diff --git a/dist/index.js b/dist/index.js index 559a0ac..3d05e2c 100644 --- a/dist/index.js +++ b/dist/index.js @@ -33,5 +33,5 @@ let re;class YargsParser{constructor(e){re=e}parse(e,t){const r=Object.assign({a * SPDX-License-Identifier: ISC */ var se,ie,oe;const ae=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):20;const ce=(ie=(se=process===null||process===void 0?void 0:process.versions)===null||se===void 0?void 0:se.node)!==null&&ie!==void 0?ie:(oe=process===null||process===void 0?void 0:process.version)===null||oe===void 0?void 0:oe.slice(1);if(ce){const e=Number(ce.match(/^([^.]+)/)[1]);if(ele,format:Z.format,normalize:o.normalize,resolve:o.resolve,require:e=>{if(typeof Ae!=="undefined"){return Ae(e)}else if(e.match(/\.json$/)){return JSON.parse((0,i.readFileSync)(e,"utf8"))}else{throw Error("only .json config files are supported in ESM")}}});const de=function Parser(e,t){const r=ue.parse(e.slice(),t);return r.argv};de.detailed=function(e,t){return ue.parse(e.slice(),t)};de.camelCase=camelCase;de.decamelize=decamelize;de.looksLikeNumber=looksLikeNumber;const ge=de;function getProcessArgvBinIndex(){if(isBundledElectronApp())return 0;return 1}function isBundledElectronApp(){return isElectronApp()&&!process.defaultApp}function isElectronApp(){return!!process.versions.electron}function hideBin(e){return e.slice(getProcessArgvBinIndex()+1)}function getProcessArgvBin(){return process.argv[getProcessArgvBinIndex()]}function yargs_node_modules_ansi_regex_ansiRegex({onlyFirst:e=false}={}){const t="(?:\\u0007|\\u001B\\u005C|\\u009C)";const r=`(?:\\u001B\\][\\s\\S]*?${t})`;const n="[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";const s=`${r}|${n}`;return new RegExp(s,e?undefined:"g")}const pe=yargs_node_modules_ansi_regex_ansiRegex();function yargs_node_modules_strip_ansi_stripAnsi(e){if(typeof e!=="string"){throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``)}if(!e.includes("")&&!e.includes("›")){return e}return e.replace(pe,"")}const he=new Intl.Segmenter;const me=/^(?:\p{Default_Ignorable_Code_Point}|\p{Control}|\p{Format}|\p{Nonspacing_Mark}|\p{Enclosing_Mark}|\p{Surrogate})+$/v;const fe=/^[\p{Default_Ignorable_Code_Point}\p{Control}\p{Format}\p{Nonspacing_Mark}\p{Enclosing_Mark}\p{Surrogate}]+/v;const Ce=/\p{Spacing_Mark}/v;const ye=/^\p{RGI_Emoji}$/v;const Ee=/^[\d#*]\u20E3$/;const Ie=/\p{Extended_Pictographic}/gu;function isDoubleWidthNonRgiEmojiSequence(e){if(e.length>50){return false}if(Ee.test(e)){return true}if(e.includes("‍")){const t=e.match(Ie);return t!==null&&t.length>=2}return false}function baseVisible(e){return e.replace(fe,"")}function isZeroWidthCluster(e){return me.test(e)}function isHangulLeadingJamo(e){return e>=4352&&e<=4447||e>=43360&&e<=43388}function isHangulVowelJamo(e){return e>=4448&&e<=4519||e>=55216&&e<=55238}function isHangulTrailingJamo(e){return e>=4520&&e<=4607||e>=55243&&e<=55291}function isHangulJamo(e){return isHangulLeadingJamo(e)||isHangulVowelJamo(e)||isHangulTrailingJamo(e)}function hangulClusterWidth(e,t){const r=[];for(const t of e){if(me.test(t)){continue}r.push(t.codePointAt(0))}if(r.length===0){return undefined}let n=0;for(let e=0;e="＀"&&s<="￯"){r+=eastAsianWidth(s.codePointAt(0),t)}}return r}function string_width_stringWidth(e,t={}){if(typeof e!=="string"||e.length===0){return 0}const{ambiguousIsNarrow:r=true,countAnsiEscapeCodes:n=false}=t;let s=e;if(!n&&(s.includes("")||s.includes("›"))){s=yargs_node_modules_strip_ansi_stripAnsi(s)}if(s.length===0){return 0}if(/^[\u0020-\u007E]*$/.test(s)){return s.length}let i=0;const o={ambiguousAsWide:!r};for(const{segment:e}of he.segment(s)){if(isZeroWidthCluster(e)){continue}if(ye.test(e)||isDoubleWidthNonRgiEmojiSequence(e)){i+=2;continue}const t=baseVisible(e);const r=hangulClusterWidth(t,o);if(r!==undefined){i+=r;continue}const n=t.codePointAt(0);i+=eastAsianWidth(n,o);i+=trailingWidth(t,o)}return i}const Be={fs:{readFileSync:i.readFileSync,writeFile:i.writeFile},format:Z.format,resolve:o.resolve,exists:e=>{try{return(0,i.statSync)(e).isFile()}catch(e){return false}}};let Qe;class Y18N{constructor(e){e=e||{};this.directory=e.directory||"./locales";this.updateFiles=typeof e.updateFiles==="boolean"?e.updateFiles:true;this.locale=e.locale||"en";this.fallbackToLanguage=typeof e.fallbackToLanguage==="boolean"?e.fallbackToLanguage:true;this.cache=Object.create(null);this.writeQueue=[]}__(...e){if(typeof arguments[0]!=="string"){return this._taggedLiteral(arguments[0],...arguments)}const t=e.shift();let cb=function(){};if(typeof e[e.length-1]==="function")cb=e.pop();cb=cb||function(){};if(!this.cache[this.locale])this._readLocaleFile();if(!this.cache[this.locale][t]&&this.updateFiles){this.cache[this.locale][t]=t;this._enqueueWrite({directory:this.directory,locale:this.locale,cb:cb})}else{cb()}return Qe.format.apply(Qe.format,[this.cache[this.locale][t]||t].concat(e))}__n(){const e=Array.prototype.slice.call(arguments);const t=e.shift();const r=e.shift();const n=e.shift();let cb=function(){};if(typeof e[e.length-1]==="function")cb=e.pop();if(!this.cache[this.locale])this._readLocaleFile();let s=n===1?t:r;if(this.cache[this.locale][t]){const e=this.cache[this.locale][t];s=e[n===1?"one":"other"]}if(!this.cache[this.locale][t]&&this.updateFiles){this.cache[this.locale][t]={one:t,other:r};this._enqueueWrite({directory:this.directory,locale:this.locale,cb:cb})}else{cb()}const i=[s];if(~s.indexOf("%d"))i.push(n);return Qe.format.apply(Qe.format,i.concat(e))}setLocale(e){this.locale=e}getLocale(){return this.locale}updateLocale(e){if(!this.cache[this.locale])this._readLocaleFile();for(const t in e){if(Object.prototype.hasOwnProperty.call(e,t)){this.cache[this.locale][t]=e[t]}}}_taggedLiteral(e,...t){let r="";e.forEach((function(e,n){const s=t[n+1];r+=e;if(typeof s!=="undefined"){r+="%s"}}));return this.__.apply(this,[r].concat([].slice.call(t,1)))}_enqueueWrite(e){this.writeQueue.push(e);if(this.writeQueue.length===1)this._processWriteQueue()}_processWriteQueue(){const e=this;const t=this.writeQueue[0];const r=t.directory;const n=t.locale;const s=t.cb;const i=this._resolveLocaleFile(r,n);const o=JSON.stringify(this.cache[n],null,2);Qe.fs.writeFile(i,o,"utf-8",(function(t){e.writeQueue.shift();if(e.writeQueue.length>0)e._processWriteQueue();s(t)}))}_readLocaleFile(){let e={};const t=this._resolveLocaleFile(this.directory,this.locale);try{if(Qe.fs.readFileSync){e=JSON.parse(Qe.fs.readFileSync(t,"utf-8"))}}catch(r){if(r instanceof SyntaxError){r.message="syntax error in "+t}if(r.code==="ENOENT")e={};else throw r}this.cache[this.locale]=e}_resolveLocaleFile(e,t){let r=Qe.resolve(e,"./",t+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(r)&&~t.lastIndexOf("_")){const n=Qe.resolve(e,"./",t.split("_")[0]+".json");if(this._fileExistsSync(n))r=n}return r}_fileExistsSync(e){return Qe.exists(e)}}function y18n(e,t){Qe=t;const r=new Y18N(e);return{__:r.__.bind(r),__n:r.__n.bind(r),setLocale:r.setLocale.bind(r),getLocale:r.getLocale.bind(r),updateLocale:r.updateLocale.bind(r),locale:r.locale}}const y18n_y18n=e=>y18n(e,Be);const be=y18n_y18n;var Se=__nccwpck_require__(3869);const we=e(import.meta.url)("node:fs");const De=(0,ee.fileURLToPath)(import.meta.url);const Ne=De.substring(0,De.lastIndexOf("node_modules"));const xe=(0,ne.createRequire)(import.meta.url);const Re={assert:{notStrictEqual:a.notStrictEqual,strictEqual:a.strictEqual},cliui:ui,findUp:sync,getEnv:e=>process.env[e],inspect:Z.inspect,getProcessArgvBin:getProcessArgvBin,mainFilename:Ne||process.cwd(),Parser:ge,path:{basename:o.basename,dirname:o.dirname,extname:o.extname,relative:o.relative,resolve:o.resolve,join:o.join},process:{argv:()=>process.argv,cwd:process.cwd,emitWarning:(e,t)=>process.emitWarning(e,t),execPath:()=>process.execPath,exit:e=>{process.exit(e)},nextTick:process.nextTick,stdColumns:typeof process.stdout.columns!=="undefined"?process.stdout.columns:null},readFileSync:we.readFileSync,readdirSync:we.readdirSync,require:xe,getCallerFile:()=>{const e=Se(3);return e.match(/^file:\/\//)?(0,ee.fileURLToPath)(e):e},stringWidth:string_width_stringWidth,y18n:be({directory:(0,o.resolve)(De,"../../../locales"),updateFiles:false})};function assertNotStrictEqual(e,t,r,n){r.assert.notStrictEqual(e,t,n)}function assertSingleKey(e,t){t.assert.strictEqual(typeof e,"string")}function objectKeys(e){return Object.keys(e)}function isPromise(e){return!!e&&!!e.then&&typeof e.then==="function"}class YError extends Error{constructor(e){super(e||"yargs error");this.name="YError";if(Error.captureStackTrace){Error.captureStackTrace(this,YError)}}}function parseCommand(e){const t=e.replace(/\s{2,}/g," ");const r=t.split(/\s+(?![^[]*]|[^<]*>)/);const n=/\.*[\][<>]/g;const s=r.shift();if(!s)throw new Error(`No command found in: ${e}`);const i={cmd:s.replace(n,""),demanded:[],optional:[]};r.forEach(((e,t)=>{let s=false;e=e.replace(/\s/g,"");if(/\.+[\]>]/.test(e)&&t===r.length-1)s=true;if(/^\[/.test(e)){i.optional.push({cmd:e.replace(n,"").split("|"),variadic:s})}else{i.demanded.push({cmd:e.replace(n,"").split("|"),variadic:s})}}));return i}const ve=["first","second","third","fourth","fifth","sixth"];function argsert(e,t,r){function parseArgs(){return typeof e==="object"?[{demanded:[],optional:[]},e,t]:[parseCommand(`cmd ${e}`),t,r]}try{let e=0;const[t,r,n]=parseArgs();const s=[].slice.call(r);while(s.length&&s[s.length-1]===undefined)s.pop();const i=n||s.length;if(io){throw new YError(`Too many arguments provided. Expected max ${o} but received ${i}.`)}t.demanded.forEach((t=>{const r=s.shift();const n=guessType(r);const i=t.cmd.filter((e=>e===n||e==="*"));if(i.length===0)argumentTypeError(n,t.cmd,e);e+=1}));t.optional.forEach((t=>{if(s.length===0)return;const r=s.shift();const n=guessType(r);const i=t.cmd.filter((e=>e===n||e==="*"));if(i.length===0)argumentTypeError(n,t.cmd,e);e+=1}))}catch(e){console.warn(e.stack)}}function guessType(e){if(Array.isArray(e)){return"array"}else if(e===null){return"null"}return typeof e}function argumentTypeError(e,t,r){throw new YError(`Invalid ${ve[r]||"manyith"} argument. Expected ${t.join(" or ")} but received ${e}.`)}class GlobalMiddleware{constructor(e){this.globalMiddleware=[];this.frozens=[];this.yargs=e}addMiddleware(e,t,r=true,n=false){argsert(" [boolean] [boolean] [boolean]",[e,t,r],arguments.length);if(Array.isArray(e)){for(let n=0;n{const n=[...r[t]||[],t];if(!e.option)return true;else return!n.includes(e.option)}));e.option=t;return this.addMiddleware(e,true,true,true)}getMiddleware(){return this.globalMiddleware}freeze(){this.frozens.push([...this.globalMiddleware])}unfreeze(){const e=this.frozens.pop();if(e!==undefined)this.globalMiddleware=e}reset(){this.globalMiddleware=this.globalMiddleware.filter((e=>e.global))}}function commandMiddlewareFactory(e){if(!e)return[];return e.map((e=>{e.applyBeforeValidation=false;return e}))}function applyMiddleware(e,t,r,n){return r.reduce(((e,r)=>{if(r.applyBeforeValidation!==n){return e}if(r.mutates){if(r.applied)return e;r.applied=true}if(isPromise(e)){return e.then((e=>Promise.all([e,r(e,t)]))).then((([e,t])=>Object.assign(e,t)))}else{const n=r(e,t);return isPromise(n)?n.then((t=>Object.assign(e,t))):Object.assign(e,n)}}),e)}function maybeAsyncResult(e,t,r=e=>{throw e}){try{const r=isFunction(e)?e():e;return isPromise(r)?r.then((e=>t(e))):t(r)}catch(e){return r(e)}}function isFunction(e){return typeof e==="function"}const ke=/(^\*)|(^\$0)/;class CommandInstance{constructor(e,t,r,n){this.requireCache=new Set;this.handlers={};this.aliasMap={};this.frozens=[];this.shim=n;this.usage=e;this.globalMiddleware=r;this.validation=t}addDirectory(e,t,r,n){n=n||{};this.requireCache.add(r);const s=this.shim.path.resolve(this.shim.path.dirname(r),e);const i=this.shim.readdirSync(s,{recursive:n.recurse?true:false});if(!Array.isArray(n.extensions))n.extensions=["js"];const o=typeof n.visit==="function"?n.visit:e=>e;for(const e of i){const r=e.toString();if(n.exclude){let e=false;if(typeof n.exclude==="function"){e=n.exclude(r)}else{e=n.exclude.test(r)}if(e)continue}if(n.include){let e=false;if(typeof n.include==="function"){e=n.include(r)}else{e=n.include.test(r)}if(!e)continue}let i=false;for(const e of n.extensions){if(r.endsWith(e))i=true}if(i){const e=this.shim.path.join(s,r);const n=t(e);const i=Object.create(null,Object.getOwnPropertyDescriptors({...n}));const a=o(i,e,r);if(a){if(this.requireCache.has(e))continue;else this.requireCache.add(e);if(!i.command){i.command=this.shim.path.basename(e,this.shim.path.extname(e))}this.addHandler(i)}}}}addHandler(e,t,r,n,s,i){let o=[];const a=commandMiddlewareFactory(s);n=n||(()=>{});if(Array.isArray(e)){if(isCommandAndAliases(e)){[e,...o]=e}else{for(const t of e){this.addHandler(t)}}}else if(isCommandHandlerDefinition(e)){let t=Array.isArray(e.command)||typeof e.command==="string"?e.command:null;if(t===null){throw new Error(`No command name given for module: ${this.shim.inspect(e)}`)}if(e.aliases)t=[].concat(t).concat(e.aliases);this.addHandler(t,this.extractDesc(e),e.builder,e.handler,e.middlewares,e.deprecated);return}else if(isCommandBuilderDefinition(r)){this.addHandler([e].concat(o),t,r.builder,r.handler,r.middlewares,r.deprecated);return}if(typeof e==="string"){const s=parseCommand(e);o=o.map((e=>parseCommand(e).cmd));let c=false;const l=[s.cmd].concat(o).filter((e=>{if(ke.test(e)){c=true;return false}return true}));if(l.length===0&&c)l.push("$0");if(c){s.cmd=l[0];o=l.slice(1);e=e.replace(ke,s.cmd)}o.forEach((e=>{this.aliasMap[e]=s.cmd}));if(t!==false){this.usage.command(e,t,c,o,i)}this.handlers[s.cmd]={original:e,description:t,handler:n,builder:r||{},middlewares:a,deprecated:i,demanded:s.demanded,optional:s.optional};if(c)this.defaultCommand=this.handlers[s.cmd]}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(e,t,r,n,s,i){const o=this.handlers[e]||this.handlers[this.aliasMap[e]]||this.defaultCommand;const a=t.getInternalMethods().getContext();const c=a.commands.slice();const l=!e;if(e){a.commands.push(e);a.fullCommands.push(o.original)}const A=this.applyBuilderUpdateUsageAndParse(l,o,t,r.aliases,c,n,s,i);return isPromise(A)?A.then((e=>this.applyMiddlewareAndGetResult(l,o,e.innerArgv,a,s,e.aliases,t))):this.applyMiddlewareAndGetResult(l,o,A.innerArgv,a,s,A.aliases,t)}applyBuilderUpdateUsageAndParse(e,t,r,n,s,i,o,a){const c=t.builder;let l=r;if(isCommandBuilderCallback(c)){r.getInternalMethods().getUsageInstance().freeze();const A=c(r.getInternalMethods().reset(n),a);if(isPromise(A)){return A.then((n=>{l=isYargsInstance(n)?n:r;return this.parseAndUpdateUsage(e,t,l,s,i,o)}))}}else if(isCommandBuilderOptionDefinitions(c)){r.getInternalMethods().getUsageInstance().freeze();l=r.getInternalMethods().reset(n);Object.keys(t.builder).forEach((e=>{l.option(e,c[e])}))}return this.parseAndUpdateUsage(e,t,l,s,i,o)}parseAndUpdateUsage(e,t,r,n,s,i){if(e)r.getInternalMethods().getUsageInstance().unfreeze(true);if(this.shouldUpdateUsage(r)){r.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(n,t),t.description)}const o=r.getInternalMethods().runYargsParserAndExecuteCommands(null,undefined,true,s,i);return isPromise(o)?o.then((e=>({aliases:r.parsed.aliases,innerArgv:e}))):{aliases:r.parsed.aliases,innerArgv:o}}shouldUpdateUsage(e){return!e.getInternalMethods().getUsageInstance().getUsageDisabled()&&e.getInternalMethods().getUsageInstance().getUsage().length===0}usageFromParentCommandsCommandHandler(e,t){const r=ke.test(t.original)?t.original.replace(ke,"").trim():t.original;const n=e.filter((e=>!ke.test(e)));n.push(r);return`$0 ${n.join(" ")}`}handleValidationAndGetResult(e,t,r,n,s,i,o,a){if(!i.getInternalMethods().getHasOutput()){const t=i.getInternalMethods().runValidation(s,a,i.parsed.error,e);r=maybeAsyncResult(r,(e=>{t(e);return e}))}if(t.handler&&!i.getInternalMethods().getHasOutput()){i.getInternalMethods().setHasOutput();const n=!!i.getOptions().configuration["populate--"];i.getInternalMethods().postProcess(r,n,false,false);r=applyMiddleware(r,i,o,false);r=maybeAsyncResult(r,(e=>{const r=t.handler(e);return isPromise(r)?r.then((()=>e)):e}));if(!e){i.getInternalMethods().getUsageInstance().cacheHelpMessage()}if(isPromise(r)&&!i.getInternalMethods().hasParseCallback()){r.catch((e=>{try{i.getInternalMethods().getUsageInstance().fail(null,e)}catch(e){}}))}}if(!e){n.commands.pop();n.fullCommands.pop()}return r}applyMiddlewareAndGetResult(e,t,r,n,s,i,o){let a={};if(s)return r;if(!o.getInternalMethods().getHasOutput()){a=this.populatePositionals(t,r,n,o)}const c=this.globalMiddleware.getMiddleware().slice(0).concat(t.middlewares);const l=applyMiddleware(r,o,c,true);return isPromise(l)?l.then((r=>this.handleValidationAndGetResult(e,t,r,n,i,o,c,a))):this.handleValidationAndGetResult(e,t,l,n,i,o,c,a)}populatePositionals(e,t,r,n){t._=t._.slice(r.commands.length);const s=e.demanded.slice(0);const i=e.optional.slice(0);const o={};this.validation.positionalCount(s.length,t._.length);while(s.length){const e=s.shift();this.populatePositional(e,t,o)}while(i.length){const e=i.shift();this.populatePositional(e,t,o)}t._=r.commands.concat(t._.map((e=>""+e)));this.postProcessPositionals(t,o,this.cmdToParseOptions(e.original),n);return o}populatePositional(e,t,r){const n=e.cmd[0];if(e.variadic){r[n]=t._.splice(0).map(String)}else{if(t._.length)r[n]=[String(t._.shift())]}}cmdToParseOptions(e){const t={array:[],default:{},alias:{},demand:{}};const r=parseCommand(e);r.demanded.forEach((e=>{const[r,...n]=e.cmd;if(e.variadic){t.array.push(r);t.default[r]=[]}t.alias[r]=n;t.demand[r]=true}));r.optional.forEach((e=>{const[r,...n]=e.cmd;if(e.variadic){t.array.push(r);t.default[r]=[]}t.alias[r]=n}));return t}postProcessPositionals(e,t,r,n){const s=Object.assign({},n.getOptions());s.default=Object.assign(r.default,s.default);for(const e of Object.keys(r.alias)){s.alias[e]=(s.alias[e]||[]).concat(r.alias[e])}s.array=s.array.concat(r.array);s.config={};const i=[];Object.keys(t).forEach((e=>{t[e].map((t=>{if(s.configuration["unknown-options-as-args"])s.key[e]=true;i.push(`--${e}`);i.push(t)}))}));if(!i.length)return;const o=Object.assign({},s.configuration,{"populate--":false});const a=this.shim.Parser.detailed(i,Object.assign({},s,{configuration:o}));if(a.error){n.getInternalMethods().getUsageInstance().fail(a.error.message,a.error)}else{const r=Object.keys(t);Object.keys(t).forEach((e=>{r.push(...a.aliases[e])}));Object.keys(a.argv).forEach((s=>{if(r.includes(s)){if(!t[s])t[s]=a.argv[s];if(!this.isInConfigs(n,s)&&!this.isDefaulted(n,s)&&Object.prototype.hasOwnProperty.call(e,s)&&Object.prototype.hasOwnProperty.call(a.argv,s)&&(Array.isArray(e[s])||Array.isArray(a.argv[s]))){e[s]=[].concat(e[s],a.argv[s])}else{e[s]=a.argv[s]}}}))}}isDefaulted(e,t){const{default:r}=e.getOptions();return Object.prototype.hasOwnProperty.call(r,t)||Object.prototype.hasOwnProperty.call(r,this.shim.Parser.camelCase(t))}isInConfigs(e,t){const{configObjects:r}=e.getOptions();return r.some((e=>Object.prototype.hasOwnProperty.call(e,t)))||r.some((e=>Object.prototype.hasOwnProperty.call(e,this.shim.Parser.camelCase(t))))}runDefaultBuilderOn(e){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(e)){const t=ke.test(this.defaultCommand.original)?this.defaultCommand.original:this.defaultCommand.original.replace(/^[^[\]<>]*/,"$0 ");e.getInternalMethods().getUsageInstance().usage(t,this.defaultCommand.description)}const t=this.defaultCommand.builder;if(isCommandBuilderCallback(t)){return t(e,true)}else if(!isCommandBuilderDefinition(t)){Object.keys(t).forEach((r=>{e.option(r,t[r])}))}return undefined}extractDesc({describe:e,description:t,desc:r}){for(const n of[e,t,r]){if(typeof n==="string"||n===false)return n;assertNotStrictEqual(n,true,this.shim)}return false}freeze(){this.frozens.push({handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand})}unfreeze(){const e=this.frozens.pop();assertNotStrictEqual(e,undefined,this.shim);({handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand}=e)}reset(){this.handlers={};this.aliasMap={};this.defaultCommand=undefined;this.requireCache=new Set;return this}}function command(e,t,r,n){return new CommandInstance(e,t,r,n)}function isCommandBuilderDefinition(e){return typeof e==="object"&&!!e.builder&&typeof e.handler==="function"}function isCommandAndAliases(e){return e.every((e=>typeof e==="string"))}function isCommandBuilderCallback(e){return typeof e==="function"}function isCommandBuilderOptionDefinitions(e){return typeof e==="object"}function isCommandHandlerDefinition(e){return typeof e==="object"&&!Array.isArray(e)}function objFilter(e={},t=()=>true){const r={};objectKeys(e).forEach((n=>{if(t(n,e[n])){r[n]=e[n]}}));return r}function setBlocking(e){if(typeof process==="undefined")return;[process.stdout,process.stderr].forEach((t=>{const r=t;if(r._handle&&r.isTTY&&typeof r._handle.setBlocking==="function"){r._handle.setBlocking(e)}}))}function isBoolean(e){return typeof e==="boolean"}function usage(e,t){const r=t.y18n.__;const n={};const s=[];n.failFn=function failFn(e){s.push(e)};let i=null;let o=null;let a=true;n.showHelpOnFail=function showHelpOnFailFn(t=true,r){const[s,c]=typeof t==="string"?[true,t]:[t,r];if(e.getInternalMethods().isGlobalContext()){o=c}i=c;a=s;return n};let c=false;n.fail=function fail(t,r){const l=e.getInternalMethods().getLoggerInstance();if(s.length){for(let e=s.length-1;e>=0;--e){const i=s[e];if(isBoolean(i)){if(r)throw r;else if(t)throw Error(t)}else{i(t,r,n)}}}else{if(e.getExitProcess())setBlocking(true);if(!c){c=true;if(a){e.showHelp("error");l.error()}if(t||r)l.error(t||r);const n=i||o;if(n){if(t||r)l.error("");l.error(n)}}r=r||new YError(t);if(e.getExitProcess()){return e.exit(1)}else if(e.getInternalMethods().hasParseCallback()){return e.exit(1,r)}else{throw r}}};let l=[];let A=false;n.usage=(e,t)=>{if(e===null){A=true;l=[];return n}A=false;l.push([e,t||""]);return n};n.getUsage=()=>l;n.getUsageDisabled=()=>A;n.getPositionalGroupName=()=>r("Positionals:");let u=[];n.example=(e,t)=>{u.push([e,t||""])};let d=[];n.command=function command(e,t,r,n,s=false){if(r){d=d.map((e=>{e[2]=false;return e}))}d.push([e,t||"",r,n,s])};n.getCommands=()=>d;let g={};n.describe=function describe(e,t){if(Array.isArray(e)){e.forEach((e=>{n.describe(e,t)}))}else if(typeof e==="object"){Object.keys(e).forEach((t=>{n.describe(t,e[t])}))}else{g[e]=t}};n.getDescriptions=()=>g;let p=[];n.epilog=e=>{p.push(e)};let h=false;let m;n.wrap=e=>{h=true;m=e};n.getWrap=()=>{if(t.getEnv("YARGS_DISABLE_WRAP")){return null}if(!h){m=windowWidth();h=true}return m};const f="__yargsString__:";n.deferY18nLookup=e=>f+e;n.help=function help(){if(C)return C;normalizeAliases();const s=e.customScriptName?e.$0:t.path.basename(e.$0);const i=e.getDemandedOptions();const o=e.getDemandedCommands();const a=e.getDeprecatedOptions();const c=e.getGroups();const h=e.getOptions();let m=[];m=m.concat(Object.keys(g));m=m.concat(Object.keys(i));m=m.concat(Object.keys(o));m=m.concat(Object.keys(h.default));m=m.filter(filterHiddenOptions);m=Object.keys(m.reduce(((e,t)=>{if(t!=="_")e[t]=true;return e}),{}));const y=n.getWrap();const E=t.cliui({width:y,wrap:!!y});if(!A){if(l.length){l.forEach((e=>{E.div({text:`${e[0].replace(/\$0/g,s)}`});if(e[1]){E.div({text:`${e[1]}`,padding:[1,0,0,0]})}}));E.div()}else if(d.length){let e=null;if(o._){e=`${s} <${r("command")}>\n`}else{e=`${s} [${r("command")}]\n`}E.div(`${e}`)}}if(d.length>1||d.length===1&&!d[0][2]){E.div(r("Commands:"));const t=e.getInternalMethods().getContext();const n=t.commands.length?`${t.commands.join(" ")} `:"";if(e.getInternalMethods().getParserConfiguration()["sort-commands"]===true){d=d.sort(((e,t)=>e[0].localeCompare(t[0])))}const i=s?`${s} `:"";d.forEach((e=>{const t=`${i}${n}${e[0].replace(/^\$0 ?/,"")}`;E.span({text:t,padding:[0,2,0,2],width:maxWidth(d,y,`${s}${n}`)+4},{text:e[1]});const o=[];if(e[2])o.push(`[${r("default")}]`);if(e[3]&&e[3].length){o.push(`[${r("aliases:")} ${e[3].join(", ")}]`)}if(e[4]){if(typeof e[4]==="string"){o.push(`[${r("deprecated: %s",e[4])}]`)}else{o.push(`[${r("deprecated")}]`)}}if(o.length){E.div({text:o.join(" "),padding:[0,0,0,2],align:"right"})}else{E.div()}}));E.div()}const I=(Object.keys(h.alias)||[]).concat(Object.keys(e.parsed.newAliases)||[]);m=m.filter((t=>!e.parsed.newAliases[t]&&I.every((e=>(h.alias[e]||[]).indexOf(t)===-1))));const B=r("Options:");if(!c[B])c[B]=[];addUngroupedKeys(m,h.alias,c,B);const isLongSwitch=e=>/^--/.test(getText(e));const Q=Object.keys(c).filter((e=>c[e].length>0)).map((e=>{const t=c[e].filter(filterHiddenOptions).map((e=>{if(I.includes(e))return e;for(let t=0,r;(r=I[t])!==undefined;t++){if((h.alias[r]||[]).includes(e))return r}return e}));return{groupName:e,normalizedKeys:t}})).filter((({normalizedKeys:e})=>e.length>0)).map((({groupName:e,normalizedKeys:t})=>{const r=t.reduce(((t,r)=>{t[r]=[r].concat(h.alias[r]||[]).map((t=>{if(e===n.getPositionalGroupName())return t;else{return(/^[0-9]$/.test(t)?h.boolean.includes(r)?"-":"--":t.length>1?"--":"-")+t}})).sort(((e,t)=>isLongSwitch(e)===isLongSwitch(t)?0:isLongSwitch(e)?1:-1)).join(", ");return t}),{});return{groupName:e,normalizedKeys:t,switches:r}}));const b=Q.filter((({groupName:e})=>e!==n.getPositionalGroupName())).some((({normalizedKeys:e,switches:t})=>!e.every((e=>isLongSwitch(t[e])))));if(b){Q.filter((({groupName:e})=>e!==n.getPositionalGroupName())).forEach((({normalizedKeys:e,switches:t})=>{e.forEach((e=>{if(isLongSwitch(t[e])){t[e]=addIndentation(t[e],"-x, ".length)}}))}))}Q.forEach((({groupName:t,normalizedKeys:s,switches:o})=>{E.div(t);s.forEach((t=>{const s=o[t];let c=g[t]||"";let l=null;if(c.includes(f))c=r(c.substring(f.length));if(h.boolean.includes(t))l=`[${r("boolean")}]`;if(h.count.includes(t))l=`[${r("count")}]`;if(h.string.includes(t))l=`[${r("string")}]`;if(h.normalize.includes(t))l=`[${r("string")}]`;if(h.array.includes(t))l=`[${r("array")}]`;if(h.number.includes(t))l=`[${r("number")}]`;const deprecatedExtra=e=>typeof e==="string"?`[${r("deprecated: %s",e)}]`:`[${r("deprecated")}]`;const A=[t in a?deprecatedExtra(a[t]):null,l,t in i?`[${r("required")}]`:null,h.choices&&h.choices[t]?`[${r("choices:")} ${n.stringifiedValues(h.choices[t])}]`:null,defaultString(h.default[t],h.defaultDescription[t])].filter(Boolean).join(" ");E.span({text:getText(s),padding:[0,2,0,2+getIndentation(s)],width:maxWidth(o,y)+4},c);const u=e.getInternalMethods().getUsageConfiguration()["hide-types"]===true;if(A&&!u)E.div({text:A,padding:[0,0,0,2],align:"right"});else E.div()}));E.div()}));if(u.length){E.div(r("Examples:"));u.forEach((e=>{e[0]=e[0].replace(/\$0/g,s)}));u.forEach((e=>{if(e[1]===""){E.div({text:e[0],padding:[0,2,0,2]})}else{E.div({text:e[0],padding:[0,2,0,2],width:maxWidth(u,y)+4},{text:e[1]})}}));E.div()}if(p.length>0){const e=p.map((e=>e.replace(/\$0/g,s))).join("\n");E.div(`${e}\n`)}return E.toString().replace(/\s*$/,"")};function maxWidth(e,r,n){let s=0;if(!Array.isArray(e)){e=Object.values(e).map((e=>[e]))}e.forEach((e=>{s=Math.max(t.stringWidth(n?`${n} ${getText(e[0])}`:getText(e[0]))+getIndentation(e[0]),s)}));if(r)s=Math.min(s,parseInt((r*.5).toString(),10));return s}function normalizeAliases(){const t=e.getDemandedOptions();const r=e.getOptions();(Object.keys(r.alias)||[]).forEach((s=>{r.alias[s].forEach((i=>{if(g[i])n.describe(s,g[i]);if(i in t)e.demandOption(s,t[i]);if(r.boolean.includes(i))e.boolean(s);if(r.count.includes(i))e.count(s);if(r.string.includes(i))e.string(s);if(r.normalize.includes(i))e.normalize(s);if(r.array.includes(i))e.array(s);if(r.number.includes(i))e.number(s)}))}))}let C;n.cacheHelpMessage=function(){C=this.help()};n.clearCachedHelpMessage=function(){C=undefined};n.hasCachedHelpMessage=function(){return!!C};function addUngroupedKeys(e,t,r,n){let s=[];let i=null;Object.keys(r).forEach((e=>{s=s.concat(r[e])}));e.forEach((e=>{i=[e].concat(t[e]);if(!i.some((e=>s.indexOf(e)!==-1))){r[n].push(e)}}));return s}function filterHiddenOptions(t){return e.getOptions().hiddenOptions.indexOf(t)<0||e.parsed.argv[e.getOptions().showHiddenOpt]}n.showHelp=t=>{const r=e.getInternalMethods().getLoggerInstance();if(!t)t="error";const s=typeof t==="function"?t:r[t];s(n.help())};n.functionDescription=e=>{const n=e.name?t.Parser.decamelize(e.name,"-"):r("generated-value");return["(",n,")"].join("")};n.stringifiedValues=function stringifiedValues(e,t){let r="";const n=t||", ";const s=[].concat(e);if(!e||!s.length)return r;s.forEach((e=>{if(r.length)r+=n;r+=JSON.stringify(e)}));return r};function defaultString(e,t){let n=`[${r("default:")} `;if(e===undefined&&!t)return null;if(t){n+=t}else{switch(typeof e){case"string":n+=`"${e}"`;break;case"object":n+=JSON.stringify(e);break;default:n+=e}}return`${n}]`}function windowWidth(){const e=80;if(t.process.stdColumns){return Math.min(e,t.process.stdColumns)}else{return e}}let y=null;n.version=e=>{y=e};n.showVersion=t=>{const r=e.getInternalMethods().getLoggerInstance();if(!t)t="error";const n=typeof t==="function"?t:r[t];n(y)};n.reset=function reset(e){i=null;c=false;l=[];A=false;p=[];u=[];d=[];g=objFilter(g,(t=>!e[t]));return n};const E=[];n.freeze=function freeze(){E.push({failMessage:i,failureOutput:c,usages:l,usageDisabled:A,epilogs:p,examples:u,commands:d,descriptions:g})};n.unfreeze=function unfreeze(e=false){const t=E.pop();if(!t)return;if(e){g={...t.descriptions,...g};d=[...t.commands,...d];l=[...t.usages,...l];u=[...t.examples,...u];p=[...t.epilogs,...p]}else{({failMessage:i,failureOutput:c,usages:l,usageDisabled:A,epilogs:p,examples:u,commands:d,descriptions:g}=t)}};return n}function isIndentedText(e){return typeof e==="object"}function addIndentation(e,t){return isIndentedText(e)?{text:e.text,indentation:e.indentation+t}:{text:e,indentation:t}}function getIndentation(e){return isIndentedText(e)?e.indentation:0}function getText(e){return isIndentedText(e)?e.text:e}const Fe=`###-begin-{{app_name}}-completions-###\n#\n# yargs command completion script\n#\n# Installation: {{app_path}} {{completion_command}} >> ~/.bashrc\n# or {{app_path}} {{completion_command}} >> ~/.bash_profile on OSX.\n#\n_{{app_name}}_yargs_completions()\n{\n local cur_word args type_list\n\n cur_word="\${COMP_WORDS[COMP_CWORD]}"\n args=("\${COMP_WORDS[@]}")\n\n # ask yargs to generate completions.\n # see https://stackoverflow.com/a/40944195/7080036 for the spaces-handling awk\n mapfile -t type_list < <({{app_path}} --get-yargs-completions "\${args[@]}")\n mapfile -t COMPREPLY < <(compgen -W "$( printf '%q ' "\${type_list[@]}" )" -- "\${cur_word}" |\n awk '/ / { print "\\""$0"\\"" } /^[^ ]+$/ { print $0 }')\n\n # if no match was found, fall back to filename completion\n if [ \${#COMPREPLY[@]} -eq 0 ]; then\n COMPREPLY=()\n fi\n\n return 0\n}\ncomplete -o bashdefault -o default -F _{{app_name}}_yargs_completions {{app_name}}\n###-end-{{app_name}}-completions-###\n`;const Te=`#compdef {{app_name}}\n###-begin-{{app_name}}-completions-###\n#\n# yargs command completion script\n#\n# Installation: {{app_path}} {{completion_command}} >> ~/.zshrc\n# or {{app_path}} {{completion_command}} >> ~/.zprofile on OSX.\n#\n_{{app_name}}_yargs_completions()\n{\n local reply\n local si=$IFS\n IFS=$'\n' reply=($(COMP_CWORD="$((CURRENT-1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" {{app_path}} --get-yargs-completions "\${words[@]}"))\n IFS=$si\n if [[ \${#reply} -gt 0 ]]; then\n _describe 'values' reply\n else\n _default\n fi\n}\nif [[ "'\${zsh_eval_context[-1]}" == "loadautofunc" ]]; then\n _{{app_name}}_yargs_completions "$@"\nelse\n compdef _{{app_name}}_yargs_completions {{app_name}}\nfi\n###-end-{{app_name}}-completions-###\n`;class Completion{constructor(e,t,r,n){var s,i,o;this.yargs=e;this.usage=t;this.command=r;this.shim=n;this.completionKey="get-yargs-completions";this.aliases=null;this.customCompletionFunction=null;this.indexAfterLastReset=0;this.zshShell=(o=((s=this.shim.getEnv("SHELL"))===null||s===void 0?void 0:s.includes("zsh"))||((i=this.shim.getEnv("ZSH_NAME"))===null||i===void 0?void 0:i.includes("zsh")))!==null&&o!==void 0?o:false}defaultCompletion(e,t,r,n){const s=this.command.getCommandHandlers();for(let t=0,r=e.length;t{const n=parseCommand(r[0]).cmd;if(t.indexOf(n)===-1){if(!this.zshShell){e.push(n)}else{const t=r[1]||"";e.push(n.replace(/:/g,"\\:")+":"+t)}}}))}}optionCompletions(e,t,r,n){if((n.match(/^-/)||n===""&&e.length===0)&&!this.previousArgHasChoices(t)){const r=this.yargs.getOptions();const s=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[];Object.keys(r.key).forEach((i=>{const o=!!r.configuration["boolean-negation"]&&r.boolean.includes(i);const a=s.includes(i);if(!a&&!r.hiddenOptions.includes(i)&&!this.argsContainKey(t,i,o)){this.completeOptionKey(i,e,n,o&&!!r.default[i])}}))}}choicesFromOptionsCompletions(e,t,r,n){if(this.previousArgHasChoices(t)){const r=this.getPreviousArgChoices(t);if(r&&r.length>0){e.push(...r.map((e=>e.replace(/:/g,"\\:"))))}}}choicesFromPositionalsCompletions(e,t,r,n){if(n===""&&e.length>0&&this.previousArgHasChoices(t)){return}const s=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[];const i=Math.max(this.indexAfterLastReset,this.yargs.getInternalMethods().getContext().commands.length+1);const o=s[r._.length-i-1];if(!o){return}const a=this.yargs.getOptions().choices[o]||[];for(const t of a){if(t.startsWith(n)){e.push(t.replace(/:/g,"\\:"))}}}getPreviousArgChoices(e){if(e.length<1)return;let t=e[e.length-1];let r="";if(!t.startsWith("-")&&e.length>1){r=t;t=e[e.length-2]}if(!t.startsWith("-"))return;const n=t.replace(/^-+/,"");const s=this.yargs.getOptions();const i=[n,...this.yargs.getAliases()[n]||[]];let o;for(const e of i){if(Object.prototype.hasOwnProperty.call(s.key,e)&&Array.isArray(s.choices[e])){o=s.choices[e];break}}if(o){return o.filter((e=>!r||e.startsWith(r)))}}previousArgHasChoices(e){const t=this.getPreviousArgChoices(e);return t!==undefined&&t.length>0}argsContainKey(e,t,r){const argsContains=t=>e.indexOf((/^[^0-9]$/.test(t)?"-":"--")+t)!==-1;if(argsContains(t))return true;if(r&&argsContains(`no-${t}`))return true;if(this.aliases){for(const e of this.aliases[t]){if(argsContains(e))return true}}return false}completeOptionKey(e,t,r,n){var s,i,o,a;let c=e;if(this.zshShell){const t=this.usage.getDescriptions();const r=(i=(s=this===null||this===void 0?void 0:this.aliases)===null||s===void 0?void 0:s[e])===null||i===void 0?void 0:i.find((e=>{const r=t[e];return typeof r==="string"&&r.length>0}));const n=r?t[r]:undefined;const l=(a=(o=t[e])!==null&&o!==void 0?o:n)!==null&&a!==void 0?a:"";c=`${e.replace(/:/g,"\\:")}:${l.replace("__yargsString__:","").replace(/(\r\n|\n|\r)/gm," ")}`}const startsByTwoDashes=e=>/^--/.test(e);const isShortOption=e=>/^[^0-9]$/.test(e);const l=!startsByTwoDashes(r)&&isShortOption(e)?"-":"--";t.push(l+c);if(n){t.push(l+"no-"+c)}}customCompletion(e,t,r,n){assertNotStrictEqual(this.customCompletionFunction,null,this.shim);if(isSyncCompletionFunction(this.customCompletionFunction)){const e=this.customCompletionFunction(r,t);if(isPromise(e)){return e.then((e=>{this.shim.process.nextTick((()=>{n(null,e)}))})).catch((e=>{this.shim.process.nextTick((()=>{n(e,undefined)}))}))}return n(null,e)}else if(isFallbackCompletionFunction(this.customCompletionFunction)){return this.customCompletionFunction(r,t,((s=n)=>this.defaultCompletion(e,t,r,s)),(e=>{n(null,e)}))}else{return this.customCompletionFunction(r,t,(e=>{n(null,e)}))}}getCompletion(e,t){const r=e.length?e[e.length-1]:"";const n=this.yargs.parse(e,true);const s=this.customCompletionFunction?n=>this.customCompletion(e,n,r,t):n=>this.defaultCompletion(e,n,r,t);return isPromise(n)?n.then(s):s(n)}generateCompletionScript(e,t){let r=this.zshShell?Te:Fe;const n=this.shim.path.basename(e);if(e.match(/\.js$/))e=`./${e}`;r=r.replace(/{{app_name}}/g,n);r=r.replace(/{{completion_command}}/g,t);return r.replace(/{{app_path}}/g,e)}registerFunction(e){this.customCompletionFunction=e}setParsed(e){this.aliases=e.aliases}}function completion(e,t,r,n){return new Completion(e,t,r,n)}function isSyncCompletionFunction(e){return e.length<3}function isFallbackCompletionFunction(e){return e.length>3}function levenshtein(e,t){if(e.length===0)return t.length;if(t.length===0)return e.length;const r=[];let n;for(n=0;n<=t.length;n++){r[n]=[n]}let s;for(s=0;s<=e.length;s++){r[0][s]=s}for(n=1;n<=t.length;n++){for(s=1;s<=e.length;s++){if(t.charAt(n-1)===e.charAt(s-1)){r[n][s]=r[n-1][s-1]}else{if(n>1&&s>1&&t.charAt(n-2)===e.charAt(s-1)&&t.charAt(n-1)===e.charAt(s-2)){r[n][s]=r[n-2][s-2]+1}else{r[n][s]=Math.min(r[n-1][s-1]+1,Math.min(r[n][s-1]+1,r[n-1][s]+1))}}}}return r[t.length][e.length]}const Me=["$0","--","_"];function validation(e,t,r){const n=r.y18n.__;const s=r.y18n.__n;const i={};i.nonOptionCount=function nonOptionCount(r){const n=e.getDemandedCommands();const i=r._.length+(r["--"]?r["--"].length:0);const o=i-e.getInternalMethods().getContext().commands.length;if(n._&&(on._.max)){if(on._.max){if(n._.maxMsg!==undefined){t.fail(n._.maxMsg?n._.maxMsg.replace(/\$0/g,o.toString()).replace(/\$1/,n._.max.toString()):null)}else{t.fail(s("Too many non-option arguments: got %s, maximum of %s","Too many non-option arguments: got %s, maximum of %s",o,o.toString(),n._.max.toString()))}}}};i.positionalCount=function positionalCount(e,r){if(r{if(!Me.includes(t)&&!Object.prototype.hasOwnProperty.call(o,t)&&!Object.prototype.hasOwnProperty.call(e.getInternalMethods().getParseContext(),t)&&!i.isValidAndSomeAliasIsNotNew(t,n)){u.push(t)}}));if(c&&(d.commands.length>0||A.length>0||a)){r._.slice(d.commands.length).forEach((e=>{if(!A.includes(""+e)){u.push(""+e)}}))}if(c){const t=e.getDemandedCommands();const n=((l=t._)===null||l===void 0?void 0:l.max)||0;const s=d.commands.length+n;if(s{e=String(e);if(!d.commands.includes(e)&&!u.includes(e)){u.push(e)}}))}}if(u.length){t.fail(s("Unknown argument: %s","Unknown arguments: %s",u.length,u.map((e=>e.trim()?e:`"${e}"`)).join(", ")))}};i.unknownCommands=function unknownCommands(r){const n=e.getInternalMethods().getCommandInstance().getCommands();const i=[];const o=e.getInternalMethods().getContext();if(o.commands.length>0||n.length>0){r._.slice(o.commands.length).forEach((e=>{if(!n.includes(""+e)){i.push(""+e)}}))}if(i.length>0){t.fail(s("Unknown command: %s","Unknown commands: %s",i.length,i.join(", ")));return true}else{return false}};i.isValidAndSomeAliasIsNotNew=function isValidAndSomeAliasIsNotNew(t,r){if(!Object.prototype.hasOwnProperty.call(r,t)){return false}const n=e.parsed.newAliases;return[t,...r[t]].some((e=>!Object.prototype.hasOwnProperty.call(n,e)||!n[t]))};i.limitedChoices=function limitedChoices(r){const s=e.getOptions();const i={};if(!Object.keys(s.choices).length)return;Object.keys(r).forEach((e=>{if(Me.indexOf(e)===-1&&Object.prototype.hasOwnProperty.call(s.choices,e)){[].concat(r[e]).forEach((t=>{if(s.choices[e].indexOf(t)===-1&&t!==undefined){i[e]=(i[e]||[]).concat(t)}}))}}));const o=Object.keys(i);if(!o.length)return;let a=n("Invalid values:");o.forEach((e=>{a+=`\n ${n("Argument: %s, Given: %s, Choices: %s",e,t.stringifiedValues(i[e]),t.stringifiedValues(s.choices[e]))}`}));t.fail(a)};let o={};i.implies=function implies(t,n){argsert(" [array|number|string]",[t,n],arguments.length);if(typeof t==="object"){Object.keys(t).forEach((e=>{i.implies(e,t[e])}))}else{e.global(t);if(!o[t]){o[t]=[]}if(Array.isArray(n)){n.forEach((e=>i.implies(t,e)))}else{assertNotStrictEqual(n,undefined,r);o[t].push(n)}}};i.getImplied=function getImplied(){return o};function keyExists(e,t){const r=Number(t);t=isNaN(r)?t:r;if(typeof t==="number"){t=e._.length>=t}else if(t.match(/^--no-.+/)){t=t.match(/^--no-(.+)/)[1];t=!Object.prototype.hasOwnProperty.call(e,t)}else{t=Object.prototype.hasOwnProperty.call(e,t)}return t}i.implications=function implications(e){const r=[];Object.keys(o).forEach((t=>{const n=t;(o[t]||[]).forEach((t=>{let s=n;const i=t;s=keyExists(e,s);t=keyExists(e,t);if(s&&!t){r.push(` ${n} -> ${i}`)}}))}));if(r.length){let e=`${n("Implications failed:")}\n`;r.forEach((t=>{e+=t}));t.fail(e)}};let a={};i.conflicts=function conflicts(t,r){argsert(" [array|string]",[t,r],arguments.length);if(typeof t==="object"){Object.keys(t).forEach((e=>{i.conflicts(e,t[e])}))}else{e.global(t);if(!a[t]){a[t]=[]}if(Array.isArray(r)){r.forEach((e=>i.conflicts(t,e)))}else{a[t].push(r)}}};i.getConflicting=()=>a;i.conflicting=function conflictingFn(s){Object.keys(s).forEach((e=>{if(a[e]){a[e].forEach((r=>{if(r&&s[e]!==undefined&&s[r]!==undefined){t.fail(n("Arguments %s and %s are mutually exclusive",e,r))}}))}}));if(e.getInternalMethods().getParserConfiguration()["strip-dashed"]){Object.keys(a).forEach((e=>{a[e].forEach((i=>{if(i&&s[r.Parser.camelCase(e)]!==undefined&&s[r.Parser.camelCase(i)]!==undefined){t.fail(n("Arguments %s and %s are mutually exclusive",e,i))}}))}))}};i.recommendCommands=function recommendCommands(e,r){const s=3;r=r.sort(((e,t)=>t.length-e.length));let i=null;let o=Infinity;for(let t=0,n;(n=r[t])!==undefined;t++){const t=levenshtein(e,n);if(t<=s&&t!e[t]));a=objFilter(a,(t=>!e[t]));return i};const c=[];i.freeze=function freeze(){c.push({implied:o,conflicting:a})};i.unfreeze=function unfreeze(){const e=c.pop();assertNotStrictEqual(e,undefined,r);({implied:o,conflicting:a}=e)};return i}let Pe=[];let Le;function applyExtends(e,t,r,n){Le=n;let s={};if(Object.prototype.hasOwnProperty.call(e,"extends")){if(typeof e.extends!=="string")return s;const i=/\.json|\..*rc$/.test(e.extends);let o=null;if(!i){try{o=import.meta.resolve(e.extends)}catch(t){return e}}else{o=getPathToDefaultConfig(t,e.extends)}checkForCircularExtends(o);Pe.push(o);s=i?JSON.parse(Le.readFileSync(o,"utf8")):n.require(e.extends);delete e.extends;s=applyExtends(s,Le.path.dirname(o),r,Le)}Pe=[];return r?mergeDeep(s,e):Object.assign({},s,e)}function checkForCircularExtends(e){if(Pe.indexOf(e)>-1){throw new YError(`Circular extended configurations: '${e}'.`)}}function getPathToDefaultConfig(e,t){return Le.path.resolve(e,t)}function mergeDeep(e,t){const r={};function isObject(e){return e&&typeof e==="object"&&!Array.isArray(e)}Object.assign(r,e);for(const n of Object.keys(t)){if(n==="__proto__")continue;if(isObject(t[n])&&isObject(r[n])){r[n]=mergeDeep(e[n],t[n])}else{r[n]=t[n]}}return r}var Ue=undefined&&undefined.__classPrivateFieldSet||function(e,t,r,n,s){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof t==="function"?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?s.call(e,r):s?s.value=r:t.set(e,r),r};var Oe=undefined&&undefined.__classPrivateFieldGet||function(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t==="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)};var He,_e,qe,Ge,ze,Ye,Ve,Je,We,je,Ke,$e,Xe,Ze,et,tt,rt,nt,st,it,ot,at,ct,At,ut,dt,pt,ht,mt,ft,Ct,yt,Et,It,Bt;function YargsFactory(e){return(t=[],r=e.process.cwd(),n)=>{const s=new YargsInstance(t,r,n,e);Object.defineProperty(s,"argv",{get:()=>s.parse(),enumerable:true});s.help();s.version();return s}}const Qt=Symbol("copyDoubleDash");const bt=Symbol("copyDoubleDash");const St=Symbol("deleteFromParserHintObject");const wt=Symbol("emitWarning");const Dt=Symbol("freeze");const Nt=Symbol("getDollarZero");const xt=Symbol("getParserConfiguration");const Rt=Symbol("getUsageConfiguration");const vt=Symbol("guessLocale");const kt=Symbol("guessVersion");const Ft=Symbol("parsePositionalNumbers");const Tt=Symbol("pkgUp");const Mt=Symbol("populateParserHintArray");const Pt=Symbol("populateParserHintSingleValueDictionary");const Lt=Symbol("populateParserHintArrayDictionary");const Ut=Symbol("populateParserHintDictionary");const Ot=Symbol("sanitizeKey");const Ht=Symbol("setKey");const _t=Symbol("unfreeze");const qt=Symbol("validateAsync");const Gt=Symbol("getCommandInstance");const zt=Symbol("getContext");const Yt=Symbol("getHasOutput");const Vt=Symbol("getLoggerInstance");const Jt=Symbol("getParseContext");const Wt=Symbol("getUsageInstance");const jt=Symbol("getValidationInstance");const Kt=Symbol("hasParseCallback");const $t=Symbol("isGlobalContext");const Xt=Symbol("postProcess");const Zt=Symbol("rebase");const er=Symbol("reset");const tr=Symbol("runYargsParserAndExecuteCommands");const rr=Symbol("runValidation");const nr=Symbol("setHasOutput");const sr=Symbol("kTrackManuallySetKeys");const ir="en_US";class YargsInstance{constructor(e=[],t,r,n){this.customScriptName=false;this.parsed=false;He.set(this,void 0);_e.set(this,void 0);qe.set(this,{commands:[],fullCommands:[]});Ge.set(this,null);ze.set(this,null);Ye.set(this,"show-hidden");Ve.set(this,null);Je.set(this,true);We.set(this,{});je.set(this,true);Ke.set(this,[]);$e.set(this,void 0);Xe.set(this,{});Ze.set(this,false);et.set(this,null);tt.set(this,true);rt.set(this,void 0);nt.set(this,"");st.set(this,void 0);it.set(this,void 0);ot.set(this,{});at.set(this,null);ct.set(this,null);At.set(this,{});ut.set(this,{});dt.set(this,void 0);pt.set(this,false);ht.set(this,void 0);mt.set(this,false);ft.set(this,false);Ct.set(this,false);yt.set(this,void 0);Et.set(this,{});It.set(this,null);Bt.set(this,void 0);Ue(this,ht,n,"f");Ue(this,dt,e,"f");Ue(this,_e,t,"f");Ue(this,it,r,"f");Ue(this,$e,new GlobalMiddleware(this),"f");this.$0=this[Nt]();this[er]();Ue(this,He,Oe(this,He,"f"),"f");Ue(this,yt,Oe(this,yt,"f"),"f");Ue(this,Bt,Oe(this,Bt,"f"),"f");Ue(this,st,Oe(this,st,"f"),"f");Oe(this,st,"f").showHiddenOpt=Oe(this,Ye,"f");Ue(this,rt,this[bt](),"f");Oe(this,ht,"f").y18n.setLocale(ir)}addHelpOpt(e,t){const r="help";argsert("[string|boolean] [string]",[e,t],arguments.length);if(Oe(this,et,"f")){this[St](Oe(this,et,"f"));Ue(this,et,null,"f")}if(e===false&&t===undefined)return this;Ue(this,et,typeof e==="string"?e:r,"f");this.boolean(Oe(this,et,"f"));this.describe(Oe(this,et,"f"),t||Oe(this,yt,"f").deferY18nLookup("Show help"));return this}help(e,t){return this.addHelpOpt(e,t)}addShowHiddenOpt(e,t){argsert("[string|boolean] [string]",[e,t],arguments.length);if(e===false&&t===undefined)return this;const r=typeof e==="string"?e:Oe(this,Ye,"f");this.boolean(r);this.describe(r,t||Oe(this,yt,"f").deferY18nLookup("Show hidden options"));Oe(this,st,"f").showHiddenOpt=r;return this}showHidden(e,t){return this.addShowHiddenOpt(e,t)}alias(e,t){argsert(" [string|array]",[e,t],arguments.length);this[Lt](this.alias.bind(this),"alias",e,t);return this}array(e){argsert("",[e],arguments.length);this[Mt]("array",e);this[sr](e);return this}boolean(e){argsert("",[e],arguments.length);this[Mt]("boolean",e);this[sr](e);return this}check(e,t){argsert(" [boolean]",[e,t],arguments.length);this.middleware(((t,r)=>maybeAsyncResult((()=>e(t,r.getOptions())),(r=>{if(!r){Oe(this,yt,"f").fail(Oe(this,ht,"f").y18n.__("Argument check failed: %s",e.toString()))}else if(typeof r==="string"||r instanceof Error){Oe(this,yt,"f").fail(r.toString(),r)}return t}),(e=>{Oe(this,yt,"f").fail(e.message?e.message:e.toString(),e);return t}))),false,t);return this}choices(e,t){argsert(" [string|array]",[e,t],arguments.length);this[Lt](this.choices.bind(this),"choices",e,t);return this}coerce(e,t){argsert(" [function]",[e,t],arguments.length);if(Array.isArray(e)){if(!t){throw new YError("coerce callback must be provided")}for(const r of e){this.coerce(r,t)}return this}else if(typeof e==="object"){for(const t of Object.keys(e)){this.coerce(t,e[t])}return this}if(!t){throw new YError("coerce callback must be provided")}const r=e;Oe(this,st,"f").key[r]=true;Oe(this,$e,"f").addCoerceMiddleware(((e,n)=>{var s;const i=(s=n.getAliases()[r])!==null&&s!==void 0?s:[];const o=[r,...i].filter((t=>Object.prototype.hasOwnProperty.call(e,t)));if(o.length===0){return e}return maybeAsyncResult((()=>t(e[o[0]])),(t=>{o.forEach((r=>{e[r]=t}));return e}),(e=>{throw new YError(e.message)}))}),r);return this}conflicts(e,t){argsert(" [string|array]",[e,t],arguments.length);Oe(this,Bt,"f").conflicts(e,t);return this}config(e="config",t,r){argsert("[object|string] [string|function] [function]",[e,t,r],arguments.length);if(typeof e==="object"&&!Array.isArray(e)){e=applyExtends(e,Oe(this,_e,"f"),this[xt]()["deep-merge-config"]||false,Oe(this,ht,"f"));Oe(this,st,"f").configObjects=(Oe(this,st,"f").configObjects||[]).concat(e);return this}if(typeof t==="function"){r=t;t=undefined}this.describe(e,t||Oe(this,yt,"f").deferY18nLookup("Path to JSON config file"));(Array.isArray(e)?e:[e]).forEach((e=>{Oe(this,st,"f").config[e]=r||true}));return this}completion(e,t,r){argsert("[string] [string|boolean|function] [function]",[e,t,r],arguments.length);if(typeof t==="function"){r=t;t=undefined}Ue(this,ze,e||Oe(this,ze,"f")||"completion","f");if(!t&&t!==false){t="generate completion script"}this.command(Oe(this,ze,"f"),t);if(r)Oe(this,Ge,"f").registerFunction(r);return this}command(e,t,r,n,s,i){argsert(" [string|boolean] [function|object] [function] [array] [boolean|string]",[e,t,r,n,s,i],arguments.length);Oe(this,He,"f").addHandler(e,t,r,n,s,i);return this}commands(e,t,r,n,s,i){return this.command(e,t,r,n,s,i)}commandDir(e,t){argsert(" [object]",[e,t],arguments.length);const r=Oe(this,it,"f")||Oe(this,ht,"f").require;Oe(this,He,"f").addDirectory(e,r,Oe(this,ht,"f").getCallerFile(),t);return this}count(e){argsert("",[e],arguments.length);this[Mt]("count",e);this[sr](e);return this}default(e,t,r){argsert(" [*] [string]",[e,t,r],arguments.length);if(r){assertSingleKey(e,Oe(this,ht,"f"));Oe(this,st,"f").defaultDescription[e]=r}if(typeof t==="function"){assertSingleKey(e,Oe(this,ht,"f"));if(!Oe(this,st,"f").defaultDescription[e])Oe(this,st,"f").defaultDescription[e]=Oe(this,yt,"f").functionDescription(t);t=t.call()}this[Pt](this.default.bind(this),"default",e,t);return this}defaults(e,t,r){return this.default(e,t,r)}demandCommand(e=1,t,r,n){argsert("[number] [number|string] [string|null|undefined] [string|null|undefined]",[e,t,r,n],arguments.length);if(typeof t!=="number"){r=t;t=Infinity}this.global("_",false);Oe(this,st,"f").demandedCommands._={min:e,max:t,minMsg:r,maxMsg:n};return this}demand(e,t,r){if(Array.isArray(t)){t.forEach((e=>{assertNotStrictEqual(r,true,Oe(this,ht,"f"));this.demandOption(e,r)}));t=Infinity}else if(typeof t!=="number"){r=t;t=Infinity}if(typeof e==="number"){assertNotStrictEqual(r,true,Oe(this,ht,"f"));this.demandCommand(e,t,r,r)}else if(Array.isArray(e)){e.forEach((e=>{assertNotStrictEqual(r,true,Oe(this,ht,"f"));this.demandOption(e,r)}))}else{if(typeof r==="string"){this.demandOption(e,r)}else if(r===true||typeof r==="undefined"){this.demandOption(e)}}return this}demandOption(e,t){argsert(" [string]",[e,t],arguments.length);this[Pt](this.demandOption.bind(this),"demandedOptions",e,t);return this}deprecateOption(e,t){argsert(" [string|boolean]",[e,t],arguments.length);Oe(this,st,"f").deprecatedOptions[e]=t;return this}describe(e,t){argsert(" [string]",[e,t],arguments.length);this[Ht](e,true);Oe(this,yt,"f").describe(e,t);return this}detectLocale(e){argsert("",[e],arguments.length);Ue(this,Je,e,"f");return this}env(e){argsert("[string|boolean]",[e],arguments.length);if(e===false)delete Oe(this,st,"f").envPrefix;else Oe(this,st,"f").envPrefix=e||"";return this}epilogue(e){argsert("",[e],arguments.length);Oe(this,yt,"f").epilog(e);return this}epilog(e){return this.epilogue(e)}example(e,t){argsert(" [string]",[e,t],arguments.length);if(Array.isArray(e)){e.forEach((e=>this.example(...e)))}else{Oe(this,yt,"f").example(e,t)}return this}exit(e,t){Ue(this,Ze,true,"f");Ue(this,Ve,t,"f");if(Oe(this,je,"f"))Oe(this,ht,"f").process.exit(e)}exitProcess(e=true){argsert("[boolean]",[e],arguments.length);Ue(this,je,e,"f");return this}fail(e){argsert("",[e],arguments.length);if(typeof e==="boolean"&&e!==false){throw new YError("Invalid first argument. Expected function or boolean 'false'")}Oe(this,yt,"f").failFn(e);return this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(e,t){argsert(" [function]",[e,t],arguments.length);if(!t){return new Promise(((t,r)=>{Oe(this,Ge,"f").getCompletion(e,((e,n)=>{if(e)r(e);else t(n)}))}))}else{return Oe(this,Ge,"f").getCompletion(e,t)}}getDemandedOptions(){argsert([],0);return Oe(this,st,"f").demandedOptions}getDemandedCommands(){argsert([],0);return Oe(this,st,"f").demandedCommands}getDeprecatedOptions(){argsert([],0);return Oe(this,st,"f").deprecatedOptions}getDetectLocale(){return Oe(this,Je,"f")}getExitProcess(){return Oe(this,je,"f")}getGroups(){return Object.assign({},Oe(this,Xe,"f"),Oe(this,ut,"f"))}getHelp(){Ue(this,Ze,true,"f");if(!Oe(this,yt,"f").hasCachedHelpMessage()){if(!this.parsed){const e=this[tr](Oe(this,dt,"f"),undefined,undefined,0,true);if(isPromise(e)){return e.then((()=>Oe(this,yt,"f").help()))}}const e=Oe(this,He,"f").runDefaultBuilderOn(this);if(isPromise(e)){return e.then((()=>Oe(this,yt,"f").help()))}}return Promise.resolve(Oe(this,yt,"f").help())}getOptions(){return Oe(this,st,"f")}getStrict(){return Oe(this,mt,"f")}getStrictCommands(){return Oe(this,ft,"f")}getStrictOptions(){return Oe(this,Ct,"f")}global(e,t){argsert(" [boolean]",[e,t],arguments.length);e=[].concat(e);if(t!==false){Oe(this,st,"f").local=Oe(this,st,"f").local.filter((t=>e.indexOf(t)===-1))}else{e.forEach((e=>{if(!Oe(this,st,"f").local.includes(e))Oe(this,st,"f").local.push(e)}))}return this}group(e,t){argsert(" ",[e,t],arguments.length);const r=Oe(this,ut,"f")[t]||Oe(this,Xe,"f")[t];if(Oe(this,ut,"f")[t]){delete Oe(this,ut,"f")[t]}const n={};Oe(this,Xe,"f")[t]=(r||[]).concat(e).filter((e=>{if(n[e])return false;return n[e]=true}));return this}hide(e){argsert("",[e],arguments.length);Oe(this,st,"f").hiddenOptions.push(e);return this}implies(e,t){argsert(" [number|string|array]",[e,t],arguments.length);Oe(this,Bt,"f").implies(e,t);return this}locale(e){argsert("[string]",[e],arguments.length);if(e===undefined){this[vt]();return Oe(this,ht,"f").y18n.getLocale()}Ue(this,Je,false,"f");Oe(this,ht,"f").y18n.setLocale(e);return this}middleware(e,t,r){return Oe(this,$e,"f").addMiddleware(e,!!t,r)}nargs(e,t){argsert(" [number]",[e,t],arguments.length);this[Pt](this.nargs.bind(this),"narg",e,t);return this}normalize(e){argsert("",[e],arguments.length);this[Mt]("normalize",e);return this}number(e){argsert("",[e],arguments.length);this[Mt]("number",e);this[sr](e);return this}option(e,t){argsert(" [object]",[e,t],arguments.length);if(typeof e==="object"){Object.keys(e).forEach((t=>{this.options(t,e[t])}))}else{if(typeof t!=="object"){t={}}this[sr](e);if(Oe(this,It,"f")&&(e==="version"||(t===null||t===void 0?void 0:t.alias)==="version")){this[wt](['"version" is a reserved word.',"Please do one of the following:",'- Disable version with `yargs.version(false)` if using "version" as an option',"- Use the built-in `yargs.version` method instead (if applicable)","- Use a different option key","https://yargs.js.org/docs/#api-reference-version"].join("\n"),undefined,"versionWarning")}Oe(this,st,"f").key[e]=true;if(t.alias)this.alias(e,t.alias);const r=t.deprecate||t.deprecated;if(r){this.deprecateOption(e,r)}const n=t.demand||t.required||t.require;if(n){this.demand(e,n)}if(t.demandOption){this.demandOption(e,typeof t.demandOption==="string"?t.demandOption:undefined)}if(t.conflicts){this.conflicts(e,t.conflicts)}if("default"in t){this.default(e,t.default)}if(t.implies!==undefined){this.implies(e,t.implies)}if(t.nargs!==undefined){this.nargs(e,t.nargs)}if(t.config){this.config(e,t.configParser)}if(t.normalize){this.normalize(e)}if(t.choices){this.choices(e,t.choices)}if(t.coerce){this.coerce(e,t.coerce)}if(t.group){this.group(e,t.group)}if(t.boolean||t.type==="boolean"){this.boolean(e);if(t.alias)this.boolean(t.alias)}if(t.array||t.type==="array"){this.array(e);if(t.alias)this.array(t.alias)}if(t.number||t.type==="number"){this.number(e);if(t.alias)this.number(t.alias)}if(t.string||t.type==="string"){this.string(e);if(t.alias)this.string(t.alias)}if(t.count||t.type==="count"){this.count(e)}if(typeof t.global==="boolean"){this.global(e,t.global)}if(t.defaultDescription){Oe(this,st,"f").defaultDescription[e]=t.defaultDescription}if(t.skipValidation){this.skipValidation(e)}const s=t.describe||t.description||t.desc;const i=Oe(this,yt,"f").getDescriptions();if(!Object.prototype.hasOwnProperty.call(i,e)||typeof s==="string"){this.describe(e,s)}if(t.hidden){this.hide(e)}if(t.requiresArg){this.requiresArg(e)}}return this}options(e,t){return this.option(e,t)}parse(e,t,r){argsert("[string|array] [function|boolean|object] [function]",[e,t,r],arguments.length);this[Dt]();if(typeof e==="undefined"){e=Oe(this,dt,"f")}if(typeof t==="object"){Ue(this,ct,t,"f");t=r}if(typeof t==="function"){Ue(this,at,t,"f");t=false}if(!t)Ue(this,dt,e,"f");if(Oe(this,at,"f"))Ue(this,je,false,"f");const n=this[tr](e,!!t);const s=this.parsed;Oe(this,Ge,"f").setParsed(this.parsed);if(isPromise(n)){return n.then((e=>{if(Oe(this,at,"f"))Oe(this,at,"f").call(this,Oe(this,Ve,"f"),e,Oe(this,nt,"f"));return e})).catch((e=>{if(Oe(this,at,"f")){Oe(this,at,"f")(e,this.parsed.argv,Oe(this,nt,"f"))}throw e})).finally((()=>{this[_t]();this.parsed=s}))}else{if(Oe(this,at,"f"))Oe(this,at,"f").call(this,Oe(this,Ve,"f"),n,Oe(this,nt,"f"));this[_t]();this.parsed=s}return n}parseAsync(e,t,r){const n=this.parse(e,t,r);return!isPromise(n)?Promise.resolve(n):n}parseSync(e,t,r){const n=this.parse(e,t,r);if(isPromise(n)){throw new YError(".parseSync() must not be used with asynchronous builders, handlers, or middleware")}return n}parserConfiguration(e){argsert("",[e],arguments.length);Ue(this,ot,e,"f");return this}pkgConf(e,t){argsert(" [string]",[e,t],arguments.length);let r=null;const n=this[Tt](t||Oe(this,_e,"f"));if(n[e]&&typeof n[e]==="object"){r=applyExtends(n[e],t||Oe(this,_e,"f"),this[xt]()["deep-merge-config"]||false,Oe(this,ht,"f"));Oe(this,st,"f").configObjects=(Oe(this,st,"f").configObjects||[]).concat(r)}return this}positional(e,t){argsert(" ",[e,t],arguments.length);const r=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];t=objFilter(t,((e,t)=>{if(e==="type"&&!["string","number","boolean"].includes(t))return false;return r.includes(e)}));const n=Oe(this,qe,"f").fullCommands[Oe(this,qe,"f").fullCommands.length-1];const s=n?Oe(this,He,"f").cmdToParseOptions(n):{array:[],alias:{},default:{},demand:{}};objectKeys(s).forEach((r=>{const n=s[r];if(Array.isArray(n)){if(n.indexOf(e)!==-1)t[r]=true}else{if(n[e]&&!(r in t))t[r]=n[e]}}));this.group(e,Oe(this,yt,"f").getPositionalGroupName());return this.option(e,t)}recommendCommands(e=true){argsert("[boolean]",[e],arguments.length);Ue(this,pt,e,"f");return this}required(e,t,r){return this.demand(e,t,r)}require(e,t,r){return this.demand(e,t,r)}requiresArg(e){argsert(" [number]",[e],arguments.length);if(typeof e==="string"&&Oe(this,st,"f").narg[e]){return this}else{this[Pt](this.requiresArg.bind(this),"narg",e,NaN)}return this}showCompletionScript(e,t){argsert("[string] [string]",[e,t],arguments.length);e=e||this.$0;Oe(this,rt,"f").log(Oe(this,Ge,"f").generateCompletionScript(e,t||Oe(this,ze,"f")||"completion"));return this}showHelp(e){argsert("[string|function]",[e],arguments.length);Ue(this,Ze,true,"f");if(!Oe(this,yt,"f").hasCachedHelpMessage()){if(!this.parsed){const t=this[tr](Oe(this,dt,"f"),undefined,undefined,0,true);if(isPromise(t)){t.then((()=>{Oe(this,yt,"f").showHelp(e)}));return this}}const t=Oe(this,He,"f").runDefaultBuilderOn(this);if(isPromise(t)){t.then((()=>{Oe(this,yt,"f").showHelp(e)}));return this}}Oe(this,yt,"f").showHelp(e);return this}scriptName(e){this.customScriptName=true;this.$0=e;return this}showHelpOnFail(e,t){argsert("[boolean|string] [string]",[e,t],arguments.length);Oe(this,yt,"f").showHelpOnFail(e,t);return this}showVersion(e){argsert("[string|function]",[e],arguments.length);Oe(this,yt,"f").showVersion(e);return this}skipValidation(e){argsert("",[e],arguments.length);this[Mt]("skipValidation",e);return this}strict(e){argsert("[boolean]",[e],arguments.length);Ue(this,mt,e!==false,"f");return this}strictCommands(e){argsert("[boolean]",[e],arguments.length);Ue(this,ft,e!==false,"f");return this}strictOptions(e){argsert("[boolean]",[e],arguments.length);Ue(this,Ct,e!==false,"f");return this}string(e){argsert("",[e],arguments.length);this[Mt]("string",e);this[sr](e);return this}terminalWidth(){argsert([],0);return Oe(this,ht,"f").process.stdColumns}updateLocale(e){return this.updateStrings(e)}updateStrings(e){argsert("",[e],arguments.length);Ue(this,Je,false,"f");Oe(this,ht,"f").y18n.updateLocale(e);return this}usage(e,t,r,n){argsert(" [string|boolean] [function|object] [function]",[e,t,r,n],arguments.length);if(t!==undefined){assertNotStrictEqual(e,null,Oe(this,ht,"f"));if((e||"").match(/^\$0( |$)/)){return this.command(e,t,r,n)}else{throw new YError(".usage() description must start with $0 if being used as alias for .command()")}}else{Oe(this,yt,"f").usage(e);return this}}usageConfiguration(e){argsert("",[e],arguments.length);Ue(this,Et,e,"f");return this}version(e,t,r){const n="version";argsert("[boolean|string] [string] [string]",[e,t,r],arguments.length);if(Oe(this,It,"f")){this[St](Oe(this,It,"f"));Oe(this,yt,"f").version(undefined);Ue(this,It,null,"f")}if(arguments.length===0){r=this[kt]();e=n}else if(arguments.length===1){if(e===false){return this}r=e;e=n}else if(arguments.length===2){r=t;t=undefined}Ue(this,It,typeof e==="string"?e:n,"f");t=t||Oe(this,yt,"f").deferY18nLookup("Show version number");Oe(this,yt,"f").version(r||undefined);this.boolean(Oe(this,It,"f"));this.describe(Oe(this,It,"f"),t);return this}wrap(e){argsert("",[e],arguments.length);Oe(this,yt,"f").wrap(e);return this}[(He=new WeakMap,_e=new WeakMap,qe=new WeakMap,Ge=new WeakMap,ze=new WeakMap,Ye=new WeakMap,Ve=new WeakMap,Je=new WeakMap,We=new WeakMap,je=new WeakMap,Ke=new WeakMap,$e=new WeakMap,Xe=new WeakMap,Ze=new WeakMap,et=new WeakMap,tt=new WeakMap,rt=new WeakMap,nt=new WeakMap,st=new WeakMap,it=new WeakMap,ot=new WeakMap,at=new WeakMap,ct=new WeakMap,At=new WeakMap,ut=new WeakMap,dt=new WeakMap,pt=new WeakMap,ht=new WeakMap,mt=new WeakMap,ft=new WeakMap,Ct=new WeakMap,yt=new WeakMap,Et=new WeakMap,It=new WeakMap,Bt=new WeakMap,Qt)](e){if(!e._||!e["--"])return e;e._.push.apply(e._,e["--"]);try{delete e["--"]}catch(e){}return e}[bt](){return{log:(...e)=>{if(!this[Kt]())console.log(...e);Ue(this,Ze,true,"f");if(Oe(this,nt,"f").length)Ue(this,nt,Oe(this,nt,"f")+"\n","f");Ue(this,nt,Oe(this,nt,"f")+e.join(" "),"f")},error:(...e)=>{if(!this[Kt]())console.error(...e);Ue(this,Ze,true,"f");if(Oe(this,nt,"f").length)Ue(this,nt,Oe(this,nt,"f")+"\n","f");Ue(this,nt,Oe(this,nt,"f")+e.join(" "),"f")}}}[St](e){objectKeys(Oe(this,st,"f")).forEach((t=>{if((e=>e==="configObjects")(t))return;const r=Oe(this,st,"f")[t];if(Array.isArray(r)){if(r.includes(e))r.splice(r.indexOf(e),1)}else if(typeof r==="object"){delete r[e]}}));delete Oe(this,yt,"f").getDescriptions()[e]}[wt](e,t,r){if(!Oe(this,We,"f")[r]){Oe(this,ht,"f").process.emitWarning(e,t);Oe(this,We,"f")[r]=true}}[Dt](){Oe(this,Ke,"f").push({options:Oe(this,st,"f"),configObjects:Oe(this,st,"f").configObjects.slice(0),exitProcess:Oe(this,je,"f"),groups:Oe(this,Xe,"f"),strict:Oe(this,mt,"f"),strictCommands:Oe(this,ft,"f"),strictOptions:Oe(this,Ct,"f"),completionCommand:Oe(this,ze,"f"),output:Oe(this,nt,"f"),exitError:Oe(this,Ve,"f"),hasOutput:Oe(this,Ze,"f"),parsed:this.parsed,parseFn:Oe(this,at,"f"),parseContext:Oe(this,ct,"f")});Oe(this,yt,"f").freeze();Oe(this,Bt,"f").freeze();Oe(this,He,"f").freeze();Oe(this,$e,"f").freeze()}[Nt](){let e="";let t;if(/\b(node|iojs|electron|bun)(\.exe)?$/.test(Oe(this,ht,"f").process.argv()[0])){t=Oe(this,ht,"f").process.argv().slice(1,2)}else{t=Oe(this,ht,"f").process.argv().slice(0,1)}e=t.map((e=>{const t=this[Zt](Oe(this,_e,"f"),e);return e.match(/^(\/|([a-zA-Z]:)?\\)/)&&t.length{if(t.includes("package.json")){return"package.json"}else{return undefined}}));assertNotStrictEqual(n,undefined,Oe(this,ht,"f"));r=JSON.parse(Oe(this,ht,"f").readFileSync(n,"utf8"))}catch(e){}Oe(this,At,"f")[t]=r||{};return Oe(this,At,"f")[t]}[Mt](e,t){t=[].concat(t);t.forEach((t=>{t=this[Ot](t);Oe(this,st,"f")[e].push(t)}))}[Pt](e,t,r,n){this[Ut](e,t,r,n,((e,t,r)=>{Oe(this,st,"f")[e][t]=r}))}[Lt](e,t,r,n){this[Ut](e,t,r,n,((e,t,r)=>{Oe(this,st,"f")[e][t]=(Oe(this,st,"f")[e][t]||[]).concat(r)}))}[Ut](e,t,r,n,s){if(Array.isArray(r)){r.forEach((t=>{e(t,n)}))}else if((e=>typeof e==="object")(r)){for(const t of objectKeys(r)){e(t,r[t])}}else{s(t,this[Ot](r),n)}}[Ot](e){if(e==="__proto__")return"___proto___";return e}[Ht](e,t){this[Pt](this[Ht].bind(this),"key",e,t);return this}[_t](){var e,t,r,n,s,i,o,a,c,l,A,u;const d=Oe(this,Ke,"f").pop();assertNotStrictEqual(d,undefined,Oe(this,ht,"f"));let g;e=this,t=this,r=this,n=this,s=this,i=this,o=this,a=this,c=this,l=this,A=this,u=this,({options:{set value(t){Ue(e,st,t,"f")}}.value,configObjects:g,exitProcess:{set value(e){Ue(t,je,e,"f")}}.value,groups:{set value(e){Ue(r,Xe,e,"f")}}.value,output:{set value(e){Ue(n,nt,e,"f")}}.value,exitError:{set value(e){Ue(s,Ve,e,"f")}}.value,hasOutput:{set value(e){Ue(i,Ze,e,"f")}}.value,parsed:this.parsed,strict:{set value(e){Ue(o,mt,e,"f")}}.value,strictCommands:{set value(e){Ue(a,ft,e,"f")}}.value,strictOptions:{set value(e){Ue(c,Ct,e,"f")}}.value,completionCommand:{set value(e){Ue(l,ze,e,"f")}}.value,parseFn:{set value(e){Ue(A,at,e,"f")}}.value,parseContext:{set value(e){Ue(u,ct,e,"f")}}.value}=d);Oe(this,st,"f").configObjects=g;Oe(this,yt,"f").unfreeze();Oe(this,Bt,"f").unfreeze();Oe(this,He,"f").unfreeze();Oe(this,$e,"f").unfreeze()}[qt](e,t){return maybeAsyncResult(t,(t=>{e(t);return t}))}getInternalMethods(){return{getCommandInstance:this[Gt].bind(this),getContext:this[zt].bind(this),getHasOutput:this[Yt].bind(this),getLoggerInstance:this[Vt].bind(this),getParseContext:this[Jt].bind(this),getParserConfiguration:this[xt].bind(this),getUsageConfiguration:this[Rt].bind(this),getUsageInstance:this[Wt].bind(this),getValidationInstance:this[jt].bind(this),hasParseCallback:this[Kt].bind(this),isGlobalContext:this[$t].bind(this),postProcess:this[Xt].bind(this),reset:this[er].bind(this),runValidation:this[rr].bind(this),runYargsParserAndExecuteCommands:this[tr].bind(this),setHasOutput:this[nr].bind(this)}}[Gt](){return Oe(this,He,"f")}[zt](){return Oe(this,qe,"f")}[Yt](){return Oe(this,Ze,"f")}[Vt](){return Oe(this,rt,"f")}[Jt](){return Oe(this,ct,"f")||{}}[Wt](){return Oe(this,yt,"f")}[jt](){return Oe(this,Bt,"f")}[Kt](){return!!Oe(this,at,"f")}[$t](){return Oe(this,tt,"f")}[Xt](e,t,r,n){if(r)return e;if(isPromise(e))return e;if(!t){e=this[Qt](e)}const s=this[xt]()["parse-positional-numbers"]||this[xt]()["parse-positional-numbers"]===undefined;if(s){e=this[Ft](e)}if(n){e=applyMiddleware(e,this,Oe(this,$e,"f").getMiddleware(),false)}return e}[er](e={}){Ue(this,st,Oe(this,st,"f")||{},"f");const t={};t.local=Oe(this,st,"f").local||[];t.configObjects=Oe(this,st,"f").configObjects||[];const r={};t.local.forEach((t=>{r[t]=true;(e[t]||[]).forEach((e=>{r[e]=true}))}));Object.assign(Oe(this,ut,"f"),Object.keys(Oe(this,Xe,"f")).reduce(((e,t)=>{const n=Oe(this,Xe,"f")[t].filter((e=>!(e in r)));if(n.length>0){e[t]=n}return e}),{}));Ue(this,Xe,{},"f");const n=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"];const s=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];n.forEach((e=>{t[e]=(Oe(this,st,"f")[e]||[]).filter((e=>!r[e]))}));s.forEach((e=>{t[e]=objFilter(Oe(this,st,"f")[e],(e=>!r[e]))}));t.envPrefix=Oe(this,st,"f").envPrefix;Ue(this,st,t,"f");Ue(this,yt,Oe(this,yt,"f")?Oe(this,yt,"f").reset(r):usage(this,Oe(this,ht,"f")),"f");Ue(this,Bt,Oe(this,Bt,"f")?Oe(this,Bt,"f").reset(r):validation(this,Oe(this,yt,"f"),Oe(this,ht,"f")),"f");Ue(this,He,Oe(this,He,"f")?Oe(this,He,"f").reset():command(Oe(this,yt,"f"),Oe(this,Bt,"f"),Oe(this,$e,"f"),Oe(this,ht,"f")),"f");if(!Oe(this,Ge,"f"))Ue(this,Ge,completion(this,Oe(this,yt,"f"),Oe(this,He,"f"),Oe(this,ht,"f")),"f");Oe(this,$e,"f").reset();Ue(this,ze,null,"f");Ue(this,nt,"","f");Ue(this,Ve,null,"f");Ue(this,Ze,false,"f");this.parsed=false;return this}[Zt](e,t){return Oe(this,ht,"f").path.relative(e,t)}[tr](e,t,r,n=0,s=false){var i,o,a,c;let l=!!r||s;e=e||Oe(this,dt,"f");Oe(this,st,"f").__=Oe(this,ht,"f").y18n.__;Oe(this,st,"f").configuration=this[xt]();const A=!!Oe(this,st,"f").configuration["populate--"];const u=Object.assign({},Oe(this,st,"f").configuration,{"populate--":true});const d=Oe(this,ht,"f").Parser.detailed(e,Object.assign({},Oe(this,st,"f"),{configuration:{"parse-positional-numbers":false,...u}}));const g=Object.assign(d.argv,Oe(this,ct,"f"));let p=undefined;const h=d.aliases;let m=false;let f=false;Object.keys(g).forEach((e=>{if(e===Oe(this,et,"f")&&g[e]){m=true}else if(e===Oe(this,It,"f")&&g[e]){f=true}}));g.$0=this.$0;this.parsed=d;if(n===0){Oe(this,yt,"f").clearCachedHelpMessage()}try{this[vt]();if(t){return this[Xt](g,A,!!r,false)}if(Oe(this,et,"f")){const e=[Oe(this,et,"f")].concat(h[Oe(this,et,"f")]||[]).filter((e=>e.length>1));if(e.includes(""+g._[g._.length-1])){g._.pop();m=true}}Ue(this,tt,false,"f");const u=Oe(this,He,"f").getCommands();const C=((i=Oe(this,Ge,"f"))===null||i===void 0?void 0:i.completionKey)?[(o=Oe(this,Ge,"f"))===null||o===void 0?void 0:o.completionKey,...(c=this.getAliases()[(a=Oe(this,Ge,"f"))===null||a===void 0?void 0:a.completionKey])!==null&&c!==void 0?c:[]].some((e=>Object.prototype.hasOwnProperty.call(g,e))):false;const y=m||C||s;if(g._.length){if(u.length){let e;for(let t=n||0,i;g._[t]!==undefined;t++){i=String(g._[t]);if(u.includes(i)&&i!==Oe(this,ze,"f")){const e=Oe(this,He,"f").runCommand(i,this,d,t+1,s,m||f||s);return this[Xt](e,A,!!r,false)}else if(!e&&i!==Oe(this,ze,"f")){e=i;break}}if(!Oe(this,He,"f").hasDefaultCommand()&&Oe(this,pt,"f")&&e&&!y){Oe(this,Bt,"f").recommendCommands(e,u)}}if(Oe(this,ze,"f")&&g._.includes(Oe(this,ze,"f"))&&!C){if(Oe(this,je,"f"))setBlocking(true);this.showCompletionScript();this.exit(0)}}if(Oe(this,He,"f").hasDefaultCommand()&&!y){const e=Oe(this,He,"f").runCommand(null,this,d,0,s,m||f||s);return this[Xt](e,A,!!r,false)}if(C){if(Oe(this,je,"f"))setBlocking(true);e=[].concat(e);const t=e.slice(e.indexOf(`--${Oe(this,Ge,"f").completionKey}`)+1);Oe(this,Ge,"f").getCompletion(t,((e,t)=>{if(e)throw new YError(e.message);(t||[]).forEach((e=>{Oe(this,rt,"f").log(e)}));this.exit(0)}));return this[Xt](g,!A,!!r,false)}if(!Oe(this,Ze,"f")){if(m){if(Oe(this,je,"f"))setBlocking(true);l=true;this.showHelp((e=>{Oe(this,rt,"f").log(e);this.exit(0)}))}else if(f){if(Oe(this,je,"f"))setBlocking(true);l=true;Oe(this,yt,"f").showVersion("log");this.exit(0)}}if(!l&&Oe(this,st,"f").skipValidation.length>0){l=Object.keys(g).some((e=>Oe(this,st,"f").skipValidation.indexOf(e)>=0&&g[e]===true))}if(!l){if(d.error)throw new YError(d.error.message);if(!C){const e=this[rr](h,{},d.error);if(!r){p=applyMiddleware(g,this,Oe(this,$e,"f").getMiddleware(),true)}p=this[qt](e,p!==null&&p!==void 0?p:g);if(isPromise(p)&&!r){p=p.then((()=>applyMiddleware(g,this,Oe(this,$e,"f").getMiddleware(),false)))}}}}catch(e){if(e instanceof YError)Oe(this,yt,"f").fail(e.message,e);else throw e}return this[Xt](p!==null&&p!==void 0?p:g,A,!!r,true)}[rr](e,t,r,n){const s={...this.getDemandedOptions()};return i=>{if(r)throw new YError(r.message);Oe(this,Bt,"f").nonOptionCount(i);Oe(this,Bt,"f").requiredArguments(i,s);let o=false;if(Oe(this,ft,"f")){o=Oe(this,Bt,"f").unknownCommands(i)}if(Oe(this,mt,"f")&&!o){Oe(this,Bt,"f").unknownArguments(i,e,t,!!n)}else if(Oe(this,Ct,"f")){Oe(this,Bt,"f").unknownArguments(i,e,{},false,false)}Oe(this,Bt,"f").limitedChoices(i);Oe(this,Bt,"f").implications(i);Oe(this,Bt,"f").conflicting(i)}}[nr](){Ue(this,Ze,true,"f")}[sr](e){if(typeof e==="string"){Oe(this,st,"f").key[e]=true}else{for(const t of e){Oe(this,st,"f").key[t]=true}}}}function isYargsInstance(e){return!!e&&typeof e.getInternalMethods==="function"}const or=YargsFactory(Re);const ar=or;var cr=__nccwpck_require__(857);function utils_toCommandValue(e){if(e===null||e===undefined){return""}else if(typeof e==="string"||e instanceof String){return e}return JSON.stringify(e)}function utils_toCommandProperties(e){if(!Object.keys(e).length){return{}}return{title:e.title,file:e.file,line:e.startLine,endLine:e.endLine,col:e.startColumn,endColumn:e.endColumn}}function command_issueCommand(e,t,r){const n=new Command(e,t,r);process.stdout.write(n.toString()+cr.EOL)}function command_issue(e,t=""){command_issueCommand(e,{},t)}const lr="::";class Command{constructor(e,t,r){if(!e){e="missing.command"}this.command=e;this.properties=t;this.message=r}toString(){let e=lr+this.command;if(this.properties&&Object.keys(this.properties).length>0){e+=" ";let t=true;for(const r in this.properties){if(this.properties.hasOwnProperty(r)){const n=this.properties[r];if(n){if(t){t=false}else{e+=","}e+=`${r}=${escapeProperty(n)}`}}}}e+=`${lr}${escapeData(this.message)}`;return e}}function escapeData(e){return utils_toCommandValue(e).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A")}function escapeProperty(e){return utils_toCommandValue(e).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/:/g,"%3A").replace(/,/g,"%2C")}const Ar=e(import.meta.url)("crypto");function file_command_issueFileCommand(e,t){const r=process.env[`GITHUB_${e}`];if(!r){throw new Error(`Unable to find environment variable for file command ${e}`)}if(!i.existsSync(r)){throw new Error(`Missing file at path: ${r}`)}i.appendFileSync(r,`${utils_toCommandValue(t)}${cr.EOL}`,{encoding:"utf8"})}function file_command_prepareKeyValueMessage(e,t){const r=`ghadelimiter_${Ar.randomUUID()}`;const n=utils_toCommandValue(t);if(e.includes(r)){throw new Error(`Unexpected input: name should not contain the delimiter "${r}"`)}if(n.includes(r)){throw new Error(`Unexpected input: value should not contain the delimiter "${r}"`)}return`${e}<<${r}${cr.EOL}${n}${cr.EOL}${r}`}var ur=__nccwpck_require__(8611);var dr=__nccwpck_require__.t(ur,2);var gr=__nccwpck_require__(5692);var pr=__nccwpck_require__.t(gr,2);function getProxyUrl(e){const t=e.protocol==="https:";if(checkBypass(e)){return undefined}const r=(()=>{if(t){return process.env["https_proxy"]||process.env["HTTPS_PROXY"]}else{return process.env["http_proxy"]||process.env["HTTP_PROXY"]}})();if(r){try{return new DecodedURL(r)}catch(e){if(!r.startsWith("http://")&&!r.startsWith("https://"))return new DecodedURL(`http://${r}`)}}else{return undefined}}function checkBypass(e){if(!e.hostname){return false}const t=e.hostname;if(isLoopbackAddress(t)){return true}const r=process.env["no_proxy"]||process.env["NO_PROXY"]||"";if(!r){return false}let n;if(e.port){n=Number(e.port)}else if(e.protocol==="http:"){n=80}else if(e.protocol==="https:"){n=443}const s=[e.hostname.toUpperCase()];if(typeof n==="number"){s.push(`${s[0]}:${n}`)}for(const e of r.split(",").map((e=>e.trim().toUpperCase())).filter((e=>e))){if(e==="*"||s.some((t=>t===e||t.endsWith(`.${e}`)||e.startsWith(".")&&t.endsWith(`${e}`)))){return true}}return false}function isLoopbackAddress(e){const t=e.toLowerCase();return t==="localhost"||t.startsWith("127.")||t.startsWith("[::1]")||t.startsWith("[0:0:0:0:0:0:0:1]")}class DecodedURL extends URL{constructor(e,t){super(e,t);this._decodedUsername=decodeURIComponent(super.username);this._decodedPassword=decodeURIComponent(super.password)}get username(){return this._decodedUsername}get password(){return this._decodedPassword}}var hr=__nccwpck_require__(770);var mr=__nccwpck_require__(6752);var fr=undefined&&undefined.__awaiter||function(e,t,r,n){function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,s){function fulfilled(e){try{step(n.next(e))}catch(e){s(e)}}function rejected(e){try{step(n["throw"](e))}catch(e){s(e)}}function step(e){e.done?r(e.value):adopt(e.value).then(fulfilled,rejected)}step((n=n.apply(e,t||[])).next())}))};var Cr;(function(e){e[e["OK"]=200]="OK";e[e["MultipleChoices"]=300]="MultipleChoices";e[e["MovedPermanently"]=301]="MovedPermanently";e[e["ResourceMoved"]=302]="ResourceMoved";e[e["SeeOther"]=303]="SeeOther";e[e["NotModified"]=304]="NotModified";e[e["UseProxy"]=305]="UseProxy";e[e["SwitchProxy"]=306]="SwitchProxy";e[e["TemporaryRedirect"]=307]="TemporaryRedirect";e[e["PermanentRedirect"]=308]="PermanentRedirect";e[e["BadRequest"]=400]="BadRequest";e[e["Unauthorized"]=401]="Unauthorized";e[e["PaymentRequired"]=402]="PaymentRequired";e[e["Forbidden"]=403]="Forbidden";e[e["NotFound"]=404]="NotFound";e[e["MethodNotAllowed"]=405]="MethodNotAllowed";e[e["NotAcceptable"]=406]="NotAcceptable";e[e["ProxyAuthenticationRequired"]=407]="ProxyAuthenticationRequired";e[e["RequestTimeout"]=408]="RequestTimeout";e[e["Conflict"]=409]="Conflict";e[e["Gone"]=410]="Gone";e[e["TooManyRequests"]=429]="TooManyRequests";e[e["InternalServerError"]=500]="InternalServerError";e[e["NotImplemented"]=501]="NotImplemented";e[e["BadGateway"]=502]="BadGateway";e[e["ServiceUnavailable"]=503]="ServiceUnavailable";e[e["GatewayTimeout"]=504]="GatewayTimeout"})(Cr||(Cr={}));var yr;(function(e){e["Accept"]="accept";e["ContentType"]="content-type"})(yr||(yr={}));var Er;(function(e){e["ApplicationJson"]="application/json"})(Er||(Er={}));function lib_getProxyUrl(e){const t=pm.getProxyUrl(new URL(e));return t?t.href:""}const Ir=[Cr.MovedPermanently,Cr.ResourceMoved,Cr.SeeOther,Cr.TemporaryRedirect,Cr.PermanentRedirect];const Br=[Cr.BadGateway,Cr.ServiceUnavailable,Cr.GatewayTimeout];const Qr=["OPTIONS","GET","DELETE","HEAD"];const br=10;const Sr=5;class HttpClientError extends Error{constructor(e,t){super(e);this.name="HttpClientError";this.statusCode=t;Object.setPrototypeOf(this,HttpClientError.prototype)}}class HttpClientResponse{constructor(e){this.message=e}readBody(){return fr(this,void 0,void 0,(function*(){return new Promise((e=>fr(this,void 0,void 0,(function*(){let t=Buffer.alloc(0);this.message.on("data",(e=>{t=Buffer.concat([t,e])}));this.message.on("end",(()=>{e(t.toString())}))}))))}))}readBodyBuffer(){return fr(this,void 0,void 0,(function*(){return new Promise((e=>fr(this,void 0,void 0,(function*(){const t=[];this.message.on("data",(e=>{t.push(e)}));this.message.on("end",(()=>{e(Buffer.concat(t))}))}))))}))}}function isHttps(e){const t=new URL(e);return t.protocol==="https:"}class lib_HttpClient{constructor(e,t,r){this._ignoreSslError=false;this._allowRedirects=true;this._allowRedirectDowngrade=false;this._maxRedirects=50;this._allowRetries=false;this._maxRetries=1;this._keepAlive=false;this._disposed=false;this.userAgent=this._getUserAgentWithOrchestrationId(e);this.handlers=t||[];this.requestOptions=r;if(r){if(r.ignoreSslError!=null){this._ignoreSslError=r.ignoreSslError}this._socketTimeout=r.socketTimeout;if(r.allowRedirects!=null){this._allowRedirects=r.allowRedirects}if(r.allowRedirectDowngrade!=null){this._allowRedirectDowngrade=r.allowRedirectDowngrade}if(r.maxRedirects!=null){this._maxRedirects=Math.max(r.maxRedirects,0)}if(r.keepAlive!=null){this._keepAlive=r.keepAlive}if(r.allowRetries!=null){this._allowRetries=r.allowRetries}if(r.maxRetries!=null){this._maxRetries=r.maxRetries}}}options(e,t){return fr(this,void 0,void 0,(function*(){return this.request("OPTIONS",e,null,t||{})}))}get(e,t){return fr(this,void 0,void 0,(function*(){return this.request("GET",e,null,t||{})}))}del(e,t){return fr(this,void 0,void 0,(function*(){return this.request("DELETE",e,null,t||{})}))}post(e,t,r){return fr(this,void 0,void 0,(function*(){return this.request("POST",e,t,r||{})}))}patch(e,t,r){return fr(this,void 0,void 0,(function*(){return this.request("PATCH",e,t,r||{})}))}put(e,t,r){return fr(this,void 0,void 0,(function*(){return this.request("PUT",e,t,r||{})}))}head(e,t){return fr(this,void 0,void 0,(function*(){return this.request("HEAD",e,null,t||{})}))}sendStream(e,t,r,n){return fr(this,void 0,void 0,(function*(){return this.request(e,t,r,n)}))}getJson(e){return fr(this,arguments,void 0,(function*(e,t={}){t[yr.Accept]=this._getExistingOrDefaultHeader(t,yr.Accept,Er.ApplicationJson);const r=yield this.get(e,t);return this._processResponse(r,this.requestOptions)}))}postJson(e,t){return fr(this,arguments,void 0,(function*(e,t,r={}){const n=JSON.stringify(t,null,2);r[yr.Accept]=this._getExistingOrDefaultHeader(r,yr.Accept,Er.ApplicationJson);r[yr.ContentType]=this._getExistingOrDefaultContentTypeHeader(r,Er.ApplicationJson);const s=yield this.post(e,n,r);return this._processResponse(s,this.requestOptions)}))}putJson(e,t){return fr(this,arguments,void 0,(function*(e,t,r={}){const n=JSON.stringify(t,null,2);r[yr.Accept]=this._getExistingOrDefaultHeader(r,yr.Accept,Er.ApplicationJson);r[yr.ContentType]=this._getExistingOrDefaultContentTypeHeader(r,Er.ApplicationJson);const s=yield this.put(e,n,r);return this._processResponse(s,this.requestOptions)}))}patchJson(e,t){return fr(this,arguments,void 0,(function*(e,t,r={}){const n=JSON.stringify(t,null,2);r[yr.Accept]=this._getExistingOrDefaultHeader(r,yr.Accept,Er.ApplicationJson);r[yr.ContentType]=this._getExistingOrDefaultContentTypeHeader(r,Er.ApplicationJson);const s=yield this.patch(e,n,r);return this._processResponse(s,this.requestOptions)}))}request(e,t,r,n){return fr(this,void 0,void 0,(function*(){if(this._disposed){throw new Error("Client has already been disposed.")}const s=new URL(t);let i=this._prepareRequest(e,s,n);const o=this._allowRetries&&Qr.includes(e)?this._maxRetries+1:1;let a=0;let c;do{c=yield this.requestRaw(i,r);if(c&&c.message&&c.message.statusCode===Cr.Unauthorized){let e;for(const t of this.handlers){if(t.canHandleAuthentication(c)){e=t;break}}if(e){return e.handleAuthentication(this,i,r)}else{return c}}let t=this._maxRedirects;while(c.message.statusCode&&Ir.includes(c.message.statusCode)&&this._allowRedirects&&t>0){const o=c.message.headers["location"];if(!o){break}const a=new URL(o);if(s.protocol==="https:"&&s.protocol!==a.protocol&&!this._allowRedirectDowngrade){throw new Error("Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.")}yield c.readBody();if(a.hostname!==s.hostname){for(const e in n){if(e.toLowerCase()==="authorization"){delete n[e]}}}i=this._prepareRequest(e,a,n);c=yield this.requestRaw(i,r);t--}if(!c.message.statusCode||!Br.includes(c.message.statusCode)){return c}a+=1;if(a{function callbackForResult(e,t){if(e){n(e)}else if(!t){n(new Error("Unknown error"))}else{r(t)}}this.requestRawWithCallback(e,t,callbackForResult)}))}))}requestRawWithCallback(e,t,r){if(typeof t==="string"){if(!e.options.headers){e.options.headers={}}e.options.headers["Content-Length"]=Buffer.byteLength(t,"utf8")}let n=false;function handleResult(e,t){if(!n){n=true;r(e,t)}}const s=e.httpModule.request(e.options,(e=>{const t=new HttpClientResponse(e);handleResult(undefined,t)}));let i;s.on("socket",(e=>{i=e}));s.setTimeout(this._socketTimeout||3*6e4,(()=>{if(i){i.end()}handleResult(new Error(`Request timeout: ${e.options.path}`))}));s.on("error",(function(e){handleResult(e)}));if(t&&typeof t==="string"){s.write(t,"utf8")}if(t&&typeof t!=="string"){t.on("close",(function(){s.end()}));t.pipe(s)}else{s.end()}}getAgent(e){const t=new URL(e);return this._getAgent(t)}getAgentDispatcher(e){const t=new URL(e);const r=getProxyUrl(t);const n=r&&r.hostname;if(!n){return}return this._getProxyAgentDispatcher(t,r)}_prepareRequest(e,t,r){const n={};n.parsedUrl=t;const s=n.parsedUrl.protocol==="https:";n.httpModule=s?pr:dr;const i=s?443:80;n.options={};n.options.host=n.parsedUrl.hostname;n.options.port=n.parsedUrl.port?parseInt(n.parsedUrl.port):i;n.options.path=(n.parsedUrl.pathname||"")+(n.parsedUrl.search||"");n.options.method=e;n.options.headers=this._mergeHeaders(r);if(this.userAgent!=null){n.options.headers["user-agent"]=this.userAgent}n.options.agent=this._getAgent(n.parsedUrl);if(this.handlers){for(const e of this.handlers){e.prepareRequest(n.options)}}return n}_mergeHeaders(e){if(this.requestOptions&&this.requestOptions.headers){return Object.assign({},lowercaseKeys(this.requestOptions.headers),lowercaseKeys(e||{}))}return lowercaseKeys(e||{})}_getExistingOrDefaultHeader(e,t,r){let n;if(this.requestOptions&&this.requestOptions.headers){const e=lowercaseKeys(this.requestOptions.headers)[t];if(e){n=typeof e==="number"?e.toString():e}}const s=e[t];if(s!==undefined){return typeof s==="number"?s.toString():s}if(n!==undefined){return n}return r}_getExistingOrDefaultContentTypeHeader(e,t){let r;if(this.requestOptions&&this.requestOptions.headers){const e=lowercaseKeys(this.requestOptions.headers)[yr.ContentType];if(e){if(typeof e==="number"){r=String(e)}else if(Array.isArray(e)){r=e.join(", ")}else{r=e}}}const n=e[yr.ContentType];if(n!==undefined){if(typeof n==="number"){return String(n)}else if(Array.isArray(n)){return n.join(", ")}else{return n}}if(r!==undefined){return r}return t}_getAgent(e){let t;const r=getProxyUrl(e);const n=r&&r.hostname;if(this._keepAlive&&n){t=this._proxyAgent}if(!n){t=this._agent}if(t){return t}const s=e.protocol==="https:";let i=100;if(this.requestOptions){i=this.requestOptions.maxSockets||ur.globalAgent.maxSockets}if(r&&r.hostname){const e={maxSockets:i,keepAlive:this._keepAlive,proxy:Object.assign(Object.assign({},(r.username||r.password)&&{proxyAuth:`${r.username}:${r.password}`}),{host:r.hostname,port:r.port})};let n;const o=r.protocol==="https:";if(s){n=o?hr.httpsOverHttps:hr.httpsOverHttp}else{n=o?hr.httpOverHttps:hr.httpOverHttp}t=n(e);this._proxyAgent=t}if(!t){const e={keepAlive:this._keepAlive,maxSockets:i};t=s?new gr.Agent(e):new ur.Agent(e);this._agent=t}if(s&&this._ignoreSslError){t.options=Object.assign(t.options||{},{rejectUnauthorized:false})}return t}_getProxyAgentDispatcher(e,t){let r;if(this._keepAlive){r=this._proxyAgentDispatcher}if(r){return r}const n=e.protocol==="https:";r=new mr.kT(Object.assign({uri:t.href,pipelining:!this._keepAlive?0:1},(t.username||t.password)&&{token:`Basic ${Buffer.from(`${t.username}:${t.password}`).toString("base64")}`}));this._proxyAgentDispatcher=r;if(n&&this._ignoreSslError){r.options=Object.assign(r.options.requestTls||{},{rejectUnauthorized:false})}return r}_getUserAgentWithOrchestrationId(e){const t=e||"actions/http-client";const r=process.env["ACTIONS_ORCHESTRATION_ID"];if(r){const e=r.replace(/[^a-z0-9_.-]/gi,"_");return`${t} actions_orchestration_id/${e}`}return t}_performExponentialBackoff(e){return fr(this,void 0,void 0,(function*(){e=Math.min(br,e);const t=Sr*Math.pow(2,e);return new Promise((e=>setTimeout((()=>e()),t)))}))}_processResponse(e,t){return fr(this,void 0,void 0,(function*(){return new Promise(((r,n)=>fr(this,void 0,void 0,(function*(){const s=e.message.statusCode||0;const i={statusCode:s,result:null,headers:{}};if(s===Cr.NotFound){r(i)}function dateTimeDeserializer(e,t){if(typeof t==="string"){const e=new Date(t);if(!isNaN(e.valueOf())){return e}}return t}let o;let a;try{a=yield e.readBody();if(a&&a.length>0){if(t&&t.deserializeDates){o=JSON.parse(a,dateTimeDeserializer)}else{o=JSON.parse(a)}i.result=o}i.headers=e.message.headers}catch(e){}if(s>299){let e;if(o&&o.message){e=o.message}else if(a&&a.length>0){e=a}else{e=`Failed request: (${s})`}const t=new HttpClientError(e,s);t.result=i.result;n(t)}else{r(i)}}))))}))}}const lowercaseKeys=e=>Object.keys(e).reduce(((t,r)=>(t[r.toLowerCase()]=e[r],t)),{});var wr=undefined&&undefined.__awaiter||function(e,t,r,n){function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,s){function fulfilled(e){try{step(n.next(e))}catch(e){s(e)}}function rejected(e){try{step(n["throw"](e))}catch(e){s(e)}}function step(e){e.done?r(e.value):adopt(e.value).then(fulfilled,rejected)}step((n=n.apply(e,t||[])).next())}))};class BasicCredentialHandler{constructor(e,t){this.username=e;this.password=t}prepareRequest(e){if(!e.headers){throw Error("The request has no headers")}e.headers["Authorization"]=`Basic ${Buffer.from(`${this.username}:${this.password}`).toString("base64")}`}canHandleAuthentication(){return false}handleAuthentication(){return wr(this,void 0,void 0,(function*(){throw new Error("not implemented")}))}}class auth_BearerCredentialHandler{constructor(e){this.token=e}prepareRequest(e){if(!e.headers){throw Error("The request has no headers")}e.headers["Authorization"]=`Bearer ${this.token}`}canHandleAuthentication(){return false}handleAuthentication(){return wr(this,void 0,void 0,(function*(){throw new Error("not implemented")}))}}class PersonalAccessTokenCredentialHandler{constructor(e){this.token=e}prepareRequest(e){if(!e.headers){throw Error("The request has no headers")}e.headers["Authorization"]=`Basic ${Buffer.from(`PAT:${this.token}`).toString("base64")}`}canHandleAuthentication(){return false}handleAuthentication(){return wr(this,void 0,void 0,(function*(){throw new Error("not implemented")}))}}var Dr=undefined&&undefined.__awaiter||function(e,t,r,n){function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,s){function fulfilled(e){try{step(n.next(e))}catch(e){s(e)}}function rejected(e){try{step(n["throw"](e))}catch(e){s(e)}}function step(e){e.done?r(e.value):adopt(e.value).then(fulfilled,rejected)}step((n=n.apply(e,t||[])).next())}))};class oidc_utils_OidcClient{static createHttpClient(e=true,t=10){const r={allowRetries:e,maxRetries:t};return new HttpClient("actions/oidc-client",[new BearerCredentialHandler(oidc_utils_OidcClient.getRequestToken())],r)}static getRequestToken(){const e=process.env["ACTIONS_ID_TOKEN_REQUEST_TOKEN"];if(!e){throw new Error("Unable to get ACTIONS_ID_TOKEN_REQUEST_TOKEN env variable")}return e}static getIDTokenUrl(){const e=process.env["ACTIONS_ID_TOKEN_REQUEST_URL"];if(!e){throw new Error("Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable")}return e}static getCall(e){return Dr(this,void 0,void 0,(function*(){var t;const r=oidc_utils_OidcClient.createHttpClient();const n=yield r.getJson(e).catch((e=>{throw new Error(`Failed to get ID Token. \n \n Error Code : ${e.statusCode}\n \n Error Message: ${e.message}`)}));const s=(t=n.result)===null||t===void 0?void 0:t.value;if(!s){throw new Error("Response json body do not have ID Token field")}return s}))}static getIDToken(e){return Dr(this,void 0,void 0,(function*(){try{let t=oidc_utils_OidcClient.getIDTokenUrl();if(e){const r=encodeURIComponent(e);t=`${t}&audience=${r}`}debug(`ID token url is ${t}`);const r=yield oidc_utils_OidcClient.getCall(t);setSecret(r);return r}catch(e){throw new Error(`Error message: ${e.message}`)}}))}}var Nr=undefined&&undefined.__awaiter||function(e,t,r,n){function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,s){function fulfilled(e){try{step(n.next(e))}catch(e){s(e)}}function rejected(e){try{step(n["throw"](e))}catch(e){s(e)}}function step(e){e.done?r(e.value):adopt(e.value).then(fulfilled,rejected)}step((n=n.apply(e,t||[])).next())}))};const{access:xr,appendFile:Rr,writeFile:vr}=i.promises;const kr="GITHUB_STEP_SUMMARY";const Fr="https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary";class Summary{constructor(){this._buffer=""}filePath(){return Nr(this,void 0,void 0,(function*(){if(this._filePath){return this._filePath}const e=process.env[kr];if(!e){throw new Error(`Unable to find environment variable for $${kr}. Check if your runtime environment supports job summaries.`)}try{yield xr(e,i.constants.R_OK|i.constants.W_OK)}catch(t){throw new Error(`Unable to access summary file: '${e}'. Check if the file has correct read/write permissions.`)}this._filePath=e;return this._filePath}))}wrap(e,t,r={}){const n=Object.entries(r).map((([e,t])=>` ${e}="${t}"`)).join("");if(!t){return`<${e}${n}>`}return`<${e}${n}>${t}`}write(e){return Nr(this,void 0,void 0,(function*(){const t=!!(e===null||e===void 0?void 0:e.overwrite);const r=yield this.filePath();const n=t?vr:Rr;yield n(r,this._buffer,{encoding:"utf8"});return this.emptyBuffer()}))}clear(){return Nr(this,void 0,void 0,(function*(){return this.emptyBuffer().write({overwrite:true})}))}stringify(){return this._buffer}isEmptyBuffer(){return this._buffer.length===0}emptyBuffer(){this._buffer="";return this}addRaw(e,t=false){this._buffer+=e;return t?this.addEOL():this}addEOL(){return this.addRaw(cr.EOL)}addCodeBlock(e,t){const r=Object.assign({},t&&{lang:t});const n=this.wrap("pre",this.wrap("code",e),r);return this.addRaw(n).addEOL()}addList(e,t=false){const r=t?"ol":"ul";const n=e.map((e=>this.wrap("li",e))).join("");const s=this.wrap(r,n);return this.addRaw(s).addEOL()}addTable(e){const t=e.map((e=>{const t=e.map((e=>{if(typeof e==="string"){return this.wrap("td",e)}const{header:t,data:r,colspan:n,rowspan:s}=e;const i=t?"th":"td";const o=Object.assign(Object.assign({},n&&{colspan:n}),s&&{rowspan:s});return this.wrap(i,r,o)})).join("");return this.wrap("tr",t)})).join("");const r=this.wrap("table",t);return this.addRaw(r).addEOL()}addDetails(e,t){const r=this.wrap("details",this.wrap("summary",e)+t);return this.addRaw(r).addEOL()}addImage(e,t,r){const{width:n,height:s}=r||{};const i=Object.assign(Object.assign({},n&&{width:n}),s&&{height:s});const o=this.wrap("img",null,Object.assign({src:e,alt:t},i));return this.addRaw(o).addEOL()}addHeading(e,t){const r=`h${t}`;const n=["h1","h2","h3","h4","h5","h6"].includes(r)?r:"h1";const s=this.wrap(n,e);return this.addRaw(s).addEOL()}addSeparator(){const e=this.wrap("hr",null);return this.addRaw(e).addEOL()}addBreak(){const e=this.wrap("br",null);return this.addRaw(e).addEOL()}addQuote(e,t){const r=Object.assign({},t&&{cite:t});const n=this.wrap("blockquote",e,r);return this.addRaw(n).addEOL()}addLink(e,t){const r=this.wrap("a",e,{href:t});return this.addRaw(r).addEOL()}}const Tr=new Summary;const Mr=null&&Tr;const Pr=null&&Tr;function toPosixPath(e){return e.replace(/[\\]/g,"/")}function toWin32Path(e){return e.replace(/[/]/g,"\\")}function toPlatformPath(e){return e.replace(/[/\\]/g,path.sep)}var Lr=__nccwpck_require__(3193);var Ur=__nccwpck_require__(4434);const Or=e(import.meta.url)("child_process");var Hr=undefined&&undefined.__awaiter||function(e,t,r,n){function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,s){function fulfilled(e){try{step(n.next(e))}catch(e){s(e)}}function rejected(e){try{step(n["throw"](e))}catch(e){s(e)}}function step(e){e.done?r(e.value):adopt(e.value).then(fulfilled,rejected)}step((n=n.apply(e,t||[])).next())}))};const{chmod:_r,copyFile:qr,lstat:Gr,mkdir:zr,open:Yr,readdir:Vr,rename:Jr,rm:Wr,rmdir:jr,stat:Kr,symlink:$r,unlink:Xr}=i.promises;const Zr=process.platform==="win32";function readlink(e){return Hr(this,void 0,void 0,(function*(){const t=yield i.promises.readlink(e);if(Zr&&!t.endsWith("\\")){return`${t}\\`}return t}))}const en=268435456;const tn=i.constants.O_RDONLY;function exists(e){return Hr(this,void 0,void 0,(function*(){try{yield Kr(e)}catch(e){if(e.code==="ENOENT"){return false}throw e}return true}))}function isDirectory(e){return Hr(this,arguments,void 0,(function*(e,t=false){const r=t?yield Kr(e):yield Gr(e);return r.isDirectory()}))}function isRooted(e){e=normalizeSeparators(e);if(!e){throw new Error('isRooted() parameter "p" cannot be empty')}if(Zr){return e.startsWith("\\")||/^[A-Z]:/i.test(e)}return e.startsWith("/")}function tryGetExecutablePath(e,t){return Hr(this,void 0,void 0,(function*(){let r=undefined;try{r=yield Kr(e)}catch(t){if(t.code!=="ENOENT"){console.log(`Unexpected error attempting to determine if executable file exists '${e}': ${t}`)}}if(r&&r.isFile()){if(Zr){const r=o.extname(e).toUpperCase();if(t.some((e=>e.toUpperCase()===r))){return e}}else{if(isUnixExecutable(r)){return e}}}const n=e;for(const s of t){e=n+s;r=undefined;try{r=yield Kr(e)}catch(t){if(t.code!=="ENOENT"){console.log(`Unexpected error attempting to determine if executable file exists '${e}': ${t}`)}}if(r&&r.isFile()){if(Zr){try{const t=o.dirname(e);const r=o.basename(e).toUpperCase();for(const n of yield Vr(t)){if(r===n.toUpperCase()){e=o.join(t,n);break}}}catch(t){console.log(`Unexpected error attempting to determine the actual case of the file '${e}': ${t}`)}return e}else{if(isUnixExecutable(r)){return e}}}}return""}))}function normalizeSeparators(e){e=e||"";if(Zr){e=e.replace(/\//g,"\\");return e.replace(/\\\\+/g,"\\")}return e.replace(/\/\/+/g,"/")}function isUnixExecutable(e){return(e.mode&1)>0||(e.mode&8)>0&&process.getgid!==undefined&&e.gid===process.getgid()||(e.mode&64)>0&&process.getuid!==undefined&&e.uid===process.getuid()}function getCmdPath(){var e;return(e=process.env["COMSPEC"])!==null&&e!==void 0?e:`cmd.exe`}var rn=undefined&&undefined.__awaiter||function(e,t,r,n){function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,s){function fulfilled(e){try{step(n.next(e))}catch(e){s(e)}}function rejected(e){try{step(n["throw"](e))}catch(e){s(e)}}function step(e){e.done?r(e.value):adopt(e.value).then(fulfilled,rejected)}step((n=n.apply(e,t||[])).next())}))};function io_cp(e,t){return rn(this,arguments,void 0,(function*(e,t,r={}){const{force:n,recursive:s,copySourceDirectory:i}=readCopyOptions(r);const a=(yield exists(t))?yield Kr(t):null;if(a&&a.isFile()&&!n){return}const c=a&&a.isDirectory()&&i?o.join(t,o.basename(e)):t;if(!(yield exists(e))){throw new Error(`no such file or directory: ${e}`)}const l=yield Kr(e);if(l.isDirectory()){if(!s){throw new Error(`Failed to copy. ${e} is a directory, but tried to copy without recursive flag.`)}else{yield cpDirRecursive(e,c,0,n)}}else{if(o.relative(e,c)===""){throw new Error(`'${c}' and '${e}' are the same file`)}yield io_copyFile(e,c,n)}}))}function mv(e,t){return rn(this,arguments,void 0,(function*(e,t,r={}){if(yield ioUtil.exists(t)){let n=true;if(yield ioUtil.isDirectory(t)){t=path.join(t,path.basename(e));n=yield ioUtil.exists(t)}if(n){if(r.force==null||r.force){yield rmRF(t)}else{throw new Error("Destination already exists")}}}yield mkdirP(path.dirname(t));yield ioUtil.rename(e,t)}))}function rmRF(e){return rn(this,void 0,void 0,(function*(){if(Zr){if(/[*"<>|]/.test(e)){throw new Error('File path must not contain `*`, `"`, `<`, `>` or `|` on Windows')}}try{yield Wr(e,{force:true,maxRetries:3,recursive:true,retryDelay:300})}catch(e){throw new Error(`File was unable to be removed ${e}`)}}))}function mkdirP(e){return rn(this,void 0,void 0,(function*(){(0,a.ok)(e,"a path argument must be provided");yield zr(e,{recursive:true})}))}function which(e,t){return rn(this,void 0,void 0,(function*(){if(!e){throw new Error("parameter 'tool' is required")}if(t){const t=yield which(e,false);if(!t){if(Zr){throw new Error(`Unable to locate executable file: ${e}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.`)}else{throw new Error(`Unable to locate executable file: ${e}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.`)}}return t}const r=yield findInPath(e);if(r&&r.length>0){return r[0]}return""}))}function findInPath(e){return rn(this,void 0,void 0,(function*(){if(!e){throw new Error("parameter 'tool' is required")}const t=[];if(Zr&&process.env["PATHEXT"]){for(const e of process.env["PATHEXT"].split(o.delimiter)){if(e){t.push(e)}}}if(isRooted(e)){const r=yield tryGetExecutablePath(e,t);if(r){return[r]}return[]}if(e.includes(o.sep)){return[]}const r=[];if(process.env.PATH){for(const e of process.env.PATH.split(o.delimiter)){if(e){r.push(e)}}}const n=[];for(const s of r){const r=yield tryGetExecutablePath(o.join(s,e),t);if(r){n.push(r)}}return n}))}function readCopyOptions(e){const t=e.force==null?true:e.force;const r=Boolean(e.recursive);const n=e.copySourceDirectory==null?true:Boolean(e.copySourceDirectory);return{force:t,recursive:r,copySourceDirectory:n}}function cpDirRecursive(e,t,r,n){return rn(this,void 0,void 0,(function*(){if(r>=255)return;r++;yield mkdirP(t);const s=yield Vr(e);for(const i of s){const s=`${e}/${i}`;const o=`${t}/${i}`;const a=yield Gr(s);if(a.isDirectory()){yield cpDirRecursive(s,o,r,n)}else{yield io_copyFile(s,o,n)}}yield _r(t,(yield Kr(e)).mode)}))}function io_copyFile(e,t,r){return rn(this,void 0,void 0,(function*(){if((yield Gr(e)).isSymbolicLink()){try{yield Gr(t);yield Xr(t)}catch(e){if(e.code==="EPERM"){yield _r(t,"0666");yield Xr(t)}}const r=yield readlink(e);yield $r(r,t,Zr?"junction":null)}else if(!(yield exists(t))||r){yield qr(e,t)}}))}const nn=e(import.meta.url)("timers");var sn=undefined&&undefined.__awaiter||function(e,t,r,n){function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,s){function fulfilled(e){try{step(n.next(e))}catch(e){s(e)}}function rejected(e){try{step(n["throw"](e))}catch(e){s(e)}}function step(e){e.done?r(e.value):adopt(e.value).then(fulfilled,rejected)}step((n=n.apply(e,t||[])).next())}))};const on=process.platform==="win32";class ToolRunner extends Ur.EventEmitter{constructor(e,t,r){super();if(!e){throw new Error("Parameter 'toolPath' cannot be null or empty.")}this.toolPath=e;this.args=t||[];this.options=r||{}}_debug(e){if(this.options.listeners&&this.options.listeners.debug){this.options.listeners.debug(e)}}_getCommandString(e,t){const r=this._getSpawnFileName();const n=this._getSpawnArgs(e);let s=t?"":"[command]";if(on){if(this._isCmdFile()){s+=r;for(const e of n){s+=` ${e}`}}else if(e.windowsVerbatimArguments){s+=`"${r}"`;for(const e of n){s+=` ${e}`}}else{s+=this._windowsQuoteCmdArg(r);for(const e of n){s+=` ${this._windowsQuoteCmdArg(e)}`}}}else{s+=r;for(const e of n){s+=` ${e}`}}return s}_processLineBuffer(e,t,r){try{let n=t+e.toString();let s=n.indexOf(cr.EOL);while(s>-1){const e=n.substring(0,s);r(e);n=n.substring(s+cr.EOL.length);s=n.indexOf(cr.EOL)}return n}catch(e){this._debug(`error processing line. Failed with error ${e}`);return""}}_getSpawnFileName(){if(on){if(this._isCmdFile()){return process.env["COMSPEC"]||"cmd.exe"}}return this.toolPath}_getSpawnArgs(e){if(on){if(this._isCmdFile()){let t=`/D /S /C "${this._windowsQuoteCmdArg(this.toolPath)}`;for(const r of this.args){t+=" ";t+=e.windowsVerbatimArguments?r:this._windowsQuoteCmdArg(r)}t+='"';return[t]}}return this.args}_endsWith(e,t){return e.endsWith(t)}_isCmdFile(){const e=this.toolPath.toUpperCase();return this._endsWith(e,".CMD")||this._endsWith(e,".BAT")}_windowsQuoteCmdArg(e){if(!this._isCmdFile()){return this._uvQuoteCmdArg(e)}if(!e){return'""'}const t=[" ","\t","&","(",")","[","]","{","}","^","=",";","!","'","+",",","`","~","|","<",">",'"'];let r=false;for(const n of e){if(t.some((e=>e===n))){r=true;break}}if(!r){return e}let n='"';let s=true;for(let t=e.length;t>0;t--){n+=e[t-1];if(s&&e[t-1]==="\\"){n+="\\"}else if(e[t-1]==='"'){s=true;n+='"'}else{s=false}}n+='"';return n.split("").reverse().join("")}_uvQuoteCmdArg(e){if(!e){return'""'}if(!e.includes(" ")&&!e.includes("\t")&&!e.includes('"')){return e}if(!e.includes('"')&&!e.includes("\\")){return`"${e}"`}let t='"';let r=true;for(let n=e.length;n>0;n--){t+=e[n-1];if(r&&e[n-1]==="\\"){t+="\\"}else if(e[n-1]==='"'){r=true;t+="\\"}else{r=false}}t+='"';return t.split("").reverse().join("")}_cloneExecOptions(e){e=e||{};const t={cwd:e.cwd||process.cwd(),env:e.env||process.env,silent:e.silent||false,windowsVerbatimArguments:e.windowsVerbatimArguments||false,failOnStdErr:e.failOnStdErr||false,ignoreReturnCode:e.ignoreReturnCode||false,delay:e.delay||1e4};t.outStream=e.outStream||process.stdout;t.errStream=e.errStream||process.stderr;return t}_getSpawnOptions(e,t){e=e||{};const r={};r.cwd=e.cwd;r.env=e.env;r["windowsVerbatimArguments"]=e.windowsVerbatimArguments||this._isCmdFile();if(e.windowsVerbatimArguments){r.argv0=`"${t}"`}return r}exec(){return sn(this,void 0,void 0,(function*(){if(!isRooted(this.toolPath)&&(this.toolPath.includes("/")||on&&this.toolPath.includes("\\"))){this.toolPath=o.resolve(process.cwd(),this.options.cwd||process.cwd(),this.toolPath)}this.toolPath=yield which(this.toolPath,true);return new Promise(((e,t)=>sn(this,void 0,void 0,(function*(){this._debug(`exec tool: ${this.toolPath}`);this._debug("arguments:");for(const e of this.args){this._debug(` ${e}`)}const r=this._cloneExecOptions(this.options);if(!r.silent&&r.outStream){r.outStream.write(this._getCommandString(r)+cr.EOL)}const n=new ExecState(r,this.toolPath);n.on("debug",(e=>{this._debug(e)}));if(this.options.cwd&&!(yield exists(this.options.cwd))){return t(new Error(`The cwd: ${this.options.cwd} does not exist!`))}const s=this._getSpawnFileName();const i=Or.spawn(s,this._getSpawnArgs(r),this._getSpawnOptions(this.options,s));let o="";if(i.stdout){i.stdout.on("data",(e=>{if(this.options.listeners&&this.options.listeners.stdout){this.options.listeners.stdout(e)}if(!r.silent&&r.outStream){r.outStream.write(e)}o=this._processLineBuffer(e,o,(e=>{if(this.options.listeners&&this.options.listeners.stdline){this.options.listeners.stdline(e)}}))}))}let a="";if(i.stderr){i.stderr.on("data",(e=>{n.processStderr=true;if(this.options.listeners&&this.options.listeners.stderr){this.options.listeners.stderr(e)}if(!r.silent&&r.errStream&&r.outStream){const t=r.failOnStdErr?r.errStream:r.outStream;t.write(e)}a=this._processLineBuffer(e,a,(e=>{if(this.options.listeners&&this.options.listeners.errline){this.options.listeners.errline(e)}}))}))}i.on("error",(e=>{n.processError=e.message;n.processExited=true;n.processClosed=true;n.CheckComplete()}));i.on("exit",(e=>{n.processExitCode=e;n.processExited=true;this._debug(`Exit code ${e} received from tool '${this.toolPath}'`);n.CheckComplete()}));i.on("close",(e=>{n.processExitCode=e;n.processExited=true;n.processClosed=true;this._debug(`STDIO streams have closed for tool '${this.toolPath}'`);n.CheckComplete()}));n.on("done",((r,n)=>{if(o.length>0){this.emit("stdline",o)}if(a.length>0){this.emit("errline",a)}i.removeAllListeners();if(r){t(r)}else{e(n)}}));if(this.options.input){if(!i.stdin){throw new Error("child process missing stdin")}i.stdin.end(this.options.input)}}))))}))}}function argStringToArray(e){const t=[];let r=false;let n=false;let s="";function append(e){if(n&&e!=='"'){s+="\\"}s+=e;n=false}for(let i=0;i0){t.push(s);s=""}continue}append(o)}if(s.length>0){t.push(s.trim())}return t}class ExecState extends Ur.EventEmitter{constructor(e,t){super();this.processClosed=false;this.processError="";this.processExitCode=0;this.processExited=false;this.processStderr=false;this.delay=1e4;this.done=false;this.timeout=null;if(!t){throw new Error("toolPath must not be empty")}this.options=e;this.toolPath=t;if(e.delay){this.delay=e.delay}}CheckComplete(){if(this.done){return}if(this.processClosed){this._setResult()}else if(this.processExited){this.timeout=(0,nn.setTimeout)(ExecState.HandleTimeout,this.delay,this)}}_debug(e){this.emit("debug",e)}_setResult(){let e;if(this.processExited){if(this.processError){e=new Error(`There was an error when attempting to execute the process '${this.toolPath}'. This may indicate the process failed to start. Error: ${this.processError}`)}else if(this.processExitCode!==0&&!this.options.ignoreReturnCode){e=new Error(`The process '${this.toolPath}' failed with exit code ${this.processExitCode}`)}else if(this.processStderr&&this.options.failOnStdErr){e=new Error(`The process '${this.toolPath}' failed because one or more lines were written to the STDERR stream`)}}if(this.timeout){clearTimeout(this.timeout);this.timeout=null}this.done=true;this.emit("done",e,this.processExitCode)}static HandleTimeout(e){if(e.done){return}if(!e.processClosed&&e.processExited){const t=`The STDIO streams did not close within ${e.delay/1e3} seconds of the exit event from process '${e.toolPath}'. This may indicate a child process inherited the STDIO streams and has not yet exited.`;e._debug(t)}e._setResult()}}var an=undefined&&undefined.__awaiter||function(e,t,r,n){function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,s){function fulfilled(e){try{step(n.next(e))}catch(e){s(e)}}function rejected(e){try{step(n["throw"](e))}catch(e){s(e)}}function step(e){e.done?r(e.value):adopt(e.value).then(fulfilled,rejected)}step((n=n.apply(e,t||[])).next())}))};function exec_exec(e,t,r){return an(this,void 0,void 0,(function*(){const n=argStringToArray(e);if(n.length===0){throw new Error(`Parameter 'commandLine' cannot be null or empty.`)}const s=n[0];t=n.slice(1).concat(t||[]);const i=new ToolRunner(s,t,r);return i.exec()}))}function getExecOutput(e,t,r){return an(this,void 0,void 0,(function*(){var n,s;let i="";let o="";const a=new StringDecoder("utf8");const c=new StringDecoder("utf8");const l=(n=r===null||r===void 0?void 0:r.listeners)===null||n===void 0?void 0:n.stdout;const A=(s=r===null||r===void 0?void 0:r.listeners)===null||s===void 0?void 0:s.stderr;const stdErrListener=e=>{o+=c.write(e);if(A){A(e)}};const stdOutListener=e=>{i+=a.write(e);if(l){l(e)}};const u=Object.assign(Object.assign({},r===null||r===void 0?void 0:r.listeners),{stdout:stdOutListener,stderr:stdErrListener});const d=yield exec_exec(e,t,Object.assign(Object.assign({},r),{listeners:u}));i+=a.end();o+=c.end();return{exitCode:d,stdout:i,stderr:o}}))}var cn=undefined&&undefined.__awaiter||function(e,t,r,n){function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,s){function fulfilled(e){try{step(n.next(e))}catch(e){s(e)}}function rejected(e){try{step(n["throw"](e))}catch(e){s(e)}}function step(e){e.done?r(e.value):adopt(e.value).then(fulfilled,rejected)}step((n=n.apply(e,t||[])).next())}))};const getWindowsInfo=()=>cn(void 0,void 0,void 0,(function*(){const{stdout:e}=yield exec.getExecOutput('powershell -command "(Get-CimInstance -ClassName Win32_OperatingSystem).Version"',undefined,{silent:true});const{stdout:t}=yield exec.getExecOutput('powershell -command "(Get-CimInstance -ClassName Win32_OperatingSystem).Caption"',undefined,{silent:true});return{name:t.trim(),version:e.trim()}}));const getMacOsInfo=()=>cn(void 0,void 0,void 0,(function*(){var e,t,r,n;const{stdout:s}=yield exec.getExecOutput("sw_vers",undefined,{silent:true});const i=(t=(e=s.match(/ProductVersion:\s*(.+)/))===null||e===void 0?void 0:e[1])!==null&&t!==void 0?t:"";const o=(n=(r=s.match(/ProductName:\s*(.+)/))===null||r===void 0?void 0:r[1])!==null&&n!==void 0?n:"";return{name:o,version:i}}));const getLinuxInfo=()=>cn(void 0,void 0,void 0,(function*(){const{stdout:e}=yield exec.getExecOutput("lsb_release",["-i","-r","-s"],{silent:true});const[t,r]=e.trim().split("\n");return{name:t,version:r}}));const ln=cr.platform();const An=cr.arch();const un=ln==="win32";const dn=ln==="darwin";const gn=ln==="linux";function getDetails(){return cn(this,void 0,void 0,(function*(){return Object.assign(Object.assign({},yield un?getWindowsInfo():dn?getMacOsInfo():getLinuxInfo()),{platform:ln,arch:An,isWindows:un,isMacOS:dn,isLinux:gn})}))}var pn=undefined&&undefined.__awaiter||function(e,t,r,n){function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,s){function fulfilled(e){try{step(n.next(e))}catch(e){s(e)}}function rejected(e){try{step(n["throw"](e))}catch(e){s(e)}}function step(e){e.done?r(e.value):adopt(e.value).then(fulfilled,rejected)}step((n=n.apply(e,t||[])).next())}))};var hn;(function(e){e[e["Success"]=0]="Success";e[e["Failure"]=1]="Failure"})(hn||(hn={}));function exportVariable(e,t){const r=toCommandValue(t);process.env[e]=r;const n=process.env["GITHUB_ENV"]||"";if(n){return issueFileCommand("ENV",prepareKeyValueMessage(e,t))}issueCommand("set-env",{name:e},r)}function core_setSecret(e){command_issueCommand("add-mask",{},e)}function addPath(e){const t=process.env["GITHUB_PATH"]||"";if(t){file_command_issueFileCommand("PATH",e)}else{command_issueCommand("add-path",{},e)}process.env["PATH"]=`${e}${o.delimiter}${process.env["PATH"]}`}function getInput(e,t){const r=process.env[`INPUT_${e.replace(/ /g,"_").toUpperCase()}`]||"";if(t&&t.required&&!r){throw new Error(`Input required and not supplied: ${e}`)}if(t&&t.trimWhitespace===false){return r}return r.trim()}function getMultilineInput(e,t){const r=getInput(e,t).split("\n").filter((e=>e!==""));if(t&&t.trimWhitespace===false){return r}return r.map((e=>e.trim()))}function getBooleanInput(e,t){const r=["true","True","TRUE"];const n=["false","False","FALSE"];const s=getInput(e,t);if(r.includes(s))return true;if(n.includes(s))return false;throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${e}\n`+`Support boolean input list: \`true | True | TRUE | false | False | FALSE\``)}function setOutput(e,t){const r=process.env["GITHUB_OUTPUT"]||"";if(r){return file_command_issueFileCommand("OUTPUT",file_command_prepareKeyValueMessage(e,t))}process.stdout.write(cr.EOL);command_issueCommand("set-output",{name:e},utils_toCommandValue(t))}function setCommandEcho(e){issue("echo",e?"on":"off")}function setFailed(e){process.exitCode=hn.Failure;core_error(e)}function isDebug(){return process.env["RUNNER_DEBUG"]==="1"}function core_debug(e){command_issueCommand("debug",{},e)}function core_error(e,t={}){command_issueCommand("error",utils_toCommandProperties(t),e instanceof Error?e.toString():e)}function warning(e,t={}){command_issueCommand("warning",utils_toCommandProperties(t),e instanceof Error?e.toString():e)}function notice(e,t={}){issueCommand("notice",toCommandProperties(t),e instanceof Error?e.toString():e)}function info(e){process.stdout.write(e+cr.EOL)}function startGroup(e){command_issue("group",e)}function endGroup(){command_issue("endgroup")}function group(e,t){return pn(this,void 0,void 0,(function*(){startGroup(e);let r;try{r=yield t()}finally{endGroup()}return r}))}function saveState(e,t){const r=process.env["GITHUB_STATE"]||"";if(r){return issueFileCommand("STATE",prepareKeyValueMessage(e,t))}issueCommand("save-state",{name:e},toCommandValue(t))}function getState(e){return process.env[`STATE_${e}`]||""}function getIDToken(e){return pn(this,void 0,void 0,(function*(){return yield OidcClient.getIDToken(e)}))}const mn=cr.platform();const fn=cr.arch();async function getInputs(){return{distribution:getInput("distribution")||"goreleaser",version:getInput("version")||"~> v2",versionFile:getInput("version-file"),args:getInput("args"),workdir:getInput("workdir")||".",installOnly:getBooleanInput("install-only"),cacheBinary:getBooleanInput("cache-binary")}} -/*! js-yaml 5.2.2 https://github.com/nodeca/js-yaml @license MIT */ -var Cn=Symbol("NOT_RESOLVED");var yn=Symbol("MERGE_KEY");function defineScalarTag(e,t){return{tagName:e,nodeKind:"scalar",implicit:t.implicit??false,matchByTagPrefix:t.matchByTagPrefix??false,implicitFirstChars:t.implicitFirstChars??null,resolve:t.resolve,identify:t.identify??null,represent:t.represent??(e=>String(e)),representTagName:t.representTagName??null}}function defineSequenceTag(e,t){const r=t.finalize===void 0;return{tagName:e,nodeKind:"sequence",implicit:false,matchByTagPrefix:t.matchByTagPrefix??false,create:t.create,addItem:t.addItem,finalize:t.finalize??(e=>e),carrierIsResult:r,identify:t.identify??null,represent:t.represent??(e=>e),representTagName:t.representTagName??null}}function defineMappingTag(e,t){const r=t.finalize===void 0;return{tagName:e,nodeKind:"mapping",implicit:false,matchByTagPrefix:t.matchByTagPrefix??false,create:t.create,addPair:t.addPair,has:t.has,keys:t.keys,get:t.get,finalize:t.finalize??(e=>e),carrierIsResult:r,identify:t.identify??null,represent:t.represent??(e=>e),representTagName:t.representTagName??null}}var En=defineScalarTag("tag:yaml.org,2002:str",{resolve:e=>e,identify:e=>typeof e==="string"});var In=["","~","null","Null","NULL"];var Bn=defineScalarTag("tag:yaml.org,2002:null",{implicit:true,implicitFirstChars:["","~","n","N"],resolve:e=>{if(In.indexOf(e)!==-1)return null;return Cn},identify:e=>e===null,represent:()=>"null"});var Qn=defineScalarTag("tag:yaml.org,2002:null",{implicit:true,implicitFirstChars:["n"],resolve:(e,t)=>{if(e==="null"||t&&e==="")return null;return Cn},identify:e=>e===null,represent:()=>"null"});var bn=["","~","null","Null","NULL"];var Sn=defineScalarTag("tag:yaml.org,2002:null",{implicit:true,implicitFirstChars:["","~","n","N"],resolve:e=>{if(bn.indexOf(e)!==-1)return null;return Cn},identify:e=>e===null,represent:()=>"null"});var wn=["true","True","TRUE"];var Dn=["false","False","FALSE"];var Nn=defineScalarTag("tag:yaml.org,2002:bool",{implicit:true,implicitFirstChars:["t","T","f","F"],resolve:e=>{if(wn.indexOf(e)!==-1)return true;if(Dn.indexOf(e)!==-1)return false;return Cn},identify:e=>Object.prototype.toString.call(e)==="[object Boolean]",represent:e=>e?"true":"false"});var xn=["true"];var Rn=["false"];var vn=defineScalarTag("tag:yaml.org,2002:bool",{implicit:true,implicitFirstChars:["t","f"],resolve:e=>{if(xn.indexOf(e)!==-1)return true;if(Rn.indexOf(e)!==-1)return false;return Cn},identify:e=>Object.prototype.toString.call(e)==="[object Boolean]",represent:e=>e?"true":"false"});var kn=["true","True","TRUE","y","Y","yes","Yes","YES","on","On","ON"];var Fn=["false","False","FALSE","n","N","no","No","NO","off","Off","OFF"];var Tn=defineScalarTag("tag:yaml.org,2002:bool",{implicit:true,implicitFirstChars:["y","Y","n","N","t","T","f","F","o","O"],resolve:e=>{if(kn.indexOf(e)!==-1)return true;if(Fn.indexOf(e)!==-1)return false;return Cn},identify:e=>Object.prototype.toString.call(e)==="[object Boolean]",represent:e=>e?"true":"false"});var Mn=new RegExp("^(?:0o[0-7]+|0x[0-9a-fA-F]+|[-+]?[0-9]+)$");var Pn=new RegExp("^(?:[-+]?0b[0-1]+|[-+]?0o[0-7]+|[-+]?0x[0-9a-fA-F]+|[-+]?[0-9]+)$");function parseYamlInteger$2(e){let t=e;let r=1;if(t[0]==="-"||t[0]==="+"){if(t[0]==="-")r=-1;t=t.slice(1)}if(t.startsWith("0b"))return r*parseInt(t.slice(2),2);if(t.startsWith("0o"))return r*parseInt(t.slice(2),8);if(t.startsWith("0x"))return r*parseInt(t.slice(2),16);return r*parseInt(t,10)}function resolveYamlInteger$2(e,t){if(t){if(!Pn.test(e))return Cn}else if(!Mn.test(e))return Cn;const r=parseYamlInteger$2(e);return Number.isFinite(r)?r:Cn}var Ln=defineScalarTag("tag:yaml.org,2002:int",{implicit:true,implicitFirstChars:["-","+",..."0123456789"],resolve:resolveYamlInteger$2,identify:e=>Number.isInteger(e)&&!Object.is(e,-0)&&e.toString(10).indexOf("e")<0,represent:e=>e.toString(10)});var Un=new RegExp("^-?(?:0|[1-9][0-9]*)$");var On=new RegExp("^(?:[-+]?0b[0-1]+|[-+]?0o[0-7]+|[-+]?0x[0-9a-fA-F]+|[-+]?[0-9]+)$");function parseYamlInteger$1(e){let t=e;let r=1;if(t[0]==="-"||t[0]==="+"){if(t[0]==="-")r=-1;t=t.slice(1)}if(t.startsWith("0b"))return r*parseInt(t.slice(2),2);if(t.startsWith("0o"))return r*parseInt(t.slice(2),8);if(t.startsWith("0x"))return r*parseInt(t.slice(2),16);return r*parseInt(t,10)}function resolveYamlInteger$1(e,t){if(t){if(!On.test(e))return Cn}else if(!Un.test(e))return Cn;const r=parseYamlInteger$1(e);return Number.isFinite(r)?r:Cn}var Hn=defineScalarTag("tag:yaml.org,2002:int",{implicit:true,implicitFirstChars:["-",..."0123456789"],resolve:resolveYamlInteger$1,identify:e=>Number.isInteger(e)&&!Object.is(e,-0)&&e.toString(10).indexOf("e")<0,represent:e=>e.toString(10)});var _n=new RegExp("^(?:[-+]?0b[0-1_]+|[-+]?0[0-7_]+|[-+]?0x[0-9a-fA-F_]+|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+|[-+]?(?:0|[1-9][0-9_]*))$");function parseYamlInteger(e){let t=e.replace(/_/g,"");let r=1;if(t[0]==="-"||t[0]==="+"){if(t[0]==="-")r=-1;t=t.slice(1)}if(t.startsWith("0b"))return r*parseInt(t.slice(2),2);if(t.startsWith("0x"))return r*parseInt(t.slice(2),16);if(t.includes(":")){let e=0;for(const r of t.split(":"))e=e*60+Number(r);return r*e}if(t!=="0"&&t[0]==="0")return r*parseInt(t,8);return r*parseInt(t,10)}function resolveYamlInteger(e){if(!_n.test(e))return Cn;const t=parseYamlInteger(e);return Number.isFinite(t)?t:Cn}var qn=defineScalarTag("tag:yaml.org,2002:int",{implicit:true,implicitFirstChars:["-","+",..."0123456789"],resolve:resolveYamlInteger,identify:e=>Number.isInteger(e)&&!Object.is(e,-0)&&e.toString(10).indexOf("e")<0,represent:e=>e.toString(10)});var Gn=new RegExp("^(?:[-+]?[0-9]+(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|[-+]?\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var zn=new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function resolveYamlFloat$2(e){if(!Gn.test(e))return Cn;let t=e.toLowerCase();const r=t[0]==="-"?-1:1;if("+-".includes(t[0]))t=t.slice(1);if(t===".inf")return r===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY;if(t===".nan")return NaN;const n=r*parseFloat(t);if(Number.isFinite(n)||zn.test(e))return n;return Cn}function representYamlFloat$2(e){if(isNaN(e))return".nan";if(e===Number.POSITIVE_INFINITY)return".inf";if(e===Number.NEGATIVE_INFINITY)return"-.inf";if(Object.is(e,-0))return"-0.0";const t=e.toString(10);return/^[-+]?[0-9]+e/.test(t)?t.replace("e",".e"):t}var Yn=defineScalarTag("tag:yaml.org,2002:float",{implicit:true,implicitFirstChars:["-","+",".",..."0123456789"],resolve:resolveYamlFloat$2,identify:e=>typeof e==="number"&&(!Number.isInteger(e)||Object.is(e,-0)||e.toString(10).indexOf("e")>=0),represent:representYamlFloat$2});var Vn=new RegExp("^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$");var Jn=new RegExp("^(?:[-+]?[0-9]+(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|[-+]?\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function resolveYamlFloat$1(e,t){if(t){if(!Jn.test(e))return Cn;let t=e.toLowerCase();const r=t[0]==="-"?-1:1;if("+-".includes(t[0]))t=t.slice(1);if(t===".inf")return r===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY;if(t===".nan")return NaN;const n=r*parseFloat(t);return Number.isFinite(n)?n:Cn}if(!Vn.test(e))return Cn;const r=Number(e);if(Number.isFinite(r))return r;return Cn}function representYamlFloat$1(e){if(isNaN(e))return".nan";if(e===Number.POSITIVE_INFINITY)return".inf";if(e===Number.NEGATIVE_INFINITY)return"-.inf";if(Object.is(e,-0))return"-0.0";const t=e.toString(10);return/^[-+]?[0-9]+e/.test(t)?t.replace("e",".e"):t}var Wn=defineScalarTag("tag:yaml.org,2002:float",{implicit:true,implicitFirstChars:["-",..."0123456789"],resolve:resolveYamlFloat$1,identify:e=>typeof e==="number"&&(!Number.isInteger(e)||Object.is(e,-0)||e.toString(10).indexOf("e")>=0),represent:representYamlFloat$1});var jn=new RegExp("^(?:[-+]?(?:(?:[0-9][0-9_]*)?\\.[0-9_]*)(?:[eE][-+][0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var Kn=new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function resolveYamlFloat(e){if(!jn.test(e))return Cn;let t=e.toLowerCase().replace(/_/g,"");const r=t[0]==="-"?-1:1;if("+-".includes(t[0]))t=t.slice(1);if(t===".inf")return r===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY;if(t===".nan")return NaN;let n=0;if(t.includes(":")){for(const e of t.split(":"))n=n*60+Number(e);n*=r}else n=r*parseFloat(t);if(Number.isFinite(n)||Kn.test(e))return n;return Cn}function representYamlFloat(e){if(isNaN(e))return".nan";if(e===Number.POSITIVE_INFINITY)return".inf";if(e===Number.NEGATIVE_INFINITY)return"-.inf";if(Object.is(e,-0))return"-0.0";const t=e.toString(10);return/^[-+]?[0-9]+e/.test(t)?t.replace("e",".e"):t}var $n=defineScalarTag("tag:yaml.org,2002:float",{implicit:true,implicitFirstChars:["-","+",".",..."0123456789"],resolve:resolveYamlFloat,identify:e=>typeof e==="number"&&(!Number.isInteger(e)||Object.is(e,-0)||e.toString(10).indexOf("e")>=0),represent:representYamlFloat});var Xn=defineScalarTag("tag:yaml.org,2002:merge",{implicit:true,implicitFirstChars:["<"],resolve:(e,t)=>{if(e==="<<"||t&&e==="")return yn;return Cn}});var Zn=/^[A-Za-z0-9+/]*={0,2}$/;function resolveYamlBinary(e){const t=e.replace(/\s/g,"");if(t.length%4!==0||!Zn.test(t))return Cn;const r=atob(t);const n=new Uint8Array(r.length);for(let e=0;eObject.prototype.toString.call(e)==="[object Uint8Array]",represent:representYamlBinary});var ts=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$");var rs=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function resolveYamlTimestamp(e){let t=ts.exec(e);if(t===null)t=rs.exec(e);if(t===null)return Cn;const r=+t[1];const n=+t[2]-1;const s=+t[3];if(!t[4]){const e=new Date(Date.UTC(r,n,s));if(e.getUTCFullYear()!==r||e.getUTCMonth()!==n||e.getUTCDate()!==s)return Cn;return e}const i=+t[4];const o=+t[5];const a=+t[6];let c=0;if(i>23||o>59||a>59)return Cn;if(t[7]){let e=t[7].slice(0,3);while(e.length<3)e+="0";c=+e}const l=new Date(Date.UTC(r,n,s,i,o,a,c));if(l.getUTCFullYear()!==r||l.getUTCMonth()!==n||l.getUTCDate()!==s)return Cn;if(t[9]){const e=+t[10];const r=+(t[11]||0);if(e>23||r>59)return Cn;const n=(e*60+r)*6e4;l.setTime(l.getTime()-(t[9]==="-"?-n:n))}return l}var ns=defineScalarTag("tag:yaml.org,2002:timestamp",{implicit:true,implicitFirstChars:[..."0123456789"],resolve:resolveYamlTimestamp,identify:e=>e instanceof Date,represent:e=>e.toISOString()});var ss=defineSequenceTag("tag:yaml.org,2002:seq",{create:()=>[],addItem:(e,t)=>{e.push(t)},identify:Array.isArray});function isPlainObject(e){if(e===null||typeof e!=="object"||Array.isArray(e))return false;const t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}function pick(e,t){const r={};for(const n of t)if(e[n]!==void 0)r[n]=e[n];return r}var as=defineSequenceTag("tag:yaml.org,2002:omap",{create:()=>({list:[],seen:new Set}),addItem:(e,t)=>{let r;if(t instanceof Map){if(t.size!==1)return"cannot resolve an ordered map item";r=t.keys().next().value}else if(isPlainObject(t)){const e=Object.keys(t);if(e.length!==1)return"cannot resolve an ordered map item";r=e[0]}else return"cannot resolve an ordered map item";if(e.seen.has(r))return"duplicate key in ordered map";e.seen.add(r);e.list.push(t);return""},finalize:e=>e.list});var cs=defineSequenceTag("tag:yaml.org,2002:pairs",{create:()=>[],addItem:(e,t)=>{if(t instanceof Map){if(t.size!==1)return"cannot resolve a pairs item";e.push(t.entries().next().value);return""}if(Object.prototype.toString.call(t)!=="[object Object]")return"cannot resolve a pairs item";const r=t;const n=Object.keys(r);if(n.length!==1)return"cannot resolve a pairs item";e.push([n[0],r[n[0]]]);return""}});var ls=defineMappingTag("tag:yaml.org,2002:map",{create:()=>({}),identify:isPlainObject,represent:e=>{const t=new Map;for(const r of Object.keys(e))t.set(r,e[r]);return t},addPair:(e,t,r)=>{if(t!==null&&typeof t==="object")return"object-based map does not support complex keys";const n=String(t);if(n==="__proto__")Object.defineProperty(e,n,{value:r,enumerable:true,configurable:true,writable:true});else e[n]=r;return""},has:(e,t)=>{if(t!==null&&typeof t==="object")return false;return Object.prototype.hasOwnProperty.call(e,String(t))},keys:e=>Object.keys(e),get:(e,t)=>e[String(t)]});var As=defineMappingTag("tag:yaml.org,2002:set",{create:()=>new Set,identify:e=>e instanceof Set,represent:e=>{const t=new Map;for(const r of e)t.set(r,null);return t},addPair:(e,t,r)=>{if(r!==null)return"cannot resolve a set item";e.add(t);return""},has:(e,t)=>e.has(t),keys:e=>e.keys(),get:()=>null});function createTagDefinitionMap(){return{scalar:{},sequence:{},mapping:{}}}function createTagDefinitionListMap(){return{scalar:[],sequence:[],mapping:[]}}function compileTags(e){const t=[];for(const r of e){let e=t.length;for(let n=0;ne.implicitFirstChars===null));const o=new Set;for(const e of r)if(e.implicitFirstChars!==null)for(const t of e.implicitFirstChars)o.add(t);const a=new Map;for(const e of o)a.set(e,r.filter((t=>t.implicitFirstChars===null||t.implicitFirstChars.indexOf(e)!==-1)));const c=n.scalar["tag:yaml.org,2002:str"];if(!c)throw new Error("schema does not define the default scalar tag (tag:yaml.org,2002:str)");this.tags=t;this.implicitScalarTags=r;this.implicitScalarByFirstChar=a;this.implicitScalarAnyFirstChar=i;this.defaultScalarTag=c;this.defaultSequenceTag=n.sequence["tag:yaml.org,2002:seq"];this.defaultMappingTag=n.mapping["tag:yaml.org,2002:map"];this.exact=n;this.prefix=s}withTags(...e){let t=[];for(const r of e)t=t.concat(r);return new Schema([...this.tags,...t])}};var ds=new us([En,ss,ls]);var gs=new us([...ds.tags,Qn,vn,Hn,Wn]);var ps=new us([...ds.tags,Bn,Nn,Ln,Yn]);var hs=new us([...ds.tags,Sn,Tn,qn,$n,ns,Xn,es,as,cs,As]);var ms=defineMappingTag("tag:yaml.org,2002:map",{create:()=>new Map,addPair:(e,t,r)=>{e.set(t,r);return""},has:(e,t)=>e.has(t),keys:e=>e.keys(),get:(e,t)=>e.get(t),identify:e=>e instanceof Map||isPlainObject(e),represent:e=>{if(e instanceof Map)return e;const t=new Map;const r=e;for(const e of Object.keys(r))t.set(e,r[e]);return t}});function normalizeKey(e){if(Array.isArray(e)){const t=Array.prototype.slice.call(e);for(let e=0;e({}),identify:isPlainObject,represent:e=>{const t=new Map;for(const r of Object.keys(e))t.set(r,e[r]);return t},addPair:(e,t,r)=>{const n=normalizeKey(t);if(n===null)return"nested arrays are not supported inside keys";if(n==="__proto__")Object.defineProperty(e,n,{value:r,enumerable:true,configurable:true,writable:true});else e[n]=r;return""},has:(e,t)=>{const r=normalizeKey(t);return r!==null&&Object.prototype.hasOwnProperty.call(e,r)},keys:e=>Object.keys(e),get:(e,t)=>e[String(t)]});var ys={maxLength:79,indent:1,linesBefore:3,linesAfter:2};function getLine(e,t,r,n,s){let i="";let o="";const a=Math.floor(s/2)-1;if(n-t>a){i=" ... ";t=n-a+i.length}if(r-n>a){o=" ...";r=n+a-o.length}return{str:i+e.slice(t,r).replace(/\t/g,"→")+o,pos:n-t+i.length}}function padStart(e,t){return" ".repeat(Math.max(t-e.length,0))+e}function makeSnippet(e,t){if(!e.buffer)return null;const r={...ys,...t};const n=/\r?\n|\r|\0/g;const s=[0];const i=[];let o;let a=-1;while(o=n.exec(e.buffer)){i.push(o.index);s.push(o.index+o[0].length);if(e.position<=o.index&&a<0)a=s.length-2}if(a<0)a=s.length-1;let c="";const l=Math.min(e.line+r.linesAfter,i.length).toString().length;const A=r.maxLength-(r.indent+l+3);for(let t=1;t<=r.linesBefore;t++){if(a-t<0)break;const n=getLine(e.buffer,s[a-t],i[a-t],e.position-(s[a]-s[a-t]),A);c=`${" ".repeat(r.indent)}${padStart((e.line-t+1).toString(),l)} | ${n.str}\n${c}`}const u=getLine(e.buffer,s[a],i[a],e.position,A);c+=`${" ".repeat(r.indent)}${padStart((e.line+1).toString(),l)} | ${u.str}\n`;c+=`${"-".repeat(r.indent+l+3+u.pos)}^\n`;for(let t=1;t<=r.linesAfter;t++){if(a+t>=i.length)break;const n=getLine(e.buffer,s[a+t],i[a+t],e.position-(s[a]-s[a+t]),A);c+=`${" ".repeat(r.indent)}${padStart((e.line+t+1).toString(),l)} | ${n.str}\n`}return c.replace(/\n$/,"")}function formatError(e,t){let r="";if(!e.mark)return e.reason;if(e.mark.name)r+=`in "${e.mark.name}" `;r+=`(${e.mark.line+1}:${e.mark.column+1})`;if(!t&&e.mark.snippet)r+=`\n\n${e.mark.snippet}`;return`${e.reason} ${r}`}var Es=class extends Error{reason;mark;constructor(e,t){super();this.name="YAMLException";this.reason=e;this.mark=t;this.message=formatError(this,false);if(Error.captureStackTrace)Error.captureStackTrace(this,this.constructor)}toString(e){return`${this.name}: ${formatError(this,e)}`}};function throwErrorAt(e,t,r,n=""){let s=0;let i=0;for(let r=0;r>10)+55296,(e-65536&1023)+56320)}function fromHexCode$1(e){if(e>=48&&e<=57)return e-48;return(e|32)-97+10}function escapedHexLen$1(e){if(e===120)return 2;if(e===117)return 4;return 8}function skipFoldedBreaks(e,t,r){let n=0;while(t0;r--){s++;const t=fromHexCode$1(e.charCodeAt(s));i=(i<<4)+t}n+=charFromCodepoint(i);s++}i=o=s}else if(t===10||t===13){n+=e.slice(i,o);const t=skipFoldedBreaks(e,s,r);n+=foldedBreaks(t.breaks);s=i=o=t.position}else{s++;if(t!==32&&t!==9)o=s}}return n+e.slice(i,r)}function getBlockValue(e,t,r,n,s,i){const o=n<0?0:n;const a=e.slice(t,r).replace(/\r\n?/g,"\n");const c=a===""?[]:(a.endsWith("\n")?a.slice(0,-1):a).split("\n");let l="";let A=false;let u=0;let d=false;for(const e of c){let t=0;while(t=e.length){u++;continue}const r=e.slice(o);const s=r.charCodeAt(0);if(i)if(s===32||s===9){d=true;l+="\n".repeat(A?1+u:u)}else if(d){d=false;l+="\n".repeat(u+1)}else if(u===0){if(A)l+=" "}else l+="\n".repeat(u);else l+="\n".repeat(A?1+u:u);l+=r;A=true;u=0}if(s===3)l+="\n".repeat(A?1+u:u);else if(s!==2){if(A)l+="\n"}return l}function getScalarValue(e,t){if(t.valueStart===Ls)return"";const{valueStart:r,valueEnd:n}=t;if(t.fast)return e.slice(r,n);switch(t.style){case 2:return getSingleQuotedValue(e,r,n);case 3:return getDoubleQuotedValue(e,r,n);case 4:return getBlockValue(e,r,n,t.indent,t.chomping,false);case 5:return getBlockValue(e,r,n,t.indent,t.chomping,true);default:return getPlainValue(e,r,n)}}var Hs={"!":"!","!!":"tag:yaml.org,2002:"};function tagPercentEncode(e){return encodeURI(e).replace(/!/g,"%21")}function tagNameFull(e,t){if(e.startsWith("!<")&&e.endsWith(">"))return decodeURIComponent(e.slice(2,-1));const r=e.indexOf("!",1);const n=r===-1?"!":e.slice(0,r+1);const s=t?.[n]??Hs[n]??n;return decodeURIComponent(s)+decodeURIComponent(e.slice(n.length))}function tagNameShort(e){let t=e;if(t.charCodeAt(0)===33){t=t.slice(1);return`!${tagPercentEncode(t)}`}if(t.slice(0,18)==="tag:yaml.org,2002:")return`!!${tagPercentEncode(t.slice(18))}`;return`!<${tagPercentEncode(t)}>`}var _s=-1;var qs={filename:"",schema:ps,json:false,maxTotalMergeKeys:1e4,maxAliases:-1};function eventPosition$1(e){if("tagStart"in e&&e.tagStart!==_s)return e.tagStart;if("anchorStart"in e&&e.anchorStart!==_s)return e.anchorStart;if("valueStart"in e&&e.valueStart!==_s)return e.valueStart;if("start"in e)return e.start;return 0}function throwError$1(e,t){throwErrorAt(e.source,e.position,t,e.filename)}function finalizeCollection(e,t,r,n){try{return r.finalize(n)}catch(r){if(r instanceof Es)throw r;throwErrorAt(e.source,t,r instanceof Error?r.message:String(r),e.filename)}}function lookupTag(e,t,r){const n=e[r];if(n)return n;for(const e of t)if(r.startsWith(e.tagName))return e}function findExplicitTag(e,t,r,n,s){const i=lookupTag(t,r,n);if(i)return i;throwError$1(e,`unknown ${s} tag !<${n}>`)}function constructScalar(e,t){const r=getScalarValue(e.source,t);const n=t.tagStart===_s?"":e.source.slice(t.tagStart,t.tagEnd);const s=e.schema.defaultScalarTag;if(n!==""){if(n==="!")return{value:r,tag:s};const t=tagNameFull(n,e.tagHandlers);const i=lookupTag(e.schema.exact.scalar,e.schema.prefix.scalar,t);if(i){const n=i.resolve(r,true,t);if(n===Cn)throwError$1(e,`cannot resolve a node with !<${t}> explicit tag`);return{value:n,tag:i}}const o=lookupTag(e.schema.exact.mapping,e.schema.prefix.mapping,t)??lookupTag(e.schema.exact.sequence,e.schema.prefix.sequence,t);if(o){if(r!=="")throwError$1(e,`cannot resolve a node with !<${t}> explicit tag`);const n=o.create(t);return{value:o.carrierIsResult?n:finalizeCollection(e,e.position,o,n),tag:o}}throwError$1(e,`unknown scalar tag !<${t}>`)}if(t.style===1){const t=e.schema.implicitScalarByFirstChar.get(r.charAt(0))??e.schema.implicitScalarAnyFirstChar;for(const e of t){const t=e.resolve(r,false,e.tagName);if(t!==Cn)return{value:t,tag:e}}}return{value:s.resolve(r,false,s.tagName),tag:s}}function collectionTag(e,t,r,n,s,i){const o=t.tagStart===_s?"":e.source.slice(t.tagStart,t.tagEnd);const a=o===""||o==="!"?s:tagNameFull(o,e.tagHandlers);return{tagName:a,tag:findExplicitTag(e,r,n,a,i)}}function isMappingTag(e){return e.nodeKind==="mapping"}function mergeKeys(e,t,r,n){for(const s of n.keys(r)){if(e.maxTotalMergeKeys!==-1&&++e.totalMergeKeys>e.maxTotalMergeKeys)throwError$1(e,`merge keys exceeded maxTotalMergeKeys (${e.maxTotalMergeKeys})`);if(t.tag.has(t.value,s))continue;const i=t.tag.addPair(t.value,s,n.get(r,s));if(i)throwError$1(e,i);(t.overridable??=new Set).add(s)}}function mergeSource(e,t,r,n){e.position=t.keyPosition;if(isMappingTag(n))mergeKeys(e,t,r,n);else if(n.nodeKind==="sequence"&&Array.isArray(r))for(const n of r)mergeKeys(e,t,n,t.tag);else throwError$1(e,"cannot merge mappings; the provided source object is unacceptable")}function addMappingValue(e,t,r,n,s){e.position=t.keyPosition;if(r===yn){mergeSource(e,t,n,s);return}if(!e.json&&t.tag.has(t.value,r)&&!t.overridable?.has(r))throwError$1(e,"duplicated mapping key");const i=t.tag.addPair(t.value,r,n);if(i)throwError$1(e,i);t.overridable?.delete(r)}function addValue(e,t,r){const n=e.frames[e.frames.length-1];if(n.kind==="document"){n.value=t;n.hasValue=true}else if(n.kind==="sequence"){if(n.merge){if(!isMappingTag(r))throwError$1(e,"cannot merge mappings; the provided source object is unacceptable")}const s=n.tag.addItem(n.value,t,n.index++);if(s)throwError$1(e,s)}else if(n.hasKey){const s=n.key;n.key=void 0;n.hasKey=false;addMappingValue(e,n,s,t,r)}else{n.key=t;n.keyPosition=e.position;n.hasKey=true}}function storeAnchor(e,t,r,n,s){if(t.anchorStart!==_s){const i={value:r,tag:n,isValueFinal:s};e.anchors.set(e.source.slice(t.anchorStart,t.anchorEnd),i);return i}return null}function constructFromEvents(e,t){const r={...qs,...t,events:e,documents:[],eventIndex:0,position:0,frames:[],anchors:new Map,tagHandlers:Object.create(null),totalMergeKeys:0,aliasCount:0};while(r.eventIndexr.maxAliases)throwError$1(r,`aliases exceeded maxAliases (${r.maxAliases})`);const t=r.source.slice(e.anchorStart,e.anchorEnd);const n=r.anchors.get(t);if(!n)throwError$1(r,`unidentified alias "${t}"`);if(!n.isValueFinal)throwError$1(r,`recursive alias "${t}" is not supported for tag ${n.tag.tagName} because it uses finalize()`);addValue(r,n.value,n.tag);break}case 6:{const e=r.frames.pop();if(e.kind==="document")r.documents.push(e.value);else{const t=e.tag.carrierIsResult?e.value:finalizeCollection(r,e.position,e.tag,e.value);if(e.anchor){e.anchor.value=t;e.anchor.isValueFinal=true}addValue(r,t,e.tag)}break}}}return r.documents}var Gs=-1;var zs=Object.prototype.hasOwnProperty;var Ys=1;var Vs=2;var Js=3;var Ws=4;var js=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;var Ks=/[,\[\]{}]/;var $s=/^(?:!|!!|![0-9A-Za-z-]+!)$/;var Xs=String.raw`(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\-#;/?:@&=+$,_.!~*'()\[\]])`;var Zs=String.raw`(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\-#;/?:@&=+$.~*'()_])`;var ei=new RegExp(`^(?:${Xs})*$`);var ti=new RegExp(`^(?:${Zs})+$`);var ri=new RegExp(`^(?:!(?:${Xs})*|${Zs}(?:${Xs})*)$`);var ni={filename:"",maxDepth:100};function addDocumentEvent(e,t,r){e.events.push({type:1,explicitStart:t,explicitEnd:r,directives:e.directives})}function addSequenceEvent(e,t,r,n,s,i,o){e.events.push({type:2,start:t,anchorStart:r,anchorEnd:n,tagStart:s,tagEnd:i,style:o})}function addMappingEvent(e,t,r,n,s,i,o){e.events.push({type:3,start:t,anchorStart:r,anchorEnd:n,tagStart:s,tagEnd:i,style:o})}function insertFlowPairMappingEvent(e,t){e.events.splice(t.eventsLength,0,{type:3,start:t.position,anchorStart:Gs,anchorEnd:Gs,tagStart:Gs,tagEnd:Gs,style:2})}function addScalarEvent(e,t,r,n,s,i,o,a,c=1,l=-1,A=false){e.events.push({type:4,valueStart:t,valueEnd:r,anchorStart:n,anchorEnd:s,tagStart:i,tagEnd:o,style:a,chomping:c,indent:l,fast:A})}function addAliasEvent(e,t,r){e.events.push({type:5,anchorStart:t,anchorEnd:r})}function addPopEvent(e){e.events.push({type:6})}function addEmptyScalarEvent(e){addScalarEvent(e,Gs,Gs,Gs,Gs,Gs,Gs,1)}function emptyProperties(){return{anchorStart:Gs,anchorEnd:Gs,tagStart:Gs,tagEnd:Gs}}function snapshotState(e){return{position:e.position,line:e.line,lineStart:e.lineStart,lineIndent:e.lineIndent,firstTabInLine:e.firstTabInLine,eventsLength:e.events.length}}function restoreState(e,t){e.position=t.position;e.line=t.line;e.lineStart=t.lineStart;e.lineIndent=t.lineIndent;e.firstTabInLine=t.firstTabInLine;e.events.length=t.eventsLength}function throwError(e,t){throwErrorAt(e.input.slice(0,e.length),e.position,t,e.filename)}function isEol(e){return e===10||e===13}function isWhiteSpace(e){return e===9||e===32}function isWsOrEol(e){return isWhiteSpace(e)||isEol(e)}function isWsOrEolOrEnd(e){return e===0||isWsOrEol(e)}function isFlowIndicator(e){return e===44||e===91||e===93||e===123||e===125}function fromDecimalCode(e){return e>=48&&e<=57?e-48:-1}function fromHexCode(e){if(e>=48&&e<=57)return e-48;const t=e|32;if(t>=97&&t<=102)return t-97+10;return-1}function escapedHexLen(e){if(e===120)return 2;if(e===117)return 4;if(e===85)return 8;return 0}function isSimpleEscape(e){return e===48||e===97||e===98||e===116||e===9||e===110||e===118||e===102||e===114||e===101||e===32||e===34||e===47||e===92||e===78||e===95||e===76||e===80}function consumeLineBreak(e){if(e.input.charCodeAt(e.position)===10)e.position++;else{e.position++;if(e.input.charCodeAt(e.position)===10)e.position++}e.line++;e.lineStart=e.position;e.lineIndent=0;e.firstTabInLine=-1}function skipSeparationSpace(e,t){let r=0;let n=e.input.charCodeAt(e.position);let s=e.position===e.lineStart||isWsOrEol(e.input.charCodeAt(e.position-1));while(n!==0){while(isWhiteSpace(n)){s=true;if(n===9&&e.firstTabInLine===-1)e.firstTabInLine=e.position;n=e.input.charCodeAt(++e.position)}if(t&&s&&n===35)do{n=e.input.charCodeAt(++e.position)}while(!isEol(n)&&n!==0);if(!isEol(n))break;consumeLineBreak(e);r++;s=true;n=e.input.charCodeAt(e.position);while(n===32){e.lineIndent++;n=e.input.charCodeAt(++e.position)}}return r}function testDocumentSeparator(e,t=e.position){const r=e.input.charCodeAt(t);if((r===45||r===46)&&r===e.input.charCodeAt(t+1)&&r===e.input.charCodeAt(t+2)){const r=e.input.charCodeAt(t+3);return r===0||isWsOrEol(r)}return false}function skipUntilLineEnd(e){let t=e.input.charCodeAt(e.position);while(t!==0&&!isEol(t))t=e.input.charCodeAt(++e.position)}function checkPrintable(e,t,r){if(js.test(e.input.slice(t,r)))throwError(e,"the stream contains non-printable characters")}function readTagProperty(e,t,r){if(e.input.charCodeAt(e.position)!==33)return false;if(t.tagStart!==Gs)throwError(e,"duplication of a tag property");const n=e.position;let s=false;let i=false;let o="!";let a=e.input.charCodeAt(++e.position);if(a===60){s=true;a=e.input.charCodeAt(++e.position)}else if(a===33){i=true;o="!!";a=e.input.charCodeAt(++e.position)}let c=e.position;let l;if(s){while(a!==0&&a!==62)a=e.input.charCodeAt(++e.position);if(a!==62)throwError(e,"unexpected end of the stream within a verbatim tag");l=e.input.slice(c,e.position);e.position++}else{while(a!==0&&!isWsOrEol(a)&&!(r&&isFlowIndicator(a))){if(a===33)if(!i){o=e.input.slice(c-1,e.position+1);if(!$s.test(o))throwError(e,"named tag handle cannot contain such characters");i=true;c=e.position+1}else throwError(e,"tag suffix cannot contain exclamation marks");a=e.input.charCodeAt(++e.position)}l=e.input.slice(c,e.position);if(Ks.test(l))throwError(e,"tag suffix cannot contain flow indicator characters")}if(l&&!(s?ei.test(l):ti.test(l)))throwError(e,`tag name cannot contain such characters: ${l}`);if(!s&&o!=="!"&&o!=="!!"&&!zs.call(e.tagHandlers,o))throwError(e,`undeclared tag handle "${o}"`);t.tagStart=n;t.tagEnd=e.position;return true}function readAnchorProperty(e,t){if(e.input.charCodeAt(e.position)!==38)return false;if(t.anchorStart!==Gs)throwError(e,"duplication of an anchor property");e.position++;const r=e.position;while(e.input.charCodeAt(e.position)!==0&&!isWsOrEol(e.input.charCodeAt(e.position))&&!isFlowIndicator(e.input.charCodeAt(e.position)))e.position++;if(e.position===r)throwError(e,"name of an anchor node must contain at least one character");t.anchorStart=r;t.anchorEnd=e.position;return true}function readAlias(e,t){if(e.input.charCodeAt(e.position)!==42)return false;if(t.anchorStart!==Gs||t.tagStart!==Gs)throwError(e,"alias node should not have any properties");e.position++;const r=e.position;while(e.input.charCodeAt(e.position)!==0&&!isWsOrEol(e.input.charCodeAt(e.position))&&!isFlowIndicator(e.input.charCodeAt(e.position)))e.position++;if(e.position===r)throwError(e,"name of an alias node must contain at least one character");addAliasEvent(e,r,e.position);return true}function readFlowScalarBreak(e,t){skipSeparationSpace(e,false);if(e.lineIndent0){e.position++;if(fromHexCode(e.input.charCodeAt(e.position))<0)throwError(e,"expected hexadecimal character")}e.position++}}else if(isEol(i)){s=false;readFlowScalarBreak(e,t)}else if(e.position===e.lineStart&&testDocumentSeparator(e))throwError(e,"unexpected end of the document within a double quoted scalar");else if(i!==9&&i<32)throwError(e,"expected valid JSON character");else e.position++}throwError(e,"unexpected end of the stream within a double quoted scalar")}function readBlockScalar(e,t,r){const n=e.input.charCodeAt(e.position);let s=1;let i=-1;let o=false;if(n!==124&&n!==62)return false;const a=n===124?4:5;e.position++;while(e.input.charCodeAt(e.position)!==0){const r=e.input.charCodeAt(e.position);const n=fromDecimalCode(r);if(r===43||r===45){if(s!==1)throwError(e,"repeat of a chomping mode identifier");s=r===43?3:2;e.position++}else if(n>=0){if(n===0)throwError(e,"bad explicit indentation width of a block scalar; it cannot be less than one");if(o)throwError(e,"repeat of an indentation width identifier");i=t+n-1;o=true;e.position++}else break}let c=false;while(isWhiteSpace(e.input.charCodeAt(e.position))){c=true;e.position++}if(c&&e.input.charCodeAt(e.position)===35)skipUntilLineEnd(e);if(isEol(e.input.charCodeAt(e.position)))consumeLineBreak(e);else if(e.input.charCodeAt(e.position)!==0)throwError(e,"a line break is expected");let l=o?i:-1;let A=0;const u=e.position;let d=e.position;while(e.input.charCodeAt(e.position)!==0){const r=e.position;let n=0;while(e.input.charCodeAt(r+n)===32)n++;const s=e.input.charCodeAt(r+n);if(s===0){if(l>=0){if(n>l)d=r+n}else if(n>0)d=r+n;break}if(r===e.lineStart&&testDocumentSeparator(e,r))break;if(!o&&l===-1&&isEol(s))A=Math.max(A,n);if(!o&&l===-1&&!isEol(s)){if(s===9&&n=t){c=true;o=e.input.charCodeAt(e.position);continue}e.position=r;e.line=n;e.lineStart=s;e.lineIndent=i;break}if(!isWhiteSpace(o))i=e.position+1;o=e.input.charCodeAt(++e.position)}if(i===s)return false;checkPrintable(e,s,i);addScalarEvent(e,s,i,n.anchorStart,n.anchorEnd,n.tagStart,n.tagEnd,1,1,-1,!c);return true}function skipFlowSeparationSpace(e,t){const r=e.line;skipSeparationSpace(e,true);if(e.line>r&&e.lineIndent0;if(e.firstTabInLine!==-1&&e.input.charCodeAt(e.position)===45&&isWsOrEolOrEnd(e.input.charCodeAt(e.position+1)))throwError(e,"bad indentation of a sequence entry");if(n&&e.lineIndent<=t)addEmptyScalarEvent(e);else parseNode(e,t,Js,false,true);skipSeparationSpace(e,true);if(e.lineIndent=e.length)break;if(e.lineIndent>t)throwError(e,"bad indentation of a sequence entry");if(e.line===r&&e.input.charCodeAt(e.position)===45&&isWsOrEolOrEnd(e.input.charCodeAt(e.position+1)))throwError(e,"bad indentation of a sequence entry")}addPopEvent(e);return true}function readBlockMapping(e,t,r,n){let s=false;let i=false;let o=false;let a=false;if(e.firstTabInLine!==-1)return false;let c=e.input.charCodeAt(e.position);while(c!==0){if(!s&&e.firstTabInLine!==-1){e.position=e.firstTabInLine;throwError(e,"tab characters must not be used in indentation")}const l=e.input.charCodeAt(e.position+1);const A=e.line;if((c===63||c===58)&&isWsOrEolOrEnd(l)){if(!o){addMappingEvent(e,e.position,n.anchorStart,n.anchorEnd,n.tagStart,n.tagEnd,1);o=true}if(c===63){if(s)addEmptyScalarEvent(e);i=true;s=true}else if(s)s=false;else{addEmptyScalarEvent(e);i=true;s=false}e.position+=1;a=true}else{if(s){addEmptyScalarEvent(e);s=false}const t=snapshotState(e);if(!parseNode(e,r,Vs,false,true))break;if(e.line===A){c=e.input.charCodeAt(e.position);while(isWhiteSpace(c))c=e.input.charCodeAt(++e.position);if(c===58){c=e.input.charCodeAt(++e.position);if(!isWsOrEolOrEnd(c))throwError(e,"a whitespace character is expected after the key-value separator within a block mapping");if(!o){restoreState(e,t);addMappingEvent(e,t.position,n.anchorStart,n.anchorEnd,n.tagStart,n.tagEnd,1);o=true;parseNode(e,r,Vs,false,true);c=e.input.charCodeAt(e.position);while(isWhiteSpace(c))c=e.input.charCodeAt(++e.position);e.position++}i=true;s=false;a=false}else if(i)throwError(e,"expected ':' after a mapping key");else{if(n.anchorStart!==Gs||n.tagStart!==Gs){restoreState(e,t);return false}return true}}else if(i)throwError(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else{if(n.anchorStart!==Gs||n.tagStart!==Gs){restoreState(e,t);return false}return true}}if(parseNode(e,t,Ws,true,a))a=false;if(!s){if(a){addEmptyScalarEvent(e);a=false}}skipSeparationSpace(e,true);c=e.input.charCodeAt(e.position);if((e.line===A||e.lineIndent>t)&&c!==0)throwError(e,"bad indentation of a mapping entry");else if(e.lineIndent=e.maxDepth)throwError(e,`nesting exceeded maxDepth (${e.maxDepth})`);e.depth++;let o=1;let a=false;let c=false;let l=null;const A=emptyProperties();let u=r===Ws||r===Js;let d=u;const g=u;if(n&&skipSeparationSpace(e,true)){a=true;if(e.lineIndent>t)o=1;else if(e.lineIndent===t)o=0;else o=-1}if(e.position===e.lineStart&&testDocumentSeparator(e)){e.depth--;return false}if(o===1)while(true){const n=e.input.charCodeAt(e.position);const s=snapshotState(e);if(a&&o!==1&&(n===33||n===38))break;if(a&&g&&(A.tagStart!==Gs||A.anchorStart!==Gs)&&(n===33||n===38)){const r=snapshotState(e);const n=t+1;if(readBlockMapping(e,e.position-e.lineStart,n,A)&&e.events[r.eventsLength]?.type===3){e.depth--;return true}restoreState(e,r)}if(a&&(n===33&&A.tagStart!==Gs||n===38&&A.anchorStart!==Gs))break;if(!readTagProperty(e,A,r===Ys)&&!readAnchorProperty(e,A))break;if(l===null)l=s;if(skipSeparationSpace(e,true)){a=true;d=g;if(e.lineIndent>t)o=1;else if(e.lineIndent===t)o=0;else o=-1}else d=false}if(d)d=a||s;if(o===1||r===Ws){const n=r===Ys||r===Vs?t:t+1;const s=e.position-e.lineStart;if(o===1)if(d&&(readBlockSequence(e,s,A)||readBlockMapping(e,s,n,A))||readFlowCollection(e,n,A))c=true;else{const t=e.input.charCodeAt(e.position);if(l!==null&&i&&g&&!d&&t!==124&&t!==62){const t=snapshotState(e);const r=l.position-l.lineStart;restoreState(e,l);if(readBlockMapping(e,r,n,emptyProperties())&&e.events[t.eventsLength]?.type===3)c=true;else restoreState(e,t)}if(!c&&(u&&readBlockScalar(e,n,A)||readSingleQuotedScalar(e,n,A)||readDoubleQuotedScalar(e,n,A)||readAlias(e,A)||readPlainScalar(e,n,r,A)))c=true}else if(o===0)c=d&&readBlockSequence(e,s,A)}u=u&&!c;if(!c&&(A.anchorStart!==Gs||A.tagStart!==Gs||u)){addScalarEvent(e,Gs,Gs,A.anchorStart,A.anchorEnd,A.tagStart,A.tagEnd,1);c=true}e.depth--;return c||A.anchorStart!==Gs||A.tagStart!==Gs}function readDirective(e){if(e.lineIndent>0||e.input.charCodeAt(e.position)!==37)return false;e.position++;const t=e.position;while(e.input.charCodeAt(e.position)!==0&&!isWsOrEol(e.input.charCodeAt(e.position)))e.position++;const r=e.input.slice(t,e.position);const n=[];if(r.length===0)throwError(e,"directive name must not be less than one character in length");while(e.input.charCodeAt(e.position)!==0&&!isEol(e.input.charCodeAt(e.position))){while(isWhiteSpace(e.input.charCodeAt(e.position)))e.position++;if(e.input.charCodeAt(e.position)===35||isEol(e.input.charCodeAt(e.position))||e.input.charCodeAt(e.position)===0)break;const t=e.position;while(e.input.charCodeAt(e.position)!==0&&!isWsOrEol(e.input.charCodeAt(e.position)))e.position++;n.push(e.input.slice(t,e.position))}if(isEol(e.input.charCodeAt(e.position)))consumeLineBreak(e);if(r==="YAML"){if(e.directives.some((e=>e.kind==="yaml")))throwError(e,"duplication of %YAML directive");if(n.length!==1)throwError(e,"YAML directive accepts exactly one argument");const t=/^([0-9]+)\.([0-9]+)$/.exec(n[0]);if(t===null)throwError(e,"ill-formed argument of the YAML directive");if(parseInt(t[1],10)!==1)throwError(e,"unacceptable YAML version of the document");e.directives.push({kind:"yaml",version:n[0]})}else if(r==="TAG"){if(n.length!==2)throwError(e,"TAG directive accepts exactly two arguments");const[t,r]=n;if(!$s.test(t))throwError(e,"ill-formed tag handle (first argument) of the TAG directive");if(zs.call(e.tagHandlers,t))throwError(e,`there is a previously declared suffix for "${t}" tag handle`);if(!ri.test(r))throwError(e,"ill-formed tag prefix (second argument) of the TAG directive");e.tagHandlers[t]=r;e.directives.push({kind:"tag",handle:t,prefix:r})}return true}function readDocument(e){e.directives=[];e.tagHandlers=Object.create(null);let t=false;skipSeparationSpace(e,true);while(readDirective(e)){t=true;skipSeparationSpace(e,true)}let r=false;let n=false;let s=true;if(e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45&&isWsOrEolOrEnd(e.input.charCodeAt(e.position+3))){r=true;const t=e.line;e.position+=3;skipSeparationSpace(e,true);s=e.line>t}else if(t)throwError(e,"directives end mark is expected");const i=e.events.length;if(!r&&e.position===e.lineStart&&e.input.charCodeAt(e.position)===46&&testDocumentSeparator(e)){e.position+=3;skipSeparationSpace(e,true);return}addDocumentEvent(e,r,false);if(!parseNode(e,e.lineIndent-1,Ws,false,s,s))addEmptyScalarEvent(e);skipSeparationSpace(e,true);if(e.position===e.lineStart&&testDocumentSeparator(e)){n=e.input.charCodeAt(e.position)===46;if(n){const t=e.line;e.position+=3;skipSeparationSpace(e,true);if(e.line===t&&e.position=n.length)break;const e=n.position;readDocument(n);if(n.position===e)throwError(n,"can not read a document")}return n.events}var si={...ni,...qs};function loadDocuments(e,t={}){const r={...si,...t};const n=String(e);const s=Object.keys(ni);const i=Object.keys(qs);return constructFromEvents(parseEvents(n,pick(r,s)),{...pick(r,i),source:n})}function loadAll(e,t,r){let n=null;if(typeof t==="function")n=t;else if(t!==null&&typeof t==="object")r=t;const s=loadDocuments(e,r);if(n===null)return s;for(const e of s)n(e)}function load(e,t){const r=loadDocuments(e,t);if(r.length===0)throw new Es("expected a document, but the input is empty");if(r.length===1)return r[0];throw new Es("expected a single document in the stream, but found more")}var ii=class{tagged=false;flow=false;singleQuoted=false;doubleQuoted=false;literal=false;folded=false};var oi=Symbol("INVALID");function buildRepresentTypes(e){const t=new Set([e.defaultScalarTag,e.defaultSequenceTag,e.defaultMappingTag].filter((e=>e!==void 0)));const r=e.implicitScalarTags;const n=e.tags.filter((e=>!(e.nodeKind==="scalar"&&e.implicit)&&!t.has(e)));const s=e.tags.filter((e=>t.has(e)));return[...r.map((e=>({tag:e,implicitTag:true}))),...n.map((e=>({tag:e,implicitTag:false}))),...s.map((e=>({tag:e,implicitTag:true})))]}function matchTag(e,t){for(let r=0,n=e.representTypes.length;r=32&&e<=126||e>=161&&e<=55295&&e!==8232&&e!==8233||e>=57344&&e<=65533&&e!==li||e>=65536&&e<=1114111}function isNsCharOrWhitespace(e){return isPrintable(e)&&e!==li&&e!==gi&&e!==di}function isPlainSafe(e,t,r){const n=isNsCharOrWhitespace(e);const s=n&&!isWhitespace(e);return(r?n:n&&e!==Bi&&e!==xi&&e!==Ri&&e!==ki&&e!==Ti)&&e!==fi&&!(t===bi&&!s)||isNsCharOrWhitespace(t)&&!isWhitespace(t)&&e===fi||t===bi&&s&&(r||e!==Bi&&e!==xi&&e!==Ri&&e!==ki&&e!==Ti)}function isPlainSafeFirst(e){return isPrintable(e)&&e!==li&&!isWhitespace(e)&&e!==Qi&&e!==Di&&e!==bi&&e!==Bi&&e!==xi&&e!==Ri&&e!==ki&&e!==Ti&&e!==fi&&e!==yi&&e!==Ii&&e!==hi&&e!==Fi&&e!==Si&&e!==wi&&e!==Ei&&e!==mi&&e!==Ci&&e!==Ni&&e!==vi}function isPlainSafeAtStart(e,t){const r=codePointAt(e,0);if(isPlainSafeFirst(r))return true;if(e.length>1&&(r===Qi||r===Di||r===bi)){const n=codePointAt(e,1);return!isWhitespace(n)&&isPlainSafe(n,r,t)}return false}function isPlainSafeLast(e){return!isWhitespace(e)&&e!==bi}function codePointAt(e,t){const r=e.charCodeAt(t);let n;if(r>=55296&&r<=56319&&t+1=56320&&n<=57343)return(r-55296)*1024+n-56320+65536}return r}function needIndentIndicator(e){return/^\n* /.test(e)}var Li=1;var Ui=2;var Oi=3;var Hi=4;var _i=5;function chooseScalarStyle(e,t,r,n,s,i){const{blockIndent:o,lineWidth:a}=r;let c;let l=0;let A=-1;let u=false;let d=false;const g=a!==-1;let p=-1;let h=!startsWithDocumentSeparator(t)&&isPlainSafeAtStart(t,i)&&isPlainSafeLast(codePointAt(t,t.length-1));if(n||s)for(c=0;c=65536?c+=2:c++){l=codePointAt(t,c);if(!isPrintable(l))return _i;h=h&&isPlainSafe(l,A,i);A=l}else{for(c=0;c=65536?c+=2:c++){l=codePointAt(t,c);if(l===di){u=true;if(g){d=d||c-p-1>a&&t[p+1]!==" ";p=c}}else if(!isPrintable(l))return _i;h=h&&isPlainSafe(l,A,i);A=l}d=d||g&&c-p-1>a&&t[p+1]!==" "}if(!u&&!d){if(h&&!s)return Li;return e.quoteStyle==="double"?_i:Ui}if(o>9&&needIndentIndicator(t))return _i;return d?Hi:Oi}function renderScalarStyle(e,t,r){const{indent:n,blockIndent:s,lineWidth:i}=r;switch(t){case Li:return encodeFlowBreaks(e,n);case Ui:return`'${encodeFlowBreaks(e,n).replace(/'/g,"''")}'`;case Oi:return"|"+blockHeader(e,s)+dropEndingNewline(indentString(e,n));case Hi:return">"+blockHeader(e,s)+dropEndingNewline(indentString(foldBlockScalar(e,i),n));case _i:return`"${escapeString(e)}"`}}function resolveScalarStyle(e,t,r,n,s){const i=n||!s;if(t.style.singleQuoted)return Ui;if(t.style.doubleQuoted)return _i;if(!i){if(t.style.literal)return Oi;if(t.style.folded)return Hi}const o=t.value;if(o.length===0){if(t.style.tagged||resolveImplicitTag(e,o)===t.tag)return Li;return e.quoteStyle==="double"?_i:Ui}const a=chooseScalarStyle(e,o,r,i,e.forceQuotes&&!n,s);if(a===Li&&!t.style.tagged&&resolveImplicitTag(e,o)!==t.tag)return e.quoteStyle==="double"?_i:Ui;return a}function blockHeader(e,t){const r=needIndentIndicator(e)?String(t):"";const n=e[e.length-1]==="\n";return`${r}${n&&(e[e.length-2]==="\n"||e==="\n")?"+":n?"":"-"}\n`}function encodeFlowBreaks(e,t){let r=e.indexOf("\n");if(r===-1)return e;const n=" ".repeat(t);let s=e.slice(0,r);const i=/(\n+)([^\n]*)/g;i.lastIndex=r;let o;while(o=i.exec(e)){const e=o[1].length;const t=o[2];s+="\n".repeat(e+1)+n+t}return s}function dropEndingNewline(e){return e[e.length-1]==="\n"?e.slice(0,-1):e}function foldBlockScalar(e,t){const r=/(\n+)([^\n]*)/g;let n=e.indexOf("\n");if(n===-1)n=e.length;r.lastIndex=n;let s=foldLine(e.slice(0,n),t);let i=e[0]==="\n"||e[0]===" ";let o;let a;while(a=r.exec(e)){const e=a[1];const r=a[2];o=r[0]===" ";s+=e+(!i&&!o&&r!==""?"\n":"")+foldLine(r,t);i=o}return s}function foldLine(e,t){if(e===""||e[0]===" ")return e;const r=/ [^ ]/g;let n;let s=0;let i;let o=0;let a=0;let c="";while(n=r.exec(e)){a=n.index;if(a-s>t){i=o>s?o:a;c+=`\n${e.slice(s,i)}`;s=i+1}o=a}c+="\n";if(e.length-s>t&&o>s)c+=`${e.slice(s,o)}\n${e.slice(o+1)}`;else c+=e.slice(s);return c.slice(1)}function escapeString(e){let t="";let r=0;for(let n=0;n=65536?n+=2:n++){r=codePointAt(e,n);const s=Mi[r];if(s){t+=s;continue}if(isPrintable(r)){t+=e[n];if(r>=65536)t+=e[n+1];continue}t+=encodeNonPrintable(r)}return t}function writeFlowSequence(e,t,r){let n="";for(let s=0,i=r.items.length;s1024;if(a)s+="? ";else if(e.quoteFlowKeys)s+='"';const c=writeNode(e,t,i,{});const l=e.flowSkipColonSpace||c===""?"":" ";s+=`${o}${e.quoteFlowKeys&&!a?'"':""}:${l}${c}`;n+=s}const i=e.flowBracketPadding&&n!==""?" ":"";return`{${i}${n}${i}}`}function sortKeyValue(e){return e.kind==="scalar"?e.value:e}function sortMappingItems(e,t){if(!e.sortKeys)return t;const r=t.slice();if(e.sortKeys===true)r.sort(((e,t)=>{const r=sortKeyValue(e.key);const n=sortKeyValue(t.key);if(rn)return 1;return 0}));else{const t=e.sortKeys;r.sort(((e,r)=>t(sortKeyValue(e.key),sortKeyValue(r.key))))}return r}function writeBlockMapping(e,t,r,n){let s="";const i=sortMappingItems(e,r.items);for(let r=0,o=i.length;r1024;if(d)if(A&&di===A.charCodeAt(0))o+="?";else o+="? ";o+=A;if(d)o+=generateNextLine(e,t);const g=writeNode(e,t+1,c,{block:true,compact:d,isblockseq:d&&!cannotBeCompact(e,c,t+1)});const p=a.kind==="scalar"&&a.value===""&&A!==""&&A.charCodeAt(A.length-1)!==Ei&&A.charCodeAt(A.length-1)!==mi;const h=!d&&(a.kind==="alias"||p)?" ":"";if(g===""||di===g.charCodeAt(0))o+=`${h}:`;else o+=`${h}: `;o+=g;s+=o}return s}function cannotBeCompact(e,t,r){return t.style.tagged||t.anchor!==void 0||e.indent<2&&r>0}function writeNode(e,t,r,n){if(r.kind==="alias")return`*${r.anchor}`;const{block:s=false,iskey:i=false,isblockseq:o=false}=n;let a=n.compact??false;const c=r.anchor!==void 0;if(cannotBeCompact(e,r,t))a=false;let l;let A=r.style.tagged;const u=s&&(r.kind==="mapping"||r.kind==="sequence")&&!r.style.flow&&r.items.length!==0;if(r.kind==="mapping")if(u)l=writeBlockMapping(e,t,r,a);else l=writeFlowMapping(e,t,r);else if(r.kind==="sequence")if(u)if(e.seqNoIndent&&!o&&t>0)l=writeBlockSequence(e,t-1,r,a);else l=writeBlockSequence(e,t,r,a);else l=writeFlowSequence(e,t,r);else{const n=scalarLayout(e,t);const o=resolveScalarStyle(e,r,n,i,s);l=renderScalarStyle(r.value,o,n);A=r.style.tagged||o!==Li&&r.tag!==e.defaultScalarTagName}if(u&&a&&t>0&&e.indent>2)l=`${" ".repeat(e.indent-2)}${l}`;if(A||c){const t=[];const n=A?nodeTagShort(r):null;const s=c?`&${r.anchor}`:null;if(e.tagBeforeAnchor){if(n!==null)t.push(n);if(s!==null)t.push(s)}else{if(s!==null)t.push(s);if(n!==null)t.push(n)}const i=l===""||l.charCodeAt(0)===di?"":" ";l=`${t.join(" ")}${i}${l}`}return l}function rootStartsOwnLine(e){return(e.kind==="sequence"||e.kind==="mapping")&&!e.style.flow&&e.items.length!==0&&!e.style.tagged&&e.anchor===void 0}function isOpenEnded(e){let t=e;while((t.kind==="sequence"||t.kind==="mapping")&&!t.style.flow&&t.items.length!==0)t=t.kind==="sequence"?t.items[t.items.length-1]:t.items[t.items.length-1].value;if(t.kind!=="scalar"||!(t.style.literal||t.style.folded))return false;const{value:r}=t;return r.endsWith("\n\n")||r==="\n"}function writeDocumentDirectives(e){let t="";for(const r of e.directives){if(r.kind==="yaml"){t+=`%YAML ${r.version}\n`;continue}const{handle:e,prefix:n}=r;t+=`%TAG ${e} ${n}\n`}return t}function present(e,t){const r=createPresenterState(t);let n="";let s=false;for(let t=0;t0&&!s;n+=o;if(i.contents===null){if(c)n+="---\n"}else if(c){const e=writeNode(r,0,i.contents,{block:true,compact:true});const t=e===""?"":a||rootStartsOwnLine(i.contents)?"\n":" ";n+=`---${t}${e}\n`}else n+=writeNode(r,0,i.contents,{block:true,compact:true})+"\n";s=i.explicitEnd||i.contents!==null&&isOpenEnded(i.contents);if(s)n+="...\n"}return n}var qi=hs.withTags({...qn,resolve:(e,t,r)=>{const n=qn.resolve(e,t,r);return n===Cn?Ln.resolve(e,t,r):n}},{...$n,resolve:(e,t,r)=>{const n=$n.resolve(e,t,r);return n===Cn?Yn.resolve(e,t,r):n}});var Gi={...Pi,schema:qi,skipInvalid:false,noRefs:false,flowLevel:-1,transform:()=>{}};function dump(e,t={}){const r={...Gi,...t};const n=jsToAst(e,r.schema,{noRefs:r.noRefs,skipInvalid:r.skipInvalid});if(r.flowLevel>=0)visit(n,((e,t)=>{if(t.depth{let t;for(let r=0;r<=Vi;r++){try{return await e()}catch(e){t=e;if(r===Vi){break}core_debug(`Attempt ${r+1} failed, retrying in ${Ji}: ${t.message}`);await new Promise((e=>setTimeout(e,Ji)))}}throw t};const Wi=/^v\d+\.\d+\.\d+-[0-9a-f]+-nightly$/i;const isNightlyTag=e=>Wi.test(e);const latestNightlyRelease=e=>e.filter((e=>Wi.test(e.tag_name))).sort(((e,t)=>(t.published_at||"").localeCompare(e.published_at||""))).shift();const getRelease=async(e,t)=>{if(t==="latest"){warning("You are using 'latest' as default version. Will lock to '~> v2'.");return getReleaseTag(e,"~> v2")}return getReleaseTag(e,t)};const getReleaseTag=async(e,t)=>{if(t==="nightly"){return resolveNightly(e)}const r=cleanTag(t);if(Yi.valid(r)){let n=t.startsWith("v")?t:`v${t}`;if(isPro(e)&&Yi.lt(r,"2.7.0")&&!n.endsWith("-pro")){n=n+distribSuffix(e)}return{tag_name:n}}const n=await resolveVersion(e,t)||t;const s=distribSuffix(e);const i=`https://goreleaser.com/releases${s}.json`;const o=await withRetry((async()=>{const e=new lib_HttpClient("goreleaser-action");const r=await e.get(i);const n=await r.readBody();const s=r.message.statusCode||500;if(s>=400){throw new Error(`Failed to get GoReleaser release ${t} from ${i} with status code ${s}: ${n}`)}return JSON.parse(n)}));const a=o.filter((e=>e.tag_name===n)).shift();if(a){return a}throw new Error(`Cannot find GoReleaser release ${t} in ${i}`)};const resolveNightly=async e=>{const t=`https://api.github.com/repos/goreleaser/${e}/releases?per_page=100`;core_debug(`Resolving latest nightly release from ${t}`);const r=await withRetry((async()=>{const e=new lib_HttpClient("goreleaser-action");const r={Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28"};const n=process.env.GITHUB_TOKEN;if(n){r["Authorization"]=`Bearer ${n}`}const s=await e.get(t,r);const i=await s.readBody();const o=s.message.statusCode||500;if(o>=400){throw new Error(`Failed to list releases from ${t} with status code ${o}: ${i}`)}return JSON.parse(i)}));const n=latestNightlyRelease(r);if(!n){throw new Error(`No '--nightly' release found in ${t}`)}info(`Resolved nightly to ${n.tag_name}`);return n};const resolveVersion=async(e,t)=>{const r=await getAllTags(e);if(!r){throw new Error(`Cannot download ${e} tags`)}core_debug(`Found ${r.length} tags in total`);const n=r.map((e=>cleanTag(e)));const s=cleanTag(t);if(!Yi.valid(s)&&!Yi.validRange(s)){return t}const i=Yi.maxSatisfying(n,s);if(Yi.lt(i,"2.7.0")){return i+distribSuffix(e)}return i};const getAllTags=async e=>{const t=distribSuffix(e);const r=`https://goreleaser.com/releases${t}.json`;core_debug(`Downloading ${r}`);return withRetry((async()=>{const e=new lib_HttpClient("goreleaser-action");const t=await e.getJson(r);if(t.result==null){return[]}return t.result.map((e=>e.tag_name))}))};const cleanTag=e=>e.replace(/-pro$/,"");function getOptions(e){const t={followSymbolicLinks:true,implicitDescendants:true,matchDirectories:true,omitBrokenSymbolicLinks:true,excludeHiddenFiles:false};if(e){if(typeof e.followSymbolicLinks==="boolean"){t.followSymbolicLinks=e.followSymbolicLinks;core_debug(`followSymbolicLinks '${t.followSymbolicLinks}'`)}if(typeof e.implicitDescendants==="boolean"){t.implicitDescendants=e.implicitDescendants;core_debug(`implicitDescendants '${t.implicitDescendants}'`)}if(typeof e.matchDirectories==="boolean"){t.matchDirectories=e.matchDirectories;core_debug(`matchDirectories '${t.matchDirectories}'`)}if(typeof e.omitBrokenSymbolicLinks==="boolean"){t.omitBrokenSymbolicLinks=e.omitBrokenSymbolicLinks;core_debug(`omitBrokenSymbolicLinks '${t.omitBrokenSymbolicLinks}'`)}if(typeof e.excludeHiddenFiles==="boolean"){t.excludeHiddenFiles=e.excludeHiddenFiles;core_debug(`excludeHiddenFiles '${t.excludeHiddenFiles}'`)}}return t}const ji=process.platform==="win32";function dirname(e){e=safeTrimTrailingSeparator(e);if(ji&&/^\\\\[^\\]+(\\[^\\]+)?$/.test(e)){return e}let t=o.dirname(e);if(ji&&/^\\\\[^\\]+\\[^\\]+\\$/.test(t)){t=safeTrimTrailingSeparator(t)}return t}function ensureAbsoluteRoot(e,t){a(e,`ensureAbsoluteRoot parameter 'root' must not be empty`);a(t,`ensureAbsoluteRoot parameter 'itemPath' must not be empty`);if(hasAbsoluteRoot(t)){return t}if(ji){if(t.match(/^[A-Z]:[^\\/]|^[A-Z]:$/i)){let e=process.cwd();a(e.match(/^[A-Z]:\\/i),`Expected current directory to start with an absolute drive root. Actual '${e}'`);if(t[0].toUpperCase()===e[0].toUpperCase()){if(t.length===2){return`${t[0]}:\\${e.substr(3)}`}else{if(!e.endsWith("\\")){e+="\\"}return`${t[0]}:\\${e.substr(3)}${t.substr(2)}`}}else{return`${t[0]}:\\${t.substr(2)}`}}else if(internal_path_helper_normalizeSeparators(t).match(/^\\$|^\\[^\\]/)){const e=process.cwd();a(e.match(/^[A-Z]:\\/i),`Expected current directory to start with an absolute drive root. Actual '${e}'`);return`${e[0]}:\\${t.substr(1)}`}}a(hasAbsoluteRoot(e),`ensureAbsoluteRoot parameter 'root' must have an absolute root`);if(e.endsWith("/")||ji&&e.endsWith("\\")){}else{e+=o.sep}return e+t}function hasAbsoluteRoot(e){a(e,`hasAbsoluteRoot parameter 'itemPath' must not be empty`);e=internal_path_helper_normalizeSeparators(e);if(ji){return e.startsWith("\\\\")||/^[A-Z]:\\/i.test(e)}return e.startsWith("/")}function hasRoot(e){a(e,`isRooted parameter 'itemPath' must not be empty`);e=internal_path_helper_normalizeSeparators(e);if(ji){return e.startsWith("\\")||/^[A-Z]:/i.test(e)}return e.startsWith("/")}function internal_path_helper_normalizeSeparators(e){e=e||"";if(ji){e=e.replace(/\//g,"\\");const t=/^\\\\+[^\\]/.test(e);return(t?"\\":"")+e.replace(/\\\\+/g,"\\")}return e.replace(/\/\/+/g,"/")}function safeTrimTrailingSeparator(e){if(!e){return""}e=internal_path_helper_normalizeSeparators(e);if(!e.endsWith(o.sep)){return e}if(e===o.sep){return e}if(ji&&/^[A-Z]:\\$/i.test(e)){return e}return e.substr(0,e.length-1)}var Ki;(function(e){e[e["None"]=0]="None";e[e["Directory"]=1]="Directory";e[e["File"]=2]="File";e[e["All"]=3]="All"})(Ki||(Ki={}));const $i=process.platform==="win32";function getSearchPaths(e){e=e.filter((e=>!e.negate));const t={};for(const r of e){const e=$i?r.searchPath.toUpperCase():r.searchPath;t[e]="candidate"}const r=[];for(const n of e){const e=$i?n.searchPath.toUpperCase():n.searchPath;if(t[e]==="included"){continue}let s=false;let i=e;let o=dirname(i);while(o!==i){if(t[o]){s=true;break}i=o;o=dirname(i)}if(!s){r.push(n.searchPath);t[e]="included"}}return r}function internal_pattern_helper_match(e,t){let r=Ki.None;for(const n of e){if(n.negate){r&=~n.match(t)}else{r|=n.match(t)}}return r}function internal_pattern_helper_partialMatch(e,t){return e.some((e=>!e.negate&&e.partialMatch(t)))}var Xi=__nccwpck_require__(9526);const Zi=process.platform==="win32";class Path{constructor(e){this.segments=[];if(typeof e==="string"){a(e,`Parameter 'itemPath' must not be empty`);e=safeTrimTrailingSeparator(e);if(!hasRoot(e)){this.segments=e.split(o.sep)}else{let t=e;let r=dirname(t);while(r!==t){const e=o.basename(t);this.segments.unshift(e);t=r;r=dirname(t)}this.segments.unshift(t)}}else{a(e.length>0,`Parameter 'itemPath' must not be an empty array`);for(let t=0;tPattern.getLiteral(e))).filter((e=>!i&&!(i=e==="")));this.searchPath=new Path(c).toString();this.rootRegExp=new RegExp(Pattern.regExpEscape(c[0]),to?"i":"");this.isImplicitPattern=t;const l={dot:true,nobrace:true,nocase:to,nocomment:true,noext:true,nonegate:true};s=to?s.replace(/\\/g,"/"):s;this.minimatch=new eo(s,l)}match(e){if(this.segments[this.segments.length-1]==="**"){e=internal_path_helper_normalizeSeparators(e);if(!e.endsWith(o.sep)&&this.isImplicitPattern===false){e=`${e}${o.sep}`}}else{e=safeTrimTrailingSeparator(e)}if(this.minimatch.match(e)){return this.trailingSeparator?Ki.Directory:Ki.All}return Ki.None}partialMatch(e){e=safeTrimTrailingSeparator(e);if(dirname(e)===e){return this.rootRegExp.test(e)}return this.minimatch.matchOne(e.split(to?/\\+/:/\/+/),this.minimatch.set[0],true)}static globEscape(e){return(to?e:e.replace(/\\/g,"\\\\")).replace(/(\[)(?=[^/]+\])/g,"[[]").replace(/\?/g,"[?]").replace(/\*/g,"[*]")}static fixupPattern(e,t){a(e,"pattern cannot be empty");const r=new Path(e).segments.map((e=>Pattern.getLiteral(e)));a(r.every(((e,t)=>(e!=="."||t===0)&&e!=="..")),`Invalid pattern '${e}'. Relative pathing '.' and '..' is not allowed.`);a(!hasRoot(e)||r[0],`Invalid pattern '${e}'. Root segment must not contain globs.`);e=internal_path_helper_normalizeSeparators(e);if(e==="."||e.startsWith(`.${o.sep}`)){e=Pattern.globEscape(process.cwd())+e.substr(1)}else if(e==="~"||e.startsWith(`~${o.sep}`)){t=t||cr.homedir();a(t,"Unable to determine HOME directory");a(hasAbsoluteRoot(t),`Expected HOME directory to be a rooted path. Actual '${t}'`);e=Pattern.globEscape(t)+e.substr(1)}else if(to&&(e.match(/^[A-Z]:$/i)||e.match(/^[A-Z]:[^\\]/i))){let t=ensureAbsoluteRoot("C:\\dummy-root",e.substr(0,2));if(e.length>2&&!t.endsWith("\\")){t+="\\"}e=Pattern.globEscape(t)+e.substr(2)}else if(to&&(e==="\\"||e.match(/^\\[^\\]/))){let t=ensureAbsoluteRoot("C:\\dummy-root","\\");if(!t.endsWith("\\")){t+="\\"}e=Pattern.globEscape(t)+e.substr(1)}else{e=ensureAbsoluteRoot(Pattern.globEscape(process.cwd()),e)}return internal_path_helper_normalizeSeparators(e)}static getLiteral(e){let t="";for(let r=0;r=0){if(n.length>1){return""}if(n){t+=n;r=s;continue}}}t+=n}return t}static regExpEscape(e){return e.replace(/[[\\^$.|?*+()]/g,"\\$&")}}class SearchState{constructor(e,t){this.path=e;this.level=t}}var ro=undefined&&undefined.__awaiter||function(e,t,r,n){function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,s){function fulfilled(e){try{step(n.next(e))}catch(e){s(e)}}function rejected(e){try{step(n["throw"](e))}catch(e){s(e)}}function step(e){e.done?r(e.value):adopt(e.value).then(fulfilled,rejected)}step((n=n.apply(e,t||[])).next())}))};var no=undefined&&undefined.__asyncValues||function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof __values==="function"?__values(e):e[Symbol.iterator](),r={},verb("next"),verb("throw"),verb("return"),r[Symbol.asyncIterator]=function(){return this},r);function verb(t){r[t]=e[t]&&function(r){return new Promise((function(n,s){r=e[t](r),settle(n,s,r.done,r.value)}))}}function settle(e,t,r,n){Promise.resolve(n).then((function(t){e({value:t,done:r})}),t)}};var so=undefined&&undefined.__await||function(e){return this instanceof so?(this.v=e,this):new so(e)};var oo=undefined&&undefined.__asyncGenerator||function(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),s,i=[];return s=Object.create((typeof AsyncIterator==="function"?AsyncIterator:Object).prototype),verb("next"),verb("throw"),verb("return",awaitReturn),s[Symbol.asyncIterator]=function(){return this},s;function awaitReturn(e){return function(t){return Promise.resolve(t).then(e,reject)}}function verb(e,t){if(n[e]){s[e]=function(t){return new Promise((function(r,n){i.push([e,t,r,n])>1||resume(e,t)}))};if(t)s[e]=t(s[e])}}function resume(e,t){try{step(n[e](t))}catch(e){settle(i[0][3],e)}}function step(e){e.value instanceof so?Promise.resolve(e.value.v).then(fulfill,reject):settle(i[0][2],e)}function fulfill(e){resume("next",e)}function reject(e){resume("throw",e)}function settle(e,t){if(e(t),i.shift(),i.length)resume(i[0][0],i[0][1])}};const ao=process.platform==="win32";class DefaultGlobber{constructor(e){this.patterns=[];this.searchPaths=[];this.options=getOptions(e)}getSearchPaths(){return this.searchPaths.slice()}glob(){return ro(this,void 0,void 0,(function*(){var e,t,r,n;const s=[];try{for(var i=true,o=no(this.globGenerator()),a;a=yield o.next(),e=a.done,!e;i=true){n=a.value;i=false;const e=n;s.push(e)}}catch(e){t={error:e}}finally{try{if(!i&&!e&&(r=o.return))yield r.call(o)}finally{if(t)throw t.error}}return s}))}globGenerator(){return oo(this,arguments,(function*globGenerator_1(){const e=getOptions(this.options);const t=[];for(const r of this.patterns){t.push(r);if(e.implicitDescendants&&(r.trailingSeparator||r.segments[r.segments.length-1]!=="**")){t.push(new Pattern(r.negate,true,r.segments.concat("**")))}}const r=[];for(const e of getSearchPaths(t)){core_debug(`Search path '${e}'`);try{yield so(i.promises.lstat(e))}catch(e){if(e.code==="ENOENT"){continue}throw e}r.unshift(new SearchState(e,1))}const n=[];while(r.length){const s=r.pop();const a=internal_pattern_helper_match(t,s.path);const c=!!a||internal_pattern_helper_partialMatch(t,s.path);if(!a&&!c){continue}const l=yield so(DefaultGlobber.stat(s,e,n));if(!l){continue}if(e.excludeHiddenFiles&&o.basename(s.path).match(/^\./)){continue}if(l.isDirectory()){if(a&Ki.Directory&&e.matchDirectories){yield yield so(s.path)}else if(!c){continue}const t=s.level+1;const n=(yield so(i.promises.readdir(s.path))).map((e=>new SearchState(o.join(s.path,e),t)));r.push(...n.reverse())}else if(a&Ki.File){yield yield so(s.path)}}}))}static create(e,t){return ro(this,void 0,void 0,(function*(){const r=new DefaultGlobber(t);if(ao){e=e.replace(/\r\n/g,"\n");e=e.replace(/\r/g,"\n")}const n=e.split("\n").map((e=>e.trim()));for(const e of n){if(!e||e.startsWith("#")){continue}else{r.patterns.push(new Pattern(e))}}r.searchPaths.push(...getSearchPaths(r.patterns));return r}))}static stat(e,t,r){return ro(this,void 0,void 0,(function*(){let n;if(t.followSymbolicLinks){try{n=yield i.promises.stat(e.path)}catch(r){if(r.code==="ENOENT"){if(t.omitBrokenSymbolicLinks){core_debug(`Broken symlink '${e.path}'`);return undefined}throw new Error(`No information found for the path '${e.path}'. This may indicate a broken symbolic link.`)}throw r}}else{n=yield i.promises.lstat(e.path)}if(n.isDirectory()&&t.followSymbolicLinks){const t=yield i.promises.realpath(e.path);while(r.length>=e.level){r.pop()}if(r.some((e=>e===t))){core_debug(`Symlink cycle detected for path '${e.path}' and realpath '${t}'`);return undefined}r.push(t)}return n}))}}const co=e(import.meta.url)("stream");var lo=undefined&&undefined.__awaiter||function(e,t,r,n){function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,s){function fulfilled(e){try{step(n.next(e))}catch(e){s(e)}}function rejected(e){try{step(n["throw"](e))}catch(e){s(e)}}function step(e){e.done?r(e.value):adopt(e.value).then(fulfilled,rejected)}step((n=n.apply(e,t||[])).next())}))};var Ao=undefined&&undefined.__asyncValues||function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof __values==="function"?__values(e):e[Symbol.iterator](),r={},verb("next"),verb("throw"),verb("return"),r[Symbol.asyncIterator]=function(){return this},r);function verb(t){r[t]=e[t]&&function(r){return new Promise((function(n,s){r=e[t](r),settle(n,s,r.done,r.value)}))}}function settle(e,t,r,n){Promise.resolve(n).then((function(t){e({value:t,done:r})}),t)}};function hashFiles(e,t){return lo(this,arguments,void 0,(function*(e,t,r=false){var n,s,i,o;var a;const c=r?core.info:core.debug;let l=false;const A=t?t:(a=process.env["GITHUB_WORKSPACE"])!==null&&a!==void 0?a:process.cwd();const u=crypto.createHash("sha256");let d=0;try{for(var g=true,p=Ao(e.globGenerator()),h;h=yield p.next(),n=h.done,!n;g=true){o=h.value;g=false;const e=o;c(e);if(!e.startsWith(`${A}${path.sep}`)){c(`Ignore '${e}' since it is not under GITHUB_WORKSPACE.`);continue}if(fs.statSync(e).isDirectory()){c(`Skip directory '${e}'.`);continue}const t=crypto.createHash("sha256");const r=util.promisify(stream.pipeline);yield r(fs.createReadStream(e),t);u.write(t.digest());d++;if(!l){l=true}}}catch(e){s={error:e}}finally{try{if(!g&&!n&&(i=p.return))yield i.call(p)}finally{if(s)throw s.error}}u.end();if(l){c(`Found ${d} files to hash.`);return u.digest("hex")}else{c(`No matches found for glob`);return""}}))}var uo=undefined&&undefined.__awaiter||function(e,t,r,n){function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,s){function fulfilled(e){try{step(n.next(e))}catch(e){s(e)}}function rejected(e){try{step(n["throw"](e))}catch(e){s(e)}}function step(e){e.done?r(e.value):adopt(e.value).then(fulfilled,rejected)}step((n=n.apply(e,t||[])).next())}))};function create(e,t){return uo(this,void 0,void 0,(function*(){return yield DefaultGlobber.create(e,t)}))}function glob_hashFiles(e){return uo(this,arguments,void 0,(function*(e,t="",r,n=false){let s=true;if(r&&typeof r.followSymbolicLinks==="boolean"){s=r.followSymbolicLinks}const i=yield create(e,{followSymbolicLinks:s});return _hashFiles(i,t,n)}))}var go;(function(e){e["Gzip"]="cache.tgz";e["Zstd"]="cache.tzst"})(go||(go={}));var po;(function(e){e["Gzip"]="gzip";e["ZstdWithoutLong"]="zstd-without-long";e["Zstd"]="zstd"})(po||(po={}));var ho;(function(e){e["GNU"]="gnu";e["BSD"]="bsd"})(ho||(ho={}));const mo=2;const fo=5e3;const Co=5e3;const yo=`${process.env["PROGRAMFILES"]}\\Git\\usr\\bin\\tar.exe`;const Eo=`${process.env["SYSTEMDRIVE"]}\\Windows\\System32\\tar.exe`;const Io="cache.tar";const Bo="manifest.txt";const Qo=10*Math.pow(1024,3);const bo="cache read denied:";var So=undefined&&undefined.__awaiter||function(e,t,r,n){function adopt(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,s){function fulfilled(e){try{step(n.next(e))}catch(e){s(e)}}function rejected(e){try{step(n["throw"](e))}catch(e){s(e)}}function step(e){e.done?r(e.value):adopt(e.value).then(fulfilled,rejected)}step((n=n.apply(e,t||[])).next())}))};var wo=undefined&&undefined.__asyncValues||function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof __values==="function"?__values(e):e[Symbol.iterator](),r={},verb("next"),verb("throw"),verb("return"),r[Symbol.asyncIterator]=function(){return this},r);function verb(t){r[t]=e[t]&&function(r){return new Promise((function(n,s){r=e[t](r),settle(n,s,r.done,r.value)}))}}function settle(e,t,r,n){Promise.resolve(n).then((function(t){e({value:t,done:r})}),t)}};const Do="1.0";function createTempDirectory(){return So(this,void 0,void 0,(function*(){const e=process.platform==="win32";let t=process.env["RUNNER_TEMP"]||"";if(!t){let r;if(e){r=process.env["USERPROFILE"]||"C:\\"}else{if(process.platform==="darwin"){r="/Users"}else{r="/home"}}t=o.join(r,"actions","temp")}const r=o.join(t,Ar.randomUUID());yield mkdirP(r);return r}))}function getArchiveFileSizeInBytes(e){return i.statSync(e).size}function resolvePaths(e){return So(this,void 0,void 0,(function*(){var t,r,n,s;var i;const a=[];const c=(i=process.env["GITHUB_WORKSPACE"])!==null&&i!==void 0?i:process.cwd();const l=yield create(e.join("\n"),{implicitDescendants:false});try{for(var A=true,u=wo(l.globGenerator()),d;d=yield u.next(),t=d.done,!t;A=true){s=d.value;A=false;const e=s;const t=o.relative(c,e).replace(new RegExp(`\\${o.sep}`,"g"),"/");core_debug(`Matched: ${t}`);if(t===""){a.push(".")}else{a.push(`${t}`)}}}catch(e){r={error:e}}finally{try{if(!A&&!t&&(n=u.return))yield n.call(u)}finally{if(r)throw r.error}}return a}))}function unlinkFile(e){return So(this,void 0,void 0,(function*(){return Z.promisify(i.unlink)(e)}))}function getVersion(e){return So(this,arguments,void 0,(function*(e,t=[]){let r="";t.push("--version");core_debug(`Checking ${e} ${t.join(" ")}`);try{yield exec_exec(`${e}`,t,{ignoreReturnCode:true,silent:true,listeners:{stdout:e=>r+=e.toString(),stderr:e=>r+=e.toString()}})}catch(e){core_debug(e.message)}r=r.trim();core_debug(r);return r}))}function getCompressionMethod(){return So(this,void 0,void 0,(function*(){const e=yield getVersion("zstd",["--quiet"]);const t=Yi.clean(e);core_debug(`zstd version: ${t}`);if(e===""){return po.Gzip}else{return po.ZstdWithoutLong}}))}function getCacheFileName(e){return e===po.Gzip?go.Gzip:go.Zstd}function getGnuTarPathOnWindows(){return So(this,void 0,void 0,(function*(){if(i.existsSync(yo)){return yo}const e=yield getVersion("tar");return e.toLowerCase().includes("gnu tar")?which("tar"):""}))}function assertDefined(e,t){if(t===undefined){throw Error(`Expected ${e} but value was undefiend`)}return t}function getCacheVersion(e,t,r=false){const n=e.slice();if(t){n.push(t)}if(process.platform==="win32"&&!r){n.push("windows-only")}n.push(Do);return Ar.createHash("sha256").update(n.join("|")).digest("hex")}function getRuntimeToken(){const e=process.env["ACTIONS_RUNTIME_TOKEN"];if(!e){throw new Error("Unable to get the ACTIONS_RUNTIME_TOKEN env variable")}return e}class AbortError extends Error{constructor(e){super(e);this.name="AbortError"}}const No=e(import.meta.url)("node:os");var xo=__nccwpck_require__(7975);const Ro=e(import.meta.url)("node:process");function log(e,...t){Ro.stderr.write(`${xo.format(e,...t)}${No.EOL}`)}function getEnvironmentVariable(e){return Ro.env[e]}function env_emitNodeWarning(e){process.emitWarning(e)}const vo=false;const ko=false;const Fo=typeof Ro.versions.deno==="string"&&Ro.versions.deno.length>0;const To=typeof Ro.versions.bun==="string"&&Ro.versions.bun.length>0;const Mo=true;const Po=!To&&!Fo;const Lo=false;const Uo=getEnvironmentVariable("DEBUG");let Oo;let Ho=[];let _o=[];const qo=[];if(Uo){enable(Uo)}const Go=Object.assign((e=>createDebugger(e)),{enable:enable,enabled:enabled,disable:disable,log:log});function enable(e){Oo=e;Ho=[];_o=[];const t=e.split(",").map((e=>e.trim()));for(const e of t){if(e.startsWith("-")){_o.push(e.substring(1))}else{Ho.push(e)}}for(const e of qo){e.enabled=enabled(e.namespace)}}function enabled(e){if(e.endsWith("*")){return true}for(const t of _o){if(namespaceMatches(e,t)){return false}}for(const t of Ho){if(namespaceMatches(e,t)){return true}}return false}function namespaceMatches(e,t){if(t.indexOf("*")===-1){return e===t}let r=t;if(t.indexOf("**")!==-1){const e=[];let n="";for(const r of t){if(r==="*"&&n==="*"){continue}else{n=r;e.push(r)}}r=e.join("")}let n=0;let s=0;const i=r.length;const o=e.length;let a=-1;let c=-1;while(n=0){s=a+1;n=c+1;if(n===o){return false}while(e[n]!==r[s]){n++;if(n===o){return false}}c=n;n++;s++;continue}else{return false}}const l=n===e.length;const A=s===r.length;const u=s===r.length-1&&r[s]==="*";return l&&(A||u)}function disable(){const e=Oo||"";enable("");return e}function createDebugger(e){const t=Object.assign(debug,{enabled:enabled(e),destroy:destroy,log:Go.log,namespace:e,extend:extend});function debug(...r){if(!t.enabled){return}if(r.length>0){r[0]=`${e} ${r[0]}`}t.log(...r)}qo.push(t);return t}function destroy(){const e=qo.indexOf(this);if(e>=0){qo.splice(e,1);return true}return false}function extend(e){const t=createDebugger(`${this.namespace}:${e}`);t.log=this.log;return t}const zo=Go;const Yo=["verbose","info","warning","error"];const Vo={verbose:400,info:300,warning:200,error:100};function patchLogMethod(e,t){t.log=(...t)=>{e.log(...t)}}function isTypeSpecRuntimeLogLevel(e){return Yo.includes(e)}function createLoggerContext(e){const t=new Set;const r=getEnvironmentVariable(e.logLevelEnvVarName);let n;const s=zo(e.namespace);s.log=(...e)=>{zo.log(...e)};function contextSetLogLevel(e){if(e&&!isTypeSpecRuntimeLogLevel(e)){throw new Error(`Unknown log level '${e}'. Acceptable values: ${Yo.join(",")}`)}n=e;const r=[];for(const e of t){if(shouldEnable(e)){r.push(e.namespace)}}zo.enable(r.join(","))}if(r){if(isTypeSpecRuntimeLogLevel(r)){contextSetLogLevel(r)}else{console.error(`${e.logLevelEnvVarName} set to unknown log level '${r}'; logging is not enabled. Acceptable values: ${Yo.join(", ")}.`)}}function shouldEnable(e){return Boolean(n&&Vo[e.level]<=Vo[n])}function createLogger(e,r){const n=Object.assign(e.extend(r),{level:r});patchLogMethod(e,n);if(shouldEnable(n)){const e=zo.disable();zo.enable(e+","+n.namespace)}t.add(n);return n}function contextGetLogLevel(){return n}function contextCreateClientLogger(e){const t=s.extend(e);patchLogMethod(s,t);return{error:createLogger(t,"error"),warning:createLogger(t,"warning"),info:createLogger(t,"info"),verbose:createLogger(t,"verbose")}}return{setLogLevel:contextSetLogLevel,getLogLevel:contextGetLogLevel,createClientLogger:contextCreateClientLogger,logger:s}}const Jo=createLoggerContext({logLevelEnvVarName:"TYPESPEC_RUNTIME_LOG_LEVEL",namespace:"typeSpecRuntime"});const Wo=Jo.logger;function setLogLevel(e){Jo.setLogLevel(e)}function getLogLevel(){return Jo.getLogLevel()}function createClientLogger(e){return Jo.createClientLogger(e)}function normalizeName(e){return e.toLowerCase()}function normalizeValue(e){return String(e).trim().replace(/[\r\n]/g,"")}function*headerIterator(e){for(const t of e.values()){yield[t.name,t.value]}}class HttpHeadersImpl{_headersMap;constructor(e){this._headersMap=new Map;if(e){for(const t of Object.keys(e)){this.set(t,e[t])}}}set(e,t){this._headersMap.set(normalizeName(e),{name:e,value:normalizeValue(t)})}get(e){return this._headersMap.get(normalizeName(e))?.value}has(e){return this._headersMap.has(normalizeName(e))}delete(e){this._headersMap.delete(normalizeName(e))}toJSON(e={}){const t={};if(e.preserveCase){for(const e of this._headersMap.values()){t[e.name]=e.value}}else{for(const[e,r]of this._headersMap){t[e]=r.value}}return t}toString(){return JSON.stringify(this.toJSON({preserveCase:true}))}[Symbol.iterator](){return headerIterator(this._headersMap)}}function httpHeaders_createHttpHeaders(e){return new HttpHeadersImpl(e)}function randomUUID(){return globalThis.crypto.randomUUID()}class PipelineRequestImpl{url;method;headers;timeout;withCredentials;body;multipartBody;formData;streamResponseStatusCodes;enableBrowserStreams;proxySettings;disableKeepAlive;abortSignal;requestId;allowInsecureConnection;onUploadProgress;onDownloadProgress;requestOverrides;authSchemes;constructor(e){this.url=e.url;this.body=e.body;this.headers=e.headers??httpHeaders_createHttpHeaders();this.method=e.method??"GET";this.timeout=e.timeout??0;this.multipartBody=e.multipartBody;this.formData=e.formData;this.disableKeepAlive=e.disableKeepAlive??false;this.proxySettings=e.proxySettings;this.streamResponseStatusCodes=e.streamResponseStatusCodes;this.withCredentials=e.withCredentials??false;this.abortSignal=e.abortSignal;this.onUploadProgress=e.onUploadProgress;this.onDownloadProgress=e.onDownloadProgress;this.requestId=e.requestId||randomUUID();this.allowInsecureConnection=e.allowInsecureConnection??false;this.enableBrowserStreams=e.enableBrowserStreams??false;this.requestOverrides=e.requestOverrides;this.authSchemes=e.authSchemes}}function pipelineRequest_createPipelineRequest(e){return new PipelineRequestImpl(e)}const jo=new Set(["Deserialize","Serialize","Retry","Sign"]);class HttpPipeline{_policies=[];_orderedPolicies;constructor(e){this._policies=e?.slice(0)??[];this._orderedPolicies=undefined}addPolicy(e,t={}){if(t.phase&&t.afterPhase){throw new Error("Policies inside a phase cannot specify afterPhase.")}if(t.phase&&!jo.has(t.phase)){throw new Error(`Invalid phase name: ${t.phase}`)}if(t.afterPhase&&!jo.has(t.afterPhase)){throw new Error(`Invalid afterPhase name: ${t.afterPhase}`)}this._policies.push({policy:e,options:t});this._orderedPolicies=undefined}removePolicy(e){const t=[];this._policies=this._policies.filter((r=>{if(e.name&&r.policy.name===e.name||e.phase&&r.options.phase===e.phase){t.push(r.policy);return false}else{return true}}));this._orderedPolicies=undefined;return t}sendRequest(e,t){const r=this.getOrderedPolicies();const n=r.reduceRight(((e,t)=>r=>t.sendRequest(r,e)),(t=>e.sendRequest(t)));return n(t)}getOrderedPolicies(){if(!this._orderedPolicies){this._orderedPolicies=this.orderPolicies()}return this._orderedPolicies}clone(){return new HttpPipeline(this._policies)}static create(){return new HttpPipeline}orderPolicies(){const e=[];const t=new Map;function createPhase(e){return{name:e,policies:new Set,hasRun:false,hasAfterPolicies:false}}const r=createPhase("Serialize");const n=createPhase("None");const s=createPhase("Deserialize");const i=createPhase("Retry");const o=createPhase("Sign");const a=[r,n,s,i,o];function getPhase(e){if(e==="Retry"){return i}else if(e==="Serialize"){return r}else if(e==="Deserialize"){return s}else if(e==="Sign"){return o}else{return n}}for(const e of this._policies){const r=e.policy;const n=e.options;const s=r.name;if(t.has(s)){throw new Error("Duplicate policy names not allowed in pipeline")}const i={policy:r,dependsOn:new Set,dependants:new Set};if(n.afterPhase){i.afterPhase=getPhase(n.afterPhase);i.afterPhase.hasAfterPolicies=true}t.set(s,i);const o=getPhase(n.phase);o.policies.add(i)}for(const e of this._policies){const{policy:r,options:n}=e;const s=r.name;const i=t.get(s);if(!i){throw new Error(`Missing node for policy ${s}`)}if(n.afterPolicies){for(const e of n.afterPolicies){const r=t.get(e);if(r){i.dependsOn.add(r);r.dependants.add(i)}}}if(n.beforePolicies){for(const e of n.beforePolicies){const r=t.get(e);if(r){r.dependsOn.add(i);i.dependants.add(r)}}}}function walkPhase(r){r.hasRun=true;for(const n of r.policies){if(n.afterPhase&&(!n.afterPhase.hasRun||n.afterPhase.policies.size)){continue}if(n.dependsOn.size===0){e.push(n.policy);for(const e of n.dependants){e.dependsOn.delete(n)}t.delete(n.policy.name);r.policies.delete(n)}}}function walkPhases(){for(const e of a){walkPhase(e);if(e.policies.size>0&&e!==n){if(!n.hasRun){walkPhase(n)}return}if(e.hasAfterPolicies){walkPhase(n)}}}let c=0;while(t.size>0){c++;const t=e.length;walkPhases();if(e.length<=t&&c>1){throw new Error("Cannot satisfy policy dependencies due to requirements cycle.")}}return e}}function pipeline_createEmptyPipeline(){return HttpPipeline.create()}function isObject(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function isError(e){if(isObject(e)){const t=typeof e.name==="string";const r=typeof e.message==="string";return t&&r}return false}const Ko=xo.inspect.custom;const $o="REDACTED";const Xo=["x-ms-client-request-id","x-ms-return-client-request-id","x-ms-useragent","x-ms-correlation-request-id","x-ms-request-id","client-request-id","ms-cv","return-client-request-id","traceparent","Access-Control-Allow-Credentials","Access-Control-Allow-Headers","Access-Control-Allow-Methods","Access-Control-Allow-Origin","Access-Control-Expose-Headers","Access-Control-Max-Age","Access-Control-Request-Headers","Access-Control-Request-Method","Origin","Accept","Accept-Encoding","Cache-Control","Connection","Content-Length","Content-Type","Date","ETag","Expires","If-Match","If-Modified-Since","If-None-Match","If-Unmodified-Since","Last-Modified","Pragma","Request-Id","Retry-After","Server","Transfer-Encoding","User-Agent","WWW-Authenticate"];const Zo=["api-version"];class Sanitizer{allowedHeaderNames;allowedQueryParameters;constructor({additionalAllowedHeaderNames:e=[],additionalAllowedQueryParameters:t=[]}={}){e=Xo.concat(e);t=Zo.concat(t);this.allowedHeaderNames=new Set(e.map((e=>e.toLowerCase())));this.allowedQueryParameters=new Set(t.map((e=>e.toLowerCase())))}sanitize(e){const t=new Set;return JSON.stringify(e,((e,r)=>{if(r instanceof Error){return{...r,name:r.name,message:r.message}}if(e==="headers"&&isObject(r)){return this.sanitizeHeaders(r)}else if(e==="url"&&typeof r==="string"){return this.sanitizeUrl(r)}else if(e==="query"&&isObject(r)){return this.sanitizeQuery(r)}else if(e==="body"){return undefined}else if(e==="response"){return undefined}else if(e==="operationSpec"){return undefined}else if(Array.isArray(r)||isObject(r)){if(t.has(r)){return"[Circular]"}t.add(r)}return r}),2)}sanitizeUrl(e){if(typeof e!=="string"||e===null||e===""){return e}const t=new URL(e);if(!t.search){return e}for(const[e]of t.searchParams){if(!this.allowedQueryParameters.has(e.toLowerCase())){t.searchParams.set(e,$o)}}return t.toString()}sanitizeHeaders(e){const t={};for(const r of Object.keys(e)){if(this.allowedHeaderNames.has(r.toLowerCase())){t[r]=e[r]}else{t[r]=$o}}return t}sanitizeQuery(e){if(typeof e!=="object"||e===null){return e}const t={};for(const r of Object.keys(e)){if(this.allowedQueryParameters.has(r.toLowerCase())){t[r]=e[r]}else{t[r]=$o}}return t}}const ea=new Sanitizer;class restError_RestError extends Error{static REQUEST_SEND_ERROR="REQUEST_SEND_ERROR";static PARSE_ERROR="PARSE_ERROR";code;statusCode;request;response;details;constructor(e,t={}){super(e);this.name="RestError";this.code=t.code;this.statusCode=t.statusCode;Object.defineProperty(this,"request",{value:t.request,enumerable:false});Object.defineProperty(this,"response",{value:t.response,enumerable:false});const r=this.request?.agent?{maxFreeSockets:this.request.agent.maxFreeSockets,maxSockets:this.request.agent.maxSockets}:undefined;Object.defineProperty(this,Ko,{value:()=>`RestError: ${this.message} \n ${ea.sanitize({...this,request:{...this.request,agent:r},response:this.response})}`,enumerable:false});Object.setPrototypeOf(this,restError_RestError.prototype)}}function restError_isRestError(e){if(e instanceof restError_RestError){return true}return isError(e)&&e.name==="RestError"}var ta=__nccwpck_require__(7067);const ra=e(import.meta.url)("node:https");var na=__nccwpck_require__(8522);var sa=__nccwpck_require__(7075);const ia=createClientLogger("ts-http-runtime");const oa={};function nodeHttpClient_isReadableStream(e){return e&&typeof e.pipe==="function"}function isStreamComplete(e){if(e.readable===false){return Promise.resolve()}return new Promise((t=>{const handler=()=>{t();e.removeListener("close",handler);e.removeListener("end",handler);e.removeListener("error",handler)};e.on("close",handler);e.on("end",handler);e.on("error",handler)}))}function isArrayBuffer(e){return e&&typeof e.byteLength==="number"}class ReportTransform extends sa.Transform{loadedBytes=0;progressCallback;_transform(e,t,r){this.push(e);this.loadedBytes+=e.length;try{this.progressCallback({loadedBytes:this.loadedBytes});r()}catch(e){r(e)}}constructor(e){super();this.progressCallback=e}}class NodeHttpClient{cachedHttpAgent;cachedHttpsAgents=new WeakMap;async sendRequest(e){const t=new AbortController;let r;if(e.abortSignal){if(e.abortSignal.aborted){throw new AbortError("The operation was aborted. Request has already been canceled.")}r=e=>{if(e.type==="abort"){t.abort()}};e.abortSignal.addEventListener("abort",r)}let n;if(e.timeout>0){n=setTimeout((()=>{const r=new Sanitizer;ia.info(`request to '${r.sanitizeUrl(e.url)}' timed out. canceling...`);t.abort()}),e.timeout)}const s=e.headers.get("Accept-Encoding");const i=s?.includes("gzip")||s?.includes("deflate");let o=typeof e.body==="function"?e.body():e.body;if(o&&!e.headers.has("Content-Length")){const t=getBodyLength(o);if(t!==null){e.headers.set("Content-Length",t)}}let a;try{if(o&&e.onUploadProgress){const t=e.onUploadProgress;const r=new ReportTransform(t);r.on("error",(e=>{ia.error("Error in upload progress",e)}));if(nodeHttpClient_isReadableStream(o)){o.pipe(r)}else{r.end(o)}o=r}const r=await this.makeRequest(e,t,o);if(n!==undefined){clearTimeout(n)}const s=getResponseHeaders(r);const c=r.statusCode??0;const l={status:c,headers:s,request:e};if(e.method==="HEAD"){r.resume();return l}a=i?getDecodedResponseStream(r,s):r;const A=e.onDownloadProgress;if(A){const e=new ReportTransform(A);e.on("error",(e=>{ia.error("Error in download progress",e)}));a.pipe(e);a=e}if(e.streamResponseStatusCodes?.has(Number.POSITIVE_INFINITY)||e.streamResponseStatusCodes?.has(l.status)){l.readableStreamBody=a}else{l.bodyAsText=await streamToText(a)}return l}finally{if(e.abortSignal&&r){let t=Promise.resolve();if(nodeHttpClient_isReadableStream(o)){t=isStreamComplete(o)}let n=Promise.resolve();if(nodeHttpClient_isReadableStream(a)){n=isStreamComplete(a)}Promise.all([t,n]).then((()=>{if(r){e.abortSignal?.removeEventListener("abort",r)}})).catch((e=>{ia.warning("Error when cleaning up abortListener on httpRequest",e)}))}}}makeRequest(e,t,r){const n=new URL(e.url);const s=n.protocol!=="https:";if(s&&!e.allowInsecureConnection){throw new Error(`Cannot connect to ${e.url} while allowInsecureConnection is false.`)}const i=e.agent??this.getOrCreateAgent(e,s);const o={agent:i,hostname:n.hostname,path:`${n.pathname}${n.search}`,port:n.port,method:e.method,headers:e.headers.toJSON({preserveCase:true}),...e.requestOverrides};return new Promise(((n,i)=>{const a=s?ta.request(o,n):ra.request(o,n);a.once("error",(t=>{i(new restError_RestError(t.message,{code:t.code??restError_RestError.REQUEST_SEND_ERROR,request:e}))}));t.signal.addEventListener("abort",(()=>{const e=new AbortError("The operation was aborted. Rejecting from abort signal callback while making request.");a.destroy(e);i(e)}));if(r&&nodeHttpClient_isReadableStream(r)){r.pipe(a)}else if(r){if(typeof r==="string"||Buffer.isBuffer(r)){a.end(r)}else if(isArrayBuffer(r)){a.end(ArrayBuffer.isView(r)?Buffer.from(r.buffer,r.byteOffset,r.byteLength):Buffer.from(r))}else{ia.error("Unrecognized body type",r);i(new restError_RestError("Unrecognized body type"))}}else{a.end()}}))}getOrCreateAgent(e,t){const r=e.disableKeepAlive;if(t){if(r){return ta.globalAgent}if(!this.cachedHttpAgent){this.cachedHttpAgent=new ta.Agent({keepAlive:true})}return this.cachedHttpAgent}else{if(r&&!e.tlsSettings){return ra.globalAgent}const t=e.tlsSettings??oa;let n=this.cachedHttpsAgents.get(t);if(n&&n.options.keepAlive===!r){return n}ia.info("No cached TLS Agent exist, creating a new Agent");n=new ra.Agent({keepAlive:!r,...t});this.cachedHttpsAgents.set(t,n);return n}}}function getResponseHeaders(e){const t=httpHeaders_createHttpHeaders();for(const r of Object.keys(e.headers)){const n=e.headers[r];if(Array.isArray(n)){if(n.length>0){t.set(r,n[0])}}else if(n){t.set(r,n)}}return t}function getDecodedResponseStream(e,t){const r=t.get("Content-Encoding");if(r==="gzip"){const t=na.createGunzip();e.pipe(t);return t}else if(r==="deflate"){const t=na.createInflate();e.pipe(t);return t}return e}function streamToText(e){return new Promise(((t,r)=>{const n=[];e.on("data",(e=>{if(Buffer.isBuffer(e)){n.push(e)}else{n.push(Buffer.from(e))}}));e.on("end",(()=>{t(Buffer.concat(n).toString("utf8"))}));e.on("error",(e=>{if(e&&e?.name==="AbortError"){r(e)}else{r(new restError_RestError(`Error reading response as text: ${e.message}`,{code:restError_RestError.PARSE_ERROR}))}}))}))}function getBodyLength(e){if(!e){return 0}else if(Buffer.isBuffer(e)){return e.length}else if(nodeHttpClient_isReadableStream(e)){return null}else if(isArrayBuffer(e)){return e.byteLength}else if(typeof e==="string"){return Buffer.from(e).length}else{return null}}function createNodeHttpClient(){return new NodeHttpClient}function defaultHttpClient_createDefaultHttpClient(){return createNodeHttpClient()}const aa="logPolicy";function logPolicy_logPolicy(e={}){const t=e.logger??ia.info;const r=new Sanitizer({additionalAllowedHeaderNames:e.additionalAllowedHeaderNames,additionalAllowedQueryParameters:e.additionalAllowedQueryParameters});return{name:aa,async sendRequest(e,n){if(!t.enabled){return n(e)}t(`Request: ${r.sanitize(e)}`);const s=await n(e);t(`Response status code: ${s.status}`);t(`Headers: ${r.sanitize({headers:s.headers})}`);return s}}}function getHeaderName(){return"User-Agent"}async function userAgentPlatform_setPlatformSpecificData(e){if(process&&process.versions){const t=`${os.type()} ${os.release()}; ${os.arch()}`;if(process.versions.bun){e.set("Bun",`${process.versions.bun} (${t})`)}else if(process.versions.deno){e.set("Deno",`${process.versions.deno} (${t})`)}else if(process.versions.node){e.set("Node",`${process.versions.node} (${t})`)}}}function getUserAgentString(e){const t=[];for(const[r,n]of e){const e=n?`${r}/${n}`:r;t.push(e)}return t.join(" ")}function getUserAgentHeaderName(){return getHeaderName()}async function userAgent_getUserAgentValue(e){const t=new Map;t.set("ts-http-runtime",SDK_VERSION);await setPlatformSpecificData(t);const r=getUserAgentString(t);const n=e?`${e} ${r}`:r;return n}const ca=getUserAgentHeaderName();const la="userAgentPolicy";function userAgentPolicy_userAgentPolicy(e={}){const t=getUserAgentValue(e.userAgentPrefix);return{name:la,async sendRequest(e,r){if(!e.headers.has(ca)){e.headers.set(ca,await t)}return r(e)}}}function getRandomIntegerInclusive(e,t){e=Math.ceil(e);t=Math.floor(t);const r=Math.floor(Math.random()*(t-e+1));return r+e}function calculateRetryDelay(e,t){const r=t.retryDelayInMs*Math.pow(2,e);const n=Math.min(t.maxRetryDelayInMs,r);const s=n/2+getRandomIntegerInclusive(0,n/2);return{retryAfterInMs:s}}const Aa="The operation was aborted.";function helpers_delay(e,t,r){return new Promise(((n,s)=>{let i=undefined;let o=undefined;const rejectOnAbort=()=>s(new AbortError(r?.abortErrorMsg?r?.abortErrorMsg:Aa));const removeListeners=()=>{if(r?.abortSignal&&o){r.abortSignal.removeEventListener("abort",o)}};o=()=>{if(i){clearTimeout(i)}removeListeners();return rejectOnAbort()};if(r?.abortSignal&&r.abortSignal.aborted){return rejectOnAbort()}i=setTimeout((()=>{removeListeners();n(t)}),e);if(r?.abortSignal){r.abortSignal.addEventListener("abort",o)}}))}function parseHeaderValueAsNumber(e,t){const r=e.headers.get(t);if(!r)return;const n=Number(r);if(Number.isNaN(n))return;return n}const ua="Retry-After";const da=["retry-after-ms","x-ms-retry-after-ms",ua];function getRetryAfterInMs(e){if(!(e&&[429,503].includes(e.status)))return undefined;try{for(const t of da){const r=parseHeaderValueAsNumber(e,t);if(r===0||r){const e=t===ua?1e3:1;return r*e}}const t=e.headers.get(ua);if(!t)return;const r=Date.parse(t);const n=r-Date.now();return Number.isFinite(n)?Math.max(0,n):undefined}catch{return undefined}}function isThrottlingRetryResponse(e){return Number.isFinite(getRetryAfterInMs(e))}function throttlingRetryStrategy_throttlingRetryStrategy(){return{name:"throttlingRetryStrategy",retry({response:e}){const t=getRetryAfterInMs(e);if(!Number.isFinite(t)){return{skipStrategy:true}}return{retryAfterInMs:t}}}}const ga=1e3;const pa=1e3*64;function exponentialRetryStrategy_exponentialRetryStrategy(e={}){const t=e.retryDelayInMs??ga;const r=e.maxRetryDelayInMs??pa;return{name:"exponentialRetryStrategy",retry({retryCount:n,response:s,responseError:i}){const o=isSystemError(i);const a=o&&e.ignoreSystemErrors;const c=isExponentialRetryResponse(s);const l=c&&e.ignoreHttpStatusCodes;const A=s&&(isThrottlingRetryResponse(s)||!c);if(A||l||a){return{skipStrategy:true}}if(i&&!o&&!c){return{errorToThrow:i}}return calculateRetryDelay(n,{retryDelayInMs:t,maxRetryDelayInMs:r})}}}function isExponentialRetryResponse(e){return Boolean(e&&e.status!==undefined&&(e.status>=500||e.status===408)&&e.status!==501&&e.status!==505)}function isSystemError(e){if(!e){return false}return e.code==="ETIMEDOUT"||e.code==="ESOCKETTIMEDOUT"||e.code==="ECONNREFUSED"||e.code==="ECONNRESET"||e.code==="ENOENT"||e.code==="ENOTFOUND"}const ha="0.3.8";const ma=3;const fa=createClientLogger("ts-http-runtime retryPolicy");const Ca="retryPolicy";function retryPolicy_retryPolicy(e,t={maxRetries:ma}){const r=t.logger||fa;return{name:Ca,async sendRequest(n,s){let i;let o;let a=-1;e:while(true){a+=1;i=undefined;o=undefined;try{r.info(`Retry ${a}: Attempting to send request`,n.requestId);i=await s(n);r.info(`Retry ${a}: Received a response from request`,n.requestId)}catch(e){r.error(`Retry ${a}: Received an error from request`,n.requestId);if(!restError_isRestError(e)){throw e}o=e;i=e.response}if(n.abortSignal?.aborted){r.error(`Retry ${a}: Request aborted.`);const e=new AbortError;throw e}if(a>=(t.maxRetries??ma)){r.info(`Retry ${a}: Maximum retries reached. Returning the last received response, or throwing the last received error.`);if(o){throw o}else if(i){return i}else{throw new Error("Maximum retries reached with no response or error to throw")}}r.info(`Retry ${a}: Processing ${e.length} retry strategies.`);t:for(const t of e){const e=t.logger||r;e.info(`Retry ${a}: Processing retry strategy ${t.name}.`);const s=t.retry({retryCount:a,response:i,responseError:o});if(s.skipStrategy){e.info(`Retry ${a}: Skipped.`);continue t}const{errorToThrow:c,retryAfterInMs:l,redirectTo:A}=s;if(c){e.error(`Retry ${a}: Retry strategy ${t.name} throws error:`,c);throw c}if(l||l===0){e.info(`Retry ${a}: Retry strategy ${t.name} retries after ${l}`);await helpers_delay(l,undefined,{abortSignal:n.abortSignal});continue e}if(A){e.info(`Retry ${a}: Retry strategy ${t.name} redirects to ${A}`);n.url=A;continue e}}if(o){r.info(`None of the retry strategies could work with the received error. Throwing it.`);throw o}if(i){r.info(`None of the retry strategies could work with the received response. Returning it.`);return i}}}}}const ya="defaultRetryPolicy";function defaultRetryPolicy_defaultRetryPolicy(e={}){return{name:ya,sendRequest:retryPolicy_retryPolicy([throttlingRetryStrategy_throttlingRetryStrategy(),exponentialRetryStrategy_exponentialRetryStrategy(e)],{maxRetries:e.maxRetries??ma}).sendRequest}}function bytesEncoding_uint8ArrayToString(e,t){return Buffer.from(e).toString(t)}function bytesEncoding_stringToUint8Array(e,t){return Buffer.from(e,t)}function convertBodyToFormDataMap(e){if(typeof FormData!=="undefined"&&e instanceof FormData){const t={};for(const[r,n]of e.entries()){const e=t[r];if(Array.isArray(e)){e.push(n)}else{t[r]=e!==undefined?[e,n]:[n]}}return t}return undefined}const Ea="formDataPolicy";function formDataPolicy_formDataPolicy(){return{name:Ea,async sendRequest(e,t){const r=convertBodyToFormDataMap(e.body);if(r){e.formData=r;e.body=undefined}if(e.formData){const t=e.headers.get("Content-Type");if(t&&t.indexOf("application/x-www-form-urlencoded")!==-1){e.body=wwwFormUrlEncode(e.formData)}else{await prepareFormData(e.formData,e)}e.formData=undefined}return t(e)}}}function wwwFormUrlEncode(e){const t=new URLSearchParams;for(const[r,n]of Object.entries(e)){if(Array.isArray(n)){for(const e of n){t.append(r,e.toString())}}else{t.append(r,n.toString())}}return t.toString()}async function prepareFormData(e,t){const r=t.headers.get("Content-Type");if(r&&!r.startsWith("multipart/form-data")){return}t.headers.set("Content-Type",r??"multipart/form-data");const n=[];for(const[t,r]of Object.entries(e)){for(const e of Array.isArray(r)?r:[r]){if(typeof e==="string"){n.push({headers:httpHeaders_createHttpHeaders({"Content-Disposition":`form-data; name="${t}"`}),body:bytesEncoding_stringToUint8Array(e,"utf-8")})}else if(e===undefined||e===null||typeof e!=="object"){throw new Error(`Unexpected value for key ${t}: ${e}. Value should be serialized to string first.`)}else{const r=e.name||"blob";const s=httpHeaders_createHttpHeaders();s.set("Content-Disposition",`form-data; name="${t}"; filename="${r}"`);s.set("Content-Type",e.type||"application/octet-stream");n.push({headers:s,body:e})}}}t.multipartBody={parts:n}}var Ia=__nccwpck_require__(3669);var Ba=__nccwpck_require__(1970);const Qa="HTTPS_PROXY";const ba="HTTP_PROXY";const Sa="ALL_PROXY";const wa="NO_PROXY";const Da="proxyPolicy";const Na=[];let xa=false;const Ra=new Map;function getEnvironmentValue(e){if(process.env[e]){return process.env[e]}else if(process.env[e.toLowerCase()]){return process.env[e.toLowerCase()]}return undefined}function loadEnvironmentProxyValue(){if(!process){return undefined}const e=getEnvironmentValue(Qa);const t=getEnvironmentValue(Sa);const r=getEnvironmentValue(ba);return e||t||r}function isBypassed(e,t,r){if(t.length===0){return false}const n=new URL(e).hostname;if(r?.has(n)){return r.get(n)}let s=false;for(const e of t){if(e[0]==="."){if(n.endsWith(e)){s=true}else{if(n.length===e.length-1&&n===e.slice(1)){s=true}}}else{if(n===e){s=true}}}r?.set(n,s);return s}function loadNoProxy(){const e=getEnvironmentValue(wa);xa=true;if(e){return e.split(",").map((e=>e.trim())).filter((e=>e.length))}return[]}function getDefaultProxySettings(e){if(!e){e=loadEnvironmentProxyValue();if(!e){return undefined}}const t=new URL(e);const r=t.protocol?t.protocol+"//":"";return{host:r+t.hostname,port:Number.parseInt(t.port||"80"),username:t.username,password:t.password}}function getDefaultProxySettingsInternal(){const e=loadEnvironmentProxyValue();return e?new URL(e):undefined}function getUrlFromProxySettings(e){let t;try{t=new URL(e.host)}catch{throw new Error(`Expecting a valid host string in proxy settings, but found "${e.host}".`)}t.port=String(e.port);if(e.username){t.username=e.username}if(e.password){t.password=e.password}return t}function setProxyAgentOnRequest(e,t,r){if(e.agent){return}const n=new URL(e.url);const s=n.protocol!=="https:";if(e.tlsSettings){ia.warning("TLS settings are not supported in combination with custom Proxy, certificates provided to the client will be ignored.")}if(s){if(!t.httpProxyAgent){t.httpProxyAgent=new Ba.HttpProxyAgent(r)}e.agent=t.httpProxyAgent}else{if(!t.httpsProxyAgent){t.httpsProxyAgent=new Ia.HttpsProxyAgent(r)}e.agent=t.httpsProxyAgent}}function proxyPolicy_proxyPolicy(e,t){if(!xa){Na.push(...loadNoProxy())}const r=e?getUrlFromProxySettings(e):getDefaultProxySettingsInternal();const n={};return{name:Da,async sendRequest(e,s){if(!e.proxySettings&&r&&!isBypassed(e.url,t?.customNoProxyList??Na,t?.customNoProxyList?undefined:Ra)){setProxyAgentOnRequest(e,n,r)}else if(e.proxySettings){setProxyAgentOnRequest(e,n,getUrlFromProxySettings(e.proxySettings))}return s(e)}}}const va="redirectPolicy";const ka=["GET","HEAD"];function redirectPolicy_redirectPolicy(e={}){const{maxRetries:t=20,allowCrossOriginRedirects:r=false}=e;return{name:va,async sendRequest(e,n){const s=await n(e);return handleRedirect(n,s,t,r)}}}async function handleRedirect(e,t,r,n,s=0){const{request:i,status:o,headers:a}=t;const c=a.get("location");if(c&&(o===300||o===301&&ka.includes(i.method)||o===302&&ka.includes(i.method)||o===303&&i.method==="POST"||o===307)&&stypeof e==="function"?e():e)).map(toStream);return co.Readable.from(async function*(){for(const e of t){for await(const t of e){yield t}}}())}}function generateBoundary(){return`----AzSDKFormBoundary${randomUUID()}`}function encodeHeaders(e){let t="";for(const[r,n]of e){t+=`${r}: ${n}\r\n`}return t}function getLength(e){if(e instanceof Uint8Array){return e.byteLength}else if(typeGuards_isBlob(e)){return e.size===-1?undefined:e.size}else{return undefined}}function getTotalLength(e){let t=0;for(const r of e){const e=getLength(r);if(e===undefined){return undefined}else{t+=e}}return t}async function buildRequestBody(e,t,r){const n=[bytesEncoding_stringToUint8Array(`--${r}`,"utf-8"),...t.flatMap((e=>[bytesEncoding_stringToUint8Array("\r\n","utf-8"),bytesEncoding_stringToUint8Array(encodeHeaders(e.headers),"utf-8"),bytesEncoding_stringToUint8Array("\r\n","utf-8"),e.body,bytesEncoding_stringToUint8Array(`\r\n--${r}`,"utf-8")])),bytesEncoding_stringToUint8Array("--\r\n\r\n","utf-8")];const s=getTotalLength(n);if(s){e.headers.set("Content-Length",s)}e.body=await concat(n)}const Fa="multipartPolicy";const Ta=70;const Ma=new Set(`abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'()+,-./:=?`);function assertValidBoundary(e){if(e.length>Ta){throw new Error(`Multipart boundary "${e}" exceeds maximum length of 70 characters`)}if(Array.from(e).some((e=>!Ma.has(e)))){throw new Error(`Multipart boundary "${e}" contains invalid characters`)}}function multipartPolicy_multipartPolicy(){return{name:Fa,async sendRequest(e,t){if(!e.multipartBody){return t(e)}if(e.body){throw new Error("multipartBody and regular body cannot be set at the same time")}let r=e.multipartBody.boundary;const n=e.headers.get("Content-Type")??"multipart/mixed";const s=n.match(/^(multipart\/[^ ;]+)(?:; *boundary=(.+))?$/);if(!s){throw new Error(`Got multipart request body, but content-type header was not multipart: ${n}`)}const[,i,o]=s;if(o&&r&&o!==r){throw new Error(`Multipart boundary was specified as ${o} in the header, but got ${r} in the request body`)}r??=o;if(r){assertValidBoundary(r)}else{r=generateBoundary()}e.headers.set("Content-Type",`${i}; boundary=${r}`);await buildRequestBody(e,e.multipartBody.parts,r);e.multipartBody=undefined;return t(e)}}}function createPipelineFromOptions_createPipelineFromOptions(e){const t=createEmptyPipeline();addPlatformPolicies(t,e);t.addPolicy(formDataPolicy(),{beforePolicies:[multipartPolicyName]});t.addPolicy(userAgentPolicy(e.userAgentOptions));t.addPolicy(multipartPolicy(),{afterPhase:"Deserialize"});t.addPolicy(defaultRetryPolicy(e.retryOptions),{phase:"Retry"});t.addPolicy(logPolicy(e.loggingOptions),{afterPhase:"Sign"});return t}let Pa=false;function allowInsecureConnection(e,t){if(t.allowInsecureConnection&&e.allowInsecureConnection){const t=new URL(e.url);if(t.hostname==="localhost"||t.hostname==="127.0.0.1"){return true}}return false}function emitInsecureConnectionWarning(){const e="Sending token over insecure transport. Assume any token issued is compromised.";logger.warning(e);if(!Pa){Pa=true;emitNodeWarning(e)}}function checkInsecureConnection_ensureSecureConnection(e,t){if(!e.url.toLowerCase().startsWith("https://")){if(allowInsecureConnection(e,t)){emitInsecureConnectionWarning()}else{throw new Error("Authentication is not permitted for non-TLS protected (non-https) URLs when allowInsecureConnection is false.")}}}const La="apiKeyAuthenticationPolicy";function apiKeyAuthenticationPolicy_apiKeyAuthenticationPolicy(e){return{name:La,async sendRequest(t,r){ensureSecureConnection(t,e);const n=(t.authSchemes??e.authSchemes)?.find((e=>e.kind==="apiKey"));if(!n){return r(t)}if(n.apiKeyLocation!=="header"){throw new Error(`Unsupported API key location: ${n.apiKeyLocation}`)}t.headers.set(n.name,e.credential.key);return r(t)}}}const Ua="bearerAuthenticationPolicy";function basicAuthenticationPolicy_basicAuthenticationPolicy(e){return{name:Ua,async sendRequest(t,r){ensureSecureConnection(t,e);const n=(t.authSchemes??e.authSchemes)?.find((e=>e.kind==="http"&&e.scheme==="basic"));if(!n){return r(t)}const{username:s,password:i}=e.credential;const o=uint8ArrayToString(stringToUint8Array(`${s}:${i}`,"utf-8"),"base64");t.headers.set("Authorization",`Basic ${o}`);return r(t)}}}const Oa="bearerAuthenticationPolicy";function bearerAuthenticationPolicy_bearerAuthenticationPolicy(e){return{name:Oa,async sendRequest(t,r){ensureSecureConnection(t,e);const n=(t.authSchemes??e.authSchemes)?.find((e=>e.kind==="http"&&e.scheme==="bearer"));if(!n){return r(t)}const s=await e.credential.getBearerToken({abortSignal:t.abortSignal});t.headers.set("Authorization",`Bearer ${s}`);return r(t)}}}const Ha="oauth2AuthenticationPolicy";function oauth2AuthenticationPolicy_oauth2AuthenticationPolicy(e){return{name:Ha,async sendRequest(t,r){ensureSecureConnection(t,e);const n=(t.authSchemes??e.authSchemes)?.find((e=>e.kind==="oauth2"));if(!n){return r(t)}const s=await e.credential.getOAuth2Token(n.flows,{abortSignal:t.abortSignal});t.headers.set("Authorization",`Bearer ${s}`);return r(t)}}}let _a;function clientHelpers_createDefaultPipeline(e={}){const t=createPipelineFromOptions(e);t.addPolicy(apiVersionPolicy(e));const{credential:r,authSchemes:n,allowInsecureConnection:s}=e;if(r){if(isApiKeyCredential(r)){t.addPolicy(apiKeyAuthenticationPolicy({authSchemes:n,credential:r,allowInsecureConnection:s}))}else if(isBasicCredential(r)){t.addPolicy(basicAuthenticationPolicy({authSchemes:n,credential:r,allowInsecureConnection:s}))}else if(isBearerTokenCredential(r)){t.addPolicy(bearerAuthenticationPolicy({authSchemes:n,credential:r,allowInsecureConnection:s}))}else if(isOAuth2TokenCredential(r)){t.addPolicy(oauth2AuthenticationPolicy({authSchemes:n,credential:r,allowInsecureConnection:s}))}}return t}function clientHelpers_getCachedDefaultHttpsClient(){if(!_a){_a=createDefaultHttpClient()}return _a}function getHeaderValue(e,t){if(e.headers){const r=Object.keys(e.headers).find((e=>e.toLowerCase()===t.toLowerCase()));if(r){return e.headers[r]}}return undefined}function getPartContentType(e){const t=getHeaderValue(e,"content-type");if(t){return t}if(e.contentType===null){return undefined}if(e.contentType){return e.contentType}const{body:r}=e;if(r===null||r===undefined){return undefined}if(typeof r==="string"||typeof r==="number"||typeof r==="boolean"){return"text/plain; charset=UTF-8"}if(r instanceof Blob){return r.type||"application/octet-stream"}if(isBinaryBody(r)){return"application/octet-stream"}return"application/json"}function escapeDispositionField(e){return JSON.stringify(e)}function getContentDisposition(e){const t=getHeaderValue(e,"content-disposition");if(t){return t}if(e.dispositionType===undefined&&e.name===undefined&&e.filename===undefined){return undefined}const r=e.dispositionType??"form-data";let n=r;if(e.name){n+=`; name=${escapeDispositionField(e.name)}`}let s=undefined;if(e.filename){s=e.filename}else if(typeof File!=="undefined"&&e.body instanceof File){const t=e.body.name;if(t!==""){s=t}}if(s){n+=`; filename=${escapeDispositionField(s)}`}return n}function normalizeBody(e,t){if(e===undefined){return new Uint8Array([])}if(isBinaryBody(e)){return e}if(typeof e==="string"||typeof e==="number"||typeof e==="boolean"){return stringToUint8Array(String(e),"utf-8")}if(t&&/application\/(.+\+)?json(;.+)?/i.test(String(t))){return stringToUint8Array(JSON.stringify(e),"utf-8")}throw new RestError(`Unsupported body/content-type combination: ${e}, ${t}`)}function buildBodyPart(e){const t=getPartContentType(e);const r=getContentDisposition(e);const n=createHttpHeaders(e.headers??{});if(t){n.set("content-type",t)}if(r){n.set("content-disposition",r)}const s=normalizeBody(e.body,t);return{headers:n,body:s}}function multipart_buildMultipartBody(e){return{parts:e.map(buildBodyPart)}}async function sendRequest_sendRequest(e,t,r,n={},s){const i=s??getCachedDefaultHttpsClient();const o=buildPipelineRequest(e,t,n);try{const e=await r.sendRequest(i,o);const t=e.headers.toJSON();const s=e.readableStreamBody??e.browserStreamBody;const a=n.responseAsStream||s!==undefined?undefined:getResponseBody(e);const c=s??a;if(n?.onResponse){n.onResponse({...e,request:o,rawHeaders:t,parsedBody:a})}return{request:o,headers:t,status:`${e.status}`,body:c}}catch(e){if(isRestError(e)&&e.response&&n.onResponse){const{response:t}=e;const r=t.headers.toJSON();n?.onResponse({...t,request:o,rawHeaders:r},e)}throw e}}function getRequestContentType(e={}){if(e.contentType){return e.contentType}const t=e.headers?.["content-type"];if(typeof t==="string"){return t}return getContentType(e.body)}function getContentType(e){if(e===undefined){return undefined}if(ArrayBuffer.isView(e)){return"application/octet-stream"}if(isBlob(e)&&e.type){return e.type}if(typeof e==="string"){try{JSON.parse(e);return"application/json"}catch(e){return undefined}}return"application/json"}function buildPipelineRequest(e,t,r={}){const n=getRequestContentType(r);const{body:s,multipartBody:i}=getRequestBody(r.body,n);const o=r.accept??r.headers?.accept??(r.noDefaultAcceptHeader?undefined:"application/json");const a=createHttpHeaders({...r.headers?r.headers:{},...o!==undefined&&{accept:o},...n&&{"content-type":n}});const{allowInsecureConnection:c,abortSignal:l,onUploadProgress:A,onDownloadProgress:u,timeout:d,responseAsStream:g,noDefaultAcceptHeader:p,url:h,method:m,body:f,multipartBody:C,headers:y,...E}=r;const I=createPipelineRequest({url:t,method:e,body:s,multipartBody:i,headers:a,allowInsecureConnection:c,abortSignal:l,onUploadProgress:A,onDownloadProgress:u,timeout:d,enableBrowserStreams:true,streamResponseStatusCodes:g?new Set([Number.POSITIVE_INFINITY]):undefined});Object.assign(I,E);return I}function getRequestBody(e,t=""){if(e===undefined){return{body:undefined}}if(typeof FormData!=="undefined"&&e instanceof FormData){return{body:e}}if(isBlob(e)){return{body:e}}if(isReadableStream(e)){return{body:e}}if(typeof e==="function"){return{body:e}}if(ArrayBuffer.isView(e)){return{body:e instanceof Uint8Array?e:JSON.stringify(e)}}const r=t.split(";")[0];switch(r){case"application/json":return{body:JSON.stringify(e)};case"multipart/form-data":if(Array.isArray(e)){return{multipartBody:buildMultipartBody(e)}}return{body:JSON.stringify(e)};case"text/plain":return{body:String(e)};default:if(typeof e==="string"){return{body:e}}return{body:JSON.stringify(e)}}}function getResponseBody(e){const t=e.headers.get("content-type")??"";const r=t.split(";")[0];const n=e.bodyAsText??"";if(r==="text/plain"){return String(n)}try{return n?JSON.parse(n):undefined}catch(t){if(r==="application/json"){throw createParseError(e,t)}return String(n)}}function createParseError(e,t){const r=`Error "${t}" occurred while parsing the response body - ${e.bodyAsText}.`;const n=t.code??RestError.PARSE_ERROR;return new RestError(r,{code:n,statusCode:e.status,request:e.request,response:e})}function getClient(e,t={}){const r=t.pipeline??createDefaultPipeline(t);if(t.additionalPolicies?.length){for(const{policy:e,position:n}of t.additionalPolicies){const t=n==="perRetry"?"Sign":undefined;r.addPolicy(e,{afterPhase:t})}}const n=t.internal?.noDefaultAcceptHeader??false;const{allowInsecureConnection:s,httpClient:i}=t;const o=t.endpoint??e;const client=(e,...t)=>{const getUrl=r=>buildRequestUrl(o,e,t,{allowInsecureConnection:s,...r});return{get:(e={})=>buildOperation("GET",getUrl(e),r,e,s,i,n),post:(e={})=>buildOperation("POST",getUrl(e),r,e,s,i,n),put:(e={})=>buildOperation("PUT",getUrl(e),r,e,s,i,n),patch:(e={})=>buildOperation("PATCH",getUrl(e),r,e,s,i,n),delete:(e={})=>buildOperation("DELETE",getUrl(e),r,e,s,i,n),head:(e={})=>buildOperation("HEAD",getUrl(e),r,e,s,i,n),options:(e={})=>buildOperation("OPTIONS",getUrl(e),r,e,s,i,n),trace:(e={})=>buildOperation("TRACE",getUrl(e),r,e,s,i,n)}};return{path:client,pathUnchecked:client,pipeline:r}}function buildOperation(e,t,r,n,s,i,o=false){s=n.allowInsecureConnection??s;return{then:function(a,c){return sendRequest(e,t,r,{...n,allowInsecureConnection:s,noDefaultAcceptHeader:o},i).then(a,c)},async asBrowserStream(){if(isNodeLike){throw new Error("`asBrowserStream` is supported only in the browser environment. Use `asNodeStream` instead to obtain the response body stream. If you require a Web stream of the response in Node, consider using `Readable.toWeb` on the result of `asNodeStream`.")}else{return sendRequest(e,t,r,{...n,allowInsecureConnection:s,noDefaultAcceptHeader:o,responseAsStream:true},i)}},async asNodeStream(){if(isNodeLike){return sendRequest(e,t,r,{...n,allowInsecureConnection:s,noDefaultAcceptHeader:o,responseAsStream:true},i)}else{throw new Error("`isNodeStream` is not supported in the browser environment. Use `asBrowserStream` to obtain the response body stream.")}}}}function createRestError(e,t){const r=typeof e==="string"?t:e;const n=r.body?.error??r.body;const s=typeof e==="string"?e:n?.message??`Unexpected status code: ${r.status}`;return new RestError(s,{statusCode:statusCodeToNumber(r.status),code:n?.code,request:r.request,response:toPipelineResponse(r)})}function toPipelineResponse(e){return{headers:createHttpHeaders(e.headers),request:e.request,status:statusCodeToNumber(e.status)??-1,...typeof e.body==="string"?{bodyAsText:e.body}:{}}}function statusCodeToNumber(e){const t=Number.parseInt(e);return Number.isNaN(t)?undefined:t}function esm_pipeline_createEmptyPipeline(){return pipeline_createEmptyPipeline()}const qa=createLoggerContext({logLevelEnvVarName:"AZURE_LOG_LEVEL",namespace:"azure"});const Ga=qa.logger;function esm_setLogLevel(e){qa.setLogLevel(e)}function esm_getLogLevel(){return qa.getLogLevel()}function esm_createClientLogger(e){return qa.createClientLogger(e)}const za=esm_createClientLogger("core-rest-pipeline");const Ya="agentPolicy";function agentPolicy_agentPolicy(e){return{name:Ya,sendRequest:async(t,r)=>{if(!t.agent){t.agent=e}return r(t)}}}const Va="decompressResponsePolicy";function decompressResponsePolicy_decompressResponsePolicy(){return{name:Va,async sendRequest(e,t){if(e.method!=="HEAD"){e.headers.set("Accept-Encoding","gzip,deflate")}return t(e)}}}const Ja="exponentialRetryPolicy";function exponentialRetryPolicy(e={}){return retryPolicy([exponentialRetryStrategy({...e,ignoreSystemErrors:true})],{maxRetries:e.maxRetries??DEFAULT_RETRY_POLICY_COUNT})}const Wa="systemErrorRetryPolicy";function systemErrorRetryPolicy(e={}){return{name:Wa,sendRequest:retryPolicy([exponentialRetryStrategy({...e,ignoreHttpStatusCodes:true})],{maxRetries:e.maxRetries??DEFAULT_RETRY_POLICY_COUNT}).sendRequest}}const ja="throttlingRetryPolicy";function throttlingRetryPolicy(e={}){return{name:ja,sendRequest:retryPolicy([throttlingRetryStrategy()],{maxRetries:e.maxRetries??DEFAULT_RETRY_POLICY_COUNT}).sendRequest}}const Ka="tlsPolicy";function tlsPolicy_tlsPolicy(e){return{name:Ka,sendRequest:async(t,r)=>{if(!t.tlsSettings){t.tlsSettings=e}return r(t)}}}const $a=null&&tspLogPolicyName;function policies_logPolicy_logPolicy(e={}){return logPolicy_logPolicy({logger:za.info,...e})}const Xa=va;function policies_redirectPolicy_redirectPolicy(e={}){return redirectPolicy_redirectPolicy(e)}function userAgentPlatform_getHeaderName(){return"User-Agent"}async function util_userAgentPlatform_setPlatformSpecificData(e){if(Ro&&Ro.versions){const t=`${No.type()} ${No.release()}; ${No.arch()}`;if(Ro.versions.bun){e.set("Bun",`${Ro.versions.bun} (${t})`)}else if(Ro.versions.deno){e.set("Deno",`${Ro.versions.deno} (${t})`)}else if(Ro.versions.node){e.set("Node",`${Ro.versions.node} (${t})`)}}}const Za="1.25.0";const ec=3;function userAgent_getUserAgentString(e){const t=[];for(const[r,n]of e){const e=n?`${r}/${n}`:r;t.push(e)}return t.join(" ")}function userAgent_getUserAgentHeaderName(){return userAgentPlatform_getHeaderName()}async function util_userAgent_getUserAgentValue(e){const t=new Map;t.set("core-rest-pipeline",Za);await util_userAgentPlatform_setPlatformSpecificData(t);const r=userAgent_getUserAgentString(t);const n=e?`${e} ${r}`:r;return n}const tc=userAgent_getUserAgentHeaderName();const rc="userAgentPolicy";function policies_userAgentPolicy_userAgentPolicy(e={}){const t=util_userAgent_getUserAgentValue(e.userAgentPrefix);return{name:rc,async sendRequest(e,r){if(!e.headers.has(tc)){e.headers.set(tc,await t)}return r(e)}}}function createFile(e,t,r={}){return createRawFile(e,t,r)}function file_isNodeReadableStream(e){return typeof e==="object"&&e!==null&&"pipe"in e&&typeof e.pipe==="function"}const nc={arrayBuffer:()=>{throw new Error("Not implemented")},bytes:()=>{throw new Error("Not implemented")},slice:()=>{throw new Error("Not implemented")},text:()=>{throw new Error("Not implemented")}};const sc=Symbol("rawContent");function hasRawContent(e){return typeof e[sc]==="function"}function getRawContent(e){if(hasRawContent(e)){return e[sc]()}else{return e}}function file_createRawFile(e,t,r={}){return{...nc,type:r.type??"",lastModified:r.lastModified??(new Date).getTime(),webkitRelativePath:r.webkitRelativePath??"",size:e.byteLength,name:t,arrayBuffer:async()=>toArrayBuffer(e).buffer,stream:()=>new Blob([toArrayBuffer(e)]).stream(),[sc]:()=>e}}function createFileFromStream(e,t,r={}){return{...nc,type:r.type??"",lastModified:r.lastModified??(new Date).getTime(),webkitRelativePath:r.webkitRelativePath??"",size:r.size??-1,name:t,stream:()=>{const t=e();if(file_isNodeReadableStream(t)){throw new Error("Not supported: a Node stream was provided as input to createFileFromStream.")}return t},[sc]:e}}function hasArrayBuffer(e){return"resize"in e.buffer}function toArrayBuffer(e){if(hasArrayBuffer(e)){if(e.byteOffset!==0||e.byteLength!==e.buffer.byteLength){return new Uint8Array(e)}return e}return e.map((e=>e))}const ic=Fa;function policies_multipartPolicy_multipartPolicy(){const e=multipartPolicy_multipartPolicy();return{name:ic,sendRequest:async(t,r)=>{if(t.multipartBody){for(const e of t.multipartBody.parts){if(hasRawContent(e.body)){e.body=getRawContent(e.body)}}}return e.sendRequest(t,r)}}}const oc=Va;function policies_decompressResponsePolicy_decompressResponsePolicy(){return decompressResponsePolicy_decompressResponsePolicy()}const ac=null&&tspDefaultRetryPolicyName;function policies_defaultRetryPolicy_defaultRetryPolicy(e={}){return defaultRetryPolicy_defaultRetryPolicy(e)}const cc=null&&tspFormDataPolicyName;function policies_formDataPolicy_formDataPolicy(){return formDataPolicy_formDataPolicy()}var lc=__nccwpck_require__(7598);async function computeSha256Hmac(e,t,r){const n=Buffer.from(e,"base64");return createHmac("sha256",n).update(t).digest(r)}async function computeSha256Hash(e,t){return createHash("sha256").update(e).digest(t)}class AbortError_AbortError extends Error{constructor(e){super(e);this.name="AbortError"}}function createAbortablePromise(e,t){const{cleanupBeforeAbort:r,abortSignal:n,abortErrorMsg:s}=t??{};return new Promise(((t,i)=>{function rejectOnAbort(){i(new AbortError_AbortError(s??"The operation was aborted."))}function removeListeners(){n?.removeEventListener("abort",onAbort)}function onAbort(){r?.();removeListeners();rejectOnAbort()}if(n?.aborted){return rejectOnAbort()}try{e((e=>{removeListeners();t(e)}),(e=>{removeListeners();i(e)}))}catch(e){i(e)}n?.addEventListener("abort",onAbort)}))}const Ac="The delay was aborted.";function delay_delay(e,t){let r;const{abortSignal:n,abortErrorMsg:s}=t??{};return createAbortablePromise((t=>{r=setTimeout(t,e)}),{cleanupBeforeAbort:()=>clearTimeout(r),abortSignal:n,abortErrorMsg:s??Ac})}function getErrorMessage(e){if(isError(e)){return e.message}else{let t;try{if(typeof e==="object"&&e){t=JSON.stringify(e)}else{t=String(e)}}catch(e){t="[unable to stringify input]"}return`Unknown error ${t}`}}function esm_calculateRetryDelay(e,t){return tspRuntime.calculateRetryDelay(e,t)}function esm_computeSha256Hash(e,t){return tspRuntime.computeSha256Hash(e,t)}function esm_computeSha256Hmac(e,t,r){return tspRuntime.computeSha256Hmac(e,t,r)}function esm_getRandomIntegerInclusive(e,t){return tspRuntime.getRandomIntegerInclusive(e,t)}function esm_isError(e){return isError(e)}function esm_isObject(e){return tspRuntime.isObject(e)}function esm_randomUUID(){return randomUUID()}const uc=vo;const dc=To;const gc=Fo;const pc=Mo;const hc=Mo;const mc=Po;const fc=Lo;const Cc=ko;function esm_uint8ArrayToString(e,t){return bytesEncoding_uint8ArrayToString(e,t)}function esm_stringToUint8Array(e,t){return bytesEncoding_stringToUint8Array(e,t)}const yc=null&&tspProxyPolicyName;function proxyPolicy_getDefaultProxySettings(e){return getDefaultProxySettings(e)}function policies_proxyPolicy_proxyPolicy(e,t){return proxyPolicy_proxyPolicy(e,t)}const Ec="setClientRequestIdPolicy";function setClientRequestIdPolicy(e="x-ms-client-request-id"){return{name:Ec,async sendRequest(t,r){if(!t.headers.has(e)){t.headers.set(e,t.requestId)}return r(t)}}}const Ic=null&&tspAgentPolicyName;function policies_agentPolicy_agentPolicy(e){return agentPolicy_agentPolicy(e)}const Bc=null&&tspTlsPolicyName;function policies_tlsPolicy_tlsPolicy(e){return tlsPolicy_tlsPolicy(e)}const Qc={span:Symbol.for("@azure/core-tracing span"),namespace:Symbol.for("@azure/core-tracing namespace")};function createTracingContext(e={}){let t=new TracingContextImpl(e.parentContext);if(e.span){t=t.setValue(Qc.span,e.span)}if(e.namespace){t=t.setValue(Qc.namespace,e.namespace)}return t}class TracingContextImpl{_contextMap;constructor(e){this._contextMap=e instanceof TracingContextImpl?new Map(e._contextMap):new Map}setValue(e,t){const r=new TracingContextImpl(this);r._contextMap.set(e,t);return r}getValue(e){return this._contextMap.get(e)}deleteValue(e){const t=new TracingContextImpl(this);t._contextMap.delete(e);return t}}var bc=__nccwpck_require__(9437);const Sc=bc.w;function createDefaultTracingSpan(){return{end:()=>{},isRecording:()=>false,recordException:()=>{},setAttribute:()=>{},setStatus:()=>{},addEvent:()=>{}}}function createDefaultInstrumenter(){return{createRequestHeaders:()=>({}),parseTraceparentHeader:()=>undefined,startSpan:(e,t)=>({span:createDefaultTracingSpan(),tracingContext:createTracingContext({parentContext:t.tracingContext})}),withContext(e,t,...r){return t(...r)}}}function useInstrumenter(e){state.instrumenterImplementation=e}function getInstrumenter(){if(!Sc.instrumenterImplementation){Sc.instrumenterImplementation=createDefaultInstrumenter()}return Sc.instrumenterImplementation}function createTracingClient(e){const{namespace:t,packageName:r,packageVersion:n}=e;function startSpan(e,s,i){const o=getInstrumenter().startSpan(e,{...i,packageName:r,packageVersion:n,tracingContext:s?.tracingOptions?.tracingContext});let a=o.tracingContext;const c=o.span;if(!a.getValue(Qc.namespace)){a=a.setValue(Qc.namespace,t)}c.setAttribute("az.namespace",a.getValue(Qc.namespace));const l=Object.assign({},s,{tracingOptions:{...s?.tracingOptions,tracingContext:a}});return{span:c,updatedOptions:l}}async function withSpan(e,t,r,n){const{span:s,updatedOptions:i}=startSpan(e,t,n);try{const e=await withContext(i.tracingOptions.tracingContext,(()=>r(i,s)));s.setStatus({status:"success"});return e}catch(e){s.setStatus({status:"error",error:e});throw e}finally{s.end()}}function withContext(e,t,...r){return getInstrumenter().withContext(e,t,...r)}function parseTraceparentHeader(e){return getInstrumenter().parseTraceparentHeader(e)}function createRequestHeaders(e){return getInstrumenter().createRequestHeaders(e)}return{startSpan:startSpan,withSpan:withSpan,withContext:withContext,parseTraceparentHeader:parseTraceparentHeader,createRequestHeaders:createRequestHeaders}}const wc=restError_RestError;function esm_restError_isRestError(e){return restError_isRestError(e)}const Dc="tracingPolicy";function tracingPolicy(e={}){const t=util_userAgent_getUserAgentValue(e.userAgentPrefix);const r=new Sanitizer({additionalAllowedQueryParameters:e.additionalAllowedQueryParameters});const n=tryCreateTracingClient();return{name:Dc,async sendRequest(e,s){if(!n){return s(e)}const i=await t;const o={"http.url":r.sanitizeUrl(e.url),"http.method":e.method,"http.user_agent":i,requestId:e.requestId};if(i){o["http.user_agent"]=i}const{span:a,tracingContext:c}=tryCreateSpan(n,e,o)??{};if(!a||!c){return s(e)}try{const t=await n.withContext(c,s,e);tryProcessResponse(a,t);return t}catch(e){tryProcessError(a,e);throw e}}}}function tryCreateTracingClient(){try{return createTracingClient({namespace:"",packageName:"@azure/core-rest-pipeline",packageVersion:Za})}catch(e){za.warning(`Error when creating the TracingClient: ${getErrorMessage(e)}`);return undefined}}function tryCreateSpan(e,t,r){try{const{span:n,updatedOptions:s}=e.startSpan(`HTTP ${t.method}`,{tracingOptions:t.tracingOptions},{spanKind:"client",spanAttributes:r});if(!n.isRecording()){n.end();return undefined}const i=e.createRequestHeaders(s.tracingOptions.tracingContext);for(const[e,r]of Object.entries(i)){t.headers.set(e,r)}return{span:n,tracingContext:s.tracingOptions.tracingContext}}catch(e){za.warning(`Skipping creating a tracing span due to an error: ${getErrorMessage(e)}`);return undefined}}function tryProcessError(e,t){try{e.setStatus({status:"error",error:esm_isError(t)?t:undefined});if(esm_restError_isRestError(t)&&t.statusCode){e.setAttribute("http.status_code",t.statusCode)}e.end()}catch(e){za.warning(`Skipping tracing span processing due to an error: ${getErrorMessage(e)}`)}}function tryProcessResponse(e,t){try{e.setAttribute("http.status_code",t.status);const r=t.headers.get("x-ms-request-id");if(r){e.setAttribute("serviceRequestId",r)}if(t.status>=400){e.setStatus({status:"error"})}e.end()}catch(e){za.warning(`Skipping tracing span processing due to an error: ${getErrorMessage(e)}`)}}function wrapAbortSignalLike(e){if(e instanceof AbortSignal){return{abortSignal:e}}if(e.aborted){return{abortSignal:AbortSignal.abort("reason"in e?e.reason:undefined)}}const t=new AbortController;let r=true;function cleanup(){if(r){e.removeEventListener("abort",listener);r=false}}function listener(){t.abort("reason"in e?e.reason:undefined);cleanup()}e.addEventListener("abort",listener);return{abortSignal:t.signal,cleanup:cleanup}}const Nc="wrapAbortSignalLikePolicy";function wrapAbortSignalLikePolicy(){return{name:Nc,sendRequest:async(e,t)=>{if(!e.abortSignal){return t(e)}const{abortSignal:r,cleanup:n}=wrapAbortSignalLike(e.abortSignal);e.abortSignal=r;try{return await t(e)}finally{n?.()}}}}function esm_createPipelineFromOptions_createPipelineFromOptions(e){const t=esm_pipeline_createEmptyPipeline();if(hc){if(e.agent){t.addPolicy(policies_agentPolicy_agentPolicy(e.agent))}if(e.tlsOptions){t.addPolicy(policies_tlsPolicy_tlsPolicy(e.tlsOptions))}t.addPolicy(policies_proxyPolicy_proxyPolicy(e.proxyOptions));t.addPolicy(policies_decompressResponsePolicy_decompressResponsePolicy())}t.addPolicy(wrapAbortSignalLikePolicy());t.addPolicy(policies_formDataPolicy_formDataPolicy(),{beforePolicies:[ic]});t.addPolicy(policies_userAgentPolicy_userAgentPolicy(e.userAgentOptions));t.addPolicy(setClientRequestIdPolicy(e.telemetryOptions?.clientRequestIdHeaderName));t.addPolicy(policies_multipartPolicy_multipartPolicy(),{afterPhase:"Deserialize"});t.addPolicy(policies_defaultRetryPolicy_defaultRetryPolicy(e.retryOptions),{phase:"Retry"});t.addPolicy(tracingPolicy({...e.userAgentOptions,...e.loggingOptions}),{afterPhase:"Retry"});if(hc){t.addPolicy(policies_redirectPolicy_redirectPolicy(e.redirectOptions),{afterPhase:"Retry"})}t.addPolicy(policies_logPolicy_logPolicy(e.loggingOptions),{afterPhase:"Sign"});return t}function esm_defaultHttpClient_createDefaultHttpClient(){const e=defaultHttpClient_createDefaultHttpClient();return{async sendRequest(t){const{abortSignal:r,cleanup:n}=t.abortSignal?wrapAbortSignalLike(t.abortSignal):{};try{t.abortSignal=r;return await e.sendRequest(t)}finally{n?.()}}}}function esm_httpHeaders_createHttpHeaders(e){return httpHeaders_createHttpHeaders(e)}function esm_pipelineRequest_createPipelineRequest(e){return pipelineRequest_createPipelineRequest(e)}const xc=null&&tspExponentialRetryPolicyName;function exponentialRetryPolicy_exponentialRetryPolicy(e={}){return tspExponentialRetryPolicy(e)}const Rc=null&&tspSystemErrorRetryPolicyName;function systemErrorRetryPolicy_systemErrorRetryPolicy(e={}){return tspSystemErrorRetryPolicy(e)}const vc=null&&tspThrottlingRetryPolicyName;function throttlingRetryPolicy_throttlingRetryPolicy(e={}){return tspThrottlingRetryPolicy(e)}const kc=esm_createClientLogger("core-rest-pipeline retryPolicy");function policies_retryPolicy_retryPolicy(e,t={maxRetries:DEFAULT_RETRY_POLICY_COUNT}){return tspRetryPolicy(e,{logger:kc,...t})}const Fc={forcedRefreshWindowInMs:1e3,retryIntervalInMs:3e3,refreshWindowInMs:1e3*60*2};async function beginRefresh(e,t,r){async function tryGetAccessToken(){if(Date.now()e.getToken(t,a);r=beginRefresh(tryGetAccessToken,i.retryIntervalInMs,n?.expiresOnTimestamp??Date.now()).then((e=>{r=null;n=e;s=a.tenantId;return n})).catch((e=>{r=null;n=null;s=undefined;throw e}))}return r}return async(e,t)=>{const r=Boolean(t.claims);const i=s!==t.tenantId;if(r){n=null}const a=i||r||o.mustRefresh;if(a){return refresh(e,t)}if(o.shouldRefresh){refresh(e,t)}return n}}const Tc="bearerTokenAuthenticationPolicy";async function trySendRequest(e,t){try{return[await t(e),undefined]}catch(e){if(esm_restError_isRestError(e)&&e.response){return[e.response,e]}else{throw e}}}async function defaultAuthorizeRequest(e){const{scopes:t,getAccessToken:r,request:n}=e;const s={abortSignal:n.abortSignal,tracingOptions:n.tracingOptions,enableCae:true};const i=await r(t,s);if(i){e.request.headers.set("Authorization",`Bearer ${i.token}`)}}function isChallengeResponse(e){return e.status===401&&e.headers.has("WWW-Authenticate")}async function authorizeRequestOnCaeChallenge(e,t){const{scopes:r}=e;const n=await e.getAccessToken(r,{enableCae:true,claims:t});if(!n){return false}e.request.headers.set("Authorization",`${n.tokenType??"Bearer"} ${n.token}`);return true}function bearerTokenAuthenticationPolicy(e){const{credential:t,scopes:r,challengeCallbacks:n}=e;const s=e.logger||za;const i={authorizeRequest:n?.authorizeRequest?.bind(n)??defaultAuthorizeRequest,authorizeRequestOnChallenge:n?.authorizeRequestOnChallenge?.bind(n)};const o=t?tokenCycler_createTokenCycler(t):()=>Promise.resolve(null);return{name:Tc,async sendRequest(e,t){if(!e.url.toLowerCase().startsWith("https://")){throw new Error("Bearer token authentication is not permitted for non-TLS protected (non-https) URLs.")}await i.authorizeRequest({scopes:Array.isArray(r)?r:[r],request:e,getAccessToken:o,logger:s});let n;let a;let c;[n,a]=await trySendRequest(e,t);if(isChallengeResponse(n)){let l=getCaeChallengeClaims(n.headers.get("WWW-Authenticate"));if(l){let i;try{i=atob(l)}catch(e){s.warning(`The WWW-Authenticate header contains "claims" that cannot be parsed. Unable to perform the Continuous Access Evaluation authentication flow. Unparsable claims: ${l}`);return n}c=await authorizeRequestOnCaeChallenge({scopes:Array.isArray(r)?r:[r],response:n,request:e,getAccessToken:o,logger:s},i);if(c){[n,a]=await trySendRequest(e,t)}}else if(i.authorizeRequestOnChallenge){c=await i.authorizeRequestOnChallenge({scopes:Array.isArray(r)?r:[r],request:e,response:n,getAccessToken:o,logger:s});if(c){[n,a]=await trySendRequest(e,t)}if(isChallengeResponse(n)){l=getCaeChallengeClaims(n.headers.get("WWW-Authenticate")??"");if(l){let i;try{i=atob(l)}catch(e){s.warning(`The WWW-Authenticate header contains "claims" that cannot be parsed. Unable to perform the Continuous Access Evaluation authentication flow. Unparsable claims: ${l}`);return n}c=await authorizeRequestOnCaeChallenge({scopes:Array.isArray(r)?r:[r],response:n,request:e,getAccessToken:o,logger:s},i);if(c){[n,a]=await trySendRequest(e,t)}}}}}if(a){throw a}else{return n}}}}function parseChallenges(e){const t=/(\w+)\s+((?:\w+=(?:"[^"]*"|[^,]*),?\s*)+)/g;const r=/(\w+)="([^"]*)"/g;const n=[];let s;while((s=t.exec(e))!==null){const e=s[1];const t=s[2];const i={};let o;while((o=r.exec(t))!==null){i[o[1]]=o[2]}n.push({scheme:e,params:i})}return n}function getCaeChallengeClaims(e){if(!e){return}const t=parseChallenges(e);return t.find((e=>e.scheme==="Bearer"&&e.params.claims&&e.params.error==="insufficient_claims"))?.params.claims}const Mc="auxiliaryAuthenticationHeaderPolicy";const Pc="x-ms-authorization-auxiliary";async function sendAuthorizeRequest(e){const{scopes:t,getAccessToken:r,request:n}=e;const s={abortSignal:n.abortSignal,tracingOptions:n.tracingOptions};return(await r(t,s))?.token??""}function auxiliaryAuthenticationHeaderPolicy(e){const{credentials:t,scopes:r}=e;const n=e.logger||coreLogger;const s=new WeakMap;return{name:Mc,async sendRequest(e,i){if(!e.url.toLowerCase().startsWith("https://")){throw new Error("Bearer token authentication for auxiliary header is not permitted for non-TLS protected (non-https) URLs.")}if(!t||t.length===0){n.info(`${Mc} header will not be set due to empty credentials.`);return i(e)}const o=[];for(const i of t){let t=s.get(i);if(!t){t=createTokenCycler(i);s.set(i,t)}o.push(sendAuthorizeRequest({scopes:Array.isArray(r)?r:[r],request:e,getAccessToken:t,logger:n}))}const a=(await Promise.all(o)).filter((e=>Boolean(e)));if(a.length===0){n.warning(`None of the auxiliary tokens are valid. ${Pc} header will not be set.`);return i(e)}e.headers.set(Pc,a.map((e=>`Bearer ${e}`)).join(", "));return i(e)}}}function isKeyCredential(e){return isObjectWithProperties(e,["key"])&&typeof e.key==="string"}class AzureNamedKeyCredential{_key;_name;get key(){return this._key}get name(){return this._name}constructor(e,t){if(!e||!t){throw new TypeError("name and key must be non-empty strings")}this._name=e;this._key=t}update(e,t){if(!e||!t){throw new TypeError("newName and newKey must be non-empty strings")}this._name=e;this._key=t}}function isNamedKeyCredential(e){return isObjectWithProperties(e,["name","key"])&&typeof e.key==="string"&&typeof e.name==="string"}class AzureSASCredential{_signature;get signature(){return this._signature}constructor(e){if(!e){throw new Error("shared access signature must be a non-empty string")}this._signature=e}update(e){if(!e){throw new Error("shared access signature must be a non-empty string")}this._signature=e}}function isSASCredential(e){return isObjectWithProperties(e,["signature"])&&typeof e.signature==="string"}function isTokenCredential(e){const t=e;return t&&typeof t.getToken==="function"&&(t.signRequest===undefined||t.getToken.length>0)}const Lc="DisableKeepAlivePolicy";function createDisableKeepAlivePolicy(){return{name:Lc,sendRequest(e,t){e.disableKeepAlive=true;return t(e)}}}function pipelineContainsDisableKeepAlivePolicy(e){return e.getOrderedPolicies().some((e=>e.name===Lc))}function encodeString(e){return uint8ArrayToString(stringToUint8Array(e,"utf-8"),"base64")}function encodeByteArray(e){return esm_uint8ArrayToString(e,"base64")}function decodeString(e){return esm_stringToUint8Array(e,"base64")}function base64_decodeStringToString(e){return uint8ArrayToString(stringToUint8Array(e,"base64"),"utf-8")}const Uc="$";const Oc="_";function isPrimitiveBody(e,t){return t!=="Composite"&&t!=="Dictionary"&&(typeof e==="string"||typeof e==="number"||typeof e==="boolean"||t?.match(/^(Date|DateTime|DateTimeRfc1123|UnixTime|ByteArray|Base64Url)$/i)!==null||e===undefined||e===null)}const Hc=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function isDuration(e){return Hc.test(e)}const _c=/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/i;function isValidUuid(e){return _c.test(e)}function handleNullableResponseAndWrappableBody(e){const t={...e.headers,...e.body};if(e.hasNullableType&&Object.getOwnPropertyNames(t).length===0){return e.shouldWrapBody?{body:null}:null}else{return e.shouldWrapBody?{...e.headers,body:e.body}:t}}function flattenResponse(e,t){const r=e.parsedHeaders;if(e.request.method==="HEAD"){return{...r,body:e.parsedBody}}const n=t&&t.bodyMapper;const s=Boolean(n?.nullable);const i=n?.type.name;if(i==="Stream"){return{...r,blobBody:e.blobBody,readableStreamBody:e.readableStreamBody}}const o=i==="Composite"&&n.type.modelProperties||{};const a=Object.keys(o).some((e=>o[e].serializedName===""));if(i==="Sequence"||a){const t=e.parsedBody??[];for(const r of Object.keys(o)){if(o[r].serializedName){t[r]=e.parsedBody?.[r]}}if(r){for(const e of Object.keys(r)){t[e]=r[e]}}return s&&!e.parsedBody&&!r&&Object.getOwnPropertyNames(o).length===0?null:t}return handleNullableResponseAndWrappableBody({body:e.parsedBody,headers:r,hasNullableType:s,shouldWrapBody:isPrimitiveBody(e.parsedBody,i)})}class SerializerImpl{modelMappers;isXML;constructor(e={},t=false){this.modelMappers=e;this.isXML=t}validateConstraints(e,t,r){const failValidation=(e,n)=>{throw new Error(`"${r}" with value "${t}" should satisfy the constraint "${e}": ${n}.`)};if(e.constraints&&t!==undefined&&t!==null){const{ExclusiveMaximum:r,ExclusiveMinimum:n,InclusiveMaximum:s,InclusiveMinimum:i,MaxItems:o,MaxLength:a,MinItems:c,MinLength:l,MultipleOf:A,Pattern:u,UniqueItems:d}=e.constraints;if(r!==undefined&&t>=r){failValidation("ExclusiveMaximum",r)}if(n!==undefined&&t<=n){failValidation("ExclusiveMinimum",n)}if(s!==undefined&&t>s){failValidation("InclusiveMaximum",s)}if(i!==undefined&&to){failValidation("MaxItems",o)}if(a!==undefined&&t.length>a){failValidation("MaxLength",a)}if(c!==undefined&&t.lengthr.indexOf(e)!==t))){failValidation("UniqueItems",d)}}}serialize(e,t,r,n={xml:{}}){const s={xml:{rootName:n.xml.rootName??"",includeRoot:n.xml.includeRoot??false,xmlCharKey:n.xml.xmlCharKey??Oc}};let i={};const o=e.type.name;if(!r){r=e.serializedName}if(o.match(/^Sequence$/i)!==null){i=[]}if(e.isConstant){t=e.defaultValue}const{required:a,nullable:c}=e;if(a&&c&&t===undefined){throw new Error(`${r} cannot be undefined.`)}if(a&&!c&&(t===undefined||t===null)){throw new Error(`${r} cannot be null or undefined.`)}if(!a&&c===false&&t===null){throw new Error(`${r} cannot be null.`)}if(t===undefined||t===null){i=t}else{if(o.match(/^any$/i)!==null){i=t}else if(o.match(/^(Number|String|Boolean|Object|Stream|Uuid)$/i)!==null){i=serializeBasicTypes(o,r,t)}else if(o.match(/^Enum$/i)!==null){const n=e;i=serializeEnumType(r,n.type.allowedValues,t)}else if(o.match(/^(Date|DateTime|TimeSpan|DateTimeRfc1123|UnixTime)$/i)!==null){i=serializeDateTypes(o,t,r)}else if(o.match(/^ByteArray$/i)!==null){i=serializeByteArrayType(r,t)}else if(o.match(/^Base64Url$/i)!==null){i=serializeBase64UrlType(r,t)}else if(o.match(/^Sequence$/i)!==null){i=serializeSequenceType(this,e,t,r,Boolean(this.isXML),s)}else if(o.match(/^Dictionary$/i)!==null){i=serializeDictionaryType(this,e,t,r,Boolean(this.isXML),s)}else if(o.match(/^Composite$/i)!==null){i=serializeCompositeType(this,e,t,r,Boolean(this.isXML),s)}}return i}deserialize(e,t,r,n={xml:{}}){const s={xml:{rootName:n.xml.rootName??"",includeRoot:n.xml.includeRoot??false,xmlCharKey:n.xml.xmlCharKey??Oc},ignoreUnknownProperties:n.ignoreUnknownProperties??false};if(t===undefined||t===null){if(this.isXML&&e.type.name==="Sequence"&&!e.xmlIsWrapped){t=[]}if(e.defaultValue!==undefined){t=e.defaultValue}return t}let i;const o=e.type.name;if(!r){r=e.serializedName}if(o.match(/^Composite$/i)!==null){i=deserializeCompositeType(this,e,t,r,s)}else{if(this.isXML){const e=s.xml.xmlCharKey;if(t[Uc]!==undefined&&t[e]!==undefined){t=t[e]}}if(o.match(/^Number$/i)!==null){i=parseFloat(t);if(isNaN(i)){i=t}}else if(o.match(/^Boolean$/i)!==null){if(t==="true"){i=true}else if(t==="false"){i=false}else{i=t}}else if(o.match(/^(String|Enum|Object|Stream|Uuid|TimeSpan|any)$/i)!==null){i=t}else if(o.match(/^(Date|DateTime|DateTimeRfc1123)$/i)!==null){i=new Date(t)}else if(o.match(/^UnixTime$/i)!==null){i=unixTimeToDate(t)}else if(o.match(/^ByteArray$/i)!==null){i=decodeString(t)}else if(o.match(/^Base64Url$/i)!==null){i=base64UrlToByteArray(t)}else if(o.match(/^Sequence$/i)!==null){i=deserializeSequenceType(this,e,t,r,s)}else if(o.match(/^Dictionary$/i)!==null){i=deserializeDictionaryType(this,e,t,r,s)}}if(e.isConstant){i=e.defaultValue}return i}}function createSerializer(e={},t=false){return new SerializerImpl(e,t)}function trimEnd(e,t){let r=e.length;while(r-1>=0&&e[r-1]===t){--r}return e.substr(0,r)}function bufferToBase64Url(e){if(!e){return undefined}if(!(e instanceof Uint8Array)){throw new Error(`Please provide an input of type Uint8Array for converting to Base64Url.`)}const t=encodeByteArray(e);return trimEnd(t,"=").replace(/\+/g,"-").replace(/\//g,"_")}function base64UrlToByteArray(e){if(!e){return undefined}if(e&&typeof e.valueOf()!=="string"){throw new Error("Please provide an input of type string for converting to Uint8Array")}e=e.replace(/-/g,"+").replace(/_/g,"/");return decodeString(e)}function splitSerializeName(e){const t=[];let r="";if(e){const n=e.split(".");for(const e of n){if(e.charAt(e.length-1)==="\\"){r+=e.substr(0,e.length-1)+"."}else{r+=e;t.push(r);r=""}}}return t}function dateToUnixTime(e){if(!e){return undefined}if(typeof e.valueOf()==="string"){e=new Date(e)}return Math.floor(e.getTime()/1e3)}function unixTimeToDate(e){if(!e){return undefined}return new Date(e*1e3)}function serializeBasicTypes(e,t,r){if(r!==null&&r!==undefined){if(e.match(/^Number$/i)!==null){if(typeof r!=="number"){throw new Error(`${t} with value ${r} must be of type number.`)}}else if(e.match(/^String$/i)!==null){if(typeof r.valueOf()!=="string"){throw new Error(`${t} with value "${r}" must be of type string.`)}}else if(e.match(/^Uuid$/i)!==null){if(!(typeof r.valueOf()==="string"&&isValidUuid(r))){throw new Error(`${t} with value "${r}" must be of type string and a valid uuid.`)}}else if(e.match(/^Boolean$/i)!==null){if(typeof r!=="boolean"){throw new Error(`${t} with value ${r} must be of type boolean.`)}}else if(e.match(/^Stream$/i)!==null){const e=typeof r;if(e!=="string"&&typeof r.pipe!=="function"&&typeof r.tee!=="function"&&!(r instanceof ArrayBuffer)&&!ArrayBuffer.isView(r)&&!((typeof Blob==="function"||typeof Blob==="object")&&r instanceof Blob)&&e!=="function"){throw new Error(`${t} must be a string, Blob, ArrayBuffer, ArrayBufferView, ReadableStream, or () => ReadableStream.`)}}}return r}function serializeEnumType(e,t,r){if(!t){throw new Error(`Please provide a set of allowedValues to validate ${e} as an Enum Type.`)}const n=t.some((e=>{if(typeof e.valueOf()==="string"){return e.toLowerCase()===r.toLowerCase()}return e===r}));if(!n){throw new Error(`${r} is not a valid value for ${e}. The valid values are: ${JSON.stringify(t)}.`)}return r}function serializeByteArrayType(e,t){if(t!==undefined&&t!==null){if(!(t instanceof Uint8Array)){throw new Error(`${e} must be of type Uint8Array.`)}t=encodeByteArray(t)}return t}function serializeBase64UrlType(e,t){if(t!==undefined&&t!==null){if(!(t instanceof Uint8Array)){throw new Error(`${e} must be of type Uint8Array.`)}t=bufferToBase64Url(t)}return t}function serializeDateTypes(e,t,r){if(t!==undefined&&t!==null){if(e.match(/^Date$/i)!==null){if(!(t instanceof Date||typeof t.valueOf()==="string"&&!isNaN(Date.parse(t)))){throw new Error(`${r} must be an instanceof Date or a string in ISO8601 format.`)}t=t instanceof Date?t.toISOString().substring(0,10):new Date(t).toISOString().substring(0,10)}else if(e.match(/^DateTime$/i)!==null){if(!(t instanceof Date||typeof t.valueOf()==="string"&&!isNaN(Date.parse(t)))){throw new Error(`${r} must be an instanceof Date or a string in ISO8601 format.`)}t=t instanceof Date?t.toISOString():new Date(t).toISOString()}else if(e.match(/^DateTimeRfc1123$/i)!==null){if(!(t instanceof Date||typeof t.valueOf()==="string"&&!isNaN(Date.parse(t)))){throw new Error(`${r} must be an instanceof Date or a string in RFC-1123 format.`)}t=t instanceof Date?t.toUTCString():new Date(t).toUTCString()}else if(e.match(/^UnixTime$/i)!==null){if(!(t instanceof Date||typeof t.valueOf()==="string"&&!isNaN(Date.parse(t)))){throw new Error(`${r} must be an instanceof Date or a string in RFC-1123/ISO8601 format `+`for it to be serialized in UnixTime/Epoch format.`)}t=dateToUnixTime(t)}else if(e.match(/^TimeSpan$/i)!==null){if(!isDuration(t)){throw new Error(`${r} must be a string in ISO 8601 format. Instead was "${t}".`)}}}return t}function serializeSequenceType(e,t,r,n,s,i){if(!Array.isArray(r)){throw new Error(`${n} must be of type Array.`)}let o=t.type.element;if(!o||typeof o!=="object"){throw new Error(`"element" metadata for an Array must be defined in the `+`mapper and it must be of type "object" in ${n}.`)}if(o.type.name==="Composite"&&o.type.className){o=e.modelMappers[o.type.className]??o}const a=[];for(let t=0;te!==s));if(a){Object.defineProperty(o,s,{value:e.serialize(c,r[s],n+'["'+s+'"]',i),enumerable:true,configurable:true,writable:true})}}}return o}return r}function getXmlObjectValue(e,t,r,n){if(!r||!e.xmlNamespace){return t}const s=e.xmlNamespacePrefix?`xmlns:${e.xmlNamespacePrefix}`:"xmlns";const i={[s]:e.xmlNamespace};if(["Composite"].includes(e.type.name)){if(t[Uc]){return t}else{const e={...t};e[Uc]=i;return e}}const o={};o[n.xml.xmlCharKey]=t;o[Uc]=i;return o}function isSpecialXmlProperty(e,t){return[Uc,t.xml.xmlCharKey].includes(e)}function deserializeCompositeType(e,t,r,n,s){const i=s.xml.xmlCharKey??Oc;if(getPolymorphicDiscriminatorRecursively(e,t)){t=getPolymorphicMapper(e,t,r,"serializedName")}const o=resolveModelProperties(e,t,n);let a={};const c=[];for(const l of Object.keys(o)){const A=o[l];const u=splitSerializeName(o[l].serializedName);c.push(u[0]);const{serializedName:d,xmlName:g,xmlElementName:p}=A;let h=n;if(d!==""&&d!==undefined){h=n+"."+d}const m=A.headerCollectionPrefix;if(m){const t={};for(const n of Object.keys(r)){if(n.startsWith(m)){t[n.substring(m.length)]=e.deserialize(A.type.value,r[n],h,s)}c.push(n)}a[l]=t}else if(e.isXML){if(A.xmlIsAttribute&&r[Uc]){a[l]=e.deserialize(A,r[Uc][g],h,s)}else if(A.xmlIsMsText){if(r[i]!==undefined){a[l]=r[i]}else if(typeof r==="string"){a[l]=r}}else{const t=p||g||d;if(A.xmlIsWrapped){const t=r[g];const n=t?.[p]??[];Object.defineProperty(a,l,{value:e.deserialize(A,n,h,s),enumerable:true,configurable:true,writable:true});c.push(g)}else{const n=r[t];a[l]=e.deserialize(A,n,h,s);c.push(t)}}}else{let n;let i=r;let c=0;for(const e of u){if(!i)break;c++;i=i[e]}if(i===null&&c{for(const t of Object.keys(o)){const r=splitSerializeName(o[t].serializedName);if(r[0]===e){return false}}return true};for(const t of Object.keys(r)){if(isAdditionalProperty(t)){const i=e.deserialize(l,r[t],n+'["'+t+'"]',s);Object.defineProperty(a,t,{value:i,enumerable:true,configurable:true,writable:true})}}}else if(r&&!s.ignoreUnknownProperties){for(const e of Object.keys(r)){if(a[e]===undefined&&!c.includes(e)&&!isSpecialXmlProperty(e,s)){Object.defineProperty(a,e,{value:r[e],enumerable:true,configurable:true,writable:true})}}}return a}function deserializeDictionaryType(e,t,r,n,s){const i=t.type.value;if(!i||typeof i!=="object"){throw new Error(`"value" metadata for a Dictionary must be defined in the `+`mapper and it must of type "object" in ${n}`)}if(r){const t={};for(const o of Object.keys(r)){t[o]=e.deserialize(i,r[o],n,s)}return t}return r}function deserializeSequenceType(e,t,r,n,s){let i=t.type.element;if(!i||typeof i!=="object"){throw new Error(`"element" metadata for an Array must be defined in the `+`mapper and it must be of type "object" in ${n}`)}if(r){if(!Array.isArray(r)){r=[r]}if(i.type.name==="Composite"&&i.type.className){i=e.modelMappers[i.type.className]??i}const t=[];for(let o=0;o0){if(s.isConstant){i=s.defaultValue}else{let t=getPropertyFromParameterPath(e,n);if(!t.propertyFound&&r){t=getPropertyFromParameterPath(r,n)}let o=false;if(!t.propertyFound){o=s.required||n[0]==="options"&&n.length===2}i=o?s.defaultValue:t.propertyValue}}}else{if(s.required){i={}}for(const[t,o]of Object.entries(n)){const n=s.type.modelProperties[t];const a=getOperationArgumentValueFromParameter(e,{parameterPath:o,mapper:n},r);if(a!==undefined){if(!i){i={}}Object.defineProperty(i,t,{value:a,enumerable:true,configurable:true,writable:true})}}}return i}function getPropertyFromParameterPath(e,t){const r={propertyFound:false};let n=0;for(;n=200&&r.status<300}if(c.headersMapper){i.parsedHeaders=a.serializer.deserialize(c.headersMapper,i.headers.toJSON(),"operationRes.parsedHeaders",{xml:{},ignoreUnknownProperties:true})}}return i}function isOperationSpecEmpty(e){const t=Object.keys(e.responses);return t.length===0||t.length===1&&t[0]==="default"}function handleErrorResponse(e,t,r,n){const s=200<=e.status&&e.status<300;const i=isOperationSpecEmpty(t)?s:!!r;if(i){if(r){if(!r.isError){return{error:null,shouldReturnResponse:false}}}else{return{error:null,shouldReturnResponse:false}}}const o=r??t.responses.default;const a=e.request.streamResponseStatusCodes?.has(e.status)?`Unexpected status code: ${e.status}`:e.bodyAsText;const c=new wc(a,{statusCode:e.status,request:e.request,response:e});if(!o&&!(e.parsedBody?.error?.code&&e.parsedBody?.error?.message)){throw c}const l=o?.bodyMapper;const A=o?.headersMapper;try{if(e.parsedBody){const r=e.parsedBody;let s;if(l){let e=r;if(t.isXML&&l.type.name===qc.Sequence){e=[];const t=l.xmlElementName;if(typeof r==="object"&&t){e=r[t]}}s=t.serializer.deserialize(l,e,"error.response.parsedBody",n)}const i=r.error||s||r;c.code=i.code;if(i.message){c.message=i.message}if(l){c.response.parsedBody=s}}if(e.headers&&A){c.response.parsedHeaders=t.serializer.deserialize(A,e.headers.toJSON(),"operationRes.parsedHeaders")}}catch(t){c.message=`Error "${t.message}" occurred in deserializing the responseBody - "${e.bodyAsText}" for the default response.`}return{error:c,shouldReturnResponse:false}}async function parse(e,t,r,n,s){if(!r.request.streamResponseStatusCodes?.has(r.status)&&r.bodyAsText){const i=r.bodyAsText;const o=r.headers.get("Content-Type")||"";const a=!o?[]:o.split(";").map((e=>e.toLowerCase()));try{if(a.length===0||a.some((t=>e.indexOf(t)!==-1))){r.parsedBody=JSON.parse(i);return r}else if(a.some((e=>t.indexOf(e)!==-1))){if(!s){throw new Error("Parsing XML not supported.")}const e=await s(i,n.xml);r.parsedBody=e;return r}}catch(e){const t=`Error "${e}" occurred while parsing the response body - ${r.bodyAsText}.`;const n=e.code||wc.PARSE_ERROR;const s=new wc(t,{code:n,statusCode:r.status,request:r.request,response:r});throw s}}return r}function getStreamingResponseStatusCodes(e){const t=new Set;for(const[r,n]of Object.entries(e.responses)){if(n.bodyMapper&&n.bodyMapper.type.name===qc.Stream){t.add(Number(r))}}return t}function getPathStringFromParameter(e){const{parameterPath:t,mapper:r}=e;let n;if(typeof t==="string"){n=t}else if(Array.isArray(t)){n=t.join(".")}else{n=r.serializedName}return n}const jc="serializationPolicy";function serializationPolicy(e={}){const t=e.stringifyXML;return{name:jc,sendRequest(e,r){const n=getOperationRequestInfo(e);const s=n?.operationSpec;const i=n?.operationArguments;if(s&&i){serializeHeaders(e,i,s);serializeRequestBody(e,i,s,t)}return r(e)}}}function serializeHeaders(e,t,r){if(r.headerParameters){for(const n of r.headerParameters){let s=getOperationArgumentValueFromParameter(t,n);if(s!==null&&s!==undefined||n.mapper.required){s=r.serializer.serialize(n.mapper,s,getPathStringFromParameter(n));const t=n.mapper.headerCollectionPrefix;if(t){for(const r of Object.keys(s)){e.headers.set(t+r,s[r])}}else{e.headers.set(n.mapper.serializedName||getPathStringFromParameter(n),s)}}}}const n=t.options?.requestOptions?.customHeaders;if(n){for(const t of Object.keys(n)){e.headers.set(t,n[t])}}}function serializeRequestBody(e,t,r,n=function(){throw new Error("XML serialization unsupported!")}){const s=t.options?.serializerOptions;const i={xml:{rootName:s?.xml.rootName??"",includeRoot:s?.xml.includeRoot??false,xmlCharKey:s?.xml.xmlCharKey??Oc}};const o=i.xml.xmlCharKey;if(r.requestBody&&r.requestBody.mapper){e.body=getOperationArgumentValueFromParameter(t,r.requestBody);const s=r.requestBody.mapper;const{required:a,serializedName:c,xmlName:l,xmlElementName:A,xmlNamespace:u,xmlNamespacePrefix:d,nullable:g}=s;const p=s.type.name;try{if(e.body!==undefined&&e.body!==null||g&&e.body===null||a){const t=getPathStringFromParameter(r.requestBody);e.body=r.serializer.serialize(s,e.body,t,i);const a=p===qc.Stream;if(r.isXML){const t=d?`xmlns:${d}`:"xmlns";const r=getXmlValueWithNamespace(u,t,p,e.body,i);if(p===qc.Sequence){e.body=n(prepareXMLRootList(r,A||l||c,t,u),{rootName:l||c,xmlCharKey:o})}else if(!a){e.body=n(r,{rootName:l||c,xmlCharKey:o})}}else if(p===qc.String&&(r.contentType?.match("text/plain")||r.mediaType==="text")){return}else if(!a){e.body=JSON.stringify(e.body)}}}catch(e){throw new Error(`Error "${e.message}" occurred in serializing the payload - ${JSON.stringify(c,undefined," ")}.`)}}else if(r.formDataParameters&&r.formDataParameters.length>0){e.formData={};for(const n of r.formDataParameters){const s=getOperationArgumentValueFromParameter(t,n);if(s!==undefined&&s!==null){const t=n.mapper.serializedName||getPathStringFromParameter(n);e.formData[t]=r.serializer.serialize(n.mapper,s,getPathStringFromParameter(n),i)}}}}function getXmlValueWithNamespace(e,t,r,n,s){if(e&&!["Composite","Sequence","Dictionary"].includes(r)){const r={};r[s.xml.xmlCharKey]=n;r[Uc]={[t]:e};return r}return n}function prepareXMLRootList(e,t,r,n){if(!Array.isArray(e)){e=[e]}if(!r||!n){return{[t]:e}}const s={[t]:e};s[Uc]={[r]:n};return s}function createClientPipeline(e={}){const t=esm_createPipelineFromOptions_createPipelineFromOptions(e??{});if(e.credentialOptions){t.addPolicy(bearerTokenAuthenticationPolicy({credential:e.credentialOptions.credential,scopes:e.credentialOptions.credentialScopes}))}t.addPolicy(serializationPolicy(e.serializationOptions),{phase:"Serialize"});t.addPolicy(deserializationPolicy(e.deserializationOptions),{phase:"Deserialize"});return t}let Kc;function getCachedDefaultHttpClient(){if(!Kc){Kc=esm_defaultHttpClient_createDefaultHttpClient()}return Kc}const $c={CSV:",",SSV:" ",Multi:"Multi",TSV:"\t",Pipes:"|"};function getRequestUrl(e,t,r,n){const s=calculateUrlReplacements(t,r,n);let i=false;let o=replaceAll(e,s);if(t.path){let e=replaceAll(t.path,s);if(t.path==="/{nextLink}"&&e.startsWith("/")){e=e.substring(1)}if(isAbsoluteUrl(e)){o=e;i=true}else{o=appendPath(o,e)}}const{queryParams:a,sequenceParams:c}=calculateQueryParameters(t,r,n);o=appendQueryParams(o,a,c,i);return o}function replaceAll(e,t){let r=e;for(const[e,n]of t){r=r.split(e).join(n)}return r}function calculateUrlReplacements(e,t,r){const n=new Map;if(e.urlParameters?.length){for(const s of e.urlParameters){let i=getOperationArgumentValueFromParameter(t,s,r);const o=getPathStringFromParameter(s);i=e.serializer.serialize(s.mapper,i,o);if(!s.skipEncoding){i=encodeURIComponent(i)}n.set(`{${s.mapper.serializedName||o}}`,i)}}return n}function isAbsoluteUrl(e){return e.includes("://")}function appendPath(e,t){if(!t){return e}const r=new URL(e);let n=r.pathname;if(!n.endsWith("/")){n=`${n}/`}if(t.startsWith("/")){t=t.substring(1)}const s=t.indexOf("?");if(s!==-1){const e=t.substring(0,s);const i=t.substring(s+1);n=n+e;if(i){r.search=r.search?`${r.search}&${i}`:i}}else{n=n+t}Object.assign(r,{pathname:n});return r.toString()}function calculateQueryParameters(e,t,r){const n=new Map;const s=new Set;if(e.queryParameters?.length){for(const i of e.queryParameters){if(i.mapper.type.name==="Sequence"&&i.mapper.serializedName){s.add(i.mapper.serializedName)}let o=getOperationArgumentValueFromParameter(t,i,r);if(o!==undefined&&o!==null||i.mapper.required){o=e.serializer.serialize(i.mapper,o,getPathStringFromParameter(i));const t=i.collectionFormat?$c[i.collectionFormat]:"";if(Array.isArray(o)){o=o.map((e=>{if(e===null||e===undefined){return""}return e}))}if(i.collectionFormat==="Multi"&&o.length===0){continue}else if(Array.isArray(o)&&(i.collectionFormat==="SSV"||i.collectionFormat==="TSV")){o=o.join(t)}if(!i.skipEncoding){if(Array.isArray(o)){o=o.map((e=>encodeURIComponent(e)))}else{o=encodeURIComponent(o)}}if(Array.isArray(o)&&(i.collectionFormat==="CSV"||i.collectionFormat==="Pipes")){o=o.join(t)}n.set(i.mapper.serializedName||getPathStringFromParameter(i),o)}}}return{queryParams:n,sequenceParams:s}}function simpleParseQueryParams(e){const t=new Map;if(!e||e[0]!=="?"){return t}e=e.slice(1);const r=e.split("&");for(const e of r){const[r,n]=e.split("=",2);const s=t.get(r);if(s){if(Array.isArray(s)){s.push(n)}else{t.set(r,[s,n])}}else{t.set(r,n)}}return t}function appendQueryParams(e,t,r,n=false){if(t.size===0){return e}const s=new URL(e);const i=simpleParseQueryParams(s.search);for(const[e,s]of t){const t=i.get(e);if(Array.isArray(t)){if(Array.isArray(s)){t.push(...s);const r=new Set(t);i.set(e,Array.from(r))}else{t.push(s)}}else if(t){if(Array.isArray(s)){s.unshift(t)}else if(r.has(e)){i.set(e,[t,s])}if(!n){i.set(e,s)}}else{i.set(e,s)}}const o=[];for(const[e,t]of i){if(typeof t==="string"){o.push(`${e}=${t}`)}else if(Array.isArray(t)){for(const r of t){o.push(`${e}=${r}`)}}else{o.push(`${e}=${t}`)}}s.search=o.length?`?${o.join("&")}`:"";return s.toString()}const Xc=esm_createClientLogger("core-client");class ServiceClient{_endpoint;_requestContentType;_allowInsecureConnection;_httpClient;pipeline;constructor(e={}){this._requestContentType=e.requestContentType;this._endpoint=e.endpoint??e.baseUri;if(e.baseUri){Xc.warning("The baseUri option for SDK Clients has been deprecated, please use endpoint instead.")}this._allowInsecureConnection=e.allowInsecureConnection;this._httpClient=e.httpClient||getCachedDefaultHttpClient();this.pipeline=e.pipeline||serviceClient_createDefaultPipeline(e);if(e.additionalPolicies?.length){for(const{policy:t,position:r}of e.additionalPolicies){const e=r==="perRetry"?"Sign":undefined;this.pipeline.addPolicy(t,{afterPhase:e})}}}sendRequest(e){return this.pipeline.sendRequest(this._httpClient,e)}async sendOperationRequest(e,t){const r=t.baseUrl||this._endpoint;if(!r){throw new Error("If operationSpec.baseUrl is not specified, then the ServiceClient must have a endpoint string property that contains the base URL to use.")}const n=getRequestUrl(r,t,e,this);const s=esm_pipelineRequest_createPipelineRequest({url:n});s.method=t.httpMethod;const i=getOperationRequestInfo(s);i.operationSpec=t;i.operationArguments=e;const o=t.contentType||this._requestContentType;if(o&&t.requestBody){s.headers.set("Content-Type",o)}const a=e.options;if(a){const e=a.requestOptions;if(e){if(e.timeout){s.timeout=e.timeout}if(e.onUploadProgress){s.onUploadProgress=e.onUploadProgress}if(e.onDownloadProgress){s.onDownloadProgress=e.onDownloadProgress}if(e.shouldDeserialize!==undefined){i.shouldDeserialize=e.shouldDeserialize}if(e.allowInsecureConnection){s.allowInsecureConnection=true}}if(a.abortSignal){s.abortSignal=a.abortSignal}if(a.tracingOptions){s.tracingOptions=a.tracingOptions}}if(this._allowInsecureConnection){s.allowInsecureConnection=true}if(s.streamResponseStatusCodes===undefined){s.streamResponseStatusCodes=getStreamingResponseStatusCodes(t)}try{const e=await this.sendRequest(s);const r=flattenResponse(e,t.responses[e.status]);if(a?.onResponse){a.onResponse(e,r)}return r}catch(e){if(typeof e==="object"&&e?.response){const r=e.response;const n=flattenResponse(r,t.responses[e.statusCode]||t.responses["default"]);e.details=n;if(a?.onResponse){a.onResponse(r,n,e)}}throw e}}}function serviceClient_createDefaultPipeline(e){const t=getCredentialScopes(e);const r=e.credential&&t?{credentialScopes:t,credential:e.credential}:undefined;return createClientPipeline({...e,credentialOptions:r})}function getCredentialScopes(e){if(e.credentialScopes){return e.credentialScopes}if(e.endpoint){return`${e.endpoint}/.default`}if(e.baseUri){return`${e.baseUri}/.default`}if(e.credential){throw new Error(`When using credentials, the ServiceClientOptions must contain either a endpoint or a credentialScopes. Unable to create a bearerTokenAuthenticationPolicy`)}return undefined}function parseCAEChallenge(e){const t=`, ${e.trim()}`.split(", Bearer ").filter((e=>e));return t.map((e=>{const t=`${e.trim()}, `.split('", ').filter((e=>e));const r=t.map((e=>(([e,t])=>({[e]:t}))(e.trim().split('="'))));return r.reduce(((e,t)=>({...e,...t})),{})}))}async function authorizeRequestOnClaimChallenge(e){const{scopes:t,response:r}=e;const n=e.logger||coreClientLogger;const s=r.headers.get("WWW-Authenticate");if(!s){n.info(`The WWW-Authenticate header was missing. Failed to perform the Continuous Access Evaluation authentication flow.`);return false}const i=parseCAEChallenge(s)||[];const o=i.find((e=>e.claims));if(!o){n.info(`The WWW-Authenticate header was missing the necessary "claims" to perform the Continuous Access Evaluation authentication flow.`);return false}const a=await e.getAccessToken(o.scope?[o.scope]:t,{claims:decodeStringToString(o.claims)});if(!a){return false}e.request.headers.set("Authorization",`${a.tokenType??"Bearer"} ${a.token}`);return true}const Zc={DefaultScope:"/.default",HeaderConstants:{AUTHORIZATION:"authorization"}};function isUuid(e){return/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/.test(e)}const authorizeRequestOnTenantChallenge=async e=>{const t=requestToOptions(e.request);const r=getChallenge(e.response);if(r){const n=parseChallenge(r);const s=buildScopes(e,n);const i=extractTenantId(n);if(!i){return false}const o=await e.getAccessToken(s,{...t,tenantId:i});if(!o){return false}e.request.headers.set(Zc.HeaderConstants.AUTHORIZATION,`${o.tokenType??"Bearer"} ${o.token}`);return true}return false};function extractTenantId(e){const t=new URL(e.authorization_uri);const r=t.pathname.split("/");const n=r[1];if(n&&isUuid(n)){return n}return undefined}function buildScopes(e,t){if(!t.resource_id){return e.scopes}const r=new URL(t.resource_id);let n=new URL(Zc.DefaultScope,r.origin).toString();if(n==="https://disk.azure.com/.default"){n="https://disk.azure.com//.default"}return[n]}function getChallenge(e){const t=e.headers.get("WWW-Authenticate");if(e.status===401&&t){return t}return}function parseChallenge(e){const t=e.slice("Bearer ".length);const r=`${t.trim()} `.split(" ").filter((e=>e));const n=r.map((e=>(([e,t])=>({[e]:t}))(e.trim().split("="))));return n.reduce(((e,t)=>({...e,...t})),{})}function requestToOptions(e){return{abortSignal:e.abortSignal,requestOptions:{timeout:e.timeout},tracingOptions:e.tracingOptions}}const el=Symbol("Original PipelineRequest");const tl=Symbol.for("@azure/core-client original request");const rl=new Set(["url","method","withCredentials","timeout","requestId","abortSignal","body","formData","onDownloadProgress","onUploadProgress","proxySettings","streamResponseStatusCodes","agent","requestOverrides"]);function toPipelineRequest(e,t={}){const r=e;const n=r[el];const s=esm_httpHeaders_createHttpHeaders(e.headers.toJson({preserveCase:true}));if(n){n.headers=s;return n}else{const r=esm_pipelineRequest_createPipelineRequest({url:e.url,method:e.method,headers:s,withCredentials:e.withCredentials,timeout:e.timeout,requestId:e.requestId,abortSignal:e.abortSignal,body:e.body,formData:e.formData,disableKeepAlive:!!e.keepAlive,onDownloadProgress:e.onDownloadProgress,onUploadProgress:e.onUploadProgress,proxySettings:e.proxySettings,streamResponseStatusCodes:e.streamResponseStatusCodes,agent:e.agent,requestOverrides:e.requestOverrides});if(t.originalRequest){r[tl]=t.originalRequest}return r}}function toWebResourceLike(e,t){const r=t?.originalRequest??e;const n={url:e.url,method:e.method,headers:toHttpHeadersLike(e.headers),withCredentials:e.withCredentials,timeout:e.timeout,requestId:e.headers.get("x-ms-client-request-id")||e.requestId,abortSignal:e.abortSignal,body:e.body,formData:e.formData,keepAlive:!!e.disableKeepAlive,onDownloadProgress:e.onDownloadProgress,onUploadProgress:e.onUploadProgress,proxySettings:e.proxySettings,streamResponseStatusCodes:e.streamResponseStatusCodes,agent:e.agent,requestOverrides:e.requestOverrides,clone(){throw new Error("Cannot clone a non-proxied WebResourceLike")},prepare(){throw new Error("WebResourceLike.prepare() is not supported by @azure/core-http-compat")},validateRequestProperties(){}};if(t?.createProxy){return new Proxy(n,{get(t,s,i){if(s===el){return e}else if(s==="clone"){return()=>toWebResourceLike(toPipelineRequest(n,{originalRequest:r}),{createProxy:true,originalRequest:r})}return Reflect.get(t,s,i)},set(t,r,n,s){if(r==="keepAlive"){e.disableKeepAlive=!n}if(typeof r==="string"&&rl.has(r)){e[r]=n}return Reflect.set(t,r,n,s)}})}else{return n}}function toHttpHeadersLike(e){return new HttpHeaders(e.toJSON({preserveCase:true}))}function getHeaderKey(e){return e.toLowerCase()}class HttpHeaders{_headersMap;constructor(e){this._headersMap={};if(e){for(const t in e){this.set(t,e[t])}}}set(e,t){this._headersMap[getHeaderKey(e)]={name:e,value:t.toString()}}get(e){const t=this._headersMap[getHeaderKey(e)];return!t?undefined:t.value}contains(e){return!!this._headersMap[getHeaderKey(e)]}remove(e){const t=this.contains(e);delete this._headersMap[getHeaderKey(e)];return t}rawHeaders(){return this.toJson({preserveCase:true})}headersArray(){const e=[];for(const t in this._headersMap){e.push(this._headersMap[t])}return e}headerNames(){const e=[];const t=this.headersArray();for(let r=0;r{const r=await e.sendRequest(toWebResourceLike(t,{createProxy:true}));return response_toPipelineResponse(r)}}}class Expression{constructor(e,t={},r){this.pattern=e;this.separator=t.separator||".";this.segments=this._parse(e);this.data=r;this._hasDeepWildcard=this.segments.some((e=>e.type==="deep-wildcard"));this._hasAttributeCondition=this.segments.some((e=>e.attrName!==undefined));this._hasPositionSelector=this.segments.some((e=>e.position!==undefined))}_parse(e){const t=[];let r=0;let n="";while(r0?e[e.length-1].tag:undefined}getCurrentNamespace(){const e=this._matcher.path;return e.length>0?e[e.length-1].namespace:undefined}getAttrValue(e){const t=this._matcher.path;if(t.length===0)return undefined;return t[t.length-1].values?.[e]}hasAttr(e){const t=this._matcher.path;if(t.length===0)return false;const r=t[t.length-1];return r.values!==undefined&&e in r.values}getAnyParentAttr(e){return this._matcher.getAnyParentAttr(e)}hasAnyParentAttr(e){return this._matcher.hasAnyParentAttr(e)}getPosition(){const e=this._matcher.path;if(e.length===0)return-1;return e[e.length-1].position??0}getCounter(){const e=this._matcher.path;if(e.length===0)return-1;return e[e.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this._matcher.path.length}toString(e,t=true){return this._matcher.toString(e,t)}toArray(){return this._matcher.path.map((e=>e.tag))}matches(e){return this._matcher.matches(e)}matchesAny(e){return e.matchesAny(this._matcher)}}class Matcher{constructor(e={}){this.separator=e.separator||".";this.path=[];this.siblingStacks=[];this._pathStringCache=null;this._view=new MatcherView(this);this._keptAttrs=[]}push(e,t=null,r=null,n=null){this._pathStringCache=null;if(this.path.length>0){this.path[this.path.length-1].values=undefined}const s=this.path.length;let i=this.siblingStacks[s];if(!i){i={counts:new Map,total:0};this.siblingStacks[s]=i}const o=r?`${r}:${e}`:e;const a=i.counts.get(o)||0;const c=i.total;i.counts.set(o,a+1);i.total++;const l={tag:e,position:c,counter:a};if(r!==null&&r!==undefined){l.namespace=r}if(t!==null&&t!==undefined){l.values=t}this.path.push(l);const A=this.path.length;const u=n!==null?n.keep:null;if(u!==null&&u!==undefined&&u.length>0&&t){for(let e=0;ethis.path.length+1){this.siblingStacks.length=this.path.length+1}const t=this.path.length+1;while(this._keptAttrs.length>0&&this._keptAttrs[this._keptAttrs.length-1].depth>=t){this._keptAttrs.pop()}return e}updateCurrent(e){if(this.path.length>0){const t=this.path[this.path.length-1];if(e!==null&&e!==undefined){t.values=e}}}getCurrentTag(){return this.path.length>0?this.path[this.path.length-1].tag:undefined}getCurrentNamespace(){return this.path.length>0?this.path[this.path.length-1].namespace:undefined}getAttrValue(e){if(this.path.length===0)return undefined;return this.path[this.path.length-1].values?.[e]}hasAttr(e){if(this.path.length===0)return false;const t=this.path[this.path.length-1];return t.values!==undefined&&e in t.values}getAnyParentAttr(e){const t=this._keptAttrs;for(let r=t.length-1;r>=0;r--){if(t[r].name===e)return t[r].value}return undefined}hasAnyParentAttr(e){const t=this._keptAttrs;for(let r=t.length-1;r>=0;r--){if(t[r].name===e)return true}return false}getPosition(){if(this.path.length===0)return-1;return this.path[this.path.length-1].position??0}getCounter(){if(this.path.length===0)return-1;return this.path[this.path.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this.path.length}toString(e,t=true){const r=e||this.separator;const n=r===this.separator&&t===true;if(n){if(this._pathStringCache!==null){return this._pathStringCache}const e=this.path.map((e=>e.namespace?`${e.namespace}:${e.tag}`:e.tag)).join(r);this._pathStringCache=e;return e}return this.path.map((e=>t&&e.namespace?`${e.namespace}:${e.tag}`:e.tag)).join(r)}toArray(){return this.path.map((e=>e.tag))}reset(){this._pathStringCache=null;this.path=[];this.siblingStacks=[];this._keptAttrs=[]}matches(e){const t=e.segments;if(t.length===0){return false}if(e.hasDeepWildcard()){return this._matchWithDeepWildcard(t)}return this._matchSimple(t)}_matchSimple(e){if(this.path.length!==e.length){return false}for(let t=0;t=0&&t>=0){const n=e[r];if(n.type==="deep-wildcard"){r--;if(r<0){return true}const n=e[r];let s=false;for(let e=t;e>=0;e--){if(this._matchSegment(n,this.path[e],e===this.path.length-1)){t=e-1;r--;s=true;break}}if(!s){return false}}else{if(!this._matchSegment(n,this.path[t],t===this.path.length-1)){return false}t--;r--}}return r<0}_matchSegment(e,t,r){if(e.tag!=="*"&&e.tag!==t.tag){return false}if(e.namespace!==undefined){if(e.namespace!=="*"&&e.namespace!==t.namespace){return false}}if(e.attrName!==undefined){if(!r){return false}if(!t.values||!(e.attrName in t.values)){return false}if(e.attrValue!==undefined){if(String(t.values[e.attrName])!==String(e.attrValue)){return false}}}if(e.position!==undefined){if(!r){return false}const n=t.counter??0;if(e.position==="first"&&n!==0){return false}else if(e.position==="odd"&&n%2!==1){return false}else if(e.position==="even"&&n%2!==0){return false}else if(e.position==="nth"&&n!==e.positionValue){return false}}return true}matchesAny(e){return e.matchesAny(this)}snapshot(){return{path:this.path.map((e=>({...e}))),siblingStacks:this.siblingStacks.map((e=>e?{counts:new Map(e.counts),total:e.total}:e)),keptAttrs:this._keptAttrs.map((e=>({...e})))}}restore(e){this._pathStringCache=null;this.path=e.path.map((e=>({...e})));this.siblingStacks=e.siblingStacks.map((e=>e?{counts:new Map(e.counts),total:e.total}:e));this._keptAttrs=(e.keptAttrs||[]).map((e=>({...e})))}readOnly(){return this._view}}function valToStr(e){return typeof e==="number"&&Object.is(e,-0)?"-0":String(e)}function safeComment(e){return valToStr(e).replace(/--/g,"- -").replace(/--/g,"- -").replace(/-$/,"- ")}function safeCdata(e){return valToStr(e).replace(/\]\]>/g,"]]]]>")}function escapeAttribute(e){return valToStr(e).replace(/"/g,""").replace(/'/g,"'")}const al=":A-Za-z_"+"À-ÖØ-öø-˿"+"Ͱ-ͽ"+"Ϳ-҆҈-῿"+"‌-‍"+"⁰-↏"+"Ⰰ-⿯"+"、-퟿"+"豈-﷏"+"ﷰ-�";const cl=al+"\\-\\.\\d"+"·"+"̀-ͯ"+"‿-⁀";const ll=":A-Za-z_"+"À-˿"+"Ͱ-ͽ"+"Ϳ-҆҈-῿"+"‌-‍"+"⁰-↏"+"Ⰰ-⿯"+"、-퟿"+"豈-﷏"+"ﷰ-�"+"𐀀-󯿿";const Al=ll+"\\-\\.\\d"+"·"+"̀-ͯ"+"҇"+"‿-⁀";const buildRegexes=(e,t,r="")=>{const n=e.replace(":","");const s=t.replace(":","");const i=`[${n}][${s}]*`;return{name:new RegExp(`^[${e}][${t}]*$`,r),ncName:new RegExp(`^${i}$`,r),qName:new RegExp(`^${i}(?::${i})?$`,r),nmToken:new RegExp(`^[${t}]+$`,r),nmTokens:new RegExp(`^[${t}]+(?:\\s+[${t}]+)*$`,r)}};const ul=buildRegexes(al,cl);const dl=buildRegexes(ll,Al,"u");const gl=":A-Za-z_";const pl=gl+"\\-\\.\\d";const hl=buildRegexes(gl,pl);const getRegexes=(e="1.0",t=false)=>{if(t)return hl;return e==="1.1"?dl:ul};const src_name=(e,{xmlVersion:t="1.0",asciiOnly:r=false}={})=>getRegexes(t,r).name.test(e);const ncName=(e,{xmlVersion:t="1.0",asciiOnly:r=false}={})=>getRegexes(t,r).ncName.test(e);const qName=(e,{xmlVersion:t="1.0",asciiOnly:r=false}={})=>getRegexes(t,r).qName.test(e);const nmToken=(e,{xmlVersion:t="1.0",asciiOnly:r=false}={})=>getRegexes(t,r).nmToken.test(e);const nmTokens=(e,{xmlVersion:t="1.0",asciiOnly:r=false}={})=>getRegexes(t,r).nmTokens.test(e);const ml=["name","ncName","qName","nmToken","nmTokens"];const createValidator=(e,{xmlVersion:t="1.0",asciiOnly:r=false,maxCacheSize:n=2048}={})=>{if(!ml.includes(e)){throw new TypeError(`Unknown production "${e}". Must be one of: ${ml.join(", ")}`)}const s=getRegexes(t,r)[e];let i=new Map;const validator=e=>{const t=i.get(e);if(t!==undefined)return t;const r=s.test(e);if(i.size{i=new Map};return validator};const src_validate=(e,t,{xmlVersion:r="1.0",asciiOnly:n=false}={})=>{if(!ml.includes(t)){throw new TypeError(`Unknown production "${t}". Must be one of: ${ml.join(", ")}`)}const s={name:src_name,ncName:ncName,qName:qName,nmToken:nmToken,nmTokens:nmTokens};const i=s[t](e,{xmlVersion:r,asciiOnly:n});if(i)return{valid:true,production:t,input:e};let o="Does not match the production rules";let a;const c=n?/^[:A-Za-z_]/:/^[:A-Za-z_\u00C0-\uFFFD]/;const l=n?/[\w\-\\.:]/:/[\w\-\\.:\u00B7\u00C0-\uFFFD]/;if(e.length===0){o="Input is empty"}else if(t==="ncName"&&e.includes(":")){a=e.indexOf(":");o="Colon is not allowed in NCName"}else if(t==="qName"&&e.startsWith(":")){o="QName cannot start with a colon";a=0}else if(t==="qName"&&e.endsWith(":")){o="QName cannot end with a colon";a=e.length-1}else if(t==="qName"&&(e.match(/:/g)||[]).length>1){o="QName can have at most one colon";a=e.lastIndexOf(":")}else if(["name","ncName","qName"].includes(t)&&!c.test(e[0])){o=`First character "${e[0]}" is not a valid NameStartChar`;a=0}else{for(let t=0;te.map((e=>src_validate(e,t,r)));const sanitize=(e,t="name",{replacement:r="_",asciiOnly:n=false}={})=>{if(!e)return r;let s=e;if(t==="ncName"){s=s.replace(/:/g,"")}const i=n?/[^\w\-\.:]/g:/[^\w\-\.:\u00B7\u00C0-\uFFFD]/g;s=s.replace(i,r);if(t!=="nmToken"&&t!=="nmTokens"){if(/^[\-\.\d]/.test(s)){s=r+s}}return s||r};const fl="\n";function detectXmlVersionFromArray(e,t){if(!Array.isArray(e)||e.length===0)return"1.0";const r=e[0];const n=propName(r);if(n==="?xml"){const e=r[":@"];if(e){const r=t.attributeNamePrefix+"version";if(e[r])return e[r]}}return"1.0"}function resolveTagName(e,t,r,n,s){if(!r.sanitizeName)return e;if(s(e))return e;return r.sanitizeName(e,{isAttribute:t,matcher:n.readOnly()})}function toXml(e,t){let r="";if(t.format){r=fl}const n=[];if(t.stopNodes&&Array.isArray(t.stopNodes)){for(let e=0;et.maxNestedTags){throw new Error("Maximum nested tags exceeded")}if(!Array.isArray(e)){if(e!==undefined&&e!==null){let r=valToStr(e);r=replaceEntitiesValue(r,t);return r}return""}for(let c=0;c`;a=false;n.pop();continue}else if(d===t.commentPropName){const e=l[A][0][t.textNodeName];const s=safeComment(e);o+=r+`\x3c!--${s}--\x3e`;a=true;n.pop();continue}else if(d[0]==="?"){const e=attr_to_str(l[":@"],t,p,n,i);const s=d==="?xml"?"":r;o+=s+`<${d}${e}?>`;a=true;n.pop();continue}let h=r;if(h!==""){h+=t.indentBy}const m=attr_to_str(l[":@"],t,p,n,i);const f=r+`<${d}${m}`;let C;if(p){C=orderedJs2Xml_getRawContent(l[A],t)}else{C=arrToStr(l[A],t,h,n,s,i)}if(t.unpairedTags.indexOf(d)!==-1){if(t.suppressUnpairedNode)o+=f+">";else o+=f+"/>"}else if((!C||C.length===0)&&t.suppressEmptyNode){o+=f+"/>"}else if(C&&C.endsWith(">")){o+=f+`>${C}${r}`}else{o+=f+">";if(C&&r!==""&&(C.includes("/>")||C.includes("`}a=true;n.pop()}return o}function extractAttributeValues(e,t){if(!e||t.ignoreAttributes)return null;const r={};let n=false;for(let s in e){if(!Object.prototype.hasOwnProperty.call(e,s))continue;const i=s.startsWith(t.attributeNamePrefix)?s.substr(t.attributeNamePrefix.length):s;r[i]=escapeAttribute(e[s]);n=true}return n?r:null}function orderedJs2Xml_getRawContent(e,t){if(!Array.isArray(e)){if(e!==undefined&&e!==null){return valToStr(e)}return""}let r="";for(let n=0;n`}else{r+=`<${i}${e}>${n}`}}}return r}function attr_to_str_raw(e,t){let r="";if(e&&!t.ignoreAttributes){for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;let s=e[n];if(s===true&&t.suppressBooleanAttributes){r+=` ${n.substr(t.attributeNamePrefix.length)}`}else{r+=` ${n.substr(t.attributeNamePrefix.length)}="${escapeAttribute(s)}"`}}}return r}function propName(e){const t=Object.keys(e);for(let r=0;r0&&t.processEntities){for(let r=0;r{for(const r of e){if(typeof r==="string"&&t===r){return true}if(r instanceof RegExp&&r.test(t)){return true}}}}return()=>false}const Cl={attributeNamePrefix:"@_",attributesGroupName:false,textNodeName:"#text",ignoreAttributes:true,cdataPropName:false,format:false,indentBy:" ",suppressEmptyNode:false,suppressUnpairedNode:true,suppressBooleanAttributes:true,tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},preserveOrder:false,commentPropName:false,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&"},{regex:new RegExp(">","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:true,stopNodes:[],oneListGroup:false,maxNestedTags:100,jPath:true,sanitizeName:false};function Builder(e){this.options=Object.assign({},Cl,e);if(this.options.stopNodes&&Array.isArray(this.options.stopNodes)){this.options.stopNodes=this.options.stopNodes.map((e=>{if(typeof e==="string"&&e.startsWith("*.")){return".."+e.substring(2)}return e}))}this.stopNodeExpressions=[];if(this.options.stopNodes&&Array.isArray(this.options.stopNodes)){for(let e=0;e\n";this.newLine="\n"}else{this.indentate=function(){return""};this.tagEndChar=">";this.newLine=""}}function detectXmlVersionFromObj(e,t){const r=e["?xml"];if(r&&typeof r==="object"){if(t.attributesGroupName&&r[t.attributesGroupName]){const e=r[t.attributesGroupName][t.attributeNamePrefix+"version"];if(e)return e}const e=r[t.attributeNamePrefix+"version"];if(e)return e}return"1.0"}function fxb_resolveTagName(e,t,r,n,s){if(!r.sanitizeName)return e;if(s(e))return e;return r.sanitizeName(e,{isAttribute:t,matcher:n.readOnly()})}Builder.prototype.build=function(e){if(this.options.preserveOrder){return toXml(e,this.options)}else{if(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1){e={[this.options.arrayNodeName]:e}}const t=new Matcher;const r=detectXmlVersionFromObj(e,this.options);const n=createValidator("qName",{xmlVersion:r});return this.j2x(e,0,t,n).val}};Builder.prototype.j2x=function(e,t,r,n){let s="";let i="";if(this.options.maxNestedTags&&r.getDepth()>=this.options.maxNestedTags){throw new Error("Maximum nested tags exceeded")}const o=this.options.jPath?r.toString():r;const a=this.checkStopNode(r);for(let c in e){if(!Object.prototype.hasOwnProperty.call(e,c))continue;const l=c===this.options.textNodeName||c===this.options.cdataPropName||c===this.options.commentPropName||this.options.attributesGroupName&&c===this.options.attributesGroupName||this.isAttribute(c)||c[0]==="?";const A=l?c:fxb_resolveTagName(c,false,this.options,r,n);if(typeof e[c]==="undefined"){if(this.isAttribute(c)){i+=""}}else if(e[c]===null){if(this.isAttribute(c)){i+=""}else if(A===this.options.cdataPropName||A===this.options.commentPropName){i+=""}else if(A[0]==="?"){i+=this.indentate(t)+"<"+A+"?"+this.tagEndChar}else{i+=this.indentate(t)+"<"+A+"/"+this.tagEndChar}}else if(e[c]instanceof Date){i+=this.buildTextValNode(e[c],A,"",t,r)}else if(typeof e[c]!=="object"){const l=this.isAttribute(c);if(l&&!this.ignoreAttributesFn(l,o)){const t=fxb_resolveTagName(l,true,this.options,r,n);s+=this.buildAttrPairStr(t,valToStr(e[c]),a)}else if(!l){if(c===this.options.textNodeName){let t=this.options.tagValueProcessor(c,valToStr(e[c]));i+=this.replaceEntitiesValue(t)}else{r.push(A);const n=this.checkStopNode(r);r.pop();if(n){const r=valToStr(e[c]);if(r===""){i+=this.indentate(t)+"<"+A+this.closeTag(A)+this.tagEndChar}else{i+=this.indentate(t)+"<"+A+">"+r+""+e+"${e}`}else if(typeof e==="object"&&e!==null){const n=this.buildRawContent(e);const s=this.buildAttributesForStopNode(e);if(n===""){t+=`<${r}${s}/>`}else{t+=`<${r}${s}>${n}`}}}}else if(typeof n==="object"&&n!==null){const e=this.buildRawContent(n);const s=this.buildAttributesForStopNode(n);if(e===""){t+=`<${r}${s}/>`}else{t+=`<${r}${s}>${e}`}}else{t+=`<${r}>${n}`}}return t};Builder.prototype.buildAttributesForStopNode=function(e){if(!e||typeof e!=="object")return"";let t="";if(this.options.attributesGroupName&&e[this.options.attributesGroupName]){const r=e[this.options.attributesGroupName];for(let e in r){if(!Object.prototype.hasOwnProperty.call(r,e))continue;const n=e.startsWith(this.options.attributeNamePrefix)?e.substring(this.options.attributeNamePrefix.length):e;const s=r[e];if(s===true&&this.options.suppressBooleanAttributes){t+=" "+n}else{t+=" "+n+'="'+escapeAttribute(s)+'"'}}}else{for(let r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;const n=this.isAttribute(r);if(n){const s=e[r];if(s===true&&this.options.suppressBooleanAttributes){t+=" "+n}else{t+=" "+n+'="'+escapeAttribute(s)+'"'}}}}return t};Builder.prototype.buildObjectNode=function(e,t,r,n){if(e===""){if(t[0]==="?")return this.indentate(n)+"<"+t+r+"?"+this.tagEndChar;else{return this.indentate(n)+"<"+t+r+this.closeTag(t)+this.tagEndChar}}else if(t[0]==="?"){return this.indentate(n)+"<"+t+r+"?"+this.tagEndChar}else{let s=""+e+s}else if(this.options.commentPropName!==false&&t===this.options.commentPropName&&i.length===0){return this.indentate(n)+`\x3c!--${safeComment(e)}--\x3e`+this.newLine}else{return this.indentate(n)+"<"+t+r+i+this.tagEndChar+e+this.indentate(n)+s}}};Builder.prototype.closeTag=function(e){let t="";if(this.options.unpairedTags.indexOf(e)!==-1){if(!this.options.suppressUnpairedNode)t="/"}else if(this.options.suppressEmptyNode){t="/"}else{t=`>`+this.newLine}else if(this.options.commentPropName!==false&&t===this.options.commentPropName){const t=safeComment(e);return this.indentate(n)+`\x3c!--${t}--\x3e`+this.newLine}else if(t[0]==="?"){return this.indentate(n)+"<"+t+r+"?"+this.tagEndChar}else{let s=this.options.tagValueProcessor(t,e);s=this.replaceEntitiesValue(s);s=valToStr(s);if(s===""){return this.indentate(n)+"<"+t+r+this.closeTag(t)+this.tagEndChar}else{return this.indentate(n)+"<"+t+r+">"+s+"0&&this.options.processEntities){for(let t=0;t"&&e[i]!==" "&&e[i]!=="\t"&&e[i]!=="\n"&&e[i]!=="\r";i++){c+=e[i]}c=c.trim();if(c[c.length-1]==="/"){c=c.substring(0,c.length-1);i--}if(!validateTagName(c)){let t;if(c.trim().length===0){t="Invalid space after '<'."}else{t="Tag '"+c+"' is an invalid name."}return getErrorObject("InvalidTag",t,getLineNumberForPosition(e,i))}const l=readAttributeStr(e,i);if(l===false){return getErrorObject("InvalidAttr","Attributes for '"+c+"' have open quote.",getLineNumberForPosition(e,i))}let A=l.value;i=l.index;if(A[A.length-1]==="/"){const r=i-A.length;A=A.substring(0,A.length-1);const s=validateAttributeString(A,t);if(s===true){n=true}else{return getErrorObject(s.err.code,s.err.msg,getLineNumberForPosition(e,r+s.err.line))}}else if(a){if(!l.tagClosed){return getErrorObject("InvalidTag","Closing tag '"+c+"' doesn't have proper closing.",getLineNumberForPosition(e,i))}else if(A.trim().length>0){return getErrorObject("InvalidTag","Closing tag '"+c+"' can't have attributes or invalid starting.",getLineNumberForPosition(e,o))}else if(r.length===0){return getErrorObject("InvalidTag","Closing tag '"+c+"' has not been opened.",getLineNumberForPosition(e,o))}else{const t=r.pop();if(c!==t.tagName){let r=getLineNumberForPosition(e,t.tagStartPos);return getErrorObject("InvalidTag","Expected closing tag '"+t.tagName+"' (opened in line "+r.line+", col "+r.col+") instead of closing tag '"+c+"'.",getLineNumberForPosition(e,o))}if(r.length==0){s=true}}}else{const a=validateAttributeString(A,t);if(a!==true){return getErrorObject(a.err.code,a.err.msg,getLineNumberForPosition(e,i-A.length+a.err.line))}if(s===true){return getErrorObject("InvalidXml","Multiple possible root nodes found.",getLineNumberForPosition(e,i))}else if(t.unpairedTags.indexOf(c)!==-1){}else{r.push({tagName:c,tagStartPos:o})}n=true}for(i++;i0){return getErrorObject("InvalidXml","Invalid '"+JSON.stringify(r.map((e=>e.tagName)),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}return true}function validator_isWhiteSpace(e){return e===" "||e==="\t"||e==="\n"||e==="\r"}function readPI(e,t){const r=t;for(;t5&&n==="xml"){return getErrorObject("InvalidXml","XML declaration allowed only at the start of the document.",getLineNumberForPosition(e,t))}else if(e[t]=="?"&&e[t+1]==">"){t++;break}else{continue}}}return t}function readCommentAndCDATA(e,t){if(e.length>t+5&&e[t+1]==="-"&&e[t+2]==="-"){for(t+=3;t"){t+=2;break}}}else if(e.length>t+8&&e[t+1]==="D"&&e[t+2]==="O"&&e[t+3]==="C"&&e[t+4]==="T"&&e[t+5]==="Y"&&e[t+6]==="P"&&e[t+7]==="E"){let r=1;for(t+=8;t"){r--;if(r===0){break}}}}else if(e.length>t+9&&e[t+1]==="["&&e[t+2]==="C"&&e[t+3]==="D"&&e[t+4]==="A"&&e[t+5]==="T"&&e[t+6]==="A"&&e[t+7]==="["){for(t+=8;t"){t+=2;break}}}return t}const Dl='"';const Nl="'";function readAttributeStr(e,t){let r="";let n="";let s=false;for(;t"){if(n===""){s=true;break}}r+=e[t]}if(n!==""){return false}return{value:r,index:t,tagClosed:s}}function scanAttributeTokens(e){const t=[];const r=e.length;let n=0;while(n=r)break;if(e[n]==="="){n=s+1;continue}const i=e.slice(s,n);const o=n;while(n{if(bl.includes(e)){return"__"+e}return e};const Rl={preserveOrder:false,attributeNamePrefix:"@_",attributesGroupName:false,textNodeName:"#text",ignoreAttributes:true,removeNSPrefix:false,allowBooleanAttributes:false,parseTagValue:true,parseAttributeValue:false,trimValues:true,cdataPropName:false,numberParseOptions:{hex:true,leadingZeros:true,eNotation:true,unicode:false},tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},stopNodes:[],alwaysCreateTextNode:false,isArray:()=>false,commentPropName:false,unpairedTags:[],processEntities:true,htmlEntities:false,entityDecoder:null,ignoreDeclaration:false,ignorePiTags:false,transformTagName:false,transformAttributeName:false,updateTag:function(e,t,r){return e},captureMetaData:false,maxNestedTags:100,strictReservedNames:true,jPath:true,onDangerousProperty:defaultOnDangerousProperty};function validatePropertyName(e,t){if(typeof e!=="string"){return}const r=e.toLowerCase();if(bl.some((e=>r===e.toLowerCase()))){throw new Error(`[SECURITY] Invalid ${t}: "${e}" is a reserved JavaScript keyword that could cause prototype pollution`)}if(Sl.some((e=>r===e.toLowerCase()))){throw new Error(`[SECURITY] Invalid ${t}: "${e}" is a reserved JavaScript keyword that could cause prototype pollution`)}}function normalizeProcessEntities(e,t){if(typeof e==="boolean"){return{enabled:e,maxEntitySize:1e4,maxExpansionDepth:1e4,maxTotalExpansions:Infinity,maxExpandedLength:1e5,maxEntityCount:1e3,allowedTags:null,tagFilter:null,appliesTo:"all"}}if(typeof e==="object"&&e!==null){return{enabled:e.enabled!==false,maxEntitySize:Math.max(1,e.maxEntitySize??1e4),maxExpansionDepth:Math.max(1,e.maxExpansionDepth??1e4),maxTotalExpansions:Math.max(1,e.maxTotalExpansions??Infinity),maxExpandedLength:Math.max(1,e.maxExpandedLength??1e5),maxEntityCount:Math.max(1,e.maxEntityCount??1e3),allowedTags:e.allowedTags??null,tagFilter:e.tagFilter??null,appliesTo:e.appliesTo??"all"}}return normalizeProcessEntities(true)}const buildOptions=function(e){const t=Object.assign({},Rl,e);const r=[{value:t.attributeNamePrefix,name:"attributeNamePrefix"},{value:t.attributesGroupName,name:"attributesGroupName"},{value:t.textNodeName,name:"textNodeName"},{value:t.cdataPropName,name:"cdataPropName"},{value:t.commentPropName,name:"commentPropName"}];for(const{value:e,name:t}of r){if(e){validatePropertyName(e,t)}}if(t.onDangerousProperty===null){t.onDangerousProperty=defaultOnDangerousProperty}t.processEntities=normalizeProcessEntities(t.processEntities,t.htmlEntities);t.unpairedTagsSet=new Set(t.unpairedTags);if(t.stopNodes&&Array.isArray(t.stopNodes)){t.stopNodes=t.stopNodes.map((e=>{if(typeof e==="string"&&e.startsWith("*.")){return".."+e.substring(2)}return e}))}return t};let vl;if(typeof Symbol!=="function"){vl="@@xmlMetadata"}else{vl=Symbol("XML Node Metadata")}class XmlNode{constructor(e){this.tagname=e;this.child=[];this[":@"]=Object.create(null)}add(e,t){if(e==="__proto__")e="#__proto__";this.child.push({[e]:t})}addChild(e,t){if(e.tagname==="__proto__")e.tagname="#__proto__";if(e[":@"]&&Object.keys(e[":@"]).length>0){this.child.push({[e.tagname]:e.child,[":@"]:e[":@"]})}else{this.child.push({[e.tagname]:e.child})}this.addStartIndex(t)}addStartIndex(e){if(e!==undefined){this.child[this.child.length-1][vl]={startIndex:e}}}addEndIndex(e){const t=this.child[this.child.length-1];if(t!==undefined&&t[vl]!==undefined&&t[vl].endIndex===undefined){t[vl].endIndex=e}}static getMetaDataSymbol(){return vl}}class DocTypeReader{constructor(e,t){this.suppressValidationErr=!e;this.options=e;this.xmlVersion=t||1}setXmlVersion(e=1){this.xmlVersion=e}readDocType(e,t){const r=Object.create(null);let n=0;if(e[t+3]==="O"&&e[t+4]==="C"&&e[t+5]==="T"&&e[t+6]==="Y"&&e[t+7]==="P"&&e[t+8]==="E"){t=t+9;let s=1;let i=false,o=false;let a=null;let c="";for(;t=this.options.maxEntityCount){throw new Error(`Entity count (${n+1}) exceeds maximum allowed (${this.options.maxEntityCount})`)}r[s]=i;n++}}else if(i&&hasSeq(e,"!ELEMENT",t)){t+=8;const{index:r}=this.readElementExp(e,t+1);t=r}else if(i&&hasSeq(e,"!ATTLIST",t)){t+=8}else if(i&&hasSeq(e,"!NOTATION",t)){t+=9;const{index:r}=this.readNotationExp(e,t+1,this.suppressValidationErr);t=r}else if(hasSeq(e,"!--",t))o=true;else throw new Error(`Invalid DOCTYPE`);s++;c=""}else if(e[t]===">"){if(o){if(e[t-1]==="-"&&e[t-2]==="-"){o=false;s--}}else{s--}if(s===0){break}}else if(e[t]==="["){i=true}else{c+=e[t]}}if(a!==null||s!==0){throw new Error(`Unclosed DOCTYPE`)}}else{throw new Error(`Invalid Tag instead of DOCTYPE`)}return{entities:r,i:t}}readEntityExp(e,t){t=skipWhitespace(e,t);const r=t;while(tthis.options.maxEntitySize){throw new Error(`Entity "${n}" size (${s.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`)}t--;return[n,s,t]}readNotationExp(e,t){t=skipWhitespace(e,t);const r=t;while(t{while(t=Hl&&s<=_l||s===ql)continue;if(s=55296&&s<=56319){if(n+1=56320&&t<=57343){const e=65536+(s-55296<<10)+(t-56320);if(Tl.has(e)){r=n;break}}}continue}if(Ol[s-Ll]!==Fl||Gl.has(s)){r=n;break}}if(r===-1)return e;const n=[];if(r>0)n.push(e.slice(0,r));for(let s=r;s=Hl&&r<=_l||r===ql){n.push(e[s]);continue}if(r=55296&&r<=56319){if(s+1=56320&&t<=57343){const e=65536+(r-55296<<10)+(t-56320);const i=Tl.get(e);if(i!==undefined){n.push(String.fromCharCode(i+48));s++;continue}}}n.push(e[s]);continue}if(Gl.has(r)){n.push("-");continue}const i=Ol[r-Ll];n.push(i!==Fl?String.fromCharCode(i+48):e[s])}return n.join("")}const zl=anynum;const Yl=/^[-+]?0x[a-fA-F0-9]+$/;const Vl=/^0b[01]+$/;const Jl=/^0o[0-7]+$/;const Wl=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/;const jl={hex:true,binary:false,octal:false,leadingZeros:true,decimalPoint:".",eNotation:true,infinity:"original",unicode:false};function toNumber(e,t={}){t=Object.assign({},jl,t);if(!e||typeof e!=="string")return e;let r=e.trim();if(r.length===0)return e;else if(t.skipLike!==undefined&&t.skipLike.test(r))return e;else if(r==="0")return 0;if(t.unicode){r=zl(r);if(r==="0")return 0}if(t.hex&&Yl.test(r)){return parse_int(r,16)}else if(t.binary&&Vl.test(r)){return parse_int(r,2)}else if(t.octal&&Jl.test(r)){return parse_int(r,8)}else if(!isFinite(r)){return handleInfinity(e,Number(r),t)}else if(r.includes("e")||r.includes("E")){return resolveEnotation(e,r,t)}else{const n=Wl.exec(r);if(n){const s=n[1]||"";const i=n[2];let o=trimZeros(n[3]);const a=s?e[i.length+1]===".":e[i.length]===".";if(!t.leadingZeros&&(i.length>1||i.length===1&&!a)){return e}else{const n=Number(r);const a=String(n);if(n===0)return n;if(a.search(/[eE]/)!==-1){if(t.eNotation)return n;else return e}else if(r.indexOf(".")!==-1){if(a==="0")return n;else if(a===o)return n;else if(a===`${s}${o}`)return n;else return e}let c=i?o:r;if(i){return c===a||s+c===a?n:e}else{return c===a||c===s+a?n:e}}}else{return e}}}const Kl=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function resolveEnotation(e,t,r){if(!r.eNotation)return e;const n=t.match(Kl);if(n){let s=n[1]||"";const i=n[3].indexOf("e")===-1?"E":"e";const o=n[2];const a=s?e[o.length+1]===i:e[o.length]===i;if(o.length>1&&a)return e;else if(o.length===1&&(n[3].startsWith(`.${i}`)||n[3][0]===i)){return Number(t)}else if(o.length>0){if(r.leadingZeros&&!a){t=(n[1]||"")+n[3];return Number(t)}else return e}else{return Number(t)}}else{return e}}function trimZeros(e){if(e&&e.indexOf(".")!==-1){let t=e.length;while(t>0&&e.charCodeAt(t-1)===48)t--;e=e.slice(0,t);if(e===".")e="0";else if(e[0]===".")e="0"+e;else if(e[e.length-1]===".")e=e.substring(0,e.length-1);return e}return e}function parse_int(e,t){const r=e.trim();if(t===2||t===8)e=r.substring(2);if(parseInt)return parseInt(e,t);else if(Number.parseInt)return Number.parseInt(e,t);else if(window&&window.parseInt)return window.parseInt(e,t);else throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}function handleInfinity(e,t,r){const n=t===Infinity;switch(r.infinity.toLowerCase()){case"null":return null;case"infinity":return t;case"string":return n?"Infinity":"-Infinity";case"original":default:return e}}function ignoreAttributes_getIgnoreAttributesFn(e){if(typeof e==="function"){return e}if(Array.isArray(e)){return t=>{for(const r of e){if(typeof r==="string"&&t===r){return true}if(r instanceof RegExp&&r.test(t)){return true}}}}return()=>false}class ExpressionSet{constructor(){this._byDepthAndTag=new Map;this._wildcardByDepth=new Map;this._deepWildcards=[];this._deepByTerminalTag=new Map;this._patterns=new Set;this._sealed=false}add(e){if(this._sealed){throw new TypeError("ExpressionSet is sealed. Create a new ExpressionSet to add more expressions.")}if(this._patterns.has(e.pattern))return this;this._patterns.add(e.pattern);if(e.hasDeepWildcard()){const t=e.segments[e.segments.length-1];if(t&&t.type!=="deep-wildcard"&&t.tag!=="*"){const r=t.tag;if(!this._deepByTerminalTag.has(r))this._deepByTerminalTag.set(r,[]);this._deepByTerminalTag.get(r).push(e)}else{this._deepWildcards.push(e)}return this}const t=e.length;const r=e.segments[e.segments.length-1];const n=r?.tag;if(!n||n==="*"){if(!this._wildcardByDepth.has(t))this._wildcardByDepth.set(t,[]);this._wildcardByDepth.get(t).push(e)}else{const r=`${t}:${n}`;if(!this._byDepthAndTag.has(r))this._byDepthAndTag.set(r,[]);this._byDepthAndTag.get(r).push(e)}return this}addAll(e){for(const t of e)this.add(t);return this}has(e){return this._patterns.has(e.pattern)}get size(){return this._patterns.size}seal(){this._sealed=true;return this}get isSealed(){return this._sealed}matchesAny(e){return this.findMatch(e)!==null}findMatch(e){const t=e.getDepth();const r=e.getCurrentTag();const n=`${t}:${r}`;const s=this._byDepthAndTag.get(n);if(s){for(let t=0;t",GT:">",quot:'"',QUOT:'"',apos:"'",lsquo:"‘",rsquo:"’",ldquo:"“",rdquo:"”",lsquor:"‚",rsquor:"’",ldquor:"„",bdquo:"„",comma:",",period:".",colon:":",semi:";",excl:"!",quest:"?",num:"#",dollar:"$",percent:"%",ast:"*",commat:"@",lowbar:"_",verbar:"|",vert:"|",sol:"/",bsol:"\\",lbrace:"{",rbrace:"}",lbrack:"[",rbrack:"]",lpar:"(",rpar:")",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",COPY:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",REG:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",half:"½",frac34:"¾",iquest:"¿",times:"×",div:"÷",divide:"÷"};const Xl={Agrave:"À",agrave:"à",Aacute:"Á",aacute:"á",Acirc:"Â",acirc:"â",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",Aring:"Å",aring:"å",AElig:"Æ",aelig:"æ",Ccedil:"Ç",ccedil:"ç",Egrave:"È",egrave:"è",Eacute:"É",eacute:"é",Ecirc:"Ê",ecirc:"ê",Euml:"Ë",euml:"ë",Igrave:"Ì",igrave:"ì",Iacute:"Í",iacute:"í",Icirc:"Î",icirc:"î",Iuml:"Ï",iuml:"ï",ETH:"Ð",eth:"ð",Ntilde:"Ñ",ntilde:"ñ",Ograve:"Ò",ograve:"ò",Oacute:"Ó",oacute:"ó",Ocirc:"Ô",ocirc:"ô",Otilde:"Õ",otilde:"õ",Ouml:"Ö",ouml:"ö",Oslash:"Ø",oslash:"ø",Ugrave:"Ù",ugrave:"ù",Uacute:"Ú",uacute:"ú",Ucirc:"Û",ucirc:"û",Uuml:"Ü",uuml:"ü",Yacute:"Ý",yacute:"ý",THORN:"Þ",thorn:"þ",szlig:"ß",yuml:"ÿ",Yuml:"Ÿ"};const Zl={Amacr:"Ā",amacr:"ā",Abreve:"Ă",abreve:"ă",Aogon:"Ą",aogon:"ą",Cacute:"Ć",cacute:"ć",Ccirc:"Ĉ",ccirc:"ĉ",Cdot:"Ċ",cdot:"ċ",Ccaron:"Č",ccaron:"č",Dcaron:"Ď",dcaron:"ď",Dstrok:"Đ",dstrok:"đ",Emacr:"Ē",emacr:"ē",Ecaron:"Ě",ecaron:"ě",Edot:"Ė",edot:"ė",Eogon:"Ę",eogon:"ę",Gcirc:"Ĝ",gcirc:"ĝ",Gbreve:"Ğ",gbreve:"ğ",Gdot:"Ġ",gdot:"ġ",Gcedil:"Ģ",Hcirc:"Ĥ",hcirc:"ĥ",Hstrok:"Ħ",hstrok:"ħ",Itilde:"Ĩ",itilde:"ĩ",Imacr:"Ī",imacr:"ī",Iogon:"Į",iogon:"į",Idot:"İ",IJlig:"IJ",ijlig:"ij",Jcirc:"Ĵ",jcirc:"ĵ",Kcedil:"Ķ",kcedil:"ķ",kgreen:"ĸ",Lacute:"Ĺ",lacute:"ĺ",Lcedil:"Ļ",lcedil:"ļ",Lcaron:"Ľ",lcaron:"ľ",Lmidot:"Ŀ",lmidot:"ŀ",Lstrok:"Ł",lstrok:"ł",Nacute:"Ń",nacute:"ń",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ENG:"Ŋ",eng:"ŋ",Omacr:"Ō",omacr:"ō",Odblac:"Ő",odblac:"ő",OElig:"Œ",oelig:"œ",Racute:"Ŕ",racute:"ŕ",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",Sacute:"Ś",sacute:"ś",Scirc:"Ŝ",scirc:"ŝ",Scedil:"Ş",scedil:"ş",Scaron:"Š",scaron:"š",Tcedil:"Ţ",tcedil:"ţ",Tcaron:"Ť",tcaron:"ť",Tstrok:"Ŧ",tstrok:"ŧ",Utilde:"Ũ",utilde:"ũ",Umacr:"Ū",umacr:"ū",Ubreve:"Ŭ",ubreve:"ŭ",Uring:"Ů",uring:"ů",Udblac:"Ű",udblac:"ű",Uogon:"Ų",uogon:"ų",Wcirc:"Ŵ",wcirc:"ŵ",Ycirc:"Ŷ",ycirc:"ŷ",Zacute:"Ź",zacute:"ź",Zdot:"Ż",zdot:"ż",Zcaron:"Ž",zcaron:"ž"};const eA={Alpha:"Α",alpha:"α",Beta:"Β",beta:"β",Gamma:"Γ",gamma:"γ",Delta:"Δ",delta:"δ",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",varepsilon:"ϵ",Zeta:"Ζ",zeta:"ζ",Eta:"Η",eta:"η",Theta:"Θ",theta:"θ",thetasym:"ϑ",vartheta:"ϑ",Iota:"Ι",iota:"ι",Kappa:"Κ",kappa:"κ",kappav:"ϰ",varkappa:"ϰ",Lambda:"Λ",lambda:"λ",Mu:"Μ",mu:"μ",Nu:"Ν",nu:"ν",Xi:"Ξ",xi:"ξ",Omicron:"Ο",omicron:"ο",Pi:"Π",pi:"π",piv:"ϖ",varpi:"ϖ",Rho:"Ρ",rho:"ρ",rhov:"ϱ",varrho:"ϱ",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",varsigma:"ς",Tau:"Τ",tau:"τ",Upsilon:"Υ",upsilon:"υ",upsi:"υ",Upsi:"ϒ",upsih:"ϒ",Phi:"Φ",phi:"φ",phiv:"ϕ",varphi:"ϕ",Chi:"Χ",chi:"χ",Psi:"Ψ",psi:"ψ",Omega:"Ω",omega:"ω",ohm:"Ω",Gammad:"Ϝ",gammad:"ϝ",digamma:"ϝ"};const tA={Afr:"𝔄",afr:"𝔞",Acy:"А",acy:"а",Bcy:"Б",bcy:"б",Vcy:"В",vcy:"в",Gcy:"Г",gcy:"г",Dcy:"Д",dcy:"д",IEcy:"Е",iecy:"е",IOcy:"Ё",iocy:"ё",ZHcy:"Ж",zhcy:"ж",Zcy:"З",zcy:"з",Icy:"И",icy:"и",Jcy:"Й",jcy:"й",Kcy:"К",kcy:"к",Lcy:"Л",lcy:"л",Mcy:"М",mcy:"м",Ncy:"Н",ncy:"н",Ocy:"О",ocy:"о",Pcy:"П",pcy:"п",Rcy:"Р",rcy:"р",Scy:"С",scy:"с",Tcy:"Т",tcy:"т",Ucy:"У",ucy:"у",Fcy:"Ф",fcy:"ф",KHcy:"Х",khcy:"х",TScy:"Ц",tscy:"ц",CHcy:"Ч",chcy:"ч",SHcy:"Ш",shcy:"ш",SHCHcy:"Щ",shchcy:"щ",HARDcy:"Ъ",hardcy:"ъ",Ycy:"Ы",ycy:"ы",SOFTcy:"Ь",softcy:"ь",Ecy:"Э",ecy:"э",YUcy:"Ю",yucy:"ю",YAcy:"Я",yacy:"я",DJcy:"Ђ",djcy:"ђ",GJcy:"Ѓ",gjcy:"ѓ",Jukcy:"Є",jukcy:"є",DScy:"Ѕ",dscy:"ѕ",Iukcy:"І",iukcy:"і",YIcy:"Ї",yicy:"ї",Jsercy:"Ј",jsercy:"ј",LJcy:"Љ",ljcy:"љ",NJcy:"Њ",njcy:"њ",TSHcy:"Ћ",tshcy:"ћ",KJcy:"Ќ",kjcy:"ќ",Ubrcy:"Ў",ubrcy:"ў",DZcy:"Џ",dzcy:"џ"};const rA={plus:"+",pm:"±",times:"×",div:"÷",divide:"÷",sdot:"⋅",star:"☆",starf:"★",bigstar:"★",lowast:"∗",ast:"*",midast:"*",compfn:"∘",smallcircle:"∘",bullet:"•",bull:"•",nbsp:" ",hellip:"…",mldr:"…",prime:"′",Prime:"″",tprime:"‴",bprime:"‵",backprime:"‵",minus:"−",minusd:"∸",dotminus:"∸",plusdo:"∔",dotplus:"∔",plusmn:"±",minusplus:"∓",mnplus:"∓",mp:"∓",setminus:"∖",smallsetminus:"∖",Backslash:"∖",setmn:"∖",ssetmn:"∖",lowbar:"_",verbar:"|",vert:"|",VerticalLine:"|",colon:":",Colon:"∷",Proportion:"∷",ratio:"∶",equals:"=",ne:"≠",nequiv:"≢",equiv:"≡",Congruent:"≡",sim:"∼",thicksim:"∼",thksim:"∼",sime:"≃",simeq:"≃",TildeEqual:"≃",asymp:"≈",approx:"≈",thickapprox:"≈",thkap:"≈",TildeTilde:"≈",ncong:"≇",cong:"≅",TildeFullEqual:"≅",asympeq:"≍",CupCap:"≍",bump:"≎",Bumpeq:"≎",HumpDownHump:"≎",bumpe:"≏",bumpeq:"≏",HumpEqual:"≏",le:"≤",LessEqual:"≤",ge:"≥",GreaterEqual:"≥",lesseqgtr:"⋚",lesseqqgtr:"⪋",greater:">",less:"<"};const nA={alefsym:"ℵ",aleph:"ℵ",beth:"ℶ",gimel:"ℷ",daleth:"ℸ",forall:"∀",ForAll:"∀",part:"∂",PartialD:"∂",exist:"∃",Exists:"∃",nexist:"∄",nexists:"∄",empty:"∅",emptyset:"∅",emptyv:"∅",varnothing:"∅",nabla:"∇",Del:"∇",isin:"∈",isinv:"∈",in:"∈",Element:"∈",notin:"∉",notinva:"∉",ni:"∋",niv:"∋",SuchThat:"∋",ReverseElement:"∋",notni:"∌",notniva:"∌",prod:"∏",Product:"∏",coprod:"∐",Coproduct:"∐",sum:"∑",Sum:"∑",minus:"−",mp:"∓",plusdo:"∔",dotplus:"∔",setminus:"∖",lowast:"∗",radic:"√",Sqrt:"√",prop:"∝",propto:"∝",Proportional:"∝",varpropto:"∝",infin:"∞",infintie:"⧝",ang:"∠",angle:"∠",angmsd:"∡",measuredangle:"∡",angsph:"∢",mid:"∣",VerticalBar:"∣",nmid:"∤",nsmid:"∤",npar:"∦",parallel:"∥",spar:"∥",nparallel:"∦",nspar:"∦",and:"∧",wedge:"∧",or:"∨",vee:"∨",cap:"∩",cup:"∪",int:"∫",Integral:"∫",conint:"∮",ContourIntegral:"∮",Conint:"∯",DoubleContourIntegral:"∯",Cconint:"∰",there4:"∴",therefore:"∴",Therefore:"∴",becaus:"∵",because:"∵",Because:"∵",ratio:"∶",Proportion:"∷",minusd:"∸",dotminus:"∸",mDDot:"∺",homtht:"∻",sim:"∼",bsimg:"∽",backsim:"∽",ac:"∾",mstpos:"∾",acd:"∿",VerticalTilde:"≀",wr:"≀",wreath:"≀",nsime:"≄",nsimeq:"≄",ncong:"≇",simne:"≆",ncongdot:"⩭̸",ngsim:"≵",nsim:"≁",napprox:"≉",nap:"≉",ngeq:"≱",nge:"≱",nleq:"≰",nle:"≰",ngtr:"≯",ngt:"≯",nless:"≮",nlt:"≮",nprec:"⊀",npr:"⊀",nsucc:"⊁",nsc:"⊁"};const sA={larr:"←",leftarrow:"←",LeftArrow:"←",uarr:"↑",uparrow:"↑",UpArrow:"↑",rarr:"→",rightarrow:"→",RightArrow:"→",darr:"↓",downarrow:"↓",DownArrow:"↓",harr:"↔",leftrightarrow:"↔",LeftRightArrow:"↔",varr:"↕",updownarrow:"↕",UpDownArrow:"↕",nwarr:"↖",nwarrow:"↖",UpperLeftArrow:"↖",nearr:"↗",nearrow:"↗",UpperRightArrow:"↗",searr:"↘",searrow:"↘",LowerRightArrow:"↘",swarr:"↙",swarrow:"↙",LowerLeftArrow:"↙",lArr:"⇐",Leftarrow:"⇐",uArr:"⇑",Uparrow:"⇑",rArr:"⇒",Rightarrow:"⇒",dArr:"⇓",Downarrow:"⇓",hArr:"⇔",Leftrightarrow:"⇔",iff:"⇔",vArr:"⇕",Updownarrow:"⇕",lAarr:"⇚",Lleftarrow:"⇚",rAarr:"⇛",Rrightarrow:"⇛",lrarr:"⇆",leftrightarrows:"⇆",rlarr:"⇄",rightleftarrows:"⇄",lrhar:"⇋",leftrightharpoons:"⇋",ReverseEquilibrium:"⇋",rlhar:"⇌",rightleftharpoons:"⇌",Equilibrium:"⇌",udarr:"⇅",UpArrowDownArrow:"⇅",duarr:"⇵",DownArrowUpArrow:"⇵",llarr:"⇇",leftleftarrows:"⇇",rrarr:"⇉",rightrightarrows:"⇉",ddarr:"⇊",downdownarrows:"⇊",har:"↽",lhard:"↽",leftharpoondown:"↽",lharu:"↼",leftharpoonup:"↼",rhard:"⇁",rightharpoondown:"⇁",rharu:"⇀",rightharpoonup:"⇀",lsh:"↰",Lsh:"↰",rsh:"↱",Rsh:"↱",ldsh:"↲",rdsh:"↳",hookleftarrow:"↩",hookrightarrow:"↪",mapstoleft:"↤",mapstoup:"↥",map:"↦",mapsto:"↦",mapstodown:"↧",crarr:"↵",nleftarrow:"↚",nleftrightarrow:"↮",nrightarrow:"↛",nrarr:"↛",larrtl:"↢",rarrtl:"↣",leftarrowtail:"↢",rightarrowtail:"↣",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Larr:"↞",Rarr:"↠",larrhk:"↩",rarrhk:"↪",larrlp:"↫",looparrowleft:"↫",rarrlp:"↬",looparrowright:"↬",harrw:"↭",leftrightsquigarrow:"↭",nrarrw:"↝̸",rarrw:"↝",rightsquigarrow:"↝",larrbfs:"⤟",rarrbfs:"⤠",nvHarr:"⤄",nvlArr:"⤂",nvrArr:"⤃",larrfs:"⤝",rarrfs:"⤞",Map:"⤅",larrsim:"⥳",rarrsim:"⥴",harrcir:"⥈",Uarrocir:"⥉",lurdshar:"⥊",ldrdhar:"⥧",ldrushar:"⥋",rdldhar:"⥩",lrhard:"⥭",uharr:"↾",uharl:"↿",dharr:"⇂",dharl:"⇃",Uarr:"↟",Darr:"↡",zigrarr:"⇝",nwArr:"⇖",neArr:"⇗",seArr:"⇘",swArr:"⇙",nharr:"↮",nhArr:"⇎",nlarr:"↚",nlArr:"⇍",nrArr:"⇏",larrb:"⇤",LeftArrowBar:"⇤",rarrb:"⇥",RightArrowBar:"⇥"};const iA={square:"□",Square:"□",squ:"□",squf:"▪",squarf:"▪",blacksquar:"▪",blacksquare:"▪",FilledVerySmallSquare:"▪",blk34:"▓",blk12:"▒",blk14:"░",block:"█",srect:"▭",rect:"▭",sdot:"⋅",sdotb:"⊡",dotsquare:"⊡",triangle:"▵",tri:"▵",trine:"▵",utri:"▵",triangledown:"▿",dtri:"▿",tridown:"▿",triangleleft:"◃",ltri:"◃",triangleright:"▹",rtri:"▹",blacktriangle:"▴",utrif:"▴",blacktriangledown:"▾",dtrif:"▾",blacktriangleleft:"◂",ltrif:"◂",blacktriangleright:"▸",rtrif:"▸",loz:"◊",lozenge:"◊",blacklozenge:"⧫",lozf:"⧫",bigcirc:"◯",xcirc:"◯",circ:"ˆ",Circle:"○",cir:"○",o:"○",bullet:"•",bull:"•",hellip:"…",mldr:"…",nldr:"‥",boxh:"─",HorizontalLine:"─",boxv:"│",boxdr:"┌",boxdl:"┐",boxur:"└",boxul:"┘",boxvr:"├",boxvl:"┤",boxhd:"┬",boxhu:"┴",boxvh:"┼",boxH:"═",boxV:"║",boxdR:"╒",boxDr:"╓",boxDR:"╔",boxDl:"╕",boxdL:"╖",boxDL:"╗",boxuR:"╘",boxUr:"╙",boxUR:"╚",boxUl:"╜",boxuL:"╛",boxUL:"╝",boxvR:"╞",boxVr:"╟",boxVR:"╠",boxVl:"╢",boxvL:"╡",boxVL:"╣",boxHd:"╤",boxhD:"╥",boxHD:"╦",boxHu:"╧",boxhU:"╨",boxHU:"╩",boxvH:"╪",boxVh:"╫",boxVH:"╬"};const oA={excl:"!",iexcl:"¡",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",nbsp:" ",comma:",",period:".",colon:":",semi:";",vert:"|",Verbar:"‖",verbar:"|",dblac:"˝",circ:"ˆ",caron:"ˇ",breve:"˘",dot:"˙",ring:"˚",ogon:"˛",tilde:"˜",DiacriticalGrave:"`",DiacriticalAcute:"´",DiacriticalTilde:"˜",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",grave:"`"};const aA={cent:"¢",pound:"£",curren:"¤",yen:"¥",euro:"€",dollar:"$",fnof:"ƒ",inr:"₹",af:"؋",birr:"ብር",peso:"₱",rub:"₽",won:"₩",yuan:"¥",cedil:"¸"};const cA={frac12:"½",half:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄"};const lA={trade:"™",TRADE:"™",telrec:"⌕",target:"⌖",ulcorn:"⌜",ulcorner:"⌜",urcorn:"⌝",urcorner:"⌝",dlcorn:"⌞",llcorner:"⌞",drcorn:"⌟",lrcorner:"⌟",intercal:"⊺",intcal:"⊺",oplus:"⊕",CirclePlus:"⊕",ominus:"⊖",CircleMinus:"⊖",otimes:"⊗",CircleTimes:"⊗",osol:"⊘",odot:"⊙",CircleDot:"⊙",oast:"⊛",circledast:"⊛",odash:"⊝",circleddash:"⊝",ocirc:"⊚",circledcirc:"⊚",boxplus:"⊞",plusb:"⊞",boxminus:"⊟",minusb:"⊟",boxtimes:"⊠",timesb:"⊠",boxdot:"⊡",sdotb:"⊡",veebar:"⊻",vee:"∨",barvee:"⊽",and:"∧",wedge:"∧",Cap:"⋒",Cup:"⋓",Fork:"⋔",pitchfork:"⋔",epar:"⋕",ltlarr:"⥶",nvap:"≍⃒",nvsim:"∼⃒",nvge:"≥⃒",nvle:"≤⃒",nvlt:"<⃒",nvgt:">⃒",nvltrie:"⊴⃒",nvrtrie:"⊵⃒",Vdash:"⊩",dashv:"⊣",vDash:"⊨",Vvdash:"⊪",nvdash:"⊬",nvDash:"⊭",nVdash:"⊮",nVDash:"⊯"};const AA={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};const uA={nbsp:" ",copy:"©",reg:"®",trade:"™",mdash:"—",ndash:"–",hellip:"…",laquo:"«",raquo:"»",lsquo:"‘",rsquo:"’",ldquo:"“",rdquo:"”",bull:"•",para:"¶",sect:"§",deg:"°",frac12:"½",frac14:"¼",frac34:"¾"};const dA=Object.freeze({ALLOW:"allow",BLOCK:"block",THROW:"throw"});const gA=new Set("!?\\\\/[]$%{}^&*()<>|+");function EntityDecoder_validateEntityName(e){if(e[0]==="#"){throw new Error(`[EntityReplacer] Invalid character '#' in entity name: "${e}"`)}for(const t of e){if(gA.has(t)){throw new Error(`[EntityReplacer] Invalid character '${t}' in entity name: "${e}"`)}}return e}function mergeEntityMaps(...e){const t=Object.create(null);for(const r of e){if(!r)continue;for(const e of Object.keys(r)){const n=r[e];if(typeof n==="string"){t[e]=n}else if(n&&typeof n==="object"&&n.val!==undefined){const r=n.val;if(typeof r==="string"){t[e]=r}}}}return t}const pA="external";const hA="base";const mA="all";function parseLimitTiers(e){if(!e||e===pA)return new Set([pA]);if(e===mA)return new Set([mA]);if(e===hA)return new Set([hA]);if(Array.isArray(e))return new Set(e);return new Set([pA])}const fA=Object.freeze({allow:0,leave:1,remove:2,throw:3});const CA=new Set([9,10,13]);function parseNCRConfig(e){if(!e){return{xmlVersion:1,onLevel:fA.allow,nullLevel:fA.remove}}const t=e.xmlVersion===1.1?1.1:1;const r=fA[e.onNCR]??fA.allow;const n=fA[e.nullNCR]??fA.remove;const s=Math.max(n,fA.remove);return{xmlVersion:t,onLevel:r,nullLevel:s}}class EntityDecoder{constructor(e={}){this._limit=e.limit||{};this._maxTotalExpansions=this._limit.maxTotalExpansions||0;this._maxExpandedLength=this._limit.maxExpandedLength||0;this._postCheck=typeof e.postCheck==="function"?e.postCheck:e=>e;this._limitTiers=parseLimitTiers(this._limit.applyLimitsTo??pA);this._numericAllowed=e.numericAllowed??true;this._baseMap=mergeEntityMaps(AA,e.namedEntities||null);this._externalMap=Object.create(null);this._inputMap=Object.create(null);this._totalExpansions=0;this._expandedLength=0;this._removeSet=new Set(e.remove&&Array.isArray(e.remove)?e.remove:[]);this._leaveSet=new Set(e.leave&&Array.isArray(e.leave)?e.leave:[]);const t=parseNCRConfig(e.ncr);this._ncrXmlVersion=t.xmlVersion;this._ncrOnLevel=t.onLevel;this._ncrNullLevel=t.nullLevel;this._onExternalEntity=typeof e.onExternalEntity==="function"?e.onExternalEntity:null;this._onInputEntity=typeof e.onInputEntity==="function"?e.onInputEntity:null}_applyRegistrationHook(e,t,r,n){if(!e)return true;const s=e(t,r);if(s===dA.BLOCK)return false;if(s===dA.THROW){throw new Error(`[EntityDecoder] Registration of ${n} entity "&${t};" was rejected by hook`)}return true}setExternalEntities(e){if(e){for(const t of Object.keys(e)){EntityDecoder_validateEntityName(t)}}if(!this._onExternalEntity){this._externalMap=mergeEntityMaps(e);return}const t=mergeEntityMaps(e);const r=Object.create(null);for(const[e,n]of Object.entries(t)){if(this._applyRegistrationHook(this._onExternalEntity,e,n,"external")){r[e]=n}}this._externalMap=r}addExternalEntity(e,t){EntityDecoder_validateEntityName(e);if(typeof t==="string"&&t.indexOf("&")===-1){if(this._applyRegistrationHook(this._onExternalEntity,e,t,"external")){this._externalMap[e]=t}}}addInputEntities(e){this._totalExpansions=0;this._expandedLength=0;if(!this._onInputEntity){this._inputMap=mergeEntityMaps(e);return}const t=mergeEntityMaps(e);const r=Object.create(null);for(const[e,n]of Object.entries(t)){if(this._applyRegistrationHook(this._onInputEntity,e,n,"input")){r[e]=n}}this._inputMap=r}reset(){this._inputMap=Object.create(null);this._totalExpansions=0;this._expandedLength=0;return this}setXmlVersion(e){this._ncrXmlVersion=e===1.1?1.1:1}decode(e){if(typeof e!=="string"||e.length===0)return e;if(e.indexOf("&")===-1)return e;const t=e;const r=[];const n=e.length;let s=0;let i=0;const o=this._maxTotalExpansions>0;const a=this._maxExpandedLength>0;const c=o||a;while(i=n||e.charCodeAt(t)!==59){i++;continue}const l=e.slice(i+1,t);if(l.length===0){i++;continue}let A;let u;if(this._removeSet.has(l)){A="";if(u===undefined){u=pA}}else if(this._leaveSet.has(l)){i++;continue}else if(l.charCodeAt(0)===35){const e=this._resolveNCR(l);if(e===undefined){i++;continue}A=e;u=hA}else{const e=this._resolveName(l);A=e?.value;u=e?.tier}if(A===undefined){i++;continue}if(i>s)r.push(e.slice(s,i));r.push(A);s=t+1;i=s;if(c&&this._tierCounts(u)){if(o){this._totalExpansions++;if(this._totalExpansions>this._maxTotalExpansions){throw new Error(`[EntityReplacer] Entity expansion count limit exceeded: `+`${this._totalExpansions} > ${this._maxTotalExpansions}`)}}if(a){const e=A.length-(l.length+2);if(e>0){this._expandedLength+=e;if(this._expandedLength>this._maxExpandedLength){throw new Error(`[EntityReplacer] Expanded content length limit exceeded: `+`${this._expandedLength} > ${this._maxExpandedLength}`)}}}}}if(s=55296&&e<=57343)return fA.remove;if(this._ncrXmlVersion===1){if(e>=1&&e<=31&&!CA.has(e))return fA.remove}return-1}_applyNCRAction(e,t,r){switch(e){case fA.allow:return String.fromCodePoint(r);case fA.remove:return"";case fA.leave:return undefined;case fA.throw:throw new Error(`[EntityDecoder] Prohibited numeric character reference `+`&${t}; (U+${r.toString(16).toUpperCase().padStart(4,"0")})`);default:return String.fromCodePoint(r)}}_resolveNCR(e){const t=e.charCodeAt(1);let r;if(t===120||t===88){r=parseInt(e.slice(2),16)}else{r=parseInt(e.slice(1),10)}if(Number.isNaN(r)||r<0||r>1114111)return undefined;const n=this._classifyNCR(r);if(!this._numericAllowed&&n/]/i},{id:"html-script-close",description:"<\/script closing tag",pattern:/<\/script[\s>]/i},{id:"html-javascript-protocol",description:"javascript: URI scheme (with optional whitespace/encoding)",pattern:/j[\t\n\r ]*a[\t\n\r ]*v[\t\n\r ]*a[\t\n\r ]*s[\t\n\r ]*c[\t\n\r ]*r[\t\n\r ]*i[\t\n\r ]*p[\t\n\r ]*t[\t\n\r ]*:/i},{id:"html-vbscript-protocol",description:"vbscript: URI scheme",pattern:/vbscript[\t\n\r ]*:/i},{id:"html-data-html",description:"data:text/html URI — can execute scripts in browsers",pattern:/data[\t\n\r ]*:[\t\n\r ]*text\/html/i},{id:"html-data-xhtml",description:"data:application/xhtml+xml URI",pattern:/data[\t\n\r ]*:[\t\n\r ]*application\/xhtml/i},{id:"html-data-svg",description:"data:image/svg+xml URI — can execute scripts",pattern:/data[\t\n\r ]*:[\t\n\r ]*image\/svg\+xml/i},{id:"html-inline-event-handler",description:"Inline event handler attributes: onclick=, onerror=, onload=, etc.",pattern:/\bon\w{1,30}\s*=/i},{id:"html-entity-obfuscated-script",description:"HTML-entity-encoded