Skip to content

Instantly share code, notes, and snippets.

@jiahut
Created July 8, 2025 08:53
Show Gist options
  • Save jiahut/188b1c5b1deafaa8c5aa591829ff770a to your computer and use it in GitHub Desktop.
Save jiahut/188b1c5b1deafaa8c5aa591829ff770a to your computer and use it in GitHub Desktop.
#!/bin/sh
':' //; exec "$(command -v bun || command -v node)" "$0" "$@"
var vZ=Object.create;var{getPrototypeOf:PZ,defineProperty:GG,getOwnPropertyNames:_Z}=Object;var EZ=Object.prototype.hasOwnProperty;var XG=(A,Q,I)=>{I=A!=null?vZ(PZ(A)):{};let J=Q||!A||!A.__esModule?GG(I,"default",{value:A,enumerable:!0}):I;for(let $ of _Z(A))if(!EZ.call(J,$))GG(J,$,{get:()=>A[$],enumerable:!0});return J};var cA=(A,Q)=>()=>(Q||A((Q={exports:{}}).exports,Q),Q.exports);var EA=import.meta.require;var CI=cA((gZ)=>{class _J extends Error{constructor(A,Q,I){super(I);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=Q,this.exitCode=A,this.nestedError=void 0}}class CG extends _J{constructor(A){super(1,"commander.invalidArgument",A);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}gZ.CommanderError=_J;gZ.InvalidArgumentError=CG});var uI=cA((hZ)=>{var{InvalidArgumentError:yZ}=CI();class ZG{constructor(A,Q){switch(this.description=Q||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,A[0]){case"<":this.required=!0,this._name=A.slice(1,-1);break;case"[":this.required=!1,this._name=A.slice(1,-1);break;default:this.required=!0,this._name=A;break}if(this._name.length>3&&this._name.slice(-3)==="...")this.variadic=!0,this._name=this._name.slice(0,-3)}name(){return this._name}_concatValue(A,Q){if(Q===this.defaultValue||!Array.isArray(Q))return[A];return Q.concat(A)}default(A,Q){return this.defaultValue=A,this.defaultValueDescription=Q,this}argParser(A){return this.parseArg=A,this}choices(A){return this.argChoices=A.slice(),this.parseArg=(Q,I)=>{if(!this.argChoices.includes(Q))throw new yZ(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._concatValue(Q,I);return Q},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function mZ(A){let Q=A.name()+(A.variadic===!0?"...":"");return A.required?"<"+Q+">":"["+Q+"]"}hZ.Argument=ZG;hZ.humanReadableArgName=mZ});var EJ=cA((dZ)=>{var{humanReadableArgName:fZ}=uI();class VG{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(A){let Q=A.commands.filter((I)=>!I._hidden);if(A._hasImplicitHelpCommand()){let[,I,J]=A._helpCommandnameAndArgs.match(/([^ ]+) *(.*)/),$=A.createCommand(I).helpOption(!1);if($.description(A._helpCommandDescription),J)$.arguments(J);Q.push($)}if(this.sortSubcommands)Q.sort((I,J)=>{return I.name().localeCompare(J.name())});return Q}compareOptions(A,Q){let I=(J)=>{return J.short?J.short.replace(/^-/,""):J.long.replace(/^--/,"")};return I(A).localeCompare(I(Q))}visibleOptions(A){let Q=A.options.filter(($)=>!$.hidden),I=A._hasHelpOption&&A._helpShortFlag&&!A._findOption(A._helpShortFlag),J=A._hasHelpOption&&!A._findOption(A._helpLongFlag);if(I||J){let $;if(!I)$=A.createOption(A._helpLongFlag,A._helpDescription);else if(!J)$=A.createOption(A._helpShortFlag,A._helpDescription);else $=A.createOption(A._helpFlags,A._helpDescription);Q.push($)}if(this.sortOptions)Q.sort(this.compareOptions);return Q}visibleGlobalOptions(A){if(!this.showGlobalOptions)return[];let Q=[];for(let I=A.parent;I;I=I.parent){let J=I.options.filter(($)=>!$.hidden);Q.push(...J)}if(this.sortOptions)Q.sort(this.compareOptions);return Q}visibleArguments(A){if(A._argsDescription)A.registeredArguments.forEach((Q)=>{Q.description=Q.description||A._argsDescription[Q.name()]||""});if(A.registeredArguments.find((Q)=>Q.description))return A.registeredArguments;return[]}subcommandTerm(A){let Q=A.registeredArguments.map((I)=>fZ(I)).join(" ");return A._name+(A._aliases[0]?"|"+A._aliases[0]:"")+(A.options.length?" [options]":"")+(Q?" "+Q:"")}optionTerm(A){return A.flags}argumentTerm(A){return A.name()}longestSubcommandTermLength(A,Q){return Q.visibleCommands(A).reduce((I,J)=>{return Math.max(I,Q.subcommandTerm(J).length)},0)}longestOptionTermLength(A,Q){return Q.visibleOptions(A).reduce((I,J)=>{return Math.max(I,Q.optionTerm(J).length)},0)}longestGlobalOptionTermLength(A,Q){return Q.visibleGlobalOptions(A).reduce((I,J)=>{return Math.max(I,Q.optionTerm(J).length)},0)}longestArgumentTermLength(A,Q){return Q.visibleArguments(A).reduce((I,J)=>{return Math.max(I,Q.argumentTerm(J).length)},0)}commandUsage(A){let Q=A._name;if(A._aliases[0])Q=Q+"|"+A._aliases[0];let I="";for(let J=A.parent;J;J=J.parent)I=J.name()+" "+I;return I+Q+" "+A.usage()}commandDescription(A){return A.description()}subcommandDescription(A){return A.summary()||A.description()}optionDescription(A){let Q=[];if(A.argChoices)Q.push(`choices: ${A.argChoices.map((I)=>JSON.stringify(I)).join(", ")}`);if(A.defaultValue!==void 0){if(A.required||A.optional||A.isBoolean()&&typeof A.defaultValue==="boolean")Q.push(`default: ${A.defaultValueDescription||JSON.stringify(A.defaultValue)}`)}if(A.presetArg!==void 0&&A.optional)Q.push(`preset: ${JSON.stringify(A.presetArg)}`);if(A.envVar!==void 0)Q.push(`env: ${A.envVar}`);if(Q.length>0)return`${A.description} (${Q.join(", ")})`;return A.description}argumentDescription(A){let Q=[];if(A.argChoices)Q.push(`choices: ${A.argChoices.map((I)=>JSON.stringify(I)).join(", ")}`);if(A.defaultValue!==void 0)Q.push(`default: ${A.defaultValueDescription||JSON.stringify(A.defaultValue)}`);if(Q.length>0){let I=`(${Q.join(", ")})`;if(A.description)return`${A.description} ${I}`;return I}return A.description}formatHelp(A,Q){let I=Q.padWidth(A,Q),J=Q.helpWidth||80,$=2,G=2;function X(D,R){if(R){let N=`${D.padEnd(I+2)}${R}`;return Q.wrap(N,J-2,I+2)}return D}function C(D){return D.join(`
`).replace(/^/gm," ".repeat(2))}let Z=[`Usage: ${Q.commandUsage(A)}`,""],Y=Q.commandDescription(A);if(Y.length>0)Z=Z.concat([Q.wrap(Y,J,0),""]);let z=Q.visibleArguments(A).map((D)=>{return X(Q.argumentTerm(D),Q.argumentDescription(D))});if(z.length>0)Z=Z.concat(["Arguments:",C(z),""]);let B=Q.visibleOptions(A).map((D)=>{return X(Q.optionTerm(D),Q.optionDescription(D))});if(B.length>0)Z=Z.concat(["Options:",C(B),""]);if(this.showGlobalOptions){let D=Q.visibleGlobalOptions(A).map((R)=>{return X(Q.optionTerm(R),Q.optionDescription(R))});if(D.length>0)Z=Z.concat(["Global Options:",C(D),""])}let q=Q.visibleCommands(A).map((D)=>{return X(Q.subcommandTerm(D),Q.subcommandDescription(D))});if(q.length>0)Z=Z.concat(["Commands:",C(q),""]);return Z.join(`
`)}padWidth(A,Q){return Math.max(Q.longestOptionTermLength(A,Q),Q.longestGlobalOptionTermLength(A,Q),Q.longestSubcommandTermLength(A,Q),Q.longestArgumentTermLength(A,Q))}wrap(A,Q,I,J=40){let G=new RegExp(`[\\n][${" \\f\\t\\v\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF"}]+`);if(A.match(G))return A;let X=Q-I;if(X<J)return A;let C=A.slice(0,I),Z=A.slice(I).replace(`\r
`,`
`),Y=" ".repeat(I),B=`\\s${"\u200B"}`,q=new RegExp(`
|.{1,${X-1}}([${B}]|$)|[^${B}]+?([${B}]|$)`,"g"),D=Z.match(q)||[];return C+D.map((R,N)=>{if(R===`
`)return"";return(N>0?Y:"")+R.trimEnd()}).join(`
`)}}dZ.Help=VG});var gJ=cA((oZ)=>{var{InvalidArgumentError:cZ}=CI();class zG{constructor(A,Q){this.flags=A,this.description=Q||"",this.required=A.includes("<"),this.optional=A.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(A),this.mandatory=!1;let I=jG(A);if(this.short=I.shortFlag,this.long=I.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}default(A,Q){return this.defaultValue=A,this.defaultValueDescription=Q,this}preset(A){return this.presetArg=A,this}conflicts(A){return this.conflictsWith=this.conflictsWith.concat(A),this}implies(A){let Q=A;if(typeof A==="string")Q={[A]:!0};return this.implied=Object.assign(this.implied||{},Q),this}env(A){return this.envVar=A,this}argParser(A){return this.parseArg=A,this}makeOptionMandatory(A=!0){return this.mandatory=!!A,this}hideHelp(A=!0){return this.hidden=!!A,this}_concatValue(A,Q){if(Q===this.defaultValue||!Array.isArray(Q))return[A];return Q.concat(A)}choices(A){return this.argChoices=A.slice(),this.parseArg=(Q,I)=>{if(!this.argChoices.includes(Q))throw new cZ(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._concatValue(Q,I);return Q},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){return iZ(this.name().replace(/^no-/,""))}is(A){return this.short===A||this.long===A}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class YG{constructor(A){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,A.forEach((Q)=>{if(Q.negate)this.negativeOptions.set(Q.attributeName(),Q);else this.positiveOptions.set(Q.attributeName(),Q)}),this.negativeOptions.forEach((Q,I)=>{if(this.positiveOptions.has(I))this.dualOptions.add(I)})}valueFromOption(A,Q){let I=Q.attributeName();if(!this.dualOptions.has(I))return!0;let J=this.negativeOptions.get(I).presetArg,$=J!==void 0?J:!1;return Q.negate===($===A)}}function iZ(A){return A.split("-").reduce((Q,I)=>{return Q+I[0].toUpperCase()+I.slice(1)})}function jG(A){let Q,I,J=A.split(/[ |,]+/);if(J.length>1&&!/^[[<]/.test(J[1]))Q=J.shift();if(I=J.shift(),!Q&&/^-[^-]$/.test(I))Q=I,I=void 0;return{shortFlag:Q,longFlag:I}}oZ.Option=zG;oZ.splitOptionFlags=jG;oZ.DualOptions=YG});var BG=cA((tZ)=>{function rZ(A,Q){if(Math.abs(A.length-Q.length)>3)return Math.max(A.length,Q.length);let I=[];for(let J=0;J<=A.length;J++)I[J]=[J];for(let J=0;J<=Q.length;J++)I[0][J]=J;for(let J=1;J<=Q.length;J++)for(let $=1;$<=A.length;$++){let G=1;if(A[$-1]===Q[J-1])G=0;else G=1;if(I[$][J]=Math.min(I[$-1][J]+1,I[$][J-1]+1,I[$-1][J-1]+G),$>1&&J>1&&A[$-1]===Q[J-2]&&A[$-2]===Q[J-1])I[$][J]=Math.min(I[$][J],I[$-2][J-2]+1)}return I[A.length][Q.length]}function aZ(A,Q){if(!Q||Q.length===0)return"";Q=Array.from(new Set(Q));let I=A.startsWith("--");if(I)A=A.slice(2),Q=Q.map((X)=>X.slice(2));let J=[],$=3,G=0.4;if(Q.forEach((X)=>{if(X.length<=1)return;let C=rZ(A,X),Z=Math.max(A.length,X.length);if((Z-C)/Z>G){if(C<$)$=C,J=[X];else if(C===$)J.push(X)}}),J.sort((X,C)=>X.localeCompare(C)),I)J=J.map((X)=>`--${X}`);if(J.length>1)return`
(Did you mean one of ${J.join(", ")}?)`;if(J.length===1)return`
(Did you mean ${J[0]}?)`;return""}tZ.suggestSimilar=aZ});var DG=cA((X8)=>{var A8=EA("events").EventEmitter,SJ=EA("child_process"),A0=EA("path"),kJ=EA("fs"),CQ=EA("process"),{Argument:Q8,humanReadableArgName:I8}=uI(),{CommanderError:yJ}=CI(),{Help:J8}=EJ(),{Option:WG,splitOptionFlags:$8,DualOptions:G8}=gJ(),{suggestSimilar:HG}=BG();class mJ extends A8{constructor(A){super();this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=A||"",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._outputConfiguration={writeOut:(Q)=>CQ.stdout.write(Q),writeErr:(Q)=>CQ.stderr.write(Q),getOutHelpWidth:()=>CQ.stdout.isTTY?CQ.stdout.columns:void 0,getErrHelpWidth:()=>CQ.stderr.isTTY?CQ.stderr.columns:void 0,outputError:(Q,I)=>I(Q)},this._hidden=!1,this._hasHelpOption=!0,this._helpFlags="-h, --help",this._helpDescription="display help for command",this._helpShortFlag="-h",this._helpLongFlag="--help",this._addImplicitHelpCommand=void 0,this._helpCommandName="help",this._helpCommandnameAndArgs="help [command]",this._helpCommandDescription="display help for command",this._helpConfiguration={}}copyInheritedSettings(A){return this._outputConfiguration=A._outputConfiguration,this._hasHelpOption=A._hasHelpOption,this._helpFlags=A._helpFlags,this._helpDescription=A._helpDescription,this._helpShortFlag=A._helpShortFlag,this._helpLongFlag=A._helpLongFlag,this._helpCommandName=A._helpCommandName,this._helpCommandnameAndArgs=A._helpCommandnameAndArgs,this._helpCommandDescription=A._helpCommandDescription,this._helpConfiguration=A._helpConfiguration,this._exitCallback=A._exitCallback,this._storeOptionsAsProperties=A._storeOptionsAsProperties,this._combineFlagAndOptionalValue=A._combineFlagAndOptionalValue,this._allowExcessArguments=A._allowExcessArguments,this._enablePositionalOptions=A._enablePositionalOptions,this._showHelpAfterError=A._showHelpAfterError,this._showSuggestionAfterError=A._showSuggestionAfterError,this}_getCommandAndAncestors(){let A=[];for(let Q=this;Q;Q=Q.parent)A.push(Q);return A}command(A,Q,I){let J=Q,$=I;if(typeof J==="object"&&J!==null)$=J,J=null;$=$||{};let[,G,X]=A.match(/([^ ]+) *(.*)/),C=this.createCommand(G);if(J)C.description(J),C._executableHandler=!0;if($.isDefault)this._defaultCommandName=C._name;if(C._hidden=!!($.noHelp||$.hidden),C._executableFile=$.executableFile||null,X)C.arguments(X);if(this.commands.push(C),C.parent=this,C.copyInheritedSettings(this),J)return this;return C}createCommand(A){return new mJ(A)}createHelp(){return Object.assign(new J8,this.configureHelp())}configureHelp(A){if(A===void 0)return this._helpConfiguration;return this._helpConfiguration=A,this}configureOutput(A){if(A===void 0)return this._outputConfiguration;return Object.assign(this._outputConfiguration,A),this}showHelpAfterError(A=!0){if(typeof A!=="string")A=!!A;return this._showHelpAfterError=A,this}showSuggestionAfterError(A=!0){return this._showSuggestionAfterError=!!A,this}addCommand(A,Q){if(!A._name)throw new Error(`Command passed to .addCommand() must have a name
- specify the name in Command constructor or using .name()`);if(Q=Q||{},Q.isDefault)this._defaultCommandName=A._name;if(Q.noHelp||Q.hidden)A._hidden=!0;return this.commands.push(A),A.parent=this,this}createArgument(A,Q){return new Q8(A,Q)}argument(A,Q,I,J){let $=this.createArgument(A,Q);if(typeof I==="function")$.default(J).argParser(I);else $.default(I);return this.addArgument($),this}arguments(A){return A.trim().split(/ +/).forEach((Q)=>{this.argument(Q)}),this}addArgument(A){let Q=this.registeredArguments.slice(-1)[0];if(Q&&Q.variadic)throw new Error(`only the last argument can be variadic '${Q.name()}'`);if(A.required&&A.defaultValue!==void 0&&A.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${A.name()}'`);return this.registeredArguments.push(A),this}addHelpCommand(A,Q){if(A===!1)this._addImplicitHelpCommand=!1;else{if(this._addImplicitHelpCommand=!0,typeof A==="string")this._helpCommandName=A.split(" ")[0],this._helpCommandnameAndArgs=A;this._helpCommandDescription=Q||this._helpCommandDescription}return this}_hasImplicitHelpCommand(){if(this._addImplicitHelpCommand===void 0)return this.commands.length&&!this._actionHandler&&!this._findCommand("help");return this._addImplicitHelpCommand}hook(A,Q){let I=["preSubcommand","preAction","postAction"];if(!I.includes(A))throw new Error(`Unexpected value for event passed to hook : '${A}'.
Expecting one of '${I.join("', '")}'`);if(this._lifeCycleHooks[A])this._lifeCycleHooks[A].push(Q);else this._lifeCycleHooks[A]=[Q];return this}exitOverride(A){if(A)this._exitCallback=A;else this._exitCallback=(Q)=>{if(Q.code!=="commander.executeSubCommandAsync")throw Q};return this}_exit(A,Q,I){if(this._exitCallback)this._exitCallback(new yJ(A,Q,I));CQ.exit(A)}action(A){let Q=(I)=>{let J=this.registeredArguments.length,$=I.slice(0,J);if(this._storeOptionsAsProperties)$[J]=this;else $[J]=this.opts();return $.push(this),A.apply(this,$)};return this._actionHandler=Q,this}createOption(A,Q){return new WG(A,Q)}_callParseArg(A,Q,I,J){try{return A.parseArg(Q,I)}catch($){if($.code==="commander.invalidArgument"){let G=`${J} ${$.message}`;this.error(G,{exitCode:$.exitCode,code:$.code})}throw $}}addOption(A){let Q=A.name(),I=A.attributeName();if(A.negate){let $=A.long.replace(/^--no-/,"--");if(!this._findOption($))this.setOptionValueWithSource(I,A.defaultValue===void 0?!0:A.defaultValue,"default")}else if(A.defaultValue!==void 0)this.setOptionValueWithSource(I,A.defaultValue,"default");this.options.push(A);let J=($,G,X)=>{if($==null&&A.presetArg!==void 0)$=A.presetArg;let C=this.getOptionValue(I);if($!==null&&A.parseArg)$=this._callParseArg(A,$,C,G);else if($!==null&&A.variadic)$=A._concatValue($,C);if($==null)if(A.negate)$=!1;else if(A.isBoolean()||A.optional)$=!0;else $="";this.setOptionValueWithSource(I,$,X)};if(this.on("option:"+Q,($)=>{let G=`error: option '${A.flags}' argument '${$}' is invalid.`;J($,G,"cli")}),A.envVar)this.on("optionEnv:"+Q,($)=>{let G=`error: option '${A.flags}' value '${$}' from env '${A.envVar}' is invalid.`;J($,G,"env")});return this}_optionEx(A,Q,I,J,$){if(typeof Q==="object"&&Q instanceof WG)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let G=this.createOption(Q,I);if(G.makeOptionMandatory(!!A.mandatory),typeof J==="function")G.default($).argParser(J);else if(J instanceof RegExp){let X=J;J=(C,Z)=>{let Y=X.exec(C);return Y?Y[0]:Z},G.default($).argParser(J)}else G.default(J);return this.addOption(G)}option(A,Q,I,J){return this._optionEx({},A,Q,I,J)}requiredOption(A,Q,I,J){return this._optionEx({mandatory:!0},A,Q,I,J)}combineFlagAndOptionalValue(A=!0){return this._combineFlagAndOptionalValue=!!A,this}allowUnknownOption(A=!0){return this._allowUnknownOption=!!A,this}allowExcessArguments(A=!0){return this._allowExcessArguments=!!A,this}enablePositionalOptions(A=!0){return this._enablePositionalOptions=!!A,this}passThroughOptions(A=!0){if(this._passThroughOptions=!!A,!!this.parent&&A&&!this.parent._enablePositionalOptions)throw new Error("passThroughOptions can not be used without turning on enablePositionalOptions for parent command(s)");return this}storeOptionsAsProperties(A=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");return this._storeOptionsAsProperties=!!A,this}getOptionValue(A){if(this._storeOptionsAsProperties)return this[A];return this._optionValues[A]}setOptionValue(A,Q){return this.setOptionValueWithSource(A,Q,void 0)}setOptionValueWithSource(A,Q,I){if(this._storeOptionsAsProperties)this[A]=Q;else this._optionValues[A]=Q;return this._optionValueSources[A]=I,this}getOptionValueSource(A){return this._optionValueSources[A]}getOptionValueSourceWithGlobals(A){let Q;return this._getCommandAndAncestors().forEach((I)=>{if(I.getOptionValueSource(A)!==void 0)Q=I.getOptionValueSource(A)}),Q}_prepareUserArgs(A,Q){if(A!==void 0&&!Array.isArray(A))throw new Error("first parameter to parse must be array or undefined");if(Q=Q||{},A===void 0){if(A=CQ.argv,CQ.versions&&CQ.versions.electron)Q.from="electron"}this.rawArgs=A.slice();let I;switch(Q.from){case void 0:case"node":this._scriptPath=A[1],I=A.slice(2);break;case"electron":if(CQ.defaultApp)this._scriptPath=A[1],I=A.slice(2);else I=A.slice(1);break;case"user":I=A.slice(0);break;default:throw new Error(`unexpected parse option { from: '${Q.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",I}parse(A,Q){let I=this._prepareUserArgs(A,Q);return this._parseCommand([],I),this}async parseAsync(A,Q){let I=this._prepareUserArgs(A,Q);return await this._parseCommand([],I),this}_executeSubCommand(A,Q){Q=Q.slice();let I=!1,J=[".js",".ts",".tsx",".mjs",".cjs"];function $(Y,z){let B=A0.resolve(Y,z);if(kJ.existsSync(B))return B;if(J.includes(A0.extname(z)))return;let q=J.find((D)=>kJ.existsSync(`${B}${D}`));if(q)return`${B}${q}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let G=A._executableFile||`${this._name}-${A._name}`,X=this._executableDir||"";if(this._scriptPath){let Y;try{Y=kJ.realpathSync(this._scriptPath)}catch(z){Y=this._scriptPath}X=A0.resolve(A0.dirname(Y),X)}if(X){let Y=$(X,G);if(!Y&&!A._executableFile&&this._scriptPath){let z=A0.basename(this._scriptPath,A0.extname(this._scriptPath));if(z!==this._name)Y=$(X,`${z}-${A._name}`)}G=Y||G}I=J.includes(A0.extname(G));let C;if(CQ.platform!=="win32")if(I)Q.unshift(G),Q=qG(CQ.execArgv).concat(Q),C=SJ.spawn(CQ.argv[0],Q,{stdio:"inherit"});else C=SJ.spawn(G,Q,{stdio:"inherit"});else Q.unshift(G),Q=qG(CQ.execArgv).concat(Q),C=SJ.spawn(CQ.execPath,Q,{stdio:"inherit"});if(!C.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((z)=>{CQ.on(z,()=>{if(C.killed===!1&&C.exitCode===null)C.kill(z)})});let Z=this._exitCallback;if(!Z)C.on("close",CQ.exit.bind(CQ));else C.on("close",()=>{Z(new yJ(CQ.exitCode||0,"commander.executeSubCommandAsync","(close)"))});C.on("error",(Y)=>{if(Y.code==="ENOENT"){let z=X?`searched for local subcommand relative to directory '${X}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",B=`'${G}' does not exist
- if '${A._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
- ${z}`;throw new Error(B)}else if(Y.code==="EACCES")throw new Error(`'${G}' not executable`);if(!Z)CQ.exit(1);else{let z=new yJ(1,"commander.executeSubCommandAsync","(error)");z.nestedError=Y,Z(z)}}),this.runningCommand=C}_dispatchSubcommand(A,Q,I){let J=this._findCommand(A);if(!J)this.help({error:!0});let $;return $=this._chainOrCallSubCommandHook($,J,"preSubcommand"),$=this._chainOrCall($,()=>{if(J._executableHandler)this._executeSubCommand(J,Q.concat(I));else return J._parseCommand(Q,I)}),$}_dispatchHelpCommand(A){if(!A)this.help();let Q=this._findCommand(A);if(Q&&!Q._executableHandler)Q.help();return this._dispatchSubcommand(A,[],[this._helpLongFlag||this._helpShortFlag])}_checkNumberOfArguments(){if(this.registeredArguments.forEach((A,Q)=>{if(A.required&&this.args[Q]==null)this.missingArgument(A.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 A=(I,J,$)=>{let G=J;if(J!==null&&I.parseArg){let X=`error: command-argument value '${J}' is invalid for argument '${I.name()}'.`;G=this._callParseArg(I,J,$,X)}return G};this._checkNumberOfArguments();let Q=[];this.registeredArguments.forEach((I,J)=>{let $=I.defaultValue;if(I.variadic){if(J<this.args.length){if($=this.args.slice(J),I.parseArg)$=$.reduce((G,X)=>{return A(I,X,G)},I.defaultValue)}else if($===void 0)$=[]}else if(J<this.args.length){if($=this.args[J],I.parseArg)$=A(I,$,I.defaultValue)}Q[J]=$}),this.processedArgs=Q}_chainOrCall(A,Q){if(A&&A.then&&typeof A.then==="function")return A.then(()=>Q());return Q()}_chainOrCallHooks(A,Q){let I=A,J=[];if(this._getCommandAndAncestors().reverse().filter(($)=>$._lifeCycleHooks[Q]!==void 0).forEach(($)=>{$._lifeCycleHooks[Q].forEach((G)=>{J.push({hookedCommand:$,callback:G})})}),Q==="postAction")J.reverse();return J.forEach(($)=>{I=this._chainOrCall(I,()=>{return $.callback($.hookedCommand,this)})}),I}_chainOrCallSubCommandHook(A,Q,I){let J=A;if(this._lifeCycleHooks[I]!==void 0)this._lifeCycleHooks[I].forEach(($)=>{J=this._chainOrCall(J,()=>{return $(this,Q)})});return J}_parseCommand(A,Q){let I=this.parseOptions(Q);if(this._parseOptionsEnv(),this._parseOptionsImplied(),A=A.concat(I.operands),Q=I.unknown,this.args=A.concat(Q),A&&this._findCommand(A[0]))return this._dispatchSubcommand(A[0],A.slice(1),Q);if(this._hasImplicitHelpCommand()&&A[0]===this._helpCommandName)return this._dispatchHelpCommand(A[1]);if(this._defaultCommandName)return FG(this,Q),this._dispatchSubcommand(this._defaultCommandName,A,Q);if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName)this.help({error:!0});FG(this,I.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let J=()=>{if(I.unknown.length>0)this.unknownOption(I.unknown[0])},$=`command:${this.name()}`;if(this._actionHandler){J(),this._processArguments();let G;if(G=this._chainOrCallHooks(G,"preAction"),G=this._chainOrCall(G,()=>this._actionHandler(this.processedArgs)),this.parent)G=this._chainOrCall(G,()=>{this.parent.emit($,A,Q)});return G=this._chainOrCallHooks(G,"postAction"),G}if(this.parent&&this.parent.listenerCount($))J(),this._processArguments(),this.parent.emit($,A,Q);else if(A.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",A,Q);if(this.listenerCount("command:*"))this.emit("command:*",A,Q);else if(this.commands.length)this.unknownCommand();else J(),this._processArguments()}else if(this.commands.length)J(),this.help({error:!0});else J(),this._processArguments()}_findCommand(A){if(!A)return;return this.commands.find((Q)=>Q._name===A||Q._aliases.includes(A))}_findOption(A){return this.options.find((Q)=>Q.is(A))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach((A)=>{A.options.forEach((Q)=>{if(Q.mandatory&&A.getOptionValue(Q.attributeName())===void 0)A.missingMandatoryOptionValue(Q)})})}_checkForConflictingLocalOptions(){let A=this.options.filter((I)=>{let J=I.attributeName();if(this.getOptionValue(J)===void 0)return!1;return this.getOptionValueSource(J)!=="default"});A.filter((I)=>I.conflictsWith.length>0).forEach((I)=>{let J=A.find(($)=>I.conflictsWith.includes($.attributeName()));if(J)this._conflictingOption(I,J)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach((A)=>{A._checkForConflictingLocalOptions()})}parseOptions(A){let Q=[],I=[],J=Q,$=A.slice();function G(C){return C.length>1&&C[0]==="-"}let X=null;while($.length){let C=$.shift();if(C==="--"){if(J===I)J.push(C);J.push(...$);break}if(X&&!G(C)){this.emit(`option:${X.name()}`,C);continue}if(X=null,G(C)){let Z=this._findOption(C);if(Z){if(Z.required){let Y=$.shift();if(Y===void 0)this.optionMissingArgument(Z);this.emit(`option:${Z.name()}`,Y)}else if(Z.optional){let Y=null;if($.length>0&&!G($[0]))Y=$.shift();this.emit(`option:${Z.name()}`,Y)}else this.emit(`option:${Z.name()}`);X=Z.variadic?Z:null;continue}}if(C.length>2&&C[0]==="-"&&C[1]!=="-"){let Z=this._findOption(`-${C[1]}`);if(Z){if(Z.required||Z.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${Z.name()}`,C.slice(2));else this.emit(`option:${Z.name()}`),$.unshift(`-${C.slice(2)}`);continue}}if(/^--[^=]+=/.test(C)){let Z=C.indexOf("="),Y=this._findOption(C.slice(0,Z));if(Y&&(Y.required||Y.optional)){this.emit(`option:${Y.name()}`,C.slice(Z+1));continue}}if(G(C))J=I;if((this._enablePositionalOptions||this._passThroughOptions)&&Q.length===0&&I.length===0){if(this._findCommand(C)){if(Q.push(C),$.length>0)I.push(...$);break}else if(C===this._helpCommandName&&this._hasImplicitHelpCommand()){if(Q.push(C),$.length>0)Q.push(...$);break}else if(this._defaultCommandName){if(I.push(C),$.length>0)I.push(...$);break}}if(this._passThroughOptions){if(J.push(C),$.length>0)J.push(...$);break}J.push(C)}return{operands:Q,unknown:I}}opts(){if(this._storeOptionsAsProperties){let A={},Q=this.options.length;for(let I=0;I<Q;I++){let J=this.options[I].attributeName();A[J]=J===this._versionOptionName?this._version:this[J]}return A}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((A,Q)=>Object.assign(A,Q.opts()),{})}error(A,Q){if(this._outputConfiguration.outputError(`${A}
`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==="string")this._outputConfiguration.writeErr(`${this._showHelpAfterError}
`);else if(this._showHelpAfterError)this._outputConfiguration.writeErr(`
`),this.outputHelp({error:!0});let I=Q||{},J=I.exitCode||1,$=I.code||"commander.error";this._exit(J,$,A)}_parseOptionsEnv(){this.options.forEach((A)=>{if(A.envVar&&A.envVar in CQ.env){let Q=A.attributeName();if(this.getOptionValue(Q)===void 0||["default","config","env"].includes(this.getOptionValueSource(Q)))if(A.required||A.optional)this.emit(`optionEnv:${A.name()}`,CQ.env[A.envVar]);else this.emit(`optionEnv:${A.name()}`)}})}_parseOptionsImplied(){let A=new G8(this.options),Q=(I)=>{return this.getOptionValue(I)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(I))};this.options.filter((I)=>I.implied!==void 0&&Q(I.attributeName())&&A.valueFromOption(this.getOptionValue(I.attributeName()),I)).forEach((I)=>{Object.keys(I.implied).filter((J)=>!Q(J)).forEach((J)=>{this.setOptionValueWithSource(J,I.implied[J],"implied")})})}missingArgument(A){let Q=`error: missing required argument '${A}'`;this.error(Q,{code:"commander.missingArgument"})}optionMissingArgument(A){let Q=`error: option '${A.flags}' argument missing`;this.error(Q,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(A){let Q=`error: required option '${A.flags}' not specified`;this.error(Q,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(A,Q){let I=(G)=>{let X=G.attributeName(),C=this.getOptionValue(X),Z=this.options.find((z)=>z.negate&&X===z.attributeName()),Y=this.options.find((z)=>!z.negate&&X===z.attributeName());if(Z&&(Z.presetArg===void 0&&C===!1||Z.presetArg!==void 0&&C===Z.presetArg))return Z;return Y||G},J=(G)=>{let X=I(G),C=X.attributeName();if(this.getOptionValueSource(C)==="env")return`environment variable '${X.envVar}'`;return`option '${X.flags}'`},$=`error: ${J(A)} cannot be used with ${J(Q)}`;this.error($,{code:"commander.conflictingOption"})}unknownOption(A){if(this._allowUnknownOption)return;let Q="";if(A.startsWith("--")&&this._showSuggestionAfterError){let J=[],$=this;do{let G=$.createHelp().visibleOptions($).filter((X)=>X.long).map((X)=>X.long);J=J.concat(G),$=$.parent}while($&&!$._enablePositionalOptions);Q=HG(A,J)}let I=`error: unknown option '${A}'${Q}`;this.error(I,{code:"commander.unknownOption"})}_excessArguments(A){if(this._allowExcessArguments)return;let Q=this.registeredArguments.length,I=Q===1?"":"s",$=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${Q} argument${I} but got ${A.length}.`;this.error($,{code:"commander.excessArguments"})}unknownCommand(){let A=this.args[0],Q="";if(this._showSuggestionAfterError){let J=[];this.createHelp().visibleCommands(this).forEach(($)=>{if(J.push($.name()),$.alias())J.push($.alias())}),Q=HG(A,J)}let I=`error: unknown command '${A}'${Q}`;this.error(I,{code:"commander.unknownCommand"})}version(A,Q,I){if(A===void 0)return this._version;this._version=A,Q=Q||"-V, --version",I=I||"output the version number";let J=this.createOption(Q,I);return this._versionOptionName=J.attributeName(),this.options.push(J),this.on("option:"+J.name(),()=>{this._outputConfiguration.writeOut(`${A}
`),this._exit(0,"commander.version",A)}),this}description(A,Q){if(A===void 0&&Q===void 0)return this._description;if(this._description=A,Q)this._argsDescription=Q;return this}summary(A){if(A===void 0)return this._summary;return this._summary=A,this}alias(A){if(A===void 0)return this._aliases[0];let Q=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)Q=this.commands[this.commands.length-1];if(A===Q._name)throw new Error("Command alias can't be the same as its name");return Q._aliases.push(A),this}aliases(A){if(A===void 0)return this._aliases;return A.forEach((Q)=>this.alias(Q)),this}usage(A){if(A===void 0){if(this._usage)return this._usage;let Q=this.registeredArguments.map((I)=>{return I8(I)});return[].concat(this.options.length||this._hasHelpOption?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?Q:[]).join(" ")}return this._usage=A,this}name(A){if(A===void 0)return this._name;return this._name=A,this}nameFromFilename(A){return this._name=A0.basename(A,A0.extname(A)),this}executableDir(A){if(A===void 0)return this._executableDir;return this._executableDir=A,this}helpInformation(A){let Q=this.createHelp();if(Q.helpWidth===void 0)Q.helpWidth=A&&A.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth();return Q.formatHelp(this,Q)}_getHelpContext(A){A=A||{};let Q={error:!!A.error},I;if(Q.error)I=(J)=>this._outputConfiguration.writeErr(J);else I=(J)=>this._outputConfiguration.writeOut(J);return Q.write=A.write||I,Q.command=this,Q}outputHelp(A){let Q;if(typeof A==="function")Q=A,A=void 0;let I=this._getHelpContext(A);this._getCommandAndAncestors().reverse().forEach(($)=>$.emit("beforeAllHelp",I)),this.emit("beforeHelp",I);let J=this.helpInformation(I);if(Q){if(J=Q(J),typeof J!=="string"&&!Buffer.isBuffer(J))throw new Error("outputHelp callback must return a string or a Buffer")}if(I.write(J),this._helpLongFlag)this.emit(this._helpLongFlag);this.emit("afterHelp",I),this._getCommandAndAncestors().forEach(($)=>$.emit("afterAllHelp",I))}helpOption(A,Q){if(typeof A==="boolean")return this._hasHelpOption=A,this;this._helpFlags=A||this._helpFlags,this._helpDescription=Q||this._helpDescription;let I=$8(this._helpFlags);return this._helpShortFlag=I.shortFlag,this._helpLongFlag=I.longFlag,this}help(A){this.outputHelp(A);let Q=CQ.exitCode||0;if(Q===0&&A&&typeof A!=="function"&&A.error)Q=1;this._exit(Q,"commander.help","(outputHelp)")}addHelpText(A,Q){let I=["beforeAll","before","after","afterAll"];if(!I.includes(A))throw new Error(`Unexpected value for position to addHelpText.
Expecting one of '${I.join("', '")}'`);let J=`${A}Help`;return this.on(J,($)=>{let G;if(typeof Q==="function")G=Q({error:$.error,command:$.command});else G=Q;if(G)$.write(`${G}
`)}),this}}function FG(A,Q){if(A._hasHelpOption&&Q.find((J)=>J===A._helpLongFlag||J===A._helpShortFlag))A.outputHelp(),A._exit(0,"commander.helpDisplayed","(outputHelp)")}function qG(A){return A.map((Q)=>{if(!Q.startsWith("--inspect"))return Q;let I,J="127.0.0.1",$="9229",G;if((G=Q.match(/^(--inspect(-brk)?)$/))!==null)I=G[1];else if((G=Q.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(I=G[1],/^\d+$/.test(G[3]))$=G[3];else J=G[3];else if((G=Q.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)I=G[1],J=G[3],$=G[4];if(I&&$!=="0")return`${I}=${J}:${parseInt($)+1}`;return Q})}X8.Command=mJ});var MG=cA((cQ,RG)=>{var{Argument:Z8}=uI(),{Command:KG}=DG(),{CommanderError:V8,InvalidArgumentError:NG}=CI(),{Help:z8}=EJ(),{Option:Y8}=gJ();cQ=RG.exports=new KG;cQ.program=cQ;cQ.Command=KG;cQ.Option=Y8;cQ.Argument=Z8;cQ.Help=z8;cQ.CommanderError=V8;cQ.InvalidArgumentError=NG;cQ.InvalidOptionArgumentError=NG});var bI=cA((UY,wG)=>{wG.exports={newInvalidAsn1Error:function(A){var Q=new Error;return Q.name="InvalidAsn1Error",Q.message=A||"",Q}}});var fI=cA((wY,TG)=>{TG.exports={EOC:0,Boolean:1,Integer:2,BitString:3,OctetString:4,Null:5,OID:6,ObjectDescriptor:7,External:8,Real:9,Enumeration:10,PDV:11,Utf8String:12,RelativeOID:13,Sequence:16,Set:17,NumericString:18,PrintableString:19,T61String:20,VideotexString:21,IA5String:22,UTCTime:23,GeneralizedTime:24,GraphicString:25,VisibleString:26,GeneralString:28,UniversalString:29,CharacterString:30,BMPString:31,Constructor:32,Context:128}});var uJ=cA((TY,OG)=>{var dI=EA("buffer"),y0=dI.Buffer,uQ={},bQ;for(bQ in dI){if(!dI.hasOwnProperty(bQ))continue;if(bQ==="SlowBuffer"||bQ==="Buffer")continue;uQ[bQ]=dI[bQ]}var m0=uQ.Buffer={};for(bQ in y0){if(!y0.hasOwnProperty(bQ))continue;if(bQ==="allocUnsafe"||bQ==="allocUnsafeSlow")continue;m0[bQ]=y0[bQ]}uQ.Buffer.prototype=y0.prototype;if(!m0.from||m0.from===Uint8Array.from)m0.from=function(A,Q,I){if(typeof A==="number")throw new TypeError('The "value" argument must not be of type number. Received type '+typeof A);if(A&&typeof A.length==="undefined")throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof A);return y0(A,Q,I)};if(!m0.alloc)m0.alloc=function(A,Q,I){if(typeof A!=="number")throw new TypeError('The "size" argument must be of type number. Received type '+typeof A);if(A<0||A>=2147483648)throw new RangeError('The value "'+A+'" is invalid for option "size"');var J=y0(A);if(!Q||Q.length===0)J.fill(0);else if(typeof I==="string")J.fill(Q,I);else J.fill(Q);return J};if(!uQ.kStringMaxLength)try{uQ.kStringMaxLength=process.binding("buffer").kStringMaxLength}catch(A){}if(!uQ.constants){if(uQ.constants={MAX_LENGTH:uQ.kMaxLength},uQ.kStringMaxLength)uQ.constants.MAX_STRING_LENGTH=uQ.kStringMaxLength}OG.exports=uQ});var vG=cA((OY,xG)=>{var j8=EA("assert"),LG=uJ().Buffer,ZI=fI(),B8=bI(),h0=B8.newInvalidAsn1Error;function vQ(A){if(!A||!LG.isBuffer(A))throw new TypeError("data must be a node Buffer");this._buf=A,this._size=A.length,this._len=0,this._offset=0}Object.defineProperty(vQ.prototype,"length",{enumerable:!0,get:function(){return this._len}});Object.defineProperty(vQ.prototype,"offset",{enumerable:!0,get:function(){return this._offset}});Object.defineProperty(vQ.prototype,"remain",{get:function(){return this._size-this._offset}});Object.defineProperty(vQ.prototype,"buffer",{get:function(){return this._buf.slice(this._offset)}});vQ.prototype.readByte=function(A){if(this._size-this._offset<1)return null;var Q=this._buf[this._offset]&255;if(!A)this._offset+=1;return Q};vQ.prototype.peek=function(){return this.readByte(!0)};vQ.prototype.readLength=function(A){if(A===void 0)A=this._offset;if(A>=this._size)return null;var Q=this._buf[A++]&255;if(Q===null)return null;if((Q&128)===128){if(Q&=127,Q===0)throw h0("Indefinite length not supported");if(Q>4)throw h0("encoding too long");if(this._size-A<Q)return null;this._len=0;for(var I=0;I<Q;I++)this._len=(this._len<<8)+(this._buf[A++]&255)}else this._len=Q;return A};vQ.prototype.readSequence=function(A){var Q=this.peek();if(Q===null)return null;if(A!==void 0&&A!==Q)throw h0("Expected 0x"+A.toString(16)+": got 0x"+Q.toString(16));var I=this.readLength(this._offset+1);if(I===null)return null;return this._offset=I,Q};vQ.prototype.readInt=function(){return this._readTag(ZI.Integer)};vQ.prototype.readBoolean=function(){return this._readTag(ZI.Boolean)===0?!1:!0};vQ.prototype.readEnumeration=function(){return this._readTag(ZI.Enumeration)};vQ.prototype.readString=function(A,Q){if(!A)A=ZI.OctetString;var I=this.peek();if(I===null)return null;if(I!==A)throw h0("Expected 0x"+A.toString(16)+": got 0x"+I.toString(16));var J=this.readLength(this._offset+1);if(J===null)return null;if(this.length>this._size-J)return null;if(this._offset=J,this.length===0)return Q?LG.alloc(0):"";var $=this._buf.slice(this._offset,this._offset+this.length);return this._offset+=this.length,Q?$:$.toString("utf8")};vQ.prototype.readOID=function(A){if(!A)A=ZI.OID;var Q=this.readString(A,!0);if(Q===null)return null;var I=[],J=0;for(var $=0;$<Q.length;$++){var G=Q[$]&255;if(J<<=7,J+=G&127,(G&128)===0)I.push(J),J=0}return J=I.shift(),I.unshift(J%40),I.unshift(J/40>>0),I.join(".")};vQ.prototype._readTag=function(A){j8.ok(A!==void 0);var Q=this.peek();if(Q===null)return null;if(Q!==A)throw h0("Expected 0x"+A.toString(16)+": got 0x"+Q.toString(16));var I=this.readLength(this._offset+1);if(I===null)return null;if(this.length>4)throw h0("Integer too long: "+this.length);if(this.length>this._size-I)return null;this._offset=I;var J=this._buf[this._offset],$=0;for(var G=0;G<this.length;G++)$<<=8,$|=this._buf[this._offset++]&255;if((J&128)===128&&G!==4)$-=1<<G*8;return $>>0};xG.exports=vQ});var _G=cA((LY,PG)=>{var V0=EA("assert"),lI=uJ().Buffer,z0=fI(),W8=bI(),cI=W8.newInvalidAsn1Error,H8={size:1024,growthFactor:8};function F8(A,Q){V0.ok(A),V0.equal(typeof A,"object"),V0.ok(Q),V0.equal(typeof Q,"object");var I=Object.getOwnPropertyNames(A);return I.forEach(function(J){if(Q[J])return;var $=Object.getOwnPropertyDescriptor(A,J);Object.defineProperty(Q,J,$)}),Q}function LQ(A){A=F8(H8,A||{}),this._buf=lI.alloc(A.size||1024),this._size=this._buf.length,this._offset=0,this._options=A,this._seq=[]}Object.defineProperty(LQ.prototype,"buffer",{get:function(){if(this._seq.length)throw cI(this._seq.length+" unended sequence(s)");return this._buf.slice(0,this._offset)}});LQ.prototype.writeByte=function(A){if(typeof A!=="number")throw new TypeError("argument must be a Number");this._ensure(1),this._buf[this._offset++]=A};LQ.prototype.writeInt=function(A,Q){if(typeof A!=="number")throw new TypeError("argument must be a Number");if(typeof Q!=="number")Q=z0.Integer;var I=4;while(((A&4286578688)===0||(A&4286578688)===-8388608)&&I>1)I--,A<<=8;if(I>4)throw cI("BER ints cannot be > 0xffffffff");this._ensure(2+I),this._buf[this._offset++]=Q,this._buf[this._offset++]=I;while(I-- >0)this._buf[this._offset++]=(A&4278190080)>>>24,A<<=8};LQ.prototype.writeNull=function(){this.writeByte(z0.Null),this.writeByte(0)};LQ.prototype.writeEnumeration=function(A,Q){if(typeof A!=="number")throw new TypeError("argument must be a Number");if(typeof Q!=="number")Q=z0.Enumeration;return this.writeInt(A,Q)};LQ.prototype.writeBoolean=function(A,Q){if(typeof A!=="boolean")throw new TypeError("argument must be a Boolean");if(typeof Q!=="number")Q=z0.Boolean;this._ensure(3),this._buf[this._offset++]=Q,this._buf[this._offset++]=1,this._buf[this._offset++]=A?255:0};LQ.prototype.writeString=function(A,Q){if(typeof A!=="string")throw new TypeError("argument must be a string (was: "+typeof A+")");if(typeof Q!=="number")Q=z0.OctetString;var I=lI.byteLength(A);if(this.writeByte(Q),this.writeLength(I),I)this._ensure(I),this._buf.write(A,this._offset),this._offset+=I};LQ.prototype.writeBuffer=function(A,Q){if(typeof Q!=="number")throw new TypeError("tag must be a number");if(!lI.isBuffer(A))throw new TypeError("argument must be a buffer");this.writeByte(Q),this.writeLength(A.length),this._ensure(A.length),A.copy(this._buf,this._offset,0,A.length),this._offset+=A.length};LQ.prototype.writeStringArray=function(A){if(!A instanceof Array)throw new TypeError("argument must be an Array[String]");var Q=this;A.forEach(function(I){Q.writeString(I)})};LQ.prototype.writeOID=function(A,Q){if(typeof A!=="string")throw new TypeError("argument must be a string");if(typeof Q!=="number")Q=z0.OID;if(!/^([0-9]+\.){3,}[0-9]+$/.test(A))throw new Error("argument is not a valid OID string");function I(X,C){if(C<128)X.push(C);else if(C<16384)X.push(C>>>7|128),X.push(C&127);else if(C<2097152)X.push(C>>>14|128),X.push((C>>>7|128)&255),X.push(C&127);else if(C<268435456)X.push(C>>>21|128),X.push((C>>>14|128)&255),X.push((C>>>7|128)&255),X.push(C&127);else X.push((C>>>28|128)&255),X.push((C>>>21|128)&255),X.push((C>>>14|128)&255),X.push((C>>>7|128)&255),X.push(C&127)}var J=A.split("."),$=[];$.push(parseInt(J[0],10)*40+parseInt(J[1],10)),J.slice(2).forEach(function(X){I($,parseInt(X,10))});var G=this;this._ensure(2+$.length),this.writeByte(Q),this.writeLength($.length),$.forEach(function(X){G.writeByte(X)})};LQ.prototype.writeLength=function(A){if(typeof A!=="number")throw new TypeError("argument must be a Number");if(this._ensure(4),A<=127)this._buf[this._offset++]=A;else if(A<=255)this._buf[this._offset++]=129,this._buf[this._offset++]=A;else if(A<=65535)this._buf[this._offset++]=130,this._buf[this._offset++]=A>>8,this._buf[this._offset++]=A;else if(A<=16777215)this._buf[this._offset++]=131,this._buf[this._offset++]=A>>16,this._buf[this._offset++]=A>>8,this._buf[this._offset++]=A;else throw cI("Length too long (> 4 bytes)")};LQ.prototype.startSequence=function(A){if(typeof A!=="number")A=z0.Sequence|z0.Constructor;this.writeByte(A),this._seq.push(this._offset),this._ensure(3),this._offset+=3};LQ.prototype.endSequence=function(){var A=this._seq.pop(),Q=A+3,I=this._offset-Q;if(I<=127)this._shift(Q,I,-2),this._buf[A]=I;else if(I<=255)this._shift(Q,I,-1),this._buf[A]=129,this._buf[A+1]=I;else if(I<=65535)this._buf[A]=130,this._buf[A+1]=I>>8,this._buf[A+2]=I;else if(I<=16777215)this._shift(Q,I,1),this._buf[A]=131,this._buf[A+1]=I>>16,this._buf[A+2]=I>>8,this._buf[A+3]=I;else throw cI("Sequence too long")};LQ.prototype._shift=function(A,Q,I){V0.ok(A!==void 0),V0.ok(Q!==void 0),V0.ok(I),this._buf.copy(this._buf,A+I,A,A+Q),this._offset+=I};LQ.prototype._ensure=function(A){if(V0.ok(A),this._size-this._offset<A){var Q=this._size*this._options.growthFactor;if(Q-this._offset<A)Q+=A;var I=lI.alloc(Q);this._buf.copy(I,0,0,this._offset),this._buf=I,this._size=Q}};PG.exports=LQ});var EG=cA((xY,iI)=>{var bJ=bI(),fJ=fI(),q8=vG(),D8=_G();iI.exports={Reader:q8,Writer:D8};for(VI in fJ)if(fJ.hasOwnProperty(VI))iI.exports[VI]=fJ[VI];var VI;for(zI in bJ)if(bJ.hasOwnProperty(zI))iI.exports[zI]=bJ[zI];var zI});var YI=cA((vY,gG)=>{var dJ=EG();gG.exports={Ber:dJ,BerReader:dJ.Reader,BerWriter:dJ.Writer}});var SG=cA((PY,oI)=>{(function(A){var Q=function(j){var H,W=new Float64Array(16);if(j)for(H=0;H<j.length;H++)W[H]=j[H];return W},I=function(){throw new Error("no PRNG")},J=new Uint8Array(16),$=new Uint8Array(32);$[0]=9;var G=Q(),X=Q([1]),C=Q([56129,1]),Z=Q([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),Y=Q([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),z=Q([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),B=Q([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),q=Q([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function D(j,H,W,V){j[H]=W>>24&255,j[H+1]=W>>16&255,j[H+2]=W>>8&255,j[H+3]=W&255,j[H+4]=V>>24&255,j[H+5]=V>>16&255,j[H+6]=V>>8&255,j[H+7]=V&255}function R(j,H,W,V,F){var w,x=0;for(w=0;w<F;w++)x|=j[H+w]^W[V+w];return(1&x-1>>>8)-1}function N(j,H,W,V){return R(j,H,W,V,16)}function v(j,H,W,V){return R(j,H,W,V,32)}function P(j,H,W,V){var F=V[0]&255|(V[1]&255)<<8|(V[2]&255)<<16|(V[3]&255)<<24,w=W[0]&255|(W[1]&255)<<8|(W[2]&255)<<16|(W[3]&255)<<24,x=W[4]&255|(W[5]&255)<<8|(W[6]&255)<<16|(W[7]&255)<<24,c=W[8]&255|(W[9]&255)<<8|(W[10]&255)<<16|(W[11]&255)<<24,e=W[12]&255|(W[13]&255)<<8|(W[14]&255)<<16|(W[15]&255)<<24,VA=V[4]&255|(V[5]&255)<<8|(V[6]&255)<<16|(V[7]&255)<<24,XA=H[0]&255|(H[1]&255)<<8|(H[2]&255)<<16|(H[3]&255)<<24,rA=H[4]&255|(H[5]&255)<<8|(H[6]&255)<<16|(H[7]&255)<<24,ZA=H[8]&255|(H[9]&255)<<8|(H[10]&255)<<16|(H[11]&255)<<24,xA=H[12]&255|(H[13]&255)<<8|(H[14]&255)<<16|(H[15]&255)<<24,vA=V[8]&255|(V[9]&255)<<8|(V[10]&255)<<16|(V[11]&255)<<24,kA=W[16]&255|(W[17]&255)<<8|(W[18]&255)<<16|(W[19]&255)<<24,SA=W[20]&255|(W[21]&255)<<8|(W[22]&255)<<16|(W[23]&255)<<24,PA=W[24]&255|(W[25]&255)<<8|(W[26]&255)<<16|(W[27]&255)<<24,gA=W[28]&255|(W[29]&255)<<8|(W[30]&255)<<16|(W[31]&255)<<24,_A=V[12]&255|(V[13]&255)<<8|(V[14]&255)<<16|(V[15]&255)<<24,zA=F,WA=w,CA=x,YA=c,jA=e,GA=VA,y=XA,m=rA,s=ZA,l=xA,i=vA,r=kA,NA=SA,yA=PA,hA=gA,mA=_A,K;for(var bA=0;bA<20;bA+=2)K=zA+NA|0,jA^=K<<7|K>>>25,K=jA+zA|0,s^=K<<9|K>>>23,K=s+jA|0,NA^=K<<13|K>>>19,K=NA+s|0,zA^=K<<18|K>>>14,K=GA+WA|0,l^=K<<7|K>>>25,K=l+GA|0,yA^=K<<9|K>>>23,K=yA+l|0,WA^=K<<13|K>>>19,K=WA+yA|0,GA^=K<<18|K>>>14,K=i+y|0,hA^=K<<7|K>>>25,K=hA+i|0,CA^=K<<9|K>>>23,K=CA+hA|0,y^=K<<13|K>>>19,K=y+CA|0,i^=K<<18|K>>>14,K=mA+r|0,YA^=K<<7|K>>>25,K=YA+mA|0,m^=K<<9|K>>>23,K=m+YA|0,r^=K<<13|K>>>19,K=r+m|0,mA^=K<<18|K>>>14,K=zA+YA|0,WA^=K<<7|K>>>25,K=WA+zA|0,CA^=K<<9|K>>>23,K=CA+WA|0,YA^=K<<13|K>>>19,K=YA+CA|0,zA^=K<<18|K>>>14,K=GA+jA|0,y^=K<<7|K>>>25,K=y+GA|0,m^=K<<9|K>>>23,K=m+y|0,jA^=K<<13|K>>>19,K=jA+m|0,GA^=K<<18|K>>>14,K=i+l|0,r^=K<<7|K>>>25,K=r+i|0,s^=K<<9|K>>>23,K=s+r|0,l^=K<<13|K>>>19,K=l+s|0,i^=K<<18|K>>>14,K=mA+hA|0,NA^=K<<7|K>>>25,K=NA+mA|0,yA^=K<<9|K>>>23,K=yA+NA|0,hA^=K<<13|K>>>19,K=hA+yA|0,mA^=K<<18|K>>>14;zA=zA+F|0,WA=WA+w|0,CA=CA+x|0,YA=YA+c|0,jA=jA+e|0,GA=GA+VA|0,y=y+XA|0,m=m+rA|0,s=s+ZA|0,l=l+xA|0,i=i+vA|0,r=r+kA|0,NA=NA+SA|0,yA=yA+PA|0,hA=hA+gA|0,mA=mA+_A|0,j[0]=zA>>>0&255,j[1]=zA>>>8&255,j[2]=zA>>>16&255,j[3]=zA>>>24&255,j[4]=WA>>>0&255,j[5]=WA>>>8&255,j[6]=WA>>>16&255,j[7]=WA>>>24&255,j[8]=CA>>>0&255,j[9]=CA>>>8&255,j[10]=CA>>>16&255,j[11]=CA>>>24&255,j[12]=YA>>>0&255,j[13]=YA>>>8&255,j[14]=YA>>>16&255,j[15]=YA>>>24&255,j[16]=jA>>>0&255,j[17]=jA>>>8&255,j[18]=jA>>>16&255,j[19]=jA>>>24&255,j[20]=GA>>>0&255,j[21]=GA>>>8&255,j[22]=GA>>>16&255,j[23]=GA>>>24&255,j[24]=y>>>0&255,j[25]=y>>>8&255,j[26]=y>>>16&255,j[27]=y>>>24&255,j[28]=m>>>0&255,j[29]=m>>>8&255,j[30]=m>>>16&255,j[31]=m>>>24&255,j[32]=s>>>0&255,j[33]=s>>>8&255,j[34]=s>>>16&255,j[35]=s>>>24&255,j[36]=l>>>0&255,j[37]=l>>>8&255,j[38]=l>>>16&255,j[39]=l>>>24&255,j[40]=i>>>0&255,j[41]=i>>>8&255,j[42]=i>>>16&255,j[43]=i>>>24&255,j[44]=r>>>0&255,j[45]=r>>>8&255,j[46]=r>>>16&255,j[47]=r>>>24&255,j[48]=NA>>>0&255,j[49]=NA>>>8&255,j[50]=NA>>>16&255,j[51]=NA>>>24&255,j[52]=yA>>>0&255,j[53]=yA>>>8&255,j[54]=yA>>>16&255,j[55]=yA>>>24&255,j[56]=hA>>>0&255,j[57]=hA>>>8&255,j[58]=hA>>>16&255,j[59]=hA>>>24&255,j[60]=mA>>>0&255,j[61]=mA>>>8&255,j[62]=mA>>>16&255,j[63]=mA>>>24&255}function o(j,H,W,V){var F=V[0]&255|(V[1]&255)<<8|(V[2]&255)<<16|(V[3]&255)<<24,w=W[0]&255|(W[1]&255)<<8|(W[2]&255)<<16|(W[3]&255)<<24,x=W[4]&255|(W[5]&255)<<8|(W[6]&255)<<16|(W[7]&255)<<24,c=W[8]&255|(W[9]&255)<<8|(W[10]&255)<<16|(W[11]&255)<<24,e=W[12]&255|(W[13]&255)<<8|(W[14]&255)<<16|(W[15]&255)<<24,VA=V[4]&255|(V[5]&255)<<8|(V[6]&255)<<16|(V[7]&255)<<24,XA=H[0]&255|(H[1]&255)<<8|(H[2]&255)<<16|(H[3]&255)<<24,rA=H[4]&255|(H[5]&255)<<8|(H[6]&255)<<16|(H[7]&255)<<24,ZA=H[8]&255|(H[9]&255)<<8|(H[10]&255)<<16|(H[11]&255)<<24,xA=H[12]&255|(H[13]&255)<<8|(H[14]&255)<<16|(H[15]&255)<<24,vA=V[8]&255|(V[9]&255)<<8|(V[10]&255)<<16|(V[11]&255)<<24,kA=W[16]&255|(W[17]&255)<<8|(W[18]&255)<<16|(W[19]&255)<<24,SA=W[20]&255|(W[21]&255)<<8|(W[22]&255)<<16|(W[23]&255)<<24,PA=W[24]&255|(W[25]&255)<<8|(W[26]&255)<<16|(W[27]&255)<<24,gA=W[28]&255|(W[29]&255)<<8|(W[30]&255)<<16|(W[31]&255)<<24,_A=V[12]&255|(V[13]&255)<<8|(V[14]&255)<<16|(V[15]&255)<<24,zA=F,WA=w,CA=x,YA=c,jA=e,GA=VA,y=XA,m=rA,s=ZA,l=xA,i=vA,r=kA,NA=SA,yA=PA,hA=gA,mA=_A,K;for(var bA=0;bA<20;bA+=2)K=zA+NA|0,jA^=K<<7|K>>>25,K=jA+zA|0,s^=K<<9|K>>>23,K=s+jA|0,NA^=K<<13|K>>>19,K=NA+s|0,zA^=K<<18|K>>>14,K=GA+WA|0,l^=K<<7|K>>>25,K=l+GA|0,yA^=K<<9|K>>>23,K=yA+l|0,WA^=K<<13|K>>>19,K=WA+yA|0,GA^=K<<18|K>>>14,K=i+y|0,hA^=K<<7|K>>>25,K=hA+i|0,CA^=K<<9|K>>>23,K=CA+hA|0,y^=K<<13|K>>>19,K=y+CA|0,i^=K<<18|K>>>14,K=mA+r|0,YA^=K<<7|K>>>25,K=YA+mA|0,m^=K<<9|K>>>23,K=m+YA|0,r^=K<<13|K>>>19,K=r+m|0,mA^=K<<18|K>>>14,K=zA+YA|0,WA^=K<<7|K>>>25,K=WA+zA|0,CA^=K<<9|K>>>23,K=CA+WA|0,YA^=K<<13|K>>>19,K=YA+CA|0,zA^=K<<18|K>>>14,K=GA+jA|0,y^=K<<7|K>>>25,K=y+GA|0,m^=K<<9|K>>>23,K=m+y|0,jA^=K<<13|K>>>19,K=jA+m|0,GA^=K<<18|K>>>14,K=i+l|0,r^=K<<7|K>>>25,K=r+i|0,s^=K<<9|K>>>23,K=s+r|0,l^=K<<13|K>>>19,K=l+s|0,i^=K<<18|K>>>14,K=mA+hA|0,NA^=K<<7|K>>>25,K=NA+mA|0,yA^=K<<9|K>>>23,K=yA+NA|0,hA^=K<<13|K>>>19,K=hA+yA|0,mA^=K<<18|K>>>14;j[0]=zA>>>0&255,j[1]=zA>>>8&255,j[2]=zA>>>16&255,j[3]=zA>>>24&255,j[4]=GA>>>0&255,j[5]=GA>>>8&255,j[6]=GA>>>16&255,j[7]=GA>>>24&255,j[8]=i>>>0&255,j[9]=i>>>8&255,j[10]=i>>>16&255,j[11]=i>>>24&255,j[12]=mA>>>0&255,j[13]=mA>>>8&255,j[14]=mA>>>16&255,j[15]=mA>>>24&255,j[16]=y>>>0&255,j[17]=y>>>8&255,j[18]=y>>>16&255,j[19]=y>>>24&255,j[20]=m>>>0&255,j[21]=m>>>8&255,j[22]=m>>>16&255,j[23]=m>>>24&255,j[24]=s>>>0&255,j[25]=s>>>8&255,j[26]=s>>>16&255,j[27]=s>>>24&255,j[28]=l>>>0&255,j[29]=l>>>8&255,j[30]=l>>>16&255,j[31]=l>>>24&255}function k(j,H,W,V){P(j,H,W,V)}function a(j,H,W,V){o(j,H,W,V)}var t=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function u(j,H,W,V,F,w,x){var c=new Uint8Array(16),e=new Uint8Array(64),VA,XA;for(XA=0;XA<16;XA++)c[XA]=0;for(XA=0;XA<8;XA++)c[XA]=w[XA];while(F>=64){k(e,c,x,t);for(XA=0;XA<64;XA++)j[H+XA]=W[V+XA]^e[XA];VA=1;for(XA=8;XA<16;XA++)VA=VA+(c[XA]&255)|0,c[XA]=VA&255,VA>>>=8;F-=64,H+=64,V+=64}if(F>0){k(e,c,x,t);for(XA=0;XA<F;XA++)j[H+XA]=W[V+XA]^e[XA]}return 0}function M(j,H,W,V,F){var w=new Uint8Array(16),x=new Uint8Array(64),c,e;for(e=0;e<16;e++)w[e]=0;for(e=0;e<8;e++)w[e]=V[e];while(W>=64){k(x,w,F,t);for(e=0;e<64;e++)j[H+e]=x[e];c=1;for(e=8;e<16;e++)c=c+(w[e]&255)|0,w[e]=c&255,c>>>=8;W-=64,H+=64}if(W>0){k(x,w,F,t);for(e=0;e<W;e++)j[H+e]=x[e]}return 0}function _(j,H,W,V,F){var w=new Uint8Array(32);a(w,V,F,t);var x=new Uint8Array(8);for(var c=0;c<8;c++)x[c]=V[c+16];return M(j,H,W,x,w)}function E(j,H,W,V,F,w,x){var c=new Uint8Array(32);a(c,w,x,t);var e=new Uint8Array(8);for(var VA=0;VA<8;VA++)e[VA]=w[VA+16];return u(j,H,W,V,F,e,c)}var p=function(j){this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0;var H,W,V,F,w,x,c,e;H=j[0]&255|(j[1]&255)<<8,this.r[0]=H&8191,W=j[2]&255|(j[3]&255)<<8,this.r[1]=(H>>>13|W<<3)&8191,V=j[4]&255|(j[5]&255)<<8,this.r[2]=(W>>>10|V<<6)&7939,F=j[6]&255|(j[7]&255)<<8,this.r[3]=(V>>>7|F<<9)&8191,w=j[8]&255|(j[9]&255)<<8,this.r[4]=(F>>>4|w<<12)&255,this.r[5]=w>>>1&8190,x=j[10]&255|(j[11]&255)<<8,this.r[6]=(w>>>14|x<<2)&8191,c=j[12]&255|(j[13]&255)<<8,this.r[7]=(x>>>11|c<<5)&8065,e=j[14]&255|(j[15]&255)<<8,this.r[8]=(c>>>8|e<<8)&8191,this.r[9]=e>>>5&127,this.pad[0]=j[16]&255|(j[17]&255)<<8,this.pad[1]=j[18]&255|(j[19]&255)<<8,this.pad[2]=j[20]&255|(j[21]&255)<<8,this.pad[3]=j[22]&255|(j[23]&255)<<8,this.pad[4]=j[24]&255|(j[25]&255)<<8,this.pad[5]=j[26]&255|(j[27]&255)<<8,this.pad[6]=j[28]&255|(j[29]&255)<<8,this.pad[7]=j[30]&255|(j[31]&255)<<8};p.prototype.blocks=function(j,H,W){var V=this.fin?0:2048,F,w,x,c,e,VA,XA,rA,ZA,xA,vA,kA,SA,PA,gA,_A,zA,WA,CA,YA=this.h[0],jA=this.h[1],GA=this.h[2],y=this.h[3],m=this.h[4],s=this.h[5],l=this.h[6],i=this.h[7],r=this.h[8],NA=this.h[9],yA=this.r[0],hA=this.r[1],mA=this.r[2],K=this.r[3],bA=this.r[4],aA=this.r[5],tA=this.r[6],uA=this.r[7],pA=this.r[8],nA=this.r[9];while(W>=16)F=j[H+0]&255|(j[H+1]&255)<<8,YA+=F&8191,w=j[H+2]&255|(j[H+3]&255)<<8,jA+=(F>>>13|w<<3)&8191,x=j[H+4]&255|(j[H+5]&255)<<8,GA+=(w>>>10|x<<6)&8191,c=j[H+6]&255|(j[H+7]&255)<<8,y+=(x>>>7|c<<9)&8191,e=j[H+8]&255|(j[H+9]&255)<<8,m+=(c>>>4|e<<12)&8191,s+=e>>>1&8191,VA=j[H+10]&255|(j[H+11]&255)<<8,l+=(e>>>14|VA<<2)&8191,XA=j[H+12]&255|(j[H+13]&255)<<8,i+=(VA>>>11|XA<<5)&8191,rA=j[H+14]&255|(j[H+15]&255)<<8,r+=(XA>>>8|rA<<8)&8191,NA+=rA>>>5|V,ZA=0,xA=ZA,xA+=YA*yA,xA+=jA*(5*nA),xA+=GA*(5*pA),xA+=y*(5*uA),xA+=m*(5*tA),ZA=xA>>>13,xA&=8191,xA+=s*(5*aA),xA+=l*(5*bA),xA+=i*(5*K),xA+=r*(5*mA),xA+=NA*(5*hA),ZA+=xA>>>13,xA&=8191,vA=ZA,vA+=YA*hA,vA+=jA*yA,vA+=GA*(5*nA),vA+=y*(5*pA),vA+=m*(5*uA),ZA=vA>>>13,vA&=8191,vA+=s*(5*tA),vA+=l*(5*aA),vA+=i*(5*bA),vA+=r*(5*K),vA+=NA*(5*mA),ZA+=vA>>>13,vA&=8191,kA=ZA,kA+=YA*mA,kA+=jA*hA,kA+=GA*yA,kA+=y*(5*nA),kA+=m*(5*pA),ZA=kA>>>13,kA&=8191,kA+=s*(5*uA),kA+=l*(5*tA),kA+=i*(5*aA),kA+=r*(5*bA),kA+=NA*(5*K),ZA+=kA>>>13,kA&=8191,SA=ZA,SA+=YA*K,SA+=jA*mA,SA+=GA*hA,SA+=y*yA,SA+=m*(5*nA),ZA=SA>>>13,SA&=8191,SA+=s*(5*pA),SA+=l*(5*uA),SA+=i*(5*tA),SA+=r*(5*aA),SA+=NA*(5*bA),ZA+=SA>>>13,SA&=8191,PA=ZA,PA+=YA*bA,PA+=jA*K,PA+=GA*mA,PA+=y*hA,PA+=m*yA,ZA=PA>>>13,PA&=8191,PA+=s*(5*nA),PA+=l*(5*pA),PA+=i*(5*uA),PA+=r*(5*tA),PA+=NA*(5*aA),ZA+=PA>>>13,PA&=8191,gA=ZA,gA+=YA*aA,gA+=jA*bA,gA+=GA*K,gA+=y*mA,gA+=m*hA,ZA=gA>>>13,gA&=8191,gA+=s*yA,gA+=l*(5*nA),gA+=i*(5*pA),gA+=r*(5*uA),gA+=NA*(5*tA),ZA+=gA>>>13,gA&=8191,_A=ZA,_A+=YA*tA,_A+=jA*aA,_A+=GA*bA,_A+=y*K,_A+=m*mA,ZA=_A>>>13,_A&=8191,_A+=s*hA,_A+=l*yA,_A+=i*(5*nA),_A+=r*(5*pA),_A+=NA*(5*uA),ZA+=_A>>>13,_A&=8191,zA=ZA,zA+=YA*uA,zA+=jA*tA,zA+=GA*aA,zA+=y*bA,zA+=m*K,ZA=zA>>>13,zA&=8191,zA+=s*mA,zA+=l*hA,zA+=i*yA,zA+=r*(5*nA),zA+=NA*(5*pA),ZA+=zA>>>13,zA&=8191,WA=ZA,WA+=YA*pA,WA+=jA*uA,WA+=GA*tA,WA+=y*aA,WA+=m*bA,ZA=WA>>>13,WA&=8191,WA+=s*K,WA+=l*mA,WA+=i*hA,WA+=r*yA,WA+=NA*(5*nA),ZA+=WA>>>13,WA&=8191,CA=ZA,CA+=YA*nA,CA+=jA*pA,CA+=GA*uA,CA+=y*tA,CA+=m*aA,ZA=CA>>>13,CA&=8191,CA+=s*bA,CA+=l*K,CA+=i*mA,CA+=r*hA,CA+=NA*yA,ZA+=CA>>>13,CA&=8191,ZA=(ZA<<2)+ZA|0,ZA=ZA+xA|0,xA=ZA&8191,ZA=ZA>>>13,vA+=ZA,YA=xA,jA=vA,GA=kA,y=SA,m=PA,s=gA,l=_A,i=zA,r=WA,NA=CA,H+=16,W-=16;this.h[0]=YA,this.h[1]=jA,this.h[2]=GA,this.h[3]=y,this.h[4]=m,this.h[5]=s,this.h[6]=l,this.h[7]=i,this.h[8]=r,this.h[9]=NA},p.prototype.finish=function(j,H){var W=new Uint16Array(10),V,F,w,x;if(this.leftover){x=this.leftover,this.buffer[x++]=1;for(;x<16;x++)this.buffer[x]=0;this.fin=1,this.blocks(this.buffer,0,16)}V=this.h[1]>>>13,this.h[1]&=8191;for(x=2;x<10;x++)this.h[x]+=V,V=this.h[x]>>>13,this.h[x]&=8191;this.h[0]+=V*5,V=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=V,V=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=V,W[0]=this.h[0]+5,V=W[0]>>>13,W[0]&=8191;for(x=1;x<10;x++)W[x]=this.h[x]+V,V=W[x]>>>13,W[x]&=8191;W[9]-=8192,F=(V^1)-1;for(x=0;x<10;x++)W[x]&=F;F=~F;for(x=0;x<10;x++)this.h[x]=this.h[x]&F|W[x];this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,w=this.h[0]+this.pad[0],this.h[0]=w&65535;for(x=1;x<8;x++)w=(this.h[x]+this.pad[x]|0)+(w>>>16)|0,this.h[x]=w&65535;j[H+0]=this.h[0]>>>0&255,j[H+1]=this.h[0]>>>8&255,j[H+2]=this.h[1]>>>0&255,j[H+3]=this.h[1]>>>8&255,j[H+4]=this.h[2]>>>0&255,j[H+5]=this.h[2]>>>8&255,j[H+6]=this.h[3]>>>0&255,j[H+7]=this.h[3]>>>8&255,j[H+8]=this.h[4]>>>0&255,j[H+9]=this.h[4]>>>8&255,j[H+10]=this.h[5]>>>0&255,j[H+11]=this.h[5]>>>8&255,j[H+12]=this.h[6]>>>0&255,j[H+13]=this.h[6]>>>8&255,j[H+14]=this.h[7]>>>0&255,j[H+15]=this.h[7]>>>8&255},p.prototype.update=function(j,H,W){var V,F;if(this.leftover){if(F=16-this.leftover,F>W)F=W;for(V=0;V<F;V++)this.buffer[this.leftover+V]=j[H+V];if(W-=F,H+=F,this.leftover+=F,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(W>=16)F=W-W%16,this.blocks(j,H,F),H+=F,W-=F;if(W){for(V=0;V<W;V++)this.buffer[this.leftover+V]=j[H+V];this.leftover+=W}};function S(j,H,W,V,F,w){var x=new p(w);return x.update(W,V,F),x.finish(j,H),0}function QA(j,H,W,V,F,w){var x=new Uint8Array(16);return S(x,0,W,V,F,w),N(j,H,x,0)}function AA(j,H,W,V,F){var w;if(W<32)return-1;E(j,0,H,0,W,V,F),S(j,16,j,32,W-32,j);for(w=0;w<16;w++)j[w]=0;return 0}function n(j,H,W,V,F){var w,x=new Uint8Array(32);if(W<32)return-1;if(_(x,0,32,V,F),QA(H,16,H,32,W-32,x)!==0)return-1;E(j,0,H,0,W,V,F);for(w=0;w<32;w++)j[w]=0;return 0}function JA(j,H){var W;for(W=0;W<16;W++)j[W]=H[W]|0}function IA(j){var H,W,V=1;for(H=0;H<16;H++)W=j[H]+V+65535,V=Math.floor(W/65536),j[H]=W-V*65536;j[0]+=V-1+37*(V-1)}function L(j,H,W){var V,F=~(W-1);for(var w=0;w<16;w++)V=F&(j[w]^H[w]),j[w]^=V,H[w]^=V}function g(j,H){var W,V,F,w=Q(),x=Q();for(W=0;W<16;W++)x[W]=H[W];IA(x),IA(x),IA(x);for(V=0;V<2;V++){w[0]=x[0]-65517;for(W=1;W<15;W++)w[W]=x[W]-65535-(w[W-1]>>16&1),w[W-1]&=65535;w[15]=x[15]-32767-(w[14]>>16&1),F=w[15]>>16&1,w[14]&=65535,L(x,w,1-F)}for(W=0;W<16;W++)j[2*W]=x[W]&255,j[2*W+1]=x[W]>>8}function b(j,H){var W=new Uint8Array(32),V=new Uint8Array(32);return g(W,j),g(V,H),v(W,0,V,0)}function d(j){var H=new Uint8Array(32);return g(H,j),H[0]&1}function FA(j,H){var W;for(W=0;W<16;W++)j[W]=H[2*W]+(H[2*W+1]<<8);j[15]&=32767}function BA(j,H,W){for(var V=0;V<16;V++)j[V]=H[V]+W[V]}function UA(j,H,W){for(var V=0;V<16;V++)j[V]=H[V]-W[V]}function LA(j,H,W){var V,F,w=0,x=0,c=0,e=0,VA=0,XA=0,rA=0,ZA=0,xA=0,vA=0,kA=0,SA=0,PA=0,gA=0,_A=0,zA=0,WA=0,CA=0,YA=0,jA=0,GA=0,y=0,m=0,s=0,l=0,i=0,r=0,NA=0,yA=0,hA=0,mA=0,K=W[0],bA=W[1],aA=W[2],tA=W[3],uA=W[4],pA=W[5],nA=W[6],HQ=W[7],IQ=W[8],jQ=W[9],BQ=W[10],WQ=W[11],KQ=W[12],wQ=W[13],TQ=W[14],OQ=W[15];V=H[0],w+=V*K,x+=V*bA,c+=V*aA,e+=V*tA,VA+=V*uA,XA+=V*pA,rA+=V*nA,ZA+=V*HQ,xA+=V*IQ,vA+=V*jQ,kA+=V*BQ,SA+=V*WQ,PA+=V*KQ,gA+=V*wQ,_A+=V*TQ,zA+=V*OQ,V=H[1],x+=V*K,c+=V*bA,e+=V*aA,VA+=V*tA,XA+=V*uA,rA+=V*pA,ZA+=V*nA,xA+=V*HQ,vA+=V*IQ,kA+=V*jQ,SA+=V*BQ,PA+=V*WQ,gA+=V*KQ,_A+=V*wQ,zA+=V*TQ,WA+=V*OQ,V=H[2],c+=V*K,e+=V*bA,VA+=V*aA,XA+=V*tA,rA+=V*uA,ZA+=V*pA,xA+=V*nA,vA+=V*HQ,kA+=V*IQ,SA+=V*jQ,PA+=V*BQ,gA+=V*WQ,_A+=V*KQ,zA+=V*wQ,WA+=V*TQ,CA+=V*OQ,V=H[3],e+=V*K,VA+=V*bA,XA+=V*aA,rA+=V*tA,ZA+=V*uA,xA+=V*pA,vA+=V*nA,kA+=V*HQ,SA+=V*IQ,PA+=V*jQ,gA+=V*BQ,_A+=V*WQ,zA+=V*KQ,WA+=V*wQ,CA+=V*TQ,YA+=V*OQ,V=H[4],VA+=V*K,XA+=V*bA,rA+=V*aA,ZA+=V*tA,xA+=V*uA,vA+=V*pA,kA+=V*nA,SA+=V*HQ,PA+=V*IQ,gA+=V*jQ,_A+=V*BQ,zA+=V*WQ,WA+=V*KQ,CA+=V*wQ,YA+=V*TQ,jA+=V*OQ,V=H[5],XA+=V*K,rA+=V*bA,ZA+=V*aA,xA+=V*tA,vA+=V*uA,kA+=V*pA,SA+=V*nA,PA+=V*HQ,gA+=V*IQ,_A+=V*jQ,zA+=V*BQ,WA+=V*WQ,CA+=V*KQ,YA+=V*wQ,jA+=V*TQ,GA+=V*OQ,V=H[6],rA+=V*K,ZA+=V*bA,xA+=V*aA,vA+=V*tA,kA+=V*uA,SA+=V*pA,PA+=V*nA,gA+=V*HQ,_A+=V*IQ,zA+=V*jQ,WA+=V*BQ,CA+=V*WQ,YA+=V*KQ,jA+=V*wQ,GA+=V*TQ,y+=V*OQ,V=H[7],ZA+=V*K,xA+=V*bA,vA+=V*aA,kA+=V*tA,SA+=V*uA,PA+=V*pA,gA+=V*nA,_A+=V*HQ,zA+=V*IQ,WA+=V*jQ,CA+=V*BQ,YA+=V*WQ,jA+=V*KQ,GA+=V*wQ,y+=V*TQ,m+=V*OQ,V=H[8],xA+=V*K,vA+=V*bA,kA+=V*aA,SA+=V*tA,PA+=V*uA,gA+=V*pA,_A+=V*nA,zA+=V*HQ,WA+=V*IQ,CA+=V*jQ,YA+=V*BQ,jA+=V*WQ,GA+=V*KQ,y+=V*wQ,m+=V*TQ,s+=V*OQ,V=H[9],vA+=V*K,kA+=V*bA,SA+=V*aA,PA+=V*tA,gA+=V*uA,_A+=V*pA,zA+=V*nA,WA+=V*HQ,CA+=V*IQ,YA+=V*jQ,jA+=V*BQ,GA+=V*WQ,y+=V*KQ,m+=V*wQ,s+=V*TQ,l+=V*OQ,V=H[10],kA+=V*K,SA+=V*bA,PA+=V*aA,gA+=V*tA,_A+=V*uA,zA+=V*pA,WA+=V*nA,CA+=V*HQ,YA+=V*IQ,jA+=V*jQ,GA+=V*BQ,y+=V*WQ,m+=V*KQ,s+=V*wQ,l+=V*TQ,i+=V*OQ,V=H[11],SA+=V*K,PA+=V*bA,gA+=V*aA,_A+=V*tA,zA+=V*uA,WA+=V*pA,CA+=V*nA,YA+=V*HQ,jA+=V*IQ,GA+=V*jQ,y+=V*BQ,m+=V*WQ,s+=V*KQ,l+=V*wQ,i+=V*TQ,r+=V*OQ,V=H[12],PA+=V*K,gA+=V*bA,_A+=V*aA,zA+=V*tA,WA+=V*uA,CA+=V*pA,YA+=V*nA,jA+=V*HQ,GA+=V*IQ,y+=V*jQ,m+=V*BQ,s+=V*WQ,l+=V*KQ,i+=V*wQ,r+=V*TQ,NA+=V*OQ,V=H[13],gA+=V*K,_A+=V*bA,zA+=V*aA,WA+=V*tA,CA+=V*uA,YA+=V*pA,jA+=V*nA,GA+=V*HQ,y+=V*IQ,m+=V*jQ,s+=V*BQ,l+=V*WQ,i+=V*KQ,r+=V*wQ,NA+=V*TQ,yA+=V*OQ,V=H[14],_A+=V*K,zA+=V*bA,WA+=V*aA,CA+=V*tA,YA+=V*uA,jA+=V*pA,GA+=V*nA,y+=V*HQ,m+=V*IQ,s+=V*jQ,l+=V*BQ,i+=V*WQ,r+=V*KQ,NA+=V*wQ,yA+=V*TQ,hA+=V*OQ,V=H[15],zA+=V*K,WA+=V*bA,CA+=V*aA,YA+=V*tA,jA+=V*uA,GA+=V*pA,y+=V*nA,m+=V*HQ,s+=V*IQ,l+=V*jQ,i+=V*BQ,r+=V*WQ,NA+=V*KQ,yA+=V*wQ,hA+=V*TQ,mA+=V*OQ,w+=38*WA,x+=38*CA,c+=38*YA,e+=38*jA,VA+=38*GA,XA+=38*y,rA+=38*m,ZA+=38*s,xA+=38*l,vA+=38*i,kA+=38*r,SA+=38*NA,PA+=38*yA,gA+=38*hA,_A+=38*mA,F=1,V=w+F+65535,F=Math.floor(V/65536),w=V-F*65536,V=x+F+65535,F=Math.floor(V/65536),x=V-F*65536,V=c+F+65535,F=Math.floor(V/65536),c=V-F*65536,V=e+F+65535,F=Math.floor(V/65536),e=V-F*65536,V=VA+F+65535,F=Math.floor(V/65536),VA=V-F*65536,V=XA+F+65535,F=Math.floor(V/65536),XA=V-F*65536,V=rA+F+65535,F=Math.floor(V/65536),rA=V-F*65536,V=ZA+F+65535,F=Math.floor(V/65536),ZA=V-F*65536,V=xA+F+65535,F=Math.floor(V/65536),xA=V-F*65536,V=vA+F+65535,F=Math.floor(V/65536),vA=V-F*65536,V=kA+F+65535,F=Math.floor(V/65536),kA=V-F*65536,V=SA+F+65535,F=Math.floor(V/65536),SA=V-F*65536,V=PA+F+65535,F=Math.floor(V/65536),PA=V-F*65536,V=gA+F+65535,F=Math.floor(V/65536),gA=V-F*65536,V=_A+F+65535,F=Math.floor(V/65536),_A=V-F*65536,V=zA+F+65535,F=Math.floor(V/65536),zA=V-F*65536,w+=F-1+37*(F-1),F=1,V=w+F+65535,F=Math.floor(V/65536),w=V-F*65536,V=x+F+65535,F=Math.floor(V/65536),x=V-F*65536,V=c+F+65535,F=Math.floor(V/65536),c=V-F*65536,V=e+F+65535,F=Math.floor(V/65536),e=V-F*65536,V=VA+F+65535,F=Math.floor(V/65536),VA=V-F*65536,V=XA+F+65535,F=Math.floor(V/65536),XA=V-F*65536,V=rA+F+65535,F=Math.floor(V/65536),rA=V-F*65536,V=ZA+F+65535,F=Math.floor(V/65536),ZA=V-F*65536,V=xA+F+65535,F=Math.floor(V/65536),xA=V-F*65536,V=vA+F+65535,F=Math.floor(V/65536),vA=V-F*65536,V=kA+F+65535,F=Math.floor(V/65536),kA=V-F*65536,V=SA+F+65535,F=Math.floor(V/65536),SA=V-F*65536,V=PA+F+65535,F=Math.floor(V/65536),PA=V-F*65536,V=gA+F+65535,F=Math.floor(V/65536),gA=V-F*65536,V=_A+F+65535,F=Math.floor(V/65536),_A=V-F*65536,V=zA+F+65535,F=Math.floor(V/65536),zA=V-F*65536,w+=F-1+37*(F-1),j[0]=w,j[1]=x,j[2]=c,j[3]=e,j[4]=VA,j[5]=XA,j[6]=rA,j[7]=ZA,j[8]=xA,j[9]=vA,j[10]=kA,j[11]=SA,j[12]=PA,j[13]=gA,j[14]=_A,j[15]=zA}function QQ(j,H){LA(j,H,H)}function yI(j,H){var W=Q(),V;for(V=0;V<16;V++)W[V]=H[V];for(V=253;V>=0;V--)if(QQ(W,W),V!==2&&V!==4)LA(W,W,H);for(V=0;V<16;V++)j[V]=W[V]}function QI(j,H){var W=Q(),V;for(V=0;V<16;V++)W[V]=H[V];for(V=250;V>=0;V--)if(QQ(W,W),V!==1)LA(W,W,H);for(V=0;V<16;V++)j[V]=W[V]}function x0(j,H,W){var V=new Uint8Array(32),F=new Float64Array(80),w,x,c=Q(),e=Q(),VA=Q(),XA=Q(),rA=Q(),ZA=Q();for(x=0;x<31;x++)V[x]=H[x];V[31]=H[31]&127|64,V[0]&=248,FA(F,W);for(x=0;x<16;x++)e[x]=F[x],XA[x]=c[x]=VA[x]=0;c[0]=XA[0]=1;for(x=254;x>=0;--x)w=V[x>>>3]>>>(x&7)&1,L(c,e,w),L(VA,XA,w),BA(rA,c,VA),UA(c,c,VA),BA(VA,e,XA),UA(e,e,XA),QQ(XA,rA),QQ(ZA,c),LA(c,VA,c),LA(VA,e,rA),BA(rA,c,VA),UA(c,c,VA),QQ(e,c),UA(VA,XA,ZA),LA(c,VA,C),BA(c,c,XA),LA(VA,VA,c),LA(c,XA,ZA),LA(XA,e,F),QQ(e,rA),L(c,e,w),L(VA,XA,w);for(x=0;x<16;x++)F[x+16]=c[x],F[x+32]=VA[x],F[x+48]=e[x],F[x+64]=XA[x];var xA=F.subarray(32),vA=F.subarray(16);return yI(xA,xA),LA(vA,vA,xA),g(j,vA),0}function v0(j,H){return x0(j,H,$)}function tQ(j,H){return I(H,32),v0(j,H)}function P0(j,H,W){var V=new Uint8Array(32);return x0(V,W,H),a(j,J,V,t)}var II=AA,mI=n;function JI(j,H,W,V,F,w){var x=new Uint8Array(32);return P0(x,F,w),II(j,H,W,V,x)}function _0(j,H,W,V,F,w){var x=new Uint8Array(32);return P0(x,F,w),mI(j,H,W,V,x)}var E0=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function f(j,H,W,V){var F=new Int32Array(16),w=new Int32Array(16),x,c,e,VA,XA,rA,ZA,xA,vA,kA,SA,PA,gA,_A,zA,WA,CA,YA,jA,GA,y,m,s,l,i,r,NA=j[0],yA=j[1],hA=j[2],mA=j[3],K=j[4],bA=j[5],aA=j[6],tA=j[7],uA=H[0],pA=H[1],nA=H[2],HQ=H[3],IQ=H[4],jQ=H[5],BQ=H[6],WQ=H[7],KQ=0;while(V>=128){for(jA=0;jA<16;jA++)GA=8*jA+KQ,F[jA]=W[GA+0]<<24|W[GA+1]<<16|W[GA+2]<<8|W[GA+3],w[jA]=W[GA+4]<<24|W[GA+5]<<16|W[GA+6]<<8|W[GA+7];for(jA=0;jA<80;jA++)if(x=NA,c=yA,e=hA,VA=mA,XA=K,rA=bA,ZA=aA,xA=tA,vA=uA,kA=pA,SA=nA,PA=HQ,gA=IQ,_A=jQ,zA=BQ,WA=WQ,y=tA,m=WQ,s=m&65535,l=m>>>16,i=y&65535,r=y>>>16,y=(K>>>14|IQ<<18)^(K>>>18|IQ<<14)^(IQ>>>9|K<<23),m=(IQ>>>14|K<<18)^(IQ>>>18|K<<14)^(K>>>9|IQ<<23),s+=m&65535,l+=m>>>16,i+=y&65535,r+=y>>>16,y=K&bA^~K&aA,m=IQ&jQ^~IQ&BQ,s+=m&65535,l+=m>>>16,i+=y&65535,r+=y>>>16,y=E0[jA*2],m=E0[jA*2+1],s+=m&65535,l+=m>>>16,i+=y&65535,r+=y>>>16,y=F[jA%16],m=w[jA%16],s+=m&65535,l+=m>>>16,i+=y&65535,r+=y>>>16,l+=s>>>16,i+=l>>>16,r+=i>>>16,CA=i&65535|r<<16,YA=s&65535|l<<16,y=CA,m=YA,s=m&65535,l=m>>>16,i=y&65535,r=y>>>16,y=(NA>>>28|uA<<4)^(uA>>>2|NA<<30)^(uA>>>7|NA<<25),m=(uA>>>28|NA<<4)^(NA>>>2|uA<<30)^(NA>>>7|uA<<25),s+=m&65535,l+=m>>>16,i+=y&65535,r+=y>>>16,y=NA&yA^NA&hA^yA&hA,m=uA&pA^uA&nA^pA&nA,s+=m&65535,l+=m>>>16,i+=y&65535,r+=y>>>16,l+=s>>>16,i+=l>>>16,r+=i>>>16,xA=i&65535|r<<16,WA=s&65535|l<<16,y=VA,m=PA,s=m&65535,l=m>>>16,i=y&65535,r=y>>>16,y=CA,m=YA,s+=m&65535,l+=m>>>16,i+=y&65535,r+=y>>>16,l+=s>>>16,i+=l>>>16,r+=i>>>16,VA=i&65535|r<<16,PA=s&65535|l<<16,yA=x,hA=c,mA=e,K=VA,bA=XA,aA=rA,tA=ZA,NA=xA,pA=vA,nA=kA,HQ=SA,IQ=PA,jQ=gA,BQ=_A,WQ=zA,uA=WA,jA%16===15)for(GA=0;GA<16;GA++)y=F[GA],m=w[GA],s=m&65535,l=m>>>16,i=y&65535,r=y>>>16,y=F[(GA+9)%16],m=w[(GA+9)%16],s+=m&65535,l+=m>>>16,i+=y&65535,r+=y>>>16,CA=F[(GA+1)%16],YA=w[(GA+1)%16],y=(CA>>>1|YA<<31)^(CA>>>8|YA<<24)^CA>>>7,m=(YA>>>1|CA<<31)^(YA>>>8|CA<<24)^(YA>>>7|CA<<25),s+=m&65535,l+=m>>>16,i+=y&65535,r+=y>>>16,CA=F[(GA+14)%16],YA=w[(GA+14)%16],y=(CA>>>19|YA<<13)^(YA>>>29|CA<<3)^CA>>>6,m=(YA>>>19|CA<<13)^(CA>>>29|YA<<3)^(YA>>>6|CA<<26),s+=m&65535,l+=m>>>16,i+=y&65535,r+=y>>>16,l+=s>>>16,i+=l>>>16,r+=i>>>16,F[GA]=i&65535|r<<16,w[GA]=s&65535|l<<16;y=NA,m=uA,s=m&65535,l=m>>>16,i=y&65535,r=y>>>16,y=j[0],m=H[0],s+=m&65535,l+=m>>>16,i+=y&65535,r+=y>>>16,l+=s>>>16,i+=l>>>16,r+=i>>>16,j[0]=NA=i&65535|r<<16,H[0]=uA=s&65535|l<<16,y=yA,m=pA,s=m&65535,l=m>>>16,i=y&65535,r=y>>>16,y=j[1],m=H[1],s+=m&65535,l+=m>>>16,i+=y&65535,r+=y>>>16,l+=s>>>16,i+=l>>>16,r+=i>>>16,j[1]=yA=i&65535|r<<16,H[1]=pA=s&65535|l<<16,y=hA,m=nA,s=m&65535,l=m>>>16,i=y&65535,r=y>>>16,y=j[2],m=H[2],s+=m&65535,l+=m>>>16,i+=y&65535,r+=y>>>16,l+=s>>>16,i+=l>>>16,r+=i>>>16,j[2]=hA=i&65535|r<<16,H[2]=nA=s&65535|l<<16,y=mA,m=HQ,s=m&65535,l=m>>>16,i=y&65535,r=y>>>16,y=j[3],m=H[3],s+=m&65535,l+=m>>>16,i+=y&65535,r+=y>>>16,l+=s>>>16,i+=l>>>16,r+=i>>>16,j[3]=mA=i&65535|r<<16,H[3]=HQ=s&65535|l<<16,y=K,m=IQ,s=m&65535,l=m>>>16,i=y&65535,r=y>>>16,y=j[4],m=H[4],s+=m&65535,l+=m>>>16,i+=y&65535,r+=y>>>16,l+=s>>>16,i+=l>>>16,r+=i>>>16,j[4]=K=i&65535|r<<16,H[4]=IQ=s&65535|l<<16,y=bA,m=jQ,s=m&65535,l=m>>>16,i=y&65535,r=y>>>16,y=j[5],m=H[5],s+=m&65535,l+=m>>>16,i+=y&65535,r+=y>>>16,l+=s>>>16,i+=l>>>16,r+=i>>>16,j[5]=bA=i&65535|r<<16,H[5]=jQ=s&65535|l<<16,y=aA,m=BQ,s=m&65535,l=m>>>16,i=y&65535,r=y>>>16,y=j[6],m=H[6],s+=m&65535,l+=m>>>16,i+=y&65535,r+=y>>>16,l+=s>>>16,i+=l>>>16,r+=i>>>16,j[6]=aA=i&65535|r<<16,H[6]=BQ=s&65535|l<<16,y=tA,m=WQ,s=m&65535,l=m>>>16,i=y&65535,r=y>>>16,y=j[7],m=H[7],s+=m&65535,l+=m>>>16,i+=y&65535,r+=y>>>16,l+=s>>>16,i+=l>>>16,r+=i>>>16,j[7]=tA=i&65535|r<<16,H[7]=WQ=s&65535|l<<16,KQ+=128,V-=128}return V}function $A(j,H,W){var V=new Int32Array(8),F=new Int32Array(8),w=new Uint8Array(256),x,c=W;V[0]=1779033703,V[1]=3144134277,V[2]=1013904242,V[3]=2773480762,V[4]=1359893119,V[5]=2600822924,V[6]=528734635,V[7]=1541459225,F[0]=4089235720,F[1]=2227873595,F[2]=4271175723,F[3]=1595750129,F[4]=2917565137,F[5]=725511199,F[6]=4215389547,F[7]=327033209,f(V,F,H,W),W%=128;for(x=0;x<W;x++)w[x]=H[c-W+x];w[W]=128,W=256-128*(W<112?1:0),w[W-9]=0,D(w,W-8,c/536870912|0,c<<3),f(V,F,w,W);for(x=0;x<8;x++)D(j,8*x,V[x],F[x]);return 0}function HA(j,H){var W=Q(),V=Q(),F=Q(),w=Q(),x=Q(),c=Q(),e=Q(),VA=Q(),XA=Q();UA(W,j[1],j[0]),UA(XA,H[1],H[0]),LA(W,W,XA),BA(V,j[0],j[1]),BA(XA,H[0],H[1]),LA(V,V,XA),LA(F,j[3],H[3]),LA(F,F,Y),LA(w,j[2],H[2]),BA(w,w,w),UA(x,V,W),UA(c,w,F),BA(e,w,F),BA(VA,V,W),LA(j[0],x,c),LA(j[1],VA,e),LA(j[2],e,c),LA(j[3],x,VA)}function OA(j,H,W){var V;for(V=0;V<4;V++)L(j[V],H[V],W)}function iA(j,H){var W=Q(),V=Q(),F=Q();yI(F,H[2]),LA(W,H[0],F),LA(V,H[1],F),g(j,V),j[31]^=d(W)<<7}function FQ(j,H,W){var V,F;JA(j[0],G),JA(j[1],X),JA(j[2],X),JA(j[3],G);for(F=255;F>=0;--F)V=W[F/8|0]>>(F&7)&1,OA(j,H,V),HA(H,j),HA(j,j),OA(j,H,V)}function sQ(j,H){var W=[Q(),Q(),Q(),Q()];JA(W[0],z),JA(W[1],B),JA(W[2],X),LA(W[3],z,B),FQ(j,W,H)}function kQ(j,H,W){var V=new Uint8Array(64),F=[Q(),Q(),Q(),Q()],w;if(!W)I(H,32);$A(V,H,32),V[0]&=248,V[31]&=127,V[31]|=64,sQ(F,V),iA(j,F);for(w=0;w<32;w++)H[w+32]=j[w];return 0}var g0=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function AQ(j,H){var W,V,F,w;for(V=63;V>=32;--V){W=0;for(F=V-32,w=V-12;F<w;++F)H[F]+=W-16*H[V]*g0[F-(V-32)],W=H[F]+128>>8,H[F]-=W*256;H[F]+=W,H[V]=0}W=0;for(F=0;F<32;F++)H[F]+=W-(H[31]>>4)*g0[F],W=H[F]>>8,H[F]&=255;for(F=0;F<32;F++)H[F]-=W*g0[F];for(V=0;V<32;V++)H[V+1]+=H[V]>>8,j[V]=H[V]&255}function NQ(j){var H=new Float64Array(64),W;for(W=0;W<64;W++)H[W]=j[W];for(W=0;W<64;W++)j[W]=0;AQ(j,H)}function DQ(j,H,W,V){var F=new Uint8Array(64),w=new Uint8Array(64),x=new Uint8Array(64),c,e,VA=new Float64Array(64),XA=[Q(),Q(),Q(),Q()];$A(F,V,32),F[0]&=248,F[31]&=127,F[31]|=64;var rA=W+64;for(c=0;c<W;c++)j[64+c]=H[c];for(c=0;c<32;c++)j[32+c]=F[32+c];$A(x,j.subarray(32),W+32),NQ(x),sQ(XA,x),iA(j,XA);for(c=32;c<64;c++)j[c]=V[c];$A(w,j,W+64),NQ(w);for(c=0;c<64;c++)VA[c]=0;for(c=0;c<32;c++)VA[c]=x[c];for(c=0;c<32;c++)for(e=0;e<32;e++)VA[c+e]+=w[c]*F[e];return AQ(j.subarray(32),VA),rA}function zQ(j,H){var W=Q(),V=Q(),F=Q(),w=Q(),x=Q(),c=Q(),e=Q();if(JA(j[2],X),FA(j[1],H),QQ(F,j[1]),LA(w,F,Z),UA(F,F,j[2]),BA(w,j[2],w),QQ(x,w),QQ(c,x),LA(e,c,x),LA(W,e,F),LA(W,W,w),QI(W,W),LA(W,W,F),LA(W,W,w),LA(W,W,w),LA(j[0],W,w),QQ(V,j[0]),LA(V,V,w),b(V,F))LA(j[0],j[0],q);if(QQ(V,j[0]),LA(V,V,w),b(V,F))return-1;if(d(j[0])===H[31]>>7)UA(j[0],G,j[0]);return LA(j[3],j[0],j[1]),0}function $Q(j,H,W,V){var F,w,x=new Uint8Array(32),c=new Uint8Array(64),e=[Q(),Q(),Q(),Q()],VA=[Q(),Q(),Q(),Q()];if(w=-1,W<64)return-1;if(zQ(VA,V))return-1;for(F=0;F<W;F++)j[F]=H[F];for(F=0;F<32;F++)j[F+32]=V[F];if($A(c,j,W),NQ(c),FQ(e,VA,c),sQ(VA,H.subarray(32)),HA(e,VA),iA(x,e),W-=64,v(H,0,x,0)){for(F=0;F<W;F++)j[F]=0;return-1}for(F=0;F<W;F++)j[F]=H[F+64];return w=W,w}var hQ=32,YQ=24,N0=32,S0=16,$I=32,hI=32,GI=32,XI=32,xJ=32,IG=YQ,OZ=N0,LZ=S0,eQ=64,R0=32,k0=64,vJ=32,PJ=64;A.lowlevel={crypto_core_hsalsa20:a,crypto_stream_xor:E,crypto_stream:_,crypto_stream_salsa20_xor:u,crypto_stream_salsa20:M,crypto_onetimeauth:S,crypto_onetimeauth_verify:QA,crypto_verify_16:N,crypto_verify_32:v,crypto_secretbox:AA,crypto_secretbox_open:n,crypto_scalarmult:x0,crypto_scalarmult_base:v0,crypto_box_beforenm:P0,crypto_box_afternm:II,crypto_box:JI,crypto_box_open:_0,crypto_box_keypair:tQ,crypto_hash:$A,crypto_sign:DQ,crypto_sign_keypair:kQ,crypto_sign_open:$Q,crypto_secretbox_KEYBYTES:hQ,crypto_secretbox_NONCEBYTES:YQ,crypto_secretbox_ZEROBYTES:N0,crypto_secretbox_BOXZEROBYTES:S0,crypto_scalarmult_BYTES:$I,crypto_scalarmult_SCALARBYTES:hI,crypto_box_PUBLICKEYBYTES:GI,crypto_box_SECRETKEYBYTES:XI,crypto_box_BEFORENMBYTES:xJ,crypto_box_NONCEBYTES:IG,crypto_box_ZEROBYTES:OZ,crypto_box_BOXZEROBYTES:LZ,crypto_sign_BYTES:eQ,crypto_sign_PUBLICKEYBYTES:R0,crypto_sign_SECRETKEYBYTES:k0,crypto_sign_SEEDBYTES:vJ,crypto_hash_BYTES:PJ};function JG(j,H){if(j.length!==hQ)throw new Error("bad key size");if(H.length!==YQ)throw new Error("bad nonce size")}function xZ(j,H){if(j.length!==GI)throw new Error("bad public key size");if(H.length!==XI)throw new Error("bad secret key size")}function yQ(){var j,H;for(H=0;H<arguments.length;H++)if((j=Object.prototype.toString.call(arguments[H]))!=="[object Uint8Array]")throw new TypeError("unexpected type "+j+", use Uint8Array")}function $G(j){for(var H=0;H<j.length;H++)j[H]=0}if(!A.util)A.util={},A.util.decodeUTF8=A.util.encodeUTF8=A.util.encodeBase64=A.util.decodeBase64=function(){throw new Error("nacl.util moved into separate package: https://github.com/dchest/tweetnacl-util-js")};A.randomBytes=function(j){var H=new Uint8Array(j);return I(H,j),H},A.secretbox=function(j,H,W){yQ(j,H,W),JG(W,H);var V=new Uint8Array(N0+j.length),F=new Uint8Array(V.length);for(var w=0;w<j.length;w++)V[w+N0]=j[w];return AA(F,V,V.length,H,W),F.subarray(S0)},A.secretbox.open=function(j,H,W){yQ(j,H,W),JG(W,H);var V=new Uint8Array(S0+j.length),F=new Uint8Array(V.length);for(var w=0;w<j.length;w++)V[w+S0]=j[w];if(V.length<32)return!1;if(n(F,V,V.length,H,W)!==0)return!1;return F.subarray(N0)},A.secretbox.keyLength=hQ,A.secretbox.nonceLength=YQ,A.secretbox.overheadLength=S0,A.scalarMult=function(j,H){if(yQ(j,H),j.length!==hI)throw new Error("bad n size");if(H.length!==$I)throw new Error("bad p size");var W=new Uint8Array($I);return x0(W,j,H),W},A.scalarMult.base=function(j){if(yQ(j),j.length!==hI)throw new Error("bad n size");var H=new Uint8Array($I);return v0(H,j),H},A.scalarMult.scalarLength=hI,A.scalarMult.groupElementLength=$I,A.box=function(j,H,W,V){var F=A.box.before(W,V);return A.secretbox(j,H,F)},A.box.before=function(j,H){yQ(j,H),xZ(j,H);var W=new Uint8Array(xJ);return P0(W,j,H),W},A.box.after=A.secretbox,A.box.open=function(j,H,W,V){var F=A.box.before(W,V);return A.secretbox.open(j,H,F)},A.box.open.after=A.secretbox.open,A.box.keyPair=function(){var j=new Uint8Array(GI),H=new Uint8Array(XI);return tQ(j,H),{publicKey:j,secretKey:H}},A.box.keyPair.fromSecretKey=function(j){if(yQ(j),j.length!==XI)throw new Error("bad secret key size");var H=new Uint8Array(GI);return v0(H,j),{publicKey:H,secretKey:new Uint8Array(j)}},A.box.publicKeyLength=GI,A.box.secretKeyLength=XI,A.box.sharedKeyLength=xJ,A.box.nonceLength=IG,A.box.overheadLength=A.secretbox.overheadLength,A.sign=function(j,H){if(yQ(j,H),H.length!==k0)throw new Error("bad secret key size");var W=new Uint8Array(eQ+j.length);return DQ(W,j,j.length,H),W},A.sign.open=function(j,H){if(arguments.length!==2)throw new Error("nacl.sign.open accepts 2 arguments; did you mean to use nacl.sign.detached.verify?");if(yQ(j,H),H.length!==R0)throw new Error("bad public key size");var W=new Uint8Array(j.length),V=$Q(W,j,j.length,H);if(V<0)return null;var F=new Uint8Array(V);for(var w=0;w<F.length;w++)F[w]=W[w];return F},A.sign.detached=function(j,H){var W=A.sign(j,H),V=new Uint8Array(eQ);for(var F=0;F<V.length;F++)V[F]=W[F];return V},A.sign.detached.verify=function(j,H,W){if(yQ(j,H,W),H.length!==eQ)throw new Error("bad signature size");if(W.length!==R0)throw new Error("bad public key size");var V=new Uint8Array(eQ+j.length),F=new Uint8Array(eQ+j.length),w;for(w=0;w<eQ;w++)V[w]=H[w];for(w=0;w<j.length;w++)V[w+eQ]=j[w];return $Q(F,V,V.length,W)>=0},A.sign.keyPair=function(){var j=new Uint8Array(R0),H=new Uint8Array(k0);return kQ(j,H),{publicKey:j,secretKey:H}},A.sign.keyPair.fromSecretKey=function(j){if(yQ(j),j.length!==k0)throw new Error("bad secret key size");var H=new Uint8Array(R0);for(var W=0;W<H.length;W++)H[W]=j[32+W];return{publicKey:H,secretKey:new Uint8Array(j)}},A.sign.keyPair.fromSeed=function(j){if(yQ(j),j.length!==vJ)throw new Error("bad seed size");var H=new Uint8Array(R0),W=new Uint8Array(k0);for(var V=0;V<32;V++)W[V]=j[V];return kQ(H,W,!0),{publicKey:H,secretKey:W}},A.sign.publicKeyLength=R0,A.sign.secretKeyLength=k0,A.sign.seedLength=vJ,A.sign.signatureLength=eQ,A.hash=function(j){yQ(j);var H=new Uint8Array(PJ);return $A(H,j,j.length),H},A.hash.hashLength=PJ,A.verify=function(j,H){if(yQ(j,H),j.length===0||H.length===0)return!1;if(j.length!==H.length)return!1;return R(j,0,H,0,j.length)===0?!0:!1},A.setPRNG=function(j){I=j},function(){var j=typeof self!=="undefined"?self.crypto||self.msCrypto:null;if(j&&j.getRandomValues){var H=65536;A.setPRNG(function(W,V){var F,w=new Uint8Array(V);for(F=0;F<V;F+=H)j.getRandomValues(w.subarray(F,F+Math.min(V-F,H)));for(F=0;F<V;F++)W[F]=w[F];$G(w)})}else if(j=EA("crypto"),j&&j.randomBytes)A.setPRNG(function(W,V){var F,w=j.randomBytes(V);for(F=0;F<V;F++)W[F]=w[F];$G(w)})}()})(typeof oI!=="undefined"&&PY?PY:self.nacl=self.nacl||{})});var oJ=cA((EY,kG)=>{var lJ=SG().lowlevel.crypto_hash,Q0=0,U0=function(){this.S=[new Uint32Array([3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946]),new Uint32Array([1266315497,3048417604,3681880366,3289982499,2909710000,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055]),new Uint32Array([3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504]),new Uint32Array([976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409000,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462])],this.P=new Uint32Array([608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731])};function nI(A,Q,I){return(A[0][Q[I+3]]+A[1][Q[I+2]]^A[2][Q[I+1]])+A[3][Q[I]]}U0.prototype.encipher=function(A,Q){if(Q===void 0){if(Q=new Uint8Array(A.buffer),A.byteOffset!==0)Q=Q.subarray(A.byteOffset)}A[0]^=this.P[0];for(var I=1;I<16;I+=2)A[1]^=nI(this.S,Q,0)^this.P[I],A[0]^=nI(this.S,Q,4)^this.P[I+1];var J=A[0];A[0]=A[1]^this.P[17],A[1]=J};U0.prototype.decipher=function(A){var Q=new Uint8Array(A.buffer);if(A.byteOffset!==0)Q=Q.subarray(A.byteOffset);A[0]^=this.P[17];for(var I=16;I>0;I-=2)A[1]^=nI(this.S,Q,0)^this.P[I],A[0]^=nI(this.S,Q,4)^this.P[I-1];var J=A[0];A[0]=A[1]^this.P[0],A[1]=J};function M0(A,Q){var I,J=0;for(I=0;I<4;I++,Q0++){if(Q0>=Q)Q0=0;J=J<<8|A[Q0]}return J}U0.prototype.expand0state=function(A,Q){var I=new Uint32Array(2),J,$,G=new Uint8Array(I.buffer);for(J=0,Q0=0;J<18;J++)this.P[J]^=M0(A,Q);Q0=0;for(J=0;J<18;J+=2)this.encipher(I,G),this.P[J]=I[0],this.P[J+1]=I[1];for(J=0;J<4;J++)for($=0;$<256;$+=2)this.encipher(I,G),this.S[J][$]=I[0],this.S[J][$+1]=I[1]};U0.prototype.expandstate=function(A,Q,I,J){var $=new Uint32Array(2),G,X;for(G=0,Q0=0;G<18;G++)this.P[G]^=M0(I,J);for(G=0,Q0=0;G<18;G+=2)$[0]^=M0(A,Q),$[1]^=M0(A,Q),this.encipher($),this.P[G]=$[0],this.P[G+1]=$[1];for(G=0;G<4;G++)for(X=0;X<256;X+=2)$[0]^=M0(A,Q),$[1]^=M0(A,Q),this.encipher($),this.S[G][X]=$[0],this.S[G][X+1]=$[1];Q0=0};U0.prototype.enc=function(A,Q){for(var I=0;I<Q;I++)this.encipher(A.subarray(I*2))};U0.prototype.dec=function(A,Q){for(var I=0;I<Q;I++)this.decipher(A.subarray(I*2))};var pI=8,cJ=32;function iJ(A,Q,I){var J=new U0,$=new Uint32Array(pI),G,X=new Uint8Array([79,120,121,99,104,114,111,109,97,116,105,99,66,108,111,119,102,105,115,104,83,119,97,116,68,121,110,97,109,105,116,101]);J.expandstate(Q,64,A,64);for(G=0;G<64;G++)J.expand0state(Q,64),J.expand0state(A,64);for(G=0;G<pI;G++)$[G]=M0(X,X.byteLength);for(G=0;G<64;G++)J.enc($,$.byteLength/8);for(G=0;G<pI;G++)I[4*G+3]=$[G]>>>24,I[4*G+2]=$[G]>>>16,I[4*G+1]=$[G]>>>8,I[4*G+0]=$[G]}function K8(A,Q,I,J,$,G,X){var C=new Uint8Array(64),Z=new Uint8Array(64),Y=new Uint8Array(cJ),z=new Uint8Array(cJ),B=new Uint8Array(J+4),q,D,R,N,v,P,o=G;if(X<1)return-1;if(Q===0||J===0||G===0||G>Y.byteLength*Y.byteLength||J>1048576)return-1;N=Math.floor((G+Y.byteLength-1)/Y.byteLength),R=Math.floor((G+N-1)/N);for(q=0;q<J;q++)B[q]=I[q];lJ(C,A,Q);for(P=1;G>0;P++){B[J+0]=P>>>24,B[J+1]=P>>>16,B[J+2]=P>>>8,B[J+3]=P,lJ(Z,B,J+4),iJ(C,Z,z);for(q=Y.byteLength;q--;)Y[q]=z[q];for(q=1;q<X;q++){lJ(Z,z,z.byteLength),iJ(C,Z,z);for(D=0;D<Y.byteLength;D++)Y[D]^=z[D]}R=Math.min(R,G);for(q=0;q<R;q++){if(v=q*N+(P-1),v>=o)break;$[v]=Y[q]}G-=q}return 0}kG.exports={BLOCKS:pI,HASHSIZE:cJ,hash:iJ,pbkdf:K8}});var J0=cA((gY,rI)=>{var I0=EA("crypto"),b0;try{b0=(()=>{throw new Error("Cannot require module "+"cpu-features");})()()}catch{}var{bindingAvailable:yG,CIPHER_INFO:N8,MAC_INFO:R8}=j0(),mG=(()=>{if(typeof I0.sign==="function"&&typeof I0.verify==="function"){let A=`-----BEGIN PRIVATE KEY-----\r
MC4CAQAwBQYDK2VwBCIEIHKj+sVa9WcD/q2DJUJaf43Kptc8xYuUQA4bOFj9vC8T\r
-----END PRIVATE KEY-----`,Q=Buffer.from("a"),I,J;try{I=I0.sign(null,Q,A),J=I0.verify(null,Q,A,I)}catch{}return Buffer.isBuffer(I)&&I.length===64&&J===!0}return!1})(),hG=typeof I0.diffieHellman==="function"&&typeof I0.generateKeyPairSync==="function"&&typeof I0.createPublicKey==="function",sI=["ecdh-sha2-nistp256","ecdh-sha2-nistp384","ecdh-sha2-nistp521","diffie-hellman-group-exchange-sha256","diffie-hellman-group14-sha256","diffie-hellman-group15-sha512","diffie-hellman-group16-sha512","diffie-hellman-group17-sha512","diffie-hellman-group18-sha512"];if(hG)sI.unshift("curve25519-sha256"),sI.unshift("[email protected]");var M8=sI.concat(["diffie-hellman-group-exchange-sha1","diffie-hellman-group14-sha1","diffie-hellman-group1-sha1"]),pJ=["ecdsa-sha2-nistp256","ecdsa-sha2-nistp384","ecdsa-sha2-nistp521","rsa-sha2-512","rsa-sha2-256","ssh-rsa"];if(mG)pJ.unshift("ssh-ed25519");var U8=pJ.concat(["ssh-dss"]),uG=(()=>{let A=I0.getCiphers();return(Q)=>A.includes(N8[Q].sslName)})(),Y0=["[email protected]","[email protected]","aes128-ctr","aes192-ctr","aes256-ctr"];if(b0&&b0.flags&&!b0.flags.aes)if(yG)Y0.unshift("[email protected]");else Y0.push("[email protected]");else if(yG&&b0&&b0.arch==="x86")Y0.splice(4,0,"[email protected]");else Y0.push("[email protected]");Y0=Y0.filter(uG);var w8=Y0.concat(["aes256-cbc","aes192-cbc","aes128-cbc","blowfish-cbc","3des-cbc","aes128-gcm","aes256-gcm","arcfour256","arcfour128","cast128-cbc","arcfour"].filter(uG)),bG=(()=>{let A=I0.getHashes();return(Q)=>A.includes(R8[Q].sslName)})(),fG=["[email protected]","[email protected]","[email protected]","hmac-sha2-256","hmac-sha2-512","hmac-sha1"].filter(bG),T8=fG.concat(["hmac-md5","hmac-sha2-256-96","hmac-sha2-512-96","hmac-ripemd160","hmac-sha1-96","hmac-md5-96"].filter(bG)),dG=["none","[email protected]","zlib"],O8=dG.concat([]),u0={BAD_DHGEX:1,OLD_EXIT:2,DYN_RPORT_BUG:4,BUG_DHGEX_LARGE:8,IMPLY_RSA_SHA2_SIGALGS:16};rI.exports={MESSAGE:{DISCONNECT:1,IGNORE:2,UNIMPLEMENTED:3,DEBUG:4,SERVICE_REQUEST:5,SERVICE_ACCEPT:6,EXT_INFO:7,KEXINIT:20,NEWKEYS:21,KEXDH_INIT:30,KEXDH_REPLY:31,KEXDH_GEX_GROUP:31,KEXDH_GEX_INIT:32,KEXDH_GEX_REPLY:33,KEXDH_GEX_REQUEST:34,KEXECDH_INIT:30,KEXECDH_REPLY:31,USERAUTH_REQUEST:50,USERAUTH_FAILURE:51,USERAUTH_SUCCESS:52,USERAUTH_BANNER:53,USERAUTH_PASSWD_CHANGEREQ:60,USERAUTH_PK_OK:60,USERAUTH_INFO_REQUEST:60,USERAUTH_INFO_RESPONSE:61,GLOBAL_REQUEST:80,REQUEST_SUCCESS:81,REQUEST_FAILURE:82,CHANNEL_OPEN:90,CHANNEL_OPEN_CONFIRMATION:91,CHANNEL_OPEN_FAILURE:92,CHANNEL_WINDOW_ADJUST:93,CHANNEL_DATA:94,CHANNEL_EXTENDED_DATA:95,CHANNEL_EOF:96,CHANNEL_CLOSE:97,CHANNEL_REQUEST:98,CHANNEL_SUCCESS:99,CHANNEL_FAILURE:100},DISCONNECT_REASON:{HOST_NOT_ALLOWED_TO_CONNECT:1,PROTOCOL_ERROR:2,KEY_EXCHANGE_FAILED:3,RESERVED:4,MAC_ERROR:5,COMPRESSION_ERROR:6,SERVICE_NOT_AVAILABLE:7,PROTOCOL_VERSION_NOT_SUPPORTED:8,HOST_KEY_NOT_VERIFIABLE:9,CONNECTION_LOST:10,BY_APPLICATION:11,TOO_MANY_CONNECTIONS:12,AUTH_CANCELED_BY_USER:13,NO_MORE_AUTH_METHODS_AVAILABLE:14,ILLEGAL_USER_NAME:15},DISCONNECT_REASON_STR:void 0,CHANNEL_OPEN_FAILURE:{ADMINISTRATIVELY_PROHIBITED:1,CONNECT_FAILED:2,UNKNOWN_CHANNEL_TYPE:3,RESOURCE_SHORTAGE:4},TERMINAL_MODE:{TTY_OP_END:0,VINTR:1,VQUIT:2,VERASE:3,VKILL:4,VEOF:5,VEOL:6,VEOL2:7,VSTART:8,VSTOP:9,VSUSP:10,VDSUSP:11,VREPRINT:12,VWERASE:13,VLNEXT:14,VFLUSH:15,VSWTCH:16,VSTATUS:17,VDISCARD:18,IGNPAR:30,PARMRK:31,INPCK:32,ISTRIP:33,INLCR:34,IGNCR:35,ICRNL:36,IUCLC:37,IXON:38,IXANY:39,IXOFF:40,IMAXBEL:41,ISIG:50,ICANON:51,XCASE:52,ECHO:53,ECHOE:54,ECHOK:55,ECHONL:56,NOFLSH:57,TOSTOP:58,IEXTEN:59,ECHOCTL:60,ECHOKE:61,PENDIN:62,OPOST:70,OLCUC:71,ONLCR:72,OCRNL:73,ONOCR:74,ONLRET:75,CS7:90,CS8:91,PARENB:92,PARODD:93,TTY_OP_ISPEED:128,TTY_OP_OSPEED:129},CHANNEL_EXTENDED_DATATYPE:{STDERR:1},SIGNALS:["ABRT","ALRM","FPE","HUP","ILL","INT","QUIT","SEGV","TERM","USR1","USR2","KILL","PIPE"].reduce((A,Q)=>({...A,[Q]:1}),{}),COMPAT:u0,COMPAT_CHECKS:[["Cisco-1.25",u0.BAD_DHGEX],[/^Cisco-1[.]/,u0.BUG_DHGEX_LARGE],[/^[0-9.]+$/,u0.OLD_EXIT],[/^OpenSSH_5[.][0-9]+/,u0.DYN_RPORT_BUG],[/^OpenSSH_7[.]4/,u0.IMPLY_RSA_SHA2_SIGALGS]],DEFAULT_KEX:sI,SUPPORTED_KEX:M8,DEFAULT_SERVER_HOST_KEY:pJ,SUPPORTED_SERVER_HOST_KEY:U8,DEFAULT_CIPHER:Y0,SUPPORTED_CIPHER:w8,DEFAULT_MAC:fG,SUPPORTED_MAC:T8,DEFAULT_COMPRESSION:dG,SUPPORTED_COMPRESSION:O8,curve25519Supported:hG,eddsaSupported:mG};rI.exports.DISCONNECT_REASON_BY_VALUE=Array.from(Object.entries(rI.exports.DISCONNECT_REASON)).reduce((A,[Q,I])=>({...A,[I]:Q}),{})});var iQ=cA((SY,oG)=>{var fQ=YI().Ber,aI,iG=Buffer[Symbol.species],L8=Object.getPrototypeOf(Uint8Array.prototype).fill;function lG(A,Q){return A[Q++]*16777216+A[Q++]*65536+A[Q++]*256+A[Q]}function jI(A,Q,I,J,$){if(!$)$=0;if(J>A.length)J=A.length;let G=J-I,X=Q.length-$;if(G>X)G=X;return Q.set(new Uint8Array(A.buffer,A.byteOffset+I,G),$),G}function BI(A,Q,I){if(I===void 0)I=A.length;return new iG(A.buffer,A.byteOffset+Q,I-Q)}function sJ(){let A=0,Q,I={init:(J,$)=>{Q=J,A=typeof $==="number"?$:0},pos:()=>A,length:()=>Q?Q.length:0,avail:()=>Q&&A<Q.length?Q.length-A:0,clear:()=>{Q=void 0},readUInt32BE:()=>{if(!Q||A+3>=Q.length)return;return Q[A++]*16777216+Q[A++]*65536+Q[A++]*256+Q[A++]},readUInt64BE:(J)=>{if(!Q||A+7>=Q.length)return;switch(J){case"always":return BigInt(`0x${Q.hexSlice(A,A+=8)}`);case"maybe":if(Q[A]>31)return BigInt(`0x${Q.hexSlice(A,A+=8)}`);default:return Q[A++]*72057594037927940+Q[A++]*281474976710656+Q[A++]*1099511627776+Q[A++]*4294967296+Q[A++]*16777216+Q[A++]*65536+Q[A++]*256+Q[A++]}},skip:(J)=>{if(Q&&J>0)A+=J},skipString:()=>{let J=I.readUInt32BE();if(J===void 0)return;return A+=J,A<=Q.length?J:void 0},readByte:()=>{if(Q&&A<Q.length)return Q[A++]},readBool:()=>{if(Q&&A<Q.length)return!!Q[A++]},readList:()=>{let J=I.readString(!0);if(J===void 0)return;return J?J.split(","):[]},readString:(J,$)=>{if(typeof J==="number")$=J,J=void 0;let G=I.readUInt32BE();if(G===void 0)return;if(Q.length-A<G||typeof $==="number"&&G>$)return;if(J){if(Buffer.isBuffer(J))return jI(Q,J,A,A+=G);return Q.utf8Slice(A,A+=G)}return BI(Q,A,A+=G)},readRaw:(J)=>{if(!Q)return;if(typeof J!=="number")return BI(Q,A,A+=Q.length-A);if(Q.length-A>=J)return BI(Q,A,A+=J)}};return I}function cG(A,Q,I){let J=new Error(A);if(typeof Q==="boolean")I=Q,J.level="protocol";else J.level=Q||"protocol";return J.fatal=!!I,J}function nJ(A,Q,I){return A[I++]=Q>>>24,A[I++]=Q>>>16,A[I++]=Q>>>8,A[I++]=Q,I}var tI=sJ();oG.exports={bufferCopy:jI,bufferSlice:BI,FastBuffer:iG,bufferFill:(A,Q,I,J)=>{return L8.call(A,Q,I,J)},makeError:cG,doFatalError:(A,Q,I,J)=>{let $;if(aI===void 0)({DISCONNECT_REASON:aI}=J0());if(Q instanceof Error)if($=Q,typeof I!=="number")J=aI.PROTOCOL_ERROR;else J=I;else $=cG(Q,I,!0);if(typeof J!=="number")J=aI.PROTOCOL_ERROR;return A.disconnect(J),A._destruct(),A._onError($),1/0},readUInt32BE:lG,writeUInt32BE:nJ,writeUInt32LE:(A,Q,I)=>{return A[I++]=Q,A[I++]=Q>>>8,A[I++]=Q>>>16,A[I++]=Q>>>24,I},makeBufferParser:sJ,bufferParser:sJ(),readString:(A,Q,I,J)=>{if(typeof I==="number")J=I,I=void 0;if(Q===void 0)Q=0;let $=A.length-Q;if(Q<0||Q>=A.length||$<4)return;let G=lG(A,Q);if($<4+G||typeof J==="number"&&G>J)return;Q+=4;let X=Q+G;if(A._pos=X,I){if(Buffer.isBuffer(I))return jI(A,I,Q,X);return A.utf8Slice(Q,X)}return BI(A,Q,X)},sigSSHToASN1:(A,Q)=>{switch(Q){case"ssh-dss":{if(A.length>40)return A;let I=new fQ.Writer;I.startSequence();let J=A.slice(0,20),$=A.slice(20);if(J[0]&128){let G=Buffer.allocUnsafe(21);G[0]=0,J.copy(G,1),J=G}else if(J[0]===0&&!(J[1]&128))J=J.slice(1);if($[0]&128){let G=Buffer.allocUnsafe(21);G[0]=0,$.copy(G,1),$=G}else if($[0]===0&&!($[1]&128))$=$.slice(1);return I.writeBuffer(J,fQ.Integer),I.writeBuffer($,fQ.Integer),I.endSequence(),I.buffer}case"ecdsa-sha2-nistp256":case"ecdsa-sha2-nistp384":case"ecdsa-sha2-nistp521":{tI.init(A,0);let I=tI.readString(),J=tI.readString();if(tI.clear(),I===void 0||J===void 0)return;let $=new fQ.Writer;return $.startSequence(),$.writeBuffer(I,fQ.Integer),$.writeBuffer(J,fQ.Integer),$.endSequence(),$.buffer}default:return A}},convertSignature:(A,Q)=>{switch(Q){case"ssh-dss":{if(A.length<=40)return A;let I=new fQ.Reader(A);I.readSequence();let J=I.readString(fQ.Integer,!0),$=I.readString(fQ.Integer,!0),G=0,X=0;if(J.length<20){let Z=Buffer.allocUnsafe(20);Z.set(J,1),J=Z,J[0]=0}if($.length<20){let Z=Buffer.allocUnsafe(20);Z.set($,1),$=Z,$[0]=0}if(J.length>20&&J[0]===0)G=1;if($.length>20&&$[0]===0)X=1;let C=Buffer.allocUnsafe(J.length-G+($.length-X));return jI(J,C,G,J.length,0),jI($,C,X,$.length,J.length-G),C}case"ecdsa-sha2-nistp256":case"ecdsa-sha2-nistp384":case"ecdsa-sha2-nistp521":{if(A[0]===0)return A;let I=new fQ.Reader(A);I.readSequence();let J=I.readString(fQ.Integer,!0),$=I.readString(fQ.Integer,!0);if(J===null||$===null)return;let G=Buffer.allocUnsafe(4+J.length+4+$.length);return nJ(G,J.length,0),G.set(J,4),nJ(G,$.length,4+J.length),G.set($,8+J.length),G}}return A},sendPacket:(A,Q,I)=>{if(!I&&A._kexinit!==void 0){if(A._queue===void 0)A._queue=[];return A._queue.push(Q),A._debug&&A._debug("Outbound: ... packet queued"),!1}return A._cipher.encrypt(Q),!0}}});var pG=cA((eI,aJ)=>{var __dirname="/home/zhijia/cc/node_modules/ssh2/lib/protocol/crypto",__filename="/home/zhijia/cc/node_modules/ssh2/lib/protocol/crypto/poly1305.js",rJ=function(){var A=typeof document!=="undefined"&&document.currentScript?document.currentScript.src:void 0;if(typeof __filename!=="undefined")A=A||__filename;return function(Q){Q=Q||{};var I;I||(I=typeof Q!=="undefined"?Q:{});var J,$;I.ready=new Promise(function(f,$A){J=f,$=$A});var G={},X;for(X in I)I.hasOwnProperty(X)&&(G[X]=I[X]);var C=typeof window==="object",Z=typeof importScripts==="function",Y=typeof process==="object"&&typeof process.versions==="object"&&typeof process.versions.node==="string",z="",B,q,D,R,N;if(Y)z=Z?EA("path").dirname(z)+"/":__dirname+"/",B=function(f,$A){var HA=tQ(f);if(HA)return $A?HA:HA.toString();return R||(R=EA("fs")),N||(N=EA("path")),f=N.normalize(f),R.readFileSync(f,$A?null:"utf8")},D=function(f){return f=B(f,!0),f.buffer||(f=new Uint8Array(f)),t(f.buffer),f},q=function(f,$A,HA){var OA=tQ(f);OA&&$A(OA),R||(R=EA("fs")),N||(N=EA("path")),f=N.normalize(f),R.readFile(f,function(iA,FQ){iA?HA(iA):$A(FQ.buffer)})},1<process.argv.length&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),I.inspect=function(){return"[Emscripten Module object]"};else if(C||Z)Z?z=self.location.href:typeof document!=="undefined"&&document.currentScript&&(z=document.currentScript.src),A&&(z=A),z.indexOf("blob:")!==0?z=z.substr(0,z.lastIndexOf("/")+1):z="",B=function(f){try{var $A=new XMLHttpRequest;return $A.open("GET",f,!1),$A.send(null),$A.responseText}catch(iA){if(f=tQ(f)){$A=[];for(var HA=0;HA<f.length;HA++){var OA=f[HA];255<OA&&(x0&&t(!1,"Character code "+OA+" ("+String.fromCharCode(OA)+") at offset "+HA+" not in 0x00-0xFF."),OA&=255),$A.push(String.fromCharCode(OA))}return $A.join("")}throw iA}},Z&&(D=function(f){try{var $A=new XMLHttpRequest;return $A.open("GET",f,!1),$A.responseType="arraybuffer",$A.send(null),new Uint8Array($A.response)}catch(HA){if(f=tQ(f))return f;throw HA}}),q=function(f,$A,HA){var OA=new XMLHttpRequest;OA.open("GET",f,!0),OA.responseType="arraybuffer",OA.onload=function(){if(OA.status==200||OA.status==0&&OA.response)$A(OA.response);else{var iA=tQ(f);iA?$A(iA.buffer):HA()}},OA.onerror=HA,OA.send(null)};I.print||console.log.bind(console);var v=I.printErr||console.warn.bind(console);for(X in G)G.hasOwnProperty(X)&&(I[X]=G[X]);G=null;var P;I.wasmBinary&&(P=I.wasmBinary);var o=I.noExitRuntime||!0;typeof WebAssembly!=="object"&&FA("no native wasm support detected");var k,a=!1;function t(f,$A){f||FA("Assertion failed: "+$A)}function u(f){var $A=I["_"+f];return t($A,"Cannot call unknown function "+f+", make sure it is exported"),$A}function M(f,$A,HA,OA){var iA={string:function(AQ){var NQ=0;if(AQ!==null&&AQ!==void 0&&AQ!==0){var DQ=(AQ.length<<2)+1;NQ=JI(DQ);var zQ=NQ,$Q=S;if(0<DQ){DQ=zQ+DQ-1;for(var hQ=0;hQ<AQ.length;++hQ){var YQ=AQ.charCodeAt(hQ);if(55296<=YQ&&57343>=YQ){var N0=AQ.charCodeAt(++hQ);YQ=65536+((YQ&1023)<<10)|N0&1023}if(127>=YQ){if(zQ>=DQ)break;$Q[zQ++]=YQ}else{if(2047>=YQ){if(zQ+1>=DQ)break;$Q[zQ++]=192|YQ>>6}else{if(65535>=YQ){if(zQ+2>=DQ)break;$Q[zQ++]=224|YQ>>12}else{if(zQ+3>=DQ)break;$Q[zQ++]=240|YQ>>18,$Q[zQ++]=128|YQ>>12&63}$Q[zQ++]=128|YQ>>6&63}$Q[zQ++]=128|YQ&63}}$Q[zQ]=0}}return NQ},array:function(AQ){var NQ=JI(AQ.length);return p.set(AQ,NQ),NQ}},FQ=u(f),sQ=[];if(f=0,OA)for(var kQ=0;kQ<OA.length;kQ++){var g0=iA[HA[kQ]];g0?(f===0&&(f=II()),sQ[kQ]=g0(OA[kQ])):sQ[kQ]=OA[kQ]}return HA=FQ.apply(null,sQ),HA=function(AQ){if($A==="string")if(AQ){for(var NQ=S,DQ=AQ+NaN,zQ=AQ;NQ[zQ]&&!(zQ>=DQ);)++zQ;if(16<zQ-AQ&&NQ.subarray&&_)AQ=_.decode(NQ.subarray(AQ,zQ));else{for(DQ="";AQ<zQ;){var $Q=NQ[AQ++];if($Q&128){var hQ=NQ[AQ++]&63;if(($Q&224)==192)DQ+=String.fromCharCode(($Q&31)<<6|hQ);else{var YQ=NQ[AQ++]&63;$Q=($Q&240)==224?($Q&15)<<12|hQ<<6|YQ:($Q&7)<<18|hQ<<12|YQ<<6|NQ[AQ++]&63,65536>$Q?DQ+=String.fromCharCode($Q):($Q-=65536,DQ+=String.fromCharCode(55296|$Q>>10,56320|$Q&1023))}}else DQ+=String.fromCharCode($Q)}AQ=DQ}}else AQ="";else AQ=$A==="boolean"?!!AQ:AQ;return AQ}(HA),f!==0&&mI(f),HA}var _=typeof TextDecoder!=="undefined"?new TextDecoder("utf8"):void 0,E,p,S;function QA(){var f=k.buffer;E=f,I.HEAP8=p=new Int8Array(f),I.HEAP16=new Int16Array(f),I.HEAP32=new Int32Array(f),I.HEAPU8=S=new Uint8Array(f),I.HEAPU16=new Uint16Array(f),I.HEAPU32=new Uint32Array(f),I.HEAPF32=new Float32Array(f),I.HEAPF64=new Float64Array(f)}var AA,n=[],JA=[],IA=[];function L(){var f=I.preRun.shift();n.unshift(f)}var g=0,b=null,d=null;I.preloadedImages={},I.preloadedAudios={};function FA(f){if(I.onAbort)I.onAbort(f);throw v(f),a=!0,f=new WebAssembly.RuntimeError("abort("+f+"). Build with -s ASSERTIONS=1 for more info."),$(f),f}var BA="data:application/octet-stream;base64,",UA;if(UA="data:application/octet-stream;base64,AGFzbQEAAAABIAZgAX8Bf2ADf39/AGABfwBgAABgAAF/YAZ/f39/f38AAgcBAWEBYQAAAwsKAAEDAQAAAgQFAgQFAXABAQEFBwEBgAKAgAIGCQF/AUGAjMACCwclCQFiAgABYwADAWQACQFlAAgBZgAHAWcABgFoAAUBaQAKAWoBAAqGTQpPAQJ/QYAIKAIAIgEgAEEDakF8cSICaiEAAkAgAkEAIAAgAU0bDQAgAD8AQRB0SwRAIAAQAEUNAQtBgAggADYCACABDwtBhAhBMDYCAEF/C4wFAg5+Cn8gACgCJCEUIAAoAiAhFSAAKAIcIREgACgCGCESIAAoAhQhEyACQRBPBEAgAC0ATEVBGHQhFyAAKAIEIhZBBWytIQ8gACgCCCIYQQVsrSENIAAoAgwiGUEFbK0hCyAAKAIQIhpBBWytIQkgADUCACEIIBqtIRAgGa0hDiAYrSEMIBatIQoDQCASIAEtAAMiEiABLQAEQQh0ciABLQAFQRB0ciABLQAGIhZBGHRyQQJ2Qf///x9xaq0iAyAOfiABLwAAIAEtAAJBEHRyIBNqIBJBGHRBgICAGHFqrSIEIBB+fCARIAEtAAdBCHQgFnIgAS0ACEEQdHIgAS0ACSIRQRh0ckEEdkH///8fcWqtIgUgDH58IAEtAApBCHQgEXIgAS0AC0EQdHIgAS0ADEEYdHJBBnYgFWqtIgYgCn58IBQgF2ogAS8ADSABLQAPQRB0cmqtIgcgCH58IAMgDH4gBCAOfnwgBSAKfnwgBiAIfnwgByAJfnwgAyAKfiAEIAx+fCAFIAh+fCAGIAl+fCAHIAt+fCADIAh+IAQgCn58IAUgCX58IAYgC358IAcgDX58IAMgCX4gBCAIfnwgBSALfnwgBiANfnwgByAPfnwiA0IaiEL/////D4N8IgRCGohC/////w+DfCIFQhqIQv////8Pg3wiBkIaiEL/////D4N8IgdCGoinQQVsIAOnQf///x9xaiITQRp2IASnQf///x9xaiESIAWnQf///x9xIREgBqdB////H3EhFSAHp0H///8fcSEUIBNB////H3EhEyABQRBqIQEgAkEQayICQQ9LDQALCyAAIBQ2AiQgACAVNgIgIAAgETYCHCAAIBI2AhggACATNgIUCwMAAQu2BAEGfwJAIAAoAjgiBARAIABBPGohBQJAIAJBECAEayIDIAIgA0kbIgZFDQAgBkEDcSEHAkAgBkEBa0EDSQRAQQAhAwwBCyAGQXxxIQhBACEDA0AgBSADIARqaiABIANqLQAAOgAAIAUgA0EBciIEIAAoAjhqaiABIARqLQAAOgAAIAUgA0ECciIEIAAoAjhqaiABIARqLQAAOgAAIAUgA0EDciIEIAAoAjhqaiABIARqLQAAOgAAIANBBGohAyAAKAI4IQQgCEEEayIIDQALCyAHRQ0AA0AgBSADIARqaiABIANqLQAAOgAAIANBAWohAyAAKAI4IQQgB0EBayIHDQALCyAAIAQgBmoiAzYCOCADQRBJDQEgACAFQRAQAiAAQQA2AjggAiAGayECIAEgBmohAQsgAkEQTwRAIAAgASACQXBxIgMQAiACQQ9xIQIgASADaiEBCyACRQ0AIAJBA3EhBCAAQTxqIQVBACEDIAJBAWtBA08EQCACQXxxIQcDQCAFIAAoAjggA2pqIAEgA2otAAA6AAAgBSADQQFyIgYgACgCOGpqIAEgBmotAAA6AAAgBSADQQJyIgYgACgCOGpqIAEgBmotAAA6AAAgBSADQQNyIgYgACgCOGpqIAEgBmotAAA6AAAgA0EEaiEDIAdBBGsiBw0ACwsgBARAA0AgBSAAKAI4IANqaiABIANqLQAAOgAAIANBAWohAyAEQQFrIgQNAAsLIAAgACgCOCACajYCOAsLoS0BDH8jAEEQayIMJAACQAJAAkACQAJAAkACQAJAAkACQAJAAkAgAEH0AU0EQEGICCgCACIFQRAgAEELakF4cSAAQQtJGyIIQQN2IgJ2IgFBA3EEQCABQX9zQQFxIAJqIgNBA3QiAUG4CGooAgAiBEEIaiEAAkAgBCgCCCICIAFBsAhqIgFGBEBBiAggBUF+IAN3cTYCAAwBCyACIAE2AgwgASACNgIICyAEIANBA3QiAUEDcjYCBCABIARqIgEgASgCBEEBcjYCBAwNCyAIQZAIKAIAIgpNDQEgAQRAAkBBAiACdCIAQQAgAGtyIAEgAnRxIgBBACAAa3FBAWsiACAAQQx2QRBxIgJ2IgFBBXZBCHEiACACciABIAB2IgFBAnZBBHEiAHIgASAAdiIBQQF2QQJxIgByIAEgAHYiAUEBdkEBcSIAciABIAB2aiIDQQN0IgBBuAhqKAIAIgQoAggiASAAQbAIaiIARgRAQYgIIAVBfiADd3EiBTYCAAwBCyABIAA2AgwgACABNgIICyAEQQhqIQAgBCAIQQNyNgIEIAQgCGoiAiADQQN0IgEgCGsiA0EBcjYCBCABIARqIAM2AgAgCgRAIApBA3YiAUEDdEGwCGohB0GcCCgCACEEAn8gBUEBIAF0IgFxRQRAQYgIIAEgBXI2AgAgBwwBCyAHKAIICyEBIAcgBDYCCCABIAQ2AgwgBCAHNgIMIAQgATYCCAtBnAggAjYCAEGQCCADNgIADA0LQYwIKAIAIgZFDQEgBkEAIAZrcUEBayIAIABBDHZBEHEiAnYiAUEFdkEIcSIAIAJyIAEgAHYiAUECdkEEcSIAciABIAB2IgFBAXZBAnEiAHIgASAAdiIBQQF2QQFxIgByIAEgAHZqQQJ0QbgKaigCACIBKAIEQXhxIAhrIQMgASECA0ACQCACKAIQIgBFBEAgAigCFCIARQ0BCyAAKAIEQXhxIAhrIgIgAyACIANJIgIbIQMgACABIAIbIQEgACECDAELCyABIAhqIgkgAU0NAiABKAIYIQsgASABKAIMIgRHBEAgASgCCCIAQZgIKAIASRogACAENgIMIAQgADYCCAwMCyABQRRqIgIoAgAiAEUEQCABKAIQIgBFDQQgAUEQaiECCwNAIAIhByAAIgRBFGoiAigCACIADQAgBEEQaiECIAQoAhAiAA0ACyAHQQA2AgAMCwtBfyEIIABBv39LDQAgAEELaiIAQXhxIQhBjAgoAgAiCUUNAEEAIAhrIQMCQAJAAkACf0EAIAhBgAJJDQAaQR8gCEH///8HSw0AGiAAQQh2IgAgAEGA/j9qQRB2QQhxIgJ0IgAgAEGA4B9qQRB2QQRxIgF0IgAgAEGAgA9qQRB2QQJxIgB0QQ92IAEgAnIgAHJrIgBBAXQgCCAAQRVqdkEBcXJBHGoLIgVBAnRBuApqKAIAIgJFBEBBACEADAELQQAhACAIQQBBGSAFQQF2ayAFQR9GG3QhAQNAAkAgAigCBEF4cSAIayIHIANPDQAgAiEEIAciAw0AQQAhAyACIQAMAwsgACACKAIUIgcgByACIAFBHXZBBHFqKAIQIgJGGyAAIAcbIQAgAUEBdCEBIAINAAsLIAAgBHJFBEBBACEEQQIgBXQiAEEAIABrciAJcSIARQ0DIABBACAAa3FBAWsiACAAQQx2QRBxIgJ2IgFBBXZBCHEiACACciABIAB2IgFBAnZBBHEiAHIgASAAdiIBQQF2QQJxIgByIAEgAHYiAUEBdkEBcSIAciABIAB2akECdEG4CmooAgAhAAsgAEUNAQsDQCAAKAIEQXhxIAhrIgEgA0khAiABIAMgAhshAyAAIAQgAhshBCAAKAIQIgEEfyABBSAAKAIUCyIADQALCyAERQ0AIANBkAgoAgAgCGtPDQAgBCAIaiIGIARNDQEgBCgCGCEFIAQgBCgCDCIBRwRAIAQoAggiAEGYCCgCAEkaIAAgATYCDCABIAA2AggMCgsgBEEUaiICKAIAIgBFBEAgBCgCECIARQ0EIARBEGohAgsDQCACIQcgACIBQRRqIgIoAgAiAA0AIAFBEGohAiABKAIQIgANAAsgB0EANgIADAkLIAhBkAgoAgAiAk0EQEGcCCgCACEDAkAgAiAIayIBQRBPBEBBkAggATYCAEGcCCADIAhqIgA2AgAgACABQQFyNgIEIAIgA2ogATYCACADIAhBA3I2AgQMAQtBnAhBADYCAEGQCEEANgIAIAMgAkEDcjYCBCACIANqIgAgACgCBEEBcjYCBAsgA0EIaiEADAsLIAhBlAgoAgAiBkkEQEGUCCAGIAhrIgE2AgBBoAhBoAgoAgAiAiAIaiIANgIAIAAgAUEBcjYCBCACIAhBA3I2AgQgAkEIaiEADAsLQQAhACAIQS9qIgkCf0HgCygCAARAQegLKAIADAELQewLQn83AgBB5AtCgKCAgICABDcCAEHgCyAMQQxqQXBxQdiq1aoFczYCAEH0C0EANgIAQcQLQQA2AgBBgCALIgFqIgVBACABayIHcSICIAhNDQpBwAsoAgAiBARAQbgLKAIAIgMgAmoiASADTQ0LIAEgBEsNCwtBxAstAABBBHENBQJAAkBBoAgoAgAiAwRAQcgLIQADQCADIAAoAgAiAU8EQCABIAAoAgRqIANLDQMLIAAoAggiAA0ACwtBABABIgFBf0YNBiACIQVB5AsoAgAiA0EBayIAIAFxBEAgAiABayAAIAFqQQAgA2txaiEFCyAFIAhNDQYgBUH+////B0sNBkHACygCACIEBEBBuAsoAgAiAyAFaiIAIANNDQcgACAESw0HCyAFEAEiACABRw0BDAgLIAUgBmsgB3EiBUH+////B0sNBSAFEAEiASAAKAIAIAAoAgRqRg0EIAEhAAsCQCAAQX9GDQAgCEEwaiAFTQ0AQegLKAIAIgEgCSAFa2pBACABa3EiAUH+////B0sEQCAAIQEMCAsgARABQX9HBEAgASAFaiEFIAAhAQwIC0EAIAVrEAEaDAULIAAiAUF/Rw0GDAQLAAtBACEEDAcLQQAhAQwFCyABQX9HDQILQcQLQcQLKAIAQQRyNgIACyACQf7///8HSw0BIAIQASEBQQAQASEAIAFBf0YNASAAQX9GDQEgACABTQ0BIAAgAWsiBSAIQShqTQ0BC0G4C0G4CygCACAFaiIANgIAQbwLKAIAIABJBEBBvAsgADYCAAsCQAJAAkBBoAgoAgAiBwRAQcgLIQADQCABIAAoAgAiAyAAKAIEIgJqRg0CIAAoAggiAA0ACwwCC0GYCCgCACIAQQAgACABTRtFBEBBmAggATYCAAtBACEAQcwLIAU2AgBByAsgATYCAEGoCEF/NgIAQawIQeALKAIANgIAQdQLQQA2AgADQCAAQQN0IgNBuAhqIANBsAhqIgI2AgAgA0G8CGogAjYCACAAQQFqIgBBIEcNAAtBlAggBUEoayIDQXggAWtBB3FBACABQQhqQQdxGyIAayICNgIAQaAIIAAgAWoiADYCACAAIAJBAXI2AgQgASADakEoNgIEQaQIQfALKAIANgIADAILIAAtAAxBCHENACADIAdLDQAgASAHTQ0AIAAgAiAFajYCBEGgCCAHQXggB2tBB3FBACAHQQhqQQdxGyIAaiICNgIAQZQIQZQIKAIAIAVqIgEgAGsiADYCACACIABBAXI2AgQgASAHakEoNgIEQaQIQfALKAIANgIADAELQZgIKAIAIAFLBEBBmAggATYCAAsgASAFaiECQcgLIQACQAJAAkACQAJAAkADQCACIAAoAgBHBEAgACgCCCIADQEMAgsLIAAtAAxBCHFFDQELQcgLIQADQCAHIAAoAgAiAk8EQCACIAAoAgRqIgQgB0sNAwsgACgCCCEADAALAAsgACABNgIAIAAgACgCBCAFajYCBCABQXggAWtBB3FBACABQQhqQQdxG2oiCSAIQQNyNgIEIAJBeCACa0EHcUEAIAJBCGpBB3EbaiIFIAggCWoiBmshAiAFIAdGBEBBoAggBjYCAEGUCEGUCCgCACACaiIANgIAIAYgAEEBcjYCBAwDCyAFQZwIKAIARgRAQZwIIAY2AgBBkAhBkAgoAgAgAmoiADYCACAGIABBAXI2AgQgACAGaiAANgIADAMLIAUoAgQiAEEDcUEBRgRAIABBeHEhBwJAIABB/wFNBEAgBSgCCCIDIABBA3YiAEEDdEGwCGpGGiADIAUoAgwiAUYEQEGICEGICCgCAEF+IAB3cTYCAAwCCyADIAE2AgwgASADNgIIDAELIAUoAhghCAJAIAUgBSgCDCIBRwRAIAUoAggiACABNgIMIAEgADYCCAwBCwJAIAVBFGoiACgCACIDDQAgBUEQaiIAKAIAIgMNAEEAIQEMAQsDQCAAIQQgAyIBQRRqIgAoAgAiAw0AIAFBEGohACABKAIQIgMNAAsgBEEANgIACyAIRQ0AAkAgBSAFKAIcIgNBAnRBuApqIgAoAgBGBEAgACABNgIAIAENAUGMCEGMCCgCAEF+IAN3cTYCAAwCCyAIQRBBFCAIKAIQIAVGG2ogATYCACABRQ0BCyABIAg2AhggBSgCECIABEAgASAANgIQIAAgATYCGAsgBSgCFCIARQ0AIAEgADYCFCAAIAE2AhgLIAUgB2ohBSACIAdqIQILIAUgBSgCBEF+cTYCBCAGIAJBAXI2AgQgAiAGaiACNgIAIAJB/wFNBEAgAkEDdiIAQQN0QbAIaiECAn9BiAgoAgAiAUEBIAB0IgBxRQRAQYgIIAAgAXI2AgAgAgwBCyACKAIICyEAIAIgBjYCCCAAIAY2AgwgBiACNgIMIAYgADYCCAwDC0EfIQAgAkH///8HTQRAIAJBCHYiACAAQYD+P2pBEHZBCHEiA3QiACAAQYDgH2pBEHZBBHEiAXQiACAAQYCAD2pBEHZBAnEiAHRBD3YgASADciAAcmsiAEEBdCACIABBFWp2QQFxckEcaiEACyAGIAA2AhwgBkIANwIQIABBAnRBuApqIQQCQEGMCCgCACIDQQEgAHQiAXFFBEBBjAggASADcjYCACAEIAY2AgAgBiAENgIYDAELIAJBAEEZIABBAXZrIABBH0YbdCEAIAQoAgAhAQNAIAEiAygCBEF4cSACRg0DIABBHXYhASAAQQF0IQAgAyABQQRxaiIEKAIQIgENAAsgBCAGNgIQIAYgAzYCGAsgBiAGNgIMIAYgBjYCCAwCC0GUCCAFQShrIgNBeCABa0EHcUEAIAFBCGpBB3EbIgBrIgI2AgBBoAggACABaiIANgIAIAAgAkEBcjYCBCABIANqQSg2AgRBpAhB8AsoAgA2AgAgByAEQScgBGtBB3FBACAEQSdrQQdxG2pBL2siACAAIAdBEGpJGyICQRs2AgQgAkHQCykCADcCECACQcgLKQIANwIIQdALIAJBCGo2AgBBzAsgBTYCAEHICyABNgIAQdQLQQA2AgAgAkEYaiEAA0AgAEEHNgIEIABBCGohASAAQQRqIQAgASAESQ0ACyACIAdGDQMgAiACKAIEQX5xNgIEIAcgAiAHayIEQQFyNgIEIAIgBDYCACAEQf8BTQRAIARBA3YiAEEDdEGwCGohAgJ/QYgIKAIAIgFBASAAdCIAcUUEQEGICCAAIAFyNgIAIAIMAQsgAigCCAshACACIAc2AgggACAHNgIMIAcgAjYCDCAHIAA2AggMBAtBHyEAIAdCADcCECAEQf///wdNBEAgBEEIdiIAIABBgP4/akEQdkEIcSICdCIAIABBgOAfakEQdkEEcSIBdCIAIABBgIAPakEQdkECcSIAdEEPdiABIAJyIAByayIAQQF0IAQgAEEVanZBAXFyQRxqIQALIAcgADYCHCAAQQJ0QbgKaiEDAkBBjAgoAgAiAkEBIAB0IgFxRQRAQYwIIAEgAnI2AgAgAyAHNgIAIAcgAzYCGAwBCyAEQQBBGSAAQQF2ayAAQR9GG3QhACADKAIAIQEDQCABIgIoAgRBeHEgBEYNBCAAQR12IQEgAEEBdCEAIAIgAUEEcWoiAygCECIBDQALIAMgBzYCECAHIAI2AhgLIAcgBzYCDCAHIAc2AggMAwsgAygCCCIAIAY2AgwgAyAGNgIIIAZBADYCGCAGIAM2AgwgBiAANgIICyAJQQhqIQAMBQsgAigCCCIAIAc2AgwgAiAHNgIIIAdBADYCGCAHIAI2AgwgByAANgIIC0GUCCgCACIAIAhNDQBBlAggACAIayIBNgIAQaAIQaAIKAIAIgIgCGoiADYCACAAIAFBAXI2AgQgAiAIQQNyNgIEIAJBCGohAAwDC0GECEEwNgIAQQAhAAwCCwJAIAVFDQACQCAEKAIcIgJBAnRBuApqIgAoAgAgBEYEQCAAIAE2AgAgAQ0BQYwIIAlBfiACd3EiCTYCAAwCCyAFQRBBFCAFKAIQIARGG2ogATYCACABRQ0BCyABIAU2AhggBCgCECIABEAgASAANgIQIAAgATYCGAsgBCgCFCIARQ0AIAEgADYCFCAAIAE2AhgLAkAgA0EPTQRAIAQgAyAIaiIAQQNyNgIEIAAgBGoiACAAKAIEQQFyNgIEDAELIAQgCEEDcjYCBCAGIANBAXI2AgQgAyAGaiADNgIAIANB/wFNBEAgA0EDdiIAQQN0QbAIaiECAn9BiAgoAgAiAUEBIAB0IgBxRQRAQYgIIAAgAXI2AgAgAgwBCyACKAIICyEAIAIgBjYCCCAAIAY2AgwgBiACNgIMIAYgADYCCAwBC0EfIQAgA0H///8HTQRAIANBCHYiACAAQYD+P2pBEHZBCHEiAnQiACAAQYDgH2pBEHZBBHEiAXQiACAAQYCAD2pBEHZBAnEiAHRBD3YgASACciAAcmsiAEEBdCADIABBFWp2QQFxckEcaiEACyAGIAA2AhwgBkIANwIQIABBAnRBuApqIQICQAJAIAlBASAAdCIBcUUEQEGMCCABIAlyNgIAIAIgBjYCACAGIAI2AhgMAQsgA0EAQRkgAEEBdmsgAEEfRht0IQAgAigCACEIA0AgCCIBKAIEQXhxIANGDQIgAEEddiECIABBAXQhACABIAJBBHFqIgIoAhAiCA0ACyACIAY2AhAgBiABNgIYCyAGIAY2AgwgBiAGNgIIDAELIAEoAggiACAGNgIMIAEgBjYCCCAGQQA2AhggBiABNgIMIAYgADYCCAsgBEEIaiEADAELAkAgC0UNAAJAIAEoAhwiAkECdEG4CmoiACgCACABRgRAIAAgBDYCACAEDQFBjAggBkF+IAJ3cTYCAAwCCyALQRBBFCALKAIQIAFGG2ogBDYCACAERQ0BCyAEIAs2AhggASgCECIABEAgBCAANgIQIAAgBDYCGAsgASgCFCIARQ0AIAQgADYCFCAAIAQ2AhgLAkAgA0EPTQRAIAEgAyAIaiIAQQNyNgIEIAAgAWoiACAAKAIEQQFyNgIEDAELIAEgCEEDcjYCBCAJIANBAXI2AgQgAyAJaiADNgIAIAoEQCAKQQN2IgBBA3RBsAhqIQRBnAgoAgAhAgJ/QQEgAHQiACAFcUUEQEGICCAAIAVyNgIAIAQMAQsgBCgCCAshACAEIAI2AgggACACNgIMIAIgBDYCDCACIAA2AggLQZwIIAk2AgBBkAggAzYCAAsgAUEIaiEACyAMQRBqJAAgAAsQACMAIABrQXBxIgAkACAACwYAIAAkAAsEACMAC4AJAgh/BH4jAEGQAWsiBiQAIAYgBS0AA0EYdEGAgIAYcSAFLwAAIAUtAAJBEHRycjYCACAGIAUoAANBAnZBg/7/H3E2AgQgBiAFKAAGQQR2Qf+B/x9xNgIIIAYgBSgACUEGdkH//8AfcTYCDCAFLwANIQggBS0ADyEJIAZCADcCFCAGQgA3AhwgBkEANgIkIAYgCCAJQRB0QYCAPHFyNgIQIAYgBSgAEDYCKCAGIAUoABQ2AiwgBiAFKAAYNgIwIAUoABwhBSAGQQA6AEwgBkEANgI4IAYgBTYCNCAGIAEgAhAEIAQEQCAGIAMgBBAECyAGKAI4IgEEQCAGQTxqIgIgAWpBAToAACABQQFqQQ9NBEAgASAGakE9aiEEAkBBDyABayIDRQ0AIAMgBGoiAUEBa0EAOgAAIARBADoAACADQQNJDQAgAUECa0EAOgAAIARBADoAASABQQNrQQA6AAAgBEEAOgACIANBB0kNACABQQRrQQA6AAAgBEEAOgADIANBCUkNACAEQQAgBGtBA3EiAWoiBEEANgIAIAQgAyABa0F8cSIBaiIDQQRrQQA2AgAgAUEJSQ0AIARBADYCCCAEQQA2AgQgA0EIa0EANgIAIANBDGtBADYCACABQRlJDQAgBEEANgIYIARBADYCFCAEQQA2AhAgBEEANgIMIANBEGtBADYCACADQRRrQQA2AgAgA0EYa0EANgIAIANBHGtBADYCACABIARBBHFBGHIiAWsiA0EgSQ0AIAEgBGohAQNAIAFCADcDGCABQgA3AxAgAUIANwMIIAFCADcDACABQSBqIQEgA0EgayIDQR9LDQALCwsgBkEBOgBMIAYgAkEQEAILIAY1AjQhECAGNQIwIREgBjUCLCEOIAAgBjUCKCAGKAIkIAYoAiAgBigCHCAGKAIYIgNBGnZqIgJBGnZqIgFBGnZqIgtBgICAYHIgAUH///8fcSINIAJB////H3EiCCAGKAIUIAtBGnZBBWxqIgFB////H3EiCUEFaiIFQRp2IANB////H3EgAUEadmoiA2oiAUEadmoiAkEadmoiBEEadmoiDEEfdSIHIANxIAEgDEEfdkEBayIDQf///x9xIgpxciIBQRp0IAUgCnEgByAJcXJyrXwiDzwAACAAIA9CGIg8AAMgACAPQhCIPAACIAAgD0IIiDwAASAAIA4gByAIcSACIApxciICQRR0IAFBBnZyrXwgD0IgiHwiDjwABCAAIA5CGIg8AAcgACAOQhCIPAAGIAAgDkIIiDwABSAAIBEgByANcSAEIApxciIBQQ50IAJBDHZyrXwgDkIgiHwiDjwACCAAIA5CGIg8AAsgACAOQhCIPAAKIAAgDkIIiDwACSAAIBAgAyAMcSAHIAtxckEIdCABQRJ2cq18IA5CIIh8Ig48AAwgACAOQhiIPAAPIAAgDkIQiDwADiAAIA5CCIg8AA0gBkIANwIwIAZCADcCKCAGQgA3AiAgBkIANwIYIAZCADcCECAGQgA3AgggBkIANwIAIAZBkAFqJAALpwwBB38CQCAARQ0AIABBCGsiAyAAQQRrKAIAIgFBeHEiAGohBQJAIAFBAXENACABQQNxRQ0BIAMgAygCACIBayIDQZgIKAIASQ0BIAAgAWohACADQZwIKAIARwRAIAFB/wFNBEAgAygCCCICIAFBA3YiBEEDdEGwCGpGGiACIAMoAgwiAUYEQEGICEGICCgCAEF+IAR3cTYCAAwDCyACIAE2AgwgASACNgIIDAILIAMoAhghBgJAIAMgAygCDCIBRwRAIAMoAggiAiABNgIMIAEgAjYCCAwBCwJAIANBFGoiAigCACIEDQAgA0EQaiICKAIAIgQNAEEAIQEMAQsDQCACIQcgBCIBQRRqIgIoAgAiBA0AIAFBEGohAiABKAIQIgQNAAsgB0EANgIACyAGRQ0BAkAgAyADKAIcIgJBAnRBuApqIgQoAgBGBEAgBCABNgIAIAENAUGMCEGMCCgCAEF+IAJ3cTYCAAwDCyAGQRBBFCAGKAIQIANGG2ogATYCACABRQ0CCyABIAY2AhggAygCECICBEAgASACNgIQIAIgATYCGAsgAygCFCICRQ0BIAEgAjYCFCACIAE2AhgMAQsgBSgCBCIBQQNxQQNHDQBBkAggADYCACAFIAFBfnE2AgQgAyAAQQFyNgIEIAAgA2ogADYCAA8LIAMgBU8NACAFKAIEIgFBAXFFDQACQCABQQJxRQRAIAVBoAgoAgBGBEBBoAggAzYCAEGUCEGUCCgCACAAaiIANgIAIAMgAEEBcjYCBCADQZwIKAIARw0DQZAIQQA2AgBBnAhBADYCAA8LIAVBnAgoAgBGBEBBnAggAzYCAEGQCEGQCCgCACAAaiIANgIAIAMgAEEBcjYCBCAAIANqIAA2AgAPCyABQXhxIABqIQACQCABQf8BTQRAIAUoAggiAiABQQN2IgRBA3RBsAhqRhogAiAFKAIMIgFGBEBBiAhBiAgoAgBBfiAEd3E2AgAMAgsgAiABNgIMIAEgAjYCCAwBCyAFKAIYIQYCQCAFIAUoAgwiAUcEQCAFKAIIIgJBmAgoAgBJGiACIAE2AgwgASACNgIIDAELAkAgBUEUaiICKAIAIgQNACAFQRBqIgIoAgAiBA0AQQAhAQwBCwNAIAIhByAEIgFBFGoiAigCACIEDQAgAUEQaiECIAEoAhAiBA0ACyAHQQA2AgALIAZFDQACQCAFIAUoAhwiAkECdEG4CmoiBCgCAEYEQCAEIAE2AgAgAQ0BQYwIQYwIKAIAQX4gAndxNgIADAILIAZBEEEUIAYoAhAgBUYbaiABNgIAIAFFDQELIAEgBjYCGCAFKAIQIgIEQCABIAI2AhAgAiABNgIYCyAFKAIUIgJFDQAgASACNgIUIAIgATYCGAsgAyAAQQFyNgIEIAAgA2ogADYCACADQZwIKAIARw0BQZAIIAA2AgAPCyAFIAFBfnE2AgQgAyAAQQFyNgIEIAAgA2ogADYCAAsgAEH/AU0EQCAAQQN2IgFBA3RBsAhqIQACf0GICCgCACICQQEgAXQiAXFFBEBBiAggASACcjYCACAADAELIAAoAggLIQIgACADNgIIIAIgAzYCDCADIAA2AgwgAyACNgIIDwtBHyECIANCADcCECAAQf///wdNBEAgAEEIdiIBIAFBgP4/akEQdkEIcSIBdCICIAJBgOAfakEQdkEEcSICdCIEIARBgIAPakEQdkECcSIEdEEPdiABIAJyIARyayIBQQF0IAAgAUEVanZBAXFyQRxqIQILIAMgAjYCHCACQQJ0QbgKaiEBAkACQAJAQYwIKAIAIgRBASACdCIHcUUEQEGMCCAEIAdyNgIAIAEgAzYCACADIAE2AhgMAQsgAEEAQRkgAkEBdmsgAkEfRht0IQIgASgCACEBA0AgASIEKAIEQXhxIABGDQIgAkEddiEBIAJBAXQhAiAEIAFBBHFqIgdBEGooAgAiAQ0ACyAHIAM2AhAgAyAENgIYCyADIAM2AgwgAyADNgIIDAELIAQoAggiACADNgIMIAQgAzYCCCADQQA2AhggAyAENgIMIAMgADYCCAtBqAhBqAgoAgBBAWsiAEF/IAAbNgIACwsLCQEAQYEICwIGUA==",!UA.startsWith(BA)){var LA=UA;UA=I.locateFile?I.locateFile(LA,z):z+LA}function QQ(){var f=UA;try{if(f==UA&&P)return new Uint8Array(P);var $A=tQ(f);if($A)return $A;if(D)return D(f);throw"both async and sync fetching of the wasm failed"}catch(HA){FA(HA)}}function yI(){if(!P&&(C||Z)){if(typeof fetch==="function"&&!UA.startsWith("file://"))return fetch(UA,{credentials:"same-origin"}).then(function(f){if(!f.ok)throw"failed to load wasm binary file at '"+UA+"'";return f.arrayBuffer()}).catch(function(){return QQ()});if(q)return new Promise(function(f,$A){q(UA,function(HA){f(new Uint8Array(HA))},$A)})}return Promise.resolve().then(function(){return QQ()})}function QI(f){for(;0<f.length;){var $A=f.shift();if(typeof $A=="function")$A(I);else{var HA=$A.m;typeof HA==="number"?$A.l===void 0?AA.get(HA)():AA.get(HA)($A.l):HA($A.l===void 0?null:$A.l)}}}var x0=!1,v0=typeof atob==="function"?atob:function(f){var $A="",HA=0;f=f.replace(/[^A-Za-z0-9\+\/=]/g,"");do{var OA="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(f.charAt(HA++)),iA="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(f.charAt(HA++)),FQ="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(f.charAt(HA++)),sQ="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(f.charAt(HA++));OA=OA<<2|iA>>4,iA=(iA&15)<<4|FQ>>2;var kQ=(FQ&3)<<6|sQ;$A+=String.fromCharCode(OA),FQ!==64&&($A+=String.fromCharCode(iA)),sQ!==64&&($A+=String.fromCharCode(kQ))}while(HA<f.length);return $A};function tQ(f){if(f.startsWith(BA)){if(f=f.slice(BA.length),typeof Y==="boolean"&&Y){var $A=Buffer.from(f,"base64");$A=new Uint8Array($A.buffer,$A.byteOffset,$A.byteLength)}else try{var HA=v0(f),OA=new Uint8Array(HA.length);for(f=0;f<HA.length;++f)OA[f]=HA.charCodeAt(f);$A=OA}catch(iA){throw Error("Converting base64 string to bytes failed.")}return $A}}var P0={a:function(f){var $A=S.length;if(f>>>=0,2147483648<f)return!1;for(var HA=1;4>=HA;HA*=2){var OA=$A*(1+0.2/HA);OA=Math.min(OA,f+100663296),OA=Math.max(f,OA),0<OA%65536&&(OA+=65536-OA%65536);A:{try{k.grow(Math.min(2147483648,OA)-E.byteLength+65535>>>16),QA();var iA=1;break A}catch(FQ){}iA=void 0}if(iA)return!0}return!1}};(function(){function f(iA){I.asm=iA.exports,k=I.asm.b,QA(),AA=I.asm.j,JA.unshift(I.asm.c),g--,I.monitorRunDependencies&&I.monitorRunDependencies(g),g==0&&(b!==null&&(clearInterval(b),b=null),d&&(iA=d,d=null,iA()))}function $A(iA){f(iA.instance)}function HA(iA){return yI().then(function(FQ){return WebAssembly.instantiate(FQ,OA)}).then(iA,function(FQ){v("failed to asynchronously prepare wasm: "+FQ),FA(FQ)})}var OA={a:P0};if(g++,I.monitorRunDependencies&&I.monitorRunDependencies(g),I.instantiateWasm)try{return I.instantiateWasm(OA,f)}catch(iA){return v("Module.instantiateWasm callback failed with error: "+iA),!1}return function(){return P||typeof WebAssembly.instantiateStreaming!=="function"||UA.startsWith(BA)||UA.startsWith("file://")||typeof fetch!=="function"?HA($A):fetch(UA,{credentials:"same-origin"}).then(function(iA){return WebAssembly.instantiateStreaming(iA,OA).then($A,function(FQ){return v("wasm streaming compile failed: "+FQ),v("falling back to ArrayBuffer instantiation"),HA($A)})})}().catch($),{}})(),I.___wasm_call_ctors=function(){return(I.___wasm_call_ctors=I.asm.c).apply(null,arguments)},I._poly1305_auth=function(){return(I._poly1305_auth=I.asm.d).apply(null,arguments)};var II=I.stackSave=function(){return(II=I.stackSave=I.asm.e).apply(null,arguments)},mI=I.stackRestore=function(){return(mI=I.stackRestore=I.asm.f).apply(null,arguments)},JI=I.stackAlloc=function(){return(JI=I.stackAlloc=I.asm.g).apply(null,arguments)};I._malloc=function(){return(I._malloc=I.asm.h).apply(null,arguments)},I._free=function(){return(I._free=I.asm.i).apply(null,arguments)},I.cwrap=function(f,$A,HA,OA){HA=HA||[];var iA=HA.every(function(FQ){return FQ==="number"});return $A!=="string"&&iA&&!OA?u(f):function(){return M(f,$A,HA,arguments)}};var _0;d=function f(){_0||E0(),_0||(d=f)};function E0(){function f(){if(!_0&&(_0=!0,I.calledRun=!0,!a)){if(QI(JA),J(I),I.onRuntimeInitialized)I.onRuntimeInitialized();if(I.postRun)for(typeof I.postRun=="function"&&(I.postRun=[I.postRun]);I.postRun.length;){var $A=I.postRun.shift();IA.unshift($A)}QI(IA)}}if(!(0<g)){if(I.preRun)for(typeof I.preRun=="function"&&(I.preRun=[I.preRun]);I.preRun.length;)L();QI(n),0<g||(I.setStatus?(I.setStatus("Running..."),setTimeout(function(){setTimeout(function(){I.setStatus("")},1),f()},1)):f())}}if(I.run=E0,I.preInit)for(typeof I.preInit=="function"&&(I.preInit=[I.preInit]);0<I.preInit.length;)I.preInit.pop()();return E0(),Q.ready}}();if(typeof eI==="object"&&typeof aJ==="object")aJ.exports=rJ;else if(typeof define==="function"&&define.amd)define([],function(){return rJ});else if(typeof eI==="object")eI.createPoly1305=rJ});var j0=cA((kY,YX)=>{var{createCipheriv:d0,createDecipheriv:AJ,createHmac:tJ,randomFillSync:w0,timingSafeEqual:eJ}=EA("crypto"),{readUInt32BE:HI,writeUInt32BE:mQ}=iQ(),B0=Buffer[Symbol.species],nG=Buffer.alloc(0),f0=Buffer.alloc(4),QJ=new Map,A$,Q$,I$,J$,$$,G$,X$;try{A$=(()=>{throw new Error("Cannot require module "+"./crypto/build/Release/sshcrypto.node");})(),{AESGCMCipher:Q$,ChaChaPolyCipher:I$,GenericCipher:J$,AESGCMDecipher:$$,ChaChaPolyDecipher:G$,GenericDecipher:X$}=A$}catch{}var UQ=1,x8=(()=>{function A(Q,I,J,$,G,X,C){return{sslName:Q,blockLen:I,keyLen:J,ivLen:$!==0||C&UQ?$:I,authLen:G,discardLen:X,stream:!!(C&UQ)}}return{"[email protected]":A("chacha20",8,64,0,16,0,UQ),"aes128-gcm":A("aes-128-gcm",16,16,12,16,0,UQ),"aes256-gcm":A("aes-256-gcm",16,32,12,16,0,UQ),"[email protected]":A("aes-128-gcm",16,16,12,16,0,UQ),"[email protected]":A("aes-256-gcm",16,32,12,16,0,UQ),"aes128-cbc":A("aes-128-cbc",16,16,0,0,0,0),"aes192-cbc":A("aes-192-cbc",16,24,0,0,0,0),"aes256-cbc":A("aes-256-cbc",16,32,0,0,0,0),"[email protected]":A("aes-256-cbc",16,32,0,0,0,0),"3des-cbc":A("des-ede3-cbc",8,24,0,0,0,0),"blowfish-cbc":A("bf-cbc",8,16,0,0,0,0),"idea-cbc":A("idea-cbc",8,16,0,0,0,0),"cast128-cbc":A("cast-cbc",8,16,0,0,0,0),"aes128-ctr":A("aes-128-ctr",16,16,16,0,0,UQ),"aes192-ctr":A("aes-192-ctr",16,24,16,0,0,UQ),"aes256-ctr":A("aes-256-ctr",16,32,16,0,0,UQ),"3des-ctr":A("des-ede3",8,24,8,0,0,UQ),"blowfish-ctr":A("bf-ecb",8,16,8,0,0,UQ),"cast128-ctr":A("cast5-ecb",8,16,8,0,0,UQ),arcfour:A("rc4",8,16,0,0,1536,UQ),arcfour128:A("rc4",8,16,0,0,1536,UQ),arcfour256:A("rc4",8,32,0,0,1536,UQ),arcfour512:A("rc4",8,64,0,0,1536,UQ)}})(),v8=(()=>{function A(Q,I,J,$){return{sslName:Q,len:I,actualLen:J,isETM:$}}return{"hmac-md5":A("md5",16,16,!1),"hmac-md5-96":A("md5",16,12,!1),"hmac-ripemd160":A("ripemd160",20,20,!1),"hmac-sha1":A("sha1",20,20,!1),"[email protected]":A("sha1",20,20,!0),"hmac-sha1-96":A("sha1",20,12,!1),"hmac-sha2-256":A("sha256",32,32,!1),"[email protected]":A("sha256",32,32,!0),"hmac-sha2-256-96":A("sha256",32,12,!1),"hmac-sha2-512":A("sha512",64,64,!1),"[email protected]":A("sha512",64,64,!0),"hmac-sha2-512-96":A("sha512",64,12,!1)}})();class sG{constructor(A,Q){this.outSeqno=A,this._onWrite=Q,this._dead=!1}free(){this._dead=!0}allocPacket(A){let Q=5+A,I=8-(Q&7);if(I<4)I+=8;Q+=I;let J=Buffer.allocUnsafe(Q);return mQ(J,Q-4,0),J[4]=I,w0(J,5+A,I),J}encrypt(A){if(this._dead)return;this._onWrite(A),this.outSeqno=this.outSeqno+1>>>0}}var rG=Buffer.alloc(32),_Q=Buffer.alloc(16),WI,FI,C$;class aG{constructor(A){let Q=A.outbound;this.outSeqno=Q.seqno,this._onWrite=Q.onWrite,this._encKeyMain=Q.cipherKey.slice(0,32),this._encKeyPktLen=Q.cipherKey.slice(32),this._dead=!1}free(){this._dead=!0}allocPacket(A){let Q=5+A,I=8-(Q-4&7);if(I<4)I+=8;Q+=I;let J=Buffer.allocUnsafe(Q);return mQ(J,Q-4,0),J[4]=I,w0(J,5+A,I),J}encrypt(A){if(this._dead)return;_Q[0]=0,mQ(_Q,this.outSeqno,12);let Q=d0("chacha20",this._encKeyMain,_Q).update(rG),I=d0("chacha20",this._encKeyPktLen,_Q).update(A.slice(0,4));this._onWrite(I),_Q[0]=1;let J=d0("chacha20",this._encKeyMain,_Q).update(A.slice(4));this._onWrite(J),C$(FI,I,I.length,J,J.length,Q);let $=Buffer.allocUnsafe(16);$.set(new Uint8Array(WI.HEAPU8.buffer,FI,16),0),this._onWrite($),this.outSeqno=this.outSeqno+1>>>0}}class tG{constructor(A){let Q=A.outbound;this.outSeqno=Q.seqno,this._onWrite=Q.onWrite,this._instance=new I$(Q.cipherKey),this._dead=!1}free(){this._dead=!0,this._instance.free()}allocPacket(A){let Q=5+A,I=8-(Q-4&7);if(I<4)I+=8;Q+=I;let J=Buffer.allocUnsafe(Q+16);return mQ(J,Q-4,0),J[4]=I,w0(J,5+A,I),J}encrypt(A){if(this._dead)return;this._instance.encrypt(A,this.outSeqno),this._onWrite(A),this.outSeqno=this.outSeqno+1>>>0}}class eG{constructor(A){let Q=A.outbound;this.outSeqno=Q.seqno,this._onWrite=Q.onWrite,this._encSSLName=Q.cipherInfo.sslName,this._encKey=Q.cipherKey,this._encIV=Q.cipherIV,this._dead=!1}free(){this._dead=!0}allocPacket(A){let Q=5+A,I=16-(Q-4&15);if(I<4)I+=16;Q+=I;let J=Buffer.allocUnsafe(Q);return mQ(J,Q-4,0),J[4]=I,w0(J,5+A,I),J}encrypt(A){if(this._dead)return;let Q=d0(this._encSSLName,this._encKey,this._encIV);Q.setAutoPadding(!1);let I=A.slice(0,4);Q.setAAD(I),this._onWrite(I);let J=Q.update(A.slice(4));this._onWrite(J);let $=Q.final();if($.length)this._onWrite($);let G=Q.getAuthTag();this._onWrite(G),zX(this._encIV),this.outSeqno=this.outSeqno+1>>>0}}class AX{constructor(A){let Q=A.outbound;this.outSeqno=Q.seqno,this._onWrite=Q.onWrite,this._instance=new Q$(Q.cipherInfo.sslName,Q.cipherKey,Q.cipherIV),this._dead=!1}free(){this._dead=!0,this._instance.free()}allocPacket(A){let Q=5+A,I=16-(Q-4&15);if(I<4)I+=16;Q+=I;let J=Buffer.allocUnsafe(Q+16);return mQ(J,Q-4,0),J[4]=I,w0(J,5+A,I),J}encrypt(A){if(this._dead)return;this._instance.encrypt(A),this._onWrite(A),this.outSeqno=this.outSeqno+1>>>0}}class QX{constructor(A){let Q=A.outbound;this.outSeqno=Q.seqno,this._onWrite=Q.onWrite,this._encBlockLen=Q.cipherInfo.blockLen,this._cipherInstance=d0(Q.cipherInfo.sslName,Q.cipherKey,Q.cipherIV),this._macSSLName=Q.macInfo.sslName,this._macKey=Q.macKey,this._macActualLen=Q.macInfo.actualLen,this._macETM=Q.macInfo.isETM,this._aadLen=this._macETM?4:0,this._dead=!1;let I=Q.cipherInfo.discardLen;if(I){let J=QJ.get(I);if(J===void 0)J=Buffer.alloc(I),QJ.set(I,J);this._cipherInstance.update(J)}}free(){this._dead=!0}allocPacket(A){let Q=this._encBlockLen,I=5+A,J=Q-(I-this._aadLen&Q-1);if(J<4)J+=Q;I+=J;let $=Buffer.allocUnsafe(I);return mQ($,I-4,0),$[4]=J,w0($,5+A,J),$}encrypt(A){if(this._dead)return;let Q;if(this._macETM){let J=new Uint8Array(A.buffer,A.byteOffset,4),$=this._cipherInstance.update(new Uint8Array(A.buffer,A.byteOffset+4,A.length-4));this._onWrite(J),this._onWrite($),Q=tJ(this._macSSLName,this._macKey),mQ(f0,this.outSeqno,0),Q.update(f0),Q.update(J),Q.update($)}else{let J=this._cipherInstance.update(A);this._onWrite(J),Q=tJ(this._macSSLName,this._macKey),mQ(f0,this.outSeqno,0),Q.update(f0),Q.update(A)}let I=Q.digest();if(I.length>this._macActualLen)I=I.slice(0,this._macActualLen);this._onWrite(I),this.outSeqno=this.outSeqno+1>>>0}}class IX{constructor(A){let Q=A.outbound;this.outSeqno=Q.seqno,this._onWrite=Q.onWrite,this._encBlockLen=Q.cipherInfo.blockLen,this._macLen=Q.macInfo.len,this._macActualLen=Q.macInfo.actualLen,this._aadLen=Q.macInfo.isETM?4:0,this._instance=new J$(Q.cipherInfo.sslName,Q.cipherKey,Q.cipherIV,Q.macInfo.sslName,Q.macKey,Q.macInfo.isETM),this._dead=!1}free(){this._dead=!0,this._instance.free()}allocPacket(A){let Q=this._encBlockLen,I=5+A,J=Q-(I-this._aadLen&Q-1);if(J<4)J+=Q;I+=J;let $=Buffer.allocUnsafe(I+this._macLen);return mQ($,I-4,0),$[4]=J,w0($,5+A,J),$}encrypt(A){if(this._dead)return;if(this._instance.encrypt(A,this.outSeqno),this._macActualLen<this._macLen)A=new B0(A.buffer,A.byteOffset,A.length-(this._macLen-this._macActualLen));this._onWrite(A),this.outSeqno=this.outSeqno+1>>>0}}class JX{constructor(A,Q){this.inSeqno=A,this._onPayload=Q,this._len=0,this._lenBytes=0,this._packet=null,this._packetPos=0}free(){}decrypt(A,Q,I){while(Q<I){if(this._lenBytes<4){let $=Math.min(4-this._lenBytes,I-Q);this._lenBytes+=$;while($--)this._len=(this._len<<8)+A[Q++];if(this._lenBytes<4)return;if(this._len>35000||this._len<8||(4+this._len&7)!==0)throw new Error("Bad packet length");if(Q>=I)return}if(this._packetPos<this._len){let $=Math.min(this._len-this._packetPos,I-Q),G;if(Q!==0||$!==I)G=new Uint8Array(A.buffer,A.byteOffset+Q,$);else G=A;if($===this._len)this._packet=G;else{if(!this._packet)this._packet=Buffer.allocUnsafe(this._len);this._packet.set(G,this._packetPos)}if(Q+=$,this._packetPos+=$,this._packetPos<this._len)return}let J=!this._packet?nG:new B0(this._packet.buffer,this._packet.byteOffset+1,this._packet.length-this._packet[0]-1);this.inSeqno=this.inSeqno+1>>>0,this._len=0,this._lenBytes=0,this._packet=null,this._packetPos=0;{let $=this._onPayload(J);if($!==void 0)return $===!1?Q:$}}}}class $X{constructor(A){let Q=A.inbound;this.inSeqno=Q.seqno,this._onPayload=Q.onPayload,this._decKeyMain=Q.decipherKey.slice(0,32),this._decKeyPktLen=Q.decipherKey.slice(32),this._len=0,this._lenBuf=Buffer.alloc(4),this._lenPos=0,this._packet=null,this._pktLen=0,this._mac=Buffer.allocUnsafe(16),this._calcMac=Buffer.allocUnsafe(16),this._macPos=0}free(){}decrypt(A,Q,I){while(Q<I){if(this._lenPos<4){let X=Math.min(4-this._lenPos,I-Q);while(X--)this._lenBuf[this._lenPos++]=A[Q++];if(this._lenPos<4)return;_Q[0]=0,mQ(_Q,this.inSeqno,12);let C=AJ("chacha20",this._decKeyPktLen,_Q).update(this._lenBuf);if(this._len=HI(C,0),this._len>35000||this._len<8||(this._len&7)!==0)throw new Error("Bad packet length")}if(this._pktLen<this._len){if(Q>=I)return;let X=Math.min(this._len-this._pktLen,I-Q),C;if(Q!==0||X!==I)C=new Uint8Array(A.buffer,A.byteOffset+Q,X);else C=A;if(X===this._len)this._packet=C;else{if(!this._packet)this._packet=Buffer.allocUnsafe(this._len);this._packet.set(C,this._pktLen)}if(Q+=X,this._pktLen+=X,this._pktLen<this._len||Q>=I)return}{let X=Math.min(16-this._macPos,I-Q);if(Q!==0||X!==I)this._mac.set(new Uint8Array(A.buffer,A.byteOffset+Q,X),this._macPos);else this._mac.set(A,this._macPos);if(Q+=X,this._macPos+=X,this._macPos<16)return}_Q[0]=0,mQ(_Q,this.inSeqno,12);let J=d0("chacha20",this._decKeyMain,_Q).update(rG);if(C$(FI,this._lenBuf,4,this._packet,this._packet.length,J),this._calcMac.set(new Uint8Array(WI.HEAPU8.buffer,FI,16),0),!eJ(this._calcMac,this._mac))throw new Error("Invalid MAC");_Q[0]=1;let $=AJ("chacha20",this._decKeyMain,_Q).update(this._packet),G=new B0($.buffer,$.byteOffset+1,$.length-$[0]-1);this.inSeqno=this.inSeqno+1>>>0,this._len=0,this._lenPos=0,this._packet=null,this._pktLen=0,this._macPos=0;{let X=this._onPayload(G);if(X!==void 0)return X===!1?Q:X}}}}class GX{constructor(A){let Q=A.inbound;this.inSeqno=Q.seqno,this._onPayload=Q.onPayload,this._instance=new G$(Q.decipherKey),this._len=0,this._lenBuf=Buffer.alloc(4),this._lenPos=0,this._packet=null,this._pktLen=0,this._mac=Buffer.allocUnsafe(16),this._macPos=0}free(){this._instance.free()}decrypt(A,Q,I){while(Q<I){if(this._lenPos<4){let $=Math.min(4-this._lenPos,I-Q);while($--)this._lenBuf[this._lenPos++]=A[Q++];if(this._lenPos<4)return;if(this._len=this._instance.decryptLen(this._lenBuf,this.inSeqno),this._len>35000||this._len<8||(this._len&7)!==0)throw new Error("Bad packet length");if(Q>=I)return}if(this._pktLen<this._len){let $=Math.min(this._len-this._pktLen,I-Q),G;if(Q!==0||$!==I)G=new Uint8Array(A.buffer,A.byteOffset+Q,$);else G=A;if($===this._len)this._packet=G;else{if(!this._packet)this._packet=Buffer.allocUnsafe(this._len);this._packet.set(G,this._pktLen)}if(Q+=$,this._pktLen+=$,this._pktLen<this._len||Q>=I)return}{let $=Math.min(16-this._macPos,I-Q);if(Q!==0||$!==I)this._mac.set(new Uint8Array(A.buffer,A.byteOffset+Q,$),this._macPos);else this._mac.set(A,this._macPos);if(Q+=$,this._macPos+=$,this._macPos<16)return}this._instance.decrypt(this._packet,this._mac,this.inSeqno);let J=new B0(this._packet.buffer,this._packet.byteOffset+1,this._packet.length-this._packet[0]-1);this.inSeqno=this.inSeqno+1>>>0,this._len=0,this._lenPos=0,this._packet=null,this._pktLen=0,this._macPos=0;{let $=this._onPayload(J);if($!==void 0)return $===!1?Q:$}}}}class XX{constructor(A){let Q=A.inbound;this.inSeqno=Q.seqno,this._onPayload=Q.onPayload,this._decipherInstance=null,this._decipherSSLName=Q.decipherInfo.sslName,this._decipherKey=Q.decipherKey,this._decipherIV=Q.decipherIV,this._len=0,this._lenBytes=0,this._packet=null,this._packetPos=0,this._pktLen=0,this._tag=Buffer.allocUnsafe(16),this._tagPos=0}free(){}decrypt(A,Q,I){while(Q<I){if(this._lenBytes<4){let $=Math.min(4-this._lenBytes,I-Q);this._lenBytes+=$;while($--)this._len=(this._len<<8)+A[Q++];if(this._lenBytes<4)return;if(this._len+20>35000||this._len<16||(this._len&15)!==0)throw new Error("Bad packet length");this._decipherInstance=AJ(this._decipherSSLName,this._decipherKey,this._decipherIV),this._decipherInstance.setAutoPadding(!1),this._decipherInstance.setAAD(P8(this._len))}if(this._pktLen<this._len){if(Q>=I)return;let $=Math.min(this._len-this._pktLen,I-Q),G;if(Q!==0||$!==I)G=this._decipherInstance.update(new Uint8Array(A.buffer,A.byteOffset+Q,$));else G=this._decipherInstance.update(A);if(G.length){if($===this._len)this._packet=G;else{if(!this._packet)this._packet=Buffer.allocUnsafe(this._len);this._packet.set(G,this._packetPos)}this._packetPos+=G.length}if(Q+=$,this._pktLen+=$,this._pktLen<this._len||Q>=I)return}{let $=Math.min(16-this._tagPos,I-Q);if(Q!==0||$!==I)this._tag.set(new Uint8Array(A.buffer,A.byteOffset+Q,$),this._tagPos);else this._tag.set(A,this._tagPos);if(Q+=$,this._tagPos+=$,this._tagPos<16)return}{this._decipherInstance.setAuthTag(this._tag);let $=this._decipherInstance.final();if($.length)if(this._packet)this._packet.set($,this._packetPos);else this._packet=$}let J=!this._packet?nG:new B0(this._packet.buffer,this._packet.byteOffset+1,this._packet.length-this._packet[0]-1);this.inSeqno=this.inSeqno+1>>>0,zX(this._decipherIV),this._len=0,this._lenBytes=0,this._packet=null,this._packetPos=0,this._pktLen=0,this._tagPos=0;{let $=this._onPayload(J);if($!==void 0)return $===!1?Q:$}}}}class CX{constructor(A){let Q=A.inbound;this.inSeqno=Q.seqno,this._onPayload=Q.onPayload,this._instance=new $$(Q.decipherInfo.sslName,Q.decipherKey,Q.decipherIV),this._len=0,this._lenBytes=0,this._packet=null,this._pktLen=0,this._tag=Buffer.allocUnsafe(16),this._tagPos=0}free(){}decrypt(A,Q,I){while(Q<I){if(this._lenBytes<4){let $=Math.min(4-this._lenBytes,I-Q);this._lenBytes+=$;while($--)this._len=(this._len<<8)+A[Q++];if(this._lenBytes<4)return;if(this._len+20>35000||this._len<16||(this._len&15)!==0)throw new Error(`Bad packet length: ${this._len}`)}if(this._pktLen<this._len){if(Q>=I)return;let $=Math.min(this._len-this._pktLen,I-Q),G;if(Q!==0||$!==I)G=new Uint8Array(A.buffer,A.byteOffset+Q,$);else G=A;if($===this._len)this._packet=G;else{if(!this._packet)this._packet=Buffer.allocUnsafe(this._len);this._packet.set(G,this._pktLen)}if(Q+=$,this._pktLen+=$,this._pktLen<this._len||Q>=I)return}{let $=Math.min(16-this._tagPos,I-Q);if(Q!==0||$!==I)this._tag.set(new Uint8Array(A.buffer,A.byteOffset+Q,$),this._tagPos);else this._tag.set(A,this._tagPos);if(Q+=$,this._tagPos+=$,this._tagPos<16)return}this._instance.decrypt(this._packet,this._len,this._tag);let J=new B0(this._packet.buffer,this._packet.byteOffset+1,this._packet.length-this._packet[0]-1);this.inSeqno=this.inSeqno+1>>>0,this._len=0,this._lenBytes=0,this._packet=null,this._pktLen=0,this._tagPos=0;{let $=this._onPayload(J);if($!==void 0)return $===!1?Q:$}}}}class ZX{constructor(A){let Q=A.inbound;this.inSeqno=Q.seqno,this._onPayload=Q.onPayload,this._decipherInstance=AJ(Q.decipherInfo.sslName,Q.decipherKey,Q.decipherIV),this._decipherInstance.setAutoPadding(!1),this._block=Buffer.allocUnsafe(Q.macInfo.isETM?4:Q.decipherInfo.blockLen),this._blockSize=Q.decipherInfo.blockLen,this._blockPos=0,this._len=0,this._packet=null,this._packetPos=0,this._pktLen=0,this._mac=Buffer.allocUnsafe(Q.macInfo.actualLen),this._macPos=0,this._macSSLName=Q.macInfo.sslName,this._macKey=Q.macKey,this._macActualLen=Q.macInfo.actualLen,this._macETM=Q.macInfo.isETM,this._macInstance=null;let I=Q.decipherInfo.discardLen;if(I){let J=QJ.get(I);if(J===void 0)J=Buffer.alloc(I),QJ.set(I,J);this._decipherInstance.update(J)}}free(){}decrypt(A,Q,I){while(Q<I){if(this._blockPos<this._block.length){let G=Math.min(this._block.length-this._blockPos,I-Q);if(Q!==0||G!==I||G<A.length)this._block.set(new Uint8Array(A.buffer,A.byteOffset+Q,G),this._blockPos);else this._block.set(A,this._blockPos);if(Q+=G,this._blockPos+=G,this._blockPos<this._block.length)return;let X,C;if(this._macETM)this._len=C=HI(this._block,0);else X=this._decipherInstance.update(this._block),this._len=HI(X,0),C=4+this._len-this._blockSize;if(this._len>35000||this._len<5||(C&this._blockSize-1)!==0)throw new Error("Bad packet length");if(this._macInstance=tJ(this._macSSLName,this._macKey),mQ(f0,this.inSeqno,0),this._macInstance.update(f0),this._macETM)this._macInstance.update(this._block);else this._macInstance.update(new Uint8Array(X.buffer,X.byteOffset,4)),this._pktLen=X.length-4,this._packetPos=this._pktLen,this._packet=Buffer.allocUnsafe(this._len),this._packet.set(new Uint8Array(X.buffer,X.byteOffset+4,this._packetPos),0);if(Q>=I)return}if(this._pktLen<this._len){let G=Math.min(this._len-this._pktLen,I-Q),X;if(Q!==0||G!==I)X=new Uint8Array(A.buffer,A.byteOffset+Q,G);else X=A;if(this._macETM)this._macInstance.update(X);let C=this._decipherInstance.update(X);if(C.length){if(G===this._len)this._packet=C;else{if(!this._packet)this._packet=Buffer.allocUnsafe(this._len);this._packet.set(C,this._packetPos)}this._packetPos+=C.length}if(Q+=G,this._pktLen+=G,this._pktLen<this._len||Q>=I)return}{let G=Math.min(this._macActualLen-this._macPos,I-Q);if(Q!==0||G!==I)this._mac.set(new Uint8Array(A.buffer,A.byteOffset+Q,G),this._macPos);else this._mac.set(A,this._macPos);if(Q+=G,this._macPos+=G,this._macPos<this._macActualLen)return}if(!this._macETM)this._macInstance.update(this._packet);let J=this._macInstance.digest();if(this._macActualLen<J.length)J=new Uint8Array(J.buffer,J.byteOffset,this._macActualLen);if(!_8(J,this._mac))throw new Error("Invalid MAC");let $=new B0(this._packet.buffer,this._packet.byteOffset+1,this._packet.length-this._packet[0]-1);this.inSeqno=this.inSeqno+1>>>0,this._blockPos=0,this._len=0,this._packet=null,this._packetPos=0,this._pktLen=0,this._macPos=0,this._macInstance=null;{let G=this._onPayload($);if(G!==void 0)return G===!1?Q:G}}}}class VX{constructor(A){let Q=A.inbound;this.inSeqno=Q.seqno,this._onPayload=Q.onPayload,this._instance=new X$(Q.decipherInfo.sslName,Q.decipherKey,Q.decipherIV,Q.macInfo.sslName,Q.macKey,Q.macInfo.isETM,Q.macInfo.actualLen),this._block=Buffer.allocUnsafe(Q.macInfo.isETM||Q.decipherInfo.stream?4:Q.decipherInfo.blockLen),this._blockPos=0,this._len=0,this._packet=null,this._pktLen=0,this._mac=Buffer.allocUnsafe(Q.macInfo.actualLen),this._macPos=0,this._macActualLen=Q.macInfo.actualLen,this._macETM=Q.macInfo.isETM}free(){this._instance.free()}decrypt(A,Q,I){while(Q<I){if(this._blockPos<this._block.length){let $=Math.min(this._block.length-this._blockPos,I-Q);if(Q!==0||$!==I||$<A.length)this._block.set(new Uint8Array(A.buffer,A.byteOffset+Q,$),this._blockPos);else this._block.set(A,this._blockPos);if(Q+=$,this._blockPos+=$,this._blockPos<this._block.length)return;let G;if(this._macETM)this._len=G=HI(this._block,0);else this._instance.decryptBlock(this._block),this._len=HI(this._block,0),G=4+this._len-this._block.length;if(this._len>35000||this._len<5||(G&this._block.length-1)!==0)throw new Error("Bad packet length");if(!this._macETM){if(this._pktLen=this._block.length-4,this._pktLen)this._packet=Buffer.allocUnsafe(this._len),this._packet.set(new Uint8Array(this._block.buffer,this._block.byteOffset+4,this._pktLen),0)}if(Q>=I)return}if(this._pktLen<this._len){let $=Math.min(this._len-this._pktLen,I-Q),G;if(Q!==0||$!==I)G=new Uint8Array(A.buffer,A.byteOffset+Q,$);else G=A;if($===this._len)this._packet=G;else{if(!this._packet)this._packet=Buffer.allocUnsafe(this._len);this._packet.set(G,this._pktLen)}if(Q+=$,this._pktLen+=$,this._pktLen<this._len||Q>=I)return}{let $=Math.min(this._macActualLen-this._macPos,I-Q);if(Q!==0||$!==I)this._mac.set(new Uint8Array(A.buffer,A.byteOffset+Q,$),this._macPos);else this._mac.set(A,this._macPos);if(Q+=$,this._macPos+=$,this._macPos<this._macActualLen)return}this._instance.decrypt(this._packet,this.inSeqno,this._block,this._mac);let J=new B0(this._packet.buffer,this._packet.byteOffset+1,this._packet.length-this._packet[0]-1);this.inSeqno=this.inSeqno+1>>>0,this._blockPos=0,this._len=0,this._packet=null,this._pktLen=0,this._macPos=0,this._macInstance=null;{let $=this._onPayload(J);if($!==void 0)return $===!1?Q:$}}}}function zX(A){++A[11]>>>8&&++A[10]>>>8&&++A[9]>>>8&&++A[8]>>>8&&++A[7]>>>8&&++A[6]>>>8&&++A[5]>>>8&&++A[4]>>>8}var P8=(()=>{let A=Buffer.alloc(4);return(Q)=>{return A[0]=Q>>>24,A[1]=Q>>>16,A[2]=Q>>>8,A[3]=Q,A}})();function _8(A,Q){if(A.length!==Q.length)return eJ(A,A),!1;return eJ(A,Q)}function E8(A){if(typeof A!=="object"||A===null)throw new Error("Invalid config");if(typeof A.outbound!=="object"||A.outbound===null)throw new Error("Invalid outbound");let Q=A.outbound;if(typeof Q.onWrite!=="function")throw new Error("Invalid outbound.onWrite");if(typeof Q.cipherInfo!=="object"||Q.cipherInfo===null)throw new Error("Invalid outbound.cipherInfo");if(!Buffer.isBuffer(Q.cipherKey)||Q.cipherKey.length!==Q.cipherInfo.keyLen)throw new Error("Invalid outbound.cipherKey");if(Q.cipherInfo.ivLen&&(!Buffer.isBuffer(Q.cipherIV)||Q.cipherIV.length!==Q.cipherInfo.ivLen))throw new Error("Invalid outbound.cipherIV");if(typeof Q.seqno!=="number"||Q.seqno<0||Q.seqno>4294967295)throw new Error("Invalid outbound.seqno");let I=!!Q.forceNative;switch(Q.cipherInfo.sslName){case"aes-128-gcm":case"aes-256-gcm":return Q$&&!I?new AX(A):new eG(A);case"chacha20":return I$&&!I?new tG(A):new aG(A);default:{if(typeof Q.macInfo!=="object"||Q.macInfo===null)throw new Error("Invalid outbound.macInfo");if(!Buffer.isBuffer(Q.macKey)||Q.macKey.length!==Q.macInfo.len)throw new Error("Invalid outbound.macKey");return J$&&!I?new IX(A):new QX(A)}}}function g8(A){if(typeof A!=="object"||A===null)throw new Error("Invalid config");if(typeof A.inbound!=="object"||A.inbound===null)throw new Error("Invalid inbound");let Q=A.inbound;if(typeof Q.onPayload!=="function")throw new Error("Invalid inbound.onPayload");if(typeof Q.decipherInfo!=="object"||Q.decipherInfo===null)throw new Error("Invalid inbound.decipherInfo");if(!Buffer.isBuffer(Q.decipherKey)||Q.decipherKey.length!==Q.decipherInfo.keyLen)throw new Error("Invalid inbound.decipherKey");if(Q.decipherInfo.ivLen&&(!Buffer.isBuffer(Q.decipherIV)||Q.decipherIV.length!==Q.decipherInfo.ivLen))throw new Error("Invalid inbound.decipherIV");if(typeof Q.seqno!=="number"||Q.seqno<0||Q.seqno>4294967295)throw new Error("Invalid inbound.seqno");let I=!!Q.forceNative;switch(Q.decipherInfo.sslName){case"aes-128-gcm":case"aes-256-gcm":return $$&&!I?new CX(A):new XX(A);case"chacha20":return G$&&!I?new GX(A):new $X(A);default:{if(typeof Q.macInfo!=="object"||Q.macInfo===null)throw new Error("Invalid inbound.macInfo");if(!Buffer.isBuffer(Q.macKey)||Q.macKey.length!==Q.macInfo.len)throw new Error("Invalid inbound.macKey");return X$&&!I?new VX(A):new ZX(A)}}}YX.exports={CIPHER_INFO:x8,MAC_INFO:v8,bindingAvailable:!!A$,init:(()=>{return new Promise(async(A,Q)=>{try{WI=await pG()(),FI=WI._malloc(16),C$=WI.cwrap("poly1305_auth",null,["number","array","number","array","number","array"])}catch(I){return Q(I)}A()})})(),NullCipher:sG,createCipher:E8,NullDecipher:JX,createDecipher:g8}});var H0=cA((yY,RX)=>{var{createDecipheriv:V$,createECDH:S8,createHash:DI,createHmac:k8,createSign:y8,createVerify:m8,getCiphers:h8,sign:jX,verify:BX}=EA("crypto"),u8=h8(),{Ber:wA}=YI(),b8=oJ().pbkdf,{CIPHER_INFO:KI}=j0(),{eddsaSupported:z$,SUPPORTED_CIPHER:f8}=J0(),{bufferSlice:T0,makeBufferParser:d8,readString:RA,readUInt32BE:qI,writeUInt32BE:RQ}=iQ(),$0=Symbol("Hash Algorithm"),oQ=Symbol("Private key PEM"),rQ=Symbol("Public key PEM"),W0=Symbol("Public key SSH"),l0=Symbol("Decrypted Key"),Z$=Object.create(null);{let A=Object.keys(KI);for(let Q=0;Q<A.length;++Q){let I=KI[A[Q]].sslName;if(!I||Z$[I])continue;Z$[I]=KI[A[Q]]}}var IJ=d8();function pQ(A,Q){Q=Q.base64Slice(0,Q.length);let I=Q.replace(/.{64}/g,`$&
`);if(Q.length&63)I+=`
`;return`-----BEGIN ${A} KEY-----
${I}-----END ${A} KEY-----`}function NI(A,Q){let I=Buffer.allocUnsafe(A.length+Q.length);return I.set(A,0),I.set(Q,A.length),I}function Y$(A,Q){let I=A.length,J=A._pos||0;for(let $=0;$<Q;++$){let G=I-J;if(J>=I||G<4)return!1;let X=qI(A,J);if(G<4+X)return!1;J+=4+X}return A._pos=J,!0}function RI(A,Q){let I=new wA.Writer;return I.startSequence(),I.startSequence(),I.writeOID("1.2.840.113549.1.1.1"),I.writeNull(),I.endSequence(),I.startSequence(wA.BitString),I.writeByte(0),I.startSequence(),I.writeBuffer(A,wA.Integer),I.writeBuffer(Q,wA.Integer),I.endSequence(),I.endSequence(),I.endSequence(),pQ("PUBLIC",I.buffer)}function MI(A,Q){let I=Buffer.allocUnsafe(15+Q.length+4+A.length);RQ(I,7,0),I.utf8Write("ssh-rsa",4,7);let J=11;return RQ(I,Q.length,J),I.set(Q,J+=4),RQ(I,A.length,J+=Q.length),I.set(A,J+4),I}var WX=(()=>{function A(J,$,G,X,C,Z,Y,z){let B=new wA.Writer;return B.startSequence(),B.writeInt(0,wA.Integer),B.writeBuffer(J,wA.Integer),B.writeBuffer($,wA.Integer),B.writeBuffer(G,wA.Integer),B.writeBuffer(X,wA.Integer),B.writeBuffer(C,wA.Integer),B.writeBuffer(Z,wA.Integer),B.writeBuffer(Y,wA.Integer),B.writeBuffer(z,wA.Integer),B.endSequence(),B.buffer}function Q(J){return BigInt(`0x${J.hexSlice(0,J.length)}`)}function I(J){let $=J.toString(16);if(($.length&1)!==0)$=`0${$}`;else{let G=$.charCodeAt(0);if(G===56||G===57||G>=97&&G<=102)$=`00${$}`}return Buffer.from($,"hex")}return function J($,G,X,C,Z,Y){let z=Q(X),B=I(z%(Q(Z)-1n)),q=I(z%(Q(Y)-1n));return pQ("RSA PRIVATE",A($,G,X,Z,Y,B,q,C))}})();function UI(A,Q,I,J){let $=new wA.Writer;return $.startSequence(),$.startSequence(),$.writeOID("1.2.840.10040.4.1"),$.startSequence(),$.writeBuffer(A,wA.Integer),$.writeBuffer(Q,wA.Integer),$.writeBuffer(I,wA.Integer),$.endSequence(),$.endSequence(),$.startSequence(wA.BitString),$.writeByte(0),$.writeBuffer(J,wA.Integer),$.endSequence(),$.endSequence(),pQ("PUBLIC",$.buffer)}function wI(A,Q,I,J){let $=Buffer.allocUnsafe(15+A.length+4+Q.length+4+I.length+4+J.length);RQ($,7,0),$.utf8Write("ssh-dss",4,7);let G=11;return RQ($,A.length,G),$.set(A,G+=4),RQ($,Q.length,G+=A.length),$.set(Q,G+=4),RQ($,I.length,G+=Q.length),$.set(I,G+=4),RQ($,J.length,G+=I.length),$.set(J,G+4),$}function HX(A,Q,I,J,$){let G=new wA.Writer;return G.startSequence(),G.writeInt(0,wA.Integer),G.writeBuffer(A,wA.Integer),G.writeBuffer(Q,wA.Integer),G.writeBuffer(I,wA.Integer),G.writeBuffer(J,wA.Integer),G.writeBuffer($,wA.Integer),G.endSequence(),pQ("DSA PRIVATE",G.buffer)}function FX(A){let Q=new wA.Writer;return Q.startSequence(),Q.startSequence(),Q.writeOID("1.3.101.112"),Q.endSequence(),Q.startSequence(wA.BitString),Q.writeByte(0),Q._ensure(A.length),Q._buf.set(A,Q._offset),Q._offset+=A.length,Q.endSequence(),Q.endSequence(),pQ("PUBLIC",Q.buffer)}function qX(A){let Q=Buffer.allocUnsafe(19+A.length);return RQ(Q,11,0),Q.utf8Write("ssh-ed25519",4,11),RQ(Q,A.length,15),Q.set(A,19),Q}function l8(A){let Q=new wA.Writer;return Q.startSequence(),Q.writeInt(0,wA.Integer),Q.startSequence(),Q.writeOID("1.3.101.112"),Q.endSequence(),Q.startSequence(wA.OctetString),Q.writeBuffer(A,wA.OctetString),Q.endSequence(),Q.endSequence(),pQ("PRIVATE",Q.buffer)}function j$(A,Q){let I=new wA.Writer;return I.startSequence(),I.startSequence(),I.writeOID("1.2.840.10045.2.1"),I.writeOID(A),I.endSequence(),I.startSequence(wA.BitString),I.writeByte(0),I._ensure(Q.length),I._buf.set(Q,I._offset),I._offset+=Q.length,I.endSequence(),I.endSequence(),pQ("PUBLIC",I.buffer)}function B$(A,Q){let I;switch(A){case"1.2.840.10045.3.1.7":I="nistp256";break;case"1.3.132.0.34":I="nistp384";break;case"1.3.132.0.35":I="nistp521";break;default:return}let J=Buffer.allocUnsafe(39+Q.length);return RQ(J,19,0),J.utf8Write(`ecdsa-sha2-${I}`,4,19),RQ(J,8,23),J.utf8Write(I,27,8),RQ(J,Q.length,35),J.set(Q,39),J}function c8(A,Q,I){let J=new wA.Writer;return J.startSequence(),J.writeInt(1,wA.Integer),J.writeBuffer(I,wA.OctetString),J.startSequence(160),J.writeOID(A),J.endSequence(),J.startSequence(161),J.startSequence(wA.BitString),J.writeByte(0),J._ensure(Q.length),J._buf.set(Q,J._offset),J._offset+=Q.length,J.endSequence(),J.endSequence(),J.endSequence(),pQ("EC PRIVATE",J.buffer)}function i8(A,Q){let I=S8(A);return I.setPrivateKey(Q),I.getPublicKey()}var TI={sign:(()=>{if(typeof jX==="function")return function A(Q,I){let J=this[oQ];if(J===null)return new Error("No private key available");if(!I||typeof I!=="string")I=this[$0];try{return jX(I,Q,J)}catch($){return $}};return function A(Q,I){let J=this[oQ];if(J===null)return new Error("No private key available");if(!I||typeof I!=="string")I=this[$0];let $=y8(I);$.update(Q);try{return $.sign(J)}catch(G){return G}}})(),verify:(()=>{if(typeof BX==="function")return function A(Q,I,J){let $=this[rQ];if($===null)return new Error("No public key available");if(!J||typeof J!=="string")J=this[$0];try{return BX(J,Q,$,I)}catch(G){return G}};return function A(Q,I,J){let $=this[rQ];if($===null)return new Error("No public key available");if(!J||typeof J!=="string")J=this[$0];let G=m8(J);G.update(Q);try{return G.verify($,I)}catch(X){return X}}})(),isPrivateKey:function A(){return this[oQ]!==null},getPrivatePEM:function A(){return this[oQ]},getPublicPEM:function A(){return this[rQ]},getPublicSSH:function A(){return this[W0]},equals:function A(Q){let I=NX(Q);if(I instanceof Error)return!1;return this.type===I.type&&this[oQ]===I[oQ]&&this[rQ]===I[rQ]&&this[W0].equals(I[W0])}};function JJ(A,Q,I,J,$,G,X){this.type=A,this.comment=Q,this[oQ]=I,this[rQ]=J,this[W0]=$,this[$0]=G,this[l0]=X}JJ.prototype=TI;{let Q=function(I,J,$){let G=[];if(I.length<8)return new Error("Malformed OpenSSH private key");let X=qI(I,0),C=qI(I,4);if(X!==C){if($)return new Error("OpenSSH key integrity check failed -- bad passphrase?");return new Error("OpenSSH key integrity check failed")}I._pos=8;let Z,Y;for(Z=0;Z<J;++Z){let B,q,D,R,N=RA(I,I._pos,!0);if(N===void 0)return new Error("Malformed OpenSSH private key");switch(N){case"ssh-rsa":{let P=RA(I,I._pos);if(P===void 0)return new Error("Malformed OpenSSH private key");let o=RA(I,I._pos);if(o===void 0)return new Error("Malformed OpenSSH private key");let k=RA(I,I._pos);if(k===void 0)return new Error("Malformed OpenSSH private key");let a=RA(I,I._pos);if(a===void 0)return new Error("Malformed OpenSSH private key");let t=RA(I,I._pos);if(t===void 0)return new Error("Malformed OpenSSH private key");let u=RA(I,I._pos);if(u===void 0)return new Error("Malformed OpenSSH private key");D=RI(P,o),R=MI(P,o),q=WX(P,o,k,a,t,u),B="sha1";break}case"ssh-dss":{let P=RA(I,I._pos);if(P===void 0)return new Error("Malformed OpenSSH private key");let o=RA(I,I._pos);if(o===void 0)return new Error("Malformed OpenSSH private key");let k=RA(I,I._pos);if(k===void 0)return new Error("Malformed OpenSSH private key");let a=RA(I,I._pos);if(a===void 0)return new Error("Malformed OpenSSH private key");let t=RA(I,I._pos);if(t===void 0)return new Error("Malformed OpenSSH private key");D=UI(P,o,k,a),R=wI(P,o,k,a),q=HX(P,o,k,a,t),B="sha1";break}case"ssh-ed25519":{if(!z$)return new Error(`Unsupported OpenSSH private key type: ${N}`);let P=RA(I,I._pos);if(P===void 0||P.length!==32)return new Error("Malformed OpenSSH private key");let o=RA(I,I._pos);if(o===void 0||o.length!==64)return new Error("Malformed OpenSSH private key");D=FX(P),R=qX(P),q=l8(T0(o,0,32)),B=null;break}case"ecdsa-sha2-nistp256":B="sha256",Y="1.2.840.10045.3.1.7";case"ecdsa-sha2-nistp384":if(B===void 0)B="sha384",Y="1.3.132.0.34";case"ecdsa-sha2-nistp521":{if(B===void 0)B="sha512",Y="1.3.132.0.35";if(!Y$(I,1))return new Error("Malformed OpenSSH private key");let P=RA(I,I._pos);if(P===void 0)return new Error("Malformed OpenSSH private key");let o=RA(I,I._pos);if(o===void 0)return new Error("Malformed OpenSSH private key");D=j$(Y,P),R=B$(Y,P),q=c8(Y,P,o);break}default:return new Error(`Unsupported OpenSSH private key type: ${N}`)}let v=RA(I,I._pos,!0);if(v===void 0)return new Error("Malformed OpenSSH private key");G.push(new JJ(N,v,q,D,R,B,$))}let z=0;for(Z=I._pos;Z<I.length;++Z)if(I[Z]!==++z%255)return new Error("Malformed OpenSSH private key");return G},A=/^-----BEGIN OPENSSH PRIVATE KEY-----(?:\r\n|\n)([\s\S]+)(?:\r\n|\n)-----END OPENSSH PRIVATE KEY-----$/;JJ.parse=(I,J)=>{let $=A.exec(I);if($===null)return null;let G,X=Buffer.from($[1],"base64");if(X.length<31)return new Error("Malformed OpenSSH private key");let C=X.utf8Slice(0,15);if(C!=="openssh-key-v1\x00")return new Error(`Unsupported OpenSSH key magic: ${C}`);let Z=RA(X,15,!0);if(Z===void 0)return new Error("Malformed OpenSSH private key");if(Z!=="none"&&f8.indexOf(Z)===-1)return new Error(`Unsupported cipher for OpenSSH key: ${Z}`);let Y=RA(X,X._pos,!0);if(Y===void 0)return new Error("Malformed OpenSSH private key");if(Y!=="none"){if(Z==="none")return new Error("Malformed OpenSSH private key");if(Y!=="bcrypt")return new Error(`Unsupported kdf name for OpenSSH key: ${Y}`);if(!J)return new Error("Encrypted private OpenSSH key detected, but no passphrase given")}else if(Z!=="none")return new Error("Malformed OpenSSH private key");let z,B,q;if(Z!=="none")z=KI[Z];let D=RA(X,X._pos);if(D===void 0)return new Error("Malformed OpenSSH private key");if(D.length)switch(Y){case"none":return new Error("Malformed OpenSSH private key");case"bcrypt":{let N=RA(D,0);if(N===void 0||D._pos+4>D.length)return new Error("Malformed OpenSSH private key");let v=qI(D,D._pos),P=Buffer.allocUnsafe(z.keyLen+z.ivLen);if(b8(J,J.length,N,N.length,P,P.length,v)!==0)return new Error("Failed to generate information to decrypt key");B=T0(P,0,z.keyLen),q=T0(P,z.keyLen,P.length);break}}else if(Y!=="none")return new Error("Malformed OpenSSH private key");if(X._pos+3>=X.length)return new Error("Malformed OpenSSH private key");let R=qI(X,X._pos);if(X._pos+=4,R>0){for(let v=0;v<R;++v){let P=RA(X,X._pos);if(P===void 0)return new Error("Malformed OpenSSH private key");if(RA(P,0,!0)===void 0)return new Error("Malformed OpenSSH private key")}let N=RA(X,X._pos);if(N===void 0)return new Error("Malformed OpenSSH private key");if(B!==void 0){if(N.length<z.blockLen||N.length%z.blockLen!==0)return new Error("Malformed OpenSSH private key");try{let v={authTagLength:z.authLen},P=V$(z.sslName,B,q,v);if(P.setAutoPadding(!1),z.authLen>0){if(X.length-X._pos<z.authLen)return new Error("Malformed OpenSSH private key");P.setAuthTag(T0(X,X._pos,X._pos+=z.authLen))}N=NI(P.update(N),P.final())}catch(v){return v}}if(X._pos!==X.length)return new Error("Malformed OpenSSH private key");G=Q(N,R,B!==void 0)}else G=[];if(G instanceof Error)return G;return G[0]}}function $J(A,Q,I,J,$,G,X){this.type=A,this.comment=Q,this[oQ]=I,this[rQ]=J,this[W0]=$,this[$0]=G,this[l0]=X}$J.prototype=TI;{let A=/^-----BEGIN (RSA|DSA|EC) PRIVATE KEY-----(?:\r\n|\n)((?:[^:]+:\s*[\S].*(?:\r\n|\n))*)([\s\S]+)(?:\r\n|\n)-----END (RSA|DSA|EC) PRIVATE KEY-----$/;$J.parse=(Q,I)=>{let J=A.exec(Q);if(J===null)return null;let $=Buffer.from(J[3],"base64"),G=J[2],X=!1;if(G!==void 0){G=G.split(/\r\n|\n/g);for(let R=0;R<G.length;++R){let N=G[R],v=N.indexOf(":");if(N.slice(0,v)==="DEK-Info"){let P=N.slice(v+2);if(v=P.indexOf(","),v===-1)continue;let o=P.slice(0,v).toLowerCase();if(u8.indexOf(o)===-1)return new Error(`Cipher (${o}) not supported for encrypted OpenSSH private key`);let k=Z$[o];if(!k)return new Error(`Cipher (${o}) not supported for encrypted OpenSSH private key`);let a=Buffer.from(P.slice(v+1),"hex");if(a.length!==k.ivLen)return new Error("Malformed encrypted OpenSSH private key");if(!I)return new Error("Encrypted OpenSSH private key detected, but no passphrase given");let t=T0(a,0,8),u=DI("md5").update(I).update(t).digest();while(u.length<k.keyLen)u=NI(u,DI("md5").update(u).update(I).update(t).digest());if(u.length>k.keyLen)u=T0(u,0,k.keyLen);try{let M=V$(o,u,a);M.setAutoPadding(!1),$=NI(M.update($),M.final()),X=!0}catch(M){return M}}}}let C,Z,Y,z,B,q,D="Malformed OpenSSH private key";if(X)D+=". Bad passphrase?";switch(J[1]){case"RSA":C="ssh-rsa",Z=pQ("RSA PRIVATE",$);try{q=new wA.Reader($),q.readSequence(),q.readInt();let R=q.readString(wA.Integer,!0);if(R===null)return new Error(D);let N=q.readString(wA.Integer,!0);if(N===null)return new Error(D);Y=RI(R,N),z=MI(R,N)}catch{return new Error(D)}B="sha1";break;case"DSA":C="ssh-dss",Z=pQ("DSA PRIVATE",$);try{q=new wA.Reader($),q.readSequence(),q.readInt();let R=q.readString(wA.Integer,!0);if(R===null)return new Error(D);let N=q.readString(wA.Integer,!0);if(N===null)return new Error(D);let v=q.readString(wA.Integer,!0);if(v===null)return new Error(D);let P=q.readString(wA.Integer,!0);if(P===null)return new Error(D);Y=UI(R,N,v,P),z=wI(R,N,v,P)}catch{return new Error(D)}B="sha1";break;case"EC":{let R,N,v;try{q=new wA.Reader($),q.readSequence(),q.readInt(),N=q.readString(wA.OctetString,!0),q.readByte();let o=q.readLength();if(o!==null){if(q._offset=o,v=q.readOID(),v===null)return new Error(D);switch(v){case"1.2.840.10045.3.1.7":R="prime256v1",C="ecdsa-sha2-nistp256",B="sha256";break;case"1.3.132.0.34":R="secp384r1",C="ecdsa-sha2-nistp384",B="sha384";break;case"1.3.132.0.35":R="secp521r1",C="ecdsa-sha2-nistp521",B="sha512";break;default:return new Error(`Unsupported private key EC OID: ${v}`)}}else return new Error(D)}catch{return new Error(D)}Z=pQ("EC PRIVATE",$);let P=i8(R,N);Y=j$(v,P),z=B$(v,P);break}}return new $J(C,"",Z,Y,z,B,X)}}function GJ(A,Q,I,J,$,G,X){this.type=A,this.comment=Q,this[oQ]=I,this[rQ]=J,this[W0]=$,this[$0]=G,this[l0]=X}GJ.prototype=TI;{let A=Buffer.alloc(0),Q=Buffer.from([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),I=Buffer.from([0,0,0,0]),J=Buffer.from([0,0,0,1]),$=/^PuTTY-User-Key-File-2: (ssh-(?:rsa|dss))\r?\nEncryption: (aes256-cbc|none)\r?\nComment: ([^\r\n]*)\r?\nPublic-Lines: \d+\r?\n([\s\S]+?)\r?\nPrivate-Lines: \d+\r?\n([\s\S]+?)\r?\nPrivate-MAC: ([^\r\n]+)/;GJ.parse=(G,X)=>{let C=$.exec(G);if(C===null)return null;let Z=C[2],Y=Z!=="none";if(Y&&!X)return new Error("Encrypted PPK private key detected, but no passphrase given");let z=Buffer.from(C[5],"base64");if(Y){let p=KI[Z],S=NI(DI("sha1").update(I).update(X).digest(),DI("sha1").update(J).update(X).digest());if(S.length>p.keyLen)S=T0(S,0,p.keyLen);try{let QA=V$(p.sslName,S,Q);QA.setAutoPadding(!1),z=NI(QA.update(z),QA.final())}catch(QA){return QA}}let B=C[1],q=C[3],D=Buffer.from(C[4],"base64"),R=C[6],N=B.length,v=Z.length,P=Buffer.byteLength(q),o=D.length,k=z.length,a=Buffer.allocUnsafe(4+N+4+v+4+P+4+o+4+k),t=0;if(RQ(a,N,t),a.utf8Write(B,t+=4,N),RQ(a,v,t+=N),a.utf8Write(Z,t+=4,v),RQ(a,P,t+=v),a.utf8Write(q,t+=4,P),RQ(a,o,t+=P),a.set(D,t+=4),RQ(a,k,t+=o),a.set(z,t+4),!X)X=A;if(k8("sha1",DI("sha1").update("putty-private-key-file-mac-key").update(X).digest()).update(a).digest("hex")!==R){if(Y)return new Error("PPK private key integrity check failed -- bad passphrase?");return new Error("PPK private key integrity check failed")}let M,_,E;switch(D._pos=0,Y$(D,1),B){case"ssh-rsa":{let p=RA(D,D._pos);if(p===void 0)return new Error("Malformed PPK public key");let S=RA(D,D._pos);if(S===void 0)return new Error("Malformed PPK public key");let QA=RA(z,0);if(QA===void 0)return new Error("Malformed PPK private key");let AA=RA(z,z._pos);if(AA===void 0)return new Error("Malformed PPK private key");let n=RA(z,z._pos);if(n===void 0)return new Error("Malformed PPK private key");let JA=RA(z,z._pos);if(JA===void 0)return new Error("Malformed PPK private key");M=RI(S,p),_=MI(S,p),E=WX(S,p,QA,JA,AA,n);break}case"ssh-dss":{let p=RA(D,D._pos);if(p===void 0)return new Error("Malformed PPK public key");let S=RA(D,D._pos);if(S===void 0)return new Error("Malformed PPK public key");let QA=RA(D,D._pos);if(QA===void 0)return new Error("Malformed PPK public key");let AA=RA(D,D._pos);if(AA===void 0)return new Error("Malformed PPK public key");let n=RA(z,0);if(n===void 0)return new Error("Malformed PPK private key");M=UI(p,S,QA,AA),_=wI(p,S,QA,AA),E=HX(p,S,QA,AA,n);break}}return new GJ(B,q,E,M,_,"sha1",Y)}}function CJ(A,Q,I,J,$){this.type=A,this.comment=Q,this[oQ]=null,this[rQ]=I,this[W0]=J,this[$0]=$,this[l0]=!1}CJ.prototype=TI;{let A;if(z$)A=/^(((?:ssh-(?:rsa|dss|ed25519))|ecdsa-sha2-nistp(?:256|384|521))(?:-cert-v0[01]@openssh.com)?) ([A-Z0-9a-z/+=]+)(?:$|\s+([\S].*)?)$/;else A=/^(((?:ssh-(?:rsa|dss))|ecdsa-sha2-nistp(?:256|384|521))(?:-cert-v0[01]@openssh.com)?) ([A-Z0-9a-z/+=]+)(?:$|\s+([\S].*)?)$/;CJ.parse=(Q)=>{let I=A.exec(Q);if(I===null)return null;let J=I[1],$=I[2],G=Buffer.from(I[3],"base64"),X=I[4]||"",C=RA(G,G._pos,!0);if(C===void 0||C.indexOf($)!==0)return new Error("Malformed OpenSSH public key");return W$(G,$,X,J)}}function XJ(A,Q,I,J,$){this.type=A,this.comment=Q,this[oQ]=null,this[rQ]=I,this[W0]=J,this[$0]=$,this[l0]=!1}XJ.prototype=TI;{let A=/^---- BEGIN SSH2 PUBLIC KEY ----(?:\r?\n)((?:.{0,72}\r?\n)+)---- END SSH2 PUBLIC KEY ----$/,Q=/^[A-Z0-9a-z/+=\r\n]+$/,I=/^([\x21-\x39\x3B-\x7E]{1,64}): ((?:[^\\]*\\\r?\n)*[^\r\n]+)\r?\n/gm,J=/\\\r?\n/g;XJ.parse=($)=>{let G=A.exec($);if(G===null)return null;let X=G[1],C=0,Z="";while(G=I.exec(X)){let D=G[1],R=G[2].replace(J,"");if(R.length>1024)return I.lastIndex=0,new Error("Malformed RFC4716 public key");if(C=I.lastIndex,D.toLowerCase()==="comment"){if(Z=R,Z.length>1&&Z.charCodeAt(0)===34&&Z.charCodeAt(Z.length-1)===34)Z=Z.slice(1,-1)}}let Y=X.slice(C);if(!Q.test(Y))return new Error("Malformed RFC4716 public key");Y=Buffer.from(Y,"base64");let z=RA(Y,0,!0);if(z===void 0)return new Error("Malformed RFC4716 public key");let B=null,q=null;switch(z){case"ssh-rsa":{let D=RA(Y,Y._pos);if(D===void 0)return new Error("Malformed RFC4716 public key");let R=RA(Y,Y._pos);if(R===void 0)return new Error("Malformed RFC4716 public key");B=RI(R,D),q=MI(R,D);break}case"ssh-dss":{let D=RA(Y,Y._pos);if(D===void 0)return new Error("Malformed RFC4716 public key");let R=RA(Y,Y._pos);if(R===void 0)return new Error("Malformed RFC4716 public key");let N=RA(Y,Y._pos);if(N===void 0)return new Error("Malformed RFC4716 public key");let v=RA(Y,Y._pos);if(v===void 0)return new Error("Malformed RFC4716 public key");B=UI(D,R,N,v),q=wI(D,R,N,v);break}default:return new Error("Malformed RFC4716 public key")}return new XJ(z,Z,B,q,"sha1")}}function W$(A,Q,I,J){if(!DX(Q))return new Error(`Unsupported OpenSSH public key type: ${Q}`);let $,G,X=null,C=null;switch(Q){case"ssh-rsa":{let Z=RA(A,A._pos||0);if(Z===void 0)return new Error("Malformed OpenSSH public key");let Y=RA(A,A._pos);if(Y===void 0)return new Error("Malformed OpenSSH public key");X=RI(Y,Z),C=MI(Y,Z),$="sha1";break}case"ssh-dss":{let Z=RA(A,A._pos||0);if(Z===void 0)return new Error("Malformed OpenSSH public key");let Y=RA(A,A._pos);if(Y===void 0)return new Error("Malformed OpenSSH public key");let z=RA(A,A._pos);if(z===void 0)return new Error("Malformed OpenSSH public key");let B=RA(A,A._pos);if(B===void 0)return new Error("Malformed OpenSSH public key");X=UI(Z,Y,z,B),C=wI(Z,Y,z,B),$="sha1";break}case"ssh-ed25519":{let Z=RA(A,A._pos||0);if(Z===void 0||Z.length!==32)return new Error("Malformed OpenSSH public key");X=FX(Z),C=qX(Z),$=null;break}case"ecdsa-sha2-nistp256":$="sha256",G="1.2.840.10045.3.1.7";case"ecdsa-sha2-nistp384":if($===void 0)$="sha384",G="1.3.132.0.34";case"ecdsa-sha2-nistp521":{if($===void 0)$="sha512",G="1.3.132.0.35";if(!Y$(A,1))return new Error("Malformed OpenSSH public key");let Z=RA(A,A._pos||0);if(Z===void 0)return new Error("Malformed OpenSSH public key");X=j$(G,Z),C=B$(G,Z);break}default:return new Error(`Unsupported OpenSSH public key type: ${Q}`)}return new CJ(J,I,X,C,$)}function DX(A){switch(A){case"ssh-rsa":case"ssh-dss":case"ecdsa-sha2-nistp256":case"ecdsa-sha2-nistp384":case"ecdsa-sha2-nistp521":return!0;case"ssh-ed25519":if(z$)return!0;default:return!1}}function KX(A){if(!A)return!1;return typeof A[l0]==="boolean"}function NX(A,Q){if(KX(A))return A;let I;if(Buffer.isBuffer(A))I=A,A=A.utf8Slice(0,A.length).trim();else if(typeof A==="string")A=A.trim();else return new Error("Key data must be a Buffer or string");if(Q!=null){if(typeof Q==="string")Q=Buffer.from(Q);else if(!Buffer.isBuffer(Q))return new Error("Passphrase must be a string or Buffer when supplied")}let J;if((J=JJ.parse(A,Q))!==null)return J;if((J=$J.parse(A,Q))!==null)return J;if((J=GJ.parse(A,Q))!==null)return J;if((J=CJ.parse(A))!==null)return J;if((J=XJ.parse(A))!==null)return J;if(I){IJ.init(I,0);let $=IJ.readString(!0);if($!==void 0){if(A=IJ.readRaw(),A!==void 0){if(J=W$(A,$,"",$),J instanceof Error)J=null}}IJ.clear()}if(J)return J;return new Error("Unsupported key format")}RX.exports={isParsedKey:KX,isSupportedKeyType:DX,parseDERKey:(A,Q)=>W$(A,Q,"",Q),parseKey:NX}});var K$=cA((mY,EX)=>{var __dirname="/home/zhijia/cc/node_modules/ssh2/lib",{Socket:TX}=EA("net"),{Duplex:OX}=EA("stream"),{resolve:o8}=EA("path"),{readFile:MX}=EA("fs"),{execFile:p8,spawn:n8}=EA("child_process"),{isParsedKey:UX,parseKey:OI}=H0(),{makeBufferParser:s8,readUInt32BE:D$,writeUInt32BE:EQ,writeUInt32LE:wX}=iQ();function LI(A){let Q=!1;return(...I)=>{if(Q)return;Q=!0,A(...I)}}function r8(A,Q){let I=Buffer.allocUnsafe(A.length+Q.length);return A.copy(I,0),Q.copy(I,A.length),I}function F$(){}var a8=Buffer.alloc(0),VQ=s8();class ZJ{getIdentities(A){A(new Error("Missing getIdentities() implementation"))}sign(A,Q,I,J){if(typeof I==="function")J=I;J(new Error("Missing sign() implementation"))}}class xI extends ZJ{constructor(A){super();this.socketPath=A}getStream(A){A=LI(A);let Q=new TX;Q.on("connect",()=>{A(null,Q)}),Q.on("close",I).on("end",I).on("error",I),Q.connect(this.socketPath);function I(){try{Q.destroy()}catch{}A(new Error("Failed to connect to agent"))}}getIdentities(A){A=LI(A),this.getStream((Q,I)=>{function J(G){if(I)try{I.destroy()}catch{}if(!G)G=new Error("Failed to retrieve identities from agent");A(G)}if(Q)return J(Q);let $=new q$(!0);$.on("error",J),$.pipe(I).pipe($),I.on("close",J).on("end",J).on("error",J),$.getIdentities((G,X)=>{if(G)return J(G);try{I.destroy()}catch{}A(null,X)})})}sign(A,Q,I,J){if(typeof I==="function")J=I,I=void 0;else if(typeof I!=="object"||I===null)I=void 0;J=LI(J),this.getStream(($,G)=>{function X(Z){if(G)try{G.destroy()}catch{}if(!Z)Z=new Error("Failed to sign data with agent");J(Z)}if($)return X($);let C=new q$(!0);C.on("error",X),C.pipe(G).pipe(C),G.on("close",X).on("end",X).on("error",X),C.sign(A,Q,I,(Z,Y)=>{if(Z)return X(Z);try{G.destroy()}catch{}J(null,Y)})})}}var LX=(()=>{let X=o8(__dirname,"..","util/pagent.exe"),C={[10]:new Error("Invalid pagent.exe arguments"),[11]:new Error("Pageant is not running"),[12]:new Error("pagent.exe could not create an mmap"),[13]:new Error("pagent.exe could not set mode for stdin"),[14]:new Error("pagent.exe could not set mode for stdout"),[15]:new Error("pagent.exe did not get expected input payload")};function Z(z){if(z.buffer=null,z.proc)z.proc.kill(),z.proc=void 0}class Y extends OX{constructor(){super();this.proc=void 0,this.buffer=null}_read(z){}_write(z,B,q){if(this.buffer===null)this.buffer=z;else{let v=Buffer.allocUnsafe(this.buffer.length+z.length);this.buffer.copy(v,0),z.copy(v,this.buffer.length),this.buffer=v}if(this.buffer.length<4)return q();let D=D$(this.buffer,0);if(this.buffer.length-4<D)return q();if(z=this.buffer.slice(0,4+D),this.buffer.length>4+D)return q(new Error("Unexpected multiple agent requests"));this.buffer=null;let R,N=this.proc=n8(X,[z.length]);N.stdout.on("data",(v)=>{this.push(v)}),N.on("error",(v)=>{R=v,q(R)}),N.on("close",(v)=>{if(this.proc=void 0,!R){if(R=C[v])return q(R);q()}}),N.stdin.end(z)}_final(z){Z(this),z()}_destroy(z,B){Z(this),B()}}return class z extends xI{getStream(B){B(null,new Y)}}})(),xX=(()=>{let A=/^!<socket >(\d+) s ([A-Z0-9]{8}-[A-Z0-9]{8}-[A-Z0-9]{8}-[A-Z0-9]{8})/;return class Q extends xI{getStream(I){I=LI(I);let J=this.socketPath,$=!1;MX(J,function G(X,C){if(X){if($)return I(new Error("Invalid cygwin unix socket path"));p8("cygpath",["-w",J],(u,M,_)=>{if(u||M.length===0)return I(new Error("Invalid cygwin unix socket path"));$=!0,J=M.toString().replace(/[\r\n]/g,""),MX(J,G)});return}let Z=A.exec(C.toString("ascii"));if(!Z)return I(new Error("Malformed cygwin unix socket file"));let Y,z=0,B=!1,q=[],D,R=Buffer.alloc(12),N=parseInt(Z[1],10),v=Z[2].replace(/-/g,""),P=Buffer.allocUnsafe(16);for(let u=0,M=0;M<32;++u,M+=2)P[u]=parseInt(v.substring(M,M+2),16);for(let u=0;u<16;u+=4)wX(P,D$(P,u),u);t();function o(){z=0,Y="secret",D.write(P)}function k(u){if(z+=u.length,Y==="secret"){if(z===16)z=0,Y="creds",D.write(R);return}if(Y==="creds"){if(!B)q.push(u);if(z===12){if(D.removeListener("connect",o),D.removeListener("data",k),D.removeListener("error",a),D.removeListener("end",a),D.removeListener("close",a),B)return I(null,D);B=!0,R=Buffer.concat(q),wX(R,process.pid,0),D.on("error",()=>{}),D.destroy(),t()}}}function a(){I(new Error("Problem negotiating cygwin unix socket security"))}function t(){D=new TX,D.on("connect",o),D.on("data",k),D.on("error",a),D.on("end",a),D.on("close",a),D.connect(N)}})}}})(),t8=/^[/\\][/\\]\.[/\\]pipe[/\\].+/;function vX(A){if(process.platform==="win32"&&!t8.test(A))return A==="pageant"?new LX:new xX(A);return new xI(A)}var q$=(()=>{function Y(_){let E;while(_[o].length){let p=_[o][0][B];if(p===void 0)break;_[o].shift(),E=_.push(p)}return E}let z=Symbol("Inbound Request Type"),B=Symbol("Inbound Request Response"),q=Symbol("Inbound Request Context");class D{constructor(_,E){this[z]=_,this[B]=void 0,this[q]=E}hasResponded(){return this[B]!==void 0}getType(){return this[z]}getContext(){return this[q]}}function R(_,E,p){return E[B]=p,Y(_)}function N(_){if(_[a]=null,_[k]===0){let E=_[o];if(E&&E.length){_[o]=[];for(let p of E)p.cb(new Error("No reply from server"))}}try{_.end()}catch{}setImmediate(()=>{if(!_[M])_.emit("end");if(!_[u])_.emit("close")})}function v(){this[u]=!0}function P(){this[M]=!0}let o=Symbol("Requests"),k=Symbol("Agent Protocol Role"),a=Symbol("Agent Protocol Buffer"),t=Symbol("Agent Protocol Current Message Length"),u=Symbol("Agent Protocol Closed"),M=Symbol("Agent Protocol Ended");return class _ extends OX{constructor(E){super({autoDestroy:!0,emitClose:!1});this[k]=E?0:1,this[o]=[],this[a]=null,this[t]=-1,this.once("end",P),this.once("close",v)}_read(E){}_write(E,p,S){if(this[a]===null)this[a]=E;else this[a]=r8(this[a],E);let QA=this[a],AA=QA.length,n=0;while(n<AA){if(AA<5)break;if(this[t]===-1)this[t]=D$(QA,n);if(AA<4+this[t])break;let JA=QA[n+=4];if(++n,this[k]===0){if(this[o].length===0)return S(new Error("Received unexpected message from server"));let IA=this[o].shift();switch(JA){case 5:IA.cb(new Error("Agent responded with failure"));break;case 12:{if(IA.type!==11)return S(new Error("Agent responded with wrong message type"));VQ.init(QA,n);let L=VQ.readUInt32BE();if(L===void 0)return VQ.clear(),S(new Error("Malformed agent response"));let g=[];for(let b=0;b<L;++b){let d=VQ.readString();if(d===void 0)return VQ.clear(),S(new Error("Malformed agent response"));let FA=VQ.readString(!0);if(FA===void 0)return VQ.clear(),S(new Error("Malformed agent response"));if(d=OI(d),d instanceof Error)continue;d.comment=d.comment||FA,g.push(d)}n=VQ.pos(),VQ.clear(),IA.cb(null,g);break}case 14:{if(IA.type!==13)return S(new Error("Agent responded with wrong message type"));VQ.init(QA,n);let L=VQ.readString();if(n=VQ.pos(),VQ.clear(),L===void 0)return S(new Error("Malformed agent response"));if(VQ.init(L,0),VQ.readString(!0),L=VQ.readString(),VQ.clear(),L===void 0)return S(new Error("Malformed OpenSSH signature format"));IA.cb(null,L);break}default:return S(new Error("Agent responded with unsupported message type"))}}else switch(JA){case 11:{let IA=new D(JA);this[o].push(IA),this.emit("identities",IA);break}case 13:{VQ.init(QA,n);let IA=VQ.readString(),L=VQ.readString(),g=VQ.readUInt32BE();if(n=VQ.pos(),VQ.clear(),g===void 0){let BA=new D(JA);return this[o].push(BA),this.failureReply(BA)}if(IA=OI(IA),IA instanceof Error){let BA=new D(JA);return this[o].push(BA),this.failureReply(BA)}let b={hash:void 0},d;if(IA.type==="ssh-rsa"){if(g&2)d="rsa-sha2-256",b.hash="sha256";else if(g&4)d="rsa-sha2-512",b.hash="sha512"}if(d===void 0)d=IA.type;let FA=new D(JA,d);this[o].push(FA),this.emit("sign",FA,IA,L,b);break}default:{let IA=new D(JA);this[o].push(IA),this.failureReply(IA)}}if(this[t]=-1,n===AA){this[a]=null;break}else this[a]=QA=QA.slice(n),AA=QA.length,n=0}S()}_destroy(E,p){N(this),p()}_final(E){N(this),E()}sign(E,p,S,QA){if(this[k]!==0)throw new Error("Client-only method called with server role");if(typeof S==="function")QA=S,S=void 0;else if(typeof S!=="object"||S===null)S=void 0;let AA=0;if(E=OI(E),E instanceof Error)throw new Error("Invalid public key argument");if(E.type==="ssh-rsa"&&S)switch(S.hash){case"sha256":AA=2;break;case"sha512":AA=4;break}E=E.getPublicSSH();let n=13,JA=E.length,IA=p.length,L=0,g=Buffer.allocUnsafe(9+JA+4+IA+4);if(EQ(g,g.length-4,L),g[L+=4]=n,EQ(g,JA,++L),E.copy(g,L+=4),EQ(g,IA,L+=JA),p.copy(g,L+=4),EQ(g,AA,L+=IA),typeof QA!=="function")QA=F$;return this[o].push({type:n,cb:QA}),this.push(g)}getIdentities(E){if(this[k]!==0)throw new Error("Client-only method called with server role");let p=11,S=0,QA=Buffer.allocUnsafe(5);if(EQ(QA,QA.length-4,S),QA[S+=4]=p,typeof E!=="function")E=F$;return this[o].push({type:p,cb:E}),this.push(QA)}failureReply(E){if(this[k]!==1)throw new Error("Server-only method called with client role");if(!(E instanceof D))throw new Error("Wrong request argument");if(E.hasResponded())return!0;let p=0,S=Buffer.allocUnsafe(5);return EQ(S,S.length-4,p),S[p+=4]=5,R(this,E,S)}getIdentitiesReply(E,p){if(this[k]!==1)throw new Error("Server-only method called with client role");if(!(E instanceof D))throw new Error("Wrong request argument");if(E.hasResponded())return!0;if(E.getType()!==11)throw new Error("Invalid response to request");if(!Array.isArray(p))throw new Error("Keys argument must be an array");let S=4,QA=[];for(let JA=0;JA<p.length;++JA){let IA=p[JA];if(typeof IA!=="object"||IA===null)throw new Error(`Invalid key entry: ${IA}`);let L,g;if(UX(IA))L=IA;else if(UX(IA.pubKey))L=IA.pubKey;else{if(typeof IA.pubKey!=="object"||IA.pubKey===null)continue;if({pubKey:L,comment:g}=IA.pubKey,L=OI(L),L instanceof Error)continue}if(g=L.comment||g,L=L.getPublicSSH(),S+=4+L.length,g&&typeof g==="string")g=Buffer.from(g);else if(!Buffer.isBuffer(g))g=a8;S+=4+g.length,QA.push({pubKey:L,comment:g})}let AA=0,n=Buffer.allocUnsafe(5+S);EQ(n,n.length-4,AA),n[AA+=4]=12,EQ(n,QA.length,++AA),AA+=4;for(let JA=0;JA<QA.length;++JA){let{pubKey:IA,comment:L}=QA[JA];if(EQ(n,IA.length,AA),IA.copy(n,AA+=4),EQ(n,L.length,AA+=IA.length),AA+=4,L.length)L.copy(n,AA),AA+=L.length}return R(this,E,n)}signReply(E,p){if(this[k]!==1)throw new Error("Server-only method called with client role");if(!(E instanceof D))throw new Error("Wrong request argument");if(E.hasResponded())return!0;if(E.getType()!==13)throw new Error("Invalid response to request");if(!Buffer.isBuffer(p))throw new Error("Signature argument must be a Buffer");if(p.length===0)throw new Error("Signature argument must be non-empty");let S=0,QA=E.getContext(),AA=Buffer.byteLength(QA),n=Buffer.allocUnsafe(13+AA+4+p.length);return EQ(n,n.length-4,S),n[S+=4]=14,EQ(n,4+AA+4+p.length,++S),EQ(n,AA,S+=4),n.utf8Write(QA,S+=4,AA),EQ(n,p.length,S+=AA),p.copy(n,S+=4),R(this,E,n)}}})(),H$=Symbol("Agent"),nQ=Symbol("Agent Keys"),G0=Symbol("Agent Keys Index"),c0=Symbol("Agent Init Callbacks");class PX{constructor(A){if(typeof A==="string")A=vX(A);else if(!_X(A))throw new Error("Invalid agent argument");this[H$]=A,this[nQ]=null,this[G0]=-1,this[c0]=null}init(A){if(typeof A!=="function")A=F$;if(this[nQ]===null)if(this[c0]===null){this[c0]=[A];let Q=(...I)=>{process.nextTick(()=>{let J=this[c0];this[c0]=null;for(let $ of J)$(...I)})};this[H$].getIdentities(LI((I,J)=>{if(I)return Q(I);if(!Array.isArray(J))return Q(new Error("Agent implementation failed to provide keys"));let $=[];for(let G of J){if(G=OI(G),G instanceof Error)continue;$.push(G)}this[nQ]=$,this[G0]=-1,Q()}))}else this[c0].push(A);else process.nextTick(A)}nextKey(){if(this[nQ]===null||++this[G0]>=this[nQ].length)return!1;return this[nQ][this[G0]]}currentKey(){if(this[nQ]===null||this[G0]>=this[nQ].length)return null;return this[nQ][this[G0]]}pos(){if(this[nQ]===null||this[G0]>=this[nQ].length)return-1;return this[G0]}reset(){this[G0]=-1}sign(...A){this[H$].sign(...A)}}function _X(A){return A instanceof ZJ}EX.exports={AgentContext:PX,AgentProtocol:q$,BaseAgent:ZJ,createAgent:vX,CygwinAgent:xX,isAgent:_X,OpenSSHAgent:xI,PageantAgent:LX}});var M$=cA((hY,mX)=>{var{kMaxLength:e8}=EA("buffer"),{createInflate:AV,constants:{DEFLATE:QV,INFLATE:IV,Z_DEFAULT_CHUNK:JV,Z_DEFAULT_COMPRESSION:$V,Z_DEFAULT_MEMLEVEL:GV,Z_DEFAULT_STRATEGY:XV,Z_DEFAULT_WINDOWBITS:CV,Z_PARTIAL_FLUSH:ZV}}=EA("zlib"),VV=AV()._handle.constructor;function zV(){throw new Error("Should not get here")}function YV(A,Q,I){let J=this._owner,$=new Error(A);$.errno=Q,$.code=I,J._err=$}function N$(A){if(!A._handle)return;A._handle.close(),A._handle=null}class R${constructor(A){let Q=CV,I=$V,J=GV,$=XV,G=void 0;this._err=void 0,this._writeState=new Uint32Array(2),this._chunkSize=JV,this._maxOutputLength=e8,this._outBuffer=Buffer.allocUnsafe(this._chunkSize),this._outOffset=0,this._handle=new VV(A),this._handle._owner=this,this._handle.onerror=YV,this._handle.init(Q,I,J,$,this._writeState,zV,void 0)}writeSync(A,Q){let I=this._handle;if(!I)throw new Error("Invalid Zlib instance");let J=A.length,$=this._chunkSize-this._outOffset,G=0,X,C,Z,Y=0,z=this._writeState,B=this._outBuffer,q=this._outOffset,D=this._chunkSize;while(!0){if(I.writeSync(ZV,A,G,J,B,q,$),this._err)throw this._err;X=z[0],C=z[1];let N=J-C,v=$-X;if(v>0){let P=q===0&&v===B.length?B:B.slice(q,q+v);if(q+=v,!Z)Z=P;else if(Z.push===void 0)Z=[Z,P];else Z.push(P);if(Y+=P.byteLength,Y>this._maxOutputLength)throw N$(this),new Error(`Output length exceeded maximum of ${this._maxOutputLength}`)}else if(v!==0)throw new Error("have should not go down");if(X===0||q>=D)$=D,q=0,B=Buffer.allocUnsafe(D);if(X===0)G+=N,J=C;else break}if(this._outBuffer=B,this._outOffset=q,Y===0)Z=Buffer.alloc(0);if(Q)return Z.totalLen=Y,Z;if(Z.push===void 0)return Z;let R=Buffer.allocUnsafe(Y);for(let N=0,v=0;N<Z.length;++N){let P=Z[N];R.set(P,v),v+=P.length}return R}}class gX{constructor(A){this.allocStart=0,this.allocStartKEX=0,this._protocol=A,this._zlib=new R$(QV)}cleanup(){if(this._zlib)N$(this._zlib)}alloc(A,Q){return Buffer.allocUnsafe(A)}finalize(A,Q){if(this._protocol._kexinit===void 0||Q){let I=this._zlib.writeSync(A,!0),J=this._protocol._cipher.allocPacket(I.totalLen);if(I.push===void 0)J.set(I,5);else for(let $=0,G=5;$<I.length;++$){let X=I[$];J.set(X,G),G+=X.length}return J}return A}}class SX{constructor(A){this.allocStart=5,this.allocStartKEX=5,this._protocol=A}cleanup(){}alloc(A,Q){if(this._protocol._kexinit===void 0||Q)return this._protocol._cipher.allocPacket(A);return Buffer.allocUnsafe(A)}finalize(A,Q){return A}}class kX{constructor(){this._zlib=new R$(IV)}cleanup(){if(this._zlib)N$(this._zlib)}read(A){return this._zlib.writeSync(A,!1)}}class yX{cleanup(){}read(A){return A}}mX.exports={PacketReader:yX,PacketWriter:SX,ZlibPacketReader:kX,ZlibPacketWriter:gX}});var dX=cA((uY,fX)=>{var{bufferSlice:U$,bufferParser:T,doFatalError:GQ,sigSSHToASN1:hX,writeUInt32BE:uX}=iQ(),{CHANNEL_OPEN_FAILURE:jV,COMPAT:BV,MESSAGE:XQ,TERMINAL_MODE:bX}=J0(),{parseKey:WV}=H0(),HV=Array.from(Object.entries(bX)).reduce((A,[Q,I])=>({...A,[Q]:I}),{});fX.exports={[XQ.DISCONNECT]:(A,Q)=>{T.init(Q,1);let I=T.readUInt32BE(),J=T.readString(!0),$=T.readString();if(T.clear(),$===void 0)return GQ(A,"Inbound: Malformed DISCONNECT packet");A._debug&&A._debug(`Inbound: Received DISCONNECT (${I}, "${J}")`);let G=A._handlers.DISCONNECT;G&&G(A,I,J)},[XQ.IGNORE]:(A,Q)=>{A._debug&&A._debug("Inbound: Received IGNORE")},[XQ.UNIMPLEMENTED]:(A,Q)=>{T.init(Q,1);let I=T.readUInt32BE();if(T.clear(),I===void 0)return GQ(A,"Inbound: Malformed UNIMPLEMENTED packet");A._debug&&A._debug(`Inbound: Received UNIMPLEMENTED (seqno ${I})`)},[XQ.DEBUG]:(A,Q)=>{T.init(Q,1);let I=T.readBool(),J=T.readString(!0),$=T.readString();if(T.clear(),$===void 0)return GQ(A,"Inbound: Malformed DEBUG packet");A._debug&&A._debug("Inbound: Received DEBUG");let G=A._handlers.DEBUG;G&&G(A,I,J)},[XQ.SERVICE_REQUEST]:(A,Q)=>{T.init(Q,1);let I=T.readString(!0);if(T.clear(),I===void 0)return GQ(A,"Inbound: Malformed SERVICE_REQUEST packet");A._debug&&A._debug(`Inbound: Received SERVICE_REQUEST (${I})`);let J=A._handlers.SERVICE_REQUEST;J&&J(A,I)},[XQ.SERVICE_ACCEPT]:(A,Q)=>{T.init(Q,1);let I=T.readString(!0);if(T.clear(),I===void 0)return GQ(A,"Inbound: Malformed SERVICE_ACCEPT packet");A._debug&&A._debug(`Inbound: Received SERVICE_ACCEPT (${I})`);let J=A._handlers.SERVICE_ACCEPT;J&&J(A,I)},[XQ.EXT_INFO]:(A,Q)=>{T.init(Q,1);let I=T.readUInt32BE(),J;if(I!==void 0){J=[];for(let G=0;G<I;++G){let X=T.readString(!0),C=T.readString();if(C!==void 0)switch(X){case"server-sig-algs":{let Z=C.latin1Slice(0,C.length).split(",");J.push({name:X,algs:Z});continue}default:continue}J=void 0;break}}if(T.clear(),J===void 0)return GQ(A,"Inbound: Malformed EXT_INFO packet");A._debug&&A._debug("Inbound: Received EXT_INFO");let $=A._handlers.EXT_INFO;$&&$(A,J)},[XQ.USERAUTH_REQUEST]:(A,Q)=>{T.init(Q,1);let I=T.readString(!0),J=T.readString(!0),$=T.readString(!0),G,X;switch($){case"none":G=null;break;case"password":{let Z=T.readBool();if(Z!==void 0){if(G=T.readString(!0),G!==void 0&&Z){let Y=T.readString(!0);if(Y!==void 0)G={oldPassword:G,newPassword:Y};else G=void 0}}break}case"publickey":{let Z=T.readBool();if(Z!==void 0){let Y=T.readString(!0),z=Y,B=T.readString(),q;switch(Y){case"rsa-sha2-256":z="ssh-rsa",q="sha256";break;case"rsa-sha2-512":z="ssh-rsa",q="sha512";break}if(Z){let D=T.pos(),R=T.readString();if(R!==void 0){if(R.length>4+Y.length+4&&R.utf8Slice(4,4+Y.length)===Y)R=U$(R,4+Y.length+4);if(R=hX(R,z),R){let N=A._kex.sessionID,v=Buffer.allocUnsafe(4+N.length+D);uX(v,N.length,0),v.set(N,4),v.set(new Uint8Array(Q.buffer,Q.byteOffset,D),4+N.length),G={keyAlgo:z,key:B,signature:R,blob:v,hashAlgo:q}}}}else G={keyAlgo:z,key:B,hashAlgo:q},X="publickey -- check"}break}case"hostbased":{let Z=T.readString(!0),Y=Z,z=T.readString(),B=T.readString(!0),q=T.readString(!0),D;switch(Z){case"rsa-sha2-256":Y="ssh-rsa",D="sha256";break;case"rsa-sha2-512":Y="ssh-rsa",D="sha512";break}let R=T.pos(),N=T.readString();if(N!==void 0){if(N.length>4+Z.length+4&&N.utf8Slice(4,4+Z.length)===Z)N=U$(N,4+Z.length+4);if(N=hX(N,Y),N!==void 0){let v=A._kex.sessionID,P=Buffer.allocUnsafe(4+v.length+R);uX(P,v.length,0),P.set(v,4),P.set(new Uint8Array(Q.buffer,Q.byteOffset,R),4+v.length),G={keyAlgo:Y,key:z,signature:N,blob:P,localHostname:B,localUsername:q,hashAlgo:D}}}break}case"keyboard-interactive":T.skipString(),G=T.readList();break;default:if($!==void 0)G=T.readRaw()}if(T.clear(),G===void 0)return GQ(A,"Inbound: Malformed USERAUTH_REQUEST packet");if(X===void 0)X=$;A._authsQueue.push($),A._debug&&A._debug(`Inbound: Received USERAUTH_REQUEST (${X})`);let C=A._handlers.USERAUTH_REQUEST;C&&C(A,I,J,$,G)},[XQ.USERAUTH_FAILURE]:(A,Q)=>{T.init(Q,1);let I=T.readList(),J=T.readBool();if(T.clear(),J===void 0)return GQ(A,"Inbound: Malformed USERAUTH_FAILURE packet");A._debug&&A._debug(`Inbound: Received USERAUTH_FAILURE (${I})`),A._authsQueue.shift();let $=A._handlers.USERAUTH_FAILURE;$&&$(A,I,J)},[XQ.USERAUTH_SUCCESS]:(A,Q)=>{A._debug&&A._debug("Inbound: Received USERAUTH_SUCCESS"),A._authsQueue.shift();let I=A._handlers.USERAUTH_SUCCESS;I&&I(A)},[XQ.USERAUTH_BANNER]:(A,Q)=>{T.init(Q,1);let I=T.readString(!0),J=T.readString();if(T.clear(),J===void 0)return GQ(A,"Inbound: Malformed USERAUTH_BANNER packet");A._debug&&A._debug("Inbound: Received USERAUTH_BANNER");let $=A._handlers.USERAUTH_BANNER;$&&$(A,I)},60:(A,Q)=>{if(!A._authsQueue.length){A._debug&&A._debug("Inbound: Received payload type 60 without auth");return}switch(A._authsQueue[0]){case"password":{T.init(Q,1);let I=T.readString(!0),J=T.readString();if(T.clear(),J===void 0)return GQ(A,"Inbound: Malformed USERAUTH_PASSWD_CHANGEREQ packet");A._debug&&A._debug("Inbound: Received USERAUTH_PASSWD_CHANGEREQ");let $=A._handlers.USERAUTH_PASSWD_CHANGEREQ;$&&$(A,I);break}case"publickey":{T.init(Q,1);let I=T.readString(!0),J=T.readString();if(T.clear(),J===void 0)return GQ(A,"Inbound: Malformed USERAUTH_PK_OK packet");A._debug&&A._debug("Inbound: Received USERAUTH_PK_OK"),A._authsQueue.shift();let $=A._handlers.USERAUTH_PK_OK;$&&$(A,I,J);break}case"keyboard-interactive":{T.init(Q,1);let I=T.readString(!0),J=T.readString(!0);T.readString();let $=T.readUInt32BE(),G;if($!==void 0){G=new Array($);let C;for(C=0;C<$;++C){let Z=T.readString(!0),Y=T.readBool();if(Y===void 0)break;G[C]={prompt:Z,echo:Y}}if(C!==$)G=void 0}if(T.clear(),G===void 0)return GQ(A,"Inbound: Malformed USERAUTH_INFO_REQUEST packet");A._debug&&A._debug("Inbound: Received USERAUTH_INFO_REQUEST");let X=A._handlers.USERAUTH_INFO_REQUEST;X&&X(A,I,J,G);break}default:A._debug&&A._debug("Inbound: Received unexpected payload type 60")}},61:(A,Q)=>{if(!A._authsQueue.length){A._debug&&A._debug("Inbound: Received payload type 61 without auth");return}if(A._authsQueue[0]!=="keyboard-interactive")return GQ(A,"Inbound: Received unexpected payload type 61");T.init(Q,1);let I=T.readUInt32BE(),J;if(I!==void 0){J=new Array(I);let G;for(G=0;G<I;++G){let X=T.readString(!0);if(X===void 0)break;J[G]=X}if(G!==I)J=void 0}if(T.clear(),J===void 0)return GQ(A,"Inbound: Malformed USERAUTH_INFO_RESPONSE packet");A._debug&&A._debug("Inbound: Received USERAUTH_INFO_RESPONSE");let $=A._handlers.USERAUTH_INFO_RESPONSE;$&&$(A,J)},[XQ.GLOBAL_REQUEST]:(A,Q)=>{T.init(Q,1);let I=T.readString(!0),J=T.readBool(),$;if(J!==void 0)switch(I){case"tcpip-forward":case"cancel-tcpip-forward":{let X=T.readString(!0),C=T.readUInt32BE();if(C!==void 0)$={bindAddr:X,bindPort:C};break}case"[email protected]":case"[email protected]":{let X=T.readString(!0);if(X!==void 0)$={socketPath:X};break}case"[email protected]":$=null;break;case"[email protected]":{$=[];while(T.avail()>0){let X=T.readString();if(X===void 0){$=void 0;break}let C=WV(X);if(!(C instanceof Error))$.push(C)}break}default:$=T.readRaw()}if(T.clear(),$===void 0)return GQ(A,"Inbound: Malformed GLOBAL_REQUEST packet");A._debug&&A._debug(`Inbound: GLOBAL_REQUEST (${I})`);let G=A._handlers.GLOBAL_REQUEST;if(G)G(A,I,J,$);else A.requestFailure()},[XQ.REQUEST_SUCCESS]:(A,Q)=>{let I=Q.length>1?U$(Q,1):null;A._debug&&A._debug("Inbound: REQUEST_SUCCESS");let J=A._handlers.REQUEST_SUCCESS;J&&J(A,I)},[XQ.REQUEST_FAILURE]:(A,Q)=>{A._debug&&A._debug("Inbound: Received REQUEST_FAILURE");let I=A._handlers.REQUEST_FAILURE;I&&I(A)},[XQ.CHANNEL_OPEN]:(A,Q)=>{T.init(Q,1);let I=T.readString(!0),J=T.readUInt32BE(),$=T.readUInt32BE(),G=T.readUInt32BE(),X;switch(I){case"forwarded-tcpip":case"direct-tcpip":{let Z=T.readString(!0),Y=T.readUInt32BE(),z=T.readString(!0),B=T.readUInt32BE();if(B!==void 0)X={type:I,sender:J,window:$,packetSize:G,data:{destIP:Z,destPort:Y,srcIP:z,srcPort:B}};break}case"[email protected]":case"[email protected]":{let Z=T.readString(!0);if(Z!==void 0)X={type:I,sender:J,window:$,packetSize:G,data:{socketPath:Z}};break}case"x11":{let Z=T.readString(!0),Y=T.readUInt32BE();if(Y!==void 0)X={type:I,sender:J,window:$,packetSize:G,data:{srcIP:Z,srcPort:Y}};break}default:X={type:I,sender:J,window:$,packetSize:G,data:{}}}if(T.clear(),X===void 0)return GQ(A,"Inbound: Malformed CHANNEL_OPEN packet");A._debug&&A._debug(`Inbound: CHANNEL_OPEN (s:${J}, ${I})`);let C=A._handlers.CHANNEL_OPEN;if(C)C(A,X);else A.channelOpenFail(X.sender,jV.ADMINISTRATIVELY_PROHIBITED,"","")},[XQ.CHANNEL_OPEN_CONFIRMATION]:(A,Q)=>{T.init(Q,1);let I=T.readUInt32BE(),J=T.readUInt32BE(),$=T.readUInt32BE(),G=T.readUInt32BE(),X=T.avail()?T.readRaw():void 0;if(T.clear(),G===void 0)return GQ(A,"Inbound: Malformed CHANNEL_OPEN_CONFIRMATION packet");A._debug&&A._debug(`Inbound: CHANNEL_OPEN_CONFIRMATION (r:${I}, s:${J})`);let C=A._handlers.CHANNEL_OPEN_CONFIRMATION;if(C)C(A,{recipient:I,sender:J,window:$,packetSize:G,data:X})},[XQ.CHANNEL_OPEN_FAILURE]:(A,Q)=>{T.init(Q,1);let I=T.readUInt32BE(),J=T.readUInt32BE(),$=T.readString(!0),G=T.readString();if(T.clear(),G===void 0)return GQ(A,"Inbound: Malformed CHANNEL_OPEN_FAILURE packet");A._debug&&A._debug(`Inbound: CHANNEL_OPEN_FAILURE (r:${I})`);let X=A._handlers.CHANNEL_OPEN_FAILURE;X&&X(A,I,J,$)},[XQ.CHANNEL_WINDOW_ADJUST]:(A,Q)=>{T.init(Q,1);let I=T.readUInt32BE(),J=T.readUInt32BE();if(T.clear(),J===void 0)return GQ(A,"Inbound: Malformed CHANNEL_WINDOW_ADJUST packet");A._debug&&A._debug(`Inbound: CHANNEL_WINDOW_ADJUST (r:${I}, ${J})`);let $=A._handlers.CHANNEL_WINDOW_ADJUST;$&&$(A,I,J)},[XQ.CHANNEL_DATA]:(A,Q)=>{T.init(Q,1);let I=T.readUInt32BE(),J=T.readString();if(T.clear(),J===void 0)return GQ(A,"Inbound: Malformed CHANNEL_DATA packet");A._debug&&A._debug(`Inbound: CHANNEL_DATA (r:${I}, ${J.length})`);let $=A._handlers.CHANNEL_DATA;$&&$(A,I,J)},[XQ.CHANNEL_EXTENDED_DATA]:(A,Q)=>{T.init(Q,1);let I=T.readUInt32BE(),J=T.readUInt32BE(),$=T.readString();if(T.clear(),$===void 0)return GQ(A,"Inbound: Malformed CHANNEL_EXTENDED_DATA packet");A._debug&&A._debug(`Inbound: CHANNEL_EXTENDED_DATA (r:${I}, ${$.length})`);let G=A._handlers.CHANNEL_EXTENDED_DATA;G&&G(A,I,$,J)},[XQ.CHANNEL_EOF]:(A,Q)=>{T.init(Q,1);let I=T.readUInt32BE();if(T.clear(),I===void 0)return GQ(A,"Inbound: Malformed CHANNEL_EOF packet");A._debug&&A._debug(`Inbound: CHANNEL_EOF (r:${I})`);let J=A._handlers.CHANNEL_EOF;J&&J(A,I)},[XQ.CHANNEL_CLOSE]:(A,Q)=>{T.init(Q,1);let I=T.readUInt32BE();if(T.clear(),I===void 0)return GQ(A,"Inbound: Malformed CHANNEL_CLOSE packet");A._debug&&A._debug(`Inbound: CHANNEL_CLOSE (r:${I})`);let J=A._handlers.CHANNEL_CLOSE;J&&J(A,I)},[XQ.CHANNEL_REQUEST]:(A,Q)=>{T.init(Q,1);let I=T.readUInt32BE(),J=T.readString(!0),$=T.readBool(),G;if($!==void 0)switch(J){case"exit-status":G=T.readUInt32BE(),A._debug&&A._debug(`Inbound: CHANNEL_REQUEST (r:${I}, ${J}: ${G})`);break;case"exit-signal":{let C,Z;if(A._compatFlags&BV.OLD_EXIT){let z=T.readUInt32BE();switch(z){case 1:C="HUP";break;case 2:C="INT";break;case 3:C="QUIT";break;case 6:C="ABRT";break;case 9:C="KILL";break;case 14:C="ALRM";break;case 15:C="TERM";break;default:if(z!==void 0)C=`UNKNOWN (${z})`}Z=!1}else if(C=T.readString(!0),Z=T.readBool(),Z===void 0)C=void 0;let Y=T.readString(!0);if(T.skipString()!==void 0)G={signal:C,coreDumped:Z,errorMessage:Y};A._debug&&A._debug(`Inbound: CHANNEL_REQUEST (r:${I}, ${J}: ${C})`);break}case"pty-req":{let C=T.readString(!0),Z=T.readUInt32BE(),Y=T.readUInt32BE(),z=T.readUInt32BE(),B=T.readUInt32BE(),q=T.readString();if(q!==void 0){T.init(q,1);let D={};while(T.avail()){let R=T.readByte();if(R===bX.TTY_OP_END)break;let N=HV[R],v=T.readUInt32BE();if(R===void 0||N===void 0||v===void 0){D=void 0;break}D[N]=v}if(D!==void 0)G={term:C,cols:Z,rows:Y,width:z,height:B,modes:D}}A._debug&&A._debug(`Inbound: CHANNEL_REQUEST (r:${I}, ${J})`);break}case"window-change":{let C=T.readUInt32BE(),Z=T.readUInt32BE(),Y=T.readUInt32BE(),z=T.readUInt32BE();if(z!==void 0)G={cols:C,rows:Z,width:Y,height:z};A._debug&&A._debug(`Inbound: CHANNEL_REQUEST (r:${I}, ${J})`);break}case"x11-req":{let C=T.readBool(),Z=T.readString(!0),Y=T.readString(),z=T.readUInt32BE();if(z!==void 0)G={single:C,protocol:Z,cookie:Y,screen:z};A._debug&&A._debug(`Inbound: CHANNEL_REQUEST (r:${I}, ${J})`);break}case"env":{let C=T.readString(!0),Z=T.readString(!0);if(Z!==void 0)G={name:C,value:Z};if(A._debug)A._debug(`Inbound: CHANNEL_REQUEST (r:${I}, ${J}: ${C}=${Z})`);break}case"shell":G=null,A._debug&&A._debug(`Inbound: CHANNEL_REQUEST (r:${I}, ${J})`);break;case"exec":G=T.readString(!0),A._debug&&A._debug(`Inbound: CHANNEL_REQUEST (r:${I}, ${J}: ${G})`);break;case"subsystem":G=T.readString(!0),A._debug&&A._debug(`Inbound: CHANNEL_REQUEST (r:${I}, ${J}: ${G})`);break;case"signal":G=T.readString(!0),A._debug&&A._debug(`Inbound: CHANNEL_REQUEST (r:${I}, ${J}: ${G})`);break;case"xon-xoff":G=T.readBool(),A._debug&&A._debug(`Inbound: CHANNEL_REQUEST (r:${I}, ${J}: ${G})`);break;case"[email protected]":G=null,A._debug&&A._debug(`Inbound: CHANNEL_REQUEST (r:${I}, ${J})`);break;default:G=T.avail()?T.readRaw():null,A._debug&&A._debug(`Inbound: CHANNEL_REQUEST (r:${I}, ${J})`)}if(T.clear(),G===void 0)return GQ(A,"Inbound: Malformed CHANNEL_REQUEST packet");let X=A._handlers.CHANNEL_REQUEST;X&&X(A,I,J,$,G)},[XQ.CHANNEL_SUCCESS]:(A,Q)=>{T.init(Q,1);let I=T.readUInt32BE();if(T.clear(),I===void 0)return GQ(A,"Inbound: Malformed CHANNEL_SUCCESS packet");A._debug&&A._debug(`Inbound: CHANNEL_SUCCESS (r:${I})`);let J=A._handlers.CHANNEL_SUCCESS;J&&J(A,I)},[XQ.CHANNEL_FAILURE]:(A,Q)=>{T.init(Q,1);let I=T.readUInt32BE();if(T.clear(),I===void 0)return GQ(A,"Inbound: Malformed CHANNEL_FAILURE packet");A._debug&&A._debug(`Inbound: CHANNEL_FAILURE (r:${I})`);let J=A._handlers.CHANNEL_FAILURE;J&&J(A,I)}}});var VJ=cA((bY,lX)=>{var w$=new Array(256);[zJ().HANDLERS,dX()].forEach((A)=>{for(let[Q,I]of Object.entries(A))if(Q=+Q,isFinite(Q)&&Q>=0&&Q<w$.length)w$[Q]=I});lX.exports=w$});var zJ=cA((fY,eX)=>{var{createDiffieHellman:FV,createDiffieHellmanGroup:qV,createECDH:DV,createHash:O$,createPublicKey:KV,diffieHellman:NV,generateKeyPairSync:RV,randomFillSync:MV}=EA("crypto"),{Ber:cX}=YI(),{COMPAT:L$,curve25519Supported:UV,DEFAULT_KEX:iX,DEFAULT_SERVER_HOST_KEY:oX,DEFAULT_CIPHER:YJ,DEFAULT_MAC:jJ,DEFAULT_COMPRESSION:BJ,DISCONNECT_REASON:dA,MESSAGE:JQ}=J0(),{CIPHER_INFO:p0,createCipher:wV,createDecipher:TV,MAC_INFO:pX}=j0(),{parseDERKey:OV}=H0(),{bufferFill:LV,bufferParser:fA,convertSignature:xV,doFatalError:lA,FastBuffer:vV,sigSSHToASN1:PV,writeUInt32BE:MQ}=iQ(),{PacketReader:nX,PacketWriter:sX,ZlibPacketReader:WJ,ZlibPacketWriter:HJ}=M$(),i0,_V=Buffer.alloc(0);function rX(A){let Q;if(A._compatFlags&L$.BAD_DHGEX){let I=A._offer.lists.kex,J=I.array,$=!1;for(let G=0;G<J.length;++G)if(J[G].includes("group-exchange")){if(!$)$=!0,J=J.slice();J.splice(G--,1)}if($){let G=17+A._offer.totalSize+1+4,X=Buffer.from(J.join(","));G-=I.buffer.length-X.length;let C=A._offer.lists.all,Z=new Uint8Array(C.buffer,C.byteOffset+4+I.buffer.length,C.length-(4+I.buffer.length));Q=Buffer.allocUnsafe(G),MQ(Q,X.length,17),Q.set(X,21),Q.set(Z,21+X.length)}}if(Q===void 0)Q=Buffer.allocUnsafe(17+A._offer.totalSize+1+4),A._offer.copyAllTo(Q,17);A._debug&&A._debug("Outbound: Sending KEXINIT"),Q[0]=JQ.KEXINIT,MV(Q,1,16),LV(Q,0,Q.length-5),A._kexinit=Q,A._packetRW.write.allocStart=0;{let I=A._packetRW.write.allocStartKEX,J=A._packetRW.write.alloc(Q.length,!0);J.set(Q,I),A._cipher.encrypt(A._packetRW.write.finalize(J,!0))}}function aX(A,Q){let I={kex:void 0,serverHostKey:void 0,cs:{cipher:void 0,mac:void 0,compress:void 0,lang:void 0},sc:{cipher:void 0,mac:void 0,compress:void 0,lang:void 0}};if(fA.init(Q,17),(I.kex=fA.readList())===void 0||(I.serverHostKey=fA.readList())===void 0||(I.cs.cipher=fA.readList())===void 0||(I.sc.cipher=fA.readList())===void 0||(I.cs.mac=fA.readList())===void 0||(I.sc.mac=fA.readList())===void 0||(I.cs.compress=fA.readList())===void 0||(I.sc.compress=fA.readList())===void 0||(I.cs.lang=fA.readList())===void 0||(I.sc.lang=fA.readList())===void 0)return fA.clear(),lA(A,"Received malformed KEXINIT","handshake",dA.KEY_EXCHANGE_FAILED);let J=fA.pos(),$=J<Q.length&&Q[J]===1;fA.clear();let G=A._offer,X=I,C=G.lists.kex.array;if(A._compatFlags&L$.BAD_DHGEX){let a=!1;for(let t=0;t<C.length;++t)if(C[t].indexOf("group-exchange")!==-1){if(!a)a=!0,C=C.slice();C.splice(t--,1)}}let Z,Y,z,B=A._debug;B&&B("Inbound: Handshake in progress"),B&&B(`Handshake: (local) KEX method: ${C}`),B&&B(`Handshake: (remote) KEX method: ${X.kex}`);let q;if(A._server)Y=C,Z=X.kex,q=Z.indexOf("ext-info-c")!==-1;else Y=X.kex,Z=C,q=Y.indexOf("ext-info-s")!==-1;if(A._strictMode===void 0){if(A._server)A._strictMode=Z.indexOf("[email protected]")!==-1;else A._strictMode=Y.indexOf("[email protected]")!==-1;if(A._strictMode){if(B&&B("Handshake: strict KEX mode enabled"),A._decipher.inSeqno!==1){if(B)B("Handshake: KEXINIT not first packet in strict KEX mode");return lA(A,"Handshake failed: KEXINIT not first packet in strict KEX mode","handshake",dA.KEY_EXCHANGE_FAILED)}}}for(z=0;z<Z.length&&Y.indexOf(Z[z])===-1;++z);if(z===Z.length)return B&&B("Handshake: no matching key exchange algorithm"),lA(A,"Handshake failed: no matching key exchange algorithm","handshake",dA.KEY_EXCHANGE_FAILED);if(I.kex=Z[z],B&&B(`Handshake: KEX algorithm: ${Z[z]}`),$&&(!X.kex.length||Z[z]!==X.kex[0]))A._skipNextInboundPacket=!0;let D=G.lists.serverHostKey.array;if(B&&B(`Handshake: (local) Host key format: ${D}`),B&&B(`Handshake: (remote) Host key format: ${X.serverHostKey}`),A._server)Y=D,Z=X.serverHostKey;else Y=X.serverHostKey,Z=D;for(z=0;z<Z.length&&Y.indexOf(Z[z])===-1;++z);if(z===Z.length)return B&&B("Handshake: No matching host key format"),lA(A,"Handshake failed: no matching host key format","handshake",dA.KEY_EXCHANGE_FAILED);I.serverHostKey=Z[z],B&&B(`Handshake: Host key format: ${Z[z]}`);let R=G.lists.cs.cipher.array;if(B&&B(`Handshake: (local) C->S cipher: ${R}`),B&&B(`Handshake: (remote) C->S cipher: ${X.cs.cipher}`),A._server)Y=R,Z=X.cs.cipher;else Y=X.cs.cipher,Z=R;for(z=0;z<Z.length&&Y.indexOf(Z[z])===-1;++z);if(z===Z.length)return B&&B("Handshake: No matching C->S cipher"),lA(A,"Handshake failed: no matching C->S cipher","handshake",dA.KEY_EXCHANGE_FAILED);I.cs.cipher=Z[z],B&&B(`Handshake: C->S Cipher: ${Z[z]}`);let N=G.lists.sc.cipher.array;if(B&&B(`Handshake: (local) S->C cipher: ${N}`),B&&B(`Handshake: (remote) S->C cipher: ${X.sc.cipher}`),A._server)Y=N,Z=X.sc.cipher;else Y=X.sc.cipher,Z=N;for(z=0;z<Z.length&&Y.indexOf(Z[z])===-1;++z);if(z===Z.length)return B&&B("Handshake: No matching S->C cipher"),lA(A,"Handshake failed: no matching S->C cipher","handshake",dA.KEY_EXCHANGE_FAILED);I.sc.cipher=Z[z],B&&B(`Handshake: S->C cipher: ${Z[z]}`);let v=G.lists.cs.mac.array;if(B&&B(`Handshake: (local) C->S MAC: ${v}`),B&&B(`Handshake: (remote) C->S MAC: ${X.cs.mac}`),p0[I.cs.cipher].authLen>0)I.cs.mac="",B&&B("Handshake: C->S MAC: <implicit>");else{if(A._server)Y=v,Z=X.cs.mac;else Y=X.cs.mac,Z=v;for(z=0;z<Z.length&&Y.indexOf(Z[z])===-1;++z);if(z===Z.length)return B&&B("Handshake: No matching C->S MAC"),lA(A,"Handshake failed: no matching C->S MAC","handshake",dA.KEY_EXCHANGE_FAILED);I.cs.mac=Z[z],B&&B(`Handshake: C->S MAC: ${Z[z]}`)}let P=G.lists.sc.mac.array;if(B&&B(`Handshake: (local) S->C MAC: ${P}`),B&&B(`Handshake: (remote) S->C MAC: ${X.sc.mac}`),p0[I.sc.cipher].authLen>0)I.sc.mac="",B&&B("Handshake: S->C MAC: <implicit>");else{if(A._server)Y=P,Z=X.sc.mac;else Y=X.sc.mac,Z=P;for(z=0;z<Z.length&&Y.indexOf(Z[z])===-1;++z);if(z===Z.length)return B&&B("Handshake: No matching S->C MAC"),lA(A,"Handshake failed: no matching S->C MAC","handshake",dA.KEY_EXCHANGE_FAILED);I.sc.mac=Z[z],B&&B(`Handshake: S->C MAC: ${Z[z]}`)}let o=G.lists.cs.compress.array;if(B&&B(`Handshake: (local) C->S compression: ${o}`),B&&B(`Handshake: (remote) C->S compression: ${X.cs.compress}`),A._server)Y=o,Z=X.cs.compress;else Y=X.cs.compress,Z=o;for(z=0;z<Z.length&&Y.indexOf(Z[z])===-1;++z);if(z===Z.length)return B&&B("Handshake: No matching C->S compression"),lA(A,"Handshake failed: no matching C->S compression","handshake",dA.KEY_EXCHANGE_FAILED);I.cs.compress=Z[z],B&&B(`Handshake: C->S compression: ${Z[z]}`);let k=G.lists.sc.compress.array;if(B&&B(`Handshake: (local) S->C compression: ${k}`),B&&B(`Handshake: (remote) S->C compression: ${X.sc.compress}`),A._server)Y=k,Z=X.sc.compress;else Y=X.sc.compress,Z=k;for(z=0;z<Z.length&&Y.indexOf(Z[z])===-1;++z);if(z===Z.length)return B&&B("Handshake: No matching S->C compression"),lA(A,"Handshake failed: no matching S->C compression","handshake",dA.KEY_EXCHANGE_FAILED);if(I.sc.compress=Z[z],B&&B(`Handshake: S->C compression: ${Z[z]}`),I.cs.lang="",I.sc.lang="",A._kex){if(!A._kexinit)rX(A);A._decipher._onPayload=tX.bind(A,{firstPacket:!1})}A._kex=EV(I,A,Q),A._kex.remoteExtInfoEnabled=q,A._kex.start()}var EV=(()=>{function A(X){let C=0,Z=X.length;while(X[C]===0)++C,--Z;let Y;if(X[C]&128)Y=Buffer.allocUnsafe(1+Z),Y[0]=0,X.copy(Y,1,C),X=Y;else if(Z!==X.length)Y=Buffer.allocUnsafe(Z),X.copy(Y,0,C),X=Y;return X}class Q{constructor(X,C,Z){this._protocol=C,this.sessionID=C._kex?C._kex.sessionID:void 0,this.negotiated=X,this.remoteExtInfoEnabled=!1,this._step=1,this._public=null,this._dh=null,this._sentNEWKEYS=!1,this._receivedNEWKEYS=!1,this._finished=!1,this._hostVerified=!1,this._kexinit=C._kexinit,this._remoteKexinit=Z,this._identRaw=C._identRaw,this._remoteIdentRaw=C._remoteIdentRaw,this._hostKey=void 0,this._dhData=void 0,this._sig=void 0}finish(X){if(this._finished)return!1;this._finished=!0;let C=this._protocol._server,Z=this.negotiated,Y=this.convertPublicKey(this._dhData),z=this.computeSecret(this._dhData);if(z instanceof Error)return z.message=`Error while computing DH secret (${this.type}): ${z.message}`,z.level="handshake",lA(this._protocol,z,dA.KEY_EXCHANGE_FAILED);let B=O$(this.hashName);aQ(B,C?this._remoteIdentRaw:this._identRaw),aQ(B,C?this._identRaw:this._remoteIdentRaw),aQ(B,C?this._remoteKexinit:this._kexinit),aQ(B,C?this._kexinit:this._remoteKexinit);let q=C?this._hostKey.getPublicSSH():this._hostKey;if(aQ(B,q),this.type==="groupex"){let o=this.getDHParams(),k=Buffer.allocUnsafe(4);MQ(k,this._minBits,0),B.update(k),MQ(k,this._prefBits,0),B.update(k),MQ(k,this._maxBits,0),B.update(k),aQ(B,o.prime),aQ(B,o.generator)}aQ(B,C?Y:this.getPublicKey());let D=C?this.getPublicKey():Y;aQ(B,D),aQ(B,z);let R=B.digest();if(!C){fA.init(this._sig,0);let o=fA.readString(!0);if(!o)return lA(this._protocol,"Malformed packet while reading signature","handshake",dA.KEY_EXCHANGE_FAILED);if(o!==Z.serverHostKey)return lA(this._protocol,`Wrong signature type: ${o}, expected: ${Z.serverHostKey}`,"handshake",dA.KEY_EXCHANGE_FAILED);let k=fA.readString();if(fA.clear(),k===void 0)return lA(this._protocol,"Malformed packet while reading signature","handshake",dA.KEY_EXCHANGE_FAILED);if(!(k=PV(k,o)))return lA(this._protocol,"Malformed signature","handshake",dA.KEY_EXCHANGE_FAILED);let a;{fA.init(this._hostKey,0);let M=fA.readString(!0),_=this._hostKey.slice(fA.pos());if(fA.clear(),a=OV(_,M),a instanceof Error)return a.level="handshake",lA(this._protocol,a,dA.KEY_EXCHANGE_FAILED)}let t;switch(this.negotiated.serverHostKey){case"rsa-sha2-256":t="sha256";break;case"rsa-sha2-512":t="sha512";break}this._protocol._debug&&this._protocol._debug("Verifying signature ...");let u=a.verify(R,k,t);if(u!==!0){if(u instanceof Error)this._protocol._debug&&this._protocol._debug(`Signature verification failed: ${u.stack}`);else this._protocol._debug&&this._protocol._debug("Signature verification failed");return lA(this._protocol,"Handshake failed: signature verification failed","handshake",dA.KEY_EXCHANGE_FAILED)}this._protocol._debug&&this._protocol._debug("Verified signature")}else{let o;switch(this.negotiated.serverHostKey){case"rsa-sha2-256":o="sha256";break;case"rsa-sha2-512":o="sha512";break}this._protocol._debug&&this._protocol._debug("Generating signature ...");let k=this._hostKey.sign(R,o);if(k instanceof Error)return lA(this._protocol,`Handshake failed: signature generation failed for ${this._hostKey.type} host key: ${k.message}`,"handshake",dA.KEY_EXCHANGE_FAILED);if(k=xV(k,this._hostKey.type),k===!1)return lA(this._protocol,`Handshake failed: signature conversion failed for ${this._hostKey.type} host key`,"handshake",dA.KEY_EXCHANGE_FAILED);let a=this.negotiated.serverHostKey,t=Buffer.byteLength(a),u=4+t+4+k.length,M=this._protocol._packetRW.write.allocStartKEX,_=this._protocol._packetRW.write.alloc(5+q.length+4+D.length+4+u,!0);if(_[M]=JQ.KEXDH_REPLY,MQ(_,q.length,++M),_.set(q,M+=4),MQ(_,D.length,M+=q.length),_.set(D,M+=4),MQ(_,u,M+=D.length),MQ(_,t,M+=4),_.utf8Write(a,M+=4,t),MQ(_,k.length,M+=t),_.set(k,M+=4),this._protocol._debug){let E;switch(this.type){case"group":E="KEXDH_REPLY";break;case"groupex":E="KEXDH_GEX_REPLY";break;default:E="KEXECDH_REPLY"}this._protocol._debug(`Outbound: Sending ${E}`)}this._protocol._cipher.encrypt(this._protocol._packetRW.write.finalize(_,!0))}if(C||!X)FJ(this);let N,v,P=(o)=>{if(N)return FJ(this),N.outbound.seqno=this._protocol._cipher.outSeqno,this._protocol._cipher.free(),this._protocol._cipher=wV(N),this._protocol._packetRW.write=v,N=void 0,v=void 0,this._protocol._onHandshakeComplete(Z),!1;if(!this.sessionID)this.sessionID=R;{let JA=Buffer.allocUnsafe(4+z.length);MQ(JA,z.length,0),JA.set(z,4),z=JA}let k=p0[Z.cs.cipher],a=p0[Z.sc.cipher],t=o0(k.ivLen,this.hashName,z,R,this.sessionID,"A"),u=o0(a.ivLen,this.hashName,z,R,this.sessionID,"B"),M=o0(k.keyLen,this.hashName,z,R,this.sessionID,"C"),_=o0(a.keyLen,this.hashName,z,R,this.sessionID,"D"),E,p;if(!k.authLen)E=pX[Z.cs.mac],p=o0(E.len,this.hashName,z,R,this.sessionID,"E");let S,QA;if(!a.authLen)S=pX[Z.sc.mac],QA=o0(S.len,this.hashName,z,R,this.sessionID,"F");let AA={inbound:{onPayload:this._protocol._onPayload,seqno:this._protocol._decipher.inSeqno,decipherInfo:!C?a:k,decipherIV:!C?u:t,decipherKey:!C?_:M,macInfo:!C?S:E,macKey:!C?QA:p},outbound:{onWrite:this._protocol._onWrite,seqno:this._protocol._cipher.outSeqno,cipherInfo:C?a:k,cipherIV:C?u:t,cipherKey:C?_:M,macInfo:C?S:E,macKey:C?QA:p}};this._protocol._decipher.free(),N=AA,this._protocol._decipher=TV(AA);let n={read:void 0,write:void 0};switch(Z.cs.compress){case"zlib":if(C)n.read=new WJ;else n.write=new HJ(this._protocol);break;case"[email protected]":if(this._protocol._authenticated){if(C)n.read=new WJ;else n.write=new HJ(this._protocol);break}default:if(C)n.read=new nX;else n.write=new sX(this._protocol)}switch(Z.sc.compress){case"zlib":if(C)n.write=new HJ(this._protocol);else n.read=new WJ;break;case"[email protected]":if(this._protocol._authenticated){if(C)n.write=new HJ(this._protocol);else n.read=new WJ;break}default:if(C)n.write=new sX(this._protocol);else n.read=new nX}if(this._protocol._packetRW.read.cleanup(),this._protocol._packetRW.write.cleanup(),this._protocol._packetRW.read=n.read,v=n.write,this._public=null,this._dh=null,this._kexinit=this._protocol._kexinit=void 0,this._remoteKexinit=void 0,this._identRaw=void 0,this._remoteIdentRaw=void 0,this._hostKey=void 0,this._dhData=void 0,this._sig=void 0,!o)return P();return!1};if(C||X)this.finish=P;if(!C)return P(X)}start(){if(!this._protocol._server){if(this._protocol._debug){let Y;switch(this.type){case"group":Y="KEXDH_INIT";break;default:Y="KEXECDH_INIT"}this._protocol._debug(`Outbound: Sending ${Y}`)}let X=this.getPublicKey(),C=this._protocol._packetRW.write.allocStartKEX,Z=this._protocol._packetRW.write.alloc(5+X.length,!0);Z[C]=JQ.KEXDH_INIT,MQ(Z,X.length,++C),Z.set(X,C+=4),this._protocol._cipher.encrypt(this._protocol._packetRW.write.finalize(Z,!0))}}getPublicKey(){this.generateKeys();let X=this._public;if(X)return this.convertPublicKey(X)}convertPublicKey(X){let C,Z=0,Y=X.length;while(X[Z]===0)++Z,--Y;if(X[Z]&128)return C=Buffer.allocUnsafe(1+Y),C[0]=0,X.copy(C,1,Z),C;if(Y!==X.length)C=Buffer.allocUnsafe(Y),X.copy(C,0,Z),X=C;return X}computeSecret(X){this.generateKeys();try{return A(this._dh.computeSecret(X))}catch(C){return C}}parse(X){let C=X[0];switch(this._step){case 1:if(this._protocol._server){if(C!==JQ.KEXDH_INIT)return lA(this._protocol,`Received packet ${C} instead of ${JQ.KEXDH_INIT}`,"handshake",dA.KEY_EXCHANGE_FAILED);this._protocol._debug&&this._protocol._debug("Received DH Init"),fA.init(X,1);let Z=fA.readString();if(fA.clear(),Z===void 0)return lA(this._protocol,"Received malformed KEX*_INIT","handshake",dA.KEY_EXCHANGE_FAILED);this._dhData=Z;let Y=this._protocol._hostKeys[this.negotiated.serverHostKey];if(Array.isArray(Y))Y=Y[0];this._hostKey=Y,this.finish()}else{if(C!==JQ.KEXDH_REPLY)return lA(this._protocol,`Received packet ${C} instead of ${JQ.KEXDH_REPLY}`,"handshake",dA.KEY_EXCHANGE_FAILED);this._protocol._debug&&this._protocol._debug("Received DH Reply"),fA.init(X,1);let Z,Y,z;if((Z=fA.readString())===void 0||(Y=fA.readString())===void 0||(z=fA.readString())===void 0)return fA.clear(),lA(this._protocol,"Received malformed KEX*_REPLY","handshake",dA.KEY_EXCHANGE_FAILED);fA.clear(),fA.init(Z,0);let B=fA.readString(!0);if(fA.clear(),B===void 0)return lA(this._protocol,"Received malformed host public key","handshake",dA.KEY_EXCHANGE_FAILED);if(B!==this.negotiated.serverHostKey)switch(this.negotiated.serverHostKey){case"rsa-sha2-256":case"rsa-sha2-512":if(B==="ssh-rsa")break;default:return lA(this._protocol,"Host key does not match negotiated type","handshake",dA.KEY_EXCHANGE_FAILED)}this._hostKey=Z,this._dhData=Y,this._sig=z;let q=!1,D;if(this._protocol._hostVerifier===void 0)D=!0,this._protocol._debug&&this._protocol._debug("Host accepted by default (no verification)");else D=this._protocol._hostVerifier(Z,(R)=>{if(q)return;if(q=!0,R===!1)return this._protocol._debug&&this._protocol._debug("Host denied (verification failed)"),lA(this._protocol,"Host denied (verification failed)","handshake",dA.KEY_EXCHANGE_FAILED);if(this._protocol._debug&&this._protocol._debug("Host accepted (verified)"),this._hostVerified=!0,this._receivedNEWKEYS)this.finish();else FJ(this)});if(D===void 0){++this._step;return}if(q=!0,D===!1)return this._protocol._debug&&this._protocol._debug("Host denied (verification failed)"),lA(this._protocol,"Host denied (verification failed)","handshake",dA.KEY_EXCHANGE_FAILED);this._protocol._debug&&this._protocol._debug("Host accepted (verified)"),this._hostVerified=!0,FJ(this)}++this._step;break;case 2:if(C!==JQ.NEWKEYS)return lA(this._protocol,`Received packet ${C} instead of ${JQ.NEWKEYS}`,"handshake",dA.KEY_EXCHANGE_FAILED);if(this._protocol._debug&&this._protocol._debug("Inbound: NEWKEYS"),this._receivedNEWKEYS=!0,this._protocol._strictMode)this._protocol._decipher.inSeqno=0;return++this._step,this.finish(!this._protocol._server&&!this._hostVerified);default:return lA(this._protocol,`Received unexpected packet ${C} after NEWKEYS`,"handshake",dA.KEY_EXCHANGE_FAILED)}}}class I extends Q{constructor(X,...C){super(...C);this.type="25519",this.hashName=X,this._keys=null}generateKeys(){if(!this._keys)this._keys=RV("x25519")}getPublicKey(){return this.generateKeys(),this._keys.publicKey.export({type:"spki",format:"der"}).slice(-32)}convertPublicKey(X){let C,Z=0,Y=X.length;while(X[Z]===0)++Z,--Y;if(X.length===32)return X;if(Y!==X.length)C=Buffer.allocUnsafe(Y),X.copy(C,0,Z),X=C;return X}computeSecret(X){this.generateKeys();try{let C=new cX.Writer;return C.startSequence(),C.startSequence(),C.writeOID("1.3.101.110"),C.endSequence(),C.startSequence(cX.BitString),C.writeByte(0),C._ensure(X.length),X.copy(C._buf,C._offset,0,X.length),C._offset+=X.length,C.endSequence(),C.endSequence(),A(NV({privateKey:this._keys.privateKey,publicKey:KV({key:C.buffer,type:"spki",format:"der"})}))}catch(C){return C}}}class J extends Q{constructor(X,C,...Z){super(...Z);this.type="ecdh",this.curveName=X,this.hashName=C}generateKeys(){if(!this._dh)this._dh=DV(this.curveName),this._public=this._dh.generateKeys()}}class $ extends Q{constructor(X,...C){super(...C);if(this.type="groupex",this.hashName=X,this._prime=null,this._generator=null,this._minBits=2048,this._prefBits=gV(this.negotiated),this._protocol._compatFlags&L$.BUG_DHGEX_LARGE)this._prefBits=Math.min(this._prefBits,4096);this._maxBits=8192}start(){if(this._protocol._server)return;this._protocol._debug&&this._protocol._debug("Outbound: Sending KEXDH_GEX_REQUEST");let X=this._protocol._packetRW.write.allocStartKEX,C=this._protocol._packetRW.write.alloc(13,!0);C[X]=JQ.KEXDH_GEX_REQUEST,MQ(C,this._minBits,++X),MQ(C,this._prefBits,X+=4),MQ(C,this._maxBits,X+=4),this._protocol._cipher.encrypt(this._protocol._packetRW.write.finalize(C,!0))}generateKeys(){if(!this._dh&&this._prime&&this._generator)this._dh=FV(this._prime,this._generator),this._public=this._dh.generateKeys()}setDHParams(X,C){if(!Buffer.isBuffer(X))throw new Error("Invalid prime value");if(!Buffer.isBuffer(C))throw new Error("Invalid generator value");this._prime=X,this._generator=C}getDHParams(){if(this._dh)return{prime:A(this._dh.getPrime()),generator:A(this._dh.getGenerator())}}parse(X){let C=X[0];switch(this._step){case 1:{if(this._protocol._server){if(C!==JQ.KEXDH_GEX_REQUEST)return lA(this._protocol,`Received packet ${C} instead of `+JQ.KEXDH_GEX_REQUEST,"handshake",dA.KEY_EXCHANGE_FAILED);return lA(this._protocol,"Group exchange not implemented for server","handshake",dA.KEY_EXCHANGE_FAILED)}if(C!==JQ.KEXDH_GEX_GROUP)return lA(this._protocol,`Received packet ${C} instead of ${JQ.KEXDH_GEX_GROUP}`,"handshake",dA.KEY_EXCHANGE_FAILED);this._protocol._debug&&this._protocol._debug("Received DH GEX Group"),fA.init(X,1);let Z,Y;if((Z=fA.readString())===void 0||(Y=fA.readString())===void 0)return fA.clear(),lA(this._protocol,"Received malformed KEXDH_GEX_GROUP","handshake",dA.KEY_EXCHANGE_FAILED);fA.clear(),this.setDHParams(Z,Y),this.generateKeys();let z=this.getPublicKey();this._protocol._debug&&this._protocol._debug("Outbound: Sending KEXDH_GEX_INIT");let B=this._protocol._packetRW.write.allocStartKEX,q=this._protocol._packetRW.write.alloc(5+z.length,!0);q[B]=JQ.KEXDH_GEX_INIT,MQ(q,z.length,++B),q.set(z,B+=4),this._protocol._cipher.encrypt(this._protocol._packetRW.write.finalize(q,!0)),++this._step;break}case 2:if(this._protocol._server){if(C!==JQ.KEXDH_GEX_INIT)return lA(this._protocol,`Received packet ${C} instead of ${JQ.KEXDH_GEX_INIT}`,"handshake",dA.KEY_EXCHANGE_FAILED);return this._protocol._debug&&this._protocol._debug("Received DH GEX Init"),lA(this._protocol,"Group exchange not implemented for server","handshake",dA.KEY_EXCHANGE_FAILED)}else if(C!==JQ.KEXDH_GEX_REPLY)return lA(this._protocol,`Received packet ${C} instead of ${JQ.KEXDH_GEX_REPLY}`,"handshake",dA.KEY_EXCHANGE_FAILED);this._protocol._debug&&this._protocol._debug("Received DH GEX Reply"),this._step=1,X[0]=JQ.KEXDH_REPLY,this.parse=Q.prototype.parse,this.parse(X)}}}class G extends Q{constructor(X,C,...Z){super(...Z);this.type="group",this.groupName=X,this.hashName=C}start(){if(!this._protocol._server){this._protocol._debug&&this._protocol._debug("Outbound: Sending KEXDH_INIT");let X=this.getPublicKey(),C=this._protocol._packetRW.write.allocStartKEX,Z=this._protocol._packetRW.write.alloc(5+X.length,!0);Z[C]=JQ.KEXDH_INIT,MQ(Z,X.length,++C),Z.set(X,C+=4),this._protocol._cipher.encrypt(this._protocol._packetRW.write.finalize(Z,!0))}}generateKeys(){if(!this._dh)this._dh=qV(this.groupName),this._public=this._dh.generateKeys()}getDHParams(){if(this._dh)return{prime:A(this._dh.getPrime()),generator:A(this._dh.getGenerator())}}}return(X,...C)=>{if(typeof X!=="object"||X===null)throw new Error("Invalid negotiated argument");let Z=X.kex;if(typeof Z==="string"){switch(C=[X,...C],Z){case"curve25519-sha256":case"[email protected]":if(!UV)break;return new I("sha256",...C);case"ecdh-sha2-nistp256":return new J("prime256v1","sha256",...C);case"ecdh-sha2-nistp384":return new J("secp384r1","sha384",...C);case"ecdh-sha2-nistp521":return new J("secp521r1","sha512",...C);case"diffie-hellman-group1-sha1":return new G("modp2","sha1",...C);case"diffie-hellman-group14-sha1":return new G("modp14","sha1",...C);case"diffie-hellman-group14-sha256":return new G("modp14","sha256",...C);case"diffie-hellman-group15-sha512":return new G("modp15","sha512",...C);case"diffie-hellman-group16-sha512":return new G("modp16","sha512",...C);case"diffie-hellman-group17-sha512":return new G("modp17","sha512",...C);case"diffie-hellman-group18-sha512":return new G("modp18","sha512",...C);case"diffie-hellman-group-exchange-sha1":return new $("sha1",...C);case"diffie-hellman-group-exchange-sha256":return new $("sha256",...C)}throw new Error(`Unsupported key exchange algorithm: ${Z}`)}throw new Error(`Invalid key exchange type: ${Z}`)}})(),T$=(()=>{let A=["kex","serverHostKey",["cs","cipher"],["sc","cipher"],["cs","mac"],["sc","mac"],["cs","compress"],["sc","compress"],["cs","lang"],["sc","lang"]];return class Q{constructor(I){if(typeof I!=="object"||I===null)throw new TypeError("Argument must be an object");let J={kex:void 0,serverHostKey:void 0,cs:{cipher:void 0,mac:void 0,compress:void 0,lang:void 0},sc:{cipher:void 0,mac:void 0,compress:void 0,lang:void 0},all:void 0},$=0;for(let C of A){let Z,Y,z,B;if(typeof C==="string")Z=J,Y=I[C],z=B=C;else{let D=C[0];Z=J[D],B=C[1],Y=I[D][B],z=`${D}.${B}`}let q={array:void 0,buffer:void 0};if(Buffer.isBuffer(Y))q.array=(""+Y).split(","),q.buffer=Y,$+=4+Y.length;else{if(typeof Y==="string")Y=Y.split(",");if(Array.isArray(Y))q.array=Y,q.buffer=Buffer.from(Y.join(","));else throw new TypeError(`Invalid \`${z}\` type: ${typeof Y}`);$+=4+q.buffer.length}Z[B]=q}let G=Buffer.allocUnsafe($);J.all=G;let X=0;for(let C of A){let Z;if(typeof C==="string")Z=J[C].buffer;else Z=J[C[0]][C[1]].buffer;X=MQ(G,Z.length,X),G.set(Z,X),X+=Z.length}this.totalSize=$,this.lists=J}copyAllTo(I,J){let $=this.lists.all;if(typeof J!=="number")throw new TypeError(`Invalid offset value: ${typeof J}`);if(I.length-J<$.length)throw new Error("Insufficient space to copy list");return I.set($,J),$.length}}})(),aQ=(()=>{let A=Buffer.allocUnsafe(4);return(Q,I)=>{MQ(A,I.length,0),Q.update(A),Q.update(I)}})();function o0(A,Q,I,J,$,G){let X;if(A){let C=O$(Q).update(I).update(J).update(G).update($).digest();while(C.length<A){let Z=O$(Q).update(I).update(J).update(C).digest(),Y=Buffer.allocUnsafe(C.length+Z.length);Y.set(C,0),Y.set(Z,C.length),C=Y}if(C.length===A)X=C;else X=new vV(C.buffer,C.byteOffset,A)}else X=_V;return X}function tX(A,Q){if(Q.length===0){this._debug&&this._debug("Inbound: Skipping empty packet payload");return}if(this._skipNextInboundPacket){this._skipNextInboundPacket=!1;return}Q=this._packetRW.read.read(Q);let I=Q[0];if(!this._strictMode)switch(I){case JQ.IGNORE:case JQ.UNIMPLEMENTED:case JQ.DEBUG:if(!i0)i0=VJ();return i0[I](this,Q)}switch(I){case JQ.DISCONNECT:if(!i0)i0=VJ();return i0[I](this,Q);case JQ.KEXINIT:if(!A.firstPacket)return lA(this,"Received extra KEXINIT during handshake","handshake",dA.KEY_EXCHANGE_FAILED);return A.firstPacket=!1,aX(this,Q);default:if(I<20||I>49)return lA(this,`Received unexpected packet type ${I}`,"handshake",dA.KEY_EXCHANGE_FAILED)}return this._kex.parse(Q)}function gV(A){let Q=p0[A.cs.cipher],I=p0[A.sc.cipher],J=Math.max(0,Q.sslName==="des-ede3-cbc"?14:Q.keyLen,Q.blockLen,Q.ivLen,I.sslName==="des-ede3-cbc"?14:I.keyLen,I.blockLen,I.ivLen)*8;if(J<=112)return 2048;if(J<=128)return 3072;if(J<=192)return 7680;return 8192}function FJ(A){if(!A._sentNEWKEYS){A._protocol._debug&&A._protocol._debug("Outbound: Sending NEWKEYS");let Q=A._protocol._packetRW.write.allocStartKEX,I=A._protocol._packetRW.write.alloc(1,!0);if(I[Q]=JQ.NEWKEYS,A._protocol._cipher.encrypt(A._protocol._packetRW.write.finalize(I,!0)),A._sentNEWKEYS=!0,A._protocol._strictMode)A._protocol._cipher.outSeqno=0}}eX.exports={KexInit:T$,kexinit:rX,onKEXPayload:tX,DEFAULT_KEXINIT_CLIENT:new T$({kex:iX.concat(["ext-info-c","[email protected]"]),serverHostKey:oX,cs:{cipher:YJ,mac:jJ,compress:BJ,lang:[]},sc:{cipher:YJ,mac:jJ,compress:BJ,lang:[]}}),DEFAULT_KEXINIT_SERVER:new T$({kex:iX.concat(["[email protected]"]),serverHostKey:oX,cs:{cipher:YJ,mac:jJ,compress:BJ,lang:[]},sc:{cipher:YJ,mac:jJ,compress:BJ,lang:[]}}),HANDLERS:{[JQ.KEXINIT]:aX}}});var AC=cA((dY,SV)=>{SV.exports={name:"ssh2",version:"1.16.0",author:"Brian White <[email protected]>",description:"SSH2 client and server modules written in pure JavaScript for node.js",main:"./lib/index.js",engines:{node:">=10.16.0"},dependencies:{asn1:"^0.2.6","bcrypt-pbkdf":"^1.0.2"},devDependencies:{"@mscdex/eslint-config":"^1.1.0",eslint:"^7.32.0"},optionalDependencies:{"cpu-features":"~0.0.10",nan:"^2.20.0"},scripts:{install:"node install.js",rebuild:"node install.js",test:"node test/test.js",lint:"eslint --cache --report-unused-disable-directives --ext=.js .eslintrc.js examples lib test","lint:fix":"npm run lint -- --fix"},keywords:["ssh","ssh2","sftp","secure","shell","exec","remote","client"],licenses:[{type:"MIT",url:"http://github.com/mscdex/ssh2/raw/master/LICENSE"}],repository:{type:"git",url:"http://github.com/mscdex/ssh2.git"}}});var P$=cA((lY,WC)=>{var{inspect:XC}=EA("util"),{bindingAvailable:kV,NullCipher:yV,NullDecipher:mV}=j0(),{COMPAT_CHECKS:hV,DISCONNECT_REASON:CC,eddsaSupported:uV,MESSAGE:qA,SIGNALS:QC,TERMINAL_MODE:v$}=J0(),{DEFAULT_KEXINIT_CLIENT:bV,DEFAULT_KEXINIT_SERVER:fV,KexInit:IC,kexinit:ZC,onKEXPayload:dV}=zJ(),{parseKey:JC}=H0(),lV=VJ(),{bufferCopy:qJ,bufferFill:cV,bufferSlice:VC,convertSignature:$C,sendPacket:DA,writeUInt32BE:U}=iQ(),{PacketReader:iV,PacketWriter:oV,ZlibPacketReader:zC,ZlibPacketWriter:YC}=M$(),pV=AC().version,nV=new Map(Object.values(CC).map((A)=>[A,1])),jC=Buffer.from(`SSH-2.0-ssh2js${pV}`),sV=Buffer.from(`${jC}\r
`),GC=Buffer.from([qA.GLOBAL_REQUEST,0,0,0,21,107,101,101,112,97,108,105,118,101,64,111,112,101,110,115,115,104,46,99,111,109,1]),rV=Buffer.from([v$.TTY_OP_END]);function x$(){}class BC{constructor(A){let Q=A.onWrite;if(typeof Q!=="function")throw new Error("Missing onWrite function");this._onWrite=(q)=>{Q(q)};let I=A.onError;if(typeof I!=="function")throw new Error("Missing onError function");this._onError=(q)=>{I(q)};let J=A.debug;this._debug=typeof J==="function"?(q)=>{J(q)}:void 0;let $=A.onHeader;this._onHeader=typeof $==="function"?(...q)=>{$(...q)}:x$;let G=A.onPacket;this._onPacket=typeof G==="function"?()=>{G()}:x$;let X=A.onHandshakeComplete;if(typeof X!=="function")X=x$;let C;this._onHandshakeComplete=(...q)=>{if(this._debug&&this._debug("Handshake completed"),C===void 0)C=!0;else C=!1;let D=this._queue;if(D){this._queue=void 0,this._debug&&this._debug(`Draining outbound queue (${D.length}) ...`);for(let R=0;R<D.length;++R){let N=D[R],v=this._packetRW.write.finalize(N);if(v===N){let P=this._cipher.allocPacket(N.length);P.set(N,5),v=P}DA(this,v)}this._debug&&this._debug("... finished draining outbound queue")}if(C&&this._server&&this._kex.remoteExtInfoEnabled)Jz(this);X(...q)},this._queue=void 0;let Z=A.messageHandlers;if(typeof Z==="object"&&Z!==null)this._handlers=Z;else this._handlers={};this._onPayload=Az.bind(this),this._server=!!A.server,this._banner=void 0;let Y;if(this._server){if(typeof A.hostKeys!=="object"||A.hostKeys===null)throw new Error("Missing server host key(s)");if(this._hostKeys=A.hostKeys,typeof A.greeting==="string"&&A.greeting.length)Y=A.greeting.slice(-2)===`\r
`?A.greeting:`${A.greeting}\r
`;if(typeof A.banner==="string"&&A.banner.length)this._banner=A.banner.slice(-2)===`\r
`?A.banner:`${A.banner}\r
`}else this._hostKeys=void 0;let z=A.offer;if(typeof z!=="object"||z===null)z=this._server?fV:bV;else if(z.constructor!==IC){if(this._server)z.kex=z.kex.concat(["[email protected]"]);else z.kex=z.kex.concat(["ext-info-c","[email protected]"]);z=new IC(z)}this._kex=void 0,this._strictMode=void 0,this._kexinit=void 0,this._offer=z,this._cipher=new yV(0,this._onWrite),this._decipher=void 0,this._skipNextInboundPacket=!1,this._packetRW={read:new iV,write:new oV(this)},this._hostVerifier=!this._server&&typeof A.hostVerifier==="function"?A.hostVerifier:void 0,this._parse=tV,this._buffer=void 0,this._authsQueue=[],this._authenticated=!1,this._remoteIdentRaw=void 0;let B;if(typeof A.ident==="string")this._identRaw=Buffer.from(`SSH-2.0-${A.ident}`),B=Buffer.allocUnsafe(this._identRaw.length+2),B.set(this._identRaw,0),B[B.length-2]=13,B[B.length-1]=10;else if(Buffer.isBuffer(A.ident)){let q=Buffer.allocUnsafe(8+A.ident.length);q.latin1Write("SSH-2.0-",0,8),q.set(A.ident,8),this._identRaw=q,B=Buffer.allocUnsafe(q.length+2),B.set(q,0),B[B.length-2]=13,B[B.length-1]=10}else this._identRaw=jC,B=sV;if(this._compatFlags=0,this._debug)if(kV)this._debug("Custom crypto binding available");else this._debug("Custom crypto binding not available");this._debug&&this._debug(`Local ident: ${XC(this._identRaw.toString())}`),this.start=()=>{if(this.start=void 0,Y)this._onWrite(Y);this._onWrite(B)}}_destruct(A){if(this._packetRW.read.cleanup(),this._packetRW.write.cleanup(),this._cipher&&this._cipher.free(),this._decipher&&this._decipher.free(),typeof A!=="string"||A.length===0)A="fatal error";this.parse=()=>{throw new Error(`Instance unusable after ${A}`)},this._onWrite=()=>{throw new Error(`Instance unusable after ${A}`)},this._destruct=void 0}cleanup(){this._destruct&&this._destruct()}parse(A,Q,I){while(Q<I)Q=this._parse(A,Q,I)}disconnect(A){let I=this._packetRW.write.allocStartKEX,J=this._packetRW.write.alloc(13,!0),$=I+13;if(!nV.has(A))A=CC.PROTOCOL_ERROR;J[I]=qA.DISCONNECT,U(J,A,++I),J.fill(0,I+=4,$),this._debug&&this._debug(`Outbound: Sending DISCONNECT (${A})`),DA(this,this._packetRW.write.finalize(J,!0),!0)}ping(){let A=this._packetRW.write.allocStart,Q=this._packetRW.write.alloc(GC.length);Q.set(GC,A),this._debug&&this._debug("Outbound: Sending ping (GLOBAL_REQUEST: [email protected])"),DA(this,this._packetRW.write.finalize(Q))}rekey(){if(this._kexinit===void 0)this._debug&&this._debug("Outbound: Initiated explicit rekey"),this._queue=[],ZC(this);else this._debug&&this._debug("Outbound: Ignoring rekey during handshake")}requestSuccess(A){let Q=this._packetRW.write.allocStart,I;if(Buffer.isBuffer(A))I=this._packetRW.write.alloc(1+A.length),I[Q]=qA.REQUEST_SUCCESS,I.set(A,++Q);else I=this._packetRW.write.alloc(1),I[Q]=qA.REQUEST_SUCCESS;this._debug&&this._debug("Outbound: Sending REQUEST_SUCCESS"),DA(this,this._packetRW.write.finalize(I))}requestFailure(){let A=this._packetRW.write.allocStart,Q=this._packetRW.write.alloc(1);Q[A]=qA.REQUEST_FAILURE,this._debug&&this._debug("Outbound: Sending REQUEST_FAILURE"),DA(this,this._packetRW.write.finalize(Q))}channelSuccess(A){let Q=this._packetRW.write.allocStart,I=this._packetRW.write.alloc(5);I[Q]=qA.CHANNEL_SUCCESS,U(I,A,++Q),this._debug&&this._debug(`Outbound: Sending CHANNEL_SUCCESS (r:${A})`),DA(this,this._packetRW.write.finalize(I))}channelFailure(A){let Q=this._packetRW.write.allocStart,I=this._packetRW.write.alloc(5);I[Q]=qA.CHANNEL_FAILURE,U(I,A,++Q),this._debug&&this._debug(`Outbound: Sending CHANNEL_FAILURE (r:${A})`),DA(this,this._packetRW.write.finalize(I))}channelEOF(A){let Q=this._packetRW.write.allocStart,I=this._packetRW.write.alloc(5);I[Q]=qA.CHANNEL_EOF,U(I,A,++Q),this._debug&&this._debug(`Outbound: Sending CHANNEL_EOF (r:${A})`),DA(this,this._packetRW.write.finalize(I))}channelClose(A){let Q=this._packetRW.write.allocStart,I=this._packetRW.write.alloc(5);I[Q]=qA.CHANNEL_CLOSE,U(I,A,++Q),this._debug&&this._debug(`Outbound: Sending CHANNEL_CLOSE (r:${A})`),DA(this,this._packetRW.write.finalize(I))}channelWindowAdjust(A,Q){let I=this._packetRW.write.allocStart,J=this._packetRW.write.alloc(9);J[I]=qA.CHANNEL_WINDOW_ADJUST,U(J,A,++I),U(J,Q,I+=4),this._debug&&this._debug(`Outbound: Sending CHANNEL_WINDOW_ADJUST (r:${A}, ${Q})`),DA(this,this._packetRW.write.finalize(J))}channelData(A,Q){let I=Buffer.isBuffer(Q),J=I?Q.length:Buffer.byteLength(Q),$=this._packetRW.write.allocStart,G=this._packetRW.write.alloc(9+J);if(G[$]=qA.CHANNEL_DATA,U(G,A,++$),U(G,J,$+=4),I)G.set(Q,$+=4);else G.utf8Write(Q,$+=4,J);this._debug&&this._debug(`Outbound: Sending CHANNEL_DATA (r:${A}, ${J})`),DA(this,this._packetRW.write.finalize(G))}channelExtData(A,Q,I){let J=Buffer.isBuffer(Q),$=J?Q.length:Buffer.byteLength(Q),G=this._packetRW.write.allocStart,X=this._packetRW.write.alloc(13+$);if(X[G]=qA.CHANNEL_EXTENDED_DATA,U(X,A,++G),U(X,I,G+=4),U(X,$,G+=4),J)X.set(Q,G+=4);else X.utf8Write(Q,G+=4,$);this._debug&&this._debug(`Outbound: Sending CHANNEL_EXTENDED_DATA (r:${A})`),DA(this,this._packetRW.write.finalize(X))}channelOpenConfirm(A,Q,I,J){let $=this._packetRW.write.allocStart,G=this._packetRW.write.alloc(17);G[$]=qA.CHANNEL_OPEN_CONFIRMATION,U(G,A,++$),U(G,Q,$+=4),U(G,I,$+=4),U(G,J,$+=4),this._debug&&this._debug(`Outbound: Sending CHANNEL_OPEN_CONFIRMATION (r:${A}, l:${Q})`),DA(this,this._packetRW.write.finalize(G))}channelOpenFail(A,Q,I){if(typeof I!=="string")I="";let J=Buffer.byteLength(I),$=this._packetRW.write.allocStart,G=this._packetRW.write.alloc(13+J+4);if(G[$]=qA.CHANNEL_OPEN_FAILURE,U(G,A,++$),U(G,Q,$+=4),U(G,J,$+=4),$+=4,J)G.utf8Write(I,$,J),$+=J;U(G,0,$),this._debug&&this._debug(`Outbound: Sending CHANNEL_OPEN_FAILURE (r:${A})`),DA(this,this._packetRW.write.finalize(G))}service(A){if(this._server)throw new Error("Client-only method called in server mode");let Q=Buffer.byteLength(A),I=this._packetRW.write.allocStart,J=this._packetRW.write.alloc(5+Q);J[I]=qA.SERVICE_REQUEST,U(J,Q,++I),J.utf8Write(A,I+=4,Q),this._debug&&this._debug(`Outbound: Sending SERVICE_REQUEST (${A})`),DA(this,this._packetRW.write.finalize(J))}authPassword(A,Q,I){if(this._server)throw new Error("Client-only method called in server mode");let J=Buffer.byteLength(A),$=Buffer.byteLength(Q),G=I?Buffer.byteLength(I):0,X=this._packetRW.write.allocStart,C=this._packetRW.write.alloc(5+J+4+14+4+8+1+4+$+(I?4+G:0));if(C[X]=qA.USERAUTH_REQUEST,U(C,J,++X),C.utf8Write(A,X+=4,J),U(C,14,X+=J),C.utf8Write("ssh-connection",X+=4,14),U(C,8,X+=14),C.utf8Write("password",X+=4,8),C[X+=8]=I?1:0,U(C,$,++X),Buffer.isBuffer(Q))qJ(Q,C,0,$,X+=4);else C.utf8Write(Q,X+=4,$);if(I){if(U(C,G,X+=$),Buffer.isBuffer(I))qJ(I,C,0,G,X+=4);else C.utf8Write(I,X+=4,G);this._debug&&this._debug("Outbound: Sending USERAUTH_REQUEST (changed password)")}else this._debug&&this._debug("Outbound: Sending USERAUTH_REQUEST (password)");this._authsQueue.push("password"),DA(this,this._packetRW.write.finalize(C))}authPK(A,Q,I,J){if(this._server)throw new Error("Client-only method called in server mode");if(Q=JC(Q),Q instanceof Error)throw new Error("Invalid key");let $=Q.type;if(Q=Q.getPublicSSH(),typeof I==="function")J=I,I=void 0;if(!I)I=$;let G=Buffer.byteLength(A),X=Buffer.byteLength(I),C=Q.length,Z=this._kex.sessionID,Y=Z.length,z=(J?4+Y:0)+1+4+G+4+14+4+9+1+4+X+4+C,B,q;if(J)B=Buffer.allocUnsafe(z),q=0,U(B,Y,q),B.set(Z,q+=4),q+=Y;else B=this._packetRW.write.alloc(z),q=this._packetRW.write.allocStart;if(B[q]=qA.USERAUTH_REQUEST,U(B,G,++q),B.utf8Write(A,q+=4,G),U(B,14,q+=G),B.utf8Write("ssh-connection",q+=4,14),U(B,9,q+=14),B.utf8Write("publickey",q+=4,9),B[q+=9]=J?1:0,U(B,X,++q),B.utf8Write(I,q+=4,X),U(B,C,q+=X),B.set(Q,q+=4),!J){this._authsQueue.push("publickey"),this._debug&&this._debug("Outbound: Sending USERAUTH_REQUEST (publickey -- check)"),DA(this,this._packetRW.write.finalize(B));return}J(B,(D)=>{if(D=$C(D,$),D===!1)throw new Error("Error while converting handshake signature");let R=D.length;q=this._packetRW.write.allocStart,B=this._packetRW.write.alloc(5+G+4+14+4+9+1+4+X+4+C+4+4+X+4+R),B[q]=qA.USERAUTH_REQUEST,U(B,G,++q),B.utf8Write(A,q+=4,G),U(B,14,q+=G),B.utf8Write("ssh-connection",q+=4,14),U(B,9,q+=14),B.utf8Write("publickey",q+=4,9),B[q+=9]=1,U(B,X,++q),B.utf8Write(I,q+=4,X),U(B,C,q+=X),B.set(Q,q+=4),U(B,4+X+4+R,q+=C),U(B,X,q+=4),B.utf8Write(I,q+=4,X),U(B,R,q+=X),B.set(D,q+=4),this._authsQueue.push("publickey"),this._debug&&this._debug("Outbound: Sending USERAUTH_REQUEST (publickey)"),DA(this,this._packetRW.write.finalize(B))})}authHostbased(A,Q,I,J,$,G){if(this._server)throw new Error("Client-only method called in server mode");if(Q=JC(Q),Q instanceof Error)throw new Error("Invalid key");let X=Q.type;if(Q=Q.getPublicSSH(),typeof $==="function")G=$,$=void 0;if(!$)$=X;let C=Buffer.byteLength(A),Z=Buffer.byteLength($),Y=Q.length,z=this._kex.sessionID,B=z.length,q=Buffer.byteLength(I),D=Buffer.byteLength(J),R=Buffer.allocUnsafe(4+B+1+4+C+4+14+4+9+4+Z+4+Y+4+q+4+D),N=0;U(R,B,N),R.set(z,N+=4),R[N+=B]=qA.USERAUTH_REQUEST,U(R,C,++N),R.utf8Write(A,N+=4,C),U(R,14,N+=C),R.utf8Write("ssh-connection",N+=4,14),U(R,9,N+=14),R.utf8Write("hostbased",N+=4,9),U(R,Z,N+=9),R.utf8Write($,N+=4,Z),U(R,Y,N+=Z),R.set(Q,N+=4),U(R,q,N+=Y),R.utf8Write(I,N+=4,q),U(R,D,N+=q),R.utf8Write(J,N+=4,D),G(R,(v)=>{if(v=$C(v,X),!v)throw new Error("Error while converting handshake signature");let P=v.length,o=R.length-B-4;N=this._packetRW.write.allocStart;let k=this._packetRW.write.alloc(o+4+4+Z+4+P);qJ(R,k,4+B,R.length,N),U(k,4+Z+4+P,N+=o),U(k,Z,N+=4),k.utf8Write($,N+=4,Z),U(k,P,N+=Z),k.set(v,N+=4),this._authsQueue.push("hostbased"),this._debug&&this._debug("Outbound: Sending USERAUTH_REQUEST (hostbased)"),DA(this,this._packetRW.write.finalize(k))})}authKeyboard(A){if(this._server)throw new Error("Client-only method called in server mode");let Q=Buffer.byteLength(A),I=this._packetRW.write.allocStart,J=this._packetRW.write.alloc(5+Q+4+14+4+20+4+4);J[I]=qA.USERAUTH_REQUEST,U(J,Q,++I),J.utf8Write(A,I+=4,Q),U(J,14,I+=Q),J.utf8Write("ssh-connection",I+=4,14),U(J,20,I+=14),J.utf8Write("keyboard-interactive",I+=4,20),U(J,0,I+=20),U(J,0,I+=4),this._authsQueue.push("keyboard-interactive"),this._debug&&this._debug("Outbound: Sending USERAUTH_REQUEST (keyboard-interactive)"),DA(this,this._packetRW.write.finalize(J))}authNone(A){if(this._server)throw new Error("Client-only method called in server mode");let Q=Buffer.byteLength(A),I=this._packetRW.write.allocStart,J=this._packetRW.write.alloc(5+Q+4+14+4+4);J[I]=qA.USERAUTH_REQUEST,U(J,Q,++I),J.utf8Write(A,I+=4,Q),U(J,14,I+=Q),J.utf8Write("ssh-connection",I+=4,14),U(J,4,I+=14),J.utf8Write("none",I+=4,4),this._authsQueue.push("none"),this._debug&&this._debug("Outbound: Sending USERAUTH_REQUEST (none)"),DA(this,this._packetRW.write.finalize(J))}authInfoRes(A){if(this._server)throw new Error("Client-only method called in server mode");let Q=0,I;if(A){I=new Array(A.length);for(let G=0;G<A.length;++G){let X=Buffer.byteLength(A[G]);I[G]=X,Q+=4+X}}let J=this._packetRW.write.allocStart,$=this._packetRW.write.alloc(5+Q);if($[J]=qA.USERAUTH_INFO_RESPONSE,A){U($,A.length,++J),J+=4;for(let G=0;G<A.length;++G){let X=I[G];if(U($,X,J),J+=4,X)$.utf8Write(A[G],J,X),J+=X}}else U($,0,++J);this._debug&&this._debug("Outbound: Sending USERAUTH_INFO_RESPONSE"),DA(this,this._packetRW.write.finalize($))}tcpipForward(A,Q,I){if(this._server)throw new Error("Client-only method called in server mode");let J=Buffer.byteLength(A),$=this._packetRW.write.allocStart,G=this._packetRW.write.alloc(23+J+4);G[$]=qA.GLOBAL_REQUEST,U(G,13,++$),G.utf8Write("tcpip-forward",$+=4,13),G[$+=13]=I===void 0||I===!0?1:0,U(G,J,++$),G.utf8Write(A,$+=4,J),U(G,Q,$+=J),this._debug&&this._debug("Outbound: Sending GLOBAL_REQUEST (tcpip-forward)"),DA(this,this._packetRW.write.finalize(G))}cancelTcpipForward(A,Q,I){if(this._server)throw new Error("Client-only method called in server mode");let J=Buffer.byteLength(A),$=this._packetRW.write.allocStart,G=this._packetRW.write.alloc(30+J+4);G[$]=qA.GLOBAL_REQUEST,U(G,20,++$),G.utf8Write("cancel-tcpip-forward",$+=4,20),G[$+=20]=I===void 0||I===!0?1:0,U(G,J,++$),G.utf8Write(A,$+=4,J),U(G,Q,$+=J),this._debug&&this._debug("Outbound: Sending GLOBAL_REQUEST (cancel-tcpip-forward)"),DA(this,this._packetRW.write.finalize(G))}openssh_streamLocalForward(A,Q){if(this._server)throw new Error("Client-only method called in server mode");let I=Buffer.byteLength(A),J=this._packetRW.write.allocStart,$=this._packetRW.write.alloc(41+I);$[J]=qA.GLOBAL_REQUEST,U($,31,++J),$.utf8Write("[email protected]",J+=4,31),$[J+=31]=Q===void 0||Q===!0?1:0,U($,I,++J),$.utf8Write(A,J+=4,I),this._debug&&this._debug("Outbound: Sending GLOBAL_REQUEST ([email protected])"),DA(this,this._packetRW.write.finalize($))}openssh_cancelStreamLocalForward(A,Q){if(this._server)throw new Error("Client-only method called in server mode");let I=Buffer.byteLength(A),J=this._packetRW.write.allocStart,$=this._packetRW.write.alloc(48+I);if($[J]=qA.GLOBAL_REQUEST,U($,38,++J),$.utf8Write("[email protected]",J+=4,38),$[J+=38]=Q===void 0||Q===!0?1:0,U($,I,++J),$.utf8Write(A,J+=4,I),this._debug)this._debug("Outbound: Sending GLOBAL_REQUEST ([email protected])");DA(this,this._packetRW.write.finalize($))}directTcpip(A,Q,I,J){if(this._server)throw new Error("Client-only method called in server mode");let $=Buffer.byteLength(J.srcIP),G=Buffer.byteLength(J.dstIP),X=this._packetRW.write.allocStart,C=this._packetRW.write.alloc(33+$+4+4+G+4);C[X]=qA.CHANNEL_OPEN,U(C,12,++X),C.utf8Write("direct-tcpip",X+=4,12),U(C,A,X+=12),U(C,Q,X+=4),U(C,I,X+=4),U(C,G,X+=4),C.utf8Write(J.dstIP,X+=4,G),U(C,J.dstPort,X+=G),U(C,$,X+=4),C.utf8Write(J.srcIP,X+=4,$),U(C,J.srcPort,X+=$),this._debug&&this._debug(`Outbound: Sending CHANNEL_OPEN (r:${A}, direct-tcpip)`),DA(this,this._packetRW.write.finalize(C))}openssh_directStreamLocal(A,Q,I,J){if(this._server)throw new Error("Client-only method called in server mode");let $=Buffer.byteLength(J.socketPath),G=this._packetRW.write.allocStart,X=this._packetRW.write.alloc(51+$+4+4);if(X[G]=qA.CHANNEL_OPEN,U(X,30,++G),X.utf8Write("[email protected]",G+=4,30),U(X,A,G+=30),U(X,Q,G+=4),U(X,I,G+=4),U(X,$,G+=4),X.utf8Write(J.socketPath,G+=4,$),cV(X,0,G+=$,G+8),this._debug)this._debug(`Outbound: Sending CHANNEL_OPEN (r:${A}, [email protected])`);DA(this,this._packetRW.write.finalize(X))}openssh_noMoreSessions(A){if(this._server)throw new Error("Client-only method called in server mode");let Q=this._packetRW.write.allocStart,I=this._packetRW.write.alloc(34);I[Q]=qA.GLOBAL_REQUEST,U(I,28,++Q),I.utf8Write("[email protected]",Q+=4,28),I[Q+=28]=A===void 0||A===!0?1:0,this._debug&&this._debug("Outbound: Sending GLOBAL_REQUEST ([email protected])"),DA(this,this._packetRW.write.finalize(I))}session(A,Q,I){if(this._server)throw new Error("Client-only method called in server mode");let J=this._packetRW.write.allocStart,$=this._packetRW.write.alloc(24);$[J]=qA.CHANNEL_OPEN,U($,7,++J),$.utf8Write("session",J+=4,7),U($,A,J+=7),U($,Q,J+=4),U($,I,J+=4),this._debug&&this._debug(`Outbound: Sending CHANNEL_OPEN (r:${A}, session)`),DA(this,this._packetRW.write.finalize($))}windowChange(A,Q,I,J,$){if(this._server)throw new Error("Client-only method called in server mode");let G=this._packetRW.write.allocStart,X=this._packetRW.write.alloc(39);X[G]=qA.CHANNEL_REQUEST,U(X,A,++G),U(X,13,G+=4),X.utf8Write("window-change",G+=4,13),X[G+=13]=0,U(X,I,++G),U(X,Q,G+=4),U(X,$,G+=4),U(X,J,G+=4),this._debug&&this._debug(`Outbound: Sending CHANNEL_REQUEST (r:${A}, window-change)`),DA(this,this._packetRW.write.finalize(X))}pty(A,Q,I,J,$,G,X,C){if(this._server)throw new Error("Client-only method called in server mode");if(!G||!G.length)G="vt100";if(X&&!Buffer.isBuffer(X)&&!Array.isArray(X)&&typeof X==="object"&&X!==null)X=Iz(X);if(!X||!X.length)X=rV;let Z=G.length,Y=X.length,z=this._packetRW.write.allocStart,B=this._packetRW.write.alloc(21+Z+4+4+4+4+4+Y);if(B[z]=qA.CHANNEL_REQUEST,U(B,A,++z),U(B,7,z+=4),B.utf8Write("pty-req",z+=4,7),B[z+=7]=C===void 0||C===!0?1:0,U(B,Z,++z),B.utf8Write(G,z+=4,Z),U(B,I,z+=Z),U(B,Q,z+=4),U(B,$,z+=4),U(B,J,z+=4),U(B,Y,z+=4),z+=4,Array.isArray(X))for(let q=0;q<Y;++q)B[z++]=X[q];else if(Buffer.isBuffer(X))B.set(X,z);this._debug&&this._debug(`Outbound: Sending CHANNEL_REQUEST (r:${A}, pty-req)`),DA(this,this._packetRW.write.finalize(B))}shell(A,Q){if(this._server)throw new Error("Client-only method called in server mode");let I=this._packetRW.write.allocStart,J=this._packetRW.write.alloc(15);J[I]=qA.CHANNEL_REQUEST,U(J,A,++I),U(J,5,I+=4),J.utf8Write("shell",I+=4,5),J[I+=5]=Q===void 0||Q===!0?1:0,this._debug&&this._debug(`Outbound: Sending CHANNEL_REQUEST (r:${A}, shell)`),DA(this,this._packetRW.write.finalize(J))}exec(A,Q,I){if(this._server)throw new Error("Client-only method called in server mode");let J=Buffer.isBuffer(Q),$=J?Q.length:Buffer.byteLength(Q),G=this._packetRW.write.allocStart,X=this._packetRW.write.alloc(18+$);if(X[G]=qA.CHANNEL_REQUEST,U(X,A,++G),U(X,4,G+=4),X.utf8Write("exec",G+=4,4),X[G+=4]=I===void 0||I===!0?1:0,U(X,$,++G),J)X.set(Q,G+=4);else X.utf8Write(Q,G+=4,$);this._debug&&this._debug(`Outbound: Sending CHANNEL_REQUEST (r:${A}, exec: ${Q})`),DA(this,this._packetRW.write.finalize(X))}signal(A,Q){if(this._server)throw new Error("Client-only method called in server mode");let I=Q;if(Q=Q.toUpperCase(),Q.slice(0,3)==="SIG")Q=Q.slice(3);if(QC[Q]!==1)throw new Error(`Invalid signal: ${I}`);let J=Q.length,$=this._packetRW.write.allocStart,G=this._packetRW.write.alloc(20+J);G[$]=qA.CHANNEL_REQUEST,U(G,A,++$),U(G,6,$+=4),G.utf8Write("signal",$+=4,6),G[$+=6]=0,U(G,J,++$),G.utf8Write(Q,$+=4,J),this._debug&&this._debug(`Outbound: Sending CHANNEL_REQUEST (r:${A}, signal: ${Q})`),DA(this,this._packetRW.write.finalize(G))}env(A,Q,I,J){if(this._server)throw new Error("Client-only method called in server mode");let $=Buffer.byteLength(Q),G=Buffer.isBuffer(I),X=G?I.length:Buffer.byteLength(I),C=this._packetRW.write.allocStart,Z=this._packetRW.write.alloc(17+$+4+X);if(Z[C]=qA.CHANNEL_REQUEST,U(Z,A,++C),U(Z,3,C+=4),Z.utf8Write("env",C+=4,3),Z[C+=3]=J===void 0||J===!0?1:0,U(Z,$,++C),Z.utf8Write(Q,C+=4,$),U(Z,X,C+=$),G)Z.set(I,C+=4);else Z.utf8Write(I,C+=4,X);this._debug&&this._debug(`Outbound: Sending CHANNEL_REQUEST (r:${A}, env: ${Q}=${I})`),DA(this,this._packetRW.write.finalize(Z))}x11Forward(A,Q,I){if(this._server)throw new Error("Client-only method called in server mode");let{protocol:J,cookie:$}=Q,G=Buffer.isBuffer(J),X=G?J.length:Buffer.byteLength(J),C=Buffer.isBuffer($),Z=C?$.length:Buffer.byteLength($),Y=this._packetRW.write.allocStart,z=this._packetRW.write.alloc(22+X+4+Z+4);if(z[Y]=qA.CHANNEL_REQUEST,U(z,A,++Y),U(z,7,Y+=4),z.utf8Write("x11-req",Y+=4,7),z[Y+=7]=I===void 0||I===!0?1:0,z[++Y]=Q.single?1:0,U(z,X,++Y),G)z.set(J,Y+=4);else z.utf8Write(J,Y+=4,X);if(U(z,Z,Y+=X),C)z.set($,Y+=4);else z.latin1Write($,Y+=4,Z);U(z,Q.screen||0,Y+=Z),this._debug&&this._debug(`Outbound: Sending CHANNEL_REQUEST (r:${A}, x11-req)`),DA(this,this._packetRW.write.finalize(z))}subsystem(A,Q,I){if(this._server)throw new Error("Client-only method called in server mode");let J=Buffer.byteLength(Q),$=this._packetRW.write.allocStart,G=this._packetRW.write.alloc(23+J);G[$]=qA.CHANNEL_REQUEST,U(G,A,++$),U(G,9,$+=4),G.utf8Write("subsystem",$+=4,9),G[$+=9]=I===void 0||I===!0?1:0,U(G,J,++$),G.utf8Write(Q,$+=4,J),this._debug&&this._debug(`Outbound: Sending CHANNEL_REQUEST (r:${A}, subsystem: ${Q})`),DA(this,this._packetRW.write.finalize(G))}openssh_agentForward(A,Q){if(this._server)throw new Error("Client-only method called in server mode");let I=this._packetRW.write.allocStart,J=this._packetRW.write.alloc(36);if(J[I]=qA.CHANNEL_REQUEST,U(J,A,++I),U(J,26,I+=4),J.utf8Write("[email protected]",I+=4,26),J[I+=26]=Q===void 0||Q===!0?1:0,this._debug)this._debug(`Outbound: Sending CHANNEL_REQUEST (r:${A}, [email protected])`);DA(this,this._packetRW.write.finalize(J))}openssh_hostKeysProve(A){if(this._server)throw new Error("Client-only method called in server mode");let Q=0,I=[];for(let G of A){let X=G.getPublicSSH();Q+=4+X.length,I.push(X)}let J=this._packetRW.write.allocStart,$=this._packetRW.write.alloc(35+Q);$[J]=qA.GLOBAL_REQUEST,U($,29,++J),$.utf8Write("[email protected]",J+=4,29),$[J+=29]=1,++J;for(let G of I)U($,G.length,J),qJ(G,$,0,G.length,J+=4),J+=G.length;if(this._debug)this._debug("Outbound: Sending GLOBAL_REQUEST ([email protected])");DA(this,this._packetRW.write.finalize($))}serviceAccept(A){if(!this._server)throw new Error("Server-only method called in client mode");let Q=Buffer.byteLength(A),I=this._packetRW.write.allocStart,J=this._packetRW.write.alloc(5+Q);if(J[I]=qA.SERVICE_ACCEPT,U(J,Q,++I),J.utf8Write(A,I+=4,Q),this._debug&&this._debug(`Outbound: Sending SERVICE_ACCEPT (${A})`),DA(this,this._packetRW.write.finalize(J)),this._server&&this._banner&&A==="ssh-userauth"){let $=this._banner;this._banner=void 0;let G=Buffer.byteLength($);I=this._packetRW.write.allocStart;let X=this._packetRW.write.alloc(5+G+4);X[I]=qA.USERAUTH_BANNER,U(X,G,++I),X.utf8Write($,I+=4,G),U(X,0,I+=G),this._debug&&this._debug("Outbound: Sending USERAUTH_BANNER"),DA(this,this._packetRW.write.finalize(X))}}forwardedTcpip(A,Q,I,J){if(!this._server)throw new Error("Server-only method called in client mode");let $=Buffer.byteLength(J.boundAddr),G=Buffer.byteLength(J.remoteAddr),X=this._packetRW.write.allocStart,C=this._packetRW.write.alloc(36+$+4+4+G+4);C[X]=qA.CHANNEL_OPEN,U(C,15,++X),C.utf8Write("forwarded-tcpip",X+=4,15),U(C,A,X+=15),U(C,Q,X+=4),U(C,I,X+=4),U(C,$,X+=4),C.utf8Write(J.boundAddr,X+=4,$),U(C,J.boundPort,X+=$),U(C,G,X+=4),C.utf8Write(J.remoteAddr,X+=4,G),U(C,J.remotePort,X+=G),this._debug&&this._debug(`Outbound: Sending CHANNEL_OPEN (r:${A}, forwarded-tcpip)`),DA(this,this._packetRW.write.finalize(C))}x11(A,Q,I,J){if(!this._server)throw new Error("Server-only method called in client mode");let $=Buffer.byteLength(J.originAddr),G=this._packetRW.write.allocStart,X=this._packetRW.write.alloc(24+$+4);X[G]=qA.CHANNEL_OPEN,U(X,3,++G),X.utf8Write("x11",G+=4,3),U(X,A,G+=3),U(X,Q,G+=4),U(X,I,G+=4),U(X,$,G+=4),X.utf8Write(J.originAddr,G+=4,$),U(X,J.originPort,G+=$),this._debug&&this._debug(`Outbound: Sending CHANNEL_OPEN (r:${A}, x11)`),DA(this,this._packetRW.write.finalize(X))}openssh_authAgent(A,Q,I){if(!this._server)throw new Error("Server-only method called in client mode");let J=this._packetRW.write.allocStart,$=this._packetRW.write.alloc(39);$[J]=qA.CHANNEL_OPEN,U($,22,++J),$.utf8Write("[email protected]",J+=4,22),U($,A,J+=22),U($,Q,J+=4),U($,I,J+=4),this._debug&&this._debug(`Outbound: Sending CHANNEL_OPEN (r:${A}, [email protected])`),DA(this,this._packetRW.write.finalize($))}openssh_forwardedStreamLocal(A,Q,I,J){if(!this._server)throw new Error("Server-only method called in client mode");let $=Buffer.byteLength(J.socketPath),G=this._packetRW.write.allocStart,X=this._packetRW.write.alloc(54+$+4);if(X[G]=qA.CHANNEL_OPEN,U(X,33,++G),X.utf8Write("[email protected]",G+=4,33),U(X,A,G+=33),U(X,Q,G+=4),U(X,I,G+=4),U(X,$,G+=4),X.utf8Write(J.socketPath,G+=4,$),U(X,0,G+=$),this._debug)this._debug(`Outbound: Sending CHANNEL_OPEN (r:${A}, [email protected])`);DA(this,this._packetRW.write.finalize(X))}exitStatus(A,Q){if(!this._server)throw new Error("Server-only method called in client mode");let I=this._packetRW.write.allocStart,J=this._packetRW.write.alloc(25);J[I]=qA.CHANNEL_REQUEST,U(J,A,++I),U(J,11,I+=4),J.utf8Write("exit-status",I+=4,11),J[I+=11]=0,U(J,Q,++I),this._debug&&this._debug(`Outbound: Sending CHANNEL_REQUEST (r:${A}, exit-status: ${Q})`),DA(this,this._packetRW.write.finalize(J))}exitSignal(A,Q,I,J){if(!this._server)throw new Error("Server-only method called in client mode");let $=Q;if(typeof $!=="string"||!$)throw new Error(`Invalid signal: ${$}`);let G=Q.toUpperCase();if(G.slice(0,3)==="SIG")G=G.slice(3);if(QC[G]!==1)throw new Error(`Invalid signal: ${$}`);let X=Buffer.byteLength(G),C=J?Buffer.byteLength(J):0,Z=this._packetRW.write.allocStart,Y=this._packetRW.write.alloc(25+X+1+4+C+4);if(Y[Z]=qA.CHANNEL_REQUEST,U(Y,A,++Z),U(Y,11,Z+=4),Y.utf8Write("exit-signal",Z+=4,11),Y[Z+=11]=0,U(Y,X,++Z),Y.utf8Write(G,Z+=4,X),Y[Z+=X]=I?1:0,U(Y,C,++Z),Z+=4,C)Y.utf8Write(J,Z,C),Z+=C;U(Y,0,Z),this._debug&&this._debug(`Outbound: Sending CHANNEL_REQUEST (r:${A}, exit-signal: ${Q})`),DA(this,this._packetRW.write.finalize(Y))}authFailure(A,Q){if(!this._server)throw new Error("Server-only method called in client mode");if(this._authsQueue.length===0)throw new Error("No auth in progress");let I;if(typeof A==="boolean")Q=A,A=void 0;if(A){I=[];for(let X=0;X<A.length;++X){if(A[X].toLowerCase()==="none")continue;I.push(A[X])}I=I.join(",")}else I="";let J=I.length,$=this._packetRW.write.allocStart,G=this._packetRW.write.alloc(5+J+1);G[$]=qA.USERAUTH_FAILURE,U(G,J,++$),G.utf8Write(I,$+=4,J),G[$+=J]=Q===!0?1:0,this._authsQueue.shift(),this._debug&&this._debug("Outbound: Sending USERAUTH_FAILURE"),DA(this,this._packetRW.write.finalize(G))}authSuccess(){if(!this._server)throw new Error("Server-only method called in client mode");if(this._authsQueue.length===0)throw new Error("No auth in progress");let A=this._packetRW.write.allocStart,Q=this._packetRW.write.alloc(1);if(Q[A]=qA.USERAUTH_SUCCESS,this._authsQueue.shift(),this._authenticated=!0,this._debug&&this._debug("Outbound: Sending USERAUTH_SUCCESS"),DA(this,this._packetRW.write.finalize(Q)),this._kex.negotiated.cs.compress==="[email protected]")this._packetRW.read=new zC;if(this._kex.negotiated.sc.compress==="[email protected]")this._packetRW.write=new YC(this)}authPKOK(A,Q){if(!this._server)throw new Error("Server-only method called in client mode");if(this._authsQueue.length===0||this._authsQueue[0]!=="publickey")throw new Error('"publickey" auth not in progress');let I=Buffer.byteLength(A),J=Q.length,$=this._packetRW.write.allocStart,G=this._packetRW.write.alloc(5+I+4+J);G[$]=qA.USERAUTH_PK_OK,U(G,I,++$),G.utf8Write(A,$+=4,I),U(G,J,$+=I),G.set(Q,$+=4),this._authsQueue.shift(),this._debug&&this._debug("Outbound: Sending USERAUTH_PK_OK"),DA(this,this._packetRW.write.finalize(G))}authPasswdChg(A){if(!this._server)throw new Error("Server-only method called in client mode");let Q=Buffer.byteLength(A),I=this._packetRW.write.allocStart,J=this._packetRW.write.alloc(5+Q+4);J[I]=qA.USERAUTH_PASSWD_CHANGEREQ,U(J,Q,++I),J.utf8Write(A,I+=4,Q),U(J,0,I+=Q),this._debug&&this._debug("Outbound: Sending USERAUTH_PASSWD_CHANGEREQ"),DA(this,this._packetRW.write.finalize(J))}authInfoReq(A,Q,I){if(!this._server)throw new Error("Server-only method called in client mode");let J=0,$=A?Buffer.byteLength(A):0,G=Q?Buffer.byteLength(Q):0;for(let Z=0;Z<I.length;++Z)J+=4+Buffer.byteLength(I[Z].prompt)+1;let X=this._packetRW.write.allocStart,C=this._packetRW.write.alloc(5+$+4+G+4+4+J);if(C[X]=qA.USERAUTH_INFO_REQUEST,U(C,$,++X),X+=4,A)C.utf8Write(A,X,$),X+=$;if(U(C,G,X),X+=4,Q)C.utf8Write(Q,X,G),X+=G;U(C,0,X),U(C,I.length,X+=4),X+=4;for(let Z=0;Z<I.length;++Z){let Y=I[Z],z=Buffer.byteLength(Y.prompt);if(U(C,z,X),X+=4,z)C.utf8Write(Y.prompt,X,z),X+=z;C[X++]=Y.echo?1:0}this._debug&&this._debug("Outbound: Sending USERAUTH_INFO_REQUEST"),DA(this,this._packetRW.write.finalize(C))}}var aV=/^SSH-(2\.0|1\.99)-([^ ]+)(?: (.*))?$/;function tV(A,Q,I){let J,$;if(this._buffer){if(J=Buffer.allocUnsafe(this._buffer.length+(I-Q)),J.set(this._buffer,0),Q===0)J.set(A,this._buffer.length);else J.set(new Uint8Array(A.buffer,A.byteOffset+Q,I-Q),this._buffer.length);$=this._buffer.length,Q=0}else J=A,$=0;let G=Q,X=Q,C=Q,Z=!1,Y=0,z=0;for(;Q<J.length;++Q){let B=J[Q];if(B===13){Z=!0;continue}if(B===10){if(C>X&&C-X>4&&J[X]===83&&J[X+1]===83&&J[X+2]===72&&J[X+3]===45){let q=J.latin1Slice(G,C+1),D=X===G?q:q.slice(X-G),R=aV.exec(D);if(!R)throw new Error("Invalid identification string");let N={greeting:X===G?"":q.slice(0,X-G),identRaw:D,versions:{protocol:R[1],software:R[2]},comments:R[3]};if(this._remoteIdentRaw=Buffer.from(D),this._debug&&this._debug(`Remote ident: ${XC(D)}`),this._compatFlags=Qz(N),this._buffer=void 0,this._decipher=new mV(0,dV.bind(this,{firstPacket:!0})),this._parse=eV,this._onHeader(N),!this._destruct)return I;return ZC(this),Q+1-$}if(this._server)throw new Error("Greetings from clients not permitted");if(++z>1024)throw new Error("Max greeting lines exceeded");Z=!1,X=Q+1,Y=0}else if(Z)throw new Error("Invalid header: expected newline");else if(++Y>=8192)throw new Error("Header line too long");C=Q}if(!this._buffer)this._buffer=VC(J,G);return Q-$}function eV(A,Q,I){return this._decipher.decrypt(A,Q,I)}function Az(A){if(this._onPacket(),A.length===0){this._debug&&this._debug("Inbound: Skipping empty packet payload");return}A=this._packetRW.read.read(A);let Q=A[0];if(Q===qA.USERAUTH_SUCCESS&&!this._server&&!this._authenticated){if(this._authenticated=!0,this._kex.negotiated.cs.compress==="[email protected]")this._packetRW.write=new YC(this);if(this._kex.negotiated.sc.compress==="[email protected]")this._packetRW.read=new zC}let I=lV[Q];if(I===void 0){this._debug&&this._debug(`Inbound: Unsupported message type: ${Q}`);return}return I(this,A)}function Qz(A){let Q=A.versions.software,I=0;for(let J of hV)if(typeof J[0]==="string"){if(Q===J[0])I|=J[1]}else if(J[0].test(Q))I|=J[1];return I}function Iz(A){let Q=Object.keys(A),I=Buffer.allocUnsafe(5*Q.length+1),J=0;for(let $=0;$<Q.length;++$){let G=Q[$];if(G==="TTY_OP_END")continue;let X=v$[G];if(X===void 0)continue;let C=A[G];if(typeof C==="number"&&isFinite(C))I[J++]=X,I[J++]=C>>>24,I[J++]=C>>>16,I[J++]=C>>>8,I[J++]=C}if(I[J++]=v$.TTY_OP_END,J<I.length)return VC(I,0,J);return I}function Jz(A){let Q="ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521rsa-sha2-512,rsa-sha2-256,ssh-rsa,ssh-dss";if(uV)Q=`ssh-ed25519,${Q}`;let I=Buffer.byteLength(Q),J=A._packetRW.write.allocStart,$=A._packetRW.write.alloc(28+I);$[J]=qA.EXT_INFO,U($,1,++J),U($,15,J+=4),$.utf8Write("server-sig-algs",J+=4,15),U($,I,J+=15),$.utf8Write(Q,J+=4,I),A._debug&&A._debug("Outbound: Sending EXT_INFO"),DA(A,A._packetRW.write.finalize($))}WC.exports=BC});var DC=cA((Xz)=>{var DJ=EA("assert"),{inspect:$z}=EA("util");function HC(A){let Q="",I=A.length,J=A[0]==="-"?1:0;for(;I>=J+4;I-=3)Q=`_${A.slice(I-3,I)}${Q}`;return`${A.slice(0,I)}${Q}`}function FC(A,Q){if(DJ(typeof Q==="string","`thing` has to be of type string"),Array.isArray(A)){let I=A.length;if(DJ(I>0,"At least one expected value needs to be specified"),A=A.map((J)=>String(J)),I>2)return`one of ${Q} ${A.slice(0,I-1).join(", ")}, or `+A[I-1];else if(I===2)return`one of ${Q} ${A[0]} or ${A[1]}`;return`of ${Q} ${A[0]}`}return`of ${Q} ${String(A)}`}Xz.ERR_INTERNAL_ASSERTION=class A extends Error{constructor(Q){super();Error.captureStackTrace(this,A);let I=`This is caused by either a bug in ssh2 or incorrect usage of ssh2 internals.
Please open an issue with this stack trace at https://github.com/mscdex/ssh2/issues
`;this.message=Q===void 0?I:`${Q}
${I}`}};var Gz=4294967296,qC=(()=>{try{return new Function("return 2n ** 32n")()}catch{}})();Xz.ERR_OUT_OF_RANGE=class A extends RangeError{constructor(Q,I,J,$){super();Error.captureStackTrace(this,A),DJ(I,'Missing "range" argument');let G=$?Q:`The value of "${Q}" is out of range.`,X;if(Number.isInteger(J)&&Math.abs(J)>Gz)X=HC(String(J));else if(typeof J==="bigint"){if(X=String(J),J>qC||J<-qC)X=HC(X);X+="n"}else X=$z(J);G+=` It must be ${I}. Received ${X}`,this.message=G}};class KJ extends TypeError{constructor(A,Q,I){super();Error.captureStackTrace(this,KJ),DJ(typeof A==="string","'name' must be a string");let J;if(typeof Q==="string"&&Q.startsWith("not "))J="must not be",Q=Q.replace(/^not /,"");else J="must be";let $;if(A.endsWith(" argument"))$=`The ${A} ${J} ${FC(Q,"type")}`;else{let G=A.includes(".")?"property":"argument";$=`The "${A}" ${G} ${J} ${FC(Q,"type")}`}$+=`. Received type ${typeof I}`,this.message=$}}Xz.ERR_INVALID_ARG_TYPE=KJ;Xz.validateNumber=function A(Q,I){if(typeof Q!=="number")throw new KJ(I,"number",Q)}});var vI=cA((iY,_C)=>{var Yz=EA("events"),q0=EA("fs"),{constants:gQ}=q0,{Readable:UC,Writable:m$}=EA("stream"),{inherits:wC,types:{isDate:E$}}=EA("util"),jz=Buffer[Symbol.species],{bufferCopy:F0,bufferSlice:r0,makeBufferParser:Bz,writeUInt32BE:h}=iQ(),X0={SIZE:1,UIDGID:2,PERMISSIONS:4,ACMODTIME:8,EXTENDED:2147483648},TA=Buffer.alloc(28),sA={OK:0,EOF:1,NO_SUCH_FILE:2,PERMISSION_DENIED:3,FAILURE:4,BAD_MESSAGE:5,NO_CONNECTION:6,CONNECTION_LOST:7,OP_UNSUPPORTED:8},Wz=new Map(Object.values(sA).map((A)=>[A,1])),Hz={[sA.OK]:"No error",[sA.EOF]:"End of file",[sA.NO_SUCH_FILE]:"No such file or directory",[sA.PERMISSION_DENIED]:"Permission denied",[sA.FAILURE]:"Failure",[sA.BAD_MESSAGE]:"Bad message",[sA.NO_CONNECTION]:"No connection",[sA.CONNECTION_LOST]:"Connection lost",[sA.OP_UNSUPPORTED]:"Operation unsupported"},MA={INIT:1,OPEN:3,CLOSE:4,READ:5,WRITE:6,LSTAT:7,FSTAT:8,SETSTAT:9,FSETSTAT:10,OPENDIR:11,READDIR:12,REMOVE:13,MKDIR:14,RMDIR:15,REALPATH:16,STAT:17,RENAME:18,READLINK:19,SYMLINK:20,EXTENDED:200},SQ={VERSION:2,STATUS:101,HANDLE:102,DATA:103,NAME:104,ATTRS:105,EXTENDED:201},KA={READ:1,WRITE:2,APPEND:4,CREAT:8,TRUNC:16,EXCL:32},Fz=Buffer.from([0,0,0,5,MA.INIT,0,0,0,3]),qz=Buffer.from([0,0,0,5,SQ.VERSION,0,0,0,3]),Dz=/^SSH-2.0-(?:OpenSSH|dropbear)/,O=Bz(),Kz={readable:!1,writable:!1,push:(A)=>{},once:()=>{},on:()=>{},emit:()=>{},end:()=>{}};function TC(){}class OC extends Yz{constructor(A,Q,I){super();if(typeof I!=="object"||!I)I={};let J=A._protocol._remoteIdentRaw;this.server=!!I.server,this._debug=typeof I.debug==="function"?I.debug:void 0,this._isOpenSSH=J&&Dz.test(J),this._version=-1,this._extensions={},this._biOpt=I.biOpt,this._pktLenBytes=0,this._pktLen=0,this._pktPos=0,this._pktType=0,this._pktData=void 0,this._writeReqid=-1,this._requests={},this._maxInPktLen=262144,this._maxOutPktLen=34000,this._maxReadLen=(this._isOpenSSH?262144:34000)-2048,this._maxWriteLen=(this._isOpenSSH?262144:34000)-2048,this.maxOpenHandles=void 0,this._client=A,this._protocol=A._protocol,this._callbacks=[],this._hasX11=!1,this._exit={code:void 0,signal:void 0,dump:void 0,desc:void 0},this._waitWindow=!1,this._chunkcb=void 0,this._buffer=[],this.type=Q.type,this.subtype=void 0,this.incoming=Q.incoming,this.outgoing=Q.outgoing,this.stderr=Kz,this.readable=!0}push(A){if(A===null){if(PC(this),!this.readable)return;this.readable=!1,this.emit("end");return}let Q=0;while(Q<A.length){if(this._pktLenBytes<4){let G=Math.min(4-this._pktLenBytes,A.length-Q);this._pktLenBytes+=G;while(G--)this._pktLen=(this._pktLen<<8)+A[Q++];if(this._pktLenBytes<4)return;if(this._pktLen===0)return eA(this,"Invalid packet length");if(this._pktLen>this._maxInPktLen){let X=this._maxInPktLen;return eA(this,`Packet length ${this._pktLen} exceeds max length of ${X}`)}if(Q>=A.length)return}if(this._pktPos<this._pktLen){let G=Math.min(this._pktLen-this._pktPos,A.length-Q);if(Q!==0||G!==A.length)if(G===this._pktLen)this._pkt=new jz(A.buffer,A.byteOffset+Q,G);else{if(!this._pkt)this._pkt=Buffer.allocUnsafe(this._pktLen);this._pkt.set(new Uint8Array(A.buffer,A.byteOffset+Q,G),this._pktPos)}else if(G===this._pktLen)this._pkt=A;else{if(!this._pkt)this._pkt=Buffer.allocUnsafe(this._pktLen);this._pkt.set(A,this._pktPos)}if(Q+=G,this._pktPos+=G,this._pktPos<this._pktLen)return}let I=this._pkt[0],J=this._pkt;this._pktLen=0,this._pktLenBytes=0,this._pkt=void 0,this._pktPos=0;let $=this.server?wz[I]:Uz[I];if(!$)return eA(this,`Unknown packet type ${I}`);if(this._version===-1){if(this.server){if(I!==MA.INIT)return eA(this,`Expected INIT packet, got ${I}`)}else if(I!==SQ.VERSION)return eA(this,`Expected VERSION packet, got ${I}`)}if($(this,J)===!1)return}}end(){this.destroy()}destroy(){if(this.outgoing.state==="open"||this.outgoing.state==="eof")this.outgoing.state="closing",this._protocol.channelClose(this.outgoing.id)}_init(){if(this._init=TC,!this.server)oA(this,Fz)}createReadStream(A,Q){if(this.server)throw new Error("Client-only method called in server mode");return new C0(this,A,Q)}createWriteStream(A,Q){if(this.server)throw new Error("Client-only method called in server mode");return new dQ(this,A,Q)}open(A,Q,I,J){if(this.server)throw new Error("Client-only method called in server mode");if(typeof I==="function")J=I,I=void 0;let $=typeof Q==="number"?Q:xC(Q);if($===null)throw new Error(`Unknown flags string: ${Q}`);let G=0,X=0;if(typeof I==="string"||typeof I==="number")I={mode:I};if(typeof I==="object"&&I!==null)I=O0(I),G=I.flags,X=I.nb;let C=Buffer.byteLength(A),Z=9,Y=Buffer.allocUnsafe(13+C+4+4+X);h(Y,Y.length-4,0),Y[4]=MA.OPEN;let z=this._writeReqid=this._writeReqid+1&4294967295;if(h(Y,z,5),h(Y,C,Z),Y.utf8Write(A,Z+=4,C),h(Y,$,Z+=C),h(Y,G,Z+=4),X){if(Z+=4,X===TA.length)Y.set(TA,Z);else F0(TA,Y,0,X,Z);Z+=X}this._requests[z]={cb:J};let B=oA(this,Y);this._debug&&this._debug(`SFTP: Outbound: ${B?"Buffered":"Sending"} OPEN`)}close(A,Q){if(this.server)throw new Error("Client-only method called in server mode");if(!Buffer.isBuffer(A))throw new Error("handle is not a Buffer");let I=A.length,J=9,$=Buffer.allocUnsafe(13+I);h($,$.length-4,0),$[4]=MA.CLOSE;let G=this._writeReqid=this._writeReqid+1&4294967295;h($,G,5),h($,I,J),$.set(A,J+=4),this._requests[G]={cb:Q};let X=oA(this,$);this._debug&&this._debug(`SFTP: Outbound: ${X?"Buffered":"Sending"} CLOSE`)}read(A,Q,I,J,$,G){if(this.server)throw new Error("Client-only method called in server mode");if(!Buffer.isBuffer(A))throw new Error("handle is not a Buffer");if(!Buffer.isBuffer(Q))throw new Error("buffer is not a Buffer");if(I>=Q.length)throw new Error("offset is out of bounds");if(I+J>Q.length)throw new Error("length extends beyond buffer");if($===null)throw new Error("null position currently unsupported");LC(this,A,Q,I,J,$,G)}readData(A,Q,I,J,$,G){this.read(A,Q,I,J,$,G)}write(A,Q,I,J,$,G){if(this.server)throw new Error("Client-only method called in server mode");if(!Buffer.isBuffer(A))throw new Error("handle is not a Buffer");if(!Buffer.isBuffer(Q))throw new Error("buffer is not a Buffer");if(I>Q.length)throw new Error("offset is out of bounds");if(I+J>Q.length)throw new Error("length extends beyond buffer");if($===null)throw new Error("null position currently unsupported");if(!J){G&&process.nextTick(G,void 0,0);return}let X=this._maxWriteLen,C=Math.max(J-X,0),Z=$;if(C)J=X;let Y=A.length,z=9,B=Buffer.allocUnsafe(13+Y+8+4+J);h(B,B.length-4,0),B[4]=MA.WRITE;let q=this._writeReqid=this._writeReqid+1&4294967295;h(B,q,5),h(B,Y,z),B.set(A,z+=4),z+=Y;for(let R=7;R>=0;--R)B[z+R]=$&255,$/=256;h(B,J,z+=8),F0(Q,B,I,I+J,z+=4),this._requests[q]={cb:(R)=>{if(R){if(typeof G==="function")G(R)}else if(C)this.write(A,Q,I+J,C,Z+J,G);else if(typeof G==="function")G(void 0,I+J)}};let D=oA(this,B);if(this._debug){let R=D?"Sent":"Buffered";this._debug(`SFTP: Outbound: ${R} WRITE (id:${q})`)}}writeData(A,Q,I,J,$,G){this.write(A,Q,I,J,$,G)}fastGet(A,Q,I,J){if(this.server)throw new Error("Client-only method called in server mode");KC(this,q0,A,Q,I,J)}fastPut(A,Q,I,J){if(this.server)throw new Error("Client-only method called in server mode");KC(q0,this,A,Q,I,J)}readFile(A,Q,I){if(this.server)throw new Error("Client-only method called in server mode");let J;if(typeof I==="function")J=I;else if(typeof Q==="function")J=Q,Q=void 0;if(typeof Q==="string")Q={encoding:Q,flag:"r"};else if(!Q)Q={encoding:null,flag:"r"};else if(typeof Q!=="object")throw new TypeError("Bad arguments");let $=Q.encoding;if($&&!Buffer.isEncoding($))throw new Error(`Unknown encoding: ${$}`);let G,X,C,Z=0,Y,z=0,B=Q.flag||"r",q=()=>{if(G===0)X=Buffer.allocUnsafe(8192),this.read(Y,X,0,8192,z,D);else this.read(Y,X,Z,G-Z,z,D)},D=(N,v)=>{let P;if(N){if(P=N.code===sA.EOF,!P)return this.close(Y,()=>{return J&&J(N)})}else P=!1;if(P||G===0&&v===0)return R();if(z+=v,Z+=v,G!==0)if(Z===G)R();else q();else C.push(r0(X,0,v)),q()};D._wantEOFError=!0;let R=()=>{this.close(Y,(N)=>{if(G===0)X=Buffer.concat(C,Z);else if(Z<G)X=r0(X,0,Z);if($)X=X.toString($);return J&&J(N,X)})};this.open(A,B,438,(N,v)=>{if(N)return J&&J(N);Y=v;let P=(o,k)=>{if(o){this.stat(A,(a,t)=>{if(a)return this.close(Y,()=>{J&&J(o)});P(null,t)});return}if(G=k.size||0,G===0)return C=[],q();X=Buffer.allocUnsafe(G),q()};this.fstat(Y,P)})}writeFile(A,Q,I,J){if(this.server)throw new Error("Client-only method called in server mode");let $;if(typeof J==="function")$=J;else if(typeof I==="function")$=I,I=void 0;if(typeof I==="string")I={encoding:I,mode:438,flag:"w"};else if(!I)I={encoding:"utf8",mode:438,flag:"w"};else if(typeof I!=="object")throw new TypeError("Bad arguments");if(I.encoding&&!Buffer.isEncoding(I.encoding))throw new Error(`Unknown encoding: ${I.encoding}`);let G=I.flag||"w";this.open(A,G,I.mode,(X,C)=>{if(X)$&&$(X);else{let Z=Buffer.isBuffer(Q)?Q:Buffer.from(""+Q,I.encoding||"utf8"),Y=/a/.test(G)?null:0;if(Y===null){let z=(B,q)=>{if(B){this.stat(A,(D,R)=>{if(D)return this.close(C,()=>{$&&$(B)});z(null,R)});return}g$(this,C,Z,0,Z.length,q.size,$)};this.fstat(C,z);return}g$(this,C,Z,0,Z.length,Y,$)}})}appendFile(A,Q,I,J){if(this.server)throw new Error("Client-only method called in server mode");let $;if(typeof J==="function")$=J;else if(typeof I==="function")$=I,I=void 0;if(typeof I==="string")I={encoding:I,mode:438,flag:"a"};else if(!I)I={encoding:"utf8",mode:438,flag:"a"};else if(typeof I!=="object")throw new TypeError("Bad arguments");if(!I.flag)I=Object.assign({flag:"a"},I);this.writeFile(A,Q,I,$)}exists(A,Q){if(this.server)throw new Error("Client-only method called in server mode");this.stat(A,(I)=>{Q&&Q(I?!1:!0)})}unlink(A,Q){if(this.server)throw new Error("Client-only method called in server mode");let I=Buffer.byteLength(A),J=9,$=Buffer.allocUnsafe(13+I);h($,$.length-4,0),$[4]=MA.REMOVE;let G=this._writeReqid=this._writeReqid+1&4294967295;h($,G,5),h($,I,J),$.utf8Write(A,J+=4,I),this._requests[G]={cb:Q};let X=oA(this,$);this._debug&&this._debug(`SFTP: Outbound: ${X?"Buffered":"Sending"} REMOVE`)}rename(A,Q,I){if(this.server)throw new Error("Client-only method called in server mode");let J=Buffer.byteLength(A),$=Buffer.byteLength(Q),G=9,X=Buffer.allocUnsafe(13+J+4+$);h(X,X.length-4,0),X[4]=MA.RENAME;let C=this._writeReqid=this._writeReqid+1&4294967295;h(X,C,5),h(X,J,G),X.utf8Write(A,G+=4,J),h(X,$,G+=J),X.utf8Write(Q,G+=4,$),this._requests[C]={cb:I};let Z=oA(this,X);this._debug&&this._debug(`SFTP: Outbound: ${Z?"Buffered":"Sending"} RENAME`)}mkdir(A,Q,I){if(this.server)throw new Error("Client-only method called in server mode");let J=0,$=0;if(typeof Q==="function")I=Q,Q=void 0;if(typeof Q==="object"&&Q!==null)Q=O0(Q),J=Q.flags,$=Q.nb;let G=Buffer.byteLength(A),X=9,C=Buffer.allocUnsafe(13+G+4+$);h(C,C.length-4,0),C[4]=MA.MKDIR;let Z=this._writeReqid=this._writeReqid+1&4294967295;if(h(C,Z,5),h(C,G,X),C.utf8Write(A,X+=4,G),h(C,J,X+=G),$){if(X+=4,$===TA.length)C.set(TA,X);else F0(TA,C,0,$,X);X+=$}this._requests[Z]={cb:I};let Y=oA(this,C);this._debug&&this._debug(`SFTP: Outbound: ${Y?"Buffered":"Sending"} MKDIR`)}rmdir(A,Q){if(this.server)throw new Error("Client-only method called in server mode");let I=Buffer.byteLength(A),J=9,$=Buffer.allocUnsafe(13+I);h($,$.length-4,0),$[4]=MA.RMDIR;let G=this._writeReqid=this._writeReqid+1&4294967295;h($,G,5),h($,I,J),$.utf8Write(A,J+=4,I),this._requests[G]={cb:Q};let X=oA(this,$);this._debug&&this._debug(`SFTP: Outbound: ${X?"Buffered":"Sending"} RMDIR`)}readdir(A,Q,I){if(this.server)throw new Error("Client-only method called in server mode");if(typeof Q==="function")I=Q,Q={};if(typeof Q!=="object"||Q===null)Q={};let J=Q&&Q.full?!1:!0;if(!Buffer.isBuffer(A)&&typeof A!=="string")throw new Error("missing directory handle or path");if(typeof A==="string"){let Y=[],z=0,B=(q,D)=>{if(q)return I(q);this.readdir(D,Q,(R,N)=>{let v=R&&R.code===sA.EOF;if(R&&!v)return this.close(D,()=>I(R));if(v)return this.close(D,(P)=>{if(P)return I(P);I(void 0,Y)});for(let P=0;P<N.length;++P,++z)Y[z]=N[P];B(void 0,D)})};return this.opendir(A,B)}let $=A.length,G=9,X=Buffer.allocUnsafe(13+$);h(X,X.length-4,0),X[4]=MA.READDIR;let C=this._writeReqid=this._writeReqid+1&4294967295;h(X,C,5),h(X,$,G),X.set(A,G+=4),this._requests[C]={cb:J?(Y,z)=>{if(typeof I!=="function")return;if(Y)return I(Y);for(let B=z.length-1;B>=0;--B)if(z[B].filename==="."||z[B].filename==="..")z.splice(B,1);I(void 0,z)}:I};let Z=oA(this,X);this._debug&&this._debug(`SFTP: Outbound: ${Z?"Buffered":"Sending"} READDIR`)}fstat(A,Q){if(this.server)throw new Error("Client-only method called in server mode");if(!Buffer.isBuffer(A))throw new Error("handle is not a Buffer");let I=A.length,J=9,$=Buffer.allocUnsafe(13+I);h($,$.length-4,0),$[4]=MA.FSTAT;let G=this._writeReqid=this._writeReqid+1&4294967295;h($,G,5),h($,I,J),$.set(A,J+=4),this._requests[G]={cb:Q};let X=oA(this,$);this._debug&&this._debug(`SFTP: Outbound: ${X?"Buffered":"Sending"} FSTAT`)}stat(A,Q){if(this.server)throw new Error("Client-only method called in server mode");let I=Buffer.byteLength(A),J=9,$=Buffer.allocUnsafe(13+I);h($,$.length-4,0),$[4]=MA.STAT;let G=this._writeReqid=this._writeReqid+1&4294967295;h($,G,5),h($,I,J),$.utf8Write(A,J+=4,I),this._requests[G]={cb:Q};let X=oA(this,$);this._debug&&this._debug(`SFTP: Outbound: ${X?"Buffered":"Sending"} STAT`)}lstat(A,Q){if(this.server)throw new Error("Client-only method called in server mode");let I=Buffer.byteLength(A),J=9,$=Buffer.allocUnsafe(13+I);h($,$.length-4,0),$[4]=MA.LSTAT;let G=this._writeReqid=this._writeReqid+1&4294967295;h($,G,5),h($,I,J),$.utf8Write(A,J+=4,I),this._requests[G]={cb:Q};let X=oA(this,$);this._debug&&this._debug(`SFTP: Outbound: ${X?"Buffered":"Sending"} LSTAT`)}opendir(A,Q){if(this.server)throw new Error("Client-only method called in server mode");let I=Buffer.byteLength(A),J=9,$=Buffer.allocUnsafe(13+I);h($,$.length-4,0),$[4]=MA.OPENDIR;let G=this._writeReqid=this._writeReqid+1&4294967295;h($,G,5),h($,I,J),$.utf8Write(A,J+=4,I),this._requests[G]={cb:Q};let X=oA(this,$);this._debug&&this._debug(`SFTP: Outbound: ${X?"Buffered":"Sending"} OPENDIR`)}setstat(A,Q,I){if(this.server)throw new Error("Client-only method called in server mode");let J=0,$=0;if(typeof Q==="object"&&Q!==null)Q=O0(Q),J=Q.flags,$=Q.nb;else if(typeof Q==="function")I=Q;let G=Buffer.byteLength(A),X=9,C=Buffer.allocUnsafe(13+G+4+$);h(C,C.length-4,0),C[4]=MA.SETSTAT;let Z=this._writeReqid=this._writeReqid+1&4294967295;if(h(C,Z,5),h(C,G,X),C.utf8Write(A,X+=4,G),h(C,J,X+=G),$){if(X+=4,$===TA.length)C.set(TA,X);else F0(TA,C,0,$,X);X+=$}this._requests[Z]={cb:I};let Y=oA(this,C);this._debug&&this._debug(`SFTP: Outbound: ${Y?"Buffered":"Sending"} SETSTAT`)}fsetstat(A,Q,I){if(this.server)throw new Error("Client-only method called in server mode");if(!Buffer.isBuffer(A))throw new Error("handle is not a Buffer");let J=0,$=0;if(typeof Q==="object"&&Q!==null)Q=O0(Q),J=Q.flags,$=Q.nb;else if(typeof Q==="function")I=Q;let G=A.length,X=9,C=Buffer.allocUnsafe(13+G+4+$);h(C,C.length-4,0),C[4]=MA.FSETSTAT;let Z=this._writeReqid=this._writeReqid+1&4294967295;if(h(C,Z,5),h(C,G,X),C.set(A,X+=4),h(C,J,X+=G),$){if(X+=4,$===TA.length)C.set(TA,X);else F0(TA,C,0,$,X);X+=$}this._requests[Z]={cb:I};let Y=oA(this,C);this._debug&&this._debug(`SFTP: Outbound: ${Y?"Buffered":"Sending"} FSETSTAT`)}futimes(A,Q,I,J){return this.fsetstat(A,{atime:n0(Q),mtime:n0(I)},J)}utimes(A,Q,I,J){return this.setstat(A,{atime:n0(Q),mtime:n0(I)},J)}fchown(A,Q,I,J){return this.fsetstat(A,{uid:Q,gid:I},J)}chown(A,Q,I,J){return this.setstat(A,{uid:Q,gid:I},J)}fchmod(A,Q,I){return this.fsetstat(A,{mode:Q},I)}chmod(A,Q,I){return this.setstat(A,{mode:Q},I)}readlink(A,Q){if(this.server)throw new Error("Client-only method called in server mode");let I=Buffer.byteLength(A),J=9,$=Buffer.allocUnsafe(13+I);h($,$.length-4,0),$[4]=MA.READLINK;let G=this._writeReqid=this._writeReqid+1&4294967295;h($,G,5),h($,I,J),$.utf8Write(A,J+=4,I),this._requests[G]={cb:(C,Z)=>{if(typeof Q!=="function")return;if(C)return Q(C);if(!Z||!Z.length)return Q(new Error("Response missing link info"));Q(void 0,Z[0].filename)}};let X=oA(this,$);this._debug&&this._debug(`SFTP: Outbound: ${X?"Buffered":"Sending"} READLINK`)}symlink(A,Q,I){if(this.server)throw new Error("Client-only method called in server mode");let J=Buffer.byteLength(Q),$=Buffer.byteLength(A),G=9,X=Buffer.allocUnsafe(13+J+4+$);h(X,X.length-4,0),X[4]=MA.SYMLINK;let C=this._writeReqid=this._writeReqid+1&4294967295;if(h(X,C,5),this._isOpenSSH)h(X,$,G),X.utf8Write(A,G+=4,$),h(X,J,G+=$),X.utf8Write(Q,G+=4,J);else h(X,J,G),X.utf8Write(Q,G+=4,J),h(X,$,G+=J),X.utf8Write(A,G+=4,$);this._requests[C]={cb:I};let Z=oA(this,X);this._debug&&this._debug(`SFTP: Outbound: ${Z?"Buffered":"Sending"} SYMLINK`)}realpath(A,Q){if(this.server)throw new Error("Client-only method called in server mode");let I=Buffer.byteLength(A),J=9,$=Buffer.allocUnsafe(13+I);h($,$.length-4,0),$[4]=MA.REALPATH;let G=this._writeReqid=this._writeReqid+1&4294967295;h($,G,5),h($,I,J),$.utf8Write(A,J+=4,I),this._requests[G]={cb:(C,Z)=>{if(typeof Q!=="function")return;if(C)return Q(C);if(!Z||!Z.length)return Q(new Error("Response missing path info"));Q(void 0,Z[0].filename)}};let X=oA(this,$);this._debug&&this._debug(`SFTP: Outbound: ${X?"Buffered":"Sending"} REALPATH`)}ext_openssh_rename(A,Q,I){if(this.server)throw new Error("Client-only method called in server mode");let J=this._extensions["[email protected]"];if(!J||J!=="1")throw new Error("Server does not support this extended request");let $=Buffer.byteLength(A),G=Buffer.byteLength(Q),X=9,C=Buffer.allocUnsafe(41+$+4+G);h(C,C.length-4,0),C[4]=MA.EXTENDED;let Z=this._writeReqid=this._writeReqid+1&4294967295;h(C,Z,5),h(C,24,X),C.utf8Write("[email protected]",X+=4,24),h(C,$,X+=24),C.utf8Write(A,X+=4,$),h(C,G,X+=$),C.utf8Write(Q,X+=4,G),this._requests[Z]={cb:I};let Y=oA(this,C);if(this._debug){let z=Y?"Buffered":"Sending";this._debug(`SFTP: Outbound: ${z} [email protected]`)}}ext_openssh_statvfs(A,Q){if(this.server)throw new Error("Client-only method called in server mode");let I=this._extensions["[email protected]"];if(!I||I!=="2")throw new Error("Server does not support this extended request");let J=Buffer.byteLength(A),$=9,G=Buffer.allocUnsafe(36+J);h(G,G.length-4,0),G[4]=MA.EXTENDED;let X=this._writeReqid=this._writeReqid+1&4294967295;h(G,X,5),h(G,19,$),G.utf8Write("[email protected]",$+=4,19),h(G,J,$+=19),G.utf8Write(A,$+=4,J),this._requests[X]={extended:"[email protected]",cb:Q};let C=oA(this,G);if(this._debug){let Z=C?"Buffered":"Sending";this._debug(`SFTP: Outbound: ${Z} [email protected]`)}}ext_openssh_fstatvfs(A,Q){if(this.server)throw new Error("Client-only method called in server mode");let I=this._extensions["[email protected]"];if(!I||I!=="2")throw new Error("Server does not support this extended request");if(!Buffer.isBuffer(A))throw new Error("handle is not a Buffer");let J=A.length,$=9,G=Buffer.allocUnsafe(37+J);h(G,G.length-4,0),G[4]=MA.EXTENDED;let X=this._writeReqid=this._writeReqid+1&4294967295;h(G,X,5),h(G,20,$),G.utf8Write("[email protected]",$+=4,20),h(G,J,$+=20),G.set(A,$+=4),this._requests[X]={extended:"[email protected]",cb:Q};let C=oA(this,G);if(this._debug){let Z=C?"Buffered":"Sending";this._debug(`SFTP: Outbound: ${Z} [email protected]`)}}ext_openssh_hardlink(A,Q,I){if(this.server)throw new Error("Client-only method called in server mode");if(this._extensions["[email protected]"]!=="1")throw new Error("Server does not support this extended request");let $=Buffer.byteLength(A),G=Buffer.byteLength(Q),X=9,C=Buffer.allocUnsafe(37+$+4+G);h(C,C.length-4,0),C[4]=MA.EXTENDED;let Z=this._writeReqid=this._writeReqid+1&4294967295;h(C,Z,5),h(C,20,X),C.utf8Write("[email protected]",X+=4,20),h(C,$,X+=20),C.utf8Write(A,X+=4,$),h(C,G,X+=$),C.utf8Write(Q,X+=4,G),this._requests[Z]={cb:I};let Y=oA(this,C);if(this._debug){let z=Y?"Buffered":"Sending";this._debug(`SFTP: Outbound: ${z} [email protected]`)}}ext_openssh_fsync(A,Q){if(this.server)throw new Error("Client-only method called in server mode");if(this._extensions["[email protected]"]!=="1")throw new Error("Server does not support this extended request");if(!Buffer.isBuffer(A))throw new Error("handle is not a Buffer");let J=A.length,$=9,G=Buffer.allocUnsafe(34+J);h(G,G.length-4,0),G[4]=MA.EXTENDED;let X=this._writeReqid=this._writeReqid+1&4294967295;h(G,X,5),h(G,17,$),G.utf8Write("[email protected]",$+=4,17),h(G,J,$+=17),G.set(A,$+=4),this._requests[X]={cb:Q};let C=oA(this,G);this._debug&&this._debug(`SFTP: Outbound: ${C?"Buffered":"Sending"} [email protected]`)}ext_openssh_lsetstat(A,Q,I){if(this.server)throw new Error("Client-only method called in server mode");if(this._extensions["[email protected]"]!=="1")throw new Error("Server does not support this extended request");let $=0,G=0;if(typeof Q==="object"&&Q!==null)Q=O0(Q),$=Q.flags,G=Q.nb;else if(typeof Q==="function")I=Q;let X=Buffer.byteLength(A),C=9,Z=Buffer.allocUnsafe(37+X+4+G);h(Z,Z.length-4,0),Z[4]=MA.EXTENDED;let Y=this._writeReqid=this._writeReqid+1&4294967295;if(h(Z,Y,5),h(Z,20,C),Z.utf8Write("[email protected]",C+=4,20),h(Z,X,C+=20),Z.utf8Write(A,C+=4,X),h(Z,$,C+=X),G){if(C+=4,G===TA.length)Z.set(TA,C);else F0(TA,Z,0,G,C);C+=G}this._requests[Y]={cb:I};let z=oA(this,Z);if(this._debug){let B=z?"Buffered":"Sending";this._debug(`SFTP: Outbound: ${B} [email protected]`)}}ext_openssh_expandPath(A,Q){if(this.server)throw new Error("Client-only method called in server mode");if(this._extensions["[email protected]"]!=="1")throw new Error("Server does not support this extended request");let J=Buffer.byteLength(A),$=9,G=Buffer.allocUnsafe(40+J);h(G,G.length-4,0),G[4]=MA.EXTENDED;let X=this._writeReqid=this._writeReqid+1&4294967295;h(G,X,5),h(G,23,$),G.utf8Write("[email protected]",$+=4,23),h(G,J,$+=20),G.utf8Write(A,$+=4,J),this._requests[X]={cb:(Z,Y)=>{if(typeof Q!=="function")return;if(Z)return Q(Z);if(!Y||!Y.length)return Q(new Error("Response missing expanded path"));Q(void 0,Y[0].filename)}};let C=oA(this,G);if(this._debug){let Z=C?"Buffered":"Sending";this._debug(`SFTP: Outbound: ${Z} [email protected]`)}}ext_copy_data(A,Q,I,J,$,G){if(this.server)throw new Error("Client-only method called in server mode");if(this._extensions["copy-data"]!=="1")throw new Error("Server does not support this extended request");if(!Buffer.isBuffer(A))throw new Error("Source handle is not a Buffer");if(!Buffer.isBuffer(J))throw new Error("Destination handle is not a Buffer");let C=0,Z=Buffer.allocUnsafe(26+A.length+8+8+4+J.length+8);h(Z,Z.length-4,C),C+=4,Z[C]=MA.EXTENDED,++C;let Y=this._writeReqid=this._writeReqid+1&4294967295;h(Z,Y,C),C+=4,h(Z,9,C),C+=4,Z.utf8Write("copy-data",C,9),C+=9,h(Z,A.length,C),C+=4,Z.set(A,C),C+=A.length;for(let B=7;B>=0;--B)Z[C+B]=Q&255,Q/=256;C+=8;for(let B=7;B>=0;--B)Z[C+B]=I&255,I/=256;C+=8,h(Z,J.length,C),C+=4,Z.set(J,C),C+=J.length;for(let B=7;B>=0;--B)Z[C+B]=$&255,$/=256;this._requests[Y]={cb:G};let z=oA(this,Z);if(this._debug){let B=z?"Buffered":"Sending";this._debug(`SFTP: Outbound: ${B} copy-data`)}}ext_home_dir(A,Q){if(this.server)throw new Error("Client-only method called in server mode");if(this._extensions["home-directory"]!=="1")throw new Error("Server does not support this extended request");if(typeof A!=="string")throw new TypeError("username is not a string");let J=0,$=Buffer.byteLength(A),G=Buffer.allocUnsafe(31+$);h(G,G.length-4,J),J+=4,G[J]=MA.EXTENDED,++J;let X=this._writeReqid=this._writeReqid+1&4294967295;h(G,X,J),J+=4,h(G,14,J),J+=4,G.utf8Write("home-directory",J,14),J+=14,h(G,$,J),J+=4,G.utf8Write(A,J,$),J+=$,this._requests[X]={cb:(Z,Y)=>{if(typeof Q!=="function")return;if(Z)return Q(Z);if(!Y||!Y.length)return Q(new Error("Response missing home directory"));Q(void 0,Y[0].filename)}};let C=oA(this,G);if(this._debug){let Z=C?"Buffered":"Sending";this._debug(`SFTP: Outbound: ${Z} home-directory`)}}ext_users_groups(A,Q,I){if(this.server)throw new Error("Client-only method called in server mode");if(this._extensions["[email protected]"]!=="1")throw new Error("Server does not support this extended request");if(!Array.isArray(A))throw new TypeError("uids is not an array");for(let Z of A)if(!Number.isInteger(Z)||Z<0||Z>4294967295)throw new Error("uid values must all be 32-bit unsigned integers");if(!Array.isArray(Q))throw new TypeError("gids is not an array");for(let Z of Q)if(!Number.isInteger(Z)||Z<0||Z>4294967295)throw new Error("gid values must all be 32-bit unsigned integers");let $=0,G=Buffer.allocUnsafe(47+4*A.length+4+4*Q.length);h(G,G.length-4,$),$+=4,G[$]=MA.EXTENDED,++$;let X=this._writeReqid=this._writeReqid+1&4294967295;h(G,X,$),$+=4,h(G,30,$),$+=4,G.utf8Write("[email protected]",$,30),$+=30,h(G,4*A.length,$),$+=4;for(let Z of A)h(G,Z,$),$+=4;h(G,4*Q.length,$),$+=4;for(let Z of Q)h(G,Z,$),$+=4;this._requests[X]={extended:"[email protected]",cb:I};let C=oA(this,G);if(this._debug){let Z=C?"Buffered":"Sending";this._debug(`SFTP: Outbound: ${Z} [email protected]`)}}handle(A,Q){if(!this.server)throw new Error("Server-only method called in client mode");if(!Buffer.isBuffer(Q))throw new Error("handle is not a Buffer");let I=Q.length;if(I>256)throw new Error("handle too large (> 256 bytes)");let J=9,$=Buffer.allocUnsafe(13+I);if(h($,$.length-4,0),$[4]=SQ.HANDLE,h($,A,5),h($,I,J),I)$.set(Q,J+=4);let G=oA(this,$);this._debug&&this._debug(`SFTP: Outbound: ${G?"Buffered":"Sending"} HANDLE`)}status(A,Q,I){if(!this.server)throw new Error("Server-only method called in client mode");if(!Wz.has(Q))throw new Error(`Bad status code: ${Q}`);I||(I="");let J=Buffer.byteLength(I),$=9,G=Buffer.allocUnsafe(17+J+4);if(h(G,G.length-4,0),G[4]=SQ.STATUS,h(G,A,5),h(G,Q,$),h(G,J,$+=4),$+=4,J)G.utf8Write(I,$,J),$+=J;h(G,0,$);let X=oA(this,G);this._debug&&this._debug(`SFTP: Outbound: ${X?"Buffered":"Sending"} STATUS`)}data(A,Q,I){if(!this.server)throw new Error("Server-only method called in client mode");let J=Buffer.isBuffer(Q);if(!J&&typeof Q!=="string")throw new Error("data is not a Buffer or string");let $;if(!J&&!I)I=void 0,$=!0;let G=J?Q.length:Buffer.byteLength(Q,I),X=9,C=Buffer.allocUnsafe(13+G);if(h(C,C.length-4,0),C[4]=SQ.DATA,h(C,A,5),h(C,G,X),G)if(J)C.set(Q,X+=4);else if($)C.utf8Write(Q,X+=4,G);else C.write(Q,X+=4,G,I);let Z=oA(this,C);this._debug&&this._debug(`SFTP: Outbound: ${Z?"Buffered":"Sending"} DATA`)}name(A,Q){if(!this.server)throw new Error("Server-only method called in client mode");if(!Array.isArray(Q)){if(typeof Q!=="object"||Q===null)throw new Error("names is not an object or array");Q=[Q]}let I=Q.length,J=0,$,G=[];for(let Y=0;Y<I;++Y){let z=Q[Y],B=!z||!z.filename||typeof z.filename!=="string"?"":z.filename;J+=4+Buffer.byteLength(B);let q=!z||!z.longname||typeof z.longname!=="string"?"":z.longname;if(J+=4+Buffer.byteLength(q),typeof z.attrs==="object"&&z.attrs!==null){if($=O0(z.attrs),J+=4+$.nb,$.nb){let D;if($.nb===TA.length)D=new Uint8Array(TA);else D=new Uint8Array($.nb),F0(TA,D,0,$.nb,0);$.bytes=D}G.push($)}else J+=4,G.push(null)}let X=9,C=Buffer.allocUnsafe(13+J);h(C,C.length-4,0),C[4]=SQ.NAME,h(C,A,5),h(C,I,X),X+=4;for(let Y=0;Y<I;++Y){let z=Q[Y];{let q=!z||!z.filename||typeof z.filename!=="string"?"":z.filename,D=Buffer.byteLength(q);if(h(C,D,X),X+=4,D)C.utf8Write(q,X,D),X+=D}{let q=!z||!z.longname||typeof z.longname!=="string"?"":z.longname,D=Buffer.byteLength(q);if(h(C,D,X),X+=4,D)C.utf8Write(q,X,D),X+=D}let B=G[Y];if(B){if(h(C,B.flags,X),X+=4,B.flags&&B.bytes)C.set(B.bytes,X),X+=B.nb}else h(C,0,X),X+=4}let Z=oA(this,C);this._debug&&this._debug(`SFTP: Outbound: ${Z?"Buffered":"Sending"} NAME`)}attrs(A,Q){if(!this.server)throw new Error("Server-only method called in client mode");if(typeof Q!=="object"||Q===null)throw new Error("attrs is not an object");Q=O0(Q);let{flags:I,nb:J}=Q,$=9,G=Buffer.allocUnsafe(13+J);if(h(G,G.length-4,0),G[4]=SQ.ATTRS,h(G,A,5),h(G,I,$),J){if($+=4,J===TA.length)G.set(TA,$);else F0(TA,G,0,J,$);$+=J}let X=oA(this,G);this._debug&&this._debug(`SFTP: Outbound: ${X?"Buffered":"Sending"} ATTRS`)}}function Nz(A){try{return Buffer.allocUnsafe(A)}catch(Q){return Q}}function LC(A,Q,I,J,$,G,X,C){let Z=A._maxReadLen,Y=Math.max($-Z,0);if(Y)$=Z;let z=Q.length,B=9,q=G,D=Buffer.allocUnsafe(13+z+8+4);h(D,D.length-4,0),D[4]=MA.READ;let R=A._writeReqid=A._writeReqid+1&4294967295;h(D,R,5),h(D,z,B),D.set(Q,B+=4),B+=z;for(let P=7;P>=0;--P)D[B+P]=q&255,q/=256;if(h(D,$,B+=8),typeof X!=="function")X=TC;let N=C||{nb:0,position:G,off:J,origOff:J,len:void 0,overflow:void 0,cb:(P,o,k)=>{let{len:a,overflow:t}=N;if(P){if(X._wantEOFError||P.code!==sA.EOF)return X(P)}else if(k>a)return X(new Error("Received more data than requested"));else if(k===a&&t){N.nb+=k,N.position+=k,N.off+=k,LC(A,Q,I,N.off,t,N.position,X,N);return}if(k=k||0,N.origOff===0&&I.length===N.nb)o=I;else o=r0(I,N.origOff,N.origOff+N.nb+k);X(void 0,N.nb+k,o,N.position)},buffer:void 0};N.len=$,N.overflow=Y,N.buffer=r0(I,J,J+$),A._requests[R]=N;let v=oA(A,D);A._debug&&A._debug(`SFTP: Outbound: ${v?"Buffered":"Sending"} READ`)}function KC(A,Q,I,J,$,G){let X=64,C=32768,Z,Y,z;if(typeof $==="function")G=$;else if(typeof $==="object"&&$!==null){if(typeof $.concurrency==="number"&&$.concurrency>0&&!isNaN($.concurrency))X=$.concurrency;if(typeof $.chunkSize==="number"&&$.chunkSize>0&&!isNaN($.chunkSize))C=$.chunkSize;if(typeof $.fileSize==="number"&&$.fileSize>0&&!isNaN($.fileSize))z=$.fileSize;if(typeof $.step==="function")Z=$.step;if(typeof $.mode==="string"||typeof $.mode==="number")Y=u$($.mode)}let B,q=0,D=0,R=!1,N,v,P,o=C*X;function k(a){if(R)return;R=!0;let t=0,u;if(N||v){if(u=()=>{if(--t===0)G(a)},N&&(A===q0||A.outgoing.state==="open"))++t;if(v&&(Q===q0||Q.outgoing.state==="open"))++t;if(N&&(A===q0||A.outgoing.state==="open"))A.close(N,u);if(v&&(Q===q0||Q.outgoing.state==="open"))Q.close(v,u)}else G(a)}A.open(I,"r",(a,t)=>{if(a)return k(a);if(N=t,z===void 0)A.fstat(N,u);else u(null,{size:z});function u(M,_){if(M){if(A!==q0){A.stat(I,(E,p)=>{if(E)return k(M);u(null,p)});return}return k(M)}B=_.size,Q.open(J,"w",(E,p)=>{if(E)return k(E);if(v=p,B<=0)return k();while(o>B){if(X===1){o=B;break}o-=C,--X}if(P=Nz(o),P instanceof Error)return k(P);if(Y!==void 0)Q.fchmod(v,Y,function JA(IA){if(IA){Q.chmod(J,Y,(L)=>JA());return}n()});else n();function S(JA,IA,L,g,b,d){if(JA)return k(JA);b=b||0,Q.write(v,P,b,IA,g,FA);function FA(BA){if(BA)return k(BA);if(D+=IA,Z&&Z(D,IA,B),IA<d)return AA(b,g+IA,d-IA);if(D===B){Q.close(v,(LA)=>{if(v=void 0,LA)return k(LA);A.close(N,(QQ)=>{if(N=void 0,QQ)return k(QQ);G()})});return}if(q>=B)return;let UA=q+C>B?B-q:C;AA(b,q,UA),q+=UA}}function QA(JA,IA,L){return(g,b,d)=>{S(g,b,d,IA,JA,L)}}function AA(JA,IA,L){A.read(N,P,JA,L,IA,QA(JA,IA,L))}function n(){let JA=0,IA=0;while(q<B&&JA<X){let L=q+C>B?B-q:C;AA(IA,q,L),IA+=L,q+=L,++JA}}})}})}function g$(A,Q,I,J,$,G,X){let C=typeof X==="function"?X:void 0;A.write(Q,I,J,$,G,(Z,Y)=>{if(Z)return A.close(Q,()=>{C&&C(Z)});if(Y===$)A.close(Q,C);else J+=Y,$-=Y,G+=Y,g$(A,Q,I,J,$,G,C)})}class h${constructor(A){this.mode=A&&A.mode,this.uid=A&&A.uid,this.gid=A&&A.gid,this.size=A&&A.size,this.atime=A&&A.atime,this.mtime=A&&A.mtime,this.extended=A&&A.extended}isDirectory(){return(this.mode&gQ.S_IFMT)===gQ.S_IFDIR}isFile(){return(this.mode&gQ.S_IFMT)===gQ.S_IFREG}isBlockDevice(){return(this.mode&gQ.S_IFMT)===gQ.S_IFBLK}isCharacterDevice(){return(this.mode&gQ.S_IFMT)===gQ.S_IFCHR}isSymbolicLink(){return(this.mode&gQ.S_IFMT)===gQ.S_IFLNK}isFIFO(){return(this.mode&gQ.S_IFMT)===gQ.S_IFIFO}isSocket(){return(this.mode&gQ.S_IFMT)===gQ.S_IFSOCK}}function O0(A){let Q=0,I=0;if(typeof A==="object"&&A!==null){if(typeof A.size==="number"){Q|=X0.SIZE;let J=A.size;TA[I++]=J/72057594037927940,TA[I++]=J/281474976710656,TA[I++]=J/1099511627776,TA[I++]=J/4294967296,TA[I++]=J/16777216,TA[I++]=J/65536,TA[I++]=J/256,TA[I++]=J}if(typeof A.uid==="number"&&typeof A.gid==="number"){Q|=X0.UIDGID;let{uid:J,gid:$}=A;TA[I++]=J>>>24,TA[I++]=J>>>16,TA[I++]=J>>>8,TA[I++]=J,TA[I++]=$>>>24,TA[I++]=$>>>16,TA[I++]=$>>>8,TA[I++]=$}if(typeof A.mode==="number"||typeof A.mode==="string"){let J=u$(A.mode);Q|=X0.PERMISSIONS,TA[I++]=J>>>24,TA[I++]=J>>>16,TA[I++]=J>>>8,TA[I++]=J}if((typeof A.atime==="number"||E$(A.atime))&&(typeof A.mtime==="number"||E$(A.mtime))){let J=n0(A.atime),$=n0(A.mtime);Q|=X0.ACMODTIME,TA[I++]=J>>>24,TA[I++]=J>>>16,TA[I++]=J>>>8,TA[I++]=J,TA[I++]=$>>>24,TA[I++]=$>>>16,TA[I++]=$>>>8,TA[I++]=$}}return{flags:Q,nb:I}}function n0(A){if(typeof A==="number"&&A===A)return A;if(E$(A))return parseInt(A.getTime()/1000,10);throw new Error(`Cannot parse time: ${A}`)}function u$(A){if(typeof A==="number"&&A===A)return A;if(typeof A==="string")return u$(parseInt(A,8));throw new Error(`Cannot parse mode: ${A}`)}var S$={r:KA.READ,"r+":KA.READ|KA.WRITE,w:KA.TRUNC|KA.CREAT|KA.WRITE,wx:KA.TRUNC|KA.CREAT|KA.WRITE|KA.EXCL,xw:KA.TRUNC|KA.CREAT|KA.WRITE|KA.EXCL,"w+":KA.TRUNC|KA.CREAT|KA.READ|KA.WRITE,"wx+":KA.TRUNC|KA.CREAT|KA.READ|KA.WRITE|KA.EXCL,"xw+":KA.TRUNC|KA.CREAT|KA.READ|KA.WRITE|KA.EXCL,a:KA.APPEND|KA.CREAT|KA.WRITE,ax:KA.APPEND|KA.CREAT|KA.WRITE|KA.EXCL,xa:KA.APPEND|KA.CREAT|KA.WRITE|KA.EXCL,"a+":KA.APPEND|KA.CREAT|KA.READ|KA.WRITE,"ax+":KA.APPEND|KA.CREAT|KA.READ|KA.WRITE|KA.EXCL,"xa+":KA.APPEND|KA.CREAT|KA.READ|KA.WRITE|KA.EXCL};function xC(A){let Q=S$[A];return Q!==void 0?Q:null}var Rz=(()=>{let A=Object.keys(S$);return(Q)=>{for(let I=0;I<A.length;++I){let J=A[I];if(S$[J]===Q)return J}return null}})();function s0(A){let Q=O.readUInt32BE();if(Q===void 0)return;let I=new h$;if(Q&X0.SIZE){let J=O.readUInt64BE(A);if(J===void 0)return;I.size=J}if(Q&X0.UIDGID){let J=O.readUInt32BE(),$=O.readUInt32BE();if($===void 0)return;I.uid=J,I.gid=$}if(Q&X0.PERMISSIONS){let J=O.readUInt32BE();if(J===void 0)return;I.mode=J}if(Q&X0.ACMODTIME){let J=O.readUInt32BE(),$=O.readUInt32BE();if($===void 0)return;I.atime=J,I.mtime=$}if(Q&X0.EXTENDED){let J=O.readUInt32BE();if(J===void 0)return;let $={};for(let G=0;G<J;++G){let X=O.readString(!0),C=O.readString();if(C===void 0)return;$[X]=C}I.extended=$}return I}function oA(A,Q){let I=vC(A,Q);if(I!==void 0)return A._buffer.push(I),!1;return!0}function vC(A,Q){let I=A.outgoing;if(I.state!=="open")return;if(I.window===0)return A._waitWindow=!0,A._chunkcb=NC,Q;let J,$=Q.length,G=0;while($-G>0&&I.window>0){let X=Math.min($-G,I.window,I.packetSize);if(I.window-=X,I.window===0)A._waitWindow=!0,A._chunkcb=NC;if(G===0&&X===$)A._protocol.channelData(A.outgoing.id,Q);else A._protocol.channelData(A.outgoing.id,r0(Q,G,G+X));G+=X}if($-G>0)if(G>0)J=r0(Q,G,$);else J=Q;return J}function NC(){this._chunkcb=void 0;let A=this._buffer,Q=0;while(Q<A.length){let I=A[Q],J=vC(this,I);if(J!==void 0){if(J!==I)A[Q]=J;if(Q>0)this._buffer=A.slice(Q);return}++Q}if(Q>0)this._buffer=[]}function eA(A,Q,I){let J=new Error(Q);if(J.level="sftp-protocol",!I&&A._debug)A._debug(`SFTP: Inbound: ${Q}`);return A.emit("error",J),A.destroy(),PC(A),!1}function PC(A){let Q=Object.keys(A._requests);if(Q.length===0)return;let I=A._requests;A._requests={};let J=new Error("No response from server");for(let $=0;$<Q.length;++$){let G=I[Q[$]];if(typeof G.cb==="function")G.cb(J)}}function Mz(A,Q){let I=9,J=Buffer.allocUnsafe(31);h(J,J.length-4,0),J[4]=MA.EXTENDED;let $=A._writeReqid=A._writeReqid+1&4294967295;h(J,$,5),h(J,18,I),J.utf8Write("[email protected]",I+=4,18),A._requests[$]={extended:"[email protected]",cb:Q};let G=oA(A,J);if(A._debug){let X=G?"Buffered":"Sending";A._debug(`SFTP: Outbound: ${X} [email protected]`)}}var Uz={[SQ.VERSION]:(A,Q)=>{if(A._version!==-1)return eA(A,"Duplicate VERSION packet");let I={};O.init(Q,1);let J=O.readUInt32BE();while(O.avail()){let $=O.readString(!0),G=O.readString(!0);if(G===void 0){J=void 0;break}I[$]=G}if(O.clear(),J===void 0)return eA(A,"Malformed VERSION packet");if(A._debug){let $=Object.keys(I);if($.length)A._debug(`SFTP: Inbound: Received VERSION (v${J}, exts:${$})`);else A._debug(`SFTP: Inbound: Received VERSION (v${J})`)}if(A._version=J,A._extensions=I,I["[email protected]"]==="1")return Mz(A,($,G)=>{if(!$){if(G.maxPktLen>0)A._maxOutPktLen=G.maxPktLen;if(G.maxReadLen>0)A._maxReadLen=G.maxReadLen;if(G.maxWriteLen>0)A._maxWriteLen=G.maxWriteLen;A.maxOpenHandles=G.maxOpenHandles>0?G.maxOpenHandles:1/0}A.emit("ready")});A.emit("ready")},[SQ.STATUS]:(A,Q)=>{O.init(Q,1);let I=O.readUInt32BE(),J=O.readUInt32BE(),$=O.readString(!0);if(O.clear(),A._debug){let X=JSON.stringify($);A._debug(`SFTP: Inbound: Received STATUS (id:${I}, ${J}, ${X})`)}let G=A._requests[I];if(delete A._requests[I],G&&typeof G.cb==="function"){if(J===sA.OK){G.cb();return}let X=new Error($||Hz[J]||"Unknown status");X.code=J,G.cb(X)}},[SQ.HANDLE]:(A,Q)=>{O.init(Q,1);let I=O.readUInt32BE(),J=O.readString();if(O.clear(),J===void 0){if(I!==void 0)delete A._requests[I];return eA(A,"Malformed HANDLE packet")}A._debug&&A._debug(`SFTP: Inbound: Received HANDLE (id:${I})`);let $=A._requests[I];if(delete A._requests[I],$&&typeof $.cb==="function")$.cb(void 0,J)},[SQ.DATA]:(A,Q)=>{O.init(Q,1);let I=O.readUInt32BE(),J;if(I!==void 0)J=A._requests[I],delete A._requests[I];if(J&&typeof J.cb==="function")if(J.buffer){let $=O.readString(J.buffer);if(O.clear(),$!==void 0){A._debug&&A._debug(`SFTP: Inbound: Received DATA (id:${I}, ${$})`),J.cb(void 0,J.buffer,$);return}}else{let $=O.readString();if(O.clear(),$!==void 0){A._debug&&A._debug(`SFTP: Inbound: Received DATA (id:${I}, ${$.length})`),J.cb(void 0,$);return}}else{let $=O.skipString();if(O.clear(),$!==void 0){A._debug&&A._debug(`SFTP: Inbound: Received DATA (id:${I}, ${$})`);return}}return eA(A,"Malformed DATA packet")},[SQ.NAME]:(A,Q)=>{O.init(Q,1);let I=O.readUInt32BE(),J;if(I!==void 0)J=A._requests[I],delete A._requests[I];let $=O.readUInt32BE();if($!==void 0){let G=[];for(let X=0;X<$;++X){let C=O.readString(!0),Z=O.readString(!0),Y=s0(A._biOpt);if(Y===void 0){G=void 0;break}G.push({filename:C,longname:Z,attrs:Y})}if(G!==void 0){if(A._debug&&A._debug(`SFTP: Inbound: Received NAME (id:${I}, ${G.length})`),O.clear(),J&&typeof J.cb==="function")J.cb(void 0,G);return}}return O.clear(),eA(A,"Malformed NAME packet")},[SQ.ATTRS]:(A,Q)=>{O.init(Q,1);let I=O.readUInt32BE(),J;if(I!==void 0)J=A._requests[I],delete A._requests[I];let $=s0(A._biOpt);if(O.clear(),$!==void 0){if(A._debug&&A._debug(`SFTP: Inbound: Received ATTRS (id:${I})`),J&&typeof J.cb==="function")J.cb(void 0,$);return}return eA(A,"Malformed ATTRS packet")},[SQ.EXTENDED]:(A,Q)=>{O.init(Q,1);let I=O.readUInt32BE();if(I!==void 0){let J=A._requests[I];if(J)switch(delete A._requests[I],J.extended){case"[email protected]":case"[email protected]":{let $=A._biOpt,G={f_bsize:O.readUInt64BE($),f_frsize:O.readUInt64BE($),f_blocks:O.readUInt64BE($),f_bfree:O.readUInt64BE($),f_bavail:O.readUInt64BE($),f_files:O.readUInt64BE($),f_ffree:O.readUInt64BE($),f_favail:O.readUInt64BE($),f_sid:O.readUInt64BE($),f_flag:O.readUInt64BE($),f_namemax:O.readUInt64BE($)};if(G.f_namemax===void 0)break;if(A._debug)A._debug(`SFTP: Inbound: Received EXTENDED_REPLY (id:${I}, ${J.extended})`);if(O.clear(),typeof J.cb==="function")J.cb(void 0,G);return}case"[email protected]":{let $={maxPktLen:O.readUInt64BE(),maxReadLen:O.readUInt64BE(),maxWriteLen:O.readUInt64BE(),maxOpenHandles:O.readUInt64BE()};if($.maxOpenHandles===void 0)break;if(A._debug)A._debug(`SFTP: Inbound: Received EXTENDED_REPLY (id:${I}, ${J.extended})`);if(O.clear(),typeof J.cb==="function")J.cb(void 0,$);return}case"[email protected]":{let $=O.readUInt32BE();if($===void 0)break;let G=new Array($);for(let Z=0;Z<G.length;++Z)G[Z]=O.readString(!0);let X=O.readUInt32BE();if(X===void 0)break;let C=new Array(X);for(let Z=0;Z<C.length;++Z)C[Z]=O.readString(!0);if(C.length>0&&C[C.length-1]===void 0)break;if(A._debug)A._debug(`SFTP: Inbound: Received EXTENDED_REPLY (id:${I}, ${J.extended})`);if(O.clear(),typeof J.cb==="function")J.cb(void 0,G,C);return}default:if(A._debug&&A._debug(`SFTP: Inbound: Received EXTENDED_REPLY (id:${I}, ???)`),O.clear(),typeof J.cb==="function")J.cb();return}else{A._debug&&A._debug(`SFTP: Inbound: Received EXTENDED_REPLY (id:${I}, ???)`),O.clear();return}}return O.clear(),eA(A,"Malformed EXTENDED_REPLY packet")}},wz={[MA.INIT]:(A,Q)=>{if(A._version!==-1)return eA(A,"Duplicate INIT packet");let I={};O.init(Q,1);let J=O.readUInt32BE();while(O.avail()){let $=O.readString(!0),G=O.readString(!0);if(G===void 0){J=void 0;break}I[$]=G}if(O.clear(),J===void 0)return eA(A,"Malformed INIT packet");if(A._debug){let $=Object.keys(I);if($.length)A._debug(`SFTP: Inbound: Received INIT (v${J}, exts:${$})`);else A._debug(`SFTP: Inbound: Received INIT (v${J})`)}oA(A,qz),A._version=J,A._extensions=I,A.emit("ready")},[MA.OPEN]:(A,Q)=>{O.init(Q,1);let I=O.readUInt32BE(),J=O.readString(!0),$=O.readUInt32BE(),G=s0(A._biOpt);if(O.clear(),G===void 0)return eA(A,"Malformed OPEN packet");if(A._debug&&A._debug(`SFTP: Inbound: Received OPEN (id:${I})`),!A.emit("OPEN",I,J,$,G))A.status(I,sA.OP_UNSUPPORTED)},[MA.CLOSE]:(A,Q)=>{O.init(Q,1);let I=O.readUInt32BE(),J=O.readString();if(O.clear(),J===void 0||J.length>256)return eA(A,"Malformed CLOSE packet");if(A._debug&&A._debug(`SFTP: Inbound: Received CLOSE (id:${I})`),!A.emit("CLOSE",I,J))A.status(I,sA.OP_UNSUPPORTED)},[MA.READ]:(A,Q)=>{O.init(Q,1);let I=O.readUInt32BE(),J=O.readString(),$=O.readUInt64BE(A._biOpt),G=O.readUInt32BE();if(O.clear(),G===void 0||J.length>256)return eA(A,"Malformed READ packet");if(A._debug&&A._debug(`SFTP: Inbound: Received READ (id:${I})`),!A.emit("READ",I,J,$,G))A.status(I,sA.OP_UNSUPPORTED)},[MA.WRITE]:(A,Q)=>{O.init(Q,1);let I=O.readUInt32BE(),J=O.readString(),$=O.readUInt64BE(A._biOpt),G=O.readString();if(O.clear(),G===void 0||J.length>256)return eA(A,"Malformed WRITE packet");if(A._debug&&A._debug(`SFTP: Inbound: Received WRITE (id:${I})`),!A.emit("WRITE",I,J,$,G))A.status(I,sA.OP_UNSUPPORTED)},[MA.LSTAT]:(A,Q)=>{O.init(Q,1);let I=O.readUInt32BE(),J=O.readString(!0);if(O.clear(),J===void 0)return eA(A,"Malformed LSTAT packet");if(A._debug&&A._debug(`SFTP: Inbound: Received LSTAT (id:${I})`),!A.emit("LSTAT",I,J))A.status(I,sA.OP_UNSUPPORTED)},[MA.FSTAT]:(A,Q)=>{O.init(Q,1);let I=O.readUInt32BE(),J=O.readString();if(O.clear(),J===void 0||J.length>256)return eA(A,"Malformed FSTAT packet");if(A._debug&&A._debug(`SFTP: Inbound: Received FSTAT (id:${I})`),!A.emit("FSTAT",I,J))A.status(I,sA.OP_UNSUPPORTED)},[MA.SETSTAT]:(A,Q)=>{O.init(Q,1);let I=O.readUInt32BE(),J=O.readString(!0),$=s0(A._biOpt);if(O.clear(),$===void 0)return eA(A,"Malformed SETSTAT packet");if(A._debug&&A._debug(`SFTP: Inbound: Received SETSTAT (id:${I})`),!A.emit("SETSTAT",I,J,$))A.status(I,sA.OP_UNSUPPORTED)},[MA.FSETSTAT]:(A,Q)=>{O.init(Q,1);let I=O.readUInt32BE(),J=O.readString(),$=s0(A._biOpt);if(O.clear(),$===void 0||J.length>256)return eA(A,"Malformed FSETSTAT packet");if(A._debug&&A._debug(`SFTP: Inbound: Received FSETSTAT (id:${I})`),!A.emit("FSETSTAT",I,J,$))A.status(I,sA.OP_UNSUPPORTED)},[MA.OPENDIR]:(A,Q)=>{O.init(Q,1);let I=O.readUInt32BE(),J=O.readString(!0);if(O.clear(),J===void 0)return eA(A,"Malformed OPENDIR packet");if(A._debug&&A._debug(`SFTP: Inbound: Received OPENDIR (id:${I})`),!A.emit("OPENDIR",I,J))A.status(I,sA.OP_UNSUPPORTED)},[MA.READDIR]:(A,Q)=>{O.init(Q,1);let I=O.readUInt32BE(),J=O.readString();if(O.clear(),J===void 0||J.length>256)return eA(A,"Malformed READDIR packet");if(A._debug&&A._debug(`SFTP: Inbound: Received READDIR (id:${I})`),!A.emit("READDIR",I,J))A.status(I,sA.OP_UNSUPPORTED)},[MA.REMOVE]:(A,Q)=>{O.init(Q,1);let I=O.readUInt32BE(),J=O.readString(!0);if(O.clear(),J===void 0)return eA(A,"Malformed REMOVE packet");if(A._debug&&A._debug(`SFTP: Inbound: Received REMOVE (id:${I})`),!A.emit("REMOVE",I,J))A.status(I,sA.OP_UNSUPPORTED)},[MA.MKDIR]:(A,Q)=>{O.init(Q,1);let I=O.readUInt32BE(),J=O.readString(!0),$=s0(A._biOpt);if(O.clear(),$===void 0)return eA(A,"Malformed MKDIR packet");if(A._debug&&A._debug(`SFTP: Inbound: Received MKDIR (id:${I})`),!A.emit("MKDIR",I,J,$))A.status(I,sA.OP_UNSUPPORTED)},[MA.RMDIR]:(A,Q)=>{O.init(Q,1);let I=O.readUInt32BE(),J=O.readString(!0);if(O.clear(),J===void 0)return eA(A,"Malformed RMDIR packet");if(A._debug&&A._debug(`SFTP: Inbound: Received RMDIR (id:${I})`),!A.emit("RMDIR",I,J))A.status(I,sA.OP_UNSUPPORTED)},[MA.REALPATH]:(A,Q)=>{O.init(Q,1);let I=O.readUInt32BE(),J=O.readString(!0);if(O.clear(),J===void 0)return eA(A,"Malformed REALPATH packet");if(A._debug&&A._debug(`SFTP: Inbound: Received REALPATH (id:${I})`),!A.emit("REALPATH",I,J))A.status(I,sA.OP_UNSUPPORTED)},[MA.STAT]:(A,Q)=>{O.init(Q,1);let I=O.readUInt32BE(),J=O.readString(!0);if(O.clear(),J===void 0)return eA(A,"Malformed STAT packet");if(A._debug&&A._debug(`SFTP: Inbound: Received STAT (id:${I})`),!A.emit("STAT",I,J))A.status(I,sA.OP_UNSUPPORTED)},[MA.RENAME]:(A,Q)=>{O.init(Q,1);let I=O.readUInt32BE(),J=O.readString(!0),$=O.readString(!0);if(O.clear(),$===void 0)return eA(A,"Malformed RENAME packet");if(A._debug&&A._debug(`SFTP: Inbound: Received RENAME (id:${I})`),!A.emit("RENAME",I,J,$))A.status(I,sA.OP_UNSUPPORTED)},[MA.READLINK]:(A,Q)=>{O.init(Q,1);let I=O.readUInt32BE(),J=O.readString(!0);if(O.clear(),J===void 0)return eA(A,"Malformed READLINK packet");if(A._debug&&A._debug(`SFTP: Inbound: Received READLINK (id:${I})`),!A.emit("READLINK",I,J))A.status(I,sA.OP_UNSUPPORTED)},[MA.SYMLINK]:(A,Q)=>{O.init(Q,1);let I=O.readUInt32BE(),J=O.readString(!0),$=O.readString(!0);if(O.clear(),$===void 0)return eA(A,"Malformed SYMLINK packet");A._debug&&A._debug(`SFTP: Inbound: Received SYMLINK (id:${I})`);let G;if(A._isOpenSSH)G=A.emit("SYMLINK",I,$,J);else G=A.emit("SYMLINK",I,J,$);if(!G)A.status(I,sA.OP_UNSUPPORTED)},[MA.EXTENDED]:(A,Q)=>{O.init(Q,1);let I=O.readUInt32BE(),J=O.readString(!0);if(J===void 0)return O.clear(),eA(A,"Malformed EXTENDED packet");let $;if(O.avail())$=O.readRaw();if(O.clear(),A._debug&&A._debug(`SFTP: Inbound: Received EXTENDED (id:${I})`),!A.emit("EXTENDED",I,J,$))A.status(I,sA.OP_UNSUPPORTED)}},{ERR_INVALID_ARG_TYPE:Tz,ERR_OUT_OF_RANGE:NJ,validateNumber:Oz}=DC(),RC=128,PQ,k$=[];function Lz(A){if(k$.length>0)PQ=k$.pop();else PQ=Buffer.allocUnsafe(A);PQ.used=0}function y$(A,Q){if(!Number.isSafeInteger(A)){if(Oz(A,Q),!Number.isInteger(A))throw new NJ(Q,"an integer",A);throw new NJ(Q,">= 0 and <= 2 ** 53 - 1",A)}if(A<0)throw new NJ(Q,">= 0 and <= 2 ** 53 - 1",A)}function _$(A){return A+7&-8}function C0(A,Q,I){if(I===void 0)I={};else if(typeof I==="string")I={encoding:I};else if(I===null||typeof I!=="object")throw new TypeError('"options" argument must be a string or an object');else I=Object.create(I);if(I.highWaterMark===void 0)I.highWaterMark=65536;if(I.emitClose=!1,I.autoDestroy=!1,UC.call(this,I),this.path=Q,this.flags=I.flags===void 0?"r":I.flags,this.mode=I.mode===void 0?438:I.mode,this.start=I.start,this.end=I.end,this.autoClose=I.autoClose===void 0?!0:I.autoClose,this.pos=0,this.bytesRead=0,this.isClosed=!1,this.handle=I.handle===void 0?null:I.handle,this.sftp=A,this._opening=!1,this.start!==void 0)y$(this.start,"start"),this.pos=this.start;if(this.end===void 0)this.end=1/0;else if(this.end!==1/0){if(y$(this.end,"end"),this.start!==void 0&&this.start>this.end)throw new NJ("start",`<= "end" (here: ${this.end})`,this.start)}if(this.on("end",function(){if(this.autoClose)this.destroy()}),!Buffer.isBuffer(this.handle))this.open()}wC(C0,UC);C0.prototype.open=function(){if(this._opening)return;this._opening=!0,this.sftp.open(this.path,this.flags,this.mode,(A,Q)=>{if(this._opening=!1,A){if(this.emit("error",A),this.autoClose)this.destroy();return}this.handle=Q,this.emit("open",Q),this.emit("ready"),this.read()})};C0.prototype._read=function(A){if(!Buffer.isBuffer(this.handle))return this.once("open",()=>this._read(A));if(this.destroyed)return;if(!PQ||PQ.length-PQ.used<RC)Lz(this.readableHighWaterMark||this._readableState.highWaterMark);let Q=PQ,I=Math.min(PQ.length-PQ.used,A),J=PQ.used;if(this.end!==void 0)I=Math.min(this.end-this.pos+1,I);if(I<=0)return this.push(null);this.sftp.read(this.handle,PQ,PQ.used,I,this.pos,($,G)=>{if($){if(this.emit("error",$),this.autoClose)this.destroy();return}let X=null;if(J+I===Q.used&&Q===PQ)Q.used=_$(Q.used+G-I);else{let C=J+I&-8,Z=_$(J+G);if(C-Z>=RC)k$.push(Q.slice(Z,C))}if(G>0)this.bytesRead+=G,X=Q.slice(J,J+G);this.pos+=G,this.push(X)}),PQ.used=_$(PQ.used+I)};C0.prototype._destroy=function(A,Q){if(this._opening&&!Buffer.isBuffer(this.handle)){this.once("open",MC.bind(null,this,Q,A));return}MC(this,Q,A),this.handle=null,this._opening=!1};function MC(A,Q,I){if(!A.handle)return J();A.sftp.close(A.handle,J);function J($){if($=$||I,Q($),A.isClosed=!0,!$)A.emit("close")}}C0.prototype.close=function(A){this.destroy(null,A)};Object.defineProperty(C0.prototype,"pending",{get(){return this.handle===null},configurable:!0});function dQ(A,Q,I){if(I===void 0)I={};else if(typeof I==="string")I={encoding:I};else if(I===null||typeof I!=="object")throw new TypeError('"options" argument must be a string or an object');else I=Object.create(I);if(I.emitClose=!1,I.autoDestroy=!1,m$.call(this,I),this.path=Q,this.flags=I.flags===void 0?"w":I.flags,this.mode=I.mode===void 0?438:I.mode,this.start=I.start,this.autoClose=I.autoClose===void 0?!0:I.autoClose,this.pos=0,this.bytesWritten=0,this.isClosed=!1,this.handle=I.handle===void 0?null:I.handle,this.sftp=A,this._opening=!1,this.start!==void 0)y$(this.start,"start"),this.pos=this.start;if(I.encoding)this.setDefaultEncoding(I.encoding);if(this.on("finish",function(){if(this._writableState.finalCalled)return;if(this.autoClose)this.destroy()}),!Buffer.isBuffer(this.handle))this.open()}wC(dQ,m$);dQ.prototype._final=function(A){if(this.autoClose)this.destroy();A()};dQ.prototype.open=function(){if(this._opening)return;this._opening=!0,this.sftp.open(this.path,this.flags,this.mode,(A,Q)=>{if(this._opening=!1,A){if(this.emit("error",A),this.autoClose)this.destroy();return}this.handle=Q;let I=(J)=>{if(J){this.sftp.chmod(this.path,this.mode,($)=>I());return}if(this.flags[0]==="a"){let $=(G,X)=>{if(G){this.sftp.stat(this.path,(C,Z)=>{if(C){this.destroy(),this.emit("error",G);return}$(null,Z)});return}this.pos=X.size,this.emit("open",Q),this.emit("ready")};this.sftp.fstat(Q,$);return}this.emit("open",Q),this.emit("ready")};this.sftp.fchmod(Q,this.mode,I)})};dQ.prototype._write=function(A,Q,I){if(!Buffer.isBuffer(A)){let J=new Tz("data","Buffer",A);return this.emit("error",J)}if(!Buffer.isBuffer(this.handle))return this.once("open",function(){this._write(A,Q,I)});this.sftp.write(this.handle,A,0,A.length,this.pos,(J,$)=>{if(J){if(this.autoClose)this.destroy();return I(J)}this.bytesWritten+=$,I()}),this.pos+=A.length};dQ.prototype._writev=function(A,Q){if(!Buffer.isBuffer(this.handle))return this.once("open",function(){this._writev(A,Q)});let I=this.sftp,J=this.handle,$=A.length,G=(X,C)=>{if(X)return this.destroy(),Q(X);if(this.bytesWritten+=C,--$===0)Q()};for(let X=0;X<A.length;++X){let C=A[X].chunk;I.write(J,C,0,C.length,this.pos,G),this.pos+=C.length}};if(typeof m$.prototype.destroy!=="function")dQ.prototype.destroy=C0.prototype.destroy;dQ.prototype._destroy=C0.prototype._destroy;dQ.prototype.close=function(A){if(A){if(this.isClosed){process.nextTick(A);return}this.on("close",A)}if(!this.autoClose)this.on("finish",this.destroy.bind(this));this.end()};dQ.prototype.destroySoon=dQ.prototype.end;Object.defineProperty(dQ.prototype,"pending",{get(){return this.handle===null},configurable:!0});_C.exports={flagsToString:Rz,OPEN_MODE:KA,SFTP:OC,Stats:h$,STATUS_CODE:sA,stringToFlags:xC}});var f$=cA((oY,hC)=>{var{Duplex:xz,Readable:vz,Writable:Pz}=EA("stream"),{CHANNEL_EXTENDED_DATATYPE:{STDERR:EC}}=J0(),{bufferSlice:RJ}=iQ();class kC extends vz{constructor(A,Q){super(Q);this._channel=A}_read(A){if(this._channel._waitChanDrain){if(this._channel._waitChanDrain=!1,this._channel.incoming.window<=1048576)b$(this._channel)}}}class yC extends Pz{constructor(A){super({highWaterMark:2097152});this._channel=A}_write(A,Q,I){let J=this._channel,$=J._client._protocol,G=J.outgoing,X=G.packetSize,C=G.id,Z=G.window,Y=A.length,z=0;if(G.state!=="open")return;while(Y-z>0&&Z>0){let B=Y-z;if(B>Z)B=Z;if(B>X)B=X;if(z===0&&B===Y)$.channelExtData(C,A,EC);else $.channelExtData(C,RJ(A,z,z+B),EC);z+=B,Z-=B}if(G.window=Z,Y-z>0){if(Z===0)J._waitWindow=!0;if(z>0)J._chunkErr=RJ(A,z,Y);else J._chunkErr=A;J._chunkcbErr=I;return}I()}}class mC extends xz{constructor(A,Q,I){let J={highWaterMark:2097152,allowHalfOpen:!I||I&&I.allowHalfOpen!==!1,emitClose:!1};super(J);this.allowHalfOpen=J.allowHalfOpen;let $=!!(I&&I.server);if(this.server=$,this.type=Q.type,this.subtype=void 0,this.incoming=Q.incoming,this.outgoing=Q.outgoing,this._callbacks=[],this._client=A,this._hasX11=!1,this._exit={code:void 0,signal:void 0,dump:void 0,desc:void 0},this.stdin=this.stdout=this,$)this.stderr=new yC(this);else this.stderr=new kC(this,J);this._waitWindow=!1,this._waitChanDrain=!1,this._chunk=void 0,this._chunkcb=void 0,this._chunkErr=void 0,this._chunkcbErr=void 0,this.on("finish",gC).on("prefinish",gC),this.on("end",SC).on("close",SC)}_read(A){if(this._waitChanDrain){if(this._waitChanDrain=!1,this.incoming.window<=1048576)b$(this)}}_write(A,Q,I){let J=this._client._protocol,$=this.outgoing,G=$.packetSize,X=$.id,C=$.window,Z=A.length,Y=0;if($.state!=="open")return;while(Z-Y>0&&C>0){let z=Z-Y;if(z>C)z=C;if(z>G)z=G;if(Y===0&&z===Z)J.channelData(X,A);else J.channelData(X,RJ(A,Y,Y+z));Y+=z,C-=z}if($.window=C,Z-Y>0){if(C===0)this._waitWindow=!0;if(Y>0)this._chunk=RJ(A,Y,Z);else this._chunk=A;this._chunkcb=I;return}I()}eof(){if(this.outgoing.state==="open")this.outgoing.state="eof",this._client._protocol.channelEOF(this.outgoing.id)}close(){if(this.outgoing.state==="open"||this.outgoing.state==="eof")this.outgoing.state="closing",this._client._protocol.channelClose(this.outgoing.id)}destroy(){return this.end(),this.close(),this}setWindow(A,Q,I,J){if(this.server)throw new Error("Client-only method called in server mode");if(this.type==="session"&&(this.subtype==="shell"||this.subtype==="exec")&&this.writable&&this.outgoing.state==="open")this._client._protocol.windowChange(this.outgoing.id,A,Q,I,J)}signal(A){if(this.server)throw new Error("Client-only method called in server mode");if(this.type==="session"&&this.writable&&this.outgoing.state==="open")this._client._protocol.signal(this.outgoing.id,A)}exit(A,Q,I){if(!this.server)throw new Error("Server-only method called in client mode");if(this.type==="session"&&this.writable&&this.outgoing.state==="open")if(typeof A==="number")this._client._protocol.exitStatus(this.outgoing.id,A);else this._client._protocol.exitSignal(this.outgoing.id,A,Q,I)}}function gC(){if(this.eof(),this.server||!this.allowHalfOpen)this.close();this.writable=!1}function SC(){this.readable=!1}function b$(A){if(A.outgoing.state==="closed")return;let Q=2097152-A.incoming.window;if(Q<=0)return;A.incoming.window+=Q,A._client._protocol.channelWindowAdjust(A.outgoing.id,Q)}hC.exports={Channel:mC,MAX_WINDOW:2097152,PACKET_SIZE:32768,windowAdjust:b$,WINDOW_THRESHOLD:1048576}});var l$=cA((pY,dC)=>{var{SFTP:_z}=vI();function uC(A,Q,I,J){if(A._chanMgr.remove(Q),typeof J!=="function")return;let $;if(I instanceof Error)$=I;else if(typeof I==="object"&&I!==null)$=new Error(`(SSH) Channel open failure: ${I.description}`),$.reason=I.reason;else $=new Error("(SSH) Channel open failure: server closed channel unexpectedly"),$.reason="";J($)}function bC(A,Q,I,J,$){if(typeof I==="function"){uC(A,Q,J,I);return}if(typeof I!=="object"||I===null)return;if(I.incoming&&I.incoming.state==="closed")return;if(A._chanMgr.remove(Q),I.server&&I.constructor.name==="Session")return;if(I.incoming.state="closed",I.readable)I.push(null);if(I.server){if(I.stderr.writable)I.stderr.end()}else if(I.stderr.readable)I.stderr.push(null);if(I.constructor!==_z&&(I.outgoing.state==="open"||I.outgoing.state==="eof")&&!$)I.close();if(I.outgoing.state==="closing")I.outgoing.state="closed";let{_readableState:G,_writableState:X}=I;if(X&&!X.ending&&!X.finished&&!$)I.end();let C=I._callbacks;I._callbacks=[];for(let Z=0;Z<C.length;++Z)C[Z](!0);if(I.server)if(!I.readable||I.destroyed||G&&G.endEmitted)I.emit("close");else I.once("end",()=>I.emit("close"));else{let Z;switch(I.type){case"[email protected]":case"direct-tcpip":Z=()=>I.emit("close");break;default:{let z=I._exit;Z=()=>{if(z.code===null)I.emit("close",z.code,z.signal,z.dump,z.desc);else I.emit("close",z.code)}}}if(!I.readable||I.destroyed||G&&G.endEmitted)Z();else I.once("end",Z);let Y=I.stderr._readableState;if(!I.stderr.readable||I.stderr.destroyed||Y&&Y.endEmitted)I.stderr.emit("close");else I.stderr.once("end",()=>I.stderr.emit("close"))}}class fC{constructor(A){this._client=A,this._channels={},this._cur=-1,this._count=0}add(A){let Q;if(this._cur<4294967295)Q=++this._cur;else if(this._count===0)this._cur=0,Q=0;else{let I=this._channels;for(let J=0;J<4294967295;++J)if(I[J]===void 0){Q=J;break}}if(Q===void 0)return-1;return this._channels[Q]=A||!0,++this._count,Q}update(A,Q){if(typeof A!=="number"||A<0||A>=4294967295||!isFinite(A))throw new Error(`Invalid channel id: ${A}`);if(Q&&this._channels[A])this._channels[A]=Q}get(A){if(typeof A!=="number"||A<0||A>=4294967295||!isFinite(A))throw new Error(`Invalid channel id: ${A}`);return this._channels[A]}remove(A){if(typeof A!=="number"||A<0||A>=4294967295||!isFinite(A))throw new Error(`Invalid channel id: ${A}`);if(this._channels[A]){if(delete this._channels[A],this._count)--this._count}}cleanup(A){let Q=this._channels;this._channels={},this._cur=-1,this._count=0;let I=Object.keys(Q),J=this._client;for(let $=0;$<I.length;++$){let G=+I[$],X=Q[G];bC(J,G,X._channel||X,A,!0)}}}var d$=(()=>{let A=Object.prototype.toString;return(Q)=>A.call(Q)==="[object RegExp]"})();function Ez(A,Q,I){if(Array.isArray(A)&&A.length>0){for(let J=0;J<A.length;++J)if(I.indexOf(A[J])===-1)throw new Error(`Unsupported algorithm: ${A[J]}`);return A}if(typeof A==="object"&&A!==null){let J=Object.keys(A),$=Q;for(let G=0;G<J.length;++G){let X=J[G],C=A[X];switch(X){case"append":if(!Array.isArray(C))C=[C];if(Array.isArray(C))for(let Z=0;Z<C.length;++Z){let Y=C[Z];if(typeof Y==="string"){if(!Y||$.indexOf(Y)!==-1)continue;if(I.indexOf(Y)===-1)throw new Error(`Unsupported algorithm: ${Y}`);if($===Q)$=$.slice();$.push(Y)}else if(d$(Y))for(let z=0;z<I.length;++z){let B=I[z];if(Y.test(B)){if($.indexOf(B)!==-1)continue;if($===Q)$=$.slice();$.push(B)}}}break;case"prepend":if(!Array.isArray(C))C=[C];if(Array.isArray(C))for(let Z=C.length;Z>=0;--Z){let Y=C[Z];if(typeof Y==="string"){if(!Y||$.indexOf(Y)!==-1)continue;if(I.indexOf(Y)===-1)throw new Error(`Unsupported algorithm: ${Y}`);if($===Q)$=$.slice();$.unshift(Y)}else if(d$(Y))for(let z=I.length;z>=0;--z){let B=I[z];if(Y.test(B)){if($.indexOf(B)!==-1)continue;if($===Q)$=$.slice();$.unshift(B)}}}break;case"remove":if(!Array.isArray(C))C=[C];if(Array.isArray(C))for(let Z=0;Z<C.length;++Z){let Y=C[Z];if(typeof Y==="string"){if(!Y)continue;let z=$.indexOf(Y);if(z===-1)continue;if($===Q)$=$.slice();$.splice(z,1)}else if(d$(Y)){for(let z=0;z<$.length;++z)if(Y.test($[z])){if($===Q)$=$.slice();$.splice(z,1),--z}}}break}}return $}return Q}dC.exports={ChannelManager:fC,generateAlgorithmList:Ez,onChannelOpenFailure:uC,onCHANNEL_CLOSE:bC,isWritable:(A)=>{return A&&A.writable&&A._readableState&&A._readableState.ended===!1}}});var p$=cA((nY,YZ)=>{var{createHash:gz,getHashes:Sz,randomFillSync:kz}=EA("crypto"),{Socket:yz}=EA("net"),{lookup:mz}=EA("dns"),hz=EA("events"),uz=Sz(),{COMPAT:CZ,CHANNEL_EXTENDED_DATATYPE:{STDERR:bz},CHANNEL_OPEN_FAILURE:PI,DEFAULT_CIPHER:lC,DEFAULT_COMPRESSION:cC,DEFAULT_KEX:iC,DEFAULT_MAC:oC,DEFAULT_SERVER_HOST_KEY:pC,DISCONNECT_REASON:nC,DISCONNECT_REASON_BY_VALUE:fz,SUPPORTED_CIPHER:dz,SUPPORTED_COMPRESSION:lz,SUPPORTED_KEX:cz,SUPPORTED_MAC:iz,SUPPORTED_SERVER_HOST_KEY:oz}=J0(),{init:pz}=j0(),nz=P$(),{parseKey:wJ}=H0(),{SFTP:sz}=vI(),{bufferCopy:sC,makeBufferParser:ZZ,makeError:rz,readUInt32BE:az,sigSSHToASN1:tz,writeUInt32BE:c$}=iQ(),{AgentContext:rC,createAgent:aC,isAgent:tC}=K$(),{Channel:VZ,MAX_WINDOW:TJ,PACKET_SIZE:OJ,windowAdjust:eC,WINDOW_THRESHOLD:AZ}=f$(),{ChannelManager:ez,generateAlgorithmList:_I,isWritable:qQ,onChannelOpenFailure:A9,onCHANNEL_CLOSE:Q9}=l$(),MJ=ZZ(),UJ=ZZ(),EI=/^OpenSSH_(?:(?![0-4])\d)|(?:\d{2,})/,o$=(A)=>{};class zZ extends hz{constructor(){super();this.config={host:void 0,port:void 0,localAddress:void 0,localPort:void 0,forceIPv4:void 0,forceIPv6:void 0,keepaliveCountMax:void 0,keepaliveInterval:void 0,readyTimeout:void 0,ident:void 0,username:void 0,password:void 0,privateKey:void 0,tryKeyboard:void 0,agent:void 0,allowAgentFwd:void 0,authHandler:void 0,hostHashAlgo:void 0,hostHashCb:void 0,strictVendor:void 0,debug:void 0},this._agent=void 0,this._readyTimeout=void 0,this._chanMgr=void 0,this._callbacks=void 0,this._forwarding=void 0,this._forwardingUnix=void 0,this._acceptX11=void 0,this._agentFwdEnabled=void 0,this._remoteVer=void 0,this._protocol=void 0,this._sock=void 0,this._resetKA=void 0}connect(A){if(this._sock&&qQ(this._sock))return this.once("close",()=>{this.connect(A)}),this.end(),this;this.config.host=A.hostname||A.host||"localhost",this.config.port=A.port||22,this.config.localAddress=typeof A.localAddress==="string"?A.localAddress:void 0,this.config.localPort=typeof A.localPort==="string"||typeof A.localPort==="number"?A.localPort:void 0,this.config.forceIPv4=A.forceIPv4||!1,this.config.forceIPv6=A.forceIPv6||!1,this.config.keepaliveCountMax=typeof A.keepaliveCountMax==="number"&&A.keepaliveCountMax>=0?A.keepaliveCountMax:3,this.config.keepaliveInterval=typeof A.keepaliveInterval==="number"&&A.keepaliveInterval>0?A.keepaliveInterval:0,this.config.readyTimeout=typeof A.readyTimeout==="number"&&A.readyTimeout>=0?A.readyTimeout:20000,this.config.ident=typeof A.ident==="string"||Buffer.isBuffer(A.ident)?A.ident:void 0;let Q={kex:void 0,serverHostKey:void 0,cs:{cipher:void 0,mac:void 0,compress:void 0,lang:[]},sc:void 0},I=!0;if(typeof A.algorithms==="object"&&A.algorithms!==null){if(Q.kex=_I(A.algorithms.kex,iC,cz),Q.kex!==iC)I=!1;if(Q.serverHostKey=_I(A.algorithms.serverHostKey,pC,oz),Q.serverHostKey!==pC)I=!1;if(Q.cs.cipher=_I(A.algorithms.cipher,lC,dz),Q.cs.cipher!==lC)I=!1;if(Q.cs.mac=_I(A.algorithms.hmac,oC,iz),Q.cs.mac!==oC)I=!1;if(Q.cs.compress=_I(A.algorithms.compress,cC,lz),Q.cs.compress!==cC)I=!1;if(!I)Q.sc=Q.cs}if(typeof A.username==="string")this.config.username=A.username;else if(typeof A.user==="string")this.config.username=A.user;else throw new Error("Invalid username");if(this.config.password=typeof A.password==="string"?A.password:void 0,this.config.privateKey=typeof A.privateKey==="string"||Buffer.isBuffer(A.privateKey)?A.privateKey:void 0,this.config.localHostname=typeof A.localHostname==="string"?A.localHostname:void 0,this.config.localUsername=typeof A.localUsername==="string"?A.localUsername:void 0,this.config.tryKeyboard=A.tryKeyboard===!0,typeof A.agent==="string"&&A.agent.length)this.config.agent=aC(A.agent);else if(tC(A.agent))this.config.agent=A.agent;else this.config.agent=void 0;this.config.allowAgentFwd=A.agentForward===!0&&this.config.agent!==void 0;let J=this.config.authHandler=typeof A.authHandler==="function"||Array.isArray(A.authHandler)?A.authHandler:void 0;this.config.strictVendor=typeof A.strictVendor==="boolean"?A.strictVendor:!0;let $=this.config.debug=typeof A.debug==="function"?A.debug:void 0;if(A.agentForward===!0&&!this.config.allowAgentFwd)throw new Error("You must set a valid agent path to allow agent forwarding");let G=this._callbacks=[];this._chanMgr=new ez(this),this._forwarding={},this._forwardingUnix={},this._acceptX11=0,this._agentFwdEnabled=!1,this._agent=this.config.agent?this.config.agent:void 0,this._remoteVer=void 0;let X;if(this.config.privateKey){if(X=wJ(this.config.privateKey,A.passphrase),X instanceof Error)throw new Error(`Cannot parse privateKey: ${X.message}`);if(Array.isArray(X))X=X[0];if(X.getPrivatePEM()===null)throw new Error("privateKey value does not contain a (valid) private key")}let C;if(typeof A.hostVerifier==="function"){let L=A.hostVerifier,g;if(uz.indexOf(A.hostHash)!==-1)g=A.hostHash;C=(b,d)=>{if(g)b=gz(g).update(b).digest("hex");let FA=L(b,d);if(FA!==void 0)d(FA)}}let Z=this._sock=A.sock||new yz,Y=!1,z=!1;if(this._protocol)this._protocol.cleanup();let B=!$?void 0:(L,g,b)=>{$(`Debug output from server: ${JSON.stringify(b)}`)},q,D=this._protocol=new nz({ident:this.config.ident,offer:I?void 0:Q,onWrite:(L)=>{if(qQ(Z))Z.write(L)},onError:(L)=>{if(L.level==="handshake")clearTimeout(this._readyTimeout);if(!D._destruct)Z.removeAllListeners("data");this.emit("error",L);try{Z.end()}catch{}},onHeader:(L)=>{if(z=!0,this._remoteVer=L.versions.software,L.greeting)this.emit("greeting",L.greeting)},onHandshakeComplete:(L)=>{if(this.emit("handshake",L),!Y)Y=!0,D.service("ssh-userauth")},debug:$,hostVerifier:C,messageHandlers:{DEBUG:B,DISCONNECT:(L,g,b)=>{if(g!==nC.BY_APPLICATION){if(!b){if(b=fz[g],b===void 0)b=`Unexpected disconnection reason: ${g}`}let d=new Error(b);d.code=g,this.emit("error",d)}Z.end()},SERVICE_ACCEPT:(L,g)=>{if(g==="ssh-userauth")n()},EXT_INFO:(L,g)=>{if(q===void 0){for(let b of g)if(b.name==="server-sig-algs"){q=b.algs;return}q=null}},USERAUTH_BANNER:(L,g)=>{this.emit("banner",g)},USERAUTH_SUCCESS:(L)=>{k(),clearTimeout(this._readyTimeout),this.emit("ready")},USERAUTH_FAILURE:(L,g,b)=>{if(M.keyAlgos){let d=M.keyAlgos[0][0];if($)$(`Client: ${M.type} (${d}) auth failed`);if(M.keyAlgos.shift(),M.keyAlgos.length){let[FA,BA]=M.keyAlgos[0];switch(M.type){case"agent":D.authPK(M.username,M.agentCtx.currentKey(),FA);return;case"publickey":D.authPK(M.username,M.key,FA);return;case"hostbased":D.authHostbased(M.username,M.key,M.localHostname,M.localUsername,FA,(UA,LA)=>{let QQ=M.key.sign(UA,BA);if(QQ instanceof Error)return QQ.message=`Error while signing with key: ${QQ.message}`,QQ.level="client-authentication",this.emit("error",QQ),n();LA(QQ)});return}}else M.keyAlgos=void 0}if(M.type==="agent"){let d=M.agentCtx.pos();return $&&$(`Client: Agent key #${d+1} failed`),JA()}$&&$(`Client: ${M.type} auth failed`),_=b,E=g,n()},USERAUTH_PASSWD_CHANGEREQ:(L,g)=>{if(M.type==="password")this.emit("change password",g,(b)=>{D.authPassword(this.config.username,this.config.password,b)})},USERAUTH_PK_OK:(L)=>{let g,b;if(M.keyAlgos)[g,b]=M.keyAlgos[0];if(M.type==="agent"){let d=M.agentCtx.currentKey();D.authPK(M.username,d,g,(FA,BA)=>{let UA={hash:b};M.agentCtx.sign(d,FA,UA,(LA,QQ)=>{if(LA)LA.level="agent",this.emit("error",LA);else return BA(QQ);JA()})})}else if(M.type==="publickey")D.authPK(M.username,M.key,g,(d,FA)=>{let BA=M.key.sign(d,b);if(BA instanceof Error)return BA.message=`Error signing data with key: ${BA.message}`,BA.level="client-authentication",this.emit("error",BA),n();FA(BA)})},USERAUTH_INFO_REQUEST:(L,g,b,d)=>{if(M.type==="keyboard-interactive"){if((Array.isArray(d)?d.length:0)===0){$&&$("Client: Sending automatic USERAUTH_INFO_RESPONSE"),D.authInfoRes();return}M.prompt(g,b,"",d,(BA)=>{D.authInfoRes(BA)})}},REQUEST_SUCCESS:(L,g)=>{if(G.length)G.shift()(!1,g)},REQUEST_FAILURE:(L)=>{if(G.length)G.shift()(!0)},GLOBAL_REQUEST:(L,g,b,d)=>{switch(g){case"[email protected]":if(X9(this,d,(FA,BA)=>{if(FA)return;this.emit("hostkeys",BA)}),b)D.requestSuccess();break;default:if(b)D.requestFailure()}},CHANNEL_OPEN:(L,g)=>{$9(this,g)},CHANNEL_OPEN_CONFIRMATION:(L,g)=>{let b=this._chanMgr.get(g.recipient);if(typeof b!=="function")return;let d=b.type==="sftp",BA={type:d?"session":b.type,incoming:{id:g.recipient,window:TJ,packetSize:OJ,state:"open"},outgoing:{id:g.sender,window:g.window,packetSize:g.packetSize,state:"open"}},UA=d?new sz(this,BA,{debug:$}):new VZ(this,BA);this._chanMgr.update(g.recipient,UA),b(void 0,UA)},CHANNEL_OPEN_FAILURE:(L,g,b,d)=>{let FA=this._chanMgr.get(g);if(typeof FA!=="function")return;A9(this,g,{reason:b,description:d},FA)},CHANNEL_DATA:(L,g,b)=>{let d=this._chanMgr.get(g);if(typeof d!=="object"||d===null)return;if(d.incoming.window===0)return;if(d.incoming.window-=b.length,d.push(b)===!1){d._waitChanDrain=!0;return}if(d.incoming.window<=AZ)eC(d)},CHANNEL_EXTENDED_DATA:(L,g,b,d)=>{if(d!==bz)return;let FA=this._chanMgr.get(g);if(typeof FA!=="object"||FA===null)return;if(FA.incoming.window===0)return;if(FA.incoming.window-=b.length,!FA.stderr.push(b)){FA._waitChanDrain=!0;return}if(FA.incoming.window<=AZ)eC(FA)},CHANNEL_WINDOW_ADJUST:(L,g,b)=>{let d=this._chanMgr.get(g);if(typeof d!=="object"||d===null)return;if(d.outgoing.window+=b,d._waitWindow){if(d._waitWindow=!1,d._chunk)d._write(d._chunk,null,d._chunkcb);else if(d._chunkcb)d._chunkcb();else if(d._chunkErr)d.stderr._write(d._chunkErr,null,d._chunkcbErr);else if(d._chunkcbErr)d._chunkcbErr()}},CHANNEL_SUCCESS:(L,g)=>{let b=this._chanMgr.get(g);if(typeof b!=="object"||b===null)return;if(this._resetKA(),b._callbacks.length)b._callbacks.shift()(!1)},CHANNEL_FAILURE:(L,g)=>{let b=this._chanMgr.get(g);if(typeof b!=="object"||b===null)return;if(this._resetKA(),b._callbacks.length)b._callbacks.shift()(!0)},CHANNEL_REQUEST:(L,g,b,d,FA)=>{let BA=this._chanMgr.get(g);if(typeof BA!=="object"||BA===null)return;let UA=BA._exit;if(UA.code!==void 0)return;switch(b){case"exit-status":BA.emit("exit",UA.code=FA);return;case"exit-signal":BA.emit("exit",UA.code=null,UA.signal=`SIG${FA.signal}`,UA.dump=FA.coreDumped,UA.desc=FA.errorMessage);return}if(d)L.channelFailure(BA.outgoing.id)},CHANNEL_EOF:(L,g)=>{let b=this._chanMgr.get(g);if(typeof b!=="object"||b===null)return;if(b.incoming.state!=="open")return;if(b.incoming.state="eof",b.readable)b.push(null);if(b.stderr.readable)b.stderr.push(null)},CHANNEL_CLOSE:(L,g)=>{Q9(this,g,this._chanMgr.get(g))}}});Z.pause();let R=this.config.keepaliveInterval,N=this.config.keepaliveCountMax,v=0,P,o=()=>{if(++v>N){if(clearInterval(P),Z.readable){let L=new Error("Keepalive timeout");L.level="client-timeout",this.emit("error",L),Z.destroy()}return}if(qQ(Z))G.push(k),D.ping();else clearInterval(P)};function k(){if(R>0){if(v=0,clearInterval(P),qQ(Z))P=setInterval(o,R)}}this._resetKA=k;let a=(()=>{let L=!1;return()=>{if(L)return;if(L=!0,u&&!z){let g=rz("Connection lost before handshake","protocol",!0);this.emit("error",g)}}})(),t=(()=>{let L=!1;return()=>{if(L)return;L=!0,u=!0,$&&$("Socket connected"),this.emit("connect"),pz.then(()=>{if(D.start(),Z.on("data",(g)=>{try{D.parse(g,0,g.length)}catch(b){this.emit("error",b);try{if(qQ(Z))Z.end()}catch{}}}),Z.stderr&&typeof Z.stderr.resume==="function")Z.stderr.resume();Z.resume()}).catch((g)=>{this.emit("error",g);try{if(qQ(Z))Z.end()}catch{}})}})(),u=!1;Z.on("connect",t).on("timeout",()=>{this.emit("timeout")}).on("error",(L)=>{$&&$(`Socket error: ${L.message}`),clearTimeout(this._readyTimeout),L.level="client-socket",this.emit("error",L)}).on("end",()=>{$&&$("Socket ended"),a(),D.cleanup(),clearTimeout(this._readyTimeout),clearInterval(P),this.emit("end")}).on("close",()=>{$&&$("Socket closed"),a(),D.cleanup(),clearTimeout(this._readyTimeout),clearInterval(P),this.emit("close");let L=G;G=this._callbacks=[];let g=new Error("No response from server");for(let b=0;b<L.length;++b)L[b](g);this._chanMgr.cleanup(g)});let M,_=null,E=null,p=["none"];if(this.config.password!==void 0)p.push("password");if(X!==void 0)p.push("publickey");if(this._agent!==void 0)p.push("agent");if(this.config.tryKeyboard)p.push("keyboard-interactive");if(X!==void 0&&this.config.localHostname!==void 0&&this.config.localUsername!==void 0)p.push("hostbased");if(Array.isArray(J))J=XZ(J);else if(typeof J!=="function")J=XZ(p);let S=!1,QA=(L)=>{if(S)return;if(S=!0,L===!1){let g=new Error("All configured authentication methods failed");g.level="client-authentication",this.emit("error",g),this.end();return}if(typeof L==="string"){let g=L;if(p.indexOf(g)===-1)return AA(`Authentication method not allowed: ${g}`);let b=this.config.username;switch(g){case"password":L={type:g,username:b,password:this.config.password};break;case"publickey":L={type:g,username:b,key:X};break;case"hostbased":L={type:g,username:b,key:X,localHostname:this.config.localHostname,localUsername:this.config.localUsername};break;case"agent":L={type:g,username:b,agentCtx:new rC(this._agent)};break;case"keyboard-interactive":L={type:g,username:b,prompt:(...d)=>this.emit("keyboard-interactive",...d)};break;case"none":L={type:g,username:b};break;default:return AA(`Skipping unsupported authentication method: ${L}`)}}else if(typeof L!=="object"||L===null)return AA(`Skipping invalid authentication attempt: ${L}`);else{let g=L.username;if(typeof g!=="string")return AA(`Skipping invalid authentication attempt: ${L}`);let b=L.type;switch(b){case"password":{let{password:d}=L;if(typeof d!=="string"&&!Buffer.isBuffer(d))return AA("Skipping invalid password auth attempt");L={type:b,username:g,password:d};break}case"publickey":{let d=wJ(L.key,L.passphrase);if(d instanceof Error)return AA("Skipping invalid key auth attempt");if(!d.isPrivateKey())return AA("Skipping non-private key");L={type:b,username:g,key:d};break}case"hostbased":{let{localHostname:d,localUsername:FA}=L,BA=wJ(L.key,L.passphrase);if(BA instanceof Error||typeof d!=="string"||typeof FA!=="string")return AA("Skipping invalid hostbased auth attempt");if(!BA.isPrivateKey())return AA("Skipping non-private key");L={type:b,username:g,key:BA,localHostname:d,localUsername:FA};break}case"agent":{let d=L.agent;if(typeof d==="string"&&d.length)d=aC(d);else if(!tC(d))return AA(`Skipping invalid agent: ${L.agent}`);L={type:b,username:g,agentCtx:new rC(d)};break}case"keyboard-interactive":{let{prompt:d}=L;if(typeof d!=="function")return AA("Skipping invalid keyboard-interactive auth attempt");L={type:b,username:g,prompt:d};break}case"none":L={type:b,username:g};break;default:return AA(`Skipping unsupported authentication method: ${L}`)}}M=L;try{let g=M.username;switch(M.type){case"password":D.authPassword(g,M.password);break;case"publickey":{let b;if(M.keyAlgos=i$(this,M.key,q),M.keyAlgos)if(M.keyAlgos.length)b=M.keyAlgos[0][0];else return AA("Skipping key authentication (no mutual hash algorithm)");D.authPK(g,M.key,b);break}case"hostbased":{let b,d;if(M.keyAlgos=i$(this,M.key,q),M.keyAlgos)if(M.keyAlgos.length)[b,d]=M.keyAlgos[0];else return AA("Skipping hostbased authentication (no mutual hash algorithm)");D.authHostbased(g,M.key,M.localHostname,M.localUsername,b,(FA,BA)=>{let UA=M.key.sign(FA,d);if(UA instanceof Error)return UA.message=`Error while signing with key: ${UA.message}`,UA.level="client-authentication",this.emit("error",UA),n();BA(UA)});break}case"agent":M.agentCtx.init((b)=>{if(b)return b.level="agent",this.emit("error",b),n();JA()});break;case"keyboard-interactive":D.authKeyboard(g);break;case"none":D.authNone(g);break}}finally{S=!1}};function AA(L){$&&$(L),process.nextTick(n)}function n(){S=!1;let L=J(E,_,QA);if(S||L===void 0)return;QA(L)}let JA=()=>{if(M.type==="agent"){let L=M.agentCtx.nextKey();if(L===!1)$&&$("Agent: No more keys left to try"),$&&$("Client: agent auth failed"),n();else{let g=M.agentCtx.pos(),b;if(M.keyAlgos=i$(this,L,q),M.keyAlgos)if(M.keyAlgos.length)b=M.keyAlgos[0][0];else{$&&$(`Agent: Skipping key #${g+1} (no mutual hash algorithm)`),JA();return}$&&$(`Agent: Trying key #${g+1}`),D.authPK(M.username,L,b)}}},IA=()=>{if(this.config.readyTimeout>0)this._readyTimeout=setTimeout(()=>{let L=new Error("Timed out while waiting for handshake");L.level="client-timeout",this.emit("error",L),Z.destroy()},this.config.readyTimeout)};if(!A.sock){let L=this.config.host,g=this.config.forceIPv4,b=this.config.forceIPv6;$&&$(`Client: Trying ${L} on port ${this.config.port} ...`);let d=()=>{IA(),Z.connect({host:L,port:this.config.port,localAddress:this.config.localAddress,localPort:this.config.localPort}),Z.setMaxListeners(0),Z.setTimeout(typeof A.timeout==="number"?A.timeout:0)};if(!g&&!b||g&&b)d();else mz(L,g?4:6,(FA,BA,UA)=>{if(FA){let QQ=new Error(`Error while looking up ${g?"IPv4":"IPv6"} address for '${L}': ${FA}`);clearTimeout(this._readyTimeout),QQ.level="client-dns",this.emit("error",QQ),this.emit("close");return}L=BA,d()})}else if(IA(),typeof Z.connecting==="boolean"){if(!Z.connecting)t()}else t();return this}end(){if(this._sock&&qQ(this._sock))this._protocol.disconnect(nC.BY_APPLICATION),this._sock.end();return this}destroy(){return this._sock&&qQ(this._sock)&&this._sock.destroy(),this}exec(A,Q,I){if(!this._sock||!qQ(this._sock))throw new Error("Not connected");if(typeof Q==="function")I=Q,Q={};let J={allowHalfOpen:Q.allowHalfOpen!==!1};return a0(this,"session",J,($,G)=>{if($){I($);return}let X=[];function C(Z){if(Z){G.close(),I(Z);return}if(X.length)X.shift()()}if(this.config.allowAgentFwd===!0||Q&&Q.agentForward===!0&&this._agent!==void 0)X.push(()=>JZ(G,C));if(typeof Q==="object"&&Q!==null){if(typeof Q.env==="object"&&Q.env!==null)$Z(G,Q.env);if(typeof Q.pty==="object"&&Q.pty!==null||Q.pty===!0)X.push(()=>IZ(G,Q.pty,C));if(typeof Q.x11==="object"&&Q.x11!==null||Q.x11==="number"||Q.x11===!0)X.push(()=>QZ(G,Q.x11,C))}X.push(()=>J9(G,A,Q,I)),X.shift()()}),this}shell(A,Q,I){if(!this._sock||!qQ(this._sock))throw new Error("Not connected");if(typeof A==="function")I=A,A=Q=void 0;else if(typeof Q==="function")I=Q,Q=void 0;if(A&&(A.x11!==void 0||A.env!==void 0))Q=A,A=void 0;return a0(this,"session",(J,$)=>{if(J){I(J);return}let G=[];function X(C){if(C){$.close(),I(C);return}if(G.length)G.shift()()}if(this.config.allowAgentFwd===!0||Q&&Q.agentForward===!0&&this._agent!==void 0)G.push(()=>JZ($,X));if(A!==!1)G.push(()=>IZ($,A,X));if(typeof Q==="object"&&Q!==null){if(typeof Q.env==="object"&&Q.env!==null)$Z($,Q.env);if(typeof Q.x11==="object"&&Q.x11!==null||Q.x11==="number"||Q.x11===!0)G.push(()=>QZ($,Q.x11,X))}G.push(()=>I9($,I)),G.shift()()}),this}subsys(A,Q){if(!this._sock||!qQ(this._sock))throw new Error("Not connected");return a0(this,"session",(I,J)=>{if(I){Q(I);return}GZ(J,A,($,G)=>{if($){Q($);return}Q(void 0,G)})}),this}forwardIn(A,Q,I){if(!this._sock||!qQ(this._sock))throw new Error("Not connected");let J=typeof I==="function";if(J)this._callbacks.push(($,G)=>{if($){I($!==!0?$:new Error(`Unable to bind to ${A}:${Q}`));return}let X=Q;if(Q===0&&G&&G.length>=4){if(X=az(G,0),!(this._protocol._compatFlags&CZ.DYN_RPORT_BUG))Q=X}this._forwarding[`${A}:${Q}`]=X,I(void 0,X)});return this._protocol.tcpipForward(A,Q,J),this}unforwardIn(A,Q,I){if(!this._sock||!qQ(this._sock))throw new Error("Not connected");let J=typeof I==="function";if(J)this._callbacks.push(($)=>{if($){I($!==!0?$:new Error(`Unable to unbind from ${A}:${Q}`));return}delete this._forwarding[`${A}:${Q}`],I()});return this._protocol.cancelTcpipForward(A,Q,J),this}forwardOut(A,Q,I,J,$){if(!this._sock||!qQ(this._sock))throw new Error("Not connected");let G={srcIP:A,srcPort:Q,dstIP:I,dstPort:J};if(typeof $!=="function")$=o$;return a0(this,"direct-tcpip",G,$),this}openssh_noMoreSessions(A){if(!this._sock||!qQ(this._sock))throw new Error("Not connected");let Q=typeof A==="function";if(!this.config.strictVendor||this.config.strictVendor&&EI.test(this._remoteVer)){if(Q)this._callbacks.push((I)=>{if(I){A(I!==!0?I:new Error("Unable to disable future sessions"));return}A()});return this._protocol.openssh_noMoreSessions(Q),this}if(!Q)return this;return process.nextTick(A,new Error("strictVendor enabled and server is not OpenSSH or compatible version")),this}openssh_forwardInStreamLocal(A,Q){if(!this._sock||!qQ(this._sock))throw new Error("Not connected");let I=typeof Q==="function";if(!this.config.strictVendor||this.config.strictVendor&&EI.test(this._remoteVer)){if(I)this._callbacks.push((J)=>{if(J){Q(J!==!0?J:new Error(`Unable to bind to ${A}`));return}this._forwardingUnix[A]=!0,Q()});return this._protocol.openssh_streamLocalForward(A,I),this}if(!I)return this;return process.nextTick(Q,new Error("strictVendor enabled and server is not OpenSSH or compatible version")),this}openssh_unforwardInStreamLocal(A,Q){if(!this._sock||!qQ(this._sock))throw new Error("Not connected");let I=typeof Q==="function";if(!this.config.strictVendor||this.config.strictVendor&&EI.test(this._remoteVer)){if(I)this._callbacks.push((J)=>{if(J){Q(J!==!0?J:new Error(`Unable to unbind from ${A}`));return}delete this._forwardingUnix[A],Q()});return this._protocol.openssh_cancelStreamLocalForward(A,I),this}if(!I)return this;return process.nextTick(Q,new Error("strictVendor enabled and server is not OpenSSH or compatible version")),this}openssh_forwardOutStreamLocal(A,Q){if(!this._sock||!qQ(this._sock))throw new Error("Not connected");if(typeof Q!=="function")Q=o$;if(!this.config.strictVendor||this.config.strictVendor&&EI.test(this._remoteVer))return a0(this,"[email protected]",{socketPath:A},Q),this;return process.nextTick(Q,new Error("strictVendor enabled and server is not OpenSSH or compatible version")),this}sftp(A){if(!this._sock||!qQ(this._sock))throw new Error("Not connected");return a0(this,"sftp",(Q,I)=>{if(Q){A(Q);return}GZ(I,"sftp",(J,$)=>{if(J){A(J);return}function G(){I.removeListener("ready",X),I.removeListener("error",C),I.removeListener("exit",Z),I.removeListener("close",Z)}function X(){G(),A(void 0,I)}function C(Y){G(),A(Y)}function Z(Y,z){G();let B;if(typeof Y==="number")B=`Received exit code ${Y} while establishing SFTP session`;else if(z!==void 0)B=`Received signal ${z} while establishing SFTP session`;else B="Received unexpected SFTP session termination";let q=new Error(B);q.code=Y,q.signal=z,A(q)}I.on("ready",X).on("error",C).on("exit",Z).on("close",Z),I._init()})}),this}setNoDelay(A){if(this._sock&&typeof this._sock.setNoDelay==="function")this._sock.setNoDelay(A);return this}}function a0(A,Q,I,J){let $=TJ,G=OJ;if(typeof I==="function")J=I,I={};let X=(Z,Y)=>{J(Z,Y)};X.type=Q;let C=A._chanMgr.add(X);if(C===-1){J(new Error("No free channels available"));return}switch(Q){case"session":case"sftp":A._protocol.session(C,$,G);break;case"direct-tcpip":A._protocol.directTcpip(C,$,G,I);break;case"[email protected]":A._protocol.openssh_directStreamLocal(C,$,G,I);break;default:throw new Error(`Unsupported channel type: ${Q}`)}}function QZ(A,Q,I){let J={single:!1,protocol:"MIT-MAGIC-COOKIE-1",cookie:void 0,screen:0};if(typeof Q==="function")I=Q;else if(typeof Q==="object"&&Q!==null){if(typeof Q.single==="boolean")J.single=Q.single;if(typeof Q.screen==="number")J.screen=Q.screen;if(typeof Q.protocol==="string")J.protocol=Q.protocol;if(typeof Q.cookie==="string")J.cookie=Q.cookie;else if(Buffer.isBuffer(Q.cookie))J.cookie=Q.cookie.hexSlice(0,Q.cookie.length)}if(J.cookie===void 0)J.cookie=G9();let $=typeof I==="function";if(A.outgoing.state!=="open"){if($)I(new Error("Channel is not open"));return}if($)A._callbacks.push((G)=>{if(G){I(G!==!0?G:new Error("Unable to request X11"));return}A._hasX11=!0,++A._client._acceptX11,A.once("close",()=>{if(A._client._acceptX11)--A._client._acceptX11}),I()});A._client._protocol.x11Forward(A.outgoing.id,J,$)}function IZ(A,Q,I){let J=24,$=80,G=640,X=480,C="vt100",Z=null;if(typeof Q==="function")I=Q;else if(typeof Q==="object"&&Q!==null){if(typeof Q.rows==="number")J=Q.rows;if(typeof Q.cols==="number")$=Q.cols;if(typeof Q.width==="number")G=Q.width;if(typeof Q.height==="number")X=Q.height;if(typeof Q.term==="string")C=Q.term;if(typeof Q.modes==="object")Z=Q.modes}let Y=typeof I==="function";if(A.outgoing.state!=="open"){if(Y)I(new Error("Channel is not open"));return}if(Y)A._callbacks.push((z)=>{if(z){I(z!==!0?z:new Error("Unable to request a pseudo-terminal"));return}I()});A._client._protocol.pty(A.outgoing.id,J,$,X,G,C,Z,Y)}function JZ(A,Q){let I=typeof Q==="function";if(A.outgoing.state!=="open"){I&&Q(new Error("Channel is not open"));return}if(A._client._agentFwdEnabled){I&&Q(!1);return}A._client._agentFwdEnabled=!0,A._callbacks.push((J)=>{if(J){if(A._client._agentFwdEnabled=!1,I)Q(J!==!0?J:new Error("Unable to request agent forwarding"));return}if(I)Q()}),A._client._protocol.openssh_agentForward(A.outgoing.id,!0)}function I9(A,Q){if(A.outgoing.state!=="open"){Q(new Error("Channel is not open"));return}A._callbacks.push((I)=>{if(I){Q(I!==!0?I:new Error("Unable to open shell"));return}A.subtype="shell",Q(void 0,A)}),A._client._protocol.shell(A.outgoing.id,!0)}function J9(A,Q,I,J){if(A.outgoing.state!=="open"){J(new Error("Channel is not open"));return}A._callbacks.push(($)=>{if($){J($!==!0?$:new Error("Unable to exec"));return}A.subtype="exec",A.allowHalfOpen=I.allowHalfOpen!==!1,J(void 0,A)}),A._client._protocol.exec(A.outgoing.id,Q,!0)}function $Z(A,Q){if(A.outgoing.state!=="open")return;let I=Object.keys(Q||{});for(let J=0;J<I.length;++J){let $=I[J],G=Q[$];A._client._protocol.env(A.outgoing.id,$,G,!1)}}function GZ(A,Q,I){if(A.outgoing.state!=="open"){I(new Error("Channel is not open"));return}A._callbacks.push((J)=>{if(J){I(J!==!0?J:new Error(`Unable to start subsystem: ${Q}`));return}A.subtype="subsystem",I(void 0,A)}),A._client._protocol.subsystem(A.outgoing.id,Q,!0)}function $9(A,Q){let I=-1,J,$=()=>{let Z={type:Q.type,incoming:{id:I,window:TJ,packetSize:OJ,state:"open"},outgoing:{id:Q.sender,window:Q.window,packetSize:Q.packetSize,state:"open"}},Y=new VZ(A,Z);return A._chanMgr.update(I,Y),A._protocol.channelOpenConfirm(Q.sender,I,TJ,OJ),Y},G=()=>{if(J===void 0)if(I===-1)J=PI.RESOURCE_SHORTAGE;else J=PI.CONNECT_FAILED;if(I!==-1)A._chanMgr.remove(I);A._protocol.channelOpenFail(Q.sender,J,"")},X=()=>{if(I=A._chanMgr.add(),I===-1){if(J=PI.RESOURCE_SHORTAGE,A.config.debug)A.config.debug("Client: Automatic rejection of incoming channel open: no channels available")}return I!==-1},C=Q.data;switch(Q.type){case"forwarded-tcpip":{let Z=A._forwarding[`${C.destIP}:${C.destPort}`];if(Z!==void 0&&X()){if(C.destPort===0)C.destPort=Z;A.emit("tcp connection",C,$,G);return}break}case"[email protected]":if(A._forwardingUnix[C.socketPath]!==void 0&&X()){A.emit("unix connection",C,$,G);return}break;case"[email protected]":if(A._agentFwdEnabled&&typeof A._agent.getStream==="function"&&X()){A._agent.getStream((Z,Y)=>{if(Z)return G();let z=$();z.pipe(Y).pipe(z)});return}break;case"x11":if(A._acceptX11!==0&&X()){A.emit("x11",C,$,G);return}break;default:if(J=PI.UNKNOWN_CHANNEL_TYPE,A.config.debug)A.config.debug(`Client: Automatic rejection of unsupported incoming channel open type: ${Q.type}`)}if(J===void 0){if(J=PI.ADMINISTRATIVELY_PROHIBITED,A.config.debug)A.config.debug("Client: Automatic rejection of unexpected incoming channel open for: "+Q.type)}G()}var G9=(()=>{let A=Buffer.allocUnsafe(16);return()=>{return kz(A,0,16),A.hexSlice(0,16)}})();function XZ(A){if(!Array.isArray(A))throw new Error("authList must be an array");let Q=0;return(I,J,$)=>{if(Q===A.length)return!1;return A[Q++]}}function X9(A,Q,I){if(!A._sock||!qQ(A._sock))return;if(typeof I!=="function")I=o$;if(!Array.isArray(Q))throw new TypeError("Invalid keys argument type");let J=[];for(let $ of Q){let G=wJ($);if(G instanceof Error)throw G;J.push(G)}if(!A.config.strictVendor||A.config.strictVendor&&EI.test(A._remoteVer)){A._callbacks.push(($,G)=>{if($){I($!==!0?$:new Error("Server failed to prove supplied keys"));return}let X=[],C=0;MJ.init(G,0);while(MJ.avail()){if(C===J.length)break;let Z=J[C++],Y=Z.getPublicSSH(),z=MJ.readString();UJ.init(z,0);let B=UJ.readString(!0),q=UJ.readString(),D;if(B!==Z.type)if(Z.type==="ssh-rsa")switch(B){case"rsa-sha2-256":D="sha256";break;case"rsa-sha2-512":D="sha512";break;default:continue}else continue;let R=A._protocol._kex.sessionID,N=Buffer.allocUnsafe(37+R.length+4+Y.length),v=0;if(c$(N,29,v),N.utf8Write("[email protected]",v+=4,29),c$(N,R.length,v+=29),sC(R,N,0,R.length,v+=4),c$(N,Y.length,v+=R.length),sC(Y,N,0,Y.length,v+=4),!(q=tz(q,B)))continue;if(Z.verify(N,q,D)===!0)X.push(Z)}UJ.clear(),MJ.clear(),I(null,X)}),A._protocol.openssh_hostKeysProve(J);return}process.nextTick(I,new Error("strictVendor enabled and server is not OpenSSH or compatible version"))}function i$(A,Q,I){switch(Q.type){case"ssh-rsa":if(A._protocol._compatFlags&CZ.IMPLY_RSA_SHA2_SIGALGS)if(!Array.isArray(I))I=["rsa-sha2-256","rsa-sha2-512"];else I=["rsa-sha2-256","rsa-sha2-512",...I];if(Array.isArray(I)){if(I.indexOf("rsa-sha2-256")!==-1)return[["rsa-sha2-256","sha256"]];if(I.indexOf("rsa-sha2-512")!==-1)return[["rsa-sha2-512","sha512"]];if(I.indexOf("ssh-rsa")===-1)return[]}return[["ssh-rsa","sha1"]]}}YZ.exports=zZ});var BZ=cA((jZ)=>{var{Agent:s$}=EA("http"),{Agent:C9}=EA("https"),{connect:Z9}=EA("tls"),n$;for(let A of[s$,C9]){class Q extends A{constructor(I,J){super(J);this._connectCfg=I,this._defaultSrcIP=J&&J.srcIP||"localhost"}createConnection(I,J){let $=I&&I.localAddress||this._defaultSrcIP,G=I&&I.localPort||0,X=I.host,C=I.port;if(n$===void 0)n$=p$();let Z=new n$,Y=!1;Z.on("ready",()=>{Z.forwardOut($,G,X,C,(z,B)=>{if(Y=!0,z)return Z.end(),J(z);B.once("close",()=>Z.end()),J(null,V9(B,A,I))})}).on("error",J).on("close",()=>{if(!Y)J(new Error("Unexpected connection close"))}).connect(this._connectCfg)}}jZ[A===s$?"SSHTTPAgent":"SSHTTPSAgent"]=Q}function gI(){}function V9(A,Q,I){if(Q===s$)return A.setKeepAlive=gI,A.setNoDelay=gI,A.setTimeout=gI,A.ref=gI,A.unref=gI,A.destroySoon=A.destroy,A;I.socket=A;let J=Z9(I),$=(()=>{let G=!1;return()=>{if(G)return;if(G=!0,A.isPaused())A.resume()}})();return J.on("end",$).on("close",$),J}});var qZ=cA((rY,AG)=>{var{Server:z9}=EA("net"),kI=EA("events"),{listenerCount:xQ}=kI,{CHANNEL_OPEN_FAILURE:t0,DEFAULT_CIPHER:Y9,DEFAULT_COMPRESSION:j9,DEFAULT_KEX:B9,DEFAULT_MAC:W9,DEFAULT_SERVER_HOST_KEY:H9,DISCONNECT_REASON:e0,DISCONNECT_REASON_BY_VALUE:F9,SUPPORTED_CIPHER:q9,SUPPORTED_COMPRESSION:D9,SUPPORTED_KEX:K9,SUPPORTED_MAC:N9,SUPPORTED_SERVER_HOST_KEY:R9}=J0(),{init:M9}=j0(),{KexInit:U9}=zJ(),{parseKey:WZ}=H0(),w9=P$(),{SFTP:T9}=vI(),{writeUInt32BE:O9}=iQ(),{Channel:AI,MAX_WINDOW:D0,PACKET_SIZE:K0,windowAdjust:L9,WINDOW_THRESHOLD:x9}=f$(),{ChannelManager:v9,generateAlgorithmList:SI,isWritable:LJ,onChannelOpenFailure:P9,onCHANNEL_CLOSE:_9}=l$();class L0 extends kI{constructor(A,Q,I,J,$){super();this.username=this.user=Q,this.service=I,this.method=J,this._initialResponse=!1,this._finalResponse=!1,this._multistep=!1,this._cbfinal=(G,X,C)=>{if(!this._finalResponse)this._finalResponse=!0,$(this,G,X,C)},this._protocol=A}accept(){this._cleanup&&this._cleanup(),this._initialResponse=!0,this._cbfinal(!0)}reject(A,Q){this._cleanup&&this._cleanup(),this._initialResponse=!0,this._cbfinal(!1,A,Q)}}class a$ extends L0{constructor(A,Q,I,J,$,G){super(A,Q,I,J,G);this._multistep=!0,this._cb=void 0,this._onInfoResponse=(X)=>{let C=this._cb;if(C)this._cb=void 0,C(X)},this.submethods=$,this.on("abort",()=>{this._cb&&this._cb(new Error("Authentication request aborted"))})}prompt(A,Q,I,J){if(!Array.isArray(A))A=[A];if(typeof Q==="function")J=Q,Q=I=void 0;else if(typeof I==="function")J=I,I=void 0;else if(typeof J!=="function")J=void 0;for(let $=0;$<A.length;++$)if(typeof A[$]==="string")A[$]={prompt:A[$],echo:!0};this._cb=J,this._initialResponse=!0,this._protocol.authInfoReq(Q,I,A)}}class HZ extends L0{constructor(A,Q,I,J,$,G){super(A,Q,I,J,G);this.key={algo:$.keyAlgo,data:$.key},this.hashAlgo=$.hashAlgo,this.signature=$.signature,this.blob=$.blob}accept(){if(!this.signature)this._initialResponse=!0,this._protocol.authPKOK(this.key.algo,this.key.data);else L0.prototype.accept.call(this)}}class FZ extends L0{constructor(A,Q,I,J,$,G){super(A,Q,I,J,G);this.key={algo:$.keyAlgo,data:$.key},this.hashAlgo=$.hashAlgo,this.signature=$.signature,this.blob=$.blob,this.localHostname=$.localHostname,this.localUsername=$.localUsername}}class t$ extends L0{constructor(A,Q,I,J,$,G){super(A,Q,I,J,G);this.password=$,this._changeCb=void 0}requestChange(A,Q){if(this._changeCb)throw new Error("Change request already in progress");if(typeof A!=="string")throw new Error("prompt argument must be a string");if(typeof Q!=="function")throw new Error("Callback argument must be a function");this._changeCb=Q,this._protocol.authPasswdChg(A)}}class Z0 extends kI{constructor(A,Q,I){super();this.type="session",this.subtype=void 0,this.server=!0,this._ending=!1,this._channel=void 0,this._chanInfo={type:"session",incoming:{id:I,window:D0,packetSize:K0,state:"open"},outgoing:{id:Q.sender,window:Q.window,packetSize:Q.packetSize,state:"open"}}}}class lQ extends kI{constructor(A,Q){super();if(typeof A!=="object"||A===null)throw new Error("Missing configuration object");let I=Object.create(null),J=[],$=A.hostKeys;if(!Array.isArray($))throw new Error("hostKeys must be an array");let G=typeof A.algorithms==="object"&&A.algorithms!==null?A.algorithms:{},X=SI(G.serverHostKey,H9,R9);for(let B=0;B<$.length;++B){let q;if(Buffer.isBuffer($[B])||typeof $[B]==="string")q=WZ($[B]);else q=WZ($[B].key,$[B].passphrase);if(q instanceof Error)throw new Error(`Cannot parse privateKey: ${q.message}`);if(Array.isArray(q))q=q[0];if(q.getPrivatePEM()===null)throw new Error("privateKey value contains an invalid private key");if(J.includes(q.type))continue;if(q.type==="ssh-rsa"){let D=X.indexOf("ssh-rsa"),R=X.indexOf("rsa-sha2-256"),N=X.indexOf("rsa-sha2-512");if(D===-1)D=1/0;[D,R,N].sort(E9).forEach((v)=>{if(v===-1)return;let P;switch(v){case D:P="ssh-rsa";break;case R:P="rsa-sha2-256";break;case N:P="rsa-sha2-512";break;default:return}I[P]=q,J.push(P)})}else I[q.type]=q,J.push(q.type)}let C={kex:SI(G.kex,B9,K9).concat(["[email protected]"]),serverHostKey:J,cs:{cipher:SI(G.cipher,Y9,q9),mac:SI(G.hmac,W9,N9),compress:SI(G.compress,j9,D9),lang:[]},sc:void 0};if(C.sc=C.cs,typeof Q==="function")this.on("connection",Q);let Z=typeof A.debug==="function"?A.debug:void 0,Y=A.ident?Buffer.from(A.ident):void 0,z=new U9(C);this._srv=new z9((B)=>{if(this._connections>=this.maxConnections){B.destroy();return}++this._connections,B.once("close",()=>{--this._connections});let q;if(Z){let D=`[${process.hrtime().join(".")}] `;q=(R)=>{Z(`${D}${R}`)}}new e$(B,I,Y,z,q,this,A)}).on("error",(B)=>{this.emit("error",B)}).on("listening",()=>{this.emit("listening")}).on("close",()=>{this.emit("close")}),this._connections=0,this.maxConnections=1/0}injectSocket(A){this._srv.emit("connection",A)}listen(...A){return this._srv.listen(...A),this}address(){return this._srv.address()}getConnections(A){return this._srv.getConnections(A),this}close(A){return this._srv.close(A),this}ref(){return this._srv.ref(),this}unref(){return this._srv.unref(),this}}lQ.KEEPALIVE_CLIENT_INTERVAL=15000;lQ.KEEPALIVE_CLIENT_COUNT_MAX=3;class e$ extends kI{constructor(A,Q,I,J,$,G,X){super();let C=0,Z=!1,Y=[],z,B,q,D=[];this._sock=A,this._chanMgr=new v9(this),this._debug=$,this.noMoreSessions=!1,this.authenticated=!1;function R(u){}this.on("error",R);let N=!$?void 0:(u,M,_)=>{$(`Debug output from client: ${JSON.stringify(_)}`)},v=typeof X.keepaliveInterval==="number"&&isFinite(X.keepaliveInterval)&&X.keepaliveInterval>0?X.keepaliveInterval:typeof lQ.KEEPALIVE_CLIENT_INTERVAL==="number"&&isFinite(lQ.KEEPALIVE_CLIENT_INTERVAL)&&lQ.KEEPALIVE_CLIENT_INTERVAL>0?lQ.KEEPALIVE_CLIENT_INTERVAL:-1,P=typeof X.keepaliveCountMax==="number"&&isFinite(X.keepaliveCountMax)&&X.keepaliveCountMax>=0?X.keepaliveCountMax:typeof lQ.KEEPALIVE_CLIENT_COUNT_MAX==="number"&&isFinite(lQ.KEEPALIVE_CLIENT_COUNT_MAX)&&lQ.KEEPALIVE_CLIENT_COUNT_MAX>=0?lQ.KEEPALIVE_CLIENT_COUNT_MAX:-1,o=0;if(v!==-1&&P!==-1)this.once("ready",()=>{let u=()=>{clearInterval(B)};this.on("close",u).on("end",u),B=setInterval(()=>{if(++o>P){clearInterval(B);let M=new Error("Keepalive timeout");M.level="client-timeout",this.emit("error",M),this.end()}else k.ping()},v)}),q=()=>{B&&B.refresh(),o=0};let k=this._protocol=new w9({server:!0,hostKeys:Q,ident:I,offer:J,onPacket:q,greeting:X.greeting,banner:X.banner,onWrite:(u)=>{if(LJ(A))A.write(u)},onError:(u)=>{if(!k._destruct)A.removeAllListeners("data");this.emit("error",u);try{A.end()}catch{}},onHeader:(u)=>{this.removeListener("error",R);let M={ip:A.remoteAddress,family:A.remoteFamily,port:A.remotePort,header:u};if(!G.emit("connection",this,M)){k.disconnect(e0.BY_APPLICATION),A.end();return}if(u.greeting)this.emit("greeting",u.greeting)},onHandshakeComplete:(u)=>{if(++C>1)this.emit("rekey");this.emit("handshake",u)},debug:$,messageHandlers:{DEBUG:N,DISCONNECT:(u,M,_)=>{if(M!==e0.BY_APPLICATION){if(!_){if(_=F9[M],_===void 0)_=`Unexpected disconnection reason: ${M}`}let E=new Error(_);E.code=M,this.emit("error",E)}A.end()},CHANNEL_OPEN:(u,M)=>{if(M.type==="session"&&this.noMoreSessions||!this.authenticated){let JA=t0.ADMINISTRATIVELY_PROHIBITED;return k.channelOpenFail(M.sender,JA)}let _=-1,E,p=!1,S,QA=()=>{if(p)return;if(p=!0,E===void 0)if(_===-1)E=t0.RESOURCE_SHORTAGE;else E=t0.CONNECT_FAILED;if(_!==-1)this._chanMgr.remove(_);k.channelOpenFail(M.sender,E,"")},AA=()=>{if(_=this._chanMgr.add(),_===-1){if(E=t0.RESOURCE_SHORTAGE,$)$("Automatic rejection of incoming channel open: no channels available")}return _!==-1},n=M.data;switch(M.type){case"session":if(xQ(this,"session")&&AA()){S=()=>{if(p)return;p=!0;let JA=new Z0(this,M,_);return this._chanMgr.update(_,JA),k.channelOpenConfirm(M.sender,_,D0,K0),JA},this.emit("session",S,QA);return}break;case"direct-tcpip":if(xQ(this,"tcpip")&&AA()){S=()=>{if(p)return;p=!0;let JA={type:void 0,incoming:{id:_,window:D0,packetSize:K0,state:"open"},outgoing:{id:M.sender,window:M.window,packetSize:M.packetSize,state:"open"}},IA=new AI(this,JA,{server:!0});return this._chanMgr.update(_,IA),k.channelOpenConfirm(M.sender,_,D0,K0),IA},this.emit("tcpip",S,QA,n);return}break;case"[email protected]":if(xQ(this,"openssh.streamlocal")&&AA()){S=()=>{if(p)return;p=!0;let JA={type:void 0,incoming:{id:_,window:D0,packetSize:K0,state:"open"},outgoing:{id:M.sender,window:M.window,packetSize:M.packetSize,state:"open"}},IA=new AI(this,JA,{server:!0});return this._chanMgr.update(_,IA),k.channelOpenConfirm(M.sender,_,D0,K0),IA},this.emit("openssh.streamlocal",S,QA,n);return}break;default:if(E=t0.UNKNOWN_CHANNEL_TYPE,$)$(`Automatic rejection of unsupported incoming channel open type: ${M.type}`)}if(E===void 0){if(E=t0.ADMINISTRATIVELY_PROHIBITED,$)$(`Automatic rejection of unexpected incoming channel open for: ${M.type}`)}QA()},CHANNEL_OPEN_CONFIRMATION:(u,M)=>{let _=this._chanMgr.get(M.recipient);if(typeof _!=="function")return;let E={type:_.type,incoming:{id:M.recipient,window:D0,packetSize:K0,state:"open"},outgoing:{id:M.sender,window:M.window,packetSize:M.packetSize,state:"open"}},p=new AI(this,E,{server:!0});this._chanMgr.update(M.recipient,p),_(void 0,p)},CHANNEL_OPEN_FAILURE:(u,M,_,E)=>{let p=this._chanMgr.get(M);if(typeof p!=="function")return;P9(this,M,{reason:_,description:E},p)},CHANNEL_DATA:(u,M,_)=>{let E=this._chanMgr.get(M);if(typeof E!=="object"||E===null)return;if(E.constructor===Z0){if(E=E._channel,!E)return}if(E.incoming.window===0)return;if(E.incoming.window-=_.length,E.push(_)===!1){E._waitChanDrain=!0;return}if(E.incoming.window<=x9)L9(E)},CHANNEL_EXTENDED_DATA:(u,M,_,E)=>{},CHANNEL_WINDOW_ADJUST:(u,M,_)=>{let E=this._chanMgr.get(M);if(typeof E!=="object"||E===null)return;if(E.constructor===Z0){if(E=E._channel,!E)return}if(E.outgoing.window+=_,E._waitWindow){if(E._waitWindow=!1,E._chunk)E._write(E._chunk,null,E._chunkcb);else if(E._chunkcb)E._chunkcb();else if(E._chunkErr)E.stderr._write(E._chunkErr,null,E._chunkcbErr);else if(E._chunkcbErr)E._chunkcbErr()}},CHANNEL_SUCCESS:(u,M)=>{let _=this._chanMgr.get(M);if(typeof _!=="object"||_===null)return;if(_.constructor===Z0){if(_=_._channel,!_)return}if(_._callbacks.length)_._callbacks.shift()(!1)},CHANNEL_FAILURE:(u,M)=>{let _=this._chanMgr.get(M);if(typeof _!=="object"||_===null)return;if(_.constructor===Z0){if(_=_._channel,!_)return}if(_._callbacks.length)_._callbacks.shift()(!0)},CHANNEL_REQUEST:(u,M,_,E,p)=>{let S=this._chanMgr.get(M);if(typeof S!=="object"||S===null)return;let QA=!1,AA,n;if(S.constructor!==Z0){if(E)k.channelFailure(S.outgoing.id);return}if(E){if(_!=="shell"&&_!=="exec"&&_!=="subsystem")AA=()=>{if(QA||S._ending||S._channel)return;QA=!0,k.channelSuccess(S._chanInfo.outgoing.id)};n=()=>{if(QA||S._ending||S._channel)return;QA=!0,k.channelFailure(S._chanInfo.outgoing.id)}}if(S._ending){n&&n();return}switch(_){case"env":if(xQ(S,"env")){S.emit("env",AA,n,{key:p.name,val:p.value});return}break;case"pty-req":if(xQ(S,"pty")){S.emit("pty",AA,n,p);return}break;case"window-change":if(xQ(S,"window-change"))S.emit("window-change",AA,n,p);else n&&n();break;case"x11-req":if(xQ(S,"x11")){S.emit("x11",AA,n,p);return}break;case"signal":if(xQ(S,"signal")){S.emit("signal",AA,n,{name:p});return}break;case"[email protected]":if(xQ(S,"auth-agent")){S.emit("auth-agent",AA,n);return}break;case"shell":if(xQ(S,"shell")){AA=()=>{if(QA||S._ending||S._channel)return;if(QA=!0,E)k.channelSuccess(S._chanInfo.outgoing.id);let JA=new AI(this,S._chanInfo,{server:!0});return JA.subtype=S.subtype=_,S._channel=JA,JA},S.emit("shell",AA,n);return}break;case"exec":if(xQ(S,"exec")){AA=()=>{if(QA||S._ending||S._channel)return;if(QA=!0,E)k.channelSuccess(S._chanInfo.outgoing.id);let JA=new AI(this,S._chanInfo,{server:!0});return JA.subtype=S.subtype=_,S._channel=JA,JA},S.emit("exec",AA,n,{command:p});return}break;case"subsystem":{let JA=p==="sftp";if(AA=()=>{if(QA||S._ending||S._channel)return;if(QA=!0,E)k.channelSuccess(S._chanInfo.outgoing.id);let IA;if(JA)IA=new T9(this,S._chanInfo,{server:!0,debug:$});else IA=new AI(this,S._chanInfo,{server:!0}),IA.subtype=S.subtype=`${_}:${p}`;return S._channel=IA,IA},p==="sftp"){if(xQ(S,"sftp")){S.emit("sftp",AA,n);return}JA=!1}if(xQ(S,"subsystem")){S.emit("subsystem",AA,n,{name:p});return}break}}$&&$(`Automatic rejection of incoming channel request: ${_}`),n&&n()},CHANNEL_EOF:(u,M)=>{let _=this._chanMgr.get(M);if(typeof _!=="object"||_===null)return;if(_.constructor===Z0){if(!_._ending)_._ending=!0,_.emit("eof"),_.emit("end");if(_=_._channel,!_)return}if(_.incoming.state!=="open")return;if(_.incoming.state="eof",_.readable)_.push(null)},CHANNEL_CLOSE:(u,M)=>{let _=this._chanMgr.get(M);if(typeof _!=="object"||_===null)return;if(_.constructor===Z0){if(_._ending=!0,_.emit("close"),_=_._channel,!_)return}_9(this,M,_)},SERVICE_REQUEST:(u,M)=>{if(C===0||Z||this.authenticated||M!=="ssh-userauth"){k.disconnect(e0.SERVICE_NOT_AVAILABLE),A.end();return}Z=!0,k.serviceAccept(M)},USERAUTH_REQUEST:(u,M,_,E,p)=>{if(C===0||this.authenticated||z&&(z.username!==M||z.service!==_)||E!=="password"&&E!=="publickey"&&E!=="hostbased"&&E!=="keyboard-interactive"&&E!=="none"||Y.length===10){k.disconnect(e0.PROTOCOL_ERROR),A.end();return}else if(_!=="ssh-connection"){k.disconnect(e0.SERVICE_NOT_AVAILABLE),A.end();return}let S;switch(E){case"keyboard-interactive":S=new a$(k,M,_,E,p,a);break;case"publickey":S=new HZ(k,M,_,E,p,a);break;case"hostbased":S=new FZ(k,M,_,E,p,a);break;case"password":if(z&&z instanceof t$&&z._changeCb){let QA=z._changeCb;z._changeCb=void 0,QA(p.newPassword);return}S=new t$(k,M,_,E,p,a);break;case"none":S=new L0(k,M,_,E,a);break}if(z){if(!z._initialResponse)return Y.push(S);else if(z._multistep&&!z._finalResponse)z._cleanup&&z._cleanup(),z.emit("abort")}if(z=S,xQ(this,"authentication"))this.emit("authentication",z);else z.reject()},USERAUTH_INFO_RESPONSE:(u,M)=>{if(z&&z instanceof a$)z._onInfoResponse(M)},GLOBAL_REQUEST:(u,M,_,E)=>{let p={type:null,buf:null};function S(QA,AA){p.type=QA,p.buf=AA,t()}if(_)D.push(p);if((M==="tcpip-forward"||M==="cancel-tcpip-forward"||M==="[email protected]"||M==="[email protected]"||M==="[email protected]")&&xQ(this,"request")&&this.authenticated){let QA,AA;if(_){let n=!1;QA=(JA)=>{if(n)return;n=!0;let IA;if(M==="tcpip-forward"&&E.bindPort===0&&typeof JA==="number")IA=Buffer.allocUnsafe(4),O9(IA,JA,0);S("SUCCESS",IA)},AA=()=>{if(n)return;n=!0,S("FAILURE")}}if(M==="[email protected]"){this.noMoreSessions=!0,QA&&QA();return}this.emit("request",QA,AA,M,E)}else if(_)S("FAILURE")}}});A.pause(),M9.then(()=>{k.start(),A.on("data",(u)=>{try{k.parse(u,0,u.length)}catch(M){this.emit("error",M);try{if(LJ(A))A.end()}catch{}}}),A.resume()}).catch((u)=>{this.emit("error",u);try{if(LJ(A))A.end()}catch{}}),A.on("error",(u)=>{u.level="socket",this.emit("error",u)}).once("end",()=>{$&&$("Socket ended"),k.cleanup(),this.emit("end")}).once("close",()=>{$&&$("Socket closed"),k.cleanup(),this.emit("close");let u=new Error("No response from server");this._chanMgr.cleanup(u)});let a=(u,M,_,E)=>{if(z===u&&!this.authenticated){if(M)z=void 0,this.authenticated=!0,k.authSuccess(),Y=[],this.emit("ready");else if(k.authFailure(_,E),Y.length)if(z=Y.pop(),xQ(this,"authentication"))this.emit("authentication",z);else z.reject()}};function t(){while(D.length>0&&D[0].type){let u=D.shift();if(u.type==="SUCCESS")k.requestSuccess(u.buf);if(u.type==="FAILURE")k.requestFailure()}}}end(){if(this._sock&&LJ(this._sock))this._protocol.disconnect(e0.BY_APPLICATION),this._sock.end();return this}x11(A,Q,I){return r$(this,"x11",{originAddr:A,originPort:Q},I),this}forwardOut(A,Q,I,J,$){return r$(this,"forwarded-tcpip",{boundAddr:A,boundPort:Q,remoteAddr:I,remotePort:J},$),this}openssh_forwardOutStreamLocal(A,Q){return r$(this,"[email protected]",{socketPath:A},Q),this}rekey(A){let Q;try{this._protocol.rekey()}catch(I){Q=I}if(typeof A==="function")if(Q)process.nextTick(A,Q);else this.once("rekey",A)}setNoDelay(A){if(this._sock&&typeof this._sock.setNoDelay==="function")this._sock.setNoDelay(A);return this}}function r$(A,Q,I,J){let $=D0,G=K0;if(typeof I==="function")J=I,I={};let X=(Z,Y)=>{J(Z,Y)};X.type=Q;let C=A._chanMgr.add(X);if(C===-1){J(new Error("No free channels available"));return}switch(Q){case"forwarded-tcpip":A._protocol.forwardedTcpip(C,$,G,I);break;case"x11":A._protocol.x11(C,$,G,I);break;case"[email protected]":A._protocol.openssh_forwardedStreamLocal(C,$,G,I);break;default:throw new Error(`Unsupported channel type: ${Q}`)}}function E9(A,Q){return A-Q}AG.exports=lQ;AG.exports.IncomingClient=e$});var MZ=cA((aY,RZ)=>{var{createCipheriv:g9,generateKeyPair:S9,generateKeyPairSync:k9,getCurves:y9,randomBytes:DZ}=EA("crypto"),{Ber:ZQ}=YI(),m9=oJ().pbkdf,{CIPHER_INFO:h9}=j0(),u9=y9(),b9=new Map(Object.entries(h9));function KZ(A,Q){if(typeof A!=="string")throw new TypeError("Key type must be a string");let I={type:"spki",format:"der"},J={type:"pkcs8",format:"der"};switch(A.toLowerCase()){case"rsa":{if(typeof Q!=="object"||Q===null)throw new TypeError("Missing options object for RSA key");let $=Q.bits;if(!Number.isInteger($))throw new TypeError("RSA bits must be an integer");if($<=0||$>16384)throw new RangeError("RSA bits must be non-zero and <= 16384");return["rsa",{modulusLength:$,publicKeyEncoding:I,privateKeyEncoding:J}]}case"ecdsa":{if(typeof Q!=="object"||Q===null)throw new TypeError("Missing options object for ECDSA key");if(!Number.isInteger(Q.bits))throw new TypeError("ECDSA bits must be an integer");let $;switch(Q.bits){case 256:$="prime256v1";break;case 384:$="secp384r1";break;case 521:$="secp521r1";break;default:throw new Error("ECDSA bits must be 256, 384, or 521")}if(!u9.includes($))throw new Error("Unsupported ECDSA bits value");return["ec",{namedCurve:$,publicKeyEncoding:I,privateKeyEncoding:J}]}case"ed25519":return["ed25519",{publicKeyEncoding:I,privateKeyEncoding:J}];default:throw new Error(`Unsupported key type: ${A}`)}}function f9(A,Q,I){switch(A){case"rsa":{let J=new ZQ.Reader(I);if(J.readSequence(),J.readInt()!==0)throw new Error("Unsupported version in RSA private key");if(J.readSequence(),J.readOID()!=="1.2.840.113549.1.1.1")throw new Error("Bad RSA private OID");if(J.readByte()!==ZQ.Null)throw new Error("Malformed RSA private key (expected null)");if(J.readByte()!==0)throw new Error("Malformed RSA private key (expected zero-length null)");if(J=new ZQ.Reader(J.readString(ZQ.OctetString,!0)),J.readSequence(),J.readInt()!==0)throw new Error("Unsupported version in RSA private key");let $=J.readString(ZQ.Integer,!0),G=J.readString(ZQ.Integer,!0),X=J.readString(ZQ.Integer,!0),C=J.readString(ZQ.Integer,!0),Z=J.readString(ZQ.Integer,!0);J.readString(ZQ.Integer,!0),J.readString(ZQ.Integer,!0);let Y=J.readString(ZQ.Integer,!0),z=Buffer.from("ssh-rsa"),B=Buffer.allocUnsafe(4+z.length+4+$.length+4+G.length+4+X.length+4+Y.length+4+C.length+4+Z.length),q=0;B.writeUInt32BE(z.length,q+=0),B.set(z,q+=4),B.writeUInt32BE($.length,q+=z.length),B.set($,q+=4),B.writeUInt32BE(G.length,q+=$.length),B.set(G,q+=4),B.writeUInt32BE(X.length,q+=G.length),B.set(X,q+=4),B.writeUInt32BE(Y.length,q+=X.length),B.set(Y,q+=4),B.writeUInt32BE(C.length,q+=Y.length),B.set(C,q+=4),B.writeUInt32BE(Z.length,q+=C.length),B.set(Z,q+=4);let D=Buffer.allocUnsafe(4+z.length+4+G.length+4+$.length);return q=0,D.writeUInt32BE(z.length,q+=0),D.set(z,q+=4),D.writeUInt32BE(G.length,q+=z.length),D.set(G,q+=4),D.writeUInt32BE($.length,q+=G.length),D.set($,q+=4),{sshName:z.toString(),priv:B,pub:D}}case"ec":{let J=new ZQ.Reader(Q);if(J.readSequence(),J.readSequence(),J.readOID()!=="1.2.840.10045.2.1")throw new Error("Bad ECDSA public OID");J.readOID();let $=J.readString(ZQ.BitString,!0);{let q=0;for(;q<$.length&&$[q]===0;++q);if(q>0)$=$.slice(q)}if(J=new ZQ.Reader(I),J.readSequence(),J.readInt()!==0)throw new Error("Unsupported version in ECDSA private key");if(J.readSequence(),J.readOID()!=="1.2.840.10045.2.1")throw new Error("Bad ECDSA private OID");let G=J.readOID(),X;switch(G){case"1.2.840.10045.3.1.7":X="nistp256";break;case"1.3.132.0.34":X="nistp384";break;case"1.3.132.0.35":X="nistp521";break;default:throw new Error("Unsupported curve in ECDSA private key")}if(J=new ZQ.Reader(J.readString(ZQ.OctetString,!0)),J.readSequence(),J.readInt()!==1)throw new Error("Unsupported version in ECDSA private key");let C=Buffer.concat([Buffer.from([0]),J.readString(ZQ.OctetString,!0)]),Z=Buffer.from(`ecdsa-sha2-${X}`);X=Buffer.from(X);let Y=Buffer.allocUnsafe(4+Z.length+4+X.length+4+$.length+4+C.length),z=0;Y.writeUInt32BE(Z.length,z+=0),Y.set(Z,z+=4),Y.writeUInt32BE(X.length,z+=Z.length),Y.set(X,z+=4),Y.writeUInt32BE($.length,z+=X.length),Y.set($,z+=4),Y.writeUInt32BE(C.length,z+=$.length),Y.set(C,z+=4);let B=Buffer.allocUnsafe(4+Z.length+4+X.length+4+$.length);return z=0,B.writeUInt32BE(Z.length,z+=0),B.set(Z,z+=4),B.writeUInt32BE(X.length,z+=Z.length),B.set(X,z+=4),B.writeUInt32BE($.length,z+=X.length),B.set($,z+=4),{sshName:Z.toString(),priv:Y,pub:B}}case"ed25519":{let J=new ZQ.Reader(Q);if(J.readSequence(),J.readSequence(),J.readOID()!=="1.3.101.112")throw new Error("Bad ED25519 public OID");let $=J.readString(ZQ.BitString,!0);{let z=0;for(;z<$.length&&$[z]===0;++z);if(z>0)$=$.slice(z)}if(J=new ZQ.Reader(I),J.readSequence(),J.readInt()!==0)throw new Error("Unsupported version in ED25519 private key");if(J.readSequence(),J.readOID()!=="1.3.101.112")throw new Error("Bad ED25519 private OID");J=new ZQ.Reader(J.readString(ZQ.OctetString,!0));let G=J.readString(ZQ.OctetString,!0),X=Buffer.from("ssh-ed25519"),C=Buffer.allocUnsafe(4+X.length+4+$.length+4+(G.length+$.length)),Z=0;C.writeUInt32BE(X.length,Z+=0),C.set(X,Z+=4),C.writeUInt32BE($.length,Z+=X.length),C.set($,Z+=4),C.writeUInt32BE(G.length+$.length,Z+=$.length),C.set(G,Z+=4),C.set($,Z+=G.length);let Y=Buffer.allocUnsafe(4+X.length+4+$.length);return Z=0,Y.writeUInt32BE(X.length,Z+=0),Y.set(X,Z+=4),Y.writeUInt32BE($.length,Z+=X.length),Y.set($,Z+=4),{sshName:X.toString(),priv:C,pub:Y}}}}function NZ(A,Q,I,J){let $="new",G,X="";if(typeof J==="object"&&J!==null){if(typeof J.comment==="string"&&J.comment)X=J.comment;if(typeof J.format==="string"&&J.format)$=J.format;if(J.passphrase){let C;if(typeof J.passphrase==="string")C=Buffer.from(J.passphrase);else if(Buffer.isBuffer(J.passphrase))C=J.passphrase;else throw new Error("Invalid passphrase");if(J.cipher===void 0)throw new Error("Missing cipher name");let Z=b9.get(J.cipher);if(Z===void 0)throw new Error("Invalid cipher name");if($==="new"){let Y=16;if(J.rounds!==void 0){if(!Number.isInteger(J.rounds))throw new TypeError("rounds must be an integer");if(J.rounds>0)Y=J.rounds}let z=Buffer.allocUnsafe(Z.keyLen+Z.ivLen),B=DZ(16);if(m9(C,C.length,B,B.length,z,z.length,Y)!==0)return new Error("Failed to generate information to encrypt key");let D=Buffer.allocUnsafe(4+B.length+4);{let R=0;D.writeUInt32BE(B.length,R+=0),D.set(B,R+=4),D.writeUInt32BE(Y,R+=B.length)}G={cipher:Z,cipherName:J.cipher,kdfName:"bcrypt",kdfOptions:D,key:z.slice(0,Z.keyLen),iv:z.slice(Z.keyLen)}}}}switch($){case"new":{let C=`-----BEGIN OPENSSH PRIVATE KEY-----
`,Z,Y=Buffer.from(G?G.cipherName:"none"),z=Buffer.from(G?G.kdfName:"none"),B=G?G.kdfOptions:Buffer.alloc(0),q=G?G.cipher.blockLen:8,D=f9(A,Q,I),R=DZ(4),N=Buffer.from(X),v=8+D.priv.length+4+N.length,P=[];for(let u=1;(v+P.length)%q;++u)P.push(u&255);P=Buffer.from(P);let o=Buffer.allocUnsafe(v+P.length),k;{let u=0;o.set(R,u+=0),o.set(R,u+=4),o.set(D.priv,u+=4),o.writeUInt32BE(N.length,u+=D.priv.length),o.set(N,u+=4),o.set(P,u+=N.length)}if(G){let u={authTagLength:G.cipher.authLen},M=g9(G.cipher.sslName,G.key,G.iv,u);if(M.setAutoPadding(!1),o=Buffer.concat([M.update(o),M.final()]),G.cipher.authLen>0)k=M.getAuthTag();else k=Buffer.alloc(0);G.key.fill(0),G.iv.fill(0)}else k=Buffer.alloc(0);let a=Buffer.from("openssh-key-v1\x00"),t=Buffer.allocUnsafe(a.length+4+Y.length+4+z.length+4+B.length+4+4+D.pub.length+4+o.length+k.length);{let u=0;t.set(a,u+=0),t.writeUInt32BE(Y.length,u+=a.length),t.set(Y,u+=4),t.writeUInt32BE(z.length,u+=Y.length),t.set(z,u+=4),t.writeUInt32BE(B.length,u+=z.length),t.set(B,u+=4),t.writeUInt32BE(1,u+=B.length),t.writeUInt32BE(D.pub.length,u+=4),t.set(D.pub,u+=4),t.writeUInt32BE(o.length,u+=D.pub.length),t.set(o,u+=4),t.set(k,u+=o.length)}{let u=t.base64Slice(0,t.length),M=u.replace(/.{64}/g,`$&
`);if(u.length&63)M+=`
`;C+=M}{let u=D.pub.base64Slice(0,D.pub.length);Z=`${D.sshName} ${u}${X?` ${X}`:""}`}return C+=`-----END OPENSSH PRIVATE KEY-----
`,{private:C,public:Z}}default:throw new Error("Invalid output key format")}}function d9(){}RZ.exports={generateKeyPair:(A,Q,I)=>{if(typeof Q==="function")I=Q,Q=void 0;if(typeof I!=="function")I=d9;let J=KZ(A,Q);S9(...J,($,G,X)=>{if($)return I($);let C;try{C=NZ(J[0],G,X,Q)}catch(Z){return I(Z)}I(null,C)})},generateKeyPairSync:(A,Q)=>{let I=KZ(A,Q),{publicKey:J,privateKey:$}=k9(...I);return NZ(I[0],J,$,Q)}}});var wZ=cA((tY,UZ)=>{var{AgentProtocol:l9,BaseAgent:c9,createAgent:i9,CygwinAgent:o9,OpenSSHAgent:p9,PageantAgent:n9}=K$(),{SSHTTPAgent:s9,SSHTTPSAgent:r9}=BZ(),{parseKey:a9}=H0(),{flagsToString:t9,OPEN_MODE:e9,STATUS_CODE:AY,stringToFlags:QY}=vI();UZ.exports={AgentProtocol:l9,BaseAgent:c9,createAgent:i9,Client:p$(),CygwinAgent:o9,HTTPAgent:s9,HTTPSAgent:r9,OpenSSHAgent:p9,PageantAgent:n9,Server:qZ(),utils:{parseKey:a9,...MZ(),sftp:{flagsToString:t9,OPEN_MODE:e9,STATUS_CODE:AY,stringToFlags:QY}}}});var UG=XG(MG(),1),{program:hJ,createCommand:jY,createArgument:BY,createOption:WY,CommanderError:HY,InvalidArgumentError:FY,InvalidOptionArgumentError:qY,Command:DY,Argument:KY,Option:NY,Help:RY}=UG.default;var TZ=XG(wZ(),1);import{readdir as IY,readFile as JY}from"fs/promises";import{join as $Y}from"path";class QG{config;verbose;dryRun;constructor(A){this.config=A.config,this.verbose=A.verbose||!1,this.dryRun=A.dryRun||!1}async run(){let A=await this.loadScripts(),Q=[];this.log(`Found ${A.length} scripts to execute`);for(let I of A){if(this.log(`
=== Executing: ${I.filename} ===`),this.dryRun){this.log(`[DRY RUN] Would execute ${I.filename} as ${I.isRootScript?"root":this.config.targetUser||"zhijia"}`);continue}try{let J=await this.executeScript(I);Q.push(J),this.logResult(J)}catch(J){this.log(`ERROR: Failed to execute ${I.filename}: ${J}`);let $={script:I,success:!1,stdout:"",stderr:J instanceof Error?J.message:String(J),exitCode:-1,startTime:new Date,endTime:new Date,duration:0};Q.push($)}}return Q}async loadScripts(){let Q=await IY(this.config.scriptsDir),I=[];for(let $ of Q){let G=this.parseScriptFilename($);if(G){let X=await JY($Y(this.config.scriptsDir,$),"utf-8");I.push({filename:$,order:G.order,description:G.description,isRootScript:G.isRootScript,content:X})}}let J=I.sort(($,G)=>$.order-G.order);return this.filterScripts(J)}parseScriptFilename(A){let Q=A.match(/^(\d{2})-(.+)$/);if(!Q)return null;let I=parseInt(Q[1],10),J=Q[2],$=Q[1].startsWith("0");return{order:I,description:J,isRootScript:$}}async executeScript(A){return new Promise((Q,I)=>{let J=new TZ.Client,$=new Date,G="",X="";J.on("ready",()=>{this.log(`Connected to ${this.config.host}`);let C=`/tmp/${A.filename}`,Y=`echo '${A.content.replace(/'/g,`'"'"'`)}' > ${C} && chmod +x ${C}`;J.exec(Y,(z,B)=>{if(z){I(z);return}B.on("close",(q)=>{if(q!==0){I(new Error(`Failed to upload script, exit code: ${q}`));return}let D=A.isRootScript?C:`su - ${this.config.targetUser||"zhijia"} -c '${C}'`;this.log(`Executing: ${D} (as ${A.isRootScript?"root":this.config.targetUser||"zhijia"})`),J.exec(D,(R,N)=>{if(R){I(R);return}N.on("close",(v)=>{let P=new Date,o=P.getTime()-$.getTime();J.end(),Q({script:A,success:v===0,stdout:G,stderr:X,exitCode:v,startTime:$,endTime:P,duration:o})}),N.on("data",(v)=>{if(G+=v.toString(),this.verbose)process.stdout.write(v)}),N.stderr.on("data",(v)=>{if(X+=v.toString(),this.verbose)process.stderr.write(v)})})}),B.on("data",(q)=>{if(this.verbose)process.stdout.write(q)}),B.stderr.on("data",(q)=>{if(this.verbose)process.stderr.write(q)})})}),J.on("error",(C)=>{I(C)}),J.connect({host:this.config.host,port:this.config.port||22,username:this.config.username,password:this.config.password})})}filterScripts(A){if(!this.config.scriptFilter)return A;let Q=this.config.scriptFilter,I=A;if(Q.include?.length)I=I.filter((J)=>Q.include.includes(J.order));if(Q.exclude?.length)I=I.filter((J)=>!Q.exclude.includes(J.order));if(Q.ranges?.length)I=I.filter((J)=>Q.ranges.some(($)=>J.order>=$.start&&J.order<=$.end));if(this.log(`
Script filtering applied:`),this.log(` Total scripts found: ${A.length}`),this.log(` Scripts to execute: ${I.length}`),I.length<A.length){let J=A.filter(($)=>!I.includes($));this.log(` Skipped scripts: ${J.map(($)=>$.filename).join(", ")}`)}return I}log(A){console.log(A)}logResult(A){let Q=A.success?"\u2713":"\u2717",I=`${A.duration}ms`;if(this.log(`${Q} ${A.script.filename} (${I})`),A.stdout&&!this.verbose)this.log(`STDOUT:
${A.stdout}`);if(A.stderr)this.log(`STDERR:
${A.stderr}`)}}hJ.name("cloud-init-runner").description("Automatically execute cloud-init scripts on remote hosts via SSH").version("1.0.0").requiredOption("-h, --host <host>","Remote host to connect to").requiredOption("-u, --username <username>","SSH username").requiredOption("-p, --password <password>","SSH password").option("-P, --port <port>","SSH port (default: 22)","22").option("-s, --scripts-dir <dir>","Directory containing cloud-init scripts","./cloud-init").option("-t, --target-user <user>","Target user for non-root scripts (default: zhijia)","zhijia").option("-i, --include <numbers...>","Include specific scripts by number (e.g., 01 03 05)").option("-e, --exclude <numbers...>","Exclude specific scripts by number (e.g., 02 04)").option("-r, --range <ranges...>","Execute scripts in range (e.g., 01-05 10-15)").option("-v, --verbose","Enable verbose output").option("-d, --dry-run","Show what would be executed without actually running").action(async(A)=>{try{let Q={};if(A.include?.length)Q.include=A.include.map((C)=>parseInt(C,10));if(A.exclude?.length)Q.exclude=A.exclude.map((C)=>parseInt(C,10));if(A.range?.length)Q.ranges=A.range.map((C)=>{let[Z,Y]=C.split("-").map((z)=>parseInt(z,10));if(isNaN(Z)||isNaN(Y))throw new Error(`Invalid range format: ${C}. Use format like '01-05'`);return{start:Z,end:Y}});let I={host:A.host,username:A.username,password:A.password,port:A.port?parseInt(A.port,10):22,scriptsDir:A.scriptsDir||"./cloud-init",targetUser:A.targetUser,scriptFilter:Object.keys(Q).length>0?Q:void 0},J=new QG({config:I,verbose:A.verbose,dryRun:A.dryRun});if(console.log("\uD83D\uDE80 Starting cloud-init execution..."),console.log(`\uD83D\uDCE1 Target: ${I.username}@${I.host}:${I.port}`),console.log(`\uD83D\uDCC1 Scripts directory: ${I.scriptsDir}`),A.dryRun)console.log("\uD83D\uDD0D DRY RUN MODE - No actual execution will occur");let $=await J.run();console.log(`
\uD83D\uDCCA Execution Summary:`);let G=$.filter((C)=>C.success).length,X=$.filter((C)=>!C.success).length;if(console.log(`\u2705 Successful: ${G}`),console.log(`\u274C Failed: ${X}`),console.log(`\u23F1\uFE0F Total time: ${$.reduce((C,Z)=>C+Z.duration,0)}ms`),X>0)console.log(`
\u274C Failed scripts:`),$.filter((C)=>!C.success).forEach((C)=>{console.log(` - ${C.script.filename}: ${C.stderr||"Unknown error"}`)}),process.exit(1);console.log(`
\uD83C\uDF89 All scripts executed successfully!`)}catch(Q){console.error("\uD83D\uDCA5 Fatal error:",Q instanceof Error?Q.message:String(Q)),process.exit(1)}});hJ.parse();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment