From 6b4f5aef165838ec1ad52a4afc54d47295cee1d5 Mon Sep 17 00:00:00 2001 From: MK Date: Thu, 8 Oct 2026 13:50:02 +0800 Subject: [PATCH 1/5] fix: prevent executable planting during sfw lookup --- README.md | 2 + dist/azure/index.mjs | 52 ++++++++++---------- dist/gitlab/index.mjs | 52 ++++++++++---------- dist/index.mjs | 2 +- src/ci/install-sfw.ts | 2 +- src/ci/process.test.ts | 54 ++++++++++++++++++++- src/ci/process.ts | 48 ++++++++++++++----- src/gitlab/install-sfw.test.ts | 2 +- src/install-sfw-path.test.ts | 87 ++++++++++++++++++++++++++++++++++ src/install-sfw.test.ts | 27 +++++------ src/install-sfw.ts | 14 +----- 11 files changed, 246 insertions(+), 96 deletions(-) create mode 100644 src/install-sfw-path.test.ts diff --git a/README.md b/README.md index 79d3974..7034438 100644 --- a/README.md +++ b/README.md @@ -293,6 +293,8 @@ steps: In the action log you will see `Using existing sfw on PATH: …` when this composition is detected, vs. `Installing sfw from …` for the bundled-download path. +Existing `sfw` executables must be in an absolute `PATH` directory. The current working directory and empty or relative `PATH` entries are ignored. On Windows, setup-vp looks for the native `sfw.exe` executable. + > [!NOTE] > **macOS / Windows require Vite+ v0.1.23 or newer.** Earlier `vp` releases didn't honor `HTTPS_PROXY` / `SSL_CERT_FILE`, so `sfw vp install` failed the TLS handshake on macOS / Windows (it always worked on Linux). The action's default `version: latest` satisfies this; if you pin an older `vp` and enable `sfw` on macOS / Windows, the install will fail the handshake. On a runner architecture with no published `sfw` binary (e.g. `riscv64`), the action logs a warning and falls back to plain `vp install`. diff --git a/dist/azure/index.mjs b/dist/azure/index.mjs index aaad74e..3793472 100644 --- a/dist/azure/index.mjs +++ b/dist/azure/index.mjs @@ -1,14 +1,14 @@ -import{createRequire as e}from"node:module";import{createWriteStream as t,existsSync as n,mkdirSync as r,mkdtempSync as i,readFileSync as a,readdirSync as o,rmSync as s,statSync as c,writeFileSync as l}from"node:fs";import u,{basename as d,dirname as f,isAbsolute as p,join as m,relative as h,sep as g}from"node:path";import{pathToFileURL as _}from"node:url";import{spawn as v,spawnSync as y}from"node:child_process";import{homedir as b,tmpdir as x}from"node:os";import{chmod as S,mkdir as C,mkdtemp as w,rename as T,rm as E,stat as ee}from"node:fs/promises";import{setTimeout as te}from"node:timers/promises";import{randomUUID as ne}from"node:crypto";var __commonJSMin=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),D=/* @__PURE__ */ e(import.meta.url),O=/* @__PURE__ */ __commonJSMin((e=>{let t=Symbol.for(`yaml.alias`),n=Symbol.for(`yaml.document`),r=Symbol.for(`yaml.map`),i=Symbol.for(`yaml.pair`),a=Symbol.for(`yaml.scalar`),o=Symbol.for(`yaml.seq`),s=Symbol.for(`yaml.node.type`),isAlias=e=>!!e&&typeof e==`object`&&e[s]===t,isDocument=e=>!!e&&typeof e==`object`&&e[s]===n,isMap=e=>!!e&&typeof e==`object`&&e[s]===r,isPair=e=>!!e&&typeof e==`object`&&e[s]===i,isScalar=e=>!!e&&typeof e==`object`&&e[s]===a,isSeq=e=>!!e&&typeof e==`object`&&e[s]===o;function isCollection(e){if(e&&typeof e==`object`)switch(e[s]){case r:case o:return!0}return!1}function isNode(e){if(e&&typeof e==`object`)switch(e[s]){case t:case r:case a:case o:return!0}return!1}e.ALIAS=t,e.DOC=n,e.MAP=r,e.NODE_TYPE=s,e.PAIR=i,e.SCALAR=a,e.SEQ=o,e.hasAnchor=e=>(isScalar(e)||isCollection(e))&&!!e.anchor,e.isAlias=isAlias,e.isCollection=isCollection,e.isDocument=isDocument,e.isMap=isMap,e.isNode=isNode,e.isPair=isPair,e.isScalar=isScalar,e.isSeq=isSeq})),k=/* @__PURE__ */ __commonJSMin((e=>{var t=O();let n=Symbol(`break visit`),r=Symbol(`skip children`),i=Symbol(`remove node`);function visit(e,n){let r=initVisitor(n);t.isDocument(e)?visit_(null,e.contents,r,Object.freeze([e]))===i&&(e.contents=null):visit_(null,e,r,Object.freeze([]))}visit.BREAK=n,visit.SKIP=r,visit.REMOVE=i;function visit_(e,r,a,o){let s=callVisitor(e,r,a,o);if(t.isNode(s)||t.isPair(s))return replaceNode(e,o,s),visit_(e,s,a,o);if(typeof s!=`symbol`){if(t.isCollection(r)){o=Object.freeze(o.concat(r));for(let e=0;e{var t=O(),n=k();let r={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},escapeTagName=e=>e.replace(/[!,[\]{}]/g,e=>r[e]);var i=class Directives{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},Directives.defaultYaml,e),this.tags=Object.assign({},Directives.defaultTags,t)}clone(){let e=new Directives(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new Directives(this.yaml,this.tags);switch(this.yaml.version){case`1.1`:this.atNextDocument=!0;break;case`1.2`:this.atNextDocument=!1,this.yaml={explicit:Directives.defaultYaml.explicit,version:`1.2`},this.tags=Object.assign({},Directives.defaultTags)}return e}add(e,t){this.atNextDocument&&=(this.yaml={explicit:Directives.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},Directives.defaultTags),!1);let n=e.trim().split(/[ \t]+/),r=n.shift();switch(r){case`%TAG`:{if(n.length!==2&&(t(0,`%TAG directive should contain exactly two parts`),n.length<2))return!1;let[e,r]=n;return this.tags[e]=r,!0}case`%YAML`:{if(this.yaml.explicit=!0,n.length!==1)return t(0,`%YAML directive should contain exactly one part`),!1;let[e]=n;if(e===`1.1`||e===`1.2`)return this.yaml.version=e,!0;{let n=/^\d+\.\d+$/.test(e);return t(6,`Unsupported YAML version ${e}`,n),!1}}default:return t(0,`Unknown directive ${r}`,!0),!1}}tagName(e,t){if(e===`!`)return`!`;if(e[0]!==`!`)return t(`Not a valid tag: ${e}`),null;if(e[1]===`<`){let n=e.slice(2,-1);return n===`!`||n===`!!`?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==`>`&&t(`Verbatim tags must end with a >`),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return n===`!`?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+escapeTagName(e.substring(n.length));return e[0]===`!`?e:`!<${e}>`}toString(e){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],i=Object.entries(this.tags),a;if(e&&i.length>0&&t.isNode(e.contents)){let r={};n.visit(e.contents,(e,n)=>{t.isNode(n)&&n.tag&&(r[n.tag]=!0)}),a=Object.keys(r)}else a=[];for(let[t,n]of i)(t!==`!!`||n!==`tag:yaml.org,2002:`)&&(!e||a.some(e=>e.startsWith(n)))&&r.push(`%TAG ${t} ${n}`);return r.join(` -`)}};i.defaultYaml={explicit:!1,version:`1.2`},i.defaultTags={"!!":`tag:yaml.org,2002:`},e.Directives=i})),ie=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=k();function anchorIsValid(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function anchorNames(e){let t=/* @__PURE__ */ new Set;return n.visit(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function findNewAnchor(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function createNodeAnchors(e,n){let r=[],i=/* @__PURE__ */ new Map,a=null;return{onAnchor:t=>{r.push(t),a??=anchorNames(e);let i=findNewAnchor(n,a);return a.add(i),i},setAnchors:()=>{for(let e of r){let n=i.get(e);if(typeof n==`object`&&n.anchor&&(t.isScalar(n.node)||t.isCollection(n.node)))n.node.anchor=n.anchor;else{let t=/* @__PURE__ */ Error(`Failed to resolve repeated object (this should not happen)`);throw t.source=e,t}}},sourceObjects:i}}e.anchorIsValid=anchorIsValid,e.anchorNames=anchorNames,e.createNodeAnchors=createNodeAnchors,e.findNewAnchor=findNewAnchor})),ae=/* @__PURE__ */ __commonJSMin((e=>{function applyReviver(e,t,n,r){if(r&&typeof r==`object`){if(Array.isArray(r))for(let t=0,n=r.length;t{var t=O();function toJS(e,n,r){if(Array.isArray(e))return e.map((e,t)=>toJS(e,String(t),r));if(e&&typeof e.toJSON==`function`){if(!r||!t.hasAnchor(e))return e.toJSON(n,r);let i={aliasCount:0,count:1,res:void 0};r.anchors.set(e,i),r.onCreate=e=>{i.res=e,delete r.onCreate};let a=e.toJSON(n,r);return r.onCreate&&r.onCreate(a),a}return typeof e==`bigint`&&!r?.keep?Number(e):e}e.toJS=toJS})),j=/* @__PURE__ */ __commonJSMin((e=>{var t=ae(),n=O(),r=A();e.NodeBase=class{constructor(e){Object.defineProperty(this,n.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:i,maxAliasCount:a,onAnchor:o,reviver:s}={}){if(!n.isDocument(e))throw TypeError(`A document argument is required`);let c={anchors:/* @__PURE__ */ new Map,doc:e,keep:!0,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof a==`number`?a:100},l=r.toJS(this,``,c);if(typeof o==`function`)for(let{count:e,res:t}of c.anchors.values())o(t,e);return typeof s==`function`?t.applyReviver(s,{"":l},``,l):l}}})),M=/* @__PURE__ */ __commonJSMin((e=>{var t=ie(),n=k(),r=O(),i=j(),a=A(),Alias=class extends i.NodeBase{constructor(e){super(r.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let i;t?.aliasResolveCache?i=t.aliasResolveCache:(i=[],n.visit(e,{Node:(e,t)=>{(r.isAlias(t)||r.hasAnchor(t))&&i.push(t)}}),t&&(t.aliasResolveCache=i));let o;for(let e of i){if(e===this)break;e.anchor===this.source&&(o=e)}if(o&&t){let{anchors:e,doc:n,maxAliasCount:r}=t,i=e.get(o); +import{createRequire as e}from"node:module";import{accessSync as t,constants as n,createWriteStream as r,existsSync as i,mkdirSync as a,mkdtempSync as o,readFileSync as s,readdirSync as c,realpathSync as l,rmSync as u,statSync as d,writeFileSync as f}from"node:fs";import p,{basename as m,dirname as h,isAbsolute as g,join as _,relative as v,sep as y}from"node:path";import{pathToFileURL as b}from"node:url";import{spawn as x,spawnSync as S}from"node:child_process";import{homedir as C,tmpdir as w}from"node:os";import{chmod as T,mkdir as E,mkdtemp as ee,rename as te,rm as ne,stat as re}from"node:fs/promises";import{setTimeout as ie}from"node:timers/promises";import{randomUUID as ae}from"node:crypto";var __commonJSMin=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),D=/* @__PURE__ */ e(import.meta.url),O=/* @__PURE__ */ __commonJSMin((e=>{let t=Symbol.for(`yaml.alias`),n=Symbol.for(`yaml.document`),r=Symbol.for(`yaml.map`),i=Symbol.for(`yaml.pair`),a=Symbol.for(`yaml.scalar`),o=Symbol.for(`yaml.seq`),s=Symbol.for(`yaml.node.type`),isAlias=e=>!!e&&typeof e==`object`&&e[s]===t,isDocument=e=>!!e&&typeof e==`object`&&e[s]===n,isMap=e=>!!e&&typeof e==`object`&&e[s]===r,isPair=e=>!!e&&typeof e==`object`&&e[s]===i,isScalar=e=>!!e&&typeof e==`object`&&e[s]===a,isSeq=e=>!!e&&typeof e==`object`&&e[s]===o;function isCollection(e){if(e&&typeof e==`object`)switch(e[s]){case r:case o:return!0}return!1}function isNode(e){if(e&&typeof e==`object`)switch(e[s]){case t:case r:case a:case o:return!0}return!1}e.ALIAS=t,e.DOC=n,e.MAP=r,e.NODE_TYPE=s,e.PAIR=i,e.SCALAR=a,e.SEQ=o,e.hasAnchor=e=>(isScalar(e)||isCollection(e))&&!!e.anchor,e.isAlias=isAlias,e.isCollection=isCollection,e.isDocument=isDocument,e.isMap=isMap,e.isNode=isNode,e.isPair=isPair,e.isScalar=isScalar,e.isSeq=isSeq})),k=/* @__PURE__ */ __commonJSMin((e=>{var t=O();let n=Symbol(`break visit`),r=Symbol(`skip children`),i=Symbol(`remove node`);function visit(e,n){let r=initVisitor(n);t.isDocument(e)?visit_(null,e.contents,r,Object.freeze([e]))===i&&(e.contents=null):visit_(null,e,r,Object.freeze([]))}visit.BREAK=n,visit.SKIP=r,visit.REMOVE=i;function visit_(e,r,a,o){let s=callVisitor(e,r,a,o);if(t.isNode(s)||t.isPair(s))return replaceNode(e,o,s),visit_(e,s,a,o);if(typeof s!=`symbol`){if(t.isCollection(r)){o=Object.freeze(o.concat(r));for(let e=0;e{var t=O(),n=k();let r={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},escapeTagName=e=>e.replace(/[!,[\]{}]/g,e=>r[e]);var i=class Directives{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},Directives.defaultYaml,e),this.tags=Object.assign({},Directives.defaultTags,t)}clone(){let e=new Directives(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new Directives(this.yaml,this.tags);switch(this.yaml.version){case`1.1`:this.atNextDocument=!0;break;case`1.2`:this.atNextDocument=!1,this.yaml={explicit:Directives.defaultYaml.explicit,version:`1.2`},this.tags=Object.assign({},Directives.defaultTags)}return e}add(e,t){this.atNextDocument&&=(this.yaml={explicit:Directives.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},Directives.defaultTags),!1);let n=e.trim().split(/[ \t]+/),r=n.shift();switch(r){case`%TAG`:{if(n.length!==2&&(t(0,`%TAG directive should contain exactly two parts`),n.length<2))return!1;let[e,r]=n;return this.tags[e]=r,!0}case`%YAML`:{if(this.yaml.explicit=!0,n.length!==1)return t(0,`%YAML directive should contain exactly one part`),!1;let[e]=n;if(e===`1.1`||e===`1.2`)return this.yaml.version=e,!0;{let n=/^\d+\.\d+$/.test(e);return t(6,`Unsupported YAML version ${e}`,n),!1}}default:return t(0,`Unknown directive ${r}`,!0),!1}}tagName(e,t){if(e===`!`)return`!`;if(e[0]!==`!`)return t(`Not a valid tag: ${e}`),null;if(e[1]===`<`){let n=e.slice(2,-1);return n===`!`||n===`!!`?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==`>`&&t(`Verbatim tags must end with a >`),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return n===`!`?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+escapeTagName(e.substring(n.length));return e[0]===`!`?e:`!<${e}>`}toString(e){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],i=Object.entries(this.tags),a;if(e&&i.length>0&&t.isNode(e.contents)){let r={};n.visit(e.contents,(e,n)=>{t.isNode(n)&&n.tag&&(r[n.tag]=!0)}),a=Object.keys(r)}else a=[];for(let[t,n]of i)(t!==`!!`||n!==`tag:yaml.org,2002:`)&&(!e||a.some(e=>e.startsWith(n)))&&r.push(`%TAG ${t} ${n}`);return r.join(` +`)}};i.defaultYaml={explicit:!1,version:`1.2`},i.defaultTags={"!!":`tag:yaml.org,2002:`},e.Directives=i})),se=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=k();function anchorIsValid(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function anchorNames(e){let t=/* @__PURE__ */ new Set;return n.visit(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function findNewAnchor(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function createNodeAnchors(e,n){let r=[],i=/* @__PURE__ */ new Map,a=null;return{onAnchor:t=>{r.push(t),a??=anchorNames(e);let i=findNewAnchor(n,a);return a.add(i),i},setAnchors:()=>{for(let e of r){let n=i.get(e);if(typeof n==`object`&&n.anchor&&(t.isScalar(n.node)||t.isCollection(n.node)))n.node.anchor=n.anchor;else{let t=/* @__PURE__ */ Error(`Failed to resolve repeated object (this should not happen)`);throw t.source=e,t}}},sourceObjects:i}}e.anchorIsValid=anchorIsValid,e.anchorNames=anchorNames,e.createNodeAnchors=createNodeAnchors,e.findNewAnchor=findNewAnchor})),ce=/* @__PURE__ */ __commonJSMin((e=>{function applyReviver(e,t,n,r){if(r&&typeof r==`object`){if(Array.isArray(r))for(let t=0,n=r.length;t{var t=O();function toJS(e,n,r){if(Array.isArray(e))return e.map((e,t)=>toJS(e,String(t),r));if(e&&typeof e.toJSON==`function`){if(!r||!t.hasAnchor(e))return e.toJSON(n,r);let i={aliasCount:0,count:1,res:void 0};r.anchors.set(e,i),r.onCreate=e=>{i.res=e,delete r.onCreate};let a=e.toJSON(n,r);return r.onCreate&&r.onCreate(a),a}return typeof e==`bigint`&&!r?.keep?Number(e):e}e.toJS=toJS})),le=/* @__PURE__ */ __commonJSMin((e=>{var t=ce(),n=O(),r=A();e.NodeBase=class{constructor(e){Object.defineProperty(this,n.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:i,maxAliasCount:a,onAnchor:o,reviver:s}={}){if(!n.isDocument(e))throw TypeError(`A document argument is required`);let c={anchors:/* @__PURE__ */ new Map,doc:e,keep:!0,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof a==`number`?a:100},l=r.toJS(this,``,c);if(typeof o==`function`)for(let{count:e,res:t}of c.anchors.values())o(t,e);return typeof s==`function`?t.applyReviver(s,{"":l},``,l):l}}})),j=/* @__PURE__ */ __commonJSMin((e=>{var t=se(),n=k(),r=O(),i=le(),a=A(),Alias=class extends i.NodeBase{constructor(e){super(r.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let i;t?.aliasResolveCache?i=t.aliasResolveCache:(i=[],n.visit(e,{Node:(e,t)=>{(r.isAlias(t)||r.hasAnchor(t))&&i.push(t)}}),t&&(t.aliasResolveCache=i));let o;for(let e of i){if(e===this)break;e.anchor===this.source&&(o=e)}if(o&&t){let{anchors:e,doc:n,maxAliasCount:r}=t,i=e.get(o); /* istanbul ignore if */ -if(i||=(a.toJS(o,null,t),e.get(o)),i?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(r>=0&&(i.count+=1,i.aliasCount===0&&(i.aliasCount=getAliasCount(n,o,e)),i.count*i.aliasCount>r))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`)}return o}toJSON(e,t){if(!t)return{source:this.source};let n=this.resolve(t.doc,t);if(!n){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}return t.anchors.get(n).res}toString(e,n,r){let i=`*${this.source}`;if(e){if(t.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${i} `}return i}};function getAliasCount(e,t,n){if(r.isAlias(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(r.isCollection(t)){let r=0;for(let i of t.items){let t=getAliasCount(e,i,n);t>r&&(r=t)}return r}if(r.isPair(t)){let r=getAliasCount(e,t.key,n),i=getAliasCount(e,t.value,n);return Math.max(r,i)}return 1}e.Alias=Alias})),N=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=j(),r=A();let isScalarValue=e=>!e||typeof e!=`function`&&typeof e!=`object`;var Scalar=class extends n.NodeBase{constructor(e){super(t.SCALAR),this.value=e}toJSON(e,t){return t?.keep?this.value:r.toJS(this.value,e,t)}toString(){return String(this.value)}};Scalar.BLOCK_FOLDED=`BLOCK_FOLDED`,Scalar.BLOCK_LITERAL=`BLOCK_LITERAL`,Scalar.PLAIN=`PLAIN`,Scalar.QUOTE_DOUBLE=`QUOTE_DOUBLE`,Scalar.QUOTE_SINGLE=`QUOTE_SINGLE`,e.Scalar=Scalar,e.isScalarValue=isScalarValue})),P=/* @__PURE__ */ __commonJSMin((e=>{var t=M(),n=O(),r=N();function findTagObject(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function createNode(e,i,a){if(n.isDocument(e)&&(e=e.contents),n.isNode(e))return e;if(n.isPair(e)){let t=a.schema[n.MAP].createNode?.(a.schema,null,a);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:o,onAnchor:s,onTagObj:c,schema:l,sourceObjects:u}=a,d;if(o&&e&&typeof e==`object`){if(d=u.get(e),d)return d.anchor??(d.anchor=s(e)),new t.Alias(d.anchor);d={anchor:null,node:null},u.set(e,d)}i?.startsWith(`!!`)&&(i=`tag:yaml.org,2002:`+i.slice(2));let f=findTagObject(e,i,l.tags);if(!f){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new r.Scalar(e);return d&&(d.node=t),t}f=e instanceof Map?l[n.MAP]:Symbol.iterator in Object(e)?l[n.SEQ]:l[n.MAP]}c&&(c(f),delete a.onTagObj);let p=f?.createNode?f.createNode(a.schema,e,a):typeof f?.nodeClass?.from==`function`?f.nodeClass.from(a.schema,e,a):new r.Scalar(e);return i?p.tag=i:f.default||(p.tag=f.tag),d&&(d.node=p),p}e.createNode=createNode})),oe=/* @__PURE__ */ __commonJSMin((e=>{var t=P(),n=O(),r=j();function collectionFromPath(e,n,r){let i=r;for(let e=n.length-1;e>=0;--e){let t=n[e];if(typeof t==`number`&&Number.isInteger(t)&&t>=0){let e=[];e[t]=i,i=e}else i=/* @__PURE__ */ new Map([[t,i]])}return t.createNode(i,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:/* @__PURE__ */ new Map})}let isEmptyPath=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done;e.Collection=class extends r.NodeBase{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>n.isNode(t)||n.isPair(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(isEmptyPath(e))this.add(t);else{let[r,...i]=e,a=this.get(r,!0);if(n.isCollection(a))a.addIn(i,t);else if(a===void 0&&this.schema)this.set(r,collectionFromPath(this.schema,i,t));else throw Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}deleteIn(e){let[t,...r]=e;if(r.length===0)return this.delete(t);let i=this.get(t,!0);if(n.isCollection(i))return i.deleteIn(r);throw Error(`Expected YAML collection at ${t}. Remaining path: ${r}`)}getIn(e,t){let[r,...i]=e,a=this.get(r,!0);return i.length===0?!t&&n.isScalar(a)?a.value:a:n.isCollection(a)?a.getIn(i,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!n.isPair(t))return!1;let r=t.value;return r==null||e&&n.isScalar(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(e){let[t,...r]=e;if(r.length===0)return this.has(t);let i=this.get(t,!0);return n.isCollection(i)?i.hasIn(r):!1}setIn(e,t){let[r,...i]=e;if(i.length===0)this.set(r,t);else{let e=this.get(r,!0);if(n.isCollection(e))e.setIn(i,t);else if(e===void 0&&this.schema)this.set(r,collectionFromPath(this.schema,i,t));else throw Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}},e.collectionFromPath=collectionFromPath,e.isEmptyPath=isEmptyPath})),F=/* @__PURE__ */ __commonJSMin((e=>{let stringifyComment=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function indentComment(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}e.indentComment=indentComment,e.lineComment=(e,t,n)=>e.endsWith(` +if(i||=(a.toJS(o,null,t),e.get(o)),i?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(r>=0&&(i.count+=1,i.aliasCount===0&&(i.aliasCount=getAliasCount(n,o,e)),i.count*i.aliasCount>r))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`)}return o}toJSON(e,t){if(!t)return{source:this.source};let n=this.resolve(t.doc,t);if(!n){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}return t.anchors.get(n).res}toString(e,n,r){let i=`*${this.source}`;if(e){if(t.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${i} `}return i}};function getAliasCount(e,t,n){if(r.isAlias(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(r.isCollection(t)){let r=0;for(let i of t.items){let t=getAliasCount(e,i,n);t>r&&(r=t)}return r}if(r.isPair(t)){let r=getAliasCount(e,t.key,n),i=getAliasCount(e,t.value,n);return Math.max(r,i)}return 1}e.Alias=Alias})),M=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=le(),r=A();let isScalarValue=e=>!e||typeof e!=`function`&&typeof e!=`object`;var Scalar=class extends n.NodeBase{constructor(e){super(t.SCALAR),this.value=e}toJSON(e,t){return t?.keep?this.value:r.toJS(this.value,e,t)}toString(){return String(this.value)}};Scalar.BLOCK_FOLDED=`BLOCK_FOLDED`,Scalar.BLOCK_LITERAL=`BLOCK_LITERAL`,Scalar.PLAIN=`PLAIN`,Scalar.QUOTE_DOUBLE=`QUOTE_DOUBLE`,Scalar.QUOTE_SINGLE=`QUOTE_SINGLE`,e.Scalar=Scalar,e.isScalarValue=isScalarValue})),N=/* @__PURE__ */ __commonJSMin((e=>{var t=j(),n=O(),r=M();function findTagObject(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function createNode(e,i,a){if(n.isDocument(e)&&(e=e.contents),n.isNode(e))return e;if(n.isPair(e)){let t=a.schema[n.MAP].createNode?.(a.schema,null,a);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:o,onAnchor:s,onTagObj:c,schema:l,sourceObjects:u}=a,d;if(o&&e&&typeof e==`object`){if(d=u.get(e),d)return d.anchor??(d.anchor=s(e)),new t.Alias(d.anchor);d={anchor:null,node:null},u.set(e,d)}i?.startsWith(`!!`)&&(i=`tag:yaml.org,2002:`+i.slice(2));let f=findTagObject(e,i,l.tags);if(!f){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new r.Scalar(e);return d&&(d.node=t),t}f=e instanceof Map?l[n.MAP]:Symbol.iterator in Object(e)?l[n.SEQ]:l[n.MAP]}c&&(c(f),delete a.onTagObj);let p=f?.createNode?f.createNode(a.schema,e,a):typeof f?.nodeClass?.from==`function`?f.nodeClass.from(a.schema,e,a):new r.Scalar(e);return i?p.tag=i:f.default||(p.tag=f.tag),d&&(d.node=p),p}e.createNode=createNode})),P=/* @__PURE__ */ __commonJSMin((e=>{var t=N(),n=O(),r=le();function collectionFromPath(e,n,r){let i=r;for(let e=n.length-1;e>=0;--e){let t=n[e];if(typeof t==`number`&&Number.isInteger(t)&&t>=0){let e=[];e[t]=i,i=e}else i=/* @__PURE__ */ new Map([[t,i]])}return t.createNode(i,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:/* @__PURE__ */ new Map})}let isEmptyPath=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done;e.Collection=class extends r.NodeBase{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>n.isNode(t)||n.isPair(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(isEmptyPath(e))this.add(t);else{let[r,...i]=e,a=this.get(r,!0);if(n.isCollection(a))a.addIn(i,t);else if(a===void 0&&this.schema)this.set(r,collectionFromPath(this.schema,i,t));else throw Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}deleteIn(e){let[t,...r]=e;if(r.length===0)return this.delete(t);let i=this.get(t,!0);if(n.isCollection(i))return i.deleteIn(r);throw Error(`Expected YAML collection at ${t}. Remaining path: ${r}`)}getIn(e,t){let[r,...i]=e,a=this.get(r,!0);return i.length===0?!t&&n.isScalar(a)?a.value:a:n.isCollection(a)?a.getIn(i,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!n.isPair(t))return!1;let r=t.value;return r==null||e&&n.isScalar(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(e){let[t,...r]=e;if(r.length===0)return this.has(t);let i=this.get(t,!0);return n.isCollection(i)?i.hasIn(r):!1}setIn(e,t){let[r,...i]=e;if(i.length===0)this.set(r,t);else{let e=this.get(r,!0);if(n.isCollection(e))e.setIn(i,t);else if(e===void 0&&this.schema)this.set(r,collectionFromPath(this.schema,i,t));else throw Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}},e.collectionFromPath=collectionFromPath,e.isEmptyPath=isEmptyPath})),F=/* @__PURE__ */ __commonJSMin((e=>{let stringifyComment=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function indentComment(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}e.indentComment=indentComment,e.lineComment=(e,t,n)=>e.endsWith(` `)?indentComment(n,t):n.includes(` `)?` -`+indentComment(n,t):(e.endsWith(` `)?``:` `)+n,e.stringifyComment=stringifyComment})),se=/* @__PURE__ */ __commonJSMin((e=>{let t=`block`,n=`quoted`;function foldFlowLines(e,r,i=`flow`,{indentAtStart:a,lineWidth:o=80,minContentWidth:s=20,onFold:c,onOverflow:l}={}){if(!o||o<0)return e;oo-Math.max(2,s)?d.push(0):p=o-a);let m,h,g=!1,_=-1,v=-1,y=-1;i===t&&(_=consumeMoreIndentedLines(e,_,r.length),_!==-1&&(p=_+u));for(let a;a=e[_+=1];){if(i===n&&a===`\\`){switch(v=_,e[_+1]){case`x`:_+=3;break;case`u`:_+=5;break;case`U`:_+=9;break;default:_+=1}y=_}if(a===` +`+indentComment(n,t):(e.endsWith(` `)?``:` `)+n,e.stringifyComment=stringifyComment})),ue=/* @__PURE__ */ __commonJSMin((e=>{let t=`block`,n=`quoted`;function foldFlowLines(e,r,i=`flow`,{indentAtStart:a,lineWidth:o=80,minContentWidth:s=20,onFold:c,onOverflow:l}={}){if(!o||o<0)return e;oo-Math.max(2,s)?d.push(0):p=o-a);let m,h,g=!1,_=-1,v=-1,y=-1;i===t&&(_=consumeMoreIndentedLines(e,_,r.length),_!==-1&&(p=_+u));for(let a;a=e[_+=1];){if(i===n&&a===`\\`){switch(v=_,e[_+1]){case`x`:_+=3;break;case`u`:_+=5;break;case`U`:_+=9;break;default:_+=1}y=_}if(a===` `)i===t&&(_=consumeMoreIndentedLines(e,_,r.length)),p=_+r.length+u,m=void 0;else{if(a===` `&&h&&h!==` `&&h!==` `&&h!==` `){let t=e[_+1];t&&t!==` `&&t!==` `&&t!==` `&&(m=_)}if(_>=p){if(m)d.push(m),p=m+u,m=void 0;else if(i===n){for(;h===` `||h===` `;)h=a,a=e[_+=1],g=!0;let t=_>y+1?_-2:v-1;if(f[t])return e;d.push(t),f[t]=!0,p=t+u,m=void 0}else g=!0}}h=a}if(g&&l&&l(),d.length===0)return e;c&&c();let b=e.slice(0,d[0]);for(let t=0;t{var t=N(),n=se();let getFoldOptions=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),containsDocumentMarker=e=>/^(%|---|\.\.\.)/m.test(e);function lineLengthOverLimit(e,t,n){if(!t||t<0)return!1;let r=t-n,i=e.length;if(i<=r)return!1;for(let t=0,n=0;t{var t=M(),n=ue();let getFoldOptions=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),containsDocumentMarker=e=>/^(%|---|\.\.\.)/m.test(e);function lineLengthOverLimit(e,t,n){if(!t||t<0)return!1;let r=t-n,i=e.length;if(i<=r)return!1;for(let t=0,n=0;tr)return!0;if(n=t+1,i-n<=r)return!1}return!0}function doubleQuotedString(e,t){let r=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return r;let{implicitKey:i}=t,a=t.options.doubleQuotedMinMultiLineLength,o=t.indent||(containsDocumentMarker(e)?` `:``),s=``,c=0;for(let e=0,t=r[e];t;t=r[++e])if(t===` `&&r[e+1]===`\\`&&r[e+2]===`n`&&(s+=r.slice(c,e)+`\\ `,e+=1,c=e,t=`\\`),t===`\\`)switch(r[e+1]){case`u`:{s+=r.slice(c,e);let t=r.substr(e+2,4);switch(t){case`0000`:s+=`\\0`;break;case`0007`:s+=`\\a`;break;case`000b`:s+=`\\v`;break;case`001b`:s+=`\\e`;break;case`0085`:s+=`\\N`;break;case`00a0`:s+=`\\_`;break;case`2028`:s+=`\\L`;break;case`2029`:s+=`\\P`;break;default:t.substr(0,2)===`00`?s+=`\\x`+t.substr(2):s+=r.substr(e,6)}e+=5,c=e+1}break;case`n`:if(i||r[e+2]===`"`||r.length{r=!0});let c=n.foldFlowLines(`${x}${e}${g}`,f,n.FOLD_BLOCK,s);if(!r)return`>${S}\n${f}${c}`}return a=a.replace(/\n+/g,`$&${f}`),`|${S}\n${f}${x}${a}${g}`}function plainString(e,r,i,a){let{type:o,value:s}=e,{actualString:c,implicitKey:l,indent:u,indentStep:d,inFlow:f}=r;if(l&&s.includes(` `)||f&&/[[\]{},]/.test(s))return quotedString(s,r);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(s))return l||f||!s.includes(` `)?quotedString(s,r):blockString(e,r,i,a);if(!l&&!f&&o!==t.Scalar.PLAIN&&s.includes(` -`))return blockString(e,r,i,a);if(containsDocumentMarker(s)){if(u===``)return r.forceBlockIndent=!0,blockString(e,r,i,a);if(l&&u===d)return quotedString(s,r)}let p=s.replace(/\n+/g,`$&\n${u}`);if(c){let test=e=>e.default&&e.tag!==`tag:yaml.org,2002:str`&&e.test?.test(p),{compat:e,tags:t}=r.doc.schema;if(t.some(test)||e?.some(test))return quotedString(s,r)}return l?p:n.foldFlowLines(p,u,n.FOLD_FLOW,getFoldOptions(r,!1))}function stringifyString(e,n,r,i){let{implicitKey:a,inFlow:o}=n,s=typeof e.value==`string`?e:Object.assign({},e,{value:String(e.value)}),{type:c}=e;c!==t.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(c=t.Scalar.QUOTE_DOUBLE);let _stringify=e=>{switch(e){case t.Scalar.BLOCK_FOLDED:case t.Scalar.BLOCK_LITERAL:return a||o?quotedString(s.value,n):blockString(s,n,r,i);case t.Scalar.QUOTE_DOUBLE:return doubleQuotedString(s.value,n);case t.Scalar.QUOTE_SINGLE:return singleQuotedString(s.value,n);case t.Scalar.PLAIN:return plainString(s,n,r,i);default:return null}},l=_stringify(c);if(l===null){let{defaultKeyType:e,defaultStringType:t}=n.options,r=a&&e||t;if(l=_stringify(r),l===null)throw Error(`Unsupported default string type ${r}`)}return l}e.stringifyString=stringifyString})),L=/* @__PURE__ */ __commonJSMin((e=>{var t=ie(),n=O(),r=F(),i=I();function createStringifyContext(e,t){let n=Object.assign({blockQuote:!0,commentString:r.stringifyComment,defaultKeyType:null,defaultStringType:`PLAIN`,directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:`false`,flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:`null`,simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:`true`,verifyAliasOrder:!0},e.schema.toStringOptions,t),i;switch(n.collectionStyle){case`block`:i=!1;break;case`flow`:i=!0;break;default:i=null}return{anchors:/* @__PURE__ */ new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?` `:``,indent:``,indentStep:typeof n.indent==`number`?` `.repeat(n.indent):` `,inFlow:i,options:n}}function getTagObject(e,t){if(t.tag){let n=e.filter(e=>e.tag===t.tag);if(n.length>0)return n.find(e=>e.format===t.format)??n[0]}let r,i;if(n.isScalar(t)){i=t.value;let n=e.filter(e=>e.identify?.(i));if(n.length>1){let e=n.filter(e=>e.test);e.length>0&&(n=e)}r=n.find(e=>e.format===t.format)??n.find(e=>!e.format)}else i=t,r=e.find(e=>e.nodeClass&&i instanceof e.nodeClass);if(!r){let e=i?.constructor?.name??(i===null?`null`:typeof i);throw Error(`Tag not resolved for ${e} value`)}return r}function stringifyProps(e,r,{anchors:i,doc:a}){if(!a.directives)return``;let o=[],s=(n.isScalar(e)||n.isCollection(e))&&e.anchor;s&&t.anchorIsValid(s)&&(i.add(s),o.push(`&${s}`));let c=e.tag??(r.default?null:r.tag);return c&&o.push(a.directives.tagString(c)),o.join(` `)}function stringify(e,t,r,a){if(n.isPair(e))return e.toString(t,r,a);if(n.isAlias(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw TypeError(`Cannot stringify circular structure without alias nodes`);t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=/* @__PURE__ */ new Set([e]),e=e.resolve(t.doc)}let o,s=n.isNode(e)?e:t.doc.createNode(e,{onTagObj:e=>o=e});o??=getTagObject(t.doc.schema.tags,s);let c=stringifyProps(s,o,t);c.length>0&&(t.indentAtStart=(t.indentAtStart??0)+c.length+1);let l=typeof o.stringify==`function`?o.stringify(s,t,r,a):n.isScalar(s)?i.stringifyString(s,t,r,a):s.toString(t,r,a);return c?n.isScalar(s)||l[0]===`{`||l[0]===`[`?`${c} ${l}`:`${c}\n${t.indent}${l}`:l}e.createStringifyContext=createStringifyContext,e.stringify=stringify})),ce=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=N(),r=L(),i=F();function stringifyPair({key:e,value:a},o,s,c){let{allNullValues:l,doc:u,indent:d,indentStep:f,options:{commentString:p,indentSeq:m,simpleKeys:h}}=o,g=t.isNode(e)&&e.comment||null;if(h){if(g)throw Error(`With simple keys, key nodes cannot have comments`);if(t.isCollection(e)||!t.isNode(e)&&typeof e==`object`)throw Error(`With simple keys, collection cannot be used as a key value`)}let _=!h&&(!e||g&&a==null&&!o.inFlow||t.isCollection(e)||(t.isScalar(e)?e.type===n.Scalar.BLOCK_FOLDED||e.type===n.Scalar.BLOCK_LITERAL:typeof e==`object`));o=Object.assign({},o,{allNullValues:!1,implicitKey:!_&&(h||!l),indent:d+f});let v=!1,y=!1,b=r.stringify(e,o,()=>v=!0,()=>y=!0);if(!_&&!o.inFlow&&b.length>1024){if(h)throw Error(`With simple keys, single line scalar must not span more than 1024 characters`);_=!0}if(o.inFlow){if(l||a==null)return v&&s&&s(),b===``?`?`:_?`? ${b}`:b}else if(l&&!h||a==null&&_)return b=`? ${b}`,g&&!v?b+=i.lineComment(b,o.indent,p(g)):y&&c&&c(),b;v&&(g=null),_?(g&&(b+=i.lineComment(b,o.indent,p(g))),b=`? ${b}\n${d}:`):(b=`${b}:`,g&&(b+=i.lineComment(b,o.indent,p(g))));let x,S,C;t.isNode(a)?(x=!!a.spaceBefore,S=a.commentBefore,C=a.comment):(x=!1,S=null,C=null,a&&typeof a==`object`&&(a=u.createNode(a))),o.implicitKey=!1,!_&&!g&&t.isScalar(a)&&(o.indentAtStart=b.length+1),y=!1,!m&&f.length>=2&&!o.inFlow&&!_&&t.isSeq(a)&&!a.flow&&!a.tag&&!a.anchor&&(o.indent=o.indent.substring(2));let w=!1,T=r.stringify(a,o,()=>w=!0,()=>y=!0),E=` `;if(g||x||S){if(E=x?` +`))return blockString(e,r,i,a);if(containsDocumentMarker(s)){if(u===``)return r.forceBlockIndent=!0,blockString(e,r,i,a);if(l&&u===d)return quotedString(s,r)}let p=s.replace(/\n+/g,`$&\n${u}`);if(c){let test=e=>e.default&&e.tag!==`tag:yaml.org,2002:str`&&e.test?.test(p),{compat:e,tags:t}=r.doc.schema;if(t.some(test)||e?.some(test))return quotedString(s,r)}return l?p:n.foldFlowLines(p,u,n.FOLD_FLOW,getFoldOptions(r,!1))}function stringifyString(e,n,r,i){let{implicitKey:a,inFlow:o}=n,s=typeof e.value==`string`?e:Object.assign({},e,{value:String(e.value)}),{type:c}=e;c!==t.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(c=t.Scalar.QUOTE_DOUBLE);let _stringify=e=>{switch(e){case t.Scalar.BLOCK_FOLDED:case t.Scalar.BLOCK_LITERAL:return a||o?quotedString(s.value,n):blockString(s,n,r,i);case t.Scalar.QUOTE_DOUBLE:return doubleQuotedString(s.value,n);case t.Scalar.QUOTE_SINGLE:return singleQuotedString(s.value,n);case t.Scalar.PLAIN:return plainString(s,n,r,i);default:return null}},l=_stringify(c);if(l===null){let{defaultKeyType:e,defaultStringType:t}=n.options,r=a&&e||t;if(l=_stringify(r),l===null)throw Error(`Unsupported default string type ${r}`)}return l}e.stringifyString=stringifyString})),L=/* @__PURE__ */ __commonJSMin((e=>{var t=se(),n=O(),r=F(),i=I();function createStringifyContext(e,t){let n=Object.assign({blockQuote:!0,commentString:r.stringifyComment,defaultKeyType:null,defaultStringType:`PLAIN`,directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:`false`,flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:`null`,simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:`true`,verifyAliasOrder:!0},e.schema.toStringOptions,t),i;switch(n.collectionStyle){case`block`:i=!1;break;case`flow`:i=!0;break;default:i=null}return{anchors:/* @__PURE__ */ new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?` `:``,indent:``,indentStep:typeof n.indent==`number`?` `.repeat(n.indent):` `,inFlow:i,options:n}}function getTagObject(e,t){if(t.tag){let n=e.filter(e=>e.tag===t.tag);if(n.length>0)return n.find(e=>e.format===t.format)??n[0]}let r,i;if(n.isScalar(t)){i=t.value;let n=e.filter(e=>e.identify?.(i));if(n.length>1){let e=n.filter(e=>e.test);e.length>0&&(n=e)}r=n.find(e=>e.format===t.format)??n.find(e=>!e.format)}else i=t,r=e.find(e=>e.nodeClass&&i instanceof e.nodeClass);if(!r){let e=i?.constructor?.name??(i===null?`null`:typeof i);throw Error(`Tag not resolved for ${e} value`)}return r}function stringifyProps(e,r,{anchors:i,doc:a}){if(!a.directives)return``;let o=[],s=(n.isScalar(e)||n.isCollection(e))&&e.anchor;s&&t.anchorIsValid(s)&&(i.add(s),o.push(`&${s}`));let c=e.tag??(r.default?null:r.tag);return c&&o.push(a.directives.tagString(c)),o.join(` `)}function stringify(e,t,r,a){if(n.isPair(e))return e.toString(t,r,a);if(n.isAlias(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw TypeError(`Cannot stringify circular structure without alias nodes`);t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=/* @__PURE__ */ new Set([e]),e=e.resolve(t.doc)}let o,s=n.isNode(e)?e:t.doc.createNode(e,{onTagObj:e=>o=e});o??=getTagObject(t.doc.schema.tags,s);let c=stringifyProps(s,o,t);c.length>0&&(t.indentAtStart=(t.indentAtStart??0)+c.length+1);let l=typeof o.stringify==`function`?o.stringify(s,t,r,a):n.isScalar(s)?i.stringifyString(s,t,r,a):s.toString(t,r,a);return c?n.isScalar(s)||l[0]===`{`||l[0]===`[`?`${c} ${l}`:`${c}\n${t.indent}${l}`:l}e.createStringifyContext=createStringifyContext,e.stringify=stringify})),de=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=M(),r=L(),i=F();function stringifyPair({key:e,value:a},o,s,c){let{allNullValues:l,doc:u,indent:d,indentStep:f,options:{commentString:p,indentSeq:m,simpleKeys:h}}=o,g=t.isNode(e)&&e.comment||null;if(h){if(g)throw Error(`With simple keys, key nodes cannot have comments`);if(t.isCollection(e)||!t.isNode(e)&&typeof e==`object`)throw Error(`With simple keys, collection cannot be used as a key value`)}let _=!h&&(!e||g&&a==null&&!o.inFlow||t.isCollection(e)||(t.isScalar(e)?e.type===n.Scalar.BLOCK_FOLDED||e.type===n.Scalar.BLOCK_LITERAL:typeof e==`object`));o=Object.assign({},o,{allNullValues:!1,implicitKey:!_&&(h||!l),indent:d+f});let v=!1,y=!1,b=r.stringify(e,o,()=>v=!0,()=>y=!0);if(!_&&!o.inFlow&&b.length>1024){if(h)throw Error(`With simple keys, single line scalar must not span more than 1024 characters`);_=!0}if(o.inFlow){if(l||a==null)return v&&s&&s(),b===``?`?`:_?`? ${b}`:b}else if(l&&!h||a==null&&_)return b=`? ${b}`,g&&!v?b+=i.lineComment(b,o.indent,p(g)):y&&c&&c(),b;v&&(g=null),_?(g&&(b+=i.lineComment(b,o.indent,p(g))),b=`? ${b}\n${d}:`):(b=`${b}:`,g&&(b+=i.lineComment(b,o.indent,p(g))));let x,S,C;t.isNode(a)?(x=!!a.spaceBefore,S=a.commentBefore,C=a.comment):(x=!1,S=null,C=null,a&&typeof a==`object`&&(a=u.createNode(a))),o.implicitKey=!1,!_&&!g&&t.isScalar(a)&&(o.indentAtStart=b.length+1),y=!1,!m&&f.length>=2&&!o.inFlow&&!_&&t.isSeq(a)&&!a.flow&&!a.tag&&!a.anchor&&(o.indent=o.indent.substring(2));let w=!1,T=r.stringify(a,o,()=>w=!0,()=>y=!0),E=` `;if(g||x||S){if(E=x?` `:``,S){let e=p(S);E+=`\n${i.indentComment(e,o.indent)}`}T===``&&!o.inFlow?E===` `&&C&&(E=` `):E+=`\n${o.indent}`}else if(!_&&t.isCollection(a)){let e=T[0],t=T.indexOf(` `),n=t!==-1,r=o.inFlow??a.flow??a.items.length===0;if(n||!r){let r=!1;if(n&&(e===`&`||e===`!`)){let n=T.indexOf(` `);e===`&`&&n!==-1&&n{var t=D(`process`);function debug(e,...t){e===`debug`&&console.log(...t)}function warn(e,n){(e===`debug`||e===`warn`)&&(typeof t.emitWarning==`function`?t.emitWarning(n):console.warn(n))}e.debug=debug,e.warn=warn})),ue=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=N();let r={identify:e=>e===`<<`||typeof e==`symbol`&&e.description===`<<`,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new n.Scalar(Symbol(`<<`)),{addToJSMap:addMergeToJSMap}),stringify:()=>`<<`},isMergeKey=(e,i)=>(r.identify(i)||t.isScalar(i)&&(!i.type||i.type===n.Scalar.PLAIN)&&r.identify(i.value))&&e?.doc.schema.tags.some(e=>e.tag===r.tag&&e.default);function addMergeToJSMap(e,n,r){let i=resolveAliasValue(e,r);if(t.isSeq(i))for(let t of i.items)mergeValue(e,n,t);else if(Array.isArray(i))for(let t of i)mergeValue(e,n,t);else mergeValue(e,n,i)}function mergeValue(e,n,r){let i=resolveAliasValue(e,r);if(!t.isMap(i))throw Error(`Merge sources must be maps or map aliases`);let a=i.toJSON(null,e,Map);for(let[e,t]of a)n instanceof Map?n.has(e)||n.set(e,t):n instanceof Set?n.add(e):Object.prototype.hasOwnProperty.call(n,e)||Object.defineProperty(n,e,{value:t,writable:!0,enumerable:!0,configurable:!0});return n}function resolveAliasValue(e,n){return e&&t.isAlias(n)?n.resolve(e.doc,e):n}e.addMergeToJSMap=addMergeToJSMap,e.isMergeKey=isMergeKey,e.merge=r})),de=/* @__PURE__ */ __commonJSMin((e=>{var t=le(),n=ue(),r=L(),i=O(),a=A();function addPairToJSMap(e,t,{key:r,value:o}){if(i.isNode(r)&&r.addToJSMap)r.addToJSMap(e,t,o);else if(n.isMergeKey(e,r))n.addMergeToJSMap(e,t,o);else{let n=a.toJS(r,``,e);if(t instanceof Map)t.set(n,a.toJS(o,n,e));else if(t instanceof Set)t.add(n);else{let i=stringifyKey(r,n,e),s=a.toJS(o,i,e);i in t?Object.defineProperty(t,i,{value:s,writable:!0,enumerable:!0,configurable:!0}):t[i]=s}}return t}function stringifyKey(e,n,a){if(n===null)return``;if(typeof n!=`object`)return String(n);if(i.isNode(e)&&a?.doc){let n=r.createStringifyContext(a.doc,{});n.anchors=/* @__PURE__ */ new Set;for(let e of a.anchors.keys())n.anchors.add(e.anchor);n.inFlow=!0,n.inStringifyKey=!0;let i=e.toString(n);if(!a.mapKeyWarned){let e=JSON.stringify(i);e.length>40&&(e=e.substring(0,36)+`..."`),t.warn(a.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${e}. Set mapAsMap: true to use object keys.`),a.mapKeyWarned=!0}return i}return JSON.stringify(n)}e.addPairToJSMap=addPairToJSMap})),R=/* @__PURE__ */ __commonJSMin((e=>{var t=P(),n=ce(),r=de(),i=O();function createPair(e,n,r){return new a(t.createNode(e,void 0,r),t.createNode(n,void 0,r))}var a=class Pair{constructor(e,t=null){Object.defineProperty(this,i.NODE_TYPE,{value:i.PAIR}),this.key=e,this.value=t}clone(e){let{key:t,value:n}=this;return i.isNode(t)&&(t=t.clone(e)),i.isNode(n)&&(n=n.clone(e)),new Pair(t,n)}toJSON(e,t){let n=t?.mapAsMap?/* @__PURE__ */ new Map:{};return r.addPairToJSMap(t,n,this)}toString(e,t,r){return e?.doc?n.stringifyPair(this,e,t,r):JSON.stringify(this)}};e.Pair=a,e.createPair=createPair})),fe=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=L(),r=F();function stringifyCollection(e,t,n){return(t.inFlow??e.flow?stringifyFlowCollection:stringifyBlockCollection)(e,t,n)}function stringifyBlockCollection({comment:e,items:i},a,{blockItemPrefix:o,flowChars:s,itemIndent:c,onChompKeep:l,onComment:u}){let{indent:d,options:{commentString:f}}=a,p=Object.assign({},a,{indent:c,type:null}),m=!1,h=[];for(let e=0;el=null,()=>m=!0);l&&(u+=r.lineComment(u,c,f(l))),m&&l&&(m=!1),h.push(o+u)}let g;if(h.length===0)g=s.start+s.end;else{g=h[0];for(let e=1;e{var t=D(`process`);function debug(e,...t){e===`debug`&&console.log(...t)}function warn(e,n){(e===`debug`||e===`warn`)&&(typeof t.emitWarning==`function`?t.emitWarning(n):console.warn(n))}e.debug=debug,e.warn=warn})),pe=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=M();let r={identify:e=>e===`<<`||typeof e==`symbol`&&e.description===`<<`,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new n.Scalar(Symbol(`<<`)),{addToJSMap:addMergeToJSMap}),stringify:()=>`<<`},isMergeKey=(e,i)=>(r.identify(i)||t.isScalar(i)&&(!i.type||i.type===n.Scalar.PLAIN)&&r.identify(i.value))&&e?.doc.schema.tags.some(e=>e.tag===r.tag&&e.default);function addMergeToJSMap(e,n,r){let i=resolveAliasValue(e,r);if(t.isSeq(i))for(let t of i.items)mergeValue(e,n,t);else if(Array.isArray(i))for(let t of i)mergeValue(e,n,t);else mergeValue(e,n,i)}function mergeValue(e,n,r){let i=resolveAliasValue(e,r);if(!t.isMap(i))throw Error(`Merge sources must be maps or map aliases`);let a=i.toJSON(null,e,Map);for(let[e,t]of a)n instanceof Map?n.has(e)||n.set(e,t):n instanceof Set?n.add(e):Object.prototype.hasOwnProperty.call(n,e)||Object.defineProperty(n,e,{value:t,writable:!0,enumerable:!0,configurable:!0});return n}function resolveAliasValue(e,n){return e&&t.isAlias(n)?n.resolve(e.doc,e):n}e.addMergeToJSMap=addMergeToJSMap,e.isMergeKey=isMergeKey,e.merge=r})),me=/* @__PURE__ */ __commonJSMin((e=>{var t=fe(),n=pe(),r=L(),i=O(),a=A();function addPairToJSMap(e,t,{key:r,value:o}){if(i.isNode(r)&&r.addToJSMap)r.addToJSMap(e,t,o);else if(n.isMergeKey(e,r))n.addMergeToJSMap(e,t,o);else{let n=a.toJS(r,``,e);if(t instanceof Map)t.set(n,a.toJS(o,n,e));else if(t instanceof Set)t.add(n);else{let i=stringifyKey(r,n,e),s=a.toJS(o,i,e);i in t?Object.defineProperty(t,i,{value:s,writable:!0,enumerable:!0,configurable:!0}):t[i]=s}}return t}function stringifyKey(e,n,a){if(n===null)return``;if(typeof n!=`object`)return String(n);if(i.isNode(e)&&a?.doc){let n=r.createStringifyContext(a.doc,{});n.anchors=/* @__PURE__ */ new Set;for(let e of a.anchors.keys())n.anchors.add(e.anchor);n.inFlow=!0,n.inStringifyKey=!0;let i=e.toString(n);if(!a.mapKeyWarned){let e=JSON.stringify(i);e.length>40&&(e=e.substring(0,36)+`..."`),t.warn(a.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${e}. Set mapAsMap: true to use object keys.`),a.mapKeyWarned=!0}return i}return JSON.stringify(n)}e.addPairToJSMap=addPairToJSMap})),R=/* @__PURE__ */ __commonJSMin((e=>{var t=N(),n=de(),r=me(),i=O();function createPair(e,n,r){return new a(t.createNode(e,void 0,r),t.createNode(n,void 0,r))}var a=class Pair{constructor(e,t=null){Object.defineProperty(this,i.NODE_TYPE,{value:i.PAIR}),this.key=e,this.value=t}clone(e){let{key:t,value:n}=this;return i.isNode(t)&&(t=t.clone(e)),i.isNode(n)&&(n=n.clone(e)),new Pair(t,n)}toJSON(e,t){let n=t?.mapAsMap?/* @__PURE__ */ new Map:{};return r.addPairToJSMap(t,n,this)}toString(e,t,r){return e?.doc?n.stringifyPair(this,e,t,r):JSON.stringify(this)}};e.Pair=a,e.createPair=createPair})),he=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=L(),r=F();function stringifyCollection(e,t,n){return(t.inFlow??e.flow?stringifyFlowCollection:stringifyBlockCollection)(e,t,n)}function stringifyBlockCollection({comment:e,items:i},a,{blockItemPrefix:o,flowChars:s,itemIndent:c,onChompKeep:l,onComment:u}){let{indent:d,options:{commentString:f}}=a,p=Object.assign({},a,{indent:c,type:null}),m=!1,h=[];for(let e=0;el=null,()=>m=!0);l&&(u+=r.lineComment(u,c,f(l))),m&&l&&(m=!1),h.push(o+u)}let g;if(h.length===0)g=s.start+s.end;else{g=h[0];for(let e=1;ec=null);f||=m.length>p||l.includes(` `),a0&&(f||=m.reduce((e,t)=>e+t.length+2,2)+(l.length+2)>i.options.lineWidth),f&&(l+=`,`)),c&&(l+=r.lineComment(l,o,u(c))),m.push(l),p=m.length}let{start:h,end:g}=a;if(m.length===0)return h+g;if(!f){let e=m.reduce((e,t)=>e+t.length+2,2);f=i.options.lineWidth>0&&e>i.options.lineWidth}if(f){let e=h;for(let t of m)e+=t?`\n${c}${s}${t}`:` -`;return`${e}\n${s}${g}`}return`${h}${l}${m.join(` `)}${l}${g}`}function addCommentBefore({indent:e,options:{commentString:t}},n,i,a){if(i&&a&&(i=i.replace(/^\n+/,``)),i){let a=r.indentComment(t(i),e);n.push(a.trimStart())}}e.stringifyCollection=stringifyCollection})),z=/* @__PURE__ */ __commonJSMin((e=>{var t=fe(),n=de(),r=oe(),i=O(),a=R(),o=N();function findPair(e,t){let n=i.isScalar(t)?t.value:t;for(let r of e)if(i.isPair(r)&&(r.key===t||r.key===n||i.isScalar(r.key)&&r.key.value===n))return r}e.YAMLMap=class extends r.Collection{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(i.MAP,e),this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:i}=n,o=new this(e),add=(e,s)=>{if(typeof i==`function`)s=i.call(t,e,s);else if(Array.isArray(i)&&!i.includes(e))return;(s!==void 0||r)&&o.items.push(a.createPair(e,s,n))};if(t instanceof Map)for(let[e,n]of t)add(e,n);else if(t&&typeof t==`object`)for(let e of Object.keys(t))add(e,t[e]);return typeof e.sortMapEntries==`function`&&o.items.sort(e.sortMapEntries),o}add(e,t){let n;n=i.isPair(e)?e:!e||typeof e!=`object`||!(`key`in e)?new a.Pair(e,e?.value):new a.Pair(e.key,e.value);let r=findPair(this.items,n.key),s=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);i.isScalar(r.value)&&o.isScalarValue(n.value)?r.value.value=n.value:r.value=n.value}else if(s){let e=this.items.findIndex(e=>s(n,e)<0);e===-1?this.items.push(n):this.items.splice(e,0,n)}else this.items.push(n)}delete(e){let t=findPair(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=findPair(this.items,e)?.value;return(!t&&i.isScalar(n)?n.value:n)??void 0}has(e){return!!findPair(this.items,e)}set(e,t){this.add(new a.Pair(e,t),!0)}toJSON(e,t,r){let i=r?new r:t?.mapAsMap?/* @__PURE__ */ new Map:{};t?.onCreate&&t.onCreate(i);for(let e of this.items)n.addPairToJSMap(t,i,e);return i}toString(e,n,r){if(!e)return JSON.stringify(this);for(let e of this.items)if(!i.isPair(e))throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),t.stringifyCollection(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:r,onComment:n})}},e.findPair=findPair})),B=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=z();e.map={collection:`map`,default:!0,nodeClass:n.YAMLMap,tag:`tag:yaml.org,2002:map`,resolve(e,n){return t.isMap(e)||n(`Expected a mapping for this tag`),e},createNode:(e,t,r)=>n.YAMLMap.from(e,t,r)}})),V=/* @__PURE__ */ __commonJSMin((e=>{var t=P(),n=fe(),r=oe(),i=O(),a=N(),o=A(),YAMLSeq=class extends r.Collection{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(i.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=asItemIndex(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=asItemIndex(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&i.isScalar(r)?r.value:r}has(e){let t=asItemIndex(e);return typeof t==`number`&&t=0?t:null}e.YAMLSeq=YAMLSeq})),H=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=V();e.seq={collection:`seq`,default:!0,nodeClass:n.YAMLSeq,tag:`tag:yaml.org,2002:seq`,resolve(e,n){return t.isSeq(e)||n(`Expected a sequence for this tag`),e},createNode:(e,t,r)=>n.YAMLSeq.from(e,t,r)}})),U=/* @__PURE__ */ __commonJSMin((e=>{var t=I();e.string={identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify(e,n,r,i){return n=Object.assign({actualString:!0},n),t.stringifyString(e,n,r,i)}}})),pe=/* @__PURE__ */ __commonJSMin((e=>{var t=N();let n={identify:e=>e==null,createNode:()=>new t.Scalar(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new t.Scalar(null),stringify:({source:e},t)=>typeof e==`string`&&n.test.test(e)?e:t.options.nullStr};e.nullTag=n})),me=/* @__PURE__ */ __commonJSMin((e=>{var t=N();let n={identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new t.Scalar(e[0]===`t`||e[0]===`T`),stringify({source:e,value:t},r){return e&&n.test.test(e)&&t===(e[0]===`t`||e[0]===`T`)?e:t?r.options.trueStr:r.options.falseStr}};e.boolTag=n})),W=/* @__PURE__ */ __commonJSMin((e=>{function stringifyNumber({format:e,minFractionDigits:t,tag:n,value:r}){if(typeof r==`bigint`)return String(r);let i=typeof r==`number`?r:Number(r);if(!isFinite(i))return isNaN(i)?`.nan`:i<0?`-.inf`:`.inf`;let a=Object.is(r,-0)?`-0`:JSON.stringify(r);if(!e&&t&&(!n||n===`tag:yaml.org,2002:float`)&&/^-?\d/.test(a)&&!a.includes(`e`)){let e=a.indexOf(`.`);e<0&&(e=a.length,a+=`.`);let n=t-(a.length-e-1);for(;n-->0;)a+=`0`}return a}e.stringifyNumber=stringifyNumber})),he=/* @__PURE__ */ __commonJSMin((e=>{var t=N(),n=W();let r={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:n.stringifyNumber};e.float={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let n=new t.Scalar(parseFloat(e)),r=e.indexOf(`.`);return r!==-1&&e[e.length-1]===`0`&&(n.minFractionDigits=e.length-r-1),n},stringify:n.stringifyNumber},e.floatExp={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():n.stringifyNumber(e)}},e.floatNaN=r})),ge=/* @__PURE__ */ __commonJSMin((e=>{var t=W();let intIdentify=e=>typeof e==`bigint`||Number.isInteger(e),intResolve=(e,t,n,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),n);function intStringify(e,n,r){let{value:i}=e;return intIdentify(i)&&i>=0?r+i.toString(n):t.stringifyNumber(e)}e.int={identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>intResolve(e,0,10,n),stringify:t.stringifyNumber},e.intHex={identify:e=>intIdentify(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>intResolve(e,2,16,n),stringify:e=>intStringify(e,16,`0x`)},e.intOct={identify:e=>intIdentify(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^0o[0-7]+$/,resolve:(e,t,n)=>intResolve(e,2,8,n),stringify:e=>intStringify(e,8,`0o`)}})),_e=/* @__PURE__ */ __commonJSMin((e=>{var t=B(),n=pe(),r=H(),i=U(),a=me(),o=he(),s=ge();e.schema=[t.map,r.seq,i.string,n.nullTag,a.boolTag,s.intOct,s.int,s.intHex,o.floatNaN,o.floatExp,o.float]})),ve=/* @__PURE__ */ __commonJSMin((e=>{var t=N(),n=B(),r=H();function intIdentify(e){return typeof e==`bigint`||Number.isInteger(e)}let stringifyJSON=({value:e})=>JSON.stringify(e),i=[{identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify:stringifyJSON},{identify:e=>e==null,createNode:()=>new t.Scalar(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^null$/,resolve:()=>null,stringify:stringifyJSON},{identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^true$|^false$/,resolve:e=>e===`true`,stringify:stringifyJSON},{identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>intIdentify(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:stringifyJSON}];e.schema=[n.map,r.seq].concat(i,{default:!0,tag:``,test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}})})),ye=/* @__PURE__ */ __commonJSMin((e=>{var t=D(`buffer`),n=N(),r=I();e.binary={identify:e=>e instanceof Uint8Array,default:!1,tag:`tag:yaml.org,2002:binary`,resolve(e,n){if(typeof t.Buffer==`function`)return t.Buffer.from(e,`base64`);if(typeof atob==`function`){let t=atob(e.replace(/[\n\r]/g,``)),n=new Uint8Array(t.length);for(let e=0;e{var t=O(),n=R(),r=N(),i=V();function resolvePairs(e,i){if(t.isSeq(e))for(let a=0;a1&&i(`Each pair must have its own sequence indicator`);let e=o.items[0]||new n.Pair(new r.Scalar(null));if(o.commentBefore&&(e.key.commentBefore=e.key.commentBefore?`${o.commentBefore}\n${e.key.commentBefore}`:o.commentBefore),o.comment){let t=e.value??e.key;t.comment=t.comment?`${o.comment}\n${t.comment}`:o.comment}o=e}e.items[a]=t.isPair(o)?o:new n.Pair(o)}}else i(`Expected a sequence for this tag`);return e}function createPairs(e,t,r){let{replacer:a}=r,o=new i.YAMLSeq(e);o.tag=`tag:yaml.org,2002:pairs`;let s=0;if(t&&Symbol.iterator in Object(t))for(let e of t){typeof a==`function`&&(e=a.call(t,String(s++),e));let i,c;if(Array.isArray(e)){if(e.length===2)i=e[0],c=e[1];else throw TypeError(`Expected [key, value] tuple: ${e}`)}else if(e&&e instanceof Object){let t=Object.keys(e);if(t.length===1)i=t[0],c=e[i];else throw TypeError(`Expected tuple with one key, not ${t.length} keys`)}else i=e;o.items.push(n.createPair(i,c,r))}return o}let a={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:resolvePairs,createNode:createPairs};e.createPairs=createPairs,e.pairs=a,e.resolvePairs=resolvePairs})),xe=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=A(),r=z(),i=V(),a=be(),o=class YAMLOMap extends i.YAMLSeq{constructor(){super(),this.add=r.YAMLMap.prototype.add.bind(this),this.delete=r.YAMLMap.prototype.delete.bind(this),this.get=r.YAMLMap.prototype.get.bind(this),this.has=r.YAMLMap.prototype.has.bind(this),this.set=r.YAMLMap.prototype.set.bind(this),this.tag=YAMLOMap.tag}toJSON(e,r){if(!r)return super.toJSON(e);let i=/* @__PURE__ */ new Map;r?.onCreate&&r.onCreate(i);for(let e of this.items){let a,o;if(t.isPair(e)?(a=n.toJS(e.key,``,r),o=n.toJS(e.value,a,r)):a=n.toJS(e,``,r),i.has(a))throw Error(`Ordered maps must not include duplicate keys`);i.set(a,o)}return i}static from(e,t,n){let r=a.createPairs(e,t,n),i=new this;return i.items=r.items,i}};o.tag=`tag:yaml.org,2002:omap`;let s={collection:`seq`,identify:e=>e instanceof Map,nodeClass:o,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,n){let r=a.resolvePairs(e,n),i=[];for(let{key:e}of r.items)t.isScalar(e)&&(i.includes(e.value)?n(`Ordered maps must not include duplicate keys: ${e.value}`):i.push(e.value));return Object.assign(new o,r)},createNode:(e,t,n)=>o.from(e,t,n)};e.YAMLOMap=o,e.omap=s})),Se=/* @__PURE__ */ __commonJSMin((e=>{var t=N();function boolStringify({value:e,source:t},i){return t&&(e?n:r).test.test(t)?t:e?i.options.trueStr:i.options.falseStr}let n={identify:e=>e===!0,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new t.Scalar(!0),stringify:boolStringify},r={identify:e=>e===!1,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new t.Scalar(!1),stringify:boolStringify};e.falseTag=r,e.trueTag=n})),Ce=/* @__PURE__ */ __commonJSMin((e=>{var t=N(),n=W();let r={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:n.stringifyNumber};e.float={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let n=new t.Scalar(parseFloat(e.replace(/_/g,``))),r=e.indexOf(`.`);if(r!==-1){let t=e.substring(r+1).replace(/_/g,``);t[t.length-1]===`0`&&(n.minFractionDigits=t.length)}return n},stringify:n.stringifyNumber},e.floatExp={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,``)),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():n.stringifyNumber(e)}},e.floatNaN=r})),we=/* @__PURE__ */ __commonJSMin((e=>{var t=W();let intIdentify=e=>typeof e==`bigint`||Number.isInteger(e);function intResolve(e,t,n,{intAsBigInt:r}){let i=e[0];if((i===`-`||i===`+`)&&(t+=1),e=e.substring(t).replace(/_/g,``),r){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`}let t=BigInt(e);return i===`-`?BigInt(-1)*t:t}let a=parseInt(e,n);return i===`-`?-1*a:a}function intStringify(e,n,r){let{value:i}=e;if(intIdentify(i)){let e=i.toString(n);return i<0?`-`+r+e.substr(1):r+e}return t.stringifyNumber(e)}let n={identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>intResolve(e,2,2,n),stringify:e=>intStringify(e,2,`0b`)},r={identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>intResolve(e,1,8,n),stringify:e=>intStringify(e,8,`0`)},i={identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>intResolve(e,0,10,n),stringify:t.stringifyNumber},a={identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>intResolve(e,2,16,n),stringify:e=>intStringify(e,16,`0x`)};e.int=i,e.intBin=n,e.intHex=a,e.intOct=r})),Te=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=R(),r=z(),i=class YAMLSet extends r.YAMLMap{constructor(e){super(e),this.tag=YAMLSet.tag}add(e){let i;i=t.isPair(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new n.Pair(e.key,null):new n.Pair(e,null),r.findPair(this.items,i.key)||this.items.push(i)}get(e,n){let i=r.findPair(this.items,e);return!n&&t.isPair(i)?t.isScalar(i.key)?i.key.value:i.key:i}set(e,t){if(typeof t!=`boolean`)throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let i=r.findPair(this.items,e);i&&!t?this.items.splice(this.items.indexOf(i),1):!i&&t&&this.items.push(new n.Pair(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw Error(`Set items must all have null values`)}static from(e,t,r){let{replacer:i}=r,a=new this(e);if(t&&Symbol.iterator in Object(t))for(let e of t)typeof i==`function`&&(e=i.call(t,e,e)),a.items.push(n.createPair(e,null,r));return a}};i.tag=`tag:yaml.org,2002:set`;let a={collection:`map`,identify:e=>e instanceof Set,nodeClass:i,default:!1,tag:`tag:yaml.org,2002:set`,createNode:(e,t,n)=>i.from(e,t,n),resolve(e,n){if(t.isMap(e)){if(e.hasAllNullValues(!0))return Object.assign(new i,e);n(`Set items must all have null values`)}else n(`Expected a mapping for this tag`);return e}};e.YAMLSet=i,e.set=a})),Ee=/* @__PURE__ */ __commonJSMin((e=>{var t=W();function parseSexagesimal(e,t){let n=e[0],r=n===`-`||n===`+`?e.substring(1):e,num=e=>t?BigInt(e):Number(e),i=r.replace(/_/g,``).split(`:`).reduce((e,t)=>e*num(60)+num(t),num(0));return n===`-`?num(-1)*i:i}function stringifySexagesimal(e){let{value:n}=e,num=e=>e;if(typeof n==`bigint`)num=e=>BigInt(e);else if(isNaN(n)||!isFinite(n))return t.stringifyNumber(e);let r=``;n<0&&(r=`-`,n*=num(-1));let i=num(60),a=[n%i];return n<60?a.unshift(0):(n=(n-a[0])/i,a.unshift(n%i),n>=60&&(n=(n-a[0])/i,a.unshift(n))),r+a.map(e=>String(e).padStart(2,`0`)).join(`:`).replace(/000000\d*$/,``)}let n={identify:e=>typeof e==`bigint`||Number.isInteger(e),default:!0,tag:`tag:yaml.org,2002:int`,format:`TIME`,test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>parseSexagesimal(e,n),stringify:stringifySexagesimal},r={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`TIME`,test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>parseSexagesimal(e,!1),stringify:stringifySexagesimal},i={identify:e=>e instanceof Date,default:!0,tag:`tag:yaml.org,2002:timestamp`,test:RegExp(`^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$`),resolve(e){let t=e.match(i.test);if(!t)throw Error(`!!timestamp expects a date, starting with yyyy-mm-dd`);let[,n,r,a,o,s,c]=t.map(Number),l=t[7]?Number((t[7]+`00`).substr(1,3)):0,u=Date.UTC(n,r-1,a,o||0,s||0,c||0,l),d=t[8];if(d&&d!==`Z`){let e=parseSexagesimal(d,!1);Math.abs(e)<30&&(e*=60),u-=6e4*e}return new Date(u)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,``)??``};e.floatTime=r,e.intTime=n,e.timestamp=i})),De=/* @__PURE__ */ __commonJSMin((e=>{var t=B(),n=pe(),r=H(),i=U(),a=ye(),o=Se(),s=Ce(),c=we(),l=ue(),u=xe(),d=be(),f=Te(),p=Ee();e.schema=[t.map,r.seq,i.string,n.nullTag,o.trueTag,o.falseTag,c.intBin,c.intOct,c.int,c.intHex,s.floatNaN,s.floatExp,s.float,a.binary,l.merge,u.omap,d.pairs,f.set,p.intTime,p.floatTime,p.timestamp]})),Oe=/* @__PURE__ */ __commonJSMin((e=>{var t=B(),n=pe(),r=H(),i=U(),a=me(),o=he(),s=ge(),c=_e(),l=ve(),u=ye(),d=ue(),f=xe(),p=be(),m=De(),h=Te(),g=Ee();let _=/* @__PURE__ */ new Map([[`core`,c.schema],[`failsafe`,[t.map,r.seq,i.string]],[`json`,l.schema],[`yaml11`,m.schema],[`yaml-1.1`,m.schema]]),v={binary:u.binary,bool:a.boolTag,float:o.float,floatExp:o.floatExp,floatNaN:o.floatNaN,floatTime:g.floatTime,int:s.int,intHex:s.intHex,intOct:s.intOct,intTime:g.intTime,map:t.map,merge:d.merge,null:n.nullTag,omap:f.omap,pairs:p.pairs,seq:r.seq,set:h.set,timestamp:g.timestamp},y={"tag:yaml.org,2002:binary":u.binary,"tag:yaml.org,2002:merge":d.merge,"tag:yaml.org,2002:omap":f.omap,"tag:yaml.org,2002:pairs":p.pairs,"tag:yaml.org,2002:set":h.set,"tag:yaml.org,2002:timestamp":g.timestamp};function getTags(e,t,n){let r=_.get(t);if(r&&!e)return n&&!r.includes(d.merge)?r.concat(d.merge):r.slice();let i=r;if(!i){if(Array.isArray(e))i=[];else{let e=Array.from(_.keys()).filter(e=>e!==`yaml11`).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown schema "${t}"; use one of ${e} or define customTags array`)}}if(Array.isArray(e))for(let t of e)i=i.concat(t);else typeof e==`function`&&(i=e(i.slice()));return n&&(i=i.concat(d.merge)),i.reduce((e,t)=>{let n=typeof t==`string`?v[t]:t;if(!n){let e=JSON.stringify(t),n=Object.keys(v).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown custom tag ${e}; use one of ${n}`)}return e.includes(n)||e.push(n),e},[])}e.coreKnownTags=y,e.getTags=getTags})),ke=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=B(),r=H(),i=U(),a=Oe();let sortMapEntriesByKey=(e,t)=>e.keyt.key);e.Schema=class Schema{constructor({compat:e,customTags:o,merge:s,resolveKnownTags:c,schema:l,sortMapEntries:u,toStringDefaults:d}){this.compat=Array.isArray(e)?a.getTags(e,`compat`):e?a.getTags(null,e):null,this.name=typeof l==`string`&&l||`core`,this.knownTags=c?a.coreKnownTags:{},this.tags=a.getTags(o,this.name,s),this.toStringOptions=d??null,Object.defineProperty(this,t.MAP,{value:n.map}),Object.defineProperty(this,t.SCALAR,{value:i.string}),Object.defineProperty(this,t.SEQ,{value:r.seq}),this.sortMapEntries=typeof u==`function`?u:u===!0?sortMapEntriesByKey:null}clone(){let e=Object.create(Schema.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}}})),Ae=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=L(),r=F();function stringifyDocument(e,i){let a=[],o=i.directives===!0;if(i.directives!==!1&&e.directives){let t=e.directives.toString(e);t?(a.push(t),o=!0):e.directives.docStart&&(o=!0)}o&&a.push(`---`);let s=n.createStringifyContext(e,i),{commentString:c}=s.options;if(e.commentBefore){a.length!==1&&a.unshift(``);let t=c(e.commentBefore);a.unshift(r.indentComment(t,``))}let l=!1,u=null;if(e.contents){if(t.isNode(e.contents)){if(e.contents.spaceBefore&&o&&a.push(``),e.contents.commentBefore){let t=c(e.contents.commentBefore);a.push(r.indentComment(t,``))}s.forceBlockIndent=!!e.comment,u=e.contents.comment}let i=u?void 0:()=>l=!0,d=n.stringify(e.contents,s,()=>u=null,i);u&&(d+=r.lineComment(d,``,c(u))),(d[0]===`|`||d[0]===`>`)&&a[a.length-1]===`---`?a[a.length-1]=`--- ${d}`:a.push(d)}else a.push(n.stringify(e.contents,s));if(e.directives?.docEnd){if(e.comment){let t=c(e.comment);t.includes(` +`;return`${e}\n${s}${g}`}return`${h}${l}${m.join(` `)}${l}${g}`}function addCommentBefore({indent:e,options:{commentString:t}},n,i,a){if(i&&a&&(i=i.replace(/^\n+/,``)),i){let a=r.indentComment(t(i),e);n.push(a.trimStart())}}e.stringifyCollection=stringifyCollection})),z=/* @__PURE__ */ __commonJSMin((e=>{var t=he(),n=me(),r=P(),i=O(),a=R(),o=M();function findPair(e,t){let n=i.isScalar(t)?t.value:t;for(let r of e)if(i.isPair(r)&&(r.key===t||r.key===n||i.isScalar(r.key)&&r.key.value===n))return r}e.YAMLMap=class extends r.Collection{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(i.MAP,e),this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:i}=n,o=new this(e),add=(e,s)=>{if(typeof i==`function`)s=i.call(t,e,s);else if(Array.isArray(i)&&!i.includes(e))return;(s!==void 0||r)&&o.items.push(a.createPair(e,s,n))};if(t instanceof Map)for(let[e,n]of t)add(e,n);else if(t&&typeof t==`object`)for(let e of Object.keys(t))add(e,t[e]);return typeof e.sortMapEntries==`function`&&o.items.sort(e.sortMapEntries),o}add(e,t){let n;n=i.isPair(e)?e:!e||typeof e!=`object`||!(`key`in e)?new a.Pair(e,e?.value):new a.Pair(e.key,e.value);let r=findPair(this.items,n.key),s=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);i.isScalar(r.value)&&o.isScalarValue(n.value)?r.value.value=n.value:r.value=n.value}else if(s){let e=this.items.findIndex(e=>s(n,e)<0);e===-1?this.items.push(n):this.items.splice(e,0,n)}else this.items.push(n)}delete(e){let t=findPair(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=findPair(this.items,e)?.value;return(!t&&i.isScalar(n)?n.value:n)??void 0}has(e){return!!findPair(this.items,e)}set(e,t){this.add(new a.Pair(e,t),!0)}toJSON(e,t,r){let i=r?new r:t?.mapAsMap?/* @__PURE__ */ new Map:{};t?.onCreate&&t.onCreate(i);for(let e of this.items)n.addPairToJSMap(t,i,e);return i}toString(e,n,r){if(!e)return JSON.stringify(this);for(let e of this.items)if(!i.isPair(e))throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),t.stringifyCollection(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:r,onComment:n})}},e.findPair=findPair})),B=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=z();e.map={collection:`map`,default:!0,nodeClass:n.YAMLMap,tag:`tag:yaml.org,2002:map`,resolve(e,n){return t.isMap(e)||n(`Expected a mapping for this tag`),e},createNode:(e,t,r)=>n.YAMLMap.from(e,t,r)}})),V=/* @__PURE__ */ __commonJSMin((e=>{var t=N(),n=he(),r=P(),i=O(),a=M(),o=A(),YAMLSeq=class extends r.Collection{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(i.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=asItemIndex(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=asItemIndex(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&i.isScalar(r)?r.value:r}has(e){let t=asItemIndex(e);return typeof t==`number`&&t=0?t:null}e.YAMLSeq=YAMLSeq})),H=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=V();e.seq={collection:`seq`,default:!0,nodeClass:n.YAMLSeq,tag:`tag:yaml.org,2002:seq`,resolve(e,n){return t.isSeq(e)||n(`Expected a sequence for this tag`),e},createNode:(e,t,r)=>n.YAMLSeq.from(e,t,r)}})),U=/* @__PURE__ */ __commonJSMin((e=>{var t=I();e.string={identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify(e,n,r,i){return n=Object.assign({actualString:!0},n),t.stringifyString(e,n,r,i)}}})),ge=/* @__PURE__ */ __commonJSMin((e=>{var t=M();let n={identify:e=>e==null,createNode:()=>new t.Scalar(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new t.Scalar(null),stringify:({source:e},t)=>typeof e==`string`&&n.test.test(e)?e:t.options.nullStr};e.nullTag=n})),_e=/* @__PURE__ */ __commonJSMin((e=>{var t=M();let n={identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new t.Scalar(e[0]===`t`||e[0]===`T`),stringify({source:e,value:t},r){return e&&n.test.test(e)&&t===(e[0]===`t`||e[0]===`T`)?e:t?r.options.trueStr:r.options.falseStr}};e.boolTag=n})),W=/* @__PURE__ */ __commonJSMin((e=>{function stringifyNumber({format:e,minFractionDigits:t,tag:n,value:r}){if(typeof r==`bigint`)return String(r);let i=typeof r==`number`?r:Number(r);if(!isFinite(i))return isNaN(i)?`.nan`:i<0?`-.inf`:`.inf`;let a=Object.is(r,-0)?`-0`:JSON.stringify(r);if(!e&&t&&(!n||n===`tag:yaml.org,2002:float`)&&/^-?\d/.test(a)&&!a.includes(`e`)){let e=a.indexOf(`.`);e<0&&(e=a.length,a+=`.`);let n=t-(a.length-e-1);for(;n-->0;)a+=`0`}return a}e.stringifyNumber=stringifyNumber})),ve=/* @__PURE__ */ __commonJSMin((e=>{var t=M(),n=W();let r={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:n.stringifyNumber};e.float={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let n=new t.Scalar(parseFloat(e)),r=e.indexOf(`.`);return r!==-1&&e[e.length-1]===`0`&&(n.minFractionDigits=e.length-r-1),n},stringify:n.stringifyNumber},e.floatExp={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():n.stringifyNumber(e)}},e.floatNaN=r})),ye=/* @__PURE__ */ __commonJSMin((e=>{var t=W();let intIdentify=e=>typeof e==`bigint`||Number.isInteger(e),intResolve=(e,t,n,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),n);function intStringify(e,n,r){let{value:i}=e;return intIdentify(i)&&i>=0?r+i.toString(n):t.stringifyNumber(e)}e.int={identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>intResolve(e,0,10,n),stringify:t.stringifyNumber},e.intHex={identify:e=>intIdentify(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>intResolve(e,2,16,n),stringify:e=>intStringify(e,16,`0x`)},e.intOct={identify:e=>intIdentify(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^0o[0-7]+$/,resolve:(e,t,n)=>intResolve(e,2,8,n),stringify:e=>intStringify(e,8,`0o`)}})),be=/* @__PURE__ */ __commonJSMin((e=>{var t=B(),n=ge(),r=H(),i=U(),a=_e(),o=ve(),s=ye();e.schema=[t.map,r.seq,i.string,n.nullTag,a.boolTag,s.intOct,s.int,s.intHex,o.floatNaN,o.floatExp,o.float]})),xe=/* @__PURE__ */ __commonJSMin((e=>{var t=M(),n=B(),r=H();function intIdentify(e){return typeof e==`bigint`||Number.isInteger(e)}let stringifyJSON=({value:e})=>JSON.stringify(e),i=[{identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify:stringifyJSON},{identify:e=>e==null,createNode:()=>new t.Scalar(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^null$/,resolve:()=>null,stringify:stringifyJSON},{identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^true$|^false$/,resolve:e=>e===`true`,stringify:stringifyJSON},{identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>intIdentify(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:stringifyJSON}];e.schema=[n.map,r.seq].concat(i,{default:!0,tag:``,test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}})})),Se=/* @__PURE__ */ __commonJSMin((e=>{var t=D(`buffer`),n=M(),r=I();e.binary={identify:e=>e instanceof Uint8Array,default:!1,tag:`tag:yaml.org,2002:binary`,resolve(e,n){if(typeof t.Buffer==`function`)return t.Buffer.from(e,`base64`);if(typeof atob==`function`){let t=atob(e.replace(/[\n\r]/g,``)),n=new Uint8Array(t.length);for(let e=0;e{var t=O(),n=R(),r=M(),i=V();function resolvePairs(e,i){if(t.isSeq(e))for(let a=0;a1&&i(`Each pair must have its own sequence indicator`);let e=o.items[0]||new n.Pair(new r.Scalar(null));if(o.commentBefore&&(e.key.commentBefore=e.key.commentBefore?`${o.commentBefore}\n${e.key.commentBefore}`:o.commentBefore),o.comment){let t=e.value??e.key;t.comment=t.comment?`${o.comment}\n${t.comment}`:o.comment}o=e}e.items[a]=t.isPair(o)?o:new n.Pair(o)}}else i(`Expected a sequence for this tag`);return e}function createPairs(e,t,r){let{replacer:a}=r,o=new i.YAMLSeq(e);o.tag=`tag:yaml.org,2002:pairs`;let s=0;if(t&&Symbol.iterator in Object(t))for(let e of t){typeof a==`function`&&(e=a.call(t,String(s++),e));let i,c;if(Array.isArray(e)){if(e.length===2)i=e[0],c=e[1];else throw TypeError(`Expected [key, value] tuple: ${e}`)}else if(e&&e instanceof Object){let t=Object.keys(e);if(t.length===1)i=t[0],c=e[i];else throw TypeError(`Expected tuple with one key, not ${t.length} keys`)}else i=e;o.items.push(n.createPair(i,c,r))}return o}let a={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:resolvePairs,createNode:createPairs};e.createPairs=createPairs,e.pairs=a,e.resolvePairs=resolvePairs})),we=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=A(),r=z(),i=V(),a=Ce(),o=class YAMLOMap extends i.YAMLSeq{constructor(){super(),this.add=r.YAMLMap.prototype.add.bind(this),this.delete=r.YAMLMap.prototype.delete.bind(this),this.get=r.YAMLMap.prototype.get.bind(this),this.has=r.YAMLMap.prototype.has.bind(this),this.set=r.YAMLMap.prototype.set.bind(this),this.tag=YAMLOMap.tag}toJSON(e,r){if(!r)return super.toJSON(e);let i=/* @__PURE__ */ new Map;r?.onCreate&&r.onCreate(i);for(let e of this.items){let a,o;if(t.isPair(e)?(a=n.toJS(e.key,``,r),o=n.toJS(e.value,a,r)):a=n.toJS(e,``,r),i.has(a))throw Error(`Ordered maps must not include duplicate keys`);i.set(a,o)}return i}static from(e,t,n){let r=a.createPairs(e,t,n),i=new this;return i.items=r.items,i}};o.tag=`tag:yaml.org,2002:omap`;let s={collection:`seq`,identify:e=>e instanceof Map,nodeClass:o,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,n){let r=a.resolvePairs(e,n),i=[];for(let{key:e}of r.items)t.isScalar(e)&&(i.includes(e.value)?n(`Ordered maps must not include duplicate keys: ${e.value}`):i.push(e.value));return Object.assign(new o,r)},createNode:(e,t,n)=>o.from(e,t,n)};e.YAMLOMap=o,e.omap=s})),Te=/* @__PURE__ */ __commonJSMin((e=>{var t=M();function boolStringify({value:e,source:t},i){return t&&(e?n:r).test.test(t)?t:e?i.options.trueStr:i.options.falseStr}let n={identify:e=>e===!0,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new t.Scalar(!0),stringify:boolStringify},r={identify:e=>e===!1,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new t.Scalar(!1),stringify:boolStringify};e.falseTag=r,e.trueTag=n})),Ee=/* @__PURE__ */ __commonJSMin((e=>{var t=M(),n=W();let r={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:n.stringifyNumber};e.float={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let n=new t.Scalar(parseFloat(e.replace(/_/g,``))),r=e.indexOf(`.`);if(r!==-1){let t=e.substring(r+1).replace(/_/g,``);t[t.length-1]===`0`&&(n.minFractionDigits=t.length)}return n},stringify:n.stringifyNumber},e.floatExp={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,``)),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():n.stringifyNumber(e)}},e.floatNaN=r})),De=/* @__PURE__ */ __commonJSMin((e=>{var t=W();let intIdentify=e=>typeof e==`bigint`||Number.isInteger(e);function intResolve(e,t,n,{intAsBigInt:r}){let i=e[0];if((i===`-`||i===`+`)&&(t+=1),e=e.substring(t).replace(/_/g,``),r){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`}let t=BigInt(e);return i===`-`?BigInt(-1)*t:t}let a=parseInt(e,n);return i===`-`?-1*a:a}function intStringify(e,n,r){let{value:i}=e;if(intIdentify(i)){let e=i.toString(n);return i<0?`-`+r+e.substr(1):r+e}return t.stringifyNumber(e)}let n={identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>intResolve(e,2,2,n),stringify:e=>intStringify(e,2,`0b`)},r={identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>intResolve(e,1,8,n),stringify:e=>intStringify(e,8,`0`)},i={identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>intResolve(e,0,10,n),stringify:t.stringifyNumber},a={identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>intResolve(e,2,16,n),stringify:e=>intStringify(e,16,`0x`)};e.int=i,e.intBin=n,e.intHex=a,e.intOct=r})),Oe=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=R(),r=z(),i=class YAMLSet extends r.YAMLMap{constructor(e){super(e),this.tag=YAMLSet.tag}add(e){let i;i=t.isPair(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new n.Pair(e.key,null):new n.Pair(e,null),r.findPair(this.items,i.key)||this.items.push(i)}get(e,n){let i=r.findPair(this.items,e);return!n&&t.isPair(i)?t.isScalar(i.key)?i.key.value:i.key:i}set(e,t){if(typeof t!=`boolean`)throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let i=r.findPair(this.items,e);i&&!t?this.items.splice(this.items.indexOf(i),1):!i&&t&&this.items.push(new n.Pair(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw Error(`Set items must all have null values`)}static from(e,t,r){let{replacer:i}=r,a=new this(e);if(t&&Symbol.iterator in Object(t))for(let e of t)typeof i==`function`&&(e=i.call(t,e,e)),a.items.push(n.createPair(e,null,r));return a}};i.tag=`tag:yaml.org,2002:set`;let a={collection:`map`,identify:e=>e instanceof Set,nodeClass:i,default:!1,tag:`tag:yaml.org,2002:set`,createNode:(e,t,n)=>i.from(e,t,n),resolve(e,n){if(t.isMap(e)){if(e.hasAllNullValues(!0))return Object.assign(new i,e);n(`Set items must all have null values`)}else n(`Expected a mapping for this tag`);return e}};e.YAMLSet=i,e.set=a})),ke=/* @__PURE__ */ __commonJSMin((e=>{var t=W();function parseSexagesimal(e,t){let n=e[0],r=n===`-`||n===`+`?e.substring(1):e,num=e=>t?BigInt(e):Number(e),i=r.replace(/_/g,``).split(`:`).reduce((e,t)=>e*num(60)+num(t),num(0));return n===`-`?num(-1)*i:i}function stringifySexagesimal(e){let{value:n}=e,num=e=>e;if(typeof n==`bigint`)num=e=>BigInt(e);else if(isNaN(n)||!isFinite(n))return t.stringifyNumber(e);let r=``;n<0&&(r=`-`,n*=num(-1));let i=num(60),a=[n%i];return n<60?a.unshift(0):(n=(n-a[0])/i,a.unshift(n%i),n>=60&&(n=(n-a[0])/i,a.unshift(n))),r+a.map(e=>String(e).padStart(2,`0`)).join(`:`).replace(/000000\d*$/,``)}let n={identify:e=>typeof e==`bigint`||Number.isInteger(e),default:!0,tag:`tag:yaml.org,2002:int`,format:`TIME`,test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>parseSexagesimal(e,n),stringify:stringifySexagesimal},r={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`TIME`,test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>parseSexagesimal(e,!1),stringify:stringifySexagesimal},i={identify:e=>e instanceof Date,default:!0,tag:`tag:yaml.org,2002:timestamp`,test:RegExp(`^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$`),resolve(e){let t=e.match(i.test);if(!t)throw Error(`!!timestamp expects a date, starting with yyyy-mm-dd`);let[,n,r,a,o,s,c]=t.map(Number),l=t[7]?Number((t[7]+`00`).substr(1,3)):0,u=Date.UTC(n,r-1,a,o||0,s||0,c||0,l),d=t[8];if(d&&d!==`Z`){let e=parseSexagesimal(d,!1);Math.abs(e)<30&&(e*=60),u-=6e4*e}return new Date(u)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,``)??``};e.floatTime=r,e.intTime=n,e.timestamp=i})),Ae=/* @__PURE__ */ __commonJSMin((e=>{var t=B(),n=ge(),r=H(),i=U(),a=Se(),o=Te(),s=Ee(),c=De(),l=pe(),u=we(),d=Ce(),f=Oe(),p=ke();e.schema=[t.map,r.seq,i.string,n.nullTag,o.trueTag,o.falseTag,c.intBin,c.intOct,c.int,c.intHex,s.floatNaN,s.floatExp,s.float,a.binary,l.merge,u.omap,d.pairs,f.set,p.intTime,p.floatTime,p.timestamp]})),je=/* @__PURE__ */ __commonJSMin((e=>{var t=B(),n=ge(),r=H(),i=U(),a=_e(),o=ve(),s=ye(),c=be(),l=xe(),u=Se(),d=pe(),f=we(),p=Ce(),m=Ae(),h=Oe(),g=ke();let _=/* @__PURE__ */ new Map([[`core`,c.schema],[`failsafe`,[t.map,r.seq,i.string]],[`json`,l.schema],[`yaml11`,m.schema],[`yaml-1.1`,m.schema]]),v={binary:u.binary,bool:a.boolTag,float:o.float,floatExp:o.floatExp,floatNaN:o.floatNaN,floatTime:g.floatTime,int:s.int,intHex:s.intHex,intOct:s.intOct,intTime:g.intTime,map:t.map,merge:d.merge,null:n.nullTag,omap:f.omap,pairs:p.pairs,seq:r.seq,set:h.set,timestamp:g.timestamp},y={"tag:yaml.org,2002:binary":u.binary,"tag:yaml.org,2002:merge":d.merge,"tag:yaml.org,2002:omap":f.omap,"tag:yaml.org,2002:pairs":p.pairs,"tag:yaml.org,2002:set":h.set,"tag:yaml.org,2002:timestamp":g.timestamp};function getTags(e,t,n){let r=_.get(t);if(r&&!e)return n&&!r.includes(d.merge)?r.concat(d.merge):r.slice();let i=r;if(!i){if(Array.isArray(e))i=[];else{let e=Array.from(_.keys()).filter(e=>e!==`yaml11`).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown schema "${t}"; use one of ${e} or define customTags array`)}}if(Array.isArray(e))for(let t of e)i=i.concat(t);else typeof e==`function`&&(i=e(i.slice()));return n&&(i=i.concat(d.merge)),i.reduce((e,t)=>{let n=typeof t==`string`?v[t]:t;if(!n){let e=JSON.stringify(t),n=Object.keys(v).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown custom tag ${e}; use one of ${n}`)}return e.includes(n)||e.push(n),e},[])}e.coreKnownTags=y,e.getTags=getTags})),Me=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=B(),r=H(),i=U(),a=je();let sortMapEntriesByKey=(e,t)=>e.keyt.key);e.Schema=class Schema{constructor({compat:e,customTags:o,merge:s,resolveKnownTags:c,schema:l,sortMapEntries:u,toStringDefaults:d}){this.compat=Array.isArray(e)?a.getTags(e,`compat`):e?a.getTags(null,e):null,this.name=typeof l==`string`&&l||`core`,this.knownTags=c?a.coreKnownTags:{},this.tags=a.getTags(o,this.name,s),this.toStringOptions=d??null,Object.defineProperty(this,t.MAP,{value:n.map}),Object.defineProperty(this,t.SCALAR,{value:i.string}),Object.defineProperty(this,t.SEQ,{value:r.seq}),this.sortMapEntries=typeof u==`function`?u:u===!0?sortMapEntriesByKey:null}clone(){let e=Object.create(Schema.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}}})),Ne=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=L(),r=F();function stringifyDocument(e,i){let a=[],o=i.directives===!0;if(i.directives!==!1&&e.directives){let t=e.directives.toString(e);t?(a.push(t),o=!0):e.directives.docStart&&(o=!0)}o&&a.push(`---`);let s=n.createStringifyContext(e,i),{commentString:c}=s.options;if(e.commentBefore){a.length!==1&&a.unshift(``);let t=c(e.commentBefore);a.unshift(r.indentComment(t,``))}let l=!1,u=null;if(e.contents){if(t.isNode(e.contents)){if(e.contents.spaceBefore&&o&&a.push(``),e.contents.commentBefore){let t=c(e.contents.commentBefore);a.push(r.indentComment(t,``))}s.forceBlockIndent=!!e.comment,u=e.contents.comment}let i=u?void 0:()=>l=!0,d=n.stringify(e.contents,s,()=>u=null,i);u&&(d+=r.lineComment(d,``,c(u))),(d[0]===`|`||d[0]===`>`)&&a[a.length-1]===`---`?a[a.length-1]=`--- ${d}`:a.push(d)}else a.push(n.stringify(e.contents,s));if(e.directives?.docEnd){if(e.comment){let t=c(e.comment);t.includes(` `)?(a.push(`...`),a.push(r.indentComment(t,``))):a.push(`... ${t}`)}else a.push(`...`)}else{let t=e.comment;t&&l&&(t=t.replace(/^\n+/,``)),t&&((!l||u)&&a[a.length-1]!==``&&a.push(``),a.push(r.indentComment(c(t),``)))}return a.join(` `)+` -`}e.stringifyDocument=stringifyDocument})),G=/* @__PURE__ */ __commonJSMin((e=>{var t=M(),n=oe(),r=O(),i=R(),a=A(),o=ke(),s=Ae(),c=ie(),l=ae(),u=P(),d=re(),f=class Document{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,r.NODE_TYPE,{value:r.DOC});let i=null;typeof t==`function`||Array.isArray(t)?i=t:n===void 0&&t&&(n=t,t=void 0);let a=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:`warn`,prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:`1.2`},n);this.options=a;let{version:o}=a;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new d.Directives({version:o}),this.setSchema(o,n),this.contents=e===void 0?null:this.createNode(e,i,n)}clone(){let e=Object.create(Document.prototype,{[r.NODE_TYPE]:{value:r.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=r.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){assertCollection(this.contents)&&this.contents.add(e)}addIn(e,t){assertCollection(this.contents)&&this.contents.addIn(e,t)}createAlias(e,n){if(!e.anchor){let t=c.anchorNames(this);e.anchor=!n||t.has(n)?c.findNewAnchor(n||`a`,t):n}return new t.Alias(e.anchor)}createNode(e,t,n){let i;if(typeof t==`function`)e=t.call({"":e},``,e),i=t;else if(Array.isArray(t)){let e=t.filter(e=>typeof e==`number`||e instanceof String||e instanceof Number).map(String);e.length>0&&(t=t.concat(e)),i=t}else n===void 0&&t&&(n=t,t=void 0);let{aliasDuplicateObjects:a,anchorPrefix:o,flow:s,keepUndefined:l,onTagObj:d,tag:f}=n??{},{onAnchor:p,setAnchors:m,sourceObjects:h}=c.createNodeAnchors(this,o||`a`),g={aliasDuplicateObjects:a??!0,keepUndefined:l??!1,onAnchor:p,onTagObj:d,replacer:i,schema:this.schema,sourceObjects:h},_=u.createNode(e,f,g);return s&&r.isCollection(_)&&(_.flow=!0),m(),_}createPair(e,t,n={}){let r=this.createNode(e,null,n),a=this.createNode(t,null,n);return new i.Pair(r,a)}delete(e){return assertCollection(this.contents)?this.contents.delete(e):!1}deleteIn(e){return n.isEmptyPath(e)?this.contents!=null&&(this.contents=null,!0):assertCollection(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return r.isCollection(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return n.isEmptyPath(e)?!t&&r.isScalar(this.contents)?this.contents.value:this.contents:r.isCollection(this.contents)?this.contents.getIn(e,t):void 0}has(e){return r.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return n.isEmptyPath(e)?this.contents!==void 0:r.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=n.collectionFromPath(this.schema,[e],t):assertCollection(this.contents)&&this.contents.set(e,t)}setIn(e,t){n.isEmptyPath(e)?this.contents=t:this.contents==null?this.contents=n.collectionFromPath(this.schema,Array.from(e),t):assertCollection(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e==`number`&&(e=String(e));let n;switch(e){case`1.1`:this.directives?this.directives.yaml.version=`1.1`:this.directives=new d.Directives({version:`1.1`}),n={resolveKnownTags:!1,schema:`yaml-1.1`};break;case`1.2`:case`next`:this.directives?this.directives.yaml.version=e:this.directives=new d.Directives({version:e}),n={resolveKnownTags:!0,schema:`core`};break;case null:this.directives&&delete this.directives,n=null;break;default:{let t=JSON.stringify(e);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${t}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(n)this.schema=new o.Schema(Object.assign(n,t));else throw Error(`With a null YAML version, the { schema: Schema } option is required`)}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:r,onAnchor:i,reviver:o}={}){let s={anchors:/* @__PURE__ */ new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r==`number`?r:100},c=a.toJS(this.contents,t??``,s);if(typeof i==`function`)for(let{count:e,res:t}of s.anchors.values())i(t,e);return typeof o==`function`?l.applyReviver(o,{"":c},``,c):c}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw Error(`Document with errors cannot be stringified`);if(`indent`in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw Error(`"indent" option must be a positive integer, not ${t}`)}return s.stringifyDocument(this,e)}};function assertCollection(e){if(r.isCollection(e))return!0;throw Error(`Expected a YAML collection as document contents`)}e.Document=f})),K=/* @__PURE__ */ __commonJSMin((e=>{var YAMLError=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},YAMLParseError=class extends YAMLError{constructor(e,t,n){super(`YAMLParseError`,e,t,n)}},YAMLWarning=class extends YAMLError{constructor(e,t,n){super(`YAMLWarning`,e,t,n)}};e.YAMLError=YAMLError,e.YAMLParseError=YAMLParseError,e.YAMLWarning=YAMLWarning,e.prettifyError=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(e=>t.linePos(e));let{line:r,col:i}=n.linePos[0];n.message+=` at line ${r}, column ${i}`;let a=i-1,o=e.substring(t.lineStarts[r-1],t.lineStarts[r]).replace(/[\n\r]+$/,``);if(a>=60&&o.length>80){let e=Math.min(a-39,o.length-79);o=`…`+o.substring(e),a-=e-1}if(o.length>80&&(o=o.substring(0,79)+`…`),r>1&&/^ *$/.test(o.substring(0,a))){let n=e.substring(t.lineStarts[r-2],t.lineStarts[r-1]);n.length>80&&(n=n.substring(0,79)+`… -`),o=n+o}if(/[^ ]/.test(o)){let e=1,t=n.linePos[1];t?.line===r&&t.col>i&&(e=Math.max(1,Math.min(t.col-i,80-a)));let s=` `.repeat(a)+`^`.repeat(e);n.message+=`:\n\n${o}\n${s}\n`}}})),q=/* @__PURE__ */ __commonJSMin((e=>{function resolveProps(e,{flow:t,indicator:n,next:r,offset:i,onError:a,parentIndent:o,startOnNewline:s}){let c=!1,l=s,u=s,d=``,f=``,p=!1,m=!1,h=null,g=null,_=null,v=null,y=null,b=null,x=null;for(let i of e)switch(m&&=(i.type!==`space`&&i.type!==`newline`&&i.type!==`comma`&&a(i.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),!1),h&&=(l&&i.type!==`comment`&&i.type!==`newline`&&a(h,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),null),i.type){case`space`:!t&&(n!==`doc-start`||r?.type!==`flow-collection`)&&i.source.includes(` `)&&(h=i),u=!0;break;case`comment`:{u||a(i,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let e=i.source.substring(1)||` `;d?d+=f+e:d=e,f=``,l=!1;break}case`newline`:l?d?d+=i.source:(!b||n!==`seq-item-ind`)&&(c=!0):f+=i.source,l=!0,p=!0,(g||_)&&(v=i),u=!0;break;case`anchor`:g&&a(i,`MULTIPLE_ANCHORS`,`A node can have at most one anchor`),i.source.endsWith(`:`)&&a(i.offset+i.source.length-1,`BAD_ALIAS`,`Anchor ending in : is ambiguous`,!0),g=i,x??=i.offset,l=!1,u=!1,m=!0;break;case`tag`:_&&a(i,`MULTIPLE_TAGS`,`A node can have at most one tag`),_=i,x??=i.offset,l=!1,u=!1,m=!0;break;case n:(g||_)&&a(i,`BAD_PROP_ORDER`,`Anchors and tags must be after the ${i.source} indicator`),b&&a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.source} in ${t??`collection`}`),b=i,l=n===`seq-item-ind`||n===`explicit-key-ind`,u=!1;break;case`comma`:if(t){y&&a(i,`UNEXPECTED_TOKEN`,`Unexpected , in ${t}`),y=i,l=!1,u=!1;break}default:a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.type} token`),l=!1,u=!1}let S=e[e.length-1],C=S?S.offset+S.source.length:i;return m&&r&&r.type!==`space`&&r.type!==`newline`&&r.type!==`comma`&&(r.type!==`scalar`||r.source!==``)&&a(r.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),h&&(l&&h.indent<=o||r?.type===`block-map`||r?.type===`block-seq`)&&a(h,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),{comma:y,found:b,spaceBefore:c,comment:d,hasNewline:p,anchor:g,tag:_,newlineAfterProp:v,end:C,start:x??C}}e.resolveProps=resolveProps})),je=/* @__PURE__ */ __commonJSMin((e=>{function containsNewline(e){if(!e)return null;switch(e.type){case`alias`:case`scalar`:case`double-quoted-scalar`:case`single-quoted-scalar`:if(e.source.includes(` -`))return!0;if(e.end){for(let t of e.end)if(t.type===`newline`)return!0}return!1;case`flow-collection`:for(let t of e.items){for(let e of t.start)if(e.type===`newline`)return!0;if(t.sep){for(let e of t.sep)if(e.type===`newline`)return!0}if(containsNewline(t.key)||containsNewline(t.value))return!0}return!1;default:return!0}}e.containsNewline=containsNewline})),Me=/* @__PURE__ */ __commonJSMin((e=>{var t=je();function flowIndentCheck(e,n,r){if(n?.type===`flow-collection`){let i=n.end[0];i.indent===e&&(i.source===`]`||i.source===`}`)&&t.containsNewline(n)&&r(i,`BAD_INDENT`,`Flow end indicator should be more indented than parent`,!0)}}e.flowIndentCheck=flowIndentCheck})),Ne=/* @__PURE__ */ __commonJSMin((e=>{var t=O();function mapIncludes(e,n,r){let{uniqueKeys:i}=e.options;if(i===!1)return!1;let a=typeof i==`function`?i:(e,n)=>e===n||t.isScalar(e)&&t.isScalar(n)&&e.value===n.value;return n.some(e=>a(e.key,r))}e.mapIncludes=mapIncludes})),Pe=/* @__PURE__ */ __commonJSMin((e=>{var t=R(),n=z(),r=q(),i=je(),a=Me(),o=Ne();let s=`All mapping items must start at the same column`;function resolveBlockMap({composeNode:e,composeEmptyNode:c},l,u,d,f){let p=new((f?.nodeClass)??n.YAMLMap)(l.schema);l.atRoot&&=!1;let m=u.offset,h=null;for(let n of u.items){let{start:f,key:g,sep:_,value:v}=n,y=r.resolveProps(f,{indicator:`explicit-key-ind`,next:g??_?.[0],offset:m,onError:d,parentIndent:u.indent,startOnNewline:!0}),b=!y.found;if(b){if(g&&(g.type===`block-seq`?d(m,`BLOCK_AS_IMPLICIT_KEY`,`A block sequence may not be used as an implicit map key`):`indent`in g&&g.indent!==u.indent&&d(m,`BAD_INDENT`,s)),!y.anchor&&!y.tag&&!_){h=y.end,y.comment&&(p.comment?p.comment+=` +`}e.stringifyDocument=stringifyDocument})),G=/* @__PURE__ */ __commonJSMin((e=>{var t=j(),n=P(),r=O(),i=R(),a=A(),o=Me(),s=Ne(),c=se(),l=ce(),u=N(),d=oe(),f=class Document{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,r.NODE_TYPE,{value:r.DOC});let i=null;typeof t==`function`||Array.isArray(t)?i=t:n===void 0&&t&&(n=t,t=void 0);let a=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:`warn`,prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:`1.2`},n);this.options=a;let{version:o}=a;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new d.Directives({version:o}),this.setSchema(o,n),this.contents=e===void 0?null:this.createNode(e,i,n)}clone(){let e=Object.create(Document.prototype,{[r.NODE_TYPE]:{value:r.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=r.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){assertCollection(this.contents)&&this.contents.add(e)}addIn(e,t){assertCollection(this.contents)&&this.contents.addIn(e,t)}createAlias(e,n){if(!e.anchor){let t=c.anchorNames(this);e.anchor=!n||t.has(n)?c.findNewAnchor(n||`a`,t):n}return new t.Alias(e.anchor)}createNode(e,t,n){let i;if(typeof t==`function`)e=t.call({"":e},``,e),i=t;else if(Array.isArray(t)){let e=t.filter(e=>typeof e==`number`||e instanceof String||e instanceof Number).map(String);e.length>0&&(t=t.concat(e)),i=t}else n===void 0&&t&&(n=t,t=void 0);let{aliasDuplicateObjects:a,anchorPrefix:o,flow:s,keepUndefined:l,onTagObj:d,tag:f}=n??{},{onAnchor:p,setAnchors:m,sourceObjects:h}=c.createNodeAnchors(this,o||`a`),g={aliasDuplicateObjects:a??!0,keepUndefined:l??!1,onAnchor:p,onTagObj:d,replacer:i,schema:this.schema,sourceObjects:h},_=u.createNode(e,f,g);return s&&r.isCollection(_)&&(_.flow=!0),m(),_}createPair(e,t,n={}){let r=this.createNode(e,null,n),a=this.createNode(t,null,n);return new i.Pair(r,a)}delete(e){return assertCollection(this.contents)?this.contents.delete(e):!1}deleteIn(e){return n.isEmptyPath(e)?this.contents!=null&&(this.contents=null,!0):assertCollection(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return r.isCollection(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return n.isEmptyPath(e)?!t&&r.isScalar(this.contents)?this.contents.value:this.contents:r.isCollection(this.contents)?this.contents.getIn(e,t):void 0}has(e){return r.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return n.isEmptyPath(e)?this.contents!==void 0:r.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=n.collectionFromPath(this.schema,[e],t):assertCollection(this.contents)&&this.contents.set(e,t)}setIn(e,t){n.isEmptyPath(e)?this.contents=t:this.contents==null?this.contents=n.collectionFromPath(this.schema,Array.from(e),t):assertCollection(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e==`number`&&(e=String(e));let n;switch(e){case`1.1`:this.directives?this.directives.yaml.version=`1.1`:this.directives=new d.Directives({version:`1.1`}),n={resolveKnownTags:!1,schema:`yaml-1.1`};break;case`1.2`:case`next`:this.directives?this.directives.yaml.version=e:this.directives=new d.Directives({version:e}),n={resolveKnownTags:!0,schema:`core`};break;case null:this.directives&&delete this.directives,n=null;break;default:{let t=JSON.stringify(e);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${t}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(n)this.schema=new o.Schema(Object.assign(n,t));else throw Error(`With a null YAML version, the { schema: Schema } option is required`)}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:r,onAnchor:i,reviver:o}={}){let s={anchors:/* @__PURE__ */ new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r==`number`?r:100},c=a.toJS(this.contents,t??``,s);if(typeof i==`function`)for(let{count:e,res:t}of s.anchors.values())i(t,e);return typeof o==`function`?l.applyReviver(o,{"":c},``,c):c}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw Error(`Document with errors cannot be stringified`);if(`indent`in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw Error(`"indent" option must be a positive integer, not ${t}`)}return s.stringifyDocument(this,e)}};function assertCollection(e){if(r.isCollection(e))return!0;throw Error(`Expected a YAML collection as document contents`)}e.Document=f})),K=/* @__PURE__ */ __commonJSMin((e=>{var YAMLError=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},YAMLParseError=class extends YAMLError{constructor(e,t,n){super(`YAMLParseError`,e,t,n)}},YAMLWarning=class extends YAMLError{constructor(e,t,n){super(`YAMLWarning`,e,t,n)}};e.YAMLError=YAMLError,e.YAMLParseError=YAMLParseError,e.YAMLWarning=YAMLWarning,e.prettifyError=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(e=>t.linePos(e));let{line:r,col:i}=n.linePos[0];n.message+=` at line ${r}, column ${i}`;let a=i-1,o=e.substring(t.lineStarts[r-1],t.lineStarts[r]).replace(/[\n\r]+$/,``);if(a>=60&&o.length>80){let e=Math.min(a-39,o.length-79);o=`…`+o.substring(e),a-=e-1}if(o.length>80&&(o=o.substring(0,79)+`…`),r>1&&/^ *$/.test(o.substring(0,a))){let n=e.substring(t.lineStarts[r-2],t.lineStarts[r-1]);n.length>80&&(n=n.substring(0,79)+`… +`),o=n+o}if(/[^ ]/.test(o)){let e=1,t=n.linePos[1];t?.line===r&&t.col>i&&(e=Math.max(1,Math.min(t.col-i,80-a)));let s=` `.repeat(a)+`^`.repeat(e);n.message+=`:\n\n${o}\n${s}\n`}}})),q=/* @__PURE__ */ __commonJSMin((e=>{function resolveProps(e,{flow:t,indicator:n,next:r,offset:i,onError:a,parentIndent:o,startOnNewline:s}){let c=!1,l=s,u=s,d=``,f=``,p=!1,m=!1,h=null,g=null,_=null,v=null,y=null,b=null,x=null;for(let i of e)switch(m&&=(i.type!==`space`&&i.type!==`newline`&&i.type!==`comma`&&a(i.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),!1),h&&=(l&&i.type!==`comment`&&i.type!==`newline`&&a(h,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),null),i.type){case`space`:!t&&(n!==`doc-start`||r?.type!==`flow-collection`)&&i.source.includes(` `)&&(h=i),u=!0;break;case`comment`:{u||a(i,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let e=i.source.substring(1)||` `;d?d+=f+e:d=e,f=``,l=!1;break}case`newline`:l?d?d+=i.source:(!b||n!==`seq-item-ind`)&&(c=!0):f+=i.source,l=!0,p=!0,(g||_)&&(v=i),u=!0;break;case`anchor`:g&&a(i,`MULTIPLE_ANCHORS`,`A node can have at most one anchor`),i.source.endsWith(`:`)&&a(i.offset+i.source.length-1,`BAD_ALIAS`,`Anchor ending in : is ambiguous`,!0),g=i,x??=i.offset,l=!1,u=!1,m=!0;break;case`tag`:_&&a(i,`MULTIPLE_TAGS`,`A node can have at most one tag`),_=i,x??=i.offset,l=!1,u=!1,m=!0;break;case n:(g||_)&&a(i,`BAD_PROP_ORDER`,`Anchors and tags must be after the ${i.source} indicator`),b&&a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.source} in ${t??`collection`}`),b=i,l=n===`seq-item-ind`||n===`explicit-key-ind`,u=!1;break;case`comma`:if(t){y&&a(i,`UNEXPECTED_TOKEN`,`Unexpected , in ${t}`),y=i,l=!1,u=!1;break}default:a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.type} token`),l=!1,u=!1}let S=e[e.length-1],C=S?S.offset+S.source.length:i;return m&&r&&r.type!==`space`&&r.type!==`newline`&&r.type!==`comma`&&(r.type!==`scalar`||r.source!==``)&&a(r.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),h&&(l&&h.indent<=o||r?.type===`block-map`||r?.type===`block-seq`)&&a(h,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),{comma:y,found:b,spaceBefore:c,comment:d,hasNewline:p,anchor:g,tag:_,newlineAfterProp:v,end:C,start:x??C}}e.resolveProps=resolveProps})),Pe=/* @__PURE__ */ __commonJSMin((e=>{function containsNewline(e){if(!e)return null;switch(e.type){case`alias`:case`scalar`:case`double-quoted-scalar`:case`single-quoted-scalar`:if(e.source.includes(` +`))return!0;if(e.end){for(let t of e.end)if(t.type===`newline`)return!0}return!1;case`flow-collection`:for(let t of e.items){for(let e of t.start)if(e.type===`newline`)return!0;if(t.sep){for(let e of t.sep)if(e.type===`newline`)return!0}if(containsNewline(t.key)||containsNewline(t.value))return!0}return!1;default:return!0}}e.containsNewline=containsNewline})),Fe=/* @__PURE__ */ __commonJSMin((e=>{var t=Pe();function flowIndentCheck(e,n,r){if(n?.type===`flow-collection`){let i=n.end[0];i.indent===e&&(i.source===`]`||i.source===`}`)&&t.containsNewline(n)&&r(i,`BAD_INDENT`,`Flow end indicator should be more indented than parent`,!0)}}e.flowIndentCheck=flowIndentCheck})),Ie=/* @__PURE__ */ __commonJSMin((e=>{var t=O();function mapIncludes(e,n,r){let{uniqueKeys:i}=e.options;if(i===!1)return!1;let a=typeof i==`function`?i:(e,n)=>e===n||t.isScalar(e)&&t.isScalar(n)&&e.value===n.value;return n.some(e=>a(e.key,r))}e.mapIncludes=mapIncludes})),Le=/* @__PURE__ */ __commonJSMin((e=>{var t=R(),n=z(),r=q(),i=Pe(),a=Fe(),o=Ie();let s=`All mapping items must start at the same column`;function resolveBlockMap({composeNode:e,composeEmptyNode:c},l,u,d,f){let p=new((f?.nodeClass)??n.YAMLMap)(l.schema);l.atRoot&&=!1;let m=u.offset,h=null;for(let n of u.items){let{start:f,key:g,sep:_,value:v}=n,y=r.resolveProps(f,{indicator:`explicit-key-ind`,next:g??_?.[0],offset:m,onError:d,parentIndent:u.indent,startOnNewline:!0}),b=!y.found;if(b){if(g&&(g.type===`block-seq`?d(m,`BLOCK_AS_IMPLICIT_KEY`,`A block sequence may not be used as an implicit map key`):`indent`in g&&g.indent!==u.indent&&d(m,`BAD_INDENT`,s)),!y.anchor&&!y.tag&&!_){h=y.end,y.comment&&(p.comment?p.comment+=` `+y.comment:p.comment=y.comment);continue}(y.newlineAfterProp||i.containsNewline(g))&&d(g??f[f.length-1],`MULTILINE_IMPLICIT_KEY`,`Implicit keys need to be on a single line`)}else y.found?.indent!==u.indent&&d(m,`BAD_INDENT`,s);l.atKey=!0;let x=y.end,S=g?e(l,g,y,d):c(l,x,f,null,y,d);l.schema.compat&&a.flowIndentCheck(u.indent,g,d),l.atKey=!1,o.mapIncludes(l,p.items,S)&&d(x,`DUPLICATE_KEY`,`Map keys must be unique`);let C=r.resolveProps(_??[],{indicator:`map-value-ind`,next:v,offset:S.range[2],onError:d,parentIndent:u.indent,startOnNewline:!g||g.type===`block-scalar`});if(m=C.end,C.found){b&&(v?.type===`block-map`&&!C.hasNewline&&d(m,`BLOCK_AS_IMPLICIT_KEY`,`Nested mappings are not allowed in compact mappings`),l.options.strict&&y.start{var t=V(),n=q(),r=Me();function resolveBlockSeq({composeNode:e,composeEmptyNode:i},a,o,s,c){let l=new((c?.nodeClass)??t.YAMLSeq)(a.schema);a.atRoot&&=!1,a.atKey&&=!1;let u=o.offset,d=null;for(let{start:t,value:c}of o.items){let f=n.resolveProps(t,{indicator:`seq-item-ind`,next:c,offset:u,onError:s,parentIndent:o.indent,startOnNewline:!0});if(!f.found){if(f.anchor||f.tag||c)c?.type===`block-seq`?s(f.end,`BAD_INDENT`,`All sequence items must start at the same column`):s(u,`MISSING_CHAR`,`Sequence item without - indicator`);else{d=f.end,f.comment&&(l.comment=f.comment);continue}}let p=c?e(a,c,f,s):i(a,f.end,t,null,f,s);a.schema.compat&&r.flowIndentCheck(o.indent,c,s),u=p.range[2],l.items.push(p)}return l.range=[o.offset,u,d??u],l}e.resolveBlockSeq=resolveBlockSeq})),J=/* @__PURE__ */ __commonJSMin((e=>{function resolveEnd(e,t,n,r){let i=``;if(e){let a=!1,o=``;for(let s of e){let{source:e,type:c}=s;switch(c){case`space`:a=!0;break;case`comment`:{n&&!a&&r(s,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let t=e.substring(1)||` `;i?i+=o+t:i=t,o=``;break}case`newline`:i&&(o+=e),a=!0;break;default:r(s,`UNEXPECTED_TOKEN`,`Unexpected ${c} at node end`)}t+=e.length}}return{comment:i,offset:t}}e.resolveEnd=resolveEnd})),Ie=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=R(),r=z(),i=V(),a=J(),o=q(),s=je(),c=Ne();let l=`Block collections are not allowed within flow collections`,isBlock=e=>e&&(e.type===`block-map`||e.type===`block-seq`);function resolveFlowCollection({composeNode:e,composeEmptyNode:u},d,f,p,m){let h=f.start.source===`{`,g=h?`flow map`:`flow sequence`,_=new((m?.nodeClass)??(h?r.YAMLMap:i.YAMLSeq))(d.schema);_.flow=!0;let v=d.atRoot;v&&(d.atRoot=!1),d.atKey&&=!1;let y=f.offset+f.start.source.length;for(let i=0;i{var t=V(),n=q(),r=Fe();function resolveBlockSeq({composeNode:e,composeEmptyNode:i},a,o,s,c){let l=new((c?.nodeClass)??t.YAMLSeq)(a.schema);a.atRoot&&=!1,a.atKey&&=!1;let u=o.offset,d=null;for(let{start:t,value:c}of o.items){let f=n.resolveProps(t,{indicator:`seq-item-ind`,next:c,offset:u,onError:s,parentIndent:o.indent,startOnNewline:!0});if(!f.found){if(f.anchor||f.tag||c)c?.type===`block-seq`?s(f.end,`BAD_INDENT`,`All sequence items must start at the same column`):s(u,`MISSING_CHAR`,`Sequence item without - indicator`);else{d=f.end,f.comment&&(l.comment=f.comment);continue}}let p=c?e(a,c,f,s):i(a,f.end,t,null,f,s);a.schema.compat&&r.flowIndentCheck(o.indent,c,s),u=p.range[2],l.items.push(p)}return l.range=[o.offset,u,d??u],l}e.resolveBlockSeq=resolveBlockSeq})),J=/* @__PURE__ */ __commonJSMin((e=>{function resolveEnd(e,t,n,r){let i=``;if(e){let a=!1,o=``;for(let s of e){let{source:e,type:c}=s;switch(c){case`space`:a=!0;break;case`comment`:{n&&!a&&r(s,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let t=e.substring(1)||` `;i?i+=o+t:i=t,o=``;break}case`newline`:i&&(o+=e),a=!0;break;default:r(s,`UNEXPECTED_TOKEN`,`Unexpected ${c} at node end`)}t+=e.length}}return{comment:i,offset:t}}e.resolveEnd=resolveEnd})),ze=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=R(),r=z(),i=V(),a=J(),o=q(),s=Pe(),c=Ie();let l=`Block collections are not allowed within flow collections`,isBlock=e=>e&&(e.type===`block-map`||e.type===`block-seq`);function resolveFlowCollection({composeNode:e,composeEmptyNode:u},d,f,p,m){let h=f.start.source===`{`,g=h?`flow map`:`flow sequence`,_=new((m?.nodeClass)??(h?r.YAMLMap:i.YAMLSeq))(d.schema);_.flow=!0;let v=d.atRoot;v&&(d.atRoot=!1),d.atKey&&=!1;let y=f.offset+f.start.source.length;for(let i=0;i0){let e=a.resolveEnd(S,C,d.options.strict,p);e.comment&&(_.comment?_.comment+=` -`+e.comment:_.comment=e.comment),_.range=[f.offset,C,e.offset]}else _.range=[f.offset,C,C];return _}e.resolveFlowCollection=resolveFlowCollection})),Le=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=N(),r=z(),i=V(),a=Pe(),o=Fe(),s=Ie();function resolveCollection(e,t,n,r,i,c){let l=n.type===`block-map`?a.resolveBlockMap(e,t,n,r,c):n.type===`block-seq`?o.resolveBlockSeq(e,t,n,r,c):s.resolveFlowCollection(e,t,n,r,c),u=l.constructor;return i===`!`||i===u.tagName?(l.tag=u.tagName,l):(i&&(l.tag=i),l)}function composeCollection(e,a,o,s,c){let l=s.tag,u=l?a.directives.tagName(l.source,e=>c(l,`TAG_RESOLVE_FAILED`,e)):null;if(o.type===`block-seq`){let{anchor:e,newlineAfterProp:t}=s,n=e&&l?e.offset>l.offset?e:l:e??l;n&&(!t||t.offsete.tag===u&&e.collection===d);if(!f){let t=a.schema.knownTags[u];if(t?.collection===d)a.schema.tags.push(Object.assign({},t,{default:!1})),f=t;else return t?c(l,`BAD_COLLECTION_TYPE`,`${t.tag} used for ${d} collection, but expects ${t.collection??`scalar`}`,!0):c(l,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${u}`,!0),resolveCollection(e,a,o,c,u)}let p=resolveCollection(e,a,o,c,u,f),m=f.resolve?.(p,e=>c(l,`TAG_RESOLVE_FAILED`,e),a.options)??p,h=t.isNode(m)?m:new n.Scalar(m);return h.range=p.range,h.tag=u,f?.format&&(h.format=f.format),h}e.composeCollection=composeCollection})),Re=/* @__PURE__ */ __commonJSMin((e=>{var t=N();function resolveBlockScalar(e,n,r){let i=n.offset,a=parseBlockScalarHeader(n,e.options.strict,r);if(!a)return{value:``,type:null,comment:``,range:[i,i,i]};let o=a.mode===`>`?t.Scalar.BLOCK_FOLDED:t.Scalar.BLOCK_LITERAL,s=n.source?splitLines(n.source):[],c=s.length;for(let e=s.length-1;e>=0;--e){let t=s[e][1];if(t===``||t===`\r`)c=e;else break}if(c===0){let e=a.chomp===`+`&&s.length>0?` +`+e.comment:_.comment=e.comment),_.range=[f.offset,C,e.offset]}else _.range=[f.offset,C,C];return _}e.resolveFlowCollection=resolveFlowCollection})),Be=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=M(),r=z(),i=V(),a=Le(),o=Re(),s=ze();function resolveCollection(e,t,n,r,i,c){let l=n.type===`block-map`?a.resolveBlockMap(e,t,n,r,c):n.type===`block-seq`?o.resolveBlockSeq(e,t,n,r,c):s.resolveFlowCollection(e,t,n,r,c),u=l.constructor;return i===`!`||i===u.tagName?(l.tag=u.tagName,l):(i&&(l.tag=i),l)}function composeCollection(e,a,o,s,c){let l=s.tag,u=l?a.directives.tagName(l.source,e=>c(l,`TAG_RESOLVE_FAILED`,e)):null;if(o.type===`block-seq`){let{anchor:e,newlineAfterProp:t}=s,n=e&&l?e.offset>l.offset?e:l:e??l;n&&(!t||t.offsete.tag===u&&e.collection===d);if(!f){let t=a.schema.knownTags[u];if(t?.collection===d)a.schema.tags.push(Object.assign({},t,{default:!1})),f=t;else return t?c(l,`BAD_COLLECTION_TYPE`,`${t.tag} used for ${d} collection, but expects ${t.collection??`scalar`}`,!0):c(l,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${u}`,!0),resolveCollection(e,a,o,c,u)}let p=resolveCollection(e,a,o,c,u,f),m=f.resolve?.(p,e=>c(l,`TAG_RESOLVE_FAILED`,e),a.options)??p,h=t.isNode(m)?m:new n.Scalar(m);return h.range=p.range,h.tag=u,f?.format&&(h.format=f.format),h}e.composeCollection=composeCollection})),Ve=/* @__PURE__ */ __commonJSMin((e=>{var t=M();function resolveBlockScalar(e,n,r){let i=n.offset,a=parseBlockScalarHeader(n,e.options.strict,r);if(!a)return{value:``,type:null,comment:``,range:[i,i,i]};let o=a.mode===`>`?t.Scalar.BLOCK_FOLDED:t.Scalar.BLOCK_LITERAL,s=n.source?splitLines(n.source):[],c=s.length;for(let e=s.length-1;e>=0;--e){let t=s[e][1];if(t===``||t===`\r`)c=e;else break}if(c===0){let e=a.chomp===`+`&&s.length>0?` `.repeat(Math.max(1,s.length-1)):``,t=i+a.length;return n.source&&(t+=n.source.length),{value:e,type:o,comment:a.comment,range:[i,t,t]}}let l=n.indent+a.indent,u=n.offset+a.length,d=0;for(let t=0;tl&&(l=n.length);else{n.length=c;--e)s[e][0].length>l&&(c=e+1);let f=``,p=``,m=!1;for(let e=0;e{var t=N(),n=J();function resolveFlowScalar(e,r,i){let{offset:a,type:o,source:s,end:c}=e,l,u,_onError=(e,t,n)=>i(a+e,t,n);switch(o){case`scalar`:l=t.Scalar.PLAIN,u=plainValue(s,_onError);break;case`single-quoted-scalar`:l=t.Scalar.QUOTE_SINGLE,u=singleQuotedValue(s,_onError);break;case`double-quoted-scalar`:l=t.Scalar.QUOTE_DOUBLE,u=doubleQuotedValue(s,_onError);break; +default:{r(i,`UNEXPECTED_TOKEN`,`Unexpected token in block scalar header: ${i.type}`);let e=i.source;e&&typeof e==`string`&&(d+=e.length)}}}return{mode:a,indent:o,chomp:s,comment:u,length:d}}function splitLines(e){let t=e.split(/\n( *)/),n=t[0],r=n.match(/^( *)/),i=[r?.[1]?[r[1],n.slice(r[1].length)]:[``,n]];for(let e=1;e{var t=M(),n=J();function resolveFlowScalar(e,r,i){let{offset:a,type:o,source:s,end:c}=e,l,u,_onError=(e,t,n)=>i(a+e,t,n);switch(o){case`scalar`:l=t.Scalar.PLAIN,u=plainValue(s,_onError);break;case`single-quoted-scalar`:l=t.Scalar.QUOTE_SINGLE,u=singleQuotedValue(s,_onError);break;case`double-quoted-scalar`:l=t.Scalar.QUOTE_DOUBLE,u=doubleQuotedValue(s,_onError);break; /* istanbul ignore next should not happen */ default:return i(e,`UNEXPECTED_TOKEN`,`Expected a flow scalar value, but found: ${o}`),{value:``,type:null,comment:``,range:[a,a+s.length,a+s.length]}}let d=a+s.length,f=n.resolveEnd(c,d,r,i);return{value:u,type:l,comment:f.comment,range:[a,d,f.offset]}}function plainValue(e,t){let n=``;switch(e[0]){ /* istanbul ignore next should not happen */ @@ -86,10 +86,10 @@ case` `:n=`a tab character`;break;case`,`:n=`flow indicator character ,`;break;c `);)r===` `&&(n+=` `),t+=1,r=e[t+1];return n||=` `,{fold:n,offset:t}}let r={0:`\0`,a:`\x07`,b:`\b`,e:`\x1B`,f:`\f`,n:` -`,r:`\r`,t:` `,v:`\v`,N:`…`,_:`\xA0`,L:`\u2028`,P:`\u2029`," ":` `,'"':`"`,"/":`/`,"\\":`\\`," ":` `};function parseCharCode(e,t,n,r){let i=e.substr(t,n),a=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(a)}catch{let i=e.substr(t-2,n+2);return r(t-2,`BAD_DQ_ESCAPE`,`Invalid escape sequence ${i}`),i}}e.resolveFlowScalar=resolveFlowScalar})),Be=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=N(),r=Re(),i=ze();function composeScalar(e,a,o,s){let{value:c,type:l,comment:u,range:d}=a.type===`block-scalar`?r.resolveBlockScalar(e,a,s):i.resolveFlowScalar(a,e.options.strict,s),f=o?e.directives.tagName(o.source,e=>s(o,`TAG_RESOLVE_FAILED`,e)):null,p;p=e.options.stringKeys&&e.atKey?e.schema[t.SCALAR]:f?findScalarTagByName(e.schema,c,f,o,s):a.type===`scalar`?findScalarTagByTest(e,c,a,s):e.schema[t.SCALAR];let m;try{let r=p.resolve(c,e=>s(o??a,`TAG_RESOLVE_FAILED`,e),e.options);m=t.isScalar(r)?r:new n.Scalar(r)}catch(e){let t=e instanceof Error?e.message:String(e);s(o??a,`TAG_RESOLVE_FAILED`,t),m=new n.Scalar(c)}return m.range=d,m.source=c,l&&(m.type=l),f&&(m.tag=f),p.format&&(m.format=p.format),u&&(m.comment=u),m}function findScalarTagByName(e,n,r,i,a){if(r===`!`)return e[t.SCALAR];let o=[];for(let t of e.tags)if(!t.collection&&t.tag===r){if(t.default&&t.test)o.push(t);else return t}for(let e of o)if(e.test?.test(n))return e;let s=e.knownTags[r];return s&&!s.collection?(e.tags.push(Object.assign({},s,{default:!1,test:void 0})),s):(a(i,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${r}`,r!==`tag:yaml.org,2002:str`),e[t.SCALAR])}function findScalarTagByTest({atKey:e,directives:n,schema:r},i,a,o){let s=r.tags.find(t=>(t.default===!0||e&&t.default===`key`)&&t.test?.test(i))||r[t.SCALAR];if(r.compat){let e=r.compat.find(e=>e.default&&e.test?.test(i))??r[t.SCALAR];s.tag!==e.tag&&o(a,`TAG_RESOLVE_FAILED`,`Value may be parsed as either ${n.tagString(s.tag)} or ${n.tagString(e.tag)}`,!0)}return s}e.composeScalar=composeScalar})),Ve=/* @__PURE__ */ __commonJSMin((e=>{function emptyScalarPosition(e,t,n){if(t){n??=t.length;for(let r=n-1;r>=0;--r){let n=t[r];switch(n.type){case`space`:case`comment`:case`newline`:e-=n.source.length;continue}for(n=t[++r];n?.type===`space`;)e+=n.source.length,n=t[++r];break}}return e}e.emptyScalarPosition=emptyScalarPosition})),He=/* @__PURE__ */ __commonJSMin((e=>{var t=M(),n=O(),r=Le(),i=Be(),a=J(),o=Ve();let s={composeNode,composeEmptyNode};function composeNode(e,t,a,o){let c=e.atKey,{spaceBefore:l,comment:u,anchor:d,tag:f}=a,p,m=!0;switch(t.type){case`alias`:p=composeAlias(e,t,o),(d||f)&&o(t,`ALIAS_PROPS`,`An alias node must not specify any properties`);break;case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:case`block-scalar`:p=i.composeScalar(e,t,f,o),d&&(p.anchor=d.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:try{p=r.composeCollection(s,e,t,a,o),d&&(p.anchor=d.source.substring(1))}catch(e){o(t,`RESOURCE_EXHAUSTION`,e instanceof Error?e.message:String(e))}break;default:o(t,`UNEXPECTED_TOKEN`,t.type===`error`?t.message:`Unsupported token (type: ${t.type})`),m=!1}return p??=composeEmptyNode(e,t.offset,void 0,null,a,o),d&&p.anchor===``&&o(d,`BAD_ALIAS`,`Anchor cannot be an empty string`),c&&e.options.stringKeys&&(!n.isScalar(p)||typeof p.value!=`string`||p.tag&&p.tag!==`tag:yaml.org,2002:str`)&&o(f??t,`NON_STRING_KEY`,`With stringKeys, all keys must be strings`),l&&(p.spaceBefore=!0),u&&(t.type===`scalar`&&t.source===``?p.comment=u:p.commentBefore=u),e.options.keepSourceTokens&&m&&(p.srcToken=t),p}function composeEmptyNode(e,t,n,r,{spaceBefore:a,comment:s,anchor:c,tag:l,end:u},d){let f={type:`scalar`,offset:o.emptyScalarPosition(t,n,r),indent:-1,source:``},p=i.composeScalar(e,f,l,d);return c&&(p.anchor=c.source.substring(1),p.anchor===``&&d(c,`BAD_ALIAS`,`Anchor cannot be an empty string`)),a&&(p.spaceBefore=!0),s&&(p.comment=s,p.range[2]=u),p}function composeAlias({options:e},{offset:n,source:r,end:i},o){let s=new t.Alias(r.substring(1));s.source===``&&o(n,`BAD_ALIAS`,`Alias cannot be an empty string`),s.source.endsWith(`:`)&&o(n+r.length-1,`BAD_ALIAS`,`Alias ending in : is ambiguous`,!0);let c=n+r.length,l=a.resolveEnd(i,c,e.strict,o);return s.range=[n,c,l.offset],l.comment&&(s.comment=l.comment),s}e.composeEmptyNode=composeEmptyNode,e.composeNode=composeNode})),Ue=/* @__PURE__ */ __commonJSMin((e=>{var t=G(),n=He(),r=J(),i=q();function composeDoc(e,a,{offset:o,start:s,value:c,end:l},u){let d=Object.assign({_directives:a},e),f=new t.Document(void 0,d),p={atKey:!1,atRoot:!0,directives:f.directives,options:f.options,schema:f.schema},m=i.resolveProps(s,{indicator:`doc-start`,next:c??l?.[0],offset:o,onError:u,parentIndent:0,startOnNewline:!0});m.found&&(f.directives.docStart=!0,c&&(c.type===`block-map`||c.type===`block-seq`)&&!m.hasNewline&&u(m.end,`MISSING_CHAR`,`Block collection cannot start on same line with directives-end marker`)),f.contents=c?n.composeNode(p,c,m,u):n.composeEmptyNode(p,m.end,s,null,m,u);let h=f.contents.range[2],g=r.resolveEnd(l,h,!1,u);return g.comment&&(f.comment=g.comment),f.range=[o,h,g.offset],f}e.composeDoc=composeDoc})),We=/* @__PURE__ */ __commonJSMin((e=>{var t=D(`process`),n=re(),r=G(),i=K(),a=O(),o=Ue(),s=J();function getErrorPos(e){if(typeof e==`number`)return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:n}=e;return[t,t+(typeof n==`string`?n.length:1)]}function parsePrelude(e){let t=``,n=!1,r=!1;for(let i=0;i{var t=O(),n=M(),r=Ve(),i=He();function composeScalar(e,a,o,s){let{value:c,type:l,comment:u,range:d}=a.type===`block-scalar`?r.resolveBlockScalar(e,a,s):i.resolveFlowScalar(a,e.options.strict,s),f=o?e.directives.tagName(o.source,e=>s(o,`TAG_RESOLVE_FAILED`,e)):null,p;p=e.options.stringKeys&&e.atKey?e.schema[t.SCALAR]:f?findScalarTagByName(e.schema,c,f,o,s):a.type===`scalar`?findScalarTagByTest(e,c,a,s):e.schema[t.SCALAR];let m;try{let r=p.resolve(c,e=>s(o??a,`TAG_RESOLVE_FAILED`,e),e.options);m=t.isScalar(r)?r:new n.Scalar(r)}catch(e){let t=e instanceof Error?e.message:String(e);s(o??a,`TAG_RESOLVE_FAILED`,t),m=new n.Scalar(c)}return m.range=d,m.source=c,l&&(m.type=l),f&&(m.tag=f),p.format&&(m.format=p.format),u&&(m.comment=u),m}function findScalarTagByName(e,n,r,i,a){if(r===`!`)return e[t.SCALAR];let o=[];for(let t of e.tags)if(!t.collection&&t.tag===r){if(t.default&&t.test)o.push(t);else return t}for(let e of o)if(e.test?.test(n))return e;let s=e.knownTags[r];return s&&!s.collection?(e.tags.push(Object.assign({},s,{default:!1,test:void 0})),s):(a(i,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${r}`,r!==`tag:yaml.org,2002:str`),e[t.SCALAR])}function findScalarTagByTest({atKey:e,directives:n,schema:r},i,a,o){let s=r.tags.find(t=>(t.default===!0||e&&t.default===`key`)&&t.test?.test(i))||r[t.SCALAR];if(r.compat){let e=r.compat.find(e=>e.default&&e.test?.test(i))??r[t.SCALAR];s.tag!==e.tag&&o(a,`TAG_RESOLVE_FAILED`,`Value may be parsed as either ${n.tagString(s.tag)} or ${n.tagString(e.tag)}`,!0)}return s}e.composeScalar=composeScalar})),We=/* @__PURE__ */ __commonJSMin((e=>{function emptyScalarPosition(e,t,n){if(t){n??=t.length;for(let r=n-1;r>=0;--r){let n=t[r];switch(n.type){case`space`:case`comment`:case`newline`:e-=n.source.length;continue}for(n=t[++r];n?.type===`space`;)e+=n.source.length,n=t[++r];break}}return e}e.emptyScalarPosition=emptyScalarPosition})),Ge=/* @__PURE__ */ __commonJSMin((e=>{var t=j(),n=O(),r=Be(),i=Ue(),a=J(),o=We();let s={composeNode,composeEmptyNode};function composeNode(e,t,a,o){let c=e.atKey,{spaceBefore:l,comment:u,anchor:d,tag:f}=a,p,m=!0;switch(t.type){case`alias`:p=composeAlias(e,t,o),(d||f)&&o(t,`ALIAS_PROPS`,`An alias node must not specify any properties`);break;case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:case`block-scalar`:p=i.composeScalar(e,t,f,o),d&&(p.anchor=d.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:try{p=r.composeCollection(s,e,t,a,o),d&&(p.anchor=d.source.substring(1))}catch(e){o(t,`RESOURCE_EXHAUSTION`,e instanceof Error?e.message:String(e))}break;default:o(t,`UNEXPECTED_TOKEN`,t.type===`error`?t.message:`Unsupported token (type: ${t.type})`),m=!1}return p??=composeEmptyNode(e,t.offset,void 0,null,a,o),d&&p.anchor===``&&o(d,`BAD_ALIAS`,`Anchor cannot be an empty string`),c&&e.options.stringKeys&&(!n.isScalar(p)||typeof p.value!=`string`||p.tag&&p.tag!==`tag:yaml.org,2002:str`)&&o(f??t,`NON_STRING_KEY`,`With stringKeys, all keys must be strings`),l&&(p.spaceBefore=!0),u&&(t.type===`scalar`&&t.source===``?p.comment=u:p.commentBefore=u),e.options.keepSourceTokens&&m&&(p.srcToken=t),p}function composeEmptyNode(e,t,n,r,{spaceBefore:a,comment:s,anchor:c,tag:l,end:u},d){let f={type:`scalar`,offset:o.emptyScalarPosition(t,n,r),indent:-1,source:``},p=i.composeScalar(e,f,l,d);return c&&(p.anchor=c.source.substring(1),p.anchor===``&&d(c,`BAD_ALIAS`,`Anchor cannot be an empty string`)),a&&(p.spaceBefore=!0),s&&(p.comment=s,p.range[2]=u),p}function composeAlias({options:e},{offset:n,source:r,end:i},o){let s=new t.Alias(r.substring(1));s.source===``&&o(n,`BAD_ALIAS`,`Alias cannot be an empty string`),s.source.endsWith(`:`)&&o(n+r.length-1,`BAD_ALIAS`,`Alias ending in : is ambiguous`,!0);let c=n+r.length,l=a.resolveEnd(i,c,e.strict,o);return s.range=[n,c,l.offset],l.comment&&(s.comment=l.comment),s}e.composeEmptyNode=composeEmptyNode,e.composeNode=composeNode})),Ke=/* @__PURE__ */ __commonJSMin((e=>{var t=G(),n=Ge(),r=J(),i=q();function composeDoc(e,a,{offset:o,start:s,value:c,end:l},u){let d=Object.assign({_directives:a},e),f=new t.Document(void 0,d),p={atKey:!1,atRoot:!0,directives:f.directives,options:f.options,schema:f.schema},m=i.resolveProps(s,{indicator:`doc-start`,next:c??l?.[0],offset:o,onError:u,parentIndent:0,startOnNewline:!0});m.found&&(f.directives.docStart=!0,c&&(c.type===`block-map`||c.type===`block-seq`)&&!m.hasNewline&&u(m.end,`MISSING_CHAR`,`Block collection cannot start on same line with directives-end marker`)),f.contents=c?n.composeNode(p,c,m,u):n.composeEmptyNode(p,m.end,s,null,m,u);let h=f.contents.range[2],g=r.resolveEnd(l,h,!1,u);return g.comment&&(f.comment=g.comment),f.range=[o,h,g.offset],f}e.composeDoc=composeDoc})),qe=/* @__PURE__ */ __commonJSMin((e=>{var t=D(`process`),n=oe(),r=G(),i=K(),a=O(),o=Ke(),s=J();function getErrorPos(e){if(typeof e==`number`)return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:n}=e;return[t,t+(typeof n==`string`?n.length:1)]}function parsePrelude(e){let t=``,n=!1,r=!1;for(let i=0;i{let a=getErrorPos(e);r?this.warnings.push(new i.YAMLWarning(a,t,n)):this.errors.push(new i.YAMLParseError(a,t,n))},this.directives=new n.Directives({version:e.version||`1.2`}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=parsePrelude(this.prelude);if(n){let i=e.contents;if(t)e.comment=e.comment?`${e.comment}\n${n}`:n;else if(r||e.directives.docStart||!i)e.commentBefore=n;else if(a.isCollection(i)&&!i.flow&&i.items.length>0){let e=i.items[0];a.isPair(e)&&(e=e.key);let t=e.commentBefore;e.commentBefore=t?`${n}\n${t}`:n}else{let e=i.commentBefore;i.commentBefore=e?`${n}\n${e}`:n}}if(t){for(let t=0;t{let i=getErrorPos(e);i[0]+=t,this.onError(i,`BAD_DIRECTIVE`,n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case`document`:{let t=o.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,`MISSING_CHAR`,`Missing directives-end/doc-start indicator line`),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case`byte-order-mark`:case`space`:break;case`comment`:case`newline`:this.prelude.push(e.source);break;case`error`:{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new i.YAMLParseError(getErrorPos(e),`UNEXPECTED_TOKEN`,t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case`doc-end`:{if(!this.doc){this.errors.push(new i.YAMLParseError(getErrorPos(e),`UNEXPECTED_TOKEN`,`Unexpected doc-end without preceding document`));break}this.doc.directives.docEnd=!0;let t=s.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let e=this.doc.comment;this.doc.comment=e?`${e}\n${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new i.YAMLParseError(getErrorPos(e),`UNEXPECTED_TOKEN`,`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let e=Object.assign({_directives:this.directives},this.options),n=new r.Document(void 0,e);this.atDirectives&&this.onError(t,`MISSING_CHAR`,`Missing directives-end indicator line`),n.range=[0,t,t],this.decorate(n,!1),yield n}}}})),Ge=/* @__PURE__ */ __commonJSMin((e=>{var t=Re(),n=ze(),r=K(),i=I();function resolveAsScalar(e,i=!0,a){if(e){let _onError=(e,t,n)=>{let i=typeof e==`number`?e:Array.isArray(e)?e[0]:e.offset;if(a)a(i,t,n);else throw new r.YAMLParseError([i,i+1],t,n)};switch(e.type){case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return n.resolveFlowScalar(e,i,_onError);case`block-scalar`:return t.resolveBlockScalar({options:{strict:i}},e,_onError)}}return null}function createScalarToken(e,t){let{implicitKey:n=!1,indent:r,inFlow:a=!1,offset:o=-1,type:s=`PLAIN`}=t,c=i.stringifyString({type:s,value:e},{implicitKey:n,indent:r>0?` `.repeat(r):``,inFlow:a,options:{blockQuote:!0,lineWidth:-1}}),l=t.end??[{type:`newline`,offset:-1,indent:r,source:` +`)+(a.substring(1)||` `),n=!0,r=!1;break;case`%`:e[i+1]?.[0]!==`#`&&(i+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:t,afterEmptyLine:r}}e.Composer=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,n,r)=>{let a=getErrorPos(e);r?this.warnings.push(new i.YAMLWarning(a,t,n)):this.errors.push(new i.YAMLParseError(a,t,n))},this.directives=new n.Directives({version:e.version||`1.2`}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=parsePrelude(this.prelude);if(n){let i=e.contents;if(t)e.comment=e.comment?`${e.comment}\n${n}`:n;else if(r||e.directives.docStart||!i)e.commentBefore=n;else if(a.isCollection(i)&&!i.flow&&i.items.length>0){let e=i.items[0];a.isPair(e)&&(e=e.key);let t=e.commentBefore;e.commentBefore=t?`${n}\n${t}`:n}else{let e=i.commentBefore;i.commentBefore=e?`${n}\n${e}`:n}}if(t){for(let t=0;t{let i=getErrorPos(e);i[0]+=t,this.onError(i,`BAD_DIRECTIVE`,n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case`document`:{let t=o.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,`MISSING_CHAR`,`Missing directives-end/doc-start indicator line`),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case`byte-order-mark`:case`space`:break;case`comment`:case`newline`:this.prelude.push(e.source);break;case`error`:{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new i.YAMLParseError(getErrorPos(e),`UNEXPECTED_TOKEN`,t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case`doc-end`:{if(!this.doc){this.errors.push(new i.YAMLParseError(getErrorPos(e),`UNEXPECTED_TOKEN`,`Unexpected doc-end without preceding document`));break}this.doc.directives.docEnd=!0;let t=s.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let e=this.doc.comment;this.doc.comment=e?`${e}\n${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new i.YAMLParseError(getErrorPos(e),`UNEXPECTED_TOKEN`,`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let e=Object.assign({_directives:this.directives},this.options),n=new r.Document(void 0,e);this.atDirectives&&this.onError(t,`MISSING_CHAR`,`Missing directives-end indicator line`),n.range=[0,t,t],this.decorate(n,!1),yield n}}}})),Je=/* @__PURE__ */ __commonJSMin((e=>{var t=Ve(),n=He(),r=K(),i=I();function resolveAsScalar(e,i=!0,a){if(e){let _onError=(e,t,n)=>{let i=typeof e==`number`?e:Array.isArray(e)?e[0]:e.offset;if(a)a(i,t,n);else throw new r.YAMLParseError([i,i+1],t,n)};switch(e.type){case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return n.resolveFlowScalar(e,i,_onError);case`block-scalar`:return t.resolveBlockScalar({options:{strict:i}},e,_onError)}}return null}function createScalarToken(e,t){let{implicitKey:n=!1,indent:r,inFlow:a=!1,offset:o=-1,type:s=`PLAIN`}=t,c=i.stringifyString({type:s,value:e},{implicitKey:n,indent:r>0?` `.repeat(r):``,inFlow:a,options:{blockQuote:!0,lineWidth:-1}}),l=t.end??[{type:`newline`,offset:-1,indent:r,source:` `}];switch(c[0]){case`|`:case`>`:{let e=c.indexOf(` `),t=c.substring(0,e),n=c.substring(e+1)+` `,i=[{type:`block-scalar-header`,offset:o,indent:r,source:t}];return addEndtoBlockProps(i,l)||i.push({type:`newline`,offset:-1,indent:r,source:` @@ -97,11 +97,11 @@ case` `:n=`a tab character`;break;case`,`:n=`flow indicator character ,`;break;c `),r=t.substring(0,n),i=t.substring(n+1)+` `;if(e.type===`block-scalar`){let t=e.props[0];if(t.type!==`block-scalar-header`)throw Error(`Invalid block scalar header`);t.source=r,e.source=i}else{let{offset:t}=e,n=`indent`in e?e.indent:-1,a=[{type:`block-scalar-header`,offset:t,indent:n,source:r}];addEndtoBlockProps(a,`end`in e?e.end:void 0)||a.push({type:`newline`,offset:-1,indent:n,source:` `});for(let t of Object.keys(e))t!==`type`&&t!==`offset`&&delete e[t];Object.assign(e,{type:`block-scalar`,indent:n,props:a,source:i})}}function addEndtoBlockProps(e,t){if(t)for(let n of t)switch(n.type){case`space`:case`comment`:e.push(n);break;case`newline`:return e.push(n),!0}return!1}function setFlowScalarValue(e,t,n){switch(e.type){case`scalar`:case`double-quoted-scalar`:case`single-quoted-scalar`:e.type=n,e.source=t;break;case`block-scalar`:{let r=e.props.slice(1),i=t.length;e.props[0].type===`block-scalar-header`&&(i-=e.props[0].source.length);for(let e of r)e.offset+=i;delete e.props,Object.assign(e,{type:n,source:t,end:r});break}case`block-map`:case`block-seq`:{let r={type:`newline`,offset:e.offset+t.length,indent:e.indent,source:` -`};delete e.items,Object.assign(e,{type:n,source:t,end:[r]});break}default:{let r=`indent`in e?e.indent:-1,i=`end`in e&&Array.isArray(e.end)?e.end.filter(e=>e.type===`space`||e.type===`comment`||e.type===`newline`):[];for(let t of Object.keys(e))t!==`type`&&t!==`offset`&&delete e[t];Object.assign(e,{type:n,indent:r,source:t,end:i})}}}e.createScalarToken=createScalarToken,e.resolveAsScalar=resolveAsScalar,e.setScalarValue=setScalarValue})),Ke=/* @__PURE__ */ __commonJSMin((e=>{let stringify=e=>`type`in e?stringifyToken(e):stringifyItem(e);function stringifyToken(e){switch(e.type){case`block-scalar`:{let t=``;for(let n of e.props)t+=stringifyToken(n);return t+e.source}case`block-map`:case`block-seq`:{let t=``;for(let n of e.items)t+=stringifyItem(n);return t}case`flow-collection`:{let t=e.start.source;for(let n of e.items)t+=stringifyItem(n);for(let n of e.end)t+=n.source;return t}case`document`:{let t=stringifyItem(e);if(e.end)for(let n of e.end)t+=n.source;return t}default:{let t=e.source;if(`end`in e&&e.end)for(let n of e.end)t+=n.source;return t}}}function stringifyItem({start:e,key:t,sep:n,value:r}){let i=``;for(let t of e)i+=t.source;if(t&&(i+=stringifyToken(t)),n)for(let e of n)i+=e.source;return r&&(i+=stringifyToken(r)),i}e.stringify=stringify})),qe=/* @__PURE__ */ __commonJSMin((e=>{let t=Symbol(`break visit`),n=Symbol(`skip children`),r=Symbol(`remove item`);function visit(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),_visit(Object.freeze([]),e,t)}visit.BREAK=t,visit.SKIP=n,visit.REMOVE=r,visit.itemAtPath=(e,t)=>{let n=e;for(let[e,r]of t){let t=n?.[e];if(t&&`items`in t)n=t.items[r];else return}return n},visit.parentCollection=(e,t)=>{let n=visit.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n?.[r];if(i&&`items`in i)return i;throw Error(`Parent collection not found`)};function _visit(e,n,i){let a=i(n,e);if(typeof a==`symbol`)return a;for(let o of[`key`,`value`]){let s=n[o];if(s&&`items`in s){for(let n=0;n{var t=Ge(),n=Ke(),r=qe();let isCollection=e=>!!e&&`items`in e,isScalar=e=>!!e&&(e.type===`scalar`||e.type===`single-quoted-scalar`||e.type===`double-quoted-scalar`||e.type===`block-scalar`); +`};delete e.items,Object.assign(e,{type:n,source:t,end:[r]});break}default:{let r=`indent`in e?e.indent:-1,i=`end`in e&&Array.isArray(e.end)?e.end.filter(e=>e.type===`space`||e.type===`comment`||e.type===`newline`):[];for(let t of Object.keys(e))t!==`type`&&t!==`offset`&&delete e[t];Object.assign(e,{type:n,indent:r,source:t,end:i})}}}e.createScalarToken=createScalarToken,e.resolveAsScalar=resolveAsScalar,e.setScalarValue=setScalarValue})),Ye=/* @__PURE__ */ __commonJSMin((e=>{let stringify=e=>`type`in e?stringifyToken(e):stringifyItem(e);function stringifyToken(e){switch(e.type){case`block-scalar`:{let t=``;for(let n of e.props)t+=stringifyToken(n);return t+e.source}case`block-map`:case`block-seq`:{let t=``;for(let n of e.items)t+=stringifyItem(n);return t}case`flow-collection`:{let t=e.start.source;for(let n of e.items)t+=stringifyItem(n);for(let n of e.end)t+=n.source;return t}case`document`:{let t=stringifyItem(e);if(e.end)for(let n of e.end)t+=n.source;return t}default:{let t=e.source;if(`end`in e&&e.end)for(let n of e.end)t+=n.source;return t}}}function stringifyItem({start:e,key:t,sep:n,value:r}){let i=``;for(let t of e)i+=t.source;if(t&&(i+=stringifyToken(t)),n)for(let e of n)i+=e.source;return r&&(i+=stringifyToken(r)),i}e.stringify=stringify})),Xe=/* @__PURE__ */ __commonJSMin((e=>{let t=Symbol(`break visit`),n=Symbol(`skip children`),r=Symbol(`remove item`);function visit(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),_visit(Object.freeze([]),e,t)}visit.BREAK=t,visit.SKIP=n,visit.REMOVE=r,visit.itemAtPath=(e,t)=>{let n=e;for(let[e,r]of t){let t=n?.[e];if(t&&`items`in t)n=t.items[r];else return}return n},visit.parentCollection=(e,t)=>{let n=visit.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n?.[r];if(i&&`items`in i)return i;throw Error(`Parent collection not found`)};function _visit(e,n,i){let a=i(n,e);if(typeof a==`symbol`)return a;for(let o of[`key`,`value`]){let s=n[o];if(s&&`items`in s){for(let n=0;n{var t=Je(),n=Ye(),r=Xe();let isCollection=e=>!!e&&`items`in e,isScalar=e=>!!e&&(e.type===`scalar`||e.type===`single-quoted-scalar`||e.type===`double-quoted-scalar`||e.type===`block-scalar`); /* istanbul ignore next */ function prettyToken(e){switch(e){case``:return``;case``:return``;case``:return``;case``:return``;default:return JSON.stringify(e)}}function tokenType(e){switch(e){case``:return`byte-order-mark`;case``:return`doc-mode`;case``:return`flow-error-end`;case``:return`scalar`;case`---`:return`doc-start`;case`...`:return`doc-end`;case``:case` `:case`\r -`:return`newline`;case`-`:return`seq-item-ind`;case`?`:return`explicit-key-ind`;case`:`:return`map-value-ind`;case`{`:return`flow-map-start`;case`}`:return`flow-map-end`;case`[`:return`flow-seq-start`;case`]`:return`flow-seq-end`;case`,`:return`comma`}switch(e[0]){case` `:case` `:return`space`;case`#`:return`comment`;case`%`:return`directive-line`;case`*`:return`alias`;case`&`:return`anchor`;case`!`:return`tag`;case`'`:return`single-quoted-scalar`;case`"`:return`double-quoted-scalar`;case`|`:case`>`:return`block-scalar-header`}return null}e.createScalarToken=t.createScalarToken,e.resolveAsScalar=t.resolveAsScalar,e.setScalarValue=t.setScalarValue,e.stringify=n.stringify,e.visit=r.visit,e.BOM=``,e.DOCUMENT=``,e.FLOW_END=``,e.SCALAR=``,e.isCollection=isCollection,e.isScalar=isScalar,e.prettyToken=prettyToken,e.tokenType=tokenType})),Ye=/* @__PURE__ */ __commonJSMin((e=>{var t=Je();function isEmpty(e){switch(e){case void 0:case` `:case` +`:return`newline`;case`-`:return`seq-item-ind`;case`?`:return`explicit-key-ind`;case`:`:return`map-value-ind`;case`{`:return`flow-map-start`;case`}`:return`flow-map-end`;case`[`:return`flow-seq-start`;case`]`:return`flow-seq-end`;case`,`:return`comma`}switch(e[0]){case` `:case` `:return`space`;case`#`:return`comment`;case`%`:return`directive-line`;case`*`:return`alias`;case`&`:return`anchor`;case`!`:return`tag`;case`'`:return`single-quoted-scalar`;case`"`:return`double-quoted-scalar`;case`|`:case`>`:return`block-scalar-header`}return null}e.createScalarToken=t.createScalarToken,e.resolveAsScalar=t.resolveAsScalar,e.setScalarValue=t.setScalarValue,e.stringify=n.stringify,e.visit=r.visit,e.BOM=``,e.DOCUMENT=``,e.FLOW_END=``,e.SCALAR=``,e.isCollection=isCollection,e.isScalar=isScalar,e.prettyToken=prettyToken,e.tokenType=tokenType})),Qe=/* @__PURE__ */ __commonJSMin((e=>{var t=Ze();function isEmpty(e){switch(e){case void 0:case` `:case` `:case`\r`:case` `:return!0;default:return!1}}let n=/* @__PURE__ */ new Set(`0123456789ABCDEFabcdef`),r=/* @__PURE__ */ new Set(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()`),i=/* @__PURE__ */ new Set(`,[]{}`),a=/* @__PURE__ */ new Set(` ,[]{} \r `),isNotAnchorChar=e=>!e||a.has(e);e.Lexer=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer=``,this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){if(e){if(typeof e!=`string`)throw TypeError(`source is not a string`);this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let n=this.next??`stream`;for(;n&&(t||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===` `||t===` `;)t=this.buffer[++e];return!t||t===`#`||t===` `||t===`\r`&&this.buffer[e+1]===` @@ -120,7 +120,7 @@ function prettyToken(e){switch(e){case``:return``;case``:return``; `,t=this.buffer[r+1]):n=r),t===`#`||e&&i.has(t))break;if(a===` `){let e=this.continueScalar(r+1);if(e===-1)break;r=Math.max(r,e-2)}}else{if(e&&i.has(a))break;n=r}return!a&&!this.atEnd?this.setNext(`plain-scalar`):(yield t.SCALAR,yield*this.pushToIndex(n+1,!0),e?`flow`:`doc`)}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(t&&(yield``),0)}*pushIndicators(){let e=0;loop:for(;;){switch(this.charAt(0)){case`!`:e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue loop;case`&`:e+=yield*this.pushUntil(isNotAnchorChar),e+=yield*this.pushSpaces(!0);continue loop;case`-`:case`?`:case`:`:{let t=this.flowLevel>0,n=this.charAt(1);if(isEmpty(n)||t&&i.has(n)){t?this.flowKey&&=!1:this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue loop}}}break loop}return e}*pushTag(){if(this.charAt(1)===`<`){let e=this.pos+2,t=this.buffer[e];for(;!isEmpty(t)&&t!==`>`;)t=this.buffer[++e];return yield*this.pushToIndex(t===`>`?e+1:e,!1)}{let e=this.pos+1,t=this.buffer[e];for(;t;)if(r.has(t))t=this.buffer[++e];else if(t===`%`&&n.has(this.buffer[e+1])&&n.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===` `?yield*this.pushCount(1):e===`\r`&&this.charAt(1)===` -`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,n;do n=this.buffer[++t];while(n===` `||e&&n===` `);let r=t-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=t),r}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}}})),Xe=/* @__PURE__ */ __commonJSMin((e=>{e.LineCounter=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t>1;this.lineStarts[r]{var t=D(`process`),n=Je(),r=Ye();function includesToken(e,t){for(let n=0;n0&&(yield this.buffer.substr(this.pos,r),this.pos=t),r}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}}})),$e=/* @__PURE__ */ __commonJSMin((e=>{e.LineCounter=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t>1;this.lineStarts[r]{var t=D(`process`),n=Ze(),r=Qe();function includesToken(e,t){for(let n=0;n=0;)switch(e[t].type){case`doc-start`:case`explicit-key-ind`:case`map-value-ind`:case`seq-item-ind`:case`newline`:break loop}for(;e[++t]?.type===`space`;);return e.splice(t,e.length)}function arrayPushArray(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let n=0;n0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type===`doc-end`&&e?.type!==`doc-end`){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:`doc-end`,offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case`document`:return yield*this.document(e);case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return yield*this.scalar(e);case`block-scalar`:return yield*this.blockScalar(e);case`block-map`:return yield*this.blockMap(e);case`block-seq`:return yield*this.blockSequence(e);case`flow-collection`:return yield*this.flowCollection(e);case`doc-end`:return yield*this.documentEnd(e)} /* istanbul ignore next should not happen */ @@ -136,14 +136,14 @@ default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.l /* istanbul ignore else should not happen */ n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let t=this.peek(2);if(t.type===`block-map`&&(this.type===`map-value-ind`&&t.indent===e.indent||this.type===`newline`&&!t.items[t.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type===`map-value-ind`&&t.type!==`flow-collection`){let n=getFirstKeyStartProps(getPrevProps(t));fixFlowSeqItems(e);let r=e.end.splice(1,e.end.length);r.push(this.sourceToken);let i={type:`block-map`,offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let e=this.source.indexOf(` `)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(` -`,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=getFirstKeyStartProps(getPrevProps(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=getFirstKeyStartProps(getPrevProps(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}}})),Qe=/* @__PURE__ */ __commonJSMin((e=>{var t=We(),n=G(),r=K(),i=le(),a=O(),o=Xe(),s=Ze();function parseOptions(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new o.LineCounter||null,prettyErrors:t}}function parseAllDocuments(e,n={}){let{lineCounter:i,prettyErrors:a}=parseOptions(n),o=new s.Parser(i?.addNewLine),c=new t.Composer(n),l=Array.from(c.compose(o.parse(e)));if(a&&i)for(let t of l)t.errors.forEach(r.prettifyError(e,i)),t.warnings.forEach(r.prettifyError(e,i));return l.length>0?l:Object.assign([],{empty:!0},c.streamInfo())}function parseDocument(e,n={}){let{lineCounter:i,prettyErrors:a}=parseOptions(n),o=new s.Parser(i?.addNewLine),c=new t.Composer(n),l=null;for(let t of c.compose(o.parse(e),!0,e.length))if(!l)l=t;else if(l.options.logLevel!==`silent`){l.errors.push(new r.YAMLParseError(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return a&&i&&(l.errors.forEach(r.prettifyError(e,i)),l.warnings.forEach(r.prettifyError(e,i))),l}function parse(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let a=parseDocument(e,n);if(!a)return null;if(a.warnings.forEach(e=>i.warn(a.options.logLevel,e)),a.errors.length>0){if(a.options.logLevel!==`silent`)throw a.errors[0];a.errors=[]}return a.toJS(Object.assign({reviver:r},n))}function stringify(e,t,r){let i=null;if(typeof t==`function`||Array.isArray(t)?i=t:r===void 0&&t&&(r=t),typeof r==`string`&&(r=r.length),typeof r==`number`){let e=Math.round(r);r=e<1?void 0:e>8?{indent:8}:{indent:e}}if(e===void 0){let{keepUndefined:e}=r??t??{};if(!e)return}return a.isDocument(e)&&!i?e.toString(r):new n.Document(e,i,r).toString(r)}e.parse=parse,e.parseAllDocuments=parseAllDocuments,e.parseDocument=parseDocument,e.stringify=stringify})),Y=(/* @__PURE__ */ __commonJSMin((e=>{var t=We(),n=G(),r=ke(),i=K(),a=M(),o=O(),s=R(),c=N(),l=z(),u=V();Je();var d=Ye(),f=Xe(),p=Ze(),m=Qe(),h=k();e.Composer=t.Composer,e.Document=n.Document,e.Schema=r.Schema,e.YAMLError=i.YAMLError,e.YAMLParseError=i.YAMLParseError,e.YAMLWarning=i.YAMLWarning,e.Alias=a.Alias,e.isAlias=o.isAlias,e.isCollection=o.isCollection,e.isDocument=o.isDocument,e.isMap=o.isMap,e.isNode=o.isNode,e.isPair=o.isPair,e.isScalar=o.isScalar,e.isSeq=o.isSeq,e.Pair=s.Pair,e.Scalar=c.Scalar,e.YAMLMap=l.YAMLMap,e.YAMLSeq=u.YAMLSeq,e.Lexer=d.Lexer,e.LineCounter=f.LineCounter,e.Parser=p.Parser,e.parse=m.parse,e.parseAllDocuments=m.parseAllDocuments,e.parseDocument=m.parseDocument,e.stringify=m.stringify,e.visit=h.visit,e.visitAsync=h.visitAsync})))();function parseInstalledVpVersion(e){return(e.match(/^\s*vp\s+v?(\d[^\s]*)/im)??e.match(/Global:\s*v?(\d[^\s]*)/i))?.[1]??`unknown`}const $e=/* @__PURE__ */ new Set([`true`,`True`,`TRUE`]),et=/* @__PURE__ */ new Set([`false`,`False`,`FALSE`]);function parseNodeManager(e){if(e){if($e.has(e))return!0;if(et.has(e))return!1;throw Error(`Invalid node-manager input: "${e}". Expected "true", "false", or unset.`)}}function supportsScopedEnv(e){let t=parseInstalledVpVersion(e);if(t.startsWith(`0.0.0-commit.`))return!0;let n=t.match(/^(\d+)\.(\d+)\.(\d+)/);if(!n)throw Error(`Could not determine the installed Vite+ version for env configuration.`);let[,r,i,a]=n.map(Number);return r>0||i>3||i===3&&a>=1}function nodeManagerOffArgs(e){return parseInstalledVpVersion(e).startsWith(`0.0.0-commit.`)&&console.info("setup-vp: node-manager: false requires a preview build that supports `vp env off node`. If this command is unsupported, use a newer preview or a stable release. setup-vp will not fall back to disabling package-manager management."),supportsScopedEnv(e)?[`env`,`off`,`node`]:[`env`,`off`]}const tt=[`npm`,`pnpm`,`yarn`,`bun`];function parsePackageManager(e){if(!e?.trim())return;let t;try{t=(0,Y.parse)(e)}catch(e){throw Error(`Invalid package-manager input: ${String(e)}`)}if(t!==``){if(typeof t==`boolean`)return t;if(t&&typeof t==`object`&&!Array.isArray(t)){for(let[e,n]of Object.entries(t))if(!tt.includes(e)||typeof n!=`boolean`)throw Error(`Invalid package-manager input: ${e} must be npm, pnpm, yarn, or bun with a boolean value.`);return t}throw Error(`Invalid package-manager input: expected a boolean or a mapping of npm, pnpm, yarn, and bun to booleans.`)}}function packageManagerArgs(e,t){if(e===void 0)return[];if(!supportsScopedEnv(t))throw Error(`package-manager configuration requires Vite+ 0.3.1 or newer.`);return typeof e==`boolean`?e?[]:[[`env`,`off`,`pm`]]:tt.filter(t=>e[t]===!1).map(e=>[`env`,`off`,e])}const X=`Vite+`,Z=`vite-plus`;function resolvePath$1(e,t){return u.isAbsolute(e)?e:u.join(t,e)}function isWithin(e,t){let n=u.relative(t,e);return!u.isAbsolute(n)&&n!==`..`&&!n.startsWith(`..${u.sep}`)}function resolveProjectDirectory(e){let{workingDirectory:t,workspaceRoot:n}=e,r=u.isAbsolute(t)?t:u.join(n,t);try{if(!c(r).isDirectory())throw Error(`working-directory is not a directory: ${t} (resolved to ${r})`)}catch(e){throw e instanceof Error&&`code`in e&&e.code===`ENOENT`?Error(`working-directory not found: ${t} (resolved to ${r})`):e}return r}function isWindows(e=process.platform){return e===`win32`}function run(e,t,n={}){let r=y(e,t,{stdio:`inherit`,...n});if(r.error)throw r.error;if(r.status!==0)throw Error(`${e} ${t.join(` `)} exited with code ${r.status??1}`)}function runWithOutput(e,t,n={}){return new Promise((r,i)=>{let a=v(e,t,{...n,stdio:[`ignore`,`pipe`,`pipe`]}),o=``,s=``;a.stdout.on(`data`,e=>{process.stdout.write(e),o=(o+e.toString()).slice(-4e3)}),a.stderr.on(`data`,e=>{process.stderr.write(e),s=(s+e.toString()).slice(-4e3)}),a.on(`error`,i),a.on(`close`,e=>r({exitCode:e??1,stdout:o,stderr:s}))})}function commandPath(e){if(isWindows()){let t=y(`where`,[e],{encoding:`utf8`});return t.status===0&&t.stdout.trim().split(/\r?\n/)[0]?.trim()||void 0}let t=y(`sh`,[`-c`,`command -v "$1"`,`sh`,e],{encoding:`utf8`});if(t.status===0)return t.stdout.trim()}function getCommandOutput(e,t,n){let r=y(e,t,{cwd:n?.cwd,encoding:`utf8`,stdio:[`ignore`,`pipe`,`pipe`]});if(r.status===0)return r.stdout.trim()}const nt=[{filename:`pnpm-lock.yaml`,type:`pnpm`},{filename:`bun.lockb`,type:`bun`},{filename:`bun.lock`,type:`bun`},{filename:`package-lock.json`,type:`npm`},{filename:`npm-shrinkwrap.json`,type:`npm`},{filename:`yarn.lock`,type:`yarn`}];function resolvePath(e,t){return p(e)?e:m(t,e)}function inferLockFileType(e,t){return t.includes(`pnpm`)?{type:`pnpm`,path:e,filename:t}:t.includes(`yarn`)?{type:`yarn`,path:e,filename:t}:t.startsWith(`bun.`)?{type:`bun`,path:e,filename:t}:{type:`npm`,path:e,filename:t}}function detectLockFile(e,t){if(e){let r=resolvePath(e,t);if(n(r)){let e=d(r),t=nt.find(t=>t.filename===e);return t?{type:t.type,path:r,filename:e}:inferLockFileType(r,e)}return}let r=o(t);for(let e of nt)if(r.includes(e.filename)){let n=m(t,e.filename);return{type:e.type,path:n,filename:e.filename}}}function prepareCacheMetadata(e){let{projectDir:t,cacheDependencyPath:n,logWarning:r}=e,i=detectLockFile(n||void 0,t);if(!i)return r?.(`setup-vp: cache is enabled but no supported lock file was found; skipping cache.`),{ready:!1};let a=getCommandOutput(`vp`,[`pm`,`cache`,`dir`],{cwd:u.dirname(i.path)});return a?{ready:!0,cachePath:a,lockFile:i.path,lockType:i.type}:(r?.(`setup-vp: could not resolve package-manager cache directory for ${i.filename}; skipping cache.`),{ready:!1})}function createLockfileResolver(e){let{getWorkspaceDir:t,info:r,debug:i}=e,o=/^\d+\.\d+\.\d+/;function tryResolveVitePlusVersionFromLockfile(e,t){let n=detectLockfileForProject(e,t);if(!n)return;let a=n.filename.endsWith(`.lockb`)?textBunLockBeside(n):n;if(!a){i(`Cannot read ${n.filename} (binary) to resolve the ${X} version; using "latest". Use the text bun.lock, or set the \`version\` input.`);return}let o=parseVitePlusVersionFromLockfile(a,workspaceSubPath(f(a.path),e));if(o)return r(`Resolved ${X} version '${o}' from ${a.filename}`),o;i(`No ${X} version found in ${a.path}`)}function detectLockfileForProject(e,n){if(n)return detectLockFile(n,e);let r=t(),i=e;for(;;){let e=detectLockFile(void 0,i);if(e)return e;let t=f(i);if(i===r||t===i||!isWithin(t,r))break;i=t}}function textBunLockBeside(e){let t=m(f(e.path),`bun.lock`);return n(t)?{type:`bun`,path:t,filename:`bun.lock`}:void 0}function workspaceSubPath(e,t){if(!isWithin(t,e))return``;let n=h(e,t);return n?n.split(g).join(`/`):``}function parseVitePlusVersionFromLockfile(e,t=``){if(e.filename.endsWith(`.lockb`))return;let n;try{n=a(e.path,`utf-8`)}catch{return}let r;switch(e.type){case`npm`:r=fromNpmLock(n,t);break;case`pnpm`:r=fromPnpmLock(n,t);break;case`yarn`:r=fromYarnLock(n);break;case`bun`:r=fromBunTextLock(n);break;default:return}return r&&o.test(r)?r:void 0}function fromNpmLock(e,t){let n;try{n=JSON.parse(e)}catch{return}let r=n.packages;if(t){let e=r?.[`${t}/node_modules/${Z}`]?.version;if(typeof e==`string`)return e;if(!npmPackageDeclaresVitePlus(r?.[t]))return}let i=r?.[`node_modules/${Z}`]?.version;if(typeof i==`string`)return i;let a=n.dependencies?.[Z]?.version;return typeof a==`string`?a:void 0}function npmPackageDeclaresVitePlus(e){if(!e)return!1;for(let t of[`dependencies`,`devDependencies`]){let n=e[t];if(n&&typeof n==`object`&&`vite-plus`in n)return!0}return!1}function fromPnpmLock(e,t){let n;try{n=(0,Y.parse)(e)}catch{return}if(!n||typeof n!=`object`)return;let r=n,i=r.importers;if(i&&typeof i==`object`){let e=t||`.`;return e in i?pnpmImporterVersion(i[e]):void 0}return pnpmImporterVersion(r)||e.match(/^\s*\/?vite-plus@(\d+\.\d+\.\d+[^\s():'"]*)/m)?.[1]}function pnpmImporterVersion(e){if(!e||typeof e!=`object`)return;let t=e;for(let e of[`dependencies`,`devDependencies`,`optionalDependencies`]){let n=t[e];if(n&&typeof n==`object`){let e=n[Z],t=typeof e==`string`?e:e?.version;if(typeof t==`string`){let e=t.replace(/\(.*$/,``).trim();if(o.test(e))return e}}}}function fromYarnLock(e){let t=/* @__PURE__ */ new Set,n=e.split(/\r?\n/);for(let e=0;ee.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}}})),tt=/* @__PURE__ */ __commonJSMin((e=>{var t=qe(),n=G(),r=K(),i=fe(),a=O(),o=$e(),s=et();function parseOptions(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new o.LineCounter||null,prettyErrors:t}}function parseAllDocuments(e,n={}){let{lineCounter:i,prettyErrors:a}=parseOptions(n),o=new s.Parser(i?.addNewLine),c=new t.Composer(n),l=Array.from(c.compose(o.parse(e)));if(a&&i)for(let t of l)t.errors.forEach(r.prettifyError(e,i)),t.warnings.forEach(r.prettifyError(e,i));return l.length>0?l:Object.assign([],{empty:!0},c.streamInfo())}function parseDocument(e,n={}){let{lineCounter:i,prettyErrors:a}=parseOptions(n),o=new s.Parser(i?.addNewLine),c=new t.Composer(n),l=null;for(let t of c.compose(o.parse(e),!0,e.length))if(!l)l=t;else if(l.options.logLevel!==`silent`){l.errors.push(new r.YAMLParseError(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return a&&i&&(l.errors.forEach(r.prettifyError(e,i)),l.warnings.forEach(r.prettifyError(e,i))),l}function parse(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let a=parseDocument(e,n);if(!a)return null;if(a.warnings.forEach(e=>i.warn(a.options.logLevel,e)),a.errors.length>0){if(a.options.logLevel!==`silent`)throw a.errors[0];a.errors=[]}return a.toJS(Object.assign({reviver:r},n))}function stringify(e,t,r){let i=null;if(typeof t==`function`||Array.isArray(t)?i=t:r===void 0&&t&&(r=t),typeof r==`string`&&(r=r.length),typeof r==`number`){let e=Math.round(r);r=e<1?void 0:e>8?{indent:8}:{indent:e}}if(e===void 0){let{keepUndefined:e}=r??t??{};if(!e)return}return a.isDocument(e)&&!i?e.toString(r):new n.Document(e,i,r).toString(r)}e.parse=parse,e.parseAllDocuments=parseAllDocuments,e.parseDocument=parseDocument,e.stringify=stringify})),Y=(/* @__PURE__ */ __commonJSMin((e=>{var t=qe(),n=G(),r=Me(),i=K(),a=j(),o=O(),s=R(),c=M(),l=z(),u=V();Ze();var d=Qe(),f=$e(),p=et(),m=tt(),h=k();e.Composer=t.Composer,e.Document=n.Document,e.Schema=r.Schema,e.YAMLError=i.YAMLError,e.YAMLParseError=i.YAMLParseError,e.YAMLWarning=i.YAMLWarning,e.Alias=a.Alias,e.isAlias=o.isAlias,e.isCollection=o.isCollection,e.isDocument=o.isDocument,e.isMap=o.isMap,e.isNode=o.isNode,e.isPair=o.isPair,e.isScalar=o.isScalar,e.isSeq=o.isSeq,e.Pair=s.Pair,e.Scalar=c.Scalar,e.YAMLMap=l.YAMLMap,e.YAMLSeq=u.YAMLSeq,e.Lexer=d.Lexer,e.LineCounter=f.LineCounter,e.Parser=p.Parser,e.parse=m.parse,e.parseAllDocuments=m.parseAllDocuments,e.parseDocument=m.parseDocument,e.stringify=m.stringify,e.visit=h.visit,e.visitAsync=h.visitAsync})))();function parseInstalledVpVersion(e){return(e.match(/^\s*vp\s+v?(\d[^\s]*)/im)??e.match(/Global:\s*v?(\d[^\s]*)/i))?.[1]??`unknown`}const nt=/* @__PURE__ */ new Set([`true`,`True`,`TRUE`]),rt=/* @__PURE__ */ new Set([`false`,`False`,`FALSE`]);function parseNodeManager(e){if(e){if(nt.has(e))return!0;if(rt.has(e))return!1;throw Error(`Invalid node-manager input: "${e}". Expected "true", "false", or unset.`)}}function supportsScopedEnv(e){let t=parseInstalledVpVersion(e);if(t.startsWith(`0.0.0-commit.`))return!0;let n=t.match(/^(\d+)\.(\d+)\.(\d+)/);if(!n)throw Error(`Could not determine the installed Vite+ version for env configuration.`);let[,r,i,a]=n.map(Number);return r>0||i>3||i===3&&a>=1}function nodeManagerOffArgs(e){return parseInstalledVpVersion(e).startsWith(`0.0.0-commit.`)&&console.info("setup-vp: node-manager: false requires a preview build that supports `vp env off node`. If this command is unsupported, use a newer preview or a stable release. setup-vp will not fall back to disabling package-manager management."),supportsScopedEnv(e)?[`env`,`off`,`node`]:[`env`,`off`]}const it=[`npm`,`pnpm`,`yarn`,`bun`];function parsePackageManager(e){if(!e?.trim())return;let t;try{t=(0,Y.parse)(e)}catch(e){throw Error(`Invalid package-manager input: ${String(e)}`)}if(t!==``){if(typeof t==`boolean`)return t;if(t&&typeof t==`object`&&!Array.isArray(t)){for(let[e,n]of Object.entries(t))if(!it.includes(e)||typeof n!=`boolean`)throw Error(`Invalid package-manager input: ${e} must be npm, pnpm, yarn, or bun with a boolean value.`);return t}throw Error(`Invalid package-manager input: expected a boolean or a mapping of npm, pnpm, yarn, and bun to booleans.`)}}function packageManagerArgs(e,t){if(e===void 0)return[];if(!supportsScopedEnv(t))throw Error(`package-manager configuration requires Vite+ 0.3.1 or newer.`);return typeof e==`boolean`?e?[]:[[`env`,`off`,`pm`]]:it.filter(t=>e[t]===!1).map(e=>[`env`,`off`,e])}const X=`Vite+`,Z=`vite-plus`;function resolvePath$1(e,t){return p.isAbsolute(e)?e:p.join(t,e)}function isWithin(e,t){let n=p.relative(t,e);return!p.isAbsolute(n)&&n!==`..`&&!n.startsWith(`..${p.sep}`)}function resolveProjectDirectory(e){let{workingDirectory:t,workspaceRoot:n}=e,r=p.isAbsolute(t)?t:p.join(n,t);try{if(!d(r).isDirectory())throw Error(`working-directory is not a directory: ${t} (resolved to ${r})`)}catch(e){throw e instanceof Error&&`code`in e&&e.code===`ENOENT`?Error(`working-directory not found: ${t} (resolved to ${r})`):e}return r}function isWindows(e=process.platform){return e===`win32`}function run(e,t,n={}){let r=S(e,t,{stdio:`inherit`,...n});if(r.error)throw r.error;if(r.status!==0)throw Error(`${e} ${t.join(` `)} exited with code ${r.status??1}`)}function runWithOutput(e,t,n={}){return new Promise((r,i)=>{let a=x(e,t,{...n,stdio:[`ignore`,`pipe`,`pipe`]}),o=``,s=``;a.stdout.on(`data`,e=>{process.stdout.write(e),o=(o+e.toString()).slice(-4e3)}),a.stderr.on(`data`,e=>{process.stderr.write(e),s=(s+e.toString()).slice(-4e3)}),a.on(`error`,i),a.on(`close`,e=>r({exitCode:e??1,stdout:o,stderr:s}))})}function commandPath(e,r=process.env){if(!e||e===`.`||e===`..`||/[\\/:]/.test(e))return;let i=isWindows(),a=i?Object.keys(r).sort().find(e=>e.toUpperCase()===`PATH`):`PATH`,o=a&&r[a]||``,s=i&&!e.toLowerCase().endsWith(`.exe`)?`${e}.exe`:e,c=l(process.cwd());for(let e of o.split(p.delimiter)){let r=i?e.replace(/^"(.*)"$/,`$1`):e;if(p.isAbsolute(r))try{let e=l(r);if(i?e.toLowerCase()===c.toLowerCase():e===c)continue;let a=p.join(r,s);if(!d(a).isFile())continue;return t(a,i?n.F_OK:n.X_OK),a}catch{}}}function getCommandOutput(e,t,n){let r=S(e,t,{cwd:n?.cwd,encoding:`utf8`,stdio:[`ignore`,`pipe`,`pipe`]});if(r.status===0)return r.stdout.trim()}const at=[{filename:`pnpm-lock.yaml`,type:`pnpm`},{filename:`bun.lockb`,type:`bun`},{filename:`bun.lock`,type:`bun`},{filename:`package-lock.json`,type:`npm`},{filename:`npm-shrinkwrap.json`,type:`npm`},{filename:`yarn.lock`,type:`yarn`}];function resolvePath(e,t){return g(e)?e:_(t,e)}function inferLockFileType(e,t){return t.includes(`pnpm`)?{type:`pnpm`,path:e,filename:t}:t.includes(`yarn`)?{type:`yarn`,path:e,filename:t}:t.startsWith(`bun.`)?{type:`bun`,path:e,filename:t}:{type:`npm`,path:e,filename:t}}function detectLockFile(e,t){if(e){let n=resolvePath(e,t);if(i(n)){let e=m(n),t=at.find(t=>t.filename===e);return t?{type:t.type,path:n,filename:e}:inferLockFileType(n,e)}return}let n=c(t);for(let e of at)if(n.includes(e.filename)){let n=_(t,e.filename);return{type:e.type,path:n,filename:e.filename}}}function prepareCacheMetadata(e){let{projectDir:t,cacheDependencyPath:n,logWarning:r}=e,i=detectLockFile(n||void 0,t);if(!i)return r?.(`setup-vp: cache is enabled but no supported lock file was found; skipping cache.`),{ready:!1};let a=getCommandOutput(`vp`,[`pm`,`cache`,`dir`],{cwd:p.dirname(i.path)});return a?{ready:!0,cachePath:a,lockFile:i.path,lockType:i.type}:(r?.(`setup-vp: could not resolve package-manager cache directory for ${i.filename}; skipping cache.`),{ready:!1})}function createLockfileResolver(e){let{getWorkspaceDir:t,info:n,debug:r}=e,a=/^\d+\.\d+\.\d+/;function tryResolveVitePlusVersionFromLockfile(e,t){let i=detectLockfileForProject(e,t);if(!i)return;let a=i.filename.endsWith(`.lockb`)?textBunLockBeside(i):i;if(!a){r(`Cannot read ${i.filename} (binary) to resolve the ${X} version; using "latest". Use the text bun.lock, or set the \`version\` input.`);return}let o=parseVitePlusVersionFromLockfile(a,workspaceSubPath(h(a.path),e));if(o)return n(`Resolved ${X} version '${o}' from ${a.filename}`),o;r(`No ${X} version found in ${a.path}`)}function detectLockfileForProject(e,n){if(n)return detectLockFile(n,e);let r=t(),i=e;for(;;){let e=detectLockFile(void 0,i);if(e)return e;let t=h(i);if(i===r||t===i||!isWithin(t,r))break;i=t}}function textBunLockBeside(e){let t=_(h(e.path),`bun.lock`);return i(t)?{type:`bun`,path:t,filename:`bun.lock`}:void 0}function workspaceSubPath(e,t){if(!isWithin(t,e))return``;let n=v(e,t);return n?n.split(y).join(`/`):``}function parseVitePlusVersionFromLockfile(e,t=``){if(e.filename.endsWith(`.lockb`))return;let n;try{n=s(e.path,`utf-8`)}catch{return}let r;switch(e.type){case`npm`:r=fromNpmLock(n,t);break;case`pnpm`:r=fromPnpmLock(n,t);break;case`yarn`:r=fromYarnLock(n);break;case`bun`:r=fromBunTextLock(n);break;default:return}return r&&a.test(r)?r:void 0}function fromNpmLock(e,t){let n;try{n=JSON.parse(e)}catch{return}let r=n.packages;if(t){let e=r?.[`${t}/node_modules/${Z}`]?.version;if(typeof e==`string`)return e;if(!npmPackageDeclaresVitePlus(r?.[t]))return}let i=r?.[`node_modules/${Z}`]?.version;if(typeof i==`string`)return i;let a=n.dependencies?.[Z]?.version;return typeof a==`string`?a:void 0}function npmPackageDeclaresVitePlus(e){if(!e)return!1;for(let t of[`dependencies`,`devDependencies`]){let n=e[t];if(n&&typeof n==`object`&&`vite-plus`in n)return!0}return!1}function fromPnpmLock(e,t){let n;try{n=(0,Y.parse)(e)}catch{return}if(!n||typeof n!=`object`)return;let r=n,i=r.importers;if(i&&typeof i==`object`){let e=t||`.`;return e in i?pnpmImporterVersion(i[e]):void 0}return pnpmImporterVersion(r)||e.match(/^\s*\/?vite-plus@(\d+\.\d+\.\d+[^\s():'"]*)/m)?.[1]}function pnpmImporterVersion(e){if(!e||typeof e!=`object`)return;let t=e;for(let e of[`dependencies`,`devDependencies`,`optionalDependencies`]){let n=t[e];if(n&&typeof n==`object`){let e=n[Z],t=typeof e==`string`?e:e?.version;if(typeof t==`string`){let e=t.replace(/\(.*$/,``).trim();if(a.test(e))return e}}}}function fromYarnLock(e){let t=/* @__PURE__ */ new Set,n=e.split(/\r?\n/);for(let e=0;ee,info:console.info,debug:()=>{},warning:console.warn}}const rt=`https://raw.githubusercontent.com/voidzero-dev/vite-plus`,it=`packages/cli`,at=/^0\.0\.0-commit\.([0-9a-f]{40})$/i,ot=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;function pkgPrNewCommitSha(e){return e.match(at)?.[1]}function getInstallScriptUrls(e,t=process.platform){let n=isWindows(t)?`install.ps1`:`install.sh`,r=installScriptRef(e);return{pinned:r?[`${rt}/${r}/${it}/${n}`,`https://cdn.jsdelivr.net/gh/voidzero-dev/vite-plus@${r}/${it}/${n}`]:[],latest:[`https://viteplus.dev/${n}`,`${rt}/main/${it}/${n}`]}}function installScriptRef(e){let t=pkgPrNewCommitSha(e);if(t)return t.toLowerCase();if(ot.test(e))return`v${e}`}function readNpmrc(e){try{return a(e,`utf8`)}catch(e){if(e.code===`ENOENT`)return``;throw e}}function analyzeProjectNpmrc(e){let t=/* @__PURE__ */ new Set;for(let n of e.split(/\r?\n/)){let e=n.trim();if(!e||e.startsWith(`;`)||e.startsWith(`#`))continue;let r=e.indexOf(`=`);if(r<0)continue;let i=e.slice(r+1).trim();for(let e of i.matchAll(/\$\{(\w+)\}/g))t.add(e[1])}return{envVarRefs:t}}function readUserConfigLines(e,t){let n=e.HOME||e.USERPROFILE,r=e.NPM_CONFIG_USERCONFIG||e.PNPM_CONFIG_USERCONFIG||n&&u.join(n,`.npmrc`);return(r?readNpmrc(r):``).split(/\r?\n/).filter(e=>!t.has(e.split(`=`)[0].trim().toLowerCase()))}function isReservedAuthVariable(e){return[`GITHUB_TOKEN`,`CI_JOB_TOKEN`,`SYSTEM_ACCESSTOKEN`].includes(e)?!1:/^(?:PATH|HOME|USERPROFILE|TMPDIR|CI)$/i.test(e)||/^(?:SETUP_VP_|RUNNER_|GITHUB_|CI_|SYSTEM_|AGENT_|BUILD_|RELEASE_)/i.test(e)}function writeUserConfig(e,t,n){let r=i(u.join(x(),`setup-vp-npmrc-`)),a=u.join(r,`.npmrc`);l(a,e,{encoding:`utf8`,mode:384});for(let e of[`NPM_CONFIG_USERCONFIG`,`PNPM_CONFIG_USERCONFIG`])t[e]=a,n?.(e,a);return a}function configureAuth(e,t,n,r,i){if(!e){if(!i)return;let{envVarRefs:e}=analyzeProjectNpmrc(readNpmrc(u.join(i,`.npmrc`)));for(let t of e)!isReservedAuthVariable(t)&&n[t]&&r?.(t,n[t]);return}let a;try{a=new URL(e)}catch{throw Error(`Invalid registry-url: "${e}". Must be a valid URL.`)}let o=a.href.endsWith(`/`)?a.href:`${a.href}/`,s=``;t&&(s=`${(t.startsWith(`@`)?t:`@${t}`).toLowerCase()}:`);let c=o.replace(/^\w+:/,``).toLowerCase(),l=readUserConfigLines(n,/* @__PURE__ */ new Set([`${s}registry`,`${c}:_authtoken`]));l.push(`${c}:_authToken=\${NODE_AUTH_TOKEN}`,`${s}registry=${o}`);let d=writeUserConfig(l.filter(Boolean).join(` +`)){let e=t.trim();if(!e||e.startsWith(`#`))continue;let[n,...r]=e.split(/\s+/);if(n===`nodejs`||n===`node`){for(let e of r)if(isAsdfInstallableVersion(e))return e}}}function isAsdfInstallableVersion(e){return!!e&&e!==`system`&&!e.startsWith(`ref:`)&&!e.startsWith(`path:`)}function parsePackageJson(e){let t;try{t=JSON.parse(e)}catch{throw Error(`Failed to parse package.json: invalid JSON`)}let n=t.devEngines;if(n?.runtime){let e=findNodeRuntime(n.runtime);if(e)return e}let r=t.engines;if(r?.node&&typeof r.node==`string`)return r.node}function findNodeRuntime(e){let t=Array.isArray(e)?e:[e];for(let e of t)if(e?.name===`node`&&typeof e.version==`string`)return e.version}return{resolveNodeVersionFile}}function resolutionContext(e){return{getWorkspaceDir:()=>e,info:console.info,debug:()=>{},warning:console.warn}}const ot=`https://raw.githubusercontent.com/voidzero-dev/vite-plus`,st=`packages/cli`,ct=/^0\.0\.0-commit\.([0-9a-f]{40})$/i,lt=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;function pkgPrNewCommitSha(e){return e.match(ct)?.[1]}function getInstallScriptUrls(e,t=process.platform){let n=isWindows(t)?`install.ps1`:`install.sh`,r=installScriptRef(e);return{pinned:r?[`${ot}/${r}/${st}/${n}`,`https://cdn.jsdelivr.net/gh/voidzero-dev/vite-plus@${r}/${st}/${n}`]:[],latest:[`https://viteplus.dev/${n}`,`${ot}/main/${st}/${n}`]}}function installScriptRef(e){let t=pkgPrNewCommitSha(e);if(t)return t.toLowerCase();if(lt.test(e))return`v${e}`}function readNpmrc(e){try{return s(e,`utf8`)}catch(e){if(e.code===`ENOENT`)return``;throw e}}function analyzeProjectNpmrc(e){let t=/* @__PURE__ */ new Set;for(let n of e.split(/\r?\n/)){let e=n.trim();if(!e||e.startsWith(`;`)||e.startsWith(`#`))continue;let r=e.indexOf(`=`);if(r<0)continue;let i=e.slice(r+1).trim();for(let e of i.matchAll(/\$\{(\w+)\}/g))t.add(e[1])}return{envVarRefs:t}}function readUserConfigLines(e,t){let n=e.HOME||e.USERPROFILE,r=e.NPM_CONFIG_USERCONFIG||e.PNPM_CONFIG_USERCONFIG||n&&p.join(n,`.npmrc`);return(r?readNpmrc(r):``).split(/\r?\n/).filter(e=>!t.has(e.split(`=`)[0].trim().toLowerCase()))}function isReservedAuthVariable(e){return[`GITHUB_TOKEN`,`CI_JOB_TOKEN`,`SYSTEM_ACCESSTOKEN`].includes(e)?!1:/^(?:PATH|HOME|USERPROFILE|TMPDIR|CI)$/i.test(e)||/^(?:SETUP_VP_|RUNNER_|GITHUB_|CI_|SYSTEM_|AGENT_|BUILD_|RELEASE_)/i.test(e)}function writeUserConfig(e,t,n){let r=o(p.join(w(),`setup-vp-npmrc-`)),i=p.join(r,`.npmrc`);f(i,e,{encoding:`utf8`,mode:384});for(let e of[`NPM_CONFIG_USERCONFIG`,`PNPM_CONFIG_USERCONFIG`])t[e]=i,n?.(e,i);return i}function configureAuth(e,t,n,r,i){if(!e){if(!i)return;let{envVarRefs:e}=analyzeProjectNpmrc(readNpmrc(p.join(i,`.npmrc`)));for(let t of e)!isReservedAuthVariable(t)&&n[t]&&r?.(t,n[t]);return}let a;try{a=new URL(e)}catch{throw Error(`Invalid registry-url: "${e}". Must be a valid URL.`)}let o=a.href.endsWith(`/`)?a.href:`${a.href}/`,s=``;t&&(s=`${(t.startsWith(`@`)?t:`@${t}`).toLowerCase()}:`);let c=o.replace(/^\w+:/,``).toLowerCase(),l=readUserConfigLines(n,/* @__PURE__ */ new Set([`${s}registry`,`${c}:_authtoken`]));l.push(`${c}:_authToken=\${NODE_AUTH_TOKEN}`,`${s}registry=${o}`);let u=writeUserConfig(l.filter(Boolean).join(` `)+` -`,n,r);return n.NODE_AUTH_TOKEN=n.NODE_AUTH_TOKEN||`XXXXX-XXXXX-XXXXX-XXXXX`,r?.(`NODE_AUTH_TOKEN`,n.NODE_AUTH_TOKEN),d}function resolveSfwEnabled(e,t,n){return e?!pkgPrNewCommitSha(t)||(n(`sfw was requested but is automatically disabled for Vite+ preview build ${t}; Socket Firewall Free will not be used.`),!1):!1}const Q=`v1.15.4`,st=`https://github.com/SocketDev/sfw-free/releases/download/${Q}`;function isMuslLinux(){if(process.platform!==`linux`)return!1;try{let e=process.report?.getReport();if(e?.header&&!e.header.glibcVersionRuntime)return!0}catch{}return n(`/etc/alpine-release`)}function getSfwAssetName(e,t,n){if(e===`darwin`){if(t===`arm64`)return`sfw-free-macos-arm64`;if(t===`x64`)return`sfw-free-macos-x86_64`}else if(e===`linux`){if(t===`arm64`)return n?`sfw-free-musl-linux-arm64`:`sfw-free-linux-arm64`;if(t===`x64`)return n?`sfw-free-musl-linux-x86_64`:`sfw-free-linux-x86_64`}else if(isWindows(e)){if(t===`arm64`)return`sfw-free-windows-arm64.exe`;if(t===`x64`)return`sfw-free-windows-x86_64.exe`}throw Error(`Unsupported platform/arch for sfw: ${e}/${t}${e===`linux`?` (${n?`musl`:`glibc`})`:``}`)}function downloadFileWithShell(e,t,n){let r=Math.max(1,Math.ceil(n/1e3)),i=commandPath(`curl`);if(i){let n=y(i,[`-fsSL`,`--connect-timeout`,`5`,`--max-time`,String(r),e,`-o`,t],{stdio:`ignore`});if(n.status===0)return;throw n.error||/* @__PURE__ */ Error(`curl failed while downloading ${e}`)}let a=commandPath(`wget`);if(a){let n=y(a,[`-q`,`-T`,String(r),`-t`,`2`,`-O`,t,e],{stdio:`ignore`});if(n.status===0)return;throw n.error||/* @__PURE__ */ Error(`wget failed while downloading ${e}`)}throw Error(`curl or wget is required to download sfw`)}function downloadFile(e,n,r=0,i=6e4,a){return r>5?Promise.reject(/* @__PURE__ */ Error(`too many redirects while downloading ${e}`)):a?new Promise((o,s)=>{let c=!1,finish=e=>{c||(c=!0,clearTimeout(u),e?s(e):o())},l=a(e,o=>{let s=o.statusCode??0,c=o.headers.location;if(s>=300&&s<400&&c){o.resume(),downloadFile(new URL(c,e).toString(),n,r+1,i,a).then(()=>finish(),finish);return}if(s!==200){o.resume(),finish(/* @__PURE__ */ Error(`download failed with HTTP ${s}: ${e}`));return}let l=t(n);o.pipe(l),l.on(`finish`,()=>l.close(()=>finish())),l.on(`error`,finish)}),u=setTimeout(()=>{l.destroy(/* @__PURE__ */ Error(`download timed out after ${i}ms: ${e}`))},i);l.on(`error`,finish)}):(downloadFileWithShell(e,n,i),Promise.resolve())}async function setupSfw(e,t={}){let n=t.env??process.env,r=t.sfwEnabled??n.SETUP_VP_SFW===`true`,i=t.platform??process.platform,a=t.arch??process.arch,o=t.isMusl??isMuslLinux(),s=t.download??downloadFile;if(!resolveSfwEnabled(r,t.vitePlusVersion??``,t.logWarning??console.warn))return`vp`;if(e.length===0)return console.log(`setup-vp: sfw was requested but run-install is disabled; sfw will not be invoked.`),`vp`;let c=commandPath(`sfw`);if(c)return console.log(`setup-vp: using existing sfw on PATH: ${c}`),`sfw`;let l;try{l=getSfwAssetName(i,a,o)}catch{return console.error(`setup-vp: sfw has no published binary for this runner's platform/architecture (process.platform=${i}, process.arch=${a}, musl=${o}) and none was found on PATH; falling back to plain vp install.`),`vp`}let d=t.cacheDirectory||n.SETUP_VP_SFW_CACHE_DIR,f=d?u.join(d,Q,l):await w(u.join(x(),`setup-vp-sfw-`));await C(f,{recursive:!0});let p=u.join(f,isWindows(i)?`sfw.exe`:`sfw`),m=`${st}/${l}`;function activate(){let e=isWindows(i)?`;`:`:`;return n.PATH=`${f}${e}${n.PATH||``}`,t.exportVariable?.(`PATH`,n.PATH),`sfw`}if(await ee(p).then(e=>e.isFile()&&e.size>0,()=>!1))return console.log(`setup-vp: using cached sfw ${Q}: ${p}`),activate();for(let e=1;e<=2;e+=1){let t=await w(u.join(f,`.download-`)),n=u.join(t,`sfw`);try{if(console.log(`setup-vp: installing sfw ${Q} from ${m}`),await s(m,n),(await ee(n)).size===0)throw Error(`Downloaded sfw binary is empty`);return await S(n,493),await T(n,p),activate()}catch(t){if(e===2)throw t;await new Promise(e=>setTimeout(e,2e3))}finally{await E(t,{recursive:!0,force:!0})}}throw Error(`failed to install sfw after retrying`)}function isRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function validateRunInstallEntry(e){if(!isRecord(e))throw Error(`run-install entries must be objects`);for(let t of Object.keys(e))if(t!==`cwd`&&t!==`args`)throw Error(`unsupported run-install key: ${t}`);let t={};if(e.cwd!==void 0){if(typeof e.cwd!=`string`)throw Error(`run-install.cwd must be a string`);t.cwd=e.cwd}if(e.args!==void 0){if(!Array.isArray(e.args)||e.args.some(e=>typeof e!=`string`))throw Error(`run-install.args must be an array of strings`);t.args=e.args}return t}function validateRunInstallInput(e){return e===null||typeof e==`boolean`?e:Array.isArray(e)?e.map(validateRunInstallEntry):validateRunInstallEntry(e)}function parseRunInstall(e){let t=validateRunInstallInput((0,Y.parse)(e)??null);return t?t===!0?[{}]:Array.isArray(t)?t:[t]:[]}function isSfwVpNotFoundFlake(e,t){return/Command 'vp' not found in PATH/.test(e+` -`+t)}async function runInstall(e,t,n,r=process.env,i={}){let a={...r};delete a.SETUP_VP_ENV_FILE;let o=i.execute??runWithOutput,s=[];for(let r of e){let e=r.cwd?u.resolve(t,r.cwd):t,c=[`install`,...r.args||[]],l=n===`sfw`?[`vp`,...c]:c,d=`${n} ${l.join(` `)} (cwd: ${e})`;console.log(`setup-vp: running ${d}`);try{let t=await o(n,l,{cwd:e,env:a});if(t.exitCode!==0&&n===`sfw`&&isSfwVpNotFoundFlake(t.stdout,t.stderr)){let r=isWindows(i.platform);if(console.warn(r?`setup-vp: sfw could not resolve vp; warming the PowerShell command cache and retrying once.`:`setup-vp: sfw could not resolve vp; retrying once.`),r)try{await o(`powershell.exe`,[`-NoProfile`,`-Command`,`Get-Command vp`],{cwd:e,env:a})}catch{}t=await o(n,l,{cwd:e,env:a})}t.exitCode!==0&&s.push(`${d} exited with code ${t.exitCode}\n${t.stderr.trim()||t.stdout.trim()}`)}catch(e){s.push(`${d}: ${String(e)}`)}}if(s.length)throw Error(s.join(` +`,n,r);return n.NODE_AUTH_TOKEN=n.NODE_AUTH_TOKEN||`XXXXX-XXXXX-XXXXX-XXXXX`,r?.(`NODE_AUTH_TOKEN`,n.NODE_AUTH_TOKEN),u}function resolveSfwEnabled(e,t,n){return e?!pkgPrNewCommitSha(t)||(n(`sfw was requested but is automatically disabled for Vite+ preview build ${t}; Socket Firewall Free will not be used.`),!1):!1}const Q=`v1.15.4`,ut=`https://github.com/SocketDev/sfw-free/releases/download/${Q}`;function isMuslLinux(){if(process.platform!==`linux`)return!1;try{let e=process.report?.getReport();if(e?.header&&!e.header.glibcVersionRuntime)return!0}catch{}return i(`/etc/alpine-release`)}function getSfwAssetName(e,t,n){if(e===`darwin`){if(t===`arm64`)return`sfw-free-macos-arm64`;if(t===`x64`)return`sfw-free-macos-x86_64`}else if(e===`linux`){if(t===`arm64`)return n?`sfw-free-musl-linux-arm64`:`sfw-free-linux-arm64`;if(t===`x64`)return n?`sfw-free-musl-linux-x86_64`:`sfw-free-linux-x86_64`}else if(isWindows(e)){if(t===`arm64`)return`sfw-free-windows-arm64.exe`;if(t===`x64`)return`sfw-free-windows-x86_64.exe`}throw Error(`Unsupported platform/arch for sfw: ${e}/${t}${e===`linux`?` (${n?`musl`:`glibc`})`:``}`)}function downloadFileWithShell(e,t,n){let r=Math.max(1,Math.ceil(n/1e3)),i=commandPath(`curl`);if(i){let n=S(i,[`-fsSL`,`--connect-timeout`,`5`,`--max-time`,String(r),e,`-o`,t],{stdio:`ignore`});if(n.status===0)return;throw n.error||/* @__PURE__ */ Error(`curl failed while downloading ${e}`)}let a=commandPath(`wget`);if(a){let n=S(a,[`-q`,`-T`,String(r),`-t`,`2`,`-O`,t,e],{stdio:`ignore`});if(n.status===0)return;throw n.error||/* @__PURE__ */ Error(`wget failed while downloading ${e}`)}throw Error(`curl or wget is required to download sfw`)}function downloadFile(e,t,n=0,i=6e4,a){return n>5?Promise.reject(/* @__PURE__ */ Error(`too many redirects while downloading ${e}`)):a?new Promise((o,s)=>{let c=!1,finish=e=>{c||(c=!0,clearTimeout(u),e?s(e):o())},l=a(e,o=>{let s=o.statusCode??0,c=o.headers.location;if(s>=300&&s<400&&c){o.resume(),downloadFile(new URL(c,e).toString(),t,n+1,i,a).then(()=>finish(),finish);return}if(s!==200){o.resume(),finish(/* @__PURE__ */ Error(`download failed with HTTP ${s}: ${e}`));return}let l=r(t);o.pipe(l),l.on(`finish`,()=>l.close(()=>finish())),l.on(`error`,finish)}),u=setTimeout(()=>{l.destroy(/* @__PURE__ */ Error(`download timed out after ${i}ms: ${e}`))},i);l.on(`error`,finish)}):(downloadFileWithShell(e,t,i),Promise.resolve())}async function setupSfw(e,t={}){let n=t.env??process.env,r=t.sfwEnabled??n.SETUP_VP_SFW===`true`,i=t.platform??process.platform,a=t.arch??process.arch,o=t.isMusl??isMuslLinux(),s=t.download??downloadFile;if(!resolveSfwEnabled(r,t.vitePlusVersion??``,t.logWarning??console.warn))return`vp`;if(e.length===0)return console.log(`setup-vp: sfw was requested but run-install is disabled; sfw will not be invoked.`),`vp`;let c=commandPath(`sfw`,n);if(c)return console.log(`setup-vp: using existing sfw on PATH: ${c}`),`sfw`;let l;try{l=getSfwAssetName(i,a,o)}catch{return console.error(`setup-vp: sfw has no published binary for this runner's platform/architecture (process.platform=${i}, process.arch=${a}, musl=${o}) and none was found on PATH; falling back to plain vp install.`),`vp`}let u=t.cacheDirectory||n.SETUP_VP_SFW_CACHE_DIR,d=u?p.join(u,Q,l):await ee(p.join(w(),`setup-vp-sfw-`));await E(d,{recursive:!0});let f=p.join(d,isWindows(i)?`sfw.exe`:`sfw`),m=`${ut}/${l}`;function activate(){let e=isWindows(i)?`;`:`:`;return n.PATH=`${d}${e}${n.PATH||``}`,t.exportVariable?.(`PATH`,n.PATH),`sfw`}if(await re(f).then(e=>e.isFile()&&e.size>0,()=>!1))return console.log(`setup-vp: using cached sfw ${Q}: ${f}`),activate();for(let e=1;e<=2;e+=1){let t=await ee(p.join(d,`.download-`)),n=p.join(t,`sfw`);try{if(console.log(`setup-vp: installing sfw ${Q} from ${m}`),await s(m,n),(await re(n)).size===0)throw Error(`Downloaded sfw binary is empty`);return await T(n,493),await te(n,f),activate()}catch(t){if(e===2)throw t;await new Promise(e=>setTimeout(e,2e3))}finally{await ne(t,{recursive:!0,force:!0})}}throw Error(`failed to install sfw after retrying`)}function isRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function validateRunInstallEntry(e){if(!isRecord(e))throw Error(`run-install entries must be objects`);for(let t of Object.keys(e))if(t!==`cwd`&&t!==`args`)throw Error(`unsupported run-install key: ${t}`);let t={};if(e.cwd!==void 0){if(typeof e.cwd!=`string`)throw Error(`run-install.cwd must be a string`);t.cwd=e.cwd}if(e.args!==void 0){if(!Array.isArray(e.args)||e.args.some(e=>typeof e!=`string`))throw Error(`run-install.args must be an array of strings`);t.args=e.args}return t}function validateRunInstallInput(e){return e===null||typeof e==`boolean`?e:Array.isArray(e)?e.map(validateRunInstallEntry):validateRunInstallEntry(e)}function parseRunInstall(e){let t=validateRunInstallInput((0,Y.parse)(e)??null);return t?t===!0?[{}]:Array.isArray(t)?t:[t]:[]}function isSfwVpNotFoundFlake(e,t){return/Command 'vp' not found in PATH/.test(e+` +`+t)}async function runInstall(e,t,n,r=process.env,i={}){let a={...r};delete a.SETUP_VP_ENV_FILE;let o=i.execute??runWithOutput,s=[];for(let r of e){let e=r.cwd?p.resolve(t,r.cwd):t,c=[`install`,...r.args||[]],l=n===`sfw`?[`vp`,...c]:c,u=`${n} ${l.join(` `)} (cwd: ${e})`;console.log(`setup-vp: running ${u}`);try{let t=await o(n,l,{cwd:e,env:a});if(t.exitCode!==0&&n===`sfw`&&isSfwVpNotFoundFlake(t.stdout,t.stderr)){let r=isWindows(i.platform);if(console.warn(r?`setup-vp: sfw could not resolve vp; warming the PowerShell command cache and retrying once.`:`setup-vp: sfw could not resolve vp; retrying once.`),r)try{await o(`powershell.exe`,[`-NoProfile`,`-Command`,`Get-Command vp`],{cwd:e,env:a})}catch{}t=await o(n,l,{cwd:e,env:a})}t.exitCode!==0&&s.push(`${u} exited with code ${t.exitCode}\n${t.stderr.trim()||t.stdout.trim()}`)}catch(e){s.push(`${u}: ${String(e)}`)}}if(s.length)throw Error(s.join(` `))}function escapeLoggingCommandData(e){return e.replaceAll(`%`,`%AZP25`).replaceAll(`\r`,`%0D`).replaceAll(` -`,`%0A`).replaceAll(`;`,`%3B`).replaceAll(`]`,`%5D`)}function prependPath(e){process.stdout.write(`##vso[task.prependpath]${escapeLoggingCommandData(e)}\n`)}function setVariable(e,t,n={}){let r=[`variable=${e}`];n.isOutput&&r.push(`isOutput=true`),n.isReadonly&&r.push(`isReadonly=true`),n.isSecret&&r.push(`issecret=true`),process.stdout.write(`##vso[task.setvariable ${r.join(`;`)}]${escapeLoggingCommandData(t)}\n`)}function logWarning(e){process.stdout.write(`##vso[task.logissue type=warning]${escapeLoggingCommandData(e)}\n`)}function logInfo(e){console.log(e)}const $=`SETUP_VP_DIRS_FILE`;function getVitePlusBinDirs(e){let t=m(e.data,`fallback-bin`);return c(t,{throwIfNoEntry:!1})?.isDirectory()?{bin:e.bin,fallbackBin:t}:{bin:e.bin}}function appendFallbackBinToPath(e,t,n=process.platform){let r=isWindows(n)?`;`:`:`;return[...e?e.split(r).filter(e=>e!==t):[],t].join(r)}const ct=/^v?(\d+)\.(\d+)\.\d+(?:-[0-9A-Za-z.-]+)?$/;function supportsVitePlusDirs(e){if(pkgPrNewCommitSha(e))return!0;let t=e.match(ct);if(!t)return!0;let n=Number(t[1]),r=Number(t[2]);return n>0||r>=3}function createVitePlusDirsFile(){return m(x(),`setup-vp-dirs-${ne()}.txt`)}function removeVitePlusDirsFile(e){s(e,{force:!0})}function readVitePlusProbe(e){try{return a(e,`utf8`)}catch(e){if(e.code===`ENOENT`)return;throw e}}function resolveVitePlusBinDirs(e,t,n){if(!t){if(!supportsVitePlusDirs(e))return{bin:n};throw Error(`Vite+ was installed successfully, but setup-vp could not resolve its VpDirs.`)}let r=readVitePlusProbe(t),i=r===void 0?void 0:parseVitePlusDirs(r);if(i)return getVitePlusBinDirs(i);if(!(pkgPrNewCommitSha(e)!==void 0||ct.test(e))&&r!==void 0){let e=parseInstalledVpVersion(r);if(e!==`unknown`&&!supportsVitePlusDirs(e))return{bin:n}}throw Error(`Vite+ was installed successfully, but setup-vp could not resolve its VpDirs.`)}function parseVitePlusDirs(e){let t=/* @__PURE__ */ new Map;for(let n of e.split(/\r?\n/)){let e=n.indexOf(` `);if(e<1)continue;let r=n.slice(0,e).replace(/^\uFEFF/,``),i=n.slice(e+1).trim();i&&t.set(r,i)}let n=t.get(`data`),r=t.get(`bin`),i=t.get(`cache`),a=t.get(`config`),o=t.get(`state`);if(n&&r&&i&&a&&o)return{data:n,bin:r,cache:i,config:a,state:o}}function getInstallScriptCommand(e,t=process.platform,n=!0){if(isWindows(t))return n?{command:`pwsh`,args:[`-Command`,` +`,`%0A`).replaceAll(`;`,`%3B`).replaceAll(`]`,`%5D`)}function prependPath(e){process.stdout.write(`##vso[task.prependpath]${escapeLoggingCommandData(e)}\n`)}function setVariable(e,t,n={}){let r=[`variable=${e}`];n.isOutput&&r.push(`isOutput=true`),n.isReadonly&&r.push(`isReadonly=true`),n.isSecret&&r.push(`issecret=true`),process.stdout.write(`##vso[task.setvariable ${r.join(`;`)}]${escapeLoggingCommandData(t)}\n`)}function logWarning(e){process.stdout.write(`##vso[task.logissue type=warning]${escapeLoggingCommandData(e)}\n`)}function logInfo(e){console.log(e)}const $=`SETUP_VP_DIRS_FILE`;function getVitePlusBinDirs(e){let t=_(e.data,`fallback-bin`);return d(t,{throwIfNoEntry:!1})?.isDirectory()?{bin:e.bin,fallbackBin:t}:{bin:e.bin}}function appendFallbackBinToPath(e,t,n=process.platform){let r=isWindows(n)?`;`:`:`;return[...e?e.split(r).filter(e=>e!==t):[],t].join(r)}const dt=/^v?(\d+)\.(\d+)\.\d+(?:-[0-9A-Za-z.-]+)?$/;function supportsVitePlusDirs(e){if(pkgPrNewCommitSha(e))return!0;let t=e.match(dt);if(!t)return!0;let n=Number(t[1]),r=Number(t[2]);return n>0||r>=3}function createVitePlusDirsFile(){return _(w(),`setup-vp-dirs-${ae()}.txt`)}function removeVitePlusDirsFile(e){u(e,{force:!0})}function readVitePlusProbe(e){try{return s(e,`utf8`)}catch(e){if(e.code===`ENOENT`)return;throw e}}function resolveVitePlusBinDirs(e,t,n){if(!t){if(!supportsVitePlusDirs(e))return{bin:n};throw Error(`Vite+ was installed successfully, but setup-vp could not resolve its VpDirs.`)}let r=readVitePlusProbe(t),i=r===void 0?void 0:parseVitePlusDirs(r);if(i)return getVitePlusBinDirs(i);if(!(pkgPrNewCommitSha(e)!==void 0||dt.test(e))&&r!==void 0){let e=parseInstalledVpVersion(r);if(e!==`unknown`&&!supportsVitePlusDirs(e))return{bin:n}}throw Error(`Vite+ was installed successfully, but setup-vp could not resolve its VpDirs.`)}function parseVitePlusDirs(e){let t=/* @__PURE__ */ new Map;for(let n of e.split(/\r?\n/)){let e=n.indexOf(` `);if(e<1)continue;let r=n.slice(0,e).replace(/^\uFEFF/,``),i=n.slice(e+1).trim();i&&t.set(r,i)}let n=t.get(`data`),r=t.get(`bin`),i=t.get(`cache`),a=t.get(`config`),o=t.get(`state`);if(n&&r&&i&&a&&o)return{data:n,bin:r,cache:i,config:a,state:o}}function getInstallScriptCommand(e,t=process.platform,n=!0){if(isWindows(t))return n?{command:`pwsh`,args:[`-Command`,` $dirsFile = $env:${$} Set-Content -LiteralPath $dirsFile -Value '' -NoNewline -Encoding UTF8 . ([scriptblock]::Create((irm -TimeoutSec 15 ${e}))) @@ -189,4 +189,4 @@ fi set +u set -o pipefail ${r} | bash -`.trim()]}}const lt=2e3;function getVitePlusHome(e=process.platform,t=process.env){let n=isWindows(e)?t.USERPROFILE||b():t.HOME||b();return m(n,`.vite-plus`)}function runInstallCommand(e,t,n=process.platform){let{command:r,args:i}=getInstallScriptCommand(e,n,t.VP_VPDIRS_AWARE===`1`),a={env:{...process.env,...t},stdio:`inherit`},o=y(r,i,a);if(isWindows(n)&&o.error?.code===`ENOENT`&&(o=y(`powershell.exe`,i,a)),o.error)throw o.error;return o.status??1}async function installVitePlus(e,t={}){let n=t.platform??process.platform,r=t.env??process.env,i=t.prependPath,a=t.sleep??te,o=t.runInstall??runInstallCommand,s=t.logWarningFn??console.warn,c={...Object.fromEntries(Object.entries(r).filter(e=>e[1]!==void 0)),VP_VERSION:e,VITE_PLUS_VERSION:e},l=supportsVitePlusDirs(e)?createVitePlusDirsFile():void 0;l?(c.VP_VPDIRS_AWARE=`1`,c[$]=l):(delete c.VP_VPDIRS_AWARE,delete c[$]);let u=pkgPrNewCommitSha(e);u&&(c.VP_PR_VERSION=u);let{pinned:d,latest:f}=getInstallScriptUrls(e,n),p=d.length+f.length,h=2*p,g=``,_=0;async function tryUrls(e){for(let t=0;t<2;t+=1)for(let t of e){_+=1;try{let e=o(t,c,n);if(e===0)return!0;g=`exit code ${e}`}catch(e){g=e instanceof Error?e.message:String(e)}_0){if(await tryUrls(d)){ensureBinInPath();return}s(`setup-vp: could not fetch the install script pinned to Vite+ ${e}. Falling back to the latest install script. The latest script may not be compatible with ${e}.`)}if(await tryUrls(f)){ensureBinInPath();return}throw Error(`Failed to install Vite+ after ${h} attempts across ${p} URL(s): ${g}`)}finally{l&&removeVitePlusDirsFile(l)}}function parseBoolean(e){return e?.toLowerCase()===`true`}function parseAzureInputs(e){return{version:e.SETUP_VP_VERSION||``,versionFile:e.SETUP_VP_VERSION_FILE||void 0,nodeVersion:e.SETUP_VP_NODE_VERSION||void 0,nodeVersionFile:e.SETUP_VP_NODE_VERSION_FILE||void 0,workingDirectory:e.SETUP_VP_WORKING_DIRECTORY||`.`,runInstall:e.SETUP_VP_RUN_INSTALL??`true`,sfw:parseBoolean(e.SETUP_VP_SFW),nodeManager:parseNodeManager(e.SETUP_VP_NODE_MANAGER),packageManager:parsePackageManager(e.SETUP_VP_PACKAGE_MANAGER),registryUrl:e.SETUP_VP_REGISTRY_URL||``,scope:e.SETUP_VP_SCOPE||``,cache:parseBoolean(e.SETUP_VP_CACHE),cacheDependencyPath:e.SETUP_VP_CACHE_DEPENDENCY_PATH||``,workspaceRoot:e.SYSTEM_DEFAULTWORKINGDIRECTORY||process.cwd()}}function resolveProjectDirFromInputs(e){return resolveProjectDirectory({workingDirectory:e.workingDirectory,workspaceRoot:e.workspaceRoot})}const ut={installVitePlus,prepareCacheMetadata,configureAuth,setupSfw,parseRunInstall,runInstall,getCommandOutput,run,parseInstalledVpVersion,prependPath,setVariable,logWarning,logInfo};function fail(e){console.error(`setup-vp: ${e}`),process.exit(1)}async function runPrepare(e=process.env,t=ut){let n=parseAzureInputs(e),i=resolveProjectDirFromInputs(n);if(n.nodeManager===!1&&(n.nodeVersion||n.nodeVersionFile))throw Error(`node-version and node-version-file cannot be used with node-manager: false`);let a={...resolutionContext(n.workspaceRoot),info:t.logInfo,warning:t.logWarning},o=createVersionResolver(a).resolveVitePlusVersion(n,i),s=n.nodeVersion||(n.nodeVersionFile?createNodeVersionResolver(a).resolveNodeVersionFile(n.nodeVersionFile,i):void 0);t.setVariable(`SETUP_VP_CACHE_HIT`,`false`),t.setVariable(`SETUP_VP_CACHE_READY`,`false`),t.setVariable(`SETUP_VP_SFW_READY`,`false`),t.setVariable(`SETUP_VP_BOOTSTRAP_NODE`,process.execPath),await t.installVitePlus(o,{env:e,prependPath:e=>t.prependPath(e),exportPath:e=>t.setVariable(`PATH`,e),logWarningFn:t.logWarning}),t.setVariable(`SETUP_VP_RESOLVED_VERSION`,o);let c=(n.nodeManager===!1||n.packageManager!==void 0)&&t.getCommandOutput(`vp`,[`--version`])||``,l=packageManagerArgs(n.packageManager,c);n.nodeManager===!1?t.run(`vp`,nodeManagerOffArgs(c)):s&&t.run(`vp`,[`env`,`use`,s],{cwd:i});for(let e of l)t.run(`vp`,e);let d=u.resolve(process.argv[1]||``);if(t.setVariable(`SETUP_VP_RUNTIME_PATH`,d),n.sfw&&!pkgPrNewCommitSha(o)&&t.parseRunInstall(n.runInstall).length>0)try{let i=getSfwAssetName(process.platform,process.arch,isMuslLinux()),a=u.join(e.PIPELINE_WORKSPACE||n.workspaceRoot,`.setup-vp-sfw`);r(a,{recursive:!0}),t.setVariable(`SETUP_VP_SFW_CACHE_DIR`,a),t.setVariable(`SETUP_VP_SFW_CACHE_KEY`,`${Q}-${i}`),t.setVariable(`SETUP_VP_SFW_READY`,`true`)}catch(e){t.logWarning(String(e))}if(!n.cache)return;let f=t.prepareCacheMetadata({projectDir:i,cacheDependencyPath:n.cacheDependencyPath||void 0,logWarning:t.logWarning});if(!f.ready){t.setVariable(`SETUP_VP_CACHE_READY`,`false`);return}t.setVariable(`SETUP_VP_CACHE_READY`,`true`),f.cachePath&&t.setVariable(`SETUP_VP_CACHE_PATH`,f.cachePath),f.lockFile&&t.setVariable(`SETUP_VP_LOCK_FILE`,f.lockFile),f.lockType&&t.setVariable(`SETUP_VP_LOCK_TYPE`,f.lockType)}async function runFinalize(e=process.env,t=ut){let n=parseAzureInputs(e),r=resolveProjectDirFromInputs(n),i=analyzeProjectNpmrc(readNpmrc(u.join(r,`.npmrc`))).envVarRefs;i.add(`NODE_AUTH_TOKEN`);for(let t of i)!isReservedAuthVariable(t)&&/^\$\([^)]+\)$/.test(e[t]||``)&&delete e[t];t.configureAuth(n.registryUrl,n.scope,e,(e,n)=>{e!==`NODE_AUTH_TOKEN`&&n!==void 0&&t.setVariable(e,n,{isSecret:e!==`NPM_CONFIG_USERCONFIG`&&e!==`PNPM_CONFIG_USERCONFIG`})},r);let a=t.parseRunInstall(n.runInstall),o=await t.setupSfw(a,{env:e,sfwEnabled:n.sfw,vitePlusVersion:e.SETUP_VP_RESOLVED_VERSION||n.version,logWarning:t.logWarning,exportVariable:(e,n)=>{n!==void 0&&(e===`PATH`?t.prependPath(n.split(u.delimiter)[0]):t.setVariable(e,n))}});a.length>0&&await t.runInstall(a,r,o,e);let s=t.getCommandOutput(`vp`,[`--version`],{cwd:r});if(!s)throw Error(`Failed to verify Vite+ installation: vp --version failed or returned no output.`);t.logInfo(s);let c=t.parseInstalledVpVersion(s);t.setVariable(`SETUP_VP_INSTALLED_VERSION`,c),t.setVariable(`version`,c,{isOutput:!0}),t.setVariable(`cacheHit`,String(e.SETUP_VP_CACHE_HIT===`true`),{isOutput:!0})}async function main(e){if(e===`prepare`){await runPrepare();return}if(e===`finalize`){await runFinalize();return}fail(`invalid phase "${String(e)}"; expected "prepare" or "finalize"`)}function isEntrypoint(e=process.argv[1],t=import.meta.url){return!!(e&&t===_(u.resolve(e)).href)}if(isEntrypoint()){let e=process.argv[2];e||fail(`missing phase argument; expected "prepare" or "finalize"`);try{await main(e)}catch(e){fail(e instanceof Error?e.message:String(e))}}export{isEntrypoint,main,runFinalize,runPrepare}; \ No newline at end of file +`.trim()]}}const ft=2e3;function getVitePlusHome(e=process.platform,t=process.env){let n=isWindows(e)?t.USERPROFILE||C():t.HOME||C();return _(n,`.vite-plus`)}function runInstallCommand(e,t,n=process.platform){let{command:r,args:i}=getInstallScriptCommand(e,n,t.VP_VPDIRS_AWARE===`1`),a={env:{...process.env,...t},stdio:`inherit`},o=S(r,i,a);if(isWindows(n)&&o.error?.code===`ENOENT`&&(o=S(`powershell.exe`,i,a)),o.error)throw o.error;return o.status??1}async function installVitePlus(e,t={}){let n=t.platform??process.platform,r=t.env??process.env,i=t.prependPath,a=t.sleep??ie,o=t.runInstall??runInstallCommand,s=t.logWarningFn??console.warn,c={...Object.fromEntries(Object.entries(r).filter(e=>e[1]!==void 0)),VP_VERSION:e,VITE_PLUS_VERSION:e},l=supportsVitePlusDirs(e)?createVitePlusDirsFile():void 0;l?(c.VP_VPDIRS_AWARE=`1`,c[$]=l):(delete c.VP_VPDIRS_AWARE,delete c[$]);let u=pkgPrNewCommitSha(e);u&&(c.VP_PR_VERSION=u);let{pinned:d,latest:f}=getInstallScriptUrls(e,n),p=d.length+f.length,m=2*p,h=``,g=0;async function tryUrls(e){for(let t=0;t<2;t+=1)for(let t of e){g+=1;try{let e=o(t,c,n);if(e===0)return!0;h=`exit code ${e}`}catch(e){h=e instanceof Error?e.message:String(e)}g0){if(await tryUrls(d)){ensureBinInPath();return}s(`setup-vp: could not fetch the install script pinned to Vite+ ${e}. Falling back to the latest install script. The latest script may not be compatible with ${e}.`)}if(await tryUrls(f)){ensureBinInPath();return}throw Error(`Failed to install Vite+ after ${m} attempts across ${p} URL(s): ${h}`)}finally{l&&removeVitePlusDirsFile(l)}}function parseBoolean(e){return e?.toLowerCase()===`true`}function parseAzureInputs(e){return{version:e.SETUP_VP_VERSION||``,versionFile:e.SETUP_VP_VERSION_FILE||void 0,nodeVersion:e.SETUP_VP_NODE_VERSION||void 0,nodeVersionFile:e.SETUP_VP_NODE_VERSION_FILE||void 0,workingDirectory:e.SETUP_VP_WORKING_DIRECTORY||`.`,runInstall:e.SETUP_VP_RUN_INSTALL??`true`,sfw:parseBoolean(e.SETUP_VP_SFW),nodeManager:parseNodeManager(e.SETUP_VP_NODE_MANAGER),packageManager:parsePackageManager(e.SETUP_VP_PACKAGE_MANAGER),registryUrl:e.SETUP_VP_REGISTRY_URL||``,scope:e.SETUP_VP_SCOPE||``,cache:parseBoolean(e.SETUP_VP_CACHE),cacheDependencyPath:e.SETUP_VP_CACHE_DEPENDENCY_PATH||``,workspaceRoot:e.SYSTEM_DEFAULTWORKINGDIRECTORY||process.cwd()}}function resolveProjectDirFromInputs(e){return resolveProjectDirectory({workingDirectory:e.workingDirectory,workspaceRoot:e.workspaceRoot})}const pt={installVitePlus,prepareCacheMetadata,configureAuth,setupSfw,parseRunInstall,runInstall,getCommandOutput,run,parseInstalledVpVersion,prependPath,setVariable,logWarning,logInfo};function fail(e){console.error(`setup-vp: ${e}`),process.exit(1)}async function runPrepare(e=process.env,t=pt){let n=parseAzureInputs(e),r=resolveProjectDirFromInputs(n);if(n.nodeManager===!1&&(n.nodeVersion||n.nodeVersionFile))throw Error(`node-version and node-version-file cannot be used with node-manager: false`);let i={...resolutionContext(n.workspaceRoot),info:t.logInfo,warning:t.logWarning},o=createVersionResolver(i).resolveVitePlusVersion(n,r),s=n.nodeVersion||(n.nodeVersionFile?createNodeVersionResolver(i).resolveNodeVersionFile(n.nodeVersionFile,r):void 0);t.setVariable(`SETUP_VP_CACHE_HIT`,`false`),t.setVariable(`SETUP_VP_CACHE_READY`,`false`),t.setVariable(`SETUP_VP_SFW_READY`,`false`),t.setVariable(`SETUP_VP_BOOTSTRAP_NODE`,process.execPath),await t.installVitePlus(o,{env:e,prependPath:e=>t.prependPath(e),exportPath:e=>t.setVariable(`PATH`,e),logWarningFn:t.logWarning}),t.setVariable(`SETUP_VP_RESOLVED_VERSION`,o);let c=(n.nodeManager===!1||n.packageManager!==void 0)&&t.getCommandOutput(`vp`,[`--version`])||``,l=packageManagerArgs(n.packageManager,c);n.nodeManager===!1?t.run(`vp`,nodeManagerOffArgs(c)):s&&t.run(`vp`,[`env`,`use`,s],{cwd:r});for(let e of l)t.run(`vp`,e);let u=p.resolve(process.argv[1]||``);if(t.setVariable(`SETUP_VP_RUNTIME_PATH`,u),n.sfw&&!pkgPrNewCommitSha(o)&&t.parseRunInstall(n.runInstall).length>0)try{let r=getSfwAssetName(process.platform,process.arch,isMuslLinux()),i=p.join(e.PIPELINE_WORKSPACE||n.workspaceRoot,`.setup-vp-sfw`);a(i,{recursive:!0}),t.setVariable(`SETUP_VP_SFW_CACHE_DIR`,i),t.setVariable(`SETUP_VP_SFW_CACHE_KEY`,`${Q}-${r}`),t.setVariable(`SETUP_VP_SFW_READY`,`true`)}catch(e){t.logWarning(String(e))}if(!n.cache)return;let d=t.prepareCacheMetadata({projectDir:r,cacheDependencyPath:n.cacheDependencyPath||void 0,logWarning:t.logWarning});if(!d.ready){t.setVariable(`SETUP_VP_CACHE_READY`,`false`);return}t.setVariable(`SETUP_VP_CACHE_READY`,`true`),d.cachePath&&t.setVariable(`SETUP_VP_CACHE_PATH`,d.cachePath),d.lockFile&&t.setVariable(`SETUP_VP_LOCK_FILE`,d.lockFile),d.lockType&&t.setVariable(`SETUP_VP_LOCK_TYPE`,d.lockType)}async function runFinalize(e=process.env,t=pt){let n=parseAzureInputs(e),r=resolveProjectDirFromInputs(n),i=analyzeProjectNpmrc(readNpmrc(p.join(r,`.npmrc`))).envVarRefs;i.add(`NODE_AUTH_TOKEN`);for(let t of i)!isReservedAuthVariable(t)&&/^\$\([^)]+\)$/.test(e[t]||``)&&delete e[t];t.configureAuth(n.registryUrl,n.scope,e,(e,n)=>{e!==`NODE_AUTH_TOKEN`&&n!==void 0&&t.setVariable(e,n,{isSecret:e!==`NPM_CONFIG_USERCONFIG`&&e!==`PNPM_CONFIG_USERCONFIG`})},r);let a=t.parseRunInstall(n.runInstall),o=await t.setupSfw(a,{env:e,sfwEnabled:n.sfw,vitePlusVersion:e.SETUP_VP_RESOLVED_VERSION||n.version,logWarning:t.logWarning,exportVariable:(e,n)=>{n!==void 0&&(e===`PATH`?t.prependPath(n.split(p.delimiter)[0]):t.setVariable(e,n))}});a.length>0&&await t.runInstall(a,r,o,e);let s=t.getCommandOutput(`vp`,[`--version`],{cwd:r});if(!s)throw Error(`Failed to verify Vite+ installation: vp --version failed or returned no output.`);t.logInfo(s);let c=t.parseInstalledVpVersion(s);t.setVariable(`SETUP_VP_INSTALLED_VERSION`,c),t.setVariable(`version`,c,{isOutput:!0}),t.setVariable(`cacheHit`,String(e.SETUP_VP_CACHE_HIT===`true`),{isOutput:!0})}async function main(e){if(e===`prepare`){await runPrepare();return}if(e===`finalize`){await runFinalize();return}fail(`invalid phase "${String(e)}"; expected "prepare" or "finalize"`)}function isEntrypoint(e=process.argv[1],t=import.meta.url){return!!(e&&t===b(p.resolve(e)).href)}if(isEntrypoint()){let e=process.argv[2];e||fail(`missing phase argument; expected "prepare" or "finalize"`);try{await main(e)}catch(e){fail(e instanceof Error?e.message:String(e))}}export{isEntrypoint,main,runFinalize,runPrepare}; \ No newline at end of file diff --git a/dist/gitlab/index.mjs b/dist/gitlab/index.mjs index 5785bd0..d924e79 100644 --- a/dist/gitlab/index.mjs +++ b/dist/gitlab/index.mjs @@ -1,14 +1,14 @@ -import{createRequire as e}from"node:module";import{copyFileSync as t,cpSync as n,createWriteStream as r,existsSync as i,lstatSync as a,mkdirSync as o,mkdtempSync as s,readFileSync as c,readdirSync as l,readlinkSync as u,rmSync as d,statSync as f,symlinkSync as p,writeFileSync as m}from"node:fs";import h,{basename as g,dirname as _,isAbsolute as v,join as y,relative as b,sep as x}from"node:path";import{pathToFileURL as S}from"node:url";import{spawn as C,spawnSync as w}from"node:child_process";import{homedir as T,tmpdir as E}from"node:os";import{setTimeout as ee}from"node:timers/promises";import{createHash as te,randomUUID as ne}from"node:crypto";import{chmod as re,mkdir as ie,mkdtemp as ae,rename as oe,rm as se,stat as ce}from"node:fs/promises";var __commonJSMin=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),D=/* @__PURE__ */ e(import.meta.url),O=/* @__PURE__ */ __commonJSMin((e=>{let t=Symbol.for(`yaml.alias`),n=Symbol.for(`yaml.document`),r=Symbol.for(`yaml.map`),i=Symbol.for(`yaml.pair`),a=Symbol.for(`yaml.scalar`),o=Symbol.for(`yaml.seq`),s=Symbol.for(`yaml.node.type`),isAlias=e=>!!e&&typeof e==`object`&&e[s]===t,isDocument=e=>!!e&&typeof e==`object`&&e[s]===n,isMap=e=>!!e&&typeof e==`object`&&e[s]===r,isPair=e=>!!e&&typeof e==`object`&&e[s]===i,isScalar=e=>!!e&&typeof e==`object`&&e[s]===a,isSeq=e=>!!e&&typeof e==`object`&&e[s]===o;function isCollection(e){if(e&&typeof e==`object`)switch(e[s]){case r:case o:return!0}return!1}function isNode(e){if(e&&typeof e==`object`)switch(e[s]){case t:case r:case a:case o:return!0}return!1}e.ALIAS=t,e.DOC=n,e.MAP=r,e.NODE_TYPE=s,e.PAIR=i,e.SCALAR=a,e.SEQ=o,e.hasAnchor=e=>(isScalar(e)||isCollection(e))&&!!e.anchor,e.isAlias=isAlias,e.isCollection=isCollection,e.isDocument=isDocument,e.isMap=isMap,e.isNode=isNode,e.isPair=isPair,e.isScalar=isScalar,e.isSeq=isSeq})),k=/* @__PURE__ */ __commonJSMin((e=>{var t=O();let n=Symbol(`break visit`),r=Symbol(`skip children`),i=Symbol(`remove node`);function visit(e,n){let r=initVisitor(n);t.isDocument(e)?visit_(null,e.contents,r,Object.freeze([e]))===i&&(e.contents=null):visit_(null,e,r,Object.freeze([]))}visit.BREAK=n,visit.SKIP=r,visit.REMOVE=i;function visit_(e,r,a,o){let s=callVisitor(e,r,a,o);if(t.isNode(s)||t.isPair(s))return replaceNode(e,o,s),visit_(e,s,a,o);if(typeof s!=`symbol`){if(t.isCollection(r)){o=Object.freeze(o.concat(r));for(let e=0;e{var t=O(),n=k();let r={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},escapeTagName=e=>e.replace(/[!,[\]{}]/g,e=>r[e]);var i=class Directives{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},Directives.defaultYaml,e),this.tags=Object.assign({},Directives.defaultTags,t)}clone(){let e=new Directives(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new Directives(this.yaml,this.tags);switch(this.yaml.version){case`1.1`:this.atNextDocument=!0;break;case`1.2`:this.atNextDocument=!1,this.yaml={explicit:Directives.defaultYaml.explicit,version:`1.2`},this.tags=Object.assign({},Directives.defaultTags)}return e}add(e,t){this.atNextDocument&&=(this.yaml={explicit:Directives.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},Directives.defaultTags),!1);let n=e.trim().split(/[ \t]+/),r=n.shift();switch(r){case`%TAG`:{if(n.length!==2&&(t(0,`%TAG directive should contain exactly two parts`),n.length<2))return!1;let[e,r]=n;return this.tags[e]=r,!0}case`%YAML`:{if(this.yaml.explicit=!0,n.length!==1)return t(0,`%YAML directive should contain exactly one part`),!1;let[e]=n;if(e===`1.1`||e===`1.2`)return this.yaml.version=e,!0;{let n=/^\d+\.\d+$/.test(e);return t(6,`Unsupported YAML version ${e}`,n),!1}}default:return t(0,`Unknown directive ${r}`,!0),!1}}tagName(e,t){if(e===`!`)return`!`;if(e[0]!==`!`)return t(`Not a valid tag: ${e}`),null;if(e[1]===`<`){let n=e.slice(2,-1);return n===`!`||n===`!!`?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==`>`&&t(`Verbatim tags must end with a >`),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return n===`!`?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+escapeTagName(e.substring(n.length));return e[0]===`!`?e:`!<${e}>`}toString(e){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],i=Object.entries(this.tags),a;if(e&&i.length>0&&t.isNode(e.contents)){let r={};n.visit(e.contents,(e,n)=>{t.isNode(n)&&n.tag&&(r[n.tag]=!0)}),a=Object.keys(r)}else a=[];for(let[t,n]of i)(t!==`!!`||n!==`tag:yaml.org,2002:`)&&(!e||a.some(e=>e.startsWith(n)))&&r.push(`%TAG ${t} ${n}`);return r.join(` -`)}};i.defaultYaml={explicit:!1,version:`1.2`},i.defaultTags={"!!":`tag:yaml.org,2002:`},e.Directives=i})),ue=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=k();function anchorIsValid(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function anchorNames(e){let t=/* @__PURE__ */ new Set;return n.visit(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function findNewAnchor(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function createNodeAnchors(e,n){let r=[],i=/* @__PURE__ */ new Map,a=null;return{onAnchor:t=>{r.push(t),a??=anchorNames(e);let i=findNewAnchor(n,a);return a.add(i),i},setAnchors:()=>{for(let e of r){let n=i.get(e);if(typeof n==`object`&&n.anchor&&(t.isScalar(n.node)||t.isCollection(n.node)))n.node.anchor=n.anchor;else{let t=/* @__PURE__ */ Error(`Failed to resolve repeated object (this should not happen)`);throw t.source=e,t}}},sourceObjects:i}}e.anchorIsValid=anchorIsValid,e.anchorNames=anchorNames,e.createNodeAnchors=createNodeAnchors,e.findNewAnchor=findNewAnchor})),de=/* @__PURE__ */ __commonJSMin((e=>{function applyReviver(e,t,n,r){if(r&&typeof r==`object`){if(Array.isArray(r))for(let t=0,n=r.length;t{var t=O();function toJS(e,n,r){if(Array.isArray(e))return e.map((e,t)=>toJS(e,String(t),r));if(e&&typeof e.toJSON==`function`){if(!r||!t.hasAnchor(e))return e.toJSON(n,r);let i={aliasCount:0,count:1,res:void 0};r.anchors.set(e,i),r.onCreate=e=>{i.res=e,delete r.onCreate};let a=e.toJSON(n,r);return r.onCreate&&r.onCreate(a),a}return typeof e==`bigint`&&!r?.keep?Number(e):e}e.toJS=toJS})),j=/* @__PURE__ */ __commonJSMin((e=>{var t=de(),n=O(),r=A();e.NodeBase=class{constructor(e){Object.defineProperty(this,n.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:i,maxAliasCount:a,onAnchor:o,reviver:s}={}){if(!n.isDocument(e))throw TypeError(`A document argument is required`);let c={anchors:/* @__PURE__ */ new Map,doc:e,keep:!0,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof a==`number`?a:100},l=r.toJS(this,``,c);if(typeof o==`function`)for(let{count:e,res:t}of c.anchors.values())o(t,e);return typeof s==`function`?t.applyReviver(s,{"":l},``,l):l}}})),M=/* @__PURE__ */ __commonJSMin((e=>{var t=ue(),n=k(),r=O(),i=j(),a=A(),Alias=class extends i.NodeBase{constructor(e){super(r.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let i;t?.aliasResolveCache?i=t.aliasResolveCache:(i=[],n.visit(e,{Node:(e,t)=>{(r.isAlias(t)||r.hasAnchor(t))&&i.push(t)}}),t&&(t.aliasResolveCache=i));let o;for(let e of i){if(e===this)break;e.anchor===this.source&&(o=e)}if(o&&t){let{anchors:e,doc:n,maxAliasCount:r}=t,i=e.get(o); +import{createRequire as e}from"node:module";import{accessSync as t,constants as n,copyFileSync as r,cpSync as i,createWriteStream as a,existsSync as o,lstatSync as s,mkdirSync as c,mkdtempSync as l,readFileSync as u,readdirSync as d,readlinkSync as f,realpathSync as p,rmSync as m,statSync as h,symlinkSync as g,writeFileSync as _}from"node:fs";import v,{basename as y,dirname as b,isAbsolute as x,join as S,relative as C,sep as w}from"node:path";import{pathToFileURL as T}from"node:url";import{spawn as E,spawnSync as D}from"node:child_process";import{homedir as ee,tmpdir as te}from"node:os";import{setTimeout as ne}from"node:timers/promises";import{createHash as re,randomUUID as ie}from"node:crypto";import{chmod as ae,mkdir as oe,mkdtemp as se,rename as ce,rm as le,stat as ue}from"node:fs/promises";var __commonJSMin=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),O=/* @__PURE__ */ e(import.meta.url),k=/* @__PURE__ */ __commonJSMin((e=>{let t=Symbol.for(`yaml.alias`),n=Symbol.for(`yaml.document`),r=Symbol.for(`yaml.map`),i=Symbol.for(`yaml.pair`),a=Symbol.for(`yaml.scalar`),o=Symbol.for(`yaml.seq`),s=Symbol.for(`yaml.node.type`),isAlias=e=>!!e&&typeof e==`object`&&e[s]===t,isDocument=e=>!!e&&typeof e==`object`&&e[s]===n,isMap=e=>!!e&&typeof e==`object`&&e[s]===r,isPair=e=>!!e&&typeof e==`object`&&e[s]===i,isScalar=e=>!!e&&typeof e==`object`&&e[s]===a,isSeq=e=>!!e&&typeof e==`object`&&e[s]===o;function isCollection(e){if(e&&typeof e==`object`)switch(e[s]){case r:case o:return!0}return!1}function isNode(e){if(e&&typeof e==`object`)switch(e[s]){case t:case r:case a:case o:return!0}return!1}e.ALIAS=t,e.DOC=n,e.MAP=r,e.NODE_TYPE=s,e.PAIR=i,e.SCALAR=a,e.SEQ=o,e.hasAnchor=e=>(isScalar(e)||isCollection(e))&&!!e.anchor,e.isAlias=isAlias,e.isCollection=isCollection,e.isDocument=isDocument,e.isMap=isMap,e.isNode=isNode,e.isPair=isPair,e.isScalar=isScalar,e.isSeq=isSeq})),A=/* @__PURE__ */ __commonJSMin((e=>{var t=k();let n=Symbol(`break visit`),r=Symbol(`skip children`),i=Symbol(`remove node`);function visit(e,n){let r=initVisitor(n);t.isDocument(e)?visit_(null,e.contents,r,Object.freeze([e]))===i&&(e.contents=null):visit_(null,e,r,Object.freeze([]))}visit.BREAK=n,visit.SKIP=r,visit.REMOVE=i;function visit_(e,r,a,o){let s=callVisitor(e,r,a,o);if(t.isNode(s)||t.isPair(s))return replaceNode(e,o,s),visit_(e,s,a,o);if(typeof s!=`symbol`){if(t.isCollection(r)){o=Object.freeze(o.concat(r));for(let e=0;e{var t=k(),n=A();let r={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},escapeTagName=e=>e.replace(/[!,[\]{}]/g,e=>r[e]);var i=class Directives{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},Directives.defaultYaml,e),this.tags=Object.assign({},Directives.defaultTags,t)}clone(){let e=new Directives(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new Directives(this.yaml,this.tags);switch(this.yaml.version){case`1.1`:this.atNextDocument=!0;break;case`1.2`:this.atNextDocument=!1,this.yaml={explicit:Directives.defaultYaml.explicit,version:`1.2`},this.tags=Object.assign({},Directives.defaultTags)}return e}add(e,t){this.atNextDocument&&=(this.yaml={explicit:Directives.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},Directives.defaultTags),!1);let n=e.trim().split(/[ \t]+/),r=n.shift();switch(r){case`%TAG`:{if(n.length!==2&&(t(0,`%TAG directive should contain exactly two parts`),n.length<2))return!1;let[e,r]=n;return this.tags[e]=r,!0}case`%YAML`:{if(this.yaml.explicit=!0,n.length!==1)return t(0,`%YAML directive should contain exactly one part`),!1;let[e]=n;if(e===`1.1`||e===`1.2`)return this.yaml.version=e,!0;{let n=/^\d+\.\d+$/.test(e);return t(6,`Unsupported YAML version ${e}`,n),!1}}default:return t(0,`Unknown directive ${r}`,!0),!1}}tagName(e,t){if(e===`!`)return`!`;if(e[0]!==`!`)return t(`Not a valid tag: ${e}`),null;if(e[1]===`<`){let n=e.slice(2,-1);return n===`!`||n===`!!`?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==`>`&&t(`Verbatim tags must end with a >`),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return n===`!`?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+escapeTagName(e.substring(n.length));return e[0]===`!`?e:`!<${e}>`}toString(e){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],i=Object.entries(this.tags),a;if(e&&i.length>0&&t.isNode(e.contents)){let r={};n.visit(e.contents,(e,n)=>{t.isNode(n)&&n.tag&&(r[n.tag]=!0)}),a=Object.keys(r)}else a=[];for(let[t,n]of i)(t!==`!!`||n!==`tag:yaml.org,2002:`)&&(!e||a.some(e=>e.startsWith(n)))&&r.push(`%TAG ${t} ${n}`);return r.join(` +`)}};i.defaultYaml={explicit:!1,version:`1.2`},i.defaultTags={"!!":`tag:yaml.org,2002:`},e.Directives=i})),fe=/* @__PURE__ */ __commonJSMin((e=>{var t=k(),n=A();function anchorIsValid(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function anchorNames(e){let t=/* @__PURE__ */ new Set;return n.visit(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function findNewAnchor(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function createNodeAnchors(e,n){let r=[],i=/* @__PURE__ */ new Map,a=null;return{onAnchor:t=>{r.push(t),a??=anchorNames(e);let i=findNewAnchor(n,a);return a.add(i),i},setAnchors:()=>{for(let e of r){let n=i.get(e);if(typeof n==`object`&&n.anchor&&(t.isScalar(n.node)||t.isCollection(n.node)))n.node.anchor=n.anchor;else{let t=/* @__PURE__ */ Error(`Failed to resolve repeated object (this should not happen)`);throw t.source=e,t}}},sourceObjects:i}}e.anchorIsValid=anchorIsValid,e.anchorNames=anchorNames,e.createNodeAnchors=createNodeAnchors,e.findNewAnchor=findNewAnchor})),pe=/* @__PURE__ */ __commonJSMin((e=>{function applyReviver(e,t,n,r){if(r&&typeof r==`object`){if(Array.isArray(r))for(let t=0,n=r.length;t{var t=k();function toJS(e,n,r){if(Array.isArray(e))return e.map((e,t)=>toJS(e,String(t),r));if(e&&typeof e.toJSON==`function`){if(!r||!t.hasAnchor(e))return e.toJSON(n,r);let i={aliasCount:0,count:1,res:void 0};r.anchors.set(e,i),r.onCreate=e=>{i.res=e,delete r.onCreate};let a=e.toJSON(n,r);return r.onCreate&&r.onCreate(a),a}return typeof e==`bigint`&&!r?.keep?Number(e):e}e.toJS=toJS})),me=/* @__PURE__ */ __commonJSMin((e=>{var t=pe(),n=k(),r=j();e.NodeBase=class{constructor(e){Object.defineProperty(this,n.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:i,maxAliasCount:a,onAnchor:o,reviver:s}={}){if(!n.isDocument(e))throw TypeError(`A document argument is required`);let c={anchors:/* @__PURE__ */ new Map,doc:e,keep:!0,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof a==`number`?a:100},l=r.toJS(this,``,c);if(typeof o==`function`)for(let{count:e,res:t}of c.anchors.values())o(t,e);return typeof s==`function`?t.applyReviver(s,{"":l},``,l):l}}})),M=/* @__PURE__ */ __commonJSMin((e=>{var t=fe(),n=A(),r=k(),i=me(),a=j(),Alias=class extends i.NodeBase{constructor(e){super(r.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let i;t?.aliasResolveCache?i=t.aliasResolveCache:(i=[],n.visit(e,{Node:(e,t)=>{(r.isAlias(t)||r.hasAnchor(t))&&i.push(t)}}),t&&(t.aliasResolveCache=i));let o;for(let e of i){if(e===this)break;e.anchor===this.source&&(o=e)}if(o&&t){let{anchors:e,doc:n,maxAliasCount:r}=t,i=e.get(o); /* istanbul ignore if */ -if(i||=(a.toJS(o,null,t),e.get(o)),i?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(r>=0&&(i.count+=1,i.aliasCount===0&&(i.aliasCount=getAliasCount(n,o,e)),i.count*i.aliasCount>r))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`)}return o}toJSON(e,t){if(!t)return{source:this.source};let n=this.resolve(t.doc,t);if(!n){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}return t.anchors.get(n).res}toString(e,n,r){let i=`*${this.source}`;if(e){if(t.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${i} `}return i}};function getAliasCount(e,t,n){if(r.isAlias(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(r.isCollection(t)){let r=0;for(let i of t.items){let t=getAliasCount(e,i,n);t>r&&(r=t)}return r}if(r.isPair(t)){let r=getAliasCount(e,t.key,n),i=getAliasCount(e,t.value,n);return Math.max(r,i)}return 1}e.Alias=Alias})),N=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=j(),r=A();let isScalarValue=e=>!e||typeof e!=`function`&&typeof e!=`object`;var Scalar=class extends n.NodeBase{constructor(e){super(t.SCALAR),this.value=e}toJSON(e,t){return t?.keep?this.value:r.toJS(this.value,e,t)}toString(){return String(this.value)}};Scalar.BLOCK_FOLDED=`BLOCK_FOLDED`,Scalar.BLOCK_LITERAL=`BLOCK_LITERAL`,Scalar.PLAIN=`PLAIN`,Scalar.QUOTE_DOUBLE=`QUOTE_DOUBLE`,Scalar.QUOTE_SINGLE=`QUOTE_SINGLE`,e.Scalar=Scalar,e.isScalarValue=isScalarValue})),P=/* @__PURE__ */ __commonJSMin((e=>{var t=M(),n=O(),r=N();function findTagObject(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function createNode(e,i,a){if(n.isDocument(e)&&(e=e.contents),n.isNode(e))return e;if(n.isPair(e)){let t=a.schema[n.MAP].createNode?.(a.schema,null,a);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:o,onAnchor:s,onTagObj:c,schema:l,sourceObjects:u}=a,d;if(o&&e&&typeof e==`object`){if(d=u.get(e),d)return d.anchor??(d.anchor=s(e)),new t.Alias(d.anchor);d={anchor:null,node:null},u.set(e,d)}i?.startsWith(`!!`)&&(i=`tag:yaml.org,2002:`+i.slice(2));let f=findTagObject(e,i,l.tags);if(!f){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new r.Scalar(e);return d&&(d.node=t),t}f=e instanceof Map?l[n.MAP]:Symbol.iterator in Object(e)?l[n.SEQ]:l[n.MAP]}c&&(c(f),delete a.onTagObj);let p=f?.createNode?f.createNode(a.schema,e,a):typeof f?.nodeClass?.from==`function`?f.nodeClass.from(a.schema,e,a):new r.Scalar(e);return i?p.tag=i:f.default||(p.tag=f.tag),d&&(d.node=p),p}e.createNode=createNode})),fe=/* @__PURE__ */ __commonJSMin((e=>{var t=P(),n=O(),r=j();function collectionFromPath(e,n,r){let i=r;for(let e=n.length-1;e>=0;--e){let t=n[e];if(typeof t==`number`&&Number.isInteger(t)&&t>=0){let e=[];e[t]=i,i=e}else i=/* @__PURE__ */ new Map([[t,i]])}return t.createNode(i,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:/* @__PURE__ */ new Map})}let isEmptyPath=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done;e.Collection=class extends r.NodeBase{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>n.isNode(t)||n.isPair(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(isEmptyPath(e))this.add(t);else{let[r,...i]=e,a=this.get(r,!0);if(n.isCollection(a))a.addIn(i,t);else if(a===void 0&&this.schema)this.set(r,collectionFromPath(this.schema,i,t));else throw Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}deleteIn(e){let[t,...r]=e;if(r.length===0)return this.delete(t);let i=this.get(t,!0);if(n.isCollection(i))return i.deleteIn(r);throw Error(`Expected YAML collection at ${t}. Remaining path: ${r}`)}getIn(e,t){let[r,...i]=e,a=this.get(r,!0);return i.length===0?!t&&n.isScalar(a)?a.value:a:n.isCollection(a)?a.getIn(i,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!n.isPair(t))return!1;let r=t.value;return r==null||e&&n.isScalar(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(e){let[t,...r]=e;if(r.length===0)return this.has(t);let i=this.get(t,!0);return n.isCollection(i)?i.hasIn(r):!1}setIn(e,t){let[r,...i]=e;if(i.length===0)this.set(r,t);else{let e=this.get(r,!0);if(n.isCollection(e))e.setIn(i,t);else if(e===void 0&&this.schema)this.set(r,collectionFromPath(this.schema,i,t));else throw Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}},e.collectionFromPath=collectionFromPath,e.isEmptyPath=isEmptyPath})),F=/* @__PURE__ */ __commonJSMin((e=>{let stringifyComment=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function indentComment(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}e.indentComment=indentComment,e.lineComment=(e,t,n)=>e.endsWith(` +if(i||=(a.toJS(o,null,t),e.get(o)),i?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(r>=0&&(i.count+=1,i.aliasCount===0&&(i.aliasCount=getAliasCount(n,o,e)),i.count*i.aliasCount>r))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`)}return o}toJSON(e,t){if(!t)return{source:this.source};let n=this.resolve(t.doc,t);if(!n){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}return t.anchors.get(n).res}toString(e,n,r){let i=`*${this.source}`;if(e){if(t.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${i} `}return i}};function getAliasCount(e,t,n){if(r.isAlias(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(r.isCollection(t)){let r=0;for(let i of t.items){let t=getAliasCount(e,i,n);t>r&&(r=t)}return r}if(r.isPair(t)){let r=getAliasCount(e,t.key,n),i=getAliasCount(e,t.value,n);return Math.max(r,i)}return 1}e.Alias=Alias})),N=/* @__PURE__ */ __commonJSMin((e=>{var t=k(),n=me(),r=j();let isScalarValue=e=>!e||typeof e!=`function`&&typeof e!=`object`;var Scalar=class extends n.NodeBase{constructor(e){super(t.SCALAR),this.value=e}toJSON(e,t){return t?.keep?this.value:r.toJS(this.value,e,t)}toString(){return String(this.value)}};Scalar.BLOCK_FOLDED=`BLOCK_FOLDED`,Scalar.BLOCK_LITERAL=`BLOCK_LITERAL`,Scalar.PLAIN=`PLAIN`,Scalar.QUOTE_DOUBLE=`QUOTE_DOUBLE`,Scalar.QUOTE_SINGLE=`QUOTE_SINGLE`,e.Scalar=Scalar,e.isScalarValue=isScalarValue})),P=/* @__PURE__ */ __commonJSMin((e=>{var t=M(),n=k(),r=N();function findTagObject(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function createNode(e,i,a){if(n.isDocument(e)&&(e=e.contents),n.isNode(e))return e;if(n.isPair(e)){let t=a.schema[n.MAP].createNode?.(a.schema,null,a);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:o,onAnchor:s,onTagObj:c,schema:l,sourceObjects:u}=a,d;if(o&&e&&typeof e==`object`){if(d=u.get(e),d)return d.anchor??(d.anchor=s(e)),new t.Alias(d.anchor);d={anchor:null,node:null},u.set(e,d)}i?.startsWith(`!!`)&&(i=`tag:yaml.org,2002:`+i.slice(2));let f=findTagObject(e,i,l.tags);if(!f){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new r.Scalar(e);return d&&(d.node=t),t}f=e instanceof Map?l[n.MAP]:Symbol.iterator in Object(e)?l[n.SEQ]:l[n.MAP]}c&&(c(f),delete a.onTagObj);let p=f?.createNode?f.createNode(a.schema,e,a):typeof f?.nodeClass?.from==`function`?f.nodeClass.from(a.schema,e,a):new r.Scalar(e);return i?p.tag=i:f.default||(p.tag=f.tag),d&&(d.node=p),p}e.createNode=createNode})),he=/* @__PURE__ */ __commonJSMin((e=>{var t=P(),n=k(),r=me();function collectionFromPath(e,n,r){let i=r;for(let e=n.length-1;e>=0;--e){let t=n[e];if(typeof t==`number`&&Number.isInteger(t)&&t>=0){let e=[];e[t]=i,i=e}else i=/* @__PURE__ */ new Map([[t,i]])}return t.createNode(i,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:/* @__PURE__ */ new Map})}let isEmptyPath=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done;e.Collection=class extends r.NodeBase{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>n.isNode(t)||n.isPair(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(isEmptyPath(e))this.add(t);else{let[r,...i]=e,a=this.get(r,!0);if(n.isCollection(a))a.addIn(i,t);else if(a===void 0&&this.schema)this.set(r,collectionFromPath(this.schema,i,t));else throw Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}deleteIn(e){let[t,...r]=e;if(r.length===0)return this.delete(t);let i=this.get(t,!0);if(n.isCollection(i))return i.deleteIn(r);throw Error(`Expected YAML collection at ${t}. Remaining path: ${r}`)}getIn(e,t){let[r,...i]=e,a=this.get(r,!0);return i.length===0?!t&&n.isScalar(a)?a.value:a:n.isCollection(a)?a.getIn(i,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!n.isPair(t))return!1;let r=t.value;return r==null||e&&n.isScalar(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(e){let[t,...r]=e;if(r.length===0)return this.has(t);let i=this.get(t,!0);return n.isCollection(i)?i.hasIn(r):!1}setIn(e,t){let[r,...i]=e;if(i.length===0)this.set(r,t);else{let e=this.get(r,!0);if(n.isCollection(e))e.setIn(i,t);else if(e===void 0&&this.schema)this.set(r,collectionFromPath(this.schema,i,t));else throw Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}},e.collectionFromPath=collectionFromPath,e.isEmptyPath=isEmptyPath})),F=/* @__PURE__ */ __commonJSMin((e=>{let stringifyComment=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function indentComment(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}e.indentComment=indentComment,e.lineComment=(e,t,n)=>e.endsWith(` `)?indentComment(n,t):n.includes(` `)?` -`+indentComment(n,t):(e.endsWith(` `)?``:` `)+n,e.stringifyComment=stringifyComment})),pe=/* @__PURE__ */ __commonJSMin((e=>{let t=`block`,n=`quoted`;function foldFlowLines(e,r,i=`flow`,{indentAtStart:a,lineWidth:o=80,minContentWidth:s=20,onFold:c,onOverflow:l}={}){if(!o||o<0)return e;oo-Math.max(2,s)?d.push(0):p=o-a);let m,h,g=!1,_=-1,v=-1,y=-1;i===t&&(_=consumeMoreIndentedLines(e,_,r.length),_!==-1&&(p=_+u));for(let a;a=e[_+=1];){if(i===n&&a===`\\`){switch(v=_,e[_+1]){case`x`:_+=3;break;case`u`:_+=5;break;case`U`:_+=9;break;default:_+=1}y=_}if(a===` +`+indentComment(n,t):(e.endsWith(` `)?``:` `)+n,e.stringifyComment=stringifyComment})),ge=/* @__PURE__ */ __commonJSMin((e=>{let t=`block`,n=`quoted`;function foldFlowLines(e,r,i=`flow`,{indentAtStart:a,lineWidth:o=80,minContentWidth:s=20,onFold:c,onOverflow:l}={}){if(!o||o<0)return e;oo-Math.max(2,s)?d.push(0):p=o-a);let m,h,g=!1,_=-1,v=-1,y=-1;i===t&&(_=consumeMoreIndentedLines(e,_,r.length),_!==-1&&(p=_+u));for(let a;a=e[_+=1];){if(i===n&&a===`\\`){switch(v=_,e[_+1]){case`x`:_+=3;break;case`u`:_+=5;break;case`U`:_+=9;break;default:_+=1}y=_}if(a===` `)i===t&&(_=consumeMoreIndentedLines(e,_,r.length)),p=_+r.length+u,m=void 0;else{if(a===` `&&h&&h!==` `&&h!==` `&&h!==` `){let t=e[_+1];t&&t!==` `&&t!==` `&&t!==` `&&(m=_)}if(_>=p){if(m)d.push(m),p=m+u,m=void 0;else if(i===n){for(;h===` `||h===` `;)h=a,a=e[_+=1],g=!0;let t=_>y+1?_-2:v-1;if(f[t])return e;d.push(t),f[t]=!0,p=t+u,m=void 0}else g=!0}}h=a}if(g&&l&&l(),d.length===0)return e;c&&c();let b=e.slice(0,d[0]);for(let t=0;t{var t=N(),n=pe();let getFoldOptions=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),containsDocumentMarker=e=>/^(%|---|\.\.\.)/m.test(e);function lineLengthOverLimit(e,t,n){if(!t||t<0)return!1;let r=t-n,i=e.length;if(i<=r)return!1;for(let t=0,n=0;t{var t=N(),n=ge();let getFoldOptions=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),containsDocumentMarker=e=>/^(%|---|\.\.\.)/m.test(e);function lineLengthOverLimit(e,t,n){if(!t||t<0)return!1;let r=t-n,i=e.length;if(i<=r)return!1;for(let t=0,n=0;tr)return!0;if(n=t+1,i-n<=r)return!1}return!0}function doubleQuotedString(e,t){let r=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return r;let{implicitKey:i}=t,a=t.options.doubleQuotedMinMultiLineLength,o=t.indent||(containsDocumentMarker(e)?` `:``),s=``,c=0;for(let e=0,t=r[e];t;t=r[++e])if(t===` `&&r[e+1]===`\\`&&r[e+2]===`n`&&(s+=r.slice(c,e)+`\\ `,e+=1,c=e,t=`\\`),t===`\\`)switch(r[e+1]){case`u`:{s+=r.slice(c,e);let t=r.substr(e+2,4);switch(t){case`0000`:s+=`\\0`;break;case`0007`:s+=`\\a`;break;case`000b`:s+=`\\v`;break;case`001b`:s+=`\\e`;break;case`0085`:s+=`\\N`;break;case`00a0`:s+=`\\_`;break;case`2028`:s+=`\\L`;break;case`2029`:s+=`\\P`;break;default:t.substr(0,2)===`00`?s+=`\\x`+t.substr(2):s+=r.substr(e,6)}e+=5,c=e+1}break;case`n`:if(i||r[e+2]===`"`||r.length{r=!0});let c=n.foldFlowLines(`${x}${e}${g}`,f,n.FOLD_BLOCK,s);if(!r)return`>${S}\n${f}${c}`}return a=a.replace(/\n+/g,`$&${f}`),`|${S}\n${f}${x}${a}${g}`}function plainString(e,r,i,a){let{type:o,value:s}=e,{actualString:c,implicitKey:l,indent:u,indentStep:d,inFlow:f}=r;if(l&&s.includes(` `)||f&&/[[\]{},]/.test(s))return quotedString(s,r);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(s))return l||f||!s.includes(` `)?quotedString(s,r):blockString(e,r,i,a);if(!l&&!f&&o!==t.Scalar.PLAIN&&s.includes(` -`))return blockString(e,r,i,a);if(containsDocumentMarker(s)){if(u===``)return r.forceBlockIndent=!0,blockString(e,r,i,a);if(l&&u===d)return quotedString(s,r)}let p=s.replace(/\n+/g,`$&\n${u}`);if(c){let test=e=>e.default&&e.tag!==`tag:yaml.org,2002:str`&&e.test?.test(p),{compat:e,tags:t}=r.doc.schema;if(t.some(test)||e?.some(test))return quotedString(s,r)}return l?p:n.foldFlowLines(p,u,n.FOLD_FLOW,getFoldOptions(r,!1))}function stringifyString(e,n,r,i){let{implicitKey:a,inFlow:o}=n,s=typeof e.value==`string`?e:Object.assign({},e,{value:String(e.value)}),{type:c}=e;c!==t.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(c=t.Scalar.QUOTE_DOUBLE);let _stringify=e=>{switch(e){case t.Scalar.BLOCK_FOLDED:case t.Scalar.BLOCK_LITERAL:return a||o?quotedString(s.value,n):blockString(s,n,r,i);case t.Scalar.QUOTE_DOUBLE:return doubleQuotedString(s.value,n);case t.Scalar.QUOTE_SINGLE:return singleQuotedString(s.value,n);case t.Scalar.PLAIN:return plainString(s,n,r,i);default:return null}},l=_stringify(c);if(l===null){let{defaultKeyType:e,defaultStringType:t}=n.options,r=a&&e||t;if(l=_stringify(r),l===null)throw Error(`Unsupported default string type ${r}`)}return l}e.stringifyString=stringifyString})),L=/* @__PURE__ */ __commonJSMin((e=>{var t=ue(),n=O(),r=F(),i=I();function createStringifyContext(e,t){let n=Object.assign({blockQuote:!0,commentString:r.stringifyComment,defaultKeyType:null,defaultStringType:`PLAIN`,directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:`false`,flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:`null`,simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:`true`,verifyAliasOrder:!0},e.schema.toStringOptions,t),i;switch(n.collectionStyle){case`block`:i=!1;break;case`flow`:i=!0;break;default:i=null}return{anchors:/* @__PURE__ */ new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?` `:``,indent:``,indentStep:typeof n.indent==`number`?` `.repeat(n.indent):` `,inFlow:i,options:n}}function getTagObject(e,t){if(t.tag){let n=e.filter(e=>e.tag===t.tag);if(n.length>0)return n.find(e=>e.format===t.format)??n[0]}let r,i;if(n.isScalar(t)){i=t.value;let n=e.filter(e=>e.identify?.(i));if(n.length>1){let e=n.filter(e=>e.test);e.length>0&&(n=e)}r=n.find(e=>e.format===t.format)??n.find(e=>!e.format)}else i=t,r=e.find(e=>e.nodeClass&&i instanceof e.nodeClass);if(!r){let e=i?.constructor?.name??(i===null?`null`:typeof i);throw Error(`Tag not resolved for ${e} value`)}return r}function stringifyProps(e,r,{anchors:i,doc:a}){if(!a.directives)return``;let o=[],s=(n.isScalar(e)||n.isCollection(e))&&e.anchor;s&&t.anchorIsValid(s)&&(i.add(s),o.push(`&${s}`));let c=e.tag??(r.default?null:r.tag);return c&&o.push(a.directives.tagString(c)),o.join(` `)}function stringify(e,t,r,a){if(n.isPair(e))return e.toString(t,r,a);if(n.isAlias(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw TypeError(`Cannot stringify circular structure without alias nodes`);t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=/* @__PURE__ */ new Set([e]),e=e.resolve(t.doc)}let o,s=n.isNode(e)?e:t.doc.createNode(e,{onTagObj:e=>o=e});o??=getTagObject(t.doc.schema.tags,s);let c=stringifyProps(s,o,t);c.length>0&&(t.indentAtStart=(t.indentAtStart??0)+c.length+1);let l=typeof o.stringify==`function`?o.stringify(s,t,r,a):n.isScalar(s)?i.stringifyString(s,t,r,a):s.toString(t,r,a);return c?n.isScalar(s)||l[0]===`{`||l[0]===`[`?`${c} ${l}`:`${c}\n${t.indent}${l}`:l}e.createStringifyContext=createStringifyContext,e.stringify=stringify})),me=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=N(),r=L(),i=F();function stringifyPair({key:e,value:a},o,s,c){let{allNullValues:l,doc:u,indent:d,indentStep:f,options:{commentString:p,indentSeq:m,simpleKeys:h}}=o,g=t.isNode(e)&&e.comment||null;if(h){if(g)throw Error(`With simple keys, key nodes cannot have comments`);if(t.isCollection(e)||!t.isNode(e)&&typeof e==`object`)throw Error(`With simple keys, collection cannot be used as a key value`)}let _=!h&&(!e||g&&a==null&&!o.inFlow||t.isCollection(e)||(t.isScalar(e)?e.type===n.Scalar.BLOCK_FOLDED||e.type===n.Scalar.BLOCK_LITERAL:typeof e==`object`));o=Object.assign({},o,{allNullValues:!1,implicitKey:!_&&(h||!l),indent:d+f});let v=!1,y=!1,b=r.stringify(e,o,()=>v=!0,()=>y=!0);if(!_&&!o.inFlow&&b.length>1024){if(h)throw Error(`With simple keys, single line scalar must not span more than 1024 characters`);_=!0}if(o.inFlow){if(l||a==null)return v&&s&&s(),b===``?`?`:_?`? ${b}`:b}else if(l&&!h||a==null&&_)return b=`? ${b}`,g&&!v?b+=i.lineComment(b,o.indent,p(g)):y&&c&&c(),b;v&&(g=null),_?(g&&(b+=i.lineComment(b,o.indent,p(g))),b=`? ${b}\n${d}:`):(b=`${b}:`,g&&(b+=i.lineComment(b,o.indent,p(g))));let x,S,C;t.isNode(a)?(x=!!a.spaceBefore,S=a.commentBefore,C=a.comment):(x=!1,S=null,C=null,a&&typeof a==`object`&&(a=u.createNode(a))),o.implicitKey=!1,!_&&!g&&t.isScalar(a)&&(o.indentAtStart=b.length+1),y=!1,!m&&f.length>=2&&!o.inFlow&&!_&&t.isSeq(a)&&!a.flow&&!a.tag&&!a.anchor&&(o.indent=o.indent.substring(2));let w=!1,T=r.stringify(a,o,()=>w=!0,()=>y=!0),E=` `;if(g||x||S){if(E=x?` +`))return blockString(e,r,i,a);if(containsDocumentMarker(s)){if(u===``)return r.forceBlockIndent=!0,blockString(e,r,i,a);if(l&&u===d)return quotedString(s,r)}let p=s.replace(/\n+/g,`$&\n${u}`);if(c){let test=e=>e.default&&e.tag!==`tag:yaml.org,2002:str`&&e.test?.test(p),{compat:e,tags:t}=r.doc.schema;if(t.some(test)||e?.some(test))return quotedString(s,r)}return l?p:n.foldFlowLines(p,u,n.FOLD_FLOW,getFoldOptions(r,!1))}function stringifyString(e,n,r,i){let{implicitKey:a,inFlow:o}=n,s=typeof e.value==`string`?e:Object.assign({},e,{value:String(e.value)}),{type:c}=e;c!==t.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(c=t.Scalar.QUOTE_DOUBLE);let _stringify=e=>{switch(e){case t.Scalar.BLOCK_FOLDED:case t.Scalar.BLOCK_LITERAL:return a||o?quotedString(s.value,n):blockString(s,n,r,i);case t.Scalar.QUOTE_DOUBLE:return doubleQuotedString(s.value,n);case t.Scalar.QUOTE_SINGLE:return singleQuotedString(s.value,n);case t.Scalar.PLAIN:return plainString(s,n,r,i);default:return null}},l=_stringify(c);if(l===null){let{defaultKeyType:e,defaultStringType:t}=n.options,r=a&&e||t;if(l=_stringify(r),l===null)throw Error(`Unsupported default string type ${r}`)}return l}e.stringifyString=stringifyString})),L=/* @__PURE__ */ __commonJSMin((e=>{var t=fe(),n=k(),r=F(),i=I();function createStringifyContext(e,t){let n=Object.assign({blockQuote:!0,commentString:r.stringifyComment,defaultKeyType:null,defaultStringType:`PLAIN`,directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:`false`,flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:`null`,simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:`true`,verifyAliasOrder:!0},e.schema.toStringOptions,t),i;switch(n.collectionStyle){case`block`:i=!1;break;case`flow`:i=!0;break;default:i=null}return{anchors:/* @__PURE__ */ new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?` `:``,indent:``,indentStep:typeof n.indent==`number`?` `.repeat(n.indent):` `,inFlow:i,options:n}}function getTagObject(e,t){if(t.tag){let n=e.filter(e=>e.tag===t.tag);if(n.length>0)return n.find(e=>e.format===t.format)??n[0]}let r,i;if(n.isScalar(t)){i=t.value;let n=e.filter(e=>e.identify?.(i));if(n.length>1){let e=n.filter(e=>e.test);e.length>0&&(n=e)}r=n.find(e=>e.format===t.format)??n.find(e=>!e.format)}else i=t,r=e.find(e=>e.nodeClass&&i instanceof e.nodeClass);if(!r){let e=i?.constructor?.name??(i===null?`null`:typeof i);throw Error(`Tag not resolved for ${e} value`)}return r}function stringifyProps(e,r,{anchors:i,doc:a}){if(!a.directives)return``;let o=[],s=(n.isScalar(e)||n.isCollection(e))&&e.anchor;s&&t.anchorIsValid(s)&&(i.add(s),o.push(`&${s}`));let c=e.tag??(r.default?null:r.tag);return c&&o.push(a.directives.tagString(c)),o.join(` `)}function stringify(e,t,r,a){if(n.isPair(e))return e.toString(t,r,a);if(n.isAlias(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw TypeError(`Cannot stringify circular structure without alias nodes`);t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=/* @__PURE__ */ new Set([e]),e=e.resolve(t.doc)}let o,s=n.isNode(e)?e:t.doc.createNode(e,{onTagObj:e=>o=e});o??=getTagObject(t.doc.schema.tags,s);let c=stringifyProps(s,o,t);c.length>0&&(t.indentAtStart=(t.indentAtStart??0)+c.length+1);let l=typeof o.stringify==`function`?o.stringify(s,t,r,a):n.isScalar(s)?i.stringifyString(s,t,r,a):s.toString(t,r,a);return c?n.isScalar(s)||l[0]===`{`||l[0]===`[`?`${c} ${l}`:`${c}\n${t.indent}${l}`:l}e.createStringifyContext=createStringifyContext,e.stringify=stringify})),_e=/* @__PURE__ */ __commonJSMin((e=>{var t=k(),n=N(),r=L(),i=F();function stringifyPair({key:e,value:a},o,s,c){let{allNullValues:l,doc:u,indent:d,indentStep:f,options:{commentString:p,indentSeq:m,simpleKeys:h}}=o,g=t.isNode(e)&&e.comment||null;if(h){if(g)throw Error(`With simple keys, key nodes cannot have comments`);if(t.isCollection(e)||!t.isNode(e)&&typeof e==`object`)throw Error(`With simple keys, collection cannot be used as a key value`)}let _=!h&&(!e||g&&a==null&&!o.inFlow||t.isCollection(e)||(t.isScalar(e)?e.type===n.Scalar.BLOCK_FOLDED||e.type===n.Scalar.BLOCK_LITERAL:typeof e==`object`));o=Object.assign({},o,{allNullValues:!1,implicitKey:!_&&(h||!l),indent:d+f});let v=!1,y=!1,b=r.stringify(e,o,()=>v=!0,()=>y=!0);if(!_&&!o.inFlow&&b.length>1024){if(h)throw Error(`With simple keys, single line scalar must not span more than 1024 characters`);_=!0}if(o.inFlow){if(l||a==null)return v&&s&&s(),b===``?`?`:_?`? ${b}`:b}else if(l&&!h||a==null&&_)return b=`? ${b}`,g&&!v?b+=i.lineComment(b,o.indent,p(g)):y&&c&&c(),b;v&&(g=null),_?(g&&(b+=i.lineComment(b,o.indent,p(g))),b=`? ${b}\n${d}:`):(b=`${b}:`,g&&(b+=i.lineComment(b,o.indent,p(g))));let x,S,C;t.isNode(a)?(x=!!a.spaceBefore,S=a.commentBefore,C=a.comment):(x=!1,S=null,C=null,a&&typeof a==`object`&&(a=u.createNode(a))),o.implicitKey=!1,!_&&!g&&t.isScalar(a)&&(o.indentAtStart=b.length+1),y=!1,!m&&f.length>=2&&!o.inFlow&&!_&&t.isSeq(a)&&!a.flow&&!a.tag&&!a.anchor&&(o.indent=o.indent.substring(2));let w=!1,T=r.stringify(a,o,()=>w=!0,()=>y=!0),E=` `;if(g||x||S){if(E=x?` `:``,S){let e=p(S);E+=`\n${i.indentComment(e,o.indent)}`}T===``&&!o.inFlow?E===` `&&C&&(E=` `):E+=`\n${o.indent}`}else if(!_&&t.isCollection(a)){let e=T[0],t=T.indexOf(` `),n=t!==-1,r=o.inFlow??a.flow??a.items.length===0;if(n||!r){let r=!1;if(n&&(e===`&`||e===`!`)){let n=T.indexOf(` `);e===`&`&&n!==-1&&n{var t=D(`process`);function debug(e,...t){e===`debug`&&console.log(...t)}function warn(e,n){(e===`debug`||e===`warn`)&&(typeof t.emitWarning==`function`?t.emitWarning(n):console.warn(n))}e.debug=debug,e.warn=warn})),ge=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=N();let r={identify:e=>e===`<<`||typeof e==`symbol`&&e.description===`<<`,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new n.Scalar(Symbol(`<<`)),{addToJSMap:addMergeToJSMap}),stringify:()=>`<<`},isMergeKey=(e,i)=>(r.identify(i)||t.isScalar(i)&&(!i.type||i.type===n.Scalar.PLAIN)&&r.identify(i.value))&&e?.doc.schema.tags.some(e=>e.tag===r.tag&&e.default);function addMergeToJSMap(e,n,r){let i=resolveAliasValue(e,r);if(t.isSeq(i))for(let t of i.items)mergeValue(e,n,t);else if(Array.isArray(i))for(let t of i)mergeValue(e,n,t);else mergeValue(e,n,i)}function mergeValue(e,n,r){let i=resolveAliasValue(e,r);if(!t.isMap(i))throw Error(`Merge sources must be maps or map aliases`);let a=i.toJSON(null,e,Map);for(let[e,t]of a)n instanceof Map?n.has(e)||n.set(e,t):n instanceof Set?n.add(e):Object.prototype.hasOwnProperty.call(n,e)||Object.defineProperty(n,e,{value:t,writable:!0,enumerable:!0,configurable:!0});return n}function resolveAliasValue(e,n){return e&&t.isAlias(n)?n.resolve(e.doc,e):n}e.addMergeToJSMap=addMergeToJSMap,e.isMergeKey=isMergeKey,e.merge=r})),_e=/* @__PURE__ */ __commonJSMin((e=>{var t=he(),n=ge(),r=L(),i=O(),a=A();function addPairToJSMap(e,t,{key:r,value:o}){if(i.isNode(r)&&r.addToJSMap)r.addToJSMap(e,t,o);else if(n.isMergeKey(e,r))n.addMergeToJSMap(e,t,o);else{let n=a.toJS(r,``,e);if(t instanceof Map)t.set(n,a.toJS(o,n,e));else if(t instanceof Set)t.add(n);else{let i=stringifyKey(r,n,e),s=a.toJS(o,i,e);i in t?Object.defineProperty(t,i,{value:s,writable:!0,enumerable:!0,configurable:!0}):t[i]=s}}return t}function stringifyKey(e,n,a){if(n===null)return``;if(typeof n!=`object`)return String(n);if(i.isNode(e)&&a?.doc){let n=r.createStringifyContext(a.doc,{});n.anchors=/* @__PURE__ */ new Set;for(let e of a.anchors.keys())n.anchors.add(e.anchor);n.inFlow=!0,n.inStringifyKey=!0;let i=e.toString(n);if(!a.mapKeyWarned){let e=JSON.stringify(i);e.length>40&&(e=e.substring(0,36)+`..."`),t.warn(a.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${e}. Set mapAsMap: true to use object keys.`),a.mapKeyWarned=!0}return i}return JSON.stringify(n)}e.addPairToJSMap=addPairToJSMap})),R=/* @__PURE__ */ __commonJSMin((e=>{var t=P(),n=me(),r=_e(),i=O();function createPair(e,n,r){return new a(t.createNode(e,void 0,r),t.createNode(n,void 0,r))}var a=class Pair{constructor(e,t=null){Object.defineProperty(this,i.NODE_TYPE,{value:i.PAIR}),this.key=e,this.value=t}clone(e){let{key:t,value:n}=this;return i.isNode(t)&&(t=t.clone(e)),i.isNode(n)&&(n=n.clone(e)),new Pair(t,n)}toJSON(e,t){let n=t?.mapAsMap?/* @__PURE__ */ new Map:{};return r.addPairToJSMap(t,n,this)}toString(e,t,r){return e?.doc?n.stringifyPair(this,e,t,r):JSON.stringify(this)}};e.Pair=a,e.createPair=createPair})),ve=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=L(),r=F();function stringifyCollection(e,t,n){return(t.inFlow??e.flow?stringifyFlowCollection:stringifyBlockCollection)(e,t,n)}function stringifyBlockCollection({comment:e,items:i},a,{blockItemPrefix:o,flowChars:s,itemIndent:c,onChompKeep:l,onComment:u}){let{indent:d,options:{commentString:f}}=a,p=Object.assign({},a,{indent:c,type:null}),m=!1,h=[];for(let e=0;el=null,()=>m=!0);l&&(u+=r.lineComment(u,c,f(l))),m&&l&&(m=!1),h.push(o+u)}let g;if(h.length===0)g=s.start+s.end;else{g=h[0];for(let e=1;e{var t=O(`process`);function debug(e,...t){e===`debug`&&console.log(...t)}function warn(e,n){(e===`debug`||e===`warn`)&&(typeof t.emitWarning==`function`?t.emitWarning(n):console.warn(n))}e.debug=debug,e.warn=warn})),ye=/* @__PURE__ */ __commonJSMin((e=>{var t=k(),n=N();let r={identify:e=>e===`<<`||typeof e==`symbol`&&e.description===`<<`,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new n.Scalar(Symbol(`<<`)),{addToJSMap:addMergeToJSMap}),stringify:()=>`<<`},isMergeKey=(e,i)=>(r.identify(i)||t.isScalar(i)&&(!i.type||i.type===n.Scalar.PLAIN)&&r.identify(i.value))&&e?.doc.schema.tags.some(e=>e.tag===r.tag&&e.default);function addMergeToJSMap(e,n,r){let i=resolveAliasValue(e,r);if(t.isSeq(i))for(let t of i.items)mergeValue(e,n,t);else if(Array.isArray(i))for(let t of i)mergeValue(e,n,t);else mergeValue(e,n,i)}function mergeValue(e,n,r){let i=resolveAliasValue(e,r);if(!t.isMap(i))throw Error(`Merge sources must be maps or map aliases`);let a=i.toJSON(null,e,Map);for(let[e,t]of a)n instanceof Map?n.has(e)||n.set(e,t):n instanceof Set?n.add(e):Object.prototype.hasOwnProperty.call(n,e)||Object.defineProperty(n,e,{value:t,writable:!0,enumerable:!0,configurable:!0});return n}function resolveAliasValue(e,n){return e&&t.isAlias(n)?n.resolve(e.doc,e):n}e.addMergeToJSMap=addMergeToJSMap,e.isMergeKey=isMergeKey,e.merge=r})),be=/* @__PURE__ */ __commonJSMin((e=>{var t=ve(),n=ye(),r=L(),i=k(),a=j();function addPairToJSMap(e,t,{key:r,value:o}){if(i.isNode(r)&&r.addToJSMap)r.addToJSMap(e,t,o);else if(n.isMergeKey(e,r))n.addMergeToJSMap(e,t,o);else{let n=a.toJS(r,``,e);if(t instanceof Map)t.set(n,a.toJS(o,n,e));else if(t instanceof Set)t.add(n);else{let i=stringifyKey(r,n,e),s=a.toJS(o,i,e);i in t?Object.defineProperty(t,i,{value:s,writable:!0,enumerable:!0,configurable:!0}):t[i]=s}}return t}function stringifyKey(e,n,a){if(n===null)return``;if(typeof n!=`object`)return String(n);if(i.isNode(e)&&a?.doc){let n=r.createStringifyContext(a.doc,{});n.anchors=/* @__PURE__ */ new Set;for(let e of a.anchors.keys())n.anchors.add(e.anchor);n.inFlow=!0,n.inStringifyKey=!0;let i=e.toString(n);if(!a.mapKeyWarned){let e=JSON.stringify(i);e.length>40&&(e=e.substring(0,36)+`..."`),t.warn(a.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${e}. Set mapAsMap: true to use object keys.`),a.mapKeyWarned=!0}return i}return JSON.stringify(n)}e.addPairToJSMap=addPairToJSMap})),R=/* @__PURE__ */ __commonJSMin((e=>{var t=P(),n=_e(),r=be(),i=k();function createPair(e,n,r){return new a(t.createNode(e,void 0,r),t.createNode(n,void 0,r))}var a=class Pair{constructor(e,t=null){Object.defineProperty(this,i.NODE_TYPE,{value:i.PAIR}),this.key=e,this.value=t}clone(e){let{key:t,value:n}=this;return i.isNode(t)&&(t=t.clone(e)),i.isNode(n)&&(n=n.clone(e)),new Pair(t,n)}toJSON(e,t){let n=t?.mapAsMap?/* @__PURE__ */ new Map:{};return r.addPairToJSMap(t,n,this)}toString(e,t,r){return e?.doc?n.stringifyPair(this,e,t,r):JSON.stringify(this)}};e.Pair=a,e.createPair=createPair})),xe=/* @__PURE__ */ __commonJSMin((e=>{var t=k(),n=L(),r=F();function stringifyCollection(e,t,n){return(t.inFlow??e.flow?stringifyFlowCollection:stringifyBlockCollection)(e,t,n)}function stringifyBlockCollection({comment:e,items:i},a,{blockItemPrefix:o,flowChars:s,itemIndent:c,onChompKeep:l,onComment:u}){let{indent:d,options:{commentString:f}}=a,p=Object.assign({},a,{indent:c,type:null}),m=!1,h=[];for(let e=0;el=null,()=>m=!0);l&&(u+=r.lineComment(u,c,f(l))),m&&l&&(m=!1),h.push(o+u)}let g;if(h.length===0)g=s.start+s.end;else{g=h[0];for(let e=1;ec=null);f||=m.length>p||l.includes(` `),a0&&(f||=m.reduce((e,t)=>e+t.length+2,2)+(l.length+2)>i.options.lineWidth),f&&(l+=`,`)),c&&(l+=r.lineComment(l,o,u(c))),m.push(l),p=m.length}let{start:h,end:g}=a;if(m.length===0)return h+g;if(!f){let e=m.reduce((e,t)=>e+t.length+2,2);f=i.options.lineWidth>0&&e>i.options.lineWidth}if(f){let e=h;for(let t of m)e+=t?`\n${c}${s}${t}`:` -`;return`${e}\n${s}${g}`}return`${h}${l}${m.join(` `)}${l}${g}`}function addCommentBefore({indent:e,options:{commentString:t}},n,i,a){if(i&&a&&(i=i.replace(/^\n+/,``)),i){let a=r.indentComment(t(i),e);n.push(a.trimStart())}}e.stringifyCollection=stringifyCollection})),z=/* @__PURE__ */ __commonJSMin((e=>{var t=ve(),n=_e(),r=fe(),i=O(),a=R(),o=N();function findPair(e,t){let n=i.isScalar(t)?t.value:t;for(let r of e)if(i.isPair(r)&&(r.key===t||r.key===n||i.isScalar(r.key)&&r.key.value===n))return r}e.YAMLMap=class extends r.Collection{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(i.MAP,e),this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:i}=n,o=new this(e),add=(e,s)=>{if(typeof i==`function`)s=i.call(t,e,s);else if(Array.isArray(i)&&!i.includes(e))return;(s!==void 0||r)&&o.items.push(a.createPair(e,s,n))};if(t instanceof Map)for(let[e,n]of t)add(e,n);else if(t&&typeof t==`object`)for(let e of Object.keys(t))add(e,t[e]);return typeof e.sortMapEntries==`function`&&o.items.sort(e.sortMapEntries),o}add(e,t){let n;n=i.isPair(e)?e:!e||typeof e!=`object`||!(`key`in e)?new a.Pair(e,e?.value):new a.Pair(e.key,e.value);let r=findPair(this.items,n.key),s=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);i.isScalar(r.value)&&o.isScalarValue(n.value)?r.value.value=n.value:r.value=n.value}else if(s){let e=this.items.findIndex(e=>s(n,e)<0);e===-1?this.items.push(n):this.items.splice(e,0,n)}else this.items.push(n)}delete(e){let t=findPair(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=findPair(this.items,e)?.value;return(!t&&i.isScalar(n)?n.value:n)??void 0}has(e){return!!findPair(this.items,e)}set(e,t){this.add(new a.Pair(e,t),!0)}toJSON(e,t,r){let i=r?new r:t?.mapAsMap?/* @__PURE__ */ new Map:{};t?.onCreate&&t.onCreate(i);for(let e of this.items)n.addPairToJSMap(t,i,e);return i}toString(e,n,r){if(!e)return JSON.stringify(this);for(let e of this.items)if(!i.isPair(e))throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),t.stringifyCollection(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:r,onComment:n})}},e.findPair=findPair})),B=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=z();e.map={collection:`map`,default:!0,nodeClass:n.YAMLMap,tag:`tag:yaml.org,2002:map`,resolve(e,n){return t.isMap(e)||n(`Expected a mapping for this tag`),e},createNode:(e,t,r)=>n.YAMLMap.from(e,t,r)}})),V=/* @__PURE__ */ __commonJSMin((e=>{var t=P(),n=ve(),r=fe(),i=O(),a=N(),o=A(),YAMLSeq=class extends r.Collection{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(i.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=asItemIndex(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=asItemIndex(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&i.isScalar(r)?r.value:r}has(e){let t=asItemIndex(e);return typeof t==`number`&&t=0?t:null}e.YAMLSeq=YAMLSeq})),H=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=V();e.seq={collection:`seq`,default:!0,nodeClass:n.YAMLSeq,tag:`tag:yaml.org,2002:seq`,resolve(e,n){return t.isSeq(e)||n(`Expected a sequence for this tag`),e},createNode:(e,t,r)=>n.YAMLSeq.from(e,t,r)}})),U=/* @__PURE__ */ __commonJSMin((e=>{var t=I();e.string={identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify(e,n,r,i){return n=Object.assign({actualString:!0},n),t.stringifyString(e,n,r,i)}}})),ye=/* @__PURE__ */ __commonJSMin((e=>{var t=N();let n={identify:e=>e==null,createNode:()=>new t.Scalar(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new t.Scalar(null),stringify:({source:e},t)=>typeof e==`string`&&n.test.test(e)?e:t.options.nullStr};e.nullTag=n})),be=/* @__PURE__ */ __commonJSMin((e=>{var t=N();let n={identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new t.Scalar(e[0]===`t`||e[0]===`T`),stringify({source:e,value:t},r){return e&&n.test.test(e)&&t===(e[0]===`t`||e[0]===`T`)?e:t?r.options.trueStr:r.options.falseStr}};e.boolTag=n})),W=/* @__PURE__ */ __commonJSMin((e=>{function stringifyNumber({format:e,minFractionDigits:t,tag:n,value:r}){if(typeof r==`bigint`)return String(r);let i=typeof r==`number`?r:Number(r);if(!isFinite(i))return isNaN(i)?`.nan`:i<0?`-.inf`:`.inf`;let a=Object.is(r,-0)?`-0`:JSON.stringify(r);if(!e&&t&&(!n||n===`tag:yaml.org,2002:float`)&&/^-?\d/.test(a)&&!a.includes(`e`)){let e=a.indexOf(`.`);e<0&&(e=a.length,a+=`.`);let n=t-(a.length-e-1);for(;n-->0;)a+=`0`}return a}e.stringifyNumber=stringifyNumber})),xe=/* @__PURE__ */ __commonJSMin((e=>{var t=N(),n=W();let r={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:n.stringifyNumber};e.float={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let n=new t.Scalar(parseFloat(e)),r=e.indexOf(`.`);return r!==-1&&e[e.length-1]===`0`&&(n.minFractionDigits=e.length-r-1),n},stringify:n.stringifyNumber},e.floatExp={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():n.stringifyNumber(e)}},e.floatNaN=r})),Se=/* @__PURE__ */ __commonJSMin((e=>{var t=W();let intIdentify=e=>typeof e==`bigint`||Number.isInteger(e),intResolve=(e,t,n,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),n);function intStringify(e,n,r){let{value:i}=e;return intIdentify(i)&&i>=0?r+i.toString(n):t.stringifyNumber(e)}e.int={identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>intResolve(e,0,10,n),stringify:t.stringifyNumber},e.intHex={identify:e=>intIdentify(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>intResolve(e,2,16,n),stringify:e=>intStringify(e,16,`0x`)},e.intOct={identify:e=>intIdentify(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^0o[0-7]+$/,resolve:(e,t,n)=>intResolve(e,2,8,n),stringify:e=>intStringify(e,8,`0o`)}})),Ce=/* @__PURE__ */ __commonJSMin((e=>{var t=B(),n=ye(),r=H(),i=U(),a=be(),o=xe(),s=Se();e.schema=[t.map,r.seq,i.string,n.nullTag,a.boolTag,s.intOct,s.int,s.intHex,o.floatNaN,o.floatExp,o.float]})),we=/* @__PURE__ */ __commonJSMin((e=>{var t=N(),n=B(),r=H();function intIdentify(e){return typeof e==`bigint`||Number.isInteger(e)}let stringifyJSON=({value:e})=>JSON.stringify(e),i=[{identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify:stringifyJSON},{identify:e=>e==null,createNode:()=>new t.Scalar(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^null$/,resolve:()=>null,stringify:stringifyJSON},{identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^true$|^false$/,resolve:e=>e===`true`,stringify:stringifyJSON},{identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>intIdentify(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:stringifyJSON}];e.schema=[n.map,r.seq].concat(i,{default:!0,tag:``,test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}})})),Te=/* @__PURE__ */ __commonJSMin((e=>{var t=D(`buffer`),n=N(),r=I();e.binary={identify:e=>e instanceof Uint8Array,default:!1,tag:`tag:yaml.org,2002:binary`,resolve(e,n){if(typeof t.Buffer==`function`)return t.Buffer.from(e,`base64`);if(typeof atob==`function`){let t=atob(e.replace(/[\n\r]/g,``)),n=new Uint8Array(t.length);for(let e=0;e{var t=O(),n=R(),r=N(),i=V();function resolvePairs(e,i){if(t.isSeq(e))for(let a=0;a1&&i(`Each pair must have its own sequence indicator`);let e=o.items[0]||new n.Pair(new r.Scalar(null));if(o.commentBefore&&(e.key.commentBefore=e.key.commentBefore?`${o.commentBefore}\n${e.key.commentBefore}`:o.commentBefore),o.comment){let t=e.value??e.key;t.comment=t.comment?`${o.comment}\n${t.comment}`:o.comment}o=e}e.items[a]=t.isPair(o)?o:new n.Pair(o)}}else i(`Expected a sequence for this tag`);return e}function createPairs(e,t,r){let{replacer:a}=r,o=new i.YAMLSeq(e);o.tag=`tag:yaml.org,2002:pairs`;let s=0;if(t&&Symbol.iterator in Object(t))for(let e of t){typeof a==`function`&&(e=a.call(t,String(s++),e));let i,c;if(Array.isArray(e)){if(e.length===2)i=e[0],c=e[1];else throw TypeError(`Expected [key, value] tuple: ${e}`)}else if(e&&e instanceof Object){let t=Object.keys(e);if(t.length===1)i=t[0],c=e[i];else throw TypeError(`Expected tuple with one key, not ${t.length} keys`)}else i=e;o.items.push(n.createPair(i,c,r))}return o}let a={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:resolvePairs,createNode:createPairs};e.createPairs=createPairs,e.pairs=a,e.resolvePairs=resolvePairs})),De=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=A(),r=z(),i=V(),a=Ee(),o=class YAMLOMap extends i.YAMLSeq{constructor(){super(),this.add=r.YAMLMap.prototype.add.bind(this),this.delete=r.YAMLMap.prototype.delete.bind(this),this.get=r.YAMLMap.prototype.get.bind(this),this.has=r.YAMLMap.prototype.has.bind(this),this.set=r.YAMLMap.prototype.set.bind(this),this.tag=YAMLOMap.tag}toJSON(e,r){if(!r)return super.toJSON(e);let i=/* @__PURE__ */ new Map;r?.onCreate&&r.onCreate(i);for(let e of this.items){let a,o;if(t.isPair(e)?(a=n.toJS(e.key,``,r),o=n.toJS(e.value,a,r)):a=n.toJS(e,``,r),i.has(a))throw Error(`Ordered maps must not include duplicate keys`);i.set(a,o)}return i}static from(e,t,n){let r=a.createPairs(e,t,n),i=new this;return i.items=r.items,i}};o.tag=`tag:yaml.org,2002:omap`;let s={collection:`seq`,identify:e=>e instanceof Map,nodeClass:o,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,n){let r=a.resolvePairs(e,n),i=[];for(let{key:e}of r.items)t.isScalar(e)&&(i.includes(e.value)?n(`Ordered maps must not include duplicate keys: ${e.value}`):i.push(e.value));return Object.assign(new o,r)},createNode:(e,t,n)=>o.from(e,t,n)};e.YAMLOMap=o,e.omap=s})),Oe=/* @__PURE__ */ __commonJSMin((e=>{var t=N();function boolStringify({value:e,source:t},i){return t&&(e?n:r).test.test(t)?t:e?i.options.trueStr:i.options.falseStr}let n={identify:e=>e===!0,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new t.Scalar(!0),stringify:boolStringify},r={identify:e=>e===!1,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new t.Scalar(!1),stringify:boolStringify};e.falseTag=r,e.trueTag=n})),ke=/* @__PURE__ */ __commonJSMin((e=>{var t=N(),n=W();let r={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:n.stringifyNumber};e.float={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let n=new t.Scalar(parseFloat(e.replace(/_/g,``))),r=e.indexOf(`.`);if(r!==-1){let t=e.substring(r+1).replace(/_/g,``);t[t.length-1]===`0`&&(n.minFractionDigits=t.length)}return n},stringify:n.stringifyNumber},e.floatExp={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,``)),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():n.stringifyNumber(e)}},e.floatNaN=r})),Ae=/* @__PURE__ */ __commonJSMin((e=>{var t=W();let intIdentify=e=>typeof e==`bigint`||Number.isInteger(e);function intResolve(e,t,n,{intAsBigInt:r}){let i=e[0];if((i===`-`||i===`+`)&&(t+=1),e=e.substring(t).replace(/_/g,``),r){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`}let t=BigInt(e);return i===`-`?BigInt(-1)*t:t}let a=parseInt(e,n);return i===`-`?-1*a:a}function intStringify(e,n,r){let{value:i}=e;if(intIdentify(i)){let e=i.toString(n);return i<0?`-`+r+e.substr(1):r+e}return t.stringifyNumber(e)}let n={identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>intResolve(e,2,2,n),stringify:e=>intStringify(e,2,`0b`)},r={identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>intResolve(e,1,8,n),stringify:e=>intStringify(e,8,`0`)},i={identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>intResolve(e,0,10,n),stringify:t.stringifyNumber},a={identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>intResolve(e,2,16,n),stringify:e=>intStringify(e,16,`0x`)};e.int=i,e.intBin=n,e.intHex=a,e.intOct=r})),je=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=R(),r=z(),i=class YAMLSet extends r.YAMLMap{constructor(e){super(e),this.tag=YAMLSet.tag}add(e){let i;i=t.isPair(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new n.Pair(e.key,null):new n.Pair(e,null),r.findPair(this.items,i.key)||this.items.push(i)}get(e,n){let i=r.findPair(this.items,e);return!n&&t.isPair(i)?t.isScalar(i.key)?i.key.value:i.key:i}set(e,t){if(typeof t!=`boolean`)throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let i=r.findPair(this.items,e);i&&!t?this.items.splice(this.items.indexOf(i),1):!i&&t&&this.items.push(new n.Pair(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw Error(`Set items must all have null values`)}static from(e,t,r){let{replacer:i}=r,a=new this(e);if(t&&Symbol.iterator in Object(t))for(let e of t)typeof i==`function`&&(e=i.call(t,e,e)),a.items.push(n.createPair(e,null,r));return a}};i.tag=`tag:yaml.org,2002:set`;let a={collection:`map`,identify:e=>e instanceof Set,nodeClass:i,default:!1,tag:`tag:yaml.org,2002:set`,createNode:(e,t,n)=>i.from(e,t,n),resolve(e,n){if(t.isMap(e)){if(e.hasAllNullValues(!0))return Object.assign(new i,e);n(`Set items must all have null values`)}else n(`Expected a mapping for this tag`);return e}};e.YAMLSet=i,e.set=a})),Me=/* @__PURE__ */ __commonJSMin((e=>{var t=W();function parseSexagesimal(e,t){let n=e[0],r=n===`-`||n===`+`?e.substring(1):e,num=e=>t?BigInt(e):Number(e),i=r.replace(/_/g,``).split(`:`).reduce((e,t)=>e*num(60)+num(t),num(0));return n===`-`?num(-1)*i:i}function stringifySexagesimal(e){let{value:n}=e,num=e=>e;if(typeof n==`bigint`)num=e=>BigInt(e);else if(isNaN(n)||!isFinite(n))return t.stringifyNumber(e);let r=``;n<0&&(r=`-`,n*=num(-1));let i=num(60),a=[n%i];return n<60?a.unshift(0):(n=(n-a[0])/i,a.unshift(n%i),n>=60&&(n=(n-a[0])/i,a.unshift(n))),r+a.map(e=>String(e).padStart(2,`0`)).join(`:`).replace(/000000\d*$/,``)}let n={identify:e=>typeof e==`bigint`||Number.isInteger(e),default:!0,tag:`tag:yaml.org,2002:int`,format:`TIME`,test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>parseSexagesimal(e,n),stringify:stringifySexagesimal},r={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`TIME`,test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>parseSexagesimal(e,!1),stringify:stringifySexagesimal},i={identify:e=>e instanceof Date,default:!0,tag:`tag:yaml.org,2002:timestamp`,test:RegExp(`^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$`),resolve(e){let t=e.match(i.test);if(!t)throw Error(`!!timestamp expects a date, starting with yyyy-mm-dd`);let[,n,r,a,o,s,c]=t.map(Number),l=t[7]?Number((t[7]+`00`).substr(1,3)):0,u=Date.UTC(n,r-1,a,o||0,s||0,c||0,l),d=t[8];if(d&&d!==`Z`){let e=parseSexagesimal(d,!1);Math.abs(e)<30&&(e*=60),u-=6e4*e}return new Date(u)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,``)??``};e.floatTime=r,e.intTime=n,e.timestamp=i})),Ne=/* @__PURE__ */ __commonJSMin((e=>{var t=B(),n=ye(),r=H(),i=U(),a=Te(),o=Oe(),s=ke(),c=Ae(),l=ge(),u=De(),d=Ee(),f=je(),p=Me();e.schema=[t.map,r.seq,i.string,n.nullTag,o.trueTag,o.falseTag,c.intBin,c.intOct,c.int,c.intHex,s.floatNaN,s.floatExp,s.float,a.binary,l.merge,u.omap,d.pairs,f.set,p.intTime,p.floatTime,p.timestamp]})),Pe=/* @__PURE__ */ __commonJSMin((e=>{var t=B(),n=ye(),r=H(),i=U(),a=be(),o=xe(),s=Se(),c=Ce(),l=we(),u=Te(),d=ge(),f=De(),p=Ee(),m=Ne(),h=je(),g=Me();let _=/* @__PURE__ */ new Map([[`core`,c.schema],[`failsafe`,[t.map,r.seq,i.string]],[`json`,l.schema],[`yaml11`,m.schema],[`yaml-1.1`,m.schema]]),v={binary:u.binary,bool:a.boolTag,float:o.float,floatExp:o.floatExp,floatNaN:o.floatNaN,floatTime:g.floatTime,int:s.int,intHex:s.intHex,intOct:s.intOct,intTime:g.intTime,map:t.map,merge:d.merge,null:n.nullTag,omap:f.omap,pairs:p.pairs,seq:r.seq,set:h.set,timestamp:g.timestamp},y={"tag:yaml.org,2002:binary":u.binary,"tag:yaml.org,2002:merge":d.merge,"tag:yaml.org,2002:omap":f.omap,"tag:yaml.org,2002:pairs":p.pairs,"tag:yaml.org,2002:set":h.set,"tag:yaml.org,2002:timestamp":g.timestamp};function getTags(e,t,n){let r=_.get(t);if(r&&!e)return n&&!r.includes(d.merge)?r.concat(d.merge):r.slice();let i=r;if(!i){if(Array.isArray(e))i=[];else{let e=Array.from(_.keys()).filter(e=>e!==`yaml11`).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown schema "${t}"; use one of ${e} or define customTags array`)}}if(Array.isArray(e))for(let t of e)i=i.concat(t);else typeof e==`function`&&(i=e(i.slice()));return n&&(i=i.concat(d.merge)),i.reduce((e,t)=>{let n=typeof t==`string`?v[t]:t;if(!n){let e=JSON.stringify(t),n=Object.keys(v).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown custom tag ${e}; use one of ${n}`)}return e.includes(n)||e.push(n),e},[])}e.coreKnownTags=y,e.getTags=getTags})),Fe=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=B(),r=H(),i=U(),a=Pe();let sortMapEntriesByKey=(e,t)=>e.keyt.key);e.Schema=class Schema{constructor({compat:e,customTags:o,merge:s,resolveKnownTags:c,schema:l,sortMapEntries:u,toStringDefaults:d}){this.compat=Array.isArray(e)?a.getTags(e,`compat`):e?a.getTags(null,e):null,this.name=typeof l==`string`&&l||`core`,this.knownTags=c?a.coreKnownTags:{},this.tags=a.getTags(o,this.name,s),this.toStringOptions=d??null,Object.defineProperty(this,t.MAP,{value:n.map}),Object.defineProperty(this,t.SCALAR,{value:i.string}),Object.defineProperty(this,t.SEQ,{value:r.seq}),this.sortMapEntries=typeof u==`function`?u:u===!0?sortMapEntriesByKey:null}clone(){let e=Object.create(Schema.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}}})),Ie=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=L(),r=F();function stringifyDocument(e,i){let a=[],o=i.directives===!0;if(i.directives!==!1&&e.directives){let t=e.directives.toString(e);t?(a.push(t),o=!0):e.directives.docStart&&(o=!0)}o&&a.push(`---`);let s=n.createStringifyContext(e,i),{commentString:c}=s.options;if(e.commentBefore){a.length!==1&&a.unshift(``);let t=c(e.commentBefore);a.unshift(r.indentComment(t,``))}let l=!1,u=null;if(e.contents){if(t.isNode(e.contents)){if(e.contents.spaceBefore&&o&&a.push(``),e.contents.commentBefore){let t=c(e.contents.commentBefore);a.push(r.indentComment(t,``))}s.forceBlockIndent=!!e.comment,u=e.contents.comment}let i=u?void 0:()=>l=!0,d=n.stringify(e.contents,s,()=>u=null,i);u&&(d+=r.lineComment(d,``,c(u))),(d[0]===`|`||d[0]===`>`)&&a[a.length-1]===`---`?a[a.length-1]=`--- ${d}`:a.push(d)}else a.push(n.stringify(e.contents,s));if(e.directives?.docEnd){if(e.comment){let t=c(e.comment);t.includes(` +`;return`${e}\n${s}${g}`}return`${h}${l}${m.join(` `)}${l}${g}`}function addCommentBefore({indent:e,options:{commentString:t}},n,i,a){if(i&&a&&(i=i.replace(/^\n+/,``)),i){let a=r.indentComment(t(i),e);n.push(a.trimStart())}}e.stringifyCollection=stringifyCollection})),z=/* @__PURE__ */ __commonJSMin((e=>{var t=xe(),n=be(),r=he(),i=k(),a=R(),o=N();function findPair(e,t){let n=i.isScalar(t)?t.value:t;for(let r of e)if(i.isPair(r)&&(r.key===t||r.key===n||i.isScalar(r.key)&&r.key.value===n))return r}e.YAMLMap=class extends r.Collection{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(i.MAP,e),this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:i}=n,o=new this(e),add=(e,s)=>{if(typeof i==`function`)s=i.call(t,e,s);else if(Array.isArray(i)&&!i.includes(e))return;(s!==void 0||r)&&o.items.push(a.createPair(e,s,n))};if(t instanceof Map)for(let[e,n]of t)add(e,n);else if(t&&typeof t==`object`)for(let e of Object.keys(t))add(e,t[e]);return typeof e.sortMapEntries==`function`&&o.items.sort(e.sortMapEntries),o}add(e,t){let n;n=i.isPair(e)?e:!e||typeof e!=`object`||!(`key`in e)?new a.Pair(e,e?.value):new a.Pair(e.key,e.value);let r=findPair(this.items,n.key),s=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);i.isScalar(r.value)&&o.isScalarValue(n.value)?r.value.value=n.value:r.value=n.value}else if(s){let e=this.items.findIndex(e=>s(n,e)<0);e===-1?this.items.push(n):this.items.splice(e,0,n)}else this.items.push(n)}delete(e){let t=findPair(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=findPair(this.items,e)?.value;return(!t&&i.isScalar(n)?n.value:n)??void 0}has(e){return!!findPair(this.items,e)}set(e,t){this.add(new a.Pair(e,t),!0)}toJSON(e,t,r){let i=r?new r:t?.mapAsMap?/* @__PURE__ */ new Map:{};t?.onCreate&&t.onCreate(i);for(let e of this.items)n.addPairToJSMap(t,i,e);return i}toString(e,n,r){if(!e)return JSON.stringify(this);for(let e of this.items)if(!i.isPair(e))throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),t.stringifyCollection(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:r,onComment:n})}},e.findPair=findPair})),B=/* @__PURE__ */ __commonJSMin((e=>{var t=k(),n=z();e.map={collection:`map`,default:!0,nodeClass:n.YAMLMap,tag:`tag:yaml.org,2002:map`,resolve(e,n){return t.isMap(e)||n(`Expected a mapping for this tag`),e},createNode:(e,t,r)=>n.YAMLMap.from(e,t,r)}})),V=/* @__PURE__ */ __commonJSMin((e=>{var t=P(),n=xe(),r=he(),i=k(),a=N(),o=j(),YAMLSeq=class extends r.Collection{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(i.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=asItemIndex(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=asItemIndex(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&i.isScalar(r)?r.value:r}has(e){let t=asItemIndex(e);return typeof t==`number`&&t=0?t:null}e.YAMLSeq=YAMLSeq})),H=/* @__PURE__ */ __commonJSMin((e=>{var t=k(),n=V();e.seq={collection:`seq`,default:!0,nodeClass:n.YAMLSeq,tag:`tag:yaml.org,2002:seq`,resolve(e,n){return t.isSeq(e)||n(`Expected a sequence for this tag`),e},createNode:(e,t,r)=>n.YAMLSeq.from(e,t,r)}})),U=/* @__PURE__ */ __commonJSMin((e=>{var t=I();e.string={identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify(e,n,r,i){return n=Object.assign({actualString:!0},n),t.stringifyString(e,n,r,i)}}})),Se=/* @__PURE__ */ __commonJSMin((e=>{var t=N();let n={identify:e=>e==null,createNode:()=>new t.Scalar(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new t.Scalar(null),stringify:({source:e},t)=>typeof e==`string`&&n.test.test(e)?e:t.options.nullStr};e.nullTag=n})),Ce=/* @__PURE__ */ __commonJSMin((e=>{var t=N();let n={identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new t.Scalar(e[0]===`t`||e[0]===`T`),stringify({source:e,value:t},r){return e&&n.test.test(e)&&t===(e[0]===`t`||e[0]===`T`)?e:t?r.options.trueStr:r.options.falseStr}};e.boolTag=n})),W=/* @__PURE__ */ __commonJSMin((e=>{function stringifyNumber({format:e,minFractionDigits:t,tag:n,value:r}){if(typeof r==`bigint`)return String(r);let i=typeof r==`number`?r:Number(r);if(!isFinite(i))return isNaN(i)?`.nan`:i<0?`-.inf`:`.inf`;let a=Object.is(r,-0)?`-0`:JSON.stringify(r);if(!e&&t&&(!n||n===`tag:yaml.org,2002:float`)&&/^-?\d/.test(a)&&!a.includes(`e`)){let e=a.indexOf(`.`);e<0&&(e=a.length,a+=`.`);let n=t-(a.length-e-1);for(;n-->0;)a+=`0`}return a}e.stringifyNumber=stringifyNumber})),we=/* @__PURE__ */ __commonJSMin((e=>{var t=N(),n=W();let r={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:n.stringifyNumber};e.float={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let n=new t.Scalar(parseFloat(e)),r=e.indexOf(`.`);return r!==-1&&e[e.length-1]===`0`&&(n.minFractionDigits=e.length-r-1),n},stringify:n.stringifyNumber},e.floatExp={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():n.stringifyNumber(e)}},e.floatNaN=r})),Te=/* @__PURE__ */ __commonJSMin((e=>{var t=W();let intIdentify=e=>typeof e==`bigint`||Number.isInteger(e),intResolve=(e,t,n,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),n);function intStringify(e,n,r){let{value:i}=e;return intIdentify(i)&&i>=0?r+i.toString(n):t.stringifyNumber(e)}e.int={identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>intResolve(e,0,10,n),stringify:t.stringifyNumber},e.intHex={identify:e=>intIdentify(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>intResolve(e,2,16,n),stringify:e=>intStringify(e,16,`0x`)},e.intOct={identify:e=>intIdentify(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^0o[0-7]+$/,resolve:(e,t,n)=>intResolve(e,2,8,n),stringify:e=>intStringify(e,8,`0o`)}})),Ee=/* @__PURE__ */ __commonJSMin((e=>{var t=B(),n=Se(),r=H(),i=U(),a=Ce(),o=we(),s=Te();e.schema=[t.map,r.seq,i.string,n.nullTag,a.boolTag,s.intOct,s.int,s.intHex,o.floatNaN,o.floatExp,o.float]})),De=/* @__PURE__ */ __commonJSMin((e=>{var t=N(),n=B(),r=H();function intIdentify(e){return typeof e==`bigint`||Number.isInteger(e)}let stringifyJSON=({value:e})=>JSON.stringify(e),i=[{identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify:stringifyJSON},{identify:e=>e==null,createNode:()=>new t.Scalar(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^null$/,resolve:()=>null,stringify:stringifyJSON},{identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^true$|^false$/,resolve:e=>e===`true`,stringify:stringifyJSON},{identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>intIdentify(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:stringifyJSON}];e.schema=[n.map,r.seq].concat(i,{default:!0,tag:``,test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}})})),Oe=/* @__PURE__ */ __commonJSMin((e=>{var t=O(`buffer`),n=N(),r=I();e.binary={identify:e=>e instanceof Uint8Array,default:!1,tag:`tag:yaml.org,2002:binary`,resolve(e,n){if(typeof t.Buffer==`function`)return t.Buffer.from(e,`base64`);if(typeof atob==`function`){let t=atob(e.replace(/[\n\r]/g,``)),n=new Uint8Array(t.length);for(let e=0;e{var t=k(),n=R(),r=N(),i=V();function resolvePairs(e,i){if(t.isSeq(e))for(let a=0;a1&&i(`Each pair must have its own sequence indicator`);let e=o.items[0]||new n.Pair(new r.Scalar(null));if(o.commentBefore&&(e.key.commentBefore=e.key.commentBefore?`${o.commentBefore}\n${e.key.commentBefore}`:o.commentBefore),o.comment){let t=e.value??e.key;t.comment=t.comment?`${o.comment}\n${t.comment}`:o.comment}o=e}e.items[a]=t.isPair(o)?o:new n.Pair(o)}}else i(`Expected a sequence for this tag`);return e}function createPairs(e,t,r){let{replacer:a}=r,o=new i.YAMLSeq(e);o.tag=`tag:yaml.org,2002:pairs`;let s=0;if(t&&Symbol.iterator in Object(t))for(let e of t){typeof a==`function`&&(e=a.call(t,String(s++),e));let i,c;if(Array.isArray(e)){if(e.length===2)i=e[0],c=e[1];else throw TypeError(`Expected [key, value] tuple: ${e}`)}else if(e&&e instanceof Object){let t=Object.keys(e);if(t.length===1)i=t[0],c=e[i];else throw TypeError(`Expected tuple with one key, not ${t.length} keys`)}else i=e;o.items.push(n.createPair(i,c,r))}return o}let a={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:resolvePairs,createNode:createPairs};e.createPairs=createPairs,e.pairs=a,e.resolvePairs=resolvePairs})),Ae=/* @__PURE__ */ __commonJSMin((e=>{var t=k(),n=j(),r=z(),i=V(),a=ke(),o=class YAMLOMap extends i.YAMLSeq{constructor(){super(),this.add=r.YAMLMap.prototype.add.bind(this),this.delete=r.YAMLMap.prototype.delete.bind(this),this.get=r.YAMLMap.prototype.get.bind(this),this.has=r.YAMLMap.prototype.has.bind(this),this.set=r.YAMLMap.prototype.set.bind(this),this.tag=YAMLOMap.tag}toJSON(e,r){if(!r)return super.toJSON(e);let i=/* @__PURE__ */ new Map;r?.onCreate&&r.onCreate(i);for(let e of this.items){let a,o;if(t.isPair(e)?(a=n.toJS(e.key,``,r),o=n.toJS(e.value,a,r)):a=n.toJS(e,``,r),i.has(a))throw Error(`Ordered maps must not include duplicate keys`);i.set(a,o)}return i}static from(e,t,n){let r=a.createPairs(e,t,n),i=new this;return i.items=r.items,i}};o.tag=`tag:yaml.org,2002:omap`;let s={collection:`seq`,identify:e=>e instanceof Map,nodeClass:o,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,n){let r=a.resolvePairs(e,n),i=[];for(let{key:e}of r.items)t.isScalar(e)&&(i.includes(e.value)?n(`Ordered maps must not include duplicate keys: ${e.value}`):i.push(e.value));return Object.assign(new o,r)},createNode:(e,t,n)=>o.from(e,t,n)};e.YAMLOMap=o,e.omap=s})),je=/* @__PURE__ */ __commonJSMin((e=>{var t=N();function boolStringify({value:e,source:t},i){return t&&(e?n:r).test.test(t)?t:e?i.options.trueStr:i.options.falseStr}let n={identify:e=>e===!0,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new t.Scalar(!0),stringify:boolStringify},r={identify:e=>e===!1,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new t.Scalar(!1),stringify:boolStringify};e.falseTag=r,e.trueTag=n})),Me=/* @__PURE__ */ __commonJSMin((e=>{var t=N(),n=W();let r={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:n.stringifyNumber};e.float={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let n=new t.Scalar(parseFloat(e.replace(/_/g,``))),r=e.indexOf(`.`);if(r!==-1){let t=e.substring(r+1).replace(/_/g,``);t[t.length-1]===`0`&&(n.minFractionDigits=t.length)}return n},stringify:n.stringifyNumber},e.floatExp={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,``)),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():n.stringifyNumber(e)}},e.floatNaN=r})),Ne=/* @__PURE__ */ __commonJSMin((e=>{var t=W();let intIdentify=e=>typeof e==`bigint`||Number.isInteger(e);function intResolve(e,t,n,{intAsBigInt:r}){let i=e[0];if((i===`-`||i===`+`)&&(t+=1),e=e.substring(t).replace(/_/g,``),r){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`}let t=BigInt(e);return i===`-`?BigInt(-1)*t:t}let a=parseInt(e,n);return i===`-`?-1*a:a}function intStringify(e,n,r){let{value:i}=e;if(intIdentify(i)){let e=i.toString(n);return i<0?`-`+r+e.substr(1):r+e}return t.stringifyNumber(e)}let n={identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>intResolve(e,2,2,n),stringify:e=>intStringify(e,2,`0b`)},r={identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>intResolve(e,1,8,n),stringify:e=>intStringify(e,8,`0`)},i={identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>intResolve(e,0,10,n),stringify:t.stringifyNumber},a={identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>intResolve(e,2,16,n),stringify:e=>intStringify(e,16,`0x`)};e.int=i,e.intBin=n,e.intHex=a,e.intOct=r})),Pe=/* @__PURE__ */ __commonJSMin((e=>{var t=k(),n=R(),r=z(),i=class YAMLSet extends r.YAMLMap{constructor(e){super(e),this.tag=YAMLSet.tag}add(e){let i;i=t.isPair(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new n.Pair(e.key,null):new n.Pair(e,null),r.findPair(this.items,i.key)||this.items.push(i)}get(e,n){let i=r.findPair(this.items,e);return!n&&t.isPair(i)?t.isScalar(i.key)?i.key.value:i.key:i}set(e,t){if(typeof t!=`boolean`)throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let i=r.findPair(this.items,e);i&&!t?this.items.splice(this.items.indexOf(i),1):!i&&t&&this.items.push(new n.Pair(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw Error(`Set items must all have null values`)}static from(e,t,r){let{replacer:i}=r,a=new this(e);if(t&&Symbol.iterator in Object(t))for(let e of t)typeof i==`function`&&(e=i.call(t,e,e)),a.items.push(n.createPair(e,null,r));return a}};i.tag=`tag:yaml.org,2002:set`;let a={collection:`map`,identify:e=>e instanceof Set,nodeClass:i,default:!1,tag:`tag:yaml.org,2002:set`,createNode:(e,t,n)=>i.from(e,t,n),resolve(e,n){if(t.isMap(e)){if(e.hasAllNullValues(!0))return Object.assign(new i,e);n(`Set items must all have null values`)}else n(`Expected a mapping for this tag`);return e}};e.YAMLSet=i,e.set=a})),Fe=/* @__PURE__ */ __commonJSMin((e=>{var t=W();function parseSexagesimal(e,t){let n=e[0],r=n===`-`||n===`+`?e.substring(1):e,num=e=>t?BigInt(e):Number(e),i=r.replace(/_/g,``).split(`:`).reduce((e,t)=>e*num(60)+num(t),num(0));return n===`-`?num(-1)*i:i}function stringifySexagesimal(e){let{value:n}=e,num=e=>e;if(typeof n==`bigint`)num=e=>BigInt(e);else if(isNaN(n)||!isFinite(n))return t.stringifyNumber(e);let r=``;n<0&&(r=`-`,n*=num(-1));let i=num(60),a=[n%i];return n<60?a.unshift(0):(n=(n-a[0])/i,a.unshift(n%i),n>=60&&(n=(n-a[0])/i,a.unshift(n))),r+a.map(e=>String(e).padStart(2,`0`)).join(`:`).replace(/000000\d*$/,``)}let n={identify:e=>typeof e==`bigint`||Number.isInteger(e),default:!0,tag:`tag:yaml.org,2002:int`,format:`TIME`,test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>parseSexagesimal(e,n),stringify:stringifySexagesimal},r={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`TIME`,test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>parseSexagesimal(e,!1),stringify:stringifySexagesimal},i={identify:e=>e instanceof Date,default:!0,tag:`tag:yaml.org,2002:timestamp`,test:RegExp(`^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$`),resolve(e){let t=e.match(i.test);if(!t)throw Error(`!!timestamp expects a date, starting with yyyy-mm-dd`);let[,n,r,a,o,s,c]=t.map(Number),l=t[7]?Number((t[7]+`00`).substr(1,3)):0,u=Date.UTC(n,r-1,a,o||0,s||0,c||0,l),d=t[8];if(d&&d!==`Z`){let e=parseSexagesimal(d,!1);Math.abs(e)<30&&(e*=60),u-=6e4*e}return new Date(u)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,``)??``};e.floatTime=r,e.intTime=n,e.timestamp=i})),Ie=/* @__PURE__ */ __commonJSMin((e=>{var t=B(),n=Se(),r=H(),i=U(),a=Oe(),o=je(),s=Me(),c=Ne(),l=ye(),u=Ae(),d=ke(),f=Pe(),p=Fe();e.schema=[t.map,r.seq,i.string,n.nullTag,o.trueTag,o.falseTag,c.intBin,c.intOct,c.int,c.intHex,s.floatNaN,s.floatExp,s.float,a.binary,l.merge,u.omap,d.pairs,f.set,p.intTime,p.floatTime,p.timestamp]})),Le=/* @__PURE__ */ __commonJSMin((e=>{var t=B(),n=Se(),r=H(),i=U(),a=Ce(),o=we(),s=Te(),c=Ee(),l=De(),u=Oe(),d=ye(),f=Ae(),p=ke(),m=Ie(),h=Pe(),g=Fe();let _=/* @__PURE__ */ new Map([[`core`,c.schema],[`failsafe`,[t.map,r.seq,i.string]],[`json`,l.schema],[`yaml11`,m.schema],[`yaml-1.1`,m.schema]]),v={binary:u.binary,bool:a.boolTag,float:o.float,floatExp:o.floatExp,floatNaN:o.floatNaN,floatTime:g.floatTime,int:s.int,intHex:s.intHex,intOct:s.intOct,intTime:g.intTime,map:t.map,merge:d.merge,null:n.nullTag,omap:f.omap,pairs:p.pairs,seq:r.seq,set:h.set,timestamp:g.timestamp},y={"tag:yaml.org,2002:binary":u.binary,"tag:yaml.org,2002:merge":d.merge,"tag:yaml.org,2002:omap":f.omap,"tag:yaml.org,2002:pairs":p.pairs,"tag:yaml.org,2002:set":h.set,"tag:yaml.org,2002:timestamp":g.timestamp};function getTags(e,t,n){let r=_.get(t);if(r&&!e)return n&&!r.includes(d.merge)?r.concat(d.merge):r.slice();let i=r;if(!i){if(Array.isArray(e))i=[];else{let e=Array.from(_.keys()).filter(e=>e!==`yaml11`).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown schema "${t}"; use one of ${e} or define customTags array`)}}if(Array.isArray(e))for(let t of e)i=i.concat(t);else typeof e==`function`&&(i=e(i.slice()));return n&&(i=i.concat(d.merge)),i.reduce((e,t)=>{let n=typeof t==`string`?v[t]:t;if(!n){let e=JSON.stringify(t),n=Object.keys(v).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown custom tag ${e}; use one of ${n}`)}return e.includes(n)||e.push(n),e},[])}e.coreKnownTags=y,e.getTags=getTags})),Re=/* @__PURE__ */ __commonJSMin((e=>{var t=k(),n=B(),r=H(),i=U(),a=Le();let sortMapEntriesByKey=(e,t)=>e.keyt.key);e.Schema=class Schema{constructor({compat:e,customTags:o,merge:s,resolveKnownTags:c,schema:l,sortMapEntries:u,toStringDefaults:d}){this.compat=Array.isArray(e)?a.getTags(e,`compat`):e?a.getTags(null,e):null,this.name=typeof l==`string`&&l||`core`,this.knownTags=c?a.coreKnownTags:{},this.tags=a.getTags(o,this.name,s),this.toStringOptions=d??null,Object.defineProperty(this,t.MAP,{value:n.map}),Object.defineProperty(this,t.SCALAR,{value:i.string}),Object.defineProperty(this,t.SEQ,{value:r.seq}),this.sortMapEntries=typeof u==`function`?u:u===!0?sortMapEntriesByKey:null}clone(){let e=Object.create(Schema.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}}})),ze=/* @__PURE__ */ __commonJSMin((e=>{var t=k(),n=L(),r=F();function stringifyDocument(e,i){let a=[],o=i.directives===!0;if(i.directives!==!1&&e.directives){let t=e.directives.toString(e);t?(a.push(t),o=!0):e.directives.docStart&&(o=!0)}o&&a.push(`---`);let s=n.createStringifyContext(e,i),{commentString:c}=s.options;if(e.commentBefore){a.length!==1&&a.unshift(``);let t=c(e.commentBefore);a.unshift(r.indentComment(t,``))}let l=!1,u=null;if(e.contents){if(t.isNode(e.contents)){if(e.contents.spaceBefore&&o&&a.push(``),e.contents.commentBefore){let t=c(e.contents.commentBefore);a.push(r.indentComment(t,``))}s.forceBlockIndent=!!e.comment,u=e.contents.comment}let i=u?void 0:()=>l=!0,d=n.stringify(e.contents,s,()=>u=null,i);u&&(d+=r.lineComment(d,``,c(u))),(d[0]===`|`||d[0]===`>`)&&a[a.length-1]===`---`?a[a.length-1]=`--- ${d}`:a.push(d)}else a.push(n.stringify(e.contents,s));if(e.directives?.docEnd){if(e.comment){let t=c(e.comment);t.includes(` `)?(a.push(`...`),a.push(r.indentComment(t,``))):a.push(`... ${t}`)}else a.push(`...`)}else{let t=e.comment;t&&l&&(t=t.replace(/^\n+/,``)),t&&((!l||u)&&a[a.length-1]!==``&&a.push(``),a.push(r.indentComment(c(t),``)))}return a.join(` `)+` -`}e.stringifyDocument=stringifyDocument})),G=/* @__PURE__ */ __commonJSMin((e=>{var t=M(),n=fe(),r=O(),i=R(),a=A(),o=Fe(),s=Ie(),c=ue(),l=de(),u=P(),d=le(),f=class Document{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,r.NODE_TYPE,{value:r.DOC});let i=null;typeof t==`function`||Array.isArray(t)?i=t:n===void 0&&t&&(n=t,t=void 0);let a=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:`warn`,prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:`1.2`},n);this.options=a;let{version:o}=a;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new d.Directives({version:o}),this.setSchema(o,n),this.contents=e===void 0?null:this.createNode(e,i,n)}clone(){let e=Object.create(Document.prototype,{[r.NODE_TYPE]:{value:r.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=r.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){assertCollection(this.contents)&&this.contents.add(e)}addIn(e,t){assertCollection(this.contents)&&this.contents.addIn(e,t)}createAlias(e,n){if(!e.anchor){let t=c.anchorNames(this);e.anchor=!n||t.has(n)?c.findNewAnchor(n||`a`,t):n}return new t.Alias(e.anchor)}createNode(e,t,n){let i;if(typeof t==`function`)e=t.call({"":e},``,e),i=t;else if(Array.isArray(t)){let e=t.filter(e=>typeof e==`number`||e instanceof String||e instanceof Number).map(String);e.length>0&&(t=t.concat(e)),i=t}else n===void 0&&t&&(n=t,t=void 0);let{aliasDuplicateObjects:a,anchorPrefix:o,flow:s,keepUndefined:l,onTagObj:d,tag:f}=n??{},{onAnchor:p,setAnchors:m,sourceObjects:h}=c.createNodeAnchors(this,o||`a`),g={aliasDuplicateObjects:a??!0,keepUndefined:l??!1,onAnchor:p,onTagObj:d,replacer:i,schema:this.schema,sourceObjects:h},_=u.createNode(e,f,g);return s&&r.isCollection(_)&&(_.flow=!0),m(),_}createPair(e,t,n={}){let r=this.createNode(e,null,n),a=this.createNode(t,null,n);return new i.Pair(r,a)}delete(e){return assertCollection(this.contents)?this.contents.delete(e):!1}deleteIn(e){return n.isEmptyPath(e)?this.contents!=null&&(this.contents=null,!0):assertCollection(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return r.isCollection(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return n.isEmptyPath(e)?!t&&r.isScalar(this.contents)?this.contents.value:this.contents:r.isCollection(this.contents)?this.contents.getIn(e,t):void 0}has(e){return r.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return n.isEmptyPath(e)?this.contents!==void 0:r.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=n.collectionFromPath(this.schema,[e],t):assertCollection(this.contents)&&this.contents.set(e,t)}setIn(e,t){n.isEmptyPath(e)?this.contents=t:this.contents==null?this.contents=n.collectionFromPath(this.schema,Array.from(e),t):assertCollection(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e==`number`&&(e=String(e));let n;switch(e){case`1.1`:this.directives?this.directives.yaml.version=`1.1`:this.directives=new d.Directives({version:`1.1`}),n={resolveKnownTags:!1,schema:`yaml-1.1`};break;case`1.2`:case`next`:this.directives?this.directives.yaml.version=e:this.directives=new d.Directives({version:e}),n={resolveKnownTags:!0,schema:`core`};break;case null:this.directives&&delete this.directives,n=null;break;default:{let t=JSON.stringify(e);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${t}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(n)this.schema=new o.Schema(Object.assign(n,t));else throw Error(`With a null YAML version, the { schema: Schema } option is required`)}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:r,onAnchor:i,reviver:o}={}){let s={anchors:/* @__PURE__ */ new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r==`number`?r:100},c=a.toJS(this.contents,t??``,s);if(typeof i==`function`)for(let{count:e,res:t}of s.anchors.values())i(t,e);return typeof o==`function`?l.applyReviver(o,{"":c},``,c):c}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw Error(`Document with errors cannot be stringified`);if(`indent`in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw Error(`"indent" option must be a positive integer, not ${t}`)}return s.stringifyDocument(this,e)}};function assertCollection(e){if(r.isCollection(e))return!0;throw Error(`Expected a YAML collection as document contents`)}e.Document=f})),K=/* @__PURE__ */ __commonJSMin((e=>{var YAMLError=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},YAMLParseError=class extends YAMLError{constructor(e,t,n){super(`YAMLParseError`,e,t,n)}},YAMLWarning=class extends YAMLError{constructor(e,t,n){super(`YAMLWarning`,e,t,n)}};e.YAMLError=YAMLError,e.YAMLParseError=YAMLParseError,e.YAMLWarning=YAMLWarning,e.prettifyError=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(e=>t.linePos(e));let{line:r,col:i}=n.linePos[0];n.message+=` at line ${r}, column ${i}`;let a=i-1,o=e.substring(t.lineStarts[r-1],t.lineStarts[r]).replace(/[\n\r]+$/,``);if(a>=60&&o.length>80){let e=Math.min(a-39,o.length-79);o=`…`+o.substring(e),a-=e-1}if(o.length>80&&(o=o.substring(0,79)+`…`),r>1&&/^ *$/.test(o.substring(0,a))){let n=e.substring(t.lineStarts[r-2],t.lineStarts[r-1]);n.length>80&&(n=n.substring(0,79)+`… -`),o=n+o}if(/[^ ]/.test(o)){let e=1,t=n.linePos[1];t?.line===r&&t.col>i&&(e=Math.max(1,Math.min(t.col-i,80-a)));let s=` `.repeat(a)+`^`.repeat(e);n.message+=`:\n\n${o}\n${s}\n`}}})),q=/* @__PURE__ */ __commonJSMin((e=>{function resolveProps(e,{flow:t,indicator:n,next:r,offset:i,onError:a,parentIndent:o,startOnNewline:s}){let c=!1,l=s,u=s,d=``,f=``,p=!1,m=!1,h=null,g=null,_=null,v=null,y=null,b=null,x=null;for(let i of e)switch(m&&=(i.type!==`space`&&i.type!==`newline`&&i.type!==`comma`&&a(i.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),!1),h&&=(l&&i.type!==`comment`&&i.type!==`newline`&&a(h,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),null),i.type){case`space`:!t&&(n!==`doc-start`||r?.type!==`flow-collection`)&&i.source.includes(` `)&&(h=i),u=!0;break;case`comment`:{u||a(i,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let e=i.source.substring(1)||` `;d?d+=f+e:d=e,f=``,l=!1;break}case`newline`:l?d?d+=i.source:(!b||n!==`seq-item-ind`)&&(c=!0):f+=i.source,l=!0,p=!0,(g||_)&&(v=i),u=!0;break;case`anchor`:g&&a(i,`MULTIPLE_ANCHORS`,`A node can have at most one anchor`),i.source.endsWith(`:`)&&a(i.offset+i.source.length-1,`BAD_ALIAS`,`Anchor ending in : is ambiguous`,!0),g=i,x??=i.offset,l=!1,u=!1,m=!0;break;case`tag`:_&&a(i,`MULTIPLE_TAGS`,`A node can have at most one tag`),_=i,x??=i.offset,l=!1,u=!1,m=!0;break;case n:(g||_)&&a(i,`BAD_PROP_ORDER`,`Anchors and tags must be after the ${i.source} indicator`),b&&a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.source} in ${t??`collection`}`),b=i,l=n===`seq-item-ind`||n===`explicit-key-ind`,u=!1;break;case`comma`:if(t){y&&a(i,`UNEXPECTED_TOKEN`,`Unexpected , in ${t}`),y=i,l=!1,u=!1;break}default:a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.type} token`),l=!1,u=!1}let S=e[e.length-1],C=S?S.offset+S.source.length:i;return m&&r&&r.type!==`space`&&r.type!==`newline`&&r.type!==`comma`&&(r.type!==`scalar`||r.source!==``)&&a(r.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),h&&(l&&h.indent<=o||r?.type===`block-map`||r?.type===`block-seq`)&&a(h,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),{comma:y,found:b,spaceBefore:c,comment:d,hasNewline:p,anchor:g,tag:_,newlineAfterProp:v,end:C,start:x??C}}e.resolveProps=resolveProps})),Le=/* @__PURE__ */ __commonJSMin((e=>{function containsNewline(e){if(!e)return null;switch(e.type){case`alias`:case`scalar`:case`double-quoted-scalar`:case`single-quoted-scalar`:if(e.source.includes(` -`))return!0;if(e.end){for(let t of e.end)if(t.type===`newline`)return!0}return!1;case`flow-collection`:for(let t of e.items){for(let e of t.start)if(e.type===`newline`)return!0;if(t.sep){for(let e of t.sep)if(e.type===`newline`)return!0}if(containsNewline(t.key)||containsNewline(t.value))return!0}return!1;default:return!0}}e.containsNewline=containsNewline})),Re=/* @__PURE__ */ __commonJSMin((e=>{var t=Le();function flowIndentCheck(e,n,r){if(n?.type===`flow-collection`){let i=n.end[0];i.indent===e&&(i.source===`]`||i.source===`}`)&&t.containsNewline(n)&&r(i,`BAD_INDENT`,`Flow end indicator should be more indented than parent`,!0)}}e.flowIndentCheck=flowIndentCheck})),ze=/* @__PURE__ */ __commonJSMin((e=>{var t=O();function mapIncludes(e,n,r){let{uniqueKeys:i}=e.options;if(i===!1)return!1;let a=typeof i==`function`?i:(e,n)=>e===n||t.isScalar(e)&&t.isScalar(n)&&e.value===n.value;return n.some(e=>a(e.key,r))}e.mapIncludes=mapIncludes})),Be=/* @__PURE__ */ __commonJSMin((e=>{var t=R(),n=z(),r=q(),i=Le(),a=Re(),o=ze();let s=`All mapping items must start at the same column`;function resolveBlockMap({composeNode:e,composeEmptyNode:c},l,u,d,f){let p=new((f?.nodeClass)??n.YAMLMap)(l.schema);l.atRoot&&=!1;let m=u.offset,h=null;for(let n of u.items){let{start:f,key:g,sep:_,value:v}=n,y=r.resolveProps(f,{indicator:`explicit-key-ind`,next:g??_?.[0],offset:m,onError:d,parentIndent:u.indent,startOnNewline:!0}),b=!y.found;if(b){if(g&&(g.type===`block-seq`?d(m,`BLOCK_AS_IMPLICIT_KEY`,`A block sequence may not be used as an implicit map key`):`indent`in g&&g.indent!==u.indent&&d(m,`BAD_INDENT`,s)),!y.anchor&&!y.tag&&!_){h=y.end,y.comment&&(p.comment?p.comment+=` +`}e.stringifyDocument=stringifyDocument})),G=/* @__PURE__ */ __commonJSMin((e=>{var t=M(),n=he(),r=k(),i=R(),a=j(),o=Re(),s=ze(),c=fe(),l=pe(),u=P(),d=de(),f=class Document{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,r.NODE_TYPE,{value:r.DOC});let i=null;typeof t==`function`||Array.isArray(t)?i=t:n===void 0&&t&&(n=t,t=void 0);let a=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:`warn`,prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:`1.2`},n);this.options=a;let{version:o}=a;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new d.Directives({version:o}),this.setSchema(o,n),this.contents=e===void 0?null:this.createNode(e,i,n)}clone(){let e=Object.create(Document.prototype,{[r.NODE_TYPE]:{value:r.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=r.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){assertCollection(this.contents)&&this.contents.add(e)}addIn(e,t){assertCollection(this.contents)&&this.contents.addIn(e,t)}createAlias(e,n){if(!e.anchor){let t=c.anchorNames(this);e.anchor=!n||t.has(n)?c.findNewAnchor(n||`a`,t):n}return new t.Alias(e.anchor)}createNode(e,t,n){let i;if(typeof t==`function`)e=t.call({"":e},``,e),i=t;else if(Array.isArray(t)){let e=t.filter(e=>typeof e==`number`||e instanceof String||e instanceof Number).map(String);e.length>0&&(t=t.concat(e)),i=t}else n===void 0&&t&&(n=t,t=void 0);let{aliasDuplicateObjects:a,anchorPrefix:o,flow:s,keepUndefined:l,onTagObj:d,tag:f}=n??{},{onAnchor:p,setAnchors:m,sourceObjects:h}=c.createNodeAnchors(this,o||`a`),g={aliasDuplicateObjects:a??!0,keepUndefined:l??!1,onAnchor:p,onTagObj:d,replacer:i,schema:this.schema,sourceObjects:h},_=u.createNode(e,f,g);return s&&r.isCollection(_)&&(_.flow=!0),m(),_}createPair(e,t,n={}){let r=this.createNode(e,null,n),a=this.createNode(t,null,n);return new i.Pair(r,a)}delete(e){return assertCollection(this.contents)?this.contents.delete(e):!1}deleteIn(e){return n.isEmptyPath(e)?this.contents!=null&&(this.contents=null,!0):assertCollection(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return r.isCollection(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return n.isEmptyPath(e)?!t&&r.isScalar(this.contents)?this.contents.value:this.contents:r.isCollection(this.contents)?this.contents.getIn(e,t):void 0}has(e){return r.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return n.isEmptyPath(e)?this.contents!==void 0:r.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=n.collectionFromPath(this.schema,[e],t):assertCollection(this.contents)&&this.contents.set(e,t)}setIn(e,t){n.isEmptyPath(e)?this.contents=t:this.contents==null?this.contents=n.collectionFromPath(this.schema,Array.from(e),t):assertCollection(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e==`number`&&(e=String(e));let n;switch(e){case`1.1`:this.directives?this.directives.yaml.version=`1.1`:this.directives=new d.Directives({version:`1.1`}),n={resolveKnownTags:!1,schema:`yaml-1.1`};break;case`1.2`:case`next`:this.directives?this.directives.yaml.version=e:this.directives=new d.Directives({version:e}),n={resolveKnownTags:!0,schema:`core`};break;case null:this.directives&&delete this.directives,n=null;break;default:{let t=JSON.stringify(e);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${t}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(n)this.schema=new o.Schema(Object.assign(n,t));else throw Error(`With a null YAML version, the { schema: Schema } option is required`)}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:r,onAnchor:i,reviver:o}={}){let s={anchors:/* @__PURE__ */ new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r==`number`?r:100},c=a.toJS(this.contents,t??``,s);if(typeof i==`function`)for(let{count:e,res:t}of s.anchors.values())i(t,e);return typeof o==`function`?l.applyReviver(o,{"":c},``,c):c}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw Error(`Document with errors cannot be stringified`);if(`indent`in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw Error(`"indent" option must be a positive integer, not ${t}`)}return s.stringifyDocument(this,e)}};function assertCollection(e){if(r.isCollection(e))return!0;throw Error(`Expected a YAML collection as document contents`)}e.Document=f})),K=/* @__PURE__ */ __commonJSMin((e=>{var YAMLError=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},YAMLParseError=class extends YAMLError{constructor(e,t,n){super(`YAMLParseError`,e,t,n)}},YAMLWarning=class extends YAMLError{constructor(e,t,n){super(`YAMLWarning`,e,t,n)}};e.YAMLError=YAMLError,e.YAMLParseError=YAMLParseError,e.YAMLWarning=YAMLWarning,e.prettifyError=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(e=>t.linePos(e));let{line:r,col:i}=n.linePos[0];n.message+=` at line ${r}, column ${i}`;let a=i-1,o=e.substring(t.lineStarts[r-1],t.lineStarts[r]).replace(/[\n\r]+$/,``);if(a>=60&&o.length>80){let e=Math.min(a-39,o.length-79);o=`…`+o.substring(e),a-=e-1}if(o.length>80&&(o=o.substring(0,79)+`…`),r>1&&/^ *$/.test(o.substring(0,a))){let n=e.substring(t.lineStarts[r-2],t.lineStarts[r-1]);n.length>80&&(n=n.substring(0,79)+`… +`),o=n+o}if(/[^ ]/.test(o)){let e=1,t=n.linePos[1];t?.line===r&&t.col>i&&(e=Math.max(1,Math.min(t.col-i,80-a)));let s=` `.repeat(a)+`^`.repeat(e);n.message+=`:\n\n${o}\n${s}\n`}}})),q=/* @__PURE__ */ __commonJSMin((e=>{function resolveProps(e,{flow:t,indicator:n,next:r,offset:i,onError:a,parentIndent:o,startOnNewline:s}){let c=!1,l=s,u=s,d=``,f=``,p=!1,m=!1,h=null,g=null,_=null,v=null,y=null,b=null,x=null;for(let i of e)switch(m&&=(i.type!==`space`&&i.type!==`newline`&&i.type!==`comma`&&a(i.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),!1),h&&=(l&&i.type!==`comment`&&i.type!==`newline`&&a(h,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),null),i.type){case`space`:!t&&(n!==`doc-start`||r?.type!==`flow-collection`)&&i.source.includes(` `)&&(h=i),u=!0;break;case`comment`:{u||a(i,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let e=i.source.substring(1)||` `;d?d+=f+e:d=e,f=``,l=!1;break}case`newline`:l?d?d+=i.source:(!b||n!==`seq-item-ind`)&&(c=!0):f+=i.source,l=!0,p=!0,(g||_)&&(v=i),u=!0;break;case`anchor`:g&&a(i,`MULTIPLE_ANCHORS`,`A node can have at most one anchor`),i.source.endsWith(`:`)&&a(i.offset+i.source.length-1,`BAD_ALIAS`,`Anchor ending in : is ambiguous`,!0),g=i,x??=i.offset,l=!1,u=!1,m=!0;break;case`tag`:_&&a(i,`MULTIPLE_TAGS`,`A node can have at most one tag`),_=i,x??=i.offset,l=!1,u=!1,m=!0;break;case n:(g||_)&&a(i,`BAD_PROP_ORDER`,`Anchors and tags must be after the ${i.source} indicator`),b&&a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.source} in ${t??`collection`}`),b=i,l=n===`seq-item-ind`||n===`explicit-key-ind`,u=!1;break;case`comma`:if(t){y&&a(i,`UNEXPECTED_TOKEN`,`Unexpected , in ${t}`),y=i,l=!1,u=!1;break}default:a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.type} token`),l=!1,u=!1}let S=e[e.length-1],C=S?S.offset+S.source.length:i;return m&&r&&r.type!==`space`&&r.type!==`newline`&&r.type!==`comma`&&(r.type!==`scalar`||r.source!==``)&&a(r.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),h&&(l&&h.indent<=o||r?.type===`block-map`||r?.type===`block-seq`)&&a(h,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),{comma:y,found:b,spaceBefore:c,comment:d,hasNewline:p,anchor:g,tag:_,newlineAfterProp:v,end:C,start:x??C}}e.resolveProps=resolveProps})),Be=/* @__PURE__ */ __commonJSMin((e=>{function containsNewline(e){if(!e)return null;switch(e.type){case`alias`:case`scalar`:case`double-quoted-scalar`:case`single-quoted-scalar`:if(e.source.includes(` +`))return!0;if(e.end){for(let t of e.end)if(t.type===`newline`)return!0}return!1;case`flow-collection`:for(let t of e.items){for(let e of t.start)if(e.type===`newline`)return!0;if(t.sep){for(let e of t.sep)if(e.type===`newline`)return!0}if(containsNewline(t.key)||containsNewline(t.value))return!0}return!1;default:return!0}}e.containsNewline=containsNewline})),Ve=/* @__PURE__ */ __commonJSMin((e=>{var t=Be();function flowIndentCheck(e,n,r){if(n?.type===`flow-collection`){let i=n.end[0];i.indent===e&&(i.source===`]`||i.source===`}`)&&t.containsNewline(n)&&r(i,`BAD_INDENT`,`Flow end indicator should be more indented than parent`,!0)}}e.flowIndentCheck=flowIndentCheck})),He=/* @__PURE__ */ __commonJSMin((e=>{var t=k();function mapIncludes(e,n,r){let{uniqueKeys:i}=e.options;if(i===!1)return!1;let a=typeof i==`function`?i:(e,n)=>e===n||t.isScalar(e)&&t.isScalar(n)&&e.value===n.value;return n.some(e=>a(e.key,r))}e.mapIncludes=mapIncludes})),Ue=/* @__PURE__ */ __commonJSMin((e=>{var t=R(),n=z(),r=q(),i=Be(),a=Ve(),o=He();let s=`All mapping items must start at the same column`;function resolveBlockMap({composeNode:e,composeEmptyNode:c},l,u,d,f){let p=new((f?.nodeClass)??n.YAMLMap)(l.schema);l.atRoot&&=!1;let m=u.offset,h=null;for(let n of u.items){let{start:f,key:g,sep:_,value:v}=n,y=r.resolveProps(f,{indicator:`explicit-key-ind`,next:g??_?.[0],offset:m,onError:d,parentIndent:u.indent,startOnNewline:!0}),b=!y.found;if(b){if(g&&(g.type===`block-seq`?d(m,`BLOCK_AS_IMPLICIT_KEY`,`A block sequence may not be used as an implicit map key`):`indent`in g&&g.indent!==u.indent&&d(m,`BAD_INDENT`,s)),!y.anchor&&!y.tag&&!_){h=y.end,y.comment&&(p.comment?p.comment+=` `+y.comment:p.comment=y.comment);continue}(y.newlineAfterProp||i.containsNewline(g))&&d(g??f[f.length-1],`MULTILINE_IMPLICIT_KEY`,`Implicit keys need to be on a single line`)}else y.found?.indent!==u.indent&&d(m,`BAD_INDENT`,s);l.atKey=!0;let x=y.end,S=g?e(l,g,y,d):c(l,x,f,null,y,d);l.schema.compat&&a.flowIndentCheck(u.indent,g,d),l.atKey=!1,o.mapIncludes(l,p.items,S)&&d(x,`DUPLICATE_KEY`,`Map keys must be unique`);let C=r.resolveProps(_??[],{indicator:`map-value-ind`,next:v,offset:S.range[2],onError:d,parentIndent:u.indent,startOnNewline:!g||g.type===`block-scalar`});if(m=C.end,C.found){b&&(v?.type===`block-map`&&!C.hasNewline&&d(m,`BLOCK_AS_IMPLICIT_KEY`,`Nested mappings are not allowed in compact mappings`),l.options.strict&&y.start{var t=V(),n=q(),r=Re();function resolveBlockSeq({composeNode:e,composeEmptyNode:i},a,o,s,c){let l=new((c?.nodeClass)??t.YAMLSeq)(a.schema);a.atRoot&&=!1,a.atKey&&=!1;let u=o.offset,d=null;for(let{start:t,value:c}of o.items){let f=n.resolveProps(t,{indicator:`seq-item-ind`,next:c,offset:u,onError:s,parentIndent:o.indent,startOnNewline:!0});if(!f.found){if(f.anchor||f.tag||c)c?.type===`block-seq`?s(f.end,`BAD_INDENT`,`All sequence items must start at the same column`):s(u,`MISSING_CHAR`,`Sequence item without - indicator`);else{d=f.end,f.comment&&(l.comment=f.comment);continue}}let p=c?e(a,c,f,s):i(a,f.end,t,null,f,s);a.schema.compat&&r.flowIndentCheck(o.indent,c,s),u=p.range[2],l.items.push(p)}return l.range=[o.offset,u,d??u],l}e.resolveBlockSeq=resolveBlockSeq})),J=/* @__PURE__ */ __commonJSMin((e=>{function resolveEnd(e,t,n,r){let i=``;if(e){let a=!1,o=``;for(let s of e){let{source:e,type:c}=s;switch(c){case`space`:a=!0;break;case`comment`:{n&&!a&&r(s,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let t=e.substring(1)||` `;i?i+=o+t:i=t,o=``;break}case`newline`:i&&(o+=e),a=!0;break;default:r(s,`UNEXPECTED_TOKEN`,`Unexpected ${c} at node end`)}t+=e.length}}return{comment:i,offset:t}}e.resolveEnd=resolveEnd})),He=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=R(),r=z(),i=V(),a=J(),o=q(),s=Le(),c=ze();let l=`Block collections are not allowed within flow collections`,isBlock=e=>e&&(e.type===`block-map`||e.type===`block-seq`);function resolveFlowCollection({composeNode:e,composeEmptyNode:u},d,f,p,m){let h=f.start.source===`{`,g=h?`flow map`:`flow sequence`,_=new((m?.nodeClass)??(h?r.YAMLMap:i.YAMLSeq))(d.schema);_.flow=!0;let v=d.atRoot;v&&(d.atRoot=!1),d.atKey&&=!1;let y=f.offset+f.start.source.length;for(let i=0;i{var t=V(),n=q(),r=Ve();function resolveBlockSeq({composeNode:e,composeEmptyNode:i},a,o,s,c){let l=new((c?.nodeClass)??t.YAMLSeq)(a.schema);a.atRoot&&=!1,a.atKey&&=!1;let u=o.offset,d=null;for(let{start:t,value:c}of o.items){let f=n.resolveProps(t,{indicator:`seq-item-ind`,next:c,offset:u,onError:s,parentIndent:o.indent,startOnNewline:!0});if(!f.found){if(f.anchor||f.tag||c)c?.type===`block-seq`?s(f.end,`BAD_INDENT`,`All sequence items must start at the same column`):s(u,`MISSING_CHAR`,`Sequence item without - indicator`);else{d=f.end,f.comment&&(l.comment=f.comment);continue}}let p=c?e(a,c,f,s):i(a,f.end,t,null,f,s);a.schema.compat&&r.flowIndentCheck(o.indent,c,s),u=p.range[2],l.items.push(p)}return l.range=[o.offset,u,d??u],l}e.resolveBlockSeq=resolveBlockSeq})),J=/* @__PURE__ */ __commonJSMin((e=>{function resolveEnd(e,t,n,r){let i=``;if(e){let a=!1,o=``;for(let s of e){let{source:e,type:c}=s;switch(c){case`space`:a=!0;break;case`comment`:{n&&!a&&r(s,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let t=e.substring(1)||` `;i?i+=o+t:i=t,o=``;break}case`newline`:i&&(o+=e),a=!0;break;default:r(s,`UNEXPECTED_TOKEN`,`Unexpected ${c} at node end`)}t+=e.length}}return{comment:i,offset:t}}e.resolveEnd=resolveEnd})),Ge=/* @__PURE__ */ __commonJSMin((e=>{var t=k(),n=R(),r=z(),i=V(),a=J(),o=q(),s=Be(),c=He();let l=`Block collections are not allowed within flow collections`,isBlock=e=>e&&(e.type===`block-map`||e.type===`block-seq`);function resolveFlowCollection({composeNode:e,composeEmptyNode:u},d,f,p,m){let h=f.start.source===`{`,g=h?`flow map`:`flow sequence`,_=new((m?.nodeClass)??(h?r.YAMLMap:i.YAMLSeq))(d.schema);_.flow=!0;let v=d.atRoot;v&&(d.atRoot=!1),d.atKey&&=!1;let y=f.offset+f.start.source.length;for(let i=0;i0){let e=a.resolveEnd(S,C,d.options.strict,p);e.comment&&(_.comment?_.comment+=` -`+e.comment:_.comment=e.comment),_.range=[f.offset,C,e.offset]}else _.range=[f.offset,C,C];return _}e.resolveFlowCollection=resolveFlowCollection})),Ue=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=N(),r=z(),i=V(),a=Be(),o=Ve(),s=He();function resolveCollection(e,t,n,r,i,c){let l=n.type===`block-map`?a.resolveBlockMap(e,t,n,r,c):n.type===`block-seq`?o.resolveBlockSeq(e,t,n,r,c):s.resolveFlowCollection(e,t,n,r,c),u=l.constructor;return i===`!`||i===u.tagName?(l.tag=u.tagName,l):(i&&(l.tag=i),l)}function composeCollection(e,a,o,s,c){let l=s.tag,u=l?a.directives.tagName(l.source,e=>c(l,`TAG_RESOLVE_FAILED`,e)):null;if(o.type===`block-seq`){let{anchor:e,newlineAfterProp:t}=s,n=e&&l?e.offset>l.offset?e:l:e??l;n&&(!t||t.offsete.tag===u&&e.collection===d);if(!f){let t=a.schema.knownTags[u];if(t?.collection===d)a.schema.tags.push(Object.assign({},t,{default:!1})),f=t;else return t?c(l,`BAD_COLLECTION_TYPE`,`${t.tag} used for ${d} collection, but expects ${t.collection??`scalar`}`,!0):c(l,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${u}`,!0),resolveCollection(e,a,o,c,u)}let p=resolveCollection(e,a,o,c,u,f),m=f.resolve?.(p,e=>c(l,`TAG_RESOLVE_FAILED`,e),a.options)??p,h=t.isNode(m)?m:new n.Scalar(m);return h.range=p.range,h.tag=u,f?.format&&(h.format=f.format),h}e.composeCollection=composeCollection})),We=/* @__PURE__ */ __commonJSMin((e=>{var t=N();function resolveBlockScalar(e,n,r){let i=n.offset,a=parseBlockScalarHeader(n,e.options.strict,r);if(!a)return{value:``,type:null,comment:``,range:[i,i,i]};let o=a.mode===`>`?t.Scalar.BLOCK_FOLDED:t.Scalar.BLOCK_LITERAL,s=n.source?splitLines(n.source):[],c=s.length;for(let e=s.length-1;e>=0;--e){let t=s[e][1];if(t===``||t===`\r`)c=e;else break}if(c===0){let e=a.chomp===`+`&&s.length>0?` +`+e.comment:_.comment=e.comment),_.range=[f.offset,C,e.offset]}else _.range=[f.offset,C,C];return _}e.resolveFlowCollection=resolveFlowCollection})),Ke=/* @__PURE__ */ __commonJSMin((e=>{var t=k(),n=N(),r=z(),i=V(),a=Ue(),o=We(),s=Ge();function resolveCollection(e,t,n,r,i,c){let l=n.type===`block-map`?a.resolveBlockMap(e,t,n,r,c):n.type===`block-seq`?o.resolveBlockSeq(e,t,n,r,c):s.resolveFlowCollection(e,t,n,r,c),u=l.constructor;return i===`!`||i===u.tagName?(l.tag=u.tagName,l):(i&&(l.tag=i),l)}function composeCollection(e,a,o,s,c){let l=s.tag,u=l?a.directives.tagName(l.source,e=>c(l,`TAG_RESOLVE_FAILED`,e)):null;if(o.type===`block-seq`){let{anchor:e,newlineAfterProp:t}=s,n=e&&l?e.offset>l.offset?e:l:e??l;n&&(!t||t.offsete.tag===u&&e.collection===d);if(!f){let t=a.schema.knownTags[u];if(t?.collection===d)a.schema.tags.push(Object.assign({},t,{default:!1})),f=t;else return t?c(l,`BAD_COLLECTION_TYPE`,`${t.tag} used for ${d} collection, but expects ${t.collection??`scalar`}`,!0):c(l,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${u}`,!0),resolveCollection(e,a,o,c,u)}let p=resolveCollection(e,a,o,c,u,f),m=f.resolve?.(p,e=>c(l,`TAG_RESOLVE_FAILED`,e),a.options)??p,h=t.isNode(m)?m:new n.Scalar(m);return h.range=p.range,h.tag=u,f?.format&&(h.format=f.format),h}e.composeCollection=composeCollection})),qe=/* @__PURE__ */ __commonJSMin((e=>{var t=N();function resolveBlockScalar(e,n,r){let i=n.offset,a=parseBlockScalarHeader(n,e.options.strict,r);if(!a)return{value:``,type:null,comment:``,range:[i,i,i]};let o=a.mode===`>`?t.Scalar.BLOCK_FOLDED:t.Scalar.BLOCK_LITERAL,s=n.source?splitLines(n.source):[],c=s.length;for(let e=s.length-1;e>=0;--e){let t=s[e][1];if(t===``||t===`\r`)c=e;else break}if(c===0){let e=a.chomp===`+`&&s.length>0?` `.repeat(Math.max(1,s.length-1)):``,t=i+a.length;return n.source&&(t+=n.source.length),{value:e,type:o,comment:a.comment,range:[i,t,t]}}let l=n.indent+a.indent,u=n.offset+a.length,d=0;for(let t=0;tl&&(l=n.length);else{n.length=c;--e)s[e][0].length>l&&(c=e+1);let f=``,p=``,m=!1;for(let e=0;e{var t=N(),n=J();function resolveFlowScalar(e,r,i){let{offset:a,type:o,source:s,end:c}=e,l,u,_onError=(e,t,n)=>i(a+e,t,n);switch(o){case`scalar`:l=t.Scalar.PLAIN,u=plainValue(s,_onError);break;case`single-quoted-scalar`:l=t.Scalar.QUOTE_SINGLE,u=singleQuotedValue(s,_onError);break;case`double-quoted-scalar`:l=t.Scalar.QUOTE_DOUBLE,u=doubleQuotedValue(s,_onError);break; +default:{r(i,`UNEXPECTED_TOKEN`,`Unexpected token in block scalar header: ${i.type}`);let e=i.source;e&&typeof e==`string`&&(d+=e.length)}}}return{mode:a,indent:o,chomp:s,comment:u,length:d}}function splitLines(e){let t=e.split(/\n( *)/),n=t[0],r=n.match(/^( *)/),i=[r?.[1]?[r[1],n.slice(r[1].length)]:[``,n]];for(let e=1;e{var t=N(),n=J();function resolveFlowScalar(e,r,i){let{offset:a,type:o,source:s,end:c}=e,l,u,_onError=(e,t,n)=>i(a+e,t,n);switch(o){case`scalar`:l=t.Scalar.PLAIN,u=plainValue(s,_onError);break;case`single-quoted-scalar`:l=t.Scalar.QUOTE_SINGLE,u=singleQuotedValue(s,_onError);break;case`double-quoted-scalar`:l=t.Scalar.QUOTE_DOUBLE,u=doubleQuotedValue(s,_onError);break; /* istanbul ignore next should not happen */ default:return i(e,`UNEXPECTED_TOKEN`,`Expected a flow scalar value, but found: ${o}`),{value:``,type:null,comment:``,range:[a,a+s.length,a+s.length]}}let d=a+s.length,f=n.resolveEnd(c,d,r,i);return{value:u,type:l,comment:f.comment,range:[a,d,f.offset]}}function plainValue(e,t){let n=``;switch(e[0]){ /* istanbul ignore next should not happen */ @@ -86,10 +86,10 @@ case` `:n=`a tab character`;break;case`,`:n=`flow indicator character ,`;break;c `);)r===` `&&(n+=` `),t+=1,r=e[t+1];return n||=` `,{fold:n,offset:t}}let r={0:`\0`,a:`\x07`,b:`\b`,e:`\x1B`,f:`\f`,n:` -`,r:`\r`,t:` `,v:`\v`,N:`…`,_:`\xA0`,L:`\u2028`,P:`\u2029`," ":` `,'"':`"`,"/":`/`,"\\":`\\`," ":` `};function parseCharCode(e,t,n,r){let i=e.substr(t,n),a=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(a)}catch{let i=e.substr(t-2,n+2);return r(t-2,`BAD_DQ_ESCAPE`,`Invalid escape sequence ${i}`),i}}e.resolveFlowScalar=resolveFlowScalar})),Ke=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=N(),r=We(),i=Ge();function composeScalar(e,a,o,s){let{value:c,type:l,comment:u,range:d}=a.type===`block-scalar`?r.resolveBlockScalar(e,a,s):i.resolveFlowScalar(a,e.options.strict,s),f=o?e.directives.tagName(o.source,e=>s(o,`TAG_RESOLVE_FAILED`,e)):null,p;p=e.options.stringKeys&&e.atKey?e.schema[t.SCALAR]:f?findScalarTagByName(e.schema,c,f,o,s):a.type===`scalar`?findScalarTagByTest(e,c,a,s):e.schema[t.SCALAR];let m;try{let r=p.resolve(c,e=>s(o??a,`TAG_RESOLVE_FAILED`,e),e.options);m=t.isScalar(r)?r:new n.Scalar(r)}catch(e){let t=e instanceof Error?e.message:String(e);s(o??a,`TAG_RESOLVE_FAILED`,t),m=new n.Scalar(c)}return m.range=d,m.source=c,l&&(m.type=l),f&&(m.tag=f),p.format&&(m.format=p.format),u&&(m.comment=u),m}function findScalarTagByName(e,n,r,i,a){if(r===`!`)return e[t.SCALAR];let o=[];for(let t of e.tags)if(!t.collection&&t.tag===r){if(t.default&&t.test)o.push(t);else return t}for(let e of o)if(e.test?.test(n))return e;let s=e.knownTags[r];return s&&!s.collection?(e.tags.push(Object.assign({},s,{default:!1,test:void 0})),s):(a(i,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${r}`,r!==`tag:yaml.org,2002:str`),e[t.SCALAR])}function findScalarTagByTest({atKey:e,directives:n,schema:r},i,a,o){let s=r.tags.find(t=>(t.default===!0||e&&t.default===`key`)&&t.test?.test(i))||r[t.SCALAR];if(r.compat){let e=r.compat.find(e=>e.default&&e.test?.test(i))??r[t.SCALAR];s.tag!==e.tag&&o(a,`TAG_RESOLVE_FAILED`,`Value may be parsed as either ${n.tagString(s.tag)} or ${n.tagString(e.tag)}`,!0)}return s}e.composeScalar=composeScalar})),qe=/* @__PURE__ */ __commonJSMin((e=>{function emptyScalarPosition(e,t,n){if(t){n??=t.length;for(let r=n-1;r>=0;--r){let n=t[r];switch(n.type){case`space`:case`comment`:case`newline`:e-=n.source.length;continue}for(n=t[++r];n?.type===`space`;)e+=n.source.length,n=t[++r];break}}return e}e.emptyScalarPosition=emptyScalarPosition})),Je=/* @__PURE__ */ __commonJSMin((e=>{var t=M(),n=O(),r=Ue(),i=Ke(),a=J(),o=qe();let s={composeNode,composeEmptyNode};function composeNode(e,t,a,o){let c=e.atKey,{spaceBefore:l,comment:u,anchor:d,tag:f}=a,p,m=!0;switch(t.type){case`alias`:p=composeAlias(e,t,o),(d||f)&&o(t,`ALIAS_PROPS`,`An alias node must not specify any properties`);break;case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:case`block-scalar`:p=i.composeScalar(e,t,f,o),d&&(p.anchor=d.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:try{p=r.composeCollection(s,e,t,a,o),d&&(p.anchor=d.source.substring(1))}catch(e){o(t,`RESOURCE_EXHAUSTION`,e instanceof Error?e.message:String(e))}break;default:o(t,`UNEXPECTED_TOKEN`,t.type===`error`?t.message:`Unsupported token (type: ${t.type})`),m=!1}return p??=composeEmptyNode(e,t.offset,void 0,null,a,o),d&&p.anchor===``&&o(d,`BAD_ALIAS`,`Anchor cannot be an empty string`),c&&e.options.stringKeys&&(!n.isScalar(p)||typeof p.value!=`string`||p.tag&&p.tag!==`tag:yaml.org,2002:str`)&&o(f??t,`NON_STRING_KEY`,`With stringKeys, all keys must be strings`),l&&(p.spaceBefore=!0),u&&(t.type===`scalar`&&t.source===``?p.comment=u:p.commentBefore=u),e.options.keepSourceTokens&&m&&(p.srcToken=t),p}function composeEmptyNode(e,t,n,r,{spaceBefore:a,comment:s,anchor:c,tag:l,end:u},d){let f={type:`scalar`,offset:o.emptyScalarPosition(t,n,r),indent:-1,source:``},p=i.composeScalar(e,f,l,d);return c&&(p.anchor=c.source.substring(1),p.anchor===``&&d(c,`BAD_ALIAS`,`Anchor cannot be an empty string`)),a&&(p.spaceBefore=!0),s&&(p.comment=s,p.range[2]=u),p}function composeAlias({options:e},{offset:n,source:r,end:i},o){let s=new t.Alias(r.substring(1));s.source===``&&o(n,`BAD_ALIAS`,`Alias cannot be an empty string`),s.source.endsWith(`:`)&&o(n+r.length-1,`BAD_ALIAS`,`Alias ending in : is ambiguous`,!0);let c=n+r.length,l=a.resolveEnd(i,c,e.strict,o);return s.range=[n,c,l.offset],l.comment&&(s.comment=l.comment),s}e.composeEmptyNode=composeEmptyNode,e.composeNode=composeNode})),Ye=/* @__PURE__ */ __commonJSMin((e=>{var t=G(),n=Je(),r=J(),i=q();function composeDoc(e,a,{offset:o,start:s,value:c,end:l},u){let d=Object.assign({_directives:a},e),f=new t.Document(void 0,d),p={atKey:!1,atRoot:!0,directives:f.directives,options:f.options,schema:f.schema},m=i.resolveProps(s,{indicator:`doc-start`,next:c??l?.[0],offset:o,onError:u,parentIndent:0,startOnNewline:!0});m.found&&(f.directives.docStart=!0,c&&(c.type===`block-map`||c.type===`block-seq`)&&!m.hasNewline&&u(m.end,`MISSING_CHAR`,`Block collection cannot start on same line with directives-end marker`)),f.contents=c?n.composeNode(p,c,m,u):n.composeEmptyNode(p,m.end,s,null,m,u);let h=f.contents.range[2],g=r.resolveEnd(l,h,!1,u);return g.comment&&(f.comment=g.comment),f.range=[o,h,g.offset],f}e.composeDoc=composeDoc})),Xe=/* @__PURE__ */ __commonJSMin((e=>{var t=D(`process`),n=le(),r=G(),i=K(),a=O(),o=Ye(),s=J();function getErrorPos(e){if(typeof e==`number`)return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:n}=e;return[t,t+(typeof n==`string`?n.length:1)]}function parsePrelude(e){let t=``,n=!1,r=!1;for(let i=0;i{var t=k(),n=N(),r=qe(),i=Je();function composeScalar(e,a,o,s){let{value:c,type:l,comment:u,range:d}=a.type===`block-scalar`?r.resolveBlockScalar(e,a,s):i.resolveFlowScalar(a,e.options.strict,s),f=o?e.directives.tagName(o.source,e=>s(o,`TAG_RESOLVE_FAILED`,e)):null,p;p=e.options.stringKeys&&e.atKey?e.schema[t.SCALAR]:f?findScalarTagByName(e.schema,c,f,o,s):a.type===`scalar`?findScalarTagByTest(e,c,a,s):e.schema[t.SCALAR];let m;try{let r=p.resolve(c,e=>s(o??a,`TAG_RESOLVE_FAILED`,e),e.options);m=t.isScalar(r)?r:new n.Scalar(r)}catch(e){let t=e instanceof Error?e.message:String(e);s(o??a,`TAG_RESOLVE_FAILED`,t),m=new n.Scalar(c)}return m.range=d,m.source=c,l&&(m.type=l),f&&(m.tag=f),p.format&&(m.format=p.format),u&&(m.comment=u),m}function findScalarTagByName(e,n,r,i,a){if(r===`!`)return e[t.SCALAR];let o=[];for(let t of e.tags)if(!t.collection&&t.tag===r){if(t.default&&t.test)o.push(t);else return t}for(let e of o)if(e.test?.test(n))return e;let s=e.knownTags[r];return s&&!s.collection?(e.tags.push(Object.assign({},s,{default:!1,test:void 0})),s):(a(i,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${r}`,r!==`tag:yaml.org,2002:str`),e[t.SCALAR])}function findScalarTagByTest({atKey:e,directives:n,schema:r},i,a,o){let s=r.tags.find(t=>(t.default===!0||e&&t.default===`key`)&&t.test?.test(i))||r[t.SCALAR];if(r.compat){let e=r.compat.find(e=>e.default&&e.test?.test(i))??r[t.SCALAR];s.tag!==e.tag&&o(a,`TAG_RESOLVE_FAILED`,`Value may be parsed as either ${n.tagString(s.tag)} or ${n.tagString(e.tag)}`,!0)}return s}e.composeScalar=composeScalar})),Xe=/* @__PURE__ */ __commonJSMin((e=>{function emptyScalarPosition(e,t,n){if(t){n??=t.length;for(let r=n-1;r>=0;--r){let n=t[r];switch(n.type){case`space`:case`comment`:case`newline`:e-=n.source.length;continue}for(n=t[++r];n?.type===`space`;)e+=n.source.length,n=t[++r];break}}return e}e.emptyScalarPosition=emptyScalarPosition})),Ze=/* @__PURE__ */ __commonJSMin((e=>{var t=M(),n=k(),r=Ke(),i=Ye(),a=J(),o=Xe();let s={composeNode,composeEmptyNode};function composeNode(e,t,a,o){let c=e.atKey,{spaceBefore:l,comment:u,anchor:d,tag:f}=a,p,m=!0;switch(t.type){case`alias`:p=composeAlias(e,t,o),(d||f)&&o(t,`ALIAS_PROPS`,`An alias node must not specify any properties`);break;case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:case`block-scalar`:p=i.composeScalar(e,t,f,o),d&&(p.anchor=d.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:try{p=r.composeCollection(s,e,t,a,o),d&&(p.anchor=d.source.substring(1))}catch(e){o(t,`RESOURCE_EXHAUSTION`,e instanceof Error?e.message:String(e))}break;default:o(t,`UNEXPECTED_TOKEN`,t.type===`error`?t.message:`Unsupported token (type: ${t.type})`),m=!1}return p??=composeEmptyNode(e,t.offset,void 0,null,a,o),d&&p.anchor===``&&o(d,`BAD_ALIAS`,`Anchor cannot be an empty string`),c&&e.options.stringKeys&&(!n.isScalar(p)||typeof p.value!=`string`||p.tag&&p.tag!==`tag:yaml.org,2002:str`)&&o(f??t,`NON_STRING_KEY`,`With stringKeys, all keys must be strings`),l&&(p.spaceBefore=!0),u&&(t.type===`scalar`&&t.source===``?p.comment=u:p.commentBefore=u),e.options.keepSourceTokens&&m&&(p.srcToken=t),p}function composeEmptyNode(e,t,n,r,{spaceBefore:a,comment:s,anchor:c,tag:l,end:u},d){let f={type:`scalar`,offset:o.emptyScalarPosition(t,n,r),indent:-1,source:``},p=i.composeScalar(e,f,l,d);return c&&(p.anchor=c.source.substring(1),p.anchor===``&&d(c,`BAD_ALIAS`,`Anchor cannot be an empty string`)),a&&(p.spaceBefore=!0),s&&(p.comment=s,p.range[2]=u),p}function composeAlias({options:e},{offset:n,source:r,end:i},o){let s=new t.Alias(r.substring(1));s.source===``&&o(n,`BAD_ALIAS`,`Alias cannot be an empty string`),s.source.endsWith(`:`)&&o(n+r.length-1,`BAD_ALIAS`,`Alias ending in : is ambiguous`,!0);let c=n+r.length,l=a.resolveEnd(i,c,e.strict,o);return s.range=[n,c,l.offset],l.comment&&(s.comment=l.comment),s}e.composeEmptyNode=composeEmptyNode,e.composeNode=composeNode})),Qe=/* @__PURE__ */ __commonJSMin((e=>{var t=G(),n=Ze(),r=J(),i=q();function composeDoc(e,a,{offset:o,start:s,value:c,end:l},u){let d=Object.assign({_directives:a},e),f=new t.Document(void 0,d),p={atKey:!1,atRoot:!0,directives:f.directives,options:f.options,schema:f.schema},m=i.resolveProps(s,{indicator:`doc-start`,next:c??l?.[0],offset:o,onError:u,parentIndent:0,startOnNewline:!0});m.found&&(f.directives.docStart=!0,c&&(c.type===`block-map`||c.type===`block-seq`)&&!m.hasNewline&&u(m.end,`MISSING_CHAR`,`Block collection cannot start on same line with directives-end marker`)),f.contents=c?n.composeNode(p,c,m,u):n.composeEmptyNode(p,m.end,s,null,m,u);let h=f.contents.range[2],g=r.resolveEnd(l,h,!1,u);return g.comment&&(f.comment=g.comment),f.range=[o,h,g.offset],f}e.composeDoc=composeDoc})),$e=/* @__PURE__ */ __commonJSMin((e=>{var t=O(`process`),n=de(),r=G(),i=K(),a=k(),o=Qe(),s=J();function getErrorPos(e){if(typeof e==`number`)return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:n}=e;return[t,t+(typeof n==`string`?n.length:1)]}function parsePrelude(e){let t=``,n=!1,r=!1;for(let i=0;i{let a=getErrorPos(e);r?this.warnings.push(new i.YAMLWarning(a,t,n)):this.errors.push(new i.YAMLParseError(a,t,n))},this.directives=new n.Directives({version:e.version||`1.2`}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=parsePrelude(this.prelude);if(n){let i=e.contents;if(t)e.comment=e.comment?`${e.comment}\n${n}`:n;else if(r||e.directives.docStart||!i)e.commentBefore=n;else if(a.isCollection(i)&&!i.flow&&i.items.length>0){let e=i.items[0];a.isPair(e)&&(e=e.key);let t=e.commentBefore;e.commentBefore=t?`${n}\n${t}`:n}else{let e=i.commentBefore;i.commentBefore=e?`${n}\n${e}`:n}}if(t){for(let t=0;t{let i=getErrorPos(e);i[0]+=t,this.onError(i,`BAD_DIRECTIVE`,n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case`document`:{let t=o.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,`MISSING_CHAR`,`Missing directives-end/doc-start indicator line`),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case`byte-order-mark`:case`space`:break;case`comment`:case`newline`:this.prelude.push(e.source);break;case`error`:{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new i.YAMLParseError(getErrorPos(e),`UNEXPECTED_TOKEN`,t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case`doc-end`:{if(!this.doc){this.errors.push(new i.YAMLParseError(getErrorPos(e),`UNEXPECTED_TOKEN`,`Unexpected doc-end without preceding document`));break}this.doc.directives.docEnd=!0;let t=s.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let e=this.doc.comment;this.doc.comment=e?`${e}\n${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new i.YAMLParseError(getErrorPos(e),`UNEXPECTED_TOKEN`,`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let e=Object.assign({_directives:this.directives},this.options),n=new r.Document(void 0,e);this.atDirectives&&this.onError(t,`MISSING_CHAR`,`Missing directives-end indicator line`),n.range=[0,t,t],this.decorate(n,!1),yield n}}}})),Ze=/* @__PURE__ */ __commonJSMin((e=>{var t=We(),n=Ge(),r=K(),i=I();function resolveAsScalar(e,i=!0,a){if(e){let _onError=(e,t,n)=>{let i=typeof e==`number`?e:Array.isArray(e)?e[0]:e.offset;if(a)a(i,t,n);else throw new r.YAMLParseError([i,i+1],t,n)};switch(e.type){case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return n.resolveFlowScalar(e,i,_onError);case`block-scalar`:return t.resolveBlockScalar({options:{strict:i}},e,_onError)}}return null}function createScalarToken(e,t){let{implicitKey:n=!1,indent:r,inFlow:a=!1,offset:o=-1,type:s=`PLAIN`}=t,c=i.stringifyString({type:s,value:e},{implicitKey:n,indent:r>0?` `.repeat(r):``,inFlow:a,options:{blockQuote:!0,lineWidth:-1}}),l=t.end??[{type:`newline`,offset:-1,indent:r,source:` +`)+(a.substring(1)||` `),n=!0,r=!1;break;case`%`:e[i+1]?.[0]!==`#`&&(i+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:t,afterEmptyLine:r}}e.Composer=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,n,r)=>{let a=getErrorPos(e);r?this.warnings.push(new i.YAMLWarning(a,t,n)):this.errors.push(new i.YAMLParseError(a,t,n))},this.directives=new n.Directives({version:e.version||`1.2`}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=parsePrelude(this.prelude);if(n){let i=e.contents;if(t)e.comment=e.comment?`${e.comment}\n${n}`:n;else if(r||e.directives.docStart||!i)e.commentBefore=n;else if(a.isCollection(i)&&!i.flow&&i.items.length>0){let e=i.items[0];a.isPair(e)&&(e=e.key);let t=e.commentBefore;e.commentBefore=t?`${n}\n${t}`:n}else{let e=i.commentBefore;i.commentBefore=e?`${n}\n${e}`:n}}if(t){for(let t=0;t{let i=getErrorPos(e);i[0]+=t,this.onError(i,`BAD_DIRECTIVE`,n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case`document`:{let t=o.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,`MISSING_CHAR`,`Missing directives-end/doc-start indicator line`),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case`byte-order-mark`:case`space`:break;case`comment`:case`newline`:this.prelude.push(e.source);break;case`error`:{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new i.YAMLParseError(getErrorPos(e),`UNEXPECTED_TOKEN`,t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case`doc-end`:{if(!this.doc){this.errors.push(new i.YAMLParseError(getErrorPos(e),`UNEXPECTED_TOKEN`,`Unexpected doc-end without preceding document`));break}this.doc.directives.docEnd=!0;let t=s.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let e=this.doc.comment;this.doc.comment=e?`${e}\n${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new i.YAMLParseError(getErrorPos(e),`UNEXPECTED_TOKEN`,`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let e=Object.assign({_directives:this.directives},this.options),n=new r.Document(void 0,e);this.atDirectives&&this.onError(t,`MISSING_CHAR`,`Missing directives-end indicator line`),n.range=[0,t,t],this.decorate(n,!1),yield n}}}})),et=/* @__PURE__ */ __commonJSMin((e=>{var t=qe(),n=Je(),r=K(),i=I();function resolveAsScalar(e,i=!0,a){if(e){let _onError=(e,t,n)=>{let i=typeof e==`number`?e:Array.isArray(e)?e[0]:e.offset;if(a)a(i,t,n);else throw new r.YAMLParseError([i,i+1],t,n)};switch(e.type){case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return n.resolveFlowScalar(e,i,_onError);case`block-scalar`:return t.resolveBlockScalar({options:{strict:i}},e,_onError)}}return null}function createScalarToken(e,t){let{implicitKey:n=!1,indent:r,inFlow:a=!1,offset:o=-1,type:s=`PLAIN`}=t,c=i.stringifyString({type:s,value:e},{implicitKey:n,indent:r>0?` `.repeat(r):``,inFlow:a,options:{blockQuote:!0,lineWidth:-1}}),l=t.end??[{type:`newline`,offset:-1,indent:r,source:` `}];switch(c[0]){case`|`:case`>`:{let e=c.indexOf(` `),t=c.substring(0,e),n=c.substring(e+1)+` `,i=[{type:`block-scalar-header`,offset:o,indent:r,source:t}];return addEndtoBlockProps(i,l)||i.push({type:`newline`,offset:-1,indent:r,source:` @@ -97,11 +97,11 @@ case` `:n=`a tab character`;break;case`,`:n=`flow indicator character ,`;break;c `),r=t.substring(0,n),i=t.substring(n+1)+` `;if(e.type===`block-scalar`){let t=e.props[0];if(t.type!==`block-scalar-header`)throw Error(`Invalid block scalar header`);t.source=r,e.source=i}else{let{offset:t}=e,n=`indent`in e?e.indent:-1,a=[{type:`block-scalar-header`,offset:t,indent:n,source:r}];addEndtoBlockProps(a,`end`in e?e.end:void 0)||a.push({type:`newline`,offset:-1,indent:n,source:` `});for(let t of Object.keys(e))t!==`type`&&t!==`offset`&&delete e[t];Object.assign(e,{type:`block-scalar`,indent:n,props:a,source:i})}}function addEndtoBlockProps(e,t){if(t)for(let n of t)switch(n.type){case`space`:case`comment`:e.push(n);break;case`newline`:return e.push(n),!0}return!1}function setFlowScalarValue(e,t,n){switch(e.type){case`scalar`:case`double-quoted-scalar`:case`single-quoted-scalar`:e.type=n,e.source=t;break;case`block-scalar`:{let r=e.props.slice(1),i=t.length;e.props[0].type===`block-scalar-header`&&(i-=e.props[0].source.length);for(let e of r)e.offset+=i;delete e.props,Object.assign(e,{type:n,source:t,end:r});break}case`block-map`:case`block-seq`:{let r={type:`newline`,offset:e.offset+t.length,indent:e.indent,source:` -`};delete e.items,Object.assign(e,{type:n,source:t,end:[r]});break}default:{let r=`indent`in e?e.indent:-1,i=`end`in e&&Array.isArray(e.end)?e.end.filter(e=>e.type===`space`||e.type===`comment`||e.type===`newline`):[];for(let t of Object.keys(e))t!==`type`&&t!==`offset`&&delete e[t];Object.assign(e,{type:n,indent:r,source:t,end:i})}}}e.createScalarToken=createScalarToken,e.resolveAsScalar=resolveAsScalar,e.setScalarValue=setScalarValue})),Qe=/* @__PURE__ */ __commonJSMin((e=>{let stringify=e=>`type`in e?stringifyToken(e):stringifyItem(e);function stringifyToken(e){switch(e.type){case`block-scalar`:{let t=``;for(let n of e.props)t+=stringifyToken(n);return t+e.source}case`block-map`:case`block-seq`:{let t=``;for(let n of e.items)t+=stringifyItem(n);return t}case`flow-collection`:{let t=e.start.source;for(let n of e.items)t+=stringifyItem(n);for(let n of e.end)t+=n.source;return t}case`document`:{let t=stringifyItem(e);if(e.end)for(let n of e.end)t+=n.source;return t}default:{let t=e.source;if(`end`in e&&e.end)for(let n of e.end)t+=n.source;return t}}}function stringifyItem({start:e,key:t,sep:n,value:r}){let i=``;for(let t of e)i+=t.source;if(t&&(i+=stringifyToken(t)),n)for(let e of n)i+=e.source;return r&&(i+=stringifyToken(r)),i}e.stringify=stringify})),$e=/* @__PURE__ */ __commonJSMin((e=>{let t=Symbol(`break visit`),n=Symbol(`skip children`),r=Symbol(`remove item`);function visit(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),_visit(Object.freeze([]),e,t)}visit.BREAK=t,visit.SKIP=n,visit.REMOVE=r,visit.itemAtPath=(e,t)=>{let n=e;for(let[e,r]of t){let t=n?.[e];if(t&&`items`in t)n=t.items[r];else return}return n},visit.parentCollection=(e,t)=>{let n=visit.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n?.[r];if(i&&`items`in i)return i;throw Error(`Parent collection not found`)};function _visit(e,n,i){let a=i(n,e);if(typeof a==`symbol`)return a;for(let o of[`key`,`value`]){let s=n[o];if(s&&`items`in s){for(let n=0;n{var t=Ze(),n=Qe(),r=$e();let isCollection=e=>!!e&&`items`in e,isScalar=e=>!!e&&(e.type===`scalar`||e.type===`single-quoted-scalar`||e.type===`double-quoted-scalar`||e.type===`block-scalar`); +`};delete e.items,Object.assign(e,{type:n,source:t,end:[r]});break}default:{let r=`indent`in e?e.indent:-1,i=`end`in e&&Array.isArray(e.end)?e.end.filter(e=>e.type===`space`||e.type===`comment`||e.type===`newline`):[];for(let t of Object.keys(e))t!==`type`&&t!==`offset`&&delete e[t];Object.assign(e,{type:n,indent:r,source:t,end:i})}}}e.createScalarToken=createScalarToken,e.resolveAsScalar=resolveAsScalar,e.setScalarValue=setScalarValue})),tt=/* @__PURE__ */ __commonJSMin((e=>{let stringify=e=>`type`in e?stringifyToken(e):stringifyItem(e);function stringifyToken(e){switch(e.type){case`block-scalar`:{let t=``;for(let n of e.props)t+=stringifyToken(n);return t+e.source}case`block-map`:case`block-seq`:{let t=``;for(let n of e.items)t+=stringifyItem(n);return t}case`flow-collection`:{let t=e.start.source;for(let n of e.items)t+=stringifyItem(n);for(let n of e.end)t+=n.source;return t}case`document`:{let t=stringifyItem(e);if(e.end)for(let n of e.end)t+=n.source;return t}default:{let t=e.source;if(`end`in e&&e.end)for(let n of e.end)t+=n.source;return t}}}function stringifyItem({start:e,key:t,sep:n,value:r}){let i=``;for(let t of e)i+=t.source;if(t&&(i+=stringifyToken(t)),n)for(let e of n)i+=e.source;return r&&(i+=stringifyToken(r)),i}e.stringify=stringify})),nt=/* @__PURE__ */ __commonJSMin((e=>{let t=Symbol(`break visit`),n=Symbol(`skip children`),r=Symbol(`remove item`);function visit(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),_visit(Object.freeze([]),e,t)}visit.BREAK=t,visit.SKIP=n,visit.REMOVE=r,visit.itemAtPath=(e,t)=>{let n=e;for(let[e,r]of t){let t=n?.[e];if(t&&`items`in t)n=t.items[r];else return}return n},visit.parentCollection=(e,t)=>{let n=visit.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n?.[r];if(i&&`items`in i)return i;throw Error(`Parent collection not found`)};function _visit(e,n,i){let a=i(n,e);if(typeof a==`symbol`)return a;for(let o of[`key`,`value`]){let s=n[o];if(s&&`items`in s){for(let n=0;n{var t=et(),n=tt(),r=nt();let isCollection=e=>!!e&&`items`in e,isScalar=e=>!!e&&(e.type===`scalar`||e.type===`single-quoted-scalar`||e.type===`double-quoted-scalar`||e.type===`block-scalar`); /* istanbul ignore next */ function prettyToken(e){switch(e){case``:return``;case``:return``;case``:return``;case``:return``;default:return JSON.stringify(e)}}function tokenType(e){switch(e){case``:return`byte-order-mark`;case``:return`doc-mode`;case``:return`flow-error-end`;case``:return`scalar`;case`---`:return`doc-start`;case`...`:return`doc-end`;case``:case` `:case`\r -`:return`newline`;case`-`:return`seq-item-ind`;case`?`:return`explicit-key-ind`;case`:`:return`map-value-ind`;case`{`:return`flow-map-start`;case`}`:return`flow-map-end`;case`[`:return`flow-seq-start`;case`]`:return`flow-seq-end`;case`,`:return`comma`}switch(e[0]){case` `:case` `:return`space`;case`#`:return`comment`;case`%`:return`directive-line`;case`*`:return`alias`;case`&`:return`anchor`;case`!`:return`tag`;case`'`:return`single-quoted-scalar`;case`"`:return`double-quoted-scalar`;case`|`:case`>`:return`block-scalar-header`}return null}e.createScalarToken=t.createScalarToken,e.resolveAsScalar=t.resolveAsScalar,e.setScalarValue=t.setScalarValue,e.stringify=n.stringify,e.visit=r.visit,e.BOM=``,e.DOCUMENT=``,e.FLOW_END=``,e.SCALAR=``,e.isCollection=isCollection,e.isScalar=isScalar,e.prettyToken=prettyToken,e.tokenType=tokenType})),tt=/* @__PURE__ */ __commonJSMin((e=>{var t=et();function isEmpty(e){switch(e){case void 0:case` `:case` +`:return`newline`;case`-`:return`seq-item-ind`;case`?`:return`explicit-key-ind`;case`:`:return`map-value-ind`;case`{`:return`flow-map-start`;case`}`:return`flow-map-end`;case`[`:return`flow-seq-start`;case`]`:return`flow-seq-end`;case`,`:return`comma`}switch(e[0]){case` `:case` `:return`space`;case`#`:return`comment`;case`%`:return`directive-line`;case`*`:return`alias`;case`&`:return`anchor`;case`!`:return`tag`;case`'`:return`single-quoted-scalar`;case`"`:return`double-quoted-scalar`;case`|`:case`>`:return`block-scalar-header`}return null}e.createScalarToken=t.createScalarToken,e.resolveAsScalar=t.resolveAsScalar,e.setScalarValue=t.setScalarValue,e.stringify=n.stringify,e.visit=r.visit,e.BOM=``,e.DOCUMENT=``,e.FLOW_END=``,e.SCALAR=``,e.isCollection=isCollection,e.isScalar=isScalar,e.prettyToken=prettyToken,e.tokenType=tokenType})),it=/* @__PURE__ */ __commonJSMin((e=>{var t=rt();function isEmpty(e){switch(e){case void 0:case` `:case` `:case`\r`:case` `:return!0;default:return!1}}let n=/* @__PURE__ */ new Set(`0123456789ABCDEFabcdef`),r=/* @__PURE__ */ new Set(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()`),i=/* @__PURE__ */ new Set(`,[]{}`),a=/* @__PURE__ */ new Set(` ,[]{} \r `),isNotAnchorChar=e=>!e||a.has(e);e.Lexer=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer=``,this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){if(e){if(typeof e!=`string`)throw TypeError(`source is not a string`);this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let n=this.next??`stream`;for(;n&&(t||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===` `||t===` `;)t=this.buffer[++e];return!t||t===`#`||t===` `||t===`\r`&&this.buffer[e+1]===` @@ -120,7 +120,7 @@ function prettyToken(e){switch(e){case``:return``;case``:return``; `,t=this.buffer[r+1]):n=r),t===`#`||e&&i.has(t))break;if(a===` `){let e=this.continueScalar(r+1);if(e===-1)break;r=Math.max(r,e-2)}}else{if(e&&i.has(a))break;n=r}return!a&&!this.atEnd?this.setNext(`plain-scalar`):(yield t.SCALAR,yield*this.pushToIndex(n+1,!0),e?`flow`:`doc`)}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(t&&(yield``),0)}*pushIndicators(){let e=0;loop:for(;;){switch(this.charAt(0)){case`!`:e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue loop;case`&`:e+=yield*this.pushUntil(isNotAnchorChar),e+=yield*this.pushSpaces(!0);continue loop;case`-`:case`?`:case`:`:{let t=this.flowLevel>0,n=this.charAt(1);if(isEmpty(n)||t&&i.has(n)){t?this.flowKey&&=!1:this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue loop}}}break loop}return e}*pushTag(){if(this.charAt(1)===`<`){let e=this.pos+2,t=this.buffer[e];for(;!isEmpty(t)&&t!==`>`;)t=this.buffer[++e];return yield*this.pushToIndex(t===`>`?e+1:e,!1)}{let e=this.pos+1,t=this.buffer[e];for(;t;)if(r.has(t))t=this.buffer[++e];else if(t===`%`&&n.has(this.buffer[e+1])&&n.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===` `?yield*this.pushCount(1):e===`\r`&&this.charAt(1)===` -`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,n;do n=this.buffer[++t];while(n===` `||e&&n===` `);let r=t-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=t),r}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}}})),nt=/* @__PURE__ */ __commonJSMin((e=>{e.LineCounter=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t>1;this.lineStarts[r]{var t=D(`process`),n=et(),r=tt();function includesToken(e,t){for(let n=0;n0&&(yield this.buffer.substr(this.pos,r),this.pos=t),r}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}}})),at=/* @__PURE__ */ __commonJSMin((e=>{e.LineCounter=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t>1;this.lineStarts[r]{var t=O(`process`),n=rt(),r=it();function includesToken(e,t){for(let n=0;n=0;)switch(e[t].type){case`doc-start`:case`explicit-key-ind`:case`map-value-ind`:case`seq-item-ind`:case`newline`:break loop}for(;e[++t]?.type===`space`;);return e.splice(t,e.length)}function arrayPushArray(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let n=0;n0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type===`doc-end`&&e?.type!==`doc-end`){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:`doc-end`,offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case`document`:return yield*this.document(e);case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return yield*this.scalar(e);case`block-scalar`:return yield*this.blockScalar(e);case`block-map`:return yield*this.blockMap(e);case`block-seq`:return yield*this.blockSequence(e);case`flow-collection`:return yield*this.flowCollection(e);case`doc-end`:return yield*this.documentEnd(e)} /* istanbul ignore next should not happen */ @@ -136,9 +136,9 @@ default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.l /* istanbul ignore else should not happen */ n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let t=this.peek(2);if(t.type===`block-map`&&(this.type===`map-value-ind`&&t.indent===e.indent||this.type===`newline`&&!t.items[t.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type===`map-value-ind`&&t.type!==`flow-collection`){let n=getFirstKeyStartProps(getPrevProps(t));fixFlowSeqItems(e);let r=e.end.splice(1,e.end.length);r.push(this.sourceToken);let i={type:`block-map`,offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let e=this.source.indexOf(` `)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(` -`,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=getFirstKeyStartProps(getPrevProps(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=getFirstKeyStartProps(getPrevProps(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}}})),it=/* @__PURE__ */ __commonJSMin((e=>{var t=Xe(),n=G(),r=K(),i=he(),a=O(),o=nt(),s=rt();function parseOptions(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new o.LineCounter||null,prettyErrors:t}}function parseAllDocuments(e,n={}){let{lineCounter:i,prettyErrors:a}=parseOptions(n),o=new s.Parser(i?.addNewLine),c=new t.Composer(n),l=Array.from(c.compose(o.parse(e)));if(a&&i)for(let t of l)t.errors.forEach(r.prettifyError(e,i)),t.warnings.forEach(r.prettifyError(e,i));return l.length>0?l:Object.assign([],{empty:!0},c.streamInfo())}function parseDocument(e,n={}){let{lineCounter:i,prettyErrors:a}=parseOptions(n),o=new s.Parser(i?.addNewLine),c=new t.Composer(n),l=null;for(let t of c.compose(o.parse(e),!0,e.length))if(!l)l=t;else if(l.options.logLevel!==`silent`){l.errors.push(new r.YAMLParseError(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return a&&i&&(l.errors.forEach(r.prettifyError(e,i)),l.warnings.forEach(r.prettifyError(e,i))),l}function parse(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let a=parseDocument(e,n);if(!a)return null;if(a.warnings.forEach(e=>i.warn(a.options.logLevel,e)),a.errors.length>0){if(a.options.logLevel!==`silent`)throw a.errors[0];a.errors=[]}return a.toJS(Object.assign({reviver:r},n))}function stringify(e,t,r){let i=null;if(typeof t==`function`||Array.isArray(t)?i=t:r===void 0&&t&&(r=t),typeof r==`string`&&(r=r.length),typeof r==`number`){let e=Math.round(r);r=e<1?void 0:e>8?{indent:8}:{indent:e}}if(e===void 0){let{keepUndefined:e}=r??t??{};if(!e)return}return a.isDocument(e)&&!i?e.toString(r):new n.Document(e,i,r).toString(r)}e.parse=parse,e.parseAllDocuments=parseAllDocuments,e.parseDocument=parseDocument,e.stringify=stringify})),Y=(/* @__PURE__ */ __commonJSMin((e=>{var t=Xe(),n=G(),r=Fe(),i=K(),a=M(),o=O(),s=R(),c=N(),l=z(),u=V();et();var d=tt(),f=nt(),p=rt(),m=it(),h=k();e.Composer=t.Composer,e.Document=n.Document,e.Schema=r.Schema,e.YAMLError=i.YAMLError,e.YAMLParseError=i.YAMLParseError,e.YAMLWarning=i.YAMLWarning,e.Alias=a.Alias,e.isAlias=o.isAlias,e.isCollection=o.isCollection,e.isDocument=o.isDocument,e.isMap=o.isMap,e.isNode=o.isNode,e.isPair=o.isPair,e.isScalar=o.isScalar,e.isSeq=o.isSeq,e.Pair=s.Pair,e.Scalar=c.Scalar,e.YAMLMap=l.YAMLMap,e.YAMLSeq=u.YAMLSeq,e.Lexer=d.Lexer,e.LineCounter=f.LineCounter,e.Parser=p.Parser,e.parse=m.parse,e.parseAllDocuments=m.parseAllDocuments,e.parseDocument=m.parseDocument,e.stringify=m.stringify,e.visit=h.visit,e.visitAsync=h.visitAsync})))();const X=`Vite+`,Z=`vite-plus`;function resolvePath$1(e,t){return h.isAbsolute(e)?e:h.join(t,e)}function isWithin(e,t){let n=h.relative(t,e);return!h.isAbsolute(n)&&n!==`..`&&!n.startsWith(`..${h.sep}`)}function resolveProjectDirectory(e){let{workingDirectory:t,workspaceRoot:n}=e,r=h.isAbsolute(t)?t:h.join(n,t);try{if(!f(r).isDirectory())throw Error(`working-directory is not a directory: ${t} (resolved to ${r})`)}catch(e){throw e instanceof Error&&`code`in e&&e.code===`ENOENT`?Error(`working-directory not found: ${t} (resolved to ${r})`):e}return r}function isWindows(e=process.platform){return e===`win32`}function run(e,t,n={}){let r=w(e,t,{stdio:`inherit`,...n});if(r.error)throw r.error;if(r.status!==0)throw Error(`${e} ${t.join(` `)} exited with code ${r.status??1}`)}function runWithOutput(e,t,n={}){return new Promise((r,i)=>{let a=C(e,t,{...n,stdio:[`ignore`,`pipe`,`pipe`]}),o=``,s=``;a.stdout.on(`data`,e=>{process.stdout.write(e),o=(o+e.toString()).slice(-4e3)}),a.stderr.on(`data`,e=>{process.stderr.write(e),s=(s+e.toString()).slice(-4e3)}),a.on(`error`,i),a.on(`close`,e=>r({exitCode:e??1,stdout:o,stderr:s}))})}function commandPath(e){if(isWindows()){let t=w(`where`,[e],{encoding:`utf8`});return t.status===0&&t.stdout.trim().split(/\r?\n/)[0]?.trim()||void 0}let t=w(`sh`,[`-c`,`command -v "$1"`,`sh`,e],{encoding:`utf8`});if(t.status===0)return t.stdout.trim()}function getCommandOutput(e,t,n){let r=w(e,t,{cwd:n?.cwd,encoding:`utf8`,stdio:[`ignore`,`pipe`,`pipe`]});if(r.status===0)return r.stdout.trim()}const at=[{filename:`pnpm-lock.yaml`,type:`pnpm`},{filename:`bun.lockb`,type:`bun`},{filename:`bun.lock`,type:`bun`},{filename:`package-lock.json`,type:`npm`},{filename:`npm-shrinkwrap.json`,type:`npm`},{filename:`yarn.lock`,type:`yarn`}];function resolvePath(e,t){return v(e)?e:y(t,e)}function inferLockFileType(e,t){return t.includes(`pnpm`)?{type:`pnpm`,path:e,filename:t}:t.includes(`yarn`)?{type:`yarn`,path:e,filename:t}:t.startsWith(`bun.`)?{type:`bun`,path:e,filename:t}:{type:`npm`,path:e,filename:t}}function detectLockFile(e,t){if(e){let n=resolvePath(e,t);if(i(n)){let e=g(n),t=at.find(t=>t.filename===e);return t?{type:t.type,path:n,filename:e}:inferLockFileType(n,e)}return}let n=l(t);for(let e of at)if(n.includes(e.filename)){let n=y(t,e.filename);return{type:e.type,path:n,filename:e.filename}}}function prepareCacheMetadata(e){let{projectDir:t,cacheDependencyPath:n,logWarning:r}=e,i=detectLockFile(n||void 0,t);if(!i)return r?.(`setup-vp: cache is enabled but no supported lock file was found; skipping cache.`),{ready:!1};let a=getCommandOutput(`vp`,[`pm`,`cache`,`dir`],{cwd:h.dirname(i.path)});return a?{ready:!0,cachePath:a,lockFile:i.path,lockType:i.type}:(r?.(`setup-vp: could not resolve package-manager cache directory for ${i.filename}; skipping cache.`),{ready:!1})}function createLockfileResolver(e){let{getWorkspaceDir:t,info:n,debug:r}=e,a=/^\d+\.\d+\.\d+/;function tryResolveVitePlusVersionFromLockfile(e,t){let i=detectLockfileForProject(e,t);if(!i)return;let a=i.filename.endsWith(`.lockb`)?textBunLockBeside(i):i;if(!a){r(`Cannot read ${i.filename} (binary) to resolve the ${X} version; using "latest". Use the text bun.lock, or set the \`version\` input.`);return}let o=parseVitePlusVersionFromLockfile(a,workspaceSubPath(_(a.path),e));if(o)return n(`Resolved ${X} version '${o}' from ${a.filename}`),o;r(`No ${X} version found in ${a.path}`)}function detectLockfileForProject(e,n){if(n)return detectLockFile(n,e);let r=t(),i=e;for(;;){let e=detectLockFile(void 0,i);if(e)return e;let t=_(i);if(i===r||t===i||!isWithin(t,r))break;i=t}}function textBunLockBeside(e){let t=y(_(e.path),`bun.lock`);return i(t)?{type:`bun`,path:t,filename:`bun.lock`}:void 0}function workspaceSubPath(e,t){if(!isWithin(t,e))return``;let n=b(e,t);return n?n.split(x).join(`/`):``}function parseVitePlusVersionFromLockfile(e,t=``){if(e.filename.endsWith(`.lockb`))return;let n;try{n=c(e.path,`utf-8`)}catch{return}let r;switch(e.type){case`npm`:r=fromNpmLock(n,t);break;case`pnpm`:r=fromPnpmLock(n,t);break;case`yarn`:r=fromYarnLock(n);break;case`bun`:r=fromBunTextLock(n);break;default:return}return r&&a.test(r)?r:void 0}function fromNpmLock(e,t){let n;try{n=JSON.parse(e)}catch{return}let r=n.packages;if(t){let e=r?.[`${t}/node_modules/${Z}`]?.version;if(typeof e==`string`)return e;if(!npmPackageDeclaresVitePlus(r?.[t]))return}let i=r?.[`node_modules/${Z}`]?.version;if(typeof i==`string`)return i;let a=n.dependencies?.[Z]?.version;return typeof a==`string`?a:void 0}function npmPackageDeclaresVitePlus(e){if(!e)return!1;for(let t of[`dependencies`,`devDependencies`]){let n=e[t];if(n&&typeof n==`object`&&`vite-plus`in n)return!0}return!1}function fromPnpmLock(e,t){let n;try{n=(0,Y.parse)(e)}catch{return}if(!n||typeof n!=`object`)return;let r=n,i=r.importers;if(i&&typeof i==`object`){let e=t||`.`;return e in i?pnpmImporterVersion(i[e]):void 0}return pnpmImporterVersion(r)||e.match(/^\s*\/?vite-plus@(\d+\.\d+\.\d+[^\s():'"]*)/m)?.[1]}function pnpmImporterVersion(e){if(!e||typeof e!=`object`)return;let t=e;for(let e of[`dependencies`,`devDependencies`,`optionalDependencies`]){let n=t[e];if(n&&typeof n==`object`){let e=n[Z],t=typeof e==`string`?e:e?.version;if(typeof t==`string`){let e=t.replace(/\(.*$/,``).trim();if(a.test(e))return e}}}}function fromYarnLock(e){let t=/* @__PURE__ */ new Set,n=e.split(/\r?\n/);for(let e=0;ee.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}}})),st=/* @__PURE__ */ __commonJSMin((e=>{var t=$e(),n=G(),r=K(),i=ve(),a=k(),o=at(),s=ot();function parseOptions(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new o.LineCounter||null,prettyErrors:t}}function parseAllDocuments(e,n={}){let{lineCounter:i,prettyErrors:a}=parseOptions(n),o=new s.Parser(i?.addNewLine),c=new t.Composer(n),l=Array.from(c.compose(o.parse(e)));if(a&&i)for(let t of l)t.errors.forEach(r.prettifyError(e,i)),t.warnings.forEach(r.prettifyError(e,i));return l.length>0?l:Object.assign([],{empty:!0},c.streamInfo())}function parseDocument(e,n={}){let{lineCounter:i,prettyErrors:a}=parseOptions(n),o=new s.Parser(i?.addNewLine),c=new t.Composer(n),l=null;for(let t of c.compose(o.parse(e),!0,e.length))if(!l)l=t;else if(l.options.logLevel!==`silent`){l.errors.push(new r.YAMLParseError(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return a&&i&&(l.errors.forEach(r.prettifyError(e,i)),l.warnings.forEach(r.prettifyError(e,i))),l}function parse(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let a=parseDocument(e,n);if(!a)return null;if(a.warnings.forEach(e=>i.warn(a.options.logLevel,e)),a.errors.length>0){if(a.options.logLevel!==`silent`)throw a.errors[0];a.errors=[]}return a.toJS(Object.assign({reviver:r},n))}function stringify(e,t,r){let i=null;if(typeof t==`function`||Array.isArray(t)?i=t:r===void 0&&t&&(r=t),typeof r==`string`&&(r=r.length),typeof r==`number`){let e=Math.round(r);r=e<1?void 0:e>8?{indent:8}:{indent:e}}if(e===void 0){let{keepUndefined:e}=r??t??{};if(!e)return}return a.isDocument(e)&&!i?e.toString(r):new n.Document(e,i,r).toString(r)}e.parse=parse,e.parseAllDocuments=parseAllDocuments,e.parseDocument=parseDocument,e.stringify=stringify})),Y=(/* @__PURE__ */ __commonJSMin((e=>{var t=$e(),n=G(),r=Re(),i=K(),a=M(),o=k(),s=R(),c=N(),l=z(),u=V();rt();var d=it(),f=at(),p=ot(),m=st(),h=A();e.Composer=t.Composer,e.Document=n.Document,e.Schema=r.Schema,e.YAMLError=i.YAMLError,e.YAMLParseError=i.YAMLParseError,e.YAMLWarning=i.YAMLWarning,e.Alias=a.Alias,e.isAlias=o.isAlias,e.isCollection=o.isCollection,e.isDocument=o.isDocument,e.isMap=o.isMap,e.isNode=o.isNode,e.isPair=o.isPair,e.isScalar=o.isScalar,e.isSeq=o.isSeq,e.Pair=s.Pair,e.Scalar=c.Scalar,e.YAMLMap=l.YAMLMap,e.YAMLSeq=u.YAMLSeq,e.Lexer=d.Lexer,e.LineCounter=f.LineCounter,e.Parser=p.Parser,e.parse=m.parse,e.parseAllDocuments=m.parseAllDocuments,e.parseDocument=m.parseDocument,e.stringify=m.stringify,e.visit=h.visit,e.visitAsync=h.visitAsync})))();const X=`Vite+`,Z=`vite-plus`;function resolvePath$1(e,t){return v.isAbsolute(e)?e:v.join(t,e)}function isWithin(e,t){let n=v.relative(t,e);return!v.isAbsolute(n)&&n!==`..`&&!n.startsWith(`..${v.sep}`)}function resolveProjectDirectory(e){let{workingDirectory:t,workspaceRoot:n}=e,r=v.isAbsolute(t)?t:v.join(n,t);try{if(!h(r).isDirectory())throw Error(`working-directory is not a directory: ${t} (resolved to ${r})`)}catch(e){throw e instanceof Error&&`code`in e&&e.code===`ENOENT`?Error(`working-directory not found: ${t} (resolved to ${r})`):e}return r}function isWindows(e=process.platform){return e===`win32`}function run(e,t,n={}){let r=D(e,t,{stdio:`inherit`,...n});if(r.error)throw r.error;if(r.status!==0)throw Error(`${e} ${t.join(` `)} exited with code ${r.status??1}`)}function runWithOutput(e,t,n={}){return new Promise((r,i)=>{let a=E(e,t,{...n,stdio:[`ignore`,`pipe`,`pipe`]}),o=``,s=``;a.stdout.on(`data`,e=>{process.stdout.write(e),o=(o+e.toString()).slice(-4e3)}),a.stderr.on(`data`,e=>{process.stderr.write(e),s=(s+e.toString()).slice(-4e3)}),a.on(`error`,i),a.on(`close`,e=>r({exitCode:e??1,stdout:o,stderr:s}))})}function commandPath(e,r=process.env){if(!e||e===`.`||e===`..`||/[\\/:]/.test(e))return;let i=isWindows(),a=i?Object.keys(r).sort().find(e=>e.toUpperCase()===`PATH`):`PATH`,o=a&&r[a]||``,s=i&&!e.toLowerCase().endsWith(`.exe`)?`${e}.exe`:e,c=p(process.cwd());for(let e of o.split(v.delimiter)){let r=i?e.replace(/^"(.*)"$/,`$1`):e;if(v.isAbsolute(r))try{let e=p(r);if(i?e.toLowerCase()===c.toLowerCase():e===c)continue;let a=v.join(r,s);if(!h(a).isFile())continue;return t(a,i?n.F_OK:n.X_OK),a}catch{}}}function getCommandOutput(e,t,n){let r=D(e,t,{cwd:n?.cwd,encoding:`utf8`,stdio:[`ignore`,`pipe`,`pipe`]});if(r.status===0)return r.stdout.trim()}const ct=[{filename:`pnpm-lock.yaml`,type:`pnpm`},{filename:`bun.lockb`,type:`bun`},{filename:`bun.lock`,type:`bun`},{filename:`package-lock.json`,type:`npm`},{filename:`npm-shrinkwrap.json`,type:`npm`},{filename:`yarn.lock`,type:`yarn`}];function resolvePath(e,t){return x(e)?e:S(t,e)}function inferLockFileType(e,t){return t.includes(`pnpm`)?{type:`pnpm`,path:e,filename:t}:t.includes(`yarn`)?{type:`yarn`,path:e,filename:t}:t.startsWith(`bun.`)?{type:`bun`,path:e,filename:t}:{type:`npm`,path:e,filename:t}}function detectLockFile(e,t){if(e){let n=resolvePath(e,t);if(o(n)){let e=y(n),t=ct.find(t=>t.filename===e);return t?{type:t.type,path:n,filename:e}:inferLockFileType(n,e)}return}let n=d(t);for(let e of ct)if(n.includes(e.filename)){let n=S(t,e.filename);return{type:e.type,path:n,filename:e.filename}}}function prepareCacheMetadata(e){let{projectDir:t,cacheDependencyPath:n,logWarning:r}=e,i=detectLockFile(n||void 0,t);if(!i)return r?.(`setup-vp: cache is enabled but no supported lock file was found; skipping cache.`),{ready:!1};let a=getCommandOutput(`vp`,[`pm`,`cache`,`dir`],{cwd:v.dirname(i.path)});return a?{ready:!0,cachePath:a,lockFile:i.path,lockType:i.type}:(r?.(`setup-vp: could not resolve package-manager cache directory for ${i.filename}; skipping cache.`),{ready:!1})}function createLockfileResolver(e){let{getWorkspaceDir:t,info:n,debug:r}=e,i=/^\d+\.\d+\.\d+/;function tryResolveVitePlusVersionFromLockfile(e,t){let i=detectLockfileForProject(e,t);if(!i)return;let a=i.filename.endsWith(`.lockb`)?textBunLockBeside(i):i;if(!a){r(`Cannot read ${i.filename} (binary) to resolve the ${X} version; using "latest". Use the text bun.lock, or set the \`version\` input.`);return}let o=parseVitePlusVersionFromLockfile(a,workspaceSubPath(b(a.path),e));if(o)return n(`Resolved ${X} version '${o}' from ${a.filename}`),o;r(`No ${X} version found in ${a.path}`)}function detectLockfileForProject(e,n){if(n)return detectLockFile(n,e);let r=t(),i=e;for(;;){let e=detectLockFile(void 0,i);if(e)return e;let t=b(i);if(i===r||t===i||!isWithin(t,r))break;i=t}}function textBunLockBeside(e){let t=S(b(e.path),`bun.lock`);return o(t)?{type:`bun`,path:t,filename:`bun.lock`}:void 0}function workspaceSubPath(e,t){if(!isWithin(t,e))return``;let n=C(e,t);return n?n.split(w).join(`/`):``}function parseVitePlusVersionFromLockfile(e,t=``){if(e.filename.endsWith(`.lockb`))return;let n;try{n=u(e.path,`utf-8`)}catch{return}let r;switch(e.type){case`npm`:r=fromNpmLock(n,t);break;case`pnpm`:r=fromPnpmLock(n,t);break;case`yarn`:r=fromYarnLock(n);break;case`bun`:r=fromBunTextLock(n);break;default:return}return r&&i.test(r)?r:void 0}function fromNpmLock(e,t){let n;try{n=JSON.parse(e)}catch{return}let r=n.packages;if(t){let e=r?.[`${t}/node_modules/${Z}`]?.version;if(typeof e==`string`)return e;if(!npmPackageDeclaresVitePlus(r?.[t]))return}let i=r?.[`node_modules/${Z}`]?.version;if(typeof i==`string`)return i;let a=n.dependencies?.[Z]?.version;return typeof a==`string`?a:void 0}function npmPackageDeclaresVitePlus(e){if(!e)return!1;for(let t of[`dependencies`,`devDependencies`]){let n=e[t];if(n&&typeof n==`object`&&`vite-plus`in n)return!0}return!1}function fromPnpmLock(e,t){let n;try{n=(0,Y.parse)(e)}catch{return}if(!n||typeof n!=`object`)return;let r=n,i=r.importers;if(i&&typeof i==`object`){let e=t||`.`;return e in i?pnpmImporterVersion(i[e]):void 0}return pnpmImporterVersion(r)||e.match(/^\s*\/?vite-plus@(\d+\.\d+\.\d+[^\s():'"]*)/m)?.[1]}function pnpmImporterVersion(e){if(!e||typeof e!=`object`)return;let t=e;for(let e of[`dependencies`,`devDependencies`,`optionalDependencies`]){let n=t[e];if(n&&typeof n==`object`){let e=n[Z],t=typeof e==`string`?e:e?.version;if(typeof t==`string`){let e=t.replace(/\(.*$/,``).trim();if(i.test(e))return e}}}}function fromYarnLock(e){let t=/* @__PURE__ */ new Set,n=e.split(/\r?\n/);for(let e=0;ee,info:console.info,debug:()=>{},warning:console.warn}}const ot=`https://raw.githubusercontent.com/voidzero-dev/vite-plus`,st=`packages/cli`,ct=/^0\.0\.0-commit\.([0-9a-f]{40})$/i,lt=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;function pkgPrNewCommitSha(e){return e.match(ct)?.[1]}function getInstallScriptUrls(e,t=process.platform){let n=isWindows(t)?`install.ps1`:`install.sh`,r=installScriptRef(e);return{pinned:r?[`${ot}/${r}/${st}/${n}`,`https://cdn.jsdelivr.net/gh/voidzero-dev/vite-plus@${r}/${st}/${n}`]:[],latest:[`https://viteplus.dev/${n}`,`${ot}/main/${st}/${n}`]}}function installScriptRef(e){let t=pkgPrNewCommitSha(e);if(t)return t.toLowerCase();if(lt.test(e))return`v${e}`}function parseInstalledVpVersion(e){return(e.match(/^\s*vp\s+v?(\d[^\s]*)/im)??e.match(/Global:\s*v?(\d[^\s]*)/i))?.[1]??`unknown`}const Q=`SETUP_VP_DIRS_FILE`;function getVitePlusBinDirs(e){let t=y(e.data,`fallback-bin`);return f(t,{throwIfNoEntry:!1})?.isDirectory()?{bin:e.bin,fallbackBin:t}:{bin:e.bin}}function appendFallbackBinToPath(e,t,n=process.platform){let r=isWindows(n)?`;`:`:`;return[...e?e.split(r).filter(e=>e!==t):[],t].join(r)}const ut=/^v?(\d+)\.(\d+)\.\d+(?:-[0-9A-Za-z.-]+)?$/;function supportsVitePlusDirs(e){if(pkgPrNewCommitSha(e))return!0;let t=e.match(ut);if(!t)return!0;let n=Number(t[1]),r=Number(t[2]);return n>0||r>=3}function createVitePlusDirsFile(){return y(E(),`setup-vp-dirs-${ne()}.txt`)}function removeVitePlusDirsFile(e){d(e,{force:!0})}function readVitePlusProbe(e){try{return c(e,`utf8`)}catch(e){if(e.code===`ENOENT`)return;throw e}}function resolveVitePlusBinDirs(e,t,n){if(!t){if(!supportsVitePlusDirs(e))return{bin:n};throw Error(`Vite+ was installed successfully, but setup-vp could not resolve its VpDirs.`)}let r=readVitePlusProbe(t),i=r===void 0?void 0:parseVitePlusDirs(r);if(i)return getVitePlusBinDirs(i);if(!(pkgPrNewCommitSha(e)!==void 0||ut.test(e))&&r!==void 0){let e=parseInstalledVpVersion(r);if(e!==`unknown`&&!supportsVitePlusDirs(e))return{bin:n}}throw Error(`Vite+ was installed successfully, but setup-vp could not resolve its VpDirs.`)}function parseVitePlusDirs(e){let t=/* @__PURE__ */ new Map;for(let n of e.split(/\r?\n/)){let e=n.indexOf(` `);if(e<1)continue;let r=n.slice(0,e).replace(/^\uFEFF/,``),i=n.slice(e+1).trim();i&&t.set(r,i)}let n=t.get(`data`),r=t.get(`bin`),i=t.get(`cache`),a=t.get(`config`),o=t.get(`state`);if(n&&r&&i&&a&&o)return{data:n,bin:r,cache:i,config:a,state:o}}function getInstallScriptCommand(e,t=process.platform,n=!0){if(isWindows(t))return n?{command:`pwsh`,args:[`-Command`,` +`)){let e=t.trim();if(!e||e.startsWith(`#`))continue;let[n,...r]=e.split(/\s+/);if(n===`nodejs`||n===`node`){for(let e of r)if(isAsdfInstallableVersion(e))return e}}}function isAsdfInstallableVersion(e){return!!e&&e!==`system`&&!e.startsWith(`ref:`)&&!e.startsWith(`path:`)}function parsePackageJson(e){let t;try{t=JSON.parse(e)}catch{throw Error(`Failed to parse package.json: invalid JSON`)}let n=t.devEngines;if(n?.runtime){let e=findNodeRuntime(n.runtime);if(e)return e}let r=t.engines;if(r?.node&&typeof r.node==`string`)return r.node}function findNodeRuntime(e){let t=Array.isArray(e)?e:[e];for(let e of t)if(e?.name===`node`&&typeof e.version==`string`)return e.version}return{resolveNodeVersionFile}}function resolutionContext(e){return{getWorkspaceDir:()=>e,info:console.info,debug:()=>{},warning:console.warn}}const lt=`https://raw.githubusercontent.com/voidzero-dev/vite-plus`,ut=`packages/cli`,dt=/^0\.0\.0-commit\.([0-9a-f]{40})$/i,ft=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;function pkgPrNewCommitSha(e){return e.match(dt)?.[1]}function getInstallScriptUrls(e,t=process.platform){let n=isWindows(t)?`install.ps1`:`install.sh`,r=installScriptRef(e);return{pinned:r?[`${lt}/${r}/${ut}/${n}`,`https://cdn.jsdelivr.net/gh/voidzero-dev/vite-plus@${r}/${ut}/${n}`]:[],latest:[`https://viteplus.dev/${n}`,`${lt}/main/${ut}/${n}`]}}function installScriptRef(e){let t=pkgPrNewCommitSha(e);if(t)return t.toLowerCase();if(ft.test(e))return`v${e}`}function parseInstalledVpVersion(e){return(e.match(/^\s*vp\s+v?(\d[^\s]*)/im)??e.match(/Global:\s*v?(\d[^\s]*)/i))?.[1]??`unknown`}const Q=`SETUP_VP_DIRS_FILE`;function getVitePlusBinDirs(e){let t=S(e.data,`fallback-bin`);return h(t,{throwIfNoEntry:!1})?.isDirectory()?{bin:e.bin,fallbackBin:t}:{bin:e.bin}}function appendFallbackBinToPath(e,t,n=process.platform){let r=isWindows(n)?`;`:`:`;return[...e?e.split(r).filter(e=>e!==t):[],t].join(r)}const pt=/^v?(\d+)\.(\d+)\.\d+(?:-[0-9A-Za-z.-]+)?$/;function supportsVitePlusDirs(e){if(pkgPrNewCommitSha(e))return!0;let t=e.match(pt);if(!t)return!0;let n=Number(t[1]),r=Number(t[2]);return n>0||r>=3}function createVitePlusDirsFile(){return S(te(),`setup-vp-dirs-${ie()}.txt`)}function removeVitePlusDirsFile(e){m(e,{force:!0})}function readVitePlusProbe(e){try{return u(e,`utf8`)}catch(e){if(e.code===`ENOENT`)return;throw e}}function resolveVitePlusBinDirs(e,t,n){if(!t){if(!supportsVitePlusDirs(e))return{bin:n};throw Error(`Vite+ was installed successfully, but setup-vp could not resolve its VpDirs.`)}let r=readVitePlusProbe(t),i=r===void 0?void 0:parseVitePlusDirs(r);if(i)return getVitePlusBinDirs(i);if(!(pkgPrNewCommitSha(e)!==void 0||pt.test(e))&&r!==void 0){let e=parseInstalledVpVersion(r);if(e!==`unknown`&&!supportsVitePlusDirs(e))return{bin:n}}throw Error(`Vite+ was installed successfully, but setup-vp could not resolve its VpDirs.`)}function parseVitePlusDirs(e){let t=/* @__PURE__ */ new Map;for(let n of e.split(/\r?\n/)){let e=n.indexOf(` `);if(e<1)continue;let r=n.slice(0,e).replace(/^\uFEFF/,``),i=n.slice(e+1).trim();i&&t.set(r,i)}let n=t.get(`data`),r=t.get(`bin`),i=t.get(`cache`),a=t.get(`config`),o=t.get(`state`);if(n&&r&&i&&a&&o)return{data:n,bin:r,cache:i,config:a,state:o}}function getInstallScriptCommand(e,t=process.platform,n=!0){if(isWindows(t))return n?{command:`pwsh`,args:[`-Command`,` $dirsFile = $env:${Q} Set-Content -LiteralPath $dirsFile -Value '' -NoNewline -Encoding UTF8 . ([scriptblock]::Create((irm -TimeoutSec 15 ${e}))) @@ -184,8 +184,8 @@ fi set +u set -o pipefail ${r} | bash -`.trim()]}}const dt=2e3;function getVitePlusHome(e=process.platform,t=process.env){let n=isWindows(e)?t.USERPROFILE||T():t.HOME||T();return y(n,`.vite-plus`)}function runInstallCommand(e,t,n=process.platform){let{command:r,args:i}=getInstallScriptCommand(e,n,t.VP_VPDIRS_AWARE===`1`),a={env:{...process.env,...t},stdio:`inherit`},o=w(r,i,a);if(isWindows(n)&&o.error?.code===`ENOENT`&&(o=w(`powershell.exe`,i,a)),o.error)throw o.error;return o.status??1}async function installVitePlus(e,t={}){let n=t.platform??process.platform,r=t.env??process.env,i=t.prependPath,a=t.sleep??ee,o=t.runInstall??runInstallCommand,s=t.logWarningFn??console.warn,c={...Object.fromEntries(Object.entries(r).filter(e=>e[1]!==void 0)),VP_VERSION:e,VITE_PLUS_VERSION:e},l=supportsVitePlusDirs(e)?createVitePlusDirsFile():void 0;l?(c.VP_VPDIRS_AWARE=`1`,c[Q]=l):(delete c.VP_VPDIRS_AWARE,delete c[Q]);let u=pkgPrNewCommitSha(e);u&&(c.VP_PR_VERSION=u);let{pinned:d,latest:f}=getInstallScriptUrls(e,n),p=d.length+f.length,m=2*p,h=``,g=0;async function tryUrls(e){for(let t=0;t<2;t+=1)for(let t of e){g+=1;try{let e=o(t,c,n);if(e===0)return!0;h=`exit code ${e}`}catch(e){h=e instanceof Error?e.message:String(e)}g0){if(await tryUrls(d)){ensureBinInPath();return}s(`setup-vp: could not fetch the install script pinned to Vite+ ${e}. Falling back to the latest install script. The latest script may not be compatible with ${e}.`)}if(await tryUrls(f)){ensureBinInPath();return}throw Error(`Failed to install Vite+ after ${m} attempts across ${p} URL(s): ${h}`)}finally{l&&removeVitePlusDirsFile(l)}}function copyCacheDirectory(e,t,r){e=h.resolve(e),t=h.resolve(t),n(e,t,{recursive:!0,force:r,errorOnExist:!1,filter:(n,i)=>{let s=a(i,{throwIfNoEntry:!1}),c=a(n);if(s&&!r)return c.isDirectory()&&s.isDirectory();if(s&&(s.isSymbolicLink()||c.isSymbolicLink())&&d(i,{recursive:!0,force:!0}),c.isSymbolicLink()){let r=h.resolve(h.dirname(n),u(n)),a=r;if(isWithin(r,e)){let n=h.join(t,h.relative(e,r));a=h.relative(h.dirname(i),n)||`.`}return o(h.dirname(i),{recursive:!0}),p(a,i,f(r,{throwIfNoEntry:!1})?.isDirectory()?`dir`:`file`),!1}return!0}})}function restoreCacheSnapshot(e,t,n=console.warn,r=!0){if(!e.ready||!e.cachePath||!e.lockFile||!e.lockType)return{hit:!1,save:()=>{}};let a=e.cachePath;if(isWithin(h.resolve(a),h.resolve(t))||isWithin(h.resolve(t),h.resolve(a)))return n(`setup-vp: package-manager cache overlaps the snapshot directory; skipping cache.`),{hit:!1,save:()=>{}};let s=h.join(t,process.platform,process.arch,e.lockType),l=h.join(s,`packages`),u=h.join(s,`lock-hash`),d=e.lockFile;function hashLockFile(){return te(`sha256`).update(c(d)).digest(`hex`)}let f;try{f=hashLockFile()}catch(e){return n(`setup-vp: could not read cache lock file: ${String(e)}`),{hit:!1,save:()=>{}}}let p=!1;try{r&&i(l)&&(o(a,{recursive:!0}),copyCacheDirectory(l,a,!1),p=c(u,`utf8`)===f)}catch(e){n(`setup-vp: could not restore package-manager cache: ${String(e)}`)}return{hit:p,save:()=>{try{if(!i(a))return;let e=hashLockFile();o(s,{recursive:!0}),copyCacheDirectory(a,l,!0),m(u,e,`utf8`)}catch(e){n(`setup-vp: could not save package-manager cache: ${String(e)}`)}}}}const ft=/* @__PURE__ */ new Set([`true`,`True`,`TRUE`]),pt=/* @__PURE__ */ new Set([`false`,`False`,`FALSE`]);function parseNodeManager(e){if(e){if(ft.has(e))return!0;if(pt.has(e))return!1;throw Error(`Invalid node-manager input: "${e}". Expected "true", "false", or unset.`)}}function supportsScopedEnv(e){let t=parseInstalledVpVersion(e);if(t.startsWith(`0.0.0-commit.`))return!0;let n=t.match(/^(\d+)\.(\d+)\.(\d+)/);if(!n)throw Error(`Could not determine the installed Vite+ version for env configuration.`);let[,r,i,a]=n.map(Number);return r>0||i>3||i===3&&a>=1}function nodeManagerOffArgs(e){return parseInstalledVpVersion(e).startsWith(`0.0.0-commit.`)&&console.info("setup-vp: node-manager: false requires a preview build that supports `vp env off node`. If this command is unsupported, use a newer preview or a stable release. setup-vp will not fall back to disabling package-manager management."),supportsScopedEnv(e)?[`env`,`off`,`node`]:[`env`,`off`]}const mt=[`npm`,`pnpm`,`yarn`,`bun`];function parsePackageManager(e){if(!e?.trim())return;let t;try{t=(0,Y.parse)(e)}catch(e){throw Error(`Invalid package-manager input: ${String(e)}`)}if(t!==``){if(typeof t==`boolean`)return t;if(t&&typeof t==`object`&&!Array.isArray(t)){for(let[e,n]of Object.entries(t))if(!mt.includes(e)||typeof n!=`boolean`)throw Error(`Invalid package-manager input: ${e} must be npm, pnpm, yarn, or bun with a boolean value.`);return t}throw Error(`Invalid package-manager input: expected a boolean or a mapping of npm, pnpm, yarn, and bun to booleans.`)}}function packageManagerArgs(e,t){if(e===void 0)return[];if(!supportsScopedEnv(t))throw Error(`package-manager configuration requires Vite+ 0.3.1 or newer.`);return typeof e==`boolean`?e?[]:[[`env`,`off`,`pm`]]:mt.filter(t=>e[t]===!1).map(e=>[`env`,`off`,e])}function readNpmrc(e){try{return c(e,`utf8`)}catch(e){if(e.code===`ENOENT`)return``;throw e}}function analyzeProjectNpmrc(e){let t=/* @__PURE__ */ new Set;for(let n of e.split(/\r?\n/)){let e=n.trim();if(!e||e.startsWith(`;`)||e.startsWith(`#`))continue;let r=e.indexOf(`=`);if(r<0)continue;let i=e.slice(r+1).trim();for(let e of i.matchAll(/\$\{(\w+)\}/g))t.add(e[1])}return{envVarRefs:t}}function readUserConfigLines(e,t){let n=e.HOME||e.USERPROFILE,r=e.NPM_CONFIG_USERCONFIG||e.PNPM_CONFIG_USERCONFIG||n&&h.join(n,`.npmrc`);return(r?readNpmrc(r):``).split(/\r?\n/).filter(e=>!t.has(e.split(`=`)[0].trim().toLowerCase()))}function isReservedAuthVariable(e){return[`GITHUB_TOKEN`,`CI_JOB_TOKEN`,`SYSTEM_ACCESSTOKEN`].includes(e)?!1:/^(?:PATH|HOME|USERPROFILE|TMPDIR|CI)$/i.test(e)||/^(?:SETUP_VP_|RUNNER_|GITHUB_|CI_|SYSTEM_|AGENT_|BUILD_|RELEASE_)/i.test(e)}function writeUserConfig(e,t,n){let r=s(h.join(E(),`setup-vp-npmrc-`)),i=h.join(r,`.npmrc`);m(i,e,{encoding:`utf8`,mode:384});for(let e of[`NPM_CONFIG_USERCONFIG`,`PNPM_CONFIG_USERCONFIG`])t[e]=i,n?.(e,i);return i}function configureAuth$1(e,t,n,r,i){if(!e){if(!i)return;let{envVarRefs:e}=analyzeProjectNpmrc(readNpmrc(h.join(i,`.npmrc`)));for(let t of e)!isReservedAuthVariable(t)&&n[t]&&r?.(t,n[t]);return}let a;try{a=new URL(e)}catch{throw Error(`Invalid registry-url: "${e}". Must be a valid URL.`)}let o=a.href.endsWith(`/`)?a.href:`${a.href}/`,s=``;t&&(s=`${(t.startsWith(`@`)?t:`@${t}`).toLowerCase()}:`);let c=o.replace(/^\w+:/,``).toLowerCase(),l=readUserConfigLines(n,/* @__PURE__ */ new Set([`${s}registry`,`${c}:_authtoken`]));l.push(`${c}:_authToken=\${NODE_AUTH_TOKEN}`,`${s}registry=${o}`);let u=writeUserConfig(l.filter(Boolean).join(` +`.trim()]}}const mt=2e3;function getVitePlusHome(e=process.platform,t=process.env){let n=isWindows(e)?t.USERPROFILE||ee():t.HOME||ee();return S(n,`.vite-plus`)}function runInstallCommand(e,t,n=process.platform){let{command:r,args:i}=getInstallScriptCommand(e,n,t.VP_VPDIRS_AWARE===`1`),a={env:{...process.env,...t},stdio:`inherit`},o=D(r,i,a);if(isWindows(n)&&o.error?.code===`ENOENT`&&(o=D(`powershell.exe`,i,a)),o.error)throw o.error;return o.status??1}async function installVitePlus(e,t={}){let n=t.platform??process.platform,r=t.env??process.env,i=t.prependPath,a=t.sleep??ne,o=t.runInstall??runInstallCommand,s=t.logWarningFn??console.warn,c={...Object.fromEntries(Object.entries(r).filter(e=>e[1]!==void 0)),VP_VERSION:e,VITE_PLUS_VERSION:e},l=supportsVitePlusDirs(e)?createVitePlusDirsFile():void 0;l?(c.VP_VPDIRS_AWARE=`1`,c[Q]=l):(delete c.VP_VPDIRS_AWARE,delete c[Q]);let u=pkgPrNewCommitSha(e);u&&(c.VP_PR_VERSION=u);let{pinned:d,latest:f}=getInstallScriptUrls(e,n),p=d.length+f.length,m=2*p,h=``,g=0;async function tryUrls(e){for(let t=0;t<2;t+=1)for(let t of e){g+=1;try{let e=o(t,c,n);if(e===0)return!0;h=`exit code ${e}`}catch(e){h=e instanceof Error?e.message:String(e)}g0){if(await tryUrls(d)){ensureBinInPath();return}s(`setup-vp: could not fetch the install script pinned to Vite+ ${e}. Falling back to the latest install script. The latest script may not be compatible with ${e}.`)}if(await tryUrls(f)){ensureBinInPath();return}throw Error(`Failed to install Vite+ after ${m} attempts across ${p} URL(s): ${h}`)}finally{l&&removeVitePlusDirsFile(l)}}function copyCacheDirectory(e,t,n){e=v.resolve(e),t=v.resolve(t),i(e,t,{recursive:!0,force:n,errorOnExist:!1,filter:(r,i)=>{let a=s(i,{throwIfNoEntry:!1}),o=s(r);if(a&&!n)return o.isDirectory()&&a.isDirectory();if(a&&(a.isSymbolicLink()||o.isSymbolicLink())&&m(i,{recursive:!0,force:!0}),o.isSymbolicLink()){let n=v.resolve(v.dirname(r),f(r)),a=n;if(isWithin(n,e)){let r=v.join(t,v.relative(e,n));a=v.relative(v.dirname(i),r)||`.`}return c(v.dirname(i),{recursive:!0}),g(a,i,h(n,{throwIfNoEntry:!1})?.isDirectory()?`dir`:`file`),!1}return!0}})}function restoreCacheSnapshot(e,t,n=console.warn,r=!0){if(!e.ready||!e.cachePath||!e.lockFile||!e.lockType)return{hit:!1,save:()=>{}};let i=e.cachePath;if(isWithin(v.resolve(i),v.resolve(t))||isWithin(v.resolve(t),v.resolve(i)))return n(`setup-vp: package-manager cache overlaps the snapshot directory; skipping cache.`),{hit:!1,save:()=>{}};let a=v.join(t,process.platform,process.arch,e.lockType),s=v.join(a,`packages`),l=v.join(a,`lock-hash`),d=e.lockFile;function hashLockFile(){return re(`sha256`).update(u(d)).digest(`hex`)}let f;try{f=hashLockFile()}catch(e){return n(`setup-vp: could not read cache lock file: ${String(e)}`),{hit:!1,save:()=>{}}}let p=!1;try{r&&o(s)&&(c(i,{recursive:!0}),copyCacheDirectory(s,i,!1),p=u(l,`utf8`)===f)}catch(e){n(`setup-vp: could not restore package-manager cache: ${String(e)}`)}return{hit:p,save:()=>{try{if(!o(i))return;let e=hashLockFile();c(a,{recursive:!0}),copyCacheDirectory(i,s,!0),_(l,e,`utf8`)}catch(e){n(`setup-vp: could not save package-manager cache: ${String(e)}`)}}}}const ht=/* @__PURE__ */ new Set([`true`,`True`,`TRUE`]),gt=/* @__PURE__ */ new Set([`false`,`False`,`FALSE`]);function parseNodeManager(e){if(e){if(ht.has(e))return!0;if(gt.has(e))return!1;throw Error(`Invalid node-manager input: "${e}". Expected "true", "false", or unset.`)}}function supportsScopedEnv(e){let t=parseInstalledVpVersion(e);if(t.startsWith(`0.0.0-commit.`))return!0;let n=t.match(/^(\d+)\.(\d+)\.(\d+)/);if(!n)throw Error(`Could not determine the installed Vite+ version for env configuration.`);let[,r,i,a]=n.map(Number);return r>0||i>3||i===3&&a>=1}function nodeManagerOffArgs(e){return parseInstalledVpVersion(e).startsWith(`0.0.0-commit.`)&&console.info("setup-vp: node-manager: false requires a preview build that supports `vp env off node`. If this command is unsupported, use a newer preview or a stable release. setup-vp will not fall back to disabling package-manager management."),supportsScopedEnv(e)?[`env`,`off`,`node`]:[`env`,`off`]}const _t=[`npm`,`pnpm`,`yarn`,`bun`];function parsePackageManager(e){if(!e?.trim())return;let t;try{t=(0,Y.parse)(e)}catch(e){throw Error(`Invalid package-manager input: ${String(e)}`)}if(t!==``){if(typeof t==`boolean`)return t;if(t&&typeof t==`object`&&!Array.isArray(t)){for(let[e,n]of Object.entries(t))if(!_t.includes(e)||typeof n!=`boolean`)throw Error(`Invalid package-manager input: ${e} must be npm, pnpm, yarn, or bun with a boolean value.`);return t}throw Error(`Invalid package-manager input: expected a boolean or a mapping of npm, pnpm, yarn, and bun to booleans.`)}}function packageManagerArgs(e,t){if(e===void 0)return[];if(!supportsScopedEnv(t))throw Error(`package-manager configuration requires Vite+ 0.3.1 or newer.`);return typeof e==`boolean`?e?[]:[[`env`,`off`,`pm`]]:_t.filter(t=>e[t]===!1).map(e=>[`env`,`off`,e])}function readNpmrc(e){try{return u(e,`utf8`)}catch(e){if(e.code===`ENOENT`)return``;throw e}}function analyzeProjectNpmrc(e){let t=/* @__PURE__ */ new Set;for(let n of e.split(/\r?\n/)){let e=n.trim();if(!e||e.startsWith(`;`)||e.startsWith(`#`))continue;let r=e.indexOf(`=`);if(r<0)continue;let i=e.slice(r+1).trim();for(let e of i.matchAll(/\$\{(\w+)\}/g))t.add(e[1])}return{envVarRefs:t}}function readUserConfigLines(e,t){let n=e.HOME||e.USERPROFILE,r=e.NPM_CONFIG_USERCONFIG||e.PNPM_CONFIG_USERCONFIG||n&&v.join(n,`.npmrc`);return(r?readNpmrc(r):``).split(/\r?\n/).filter(e=>!t.has(e.split(`=`)[0].trim().toLowerCase()))}function isReservedAuthVariable(e){return[`GITHUB_TOKEN`,`CI_JOB_TOKEN`,`SYSTEM_ACCESSTOKEN`].includes(e)?!1:/^(?:PATH|HOME|USERPROFILE|TMPDIR|CI)$/i.test(e)||/^(?:SETUP_VP_|RUNNER_|GITHUB_|CI_|SYSTEM_|AGENT_|BUILD_|RELEASE_)/i.test(e)}function writeUserConfig(e,t,n){let r=l(v.join(te(),`setup-vp-npmrc-`)),i=v.join(r,`.npmrc`);_(i,e,{encoding:`utf8`,mode:384});for(let e of[`NPM_CONFIG_USERCONFIG`,`PNPM_CONFIG_USERCONFIG`])t[e]=i,n?.(e,i);return i}function configureAuth$1(e,t,n,r,i){if(!e){if(!i)return;let{envVarRefs:e}=analyzeProjectNpmrc(readNpmrc(v.join(i,`.npmrc`)));for(let t of e)!isReservedAuthVariable(t)&&n[t]&&r?.(t,n[t]);return}let a;try{a=new URL(e)}catch{throw Error(`Invalid registry-url: "${e}". Must be a valid URL.`)}let o=a.href.endsWith(`/`)?a.href:`${a.href}/`,s=``;t&&(s=`${(t.startsWith(`@`)?t:`@${t}`).toLowerCase()}:`);let c=o.replace(/^\w+:/,``).toLowerCase(),l=readUserConfigLines(n,/* @__PURE__ */ new Set([`${s}registry`,`${c}:_authtoken`]));l.push(`${c}:_authToken=\${NODE_AUTH_TOKEN}`,`${s}registry=${o}`);let u=writeUserConfig(l.filter(Boolean).join(` `)+` -`,n,r);return n.NODE_AUTH_TOKEN=n.NODE_AUTH_TOKEN||`XXXXX-XXXXX-XXXXX-XXXXX`,r?.(`NODE_AUTH_TOKEN`,n.NODE_AUTH_TOKEN),u}function shellQuote(e){return`'${String(e).replaceAll(`'`,`'\\''`)}'`}function exportShellEnv(e,t,n=process.env){if(!n.SETUP_VP_ENV_FILE||t===void 0)return;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(e))throw Error(`Invalid environment variable name`);let r=n.SETUP_VP_ENV_FORMAT===`powershell`?`$env:${e} = '${t.replaceAll(`'`,`''`)}'\n`:`export ${e}=${shellQuote(t)}\n`;m(n.SETUP_VP_ENV_FILE,r,{encoding:`utf8`,flag:`a`})}function configureAuth(e,t,n=process.env,r){return configureAuth$1(e,t,n,n===process.env?(e,t)=>exportShellEnv(e,t,n):void 0,r)}function resolveSfwEnabled(e,t,n){return e?!pkgPrNewCommitSha(t)||(n(`sfw was requested but is automatically disabled for Vite+ preview build ${t}; Socket Firewall Free will not be used.`),!1):!1}const $=`v1.15.4`,ht=`https://github.com/SocketDev/sfw-free/releases/download/${$}`;function isMuslLinux(){if(process.platform!==`linux`)return!1;try{let e=process.report?.getReport();if(e?.header&&!e.header.glibcVersionRuntime)return!0}catch{}return i(`/etc/alpine-release`)}function getSfwAssetName(e,t,n){if(e===`darwin`){if(t===`arm64`)return`sfw-free-macos-arm64`;if(t===`x64`)return`sfw-free-macos-x86_64`}else if(e===`linux`){if(t===`arm64`)return n?`sfw-free-musl-linux-arm64`:`sfw-free-linux-arm64`;if(t===`x64`)return n?`sfw-free-musl-linux-x86_64`:`sfw-free-linux-x86_64`}else if(isWindows(e)){if(t===`arm64`)return`sfw-free-windows-arm64.exe`;if(t===`x64`)return`sfw-free-windows-x86_64.exe`}throw Error(`Unsupported platform/arch for sfw: ${e}/${t}${e===`linux`?` (${n?`musl`:`glibc`})`:``}`)}function downloadFileWithShell(e,t,n){let r=Math.max(1,Math.ceil(n/1e3)),i=commandPath(`curl`);if(i){let n=w(i,[`-fsSL`,`--connect-timeout`,`5`,`--max-time`,String(r),e,`-o`,t],{stdio:`ignore`});if(n.status===0)return;throw n.error||/* @__PURE__ */ Error(`curl failed while downloading ${e}`)}let a=commandPath(`wget`);if(a){let n=w(a,[`-q`,`-T`,String(r),`-t`,`2`,`-O`,t,e],{stdio:`ignore`});if(n.status===0)return;throw n.error||/* @__PURE__ */ Error(`wget failed while downloading ${e}`)}throw Error(`curl or wget is required to download sfw`)}function downloadFile(e,t,n=0,i=6e4,a){return n>5?Promise.reject(/* @__PURE__ */ Error(`too many redirects while downloading ${e}`)):a?new Promise((o,s)=>{let c=!1,finish=e=>{c||(c=!0,clearTimeout(u),e?s(e):o())},l=a(e,o=>{let s=o.statusCode??0,c=o.headers.location;if(s>=300&&s<400&&c){o.resume(),downloadFile(new URL(c,e).toString(),t,n+1,i,a).then(()=>finish(),finish);return}if(s!==200){o.resume(),finish(/* @__PURE__ */ Error(`download failed with HTTP ${s}: ${e}`));return}let l=r(t);o.pipe(l),l.on(`finish`,()=>l.close(()=>finish())),l.on(`error`,finish)}),u=setTimeout(()=>{l.destroy(/* @__PURE__ */ Error(`download timed out after ${i}ms: ${e}`))},i);l.on(`error`,finish)}):(downloadFileWithShell(e,t,i),Promise.resolve())}async function setupSfw$1(e,t={}){let n=t.env??process.env,r=t.sfwEnabled??n.SETUP_VP_SFW===`true`,i=t.platform??process.platform,a=t.arch??process.arch,o=t.isMusl??isMuslLinux(),s=t.download??downloadFile;if(!resolveSfwEnabled(r,t.vitePlusVersion??``,t.logWarning??console.warn))return`vp`;if(e.length===0)return console.log(`setup-vp: sfw was requested but run-install is disabled; sfw will not be invoked.`),`vp`;let c=commandPath(`sfw`);if(c)return console.log(`setup-vp: using existing sfw on PATH: ${c}`),`sfw`;let l;try{l=getSfwAssetName(i,a,o)}catch{return console.error(`setup-vp: sfw has no published binary for this runner's platform/architecture (process.platform=${i}, process.arch=${a}, musl=${o}) and none was found on PATH; falling back to plain vp install.`),`vp`}let u=t.cacheDirectory||n.SETUP_VP_SFW_CACHE_DIR,d=u?h.join(u,$,l):await ae(h.join(E(),`setup-vp-sfw-`));await ie(d,{recursive:!0});let f=h.join(d,isWindows(i)?`sfw.exe`:`sfw`),p=`${ht}/${l}`;function activate(){let e=isWindows(i)?`;`:`:`;return n.PATH=`${d}${e}${n.PATH||``}`,t.exportVariable?.(`PATH`,n.PATH),`sfw`}if(await ce(f).then(e=>e.isFile()&&e.size>0,()=>!1))return console.log(`setup-vp: using cached sfw ${$}: ${f}`),activate();for(let e=1;e<=2;e+=1){let t=await ae(h.join(d,`.download-`)),n=h.join(t,`sfw`);try{if(console.log(`setup-vp: installing sfw ${$} from ${p}`),await s(p,n),(await ce(n)).size===0)throw Error(`Downloaded sfw binary is empty`);return await re(n,493),await oe(n,f),activate()}catch(t){if(e===2)throw t;await new Promise(e=>setTimeout(e,2e3))}finally{await se(t,{recursive:!0,force:!0})}}throw Error(`failed to install sfw after retrying`)}async function setupSfw(e,t=process.env,n=``){return setupSfw$1(e,{env:t,vitePlusVersion:n,exportVariable:(e,n)=>exportShellEnv(e,n,t)})}function isRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function validateRunInstallEntry(e){if(!isRecord(e))throw Error(`run-install entries must be objects`);for(let t of Object.keys(e))if(t!==`cwd`&&t!==`args`)throw Error(`unsupported run-install key: ${t}`);let t={};if(e.cwd!==void 0){if(typeof e.cwd!=`string`)throw Error(`run-install.cwd must be a string`);t.cwd=e.cwd}if(e.args!==void 0){if(!Array.isArray(e.args)||e.args.some(e=>typeof e!=`string`))throw Error(`run-install.args must be an array of strings`);t.args=e.args}return t}function validateRunInstallInput(e){return e===null||typeof e==`boolean`?e:Array.isArray(e)?e.map(validateRunInstallEntry):validateRunInstallEntry(e)}function parseRunInstall(e){let t=validateRunInstallInput((0,Y.parse)(e)??null);return t?t===!0?[{}]:Array.isArray(t)?t:[t]:[]}function isSfwVpNotFoundFlake(e,t){return/Command 'vp' not found in PATH/.test(e+` -`+t)}async function runInstall(e,t,n,r=process.env,i={}){let a={...r};delete a.SETUP_VP_ENV_FILE;let o=i.execute??runWithOutput,s=[];for(let r of e){let e=r.cwd?h.resolve(t,r.cwd):t,c=[`install`,...r.args||[]],l=n===`sfw`?[`vp`,...c]:c,u=`${n} ${l.join(` `)} (cwd: ${e})`;console.log(`setup-vp: running ${u}`);try{let t=await o(n,l,{cwd:e,env:a});if(t.exitCode!==0&&n===`sfw`&&isSfwVpNotFoundFlake(t.stdout,t.stderr)){let r=isWindows(i.platform);if(console.warn(r?`setup-vp: sfw could not resolve vp; warming the PowerShell command cache and retrying once.`:`setup-vp: sfw could not resolve vp; retrying once.`),r)try{await o(`powershell.exe`,[`-NoProfile`,`-Command`,`Get-Command vp`],{cwd:e,env:a})}catch{}t=await o(n,l,{cwd:e,env:a})}t.exitCode!==0&&s.push(`${u} exited with code ${t.exitCode}\n${t.stderr.trim()||t.stdout.trim()}`)}catch(e){s.push(`${u}: ${String(e)}`)}}if(s.length)throw Error(s.join(` -`))}function resolveProjectDir(e=process.env){return resolveProjectDirectory({workingDirectory:e.SETUP_VP_WORKING_DIRECTORY||`.`,workspaceRoot:e.CI_PROJECT_DIR||process.cwd()})}function fail(e){console.error(`setup-vp: ${e}`),process.exit(1)}function applyEnvironmentModes(e=process.env,t=run){let n=parseNodeManager(e.SETUP_VP_NODE_MANAGER),r=parsePackageManager(e.SETUP_VP_PACKAGE_MANAGER),i=(n===!1||r!==void 0)&&getCommandOutput(`vp`,[`--version`])||``,a=packageManagerArgs(r,i);n===!1&&t(`vp`,nodeManagerOffArgs(i));for(let e of a)t(`vp`,e)}async function main(e=`setup`){let n=process.env,r=n.CI_PROJECT_DIR||process.cwd(),i=h.join(r,`.setup-vp-cache`),a=h.join(r,`.setup-vp-cache-state.json`),o=h.join(r,`.setup-vp-outputs.env`);if(e===`save-cache`){restoreCacheSnapshot(JSON.parse(c(a,`utf8`)),i,console.warn,!1).save();return}if(e!==`setup`)throw Error(`Invalid GitLab phase: ${e}`);let s=resolveProjectDir(n);d(a,{force:!0}),d(o,{force:!0});let l=resolutionContext(r),u=parseNodeManager(n.SETUP_VP_NODE_MANAGER);parsePackageManager(n.SETUP_VP_PACKAGE_MANAGER);let f=parseRunInstall(n.SETUP_VP_RUN_INSTALL??`true`);if(u===!1&&(n.SETUP_VP_NODE_VERSION||n.SETUP_VP_NODE_VERSION_FILE))throw Error(`node-version and node-version-file cannot be used with node-manager: false`);let p=n.SETUP_VP_NODE_VERSION||(n.SETUP_VP_NODE_VERSION_FILE?createNodeVersionResolver(l).resolveNodeVersionFile(n.SETUP_VP_NODE_VERSION_FILE,s):void 0),g=createVersionResolver(l).resolveVitePlusVersion({version:n.SETUP_VP_VERSION,versionFile:n.SETUP_VP_VERSION_FILE,cacheDependencyPath:n.SETUP_VP_CACHE_DEPENDENCY_PATH},s);await installVitePlus(g,{env:n,exportPath:e=>exportShellEnv(`PATH`,e)}),applyEnvironmentModes(),p&&run(`vp`,[`env`,`use`,p],{cwd:s}),configureAuth(n.SETUP_VP_REGISTRY_URL||``,n.SETUP_VP_SCOPE||``,n,s);let _=n.SETUP_VP_CACHE?.toLowerCase()===`true`;_?n.SETUP_VP_SFW_CACHE_DIR=h.join(i,`sfw`):delete n.SETUP_VP_SFW_CACHE_DIR;let v=_?prepareCacheMetadata({projectDir:s,cacheDependencyPath:n.SETUP_VP_CACHE_DEPENDENCY_PATH,logWarning:console.warn}):{ready:!1},y=restoreCacheSnapshot(v,i),b=n.SETUP_VP_CACHE_SAVE?.toLowerCase()!==`false`;v.ready&&b&&(m(a,JSON.stringify(v),{mode:384}),t(process.argv[1],h.join(r,`.setup-vp-runtime.mjs`))),await runInstall(f,s,await setupSfw(f,n,g)),b&&y.save();let x=getCommandOutput(`vp`,[`--version`],{cwd:s});if(!x)throw Error(`Failed to verify Vite+ installation: vp --version failed or returned no output.`);console.log(x);let S={SETUP_VP_INSTALLED_VERSION:parseInstalledVpVersion(x),SETUP_VP_CACHE_HIT:String(y.hit)};for(let[e,t]of Object.entries(S))n[e]=t,exportShellEnv(e,t);m(o,Object.entries(S).map(([e,t])=>`${e}=${t}\n`).join(``),{mode:384})}function isEntrypoint(e=process.argv[1],t=import.meta.url){return!!(e&&t===S(h.resolve(e)).href)}if(isEntrypoint())try{await main(process.argv[2])}catch(e){fail(e instanceof Error?e.message:String(e))}export{applyEnvironmentModes,isEntrypoint,main}; \ No newline at end of file +`,n,r);return n.NODE_AUTH_TOKEN=n.NODE_AUTH_TOKEN||`XXXXX-XXXXX-XXXXX-XXXXX`,r?.(`NODE_AUTH_TOKEN`,n.NODE_AUTH_TOKEN),u}function shellQuote(e){return`'${String(e).replaceAll(`'`,`'\\''`)}'`}function exportShellEnv(e,t,n=process.env){if(!n.SETUP_VP_ENV_FILE||t===void 0)return;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(e))throw Error(`Invalid environment variable name`);let r=n.SETUP_VP_ENV_FORMAT===`powershell`?`$env:${e} = '${t.replaceAll(`'`,`''`)}'\n`:`export ${e}=${shellQuote(t)}\n`;_(n.SETUP_VP_ENV_FILE,r,{encoding:`utf8`,flag:`a`})}function configureAuth(e,t,n=process.env,r){return configureAuth$1(e,t,n,n===process.env?(e,t)=>exportShellEnv(e,t,n):void 0,r)}function resolveSfwEnabled(e,t,n){return e?!pkgPrNewCommitSha(t)||(n(`sfw was requested but is automatically disabled for Vite+ preview build ${t}; Socket Firewall Free will not be used.`),!1):!1}const $=`v1.15.4`,vt=`https://github.com/SocketDev/sfw-free/releases/download/${$}`;function isMuslLinux(){if(process.platform!==`linux`)return!1;try{let e=process.report?.getReport();if(e?.header&&!e.header.glibcVersionRuntime)return!0}catch{}return o(`/etc/alpine-release`)}function getSfwAssetName(e,t,n){if(e===`darwin`){if(t===`arm64`)return`sfw-free-macos-arm64`;if(t===`x64`)return`sfw-free-macos-x86_64`}else if(e===`linux`){if(t===`arm64`)return n?`sfw-free-musl-linux-arm64`:`sfw-free-linux-arm64`;if(t===`x64`)return n?`sfw-free-musl-linux-x86_64`:`sfw-free-linux-x86_64`}else if(isWindows(e)){if(t===`arm64`)return`sfw-free-windows-arm64.exe`;if(t===`x64`)return`sfw-free-windows-x86_64.exe`}throw Error(`Unsupported platform/arch for sfw: ${e}/${t}${e===`linux`?` (${n?`musl`:`glibc`})`:``}`)}function downloadFileWithShell(e,t,n){let r=Math.max(1,Math.ceil(n/1e3)),i=commandPath(`curl`);if(i){let n=D(i,[`-fsSL`,`--connect-timeout`,`5`,`--max-time`,String(r),e,`-o`,t],{stdio:`ignore`});if(n.status===0)return;throw n.error||/* @__PURE__ */ Error(`curl failed while downloading ${e}`)}let a=commandPath(`wget`);if(a){let n=D(a,[`-q`,`-T`,String(r),`-t`,`2`,`-O`,t,e],{stdio:`ignore`});if(n.status===0)return;throw n.error||/* @__PURE__ */ Error(`wget failed while downloading ${e}`)}throw Error(`curl or wget is required to download sfw`)}function downloadFile(e,t,n=0,r=6e4,i){return n>5?Promise.reject(/* @__PURE__ */ Error(`too many redirects while downloading ${e}`)):i?new Promise((o,s)=>{let c=!1,finish=e=>{c||(c=!0,clearTimeout(u),e?s(e):o())},l=i(e,o=>{let s=o.statusCode??0,c=o.headers.location;if(s>=300&&s<400&&c){o.resume(),downloadFile(new URL(c,e).toString(),t,n+1,r,i).then(()=>finish(),finish);return}if(s!==200){o.resume(),finish(/* @__PURE__ */ Error(`download failed with HTTP ${s}: ${e}`));return}let l=a(t);o.pipe(l),l.on(`finish`,()=>l.close(()=>finish())),l.on(`error`,finish)}),u=setTimeout(()=>{l.destroy(/* @__PURE__ */ Error(`download timed out after ${r}ms: ${e}`))},r);l.on(`error`,finish)}):(downloadFileWithShell(e,t,r),Promise.resolve())}async function setupSfw$1(e,t={}){let n=t.env??process.env,r=t.sfwEnabled??n.SETUP_VP_SFW===`true`,i=t.platform??process.platform,a=t.arch??process.arch,o=t.isMusl??isMuslLinux(),s=t.download??downloadFile;if(!resolveSfwEnabled(r,t.vitePlusVersion??``,t.logWarning??console.warn))return`vp`;if(e.length===0)return console.log(`setup-vp: sfw was requested but run-install is disabled; sfw will not be invoked.`),`vp`;let c=commandPath(`sfw`,n);if(c)return console.log(`setup-vp: using existing sfw on PATH: ${c}`),`sfw`;let l;try{l=getSfwAssetName(i,a,o)}catch{return console.error(`setup-vp: sfw has no published binary for this runner's platform/architecture (process.platform=${i}, process.arch=${a}, musl=${o}) and none was found on PATH; falling back to plain vp install.`),`vp`}let u=t.cacheDirectory||n.SETUP_VP_SFW_CACHE_DIR,d=u?v.join(u,$,l):await se(v.join(te(),`setup-vp-sfw-`));await oe(d,{recursive:!0});let f=v.join(d,isWindows(i)?`sfw.exe`:`sfw`),p=`${vt}/${l}`;function activate(){let e=isWindows(i)?`;`:`:`;return n.PATH=`${d}${e}${n.PATH||``}`,t.exportVariable?.(`PATH`,n.PATH),`sfw`}if(await ue(f).then(e=>e.isFile()&&e.size>0,()=>!1))return console.log(`setup-vp: using cached sfw ${$}: ${f}`),activate();for(let e=1;e<=2;e+=1){let t=await se(v.join(d,`.download-`)),n=v.join(t,`sfw`);try{if(console.log(`setup-vp: installing sfw ${$} from ${p}`),await s(p,n),(await ue(n)).size===0)throw Error(`Downloaded sfw binary is empty`);return await ae(n,493),await ce(n,f),activate()}catch(t){if(e===2)throw t;await new Promise(e=>setTimeout(e,2e3))}finally{await le(t,{recursive:!0,force:!0})}}throw Error(`failed to install sfw after retrying`)}async function setupSfw(e,t=process.env,n=``){return setupSfw$1(e,{env:t,vitePlusVersion:n,exportVariable:(e,n)=>exportShellEnv(e,n,t)})}function isRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function validateRunInstallEntry(e){if(!isRecord(e))throw Error(`run-install entries must be objects`);for(let t of Object.keys(e))if(t!==`cwd`&&t!==`args`)throw Error(`unsupported run-install key: ${t}`);let t={};if(e.cwd!==void 0){if(typeof e.cwd!=`string`)throw Error(`run-install.cwd must be a string`);t.cwd=e.cwd}if(e.args!==void 0){if(!Array.isArray(e.args)||e.args.some(e=>typeof e!=`string`))throw Error(`run-install.args must be an array of strings`);t.args=e.args}return t}function validateRunInstallInput(e){return e===null||typeof e==`boolean`?e:Array.isArray(e)?e.map(validateRunInstallEntry):validateRunInstallEntry(e)}function parseRunInstall(e){let t=validateRunInstallInput((0,Y.parse)(e)??null);return t?t===!0?[{}]:Array.isArray(t)?t:[t]:[]}function isSfwVpNotFoundFlake(e,t){return/Command 'vp' not found in PATH/.test(e+` +`+t)}async function runInstall(e,t,n,r=process.env,i={}){let a={...r};delete a.SETUP_VP_ENV_FILE;let o=i.execute??runWithOutput,s=[];for(let r of e){let e=r.cwd?v.resolve(t,r.cwd):t,c=[`install`,...r.args||[]],l=n===`sfw`?[`vp`,...c]:c,u=`${n} ${l.join(` `)} (cwd: ${e})`;console.log(`setup-vp: running ${u}`);try{let t=await o(n,l,{cwd:e,env:a});if(t.exitCode!==0&&n===`sfw`&&isSfwVpNotFoundFlake(t.stdout,t.stderr)){let r=isWindows(i.platform);if(console.warn(r?`setup-vp: sfw could not resolve vp; warming the PowerShell command cache and retrying once.`:`setup-vp: sfw could not resolve vp; retrying once.`),r)try{await o(`powershell.exe`,[`-NoProfile`,`-Command`,`Get-Command vp`],{cwd:e,env:a})}catch{}t=await o(n,l,{cwd:e,env:a})}t.exitCode!==0&&s.push(`${u} exited with code ${t.exitCode}\n${t.stderr.trim()||t.stdout.trim()}`)}catch(e){s.push(`${u}: ${String(e)}`)}}if(s.length)throw Error(s.join(` +`))}function resolveProjectDir(e=process.env){return resolveProjectDirectory({workingDirectory:e.SETUP_VP_WORKING_DIRECTORY||`.`,workspaceRoot:e.CI_PROJECT_DIR||process.cwd()})}function fail(e){console.error(`setup-vp: ${e}`),process.exit(1)}function applyEnvironmentModes(e=process.env,t=run){let n=parseNodeManager(e.SETUP_VP_NODE_MANAGER),r=parsePackageManager(e.SETUP_VP_PACKAGE_MANAGER),i=(n===!1||r!==void 0)&&getCommandOutput(`vp`,[`--version`])||``,a=packageManagerArgs(r,i);n===!1&&t(`vp`,nodeManagerOffArgs(i));for(let e of a)t(`vp`,e)}async function main(e=`setup`){let t=process.env,n=t.CI_PROJECT_DIR||process.cwd(),i=v.join(n,`.setup-vp-cache`),a=v.join(n,`.setup-vp-cache-state.json`),o=v.join(n,`.setup-vp-outputs.env`);if(e===`save-cache`){restoreCacheSnapshot(JSON.parse(u(a,`utf8`)),i,console.warn,!1).save();return}if(e!==`setup`)throw Error(`Invalid GitLab phase: ${e}`);let s=resolveProjectDir(t);m(a,{force:!0}),m(o,{force:!0});let c=resolutionContext(n),l=parseNodeManager(t.SETUP_VP_NODE_MANAGER);parsePackageManager(t.SETUP_VP_PACKAGE_MANAGER);let d=parseRunInstall(t.SETUP_VP_RUN_INSTALL??`true`);if(l===!1&&(t.SETUP_VP_NODE_VERSION||t.SETUP_VP_NODE_VERSION_FILE))throw Error(`node-version and node-version-file cannot be used with node-manager: false`);let f=t.SETUP_VP_NODE_VERSION||(t.SETUP_VP_NODE_VERSION_FILE?createNodeVersionResolver(c).resolveNodeVersionFile(t.SETUP_VP_NODE_VERSION_FILE,s):void 0),p=createVersionResolver(c).resolveVitePlusVersion({version:t.SETUP_VP_VERSION,versionFile:t.SETUP_VP_VERSION_FILE,cacheDependencyPath:t.SETUP_VP_CACHE_DEPENDENCY_PATH},s);await installVitePlus(p,{env:t,exportPath:e=>exportShellEnv(`PATH`,e)}),applyEnvironmentModes(),f&&run(`vp`,[`env`,`use`,f],{cwd:s}),configureAuth(t.SETUP_VP_REGISTRY_URL||``,t.SETUP_VP_SCOPE||``,t,s);let h=t.SETUP_VP_CACHE?.toLowerCase()===`true`;h?t.SETUP_VP_SFW_CACHE_DIR=v.join(i,`sfw`):delete t.SETUP_VP_SFW_CACHE_DIR;let g=h?prepareCacheMetadata({projectDir:s,cacheDependencyPath:t.SETUP_VP_CACHE_DEPENDENCY_PATH,logWarning:console.warn}):{ready:!1},y=restoreCacheSnapshot(g,i),b=t.SETUP_VP_CACHE_SAVE?.toLowerCase()!==`false`;g.ready&&b&&(_(a,JSON.stringify(g),{mode:384}),r(process.argv[1],v.join(n,`.setup-vp-runtime.mjs`))),await runInstall(d,s,await setupSfw(d,t,p)),b&&y.save();let x=getCommandOutput(`vp`,[`--version`],{cwd:s});if(!x)throw Error(`Failed to verify Vite+ installation: vp --version failed or returned no output.`);console.log(x);let S={SETUP_VP_INSTALLED_VERSION:parseInstalledVpVersion(x),SETUP_VP_CACHE_HIT:String(y.hit)};for(let[e,n]of Object.entries(S))t[e]=n,exportShellEnv(e,n);_(o,Object.entries(S).map(([e,t])=>`${e}=${t}\n`).join(``),{mode:384})}function isEntrypoint(e=process.argv[1],t=import.meta.url){return!!(e&&t===T(v.resolve(e)).href)}if(isEntrypoint())try{await main(process.argv[2])}catch(e){fail(e instanceof Error?e.message:String(e))}export{applyEnvironmentModes,isEntrypoint,main}; \ No newline at end of file diff --git a/dist/index.mjs b/dist/index.mjs index 3eea643..22e9616 100644 --- a/dist/index.mjs +++ b/dist/index.mjs @@ -329,6 +329,6 @@ default:throw Error(`Unexpected operation: ${e.operator}`)}}),o&&(!a||i(a,o))&&( More info on storage limits: https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions#calculating-minute-and-storage-spending`),this.name=`UsageError`}};UsageError.isUsageErrorMessage=e=>e?e.includes(`insufficient usage`):!1;var RateLimitError=class extends Error{constructor(e){super(e),this.name=`RateLimitError`}},__awaiter$6=function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})},UploadProgress=class{constructor(e){this.contentLength=e,this.sentBytes=0,this.displayedComplete=!1,this.startTime=Date.now()}setSentBytes(e){this.sentBytes=e}getTransferredBytes(){return this.sentBytes}isDone(){return this.getTransferredBytes()===this.contentLength}display(){if(this.displayedComplete)return;let e=this.sentBytes,t=(100*(e/this.contentLength)).toFixed(1),n=Date.now()-this.startTime,r=(e/1048576/(n/1e3)).toFixed(1);info(`Sent ${e} of ${this.contentLength} (${t}%), ${r} MBs/sec`),this.isDone()&&(this.displayedComplete=!0)}onProgress(){return e=>{this.setSentBytes(e.loadedBytes)}}startDisplayTimer(e=1e3){let displayCallback=()=>{this.display(),this.isDone()||(this.timeoutHandle=setTimeout(displayCallback,e))};this.timeoutHandle=setTimeout(displayCallback,e)}stopDisplayTimer(){this.timeoutHandle&&=(clearTimeout(this.timeoutHandle),void 0),this.display()}};function uploadCacheArchiveSDK(e,t,n){return __awaiter$6(this,void 0,void 0,function*(){let r=new k_(e),i=r.getBlockBlobClient(),a=new UploadProgress(n?.archiveSizeBytes??0),o={blockSize:n?.uploadChunkSize,concurrency:n?.uploadConcurrency,maxSingleShotSize:134217728,onProgress:a.onProgress()};try{a.startDisplayTimer(),debug(`BlobClient: ${r.name}:${r.accountName}:${r.containerName}`);let e=yield i.uploadFile(t,o);if(e._response.status>=400)throw new InvalidResponseError(`uploadCacheArchiveSDK: upload failed with status code ${e._response.status}`);return e}catch(e){throw warning(`uploadCacheArchiveSDK: internal error uploading cache archive: ${e.message}`),e}finally{a.stopDisplayTimer()}})}var __awaiter$5=function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})};function isSuccessStatusCode(e){return e?e>=200&&e<300:!1}function isServerErrorStatusCode(e){return!e||e>=500}function isRetryableStatusCode(e){return e?[On.BadGateway,On.ServiceUnavailable,On.GatewayTimeout].includes(e):!1}function sleep(e){return __awaiter$5(this,void 0,void 0,function*(){return new Promise(t=>setTimeout(t,e))})}function retry(e,t,n){return __awaiter$5(this,arguments,void 0,function*(e,t,n,r=2,i=us,a=void 0){let o=``,s=1;for(;s<=r;){let c,l,u=!1;try{c=yield t()}catch(e){a&&(c=a(e)),u=!0,o=e.message}if(c&&(l=n(c),!isServerErrorStatusCode(l)))return c;if(l&&(u=isRetryableStatusCode(l),o=`Cache service responded with ${l}`),debug(`${e} - Attempt ${s} of ${r} failed with error: ${o}`),!u){debug(`${e} - Error is not retryable`);break}yield sleep(i),s++}throw Error(`${e} failed: ${o}`)})}function retryTypedResponse(e,t){return __awaiter$5(this,arguments,void 0,function*(e,t,n=2,r=us){return yield retry(e,t,e=>e.statusCode,n,r,e=>{if(e instanceof Pn)return{statusCode:e.statusCode,result:null,headers:{},error:e}})})}function retryHttpClientResponse(e,t){return __awaiter$5(this,arguments,void 0,function*(e,t,n=2,r=us){return yield retry(e,t,e=>e.message.statusCode,n,r)})}var __awaiter$4=function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})};function pipeResponseToStream(e,t){return __awaiter$4(this,void 0,void 0,function*(){yield v.promisify(Te.pipeline)(e.message,t)})}var DownloadProgress=class{constructor(e){this.contentLength=e,this.segmentIndex=0,this.segmentSize=0,this.segmentOffset=0,this.receivedBytes=0,this.displayedComplete=!1,this.startTime=Date.now()}nextSegment(e){this.segmentOffset+=this.segmentSize,this.segmentIndex+=1,this.segmentSize=e,this.receivedBytes=0,debug(`Downloading segment at offset ${this.segmentOffset} with length ${this.segmentSize}...`)}setReceivedBytes(e){this.receivedBytes=e}getTransferredBytes(){return this.segmentOffset+this.receivedBytes}isDone(){return this.getTransferredBytes()===this.contentLength}display(){if(this.displayedComplete)return;let e=this.segmentOffset+this.receivedBytes,t=(100*(e/this.contentLength)).toFixed(1),n=Date.now()-this.startTime,r=(e/1048576/(n/1e3)).toFixed(1);info(`Received ${e} of ${this.contentLength} (${t}%), ${r} MBs/sec`),this.isDone()&&(this.displayedComplete=!0)}onProgress(){return e=>{this.setReceivedBytes(e.loadedBytes)}}startDisplayTimer(e=1e3){let displayCallback=()=>{this.display(),this.isDone()||(this.timeoutHandle=setTimeout(displayCallback,e))};this.timeoutHandle=setTimeout(displayCallback,e)}stopDisplayTimer(){this.timeoutHandle&&=(clearTimeout(this.timeoutHandle),void 0),this.display()}};function downloadCacheHttpClient(e,t){return __awaiter$4(this,void 0,void 0,function*(){let n=a.createWriteStream(t),r=new HttpClient(`actions/cache`),i=yield retryHttpClientResponse(`downloadCache`,()=>__awaiter$4(this,void 0,void 0,function*(){return r.get(e)}));i.message.socket.setTimeout(ds,()=>{i.message.destroy(),debug(`Aborting download, socket timed out after ${ds} ms`)}),yield pipeResponseToStream(i,n);let o=i.message.headers[`content-length`];if(o){let e=parseInt(o),n=getArchiveFileSizeInBytes(t);if(n!==e)throw Error(`Incomplete download. Expected file size: ${e}, actual file size: ${n}`)}else debug(`Unable to validate download, no Content-Length header`)})}function downloadCacheHttpClientConcurrent(e,t,n){return __awaiter$4(this,void 0,void 0,function*(){let r=yield a.promises.open(t,`w`),i=new HttpClient(`actions/cache`,void 0,{socketTimeout:n.timeoutInMs,keepAlive:!0});try{let t=(yield retryHttpClientResponse(`downloadCacheMetadata`,()=>__awaiter$4(this,void 0,void 0,function*(){return yield i.request(`HEAD`,e,null,{})}))).message.headers[`content-length`];if(t==null)throw Error(`Content-Length not found on blob response`);let a=parseInt(t);if(Number.isNaN(a))throw Error(`Could not interpret Content-Length: ${a}`);let o=[],s=4194304;for(let t=0;t__awaiter$4(this,void 0,void 0,function*(){return yield downloadSegmentRetry(i,e,t,n)})})}o.reverse();let c=0,l=0,u=new DownloadProgress(a);u.startDisplayTimer();let d=u.onProgress(),f=[],p,waitAndWrite=()=>__awaiter$4(this,void 0,void 0,function*(){let e=yield Promise.race(Object.values(f));yield r.write(e.buffer,0,e.count,e.offset),c--,delete f[e.offset],l+=e.count,d({loadedBytes:l})});for(;p=o.pop();)f[p.offset]=p.promiseGetter(),c++,c>=(n.downloadConcurrency??10)&&(yield waitAndWrite());for(;c>0;)yield waitAndWrite()}finally{i.dispose(),yield r.close()}})}function downloadSegmentRetry(e,t,n,r){return __awaiter$4(this,void 0,void 0,function*(){let i=0;for(;;)try{let i=yield promiseWithTimeout(3e4,downloadSegment(e,t,n,r));if(typeof i==`string`)throw Error(`downloadSegmentRetry failed due to timeout`);return i}catch(e){if(i>=5)throw e;i++}})}function downloadSegment(e,t,n,r){return __awaiter$4(this,void 0,void 0,function*(){let i=yield retryHttpClientResponse(`downloadCachePart`,()=>__awaiter$4(this,void 0,void 0,function*(){return yield e.get(t,{Range:`bytes=${n}-${n+r-1}`})}));if(!i.readBodyBuffer)throw Error(`Expected HttpClientResponse to implement readBodyBuffer`);return{offset:n,count:r,buffer:yield i.readBodyBuffer()}})}function downloadCacheStorageSDK(e,t,n){return __awaiter$4(this,void 0,void 0,function*(){let r=new j_(e,void 0,{retryOptions:{tryTimeoutInMs:n.timeoutInMs}}),i=(yield r.getProperties()).contentLength??-1;if(i<0)debug(`Unable to determine content length, downloading file with http-client...`),yield downloadCacheHttpClient(e,t);else{let e=Math.min(134217728,ee.constants.MAX_LENGTH),o=new DownloadProgress(i),s=a.openSync(t,`w`);try{o.startDisplayTimer();let t=new AbortController,c=t.signal;for(;!o.isDone();){let l=o.segmentOffset+o.segmentSize,u=Math.min(e,i-l);o.nextSegment(u);let d=yield promiseWithTimeout(n.segmentTimeoutInMs||36e5,r.downloadToBuffer(l,u,{abortSignal:c,concurrency:n.downloadConcurrency,onProgress:o.onProgress()}));if(d===`timeout`)throw t.abort(),Error(`Aborting cache download as the download time exceeded the timeout.`);Buffer.isBuffer(d)&&a.writeFileSync(s,d)}}finally{o.stopDisplayTimer(),a.closeSync(s)}}})}const promiseWithTimeout=(e,t)=>__awaiter$4(void 0,void 0,void 0,function*(){let n,r=new Promise(t=>{n=setTimeout(()=>t(`timeout`),e)});return Promise.race([t,r]).then(e=>(clearTimeout(n),e))});function getUploadOptions(e){let t={useAzureSdk:!1,uploadConcurrency:4,uploadChunkSize:33554432};return e&&(typeof e.useAzureSdk==`boolean`&&(t.useAzureSdk=e.useAzureSdk),typeof e.uploadConcurrency==`number`&&(t.uploadConcurrency=e.uploadConcurrency),typeof e.uploadChunkSize==`number`&&(t.uploadChunkSize=e.uploadChunkSize)),t.uploadConcurrency=isNaN(Number(process.env.CACHE_UPLOAD_CONCURRENCY))?t.uploadConcurrency:Math.min(32,Number(process.env.CACHE_UPLOAD_CONCURRENCY)),t.uploadChunkSize=isNaN(Number(process.env.CACHE_UPLOAD_CHUNK_SIZE))?t.uploadChunkSize:Math.min(134217728,Number(process.env.CACHE_UPLOAD_CHUNK_SIZE)*1024*1024),debug(`Use Azure SDK: ${t.useAzureSdk}`),debug(`Upload concurrency: ${t.uploadConcurrency}`),debug(`Upload chunk size: ${t.uploadChunkSize}`),t}function getDownloadOptions(e){let t={useAzureSdk:!1,concurrentBlobDownloads:!0,downloadConcurrency:8,timeoutInMs:3e4,segmentTimeoutInMs:6e5,lookupOnly:!1};e&&(typeof e.useAzureSdk==`boolean`&&(t.useAzureSdk=e.useAzureSdk),typeof e.concurrentBlobDownloads==`boolean`&&(t.concurrentBlobDownloads=e.concurrentBlobDownloads),typeof e.downloadConcurrency==`number`&&(t.downloadConcurrency=e.downloadConcurrency),typeof e.timeoutInMs==`number`&&(t.timeoutInMs=e.timeoutInMs),typeof e.segmentTimeoutInMs==`number`&&(t.segmentTimeoutInMs=e.segmentTimeoutInMs),typeof e.lookupOnly==`boolean`&&(t.lookupOnly=e.lookupOnly));let n=process.env.SEGMENT_DOWNLOAD_TIMEOUT_MINS;return n&&!isNaN(Number(n))&&isFinite(Number(n))&&(t.segmentTimeoutInMs=Number(n)*60*1e3),debug(`Use Azure SDK: ${t.useAzureSdk}`),debug(`Download concurrency: ${t.downloadConcurrency}`),debug(`Request timeout (ms): ${t.timeoutInMs}`),debug(`Cache segment download timeout mins env var: ${process.env.SEGMENT_DOWNLOAD_TIMEOUT_MINS}`),debug(`Segment download timeout (ms): ${t.segmentTimeoutInMs}`),debug(`Lookup only: ${t.lookupOnly}`),t}function isGhes(){let e=new URL(process.env.GITHUB_SERVER_URL||`https://github.com`).hostname.trimEnd().toUpperCase(),t=e===`GITHUB.COM`,n=e.endsWith(`.GHE.COM`),r=e.endsWith(`.LOCALHOST`);return!t&&!n&&!r}function getCacheServiceVersion(){return isGhes()?`v1`:process.env.ACTIONS_CACHE_SERVICE_V2?`v2`:`v1`}const N_=[`none`,`read`,`write`,`write-only`];function getCacheMode(){return(process.env.ACTIONS_CACHE_MODE||``).trim().toLowerCase()}function isCacheReadable(e){return!N_.includes(e)||e===`read`||e===`write`}function isCacheWritable(e){return!N_.includes(e)||e===`write`||e===`write-only`}function getCacheServiceURL(){let e=getCacheServiceVersion();switch(e){case`v1`:return process.env.ACTIONS_CACHE_URL||process.env.ACTIONS_RESULTS_URL||``;case`v2`:return process.env.ACTIONS_RESULTS_URL||``;default:throw Error(`Unsupported cache service version: ${e}`)}}var P_=/* @__PURE__ */ __commonJSMin(((e,t)=>{t.exports={name:`@actions/cache`,version:`6.3.0`,description:`Actions cache lib`,keywords:[`github`,`actions`,`cache`],homepage:`https://github.com/actions/toolkit/tree/main/packages/cache`,license:`MIT`,type:`module`,main:`lib/cache.js`,types:`lib/cache.d.ts`,exports:{".":{types:`./lib/cache.d.ts`,import:`./lib/cache.js`}},directories:{lib:`lib`,test:`__tests__`},files:[`lib`,`!.DS_Store`],publishConfig:{access:`public`},repository:{type:`git`,url:`git+https://github.com/actions/toolkit.git`,directory:`packages/cache`},scripts:{"audit-moderate":`npm install && npm audit --json --audit-level=moderate > audit.json`,test:`echo "Error: run tests from root" && exit 1`,tsc:`tsc && cp src/internal/shared/package-version.cjs lib/internal/shared/`},bugs:{url:`https://github.com/actions/toolkit/issues`},dependencies:{"@actions/core":`^3.0.1`,"@actions/exec":`^3.0.0`,"@actions/glob":`^0.7.0`,"@actions/http-client":`^4.0.1`,"@actions/io":`^3.0.2`,"@azure/core-rest-pipeline":`~1.23.0`,"@azure/storage-blob":`~12.31.0`,"@protobuf-ts/runtime-rpc":`^2.11.1`,semver:`^7.8.5`},devDependencies:{"@protobuf-ts/plugin":`^2.11.1`,"@types/node":`^25.9.8`,"@types/semver":`^7.8.0`,typescript:`^5.9.3`},overrides:{"uri-js":`npm:uri-js-replace@^1.0.1`,"node-fetch":`^3.3.2`}}})),F_=(/* @__PURE__ */ __commonJSMin(((e,t)=>{t.exports={version:P_().version}})))();function getUserAgentString(){return`@actions/cache-${F_.version}`}var __awaiter$3=function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})};function getCacheApiUrl(e){let t=getCacheServiceURL();if(!t)throw Error(`Cache Service Url not found, unable to restore cache.`);let n=`${t}_apis/artifactcache/${e}`;return debug(`Resource Url: ${n}`),n}function createAcceptHeader(e,t){return`${e};api-version=${t}`}function getRequestOptions(){return{headers:{Accept:createAcceptHeader(`application/json`,`6.0-preview.1`)}}}function createHttpClient(){let e=new BearerCredentialHandler(process.env.ACTIONS_RUNTIME_TOKEN||``);return new HttpClient(getUserAgentString(),[e],getRequestOptions())}function getCacheEntry(e,t,n){return __awaiter$3(this,void 0,void 0,function*(){let r=createHttpClient(),i=getCacheVersion(t,n?.compressionMethod,n?.enableCrossOsArchive),a=`cache?keys=${encodeURIComponent(e.join(`,`))}&version=${i}`,o=yield retryTypedResponse(`getCacheEntry`,()=>__awaiter$3(this,void 0,void 0,function*(){return r.getJson(getCacheApiUrl(a))}));if(o.statusCode===204)return isDebug()&&(yield printCachesListForDiagnostics(e[0],r,i)),null;if(!isSuccessStatusCode(o.statusCode)){let e=o.error?.message;throw e?.includes(`cache read denied:`)?Error(e):Error(`Cache service responded with ${o.statusCode}`)}let s=o.result,c=s?.archiveLocation;if(!c)throw Error(`Cache not found.`);return setSecret(c),debug(`Cache Result:`),debug(JSON.stringify(s)),s})}function printCachesListForDiagnostics(e,t,n){return __awaiter$3(this,void 0,void 0,function*(){let r=`caches?key=${encodeURIComponent(e)}`,i=yield retryTypedResponse(`listCache`,()=>__awaiter$3(this,void 0,void 0,function*(){return t.getJson(getCacheApiUrl(r))}));if(i.statusCode===200){let t=i.result,r=t?.totalCount;if(r&&r>0){debug(`No matching cache found for cache key '${e}', version '${n} and scope ${process.env.GITHUB_REF}. There exist one or more cache(s) with similar key but they have different version or scope. See more info on cache matching here: https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#matching-a-cache-key \nOther caches with similar key:`);for(let e of t?.artifactCaches||[])debug(`Cache Key: ${e?.cacheKey}, Cache Version: ${e?.cacheVersion}, Cache Scope: ${e?.scope}, Cache Created: ${e?.creationTime}`)}}})}function downloadCache(e,t,n){return __awaiter$3(this,void 0,void 0,function*(){let r=new De(e),i=getDownloadOptions(n);r.hostname.endsWith(`.blob.core.windows.net`)?i.useAzureSdk?yield downloadCacheStorageSDK(e,t,i):i.concurrentBlobDownloads?yield downloadCacheHttpClientConcurrent(e,t,i):yield downloadCacheHttpClient(e,t):yield downloadCacheHttpClient(e,t)})}function reserveCache(e,t,n){return __awaiter$3(this,void 0,void 0,function*(){let r=createHttpClient(),i={key:e,version:getCacheVersion(t,n?.compressionMethod,n?.enableCrossOsArchive),cacheSize:n?.cacheSize};return yield retryTypedResponse(`reserveCache`,()=>__awaiter$3(this,void 0,void 0,function*(){return r.postJson(getCacheApiUrl(`caches`),i)}))})}function getContentRange(e,t){return`bytes ${e}-${t}/*`}function uploadChunk(e,t,n,r,i){return __awaiter$3(this,void 0,void 0,function*(){debug(`Uploading chunk of size ${i-r+1} bytes at offset ${r} with content range: ${getContentRange(r,i)}`);let a={"Content-Type":`application/octet-stream`,"Content-Range":getContentRange(r,i)},o=yield retryHttpClientResponse(`uploadChunk (start: ${r}, end: ${i})`,()=>__awaiter$3(this,void 0,void 0,function*(){return e.sendStream(`PATCH`,t,n(),a)}));if(!isSuccessStatusCode(o.message.statusCode))throw Error(`Cache service responded with ${o.message.statusCode} during upload chunk.`)})}function uploadFile(e,t,n,r){return __awaiter$3(this,void 0,void 0,function*(){let i=getArchiveFileSizeInBytes(n),o=getCacheApiUrl(`caches/${t.toString()}`),s=a.openSync(n,`r`),c=getUploadOptions(r),l=assertDefined(`uploadConcurrency`,c.uploadConcurrency),u=assertDefined(`uploadChunkSize`,c.uploadChunkSize),d=[...Array(l).keys()];debug(`Awaiting all uploads`);let f=0;try{yield Promise.all(d.map(()=>__awaiter$3(this,void 0,void 0,function*(){for(;fa.createReadStream(n,{fd:s,start:r,end:c,autoClose:!1}).on(`error`,e=>{throw Error(`Cache upload failed because file read failed with ${e.message}`)}),r,c)}})))}finally{a.closeSync(s)}})}function commitCache(e,t,n){return __awaiter$3(this,void 0,void 0,function*(){let r={size:n};return yield retryTypedResponse(`commitCache`,()=>__awaiter$3(this,void 0,void 0,function*(){return e.postJson(getCacheApiUrl(`caches/${t.toString()}`),r)}))})}function saveCache$2(e,t,n,r){return __awaiter$3(this,void 0,void 0,function*(){if(getUploadOptions(r).useAzureSdk){if(!n)throw Error(`Azure Storage SDK can only be used when a signed URL is provided.`);yield uploadCacheArchiveSDK(n,t,r)}else{let n=createHttpClient();debug(`Upload cache`),yield uploadFile(n,e,t,r),debug(`Commiting cache`);let i=getArchiveFileSizeInBytes(t);info(`Cache Size: ~${Math.round(i/1048576)} MB (${i} B)`);let a=yield commitCache(n,e,i);if(!isSuccessStatusCode(a.statusCode))throw Error(`Cache service responded with ${a.statusCode} during commit cache.`);info(`Cache saved successfully`)}})}var I_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isJsonObject=e.typeofJsonValue=void 0;function typeofJsonValue(e){let t=typeof e;if(t==`object`){if(Array.isArray(e))return`array`;if(e===null)return`null`}return t}e.typeofJsonValue=typeofJsonValue;function isJsonObject(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}e.isJsonObject=isJsonObject})),L_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.base64encode=e.base64decode=void 0;let t=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`.split(``),n=[];for(let e=0;e>4,s=o,a=2;break;case 2:r[i++]=(s&15)<<4|(o&60)>>2,s=o,a=3;break;case 3:r[i++]=(s&3)<<6|o,a=0}}if(a==1)throw Error(`invalid base64 string.`);return r.subarray(0,i)}e.base64decode=base64decode;function base64encode(e){let n=``,r=0,i,a=0;for(let o=0;o>2],a=(i&3)<<4,r=1;break;case 1:n+=t[a|i>>4],a=(i&15)<<2,r=2;break;case 2:n+=t[a|i>>6],n+=t[i&63],r=0}return r&&(n+=t[a],n+=`=`,r==1&&(n+=`=`)),n}e.base64encode=base64encode})),R_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.utf8read=void 0;let fromCharCodes=e=>String.fromCharCode.apply(String,e);function utf8read(e){if(e.length<1)return``;let t=0,n=[],r=[],i=0,a,o=e.length;for(;t191&&a<224?r[i++]=(a&31)<<6|e[t++]&63:a>239&&a<365?(a=((a&7)<<18|(e[t++]&63)<<12|(e[t++]&63)<<6|e[t++]&63)-65536,r[i++]=55296+(a>>10),r[i++]=56320+(a&1023)):r[i++]=(a&15)<<12|(e[t++]&63)<<6|e[t++]&63,i>8191&&(n.push(fromCharCodes(r)),i=0);return n.length?(i&&n.push(fromCharCodes(r.slice(0,i))),n.join(``)):fromCharCodes(r.slice(0,i))}e.utf8read=utf8read})),z_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.WireType=e.mergeBinaryOptions=e.UnknownFieldHandler=void 0,(function(e){e.symbol=Symbol.for(`protobuf-ts/unknown`),e.onRead=(t,n,r,i,a)=>{(is(n)?n[e.symbol]:n[e.symbol]=[]).push({no:r,wireType:i,data:a})},e.onWrite=(t,n,r)=>{for(let{no:t,wireType:i,data:a}of e.list(n))r.tag(t,i).raw(a)},e.list=(t,n)=>{if(is(t)){let r=t[e.symbol];return n?r.filter(e=>e.no==n):r}return[]},e.last=(t,n)=>e.list(t,n).slice(-1)[0];let is=t=>t&&Array.isArray(t[e.symbol])})(e.UnknownFieldHandler||={});function mergeBinaryOptions(e,t){return Object.assign(Object.assign({},e),t)}e.mergeBinaryOptions=mergeBinaryOptions,(function(e){e[e.Varint=0]=`Varint`,e[e.Bit64=1]=`Bit64`,e[e.LengthDelimited=2]=`LengthDelimited`,e[e.StartGroup=3]=`StartGroup`,e[e.EndGroup=4]=`EndGroup`,e[e.Bit32=5]=`Bit32`})(e.WireType||={})})),B_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.varint32read=e.varint32write=e.int64toString=e.int64fromString=e.varint64write=e.varint64read=void 0;function varint64read(){let e=0,t=0;for(let n=0;n<28;n+=7){let r=this.buf[this.pos++];if(e|=(r&127)<>4,!(n&128))return this.assertBounds(),[e,t];for(let n=3;n<=31;n+=7){let r=this.buf[this.pos++];if(t|=(r&127)<>>r,a=!(!(i>>>7)&&t==0),o=(a?i|128:i)&255;if(n.push(o),!a)return}let r=e>>>28&15|(t&7)<<4,i=!!(t>>3);if(n.push((i?r|128:r)&255),i){for(let e=3;e<31;e+=7){let r=t>>>e,i=!!(r>>>7),a=(i?r|128:r)&255;if(n.push(a),!i)return}n.push(t>>>31&1)}}e.varint64write=varint64write;let t=4294967296;function int64fromString(e){let n=e[0]==`-`;n&&(e=e.slice(1));let r=1e6,i=0,a=0;function add1e6digit(n,o){let s=Number(e.slice(n,o));a*=r,i=i*r+s,i>=t&&(a+=i/t|0,i%=t)}return add1e6digit(-24,-18),add1e6digit(-18,-12),add1e6digit(-12,-6),add1e6digit(-6),[n,i,a]}e.int64fromString=int64fromString;function int64toString(e,n){if(n>>>0<=2097151)return``+(t*n+(e>>>0));let r=e&16777215,i=(e>>>24|n<<8)>>>0&16777215,a=n>>16&65535,o=r+i*6777216+a*6710656,s=i+a*8147497,c=a*2,l=1e7;o>=l&&(s+=Math.floor(o/l),o%=l),s>=l&&(c+=Math.floor(s/l),s%=l);function decimalFrom1e7(e,t){let n=e?String(e):``;return t?`0000000`.slice(n.length)+n:n}return decimalFrom1e7(c,0)+decimalFrom1e7(s,c)+decimalFrom1e7(o,1)}e.int64toString=int64toString;function varint32write(e,t){if(e>=0){for(;e>127;)t.push(e&127|128),e>>>=7;t.push(e)}else{for(let n=0;n<9;n++)t.push(e&127|128),e>>=7;t.push(1)}}e.varint32write=varint32write;function varint32read(){let e=this.buf[this.pos++],t=e&127;if(!(e&128)||(e=this.buf[this.pos++],t|=(e&127)<<7,!(e&128))||(e=this.buf[this.pos++],t|=(e&127)<<14,!(e&128))||(e=this.buf[this.pos++],t|=(e&127)<<21,!(e&128)))return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let t=5;e&128&&t<10;t++)e=this.buf[this.pos++];if(e&128)throw Error(`invalid varint`);return this.assertBounds(),t>>>0}e.varint32read=varint32read})),V_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PbLong=e.PbULong=e.detectBi=void 0;let t=B_(),n;function detectBi(){let e=/* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8));n=globalThis.BigInt!==void 0&&typeof e.getBigInt64==`function`&&typeof e.getBigUint64==`function`&&typeof e.setBigInt64==`function`&&typeof e.setBigUint64==`function`?{MIN:BigInt(`-9223372036854775808`),MAX:BigInt(`9223372036854775807`),UMIN:BigInt(`0`),UMAX:BigInt(`18446744073709551615`),C:BigInt,V:e}:void 0}e.detectBi=detectBi,detectBi();function assertBi(e){if(!e)throw Error(`BigInt unavailable, see https://github.com/timostamm/protobuf-ts/blob/v1.0.8/MANUAL.md#bigint-support`)}let r=/^-?[0-9]+$/,i=4294967296,a=2147483648;var SharedPbLong=class{constructor(e,t){this.lo=e|0,this.hi=t|0}isZero(){return this.lo==0&&this.hi==0}toNumber(){let e=this.hi*i+(this.lo>>>0);if(!Number.isSafeInteger(e))throw Error(`cannot convert to safe number`);return e}},o=class PbULong extends SharedPbLong{static from(e){if(n)switch(typeof e){case`string`:if(e==`0`)return this.ZERO;if(e==``)throw Error(`string is no integer`);e=n.C(e);case`number`:if(e===0)return this.ZERO;e=n.C(e);case`bigint`:if(!e)return this.ZERO;if(en.UMAX)throw Error(`ulong too large`);return n.V.setBigUint64(0,e,!0),new PbULong(n.V.getInt32(0,!0),n.V.getInt32(4,!0))}else switch(typeof e){case`string`:if(e==`0`)return this.ZERO;if(e=e.trim(),!r.test(e))throw Error(`string is no integer`);let[n,a,o]=t.int64fromString(e);if(n)throw Error(`signed value for ulong`);return new PbULong(a,o);case`number`:if(e==0)return this.ZERO;if(!Number.isSafeInteger(e))throw Error(`number is no integer`);if(e<0)throw Error(`signed value for ulong`);return new PbULong(e,e/i)}throw Error(`unknown value `+typeof e)}toString(){return n?this.toBigInt().toString():t.int64toString(this.lo,this.hi)}toBigInt(){return assertBi(n),n.V.setInt32(0,this.lo,!0),n.V.setInt32(4,this.hi,!0),n.V.getBigUint64(0,!0)}};e.PbULong=o,o.ZERO=new o(0,0);var s=class PbLong extends SharedPbLong{static from(e){if(n)switch(typeof e){case`string`:if(e==`0`)return this.ZERO;if(e==``)throw Error(`string is no integer`);e=n.C(e);case`number`:if(e===0)return this.ZERO;e=n.C(e);case`bigint`:if(!e)return this.ZERO;if(en.MAX)throw Error(`signed long too large`);return n.V.setBigInt64(0,e,!0),new PbLong(n.V.getInt32(0,!0),n.V.getInt32(4,!0))}else switch(typeof e){case`string`:if(e==`0`)return this.ZERO;if(e=e.trim(),!r.test(e))throw Error(`string is no integer`);let[n,o,s]=t.int64fromString(e);if(n){if(s>a||s==a&&o!=0)throw Error(`signed long too small`)}else if(s>=a)throw Error(`signed long too large`);let c=new PbLong(o,s);return n?c.negate():c;case`number`:if(e==0)return this.ZERO;if(!Number.isSafeInteger(e))throw Error(`number is no integer`);return e>0?new PbLong(e,e/i):new PbLong(-e,-e/i).negate()}throw Error(`unknown value `+typeof e)}isNegative(){return!!(this.hi&a)}negate(){let e=~this.hi,t=this.lo;return t?t=~t+1:e+=1,new PbLong(t,e)}toString(){if(n)return this.toBigInt().toString();if(this.isNegative()){let e=this.negate();return`-`+t.int64toString(e.lo,e.hi)}return t.int64toString(this.lo,this.hi)}toBigInt(){return assertBi(n),n.V.setInt32(0,this.lo,!0),n.V.setInt32(4,this.hi,!0),n.V.getBigInt64(0,!0)}};e.PbLong=s,s.ZERO=new s(0,0)})),H_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BinaryReader=e.binaryReadOptions=void 0;let t=z_(),n=V_(),r=B_(),i={readUnknownField:!0,readerFactory:e=>new BinaryReader(e)};function binaryReadOptions(e){return e?Object.assign(Object.assign({},i),e):i}e.binaryReadOptions=binaryReadOptions;var BinaryReader=class{constructor(e,t){this.varint64=r.varint64read,this.uint32=r.varint32read,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=t??new TextDecoder(`utf-8`,{fatal:!0,ignoreBOM:!0})}tag(){let e=this.uint32(),t=e>>>3,n=e&7;if(t<=0||n<0||n>5)throw Error(`illegal tag: field no `+t+` wire type `+n);return[t,n]}skip(e){let n=this.pos;switch(e){case t.WireType.Varint:for(;this.buf[this.pos++]&128;);break;case t.WireType.Bit64:this.pos+=4;case t.WireType.Bit32:this.pos+=4;break;case t.WireType.LengthDelimited:let n=this.uint32();this.pos+=n;break;case t.WireType.StartGroup:let r;for(;(r=this.tag()[1])!==t.WireType.EndGroup;)this.skip(r);break;default:throw Error(`cant skip wire type `+e)}return this.assertBounds(),this.buf.subarray(n,this.pos)}assertBounds(){if(this.pos>this.len)throw RangeError(`premature EOF`)}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)}int64(){return new n.PbLong(...this.varint64())}uint64(){return new n.PbULong(...this.varint64())}sint64(){let[e,t]=this.varint64(),r=-(e&1);return e=(e>>>1|(t&1)<<31)^r,t=t>>>1^r,new n.PbLong(e,t)}bool(){let[e,t]=this.varint64();return e!==0||t!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return new n.PbULong(this.sfixed32(),this.sfixed32())}sfixed64(){return new n.PbLong(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),t=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(t,t+e)}string(){return this.textDecoder.decode(this.bytes())}};e.BinaryReader=BinaryReader})),U_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.assertFloat32=e.assertUInt32=e.assertInt32=e.assertNever=e.assert=void 0;function assert(e,t){if(!e)throw Error(t)}e.assert=assert;function assertNever(e,t){throw Error(t??`Unexpected object: `+e)}e.assertNever=assertNever;function assertInt32(e){if(typeof e!=`number`)throw Error(`invalid int 32: `+typeof e);if(!Number.isInteger(e)||e>2147483647||e<-2147483648)throw Error(`invalid int 32: `+e)}e.assertInt32=assertInt32;function assertUInt32(e){if(typeof e!=`number`)throw Error(`invalid uint 32: `+typeof e);if(!Number.isInteger(e)||e>4294967295||e<0)throw Error(`invalid uint 32: `+e)}e.assertUInt32=assertUInt32;function assertFloat32(e){if(typeof e!=`number`)throw Error(`invalid float 32: `+typeof e);if(Number.isFinite(e)&&(e>34028234663852886e22||e<-34028234663852886e22))throw Error(`invalid float 32: `+e)}e.assertFloat32=assertFloat32})),W_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BinaryWriter=e.binaryWriteOptions=void 0;let t=V_(),n=B_(),r=U_(),i={writeUnknownFields:!0,writerFactory:()=>new BinaryWriter};function binaryWriteOptions(e){return e?Object.assign(Object.assign({},i),e):i}e.binaryWriteOptions=binaryWriteOptions;var BinaryWriter=class{constructor(e){this.stack=[],this.textEncoder=e??new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let t=0;t>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(r.assertUInt32(e);e>127;)this.buf.push(e&127|128),e>>>=7;return this.buf.push(e),this}int32(e){return r.assertInt32(e),n.varint32write(e,this.buf),this}bool(e){return this.buf.push(+!!e),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let t=this.textEncoder.encode(e);return this.uint32(t.byteLength),this.raw(t)}float(e){r.assertFloat32(e);let t=/* @__PURE__ */ new Uint8Array(4);return new DataView(t.buffer).setFloat32(0,e,!0),this.raw(t)}double(e){let t=/* @__PURE__ */ new Uint8Array(8);return new DataView(t.buffer).setFloat64(0,e,!0),this.raw(t)}fixed32(e){r.assertUInt32(e);let t=/* @__PURE__ */ new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),this.raw(t)}sfixed32(e){r.assertInt32(e);let t=/* @__PURE__ */ new Uint8Array(4);return new DataView(t.buffer).setInt32(0,e,!0),this.raw(t)}sint32(e){return r.assertInt32(e),e=(e<<1^e>>31)>>>0,n.varint32write(e,this.buf),this}sfixed64(e){let n=/* @__PURE__ */ new Uint8Array(8),r=new DataView(n.buffer),i=t.PbLong.from(e);return r.setInt32(0,i.lo,!0),r.setInt32(4,i.hi,!0),this.raw(n)}fixed64(e){let n=/* @__PURE__ */ new Uint8Array(8),r=new DataView(n.buffer),i=t.PbULong.from(e);return r.setInt32(0,i.lo,!0),r.setInt32(4,i.hi,!0),this.raw(n)}int64(e){let r=t.PbLong.from(e);return n.varint64write(r.lo,r.hi,this.buf),this}sint64(e){let r=t.PbLong.from(e),i=r.hi>>31,a=r.lo<<1^i,o=(r.hi<<1|r.lo>>>31)^i;return n.varint64write(a,o,this.buf),this}uint64(e){let r=t.PbULong.from(e);return n.varint64write(r.lo,r.hi,this.buf),this}};e.BinaryWriter=BinaryWriter})),G_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.mergeJsonOptions=e.jsonWriteOptions=e.jsonReadOptions=void 0;let t={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0},n={ignoreUnknownFields:!1};function jsonReadOptions(e){return e?Object.assign(Object.assign({},n),e):n}e.jsonReadOptions=jsonReadOptions;function jsonWriteOptions(e){return e?Object.assign(Object.assign({},t),e):t}e.jsonWriteOptions=jsonWriteOptions;function mergeJsonOptions(e,t){let n=Object.assign(Object.assign({},e),t);return n.typeRegistry=[...e?.typeRegistry??[],...t?.typeRegistry??[]],n}e.mergeJsonOptions=mergeJsonOptions})),K_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MESSAGE_TYPE=void 0,e.MESSAGE_TYPE=Symbol.for(`protobuf-ts/message-type`)})),q_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.lowerCamelCase=void 0;function lowerCamelCase(e){let t=!1,n=[];for(let r=0;r{Object.defineProperty(e,"__esModule",{value:!0}),e.readMessageOption=e.readFieldOption=e.readFieldOptions=e.normalizeFieldInfo=e.RepeatType=e.LongType=e.ScalarType=void 0;let t=q_();(function(e){e[e.DOUBLE=1]=`DOUBLE`,e[e.FLOAT=2]=`FLOAT`,e[e.INT64=3]=`INT64`,e[e.UINT64=4]=`UINT64`,e[e.INT32=5]=`INT32`,e[e.FIXED64=6]=`FIXED64`,e[e.FIXED32=7]=`FIXED32`,e[e.BOOL=8]=`BOOL`,e[e.STRING=9]=`STRING`,e[e.BYTES=12]=`BYTES`,e[e.UINT32=13]=`UINT32`,e[e.SFIXED32=15]=`SFIXED32`,e[e.SFIXED64=16]=`SFIXED64`,e[e.SINT32=17]=`SINT32`,e[e.SINT64=18]=`SINT64`})(e.ScalarType||={}),(function(e){e[e.BIGINT=0]=`BIGINT`,e[e.STRING=1]=`STRING`,e[e.NUMBER=2]=`NUMBER`})(e.LongType||={});var n;(function(e){e[e.NO=0]=`NO`,e[e.PACKED=1]=`PACKED`,e[e.UNPACKED=2]=`UNPACKED`})(n=e.RepeatType||={});function normalizeFieldInfo(e){return e.localName=e.localName??t.lowerCamelCase(e.name),e.jsonName=e.jsonName??t.lowerCamelCase(e.name),e.repeat=e.repeat??n.NO,e.opt=e.opt??(!e.repeat&&!e.oneof&&e.kind==`message`),e}e.normalizeFieldInfo=normalizeFieldInfo;function readFieldOptions(e,t,n,r){let i=e.fields.find((e,n)=>e.localName==t||n==t)?.options;return i&&i[n]?r.fromJson(i[n]):void 0}e.readFieldOptions=readFieldOptions;function readFieldOption(e,t,n,r){let i=e.fields.find((e,n)=>e.localName==t||n==t)?.options;if(!i)return;let a=i[n];return a===void 0?a:r?r.fromJson(a):a}e.readFieldOption=readFieldOption;function readMessageOption(e,t,n){let r=e.options[t];return r===void 0?r:n?n.fromJson(r):r}e.readMessageOption=readMessageOption})),Y_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getSelectedOneofValue=e.clearOneofValue=e.setUnknownOneofValue=e.setOneofValue=e.getOneofValue=e.isOneofGroup=void 0;function isOneofGroup(e){if(typeof e!=`object`||!e||!e.hasOwnProperty(`oneofKind`))return!1;switch(typeof e.oneofKind){case`string`:return e[e.oneofKind]!==void 0&&Object.keys(e).length==2;case`undefined`:return Object.keys(e).length==1;default:return!1}}e.isOneofGroup=isOneofGroup;function getOneofValue(e,t){return e[t]}e.getOneofValue=getOneofValue;function setOneofValue(e,t,n){e.oneofKind!==void 0&&delete e[e.oneofKind],e.oneofKind=t,n!==void 0&&(e[t]=n)}e.setOneofValue=setOneofValue;function setUnknownOneofValue(e,t,n){e.oneofKind!==void 0&&delete e[e.oneofKind],e.oneofKind=t,n!==void 0&&t!==void 0&&(e[t]=n)}e.setUnknownOneofValue=setUnknownOneofValue;function clearOneofValue(e){e.oneofKind!==void 0&&delete e[e.oneofKind],e.oneofKind=void 0}e.clearOneofValue=clearOneofValue;function getSelectedOneofValue(e){if(e.oneofKind!==void 0)return e[e.oneofKind]}e.getSelectedOneofValue=getSelectedOneofValue})),X_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ReflectionTypeCheck=void 0;let t=J_(),n=Y_();e.ReflectionTypeCheck=class{constructor(e){this.fields=e.fields??[]}prepare(){if(this.data)return;let e=[],t=[],n=[];for(let r of this.fields)if(r.oneof)n.includes(r.oneof)||(n.push(r.oneof),e.push(r.oneof),t.push(r.oneof));else switch(t.push(r.localName),r.kind){case`scalar`:case`enum`:(!r.opt||r.repeat)&&e.push(r.localName);break;case`message`:r.repeat&&e.push(r.localName);break;case`map`:e.push(r.localName)}this.data={req:e,known:t,oneofs:Object.values(n)}}is(e,t,r=!1){if(t<0)return!0;if(typeof e!=`object`||!e)return!1;this.prepare();let i=Object.keys(e),a=this.data;if(i.length!i.includes(e))||!r&&i.some(e=>!a.known.includes(e)))return!1;if(t<1)return!0;for(let i of a.oneofs){let a=e[i];if(!n.isOneofGroup(a))return!1;if(a.oneofKind===void 0)continue;let o=this.fields.find(e=>e.localName===a.oneofKind);if(!o||!this.field(a[a.oneofKind],o,r,t))return!1}for(let n of this.fields)if(n.oneof===void 0&&!this.field(e[n.localName],n,r,t))return!1;return!0}field(e,n,r,i){let a=n.repeat;switch(n.kind){case`scalar`:return e===void 0?n.opt:a?this.scalars(e,n.T,i,n.L):this.scalar(e,n.T,n.L);case`enum`:return e===void 0?n.opt:a?this.scalars(e,t.ScalarType.INT32,i):this.scalar(e,t.ScalarType.INT32);case`message`:return e===void 0?!0:a?this.messages(e,n.T(),r,i):this.message(e,n.T(),r,i);case`map`:if(typeof e!=`object`||!e)return!1;if(i<2)return!0;if(!this.mapKeys(e,n.K,i))return!1;switch(n.V.kind){case`scalar`:return this.scalars(Object.values(e),n.V.T,i,n.V.L);case`enum`:return this.scalars(Object.values(e),t.ScalarType.INT32,i);case`message`:return this.messages(Object.values(e),n.V.T(),r,i)}}return!0}message(e,t,n,r){return n?t.isAssignable(e,r):t.is(e,r)}messages(e,t,n,r){if(!Array.isArray(e))return!1;if(r<2)return!0;if(n){for(let n=0;nparseInt(e)),n,r);case t.ScalarType.BOOL:return this.scalars(i.slice(0,r).map(e=>e==`true`||e!=`false`&&e),n,r);default:return this.scalars(i,n,r,t.LongType.STRING)}}}})),Z_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.reflectionLongConvert=void 0;let t=J_();function reflectionLongConvert(e,n){switch(n){case t.LongType.BIGINT:return e.toBigInt();case t.LongType.NUMBER:return e.toNumber();default:return e.toString()}}e.reflectionLongConvert=reflectionLongConvert})),Q_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ReflectionJsonReader=void 0;let t=I_(),n=L_(),r=J_(),i=V_(),a=U_(),o=Z_();e.ReflectionJsonReader=class{constructor(e){this.info=e}prepare(){if(this.fMap===void 0){this.fMap={};let e=this.info.fields??[];for(let t of e)this.fMap[t.name]=t,this.fMap[t.jsonName]=t,this.fMap[t.localName]=t}}assert(e,n,r){if(!e){let e=t.typeofJsonValue(r);throw(e==`number`||e==`boolean`)&&(e=r.toString()),Error(`Cannot parse JSON ${e} for ${this.info.typeName}#${n}`)}}read(e,n,i){this.prepare();let a=[];for(let[o,s]of Object.entries(e)){let e=this.fMap[o];if(!e){if(!i.ignoreUnknownFields)throw Error(`Found unknown field while reading ${this.info.typeName} from JSON format. JSON key: ${o}`);continue}let c=e.localName,l;if(e.oneof){if(s===null&&(e.kind!==`enum`||e.T()[0]!==`google.protobuf.NullValue`))continue;if(a.includes(e.oneof))throw Error(`Multiple members of the oneof group "${e.oneof}" of ${this.info.typeName} are present in JSON.`);a.push(e.oneof),l=n[e.oneof]={oneofKind:c}}else l=n;if(e.kind==`map`){if(s===null)continue;this.assert(t.isJsonObject(s),e.name,s);let n=l[c];for(let[t,a]of Object.entries(s)){this.assert(a!==null,e.name+` map value`,null);let o;switch(e.V.kind){case`message`:o=e.V.T().internalJsonRead(a,i);break;case`enum`:if(o=this.enum(e.V.T(),a,e.name,i.ignoreUnknownFields),o===!1)continue;break;case`scalar`:o=this.scalar(a,e.V.T,e.V.L,e.name)}this.assert(o!==void 0,e.name+` map value`,a);let s=t;e.K==r.ScalarType.BOOL&&(s=s==`true`||s!=`false`&&s),s=this.scalar(s,e.K,r.LongType.STRING,e.name).toString(),n[s]=o}}else if(e.repeat){if(s===null)continue;this.assert(Array.isArray(s),e.name,s);let t=l[c];for(let n of s){this.assert(n!==null,e.name,null);let r;switch(e.kind){case`message`:r=e.T().internalJsonRead(n,i);break;case`enum`:if(r=this.enum(e.T(),n,e.name,i.ignoreUnknownFields),r===!1)continue;break;case`scalar`:r=this.scalar(n,e.T,e.L,e.name)}this.assert(r!==void 0,e.name,s),t.push(r)}}else switch(e.kind){case`message`:if(s===null&&e.T().typeName!=`google.protobuf.Value`){this.assert(e.oneof===void 0,e.name+` (oneof member)`,null);continue}l[c]=e.T().internalJsonRead(s,i,l[c]);break;case`enum`:if(s===null)continue;let t=this.enum(e.T(),s,e.name,i.ignoreUnknownFields);if(t===!1)continue;l[c]=t;break;case`scalar`:if(s===null)continue;l[c]=this.scalar(s,e.T,e.L,e.name)}}}enum(e,t,n,r){if(e[0]==`google.protobuf.NullValue`&&a.assert(t===null||t===`NULL_VALUE`,`Unable to parse field ${this.info.typeName}#${n}, enum ${e[0]} only accepts null.`),t===null)return 0;switch(typeof t){case`number`:return a.assert(Number.isInteger(t),`Unable to parse field ${this.info.typeName}#${n}, enum can only be integral number, got ${t}.`),t;case`string`:let i=t;e[2]&&t.substring(0,e[2].length)===e[2]&&(i=t.substring(e[2].length));let o=e[1][i];return o===void 0&&r?!1:(a.assert(typeof o==`number`,`Unable to parse field ${this.info.typeName}#${n}, enum ${e[0]} has no value for "${t}".`),o)}a.assert(!1,`Unable to parse field ${this.info.typeName}#${n}, cannot parse enum value from ${typeof t}".`)}scalar(e,t,s,c){let l;try{switch(t){case r.ScalarType.DOUBLE:case r.ScalarType.FLOAT:if(e===null)return 0;if(e===`NaN`)return NaN;if(e===`Infinity`)return 1/0;if(e===`-Infinity`)return-1/0;if(e===``){l=`empty string`;break}if(typeof e==`string`&&e.trim().length!==e.length){l=`extra whitespace`;break}if(typeof e!=`string`&&typeof e!=`number`)break;let c=Number(e);if(Number.isNaN(c)){l=`not a number`;break}if(!Number.isFinite(c)){l=`too large or small`;break}return t==r.ScalarType.FLOAT&&a.assertFloat32(c),c;case r.ScalarType.INT32:case r.ScalarType.FIXED32:case r.ScalarType.SFIXED32:case r.ScalarType.SINT32:case r.ScalarType.UINT32:if(e===null)return 0;let u;if(typeof e==`number`?u=e:e===``?l=`empty string`:typeof e==`string`&&(e.trim().length===e.length?u=Number(e):l=`extra whitespace`),u===void 0)break;return t==r.ScalarType.UINT32?a.assertUInt32(u):a.assertInt32(u),u;case r.ScalarType.INT64:case r.ScalarType.SFIXED64:case r.ScalarType.SINT64:if(e===null)return o.reflectionLongConvert(i.PbLong.ZERO,s);if(typeof e!=`number`&&typeof e!=`string`)break;return o.reflectionLongConvert(i.PbLong.from(e),s);case r.ScalarType.FIXED64:case r.ScalarType.UINT64:if(e===null)return o.reflectionLongConvert(i.PbULong.ZERO,s);if(typeof e!=`number`&&typeof e!=`string`)break;return o.reflectionLongConvert(i.PbULong.from(e),s);case r.ScalarType.BOOL:if(e===null)return!1;if(typeof e!=`boolean`)break;return e;case r.ScalarType.STRING:if(e===null)return``;if(typeof e!=`string`){l=`extra whitespace`;break}return e;case r.ScalarType.BYTES:if(e===null||e===``)return/* @__PURE__ */ new Uint8Array;if(typeof e!=`string`)break;return n.base64decode(e)}}catch(e){l=e.message}this.assert(!1,c+(l?` - `+l:``),e)}}})),$_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ReflectionJsonWriter=void 0;let t=L_(),n=V_(),r=J_(),i=U_();e.ReflectionJsonWriter=class{constructor(e){this.fields=e.fields??[]}write(e,t){let n={},r=e;for(let e of this.fields){if(!e.oneof){let i=this.field(e,r[e.localName],t);i!==void 0&&(n[t.useProtoFieldName?e.name:e.jsonName]=i);continue}let a=r[e.oneof];if(a.oneofKind!==e.localName)continue;let o=e.kind==`scalar`||e.kind==`enum`?Object.assign(Object.assign({},t),{emitDefaultValues:!0}):t,s=this.field(e,a[e.localName],o);i.assert(s!==void 0),n[t.useProtoFieldName?e.name:e.jsonName]=s}return n}field(e,t,n){let r;if(e.kind==`map`){i.assert(typeof t==`object`&&!!t);let a={};switch(e.V.kind){case`scalar`:for(let[n,r]of Object.entries(t)){let t=this.scalar(e.V.T,r,e.name,!1,!0);i.assert(t!==void 0),a[n.toString()]=t}break;case`message`:let r=e.V.T();for(let[o,s]of Object.entries(t)){let t=this.message(r,s,e.name,n);i.assert(t!==void 0),a[o.toString()]=t}break;case`enum`:let o=e.V.T();for(let[r,s]of Object.entries(t)){i.assert(s===void 0||typeof s==`number`);let t=this.enum(o,s,e.name,!1,!0,n.enumAsInteger);i.assert(t!==void 0),a[r.toString()]=t}}(n.emitDefaultValues||Object.keys(a).length>0)&&(r=a)}else if(e.repeat){i.assert(Array.isArray(t));let a=[];switch(e.kind){case`scalar`:for(let n=0;n0||n.emitDefaultValues)&&(r=a)}else switch(e.kind){case`scalar`:r=this.scalar(e.T,t,e.name,e.opt,n.emitDefaultValues);break;case`enum`:r=this.enum(e.T(),t,e.name,e.opt,n.emitDefaultValues,n.enumAsInteger);break;case`message`:r=this.message(e.T(),t,e.name,n)}return r}enum(e,t,n,r,a,o){if(e[0]==`google.protobuf.NullValue`)return!a&&!r?void 0:null;if(t===void 0){i.assert(r);return}if(t!==0||a||r)return i.assert(typeof t==`number`),i.assert(Number.isInteger(t)),o||!e[1].hasOwnProperty(t)?t:e[2]?e[2]+e[1][t]:e[1][t]}message(e,t,n,r){return t===void 0?r.emitDefaultValues?null:void 0:e.internalJsonWrite(t,r)}scalar(e,a,o,s,c){if(a===void 0){i.assert(s);return}let l=c||s;switch(e){case r.ScalarType.INT32:case r.ScalarType.SFIXED32:case r.ScalarType.SINT32:return a===0?l?0:void 0:(i.assertInt32(a),a);case r.ScalarType.FIXED32:case r.ScalarType.UINT32:return a===0?l?0:void 0:(i.assertUInt32(a),a);case r.ScalarType.FLOAT:i.assertFloat32(a);case r.ScalarType.DOUBLE:return a===0?l?0:void 0:(i.assert(typeof a==`number`),Number.isNaN(a)?`NaN`:a===1/0?`Infinity`:a===-1/0?`-Infinity`:a);case r.ScalarType.STRING:return a===``?l?``:void 0:(i.assert(typeof a==`string`),a);case r.ScalarType.BOOL:return a===!1?!l&&void 0:(i.assert(typeof a==`boolean`),a);case r.ScalarType.UINT64:case r.ScalarType.FIXED64:i.assert(typeof a==`number`||typeof a==`string`||typeof a==`bigint`);let e=n.PbULong.from(a);return e.isZero()&&!l?void 0:e.toString();case r.ScalarType.INT64:case r.ScalarType.SFIXED64:case r.ScalarType.SINT64:i.assert(typeof a==`number`||typeof a==`string`||typeof a==`bigint`);let o=n.PbLong.from(a);return o.isZero()&&!l?void 0:o.toString();case r.ScalarType.BYTES:return i.assert(a instanceof Uint8Array),a.byteLength?t.base64encode(a):l?``:void 0}}}})),ev=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.reflectionScalarDefault=void 0;let t=J_(),n=Z_(),r=V_();function reflectionScalarDefault(e,i=t.LongType.STRING){switch(e){case t.ScalarType.BOOL:return!1;case t.ScalarType.UINT64:case t.ScalarType.FIXED64:return n.reflectionLongConvert(r.PbULong.ZERO,i);case t.ScalarType.INT64:case t.ScalarType.SFIXED64:case t.ScalarType.SINT64:return n.reflectionLongConvert(r.PbLong.ZERO,i);case t.ScalarType.DOUBLE:case t.ScalarType.FLOAT:return 0;case t.ScalarType.BYTES:return/* @__PURE__ */ new Uint8Array;case t.ScalarType.STRING:return``;default:return 0}}e.reflectionScalarDefault=reflectionScalarDefault})),tv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ReflectionBinaryReader=void 0;let t=z_(),n=J_(),r=Z_(),i=ev();e.ReflectionBinaryReader=class{constructor(e){this.info=e}prepare(){if(!this.fieldNoToField){let e=this.info.fields??[];this.fieldNoToField=new Map(e.map(e=>[e.no,e]))}}read(e,r,i,a){this.prepare();let o=a===void 0?e.len:e.pos+a;for(;e.pos{Object.defineProperty(e,"__esModule",{value:!0}),e.ReflectionBinaryWriter=void 0;let t=z_(),n=J_(),r=U_(),i=V_();e.ReflectionBinaryWriter=class{constructor(e){this.info=e}prepare(){if(!this.fields){let e=this.info.fields?this.info.fields.concat():[];this.fields=e.sort((e,t)=>e.no-t.no)}}write(e,i,a){this.prepare();for(let t of this.fields){let o,s,c=t.repeat,l=t.localName;if(t.oneof){let n=e[t.oneof];if(n.oneofKind!==l)continue;o=n[l],s=!0}else o=e[l],s=!1;switch(t.kind){case`scalar`:case`enum`:let e=t.kind==`enum`?n.ScalarType.INT32:t.T;if(c){if(r.assert(Array.isArray(o)),c==n.RepeatType.PACKED)this.packed(i,e,t.no,o);else for(let n of o)this.scalar(i,e,t.no,n,!0)}else o===void 0?r.assert(t.opt):this.scalar(i,e,t.no,o,s||t.opt);break;case`message`:if(c){r.assert(Array.isArray(o));for(let e of o)this.message(i,a,t.T(),t.no,e)}else this.message(i,a,t.T(),t.no,o);break;case`map`:r.assert(typeof o==`object`&&!!o);for(let[e,n]of Object.entries(o))this.mapEntry(i,a,t,e,n)}}let o=a.writeUnknownFields;o!==!1&&(o===!0?t.UnknownFieldHandler.onWrite:o)(this.info.typeName,e,i)}mapEntry(e,i,a,o,s){e.tag(a.no,t.WireType.LengthDelimited),e.fork();let c=o;switch(a.K){case n.ScalarType.INT32:case n.ScalarType.FIXED32:case n.ScalarType.UINT32:case n.ScalarType.SFIXED32:case n.ScalarType.SINT32:c=Number.parseInt(o);break;case n.ScalarType.BOOL:r.assert(o==`true`||o==`false`),c=o==`true`}switch(this.scalar(e,a.K,1,c,!0),a.V.kind){case`scalar`:this.scalar(e,a.V.T,2,s,!0);break;case`enum`:this.scalar(e,n.ScalarType.INT32,2,s,!0);break;case`message`:this.message(e,i,a.V.T(),2,s)}e.join()}message(e,n,r,i,a){a!==void 0&&(r.internalBinaryWrite(a,e.tag(i,t.WireType.LengthDelimited).fork(),n),e.join())}scalar(e,t,n,r,i){let[a,o,s]=this.scalarInfo(t,r);(!s||i)&&(e.tag(n,a),e[o](r))}packed(e,i,a,o){if(!o.length)return;r.assert(i!==n.ScalarType.BYTES&&i!==n.ScalarType.STRING),e.tag(a,t.WireType.LengthDelimited),e.fork();let[,s]=this.scalarInfo(i);for(let t=0;t{Object.defineProperty(e,"__esModule",{value:!0}),e.reflectionCreate=void 0;let t=ev(),n=K_();function reflectionCreate(e){let r=e.messagePrototype?Object.create(e.messagePrototype):Object.defineProperty({},n.MESSAGE_TYPE,{value:e});for(let n of e.fields){let e=n.localName;if(!n.opt){if(n.oneof)r[n.oneof]={oneofKind:void 0};else if(n.repeat)r[e]=[];else switch(n.kind){case`scalar`:r[e]=t.reflectionScalarDefault(n.T,n.L);break;case`enum`:r[e]=0;break;case`map`:r[e]={}}}}return r}e.reflectionCreate=reflectionCreate})),iv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.reflectionMergePartial=void 0;function reflectionMergePartial(e,t,n){let r,i=n,a;for(let n of e.fields){let e=n.localName;if(n.oneof){let o=i[n.oneof];if(o?.oneofKind==null)continue;if(r=o[e],a=t[n.oneof],a.oneofKind=o.oneofKind,r==null){delete a[e];continue}}else if(r=i[e],a=t,r==null)continue;switch(n.repeat&&(a[e].length=r.length),n.kind){case`scalar`:case`enum`:if(n.repeat)for(let t=0;t{Object.defineProperty(e,"__esModule",{value:!0}),e.reflectionEquals=void 0;let t=J_();function reflectionEquals(e,r,i){if(r===i)return!0;if(!r||!i)return!1;for(let a of e.fields){let e=a.localName,o=a.oneof?r[a.oneof][e]:r[e],s=a.oneof?i[a.oneof][e]:i[e];switch(a.kind){case`enum`:case`scalar`:let e=a.kind==`enum`?t.ScalarType.INT32:a.T;if(!(a.repeat?repeatedPrimitiveEq(e,o,s):primitiveEq(e,o,s)))return!1;break;case`map`:if(!(a.V.kind==`message`?repeatedMsgEq(a.V.T(),n(o),n(s)):repeatedPrimitiveEq(a.V.kind==`enum`?t.ScalarType.INT32:a.V.T,n(o),n(s))))return!1;break;case`message`:let r=a.T();if(!(a.repeat?repeatedMsgEq(r,o,s):r.equals(o,s)))return!1}}return!0}e.reflectionEquals=reflectionEquals;let n=Object.values;function primitiveEq(e,n,r){if(n===r)return!0;if(e!==t.ScalarType.BYTES)return!1;let i=n,a=r;if(i.length!==a.length)return!1;for(let e=0;e{Object.defineProperty(e,"__esModule",{value:!0}),e.MessageType=void 0;let t=K_(),n=J_(),r=X_(),i=Q_(),a=$_(),o=tv(),s=nv(),c=rv(),l=iv(),u=I_(),d=G_(),f=av(),p=W_(),m=H_(),h=Object.getOwnPropertyDescriptors(Object.getPrototypeOf({})),g=h[t.MESSAGE_TYPE]={};e.MessageType=class{constructor(e,t,c){this.defaultCheckDepth=16,this.typeName=e,this.fields=t.map(n.normalizeFieldInfo),this.options=c??{},g.value=this,this.messagePrototype=Object.create(null,h),this.refTypeCheck=new r.ReflectionTypeCheck(this),this.refJsonReader=new i.ReflectionJsonReader(this),this.refJsonWriter=new a.ReflectionJsonWriter(this),this.refBinReader=new o.ReflectionBinaryReader(this),this.refBinWriter=new s.ReflectionBinaryWriter(this)}create(e){let t=c.reflectionCreate(this);return e!==void 0&&l.reflectionMergePartial(this,t,e),t}clone(e){let t=this.create();return l.reflectionMergePartial(this,t,e),t}equals(e,t){return f.reflectionEquals(this,e,t)}is(e,t=this.defaultCheckDepth){return this.refTypeCheck.is(e,t,!1)}isAssignable(e,t=this.defaultCheckDepth){return this.refTypeCheck.is(e,t,!0)}mergePartial(e,t){l.reflectionMergePartial(this,e,t)}fromBinary(e,t){let n=m.binaryReadOptions(t);return this.internalBinaryRead(n.readerFactory(e),e.byteLength,n)}fromJson(e,t){return this.internalJsonRead(e,d.jsonReadOptions(t))}fromJsonString(e,t){let n=JSON.parse(e);return this.fromJson(n,t)}toJson(e,t){return this.internalJsonWrite(e,d.jsonWriteOptions(t))}toJsonString(e,t){let n=this.toJson(e,t);return JSON.stringify(n,null,t?.prettySpaces??0)}toBinary(e,t){let n=p.binaryWriteOptions(t);return this.internalBinaryWrite(e,n.writerFactory(),n).finish()}internalJsonRead(e,t,n){if(typeof e==`object`&&e&&!Array.isArray(e)){let r=n??this.create();return this.refJsonReader.read(e,r,t),r}throw Error(`Unable to parse message ${this.typeName} from JSON ${u.typeofJsonValue(e)}.`)}internalJsonWrite(e,t){return this.refJsonWriter.write(e,t)}internalBinaryWrite(e,t,n){return this.refBinWriter.write(e,t,n),t}internalBinaryRead(e,t,n,r){let i=r??this.create();return this.refBinReader.read(e,i,n,t),i}}})),sv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.containsMessageType=void 0;let t=K_();function containsMessageType(e){return e[t.MESSAGE_TYPE]!=null}e.containsMessageType=containsMessageType})),cv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.listEnumNumbers=e.listEnumNames=e.listEnumValues=e.isEnumObject=void 0;function isEnumObject(e){if(typeof e!=`object`||!e||!e.hasOwnProperty(0))return!1;for(let t of Object.keys(e)){let n=parseInt(t);if(Number.isNaN(n)){let n=e[t];if(n===void 0||typeof n!=`number`||e[n]===void 0)return!1}else{let t=e[n];if(t===void 0||e[t]!==n)return!1}}return!0}e.isEnumObject=isEnumObject;function listEnumValues(e){if(!isEnumObject(e))throw Error(`not a typescript enum object`);let t=[];for(let[n,r]of Object.entries(e))typeof r==`number`&&t.push({name:n,number:r});return t}e.listEnumValues=listEnumValues;function listEnumNames(e){return listEnumValues(e).map(e=>e.name)}e.listEnumNames=listEnumNames;function listEnumNumbers(e){return listEnumValues(e).map(e=>e.number).filter((e,t,n)=>n.indexOf(e)==t)}e.listEnumNumbers=listEnumNumbers})),lv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=I_();Object.defineProperty(e,"typeofJsonValue",{enumerable:!0,get:function(){return t.typeofJsonValue}}),Object.defineProperty(e,"isJsonObject",{enumerable:!0,get:function(){return t.isJsonObject}});var n=L_();Object.defineProperty(e,"base64decode",{enumerable:!0,get:function(){return n.base64decode}}),Object.defineProperty(e,"base64encode",{enumerable:!0,get:function(){return n.base64encode}});var r=R_();Object.defineProperty(e,"utf8read",{enumerable:!0,get:function(){return r.utf8read}});var i=z_();Object.defineProperty(e,"WireType",{enumerable:!0,get:function(){return i.WireType}}),Object.defineProperty(e,"mergeBinaryOptions",{enumerable:!0,get:function(){return i.mergeBinaryOptions}}),Object.defineProperty(e,"UnknownFieldHandler",{enumerable:!0,get:function(){return i.UnknownFieldHandler}});var a=H_();Object.defineProperty(e,"BinaryReader",{enumerable:!0,get:function(){return a.BinaryReader}}),Object.defineProperty(e,"binaryReadOptions",{enumerable:!0,get:function(){return a.binaryReadOptions}});var o=W_();Object.defineProperty(e,"BinaryWriter",{enumerable:!0,get:function(){return o.BinaryWriter}}),Object.defineProperty(e,"binaryWriteOptions",{enumerable:!0,get:function(){return o.binaryWriteOptions}});var s=V_();Object.defineProperty(e,"PbLong",{enumerable:!0,get:function(){return s.PbLong}}),Object.defineProperty(e,"PbULong",{enumerable:!0,get:function(){return s.PbULong}});var c=G_();Object.defineProperty(e,"jsonReadOptions",{enumerable:!0,get:function(){return c.jsonReadOptions}}),Object.defineProperty(e,"jsonWriteOptions",{enumerable:!0,get:function(){return c.jsonWriteOptions}}),Object.defineProperty(e,"mergeJsonOptions",{enumerable:!0,get:function(){return c.mergeJsonOptions}});var l=K_();Object.defineProperty(e,"MESSAGE_TYPE",{enumerable:!0,get:function(){return l.MESSAGE_TYPE}});var u=ov();Object.defineProperty(e,"MessageType",{enumerable:!0,get:function(){return u.MessageType}});var d=J_();Object.defineProperty(e,"ScalarType",{enumerable:!0,get:function(){return d.ScalarType}}),Object.defineProperty(e,"LongType",{enumerable:!0,get:function(){return d.LongType}}),Object.defineProperty(e,"RepeatType",{enumerable:!0,get:function(){return d.RepeatType}}),Object.defineProperty(e,"normalizeFieldInfo",{enumerable:!0,get:function(){return d.normalizeFieldInfo}}),Object.defineProperty(e,"readFieldOptions",{enumerable:!0,get:function(){return d.readFieldOptions}}),Object.defineProperty(e,"readFieldOption",{enumerable:!0,get:function(){return d.readFieldOption}}),Object.defineProperty(e,"readMessageOption",{enumerable:!0,get:function(){return d.readMessageOption}});var f=X_();Object.defineProperty(e,"ReflectionTypeCheck",{enumerable:!0,get:function(){return f.ReflectionTypeCheck}});var p=rv();Object.defineProperty(e,"reflectionCreate",{enumerable:!0,get:function(){return p.reflectionCreate}});var m=ev();Object.defineProperty(e,"reflectionScalarDefault",{enumerable:!0,get:function(){return m.reflectionScalarDefault}});var h=iv();Object.defineProperty(e,"reflectionMergePartial",{enumerable:!0,get:function(){return h.reflectionMergePartial}});var g=av();Object.defineProperty(e,"reflectionEquals",{enumerable:!0,get:function(){return g.reflectionEquals}});var v=tv();Object.defineProperty(e,"ReflectionBinaryReader",{enumerable:!0,get:function(){return v.ReflectionBinaryReader}});var y=nv();Object.defineProperty(e,"ReflectionBinaryWriter",{enumerable:!0,get:function(){return y.ReflectionBinaryWriter}});var b=Q_();Object.defineProperty(e,"ReflectionJsonReader",{enumerable:!0,get:function(){return b.ReflectionJsonReader}});var x=$_();Object.defineProperty(e,"ReflectionJsonWriter",{enumerable:!0,get:function(){return x.ReflectionJsonWriter}});var S=sv();Object.defineProperty(e,"containsMessageType",{enumerable:!0,get:function(){return S.containsMessageType}});var C=Y_();Object.defineProperty(e,"isOneofGroup",{enumerable:!0,get:function(){return C.isOneofGroup}}),Object.defineProperty(e,"setOneofValue",{enumerable:!0,get:function(){return C.setOneofValue}}),Object.defineProperty(e,"getOneofValue",{enumerable:!0,get:function(){return C.getOneofValue}}),Object.defineProperty(e,"clearOneofValue",{enumerable:!0,get:function(){return C.clearOneofValue}}),Object.defineProperty(e,"getSelectedOneofValue",{enumerable:!0,get:function(){return C.getSelectedOneofValue}});var w=cv();Object.defineProperty(e,"listEnumValues",{enumerable:!0,get:function(){return w.listEnumValues}}),Object.defineProperty(e,"listEnumNames",{enumerable:!0,get:function(){return w.listEnumNames}}),Object.defineProperty(e,"listEnumNumbers",{enumerable:!0,get:function(){return w.listEnumNumbers}}),Object.defineProperty(e,"isEnumObject",{enumerable:!0,get:function(){return w.isEnumObject}});var T=q_();Object.defineProperty(e,"lowerCamelCase",{enumerable:!0,get:function(){return T.lowerCamelCase}});var E=U_();Object.defineProperty(e,"assert",{enumerable:!0,get:function(){return E.assert}}),Object.defineProperty(e,"assertNever",{enumerable:!0,get:function(){return E.assertNever}}),Object.defineProperty(e,"assertInt32",{enumerable:!0,get:function(){return E.assertInt32}}),Object.defineProperty(e,"assertUInt32",{enumerable:!0,get:function(){return E.assertUInt32}}),Object.defineProperty(e,"assertFloat32",{enumerable:!0,get:function(){return E.assertFloat32}})})),uv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.readServiceOption=e.readMethodOption=e.readMethodOptions=e.normalizeMethodInfo=void 0;let t=lv();function normalizeMethodInfo(e,n){let r=e;return r.service=n,r.localName=r.localName??t.lowerCamelCase(r.name),r.serverStreaming=!!r.serverStreaming,r.clientStreaming=!!r.clientStreaming,r.options=r.options??{},r.idempotency=r.idempotency??void 0,r}e.normalizeMethodInfo=normalizeMethodInfo;function readMethodOptions(e,t,n,r){let i=e.methods.find((e,n)=>e.localName===t||n===t)?.options;return i&&i[n]?r.fromJson(i[n]):void 0}e.readMethodOptions=readMethodOptions;function readMethodOption(e,t,n,r){let i=e.methods.find((e,n)=>e.localName===t||n===t)?.options;if(!i)return;let a=i[n];return a===void 0?a:r?r.fromJson(a):a}e.readMethodOption=readMethodOption;function readServiceOption(e,t,n){let r=e.options;if(!r)return;let i=r[t];return i===void 0?i:n?n.fromJson(i):i}e.readServiceOption=readServiceOption})),dv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ServiceType=void 0;let t=uv();e.ServiceType=class{constructor(e,n,r){this.typeName=e,this.methods=n.map(e=>t.normalizeMethodInfo(e,this)),this.options=r??{}}}})),fv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.RpcError=void 0,e.RpcError=class extends Error{constructor(e,t=`UNKNOWN`,n){super(e),this.name=`RpcError`,Object.setPrototypeOf(this,new.target.prototype),this.code=t,this.meta=n??{}}toString(){let e=[this.name+`: `+this.message];this.code&&(e.push(``),e.push(`Code: `+this.code)),this.serviceName&&this.methodName&&e.push(`Method: `+this.serviceName+`/`+this.methodName);let t=Object.entries(this.meta);if(t.length){e.push(``),e.push(`Meta:`);for(let[n,r]of t)e.push(` ${n}: ${r}`)}return e.join(` `)}}})),pv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.mergeRpcOptions=void 0;let t=lv();function mergeRpcOptions(e,n){if(!n)return e;let r={};copy(e,r),copy(n,r);for(let i of Object.keys(n)){let a=n[i];switch(i){case`jsonOptions`:r.jsonOptions=t.mergeJsonOptions(e.jsonOptions,r.jsonOptions);break;case`binaryOptions`:r.binaryOptions=t.mergeBinaryOptions(e.binaryOptions,r.binaryOptions);break;case`meta`:r.meta={},copy(e.meta,r.meta),copy(n.meta,r.meta);break;case`interceptors`:r.interceptors=e.interceptors?e.interceptors.concat(a):a.concat()}}return r}e.mergeRpcOptions=mergeRpcOptions;function copy(e,t){if(!e)return;let n=t;for(let[t,r]of Object.entries(e))n[t]=r instanceof Date?new Date(r.getTime()):Array.isArray(r)?r.concat():r}})),mv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Deferred=e.DeferredState=void 0;var t;(function(e){e[e.PENDING=0]=`PENDING`,e[e.REJECTED=1]=`REJECTED`,e[e.RESOLVED=2]=`RESOLVED`})(t=e.DeferredState||={}),e.Deferred=class{constructor(e=!0){this._state=t.PENDING,this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t}),e&&this._promise.catch(e=>{})}get state(){return this._state}get promise(){return this._promise}resolve(e){if(this.state!==t.PENDING)throw Error(`cannot resolve ${t[this.state].toLowerCase()}`);this._resolve(e),this._state=t.RESOLVED}reject(e){if(this.state!==t.PENDING)throw Error(`cannot reject ${t[this.state].toLowerCase()}`);this._reject(e),this._state=t.REJECTED}resolvePending(e){this._state===t.PENDING&&this.resolve(e)}rejectPending(e){this._state===t.PENDING&&this.reject(e)}}})),hv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.RpcOutputStreamController=void 0;let t=mv(),n=lv();e.RpcOutputStreamController=class{constructor(){this._lis={nxt:[],msg:[],err:[],cmp:[]},this._closed=!1,this._itState={q:[]}}onNext(e){return this.addLis(e,this._lis.nxt)}onMessage(e){return this.addLis(e,this._lis.msg)}onError(e){return this.addLis(e,this._lis.err)}onComplete(e){return this.addLis(e,this._lis.cmp)}addLis(e,t){return t.push(e),()=>{let n=t.indexOf(e);n>=0&&t.splice(n,1)}}clearLis(){for(let e of Object.values(this._lis))e.splice(0,e.length)}get closed(){return this._closed!==!1}notifyNext(e,t,r){n.assert(+!!e+ +!!t+ +!!r<=1,`only one emission at a time`),e&&this.notifyMessage(e),t&&this.notifyError(t),r&&this.notifyComplete()}notifyMessage(e){n.assert(!this.closed,`stream is closed`),this.pushIt({value:e,done:!1}),this._lis.msg.forEach(t=>t(e)),this._lis.nxt.forEach(t=>t(e,void 0,!1))}notifyError(e){n.assert(!this.closed,`stream is closed`),this._closed=e,this.pushIt(e),this._lis.err.forEach(t=>t(e)),this._lis.nxt.forEach(t=>t(void 0,e,!1)),this.clearLis()}notifyComplete(){n.assert(!this.closed,`stream is closed`),this._closed=!0,this.pushIt({value:null,done:!0}),this._lis.cmp.forEach(e=>e()),this._lis.nxt.forEach(e=>e(void 0,void 0,!0)),this.clearLis()}[Symbol.asyncIterator](){return this._closed===!0?this.pushIt({value:null,done:!0}):this._closed!==!1&&this.pushIt(this._closed),{next:()=>{let e=this._itState;n.assert(e,`bad state`),n.assert(!e.p,`iterator contract broken`);let r=e.q.shift();return r?`value`in r?Promise.resolve(r):Promise.reject(r):(e.p=new t.Deferred,e.p.promise)}}}pushIt(e){let r=this._itState;if(r.p){let i=r.p;n.assert(i.state==t.DeferredState.PENDING,`iterator contract broken`),`value`in e?i.resolve(e):i.reject(e),delete r.p}else r.q.push(e)}}})),gv=/* @__PURE__ */ __commonJSMin((e=>{var t=e&&e.__awaiter||function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.UnaryCall=void 0,e.UnaryCall=class{constructor(e,t,n,r,i,a,o){this.method=e,this.requestHeaders=t,this.request=n,this.headers=r,this.response=i,this.status=a,this.trailers=o}then(e,t){return this.promiseFinished().then(t=>e?Promise.resolve(e(t)):t,e=>t?Promise.resolve(t(e)):Promise.reject(e))}promiseFinished(){return t(this,void 0,void 0,function*(){let[e,t,n,r]=yield Promise.all([this.headers,this.response,this.status,this.trailers]);return{method:this.method,requestHeaders:this.requestHeaders,request:this.request,headers:e,response:t,status:n,trailers:r}})}}})),_v=/* @__PURE__ */ __commonJSMin((e=>{var t=e&&e.__awaiter||function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.ServerStreamingCall=void 0,e.ServerStreamingCall=class{constructor(e,t,n,r,i,a,o){this.method=e,this.requestHeaders=t,this.request=n,this.headers=r,this.responses=i,this.status=a,this.trailers=o}then(e,t){return this.promiseFinished().then(t=>e?Promise.resolve(e(t)):t,e=>t?Promise.resolve(t(e)):Promise.reject(e))}promiseFinished(){return t(this,void 0,void 0,function*(){let[e,t,n]=yield Promise.all([this.headers,this.status,this.trailers]);return{method:this.method,requestHeaders:this.requestHeaders,request:this.request,headers:e,status:t,trailers:n}})}}})),vv=/* @__PURE__ */ __commonJSMin((e=>{var t=e&&e.__awaiter||function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.ClientStreamingCall=void 0,e.ClientStreamingCall=class{constructor(e,t,n,r,i,a,o){this.method=e,this.requestHeaders=t,this.requests=n,this.headers=r,this.response=i,this.status=a,this.trailers=o}then(e,t){return this.promiseFinished().then(t=>e?Promise.resolve(e(t)):t,e=>t?Promise.resolve(t(e)):Promise.reject(e))}promiseFinished(){return t(this,void 0,void 0,function*(){let[e,t,n,r]=yield Promise.all([this.headers,this.response,this.status,this.trailers]);return{method:this.method,requestHeaders:this.requestHeaders,headers:e,response:t,status:n,trailers:r}})}}})),yv=/* @__PURE__ */ __commonJSMin((e=>{var t=e&&e.__awaiter||function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.DuplexStreamingCall=void 0,e.DuplexStreamingCall=class{constructor(e,t,n,r,i,a,o){this.method=e,this.requestHeaders=t,this.requests=n,this.headers=r,this.responses=i,this.status=a,this.trailers=o}then(e,t){return this.promiseFinished().then(t=>e?Promise.resolve(e(t)):t,e=>t?Promise.resolve(t(e)):Promise.reject(e))}promiseFinished(){return t(this,void 0,void 0,function*(){let[e,t,n]=yield Promise.all([this.headers,this.status,this.trailers]);return{method:this.method,requestHeaders:this.requestHeaders,headers:e,status:t,trailers:n}})}}})),bv=/* @__PURE__ */ __commonJSMin((e=>{var t=e&&e.__awaiter||function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.TestTransport=void 0;let n=fv(),r=lv(),i=hv(),a=pv(),o=gv(),s=_v(),c=vv(),l=yv();var u=class TestTransport{constructor(e){this.suppressUncaughtRejections=!0,this.headerDelay=10,this.responseDelay=50,this.betweenResponseDelay=10,this.afterResponseDelay=10,this.data=e??{}}get sentMessages(){return this.lastInput instanceof TestInputStream?this.lastInput.sent:typeof this.lastInput==`object`?[this.lastInput.single]:[]}get sendComplete(){return this.lastInput instanceof TestInputStream?this.lastInput.completed:typeof this.lastInput==`object`}promiseHeaders(){let e=this.data.headers??TestTransport.defaultHeaders;return e instanceof n.RpcError?Promise.reject(e):Promise.resolve(e)}promiseSingleResponse(e){if(this.data.response instanceof n.RpcError)return Promise.reject(this.data.response);let t;return Array.isArray(this.data.response)?(r.assert(this.data.response.length>0),t=this.data.response[0]):t=this.data.response===void 0?e.O.create():this.data.response,r.assert(e.O.is(t)),Promise.resolve(t)}streamResponses(e,i,a){return t(this,void 0,void 0,function*(){let t=[];if(this.data.response===void 0)t.push(e.O.create());else if(Array.isArray(this.data.response))for(let n of this.data.response)r.assert(e.O.is(n)),t.push(n);else this.data.response instanceof n.RpcError||(r.assert(e.O.is(this.data.response)),t.push(this.data.response));try{yield delay(this.responseDelay,a)(void 0)}catch(e){i.notifyError(e);return}if(this.data.response instanceof n.RpcError){i.notifyError(this.data.response);return}for(let e of t){i.notifyMessage(e);try{yield delay(this.betweenResponseDelay,a)(void 0)}catch(e){i.notifyError(e);return}}if(this.data.status instanceof n.RpcError){i.notifyError(this.data.status);return}if(this.data.trailers instanceof n.RpcError){i.notifyError(this.data.trailers);return}i.notifyComplete()})}promiseStatus(){let e=this.data.status??TestTransport.defaultStatus;return e instanceof n.RpcError?Promise.reject(e):Promise.resolve(e)}promiseTrailers(){let e=this.data.trailers??TestTransport.defaultTrailers;return e instanceof n.RpcError?Promise.reject(e):Promise.resolve(e)}maybeSuppressUncaught(...e){if(this.suppressUncaughtRejections)for(let t of e)t.catch(()=>{})}mergeOptions(e){return a.mergeRpcOptions({},e)}unary(e,t,n){let r=n.meta??{},i=this.promiseHeaders().then(delay(this.headerDelay,n.abort)),a=i.catch(e=>{}).then(delay(this.responseDelay,n.abort)).then(t=>this.promiseSingleResponse(e)),s=a.catch(e=>{}).then(delay(this.afterResponseDelay,n.abort)).then(e=>this.promiseStatus()),c=a.catch(e=>{}).then(delay(this.afterResponseDelay,n.abort)).then(e=>this.promiseTrailers());return this.maybeSuppressUncaught(s,c),this.lastInput={single:t},new o.UnaryCall(e,r,t,i,a,s,c)}serverStreaming(e,t,n){let r=n.meta??{},a=this.promiseHeaders().then(delay(this.headerDelay,n.abort)),o=new i.RpcOutputStreamController,c=a.then(delay(this.responseDelay,n.abort)).catch(()=>{}).then(()=>this.streamResponses(e,o,n.abort)).then(delay(this.afterResponseDelay,n.abort)),l=c.then(()=>this.promiseStatus()),u=c.then(()=>this.promiseTrailers());return this.maybeSuppressUncaught(l,u),this.lastInput={single:t},new s.ServerStreamingCall(e,r,t,a,o,l,u)}clientStreaming(e,t){let n=t.meta??{},r=this.promiseHeaders().then(delay(this.headerDelay,t.abort)),i=r.catch(e=>{}).then(delay(this.responseDelay,t.abort)).then(t=>this.promiseSingleResponse(e)),a=i.catch(e=>{}).then(delay(this.afterResponseDelay,t.abort)).then(e=>this.promiseStatus()),o=i.catch(e=>{}).then(delay(this.afterResponseDelay,t.abort)).then(e=>this.promiseTrailers());return this.maybeSuppressUncaught(a,o),this.lastInput=new TestInputStream(this.data,t.abort),new c.ClientStreamingCall(e,n,this.lastInput,r,i,a,o)}duplex(e,t){let n=t.meta??{},r=this.promiseHeaders().then(delay(this.headerDelay,t.abort)),a=new i.RpcOutputStreamController,o=r.then(delay(this.responseDelay,t.abort)).catch(()=>{}).then(()=>this.streamResponses(e,a,t.abort)).then(delay(this.afterResponseDelay,t.abort)),s=o.then(()=>this.promiseStatus()),c=o.then(()=>this.promiseTrailers());return this.maybeSuppressUncaught(s,c),this.lastInput=new TestInputStream(this.data,t.abort),new l.DuplexStreamingCall(e,n,this.lastInput,r,a,s,c)}};e.TestTransport=u,u.defaultHeaders={responseHeader:`test`},u.defaultStatus={code:`OK`,detail:`all good`},u.defaultTrailers={responseTrailer:`test`};function delay(e,t){return r=>new Promise((i,a)=>{if(t?.aborted)a(new n.RpcError(`user cancel`,`CANCELLED`));else{let o=setTimeout(()=>i(r),e);t&&t.addEventListener(`abort`,e=>{clearTimeout(o),a(new n.RpcError(`user cancel`,`CANCELLED`))})}})}var TestInputStream=class{constructor(e,t){this._completed=!1,this._sent=[],this.data=e,this.abort=t}get sent(){return this._sent}get completed(){return this._completed}send(e){if(this.data.inputMessage instanceof n.RpcError)return Promise.reject(this.data.inputMessage);let t=this.data.inputMessage===void 0?10:this.data.inputMessage;return Promise.resolve(void 0).then(()=>{this._sent.push(e)}).then(delay(t,this.abort))}complete(){if(this.data.inputComplete instanceof n.RpcError)return Promise.reject(this.data.inputComplete);let e=this.data.inputComplete===void 0?10:this.data.inputComplete;return Promise.resolve(void 0).then(()=>{this._completed=!0}).then(delay(e,this.abort))}}})),xv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.stackDuplexStreamingInterceptors=e.stackClientStreamingInterceptors=e.stackServerStreamingInterceptors=e.stackUnaryInterceptors=e.stackIntercept=void 0;let t=lv();function stackIntercept(e,n,r,i,a){if(e==`unary`){let tail=(e,t,r)=>n.unary(e,t,r);for(let e of(i.interceptors??[]).filter(e=>e.interceptUnary).reverse()){let t=tail;tail=(n,r,i)=>e.interceptUnary(t,n,r,i)}return tail(r,a,i)}if(e==`serverStreaming`){let tail=(e,t,r)=>n.serverStreaming(e,t,r);for(let e of(i.interceptors??[]).filter(e=>e.interceptServerStreaming).reverse()){let t=tail;tail=(n,r,i)=>e.interceptServerStreaming(t,n,r,i)}return tail(r,a,i)}if(e==`clientStreaming`){let tail=(e,t)=>n.clientStreaming(e,t);for(let e of(i.interceptors??[]).filter(e=>e.interceptClientStreaming).reverse()){let t=tail;tail=(n,r)=>e.interceptClientStreaming(t,n,r)}return tail(r,i)}if(e==`duplex`){let tail=(e,t)=>n.duplex(e,t);for(let e of(i.interceptors??[]).filter(e=>e.interceptDuplex).reverse()){let t=tail;tail=(n,r)=>e.interceptDuplex(t,n,r)}return tail(r,i)}t.assertNever(e)}e.stackIntercept=stackIntercept;function stackUnaryInterceptors(e,t,n,r){return stackIntercept(`unary`,e,t,r,n)}e.stackUnaryInterceptors=stackUnaryInterceptors;function stackServerStreamingInterceptors(e,t,n,r){return stackIntercept(`serverStreaming`,e,t,r,n)}e.stackServerStreamingInterceptors=stackServerStreamingInterceptors;function stackClientStreamingInterceptors(e,t,n){return stackIntercept(`clientStreaming`,e,t,n)}e.stackClientStreamingInterceptors=stackClientStreamingInterceptors;function stackDuplexStreamingInterceptors(e,t,n){return stackIntercept(`duplex`,e,t,n)}e.stackDuplexStreamingInterceptors=stackDuplexStreamingInterceptors})),Sv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ServerCallContextController=void 0,e.ServerCallContextController=class{constructor(e,t,n,r,i={code:`OK`,detail:``}){this._cancelled=!1,this._listeners=[],this.method=e,this.headers=t,this.deadline=n,this.trailers={},this._sendRH=r,this.status=i}notifyCancelled(){if(!this._cancelled){this._cancelled=!0;for(let e of this._listeners)e()}}sendResponseHeaders(e){this._sendRH(e)}get cancelled(){return this._cancelled}onCancel(e){let t=this._listeners;return t.push(e),()=>{let n=t.indexOf(e);n>=0&&t.splice(n,1)}}}})),Cv=(/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=dv();Object.defineProperty(e,"ServiceType",{enumerable:!0,get:function(){return t.ServiceType}});var n=uv();Object.defineProperty(e,"readMethodOptions",{enumerable:!0,get:function(){return n.readMethodOptions}}),Object.defineProperty(e,"readMethodOption",{enumerable:!0,get:function(){return n.readMethodOption}}),Object.defineProperty(e,"readServiceOption",{enumerable:!0,get:function(){return n.readServiceOption}});var r=fv();Object.defineProperty(e,"RpcError",{enumerable:!0,get:function(){return r.RpcError}});var i=pv();Object.defineProperty(e,"mergeRpcOptions",{enumerable:!0,get:function(){return i.mergeRpcOptions}});var a=hv();Object.defineProperty(e,"RpcOutputStreamController",{enumerable:!0,get:function(){return a.RpcOutputStreamController}});var o=bv();Object.defineProperty(e,"TestTransport",{enumerable:!0,get:function(){return o.TestTransport}});var s=mv();Object.defineProperty(e,"Deferred",{enumerable:!0,get:function(){return s.Deferred}}),Object.defineProperty(e,"DeferredState",{enumerable:!0,get:function(){return s.DeferredState}});var c=yv();Object.defineProperty(e,"DuplexStreamingCall",{enumerable:!0,get:function(){return c.DuplexStreamingCall}});var l=vv();Object.defineProperty(e,"ClientStreamingCall",{enumerable:!0,get:function(){return l.ClientStreamingCall}});var u=_v();Object.defineProperty(e,"ServerStreamingCall",{enumerable:!0,get:function(){return u.ServerStreamingCall}});var d=gv();Object.defineProperty(e,"UnaryCall",{enumerable:!0,get:function(){return d.UnaryCall}});var f=xv();Object.defineProperty(e,"stackIntercept",{enumerable:!0,get:function(){return f.stackIntercept}}),Object.defineProperty(e,"stackDuplexStreamingInterceptors",{enumerable:!0,get:function(){return f.stackDuplexStreamingInterceptors}}),Object.defineProperty(e,"stackClientStreamingInterceptors",{enumerable:!0,get:function(){return f.stackClientStreamingInterceptors}}),Object.defineProperty(e,"stackServerStreamingInterceptors",{enumerable:!0,get:function(){return f.stackServerStreamingInterceptors}}),Object.defineProperty(e,"stackUnaryInterceptors",{enumerable:!0,get:function(){return f.stackUnaryInterceptors}});var p=Sv();Object.defineProperty(e,"ServerCallContextController",{enumerable:!0,get:function(){return p.ServerCallContextController}})})))(),$=lv();const wv=new class extends $.MessageType{constructor(){super(`github.actions.results.entities.v1.CacheScope`,[{no:1,name:`scope`,kind:`scalar`,T:9},{no:2,name:`permission`,kind:`scalar`,T:3}])}create(e){let t={scope:``,permission:`0`};return globalThis.Object.defineProperty(t,$.MESSAGE_TYPE,{enumerable:!1,value:this}),e!==void 0&&(0,$.reflectionMergePartial)(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),a=e.pos+t;for(;e.poswv}])}create(e){let t={repositoryId:`0`,scope:[]};return globalThis.Object.defineProperty(t,$.MESSAGE_TYPE,{enumerable:!1,value:this}),e!==void 0&&(0,$.reflectionMergePartial)(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),a=e.pos+t;for(;e.posTv},{no:2,name:`key`,kind:`scalar`,T:9},{no:3,name:`version`,kind:`scalar`,T:9}])}create(e){let t={key:``,version:``};return globalThis.Object.defineProperty(t,$.MESSAGE_TYPE,{enumerable:!1,value:this}),e!==void 0&&(0,$.reflectionMergePartial)(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),a=e.pos+t;for(;e.posTv},{no:2,name:`key`,kind:`scalar`,T:9},{no:3,name:`size_bytes`,kind:`scalar`,T:3},{no:4,name:`version`,kind:`scalar`,T:9}])}create(e){let t={key:``,sizeBytes:`0`,version:``};return globalThis.Object.defineProperty(t,$.MESSAGE_TYPE,{enumerable:!1,value:this}),e!==void 0&&(0,$.reflectionMergePartial)(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),a=e.pos+t;for(;e.posTv},{no:2,name:`key`,kind:`scalar`,T:9},{no:3,name:`restore_keys`,kind:`scalar`,repeat:2,T:9},{no:4,name:`version`,kind:`scalar`,T:9}])}create(e){let t={key:``,restoreKeys:[],version:``};return globalThis.Object.defineProperty(t,$.MESSAGE_TYPE,{enumerable:!1,value:this}),e!==void 0&&(0,$.reflectionMergePartial)(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),a=e.pos+t;for(;e.posDv.fromJson(e,{ignoreUnknownFields:!0}))}FinalizeCacheEntryUpload(e){let t=Ov.toJson(e,{useProtoFieldName:!0,emitDefaultValues:!1});return this.rpc.request(`github.actions.results.api.v1.CacheService`,`FinalizeCacheEntryUpload`,`application/json`,t).then(e=>kv.fromJson(e,{ignoreUnknownFields:!0}))}GetCacheEntryDownloadURL(e){let t=Av.toJson(e,{useProtoFieldName:!0,emitDefaultValues:!1});return this.rpc.request(`github.actions.results.api.v1.CacheService`,`GetCacheEntryDownloadURL`,`application/json`,t).then(e=>jv.fromJson(e,{ignoreUnknownFields:!0}))}};function maskSigUrl(e){if(e)try{let t=new URL(e).searchParams.get(`sig`);t&&(setSecret(t),setSecret(encodeURIComponent(t)))}catch(t){debug(`Failed to parse URL: ${e} ${t instanceof Error?t.message:String(t)}`)}}function maskSecretUrls(e){if(typeof e!=`object`||!e){debug(`body is not an object or is null`);return}`signed_upload_url`in e&&typeof e.signed_upload_url==`string`&&maskSigUrl(e.signed_upload_url),`signed_download_url`in e&&typeof e.signed_download_url==`string`&&maskSigUrl(e.signed_download_url)}var __awaiter$2=function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})},CacheServiceClient=class{constructor(e,t,n,r){this.maxAttempts=5,this.baseRetryIntervalMilliseconds=3e3,this.retryMultiplier=1.5;let i=getRuntimeToken();this.baseUrl=getCacheServiceURL(),t&&(this.maxAttempts=t),n&&(this.baseRetryIntervalMilliseconds=n),r&&(this.retryMultiplier=r),this.httpClient=new HttpClient(e,[new BearerCredentialHandler(i)])}request(e,t,n,r){return __awaiter$2(this,void 0,void 0,function*(){let i=new URL(`/twirp/${e}/${t}`,this.baseUrl).href;debug(`[Request] ${t} ${i}`);let a={"Content-Type":n};try{let{body:e}=yield this.retryableRequest(()=>__awaiter$2(this,void 0,void 0,function*(){return this.httpClient.post(i,JSON.stringify(r),a)}));return e}catch(e){throw Error(`Failed to ${t}: ${e.message}`)}})}retryableRequest(e){return __awaiter$2(this,void 0,void 0,function*(){let t=0,n=``,r=``;for(;t0&&warning(`You've hit a rate limit, your rate limit will reset in ${t} seconds`)}throw new RateLimitError(`Rate limited: ${n}`)}}catch(e){if(e instanceof SyntaxError&&debug(`Raw Body: ${r}`),e instanceof UsageError||e instanceof RateLimitError)throw e;if(NetworkError.isNetworkErrorCode(e?.code))throw new NetworkError(e?.code);i=!0,n=e.message}if(!i)throw Error(`Received non-retryable error: ${n}`);if(t+1===this.maxAttempts)throw Error(`Failed to make request after ${this.maxAttempts} attempts: ${n}`);let a=this.getExponentialRetryTimeMilliseconds(t);info(`Attempt ${t+1} of ${this.maxAttempts} failed with error: ${n}. Retrying request in ${a} ms...`),yield this.sleep(a),t++}throw Error(`Request failed`)})}isSuccessStatusCode(e){return e?e>=200&&e<300:!1}isRetryableHttpStatusCode(e){return e?[On.BadGateway,On.GatewayTimeout,On.InternalServerError,On.ServiceUnavailable].includes(e):!1}sleep(e){return __awaiter$2(this,void 0,void 0,function*(){return new Promise(t=>setTimeout(t,e))})}getExponentialRetryTimeMilliseconds(e){if(e<0)throw Error(`attempt should be a positive integer`);if(e===0)return this.baseRetryIntervalMilliseconds;let t=this.baseRetryIntervalMilliseconds*this.retryMultiplier**+e,n=t*this.retryMultiplier;return Math.trunc(Math.random()*(n-t)+t)}};function internalCacheTwirpClient(e){return new CacheServiceClientJSON(new CacheServiceClient(getUserAgentString(),e?.maxAttempts,e?.retryIntervalMs,e?.retryMultiplier))}var __awaiter$1=function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})};const Mv=process.platform===`win32`;function getTarPath(){return __awaiter$1(this,void 0,void 0,function*(){switch(process.platform){case`win32`:{let e=yield getGnuTarPathOnWindows(),t=ps;if(e)return{path:e,type:ls.GNU};if(s(t))return{path:t,type:ls.BSD};break}case`darwin`:{let e=yield which(`gtar`,!1);return e?{path:e,type:ls.GNU}:{path:yield which(`tar`,!0),type:ls.BSD}}}return{path:yield which(`tar`,!0),type:ls.GNU}})}function getTarArgs(e,t,n){return __awaiter$1(this,arguments,void 0,function*(e,t,n,r=``){let i=[`"${e.path}"`],a=getCacheFileName(t),o=`cache.tar`,s=getWorkingDirectory(),c=e.type===ls.BSD&&t!==cs.Gzip&&Mv;switch(n){case`create`:i.push(`--posix`,`-cf`,c?o:a.replace(RegExp(`\\${u.sep}`,`g`),`/`),`--exclude`,c?o:a.replace(RegExp(`\\${u.sep}`,`g`),`/`),`-P`,`-C`,s.replace(RegExp(`\\${u.sep}`,`g`),`/`),`--files-from`,hs);break;case`extract`:i.push(`-xf`,c?o:r.replace(RegExp(`\\${u.sep}`,`g`),`/`),`-P`,`-C`,c?quoteAbsolutePath(s):s.replace(RegExp(`\\${u.sep}`,`g`),`/`));break;case`list`:i.push(`-tf`,c?o:r.replace(RegExp(`\\${u.sep}`,`g`),`/`),`-P`)}if(e.type===ls.GNU)switch(process.platform){case`win32`:i.push(`--force-local`);break;case`darwin`:i.push(`--delay-directory-restore`)}return i})}function getCommands(e,t){return __awaiter$1(this,arguments,void 0,function*(e,t,n=``){let r,i=yield getTarPath(),a=yield getTarArgs(i,e,t,n),o=t===`create`?yield getCompressionProgram(i,e):yield getDecompressionProgram(i,e,n),s=i.type===ls.BSD&&e!==cs.Gzip&&Mv;return r=s&&t!==`create`?[[...o].join(` `),[...a].join(` `)]:[[...a].join(` `),[...o].join(` `)],{commands:s?r:[r.join(` `)],requiresTempDirectory:s&&t!==`create`}})}function getWorkingDirectory(){return process.env.GITHUB_WORKSPACE??process.cwd()}function quoteAbsolutePath(e){return`"${u.resolve(e).replace(RegExp(`\\${u.sep}`,`g`),`/`)}"`}function getDecompressionProgram(e,t,n){return __awaiter$1(this,void 0,void 0,function*(){let r=e.type===ls.BSD&&t!==cs.Gzip&&Mv;switch(t){case cs.Zstd:return r?[`zstd -d --long=30 --force -o`,ms,quoteAbsolutePath(n)]:[`--use-compress-program`,Mv?`"zstd -d --long=30"`:`unzstd --long=30`];case cs.ZstdWithoutLong:return r?[`zstd -d --force -o`,ms,quoteAbsolutePath(n)]:[`--use-compress-program`,Mv?`"zstd -d"`:`unzstd`];default:return[`-z`]}})}function getCompressionProgram(e,t){return __awaiter$1(this,void 0,void 0,function*(){let n=getCacheFileName(t),r=e.type===ls.BSD&&t!==cs.Gzip&&Mv;switch(t){case cs.Zstd:return r?[`zstd -T0 --long=30 --force -o`,n.replace(RegExp(`\\${u.sep}`,`g`),`/`),ms]:[`--use-compress-program`,Mv?`"zstd -T0 --long=30"`:`zstdmt --long=30`];case cs.ZstdWithoutLong:return r?[`zstd -T0 --force -o`,n.replace(RegExp(`\\${u.sep}`,`g`),`/`),ms]:[`--use-compress-program`,Mv?`"zstd -T0"`:`zstdmt`];default:return[`-z`]}})}function execCommands(e,t){return __awaiter$1(this,void 0,void 0,function*(){for(let n of e)try{yield exec(n,void 0,{cwd:t,env:Object.assign(Object.assign({},process.env),{MSYS:`winsymlinks:nativestrict`})})}catch(e){throw Error(`${n.split(` `)[0]} failed with error: ${e?.message}`)}})}function execReadCommands(e,t,n){return __awaiter$1(this,void 0,void 0,function*(){let{commands:r,requiresTempDirectory:i}=yield getCommands(t,n,e),a=i?yield createTempDirectory():void 0;try{yield execCommands(r,a)}finally{if(a)try{yield rmRF(a)}catch(e){debug(`Failed to delete temporary tar directory: ${e}`)}}})}function listTar(e,t){return __awaiter$1(this,void 0,void 0,function*(){yield execReadCommands(e,t,`list`)})}function extractTar(e,t){return __awaiter$1(this,void 0,void 0,function*(){yield mkdirP(getWorkingDirectory()),yield execReadCommands(e,t,`extract`)})}function createTar(e,t,n){return __awaiter$1(this,void 0,void 0,function*(){l(u.join(e,hs),t.join(` -`));let{commands:r}=yield getCommands(n,`create`);yield execCommands(r,e)})}var __awaiter=function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})},Nv=class ValidationError extends Error{constructor(e){super(e),this.name=`ValidationError`,Object.setPrototypeOf(this,ValidationError.prototype)}},Pv=class ReserveCacheError extends Error{constructor(e){super(e),this.name=`ReserveCacheError`,Object.setPrototypeOf(this,ReserveCacheError.prototype)}},Fv=class CacheWriteDeniedError extends Pv{constructor(e){super(e),this.name=`CacheWriteDeniedError`,Object.setPrototypeOf(this,CacheWriteDeniedError.prototype)}};const Iv=`cache read denied:`;var Lv=class CacheReadDeniedError extends Error{constructor(e){super(e),this.name=`CacheReadDeniedError`,Object.setPrototypeOf(this,CacheReadDeniedError.prototype)}},Rv=class FinalizeCacheError extends Error{constructor(e){super(e),this.name=`FinalizeCacheError`,Object.setPrototypeOf(this,FinalizeCacheError.prototype)}};function checkPaths(e){if(!e||e.length===0)throw new Nv(`Path Validation Error: At least one directory or file path is required`)}function checkKey(e){if(e.length>512)throw new Nv(`Key Validation Error: ${e} cannot be larger than 512 characters.`);if(!/^[^,]*$/.test(e))throw new Nv(`Key Validation Error: ${e} cannot contain commas.`)}function restoreCache$1(e,t,n,r){return __awaiter(this,arguments,void 0,function*(e,t,n,r,i=!1){let a=getCacheServiceVersion();debug(`Cache service version: ${a}`),checkPaths(e);let o=getCacheMode();if(!isCacheReadable(o)){info(`Cache restore skipped: the effective cache-mode '${o}' does not permit reads.`),debug(`Skipped restore for paths [${e.join(`, `)}] with primary key '${t}'.`);return}switch(a){case`v2`:return yield restoreCacheV2(e,t,n,r,i);default:return yield restoreCacheV1(e,t,n,r,i)}})}function restoreCacheV1(e,t,n,r){return __awaiter(this,arguments,void 0,function*(e,t,n,r,i=!1){n||=[];let a=[t,...n];if(debug(`Resolved Keys:`),debug(JSON.stringify(a)),a.length>10)throw new Nv(`Key Validation Error: Keys are limited to a maximum of 10.`);for(let e of a)checkKey(e);let o=yield getCompressionMethod(),s=``;try{let t;try{t=yield getCacheEntry(a,e,{compressionMethod:o,enableCrossOsArchive:i})}catch(e){let t=e?.message??``;throw t.includes(Iv)?new Lv(t):e}if(!t?.archiveLocation)return;if(r?.lookupOnly)return info(`Lookup only - skipping download`),t.cacheKey;s=u.join(yield createTempDirectory(),getCacheFileName(o)),debug(`Archive Path: ${s}`),yield downloadCache(t.archiveLocation,s,r),isDebug()&&(yield listTar(s,o));let n=getArchiveFileSizeInBytes(s);return info(`Cache Size: ~${Math.round(n/1048576)} MB (${n} B)`),yield extractTar(s,o),info(`Cache restored successfully`),t.cacheKey}catch(e){let t=e;if(t.name===Nv.name)throw e;t instanceof Pn&&typeof t.statusCode==`number`&&t.statusCode>=500?error(`Failed to restore: ${e.message}`):warning(`Failed to restore: ${e.message}`)}finally{try{yield unlinkFile(s)}catch(e){debug(`Failed to delete archive: ${e}`)}}})}function restoreCacheV2(e,t,n,r){return __awaiter(this,arguments,void 0,function*(e,t,n,r,i=!1){r=Object.assign(Object.assign({},r),{useAzureSdk:!0}),n||=[];let a=[t,...n];if(debug(`Resolved Keys:`),debug(JSON.stringify(a)),a.length>10)throw new Nv(`Key Validation Error: Keys are limited to a maximum of 10.`);for(let e of a)checkKey(e);let o=``;try{let s=internalCacheTwirpClient(),c=yield getCompressionMethod(),l={key:t,restoreKeys:n,version:getCacheVersion(e,c,i)},d;try{d=yield s.GetCacheEntryDownloadURL(l)}catch(e){let t=e?.message??``;throw t.includes(Iv)?new Lv(t):e}if(!d.ok){debug(`Cache not found for version ${l.version} of keys: ${a.join(`, `)}`);return}if(l.key===d.matchedKey?info(`Cache hit for: ${d.matchedKey}`):info(`Cache hit for restore-key: ${d.matchedKey}`),r?.lookupOnly)return info(`Lookup only - skipping download`),d.matchedKey;o=u.join(yield createTempDirectory(),getCacheFileName(c)),debug(`Archive path: ${o}`),debug(`Starting download of archive to: ${o}`),yield downloadCache(d.signedDownloadUrl,o,r);let f=getArchiveFileSizeInBytes(o);return info(`Cache Size: ~${Math.round(f/1048576)} MB (${f} B)`),isDebug()&&(yield listTar(o,c)),yield extractTar(o,c),info(`Cache restored successfully`),d.matchedKey}catch(e){let t=e;if(t.name===Nv.name)throw e;t instanceof Pn&&typeof t.statusCode==`number`&&t.statusCode>=500?error(`Failed to restore: ${e.message}`):warning(`Failed to restore: ${e.message}`)}finally{try{o&&(yield unlinkFile(o))}catch(e){debug(`Failed to delete archive: ${e}`)}}})}function saveCache$1(e,t,n){return __awaiter(this,arguments,void 0,function*(e,t,n,r=!1){let i=getCacheServiceVersion();debug(`Cache service version: ${i}`),checkPaths(e),checkKey(t);let a=getCacheMode();if(!isCacheWritable(a))return info(`Cache save skipped: the effective cache-mode '${a}' does not permit writes.`),debug(`Skipped save for paths [${e.join(`, `)}] with key '${t}'.`),-1;switch(i){case`v2`:return yield saveCacheV2(e,t,n,r);default:return yield saveCacheV1(e,t,n,r)}})}function saveCacheV1(e,t,n){return __awaiter(this,arguments,void 0,function*(e,t,n,r=!1){let i=yield getCompressionMethod(),a=-1,o=yield resolvePaths(e);if(debug(`Cache Paths:`),debug(`${JSON.stringify(o)}`),o.length===0)throw Error(`Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.`);let s=yield createTempDirectory(),c=u.join(s,getCacheFileName(i));debug(`Archive Path: ${c}`);try{yield createTar(s,o,i),isDebug()&&(yield listTar(c,i));let l=getArchiveFileSizeInBytes(c);if(debug(`File Size: ${l}`),l>10737418240&&!isGhes())throw Error(`Cache size of ~${Math.round(l/1048576)} MB (${l} B) is over the 10GB limit, not saving cache.`);debug(`Reserving Cache`);let u=yield reserveCache(t,e,{compressionMethod:i,enableCrossOsArchive:r,cacheSize:l});if(u?.result?.cacheId)a=u?.result?.cacheId;else if(u?.statusCode===400)throw Error(u?.error?.message??`Cache size of ~${Math.round(l/1048576)} MB (${l} B) is over the data cap limit, not saving cache.`);else{let e=u?.error?.message;throw e?.startsWith(`cache write denied:`)?new Fv(`Unable to reserve cache with key ${t}. More details: ${e}`):new Pv(`Unable to reserve cache with key ${t}, another job may be creating this cache. More details: ${u?.error?.message}`)}debug(`Saving Cache (ID: ${a})`),yield saveCache$2(a,c,``,n)}catch(e){let t=e;if(t.name===Nv.name)throw e;t.name===Pv.name?info(`Failed to save: ${t.message}`):t instanceof Pn&&typeof t.statusCode==`number`&&t.statusCode>=500?error(`Failed to save: ${t.message}`):warning(`Failed to save: ${t.message}`)}finally{try{yield unlinkFile(c)}catch(e){debug(`Failed to delete archive: ${e}`)}}return a})}function saveCacheV2(e,t,n){return __awaiter(this,arguments,void 0,function*(e,t,n,r=!1){n=Object.assign(Object.assign({},n),{uploadChunkSize:67108864,uploadConcurrency:8,useAzureSdk:!0});let i=yield getCompressionMethod(),a=internalCacheTwirpClient(),o=-1,s=yield resolvePaths(e);if(debug(`Cache Paths:`),debug(`${JSON.stringify(s)}`),s.length===0)throw Error(`Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.`);let c=yield createTempDirectory(),l=u.join(c,getCacheFileName(i));debug(`Archive Path: ${l}`);try{yield createTar(c,s,i),isDebug()&&(yield listTar(l,i));let u=getArchiveFileSizeInBytes(l);debug(`File Size: ${u}`),n.archiveSizeBytes=u,debug(`Reserving Cache`);let d=getCacheVersion(e,i,r),f={key:t,version:d},p;try{let e=yield a.CreateCacheEntry(f);if(!e.ok)throw e.message&&!e.message.startsWith(`cache write denied:`)&&warning(`Cache reservation failed: ${e.message}`),Error(e.message||`Response was not ok`);p=e.signedUploadUrl}catch(e){debug(`Failed to reserve cache: ${e}`);let n=e?.message??``;throw n.startsWith(`cache write denied:`)?new Fv(`Unable to reserve cache with key ${t}. More details: ${n}`):new Pv(`Unable to reserve cache with key ${t}, another job may be creating this cache.`)}debug(`Attempting to upload cache located at: ${l}`),yield saveCache$2(o,l,p,n);let m={key:t,version:d,sizeBytes:`${u}`},h=yield a.FinalizeCacheEntryUpload(m);if(debug(`FinalizeCacheEntryUploadResponse: ${h.ok}`),!h.ok)throw h.message?new Rv(h.message):Error(`Unable to finalize cache with key ${t}, another job may be finalizing this cache.`);o=parseInt(h.entryId)}catch(e){let t=e;if(t.name===Nv.name)throw e;t.name===Pv.name?info(`Failed to save: ${t.message}`):t.name===Rv.name?warning(t.message):t instanceof Pn&&typeof t.statusCode==`number`&&t.statusCode>=500?error(`Failed to save: ${t.message}`):warning(`Failed to save: ${t.message}`)}finally{try{yield unlinkFile(l)}catch(e){debug(`Failed to delete archive: ${e}`)}}return o})}function resolveSfwEnabled(e,t,n){return e?!pkgPrNewCommitSha(t)||(n(`sfw was requested but is automatically disabled for Vite+ preview build ${t}; Socket Firewall Free will not be used.`),!1):!1}const zv=`v1.15.4`,Bv=`https://github.com/SocketDev/sfw-free/releases/download/${zv}`;function isMuslLinux(){if(process.platform!==`linux`)return!1;try{let e=process.report?.getReport();if(e?.header&&!e.header.glibcVersionRuntime)return!0}catch{}return F(`/etc/alpine-release`)}function getSfwAssetName(e,t,n){if(e===`darwin`){if(t===`arm64`)return`sfw-free-macos-arm64`;if(t===`x64`)return`sfw-free-macos-x86_64`}else if(e===`linux`){if(t===`arm64`)return n?`sfw-free-musl-linux-arm64`:`sfw-free-linux-arm64`;if(t===`x64`)return n?`sfw-free-musl-linux-x86_64`:`sfw-free-linux-x86_64`}else if(isWindows(e)){if(t===`arm64`)return`sfw-free-windows-arm64.exe`;if(t===`x64`)return`sfw-free-windows-x86_64.exe`}throw Error(`Unsupported platform/arch for sfw: ${e}/${t}${e===`linux`?` (${n?`musl`:`glibc`})`:``}`)}const Vv=2e3;function isSfwSupported(e=process.platform,t=process.arch,n=isMuslLinux()){try{return!!getSfwAssetName(e,t,n)}catch{return!1}}function getSfwBinDir(){let e=process.env.RUNNER_TEMP||process.env.TMPDIR||process.env.TEMP||`/tmp`;return P(e,`sfw-bin`)}async function installSfw(){let e=getSfwAssetName(process.platform,process.arch,isMuslLinux()),t=`${Bv}/${e}`,n=getSfwBinDir();fe(n,{recursive:!0});let r=P(n,isWindows()?`sfw.exe`:`sfw`),i=`sfw-${zv}-${process.platform}-${process.arch}-${isMuslLinux()?`musl`:`glibc`}`;try{let e=await restoreCache$1([n],i);if(e&&F(r)){isWindows()||ue(r,493),addPath(n),info(`sfw restored from cache: ${e}`);return}}catch(e){warning(`sfw cache restore failed (${e instanceof Error?e.message:String(e)}); falling through to download.`)}info(`Installing sfw from ${t}...`);let a=``;for(let e=1;e<=2;e++){try{let e=await runDownloadCommand(t,r);if(e===0&&F(r)){isWindows()||ue(r,493),addPath(n),info(`sfw installed at ${r}`);try{await saveCache$1([n],i),info(`sfw cached under key: ${i}`)}catch(e){warning(`sfw cache save failed (${e instanceof Error?e.message:String(e)}); continuing.`)}return}a=`exit code ${e}`}catch(e){a=e instanceof Error?e.message:String(e)}e<2&&(warning(`Failed to install sfw from ${t} (${a}). Retrying in ${Vv}ms... (attempt ${e+1}/2)`),await se(Vv))}throw Error(`Failed to install sfw from ${t} after 2 attempts: ${a}`)}function findSfwOnPath(){let e=isWindows()?`where`:`which`;try{let t=we(e,[`sfw`],{encoding:`utf8`,stdio:[`ignore`,`pipe`,`ignore`]}).split(/\r?\n/).find(e=>e.trim().length>0);return t?t.trim():null}catch{return null}}async function setupSfw(e){if(!resolveSfwEnabled(e.sfw,e.version,warning))return!1;if(e.runInstall.length===0)return info("sfw was requested but `run-install` is disabled; sfw will not be invoked."),!1;let t=findSfwOnPath();return t?(info(`Using existing sfw on PATH: ${t}`),!0):isSfwSupported()?(await installSfw(),!0):(warning(`sfw has no published binary for this runner's platform/architecture (${`process.platform=${process.platform}, process.arch=${process.arch}, musl=${isMuslLinux()}`}) and none was found on PATH; falling back to plain \`vp install\`. To enable sfw here, install a working sfw binary on PATH in an earlier step (e.g. via \`socketdev/action@\` or a custom install).`),!1)}async function runDownloadCommand(e,t){let n={ignoreReturnCode:!0};return isWindows()?exec(`pwsh`,[`-Command`,`Invoke-WebRequest -UseBasicParsing -Uri '${e}' -OutFile '${t}' -TimeoutSec 60`],n):exec(`bash`,[`-c`,`set -o pipefail; curl -fsSL --connect-timeout 5 --max-time 60 -o '${t}' '${e}'`],n)}const Hv=/Command 'vp' not found in PATH/;function isSfwVpNotFoundFlake(e,t){return Hv.test(t)||Hv.test(e)}async function warmPowerShellCommandCache(){if(isWindows())try{await getExecOutput(`powershell.exe`,[`-NoProfile`,`-Command`,`Get-Command vp`],{ignoreReturnCode:!0})}catch(e){info(`PowerShell warm-up failed (${String(e)}); retrying sfw anyway.`)}}function tailOutput(e,t){let n=e.trim();return n.length<=t?n:`…(truncated, showing last ${t} chars)…\n${n.slice(-t)}`}async function runViteInstall(e){let t=getConfiguredProjectDir(e);for(let n of e.runInstall){let r=[`install`];n.args&&r.push(...n.args);let i=e.sfw?`sfw`:`vp`,a=e.sfw?[`vp`,...r]:r,o=getInstallCwd(t,n.cwd),s=`${i} ${a.join(` `)}`,attempt=async e=>{startGroup(`Running ${e} in ${o}...`);try{return await getExecOutput(i,a,{cwd:o,ignoreReturnCode:!0})}finally{endGroup()}};try{let t=await attempt(s);if(t.exitCode!==0&&e.sfw&&isSfwVpNotFoundFlake(t.stdout,t.stderr)&&(warning(`sfw reported vp as not found even though it is on PATH. This is a known sfw flake on Windows: a cold PowerShell start exceeds sfw's 10s command-resolution timeout and the timeout is misreported as not-found. Warming the PowerShell command cache and retrying once.`),await warmPowerShellCommandCache(),t=await attempt(`${s} (retry)`)),t.exitCode===0){info(`Successfully ran ${s}`);continue}let n=t.stderr.trim()||t.stdout.trim();n&&error(tailOutput(n,4e3),{title:`${s} failed`}),setFailed(`Command "${s}" (cwd: ${o}) exited with code ${t.exitCode}`)}catch(e){setFailed(`Failed to run ${s}: ${String(e)}`)}}}async function restoreCache(e){let t=getConfiguredProjectDir(e),n=detectLockFile$1(e.cacheDependencyPath,t);if(!n){warning(e.cacheDependencyPath?`No lock file found for cache-dependency-path: ${e.cacheDependencyPath}. Skipping cache restore.`:`No lock file found in project directory: ${t}. Skipping cache restore.`),setOutput(`cache-hit`,!1);return}info(`Using lock file: ${n.path}`);let r=ne(n.path);info(`Resolving dependency cache directory in: ${r}`);let i=await getCacheDirectories(n.type,r);if(!i.length){warning(`No cache directories found for ${n.type} in ${r}. Skipping cache restore.`),setOutput(`cache-hit`,!1);return}debug(`Cache paths: ${i.join(`, `)}`),saveState(`CACHE_PATHS`,JSON.stringify(i));let a=process.env.RUNNER_OS||Se(),o=be(),s=await hashFiles(n.path);if(!s)throw Error(`Failed to generate hash for lock file: ${n.path}`);let c=`vite-plus-${a}-${o}-${n.type}-${s}`,l=[`vite-plus-${a}-${o}-${n.type}-`,`vite-plus-${a}-${o}-`];debug(`Primary key: ${c}`),debug(`Restore keys: ${l.join(`, `)}`),saveState(`CACHE_PRIMARY_KEY`,c);let u=await restoreCache$1(i,c,l);u?(info(`Cache restored from key: ${u}`),saveState(`CACHE_MATCHED_KEY`,u),setOutput(`cache-hit`,!0)):(info(`Cache not found`),setOutput(`cache-hit`,!1))}async function saveCache(){let e=getState(`CACHE_PRIMARY_KEY`),t=getState(`CACHE_MATCHED_KEY`),n=getState(`CACHE_PATHS`);if(!e){info(`No cache key found. Skipping cache save.`);return}if(!n){info(`No cache paths found. Skipping cache save.`);return}if(e===t){info(`Cache hit on primary key "${e}". Skipping save.`);return}let r=JSON.parse(n);if(!r.length){info(`Empty cache paths. Skipping cache save.`);return}try{if(await saveCache$1(r,e)===-1){info(`Cache not saved (key already reserved by a concurrent job, or save was skipped).`);return}info(`Cache saved with key: ${e}`)}catch(e){warning(`Failed to save cache: ${String(e)}`)}}function resolvePath$1(e,t){return M.isAbsolute(e)?e:M.join(t,e)}function isWithin(e,t){let n=M.relative(t,e);return!M.isAbsolute(n)&&n!==`..`&&!n.startsWith(`..${M.sep}`)}function createNodeVersionResolver(e){let{getWorkspaceDir:t,info:n}=e;function resolveNodeVersionFile(e,r){let i=resolvePath$1(e,r||t()),a;try{a=pe(i,`utf-8`)}catch{throw Error(`node-version-file not found: ${i}`)}let o=te(i),s;if(s=o===`.tool-versions`?parseToolVersions(a):o===`package.json`?parsePackageJson(a):parsePlainVersionFile(a),!s)throw Error(`No Node.js version found in ${e}`);return s=s.replace(/^v/i,``),n(`Resolved Node.js version '${s}' from ${e}`),s}function parsePlainVersionFile(e){for(let t of e.split(` +`));let{commands:r}=yield getCommands(n,`create`);yield execCommands(r,e)})}var __awaiter=function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})},Nv=class ValidationError extends Error{constructor(e){super(e),this.name=`ValidationError`,Object.setPrototypeOf(this,ValidationError.prototype)}},Pv=class ReserveCacheError extends Error{constructor(e){super(e),this.name=`ReserveCacheError`,Object.setPrototypeOf(this,ReserveCacheError.prototype)}},Fv=class CacheWriteDeniedError extends Pv{constructor(e){super(e),this.name=`CacheWriteDeniedError`,Object.setPrototypeOf(this,CacheWriteDeniedError.prototype)}};const Iv=`cache read denied:`;var Lv=class CacheReadDeniedError extends Error{constructor(e){super(e),this.name=`CacheReadDeniedError`,Object.setPrototypeOf(this,CacheReadDeniedError.prototype)}},Rv=class FinalizeCacheError extends Error{constructor(e){super(e),this.name=`FinalizeCacheError`,Object.setPrototypeOf(this,FinalizeCacheError.prototype)}};function checkPaths(e){if(!e||e.length===0)throw new Nv(`Path Validation Error: At least one directory or file path is required`)}function checkKey(e){if(e.length>512)throw new Nv(`Key Validation Error: ${e} cannot be larger than 512 characters.`);if(!/^[^,]*$/.test(e))throw new Nv(`Key Validation Error: ${e} cannot contain commas.`)}function restoreCache$1(e,t,n,r){return __awaiter(this,arguments,void 0,function*(e,t,n,r,i=!1){let a=getCacheServiceVersion();debug(`Cache service version: ${a}`),checkPaths(e);let o=getCacheMode();if(!isCacheReadable(o)){info(`Cache restore skipped: the effective cache-mode '${o}' does not permit reads.`),debug(`Skipped restore for paths [${e.join(`, `)}] with primary key '${t}'.`);return}switch(a){case`v2`:return yield restoreCacheV2(e,t,n,r,i);default:return yield restoreCacheV1(e,t,n,r,i)}})}function restoreCacheV1(e,t,n,r){return __awaiter(this,arguments,void 0,function*(e,t,n,r,i=!1){n||=[];let a=[t,...n];if(debug(`Resolved Keys:`),debug(JSON.stringify(a)),a.length>10)throw new Nv(`Key Validation Error: Keys are limited to a maximum of 10.`);for(let e of a)checkKey(e);let o=yield getCompressionMethod(),s=``;try{let t;try{t=yield getCacheEntry(a,e,{compressionMethod:o,enableCrossOsArchive:i})}catch(e){let t=e?.message??``;throw t.includes(Iv)?new Lv(t):e}if(!t?.archiveLocation)return;if(r?.lookupOnly)return info(`Lookup only - skipping download`),t.cacheKey;s=u.join(yield createTempDirectory(),getCacheFileName(o)),debug(`Archive Path: ${s}`),yield downloadCache(t.archiveLocation,s,r),isDebug()&&(yield listTar(s,o));let n=getArchiveFileSizeInBytes(s);return info(`Cache Size: ~${Math.round(n/1048576)} MB (${n} B)`),yield extractTar(s,o),info(`Cache restored successfully`),t.cacheKey}catch(e){let t=e;if(t.name===Nv.name)throw e;t instanceof Pn&&typeof t.statusCode==`number`&&t.statusCode>=500?error(`Failed to restore: ${e.message}`):warning(`Failed to restore: ${e.message}`)}finally{try{yield unlinkFile(s)}catch(e){debug(`Failed to delete archive: ${e}`)}}})}function restoreCacheV2(e,t,n,r){return __awaiter(this,arguments,void 0,function*(e,t,n,r,i=!1){r=Object.assign(Object.assign({},r),{useAzureSdk:!0}),n||=[];let a=[t,...n];if(debug(`Resolved Keys:`),debug(JSON.stringify(a)),a.length>10)throw new Nv(`Key Validation Error: Keys are limited to a maximum of 10.`);for(let e of a)checkKey(e);let o=``;try{let s=internalCacheTwirpClient(),c=yield getCompressionMethod(),l={key:t,restoreKeys:n,version:getCacheVersion(e,c,i)},d;try{d=yield s.GetCacheEntryDownloadURL(l)}catch(e){let t=e?.message??``;throw t.includes(Iv)?new Lv(t):e}if(!d.ok){debug(`Cache not found for version ${l.version} of keys: ${a.join(`, `)}`);return}if(l.key===d.matchedKey?info(`Cache hit for: ${d.matchedKey}`):info(`Cache hit for restore-key: ${d.matchedKey}`),r?.lookupOnly)return info(`Lookup only - skipping download`),d.matchedKey;o=u.join(yield createTempDirectory(),getCacheFileName(c)),debug(`Archive path: ${o}`),debug(`Starting download of archive to: ${o}`),yield downloadCache(d.signedDownloadUrl,o,r);let f=getArchiveFileSizeInBytes(o);return info(`Cache Size: ~${Math.round(f/1048576)} MB (${f} B)`),isDebug()&&(yield listTar(o,c)),yield extractTar(o,c),info(`Cache restored successfully`),d.matchedKey}catch(e){let t=e;if(t.name===Nv.name)throw e;t instanceof Pn&&typeof t.statusCode==`number`&&t.statusCode>=500?error(`Failed to restore: ${e.message}`):warning(`Failed to restore: ${e.message}`)}finally{try{o&&(yield unlinkFile(o))}catch(e){debug(`Failed to delete archive: ${e}`)}}})}function saveCache$1(e,t,n){return __awaiter(this,arguments,void 0,function*(e,t,n,r=!1){let i=getCacheServiceVersion();debug(`Cache service version: ${i}`),checkPaths(e),checkKey(t);let a=getCacheMode();if(!isCacheWritable(a))return info(`Cache save skipped: the effective cache-mode '${a}' does not permit writes.`),debug(`Skipped save for paths [${e.join(`, `)}] with key '${t}'.`),-1;switch(i){case`v2`:return yield saveCacheV2(e,t,n,r);default:return yield saveCacheV1(e,t,n,r)}})}function saveCacheV1(e,t,n){return __awaiter(this,arguments,void 0,function*(e,t,n,r=!1){let i=yield getCompressionMethod(),a=-1,o=yield resolvePaths(e);if(debug(`Cache Paths:`),debug(`${JSON.stringify(o)}`),o.length===0)throw Error(`Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.`);let s=yield createTempDirectory(),c=u.join(s,getCacheFileName(i));debug(`Archive Path: ${c}`);try{yield createTar(s,o,i),isDebug()&&(yield listTar(c,i));let l=getArchiveFileSizeInBytes(c);if(debug(`File Size: ${l}`),l>10737418240&&!isGhes())throw Error(`Cache size of ~${Math.round(l/1048576)} MB (${l} B) is over the 10GB limit, not saving cache.`);debug(`Reserving Cache`);let u=yield reserveCache(t,e,{compressionMethod:i,enableCrossOsArchive:r,cacheSize:l});if(u?.result?.cacheId)a=u?.result?.cacheId;else if(u?.statusCode===400)throw Error(u?.error?.message??`Cache size of ~${Math.round(l/1048576)} MB (${l} B) is over the data cap limit, not saving cache.`);else{let e=u?.error?.message;throw e?.startsWith(`cache write denied:`)?new Fv(`Unable to reserve cache with key ${t}. More details: ${e}`):new Pv(`Unable to reserve cache with key ${t}, another job may be creating this cache. More details: ${u?.error?.message}`)}debug(`Saving Cache (ID: ${a})`),yield saveCache$2(a,c,``,n)}catch(e){let t=e;if(t.name===Nv.name)throw e;t.name===Pv.name?info(`Failed to save: ${t.message}`):t instanceof Pn&&typeof t.statusCode==`number`&&t.statusCode>=500?error(`Failed to save: ${t.message}`):warning(`Failed to save: ${t.message}`)}finally{try{yield unlinkFile(c)}catch(e){debug(`Failed to delete archive: ${e}`)}}return a})}function saveCacheV2(e,t,n){return __awaiter(this,arguments,void 0,function*(e,t,n,r=!1){n=Object.assign(Object.assign({},n),{uploadChunkSize:67108864,uploadConcurrency:8,useAzureSdk:!0});let i=yield getCompressionMethod(),a=internalCacheTwirpClient(),o=-1,s=yield resolvePaths(e);if(debug(`Cache Paths:`),debug(`${JSON.stringify(s)}`),s.length===0)throw Error(`Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.`);let c=yield createTempDirectory(),l=u.join(c,getCacheFileName(i));debug(`Archive Path: ${l}`);try{yield createTar(c,s,i),isDebug()&&(yield listTar(l,i));let u=getArchiveFileSizeInBytes(l);debug(`File Size: ${u}`),n.archiveSizeBytes=u,debug(`Reserving Cache`);let d=getCacheVersion(e,i,r),f={key:t,version:d},p;try{let e=yield a.CreateCacheEntry(f);if(!e.ok)throw e.message&&!e.message.startsWith(`cache write denied:`)&&warning(`Cache reservation failed: ${e.message}`),Error(e.message||`Response was not ok`);p=e.signedUploadUrl}catch(e){debug(`Failed to reserve cache: ${e}`);let n=e?.message??``;throw n.startsWith(`cache write denied:`)?new Fv(`Unable to reserve cache with key ${t}. More details: ${n}`):new Pv(`Unable to reserve cache with key ${t}, another job may be creating this cache.`)}debug(`Attempting to upload cache located at: ${l}`),yield saveCache$2(o,l,p,n);let m={key:t,version:d,sizeBytes:`${u}`},h=yield a.FinalizeCacheEntryUpload(m);if(debug(`FinalizeCacheEntryUploadResponse: ${h.ok}`),!h.ok)throw h.message?new Rv(h.message):Error(`Unable to finalize cache with key ${t}, another job may be finalizing this cache.`);o=parseInt(h.entryId)}catch(e){let t=e;if(t.name===Nv.name)throw e;t.name===Pv.name?info(`Failed to save: ${t.message}`):t.name===Rv.name?warning(t.message):t instanceof Pn&&typeof t.statusCode==`number`&&t.statusCode>=500?error(`Failed to save: ${t.message}`):warning(`Failed to save: ${t.message}`)}finally{try{yield unlinkFile(l)}catch(e){debug(`Failed to delete archive: ${e}`)}}return o})}function commandPath(e,t=process.env){if(!e||e===`.`||e===`..`||/[\\/:]/.test(e))return;let n=isWindows(),r=n?Object.keys(t).sort().find(e=>e.toUpperCase()===`PATH`):`PATH`,i=r&&t[r]||``,a=n&&!e.toLowerCase().endsWith(`.exe`)?`${e}.exe`:e,o=I(process.cwd());for(let e of i.split(M.delimiter)){let t=n?e.replace(/^"(.*)"$/,`$1`):e;if(M.isAbsolute(t))try{let e=I(t);if(n?e.toLowerCase()===o.toLowerCase():e===o)continue;let r=M.join(t,a);if(!ge(r).isFile())continue;return le(r,n?de.F_OK:de.X_OK),r}catch{}}}function resolveSfwEnabled(e,t,n){return e?!pkgPrNewCommitSha(t)||(n(`sfw was requested but is automatically disabled for Vite+ preview build ${t}; Socket Firewall Free will not be used.`),!1):!1}const zv=`v1.15.4`,Bv=`https://github.com/SocketDev/sfw-free/releases/download/${zv}`;function isMuslLinux(){if(process.platform!==`linux`)return!1;try{let e=process.report?.getReport();if(e?.header&&!e.header.glibcVersionRuntime)return!0}catch{}return F(`/etc/alpine-release`)}function getSfwAssetName(e,t,n){if(e===`darwin`){if(t===`arm64`)return`sfw-free-macos-arm64`;if(t===`x64`)return`sfw-free-macos-x86_64`}else if(e===`linux`){if(t===`arm64`)return n?`sfw-free-musl-linux-arm64`:`sfw-free-linux-arm64`;if(t===`x64`)return n?`sfw-free-musl-linux-x86_64`:`sfw-free-linux-x86_64`}else if(isWindows(e)){if(t===`arm64`)return`sfw-free-windows-arm64.exe`;if(t===`x64`)return`sfw-free-windows-x86_64.exe`}throw Error(`Unsupported platform/arch for sfw: ${e}/${t}${e===`linux`?` (${n?`musl`:`glibc`})`:``}`)}const Vv=2e3;function isSfwSupported(e=process.platform,t=process.arch,n=isMuslLinux()){try{return!!getSfwAssetName(e,t,n)}catch{return!1}}function getSfwBinDir(){let e=process.env.RUNNER_TEMP||process.env.TMPDIR||process.env.TEMP||`/tmp`;return P(e,`sfw-bin`)}async function installSfw(){let e=getSfwAssetName(process.platform,process.arch,isMuslLinux()),t=`${Bv}/${e}`,n=getSfwBinDir();fe(n,{recursive:!0});let r=P(n,isWindows()?`sfw.exe`:`sfw`),i=`sfw-${zv}-${process.platform}-${process.arch}-${isMuslLinux()?`musl`:`glibc`}`;try{let e=await restoreCache$1([n],i);if(e&&F(r)){isWindows()||ue(r,493),addPath(n),info(`sfw restored from cache: ${e}`);return}}catch(e){warning(`sfw cache restore failed (${e instanceof Error?e.message:String(e)}); falling through to download.`)}info(`Installing sfw from ${t}...`);let a=``;for(let e=1;e<=2;e++){try{let e=await runDownloadCommand(t,r);if(e===0&&F(r)){isWindows()||ue(r,493),addPath(n),info(`sfw installed at ${r}`);try{await saveCache$1([n],i),info(`sfw cached under key: ${i}`)}catch(e){warning(`sfw cache save failed (${e instanceof Error?e.message:String(e)}); continuing.`)}return}a=`exit code ${e}`}catch(e){a=e instanceof Error?e.message:String(e)}e<2&&(warning(`Failed to install sfw from ${t} (${a}). Retrying in ${Vv}ms... (attempt ${e+1}/2)`),await se(Vv))}throw Error(`Failed to install sfw from ${t} after 2 attempts: ${a}`)}function findSfwOnPath(){return commandPath(`sfw`)??null}async function setupSfw(e){if(!resolveSfwEnabled(e.sfw,e.version,warning))return!1;if(e.runInstall.length===0)return info("sfw was requested but `run-install` is disabled; sfw will not be invoked."),!1;let t=findSfwOnPath();return t?(info(`Using existing sfw on PATH: ${t}`),!0):isSfwSupported()?(await installSfw(),!0):(warning(`sfw has no published binary for this runner's platform/architecture (${`process.platform=${process.platform}, process.arch=${process.arch}, musl=${isMuslLinux()}`}) and none was found on PATH; falling back to plain \`vp install\`. To enable sfw here, install a working sfw binary on PATH in an earlier step (e.g. via \`socketdev/action@\` or a custom install).`),!1)}async function runDownloadCommand(e,t){let n={ignoreReturnCode:!0};return isWindows()?exec(`pwsh`,[`-Command`,`Invoke-WebRequest -UseBasicParsing -Uri '${e}' -OutFile '${t}' -TimeoutSec 60`],n):exec(`bash`,[`-c`,`set -o pipefail; curl -fsSL --connect-timeout 5 --max-time 60 -o '${t}' '${e}'`],n)}const Hv=/Command 'vp' not found in PATH/;function isSfwVpNotFoundFlake(e,t){return Hv.test(t)||Hv.test(e)}async function warmPowerShellCommandCache(){if(isWindows())try{await getExecOutput(`powershell.exe`,[`-NoProfile`,`-Command`,`Get-Command vp`],{ignoreReturnCode:!0})}catch(e){info(`PowerShell warm-up failed (${String(e)}); retrying sfw anyway.`)}}function tailOutput(e,t){let n=e.trim();return n.length<=t?n:`…(truncated, showing last ${t} chars)…\n${n.slice(-t)}`}async function runViteInstall(e){let t=getConfiguredProjectDir(e);for(let n of e.runInstall){let r=[`install`];n.args&&r.push(...n.args);let i=e.sfw?`sfw`:`vp`,a=e.sfw?[`vp`,...r]:r,o=getInstallCwd(t,n.cwd),s=`${i} ${a.join(` `)}`,attempt=async e=>{startGroup(`Running ${e} in ${o}...`);try{return await getExecOutput(i,a,{cwd:o,ignoreReturnCode:!0})}finally{endGroup()}};try{let t=await attempt(s);if(t.exitCode!==0&&e.sfw&&isSfwVpNotFoundFlake(t.stdout,t.stderr)&&(warning(`sfw reported vp as not found even though it is on PATH. This is a known sfw flake on Windows: a cold PowerShell start exceeds sfw's 10s command-resolution timeout and the timeout is misreported as not-found. Warming the PowerShell command cache and retrying once.`),await warmPowerShellCommandCache(),t=await attempt(`${s} (retry)`)),t.exitCode===0){info(`Successfully ran ${s}`);continue}let n=t.stderr.trim()||t.stdout.trim();n&&error(tailOutput(n,4e3),{title:`${s} failed`}),setFailed(`Command "${s}" (cwd: ${o}) exited with code ${t.exitCode}`)}catch(e){setFailed(`Failed to run ${s}: ${String(e)}`)}}}async function restoreCache(e){let t=getConfiguredProjectDir(e),n=detectLockFile$1(e.cacheDependencyPath,t);if(!n){warning(e.cacheDependencyPath?`No lock file found for cache-dependency-path: ${e.cacheDependencyPath}. Skipping cache restore.`:`No lock file found in project directory: ${t}. Skipping cache restore.`),setOutput(`cache-hit`,!1);return}info(`Using lock file: ${n.path}`);let r=ne(n.path);info(`Resolving dependency cache directory in: ${r}`);let i=await getCacheDirectories(n.type,r);if(!i.length){warning(`No cache directories found for ${n.type} in ${r}. Skipping cache restore.`),setOutput(`cache-hit`,!1);return}debug(`Cache paths: ${i.join(`, `)}`),saveState(`CACHE_PATHS`,JSON.stringify(i));let a=process.env.RUNNER_OS||Se(),o=be(),s=await hashFiles(n.path);if(!s)throw Error(`Failed to generate hash for lock file: ${n.path}`);let c=`vite-plus-${a}-${o}-${n.type}-${s}`,l=[`vite-plus-${a}-${o}-${n.type}-`,`vite-plus-${a}-${o}-`];debug(`Primary key: ${c}`),debug(`Restore keys: ${l.join(`, `)}`),saveState(`CACHE_PRIMARY_KEY`,c);let u=await restoreCache$1(i,c,l);u?(info(`Cache restored from key: ${u}`),saveState(`CACHE_MATCHED_KEY`,u),setOutput(`cache-hit`,!0)):(info(`Cache not found`),setOutput(`cache-hit`,!1))}async function saveCache(){let e=getState(`CACHE_PRIMARY_KEY`),t=getState(`CACHE_MATCHED_KEY`),n=getState(`CACHE_PATHS`);if(!e){info(`No cache key found. Skipping cache save.`);return}if(!n){info(`No cache paths found. Skipping cache save.`);return}if(e===t){info(`Cache hit on primary key "${e}". Skipping save.`);return}let r=JSON.parse(n);if(!r.length){info(`Empty cache paths. Skipping cache save.`);return}try{if(await saveCache$1(r,e)===-1){info(`Cache not saved (key already reserved by a concurrent job, or save was skipped).`);return}info(`Cache saved with key: ${e}`)}catch(e){warning(`Failed to save cache: ${String(e)}`)}}function resolvePath$1(e,t){return M.isAbsolute(e)?e:M.join(t,e)}function isWithin(e,t){let n=M.relative(t,e);return!M.isAbsolute(n)&&n!==`..`&&!n.startsWith(`..${M.sep}`)}function createNodeVersionResolver(e){let{getWorkspaceDir:t,info:n}=e;function resolveNodeVersionFile(e,r){let i=resolvePath$1(e,r||t()),a;try{a=pe(i,`utf-8`)}catch{throw Error(`node-version-file not found: ${i}`)}let o=te(i),s;if(s=o===`.tool-versions`?parseToolVersions(a):o===`package.json`?parsePackageJson(a):parsePlainVersionFile(a),!s)throw Error(`No Node.js version found in ${e}`);return s=s.replace(/^v/i,``),n(`Resolved Node.js version '${s}' from ${e}`),s}function parsePlainVersionFile(e){for(let t of e.split(` `)){let e=(t.includes(`#`)?t.slice(0,t.indexOf(`#`)):t).trim();if(e)return normalizeNvmAlias(e)}}function normalizeNvmAlias(e){let t=e.toLowerCase();return t===`node`||t===`stable`?`latest`:e}function parseToolVersions(e){for(let t of e.split(` `)){let e=t.trim();if(!e||e.startsWith(`#`))continue;let[n,...r]=e.split(/\s+/);if(n===`nodejs`||n===`node`){for(let e of r)if(isAsdfInstallableVersion(e))return e}}}function isAsdfInstallableVersion(e){return!!e&&e!==`system`&&!e.startsWith(`ref:`)&&!e.startsWith(`path:`)}function parsePackageJson(e){let t;try{t=JSON.parse(e)}catch{throw Error(`Failed to parse package.json: invalid JSON`)}let n=t.devEngines;if(n?.runtime){let e=findNodeRuntime(n.runtime);if(e)return e}let r=t.engines;if(r?.node&&typeof r.node==`string`)return r.node}function findNodeRuntime(e){let t=Array.isArray(e)?e:[e];for(let e of t)if(e?.name===`node`&&typeof e.version==`string`)return e.version}return{resolveNodeVersionFile}}const{resolveNodeVersionFile:Uv}=createNodeVersionResolver({getWorkspaceDir,info}),Wv=[{filename:`pnpm-lock.yaml`,type:`pnpm`},{filename:`bun.lockb`,type:`bun`},{filename:`bun.lock`,type:`bun`},{filename:`package-lock.json`,type:`npm`},{filename:`npm-shrinkwrap.json`,type:`npm`},{filename:`yarn.lock`,type:`yarn`}];function resolvePath(e,t){return re(e)?e:P(t,e)}function inferLockFileType(e,t){return t.includes(`pnpm`)?{type:`pnpm`,path:e,filename:t}:t.includes(`yarn`)?{type:`yarn`,path:e,filename:t}:t.startsWith(`bun.`)?{type:`bun`,path:e,filename:t}:{type:`npm`,path:e,filename:t}}function detectLockFile(e,t){if(e){let n=resolvePath(e,t);if(F(n)){let e=te(n),t=Wv.find(t=>t.filename===e);return t?{type:t.type,path:n,filename:e}:inferLockFileType(n,e)}return}let n=me(t);for(let e of Wv)if(n.includes(e.filename)){let n=P(t,e.filename);return{type:e.type,path:n,filename:e.filename}}}function createLockfileResolver(e){let{getWorkspaceDir:t,info:n,debug:r}=e,i=/^\d+\.\d+\.\d+/;function tryResolveVitePlusVersionFromLockfile(e,t){let i=detectLockfileForProject(e,t);if(!i)return;let a=i.filename.endsWith(`.lockb`)?textBunLockBeside(i):i;if(!a){r(`Cannot read ${i.filename} (binary) to resolve the ${aa} version; using "latest". Use the text bun.lock, or set the \`version\` input.`);return}let o=parseVitePlusVersionFromLockfile(a,workspaceSubPath(ne(a.path),e));if(o)return n(`Resolved ${aa} version '${o}' from ${a.filename}`),o;r(`No ${aa} version found in ${a.path}`)}function detectLockfileForProject(e,n){if(n)return detectLockFile(n,e);let r=t(),i=e;for(;;){let e=detectLockFile(void 0,i);if(e)return e;let t=ne(i);if(i===r||t===i||!isWithin(t,r))break;i=t}}function textBunLockBeside(e){let t=P(ne(e.path),`bun.lock`);return F(t)?{type:`bun`,path:t,filename:`bun.lock`}:void 0}function workspaceSubPath(e,t){if(!isWithin(t,e))return``;let n=ie(e,t);return n?n.split(oe).join(`/`):``}function parseVitePlusVersionFromLockfile(e,t=``){if(e.filename.endsWith(`.lockb`))return;let n;try{n=pe(e.path,`utf-8`)}catch{return}let r;switch(e.type){case`npm`:r=fromNpmLock(n,t);break;case`pnpm`:r=fromPnpmLock(n,t);break;case`yarn`:r=fromYarnLock(n);break;case`bun`:r=fromBunTextLock(n);break;default:return}return r&&i.test(r)?r:void 0}function fromNpmLock(e,t){let n;try{n=JSON.parse(e)}catch{return}let r=n.packages;if(t){let e=r?.[`${t}/node_modules/${oa}`]?.version;if(typeof e==`string`)return e;if(!npmPackageDeclaresVitePlus(r?.[t]))return}let i=r?.[`node_modules/${oa}`]?.version;if(typeof i==`string`)return i;let a=n.dependencies?.[oa]?.version;return typeof a==`string`?a:void 0}function npmPackageDeclaresVitePlus(e){if(!e)return!1;for(let t of[`dependencies`,`devDependencies`]){let n=e[t];if(n&&typeof n==`object`&&`vite-plus`in n)return!0}return!1}function fromPnpmLock(e,t){let n;try{n=(0,_i.parse)(e)}catch{return}if(!n||typeof n!=`object`)return;let r=n,i=r.importers;if(i&&typeof i==`object`){let e=t||`.`;return e in i?pnpmImporterVersion(i[e]):void 0}return pnpmImporterVersion(r)||e.match(/^\s*\/?vite-plus@(\d+\.\d+\.\d+[^\s():'"]*)/m)?.[1]}function pnpmImporterVersion(e){if(!e||typeof e!=`object`)return;let t=e;for(let e of[`dependencies`,`devDependencies`,`optionalDependencies`]){let n=t[e];if(n&&typeof n==`object`){let e=n[oa],t=typeof e==`string`?e:e?.version;if(typeof t==`string`){let e=t.replace(/\(.*$/,``).trim();if(i.test(e))return e}}}}function fromYarnLock(e){let t=/* @__PURE__ */ new Set,n=e.split(/\r?\n/);for(let e=0;e!isReservedEnvVar(e)&&!!process.env[e]);if(i.length===0){debug(`Project .npmrc at ${t}: no auth env vars to propagate`);return}info(`Detected project .npmrc at ${t}. Propagating auth env vars: ${i.join(`, `)}`);for(let e of i)exportVariable(e,process.env[e])}async function runMain(e){saveState(`IS_POST`,`true`);let t=getConfiguredProjectDir(e),n=e.nodeVersion;!n&&e.nodeVersionFile&&(n=Uv(e.nodeVersionFile,t));let r=Gv(e,t);await installVitePlus({...e,version:r});let i=e.nodeManager===!1||e.packageManager!==void 0?(await getExecOutput(`vp`,[`--version`],{silent:!0})).stdout:``,a=packageManagerArgs(e.packageManager,i);e.nodeManager===!1?(info(`Disabling Vite+ Node.js version management...`),await exec(`vp`,nodeManagerOffArgs(i))):n&&(info(`Setting up Node.js ${n} via vp env use...`),await exec(`vp`,[`env`,`use`,n]));for(let e of a)await exec(`vp`,e);e.registryUrl?configAuthentication(e.registryUrl,e.scope):propagateProjectNpmrcAuth(t),e.cache&&await restoreCache(e);let o=await setupSfw({...e,version:r});e.runInstall.length>0&&await runViteInstall({...e,sfw:o}),await printViteVersion(t)}async function printViteVersion(e){try{let t=(await getExecOutput(`vp`,[`--version`],{cwd:e,silent:!0})).stdout.trim();info(t);let n=parseInstalledVpVersion(t);saveState(`INSTALLED_VERSION`,n),setOutput(`version`,n)}catch(e){warning(`Could not get vp version: ${String(e)}`),setOutput(`version`,`unknown`)}}async function runPost(e){if(e.cache){if(!e.cacheSave){info(`Cache saving is disabled. Skipping cache save.`);return}await saveCache()}}async function main(){let e=getInputs();getState(`IS_POST`)===`true`?await runPost(e):await runMain(e)}main().catch(e=>{console.error(e),setFailed(e instanceof Error?e.message:String(e))});export{runMain,runPost}; \ No newline at end of file diff --git a/src/ci/install-sfw.ts b/src/ci/install-sfw.ts index 2d66edf..7a99f2f 100644 --- a/src/ci/install-sfw.ts +++ b/src/ci/install-sfw.ts @@ -184,7 +184,7 @@ export async function setupSfw( return "vp"; } - const existing = commandPath("sfw"); + const existing = commandPath("sfw", env); if (existing) { console.log(`setup-vp: using existing sfw on PATH: ${existing}`); return "sfw"; diff --git a/src/ci/process.test.ts b/src/ci/process.test.ts index 1980ed4..28e3ea7 100644 --- a/src/ci/process.test.ts +++ b/src/ci/process.test.ts @@ -1,9 +1,11 @@ import { + chmodSync, copyFileSync, mkdtempSync, mkdirSync, readFileSync, statSync, + symlinkSync, writeFileSync, } from "node:fs"; import { rm } from "node:fs/promises"; @@ -22,6 +24,55 @@ afterEach(async () => { } }); +describe("commandPath", () => { + function fixture(): { root: string; first: string; second: string; filename: string } { + const root = mkdtempSync(path.join(tmpdir(), "setup-vp-path-")); + directories.push(root); + const first = path.join(root, "first bin"); + const second = path.join(root, "second bin"); + mkdirSync(first); + mkdirSync(second); + return { root, first, second, filename: isWindows() ? "sfw.exe" : "sfw" }; + } + + it("checks PATH order, skips directories and missing entries, and never executes the result", () => { + const { root, first, second, filename } = fixture(); + const env = { PATH: [path.join(root, "missing"), first, second].join(path.delimiter) }; + mkdirSync(path.join(first, filename)); + writeFileSync(path.join(second, filename), "not an executable program", { mode: 0o755 }); + + expect(commandPath("sfw", env)).toBe(path.join(second, filename)); + expect(commandPath("sfw", {})).toBeUndefined(); + expect(commandPath("sfw", { PATH: "" })).toBeUndefined(); + expect(commandPath("../sfw", env)).toBeUndefined(); + expect(commandPath(path.join(second, filename), env)).toBeUndefined(); + expect(commandPath("", env)).toBeUndefined(); + }); + + it.skipIf(isWindows())("requires execute permission and accepts executable symlinks", () => { + const { first, second, filename } = fixture(); + writeFileSync(path.join(first, filename), "not executable", { mode: 0o644 }); + writeFileSync(path.join(second, filename), "executable", { mode: 0o755 }); + const env = { PATH: [first, second].join(path.delimiter) }; + expect(commandPath("sfw", env)).toBe(path.join(second, filename)); + + chmodSync(path.join(first, filename), 0o755); + expect(commandPath("sfw", env)).toBe(path.join(first, filename)); + symlinkSync(path.join(second, filename), path.join(first, "linked-sfw")); + expect(commandPath("linked-sfw", env)).toBe(path.join(first, "linked-sfw")); + }); + + it.skipIf(!isWindows())("accepts quoted Path entries and selects native .exe files", () => { + const { first, second, filename } = fixture(); + writeFileSync(path.join(first, "sfw.cmd"), "@exit /b 1"); + writeFileSync(path.join(first, "sfw.com"), "not an exe"); + writeFileSync(path.join(second, filename), "native exe"); + const env = { Path: `"${first}";"${second}"`, PATHEXT: ".CMD;.COM" }; + expect(commandPath("sfw", env)).toBe(path.join(second, filename)); + expect(commandPath("sfw.exe", env)).toBe(path.join(second, filename)); + }); +}); + describe("portable process helpers", () => { it("retains native executable output and failures", async () => { expect(getCommandOutput(process.execPath, ["-p", "'output'"])).toBe("output"); @@ -67,8 +118,7 @@ process.exit(Number(process.env.SETUP_VP_TEST_EXIT || 0)); "trailing\\", ]; const commandArgs = [script, ...args]; - // where.exe can expand TEMP's 8.3 spelling. Check file identity rather - // than requiring the same spelling for equivalent Windows paths. + // Check file identity across equivalent Windows path spellings. const resolvedPath = commandPath("vp"); expect(resolvedPath).toBeDefined(); const expectedFile = statSync(path.join(bin, "vp.exe"), { bigint: true }); diff --git a/src/ci/process.ts b/src/ci/process.ts index 776c4c0..49edc81 100644 --- a/src/ci/process.ts +++ b/src/ci/process.ts @@ -1,5 +1,7 @@ import { spawn, spawnSync } from "node:child_process"; import type { SpawnOptions, SpawnSyncOptions } from "node:child_process"; +import { accessSync, constants, realpathSync, statSync } from "node:fs"; +import path from "node:path"; import { isWindows } from "./platform.js"; export function run(command: string, args: string[], options: SpawnSyncOptions = {}): void { @@ -32,20 +34,42 @@ export function runWithOutput( }); } -export function commandPath(command: string): string | undefined { - if (isWindows()) { - const result = spawnSync("where", [command], { encoding: "utf8" }); - if (result.status === 0) { - const line = result.stdout.trim().split(/\r?\n/)[0]?.trim(); - return line || undefined; +// Resolve native executables without running a lookup tool from the workspace. +export function commandPath( + command: string, + env: NodeJS.ProcessEnv = process.env, +): string | undefined { + if (!command || command === "." || command === ".." || /[\\/:]/.test(command)) return undefined; + + const windows = isWindows(); + const pathKey = windows + ? Object.keys(env) + .sort() + .find((key) => key.toUpperCase() === "PATH") + : "PATH"; + const searchPath = (pathKey && env[pathKey]) || ""; + const filename = windows && !command.toLowerCase().endsWith(".exe") ? `${command}.exe` : command; + const cwd = realpathSync(process.cwd()); + + for (const entry of searchPath.split(path.delimiter)) { + const directory = windows ? entry.replace(/^"(.*)"$/, "$1") : entry; + // Empty and relative entries can refer to attacker-controlled checkout files. + if (!path.isAbsolute(directory)) continue; + try { + const resolvedDirectory = realpathSync(directory); + const isCwd = windows + ? resolvedDirectory.toLowerCase() === cwd.toLowerCase() + : resolvedDirectory === cwd; + if (isCwd) continue; + + const candidate = path.join(directory, filename); + if (!statSync(candidate).isFile()) continue; + accessSync(candidate, windows ? constants.F_OK : constants.X_OK); + return candidate; + } catch { + // Missing or inaccessible entries do not prevent searching the rest of PATH. } - return undefined; } - - const result = spawnSync("sh", ["-c", 'command -v "$1"', "sh", command], { - encoding: "utf8", - }); - if (result.status === 0) return result.stdout.trim(); return undefined; } diff --git a/src/gitlab/install-sfw.test.ts b/src/gitlab/install-sfw.test.ts index 85a79bd..1af2571 100644 --- a/src/gitlab/install-sfw.test.ts +++ b/src/gitlab/install-sfw.test.ts @@ -45,7 +45,7 @@ describe("GitLab sfw setup", () => { vi.mocked(commandPath).mockReturnValue(path.join(tempDir(), "sfw")); expect(await setupSfw([{}], { SETUP_VP_SFW: "true" })).toBe("sfw"); - expect(commandPath).toHaveBeenCalledWith("sfw"); + expect(commandPath).toHaveBeenCalledWith("sfw", { SETUP_VP_SFW: "true" }); expect(spawnSync).not.toHaveBeenCalled(); }); diff --git a/src/install-sfw-path.test.ts b/src/install-sfw-path.test.ts new file mode 100644 index 0000000..7e56609 --- /dev/null +++ b/src/install-sfw-path.test.ts @@ -0,0 +1,87 @@ +import { + copyFileSync, + existsSync, + mkdirSync, + mkdtempSync, + symlinkSync, + writeFileSync, +} from "node:fs"; +import { rm } from "node:fs/promises"; +import { tmpdir } from "node:os"; +import path from "node:path"; +import { afterEach, expect, it, vi } from "vite-plus/test"; +import { setupSfw } from "./ci/install-sfw.js"; +import { isWindows } from "./ci/platform.js"; +import { commandPath } from "./ci/process.js"; +import { findSfwOnPath } from "./install-sfw.js"; + +const directories: string[] = []; +afterEach(async () => { + vi.unstubAllEnvs(); + for (const directory of directories.splice(0)) { + await rm(directory, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 }); + } +}); + +it("does not execute planted lookup tools or reuse sfw from the working directory", async () => { + const root = mkdtempSync(path.join(tmpdir(), "setup-vp-sfw-path-")); + directories.push(root); + const workspace = path.join(root, "workspace"); + const trustedBin = path.join(root, "trusted bin"); + const alias = path.join(root, "workspace-alias"); + const marker = path.join(root, "lookup-executed"); + const filename = isWindows() ? "sfw.exe" : "sfw"; + mkdirSync(workspace); + mkdirSync(trustedBin); + symlinkSync(workspace, alias, isWindows() ? "junction" : "dir"); + writeFileSync(path.join(workspace, filename), "workspace executable", { mode: 0o755 }); + vi.stubEnv("SETUP_VP_LOOKUP_MARKER", marker); + + if (isWindows()) { + // A real PE executable makes a regressed execFileSync/spawnSync('where') + // run the harmless marker hook, even without invoking a shell. + copyFileSync(process.execPath, path.join(workspace, "where.exe")); + const hook = path.join(root, "marker.cjs"); + writeFileSync( + hook, + "require('node:fs').writeFileSync(process.env.SETUP_VP_LOOKUP_MARKER, 'called'); process.exit(1);", + ); + vi.stubEnv("NODE_OPTIONS", `--require ${JSON.stringify(hook)}`); + writeFileSync( + path.join(workspace, "where.cmd"), + '@echo called > "%SETUP_VP_LOOKUP_MARKER%"\r\n@exit /b 1\r\n', + ); + } else { + for (const tool of ["which", "sh"]) { + writeFileSync( + path.join(workspace, tool), + '#!/bin/sh\nprintf called > "$SETUP_VP_LOOKUP_MARKER"\nexit 1\n', + { mode: 0o755 }, + ); + } + } + + const originalCwd = process.cwd(); + try { + process.chdir(workspace); + // Cover implicit CWD, relative entries, absolute CWD, and a symlink/junction alias. + vi.stubEnv( + "PATH", + ["", ".", "../workspace", workspace, alias, trustedBin].join(path.delimiter), + ); + expect(commandPath("sfw")).toBeUndefined(); + expect(findSfwOnPath()).toBeNull(); + expect(existsSync(marker)).toBe(false); + + const binary = path.join(trustedBin, filename); + writeFileSync(binary, "trusted executable", { mode: 0o755 }); + expect(commandPath("sfw")).toBe(binary); + expect(findSfwOnPath()).toBe(binary); + const download = vi.fn(); + expect(await setupSfw([{}], { sfwEnabled: true, download })).toBe("sfw"); + expect(download).not.toHaveBeenCalled(); + expect(existsSync(marker)).toBe(false); + } finally { + process.chdir(originalCwd); + } +}); diff --git a/src/install-sfw.test.ts b/src/install-sfw.test.ts index e78f2c2..36cfa10 100644 --- a/src/install-sfw.test.ts +++ b/src/install-sfw.test.ts @@ -4,8 +4,8 @@ import { describe, it, expect, beforeEach, afterEach, vi } from "vite-plus/test" // in-file references resolve to the mocked versions. setupSfw / installSfw // call findSfwOnPath / isSfwSupported / installSfw directly within the // module, so we drive them by stubbing process.platform and the external -// shells (@actions/core, @actions/cache, @actions/exec, node:child_process, -// node:fs). +// dependencies (@actions/core, @actions/cache, @actions/exec, +// commandPath, node:fs). vi.mock("@actions/core", () => ({ info: vi.fn(), warning: vi.fn(), @@ -18,10 +18,7 @@ vi.mock("@actions/cache", () => ({ vi.mock("@actions/exec", () => ({ exec: vi.fn(), })); -vi.mock("node:child_process", async (importOriginal) => ({ - ...(await importOriginal()), - execFileSync: vi.fn(), -})); +vi.mock("./ci/process.js", () => ({ commandPath: vi.fn() })); vi.mock("node:fs", async (importOriginal) => ({ ...(await importOriginal()), chmodSync: vi.fn(), @@ -35,7 +32,7 @@ vi.mock("node:timers/promises", () => ({ import { restoreCache, saveCache } from "@actions/cache"; import { addPath, info, warning } from "@actions/core"; import { exec } from "@actions/exec"; -import { execFileSync } from "node:child_process"; +import { commandPath } from "./ci/process.js"; import { existsSync } from "node:fs"; import { SFW_VERSION } from "./ci/install-sfw.js"; import { getSfwAssetName, installSfw, isSfwSupported, setupSfw } from "./install-sfw.js"; @@ -181,14 +178,14 @@ describe("setupSfw", () => { "disables sfw for preview builds on %s even when sfw is on PATH", async (platform) => { stubPlatform(platform, "x64"); - vi.mocked(execFileSync).mockReturnValue("/usr/bin/sfw\n"); + vi.mocked(commandPath).mockReturnValue("/usr/bin/sfw"); expect(await setupSfw(makeInputs({ version: previewVersion }))).toBe(false); expect(warning).toHaveBeenCalledExactlyOnceWith( `sfw was requested but is automatically disabled for Vite+ preview build ${previewVersion}; Socket Firewall Free will not be used.`, ); - expect(execFileSync).not.toHaveBeenCalled(); + expect(commandPath).not.toHaveBeenCalled(); expect(restoreCache).not.toHaveBeenCalled(); expect(exec).not.toHaveBeenCalled(); expect(addPath).not.toHaveBeenCalled(); @@ -203,7 +200,7 @@ describe("setupSfw", () => { it.each(["0.3.2", "0.3.3-alpha.1", "latest", "next"])( "keeps sfw enabled for %s", async (version) => { - vi.mocked(execFileSync).mockReturnValue("/usr/bin/sfw\n"); + vi.mocked(commandPath).mockReturnValue("/usr/bin/sfw"); expect(await setupSfw(makeInputs({ version }))).toBe(true); expect(warning).not.toHaveBeenCalled(); }, @@ -219,26 +216,26 @@ describe("setupSfw", () => { // macOS is supported as of vp v0.1.23 — the PATH-detection branch now // applies to all platforms, not just Linux. stubPlatform("darwin", "arm64"); - vi.mocked(execFileSync).mockReturnValue("/usr/local/bin/sfw\n"); + vi.mocked(commandPath).mockReturnValue("/usr/local/bin/sfw"); expect(await setupSfw(makeInputs())).toBe(true); expect(info).toHaveBeenCalledWith(expect.stringContaining("Using existing sfw on PATH")); + expect(commandPath).toHaveBeenCalledExactlyOnceWith("sfw"); expect(restoreCache).not.toHaveBeenCalled(); // installSfw never invoked expect(exec).not.toHaveBeenCalled(); }); it("uses an existing sfw on PATH on Linux and skips the download", async () => { - vi.mocked(execFileSync).mockReturnValue("/usr/bin/sfw\n"); + vi.mocked(commandPath).mockReturnValue("/usr/bin/sfw"); expect(await setupSfw(makeInputs())).toBe(true); expect(info).toHaveBeenCalledWith(expect.stringContaining("Using existing sfw on PATH")); + expect(commandPath).toHaveBeenCalledExactlyOnceWith("sfw"); expect(restoreCache).not.toHaveBeenCalled(); expect(exec).not.toHaveBeenCalled(); }); it("falls back with a warning on an unsupported arch + no sfw on PATH", async () => { stubPlatform("linux", "ia32"); - vi.mocked(execFileSync).mockImplementation(() => { - throw new Error("not found"); - }); + vi.mocked(commandPath).mockReturnValue(undefined); expect(await setupSfw(makeInputs())).toBe(false); expect(warning).toHaveBeenCalledWith( expect.stringContaining("no published binary for this runner"), diff --git a/src/install-sfw.ts b/src/install-sfw.ts index bfbce40..f8ed283 100644 --- a/src/install-sfw.ts +++ b/src/install-sfw.ts @@ -1,12 +1,12 @@ import { restoreCache, saveCache } from "@actions/cache"; import { info, warning, addPath } from "@actions/core"; import { exec } from "@actions/exec"; -import { execFileSync } from "node:child_process"; import { chmodSync, existsSync, mkdirSync } from "node:fs"; import { join } from "node:path"; import { setTimeout as sleep } from "node:timers/promises"; import { getSfwAssetName, isMuslLinux, SFW_RELEASE_BASE, SFW_VERSION } from "./ci/install-sfw.js"; import { isWindows } from "./ci/platform.js"; +import { commandPath } from "./ci/process.js"; import { resolveSfwEnabled } from "./ci/sfw.js"; import type { Inputs } from "./types.js"; @@ -122,17 +122,7 @@ export async function installSfw(): Promise { // Used to detect when the user composed `socketdev/action@` (or // installed sfw via some other means) before invoking this action. export function findSfwOnPath(): string | null { - const lookupCmd = isWindows() ? "where" : "which"; - try { - const stdout = execFileSync(lookupCmd, ["sfw"], { - encoding: "utf8", - stdio: ["ignore", "pipe", "ignore"], - }); - const firstLine = stdout.split(/\r?\n/).find((line) => line.trim().length > 0); - return firstLine ? firstLine.trim() : null; - } catch { - return null; - } + return commandPath("sfw") ?? null; } // Decide what to do with `sfw: true`. Returns whether `vp install` should be From 07b671802febb81f944506a61b75398c717b3adc Mon Sep 17 00:00:00 2001 From: MK Date: Thu, 8 Oct 2026 14:10:56 +0800 Subject: [PATCH 2/5] fix: enforce sfw path selection during installation --- README.md | 2 +- dist/azure/index.mjs | 44 +++++----- dist/gitlab/index.mjs | 52 ++++++------ dist/index.mjs | 4 +- src/azure/index.test.ts | 10 +-- src/azure/parity.test.ts | 34 +++++++- src/ci/install-sfw.test.ts | 13 +-- src/ci/install-sfw.ts | 14 ++-- src/ci/process.test.ts | 33 ++++++++ src/ci/process.ts | 13 ++- src/ci/run-install.test.ts | 19 +++-- src/ci/run-install.ts | 15 ++-- src/ci/types.ts | 5 +- src/gitlab/index.test.ts | 12 +++ src/gitlab/install-sfw.test.ts | 12 ++- src/gitlab/run-install.test.ts | 20 +++-- src/gitlab/types.test.ts | 6 +- src/index.test.ts | 15 +++- src/index.ts | 4 +- src/install-sfw-path.test.ts | 144 ++++++++++++++++++++++++++++++++- src/install-sfw.test.ts | 34 +++++--- src/install-sfw.ts | 29 +++---- src/run-install.test.ts | 22 ++--- src/run-install.ts | 19 ++--- 24 files changed, 418 insertions(+), 157 deletions(-) diff --git a/README.md b/README.md index 7034438..f5ed800 100644 --- a/README.md +++ b/README.md @@ -293,7 +293,7 @@ steps: In the action log you will see `Using existing sfw on PATH: …` when this composition is detected, vs. `Installing sfw from …` for the bundled-download path. -Existing `sfw` executables must be in an absolute `PATH` directory. The current working directory and empty or relative `PATH` entries are ignored. On Windows, setup-vp looks for the native `sfw.exe` executable. +Existing `sfw` executables must be in an absolute `PATH` directory. The current working directory, including aliases of that directory, and empty or relative `PATH` entries are ignored. On Windows, setup-vp looks for the native `sfw.exe` executable. Dependency installation uses the selected executable's absolute path, including after a download or cache restore. > [!NOTE] > **macOS / Windows require Vite+ v0.1.23 or newer.** Earlier `vp` releases didn't honor `HTTPS_PROXY` / `SSL_CERT_FILE`, so `sfw vp install` failed the TLS handshake on macOS / Windows (it always worked on Linux). The action's default `version: latest` satisfies this; if you pin an older `vp` and enable `sfw` on macOS / Windows, the install will fail the handshake. On a runner architecture with no published `sfw` binary (e.g. `riscv64`), the action logs a warning and falls back to plain `vp install`. diff --git a/dist/azure/index.mjs b/dist/azure/index.mjs index 3793472..299b4d5 100644 --- a/dist/azure/index.mjs +++ b/dist/azure/index.mjs @@ -1,14 +1,14 @@ -import{createRequire as e}from"node:module";import{accessSync as t,constants as n,createWriteStream as r,existsSync as i,mkdirSync as a,mkdtempSync as o,readFileSync as s,readdirSync as c,realpathSync as l,rmSync as u,statSync as d,writeFileSync as f}from"node:fs";import p,{basename as m,dirname as h,isAbsolute as g,join as _,relative as v,sep as y}from"node:path";import{pathToFileURL as b}from"node:url";import{spawn as x,spawnSync as S}from"node:child_process";import{homedir as C,tmpdir as w}from"node:os";import{chmod as T,mkdir as E,mkdtemp as ee,rename as te,rm as ne,stat as re}from"node:fs/promises";import{setTimeout as ie}from"node:timers/promises";import{randomUUID as ae}from"node:crypto";var __commonJSMin=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),D=/* @__PURE__ */ e(import.meta.url),O=/* @__PURE__ */ __commonJSMin((e=>{let t=Symbol.for(`yaml.alias`),n=Symbol.for(`yaml.document`),r=Symbol.for(`yaml.map`),i=Symbol.for(`yaml.pair`),a=Symbol.for(`yaml.scalar`),o=Symbol.for(`yaml.seq`),s=Symbol.for(`yaml.node.type`),isAlias=e=>!!e&&typeof e==`object`&&e[s]===t,isDocument=e=>!!e&&typeof e==`object`&&e[s]===n,isMap=e=>!!e&&typeof e==`object`&&e[s]===r,isPair=e=>!!e&&typeof e==`object`&&e[s]===i,isScalar=e=>!!e&&typeof e==`object`&&e[s]===a,isSeq=e=>!!e&&typeof e==`object`&&e[s]===o;function isCollection(e){if(e&&typeof e==`object`)switch(e[s]){case r:case o:return!0}return!1}function isNode(e){if(e&&typeof e==`object`)switch(e[s]){case t:case r:case a:case o:return!0}return!1}e.ALIAS=t,e.DOC=n,e.MAP=r,e.NODE_TYPE=s,e.PAIR=i,e.SCALAR=a,e.SEQ=o,e.hasAnchor=e=>(isScalar(e)||isCollection(e))&&!!e.anchor,e.isAlias=isAlias,e.isCollection=isCollection,e.isDocument=isDocument,e.isMap=isMap,e.isNode=isNode,e.isPair=isPair,e.isScalar=isScalar,e.isSeq=isSeq})),k=/* @__PURE__ */ __commonJSMin((e=>{var t=O();let n=Symbol(`break visit`),r=Symbol(`skip children`),i=Symbol(`remove node`);function visit(e,n){let r=initVisitor(n);t.isDocument(e)?visit_(null,e.contents,r,Object.freeze([e]))===i&&(e.contents=null):visit_(null,e,r,Object.freeze([]))}visit.BREAK=n,visit.SKIP=r,visit.REMOVE=i;function visit_(e,r,a,o){let s=callVisitor(e,r,a,o);if(t.isNode(s)||t.isPair(s))return replaceNode(e,o,s),visit_(e,s,a,o);if(typeof s!=`symbol`){if(t.isCollection(r)){o=Object.freeze(o.concat(r));for(let e=0;e{var t=O(),n=k();let r={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},escapeTagName=e=>e.replace(/[!,[\]{}]/g,e=>r[e]);var i=class Directives{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},Directives.defaultYaml,e),this.tags=Object.assign({},Directives.defaultTags,t)}clone(){let e=new Directives(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new Directives(this.yaml,this.tags);switch(this.yaml.version){case`1.1`:this.atNextDocument=!0;break;case`1.2`:this.atNextDocument=!1,this.yaml={explicit:Directives.defaultYaml.explicit,version:`1.2`},this.tags=Object.assign({},Directives.defaultTags)}return e}add(e,t){this.atNextDocument&&=(this.yaml={explicit:Directives.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},Directives.defaultTags),!1);let n=e.trim().split(/[ \t]+/),r=n.shift();switch(r){case`%TAG`:{if(n.length!==2&&(t(0,`%TAG directive should contain exactly two parts`),n.length<2))return!1;let[e,r]=n;return this.tags[e]=r,!0}case`%YAML`:{if(this.yaml.explicit=!0,n.length!==1)return t(0,`%YAML directive should contain exactly one part`),!1;let[e]=n;if(e===`1.1`||e===`1.2`)return this.yaml.version=e,!0;{let n=/^\d+\.\d+$/.test(e);return t(6,`Unsupported YAML version ${e}`,n),!1}}default:return t(0,`Unknown directive ${r}`,!0),!1}}tagName(e,t){if(e===`!`)return`!`;if(e[0]!==`!`)return t(`Not a valid tag: ${e}`),null;if(e[1]===`<`){let n=e.slice(2,-1);return n===`!`||n===`!!`?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==`>`&&t(`Verbatim tags must end with a >`),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return n===`!`?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+escapeTagName(e.substring(n.length));return e[0]===`!`?e:`!<${e}>`}toString(e){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],i=Object.entries(this.tags),a;if(e&&i.length>0&&t.isNode(e.contents)){let r={};n.visit(e.contents,(e,n)=>{t.isNode(n)&&n.tag&&(r[n.tag]=!0)}),a=Object.keys(r)}else a=[];for(let[t,n]of i)(t!==`!!`||n!==`tag:yaml.org,2002:`)&&(!e||a.some(e=>e.startsWith(n)))&&r.push(`%TAG ${t} ${n}`);return r.join(` -`)}};i.defaultYaml={explicit:!1,version:`1.2`},i.defaultTags={"!!":`tag:yaml.org,2002:`},e.Directives=i})),se=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=k();function anchorIsValid(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function anchorNames(e){let t=/* @__PURE__ */ new Set;return n.visit(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function findNewAnchor(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function createNodeAnchors(e,n){let r=[],i=/* @__PURE__ */ new Map,a=null;return{onAnchor:t=>{r.push(t),a??=anchorNames(e);let i=findNewAnchor(n,a);return a.add(i),i},setAnchors:()=>{for(let e of r){let n=i.get(e);if(typeof n==`object`&&n.anchor&&(t.isScalar(n.node)||t.isCollection(n.node)))n.node.anchor=n.anchor;else{let t=/* @__PURE__ */ Error(`Failed to resolve repeated object (this should not happen)`);throw t.source=e,t}}},sourceObjects:i}}e.anchorIsValid=anchorIsValid,e.anchorNames=anchorNames,e.createNodeAnchors=createNodeAnchors,e.findNewAnchor=findNewAnchor})),ce=/* @__PURE__ */ __commonJSMin((e=>{function applyReviver(e,t,n,r){if(r&&typeof r==`object`){if(Array.isArray(r))for(let t=0,n=r.length;t{var t=O();function toJS(e,n,r){if(Array.isArray(e))return e.map((e,t)=>toJS(e,String(t),r));if(e&&typeof e.toJSON==`function`){if(!r||!t.hasAnchor(e))return e.toJSON(n,r);let i={aliasCount:0,count:1,res:void 0};r.anchors.set(e,i),r.onCreate=e=>{i.res=e,delete r.onCreate};let a=e.toJSON(n,r);return r.onCreate&&r.onCreate(a),a}return typeof e==`bigint`&&!r?.keep?Number(e):e}e.toJS=toJS})),le=/* @__PURE__ */ __commonJSMin((e=>{var t=ce(),n=O(),r=A();e.NodeBase=class{constructor(e){Object.defineProperty(this,n.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:i,maxAliasCount:a,onAnchor:o,reviver:s}={}){if(!n.isDocument(e))throw TypeError(`A document argument is required`);let c={anchors:/* @__PURE__ */ new Map,doc:e,keep:!0,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof a==`number`?a:100},l=r.toJS(this,``,c);if(typeof o==`function`)for(let{count:e,res:t}of c.anchors.values())o(t,e);return typeof s==`function`?t.applyReviver(s,{"":l},``,l):l}}})),j=/* @__PURE__ */ __commonJSMin((e=>{var t=se(),n=k(),r=O(),i=le(),a=A(),Alias=class extends i.NodeBase{constructor(e){super(r.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let i;t?.aliasResolveCache?i=t.aliasResolveCache:(i=[],n.visit(e,{Node:(e,t)=>{(r.isAlias(t)||r.hasAnchor(t))&&i.push(t)}}),t&&(t.aliasResolveCache=i));let o;for(let e of i){if(e===this)break;e.anchor===this.source&&(o=e)}if(o&&t){let{anchors:e,doc:n,maxAliasCount:r}=t,i=e.get(o); +import{createRequire as e}from"node:module";import{accessSync as t,constants as n,createWriteStream as r,existsSync as i,mkdirSync as a,mkdtempSync as o,readFileSync as s,readdirSync as c,rmSync as l,statSync as u,writeFileSync as d}from"node:fs";import f,{basename as p,dirname as m,isAbsolute as h,join as g,relative as _,sep as v}from"node:path";import{pathToFileURL as y}from"node:url";import{spawn as b,spawnSync as x}from"node:child_process";import{homedir as S,tmpdir as C}from"node:os";import{chmod as w,mkdir as T,mkdtemp as E,rename as ee,rm as te,stat as ne}from"node:fs/promises";import{setTimeout as re}from"node:timers/promises";import{randomUUID as ie}from"node:crypto";var __commonJSMin=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),D=/* @__PURE__ */ e(import.meta.url),O=/* @__PURE__ */ __commonJSMin((e=>{let t=Symbol.for(`yaml.alias`),n=Symbol.for(`yaml.document`),r=Symbol.for(`yaml.map`),i=Symbol.for(`yaml.pair`),a=Symbol.for(`yaml.scalar`),o=Symbol.for(`yaml.seq`),s=Symbol.for(`yaml.node.type`),isAlias=e=>!!e&&typeof e==`object`&&e[s]===t,isDocument=e=>!!e&&typeof e==`object`&&e[s]===n,isMap=e=>!!e&&typeof e==`object`&&e[s]===r,isPair=e=>!!e&&typeof e==`object`&&e[s]===i,isScalar=e=>!!e&&typeof e==`object`&&e[s]===a,isSeq=e=>!!e&&typeof e==`object`&&e[s]===o;function isCollection(e){if(e&&typeof e==`object`)switch(e[s]){case r:case o:return!0}return!1}function isNode(e){if(e&&typeof e==`object`)switch(e[s]){case t:case r:case a:case o:return!0}return!1}e.ALIAS=t,e.DOC=n,e.MAP=r,e.NODE_TYPE=s,e.PAIR=i,e.SCALAR=a,e.SEQ=o,e.hasAnchor=e=>(isScalar(e)||isCollection(e))&&!!e.anchor,e.isAlias=isAlias,e.isCollection=isCollection,e.isDocument=isDocument,e.isMap=isMap,e.isNode=isNode,e.isPair=isPair,e.isScalar=isScalar,e.isSeq=isSeq})),k=/* @__PURE__ */ __commonJSMin((e=>{var t=O();let n=Symbol(`break visit`),r=Symbol(`skip children`),i=Symbol(`remove node`);function visit(e,n){let r=initVisitor(n);t.isDocument(e)?visit_(null,e.contents,r,Object.freeze([e]))===i&&(e.contents=null):visit_(null,e,r,Object.freeze([]))}visit.BREAK=n,visit.SKIP=r,visit.REMOVE=i;function visit_(e,r,a,o){let s=callVisitor(e,r,a,o);if(t.isNode(s)||t.isPair(s))return replaceNode(e,o,s),visit_(e,s,a,o);if(typeof s!=`symbol`){if(t.isCollection(r)){o=Object.freeze(o.concat(r));for(let e=0;e{var t=O(),n=k();let r={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},escapeTagName=e=>e.replace(/[!,[\]{}]/g,e=>r[e]);var i=class Directives{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},Directives.defaultYaml,e),this.tags=Object.assign({},Directives.defaultTags,t)}clone(){let e=new Directives(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new Directives(this.yaml,this.tags);switch(this.yaml.version){case`1.1`:this.atNextDocument=!0;break;case`1.2`:this.atNextDocument=!1,this.yaml={explicit:Directives.defaultYaml.explicit,version:`1.2`},this.tags=Object.assign({},Directives.defaultTags)}return e}add(e,t){this.atNextDocument&&=(this.yaml={explicit:Directives.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},Directives.defaultTags),!1);let n=e.trim().split(/[ \t]+/),r=n.shift();switch(r){case`%TAG`:{if(n.length!==2&&(t(0,`%TAG directive should contain exactly two parts`),n.length<2))return!1;let[e,r]=n;return this.tags[e]=r,!0}case`%YAML`:{if(this.yaml.explicit=!0,n.length!==1)return t(0,`%YAML directive should contain exactly one part`),!1;let[e]=n;if(e===`1.1`||e===`1.2`)return this.yaml.version=e,!0;{let n=/^\d+\.\d+$/.test(e);return t(6,`Unsupported YAML version ${e}`,n),!1}}default:return t(0,`Unknown directive ${r}`,!0),!1}}tagName(e,t){if(e===`!`)return`!`;if(e[0]!==`!`)return t(`Not a valid tag: ${e}`),null;if(e[1]===`<`){let n=e.slice(2,-1);return n===`!`||n===`!!`?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==`>`&&t(`Verbatim tags must end with a >`),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return n===`!`?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+escapeTagName(e.substring(n.length));return e[0]===`!`?e:`!<${e}>`}toString(e){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],i=Object.entries(this.tags),a;if(e&&i.length>0&&t.isNode(e.contents)){let r={};n.visit(e.contents,(e,n)=>{t.isNode(n)&&n.tag&&(r[n.tag]=!0)}),a=Object.keys(r)}else a=[];for(let[t,n]of i)(t!==`!!`||n!==`tag:yaml.org,2002:`)&&(!e||a.some(e=>e.startsWith(n)))&&r.push(`%TAG ${t} ${n}`);return r.join(` +`)}};i.defaultYaml={explicit:!1,version:`1.2`},i.defaultTags={"!!":`tag:yaml.org,2002:`},e.Directives=i})),oe=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=k();function anchorIsValid(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function anchorNames(e){let t=/* @__PURE__ */ new Set;return n.visit(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function findNewAnchor(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function createNodeAnchors(e,n){let r=[],i=/* @__PURE__ */ new Map,a=null;return{onAnchor:t=>{r.push(t),a??=anchorNames(e);let i=findNewAnchor(n,a);return a.add(i),i},setAnchors:()=>{for(let e of r){let n=i.get(e);if(typeof n==`object`&&n.anchor&&(t.isScalar(n.node)||t.isCollection(n.node)))n.node.anchor=n.anchor;else{let t=/* @__PURE__ */ Error(`Failed to resolve repeated object (this should not happen)`);throw t.source=e,t}}},sourceObjects:i}}e.anchorIsValid=anchorIsValid,e.anchorNames=anchorNames,e.createNodeAnchors=createNodeAnchors,e.findNewAnchor=findNewAnchor})),se=/* @__PURE__ */ __commonJSMin((e=>{function applyReviver(e,t,n,r){if(r&&typeof r==`object`){if(Array.isArray(r))for(let t=0,n=r.length;t{var t=O();function toJS(e,n,r){if(Array.isArray(e))return e.map((e,t)=>toJS(e,String(t),r));if(e&&typeof e.toJSON==`function`){if(!r||!t.hasAnchor(e))return e.toJSON(n,r);let i={aliasCount:0,count:1,res:void 0};r.anchors.set(e,i),r.onCreate=e=>{i.res=e,delete r.onCreate};let a=e.toJSON(n,r);return r.onCreate&&r.onCreate(a),a}return typeof e==`bigint`&&!r?.keep?Number(e):e}e.toJS=toJS})),ce=/* @__PURE__ */ __commonJSMin((e=>{var t=se(),n=O(),r=A();e.NodeBase=class{constructor(e){Object.defineProperty(this,n.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:i,maxAliasCount:a,onAnchor:o,reviver:s}={}){if(!n.isDocument(e))throw TypeError(`A document argument is required`);let c={anchors:/* @__PURE__ */ new Map,doc:e,keep:!0,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof a==`number`?a:100},l=r.toJS(this,``,c);if(typeof o==`function`)for(let{count:e,res:t}of c.anchors.values())o(t,e);return typeof s==`function`?t.applyReviver(s,{"":l},``,l):l}}})),j=/* @__PURE__ */ __commonJSMin((e=>{var t=oe(),n=k(),r=O(),i=ce(),a=A(),Alias=class extends i.NodeBase{constructor(e){super(r.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let i;t?.aliasResolveCache?i=t.aliasResolveCache:(i=[],n.visit(e,{Node:(e,t)=>{(r.isAlias(t)||r.hasAnchor(t))&&i.push(t)}}),t&&(t.aliasResolveCache=i));let o;for(let e of i){if(e===this)break;e.anchor===this.source&&(o=e)}if(o&&t){let{anchors:e,doc:n,maxAliasCount:r}=t,i=e.get(o); /* istanbul ignore if */ -if(i||=(a.toJS(o,null,t),e.get(o)),i?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(r>=0&&(i.count+=1,i.aliasCount===0&&(i.aliasCount=getAliasCount(n,o,e)),i.count*i.aliasCount>r))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`)}return o}toJSON(e,t){if(!t)return{source:this.source};let n=this.resolve(t.doc,t);if(!n){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}return t.anchors.get(n).res}toString(e,n,r){let i=`*${this.source}`;if(e){if(t.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${i} `}return i}};function getAliasCount(e,t,n){if(r.isAlias(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(r.isCollection(t)){let r=0;for(let i of t.items){let t=getAliasCount(e,i,n);t>r&&(r=t)}return r}if(r.isPair(t)){let r=getAliasCount(e,t.key,n),i=getAliasCount(e,t.value,n);return Math.max(r,i)}return 1}e.Alias=Alias})),M=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=le(),r=A();let isScalarValue=e=>!e||typeof e!=`function`&&typeof e!=`object`;var Scalar=class extends n.NodeBase{constructor(e){super(t.SCALAR),this.value=e}toJSON(e,t){return t?.keep?this.value:r.toJS(this.value,e,t)}toString(){return String(this.value)}};Scalar.BLOCK_FOLDED=`BLOCK_FOLDED`,Scalar.BLOCK_LITERAL=`BLOCK_LITERAL`,Scalar.PLAIN=`PLAIN`,Scalar.QUOTE_DOUBLE=`QUOTE_DOUBLE`,Scalar.QUOTE_SINGLE=`QUOTE_SINGLE`,e.Scalar=Scalar,e.isScalarValue=isScalarValue})),N=/* @__PURE__ */ __commonJSMin((e=>{var t=j(),n=O(),r=M();function findTagObject(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function createNode(e,i,a){if(n.isDocument(e)&&(e=e.contents),n.isNode(e))return e;if(n.isPair(e)){let t=a.schema[n.MAP].createNode?.(a.schema,null,a);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:o,onAnchor:s,onTagObj:c,schema:l,sourceObjects:u}=a,d;if(o&&e&&typeof e==`object`){if(d=u.get(e),d)return d.anchor??(d.anchor=s(e)),new t.Alias(d.anchor);d={anchor:null,node:null},u.set(e,d)}i?.startsWith(`!!`)&&(i=`tag:yaml.org,2002:`+i.slice(2));let f=findTagObject(e,i,l.tags);if(!f){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new r.Scalar(e);return d&&(d.node=t),t}f=e instanceof Map?l[n.MAP]:Symbol.iterator in Object(e)?l[n.SEQ]:l[n.MAP]}c&&(c(f),delete a.onTagObj);let p=f?.createNode?f.createNode(a.schema,e,a):typeof f?.nodeClass?.from==`function`?f.nodeClass.from(a.schema,e,a):new r.Scalar(e);return i?p.tag=i:f.default||(p.tag=f.tag),d&&(d.node=p),p}e.createNode=createNode})),P=/* @__PURE__ */ __commonJSMin((e=>{var t=N(),n=O(),r=le();function collectionFromPath(e,n,r){let i=r;for(let e=n.length-1;e>=0;--e){let t=n[e];if(typeof t==`number`&&Number.isInteger(t)&&t>=0){let e=[];e[t]=i,i=e}else i=/* @__PURE__ */ new Map([[t,i]])}return t.createNode(i,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:/* @__PURE__ */ new Map})}let isEmptyPath=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done;e.Collection=class extends r.NodeBase{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>n.isNode(t)||n.isPair(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(isEmptyPath(e))this.add(t);else{let[r,...i]=e,a=this.get(r,!0);if(n.isCollection(a))a.addIn(i,t);else if(a===void 0&&this.schema)this.set(r,collectionFromPath(this.schema,i,t));else throw Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}deleteIn(e){let[t,...r]=e;if(r.length===0)return this.delete(t);let i=this.get(t,!0);if(n.isCollection(i))return i.deleteIn(r);throw Error(`Expected YAML collection at ${t}. Remaining path: ${r}`)}getIn(e,t){let[r,...i]=e,a=this.get(r,!0);return i.length===0?!t&&n.isScalar(a)?a.value:a:n.isCollection(a)?a.getIn(i,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!n.isPair(t))return!1;let r=t.value;return r==null||e&&n.isScalar(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(e){let[t,...r]=e;if(r.length===0)return this.has(t);let i=this.get(t,!0);return n.isCollection(i)?i.hasIn(r):!1}setIn(e,t){let[r,...i]=e;if(i.length===0)this.set(r,t);else{let e=this.get(r,!0);if(n.isCollection(e))e.setIn(i,t);else if(e===void 0&&this.schema)this.set(r,collectionFromPath(this.schema,i,t));else throw Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}},e.collectionFromPath=collectionFromPath,e.isEmptyPath=isEmptyPath})),F=/* @__PURE__ */ __commonJSMin((e=>{let stringifyComment=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function indentComment(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}e.indentComment=indentComment,e.lineComment=(e,t,n)=>e.endsWith(` +if(i||=(a.toJS(o,null,t),e.get(o)),i?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(r>=0&&(i.count+=1,i.aliasCount===0&&(i.aliasCount=getAliasCount(n,o,e)),i.count*i.aliasCount>r))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`)}return o}toJSON(e,t){if(!t)return{source:this.source};let n=this.resolve(t.doc,t);if(!n){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}return t.anchors.get(n).res}toString(e,n,r){let i=`*${this.source}`;if(e){if(t.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${i} `}return i}};function getAliasCount(e,t,n){if(r.isAlias(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(r.isCollection(t)){let r=0;for(let i of t.items){let t=getAliasCount(e,i,n);t>r&&(r=t)}return r}if(r.isPair(t)){let r=getAliasCount(e,t.key,n),i=getAliasCount(e,t.value,n);return Math.max(r,i)}return 1}e.Alias=Alias})),M=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=ce(),r=A();let isScalarValue=e=>!e||typeof e!=`function`&&typeof e!=`object`;var Scalar=class extends n.NodeBase{constructor(e){super(t.SCALAR),this.value=e}toJSON(e,t){return t?.keep?this.value:r.toJS(this.value,e,t)}toString(){return String(this.value)}};Scalar.BLOCK_FOLDED=`BLOCK_FOLDED`,Scalar.BLOCK_LITERAL=`BLOCK_LITERAL`,Scalar.PLAIN=`PLAIN`,Scalar.QUOTE_DOUBLE=`QUOTE_DOUBLE`,Scalar.QUOTE_SINGLE=`QUOTE_SINGLE`,e.Scalar=Scalar,e.isScalarValue=isScalarValue})),N=/* @__PURE__ */ __commonJSMin((e=>{var t=j(),n=O(),r=M();function findTagObject(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function createNode(e,i,a){if(n.isDocument(e)&&(e=e.contents),n.isNode(e))return e;if(n.isPair(e)){let t=a.schema[n.MAP].createNode?.(a.schema,null,a);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:o,onAnchor:s,onTagObj:c,schema:l,sourceObjects:u}=a,d;if(o&&e&&typeof e==`object`){if(d=u.get(e),d)return d.anchor??(d.anchor=s(e)),new t.Alias(d.anchor);d={anchor:null,node:null},u.set(e,d)}i?.startsWith(`!!`)&&(i=`tag:yaml.org,2002:`+i.slice(2));let f=findTagObject(e,i,l.tags);if(!f){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new r.Scalar(e);return d&&(d.node=t),t}f=e instanceof Map?l[n.MAP]:Symbol.iterator in Object(e)?l[n.SEQ]:l[n.MAP]}c&&(c(f),delete a.onTagObj);let p=f?.createNode?f.createNode(a.schema,e,a):typeof f?.nodeClass?.from==`function`?f.nodeClass.from(a.schema,e,a):new r.Scalar(e);return i?p.tag=i:f.default||(p.tag=f.tag),d&&(d.node=p),p}e.createNode=createNode})),le=/* @__PURE__ */ __commonJSMin((e=>{var t=N(),n=O(),r=ce();function collectionFromPath(e,n,r){let i=r;for(let e=n.length-1;e>=0;--e){let t=n[e];if(typeof t==`number`&&Number.isInteger(t)&&t>=0){let e=[];e[t]=i,i=e}else i=/* @__PURE__ */ new Map([[t,i]])}return t.createNode(i,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:/* @__PURE__ */ new Map})}let isEmptyPath=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done;e.Collection=class extends r.NodeBase{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>n.isNode(t)||n.isPair(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(isEmptyPath(e))this.add(t);else{let[r,...i]=e,a=this.get(r,!0);if(n.isCollection(a))a.addIn(i,t);else if(a===void 0&&this.schema)this.set(r,collectionFromPath(this.schema,i,t));else throw Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}deleteIn(e){let[t,...r]=e;if(r.length===0)return this.delete(t);let i=this.get(t,!0);if(n.isCollection(i))return i.deleteIn(r);throw Error(`Expected YAML collection at ${t}. Remaining path: ${r}`)}getIn(e,t){let[r,...i]=e,a=this.get(r,!0);return i.length===0?!t&&n.isScalar(a)?a.value:a:n.isCollection(a)?a.getIn(i,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!n.isPair(t))return!1;let r=t.value;return r==null||e&&n.isScalar(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(e){let[t,...r]=e;if(r.length===0)return this.has(t);let i=this.get(t,!0);return n.isCollection(i)?i.hasIn(r):!1}setIn(e,t){let[r,...i]=e;if(i.length===0)this.set(r,t);else{let e=this.get(r,!0);if(n.isCollection(e))e.setIn(i,t);else if(e===void 0&&this.schema)this.set(r,collectionFromPath(this.schema,i,t));else throw Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}},e.collectionFromPath=collectionFromPath,e.isEmptyPath=isEmptyPath})),P=/* @__PURE__ */ __commonJSMin((e=>{let stringifyComment=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function indentComment(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}e.indentComment=indentComment,e.lineComment=(e,t,n)=>e.endsWith(` `)?indentComment(n,t):n.includes(` `)?` `+indentComment(n,t):(e.endsWith(` `)?``:` `)+n,e.stringifyComment=stringifyComment})),ue=/* @__PURE__ */ __commonJSMin((e=>{let t=`block`,n=`quoted`;function foldFlowLines(e,r,i=`flow`,{indentAtStart:a,lineWidth:o=80,minContentWidth:s=20,onFold:c,onOverflow:l}={}){if(!o||o<0)return e;oo-Math.max(2,s)?d.push(0):p=o-a);let m,h,g=!1,_=-1,v=-1,y=-1;i===t&&(_=consumeMoreIndentedLines(e,_,r.length),_!==-1&&(p=_+u));for(let a;a=e[_+=1];){if(i===n&&a===`\\`){switch(v=_,e[_+1]){case`x`:_+=3;break;case`u`:_+=5;break;case`U`:_+=9;break;default:_+=1}y=_}if(a===` `)i===t&&(_=consumeMoreIndentedLines(e,_,r.length)),p=_+r.length+u,m=void 0;else{if(a===` `&&h&&h!==` `&&h!==` `&&h!==` `){let t=e[_+1];t&&t!==` `&&t!==` `&&t!==` `&&(m=_)}if(_>=p){if(m)d.push(m),p=m+u,m=void 0;else if(i===n){for(;h===` `||h===` `;)h=a,a=e[_+=1],g=!0;let t=_>y+1?_-2:v-1;if(f[t])return e;d.push(t),f[t]=!0,p=t+u,m=void 0}else g=!0}}h=a}if(g&&l&&l(),d.length===0)return e;c&&c();let b=e.slice(0,d[0]);for(let t=0;t{var t=M(),n=ue();let getFoldOptions=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),containsDocumentMarker=e=>/^(%|---|\.\.\.)/m.test(e);function lineLengthOverLimit(e,t,n){if(!t||t<0)return!1;let r=t-n,i=e.length;if(i<=r)return!1;for(let t=0,n=0;t{var t=M(),n=ue();let getFoldOptions=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),containsDocumentMarker=e=>/^(%|---|\.\.\.)/m.test(e);function lineLengthOverLimit(e,t,n){if(!t||t<0)return!1;let r=t-n,i=e.length;if(i<=r)return!1;for(let t=0,n=0;tr)return!0;if(n=t+1,i-n<=r)return!1}return!0}function doubleQuotedString(e,t){let r=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return r;let{implicitKey:i}=t,a=t.options.doubleQuotedMinMultiLineLength,o=t.indent||(containsDocumentMarker(e)?` `:``),s=``,c=0;for(let e=0,t=r[e];t;t=r[++e])if(t===` `&&r[e+1]===`\\`&&r[e+2]===`n`&&(s+=r.slice(c,e)+`\\ `,e+=1,c=e,t=`\\`),t===`\\`)switch(r[e+1]){case`u`:{s+=r.slice(c,e);let t=r.substr(e+2,4);switch(t){case`0000`:s+=`\\0`;break;case`0007`:s+=`\\a`;break;case`000b`:s+=`\\v`;break;case`001b`:s+=`\\e`;break;case`0085`:s+=`\\N`;break;case`00a0`:s+=`\\_`;break;case`2028`:s+=`\\L`;break;case`2029`:s+=`\\P`;break;default:t.substr(0,2)===`00`?s+=`\\x`+t.substr(2):s+=r.substr(e,6)}e+=5,c=e+1}break;case`n`:if(i||r[e+2]===`"`||r.length{r=!0});let c=n.foldFlowLines(`${x}${e}${g}`,f,n.FOLD_BLOCK,s);if(!r)return`>${S}\n${f}${c}`}return a=a.replace(/\n+/g,`$&${f}`),`|${S}\n${f}${x}${a}${g}`}function plainString(e,r,i,a){let{type:o,value:s}=e,{actualString:c,implicitKey:l,indent:u,indentStep:d,inFlow:f}=r;if(l&&s.includes(` `)||f&&/[[\]{},]/.test(s))return quotedString(s,r);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(s))return l||f||!s.includes(` `)?quotedString(s,r):blockString(e,r,i,a);if(!l&&!f&&o!==t.Scalar.PLAIN&&s.includes(` -`))return blockString(e,r,i,a);if(containsDocumentMarker(s)){if(u===``)return r.forceBlockIndent=!0,blockString(e,r,i,a);if(l&&u===d)return quotedString(s,r)}let p=s.replace(/\n+/g,`$&\n${u}`);if(c){let test=e=>e.default&&e.tag!==`tag:yaml.org,2002:str`&&e.test?.test(p),{compat:e,tags:t}=r.doc.schema;if(t.some(test)||e?.some(test))return quotedString(s,r)}return l?p:n.foldFlowLines(p,u,n.FOLD_FLOW,getFoldOptions(r,!1))}function stringifyString(e,n,r,i){let{implicitKey:a,inFlow:o}=n,s=typeof e.value==`string`?e:Object.assign({},e,{value:String(e.value)}),{type:c}=e;c!==t.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(c=t.Scalar.QUOTE_DOUBLE);let _stringify=e=>{switch(e){case t.Scalar.BLOCK_FOLDED:case t.Scalar.BLOCK_LITERAL:return a||o?quotedString(s.value,n):blockString(s,n,r,i);case t.Scalar.QUOTE_DOUBLE:return doubleQuotedString(s.value,n);case t.Scalar.QUOTE_SINGLE:return singleQuotedString(s.value,n);case t.Scalar.PLAIN:return plainString(s,n,r,i);default:return null}},l=_stringify(c);if(l===null){let{defaultKeyType:e,defaultStringType:t}=n.options,r=a&&e||t;if(l=_stringify(r),l===null)throw Error(`Unsupported default string type ${r}`)}return l}e.stringifyString=stringifyString})),L=/* @__PURE__ */ __commonJSMin((e=>{var t=se(),n=O(),r=F(),i=I();function createStringifyContext(e,t){let n=Object.assign({blockQuote:!0,commentString:r.stringifyComment,defaultKeyType:null,defaultStringType:`PLAIN`,directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:`false`,flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:`null`,simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:`true`,verifyAliasOrder:!0},e.schema.toStringOptions,t),i;switch(n.collectionStyle){case`block`:i=!1;break;case`flow`:i=!0;break;default:i=null}return{anchors:/* @__PURE__ */ new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?` `:``,indent:``,indentStep:typeof n.indent==`number`?` `.repeat(n.indent):` `,inFlow:i,options:n}}function getTagObject(e,t){if(t.tag){let n=e.filter(e=>e.tag===t.tag);if(n.length>0)return n.find(e=>e.format===t.format)??n[0]}let r,i;if(n.isScalar(t)){i=t.value;let n=e.filter(e=>e.identify?.(i));if(n.length>1){let e=n.filter(e=>e.test);e.length>0&&(n=e)}r=n.find(e=>e.format===t.format)??n.find(e=>!e.format)}else i=t,r=e.find(e=>e.nodeClass&&i instanceof e.nodeClass);if(!r){let e=i?.constructor?.name??(i===null?`null`:typeof i);throw Error(`Tag not resolved for ${e} value`)}return r}function stringifyProps(e,r,{anchors:i,doc:a}){if(!a.directives)return``;let o=[],s=(n.isScalar(e)||n.isCollection(e))&&e.anchor;s&&t.anchorIsValid(s)&&(i.add(s),o.push(`&${s}`));let c=e.tag??(r.default?null:r.tag);return c&&o.push(a.directives.tagString(c)),o.join(` `)}function stringify(e,t,r,a){if(n.isPair(e))return e.toString(t,r,a);if(n.isAlias(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw TypeError(`Cannot stringify circular structure without alias nodes`);t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=/* @__PURE__ */ new Set([e]),e=e.resolve(t.doc)}let o,s=n.isNode(e)?e:t.doc.createNode(e,{onTagObj:e=>o=e});o??=getTagObject(t.doc.schema.tags,s);let c=stringifyProps(s,o,t);c.length>0&&(t.indentAtStart=(t.indentAtStart??0)+c.length+1);let l=typeof o.stringify==`function`?o.stringify(s,t,r,a):n.isScalar(s)?i.stringifyString(s,t,r,a):s.toString(t,r,a);return c?n.isScalar(s)||l[0]===`{`||l[0]===`[`?`${c} ${l}`:`${c}\n${t.indent}${l}`:l}e.createStringifyContext=createStringifyContext,e.stringify=stringify})),de=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=M(),r=L(),i=F();function stringifyPair({key:e,value:a},o,s,c){let{allNullValues:l,doc:u,indent:d,indentStep:f,options:{commentString:p,indentSeq:m,simpleKeys:h}}=o,g=t.isNode(e)&&e.comment||null;if(h){if(g)throw Error(`With simple keys, key nodes cannot have comments`);if(t.isCollection(e)||!t.isNode(e)&&typeof e==`object`)throw Error(`With simple keys, collection cannot be used as a key value`)}let _=!h&&(!e||g&&a==null&&!o.inFlow||t.isCollection(e)||(t.isScalar(e)?e.type===n.Scalar.BLOCK_FOLDED||e.type===n.Scalar.BLOCK_LITERAL:typeof e==`object`));o=Object.assign({},o,{allNullValues:!1,implicitKey:!_&&(h||!l),indent:d+f});let v=!1,y=!1,b=r.stringify(e,o,()=>v=!0,()=>y=!0);if(!_&&!o.inFlow&&b.length>1024){if(h)throw Error(`With simple keys, single line scalar must not span more than 1024 characters`);_=!0}if(o.inFlow){if(l||a==null)return v&&s&&s(),b===``?`?`:_?`? ${b}`:b}else if(l&&!h||a==null&&_)return b=`? ${b}`,g&&!v?b+=i.lineComment(b,o.indent,p(g)):y&&c&&c(),b;v&&(g=null),_?(g&&(b+=i.lineComment(b,o.indent,p(g))),b=`? ${b}\n${d}:`):(b=`${b}:`,g&&(b+=i.lineComment(b,o.indent,p(g))));let x,S,C;t.isNode(a)?(x=!!a.spaceBefore,S=a.commentBefore,C=a.comment):(x=!1,S=null,C=null,a&&typeof a==`object`&&(a=u.createNode(a))),o.implicitKey=!1,!_&&!g&&t.isScalar(a)&&(o.indentAtStart=b.length+1),y=!1,!m&&f.length>=2&&!o.inFlow&&!_&&t.isSeq(a)&&!a.flow&&!a.tag&&!a.anchor&&(o.indent=o.indent.substring(2));let w=!1,T=r.stringify(a,o,()=>w=!0,()=>y=!0),E=` `;if(g||x||S){if(E=x?` +`))return blockString(e,r,i,a);if(containsDocumentMarker(s)){if(u===``)return r.forceBlockIndent=!0,blockString(e,r,i,a);if(l&&u===d)return quotedString(s,r)}let p=s.replace(/\n+/g,`$&\n${u}`);if(c){let test=e=>e.default&&e.tag!==`tag:yaml.org,2002:str`&&e.test?.test(p),{compat:e,tags:t}=r.doc.schema;if(t.some(test)||e?.some(test))return quotedString(s,r)}return l?p:n.foldFlowLines(p,u,n.FOLD_FLOW,getFoldOptions(r,!1))}function stringifyString(e,n,r,i){let{implicitKey:a,inFlow:o}=n,s=typeof e.value==`string`?e:Object.assign({},e,{value:String(e.value)}),{type:c}=e;c!==t.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(c=t.Scalar.QUOTE_DOUBLE);let _stringify=e=>{switch(e){case t.Scalar.BLOCK_FOLDED:case t.Scalar.BLOCK_LITERAL:return a||o?quotedString(s.value,n):blockString(s,n,r,i);case t.Scalar.QUOTE_DOUBLE:return doubleQuotedString(s.value,n);case t.Scalar.QUOTE_SINGLE:return singleQuotedString(s.value,n);case t.Scalar.PLAIN:return plainString(s,n,r,i);default:return null}},l=_stringify(c);if(l===null){let{defaultKeyType:e,defaultStringType:t}=n.options,r=a&&e||t;if(l=_stringify(r),l===null)throw Error(`Unsupported default string type ${r}`)}return l}e.stringifyString=stringifyString})),I=/* @__PURE__ */ __commonJSMin((e=>{var t=oe(),n=O(),r=P(),i=F();function createStringifyContext(e,t){let n=Object.assign({blockQuote:!0,commentString:r.stringifyComment,defaultKeyType:null,defaultStringType:`PLAIN`,directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:`false`,flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:`null`,simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:`true`,verifyAliasOrder:!0},e.schema.toStringOptions,t),i;switch(n.collectionStyle){case`block`:i=!1;break;case`flow`:i=!0;break;default:i=null}return{anchors:/* @__PURE__ */ new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?` `:``,indent:``,indentStep:typeof n.indent==`number`?` `.repeat(n.indent):` `,inFlow:i,options:n}}function getTagObject(e,t){if(t.tag){let n=e.filter(e=>e.tag===t.tag);if(n.length>0)return n.find(e=>e.format===t.format)??n[0]}let r,i;if(n.isScalar(t)){i=t.value;let n=e.filter(e=>e.identify?.(i));if(n.length>1){let e=n.filter(e=>e.test);e.length>0&&(n=e)}r=n.find(e=>e.format===t.format)??n.find(e=>!e.format)}else i=t,r=e.find(e=>e.nodeClass&&i instanceof e.nodeClass);if(!r){let e=i?.constructor?.name??(i===null?`null`:typeof i);throw Error(`Tag not resolved for ${e} value`)}return r}function stringifyProps(e,r,{anchors:i,doc:a}){if(!a.directives)return``;let o=[],s=(n.isScalar(e)||n.isCollection(e))&&e.anchor;s&&t.anchorIsValid(s)&&(i.add(s),o.push(`&${s}`));let c=e.tag??(r.default?null:r.tag);return c&&o.push(a.directives.tagString(c)),o.join(` `)}function stringify(e,t,r,a){if(n.isPair(e))return e.toString(t,r,a);if(n.isAlias(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw TypeError(`Cannot stringify circular structure without alias nodes`);t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=/* @__PURE__ */ new Set([e]),e=e.resolve(t.doc)}let o,s=n.isNode(e)?e:t.doc.createNode(e,{onTagObj:e=>o=e});o??=getTagObject(t.doc.schema.tags,s);let c=stringifyProps(s,o,t);c.length>0&&(t.indentAtStart=(t.indentAtStart??0)+c.length+1);let l=typeof o.stringify==`function`?o.stringify(s,t,r,a):n.isScalar(s)?i.stringifyString(s,t,r,a):s.toString(t,r,a);return c?n.isScalar(s)||l[0]===`{`||l[0]===`[`?`${c} ${l}`:`${c}\n${t.indent}${l}`:l}e.createStringifyContext=createStringifyContext,e.stringify=stringify})),de=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=M(),r=I(),i=P();function stringifyPair({key:e,value:a},o,s,c){let{allNullValues:l,doc:u,indent:d,indentStep:f,options:{commentString:p,indentSeq:m,simpleKeys:h}}=o,g=t.isNode(e)&&e.comment||null;if(h){if(g)throw Error(`With simple keys, key nodes cannot have comments`);if(t.isCollection(e)||!t.isNode(e)&&typeof e==`object`)throw Error(`With simple keys, collection cannot be used as a key value`)}let _=!h&&(!e||g&&a==null&&!o.inFlow||t.isCollection(e)||(t.isScalar(e)?e.type===n.Scalar.BLOCK_FOLDED||e.type===n.Scalar.BLOCK_LITERAL:typeof e==`object`));o=Object.assign({},o,{allNullValues:!1,implicitKey:!_&&(h||!l),indent:d+f});let v=!1,y=!1,b=r.stringify(e,o,()=>v=!0,()=>y=!0);if(!_&&!o.inFlow&&b.length>1024){if(h)throw Error(`With simple keys, single line scalar must not span more than 1024 characters`);_=!0}if(o.inFlow){if(l||a==null)return v&&s&&s(),b===``?`?`:_?`? ${b}`:b}else if(l&&!h||a==null&&_)return b=`? ${b}`,g&&!v?b+=i.lineComment(b,o.indent,p(g)):y&&c&&c(),b;v&&(g=null),_?(g&&(b+=i.lineComment(b,o.indent,p(g))),b=`? ${b}\n${d}:`):(b=`${b}:`,g&&(b+=i.lineComment(b,o.indent,p(g))));let x,S,C;t.isNode(a)?(x=!!a.spaceBefore,S=a.commentBefore,C=a.comment):(x=!1,S=null,C=null,a&&typeof a==`object`&&(a=u.createNode(a))),o.implicitKey=!1,!_&&!g&&t.isScalar(a)&&(o.indentAtStart=b.length+1),y=!1,!m&&f.length>=2&&!o.inFlow&&!_&&t.isSeq(a)&&!a.flow&&!a.tag&&!a.anchor&&(o.indent=o.indent.substring(2));let w=!1,T=r.stringify(a,o,()=>w=!0,()=>y=!0),E=` `;if(g||x||S){if(E=x?` `:``,S){let e=p(S);E+=`\n${i.indentComment(e,o.indent)}`}T===``&&!o.inFlow?E===` `&&C&&(E=` `):E+=`\n${o.indent}`}else if(!_&&t.isCollection(a)){let e=T[0],t=T.indexOf(` `),n=t!==-1,r=o.inFlow??a.flow??a.items.length===0;if(n||!r){let r=!1;if(n&&(e===`&`||e===`!`)){let n=T.indexOf(` `);e===`&`&&n!==-1&&n{var t=D(`process`);function debug(e,...t){e===`debug`&&console.log(...t)}function warn(e,n){(e===`debug`||e===`warn`)&&(typeof t.emitWarning==`function`?t.emitWarning(n):console.warn(n))}e.debug=debug,e.warn=warn})),pe=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=M();let r={identify:e=>e===`<<`||typeof e==`symbol`&&e.description===`<<`,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new n.Scalar(Symbol(`<<`)),{addToJSMap:addMergeToJSMap}),stringify:()=>`<<`},isMergeKey=(e,i)=>(r.identify(i)||t.isScalar(i)&&(!i.type||i.type===n.Scalar.PLAIN)&&r.identify(i.value))&&e?.doc.schema.tags.some(e=>e.tag===r.tag&&e.default);function addMergeToJSMap(e,n,r){let i=resolveAliasValue(e,r);if(t.isSeq(i))for(let t of i.items)mergeValue(e,n,t);else if(Array.isArray(i))for(let t of i)mergeValue(e,n,t);else mergeValue(e,n,i)}function mergeValue(e,n,r){let i=resolveAliasValue(e,r);if(!t.isMap(i))throw Error(`Merge sources must be maps or map aliases`);let a=i.toJSON(null,e,Map);for(let[e,t]of a)n instanceof Map?n.has(e)||n.set(e,t):n instanceof Set?n.add(e):Object.prototype.hasOwnProperty.call(n,e)||Object.defineProperty(n,e,{value:t,writable:!0,enumerable:!0,configurable:!0});return n}function resolveAliasValue(e,n){return e&&t.isAlias(n)?n.resolve(e.doc,e):n}e.addMergeToJSMap=addMergeToJSMap,e.isMergeKey=isMergeKey,e.merge=r})),me=/* @__PURE__ */ __commonJSMin((e=>{var t=fe(),n=pe(),r=L(),i=O(),a=A();function addPairToJSMap(e,t,{key:r,value:o}){if(i.isNode(r)&&r.addToJSMap)r.addToJSMap(e,t,o);else if(n.isMergeKey(e,r))n.addMergeToJSMap(e,t,o);else{let n=a.toJS(r,``,e);if(t instanceof Map)t.set(n,a.toJS(o,n,e));else if(t instanceof Set)t.add(n);else{let i=stringifyKey(r,n,e),s=a.toJS(o,i,e);i in t?Object.defineProperty(t,i,{value:s,writable:!0,enumerable:!0,configurable:!0}):t[i]=s}}return t}function stringifyKey(e,n,a){if(n===null)return``;if(typeof n!=`object`)return String(n);if(i.isNode(e)&&a?.doc){let n=r.createStringifyContext(a.doc,{});n.anchors=/* @__PURE__ */ new Set;for(let e of a.anchors.keys())n.anchors.add(e.anchor);n.inFlow=!0,n.inStringifyKey=!0;let i=e.toString(n);if(!a.mapKeyWarned){let e=JSON.stringify(i);e.length>40&&(e=e.substring(0,36)+`..."`),t.warn(a.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${e}. Set mapAsMap: true to use object keys.`),a.mapKeyWarned=!0}return i}return JSON.stringify(n)}e.addPairToJSMap=addPairToJSMap})),R=/* @__PURE__ */ __commonJSMin((e=>{var t=N(),n=de(),r=me(),i=O();function createPair(e,n,r){return new a(t.createNode(e,void 0,r),t.createNode(n,void 0,r))}var a=class Pair{constructor(e,t=null){Object.defineProperty(this,i.NODE_TYPE,{value:i.PAIR}),this.key=e,this.value=t}clone(e){let{key:t,value:n}=this;return i.isNode(t)&&(t=t.clone(e)),i.isNode(n)&&(n=n.clone(e)),new Pair(t,n)}toJSON(e,t){let n=t?.mapAsMap?/* @__PURE__ */ new Map:{};return r.addPairToJSMap(t,n,this)}toString(e,t,r){return e?.doc?n.stringifyPair(this,e,t,r):JSON.stringify(this)}};e.Pair=a,e.createPair=createPair})),he=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=L(),r=F();function stringifyCollection(e,t,n){return(t.inFlow??e.flow?stringifyFlowCollection:stringifyBlockCollection)(e,t,n)}function stringifyBlockCollection({comment:e,items:i},a,{blockItemPrefix:o,flowChars:s,itemIndent:c,onChompKeep:l,onComment:u}){let{indent:d,options:{commentString:f}}=a,p=Object.assign({},a,{indent:c,type:null}),m=!1,h=[];for(let e=0;el=null,()=>m=!0);l&&(u+=r.lineComment(u,c,f(l))),m&&l&&(m=!1),h.push(o+u)}let g;if(h.length===0)g=s.start+s.end;else{g=h[0];for(let e=1;e{var t=D(`process`);function debug(e,...t){e===`debug`&&console.log(...t)}function warn(e,n){(e===`debug`||e===`warn`)&&(typeof t.emitWarning==`function`?t.emitWarning(n):console.warn(n))}e.debug=debug,e.warn=warn})),pe=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=M();let r={identify:e=>e===`<<`||typeof e==`symbol`&&e.description===`<<`,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new n.Scalar(Symbol(`<<`)),{addToJSMap:addMergeToJSMap}),stringify:()=>`<<`},isMergeKey=(e,i)=>(r.identify(i)||t.isScalar(i)&&(!i.type||i.type===n.Scalar.PLAIN)&&r.identify(i.value))&&e?.doc.schema.tags.some(e=>e.tag===r.tag&&e.default);function addMergeToJSMap(e,n,r){let i=resolveAliasValue(e,r);if(t.isSeq(i))for(let t of i.items)mergeValue(e,n,t);else if(Array.isArray(i))for(let t of i)mergeValue(e,n,t);else mergeValue(e,n,i)}function mergeValue(e,n,r){let i=resolveAliasValue(e,r);if(!t.isMap(i))throw Error(`Merge sources must be maps or map aliases`);let a=i.toJSON(null,e,Map);for(let[e,t]of a)n instanceof Map?n.has(e)||n.set(e,t):n instanceof Set?n.add(e):Object.prototype.hasOwnProperty.call(n,e)||Object.defineProperty(n,e,{value:t,writable:!0,enumerable:!0,configurable:!0});return n}function resolveAliasValue(e,n){return e&&t.isAlias(n)?n.resolve(e.doc,e):n}e.addMergeToJSMap=addMergeToJSMap,e.isMergeKey=isMergeKey,e.merge=r})),me=/* @__PURE__ */ __commonJSMin((e=>{var t=fe(),n=pe(),r=I(),i=O(),a=A();function addPairToJSMap(e,t,{key:r,value:o}){if(i.isNode(r)&&r.addToJSMap)r.addToJSMap(e,t,o);else if(n.isMergeKey(e,r))n.addMergeToJSMap(e,t,o);else{let n=a.toJS(r,``,e);if(t instanceof Map)t.set(n,a.toJS(o,n,e));else if(t instanceof Set)t.add(n);else{let i=stringifyKey(r,n,e),s=a.toJS(o,i,e);i in t?Object.defineProperty(t,i,{value:s,writable:!0,enumerable:!0,configurable:!0}):t[i]=s}}return t}function stringifyKey(e,n,a){if(n===null)return``;if(typeof n!=`object`)return String(n);if(i.isNode(e)&&a?.doc){let n=r.createStringifyContext(a.doc,{});n.anchors=/* @__PURE__ */ new Set;for(let e of a.anchors.keys())n.anchors.add(e.anchor);n.inFlow=!0,n.inStringifyKey=!0;let i=e.toString(n);if(!a.mapKeyWarned){let e=JSON.stringify(i);e.length>40&&(e=e.substring(0,36)+`..."`),t.warn(a.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${e}. Set mapAsMap: true to use object keys.`),a.mapKeyWarned=!0}return i}return JSON.stringify(n)}e.addPairToJSMap=addPairToJSMap})),L=/* @__PURE__ */ __commonJSMin((e=>{var t=N(),n=de(),r=me(),i=O();function createPair(e,n,r){return new a(t.createNode(e,void 0,r),t.createNode(n,void 0,r))}var a=class Pair{constructor(e,t=null){Object.defineProperty(this,i.NODE_TYPE,{value:i.PAIR}),this.key=e,this.value=t}clone(e){let{key:t,value:n}=this;return i.isNode(t)&&(t=t.clone(e)),i.isNode(n)&&(n=n.clone(e)),new Pair(t,n)}toJSON(e,t){let n=t?.mapAsMap?/* @__PURE__ */ new Map:{};return r.addPairToJSMap(t,n,this)}toString(e,t,r){return e?.doc?n.stringifyPair(this,e,t,r):JSON.stringify(this)}};e.Pair=a,e.createPair=createPair})),he=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=I(),r=P();function stringifyCollection(e,t,n){return(t.inFlow??e.flow?stringifyFlowCollection:stringifyBlockCollection)(e,t,n)}function stringifyBlockCollection({comment:e,items:i},a,{blockItemPrefix:o,flowChars:s,itemIndent:c,onChompKeep:l,onComment:u}){let{indent:d,options:{commentString:f}}=a,p=Object.assign({},a,{indent:c,type:null}),m=!1,h=[];for(let e=0;el=null,()=>m=!0);l&&(u+=r.lineComment(u,c,f(l))),m&&l&&(m=!1),h.push(o+u)}let g;if(h.length===0)g=s.start+s.end;else{g=h[0];for(let e=1;ec=null);f||=m.length>p||l.includes(` `),a0&&(f||=m.reduce((e,t)=>e+t.length+2,2)+(l.length+2)>i.options.lineWidth),f&&(l+=`,`)),c&&(l+=r.lineComment(l,o,u(c))),m.push(l),p=m.length}let{start:h,end:g}=a;if(m.length===0)return h+g;if(!f){let e=m.reduce((e,t)=>e+t.length+2,2);f=i.options.lineWidth>0&&e>i.options.lineWidth}if(f){let e=h;for(let t of m)e+=t?`\n${c}${s}${t}`:` -`;return`${e}\n${s}${g}`}return`${h}${l}${m.join(` `)}${l}${g}`}function addCommentBefore({indent:e,options:{commentString:t}},n,i,a){if(i&&a&&(i=i.replace(/^\n+/,``)),i){let a=r.indentComment(t(i),e);n.push(a.trimStart())}}e.stringifyCollection=stringifyCollection})),z=/* @__PURE__ */ __commonJSMin((e=>{var t=he(),n=me(),r=P(),i=O(),a=R(),o=M();function findPair(e,t){let n=i.isScalar(t)?t.value:t;for(let r of e)if(i.isPair(r)&&(r.key===t||r.key===n||i.isScalar(r.key)&&r.key.value===n))return r}e.YAMLMap=class extends r.Collection{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(i.MAP,e),this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:i}=n,o=new this(e),add=(e,s)=>{if(typeof i==`function`)s=i.call(t,e,s);else if(Array.isArray(i)&&!i.includes(e))return;(s!==void 0||r)&&o.items.push(a.createPair(e,s,n))};if(t instanceof Map)for(let[e,n]of t)add(e,n);else if(t&&typeof t==`object`)for(let e of Object.keys(t))add(e,t[e]);return typeof e.sortMapEntries==`function`&&o.items.sort(e.sortMapEntries),o}add(e,t){let n;n=i.isPair(e)?e:!e||typeof e!=`object`||!(`key`in e)?new a.Pair(e,e?.value):new a.Pair(e.key,e.value);let r=findPair(this.items,n.key),s=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);i.isScalar(r.value)&&o.isScalarValue(n.value)?r.value.value=n.value:r.value=n.value}else if(s){let e=this.items.findIndex(e=>s(n,e)<0);e===-1?this.items.push(n):this.items.splice(e,0,n)}else this.items.push(n)}delete(e){let t=findPair(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=findPair(this.items,e)?.value;return(!t&&i.isScalar(n)?n.value:n)??void 0}has(e){return!!findPair(this.items,e)}set(e,t){this.add(new a.Pair(e,t),!0)}toJSON(e,t,r){let i=r?new r:t?.mapAsMap?/* @__PURE__ */ new Map:{};t?.onCreate&&t.onCreate(i);for(let e of this.items)n.addPairToJSMap(t,i,e);return i}toString(e,n,r){if(!e)return JSON.stringify(this);for(let e of this.items)if(!i.isPair(e))throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),t.stringifyCollection(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:r,onComment:n})}},e.findPair=findPair})),B=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=z();e.map={collection:`map`,default:!0,nodeClass:n.YAMLMap,tag:`tag:yaml.org,2002:map`,resolve(e,n){return t.isMap(e)||n(`Expected a mapping for this tag`),e},createNode:(e,t,r)=>n.YAMLMap.from(e,t,r)}})),V=/* @__PURE__ */ __commonJSMin((e=>{var t=N(),n=he(),r=P(),i=O(),a=M(),o=A(),YAMLSeq=class extends r.Collection{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(i.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=asItemIndex(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=asItemIndex(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&i.isScalar(r)?r.value:r}has(e){let t=asItemIndex(e);return typeof t==`number`&&t=0?t:null}e.YAMLSeq=YAMLSeq})),H=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=V();e.seq={collection:`seq`,default:!0,nodeClass:n.YAMLSeq,tag:`tag:yaml.org,2002:seq`,resolve(e,n){return t.isSeq(e)||n(`Expected a sequence for this tag`),e},createNode:(e,t,r)=>n.YAMLSeq.from(e,t,r)}})),U=/* @__PURE__ */ __commonJSMin((e=>{var t=I();e.string={identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify(e,n,r,i){return n=Object.assign({actualString:!0},n),t.stringifyString(e,n,r,i)}}})),ge=/* @__PURE__ */ __commonJSMin((e=>{var t=M();let n={identify:e=>e==null,createNode:()=>new t.Scalar(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new t.Scalar(null),stringify:({source:e},t)=>typeof e==`string`&&n.test.test(e)?e:t.options.nullStr};e.nullTag=n})),_e=/* @__PURE__ */ __commonJSMin((e=>{var t=M();let n={identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new t.Scalar(e[0]===`t`||e[0]===`T`),stringify({source:e,value:t},r){return e&&n.test.test(e)&&t===(e[0]===`t`||e[0]===`T`)?e:t?r.options.trueStr:r.options.falseStr}};e.boolTag=n})),W=/* @__PURE__ */ __commonJSMin((e=>{function stringifyNumber({format:e,minFractionDigits:t,tag:n,value:r}){if(typeof r==`bigint`)return String(r);let i=typeof r==`number`?r:Number(r);if(!isFinite(i))return isNaN(i)?`.nan`:i<0?`-.inf`:`.inf`;let a=Object.is(r,-0)?`-0`:JSON.stringify(r);if(!e&&t&&(!n||n===`tag:yaml.org,2002:float`)&&/^-?\d/.test(a)&&!a.includes(`e`)){let e=a.indexOf(`.`);e<0&&(e=a.length,a+=`.`);let n=t-(a.length-e-1);for(;n-->0;)a+=`0`}return a}e.stringifyNumber=stringifyNumber})),ve=/* @__PURE__ */ __commonJSMin((e=>{var t=M(),n=W();let r={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:n.stringifyNumber};e.float={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let n=new t.Scalar(parseFloat(e)),r=e.indexOf(`.`);return r!==-1&&e[e.length-1]===`0`&&(n.minFractionDigits=e.length-r-1),n},stringify:n.stringifyNumber},e.floatExp={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():n.stringifyNumber(e)}},e.floatNaN=r})),ye=/* @__PURE__ */ __commonJSMin((e=>{var t=W();let intIdentify=e=>typeof e==`bigint`||Number.isInteger(e),intResolve=(e,t,n,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),n);function intStringify(e,n,r){let{value:i}=e;return intIdentify(i)&&i>=0?r+i.toString(n):t.stringifyNumber(e)}e.int={identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>intResolve(e,0,10,n),stringify:t.stringifyNumber},e.intHex={identify:e=>intIdentify(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>intResolve(e,2,16,n),stringify:e=>intStringify(e,16,`0x`)},e.intOct={identify:e=>intIdentify(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^0o[0-7]+$/,resolve:(e,t,n)=>intResolve(e,2,8,n),stringify:e=>intStringify(e,8,`0o`)}})),be=/* @__PURE__ */ __commonJSMin((e=>{var t=B(),n=ge(),r=H(),i=U(),a=_e(),o=ve(),s=ye();e.schema=[t.map,r.seq,i.string,n.nullTag,a.boolTag,s.intOct,s.int,s.intHex,o.floatNaN,o.floatExp,o.float]})),xe=/* @__PURE__ */ __commonJSMin((e=>{var t=M(),n=B(),r=H();function intIdentify(e){return typeof e==`bigint`||Number.isInteger(e)}let stringifyJSON=({value:e})=>JSON.stringify(e),i=[{identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify:stringifyJSON},{identify:e=>e==null,createNode:()=>new t.Scalar(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^null$/,resolve:()=>null,stringify:stringifyJSON},{identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^true$|^false$/,resolve:e=>e===`true`,stringify:stringifyJSON},{identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>intIdentify(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:stringifyJSON}];e.schema=[n.map,r.seq].concat(i,{default:!0,tag:``,test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}})})),Se=/* @__PURE__ */ __commonJSMin((e=>{var t=D(`buffer`),n=M(),r=I();e.binary={identify:e=>e instanceof Uint8Array,default:!1,tag:`tag:yaml.org,2002:binary`,resolve(e,n){if(typeof t.Buffer==`function`)return t.Buffer.from(e,`base64`);if(typeof atob==`function`){let t=atob(e.replace(/[\n\r]/g,``)),n=new Uint8Array(t.length);for(let e=0;e{var t=O(),n=R(),r=M(),i=V();function resolvePairs(e,i){if(t.isSeq(e))for(let a=0;a1&&i(`Each pair must have its own sequence indicator`);let e=o.items[0]||new n.Pair(new r.Scalar(null));if(o.commentBefore&&(e.key.commentBefore=e.key.commentBefore?`${o.commentBefore}\n${e.key.commentBefore}`:o.commentBefore),o.comment){let t=e.value??e.key;t.comment=t.comment?`${o.comment}\n${t.comment}`:o.comment}o=e}e.items[a]=t.isPair(o)?o:new n.Pair(o)}}else i(`Expected a sequence for this tag`);return e}function createPairs(e,t,r){let{replacer:a}=r,o=new i.YAMLSeq(e);o.tag=`tag:yaml.org,2002:pairs`;let s=0;if(t&&Symbol.iterator in Object(t))for(let e of t){typeof a==`function`&&(e=a.call(t,String(s++),e));let i,c;if(Array.isArray(e)){if(e.length===2)i=e[0],c=e[1];else throw TypeError(`Expected [key, value] tuple: ${e}`)}else if(e&&e instanceof Object){let t=Object.keys(e);if(t.length===1)i=t[0],c=e[i];else throw TypeError(`Expected tuple with one key, not ${t.length} keys`)}else i=e;o.items.push(n.createPair(i,c,r))}return o}let a={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:resolvePairs,createNode:createPairs};e.createPairs=createPairs,e.pairs=a,e.resolvePairs=resolvePairs})),we=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=A(),r=z(),i=V(),a=Ce(),o=class YAMLOMap extends i.YAMLSeq{constructor(){super(),this.add=r.YAMLMap.prototype.add.bind(this),this.delete=r.YAMLMap.prototype.delete.bind(this),this.get=r.YAMLMap.prototype.get.bind(this),this.has=r.YAMLMap.prototype.has.bind(this),this.set=r.YAMLMap.prototype.set.bind(this),this.tag=YAMLOMap.tag}toJSON(e,r){if(!r)return super.toJSON(e);let i=/* @__PURE__ */ new Map;r?.onCreate&&r.onCreate(i);for(let e of this.items){let a,o;if(t.isPair(e)?(a=n.toJS(e.key,``,r),o=n.toJS(e.value,a,r)):a=n.toJS(e,``,r),i.has(a))throw Error(`Ordered maps must not include duplicate keys`);i.set(a,o)}return i}static from(e,t,n){let r=a.createPairs(e,t,n),i=new this;return i.items=r.items,i}};o.tag=`tag:yaml.org,2002:omap`;let s={collection:`seq`,identify:e=>e instanceof Map,nodeClass:o,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,n){let r=a.resolvePairs(e,n),i=[];for(let{key:e}of r.items)t.isScalar(e)&&(i.includes(e.value)?n(`Ordered maps must not include duplicate keys: ${e.value}`):i.push(e.value));return Object.assign(new o,r)},createNode:(e,t,n)=>o.from(e,t,n)};e.YAMLOMap=o,e.omap=s})),Te=/* @__PURE__ */ __commonJSMin((e=>{var t=M();function boolStringify({value:e,source:t},i){return t&&(e?n:r).test.test(t)?t:e?i.options.trueStr:i.options.falseStr}let n={identify:e=>e===!0,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new t.Scalar(!0),stringify:boolStringify},r={identify:e=>e===!1,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new t.Scalar(!1),stringify:boolStringify};e.falseTag=r,e.trueTag=n})),Ee=/* @__PURE__ */ __commonJSMin((e=>{var t=M(),n=W();let r={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:n.stringifyNumber};e.float={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let n=new t.Scalar(parseFloat(e.replace(/_/g,``))),r=e.indexOf(`.`);if(r!==-1){let t=e.substring(r+1).replace(/_/g,``);t[t.length-1]===`0`&&(n.minFractionDigits=t.length)}return n},stringify:n.stringifyNumber},e.floatExp={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,``)),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():n.stringifyNumber(e)}},e.floatNaN=r})),De=/* @__PURE__ */ __commonJSMin((e=>{var t=W();let intIdentify=e=>typeof e==`bigint`||Number.isInteger(e);function intResolve(e,t,n,{intAsBigInt:r}){let i=e[0];if((i===`-`||i===`+`)&&(t+=1),e=e.substring(t).replace(/_/g,``),r){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`}let t=BigInt(e);return i===`-`?BigInt(-1)*t:t}let a=parseInt(e,n);return i===`-`?-1*a:a}function intStringify(e,n,r){let{value:i}=e;if(intIdentify(i)){let e=i.toString(n);return i<0?`-`+r+e.substr(1):r+e}return t.stringifyNumber(e)}let n={identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>intResolve(e,2,2,n),stringify:e=>intStringify(e,2,`0b`)},r={identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>intResolve(e,1,8,n),stringify:e=>intStringify(e,8,`0`)},i={identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>intResolve(e,0,10,n),stringify:t.stringifyNumber},a={identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>intResolve(e,2,16,n),stringify:e=>intStringify(e,16,`0x`)};e.int=i,e.intBin=n,e.intHex=a,e.intOct=r})),Oe=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=R(),r=z(),i=class YAMLSet extends r.YAMLMap{constructor(e){super(e),this.tag=YAMLSet.tag}add(e){let i;i=t.isPair(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new n.Pair(e.key,null):new n.Pair(e,null),r.findPair(this.items,i.key)||this.items.push(i)}get(e,n){let i=r.findPair(this.items,e);return!n&&t.isPair(i)?t.isScalar(i.key)?i.key.value:i.key:i}set(e,t){if(typeof t!=`boolean`)throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let i=r.findPair(this.items,e);i&&!t?this.items.splice(this.items.indexOf(i),1):!i&&t&&this.items.push(new n.Pair(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw Error(`Set items must all have null values`)}static from(e,t,r){let{replacer:i}=r,a=new this(e);if(t&&Symbol.iterator in Object(t))for(let e of t)typeof i==`function`&&(e=i.call(t,e,e)),a.items.push(n.createPair(e,null,r));return a}};i.tag=`tag:yaml.org,2002:set`;let a={collection:`map`,identify:e=>e instanceof Set,nodeClass:i,default:!1,tag:`tag:yaml.org,2002:set`,createNode:(e,t,n)=>i.from(e,t,n),resolve(e,n){if(t.isMap(e)){if(e.hasAllNullValues(!0))return Object.assign(new i,e);n(`Set items must all have null values`)}else n(`Expected a mapping for this tag`);return e}};e.YAMLSet=i,e.set=a})),ke=/* @__PURE__ */ __commonJSMin((e=>{var t=W();function parseSexagesimal(e,t){let n=e[0],r=n===`-`||n===`+`?e.substring(1):e,num=e=>t?BigInt(e):Number(e),i=r.replace(/_/g,``).split(`:`).reduce((e,t)=>e*num(60)+num(t),num(0));return n===`-`?num(-1)*i:i}function stringifySexagesimal(e){let{value:n}=e,num=e=>e;if(typeof n==`bigint`)num=e=>BigInt(e);else if(isNaN(n)||!isFinite(n))return t.stringifyNumber(e);let r=``;n<0&&(r=`-`,n*=num(-1));let i=num(60),a=[n%i];return n<60?a.unshift(0):(n=(n-a[0])/i,a.unshift(n%i),n>=60&&(n=(n-a[0])/i,a.unshift(n))),r+a.map(e=>String(e).padStart(2,`0`)).join(`:`).replace(/000000\d*$/,``)}let n={identify:e=>typeof e==`bigint`||Number.isInteger(e),default:!0,tag:`tag:yaml.org,2002:int`,format:`TIME`,test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>parseSexagesimal(e,n),stringify:stringifySexagesimal},r={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`TIME`,test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>parseSexagesimal(e,!1),stringify:stringifySexagesimal},i={identify:e=>e instanceof Date,default:!0,tag:`tag:yaml.org,2002:timestamp`,test:RegExp(`^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$`),resolve(e){let t=e.match(i.test);if(!t)throw Error(`!!timestamp expects a date, starting with yyyy-mm-dd`);let[,n,r,a,o,s,c]=t.map(Number),l=t[7]?Number((t[7]+`00`).substr(1,3)):0,u=Date.UTC(n,r-1,a,o||0,s||0,c||0,l),d=t[8];if(d&&d!==`Z`){let e=parseSexagesimal(d,!1);Math.abs(e)<30&&(e*=60),u-=6e4*e}return new Date(u)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,``)??``};e.floatTime=r,e.intTime=n,e.timestamp=i})),Ae=/* @__PURE__ */ __commonJSMin((e=>{var t=B(),n=ge(),r=H(),i=U(),a=Se(),o=Te(),s=Ee(),c=De(),l=pe(),u=we(),d=Ce(),f=Oe(),p=ke();e.schema=[t.map,r.seq,i.string,n.nullTag,o.trueTag,o.falseTag,c.intBin,c.intOct,c.int,c.intHex,s.floatNaN,s.floatExp,s.float,a.binary,l.merge,u.omap,d.pairs,f.set,p.intTime,p.floatTime,p.timestamp]})),je=/* @__PURE__ */ __commonJSMin((e=>{var t=B(),n=ge(),r=H(),i=U(),a=_e(),o=ve(),s=ye(),c=be(),l=xe(),u=Se(),d=pe(),f=we(),p=Ce(),m=Ae(),h=Oe(),g=ke();let _=/* @__PURE__ */ new Map([[`core`,c.schema],[`failsafe`,[t.map,r.seq,i.string]],[`json`,l.schema],[`yaml11`,m.schema],[`yaml-1.1`,m.schema]]),v={binary:u.binary,bool:a.boolTag,float:o.float,floatExp:o.floatExp,floatNaN:o.floatNaN,floatTime:g.floatTime,int:s.int,intHex:s.intHex,intOct:s.intOct,intTime:g.intTime,map:t.map,merge:d.merge,null:n.nullTag,omap:f.omap,pairs:p.pairs,seq:r.seq,set:h.set,timestamp:g.timestamp},y={"tag:yaml.org,2002:binary":u.binary,"tag:yaml.org,2002:merge":d.merge,"tag:yaml.org,2002:omap":f.omap,"tag:yaml.org,2002:pairs":p.pairs,"tag:yaml.org,2002:set":h.set,"tag:yaml.org,2002:timestamp":g.timestamp};function getTags(e,t,n){let r=_.get(t);if(r&&!e)return n&&!r.includes(d.merge)?r.concat(d.merge):r.slice();let i=r;if(!i){if(Array.isArray(e))i=[];else{let e=Array.from(_.keys()).filter(e=>e!==`yaml11`).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown schema "${t}"; use one of ${e} or define customTags array`)}}if(Array.isArray(e))for(let t of e)i=i.concat(t);else typeof e==`function`&&(i=e(i.slice()));return n&&(i=i.concat(d.merge)),i.reduce((e,t)=>{let n=typeof t==`string`?v[t]:t;if(!n){let e=JSON.stringify(t),n=Object.keys(v).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown custom tag ${e}; use one of ${n}`)}return e.includes(n)||e.push(n),e},[])}e.coreKnownTags=y,e.getTags=getTags})),Me=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=B(),r=H(),i=U(),a=je();let sortMapEntriesByKey=(e,t)=>e.keyt.key);e.Schema=class Schema{constructor({compat:e,customTags:o,merge:s,resolveKnownTags:c,schema:l,sortMapEntries:u,toStringDefaults:d}){this.compat=Array.isArray(e)?a.getTags(e,`compat`):e?a.getTags(null,e):null,this.name=typeof l==`string`&&l||`core`,this.knownTags=c?a.coreKnownTags:{},this.tags=a.getTags(o,this.name,s),this.toStringOptions=d??null,Object.defineProperty(this,t.MAP,{value:n.map}),Object.defineProperty(this,t.SCALAR,{value:i.string}),Object.defineProperty(this,t.SEQ,{value:r.seq}),this.sortMapEntries=typeof u==`function`?u:u===!0?sortMapEntriesByKey:null}clone(){let e=Object.create(Schema.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}}})),Ne=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=L(),r=F();function stringifyDocument(e,i){let a=[],o=i.directives===!0;if(i.directives!==!1&&e.directives){let t=e.directives.toString(e);t?(a.push(t),o=!0):e.directives.docStart&&(o=!0)}o&&a.push(`---`);let s=n.createStringifyContext(e,i),{commentString:c}=s.options;if(e.commentBefore){a.length!==1&&a.unshift(``);let t=c(e.commentBefore);a.unshift(r.indentComment(t,``))}let l=!1,u=null;if(e.contents){if(t.isNode(e.contents)){if(e.contents.spaceBefore&&o&&a.push(``),e.contents.commentBefore){let t=c(e.contents.commentBefore);a.push(r.indentComment(t,``))}s.forceBlockIndent=!!e.comment,u=e.contents.comment}let i=u?void 0:()=>l=!0,d=n.stringify(e.contents,s,()=>u=null,i);u&&(d+=r.lineComment(d,``,c(u))),(d[0]===`|`||d[0]===`>`)&&a[a.length-1]===`---`?a[a.length-1]=`--- ${d}`:a.push(d)}else a.push(n.stringify(e.contents,s));if(e.directives?.docEnd){if(e.comment){let t=c(e.comment);t.includes(` +`;return`${e}\n${s}${g}`}return`${h}${l}${m.join(` `)}${l}${g}`}function addCommentBefore({indent:e,options:{commentString:t}},n,i,a){if(i&&a&&(i=i.replace(/^\n+/,``)),i){let a=r.indentComment(t(i),e);n.push(a.trimStart())}}e.stringifyCollection=stringifyCollection})),R=/* @__PURE__ */ __commonJSMin((e=>{var t=he(),n=me(),r=le(),i=O(),a=L(),o=M();function findPair(e,t){let n=i.isScalar(t)?t.value:t;for(let r of e)if(i.isPair(r)&&(r.key===t||r.key===n||i.isScalar(r.key)&&r.key.value===n))return r}e.YAMLMap=class extends r.Collection{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(i.MAP,e),this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:i}=n,o=new this(e),add=(e,s)=>{if(typeof i==`function`)s=i.call(t,e,s);else if(Array.isArray(i)&&!i.includes(e))return;(s!==void 0||r)&&o.items.push(a.createPair(e,s,n))};if(t instanceof Map)for(let[e,n]of t)add(e,n);else if(t&&typeof t==`object`)for(let e of Object.keys(t))add(e,t[e]);return typeof e.sortMapEntries==`function`&&o.items.sort(e.sortMapEntries),o}add(e,t){let n;n=i.isPair(e)?e:!e||typeof e!=`object`||!(`key`in e)?new a.Pair(e,e?.value):new a.Pair(e.key,e.value);let r=findPair(this.items,n.key),s=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);i.isScalar(r.value)&&o.isScalarValue(n.value)?r.value.value=n.value:r.value=n.value}else if(s){let e=this.items.findIndex(e=>s(n,e)<0);e===-1?this.items.push(n):this.items.splice(e,0,n)}else this.items.push(n)}delete(e){let t=findPair(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=findPair(this.items,e)?.value;return(!t&&i.isScalar(n)?n.value:n)??void 0}has(e){return!!findPair(this.items,e)}set(e,t){this.add(new a.Pair(e,t),!0)}toJSON(e,t,r){let i=r?new r:t?.mapAsMap?/* @__PURE__ */ new Map:{};t?.onCreate&&t.onCreate(i);for(let e of this.items)n.addPairToJSMap(t,i,e);return i}toString(e,n,r){if(!e)return JSON.stringify(this);for(let e of this.items)if(!i.isPair(e))throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),t.stringifyCollection(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:r,onComment:n})}},e.findPair=findPair})),z=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=R();e.map={collection:`map`,default:!0,nodeClass:n.YAMLMap,tag:`tag:yaml.org,2002:map`,resolve(e,n){return t.isMap(e)||n(`Expected a mapping for this tag`),e},createNode:(e,t,r)=>n.YAMLMap.from(e,t,r)}})),B=/* @__PURE__ */ __commonJSMin((e=>{var t=N(),n=he(),r=le(),i=O(),a=M(),o=A(),YAMLSeq=class extends r.Collection{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(i.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=asItemIndex(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=asItemIndex(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&i.isScalar(r)?r.value:r}has(e){let t=asItemIndex(e);return typeof t==`number`&&t=0?t:null}e.YAMLSeq=YAMLSeq})),V=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=B();e.seq={collection:`seq`,default:!0,nodeClass:n.YAMLSeq,tag:`tag:yaml.org,2002:seq`,resolve(e,n){return t.isSeq(e)||n(`Expected a sequence for this tag`),e},createNode:(e,t,r)=>n.YAMLSeq.from(e,t,r)}})),H=/* @__PURE__ */ __commonJSMin((e=>{var t=F();e.string={identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify(e,n,r,i){return n=Object.assign({actualString:!0},n),t.stringifyString(e,n,r,i)}}})),ge=/* @__PURE__ */ __commonJSMin((e=>{var t=M();let n={identify:e=>e==null,createNode:()=>new t.Scalar(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new t.Scalar(null),stringify:({source:e},t)=>typeof e==`string`&&n.test.test(e)?e:t.options.nullStr};e.nullTag=n})),_e=/* @__PURE__ */ __commonJSMin((e=>{var t=M();let n={identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new t.Scalar(e[0]===`t`||e[0]===`T`),stringify({source:e,value:t},r){return e&&n.test.test(e)&&t===(e[0]===`t`||e[0]===`T`)?e:t?r.options.trueStr:r.options.falseStr}};e.boolTag=n})),U=/* @__PURE__ */ __commonJSMin((e=>{function stringifyNumber({format:e,minFractionDigits:t,tag:n,value:r}){if(typeof r==`bigint`)return String(r);let i=typeof r==`number`?r:Number(r);if(!isFinite(i))return isNaN(i)?`.nan`:i<0?`-.inf`:`.inf`;let a=Object.is(r,-0)?`-0`:JSON.stringify(r);if(!e&&t&&(!n||n===`tag:yaml.org,2002:float`)&&/^-?\d/.test(a)&&!a.includes(`e`)){let e=a.indexOf(`.`);e<0&&(e=a.length,a+=`.`);let n=t-(a.length-e-1);for(;n-->0;)a+=`0`}return a}e.stringifyNumber=stringifyNumber})),ve=/* @__PURE__ */ __commonJSMin((e=>{var t=M(),n=U();let r={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:n.stringifyNumber};e.float={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let n=new t.Scalar(parseFloat(e)),r=e.indexOf(`.`);return r!==-1&&e[e.length-1]===`0`&&(n.minFractionDigits=e.length-r-1),n},stringify:n.stringifyNumber},e.floatExp={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():n.stringifyNumber(e)}},e.floatNaN=r})),ye=/* @__PURE__ */ __commonJSMin((e=>{var t=U();let intIdentify=e=>typeof e==`bigint`||Number.isInteger(e),intResolve=(e,t,n,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),n);function intStringify(e,n,r){let{value:i}=e;return intIdentify(i)&&i>=0?r+i.toString(n):t.stringifyNumber(e)}e.int={identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>intResolve(e,0,10,n),stringify:t.stringifyNumber},e.intHex={identify:e=>intIdentify(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>intResolve(e,2,16,n),stringify:e=>intStringify(e,16,`0x`)},e.intOct={identify:e=>intIdentify(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^0o[0-7]+$/,resolve:(e,t,n)=>intResolve(e,2,8,n),stringify:e=>intStringify(e,8,`0o`)}})),be=/* @__PURE__ */ __commonJSMin((e=>{var t=z(),n=ge(),r=V(),i=H(),a=_e(),o=ve(),s=ye();e.schema=[t.map,r.seq,i.string,n.nullTag,a.boolTag,s.intOct,s.int,s.intHex,o.floatNaN,o.floatExp,o.float]})),xe=/* @__PURE__ */ __commonJSMin((e=>{var t=M(),n=z(),r=V();function intIdentify(e){return typeof e==`bigint`||Number.isInteger(e)}let stringifyJSON=({value:e})=>JSON.stringify(e),i=[{identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify:stringifyJSON},{identify:e=>e==null,createNode:()=>new t.Scalar(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^null$/,resolve:()=>null,stringify:stringifyJSON},{identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^true$|^false$/,resolve:e=>e===`true`,stringify:stringifyJSON},{identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>intIdentify(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:stringifyJSON}];e.schema=[n.map,r.seq].concat(i,{default:!0,tag:``,test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}})})),Se=/* @__PURE__ */ __commonJSMin((e=>{var t=D(`buffer`),n=M(),r=F();e.binary={identify:e=>e instanceof Uint8Array,default:!1,tag:`tag:yaml.org,2002:binary`,resolve(e,n){if(typeof t.Buffer==`function`)return t.Buffer.from(e,`base64`);if(typeof atob==`function`){let t=atob(e.replace(/[\n\r]/g,``)),n=new Uint8Array(t.length);for(let e=0;e{var t=O(),n=L(),r=M(),i=B();function resolvePairs(e,i){if(t.isSeq(e))for(let a=0;a1&&i(`Each pair must have its own sequence indicator`);let e=o.items[0]||new n.Pair(new r.Scalar(null));if(o.commentBefore&&(e.key.commentBefore=e.key.commentBefore?`${o.commentBefore}\n${e.key.commentBefore}`:o.commentBefore),o.comment){let t=e.value??e.key;t.comment=t.comment?`${o.comment}\n${t.comment}`:o.comment}o=e}e.items[a]=t.isPair(o)?o:new n.Pair(o)}}else i(`Expected a sequence for this tag`);return e}function createPairs(e,t,r){let{replacer:a}=r,o=new i.YAMLSeq(e);o.tag=`tag:yaml.org,2002:pairs`;let s=0;if(t&&Symbol.iterator in Object(t))for(let e of t){typeof a==`function`&&(e=a.call(t,String(s++),e));let i,c;if(Array.isArray(e)){if(e.length===2)i=e[0],c=e[1];else throw TypeError(`Expected [key, value] tuple: ${e}`)}else if(e&&e instanceof Object){let t=Object.keys(e);if(t.length===1)i=t[0],c=e[i];else throw TypeError(`Expected tuple with one key, not ${t.length} keys`)}else i=e;o.items.push(n.createPair(i,c,r))}return o}let a={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:resolvePairs,createNode:createPairs};e.createPairs=createPairs,e.pairs=a,e.resolvePairs=resolvePairs})),we=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=A(),r=R(),i=B(),a=Ce(),o=class YAMLOMap extends i.YAMLSeq{constructor(){super(),this.add=r.YAMLMap.prototype.add.bind(this),this.delete=r.YAMLMap.prototype.delete.bind(this),this.get=r.YAMLMap.prototype.get.bind(this),this.has=r.YAMLMap.prototype.has.bind(this),this.set=r.YAMLMap.prototype.set.bind(this),this.tag=YAMLOMap.tag}toJSON(e,r){if(!r)return super.toJSON(e);let i=/* @__PURE__ */ new Map;r?.onCreate&&r.onCreate(i);for(let e of this.items){let a,o;if(t.isPair(e)?(a=n.toJS(e.key,``,r),o=n.toJS(e.value,a,r)):a=n.toJS(e,``,r),i.has(a))throw Error(`Ordered maps must not include duplicate keys`);i.set(a,o)}return i}static from(e,t,n){let r=a.createPairs(e,t,n),i=new this;return i.items=r.items,i}};o.tag=`tag:yaml.org,2002:omap`;let s={collection:`seq`,identify:e=>e instanceof Map,nodeClass:o,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,n){let r=a.resolvePairs(e,n),i=[];for(let{key:e}of r.items)t.isScalar(e)&&(i.includes(e.value)?n(`Ordered maps must not include duplicate keys: ${e.value}`):i.push(e.value));return Object.assign(new o,r)},createNode:(e,t,n)=>o.from(e,t,n)};e.YAMLOMap=o,e.omap=s})),Te=/* @__PURE__ */ __commonJSMin((e=>{var t=M();function boolStringify({value:e,source:t},i){return t&&(e?n:r).test.test(t)?t:e?i.options.trueStr:i.options.falseStr}let n={identify:e=>e===!0,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new t.Scalar(!0),stringify:boolStringify},r={identify:e=>e===!1,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new t.Scalar(!1),stringify:boolStringify};e.falseTag=r,e.trueTag=n})),Ee=/* @__PURE__ */ __commonJSMin((e=>{var t=M(),n=U();let r={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:n.stringifyNumber};e.float={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let n=new t.Scalar(parseFloat(e.replace(/_/g,``))),r=e.indexOf(`.`);if(r!==-1){let t=e.substring(r+1).replace(/_/g,``);t[t.length-1]===`0`&&(n.minFractionDigits=t.length)}return n},stringify:n.stringifyNumber},e.floatExp={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,``)),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():n.stringifyNumber(e)}},e.floatNaN=r})),De=/* @__PURE__ */ __commonJSMin((e=>{var t=U();let intIdentify=e=>typeof e==`bigint`||Number.isInteger(e);function intResolve(e,t,n,{intAsBigInt:r}){let i=e[0];if((i===`-`||i===`+`)&&(t+=1),e=e.substring(t).replace(/_/g,``),r){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`}let t=BigInt(e);return i===`-`?BigInt(-1)*t:t}let a=parseInt(e,n);return i===`-`?-1*a:a}function intStringify(e,n,r){let{value:i}=e;if(intIdentify(i)){let e=i.toString(n);return i<0?`-`+r+e.substr(1):r+e}return t.stringifyNumber(e)}let n={identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>intResolve(e,2,2,n),stringify:e=>intStringify(e,2,`0b`)},r={identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>intResolve(e,1,8,n),stringify:e=>intStringify(e,8,`0`)},i={identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>intResolve(e,0,10,n),stringify:t.stringifyNumber},a={identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>intResolve(e,2,16,n),stringify:e=>intStringify(e,16,`0x`)};e.int=i,e.intBin=n,e.intHex=a,e.intOct=r})),Oe=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=L(),r=R(),i=class YAMLSet extends r.YAMLMap{constructor(e){super(e),this.tag=YAMLSet.tag}add(e){let i;i=t.isPair(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new n.Pair(e.key,null):new n.Pair(e,null),r.findPair(this.items,i.key)||this.items.push(i)}get(e,n){let i=r.findPair(this.items,e);return!n&&t.isPair(i)?t.isScalar(i.key)?i.key.value:i.key:i}set(e,t){if(typeof t!=`boolean`)throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let i=r.findPair(this.items,e);i&&!t?this.items.splice(this.items.indexOf(i),1):!i&&t&&this.items.push(new n.Pair(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw Error(`Set items must all have null values`)}static from(e,t,r){let{replacer:i}=r,a=new this(e);if(t&&Symbol.iterator in Object(t))for(let e of t)typeof i==`function`&&(e=i.call(t,e,e)),a.items.push(n.createPair(e,null,r));return a}};i.tag=`tag:yaml.org,2002:set`;let a={collection:`map`,identify:e=>e instanceof Set,nodeClass:i,default:!1,tag:`tag:yaml.org,2002:set`,createNode:(e,t,n)=>i.from(e,t,n),resolve(e,n){if(t.isMap(e)){if(e.hasAllNullValues(!0))return Object.assign(new i,e);n(`Set items must all have null values`)}else n(`Expected a mapping for this tag`);return e}};e.YAMLSet=i,e.set=a})),ke=/* @__PURE__ */ __commonJSMin((e=>{var t=U();function parseSexagesimal(e,t){let n=e[0],r=n===`-`||n===`+`?e.substring(1):e,num=e=>t?BigInt(e):Number(e),i=r.replace(/_/g,``).split(`:`).reduce((e,t)=>e*num(60)+num(t),num(0));return n===`-`?num(-1)*i:i}function stringifySexagesimal(e){let{value:n}=e,num=e=>e;if(typeof n==`bigint`)num=e=>BigInt(e);else if(isNaN(n)||!isFinite(n))return t.stringifyNumber(e);let r=``;n<0&&(r=`-`,n*=num(-1));let i=num(60),a=[n%i];return n<60?a.unshift(0):(n=(n-a[0])/i,a.unshift(n%i),n>=60&&(n=(n-a[0])/i,a.unshift(n))),r+a.map(e=>String(e).padStart(2,`0`)).join(`:`).replace(/000000\d*$/,``)}let n={identify:e=>typeof e==`bigint`||Number.isInteger(e),default:!0,tag:`tag:yaml.org,2002:int`,format:`TIME`,test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>parseSexagesimal(e,n),stringify:stringifySexagesimal},r={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`TIME`,test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>parseSexagesimal(e,!1),stringify:stringifySexagesimal},i={identify:e=>e instanceof Date,default:!0,tag:`tag:yaml.org,2002:timestamp`,test:RegExp(`^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$`),resolve(e){let t=e.match(i.test);if(!t)throw Error(`!!timestamp expects a date, starting with yyyy-mm-dd`);let[,n,r,a,o,s,c]=t.map(Number),l=t[7]?Number((t[7]+`00`).substr(1,3)):0,u=Date.UTC(n,r-1,a,o||0,s||0,c||0,l),d=t[8];if(d&&d!==`Z`){let e=parseSexagesimal(d,!1);Math.abs(e)<30&&(e*=60),u-=6e4*e}return new Date(u)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,``)??``};e.floatTime=r,e.intTime=n,e.timestamp=i})),Ae=/* @__PURE__ */ __commonJSMin((e=>{var t=z(),n=ge(),r=V(),i=H(),a=Se(),o=Te(),s=Ee(),c=De(),l=pe(),u=we(),d=Ce(),f=Oe(),p=ke();e.schema=[t.map,r.seq,i.string,n.nullTag,o.trueTag,o.falseTag,c.intBin,c.intOct,c.int,c.intHex,s.floatNaN,s.floatExp,s.float,a.binary,l.merge,u.omap,d.pairs,f.set,p.intTime,p.floatTime,p.timestamp]})),je=/* @__PURE__ */ __commonJSMin((e=>{var t=z(),n=ge(),r=V(),i=H(),a=_e(),o=ve(),s=ye(),c=be(),l=xe(),u=Se(),d=pe(),f=we(),p=Ce(),m=Ae(),h=Oe(),g=ke();let _=/* @__PURE__ */ new Map([[`core`,c.schema],[`failsafe`,[t.map,r.seq,i.string]],[`json`,l.schema],[`yaml11`,m.schema],[`yaml-1.1`,m.schema]]),v={binary:u.binary,bool:a.boolTag,float:o.float,floatExp:o.floatExp,floatNaN:o.floatNaN,floatTime:g.floatTime,int:s.int,intHex:s.intHex,intOct:s.intOct,intTime:g.intTime,map:t.map,merge:d.merge,null:n.nullTag,omap:f.omap,pairs:p.pairs,seq:r.seq,set:h.set,timestamp:g.timestamp},y={"tag:yaml.org,2002:binary":u.binary,"tag:yaml.org,2002:merge":d.merge,"tag:yaml.org,2002:omap":f.omap,"tag:yaml.org,2002:pairs":p.pairs,"tag:yaml.org,2002:set":h.set,"tag:yaml.org,2002:timestamp":g.timestamp};function getTags(e,t,n){let r=_.get(t);if(r&&!e)return n&&!r.includes(d.merge)?r.concat(d.merge):r.slice();let i=r;if(!i){if(Array.isArray(e))i=[];else{let e=Array.from(_.keys()).filter(e=>e!==`yaml11`).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown schema "${t}"; use one of ${e} or define customTags array`)}}if(Array.isArray(e))for(let t of e)i=i.concat(t);else typeof e==`function`&&(i=e(i.slice()));return n&&(i=i.concat(d.merge)),i.reduce((e,t)=>{let n=typeof t==`string`?v[t]:t;if(!n){let e=JSON.stringify(t),n=Object.keys(v).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown custom tag ${e}; use one of ${n}`)}return e.includes(n)||e.push(n),e},[])}e.coreKnownTags=y,e.getTags=getTags})),Me=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=z(),r=V(),i=H(),a=je();let sortMapEntriesByKey=(e,t)=>e.keyt.key);e.Schema=class Schema{constructor({compat:e,customTags:o,merge:s,resolveKnownTags:c,schema:l,sortMapEntries:u,toStringDefaults:d}){this.compat=Array.isArray(e)?a.getTags(e,`compat`):e?a.getTags(null,e):null,this.name=typeof l==`string`&&l||`core`,this.knownTags=c?a.coreKnownTags:{},this.tags=a.getTags(o,this.name,s),this.toStringOptions=d??null,Object.defineProperty(this,t.MAP,{value:n.map}),Object.defineProperty(this,t.SCALAR,{value:i.string}),Object.defineProperty(this,t.SEQ,{value:r.seq}),this.sortMapEntries=typeof u==`function`?u:u===!0?sortMapEntriesByKey:null}clone(){let e=Object.create(Schema.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}}})),Ne=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=I(),r=P();function stringifyDocument(e,i){let a=[],o=i.directives===!0;if(i.directives!==!1&&e.directives){let t=e.directives.toString(e);t?(a.push(t),o=!0):e.directives.docStart&&(o=!0)}o&&a.push(`---`);let s=n.createStringifyContext(e,i),{commentString:c}=s.options;if(e.commentBefore){a.length!==1&&a.unshift(``);let t=c(e.commentBefore);a.unshift(r.indentComment(t,``))}let l=!1,u=null;if(e.contents){if(t.isNode(e.contents)){if(e.contents.spaceBefore&&o&&a.push(``),e.contents.commentBefore){let t=c(e.contents.commentBefore);a.push(r.indentComment(t,``))}s.forceBlockIndent=!!e.comment,u=e.contents.comment}let i=u?void 0:()=>l=!0,d=n.stringify(e.contents,s,()=>u=null,i);u&&(d+=r.lineComment(d,``,c(u))),(d[0]===`|`||d[0]===`>`)&&a[a.length-1]===`---`?a[a.length-1]=`--- ${d}`:a.push(d)}else a.push(n.stringify(e.contents,s));if(e.directives?.docEnd){if(e.comment){let t=c(e.comment);t.includes(` `)?(a.push(`...`),a.push(r.indentComment(t,``))):a.push(`... ${t}`)}else a.push(`...`)}else{let t=e.comment;t&&l&&(t=t.replace(/^\n+/,``)),t&&((!l||u)&&a[a.length-1]!==``&&a.push(``),a.push(r.indentComment(c(t),``)))}return a.join(` `)+` -`}e.stringifyDocument=stringifyDocument})),G=/* @__PURE__ */ __commonJSMin((e=>{var t=j(),n=P(),r=O(),i=R(),a=A(),o=Me(),s=Ne(),c=se(),l=ce(),u=N(),d=oe(),f=class Document{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,r.NODE_TYPE,{value:r.DOC});let i=null;typeof t==`function`||Array.isArray(t)?i=t:n===void 0&&t&&(n=t,t=void 0);let a=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:`warn`,prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:`1.2`},n);this.options=a;let{version:o}=a;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new d.Directives({version:o}),this.setSchema(o,n),this.contents=e===void 0?null:this.createNode(e,i,n)}clone(){let e=Object.create(Document.prototype,{[r.NODE_TYPE]:{value:r.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=r.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){assertCollection(this.contents)&&this.contents.add(e)}addIn(e,t){assertCollection(this.contents)&&this.contents.addIn(e,t)}createAlias(e,n){if(!e.anchor){let t=c.anchorNames(this);e.anchor=!n||t.has(n)?c.findNewAnchor(n||`a`,t):n}return new t.Alias(e.anchor)}createNode(e,t,n){let i;if(typeof t==`function`)e=t.call({"":e},``,e),i=t;else if(Array.isArray(t)){let e=t.filter(e=>typeof e==`number`||e instanceof String||e instanceof Number).map(String);e.length>0&&(t=t.concat(e)),i=t}else n===void 0&&t&&(n=t,t=void 0);let{aliasDuplicateObjects:a,anchorPrefix:o,flow:s,keepUndefined:l,onTagObj:d,tag:f}=n??{},{onAnchor:p,setAnchors:m,sourceObjects:h}=c.createNodeAnchors(this,o||`a`),g={aliasDuplicateObjects:a??!0,keepUndefined:l??!1,onAnchor:p,onTagObj:d,replacer:i,schema:this.schema,sourceObjects:h},_=u.createNode(e,f,g);return s&&r.isCollection(_)&&(_.flow=!0),m(),_}createPair(e,t,n={}){let r=this.createNode(e,null,n),a=this.createNode(t,null,n);return new i.Pair(r,a)}delete(e){return assertCollection(this.contents)?this.contents.delete(e):!1}deleteIn(e){return n.isEmptyPath(e)?this.contents!=null&&(this.contents=null,!0):assertCollection(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return r.isCollection(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return n.isEmptyPath(e)?!t&&r.isScalar(this.contents)?this.contents.value:this.contents:r.isCollection(this.contents)?this.contents.getIn(e,t):void 0}has(e){return r.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return n.isEmptyPath(e)?this.contents!==void 0:r.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=n.collectionFromPath(this.schema,[e],t):assertCollection(this.contents)&&this.contents.set(e,t)}setIn(e,t){n.isEmptyPath(e)?this.contents=t:this.contents==null?this.contents=n.collectionFromPath(this.schema,Array.from(e),t):assertCollection(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e==`number`&&(e=String(e));let n;switch(e){case`1.1`:this.directives?this.directives.yaml.version=`1.1`:this.directives=new d.Directives({version:`1.1`}),n={resolveKnownTags:!1,schema:`yaml-1.1`};break;case`1.2`:case`next`:this.directives?this.directives.yaml.version=e:this.directives=new d.Directives({version:e}),n={resolveKnownTags:!0,schema:`core`};break;case null:this.directives&&delete this.directives,n=null;break;default:{let t=JSON.stringify(e);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${t}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(n)this.schema=new o.Schema(Object.assign(n,t));else throw Error(`With a null YAML version, the { schema: Schema } option is required`)}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:r,onAnchor:i,reviver:o}={}){let s={anchors:/* @__PURE__ */ new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r==`number`?r:100},c=a.toJS(this.contents,t??``,s);if(typeof i==`function`)for(let{count:e,res:t}of s.anchors.values())i(t,e);return typeof o==`function`?l.applyReviver(o,{"":c},``,c):c}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw Error(`Document with errors cannot be stringified`);if(`indent`in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw Error(`"indent" option must be a positive integer, not ${t}`)}return s.stringifyDocument(this,e)}};function assertCollection(e){if(r.isCollection(e))return!0;throw Error(`Expected a YAML collection as document contents`)}e.Document=f})),K=/* @__PURE__ */ __commonJSMin((e=>{var YAMLError=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},YAMLParseError=class extends YAMLError{constructor(e,t,n){super(`YAMLParseError`,e,t,n)}},YAMLWarning=class extends YAMLError{constructor(e,t,n){super(`YAMLWarning`,e,t,n)}};e.YAMLError=YAMLError,e.YAMLParseError=YAMLParseError,e.YAMLWarning=YAMLWarning,e.prettifyError=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(e=>t.linePos(e));let{line:r,col:i}=n.linePos[0];n.message+=` at line ${r}, column ${i}`;let a=i-1,o=e.substring(t.lineStarts[r-1],t.lineStarts[r]).replace(/[\n\r]+$/,``);if(a>=60&&o.length>80){let e=Math.min(a-39,o.length-79);o=`…`+o.substring(e),a-=e-1}if(o.length>80&&(o=o.substring(0,79)+`…`),r>1&&/^ *$/.test(o.substring(0,a))){let n=e.substring(t.lineStarts[r-2],t.lineStarts[r-1]);n.length>80&&(n=n.substring(0,79)+`… -`),o=n+o}if(/[^ ]/.test(o)){let e=1,t=n.linePos[1];t?.line===r&&t.col>i&&(e=Math.max(1,Math.min(t.col-i,80-a)));let s=` `.repeat(a)+`^`.repeat(e);n.message+=`:\n\n${o}\n${s}\n`}}})),q=/* @__PURE__ */ __commonJSMin((e=>{function resolveProps(e,{flow:t,indicator:n,next:r,offset:i,onError:a,parentIndent:o,startOnNewline:s}){let c=!1,l=s,u=s,d=``,f=``,p=!1,m=!1,h=null,g=null,_=null,v=null,y=null,b=null,x=null;for(let i of e)switch(m&&=(i.type!==`space`&&i.type!==`newline`&&i.type!==`comma`&&a(i.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),!1),h&&=(l&&i.type!==`comment`&&i.type!==`newline`&&a(h,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),null),i.type){case`space`:!t&&(n!==`doc-start`||r?.type!==`flow-collection`)&&i.source.includes(` `)&&(h=i),u=!0;break;case`comment`:{u||a(i,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let e=i.source.substring(1)||` `;d?d+=f+e:d=e,f=``,l=!1;break}case`newline`:l?d?d+=i.source:(!b||n!==`seq-item-ind`)&&(c=!0):f+=i.source,l=!0,p=!0,(g||_)&&(v=i),u=!0;break;case`anchor`:g&&a(i,`MULTIPLE_ANCHORS`,`A node can have at most one anchor`),i.source.endsWith(`:`)&&a(i.offset+i.source.length-1,`BAD_ALIAS`,`Anchor ending in : is ambiguous`,!0),g=i,x??=i.offset,l=!1,u=!1,m=!0;break;case`tag`:_&&a(i,`MULTIPLE_TAGS`,`A node can have at most one tag`),_=i,x??=i.offset,l=!1,u=!1,m=!0;break;case n:(g||_)&&a(i,`BAD_PROP_ORDER`,`Anchors and tags must be after the ${i.source} indicator`),b&&a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.source} in ${t??`collection`}`),b=i,l=n===`seq-item-ind`||n===`explicit-key-ind`,u=!1;break;case`comma`:if(t){y&&a(i,`UNEXPECTED_TOKEN`,`Unexpected , in ${t}`),y=i,l=!1,u=!1;break}default:a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.type} token`),l=!1,u=!1}let S=e[e.length-1],C=S?S.offset+S.source.length:i;return m&&r&&r.type!==`space`&&r.type!==`newline`&&r.type!==`comma`&&(r.type!==`scalar`||r.source!==``)&&a(r.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),h&&(l&&h.indent<=o||r?.type===`block-map`||r?.type===`block-seq`)&&a(h,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),{comma:y,found:b,spaceBefore:c,comment:d,hasNewline:p,anchor:g,tag:_,newlineAfterProp:v,end:C,start:x??C}}e.resolveProps=resolveProps})),Pe=/* @__PURE__ */ __commonJSMin((e=>{function containsNewline(e){if(!e)return null;switch(e.type){case`alias`:case`scalar`:case`double-quoted-scalar`:case`single-quoted-scalar`:if(e.source.includes(` -`))return!0;if(e.end){for(let t of e.end)if(t.type===`newline`)return!0}return!1;case`flow-collection`:for(let t of e.items){for(let e of t.start)if(e.type===`newline`)return!0;if(t.sep){for(let e of t.sep)if(e.type===`newline`)return!0}if(containsNewline(t.key)||containsNewline(t.value))return!0}return!1;default:return!0}}e.containsNewline=containsNewline})),Fe=/* @__PURE__ */ __commonJSMin((e=>{var t=Pe();function flowIndentCheck(e,n,r){if(n?.type===`flow-collection`){let i=n.end[0];i.indent===e&&(i.source===`]`||i.source===`}`)&&t.containsNewline(n)&&r(i,`BAD_INDENT`,`Flow end indicator should be more indented than parent`,!0)}}e.flowIndentCheck=flowIndentCheck})),Ie=/* @__PURE__ */ __commonJSMin((e=>{var t=O();function mapIncludes(e,n,r){let{uniqueKeys:i}=e.options;if(i===!1)return!1;let a=typeof i==`function`?i:(e,n)=>e===n||t.isScalar(e)&&t.isScalar(n)&&e.value===n.value;return n.some(e=>a(e.key,r))}e.mapIncludes=mapIncludes})),Le=/* @__PURE__ */ __commonJSMin((e=>{var t=R(),n=z(),r=q(),i=Pe(),a=Fe(),o=Ie();let s=`All mapping items must start at the same column`;function resolveBlockMap({composeNode:e,composeEmptyNode:c},l,u,d,f){let p=new((f?.nodeClass)??n.YAMLMap)(l.schema);l.atRoot&&=!1;let m=u.offset,h=null;for(let n of u.items){let{start:f,key:g,sep:_,value:v}=n,y=r.resolveProps(f,{indicator:`explicit-key-ind`,next:g??_?.[0],offset:m,onError:d,parentIndent:u.indent,startOnNewline:!0}),b=!y.found;if(b){if(g&&(g.type===`block-seq`?d(m,`BLOCK_AS_IMPLICIT_KEY`,`A block sequence may not be used as an implicit map key`):`indent`in g&&g.indent!==u.indent&&d(m,`BAD_INDENT`,s)),!y.anchor&&!y.tag&&!_){h=y.end,y.comment&&(p.comment?p.comment+=` +`}e.stringifyDocument=stringifyDocument})),W=/* @__PURE__ */ __commonJSMin((e=>{var t=j(),n=le(),r=O(),i=L(),a=A(),o=Me(),s=Ne(),c=oe(),l=se(),u=N(),d=ae(),f=class Document{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,r.NODE_TYPE,{value:r.DOC});let i=null;typeof t==`function`||Array.isArray(t)?i=t:n===void 0&&t&&(n=t,t=void 0);let a=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:`warn`,prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:`1.2`},n);this.options=a;let{version:o}=a;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new d.Directives({version:o}),this.setSchema(o,n),this.contents=e===void 0?null:this.createNode(e,i,n)}clone(){let e=Object.create(Document.prototype,{[r.NODE_TYPE]:{value:r.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=r.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){assertCollection(this.contents)&&this.contents.add(e)}addIn(e,t){assertCollection(this.contents)&&this.contents.addIn(e,t)}createAlias(e,n){if(!e.anchor){let t=c.anchorNames(this);e.anchor=!n||t.has(n)?c.findNewAnchor(n||`a`,t):n}return new t.Alias(e.anchor)}createNode(e,t,n){let i;if(typeof t==`function`)e=t.call({"":e},``,e),i=t;else if(Array.isArray(t)){let e=t.filter(e=>typeof e==`number`||e instanceof String||e instanceof Number).map(String);e.length>0&&(t=t.concat(e)),i=t}else n===void 0&&t&&(n=t,t=void 0);let{aliasDuplicateObjects:a,anchorPrefix:o,flow:s,keepUndefined:l,onTagObj:d,tag:f}=n??{},{onAnchor:p,setAnchors:m,sourceObjects:h}=c.createNodeAnchors(this,o||`a`),g={aliasDuplicateObjects:a??!0,keepUndefined:l??!1,onAnchor:p,onTagObj:d,replacer:i,schema:this.schema,sourceObjects:h},_=u.createNode(e,f,g);return s&&r.isCollection(_)&&(_.flow=!0),m(),_}createPair(e,t,n={}){let r=this.createNode(e,null,n),a=this.createNode(t,null,n);return new i.Pair(r,a)}delete(e){return assertCollection(this.contents)?this.contents.delete(e):!1}deleteIn(e){return n.isEmptyPath(e)?this.contents!=null&&(this.contents=null,!0):assertCollection(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return r.isCollection(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return n.isEmptyPath(e)?!t&&r.isScalar(this.contents)?this.contents.value:this.contents:r.isCollection(this.contents)?this.contents.getIn(e,t):void 0}has(e){return r.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return n.isEmptyPath(e)?this.contents!==void 0:r.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=n.collectionFromPath(this.schema,[e],t):assertCollection(this.contents)&&this.contents.set(e,t)}setIn(e,t){n.isEmptyPath(e)?this.contents=t:this.contents==null?this.contents=n.collectionFromPath(this.schema,Array.from(e),t):assertCollection(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e==`number`&&(e=String(e));let n;switch(e){case`1.1`:this.directives?this.directives.yaml.version=`1.1`:this.directives=new d.Directives({version:`1.1`}),n={resolveKnownTags:!1,schema:`yaml-1.1`};break;case`1.2`:case`next`:this.directives?this.directives.yaml.version=e:this.directives=new d.Directives({version:e}),n={resolveKnownTags:!0,schema:`core`};break;case null:this.directives&&delete this.directives,n=null;break;default:{let t=JSON.stringify(e);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${t}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(n)this.schema=new o.Schema(Object.assign(n,t));else throw Error(`With a null YAML version, the { schema: Schema } option is required`)}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:r,onAnchor:i,reviver:o}={}){let s={anchors:/* @__PURE__ */ new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r==`number`?r:100},c=a.toJS(this.contents,t??``,s);if(typeof i==`function`)for(let{count:e,res:t}of s.anchors.values())i(t,e);return typeof o==`function`?l.applyReviver(o,{"":c},``,c):c}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw Error(`Document with errors cannot be stringified`);if(`indent`in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw Error(`"indent" option must be a positive integer, not ${t}`)}return s.stringifyDocument(this,e)}};function assertCollection(e){if(r.isCollection(e))return!0;throw Error(`Expected a YAML collection as document contents`)}e.Document=f})),G=/* @__PURE__ */ __commonJSMin((e=>{var YAMLError=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},YAMLParseError=class extends YAMLError{constructor(e,t,n){super(`YAMLParseError`,e,t,n)}},YAMLWarning=class extends YAMLError{constructor(e,t,n){super(`YAMLWarning`,e,t,n)}};e.YAMLError=YAMLError,e.YAMLParseError=YAMLParseError,e.YAMLWarning=YAMLWarning,e.prettifyError=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(e=>t.linePos(e));let{line:r,col:i}=n.linePos[0];n.message+=` at line ${r}, column ${i}`;let a=i-1,o=e.substring(t.lineStarts[r-1],t.lineStarts[r]).replace(/[\n\r]+$/,``);if(a>=60&&o.length>80){let e=Math.min(a-39,o.length-79);o=`…`+o.substring(e),a-=e-1}if(o.length>80&&(o=o.substring(0,79)+`…`),r>1&&/^ *$/.test(o.substring(0,a))){let n=e.substring(t.lineStarts[r-2],t.lineStarts[r-1]);n.length>80&&(n=n.substring(0,79)+`… +`),o=n+o}if(/[^ ]/.test(o)){let e=1,t=n.linePos[1];t?.line===r&&t.col>i&&(e=Math.max(1,Math.min(t.col-i,80-a)));let s=` `.repeat(a)+`^`.repeat(e);n.message+=`:\n\n${o}\n${s}\n`}}})),K=/* @__PURE__ */ __commonJSMin((e=>{function resolveProps(e,{flow:t,indicator:n,next:r,offset:i,onError:a,parentIndent:o,startOnNewline:s}){let c=!1,l=s,u=s,d=``,f=``,p=!1,m=!1,h=null,g=null,_=null,v=null,y=null,b=null,x=null;for(let i of e)switch(m&&=(i.type!==`space`&&i.type!==`newline`&&i.type!==`comma`&&a(i.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),!1),h&&=(l&&i.type!==`comment`&&i.type!==`newline`&&a(h,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),null),i.type){case`space`:!t&&(n!==`doc-start`||r?.type!==`flow-collection`)&&i.source.includes(` `)&&(h=i),u=!0;break;case`comment`:{u||a(i,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let e=i.source.substring(1)||` `;d?d+=f+e:d=e,f=``,l=!1;break}case`newline`:l?d?d+=i.source:(!b||n!==`seq-item-ind`)&&(c=!0):f+=i.source,l=!0,p=!0,(g||_)&&(v=i),u=!0;break;case`anchor`:g&&a(i,`MULTIPLE_ANCHORS`,`A node can have at most one anchor`),i.source.endsWith(`:`)&&a(i.offset+i.source.length-1,`BAD_ALIAS`,`Anchor ending in : is ambiguous`,!0),g=i,x??=i.offset,l=!1,u=!1,m=!0;break;case`tag`:_&&a(i,`MULTIPLE_TAGS`,`A node can have at most one tag`),_=i,x??=i.offset,l=!1,u=!1,m=!0;break;case n:(g||_)&&a(i,`BAD_PROP_ORDER`,`Anchors and tags must be after the ${i.source} indicator`),b&&a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.source} in ${t??`collection`}`),b=i,l=n===`seq-item-ind`||n===`explicit-key-ind`,u=!1;break;case`comma`:if(t){y&&a(i,`UNEXPECTED_TOKEN`,`Unexpected , in ${t}`),y=i,l=!1,u=!1;break}default:a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.type} token`),l=!1,u=!1}let S=e[e.length-1],C=S?S.offset+S.source.length:i;return m&&r&&r.type!==`space`&&r.type!==`newline`&&r.type!==`comma`&&(r.type!==`scalar`||r.source!==``)&&a(r.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),h&&(l&&h.indent<=o||r?.type===`block-map`||r?.type===`block-seq`)&&a(h,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),{comma:y,found:b,spaceBefore:c,comment:d,hasNewline:p,anchor:g,tag:_,newlineAfterProp:v,end:C,start:x??C}}e.resolveProps=resolveProps})),Pe=/* @__PURE__ */ __commonJSMin((e=>{function containsNewline(e){if(!e)return null;switch(e.type){case`alias`:case`scalar`:case`double-quoted-scalar`:case`single-quoted-scalar`:if(e.source.includes(` +`))return!0;if(e.end){for(let t of e.end)if(t.type===`newline`)return!0}return!1;case`flow-collection`:for(let t of e.items){for(let e of t.start)if(e.type===`newline`)return!0;if(t.sep){for(let e of t.sep)if(e.type===`newline`)return!0}if(containsNewline(t.key)||containsNewline(t.value))return!0}return!1;default:return!0}}e.containsNewline=containsNewline})),Fe=/* @__PURE__ */ __commonJSMin((e=>{var t=Pe();function flowIndentCheck(e,n,r){if(n?.type===`flow-collection`){let i=n.end[0];i.indent===e&&(i.source===`]`||i.source===`}`)&&t.containsNewline(n)&&r(i,`BAD_INDENT`,`Flow end indicator should be more indented than parent`,!0)}}e.flowIndentCheck=flowIndentCheck})),Ie=/* @__PURE__ */ __commonJSMin((e=>{var t=O();function mapIncludes(e,n,r){let{uniqueKeys:i}=e.options;if(i===!1)return!1;let a=typeof i==`function`?i:(e,n)=>e===n||t.isScalar(e)&&t.isScalar(n)&&e.value===n.value;return n.some(e=>a(e.key,r))}e.mapIncludes=mapIncludes})),Le=/* @__PURE__ */ __commonJSMin((e=>{var t=L(),n=R(),r=K(),i=Pe(),a=Fe(),o=Ie();let s=`All mapping items must start at the same column`;function resolveBlockMap({composeNode:e,composeEmptyNode:c},l,u,d,f){let p=new((f?.nodeClass)??n.YAMLMap)(l.schema);l.atRoot&&=!1;let m=u.offset,h=null;for(let n of u.items){let{start:f,key:g,sep:_,value:v}=n,y=r.resolveProps(f,{indicator:`explicit-key-ind`,next:g??_?.[0],offset:m,onError:d,parentIndent:u.indent,startOnNewline:!0}),b=!y.found;if(b){if(g&&(g.type===`block-seq`?d(m,`BLOCK_AS_IMPLICIT_KEY`,`A block sequence may not be used as an implicit map key`):`indent`in g&&g.indent!==u.indent&&d(m,`BAD_INDENT`,s)),!y.anchor&&!y.tag&&!_){h=y.end,y.comment&&(p.comment?p.comment+=` `+y.comment:p.comment=y.comment);continue}(y.newlineAfterProp||i.containsNewline(g))&&d(g??f[f.length-1],`MULTILINE_IMPLICIT_KEY`,`Implicit keys need to be on a single line`)}else y.found?.indent!==u.indent&&d(m,`BAD_INDENT`,s);l.atKey=!0;let x=y.end,S=g?e(l,g,y,d):c(l,x,f,null,y,d);l.schema.compat&&a.flowIndentCheck(u.indent,g,d),l.atKey=!1,o.mapIncludes(l,p.items,S)&&d(x,`DUPLICATE_KEY`,`Map keys must be unique`);let C=r.resolveProps(_??[],{indicator:`map-value-ind`,next:v,offset:S.range[2],onError:d,parentIndent:u.indent,startOnNewline:!g||g.type===`block-scalar`});if(m=C.end,C.found){b&&(v?.type===`block-map`&&!C.hasNewline&&d(m,`BLOCK_AS_IMPLICIT_KEY`,`Nested mappings are not allowed in compact mappings`),l.options.strict&&y.start{var t=V(),n=q(),r=Fe();function resolveBlockSeq({composeNode:e,composeEmptyNode:i},a,o,s,c){let l=new((c?.nodeClass)??t.YAMLSeq)(a.schema);a.atRoot&&=!1,a.atKey&&=!1;let u=o.offset,d=null;for(let{start:t,value:c}of o.items){let f=n.resolveProps(t,{indicator:`seq-item-ind`,next:c,offset:u,onError:s,parentIndent:o.indent,startOnNewline:!0});if(!f.found){if(f.anchor||f.tag||c)c?.type===`block-seq`?s(f.end,`BAD_INDENT`,`All sequence items must start at the same column`):s(u,`MISSING_CHAR`,`Sequence item without - indicator`);else{d=f.end,f.comment&&(l.comment=f.comment);continue}}let p=c?e(a,c,f,s):i(a,f.end,t,null,f,s);a.schema.compat&&r.flowIndentCheck(o.indent,c,s),u=p.range[2],l.items.push(p)}return l.range=[o.offset,u,d??u],l}e.resolveBlockSeq=resolveBlockSeq})),J=/* @__PURE__ */ __commonJSMin((e=>{function resolveEnd(e,t,n,r){let i=``;if(e){let a=!1,o=``;for(let s of e){let{source:e,type:c}=s;switch(c){case`space`:a=!0;break;case`comment`:{n&&!a&&r(s,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let t=e.substring(1)||` `;i?i+=o+t:i=t,o=``;break}case`newline`:i&&(o+=e),a=!0;break;default:r(s,`UNEXPECTED_TOKEN`,`Unexpected ${c} at node end`)}t+=e.length}}return{comment:i,offset:t}}e.resolveEnd=resolveEnd})),ze=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=R(),r=z(),i=V(),a=J(),o=q(),s=Pe(),c=Ie();let l=`Block collections are not allowed within flow collections`,isBlock=e=>e&&(e.type===`block-map`||e.type===`block-seq`);function resolveFlowCollection({composeNode:e,composeEmptyNode:u},d,f,p,m){let h=f.start.source===`{`,g=h?`flow map`:`flow sequence`,_=new((m?.nodeClass)??(h?r.YAMLMap:i.YAMLSeq))(d.schema);_.flow=!0;let v=d.atRoot;v&&(d.atRoot=!1),d.atKey&&=!1;let y=f.offset+f.start.source.length;for(let i=0;i{var t=B(),n=K(),r=Fe();function resolveBlockSeq({composeNode:e,composeEmptyNode:i},a,o,s,c){let l=new((c?.nodeClass)??t.YAMLSeq)(a.schema);a.atRoot&&=!1,a.atKey&&=!1;let u=o.offset,d=null;for(let{start:t,value:c}of o.items){let f=n.resolveProps(t,{indicator:`seq-item-ind`,next:c,offset:u,onError:s,parentIndent:o.indent,startOnNewline:!0});if(!f.found){if(f.anchor||f.tag||c)c?.type===`block-seq`?s(f.end,`BAD_INDENT`,`All sequence items must start at the same column`):s(u,`MISSING_CHAR`,`Sequence item without - indicator`);else{d=f.end,f.comment&&(l.comment=f.comment);continue}}let p=c?e(a,c,f,s):i(a,f.end,t,null,f,s);a.schema.compat&&r.flowIndentCheck(o.indent,c,s),u=p.range[2],l.items.push(p)}return l.range=[o.offset,u,d??u],l}e.resolveBlockSeq=resolveBlockSeq})),q=/* @__PURE__ */ __commonJSMin((e=>{function resolveEnd(e,t,n,r){let i=``;if(e){let a=!1,o=``;for(let s of e){let{source:e,type:c}=s;switch(c){case`space`:a=!0;break;case`comment`:{n&&!a&&r(s,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let t=e.substring(1)||` `;i?i+=o+t:i=t,o=``;break}case`newline`:i&&(o+=e),a=!0;break;default:r(s,`UNEXPECTED_TOKEN`,`Unexpected ${c} at node end`)}t+=e.length}}return{comment:i,offset:t}}e.resolveEnd=resolveEnd})),ze=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=L(),r=R(),i=B(),a=q(),o=K(),s=Pe(),c=Ie();let l=`Block collections are not allowed within flow collections`,isBlock=e=>e&&(e.type===`block-map`||e.type===`block-seq`);function resolveFlowCollection({composeNode:e,composeEmptyNode:u},d,f,p,m){let h=f.start.source===`{`,g=h?`flow map`:`flow sequence`,_=new((m?.nodeClass)??(h?r.YAMLMap:i.YAMLSeq))(d.schema);_.flow=!0;let v=d.atRoot;v&&(d.atRoot=!1),d.atKey&&=!1;let y=f.offset+f.start.source.length;for(let i=0;i0){let e=a.resolveEnd(S,C,d.options.strict,p);e.comment&&(_.comment?_.comment+=` -`+e.comment:_.comment=e.comment),_.range=[f.offset,C,e.offset]}else _.range=[f.offset,C,C];return _}e.resolveFlowCollection=resolveFlowCollection})),Be=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=M(),r=z(),i=V(),a=Le(),o=Re(),s=ze();function resolveCollection(e,t,n,r,i,c){let l=n.type===`block-map`?a.resolveBlockMap(e,t,n,r,c):n.type===`block-seq`?o.resolveBlockSeq(e,t,n,r,c):s.resolveFlowCollection(e,t,n,r,c),u=l.constructor;return i===`!`||i===u.tagName?(l.tag=u.tagName,l):(i&&(l.tag=i),l)}function composeCollection(e,a,o,s,c){let l=s.tag,u=l?a.directives.tagName(l.source,e=>c(l,`TAG_RESOLVE_FAILED`,e)):null;if(o.type===`block-seq`){let{anchor:e,newlineAfterProp:t}=s,n=e&&l?e.offset>l.offset?e:l:e??l;n&&(!t||t.offsete.tag===u&&e.collection===d);if(!f){let t=a.schema.knownTags[u];if(t?.collection===d)a.schema.tags.push(Object.assign({},t,{default:!1})),f=t;else return t?c(l,`BAD_COLLECTION_TYPE`,`${t.tag} used for ${d} collection, but expects ${t.collection??`scalar`}`,!0):c(l,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${u}`,!0),resolveCollection(e,a,o,c,u)}let p=resolveCollection(e,a,o,c,u,f),m=f.resolve?.(p,e=>c(l,`TAG_RESOLVE_FAILED`,e),a.options)??p,h=t.isNode(m)?m:new n.Scalar(m);return h.range=p.range,h.tag=u,f?.format&&(h.format=f.format),h}e.composeCollection=composeCollection})),Ve=/* @__PURE__ */ __commonJSMin((e=>{var t=M();function resolveBlockScalar(e,n,r){let i=n.offset,a=parseBlockScalarHeader(n,e.options.strict,r);if(!a)return{value:``,type:null,comment:``,range:[i,i,i]};let o=a.mode===`>`?t.Scalar.BLOCK_FOLDED:t.Scalar.BLOCK_LITERAL,s=n.source?splitLines(n.source):[],c=s.length;for(let e=s.length-1;e>=0;--e){let t=s[e][1];if(t===``||t===`\r`)c=e;else break}if(c===0){let e=a.chomp===`+`&&s.length>0?` +`+e.comment:_.comment=e.comment),_.range=[f.offset,C,e.offset]}else _.range=[f.offset,C,C];return _}e.resolveFlowCollection=resolveFlowCollection})),Be=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=M(),r=R(),i=B(),a=Le(),o=Re(),s=ze();function resolveCollection(e,t,n,r,i,c){let l=n.type===`block-map`?a.resolveBlockMap(e,t,n,r,c):n.type===`block-seq`?o.resolveBlockSeq(e,t,n,r,c):s.resolveFlowCollection(e,t,n,r,c),u=l.constructor;return i===`!`||i===u.tagName?(l.tag=u.tagName,l):(i&&(l.tag=i),l)}function composeCollection(e,a,o,s,c){let l=s.tag,u=l?a.directives.tagName(l.source,e=>c(l,`TAG_RESOLVE_FAILED`,e)):null;if(o.type===`block-seq`){let{anchor:e,newlineAfterProp:t}=s,n=e&&l?e.offset>l.offset?e:l:e??l;n&&(!t||t.offsete.tag===u&&e.collection===d);if(!f){let t=a.schema.knownTags[u];if(t?.collection===d)a.schema.tags.push(Object.assign({},t,{default:!1})),f=t;else return t?c(l,`BAD_COLLECTION_TYPE`,`${t.tag} used for ${d} collection, but expects ${t.collection??`scalar`}`,!0):c(l,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${u}`,!0),resolveCollection(e,a,o,c,u)}let p=resolveCollection(e,a,o,c,u,f),m=f.resolve?.(p,e=>c(l,`TAG_RESOLVE_FAILED`,e),a.options)??p,h=t.isNode(m)?m:new n.Scalar(m);return h.range=p.range,h.tag=u,f?.format&&(h.format=f.format),h}e.composeCollection=composeCollection})),Ve=/* @__PURE__ */ __commonJSMin((e=>{var t=M();function resolveBlockScalar(e,n,r){let i=n.offset,a=parseBlockScalarHeader(n,e.options.strict,r);if(!a)return{value:``,type:null,comment:``,range:[i,i,i]};let o=a.mode===`>`?t.Scalar.BLOCK_FOLDED:t.Scalar.BLOCK_LITERAL,s=n.source?splitLines(n.source):[],c=s.length;for(let e=s.length-1;e>=0;--e){let t=s[e][1];if(t===``||t===`\r`)c=e;else break}if(c===0){let e=a.chomp===`+`&&s.length>0?` `.repeat(Math.max(1,s.length-1)):``,t=i+a.length;return n.source&&(t+=n.source.length),{value:e,type:o,comment:a.comment,range:[i,t,t]}}let l=n.indent+a.indent,u=n.offset+a.length,d=0;for(let t=0;tl&&(l=n.length);else{n.length=c;--e)s[e][0].length>l&&(c=e+1);let f=``,p=``,m=!1;for(let e=0;e{var t=M(),n=J();function resolveFlowScalar(e,r,i){let{offset:a,type:o,source:s,end:c}=e,l,u,_onError=(e,t,n)=>i(a+e,t,n);switch(o){case`scalar`:l=t.Scalar.PLAIN,u=plainValue(s,_onError);break;case`single-quoted-scalar`:l=t.Scalar.QUOTE_SINGLE,u=singleQuotedValue(s,_onError);break;case`double-quoted-scalar`:l=t.Scalar.QUOTE_DOUBLE,u=doubleQuotedValue(s,_onError);break; +default:{r(i,`UNEXPECTED_TOKEN`,`Unexpected token in block scalar header: ${i.type}`);let e=i.source;e&&typeof e==`string`&&(d+=e.length)}}}return{mode:a,indent:o,chomp:s,comment:u,length:d}}function splitLines(e){let t=e.split(/\n( *)/),n=t[0],r=n.match(/^( *)/),i=[r?.[1]?[r[1],n.slice(r[1].length)]:[``,n]];for(let e=1;e{var t=M(),n=q();function resolveFlowScalar(e,r,i){let{offset:a,type:o,source:s,end:c}=e,l,u,_onError=(e,t,n)=>i(a+e,t,n);switch(o){case`scalar`:l=t.Scalar.PLAIN,u=plainValue(s,_onError);break;case`single-quoted-scalar`:l=t.Scalar.QUOTE_SINGLE,u=singleQuotedValue(s,_onError);break;case`double-quoted-scalar`:l=t.Scalar.QUOTE_DOUBLE,u=doubleQuotedValue(s,_onError);break; /* istanbul ignore next should not happen */ default:return i(e,`UNEXPECTED_TOKEN`,`Expected a flow scalar value, but found: ${o}`),{value:``,type:null,comment:``,range:[a,a+s.length,a+s.length]}}let d=a+s.length,f=n.resolveEnd(c,d,r,i);return{value:u,type:l,comment:f.comment,range:[a,d,f.offset]}}function plainValue(e,t){let n=``;switch(e[0]){ /* istanbul ignore next should not happen */ @@ -86,10 +86,10 @@ case` `:n=`a tab character`;break;case`,`:n=`flow indicator character ,`;break;c `);)r===` `&&(n+=` `),t+=1,r=e[t+1];return n||=` `,{fold:n,offset:t}}let r={0:`\0`,a:`\x07`,b:`\b`,e:`\x1B`,f:`\f`,n:` -`,r:`\r`,t:` `,v:`\v`,N:`…`,_:`\xA0`,L:`\u2028`,P:`\u2029`," ":` `,'"':`"`,"/":`/`,"\\":`\\`," ":` `};function parseCharCode(e,t,n,r){let i=e.substr(t,n),a=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(a)}catch{let i=e.substr(t-2,n+2);return r(t-2,`BAD_DQ_ESCAPE`,`Invalid escape sequence ${i}`),i}}e.resolveFlowScalar=resolveFlowScalar})),Ue=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=M(),r=Ve(),i=He();function composeScalar(e,a,o,s){let{value:c,type:l,comment:u,range:d}=a.type===`block-scalar`?r.resolveBlockScalar(e,a,s):i.resolveFlowScalar(a,e.options.strict,s),f=o?e.directives.tagName(o.source,e=>s(o,`TAG_RESOLVE_FAILED`,e)):null,p;p=e.options.stringKeys&&e.atKey?e.schema[t.SCALAR]:f?findScalarTagByName(e.schema,c,f,o,s):a.type===`scalar`?findScalarTagByTest(e,c,a,s):e.schema[t.SCALAR];let m;try{let r=p.resolve(c,e=>s(o??a,`TAG_RESOLVE_FAILED`,e),e.options);m=t.isScalar(r)?r:new n.Scalar(r)}catch(e){let t=e instanceof Error?e.message:String(e);s(o??a,`TAG_RESOLVE_FAILED`,t),m=new n.Scalar(c)}return m.range=d,m.source=c,l&&(m.type=l),f&&(m.tag=f),p.format&&(m.format=p.format),u&&(m.comment=u),m}function findScalarTagByName(e,n,r,i,a){if(r===`!`)return e[t.SCALAR];let o=[];for(let t of e.tags)if(!t.collection&&t.tag===r){if(t.default&&t.test)o.push(t);else return t}for(let e of o)if(e.test?.test(n))return e;let s=e.knownTags[r];return s&&!s.collection?(e.tags.push(Object.assign({},s,{default:!1,test:void 0})),s):(a(i,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${r}`,r!==`tag:yaml.org,2002:str`),e[t.SCALAR])}function findScalarTagByTest({atKey:e,directives:n,schema:r},i,a,o){let s=r.tags.find(t=>(t.default===!0||e&&t.default===`key`)&&t.test?.test(i))||r[t.SCALAR];if(r.compat){let e=r.compat.find(e=>e.default&&e.test?.test(i))??r[t.SCALAR];s.tag!==e.tag&&o(a,`TAG_RESOLVE_FAILED`,`Value may be parsed as either ${n.tagString(s.tag)} or ${n.tagString(e.tag)}`,!0)}return s}e.composeScalar=composeScalar})),We=/* @__PURE__ */ __commonJSMin((e=>{function emptyScalarPosition(e,t,n){if(t){n??=t.length;for(let r=n-1;r>=0;--r){let n=t[r];switch(n.type){case`space`:case`comment`:case`newline`:e-=n.source.length;continue}for(n=t[++r];n?.type===`space`;)e+=n.source.length,n=t[++r];break}}return e}e.emptyScalarPosition=emptyScalarPosition})),Ge=/* @__PURE__ */ __commonJSMin((e=>{var t=j(),n=O(),r=Be(),i=Ue(),a=J(),o=We();let s={composeNode,composeEmptyNode};function composeNode(e,t,a,o){let c=e.atKey,{spaceBefore:l,comment:u,anchor:d,tag:f}=a,p,m=!0;switch(t.type){case`alias`:p=composeAlias(e,t,o),(d||f)&&o(t,`ALIAS_PROPS`,`An alias node must not specify any properties`);break;case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:case`block-scalar`:p=i.composeScalar(e,t,f,o),d&&(p.anchor=d.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:try{p=r.composeCollection(s,e,t,a,o),d&&(p.anchor=d.source.substring(1))}catch(e){o(t,`RESOURCE_EXHAUSTION`,e instanceof Error?e.message:String(e))}break;default:o(t,`UNEXPECTED_TOKEN`,t.type===`error`?t.message:`Unsupported token (type: ${t.type})`),m=!1}return p??=composeEmptyNode(e,t.offset,void 0,null,a,o),d&&p.anchor===``&&o(d,`BAD_ALIAS`,`Anchor cannot be an empty string`),c&&e.options.stringKeys&&(!n.isScalar(p)||typeof p.value!=`string`||p.tag&&p.tag!==`tag:yaml.org,2002:str`)&&o(f??t,`NON_STRING_KEY`,`With stringKeys, all keys must be strings`),l&&(p.spaceBefore=!0),u&&(t.type===`scalar`&&t.source===``?p.comment=u:p.commentBefore=u),e.options.keepSourceTokens&&m&&(p.srcToken=t),p}function composeEmptyNode(e,t,n,r,{spaceBefore:a,comment:s,anchor:c,tag:l,end:u},d){let f={type:`scalar`,offset:o.emptyScalarPosition(t,n,r),indent:-1,source:``},p=i.composeScalar(e,f,l,d);return c&&(p.anchor=c.source.substring(1),p.anchor===``&&d(c,`BAD_ALIAS`,`Anchor cannot be an empty string`)),a&&(p.spaceBefore=!0),s&&(p.comment=s,p.range[2]=u),p}function composeAlias({options:e},{offset:n,source:r,end:i},o){let s=new t.Alias(r.substring(1));s.source===``&&o(n,`BAD_ALIAS`,`Alias cannot be an empty string`),s.source.endsWith(`:`)&&o(n+r.length-1,`BAD_ALIAS`,`Alias ending in : is ambiguous`,!0);let c=n+r.length,l=a.resolveEnd(i,c,e.strict,o);return s.range=[n,c,l.offset],l.comment&&(s.comment=l.comment),s}e.composeEmptyNode=composeEmptyNode,e.composeNode=composeNode})),Ke=/* @__PURE__ */ __commonJSMin((e=>{var t=G(),n=Ge(),r=J(),i=q();function composeDoc(e,a,{offset:o,start:s,value:c,end:l},u){let d=Object.assign({_directives:a},e),f=new t.Document(void 0,d),p={atKey:!1,atRoot:!0,directives:f.directives,options:f.options,schema:f.schema},m=i.resolveProps(s,{indicator:`doc-start`,next:c??l?.[0],offset:o,onError:u,parentIndent:0,startOnNewline:!0});m.found&&(f.directives.docStart=!0,c&&(c.type===`block-map`||c.type===`block-seq`)&&!m.hasNewline&&u(m.end,`MISSING_CHAR`,`Block collection cannot start on same line with directives-end marker`)),f.contents=c?n.composeNode(p,c,m,u):n.composeEmptyNode(p,m.end,s,null,m,u);let h=f.contents.range[2],g=r.resolveEnd(l,h,!1,u);return g.comment&&(f.comment=g.comment),f.range=[o,h,g.offset],f}e.composeDoc=composeDoc})),qe=/* @__PURE__ */ __commonJSMin((e=>{var t=D(`process`),n=oe(),r=G(),i=K(),a=O(),o=Ke(),s=J();function getErrorPos(e){if(typeof e==`number`)return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:n}=e;return[t,t+(typeof n==`string`?n.length:1)]}function parsePrelude(e){let t=``,n=!1,r=!1;for(let i=0;i{var t=O(),n=M(),r=Ve(),i=He();function composeScalar(e,a,o,s){let{value:c,type:l,comment:u,range:d}=a.type===`block-scalar`?r.resolveBlockScalar(e,a,s):i.resolveFlowScalar(a,e.options.strict,s),f=o?e.directives.tagName(o.source,e=>s(o,`TAG_RESOLVE_FAILED`,e)):null,p;p=e.options.stringKeys&&e.atKey?e.schema[t.SCALAR]:f?findScalarTagByName(e.schema,c,f,o,s):a.type===`scalar`?findScalarTagByTest(e,c,a,s):e.schema[t.SCALAR];let m;try{let r=p.resolve(c,e=>s(o??a,`TAG_RESOLVE_FAILED`,e),e.options);m=t.isScalar(r)?r:new n.Scalar(r)}catch(e){let t=e instanceof Error?e.message:String(e);s(o??a,`TAG_RESOLVE_FAILED`,t),m=new n.Scalar(c)}return m.range=d,m.source=c,l&&(m.type=l),f&&(m.tag=f),p.format&&(m.format=p.format),u&&(m.comment=u),m}function findScalarTagByName(e,n,r,i,a){if(r===`!`)return e[t.SCALAR];let o=[];for(let t of e.tags)if(!t.collection&&t.tag===r){if(t.default&&t.test)o.push(t);else return t}for(let e of o)if(e.test?.test(n))return e;let s=e.knownTags[r];return s&&!s.collection?(e.tags.push(Object.assign({},s,{default:!1,test:void 0})),s):(a(i,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${r}`,r!==`tag:yaml.org,2002:str`),e[t.SCALAR])}function findScalarTagByTest({atKey:e,directives:n,schema:r},i,a,o){let s=r.tags.find(t=>(t.default===!0||e&&t.default===`key`)&&t.test?.test(i))||r[t.SCALAR];if(r.compat){let e=r.compat.find(e=>e.default&&e.test?.test(i))??r[t.SCALAR];s.tag!==e.tag&&o(a,`TAG_RESOLVE_FAILED`,`Value may be parsed as either ${n.tagString(s.tag)} or ${n.tagString(e.tag)}`,!0)}return s}e.composeScalar=composeScalar})),We=/* @__PURE__ */ __commonJSMin((e=>{function emptyScalarPosition(e,t,n){if(t){n??=t.length;for(let r=n-1;r>=0;--r){let n=t[r];switch(n.type){case`space`:case`comment`:case`newline`:e-=n.source.length;continue}for(n=t[++r];n?.type===`space`;)e+=n.source.length,n=t[++r];break}}return e}e.emptyScalarPosition=emptyScalarPosition})),Ge=/* @__PURE__ */ __commonJSMin((e=>{var t=j(),n=O(),r=Be(),i=Ue(),a=q(),o=We();let s={composeNode,composeEmptyNode};function composeNode(e,t,a,o){let c=e.atKey,{spaceBefore:l,comment:u,anchor:d,tag:f}=a,p,m=!0;switch(t.type){case`alias`:p=composeAlias(e,t,o),(d||f)&&o(t,`ALIAS_PROPS`,`An alias node must not specify any properties`);break;case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:case`block-scalar`:p=i.composeScalar(e,t,f,o),d&&(p.anchor=d.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:try{p=r.composeCollection(s,e,t,a,o),d&&(p.anchor=d.source.substring(1))}catch(e){o(t,`RESOURCE_EXHAUSTION`,e instanceof Error?e.message:String(e))}break;default:o(t,`UNEXPECTED_TOKEN`,t.type===`error`?t.message:`Unsupported token (type: ${t.type})`),m=!1}return p??=composeEmptyNode(e,t.offset,void 0,null,a,o),d&&p.anchor===``&&o(d,`BAD_ALIAS`,`Anchor cannot be an empty string`),c&&e.options.stringKeys&&(!n.isScalar(p)||typeof p.value!=`string`||p.tag&&p.tag!==`tag:yaml.org,2002:str`)&&o(f??t,`NON_STRING_KEY`,`With stringKeys, all keys must be strings`),l&&(p.spaceBefore=!0),u&&(t.type===`scalar`&&t.source===``?p.comment=u:p.commentBefore=u),e.options.keepSourceTokens&&m&&(p.srcToken=t),p}function composeEmptyNode(e,t,n,r,{spaceBefore:a,comment:s,anchor:c,tag:l,end:u},d){let f={type:`scalar`,offset:o.emptyScalarPosition(t,n,r),indent:-1,source:``},p=i.composeScalar(e,f,l,d);return c&&(p.anchor=c.source.substring(1),p.anchor===``&&d(c,`BAD_ALIAS`,`Anchor cannot be an empty string`)),a&&(p.spaceBefore=!0),s&&(p.comment=s,p.range[2]=u),p}function composeAlias({options:e},{offset:n,source:r,end:i},o){let s=new t.Alias(r.substring(1));s.source===``&&o(n,`BAD_ALIAS`,`Alias cannot be an empty string`),s.source.endsWith(`:`)&&o(n+r.length-1,`BAD_ALIAS`,`Alias ending in : is ambiguous`,!0);let c=n+r.length,l=a.resolveEnd(i,c,e.strict,o);return s.range=[n,c,l.offset],l.comment&&(s.comment=l.comment),s}e.composeEmptyNode=composeEmptyNode,e.composeNode=composeNode})),Ke=/* @__PURE__ */ __commonJSMin((e=>{var t=W(),n=Ge(),r=q(),i=K();function composeDoc(e,a,{offset:o,start:s,value:c,end:l},u){let d=Object.assign({_directives:a},e),f=new t.Document(void 0,d),p={atKey:!1,atRoot:!0,directives:f.directives,options:f.options,schema:f.schema},m=i.resolveProps(s,{indicator:`doc-start`,next:c??l?.[0],offset:o,onError:u,parentIndent:0,startOnNewline:!0});m.found&&(f.directives.docStart=!0,c&&(c.type===`block-map`||c.type===`block-seq`)&&!m.hasNewline&&u(m.end,`MISSING_CHAR`,`Block collection cannot start on same line with directives-end marker`)),f.contents=c?n.composeNode(p,c,m,u):n.composeEmptyNode(p,m.end,s,null,m,u);let h=f.contents.range[2],g=r.resolveEnd(l,h,!1,u);return g.comment&&(f.comment=g.comment),f.range=[o,h,g.offset],f}e.composeDoc=composeDoc})),qe=/* @__PURE__ */ __commonJSMin((e=>{var t=D(`process`),n=ae(),r=W(),i=G(),a=O(),o=Ke(),s=q();function getErrorPos(e){if(typeof e==`number`)return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:n}=e;return[t,t+(typeof n==`string`?n.length:1)]}function parsePrelude(e){let t=``,n=!1,r=!1;for(let i=0;i{let a=getErrorPos(e);r?this.warnings.push(new i.YAMLWarning(a,t,n)):this.errors.push(new i.YAMLParseError(a,t,n))},this.directives=new n.Directives({version:e.version||`1.2`}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=parsePrelude(this.prelude);if(n){let i=e.contents;if(t)e.comment=e.comment?`${e.comment}\n${n}`:n;else if(r||e.directives.docStart||!i)e.commentBefore=n;else if(a.isCollection(i)&&!i.flow&&i.items.length>0){let e=i.items[0];a.isPair(e)&&(e=e.key);let t=e.commentBefore;e.commentBefore=t?`${n}\n${t}`:n}else{let e=i.commentBefore;i.commentBefore=e?`${n}\n${e}`:n}}if(t){for(let t=0;t{let i=getErrorPos(e);i[0]+=t,this.onError(i,`BAD_DIRECTIVE`,n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case`document`:{let t=o.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,`MISSING_CHAR`,`Missing directives-end/doc-start indicator line`),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case`byte-order-mark`:case`space`:break;case`comment`:case`newline`:this.prelude.push(e.source);break;case`error`:{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new i.YAMLParseError(getErrorPos(e),`UNEXPECTED_TOKEN`,t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case`doc-end`:{if(!this.doc){this.errors.push(new i.YAMLParseError(getErrorPos(e),`UNEXPECTED_TOKEN`,`Unexpected doc-end without preceding document`));break}this.doc.directives.docEnd=!0;let t=s.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let e=this.doc.comment;this.doc.comment=e?`${e}\n${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new i.YAMLParseError(getErrorPos(e),`UNEXPECTED_TOKEN`,`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let e=Object.assign({_directives:this.directives},this.options),n=new r.Document(void 0,e);this.atDirectives&&this.onError(t,`MISSING_CHAR`,`Missing directives-end indicator line`),n.range=[0,t,t],this.decorate(n,!1),yield n}}}})),Je=/* @__PURE__ */ __commonJSMin((e=>{var t=Ve(),n=He(),r=K(),i=I();function resolveAsScalar(e,i=!0,a){if(e){let _onError=(e,t,n)=>{let i=typeof e==`number`?e:Array.isArray(e)?e[0]:e.offset;if(a)a(i,t,n);else throw new r.YAMLParseError([i,i+1],t,n)};switch(e.type){case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return n.resolveFlowScalar(e,i,_onError);case`block-scalar`:return t.resolveBlockScalar({options:{strict:i}},e,_onError)}}return null}function createScalarToken(e,t){let{implicitKey:n=!1,indent:r,inFlow:a=!1,offset:o=-1,type:s=`PLAIN`}=t,c=i.stringifyString({type:s,value:e},{implicitKey:n,indent:r>0?` `.repeat(r):``,inFlow:a,options:{blockQuote:!0,lineWidth:-1}}),l=t.end??[{type:`newline`,offset:-1,indent:r,source:` +`)+(a.substring(1)||` `),n=!0,r=!1;break;case`%`:e[i+1]?.[0]!==`#`&&(i+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:t,afterEmptyLine:r}}e.Composer=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,n,r)=>{let a=getErrorPos(e);r?this.warnings.push(new i.YAMLWarning(a,t,n)):this.errors.push(new i.YAMLParseError(a,t,n))},this.directives=new n.Directives({version:e.version||`1.2`}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=parsePrelude(this.prelude);if(n){let i=e.contents;if(t)e.comment=e.comment?`${e.comment}\n${n}`:n;else if(r||e.directives.docStart||!i)e.commentBefore=n;else if(a.isCollection(i)&&!i.flow&&i.items.length>0){let e=i.items[0];a.isPair(e)&&(e=e.key);let t=e.commentBefore;e.commentBefore=t?`${n}\n${t}`:n}else{let e=i.commentBefore;i.commentBefore=e?`${n}\n${e}`:n}}if(t){for(let t=0;t{let i=getErrorPos(e);i[0]+=t,this.onError(i,`BAD_DIRECTIVE`,n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case`document`:{let t=o.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,`MISSING_CHAR`,`Missing directives-end/doc-start indicator line`),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case`byte-order-mark`:case`space`:break;case`comment`:case`newline`:this.prelude.push(e.source);break;case`error`:{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new i.YAMLParseError(getErrorPos(e),`UNEXPECTED_TOKEN`,t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case`doc-end`:{if(!this.doc){this.errors.push(new i.YAMLParseError(getErrorPos(e),`UNEXPECTED_TOKEN`,`Unexpected doc-end without preceding document`));break}this.doc.directives.docEnd=!0;let t=s.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let e=this.doc.comment;this.doc.comment=e?`${e}\n${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new i.YAMLParseError(getErrorPos(e),`UNEXPECTED_TOKEN`,`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let e=Object.assign({_directives:this.directives},this.options),n=new r.Document(void 0,e);this.atDirectives&&this.onError(t,`MISSING_CHAR`,`Missing directives-end indicator line`),n.range=[0,t,t],this.decorate(n,!1),yield n}}}})),Je=/* @__PURE__ */ __commonJSMin((e=>{var t=Ve(),n=He(),r=G(),i=F();function resolveAsScalar(e,i=!0,a){if(e){let _onError=(e,t,n)=>{let i=typeof e==`number`?e:Array.isArray(e)?e[0]:e.offset;if(a)a(i,t,n);else throw new r.YAMLParseError([i,i+1],t,n)};switch(e.type){case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return n.resolveFlowScalar(e,i,_onError);case`block-scalar`:return t.resolveBlockScalar({options:{strict:i}},e,_onError)}}return null}function createScalarToken(e,t){let{implicitKey:n=!1,indent:r,inFlow:a=!1,offset:o=-1,type:s=`PLAIN`}=t,c=i.stringifyString({type:s,value:e},{implicitKey:n,indent:r>0?` `.repeat(r):``,inFlow:a,options:{blockQuote:!0,lineWidth:-1}}),l=t.end??[{type:`newline`,offset:-1,indent:r,source:` `}];switch(c[0]){case`|`:case`>`:{let e=c.indexOf(` `),t=c.substring(0,e),n=c.substring(e+1)+` `,i=[{type:`block-scalar-header`,offset:o,indent:r,source:t}];return addEndtoBlockProps(i,l)||i.push({type:`newline`,offset:-1,indent:r,source:` @@ -136,14 +136,14 @@ default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.l /* istanbul ignore else should not happen */ n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let t=this.peek(2);if(t.type===`block-map`&&(this.type===`map-value-ind`&&t.indent===e.indent||this.type===`newline`&&!t.items[t.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type===`map-value-ind`&&t.type!==`flow-collection`){let n=getFirstKeyStartProps(getPrevProps(t));fixFlowSeqItems(e);let r=e.end.splice(1,e.end.length);r.push(this.sourceToken);let i={type:`block-map`,offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let e=this.source.indexOf(` `)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(` -`,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=getFirstKeyStartProps(getPrevProps(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=getFirstKeyStartProps(getPrevProps(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}}})),tt=/* @__PURE__ */ __commonJSMin((e=>{var t=qe(),n=G(),r=K(),i=fe(),a=O(),o=$e(),s=et();function parseOptions(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new o.LineCounter||null,prettyErrors:t}}function parseAllDocuments(e,n={}){let{lineCounter:i,prettyErrors:a}=parseOptions(n),o=new s.Parser(i?.addNewLine),c=new t.Composer(n),l=Array.from(c.compose(o.parse(e)));if(a&&i)for(let t of l)t.errors.forEach(r.prettifyError(e,i)),t.warnings.forEach(r.prettifyError(e,i));return l.length>0?l:Object.assign([],{empty:!0},c.streamInfo())}function parseDocument(e,n={}){let{lineCounter:i,prettyErrors:a}=parseOptions(n),o=new s.Parser(i?.addNewLine),c=new t.Composer(n),l=null;for(let t of c.compose(o.parse(e),!0,e.length))if(!l)l=t;else if(l.options.logLevel!==`silent`){l.errors.push(new r.YAMLParseError(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return a&&i&&(l.errors.forEach(r.prettifyError(e,i)),l.warnings.forEach(r.prettifyError(e,i))),l}function parse(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let a=parseDocument(e,n);if(!a)return null;if(a.warnings.forEach(e=>i.warn(a.options.logLevel,e)),a.errors.length>0){if(a.options.logLevel!==`silent`)throw a.errors[0];a.errors=[]}return a.toJS(Object.assign({reviver:r},n))}function stringify(e,t,r){let i=null;if(typeof t==`function`||Array.isArray(t)?i=t:r===void 0&&t&&(r=t),typeof r==`string`&&(r=r.length),typeof r==`number`){let e=Math.round(r);r=e<1?void 0:e>8?{indent:8}:{indent:e}}if(e===void 0){let{keepUndefined:e}=r??t??{};if(!e)return}return a.isDocument(e)&&!i?e.toString(r):new n.Document(e,i,r).toString(r)}e.parse=parse,e.parseAllDocuments=parseAllDocuments,e.parseDocument=parseDocument,e.stringify=stringify})),Y=(/* @__PURE__ */ __commonJSMin((e=>{var t=qe(),n=G(),r=Me(),i=K(),a=j(),o=O(),s=R(),c=M(),l=z(),u=V();Ze();var d=Qe(),f=$e(),p=et(),m=tt(),h=k();e.Composer=t.Composer,e.Document=n.Document,e.Schema=r.Schema,e.YAMLError=i.YAMLError,e.YAMLParseError=i.YAMLParseError,e.YAMLWarning=i.YAMLWarning,e.Alias=a.Alias,e.isAlias=o.isAlias,e.isCollection=o.isCollection,e.isDocument=o.isDocument,e.isMap=o.isMap,e.isNode=o.isNode,e.isPair=o.isPair,e.isScalar=o.isScalar,e.isSeq=o.isSeq,e.Pair=s.Pair,e.Scalar=c.Scalar,e.YAMLMap=l.YAMLMap,e.YAMLSeq=u.YAMLSeq,e.Lexer=d.Lexer,e.LineCounter=f.LineCounter,e.Parser=p.Parser,e.parse=m.parse,e.parseAllDocuments=m.parseAllDocuments,e.parseDocument=m.parseDocument,e.stringify=m.stringify,e.visit=h.visit,e.visitAsync=h.visitAsync})))();function parseInstalledVpVersion(e){return(e.match(/^\s*vp\s+v?(\d[^\s]*)/im)??e.match(/Global:\s*v?(\d[^\s]*)/i))?.[1]??`unknown`}const nt=/* @__PURE__ */ new Set([`true`,`True`,`TRUE`]),rt=/* @__PURE__ */ new Set([`false`,`False`,`FALSE`]);function parseNodeManager(e){if(e){if(nt.has(e))return!0;if(rt.has(e))return!1;throw Error(`Invalid node-manager input: "${e}". Expected "true", "false", or unset.`)}}function supportsScopedEnv(e){let t=parseInstalledVpVersion(e);if(t.startsWith(`0.0.0-commit.`))return!0;let n=t.match(/^(\d+)\.(\d+)\.(\d+)/);if(!n)throw Error(`Could not determine the installed Vite+ version for env configuration.`);let[,r,i,a]=n.map(Number);return r>0||i>3||i===3&&a>=1}function nodeManagerOffArgs(e){return parseInstalledVpVersion(e).startsWith(`0.0.0-commit.`)&&console.info("setup-vp: node-manager: false requires a preview build that supports `vp env off node`. If this command is unsupported, use a newer preview or a stable release. setup-vp will not fall back to disabling package-manager management."),supportsScopedEnv(e)?[`env`,`off`,`node`]:[`env`,`off`]}const it=[`npm`,`pnpm`,`yarn`,`bun`];function parsePackageManager(e){if(!e?.trim())return;let t;try{t=(0,Y.parse)(e)}catch(e){throw Error(`Invalid package-manager input: ${String(e)}`)}if(t!==``){if(typeof t==`boolean`)return t;if(t&&typeof t==`object`&&!Array.isArray(t)){for(let[e,n]of Object.entries(t))if(!it.includes(e)||typeof n!=`boolean`)throw Error(`Invalid package-manager input: ${e} must be npm, pnpm, yarn, or bun with a boolean value.`);return t}throw Error(`Invalid package-manager input: expected a boolean or a mapping of npm, pnpm, yarn, and bun to booleans.`)}}function packageManagerArgs(e,t){if(e===void 0)return[];if(!supportsScopedEnv(t))throw Error(`package-manager configuration requires Vite+ 0.3.1 or newer.`);return typeof e==`boolean`?e?[]:[[`env`,`off`,`pm`]]:it.filter(t=>e[t]===!1).map(e=>[`env`,`off`,e])}const X=`Vite+`,Z=`vite-plus`;function resolvePath$1(e,t){return p.isAbsolute(e)?e:p.join(t,e)}function isWithin(e,t){let n=p.relative(t,e);return!p.isAbsolute(n)&&n!==`..`&&!n.startsWith(`..${p.sep}`)}function resolveProjectDirectory(e){let{workingDirectory:t,workspaceRoot:n}=e,r=p.isAbsolute(t)?t:p.join(n,t);try{if(!d(r).isDirectory())throw Error(`working-directory is not a directory: ${t} (resolved to ${r})`)}catch(e){throw e instanceof Error&&`code`in e&&e.code===`ENOENT`?Error(`working-directory not found: ${t} (resolved to ${r})`):e}return r}function isWindows(e=process.platform){return e===`win32`}function run(e,t,n={}){let r=S(e,t,{stdio:`inherit`,...n});if(r.error)throw r.error;if(r.status!==0)throw Error(`${e} ${t.join(` `)} exited with code ${r.status??1}`)}function runWithOutput(e,t,n={}){return new Promise((r,i)=>{let a=x(e,t,{...n,stdio:[`ignore`,`pipe`,`pipe`]}),o=``,s=``;a.stdout.on(`data`,e=>{process.stdout.write(e),o=(o+e.toString()).slice(-4e3)}),a.stderr.on(`data`,e=>{process.stderr.write(e),s=(s+e.toString()).slice(-4e3)}),a.on(`error`,i),a.on(`close`,e=>r({exitCode:e??1,stdout:o,stderr:s}))})}function commandPath(e,r=process.env){if(!e||e===`.`||e===`..`||/[\\/:]/.test(e))return;let i=isWindows(),a=i?Object.keys(r).sort().find(e=>e.toUpperCase()===`PATH`):`PATH`,o=a&&r[a]||``,s=i&&!e.toLowerCase().endsWith(`.exe`)?`${e}.exe`:e,c=l(process.cwd());for(let e of o.split(p.delimiter)){let r=i?e.replace(/^"(.*)"$/,`$1`):e;if(p.isAbsolute(r))try{let e=l(r);if(i?e.toLowerCase()===c.toLowerCase():e===c)continue;let a=p.join(r,s);if(!d(a).isFile())continue;return t(a,i?n.F_OK:n.X_OK),a}catch{}}}function getCommandOutput(e,t,n){let r=S(e,t,{cwd:n?.cwd,encoding:`utf8`,stdio:[`ignore`,`pipe`,`pipe`]});if(r.status===0)return r.stdout.trim()}const at=[{filename:`pnpm-lock.yaml`,type:`pnpm`},{filename:`bun.lockb`,type:`bun`},{filename:`bun.lock`,type:`bun`},{filename:`package-lock.json`,type:`npm`},{filename:`npm-shrinkwrap.json`,type:`npm`},{filename:`yarn.lock`,type:`yarn`}];function resolvePath(e,t){return g(e)?e:_(t,e)}function inferLockFileType(e,t){return t.includes(`pnpm`)?{type:`pnpm`,path:e,filename:t}:t.includes(`yarn`)?{type:`yarn`,path:e,filename:t}:t.startsWith(`bun.`)?{type:`bun`,path:e,filename:t}:{type:`npm`,path:e,filename:t}}function detectLockFile(e,t){if(e){let n=resolvePath(e,t);if(i(n)){let e=m(n),t=at.find(t=>t.filename===e);return t?{type:t.type,path:n,filename:e}:inferLockFileType(n,e)}return}let n=c(t);for(let e of at)if(n.includes(e.filename)){let n=_(t,e.filename);return{type:e.type,path:n,filename:e.filename}}}function prepareCacheMetadata(e){let{projectDir:t,cacheDependencyPath:n,logWarning:r}=e,i=detectLockFile(n||void 0,t);if(!i)return r?.(`setup-vp: cache is enabled but no supported lock file was found; skipping cache.`),{ready:!1};let a=getCommandOutput(`vp`,[`pm`,`cache`,`dir`],{cwd:p.dirname(i.path)});return a?{ready:!0,cachePath:a,lockFile:i.path,lockType:i.type}:(r?.(`setup-vp: could not resolve package-manager cache directory for ${i.filename}; skipping cache.`),{ready:!1})}function createLockfileResolver(e){let{getWorkspaceDir:t,info:n,debug:r}=e,a=/^\d+\.\d+\.\d+/;function tryResolveVitePlusVersionFromLockfile(e,t){let i=detectLockfileForProject(e,t);if(!i)return;let a=i.filename.endsWith(`.lockb`)?textBunLockBeside(i):i;if(!a){r(`Cannot read ${i.filename} (binary) to resolve the ${X} version; using "latest". Use the text bun.lock, or set the \`version\` input.`);return}let o=parseVitePlusVersionFromLockfile(a,workspaceSubPath(h(a.path),e));if(o)return n(`Resolved ${X} version '${o}' from ${a.filename}`),o;r(`No ${X} version found in ${a.path}`)}function detectLockfileForProject(e,n){if(n)return detectLockFile(n,e);let r=t(),i=e;for(;;){let e=detectLockFile(void 0,i);if(e)return e;let t=h(i);if(i===r||t===i||!isWithin(t,r))break;i=t}}function textBunLockBeside(e){let t=_(h(e.path),`bun.lock`);return i(t)?{type:`bun`,path:t,filename:`bun.lock`}:void 0}function workspaceSubPath(e,t){if(!isWithin(t,e))return``;let n=v(e,t);return n?n.split(y).join(`/`):``}function parseVitePlusVersionFromLockfile(e,t=``){if(e.filename.endsWith(`.lockb`))return;let n;try{n=s(e.path,`utf-8`)}catch{return}let r;switch(e.type){case`npm`:r=fromNpmLock(n,t);break;case`pnpm`:r=fromPnpmLock(n,t);break;case`yarn`:r=fromYarnLock(n);break;case`bun`:r=fromBunTextLock(n);break;default:return}return r&&a.test(r)?r:void 0}function fromNpmLock(e,t){let n;try{n=JSON.parse(e)}catch{return}let r=n.packages;if(t){let e=r?.[`${t}/node_modules/${Z}`]?.version;if(typeof e==`string`)return e;if(!npmPackageDeclaresVitePlus(r?.[t]))return}let i=r?.[`node_modules/${Z}`]?.version;if(typeof i==`string`)return i;let a=n.dependencies?.[Z]?.version;return typeof a==`string`?a:void 0}function npmPackageDeclaresVitePlus(e){if(!e)return!1;for(let t of[`dependencies`,`devDependencies`]){let n=e[t];if(n&&typeof n==`object`&&`vite-plus`in n)return!0}return!1}function fromPnpmLock(e,t){let n;try{n=(0,Y.parse)(e)}catch{return}if(!n||typeof n!=`object`)return;let r=n,i=r.importers;if(i&&typeof i==`object`){let e=t||`.`;return e in i?pnpmImporterVersion(i[e]):void 0}return pnpmImporterVersion(r)||e.match(/^\s*\/?vite-plus@(\d+\.\d+\.\d+[^\s():'"]*)/m)?.[1]}function pnpmImporterVersion(e){if(!e||typeof e!=`object`)return;let t=e;for(let e of[`dependencies`,`devDependencies`,`optionalDependencies`]){let n=t[e];if(n&&typeof n==`object`){let e=n[Z],t=typeof e==`string`?e:e?.version;if(typeof t==`string`){let e=t.replace(/\(.*$/,``).trim();if(a.test(e))return e}}}}function fromYarnLock(e){let t=/* @__PURE__ */ new Set,n=e.split(/\r?\n/);for(let e=0;ee.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}}})),tt=/* @__PURE__ */ __commonJSMin((e=>{var t=qe(),n=W(),r=G(),i=fe(),a=O(),o=$e(),s=et();function parseOptions(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new o.LineCounter||null,prettyErrors:t}}function parseAllDocuments(e,n={}){let{lineCounter:i,prettyErrors:a}=parseOptions(n),o=new s.Parser(i?.addNewLine),c=new t.Composer(n),l=Array.from(c.compose(o.parse(e)));if(a&&i)for(let t of l)t.errors.forEach(r.prettifyError(e,i)),t.warnings.forEach(r.prettifyError(e,i));return l.length>0?l:Object.assign([],{empty:!0},c.streamInfo())}function parseDocument(e,n={}){let{lineCounter:i,prettyErrors:a}=parseOptions(n),o=new s.Parser(i?.addNewLine),c=new t.Composer(n),l=null;for(let t of c.compose(o.parse(e),!0,e.length))if(!l)l=t;else if(l.options.logLevel!==`silent`){l.errors.push(new r.YAMLParseError(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return a&&i&&(l.errors.forEach(r.prettifyError(e,i)),l.warnings.forEach(r.prettifyError(e,i))),l}function parse(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let a=parseDocument(e,n);if(!a)return null;if(a.warnings.forEach(e=>i.warn(a.options.logLevel,e)),a.errors.length>0){if(a.options.logLevel!==`silent`)throw a.errors[0];a.errors=[]}return a.toJS(Object.assign({reviver:r},n))}function stringify(e,t,r){let i=null;if(typeof t==`function`||Array.isArray(t)?i=t:r===void 0&&t&&(r=t),typeof r==`string`&&(r=r.length),typeof r==`number`){let e=Math.round(r);r=e<1?void 0:e>8?{indent:8}:{indent:e}}if(e===void 0){let{keepUndefined:e}=r??t??{};if(!e)return}return a.isDocument(e)&&!i?e.toString(r):new n.Document(e,i,r).toString(r)}e.parse=parse,e.parseAllDocuments=parseAllDocuments,e.parseDocument=parseDocument,e.stringify=stringify})),J=(/* @__PURE__ */ __commonJSMin((e=>{var t=qe(),n=W(),r=Me(),i=G(),a=j(),o=O(),s=L(),c=M(),l=R(),u=B();Ze();var d=Qe(),f=$e(),p=et(),m=tt(),h=k();e.Composer=t.Composer,e.Document=n.Document,e.Schema=r.Schema,e.YAMLError=i.YAMLError,e.YAMLParseError=i.YAMLParseError,e.YAMLWarning=i.YAMLWarning,e.Alias=a.Alias,e.isAlias=o.isAlias,e.isCollection=o.isCollection,e.isDocument=o.isDocument,e.isMap=o.isMap,e.isNode=o.isNode,e.isPair=o.isPair,e.isScalar=o.isScalar,e.isSeq=o.isSeq,e.Pair=s.Pair,e.Scalar=c.Scalar,e.YAMLMap=l.YAMLMap,e.YAMLSeq=u.YAMLSeq,e.Lexer=d.Lexer,e.LineCounter=f.LineCounter,e.Parser=p.Parser,e.parse=m.parse,e.parseAllDocuments=m.parseAllDocuments,e.parseDocument=m.parseDocument,e.stringify=m.stringify,e.visit=h.visit,e.visitAsync=h.visitAsync})))();function parseInstalledVpVersion(e){return(e.match(/^\s*vp\s+v?(\d[^\s]*)/im)??e.match(/Global:\s*v?(\d[^\s]*)/i))?.[1]??`unknown`}const nt=/* @__PURE__ */ new Set([`true`,`True`,`TRUE`]),rt=/* @__PURE__ */ new Set([`false`,`False`,`FALSE`]);function parseNodeManager(e){if(e){if(nt.has(e))return!0;if(rt.has(e))return!1;throw Error(`Invalid node-manager input: "${e}". Expected "true", "false", or unset.`)}}function supportsScopedEnv(e){let t=parseInstalledVpVersion(e);if(t.startsWith(`0.0.0-commit.`))return!0;let n=t.match(/^(\d+)\.(\d+)\.(\d+)/);if(!n)throw Error(`Could not determine the installed Vite+ version for env configuration.`);let[,r,i,a]=n.map(Number);return r>0||i>3||i===3&&a>=1}function nodeManagerOffArgs(e){return parseInstalledVpVersion(e).startsWith(`0.0.0-commit.`)&&console.info("setup-vp: node-manager: false requires a preview build that supports `vp env off node`. If this command is unsupported, use a newer preview or a stable release. setup-vp will not fall back to disabling package-manager management."),supportsScopedEnv(e)?[`env`,`off`,`node`]:[`env`,`off`]}const it=[`npm`,`pnpm`,`yarn`,`bun`];function parsePackageManager(e){if(!e?.trim())return;let t;try{t=(0,J.parse)(e)}catch(e){throw Error(`Invalid package-manager input: ${String(e)}`)}if(t!==``){if(typeof t==`boolean`)return t;if(t&&typeof t==`object`&&!Array.isArray(t)){for(let[e,n]of Object.entries(t))if(!it.includes(e)||typeof n!=`boolean`)throw Error(`Invalid package-manager input: ${e} must be npm, pnpm, yarn, or bun with a boolean value.`);return t}throw Error(`Invalid package-manager input: expected a boolean or a mapping of npm, pnpm, yarn, and bun to booleans.`)}}function packageManagerArgs(e,t){if(e===void 0)return[];if(!supportsScopedEnv(t))throw Error(`package-manager configuration requires Vite+ 0.3.1 or newer.`);return typeof e==`boolean`?e?[]:[[`env`,`off`,`pm`]]:it.filter(t=>e[t]===!1).map(e=>[`env`,`off`,e])}const Y=`Vite+`,X=`vite-plus`;function resolvePath$1(e,t){return f.isAbsolute(e)?e:f.join(t,e)}function isWithin(e,t){let n=f.relative(t,e);return!f.isAbsolute(n)&&n!==`..`&&!n.startsWith(`..${f.sep}`)}function resolveProjectDirectory(e){let{workingDirectory:t,workspaceRoot:n}=e,r=f.isAbsolute(t)?t:f.join(n,t);try{if(!u(r).isDirectory())throw Error(`working-directory is not a directory: ${t} (resolved to ${r})`)}catch(e){throw e instanceof Error&&`code`in e&&e.code===`ENOENT`?Error(`working-directory not found: ${t} (resolved to ${r})`):e}return r}function isWindows(e=process.platform){return e===`win32`}function run(e,t,n={}){let r=x(e,t,{stdio:`inherit`,...n});if(r.error)throw r.error;if(r.status!==0)throw Error(`${e} ${t.join(` `)} exited with code ${r.status??1}`)}function runWithOutput(e,t,n={}){return new Promise((r,i)=>{let a=b(e,t,{...n,stdio:[`ignore`,`pipe`,`pipe`]}),o=``,s=``;a.stdout.on(`data`,e=>{process.stdout.write(e),o=(o+e.toString()).slice(-4e3)}),a.stderr.on(`data`,e=>{process.stderr.write(e),s=(s+e.toString()).slice(-4e3)}),a.on(`error`,i),a.on(`close`,e=>r({exitCode:e??1,stdout:o,stderr:s}))})}function commandPath(e,r=process.env){if(!e||e===`.`||e===`..`||/[\\/:]/.test(e))return;let i=isWindows(),a=i?Object.keys(r).sort().find(e=>e.toUpperCase()===`PATH`):`PATH`,o=a&&r[a]||``,s=i&&!e.toLowerCase().endsWith(`.exe`)?`${e}.exe`:e,c=u(process.cwd(),{bigint:!0});for(let e of o.split(f.delimiter)){let r=i?e.replace(/^"(.*)"$/,`$1`):e;if(f.isAbsolute(r))try{let e=u(r,{bigint:!0});if(e.dev===c.dev&&e.ino===c.ino)continue;let a=f.join(r,s);if(!u(a).isFile())continue;return t(a,i?n.F_OK:n.X_OK),a}catch{}}}function getCommandOutput(e,t,n){let r=x(e,t,{cwd:n?.cwd,encoding:`utf8`,stdio:[`ignore`,`pipe`,`pipe`]});if(r.status===0)return r.stdout.trim()}const at=[{filename:`pnpm-lock.yaml`,type:`pnpm`},{filename:`bun.lockb`,type:`bun`},{filename:`bun.lock`,type:`bun`},{filename:`package-lock.json`,type:`npm`},{filename:`npm-shrinkwrap.json`,type:`npm`},{filename:`yarn.lock`,type:`yarn`}];function resolvePath(e,t){return h(e)?e:g(t,e)}function inferLockFileType(e,t){return t.includes(`pnpm`)?{type:`pnpm`,path:e,filename:t}:t.includes(`yarn`)?{type:`yarn`,path:e,filename:t}:t.startsWith(`bun.`)?{type:`bun`,path:e,filename:t}:{type:`npm`,path:e,filename:t}}function detectLockFile(e,t){if(e){let n=resolvePath(e,t);if(i(n)){let e=p(n),t=at.find(t=>t.filename===e);return t?{type:t.type,path:n,filename:e}:inferLockFileType(n,e)}return}let n=c(t);for(let e of at)if(n.includes(e.filename)){let n=g(t,e.filename);return{type:e.type,path:n,filename:e.filename}}}function prepareCacheMetadata(e){let{projectDir:t,cacheDependencyPath:n,logWarning:r}=e,i=detectLockFile(n||void 0,t);if(!i)return r?.(`setup-vp: cache is enabled but no supported lock file was found; skipping cache.`),{ready:!1};let a=getCommandOutput(`vp`,[`pm`,`cache`,`dir`],{cwd:f.dirname(i.path)});return a?{ready:!0,cachePath:a,lockFile:i.path,lockType:i.type}:(r?.(`setup-vp: could not resolve package-manager cache directory for ${i.filename}; skipping cache.`),{ready:!1})}function createLockfileResolver(e){let{getWorkspaceDir:t,info:n,debug:r}=e,a=/^\d+\.\d+\.\d+/;function tryResolveVitePlusVersionFromLockfile(e,t){let i=detectLockfileForProject(e,t);if(!i)return;let a=i.filename.endsWith(`.lockb`)?textBunLockBeside(i):i;if(!a){r(`Cannot read ${i.filename} (binary) to resolve the ${Y} version; using "latest". Use the text bun.lock, or set the \`version\` input.`);return}let o=parseVitePlusVersionFromLockfile(a,workspaceSubPath(m(a.path),e));if(o)return n(`Resolved ${Y} version '${o}' from ${a.filename}`),o;r(`No ${Y} version found in ${a.path}`)}function detectLockfileForProject(e,n){if(n)return detectLockFile(n,e);let r=t(),i=e;for(;;){let e=detectLockFile(void 0,i);if(e)return e;let t=m(i);if(i===r||t===i||!isWithin(t,r))break;i=t}}function textBunLockBeside(e){let t=g(m(e.path),`bun.lock`);return i(t)?{type:`bun`,path:t,filename:`bun.lock`}:void 0}function workspaceSubPath(e,t){if(!isWithin(t,e))return``;let n=_(e,t);return n?n.split(v).join(`/`):``}function parseVitePlusVersionFromLockfile(e,t=``){if(e.filename.endsWith(`.lockb`))return;let n;try{n=s(e.path,`utf-8`)}catch{return}let r;switch(e.type){case`npm`:r=fromNpmLock(n,t);break;case`pnpm`:r=fromPnpmLock(n,t);break;case`yarn`:r=fromYarnLock(n);break;case`bun`:r=fromBunTextLock(n);break;default:return}return r&&a.test(r)?r:void 0}function fromNpmLock(e,t){let n;try{n=JSON.parse(e)}catch{return}let r=n.packages;if(t){let e=r?.[`${t}/node_modules/${X}`]?.version;if(typeof e==`string`)return e;if(!npmPackageDeclaresVitePlus(r?.[t]))return}let i=r?.[`node_modules/${X}`]?.version;if(typeof i==`string`)return i;let a=n.dependencies?.[X]?.version;return typeof a==`string`?a:void 0}function npmPackageDeclaresVitePlus(e){if(!e)return!1;for(let t of[`dependencies`,`devDependencies`]){let n=e[t];if(n&&typeof n==`object`&&`vite-plus`in n)return!0}return!1}function fromPnpmLock(e,t){let n;try{n=(0,J.parse)(e)}catch{return}if(!n||typeof n!=`object`)return;let r=n,i=r.importers;if(i&&typeof i==`object`){let e=t||`.`;return e in i?pnpmImporterVersion(i[e]):void 0}return pnpmImporterVersion(r)||e.match(/^\s*\/?vite-plus@(\d+\.\d+\.\d+[^\s():'"]*)/m)?.[1]}function pnpmImporterVersion(e){if(!e||typeof e!=`object`)return;let t=e;for(let e of[`dependencies`,`devDependencies`,`optionalDependencies`]){let n=t[e];if(n&&typeof n==`object`){let e=n[X],t=typeof e==`string`?e:e?.version;if(typeof t==`string`){let e=t.replace(/\(.*$/,``).trim();if(a.test(e))return e}}}}function fromYarnLock(e){let t=/* @__PURE__ */ new Set,n=e.split(/\r?\n/);for(let e=0;ee,info:console.info,debug:()=>{},warning:console.warn}}const ot=`https://raw.githubusercontent.com/voidzero-dev/vite-plus`,st=`packages/cli`,ct=/^0\.0\.0-commit\.([0-9a-f]{40})$/i,lt=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;function pkgPrNewCommitSha(e){return e.match(ct)?.[1]}function getInstallScriptUrls(e,t=process.platform){let n=isWindows(t)?`install.ps1`:`install.sh`,r=installScriptRef(e);return{pinned:r?[`${ot}/${r}/${st}/${n}`,`https://cdn.jsdelivr.net/gh/voidzero-dev/vite-plus@${r}/${st}/${n}`]:[],latest:[`https://viteplus.dev/${n}`,`${ot}/main/${st}/${n}`]}}function installScriptRef(e){let t=pkgPrNewCommitSha(e);if(t)return t.toLowerCase();if(lt.test(e))return`v${e}`}function readNpmrc(e){try{return s(e,`utf8`)}catch(e){if(e.code===`ENOENT`)return``;throw e}}function analyzeProjectNpmrc(e){let t=/* @__PURE__ */ new Set;for(let n of e.split(/\r?\n/)){let e=n.trim();if(!e||e.startsWith(`;`)||e.startsWith(`#`))continue;let r=e.indexOf(`=`);if(r<0)continue;let i=e.slice(r+1).trim();for(let e of i.matchAll(/\$\{(\w+)\}/g))t.add(e[1])}return{envVarRefs:t}}function readUserConfigLines(e,t){let n=e.HOME||e.USERPROFILE,r=e.NPM_CONFIG_USERCONFIG||e.PNPM_CONFIG_USERCONFIG||n&&p.join(n,`.npmrc`);return(r?readNpmrc(r):``).split(/\r?\n/).filter(e=>!t.has(e.split(`=`)[0].trim().toLowerCase()))}function isReservedAuthVariable(e){return[`GITHUB_TOKEN`,`CI_JOB_TOKEN`,`SYSTEM_ACCESSTOKEN`].includes(e)?!1:/^(?:PATH|HOME|USERPROFILE|TMPDIR|CI)$/i.test(e)||/^(?:SETUP_VP_|RUNNER_|GITHUB_|CI_|SYSTEM_|AGENT_|BUILD_|RELEASE_)/i.test(e)}function writeUserConfig(e,t,n){let r=o(p.join(w(),`setup-vp-npmrc-`)),i=p.join(r,`.npmrc`);f(i,e,{encoding:`utf8`,mode:384});for(let e of[`NPM_CONFIG_USERCONFIG`,`PNPM_CONFIG_USERCONFIG`])t[e]=i,n?.(e,i);return i}function configureAuth(e,t,n,r,i){if(!e){if(!i)return;let{envVarRefs:e}=analyzeProjectNpmrc(readNpmrc(p.join(i,`.npmrc`)));for(let t of e)!isReservedAuthVariable(t)&&n[t]&&r?.(t,n[t]);return}let a;try{a=new URL(e)}catch{throw Error(`Invalid registry-url: "${e}". Must be a valid URL.`)}let o=a.href.endsWith(`/`)?a.href:`${a.href}/`,s=``;t&&(s=`${(t.startsWith(`@`)?t:`@${t}`).toLowerCase()}:`);let c=o.replace(/^\w+:/,``).toLowerCase(),l=readUserConfigLines(n,/* @__PURE__ */ new Set([`${s}registry`,`${c}:_authtoken`]));l.push(`${c}:_authToken=\${NODE_AUTH_TOKEN}`,`${s}registry=${o}`);let u=writeUserConfig(l.filter(Boolean).join(` +`)){let e=t.trim();if(!e||e.startsWith(`#`))continue;let[n,...r]=e.split(/\s+/);if(n===`nodejs`||n===`node`){for(let e of r)if(isAsdfInstallableVersion(e))return e}}}function isAsdfInstallableVersion(e){return!!e&&e!==`system`&&!e.startsWith(`ref:`)&&!e.startsWith(`path:`)}function parsePackageJson(e){let t;try{t=JSON.parse(e)}catch{throw Error(`Failed to parse package.json: invalid JSON`)}let n=t.devEngines;if(n?.runtime){let e=findNodeRuntime(n.runtime);if(e)return e}let r=t.engines;if(r?.node&&typeof r.node==`string`)return r.node}function findNodeRuntime(e){let t=Array.isArray(e)?e:[e];for(let e of t)if(e?.name===`node`&&typeof e.version==`string`)return e.version}return{resolveNodeVersionFile}}function resolutionContext(e){return{getWorkspaceDir:()=>e,info:console.info,debug:()=>{},warning:console.warn}}const ot=`https://raw.githubusercontent.com/voidzero-dev/vite-plus`,Z=`packages/cli`,st=/^0\.0\.0-commit\.([0-9a-f]{40})$/i,ct=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;function pkgPrNewCommitSha(e){return e.match(st)?.[1]}function getInstallScriptUrls(e,t=process.platform){let n=isWindows(t)?`install.ps1`:`install.sh`,r=installScriptRef(e);return{pinned:r?[`${ot}/${r}/${Z}/${n}`,`https://cdn.jsdelivr.net/gh/voidzero-dev/vite-plus@${r}/${Z}/${n}`]:[],latest:[`https://viteplus.dev/${n}`,`${ot}/main/${Z}/${n}`]}}function installScriptRef(e){let t=pkgPrNewCommitSha(e);if(t)return t.toLowerCase();if(ct.test(e))return`v${e}`}function readNpmrc(e){try{return s(e,`utf8`)}catch(e){if(e.code===`ENOENT`)return``;throw e}}function analyzeProjectNpmrc(e){let t=/* @__PURE__ */ new Set;for(let n of e.split(/\r?\n/)){let e=n.trim();if(!e||e.startsWith(`;`)||e.startsWith(`#`))continue;let r=e.indexOf(`=`);if(r<0)continue;let i=e.slice(r+1).trim();for(let e of i.matchAll(/\$\{(\w+)\}/g))t.add(e[1])}return{envVarRefs:t}}function readUserConfigLines(e,t){let n=e.HOME||e.USERPROFILE,r=e.NPM_CONFIG_USERCONFIG||e.PNPM_CONFIG_USERCONFIG||n&&f.join(n,`.npmrc`);return(r?readNpmrc(r):``).split(/\r?\n/).filter(e=>!t.has(e.split(`=`)[0].trim().toLowerCase()))}function isReservedAuthVariable(e){return[`GITHUB_TOKEN`,`CI_JOB_TOKEN`,`SYSTEM_ACCESSTOKEN`].includes(e)?!1:/^(?:PATH|HOME|USERPROFILE|TMPDIR|CI)$/i.test(e)||/^(?:SETUP_VP_|RUNNER_|GITHUB_|CI_|SYSTEM_|AGENT_|BUILD_|RELEASE_)/i.test(e)}function writeUserConfig(e,t,n){let r=o(f.join(C(),`setup-vp-npmrc-`)),i=f.join(r,`.npmrc`);d(i,e,{encoding:`utf8`,mode:384});for(let e of[`NPM_CONFIG_USERCONFIG`,`PNPM_CONFIG_USERCONFIG`])t[e]=i,n?.(e,i);return i}function configureAuth(e,t,n,r,i){if(!e){if(!i)return;let{envVarRefs:e}=analyzeProjectNpmrc(readNpmrc(f.join(i,`.npmrc`)));for(let t of e)!isReservedAuthVariable(t)&&n[t]&&r?.(t,n[t]);return}let a;try{a=new URL(e)}catch{throw Error(`Invalid registry-url: "${e}". Must be a valid URL.`)}let o=a.href.endsWith(`/`)?a.href:`${a.href}/`,s=``;t&&(s=`${(t.startsWith(`@`)?t:`@${t}`).toLowerCase()}:`);let c=o.replace(/^\w+:/,``).toLowerCase(),l=readUserConfigLines(n,/* @__PURE__ */ new Set([`${s}registry`,`${c}:_authtoken`]));l.push(`${c}:_authToken=\${NODE_AUTH_TOKEN}`,`${s}registry=${o}`);let u=writeUserConfig(l.filter(Boolean).join(` `)+` -`,n,r);return n.NODE_AUTH_TOKEN=n.NODE_AUTH_TOKEN||`XXXXX-XXXXX-XXXXX-XXXXX`,r?.(`NODE_AUTH_TOKEN`,n.NODE_AUTH_TOKEN),u}function resolveSfwEnabled(e,t,n){return e?!pkgPrNewCommitSha(t)||(n(`sfw was requested but is automatically disabled for Vite+ preview build ${t}; Socket Firewall Free will not be used.`),!1):!1}const Q=`v1.15.4`,ut=`https://github.com/SocketDev/sfw-free/releases/download/${Q}`;function isMuslLinux(){if(process.platform!==`linux`)return!1;try{let e=process.report?.getReport();if(e?.header&&!e.header.glibcVersionRuntime)return!0}catch{}return i(`/etc/alpine-release`)}function getSfwAssetName(e,t,n){if(e===`darwin`){if(t===`arm64`)return`sfw-free-macos-arm64`;if(t===`x64`)return`sfw-free-macos-x86_64`}else if(e===`linux`){if(t===`arm64`)return n?`sfw-free-musl-linux-arm64`:`sfw-free-linux-arm64`;if(t===`x64`)return n?`sfw-free-musl-linux-x86_64`:`sfw-free-linux-x86_64`}else if(isWindows(e)){if(t===`arm64`)return`sfw-free-windows-arm64.exe`;if(t===`x64`)return`sfw-free-windows-x86_64.exe`}throw Error(`Unsupported platform/arch for sfw: ${e}/${t}${e===`linux`?` (${n?`musl`:`glibc`})`:``}`)}function downloadFileWithShell(e,t,n){let r=Math.max(1,Math.ceil(n/1e3)),i=commandPath(`curl`);if(i){let n=S(i,[`-fsSL`,`--connect-timeout`,`5`,`--max-time`,String(r),e,`-o`,t],{stdio:`ignore`});if(n.status===0)return;throw n.error||/* @__PURE__ */ Error(`curl failed while downloading ${e}`)}let a=commandPath(`wget`);if(a){let n=S(a,[`-q`,`-T`,String(r),`-t`,`2`,`-O`,t,e],{stdio:`ignore`});if(n.status===0)return;throw n.error||/* @__PURE__ */ Error(`wget failed while downloading ${e}`)}throw Error(`curl or wget is required to download sfw`)}function downloadFile(e,t,n=0,i=6e4,a){return n>5?Promise.reject(/* @__PURE__ */ Error(`too many redirects while downloading ${e}`)):a?new Promise((o,s)=>{let c=!1,finish=e=>{c||(c=!0,clearTimeout(u),e?s(e):o())},l=a(e,o=>{let s=o.statusCode??0,c=o.headers.location;if(s>=300&&s<400&&c){o.resume(),downloadFile(new URL(c,e).toString(),t,n+1,i,a).then(()=>finish(),finish);return}if(s!==200){o.resume(),finish(/* @__PURE__ */ Error(`download failed with HTTP ${s}: ${e}`));return}let l=r(t);o.pipe(l),l.on(`finish`,()=>l.close(()=>finish())),l.on(`error`,finish)}),u=setTimeout(()=>{l.destroy(/* @__PURE__ */ Error(`download timed out after ${i}ms: ${e}`))},i);l.on(`error`,finish)}):(downloadFileWithShell(e,t,i),Promise.resolve())}async function setupSfw(e,t={}){let n=t.env??process.env,r=t.sfwEnabled??n.SETUP_VP_SFW===`true`,i=t.platform??process.platform,a=t.arch??process.arch,o=t.isMusl??isMuslLinux(),s=t.download??downloadFile;if(!resolveSfwEnabled(r,t.vitePlusVersion??``,t.logWarning??console.warn))return`vp`;if(e.length===0)return console.log(`setup-vp: sfw was requested but run-install is disabled; sfw will not be invoked.`),`vp`;let c=commandPath(`sfw`,n);if(c)return console.log(`setup-vp: using existing sfw on PATH: ${c}`),`sfw`;let l;try{l=getSfwAssetName(i,a,o)}catch{return console.error(`setup-vp: sfw has no published binary for this runner's platform/architecture (process.platform=${i}, process.arch=${a}, musl=${o}) and none was found on PATH; falling back to plain vp install.`),`vp`}let u=t.cacheDirectory||n.SETUP_VP_SFW_CACHE_DIR,d=u?p.join(u,Q,l):await ee(p.join(w(),`setup-vp-sfw-`));await E(d,{recursive:!0});let f=p.join(d,isWindows(i)?`sfw.exe`:`sfw`),m=`${ut}/${l}`;function activate(){let e=isWindows(i)?`;`:`:`;return n.PATH=`${d}${e}${n.PATH||``}`,t.exportVariable?.(`PATH`,n.PATH),`sfw`}if(await re(f).then(e=>e.isFile()&&e.size>0,()=>!1))return console.log(`setup-vp: using cached sfw ${Q}: ${f}`),activate();for(let e=1;e<=2;e+=1){let t=await ee(p.join(d,`.download-`)),n=p.join(t,`sfw`);try{if(console.log(`setup-vp: installing sfw ${Q} from ${m}`),await s(m,n),(await re(n)).size===0)throw Error(`Downloaded sfw binary is empty`);return await T(n,493),await te(n,f),activate()}catch(t){if(e===2)throw t;await new Promise(e=>setTimeout(e,2e3))}finally{await ne(t,{recursive:!0,force:!0})}}throw Error(`failed to install sfw after retrying`)}function isRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function validateRunInstallEntry(e){if(!isRecord(e))throw Error(`run-install entries must be objects`);for(let t of Object.keys(e))if(t!==`cwd`&&t!==`args`)throw Error(`unsupported run-install key: ${t}`);let t={};if(e.cwd!==void 0){if(typeof e.cwd!=`string`)throw Error(`run-install.cwd must be a string`);t.cwd=e.cwd}if(e.args!==void 0){if(!Array.isArray(e.args)||e.args.some(e=>typeof e!=`string`))throw Error(`run-install.args must be an array of strings`);t.args=e.args}return t}function validateRunInstallInput(e){return e===null||typeof e==`boolean`?e:Array.isArray(e)?e.map(validateRunInstallEntry):validateRunInstallEntry(e)}function parseRunInstall(e){let t=validateRunInstallInput((0,Y.parse)(e)??null);return t?t===!0?[{}]:Array.isArray(t)?t:[t]:[]}function isSfwVpNotFoundFlake(e,t){return/Command 'vp' not found in PATH/.test(e+` -`+t)}async function runInstall(e,t,n,r=process.env,i={}){let a={...r};delete a.SETUP_VP_ENV_FILE;let o=i.execute??runWithOutput,s=[];for(let r of e){let e=r.cwd?p.resolve(t,r.cwd):t,c=[`install`,...r.args||[]],l=n===`sfw`?[`vp`,...c]:c,u=`${n} ${l.join(` `)} (cwd: ${e})`;console.log(`setup-vp: running ${u}`);try{let t=await o(n,l,{cwd:e,env:a});if(t.exitCode!==0&&n===`sfw`&&isSfwVpNotFoundFlake(t.stdout,t.stderr)){let r=isWindows(i.platform);if(console.warn(r?`setup-vp: sfw could not resolve vp; warming the PowerShell command cache and retrying once.`:`setup-vp: sfw could not resolve vp; retrying once.`),r)try{await o(`powershell.exe`,[`-NoProfile`,`-Command`,`Get-Command vp`],{cwd:e,env:a})}catch{}t=await o(n,l,{cwd:e,env:a})}t.exitCode!==0&&s.push(`${u} exited with code ${t.exitCode}\n${t.stderr.trim()||t.stdout.trim()}`)}catch(e){s.push(`${u}: ${String(e)}`)}}if(s.length)throw Error(s.join(` +`,n,r);return n.NODE_AUTH_TOKEN=n.NODE_AUTH_TOKEN||`XXXXX-XXXXX-XXXXX-XXXXX`,r?.(`NODE_AUTH_TOKEN`,n.NODE_AUTH_TOKEN),u}function resolveSfwEnabled(e,t,n){return e?!pkgPrNewCommitSha(t)||(n(`sfw was requested but is automatically disabled for Vite+ preview build ${t}; Socket Firewall Free will not be used.`),!1):!1}const Q=`v1.15.4`,lt=`https://github.com/SocketDev/sfw-free/releases/download/${Q}`;function isMuslLinux(){if(process.platform!==`linux`)return!1;try{let e=process.report?.getReport();if(e?.header&&!e.header.glibcVersionRuntime)return!0}catch{}return i(`/etc/alpine-release`)}function getSfwAssetName(e,t,n){if(e===`darwin`){if(t===`arm64`)return`sfw-free-macos-arm64`;if(t===`x64`)return`sfw-free-macos-x86_64`}else if(e===`linux`){if(t===`arm64`)return n?`sfw-free-musl-linux-arm64`:`sfw-free-linux-arm64`;if(t===`x64`)return n?`sfw-free-musl-linux-x86_64`:`sfw-free-linux-x86_64`}else if(isWindows(e)){if(t===`arm64`)return`sfw-free-windows-arm64.exe`;if(t===`x64`)return`sfw-free-windows-x86_64.exe`}throw Error(`Unsupported platform/arch for sfw: ${e}/${t}${e===`linux`?` (${n?`musl`:`glibc`})`:``}`)}function downloadFileWithShell(e,t,n){let r=Math.max(1,Math.ceil(n/1e3)),i=commandPath(`curl`);if(i){let n=x(i,[`-fsSL`,`--connect-timeout`,`5`,`--max-time`,String(r),e,`-o`,t],{stdio:`ignore`});if(n.status===0)return;throw n.error||/* @__PURE__ */ Error(`curl failed while downloading ${e}`)}let a=commandPath(`wget`);if(a){let n=x(a,[`-q`,`-T`,String(r),`-t`,`2`,`-O`,t,e],{stdio:`ignore`});if(n.status===0)return;throw n.error||/* @__PURE__ */ Error(`wget failed while downloading ${e}`)}throw Error(`curl or wget is required to download sfw`)}function downloadFile(e,t,n=0,i=6e4,a){return n>5?Promise.reject(/* @__PURE__ */ Error(`too many redirects while downloading ${e}`)):a?new Promise((o,s)=>{let c=!1,finish=e=>{c||(c=!0,clearTimeout(u),e?s(e):o())},l=a(e,o=>{let s=o.statusCode??0,c=o.headers.location;if(s>=300&&s<400&&c){o.resume(),downloadFile(new URL(c,e).toString(),t,n+1,i,a).then(()=>finish(),finish);return}if(s!==200){o.resume(),finish(/* @__PURE__ */ Error(`download failed with HTTP ${s}: ${e}`));return}let l=r(t);o.pipe(l),l.on(`finish`,()=>l.close(()=>finish())),l.on(`error`,finish)}),u=setTimeout(()=>{l.destroy(/* @__PURE__ */ Error(`download timed out after ${i}ms: ${e}`))},i);l.on(`error`,finish)}):(downloadFileWithShell(e,t,i),Promise.resolve())}async function setupSfw(e,t={}){let n=t.env??process.env,r=t.sfwEnabled??n.SETUP_VP_SFW===`true`,i=t.platform??process.platform,a=t.arch??process.arch,o=t.isMusl??isMuslLinux(),s=t.download??downloadFile;if(!resolveSfwEnabled(r,t.vitePlusVersion??``,t.logWarning??console.warn))return{executable:`vp`,sfw:!1};if(e.length===0)return console.log(`setup-vp: sfw was requested but run-install is disabled; sfw will not be invoked.`),{executable:`vp`,sfw:!1};let c=commandPath(`sfw`,n);if(c)return console.log(`setup-vp: using existing sfw on PATH: ${c}`),{executable:c,sfw:!0};let l;try{l=getSfwAssetName(i,a,o)}catch{return console.error(`setup-vp: sfw has no published binary for this runner's platform/architecture (process.platform=${i}, process.arch=${a}, musl=${o}) and none was found on PATH; falling back to plain vp install.`),{executable:`vp`,sfw:!1}}let u=t.cacheDirectory||n.SETUP_VP_SFW_CACHE_DIR,d=u?f.resolve(u,Q,l):await E(f.resolve(C(),`setup-vp-sfw-`));await T(d,{recursive:!0});let p=f.join(d,isWindows(i)?`sfw.exe`:`sfw`),m=`${lt}/${l}`;function activate(){let e=isWindows(i)?`;`:`:`;return n.PATH=`${d}${e}${n.PATH||``}`,t.exportVariable?.(`PATH`,n.PATH),{executable:p,sfw:!0}}if(await ne(p).then(e=>e.isFile()&&e.size>0,()=>!1))return console.log(`setup-vp: using cached sfw ${Q}: ${p}`),activate();for(let e=1;e<=2;e+=1){let t=await E(f.join(d,`.download-`)),n=f.join(t,`sfw`);try{if(console.log(`setup-vp: installing sfw ${Q} from ${m}`),await s(m,n),(await ne(n)).size===0)throw Error(`Downloaded sfw binary is empty`);return await w(n,493),await ee(n,p),activate()}catch(t){if(e===2)throw t;await new Promise(e=>setTimeout(e,2e3))}finally{await te(t,{recursive:!0,force:!0})}}throw Error(`failed to install sfw after retrying`)}function isRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function validateRunInstallEntry(e){if(!isRecord(e))throw Error(`run-install entries must be objects`);for(let t of Object.keys(e))if(t!==`cwd`&&t!==`args`)throw Error(`unsupported run-install key: ${t}`);let t={};if(e.cwd!==void 0){if(typeof e.cwd!=`string`)throw Error(`run-install.cwd must be a string`);t.cwd=e.cwd}if(e.args!==void 0){if(!Array.isArray(e.args)||e.args.some(e=>typeof e!=`string`))throw Error(`run-install.args must be an array of strings`);t.args=e.args}return t}function validateRunInstallInput(e){return e===null||typeof e==`boolean`?e:Array.isArray(e)?e.map(validateRunInstallEntry):validateRunInstallEntry(e)}function parseRunInstall(e){let t=validateRunInstallInput((0,J.parse)(e)??null);return t?t===!0?[{}]:Array.isArray(t)?t:[t]:[]}function isSfwVpNotFoundFlake(e,t){return/Command 'vp' not found in PATH/.test(e+` +`+t)}async function runInstall(e,t,n,r=process.env,i={}){let a={...r};delete a.SETUP_VP_ENV_FILE;let o=i.execute??runWithOutput,{executable:s,sfw:c}=n,l=[];for(let n of e){let e=n.cwd?f.resolve(t,n.cwd):t,r=[`install`,...n.args||[]],u=c?[`vp`,...r]:r,d=`${s} ${u.join(` `)} (cwd: ${e})`;console.log(`setup-vp: running ${d}`);try{let t=await o(s,u,{cwd:e,env:a});if(t.exitCode!==0&&c&&isSfwVpNotFoundFlake(t.stdout,t.stderr)){let n=isWindows(i.platform);if(console.warn(n?`setup-vp: sfw could not resolve vp; warming the PowerShell command cache and retrying once.`:`setup-vp: sfw could not resolve vp; retrying once.`),n)try{await o(`powershell.exe`,[`-NoProfile`,`-Command`,`Get-Command vp`],{cwd:e,env:a})}catch{}t=await o(s,u,{cwd:e,env:a})}t.exitCode!==0&&l.push(`${d} exited with code ${t.exitCode}\n${t.stderr.trim()||t.stdout.trim()}`)}catch(e){l.push(`${d}: ${String(e)}`)}}if(l.length)throw Error(l.join(` `))}function escapeLoggingCommandData(e){return e.replaceAll(`%`,`%AZP25`).replaceAll(`\r`,`%0D`).replaceAll(` -`,`%0A`).replaceAll(`;`,`%3B`).replaceAll(`]`,`%5D`)}function prependPath(e){process.stdout.write(`##vso[task.prependpath]${escapeLoggingCommandData(e)}\n`)}function setVariable(e,t,n={}){let r=[`variable=${e}`];n.isOutput&&r.push(`isOutput=true`),n.isReadonly&&r.push(`isReadonly=true`),n.isSecret&&r.push(`issecret=true`),process.stdout.write(`##vso[task.setvariable ${r.join(`;`)}]${escapeLoggingCommandData(t)}\n`)}function logWarning(e){process.stdout.write(`##vso[task.logissue type=warning]${escapeLoggingCommandData(e)}\n`)}function logInfo(e){console.log(e)}const $=`SETUP_VP_DIRS_FILE`;function getVitePlusBinDirs(e){let t=_(e.data,`fallback-bin`);return d(t,{throwIfNoEntry:!1})?.isDirectory()?{bin:e.bin,fallbackBin:t}:{bin:e.bin}}function appendFallbackBinToPath(e,t,n=process.platform){let r=isWindows(n)?`;`:`:`;return[...e?e.split(r).filter(e=>e!==t):[],t].join(r)}const dt=/^v?(\d+)\.(\d+)\.\d+(?:-[0-9A-Za-z.-]+)?$/;function supportsVitePlusDirs(e){if(pkgPrNewCommitSha(e))return!0;let t=e.match(dt);if(!t)return!0;let n=Number(t[1]),r=Number(t[2]);return n>0||r>=3}function createVitePlusDirsFile(){return _(w(),`setup-vp-dirs-${ae()}.txt`)}function removeVitePlusDirsFile(e){u(e,{force:!0})}function readVitePlusProbe(e){try{return s(e,`utf8`)}catch(e){if(e.code===`ENOENT`)return;throw e}}function resolveVitePlusBinDirs(e,t,n){if(!t){if(!supportsVitePlusDirs(e))return{bin:n};throw Error(`Vite+ was installed successfully, but setup-vp could not resolve its VpDirs.`)}let r=readVitePlusProbe(t),i=r===void 0?void 0:parseVitePlusDirs(r);if(i)return getVitePlusBinDirs(i);if(!(pkgPrNewCommitSha(e)!==void 0||dt.test(e))&&r!==void 0){let e=parseInstalledVpVersion(r);if(e!==`unknown`&&!supportsVitePlusDirs(e))return{bin:n}}throw Error(`Vite+ was installed successfully, but setup-vp could not resolve its VpDirs.`)}function parseVitePlusDirs(e){let t=/* @__PURE__ */ new Map;for(let n of e.split(/\r?\n/)){let e=n.indexOf(` `);if(e<1)continue;let r=n.slice(0,e).replace(/^\uFEFF/,``),i=n.slice(e+1).trim();i&&t.set(r,i)}let n=t.get(`data`),r=t.get(`bin`),i=t.get(`cache`),a=t.get(`config`),o=t.get(`state`);if(n&&r&&i&&a&&o)return{data:n,bin:r,cache:i,config:a,state:o}}function getInstallScriptCommand(e,t=process.platform,n=!0){if(isWindows(t))return n?{command:`pwsh`,args:[`-Command`,` +`,`%0A`).replaceAll(`;`,`%3B`).replaceAll(`]`,`%5D`)}function prependPath(e){process.stdout.write(`##vso[task.prependpath]${escapeLoggingCommandData(e)}\n`)}function setVariable(e,t,n={}){let r=[`variable=${e}`];n.isOutput&&r.push(`isOutput=true`),n.isReadonly&&r.push(`isReadonly=true`),n.isSecret&&r.push(`issecret=true`),process.stdout.write(`##vso[task.setvariable ${r.join(`;`)}]${escapeLoggingCommandData(t)}\n`)}function logWarning(e){process.stdout.write(`##vso[task.logissue type=warning]${escapeLoggingCommandData(e)}\n`)}function logInfo(e){console.log(e)}const $=`SETUP_VP_DIRS_FILE`;function getVitePlusBinDirs(e){let t=g(e.data,`fallback-bin`);return u(t,{throwIfNoEntry:!1})?.isDirectory()?{bin:e.bin,fallbackBin:t}:{bin:e.bin}}function appendFallbackBinToPath(e,t,n=process.platform){let r=isWindows(n)?`;`:`:`;return[...e?e.split(r).filter(e=>e!==t):[],t].join(r)}const ut=/^v?(\d+)\.(\d+)\.\d+(?:-[0-9A-Za-z.-]+)?$/;function supportsVitePlusDirs(e){if(pkgPrNewCommitSha(e))return!0;let t=e.match(ut);if(!t)return!0;let n=Number(t[1]),r=Number(t[2]);return n>0||r>=3}function createVitePlusDirsFile(){return g(C(),`setup-vp-dirs-${ie()}.txt`)}function removeVitePlusDirsFile(e){l(e,{force:!0})}function readVitePlusProbe(e){try{return s(e,`utf8`)}catch(e){if(e.code===`ENOENT`)return;throw e}}function resolveVitePlusBinDirs(e,t,n){if(!t){if(!supportsVitePlusDirs(e))return{bin:n};throw Error(`Vite+ was installed successfully, but setup-vp could not resolve its VpDirs.`)}let r=readVitePlusProbe(t),i=r===void 0?void 0:parseVitePlusDirs(r);if(i)return getVitePlusBinDirs(i);if(!(pkgPrNewCommitSha(e)!==void 0||ut.test(e))&&r!==void 0){let e=parseInstalledVpVersion(r);if(e!==`unknown`&&!supportsVitePlusDirs(e))return{bin:n}}throw Error(`Vite+ was installed successfully, but setup-vp could not resolve its VpDirs.`)}function parseVitePlusDirs(e){let t=/* @__PURE__ */ new Map;for(let n of e.split(/\r?\n/)){let e=n.indexOf(` `);if(e<1)continue;let r=n.slice(0,e).replace(/^\uFEFF/,``),i=n.slice(e+1).trim();i&&t.set(r,i)}let n=t.get(`data`),r=t.get(`bin`),i=t.get(`cache`),a=t.get(`config`),o=t.get(`state`);if(n&&r&&i&&a&&o)return{data:n,bin:r,cache:i,config:a,state:o}}function getInstallScriptCommand(e,t=process.platform,n=!0){if(isWindows(t))return n?{command:`pwsh`,args:[`-Command`,` $dirsFile = $env:${$} Set-Content -LiteralPath $dirsFile -Value '' -NoNewline -Encoding UTF8 . ([scriptblock]::Create((irm -TimeoutSec 15 ${e}))) @@ -189,4 +189,4 @@ fi set +u set -o pipefail ${r} | bash -`.trim()]}}const ft=2e3;function getVitePlusHome(e=process.platform,t=process.env){let n=isWindows(e)?t.USERPROFILE||C():t.HOME||C();return _(n,`.vite-plus`)}function runInstallCommand(e,t,n=process.platform){let{command:r,args:i}=getInstallScriptCommand(e,n,t.VP_VPDIRS_AWARE===`1`),a={env:{...process.env,...t},stdio:`inherit`},o=S(r,i,a);if(isWindows(n)&&o.error?.code===`ENOENT`&&(o=S(`powershell.exe`,i,a)),o.error)throw o.error;return o.status??1}async function installVitePlus(e,t={}){let n=t.platform??process.platform,r=t.env??process.env,i=t.prependPath,a=t.sleep??ie,o=t.runInstall??runInstallCommand,s=t.logWarningFn??console.warn,c={...Object.fromEntries(Object.entries(r).filter(e=>e[1]!==void 0)),VP_VERSION:e,VITE_PLUS_VERSION:e},l=supportsVitePlusDirs(e)?createVitePlusDirsFile():void 0;l?(c.VP_VPDIRS_AWARE=`1`,c[$]=l):(delete c.VP_VPDIRS_AWARE,delete c[$]);let u=pkgPrNewCommitSha(e);u&&(c.VP_PR_VERSION=u);let{pinned:d,latest:f}=getInstallScriptUrls(e,n),p=d.length+f.length,m=2*p,h=``,g=0;async function tryUrls(e){for(let t=0;t<2;t+=1)for(let t of e){g+=1;try{let e=o(t,c,n);if(e===0)return!0;h=`exit code ${e}`}catch(e){h=e instanceof Error?e.message:String(e)}g0){if(await tryUrls(d)){ensureBinInPath();return}s(`setup-vp: could not fetch the install script pinned to Vite+ ${e}. Falling back to the latest install script. The latest script may not be compatible with ${e}.`)}if(await tryUrls(f)){ensureBinInPath();return}throw Error(`Failed to install Vite+ after ${m} attempts across ${p} URL(s): ${h}`)}finally{l&&removeVitePlusDirsFile(l)}}function parseBoolean(e){return e?.toLowerCase()===`true`}function parseAzureInputs(e){return{version:e.SETUP_VP_VERSION||``,versionFile:e.SETUP_VP_VERSION_FILE||void 0,nodeVersion:e.SETUP_VP_NODE_VERSION||void 0,nodeVersionFile:e.SETUP_VP_NODE_VERSION_FILE||void 0,workingDirectory:e.SETUP_VP_WORKING_DIRECTORY||`.`,runInstall:e.SETUP_VP_RUN_INSTALL??`true`,sfw:parseBoolean(e.SETUP_VP_SFW),nodeManager:parseNodeManager(e.SETUP_VP_NODE_MANAGER),packageManager:parsePackageManager(e.SETUP_VP_PACKAGE_MANAGER),registryUrl:e.SETUP_VP_REGISTRY_URL||``,scope:e.SETUP_VP_SCOPE||``,cache:parseBoolean(e.SETUP_VP_CACHE),cacheDependencyPath:e.SETUP_VP_CACHE_DEPENDENCY_PATH||``,workspaceRoot:e.SYSTEM_DEFAULTWORKINGDIRECTORY||process.cwd()}}function resolveProjectDirFromInputs(e){return resolveProjectDirectory({workingDirectory:e.workingDirectory,workspaceRoot:e.workspaceRoot})}const pt={installVitePlus,prepareCacheMetadata,configureAuth,setupSfw,parseRunInstall,runInstall,getCommandOutput,run,parseInstalledVpVersion,prependPath,setVariable,logWarning,logInfo};function fail(e){console.error(`setup-vp: ${e}`),process.exit(1)}async function runPrepare(e=process.env,t=pt){let n=parseAzureInputs(e),r=resolveProjectDirFromInputs(n);if(n.nodeManager===!1&&(n.nodeVersion||n.nodeVersionFile))throw Error(`node-version and node-version-file cannot be used with node-manager: false`);let i={...resolutionContext(n.workspaceRoot),info:t.logInfo,warning:t.logWarning},o=createVersionResolver(i).resolveVitePlusVersion(n,r),s=n.nodeVersion||(n.nodeVersionFile?createNodeVersionResolver(i).resolveNodeVersionFile(n.nodeVersionFile,r):void 0);t.setVariable(`SETUP_VP_CACHE_HIT`,`false`),t.setVariable(`SETUP_VP_CACHE_READY`,`false`),t.setVariable(`SETUP_VP_SFW_READY`,`false`),t.setVariable(`SETUP_VP_BOOTSTRAP_NODE`,process.execPath),await t.installVitePlus(o,{env:e,prependPath:e=>t.prependPath(e),exportPath:e=>t.setVariable(`PATH`,e),logWarningFn:t.logWarning}),t.setVariable(`SETUP_VP_RESOLVED_VERSION`,o);let c=(n.nodeManager===!1||n.packageManager!==void 0)&&t.getCommandOutput(`vp`,[`--version`])||``,l=packageManagerArgs(n.packageManager,c);n.nodeManager===!1?t.run(`vp`,nodeManagerOffArgs(c)):s&&t.run(`vp`,[`env`,`use`,s],{cwd:r});for(let e of l)t.run(`vp`,e);let u=p.resolve(process.argv[1]||``);if(t.setVariable(`SETUP_VP_RUNTIME_PATH`,u),n.sfw&&!pkgPrNewCommitSha(o)&&t.parseRunInstall(n.runInstall).length>0)try{let r=getSfwAssetName(process.platform,process.arch,isMuslLinux()),i=p.join(e.PIPELINE_WORKSPACE||n.workspaceRoot,`.setup-vp-sfw`);a(i,{recursive:!0}),t.setVariable(`SETUP_VP_SFW_CACHE_DIR`,i),t.setVariable(`SETUP_VP_SFW_CACHE_KEY`,`${Q}-${r}`),t.setVariable(`SETUP_VP_SFW_READY`,`true`)}catch(e){t.logWarning(String(e))}if(!n.cache)return;let d=t.prepareCacheMetadata({projectDir:r,cacheDependencyPath:n.cacheDependencyPath||void 0,logWarning:t.logWarning});if(!d.ready){t.setVariable(`SETUP_VP_CACHE_READY`,`false`);return}t.setVariable(`SETUP_VP_CACHE_READY`,`true`),d.cachePath&&t.setVariable(`SETUP_VP_CACHE_PATH`,d.cachePath),d.lockFile&&t.setVariable(`SETUP_VP_LOCK_FILE`,d.lockFile),d.lockType&&t.setVariable(`SETUP_VP_LOCK_TYPE`,d.lockType)}async function runFinalize(e=process.env,t=pt){let n=parseAzureInputs(e),r=resolveProjectDirFromInputs(n),i=analyzeProjectNpmrc(readNpmrc(p.join(r,`.npmrc`))).envVarRefs;i.add(`NODE_AUTH_TOKEN`);for(let t of i)!isReservedAuthVariable(t)&&/^\$\([^)]+\)$/.test(e[t]||``)&&delete e[t];t.configureAuth(n.registryUrl,n.scope,e,(e,n)=>{e!==`NODE_AUTH_TOKEN`&&n!==void 0&&t.setVariable(e,n,{isSecret:e!==`NPM_CONFIG_USERCONFIG`&&e!==`PNPM_CONFIG_USERCONFIG`})},r);let a=t.parseRunInstall(n.runInstall),o=await t.setupSfw(a,{env:e,sfwEnabled:n.sfw,vitePlusVersion:e.SETUP_VP_RESOLVED_VERSION||n.version,logWarning:t.logWarning,exportVariable:(e,n)=>{n!==void 0&&(e===`PATH`?t.prependPath(n.split(p.delimiter)[0]):t.setVariable(e,n))}});a.length>0&&await t.runInstall(a,r,o,e);let s=t.getCommandOutput(`vp`,[`--version`],{cwd:r});if(!s)throw Error(`Failed to verify Vite+ installation: vp --version failed or returned no output.`);t.logInfo(s);let c=t.parseInstalledVpVersion(s);t.setVariable(`SETUP_VP_INSTALLED_VERSION`,c),t.setVariable(`version`,c,{isOutput:!0}),t.setVariable(`cacheHit`,String(e.SETUP_VP_CACHE_HIT===`true`),{isOutput:!0})}async function main(e){if(e===`prepare`){await runPrepare();return}if(e===`finalize`){await runFinalize();return}fail(`invalid phase "${String(e)}"; expected "prepare" or "finalize"`)}function isEntrypoint(e=process.argv[1],t=import.meta.url){return!!(e&&t===b(p.resolve(e)).href)}if(isEntrypoint()){let e=process.argv[2];e||fail(`missing phase argument; expected "prepare" or "finalize"`);try{await main(e)}catch(e){fail(e instanceof Error?e.message:String(e))}}export{isEntrypoint,main,runFinalize,runPrepare}; \ No newline at end of file +`.trim()]}}const dt=2e3;function getVitePlusHome(e=process.platform,t=process.env){let n=isWindows(e)?t.USERPROFILE||S():t.HOME||S();return g(n,`.vite-plus`)}function runInstallCommand(e,t,n=process.platform){let{command:r,args:i}=getInstallScriptCommand(e,n,t.VP_VPDIRS_AWARE===`1`),a={env:{...process.env,...t},stdio:`inherit`},o=x(r,i,a);if(isWindows(n)&&o.error?.code===`ENOENT`&&(o=x(`powershell.exe`,i,a)),o.error)throw o.error;return o.status??1}async function installVitePlus(e,t={}){let n=t.platform??process.platform,r=t.env??process.env,i=t.prependPath,a=t.sleep??re,o=t.runInstall??runInstallCommand,s=t.logWarningFn??console.warn,c={...Object.fromEntries(Object.entries(r).filter(e=>e[1]!==void 0)),VP_VERSION:e,VITE_PLUS_VERSION:e},l=supportsVitePlusDirs(e)?createVitePlusDirsFile():void 0;l?(c.VP_VPDIRS_AWARE=`1`,c[$]=l):(delete c.VP_VPDIRS_AWARE,delete c[$]);let u=pkgPrNewCommitSha(e);u&&(c.VP_PR_VERSION=u);let{pinned:d,latest:f}=getInstallScriptUrls(e,n),p=d.length+f.length,m=2*p,h=``,_=0;async function tryUrls(e){for(let t=0;t<2;t+=1)for(let t of e){_+=1;try{let e=o(t,c,n);if(e===0)return!0;h=`exit code ${e}`}catch(e){h=e instanceof Error?e.message:String(e)}_0){if(await tryUrls(d)){ensureBinInPath();return}s(`setup-vp: could not fetch the install script pinned to Vite+ ${e}. Falling back to the latest install script. The latest script may not be compatible with ${e}.`)}if(await tryUrls(f)){ensureBinInPath();return}throw Error(`Failed to install Vite+ after ${m} attempts across ${p} URL(s): ${h}`)}finally{l&&removeVitePlusDirsFile(l)}}function parseBoolean(e){return e?.toLowerCase()===`true`}function parseAzureInputs(e){return{version:e.SETUP_VP_VERSION||``,versionFile:e.SETUP_VP_VERSION_FILE||void 0,nodeVersion:e.SETUP_VP_NODE_VERSION||void 0,nodeVersionFile:e.SETUP_VP_NODE_VERSION_FILE||void 0,workingDirectory:e.SETUP_VP_WORKING_DIRECTORY||`.`,runInstall:e.SETUP_VP_RUN_INSTALL??`true`,sfw:parseBoolean(e.SETUP_VP_SFW),nodeManager:parseNodeManager(e.SETUP_VP_NODE_MANAGER),packageManager:parsePackageManager(e.SETUP_VP_PACKAGE_MANAGER),registryUrl:e.SETUP_VP_REGISTRY_URL||``,scope:e.SETUP_VP_SCOPE||``,cache:parseBoolean(e.SETUP_VP_CACHE),cacheDependencyPath:e.SETUP_VP_CACHE_DEPENDENCY_PATH||``,workspaceRoot:e.SYSTEM_DEFAULTWORKINGDIRECTORY||process.cwd()}}function resolveProjectDirFromInputs(e){return resolveProjectDirectory({workingDirectory:e.workingDirectory,workspaceRoot:e.workspaceRoot})}const ft={installVitePlus,prepareCacheMetadata,configureAuth,setupSfw,parseRunInstall,runInstall,getCommandOutput,run,parseInstalledVpVersion,prependPath,setVariable,logWarning,logInfo};function fail(e){console.error(`setup-vp: ${e}`),process.exit(1)}async function runPrepare(e=process.env,t=ft){let n=parseAzureInputs(e),r=resolveProjectDirFromInputs(n);if(n.nodeManager===!1&&(n.nodeVersion||n.nodeVersionFile))throw Error(`node-version and node-version-file cannot be used with node-manager: false`);let i={...resolutionContext(n.workspaceRoot),info:t.logInfo,warning:t.logWarning},o=createVersionResolver(i).resolveVitePlusVersion(n,r),s=n.nodeVersion||(n.nodeVersionFile?createNodeVersionResolver(i).resolveNodeVersionFile(n.nodeVersionFile,r):void 0);t.setVariable(`SETUP_VP_CACHE_HIT`,`false`),t.setVariable(`SETUP_VP_CACHE_READY`,`false`),t.setVariable(`SETUP_VP_SFW_READY`,`false`),t.setVariable(`SETUP_VP_BOOTSTRAP_NODE`,process.execPath),await t.installVitePlus(o,{env:e,prependPath:e=>t.prependPath(e),exportPath:e=>t.setVariable(`PATH`,e),logWarningFn:t.logWarning}),t.setVariable(`SETUP_VP_RESOLVED_VERSION`,o);let c=(n.nodeManager===!1||n.packageManager!==void 0)&&t.getCommandOutput(`vp`,[`--version`])||``,l=packageManagerArgs(n.packageManager,c);n.nodeManager===!1?t.run(`vp`,nodeManagerOffArgs(c)):s&&t.run(`vp`,[`env`,`use`,s],{cwd:r});for(let e of l)t.run(`vp`,e);let u=f.resolve(process.argv[1]||``);if(t.setVariable(`SETUP_VP_RUNTIME_PATH`,u),n.sfw&&!pkgPrNewCommitSha(o)&&t.parseRunInstall(n.runInstall).length>0)try{let r=getSfwAssetName(process.platform,process.arch,isMuslLinux()),i=f.join(e.PIPELINE_WORKSPACE||n.workspaceRoot,`.setup-vp-sfw`);a(i,{recursive:!0}),t.setVariable(`SETUP_VP_SFW_CACHE_DIR`,i),t.setVariable(`SETUP_VP_SFW_CACHE_KEY`,`${Q}-${r}`),t.setVariable(`SETUP_VP_SFW_READY`,`true`)}catch(e){t.logWarning(String(e))}if(!n.cache)return;let d=t.prepareCacheMetadata({projectDir:r,cacheDependencyPath:n.cacheDependencyPath||void 0,logWarning:t.logWarning});if(!d.ready){t.setVariable(`SETUP_VP_CACHE_READY`,`false`);return}t.setVariable(`SETUP_VP_CACHE_READY`,`true`),d.cachePath&&t.setVariable(`SETUP_VP_CACHE_PATH`,d.cachePath),d.lockFile&&t.setVariable(`SETUP_VP_LOCK_FILE`,d.lockFile),d.lockType&&t.setVariable(`SETUP_VP_LOCK_TYPE`,d.lockType)}async function runFinalize(e=process.env,t=ft){let n=parseAzureInputs(e),r=resolveProjectDirFromInputs(n),i=analyzeProjectNpmrc(readNpmrc(f.join(r,`.npmrc`))).envVarRefs;i.add(`NODE_AUTH_TOKEN`);for(let t of i)!isReservedAuthVariable(t)&&/^\$\([^)]+\)$/.test(e[t]||``)&&delete e[t];t.configureAuth(n.registryUrl,n.scope,e,(e,n)=>{e!==`NODE_AUTH_TOKEN`&&n!==void 0&&t.setVariable(e,n,{isSecret:e!==`NPM_CONFIG_USERCONFIG`&&e!==`PNPM_CONFIG_USERCONFIG`})},r);let a=t.parseRunInstall(n.runInstall),o=await t.setupSfw(a,{env:e,sfwEnabled:n.sfw,vitePlusVersion:e.SETUP_VP_RESOLVED_VERSION||n.version,logWarning:t.logWarning,exportVariable:(e,n)=>{n!==void 0&&(e===`PATH`?t.prependPath(n.split(f.delimiter)[0]):t.setVariable(e,n))}});a.length>0&&await t.runInstall(a,r,o,e);let s=t.getCommandOutput(`vp`,[`--version`],{cwd:r});if(!s)throw Error(`Failed to verify Vite+ installation: vp --version failed or returned no output.`);t.logInfo(s);let c=t.parseInstalledVpVersion(s);t.setVariable(`SETUP_VP_INSTALLED_VERSION`,c),t.setVariable(`version`,c,{isOutput:!0}),t.setVariable(`cacheHit`,String(e.SETUP_VP_CACHE_HIT===`true`),{isOutput:!0})}async function main(e){if(e===`prepare`){await runPrepare();return}if(e===`finalize`){await runFinalize();return}fail(`invalid phase "${String(e)}"; expected "prepare" or "finalize"`)}function isEntrypoint(e=process.argv[1],t=import.meta.url){return!!(e&&t===y(f.resolve(e)).href)}if(isEntrypoint()){let e=process.argv[2];e||fail(`missing phase argument; expected "prepare" or "finalize"`);try{await main(e)}catch(e){fail(e instanceof Error?e.message:String(e))}}export{isEntrypoint,main,runFinalize,runPrepare}; \ No newline at end of file diff --git a/dist/gitlab/index.mjs b/dist/gitlab/index.mjs index d924e79..4a68b57 100644 --- a/dist/gitlab/index.mjs +++ b/dist/gitlab/index.mjs @@ -1,14 +1,14 @@ -import{createRequire as e}from"node:module";import{accessSync as t,constants as n,copyFileSync as r,cpSync as i,createWriteStream as a,existsSync as o,lstatSync as s,mkdirSync as c,mkdtempSync as l,readFileSync as u,readdirSync as d,readlinkSync as f,realpathSync as p,rmSync as m,statSync as h,symlinkSync as g,writeFileSync as _}from"node:fs";import v,{basename as y,dirname as b,isAbsolute as x,join as S,relative as C,sep as w}from"node:path";import{pathToFileURL as T}from"node:url";import{spawn as E,spawnSync as D}from"node:child_process";import{homedir as ee,tmpdir as te}from"node:os";import{setTimeout as ne}from"node:timers/promises";import{createHash as re,randomUUID as ie}from"node:crypto";import{chmod as ae,mkdir as oe,mkdtemp as se,rename as ce,rm as le,stat as ue}from"node:fs/promises";var __commonJSMin=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),O=/* @__PURE__ */ e(import.meta.url),k=/* @__PURE__ */ __commonJSMin((e=>{let t=Symbol.for(`yaml.alias`),n=Symbol.for(`yaml.document`),r=Symbol.for(`yaml.map`),i=Symbol.for(`yaml.pair`),a=Symbol.for(`yaml.scalar`),o=Symbol.for(`yaml.seq`),s=Symbol.for(`yaml.node.type`),isAlias=e=>!!e&&typeof e==`object`&&e[s]===t,isDocument=e=>!!e&&typeof e==`object`&&e[s]===n,isMap=e=>!!e&&typeof e==`object`&&e[s]===r,isPair=e=>!!e&&typeof e==`object`&&e[s]===i,isScalar=e=>!!e&&typeof e==`object`&&e[s]===a,isSeq=e=>!!e&&typeof e==`object`&&e[s]===o;function isCollection(e){if(e&&typeof e==`object`)switch(e[s]){case r:case o:return!0}return!1}function isNode(e){if(e&&typeof e==`object`)switch(e[s]){case t:case r:case a:case o:return!0}return!1}e.ALIAS=t,e.DOC=n,e.MAP=r,e.NODE_TYPE=s,e.PAIR=i,e.SCALAR=a,e.SEQ=o,e.hasAnchor=e=>(isScalar(e)||isCollection(e))&&!!e.anchor,e.isAlias=isAlias,e.isCollection=isCollection,e.isDocument=isDocument,e.isMap=isMap,e.isNode=isNode,e.isPair=isPair,e.isScalar=isScalar,e.isSeq=isSeq})),A=/* @__PURE__ */ __commonJSMin((e=>{var t=k();let n=Symbol(`break visit`),r=Symbol(`skip children`),i=Symbol(`remove node`);function visit(e,n){let r=initVisitor(n);t.isDocument(e)?visit_(null,e.contents,r,Object.freeze([e]))===i&&(e.contents=null):visit_(null,e,r,Object.freeze([]))}visit.BREAK=n,visit.SKIP=r,visit.REMOVE=i;function visit_(e,r,a,o){let s=callVisitor(e,r,a,o);if(t.isNode(s)||t.isPair(s))return replaceNode(e,o,s),visit_(e,s,a,o);if(typeof s!=`symbol`){if(t.isCollection(r)){o=Object.freeze(o.concat(r));for(let e=0;e{var t=k(),n=A();let r={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},escapeTagName=e=>e.replace(/[!,[\]{}]/g,e=>r[e]);var i=class Directives{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},Directives.defaultYaml,e),this.tags=Object.assign({},Directives.defaultTags,t)}clone(){let e=new Directives(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new Directives(this.yaml,this.tags);switch(this.yaml.version){case`1.1`:this.atNextDocument=!0;break;case`1.2`:this.atNextDocument=!1,this.yaml={explicit:Directives.defaultYaml.explicit,version:`1.2`},this.tags=Object.assign({},Directives.defaultTags)}return e}add(e,t){this.atNextDocument&&=(this.yaml={explicit:Directives.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},Directives.defaultTags),!1);let n=e.trim().split(/[ \t]+/),r=n.shift();switch(r){case`%TAG`:{if(n.length!==2&&(t(0,`%TAG directive should contain exactly two parts`),n.length<2))return!1;let[e,r]=n;return this.tags[e]=r,!0}case`%YAML`:{if(this.yaml.explicit=!0,n.length!==1)return t(0,`%YAML directive should contain exactly one part`),!1;let[e]=n;if(e===`1.1`||e===`1.2`)return this.yaml.version=e,!0;{let n=/^\d+\.\d+$/.test(e);return t(6,`Unsupported YAML version ${e}`,n),!1}}default:return t(0,`Unknown directive ${r}`,!0),!1}}tagName(e,t){if(e===`!`)return`!`;if(e[0]!==`!`)return t(`Not a valid tag: ${e}`),null;if(e[1]===`<`){let n=e.slice(2,-1);return n===`!`||n===`!!`?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==`>`&&t(`Verbatim tags must end with a >`),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return n===`!`?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+escapeTagName(e.substring(n.length));return e[0]===`!`?e:`!<${e}>`}toString(e){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],i=Object.entries(this.tags),a;if(e&&i.length>0&&t.isNode(e.contents)){let r={};n.visit(e.contents,(e,n)=>{t.isNode(n)&&n.tag&&(r[n.tag]=!0)}),a=Object.keys(r)}else a=[];for(let[t,n]of i)(t!==`!!`||n!==`tag:yaml.org,2002:`)&&(!e||a.some(e=>e.startsWith(n)))&&r.push(`%TAG ${t} ${n}`);return r.join(` -`)}};i.defaultYaml={explicit:!1,version:`1.2`},i.defaultTags={"!!":`tag:yaml.org,2002:`},e.Directives=i})),fe=/* @__PURE__ */ __commonJSMin((e=>{var t=k(),n=A();function anchorIsValid(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function anchorNames(e){let t=/* @__PURE__ */ new Set;return n.visit(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function findNewAnchor(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function createNodeAnchors(e,n){let r=[],i=/* @__PURE__ */ new Map,a=null;return{onAnchor:t=>{r.push(t),a??=anchorNames(e);let i=findNewAnchor(n,a);return a.add(i),i},setAnchors:()=>{for(let e of r){let n=i.get(e);if(typeof n==`object`&&n.anchor&&(t.isScalar(n.node)||t.isCollection(n.node)))n.node.anchor=n.anchor;else{let t=/* @__PURE__ */ Error(`Failed to resolve repeated object (this should not happen)`);throw t.source=e,t}}},sourceObjects:i}}e.anchorIsValid=anchorIsValid,e.anchorNames=anchorNames,e.createNodeAnchors=createNodeAnchors,e.findNewAnchor=findNewAnchor})),pe=/* @__PURE__ */ __commonJSMin((e=>{function applyReviver(e,t,n,r){if(r&&typeof r==`object`){if(Array.isArray(r))for(let t=0,n=r.length;t{var t=k();function toJS(e,n,r){if(Array.isArray(e))return e.map((e,t)=>toJS(e,String(t),r));if(e&&typeof e.toJSON==`function`){if(!r||!t.hasAnchor(e))return e.toJSON(n,r);let i={aliasCount:0,count:1,res:void 0};r.anchors.set(e,i),r.onCreate=e=>{i.res=e,delete r.onCreate};let a=e.toJSON(n,r);return r.onCreate&&r.onCreate(a),a}return typeof e==`bigint`&&!r?.keep?Number(e):e}e.toJS=toJS})),me=/* @__PURE__ */ __commonJSMin((e=>{var t=pe(),n=k(),r=j();e.NodeBase=class{constructor(e){Object.defineProperty(this,n.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:i,maxAliasCount:a,onAnchor:o,reviver:s}={}){if(!n.isDocument(e))throw TypeError(`A document argument is required`);let c={anchors:/* @__PURE__ */ new Map,doc:e,keep:!0,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof a==`number`?a:100},l=r.toJS(this,``,c);if(typeof o==`function`)for(let{count:e,res:t}of c.anchors.values())o(t,e);return typeof s==`function`?t.applyReviver(s,{"":l},``,l):l}}})),M=/* @__PURE__ */ __commonJSMin((e=>{var t=fe(),n=A(),r=k(),i=me(),a=j(),Alias=class extends i.NodeBase{constructor(e){super(r.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let i;t?.aliasResolveCache?i=t.aliasResolveCache:(i=[],n.visit(e,{Node:(e,t)=>{(r.isAlias(t)||r.hasAnchor(t))&&i.push(t)}}),t&&(t.aliasResolveCache=i));let o;for(let e of i){if(e===this)break;e.anchor===this.source&&(o=e)}if(o&&t){let{anchors:e,doc:n,maxAliasCount:r}=t,i=e.get(o); +import{createRequire as e}from"node:module";import{accessSync as t,constants as n,copyFileSync as r,cpSync as i,createWriteStream as a,existsSync as o,lstatSync as s,mkdirSync as c,mkdtempSync as l,readFileSync as u,readdirSync as d,readlinkSync as f,rmSync as p,statSync as m,symlinkSync as h,writeFileSync as g}from"node:fs";import _,{basename as v,dirname as y,isAbsolute as b,join as x,relative as S,sep as C}from"node:path";import{pathToFileURL as w}from"node:url";import{spawn as T,spawnSync as E}from"node:child_process";import{homedir as ee,tmpdir as te}from"node:os";import{setTimeout as ne}from"node:timers/promises";import{createHash as re,randomUUID as ie}from"node:crypto";import{chmod as ae,mkdir as oe,mkdtemp as se,rename as ce,rm as le,stat as ue}from"node:fs/promises";var __commonJSMin=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),D=/* @__PURE__ */ e(import.meta.url),O=/* @__PURE__ */ __commonJSMin((e=>{let t=Symbol.for(`yaml.alias`),n=Symbol.for(`yaml.document`),r=Symbol.for(`yaml.map`),i=Symbol.for(`yaml.pair`),a=Symbol.for(`yaml.scalar`),o=Symbol.for(`yaml.seq`),s=Symbol.for(`yaml.node.type`),isAlias=e=>!!e&&typeof e==`object`&&e[s]===t,isDocument=e=>!!e&&typeof e==`object`&&e[s]===n,isMap=e=>!!e&&typeof e==`object`&&e[s]===r,isPair=e=>!!e&&typeof e==`object`&&e[s]===i,isScalar=e=>!!e&&typeof e==`object`&&e[s]===a,isSeq=e=>!!e&&typeof e==`object`&&e[s]===o;function isCollection(e){if(e&&typeof e==`object`)switch(e[s]){case r:case o:return!0}return!1}function isNode(e){if(e&&typeof e==`object`)switch(e[s]){case t:case r:case a:case o:return!0}return!1}e.ALIAS=t,e.DOC=n,e.MAP=r,e.NODE_TYPE=s,e.PAIR=i,e.SCALAR=a,e.SEQ=o,e.hasAnchor=e=>(isScalar(e)||isCollection(e))&&!!e.anchor,e.isAlias=isAlias,e.isCollection=isCollection,e.isDocument=isDocument,e.isMap=isMap,e.isNode=isNode,e.isPair=isPair,e.isScalar=isScalar,e.isSeq=isSeq})),k=/* @__PURE__ */ __commonJSMin((e=>{var t=O();let n=Symbol(`break visit`),r=Symbol(`skip children`),i=Symbol(`remove node`);function visit(e,n){let r=initVisitor(n);t.isDocument(e)?visit_(null,e.contents,r,Object.freeze([e]))===i&&(e.contents=null):visit_(null,e,r,Object.freeze([]))}visit.BREAK=n,visit.SKIP=r,visit.REMOVE=i;function visit_(e,r,a,o){let s=callVisitor(e,r,a,o);if(t.isNode(s)||t.isPair(s))return replaceNode(e,o,s),visit_(e,s,a,o);if(typeof s!=`symbol`){if(t.isCollection(r)){o=Object.freeze(o.concat(r));for(let e=0;e{var t=O(),n=k();let r={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},escapeTagName=e=>e.replace(/[!,[\]{}]/g,e=>r[e]);var i=class Directives{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},Directives.defaultYaml,e),this.tags=Object.assign({},Directives.defaultTags,t)}clone(){let e=new Directives(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new Directives(this.yaml,this.tags);switch(this.yaml.version){case`1.1`:this.atNextDocument=!0;break;case`1.2`:this.atNextDocument=!1,this.yaml={explicit:Directives.defaultYaml.explicit,version:`1.2`},this.tags=Object.assign({},Directives.defaultTags)}return e}add(e,t){this.atNextDocument&&=(this.yaml={explicit:Directives.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},Directives.defaultTags),!1);let n=e.trim().split(/[ \t]+/),r=n.shift();switch(r){case`%TAG`:{if(n.length!==2&&(t(0,`%TAG directive should contain exactly two parts`),n.length<2))return!1;let[e,r]=n;return this.tags[e]=r,!0}case`%YAML`:{if(this.yaml.explicit=!0,n.length!==1)return t(0,`%YAML directive should contain exactly one part`),!1;let[e]=n;if(e===`1.1`||e===`1.2`)return this.yaml.version=e,!0;{let n=/^\d+\.\d+$/.test(e);return t(6,`Unsupported YAML version ${e}`,n),!1}}default:return t(0,`Unknown directive ${r}`,!0),!1}}tagName(e,t){if(e===`!`)return`!`;if(e[0]!==`!`)return t(`Not a valid tag: ${e}`),null;if(e[1]===`<`){let n=e.slice(2,-1);return n===`!`||n===`!!`?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==`>`&&t(`Verbatim tags must end with a >`),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return n===`!`?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+escapeTagName(e.substring(n.length));return e[0]===`!`?e:`!<${e}>`}toString(e){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],i=Object.entries(this.tags),a;if(e&&i.length>0&&t.isNode(e.contents)){let r={};n.visit(e.contents,(e,n)=>{t.isNode(n)&&n.tag&&(r[n.tag]=!0)}),a=Object.keys(r)}else a=[];for(let[t,n]of i)(t!==`!!`||n!==`tag:yaml.org,2002:`)&&(!e||a.some(e=>e.startsWith(n)))&&r.push(`%TAG ${t} ${n}`);return r.join(` +`)}};i.defaultYaml={explicit:!1,version:`1.2`},i.defaultTags={"!!":`tag:yaml.org,2002:`},e.Directives=i})),A=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=k();function anchorIsValid(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function anchorNames(e){let t=/* @__PURE__ */ new Set;return n.visit(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function findNewAnchor(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function createNodeAnchors(e,n){let r=[],i=/* @__PURE__ */ new Map,a=null;return{onAnchor:t=>{r.push(t),a??=anchorNames(e);let i=findNewAnchor(n,a);return a.add(i),i},setAnchors:()=>{for(let e of r){let n=i.get(e);if(typeof n==`object`&&n.anchor&&(t.isScalar(n.node)||t.isCollection(n.node)))n.node.anchor=n.anchor;else{let t=/* @__PURE__ */ Error(`Failed to resolve repeated object (this should not happen)`);throw t.source=e,t}}},sourceObjects:i}}e.anchorIsValid=anchorIsValid,e.anchorNames=anchorNames,e.createNodeAnchors=createNodeAnchors,e.findNewAnchor=findNewAnchor})),fe=/* @__PURE__ */ __commonJSMin((e=>{function applyReviver(e,t,n,r){if(r&&typeof r==`object`){if(Array.isArray(r))for(let t=0,n=r.length;t{var t=O();function toJS(e,n,r){if(Array.isArray(e))return e.map((e,t)=>toJS(e,String(t),r));if(e&&typeof e.toJSON==`function`){if(!r||!t.hasAnchor(e))return e.toJSON(n,r);let i={aliasCount:0,count:1,res:void 0};r.anchors.set(e,i),r.onCreate=e=>{i.res=e,delete r.onCreate};let a=e.toJSON(n,r);return r.onCreate&&r.onCreate(a),a}return typeof e==`bigint`&&!r?.keep?Number(e):e}e.toJS=toJS})),pe=/* @__PURE__ */ __commonJSMin((e=>{var t=fe(),n=O(),r=j();e.NodeBase=class{constructor(e){Object.defineProperty(this,n.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:i,maxAliasCount:a,onAnchor:o,reviver:s}={}){if(!n.isDocument(e))throw TypeError(`A document argument is required`);let c={anchors:/* @__PURE__ */ new Map,doc:e,keep:!0,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof a==`number`?a:100},l=r.toJS(this,``,c);if(typeof o==`function`)for(let{count:e,res:t}of c.anchors.values())o(t,e);return typeof s==`function`?t.applyReviver(s,{"":l},``,l):l}}})),M=/* @__PURE__ */ __commonJSMin((e=>{var t=A(),n=k(),r=O(),i=pe(),a=j(),Alias=class extends i.NodeBase{constructor(e){super(r.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let i;t?.aliasResolveCache?i=t.aliasResolveCache:(i=[],n.visit(e,{Node:(e,t)=>{(r.isAlias(t)||r.hasAnchor(t))&&i.push(t)}}),t&&(t.aliasResolveCache=i));let o;for(let e of i){if(e===this)break;e.anchor===this.source&&(o=e)}if(o&&t){let{anchors:e,doc:n,maxAliasCount:r}=t,i=e.get(o); /* istanbul ignore if */ -if(i||=(a.toJS(o,null,t),e.get(o)),i?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(r>=0&&(i.count+=1,i.aliasCount===0&&(i.aliasCount=getAliasCount(n,o,e)),i.count*i.aliasCount>r))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`)}return o}toJSON(e,t){if(!t)return{source:this.source};let n=this.resolve(t.doc,t);if(!n){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}return t.anchors.get(n).res}toString(e,n,r){let i=`*${this.source}`;if(e){if(t.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${i} `}return i}};function getAliasCount(e,t,n){if(r.isAlias(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(r.isCollection(t)){let r=0;for(let i of t.items){let t=getAliasCount(e,i,n);t>r&&(r=t)}return r}if(r.isPair(t)){let r=getAliasCount(e,t.key,n),i=getAliasCount(e,t.value,n);return Math.max(r,i)}return 1}e.Alias=Alias})),N=/* @__PURE__ */ __commonJSMin((e=>{var t=k(),n=me(),r=j();let isScalarValue=e=>!e||typeof e!=`function`&&typeof e!=`object`;var Scalar=class extends n.NodeBase{constructor(e){super(t.SCALAR),this.value=e}toJSON(e,t){return t?.keep?this.value:r.toJS(this.value,e,t)}toString(){return String(this.value)}};Scalar.BLOCK_FOLDED=`BLOCK_FOLDED`,Scalar.BLOCK_LITERAL=`BLOCK_LITERAL`,Scalar.PLAIN=`PLAIN`,Scalar.QUOTE_DOUBLE=`QUOTE_DOUBLE`,Scalar.QUOTE_SINGLE=`QUOTE_SINGLE`,e.Scalar=Scalar,e.isScalarValue=isScalarValue})),P=/* @__PURE__ */ __commonJSMin((e=>{var t=M(),n=k(),r=N();function findTagObject(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function createNode(e,i,a){if(n.isDocument(e)&&(e=e.contents),n.isNode(e))return e;if(n.isPair(e)){let t=a.schema[n.MAP].createNode?.(a.schema,null,a);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:o,onAnchor:s,onTagObj:c,schema:l,sourceObjects:u}=a,d;if(o&&e&&typeof e==`object`){if(d=u.get(e),d)return d.anchor??(d.anchor=s(e)),new t.Alias(d.anchor);d={anchor:null,node:null},u.set(e,d)}i?.startsWith(`!!`)&&(i=`tag:yaml.org,2002:`+i.slice(2));let f=findTagObject(e,i,l.tags);if(!f){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new r.Scalar(e);return d&&(d.node=t),t}f=e instanceof Map?l[n.MAP]:Symbol.iterator in Object(e)?l[n.SEQ]:l[n.MAP]}c&&(c(f),delete a.onTagObj);let p=f?.createNode?f.createNode(a.schema,e,a):typeof f?.nodeClass?.from==`function`?f.nodeClass.from(a.schema,e,a):new r.Scalar(e);return i?p.tag=i:f.default||(p.tag=f.tag),d&&(d.node=p),p}e.createNode=createNode})),he=/* @__PURE__ */ __commonJSMin((e=>{var t=P(),n=k(),r=me();function collectionFromPath(e,n,r){let i=r;for(let e=n.length-1;e>=0;--e){let t=n[e];if(typeof t==`number`&&Number.isInteger(t)&&t>=0){let e=[];e[t]=i,i=e}else i=/* @__PURE__ */ new Map([[t,i]])}return t.createNode(i,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:/* @__PURE__ */ new Map})}let isEmptyPath=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done;e.Collection=class extends r.NodeBase{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>n.isNode(t)||n.isPair(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(isEmptyPath(e))this.add(t);else{let[r,...i]=e,a=this.get(r,!0);if(n.isCollection(a))a.addIn(i,t);else if(a===void 0&&this.schema)this.set(r,collectionFromPath(this.schema,i,t));else throw Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}deleteIn(e){let[t,...r]=e;if(r.length===0)return this.delete(t);let i=this.get(t,!0);if(n.isCollection(i))return i.deleteIn(r);throw Error(`Expected YAML collection at ${t}. Remaining path: ${r}`)}getIn(e,t){let[r,...i]=e,a=this.get(r,!0);return i.length===0?!t&&n.isScalar(a)?a.value:a:n.isCollection(a)?a.getIn(i,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!n.isPair(t))return!1;let r=t.value;return r==null||e&&n.isScalar(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(e){let[t,...r]=e;if(r.length===0)return this.has(t);let i=this.get(t,!0);return n.isCollection(i)?i.hasIn(r):!1}setIn(e,t){let[r,...i]=e;if(i.length===0)this.set(r,t);else{let e=this.get(r,!0);if(n.isCollection(e))e.setIn(i,t);else if(e===void 0&&this.schema)this.set(r,collectionFromPath(this.schema,i,t));else throw Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}},e.collectionFromPath=collectionFromPath,e.isEmptyPath=isEmptyPath})),F=/* @__PURE__ */ __commonJSMin((e=>{let stringifyComment=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function indentComment(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}e.indentComment=indentComment,e.lineComment=(e,t,n)=>e.endsWith(` +if(i||=(a.toJS(o,null,t),e.get(o)),i?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(r>=0&&(i.count+=1,i.aliasCount===0&&(i.aliasCount=getAliasCount(n,o,e)),i.count*i.aliasCount>r))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`)}return o}toJSON(e,t){if(!t)return{source:this.source};let n=this.resolve(t.doc,t);if(!n){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}return t.anchors.get(n).res}toString(e,n,r){let i=`*${this.source}`;if(e){if(t.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${i} `}return i}};function getAliasCount(e,t,n){if(r.isAlias(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(r.isCollection(t)){let r=0;for(let i of t.items){let t=getAliasCount(e,i,n);t>r&&(r=t)}return r}if(r.isPair(t)){let r=getAliasCount(e,t.key,n),i=getAliasCount(e,t.value,n);return Math.max(r,i)}return 1}e.Alias=Alias})),N=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=pe(),r=j();let isScalarValue=e=>!e||typeof e!=`function`&&typeof e!=`object`;var Scalar=class extends n.NodeBase{constructor(e){super(t.SCALAR),this.value=e}toJSON(e,t){return t?.keep?this.value:r.toJS(this.value,e,t)}toString(){return String(this.value)}};Scalar.BLOCK_FOLDED=`BLOCK_FOLDED`,Scalar.BLOCK_LITERAL=`BLOCK_LITERAL`,Scalar.PLAIN=`PLAIN`,Scalar.QUOTE_DOUBLE=`QUOTE_DOUBLE`,Scalar.QUOTE_SINGLE=`QUOTE_SINGLE`,e.Scalar=Scalar,e.isScalarValue=isScalarValue})),P=/* @__PURE__ */ __commonJSMin((e=>{var t=M(),n=O(),r=N();function findTagObject(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function createNode(e,i,a){if(n.isDocument(e)&&(e=e.contents),n.isNode(e))return e;if(n.isPair(e)){let t=a.schema[n.MAP].createNode?.(a.schema,null,a);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:o,onAnchor:s,onTagObj:c,schema:l,sourceObjects:u}=a,d;if(o&&e&&typeof e==`object`){if(d=u.get(e),d)return d.anchor??(d.anchor=s(e)),new t.Alias(d.anchor);d={anchor:null,node:null},u.set(e,d)}i?.startsWith(`!!`)&&(i=`tag:yaml.org,2002:`+i.slice(2));let f=findTagObject(e,i,l.tags);if(!f){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new r.Scalar(e);return d&&(d.node=t),t}f=e instanceof Map?l[n.MAP]:Symbol.iterator in Object(e)?l[n.SEQ]:l[n.MAP]}c&&(c(f),delete a.onTagObj);let p=f?.createNode?f.createNode(a.schema,e,a):typeof f?.nodeClass?.from==`function`?f.nodeClass.from(a.schema,e,a):new r.Scalar(e);return i?p.tag=i:f.default||(p.tag=f.tag),d&&(d.node=p),p}e.createNode=createNode})),me=/* @__PURE__ */ __commonJSMin((e=>{var t=P(),n=O(),r=pe();function collectionFromPath(e,n,r){let i=r;for(let e=n.length-1;e>=0;--e){let t=n[e];if(typeof t==`number`&&Number.isInteger(t)&&t>=0){let e=[];e[t]=i,i=e}else i=/* @__PURE__ */ new Map([[t,i]])}return t.createNode(i,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:/* @__PURE__ */ new Map})}let isEmptyPath=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done;e.Collection=class extends r.NodeBase{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>n.isNode(t)||n.isPair(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(isEmptyPath(e))this.add(t);else{let[r,...i]=e,a=this.get(r,!0);if(n.isCollection(a))a.addIn(i,t);else if(a===void 0&&this.schema)this.set(r,collectionFromPath(this.schema,i,t));else throw Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}deleteIn(e){let[t,...r]=e;if(r.length===0)return this.delete(t);let i=this.get(t,!0);if(n.isCollection(i))return i.deleteIn(r);throw Error(`Expected YAML collection at ${t}. Remaining path: ${r}`)}getIn(e,t){let[r,...i]=e,a=this.get(r,!0);return i.length===0?!t&&n.isScalar(a)?a.value:a:n.isCollection(a)?a.getIn(i,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!n.isPair(t))return!1;let r=t.value;return r==null||e&&n.isScalar(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(e){let[t,...r]=e;if(r.length===0)return this.has(t);let i=this.get(t,!0);return n.isCollection(i)?i.hasIn(r):!1}setIn(e,t){let[r,...i]=e;if(i.length===0)this.set(r,t);else{let e=this.get(r,!0);if(n.isCollection(e))e.setIn(i,t);else if(e===void 0&&this.schema)this.set(r,collectionFromPath(this.schema,i,t));else throw Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}},e.collectionFromPath=collectionFromPath,e.isEmptyPath=isEmptyPath})),F=/* @__PURE__ */ __commonJSMin((e=>{let stringifyComment=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function indentComment(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}e.indentComment=indentComment,e.lineComment=(e,t,n)=>e.endsWith(` `)?indentComment(n,t):n.includes(` `)?` -`+indentComment(n,t):(e.endsWith(` `)?``:` `)+n,e.stringifyComment=stringifyComment})),ge=/* @__PURE__ */ __commonJSMin((e=>{let t=`block`,n=`quoted`;function foldFlowLines(e,r,i=`flow`,{indentAtStart:a,lineWidth:o=80,minContentWidth:s=20,onFold:c,onOverflow:l}={}){if(!o||o<0)return e;oo-Math.max(2,s)?d.push(0):p=o-a);let m,h,g=!1,_=-1,v=-1,y=-1;i===t&&(_=consumeMoreIndentedLines(e,_,r.length),_!==-1&&(p=_+u));for(let a;a=e[_+=1];){if(i===n&&a===`\\`){switch(v=_,e[_+1]){case`x`:_+=3;break;case`u`:_+=5;break;case`U`:_+=9;break;default:_+=1}y=_}if(a===` +`+indentComment(n,t):(e.endsWith(` `)?``:` `)+n,e.stringifyComment=stringifyComment})),he=/* @__PURE__ */ __commonJSMin((e=>{let t=`block`,n=`quoted`;function foldFlowLines(e,r,i=`flow`,{indentAtStart:a,lineWidth:o=80,minContentWidth:s=20,onFold:c,onOverflow:l}={}){if(!o||o<0)return e;oo-Math.max(2,s)?d.push(0):p=o-a);let m,h,g=!1,_=-1,v=-1,y=-1;i===t&&(_=consumeMoreIndentedLines(e,_,r.length),_!==-1&&(p=_+u));for(let a;a=e[_+=1];){if(i===n&&a===`\\`){switch(v=_,e[_+1]){case`x`:_+=3;break;case`u`:_+=5;break;case`U`:_+=9;break;default:_+=1}y=_}if(a===` `)i===t&&(_=consumeMoreIndentedLines(e,_,r.length)),p=_+r.length+u,m=void 0;else{if(a===` `&&h&&h!==` `&&h!==` `&&h!==` `){let t=e[_+1];t&&t!==` `&&t!==` `&&t!==` `&&(m=_)}if(_>=p){if(m)d.push(m),p=m+u,m=void 0;else if(i===n){for(;h===` `||h===` `;)h=a,a=e[_+=1],g=!0;let t=_>y+1?_-2:v-1;if(f[t])return e;d.push(t),f[t]=!0,p=t+u,m=void 0}else g=!0}}h=a}if(g&&l&&l(),d.length===0)return e;c&&c();let b=e.slice(0,d[0]);for(let t=0;t{var t=N(),n=ge();let getFoldOptions=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),containsDocumentMarker=e=>/^(%|---|\.\.\.)/m.test(e);function lineLengthOverLimit(e,t,n){if(!t||t<0)return!1;let r=t-n,i=e.length;if(i<=r)return!1;for(let t=0,n=0;t{var t=N(),n=he();let getFoldOptions=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),containsDocumentMarker=e=>/^(%|---|\.\.\.)/m.test(e);function lineLengthOverLimit(e,t,n){if(!t||t<0)return!1;let r=t-n,i=e.length;if(i<=r)return!1;for(let t=0,n=0;tr)return!0;if(n=t+1,i-n<=r)return!1}return!0}function doubleQuotedString(e,t){let r=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return r;let{implicitKey:i}=t,a=t.options.doubleQuotedMinMultiLineLength,o=t.indent||(containsDocumentMarker(e)?` `:``),s=``,c=0;for(let e=0,t=r[e];t;t=r[++e])if(t===` `&&r[e+1]===`\\`&&r[e+2]===`n`&&(s+=r.slice(c,e)+`\\ `,e+=1,c=e,t=`\\`),t===`\\`)switch(r[e+1]){case`u`:{s+=r.slice(c,e);let t=r.substr(e+2,4);switch(t){case`0000`:s+=`\\0`;break;case`0007`:s+=`\\a`;break;case`000b`:s+=`\\v`;break;case`001b`:s+=`\\e`;break;case`0085`:s+=`\\N`;break;case`00a0`:s+=`\\_`;break;case`2028`:s+=`\\L`;break;case`2029`:s+=`\\P`;break;default:t.substr(0,2)===`00`?s+=`\\x`+t.substr(2):s+=r.substr(e,6)}e+=5,c=e+1}break;case`n`:if(i||r[e+2]===`"`||r.length{r=!0});let c=n.foldFlowLines(`${x}${e}${g}`,f,n.FOLD_BLOCK,s);if(!r)return`>${S}\n${f}${c}`}return a=a.replace(/\n+/g,`$&${f}`),`|${S}\n${f}${x}${a}${g}`}function plainString(e,r,i,a){let{type:o,value:s}=e,{actualString:c,implicitKey:l,indent:u,indentStep:d,inFlow:f}=r;if(l&&s.includes(` `)||f&&/[[\]{},]/.test(s))return quotedString(s,r);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(s))return l||f||!s.includes(` `)?quotedString(s,r):blockString(e,r,i,a);if(!l&&!f&&o!==t.Scalar.PLAIN&&s.includes(` -`))return blockString(e,r,i,a);if(containsDocumentMarker(s)){if(u===``)return r.forceBlockIndent=!0,blockString(e,r,i,a);if(l&&u===d)return quotedString(s,r)}let p=s.replace(/\n+/g,`$&\n${u}`);if(c){let test=e=>e.default&&e.tag!==`tag:yaml.org,2002:str`&&e.test?.test(p),{compat:e,tags:t}=r.doc.schema;if(t.some(test)||e?.some(test))return quotedString(s,r)}return l?p:n.foldFlowLines(p,u,n.FOLD_FLOW,getFoldOptions(r,!1))}function stringifyString(e,n,r,i){let{implicitKey:a,inFlow:o}=n,s=typeof e.value==`string`?e:Object.assign({},e,{value:String(e.value)}),{type:c}=e;c!==t.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(c=t.Scalar.QUOTE_DOUBLE);let _stringify=e=>{switch(e){case t.Scalar.BLOCK_FOLDED:case t.Scalar.BLOCK_LITERAL:return a||o?quotedString(s.value,n):blockString(s,n,r,i);case t.Scalar.QUOTE_DOUBLE:return doubleQuotedString(s.value,n);case t.Scalar.QUOTE_SINGLE:return singleQuotedString(s.value,n);case t.Scalar.PLAIN:return plainString(s,n,r,i);default:return null}},l=_stringify(c);if(l===null){let{defaultKeyType:e,defaultStringType:t}=n.options,r=a&&e||t;if(l=_stringify(r),l===null)throw Error(`Unsupported default string type ${r}`)}return l}e.stringifyString=stringifyString})),L=/* @__PURE__ */ __commonJSMin((e=>{var t=fe(),n=k(),r=F(),i=I();function createStringifyContext(e,t){let n=Object.assign({blockQuote:!0,commentString:r.stringifyComment,defaultKeyType:null,defaultStringType:`PLAIN`,directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:`false`,flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:`null`,simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:`true`,verifyAliasOrder:!0},e.schema.toStringOptions,t),i;switch(n.collectionStyle){case`block`:i=!1;break;case`flow`:i=!0;break;default:i=null}return{anchors:/* @__PURE__ */ new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?` `:``,indent:``,indentStep:typeof n.indent==`number`?` `.repeat(n.indent):` `,inFlow:i,options:n}}function getTagObject(e,t){if(t.tag){let n=e.filter(e=>e.tag===t.tag);if(n.length>0)return n.find(e=>e.format===t.format)??n[0]}let r,i;if(n.isScalar(t)){i=t.value;let n=e.filter(e=>e.identify?.(i));if(n.length>1){let e=n.filter(e=>e.test);e.length>0&&(n=e)}r=n.find(e=>e.format===t.format)??n.find(e=>!e.format)}else i=t,r=e.find(e=>e.nodeClass&&i instanceof e.nodeClass);if(!r){let e=i?.constructor?.name??(i===null?`null`:typeof i);throw Error(`Tag not resolved for ${e} value`)}return r}function stringifyProps(e,r,{anchors:i,doc:a}){if(!a.directives)return``;let o=[],s=(n.isScalar(e)||n.isCollection(e))&&e.anchor;s&&t.anchorIsValid(s)&&(i.add(s),o.push(`&${s}`));let c=e.tag??(r.default?null:r.tag);return c&&o.push(a.directives.tagString(c)),o.join(` `)}function stringify(e,t,r,a){if(n.isPair(e))return e.toString(t,r,a);if(n.isAlias(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw TypeError(`Cannot stringify circular structure without alias nodes`);t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=/* @__PURE__ */ new Set([e]),e=e.resolve(t.doc)}let o,s=n.isNode(e)?e:t.doc.createNode(e,{onTagObj:e=>o=e});o??=getTagObject(t.doc.schema.tags,s);let c=stringifyProps(s,o,t);c.length>0&&(t.indentAtStart=(t.indentAtStart??0)+c.length+1);let l=typeof o.stringify==`function`?o.stringify(s,t,r,a):n.isScalar(s)?i.stringifyString(s,t,r,a):s.toString(t,r,a);return c?n.isScalar(s)||l[0]===`{`||l[0]===`[`?`${c} ${l}`:`${c}\n${t.indent}${l}`:l}e.createStringifyContext=createStringifyContext,e.stringify=stringify})),_e=/* @__PURE__ */ __commonJSMin((e=>{var t=k(),n=N(),r=L(),i=F();function stringifyPair({key:e,value:a},o,s,c){let{allNullValues:l,doc:u,indent:d,indentStep:f,options:{commentString:p,indentSeq:m,simpleKeys:h}}=o,g=t.isNode(e)&&e.comment||null;if(h){if(g)throw Error(`With simple keys, key nodes cannot have comments`);if(t.isCollection(e)||!t.isNode(e)&&typeof e==`object`)throw Error(`With simple keys, collection cannot be used as a key value`)}let _=!h&&(!e||g&&a==null&&!o.inFlow||t.isCollection(e)||(t.isScalar(e)?e.type===n.Scalar.BLOCK_FOLDED||e.type===n.Scalar.BLOCK_LITERAL:typeof e==`object`));o=Object.assign({},o,{allNullValues:!1,implicitKey:!_&&(h||!l),indent:d+f});let v=!1,y=!1,b=r.stringify(e,o,()=>v=!0,()=>y=!0);if(!_&&!o.inFlow&&b.length>1024){if(h)throw Error(`With simple keys, single line scalar must not span more than 1024 characters`);_=!0}if(o.inFlow){if(l||a==null)return v&&s&&s(),b===``?`?`:_?`? ${b}`:b}else if(l&&!h||a==null&&_)return b=`? ${b}`,g&&!v?b+=i.lineComment(b,o.indent,p(g)):y&&c&&c(),b;v&&(g=null),_?(g&&(b+=i.lineComment(b,o.indent,p(g))),b=`? ${b}\n${d}:`):(b=`${b}:`,g&&(b+=i.lineComment(b,o.indent,p(g))));let x,S,C;t.isNode(a)?(x=!!a.spaceBefore,S=a.commentBefore,C=a.comment):(x=!1,S=null,C=null,a&&typeof a==`object`&&(a=u.createNode(a))),o.implicitKey=!1,!_&&!g&&t.isScalar(a)&&(o.indentAtStart=b.length+1),y=!1,!m&&f.length>=2&&!o.inFlow&&!_&&t.isSeq(a)&&!a.flow&&!a.tag&&!a.anchor&&(o.indent=o.indent.substring(2));let w=!1,T=r.stringify(a,o,()=>w=!0,()=>y=!0),E=` `;if(g||x||S){if(E=x?` +`))return blockString(e,r,i,a);if(containsDocumentMarker(s)){if(u===``)return r.forceBlockIndent=!0,blockString(e,r,i,a);if(l&&u===d)return quotedString(s,r)}let p=s.replace(/\n+/g,`$&\n${u}`);if(c){let test=e=>e.default&&e.tag!==`tag:yaml.org,2002:str`&&e.test?.test(p),{compat:e,tags:t}=r.doc.schema;if(t.some(test)||e?.some(test))return quotedString(s,r)}return l?p:n.foldFlowLines(p,u,n.FOLD_FLOW,getFoldOptions(r,!1))}function stringifyString(e,n,r,i){let{implicitKey:a,inFlow:o}=n,s=typeof e.value==`string`?e:Object.assign({},e,{value:String(e.value)}),{type:c}=e;c!==t.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(s.value)&&(c=t.Scalar.QUOTE_DOUBLE);let _stringify=e=>{switch(e){case t.Scalar.BLOCK_FOLDED:case t.Scalar.BLOCK_LITERAL:return a||o?quotedString(s.value,n):blockString(s,n,r,i);case t.Scalar.QUOTE_DOUBLE:return doubleQuotedString(s.value,n);case t.Scalar.QUOTE_SINGLE:return singleQuotedString(s.value,n);case t.Scalar.PLAIN:return plainString(s,n,r,i);default:return null}},l=_stringify(c);if(l===null){let{defaultKeyType:e,defaultStringType:t}=n.options,r=a&&e||t;if(l=_stringify(r),l===null)throw Error(`Unsupported default string type ${r}`)}return l}e.stringifyString=stringifyString})),L=/* @__PURE__ */ __commonJSMin((e=>{var t=A(),n=O(),r=F(),i=I();function createStringifyContext(e,t){let n=Object.assign({blockQuote:!0,commentString:r.stringifyComment,defaultKeyType:null,defaultStringType:`PLAIN`,directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:`false`,flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:`null`,simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:`true`,verifyAliasOrder:!0},e.schema.toStringOptions,t),i;switch(n.collectionStyle){case`block`:i=!1;break;case`flow`:i=!0;break;default:i=null}return{anchors:/* @__PURE__ */ new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?` `:``,indent:``,indentStep:typeof n.indent==`number`?` `.repeat(n.indent):` `,inFlow:i,options:n}}function getTagObject(e,t){if(t.tag){let n=e.filter(e=>e.tag===t.tag);if(n.length>0)return n.find(e=>e.format===t.format)??n[0]}let r,i;if(n.isScalar(t)){i=t.value;let n=e.filter(e=>e.identify?.(i));if(n.length>1){let e=n.filter(e=>e.test);e.length>0&&(n=e)}r=n.find(e=>e.format===t.format)??n.find(e=>!e.format)}else i=t,r=e.find(e=>e.nodeClass&&i instanceof e.nodeClass);if(!r){let e=i?.constructor?.name??(i===null?`null`:typeof i);throw Error(`Tag not resolved for ${e} value`)}return r}function stringifyProps(e,r,{anchors:i,doc:a}){if(!a.directives)return``;let o=[],s=(n.isScalar(e)||n.isCollection(e))&&e.anchor;s&&t.anchorIsValid(s)&&(i.add(s),o.push(`&${s}`));let c=e.tag??(r.default?null:r.tag);return c&&o.push(a.directives.tagString(c)),o.join(` `)}function stringify(e,t,r,a){if(n.isPair(e))return e.toString(t,r,a);if(n.isAlias(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw TypeError(`Cannot stringify circular structure without alias nodes`);t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=/* @__PURE__ */ new Set([e]),e=e.resolve(t.doc)}let o,s=n.isNode(e)?e:t.doc.createNode(e,{onTagObj:e=>o=e});o??=getTagObject(t.doc.schema.tags,s);let c=stringifyProps(s,o,t);c.length>0&&(t.indentAtStart=(t.indentAtStart??0)+c.length+1);let l=typeof o.stringify==`function`?o.stringify(s,t,r,a):n.isScalar(s)?i.stringifyString(s,t,r,a):s.toString(t,r,a);return c?n.isScalar(s)||l[0]===`{`||l[0]===`[`?`${c} ${l}`:`${c}\n${t.indent}${l}`:l}e.createStringifyContext=createStringifyContext,e.stringify=stringify})),ge=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=N(),r=L(),i=F();function stringifyPair({key:e,value:a},o,s,c){let{allNullValues:l,doc:u,indent:d,indentStep:f,options:{commentString:p,indentSeq:m,simpleKeys:h}}=o,g=t.isNode(e)&&e.comment||null;if(h){if(g)throw Error(`With simple keys, key nodes cannot have comments`);if(t.isCollection(e)||!t.isNode(e)&&typeof e==`object`)throw Error(`With simple keys, collection cannot be used as a key value`)}let _=!h&&(!e||g&&a==null&&!o.inFlow||t.isCollection(e)||(t.isScalar(e)?e.type===n.Scalar.BLOCK_FOLDED||e.type===n.Scalar.BLOCK_LITERAL:typeof e==`object`));o=Object.assign({},o,{allNullValues:!1,implicitKey:!_&&(h||!l),indent:d+f});let v=!1,y=!1,b=r.stringify(e,o,()=>v=!0,()=>y=!0);if(!_&&!o.inFlow&&b.length>1024){if(h)throw Error(`With simple keys, single line scalar must not span more than 1024 characters`);_=!0}if(o.inFlow){if(l||a==null)return v&&s&&s(),b===``?`?`:_?`? ${b}`:b}else if(l&&!h||a==null&&_)return b=`? ${b}`,g&&!v?b+=i.lineComment(b,o.indent,p(g)):y&&c&&c(),b;v&&(g=null),_?(g&&(b+=i.lineComment(b,o.indent,p(g))),b=`? ${b}\n${d}:`):(b=`${b}:`,g&&(b+=i.lineComment(b,o.indent,p(g))));let x,S,C;t.isNode(a)?(x=!!a.spaceBefore,S=a.commentBefore,C=a.comment):(x=!1,S=null,C=null,a&&typeof a==`object`&&(a=u.createNode(a))),o.implicitKey=!1,!_&&!g&&t.isScalar(a)&&(o.indentAtStart=b.length+1),y=!1,!m&&f.length>=2&&!o.inFlow&&!_&&t.isSeq(a)&&!a.flow&&!a.tag&&!a.anchor&&(o.indent=o.indent.substring(2));let w=!1,T=r.stringify(a,o,()=>w=!0,()=>y=!0),E=` `;if(g||x||S){if(E=x?` `:``,S){let e=p(S);E+=`\n${i.indentComment(e,o.indent)}`}T===``&&!o.inFlow?E===` `&&C&&(E=` `):E+=`\n${o.indent}`}else if(!_&&t.isCollection(a)){let e=T[0],t=T.indexOf(` `),n=t!==-1,r=o.inFlow??a.flow??a.items.length===0;if(n||!r){let r=!1;if(n&&(e===`&`||e===`!`)){let n=T.indexOf(` `);e===`&`&&n!==-1&&n{var t=O(`process`);function debug(e,...t){e===`debug`&&console.log(...t)}function warn(e,n){(e===`debug`||e===`warn`)&&(typeof t.emitWarning==`function`?t.emitWarning(n):console.warn(n))}e.debug=debug,e.warn=warn})),ye=/* @__PURE__ */ __commonJSMin((e=>{var t=k(),n=N();let r={identify:e=>e===`<<`||typeof e==`symbol`&&e.description===`<<`,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new n.Scalar(Symbol(`<<`)),{addToJSMap:addMergeToJSMap}),stringify:()=>`<<`},isMergeKey=(e,i)=>(r.identify(i)||t.isScalar(i)&&(!i.type||i.type===n.Scalar.PLAIN)&&r.identify(i.value))&&e?.doc.schema.tags.some(e=>e.tag===r.tag&&e.default);function addMergeToJSMap(e,n,r){let i=resolveAliasValue(e,r);if(t.isSeq(i))for(let t of i.items)mergeValue(e,n,t);else if(Array.isArray(i))for(let t of i)mergeValue(e,n,t);else mergeValue(e,n,i)}function mergeValue(e,n,r){let i=resolveAliasValue(e,r);if(!t.isMap(i))throw Error(`Merge sources must be maps or map aliases`);let a=i.toJSON(null,e,Map);for(let[e,t]of a)n instanceof Map?n.has(e)||n.set(e,t):n instanceof Set?n.add(e):Object.prototype.hasOwnProperty.call(n,e)||Object.defineProperty(n,e,{value:t,writable:!0,enumerable:!0,configurable:!0});return n}function resolveAliasValue(e,n){return e&&t.isAlias(n)?n.resolve(e.doc,e):n}e.addMergeToJSMap=addMergeToJSMap,e.isMergeKey=isMergeKey,e.merge=r})),be=/* @__PURE__ */ __commonJSMin((e=>{var t=ve(),n=ye(),r=L(),i=k(),a=j();function addPairToJSMap(e,t,{key:r,value:o}){if(i.isNode(r)&&r.addToJSMap)r.addToJSMap(e,t,o);else if(n.isMergeKey(e,r))n.addMergeToJSMap(e,t,o);else{let n=a.toJS(r,``,e);if(t instanceof Map)t.set(n,a.toJS(o,n,e));else if(t instanceof Set)t.add(n);else{let i=stringifyKey(r,n,e),s=a.toJS(o,i,e);i in t?Object.defineProperty(t,i,{value:s,writable:!0,enumerable:!0,configurable:!0}):t[i]=s}}return t}function stringifyKey(e,n,a){if(n===null)return``;if(typeof n!=`object`)return String(n);if(i.isNode(e)&&a?.doc){let n=r.createStringifyContext(a.doc,{});n.anchors=/* @__PURE__ */ new Set;for(let e of a.anchors.keys())n.anchors.add(e.anchor);n.inFlow=!0,n.inStringifyKey=!0;let i=e.toString(n);if(!a.mapKeyWarned){let e=JSON.stringify(i);e.length>40&&(e=e.substring(0,36)+`..."`),t.warn(a.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${e}. Set mapAsMap: true to use object keys.`),a.mapKeyWarned=!0}return i}return JSON.stringify(n)}e.addPairToJSMap=addPairToJSMap})),R=/* @__PURE__ */ __commonJSMin((e=>{var t=P(),n=_e(),r=be(),i=k();function createPair(e,n,r){return new a(t.createNode(e,void 0,r),t.createNode(n,void 0,r))}var a=class Pair{constructor(e,t=null){Object.defineProperty(this,i.NODE_TYPE,{value:i.PAIR}),this.key=e,this.value=t}clone(e){let{key:t,value:n}=this;return i.isNode(t)&&(t=t.clone(e)),i.isNode(n)&&(n=n.clone(e)),new Pair(t,n)}toJSON(e,t){let n=t?.mapAsMap?/* @__PURE__ */ new Map:{};return r.addPairToJSMap(t,n,this)}toString(e,t,r){return e?.doc?n.stringifyPair(this,e,t,r):JSON.stringify(this)}};e.Pair=a,e.createPair=createPair})),xe=/* @__PURE__ */ __commonJSMin((e=>{var t=k(),n=L(),r=F();function stringifyCollection(e,t,n){return(t.inFlow??e.flow?stringifyFlowCollection:stringifyBlockCollection)(e,t,n)}function stringifyBlockCollection({comment:e,items:i},a,{blockItemPrefix:o,flowChars:s,itemIndent:c,onChompKeep:l,onComment:u}){let{indent:d,options:{commentString:f}}=a,p=Object.assign({},a,{indent:c,type:null}),m=!1,h=[];for(let e=0;el=null,()=>m=!0);l&&(u+=r.lineComment(u,c,f(l))),m&&l&&(m=!1),h.push(o+u)}let g;if(h.length===0)g=s.start+s.end;else{g=h[0];for(let e=1;e{var t=D(`process`);function debug(e,...t){e===`debug`&&console.log(...t)}function warn(e,n){(e===`debug`||e===`warn`)&&(typeof t.emitWarning==`function`?t.emitWarning(n):console.warn(n))}e.debug=debug,e.warn=warn})),ve=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=N();let r={identify:e=>e===`<<`||typeof e==`symbol`&&e.description===`<<`,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new n.Scalar(Symbol(`<<`)),{addToJSMap:addMergeToJSMap}),stringify:()=>`<<`},isMergeKey=(e,i)=>(r.identify(i)||t.isScalar(i)&&(!i.type||i.type===n.Scalar.PLAIN)&&r.identify(i.value))&&e?.doc.schema.tags.some(e=>e.tag===r.tag&&e.default);function addMergeToJSMap(e,n,r){let i=resolveAliasValue(e,r);if(t.isSeq(i))for(let t of i.items)mergeValue(e,n,t);else if(Array.isArray(i))for(let t of i)mergeValue(e,n,t);else mergeValue(e,n,i)}function mergeValue(e,n,r){let i=resolveAliasValue(e,r);if(!t.isMap(i))throw Error(`Merge sources must be maps or map aliases`);let a=i.toJSON(null,e,Map);for(let[e,t]of a)n instanceof Map?n.has(e)||n.set(e,t):n instanceof Set?n.add(e):Object.prototype.hasOwnProperty.call(n,e)||Object.defineProperty(n,e,{value:t,writable:!0,enumerable:!0,configurable:!0});return n}function resolveAliasValue(e,n){return e&&t.isAlias(n)?n.resolve(e.doc,e):n}e.addMergeToJSMap=addMergeToJSMap,e.isMergeKey=isMergeKey,e.merge=r})),ye=/* @__PURE__ */ __commonJSMin((e=>{var t=_e(),n=ve(),r=L(),i=O(),a=j();function addPairToJSMap(e,t,{key:r,value:o}){if(i.isNode(r)&&r.addToJSMap)r.addToJSMap(e,t,o);else if(n.isMergeKey(e,r))n.addMergeToJSMap(e,t,o);else{let n=a.toJS(r,``,e);if(t instanceof Map)t.set(n,a.toJS(o,n,e));else if(t instanceof Set)t.add(n);else{let i=stringifyKey(r,n,e),s=a.toJS(o,i,e);i in t?Object.defineProperty(t,i,{value:s,writable:!0,enumerable:!0,configurable:!0}):t[i]=s}}return t}function stringifyKey(e,n,a){if(n===null)return``;if(typeof n!=`object`)return String(n);if(i.isNode(e)&&a?.doc){let n=r.createStringifyContext(a.doc,{});n.anchors=/* @__PURE__ */ new Set;for(let e of a.anchors.keys())n.anchors.add(e.anchor);n.inFlow=!0,n.inStringifyKey=!0;let i=e.toString(n);if(!a.mapKeyWarned){let e=JSON.stringify(i);e.length>40&&(e=e.substring(0,36)+`..."`),t.warn(a.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${e}. Set mapAsMap: true to use object keys.`),a.mapKeyWarned=!0}return i}return JSON.stringify(n)}e.addPairToJSMap=addPairToJSMap})),R=/* @__PURE__ */ __commonJSMin((e=>{var t=P(),n=ge(),r=ye(),i=O();function createPair(e,n,r){return new a(t.createNode(e,void 0,r),t.createNode(n,void 0,r))}var a=class Pair{constructor(e,t=null){Object.defineProperty(this,i.NODE_TYPE,{value:i.PAIR}),this.key=e,this.value=t}clone(e){let{key:t,value:n}=this;return i.isNode(t)&&(t=t.clone(e)),i.isNode(n)&&(n=n.clone(e)),new Pair(t,n)}toJSON(e,t){let n=t?.mapAsMap?/* @__PURE__ */ new Map:{};return r.addPairToJSMap(t,n,this)}toString(e,t,r){return e?.doc?n.stringifyPair(this,e,t,r):JSON.stringify(this)}};e.Pair=a,e.createPair=createPair})),be=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=L(),r=F();function stringifyCollection(e,t,n){return(t.inFlow??e.flow?stringifyFlowCollection:stringifyBlockCollection)(e,t,n)}function stringifyBlockCollection({comment:e,items:i},a,{blockItemPrefix:o,flowChars:s,itemIndent:c,onChompKeep:l,onComment:u}){let{indent:d,options:{commentString:f}}=a,p=Object.assign({},a,{indent:c,type:null}),m=!1,h=[];for(let e=0;el=null,()=>m=!0);l&&(u+=r.lineComment(u,c,f(l))),m&&l&&(m=!1),h.push(o+u)}let g;if(h.length===0)g=s.start+s.end;else{g=h[0];for(let e=1;ec=null);f||=m.length>p||l.includes(` `),a0&&(f||=m.reduce((e,t)=>e+t.length+2,2)+(l.length+2)>i.options.lineWidth),f&&(l+=`,`)),c&&(l+=r.lineComment(l,o,u(c))),m.push(l),p=m.length}let{start:h,end:g}=a;if(m.length===0)return h+g;if(!f){let e=m.reduce((e,t)=>e+t.length+2,2);f=i.options.lineWidth>0&&e>i.options.lineWidth}if(f){let e=h;for(let t of m)e+=t?`\n${c}${s}${t}`:` -`;return`${e}\n${s}${g}`}return`${h}${l}${m.join(` `)}${l}${g}`}function addCommentBefore({indent:e,options:{commentString:t}},n,i,a){if(i&&a&&(i=i.replace(/^\n+/,``)),i){let a=r.indentComment(t(i),e);n.push(a.trimStart())}}e.stringifyCollection=stringifyCollection})),z=/* @__PURE__ */ __commonJSMin((e=>{var t=xe(),n=be(),r=he(),i=k(),a=R(),o=N();function findPair(e,t){let n=i.isScalar(t)?t.value:t;for(let r of e)if(i.isPair(r)&&(r.key===t||r.key===n||i.isScalar(r.key)&&r.key.value===n))return r}e.YAMLMap=class extends r.Collection{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(i.MAP,e),this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:i}=n,o=new this(e),add=(e,s)=>{if(typeof i==`function`)s=i.call(t,e,s);else if(Array.isArray(i)&&!i.includes(e))return;(s!==void 0||r)&&o.items.push(a.createPair(e,s,n))};if(t instanceof Map)for(let[e,n]of t)add(e,n);else if(t&&typeof t==`object`)for(let e of Object.keys(t))add(e,t[e]);return typeof e.sortMapEntries==`function`&&o.items.sort(e.sortMapEntries),o}add(e,t){let n;n=i.isPair(e)?e:!e||typeof e!=`object`||!(`key`in e)?new a.Pair(e,e?.value):new a.Pair(e.key,e.value);let r=findPair(this.items,n.key),s=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);i.isScalar(r.value)&&o.isScalarValue(n.value)?r.value.value=n.value:r.value=n.value}else if(s){let e=this.items.findIndex(e=>s(n,e)<0);e===-1?this.items.push(n):this.items.splice(e,0,n)}else this.items.push(n)}delete(e){let t=findPair(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=findPair(this.items,e)?.value;return(!t&&i.isScalar(n)?n.value:n)??void 0}has(e){return!!findPair(this.items,e)}set(e,t){this.add(new a.Pair(e,t),!0)}toJSON(e,t,r){let i=r?new r:t?.mapAsMap?/* @__PURE__ */ new Map:{};t?.onCreate&&t.onCreate(i);for(let e of this.items)n.addPairToJSMap(t,i,e);return i}toString(e,n,r){if(!e)return JSON.stringify(this);for(let e of this.items)if(!i.isPair(e))throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),t.stringifyCollection(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:r,onComment:n})}},e.findPair=findPair})),B=/* @__PURE__ */ __commonJSMin((e=>{var t=k(),n=z();e.map={collection:`map`,default:!0,nodeClass:n.YAMLMap,tag:`tag:yaml.org,2002:map`,resolve(e,n){return t.isMap(e)||n(`Expected a mapping for this tag`),e},createNode:(e,t,r)=>n.YAMLMap.from(e,t,r)}})),V=/* @__PURE__ */ __commonJSMin((e=>{var t=P(),n=xe(),r=he(),i=k(),a=N(),o=j(),YAMLSeq=class extends r.Collection{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(i.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=asItemIndex(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=asItemIndex(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&i.isScalar(r)?r.value:r}has(e){let t=asItemIndex(e);return typeof t==`number`&&t=0?t:null}e.YAMLSeq=YAMLSeq})),H=/* @__PURE__ */ __commonJSMin((e=>{var t=k(),n=V();e.seq={collection:`seq`,default:!0,nodeClass:n.YAMLSeq,tag:`tag:yaml.org,2002:seq`,resolve(e,n){return t.isSeq(e)||n(`Expected a sequence for this tag`),e},createNode:(e,t,r)=>n.YAMLSeq.from(e,t,r)}})),U=/* @__PURE__ */ __commonJSMin((e=>{var t=I();e.string={identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify(e,n,r,i){return n=Object.assign({actualString:!0},n),t.stringifyString(e,n,r,i)}}})),Se=/* @__PURE__ */ __commonJSMin((e=>{var t=N();let n={identify:e=>e==null,createNode:()=>new t.Scalar(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new t.Scalar(null),stringify:({source:e},t)=>typeof e==`string`&&n.test.test(e)?e:t.options.nullStr};e.nullTag=n})),Ce=/* @__PURE__ */ __commonJSMin((e=>{var t=N();let n={identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new t.Scalar(e[0]===`t`||e[0]===`T`),stringify({source:e,value:t},r){return e&&n.test.test(e)&&t===(e[0]===`t`||e[0]===`T`)?e:t?r.options.trueStr:r.options.falseStr}};e.boolTag=n})),W=/* @__PURE__ */ __commonJSMin((e=>{function stringifyNumber({format:e,minFractionDigits:t,tag:n,value:r}){if(typeof r==`bigint`)return String(r);let i=typeof r==`number`?r:Number(r);if(!isFinite(i))return isNaN(i)?`.nan`:i<0?`-.inf`:`.inf`;let a=Object.is(r,-0)?`-0`:JSON.stringify(r);if(!e&&t&&(!n||n===`tag:yaml.org,2002:float`)&&/^-?\d/.test(a)&&!a.includes(`e`)){let e=a.indexOf(`.`);e<0&&(e=a.length,a+=`.`);let n=t-(a.length-e-1);for(;n-->0;)a+=`0`}return a}e.stringifyNumber=stringifyNumber})),we=/* @__PURE__ */ __commonJSMin((e=>{var t=N(),n=W();let r={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:n.stringifyNumber};e.float={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let n=new t.Scalar(parseFloat(e)),r=e.indexOf(`.`);return r!==-1&&e[e.length-1]===`0`&&(n.minFractionDigits=e.length-r-1),n},stringify:n.stringifyNumber},e.floatExp={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():n.stringifyNumber(e)}},e.floatNaN=r})),Te=/* @__PURE__ */ __commonJSMin((e=>{var t=W();let intIdentify=e=>typeof e==`bigint`||Number.isInteger(e),intResolve=(e,t,n,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),n);function intStringify(e,n,r){let{value:i}=e;return intIdentify(i)&&i>=0?r+i.toString(n):t.stringifyNumber(e)}e.int={identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>intResolve(e,0,10,n),stringify:t.stringifyNumber},e.intHex={identify:e=>intIdentify(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>intResolve(e,2,16,n),stringify:e=>intStringify(e,16,`0x`)},e.intOct={identify:e=>intIdentify(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^0o[0-7]+$/,resolve:(e,t,n)=>intResolve(e,2,8,n),stringify:e=>intStringify(e,8,`0o`)}})),Ee=/* @__PURE__ */ __commonJSMin((e=>{var t=B(),n=Se(),r=H(),i=U(),a=Ce(),o=we(),s=Te();e.schema=[t.map,r.seq,i.string,n.nullTag,a.boolTag,s.intOct,s.int,s.intHex,o.floatNaN,o.floatExp,o.float]})),De=/* @__PURE__ */ __commonJSMin((e=>{var t=N(),n=B(),r=H();function intIdentify(e){return typeof e==`bigint`||Number.isInteger(e)}let stringifyJSON=({value:e})=>JSON.stringify(e),i=[{identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify:stringifyJSON},{identify:e=>e==null,createNode:()=>new t.Scalar(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^null$/,resolve:()=>null,stringify:stringifyJSON},{identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^true$|^false$/,resolve:e=>e===`true`,stringify:stringifyJSON},{identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>intIdentify(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:stringifyJSON}];e.schema=[n.map,r.seq].concat(i,{default:!0,tag:``,test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}})})),Oe=/* @__PURE__ */ __commonJSMin((e=>{var t=O(`buffer`),n=N(),r=I();e.binary={identify:e=>e instanceof Uint8Array,default:!1,tag:`tag:yaml.org,2002:binary`,resolve(e,n){if(typeof t.Buffer==`function`)return t.Buffer.from(e,`base64`);if(typeof atob==`function`){let t=atob(e.replace(/[\n\r]/g,``)),n=new Uint8Array(t.length);for(let e=0;e{var t=k(),n=R(),r=N(),i=V();function resolvePairs(e,i){if(t.isSeq(e))for(let a=0;a1&&i(`Each pair must have its own sequence indicator`);let e=o.items[0]||new n.Pair(new r.Scalar(null));if(o.commentBefore&&(e.key.commentBefore=e.key.commentBefore?`${o.commentBefore}\n${e.key.commentBefore}`:o.commentBefore),o.comment){let t=e.value??e.key;t.comment=t.comment?`${o.comment}\n${t.comment}`:o.comment}o=e}e.items[a]=t.isPair(o)?o:new n.Pair(o)}}else i(`Expected a sequence for this tag`);return e}function createPairs(e,t,r){let{replacer:a}=r,o=new i.YAMLSeq(e);o.tag=`tag:yaml.org,2002:pairs`;let s=0;if(t&&Symbol.iterator in Object(t))for(let e of t){typeof a==`function`&&(e=a.call(t,String(s++),e));let i,c;if(Array.isArray(e)){if(e.length===2)i=e[0],c=e[1];else throw TypeError(`Expected [key, value] tuple: ${e}`)}else if(e&&e instanceof Object){let t=Object.keys(e);if(t.length===1)i=t[0],c=e[i];else throw TypeError(`Expected tuple with one key, not ${t.length} keys`)}else i=e;o.items.push(n.createPair(i,c,r))}return o}let a={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:resolvePairs,createNode:createPairs};e.createPairs=createPairs,e.pairs=a,e.resolvePairs=resolvePairs})),Ae=/* @__PURE__ */ __commonJSMin((e=>{var t=k(),n=j(),r=z(),i=V(),a=ke(),o=class YAMLOMap extends i.YAMLSeq{constructor(){super(),this.add=r.YAMLMap.prototype.add.bind(this),this.delete=r.YAMLMap.prototype.delete.bind(this),this.get=r.YAMLMap.prototype.get.bind(this),this.has=r.YAMLMap.prototype.has.bind(this),this.set=r.YAMLMap.prototype.set.bind(this),this.tag=YAMLOMap.tag}toJSON(e,r){if(!r)return super.toJSON(e);let i=/* @__PURE__ */ new Map;r?.onCreate&&r.onCreate(i);for(let e of this.items){let a,o;if(t.isPair(e)?(a=n.toJS(e.key,``,r),o=n.toJS(e.value,a,r)):a=n.toJS(e,``,r),i.has(a))throw Error(`Ordered maps must not include duplicate keys`);i.set(a,o)}return i}static from(e,t,n){let r=a.createPairs(e,t,n),i=new this;return i.items=r.items,i}};o.tag=`tag:yaml.org,2002:omap`;let s={collection:`seq`,identify:e=>e instanceof Map,nodeClass:o,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,n){let r=a.resolvePairs(e,n),i=[];for(let{key:e}of r.items)t.isScalar(e)&&(i.includes(e.value)?n(`Ordered maps must not include duplicate keys: ${e.value}`):i.push(e.value));return Object.assign(new o,r)},createNode:(e,t,n)=>o.from(e,t,n)};e.YAMLOMap=o,e.omap=s})),je=/* @__PURE__ */ __commonJSMin((e=>{var t=N();function boolStringify({value:e,source:t},i){return t&&(e?n:r).test.test(t)?t:e?i.options.trueStr:i.options.falseStr}let n={identify:e=>e===!0,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new t.Scalar(!0),stringify:boolStringify},r={identify:e=>e===!1,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new t.Scalar(!1),stringify:boolStringify};e.falseTag=r,e.trueTag=n})),Me=/* @__PURE__ */ __commonJSMin((e=>{var t=N(),n=W();let r={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:n.stringifyNumber};e.float={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let n=new t.Scalar(parseFloat(e.replace(/_/g,``))),r=e.indexOf(`.`);if(r!==-1){let t=e.substring(r+1).replace(/_/g,``);t[t.length-1]===`0`&&(n.minFractionDigits=t.length)}return n},stringify:n.stringifyNumber},e.floatExp={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,``)),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():n.stringifyNumber(e)}},e.floatNaN=r})),Ne=/* @__PURE__ */ __commonJSMin((e=>{var t=W();let intIdentify=e=>typeof e==`bigint`||Number.isInteger(e);function intResolve(e,t,n,{intAsBigInt:r}){let i=e[0];if((i===`-`||i===`+`)&&(t+=1),e=e.substring(t).replace(/_/g,``),r){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`}let t=BigInt(e);return i===`-`?BigInt(-1)*t:t}let a=parseInt(e,n);return i===`-`?-1*a:a}function intStringify(e,n,r){let{value:i}=e;if(intIdentify(i)){let e=i.toString(n);return i<0?`-`+r+e.substr(1):r+e}return t.stringifyNumber(e)}let n={identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>intResolve(e,2,2,n),stringify:e=>intStringify(e,2,`0b`)},r={identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>intResolve(e,1,8,n),stringify:e=>intStringify(e,8,`0`)},i={identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>intResolve(e,0,10,n),stringify:t.stringifyNumber},a={identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>intResolve(e,2,16,n),stringify:e=>intStringify(e,16,`0x`)};e.int=i,e.intBin=n,e.intHex=a,e.intOct=r})),Pe=/* @__PURE__ */ __commonJSMin((e=>{var t=k(),n=R(),r=z(),i=class YAMLSet extends r.YAMLMap{constructor(e){super(e),this.tag=YAMLSet.tag}add(e){let i;i=t.isPair(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new n.Pair(e.key,null):new n.Pair(e,null),r.findPair(this.items,i.key)||this.items.push(i)}get(e,n){let i=r.findPair(this.items,e);return!n&&t.isPair(i)?t.isScalar(i.key)?i.key.value:i.key:i}set(e,t){if(typeof t!=`boolean`)throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let i=r.findPair(this.items,e);i&&!t?this.items.splice(this.items.indexOf(i),1):!i&&t&&this.items.push(new n.Pair(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw Error(`Set items must all have null values`)}static from(e,t,r){let{replacer:i}=r,a=new this(e);if(t&&Symbol.iterator in Object(t))for(let e of t)typeof i==`function`&&(e=i.call(t,e,e)),a.items.push(n.createPair(e,null,r));return a}};i.tag=`tag:yaml.org,2002:set`;let a={collection:`map`,identify:e=>e instanceof Set,nodeClass:i,default:!1,tag:`tag:yaml.org,2002:set`,createNode:(e,t,n)=>i.from(e,t,n),resolve(e,n){if(t.isMap(e)){if(e.hasAllNullValues(!0))return Object.assign(new i,e);n(`Set items must all have null values`)}else n(`Expected a mapping for this tag`);return e}};e.YAMLSet=i,e.set=a})),Fe=/* @__PURE__ */ __commonJSMin((e=>{var t=W();function parseSexagesimal(e,t){let n=e[0],r=n===`-`||n===`+`?e.substring(1):e,num=e=>t?BigInt(e):Number(e),i=r.replace(/_/g,``).split(`:`).reduce((e,t)=>e*num(60)+num(t),num(0));return n===`-`?num(-1)*i:i}function stringifySexagesimal(e){let{value:n}=e,num=e=>e;if(typeof n==`bigint`)num=e=>BigInt(e);else if(isNaN(n)||!isFinite(n))return t.stringifyNumber(e);let r=``;n<0&&(r=`-`,n*=num(-1));let i=num(60),a=[n%i];return n<60?a.unshift(0):(n=(n-a[0])/i,a.unshift(n%i),n>=60&&(n=(n-a[0])/i,a.unshift(n))),r+a.map(e=>String(e).padStart(2,`0`)).join(`:`).replace(/000000\d*$/,``)}let n={identify:e=>typeof e==`bigint`||Number.isInteger(e),default:!0,tag:`tag:yaml.org,2002:int`,format:`TIME`,test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>parseSexagesimal(e,n),stringify:stringifySexagesimal},r={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`TIME`,test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>parseSexagesimal(e,!1),stringify:stringifySexagesimal},i={identify:e=>e instanceof Date,default:!0,tag:`tag:yaml.org,2002:timestamp`,test:RegExp(`^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$`),resolve(e){let t=e.match(i.test);if(!t)throw Error(`!!timestamp expects a date, starting with yyyy-mm-dd`);let[,n,r,a,o,s,c]=t.map(Number),l=t[7]?Number((t[7]+`00`).substr(1,3)):0,u=Date.UTC(n,r-1,a,o||0,s||0,c||0,l),d=t[8];if(d&&d!==`Z`){let e=parseSexagesimal(d,!1);Math.abs(e)<30&&(e*=60),u-=6e4*e}return new Date(u)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,``)??``};e.floatTime=r,e.intTime=n,e.timestamp=i})),Ie=/* @__PURE__ */ __commonJSMin((e=>{var t=B(),n=Se(),r=H(),i=U(),a=Oe(),o=je(),s=Me(),c=Ne(),l=ye(),u=Ae(),d=ke(),f=Pe(),p=Fe();e.schema=[t.map,r.seq,i.string,n.nullTag,o.trueTag,o.falseTag,c.intBin,c.intOct,c.int,c.intHex,s.floatNaN,s.floatExp,s.float,a.binary,l.merge,u.omap,d.pairs,f.set,p.intTime,p.floatTime,p.timestamp]})),Le=/* @__PURE__ */ __commonJSMin((e=>{var t=B(),n=Se(),r=H(),i=U(),a=Ce(),o=we(),s=Te(),c=Ee(),l=De(),u=Oe(),d=ye(),f=Ae(),p=ke(),m=Ie(),h=Pe(),g=Fe();let _=/* @__PURE__ */ new Map([[`core`,c.schema],[`failsafe`,[t.map,r.seq,i.string]],[`json`,l.schema],[`yaml11`,m.schema],[`yaml-1.1`,m.schema]]),v={binary:u.binary,bool:a.boolTag,float:o.float,floatExp:o.floatExp,floatNaN:o.floatNaN,floatTime:g.floatTime,int:s.int,intHex:s.intHex,intOct:s.intOct,intTime:g.intTime,map:t.map,merge:d.merge,null:n.nullTag,omap:f.omap,pairs:p.pairs,seq:r.seq,set:h.set,timestamp:g.timestamp},y={"tag:yaml.org,2002:binary":u.binary,"tag:yaml.org,2002:merge":d.merge,"tag:yaml.org,2002:omap":f.omap,"tag:yaml.org,2002:pairs":p.pairs,"tag:yaml.org,2002:set":h.set,"tag:yaml.org,2002:timestamp":g.timestamp};function getTags(e,t,n){let r=_.get(t);if(r&&!e)return n&&!r.includes(d.merge)?r.concat(d.merge):r.slice();let i=r;if(!i){if(Array.isArray(e))i=[];else{let e=Array.from(_.keys()).filter(e=>e!==`yaml11`).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown schema "${t}"; use one of ${e} or define customTags array`)}}if(Array.isArray(e))for(let t of e)i=i.concat(t);else typeof e==`function`&&(i=e(i.slice()));return n&&(i=i.concat(d.merge)),i.reduce((e,t)=>{let n=typeof t==`string`?v[t]:t;if(!n){let e=JSON.stringify(t),n=Object.keys(v).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown custom tag ${e}; use one of ${n}`)}return e.includes(n)||e.push(n),e},[])}e.coreKnownTags=y,e.getTags=getTags})),Re=/* @__PURE__ */ __commonJSMin((e=>{var t=k(),n=B(),r=H(),i=U(),a=Le();let sortMapEntriesByKey=(e,t)=>e.keyt.key);e.Schema=class Schema{constructor({compat:e,customTags:o,merge:s,resolveKnownTags:c,schema:l,sortMapEntries:u,toStringDefaults:d}){this.compat=Array.isArray(e)?a.getTags(e,`compat`):e?a.getTags(null,e):null,this.name=typeof l==`string`&&l||`core`,this.knownTags=c?a.coreKnownTags:{},this.tags=a.getTags(o,this.name,s),this.toStringOptions=d??null,Object.defineProperty(this,t.MAP,{value:n.map}),Object.defineProperty(this,t.SCALAR,{value:i.string}),Object.defineProperty(this,t.SEQ,{value:r.seq}),this.sortMapEntries=typeof u==`function`?u:u===!0?sortMapEntriesByKey:null}clone(){let e=Object.create(Schema.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}}})),ze=/* @__PURE__ */ __commonJSMin((e=>{var t=k(),n=L(),r=F();function stringifyDocument(e,i){let a=[],o=i.directives===!0;if(i.directives!==!1&&e.directives){let t=e.directives.toString(e);t?(a.push(t),o=!0):e.directives.docStart&&(o=!0)}o&&a.push(`---`);let s=n.createStringifyContext(e,i),{commentString:c}=s.options;if(e.commentBefore){a.length!==1&&a.unshift(``);let t=c(e.commentBefore);a.unshift(r.indentComment(t,``))}let l=!1,u=null;if(e.contents){if(t.isNode(e.contents)){if(e.contents.spaceBefore&&o&&a.push(``),e.contents.commentBefore){let t=c(e.contents.commentBefore);a.push(r.indentComment(t,``))}s.forceBlockIndent=!!e.comment,u=e.contents.comment}let i=u?void 0:()=>l=!0,d=n.stringify(e.contents,s,()=>u=null,i);u&&(d+=r.lineComment(d,``,c(u))),(d[0]===`|`||d[0]===`>`)&&a[a.length-1]===`---`?a[a.length-1]=`--- ${d}`:a.push(d)}else a.push(n.stringify(e.contents,s));if(e.directives?.docEnd){if(e.comment){let t=c(e.comment);t.includes(` +`;return`${e}\n${s}${g}`}return`${h}${l}${m.join(` `)}${l}${g}`}function addCommentBefore({indent:e,options:{commentString:t}},n,i,a){if(i&&a&&(i=i.replace(/^\n+/,``)),i){let a=r.indentComment(t(i),e);n.push(a.trimStart())}}e.stringifyCollection=stringifyCollection})),z=/* @__PURE__ */ __commonJSMin((e=>{var t=be(),n=ye(),r=me(),i=O(),a=R(),o=N();function findPair(e,t){let n=i.isScalar(t)?t.value:t;for(let r of e)if(i.isPair(r)&&(r.key===t||r.key===n||i.isScalar(r.key)&&r.key.value===n))return r}e.YAMLMap=class extends r.Collection{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(i.MAP,e),this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:i}=n,o=new this(e),add=(e,s)=>{if(typeof i==`function`)s=i.call(t,e,s);else if(Array.isArray(i)&&!i.includes(e))return;(s!==void 0||r)&&o.items.push(a.createPair(e,s,n))};if(t instanceof Map)for(let[e,n]of t)add(e,n);else if(t&&typeof t==`object`)for(let e of Object.keys(t))add(e,t[e]);return typeof e.sortMapEntries==`function`&&o.items.sort(e.sortMapEntries),o}add(e,t){let n;n=i.isPair(e)?e:!e||typeof e!=`object`||!(`key`in e)?new a.Pair(e,e?.value):new a.Pair(e.key,e.value);let r=findPair(this.items,n.key),s=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);i.isScalar(r.value)&&o.isScalarValue(n.value)?r.value.value=n.value:r.value=n.value}else if(s){let e=this.items.findIndex(e=>s(n,e)<0);e===-1?this.items.push(n):this.items.splice(e,0,n)}else this.items.push(n)}delete(e){let t=findPair(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=findPair(this.items,e)?.value;return(!t&&i.isScalar(n)?n.value:n)??void 0}has(e){return!!findPair(this.items,e)}set(e,t){this.add(new a.Pair(e,t),!0)}toJSON(e,t,r){let i=r?new r:t?.mapAsMap?/* @__PURE__ */ new Map:{};t?.onCreate&&t.onCreate(i);for(let e of this.items)n.addPairToJSMap(t,i,e);return i}toString(e,n,r){if(!e)return JSON.stringify(this);for(let e of this.items)if(!i.isPair(e))throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),t.stringifyCollection(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:r,onComment:n})}},e.findPair=findPair})),B=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=z();e.map={collection:`map`,default:!0,nodeClass:n.YAMLMap,tag:`tag:yaml.org,2002:map`,resolve(e,n){return t.isMap(e)||n(`Expected a mapping for this tag`),e},createNode:(e,t,r)=>n.YAMLMap.from(e,t,r)}})),V=/* @__PURE__ */ __commonJSMin((e=>{var t=P(),n=be(),r=me(),i=O(),a=N(),o=j(),YAMLSeq=class extends r.Collection{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(i.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=asItemIndex(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=asItemIndex(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&i.isScalar(r)?r.value:r}has(e){let t=asItemIndex(e);return typeof t==`number`&&t=0?t:null}e.YAMLSeq=YAMLSeq})),H=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=V();e.seq={collection:`seq`,default:!0,nodeClass:n.YAMLSeq,tag:`tag:yaml.org,2002:seq`,resolve(e,n){return t.isSeq(e)||n(`Expected a sequence for this tag`),e},createNode:(e,t,r)=>n.YAMLSeq.from(e,t,r)}})),U=/* @__PURE__ */ __commonJSMin((e=>{var t=I();e.string={identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify(e,n,r,i){return n=Object.assign({actualString:!0},n),t.stringifyString(e,n,r,i)}}})),xe=/* @__PURE__ */ __commonJSMin((e=>{var t=N();let n={identify:e=>e==null,createNode:()=>new t.Scalar(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new t.Scalar(null),stringify:({source:e},t)=>typeof e==`string`&&n.test.test(e)?e:t.options.nullStr};e.nullTag=n})),Se=/* @__PURE__ */ __commonJSMin((e=>{var t=N();let n={identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new t.Scalar(e[0]===`t`||e[0]===`T`),stringify({source:e,value:t},r){return e&&n.test.test(e)&&t===(e[0]===`t`||e[0]===`T`)?e:t?r.options.trueStr:r.options.falseStr}};e.boolTag=n})),W=/* @__PURE__ */ __commonJSMin((e=>{function stringifyNumber({format:e,minFractionDigits:t,tag:n,value:r}){if(typeof r==`bigint`)return String(r);let i=typeof r==`number`?r:Number(r);if(!isFinite(i))return isNaN(i)?`.nan`:i<0?`-.inf`:`.inf`;let a=Object.is(r,-0)?`-0`:JSON.stringify(r);if(!e&&t&&(!n||n===`tag:yaml.org,2002:float`)&&/^-?\d/.test(a)&&!a.includes(`e`)){let e=a.indexOf(`.`);e<0&&(e=a.length,a+=`.`);let n=t-(a.length-e-1);for(;n-->0;)a+=`0`}return a}e.stringifyNumber=stringifyNumber})),Ce=/* @__PURE__ */ __commonJSMin((e=>{var t=N(),n=W();let r={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:n.stringifyNumber};e.float={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let n=new t.Scalar(parseFloat(e)),r=e.indexOf(`.`);return r!==-1&&e[e.length-1]===`0`&&(n.minFractionDigits=e.length-r-1),n},stringify:n.stringifyNumber},e.floatExp={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():n.stringifyNumber(e)}},e.floatNaN=r})),we=/* @__PURE__ */ __commonJSMin((e=>{var t=W();let intIdentify=e=>typeof e==`bigint`||Number.isInteger(e),intResolve=(e,t,n,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),n);function intStringify(e,n,r){let{value:i}=e;return intIdentify(i)&&i>=0?r+i.toString(n):t.stringifyNumber(e)}e.int={identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>intResolve(e,0,10,n),stringify:t.stringifyNumber},e.intHex={identify:e=>intIdentify(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>intResolve(e,2,16,n),stringify:e=>intStringify(e,16,`0x`)},e.intOct={identify:e=>intIdentify(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^0o[0-7]+$/,resolve:(e,t,n)=>intResolve(e,2,8,n),stringify:e=>intStringify(e,8,`0o`)}})),Te=/* @__PURE__ */ __commonJSMin((e=>{var t=B(),n=xe(),r=H(),i=U(),a=Se(),o=Ce(),s=we();e.schema=[t.map,r.seq,i.string,n.nullTag,a.boolTag,s.intOct,s.int,s.intHex,o.floatNaN,o.floatExp,o.float]})),Ee=/* @__PURE__ */ __commonJSMin((e=>{var t=N(),n=B(),r=H();function intIdentify(e){return typeof e==`bigint`||Number.isInteger(e)}let stringifyJSON=({value:e})=>JSON.stringify(e),i=[{identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify:stringifyJSON},{identify:e=>e==null,createNode:()=>new t.Scalar(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^null$/,resolve:()=>null,stringify:stringifyJSON},{identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^true$|^false$/,resolve:e=>e===`true`,stringify:stringifyJSON},{identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>intIdentify(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:stringifyJSON}];e.schema=[n.map,r.seq].concat(i,{default:!0,tag:``,test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}})})),De=/* @__PURE__ */ __commonJSMin((e=>{var t=D(`buffer`),n=N(),r=I();e.binary={identify:e=>e instanceof Uint8Array,default:!1,tag:`tag:yaml.org,2002:binary`,resolve(e,n){if(typeof t.Buffer==`function`)return t.Buffer.from(e,`base64`);if(typeof atob==`function`){let t=atob(e.replace(/[\n\r]/g,``)),n=new Uint8Array(t.length);for(let e=0;e{var t=O(),n=R(),r=N(),i=V();function resolvePairs(e,i){if(t.isSeq(e))for(let a=0;a1&&i(`Each pair must have its own sequence indicator`);let e=o.items[0]||new n.Pair(new r.Scalar(null));if(o.commentBefore&&(e.key.commentBefore=e.key.commentBefore?`${o.commentBefore}\n${e.key.commentBefore}`:o.commentBefore),o.comment){let t=e.value??e.key;t.comment=t.comment?`${o.comment}\n${t.comment}`:o.comment}o=e}e.items[a]=t.isPair(o)?o:new n.Pair(o)}}else i(`Expected a sequence for this tag`);return e}function createPairs(e,t,r){let{replacer:a}=r,o=new i.YAMLSeq(e);o.tag=`tag:yaml.org,2002:pairs`;let s=0;if(t&&Symbol.iterator in Object(t))for(let e of t){typeof a==`function`&&(e=a.call(t,String(s++),e));let i,c;if(Array.isArray(e)){if(e.length===2)i=e[0],c=e[1];else throw TypeError(`Expected [key, value] tuple: ${e}`)}else if(e&&e instanceof Object){let t=Object.keys(e);if(t.length===1)i=t[0],c=e[i];else throw TypeError(`Expected tuple with one key, not ${t.length} keys`)}else i=e;o.items.push(n.createPair(i,c,r))}return o}let a={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:resolvePairs,createNode:createPairs};e.createPairs=createPairs,e.pairs=a,e.resolvePairs=resolvePairs})),ke=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=j(),r=z(),i=V(),a=Oe(),o=class YAMLOMap extends i.YAMLSeq{constructor(){super(),this.add=r.YAMLMap.prototype.add.bind(this),this.delete=r.YAMLMap.prototype.delete.bind(this),this.get=r.YAMLMap.prototype.get.bind(this),this.has=r.YAMLMap.prototype.has.bind(this),this.set=r.YAMLMap.prototype.set.bind(this),this.tag=YAMLOMap.tag}toJSON(e,r){if(!r)return super.toJSON(e);let i=/* @__PURE__ */ new Map;r?.onCreate&&r.onCreate(i);for(let e of this.items){let a,o;if(t.isPair(e)?(a=n.toJS(e.key,``,r),o=n.toJS(e.value,a,r)):a=n.toJS(e,``,r),i.has(a))throw Error(`Ordered maps must not include duplicate keys`);i.set(a,o)}return i}static from(e,t,n){let r=a.createPairs(e,t,n),i=new this;return i.items=r.items,i}};o.tag=`tag:yaml.org,2002:omap`;let s={collection:`seq`,identify:e=>e instanceof Map,nodeClass:o,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,n){let r=a.resolvePairs(e,n),i=[];for(let{key:e}of r.items)t.isScalar(e)&&(i.includes(e.value)?n(`Ordered maps must not include duplicate keys: ${e.value}`):i.push(e.value));return Object.assign(new o,r)},createNode:(e,t,n)=>o.from(e,t,n)};e.YAMLOMap=o,e.omap=s})),Ae=/* @__PURE__ */ __commonJSMin((e=>{var t=N();function boolStringify({value:e,source:t},i){return t&&(e?n:r).test.test(t)?t:e?i.options.trueStr:i.options.falseStr}let n={identify:e=>e===!0,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new t.Scalar(!0),stringify:boolStringify},r={identify:e=>e===!1,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new t.Scalar(!1),stringify:boolStringify};e.falseTag=r,e.trueTag=n})),je=/* @__PURE__ */ __commonJSMin((e=>{var t=N(),n=W();let r={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:n.stringifyNumber};e.float={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let n=new t.Scalar(parseFloat(e.replace(/_/g,``))),r=e.indexOf(`.`);if(r!==-1){let t=e.substring(r+1).replace(/_/g,``);t[t.length-1]===`0`&&(n.minFractionDigits=t.length)}return n},stringify:n.stringifyNumber},e.floatExp={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,``)),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():n.stringifyNumber(e)}},e.floatNaN=r})),Me=/* @__PURE__ */ __commonJSMin((e=>{var t=W();let intIdentify=e=>typeof e==`bigint`||Number.isInteger(e);function intResolve(e,t,n,{intAsBigInt:r}){let i=e[0];if((i===`-`||i===`+`)&&(t+=1),e=e.substring(t).replace(/_/g,``),r){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`}let t=BigInt(e);return i===`-`?BigInt(-1)*t:t}let a=parseInt(e,n);return i===`-`?-1*a:a}function intStringify(e,n,r){let{value:i}=e;if(intIdentify(i)){let e=i.toString(n);return i<0?`-`+r+e.substr(1):r+e}return t.stringifyNumber(e)}let n={identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>intResolve(e,2,2,n),stringify:e=>intStringify(e,2,`0b`)},r={identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>intResolve(e,1,8,n),stringify:e=>intStringify(e,8,`0`)},i={identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>intResolve(e,0,10,n),stringify:t.stringifyNumber},a={identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>intResolve(e,2,16,n),stringify:e=>intStringify(e,16,`0x`)};e.int=i,e.intBin=n,e.intHex=a,e.intOct=r})),Ne=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=R(),r=z(),i=class YAMLSet extends r.YAMLMap{constructor(e){super(e),this.tag=YAMLSet.tag}add(e){let i;i=t.isPair(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new n.Pair(e.key,null):new n.Pair(e,null),r.findPair(this.items,i.key)||this.items.push(i)}get(e,n){let i=r.findPair(this.items,e);return!n&&t.isPair(i)?t.isScalar(i.key)?i.key.value:i.key:i}set(e,t){if(typeof t!=`boolean`)throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let i=r.findPair(this.items,e);i&&!t?this.items.splice(this.items.indexOf(i),1):!i&&t&&this.items.push(new n.Pair(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw Error(`Set items must all have null values`)}static from(e,t,r){let{replacer:i}=r,a=new this(e);if(t&&Symbol.iterator in Object(t))for(let e of t)typeof i==`function`&&(e=i.call(t,e,e)),a.items.push(n.createPair(e,null,r));return a}};i.tag=`tag:yaml.org,2002:set`;let a={collection:`map`,identify:e=>e instanceof Set,nodeClass:i,default:!1,tag:`tag:yaml.org,2002:set`,createNode:(e,t,n)=>i.from(e,t,n),resolve(e,n){if(t.isMap(e)){if(e.hasAllNullValues(!0))return Object.assign(new i,e);n(`Set items must all have null values`)}else n(`Expected a mapping for this tag`);return e}};e.YAMLSet=i,e.set=a})),Pe=/* @__PURE__ */ __commonJSMin((e=>{var t=W();function parseSexagesimal(e,t){let n=e[0],r=n===`-`||n===`+`?e.substring(1):e,num=e=>t?BigInt(e):Number(e),i=r.replace(/_/g,``).split(`:`).reduce((e,t)=>e*num(60)+num(t),num(0));return n===`-`?num(-1)*i:i}function stringifySexagesimal(e){let{value:n}=e,num=e=>e;if(typeof n==`bigint`)num=e=>BigInt(e);else if(isNaN(n)||!isFinite(n))return t.stringifyNumber(e);let r=``;n<0&&(r=`-`,n*=num(-1));let i=num(60),a=[n%i];return n<60?a.unshift(0):(n=(n-a[0])/i,a.unshift(n%i),n>=60&&(n=(n-a[0])/i,a.unshift(n))),r+a.map(e=>String(e).padStart(2,`0`)).join(`:`).replace(/000000\d*$/,``)}let n={identify:e=>typeof e==`bigint`||Number.isInteger(e),default:!0,tag:`tag:yaml.org,2002:int`,format:`TIME`,test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>parseSexagesimal(e,n),stringify:stringifySexagesimal},r={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`TIME`,test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>parseSexagesimal(e,!1),stringify:stringifySexagesimal},i={identify:e=>e instanceof Date,default:!0,tag:`tag:yaml.org,2002:timestamp`,test:RegExp(`^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$`),resolve(e){let t=e.match(i.test);if(!t)throw Error(`!!timestamp expects a date, starting with yyyy-mm-dd`);let[,n,r,a,o,s,c]=t.map(Number),l=t[7]?Number((t[7]+`00`).substr(1,3)):0,u=Date.UTC(n,r-1,a,o||0,s||0,c||0,l),d=t[8];if(d&&d!==`Z`){let e=parseSexagesimal(d,!1);Math.abs(e)<30&&(e*=60),u-=6e4*e}return new Date(u)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,``)??``};e.floatTime=r,e.intTime=n,e.timestamp=i})),Fe=/* @__PURE__ */ __commonJSMin((e=>{var t=B(),n=xe(),r=H(),i=U(),a=De(),o=Ae(),s=je(),c=Me(),l=ve(),u=ke(),d=Oe(),f=Ne(),p=Pe();e.schema=[t.map,r.seq,i.string,n.nullTag,o.trueTag,o.falseTag,c.intBin,c.intOct,c.int,c.intHex,s.floatNaN,s.floatExp,s.float,a.binary,l.merge,u.omap,d.pairs,f.set,p.intTime,p.floatTime,p.timestamp]})),Ie=/* @__PURE__ */ __commonJSMin((e=>{var t=B(),n=xe(),r=H(),i=U(),a=Se(),o=Ce(),s=we(),c=Te(),l=Ee(),u=De(),d=ve(),f=ke(),p=Oe(),m=Fe(),h=Ne(),g=Pe();let _=/* @__PURE__ */ new Map([[`core`,c.schema],[`failsafe`,[t.map,r.seq,i.string]],[`json`,l.schema],[`yaml11`,m.schema],[`yaml-1.1`,m.schema]]),v={binary:u.binary,bool:a.boolTag,float:o.float,floatExp:o.floatExp,floatNaN:o.floatNaN,floatTime:g.floatTime,int:s.int,intHex:s.intHex,intOct:s.intOct,intTime:g.intTime,map:t.map,merge:d.merge,null:n.nullTag,omap:f.omap,pairs:p.pairs,seq:r.seq,set:h.set,timestamp:g.timestamp},y={"tag:yaml.org,2002:binary":u.binary,"tag:yaml.org,2002:merge":d.merge,"tag:yaml.org,2002:omap":f.omap,"tag:yaml.org,2002:pairs":p.pairs,"tag:yaml.org,2002:set":h.set,"tag:yaml.org,2002:timestamp":g.timestamp};function getTags(e,t,n){let r=_.get(t);if(r&&!e)return n&&!r.includes(d.merge)?r.concat(d.merge):r.slice();let i=r;if(!i){if(Array.isArray(e))i=[];else{let e=Array.from(_.keys()).filter(e=>e!==`yaml11`).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown schema "${t}"; use one of ${e} or define customTags array`)}}if(Array.isArray(e))for(let t of e)i=i.concat(t);else typeof e==`function`&&(i=e(i.slice()));return n&&(i=i.concat(d.merge)),i.reduce((e,t)=>{let n=typeof t==`string`?v[t]:t;if(!n){let e=JSON.stringify(t),n=Object.keys(v).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown custom tag ${e}; use one of ${n}`)}return e.includes(n)||e.push(n),e},[])}e.coreKnownTags=y,e.getTags=getTags})),Le=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=B(),r=H(),i=U(),a=Ie();let sortMapEntriesByKey=(e,t)=>e.keyt.key);e.Schema=class Schema{constructor({compat:e,customTags:o,merge:s,resolveKnownTags:c,schema:l,sortMapEntries:u,toStringDefaults:d}){this.compat=Array.isArray(e)?a.getTags(e,`compat`):e?a.getTags(null,e):null,this.name=typeof l==`string`&&l||`core`,this.knownTags=c?a.coreKnownTags:{},this.tags=a.getTags(o,this.name,s),this.toStringOptions=d??null,Object.defineProperty(this,t.MAP,{value:n.map}),Object.defineProperty(this,t.SCALAR,{value:i.string}),Object.defineProperty(this,t.SEQ,{value:r.seq}),this.sortMapEntries=typeof u==`function`?u:u===!0?sortMapEntriesByKey:null}clone(){let e=Object.create(Schema.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}}})),Re=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=L(),r=F();function stringifyDocument(e,i){let a=[],o=i.directives===!0;if(i.directives!==!1&&e.directives){let t=e.directives.toString(e);t?(a.push(t),o=!0):e.directives.docStart&&(o=!0)}o&&a.push(`---`);let s=n.createStringifyContext(e,i),{commentString:c}=s.options;if(e.commentBefore){a.length!==1&&a.unshift(``);let t=c(e.commentBefore);a.unshift(r.indentComment(t,``))}let l=!1,u=null;if(e.contents){if(t.isNode(e.contents)){if(e.contents.spaceBefore&&o&&a.push(``),e.contents.commentBefore){let t=c(e.contents.commentBefore);a.push(r.indentComment(t,``))}s.forceBlockIndent=!!e.comment,u=e.contents.comment}let i=u?void 0:()=>l=!0,d=n.stringify(e.contents,s,()=>u=null,i);u&&(d+=r.lineComment(d,``,c(u))),(d[0]===`|`||d[0]===`>`)&&a[a.length-1]===`---`?a[a.length-1]=`--- ${d}`:a.push(d)}else a.push(n.stringify(e.contents,s));if(e.directives?.docEnd){if(e.comment){let t=c(e.comment);t.includes(` `)?(a.push(`...`),a.push(r.indentComment(t,``))):a.push(`... ${t}`)}else a.push(`...`)}else{let t=e.comment;t&&l&&(t=t.replace(/^\n+/,``)),t&&((!l||u)&&a[a.length-1]!==``&&a.push(``),a.push(r.indentComment(c(t),``)))}return a.join(` `)+` -`}e.stringifyDocument=stringifyDocument})),G=/* @__PURE__ */ __commonJSMin((e=>{var t=M(),n=he(),r=k(),i=R(),a=j(),o=Re(),s=ze(),c=fe(),l=pe(),u=P(),d=de(),f=class Document{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,r.NODE_TYPE,{value:r.DOC});let i=null;typeof t==`function`||Array.isArray(t)?i=t:n===void 0&&t&&(n=t,t=void 0);let a=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:`warn`,prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:`1.2`},n);this.options=a;let{version:o}=a;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new d.Directives({version:o}),this.setSchema(o,n),this.contents=e===void 0?null:this.createNode(e,i,n)}clone(){let e=Object.create(Document.prototype,{[r.NODE_TYPE]:{value:r.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=r.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){assertCollection(this.contents)&&this.contents.add(e)}addIn(e,t){assertCollection(this.contents)&&this.contents.addIn(e,t)}createAlias(e,n){if(!e.anchor){let t=c.anchorNames(this);e.anchor=!n||t.has(n)?c.findNewAnchor(n||`a`,t):n}return new t.Alias(e.anchor)}createNode(e,t,n){let i;if(typeof t==`function`)e=t.call({"":e},``,e),i=t;else if(Array.isArray(t)){let e=t.filter(e=>typeof e==`number`||e instanceof String||e instanceof Number).map(String);e.length>0&&(t=t.concat(e)),i=t}else n===void 0&&t&&(n=t,t=void 0);let{aliasDuplicateObjects:a,anchorPrefix:o,flow:s,keepUndefined:l,onTagObj:d,tag:f}=n??{},{onAnchor:p,setAnchors:m,sourceObjects:h}=c.createNodeAnchors(this,o||`a`),g={aliasDuplicateObjects:a??!0,keepUndefined:l??!1,onAnchor:p,onTagObj:d,replacer:i,schema:this.schema,sourceObjects:h},_=u.createNode(e,f,g);return s&&r.isCollection(_)&&(_.flow=!0),m(),_}createPair(e,t,n={}){let r=this.createNode(e,null,n),a=this.createNode(t,null,n);return new i.Pair(r,a)}delete(e){return assertCollection(this.contents)?this.contents.delete(e):!1}deleteIn(e){return n.isEmptyPath(e)?this.contents!=null&&(this.contents=null,!0):assertCollection(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return r.isCollection(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return n.isEmptyPath(e)?!t&&r.isScalar(this.contents)?this.contents.value:this.contents:r.isCollection(this.contents)?this.contents.getIn(e,t):void 0}has(e){return r.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return n.isEmptyPath(e)?this.contents!==void 0:r.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=n.collectionFromPath(this.schema,[e],t):assertCollection(this.contents)&&this.contents.set(e,t)}setIn(e,t){n.isEmptyPath(e)?this.contents=t:this.contents==null?this.contents=n.collectionFromPath(this.schema,Array.from(e),t):assertCollection(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e==`number`&&(e=String(e));let n;switch(e){case`1.1`:this.directives?this.directives.yaml.version=`1.1`:this.directives=new d.Directives({version:`1.1`}),n={resolveKnownTags:!1,schema:`yaml-1.1`};break;case`1.2`:case`next`:this.directives?this.directives.yaml.version=e:this.directives=new d.Directives({version:e}),n={resolveKnownTags:!0,schema:`core`};break;case null:this.directives&&delete this.directives,n=null;break;default:{let t=JSON.stringify(e);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${t}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(n)this.schema=new o.Schema(Object.assign(n,t));else throw Error(`With a null YAML version, the { schema: Schema } option is required`)}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:r,onAnchor:i,reviver:o}={}){let s={anchors:/* @__PURE__ */ new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r==`number`?r:100},c=a.toJS(this.contents,t??``,s);if(typeof i==`function`)for(let{count:e,res:t}of s.anchors.values())i(t,e);return typeof o==`function`?l.applyReviver(o,{"":c},``,c):c}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw Error(`Document with errors cannot be stringified`);if(`indent`in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw Error(`"indent" option must be a positive integer, not ${t}`)}return s.stringifyDocument(this,e)}};function assertCollection(e){if(r.isCollection(e))return!0;throw Error(`Expected a YAML collection as document contents`)}e.Document=f})),K=/* @__PURE__ */ __commonJSMin((e=>{var YAMLError=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},YAMLParseError=class extends YAMLError{constructor(e,t,n){super(`YAMLParseError`,e,t,n)}},YAMLWarning=class extends YAMLError{constructor(e,t,n){super(`YAMLWarning`,e,t,n)}};e.YAMLError=YAMLError,e.YAMLParseError=YAMLParseError,e.YAMLWarning=YAMLWarning,e.prettifyError=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(e=>t.linePos(e));let{line:r,col:i}=n.linePos[0];n.message+=` at line ${r}, column ${i}`;let a=i-1,o=e.substring(t.lineStarts[r-1],t.lineStarts[r]).replace(/[\n\r]+$/,``);if(a>=60&&o.length>80){let e=Math.min(a-39,o.length-79);o=`…`+o.substring(e),a-=e-1}if(o.length>80&&(o=o.substring(0,79)+`…`),r>1&&/^ *$/.test(o.substring(0,a))){let n=e.substring(t.lineStarts[r-2],t.lineStarts[r-1]);n.length>80&&(n=n.substring(0,79)+`… -`),o=n+o}if(/[^ ]/.test(o)){let e=1,t=n.linePos[1];t?.line===r&&t.col>i&&(e=Math.max(1,Math.min(t.col-i,80-a)));let s=` `.repeat(a)+`^`.repeat(e);n.message+=`:\n\n${o}\n${s}\n`}}})),q=/* @__PURE__ */ __commonJSMin((e=>{function resolveProps(e,{flow:t,indicator:n,next:r,offset:i,onError:a,parentIndent:o,startOnNewline:s}){let c=!1,l=s,u=s,d=``,f=``,p=!1,m=!1,h=null,g=null,_=null,v=null,y=null,b=null,x=null;for(let i of e)switch(m&&=(i.type!==`space`&&i.type!==`newline`&&i.type!==`comma`&&a(i.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),!1),h&&=(l&&i.type!==`comment`&&i.type!==`newline`&&a(h,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),null),i.type){case`space`:!t&&(n!==`doc-start`||r?.type!==`flow-collection`)&&i.source.includes(` `)&&(h=i),u=!0;break;case`comment`:{u||a(i,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let e=i.source.substring(1)||` `;d?d+=f+e:d=e,f=``,l=!1;break}case`newline`:l?d?d+=i.source:(!b||n!==`seq-item-ind`)&&(c=!0):f+=i.source,l=!0,p=!0,(g||_)&&(v=i),u=!0;break;case`anchor`:g&&a(i,`MULTIPLE_ANCHORS`,`A node can have at most one anchor`),i.source.endsWith(`:`)&&a(i.offset+i.source.length-1,`BAD_ALIAS`,`Anchor ending in : is ambiguous`,!0),g=i,x??=i.offset,l=!1,u=!1,m=!0;break;case`tag`:_&&a(i,`MULTIPLE_TAGS`,`A node can have at most one tag`),_=i,x??=i.offset,l=!1,u=!1,m=!0;break;case n:(g||_)&&a(i,`BAD_PROP_ORDER`,`Anchors and tags must be after the ${i.source} indicator`),b&&a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.source} in ${t??`collection`}`),b=i,l=n===`seq-item-ind`||n===`explicit-key-ind`,u=!1;break;case`comma`:if(t){y&&a(i,`UNEXPECTED_TOKEN`,`Unexpected , in ${t}`),y=i,l=!1,u=!1;break}default:a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.type} token`),l=!1,u=!1}let S=e[e.length-1],C=S?S.offset+S.source.length:i;return m&&r&&r.type!==`space`&&r.type!==`newline`&&r.type!==`comma`&&(r.type!==`scalar`||r.source!==``)&&a(r.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),h&&(l&&h.indent<=o||r?.type===`block-map`||r?.type===`block-seq`)&&a(h,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),{comma:y,found:b,spaceBefore:c,comment:d,hasNewline:p,anchor:g,tag:_,newlineAfterProp:v,end:C,start:x??C}}e.resolveProps=resolveProps})),Be=/* @__PURE__ */ __commonJSMin((e=>{function containsNewline(e){if(!e)return null;switch(e.type){case`alias`:case`scalar`:case`double-quoted-scalar`:case`single-quoted-scalar`:if(e.source.includes(` -`))return!0;if(e.end){for(let t of e.end)if(t.type===`newline`)return!0}return!1;case`flow-collection`:for(let t of e.items){for(let e of t.start)if(e.type===`newline`)return!0;if(t.sep){for(let e of t.sep)if(e.type===`newline`)return!0}if(containsNewline(t.key)||containsNewline(t.value))return!0}return!1;default:return!0}}e.containsNewline=containsNewline})),Ve=/* @__PURE__ */ __commonJSMin((e=>{var t=Be();function flowIndentCheck(e,n,r){if(n?.type===`flow-collection`){let i=n.end[0];i.indent===e&&(i.source===`]`||i.source===`}`)&&t.containsNewline(n)&&r(i,`BAD_INDENT`,`Flow end indicator should be more indented than parent`,!0)}}e.flowIndentCheck=flowIndentCheck})),He=/* @__PURE__ */ __commonJSMin((e=>{var t=k();function mapIncludes(e,n,r){let{uniqueKeys:i}=e.options;if(i===!1)return!1;let a=typeof i==`function`?i:(e,n)=>e===n||t.isScalar(e)&&t.isScalar(n)&&e.value===n.value;return n.some(e=>a(e.key,r))}e.mapIncludes=mapIncludes})),Ue=/* @__PURE__ */ __commonJSMin((e=>{var t=R(),n=z(),r=q(),i=Be(),a=Ve(),o=He();let s=`All mapping items must start at the same column`;function resolveBlockMap({composeNode:e,composeEmptyNode:c},l,u,d,f){let p=new((f?.nodeClass)??n.YAMLMap)(l.schema);l.atRoot&&=!1;let m=u.offset,h=null;for(let n of u.items){let{start:f,key:g,sep:_,value:v}=n,y=r.resolveProps(f,{indicator:`explicit-key-ind`,next:g??_?.[0],offset:m,onError:d,parentIndent:u.indent,startOnNewline:!0}),b=!y.found;if(b){if(g&&(g.type===`block-seq`?d(m,`BLOCK_AS_IMPLICIT_KEY`,`A block sequence may not be used as an implicit map key`):`indent`in g&&g.indent!==u.indent&&d(m,`BAD_INDENT`,s)),!y.anchor&&!y.tag&&!_){h=y.end,y.comment&&(p.comment?p.comment+=` +`}e.stringifyDocument=stringifyDocument})),G=/* @__PURE__ */ __commonJSMin((e=>{var t=M(),n=me(),r=O(),i=R(),a=j(),o=Le(),s=Re(),c=A(),l=fe(),u=P(),d=de(),f=class Document{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,r.NODE_TYPE,{value:r.DOC});let i=null;typeof t==`function`||Array.isArray(t)?i=t:n===void 0&&t&&(n=t,t=void 0);let a=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:`warn`,prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:`1.2`},n);this.options=a;let{version:o}=a;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new d.Directives({version:o}),this.setSchema(o,n),this.contents=e===void 0?null:this.createNode(e,i,n)}clone(){let e=Object.create(Document.prototype,{[r.NODE_TYPE]:{value:r.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=r.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){assertCollection(this.contents)&&this.contents.add(e)}addIn(e,t){assertCollection(this.contents)&&this.contents.addIn(e,t)}createAlias(e,n){if(!e.anchor){let t=c.anchorNames(this);e.anchor=!n||t.has(n)?c.findNewAnchor(n||`a`,t):n}return new t.Alias(e.anchor)}createNode(e,t,n){let i;if(typeof t==`function`)e=t.call({"":e},``,e),i=t;else if(Array.isArray(t)){let e=t.filter(e=>typeof e==`number`||e instanceof String||e instanceof Number).map(String);e.length>0&&(t=t.concat(e)),i=t}else n===void 0&&t&&(n=t,t=void 0);let{aliasDuplicateObjects:a,anchorPrefix:o,flow:s,keepUndefined:l,onTagObj:d,tag:f}=n??{},{onAnchor:p,setAnchors:m,sourceObjects:h}=c.createNodeAnchors(this,o||`a`),g={aliasDuplicateObjects:a??!0,keepUndefined:l??!1,onAnchor:p,onTagObj:d,replacer:i,schema:this.schema,sourceObjects:h},_=u.createNode(e,f,g);return s&&r.isCollection(_)&&(_.flow=!0),m(),_}createPair(e,t,n={}){let r=this.createNode(e,null,n),a=this.createNode(t,null,n);return new i.Pair(r,a)}delete(e){return assertCollection(this.contents)?this.contents.delete(e):!1}deleteIn(e){return n.isEmptyPath(e)?this.contents!=null&&(this.contents=null,!0):assertCollection(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return r.isCollection(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return n.isEmptyPath(e)?!t&&r.isScalar(this.contents)?this.contents.value:this.contents:r.isCollection(this.contents)?this.contents.getIn(e,t):void 0}has(e){return r.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return n.isEmptyPath(e)?this.contents!==void 0:r.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=n.collectionFromPath(this.schema,[e],t):assertCollection(this.contents)&&this.contents.set(e,t)}setIn(e,t){n.isEmptyPath(e)?this.contents=t:this.contents==null?this.contents=n.collectionFromPath(this.schema,Array.from(e),t):assertCollection(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e==`number`&&(e=String(e));let n;switch(e){case`1.1`:this.directives?this.directives.yaml.version=`1.1`:this.directives=new d.Directives({version:`1.1`}),n={resolveKnownTags:!1,schema:`yaml-1.1`};break;case`1.2`:case`next`:this.directives?this.directives.yaml.version=e:this.directives=new d.Directives({version:e}),n={resolveKnownTags:!0,schema:`core`};break;case null:this.directives&&delete this.directives,n=null;break;default:{let t=JSON.stringify(e);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${t}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(n)this.schema=new o.Schema(Object.assign(n,t));else throw Error(`With a null YAML version, the { schema: Schema } option is required`)}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:r,onAnchor:i,reviver:o}={}){let s={anchors:/* @__PURE__ */ new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r==`number`?r:100},c=a.toJS(this.contents,t??``,s);if(typeof i==`function`)for(let{count:e,res:t}of s.anchors.values())i(t,e);return typeof o==`function`?l.applyReviver(o,{"":c},``,c):c}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw Error(`Document with errors cannot be stringified`);if(`indent`in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw Error(`"indent" option must be a positive integer, not ${t}`)}return s.stringifyDocument(this,e)}};function assertCollection(e){if(r.isCollection(e))return!0;throw Error(`Expected a YAML collection as document contents`)}e.Document=f})),K=/* @__PURE__ */ __commonJSMin((e=>{var YAMLError=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},YAMLParseError=class extends YAMLError{constructor(e,t,n){super(`YAMLParseError`,e,t,n)}},YAMLWarning=class extends YAMLError{constructor(e,t,n){super(`YAMLWarning`,e,t,n)}};e.YAMLError=YAMLError,e.YAMLParseError=YAMLParseError,e.YAMLWarning=YAMLWarning,e.prettifyError=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(e=>t.linePos(e));let{line:r,col:i}=n.linePos[0];n.message+=` at line ${r}, column ${i}`;let a=i-1,o=e.substring(t.lineStarts[r-1],t.lineStarts[r]).replace(/[\n\r]+$/,``);if(a>=60&&o.length>80){let e=Math.min(a-39,o.length-79);o=`…`+o.substring(e),a-=e-1}if(o.length>80&&(o=o.substring(0,79)+`…`),r>1&&/^ *$/.test(o.substring(0,a))){let n=e.substring(t.lineStarts[r-2],t.lineStarts[r-1]);n.length>80&&(n=n.substring(0,79)+`… +`),o=n+o}if(/[^ ]/.test(o)){let e=1,t=n.linePos[1];t?.line===r&&t.col>i&&(e=Math.max(1,Math.min(t.col-i,80-a)));let s=` `.repeat(a)+`^`.repeat(e);n.message+=`:\n\n${o}\n${s}\n`}}})),q=/* @__PURE__ */ __commonJSMin((e=>{function resolveProps(e,{flow:t,indicator:n,next:r,offset:i,onError:a,parentIndent:o,startOnNewline:s}){let c=!1,l=s,u=s,d=``,f=``,p=!1,m=!1,h=null,g=null,_=null,v=null,y=null,b=null,x=null;for(let i of e)switch(m&&=(i.type!==`space`&&i.type!==`newline`&&i.type!==`comma`&&a(i.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),!1),h&&=(l&&i.type!==`comment`&&i.type!==`newline`&&a(h,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),null),i.type){case`space`:!t&&(n!==`doc-start`||r?.type!==`flow-collection`)&&i.source.includes(` `)&&(h=i),u=!0;break;case`comment`:{u||a(i,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let e=i.source.substring(1)||` `;d?d+=f+e:d=e,f=``,l=!1;break}case`newline`:l?d?d+=i.source:(!b||n!==`seq-item-ind`)&&(c=!0):f+=i.source,l=!0,p=!0,(g||_)&&(v=i),u=!0;break;case`anchor`:g&&a(i,`MULTIPLE_ANCHORS`,`A node can have at most one anchor`),i.source.endsWith(`:`)&&a(i.offset+i.source.length-1,`BAD_ALIAS`,`Anchor ending in : is ambiguous`,!0),g=i,x??=i.offset,l=!1,u=!1,m=!0;break;case`tag`:_&&a(i,`MULTIPLE_TAGS`,`A node can have at most one tag`),_=i,x??=i.offset,l=!1,u=!1,m=!0;break;case n:(g||_)&&a(i,`BAD_PROP_ORDER`,`Anchors and tags must be after the ${i.source} indicator`),b&&a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.source} in ${t??`collection`}`),b=i,l=n===`seq-item-ind`||n===`explicit-key-ind`,u=!1;break;case`comma`:if(t){y&&a(i,`UNEXPECTED_TOKEN`,`Unexpected , in ${t}`),y=i,l=!1,u=!1;break}default:a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.type} token`),l=!1,u=!1}let S=e[e.length-1],C=S?S.offset+S.source.length:i;return m&&r&&r.type!==`space`&&r.type!==`newline`&&r.type!==`comma`&&(r.type!==`scalar`||r.source!==``)&&a(r.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),h&&(l&&h.indent<=o||r?.type===`block-map`||r?.type===`block-seq`)&&a(h,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),{comma:y,found:b,spaceBefore:c,comment:d,hasNewline:p,anchor:g,tag:_,newlineAfterProp:v,end:C,start:x??C}}e.resolveProps=resolveProps})),ze=/* @__PURE__ */ __commonJSMin((e=>{function containsNewline(e){if(!e)return null;switch(e.type){case`alias`:case`scalar`:case`double-quoted-scalar`:case`single-quoted-scalar`:if(e.source.includes(` +`))return!0;if(e.end){for(let t of e.end)if(t.type===`newline`)return!0}return!1;case`flow-collection`:for(let t of e.items){for(let e of t.start)if(e.type===`newline`)return!0;if(t.sep){for(let e of t.sep)if(e.type===`newline`)return!0}if(containsNewline(t.key)||containsNewline(t.value))return!0}return!1;default:return!0}}e.containsNewline=containsNewline})),Be=/* @__PURE__ */ __commonJSMin((e=>{var t=ze();function flowIndentCheck(e,n,r){if(n?.type===`flow-collection`){let i=n.end[0];i.indent===e&&(i.source===`]`||i.source===`}`)&&t.containsNewline(n)&&r(i,`BAD_INDENT`,`Flow end indicator should be more indented than parent`,!0)}}e.flowIndentCheck=flowIndentCheck})),Ve=/* @__PURE__ */ __commonJSMin((e=>{var t=O();function mapIncludes(e,n,r){let{uniqueKeys:i}=e.options;if(i===!1)return!1;let a=typeof i==`function`?i:(e,n)=>e===n||t.isScalar(e)&&t.isScalar(n)&&e.value===n.value;return n.some(e=>a(e.key,r))}e.mapIncludes=mapIncludes})),He=/* @__PURE__ */ __commonJSMin((e=>{var t=R(),n=z(),r=q(),i=ze(),a=Be(),o=Ve();let s=`All mapping items must start at the same column`;function resolveBlockMap({composeNode:e,composeEmptyNode:c},l,u,d,f){let p=new((f?.nodeClass)??n.YAMLMap)(l.schema);l.atRoot&&=!1;let m=u.offset,h=null;for(let n of u.items){let{start:f,key:g,sep:_,value:v}=n,y=r.resolveProps(f,{indicator:`explicit-key-ind`,next:g??_?.[0],offset:m,onError:d,parentIndent:u.indent,startOnNewline:!0}),b=!y.found;if(b){if(g&&(g.type===`block-seq`?d(m,`BLOCK_AS_IMPLICIT_KEY`,`A block sequence may not be used as an implicit map key`):`indent`in g&&g.indent!==u.indent&&d(m,`BAD_INDENT`,s)),!y.anchor&&!y.tag&&!_){h=y.end,y.comment&&(p.comment?p.comment+=` `+y.comment:p.comment=y.comment);continue}(y.newlineAfterProp||i.containsNewline(g))&&d(g??f[f.length-1],`MULTILINE_IMPLICIT_KEY`,`Implicit keys need to be on a single line`)}else y.found?.indent!==u.indent&&d(m,`BAD_INDENT`,s);l.atKey=!0;let x=y.end,S=g?e(l,g,y,d):c(l,x,f,null,y,d);l.schema.compat&&a.flowIndentCheck(u.indent,g,d),l.atKey=!1,o.mapIncludes(l,p.items,S)&&d(x,`DUPLICATE_KEY`,`Map keys must be unique`);let C=r.resolveProps(_??[],{indicator:`map-value-ind`,next:v,offset:S.range[2],onError:d,parentIndent:u.indent,startOnNewline:!g||g.type===`block-scalar`});if(m=C.end,C.found){b&&(v?.type===`block-map`&&!C.hasNewline&&d(m,`BLOCK_AS_IMPLICIT_KEY`,`Nested mappings are not allowed in compact mappings`),l.options.strict&&y.start{var t=V(),n=q(),r=Ve();function resolveBlockSeq({composeNode:e,composeEmptyNode:i},a,o,s,c){let l=new((c?.nodeClass)??t.YAMLSeq)(a.schema);a.atRoot&&=!1,a.atKey&&=!1;let u=o.offset,d=null;for(let{start:t,value:c}of o.items){let f=n.resolveProps(t,{indicator:`seq-item-ind`,next:c,offset:u,onError:s,parentIndent:o.indent,startOnNewline:!0});if(!f.found){if(f.anchor||f.tag||c)c?.type===`block-seq`?s(f.end,`BAD_INDENT`,`All sequence items must start at the same column`):s(u,`MISSING_CHAR`,`Sequence item without - indicator`);else{d=f.end,f.comment&&(l.comment=f.comment);continue}}let p=c?e(a,c,f,s):i(a,f.end,t,null,f,s);a.schema.compat&&r.flowIndentCheck(o.indent,c,s),u=p.range[2],l.items.push(p)}return l.range=[o.offset,u,d??u],l}e.resolveBlockSeq=resolveBlockSeq})),J=/* @__PURE__ */ __commonJSMin((e=>{function resolveEnd(e,t,n,r){let i=``;if(e){let a=!1,o=``;for(let s of e){let{source:e,type:c}=s;switch(c){case`space`:a=!0;break;case`comment`:{n&&!a&&r(s,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let t=e.substring(1)||` `;i?i+=o+t:i=t,o=``;break}case`newline`:i&&(o+=e),a=!0;break;default:r(s,`UNEXPECTED_TOKEN`,`Unexpected ${c} at node end`)}t+=e.length}}return{comment:i,offset:t}}e.resolveEnd=resolveEnd})),Ge=/* @__PURE__ */ __commonJSMin((e=>{var t=k(),n=R(),r=z(),i=V(),a=J(),o=q(),s=Be(),c=He();let l=`Block collections are not allowed within flow collections`,isBlock=e=>e&&(e.type===`block-map`||e.type===`block-seq`);function resolveFlowCollection({composeNode:e,composeEmptyNode:u},d,f,p,m){let h=f.start.source===`{`,g=h?`flow map`:`flow sequence`,_=new((m?.nodeClass)??(h?r.YAMLMap:i.YAMLSeq))(d.schema);_.flow=!0;let v=d.atRoot;v&&(d.atRoot=!1),d.atKey&&=!1;let y=f.offset+f.start.source.length;for(let i=0;i{var t=V(),n=q(),r=Be();function resolveBlockSeq({composeNode:e,composeEmptyNode:i},a,o,s,c){let l=new((c?.nodeClass)??t.YAMLSeq)(a.schema);a.atRoot&&=!1,a.atKey&&=!1;let u=o.offset,d=null;for(let{start:t,value:c}of o.items){let f=n.resolveProps(t,{indicator:`seq-item-ind`,next:c,offset:u,onError:s,parentIndent:o.indent,startOnNewline:!0});if(!f.found){if(f.anchor||f.tag||c)c?.type===`block-seq`?s(f.end,`BAD_INDENT`,`All sequence items must start at the same column`):s(u,`MISSING_CHAR`,`Sequence item without - indicator`);else{d=f.end,f.comment&&(l.comment=f.comment);continue}}let p=c?e(a,c,f,s):i(a,f.end,t,null,f,s);a.schema.compat&&r.flowIndentCheck(o.indent,c,s),u=p.range[2],l.items.push(p)}return l.range=[o.offset,u,d??u],l}e.resolveBlockSeq=resolveBlockSeq})),J=/* @__PURE__ */ __commonJSMin((e=>{function resolveEnd(e,t,n,r){let i=``;if(e){let a=!1,o=``;for(let s of e){let{source:e,type:c}=s;switch(c){case`space`:a=!0;break;case`comment`:{n&&!a&&r(s,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let t=e.substring(1)||` `;i?i+=o+t:i=t,o=``;break}case`newline`:i&&(o+=e),a=!0;break;default:r(s,`UNEXPECTED_TOKEN`,`Unexpected ${c} at node end`)}t+=e.length}}return{comment:i,offset:t}}e.resolveEnd=resolveEnd})),We=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=R(),r=z(),i=V(),a=J(),o=q(),s=ze(),c=Ve();let l=`Block collections are not allowed within flow collections`,isBlock=e=>e&&(e.type===`block-map`||e.type===`block-seq`);function resolveFlowCollection({composeNode:e,composeEmptyNode:u},d,f,p,m){let h=f.start.source===`{`,g=h?`flow map`:`flow sequence`,_=new((m?.nodeClass)??(h?r.YAMLMap:i.YAMLSeq))(d.schema);_.flow=!0;let v=d.atRoot;v&&(d.atRoot=!1),d.atKey&&=!1;let y=f.offset+f.start.source.length;for(let i=0;i0){let e=a.resolveEnd(S,C,d.options.strict,p);e.comment&&(_.comment?_.comment+=` -`+e.comment:_.comment=e.comment),_.range=[f.offset,C,e.offset]}else _.range=[f.offset,C,C];return _}e.resolveFlowCollection=resolveFlowCollection})),Ke=/* @__PURE__ */ __commonJSMin((e=>{var t=k(),n=N(),r=z(),i=V(),a=Ue(),o=We(),s=Ge();function resolveCollection(e,t,n,r,i,c){let l=n.type===`block-map`?a.resolveBlockMap(e,t,n,r,c):n.type===`block-seq`?o.resolveBlockSeq(e,t,n,r,c):s.resolveFlowCollection(e,t,n,r,c),u=l.constructor;return i===`!`||i===u.tagName?(l.tag=u.tagName,l):(i&&(l.tag=i),l)}function composeCollection(e,a,o,s,c){let l=s.tag,u=l?a.directives.tagName(l.source,e=>c(l,`TAG_RESOLVE_FAILED`,e)):null;if(o.type===`block-seq`){let{anchor:e,newlineAfterProp:t}=s,n=e&&l?e.offset>l.offset?e:l:e??l;n&&(!t||t.offsete.tag===u&&e.collection===d);if(!f){let t=a.schema.knownTags[u];if(t?.collection===d)a.schema.tags.push(Object.assign({},t,{default:!1})),f=t;else return t?c(l,`BAD_COLLECTION_TYPE`,`${t.tag} used for ${d} collection, but expects ${t.collection??`scalar`}`,!0):c(l,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${u}`,!0),resolveCollection(e,a,o,c,u)}let p=resolveCollection(e,a,o,c,u,f),m=f.resolve?.(p,e=>c(l,`TAG_RESOLVE_FAILED`,e),a.options)??p,h=t.isNode(m)?m:new n.Scalar(m);return h.range=p.range,h.tag=u,f?.format&&(h.format=f.format),h}e.composeCollection=composeCollection})),qe=/* @__PURE__ */ __commonJSMin((e=>{var t=N();function resolveBlockScalar(e,n,r){let i=n.offset,a=parseBlockScalarHeader(n,e.options.strict,r);if(!a)return{value:``,type:null,comment:``,range:[i,i,i]};let o=a.mode===`>`?t.Scalar.BLOCK_FOLDED:t.Scalar.BLOCK_LITERAL,s=n.source?splitLines(n.source):[],c=s.length;for(let e=s.length-1;e>=0;--e){let t=s[e][1];if(t===``||t===`\r`)c=e;else break}if(c===0){let e=a.chomp===`+`&&s.length>0?` +`+e.comment:_.comment=e.comment),_.range=[f.offset,C,e.offset]}else _.range=[f.offset,C,C];return _}e.resolveFlowCollection=resolveFlowCollection})),Ge=/* @__PURE__ */ __commonJSMin((e=>{var t=O(),n=N(),r=z(),i=V(),a=He(),o=Ue(),s=We();function resolveCollection(e,t,n,r,i,c){let l=n.type===`block-map`?a.resolveBlockMap(e,t,n,r,c):n.type===`block-seq`?o.resolveBlockSeq(e,t,n,r,c):s.resolveFlowCollection(e,t,n,r,c),u=l.constructor;return i===`!`||i===u.tagName?(l.tag=u.tagName,l):(i&&(l.tag=i),l)}function composeCollection(e,a,o,s,c){let l=s.tag,u=l?a.directives.tagName(l.source,e=>c(l,`TAG_RESOLVE_FAILED`,e)):null;if(o.type===`block-seq`){let{anchor:e,newlineAfterProp:t}=s,n=e&&l?e.offset>l.offset?e:l:e??l;n&&(!t||t.offsete.tag===u&&e.collection===d);if(!f){let t=a.schema.knownTags[u];if(t?.collection===d)a.schema.tags.push(Object.assign({},t,{default:!1})),f=t;else return t?c(l,`BAD_COLLECTION_TYPE`,`${t.tag} used for ${d} collection, but expects ${t.collection??`scalar`}`,!0):c(l,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${u}`,!0),resolveCollection(e,a,o,c,u)}let p=resolveCollection(e,a,o,c,u,f),m=f.resolve?.(p,e=>c(l,`TAG_RESOLVE_FAILED`,e),a.options)??p,h=t.isNode(m)?m:new n.Scalar(m);return h.range=p.range,h.tag=u,f?.format&&(h.format=f.format),h}e.composeCollection=composeCollection})),Ke=/* @__PURE__ */ __commonJSMin((e=>{var t=N();function resolveBlockScalar(e,n,r){let i=n.offset,a=parseBlockScalarHeader(n,e.options.strict,r);if(!a)return{value:``,type:null,comment:``,range:[i,i,i]};let o=a.mode===`>`?t.Scalar.BLOCK_FOLDED:t.Scalar.BLOCK_LITERAL,s=n.source?splitLines(n.source):[],c=s.length;for(let e=s.length-1;e>=0;--e){let t=s[e][1];if(t===``||t===`\r`)c=e;else break}if(c===0){let e=a.chomp===`+`&&s.length>0?` `.repeat(Math.max(1,s.length-1)):``,t=i+a.length;return n.source&&(t+=n.source.length),{value:e,type:o,comment:a.comment,range:[i,t,t]}}let l=n.indent+a.indent,u=n.offset+a.length,d=0;for(let t=0;tl&&(l=n.length);else{n.length=c;--e)s[e][0].length>l&&(c=e+1);let f=``,p=``,m=!1;for(let e=0;e{var t=N(),n=J();function resolveFlowScalar(e,r,i){let{offset:a,type:o,source:s,end:c}=e,l,u,_onError=(e,t,n)=>i(a+e,t,n);switch(o){case`scalar`:l=t.Scalar.PLAIN,u=plainValue(s,_onError);break;case`single-quoted-scalar`:l=t.Scalar.QUOTE_SINGLE,u=singleQuotedValue(s,_onError);break;case`double-quoted-scalar`:l=t.Scalar.QUOTE_DOUBLE,u=doubleQuotedValue(s,_onError);break; +default:{r(i,`UNEXPECTED_TOKEN`,`Unexpected token in block scalar header: ${i.type}`);let e=i.source;e&&typeof e==`string`&&(d+=e.length)}}}return{mode:a,indent:o,chomp:s,comment:u,length:d}}function splitLines(e){let t=e.split(/\n( *)/),n=t[0],r=n.match(/^( *)/),i=[r?.[1]?[r[1],n.slice(r[1].length)]:[``,n]];for(let e=1;e{var t=N(),n=J();function resolveFlowScalar(e,r,i){let{offset:a,type:o,source:s,end:c}=e,l,u,_onError=(e,t,n)=>i(a+e,t,n);switch(o){case`scalar`:l=t.Scalar.PLAIN,u=plainValue(s,_onError);break;case`single-quoted-scalar`:l=t.Scalar.QUOTE_SINGLE,u=singleQuotedValue(s,_onError);break;case`double-quoted-scalar`:l=t.Scalar.QUOTE_DOUBLE,u=doubleQuotedValue(s,_onError);break; /* istanbul ignore next should not happen */ default:return i(e,`UNEXPECTED_TOKEN`,`Expected a flow scalar value, but found: ${o}`),{value:``,type:null,comment:``,range:[a,a+s.length,a+s.length]}}let d=a+s.length,f=n.resolveEnd(c,d,r,i);return{value:u,type:l,comment:f.comment,range:[a,d,f.offset]}}function plainValue(e,t){let n=``;switch(e[0]){ /* istanbul ignore next should not happen */ @@ -86,10 +86,10 @@ case` `:n=`a tab character`;break;case`,`:n=`flow indicator character ,`;break;c `);)r===` `&&(n+=` `),t+=1,r=e[t+1];return n||=` `,{fold:n,offset:t}}let r={0:`\0`,a:`\x07`,b:`\b`,e:`\x1B`,f:`\f`,n:` -`,r:`\r`,t:` `,v:`\v`,N:`…`,_:`\xA0`,L:`\u2028`,P:`\u2029`," ":` `,'"':`"`,"/":`/`,"\\":`\\`," ":` `};function parseCharCode(e,t,n,r){let i=e.substr(t,n),a=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(a)}catch{let i=e.substr(t-2,n+2);return r(t-2,`BAD_DQ_ESCAPE`,`Invalid escape sequence ${i}`),i}}e.resolveFlowScalar=resolveFlowScalar})),Ye=/* @__PURE__ */ __commonJSMin((e=>{var t=k(),n=N(),r=qe(),i=Je();function composeScalar(e,a,o,s){let{value:c,type:l,comment:u,range:d}=a.type===`block-scalar`?r.resolveBlockScalar(e,a,s):i.resolveFlowScalar(a,e.options.strict,s),f=o?e.directives.tagName(o.source,e=>s(o,`TAG_RESOLVE_FAILED`,e)):null,p;p=e.options.stringKeys&&e.atKey?e.schema[t.SCALAR]:f?findScalarTagByName(e.schema,c,f,o,s):a.type===`scalar`?findScalarTagByTest(e,c,a,s):e.schema[t.SCALAR];let m;try{let r=p.resolve(c,e=>s(o??a,`TAG_RESOLVE_FAILED`,e),e.options);m=t.isScalar(r)?r:new n.Scalar(r)}catch(e){let t=e instanceof Error?e.message:String(e);s(o??a,`TAG_RESOLVE_FAILED`,t),m=new n.Scalar(c)}return m.range=d,m.source=c,l&&(m.type=l),f&&(m.tag=f),p.format&&(m.format=p.format),u&&(m.comment=u),m}function findScalarTagByName(e,n,r,i,a){if(r===`!`)return e[t.SCALAR];let o=[];for(let t of e.tags)if(!t.collection&&t.tag===r){if(t.default&&t.test)o.push(t);else return t}for(let e of o)if(e.test?.test(n))return e;let s=e.knownTags[r];return s&&!s.collection?(e.tags.push(Object.assign({},s,{default:!1,test:void 0})),s):(a(i,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${r}`,r!==`tag:yaml.org,2002:str`),e[t.SCALAR])}function findScalarTagByTest({atKey:e,directives:n,schema:r},i,a,o){let s=r.tags.find(t=>(t.default===!0||e&&t.default===`key`)&&t.test?.test(i))||r[t.SCALAR];if(r.compat){let e=r.compat.find(e=>e.default&&e.test?.test(i))??r[t.SCALAR];s.tag!==e.tag&&o(a,`TAG_RESOLVE_FAILED`,`Value may be parsed as either ${n.tagString(s.tag)} or ${n.tagString(e.tag)}`,!0)}return s}e.composeScalar=composeScalar})),Xe=/* @__PURE__ */ __commonJSMin((e=>{function emptyScalarPosition(e,t,n){if(t){n??=t.length;for(let r=n-1;r>=0;--r){let n=t[r];switch(n.type){case`space`:case`comment`:case`newline`:e-=n.source.length;continue}for(n=t[++r];n?.type===`space`;)e+=n.source.length,n=t[++r];break}}return e}e.emptyScalarPosition=emptyScalarPosition})),Ze=/* @__PURE__ */ __commonJSMin((e=>{var t=M(),n=k(),r=Ke(),i=Ye(),a=J(),o=Xe();let s={composeNode,composeEmptyNode};function composeNode(e,t,a,o){let c=e.atKey,{spaceBefore:l,comment:u,anchor:d,tag:f}=a,p,m=!0;switch(t.type){case`alias`:p=composeAlias(e,t,o),(d||f)&&o(t,`ALIAS_PROPS`,`An alias node must not specify any properties`);break;case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:case`block-scalar`:p=i.composeScalar(e,t,f,o),d&&(p.anchor=d.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:try{p=r.composeCollection(s,e,t,a,o),d&&(p.anchor=d.source.substring(1))}catch(e){o(t,`RESOURCE_EXHAUSTION`,e instanceof Error?e.message:String(e))}break;default:o(t,`UNEXPECTED_TOKEN`,t.type===`error`?t.message:`Unsupported token (type: ${t.type})`),m=!1}return p??=composeEmptyNode(e,t.offset,void 0,null,a,o),d&&p.anchor===``&&o(d,`BAD_ALIAS`,`Anchor cannot be an empty string`),c&&e.options.stringKeys&&(!n.isScalar(p)||typeof p.value!=`string`||p.tag&&p.tag!==`tag:yaml.org,2002:str`)&&o(f??t,`NON_STRING_KEY`,`With stringKeys, all keys must be strings`),l&&(p.spaceBefore=!0),u&&(t.type===`scalar`&&t.source===``?p.comment=u:p.commentBefore=u),e.options.keepSourceTokens&&m&&(p.srcToken=t),p}function composeEmptyNode(e,t,n,r,{spaceBefore:a,comment:s,anchor:c,tag:l,end:u},d){let f={type:`scalar`,offset:o.emptyScalarPosition(t,n,r),indent:-1,source:``},p=i.composeScalar(e,f,l,d);return c&&(p.anchor=c.source.substring(1),p.anchor===``&&d(c,`BAD_ALIAS`,`Anchor cannot be an empty string`)),a&&(p.spaceBefore=!0),s&&(p.comment=s,p.range[2]=u),p}function composeAlias({options:e},{offset:n,source:r,end:i},o){let s=new t.Alias(r.substring(1));s.source===``&&o(n,`BAD_ALIAS`,`Alias cannot be an empty string`),s.source.endsWith(`:`)&&o(n+r.length-1,`BAD_ALIAS`,`Alias ending in : is ambiguous`,!0);let c=n+r.length,l=a.resolveEnd(i,c,e.strict,o);return s.range=[n,c,l.offset],l.comment&&(s.comment=l.comment),s}e.composeEmptyNode=composeEmptyNode,e.composeNode=composeNode})),Qe=/* @__PURE__ */ __commonJSMin((e=>{var t=G(),n=Ze(),r=J(),i=q();function composeDoc(e,a,{offset:o,start:s,value:c,end:l},u){let d=Object.assign({_directives:a},e),f=new t.Document(void 0,d),p={atKey:!1,atRoot:!0,directives:f.directives,options:f.options,schema:f.schema},m=i.resolveProps(s,{indicator:`doc-start`,next:c??l?.[0],offset:o,onError:u,parentIndent:0,startOnNewline:!0});m.found&&(f.directives.docStart=!0,c&&(c.type===`block-map`||c.type===`block-seq`)&&!m.hasNewline&&u(m.end,`MISSING_CHAR`,`Block collection cannot start on same line with directives-end marker`)),f.contents=c?n.composeNode(p,c,m,u):n.composeEmptyNode(p,m.end,s,null,m,u);let h=f.contents.range[2],g=r.resolveEnd(l,h,!1,u);return g.comment&&(f.comment=g.comment),f.range=[o,h,g.offset],f}e.composeDoc=composeDoc})),$e=/* @__PURE__ */ __commonJSMin((e=>{var t=O(`process`),n=de(),r=G(),i=K(),a=k(),o=Qe(),s=J();function getErrorPos(e){if(typeof e==`number`)return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:n}=e;return[t,t+(typeof n==`string`?n.length:1)]}function parsePrelude(e){let t=``,n=!1,r=!1;for(let i=0;i{var t=O(),n=N(),r=Ke(),i=qe();function composeScalar(e,a,o,s){let{value:c,type:l,comment:u,range:d}=a.type===`block-scalar`?r.resolveBlockScalar(e,a,s):i.resolveFlowScalar(a,e.options.strict,s),f=o?e.directives.tagName(o.source,e=>s(o,`TAG_RESOLVE_FAILED`,e)):null,p;p=e.options.stringKeys&&e.atKey?e.schema[t.SCALAR]:f?findScalarTagByName(e.schema,c,f,o,s):a.type===`scalar`?findScalarTagByTest(e,c,a,s):e.schema[t.SCALAR];let m;try{let r=p.resolve(c,e=>s(o??a,`TAG_RESOLVE_FAILED`,e),e.options);m=t.isScalar(r)?r:new n.Scalar(r)}catch(e){let t=e instanceof Error?e.message:String(e);s(o??a,`TAG_RESOLVE_FAILED`,t),m=new n.Scalar(c)}return m.range=d,m.source=c,l&&(m.type=l),f&&(m.tag=f),p.format&&(m.format=p.format),u&&(m.comment=u),m}function findScalarTagByName(e,n,r,i,a){if(r===`!`)return e[t.SCALAR];let o=[];for(let t of e.tags)if(!t.collection&&t.tag===r){if(t.default&&t.test)o.push(t);else return t}for(let e of o)if(e.test?.test(n))return e;let s=e.knownTags[r];return s&&!s.collection?(e.tags.push(Object.assign({},s,{default:!1,test:void 0})),s):(a(i,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${r}`,r!==`tag:yaml.org,2002:str`),e[t.SCALAR])}function findScalarTagByTest({atKey:e,directives:n,schema:r},i,a,o){let s=r.tags.find(t=>(t.default===!0||e&&t.default===`key`)&&t.test?.test(i))||r[t.SCALAR];if(r.compat){let e=r.compat.find(e=>e.default&&e.test?.test(i))??r[t.SCALAR];s.tag!==e.tag&&o(a,`TAG_RESOLVE_FAILED`,`Value may be parsed as either ${n.tagString(s.tag)} or ${n.tagString(e.tag)}`,!0)}return s}e.composeScalar=composeScalar})),Ye=/* @__PURE__ */ __commonJSMin((e=>{function emptyScalarPosition(e,t,n){if(t){n??=t.length;for(let r=n-1;r>=0;--r){let n=t[r];switch(n.type){case`space`:case`comment`:case`newline`:e-=n.source.length;continue}for(n=t[++r];n?.type===`space`;)e+=n.source.length,n=t[++r];break}}return e}e.emptyScalarPosition=emptyScalarPosition})),Xe=/* @__PURE__ */ __commonJSMin((e=>{var t=M(),n=O(),r=Ge(),i=Je(),a=J(),o=Ye();let s={composeNode,composeEmptyNode};function composeNode(e,t,a,o){let c=e.atKey,{spaceBefore:l,comment:u,anchor:d,tag:f}=a,p,m=!0;switch(t.type){case`alias`:p=composeAlias(e,t,o),(d||f)&&o(t,`ALIAS_PROPS`,`An alias node must not specify any properties`);break;case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:case`block-scalar`:p=i.composeScalar(e,t,f,o),d&&(p.anchor=d.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:try{p=r.composeCollection(s,e,t,a,o),d&&(p.anchor=d.source.substring(1))}catch(e){o(t,`RESOURCE_EXHAUSTION`,e instanceof Error?e.message:String(e))}break;default:o(t,`UNEXPECTED_TOKEN`,t.type===`error`?t.message:`Unsupported token (type: ${t.type})`),m=!1}return p??=composeEmptyNode(e,t.offset,void 0,null,a,o),d&&p.anchor===``&&o(d,`BAD_ALIAS`,`Anchor cannot be an empty string`),c&&e.options.stringKeys&&(!n.isScalar(p)||typeof p.value!=`string`||p.tag&&p.tag!==`tag:yaml.org,2002:str`)&&o(f??t,`NON_STRING_KEY`,`With stringKeys, all keys must be strings`),l&&(p.spaceBefore=!0),u&&(t.type===`scalar`&&t.source===``?p.comment=u:p.commentBefore=u),e.options.keepSourceTokens&&m&&(p.srcToken=t),p}function composeEmptyNode(e,t,n,r,{spaceBefore:a,comment:s,anchor:c,tag:l,end:u},d){let f={type:`scalar`,offset:o.emptyScalarPosition(t,n,r),indent:-1,source:``},p=i.composeScalar(e,f,l,d);return c&&(p.anchor=c.source.substring(1),p.anchor===``&&d(c,`BAD_ALIAS`,`Anchor cannot be an empty string`)),a&&(p.spaceBefore=!0),s&&(p.comment=s,p.range[2]=u),p}function composeAlias({options:e},{offset:n,source:r,end:i},o){let s=new t.Alias(r.substring(1));s.source===``&&o(n,`BAD_ALIAS`,`Alias cannot be an empty string`),s.source.endsWith(`:`)&&o(n+r.length-1,`BAD_ALIAS`,`Alias ending in : is ambiguous`,!0);let c=n+r.length,l=a.resolveEnd(i,c,e.strict,o);return s.range=[n,c,l.offset],l.comment&&(s.comment=l.comment),s}e.composeEmptyNode=composeEmptyNode,e.composeNode=composeNode})),Ze=/* @__PURE__ */ __commonJSMin((e=>{var t=G(),n=Xe(),r=J(),i=q();function composeDoc(e,a,{offset:o,start:s,value:c,end:l},u){let d=Object.assign({_directives:a},e),f=new t.Document(void 0,d),p={atKey:!1,atRoot:!0,directives:f.directives,options:f.options,schema:f.schema},m=i.resolveProps(s,{indicator:`doc-start`,next:c??l?.[0],offset:o,onError:u,parentIndent:0,startOnNewline:!0});m.found&&(f.directives.docStart=!0,c&&(c.type===`block-map`||c.type===`block-seq`)&&!m.hasNewline&&u(m.end,`MISSING_CHAR`,`Block collection cannot start on same line with directives-end marker`)),f.contents=c?n.composeNode(p,c,m,u):n.composeEmptyNode(p,m.end,s,null,m,u);let h=f.contents.range[2],g=r.resolveEnd(l,h,!1,u);return g.comment&&(f.comment=g.comment),f.range=[o,h,g.offset],f}e.composeDoc=composeDoc})),Qe=/* @__PURE__ */ __commonJSMin((e=>{var t=D(`process`),n=de(),r=G(),i=K(),a=O(),o=Ze(),s=J();function getErrorPos(e){if(typeof e==`number`)return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:n}=e;return[t,t+(typeof n==`string`?n.length:1)]}function parsePrelude(e){let t=``,n=!1,r=!1;for(let i=0;i{let a=getErrorPos(e);r?this.warnings.push(new i.YAMLWarning(a,t,n)):this.errors.push(new i.YAMLParseError(a,t,n))},this.directives=new n.Directives({version:e.version||`1.2`}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=parsePrelude(this.prelude);if(n){let i=e.contents;if(t)e.comment=e.comment?`${e.comment}\n${n}`:n;else if(r||e.directives.docStart||!i)e.commentBefore=n;else if(a.isCollection(i)&&!i.flow&&i.items.length>0){let e=i.items[0];a.isPair(e)&&(e=e.key);let t=e.commentBefore;e.commentBefore=t?`${n}\n${t}`:n}else{let e=i.commentBefore;i.commentBefore=e?`${n}\n${e}`:n}}if(t){for(let t=0;t{let i=getErrorPos(e);i[0]+=t,this.onError(i,`BAD_DIRECTIVE`,n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case`document`:{let t=o.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,`MISSING_CHAR`,`Missing directives-end/doc-start indicator line`),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case`byte-order-mark`:case`space`:break;case`comment`:case`newline`:this.prelude.push(e.source);break;case`error`:{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new i.YAMLParseError(getErrorPos(e),`UNEXPECTED_TOKEN`,t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case`doc-end`:{if(!this.doc){this.errors.push(new i.YAMLParseError(getErrorPos(e),`UNEXPECTED_TOKEN`,`Unexpected doc-end without preceding document`));break}this.doc.directives.docEnd=!0;let t=s.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let e=this.doc.comment;this.doc.comment=e?`${e}\n${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new i.YAMLParseError(getErrorPos(e),`UNEXPECTED_TOKEN`,`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let e=Object.assign({_directives:this.directives},this.options),n=new r.Document(void 0,e);this.atDirectives&&this.onError(t,`MISSING_CHAR`,`Missing directives-end indicator line`),n.range=[0,t,t],this.decorate(n,!1),yield n}}}})),et=/* @__PURE__ */ __commonJSMin((e=>{var t=qe(),n=Je(),r=K(),i=I();function resolveAsScalar(e,i=!0,a){if(e){let _onError=(e,t,n)=>{let i=typeof e==`number`?e:Array.isArray(e)?e[0]:e.offset;if(a)a(i,t,n);else throw new r.YAMLParseError([i,i+1],t,n)};switch(e.type){case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return n.resolveFlowScalar(e,i,_onError);case`block-scalar`:return t.resolveBlockScalar({options:{strict:i}},e,_onError)}}return null}function createScalarToken(e,t){let{implicitKey:n=!1,indent:r,inFlow:a=!1,offset:o=-1,type:s=`PLAIN`}=t,c=i.stringifyString({type:s,value:e},{implicitKey:n,indent:r>0?` `.repeat(r):``,inFlow:a,options:{blockQuote:!0,lineWidth:-1}}),l=t.end??[{type:`newline`,offset:-1,indent:r,source:` +`)+(a.substring(1)||` `),n=!0,r=!1;break;case`%`:e[i+1]?.[0]!==`#`&&(i+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:t,afterEmptyLine:r}}e.Composer=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,n,r)=>{let a=getErrorPos(e);r?this.warnings.push(new i.YAMLWarning(a,t,n)):this.errors.push(new i.YAMLParseError(a,t,n))},this.directives=new n.Directives({version:e.version||`1.2`}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=parsePrelude(this.prelude);if(n){let i=e.contents;if(t)e.comment=e.comment?`${e.comment}\n${n}`:n;else if(r||e.directives.docStart||!i)e.commentBefore=n;else if(a.isCollection(i)&&!i.flow&&i.items.length>0){let e=i.items[0];a.isPair(e)&&(e=e.key);let t=e.commentBefore;e.commentBefore=t?`${n}\n${t}`:n}else{let e=i.commentBefore;i.commentBefore=e?`${n}\n${e}`:n}}if(t){for(let t=0;t{let i=getErrorPos(e);i[0]+=t,this.onError(i,`BAD_DIRECTIVE`,n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case`document`:{let t=o.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,`MISSING_CHAR`,`Missing directives-end/doc-start indicator line`),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case`byte-order-mark`:case`space`:break;case`comment`:case`newline`:this.prelude.push(e.source);break;case`error`:{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new i.YAMLParseError(getErrorPos(e),`UNEXPECTED_TOKEN`,t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case`doc-end`:{if(!this.doc){this.errors.push(new i.YAMLParseError(getErrorPos(e),`UNEXPECTED_TOKEN`,`Unexpected doc-end without preceding document`));break}this.doc.directives.docEnd=!0;let t=s.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let e=this.doc.comment;this.doc.comment=e?`${e}\n${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new i.YAMLParseError(getErrorPos(e),`UNEXPECTED_TOKEN`,`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let e=Object.assign({_directives:this.directives},this.options),n=new r.Document(void 0,e);this.atDirectives&&this.onError(t,`MISSING_CHAR`,`Missing directives-end indicator line`),n.range=[0,t,t],this.decorate(n,!1),yield n}}}})),$e=/* @__PURE__ */ __commonJSMin((e=>{var t=Ke(),n=qe(),r=K(),i=I();function resolveAsScalar(e,i=!0,a){if(e){let _onError=(e,t,n)=>{let i=typeof e==`number`?e:Array.isArray(e)?e[0]:e.offset;if(a)a(i,t,n);else throw new r.YAMLParseError([i,i+1],t,n)};switch(e.type){case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return n.resolveFlowScalar(e,i,_onError);case`block-scalar`:return t.resolveBlockScalar({options:{strict:i}},e,_onError)}}return null}function createScalarToken(e,t){let{implicitKey:n=!1,indent:r,inFlow:a=!1,offset:o=-1,type:s=`PLAIN`}=t,c=i.stringifyString({type:s,value:e},{implicitKey:n,indent:r>0?` `.repeat(r):``,inFlow:a,options:{blockQuote:!0,lineWidth:-1}}),l=t.end??[{type:`newline`,offset:-1,indent:r,source:` `}];switch(c[0]){case`|`:case`>`:{let e=c.indexOf(` `),t=c.substring(0,e),n=c.substring(e+1)+` `,i=[{type:`block-scalar-header`,offset:o,indent:r,source:t}];return addEndtoBlockProps(i,l)||i.push({type:`newline`,offset:-1,indent:r,source:` @@ -97,11 +97,11 @@ case` `:n=`a tab character`;break;case`,`:n=`flow indicator character ,`;break;c `),r=t.substring(0,n),i=t.substring(n+1)+` `;if(e.type===`block-scalar`){let t=e.props[0];if(t.type!==`block-scalar-header`)throw Error(`Invalid block scalar header`);t.source=r,e.source=i}else{let{offset:t}=e,n=`indent`in e?e.indent:-1,a=[{type:`block-scalar-header`,offset:t,indent:n,source:r}];addEndtoBlockProps(a,`end`in e?e.end:void 0)||a.push({type:`newline`,offset:-1,indent:n,source:` `});for(let t of Object.keys(e))t!==`type`&&t!==`offset`&&delete e[t];Object.assign(e,{type:`block-scalar`,indent:n,props:a,source:i})}}function addEndtoBlockProps(e,t){if(t)for(let n of t)switch(n.type){case`space`:case`comment`:e.push(n);break;case`newline`:return e.push(n),!0}return!1}function setFlowScalarValue(e,t,n){switch(e.type){case`scalar`:case`double-quoted-scalar`:case`single-quoted-scalar`:e.type=n,e.source=t;break;case`block-scalar`:{let r=e.props.slice(1),i=t.length;e.props[0].type===`block-scalar-header`&&(i-=e.props[0].source.length);for(let e of r)e.offset+=i;delete e.props,Object.assign(e,{type:n,source:t,end:r});break}case`block-map`:case`block-seq`:{let r={type:`newline`,offset:e.offset+t.length,indent:e.indent,source:` -`};delete e.items,Object.assign(e,{type:n,source:t,end:[r]});break}default:{let r=`indent`in e?e.indent:-1,i=`end`in e&&Array.isArray(e.end)?e.end.filter(e=>e.type===`space`||e.type===`comment`||e.type===`newline`):[];for(let t of Object.keys(e))t!==`type`&&t!==`offset`&&delete e[t];Object.assign(e,{type:n,indent:r,source:t,end:i})}}}e.createScalarToken=createScalarToken,e.resolveAsScalar=resolveAsScalar,e.setScalarValue=setScalarValue})),tt=/* @__PURE__ */ __commonJSMin((e=>{let stringify=e=>`type`in e?stringifyToken(e):stringifyItem(e);function stringifyToken(e){switch(e.type){case`block-scalar`:{let t=``;for(let n of e.props)t+=stringifyToken(n);return t+e.source}case`block-map`:case`block-seq`:{let t=``;for(let n of e.items)t+=stringifyItem(n);return t}case`flow-collection`:{let t=e.start.source;for(let n of e.items)t+=stringifyItem(n);for(let n of e.end)t+=n.source;return t}case`document`:{let t=stringifyItem(e);if(e.end)for(let n of e.end)t+=n.source;return t}default:{let t=e.source;if(`end`in e&&e.end)for(let n of e.end)t+=n.source;return t}}}function stringifyItem({start:e,key:t,sep:n,value:r}){let i=``;for(let t of e)i+=t.source;if(t&&(i+=stringifyToken(t)),n)for(let e of n)i+=e.source;return r&&(i+=stringifyToken(r)),i}e.stringify=stringify})),nt=/* @__PURE__ */ __commonJSMin((e=>{let t=Symbol(`break visit`),n=Symbol(`skip children`),r=Symbol(`remove item`);function visit(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),_visit(Object.freeze([]),e,t)}visit.BREAK=t,visit.SKIP=n,visit.REMOVE=r,visit.itemAtPath=(e,t)=>{let n=e;for(let[e,r]of t){let t=n?.[e];if(t&&`items`in t)n=t.items[r];else return}return n},visit.parentCollection=(e,t)=>{let n=visit.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n?.[r];if(i&&`items`in i)return i;throw Error(`Parent collection not found`)};function _visit(e,n,i){let a=i(n,e);if(typeof a==`symbol`)return a;for(let o of[`key`,`value`]){let s=n[o];if(s&&`items`in s){for(let n=0;n{var t=et(),n=tt(),r=nt();let isCollection=e=>!!e&&`items`in e,isScalar=e=>!!e&&(e.type===`scalar`||e.type===`single-quoted-scalar`||e.type===`double-quoted-scalar`||e.type===`block-scalar`); +`};delete e.items,Object.assign(e,{type:n,source:t,end:[r]});break}default:{let r=`indent`in e?e.indent:-1,i=`end`in e&&Array.isArray(e.end)?e.end.filter(e=>e.type===`space`||e.type===`comment`||e.type===`newline`):[];for(let t of Object.keys(e))t!==`type`&&t!==`offset`&&delete e[t];Object.assign(e,{type:n,indent:r,source:t,end:i})}}}e.createScalarToken=createScalarToken,e.resolveAsScalar=resolveAsScalar,e.setScalarValue=setScalarValue})),et=/* @__PURE__ */ __commonJSMin((e=>{let stringify=e=>`type`in e?stringifyToken(e):stringifyItem(e);function stringifyToken(e){switch(e.type){case`block-scalar`:{let t=``;for(let n of e.props)t+=stringifyToken(n);return t+e.source}case`block-map`:case`block-seq`:{let t=``;for(let n of e.items)t+=stringifyItem(n);return t}case`flow-collection`:{let t=e.start.source;for(let n of e.items)t+=stringifyItem(n);for(let n of e.end)t+=n.source;return t}case`document`:{let t=stringifyItem(e);if(e.end)for(let n of e.end)t+=n.source;return t}default:{let t=e.source;if(`end`in e&&e.end)for(let n of e.end)t+=n.source;return t}}}function stringifyItem({start:e,key:t,sep:n,value:r}){let i=``;for(let t of e)i+=t.source;if(t&&(i+=stringifyToken(t)),n)for(let e of n)i+=e.source;return r&&(i+=stringifyToken(r)),i}e.stringify=stringify})),tt=/* @__PURE__ */ __commonJSMin((e=>{let t=Symbol(`break visit`),n=Symbol(`skip children`),r=Symbol(`remove item`);function visit(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),_visit(Object.freeze([]),e,t)}visit.BREAK=t,visit.SKIP=n,visit.REMOVE=r,visit.itemAtPath=(e,t)=>{let n=e;for(let[e,r]of t){let t=n?.[e];if(t&&`items`in t)n=t.items[r];else return}return n},visit.parentCollection=(e,t)=>{let n=visit.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n?.[r];if(i&&`items`in i)return i;throw Error(`Parent collection not found`)};function _visit(e,n,i){let a=i(n,e);if(typeof a==`symbol`)return a;for(let o of[`key`,`value`]){let s=n[o];if(s&&`items`in s){for(let n=0;n{var t=$e(),n=et(),r=tt();let isCollection=e=>!!e&&`items`in e,isScalar=e=>!!e&&(e.type===`scalar`||e.type===`single-quoted-scalar`||e.type===`double-quoted-scalar`||e.type===`block-scalar`); /* istanbul ignore next */ function prettyToken(e){switch(e){case``:return``;case``:return``;case``:return``;case``:return``;default:return JSON.stringify(e)}}function tokenType(e){switch(e){case``:return`byte-order-mark`;case``:return`doc-mode`;case``:return`flow-error-end`;case``:return`scalar`;case`---`:return`doc-start`;case`...`:return`doc-end`;case``:case` `:case`\r -`:return`newline`;case`-`:return`seq-item-ind`;case`?`:return`explicit-key-ind`;case`:`:return`map-value-ind`;case`{`:return`flow-map-start`;case`}`:return`flow-map-end`;case`[`:return`flow-seq-start`;case`]`:return`flow-seq-end`;case`,`:return`comma`}switch(e[0]){case` `:case` `:return`space`;case`#`:return`comment`;case`%`:return`directive-line`;case`*`:return`alias`;case`&`:return`anchor`;case`!`:return`tag`;case`'`:return`single-quoted-scalar`;case`"`:return`double-quoted-scalar`;case`|`:case`>`:return`block-scalar-header`}return null}e.createScalarToken=t.createScalarToken,e.resolveAsScalar=t.resolveAsScalar,e.setScalarValue=t.setScalarValue,e.stringify=n.stringify,e.visit=r.visit,e.BOM=``,e.DOCUMENT=``,e.FLOW_END=``,e.SCALAR=``,e.isCollection=isCollection,e.isScalar=isScalar,e.prettyToken=prettyToken,e.tokenType=tokenType})),it=/* @__PURE__ */ __commonJSMin((e=>{var t=rt();function isEmpty(e){switch(e){case void 0:case` `:case` +`:return`newline`;case`-`:return`seq-item-ind`;case`?`:return`explicit-key-ind`;case`:`:return`map-value-ind`;case`{`:return`flow-map-start`;case`}`:return`flow-map-end`;case`[`:return`flow-seq-start`;case`]`:return`flow-seq-end`;case`,`:return`comma`}switch(e[0]){case` `:case` `:return`space`;case`#`:return`comment`;case`%`:return`directive-line`;case`*`:return`alias`;case`&`:return`anchor`;case`!`:return`tag`;case`'`:return`single-quoted-scalar`;case`"`:return`double-quoted-scalar`;case`|`:case`>`:return`block-scalar-header`}return null}e.createScalarToken=t.createScalarToken,e.resolveAsScalar=t.resolveAsScalar,e.setScalarValue=t.setScalarValue,e.stringify=n.stringify,e.visit=r.visit,e.BOM=``,e.DOCUMENT=``,e.FLOW_END=``,e.SCALAR=``,e.isCollection=isCollection,e.isScalar=isScalar,e.prettyToken=prettyToken,e.tokenType=tokenType})),rt=/* @__PURE__ */ __commonJSMin((e=>{var t=nt();function isEmpty(e){switch(e){case void 0:case` `:case` `:case`\r`:case` `:return!0;default:return!1}}let n=/* @__PURE__ */ new Set(`0123456789ABCDEFabcdef`),r=/* @__PURE__ */ new Set(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()`),i=/* @__PURE__ */ new Set(`,[]{}`),a=/* @__PURE__ */ new Set(` ,[]{} \r `),isNotAnchorChar=e=>!e||a.has(e);e.Lexer=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer=``,this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){if(e){if(typeof e!=`string`)throw TypeError(`source is not a string`);this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let n=this.next??`stream`;for(;n&&(t||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===` `||t===` `;)t=this.buffer[++e];return!t||t===`#`||t===` `||t===`\r`&&this.buffer[e+1]===` @@ -120,7 +120,7 @@ function prettyToken(e){switch(e){case``:return``;case``:return``; `,t=this.buffer[r+1]):n=r),t===`#`||e&&i.has(t))break;if(a===` `){let e=this.continueScalar(r+1);if(e===-1)break;r=Math.max(r,e-2)}}else{if(e&&i.has(a))break;n=r}return!a&&!this.atEnd?this.setNext(`plain-scalar`):(yield t.SCALAR,yield*this.pushToIndex(n+1,!0),e?`flow`:`doc`)}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(t&&(yield``),0)}*pushIndicators(){let e=0;loop:for(;;){switch(this.charAt(0)){case`!`:e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue loop;case`&`:e+=yield*this.pushUntil(isNotAnchorChar),e+=yield*this.pushSpaces(!0);continue loop;case`-`:case`?`:case`:`:{let t=this.flowLevel>0,n=this.charAt(1);if(isEmpty(n)||t&&i.has(n)){t?this.flowKey&&=!1:this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue loop}}}break loop}return e}*pushTag(){if(this.charAt(1)===`<`){let e=this.pos+2,t=this.buffer[e];for(;!isEmpty(t)&&t!==`>`;)t=this.buffer[++e];return yield*this.pushToIndex(t===`>`?e+1:e,!1)}{let e=this.pos+1,t=this.buffer[e];for(;t;)if(r.has(t))t=this.buffer[++e];else if(t===`%`&&n.has(this.buffer[e+1])&&n.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===` `?yield*this.pushCount(1):e===`\r`&&this.charAt(1)===` -`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,n;do n=this.buffer[++t];while(n===` `||e&&n===` `);let r=t-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=t),r}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}}})),at=/* @__PURE__ */ __commonJSMin((e=>{e.LineCounter=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t>1;this.lineStarts[r]{var t=O(`process`),n=rt(),r=it();function includesToken(e,t){for(let n=0;n0&&(yield this.buffer.substr(this.pos,r),this.pos=t),r}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}}})),it=/* @__PURE__ */ __commonJSMin((e=>{e.LineCounter=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t>1;this.lineStarts[r]{var t=D(`process`),n=nt(),r=rt();function includesToken(e,t){for(let n=0;n=0;)switch(e[t].type){case`doc-start`:case`explicit-key-ind`:case`map-value-ind`:case`seq-item-ind`:case`newline`:break loop}for(;e[++t]?.type===`space`;);return e.splice(t,e.length)}function arrayPushArray(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let n=0;n0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type===`doc-end`&&e?.type!==`doc-end`){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:`doc-end`,offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case`document`:return yield*this.document(e);case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return yield*this.scalar(e);case`block-scalar`:return yield*this.blockScalar(e);case`block-map`:return yield*this.blockMap(e);case`block-seq`:return yield*this.blockSequence(e);case`flow-collection`:return yield*this.flowCollection(e);case`doc-end`:return yield*this.documentEnd(e)} /* istanbul ignore next should not happen */ @@ -136,9 +136,9 @@ default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.l /* istanbul ignore else should not happen */ n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let t=this.peek(2);if(t.type===`block-map`&&(this.type===`map-value-ind`&&t.indent===e.indent||this.type===`newline`&&!t.items[t.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type===`map-value-ind`&&t.type!==`flow-collection`){let n=getFirstKeyStartProps(getPrevProps(t));fixFlowSeqItems(e);let r=e.end.splice(1,e.end.length);r.push(this.sourceToken);let i={type:`block-map`,offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let e=this.source.indexOf(` `)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(` -`,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=getFirstKeyStartProps(getPrevProps(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=getFirstKeyStartProps(getPrevProps(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}}})),st=/* @__PURE__ */ __commonJSMin((e=>{var t=$e(),n=G(),r=K(),i=ve(),a=k(),o=at(),s=ot();function parseOptions(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new o.LineCounter||null,prettyErrors:t}}function parseAllDocuments(e,n={}){let{lineCounter:i,prettyErrors:a}=parseOptions(n),o=new s.Parser(i?.addNewLine),c=new t.Composer(n),l=Array.from(c.compose(o.parse(e)));if(a&&i)for(let t of l)t.errors.forEach(r.prettifyError(e,i)),t.warnings.forEach(r.prettifyError(e,i));return l.length>0?l:Object.assign([],{empty:!0},c.streamInfo())}function parseDocument(e,n={}){let{lineCounter:i,prettyErrors:a}=parseOptions(n),o=new s.Parser(i?.addNewLine),c=new t.Composer(n),l=null;for(let t of c.compose(o.parse(e),!0,e.length))if(!l)l=t;else if(l.options.logLevel!==`silent`){l.errors.push(new r.YAMLParseError(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return a&&i&&(l.errors.forEach(r.prettifyError(e,i)),l.warnings.forEach(r.prettifyError(e,i))),l}function parse(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let a=parseDocument(e,n);if(!a)return null;if(a.warnings.forEach(e=>i.warn(a.options.logLevel,e)),a.errors.length>0){if(a.options.logLevel!==`silent`)throw a.errors[0];a.errors=[]}return a.toJS(Object.assign({reviver:r},n))}function stringify(e,t,r){let i=null;if(typeof t==`function`||Array.isArray(t)?i=t:r===void 0&&t&&(r=t),typeof r==`string`&&(r=r.length),typeof r==`number`){let e=Math.round(r);r=e<1?void 0:e>8?{indent:8}:{indent:e}}if(e===void 0){let{keepUndefined:e}=r??t??{};if(!e)return}return a.isDocument(e)&&!i?e.toString(r):new n.Document(e,i,r).toString(r)}e.parse=parse,e.parseAllDocuments=parseAllDocuments,e.parseDocument=parseDocument,e.stringify=stringify})),Y=(/* @__PURE__ */ __commonJSMin((e=>{var t=$e(),n=G(),r=Re(),i=K(),a=M(),o=k(),s=R(),c=N(),l=z(),u=V();rt();var d=it(),f=at(),p=ot(),m=st(),h=A();e.Composer=t.Composer,e.Document=n.Document,e.Schema=r.Schema,e.YAMLError=i.YAMLError,e.YAMLParseError=i.YAMLParseError,e.YAMLWarning=i.YAMLWarning,e.Alias=a.Alias,e.isAlias=o.isAlias,e.isCollection=o.isCollection,e.isDocument=o.isDocument,e.isMap=o.isMap,e.isNode=o.isNode,e.isPair=o.isPair,e.isScalar=o.isScalar,e.isSeq=o.isSeq,e.Pair=s.Pair,e.Scalar=c.Scalar,e.YAMLMap=l.YAMLMap,e.YAMLSeq=u.YAMLSeq,e.Lexer=d.Lexer,e.LineCounter=f.LineCounter,e.Parser=p.Parser,e.parse=m.parse,e.parseAllDocuments=m.parseAllDocuments,e.parseDocument=m.parseDocument,e.stringify=m.stringify,e.visit=h.visit,e.visitAsync=h.visitAsync})))();const X=`Vite+`,Z=`vite-plus`;function resolvePath$1(e,t){return v.isAbsolute(e)?e:v.join(t,e)}function isWithin(e,t){let n=v.relative(t,e);return!v.isAbsolute(n)&&n!==`..`&&!n.startsWith(`..${v.sep}`)}function resolveProjectDirectory(e){let{workingDirectory:t,workspaceRoot:n}=e,r=v.isAbsolute(t)?t:v.join(n,t);try{if(!h(r).isDirectory())throw Error(`working-directory is not a directory: ${t} (resolved to ${r})`)}catch(e){throw e instanceof Error&&`code`in e&&e.code===`ENOENT`?Error(`working-directory not found: ${t} (resolved to ${r})`):e}return r}function isWindows(e=process.platform){return e===`win32`}function run(e,t,n={}){let r=D(e,t,{stdio:`inherit`,...n});if(r.error)throw r.error;if(r.status!==0)throw Error(`${e} ${t.join(` `)} exited with code ${r.status??1}`)}function runWithOutput(e,t,n={}){return new Promise((r,i)=>{let a=E(e,t,{...n,stdio:[`ignore`,`pipe`,`pipe`]}),o=``,s=``;a.stdout.on(`data`,e=>{process.stdout.write(e),o=(o+e.toString()).slice(-4e3)}),a.stderr.on(`data`,e=>{process.stderr.write(e),s=(s+e.toString()).slice(-4e3)}),a.on(`error`,i),a.on(`close`,e=>r({exitCode:e??1,stdout:o,stderr:s}))})}function commandPath(e,r=process.env){if(!e||e===`.`||e===`..`||/[\\/:]/.test(e))return;let i=isWindows(),a=i?Object.keys(r).sort().find(e=>e.toUpperCase()===`PATH`):`PATH`,o=a&&r[a]||``,s=i&&!e.toLowerCase().endsWith(`.exe`)?`${e}.exe`:e,c=p(process.cwd());for(let e of o.split(v.delimiter)){let r=i?e.replace(/^"(.*)"$/,`$1`):e;if(v.isAbsolute(r))try{let e=p(r);if(i?e.toLowerCase()===c.toLowerCase():e===c)continue;let a=v.join(r,s);if(!h(a).isFile())continue;return t(a,i?n.F_OK:n.X_OK),a}catch{}}}function getCommandOutput(e,t,n){let r=D(e,t,{cwd:n?.cwd,encoding:`utf8`,stdio:[`ignore`,`pipe`,`pipe`]});if(r.status===0)return r.stdout.trim()}const ct=[{filename:`pnpm-lock.yaml`,type:`pnpm`},{filename:`bun.lockb`,type:`bun`},{filename:`bun.lock`,type:`bun`},{filename:`package-lock.json`,type:`npm`},{filename:`npm-shrinkwrap.json`,type:`npm`},{filename:`yarn.lock`,type:`yarn`}];function resolvePath(e,t){return x(e)?e:S(t,e)}function inferLockFileType(e,t){return t.includes(`pnpm`)?{type:`pnpm`,path:e,filename:t}:t.includes(`yarn`)?{type:`yarn`,path:e,filename:t}:t.startsWith(`bun.`)?{type:`bun`,path:e,filename:t}:{type:`npm`,path:e,filename:t}}function detectLockFile(e,t){if(e){let n=resolvePath(e,t);if(o(n)){let e=y(n),t=ct.find(t=>t.filename===e);return t?{type:t.type,path:n,filename:e}:inferLockFileType(n,e)}return}let n=d(t);for(let e of ct)if(n.includes(e.filename)){let n=S(t,e.filename);return{type:e.type,path:n,filename:e.filename}}}function prepareCacheMetadata(e){let{projectDir:t,cacheDependencyPath:n,logWarning:r}=e,i=detectLockFile(n||void 0,t);if(!i)return r?.(`setup-vp: cache is enabled but no supported lock file was found; skipping cache.`),{ready:!1};let a=getCommandOutput(`vp`,[`pm`,`cache`,`dir`],{cwd:v.dirname(i.path)});return a?{ready:!0,cachePath:a,lockFile:i.path,lockType:i.type}:(r?.(`setup-vp: could not resolve package-manager cache directory for ${i.filename}; skipping cache.`),{ready:!1})}function createLockfileResolver(e){let{getWorkspaceDir:t,info:n,debug:r}=e,i=/^\d+\.\d+\.\d+/;function tryResolveVitePlusVersionFromLockfile(e,t){let i=detectLockfileForProject(e,t);if(!i)return;let a=i.filename.endsWith(`.lockb`)?textBunLockBeside(i):i;if(!a){r(`Cannot read ${i.filename} (binary) to resolve the ${X} version; using "latest". Use the text bun.lock, or set the \`version\` input.`);return}let o=parseVitePlusVersionFromLockfile(a,workspaceSubPath(b(a.path),e));if(o)return n(`Resolved ${X} version '${o}' from ${a.filename}`),o;r(`No ${X} version found in ${a.path}`)}function detectLockfileForProject(e,n){if(n)return detectLockFile(n,e);let r=t(),i=e;for(;;){let e=detectLockFile(void 0,i);if(e)return e;let t=b(i);if(i===r||t===i||!isWithin(t,r))break;i=t}}function textBunLockBeside(e){let t=S(b(e.path),`bun.lock`);return o(t)?{type:`bun`,path:t,filename:`bun.lock`}:void 0}function workspaceSubPath(e,t){if(!isWithin(t,e))return``;let n=C(e,t);return n?n.split(w).join(`/`):``}function parseVitePlusVersionFromLockfile(e,t=``){if(e.filename.endsWith(`.lockb`))return;let n;try{n=u(e.path,`utf-8`)}catch{return}let r;switch(e.type){case`npm`:r=fromNpmLock(n,t);break;case`pnpm`:r=fromPnpmLock(n,t);break;case`yarn`:r=fromYarnLock(n);break;case`bun`:r=fromBunTextLock(n);break;default:return}return r&&i.test(r)?r:void 0}function fromNpmLock(e,t){let n;try{n=JSON.parse(e)}catch{return}let r=n.packages;if(t){let e=r?.[`${t}/node_modules/${Z}`]?.version;if(typeof e==`string`)return e;if(!npmPackageDeclaresVitePlus(r?.[t]))return}let i=r?.[`node_modules/${Z}`]?.version;if(typeof i==`string`)return i;let a=n.dependencies?.[Z]?.version;return typeof a==`string`?a:void 0}function npmPackageDeclaresVitePlus(e){if(!e)return!1;for(let t of[`dependencies`,`devDependencies`]){let n=e[t];if(n&&typeof n==`object`&&`vite-plus`in n)return!0}return!1}function fromPnpmLock(e,t){let n;try{n=(0,Y.parse)(e)}catch{return}if(!n||typeof n!=`object`)return;let r=n,i=r.importers;if(i&&typeof i==`object`){let e=t||`.`;return e in i?pnpmImporterVersion(i[e]):void 0}return pnpmImporterVersion(r)||e.match(/^\s*\/?vite-plus@(\d+\.\d+\.\d+[^\s():'"]*)/m)?.[1]}function pnpmImporterVersion(e){if(!e||typeof e!=`object`)return;let t=e;for(let e of[`dependencies`,`devDependencies`,`optionalDependencies`]){let n=t[e];if(n&&typeof n==`object`){let e=n[Z],t=typeof e==`string`?e:e?.version;if(typeof t==`string`){let e=t.replace(/\(.*$/,``).trim();if(i.test(e))return e}}}}function fromYarnLock(e){let t=/* @__PURE__ */ new Set,n=e.split(/\r?\n/);for(let e=0;ee.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}}})),ot=/* @__PURE__ */ __commonJSMin((e=>{var t=Qe(),n=G(),r=K(),i=_e(),a=O(),o=it(),s=at();function parseOptions(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new o.LineCounter||null,prettyErrors:t}}function parseAllDocuments(e,n={}){let{lineCounter:i,prettyErrors:a}=parseOptions(n),o=new s.Parser(i?.addNewLine),c=new t.Composer(n),l=Array.from(c.compose(o.parse(e)));if(a&&i)for(let t of l)t.errors.forEach(r.prettifyError(e,i)),t.warnings.forEach(r.prettifyError(e,i));return l.length>0?l:Object.assign([],{empty:!0},c.streamInfo())}function parseDocument(e,n={}){let{lineCounter:i,prettyErrors:a}=parseOptions(n),o=new s.Parser(i?.addNewLine),c=new t.Composer(n),l=null;for(let t of c.compose(o.parse(e),!0,e.length))if(!l)l=t;else if(l.options.logLevel!==`silent`){l.errors.push(new r.YAMLParseError(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return a&&i&&(l.errors.forEach(r.prettifyError(e,i)),l.warnings.forEach(r.prettifyError(e,i))),l}function parse(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let a=parseDocument(e,n);if(!a)return null;if(a.warnings.forEach(e=>i.warn(a.options.logLevel,e)),a.errors.length>0){if(a.options.logLevel!==`silent`)throw a.errors[0];a.errors=[]}return a.toJS(Object.assign({reviver:r},n))}function stringify(e,t,r){let i=null;if(typeof t==`function`||Array.isArray(t)?i=t:r===void 0&&t&&(r=t),typeof r==`string`&&(r=r.length),typeof r==`number`){let e=Math.round(r);r=e<1?void 0:e>8?{indent:8}:{indent:e}}if(e===void 0){let{keepUndefined:e}=r??t??{};if(!e)return}return a.isDocument(e)&&!i?e.toString(r):new n.Document(e,i,r).toString(r)}e.parse=parse,e.parseAllDocuments=parseAllDocuments,e.parseDocument=parseDocument,e.stringify=stringify})),Y=(/* @__PURE__ */ __commonJSMin((e=>{var t=Qe(),n=G(),r=Le(),i=K(),a=M(),o=O(),s=R(),c=N(),l=z(),u=V();nt();var d=rt(),f=it(),p=at(),m=ot(),h=k();e.Composer=t.Composer,e.Document=n.Document,e.Schema=r.Schema,e.YAMLError=i.YAMLError,e.YAMLParseError=i.YAMLParseError,e.YAMLWarning=i.YAMLWarning,e.Alias=a.Alias,e.isAlias=o.isAlias,e.isCollection=o.isCollection,e.isDocument=o.isDocument,e.isMap=o.isMap,e.isNode=o.isNode,e.isPair=o.isPair,e.isScalar=o.isScalar,e.isSeq=o.isSeq,e.Pair=s.Pair,e.Scalar=c.Scalar,e.YAMLMap=l.YAMLMap,e.YAMLSeq=u.YAMLSeq,e.Lexer=d.Lexer,e.LineCounter=f.LineCounter,e.Parser=p.Parser,e.parse=m.parse,e.parseAllDocuments=m.parseAllDocuments,e.parseDocument=m.parseDocument,e.stringify=m.stringify,e.visit=h.visit,e.visitAsync=h.visitAsync})))();const X=`Vite+`,Z=`vite-plus`;function resolvePath$1(e,t){return _.isAbsolute(e)?e:_.join(t,e)}function isWithin(e,t){let n=_.relative(t,e);return!_.isAbsolute(n)&&n!==`..`&&!n.startsWith(`..${_.sep}`)}function resolveProjectDirectory(e){let{workingDirectory:t,workspaceRoot:n}=e,r=_.isAbsolute(t)?t:_.join(n,t);try{if(!m(r).isDirectory())throw Error(`working-directory is not a directory: ${t} (resolved to ${r})`)}catch(e){throw e instanceof Error&&`code`in e&&e.code===`ENOENT`?Error(`working-directory not found: ${t} (resolved to ${r})`):e}return r}function isWindows(e=process.platform){return e===`win32`}function run(e,t,n={}){let r=E(e,t,{stdio:`inherit`,...n});if(r.error)throw r.error;if(r.status!==0)throw Error(`${e} ${t.join(` `)} exited with code ${r.status??1}`)}function runWithOutput(e,t,n={}){return new Promise((r,i)=>{let a=T(e,t,{...n,stdio:[`ignore`,`pipe`,`pipe`]}),o=``,s=``;a.stdout.on(`data`,e=>{process.stdout.write(e),o=(o+e.toString()).slice(-4e3)}),a.stderr.on(`data`,e=>{process.stderr.write(e),s=(s+e.toString()).slice(-4e3)}),a.on(`error`,i),a.on(`close`,e=>r({exitCode:e??1,stdout:o,stderr:s}))})}function commandPath(e,r=process.env){if(!e||e===`.`||e===`..`||/[\\/:]/.test(e))return;let i=isWindows(),a=i?Object.keys(r).sort().find(e=>e.toUpperCase()===`PATH`):`PATH`,o=a&&r[a]||``,s=i&&!e.toLowerCase().endsWith(`.exe`)?`${e}.exe`:e,c=m(process.cwd(),{bigint:!0});for(let e of o.split(_.delimiter)){let r=i?e.replace(/^"(.*)"$/,`$1`):e;if(_.isAbsolute(r))try{let e=m(r,{bigint:!0});if(e.dev===c.dev&&e.ino===c.ino)continue;let a=_.join(r,s);if(!m(a).isFile())continue;return t(a,i?n.F_OK:n.X_OK),a}catch{}}}function getCommandOutput(e,t,n){let r=E(e,t,{cwd:n?.cwd,encoding:`utf8`,stdio:[`ignore`,`pipe`,`pipe`]});if(r.status===0)return r.stdout.trim()}const st=[{filename:`pnpm-lock.yaml`,type:`pnpm`},{filename:`bun.lockb`,type:`bun`},{filename:`bun.lock`,type:`bun`},{filename:`package-lock.json`,type:`npm`},{filename:`npm-shrinkwrap.json`,type:`npm`},{filename:`yarn.lock`,type:`yarn`}];function resolvePath(e,t){return b(e)?e:x(t,e)}function inferLockFileType(e,t){return t.includes(`pnpm`)?{type:`pnpm`,path:e,filename:t}:t.includes(`yarn`)?{type:`yarn`,path:e,filename:t}:t.startsWith(`bun.`)?{type:`bun`,path:e,filename:t}:{type:`npm`,path:e,filename:t}}function detectLockFile(e,t){if(e){let n=resolvePath(e,t);if(o(n)){let e=v(n),t=st.find(t=>t.filename===e);return t?{type:t.type,path:n,filename:e}:inferLockFileType(n,e)}return}let n=d(t);for(let e of st)if(n.includes(e.filename)){let n=x(t,e.filename);return{type:e.type,path:n,filename:e.filename}}}function prepareCacheMetadata(e){let{projectDir:t,cacheDependencyPath:n,logWarning:r}=e,i=detectLockFile(n||void 0,t);if(!i)return r?.(`setup-vp: cache is enabled but no supported lock file was found; skipping cache.`),{ready:!1};let a=getCommandOutput(`vp`,[`pm`,`cache`,`dir`],{cwd:_.dirname(i.path)});return a?{ready:!0,cachePath:a,lockFile:i.path,lockType:i.type}:(r?.(`setup-vp: could not resolve package-manager cache directory for ${i.filename}; skipping cache.`),{ready:!1})}function createLockfileResolver(e){let{getWorkspaceDir:t,info:n,debug:r}=e,i=/^\d+\.\d+\.\d+/;function tryResolveVitePlusVersionFromLockfile(e,t){let i=detectLockfileForProject(e,t);if(!i)return;let a=i.filename.endsWith(`.lockb`)?textBunLockBeside(i):i;if(!a){r(`Cannot read ${i.filename} (binary) to resolve the ${X} version; using "latest". Use the text bun.lock, or set the \`version\` input.`);return}let o=parseVitePlusVersionFromLockfile(a,workspaceSubPath(y(a.path),e));if(o)return n(`Resolved ${X} version '${o}' from ${a.filename}`),o;r(`No ${X} version found in ${a.path}`)}function detectLockfileForProject(e,n){if(n)return detectLockFile(n,e);let r=t(),i=e;for(;;){let e=detectLockFile(void 0,i);if(e)return e;let t=y(i);if(i===r||t===i||!isWithin(t,r))break;i=t}}function textBunLockBeside(e){let t=x(y(e.path),`bun.lock`);return o(t)?{type:`bun`,path:t,filename:`bun.lock`}:void 0}function workspaceSubPath(e,t){if(!isWithin(t,e))return``;let n=S(e,t);return n?n.split(C).join(`/`):``}function parseVitePlusVersionFromLockfile(e,t=``){if(e.filename.endsWith(`.lockb`))return;let n;try{n=u(e.path,`utf-8`)}catch{return}let r;switch(e.type){case`npm`:r=fromNpmLock(n,t);break;case`pnpm`:r=fromPnpmLock(n,t);break;case`yarn`:r=fromYarnLock(n);break;case`bun`:r=fromBunTextLock(n);break;default:return}return r&&i.test(r)?r:void 0}function fromNpmLock(e,t){let n;try{n=JSON.parse(e)}catch{return}let r=n.packages;if(t){let e=r?.[`${t}/node_modules/${Z}`]?.version;if(typeof e==`string`)return e;if(!npmPackageDeclaresVitePlus(r?.[t]))return}let i=r?.[`node_modules/${Z}`]?.version;if(typeof i==`string`)return i;let a=n.dependencies?.[Z]?.version;return typeof a==`string`?a:void 0}function npmPackageDeclaresVitePlus(e){if(!e)return!1;for(let t of[`dependencies`,`devDependencies`]){let n=e[t];if(n&&typeof n==`object`&&`vite-plus`in n)return!0}return!1}function fromPnpmLock(e,t){let n;try{n=(0,Y.parse)(e)}catch{return}if(!n||typeof n!=`object`)return;let r=n,i=r.importers;if(i&&typeof i==`object`){let e=t||`.`;return e in i?pnpmImporterVersion(i[e]):void 0}return pnpmImporterVersion(r)||e.match(/^\s*\/?vite-plus@(\d+\.\d+\.\d+[^\s():'"]*)/m)?.[1]}function pnpmImporterVersion(e){if(!e||typeof e!=`object`)return;let t=e;for(let e of[`dependencies`,`devDependencies`,`optionalDependencies`]){let n=t[e];if(n&&typeof n==`object`){let e=n[Z],t=typeof e==`string`?e:e?.version;if(typeof t==`string`){let e=t.replace(/\(.*$/,``).trim();if(i.test(e))return e}}}}function fromYarnLock(e){let t=/* @__PURE__ */ new Set,n=e.split(/\r?\n/);for(let e=0;ee,info:console.info,debug:()=>{},warning:console.warn}}const lt=`https://raw.githubusercontent.com/voidzero-dev/vite-plus`,ut=`packages/cli`,dt=/^0\.0\.0-commit\.([0-9a-f]{40})$/i,ft=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;function pkgPrNewCommitSha(e){return e.match(dt)?.[1]}function getInstallScriptUrls(e,t=process.platform){let n=isWindows(t)?`install.ps1`:`install.sh`,r=installScriptRef(e);return{pinned:r?[`${lt}/${r}/${ut}/${n}`,`https://cdn.jsdelivr.net/gh/voidzero-dev/vite-plus@${r}/${ut}/${n}`]:[],latest:[`https://viteplus.dev/${n}`,`${lt}/main/${ut}/${n}`]}}function installScriptRef(e){let t=pkgPrNewCommitSha(e);if(t)return t.toLowerCase();if(ft.test(e))return`v${e}`}function parseInstalledVpVersion(e){return(e.match(/^\s*vp\s+v?(\d[^\s]*)/im)??e.match(/Global:\s*v?(\d[^\s]*)/i))?.[1]??`unknown`}const Q=`SETUP_VP_DIRS_FILE`;function getVitePlusBinDirs(e){let t=S(e.data,`fallback-bin`);return h(t,{throwIfNoEntry:!1})?.isDirectory()?{bin:e.bin,fallbackBin:t}:{bin:e.bin}}function appendFallbackBinToPath(e,t,n=process.platform){let r=isWindows(n)?`;`:`:`;return[...e?e.split(r).filter(e=>e!==t):[],t].join(r)}const pt=/^v?(\d+)\.(\d+)\.\d+(?:-[0-9A-Za-z.-]+)?$/;function supportsVitePlusDirs(e){if(pkgPrNewCommitSha(e))return!0;let t=e.match(pt);if(!t)return!0;let n=Number(t[1]),r=Number(t[2]);return n>0||r>=3}function createVitePlusDirsFile(){return S(te(),`setup-vp-dirs-${ie()}.txt`)}function removeVitePlusDirsFile(e){m(e,{force:!0})}function readVitePlusProbe(e){try{return u(e,`utf8`)}catch(e){if(e.code===`ENOENT`)return;throw e}}function resolveVitePlusBinDirs(e,t,n){if(!t){if(!supportsVitePlusDirs(e))return{bin:n};throw Error(`Vite+ was installed successfully, but setup-vp could not resolve its VpDirs.`)}let r=readVitePlusProbe(t),i=r===void 0?void 0:parseVitePlusDirs(r);if(i)return getVitePlusBinDirs(i);if(!(pkgPrNewCommitSha(e)!==void 0||pt.test(e))&&r!==void 0){let e=parseInstalledVpVersion(r);if(e!==`unknown`&&!supportsVitePlusDirs(e))return{bin:n}}throw Error(`Vite+ was installed successfully, but setup-vp could not resolve its VpDirs.`)}function parseVitePlusDirs(e){let t=/* @__PURE__ */ new Map;for(let n of e.split(/\r?\n/)){let e=n.indexOf(` `);if(e<1)continue;let r=n.slice(0,e).replace(/^\uFEFF/,``),i=n.slice(e+1).trim();i&&t.set(r,i)}let n=t.get(`data`),r=t.get(`bin`),i=t.get(`cache`),a=t.get(`config`),o=t.get(`state`);if(n&&r&&i&&a&&o)return{data:n,bin:r,cache:i,config:a,state:o}}function getInstallScriptCommand(e,t=process.platform,n=!0){if(isWindows(t))return n?{command:`pwsh`,args:[`-Command`,` +`)){let e=t.trim();if(!e||e.startsWith(`#`))continue;let[n,...r]=e.split(/\s+/);if(n===`nodejs`||n===`node`){for(let e of r)if(isAsdfInstallableVersion(e))return e}}}function isAsdfInstallableVersion(e){return!!e&&e!==`system`&&!e.startsWith(`ref:`)&&!e.startsWith(`path:`)}function parsePackageJson(e){let t;try{t=JSON.parse(e)}catch{throw Error(`Failed to parse package.json: invalid JSON`)}let n=t.devEngines;if(n?.runtime){let e=findNodeRuntime(n.runtime);if(e)return e}let r=t.engines;if(r?.node&&typeof r.node==`string`)return r.node}function findNodeRuntime(e){let t=Array.isArray(e)?e:[e];for(let e of t)if(e?.name===`node`&&typeof e.version==`string`)return e.version}return{resolveNodeVersionFile}}function resolutionContext(e){return{getWorkspaceDir:()=>e,info:console.info,debug:()=>{},warning:console.warn}}const ct=`https://raw.githubusercontent.com/voidzero-dev/vite-plus`,lt=`packages/cli`,ut=/^0\.0\.0-commit\.([0-9a-f]{40})$/i,dt=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;function pkgPrNewCommitSha(e){return e.match(ut)?.[1]}function getInstallScriptUrls(e,t=process.platform){let n=isWindows(t)?`install.ps1`:`install.sh`,r=installScriptRef(e);return{pinned:r?[`${ct}/${r}/${lt}/${n}`,`https://cdn.jsdelivr.net/gh/voidzero-dev/vite-plus@${r}/${lt}/${n}`]:[],latest:[`https://viteplus.dev/${n}`,`${ct}/main/${lt}/${n}`]}}function installScriptRef(e){let t=pkgPrNewCommitSha(e);if(t)return t.toLowerCase();if(dt.test(e))return`v${e}`}function parseInstalledVpVersion(e){return(e.match(/^\s*vp\s+v?(\d[^\s]*)/im)??e.match(/Global:\s*v?(\d[^\s]*)/i))?.[1]??`unknown`}const Q=`SETUP_VP_DIRS_FILE`;function getVitePlusBinDirs(e){let t=x(e.data,`fallback-bin`);return m(t,{throwIfNoEntry:!1})?.isDirectory()?{bin:e.bin,fallbackBin:t}:{bin:e.bin}}function appendFallbackBinToPath(e,t,n=process.platform){let r=isWindows(n)?`;`:`:`;return[...e?e.split(r).filter(e=>e!==t):[],t].join(r)}const ft=/^v?(\d+)\.(\d+)\.\d+(?:-[0-9A-Za-z.-]+)?$/;function supportsVitePlusDirs(e){if(pkgPrNewCommitSha(e))return!0;let t=e.match(ft);if(!t)return!0;let n=Number(t[1]),r=Number(t[2]);return n>0||r>=3}function createVitePlusDirsFile(){return x(te(),`setup-vp-dirs-${ie()}.txt`)}function removeVitePlusDirsFile(e){p(e,{force:!0})}function readVitePlusProbe(e){try{return u(e,`utf8`)}catch(e){if(e.code===`ENOENT`)return;throw e}}function resolveVitePlusBinDirs(e,t,n){if(!t){if(!supportsVitePlusDirs(e))return{bin:n};throw Error(`Vite+ was installed successfully, but setup-vp could not resolve its VpDirs.`)}let r=readVitePlusProbe(t),i=r===void 0?void 0:parseVitePlusDirs(r);if(i)return getVitePlusBinDirs(i);if(!(pkgPrNewCommitSha(e)!==void 0||ft.test(e))&&r!==void 0){let e=parseInstalledVpVersion(r);if(e!==`unknown`&&!supportsVitePlusDirs(e))return{bin:n}}throw Error(`Vite+ was installed successfully, but setup-vp could not resolve its VpDirs.`)}function parseVitePlusDirs(e){let t=/* @__PURE__ */ new Map;for(let n of e.split(/\r?\n/)){let e=n.indexOf(` `);if(e<1)continue;let r=n.slice(0,e).replace(/^\uFEFF/,``),i=n.slice(e+1).trim();i&&t.set(r,i)}let n=t.get(`data`),r=t.get(`bin`),i=t.get(`cache`),a=t.get(`config`),o=t.get(`state`);if(n&&r&&i&&a&&o)return{data:n,bin:r,cache:i,config:a,state:o}}function getInstallScriptCommand(e,t=process.platform,n=!0){if(isWindows(t))return n?{command:`pwsh`,args:[`-Command`,` $dirsFile = $env:${Q} Set-Content -LiteralPath $dirsFile -Value '' -NoNewline -Encoding UTF8 . ([scriptblock]::Create((irm -TimeoutSec 15 ${e}))) @@ -184,8 +184,8 @@ fi set +u set -o pipefail ${r} | bash -`.trim()]}}const mt=2e3;function getVitePlusHome(e=process.platform,t=process.env){let n=isWindows(e)?t.USERPROFILE||ee():t.HOME||ee();return S(n,`.vite-plus`)}function runInstallCommand(e,t,n=process.platform){let{command:r,args:i}=getInstallScriptCommand(e,n,t.VP_VPDIRS_AWARE===`1`),a={env:{...process.env,...t},stdio:`inherit`},o=D(r,i,a);if(isWindows(n)&&o.error?.code===`ENOENT`&&(o=D(`powershell.exe`,i,a)),o.error)throw o.error;return o.status??1}async function installVitePlus(e,t={}){let n=t.platform??process.platform,r=t.env??process.env,i=t.prependPath,a=t.sleep??ne,o=t.runInstall??runInstallCommand,s=t.logWarningFn??console.warn,c={...Object.fromEntries(Object.entries(r).filter(e=>e[1]!==void 0)),VP_VERSION:e,VITE_PLUS_VERSION:e},l=supportsVitePlusDirs(e)?createVitePlusDirsFile():void 0;l?(c.VP_VPDIRS_AWARE=`1`,c[Q]=l):(delete c.VP_VPDIRS_AWARE,delete c[Q]);let u=pkgPrNewCommitSha(e);u&&(c.VP_PR_VERSION=u);let{pinned:d,latest:f}=getInstallScriptUrls(e,n),p=d.length+f.length,m=2*p,h=``,g=0;async function tryUrls(e){for(let t=0;t<2;t+=1)for(let t of e){g+=1;try{let e=o(t,c,n);if(e===0)return!0;h=`exit code ${e}`}catch(e){h=e instanceof Error?e.message:String(e)}g0){if(await tryUrls(d)){ensureBinInPath();return}s(`setup-vp: could not fetch the install script pinned to Vite+ ${e}. Falling back to the latest install script. The latest script may not be compatible with ${e}.`)}if(await tryUrls(f)){ensureBinInPath();return}throw Error(`Failed to install Vite+ after ${m} attempts across ${p} URL(s): ${h}`)}finally{l&&removeVitePlusDirsFile(l)}}function copyCacheDirectory(e,t,n){e=v.resolve(e),t=v.resolve(t),i(e,t,{recursive:!0,force:n,errorOnExist:!1,filter:(r,i)=>{let a=s(i,{throwIfNoEntry:!1}),o=s(r);if(a&&!n)return o.isDirectory()&&a.isDirectory();if(a&&(a.isSymbolicLink()||o.isSymbolicLink())&&m(i,{recursive:!0,force:!0}),o.isSymbolicLink()){let n=v.resolve(v.dirname(r),f(r)),a=n;if(isWithin(n,e)){let r=v.join(t,v.relative(e,n));a=v.relative(v.dirname(i),r)||`.`}return c(v.dirname(i),{recursive:!0}),g(a,i,h(n,{throwIfNoEntry:!1})?.isDirectory()?`dir`:`file`),!1}return!0}})}function restoreCacheSnapshot(e,t,n=console.warn,r=!0){if(!e.ready||!e.cachePath||!e.lockFile||!e.lockType)return{hit:!1,save:()=>{}};let i=e.cachePath;if(isWithin(v.resolve(i),v.resolve(t))||isWithin(v.resolve(t),v.resolve(i)))return n(`setup-vp: package-manager cache overlaps the snapshot directory; skipping cache.`),{hit:!1,save:()=>{}};let a=v.join(t,process.platform,process.arch,e.lockType),s=v.join(a,`packages`),l=v.join(a,`lock-hash`),d=e.lockFile;function hashLockFile(){return re(`sha256`).update(u(d)).digest(`hex`)}let f;try{f=hashLockFile()}catch(e){return n(`setup-vp: could not read cache lock file: ${String(e)}`),{hit:!1,save:()=>{}}}let p=!1;try{r&&o(s)&&(c(i,{recursive:!0}),copyCacheDirectory(s,i,!1),p=u(l,`utf8`)===f)}catch(e){n(`setup-vp: could not restore package-manager cache: ${String(e)}`)}return{hit:p,save:()=>{try{if(!o(i))return;let e=hashLockFile();c(a,{recursive:!0}),copyCacheDirectory(i,s,!0),_(l,e,`utf8`)}catch(e){n(`setup-vp: could not save package-manager cache: ${String(e)}`)}}}}const ht=/* @__PURE__ */ new Set([`true`,`True`,`TRUE`]),gt=/* @__PURE__ */ new Set([`false`,`False`,`FALSE`]);function parseNodeManager(e){if(e){if(ht.has(e))return!0;if(gt.has(e))return!1;throw Error(`Invalid node-manager input: "${e}". Expected "true", "false", or unset.`)}}function supportsScopedEnv(e){let t=parseInstalledVpVersion(e);if(t.startsWith(`0.0.0-commit.`))return!0;let n=t.match(/^(\d+)\.(\d+)\.(\d+)/);if(!n)throw Error(`Could not determine the installed Vite+ version for env configuration.`);let[,r,i,a]=n.map(Number);return r>0||i>3||i===3&&a>=1}function nodeManagerOffArgs(e){return parseInstalledVpVersion(e).startsWith(`0.0.0-commit.`)&&console.info("setup-vp: node-manager: false requires a preview build that supports `vp env off node`. If this command is unsupported, use a newer preview or a stable release. setup-vp will not fall back to disabling package-manager management."),supportsScopedEnv(e)?[`env`,`off`,`node`]:[`env`,`off`]}const _t=[`npm`,`pnpm`,`yarn`,`bun`];function parsePackageManager(e){if(!e?.trim())return;let t;try{t=(0,Y.parse)(e)}catch(e){throw Error(`Invalid package-manager input: ${String(e)}`)}if(t!==``){if(typeof t==`boolean`)return t;if(t&&typeof t==`object`&&!Array.isArray(t)){for(let[e,n]of Object.entries(t))if(!_t.includes(e)||typeof n!=`boolean`)throw Error(`Invalid package-manager input: ${e} must be npm, pnpm, yarn, or bun with a boolean value.`);return t}throw Error(`Invalid package-manager input: expected a boolean or a mapping of npm, pnpm, yarn, and bun to booleans.`)}}function packageManagerArgs(e,t){if(e===void 0)return[];if(!supportsScopedEnv(t))throw Error(`package-manager configuration requires Vite+ 0.3.1 or newer.`);return typeof e==`boolean`?e?[]:[[`env`,`off`,`pm`]]:_t.filter(t=>e[t]===!1).map(e=>[`env`,`off`,e])}function readNpmrc(e){try{return u(e,`utf8`)}catch(e){if(e.code===`ENOENT`)return``;throw e}}function analyzeProjectNpmrc(e){let t=/* @__PURE__ */ new Set;for(let n of e.split(/\r?\n/)){let e=n.trim();if(!e||e.startsWith(`;`)||e.startsWith(`#`))continue;let r=e.indexOf(`=`);if(r<0)continue;let i=e.slice(r+1).trim();for(let e of i.matchAll(/\$\{(\w+)\}/g))t.add(e[1])}return{envVarRefs:t}}function readUserConfigLines(e,t){let n=e.HOME||e.USERPROFILE,r=e.NPM_CONFIG_USERCONFIG||e.PNPM_CONFIG_USERCONFIG||n&&v.join(n,`.npmrc`);return(r?readNpmrc(r):``).split(/\r?\n/).filter(e=>!t.has(e.split(`=`)[0].trim().toLowerCase()))}function isReservedAuthVariable(e){return[`GITHUB_TOKEN`,`CI_JOB_TOKEN`,`SYSTEM_ACCESSTOKEN`].includes(e)?!1:/^(?:PATH|HOME|USERPROFILE|TMPDIR|CI)$/i.test(e)||/^(?:SETUP_VP_|RUNNER_|GITHUB_|CI_|SYSTEM_|AGENT_|BUILD_|RELEASE_)/i.test(e)}function writeUserConfig(e,t,n){let r=l(v.join(te(),`setup-vp-npmrc-`)),i=v.join(r,`.npmrc`);_(i,e,{encoding:`utf8`,mode:384});for(let e of[`NPM_CONFIG_USERCONFIG`,`PNPM_CONFIG_USERCONFIG`])t[e]=i,n?.(e,i);return i}function configureAuth$1(e,t,n,r,i){if(!e){if(!i)return;let{envVarRefs:e}=analyzeProjectNpmrc(readNpmrc(v.join(i,`.npmrc`)));for(let t of e)!isReservedAuthVariable(t)&&n[t]&&r?.(t,n[t]);return}let a;try{a=new URL(e)}catch{throw Error(`Invalid registry-url: "${e}". Must be a valid URL.`)}let o=a.href.endsWith(`/`)?a.href:`${a.href}/`,s=``;t&&(s=`${(t.startsWith(`@`)?t:`@${t}`).toLowerCase()}:`);let c=o.replace(/^\w+:/,``).toLowerCase(),l=readUserConfigLines(n,/* @__PURE__ */ new Set([`${s}registry`,`${c}:_authtoken`]));l.push(`${c}:_authToken=\${NODE_AUTH_TOKEN}`,`${s}registry=${o}`);let u=writeUserConfig(l.filter(Boolean).join(` +`.trim()]}}const pt=2e3;function getVitePlusHome(e=process.platform,t=process.env){let n=isWindows(e)?t.USERPROFILE||ee():t.HOME||ee();return x(n,`.vite-plus`)}function runInstallCommand(e,t,n=process.platform){let{command:r,args:i}=getInstallScriptCommand(e,n,t.VP_VPDIRS_AWARE===`1`),a={env:{...process.env,...t},stdio:`inherit`},o=E(r,i,a);if(isWindows(n)&&o.error?.code===`ENOENT`&&(o=E(`powershell.exe`,i,a)),o.error)throw o.error;return o.status??1}async function installVitePlus(e,t={}){let n=t.platform??process.platform,r=t.env??process.env,i=t.prependPath,a=t.sleep??ne,o=t.runInstall??runInstallCommand,s=t.logWarningFn??console.warn,c={...Object.fromEntries(Object.entries(r).filter(e=>e[1]!==void 0)),VP_VERSION:e,VITE_PLUS_VERSION:e},l=supportsVitePlusDirs(e)?createVitePlusDirsFile():void 0;l?(c.VP_VPDIRS_AWARE=`1`,c[Q]=l):(delete c.VP_VPDIRS_AWARE,delete c[Q]);let u=pkgPrNewCommitSha(e);u&&(c.VP_PR_VERSION=u);let{pinned:d,latest:f}=getInstallScriptUrls(e,n),p=d.length+f.length,m=2*p,h=``,g=0;async function tryUrls(e){for(let t=0;t<2;t+=1)for(let t of e){g+=1;try{let e=o(t,c,n);if(e===0)return!0;h=`exit code ${e}`}catch(e){h=e instanceof Error?e.message:String(e)}g0){if(await tryUrls(d)){ensureBinInPath();return}s(`setup-vp: could not fetch the install script pinned to Vite+ ${e}. Falling back to the latest install script. The latest script may not be compatible with ${e}.`)}if(await tryUrls(f)){ensureBinInPath();return}throw Error(`Failed to install Vite+ after ${m} attempts across ${p} URL(s): ${h}`)}finally{l&&removeVitePlusDirsFile(l)}}function copyCacheDirectory(e,t,n){e=_.resolve(e),t=_.resolve(t),i(e,t,{recursive:!0,force:n,errorOnExist:!1,filter:(r,i)=>{let a=s(i,{throwIfNoEntry:!1}),o=s(r);if(a&&!n)return o.isDirectory()&&a.isDirectory();if(a&&(a.isSymbolicLink()||o.isSymbolicLink())&&p(i,{recursive:!0,force:!0}),o.isSymbolicLink()){let n=_.resolve(_.dirname(r),f(r)),a=n;if(isWithin(n,e)){let r=_.join(t,_.relative(e,n));a=_.relative(_.dirname(i),r)||`.`}return c(_.dirname(i),{recursive:!0}),h(a,i,m(n,{throwIfNoEntry:!1})?.isDirectory()?`dir`:`file`),!1}return!0}})}function restoreCacheSnapshot(e,t,n=console.warn,r=!0){if(!e.ready||!e.cachePath||!e.lockFile||!e.lockType)return{hit:!1,save:()=>{}};let i=e.cachePath;if(isWithin(_.resolve(i),_.resolve(t))||isWithin(_.resolve(t),_.resolve(i)))return n(`setup-vp: package-manager cache overlaps the snapshot directory; skipping cache.`),{hit:!1,save:()=>{}};let a=_.join(t,process.platform,process.arch,e.lockType),s=_.join(a,`packages`),l=_.join(a,`lock-hash`),d=e.lockFile;function hashLockFile(){return re(`sha256`).update(u(d)).digest(`hex`)}let f;try{f=hashLockFile()}catch(e){return n(`setup-vp: could not read cache lock file: ${String(e)}`),{hit:!1,save:()=>{}}}let p=!1;try{r&&o(s)&&(c(i,{recursive:!0}),copyCacheDirectory(s,i,!1),p=u(l,`utf8`)===f)}catch(e){n(`setup-vp: could not restore package-manager cache: ${String(e)}`)}return{hit:p,save:()=>{try{if(!o(i))return;let e=hashLockFile();c(a,{recursive:!0}),copyCacheDirectory(i,s,!0),g(l,e,`utf8`)}catch(e){n(`setup-vp: could not save package-manager cache: ${String(e)}`)}}}}const mt=/* @__PURE__ */ new Set([`true`,`True`,`TRUE`]),ht=/* @__PURE__ */ new Set([`false`,`False`,`FALSE`]);function parseNodeManager(e){if(e){if(mt.has(e))return!0;if(ht.has(e))return!1;throw Error(`Invalid node-manager input: "${e}". Expected "true", "false", or unset.`)}}function supportsScopedEnv(e){let t=parseInstalledVpVersion(e);if(t.startsWith(`0.0.0-commit.`))return!0;let n=t.match(/^(\d+)\.(\d+)\.(\d+)/);if(!n)throw Error(`Could not determine the installed Vite+ version for env configuration.`);let[,r,i,a]=n.map(Number);return r>0||i>3||i===3&&a>=1}function nodeManagerOffArgs(e){return parseInstalledVpVersion(e).startsWith(`0.0.0-commit.`)&&console.info("setup-vp: node-manager: false requires a preview build that supports `vp env off node`. If this command is unsupported, use a newer preview or a stable release. setup-vp will not fall back to disabling package-manager management."),supportsScopedEnv(e)?[`env`,`off`,`node`]:[`env`,`off`]}const gt=[`npm`,`pnpm`,`yarn`,`bun`];function parsePackageManager(e){if(!e?.trim())return;let t;try{t=(0,Y.parse)(e)}catch(e){throw Error(`Invalid package-manager input: ${String(e)}`)}if(t!==``){if(typeof t==`boolean`)return t;if(t&&typeof t==`object`&&!Array.isArray(t)){for(let[e,n]of Object.entries(t))if(!gt.includes(e)||typeof n!=`boolean`)throw Error(`Invalid package-manager input: ${e} must be npm, pnpm, yarn, or bun with a boolean value.`);return t}throw Error(`Invalid package-manager input: expected a boolean or a mapping of npm, pnpm, yarn, and bun to booleans.`)}}function packageManagerArgs(e,t){if(e===void 0)return[];if(!supportsScopedEnv(t))throw Error(`package-manager configuration requires Vite+ 0.3.1 or newer.`);return typeof e==`boolean`?e?[]:[[`env`,`off`,`pm`]]:gt.filter(t=>e[t]===!1).map(e=>[`env`,`off`,e])}function readNpmrc(e){try{return u(e,`utf8`)}catch(e){if(e.code===`ENOENT`)return``;throw e}}function analyzeProjectNpmrc(e){let t=/* @__PURE__ */ new Set;for(let n of e.split(/\r?\n/)){let e=n.trim();if(!e||e.startsWith(`;`)||e.startsWith(`#`))continue;let r=e.indexOf(`=`);if(r<0)continue;let i=e.slice(r+1).trim();for(let e of i.matchAll(/\$\{(\w+)\}/g))t.add(e[1])}return{envVarRefs:t}}function readUserConfigLines(e,t){let n=e.HOME||e.USERPROFILE,r=e.NPM_CONFIG_USERCONFIG||e.PNPM_CONFIG_USERCONFIG||n&&_.join(n,`.npmrc`);return(r?readNpmrc(r):``).split(/\r?\n/).filter(e=>!t.has(e.split(`=`)[0].trim().toLowerCase()))}function isReservedAuthVariable(e){return[`GITHUB_TOKEN`,`CI_JOB_TOKEN`,`SYSTEM_ACCESSTOKEN`].includes(e)?!1:/^(?:PATH|HOME|USERPROFILE|TMPDIR|CI)$/i.test(e)||/^(?:SETUP_VP_|RUNNER_|GITHUB_|CI_|SYSTEM_|AGENT_|BUILD_|RELEASE_)/i.test(e)}function writeUserConfig(e,t,n){let r=l(_.join(te(),`setup-vp-npmrc-`)),i=_.join(r,`.npmrc`);g(i,e,{encoding:`utf8`,mode:384});for(let e of[`NPM_CONFIG_USERCONFIG`,`PNPM_CONFIG_USERCONFIG`])t[e]=i,n?.(e,i);return i}function configureAuth$1(e,t,n,r,i){if(!e){if(!i)return;let{envVarRefs:e}=analyzeProjectNpmrc(readNpmrc(_.join(i,`.npmrc`)));for(let t of e)!isReservedAuthVariable(t)&&n[t]&&r?.(t,n[t]);return}let a;try{a=new URL(e)}catch{throw Error(`Invalid registry-url: "${e}". Must be a valid URL.`)}let o=a.href.endsWith(`/`)?a.href:`${a.href}/`,s=``;t&&(s=`${(t.startsWith(`@`)?t:`@${t}`).toLowerCase()}:`);let c=o.replace(/^\w+:/,``).toLowerCase(),l=readUserConfigLines(n,/* @__PURE__ */ new Set([`${s}registry`,`${c}:_authtoken`]));l.push(`${c}:_authToken=\${NODE_AUTH_TOKEN}`,`${s}registry=${o}`);let u=writeUserConfig(l.filter(Boolean).join(` `)+` -`,n,r);return n.NODE_AUTH_TOKEN=n.NODE_AUTH_TOKEN||`XXXXX-XXXXX-XXXXX-XXXXX`,r?.(`NODE_AUTH_TOKEN`,n.NODE_AUTH_TOKEN),u}function shellQuote(e){return`'${String(e).replaceAll(`'`,`'\\''`)}'`}function exportShellEnv(e,t,n=process.env){if(!n.SETUP_VP_ENV_FILE||t===void 0)return;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(e))throw Error(`Invalid environment variable name`);let r=n.SETUP_VP_ENV_FORMAT===`powershell`?`$env:${e} = '${t.replaceAll(`'`,`''`)}'\n`:`export ${e}=${shellQuote(t)}\n`;_(n.SETUP_VP_ENV_FILE,r,{encoding:`utf8`,flag:`a`})}function configureAuth(e,t,n=process.env,r){return configureAuth$1(e,t,n,n===process.env?(e,t)=>exportShellEnv(e,t,n):void 0,r)}function resolveSfwEnabled(e,t,n){return e?!pkgPrNewCommitSha(t)||(n(`sfw was requested but is automatically disabled for Vite+ preview build ${t}; Socket Firewall Free will not be used.`),!1):!1}const $=`v1.15.4`,vt=`https://github.com/SocketDev/sfw-free/releases/download/${$}`;function isMuslLinux(){if(process.platform!==`linux`)return!1;try{let e=process.report?.getReport();if(e?.header&&!e.header.glibcVersionRuntime)return!0}catch{}return o(`/etc/alpine-release`)}function getSfwAssetName(e,t,n){if(e===`darwin`){if(t===`arm64`)return`sfw-free-macos-arm64`;if(t===`x64`)return`sfw-free-macos-x86_64`}else if(e===`linux`){if(t===`arm64`)return n?`sfw-free-musl-linux-arm64`:`sfw-free-linux-arm64`;if(t===`x64`)return n?`sfw-free-musl-linux-x86_64`:`sfw-free-linux-x86_64`}else if(isWindows(e)){if(t===`arm64`)return`sfw-free-windows-arm64.exe`;if(t===`x64`)return`sfw-free-windows-x86_64.exe`}throw Error(`Unsupported platform/arch for sfw: ${e}/${t}${e===`linux`?` (${n?`musl`:`glibc`})`:``}`)}function downloadFileWithShell(e,t,n){let r=Math.max(1,Math.ceil(n/1e3)),i=commandPath(`curl`);if(i){let n=D(i,[`-fsSL`,`--connect-timeout`,`5`,`--max-time`,String(r),e,`-o`,t],{stdio:`ignore`});if(n.status===0)return;throw n.error||/* @__PURE__ */ Error(`curl failed while downloading ${e}`)}let a=commandPath(`wget`);if(a){let n=D(a,[`-q`,`-T`,String(r),`-t`,`2`,`-O`,t,e],{stdio:`ignore`});if(n.status===0)return;throw n.error||/* @__PURE__ */ Error(`wget failed while downloading ${e}`)}throw Error(`curl or wget is required to download sfw`)}function downloadFile(e,t,n=0,r=6e4,i){return n>5?Promise.reject(/* @__PURE__ */ Error(`too many redirects while downloading ${e}`)):i?new Promise((o,s)=>{let c=!1,finish=e=>{c||(c=!0,clearTimeout(u),e?s(e):o())},l=i(e,o=>{let s=o.statusCode??0,c=o.headers.location;if(s>=300&&s<400&&c){o.resume(),downloadFile(new URL(c,e).toString(),t,n+1,r,i).then(()=>finish(),finish);return}if(s!==200){o.resume(),finish(/* @__PURE__ */ Error(`download failed with HTTP ${s}: ${e}`));return}let l=a(t);o.pipe(l),l.on(`finish`,()=>l.close(()=>finish())),l.on(`error`,finish)}),u=setTimeout(()=>{l.destroy(/* @__PURE__ */ Error(`download timed out after ${r}ms: ${e}`))},r);l.on(`error`,finish)}):(downloadFileWithShell(e,t,r),Promise.resolve())}async function setupSfw$1(e,t={}){let n=t.env??process.env,r=t.sfwEnabled??n.SETUP_VP_SFW===`true`,i=t.platform??process.platform,a=t.arch??process.arch,o=t.isMusl??isMuslLinux(),s=t.download??downloadFile;if(!resolveSfwEnabled(r,t.vitePlusVersion??``,t.logWarning??console.warn))return`vp`;if(e.length===0)return console.log(`setup-vp: sfw was requested but run-install is disabled; sfw will not be invoked.`),`vp`;let c=commandPath(`sfw`,n);if(c)return console.log(`setup-vp: using existing sfw on PATH: ${c}`),`sfw`;let l;try{l=getSfwAssetName(i,a,o)}catch{return console.error(`setup-vp: sfw has no published binary for this runner's platform/architecture (process.platform=${i}, process.arch=${a}, musl=${o}) and none was found on PATH; falling back to plain vp install.`),`vp`}let u=t.cacheDirectory||n.SETUP_VP_SFW_CACHE_DIR,d=u?v.join(u,$,l):await se(v.join(te(),`setup-vp-sfw-`));await oe(d,{recursive:!0});let f=v.join(d,isWindows(i)?`sfw.exe`:`sfw`),p=`${vt}/${l}`;function activate(){let e=isWindows(i)?`;`:`:`;return n.PATH=`${d}${e}${n.PATH||``}`,t.exportVariable?.(`PATH`,n.PATH),`sfw`}if(await ue(f).then(e=>e.isFile()&&e.size>0,()=>!1))return console.log(`setup-vp: using cached sfw ${$}: ${f}`),activate();for(let e=1;e<=2;e+=1){let t=await se(v.join(d,`.download-`)),n=v.join(t,`sfw`);try{if(console.log(`setup-vp: installing sfw ${$} from ${p}`),await s(p,n),(await ue(n)).size===0)throw Error(`Downloaded sfw binary is empty`);return await ae(n,493),await ce(n,f),activate()}catch(t){if(e===2)throw t;await new Promise(e=>setTimeout(e,2e3))}finally{await le(t,{recursive:!0,force:!0})}}throw Error(`failed to install sfw after retrying`)}async function setupSfw(e,t=process.env,n=``){return setupSfw$1(e,{env:t,vitePlusVersion:n,exportVariable:(e,n)=>exportShellEnv(e,n,t)})}function isRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function validateRunInstallEntry(e){if(!isRecord(e))throw Error(`run-install entries must be objects`);for(let t of Object.keys(e))if(t!==`cwd`&&t!==`args`)throw Error(`unsupported run-install key: ${t}`);let t={};if(e.cwd!==void 0){if(typeof e.cwd!=`string`)throw Error(`run-install.cwd must be a string`);t.cwd=e.cwd}if(e.args!==void 0){if(!Array.isArray(e.args)||e.args.some(e=>typeof e!=`string`))throw Error(`run-install.args must be an array of strings`);t.args=e.args}return t}function validateRunInstallInput(e){return e===null||typeof e==`boolean`?e:Array.isArray(e)?e.map(validateRunInstallEntry):validateRunInstallEntry(e)}function parseRunInstall(e){let t=validateRunInstallInput((0,Y.parse)(e)??null);return t?t===!0?[{}]:Array.isArray(t)?t:[t]:[]}function isSfwVpNotFoundFlake(e,t){return/Command 'vp' not found in PATH/.test(e+` -`+t)}async function runInstall(e,t,n,r=process.env,i={}){let a={...r};delete a.SETUP_VP_ENV_FILE;let o=i.execute??runWithOutput,s=[];for(let r of e){let e=r.cwd?v.resolve(t,r.cwd):t,c=[`install`,...r.args||[]],l=n===`sfw`?[`vp`,...c]:c,u=`${n} ${l.join(` `)} (cwd: ${e})`;console.log(`setup-vp: running ${u}`);try{let t=await o(n,l,{cwd:e,env:a});if(t.exitCode!==0&&n===`sfw`&&isSfwVpNotFoundFlake(t.stdout,t.stderr)){let r=isWindows(i.platform);if(console.warn(r?`setup-vp: sfw could not resolve vp; warming the PowerShell command cache and retrying once.`:`setup-vp: sfw could not resolve vp; retrying once.`),r)try{await o(`powershell.exe`,[`-NoProfile`,`-Command`,`Get-Command vp`],{cwd:e,env:a})}catch{}t=await o(n,l,{cwd:e,env:a})}t.exitCode!==0&&s.push(`${u} exited with code ${t.exitCode}\n${t.stderr.trim()||t.stdout.trim()}`)}catch(e){s.push(`${u}: ${String(e)}`)}}if(s.length)throw Error(s.join(` -`))}function resolveProjectDir(e=process.env){return resolveProjectDirectory({workingDirectory:e.SETUP_VP_WORKING_DIRECTORY||`.`,workspaceRoot:e.CI_PROJECT_DIR||process.cwd()})}function fail(e){console.error(`setup-vp: ${e}`),process.exit(1)}function applyEnvironmentModes(e=process.env,t=run){let n=parseNodeManager(e.SETUP_VP_NODE_MANAGER),r=parsePackageManager(e.SETUP_VP_PACKAGE_MANAGER),i=(n===!1||r!==void 0)&&getCommandOutput(`vp`,[`--version`])||``,a=packageManagerArgs(r,i);n===!1&&t(`vp`,nodeManagerOffArgs(i));for(let e of a)t(`vp`,e)}async function main(e=`setup`){let t=process.env,n=t.CI_PROJECT_DIR||process.cwd(),i=v.join(n,`.setup-vp-cache`),a=v.join(n,`.setup-vp-cache-state.json`),o=v.join(n,`.setup-vp-outputs.env`);if(e===`save-cache`){restoreCacheSnapshot(JSON.parse(u(a,`utf8`)),i,console.warn,!1).save();return}if(e!==`setup`)throw Error(`Invalid GitLab phase: ${e}`);let s=resolveProjectDir(t);m(a,{force:!0}),m(o,{force:!0});let c=resolutionContext(n),l=parseNodeManager(t.SETUP_VP_NODE_MANAGER);parsePackageManager(t.SETUP_VP_PACKAGE_MANAGER);let d=parseRunInstall(t.SETUP_VP_RUN_INSTALL??`true`);if(l===!1&&(t.SETUP_VP_NODE_VERSION||t.SETUP_VP_NODE_VERSION_FILE))throw Error(`node-version and node-version-file cannot be used with node-manager: false`);let f=t.SETUP_VP_NODE_VERSION||(t.SETUP_VP_NODE_VERSION_FILE?createNodeVersionResolver(c).resolveNodeVersionFile(t.SETUP_VP_NODE_VERSION_FILE,s):void 0),p=createVersionResolver(c).resolveVitePlusVersion({version:t.SETUP_VP_VERSION,versionFile:t.SETUP_VP_VERSION_FILE,cacheDependencyPath:t.SETUP_VP_CACHE_DEPENDENCY_PATH},s);await installVitePlus(p,{env:t,exportPath:e=>exportShellEnv(`PATH`,e)}),applyEnvironmentModes(),f&&run(`vp`,[`env`,`use`,f],{cwd:s}),configureAuth(t.SETUP_VP_REGISTRY_URL||``,t.SETUP_VP_SCOPE||``,t,s);let h=t.SETUP_VP_CACHE?.toLowerCase()===`true`;h?t.SETUP_VP_SFW_CACHE_DIR=v.join(i,`sfw`):delete t.SETUP_VP_SFW_CACHE_DIR;let g=h?prepareCacheMetadata({projectDir:s,cacheDependencyPath:t.SETUP_VP_CACHE_DEPENDENCY_PATH,logWarning:console.warn}):{ready:!1},y=restoreCacheSnapshot(g,i),b=t.SETUP_VP_CACHE_SAVE?.toLowerCase()!==`false`;g.ready&&b&&(_(a,JSON.stringify(g),{mode:384}),r(process.argv[1],v.join(n,`.setup-vp-runtime.mjs`))),await runInstall(d,s,await setupSfw(d,t,p)),b&&y.save();let x=getCommandOutput(`vp`,[`--version`],{cwd:s});if(!x)throw Error(`Failed to verify Vite+ installation: vp --version failed or returned no output.`);console.log(x);let S={SETUP_VP_INSTALLED_VERSION:parseInstalledVpVersion(x),SETUP_VP_CACHE_HIT:String(y.hit)};for(let[e,n]of Object.entries(S))t[e]=n,exportShellEnv(e,n);_(o,Object.entries(S).map(([e,t])=>`${e}=${t}\n`).join(``),{mode:384})}function isEntrypoint(e=process.argv[1],t=import.meta.url){return!!(e&&t===T(v.resolve(e)).href)}if(isEntrypoint())try{await main(process.argv[2])}catch(e){fail(e instanceof Error?e.message:String(e))}export{applyEnvironmentModes,isEntrypoint,main}; \ No newline at end of file +`,n,r);return n.NODE_AUTH_TOKEN=n.NODE_AUTH_TOKEN||`XXXXX-XXXXX-XXXXX-XXXXX`,r?.(`NODE_AUTH_TOKEN`,n.NODE_AUTH_TOKEN),u}function shellQuote(e){return`'${String(e).replaceAll(`'`,`'\\''`)}'`}function exportShellEnv(e,t,n=process.env){if(!n.SETUP_VP_ENV_FILE||t===void 0)return;if(!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(e))throw Error(`Invalid environment variable name`);let r=n.SETUP_VP_ENV_FORMAT===`powershell`?`$env:${e} = '${t.replaceAll(`'`,`''`)}'\n`:`export ${e}=${shellQuote(t)}\n`;g(n.SETUP_VP_ENV_FILE,r,{encoding:`utf8`,flag:`a`})}function configureAuth(e,t,n=process.env,r){return configureAuth$1(e,t,n,n===process.env?(e,t)=>exportShellEnv(e,t,n):void 0,r)}function resolveSfwEnabled(e,t,n){return e?!pkgPrNewCommitSha(t)||(n(`sfw was requested but is automatically disabled for Vite+ preview build ${t}; Socket Firewall Free will not be used.`),!1):!1}const $=`v1.15.4`,_t=`https://github.com/SocketDev/sfw-free/releases/download/${$}`;function isMuslLinux(){if(process.platform!==`linux`)return!1;try{let e=process.report?.getReport();if(e?.header&&!e.header.glibcVersionRuntime)return!0}catch{}return o(`/etc/alpine-release`)}function getSfwAssetName(e,t,n){if(e===`darwin`){if(t===`arm64`)return`sfw-free-macos-arm64`;if(t===`x64`)return`sfw-free-macos-x86_64`}else if(e===`linux`){if(t===`arm64`)return n?`sfw-free-musl-linux-arm64`:`sfw-free-linux-arm64`;if(t===`x64`)return n?`sfw-free-musl-linux-x86_64`:`sfw-free-linux-x86_64`}else if(isWindows(e)){if(t===`arm64`)return`sfw-free-windows-arm64.exe`;if(t===`x64`)return`sfw-free-windows-x86_64.exe`}throw Error(`Unsupported platform/arch for sfw: ${e}/${t}${e===`linux`?` (${n?`musl`:`glibc`})`:``}`)}function downloadFileWithShell(e,t,n){let r=Math.max(1,Math.ceil(n/1e3)),i=commandPath(`curl`);if(i){let n=E(i,[`-fsSL`,`--connect-timeout`,`5`,`--max-time`,String(r),e,`-o`,t],{stdio:`ignore`});if(n.status===0)return;throw n.error||/* @__PURE__ */ Error(`curl failed while downloading ${e}`)}let a=commandPath(`wget`);if(a){let n=E(a,[`-q`,`-T`,String(r),`-t`,`2`,`-O`,t,e],{stdio:`ignore`});if(n.status===0)return;throw n.error||/* @__PURE__ */ Error(`wget failed while downloading ${e}`)}throw Error(`curl or wget is required to download sfw`)}function downloadFile(e,t,n=0,r=6e4,i){return n>5?Promise.reject(/* @__PURE__ */ Error(`too many redirects while downloading ${e}`)):i?new Promise((o,s)=>{let c=!1,finish=e=>{c||(c=!0,clearTimeout(u),e?s(e):o())},l=i(e,o=>{let s=o.statusCode??0,c=o.headers.location;if(s>=300&&s<400&&c){o.resume(),downloadFile(new URL(c,e).toString(),t,n+1,r,i).then(()=>finish(),finish);return}if(s!==200){o.resume(),finish(/* @__PURE__ */ Error(`download failed with HTTP ${s}: ${e}`));return}let l=a(t);o.pipe(l),l.on(`finish`,()=>l.close(()=>finish())),l.on(`error`,finish)}),u=setTimeout(()=>{l.destroy(/* @__PURE__ */ Error(`download timed out after ${r}ms: ${e}`))},r);l.on(`error`,finish)}):(downloadFileWithShell(e,t,r),Promise.resolve())}async function setupSfw$1(e,t={}){let n=t.env??process.env,r=t.sfwEnabled??n.SETUP_VP_SFW===`true`,i=t.platform??process.platform,a=t.arch??process.arch,o=t.isMusl??isMuslLinux(),s=t.download??downloadFile;if(!resolveSfwEnabled(r,t.vitePlusVersion??``,t.logWarning??console.warn))return{executable:`vp`,sfw:!1};if(e.length===0)return console.log(`setup-vp: sfw was requested but run-install is disabled; sfw will not be invoked.`),{executable:`vp`,sfw:!1};let c=commandPath(`sfw`,n);if(c)return console.log(`setup-vp: using existing sfw on PATH: ${c}`),{executable:c,sfw:!0};let l;try{l=getSfwAssetName(i,a,o)}catch{return console.error(`setup-vp: sfw has no published binary for this runner's platform/architecture (process.platform=${i}, process.arch=${a}, musl=${o}) and none was found on PATH; falling back to plain vp install.`),{executable:`vp`,sfw:!1}}let u=t.cacheDirectory||n.SETUP_VP_SFW_CACHE_DIR,d=u?_.resolve(u,$,l):await se(_.resolve(te(),`setup-vp-sfw-`));await oe(d,{recursive:!0});let f=_.join(d,isWindows(i)?`sfw.exe`:`sfw`),p=`${_t}/${l}`;function activate(){let e=isWindows(i)?`;`:`:`;return n.PATH=`${d}${e}${n.PATH||``}`,t.exportVariable?.(`PATH`,n.PATH),{executable:f,sfw:!0}}if(await ue(f).then(e=>e.isFile()&&e.size>0,()=>!1))return console.log(`setup-vp: using cached sfw ${$}: ${f}`),activate();for(let e=1;e<=2;e+=1){let t=await se(_.join(d,`.download-`)),n=_.join(t,`sfw`);try{if(console.log(`setup-vp: installing sfw ${$} from ${p}`),await s(p,n),(await ue(n)).size===0)throw Error(`Downloaded sfw binary is empty`);return await ae(n,493),await ce(n,f),activate()}catch(t){if(e===2)throw t;await new Promise(e=>setTimeout(e,2e3))}finally{await le(t,{recursive:!0,force:!0})}}throw Error(`failed to install sfw after retrying`)}async function setupSfw(e,t=process.env,n=``){return setupSfw$1(e,{env:t,vitePlusVersion:n,exportVariable:(e,n)=>exportShellEnv(e,n,t)})}function isRecord(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function validateRunInstallEntry(e){if(!isRecord(e))throw Error(`run-install entries must be objects`);for(let t of Object.keys(e))if(t!==`cwd`&&t!==`args`)throw Error(`unsupported run-install key: ${t}`);let t={};if(e.cwd!==void 0){if(typeof e.cwd!=`string`)throw Error(`run-install.cwd must be a string`);t.cwd=e.cwd}if(e.args!==void 0){if(!Array.isArray(e.args)||e.args.some(e=>typeof e!=`string`))throw Error(`run-install.args must be an array of strings`);t.args=e.args}return t}function validateRunInstallInput(e){return e===null||typeof e==`boolean`?e:Array.isArray(e)?e.map(validateRunInstallEntry):validateRunInstallEntry(e)}function parseRunInstall(e){let t=validateRunInstallInput((0,Y.parse)(e)??null);return t?t===!0?[{}]:Array.isArray(t)?t:[t]:[]}function isSfwVpNotFoundFlake(e,t){return/Command 'vp' not found in PATH/.test(e+` +`+t)}async function runInstall(e,t,n,r=process.env,i={}){let a={...r};delete a.SETUP_VP_ENV_FILE;let o=i.execute??runWithOutput,{executable:s,sfw:c}=n,l=[];for(let n of e){let e=n.cwd?_.resolve(t,n.cwd):t,r=[`install`,...n.args||[]],u=c?[`vp`,...r]:r,d=`${s} ${u.join(` `)} (cwd: ${e})`;console.log(`setup-vp: running ${d}`);try{let t=await o(s,u,{cwd:e,env:a});if(t.exitCode!==0&&c&&isSfwVpNotFoundFlake(t.stdout,t.stderr)){let n=isWindows(i.platform);if(console.warn(n?`setup-vp: sfw could not resolve vp; warming the PowerShell command cache and retrying once.`:`setup-vp: sfw could not resolve vp; retrying once.`),n)try{await o(`powershell.exe`,[`-NoProfile`,`-Command`,`Get-Command vp`],{cwd:e,env:a})}catch{}t=await o(s,u,{cwd:e,env:a})}t.exitCode!==0&&l.push(`${d} exited with code ${t.exitCode}\n${t.stderr.trim()||t.stdout.trim()}`)}catch(e){l.push(`${d}: ${String(e)}`)}}if(l.length)throw Error(l.join(` +`))}function resolveProjectDir(e=process.env){return resolveProjectDirectory({workingDirectory:e.SETUP_VP_WORKING_DIRECTORY||`.`,workspaceRoot:e.CI_PROJECT_DIR||process.cwd()})}function fail(e){console.error(`setup-vp: ${e}`),process.exit(1)}function applyEnvironmentModes(e=process.env,t=run){let n=parseNodeManager(e.SETUP_VP_NODE_MANAGER),r=parsePackageManager(e.SETUP_VP_PACKAGE_MANAGER),i=(n===!1||r!==void 0)&&getCommandOutput(`vp`,[`--version`])||``,a=packageManagerArgs(r,i);n===!1&&t(`vp`,nodeManagerOffArgs(i));for(let e of a)t(`vp`,e)}async function main(e=`setup`){let t=process.env,n=t.CI_PROJECT_DIR||process.cwd(),i=_.join(n,`.setup-vp-cache`),a=_.join(n,`.setup-vp-cache-state.json`),o=_.join(n,`.setup-vp-outputs.env`);if(e===`save-cache`){restoreCacheSnapshot(JSON.parse(u(a,`utf8`)),i,console.warn,!1).save();return}if(e!==`setup`)throw Error(`Invalid GitLab phase: ${e}`);let s=resolveProjectDir(t);p(a,{force:!0}),p(o,{force:!0});let c=resolutionContext(n),l=parseNodeManager(t.SETUP_VP_NODE_MANAGER);parsePackageManager(t.SETUP_VP_PACKAGE_MANAGER);let d=parseRunInstall(t.SETUP_VP_RUN_INSTALL??`true`);if(l===!1&&(t.SETUP_VP_NODE_VERSION||t.SETUP_VP_NODE_VERSION_FILE))throw Error(`node-version and node-version-file cannot be used with node-manager: false`);let f=t.SETUP_VP_NODE_VERSION||(t.SETUP_VP_NODE_VERSION_FILE?createNodeVersionResolver(c).resolveNodeVersionFile(t.SETUP_VP_NODE_VERSION_FILE,s):void 0),m=createVersionResolver(c).resolveVitePlusVersion({version:t.SETUP_VP_VERSION,versionFile:t.SETUP_VP_VERSION_FILE,cacheDependencyPath:t.SETUP_VP_CACHE_DEPENDENCY_PATH},s);await installVitePlus(m,{env:t,exportPath:e=>exportShellEnv(`PATH`,e)}),applyEnvironmentModes(),f&&run(`vp`,[`env`,`use`,f],{cwd:s}),configureAuth(t.SETUP_VP_REGISTRY_URL||``,t.SETUP_VP_SCOPE||``,t,s);let h=t.SETUP_VP_CACHE?.toLowerCase()===`true`;h?t.SETUP_VP_SFW_CACHE_DIR=_.join(i,`sfw`):delete t.SETUP_VP_SFW_CACHE_DIR;let v=h?prepareCacheMetadata({projectDir:s,cacheDependencyPath:t.SETUP_VP_CACHE_DEPENDENCY_PATH,logWarning:console.warn}):{ready:!1},y=restoreCacheSnapshot(v,i),b=t.SETUP_VP_CACHE_SAVE?.toLowerCase()!==`false`;v.ready&&b&&(g(a,JSON.stringify(v),{mode:384}),r(process.argv[1],_.join(n,`.setup-vp-runtime.mjs`))),await runInstall(d,s,await setupSfw(d,t,m)),b&&y.save();let x=getCommandOutput(`vp`,[`--version`],{cwd:s});if(!x)throw Error(`Failed to verify Vite+ installation: vp --version failed or returned no output.`);console.log(x);let S={SETUP_VP_INSTALLED_VERSION:parseInstalledVpVersion(x),SETUP_VP_CACHE_HIT:String(y.hit)};for(let[e,n]of Object.entries(S))t[e]=n,exportShellEnv(e,n);g(o,Object.entries(S).map(([e,t])=>`${e}=${t}\n`).join(``),{mode:384})}function isEntrypoint(e=process.argv[1],t=import.meta.url){return!!(e&&t===w(_.resolve(e)).href)}if(isEntrypoint())try{await main(process.argv[2])}catch(e){fail(e instanceof Error?e.message:String(e))}export{applyEnvironmentModes,isEntrypoint,main}; \ No newline at end of file diff --git a/dist/index.mjs b/dist/index.mjs index 22e9616..6cdd96d 100644 --- a/dist/index.mjs +++ b/dist/index.mjs @@ -329,6 +329,6 @@ default:throw Error(`Unexpected operation: ${e.operator}`)}}),o&&(!a||i(a,o))&&( More info on storage limits: https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions#calculating-minute-and-storage-spending`),this.name=`UsageError`}};UsageError.isUsageErrorMessage=e=>e?e.includes(`insufficient usage`):!1;var RateLimitError=class extends Error{constructor(e){super(e),this.name=`RateLimitError`}},__awaiter$6=function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})},UploadProgress=class{constructor(e){this.contentLength=e,this.sentBytes=0,this.displayedComplete=!1,this.startTime=Date.now()}setSentBytes(e){this.sentBytes=e}getTransferredBytes(){return this.sentBytes}isDone(){return this.getTransferredBytes()===this.contentLength}display(){if(this.displayedComplete)return;let e=this.sentBytes,t=(100*(e/this.contentLength)).toFixed(1),n=Date.now()-this.startTime,r=(e/1048576/(n/1e3)).toFixed(1);info(`Sent ${e} of ${this.contentLength} (${t}%), ${r} MBs/sec`),this.isDone()&&(this.displayedComplete=!0)}onProgress(){return e=>{this.setSentBytes(e.loadedBytes)}}startDisplayTimer(e=1e3){let displayCallback=()=>{this.display(),this.isDone()||(this.timeoutHandle=setTimeout(displayCallback,e))};this.timeoutHandle=setTimeout(displayCallback,e)}stopDisplayTimer(){this.timeoutHandle&&=(clearTimeout(this.timeoutHandle),void 0),this.display()}};function uploadCacheArchiveSDK(e,t,n){return __awaiter$6(this,void 0,void 0,function*(){let r=new k_(e),i=r.getBlockBlobClient(),a=new UploadProgress(n?.archiveSizeBytes??0),o={blockSize:n?.uploadChunkSize,concurrency:n?.uploadConcurrency,maxSingleShotSize:134217728,onProgress:a.onProgress()};try{a.startDisplayTimer(),debug(`BlobClient: ${r.name}:${r.accountName}:${r.containerName}`);let e=yield i.uploadFile(t,o);if(e._response.status>=400)throw new InvalidResponseError(`uploadCacheArchiveSDK: upload failed with status code ${e._response.status}`);return e}catch(e){throw warning(`uploadCacheArchiveSDK: internal error uploading cache archive: ${e.message}`),e}finally{a.stopDisplayTimer()}})}var __awaiter$5=function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})};function isSuccessStatusCode(e){return e?e>=200&&e<300:!1}function isServerErrorStatusCode(e){return!e||e>=500}function isRetryableStatusCode(e){return e?[On.BadGateway,On.ServiceUnavailable,On.GatewayTimeout].includes(e):!1}function sleep(e){return __awaiter$5(this,void 0,void 0,function*(){return new Promise(t=>setTimeout(t,e))})}function retry(e,t,n){return __awaiter$5(this,arguments,void 0,function*(e,t,n,r=2,i=us,a=void 0){let o=``,s=1;for(;s<=r;){let c,l,u=!1;try{c=yield t()}catch(e){a&&(c=a(e)),u=!0,o=e.message}if(c&&(l=n(c),!isServerErrorStatusCode(l)))return c;if(l&&(u=isRetryableStatusCode(l),o=`Cache service responded with ${l}`),debug(`${e} - Attempt ${s} of ${r} failed with error: ${o}`),!u){debug(`${e} - Error is not retryable`);break}yield sleep(i),s++}throw Error(`${e} failed: ${o}`)})}function retryTypedResponse(e,t){return __awaiter$5(this,arguments,void 0,function*(e,t,n=2,r=us){return yield retry(e,t,e=>e.statusCode,n,r,e=>{if(e instanceof Pn)return{statusCode:e.statusCode,result:null,headers:{},error:e}})})}function retryHttpClientResponse(e,t){return __awaiter$5(this,arguments,void 0,function*(e,t,n=2,r=us){return yield retry(e,t,e=>e.message.statusCode,n,r)})}var __awaiter$4=function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})};function pipeResponseToStream(e,t){return __awaiter$4(this,void 0,void 0,function*(){yield v.promisify(Te.pipeline)(e.message,t)})}var DownloadProgress=class{constructor(e){this.contentLength=e,this.segmentIndex=0,this.segmentSize=0,this.segmentOffset=0,this.receivedBytes=0,this.displayedComplete=!1,this.startTime=Date.now()}nextSegment(e){this.segmentOffset+=this.segmentSize,this.segmentIndex+=1,this.segmentSize=e,this.receivedBytes=0,debug(`Downloading segment at offset ${this.segmentOffset} with length ${this.segmentSize}...`)}setReceivedBytes(e){this.receivedBytes=e}getTransferredBytes(){return this.segmentOffset+this.receivedBytes}isDone(){return this.getTransferredBytes()===this.contentLength}display(){if(this.displayedComplete)return;let e=this.segmentOffset+this.receivedBytes,t=(100*(e/this.contentLength)).toFixed(1),n=Date.now()-this.startTime,r=(e/1048576/(n/1e3)).toFixed(1);info(`Received ${e} of ${this.contentLength} (${t}%), ${r} MBs/sec`),this.isDone()&&(this.displayedComplete=!0)}onProgress(){return e=>{this.setReceivedBytes(e.loadedBytes)}}startDisplayTimer(e=1e3){let displayCallback=()=>{this.display(),this.isDone()||(this.timeoutHandle=setTimeout(displayCallback,e))};this.timeoutHandle=setTimeout(displayCallback,e)}stopDisplayTimer(){this.timeoutHandle&&=(clearTimeout(this.timeoutHandle),void 0),this.display()}};function downloadCacheHttpClient(e,t){return __awaiter$4(this,void 0,void 0,function*(){let n=a.createWriteStream(t),r=new HttpClient(`actions/cache`),i=yield retryHttpClientResponse(`downloadCache`,()=>__awaiter$4(this,void 0,void 0,function*(){return r.get(e)}));i.message.socket.setTimeout(ds,()=>{i.message.destroy(),debug(`Aborting download, socket timed out after ${ds} ms`)}),yield pipeResponseToStream(i,n);let o=i.message.headers[`content-length`];if(o){let e=parseInt(o),n=getArchiveFileSizeInBytes(t);if(n!==e)throw Error(`Incomplete download. Expected file size: ${e}, actual file size: ${n}`)}else debug(`Unable to validate download, no Content-Length header`)})}function downloadCacheHttpClientConcurrent(e,t,n){return __awaiter$4(this,void 0,void 0,function*(){let r=yield a.promises.open(t,`w`),i=new HttpClient(`actions/cache`,void 0,{socketTimeout:n.timeoutInMs,keepAlive:!0});try{let t=(yield retryHttpClientResponse(`downloadCacheMetadata`,()=>__awaiter$4(this,void 0,void 0,function*(){return yield i.request(`HEAD`,e,null,{})}))).message.headers[`content-length`];if(t==null)throw Error(`Content-Length not found on blob response`);let a=parseInt(t);if(Number.isNaN(a))throw Error(`Could not interpret Content-Length: ${a}`);let o=[],s=4194304;for(let t=0;t__awaiter$4(this,void 0,void 0,function*(){return yield downloadSegmentRetry(i,e,t,n)})})}o.reverse();let c=0,l=0,u=new DownloadProgress(a);u.startDisplayTimer();let d=u.onProgress(),f=[],p,waitAndWrite=()=>__awaiter$4(this,void 0,void 0,function*(){let e=yield Promise.race(Object.values(f));yield r.write(e.buffer,0,e.count,e.offset),c--,delete f[e.offset],l+=e.count,d({loadedBytes:l})});for(;p=o.pop();)f[p.offset]=p.promiseGetter(),c++,c>=(n.downloadConcurrency??10)&&(yield waitAndWrite());for(;c>0;)yield waitAndWrite()}finally{i.dispose(),yield r.close()}})}function downloadSegmentRetry(e,t,n,r){return __awaiter$4(this,void 0,void 0,function*(){let i=0;for(;;)try{let i=yield promiseWithTimeout(3e4,downloadSegment(e,t,n,r));if(typeof i==`string`)throw Error(`downloadSegmentRetry failed due to timeout`);return i}catch(e){if(i>=5)throw e;i++}})}function downloadSegment(e,t,n,r){return __awaiter$4(this,void 0,void 0,function*(){let i=yield retryHttpClientResponse(`downloadCachePart`,()=>__awaiter$4(this,void 0,void 0,function*(){return yield e.get(t,{Range:`bytes=${n}-${n+r-1}`})}));if(!i.readBodyBuffer)throw Error(`Expected HttpClientResponse to implement readBodyBuffer`);return{offset:n,count:r,buffer:yield i.readBodyBuffer()}})}function downloadCacheStorageSDK(e,t,n){return __awaiter$4(this,void 0,void 0,function*(){let r=new j_(e,void 0,{retryOptions:{tryTimeoutInMs:n.timeoutInMs}}),i=(yield r.getProperties()).contentLength??-1;if(i<0)debug(`Unable to determine content length, downloading file with http-client...`),yield downloadCacheHttpClient(e,t);else{let e=Math.min(134217728,ee.constants.MAX_LENGTH),o=new DownloadProgress(i),s=a.openSync(t,`w`);try{o.startDisplayTimer();let t=new AbortController,c=t.signal;for(;!o.isDone();){let l=o.segmentOffset+o.segmentSize,u=Math.min(e,i-l);o.nextSegment(u);let d=yield promiseWithTimeout(n.segmentTimeoutInMs||36e5,r.downloadToBuffer(l,u,{abortSignal:c,concurrency:n.downloadConcurrency,onProgress:o.onProgress()}));if(d===`timeout`)throw t.abort(),Error(`Aborting cache download as the download time exceeded the timeout.`);Buffer.isBuffer(d)&&a.writeFileSync(s,d)}}finally{o.stopDisplayTimer(),a.closeSync(s)}}})}const promiseWithTimeout=(e,t)=>__awaiter$4(void 0,void 0,void 0,function*(){let n,r=new Promise(t=>{n=setTimeout(()=>t(`timeout`),e)});return Promise.race([t,r]).then(e=>(clearTimeout(n),e))});function getUploadOptions(e){let t={useAzureSdk:!1,uploadConcurrency:4,uploadChunkSize:33554432};return e&&(typeof e.useAzureSdk==`boolean`&&(t.useAzureSdk=e.useAzureSdk),typeof e.uploadConcurrency==`number`&&(t.uploadConcurrency=e.uploadConcurrency),typeof e.uploadChunkSize==`number`&&(t.uploadChunkSize=e.uploadChunkSize)),t.uploadConcurrency=isNaN(Number(process.env.CACHE_UPLOAD_CONCURRENCY))?t.uploadConcurrency:Math.min(32,Number(process.env.CACHE_UPLOAD_CONCURRENCY)),t.uploadChunkSize=isNaN(Number(process.env.CACHE_UPLOAD_CHUNK_SIZE))?t.uploadChunkSize:Math.min(134217728,Number(process.env.CACHE_UPLOAD_CHUNK_SIZE)*1024*1024),debug(`Use Azure SDK: ${t.useAzureSdk}`),debug(`Upload concurrency: ${t.uploadConcurrency}`),debug(`Upload chunk size: ${t.uploadChunkSize}`),t}function getDownloadOptions(e){let t={useAzureSdk:!1,concurrentBlobDownloads:!0,downloadConcurrency:8,timeoutInMs:3e4,segmentTimeoutInMs:6e5,lookupOnly:!1};e&&(typeof e.useAzureSdk==`boolean`&&(t.useAzureSdk=e.useAzureSdk),typeof e.concurrentBlobDownloads==`boolean`&&(t.concurrentBlobDownloads=e.concurrentBlobDownloads),typeof e.downloadConcurrency==`number`&&(t.downloadConcurrency=e.downloadConcurrency),typeof e.timeoutInMs==`number`&&(t.timeoutInMs=e.timeoutInMs),typeof e.segmentTimeoutInMs==`number`&&(t.segmentTimeoutInMs=e.segmentTimeoutInMs),typeof e.lookupOnly==`boolean`&&(t.lookupOnly=e.lookupOnly));let n=process.env.SEGMENT_DOWNLOAD_TIMEOUT_MINS;return n&&!isNaN(Number(n))&&isFinite(Number(n))&&(t.segmentTimeoutInMs=Number(n)*60*1e3),debug(`Use Azure SDK: ${t.useAzureSdk}`),debug(`Download concurrency: ${t.downloadConcurrency}`),debug(`Request timeout (ms): ${t.timeoutInMs}`),debug(`Cache segment download timeout mins env var: ${process.env.SEGMENT_DOWNLOAD_TIMEOUT_MINS}`),debug(`Segment download timeout (ms): ${t.segmentTimeoutInMs}`),debug(`Lookup only: ${t.lookupOnly}`),t}function isGhes(){let e=new URL(process.env.GITHUB_SERVER_URL||`https://github.com`).hostname.trimEnd().toUpperCase(),t=e===`GITHUB.COM`,n=e.endsWith(`.GHE.COM`),r=e.endsWith(`.LOCALHOST`);return!t&&!n&&!r}function getCacheServiceVersion(){return isGhes()?`v1`:process.env.ACTIONS_CACHE_SERVICE_V2?`v2`:`v1`}const N_=[`none`,`read`,`write`,`write-only`];function getCacheMode(){return(process.env.ACTIONS_CACHE_MODE||``).trim().toLowerCase()}function isCacheReadable(e){return!N_.includes(e)||e===`read`||e===`write`}function isCacheWritable(e){return!N_.includes(e)||e===`write`||e===`write-only`}function getCacheServiceURL(){let e=getCacheServiceVersion();switch(e){case`v1`:return process.env.ACTIONS_CACHE_URL||process.env.ACTIONS_RESULTS_URL||``;case`v2`:return process.env.ACTIONS_RESULTS_URL||``;default:throw Error(`Unsupported cache service version: ${e}`)}}var P_=/* @__PURE__ */ __commonJSMin(((e,t)=>{t.exports={name:`@actions/cache`,version:`6.3.0`,description:`Actions cache lib`,keywords:[`github`,`actions`,`cache`],homepage:`https://github.com/actions/toolkit/tree/main/packages/cache`,license:`MIT`,type:`module`,main:`lib/cache.js`,types:`lib/cache.d.ts`,exports:{".":{types:`./lib/cache.d.ts`,import:`./lib/cache.js`}},directories:{lib:`lib`,test:`__tests__`},files:[`lib`,`!.DS_Store`],publishConfig:{access:`public`},repository:{type:`git`,url:`git+https://github.com/actions/toolkit.git`,directory:`packages/cache`},scripts:{"audit-moderate":`npm install && npm audit --json --audit-level=moderate > audit.json`,test:`echo "Error: run tests from root" && exit 1`,tsc:`tsc && cp src/internal/shared/package-version.cjs lib/internal/shared/`},bugs:{url:`https://github.com/actions/toolkit/issues`},dependencies:{"@actions/core":`^3.0.1`,"@actions/exec":`^3.0.0`,"@actions/glob":`^0.7.0`,"@actions/http-client":`^4.0.1`,"@actions/io":`^3.0.2`,"@azure/core-rest-pipeline":`~1.23.0`,"@azure/storage-blob":`~12.31.0`,"@protobuf-ts/runtime-rpc":`^2.11.1`,semver:`^7.8.5`},devDependencies:{"@protobuf-ts/plugin":`^2.11.1`,"@types/node":`^25.9.8`,"@types/semver":`^7.8.0`,typescript:`^5.9.3`},overrides:{"uri-js":`npm:uri-js-replace@^1.0.1`,"node-fetch":`^3.3.2`}}})),F_=(/* @__PURE__ */ __commonJSMin(((e,t)=>{t.exports={version:P_().version}})))();function getUserAgentString(){return`@actions/cache-${F_.version}`}var __awaiter$3=function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})};function getCacheApiUrl(e){let t=getCacheServiceURL();if(!t)throw Error(`Cache Service Url not found, unable to restore cache.`);let n=`${t}_apis/artifactcache/${e}`;return debug(`Resource Url: ${n}`),n}function createAcceptHeader(e,t){return`${e};api-version=${t}`}function getRequestOptions(){return{headers:{Accept:createAcceptHeader(`application/json`,`6.0-preview.1`)}}}function createHttpClient(){let e=new BearerCredentialHandler(process.env.ACTIONS_RUNTIME_TOKEN||``);return new HttpClient(getUserAgentString(),[e],getRequestOptions())}function getCacheEntry(e,t,n){return __awaiter$3(this,void 0,void 0,function*(){let r=createHttpClient(),i=getCacheVersion(t,n?.compressionMethod,n?.enableCrossOsArchive),a=`cache?keys=${encodeURIComponent(e.join(`,`))}&version=${i}`,o=yield retryTypedResponse(`getCacheEntry`,()=>__awaiter$3(this,void 0,void 0,function*(){return r.getJson(getCacheApiUrl(a))}));if(o.statusCode===204)return isDebug()&&(yield printCachesListForDiagnostics(e[0],r,i)),null;if(!isSuccessStatusCode(o.statusCode)){let e=o.error?.message;throw e?.includes(`cache read denied:`)?Error(e):Error(`Cache service responded with ${o.statusCode}`)}let s=o.result,c=s?.archiveLocation;if(!c)throw Error(`Cache not found.`);return setSecret(c),debug(`Cache Result:`),debug(JSON.stringify(s)),s})}function printCachesListForDiagnostics(e,t,n){return __awaiter$3(this,void 0,void 0,function*(){let r=`caches?key=${encodeURIComponent(e)}`,i=yield retryTypedResponse(`listCache`,()=>__awaiter$3(this,void 0,void 0,function*(){return t.getJson(getCacheApiUrl(r))}));if(i.statusCode===200){let t=i.result,r=t?.totalCount;if(r&&r>0){debug(`No matching cache found for cache key '${e}', version '${n} and scope ${process.env.GITHUB_REF}. There exist one or more cache(s) with similar key but they have different version or scope. See more info on cache matching here: https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#matching-a-cache-key \nOther caches with similar key:`);for(let e of t?.artifactCaches||[])debug(`Cache Key: ${e?.cacheKey}, Cache Version: ${e?.cacheVersion}, Cache Scope: ${e?.scope}, Cache Created: ${e?.creationTime}`)}}})}function downloadCache(e,t,n){return __awaiter$3(this,void 0,void 0,function*(){let r=new De(e),i=getDownloadOptions(n);r.hostname.endsWith(`.blob.core.windows.net`)?i.useAzureSdk?yield downloadCacheStorageSDK(e,t,i):i.concurrentBlobDownloads?yield downloadCacheHttpClientConcurrent(e,t,i):yield downloadCacheHttpClient(e,t):yield downloadCacheHttpClient(e,t)})}function reserveCache(e,t,n){return __awaiter$3(this,void 0,void 0,function*(){let r=createHttpClient(),i={key:e,version:getCacheVersion(t,n?.compressionMethod,n?.enableCrossOsArchive),cacheSize:n?.cacheSize};return yield retryTypedResponse(`reserveCache`,()=>__awaiter$3(this,void 0,void 0,function*(){return r.postJson(getCacheApiUrl(`caches`),i)}))})}function getContentRange(e,t){return`bytes ${e}-${t}/*`}function uploadChunk(e,t,n,r,i){return __awaiter$3(this,void 0,void 0,function*(){debug(`Uploading chunk of size ${i-r+1} bytes at offset ${r} with content range: ${getContentRange(r,i)}`);let a={"Content-Type":`application/octet-stream`,"Content-Range":getContentRange(r,i)},o=yield retryHttpClientResponse(`uploadChunk (start: ${r}, end: ${i})`,()=>__awaiter$3(this,void 0,void 0,function*(){return e.sendStream(`PATCH`,t,n(),a)}));if(!isSuccessStatusCode(o.message.statusCode))throw Error(`Cache service responded with ${o.message.statusCode} during upload chunk.`)})}function uploadFile(e,t,n,r){return __awaiter$3(this,void 0,void 0,function*(){let i=getArchiveFileSizeInBytes(n),o=getCacheApiUrl(`caches/${t.toString()}`),s=a.openSync(n,`r`),c=getUploadOptions(r),l=assertDefined(`uploadConcurrency`,c.uploadConcurrency),u=assertDefined(`uploadChunkSize`,c.uploadChunkSize),d=[...Array(l).keys()];debug(`Awaiting all uploads`);let f=0;try{yield Promise.all(d.map(()=>__awaiter$3(this,void 0,void 0,function*(){for(;fa.createReadStream(n,{fd:s,start:r,end:c,autoClose:!1}).on(`error`,e=>{throw Error(`Cache upload failed because file read failed with ${e.message}`)}),r,c)}})))}finally{a.closeSync(s)}})}function commitCache(e,t,n){return __awaiter$3(this,void 0,void 0,function*(){let r={size:n};return yield retryTypedResponse(`commitCache`,()=>__awaiter$3(this,void 0,void 0,function*(){return e.postJson(getCacheApiUrl(`caches/${t.toString()}`),r)}))})}function saveCache$2(e,t,n,r){return __awaiter$3(this,void 0,void 0,function*(){if(getUploadOptions(r).useAzureSdk){if(!n)throw Error(`Azure Storage SDK can only be used when a signed URL is provided.`);yield uploadCacheArchiveSDK(n,t,r)}else{let n=createHttpClient();debug(`Upload cache`),yield uploadFile(n,e,t,r),debug(`Commiting cache`);let i=getArchiveFileSizeInBytes(t);info(`Cache Size: ~${Math.round(i/1048576)} MB (${i} B)`);let a=yield commitCache(n,e,i);if(!isSuccessStatusCode(a.statusCode))throw Error(`Cache service responded with ${a.statusCode} during commit cache.`);info(`Cache saved successfully`)}})}var I_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isJsonObject=e.typeofJsonValue=void 0;function typeofJsonValue(e){let t=typeof e;if(t==`object`){if(Array.isArray(e))return`array`;if(e===null)return`null`}return t}e.typeofJsonValue=typeofJsonValue;function isJsonObject(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}e.isJsonObject=isJsonObject})),L_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.base64encode=e.base64decode=void 0;let t=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`.split(``),n=[];for(let e=0;e>4,s=o,a=2;break;case 2:r[i++]=(s&15)<<4|(o&60)>>2,s=o,a=3;break;case 3:r[i++]=(s&3)<<6|o,a=0}}if(a==1)throw Error(`invalid base64 string.`);return r.subarray(0,i)}e.base64decode=base64decode;function base64encode(e){let n=``,r=0,i,a=0;for(let o=0;o>2],a=(i&3)<<4,r=1;break;case 1:n+=t[a|i>>4],a=(i&15)<<2,r=2;break;case 2:n+=t[a|i>>6],n+=t[i&63],r=0}return r&&(n+=t[a],n+=`=`,r==1&&(n+=`=`)),n}e.base64encode=base64encode})),R_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.utf8read=void 0;let fromCharCodes=e=>String.fromCharCode.apply(String,e);function utf8read(e){if(e.length<1)return``;let t=0,n=[],r=[],i=0,a,o=e.length;for(;t191&&a<224?r[i++]=(a&31)<<6|e[t++]&63:a>239&&a<365?(a=((a&7)<<18|(e[t++]&63)<<12|(e[t++]&63)<<6|e[t++]&63)-65536,r[i++]=55296+(a>>10),r[i++]=56320+(a&1023)):r[i++]=(a&15)<<12|(e[t++]&63)<<6|e[t++]&63,i>8191&&(n.push(fromCharCodes(r)),i=0);return n.length?(i&&n.push(fromCharCodes(r.slice(0,i))),n.join(``)):fromCharCodes(r.slice(0,i))}e.utf8read=utf8read})),z_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.WireType=e.mergeBinaryOptions=e.UnknownFieldHandler=void 0,(function(e){e.symbol=Symbol.for(`protobuf-ts/unknown`),e.onRead=(t,n,r,i,a)=>{(is(n)?n[e.symbol]:n[e.symbol]=[]).push({no:r,wireType:i,data:a})},e.onWrite=(t,n,r)=>{for(let{no:t,wireType:i,data:a}of e.list(n))r.tag(t,i).raw(a)},e.list=(t,n)=>{if(is(t)){let r=t[e.symbol];return n?r.filter(e=>e.no==n):r}return[]},e.last=(t,n)=>e.list(t,n).slice(-1)[0];let is=t=>t&&Array.isArray(t[e.symbol])})(e.UnknownFieldHandler||={});function mergeBinaryOptions(e,t){return Object.assign(Object.assign({},e),t)}e.mergeBinaryOptions=mergeBinaryOptions,(function(e){e[e.Varint=0]=`Varint`,e[e.Bit64=1]=`Bit64`,e[e.LengthDelimited=2]=`LengthDelimited`,e[e.StartGroup=3]=`StartGroup`,e[e.EndGroup=4]=`EndGroup`,e[e.Bit32=5]=`Bit32`})(e.WireType||={})})),B_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.varint32read=e.varint32write=e.int64toString=e.int64fromString=e.varint64write=e.varint64read=void 0;function varint64read(){let e=0,t=0;for(let n=0;n<28;n+=7){let r=this.buf[this.pos++];if(e|=(r&127)<>4,!(n&128))return this.assertBounds(),[e,t];for(let n=3;n<=31;n+=7){let r=this.buf[this.pos++];if(t|=(r&127)<>>r,a=!(!(i>>>7)&&t==0),o=(a?i|128:i)&255;if(n.push(o),!a)return}let r=e>>>28&15|(t&7)<<4,i=!!(t>>3);if(n.push((i?r|128:r)&255),i){for(let e=3;e<31;e+=7){let r=t>>>e,i=!!(r>>>7),a=(i?r|128:r)&255;if(n.push(a),!i)return}n.push(t>>>31&1)}}e.varint64write=varint64write;let t=4294967296;function int64fromString(e){let n=e[0]==`-`;n&&(e=e.slice(1));let r=1e6,i=0,a=0;function add1e6digit(n,o){let s=Number(e.slice(n,o));a*=r,i=i*r+s,i>=t&&(a+=i/t|0,i%=t)}return add1e6digit(-24,-18),add1e6digit(-18,-12),add1e6digit(-12,-6),add1e6digit(-6),[n,i,a]}e.int64fromString=int64fromString;function int64toString(e,n){if(n>>>0<=2097151)return``+(t*n+(e>>>0));let r=e&16777215,i=(e>>>24|n<<8)>>>0&16777215,a=n>>16&65535,o=r+i*6777216+a*6710656,s=i+a*8147497,c=a*2,l=1e7;o>=l&&(s+=Math.floor(o/l),o%=l),s>=l&&(c+=Math.floor(s/l),s%=l);function decimalFrom1e7(e,t){let n=e?String(e):``;return t?`0000000`.slice(n.length)+n:n}return decimalFrom1e7(c,0)+decimalFrom1e7(s,c)+decimalFrom1e7(o,1)}e.int64toString=int64toString;function varint32write(e,t){if(e>=0){for(;e>127;)t.push(e&127|128),e>>>=7;t.push(e)}else{for(let n=0;n<9;n++)t.push(e&127|128),e>>=7;t.push(1)}}e.varint32write=varint32write;function varint32read(){let e=this.buf[this.pos++],t=e&127;if(!(e&128)||(e=this.buf[this.pos++],t|=(e&127)<<7,!(e&128))||(e=this.buf[this.pos++],t|=(e&127)<<14,!(e&128))||(e=this.buf[this.pos++],t|=(e&127)<<21,!(e&128)))return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let t=5;e&128&&t<10;t++)e=this.buf[this.pos++];if(e&128)throw Error(`invalid varint`);return this.assertBounds(),t>>>0}e.varint32read=varint32read})),V_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PbLong=e.PbULong=e.detectBi=void 0;let t=B_(),n;function detectBi(){let e=/* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8));n=globalThis.BigInt!==void 0&&typeof e.getBigInt64==`function`&&typeof e.getBigUint64==`function`&&typeof e.setBigInt64==`function`&&typeof e.setBigUint64==`function`?{MIN:BigInt(`-9223372036854775808`),MAX:BigInt(`9223372036854775807`),UMIN:BigInt(`0`),UMAX:BigInt(`18446744073709551615`),C:BigInt,V:e}:void 0}e.detectBi=detectBi,detectBi();function assertBi(e){if(!e)throw Error(`BigInt unavailable, see https://github.com/timostamm/protobuf-ts/blob/v1.0.8/MANUAL.md#bigint-support`)}let r=/^-?[0-9]+$/,i=4294967296,a=2147483648;var SharedPbLong=class{constructor(e,t){this.lo=e|0,this.hi=t|0}isZero(){return this.lo==0&&this.hi==0}toNumber(){let e=this.hi*i+(this.lo>>>0);if(!Number.isSafeInteger(e))throw Error(`cannot convert to safe number`);return e}},o=class PbULong extends SharedPbLong{static from(e){if(n)switch(typeof e){case`string`:if(e==`0`)return this.ZERO;if(e==``)throw Error(`string is no integer`);e=n.C(e);case`number`:if(e===0)return this.ZERO;e=n.C(e);case`bigint`:if(!e)return this.ZERO;if(en.UMAX)throw Error(`ulong too large`);return n.V.setBigUint64(0,e,!0),new PbULong(n.V.getInt32(0,!0),n.V.getInt32(4,!0))}else switch(typeof e){case`string`:if(e==`0`)return this.ZERO;if(e=e.trim(),!r.test(e))throw Error(`string is no integer`);let[n,a,o]=t.int64fromString(e);if(n)throw Error(`signed value for ulong`);return new PbULong(a,o);case`number`:if(e==0)return this.ZERO;if(!Number.isSafeInteger(e))throw Error(`number is no integer`);if(e<0)throw Error(`signed value for ulong`);return new PbULong(e,e/i)}throw Error(`unknown value `+typeof e)}toString(){return n?this.toBigInt().toString():t.int64toString(this.lo,this.hi)}toBigInt(){return assertBi(n),n.V.setInt32(0,this.lo,!0),n.V.setInt32(4,this.hi,!0),n.V.getBigUint64(0,!0)}};e.PbULong=o,o.ZERO=new o(0,0);var s=class PbLong extends SharedPbLong{static from(e){if(n)switch(typeof e){case`string`:if(e==`0`)return this.ZERO;if(e==``)throw Error(`string is no integer`);e=n.C(e);case`number`:if(e===0)return this.ZERO;e=n.C(e);case`bigint`:if(!e)return this.ZERO;if(en.MAX)throw Error(`signed long too large`);return n.V.setBigInt64(0,e,!0),new PbLong(n.V.getInt32(0,!0),n.V.getInt32(4,!0))}else switch(typeof e){case`string`:if(e==`0`)return this.ZERO;if(e=e.trim(),!r.test(e))throw Error(`string is no integer`);let[n,o,s]=t.int64fromString(e);if(n){if(s>a||s==a&&o!=0)throw Error(`signed long too small`)}else if(s>=a)throw Error(`signed long too large`);let c=new PbLong(o,s);return n?c.negate():c;case`number`:if(e==0)return this.ZERO;if(!Number.isSafeInteger(e))throw Error(`number is no integer`);return e>0?new PbLong(e,e/i):new PbLong(-e,-e/i).negate()}throw Error(`unknown value `+typeof e)}isNegative(){return!!(this.hi&a)}negate(){let e=~this.hi,t=this.lo;return t?t=~t+1:e+=1,new PbLong(t,e)}toString(){if(n)return this.toBigInt().toString();if(this.isNegative()){let e=this.negate();return`-`+t.int64toString(e.lo,e.hi)}return t.int64toString(this.lo,this.hi)}toBigInt(){return assertBi(n),n.V.setInt32(0,this.lo,!0),n.V.setInt32(4,this.hi,!0),n.V.getBigInt64(0,!0)}};e.PbLong=s,s.ZERO=new s(0,0)})),H_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BinaryReader=e.binaryReadOptions=void 0;let t=z_(),n=V_(),r=B_(),i={readUnknownField:!0,readerFactory:e=>new BinaryReader(e)};function binaryReadOptions(e){return e?Object.assign(Object.assign({},i),e):i}e.binaryReadOptions=binaryReadOptions;var BinaryReader=class{constructor(e,t){this.varint64=r.varint64read,this.uint32=r.varint32read,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=t??new TextDecoder(`utf-8`,{fatal:!0,ignoreBOM:!0})}tag(){let e=this.uint32(),t=e>>>3,n=e&7;if(t<=0||n<0||n>5)throw Error(`illegal tag: field no `+t+` wire type `+n);return[t,n]}skip(e){let n=this.pos;switch(e){case t.WireType.Varint:for(;this.buf[this.pos++]&128;);break;case t.WireType.Bit64:this.pos+=4;case t.WireType.Bit32:this.pos+=4;break;case t.WireType.LengthDelimited:let n=this.uint32();this.pos+=n;break;case t.WireType.StartGroup:let r;for(;(r=this.tag()[1])!==t.WireType.EndGroup;)this.skip(r);break;default:throw Error(`cant skip wire type `+e)}return this.assertBounds(),this.buf.subarray(n,this.pos)}assertBounds(){if(this.pos>this.len)throw RangeError(`premature EOF`)}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)}int64(){return new n.PbLong(...this.varint64())}uint64(){return new n.PbULong(...this.varint64())}sint64(){let[e,t]=this.varint64(),r=-(e&1);return e=(e>>>1|(t&1)<<31)^r,t=t>>>1^r,new n.PbLong(e,t)}bool(){let[e,t]=this.varint64();return e!==0||t!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return new n.PbULong(this.sfixed32(),this.sfixed32())}sfixed64(){return new n.PbLong(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),t=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(t,t+e)}string(){return this.textDecoder.decode(this.bytes())}};e.BinaryReader=BinaryReader})),U_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.assertFloat32=e.assertUInt32=e.assertInt32=e.assertNever=e.assert=void 0;function assert(e,t){if(!e)throw Error(t)}e.assert=assert;function assertNever(e,t){throw Error(t??`Unexpected object: `+e)}e.assertNever=assertNever;function assertInt32(e){if(typeof e!=`number`)throw Error(`invalid int 32: `+typeof e);if(!Number.isInteger(e)||e>2147483647||e<-2147483648)throw Error(`invalid int 32: `+e)}e.assertInt32=assertInt32;function assertUInt32(e){if(typeof e!=`number`)throw Error(`invalid uint 32: `+typeof e);if(!Number.isInteger(e)||e>4294967295||e<0)throw Error(`invalid uint 32: `+e)}e.assertUInt32=assertUInt32;function assertFloat32(e){if(typeof e!=`number`)throw Error(`invalid float 32: `+typeof e);if(Number.isFinite(e)&&(e>34028234663852886e22||e<-34028234663852886e22))throw Error(`invalid float 32: `+e)}e.assertFloat32=assertFloat32})),W_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BinaryWriter=e.binaryWriteOptions=void 0;let t=V_(),n=B_(),r=U_(),i={writeUnknownFields:!0,writerFactory:()=>new BinaryWriter};function binaryWriteOptions(e){return e?Object.assign(Object.assign({},i),e):i}e.binaryWriteOptions=binaryWriteOptions;var BinaryWriter=class{constructor(e){this.stack=[],this.textEncoder=e??new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let t=0;t>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(r.assertUInt32(e);e>127;)this.buf.push(e&127|128),e>>>=7;return this.buf.push(e),this}int32(e){return r.assertInt32(e),n.varint32write(e,this.buf),this}bool(e){return this.buf.push(+!!e),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let t=this.textEncoder.encode(e);return this.uint32(t.byteLength),this.raw(t)}float(e){r.assertFloat32(e);let t=/* @__PURE__ */ new Uint8Array(4);return new DataView(t.buffer).setFloat32(0,e,!0),this.raw(t)}double(e){let t=/* @__PURE__ */ new Uint8Array(8);return new DataView(t.buffer).setFloat64(0,e,!0),this.raw(t)}fixed32(e){r.assertUInt32(e);let t=/* @__PURE__ */ new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),this.raw(t)}sfixed32(e){r.assertInt32(e);let t=/* @__PURE__ */ new Uint8Array(4);return new DataView(t.buffer).setInt32(0,e,!0),this.raw(t)}sint32(e){return r.assertInt32(e),e=(e<<1^e>>31)>>>0,n.varint32write(e,this.buf),this}sfixed64(e){let n=/* @__PURE__ */ new Uint8Array(8),r=new DataView(n.buffer),i=t.PbLong.from(e);return r.setInt32(0,i.lo,!0),r.setInt32(4,i.hi,!0),this.raw(n)}fixed64(e){let n=/* @__PURE__ */ new Uint8Array(8),r=new DataView(n.buffer),i=t.PbULong.from(e);return r.setInt32(0,i.lo,!0),r.setInt32(4,i.hi,!0),this.raw(n)}int64(e){let r=t.PbLong.from(e);return n.varint64write(r.lo,r.hi,this.buf),this}sint64(e){let r=t.PbLong.from(e),i=r.hi>>31,a=r.lo<<1^i,o=(r.hi<<1|r.lo>>>31)^i;return n.varint64write(a,o,this.buf),this}uint64(e){let r=t.PbULong.from(e);return n.varint64write(r.lo,r.hi,this.buf),this}};e.BinaryWriter=BinaryWriter})),G_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.mergeJsonOptions=e.jsonWriteOptions=e.jsonReadOptions=void 0;let t={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0},n={ignoreUnknownFields:!1};function jsonReadOptions(e){return e?Object.assign(Object.assign({},n),e):n}e.jsonReadOptions=jsonReadOptions;function jsonWriteOptions(e){return e?Object.assign(Object.assign({},t),e):t}e.jsonWriteOptions=jsonWriteOptions;function mergeJsonOptions(e,t){let n=Object.assign(Object.assign({},e),t);return n.typeRegistry=[...e?.typeRegistry??[],...t?.typeRegistry??[]],n}e.mergeJsonOptions=mergeJsonOptions})),K_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MESSAGE_TYPE=void 0,e.MESSAGE_TYPE=Symbol.for(`protobuf-ts/message-type`)})),q_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.lowerCamelCase=void 0;function lowerCamelCase(e){let t=!1,n=[];for(let r=0;r{Object.defineProperty(e,"__esModule",{value:!0}),e.readMessageOption=e.readFieldOption=e.readFieldOptions=e.normalizeFieldInfo=e.RepeatType=e.LongType=e.ScalarType=void 0;let t=q_();(function(e){e[e.DOUBLE=1]=`DOUBLE`,e[e.FLOAT=2]=`FLOAT`,e[e.INT64=3]=`INT64`,e[e.UINT64=4]=`UINT64`,e[e.INT32=5]=`INT32`,e[e.FIXED64=6]=`FIXED64`,e[e.FIXED32=7]=`FIXED32`,e[e.BOOL=8]=`BOOL`,e[e.STRING=9]=`STRING`,e[e.BYTES=12]=`BYTES`,e[e.UINT32=13]=`UINT32`,e[e.SFIXED32=15]=`SFIXED32`,e[e.SFIXED64=16]=`SFIXED64`,e[e.SINT32=17]=`SINT32`,e[e.SINT64=18]=`SINT64`})(e.ScalarType||={}),(function(e){e[e.BIGINT=0]=`BIGINT`,e[e.STRING=1]=`STRING`,e[e.NUMBER=2]=`NUMBER`})(e.LongType||={});var n;(function(e){e[e.NO=0]=`NO`,e[e.PACKED=1]=`PACKED`,e[e.UNPACKED=2]=`UNPACKED`})(n=e.RepeatType||={});function normalizeFieldInfo(e){return e.localName=e.localName??t.lowerCamelCase(e.name),e.jsonName=e.jsonName??t.lowerCamelCase(e.name),e.repeat=e.repeat??n.NO,e.opt=e.opt??(!e.repeat&&!e.oneof&&e.kind==`message`),e}e.normalizeFieldInfo=normalizeFieldInfo;function readFieldOptions(e,t,n,r){let i=e.fields.find((e,n)=>e.localName==t||n==t)?.options;return i&&i[n]?r.fromJson(i[n]):void 0}e.readFieldOptions=readFieldOptions;function readFieldOption(e,t,n,r){let i=e.fields.find((e,n)=>e.localName==t||n==t)?.options;if(!i)return;let a=i[n];return a===void 0?a:r?r.fromJson(a):a}e.readFieldOption=readFieldOption;function readMessageOption(e,t,n){let r=e.options[t];return r===void 0?r:n?n.fromJson(r):r}e.readMessageOption=readMessageOption})),Y_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getSelectedOneofValue=e.clearOneofValue=e.setUnknownOneofValue=e.setOneofValue=e.getOneofValue=e.isOneofGroup=void 0;function isOneofGroup(e){if(typeof e!=`object`||!e||!e.hasOwnProperty(`oneofKind`))return!1;switch(typeof e.oneofKind){case`string`:return e[e.oneofKind]!==void 0&&Object.keys(e).length==2;case`undefined`:return Object.keys(e).length==1;default:return!1}}e.isOneofGroup=isOneofGroup;function getOneofValue(e,t){return e[t]}e.getOneofValue=getOneofValue;function setOneofValue(e,t,n){e.oneofKind!==void 0&&delete e[e.oneofKind],e.oneofKind=t,n!==void 0&&(e[t]=n)}e.setOneofValue=setOneofValue;function setUnknownOneofValue(e,t,n){e.oneofKind!==void 0&&delete e[e.oneofKind],e.oneofKind=t,n!==void 0&&t!==void 0&&(e[t]=n)}e.setUnknownOneofValue=setUnknownOneofValue;function clearOneofValue(e){e.oneofKind!==void 0&&delete e[e.oneofKind],e.oneofKind=void 0}e.clearOneofValue=clearOneofValue;function getSelectedOneofValue(e){if(e.oneofKind!==void 0)return e[e.oneofKind]}e.getSelectedOneofValue=getSelectedOneofValue})),X_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ReflectionTypeCheck=void 0;let t=J_(),n=Y_();e.ReflectionTypeCheck=class{constructor(e){this.fields=e.fields??[]}prepare(){if(this.data)return;let e=[],t=[],n=[];for(let r of this.fields)if(r.oneof)n.includes(r.oneof)||(n.push(r.oneof),e.push(r.oneof),t.push(r.oneof));else switch(t.push(r.localName),r.kind){case`scalar`:case`enum`:(!r.opt||r.repeat)&&e.push(r.localName);break;case`message`:r.repeat&&e.push(r.localName);break;case`map`:e.push(r.localName)}this.data={req:e,known:t,oneofs:Object.values(n)}}is(e,t,r=!1){if(t<0)return!0;if(typeof e!=`object`||!e)return!1;this.prepare();let i=Object.keys(e),a=this.data;if(i.length!i.includes(e))||!r&&i.some(e=>!a.known.includes(e)))return!1;if(t<1)return!0;for(let i of a.oneofs){let a=e[i];if(!n.isOneofGroup(a))return!1;if(a.oneofKind===void 0)continue;let o=this.fields.find(e=>e.localName===a.oneofKind);if(!o||!this.field(a[a.oneofKind],o,r,t))return!1}for(let n of this.fields)if(n.oneof===void 0&&!this.field(e[n.localName],n,r,t))return!1;return!0}field(e,n,r,i){let a=n.repeat;switch(n.kind){case`scalar`:return e===void 0?n.opt:a?this.scalars(e,n.T,i,n.L):this.scalar(e,n.T,n.L);case`enum`:return e===void 0?n.opt:a?this.scalars(e,t.ScalarType.INT32,i):this.scalar(e,t.ScalarType.INT32);case`message`:return e===void 0?!0:a?this.messages(e,n.T(),r,i):this.message(e,n.T(),r,i);case`map`:if(typeof e!=`object`||!e)return!1;if(i<2)return!0;if(!this.mapKeys(e,n.K,i))return!1;switch(n.V.kind){case`scalar`:return this.scalars(Object.values(e),n.V.T,i,n.V.L);case`enum`:return this.scalars(Object.values(e),t.ScalarType.INT32,i);case`message`:return this.messages(Object.values(e),n.V.T(),r,i)}}return!0}message(e,t,n,r){return n?t.isAssignable(e,r):t.is(e,r)}messages(e,t,n,r){if(!Array.isArray(e))return!1;if(r<2)return!0;if(n){for(let n=0;nparseInt(e)),n,r);case t.ScalarType.BOOL:return this.scalars(i.slice(0,r).map(e=>e==`true`||e!=`false`&&e),n,r);default:return this.scalars(i,n,r,t.LongType.STRING)}}}})),Z_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.reflectionLongConvert=void 0;let t=J_();function reflectionLongConvert(e,n){switch(n){case t.LongType.BIGINT:return e.toBigInt();case t.LongType.NUMBER:return e.toNumber();default:return e.toString()}}e.reflectionLongConvert=reflectionLongConvert})),Q_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ReflectionJsonReader=void 0;let t=I_(),n=L_(),r=J_(),i=V_(),a=U_(),o=Z_();e.ReflectionJsonReader=class{constructor(e){this.info=e}prepare(){if(this.fMap===void 0){this.fMap={};let e=this.info.fields??[];for(let t of e)this.fMap[t.name]=t,this.fMap[t.jsonName]=t,this.fMap[t.localName]=t}}assert(e,n,r){if(!e){let e=t.typeofJsonValue(r);throw(e==`number`||e==`boolean`)&&(e=r.toString()),Error(`Cannot parse JSON ${e} for ${this.info.typeName}#${n}`)}}read(e,n,i){this.prepare();let a=[];for(let[o,s]of Object.entries(e)){let e=this.fMap[o];if(!e){if(!i.ignoreUnknownFields)throw Error(`Found unknown field while reading ${this.info.typeName} from JSON format. JSON key: ${o}`);continue}let c=e.localName,l;if(e.oneof){if(s===null&&(e.kind!==`enum`||e.T()[0]!==`google.protobuf.NullValue`))continue;if(a.includes(e.oneof))throw Error(`Multiple members of the oneof group "${e.oneof}" of ${this.info.typeName} are present in JSON.`);a.push(e.oneof),l=n[e.oneof]={oneofKind:c}}else l=n;if(e.kind==`map`){if(s===null)continue;this.assert(t.isJsonObject(s),e.name,s);let n=l[c];for(let[t,a]of Object.entries(s)){this.assert(a!==null,e.name+` map value`,null);let o;switch(e.V.kind){case`message`:o=e.V.T().internalJsonRead(a,i);break;case`enum`:if(o=this.enum(e.V.T(),a,e.name,i.ignoreUnknownFields),o===!1)continue;break;case`scalar`:o=this.scalar(a,e.V.T,e.V.L,e.name)}this.assert(o!==void 0,e.name+` map value`,a);let s=t;e.K==r.ScalarType.BOOL&&(s=s==`true`||s!=`false`&&s),s=this.scalar(s,e.K,r.LongType.STRING,e.name).toString(),n[s]=o}}else if(e.repeat){if(s===null)continue;this.assert(Array.isArray(s),e.name,s);let t=l[c];for(let n of s){this.assert(n!==null,e.name,null);let r;switch(e.kind){case`message`:r=e.T().internalJsonRead(n,i);break;case`enum`:if(r=this.enum(e.T(),n,e.name,i.ignoreUnknownFields),r===!1)continue;break;case`scalar`:r=this.scalar(n,e.T,e.L,e.name)}this.assert(r!==void 0,e.name,s),t.push(r)}}else switch(e.kind){case`message`:if(s===null&&e.T().typeName!=`google.protobuf.Value`){this.assert(e.oneof===void 0,e.name+` (oneof member)`,null);continue}l[c]=e.T().internalJsonRead(s,i,l[c]);break;case`enum`:if(s===null)continue;let t=this.enum(e.T(),s,e.name,i.ignoreUnknownFields);if(t===!1)continue;l[c]=t;break;case`scalar`:if(s===null)continue;l[c]=this.scalar(s,e.T,e.L,e.name)}}}enum(e,t,n,r){if(e[0]==`google.protobuf.NullValue`&&a.assert(t===null||t===`NULL_VALUE`,`Unable to parse field ${this.info.typeName}#${n}, enum ${e[0]} only accepts null.`),t===null)return 0;switch(typeof t){case`number`:return a.assert(Number.isInteger(t),`Unable to parse field ${this.info.typeName}#${n}, enum can only be integral number, got ${t}.`),t;case`string`:let i=t;e[2]&&t.substring(0,e[2].length)===e[2]&&(i=t.substring(e[2].length));let o=e[1][i];return o===void 0&&r?!1:(a.assert(typeof o==`number`,`Unable to parse field ${this.info.typeName}#${n}, enum ${e[0]} has no value for "${t}".`),o)}a.assert(!1,`Unable to parse field ${this.info.typeName}#${n}, cannot parse enum value from ${typeof t}".`)}scalar(e,t,s,c){let l;try{switch(t){case r.ScalarType.DOUBLE:case r.ScalarType.FLOAT:if(e===null)return 0;if(e===`NaN`)return NaN;if(e===`Infinity`)return 1/0;if(e===`-Infinity`)return-1/0;if(e===``){l=`empty string`;break}if(typeof e==`string`&&e.trim().length!==e.length){l=`extra whitespace`;break}if(typeof e!=`string`&&typeof e!=`number`)break;let c=Number(e);if(Number.isNaN(c)){l=`not a number`;break}if(!Number.isFinite(c)){l=`too large or small`;break}return t==r.ScalarType.FLOAT&&a.assertFloat32(c),c;case r.ScalarType.INT32:case r.ScalarType.FIXED32:case r.ScalarType.SFIXED32:case r.ScalarType.SINT32:case r.ScalarType.UINT32:if(e===null)return 0;let u;if(typeof e==`number`?u=e:e===``?l=`empty string`:typeof e==`string`&&(e.trim().length===e.length?u=Number(e):l=`extra whitespace`),u===void 0)break;return t==r.ScalarType.UINT32?a.assertUInt32(u):a.assertInt32(u),u;case r.ScalarType.INT64:case r.ScalarType.SFIXED64:case r.ScalarType.SINT64:if(e===null)return o.reflectionLongConvert(i.PbLong.ZERO,s);if(typeof e!=`number`&&typeof e!=`string`)break;return o.reflectionLongConvert(i.PbLong.from(e),s);case r.ScalarType.FIXED64:case r.ScalarType.UINT64:if(e===null)return o.reflectionLongConvert(i.PbULong.ZERO,s);if(typeof e!=`number`&&typeof e!=`string`)break;return o.reflectionLongConvert(i.PbULong.from(e),s);case r.ScalarType.BOOL:if(e===null)return!1;if(typeof e!=`boolean`)break;return e;case r.ScalarType.STRING:if(e===null)return``;if(typeof e!=`string`){l=`extra whitespace`;break}return e;case r.ScalarType.BYTES:if(e===null||e===``)return/* @__PURE__ */ new Uint8Array;if(typeof e!=`string`)break;return n.base64decode(e)}}catch(e){l=e.message}this.assert(!1,c+(l?` - `+l:``),e)}}})),$_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ReflectionJsonWriter=void 0;let t=L_(),n=V_(),r=J_(),i=U_();e.ReflectionJsonWriter=class{constructor(e){this.fields=e.fields??[]}write(e,t){let n={},r=e;for(let e of this.fields){if(!e.oneof){let i=this.field(e,r[e.localName],t);i!==void 0&&(n[t.useProtoFieldName?e.name:e.jsonName]=i);continue}let a=r[e.oneof];if(a.oneofKind!==e.localName)continue;let o=e.kind==`scalar`||e.kind==`enum`?Object.assign(Object.assign({},t),{emitDefaultValues:!0}):t,s=this.field(e,a[e.localName],o);i.assert(s!==void 0),n[t.useProtoFieldName?e.name:e.jsonName]=s}return n}field(e,t,n){let r;if(e.kind==`map`){i.assert(typeof t==`object`&&!!t);let a={};switch(e.V.kind){case`scalar`:for(let[n,r]of Object.entries(t)){let t=this.scalar(e.V.T,r,e.name,!1,!0);i.assert(t!==void 0),a[n.toString()]=t}break;case`message`:let r=e.V.T();for(let[o,s]of Object.entries(t)){let t=this.message(r,s,e.name,n);i.assert(t!==void 0),a[o.toString()]=t}break;case`enum`:let o=e.V.T();for(let[r,s]of Object.entries(t)){i.assert(s===void 0||typeof s==`number`);let t=this.enum(o,s,e.name,!1,!0,n.enumAsInteger);i.assert(t!==void 0),a[r.toString()]=t}}(n.emitDefaultValues||Object.keys(a).length>0)&&(r=a)}else if(e.repeat){i.assert(Array.isArray(t));let a=[];switch(e.kind){case`scalar`:for(let n=0;n0||n.emitDefaultValues)&&(r=a)}else switch(e.kind){case`scalar`:r=this.scalar(e.T,t,e.name,e.opt,n.emitDefaultValues);break;case`enum`:r=this.enum(e.T(),t,e.name,e.opt,n.emitDefaultValues,n.enumAsInteger);break;case`message`:r=this.message(e.T(),t,e.name,n)}return r}enum(e,t,n,r,a,o){if(e[0]==`google.protobuf.NullValue`)return!a&&!r?void 0:null;if(t===void 0){i.assert(r);return}if(t!==0||a||r)return i.assert(typeof t==`number`),i.assert(Number.isInteger(t)),o||!e[1].hasOwnProperty(t)?t:e[2]?e[2]+e[1][t]:e[1][t]}message(e,t,n,r){return t===void 0?r.emitDefaultValues?null:void 0:e.internalJsonWrite(t,r)}scalar(e,a,o,s,c){if(a===void 0){i.assert(s);return}let l=c||s;switch(e){case r.ScalarType.INT32:case r.ScalarType.SFIXED32:case r.ScalarType.SINT32:return a===0?l?0:void 0:(i.assertInt32(a),a);case r.ScalarType.FIXED32:case r.ScalarType.UINT32:return a===0?l?0:void 0:(i.assertUInt32(a),a);case r.ScalarType.FLOAT:i.assertFloat32(a);case r.ScalarType.DOUBLE:return a===0?l?0:void 0:(i.assert(typeof a==`number`),Number.isNaN(a)?`NaN`:a===1/0?`Infinity`:a===-1/0?`-Infinity`:a);case r.ScalarType.STRING:return a===``?l?``:void 0:(i.assert(typeof a==`string`),a);case r.ScalarType.BOOL:return a===!1?!l&&void 0:(i.assert(typeof a==`boolean`),a);case r.ScalarType.UINT64:case r.ScalarType.FIXED64:i.assert(typeof a==`number`||typeof a==`string`||typeof a==`bigint`);let e=n.PbULong.from(a);return e.isZero()&&!l?void 0:e.toString();case r.ScalarType.INT64:case r.ScalarType.SFIXED64:case r.ScalarType.SINT64:i.assert(typeof a==`number`||typeof a==`string`||typeof a==`bigint`);let o=n.PbLong.from(a);return o.isZero()&&!l?void 0:o.toString();case r.ScalarType.BYTES:return i.assert(a instanceof Uint8Array),a.byteLength?t.base64encode(a):l?``:void 0}}}})),ev=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.reflectionScalarDefault=void 0;let t=J_(),n=Z_(),r=V_();function reflectionScalarDefault(e,i=t.LongType.STRING){switch(e){case t.ScalarType.BOOL:return!1;case t.ScalarType.UINT64:case t.ScalarType.FIXED64:return n.reflectionLongConvert(r.PbULong.ZERO,i);case t.ScalarType.INT64:case t.ScalarType.SFIXED64:case t.ScalarType.SINT64:return n.reflectionLongConvert(r.PbLong.ZERO,i);case t.ScalarType.DOUBLE:case t.ScalarType.FLOAT:return 0;case t.ScalarType.BYTES:return/* @__PURE__ */ new Uint8Array;case t.ScalarType.STRING:return``;default:return 0}}e.reflectionScalarDefault=reflectionScalarDefault})),tv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ReflectionBinaryReader=void 0;let t=z_(),n=J_(),r=Z_(),i=ev();e.ReflectionBinaryReader=class{constructor(e){this.info=e}prepare(){if(!this.fieldNoToField){let e=this.info.fields??[];this.fieldNoToField=new Map(e.map(e=>[e.no,e]))}}read(e,r,i,a){this.prepare();let o=a===void 0?e.len:e.pos+a;for(;e.pos{Object.defineProperty(e,"__esModule",{value:!0}),e.ReflectionBinaryWriter=void 0;let t=z_(),n=J_(),r=U_(),i=V_();e.ReflectionBinaryWriter=class{constructor(e){this.info=e}prepare(){if(!this.fields){let e=this.info.fields?this.info.fields.concat():[];this.fields=e.sort((e,t)=>e.no-t.no)}}write(e,i,a){this.prepare();for(let t of this.fields){let o,s,c=t.repeat,l=t.localName;if(t.oneof){let n=e[t.oneof];if(n.oneofKind!==l)continue;o=n[l],s=!0}else o=e[l],s=!1;switch(t.kind){case`scalar`:case`enum`:let e=t.kind==`enum`?n.ScalarType.INT32:t.T;if(c){if(r.assert(Array.isArray(o)),c==n.RepeatType.PACKED)this.packed(i,e,t.no,o);else for(let n of o)this.scalar(i,e,t.no,n,!0)}else o===void 0?r.assert(t.opt):this.scalar(i,e,t.no,o,s||t.opt);break;case`message`:if(c){r.assert(Array.isArray(o));for(let e of o)this.message(i,a,t.T(),t.no,e)}else this.message(i,a,t.T(),t.no,o);break;case`map`:r.assert(typeof o==`object`&&!!o);for(let[e,n]of Object.entries(o))this.mapEntry(i,a,t,e,n)}}let o=a.writeUnknownFields;o!==!1&&(o===!0?t.UnknownFieldHandler.onWrite:o)(this.info.typeName,e,i)}mapEntry(e,i,a,o,s){e.tag(a.no,t.WireType.LengthDelimited),e.fork();let c=o;switch(a.K){case n.ScalarType.INT32:case n.ScalarType.FIXED32:case n.ScalarType.UINT32:case n.ScalarType.SFIXED32:case n.ScalarType.SINT32:c=Number.parseInt(o);break;case n.ScalarType.BOOL:r.assert(o==`true`||o==`false`),c=o==`true`}switch(this.scalar(e,a.K,1,c,!0),a.V.kind){case`scalar`:this.scalar(e,a.V.T,2,s,!0);break;case`enum`:this.scalar(e,n.ScalarType.INT32,2,s,!0);break;case`message`:this.message(e,i,a.V.T(),2,s)}e.join()}message(e,n,r,i,a){a!==void 0&&(r.internalBinaryWrite(a,e.tag(i,t.WireType.LengthDelimited).fork(),n),e.join())}scalar(e,t,n,r,i){let[a,o,s]=this.scalarInfo(t,r);(!s||i)&&(e.tag(n,a),e[o](r))}packed(e,i,a,o){if(!o.length)return;r.assert(i!==n.ScalarType.BYTES&&i!==n.ScalarType.STRING),e.tag(a,t.WireType.LengthDelimited),e.fork();let[,s]=this.scalarInfo(i);for(let t=0;t{Object.defineProperty(e,"__esModule",{value:!0}),e.reflectionCreate=void 0;let t=ev(),n=K_();function reflectionCreate(e){let r=e.messagePrototype?Object.create(e.messagePrototype):Object.defineProperty({},n.MESSAGE_TYPE,{value:e});for(let n of e.fields){let e=n.localName;if(!n.opt){if(n.oneof)r[n.oneof]={oneofKind:void 0};else if(n.repeat)r[e]=[];else switch(n.kind){case`scalar`:r[e]=t.reflectionScalarDefault(n.T,n.L);break;case`enum`:r[e]=0;break;case`map`:r[e]={}}}}return r}e.reflectionCreate=reflectionCreate})),iv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.reflectionMergePartial=void 0;function reflectionMergePartial(e,t,n){let r,i=n,a;for(let n of e.fields){let e=n.localName;if(n.oneof){let o=i[n.oneof];if(o?.oneofKind==null)continue;if(r=o[e],a=t[n.oneof],a.oneofKind=o.oneofKind,r==null){delete a[e];continue}}else if(r=i[e],a=t,r==null)continue;switch(n.repeat&&(a[e].length=r.length),n.kind){case`scalar`:case`enum`:if(n.repeat)for(let t=0;t{Object.defineProperty(e,"__esModule",{value:!0}),e.reflectionEquals=void 0;let t=J_();function reflectionEquals(e,r,i){if(r===i)return!0;if(!r||!i)return!1;for(let a of e.fields){let e=a.localName,o=a.oneof?r[a.oneof][e]:r[e],s=a.oneof?i[a.oneof][e]:i[e];switch(a.kind){case`enum`:case`scalar`:let e=a.kind==`enum`?t.ScalarType.INT32:a.T;if(!(a.repeat?repeatedPrimitiveEq(e,o,s):primitiveEq(e,o,s)))return!1;break;case`map`:if(!(a.V.kind==`message`?repeatedMsgEq(a.V.T(),n(o),n(s)):repeatedPrimitiveEq(a.V.kind==`enum`?t.ScalarType.INT32:a.V.T,n(o),n(s))))return!1;break;case`message`:let r=a.T();if(!(a.repeat?repeatedMsgEq(r,o,s):r.equals(o,s)))return!1}}return!0}e.reflectionEquals=reflectionEquals;let n=Object.values;function primitiveEq(e,n,r){if(n===r)return!0;if(e!==t.ScalarType.BYTES)return!1;let i=n,a=r;if(i.length!==a.length)return!1;for(let e=0;e{Object.defineProperty(e,"__esModule",{value:!0}),e.MessageType=void 0;let t=K_(),n=J_(),r=X_(),i=Q_(),a=$_(),o=tv(),s=nv(),c=rv(),l=iv(),u=I_(),d=G_(),f=av(),p=W_(),m=H_(),h=Object.getOwnPropertyDescriptors(Object.getPrototypeOf({})),g=h[t.MESSAGE_TYPE]={};e.MessageType=class{constructor(e,t,c){this.defaultCheckDepth=16,this.typeName=e,this.fields=t.map(n.normalizeFieldInfo),this.options=c??{},g.value=this,this.messagePrototype=Object.create(null,h),this.refTypeCheck=new r.ReflectionTypeCheck(this),this.refJsonReader=new i.ReflectionJsonReader(this),this.refJsonWriter=new a.ReflectionJsonWriter(this),this.refBinReader=new o.ReflectionBinaryReader(this),this.refBinWriter=new s.ReflectionBinaryWriter(this)}create(e){let t=c.reflectionCreate(this);return e!==void 0&&l.reflectionMergePartial(this,t,e),t}clone(e){let t=this.create();return l.reflectionMergePartial(this,t,e),t}equals(e,t){return f.reflectionEquals(this,e,t)}is(e,t=this.defaultCheckDepth){return this.refTypeCheck.is(e,t,!1)}isAssignable(e,t=this.defaultCheckDepth){return this.refTypeCheck.is(e,t,!0)}mergePartial(e,t){l.reflectionMergePartial(this,e,t)}fromBinary(e,t){let n=m.binaryReadOptions(t);return this.internalBinaryRead(n.readerFactory(e),e.byteLength,n)}fromJson(e,t){return this.internalJsonRead(e,d.jsonReadOptions(t))}fromJsonString(e,t){let n=JSON.parse(e);return this.fromJson(n,t)}toJson(e,t){return this.internalJsonWrite(e,d.jsonWriteOptions(t))}toJsonString(e,t){let n=this.toJson(e,t);return JSON.stringify(n,null,t?.prettySpaces??0)}toBinary(e,t){let n=p.binaryWriteOptions(t);return this.internalBinaryWrite(e,n.writerFactory(),n).finish()}internalJsonRead(e,t,n){if(typeof e==`object`&&e&&!Array.isArray(e)){let r=n??this.create();return this.refJsonReader.read(e,r,t),r}throw Error(`Unable to parse message ${this.typeName} from JSON ${u.typeofJsonValue(e)}.`)}internalJsonWrite(e,t){return this.refJsonWriter.write(e,t)}internalBinaryWrite(e,t,n){return this.refBinWriter.write(e,t,n),t}internalBinaryRead(e,t,n,r){let i=r??this.create();return this.refBinReader.read(e,i,n,t),i}}})),sv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.containsMessageType=void 0;let t=K_();function containsMessageType(e){return e[t.MESSAGE_TYPE]!=null}e.containsMessageType=containsMessageType})),cv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.listEnumNumbers=e.listEnumNames=e.listEnumValues=e.isEnumObject=void 0;function isEnumObject(e){if(typeof e!=`object`||!e||!e.hasOwnProperty(0))return!1;for(let t of Object.keys(e)){let n=parseInt(t);if(Number.isNaN(n)){let n=e[t];if(n===void 0||typeof n!=`number`||e[n]===void 0)return!1}else{let t=e[n];if(t===void 0||e[t]!==n)return!1}}return!0}e.isEnumObject=isEnumObject;function listEnumValues(e){if(!isEnumObject(e))throw Error(`not a typescript enum object`);let t=[];for(let[n,r]of Object.entries(e))typeof r==`number`&&t.push({name:n,number:r});return t}e.listEnumValues=listEnumValues;function listEnumNames(e){return listEnumValues(e).map(e=>e.name)}e.listEnumNames=listEnumNames;function listEnumNumbers(e){return listEnumValues(e).map(e=>e.number).filter((e,t,n)=>n.indexOf(e)==t)}e.listEnumNumbers=listEnumNumbers})),lv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=I_();Object.defineProperty(e,"typeofJsonValue",{enumerable:!0,get:function(){return t.typeofJsonValue}}),Object.defineProperty(e,"isJsonObject",{enumerable:!0,get:function(){return t.isJsonObject}});var n=L_();Object.defineProperty(e,"base64decode",{enumerable:!0,get:function(){return n.base64decode}}),Object.defineProperty(e,"base64encode",{enumerable:!0,get:function(){return n.base64encode}});var r=R_();Object.defineProperty(e,"utf8read",{enumerable:!0,get:function(){return r.utf8read}});var i=z_();Object.defineProperty(e,"WireType",{enumerable:!0,get:function(){return i.WireType}}),Object.defineProperty(e,"mergeBinaryOptions",{enumerable:!0,get:function(){return i.mergeBinaryOptions}}),Object.defineProperty(e,"UnknownFieldHandler",{enumerable:!0,get:function(){return i.UnknownFieldHandler}});var a=H_();Object.defineProperty(e,"BinaryReader",{enumerable:!0,get:function(){return a.BinaryReader}}),Object.defineProperty(e,"binaryReadOptions",{enumerable:!0,get:function(){return a.binaryReadOptions}});var o=W_();Object.defineProperty(e,"BinaryWriter",{enumerable:!0,get:function(){return o.BinaryWriter}}),Object.defineProperty(e,"binaryWriteOptions",{enumerable:!0,get:function(){return o.binaryWriteOptions}});var s=V_();Object.defineProperty(e,"PbLong",{enumerable:!0,get:function(){return s.PbLong}}),Object.defineProperty(e,"PbULong",{enumerable:!0,get:function(){return s.PbULong}});var c=G_();Object.defineProperty(e,"jsonReadOptions",{enumerable:!0,get:function(){return c.jsonReadOptions}}),Object.defineProperty(e,"jsonWriteOptions",{enumerable:!0,get:function(){return c.jsonWriteOptions}}),Object.defineProperty(e,"mergeJsonOptions",{enumerable:!0,get:function(){return c.mergeJsonOptions}});var l=K_();Object.defineProperty(e,"MESSAGE_TYPE",{enumerable:!0,get:function(){return l.MESSAGE_TYPE}});var u=ov();Object.defineProperty(e,"MessageType",{enumerable:!0,get:function(){return u.MessageType}});var d=J_();Object.defineProperty(e,"ScalarType",{enumerable:!0,get:function(){return d.ScalarType}}),Object.defineProperty(e,"LongType",{enumerable:!0,get:function(){return d.LongType}}),Object.defineProperty(e,"RepeatType",{enumerable:!0,get:function(){return d.RepeatType}}),Object.defineProperty(e,"normalizeFieldInfo",{enumerable:!0,get:function(){return d.normalizeFieldInfo}}),Object.defineProperty(e,"readFieldOptions",{enumerable:!0,get:function(){return d.readFieldOptions}}),Object.defineProperty(e,"readFieldOption",{enumerable:!0,get:function(){return d.readFieldOption}}),Object.defineProperty(e,"readMessageOption",{enumerable:!0,get:function(){return d.readMessageOption}});var f=X_();Object.defineProperty(e,"ReflectionTypeCheck",{enumerable:!0,get:function(){return f.ReflectionTypeCheck}});var p=rv();Object.defineProperty(e,"reflectionCreate",{enumerable:!0,get:function(){return p.reflectionCreate}});var m=ev();Object.defineProperty(e,"reflectionScalarDefault",{enumerable:!0,get:function(){return m.reflectionScalarDefault}});var h=iv();Object.defineProperty(e,"reflectionMergePartial",{enumerable:!0,get:function(){return h.reflectionMergePartial}});var g=av();Object.defineProperty(e,"reflectionEquals",{enumerable:!0,get:function(){return g.reflectionEquals}});var v=tv();Object.defineProperty(e,"ReflectionBinaryReader",{enumerable:!0,get:function(){return v.ReflectionBinaryReader}});var y=nv();Object.defineProperty(e,"ReflectionBinaryWriter",{enumerable:!0,get:function(){return y.ReflectionBinaryWriter}});var b=Q_();Object.defineProperty(e,"ReflectionJsonReader",{enumerable:!0,get:function(){return b.ReflectionJsonReader}});var x=$_();Object.defineProperty(e,"ReflectionJsonWriter",{enumerable:!0,get:function(){return x.ReflectionJsonWriter}});var S=sv();Object.defineProperty(e,"containsMessageType",{enumerable:!0,get:function(){return S.containsMessageType}});var C=Y_();Object.defineProperty(e,"isOneofGroup",{enumerable:!0,get:function(){return C.isOneofGroup}}),Object.defineProperty(e,"setOneofValue",{enumerable:!0,get:function(){return C.setOneofValue}}),Object.defineProperty(e,"getOneofValue",{enumerable:!0,get:function(){return C.getOneofValue}}),Object.defineProperty(e,"clearOneofValue",{enumerable:!0,get:function(){return C.clearOneofValue}}),Object.defineProperty(e,"getSelectedOneofValue",{enumerable:!0,get:function(){return C.getSelectedOneofValue}});var w=cv();Object.defineProperty(e,"listEnumValues",{enumerable:!0,get:function(){return w.listEnumValues}}),Object.defineProperty(e,"listEnumNames",{enumerable:!0,get:function(){return w.listEnumNames}}),Object.defineProperty(e,"listEnumNumbers",{enumerable:!0,get:function(){return w.listEnumNumbers}}),Object.defineProperty(e,"isEnumObject",{enumerable:!0,get:function(){return w.isEnumObject}});var T=q_();Object.defineProperty(e,"lowerCamelCase",{enumerable:!0,get:function(){return T.lowerCamelCase}});var E=U_();Object.defineProperty(e,"assert",{enumerable:!0,get:function(){return E.assert}}),Object.defineProperty(e,"assertNever",{enumerable:!0,get:function(){return E.assertNever}}),Object.defineProperty(e,"assertInt32",{enumerable:!0,get:function(){return E.assertInt32}}),Object.defineProperty(e,"assertUInt32",{enumerable:!0,get:function(){return E.assertUInt32}}),Object.defineProperty(e,"assertFloat32",{enumerable:!0,get:function(){return E.assertFloat32}})})),uv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.readServiceOption=e.readMethodOption=e.readMethodOptions=e.normalizeMethodInfo=void 0;let t=lv();function normalizeMethodInfo(e,n){let r=e;return r.service=n,r.localName=r.localName??t.lowerCamelCase(r.name),r.serverStreaming=!!r.serverStreaming,r.clientStreaming=!!r.clientStreaming,r.options=r.options??{},r.idempotency=r.idempotency??void 0,r}e.normalizeMethodInfo=normalizeMethodInfo;function readMethodOptions(e,t,n,r){let i=e.methods.find((e,n)=>e.localName===t||n===t)?.options;return i&&i[n]?r.fromJson(i[n]):void 0}e.readMethodOptions=readMethodOptions;function readMethodOption(e,t,n,r){let i=e.methods.find((e,n)=>e.localName===t||n===t)?.options;if(!i)return;let a=i[n];return a===void 0?a:r?r.fromJson(a):a}e.readMethodOption=readMethodOption;function readServiceOption(e,t,n){let r=e.options;if(!r)return;let i=r[t];return i===void 0?i:n?n.fromJson(i):i}e.readServiceOption=readServiceOption})),dv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ServiceType=void 0;let t=uv();e.ServiceType=class{constructor(e,n,r){this.typeName=e,this.methods=n.map(e=>t.normalizeMethodInfo(e,this)),this.options=r??{}}}})),fv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.RpcError=void 0,e.RpcError=class extends Error{constructor(e,t=`UNKNOWN`,n){super(e),this.name=`RpcError`,Object.setPrototypeOf(this,new.target.prototype),this.code=t,this.meta=n??{}}toString(){let e=[this.name+`: `+this.message];this.code&&(e.push(``),e.push(`Code: `+this.code)),this.serviceName&&this.methodName&&e.push(`Method: `+this.serviceName+`/`+this.methodName);let t=Object.entries(this.meta);if(t.length){e.push(``),e.push(`Meta:`);for(let[n,r]of t)e.push(` ${n}: ${r}`)}return e.join(` `)}}})),pv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.mergeRpcOptions=void 0;let t=lv();function mergeRpcOptions(e,n){if(!n)return e;let r={};copy(e,r),copy(n,r);for(let i of Object.keys(n)){let a=n[i];switch(i){case`jsonOptions`:r.jsonOptions=t.mergeJsonOptions(e.jsonOptions,r.jsonOptions);break;case`binaryOptions`:r.binaryOptions=t.mergeBinaryOptions(e.binaryOptions,r.binaryOptions);break;case`meta`:r.meta={},copy(e.meta,r.meta),copy(n.meta,r.meta);break;case`interceptors`:r.interceptors=e.interceptors?e.interceptors.concat(a):a.concat()}}return r}e.mergeRpcOptions=mergeRpcOptions;function copy(e,t){if(!e)return;let n=t;for(let[t,r]of Object.entries(e))n[t]=r instanceof Date?new Date(r.getTime()):Array.isArray(r)?r.concat():r}})),mv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Deferred=e.DeferredState=void 0;var t;(function(e){e[e.PENDING=0]=`PENDING`,e[e.REJECTED=1]=`REJECTED`,e[e.RESOLVED=2]=`RESOLVED`})(t=e.DeferredState||={}),e.Deferred=class{constructor(e=!0){this._state=t.PENDING,this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t}),e&&this._promise.catch(e=>{})}get state(){return this._state}get promise(){return this._promise}resolve(e){if(this.state!==t.PENDING)throw Error(`cannot resolve ${t[this.state].toLowerCase()}`);this._resolve(e),this._state=t.RESOLVED}reject(e){if(this.state!==t.PENDING)throw Error(`cannot reject ${t[this.state].toLowerCase()}`);this._reject(e),this._state=t.REJECTED}resolvePending(e){this._state===t.PENDING&&this.resolve(e)}rejectPending(e){this._state===t.PENDING&&this.reject(e)}}})),hv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.RpcOutputStreamController=void 0;let t=mv(),n=lv();e.RpcOutputStreamController=class{constructor(){this._lis={nxt:[],msg:[],err:[],cmp:[]},this._closed=!1,this._itState={q:[]}}onNext(e){return this.addLis(e,this._lis.nxt)}onMessage(e){return this.addLis(e,this._lis.msg)}onError(e){return this.addLis(e,this._lis.err)}onComplete(e){return this.addLis(e,this._lis.cmp)}addLis(e,t){return t.push(e),()=>{let n=t.indexOf(e);n>=0&&t.splice(n,1)}}clearLis(){for(let e of Object.values(this._lis))e.splice(0,e.length)}get closed(){return this._closed!==!1}notifyNext(e,t,r){n.assert(+!!e+ +!!t+ +!!r<=1,`only one emission at a time`),e&&this.notifyMessage(e),t&&this.notifyError(t),r&&this.notifyComplete()}notifyMessage(e){n.assert(!this.closed,`stream is closed`),this.pushIt({value:e,done:!1}),this._lis.msg.forEach(t=>t(e)),this._lis.nxt.forEach(t=>t(e,void 0,!1))}notifyError(e){n.assert(!this.closed,`stream is closed`),this._closed=e,this.pushIt(e),this._lis.err.forEach(t=>t(e)),this._lis.nxt.forEach(t=>t(void 0,e,!1)),this.clearLis()}notifyComplete(){n.assert(!this.closed,`stream is closed`),this._closed=!0,this.pushIt({value:null,done:!0}),this._lis.cmp.forEach(e=>e()),this._lis.nxt.forEach(e=>e(void 0,void 0,!0)),this.clearLis()}[Symbol.asyncIterator](){return this._closed===!0?this.pushIt({value:null,done:!0}):this._closed!==!1&&this.pushIt(this._closed),{next:()=>{let e=this._itState;n.assert(e,`bad state`),n.assert(!e.p,`iterator contract broken`);let r=e.q.shift();return r?`value`in r?Promise.resolve(r):Promise.reject(r):(e.p=new t.Deferred,e.p.promise)}}}pushIt(e){let r=this._itState;if(r.p){let i=r.p;n.assert(i.state==t.DeferredState.PENDING,`iterator contract broken`),`value`in e?i.resolve(e):i.reject(e),delete r.p}else r.q.push(e)}}})),gv=/* @__PURE__ */ __commonJSMin((e=>{var t=e&&e.__awaiter||function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.UnaryCall=void 0,e.UnaryCall=class{constructor(e,t,n,r,i,a,o){this.method=e,this.requestHeaders=t,this.request=n,this.headers=r,this.response=i,this.status=a,this.trailers=o}then(e,t){return this.promiseFinished().then(t=>e?Promise.resolve(e(t)):t,e=>t?Promise.resolve(t(e)):Promise.reject(e))}promiseFinished(){return t(this,void 0,void 0,function*(){let[e,t,n,r]=yield Promise.all([this.headers,this.response,this.status,this.trailers]);return{method:this.method,requestHeaders:this.requestHeaders,request:this.request,headers:e,response:t,status:n,trailers:r}})}}})),_v=/* @__PURE__ */ __commonJSMin((e=>{var t=e&&e.__awaiter||function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.ServerStreamingCall=void 0,e.ServerStreamingCall=class{constructor(e,t,n,r,i,a,o){this.method=e,this.requestHeaders=t,this.request=n,this.headers=r,this.responses=i,this.status=a,this.trailers=o}then(e,t){return this.promiseFinished().then(t=>e?Promise.resolve(e(t)):t,e=>t?Promise.resolve(t(e)):Promise.reject(e))}promiseFinished(){return t(this,void 0,void 0,function*(){let[e,t,n]=yield Promise.all([this.headers,this.status,this.trailers]);return{method:this.method,requestHeaders:this.requestHeaders,request:this.request,headers:e,status:t,trailers:n}})}}})),vv=/* @__PURE__ */ __commonJSMin((e=>{var t=e&&e.__awaiter||function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.ClientStreamingCall=void 0,e.ClientStreamingCall=class{constructor(e,t,n,r,i,a,o){this.method=e,this.requestHeaders=t,this.requests=n,this.headers=r,this.response=i,this.status=a,this.trailers=o}then(e,t){return this.promiseFinished().then(t=>e?Promise.resolve(e(t)):t,e=>t?Promise.resolve(t(e)):Promise.reject(e))}promiseFinished(){return t(this,void 0,void 0,function*(){let[e,t,n,r]=yield Promise.all([this.headers,this.response,this.status,this.trailers]);return{method:this.method,requestHeaders:this.requestHeaders,headers:e,response:t,status:n,trailers:r}})}}})),yv=/* @__PURE__ */ __commonJSMin((e=>{var t=e&&e.__awaiter||function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.DuplexStreamingCall=void 0,e.DuplexStreamingCall=class{constructor(e,t,n,r,i,a,o){this.method=e,this.requestHeaders=t,this.requests=n,this.headers=r,this.responses=i,this.status=a,this.trailers=o}then(e,t){return this.promiseFinished().then(t=>e?Promise.resolve(e(t)):t,e=>t?Promise.resolve(t(e)):Promise.reject(e))}promiseFinished(){return t(this,void 0,void 0,function*(){let[e,t,n]=yield Promise.all([this.headers,this.status,this.trailers]);return{method:this.method,requestHeaders:this.requestHeaders,headers:e,status:t,trailers:n}})}}})),bv=/* @__PURE__ */ __commonJSMin((e=>{var t=e&&e.__awaiter||function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.TestTransport=void 0;let n=fv(),r=lv(),i=hv(),a=pv(),o=gv(),s=_v(),c=vv(),l=yv();var u=class TestTransport{constructor(e){this.suppressUncaughtRejections=!0,this.headerDelay=10,this.responseDelay=50,this.betweenResponseDelay=10,this.afterResponseDelay=10,this.data=e??{}}get sentMessages(){return this.lastInput instanceof TestInputStream?this.lastInput.sent:typeof this.lastInput==`object`?[this.lastInput.single]:[]}get sendComplete(){return this.lastInput instanceof TestInputStream?this.lastInput.completed:typeof this.lastInput==`object`}promiseHeaders(){let e=this.data.headers??TestTransport.defaultHeaders;return e instanceof n.RpcError?Promise.reject(e):Promise.resolve(e)}promiseSingleResponse(e){if(this.data.response instanceof n.RpcError)return Promise.reject(this.data.response);let t;return Array.isArray(this.data.response)?(r.assert(this.data.response.length>0),t=this.data.response[0]):t=this.data.response===void 0?e.O.create():this.data.response,r.assert(e.O.is(t)),Promise.resolve(t)}streamResponses(e,i,a){return t(this,void 0,void 0,function*(){let t=[];if(this.data.response===void 0)t.push(e.O.create());else if(Array.isArray(this.data.response))for(let n of this.data.response)r.assert(e.O.is(n)),t.push(n);else this.data.response instanceof n.RpcError||(r.assert(e.O.is(this.data.response)),t.push(this.data.response));try{yield delay(this.responseDelay,a)(void 0)}catch(e){i.notifyError(e);return}if(this.data.response instanceof n.RpcError){i.notifyError(this.data.response);return}for(let e of t){i.notifyMessage(e);try{yield delay(this.betweenResponseDelay,a)(void 0)}catch(e){i.notifyError(e);return}}if(this.data.status instanceof n.RpcError){i.notifyError(this.data.status);return}if(this.data.trailers instanceof n.RpcError){i.notifyError(this.data.trailers);return}i.notifyComplete()})}promiseStatus(){let e=this.data.status??TestTransport.defaultStatus;return e instanceof n.RpcError?Promise.reject(e):Promise.resolve(e)}promiseTrailers(){let e=this.data.trailers??TestTransport.defaultTrailers;return e instanceof n.RpcError?Promise.reject(e):Promise.resolve(e)}maybeSuppressUncaught(...e){if(this.suppressUncaughtRejections)for(let t of e)t.catch(()=>{})}mergeOptions(e){return a.mergeRpcOptions({},e)}unary(e,t,n){let r=n.meta??{},i=this.promiseHeaders().then(delay(this.headerDelay,n.abort)),a=i.catch(e=>{}).then(delay(this.responseDelay,n.abort)).then(t=>this.promiseSingleResponse(e)),s=a.catch(e=>{}).then(delay(this.afterResponseDelay,n.abort)).then(e=>this.promiseStatus()),c=a.catch(e=>{}).then(delay(this.afterResponseDelay,n.abort)).then(e=>this.promiseTrailers());return this.maybeSuppressUncaught(s,c),this.lastInput={single:t},new o.UnaryCall(e,r,t,i,a,s,c)}serverStreaming(e,t,n){let r=n.meta??{},a=this.promiseHeaders().then(delay(this.headerDelay,n.abort)),o=new i.RpcOutputStreamController,c=a.then(delay(this.responseDelay,n.abort)).catch(()=>{}).then(()=>this.streamResponses(e,o,n.abort)).then(delay(this.afterResponseDelay,n.abort)),l=c.then(()=>this.promiseStatus()),u=c.then(()=>this.promiseTrailers());return this.maybeSuppressUncaught(l,u),this.lastInput={single:t},new s.ServerStreamingCall(e,r,t,a,o,l,u)}clientStreaming(e,t){let n=t.meta??{},r=this.promiseHeaders().then(delay(this.headerDelay,t.abort)),i=r.catch(e=>{}).then(delay(this.responseDelay,t.abort)).then(t=>this.promiseSingleResponse(e)),a=i.catch(e=>{}).then(delay(this.afterResponseDelay,t.abort)).then(e=>this.promiseStatus()),o=i.catch(e=>{}).then(delay(this.afterResponseDelay,t.abort)).then(e=>this.promiseTrailers());return this.maybeSuppressUncaught(a,o),this.lastInput=new TestInputStream(this.data,t.abort),new c.ClientStreamingCall(e,n,this.lastInput,r,i,a,o)}duplex(e,t){let n=t.meta??{},r=this.promiseHeaders().then(delay(this.headerDelay,t.abort)),a=new i.RpcOutputStreamController,o=r.then(delay(this.responseDelay,t.abort)).catch(()=>{}).then(()=>this.streamResponses(e,a,t.abort)).then(delay(this.afterResponseDelay,t.abort)),s=o.then(()=>this.promiseStatus()),c=o.then(()=>this.promiseTrailers());return this.maybeSuppressUncaught(s,c),this.lastInput=new TestInputStream(this.data,t.abort),new l.DuplexStreamingCall(e,n,this.lastInput,r,a,s,c)}};e.TestTransport=u,u.defaultHeaders={responseHeader:`test`},u.defaultStatus={code:`OK`,detail:`all good`},u.defaultTrailers={responseTrailer:`test`};function delay(e,t){return r=>new Promise((i,a)=>{if(t?.aborted)a(new n.RpcError(`user cancel`,`CANCELLED`));else{let o=setTimeout(()=>i(r),e);t&&t.addEventListener(`abort`,e=>{clearTimeout(o),a(new n.RpcError(`user cancel`,`CANCELLED`))})}})}var TestInputStream=class{constructor(e,t){this._completed=!1,this._sent=[],this.data=e,this.abort=t}get sent(){return this._sent}get completed(){return this._completed}send(e){if(this.data.inputMessage instanceof n.RpcError)return Promise.reject(this.data.inputMessage);let t=this.data.inputMessage===void 0?10:this.data.inputMessage;return Promise.resolve(void 0).then(()=>{this._sent.push(e)}).then(delay(t,this.abort))}complete(){if(this.data.inputComplete instanceof n.RpcError)return Promise.reject(this.data.inputComplete);let e=this.data.inputComplete===void 0?10:this.data.inputComplete;return Promise.resolve(void 0).then(()=>{this._completed=!0}).then(delay(e,this.abort))}}})),xv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.stackDuplexStreamingInterceptors=e.stackClientStreamingInterceptors=e.stackServerStreamingInterceptors=e.stackUnaryInterceptors=e.stackIntercept=void 0;let t=lv();function stackIntercept(e,n,r,i,a){if(e==`unary`){let tail=(e,t,r)=>n.unary(e,t,r);for(let e of(i.interceptors??[]).filter(e=>e.interceptUnary).reverse()){let t=tail;tail=(n,r,i)=>e.interceptUnary(t,n,r,i)}return tail(r,a,i)}if(e==`serverStreaming`){let tail=(e,t,r)=>n.serverStreaming(e,t,r);for(let e of(i.interceptors??[]).filter(e=>e.interceptServerStreaming).reverse()){let t=tail;tail=(n,r,i)=>e.interceptServerStreaming(t,n,r,i)}return tail(r,a,i)}if(e==`clientStreaming`){let tail=(e,t)=>n.clientStreaming(e,t);for(let e of(i.interceptors??[]).filter(e=>e.interceptClientStreaming).reverse()){let t=tail;tail=(n,r)=>e.interceptClientStreaming(t,n,r)}return tail(r,i)}if(e==`duplex`){let tail=(e,t)=>n.duplex(e,t);for(let e of(i.interceptors??[]).filter(e=>e.interceptDuplex).reverse()){let t=tail;tail=(n,r)=>e.interceptDuplex(t,n,r)}return tail(r,i)}t.assertNever(e)}e.stackIntercept=stackIntercept;function stackUnaryInterceptors(e,t,n,r){return stackIntercept(`unary`,e,t,r,n)}e.stackUnaryInterceptors=stackUnaryInterceptors;function stackServerStreamingInterceptors(e,t,n,r){return stackIntercept(`serverStreaming`,e,t,r,n)}e.stackServerStreamingInterceptors=stackServerStreamingInterceptors;function stackClientStreamingInterceptors(e,t,n){return stackIntercept(`clientStreaming`,e,t,n)}e.stackClientStreamingInterceptors=stackClientStreamingInterceptors;function stackDuplexStreamingInterceptors(e,t,n){return stackIntercept(`duplex`,e,t,n)}e.stackDuplexStreamingInterceptors=stackDuplexStreamingInterceptors})),Sv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ServerCallContextController=void 0,e.ServerCallContextController=class{constructor(e,t,n,r,i={code:`OK`,detail:``}){this._cancelled=!1,this._listeners=[],this.method=e,this.headers=t,this.deadline=n,this.trailers={},this._sendRH=r,this.status=i}notifyCancelled(){if(!this._cancelled){this._cancelled=!0;for(let e of this._listeners)e()}}sendResponseHeaders(e){this._sendRH(e)}get cancelled(){return this._cancelled}onCancel(e){let t=this._listeners;return t.push(e),()=>{let n=t.indexOf(e);n>=0&&t.splice(n,1)}}}})),Cv=(/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=dv();Object.defineProperty(e,"ServiceType",{enumerable:!0,get:function(){return t.ServiceType}});var n=uv();Object.defineProperty(e,"readMethodOptions",{enumerable:!0,get:function(){return n.readMethodOptions}}),Object.defineProperty(e,"readMethodOption",{enumerable:!0,get:function(){return n.readMethodOption}}),Object.defineProperty(e,"readServiceOption",{enumerable:!0,get:function(){return n.readServiceOption}});var r=fv();Object.defineProperty(e,"RpcError",{enumerable:!0,get:function(){return r.RpcError}});var i=pv();Object.defineProperty(e,"mergeRpcOptions",{enumerable:!0,get:function(){return i.mergeRpcOptions}});var a=hv();Object.defineProperty(e,"RpcOutputStreamController",{enumerable:!0,get:function(){return a.RpcOutputStreamController}});var o=bv();Object.defineProperty(e,"TestTransport",{enumerable:!0,get:function(){return o.TestTransport}});var s=mv();Object.defineProperty(e,"Deferred",{enumerable:!0,get:function(){return s.Deferred}}),Object.defineProperty(e,"DeferredState",{enumerable:!0,get:function(){return s.DeferredState}});var c=yv();Object.defineProperty(e,"DuplexStreamingCall",{enumerable:!0,get:function(){return c.DuplexStreamingCall}});var l=vv();Object.defineProperty(e,"ClientStreamingCall",{enumerable:!0,get:function(){return l.ClientStreamingCall}});var u=_v();Object.defineProperty(e,"ServerStreamingCall",{enumerable:!0,get:function(){return u.ServerStreamingCall}});var d=gv();Object.defineProperty(e,"UnaryCall",{enumerable:!0,get:function(){return d.UnaryCall}});var f=xv();Object.defineProperty(e,"stackIntercept",{enumerable:!0,get:function(){return f.stackIntercept}}),Object.defineProperty(e,"stackDuplexStreamingInterceptors",{enumerable:!0,get:function(){return f.stackDuplexStreamingInterceptors}}),Object.defineProperty(e,"stackClientStreamingInterceptors",{enumerable:!0,get:function(){return f.stackClientStreamingInterceptors}}),Object.defineProperty(e,"stackServerStreamingInterceptors",{enumerable:!0,get:function(){return f.stackServerStreamingInterceptors}}),Object.defineProperty(e,"stackUnaryInterceptors",{enumerable:!0,get:function(){return f.stackUnaryInterceptors}});var p=Sv();Object.defineProperty(e,"ServerCallContextController",{enumerable:!0,get:function(){return p.ServerCallContextController}})})))(),$=lv();const wv=new class extends $.MessageType{constructor(){super(`github.actions.results.entities.v1.CacheScope`,[{no:1,name:`scope`,kind:`scalar`,T:9},{no:2,name:`permission`,kind:`scalar`,T:3}])}create(e){let t={scope:``,permission:`0`};return globalThis.Object.defineProperty(t,$.MESSAGE_TYPE,{enumerable:!1,value:this}),e!==void 0&&(0,$.reflectionMergePartial)(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),a=e.pos+t;for(;e.poswv}])}create(e){let t={repositoryId:`0`,scope:[]};return globalThis.Object.defineProperty(t,$.MESSAGE_TYPE,{enumerable:!1,value:this}),e!==void 0&&(0,$.reflectionMergePartial)(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),a=e.pos+t;for(;e.posTv},{no:2,name:`key`,kind:`scalar`,T:9},{no:3,name:`version`,kind:`scalar`,T:9}])}create(e){let t={key:``,version:``};return globalThis.Object.defineProperty(t,$.MESSAGE_TYPE,{enumerable:!1,value:this}),e!==void 0&&(0,$.reflectionMergePartial)(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),a=e.pos+t;for(;e.posTv},{no:2,name:`key`,kind:`scalar`,T:9},{no:3,name:`size_bytes`,kind:`scalar`,T:3},{no:4,name:`version`,kind:`scalar`,T:9}])}create(e){let t={key:``,sizeBytes:`0`,version:``};return globalThis.Object.defineProperty(t,$.MESSAGE_TYPE,{enumerable:!1,value:this}),e!==void 0&&(0,$.reflectionMergePartial)(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),a=e.pos+t;for(;e.posTv},{no:2,name:`key`,kind:`scalar`,T:9},{no:3,name:`restore_keys`,kind:`scalar`,repeat:2,T:9},{no:4,name:`version`,kind:`scalar`,T:9}])}create(e){let t={key:``,restoreKeys:[],version:``};return globalThis.Object.defineProperty(t,$.MESSAGE_TYPE,{enumerable:!1,value:this}),e!==void 0&&(0,$.reflectionMergePartial)(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),a=e.pos+t;for(;e.posDv.fromJson(e,{ignoreUnknownFields:!0}))}FinalizeCacheEntryUpload(e){let t=Ov.toJson(e,{useProtoFieldName:!0,emitDefaultValues:!1});return this.rpc.request(`github.actions.results.api.v1.CacheService`,`FinalizeCacheEntryUpload`,`application/json`,t).then(e=>kv.fromJson(e,{ignoreUnknownFields:!0}))}GetCacheEntryDownloadURL(e){let t=Av.toJson(e,{useProtoFieldName:!0,emitDefaultValues:!1});return this.rpc.request(`github.actions.results.api.v1.CacheService`,`GetCacheEntryDownloadURL`,`application/json`,t).then(e=>jv.fromJson(e,{ignoreUnknownFields:!0}))}};function maskSigUrl(e){if(e)try{let t=new URL(e).searchParams.get(`sig`);t&&(setSecret(t),setSecret(encodeURIComponent(t)))}catch(t){debug(`Failed to parse URL: ${e} ${t instanceof Error?t.message:String(t)}`)}}function maskSecretUrls(e){if(typeof e!=`object`||!e){debug(`body is not an object or is null`);return}`signed_upload_url`in e&&typeof e.signed_upload_url==`string`&&maskSigUrl(e.signed_upload_url),`signed_download_url`in e&&typeof e.signed_download_url==`string`&&maskSigUrl(e.signed_download_url)}var __awaiter$2=function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})},CacheServiceClient=class{constructor(e,t,n,r){this.maxAttempts=5,this.baseRetryIntervalMilliseconds=3e3,this.retryMultiplier=1.5;let i=getRuntimeToken();this.baseUrl=getCacheServiceURL(),t&&(this.maxAttempts=t),n&&(this.baseRetryIntervalMilliseconds=n),r&&(this.retryMultiplier=r),this.httpClient=new HttpClient(e,[new BearerCredentialHandler(i)])}request(e,t,n,r){return __awaiter$2(this,void 0,void 0,function*(){let i=new URL(`/twirp/${e}/${t}`,this.baseUrl).href;debug(`[Request] ${t} ${i}`);let a={"Content-Type":n};try{let{body:e}=yield this.retryableRequest(()=>__awaiter$2(this,void 0,void 0,function*(){return this.httpClient.post(i,JSON.stringify(r),a)}));return e}catch(e){throw Error(`Failed to ${t}: ${e.message}`)}})}retryableRequest(e){return __awaiter$2(this,void 0,void 0,function*(){let t=0,n=``,r=``;for(;t0&&warning(`You've hit a rate limit, your rate limit will reset in ${t} seconds`)}throw new RateLimitError(`Rate limited: ${n}`)}}catch(e){if(e instanceof SyntaxError&&debug(`Raw Body: ${r}`),e instanceof UsageError||e instanceof RateLimitError)throw e;if(NetworkError.isNetworkErrorCode(e?.code))throw new NetworkError(e?.code);i=!0,n=e.message}if(!i)throw Error(`Received non-retryable error: ${n}`);if(t+1===this.maxAttempts)throw Error(`Failed to make request after ${this.maxAttempts} attempts: ${n}`);let a=this.getExponentialRetryTimeMilliseconds(t);info(`Attempt ${t+1} of ${this.maxAttempts} failed with error: ${n}. Retrying request in ${a} ms...`),yield this.sleep(a),t++}throw Error(`Request failed`)})}isSuccessStatusCode(e){return e?e>=200&&e<300:!1}isRetryableHttpStatusCode(e){return e?[On.BadGateway,On.GatewayTimeout,On.InternalServerError,On.ServiceUnavailable].includes(e):!1}sleep(e){return __awaiter$2(this,void 0,void 0,function*(){return new Promise(t=>setTimeout(t,e))})}getExponentialRetryTimeMilliseconds(e){if(e<0)throw Error(`attempt should be a positive integer`);if(e===0)return this.baseRetryIntervalMilliseconds;let t=this.baseRetryIntervalMilliseconds*this.retryMultiplier**+e,n=t*this.retryMultiplier;return Math.trunc(Math.random()*(n-t)+t)}};function internalCacheTwirpClient(e){return new CacheServiceClientJSON(new CacheServiceClient(getUserAgentString(),e?.maxAttempts,e?.retryIntervalMs,e?.retryMultiplier))}var __awaiter$1=function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})};const Mv=process.platform===`win32`;function getTarPath(){return __awaiter$1(this,void 0,void 0,function*(){switch(process.platform){case`win32`:{let e=yield getGnuTarPathOnWindows(),t=ps;if(e)return{path:e,type:ls.GNU};if(s(t))return{path:t,type:ls.BSD};break}case`darwin`:{let e=yield which(`gtar`,!1);return e?{path:e,type:ls.GNU}:{path:yield which(`tar`,!0),type:ls.BSD}}}return{path:yield which(`tar`,!0),type:ls.GNU}})}function getTarArgs(e,t,n){return __awaiter$1(this,arguments,void 0,function*(e,t,n,r=``){let i=[`"${e.path}"`],a=getCacheFileName(t),o=`cache.tar`,s=getWorkingDirectory(),c=e.type===ls.BSD&&t!==cs.Gzip&&Mv;switch(n){case`create`:i.push(`--posix`,`-cf`,c?o:a.replace(RegExp(`\\${u.sep}`,`g`),`/`),`--exclude`,c?o:a.replace(RegExp(`\\${u.sep}`,`g`),`/`),`-P`,`-C`,s.replace(RegExp(`\\${u.sep}`,`g`),`/`),`--files-from`,hs);break;case`extract`:i.push(`-xf`,c?o:r.replace(RegExp(`\\${u.sep}`,`g`),`/`),`-P`,`-C`,c?quoteAbsolutePath(s):s.replace(RegExp(`\\${u.sep}`,`g`),`/`));break;case`list`:i.push(`-tf`,c?o:r.replace(RegExp(`\\${u.sep}`,`g`),`/`),`-P`)}if(e.type===ls.GNU)switch(process.platform){case`win32`:i.push(`--force-local`);break;case`darwin`:i.push(`--delay-directory-restore`)}return i})}function getCommands(e,t){return __awaiter$1(this,arguments,void 0,function*(e,t,n=``){let r,i=yield getTarPath(),a=yield getTarArgs(i,e,t,n),o=t===`create`?yield getCompressionProgram(i,e):yield getDecompressionProgram(i,e,n),s=i.type===ls.BSD&&e!==cs.Gzip&&Mv;return r=s&&t!==`create`?[[...o].join(` `),[...a].join(` `)]:[[...a].join(` `),[...o].join(` `)],{commands:s?r:[r.join(` `)],requiresTempDirectory:s&&t!==`create`}})}function getWorkingDirectory(){return process.env.GITHUB_WORKSPACE??process.cwd()}function quoteAbsolutePath(e){return`"${u.resolve(e).replace(RegExp(`\\${u.sep}`,`g`),`/`)}"`}function getDecompressionProgram(e,t,n){return __awaiter$1(this,void 0,void 0,function*(){let r=e.type===ls.BSD&&t!==cs.Gzip&&Mv;switch(t){case cs.Zstd:return r?[`zstd -d --long=30 --force -o`,ms,quoteAbsolutePath(n)]:[`--use-compress-program`,Mv?`"zstd -d --long=30"`:`unzstd --long=30`];case cs.ZstdWithoutLong:return r?[`zstd -d --force -o`,ms,quoteAbsolutePath(n)]:[`--use-compress-program`,Mv?`"zstd -d"`:`unzstd`];default:return[`-z`]}})}function getCompressionProgram(e,t){return __awaiter$1(this,void 0,void 0,function*(){let n=getCacheFileName(t),r=e.type===ls.BSD&&t!==cs.Gzip&&Mv;switch(t){case cs.Zstd:return r?[`zstd -T0 --long=30 --force -o`,n.replace(RegExp(`\\${u.sep}`,`g`),`/`),ms]:[`--use-compress-program`,Mv?`"zstd -T0 --long=30"`:`zstdmt --long=30`];case cs.ZstdWithoutLong:return r?[`zstd -T0 --force -o`,n.replace(RegExp(`\\${u.sep}`,`g`),`/`),ms]:[`--use-compress-program`,Mv?`"zstd -T0"`:`zstdmt`];default:return[`-z`]}})}function execCommands(e,t){return __awaiter$1(this,void 0,void 0,function*(){for(let n of e)try{yield exec(n,void 0,{cwd:t,env:Object.assign(Object.assign({},process.env),{MSYS:`winsymlinks:nativestrict`})})}catch(e){throw Error(`${n.split(` `)[0]} failed with error: ${e?.message}`)}})}function execReadCommands(e,t,n){return __awaiter$1(this,void 0,void 0,function*(){let{commands:r,requiresTempDirectory:i}=yield getCommands(t,n,e),a=i?yield createTempDirectory():void 0;try{yield execCommands(r,a)}finally{if(a)try{yield rmRF(a)}catch(e){debug(`Failed to delete temporary tar directory: ${e}`)}}})}function listTar(e,t){return __awaiter$1(this,void 0,void 0,function*(){yield execReadCommands(e,t,`list`)})}function extractTar(e,t){return __awaiter$1(this,void 0,void 0,function*(){yield mkdirP(getWorkingDirectory()),yield execReadCommands(e,t,`extract`)})}function createTar(e,t,n){return __awaiter$1(this,void 0,void 0,function*(){l(u.join(e,hs),t.join(` -`));let{commands:r}=yield getCommands(n,`create`);yield execCommands(r,e)})}var __awaiter=function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})},Nv=class ValidationError extends Error{constructor(e){super(e),this.name=`ValidationError`,Object.setPrototypeOf(this,ValidationError.prototype)}},Pv=class ReserveCacheError extends Error{constructor(e){super(e),this.name=`ReserveCacheError`,Object.setPrototypeOf(this,ReserveCacheError.prototype)}},Fv=class CacheWriteDeniedError extends Pv{constructor(e){super(e),this.name=`CacheWriteDeniedError`,Object.setPrototypeOf(this,CacheWriteDeniedError.prototype)}};const Iv=`cache read denied:`;var Lv=class CacheReadDeniedError extends Error{constructor(e){super(e),this.name=`CacheReadDeniedError`,Object.setPrototypeOf(this,CacheReadDeniedError.prototype)}},Rv=class FinalizeCacheError extends Error{constructor(e){super(e),this.name=`FinalizeCacheError`,Object.setPrototypeOf(this,FinalizeCacheError.prototype)}};function checkPaths(e){if(!e||e.length===0)throw new Nv(`Path Validation Error: At least one directory or file path is required`)}function checkKey(e){if(e.length>512)throw new Nv(`Key Validation Error: ${e} cannot be larger than 512 characters.`);if(!/^[^,]*$/.test(e))throw new Nv(`Key Validation Error: ${e} cannot contain commas.`)}function restoreCache$1(e,t,n,r){return __awaiter(this,arguments,void 0,function*(e,t,n,r,i=!1){let a=getCacheServiceVersion();debug(`Cache service version: ${a}`),checkPaths(e);let o=getCacheMode();if(!isCacheReadable(o)){info(`Cache restore skipped: the effective cache-mode '${o}' does not permit reads.`),debug(`Skipped restore for paths [${e.join(`, `)}] with primary key '${t}'.`);return}switch(a){case`v2`:return yield restoreCacheV2(e,t,n,r,i);default:return yield restoreCacheV1(e,t,n,r,i)}})}function restoreCacheV1(e,t,n,r){return __awaiter(this,arguments,void 0,function*(e,t,n,r,i=!1){n||=[];let a=[t,...n];if(debug(`Resolved Keys:`),debug(JSON.stringify(a)),a.length>10)throw new Nv(`Key Validation Error: Keys are limited to a maximum of 10.`);for(let e of a)checkKey(e);let o=yield getCompressionMethod(),s=``;try{let t;try{t=yield getCacheEntry(a,e,{compressionMethod:o,enableCrossOsArchive:i})}catch(e){let t=e?.message??``;throw t.includes(Iv)?new Lv(t):e}if(!t?.archiveLocation)return;if(r?.lookupOnly)return info(`Lookup only - skipping download`),t.cacheKey;s=u.join(yield createTempDirectory(),getCacheFileName(o)),debug(`Archive Path: ${s}`),yield downloadCache(t.archiveLocation,s,r),isDebug()&&(yield listTar(s,o));let n=getArchiveFileSizeInBytes(s);return info(`Cache Size: ~${Math.round(n/1048576)} MB (${n} B)`),yield extractTar(s,o),info(`Cache restored successfully`),t.cacheKey}catch(e){let t=e;if(t.name===Nv.name)throw e;t instanceof Pn&&typeof t.statusCode==`number`&&t.statusCode>=500?error(`Failed to restore: ${e.message}`):warning(`Failed to restore: ${e.message}`)}finally{try{yield unlinkFile(s)}catch(e){debug(`Failed to delete archive: ${e}`)}}})}function restoreCacheV2(e,t,n,r){return __awaiter(this,arguments,void 0,function*(e,t,n,r,i=!1){r=Object.assign(Object.assign({},r),{useAzureSdk:!0}),n||=[];let a=[t,...n];if(debug(`Resolved Keys:`),debug(JSON.stringify(a)),a.length>10)throw new Nv(`Key Validation Error: Keys are limited to a maximum of 10.`);for(let e of a)checkKey(e);let o=``;try{let s=internalCacheTwirpClient(),c=yield getCompressionMethod(),l={key:t,restoreKeys:n,version:getCacheVersion(e,c,i)},d;try{d=yield s.GetCacheEntryDownloadURL(l)}catch(e){let t=e?.message??``;throw t.includes(Iv)?new Lv(t):e}if(!d.ok){debug(`Cache not found for version ${l.version} of keys: ${a.join(`, `)}`);return}if(l.key===d.matchedKey?info(`Cache hit for: ${d.matchedKey}`):info(`Cache hit for restore-key: ${d.matchedKey}`),r?.lookupOnly)return info(`Lookup only - skipping download`),d.matchedKey;o=u.join(yield createTempDirectory(),getCacheFileName(c)),debug(`Archive path: ${o}`),debug(`Starting download of archive to: ${o}`),yield downloadCache(d.signedDownloadUrl,o,r);let f=getArchiveFileSizeInBytes(o);return info(`Cache Size: ~${Math.round(f/1048576)} MB (${f} B)`),isDebug()&&(yield listTar(o,c)),yield extractTar(o,c),info(`Cache restored successfully`),d.matchedKey}catch(e){let t=e;if(t.name===Nv.name)throw e;t instanceof Pn&&typeof t.statusCode==`number`&&t.statusCode>=500?error(`Failed to restore: ${e.message}`):warning(`Failed to restore: ${e.message}`)}finally{try{o&&(yield unlinkFile(o))}catch(e){debug(`Failed to delete archive: ${e}`)}}})}function saveCache$1(e,t,n){return __awaiter(this,arguments,void 0,function*(e,t,n,r=!1){let i=getCacheServiceVersion();debug(`Cache service version: ${i}`),checkPaths(e),checkKey(t);let a=getCacheMode();if(!isCacheWritable(a))return info(`Cache save skipped: the effective cache-mode '${a}' does not permit writes.`),debug(`Skipped save for paths [${e.join(`, `)}] with key '${t}'.`),-1;switch(i){case`v2`:return yield saveCacheV2(e,t,n,r);default:return yield saveCacheV1(e,t,n,r)}})}function saveCacheV1(e,t,n){return __awaiter(this,arguments,void 0,function*(e,t,n,r=!1){let i=yield getCompressionMethod(),a=-1,o=yield resolvePaths(e);if(debug(`Cache Paths:`),debug(`${JSON.stringify(o)}`),o.length===0)throw Error(`Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.`);let s=yield createTempDirectory(),c=u.join(s,getCacheFileName(i));debug(`Archive Path: ${c}`);try{yield createTar(s,o,i),isDebug()&&(yield listTar(c,i));let l=getArchiveFileSizeInBytes(c);if(debug(`File Size: ${l}`),l>10737418240&&!isGhes())throw Error(`Cache size of ~${Math.round(l/1048576)} MB (${l} B) is over the 10GB limit, not saving cache.`);debug(`Reserving Cache`);let u=yield reserveCache(t,e,{compressionMethod:i,enableCrossOsArchive:r,cacheSize:l});if(u?.result?.cacheId)a=u?.result?.cacheId;else if(u?.statusCode===400)throw Error(u?.error?.message??`Cache size of ~${Math.round(l/1048576)} MB (${l} B) is over the data cap limit, not saving cache.`);else{let e=u?.error?.message;throw e?.startsWith(`cache write denied:`)?new Fv(`Unable to reserve cache with key ${t}. More details: ${e}`):new Pv(`Unable to reserve cache with key ${t}, another job may be creating this cache. More details: ${u?.error?.message}`)}debug(`Saving Cache (ID: ${a})`),yield saveCache$2(a,c,``,n)}catch(e){let t=e;if(t.name===Nv.name)throw e;t.name===Pv.name?info(`Failed to save: ${t.message}`):t instanceof Pn&&typeof t.statusCode==`number`&&t.statusCode>=500?error(`Failed to save: ${t.message}`):warning(`Failed to save: ${t.message}`)}finally{try{yield unlinkFile(c)}catch(e){debug(`Failed to delete archive: ${e}`)}}return a})}function saveCacheV2(e,t,n){return __awaiter(this,arguments,void 0,function*(e,t,n,r=!1){n=Object.assign(Object.assign({},n),{uploadChunkSize:67108864,uploadConcurrency:8,useAzureSdk:!0});let i=yield getCompressionMethod(),a=internalCacheTwirpClient(),o=-1,s=yield resolvePaths(e);if(debug(`Cache Paths:`),debug(`${JSON.stringify(s)}`),s.length===0)throw Error(`Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.`);let c=yield createTempDirectory(),l=u.join(c,getCacheFileName(i));debug(`Archive Path: ${l}`);try{yield createTar(c,s,i),isDebug()&&(yield listTar(l,i));let u=getArchiveFileSizeInBytes(l);debug(`File Size: ${u}`),n.archiveSizeBytes=u,debug(`Reserving Cache`);let d=getCacheVersion(e,i,r),f={key:t,version:d},p;try{let e=yield a.CreateCacheEntry(f);if(!e.ok)throw e.message&&!e.message.startsWith(`cache write denied:`)&&warning(`Cache reservation failed: ${e.message}`),Error(e.message||`Response was not ok`);p=e.signedUploadUrl}catch(e){debug(`Failed to reserve cache: ${e}`);let n=e?.message??``;throw n.startsWith(`cache write denied:`)?new Fv(`Unable to reserve cache with key ${t}. More details: ${n}`):new Pv(`Unable to reserve cache with key ${t}, another job may be creating this cache.`)}debug(`Attempting to upload cache located at: ${l}`),yield saveCache$2(o,l,p,n);let m={key:t,version:d,sizeBytes:`${u}`},h=yield a.FinalizeCacheEntryUpload(m);if(debug(`FinalizeCacheEntryUploadResponse: ${h.ok}`),!h.ok)throw h.message?new Rv(h.message):Error(`Unable to finalize cache with key ${t}, another job may be finalizing this cache.`);o=parseInt(h.entryId)}catch(e){let t=e;if(t.name===Nv.name)throw e;t.name===Pv.name?info(`Failed to save: ${t.message}`):t.name===Rv.name?warning(t.message):t instanceof Pn&&typeof t.statusCode==`number`&&t.statusCode>=500?error(`Failed to save: ${t.message}`):warning(`Failed to save: ${t.message}`)}finally{try{yield unlinkFile(l)}catch(e){debug(`Failed to delete archive: ${e}`)}}return o})}function commandPath(e,t=process.env){if(!e||e===`.`||e===`..`||/[\\/:]/.test(e))return;let n=isWindows(),r=n?Object.keys(t).sort().find(e=>e.toUpperCase()===`PATH`):`PATH`,i=r&&t[r]||``,a=n&&!e.toLowerCase().endsWith(`.exe`)?`${e}.exe`:e,o=I(process.cwd());for(let e of i.split(M.delimiter)){let t=n?e.replace(/^"(.*)"$/,`$1`):e;if(M.isAbsolute(t))try{let e=I(t);if(n?e.toLowerCase()===o.toLowerCase():e===o)continue;let r=M.join(t,a);if(!ge(r).isFile())continue;return le(r,n?de.F_OK:de.X_OK),r}catch{}}}function resolveSfwEnabled(e,t,n){return e?!pkgPrNewCommitSha(t)||(n(`sfw was requested but is automatically disabled for Vite+ preview build ${t}; Socket Firewall Free will not be used.`),!1):!1}const zv=`v1.15.4`,Bv=`https://github.com/SocketDev/sfw-free/releases/download/${zv}`;function isMuslLinux(){if(process.platform!==`linux`)return!1;try{let e=process.report?.getReport();if(e?.header&&!e.header.glibcVersionRuntime)return!0}catch{}return F(`/etc/alpine-release`)}function getSfwAssetName(e,t,n){if(e===`darwin`){if(t===`arm64`)return`sfw-free-macos-arm64`;if(t===`x64`)return`sfw-free-macos-x86_64`}else if(e===`linux`){if(t===`arm64`)return n?`sfw-free-musl-linux-arm64`:`sfw-free-linux-arm64`;if(t===`x64`)return n?`sfw-free-musl-linux-x86_64`:`sfw-free-linux-x86_64`}else if(isWindows(e)){if(t===`arm64`)return`sfw-free-windows-arm64.exe`;if(t===`x64`)return`sfw-free-windows-x86_64.exe`}throw Error(`Unsupported platform/arch for sfw: ${e}/${t}${e===`linux`?` (${n?`musl`:`glibc`})`:``}`)}const Vv=2e3;function isSfwSupported(e=process.platform,t=process.arch,n=isMuslLinux()){try{return!!getSfwAssetName(e,t,n)}catch{return!1}}function getSfwBinDir(){let e=process.env.RUNNER_TEMP||process.env.TMPDIR||process.env.TEMP||`/tmp`;return P(e,`sfw-bin`)}async function installSfw(){let e=getSfwAssetName(process.platform,process.arch,isMuslLinux()),t=`${Bv}/${e}`,n=getSfwBinDir();fe(n,{recursive:!0});let r=P(n,isWindows()?`sfw.exe`:`sfw`),i=`sfw-${zv}-${process.platform}-${process.arch}-${isMuslLinux()?`musl`:`glibc`}`;try{let e=await restoreCache$1([n],i);if(e&&F(r)){isWindows()||ue(r,493),addPath(n),info(`sfw restored from cache: ${e}`);return}}catch(e){warning(`sfw cache restore failed (${e instanceof Error?e.message:String(e)}); falling through to download.`)}info(`Installing sfw from ${t}...`);let a=``;for(let e=1;e<=2;e++){try{let e=await runDownloadCommand(t,r);if(e===0&&F(r)){isWindows()||ue(r,493),addPath(n),info(`sfw installed at ${r}`);try{await saveCache$1([n],i),info(`sfw cached under key: ${i}`)}catch(e){warning(`sfw cache save failed (${e instanceof Error?e.message:String(e)}); continuing.`)}return}a=`exit code ${e}`}catch(e){a=e instanceof Error?e.message:String(e)}e<2&&(warning(`Failed to install sfw from ${t} (${a}). Retrying in ${Vv}ms... (attempt ${e+1}/2)`),await se(Vv))}throw Error(`Failed to install sfw from ${t} after 2 attempts: ${a}`)}function findSfwOnPath(){return commandPath(`sfw`)??null}async function setupSfw(e){if(!resolveSfwEnabled(e.sfw,e.version,warning))return!1;if(e.runInstall.length===0)return info("sfw was requested but `run-install` is disabled; sfw will not be invoked."),!1;let t=findSfwOnPath();return t?(info(`Using existing sfw on PATH: ${t}`),!0):isSfwSupported()?(await installSfw(),!0):(warning(`sfw has no published binary for this runner's platform/architecture (${`process.platform=${process.platform}, process.arch=${process.arch}, musl=${isMuslLinux()}`}) and none was found on PATH; falling back to plain \`vp install\`. To enable sfw here, install a working sfw binary on PATH in an earlier step (e.g. via \`socketdev/action@\` or a custom install).`),!1)}async function runDownloadCommand(e,t){let n={ignoreReturnCode:!0};return isWindows()?exec(`pwsh`,[`-Command`,`Invoke-WebRequest -UseBasicParsing -Uri '${e}' -OutFile '${t}' -TimeoutSec 60`],n):exec(`bash`,[`-c`,`set -o pipefail; curl -fsSL --connect-timeout 5 --max-time 60 -o '${t}' '${e}'`],n)}const Hv=/Command 'vp' not found in PATH/;function isSfwVpNotFoundFlake(e,t){return Hv.test(t)||Hv.test(e)}async function warmPowerShellCommandCache(){if(isWindows())try{await getExecOutput(`powershell.exe`,[`-NoProfile`,`-Command`,`Get-Command vp`],{ignoreReturnCode:!0})}catch(e){info(`PowerShell warm-up failed (${String(e)}); retrying sfw anyway.`)}}function tailOutput(e,t){let n=e.trim();return n.length<=t?n:`…(truncated, showing last ${t} chars)…\n${n.slice(-t)}`}async function runViteInstall(e){let t=getConfiguredProjectDir(e);for(let n of e.runInstall){let r=[`install`];n.args&&r.push(...n.args);let i=e.sfw?`sfw`:`vp`,a=e.sfw?[`vp`,...r]:r,o=getInstallCwd(t,n.cwd),s=`${i} ${a.join(` `)}`,attempt=async e=>{startGroup(`Running ${e} in ${o}...`);try{return await getExecOutput(i,a,{cwd:o,ignoreReturnCode:!0})}finally{endGroup()}};try{let t=await attempt(s);if(t.exitCode!==0&&e.sfw&&isSfwVpNotFoundFlake(t.stdout,t.stderr)&&(warning(`sfw reported vp as not found even though it is on PATH. This is a known sfw flake on Windows: a cold PowerShell start exceeds sfw's 10s command-resolution timeout and the timeout is misreported as not-found. Warming the PowerShell command cache and retrying once.`),await warmPowerShellCommandCache(),t=await attempt(`${s} (retry)`)),t.exitCode===0){info(`Successfully ran ${s}`);continue}let n=t.stderr.trim()||t.stdout.trim();n&&error(tailOutput(n,4e3),{title:`${s} failed`}),setFailed(`Command "${s}" (cwd: ${o}) exited with code ${t.exitCode}`)}catch(e){setFailed(`Failed to run ${s}: ${String(e)}`)}}}async function restoreCache(e){let t=getConfiguredProjectDir(e),n=detectLockFile$1(e.cacheDependencyPath,t);if(!n){warning(e.cacheDependencyPath?`No lock file found for cache-dependency-path: ${e.cacheDependencyPath}. Skipping cache restore.`:`No lock file found in project directory: ${t}. Skipping cache restore.`),setOutput(`cache-hit`,!1);return}info(`Using lock file: ${n.path}`);let r=ne(n.path);info(`Resolving dependency cache directory in: ${r}`);let i=await getCacheDirectories(n.type,r);if(!i.length){warning(`No cache directories found for ${n.type} in ${r}. Skipping cache restore.`),setOutput(`cache-hit`,!1);return}debug(`Cache paths: ${i.join(`, `)}`),saveState(`CACHE_PATHS`,JSON.stringify(i));let a=process.env.RUNNER_OS||Se(),o=be(),s=await hashFiles(n.path);if(!s)throw Error(`Failed to generate hash for lock file: ${n.path}`);let c=`vite-plus-${a}-${o}-${n.type}-${s}`,l=[`vite-plus-${a}-${o}-${n.type}-`,`vite-plus-${a}-${o}-`];debug(`Primary key: ${c}`),debug(`Restore keys: ${l.join(`, `)}`),saveState(`CACHE_PRIMARY_KEY`,c);let u=await restoreCache$1(i,c,l);u?(info(`Cache restored from key: ${u}`),saveState(`CACHE_MATCHED_KEY`,u),setOutput(`cache-hit`,!0)):(info(`Cache not found`),setOutput(`cache-hit`,!1))}async function saveCache(){let e=getState(`CACHE_PRIMARY_KEY`),t=getState(`CACHE_MATCHED_KEY`),n=getState(`CACHE_PATHS`);if(!e){info(`No cache key found. Skipping cache save.`);return}if(!n){info(`No cache paths found. Skipping cache save.`);return}if(e===t){info(`Cache hit on primary key "${e}". Skipping save.`);return}let r=JSON.parse(n);if(!r.length){info(`Empty cache paths. Skipping cache save.`);return}try{if(await saveCache$1(r,e)===-1){info(`Cache not saved (key already reserved by a concurrent job, or save was skipped).`);return}info(`Cache saved with key: ${e}`)}catch(e){warning(`Failed to save cache: ${String(e)}`)}}function resolvePath$1(e,t){return M.isAbsolute(e)?e:M.join(t,e)}function isWithin(e,t){let n=M.relative(t,e);return!M.isAbsolute(n)&&n!==`..`&&!n.startsWith(`..${M.sep}`)}function createNodeVersionResolver(e){let{getWorkspaceDir:t,info:n}=e;function resolveNodeVersionFile(e,r){let i=resolvePath$1(e,r||t()),a;try{a=pe(i,`utf-8`)}catch{throw Error(`node-version-file not found: ${i}`)}let o=te(i),s;if(s=o===`.tool-versions`?parseToolVersions(a):o===`package.json`?parsePackageJson(a):parsePlainVersionFile(a),!s)throw Error(`No Node.js version found in ${e}`);return s=s.replace(/^v/i,``),n(`Resolved Node.js version '${s}' from ${e}`),s}function parsePlainVersionFile(e){for(let t of e.split(` +`));let{commands:r}=yield getCommands(n,`create`);yield execCommands(r,e)})}var __awaiter=function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})},Nv=class ValidationError extends Error{constructor(e){super(e),this.name=`ValidationError`,Object.setPrototypeOf(this,ValidationError.prototype)}},Pv=class ReserveCacheError extends Error{constructor(e){super(e),this.name=`ReserveCacheError`,Object.setPrototypeOf(this,ReserveCacheError.prototype)}},Fv=class CacheWriteDeniedError extends Pv{constructor(e){super(e),this.name=`CacheWriteDeniedError`,Object.setPrototypeOf(this,CacheWriteDeniedError.prototype)}};const Iv=`cache read denied:`;var Lv=class CacheReadDeniedError extends Error{constructor(e){super(e),this.name=`CacheReadDeniedError`,Object.setPrototypeOf(this,CacheReadDeniedError.prototype)}},Rv=class FinalizeCacheError extends Error{constructor(e){super(e),this.name=`FinalizeCacheError`,Object.setPrototypeOf(this,FinalizeCacheError.prototype)}};function checkPaths(e){if(!e||e.length===0)throw new Nv(`Path Validation Error: At least one directory or file path is required`)}function checkKey(e){if(e.length>512)throw new Nv(`Key Validation Error: ${e} cannot be larger than 512 characters.`);if(!/^[^,]*$/.test(e))throw new Nv(`Key Validation Error: ${e} cannot contain commas.`)}function restoreCache$1(e,t,n,r){return __awaiter(this,arguments,void 0,function*(e,t,n,r,i=!1){let a=getCacheServiceVersion();debug(`Cache service version: ${a}`),checkPaths(e);let o=getCacheMode();if(!isCacheReadable(o)){info(`Cache restore skipped: the effective cache-mode '${o}' does not permit reads.`),debug(`Skipped restore for paths [${e.join(`, `)}] with primary key '${t}'.`);return}switch(a){case`v2`:return yield restoreCacheV2(e,t,n,r,i);default:return yield restoreCacheV1(e,t,n,r,i)}})}function restoreCacheV1(e,t,n,r){return __awaiter(this,arguments,void 0,function*(e,t,n,r,i=!1){n||=[];let a=[t,...n];if(debug(`Resolved Keys:`),debug(JSON.stringify(a)),a.length>10)throw new Nv(`Key Validation Error: Keys are limited to a maximum of 10.`);for(let e of a)checkKey(e);let o=yield getCompressionMethod(),s=``;try{let t;try{t=yield getCacheEntry(a,e,{compressionMethod:o,enableCrossOsArchive:i})}catch(e){let t=e?.message??``;throw t.includes(Iv)?new Lv(t):e}if(!t?.archiveLocation)return;if(r?.lookupOnly)return info(`Lookup only - skipping download`),t.cacheKey;s=u.join(yield createTempDirectory(),getCacheFileName(o)),debug(`Archive Path: ${s}`),yield downloadCache(t.archiveLocation,s,r),isDebug()&&(yield listTar(s,o));let n=getArchiveFileSizeInBytes(s);return info(`Cache Size: ~${Math.round(n/1048576)} MB (${n} B)`),yield extractTar(s,o),info(`Cache restored successfully`),t.cacheKey}catch(e){let t=e;if(t.name===Nv.name)throw e;t instanceof Pn&&typeof t.statusCode==`number`&&t.statusCode>=500?error(`Failed to restore: ${e.message}`):warning(`Failed to restore: ${e.message}`)}finally{try{yield unlinkFile(s)}catch(e){debug(`Failed to delete archive: ${e}`)}}})}function restoreCacheV2(e,t,n,r){return __awaiter(this,arguments,void 0,function*(e,t,n,r,i=!1){r=Object.assign(Object.assign({},r),{useAzureSdk:!0}),n||=[];let a=[t,...n];if(debug(`Resolved Keys:`),debug(JSON.stringify(a)),a.length>10)throw new Nv(`Key Validation Error: Keys are limited to a maximum of 10.`);for(let e of a)checkKey(e);let o=``;try{let s=internalCacheTwirpClient(),c=yield getCompressionMethod(),l={key:t,restoreKeys:n,version:getCacheVersion(e,c,i)},d;try{d=yield s.GetCacheEntryDownloadURL(l)}catch(e){let t=e?.message??``;throw t.includes(Iv)?new Lv(t):e}if(!d.ok){debug(`Cache not found for version ${l.version} of keys: ${a.join(`, `)}`);return}if(l.key===d.matchedKey?info(`Cache hit for: ${d.matchedKey}`):info(`Cache hit for restore-key: ${d.matchedKey}`),r?.lookupOnly)return info(`Lookup only - skipping download`),d.matchedKey;o=u.join(yield createTempDirectory(),getCacheFileName(c)),debug(`Archive path: ${o}`),debug(`Starting download of archive to: ${o}`),yield downloadCache(d.signedDownloadUrl,o,r);let f=getArchiveFileSizeInBytes(o);return info(`Cache Size: ~${Math.round(f/1048576)} MB (${f} B)`),isDebug()&&(yield listTar(o,c)),yield extractTar(o,c),info(`Cache restored successfully`),d.matchedKey}catch(e){let t=e;if(t.name===Nv.name)throw e;t instanceof Pn&&typeof t.statusCode==`number`&&t.statusCode>=500?error(`Failed to restore: ${e.message}`):warning(`Failed to restore: ${e.message}`)}finally{try{o&&(yield unlinkFile(o))}catch(e){debug(`Failed to delete archive: ${e}`)}}})}function saveCache$1(e,t,n){return __awaiter(this,arguments,void 0,function*(e,t,n,r=!1){let i=getCacheServiceVersion();debug(`Cache service version: ${i}`),checkPaths(e),checkKey(t);let a=getCacheMode();if(!isCacheWritable(a))return info(`Cache save skipped: the effective cache-mode '${a}' does not permit writes.`),debug(`Skipped save for paths [${e.join(`, `)}] with key '${t}'.`),-1;switch(i){case`v2`:return yield saveCacheV2(e,t,n,r);default:return yield saveCacheV1(e,t,n,r)}})}function saveCacheV1(e,t,n){return __awaiter(this,arguments,void 0,function*(e,t,n,r=!1){let i=yield getCompressionMethod(),a=-1,o=yield resolvePaths(e);if(debug(`Cache Paths:`),debug(`${JSON.stringify(o)}`),o.length===0)throw Error(`Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.`);let s=yield createTempDirectory(),c=u.join(s,getCacheFileName(i));debug(`Archive Path: ${c}`);try{yield createTar(s,o,i),isDebug()&&(yield listTar(c,i));let l=getArchiveFileSizeInBytes(c);if(debug(`File Size: ${l}`),l>10737418240&&!isGhes())throw Error(`Cache size of ~${Math.round(l/1048576)} MB (${l} B) is over the 10GB limit, not saving cache.`);debug(`Reserving Cache`);let u=yield reserveCache(t,e,{compressionMethod:i,enableCrossOsArchive:r,cacheSize:l});if(u?.result?.cacheId)a=u?.result?.cacheId;else if(u?.statusCode===400)throw Error(u?.error?.message??`Cache size of ~${Math.round(l/1048576)} MB (${l} B) is over the data cap limit, not saving cache.`);else{let e=u?.error?.message;throw e?.startsWith(`cache write denied:`)?new Fv(`Unable to reserve cache with key ${t}. More details: ${e}`):new Pv(`Unable to reserve cache with key ${t}, another job may be creating this cache. More details: ${u?.error?.message}`)}debug(`Saving Cache (ID: ${a})`),yield saveCache$2(a,c,``,n)}catch(e){let t=e;if(t.name===Nv.name)throw e;t.name===Pv.name?info(`Failed to save: ${t.message}`):t instanceof Pn&&typeof t.statusCode==`number`&&t.statusCode>=500?error(`Failed to save: ${t.message}`):warning(`Failed to save: ${t.message}`)}finally{try{yield unlinkFile(c)}catch(e){debug(`Failed to delete archive: ${e}`)}}return a})}function saveCacheV2(e,t,n){return __awaiter(this,arguments,void 0,function*(e,t,n,r=!1){n=Object.assign(Object.assign({},n),{uploadChunkSize:67108864,uploadConcurrency:8,useAzureSdk:!0});let i=yield getCompressionMethod(),a=internalCacheTwirpClient(),o=-1,s=yield resolvePaths(e);if(debug(`Cache Paths:`),debug(`${JSON.stringify(s)}`),s.length===0)throw Error(`Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.`);let c=yield createTempDirectory(),l=u.join(c,getCacheFileName(i));debug(`Archive Path: ${l}`);try{yield createTar(c,s,i),isDebug()&&(yield listTar(l,i));let u=getArchiveFileSizeInBytes(l);debug(`File Size: ${u}`),n.archiveSizeBytes=u,debug(`Reserving Cache`);let d=getCacheVersion(e,i,r),f={key:t,version:d},p;try{let e=yield a.CreateCacheEntry(f);if(!e.ok)throw e.message&&!e.message.startsWith(`cache write denied:`)&&warning(`Cache reservation failed: ${e.message}`),Error(e.message||`Response was not ok`);p=e.signedUploadUrl}catch(e){debug(`Failed to reserve cache: ${e}`);let n=e?.message??``;throw n.startsWith(`cache write denied:`)?new Fv(`Unable to reserve cache with key ${t}. More details: ${n}`):new Pv(`Unable to reserve cache with key ${t}, another job may be creating this cache.`)}debug(`Attempting to upload cache located at: ${l}`),yield saveCache$2(o,l,p,n);let m={key:t,version:d,sizeBytes:`${u}`},h=yield a.FinalizeCacheEntryUpload(m);if(debug(`FinalizeCacheEntryUploadResponse: ${h.ok}`),!h.ok)throw h.message?new Rv(h.message):Error(`Unable to finalize cache with key ${t}, another job may be finalizing this cache.`);o=parseInt(h.entryId)}catch(e){let t=e;if(t.name===Nv.name)throw e;t.name===Pv.name?info(`Failed to save: ${t.message}`):t.name===Rv.name?warning(t.message):t instanceof Pn&&typeof t.statusCode==`number`&&t.statusCode>=500?error(`Failed to save: ${t.message}`):warning(`Failed to save: ${t.message}`)}finally{try{yield unlinkFile(l)}catch(e){debug(`Failed to delete archive: ${e}`)}}return o})}function commandPath(e,t=process.env){if(!e||e===`.`||e===`..`||/[\\/:]/.test(e))return;let n=isWindows(),r=n?Object.keys(t).sort().find(e=>e.toUpperCase()===`PATH`):`PATH`,i=r&&t[r]||``,a=n&&!e.toLowerCase().endsWith(`.exe`)?`${e}.exe`:e,o=ge(process.cwd(),{bigint:!0});for(let e of i.split(M.delimiter)){let t=n?e.replace(/^"(.*)"$/,`$1`):e;if(M.isAbsolute(t))try{let e=ge(t,{bigint:!0});if(e.dev===o.dev&&e.ino===o.ino)continue;let r=M.join(t,a);if(!ge(r).isFile())continue;return le(r,n?de.F_OK:de.X_OK),r}catch{}}}function resolveSfwEnabled(e,t,n){return e?!pkgPrNewCommitSha(t)||(n(`sfw was requested but is automatically disabled for Vite+ preview build ${t}; Socket Firewall Free will not be used.`),!1):!1}const zv=`v1.15.4`,Bv=`https://github.com/SocketDev/sfw-free/releases/download/${zv}`;function isMuslLinux(){if(process.platform!==`linux`)return!1;try{let e=process.report?.getReport();if(e?.header&&!e.header.glibcVersionRuntime)return!0}catch{}return F(`/etc/alpine-release`)}function getSfwAssetName(e,t,n){if(e===`darwin`){if(t===`arm64`)return`sfw-free-macos-arm64`;if(t===`x64`)return`sfw-free-macos-x86_64`}else if(e===`linux`){if(t===`arm64`)return n?`sfw-free-musl-linux-arm64`:`sfw-free-linux-arm64`;if(t===`x64`)return n?`sfw-free-musl-linux-x86_64`:`sfw-free-linux-x86_64`}else if(isWindows(e)){if(t===`arm64`)return`sfw-free-windows-arm64.exe`;if(t===`x64`)return`sfw-free-windows-x86_64.exe`}throw Error(`Unsupported platform/arch for sfw: ${e}/${t}${e===`linux`?` (${n?`musl`:`glibc`})`:``}`)}const Vv=2e3;function isSfwSupported(e=process.platform,t=process.arch,n=isMuslLinux()){try{return!!getSfwAssetName(e,t,n)}catch{return!1}}function getSfwBinDir(){let e=process.env.RUNNER_TEMP||process.env.TMPDIR||process.env.TEMP||`/tmp`;return ae(e,`sfw-bin`)}async function installSfw(){let e=getSfwAssetName(process.platform,process.arch,isMuslLinux()),t=`${Bv}/${e}`,n=getSfwBinDir();fe(n,{recursive:!0});let r=P(n,isWindows()?`sfw.exe`:`sfw`),i=`sfw-${zv}-${process.platform}-${process.arch}-${isMuslLinux()?`musl`:`glibc`}`;try{let e=await restoreCache$1([n],i);if(e&&F(r))return isWindows()||ue(r,493),addPath(n),info(`sfw restored from cache: ${e}`),r}catch(e){warning(`sfw cache restore failed (${e instanceof Error?e.message:String(e)}); falling through to download.`)}info(`Installing sfw from ${t}...`);let a=``;for(let e=1;e<=2;e++){try{let e=await runDownloadCommand(t,r);if(e===0&&F(r)){isWindows()||ue(r,493),addPath(n),info(`sfw installed at ${r}`);try{await saveCache$1([n],i),info(`sfw cached under key: ${i}`)}catch(e){warning(`sfw cache save failed (${e instanceof Error?e.message:String(e)}); continuing.`)}return r}a=`exit code ${e}`}catch(e){a=e instanceof Error?e.message:String(e)}e<2&&(warning(`Failed to install sfw from ${t} (${a}). Retrying in ${Vv}ms... (attempt ${e+1}/2)`),await se(Vv))}throw Error(`Failed to install sfw from ${t} after 2 attempts: ${a}`)}function findSfwOnPath(){return commandPath(`sfw`)??null}async function setupSfw(e){if(!resolveSfwEnabled(e.sfw,e.version,warning))return{executable:`vp`,sfw:!1};if(e.runInstall.length===0)return info("sfw was requested but `run-install` is disabled; sfw will not be invoked."),{executable:`vp`,sfw:!1};let t=findSfwOnPath();return t?(info(`Using existing sfw on PATH: ${t}`),{executable:t,sfw:!0}):isSfwSupported()?{executable:await installSfw(),sfw:!0}:(warning(`sfw has no published binary for this runner's platform/architecture (${`process.platform=${process.platform}, process.arch=${process.arch}, musl=${isMuslLinux()}`}) and none was found on PATH; falling back to plain \`vp install\`. To enable sfw here, install a working sfw binary on PATH in an earlier step (e.g. via \`socketdev/action@\` or a custom install).`),{executable:`vp`,sfw:!1})}async function runDownloadCommand(e,t){let n={ignoreReturnCode:!0};return isWindows()?exec(`pwsh`,[`-Command`,`Invoke-WebRequest -UseBasicParsing -Uri '${e}' -OutFile '${t}' -TimeoutSec 60`],n):exec(`bash`,[`-c`,`set -o pipefail; curl -fsSL --connect-timeout 5 --max-time 60 -o '${t}' '${e}'`],n)}const Hv=/Command 'vp' not found in PATH/;function isSfwVpNotFoundFlake(e,t){return Hv.test(t)||Hv.test(e)}async function warmPowerShellCommandCache(){if(isWindows())try{await getExecOutput(`powershell.exe`,[`-NoProfile`,`-Command`,`Get-Command vp`],{ignoreReturnCode:!0})}catch(e){info(`PowerShell warm-up failed (${String(e)}); retrying sfw anyway.`)}}function tailOutput(e,t){let n=e.trim();return n.length<=t?n:`…(truncated, showing last ${t} chars)…\n${n.slice(-t)}`}async function runViteInstall(e,t){let n=getConfiguredProjectDir(e),{executable:r,sfw:i}=t;for(let t of e.runInstall){let e=[`install`];t.args&&e.push(...t.args);let a=i?[`vp`,...e]:e,o=getInstallCwd(n,t.cwd),s=`${r} ${a.join(` `)}`,attempt=async e=>{startGroup(`Running ${e} in ${o}...`);try{return await getExecOutput(`"${r.replaceAll(`"`,`\\"`)}"`,a,{cwd:o,ignoreReturnCode:!0})}finally{endGroup()}};try{let e=await attempt(s);if(e.exitCode!==0&&i&&isSfwVpNotFoundFlake(e.stdout,e.stderr)&&(warning(`sfw reported vp as not found even though it is on PATH. This is a known sfw flake on Windows: a cold PowerShell start exceeds sfw's 10s command-resolution timeout and the timeout is misreported as not-found. Warming the PowerShell command cache and retrying once.`),await warmPowerShellCommandCache(),e=await attempt(`${s} (retry)`)),e.exitCode===0){info(`Successfully ran ${s}`);continue}let t=e.stderr.trim()||e.stdout.trim();t&&error(tailOutput(t,4e3),{title:`${s} failed`}),setFailed(`Command "${s}" (cwd: ${o}) exited with code ${e.exitCode}`)}catch(e){setFailed(`Failed to run ${s}: ${String(e)}`)}}}async function restoreCache(e){let t=getConfiguredProjectDir(e),n=detectLockFile$1(e.cacheDependencyPath,t);if(!n){warning(e.cacheDependencyPath?`No lock file found for cache-dependency-path: ${e.cacheDependencyPath}. Skipping cache restore.`:`No lock file found in project directory: ${t}. Skipping cache restore.`),setOutput(`cache-hit`,!1);return}info(`Using lock file: ${n.path}`);let r=ne(n.path);info(`Resolving dependency cache directory in: ${r}`);let i=await getCacheDirectories(n.type,r);if(!i.length){warning(`No cache directories found for ${n.type} in ${r}. Skipping cache restore.`),setOutput(`cache-hit`,!1);return}debug(`Cache paths: ${i.join(`, `)}`),saveState(`CACHE_PATHS`,JSON.stringify(i));let a=process.env.RUNNER_OS||Se(),o=be(),s=await hashFiles(n.path);if(!s)throw Error(`Failed to generate hash for lock file: ${n.path}`);let c=`vite-plus-${a}-${o}-${n.type}-${s}`,l=[`vite-plus-${a}-${o}-${n.type}-`,`vite-plus-${a}-${o}-`];debug(`Primary key: ${c}`),debug(`Restore keys: ${l.join(`, `)}`),saveState(`CACHE_PRIMARY_KEY`,c);let u=await restoreCache$1(i,c,l);u?(info(`Cache restored from key: ${u}`),saveState(`CACHE_MATCHED_KEY`,u),setOutput(`cache-hit`,!0)):(info(`Cache not found`),setOutput(`cache-hit`,!1))}async function saveCache(){let e=getState(`CACHE_PRIMARY_KEY`),t=getState(`CACHE_MATCHED_KEY`),n=getState(`CACHE_PATHS`);if(!e){info(`No cache key found. Skipping cache save.`);return}if(!n){info(`No cache paths found. Skipping cache save.`);return}if(e===t){info(`Cache hit on primary key "${e}". Skipping save.`);return}let r=JSON.parse(n);if(!r.length){info(`Empty cache paths. Skipping cache save.`);return}try{if(await saveCache$1(r,e)===-1){info(`Cache not saved (key already reserved by a concurrent job, or save was skipped).`);return}info(`Cache saved with key: ${e}`)}catch(e){warning(`Failed to save cache: ${String(e)}`)}}function resolvePath$1(e,t){return M.isAbsolute(e)?e:M.join(t,e)}function isWithin(e,t){let n=M.relative(t,e);return!M.isAbsolute(n)&&n!==`..`&&!n.startsWith(`..${M.sep}`)}function createNodeVersionResolver(e){let{getWorkspaceDir:t,info:n}=e;function resolveNodeVersionFile(e,r){let i=resolvePath$1(e,r||t()),a;try{a=pe(i,`utf-8`)}catch{throw Error(`node-version-file not found: ${i}`)}let o=te(i),s;if(s=o===`.tool-versions`?parseToolVersions(a):o===`package.json`?parsePackageJson(a):parsePlainVersionFile(a),!s)throw Error(`No Node.js version found in ${e}`);return s=s.replace(/^v/i,``),n(`Resolved Node.js version '${s}' from ${e}`),s}function parsePlainVersionFile(e){for(let t of e.split(` `)){let e=(t.includes(`#`)?t.slice(0,t.indexOf(`#`)):t).trim();if(e)return normalizeNvmAlias(e)}}function normalizeNvmAlias(e){let t=e.toLowerCase();return t===`node`||t===`stable`?`latest`:e}function parseToolVersions(e){for(let t of e.split(` -`)){let e=t.trim();if(!e||e.startsWith(`#`))continue;let[n,...r]=e.split(/\s+/);if(n===`nodejs`||n===`node`){for(let e of r)if(isAsdfInstallableVersion(e))return e}}}function isAsdfInstallableVersion(e){return!!e&&e!==`system`&&!e.startsWith(`ref:`)&&!e.startsWith(`path:`)}function parsePackageJson(e){let t;try{t=JSON.parse(e)}catch{throw Error(`Failed to parse package.json: invalid JSON`)}let n=t.devEngines;if(n?.runtime){let e=findNodeRuntime(n.runtime);if(e)return e}let r=t.engines;if(r?.node&&typeof r.node==`string`)return r.node}function findNodeRuntime(e){let t=Array.isArray(e)?e:[e];for(let e of t)if(e?.name===`node`&&typeof e.version==`string`)return e.version}return{resolveNodeVersionFile}}const{resolveNodeVersionFile:Uv}=createNodeVersionResolver({getWorkspaceDir,info}),Wv=[{filename:`pnpm-lock.yaml`,type:`pnpm`},{filename:`bun.lockb`,type:`bun`},{filename:`bun.lock`,type:`bun`},{filename:`package-lock.json`,type:`npm`},{filename:`npm-shrinkwrap.json`,type:`npm`},{filename:`yarn.lock`,type:`yarn`}];function resolvePath(e,t){return re(e)?e:P(t,e)}function inferLockFileType(e,t){return t.includes(`pnpm`)?{type:`pnpm`,path:e,filename:t}:t.includes(`yarn`)?{type:`yarn`,path:e,filename:t}:t.startsWith(`bun.`)?{type:`bun`,path:e,filename:t}:{type:`npm`,path:e,filename:t}}function detectLockFile(e,t){if(e){let n=resolvePath(e,t);if(F(n)){let e=te(n),t=Wv.find(t=>t.filename===e);return t?{type:t.type,path:n,filename:e}:inferLockFileType(n,e)}return}let n=me(t);for(let e of Wv)if(n.includes(e.filename)){let n=P(t,e.filename);return{type:e.type,path:n,filename:e.filename}}}function createLockfileResolver(e){let{getWorkspaceDir:t,info:n,debug:r}=e,i=/^\d+\.\d+\.\d+/;function tryResolveVitePlusVersionFromLockfile(e,t){let i=detectLockfileForProject(e,t);if(!i)return;let a=i.filename.endsWith(`.lockb`)?textBunLockBeside(i):i;if(!a){r(`Cannot read ${i.filename} (binary) to resolve the ${aa} version; using "latest". Use the text bun.lock, or set the \`version\` input.`);return}let o=parseVitePlusVersionFromLockfile(a,workspaceSubPath(ne(a.path),e));if(o)return n(`Resolved ${aa} version '${o}' from ${a.filename}`),o;r(`No ${aa} version found in ${a.path}`)}function detectLockfileForProject(e,n){if(n)return detectLockFile(n,e);let r=t(),i=e;for(;;){let e=detectLockFile(void 0,i);if(e)return e;let t=ne(i);if(i===r||t===i||!isWithin(t,r))break;i=t}}function textBunLockBeside(e){let t=P(ne(e.path),`bun.lock`);return F(t)?{type:`bun`,path:t,filename:`bun.lock`}:void 0}function workspaceSubPath(e,t){if(!isWithin(t,e))return``;let n=ie(e,t);return n?n.split(oe).join(`/`):``}function parseVitePlusVersionFromLockfile(e,t=``){if(e.filename.endsWith(`.lockb`))return;let n;try{n=pe(e.path,`utf-8`)}catch{return}let r;switch(e.type){case`npm`:r=fromNpmLock(n,t);break;case`pnpm`:r=fromPnpmLock(n,t);break;case`yarn`:r=fromYarnLock(n);break;case`bun`:r=fromBunTextLock(n);break;default:return}return r&&i.test(r)?r:void 0}function fromNpmLock(e,t){let n;try{n=JSON.parse(e)}catch{return}let r=n.packages;if(t){let e=r?.[`${t}/node_modules/${oa}`]?.version;if(typeof e==`string`)return e;if(!npmPackageDeclaresVitePlus(r?.[t]))return}let i=r?.[`node_modules/${oa}`]?.version;if(typeof i==`string`)return i;let a=n.dependencies?.[oa]?.version;return typeof a==`string`?a:void 0}function npmPackageDeclaresVitePlus(e){if(!e)return!1;for(let t of[`dependencies`,`devDependencies`]){let n=e[t];if(n&&typeof n==`object`&&`vite-plus`in n)return!0}return!1}function fromPnpmLock(e,t){let n;try{n=(0,_i.parse)(e)}catch{return}if(!n||typeof n!=`object`)return;let r=n,i=r.importers;if(i&&typeof i==`object`){let e=t||`.`;return e in i?pnpmImporterVersion(i[e]):void 0}return pnpmImporterVersion(r)||e.match(/^\s*\/?vite-plus@(\d+\.\d+\.\d+[^\s():'"]*)/m)?.[1]}function pnpmImporterVersion(e){if(!e||typeof e!=`object`)return;let t=e;for(let e of[`dependencies`,`devDependencies`,`optionalDependencies`]){let n=t[e];if(n&&typeof n==`object`){let e=n[oa],t=typeof e==`string`?e:e?.version;if(typeof t==`string`){let e=t.replace(/\(.*$/,``).trim();if(i.test(e))return e}}}}function fromYarnLock(e){let t=/* @__PURE__ */ new Set,n=e.split(/\r?\n/);for(let e=0;e!isReservedEnvVar(e)&&!!process.env[e]);if(i.length===0){debug(`Project .npmrc at ${t}: no auth env vars to propagate`);return}info(`Detected project .npmrc at ${t}. Propagating auth env vars: ${i.join(`, `)}`);for(let e of i)exportVariable(e,process.env[e])}async function runMain(e){saveState(`IS_POST`,`true`);let t=getConfiguredProjectDir(e),n=e.nodeVersion;!n&&e.nodeVersionFile&&(n=Uv(e.nodeVersionFile,t));let r=Gv(e,t);await installVitePlus({...e,version:r});let i=e.nodeManager===!1||e.packageManager!==void 0?(await getExecOutput(`vp`,[`--version`],{silent:!0})).stdout:``,a=packageManagerArgs(e.packageManager,i);e.nodeManager===!1?(info(`Disabling Vite+ Node.js version management...`),await exec(`vp`,nodeManagerOffArgs(i))):n&&(info(`Setting up Node.js ${n} via vp env use...`),await exec(`vp`,[`env`,`use`,n]));for(let e of a)await exec(`vp`,e);e.registryUrl?configAuthentication(e.registryUrl,e.scope):propagateProjectNpmrcAuth(t),e.cache&&await restoreCache(e);let o=await setupSfw({...e,version:r});e.runInstall.length>0&&await runViteInstall({...e,sfw:o}),await printViteVersion(t)}async function printViteVersion(e){try{let t=(await getExecOutput(`vp`,[`--version`],{cwd:e,silent:!0})).stdout.trim();info(t);let n=parseInstalledVpVersion(t);saveState(`INSTALLED_VERSION`,n),setOutput(`version`,n)}catch(e){warning(`Could not get vp version: ${String(e)}`),setOutput(`version`,`unknown`)}}async function runPost(e){if(e.cache){if(!e.cacheSave){info(`Cache saving is disabled. Skipping cache save.`);return}await saveCache()}}async function main(){let e=getInputs();getState(`IS_POST`)===`true`?await runPost(e):await runMain(e)}main().catch(e=>{console.error(e),setFailed(e instanceof Error?e.message:String(e))});export{runMain,runPost}; \ No newline at end of file +`)){let e=t.trim();if(!e||e.startsWith(`#`))continue;let[n,...r]=e.split(/\s+/);if(n===`nodejs`||n===`node`){for(let e of r)if(isAsdfInstallableVersion(e))return e}}}function isAsdfInstallableVersion(e){return!!e&&e!==`system`&&!e.startsWith(`ref:`)&&!e.startsWith(`path:`)}function parsePackageJson(e){let t;try{t=JSON.parse(e)}catch{throw Error(`Failed to parse package.json: invalid JSON`)}let n=t.devEngines;if(n?.runtime){let e=findNodeRuntime(n.runtime);if(e)return e}let r=t.engines;if(r?.node&&typeof r.node==`string`)return r.node}function findNodeRuntime(e){let t=Array.isArray(e)?e:[e];for(let e of t)if(e?.name===`node`&&typeof e.version==`string`)return e.version}return{resolveNodeVersionFile}}const{resolveNodeVersionFile:Uv}=createNodeVersionResolver({getWorkspaceDir,info}),Wv=[{filename:`pnpm-lock.yaml`,type:`pnpm`},{filename:`bun.lockb`,type:`bun`},{filename:`bun.lock`,type:`bun`},{filename:`package-lock.json`,type:`npm`},{filename:`npm-shrinkwrap.json`,type:`npm`},{filename:`yarn.lock`,type:`yarn`}];function resolvePath(e,t){return re(e)?e:P(t,e)}function inferLockFileType(e,t){return t.includes(`pnpm`)?{type:`pnpm`,path:e,filename:t}:t.includes(`yarn`)?{type:`yarn`,path:e,filename:t}:t.startsWith(`bun.`)?{type:`bun`,path:e,filename:t}:{type:`npm`,path:e,filename:t}}function detectLockFile(e,t){if(e){let n=resolvePath(e,t);if(F(n)){let e=te(n),t=Wv.find(t=>t.filename===e);return t?{type:t.type,path:n,filename:e}:inferLockFileType(n,e)}return}let n=me(t);for(let e of Wv)if(n.includes(e.filename)){let n=P(t,e.filename);return{type:e.type,path:n,filename:e.filename}}}function createLockfileResolver(e){let{getWorkspaceDir:t,info:n,debug:r}=e,i=/^\d+\.\d+\.\d+/;function tryResolveVitePlusVersionFromLockfile(e,t){let i=detectLockfileForProject(e,t);if(!i)return;let a=i.filename.endsWith(`.lockb`)?textBunLockBeside(i):i;if(!a){r(`Cannot read ${i.filename} (binary) to resolve the ${aa} version; using "latest". Use the text bun.lock, or set the \`version\` input.`);return}let o=parseVitePlusVersionFromLockfile(a,workspaceSubPath(ne(a.path),e));if(o)return n(`Resolved ${aa} version '${o}' from ${a.filename}`),o;r(`No ${aa} version found in ${a.path}`)}function detectLockfileForProject(e,n){if(n)return detectLockFile(n,e);let r=t(),i=e;for(;;){let e=detectLockFile(void 0,i);if(e)return e;let t=ne(i);if(i===r||t===i||!isWithin(t,r))break;i=t}}function textBunLockBeside(e){let t=P(ne(e.path),`bun.lock`);return F(t)?{type:`bun`,path:t,filename:`bun.lock`}:void 0}function workspaceSubPath(e,t){if(!isWithin(t,e))return``;let n=ie(e,t);return n?n.split(oe).join(`/`):``}function parseVitePlusVersionFromLockfile(e,t=``){if(e.filename.endsWith(`.lockb`))return;let n;try{n=pe(e.path,`utf-8`)}catch{return}let r;switch(e.type){case`npm`:r=fromNpmLock(n,t);break;case`pnpm`:r=fromPnpmLock(n,t);break;case`yarn`:r=fromYarnLock(n);break;case`bun`:r=fromBunTextLock(n);break;default:return}return r&&i.test(r)?r:void 0}function fromNpmLock(e,t){let n;try{n=JSON.parse(e)}catch{return}let r=n.packages;if(t){let e=r?.[`${t}/node_modules/${oa}`]?.version;if(typeof e==`string`)return e;if(!npmPackageDeclaresVitePlus(r?.[t]))return}let i=r?.[`node_modules/${oa}`]?.version;if(typeof i==`string`)return i;let a=n.dependencies?.[oa]?.version;return typeof a==`string`?a:void 0}function npmPackageDeclaresVitePlus(e){if(!e)return!1;for(let t of[`dependencies`,`devDependencies`]){let n=e[t];if(n&&typeof n==`object`&&`vite-plus`in n)return!0}return!1}function fromPnpmLock(e,t){let n;try{n=(0,_i.parse)(e)}catch{return}if(!n||typeof n!=`object`)return;let r=n,i=r.importers;if(i&&typeof i==`object`){let e=t||`.`;return e in i?pnpmImporterVersion(i[e]):void 0}return pnpmImporterVersion(r)||e.match(/^\s*\/?vite-plus@(\d+\.\d+\.\d+[^\s():'"]*)/m)?.[1]}function pnpmImporterVersion(e){if(!e||typeof e!=`object`)return;let t=e;for(let e of[`dependencies`,`devDependencies`,`optionalDependencies`]){let n=t[e];if(n&&typeof n==`object`){let e=n[oa],t=typeof e==`string`?e:e?.version;if(typeof t==`string`){let e=t.replace(/\(.*$/,``).trim();if(i.test(e))return e}}}}function fromYarnLock(e){let t=/* @__PURE__ */ new Set,n=e.split(/\r?\n/);for(let e=0;e!isReservedEnvVar(e)&&!!process.env[e]);if(i.length===0){debug(`Project .npmrc at ${t}: no auth env vars to propagate`);return}info(`Detected project .npmrc at ${t}. Propagating auth env vars: ${i.join(`, `)}`);for(let e of i)exportVariable(e,process.env[e])}async function runMain(e){saveState(`IS_POST`,`true`);let t=getConfiguredProjectDir(e),n=e.nodeVersion;!n&&e.nodeVersionFile&&(n=Uv(e.nodeVersionFile,t));let r=Gv(e,t);await installVitePlus({...e,version:r});let i=e.nodeManager===!1||e.packageManager!==void 0?(await getExecOutput(`vp`,[`--version`],{silent:!0})).stdout:``,a=packageManagerArgs(e.packageManager,i);e.nodeManager===!1?(info(`Disabling Vite+ Node.js version management...`),await exec(`vp`,nodeManagerOffArgs(i))):n&&(info(`Setting up Node.js ${n} via vp env use...`),await exec(`vp`,[`env`,`use`,n]));for(let e of a)await exec(`vp`,e);e.registryUrl?configAuthentication(e.registryUrl,e.scope):propagateProjectNpmrcAuth(t),e.cache&&await restoreCache(e);let o=await setupSfw({...e,version:r});e.runInstall.length>0&&await runViteInstall(e,o),await printViteVersion(t)}async function printViteVersion(e){try{let t=(await getExecOutput(`vp`,[`--version`],{cwd:e,silent:!0})).stdout.trim();info(t);let n=parseInstalledVpVersion(t);saveState(`INSTALLED_VERSION`,n),setOutput(`version`,n)}catch(e){warning(`Could not get vp version: ${String(e)}`),setOutput(`version`,`unknown`)}}async function runPost(e){if(e.cache){if(!e.cacheSave){info(`Cache saving is disabled. Skipping cache save.`);return}await saveCache()}}async function main(){let e=getInputs();getState(`IS_POST`)===`true`?await runPost(e):await runMain(e)}main().catch(e=>{console.error(e),setFailed(e instanceof Error?e.message:String(e))});export{runMain,runPost}; \ No newline at end of file diff --git a/src/azure/index.test.ts b/src/azure/index.test.ts index afed72f..6d1e330 100644 --- a/src/azure/index.test.ts +++ b/src/azure/index.test.ts @@ -19,7 +19,7 @@ describe("Azure lifecycle", () => { return { ready: false }; }, configureAuth: () => undefined, - setupSfw: async () => "vp", + setupSfw: async () => ({ executable: "vp", sfw: false }), parseRunInstall: () => [], runInstall: () => undefined, getCommandOutput: () => "vp v0.2.2", @@ -51,7 +51,7 @@ describe("Azure lifecycle", () => { }, setupSfw: async () => { calls.push("sfw"); - return "vp"; + return { executable: "vp", sfw: false }; }, parseRunInstall: () => { calls.push("parse"); @@ -89,7 +89,7 @@ describe("Azure lifecycle", () => { installVitePlus: async () => undefined, prepareCacheMetadata: () => ({ ready: false }), configureAuth: () => undefined, - setupSfw: async () => "vp", + setupSfw: async () => ({ executable: "vp", sfw: false }), parseRunInstall: () => [], runInstall: () => undefined, getCommandOutput: () => `vp v${version}`, @@ -123,7 +123,7 @@ describe("Azure lifecycle", () => { installVitePlus: async () => undefined, prepareCacheMetadata: () => ({ ready: false }), configureAuth: () => undefined, - setupSfw: async () => "vp", + setupSfw: async () => ({ executable: "vp", sfw: false }), parseRunInstall: () => [], runInstall: () => undefined, getCommandOutput: () => "vp v0.2.2", @@ -150,7 +150,7 @@ describe("Azure lifecycle", () => { installVitePlus: async () => undefined, prepareCacheMetadata: () => ({ ready: false }), configureAuth: () => undefined, - setupSfw: async () => "vp", + setupSfw: async () => ({ executable: "vp", sfw: false }), parseRunInstall: () => [], runInstall, getCommandOutput: () => "vp v0.2.2", diff --git a/src/azure/parity.test.ts b/src/azure/parity.test.ts index bb99741..1631f9d 100644 --- a/src/azure/parity.test.ts +++ b/src/azure/parity.test.ts @@ -23,7 +23,7 @@ function fixture() { installVitePlus: vi.fn(async () => {}), prepareCacheMetadata: vi.fn(() => ({ ready: false })), configureAuth: vi.fn(configureAuth), - setupSfw: vi.fn().mockResolvedValue("vp"), + setupSfw: vi.fn().mockResolvedValue({ executable: "vp", sfw: false }), parseRunInstall, runInstall: vi.fn(), getCommandOutput: vi.fn((): string | undefined => "vp v0.3.1"), @@ -134,7 +134,23 @@ describe("Azure parity", () => { expect(ports.setVariable.mock.calls.some(([name]) => name.endsWith("CONFIG_USERCONFIG"))).toBe( false, ); - expect(ports.runInstall).toHaveBeenCalledWith(expect.anything(), project, "vp", target); + expect(ports.runInstall).toHaveBeenCalledWith( + expect.anything(), + project, + { executable: "vp", sfw: false }, + target, + ); + }); + + it("passes the selected sfw executable to the install runner", async () => { + const { project, env, ports } = fixture(); + const command = { executable: path.join(project, "trusted", "sfw"), sfw: true }; + ports.setupSfw.mockResolvedValue(command); + const target = { ...env, SETUP_VP_SFW: "true" }; + + await runFinalize(target, ports); + + expect(ports.runInstall).toHaveBeenCalledWith([{}], project, command, target); }); it("prepares a version/platform-specific sfw cache only when an install will run", async () => { @@ -185,7 +201,12 @@ describe("Azure parity", () => { delete target.SETUP_VP_VERSION_FILE; await runFinalize(target, ports); - expect(ports.runInstall).toHaveBeenCalledWith([{}], project, "vp", target); + expect(ports.runInstall).toHaveBeenCalledWith( + [{}], + project, + { executable: "vp", sfw: false }, + target, + ); expect(ports.logWarning).toHaveBeenCalledExactlyOnceWith( expect.stringContaining(`automatically disabled for Vite+ preview build ${version}`), ); @@ -205,7 +226,12 @@ describe("Azure parity", () => { expect(target.CUSTOM_TOKEN).toBeUndefined(); expect(target.UNRELATED_VALUE).toBe("$(keep-me)"); expect(ports.setVariable.mock.calls.some(([name]) => name === "CUSTOM_TOKEN")).toBe(false); - expect(ports.runInstall).toHaveBeenCalledWith(expect.anything(), project, "vp", target); + expect(ports.runInstall).toHaveBeenCalledWith( + expect.anything(), + project, + { executable: "vp", sfw: false }, + target, + ); }, ); diff --git a/src/ci/install-sfw.test.ts b/src/ci/install-sfw.test.ts index eb4a3b7..c36b4e5 100644 --- a/src/ci/install-sfw.test.ts +++ b/src/ci/install-sfw.test.ts @@ -33,7 +33,7 @@ describe("portable sfw preview handling", () => { logWarning, }); - expect(installCommand).toBe("vp"); + expect(installCommand).toEqual({ executable: "vp", sfw: false }); expect(logWarning).toHaveBeenCalledExactlyOnceWith( `sfw was requested but is automatically disabled for Vite+ preview build ${vitePlusVersion}; Socket Firewall Free will not be used.`, ); @@ -46,7 +46,10 @@ describe("portable sfw preview handling", () => { it("does not warn when sfw is already disabled for a preview", async () => { const logWarning = vi.fn(); - expect(await setupSfw([{}], { sfwEnabled: false, vitePlusVersion, logWarning })).toBe("vp"); + expect(await setupSfw([{}], { sfwEnabled: false, vitePlusVersion, logWarning })).toEqual({ + executable: "vp", + sfw: false, + }); expect(logWarning).not.toHaveBeenCalled(); }); @@ -55,9 +58,9 @@ describe("portable sfw preview handling", () => { async (version) => { vi.mocked(commandPath).mockReturnValue("/bin/sfw"); const logWarning = vi.fn(); - expect(await setupSfw([{}], { sfwEnabled: true, vitePlusVersion: version, logWarning })).toBe( - "sfw", - ); + expect( + await setupSfw([{}], { sfwEnabled: true, vitePlusVersion: version, logWarning }), + ).toEqual({ executable: "/bin/sfw", sfw: true }); expect(logWarning).not.toHaveBeenCalled(); }, ); diff --git a/src/ci/install-sfw.ts b/src/ci/install-sfw.ts index 7a99f2f..1171bf8 100644 --- a/src/ci/install-sfw.ts +++ b/src/ci/install-sfw.ts @@ -175,19 +175,19 @@ export async function setupSfw( options.vitePlusVersion ?? "", options.logWarning ?? console.warn, ); - if (!effectiveSfw) return "vp"; + if (!effectiveSfw) return { executable: "vp", sfw: false }; if (runInstallEntries.length === 0) { console.log( "setup-vp: sfw was requested but run-install is disabled; sfw will not be invoked.", ); - return "vp"; + return { executable: "vp", sfw: false }; } const existing = commandPath("sfw", env); if (existing) { console.log(`setup-vp: using existing sfw on PATH: ${existing}`); - return "sfw"; + return { executable: existing, sfw: true }; } let asset: string; @@ -197,13 +197,13 @@ export async function setupSfw( console.error( `setup-vp: sfw has no published binary for this runner's platform/architecture (process.platform=${platform}, process.arch=${arch}, musl=${isMusl}) and none was found on PATH; falling back to plain vp install.`, ); - return "vp"; + return { executable: "vp", sfw: false }; } const cacheDirectory = options.cacheDirectory || env.SETUP_VP_SFW_CACHE_DIR; const sfwDir = cacheDirectory - ? path.join(cacheDirectory, SFW_VERSION, asset) - : await mkdtemp(path.join(tmpdir(), "setup-vp-sfw-")); + ? path.resolve(cacheDirectory, SFW_VERSION, asset) + : await mkdtemp(path.resolve(tmpdir(), "setup-vp-sfw-")); await mkdir(sfwDir, { recursive: true }); const sfwBin = path.join(sfwDir, isWindows(platform) ? "sfw.exe" : "sfw"); const sfwUrl = `${SFW_RELEASE_BASE}/${asset}`; @@ -211,7 +211,7 @@ export async function setupSfw( const pathSeparator = isWindows(platform) ? ";" : ":"; env.PATH = `${sfwDir}${pathSeparator}${env.PATH || ""}`; options.exportVariable?.("PATH", env.PATH); - return "sfw"; + return { executable: sfwBin, sfw: true }; } if ( await stat(sfwBin).then( diff --git a/src/ci/process.test.ts b/src/ci/process.test.ts index 28e3ea7..8c9c639 100644 --- a/src/ci/process.test.ts +++ b/src/ci/process.test.ts @@ -1,6 +1,7 @@ import { chmodSync, copyFileSync, + existsSync, mkdtempSync, mkdirSync, readFileSync, @@ -71,6 +72,38 @@ describe("commandPath", () => { expect(commandPath("sfw", env)).toBe(path.join(second, filename)); expect(commandPath("sfw.exe", env)).toBe(path.join(second, filename)); }); + + it("excludes a case alias on a case-insensitive volume", (context) => { + const { root, first, filename } = fixture(); + const alias = path.join(root, "FIRST BIN"); + if (!existsSync(alias)) context.skip("requires a case-insensitive volume"); + writeFileSync(path.join(first, filename), "workspace executable", { mode: 0o755 }); + const originalCwd = process.cwd(); + try { + process.chdir(first); + expect(commandPath("sfw", { PATH: alias })).toBeUndefined(); + } finally { + process.chdir(originalCwd); + } + }); + + it("keeps distinct directories that differ only in case on a case-sensitive volume", (context) => { + const { root, first, filename } = fixture(); + const other = path.join(root, "FIRST BIN"); + if (existsSync(other)) context.skip("requires a case-sensitive volume"); + mkdirSync(other); + writeFileSync(path.join(first, filename), "workspace executable", { mode: 0o755 }); + writeFileSync(path.join(other, filename), "trusted executable", { mode: 0o755 }); + const originalCwd = process.cwd(); + try { + process.chdir(first); + expect(commandPath("sfw", { PATH: [first, other].join(path.delimiter) })).toBe( + path.join(other, filename), + ); + } finally { + process.chdir(originalCwd); + } + }); }); describe("portable process helpers", () => { diff --git a/src/ci/process.ts b/src/ci/process.ts index 49edc81..acb8115 100644 --- a/src/ci/process.ts +++ b/src/ci/process.ts @@ -1,6 +1,6 @@ import { spawn, spawnSync } from "node:child_process"; import type { SpawnOptions, SpawnSyncOptions } from "node:child_process"; -import { accessSync, constants, realpathSync, statSync } from "node:fs"; +import { accessSync, constants, statSync } from "node:fs"; import path from "node:path"; import { isWindows } from "./platform.js"; @@ -49,18 +49,17 @@ export function commandPath( : "PATH"; const searchPath = (pathKey && env[pathKey]) || ""; const filename = windows && !command.toLowerCase().endsWith(".exe") ? `${command}.exe` : command; - const cwd = realpathSync(process.cwd()); + const cwd = statSync(process.cwd(), { bigint: true }); for (const entry of searchPath.split(path.delimiter)) { const directory = windows ? entry.replace(/^"(.*)"$/, "$1") : entry; // Empty and relative entries can refer to attacker-controlled checkout files. if (!path.isAbsolute(directory)) continue; try { - const resolvedDirectory = realpathSync(directory); - const isCwd = windows - ? resolvedDirectory.toLowerCase() === cwd.toLowerCase() - : resolvedDirectory === cwd; - if (isCwd) continue; + // Filesystem identity covers case aliases and symlinks without assuming + // that all volumes on the same operating system use the same case rules. + const directoryStat = statSync(directory, { bigint: true }); + if (directoryStat.dev === cwd.dev && directoryStat.ino === cwd.ino) continue; const candidate = path.join(directory, filename); if (!statSync(candidate).isFile()) continue; diff --git a/src/ci/run-install.test.ts b/src/ci/run-install.test.ts index 6e8ca6c..42bf8cb 100644 --- a/src/ci/run-install.test.ts +++ b/src/ci/run-install.test.ts @@ -1,6 +1,8 @@ import { describe, expect, it, vi } from "vite-plus/test"; import { parseRunInstall, runInstall } from "./run-install.js"; +const sfwCommand = { executable: "/trusted/sfw", sfw: true }; + describe("portable installs", () => { it("parses YAML comments, anchors, quoted escapes and empty arguments", () => { expect( @@ -23,8 +25,12 @@ describe("portable installs", () => { .mockResolvedValueOnce({ exitCode: 1, stdout: "", stderr: "Command 'vp' not found in PATH" }) .mockRejectedValueOnce(new Error("warm-up failed")) .mockResolvedValueOnce({ exitCode: 0, stdout: "", stderr: "" }); - await runInstall([{}], "/project", "sfw", {}, { platform: "win32", execute }); - expect(execute.mock.calls.map((call) => call[0])).toEqual(["sfw", "powershell.exe", "sfw"]); + await runInstall([{}], "/project", sfwCommand, {}, { platform: "win32", execute }); + expect(execute.mock.calls.map((call) => call[0])).toEqual([ + sfwCommand.executable, + "powershell.exe", + sfwCommand.executable, + ]); }); it("runs later entries, aggregates failures, and never retries ordinary install errors", async () => { @@ -32,7 +38,7 @@ describe("portable installs", () => { .fn() .mockResolvedValue({ exitCode: 1, stdout: "", stderr: "lockfile mismatch" }); await expect( - runInstall([{ cwd: "a" }, { cwd: "b" }], "/project", "sfw", {}, { execute }), + runInstall([{ cwd: "a" }, { cwd: "b" }], "/project", sfwCommand, {}, { execute }), ).rejects.toThrow(/cwd:.*a[\s\S]*cwd:.*b/); expect(execute).toHaveBeenCalledTimes(2); }); @@ -50,8 +56,11 @@ describe("portable installs", () => { stderr: "Command 'vp' not found in PATH", }) .mockResolvedValueOnce({ exitCode: 0, stdout: "", stderr: "" }); - await runInstall([{}], "/project", "sfw", {}, { platform, execute }); - expect(execute.mock.calls.map(([command]) => command)).toEqual(["sfw", "sfw"]); + await runInstall([{}], "/project", sfwCommand, {}, { platform, execute }); + expect(execute.mock.calls.map(([command]) => command)).toEqual([ + sfwCommand.executable, + sfwCommand.executable, + ]); expect(warn).toHaveBeenCalledWith("setup-vp: sfw could not resolve vp; retrying once."); } finally { warn.mockRestore(); diff --git a/src/ci/run-install.ts b/src/ci/run-install.ts index 29492b4..26c3079 100644 --- a/src/ci/run-install.ts +++ b/src/ci/run-install.ts @@ -75,21 +75,18 @@ export async function runInstall( const installEnv = { ...env }; delete installEnv.SETUP_VP_ENV_FILE; const execute = options.execute ?? runWithOutput; + const { executable, sfw } = installCommand; const failures: string[] = []; for (const entry of entries) { const cwd = entry.cwd ? path.resolve(projectDir, entry.cwd) : projectDir; const installArgs = ["install", ...(entry.args || [])]; - const args = installCommand === "sfw" ? ["vp", ...installArgs] : installArgs; - const label = `${installCommand} ${args.join(" ")} (cwd: ${cwd})`; + const args = sfw ? ["vp", ...installArgs] : installArgs; + const label = `${executable} ${args.join(" ")} (cwd: ${cwd})`; console.log(`setup-vp: running ${label}`); try { - let result = await execute(installCommand, args, { cwd, env: installEnv }); - if ( - result.exitCode !== 0 && - installCommand === "sfw" && - isSfwVpNotFoundFlake(result.stdout, result.stderr) - ) { + let result = await execute(executable, args, { cwd, env: installEnv }); + if (result.exitCode !== 0 && sfw && isSfwVpNotFoundFlake(result.stdout, result.stderr)) { const windows = isWindows(options.platform); console.warn( windows @@ -106,7 +103,7 @@ export async function runInstall( // A failed warm-up must not prevent the retry. } } - result = await execute(installCommand, args, { cwd, env: installEnv }); + result = await execute(executable, args, { cwd, env: installEnv }); } if (result.exitCode !== 0) { failures.push( diff --git a/src/ci/types.ts b/src/ci/types.ts index c387922..0da57b0 100644 --- a/src/ci/types.ts +++ b/src/ci/types.ts @@ -10,7 +10,10 @@ export type RunInstallInput = null | boolean | RunInstallEntry | RunInstallEntry export type RuntimeEnv = Record; -export type InstallCommand = "vp" | "sfw"; +export type InstallCommand = { + executable: string; + sfw: boolean; +}; export enum LockFileType { Npm = "npm", diff --git a/src/gitlab/index.test.ts b/src/gitlab/index.test.ts index ab1071e..7fcc431 100644 --- a/src/gitlab/index.test.ts +++ b/src/gitlab/index.test.ts @@ -85,6 +85,18 @@ describe("GitLab setup parity", () => { ); }); + it("executes the selected sfw path when running the install", async () => { + const root = fixture(); + const executable = path.join(root, "trusted", "sfw"); + vi.stubEnv("SETUP_VP_SFW", "true"); + vi.stubEnv("SETUP_VP_RUN_INSTALL", "true"); + vi.mocked(commandPath).mockReturnValue(executable); + + await main(); + + expect(runWithOutput).toHaveBeenCalledWith(executable, ["vp", "install"], expect.any(Object)); + }); + it("gives explicit versions priority over version files", async () => { fixture(); vi.stubEnv("SETUP_VP_VERSION", "0.3.2"); diff --git a/src/gitlab/install-sfw.test.ts b/src/gitlab/install-sfw.test.ts index 1af2571..3b59398 100644 --- a/src/gitlab/install-sfw.test.ts +++ b/src/gitlab/install-sfw.test.ts @@ -37,14 +37,18 @@ describe("GitLab sfw setup", () => { }); it("does not set up sfw when disabled or run-install is disabled", async () => { - expect(await setupSfw([{}], { SETUP_VP_SFW: "false" })).toBe("vp"); - expect(await setupSfw([], { SETUP_VP_SFW: "true" })).toBe("vp"); + expect(await setupSfw([{}], { SETUP_VP_SFW: "false" })).toEqual({ + executable: "vp", + sfw: false, + }); + expect(await setupSfw([], { SETUP_VP_SFW: "true" })).toEqual({ executable: "vp", sfw: false }); }); it("uses an existing sfw command from PATH", async () => { - vi.mocked(commandPath).mockReturnValue(path.join(tempDir(), "sfw")); + const executable = path.join(tempDir(), "sfw"); + vi.mocked(commandPath).mockReturnValue(executable); - expect(await setupSfw([{}], { SETUP_VP_SFW: "true" })).toBe("sfw"); + expect(await setupSfw([{}], { SETUP_VP_SFW: "true" })).toEqual({ executable, sfw: true }); expect(commandPath).toHaveBeenCalledWith("sfw", { SETUP_VP_SFW: "true" }); expect(spawnSync).not.toHaveBeenCalled(); }); diff --git a/src/gitlab/run-install.test.ts b/src/gitlab/run-install.test.ts index b95c59f..e6c046d 100644 --- a/src/gitlab/run-install.test.ts +++ b/src/gitlab/run-install.test.ts @@ -103,9 +103,15 @@ describe("GitLab run-install execution", () => { const dir = tempDir(); const appDir = path.join(dir, "app"); mkdirSync(appDir); - await runInstall([{ cwd: "app", args: ["--frozen-lockfile"] }], dir, "vp", process.env, { - execute: recorder(dir), - }); + await runInstall( + [{ cwd: "app", args: ["--frozen-lockfile"] }], + dir, + { executable: "vp", sfw: false }, + process.env, + { + execute: recorder(dir), + }, + ); expect(JSON.parse(readFileSync(path.join(dir, "run.json"), "utf8"))).toEqual({ cwd: realpathSync(appDir), @@ -116,11 +122,13 @@ describe("GitLab run-install execution", () => { it("runs install entries through sfw when requested", async () => { const dir = tempDir(); - await runInstall([{}], dir, "sfw", process.env, { execute: recorder(dir) }); + await runInstall([{}], dir, { executable: "/trusted/sfw", sfw: true }, process.env, { + execute: recorder(dir), + }); expect(JSON.parse(readFileSync(path.join(dir, "run.json"), "utf8"))).toEqual({ cwd: realpathSync(dir), - command: "sfw", + command: "/trusted/sfw", args: ["vp", "install"], }); }); @@ -128,7 +136,7 @@ describe("GitLab run-install execution", () => { it("does not expose SETUP_VP_ENV_FILE to install subprocesses", async () => { const dir = tempDir(); const env = { ...process.env, SETUP_VP_ENV_FILE: path.join(dir, "setup-vp.env") }; - await runInstall([{}], dir, "vp", env, { execute: recorder(dir) }); + await runInstall([{}], dir, { executable: "vp", sfw: false }, env, { execute: recorder(dir) }); expect(JSON.parse(readFileSync(path.join(dir, "run.json"), "utf8"))).not.toHaveProperty( "envFile", diff --git a/src/gitlab/types.test.ts b/src/gitlab/types.test.ts index 9aa741c..753c32c 100644 --- a/src/gitlab/types.test.ts +++ b/src/gitlab/types.test.ts @@ -11,8 +11,10 @@ describe("GitLab runtime types", () => { const input: RunInstallInput = entries; const env: RuntimeEnv = { SETUP_VP_SFW: "true" }; - expect(acceptInstallCommand("vp")).toBe("vp"); - expect(acceptInstallCommand("sfw")).toBe("sfw"); + expect(acceptInstallCommand({ executable: "vp", sfw: false }).sfw).toBe(false); + expect(acceptInstallCommand({ executable: "/trusted/sfw", sfw: true }).executable).toBe( + "/trusted/sfw", + ); expect(input).toEqual(entries); expect(env.SETUP_VP_SFW).toBe("true"); }); diff --git a/src/index.test.ts b/src/index.test.ts index d27ee95..9cbdead 100644 --- a/src/index.test.ts +++ b/src/index.test.ts @@ -56,17 +56,28 @@ const inputs = (cache: boolean, cacheSave: boolean): Inputs => ({ }); describe("runMain sfw", () => { + it("passes the selected sfw executable to the install runner", async () => { + vi.mocked(resolveVitePlusVersion).mockReturnValue("latest"); + const command = { executable: "/trusted/sfw", sfw: true }; + vi.mocked(setupSfw).mockResolvedValue(command); + const requested = { ...inputs(false, true), sfw: true, runInstall: [{}] }; + + await runMain(requested); + + expect(runViteInstall).toHaveBeenCalledWith(requested, command); + }); + it("passes the resolved preview version to sfw setup and installs without sfw", async () => { const version = "0.0.0-commit.7d848b3da1987fa60b4cf18487fcc36a2a697e94"; vi.mocked(resolveVitePlusVersion).mockReturnValue(version); - vi.mocked(setupSfw).mockResolvedValue(false); + vi.mocked(setupSfw).mockResolvedValue({ executable: "vp", sfw: false }); const requested = { ...inputs(false, true), sfw: true, runInstall: [{}] }; await runMain(requested); expect(installVitePlus).toHaveBeenCalledWith({ ...requested, version }); expect(setupSfw).toHaveBeenCalledWith({ ...requested, version }); - expect(runViteInstall).toHaveBeenCalledWith({ ...requested, sfw: false }); + expect(runViteInstall).toHaveBeenCalledWith(requested, { executable: "vp", sfw: false }); }); }); diff --git a/src/index.ts b/src/index.ts index a21a71d..30745cd 100644 --- a/src/index.ts +++ b/src/index.ts @@ -65,11 +65,11 @@ export async function runMain(inputs: Inputs): Promise { // Step 6: Install Socket Firewall Free if requested (must run before vp install). // Use the resolved version so preview pins in files also disable sfw. - const effectiveSfw = await setupSfw({ ...inputs, version }); + const installCommand = await setupSfw({ ...inputs, version }); // Step 7: Run vp install if requested if (inputs.runInstall.length > 0) { - await runViteInstall({ ...inputs, sfw: effectiveSfw }); + await runViteInstall(inputs, installCommand); } // Print version info at the end diff --git a/src/install-sfw-path.test.ts b/src/install-sfw-path.test.ts index 7e56609..8a3fbea 100644 --- a/src/install-sfw-path.test.ts +++ b/src/install-sfw-path.test.ts @@ -3,26 +3,161 @@ import { existsSync, mkdirSync, mkdtempSync, + readFileSync, + statSync, symlinkSync, writeFileSync, } from "node:fs"; import { rm } from "node:fs/promises"; import { tmpdir } from "node:os"; import path from "node:path"; -import { afterEach, expect, it, vi } from "vite-plus/test"; +import { afterEach, describe, expect, it, vi } from "vite-plus/test"; +import { restoreCache, saveCache } from "@actions/cache"; +import { addPath, setFailed } from "@actions/core"; +import { exec } from "@actions/exec"; import { setupSfw } from "./ci/install-sfw.js"; +import { runInstall } from "./ci/run-install.js"; import { isWindows } from "./ci/platform.js"; import { commandPath } from "./ci/process.js"; -import { findSfwOnPath } from "./install-sfw.js"; +import { findSfwOnPath, setupSfw as setupGitHubSfw } from "./install-sfw.js"; +import { runViteInstall } from "./run-install.js"; +import type { InstallCommand } from "./ci/types.js"; +import type { Inputs } from "./types.js"; + +vi.mock("@actions/cache", () => ({ restoreCache: vi.fn(), saveCache: vi.fn() })); +vi.mock("@actions/core", async (importOriginal) => ({ + ...(await importOriginal()), + addPath: vi.fn(), + setFailed: vi.fn(), +})); +// Keep getExecOutput real: the regression must reach actual process execution. +vi.mock("@actions/exec", async (importOriginal) => ({ + ...(await importOriginal()), + exec: vi.fn(), +})); const directories: string[] = []; afterEach(async () => { vi.unstubAllEnvs(); + vi.resetAllMocks(); for (const directory of directories.splice(0)) { await rm(directory, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 }); } }); +describe.each(["portable", "GitHub Actions"] as const)("%s sfw execution", (adapter) => { + it.each(["existing", "download", "cache"] as const)( + "executes the selected %s binary despite workspace binaries and PATH changes", + async (source) => { + const root = mkdtempSync(path.join(tmpdir(), "setup-vp-sfw-execute-")); + directories.push(root); + const workspace = path.join(root, "workspace"); + const installDir = path.join(workspace, "install directory"); + const trustedBin = path.join(root, "trusted bin"); + const marker = path.join(root, "executed"); + const filename = isWindows() ? "sfw.exe" : "sfw"; + mkdirSync(installDir, { recursive: true }); + mkdirSync(trustedBin); + vi.stubEnv("SETUP_VP_EXECUTION_MARKER", marker); + vi.stubEnv("RUNNER_TEMP", root); + vi.stubEnv("SETUP_VP_SFW_CACHE_DIR", undefined); + vi.stubEnv("NoDefaultCurrentDirectoryInExePath", undefined); + + if (isWindows()) { + const hook = path.join(root, "record.cjs"); + writeFileSync( + hook, + `const fs = require('node:fs'); +fs.writeFileSync(process.env.SETUP_VP_EXECUTION_MARKER, [process.argv0, ...process.argv.slice(1)].join('\\n') + '\\n'); +process.exit(0);`, + ); + vi.stubEnv("NODE_OPTIONS", `--require ${JSON.stringify(hook)}`); + } + + function writeExecutable(file: string): void { + mkdirSync(path.dirname(file), { recursive: true }); + if (isWindows()) { + copyFileSync(process.execPath, file); + } else { + writeFileSync( + file, + '#!/bin/sh\nprintf "%s\\n" "$0" "$@" > "$SETUP_VP_EXECUTION_MARKER"\n', + { + mode: 0o755, + }, + ); + } + } + writeExecutable(path.join(workspace, filename)); + writeExecutable(path.join(installDir, filename)); + const existing = path.join(trustedBin, filename); + if (source === "existing") writeExecutable(existing); + + const inputs: Inputs = { + version: "latest", + sfw: true, + cache: false, + cacheSave: true, + workingDirectory: workspace, + runInstall: [{ cwd: "install directory", args: ["--frozen-lockfile", "", "two words"] }], + }; + const originalCwd = process.cwd(); + try { + process.chdir(workspace); + vi.stubEnv("PATH", [workspace, trustedBin].join(path.delimiter)); + let command: InstallCommand; + if (adapter === "portable") { + const download = vi.fn(async (_url: string, file: string) => writeExecutable(file)); + // A relative cache setting must still produce an absolute executable path. + const options = { sfwEnabled: true, download, cacheDirectory: "../portable cache" }; + const env = { ...process.env }; + if (source === "cache") + await setupSfw(inputs.runInstall, { ...options, env: { ...env } }); + command = await setupSfw(inputs.runInstall, { ...options, env }); + expect(download).toHaveBeenCalledTimes(source === "existing" ? 0 : 1); + } else { + const binary = path.join(root, "sfw-bin", filename); + if (source === "cache") { + writeExecutable(binary); + vi.mocked(restoreCache).mockResolvedValue("cached"); + } + vi.mocked(exec).mockImplementation(async () => { + writeExecutable(binary); + return 0; + }); + command = await setupGitHubSfw(inputs); + expect(exec).toHaveBeenCalledTimes(source === "download" ? 1 : 0); + expect(saveCache).toHaveBeenCalledTimes(source === "download" ? 1 : 0); + expect(addPath).toHaveBeenCalledTimes(source === "existing" ? 0 : 1); + } + + expect(command.sfw).toBe(true); + expect(path.isAbsolute(command.executable)).toBe(true); + if (source === "existing") expect(command.executable).toBe(existing); + // Exercise both an explicit PATH attack and Windows' implicit child-CWD search. + for (const searchPath of [[workspace, trustedBin].join(path.delimiter), trustedBin]) { + vi.stubEnv("PATH", searchPath); + if (adapter === "portable") await runInstall(inputs.runInstall, workspace, command); + else await runViteInstall(inputs, command); + expect(setFailed).not.toHaveBeenCalled(); + const [executed, wrapped, ...args] = readFileSync(marker, "utf8").trimEnd().split("\n"); + const expected = statSync(command.executable, { bigint: true }); + expect(statSync(executed!, { bigint: true })).toMatchObject({ + dev: expected.dev, + ino: expected.ino, + }); + // Node normalizes the first argument to a path before the Windows preload hook. + expect(path.basename(wrapped!)).toBe("vp"); + expect(args).toEqual(["install", "--frozen-lockfile", "", "two words"]); + } + } finally { + process.chdir(originalCwd); + } + }, + 30_000, + ); +}); + it("does not execute planted lookup tools or reuse sfw from the working directory", async () => { const root = mkdtempSync(path.join(tmpdir(), "setup-vp-sfw-path-")); directories.push(root); @@ -78,7 +213,10 @@ it("does not execute planted lookup tools or reuse sfw from the working director expect(commandPath("sfw")).toBe(binary); expect(findSfwOnPath()).toBe(binary); const download = vi.fn(); - expect(await setupSfw([{}], { sfwEnabled: true, download })).toBe("sfw"); + expect(await setupSfw([{}], { sfwEnabled: true, download })).toEqual({ + executable: binary, + sfw: true, + }); expect(download).not.toHaveBeenCalled(); expect(existsSync(marker)).toBe(false); } finally { diff --git a/src/install-sfw.test.ts b/src/install-sfw.test.ts index 36cfa10..df69367 100644 --- a/src/install-sfw.test.ts +++ b/src/install-sfw.test.ts @@ -168,8 +168,8 @@ describe("setupSfw", () => { Object.defineProperty(process, "arch", { value: originalArch, configurable: true }); }); - it("returns false silently when inputs.sfw is false", async () => { - expect(await setupSfw(makeInputs({ sfw: false }))).toBe(false); + it("selects plain vp silently when inputs.sfw is false", async () => { + expect(await setupSfw(makeInputs({ sfw: false }))).toEqual({ executable: "vp", sfw: false }); expect(info).not.toHaveBeenCalled(); expect(warning).not.toHaveBeenCalled(); }); @@ -180,7 +180,10 @@ describe("setupSfw", () => { stubPlatform(platform, "x64"); vi.mocked(commandPath).mockReturnValue("/usr/bin/sfw"); - expect(await setupSfw(makeInputs({ version: previewVersion }))).toBe(false); + expect(await setupSfw(makeInputs({ version: previewVersion }))).toEqual({ + executable: "vp", + sfw: false, + }); expect(warning).toHaveBeenCalledExactlyOnceWith( `sfw was requested but is automatically disabled for Vite+ preview build ${previewVersion}; Socket Firewall Free will not be used.`, @@ -193,7 +196,10 @@ describe("setupSfw", () => { ); it("does not warn about preview builds when sfw is already disabled", async () => { - expect(await setupSfw(makeInputs({ sfw: false, version: previewVersion }))).toBe(false); + expect(await setupSfw(makeInputs({ sfw: false, version: previewVersion }))).toEqual({ + executable: "vp", + sfw: false, + }); expect(warning).not.toHaveBeenCalled(); }); @@ -201,13 +207,19 @@ describe("setupSfw", () => { "keeps sfw enabled for %s", async (version) => { vi.mocked(commandPath).mockReturnValue("/usr/bin/sfw"); - expect(await setupSfw(makeInputs({ version }))).toBe(true); + expect(await setupSfw(makeInputs({ version }))).toEqual({ + executable: "/usr/bin/sfw", + sfw: true, + }); expect(warning).not.toHaveBeenCalled(); }, ); - it("returns false with an info log when run-install is empty", async () => { - expect(await setupSfw(makeInputs({ runInstall: [] }))).toBe(false); + it("selects plain vp with an info log when run-install is empty", async () => { + expect(await setupSfw(makeInputs({ runInstall: [] }))).toEqual({ + executable: "vp", + sfw: false, + }); expect(info).toHaveBeenCalledWith(expect.stringContaining("`run-install` is disabled")); expect(warning).not.toHaveBeenCalled(); }); @@ -217,7 +229,7 @@ describe("setupSfw", () => { // applies to all platforms, not just Linux. stubPlatform("darwin", "arm64"); vi.mocked(commandPath).mockReturnValue("/usr/local/bin/sfw"); - expect(await setupSfw(makeInputs())).toBe(true); + expect(await setupSfw(makeInputs())).toEqual({ executable: "/usr/local/bin/sfw", sfw: true }); expect(info).toHaveBeenCalledWith(expect.stringContaining("Using existing sfw on PATH")); expect(commandPath).toHaveBeenCalledExactlyOnceWith("sfw"); expect(restoreCache).not.toHaveBeenCalled(); // installSfw never invoked @@ -226,7 +238,7 @@ describe("setupSfw", () => { it("uses an existing sfw on PATH on Linux and skips the download", async () => { vi.mocked(commandPath).mockReturnValue("/usr/bin/sfw"); - expect(await setupSfw(makeInputs())).toBe(true); + expect(await setupSfw(makeInputs())).toEqual({ executable: "/usr/bin/sfw", sfw: true }); expect(info).toHaveBeenCalledWith(expect.stringContaining("Using existing sfw on PATH")); expect(commandPath).toHaveBeenCalledExactlyOnceWith("sfw"); expect(restoreCache).not.toHaveBeenCalled(); @@ -236,7 +248,7 @@ describe("setupSfw", () => { it("falls back with a warning on an unsupported arch + no sfw on PATH", async () => { stubPlatform("linux", "ia32"); vi.mocked(commandPath).mockReturnValue(undefined); - expect(await setupSfw(makeInputs())).toBe(false); + expect(await setupSfw(makeInputs())).toEqual({ executable: "vp", sfw: false }); expect(warning).toHaveBeenCalledWith( expect.stringContaining("no published binary for this runner"), ); @@ -320,7 +332,7 @@ describe("installSfw", () => { vi.mocked(restoreCache).mockResolvedValueOnce(undefined); vi.mocked(exec).mockResolvedValueOnce(0); vi.mocked(saveCache).mockRejectedValueOnce(new Error("ReserveCacheError")); - await expect(installSfw()).resolves.toBeUndefined(); + await expect(installSfw()).resolves.toEqual(expect.stringMatching(/[\\/]sfw-bin[\\/]sfw$/)); expect(warning).toHaveBeenCalledWith(expect.stringContaining("cache save failed")); }); }); diff --git a/src/install-sfw.ts b/src/install-sfw.ts index f8ed283..d9b23cd 100644 --- a/src/install-sfw.ts +++ b/src/install-sfw.ts @@ -2,12 +2,13 @@ import { restoreCache, saveCache } from "@actions/cache"; import { info, warning, addPath } from "@actions/core"; import { exec } from "@actions/exec"; import { chmodSync, existsSync, mkdirSync } from "node:fs"; -import { join } from "node:path"; +import { join, resolve } from "node:path"; import { setTimeout as sleep } from "node:timers/promises"; import { getSfwAssetName, isMuslLinux, SFW_RELEASE_BASE, SFW_VERSION } from "./ci/install-sfw.js"; import { isWindows } from "./ci/platform.js"; import { commandPath } from "./ci/process.js"; import { resolveSfwEnabled } from "./ci/sfw.js"; +import type { InstallCommand } from "./ci/types.js"; import type { Inputs } from "./types.js"; export { getSfwAssetName, isMuslLinux }; @@ -42,10 +43,10 @@ export function isSfwSupported( function getSfwBinDir(): string { const tmp = process.env.RUNNER_TEMP || process.env.TMPDIR || process.env.TEMP || "/tmp"; - return join(tmp, "sfw-bin"); + return resolve(tmp, "sfw-bin"); } -export async function installSfw(): Promise { +export async function installSfw(): Promise { const assetName = getSfwAssetName(process.platform, process.arch, isMuslLinux()); const url = `${SFW_RELEASE_BASE}/${assetName}`; const binDir = getSfwBinDir(); @@ -66,7 +67,7 @@ export async function installSfw(): Promise { } addPath(binDir); info(`sfw restored from cache: ${matchedKey}`); - return; + return binPath; } } catch (error) { warning( @@ -98,7 +99,7 @@ export async function installSfw(): Promise { `sfw cache save failed (${error instanceof Error ? error.message : String(error)}); continuing.`, ); } - return; + return binPath; } failureReason = `exit code ${exitCode}`; } catch (error) { @@ -125,8 +126,8 @@ export function findSfwOnPath(): string | null { return commandPath("sfw") ?? null; } -// Decide what to do with `sfw: true`. Returns whether `vp install` should be -// wrapped with sfw. Centralizes all the cases and emits one log message per +// Decide what to do with `sfw: true`. Returns the executable and whether it +// wraps vp. Centralizes all the cases and emits one log message per // branch so the chosen path is always visible. // // macOS / Windows / Linux are all supported as of vite-plus v0.1.23 (older vp @@ -134,12 +135,13 @@ export function findSfwOnPath(): string | null { // pins vp < 0.1.23 on macOS/Windows with sfw enabled, `sfw vp install` will // fail the handshake; that's a documented requirement, not something we guard // against here. -export async function setupSfw(inputs: Inputs): Promise { - if (!resolveSfwEnabled(inputs.sfw, inputs.version, warning)) return false; +export async function setupSfw(inputs: Inputs): Promise { + if (!resolveSfwEnabled(inputs.sfw, inputs.version, warning)) + return { executable: "vp", sfw: false }; if (inputs.runInstall.length === 0) { info("sfw was requested but `run-install` is disabled; sfw will not be invoked."); - return false; + return { executable: "vp", sfw: false }; } // Prefer an externally-provided sfw — typically installed by a prior @@ -149,7 +151,7 @@ export async function setupSfw(inputs: Inputs): Promise { const existing = findSfwOnPath(); if (existing) { info(`Using existing sfw on PATH: ${existing}`); - return true; + return { executable: existing, sfw: true }; } if (!isSfwSupported()) { @@ -157,11 +159,10 @@ export async function setupSfw(inputs: Inputs): Promise { warning( `sfw has no published binary for this runner's platform/architecture (${env}) and none was found on PATH; falling back to plain \`vp install\`. To enable sfw here, install a working sfw binary on PATH in an earlier step (e.g. via \`socketdev/action@\` or a custom install).`, ); - return false; + return { executable: "vp", sfw: false }; } - await installSfw(); - return true; + return { executable: await installSfw(), sfw: true }; } async function runDownloadCommand(url: string, outPath: string): Promise { diff --git a/src/run-install.test.ts b/src/run-install.test.ts index 23627b0..2c26ac7 100644 --- a/src/run-install.test.ts +++ b/src/run-install.test.ts @@ -36,6 +36,8 @@ const baseInputs: Inputs = { cacheSave: true, }; +const sfwCommand = { executable: "/trusted/sfw", sfw: true }; + const mockedExec = vi.mocked(getExecOutput); function execResult(exitCode: number, stderr = "", stdout = "") { @@ -76,7 +78,7 @@ describe("runViteInstall sfw retry", () => { it("runs once and succeeds without retry", async () => { mockedExec.mockResolvedValueOnce(execResult(0)); - await runViteInstall(baseInputs); + await runViteInstall(baseInputs, sfwCommand); expect(mockedExec).toHaveBeenCalledTimes(1); expect(setFailed).not.toHaveBeenCalled(); @@ -89,13 +91,13 @@ describe("runViteInstall sfw retry", () => { .mockResolvedValueOnce(execResult(0)) // warm-up .mockResolvedValueOnce(execResult(0)); // retry - await runViteInstall(baseInputs); + await runViteInstall(baseInputs, sfwCommand); expect(mockedExec).toHaveBeenCalledTimes(3); - expect(mockedExec.mock.calls[0]?.[0]).toBe("sfw"); + expect(mockedExec.mock.calls[0]?.[0]).toBe(`"${sfwCommand.executable}"`); expect(mockedExec.mock.calls[1]?.[0]).toBe("powershell.exe"); expect(mockedExec.mock.calls[1]?.[1]).toEqual(["-NoProfile", "-Command", "Get-Command vp"]); - expect(mockedExec.mock.calls[2]?.[0]).toBe("sfw"); + expect(mockedExec.mock.calls[2]?.[0]).toBe(`"${sfwCommand.executable}"`); expect(mockedExec.mock.calls[2]?.[1]).toEqual(["vp", "install"]); expect(warning).toHaveBeenCalledTimes(1); expect(setFailed).not.toHaveBeenCalled(); @@ -107,10 +109,10 @@ describe("runViteInstall sfw retry", () => { .mockResolvedValueOnce(execResult(1, SFW_NOT_FOUND_STDERR)) .mockResolvedValueOnce(execResult(0)); // retry - await runViteInstall(baseInputs); + await runViteInstall(baseInputs, sfwCommand); expect(mockedExec).toHaveBeenCalledTimes(2); - expect(mockedExec.mock.calls[1]?.[0]).toBe("sfw"); + expect(mockedExec.mock.calls[1]?.[0]).toBe(`"${sfwCommand.executable}"`); expect(setFailed).not.toHaveBeenCalled(); }); @@ -118,7 +120,7 @@ describe("runViteInstall sfw retry", () => { stubPlatform("win32"); mockedExec.mockResolvedValueOnce(execResult(1, "ERR_PNPM_FETCH_404 not found")); - await runViteInstall(baseInputs); + await runViteInstall(baseInputs, sfwCommand); expect(mockedExec).toHaveBeenCalledTimes(1); expect(setFailed).toHaveBeenCalledTimes(1); @@ -128,7 +130,7 @@ describe("runViteInstall sfw retry", () => { stubPlatform("win32"); mockedExec.mockResolvedValueOnce(execResult(1, SFW_NOT_FOUND_STDERR)); - await runViteInstall({ ...baseInputs, sfw: false }); + await runViteInstall(baseInputs, { executable: "vp", sfw: false }); expect(mockedExec).toHaveBeenCalledTimes(1); expect(setFailed).toHaveBeenCalledTimes(1); @@ -141,7 +143,7 @@ describe("runViteInstall sfw retry", () => { .mockResolvedValueOnce(execResult(0)) // warm-up .mockResolvedValueOnce(execResult(1, SFW_NOT_FOUND_STDERR)); // retry fails too - await runViteInstall(baseInputs); + await runViteInstall(baseInputs, sfwCommand); expect(mockedExec).toHaveBeenCalledTimes(3); expect(setFailed).toHaveBeenCalledTimes(1); @@ -154,7 +156,7 @@ describe("runViteInstall sfw retry", () => { .mockRejectedValueOnce(new Error("spawn powershell.exe ENOENT")) // warm-up .mockResolvedValueOnce(execResult(0)); // retry - await runViteInstall(baseInputs); + await runViteInstall(baseInputs, sfwCommand); expect(mockedExec).toHaveBeenCalledTimes(3); expect(setFailed).not.toHaveBeenCalled(); diff --git a/src/run-install.ts b/src/run-install.ts index c3505bf..08473f1 100644 --- a/src/run-install.ts +++ b/src/run-install.ts @@ -1,6 +1,7 @@ import { startGroup, endGroup, setFailed, info, warning, error as logError } from "@actions/core"; import { getExecOutput } from "@actions/exec"; import type { Inputs } from "./types.js"; +import type { InstallCommand } from "./ci/types.js"; import { getConfiguredProjectDir, getInstallCwd } from "./utils.js"; import { isWindows } from "./ci/platform.js"; @@ -39,8 +40,12 @@ function tailOutput(buffer: string, max: number): string { return `…(truncated, showing last ${max} chars)…\n${trimmed.slice(-max)}`; } -export async function runViteInstall(inputs: Inputs): Promise { +export async function runViteInstall( + inputs: Inputs, + installCommand: InstallCommand, +): Promise { const projectDir = getConfiguredProjectDir(inputs); + const { executable: cmd, sfw } = installCommand; for (const options of inputs.runInstall) { const installArgs = ["install"]; @@ -48,15 +53,15 @@ export async function runViteInstall(inputs: Inputs): Promise { installArgs.push(...options.args); } - const cmd = inputs.sfw ? "sfw" : "vp"; - const args = inputs.sfw ? ["vp", ...installArgs] : installArgs; + const args = sfw ? ["vp", ...installArgs] : installArgs; const cwd = getInstallCwd(projectDir, options.cwd); const cmdStr = `${cmd} ${args.join(" ")}`; const attempt = async (label: string) => { startGroup(`Running ${label} in ${cwd}...`); try { - return await getExecOutput(cmd, args, { + // @actions/exec parses its first parameter as a command line. + return await getExecOutput(`"${cmd.replaceAll('"', '\\"')}"`, args, { cwd, ignoreReturnCode: true, }); @@ -68,11 +73,7 @@ export async function runViteInstall(inputs: Inputs): Promise { try { let result = await attempt(cmdStr); - if ( - result.exitCode !== 0 && - inputs.sfw && - isSfwVpNotFoundFlake(result.stdout, result.stderr) - ) { + if (result.exitCode !== 0 && sfw && isSfwVpNotFoundFlake(result.stdout, result.stderr)) { warning( "sfw reported vp as not found even though it is on PATH. This is a known sfw flake on Windows: a cold PowerShell start exceeds sfw's 10s command-resolution timeout and the timeout is misreported as not-found. Warming the PowerShell command cache and retrying once.", ); From a23aab259aab62f9dc330f7aede763b7566ff2e4 Mon Sep 17 00:00:00 2001 From: MK Date: Thu, 8 Oct 2026 14:37:31 +0800 Subject: [PATCH 3/5] fix: reject Windows drive-root-relative command paths --- README.md | 2 +- dist/azure/index.mjs | 2 +- dist/gitlab/index.mjs | 2 +- dist/index.mjs | 2 +- src/ci/process-windows.test.ts | 69 ++++++++++++++++++++++++++++++++++ src/ci/process.ts | 3 ++ src/install-sfw-path.test.ts | 59 +++++++++++++++++++++++++++++ 7 files changed, 135 insertions(+), 4 deletions(-) create mode 100644 src/ci/process-windows.test.ts diff --git a/README.md b/README.md index f5ed800..d24365e 100644 --- a/README.md +++ b/README.md @@ -293,7 +293,7 @@ steps: In the action log you will see `Using existing sfw on PATH: …` when this composition is detected, vs. `Installing sfw from …` for the bundled-download path. -Existing `sfw` executables must be in an absolute `PATH` directory. The current working directory, including aliases of that directory, and empty or relative `PATH` entries are ignored. On Windows, setup-vp looks for the native `sfw.exe` executable. Dependency installation uses the selected executable's absolute path, including after a download or cache restore. +Existing `sfw` executables must be in an absolute `PATH` directory. The current working directory, including aliases of that directory, and empty or relative `PATH` entries are ignored. On Windows, paths must include a drive or UNC share; entries such as `\trusted` are ignored. setup-vp looks for the native `sfw.exe` executable on Windows. Dependency installation uses the selected executable's absolute path, including after a download or cache restore. > [!NOTE] > **macOS / Windows require Vite+ v0.1.23 or newer.** Earlier `vp` releases didn't honor `HTTPS_PROXY` / `SSL_CERT_FILE`, so `sfw vp install` failed the TLS handshake on macOS / Windows (it always worked on Linux). The action's default `version: latest` satisfies this; if you pin an older `vp` and enable `sfw` on macOS / Windows, the install will fail the handshake. On a runner architecture with no published `sfw` binary (e.g. `riscv64`), the action logs a warning and falls back to plain `vp install`. diff --git a/dist/azure/index.mjs b/dist/azure/index.mjs index 299b4d5..ac3c311 100644 --- a/dist/azure/index.mjs +++ b/dist/azure/index.mjs @@ -136,7 +136,7 @@ default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.l /* istanbul ignore else should not happen */ n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let t=this.peek(2);if(t.type===`block-map`&&(this.type===`map-value-ind`&&t.indent===e.indent||this.type===`newline`&&!t.items[t.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type===`map-value-ind`&&t.type!==`flow-collection`){let n=getFirstKeyStartProps(getPrevProps(t));fixFlowSeqItems(e);let r=e.end.splice(1,e.end.length);r.push(this.sourceToken);let i={type:`block-map`,offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let e=this.source.indexOf(` `)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(` -`,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=getFirstKeyStartProps(getPrevProps(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=getFirstKeyStartProps(getPrevProps(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}}})),tt=/* @__PURE__ */ __commonJSMin((e=>{var t=qe(),n=W(),r=G(),i=fe(),a=O(),o=$e(),s=et();function parseOptions(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new o.LineCounter||null,prettyErrors:t}}function parseAllDocuments(e,n={}){let{lineCounter:i,prettyErrors:a}=parseOptions(n),o=new s.Parser(i?.addNewLine),c=new t.Composer(n),l=Array.from(c.compose(o.parse(e)));if(a&&i)for(let t of l)t.errors.forEach(r.prettifyError(e,i)),t.warnings.forEach(r.prettifyError(e,i));return l.length>0?l:Object.assign([],{empty:!0},c.streamInfo())}function parseDocument(e,n={}){let{lineCounter:i,prettyErrors:a}=parseOptions(n),o=new s.Parser(i?.addNewLine),c=new t.Composer(n),l=null;for(let t of c.compose(o.parse(e),!0,e.length))if(!l)l=t;else if(l.options.logLevel!==`silent`){l.errors.push(new r.YAMLParseError(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return a&&i&&(l.errors.forEach(r.prettifyError(e,i)),l.warnings.forEach(r.prettifyError(e,i))),l}function parse(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let a=parseDocument(e,n);if(!a)return null;if(a.warnings.forEach(e=>i.warn(a.options.logLevel,e)),a.errors.length>0){if(a.options.logLevel!==`silent`)throw a.errors[0];a.errors=[]}return a.toJS(Object.assign({reviver:r},n))}function stringify(e,t,r){let i=null;if(typeof t==`function`||Array.isArray(t)?i=t:r===void 0&&t&&(r=t),typeof r==`string`&&(r=r.length),typeof r==`number`){let e=Math.round(r);r=e<1?void 0:e>8?{indent:8}:{indent:e}}if(e===void 0){let{keepUndefined:e}=r??t??{};if(!e)return}return a.isDocument(e)&&!i?e.toString(r):new n.Document(e,i,r).toString(r)}e.parse=parse,e.parseAllDocuments=parseAllDocuments,e.parseDocument=parseDocument,e.stringify=stringify})),J=(/* @__PURE__ */ __commonJSMin((e=>{var t=qe(),n=W(),r=Me(),i=G(),a=j(),o=O(),s=L(),c=M(),l=R(),u=B();Ze();var d=Qe(),f=$e(),p=et(),m=tt(),h=k();e.Composer=t.Composer,e.Document=n.Document,e.Schema=r.Schema,e.YAMLError=i.YAMLError,e.YAMLParseError=i.YAMLParseError,e.YAMLWarning=i.YAMLWarning,e.Alias=a.Alias,e.isAlias=o.isAlias,e.isCollection=o.isCollection,e.isDocument=o.isDocument,e.isMap=o.isMap,e.isNode=o.isNode,e.isPair=o.isPair,e.isScalar=o.isScalar,e.isSeq=o.isSeq,e.Pair=s.Pair,e.Scalar=c.Scalar,e.YAMLMap=l.YAMLMap,e.YAMLSeq=u.YAMLSeq,e.Lexer=d.Lexer,e.LineCounter=f.LineCounter,e.Parser=p.Parser,e.parse=m.parse,e.parseAllDocuments=m.parseAllDocuments,e.parseDocument=m.parseDocument,e.stringify=m.stringify,e.visit=h.visit,e.visitAsync=h.visitAsync})))();function parseInstalledVpVersion(e){return(e.match(/^\s*vp\s+v?(\d[^\s]*)/im)??e.match(/Global:\s*v?(\d[^\s]*)/i))?.[1]??`unknown`}const nt=/* @__PURE__ */ new Set([`true`,`True`,`TRUE`]),rt=/* @__PURE__ */ new Set([`false`,`False`,`FALSE`]);function parseNodeManager(e){if(e){if(nt.has(e))return!0;if(rt.has(e))return!1;throw Error(`Invalid node-manager input: "${e}". Expected "true", "false", or unset.`)}}function supportsScopedEnv(e){let t=parseInstalledVpVersion(e);if(t.startsWith(`0.0.0-commit.`))return!0;let n=t.match(/^(\d+)\.(\d+)\.(\d+)/);if(!n)throw Error(`Could not determine the installed Vite+ version for env configuration.`);let[,r,i,a]=n.map(Number);return r>0||i>3||i===3&&a>=1}function nodeManagerOffArgs(e){return parseInstalledVpVersion(e).startsWith(`0.0.0-commit.`)&&console.info("setup-vp: node-manager: false requires a preview build that supports `vp env off node`. If this command is unsupported, use a newer preview or a stable release. setup-vp will not fall back to disabling package-manager management."),supportsScopedEnv(e)?[`env`,`off`,`node`]:[`env`,`off`]}const it=[`npm`,`pnpm`,`yarn`,`bun`];function parsePackageManager(e){if(!e?.trim())return;let t;try{t=(0,J.parse)(e)}catch(e){throw Error(`Invalid package-manager input: ${String(e)}`)}if(t!==``){if(typeof t==`boolean`)return t;if(t&&typeof t==`object`&&!Array.isArray(t)){for(let[e,n]of Object.entries(t))if(!it.includes(e)||typeof n!=`boolean`)throw Error(`Invalid package-manager input: ${e} must be npm, pnpm, yarn, or bun with a boolean value.`);return t}throw Error(`Invalid package-manager input: expected a boolean or a mapping of npm, pnpm, yarn, and bun to booleans.`)}}function packageManagerArgs(e,t){if(e===void 0)return[];if(!supportsScopedEnv(t))throw Error(`package-manager configuration requires Vite+ 0.3.1 or newer.`);return typeof e==`boolean`?e?[]:[[`env`,`off`,`pm`]]:it.filter(t=>e[t]===!1).map(e=>[`env`,`off`,e])}const Y=`Vite+`,X=`vite-plus`;function resolvePath$1(e,t){return f.isAbsolute(e)?e:f.join(t,e)}function isWithin(e,t){let n=f.relative(t,e);return!f.isAbsolute(n)&&n!==`..`&&!n.startsWith(`..${f.sep}`)}function resolveProjectDirectory(e){let{workingDirectory:t,workspaceRoot:n}=e,r=f.isAbsolute(t)?t:f.join(n,t);try{if(!u(r).isDirectory())throw Error(`working-directory is not a directory: ${t} (resolved to ${r})`)}catch(e){throw e instanceof Error&&`code`in e&&e.code===`ENOENT`?Error(`working-directory not found: ${t} (resolved to ${r})`):e}return r}function isWindows(e=process.platform){return e===`win32`}function run(e,t,n={}){let r=x(e,t,{stdio:`inherit`,...n});if(r.error)throw r.error;if(r.status!==0)throw Error(`${e} ${t.join(` `)} exited with code ${r.status??1}`)}function runWithOutput(e,t,n={}){return new Promise((r,i)=>{let a=b(e,t,{...n,stdio:[`ignore`,`pipe`,`pipe`]}),o=``,s=``;a.stdout.on(`data`,e=>{process.stdout.write(e),o=(o+e.toString()).slice(-4e3)}),a.stderr.on(`data`,e=>{process.stderr.write(e),s=(s+e.toString()).slice(-4e3)}),a.on(`error`,i),a.on(`close`,e=>r({exitCode:e??1,stdout:o,stderr:s}))})}function commandPath(e,r=process.env){if(!e||e===`.`||e===`..`||/[\\/:]/.test(e))return;let i=isWindows(),a=i?Object.keys(r).sort().find(e=>e.toUpperCase()===`PATH`):`PATH`,o=a&&r[a]||``,s=i&&!e.toLowerCase().endsWith(`.exe`)?`${e}.exe`:e,c=u(process.cwd(),{bigint:!0});for(let e of o.split(f.delimiter)){let r=i?e.replace(/^"(.*)"$/,`$1`):e;if(f.isAbsolute(r))try{let e=u(r,{bigint:!0});if(e.dev===c.dev&&e.ino===c.ino)continue;let a=f.join(r,s);if(!u(a).isFile())continue;return t(a,i?n.F_OK:n.X_OK),a}catch{}}}function getCommandOutput(e,t,n){let r=x(e,t,{cwd:n?.cwd,encoding:`utf8`,stdio:[`ignore`,`pipe`,`pipe`]});if(r.status===0)return r.stdout.trim()}const at=[{filename:`pnpm-lock.yaml`,type:`pnpm`},{filename:`bun.lockb`,type:`bun`},{filename:`bun.lock`,type:`bun`},{filename:`package-lock.json`,type:`npm`},{filename:`npm-shrinkwrap.json`,type:`npm`},{filename:`yarn.lock`,type:`yarn`}];function resolvePath(e,t){return h(e)?e:g(t,e)}function inferLockFileType(e,t){return t.includes(`pnpm`)?{type:`pnpm`,path:e,filename:t}:t.includes(`yarn`)?{type:`yarn`,path:e,filename:t}:t.startsWith(`bun.`)?{type:`bun`,path:e,filename:t}:{type:`npm`,path:e,filename:t}}function detectLockFile(e,t){if(e){let n=resolvePath(e,t);if(i(n)){let e=p(n),t=at.find(t=>t.filename===e);return t?{type:t.type,path:n,filename:e}:inferLockFileType(n,e)}return}let n=c(t);for(let e of at)if(n.includes(e.filename)){let n=g(t,e.filename);return{type:e.type,path:n,filename:e.filename}}}function prepareCacheMetadata(e){let{projectDir:t,cacheDependencyPath:n,logWarning:r}=e,i=detectLockFile(n||void 0,t);if(!i)return r?.(`setup-vp: cache is enabled but no supported lock file was found; skipping cache.`),{ready:!1};let a=getCommandOutput(`vp`,[`pm`,`cache`,`dir`],{cwd:f.dirname(i.path)});return a?{ready:!0,cachePath:a,lockFile:i.path,lockType:i.type}:(r?.(`setup-vp: could not resolve package-manager cache directory for ${i.filename}; skipping cache.`),{ready:!1})}function createLockfileResolver(e){let{getWorkspaceDir:t,info:n,debug:r}=e,a=/^\d+\.\d+\.\d+/;function tryResolveVitePlusVersionFromLockfile(e,t){let i=detectLockfileForProject(e,t);if(!i)return;let a=i.filename.endsWith(`.lockb`)?textBunLockBeside(i):i;if(!a){r(`Cannot read ${i.filename} (binary) to resolve the ${Y} version; using "latest". Use the text bun.lock, or set the \`version\` input.`);return}let o=parseVitePlusVersionFromLockfile(a,workspaceSubPath(m(a.path),e));if(o)return n(`Resolved ${Y} version '${o}' from ${a.filename}`),o;r(`No ${Y} version found in ${a.path}`)}function detectLockfileForProject(e,n){if(n)return detectLockFile(n,e);let r=t(),i=e;for(;;){let e=detectLockFile(void 0,i);if(e)return e;let t=m(i);if(i===r||t===i||!isWithin(t,r))break;i=t}}function textBunLockBeside(e){let t=g(m(e.path),`bun.lock`);return i(t)?{type:`bun`,path:t,filename:`bun.lock`}:void 0}function workspaceSubPath(e,t){if(!isWithin(t,e))return``;let n=_(e,t);return n?n.split(v).join(`/`):``}function parseVitePlusVersionFromLockfile(e,t=``){if(e.filename.endsWith(`.lockb`))return;let n;try{n=s(e.path,`utf-8`)}catch{return}let r;switch(e.type){case`npm`:r=fromNpmLock(n,t);break;case`pnpm`:r=fromPnpmLock(n,t);break;case`yarn`:r=fromYarnLock(n);break;case`bun`:r=fromBunTextLock(n);break;default:return}return r&&a.test(r)?r:void 0}function fromNpmLock(e,t){let n;try{n=JSON.parse(e)}catch{return}let r=n.packages;if(t){let e=r?.[`${t}/node_modules/${X}`]?.version;if(typeof e==`string`)return e;if(!npmPackageDeclaresVitePlus(r?.[t]))return}let i=r?.[`node_modules/${X}`]?.version;if(typeof i==`string`)return i;let a=n.dependencies?.[X]?.version;return typeof a==`string`?a:void 0}function npmPackageDeclaresVitePlus(e){if(!e)return!1;for(let t of[`dependencies`,`devDependencies`]){let n=e[t];if(n&&typeof n==`object`&&`vite-plus`in n)return!0}return!1}function fromPnpmLock(e,t){let n;try{n=(0,J.parse)(e)}catch{return}if(!n||typeof n!=`object`)return;let r=n,i=r.importers;if(i&&typeof i==`object`){let e=t||`.`;return e in i?pnpmImporterVersion(i[e]):void 0}return pnpmImporterVersion(r)||e.match(/^\s*\/?vite-plus@(\d+\.\d+\.\d+[^\s():'"]*)/m)?.[1]}function pnpmImporterVersion(e){if(!e||typeof e!=`object`)return;let t=e;for(let e of[`dependencies`,`devDependencies`,`optionalDependencies`]){let n=t[e];if(n&&typeof n==`object`){let e=n[X],t=typeof e==`string`?e:e?.version;if(typeof t==`string`){let e=t.replace(/\(.*$/,``).trim();if(a.test(e))return e}}}}function fromYarnLock(e){let t=/* @__PURE__ */ new Set,n=e.split(/\r?\n/);for(let e=0;ee.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}}})),tt=/* @__PURE__ */ __commonJSMin((e=>{var t=qe(),n=W(),r=G(),i=fe(),a=O(),o=$e(),s=et();function parseOptions(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new o.LineCounter||null,prettyErrors:t}}function parseAllDocuments(e,n={}){let{lineCounter:i,prettyErrors:a}=parseOptions(n),o=new s.Parser(i?.addNewLine),c=new t.Composer(n),l=Array.from(c.compose(o.parse(e)));if(a&&i)for(let t of l)t.errors.forEach(r.prettifyError(e,i)),t.warnings.forEach(r.prettifyError(e,i));return l.length>0?l:Object.assign([],{empty:!0},c.streamInfo())}function parseDocument(e,n={}){let{lineCounter:i,prettyErrors:a}=parseOptions(n),o=new s.Parser(i?.addNewLine),c=new t.Composer(n),l=null;for(let t of c.compose(o.parse(e),!0,e.length))if(!l)l=t;else if(l.options.logLevel!==`silent`){l.errors.push(new r.YAMLParseError(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return a&&i&&(l.errors.forEach(r.prettifyError(e,i)),l.warnings.forEach(r.prettifyError(e,i))),l}function parse(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let a=parseDocument(e,n);if(!a)return null;if(a.warnings.forEach(e=>i.warn(a.options.logLevel,e)),a.errors.length>0){if(a.options.logLevel!==`silent`)throw a.errors[0];a.errors=[]}return a.toJS(Object.assign({reviver:r},n))}function stringify(e,t,r){let i=null;if(typeof t==`function`||Array.isArray(t)?i=t:r===void 0&&t&&(r=t),typeof r==`string`&&(r=r.length),typeof r==`number`){let e=Math.round(r);r=e<1?void 0:e>8?{indent:8}:{indent:e}}if(e===void 0){let{keepUndefined:e}=r??t??{};if(!e)return}return a.isDocument(e)&&!i?e.toString(r):new n.Document(e,i,r).toString(r)}e.parse=parse,e.parseAllDocuments=parseAllDocuments,e.parseDocument=parseDocument,e.stringify=stringify})),J=(/* @__PURE__ */ __commonJSMin((e=>{var t=qe(),n=W(),r=Me(),i=G(),a=j(),o=O(),s=L(),c=M(),l=R(),u=B();Ze();var d=Qe(),f=$e(),p=et(),m=tt(),h=k();e.Composer=t.Composer,e.Document=n.Document,e.Schema=r.Schema,e.YAMLError=i.YAMLError,e.YAMLParseError=i.YAMLParseError,e.YAMLWarning=i.YAMLWarning,e.Alias=a.Alias,e.isAlias=o.isAlias,e.isCollection=o.isCollection,e.isDocument=o.isDocument,e.isMap=o.isMap,e.isNode=o.isNode,e.isPair=o.isPair,e.isScalar=o.isScalar,e.isSeq=o.isSeq,e.Pair=s.Pair,e.Scalar=c.Scalar,e.YAMLMap=l.YAMLMap,e.YAMLSeq=u.YAMLSeq,e.Lexer=d.Lexer,e.LineCounter=f.LineCounter,e.Parser=p.Parser,e.parse=m.parse,e.parseAllDocuments=m.parseAllDocuments,e.parseDocument=m.parseDocument,e.stringify=m.stringify,e.visit=h.visit,e.visitAsync=h.visitAsync})))();function parseInstalledVpVersion(e){return(e.match(/^\s*vp\s+v?(\d[^\s]*)/im)??e.match(/Global:\s*v?(\d[^\s]*)/i))?.[1]??`unknown`}const nt=/* @__PURE__ */ new Set([`true`,`True`,`TRUE`]),rt=/* @__PURE__ */ new Set([`false`,`False`,`FALSE`]);function parseNodeManager(e){if(e){if(nt.has(e))return!0;if(rt.has(e))return!1;throw Error(`Invalid node-manager input: "${e}". Expected "true", "false", or unset.`)}}function supportsScopedEnv(e){let t=parseInstalledVpVersion(e);if(t.startsWith(`0.0.0-commit.`))return!0;let n=t.match(/^(\d+)\.(\d+)\.(\d+)/);if(!n)throw Error(`Could not determine the installed Vite+ version for env configuration.`);let[,r,i,a]=n.map(Number);return r>0||i>3||i===3&&a>=1}function nodeManagerOffArgs(e){return parseInstalledVpVersion(e).startsWith(`0.0.0-commit.`)&&console.info("setup-vp: node-manager: false requires a preview build that supports `vp env off node`. If this command is unsupported, use a newer preview or a stable release. setup-vp will not fall back to disabling package-manager management."),supportsScopedEnv(e)?[`env`,`off`,`node`]:[`env`,`off`]}const it=[`npm`,`pnpm`,`yarn`,`bun`];function parsePackageManager(e){if(!e?.trim())return;let t;try{t=(0,J.parse)(e)}catch(e){throw Error(`Invalid package-manager input: ${String(e)}`)}if(t!==``){if(typeof t==`boolean`)return t;if(t&&typeof t==`object`&&!Array.isArray(t)){for(let[e,n]of Object.entries(t))if(!it.includes(e)||typeof n!=`boolean`)throw Error(`Invalid package-manager input: ${e} must be npm, pnpm, yarn, or bun with a boolean value.`);return t}throw Error(`Invalid package-manager input: expected a boolean or a mapping of npm, pnpm, yarn, and bun to booleans.`)}}function packageManagerArgs(e,t){if(e===void 0)return[];if(!supportsScopedEnv(t))throw Error(`package-manager configuration requires Vite+ 0.3.1 or newer.`);return typeof e==`boolean`?e?[]:[[`env`,`off`,`pm`]]:it.filter(t=>e[t]===!1).map(e=>[`env`,`off`,e])}const Y=`Vite+`,X=`vite-plus`;function resolvePath$1(e,t){return f.isAbsolute(e)?e:f.join(t,e)}function isWithin(e,t){let n=f.relative(t,e);return!f.isAbsolute(n)&&n!==`..`&&!n.startsWith(`..${f.sep}`)}function resolveProjectDirectory(e){let{workingDirectory:t,workspaceRoot:n}=e,r=f.isAbsolute(t)?t:f.join(n,t);try{if(!u(r).isDirectory())throw Error(`working-directory is not a directory: ${t} (resolved to ${r})`)}catch(e){throw e instanceof Error&&`code`in e&&e.code===`ENOENT`?Error(`working-directory not found: ${t} (resolved to ${r})`):e}return r}function isWindows(e=process.platform){return e===`win32`}function run(e,t,n={}){let r=x(e,t,{stdio:`inherit`,...n});if(r.error)throw r.error;if(r.status!==0)throw Error(`${e} ${t.join(` `)} exited with code ${r.status??1}`)}function runWithOutput(e,t,n={}){return new Promise((r,i)=>{let a=b(e,t,{...n,stdio:[`ignore`,`pipe`,`pipe`]}),o=``,s=``;a.stdout.on(`data`,e=>{process.stdout.write(e),o=(o+e.toString()).slice(-4e3)}),a.stderr.on(`data`,e=>{process.stderr.write(e),s=(s+e.toString()).slice(-4e3)}),a.on(`error`,i),a.on(`close`,e=>r({exitCode:e??1,stdout:o,stderr:s}))})}function commandPath(e,r=process.env){if(!e||e===`.`||e===`..`||/[\\/:]/.test(e))return;let i=isWindows(),a=i?Object.keys(r).sort().find(e=>e.toUpperCase()===`PATH`):`PATH`,o=a&&r[a]||``,s=i&&!e.toLowerCase().endsWith(`.exe`)?`${e}.exe`:e,c=u(process.cwd(),{bigint:!0});for(let e of o.split(f.delimiter)){let r=i?e.replace(/^"(.*)"$/,`$1`):e;if(f.isAbsolute(r)&&!(i&&f.parse(r).root.length===1))try{let e=u(r,{bigint:!0});if(e.dev===c.dev&&e.ino===c.ino)continue;let a=f.join(r,s);if(!u(a).isFile())continue;return t(a,i?n.F_OK:n.X_OK),a}catch{}}}function getCommandOutput(e,t,n){let r=x(e,t,{cwd:n?.cwd,encoding:`utf8`,stdio:[`ignore`,`pipe`,`pipe`]});if(r.status===0)return r.stdout.trim()}const at=[{filename:`pnpm-lock.yaml`,type:`pnpm`},{filename:`bun.lockb`,type:`bun`},{filename:`bun.lock`,type:`bun`},{filename:`package-lock.json`,type:`npm`},{filename:`npm-shrinkwrap.json`,type:`npm`},{filename:`yarn.lock`,type:`yarn`}];function resolvePath(e,t){return h(e)?e:g(t,e)}function inferLockFileType(e,t){return t.includes(`pnpm`)?{type:`pnpm`,path:e,filename:t}:t.includes(`yarn`)?{type:`yarn`,path:e,filename:t}:t.startsWith(`bun.`)?{type:`bun`,path:e,filename:t}:{type:`npm`,path:e,filename:t}}function detectLockFile(e,t){if(e){let n=resolvePath(e,t);if(i(n)){let e=p(n),t=at.find(t=>t.filename===e);return t?{type:t.type,path:n,filename:e}:inferLockFileType(n,e)}return}let n=c(t);for(let e of at)if(n.includes(e.filename)){let n=g(t,e.filename);return{type:e.type,path:n,filename:e.filename}}}function prepareCacheMetadata(e){let{projectDir:t,cacheDependencyPath:n,logWarning:r}=e,i=detectLockFile(n||void 0,t);if(!i)return r?.(`setup-vp: cache is enabled but no supported lock file was found; skipping cache.`),{ready:!1};let a=getCommandOutput(`vp`,[`pm`,`cache`,`dir`],{cwd:f.dirname(i.path)});return a?{ready:!0,cachePath:a,lockFile:i.path,lockType:i.type}:(r?.(`setup-vp: could not resolve package-manager cache directory for ${i.filename}; skipping cache.`),{ready:!1})}function createLockfileResolver(e){let{getWorkspaceDir:t,info:n,debug:r}=e,a=/^\d+\.\d+\.\d+/;function tryResolveVitePlusVersionFromLockfile(e,t){let i=detectLockfileForProject(e,t);if(!i)return;let a=i.filename.endsWith(`.lockb`)?textBunLockBeside(i):i;if(!a){r(`Cannot read ${i.filename} (binary) to resolve the ${Y} version; using "latest". Use the text bun.lock, or set the \`version\` input.`);return}let o=parseVitePlusVersionFromLockfile(a,workspaceSubPath(m(a.path),e));if(o)return n(`Resolved ${Y} version '${o}' from ${a.filename}`),o;r(`No ${Y} version found in ${a.path}`)}function detectLockfileForProject(e,n){if(n)return detectLockFile(n,e);let r=t(),i=e;for(;;){let e=detectLockFile(void 0,i);if(e)return e;let t=m(i);if(i===r||t===i||!isWithin(t,r))break;i=t}}function textBunLockBeside(e){let t=g(m(e.path),`bun.lock`);return i(t)?{type:`bun`,path:t,filename:`bun.lock`}:void 0}function workspaceSubPath(e,t){if(!isWithin(t,e))return``;let n=_(e,t);return n?n.split(v).join(`/`):``}function parseVitePlusVersionFromLockfile(e,t=``){if(e.filename.endsWith(`.lockb`))return;let n;try{n=s(e.path,`utf-8`)}catch{return}let r;switch(e.type){case`npm`:r=fromNpmLock(n,t);break;case`pnpm`:r=fromPnpmLock(n,t);break;case`yarn`:r=fromYarnLock(n);break;case`bun`:r=fromBunTextLock(n);break;default:return}return r&&a.test(r)?r:void 0}function fromNpmLock(e,t){let n;try{n=JSON.parse(e)}catch{return}let r=n.packages;if(t){let e=r?.[`${t}/node_modules/${X}`]?.version;if(typeof e==`string`)return e;if(!npmPackageDeclaresVitePlus(r?.[t]))return}let i=r?.[`node_modules/${X}`]?.version;if(typeof i==`string`)return i;let a=n.dependencies?.[X]?.version;return typeof a==`string`?a:void 0}function npmPackageDeclaresVitePlus(e){if(!e)return!1;for(let t of[`dependencies`,`devDependencies`]){let n=e[t];if(n&&typeof n==`object`&&`vite-plus`in n)return!0}return!1}function fromPnpmLock(e,t){let n;try{n=(0,J.parse)(e)}catch{return}if(!n||typeof n!=`object`)return;let r=n,i=r.importers;if(i&&typeof i==`object`){let e=t||`.`;return e in i?pnpmImporterVersion(i[e]):void 0}return pnpmImporterVersion(r)||e.match(/^\s*\/?vite-plus@(\d+\.\d+\.\d+[^\s():'"]*)/m)?.[1]}function pnpmImporterVersion(e){if(!e||typeof e!=`object`)return;let t=e;for(let e of[`dependencies`,`devDependencies`,`optionalDependencies`]){let n=t[e];if(n&&typeof n==`object`){let e=n[X],t=typeof e==`string`?e:e?.version;if(typeof t==`string`){let e=t.replace(/\(.*$/,``).trim();if(a.test(e))return e}}}}function fromYarnLock(e){let t=/* @__PURE__ */ new Set,n=e.split(/\r?\n/);for(let e=0;ee,info:console.info,debug:()=>{},warning:console.warn}}const ot=`https://raw.githubusercontent.com/voidzero-dev/vite-plus`,Z=`packages/cli`,st=/^0\.0\.0-commit\.([0-9a-f]{40})$/i,ct=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;function pkgPrNewCommitSha(e){return e.match(st)?.[1]}function getInstallScriptUrls(e,t=process.platform){let n=isWindows(t)?`install.ps1`:`install.sh`,r=installScriptRef(e);return{pinned:r?[`${ot}/${r}/${Z}/${n}`,`https://cdn.jsdelivr.net/gh/voidzero-dev/vite-plus@${r}/${Z}/${n}`]:[],latest:[`https://viteplus.dev/${n}`,`${ot}/main/${Z}/${n}`]}}function installScriptRef(e){let t=pkgPrNewCommitSha(e);if(t)return t.toLowerCase();if(ct.test(e))return`v${e}`}function readNpmrc(e){try{return s(e,`utf8`)}catch(e){if(e.code===`ENOENT`)return``;throw e}}function analyzeProjectNpmrc(e){let t=/* @__PURE__ */ new Set;for(let n of e.split(/\r?\n/)){let e=n.trim();if(!e||e.startsWith(`;`)||e.startsWith(`#`))continue;let r=e.indexOf(`=`);if(r<0)continue;let i=e.slice(r+1).trim();for(let e of i.matchAll(/\$\{(\w+)\}/g))t.add(e[1])}return{envVarRefs:t}}function readUserConfigLines(e,t){let n=e.HOME||e.USERPROFILE,r=e.NPM_CONFIG_USERCONFIG||e.PNPM_CONFIG_USERCONFIG||n&&f.join(n,`.npmrc`);return(r?readNpmrc(r):``).split(/\r?\n/).filter(e=>!t.has(e.split(`=`)[0].trim().toLowerCase()))}function isReservedAuthVariable(e){return[`GITHUB_TOKEN`,`CI_JOB_TOKEN`,`SYSTEM_ACCESSTOKEN`].includes(e)?!1:/^(?:PATH|HOME|USERPROFILE|TMPDIR|CI)$/i.test(e)||/^(?:SETUP_VP_|RUNNER_|GITHUB_|CI_|SYSTEM_|AGENT_|BUILD_|RELEASE_)/i.test(e)}function writeUserConfig(e,t,n){let r=o(f.join(C(),`setup-vp-npmrc-`)),i=f.join(r,`.npmrc`);d(i,e,{encoding:`utf8`,mode:384});for(let e of[`NPM_CONFIG_USERCONFIG`,`PNPM_CONFIG_USERCONFIG`])t[e]=i,n?.(e,i);return i}function configureAuth(e,t,n,r,i){if(!e){if(!i)return;let{envVarRefs:e}=analyzeProjectNpmrc(readNpmrc(f.join(i,`.npmrc`)));for(let t of e)!isReservedAuthVariable(t)&&n[t]&&r?.(t,n[t]);return}let a;try{a=new URL(e)}catch{throw Error(`Invalid registry-url: "${e}". Must be a valid URL.`)}let o=a.href.endsWith(`/`)?a.href:`${a.href}/`,s=``;t&&(s=`${(t.startsWith(`@`)?t:`@${t}`).toLowerCase()}:`);let c=o.replace(/^\w+:/,``).toLowerCase(),l=readUserConfigLines(n,/* @__PURE__ */ new Set([`${s}registry`,`${c}:_authtoken`]));l.push(`${c}:_authToken=\${NODE_AUTH_TOKEN}`,`${s}registry=${o}`);let u=writeUserConfig(l.filter(Boolean).join(` `)+` diff --git a/dist/gitlab/index.mjs b/dist/gitlab/index.mjs index 4a68b57..32efed9 100644 --- a/dist/gitlab/index.mjs +++ b/dist/gitlab/index.mjs @@ -136,7 +136,7 @@ default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.l /* istanbul ignore else should not happen */ n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let t=this.peek(2);if(t.type===`block-map`&&(this.type===`map-value-ind`&&t.indent===e.indent||this.type===`newline`&&!t.items[t.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type===`map-value-ind`&&t.type!==`flow-collection`){let n=getFirstKeyStartProps(getPrevProps(t));fixFlowSeqItems(e);let r=e.end.splice(1,e.end.length);r.push(this.sourceToken);let i={type:`block-map`,offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let e=this.source.indexOf(` `)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(` -`,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=getFirstKeyStartProps(getPrevProps(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=getFirstKeyStartProps(getPrevProps(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}}})),ot=/* @__PURE__ */ __commonJSMin((e=>{var t=Qe(),n=G(),r=K(),i=_e(),a=O(),o=it(),s=at();function parseOptions(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new o.LineCounter||null,prettyErrors:t}}function parseAllDocuments(e,n={}){let{lineCounter:i,prettyErrors:a}=parseOptions(n),o=new s.Parser(i?.addNewLine),c=new t.Composer(n),l=Array.from(c.compose(o.parse(e)));if(a&&i)for(let t of l)t.errors.forEach(r.prettifyError(e,i)),t.warnings.forEach(r.prettifyError(e,i));return l.length>0?l:Object.assign([],{empty:!0},c.streamInfo())}function parseDocument(e,n={}){let{lineCounter:i,prettyErrors:a}=parseOptions(n),o=new s.Parser(i?.addNewLine),c=new t.Composer(n),l=null;for(let t of c.compose(o.parse(e),!0,e.length))if(!l)l=t;else if(l.options.logLevel!==`silent`){l.errors.push(new r.YAMLParseError(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return a&&i&&(l.errors.forEach(r.prettifyError(e,i)),l.warnings.forEach(r.prettifyError(e,i))),l}function parse(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let a=parseDocument(e,n);if(!a)return null;if(a.warnings.forEach(e=>i.warn(a.options.logLevel,e)),a.errors.length>0){if(a.options.logLevel!==`silent`)throw a.errors[0];a.errors=[]}return a.toJS(Object.assign({reviver:r},n))}function stringify(e,t,r){let i=null;if(typeof t==`function`||Array.isArray(t)?i=t:r===void 0&&t&&(r=t),typeof r==`string`&&(r=r.length),typeof r==`number`){let e=Math.round(r);r=e<1?void 0:e>8?{indent:8}:{indent:e}}if(e===void 0){let{keepUndefined:e}=r??t??{};if(!e)return}return a.isDocument(e)&&!i?e.toString(r):new n.Document(e,i,r).toString(r)}e.parse=parse,e.parseAllDocuments=parseAllDocuments,e.parseDocument=parseDocument,e.stringify=stringify})),Y=(/* @__PURE__ */ __commonJSMin((e=>{var t=Qe(),n=G(),r=Le(),i=K(),a=M(),o=O(),s=R(),c=N(),l=z(),u=V();nt();var d=rt(),f=it(),p=at(),m=ot(),h=k();e.Composer=t.Composer,e.Document=n.Document,e.Schema=r.Schema,e.YAMLError=i.YAMLError,e.YAMLParseError=i.YAMLParseError,e.YAMLWarning=i.YAMLWarning,e.Alias=a.Alias,e.isAlias=o.isAlias,e.isCollection=o.isCollection,e.isDocument=o.isDocument,e.isMap=o.isMap,e.isNode=o.isNode,e.isPair=o.isPair,e.isScalar=o.isScalar,e.isSeq=o.isSeq,e.Pair=s.Pair,e.Scalar=c.Scalar,e.YAMLMap=l.YAMLMap,e.YAMLSeq=u.YAMLSeq,e.Lexer=d.Lexer,e.LineCounter=f.LineCounter,e.Parser=p.Parser,e.parse=m.parse,e.parseAllDocuments=m.parseAllDocuments,e.parseDocument=m.parseDocument,e.stringify=m.stringify,e.visit=h.visit,e.visitAsync=h.visitAsync})))();const X=`Vite+`,Z=`vite-plus`;function resolvePath$1(e,t){return _.isAbsolute(e)?e:_.join(t,e)}function isWithin(e,t){let n=_.relative(t,e);return!_.isAbsolute(n)&&n!==`..`&&!n.startsWith(`..${_.sep}`)}function resolveProjectDirectory(e){let{workingDirectory:t,workspaceRoot:n}=e,r=_.isAbsolute(t)?t:_.join(n,t);try{if(!m(r).isDirectory())throw Error(`working-directory is not a directory: ${t} (resolved to ${r})`)}catch(e){throw e instanceof Error&&`code`in e&&e.code===`ENOENT`?Error(`working-directory not found: ${t} (resolved to ${r})`):e}return r}function isWindows(e=process.platform){return e===`win32`}function run(e,t,n={}){let r=E(e,t,{stdio:`inherit`,...n});if(r.error)throw r.error;if(r.status!==0)throw Error(`${e} ${t.join(` `)} exited with code ${r.status??1}`)}function runWithOutput(e,t,n={}){return new Promise((r,i)=>{let a=T(e,t,{...n,stdio:[`ignore`,`pipe`,`pipe`]}),o=``,s=``;a.stdout.on(`data`,e=>{process.stdout.write(e),o=(o+e.toString()).slice(-4e3)}),a.stderr.on(`data`,e=>{process.stderr.write(e),s=(s+e.toString()).slice(-4e3)}),a.on(`error`,i),a.on(`close`,e=>r({exitCode:e??1,stdout:o,stderr:s}))})}function commandPath(e,r=process.env){if(!e||e===`.`||e===`..`||/[\\/:]/.test(e))return;let i=isWindows(),a=i?Object.keys(r).sort().find(e=>e.toUpperCase()===`PATH`):`PATH`,o=a&&r[a]||``,s=i&&!e.toLowerCase().endsWith(`.exe`)?`${e}.exe`:e,c=m(process.cwd(),{bigint:!0});for(let e of o.split(_.delimiter)){let r=i?e.replace(/^"(.*)"$/,`$1`):e;if(_.isAbsolute(r))try{let e=m(r,{bigint:!0});if(e.dev===c.dev&&e.ino===c.ino)continue;let a=_.join(r,s);if(!m(a).isFile())continue;return t(a,i?n.F_OK:n.X_OK),a}catch{}}}function getCommandOutput(e,t,n){let r=E(e,t,{cwd:n?.cwd,encoding:`utf8`,stdio:[`ignore`,`pipe`,`pipe`]});if(r.status===0)return r.stdout.trim()}const st=[{filename:`pnpm-lock.yaml`,type:`pnpm`},{filename:`bun.lockb`,type:`bun`},{filename:`bun.lock`,type:`bun`},{filename:`package-lock.json`,type:`npm`},{filename:`npm-shrinkwrap.json`,type:`npm`},{filename:`yarn.lock`,type:`yarn`}];function resolvePath(e,t){return b(e)?e:x(t,e)}function inferLockFileType(e,t){return t.includes(`pnpm`)?{type:`pnpm`,path:e,filename:t}:t.includes(`yarn`)?{type:`yarn`,path:e,filename:t}:t.startsWith(`bun.`)?{type:`bun`,path:e,filename:t}:{type:`npm`,path:e,filename:t}}function detectLockFile(e,t){if(e){let n=resolvePath(e,t);if(o(n)){let e=v(n),t=st.find(t=>t.filename===e);return t?{type:t.type,path:n,filename:e}:inferLockFileType(n,e)}return}let n=d(t);for(let e of st)if(n.includes(e.filename)){let n=x(t,e.filename);return{type:e.type,path:n,filename:e.filename}}}function prepareCacheMetadata(e){let{projectDir:t,cacheDependencyPath:n,logWarning:r}=e,i=detectLockFile(n||void 0,t);if(!i)return r?.(`setup-vp: cache is enabled but no supported lock file was found; skipping cache.`),{ready:!1};let a=getCommandOutput(`vp`,[`pm`,`cache`,`dir`],{cwd:_.dirname(i.path)});return a?{ready:!0,cachePath:a,lockFile:i.path,lockType:i.type}:(r?.(`setup-vp: could not resolve package-manager cache directory for ${i.filename}; skipping cache.`),{ready:!1})}function createLockfileResolver(e){let{getWorkspaceDir:t,info:n,debug:r}=e,i=/^\d+\.\d+\.\d+/;function tryResolveVitePlusVersionFromLockfile(e,t){let i=detectLockfileForProject(e,t);if(!i)return;let a=i.filename.endsWith(`.lockb`)?textBunLockBeside(i):i;if(!a){r(`Cannot read ${i.filename} (binary) to resolve the ${X} version; using "latest". Use the text bun.lock, or set the \`version\` input.`);return}let o=parseVitePlusVersionFromLockfile(a,workspaceSubPath(y(a.path),e));if(o)return n(`Resolved ${X} version '${o}' from ${a.filename}`),o;r(`No ${X} version found in ${a.path}`)}function detectLockfileForProject(e,n){if(n)return detectLockFile(n,e);let r=t(),i=e;for(;;){let e=detectLockFile(void 0,i);if(e)return e;let t=y(i);if(i===r||t===i||!isWithin(t,r))break;i=t}}function textBunLockBeside(e){let t=x(y(e.path),`bun.lock`);return o(t)?{type:`bun`,path:t,filename:`bun.lock`}:void 0}function workspaceSubPath(e,t){if(!isWithin(t,e))return``;let n=S(e,t);return n?n.split(C).join(`/`):``}function parseVitePlusVersionFromLockfile(e,t=``){if(e.filename.endsWith(`.lockb`))return;let n;try{n=u(e.path,`utf-8`)}catch{return}let r;switch(e.type){case`npm`:r=fromNpmLock(n,t);break;case`pnpm`:r=fromPnpmLock(n,t);break;case`yarn`:r=fromYarnLock(n);break;case`bun`:r=fromBunTextLock(n);break;default:return}return r&&i.test(r)?r:void 0}function fromNpmLock(e,t){let n;try{n=JSON.parse(e)}catch{return}let r=n.packages;if(t){let e=r?.[`${t}/node_modules/${Z}`]?.version;if(typeof e==`string`)return e;if(!npmPackageDeclaresVitePlus(r?.[t]))return}let i=r?.[`node_modules/${Z}`]?.version;if(typeof i==`string`)return i;let a=n.dependencies?.[Z]?.version;return typeof a==`string`?a:void 0}function npmPackageDeclaresVitePlus(e){if(!e)return!1;for(let t of[`dependencies`,`devDependencies`]){let n=e[t];if(n&&typeof n==`object`&&`vite-plus`in n)return!0}return!1}function fromPnpmLock(e,t){let n;try{n=(0,Y.parse)(e)}catch{return}if(!n||typeof n!=`object`)return;let r=n,i=r.importers;if(i&&typeof i==`object`){let e=t||`.`;return e in i?pnpmImporterVersion(i[e]):void 0}return pnpmImporterVersion(r)||e.match(/^\s*\/?vite-plus@(\d+\.\d+\.\d+[^\s():'"]*)/m)?.[1]}function pnpmImporterVersion(e){if(!e||typeof e!=`object`)return;let t=e;for(let e of[`dependencies`,`devDependencies`,`optionalDependencies`]){let n=t[e];if(n&&typeof n==`object`){let e=n[Z],t=typeof e==`string`?e:e?.version;if(typeof t==`string`){let e=t.replace(/\(.*$/,``).trim();if(i.test(e))return e}}}}function fromYarnLock(e){let t=/* @__PURE__ */ new Set,n=e.split(/\r?\n/);for(let e=0;ee.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}}})),ot=/* @__PURE__ */ __commonJSMin((e=>{var t=Qe(),n=G(),r=K(),i=_e(),a=O(),o=it(),s=at();function parseOptions(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new o.LineCounter||null,prettyErrors:t}}function parseAllDocuments(e,n={}){let{lineCounter:i,prettyErrors:a}=parseOptions(n),o=new s.Parser(i?.addNewLine),c=new t.Composer(n),l=Array.from(c.compose(o.parse(e)));if(a&&i)for(let t of l)t.errors.forEach(r.prettifyError(e,i)),t.warnings.forEach(r.prettifyError(e,i));return l.length>0?l:Object.assign([],{empty:!0},c.streamInfo())}function parseDocument(e,n={}){let{lineCounter:i,prettyErrors:a}=parseOptions(n),o=new s.Parser(i?.addNewLine),c=new t.Composer(n),l=null;for(let t of c.compose(o.parse(e),!0,e.length))if(!l)l=t;else if(l.options.logLevel!==`silent`){l.errors.push(new r.YAMLParseError(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return a&&i&&(l.errors.forEach(r.prettifyError(e,i)),l.warnings.forEach(r.prettifyError(e,i))),l}function parse(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let a=parseDocument(e,n);if(!a)return null;if(a.warnings.forEach(e=>i.warn(a.options.logLevel,e)),a.errors.length>0){if(a.options.logLevel!==`silent`)throw a.errors[0];a.errors=[]}return a.toJS(Object.assign({reviver:r},n))}function stringify(e,t,r){let i=null;if(typeof t==`function`||Array.isArray(t)?i=t:r===void 0&&t&&(r=t),typeof r==`string`&&(r=r.length),typeof r==`number`){let e=Math.round(r);r=e<1?void 0:e>8?{indent:8}:{indent:e}}if(e===void 0){let{keepUndefined:e}=r??t??{};if(!e)return}return a.isDocument(e)&&!i?e.toString(r):new n.Document(e,i,r).toString(r)}e.parse=parse,e.parseAllDocuments=parseAllDocuments,e.parseDocument=parseDocument,e.stringify=stringify})),Y=(/* @__PURE__ */ __commonJSMin((e=>{var t=Qe(),n=G(),r=Le(),i=K(),a=M(),o=O(),s=R(),c=N(),l=z(),u=V();nt();var d=rt(),f=it(),p=at(),m=ot(),h=k();e.Composer=t.Composer,e.Document=n.Document,e.Schema=r.Schema,e.YAMLError=i.YAMLError,e.YAMLParseError=i.YAMLParseError,e.YAMLWarning=i.YAMLWarning,e.Alias=a.Alias,e.isAlias=o.isAlias,e.isCollection=o.isCollection,e.isDocument=o.isDocument,e.isMap=o.isMap,e.isNode=o.isNode,e.isPair=o.isPair,e.isScalar=o.isScalar,e.isSeq=o.isSeq,e.Pair=s.Pair,e.Scalar=c.Scalar,e.YAMLMap=l.YAMLMap,e.YAMLSeq=u.YAMLSeq,e.Lexer=d.Lexer,e.LineCounter=f.LineCounter,e.Parser=p.Parser,e.parse=m.parse,e.parseAllDocuments=m.parseAllDocuments,e.parseDocument=m.parseDocument,e.stringify=m.stringify,e.visit=h.visit,e.visitAsync=h.visitAsync})))();const X=`Vite+`,Z=`vite-plus`;function resolvePath$1(e,t){return _.isAbsolute(e)?e:_.join(t,e)}function isWithin(e,t){let n=_.relative(t,e);return!_.isAbsolute(n)&&n!==`..`&&!n.startsWith(`..${_.sep}`)}function resolveProjectDirectory(e){let{workingDirectory:t,workspaceRoot:n}=e,r=_.isAbsolute(t)?t:_.join(n,t);try{if(!m(r).isDirectory())throw Error(`working-directory is not a directory: ${t} (resolved to ${r})`)}catch(e){throw e instanceof Error&&`code`in e&&e.code===`ENOENT`?Error(`working-directory not found: ${t} (resolved to ${r})`):e}return r}function isWindows(e=process.platform){return e===`win32`}function run(e,t,n={}){let r=E(e,t,{stdio:`inherit`,...n});if(r.error)throw r.error;if(r.status!==0)throw Error(`${e} ${t.join(` `)} exited with code ${r.status??1}`)}function runWithOutput(e,t,n={}){return new Promise((r,i)=>{let a=T(e,t,{...n,stdio:[`ignore`,`pipe`,`pipe`]}),o=``,s=``;a.stdout.on(`data`,e=>{process.stdout.write(e),o=(o+e.toString()).slice(-4e3)}),a.stderr.on(`data`,e=>{process.stderr.write(e),s=(s+e.toString()).slice(-4e3)}),a.on(`error`,i),a.on(`close`,e=>r({exitCode:e??1,stdout:o,stderr:s}))})}function commandPath(e,r=process.env){if(!e||e===`.`||e===`..`||/[\\/:]/.test(e))return;let i=isWindows(),a=i?Object.keys(r).sort().find(e=>e.toUpperCase()===`PATH`):`PATH`,o=a&&r[a]||``,s=i&&!e.toLowerCase().endsWith(`.exe`)?`${e}.exe`:e,c=m(process.cwd(),{bigint:!0});for(let e of o.split(_.delimiter)){let r=i?e.replace(/^"(.*)"$/,`$1`):e;if(_.isAbsolute(r)&&!(i&&_.parse(r).root.length===1))try{let e=m(r,{bigint:!0});if(e.dev===c.dev&&e.ino===c.ino)continue;let a=_.join(r,s);if(!m(a).isFile())continue;return t(a,i?n.F_OK:n.X_OK),a}catch{}}}function getCommandOutput(e,t,n){let r=E(e,t,{cwd:n?.cwd,encoding:`utf8`,stdio:[`ignore`,`pipe`,`pipe`]});if(r.status===0)return r.stdout.trim()}const st=[{filename:`pnpm-lock.yaml`,type:`pnpm`},{filename:`bun.lockb`,type:`bun`},{filename:`bun.lock`,type:`bun`},{filename:`package-lock.json`,type:`npm`},{filename:`npm-shrinkwrap.json`,type:`npm`},{filename:`yarn.lock`,type:`yarn`}];function resolvePath(e,t){return b(e)?e:x(t,e)}function inferLockFileType(e,t){return t.includes(`pnpm`)?{type:`pnpm`,path:e,filename:t}:t.includes(`yarn`)?{type:`yarn`,path:e,filename:t}:t.startsWith(`bun.`)?{type:`bun`,path:e,filename:t}:{type:`npm`,path:e,filename:t}}function detectLockFile(e,t){if(e){let n=resolvePath(e,t);if(o(n)){let e=v(n),t=st.find(t=>t.filename===e);return t?{type:t.type,path:n,filename:e}:inferLockFileType(n,e)}return}let n=d(t);for(let e of st)if(n.includes(e.filename)){let n=x(t,e.filename);return{type:e.type,path:n,filename:e.filename}}}function prepareCacheMetadata(e){let{projectDir:t,cacheDependencyPath:n,logWarning:r}=e,i=detectLockFile(n||void 0,t);if(!i)return r?.(`setup-vp: cache is enabled but no supported lock file was found; skipping cache.`),{ready:!1};let a=getCommandOutput(`vp`,[`pm`,`cache`,`dir`],{cwd:_.dirname(i.path)});return a?{ready:!0,cachePath:a,lockFile:i.path,lockType:i.type}:(r?.(`setup-vp: could not resolve package-manager cache directory for ${i.filename}; skipping cache.`),{ready:!1})}function createLockfileResolver(e){let{getWorkspaceDir:t,info:n,debug:r}=e,i=/^\d+\.\d+\.\d+/;function tryResolveVitePlusVersionFromLockfile(e,t){let i=detectLockfileForProject(e,t);if(!i)return;let a=i.filename.endsWith(`.lockb`)?textBunLockBeside(i):i;if(!a){r(`Cannot read ${i.filename} (binary) to resolve the ${X} version; using "latest". Use the text bun.lock, or set the \`version\` input.`);return}let o=parseVitePlusVersionFromLockfile(a,workspaceSubPath(y(a.path),e));if(o)return n(`Resolved ${X} version '${o}' from ${a.filename}`),o;r(`No ${X} version found in ${a.path}`)}function detectLockfileForProject(e,n){if(n)return detectLockFile(n,e);let r=t(),i=e;for(;;){let e=detectLockFile(void 0,i);if(e)return e;let t=y(i);if(i===r||t===i||!isWithin(t,r))break;i=t}}function textBunLockBeside(e){let t=x(y(e.path),`bun.lock`);return o(t)?{type:`bun`,path:t,filename:`bun.lock`}:void 0}function workspaceSubPath(e,t){if(!isWithin(t,e))return``;let n=S(e,t);return n?n.split(C).join(`/`):``}function parseVitePlusVersionFromLockfile(e,t=``){if(e.filename.endsWith(`.lockb`))return;let n;try{n=u(e.path,`utf-8`)}catch{return}let r;switch(e.type){case`npm`:r=fromNpmLock(n,t);break;case`pnpm`:r=fromPnpmLock(n,t);break;case`yarn`:r=fromYarnLock(n);break;case`bun`:r=fromBunTextLock(n);break;default:return}return r&&i.test(r)?r:void 0}function fromNpmLock(e,t){let n;try{n=JSON.parse(e)}catch{return}let r=n.packages;if(t){let e=r?.[`${t}/node_modules/${Z}`]?.version;if(typeof e==`string`)return e;if(!npmPackageDeclaresVitePlus(r?.[t]))return}let i=r?.[`node_modules/${Z}`]?.version;if(typeof i==`string`)return i;let a=n.dependencies?.[Z]?.version;return typeof a==`string`?a:void 0}function npmPackageDeclaresVitePlus(e){if(!e)return!1;for(let t of[`dependencies`,`devDependencies`]){let n=e[t];if(n&&typeof n==`object`&&`vite-plus`in n)return!0}return!1}function fromPnpmLock(e,t){let n;try{n=(0,Y.parse)(e)}catch{return}if(!n||typeof n!=`object`)return;let r=n,i=r.importers;if(i&&typeof i==`object`){let e=t||`.`;return e in i?pnpmImporterVersion(i[e]):void 0}return pnpmImporterVersion(r)||e.match(/^\s*\/?vite-plus@(\d+\.\d+\.\d+[^\s():'"]*)/m)?.[1]}function pnpmImporterVersion(e){if(!e||typeof e!=`object`)return;let t=e;for(let e of[`dependencies`,`devDependencies`,`optionalDependencies`]){let n=t[e];if(n&&typeof n==`object`){let e=n[Z],t=typeof e==`string`?e:e?.version;if(typeof t==`string`){let e=t.replace(/\(.*$/,``).trim();if(i.test(e))return e}}}}function fromYarnLock(e){let t=/* @__PURE__ */ new Set,n=e.split(/\r?\n/);for(let e=0;ee,info:console.info,debug:()=>{},warning:console.warn}}const ct=`https://raw.githubusercontent.com/voidzero-dev/vite-plus`,lt=`packages/cli`,ut=/^0\.0\.0-commit\.([0-9a-f]{40})$/i,dt=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;function pkgPrNewCommitSha(e){return e.match(ut)?.[1]}function getInstallScriptUrls(e,t=process.platform){let n=isWindows(t)?`install.ps1`:`install.sh`,r=installScriptRef(e);return{pinned:r?[`${ct}/${r}/${lt}/${n}`,`https://cdn.jsdelivr.net/gh/voidzero-dev/vite-plus@${r}/${lt}/${n}`]:[],latest:[`https://viteplus.dev/${n}`,`${ct}/main/${lt}/${n}`]}}function installScriptRef(e){let t=pkgPrNewCommitSha(e);if(t)return t.toLowerCase();if(dt.test(e))return`v${e}`}function parseInstalledVpVersion(e){return(e.match(/^\s*vp\s+v?(\d[^\s]*)/im)??e.match(/Global:\s*v?(\d[^\s]*)/i))?.[1]??`unknown`}const Q=`SETUP_VP_DIRS_FILE`;function getVitePlusBinDirs(e){let t=x(e.data,`fallback-bin`);return m(t,{throwIfNoEntry:!1})?.isDirectory()?{bin:e.bin,fallbackBin:t}:{bin:e.bin}}function appendFallbackBinToPath(e,t,n=process.platform){let r=isWindows(n)?`;`:`:`;return[...e?e.split(r).filter(e=>e!==t):[],t].join(r)}const ft=/^v?(\d+)\.(\d+)\.\d+(?:-[0-9A-Za-z.-]+)?$/;function supportsVitePlusDirs(e){if(pkgPrNewCommitSha(e))return!0;let t=e.match(ft);if(!t)return!0;let n=Number(t[1]),r=Number(t[2]);return n>0||r>=3}function createVitePlusDirsFile(){return x(te(),`setup-vp-dirs-${ie()}.txt`)}function removeVitePlusDirsFile(e){p(e,{force:!0})}function readVitePlusProbe(e){try{return u(e,`utf8`)}catch(e){if(e.code===`ENOENT`)return;throw e}}function resolveVitePlusBinDirs(e,t,n){if(!t){if(!supportsVitePlusDirs(e))return{bin:n};throw Error(`Vite+ was installed successfully, but setup-vp could not resolve its VpDirs.`)}let r=readVitePlusProbe(t),i=r===void 0?void 0:parseVitePlusDirs(r);if(i)return getVitePlusBinDirs(i);if(!(pkgPrNewCommitSha(e)!==void 0||ft.test(e))&&r!==void 0){let e=parseInstalledVpVersion(r);if(e!==`unknown`&&!supportsVitePlusDirs(e))return{bin:n}}throw Error(`Vite+ was installed successfully, but setup-vp could not resolve its VpDirs.`)}function parseVitePlusDirs(e){let t=/* @__PURE__ */ new Map;for(let n of e.split(/\r?\n/)){let e=n.indexOf(` `);if(e<1)continue;let r=n.slice(0,e).replace(/^\uFEFF/,``),i=n.slice(e+1).trim();i&&t.set(r,i)}let n=t.get(`data`),r=t.get(`bin`),i=t.get(`cache`),a=t.get(`config`),o=t.get(`state`);if(n&&r&&i&&a&&o)return{data:n,bin:r,cache:i,config:a,state:o}}function getInstallScriptCommand(e,t=process.platform,n=!0){if(isWindows(t))return n?{command:`pwsh`,args:[`-Command`,` $dirsFile = $env:${Q} diff --git a/dist/index.mjs b/dist/index.mjs index 6cdd96d..41d1831 100644 --- a/dist/index.mjs +++ b/dist/index.mjs @@ -329,6 +329,6 @@ default:throw Error(`Unexpected operation: ${e.operator}`)}}),o&&(!a||i(a,o))&&( More info on storage limits: https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions#calculating-minute-and-storage-spending`),this.name=`UsageError`}};UsageError.isUsageErrorMessage=e=>e?e.includes(`insufficient usage`):!1;var RateLimitError=class extends Error{constructor(e){super(e),this.name=`RateLimitError`}},__awaiter$6=function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})},UploadProgress=class{constructor(e){this.contentLength=e,this.sentBytes=0,this.displayedComplete=!1,this.startTime=Date.now()}setSentBytes(e){this.sentBytes=e}getTransferredBytes(){return this.sentBytes}isDone(){return this.getTransferredBytes()===this.contentLength}display(){if(this.displayedComplete)return;let e=this.sentBytes,t=(100*(e/this.contentLength)).toFixed(1),n=Date.now()-this.startTime,r=(e/1048576/(n/1e3)).toFixed(1);info(`Sent ${e} of ${this.contentLength} (${t}%), ${r} MBs/sec`),this.isDone()&&(this.displayedComplete=!0)}onProgress(){return e=>{this.setSentBytes(e.loadedBytes)}}startDisplayTimer(e=1e3){let displayCallback=()=>{this.display(),this.isDone()||(this.timeoutHandle=setTimeout(displayCallback,e))};this.timeoutHandle=setTimeout(displayCallback,e)}stopDisplayTimer(){this.timeoutHandle&&=(clearTimeout(this.timeoutHandle),void 0),this.display()}};function uploadCacheArchiveSDK(e,t,n){return __awaiter$6(this,void 0,void 0,function*(){let r=new k_(e),i=r.getBlockBlobClient(),a=new UploadProgress(n?.archiveSizeBytes??0),o={blockSize:n?.uploadChunkSize,concurrency:n?.uploadConcurrency,maxSingleShotSize:134217728,onProgress:a.onProgress()};try{a.startDisplayTimer(),debug(`BlobClient: ${r.name}:${r.accountName}:${r.containerName}`);let e=yield i.uploadFile(t,o);if(e._response.status>=400)throw new InvalidResponseError(`uploadCacheArchiveSDK: upload failed with status code ${e._response.status}`);return e}catch(e){throw warning(`uploadCacheArchiveSDK: internal error uploading cache archive: ${e.message}`),e}finally{a.stopDisplayTimer()}})}var __awaiter$5=function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})};function isSuccessStatusCode(e){return e?e>=200&&e<300:!1}function isServerErrorStatusCode(e){return!e||e>=500}function isRetryableStatusCode(e){return e?[On.BadGateway,On.ServiceUnavailable,On.GatewayTimeout].includes(e):!1}function sleep(e){return __awaiter$5(this,void 0,void 0,function*(){return new Promise(t=>setTimeout(t,e))})}function retry(e,t,n){return __awaiter$5(this,arguments,void 0,function*(e,t,n,r=2,i=us,a=void 0){let o=``,s=1;for(;s<=r;){let c,l,u=!1;try{c=yield t()}catch(e){a&&(c=a(e)),u=!0,o=e.message}if(c&&(l=n(c),!isServerErrorStatusCode(l)))return c;if(l&&(u=isRetryableStatusCode(l),o=`Cache service responded with ${l}`),debug(`${e} - Attempt ${s} of ${r} failed with error: ${o}`),!u){debug(`${e} - Error is not retryable`);break}yield sleep(i),s++}throw Error(`${e} failed: ${o}`)})}function retryTypedResponse(e,t){return __awaiter$5(this,arguments,void 0,function*(e,t,n=2,r=us){return yield retry(e,t,e=>e.statusCode,n,r,e=>{if(e instanceof Pn)return{statusCode:e.statusCode,result:null,headers:{},error:e}})})}function retryHttpClientResponse(e,t){return __awaiter$5(this,arguments,void 0,function*(e,t,n=2,r=us){return yield retry(e,t,e=>e.message.statusCode,n,r)})}var __awaiter$4=function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})};function pipeResponseToStream(e,t){return __awaiter$4(this,void 0,void 0,function*(){yield v.promisify(Te.pipeline)(e.message,t)})}var DownloadProgress=class{constructor(e){this.contentLength=e,this.segmentIndex=0,this.segmentSize=0,this.segmentOffset=0,this.receivedBytes=0,this.displayedComplete=!1,this.startTime=Date.now()}nextSegment(e){this.segmentOffset+=this.segmentSize,this.segmentIndex+=1,this.segmentSize=e,this.receivedBytes=0,debug(`Downloading segment at offset ${this.segmentOffset} with length ${this.segmentSize}...`)}setReceivedBytes(e){this.receivedBytes=e}getTransferredBytes(){return this.segmentOffset+this.receivedBytes}isDone(){return this.getTransferredBytes()===this.contentLength}display(){if(this.displayedComplete)return;let e=this.segmentOffset+this.receivedBytes,t=(100*(e/this.contentLength)).toFixed(1),n=Date.now()-this.startTime,r=(e/1048576/(n/1e3)).toFixed(1);info(`Received ${e} of ${this.contentLength} (${t}%), ${r} MBs/sec`),this.isDone()&&(this.displayedComplete=!0)}onProgress(){return e=>{this.setReceivedBytes(e.loadedBytes)}}startDisplayTimer(e=1e3){let displayCallback=()=>{this.display(),this.isDone()||(this.timeoutHandle=setTimeout(displayCallback,e))};this.timeoutHandle=setTimeout(displayCallback,e)}stopDisplayTimer(){this.timeoutHandle&&=(clearTimeout(this.timeoutHandle),void 0),this.display()}};function downloadCacheHttpClient(e,t){return __awaiter$4(this,void 0,void 0,function*(){let n=a.createWriteStream(t),r=new HttpClient(`actions/cache`),i=yield retryHttpClientResponse(`downloadCache`,()=>__awaiter$4(this,void 0,void 0,function*(){return r.get(e)}));i.message.socket.setTimeout(ds,()=>{i.message.destroy(),debug(`Aborting download, socket timed out after ${ds} ms`)}),yield pipeResponseToStream(i,n);let o=i.message.headers[`content-length`];if(o){let e=parseInt(o),n=getArchiveFileSizeInBytes(t);if(n!==e)throw Error(`Incomplete download. Expected file size: ${e}, actual file size: ${n}`)}else debug(`Unable to validate download, no Content-Length header`)})}function downloadCacheHttpClientConcurrent(e,t,n){return __awaiter$4(this,void 0,void 0,function*(){let r=yield a.promises.open(t,`w`),i=new HttpClient(`actions/cache`,void 0,{socketTimeout:n.timeoutInMs,keepAlive:!0});try{let t=(yield retryHttpClientResponse(`downloadCacheMetadata`,()=>__awaiter$4(this,void 0,void 0,function*(){return yield i.request(`HEAD`,e,null,{})}))).message.headers[`content-length`];if(t==null)throw Error(`Content-Length not found on blob response`);let a=parseInt(t);if(Number.isNaN(a))throw Error(`Could not interpret Content-Length: ${a}`);let o=[],s=4194304;for(let t=0;t__awaiter$4(this,void 0,void 0,function*(){return yield downloadSegmentRetry(i,e,t,n)})})}o.reverse();let c=0,l=0,u=new DownloadProgress(a);u.startDisplayTimer();let d=u.onProgress(),f=[],p,waitAndWrite=()=>__awaiter$4(this,void 0,void 0,function*(){let e=yield Promise.race(Object.values(f));yield r.write(e.buffer,0,e.count,e.offset),c--,delete f[e.offset],l+=e.count,d({loadedBytes:l})});for(;p=o.pop();)f[p.offset]=p.promiseGetter(),c++,c>=(n.downloadConcurrency??10)&&(yield waitAndWrite());for(;c>0;)yield waitAndWrite()}finally{i.dispose(),yield r.close()}})}function downloadSegmentRetry(e,t,n,r){return __awaiter$4(this,void 0,void 0,function*(){let i=0;for(;;)try{let i=yield promiseWithTimeout(3e4,downloadSegment(e,t,n,r));if(typeof i==`string`)throw Error(`downloadSegmentRetry failed due to timeout`);return i}catch(e){if(i>=5)throw e;i++}})}function downloadSegment(e,t,n,r){return __awaiter$4(this,void 0,void 0,function*(){let i=yield retryHttpClientResponse(`downloadCachePart`,()=>__awaiter$4(this,void 0,void 0,function*(){return yield e.get(t,{Range:`bytes=${n}-${n+r-1}`})}));if(!i.readBodyBuffer)throw Error(`Expected HttpClientResponse to implement readBodyBuffer`);return{offset:n,count:r,buffer:yield i.readBodyBuffer()}})}function downloadCacheStorageSDK(e,t,n){return __awaiter$4(this,void 0,void 0,function*(){let r=new j_(e,void 0,{retryOptions:{tryTimeoutInMs:n.timeoutInMs}}),i=(yield r.getProperties()).contentLength??-1;if(i<0)debug(`Unable to determine content length, downloading file with http-client...`),yield downloadCacheHttpClient(e,t);else{let e=Math.min(134217728,ee.constants.MAX_LENGTH),o=new DownloadProgress(i),s=a.openSync(t,`w`);try{o.startDisplayTimer();let t=new AbortController,c=t.signal;for(;!o.isDone();){let l=o.segmentOffset+o.segmentSize,u=Math.min(e,i-l);o.nextSegment(u);let d=yield promiseWithTimeout(n.segmentTimeoutInMs||36e5,r.downloadToBuffer(l,u,{abortSignal:c,concurrency:n.downloadConcurrency,onProgress:o.onProgress()}));if(d===`timeout`)throw t.abort(),Error(`Aborting cache download as the download time exceeded the timeout.`);Buffer.isBuffer(d)&&a.writeFileSync(s,d)}}finally{o.stopDisplayTimer(),a.closeSync(s)}}})}const promiseWithTimeout=(e,t)=>__awaiter$4(void 0,void 0,void 0,function*(){let n,r=new Promise(t=>{n=setTimeout(()=>t(`timeout`),e)});return Promise.race([t,r]).then(e=>(clearTimeout(n),e))});function getUploadOptions(e){let t={useAzureSdk:!1,uploadConcurrency:4,uploadChunkSize:33554432};return e&&(typeof e.useAzureSdk==`boolean`&&(t.useAzureSdk=e.useAzureSdk),typeof e.uploadConcurrency==`number`&&(t.uploadConcurrency=e.uploadConcurrency),typeof e.uploadChunkSize==`number`&&(t.uploadChunkSize=e.uploadChunkSize)),t.uploadConcurrency=isNaN(Number(process.env.CACHE_UPLOAD_CONCURRENCY))?t.uploadConcurrency:Math.min(32,Number(process.env.CACHE_UPLOAD_CONCURRENCY)),t.uploadChunkSize=isNaN(Number(process.env.CACHE_UPLOAD_CHUNK_SIZE))?t.uploadChunkSize:Math.min(134217728,Number(process.env.CACHE_UPLOAD_CHUNK_SIZE)*1024*1024),debug(`Use Azure SDK: ${t.useAzureSdk}`),debug(`Upload concurrency: ${t.uploadConcurrency}`),debug(`Upload chunk size: ${t.uploadChunkSize}`),t}function getDownloadOptions(e){let t={useAzureSdk:!1,concurrentBlobDownloads:!0,downloadConcurrency:8,timeoutInMs:3e4,segmentTimeoutInMs:6e5,lookupOnly:!1};e&&(typeof e.useAzureSdk==`boolean`&&(t.useAzureSdk=e.useAzureSdk),typeof e.concurrentBlobDownloads==`boolean`&&(t.concurrentBlobDownloads=e.concurrentBlobDownloads),typeof e.downloadConcurrency==`number`&&(t.downloadConcurrency=e.downloadConcurrency),typeof e.timeoutInMs==`number`&&(t.timeoutInMs=e.timeoutInMs),typeof e.segmentTimeoutInMs==`number`&&(t.segmentTimeoutInMs=e.segmentTimeoutInMs),typeof e.lookupOnly==`boolean`&&(t.lookupOnly=e.lookupOnly));let n=process.env.SEGMENT_DOWNLOAD_TIMEOUT_MINS;return n&&!isNaN(Number(n))&&isFinite(Number(n))&&(t.segmentTimeoutInMs=Number(n)*60*1e3),debug(`Use Azure SDK: ${t.useAzureSdk}`),debug(`Download concurrency: ${t.downloadConcurrency}`),debug(`Request timeout (ms): ${t.timeoutInMs}`),debug(`Cache segment download timeout mins env var: ${process.env.SEGMENT_DOWNLOAD_TIMEOUT_MINS}`),debug(`Segment download timeout (ms): ${t.segmentTimeoutInMs}`),debug(`Lookup only: ${t.lookupOnly}`),t}function isGhes(){let e=new URL(process.env.GITHUB_SERVER_URL||`https://github.com`).hostname.trimEnd().toUpperCase(),t=e===`GITHUB.COM`,n=e.endsWith(`.GHE.COM`),r=e.endsWith(`.LOCALHOST`);return!t&&!n&&!r}function getCacheServiceVersion(){return isGhes()?`v1`:process.env.ACTIONS_CACHE_SERVICE_V2?`v2`:`v1`}const N_=[`none`,`read`,`write`,`write-only`];function getCacheMode(){return(process.env.ACTIONS_CACHE_MODE||``).trim().toLowerCase()}function isCacheReadable(e){return!N_.includes(e)||e===`read`||e===`write`}function isCacheWritable(e){return!N_.includes(e)||e===`write`||e===`write-only`}function getCacheServiceURL(){let e=getCacheServiceVersion();switch(e){case`v1`:return process.env.ACTIONS_CACHE_URL||process.env.ACTIONS_RESULTS_URL||``;case`v2`:return process.env.ACTIONS_RESULTS_URL||``;default:throw Error(`Unsupported cache service version: ${e}`)}}var P_=/* @__PURE__ */ __commonJSMin(((e,t)=>{t.exports={name:`@actions/cache`,version:`6.3.0`,description:`Actions cache lib`,keywords:[`github`,`actions`,`cache`],homepage:`https://github.com/actions/toolkit/tree/main/packages/cache`,license:`MIT`,type:`module`,main:`lib/cache.js`,types:`lib/cache.d.ts`,exports:{".":{types:`./lib/cache.d.ts`,import:`./lib/cache.js`}},directories:{lib:`lib`,test:`__tests__`},files:[`lib`,`!.DS_Store`],publishConfig:{access:`public`},repository:{type:`git`,url:`git+https://github.com/actions/toolkit.git`,directory:`packages/cache`},scripts:{"audit-moderate":`npm install && npm audit --json --audit-level=moderate > audit.json`,test:`echo "Error: run tests from root" && exit 1`,tsc:`tsc && cp src/internal/shared/package-version.cjs lib/internal/shared/`},bugs:{url:`https://github.com/actions/toolkit/issues`},dependencies:{"@actions/core":`^3.0.1`,"@actions/exec":`^3.0.0`,"@actions/glob":`^0.7.0`,"@actions/http-client":`^4.0.1`,"@actions/io":`^3.0.2`,"@azure/core-rest-pipeline":`~1.23.0`,"@azure/storage-blob":`~12.31.0`,"@protobuf-ts/runtime-rpc":`^2.11.1`,semver:`^7.8.5`},devDependencies:{"@protobuf-ts/plugin":`^2.11.1`,"@types/node":`^25.9.8`,"@types/semver":`^7.8.0`,typescript:`^5.9.3`},overrides:{"uri-js":`npm:uri-js-replace@^1.0.1`,"node-fetch":`^3.3.2`}}})),F_=(/* @__PURE__ */ __commonJSMin(((e,t)=>{t.exports={version:P_().version}})))();function getUserAgentString(){return`@actions/cache-${F_.version}`}var __awaiter$3=function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})};function getCacheApiUrl(e){let t=getCacheServiceURL();if(!t)throw Error(`Cache Service Url not found, unable to restore cache.`);let n=`${t}_apis/artifactcache/${e}`;return debug(`Resource Url: ${n}`),n}function createAcceptHeader(e,t){return`${e};api-version=${t}`}function getRequestOptions(){return{headers:{Accept:createAcceptHeader(`application/json`,`6.0-preview.1`)}}}function createHttpClient(){let e=new BearerCredentialHandler(process.env.ACTIONS_RUNTIME_TOKEN||``);return new HttpClient(getUserAgentString(),[e],getRequestOptions())}function getCacheEntry(e,t,n){return __awaiter$3(this,void 0,void 0,function*(){let r=createHttpClient(),i=getCacheVersion(t,n?.compressionMethod,n?.enableCrossOsArchive),a=`cache?keys=${encodeURIComponent(e.join(`,`))}&version=${i}`,o=yield retryTypedResponse(`getCacheEntry`,()=>__awaiter$3(this,void 0,void 0,function*(){return r.getJson(getCacheApiUrl(a))}));if(o.statusCode===204)return isDebug()&&(yield printCachesListForDiagnostics(e[0],r,i)),null;if(!isSuccessStatusCode(o.statusCode)){let e=o.error?.message;throw e?.includes(`cache read denied:`)?Error(e):Error(`Cache service responded with ${o.statusCode}`)}let s=o.result,c=s?.archiveLocation;if(!c)throw Error(`Cache not found.`);return setSecret(c),debug(`Cache Result:`),debug(JSON.stringify(s)),s})}function printCachesListForDiagnostics(e,t,n){return __awaiter$3(this,void 0,void 0,function*(){let r=`caches?key=${encodeURIComponent(e)}`,i=yield retryTypedResponse(`listCache`,()=>__awaiter$3(this,void 0,void 0,function*(){return t.getJson(getCacheApiUrl(r))}));if(i.statusCode===200){let t=i.result,r=t?.totalCount;if(r&&r>0){debug(`No matching cache found for cache key '${e}', version '${n} and scope ${process.env.GITHUB_REF}. There exist one or more cache(s) with similar key but they have different version or scope. See more info on cache matching here: https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#matching-a-cache-key \nOther caches with similar key:`);for(let e of t?.artifactCaches||[])debug(`Cache Key: ${e?.cacheKey}, Cache Version: ${e?.cacheVersion}, Cache Scope: ${e?.scope}, Cache Created: ${e?.creationTime}`)}}})}function downloadCache(e,t,n){return __awaiter$3(this,void 0,void 0,function*(){let r=new De(e),i=getDownloadOptions(n);r.hostname.endsWith(`.blob.core.windows.net`)?i.useAzureSdk?yield downloadCacheStorageSDK(e,t,i):i.concurrentBlobDownloads?yield downloadCacheHttpClientConcurrent(e,t,i):yield downloadCacheHttpClient(e,t):yield downloadCacheHttpClient(e,t)})}function reserveCache(e,t,n){return __awaiter$3(this,void 0,void 0,function*(){let r=createHttpClient(),i={key:e,version:getCacheVersion(t,n?.compressionMethod,n?.enableCrossOsArchive),cacheSize:n?.cacheSize};return yield retryTypedResponse(`reserveCache`,()=>__awaiter$3(this,void 0,void 0,function*(){return r.postJson(getCacheApiUrl(`caches`),i)}))})}function getContentRange(e,t){return`bytes ${e}-${t}/*`}function uploadChunk(e,t,n,r,i){return __awaiter$3(this,void 0,void 0,function*(){debug(`Uploading chunk of size ${i-r+1} bytes at offset ${r} with content range: ${getContentRange(r,i)}`);let a={"Content-Type":`application/octet-stream`,"Content-Range":getContentRange(r,i)},o=yield retryHttpClientResponse(`uploadChunk (start: ${r}, end: ${i})`,()=>__awaiter$3(this,void 0,void 0,function*(){return e.sendStream(`PATCH`,t,n(),a)}));if(!isSuccessStatusCode(o.message.statusCode))throw Error(`Cache service responded with ${o.message.statusCode} during upload chunk.`)})}function uploadFile(e,t,n,r){return __awaiter$3(this,void 0,void 0,function*(){let i=getArchiveFileSizeInBytes(n),o=getCacheApiUrl(`caches/${t.toString()}`),s=a.openSync(n,`r`),c=getUploadOptions(r),l=assertDefined(`uploadConcurrency`,c.uploadConcurrency),u=assertDefined(`uploadChunkSize`,c.uploadChunkSize),d=[...Array(l).keys()];debug(`Awaiting all uploads`);let f=0;try{yield Promise.all(d.map(()=>__awaiter$3(this,void 0,void 0,function*(){for(;fa.createReadStream(n,{fd:s,start:r,end:c,autoClose:!1}).on(`error`,e=>{throw Error(`Cache upload failed because file read failed with ${e.message}`)}),r,c)}})))}finally{a.closeSync(s)}})}function commitCache(e,t,n){return __awaiter$3(this,void 0,void 0,function*(){let r={size:n};return yield retryTypedResponse(`commitCache`,()=>__awaiter$3(this,void 0,void 0,function*(){return e.postJson(getCacheApiUrl(`caches/${t.toString()}`),r)}))})}function saveCache$2(e,t,n,r){return __awaiter$3(this,void 0,void 0,function*(){if(getUploadOptions(r).useAzureSdk){if(!n)throw Error(`Azure Storage SDK can only be used when a signed URL is provided.`);yield uploadCacheArchiveSDK(n,t,r)}else{let n=createHttpClient();debug(`Upload cache`),yield uploadFile(n,e,t,r),debug(`Commiting cache`);let i=getArchiveFileSizeInBytes(t);info(`Cache Size: ~${Math.round(i/1048576)} MB (${i} B)`);let a=yield commitCache(n,e,i);if(!isSuccessStatusCode(a.statusCode))throw Error(`Cache service responded with ${a.statusCode} during commit cache.`);info(`Cache saved successfully`)}})}var I_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isJsonObject=e.typeofJsonValue=void 0;function typeofJsonValue(e){let t=typeof e;if(t==`object`){if(Array.isArray(e))return`array`;if(e===null)return`null`}return t}e.typeofJsonValue=typeofJsonValue;function isJsonObject(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}e.isJsonObject=isJsonObject})),L_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.base64encode=e.base64decode=void 0;let t=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`.split(``),n=[];for(let e=0;e>4,s=o,a=2;break;case 2:r[i++]=(s&15)<<4|(o&60)>>2,s=o,a=3;break;case 3:r[i++]=(s&3)<<6|o,a=0}}if(a==1)throw Error(`invalid base64 string.`);return r.subarray(0,i)}e.base64decode=base64decode;function base64encode(e){let n=``,r=0,i,a=0;for(let o=0;o>2],a=(i&3)<<4,r=1;break;case 1:n+=t[a|i>>4],a=(i&15)<<2,r=2;break;case 2:n+=t[a|i>>6],n+=t[i&63],r=0}return r&&(n+=t[a],n+=`=`,r==1&&(n+=`=`)),n}e.base64encode=base64encode})),R_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.utf8read=void 0;let fromCharCodes=e=>String.fromCharCode.apply(String,e);function utf8read(e){if(e.length<1)return``;let t=0,n=[],r=[],i=0,a,o=e.length;for(;t191&&a<224?r[i++]=(a&31)<<6|e[t++]&63:a>239&&a<365?(a=((a&7)<<18|(e[t++]&63)<<12|(e[t++]&63)<<6|e[t++]&63)-65536,r[i++]=55296+(a>>10),r[i++]=56320+(a&1023)):r[i++]=(a&15)<<12|(e[t++]&63)<<6|e[t++]&63,i>8191&&(n.push(fromCharCodes(r)),i=0);return n.length?(i&&n.push(fromCharCodes(r.slice(0,i))),n.join(``)):fromCharCodes(r.slice(0,i))}e.utf8read=utf8read})),z_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.WireType=e.mergeBinaryOptions=e.UnknownFieldHandler=void 0,(function(e){e.symbol=Symbol.for(`protobuf-ts/unknown`),e.onRead=(t,n,r,i,a)=>{(is(n)?n[e.symbol]:n[e.symbol]=[]).push({no:r,wireType:i,data:a})},e.onWrite=(t,n,r)=>{for(let{no:t,wireType:i,data:a}of e.list(n))r.tag(t,i).raw(a)},e.list=(t,n)=>{if(is(t)){let r=t[e.symbol];return n?r.filter(e=>e.no==n):r}return[]},e.last=(t,n)=>e.list(t,n).slice(-1)[0];let is=t=>t&&Array.isArray(t[e.symbol])})(e.UnknownFieldHandler||={});function mergeBinaryOptions(e,t){return Object.assign(Object.assign({},e),t)}e.mergeBinaryOptions=mergeBinaryOptions,(function(e){e[e.Varint=0]=`Varint`,e[e.Bit64=1]=`Bit64`,e[e.LengthDelimited=2]=`LengthDelimited`,e[e.StartGroup=3]=`StartGroup`,e[e.EndGroup=4]=`EndGroup`,e[e.Bit32=5]=`Bit32`})(e.WireType||={})})),B_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.varint32read=e.varint32write=e.int64toString=e.int64fromString=e.varint64write=e.varint64read=void 0;function varint64read(){let e=0,t=0;for(let n=0;n<28;n+=7){let r=this.buf[this.pos++];if(e|=(r&127)<>4,!(n&128))return this.assertBounds(),[e,t];for(let n=3;n<=31;n+=7){let r=this.buf[this.pos++];if(t|=(r&127)<>>r,a=!(!(i>>>7)&&t==0),o=(a?i|128:i)&255;if(n.push(o),!a)return}let r=e>>>28&15|(t&7)<<4,i=!!(t>>3);if(n.push((i?r|128:r)&255),i){for(let e=3;e<31;e+=7){let r=t>>>e,i=!!(r>>>7),a=(i?r|128:r)&255;if(n.push(a),!i)return}n.push(t>>>31&1)}}e.varint64write=varint64write;let t=4294967296;function int64fromString(e){let n=e[0]==`-`;n&&(e=e.slice(1));let r=1e6,i=0,a=0;function add1e6digit(n,o){let s=Number(e.slice(n,o));a*=r,i=i*r+s,i>=t&&(a+=i/t|0,i%=t)}return add1e6digit(-24,-18),add1e6digit(-18,-12),add1e6digit(-12,-6),add1e6digit(-6),[n,i,a]}e.int64fromString=int64fromString;function int64toString(e,n){if(n>>>0<=2097151)return``+(t*n+(e>>>0));let r=e&16777215,i=(e>>>24|n<<8)>>>0&16777215,a=n>>16&65535,o=r+i*6777216+a*6710656,s=i+a*8147497,c=a*2,l=1e7;o>=l&&(s+=Math.floor(o/l),o%=l),s>=l&&(c+=Math.floor(s/l),s%=l);function decimalFrom1e7(e,t){let n=e?String(e):``;return t?`0000000`.slice(n.length)+n:n}return decimalFrom1e7(c,0)+decimalFrom1e7(s,c)+decimalFrom1e7(o,1)}e.int64toString=int64toString;function varint32write(e,t){if(e>=0){for(;e>127;)t.push(e&127|128),e>>>=7;t.push(e)}else{for(let n=0;n<9;n++)t.push(e&127|128),e>>=7;t.push(1)}}e.varint32write=varint32write;function varint32read(){let e=this.buf[this.pos++],t=e&127;if(!(e&128)||(e=this.buf[this.pos++],t|=(e&127)<<7,!(e&128))||(e=this.buf[this.pos++],t|=(e&127)<<14,!(e&128))||(e=this.buf[this.pos++],t|=(e&127)<<21,!(e&128)))return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let t=5;e&128&&t<10;t++)e=this.buf[this.pos++];if(e&128)throw Error(`invalid varint`);return this.assertBounds(),t>>>0}e.varint32read=varint32read})),V_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PbLong=e.PbULong=e.detectBi=void 0;let t=B_(),n;function detectBi(){let e=/* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8));n=globalThis.BigInt!==void 0&&typeof e.getBigInt64==`function`&&typeof e.getBigUint64==`function`&&typeof e.setBigInt64==`function`&&typeof e.setBigUint64==`function`?{MIN:BigInt(`-9223372036854775808`),MAX:BigInt(`9223372036854775807`),UMIN:BigInt(`0`),UMAX:BigInt(`18446744073709551615`),C:BigInt,V:e}:void 0}e.detectBi=detectBi,detectBi();function assertBi(e){if(!e)throw Error(`BigInt unavailable, see https://github.com/timostamm/protobuf-ts/blob/v1.0.8/MANUAL.md#bigint-support`)}let r=/^-?[0-9]+$/,i=4294967296,a=2147483648;var SharedPbLong=class{constructor(e,t){this.lo=e|0,this.hi=t|0}isZero(){return this.lo==0&&this.hi==0}toNumber(){let e=this.hi*i+(this.lo>>>0);if(!Number.isSafeInteger(e))throw Error(`cannot convert to safe number`);return e}},o=class PbULong extends SharedPbLong{static from(e){if(n)switch(typeof e){case`string`:if(e==`0`)return this.ZERO;if(e==``)throw Error(`string is no integer`);e=n.C(e);case`number`:if(e===0)return this.ZERO;e=n.C(e);case`bigint`:if(!e)return this.ZERO;if(en.UMAX)throw Error(`ulong too large`);return n.V.setBigUint64(0,e,!0),new PbULong(n.V.getInt32(0,!0),n.V.getInt32(4,!0))}else switch(typeof e){case`string`:if(e==`0`)return this.ZERO;if(e=e.trim(),!r.test(e))throw Error(`string is no integer`);let[n,a,o]=t.int64fromString(e);if(n)throw Error(`signed value for ulong`);return new PbULong(a,o);case`number`:if(e==0)return this.ZERO;if(!Number.isSafeInteger(e))throw Error(`number is no integer`);if(e<0)throw Error(`signed value for ulong`);return new PbULong(e,e/i)}throw Error(`unknown value `+typeof e)}toString(){return n?this.toBigInt().toString():t.int64toString(this.lo,this.hi)}toBigInt(){return assertBi(n),n.V.setInt32(0,this.lo,!0),n.V.setInt32(4,this.hi,!0),n.V.getBigUint64(0,!0)}};e.PbULong=o,o.ZERO=new o(0,0);var s=class PbLong extends SharedPbLong{static from(e){if(n)switch(typeof e){case`string`:if(e==`0`)return this.ZERO;if(e==``)throw Error(`string is no integer`);e=n.C(e);case`number`:if(e===0)return this.ZERO;e=n.C(e);case`bigint`:if(!e)return this.ZERO;if(en.MAX)throw Error(`signed long too large`);return n.V.setBigInt64(0,e,!0),new PbLong(n.V.getInt32(0,!0),n.V.getInt32(4,!0))}else switch(typeof e){case`string`:if(e==`0`)return this.ZERO;if(e=e.trim(),!r.test(e))throw Error(`string is no integer`);let[n,o,s]=t.int64fromString(e);if(n){if(s>a||s==a&&o!=0)throw Error(`signed long too small`)}else if(s>=a)throw Error(`signed long too large`);let c=new PbLong(o,s);return n?c.negate():c;case`number`:if(e==0)return this.ZERO;if(!Number.isSafeInteger(e))throw Error(`number is no integer`);return e>0?new PbLong(e,e/i):new PbLong(-e,-e/i).negate()}throw Error(`unknown value `+typeof e)}isNegative(){return!!(this.hi&a)}negate(){let e=~this.hi,t=this.lo;return t?t=~t+1:e+=1,new PbLong(t,e)}toString(){if(n)return this.toBigInt().toString();if(this.isNegative()){let e=this.negate();return`-`+t.int64toString(e.lo,e.hi)}return t.int64toString(this.lo,this.hi)}toBigInt(){return assertBi(n),n.V.setInt32(0,this.lo,!0),n.V.setInt32(4,this.hi,!0),n.V.getBigInt64(0,!0)}};e.PbLong=s,s.ZERO=new s(0,0)})),H_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BinaryReader=e.binaryReadOptions=void 0;let t=z_(),n=V_(),r=B_(),i={readUnknownField:!0,readerFactory:e=>new BinaryReader(e)};function binaryReadOptions(e){return e?Object.assign(Object.assign({},i),e):i}e.binaryReadOptions=binaryReadOptions;var BinaryReader=class{constructor(e,t){this.varint64=r.varint64read,this.uint32=r.varint32read,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=t??new TextDecoder(`utf-8`,{fatal:!0,ignoreBOM:!0})}tag(){let e=this.uint32(),t=e>>>3,n=e&7;if(t<=0||n<0||n>5)throw Error(`illegal tag: field no `+t+` wire type `+n);return[t,n]}skip(e){let n=this.pos;switch(e){case t.WireType.Varint:for(;this.buf[this.pos++]&128;);break;case t.WireType.Bit64:this.pos+=4;case t.WireType.Bit32:this.pos+=4;break;case t.WireType.LengthDelimited:let n=this.uint32();this.pos+=n;break;case t.WireType.StartGroup:let r;for(;(r=this.tag()[1])!==t.WireType.EndGroup;)this.skip(r);break;default:throw Error(`cant skip wire type `+e)}return this.assertBounds(),this.buf.subarray(n,this.pos)}assertBounds(){if(this.pos>this.len)throw RangeError(`premature EOF`)}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)}int64(){return new n.PbLong(...this.varint64())}uint64(){return new n.PbULong(...this.varint64())}sint64(){let[e,t]=this.varint64(),r=-(e&1);return e=(e>>>1|(t&1)<<31)^r,t=t>>>1^r,new n.PbLong(e,t)}bool(){let[e,t]=this.varint64();return e!==0||t!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return new n.PbULong(this.sfixed32(),this.sfixed32())}sfixed64(){return new n.PbLong(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),t=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(t,t+e)}string(){return this.textDecoder.decode(this.bytes())}};e.BinaryReader=BinaryReader})),U_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.assertFloat32=e.assertUInt32=e.assertInt32=e.assertNever=e.assert=void 0;function assert(e,t){if(!e)throw Error(t)}e.assert=assert;function assertNever(e,t){throw Error(t??`Unexpected object: `+e)}e.assertNever=assertNever;function assertInt32(e){if(typeof e!=`number`)throw Error(`invalid int 32: `+typeof e);if(!Number.isInteger(e)||e>2147483647||e<-2147483648)throw Error(`invalid int 32: `+e)}e.assertInt32=assertInt32;function assertUInt32(e){if(typeof e!=`number`)throw Error(`invalid uint 32: `+typeof e);if(!Number.isInteger(e)||e>4294967295||e<0)throw Error(`invalid uint 32: `+e)}e.assertUInt32=assertUInt32;function assertFloat32(e){if(typeof e!=`number`)throw Error(`invalid float 32: `+typeof e);if(Number.isFinite(e)&&(e>34028234663852886e22||e<-34028234663852886e22))throw Error(`invalid float 32: `+e)}e.assertFloat32=assertFloat32})),W_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BinaryWriter=e.binaryWriteOptions=void 0;let t=V_(),n=B_(),r=U_(),i={writeUnknownFields:!0,writerFactory:()=>new BinaryWriter};function binaryWriteOptions(e){return e?Object.assign(Object.assign({},i),e):i}e.binaryWriteOptions=binaryWriteOptions;var BinaryWriter=class{constructor(e){this.stack=[],this.textEncoder=e??new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let t=0;t>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(r.assertUInt32(e);e>127;)this.buf.push(e&127|128),e>>>=7;return this.buf.push(e),this}int32(e){return r.assertInt32(e),n.varint32write(e,this.buf),this}bool(e){return this.buf.push(+!!e),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let t=this.textEncoder.encode(e);return this.uint32(t.byteLength),this.raw(t)}float(e){r.assertFloat32(e);let t=/* @__PURE__ */ new Uint8Array(4);return new DataView(t.buffer).setFloat32(0,e,!0),this.raw(t)}double(e){let t=/* @__PURE__ */ new Uint8Array(8);return new DataView(t.buffer).setFloat64(0,e,!0),this.raw(t)}fixed32(e){r.assertUInt32(e);let t=/* @__PURE__ */ new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),this.raw(t)}sfixed32(e){r.assertInt32(e);let t=/* @__PURE__ */ new Uint8Array(4);return new DataView(t.buffer).setInt32(0,e,!0),this.raw(t)}sint32(e){return r.assertInt32(e),e=(e<<1^e>>31)>>>0,n.varint32write(e,this.buf),this}sfixed64(e){let n=/* @__PURE__ */ new Uint8Array(8),r=new DataView(n.buffer),i=t.PbLong.from(e);return r.setInt32(0,i.lo,!0),r.setInt32(4,i.hi,!0),this.raw(n)}fixed64(e){let n=/* @__PURE__ */ new Uint8Array(8),r=new DataView(n.buffer),i=t.PbULong.from(e);return r.setInt32(0,i.lo,!0),r.setInt32(4,i.hi,!0),this.raw(n)}int64(e){let r=t.PbLong.from(e);return n.varint64write(r.lo,r.hi,this.buf),this}sint64(e){let r=t.PbLong.from(e),i=r.hi>>31,a=r.lo<<1^i,o=(r.hi<<1|r.lo>>>31)^i;return n.varint64write(a,o,this.buf),this}uint64(e){let r=t.PbULong.from(e);return n.varint64write(r.lo,r.hi,this.buf),this}};e.BinaryWriter=BinaryWriter})),G_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.mergeJsonOptions=e.jsonWriteOptions=e.jsonReadOptions=void 0;let t={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0},n={ignoreUnknownFields:!1};function jsonReadOptions(e){return e?Object.assign(Object.assign({},n),e):n}e.jsonReadOptions=jsonReadOptions;function jsonWriteOptions(e){return e?Object.assign(Object.assign({},t),e):t}e.jsonWriteOptions=jsonWriteOptions;function mergeJsonOptions(e,t){let n=Object.assign(Object.assign({},e),t);return n.typeRegistry=[...e?.typeRegistry??[],...t?.typeRegistry??[]],n}e.mergeJsonOptions=mergeJsonOptions})),K_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MESSAGE_TYPE=void 0,e.MESSAGE_TYPE=Symbol.for(`protobuf-ts/message-type`)})),q_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.lowerCamelCase=void 0;function lowerCamelCase(e){let t=!1,n=[];for(let r=0;r{Object.defineProperty(e,"__esModule",{value:!0}),e.readMessageOption=e.readFieldOption=e.readFieldOptions=e.normalizeFieldInfo=e.RepeatType=e.LongType=e.ScalarType=void 0;let t=q_();(function(e){e[e.DOUBLE=1]=`DOUBLE`,e[e.FLOAT=2]=`FLOAT`,e[e.INT64=3]=`INT64`,e[e.UINT64=4]=`UINT64`,e[e.INT32=5]=`INT32`,e[e.FIXED64=6]=`FIXED64`,e[e.FIXED32=7]=`FIXED32`,e[e.BOOL=8]=`BOOL`,e[e.STRING=9]=`STRING`,e[e.BYTES=12]=`BYTES`,e[e.UINT32=13]=`UINT32`,e[e.SFIXED32=15]=`SFIXED32`,e[e.SFIXED64=16]=`SFIXED64`,e[e.SINT32=17]=`SINT32`,e[e.SINT64=18]=`SINT64`})(e.ScalarType||={}),(function(e){e[e.BIGINT=0]=`BIGINT`,e[e.STRING=1]=`STRING`,e[e.NUMBER=2]=`NUMBER`})(e.LongType||={});var n;(function(e){e[e.NO=0]=`NO`,e[e.PACKED=1]=`PACKED`,e[e.UNPACKED=2]=`UNPACKED`})(n=e.RepeatType||={});function normalizeFieldInfo(e){return e.localName=e.localName??t.lowerCamelCase(e.name),e.jsonName=e.jsonName??t.lowerCamelCase(e.name),e.repeat=e.repeat??n.NO,e.opt=e.opt??(!e.repeat&&!e.oneof&&e.kind==`message`),e}e.normalizeFieldInfo=normalizeFieldInfo;function readFieldOptions(e,t,n,r){let i=e.fields.find((e,n)=>e.localName==t||n==t)?.options;return i&&i[n]?r.fromJson(i[n]):void 0}e.readFieldOptions=readFieldOptions;function readFieldOption(e,t,n,r){let i=e.fields.find((e,n)=>e.localName==t||n==t)?.options;if(!i)return;let a=i[n];return a===void 0?a:r?r.fromJson(a):a}e.readFieldOption=readFieldOption;function readMessageOption(e,t,n){let r=e.options[t];return r===void 0?r:n?n.fromJson(r):r}e.readMessageOption=readMessageOption})),Y_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getSelectedOneofValue=e.clearOneofValue=e.setUnknownOneofValue=e.setOneofValue=e.getOneofValue=e.isOneofGroup=void 0;function isOneofGroup(e){if(typeof e!=`object`||!e||!e.hasOwnProperty(`oneofKind`))return!1;switch(typeof e.oneofKind){case`string`:return e[e.oneofKind]!==void 0&&Object.keys(e).length==2;case`undefined`:return Object.keys(e).length==1;default:return!1}}e.isOneofGroup=isOneofGroup;function getOneofValue(e,t){return e[t]}e.getOneofValue=getOneofValue;function setOneofValue(e,t,n){e.oneofKind!==void 0&&delete e[e.oneofKind],e.oneofKind=t,n!==void 0&&(e[t]=n)}e.setOneofValue=setOneofValue;function setUnknownOneofValue(e,t,n){e.oneofKind!==void 0&&delete e[e.oneofKind],e.oneofKind=t,n!==void 0&&t!==void 0&&(e[t]=n)}e.setUnknownOneofValue=setUnknownOneofValue;function clearOneofValue(e){e.oneofKind!==void 0&&delete e[e.oneofKind],e.oneofKind=void 0}e.clearOneofValue=clearOneofValue;function getSelectedOneofValue(e){if(e.oneofKind!==void 0)return e[e.oneofKind]}e.getSelectedOneofValue=getSelectedOneofValue})),X_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ReflectionTypeCheck=void 0;let t=J_(),n=Y_();e.ReflectionTypeCheck=class{constructor(e){this.fields=e.fields??[]}prepare(){if(this.data)return;let e=[],t=[],n=[];for(let r of this.fields)if(r.oneof)n.includes(r.oneof)||(n.push(r.oneof),e.push(r.oneof),t.push(r.oneof));else switch(t.push(r.localName),r.kind){case`scalar`:case`enum`:(!r.opt||r.repeat)&&e.push(r.localName);break;case`message`:r.repeat&&e.push(r.localName);break;case`map`:e.push(r.localName)}this.data={req:e,known:t,oneofs:Object.values(n)}}is(e,t,r=!1){if(t<0)return!0;if(typeof e!=`object`||!e)return!1;this.prepare();let i=Object.keys(e),a=this.data;if(i.length!i.includes(e))||!r&&i.some(e=>!a.known.includes(e)))return!1;if(t<1)return!0;for(let i of a.oneofs){let a=e[i];if(!n.isOneofGroup(a))return!1;if(a.oneofKind===void 0)continue;let o=this.fields.find(e=>e.localName===a.oneofKind);if(!o||!this.field(a[a.oneofKind],o,r,t))return!1}for(let n of this.fields)if(n.oneof===void 0&&!this.field(e[n.localName],n,r,t))return!1;return!0}field(e,n,r,i){let a=n.repeat;switch(n.kind){case`scalar`:return e===void 0?n.opt:a?this.scalars(e,n.T,i,n.L):this.scalar(e,n.T,n.L);case`enum`:return e===void 0?n.opt:a?this.scalars(e,t.ScalarType.INT32,i):this.scalar(e,t.ScalarType.INT32);case`message`:return e===void 0?!0:a?this.messages(e,n.T(),r,i):this.message(e,n.T(),r,i);case`map`:if(typeof e!=`object`||!e)return!1;if(i<2)return!0;if(!this.mapKeys(e,n.K,i))return!1;switch(n.V.kind){case`scalar`:return this.scalars(Object.values(e),n.V.T,i,n.V.L);case`enum`:return this.scalars(Object.values(e),t.ScalarType.INT32,i);case`message`:return this.messages(Object.values(e),n.V.T(),r,i)}}return!0}message(e,t,n,r){return n?t.isAssignable(e,r):t.is(e,r)}messages(e,t,n,r){if(!Array.isArray(e))return!1;if(r<2)return!0;if(n){for(let n=0;nparseInt(e)),n,r);case t.ScalarType.BOOL:return this.scalars(i.slice(0,r).map(e=>e==`true`||e!=`false`&&e),n,r);default:return this.scalars(i,n,r,t.LongType.STRING)}}}})),Z_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.reflectionLongConvert=void 0;let t=J_();function reflectionLongConvert(e,n){switch(n){case t.LongType.BIGINT:return e.toBigInt();case t.LongType.NUMBER:return e.toNumber();default:return e.toString()}}e.reflectionLongConvert=reflectionLongConvert})),Q_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ReflectionJsonReader=void 0;let t=I_(),n=L_(),r=J_(),i=V_(),a=U_(),o=Z_();e.ReflectionJsonReader=class{constructor(e){this.info=e}prepare(){if(this.fMap===void 0){this.fMap={};let e=this.info.fields??[];for(let t of e)this.fMap[t.name]=t,this.fMap[t.jsonName]=t,this.fMap[t.localName]=t}}assert(e,n,r){if(!e){let e=t.typeofJsonValue(r);throw(e==`number`||e==`boolean`)&&(e=r.toString()),Error(`Cannot parse JSON ${e} for ${this.info.typeName}#${n}`)}}read(e,n,i){this.prepare();let a=[];for(let[o,s]of Object.entries(e)){let e=this.fMap[o];if(!e){if(!i.ignoreUnknownFields)throw Error(`Found unknown field while reading ${this.info.typeName} from JSON format. JSON key: ${o}`);continue}let c=e.localName,l;if(e.oneof){if(s===null&&(e.kind!==`enum`||e.T()[0]!==`google.protobuf.NullValue`))continue;if(a.includes(e.oneof))throw Error(`Multiple members of the oneof group "${e.oneof}" of ${this.info.typeName} are present in JSON.`);a.push(e.oneof),l=n[e.oneof]={oneofKind:c}}else l=n;if(e.kind==`map`){if(s===null)continue;this.assert(t.isJsonObject(s),e.name,s);let n=l[c];for(let[t,a]of Object.entries(s)){this.assert(a!==null,e.name+` map value`,null);let o;switch(e.V.kind){case`message`:o=e.V.T().internalJsonRead(a,i);break;case`enum`:if(o=this.enum(e.V.T(),a,e.name,i.ignoreUnknownFields),o===!1)continue;break;case`scalar`:o=this.scalar(a,e.V.T,e.V.L,e.name)}this.assert(o!==void 0,e.name+` map value`,a);let s=t;e.K==r.ScalarType.BOOL&&(s=s==`true`||s!=`false`&&s),s=this.scalar(s,e.K,r.LongType.STRING,e.name).toString(),n[s]=o}}else if(e.repeat){if(s===null)continue;this.assert(Array.isArray(s),e.name,s);let t=l[c];for(let n of s){this.assert(n!==null,e.name,null);let r;switch(e.kind){case`message`:r=e.T().internalJsonRead(n,i);break;case`enum`:if(r=this.enum(e.T(),n,e.name,i.ignoreUnknownFields),r===!1)continue;break;case`scalar`:r=this.scalar(n,e.T,e.L,e.name)}this.assert(r!==void 0,e.name,s),t.push(r)}}else switch(e.kind){case`message`:if(s===null&&e.T().typeName!=`google.protobuf.Value`){this.assert(e.oneof===void 0,e.name+` (oneof member)`,null);continue}l[c]=e.T().internalJsonRead(s,i,l[c]);break;case`enum`:if(s===null)continue;let t=this.enum(e.T(),s,e.name,i.ignoreUnknownFields);if(t===!1)continue;l[c]=t;break;case`scalar`:if(s===null)continue;l[c]=this.scalar(s,e.T,e.L,e.name)}}}enum(e,t,n,r){if(e[0]==`google.protobuf.NullValue`&&a.assert(t===null||t===`NULL_VALUE`,`Unable to parse field ${this.info.typeName}#${n}, enum ${e[0]} only accepts null.`),t===null)return 0;switch(typeof t){case`number`:return a.assert(Number.isInteger(t),`Unable to parse field ${this.info.typeName}#${n}, enum can only be integral number, got ${t}.`),t;case`string`:let i=t;e[2]&&t.substring(0,e[2].length)===e[2]&&(i=t.substring(e[2].length));let o=e[1][i];return o===void 0&&r?!1:(a.assert(typeof o==`number`,`Unable to parse field ${this.info.typeName}#${n}, enum ${e[0]} has no value for "${t}".`),o)}a.assert(!1,`Unable to parse field ${this.info.typeName}#${n}, cannot parse enum value from ${typeof t}".`)}scalar(e,t,s,c){let l;try{switch(t){case r.ScalarType.DOUBLE:case r.ScalarType.FLOAT:if(e===null)return 0;if(e===`NaN`)return NaN;if(e===`Infinity`)return 1/0;if(e===`-Infinity`)return-1/0;if(e===``){l=`empty string`;break}if(typeof e==`string`&&e.trim().length!==e.length){l=`extra whitespace`;break}if(typeof e!=`string`&&typeof e!=`number`)break;let c=Number(e);if(Number.isNaN(c)){l=`not a number`;break}if(!Number.isFinite(c)){l=`too large or small`;break}return t==r.ScalarType.FLOAT&&a.assertFloat32(c),c;case r.ScalarType.INT32:case r.ScalarType.FIXED32:case r.ScalarType.SFIXED32:case r.ScalarType.SINT32:case r.ScalarType.UINT32:if(e===null)return 0;let u;if(typeof e==`number`?u=e:e===``?l=`empty string`:typeof e==`string`&&(e.trim().length===e.length?u=Number(e):l=`extra whitespace`),u===void 0)break;return t==r.ScalarType.UINT32?a.assertUInt32(u):a.assertInt32(u),u;case r.ScalarType.INT64:case r.ScalarType.SFIXED64:case r.ScalarType.SINT64:if(e===null)return o.reflectionLongConvert(i.PbLong.ZERO,s);if(typeof e!=`number`&&typeof e!=`string`)break;return o.reflectionLongConvert(i.PbLong.from(e),s);case r.ScalarType.FIXED64:case r.ScalarType.UINT64:if(e===null)return o.reflectionLongConvert(i.PbULong.ZERO,s);if(typeof e!=`number`&&typeof e!=`string`)break;return o.reflectionLongConvert(i.PbULong.from(e),s);case r.ScalarType.BOOL:if(e===null)return!1;if(typeof e!=`boolean`)break;return e;case r.ScalarType.STRING:if(e===null)return``;if(typeof e!=`string`){l=`extra whitespace`;break}return e;case r.ScalarType.BYTES:if(e===null||e===``)return/* @__PURE__ */ new Uint8Array;if(typeof e!=`string`)break;return n.base64decode(e)}}catch(e){l=e.message}this.assert(!1,c+(l?` - `+l:``),e)}}})),$_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ReflectionJsonWriter=void 0;let t=L_(),n=V_(),r=J_(),i=U_();e.ReflectionJsonWriter=class{constructor(e){this.fields=e.fields??[]}write(e,t){let n={},r=e;for(let e of this.fields){if(!e.oneof){let i=this.field(e,r[e.localName],t);i!==void 0&&(n[t.useProtoFieldName?e.name:e.jsonName]=i);continue}let a=r[e.oneof];if(a.oneofKind!==e.localName)continue;let o=e.kind==`scalar`||e.kind==`enum`?Object.assign(Object.assign({},t),{emitDefaultValues:!0}):t,s=this.field(e,a[e.localName],o);i.assert(s!==void 0),n[t.useProtoFieldName?e.name:e.jsonName]=s}return n}field(e,t,n){let r;if(e.kind==`map`){i.assert(typeof t==`object`&&!!t);let a={};switch(e.V.kind){case`scalar`:for(let[n,r]of Object.entries(t)){let t=this.scalar(e.V.T,r,e.name,!1,!0);i.assert(t!==void 0),a[n.toString()]=t}break;case`message`:let r=e.V.T();for(let[o,s]of Object.entries(t)){let t=this.message(r,s,e.name,n);i.assert(t!==void 0),a[o.toString()]=t}break;case`enum`:let o=e.V.T();for(let[r,s]of Object.entries(t)){i.assert(s===void 0||typeof s==`number`);let t=this.enum(o,s,e.name,!1,!0,n.enumAsInteger);i.assert(t!==void 0),a[r.toString()]=t}}(n.emitDefaultValues||Object.keys(a).length>0)&&(r=a)}else if(e.repeat){i.assert(Array.isArray(t));let a=[];switch(e.kind){case`scalar`:for(let n=0;n0||n.emitDefaultValues)&&(r=a)}else switch(e.kind){case`scalar`:r=this.scalar(e.T,t,e.name,e.opt,n.emitDefaultValues);break;case`enum`:r=this.enum(e.T(),t,e.name,e.opt,n.emitDefaultValues,n.enumAsInteger);break;case`message`:r=this.message(e.T(),t,e.name,n)}return r}enum(e,t,n,r,a,o){if(e[0]==`google.protobuf.NullValue`)return!a&&!r?void 0:null;if(t===void 0){i.assert(r);return}if(t!==0||a||r)return i.assert(typeof t==`number`),i.assert(Number.isInteger(t)),o||!e[1].hasOwnProperty(t)?t:e[2]?e[2]+e[1][t]:e[1][t]}message(e,t,n,r){return t===void 0?r.emitDefaultValues?null:void 0:e.internalJsonWrite(t,r)}scalar(e,a,o,s,c){if(a===void 0){i.assert(s);return}let l=c||s;switch(e){case r.ScalarType.INT32:case r.ScalarType.SFIXED32:case r.ScalarType.SINT32:return a===0?l?0:void 0:(i.assertInt32(a),a);case r.ScalarType.FIXED32:case r.ScalarType.UINT32:return a===0?l?0:void 0:(i.assertUInt32(a),a);case r.ScalarType.FLOAT:i.assertFloat32(a);case r.ScalarType.DOUBLE:return a===0?l?0:void 0:(i.assert(typeof a==`number`),Number.isNaN(a)?`NaN`:a===1/0?`Infinity`:a===-1/0?`-Infinity`:a);case r.ScalarType.STRING:return a===``?l?``:void 0:(i.assert(typeof a==`string`),a);case r.ScalarType.BOOL:return a===!1?!l&&void 0:(i.assert(typeof a==`boolean`),a);case r.ScalarType.UINT64:case r.ScalarType.FIXED64:i.assert(typeof a==`number`||typeof a==`string`||typeof a==`bigint`);let e=n.PbULong.from(a);return e.isZero()&&!l?void 0:e.toString();case r.ScalarType.INT64:case r.ScalarType.SFIXED64:case r.ScalarType.SINT64:i.assert(typeof a==`number`||typeof a==`string`||typeof a==`bigint`);let o=n.PbLong.from(a);return o.isZero()&&!l?void 0:o.toString();case r.ScalarType.BYTES:return i.assert(a instanceof Uint8Array),a.byteLength?t.base64encode(a):l?``:void 0}}}})),ev=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.reflectionScalarDefault=void 0;let t=J_(),n=Z_(),r=V_();function reflectionScalarDefault(e,i=t.LongType.STRING){switch(e){case t.ScalarType.BOOL:return!1;case t.ScalarType.UINT64:case t.ScalarType.FIXED64:return n.reflectionLongConvert(r.PbULong.ZERO,i);case t.ScalarType.INT64:case t.ScalarType.SFIXED64:case t.ScalarType.SINT64:return n.reflectionLongConvert(r.PbLong.ZERO,i);case t.ScalarType.DOUBLE:case t.ScalarType.FLOAT:return 0;case t.ScalarType.BYTES:return/* @__PURE__ */ new Uint8Array;case t.ScalarType.STRING:return``;default:return 0}}e.reflectionScalarDefault=reflectionScalarDefault})),tv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ReflectionBinaryReader=void 0;let t=z_(),n=J_(),r=Z_(),i=ev();e.ReflectionBinaryReader=class{constructor(e){this.info=e}prepare(){if(!this.fieldNoToField){let e=this.info.fields??[];this.fieldNoToField=new Map(e.map(e=>[e.no,e]))}}read(e,r,i,a){this.prepare();let o=a===void 0?e.len:e.pos+a;for(;e.pos{Object.defineProperty(e,"__esModule",{value:!0}),e.ReflectionBinaryWriter=void 0;let t=z_(),n=J_(),r=U_(),i=V_();e.ReflectionBinaryWriter=class{constructor(e){this.info=e}prepare(){if(!this.fields){let e=this.info.fields?this.info.fields.concat():[];this.fields=e.sort((e,t)=>e.no-t.no)}}write(e,i,a){this.prepare();for(let t of this.fields){let o,s,c=t.repeat,l=t.localName;if(t.oneof){let n=e[t.oneof];if(n.oneofKind!==l)continue;o=n[l],s=!0}else o=e[l],s=!1;switch(t.kind){case`scalar`:case`enum`:let e=t.kind==`enum`?n.ScalarType.INT32:t.T;if(c){if(r.assert(Array.isArray(o)),c==n.RepeatType.PACKED)this.packed(i,e,t.no,o);else for(let n of o)this.scalar(i,e,t.no,n,!0)}else o===void 0?r.assert(t.opt):this.scalar(i,e,t.no,o,s||t.opt);break;case`message`:if(c){r.assert(Array.isArray(o));for(let e of o)this.message(i,a,t.T(),t.no,e)}else this.message(i,a,t.T(),t.no,o);break;case`map`:r.assert(typeof o==`object`&&!!o);for(let[e,n]of Object.entries(o))this.mapEntry(i,a,t,e,n)}}let o=a.writeUnknownFields;o!==!1&&(o===!0?t.UnknownFieldHandler.onWrite:o)(this.info.typeName,e,i)}mapEntry(e,i,a,o,s){e.tag(a.no,t.WireType.LengthDelimited),e.fork();let c=o;switch(a.K){case n.ScalarType.INT32:case n.ScalarType.FIXED32:case n.ScalarType.UINT32:case n.ScalarType.SFIXED32:case n.ScalarType.SINT32:c=Number.parseInt(o);break;case n.ScalarType.BOOL:r.assert(o==`true`||o==`false`),c=o==`true`}switch(this.scalar(e,a.K,1,c,!0),a.V.kind){case`scalar`:this.scalar(e,a.V.T,2,s,!0);break;case`enum`:this.scalar(e,n.ScalarType.INT32,2,s,!0);break;case`message`:this.message(e,i,a.V.T(),2,s)}e.join()}message(e,n,r,i,a){a!==void 0&&(r.internalBinaryWrite(a,e.tag(i,t.WireType.LengthDelimited).fork(),n),e.join())}scalar(e,t,n,r,i){let[a,o,s]=this.scalarInfo(t,r);(!s||i)&&(e.tag(n,a),e[o](r))}packed(e,i,a,o){if(!o.length)return;r.assert(i!==n.ScalarType.BYTES&&i!==n.ScalarType.STRING),e.tag(a,t.WireType.LengthDelimited),e.fork();let[,s]=this.scalarInfo(i);for(let t=0;t{Object.defineProperty(e,"__esModule",{value:!0}),e.reflectionCreate=void 0;let t=ev(),n=K_();function reflectionCreate(e){let r=e.messagePrototype?Object.create(e.messagePrototype):Object.defineProperty({},n.MESSAGE_TYPE,{value:e});for(let n of e.fields){let e=n.localName;if(!n.opt){if(n.oneof)r[n.oneof]={oneofKind:void 0};else if(n.repeat)r[e]=[];else switch(n.kind){case`scalar`:r[e]=t.reflectionScalarDefault(n.T,n.L);break;case`enum`:r[e]=0;break;case`map`:r[e]={}}}}return r}e.reflectionCreate=reflectionCreate})),iv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.reflectionMergePartial=void 0;function reflectionMergePartial(e,t,n){let r,i=n,a;for(let n of e.fields){let e=n.localName;if(n.oneof){let o=i[n.oneof];if(o?.oneofKind==null)continue;if(r=o[e],a=t[n.oneof],a.oneofKind=o.oneofKind,r==null){delete a[e];continue}}else if(r=i[e],a=t,r==null)continue;switch(n.repeat&&(a[e].length=r.length),n.kind){case`scalar`:case`enum`:if(n.repeat)for(let t=0;t{Object.defineProperty(e,"__esModule",{value:!0}),e.reflectionEquals=void 0;let t=J_();function reflectionEquals(e,r,i){if(r===i)return!0;if(!r||!i)return!1;for(let a of e.fields){let e=a.localName,o=a.oneof?r[a.oneof][e]:r[e],s=a.oneof?i[a.oneof][e]:i[e];switch(a.kind){case`enum`:case`scalar`:let e=a.kind==`enum`?t.ScalarType.INT32:a.T;if(!(a.repeat?repeatedPrimitiveEq(e,o,s):primitiveEq(e,o,s)))return!1;break;case`map`:if(!(a.V.kind==`message`?repeatedMsgEq(a.V.T(),n(o),n(s)):repeatedPrimitiveEq(a.V.kind==`enum`?t.ScalarType.INT32:a.V.T,n(o),n(s))))return!1;break;case`message`:let r=a.T();if(!(a.repeat?repeatedMsgEq(r,o,s):r.equals(o,s)))return!1}}return!0}e.reflectionEquals=reflectionEquals;let n=Object.values;function primitiveEq(e,n,r){if(n===r)return!0;if(e!==t.ScalarType.BYTES)return!1;let i=n,a=r;if(i.length!==a.length)return!1;for(let e=0;e{Object.defineProperty(e,"__esModule",{value:!0}),e.MessageType=void 0;let t=K_(),n=J_(),r=X_(),i=Q_(),a=$_(),o=tv(),s=nv(),c=rv(),l=iv(),u=I_(),d=G_(),f=av(),p=W_(),m=H_(),h=Object.getOwnPropertyDescriptors(Object.getPrototypeOf({})),g=h[t.MESSAGE_TYPE]={};e.MessageType=class{constructor(e,t,c){this.defaultCheckDepth=16,this.typeName=e,this.fields=t.map(n.normalizeFieldInfo),this.options=c??{},g.value=this,this.messagePrototype=Object.create(null,h),this.refTypeCheck=new r.ReflectionTypeCheck(this),this.refJsonReader=new i.ReflectionJsonReader(this),this.refJsonWriter=new a.ReflectionJsonWriter(this),this.refBinReader=new o.ReflectionBinaryReader(this),this.refBinWriter=new s.ReflectionBinaryWriter(this)}create(e){let t=c.reflectionCreate(this);return e!==void 0&&l.reflectionMergePartial(this,t,e),t}clone(e){let t=this.create();return l.reflectionMergePartial(this,t,e),t}equals(e,t){return f.reflectionEquals(this,e,t)}is(e,t=this.defaultCheckDepth){return this.refTypeCheck.is(e,t,!1)}isAssignable(e,t=this.defaultCheckDepth){return this.refTypeCheck.is(e,t,!0)}mergePartial(e,t){l.reflectionMergePartial(this,e,t)}fromBinary(e,t){let n=m.binaryReadOptions(t);return this.internalBinaryRead(n.readerFactory(e),e.byteLength,n)}fromJson(e,t){return this.internalJsonRead(e,d.jsonReadOptions(t))}fromJsonString(e,t){let n=JSON.parse(e);return this.fromJson(n,t)}toJson(e,t){return this.internalJsonWrite(e,d.jsonWriteOptions(t))}toJsonString(e,t){let n=this.toJson(e,t);return JSON.stringify(n,null,t?.prettySpaces??0)}toBinary(e,t){let n=p.binaryWriteOptions(t);return this.internalBinaryWrite(e,n.writerFactory(),n).finish()}internalJsonRead(e,t,n){if(typeof e==`object`&&e&&!Array.isArray(e)){let r=n??this.create();return this.refJsonReader.read(e,r,t),r}throw Error(`Unable to parse message ${this.typeName} from JSON ${u.typeofJsonValue(e)}.`)}internalJsonWrite(e,t){return this.refJsonWriter.write(e,t)}internalBinaryWrite(e,t,n){return this.refBinWriter.write(e,t,n),t}internalBinaryRead(e,t,n,r){let i=r??this.create();return this.refBinReader.read(e,i,n,t),i}}})),sv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.containsMessageType=void 0;let t=K_();function containsMessageType(e){return e[t.MESSAGE_TYPE]!=null}e.containsMessageType=containsMessageType})),cv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.listEnumNumbers=e.listEnumNames=e.listEnumValues=e.isEnumObject=void 0;function isEnumObject(e){if(typeof e!=`object`||!e||!e.hasOwnProperty(0))return!1;for(let t of Object.keys(e)){let n=parseInt(t);if(Number.isNaN(n)){let n=e[t];if(n===void 0||typeof n!=`number`||e[n]===void 0)return!1}else{let t=e[n];if(t===void 0||e[t]!==n)return!1}}return!0}e.isEnumObject=isEnumObject;function listEnumValues(e){if(!isEnumObject(e))throw Error(`not a typescript enum object`);let t=[];for(let[n,r]of Object.entries(e))typeof r==`number`&&t.push({name:n,number:r});return t}e.listEnumValues=listEnumValues;function listEnumNames(e){return listEnumValues(e).map(e=>e.name)}e.listEnumNames=listEnumNames;function listEnumNumbers(e){return listEnumValues(e).map(e=>e.number).filter((e,t,n)=>n.indexOf(e)==t)}e.listEnumNumbers=listEnumNumbers})),lv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=I_();Object.defineProperty(e,"typeofJsonValue",{enumerable:!0,get:function(){return t.typeofJsonValue}}),Object.defineProperty(e,"isJsonObject",{enumerable:!0,get:function(){return t.isJsonObject}});var n=L_();Object.defineProperty(e,"base64decode",{enumerable:!0,get:function(){return n.base64decode}}),Object.defineProperty(e,"base64encode",{enumerable:!0,get:function(){return n.base64encode}});var r=R_();Object.defineProperty(e,"utf8read",{enumerable:!0,get:function(){return r.utf8read}});var i=z_();Object.defineProperty(e,"WireType",{enumerable:!0,get:function(){return i.WireType}}),Object.defineProperty(e,"mergeBinaryOptions",{enumerable:!0,get:function(){return i.mergeBinaryOptions}}),Object.defineProperty(e,"UnknownFieldHandler",{enumerable:!0,get:function(){return i.UnknownFieldHandler}});var a=H_();Object.defineProperty(e,"BinaryReader",{enumerable:!0,get:function(){return a.BinaryReader}}),Object.defineProperty(e,"binaryReadOptions",{enumerable:!0,get:function(){return a.binaryReadOptions}});var o=W_();Object.defineProperty(e,"BinaryWriter",{enumerable:!0,get:function(){return o.BinaryWriter}}),Object.defineProperty(e,"binaryWriteOptions",{enumerable:!0,get:function(){return o.binaryWriteOptions}});var s=V_();Object.defineProperty(e,"PbLong",{enumerable:!0,get:function(){return s.PbLong}}),Object.defineProperty(e,"PbULong",{enumerable:!0,get:function(){return s.PbULong}});var c=G_();Object.defineProperty(e,"jsonReadOptions",{enumerable:!0,get:function(){return c.jsonReadOptions}}),Object.defineProperty(e,"jsonWriteOptions",{enumerable:!0,get:function(){return c.jsonWriteOptions}}),Object.defineProperty(e,"mergeJsonOptions",{enumerable:!0,get:function(){return c.mergeJsonOptions}});var l=K_();Object.defineProperty(e,"MESSAGE_TYPE",{enumerable:!0,get:function(){return l.MESSAGE_TYPE}});var u=ov();Object.defineProperty(e,"MessageType",{enumerable:!0,get:function(){return u.MessageType}});var d=J_();Object.defineProperty(e,"ScalarType",{enumerable:!0,get:function(){return d.ScalarType}}),Object.defineProperty(e,"LongType",{enumerable:!0,get:function(){return d.LongType}}),Object.defineProperty(e,"RepeatType",{enumerable:!0,get:function(){return d.RepeatType}}),Object.defineProperty(e,"normalizeFieldInfo",{enumerable:!0,get:function(){return d.normalizeFieldInfo}}),Object.defineProperty(e,"readFieldOptions",{enumerable:!0,get:function(){return d.readFieldOptions}}),Object.defineProperty(e,"readFieldOption",{enumerable:!0,get:function(){return d.readFieldOption}}),Object.defineProperty(e,"readMessageOption",{enumerable:!0,get:function(){return d.readMessageOption}});var f=X_();Object.defineProperty(e,"ReflectionTypeCheck",{enumerable:!0,get:function(){return f.ReflectionTypeCheck}});var p=rv();Object.defineProperty(e,"reflectionCreate",{enumerable:!0,get:function(){return p.reflectionCreate}});var m=ev();Object.defineProperty(e,"reflectionScalarDefault",{enumerable:!0,get:function(){return m.reflectionScalarDefault}});var h=iv();Object.defineProperty(e,"reflectionMergePartial",{enumerable:!0,get:function(){return h.reflectionMergePartial}});var g=av();Object.defineProperty(e,"reflectionEquals",{enumerable:!0,get:function(){return g.reflectionEquals}});var v=tv();Object.defineProperty(e,"ReflectionBinaryReader",{enumerable:!0,get:function(){return v.ReflectionBinaryReader}});var y=nv();Object.defineProperty(e,"ReflectionBinaryWriter",{enumerable:!0,get:function(){return y.ReflectionBinaryWriter}});var b=Q_();Object.defineProperty(e,"ReflectionJsonReader",{enumerable:!0,get:function(){return b.ReflectionJsonReader}});var x=$_();Object.defineProperty(e,"ReflectionJsonWriter",{enumerable:!0,get:function(){return x.ReflectionJsonWriter}});var S=sv();Object.defineProperty(e,"containsMessageType",{enumerable:!0,get:function(){return S.containsMessageType}});var C=Y_();Object.defineProperty(e,"isOneofGroup",{enumerable:!0,get:function(){return C.isOneofGroup}}),Object.defineProperty(e,"setOneofValue",{enumerable:!0,get:function(){return C.setOneofValue}}),Object.defineProperty(e,"getOneofValue",{enumerable:!0,get:function(){return C.getOneofValue}}),Object.defineProperty(e,"clearOneofValue",{enumerable:!0,get:function(){return C.clearOneofValue}}),Object.defineProperty(e,"getSelectedOneofValue",{enumerable:!0,get:function(){return C.getSelectedOneofValue}});var w=cv();Object.defineProperty(e,"listEnumValues",{enumerable:!0,get:function(){return w.listEnumValues}}),Object.defineProperty(e,"listEnumNames",{enumerable:!0,get:function(){return w.listEnumNames}}),Object.defineProperty(e,"listEnumNumbers",{enumerable:!0,get:function(){return w.listEnumNumbers}}),Object.defineProperty(e,"isEnumObject",{enumerable:!0,get:function(){return w.isEnumObject}});var T=q_();Object.defineProperty(e,"lowerCamelCase",{enumerable:!0,get:function(){return T.lowerCamelCase}});var E=U_();Object.defineProperty(e,"assert",{enumerable:!0,get:function(){return E.assert}}),Object.defineProperty(e,"assertNever",{enumerable:!0,get:function(){return E.assertNever}}),Object.defineProperty(e,"assertInt32",{enumerable:!0,get:function(){return E.assertInt32}}),Object.defineProperty(e,"assertUInt32",{enumerable:!0,get:function(){return E.assertUInt32}}),Object.defineProperty(e,"assertFloat32",{enumerable:!0,get:function(){return E.assertFloat32}})})),uv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.readServiceOption=e.readMethodOption=e.readMethodOptions=e.normalizeMethodInfo=void 0;let t=lv();function normalizeMethodInfo(e,n){let r=e;return r.service=n,r.localName=r.localName??t.lowerCamelCase(r.name),r.serverStreaming=!!r.serverStreaming,r.clientStreaming=!!r.clientStreaming,r.options=r.options??{},r.idempotency=r.idempotency??void 0,r}e.normalizeMethodInfo=normalizeMethodInfo;function readMethodOptions(e,t,n,r){let i=e.methods.find((e,n)=>e.localName===t||n===t)?.options;return i&&i[n]?r.fromJson(i[n]):void 0}e.readMethodOptions=readMethodOptions;function readMethodOption(e,t,n,r){let i=e.methods.find((e,n)=>e.localName===t||n===t)?.options;if(!i)return;let a=i[n];return a===void 0?a:r?r.fromJson(a):a}e.readMethodOption=readMethodOption;function readServiceOption(e,t,n){let r=e.options;if(!r)return;let i=r[t];return i===void 0?i:n?n.fromJson(i):i}e.readServiceOption=readServiceOption})),dv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ServiceType=void 0;let t=uv();e.ServiceType=class{constructor(e,n,r){this.typeName=e,this.methods=n.map(e=>t.normalizeMethodInfo(e,this)),this.options=r??{}}}})),fv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.RpcError=void 0,e.RpcError=class extends Error{constructor(e,t=`UNKNOWN`,n){super(e),this.name=`RpcError`,Object.setPrototypeOf(this,new.target.prototype),this.code=t,this.meta=n??{}}toString(){let e=[this.name+`: `+this.message];this.code&&(e.push(``),e.push(`Code: `+this.code)),this.serviceName&&this.methodName&&e.push(`Method: `+this.serviceName+`/`+this.methodName);let t=Object.entries(this.meta);if(t.length){e.push(``),e.push(`Meta:`);for(let[n,r]of t)e.push(` ${n}: ${r}`)}return e.join(` `)}}})),pv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.mergeRpcOptions=void 0;let t=lv();function mergeRpcOptions(e,n){if(!n)return e;let r={};copy(e,r),copy(n,r);for(let i of Object.keys(n)){let a=n[i];switch(i){case`jsonOptions`:r.jsonOptions=t.mergeJsonOptions(e.jsonOptions,r.jsonOptions);break;case`binaryOptions`:r.binaryOptions=t.mergeBinaryOptions(e.binaryOptions,r.binaryOptions);break;case`meta`:r.meta={},copy(e.meta,r.meta),copy(n.meta,r.meta);break;case`interceptors`:r.interceptors=e.interceptors?e.interceptors.concat(a):a.concat()}}return r}e.mergeRpcOptions=mergeRpcOptions;function copy(e,t){if(!e)return;let n=t;for(let[t,r]of Object.entries(e))n[t]=r instanceof Date?new Date(r.getTime()):Array.isArray(r)?r.concat():r}})),mv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Deferred=e.DeferredState=void 0;var t;(function(e){e[e.PENDING=0]=`PENDING`,e[e.REJECTED=1]=`REJECTED`,e[e.RESOLVED=2]=`RESOLVED`})(t=e.DeferredState||={}),e.Deferred=class{constructor(e=!0){this._state=t.PENDING,this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t}),e&&this._promise.catch(e=>{})}get state(){return this._state}get promise(){return this._promise}resolve(e){if(this.state!==t.PENDING)throw Error(`cannot resolve ${t[this.state].toLowerCase()}`);this._resolve(e),this._state=t.RESOLVED}reject(e){if(this.state!==t.PENDING)throw Error(`cannot reject ${t[this.state].toLowerCase()}`);this._reject(e),this._state=t.REJECTED}resolvePending(e){this._state===t.PENDING&&this.resolve(e)}rejectPending(e){this._state===t.PENDING&&this.reject(e)}}})),hv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.RpcOutputStreamController=void 0;let t=mv(),n=lv();e.RpcOutputStreamController=class{constructor(){this._lis={nxt:[],msg:[],err:[],cmp:[]},this._closed=!1,this._itState={q:[]}}onNext(e){return this.addLis(e,this._lis.nxt)}onMessage(e){return this.addLis(e,this._lis.msg)}onError(e){return this.addLis(e,this._lis.err)}onComplete(e){return this.addLis(e,this._lis.cmp)}addLis(e,t){return t.push(e),()=>{let n=t.indexOf(e);n>=0&&t.splice(n,1)}}clearLis(){for(let e of Object.values(this._lis))e.splice(0,e.length)}get closed(){return this._closed!==!1}notifyNext(e,t,r){n.assert(+!!e+ +!!t+ +!!r<=1,`only one emission at a time`),e&&this.notifyMessage(e),t&&this.notifyError(t),r&&this.notifyComplete()}notifyMessage(e){n.assert(!this.closed,`stream is closed`),this.pushIt({value:e,done:!1}),this._lis.msg.forEach(t=>t(e)),this._lis.nxt.forEach(t=>t(e,void 0,!1))}notifyError(e){n.assert(!this.closed,`stream is closed`),this._closed=e,this.pushIt(e),this._lis.err.forEach(t=>t(e)),this._lis.nxt.forEach(t=>t(void 0,e,!1)),this.clearLis()}notifyComplete(){n.assert(!this.closed,`stream is closed`),this._closed=!0,this.pushIt({value:null,done:!0}),this._lis.cmp.forEach(e=>e()),this._lis.nxt.forEach(e=>e(void 0,void 0,!0)),this.clearLis()}[Symbol.asyncIterator](){return this._closed===!0?this.pushIt({value:null,done:!0}):this._closed!==!1&&this.pushIt(this._closed),{next:()=>{let e=this._itState;n.assert(e,`bad state`),n.assert(!e.p,`iterator contract broken`);let r=e.q.shift();return r?`value`in r?Promise.resolve(r):Promise.reject(r):(e.p=new t.Deferred,e.p.promise)}}}pushIt(e){let r=this._itState;if(r.p){let i=r.p;n.assert(i.state==t.DeferredState.PENDING,`iterator contract broken`),`value`in e?i.resolve(e):i.reject(e),delete r.p}else r.q.push(e)}}})),gv=/* @__PURE__ */ __commonJSMin((e=>{var t=e&&e.__awaiter||function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.UnaryCall=void 0,e.UnaryCall=class{constructor(e,t,n,r,i,a,o){this.method=e,this.requestHeaders=t,this.request=n,this.headers=r,this.response=i,this.status=a,this.trailers=o}then(e,t){return this.promiseFinished().then(t=>e?Promise.resolve(e(t)):t,e=>t?Promise.resolve(t(e)):Promise.reject(e))}promiseFinished(){return t(this,void 0,void 0,function*(){let[e,t,n,r]=yield Promise.all([this.headers,this.response,this.status,this.trailers]);return{method:this.method,requestHeaders:this.requestHeaders,request:this.request,headers:e,response:t,status:n,trailers:r}})}}})),_v=/* @__PURE__ */ __commonJSMin((e=>{var t=e&&e.__awaiter||function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.ServerStreamingCall=void 0,e.ServerStreamingCall=class{constructor(e,t,n,r,i,a,o){this.method=e,this.requestHeaders=t,this.request=n,this.headers=r,this.responses=i,this.status=a,this.trailers=o}then(e,t){return this.promiseFinished().then(t=>e?Promise.resolve(e(t)):t,e=>t?Promise.resolve(t(e)):Promise.reject(e))}promiseFinished(){return t(this,void 0,void 0,function*(){let[e,t,n]=yield Promise.all([this.headers,this.status,this.trailers]);return{method:this.method,requestHeaders:this.requestHeaders,request:this.request,headers:e,status:t,trailers:n}})}}})),vv=/* @__PURE__ */ __commonJSMin((e=>{var t=e&&e.__awaiter||function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.ClientStreamingCall=void 0,e.ClientStreamingCall=class{constructor(e,t,n,r,i,a,o){this.method=e,this.requestHeaders=t,this.requests=n,this.headers=r,this.response=i,this.status=a,this.trailers=o}then(e,t){return this.promiseFinished().then(t=>e?Promise.resolve(e(t)):t,e=>t?Promise.resolve(t(e)):Promise.reject(e))}promiseFinished(){return t(this,void 0,void 0,function*(){let[e,t,n,r]=yield Promise.all([this.headers,this.response,this.status,this.trailers]);return{method:this.method,requestHeaders:this.requestHeaders,headers:e,response:t,status:n,trailers:r}})}}})),yv=/* @__PURE__ */ __commonJSMin((e=>{var t=e&&e.__awaiter||function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.DuplexStreamingCall=void 0,e.DuplexStreamingCall=class{constructor(e,t,n,r,i,a,o){this.method=e,this.requestHeaders=t,this.requests=n,this.headers=r,this.responses=i,this.status=a,this.trailers=o}then(e,t){return this.promiseFinished().then(t=>e?Promise.resolve(e(t)):t,e=>t?Promise.resolve(t(e)):Promise.reject(e))}promiseFinished(){return t(this,void 0,void 0,function*(){let[e,t,n]=yield Promise.all([this.headers,this.status,this.trailers]);return{method:this.method,requestHeaders:this.requestHeaders,headers:e,status:t,trailers:n}})}}})),bv=/* @__PURE__ */ __commonJSMin((e=>{var t=e&&e.__awaiter||function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.TestTransport=void 0;let n=fv(),r=lv(),i=hv(),a=pv(),o=gv(),s=_v(),c=vv(),l=yv();var u=class TestTransport{constructor(e){this.suppressUncaughtRejections=!0,this.headerDelay=10,this.responseDelay=50,this.betweenResponseDelay=10,this.afterResponseDelay=10,this.data=e??{}}get sentMessages(){return this.lastInput instanceof TestInputStream?this.lastInput.sent:typeof this.lastInput==`object`?[this.lastInput.single]:[]}get sendComplete(){return this.lastInput instanceof TestInputStream?this.lastInput.completed:typeof this.lastInput==`object`}promiseHeaders(){let e=this.data.headers??TestTransport.defaultHeaders;return e instanceof n.RpcError?Promise.reject(e):Promise.resolve(e)}promiseSingleResponse(e){if(this.data.response instanceof n.RpcError)return Promise.reject(this.data.response);let t;return Array.isArray(this.data.response)?(r.assert(this.data.response.length>0),t=this.data.response[0]):t=this.data.response===void 0?e.O.create():this.data.response,r.assert(e.O.is(t)),Promise.resolve(t)}streamResponses(e,i,a){return t(this,void 0,void 0,function*(){let t=[];if(this.data.response===void 0)t.push(e.O.create());else if(Array.isArray(this.data.response))for(let n of this.data.response)r.assert(e.O.is(n)),t.push(n);else this.data.response instanceof n.RpcError||(r.assert(e.O.is(this.data.response)),t.push(this.data.response));try{yield delay(this.responseDelay,a)(void 0)}catch(e){i.notifyError(e);return}if(this.data.response instanceof n.RpcError){i.notifyError(this.data.response);return}for(let e of t){i.notifyMessage(e);try{yield delay(this.betweenResponseDelay,a)(void 0)}catch(e){i.notifyError(e);return}}if(this.data.status instanceof n.RpcError){i.notifyError(this.data.status);return}if(this.data.trailers instanceof n.RpcError){i.notifyError(this.data.trailers);return}i.notifyComplete()})}promiseStatus(){let e=this.data.status??TestTransport.defaultStatus;return e instanceof n.RpcError?Promise.reject(e):Promise.resolve(e)}promiseTrailers(){let e=this.data.trailers??TestTransport.defaultTrailers;return e instanceof n.RpcError?Promise.reject(e):Promise.resolve(e)}maybeSuppressUncaught(...e){if(this.suppressUncaughtRejections)for(let t of e)t.catch(()=>{})}mergeOptions(e){return a.mergeRpcOptions({},e)}unary(e,t,n){let r=n.meta??{},i=this.promiseHeaders().then(delay(this.headerDelay,n.abort)),a=i.catch(e=>{}).then(delay(this.responseDelay,n.abort)).then(t=>this.promiseSingleResponse(e)),s=a.catch(e=>{}).then(delay(this.afterResponseDelay,n.abort)).then(e=>this.promiseStatus()),c=a.catch(e=>{}).then(delay(this.afterResponseDelay,n.abort)).then(e=>this.promiseTrailers());return this.maybeSuppressUncaught(s,c),this.lastInput={single:t},new o.UnaryCall(e,r,t,i,a,s,c)}serverStreaming(e,t,n){let r=n.meta??{},a=this.promiseHeaders().then(delay(this.headerDelay,n.abort)),o=new i.RpcOutputStreamController,c=a.then(delay(this.responseDelay,n.abort)).catch(()=>{}).then(()=>this.streamResponses(e,o,n.abort)).then(delay(this.afterResponseDelay,n.abort)),l=c.then(()=>this.promiseStatus()),u=c.then(()=>this.promiseTrailers());return this.maybeSuppressUncaught(l,u),this.lastInput={single:t},new s.ServerStreamingCall(e,r,t,a,o,l,u)}clientStreaming(e,t){let n=t.meta??{},r=this.promiseHeaders().then(delay(this.headerDelay,t.abort)),i=r.catch(e=>{}).then(delay(this.responseDelay,t.abort)).then(t=>this.promiseSingleResponse(e)),a=i.catch(e=>{}).then(delay(this.afterResponseDelay,t.abort)).then(e=>this.promiseStatus()),o=i.catch(e=>{}).then(delay(this.afterResponseDelay,t.abort)).then(e=>this.promiseTrailers());return this.maybeSuppressUncaught(a,o),this.lastInput=new TestInputStream(this.data,t.abort),new c.ClientStreamingCall(e,n,this.lastInput,r,i,a,o)}duplex(e,t){let n=t.meta??{},r=this.promiseHeaders().then(delay(this.headerDelay,t.abort)),a=new i.RpcOutputStreamController,o=r.then(delay(this.responseDelay,t.abort)).catch(()=>{}).then(()=>this.streamResponses(e,a,t.abort)).then(delay(this.afterResponseDelay,t.abort)),s=o.then(()=>this.promiseStatus()),c=o.then(()=>this.promiseTrailers());return this.maybeSuppressUncaught(s,c),this.lastInput=new TestInputStream(this.data,t.abort),new l.DuplexStreamingCall(e,n,this.lastInput,r,a,s,c)}};e.TestTransport=u,u.defaultHeaders={responseHeader:`test`},u.defaultStatus={code:`OK`,detail:`all good`},u.defaultTrailers={responseTrailer:`test`};function delay(e,t){return r=>new Promise((i,a)=>{if(t?.aborted)a(new n.RpcError(`user cancel`,`CANCELLED`));else{let o=setTimeout(()=>i(r),e);t&&t.addEventListener(`abort`,e=>{clearTimeout(o),a(new n.RpcError(`user cancel`,`CANCELLED`))})}})}var TestInputStream=class{constructor(e,t){this._completed=!1,this._sent=[],this.data=e,this.abort=t}get sent(){return this._sent}get completed(){return this._completed}send(e){if(this.data.inputMessage instanceof n.RpcError)return Promise.reject(this.data.inputMessage);let t=this.data.inputMessage===void 0?10:this.data.inputMessage;return Promise.resolve(void 0).then(()=>{this._sent.push(e)}).then(delay(t,this.abort))}complete(){if(this.data.inputComplete instanceof n.RpcError)return Promise.reject(this.data.inputComplete);let e=this.data.inputComplete===void 0?10:this.data.inputComplete;return Promise.resolve(void 0).then(()=>{this._completed=!0}).then(delay(e,this.abort))}}})),xv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.stackDuplexStreamingInterceptors=e.stackClientStreamingInterceptors=e.stackServerStreamingInterceptors=e.stackUnaryInterceptors=e.stackIntercept=void 0;let t=lv();function stackIntercept(e,n,r,i,a){if(e==`unary`){let tail=(e,t,r)=>n.unary(e,t,r);for(let e of(i.interceptors??[]).filter(e=>e.interceptUnary).reverse()){let t=tail;tail=(n,r,i)=>e.interceptUnary(t,n,r,i)}return tail(r,a,i)}if(e==`serverStreaming`){let tail=(e,t,r)=>n.serverStreaming(e,t,r);for(let e of(i.interceptors??[]).filter(e=>e.interceptServerStreaming).reverse()){let t=tail;tail=(n,r,i)=>e.interceptServerStreaming(t,n,r,i)}return tail(r,a,i)}if(e==`clientStreaming`){let tail=(e,t)=>n.clientStreaming(e,t);for(let e of(i.interceptors??[]).filter(e=>e.interceptClientStreaming).reverse()){let t=tail;tail=(n,r)=>e.interceptClientStreaming(t,n,r)}return tail(r,i)}if(e==`duplex`){let tail=(e,t)=>n.duplex(e,t);for(let e of(i.interceptors??[]).filter(e=>e.interceptDuplex).reverse()){let t=tail;tail=(n,r)=>e.interceptDuplex(t,n,r)}return tail(r,i)}t.assertNever(e)}e.stackIntercept=stackIntercept;function stackUnaryInterceptors(e,t,n,r){return stackIntercept(`unary`,e,t,r,n)}e.stackUnaryInterceptors=stackUnaryInterceptors;function stackServerStreamingInterceptors(e,t,n,r){return stackIntercept(`serverStreaming`,e,t,r,n)}e.stackServerStreamingInterceptors=stackServerStreamingInterceptors;function stackClientStreamingInterceptors(e,t,n){return stackIntercept(`clientStreaming`,e,t,n)}e.stackClientStreamingInterceptors=stackClientStreamingInterceptors;function stackDuplexStreamingInterceptors(e,t,n){return stackIntercept(`duplex`,e,t,n)}e.stackDuplexStreamingInterceptors=stackDuplexStreamingInterceptors})),Sv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ServerCallContextController=void 0,e.ServerCallContextController=class{constructor(e,t,n,r,i={code:`OK`,detail:``}){this._cancelled=!1,this._listeners=[],this.method=e,this.headers=t,this.deadline=n,this.trailers={},this._sendRH=r,this.status=i}notifyCancelled(){if(!this._cancelled){this._cancelled=!0;for(let e of this._listeners)e()}}sendResponseHeaders(e){this._sendRH(e)}get cancelled(){return this._cancelled}onCancel(e){let t=this._listeners;return t.push(e),()=>{let n=t.indexOf(e);n>=0&&t.splice(n,1)}}}})),Cv=(/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=dv();Object.defineProperty(e,"ServiceType",{enumerable:!0,get:function(){return t.ServiceType}});var n=uv();Object.defineProperty(e,"readMethodOptions",{enumerable:!0,get:function(){return n.readMethodOptions}}),Object.defineProperty(e,"readMethodOption",{enumerable:!0,get:function(){return n.readMethodOption}}),Object.defineProperty(e,"readServiceOption",{enumerable:!0,get:function(){return n.readServiceOption}});var r=fv();Object.defineProperty(e,"RpcError",{enumerable:!0,get:function(){return r.RpcError}});var i=pv();Object.defineProperty(e,"mergeRpcOptions",{enumerable:!0,get:function(){return i.mergeRpcOptions}});var a=hv();Object.defineProperty(e,"RpcOutputStreamController",{enumerable:!0,get:function(){return a.RpcOutputStreamController}});var o=bv();Object.defineProperty(e,"TestTransport",{enumerable:!0,get:function(){return o.TestTransport}});var s=mv();Object.defineProperty(e,"Deferred",{enumerable:!0,get:function(){return s.Deferred}}),Object.defineProperty(e,"DeferredState",{enumerable:!0,get:function(){return s.DeferredState}});var c=yv();Object.defineProperty(e,"DuplexStreamingCall",{enumerable:!0,get:function(){return c.DuplexStreamingCall}});var l=vv();Object.defineProperty(e,"ClientStreamingCall",{enumerable:!0,get:function(){return l.ClientStreamingCall}});var u=_v();Object.defineProperty(e,"ServerStreamingCall",{enumerable:!0,get:function(){return u.ServerStreamingCall}});var d=gv();Object.defineProperty(e,"UnaryCall",{enumerable:!0,get:function(){return d.UnaryCall}});var f=xv();Object.defineProperty(e,"stackIntercept",{enumerable:!0,get:function(){return f.stackIntercept}}),Object.defineProperty(e,"stackDuplexStreamingInterceptors",{enumerable:!0,get:function(){return f.stackDuplexStreamingInterceptors}}),Object.defineProperty(e,"stackClientStreamingInterceptors",{enumerable:!0,get:function(){return f.stackClientStreamingInterceptors}}),Object.defineProperty(e,"stackServerStreamingInterceptors",{enumerable:!0,get:function(){return f.stackServerStreamingInterceptors}}),Object.defineProperty(e,"stackUnaryInterceptors",{enumerable:!0,get:function(){return f.stackUnaryInterceptors}});var p=Sv();Object.defineProperty(e,"ServerCallContextController",{enumerable:!0,get:function(){return p.ServerCallContextController}})})))(),$=lv();const wv=new class extends $.MessageType{constructor(){super(`github.actions.results.entities.v1.CacheScope`,[{no:1,name:`scope`,kind:`scalar`,T:9},{no:2,name:`permission`,kind:`scalar`,T:3}])}create(e){let t={scope:``,permission:`0`};return globalThis.Object.defineProperty(t,$.MESSAGE_TYPE,{enumerable:!1,value:this}),e!==void 0&&(0,$.reflectionMergePartial)(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),a=e.pos+t;for(;e.poswv}])}create(e){let t={repositoryId:`0`,scope:[]};return globalThis.Object.defineProperty(t,$.MESSAGE_TYPE,{enumerable:!1,value:this}),e!==void 0&&(0,$.reflectionMergePartial)(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),a=e.pos+t;for(;e.posTv},{no:2,name:`key`,kind:`scalar`,T:9},{no:3,name:`version`,kind:`scalar`,T:9}])}create(e){let t={key:``,version:``};return globalThis.Object.defineProperty(t,$.MESSAGE_TYPE,{enumerable:!1,value:this}),e!==void 0&&(0,$.reflectionMergePartial)(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),a=e.pos+t;for(;e.posTv},{no:2,name:`key`,kind:`scalar`,T:9},{no:3,name:`size_bytes`,kind:`scalar`,T:3},{no:4,name:`version`,kind:`scalar`,T:9}])}create(e){let t={key:``,sizeBytes:`0`,version:``};return globalThis.Object.defineProperty(t,$.MESSAGE_TYPE,{enumerable:!1,value:this}),e!==void 0&&(0,$.reflectionMergePartial)(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),a=e.pos+t;for(;e.posTv},{no:2,name:`key`,kind:`scalar`,T:9},{no:3,name:`restore_keys`,kind:`scalar`,repeat:2,T:9},{no:4,name:`version`,kind:`scalar`,T:9}])}create(e){let t={key:``,restoreKeys:[],version:``};return globalThis.Object.defineProperty(t,$.MESSAGE_TYPE,{enumerable:!1,value:this}),e!==void 0&&(0,$.reflectionMergePartial)(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),a=e.pos+t;for(;e.posDv.fromJson(e,{ignoreUnknownFields:!0}))}FinalizeCacheEntryUpload(e){let t=Ov.toJson(e,{useProtoFieldName:!0,emitDefaultValues:!1});return this.rpc.request(`github.actions.results.api.v1.CacheService`,`FinalizeCacheEntryUpload`,`application/json`,t).then(e=>kv.fromJson(e,{ignoreUnknownFields:!0}))}GetCacheEntryDownloadURL(e){let t=Av.toJson(e,{useProtoFieldName:!0,emitDefaultValues:!1});return this.rpc.request(`github.actions.results.api.v1.CacheService`,`GetCacheEntryDownloadURL`,`application/json`,t).then(e=>jv.fromJson(e,{ignoreUnknownFields:!0}))}};function maskSigUrl(e){if(e)try{let t=new URL(e).searchParams.get(`sig`);t&&(setSecret(t),setSecret(encodeURIComponent(t)))}catch(t){debug(`Failed to parse URL: ${e} ${t instanceof Error?t.message:String(t)}`)}}function maskSecretUrls(e){if(typeof e!=`object`||!e){debug(`body is not an object or is null`);return}`signed_upload_url`in e&&typeof e.signed_upload_url==`string`&&maskSigUrl(e.signed_upload_url),`signed_download_url`in e&&typeof e.signed_download_url==`string`&&maskSigUrl(e.signed_download_url)}var __awaiter$2=function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})},CacheServiceClient=class{constructor(e,t,n,r){this.maxAttempts=5,this.baseRetryIntervalMilliseconds=3e3,this.retryMultiplier=1.5;let i=getRuntimeToken();this.baseUrl=getCacheServiceURL(),t&&(this.maxAttempts=t),n&&(this.baseRetryIntervalMilliseconds=n),r&&(this.retryMultiplier=r),this.httpClient=new HttpClient(e,[new BearerCredentialHandler(i)])}request(e,t,n,r){return __awaiter$2(this,void 0,void 0,function*(){let i=new URL(`/twirp/${e}/${t}`,this.baseUrl).href;debug(`[Request] ${t} ${i}`);let a={"Content-Type":n};try{let{body:e}=yield this.retryableRequest(()=>__awaiter$2(this,void 0,void 0,function*(){return this.httpClient.post(i,JSON.stringify(r),a)}));return e}catch(e){throw Error(`Failed to ${t}: ${e.message}`)}})}retryableRequest(e){return __awaiter$2(this,void 0,void 0,function*(){let t=0,n=``,r=``;for(;t0&&warning(`You've hit a rate limit, your rate limit will reset in ${t} seconds`)}throw new RateLimitError(`Rate limited: ${n}`)}}catch(e){if(e instanceof SyntaxError&&debug(`Raw Body: ${r}`),e instanceof UsageError||e instanceof RateLimitError)throw e;if(NetworkError.isNetworkErrorCode(e?.code))throw new NetworkError(e?.code);i=!0,n=e.message}if(!i)throw Error(`Received non-retryable error: ${n}`);if(t+1===this.maxAttempts)throw Error(`Failed to make request after ${this.maxAttempts} attempts: ${n}`);let a=this.getExponentialRetryTimeMilliseconds(t);info(`Attempt ${t+1} of ${this.maxAttempts} failed with error: ${n}. Retrying request in ${a} ms...`),yield this.sleep(a),t++}throw Error(`Request failed`)})}isSuccessStatusCode(e){return e?e>=200&&e<300:!1}isRetryableHttpStatusCode(e){return e?[On.BadGateway,On.GatewayTimeout,On.InternalServerError,On.ServiceUnavailable].includes(e):!1}sleep(e){return __awaiter$2(this,void 0,void 0,function*(){return new Promise(t=>setTimeout(t,e))})}getExponentialRetryTimeMilliseconds(e){if(e<0)throw Error(`attempt should be a positive integer`);if(e===0)return this.baseRetryIntervalMilliseconds;let t=this.baseRetryIntervalMilliseconds*this.retryMultiplier**+e,n=t*this.retryMultiplier;return Math.trunc(Math.random()*(n-t)+t)}};function internalCacheTwirpClient(e){return new CacheServiceClientJSON(new CacheServiceClient(getUserAgentString(),e?.maxAttempts,e?.retryIntervalMs,e?.retryMultiplier))}var __awaiter$1=function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})};const Mv=process.platform===`win32`;function getTarPath(){return __awaiter$1(this,void 0,void 0,function*(){switch(process.platform){case`win32`:{let e=yield getGnuTarPathOnWindows(),t=ps;if(e)return{path:e,type:ls.GNU};if(s(t))return{path:t,type:ls.BSD};break}case`darwin`:{let e=yield which(`gtar`,!1);return e?{path:e,type:ls.GNU}:{path:yield which(`tar`,!0),type:ls.BSD}}}return{path:yield which(`tar`,!0),type:ls.GNU}})}function getTarArgs(e,t,n){return __awaiter$1(this,arguments,void 0,function*(e,t,n,r=``){let i=[`"${e.path}"`],a=getCacheFileName(t),o=`cache.tar`,s=getWorkingDirectory(),c=e.type===ls.BSD&&t!==cs.Gzip&&Mv;switch(n){case`create`:i.push(`--posix`,`-cf`,c?o:a.replace(RegExp(`\\${u.sep}`,`g`),`/`),`--exclude`,c?o:a.replace(RegExp(`\\${u.sep}`,`g`),`/`),`-P`,`-C`,s.replace(RegExp(`\\${u.sep}`,`g`),`/`),`--files-from`,hs);break;case`extract`:i.push(`-xf`,c?o:r.replace(RegExp(`\\${u.sep}`,`g`),`/`),`-P`,`-C`,c?quoteAbsolutePath(s):s.replace(RegExp(`\\${u.sep}`,`g`),`/`));break;case`list`:i.push(`-tf`,c?o:r.replace(RegExp(`\\${u.sep}`,`g`),`/`),`-P`)}if(e.type===ls.GNU)switch(process.platform){case`win32`:i.push(`--force-local`);break;case`darwin`:i.push(`--delay-directory-restore`)}return i})}function getCommands(e,t){return __awaiter$1(this,arguments,void 0,function*(e,t,n=``){let r,i=yield getTarPath(),a=yield getTarArgs(i,e,t,n),o=t===`create`?yield getCompressionProgram(i,e):yield getDecompressionProgram(i,e,n),s=i.type===ls.BSD&&e!==cs.Gzip&&Mv;return r=s&&t!==`create`?[[...o].join(` `),[...a].join(` `)]:[[...a].join(` `),[...o].join(` `)],{commands:s?r:[r.join(` `)],requiresTempDirectory:s&&t!==`create`}})}function getWorkingDirectory(){return process.env.GITHUB_WORKSPACE??process.cwd()}function quoteAbsolutePath(e){return`"${u.resolve(e).replace(RegExp(`\\${u.sep}`,`g`),`/`)}"`}function getDecompressionProgram(e,t,n){return __awaiter$1(this,void 0,void 0,function*(){let r=e.type===ls.BSD&&t!==cs.Gzip&&Mv;switch(t){case cs.Zstd:return r?[`zstd -d --long=30 --force -o`,ms,quoteAbsolutePath(n)]:[`--use-compress-program`,Mv?`"zstd -d --long=30"`:`unzstd --long=30`];case cs.ZstdWithoutLong:return r?[`zstd -d --force -o`,ms,quoteAbsolutePath(n)]:[`--use-compress-program`,Mv?`"zstd -d"`:`unzstd`];default:return[`-z`]}})}function getCompressionProgram(e,t){return __awaiter$1(this,void 0,void 0,function*(){let n=getCacheFileName(t),r=e.type===ls.BSD&&t!==cs.Gzip&&Mv;switch(t){case cs.Zstd:return r?[`zstd -T0 --long=30 --force -o`,n.replace(RegExp(`\\${u.sep}`,`g`),`/`),ms]:[`--use-compress-program`,Mv?`"zstd -T0 --long=30"`:`zstdmt --long=30`];case cs.ZstdWithoutLong:return r?[`zstd -T0 --force -o`,n.replace(RegExp(`\\${u.sep}`,`g`),`/`),ms]:[`--use-compress-program`,Mv?`"zstd -T0"`:`zstdmt`];default:return[`-z`]}})}function execCommands(e,t){return __awaiter$1(this,void 0,void 0,function*(){for(let n of e)try{yield exec(n,void 0,{cwd:t,env:Object.assign(Object.assign({},process.env),{MSYS:`winsymlinks:nativestrict`})})}catch(e){throw Error(`${n.split(` `)[0]} failed with error: ${e?.message}`)}})}function execReadCommands(e,t,n){return __awaiter$1(this,void 0,void 0,function*(){let{commands:r,requiresTempDirectory:i}=yield getCommands(t,n,e),a=i?yield createTempDirectory():void 0;try{yield execCommands(r,a)}finally{if(a)try{yield rmRF(a)}catch(e){debug(`Failed to delete temporary tar directory: ${e}`)}}})}function listTar(e,t){return __awaiter$1(this,void 0,void 0,function*(){yield execReadCommands(e,t,`list`)})}function extractTar(e,t){return __awaiter$1(this,void 0,void 0,function*(){yield mkdirP(getWorkingDirectory()),yield execReadCommands(e,t,`extract`)})}function createTar(e,t,n){return __awaiter$1(this,void 0,void 0,function*(){l(u.join(e,hs),t.join(` -`));let{commands:r}=yield getCommands(n,`create`);yield execCommands(r,e)})}var __awaiter=function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})},Nv=class ValidationError extends Error{constructor(e){super(e),this.name=`ValidationError`,Object.setPrototypeOf(this,ValidationError.prototype)}},Pv=class ReserveCacheError extends Error{constructor(e){super(e),this.name=`ReserveCacheError`,Object.setPrototypeOf(this,ReserveCacheError.prototype)}},Fv=class CacheWriteDeniedError extends Pv{constructor(e){super(e),this.name=`CacheWriteDeniedError`,Object.setPrototypeOf(this,CacheWriteDeniedError.prototype)}};const Iv=`cache read denied:`;var Lv=class CacheReadDeniedError extends Error{constructor(e){super(e),this.name=`CacheReadDeniedError`,Object.setPrototypeOf(this,CacheReadDeniedError.prototype)}},Rv=class FinalizeCacheError extends Error{constructor(e){super(e),this.name=`FinalizeCacheError`,Object.setPrototypeOf(this,FinalizeCacheError.prototype)}};function checkPaths(e){if(!e||e.length===0)throw new Nv(`Path Validation Error: At least one directory or file path is required`)}function checkKey(e){if(e.length>512)throw new Nv(`Key Validation Error: ${e} cannot be larger than 512 characters.`);if(!/^[^,]*$/.test(e))throw new Nv(`Key Validation Error: ${e} cannot contain commas.`)}function restoreCache$1(e,t,n,r){return __awaiter(this,arguments,void 0,function*(e,t,n,r,i=!1){let a=getCacheServiceVersion();debug(`Cache service version: ${a}`),checkPaths(e);let o=getCacheMode();if(!isCacheReadable(o)){info(`Cache restore skipped: the effective cache-mode '${o}' does not permit reads.`),debug(`Skipped restore for paths [${e.join(`, `)}] with primary key '${t}'.`);return}switch(a){case`v2`:return yield restoreCacheV2(e,t,n,r,i);default:return yield restoreCacheV1(e,t,n,r,i)}})}function restoreCacheV1(e,t,n,r){return __awaiter(this,arguments,void 0,function*(e,t,n,r,i=!1){n||=[];let a=[t,...n];if(debug(`Resolved Keys:`),debug(JSON.stringify(a)),a.length>10)throw new Nv(`Key Validation Error: Keys are limited to a maximum of 10.`);for(let e of a)checkKey(e);let o=yield getCompressionMethod(),s=``;try{let t;try{t=yield getCacheEntry(a,e,{compressionMethod:o,enableCrossOsArchive:i})}catch(e){let t=e?.message??``;throw t.includes(Iv)?new Lv(t):e}if(!t?.archiveLocation)return;if(r?.lookupOnly)return info(`Lookup only - skipping download`),t.cacheKey;s=u.join(yield createTempDirectory(),getCacheFileName(o)),debug(`Archive Path: ${s}`),yield downloadCache(t.archiveLocation,s,r),isDebug()&&(yield listTar(s,o));let n=getArchiveFileSizeInBytes(s);return info(`Cache Size: ~${Math.round(n/1048576)} MB (${n} B)`),yield extractTar(s,o),info(`Cache restored successfully`),t.cacheKey}catch(e){let t=e;if(t.name===Nv.name)throw e;t instanceof Pn&&typeof t.statusCode==`number`&&t.statusCode>=500?error(`Failed to restore: ${e.message}`):warning(`Failed to restore: ${e.message}`)}finally{try{yield unlinkFile(s)}catch(e){debug(`Failed to delete archive: ${e}`)}}})}function restoreCacheV2(e,t,n,r){return __awaiter(this,arguments,void 0,function*(e,t,n,r,i=!1){r=Object.assign(Object.assign({},r),{useAzureSdk:!0}),n||=[];let a=[t,...n];if(debug(`Resolved Keys:`),debug(JSON.stringify(a)),a.length>10)throw new Nv(`Key Validation Error: Keys are limited to a maximum of 10.`);for(let e of a)checkKey(e);let o=``;try{let s=internalCacheTwirpClient(),c=yield getCompressionMethod(),l={key:t,restoreKeys:n,version:getCacheVersion(e,c,i)},d;try{d=yield s.GetCacheEntryDownloadURL(l)}catch(e){let t=e?.message??``;throw t.includes(Iv)?new Lv(t):e}if(!d.ok){debug(`Cache not found for version ${l.version} of keys: ${a.join(`, `)}`);return}if(l.key===d.matchedKey?info(`Cache hit for: ${d.matchedKey}`):info(`Cache hit for restore-key: ${d.matchedKey}`),r?.lookupOnly)return info(`Lookup only - skipping download`),d.matchedKey;o=u.join(yield createTempDirectory(),getCacheFileName(c)),debug(`Archive path: ${o}`),debug(`Starting download of archive to: ${o}`),yield downloadCache(d.signedDownloadUrl,o,r);let f=getArchiveFileSizeInBytes(o);return info(`Cache Size: ~${Math.round(f/1048576)} MB (${f} B)`),isDebug()&&(yield listTar(o,c)),yield extractTar(o,c),info(`Cache restored successfully`),d.matchedKey}catch(e){let t=e;if(t.name===Nv.name)throw e;t instanceof Pn&&typeof t.statusCode==`number`&&t.statusCode>=500?error(`Failed to restore: ${e.message}`):warning(`Failed to restore: ${e.message}`)}finally{try{o&&(yield unlinkFile(o))}catch(e){debug(`Failed to delete archive: ${e}`)}}})}function saveCache$1(e,t,n){return __awaiter(this,arguments,void 0,function*(e,t,n,r=!1){let i=getCacheServiceVersion();debug(`Cache service version: ${i}`),checkPaths(e),checkKey(t);let a=getCacheMode();if(!isCacheWritable(a))return info(`Cache save skipped: the effective cache-mode '${a}' does not permit writes.`),debug(`Skipped save for paths [${e.join(`, `)}] with key '${t}'.`),-1;switch(i){case`v2`:return yield saveCacheV2(e,t,n,r);default:return yield saveCacheV1(e,t,n,r)}})}function saveCacheV1(e,t,n){return __awaiter(this,arguments,void 0,function*(e,t,n,r=!1){let i=yield getCompressionMethod(),a=-1,o=yield resolvePaths(e);if(debug(`Cache Paths:`),debug(`${JSON.stringify(o)}`),o.length===0)throw Error(`Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.`);let s=yield createTempDirectory(),c=u.join(s,getCacheFileName(i));debug(`Archive Path: ${c}`);try{yield createTar(s,o,i),isDebug()&&(yield listTar(c,i));let l=getArchiveFileSizeInBytes(c);if(debug(`File Size: ${l}`),l>10737418240&&!isGhes())throw Error(`Cache size of ~${Math.round(l/1048576)} MB (${l} B) is over the 10GB limit, not saving cache.`);debug(`Reserving Cache`);let u=yield reserveCache(t,e,{compressionMethod:i,enableCrossOsArchive:r,cacheSize:l});if(u?.result?.cacheId)a=u?.result?.cacheId;else if(u?.statusCode===400)throw Error(u?.error?.message??`Cache size of ~${Math.round(l/1048576)} MB (${l} B) is over the data cap limit, not saving cache.`);else{let e=u?.error?.message;throw e?.startsWith(`cache write denied:`)?new Fv(`Unable to reserve cache with key ${t}. More details: ${e}`):new Pv(`Unable to reserve cache with key ${t}, another job may be creating this cache. More details: ${u?.error?.message}`)}debug(`Saving Cache (ID: ${a})`),yield saveCache$2(a,c,``,n)}catch(e){let t=e;if(t.name===Nv.name)throw e;t.name===Pv.name?info(`Failed to save: ${t.message}`):t instanceof Pn&&typeof t.statusCode==`number`&&t.statusCode>=500?error(`Failed to save: ${t.message}`):warning(`Failed to save: ${t.message}`)}finally{try{yield unlinkFile(c)}catch(e){debug(`Failed to delete archive: ${e}`)}}return a})}function saveCacheV2(e,t,n){return __awaiter(this,arguments,void 0,function*(e,t,n,r=!1){n=Object.assign(Object.assign({},n),{uploadChunkSize:67108864,uploadConcurrency:8,useAzureSdk:!0});let i=yield getCompressionMethod(),a=internalCacheTwirpClient(),o=-1,s=yield resolvePaths(e);if(debug(`Cache Paths:`),debug(`${JSON.stringify(s)}`),s.length===0)throw Error(`Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.`);let c=yield createTempDirectory(),l=u.join(c,getCacheFileName(i));debug(`Archive Path: ${l}`);try{yield createTar(c,s,i),isDebug()&&(yield listTar(l,i));let u=getArchiveFileSizeInBytes(l);debug(`File Size: ${u}`),n.archiveSizeBytes=u,debug(`Reserving Cache`);let d=getCacheVersion(e,i,r),f={key:t,version:d},p;try{let e=yield a.CreateCacheEntry(f);if(!e.ok)throw e.message&&!e.message.startsWith(`cache write denied:`)&&warning(`Cache reservation failed: ${e.message}`),Error(e.message||`Response was not ok`);p=e.signedUploadUrl}catch(e){debug(`Failed to reserve cache: ${e}`);let n=e?.message??``;throw n.startsWith(`cache write denied:`)?new Fv(`Unable to reserve cache with key ${t}. More details: ${n}`):new Pv(`Unable to reserve cache with key ${t}, another job may be creating this cache.`)}debug(`Attempting to upload cache located at: ${l}`),yield saveCache$2(o,l,p,n);let m={key:t,version:d,sizeBytes:`${u}`},h=yield a.FinalizeCacheEntryUpload(m);if(debug(`FinalizeCacheEntryUploadResponse: ${h.ok}`),!h.ok)throw h.message?new Rv(h.message):Error(`Unable to finalize cache with key ${t}, another job may be finalizing this cache.`);o=parseInt(h.entryId)}catch(e){let t=e;if(t.name===Nv.name)throw e;t.name===Pv.name?info(`Failed to save: ${t.message}`):t.name===Rv.name?warning(t.message):t instanceof Pn&&typeof t.statusCode==`number`&&t.statusCode>=500?error(`Failed to save: ${t.message}`):warning(`Failed to save: ${t.message}`)}finally{try{yield unlinkFile(l)}catch(e){debug(`Failed to delete archive: ${e}`)}}return o})}function commandPath(e,t=process.env){if(!e||e===`.`||e===`..`||/[\\/:]/.test(e))return;let n=isWindows(),r=n?Object.keys(t).sort().find(e=>e.toUpperCase()===`PATH`):`PATH`,i=r&&t[r]||``,a=n&&!e.toLowerCase().endsWith(`.exe`)?`${e}.exe`:e,o=ge(process.cwd(),{bigint:!0});for(let e of i.split(M.delimiter)){let t=n?e.replace(/^"(.*)"$/,`$1`):e;if(M.isAbsolute(t))try{let e=ge(t,{bigint:!0});if(e.dev===o.dev&&e.ino===o.ino)continue;let r=M.join(t,a);if(!ge(r).isFile())continue;return le(r,n?de.F_OK:de.X_OK),r}catch{}}}function resolveSfwEnabled(e,t,n){return e?!pkgPrNewCommitSha(t)||(n(`sfw was requested but is automatically disabled for Vite+ preview build ${t}; Socket Firewall Free will not be used.`),!1):!1}const zv=`v1.15.4`,Bv=`https://github.com/SocketDev/sfw-free/releases/download/${zv}`;function isMuslLinux(){if(process.platform!==`linux`)return!1;try{let e=process.report?.getReport();if(e?.header&&!e.header.glibcVersionRuntime)return!0}catch{}return F(`/etc/alpine-release`)}function getSfwAssetName(e,t,n){if(e===`darwin`){if(t===`arm64`)return`sfw-free-macos-arm64`;if(t===`x64`)return`sfw-free-macos-x86_64`}else if(e===`linux`){if(t===`arm64`)return n?`sfw-free-musl-linux-arm64`:`sfw-free-linux-arm64`;if(t===`x64`)return n?`sfw-free-musl-linux-x86_64`:`sfw-free-linux-x86_64`}else if(isWindows(e)){if(t===`arm64`)return`sfw-free-windows-arm64.exe`;if(t===`x64`)return`sfw-free-windows-x86_64.exe`}throw Error(`Unsupported platform/arch for sfw: ${e}/${t}${e===`linux`?` (${n?`musl`:`glibc`})`:``}`)}const Vv=2e3;function isSfwSupported(e=process.platform,t=process.arch,n=isMuslLinux()){try{return!!getSfwAssetName(e,t,n)}catch{return!1}}function getSfwBinDir(){let e=process.env.RUNNER_TEMP||process.env.TMPDIR||process.env.TEMP||`/tmp`;return ae(e,`sfw-bin`)}async function installSfw(){let e=getSfwAssetName(process.platform,process.arch,isMuslLinux()),t=`${Bv}/${e}`,n=getSfwBinDir();fe(n,{recursive:!0});let r=P(n,isWindows()?`sfw.exe`:`sfw`),i=`sfw-${zv}-${process.platform}-${process.arch}-${isMuslLinux()?`musl`:`glibc`}`;try{let e=await restoreCache$1([n],i);if(e&&F(r))return isWindows()||ue(r,493),addPath(n),info(`sfw restored from cache: ${e}`),r}catch(e){warning(`sfw cache restore failed (${e instanceof Error?e.message:String(e)}); falling through to download.`)}info(`Installing sfw from ${t}...`);let a=``;for(let e=1;e<=2;e++){try{let e=await runDownloadCommand(t,r);if(e===0&&F(r)){isWindows()||ue(r,493),addPath(n),info(`sfw installed at ${r}`);try{await saveCache$1([n],i),info(`sfw cached under key: ${i}`)}catch(e){warning(`sfw cache save failed (${e instanceof Error?e.message:String(e)}); continuing.`)}return r}a=`exit code ${e}`}catch(e){a=e instanceof Error?e.message:String(e)}e<2&&(warning(`Failed to install sfw from ${t} (${a}). Retrying in ${Vv}ms... (attempt ${e+1}/2)`),await se(Vv))}throw Error(`Failed to install sfw from ${t} after 2 attempts: ${a}`)}function findSfwOnPath(){return commandPath(`sfw`)??null}async function setupSfw(e){if(!resolveSfwEnabled(e.sfw,e.version,warning))return{executable:`vp`,sfw:!1};if(e.runInstall.length===0)return info("sfw was requested but `run-install` is disabled; sfw will not be invoked."),{executable:`vp`,sfw:!1};let t=findSfwOnPath();return t?(info(`Using existing sfw on PATH: ${t}`),{executable:t,sfw:!0}):isSfwSupported()?{executable:await installSfw(),sfw:!0}:(warning(`sfw has no published binary for this runner's platform/architecture (${`process.platform=${process.platform}, process.arch=${process.arch}, musl=${isMuslLinux()}`}) and none was found on PATH; falling back to plain \`vp install\`. To enable sfw here, install a working sfw binary on PATH in an earlier step (e.g. via \`socketdev/action@\` or a custom install).`),{executable:`vp`,sfw:!1})}async function runDownloadCommand(e,t){let n={ignoreReturnCode:!0};return isWindows()?exec(`pwsh`,[`-Command`,`Invoke-WebRequest -UseBasicParsing -Uri '${e}' -OutFile '${t}' -TimeoutSec 60`],n):exec(`bash`,[`-c`,`set -o pipefail; curl -fsSL --connect-timeout 5 --max-time 60 -o '${t}' '${e}'`],n)}const Hv=/Command 'vp' not found in PATH/;function isSfwVpNotFoundFlake(e,t){return Hv.test(t)||Hv.test(e)}async function warmPowerShellCommandCache(){if(isWindows())try{await getExecOutput(`powershell.exe`,[`-NoProfile`,`-Command`,`Get-Command vp`],{ignoreReturnCode:!0})}catch(e){info(`PowerShell warm-up failed (${String(e)}); retrying sfw anyway.`)}}function tailOutput(e,t){let n=e.trim();return n.length<=t?n:`…(truncated, showing last ${t} chars)…\n${n.slice(-t)}`}async function runViteInstall(e,t){let n=getConfiguredProjectDir(e),{executable:r,sfw:i}=t;for(let t of e.runInstall){let e=[`install`];t.args&&e.push(...t.args);let a=i?[`vp`,...e]:e,o=getInstallCwd(n,t.cwd),s=`${r} ${a.join(` `)}`,attempt=async e=>{startGroup(`Running ${e} in ${o}...`);try{return await getExecOutput(`"${r.replaceAll(`"`,`\\"`)}"`,a,{cwd:o,ignoreReturnCode:!0})}finally{endGroup()}};try{let e=await attempt(s);if(e.exitCode!==0&&i&&isSfwVpNotFoundFlake(e.stdout,e.stderr)&&(warning(`sfw reported vp as not found even though it is on PATH. This is a known sfw flake on Windows: a cold PowerShell start exceeds sfw's 10s command-resolution timeout and the timeout is misreported as not-found. Warming the PowerShell command cache and retrying once.`),await warmPowerShellCommandCache(),e=await attempt(`${s} (retry)`)),e.exitCode===0){info(`Successfully ran ${s}`);continue}let t=e.stderr.trim()||e.stdout.trim();t&&error(tailOutput(t,4e3),{title:`${s} failed`}),setFailed(`Command "${s}" (cwd: ${o}) exited with code ${e.exitCode}`)}catch(e){setFailed(`Failed to run ${s}: ${String(e)}`)}}}async function restoreCache(e){let t=getConfiguredProjectDir(e),n=detectLockFile$1(e.cacheDependencyPath,t);if(!n){warning(e.cacheDependencyPath?`No lock file found for cache-dependency-path: ${e.cacheDependencyPath}. Skipping cache restore.`:`No lock file found in project directory: ${t}. Skipping cache restore.`),setOutput(`cache-hit`,!1);return}info(`Using lock file: ${n.path}`);let r=ne(n.path);info(`Resolving dependency cache directory in: ${r}`);let i=await getCacheDirectories(n.type,r);if(!i.length){warning(`No cache directories found for ${n.type} in ${r}. Skipping cache restore.`),setOutput(`cache-hit`,!1);return}debug(`Cache paths: ${i.join(`, `)}`),saveState(`CACHE_PATHS`,JSON.stringify(i));let a=process.env.RUNNER_OS||Se(),o=be(),s=await hashFiles(n.path);if(!s)throw Error(`Failed to generate hash for lock file: ${n.path}`);let c=`vite-plus-${a}-${o}-${n.type}-${s}`,l=[`vite-plus-${a}-${o}-${n.type}-`,`vite-plus-${a}-${o}-`];debug(`Primary key: ${c}`),debug(`Restore keys: ${l.join(`, `)}`),saveState(`CACHE_PRIMARY_KEY`,c);let u=await restoreCache$1(i,c,l);u?(info(`Cache restored from key: ${u}`),saveState(`CACHE_MATCHED_KEY`,u),setOutput(`cache-hit`,!0)):(info(`Cache not found`),setOutput(`cache-hit`,!1))}async function saveCache(){let e=getState(`CACHE_PRIMARY_KEY`),t=getState(`CACHE_MATCHED_KEY`),n=getState(`CACHE_PATHS`);if(!e){info(`No cache key found. Skipping cache save.`);return}if(!n){info(`No cache paths found. Skipping cache save.`);return}if(e===t){info(`Cache hit on primary key "${e}". Skipping save.`);return}let r=JSON.parse(n);if(!r.length){info(`Empty cache paths. Skipping cache save.`);return}try{if(await saveCache$1(r,e)===-1){info(`Cache not saved (key already reserved by a concurrent job, or save was skipped).`);return}info(`Cache saved with key: ${e}`)}catch(e){warning(`Failed to save cache: ${String(e)}`)}}function resolvePath$1(e,t){return M.isAbsolute(e)?e:M.join(t,e)}function isWithin(e,t){let n=M.relative(t,e);return!M.isAbsolute(n)&&n!==`..`&&!n.startsWith(`..${M.sep}`)}function createNodeVersionResolver(e){let{getWorkspaceDir:t,info:n}=e;function resolveNodeVersionFile(e,r){let i=resolvePath$1(e,r||t()),a;try{a=pe(i,`utf-8`)}catch{throw Error(`node-version-file not found: ${i}`)}let o=te(i),s;if(s=o===`.tool-versions`?parseToolVersions(a):o===`package.json`?parsePackageJson(a):parsePlainVersionFile(a),!s)throw Error(`No Node.js version found in ${e}`);return s=s.replace(/^v/i,``),n(`Resolved Node.js version '${s}' from ${e}`),s}function parsePlainVersionFile(e){for(let t of e.split(` +`));let{commands:r}=yield getCommands(n,`create`);yield execCommands(r,e)})}var __awaiter=function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})},Nv=class ValidationError extends Error{constructor(e){super(e),this.name=`ValidationError`,Object.setPrototypeOf(this,ValidationError.prototype)}},Pv=class ReserveCacheError extends Error{constructor(e){super(e),this.name=`ReserveCacheError`,Object.setPrototypeOf(this,ReserveCacheError.prototype)}},Fv=class CacheWriteDeniedError extends Pv{constructor(e){super(e),this.name=`CacheWriteDeniedError`,Object.setPrototypeOf(this,CacheWriteDeniedError.prototype)}};const Iv=`cache read denied:`;var Lv=class CacheReadDeniedError extends Error{constructor(e){super(e),this.name=`CacheReadDeniedError`,Object.setPrototypeOf(this,CacheReadDeniedError.prototype)}},Rv=class FinalizeCacheError extends Error{constructor(e){super(e),this.name=`FinalizeCacheError`,Object.setPrototypeOf(this,FinalizeCacheError.prototype)}};function checkPaths(e){if(!e||e.length===0)throw new Nv(`Path Validation Error: At least one directory or file path is required`)}function checkKey(e){if(e.length>512)throw new Nv(`Key Validation Error: ${e} cannot be larger than 512 characters.`);if(!/^[^,]*$/.test(e))throw new Nv(`Key Validation Error: ${e} cannot contain commas.`)}function restoreCache$1(e,t,n,r){return __awaiter(this,arguments,void 0,function*(e,t,n,r,i=!1){let a=getCacheServiceVersion();debug(`Cache service version: ${a}`),checkPaths(e);let o=getCacheMode();if(!isCacheReadable(o)){info(`Cache restore skipped: the effective cache-mode '${o}' does not permit reads.`),debug(`Skipped restore for paths [${e.join(`, `)}] with primary key '${t}'.`);return}switch(a){case`v2`:return yield restoreCacheV2(e,t,n,r,i);default:return yield restoreCacheV1(e,t,n,r,i)}})}function restoreCacheV1(e,t,n,r){return __awaiter(this,arguments,void 0,function*(e,t,n,r,i=!1){n||=[];let a=[t,...n];if(debug(`Resolved Keys:`),debug(JSON.stringify(a)),a.length>10)throw new Nv(`Key Validation Error: Keys are limited to a maximum of 10.`);for(let e of a)checkKey(e);let o=yield getCompressionMethod(),s=``;try{let t;try{t=yield getCacheEntry(a,e,{compressionMethod:o,enableCrossOsArchive:i})}catch(e){let t=e?.message??``;throw t.includes(Iv)?new Lv(t):e}if(!t?.archiveLocation)return;if(r?.lookupOnly)return info(`Lookup only - skipping download`),t.cacheKey;s=u.join(yield createTempDirectory(),getCacheFileName(o)),debug(`Archive Path: ${s}`),yield downloadCache(t.archiveLocation,s,r),isDebug()&&(yield listTar(s,o));let n=getArchiveFileSizeInBytes(s);return info(`Cache Size: ~${Math.round(n/1048576)} MB (${n} B)`),yield extractTar(s,o),info(`Cache restored successfully`),t.cacheKey}catch(e){let t=e;if(t.name===Nv.name)throw e;t instanceof Pn&&typeof t.statusCode==`number`&&t.statusCode>=500?error(`Failed to restore: ${e.message}`):warning(`Failed to restore: ${e.message}`)}finally{try{yield unlinkFile(s)}catch(e){debug(`Failed to delete archive: ${e}`)}}})}function restoreCacheV2(e,t,n,r){return __awaiter(this,arguments,void 0,function*(e,t,n,r,i=!1){r=Object.assign(Object.assign({},r),{useAzureSdk:!0}),n||=[];let a=[t,...n];if(debug(`Resolved Keys:`),debug(JSON.stringify(a)),a.length>10)throw new Nv(`Key Validation Error: Keys are limited to a maximum of 10.`);for(let e of a)checkKey(e);let o=``;try{let s=internalCacheTwirpClient(),c=yield getCompressionMethod(),l={key:t,restoreKeys:n,version:getCacheVersion(e,c,i)},d;try{d=yield s.GetCacheEntryDownloadURL(l)}catch(e){let t=e?.message??``;throw t.includes(Iv)?new Lv(t):e}if(!d.ok){debug(`Cache not found for version ${l.version} of keys: ${a.join(`, `)}`);return}if(l.key===d.matchedKey?info(`Cache hit for: ${d.matchedKey}`):info(`Cache hit for restore-key: ${d.matchedKey}`),r?.lookupOnly)return info(`Lookup only - skipping download`),d.matchedKey;o=u.join(yield createTempDirectory(),getCacheFileName(c)),debug(`Archive path: ${o}`),debug(`Starting download of archive to: ${o}`),yield downloadCache(d.signedDownloadUrl,o,r);let f=getArchiveFileSizeInBytes(o);return info(`Cache Size: ~${Math.round(f/1048576)} MB (${f} B)`),isDebug()&&(yield listTar(o,c)),yield extractTar(o,c),info(`Cache restored successfully`),d.matchedKey}catch(e){let t=e;if(t.name===Nv.name)throw e;t instanceof Pn&&typeof t.statusCode==`number`&&t.statusCode>=500?error(`Failed to restore: ${e.message}`):warning(`Failed to restore: ${e.message}`)}finally{try{o&&(yield unlinkFile(o))}catch(e){debug(`Failed to delete archive: ${e}`)}}})}function saveCache$1(e,t,n){return __awaiter(this,arguments,void 0,function*(e,t,n,r=!1){let i=getCacheServiceVersion();debug(`Cache service version: ${i}`),checkPaths(e),checkKey(t);let a=getCacheMode();if(!isCacheWritable(a))return info(`Cache save skipped: the effective cache-mode '${a}' does not permit writes.`),debug(`Skipped save for paths [${e.join(`, `)}] with key '${t}'.`),-1;switch(i){case`v2`:return yield saveCacheV2(e,t,n,r);default:return yield saveCacheV1(e,t,n,r)}})}function saveCacheV1(e,t,n){return __awaiter(this,arguments,void 0,function*(e,t,n,r=!1){let i=yield getCompressionMethod(),a=-1,o=yield resolvePaths(e);if(debug(`Cache Paths:`),debug(`${JSON.stringify(o)}`),o.length===0)throw Error(`Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.`);let s=yield createTempDirectory(),c=u.join(s,getCacheFileName(i));debug(`Archive Path: ${c}`);try{yield createTar(s,o,i),isDebug()&&(yield listTar(c,i));let l=getArchiveFileSizeInBytes(c);if(debug(`File Size: ${l}`),l>10737418240&&!isGhes())throw Error(`Cache size of ~${Math.round(l/1048576)} MB (${l} B) is over the 10GB limit, not saving cache.`);debug(`Reserving Cache`);let u=yield reserveCache(t,e,{compressionMethod:i,enableCrossOsArchive:r,cacheSize:l});if(u?.result?.cacheId)a=u?.result?.cacheId;else if(u?.statusCode===400)throw Error(u?.error?.message??`Cache size of ~${Math.round(l/1048576)} MB (${l} B) is over the data cap limit, not saving cache.`);else{let e=u?.error?.message;throw e?.startsWith(`cache write denied:`)?new Fv(`Unable to reserve cache with key ${t}. More details: ${e}`):new Pv(`Unable to reserve cache with key ${t}, another job may be creating this cache. More details: ${u?.error?.message}`)}debug(`Saving Cache (ID: ${a})`),yield saveCache$2(a,c,``,n)}catch(e){let t=e;if(t.name===Nv.name)throw e;t.name===Pv.name?info(`Failed to save: ${t.message}`):t instanceof Pn&&typeof t.statusCode==`number`&&t.statusCode>=500?error(`Failed to save: ${t.message}`):warning(`Failed to save: ${t.message}`)}finally{try{yield unlinkFile(c)}catch(e){debug(`Failed to delete archive: ${e}`)}}return a})}function saveCacheV2(e,t,n){return __awaiter(this,arguments,void 0,function*(e,t,n,r=!1){n=Object.assign(Object.assign({},n),{uploadChunkSize:67108864,uploadConcurrency:8,useAzureSdk:!0});let i=yield getCompressionMethod(),a=internalCacheTwirpClient(),o=-1,s=yield resolvePaths(e);if(debug(`Cache Paths:`),debug(`${JSON.stringify(s)}`),s.length===0)throw Error(`Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.`);let c=yield createTempDirectory(),l=u.join(c,getCacheFileName(i));debug(`Archive Path: ${l}`);try{yield createTar(c,s,i),isDebug()&&(yield listTar(l,i));let u=getArchiveFileSizeInBytes(l);debug(`File Size: ${u}`),n.archiveSizeBytes=u,debug(`Reserving Cache`);let d=getCacheVersion(e,i,r),f={key:t,version:d},p;try{let e=yield a.CreateCacheEntry(f);if(!e.ok)throw e.message&&!e.message.startsWith(`cache write denied:`)&&warning(`Cache reservation failed: ${e.message}`),Error(e.message||`Response was not ok`);p=e.signedUploadUrl}catch(e){debug(`Failed to reserve cache: ${e}`);let n=e?.message??``;throw n.startsWith(`cache write denied:`)?new Fv(`Unable to reserve cache with key ${t}. More details: ${n}`):new Pv(`Unable to reserve cache with key ${t}, another job may be creating this cache.`)}debug(`Attempting to upload cache located at: ${l}`),yield saveCache$2(o,l,p,n);let m={key:t,version:d,sizeBytes:`${u}`},h=yield a.FinalizeCacheEntryUpload(m);if(debug(`FinalizeCacheEntryUploadResponse: ${h.ok}`),!h.ok)throw h.message?new Rv(h.message):Error(`Unable to finalize cache with key ${t}, another job may be finalizing this cache.`);o=parseInt(h.entryId)}catch(e){let t=e;if(t.name===Nv.name)throw e;t.name===Pv.name?info(`Failed to save: ${t.message}`):t.name===Rv.name?warning(t.message):t instanceof Pn&&typeof t.statusCode==`number`&&t.statusCode>=500?error(`Failed to save: ${t.message}`):warning(`Failed to save: ${t.message}`)}finally{try{yield unlinkFile(l)}catch(e){debug(`Failed to delete archive: ${e}`)}}return o})}function commandPath(e,t=process.env){if(!e||e===`.`||e===`..`||/[\\/:]/.test(e))return;let n=isWindows(),r=n?Object.keys(t).sort().find(e=>e.toUpperCase()===`PATH`):`PATH`,i=r&&t[r]||``,a=n&&!e.toLowerCase().endsWith(`.exe`)?`${e}.exe`:e,o=ge(process.cwd(),{bigint:!0});for(let e of i.split(M.delimiter)){let t=n?e.replace(/^"(.*)"$/,`$1`):e;if(M.isAbsolute(t)&&!(n&&M.parse(t).root.length===1))try{let e=ge(t,{bigint:!0});if(e.dev===o.dev&&e.ino===o.ino)continue;let r=M.join(t,a);if(!ge(r).isFile())continue;return le(r,n?de.F_OK:de.X_OK),r}catch{}}}function resolveSfwEnabled(e,t,n){return e?!pkgPrNewCommitSha(t)||(n(`sfw was requested but is automatically disabled for Vite+ preview build ${t}; Socket Firewall Free will not be used.`),!1):!1}const zv=`v1.15.4`,Bv=`https://github.com/SocketDev/sfw-free/releases/download/${zv}`;function isMuslLinux(){if(process.platform!==`linux`)return!1;try{let e=process.report?.getReport();if(e?.header&&!e.header.glibcVersionRuntime)return!0}catch{}return F(`/etc/alpine-release`)}function getSfwAssetName(e,t,n){if(e===`darwin`){if(t===`arm64`)return`sfw-free-macos-arm64`;if(t===`x64`)return`sfw-free-macos-x86_64`}else if(e===`linux`){if(t===`arm64`)return n?`sfw-free-musl-linux-arm64`:`sfw-free-linux-arm64`;if(t===`x64`)return n?`sfw-free-musl-linux-x86_64`:`sfw-free-linux-x86_64`}else if(isWindows(e)){if(t===`arm64`)return`sfw-free-windows-arm64.exe`;if(t===`x64`)return`sfw-free-windows-x86_64.exe`}throw Error(`Unsupported platform/arch for sfw: ${e}/${t}${e===`linux`?` (${n?`musl`:`glibc`})`:``}`)}const Vv=2e3;function isSfwSupported(e=process.platform,t=process.arch,n=isMuslLinux()){try{return!!getSfwAssetName(e,t,n)}catch{return!1}}function getSfwBinDir(){let e=process.env.RUNNER_TEMP||process.env.TMPDIR||process.env.TEMP||`/tmp`;return ae(e,`sfw-bin`)}async function installSfw(){let e=getSfwAssetName(process.platform,process.arch,isMuslLinux()),t=`${Bv}/${e}`,n=getSfwBinDir();fe(n,{recursive:!0});let r=P(n,isWindows()?`sfw.exe`:`sfw`),i=`sfw-${zv}-${process.platform}-${process.arch}-${isMuslLinux()?`musl`:`glibc`}`;try{let e=await restoreCache$1([n],i);if(e&&F(r))return isWindows()||ue(r,493),addPath(n),info(`sfw restored from cache: ${e}`),r}catch(e){warning(`sfw cache restore failed (${e instanceof Error?e.message:String(e)}); falling through to download.`)}info(`Installing sfw from ${t}...`);let a=``;for(let e=1;e<=2;e++){try{let e=await runDownloadCommand(t,r);if(e===0&&F(r)){isWindows()||ue(r,493),addPath(n),info(`sfw installed at ${r}`);try{await saveCache$1([n],i),info(`sfw cached under key: ${i}`)}catch(e){warning(`sfw cache save failed (${e instanceof Error?e.message:String(e)}); continuing.`)}return r}a=`exit code ${e}`}catch(e){a=e instanceof Error?e.message:String(e)}e<2&&(warning(`Failed to install sfw from ${t} (${a}). Retrying in ${Vv}ms... (attempt ${e+1}/2)`),await se(Vv))}throw Error(`Failed to install sfw from ${t} after 2 attempts: ${a}`)}function findSfwOnPath(){return commandPath(`sfw`)??null}async function setupSfw(e){if(!resolveSfwEnabled(e.sfw,e.version,warning))return{executable:`vp`,sfw:!1};if(e.runInstall.length===0)return info("sfw was requested but `run-install` is disabled; sfw will not be invoked."),{executable:`vp`,sfw:!1};let t=findSfwOnPath();return t?(info(`Using existing sfw on PATH: ${t}`),{executable:t,sfw:!0}):isSfwSupported()?{executable:await installSfw(),sfw:!0}:(warning(`sfw has no published binary for this runner's platform/architecture (${`process.platform=${process.platform}, process.arch=${process.arch}, musl=${isMuslLinux()}`}) and none was found on PATH; falling back to plain \`vp install\`. To enable sfw here, install a working sfw binary on PATH in an earlier step (e.g. via \`socketdev/action@\` or a custom install).`),{executable:`vp`,sfw:!1})}async function runDownloadCommand(e,t){let n={ignoreReturnCode:!0};return isWindows()?exec(`pwsh`,[`-Command`,`Invoke-WebRequest -UseBasicParsing -Uri '${e}' -OutFile '${t}' -TimeoutSec 60`],n):exec(`bash`,[`-c`,`set -o pipefail; curl -fsSL --connect-timeout 5 --max-time 60 -o '${t}' '${e}'`],n)}const Hv=/Command 'vp' not found in PATH/;function isSfwVpNotFoundFlake(e,t){return Hv.test(t)||Hv.test(e)}async function warmPowerShellCommandCache(){if(isWindows())try{await getExecOutput(`powershell.exe`,[`-NoProfile`,`-Command`,`Get-Command vp`],{ignoreReturnCode:!0})}catch(e){info(`PowerShell warm-up failed (${String(e)}); retrying sfw anyway.`)}}function tailOutput(e,t){let n=e.trim();return n.length<=t?n:`…(truncated, showing last ${t} chars)…\n${n.slice(-t)}`}async function runViteInstall(e,t){let n=getConfiguredProjectDir(e),{executable:r,sfw:i}=t;for(let t of e.runInstall){let e=[`install`];t.args&&e.push(...t.args);let a=i?[`vp`,...e]:e,o=getInstallCwd(n,t.cwd),s=`${r} ${a.join(` `)}`,attempt=async e=>{startGroup(`Running ${e} in ${o}...`);try{return await getExecOutput(`"${r.replaceAll(`"`,`\\"`)}"`,a,{cwd:o,ignoreReturnCode:!0})}finally{endGroup()}};try{let e=await attempt(s);if(e.exitCode!==0&&i&&isSfwVpNotFoundFlake(e.stdout,e.stderr)&&(warning(`sfw reported vp as not found even though it is on PATH. This is a known sfw flake on Windows: a cold PowerShell start exceeds sfw's 10s command-resolution timeout and the timeout is misreported as not-found. Warming the PowerShell command cache and retrying once.`),await warmPowerShellCommandCache(),e=await attempt(`${s} (retry)`)),e.exitCode===0){info(`Successfully ran ${s}`);continue}let t=e.stderr.trim()||e.stdout.trim();t&&error(tailOutput(t,4e3),{title:`${s} failed`}),setFailed(`Command "${s}" (cwd: ${o}) exited with code ${e.exitCode}`)}catch(e){setFailed(`Failed to run ${s}: ${String(e)}`)}}}async function restoreCache(e){let t=getConfiguredProjectDir(e),n=detectLockFile$1(e.cacheDependencyPath,t);if(!n){warning(e.cacheDependencyPath?`No lock file found for cache-dependency-path: ${e.cacheDependencyPath}. Skipping cache restore.`:`No lock file found in project directory: ${t}. Skipping cache restore.`),setOutput(`cache-hit`,!1);return}info(`Using lock file: ${n.path}`);let r=ne(n.path);info(`Resolving dependency cache directory in: ${r}`);let i=await getCacheDirectories(n.type,r);if(!i.length){warning(`No cache directories found for ${n.type} in ${r}. Skipping cache restore.`),setOutput(`cache-hit`,!1);return}debug(`Cache paths: ${i.join(`, `)}`),saveState(`CACHE_PATHS`,JSON.stringify(i));let a=process.env.RUNNER_OS||Se(),o=be(),s=await hashFiles(n.path);if(!s)throw Error(`Failed to generate hash for lock file: ${n.path}`);let c=`vite-plus-${a}-${o}-${n.type}-${s}`,l=[`vite-plus-${a}-${o}-${n.type}-`,`vite-plus-${a}-${o}-`];debug(`Primary key: ${c}`),debug(`Restore keys: ${l.join(`, `)}`),saveState(`CACHE_PRIMARY_KEY`,c);let u=await restoreCache$1(i,c,l);u?(info(`Cache restored from key: ${u}`),saveState(`CACHE_MATCHED_KEY`,u),setOutput(`cache-hit`,!0)):(info(`Cache not found`),setOutput(`cache-hit`,!1))}async function saveCache(){let e=getState(`CACHE_PRIMARY_KEY`),t=getState(`CACHE_MATCHED_KEY`),n=getState(`CACHE_PATHS`);if(!e){info(`No cache key found. Skipping cache save.`);return}if(!n){info(`No cache paths found. Skipping cache save.`);return}if(e===t){info(`Cache hit on primary key "${e}". Skipping save.`);return}let r=JSON.parse(n);if(!r.length){info(`Empty cache paths. Skipping cache save.`);return}try{if(await saveCache$1(r,e)===-1){info(`Cache not saved (key already reserved by a concurrent job, or save was skipped).`);return}info(`Cache saved with key: ${e}`)}catch(e){warning(`Failed to save cache: ${String(e)}`)}}function resolvePath$1(e,t){return M.isAbsolute(e)?e:M.join(t,e)}function isWithin(e,t){let n=M.relative(t,e);return!M.isAbsolute(n)&&n!==`..`&&!n.startsWith(`..${M.sep}`)}function createNodeVersionResolver(e){let{getWorkspaceDir:t,info:n}=e;function resolveNodeVersionFile(e,r){let i=resolvePath$1(e,r||t()),a;try{a=pe(i,`utf-8`)}catch{throw Error(`node-version-file not found: ${i}`)}let o=te(i),s;if(s=o===`.tool-versions`?parseToolVersions(a):o===`package.json`?parsePackageJson(a):parsePlainVersionFile(a),!s)throw Error(`No Node.js version found in ${e}`);return s=s.replace(/^v/i,``),n(`Resolved Node.js version '${s}' from ${e}`),s}function parsePlainVersionFile(e){for(let t of e.split(` `)){let e=(t.includes(`#`)?t.slice(0,t.indexOf(`#`)):t).trim();if(e)return normalizeNvmAlias(e)}}function normalizeNvmAlias(e){let t=e.toLowerCase();return t===`node`||t===`stable`?`latest`:e}function parseToolVersions(e){for(let t of e.split(` `)){let e=t.trim();if(!e||e.startsWith(`#`))continue;let[n,...r]=e.split(/\s+/);if(n===`nodejs`||n===`node`){for(let e of r)if(isAsdfInstallableVersion(e))return e}}}function isAsdfInstallableVersion(e){return!!e&&e!==`system`&&!e.startsWith(`ref:`)&&!e.startsWith(`path:`)}function parsePackageJson(e){let t;try{t=JSON.parse(e)}catch{throw Error(`Failed to parse package.json: invalid JSON`)}let n=t.devEngines;if(n?.runtime){let e=findNodeRuntime(n.runtime);if(e)return e}let r=t.engines;if(r?.node&&typeof r.node==`string`)return r.node}function findNodeRuntime(e){let t=Array.isArray(e)?e:[e];for(let e of t)if(e?.name===`node`&&typeof e.version==`string`)return e.version}return{resolveNodeVersionFile}}const{resolveNodeVersionFile:Uv}=createNodeVersionResolver({getWorkspaceDir,info}),Wv=[{filename:`pnpm-lock.yaml`,type:`pnpm`},{filename:`bun.lockb`,type:`bun`},{filename:`bun.lock`,type:`bun`},{filename:`package-lock.json`,type:`npm`},{filename:`npm-shrinkwrap.json`,type:`npm`},{filename:`yarn.lock`,type:`yarn`}];function resolvePath(e,t){return re(e)?e:P(t,e)}function inferLockFileType(e,t){return t.includes(`pnpm`)?{type:`pnpm`,path:e,filename:t}:t.includes(`yarn`)?{type:`yarn`,path:e,filename:t}:t.startsWith(`bun.`)?{type:`bun`,path:e,filename:t}:{type:`npm`,path:e,filename:t}}function detectLockFile(e,t){if(e){let n=resolvePath(e,t);if(F(n)){let e=te(n),t=Wv.find(t=>t.filename===e);return t?{type:t.type,path:n,filename:e}:inferLockFileType(n,e)}return}let n=me(t);for(let e of Wv)if(n.includes(e.filename)){let n=P(t,e.filename);return{type:e.type,path:n,filename:e.filename}}}function createLockfileResolver(e){let{getWorkspaceDir:t,info:n,debug:r}=e,i=/^\d+\.\d+\.\d+/;function tryResolveVitePlusVersionFromLockfile(e,t){let i=detectLockfileForProject(e,t);if(!i)return;let a=i.filename.endsWith(`.lockb`)?textBunLockBeside(i):i;if(!a){r(`Cannot read ${i.filename} (binary) to resolve the ${aa} version; using "latest". Use the text bun.lock, or set the \`version\` input.`);return}let o=parseVitePlusVersionFromLockfile(a,workspaceSubPath(ne(a.path),e));if(o)return n(`Resolved ${aa} version '${o}' from ${a.filename}`),o;r(`No ${aa} version found in ${a.path}`)}function detectLockfileForProject(e,n){if(n)return detectLockFile(n,e);let r=t(),i=e;for(;;){let e=detectLockFile(void 0,i);if(e)return e;let t=ne(i);if(i===r||t===i||!isWithin(t,r))break;i=t}}function textBunLockBeside(e){let t=P(ne(e.path),`bun.lock`);return F(t)?{type:`bun`,path:t,filename:`bun.lock`}:void 0}function workspaceSubPath(e,t){if(!isWithin(t,e))return``;let n=ie(e,t);return n?n.split(oe).join(`/`):``}function parseVitePlusVersionFromLockfile(e,t=``){if(e.filename.endsWith(`.lockb`))return;let n;try{n=pe(e.path,`utf-8`)}catch{return}let r;switch(e.type){case`npm`:r=fromNpmLock(n,t);break;case`pnpm`:r=fromPnpmLock(n,t);break;case`yarn`:r=fromYarnLock(n);break;case`bun`:r=fromBunTextLock(n);break;default:return}return r&&i.test(r)?r:void 0}function fromNpmLock(e,t){let n;try{n=JSON.parse(e)}catch{return}let r=n.packages;if(t){let e=r?.[`${t}/node_modules/${oa}`]?.version;if(typeof e==`string`)return e;if(!npmPackageDeclaresVitePlus(r?.[t]))return}let i=r?.[`node_modules/${oa}`]?.version;if(typeof i==`string`)return i;let a=n.dependencies?.[oa]?.version;return typeof a==`string`?a:void 0}function npmPackageDeclaresVitePlus(e){if(!e)return!1;for(let t of[`dependencies`,`devDependencies`]){let n=e[t];if(n&&typeof n==`object`&&`vite-plus`in n)return!0}return!1}function fromPnpmLock(e,t){let n;try{n=(0,_i.parse)(e)}catch{return}if(!n||typeof n!=`object`)return;let r=n,i=r.importers;if(i&&typeof i==`object`){let e=t||`.`;return e in i?pnpmImporterVersion(i[e]):void 0}return pnpmImporterVersion(r)||e.match(/^\s*\/?vite-plus@(\d+\.\d+\.\d+[^\s():'"]*)/m)?.[1]}function pnpmImporterVersion(e){if(!e||typeof e!=`object`)return;let t=e;for(let e of[`dependencies`,`devDependencies`,`optionalDependencies`]){let n=t[e];if(n&&typeof n==`object`){let e=n[oa],t=typeof e==`string`?e:e?.version;if(typeof t==`string`){let e=t.replace(/\(.*$/,``).trim();if(i.test(e))return e}}}}function fromYarnLock(e){let t=/* @__PURE__ */ new Set,n=e.split(/\r?\n/);for(let e=0;e!isReservedEnvVar(e)&&!!process.env[e]);if(i.length===0){debug(`Project .npmrc at ${t}: no auth env vars to propagate`);return}info(`Detected project .npmrc at ${t}. Propagating auth env vars: ${i.join(`, `)}`);for(let e of i)exportVariable(e,process.env[e])}async function runMain(e){saveState(`IS_POST`,`true`);let t=getConfiguredProjectDir(e),n=e.nodeVersion;!n&&e.nodeVersionFile&&(n=Uv(e.nodeVersionFile,t));let r=Gv(e,t);await installVitePlus({...e,version:r});let i=e.nodeManager===!1||e.packageManager!==void 0?(await getExecOutput(`vp`,[`--version`],{silent:!0})).stdout:``,a=packageManagerArgs(e.packageManager,i);e.nodeManager===!1?(info(`Disabling Vite+ Node.js version management...`),await exec(`vp`,nodeManagerOffArgs(i))):n&&(info(`Setting up Node.js ${n} via vp env use...`),await exec(`vp`,[`env`,`use`,n]));for(let e of a)await exec(`vp`,e);e.registryUrl?configAuthentication(e.registryUrl,e.scope):propagateProjectNpmrcAuth(t),e.cache&&await restoreCache(e);let o=await setupSfw({...e,version:r});e.runInstall.length>0&&await runViteInstall(e,o),await printViteVersion(t)}async function printViteVersion(e){try{let t=(await getExecOutput(`vp`,[`--version`],{cwd:e,silent:!0})).stdout.trim();info(t);let n=parseInstalledVpVersion(t);saveState(`INSTALLED_VERSION`,n),setOutput(`version`,n)}catch(e){warning(`Could not get vp version: ${String(e)}`),setOutput(`version`,`unknown`)}}async function runPost(e){if(e.cache){if(!e.cacheSave){info(`Cache saving is disabled. Skipping cache save.`);return}await saveCache()}}async function main(){let e=getInputs();getState(`IS_POST`)===`true`?await runPost(e):await runMain(e)}main().catch(e=>{console.error(e),setFailed(e instanceof Error?e.message:String(e))});export{runMain,runPost}; \ No newline at end of file diff --git a/src/ci/process-windows.test.ts b/src/ci/process-windows.test.ts new file mode 100644 index 0000000..cd53073 --- /dev/null +++ b/src/ci/process-windows.test.ts @@ -0,0 +1,69 @@ +import { accessSync, statSync } from "node:fs"; +import path from "node:path"; +import { afterEach, beforeEach, describe, expect, it, vi } from "vite-plus/test"; +import { commandPath } from "./process.js"; +import { runInstall } from "./run-install.js"; + +// Exercise Windows path rules on every host; native execution is covered separately. +vi.mock("node:path", async (importOriginal) => { + const actual = await importOriginal(); + return { ...actual, default: actual.win32 }; +}); +vi.mock("./platform.js", () => ({ isWindows: () => true })); +vi.mock("node:fs", async (importOriginal) => ({ + ...(await importOriginal()), + accessSync: vi.fn(), + statSync: vi.fn((file: string) => ({ + dev: 1n, + ino: file === String.raw`C:\source` ? 1n : 2n, + isFile: () => true, + })), +})); + +beforeEach(() => { + vi.spyOn(process, "cwd").mockReturnValue(String.raw`C:\source`); +}); +afterEach(() => { + vi.restoreAllMocks(); + vi.clearAllMocks(); +}); + +describe("Windows command paths", () => { + it.each([ + String.raw`\trusted`, + "/trusted", + String.raw`"\trusted"`, + "\\", + "/", + String.raw`C:trusted`, + ])("rejects %s before inspecting a file relative to the setup drive", (directory) => { + expect(commandPath("sfw", { PATH: directory })).toBeUndefined(); + expect(statSync).toHaveBeenCalledExactlyOnceWith(String.raw`C:\source`, { bigint: true }); + expect(accessSync).not.toHaveBeenCalled(); + }); + + it.each([ + String.raw`C:\trusted`, + "C:/trusted", + String.raw`"C:\trusted bin"`, + String.raw`\\server\share\trusted`, + "//server/share/trusted", + String.raw`\\?\C:\trusted`, + String.raw`\\?\UNC\server\share\trusted`, + ])("retains the qualified path %s when installation uses another drive", async (directory) => { + const executable = commandPath("sfw", { PATH: `\\unqualified;${directory}` }); + const expected = path.join(directory.replace(/^"(.*)"$/, "$1"), "sfw.exe"); + expect(executable).toBe(expected); + + const execute = vi.fn(async () => ({ exitCode: 0, stdout: "", stderr: "" })); + const installCwd = String.raw`D:\project`; + await runInstall([{}], installCwd, { executable: executable!, sfw: true }, {}, { execute }); + expect(execute).toHaveBeenCalledExactlyOnceWith(expected, ["vp", "install"], { + cwd: installCwd, + env: {}, + }); + expect(path.resolve(installCwd, executable!)).toBe( + path.resolve(String.raw`C:\source`, expected), + ); + }); +}); diff --git a/src/ci/process.ts b/src/ci/process.ts index acb8115..ebbb8c7 100644 --- a/src/ci/process.ts +++ b/src/ci/process.ts @@ -55,6 +55,9 @@ export function commandPath( const directory = windows ? entry.replace(/^"(.*)"$/, "$1") : entry; // Empty and relative entries can refer to attacker-controlled checkout files. if (!path.isAbsolute(directory)) continue; + // On Windows, isAbsolute also accepts drive-root-relative paths such as + // \trusted. These change meaning when the install cwd is on another drive. + if (windows && path.parse(directory).root.length === 1) continue; try { // Filesystem identity covers case aliases and symlinks without assuming // that all volumes on the same operating system use the same case rules. diff --git a/src/install-sfw-path.test.ts b/src/install-sfw-path.test.ts index 8a3fbea..29a6b9b 100644 --- a/src/install-sfw-path.test.ts +++ b/src/install-sfw-path.test.ts @@ -9,6 +9,7 @@ import { writeFileSync, } from "node:fs"; import { rm } from "node:fs/promises"; +import { execFileSync } from "node:child_process"; import { tmpdir } from "node:os"; import path from "node:path"; import { afterEach, describe, expect, it, vi } from "vite-plus/test"; @@ -158,6 +159,64 @@ process.exit(0);`, ); }); +it.skipIf(!isWindows())( + "rejects a drive-root-relative PATH entry before executing on a different Windows drive", + async () => { + const root = mkdtempSync(path.join(tmpdir(), "setup-vp-sfw-drives-")); + directories.push(root); + const workspace = path.join(root, "workspace"); + const trustedBin = path.join(root, "trusted"); + const otherDriveRoot = path.join(root, "other-drive"); + mkdirSync(workspace); + mkdirSync(trustedBin); + mkdirSync(otherDriveRoot); + const trusted = path.join(trustedBin, "sfw.exe"); + copyFileSync(process.execPath, trusted); + const relativeBin = trustedBin.slice(path.parse(trustedBin).root.length - 1); + const otherBinary = path.join(otherDriveRoot, relativeBin.slice(1), "sfw.exe"); + mkdirSync(path.dirname(otherBinary), { recursive: true }); + copyFileSync(process.execPath, otherBinary); + const marker = path.join(root, "executed"); + const hook = path.join(root, "record.cjs"); + writeFileSync( + hook, + "require('node:fs').writeFileSync(process.env.SETUP_VP_EXECUTION_MARKER, process.execPath); process.exit(0);", + ); + vi.stubEnv("SETUP_VP_EXECUTION_MARKER", marker); + vi.stubEnv("NODE_OPTIONS", `--require ${JSON.stringify(hook)}`); + vi.stubEnv("PATH", `${relativeBin};${trustedBin}`); + + // SUBST creates a second drive without needing another physical volume. + const drive = ["Z:", "Y:", "X:", "W:"].find((candidate) => !existsSync(`${candidate}\\`)); + expect(drive, "a free drive letter is required for the native regression").toBeDefined(); + const subst = path.join(process.env.SystemRoot!, "System32", "subst.exe"); + execFileSync(subst, [drive!, otherDriveRoot]); + const originalCwd = process.cwd(); + try { + process.chdir(workspace); + const installCwd = `${drive}\\project`; + mkdirSync(installCwd); + expect(path.parse(installCwd).root).not.toBe(path.parse(workspace).root); + expect(commandPath("sfw", { PATH: relativeBin })).toBeUndefined(); + const command = await setupSfw([{}], { sfwEnabled: true }); + expect(command).toEqual({ executable: trusted, sfw: true }); + + await runInstall([{}], installCwd, command); + + const executed = readFileSync(marker, "utf8"); + const expected = statSync(trusted, { bigint: true }); + expect(statSync(executed, { bigint: true })).toMatchObject({ + dev: expected.dev, + ino: expected.ino, + }); + } finally { + process.chdir(originalCwd); + execFileSync(subst, [drive!, "/D"]); + } + }, + 30_000, +); + it("does not execute planted lookup tools or reuse sfw from the working directory", async () => { const root = mkdtempSync(path.join(tmpdir(), "setup-vp-sfw-path-")); directories.push(root); From 6b494ef6e7c0d5086561cd9516b8c87b8dc5e3b0 Mon Sep 17 00:00:00 2001 From: MK Date: Thu, 8 Oct 2026 14:39:42 +0800 Subject: [PATCH 4/5] docs: remove sfw implementation details from README --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index d24365e..79d3974 100644 --- a/README.md +++ b/README.md @@ -293,8 +293,6 @@ steps: In the action log you will see `Using existing sfw on PATH: …` when this composition is detected, vs. `Installing sfw from …` for the bundled-download path. -Existing `sfw` executables must be in an absolute `PATH` directory. The current working directory, including aliases of that directory, and empty or relative `PATH` entries are ignored. On Windows, paths must include a drive or UNC share; entries such as `\trusted` are ignored. setup-vp looks for the native `sfw.exe` executable on Windows. Dependency installation uses the selected executable's absolute path, including after a download or cache restore. - > [!NOTE] > **macOS / Windows require Vite+ v0.1.23 or newer.** Earlier `vp` releases didn't honor `HTTPS_PROXY` / `SSL_CERT_FILE`, so `sfw vp install` failed the TLS handshake on macOS / Windows (it always worked on Linux). The action's default `version: latest` satisfies this; if you pin an older `vp` and enable `sfw` on macOS / Windows, the install will fail the handshake. On a runner architecture with no published `sfw` binary (e.g. `riscv64`), the action logs a warning and falls back to plain `vp install`. From 5459d59a842a1baf19406c44c4c747e17a3b603e Mon Sep 17 00:00:00 2001 From: MK Date: Thu, 8 Oct 2026 14:45:17 +0800 Subject: [PATCH 5/5] refactor: simplify sfw execution and regression fixtures --- dist/azure/index.mjs | 2 +- dist/gitlab/index.mjs | 2 +- dist/index.mjs | 2 +- src/ci/process.ts | 12 ++-- src/install-sfw-path.test.ts | 123 ++++++++++++++++------------------- src/install-sfw.test.ts | 34 +++++----- src/run-install.ts | 33 +++++----- 7 files changed, 96 insertions(+), 112 deletions(-) diff --git a/dist/azure/index.mjs b/dist/azure/index.mjs index ac3c311..f2053fa 100644 --- a/dist/azure/index.mjs +++ b/dist/azure/index.mjs @@ -136,7 +136,7 @@ default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.l /* istanbul ignore else should not happen */ n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let t=this.peek(2);if(t.type===`block-map`&&(this.type===`map-value-ind`&&t.indent===e.indent||this.type===`newline`&&!t.items[t.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type===`map-value-ind`&&t.type!==`flow-collection`){let n=getFirstKeyStartProps(getPrevProps(t));fixFlowSeqItems(e);let r=e.end.splice(1,e.end.length);r.push(this.sourceToken);let i={type:`block-map`,offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let e=this.source.indexOf(` `)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(` -`,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=getFirstKeyStartProps(getPrevProps(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=getFirstKeyStartProps(getPrevProps(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}}})),tt=/* @__PURE__ */ __commonJSMin((e=>{var t=qe(),n=W(),r=G(),i=fe(),a=O(),o=$e(),s=et();function parseOptions(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new o.LineCounter||null,prettyErrors:t}}function parseAllDocuments(e,n={}){let{lineCounter:i,prettyErrors:a}=parseOptions(n),o=new s.Parser(i?.addNewLine),c=new t.Composer(n),l=Array.from(c.compose(o.parse(e)));if(a&&i)for(let t of l)t.errors.forEach(r.prettifyError(e,i)),t.warnings.forEach(r.prettifyError(e,i));return l.length>0?l:Object.assign([],{empty:!0},c.streamInfo())}function parseDocument(e,n={}){let{lineCounter:i,prettyErrors:a}=parseOptions(n),o=new s.Parser(i?.addNewLine),c=new t.Composer(n),l=null;for(let t of c.compose(o.parse(e),!0,e.length))if(!l)l=t;else if(l.options.logLevel!==`silent`){l.errors.push(new r.YAMLParseError(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return a&&i&&(l.errors.forEach(r.prettifyError(e,i)),l.warnings.forEach(r.prettifyError(e,i))),l}function parse(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let a=parseDocument(e,n);if(!a)return null;if(a.warnings.forEach(e=>i.warn(a.options.logLevel,e)),a.errors.length>0){if(a.options.logLevel!==`silent`)throw a.errors[0];a.errors=[]}return a.toJS(Object.assign({reviver:r},n))}function stringify(e,t,r){let i=null;if(typeof t==`function`||Array.isArray(t)?i=t:r===void 0&&t&&(r=t),typeof r==`string`&&(r=r.length),typeof r==`number`){let e=Math.round(r);r=e<1?void 0:e>8?{indent:8}:{indent:e}}if(e===void 0){let{keepUndefined:e}=r??t??{};if(!e)return}return a.isDocument(e)&&!i?e.toString(r):new n.Document(e,i,r).toString(r)}e.parse=parse,e.parseAllDocuments=parseAllDocuments,e.parseDocument=parseDocument,e.stringify=stringify})),J=(/* @__PURE__ */ __commonJSMin((e=>{var t=qe(),n=W(),r=Me(),i=G(),a=j(),o=O(),s=L(),c=M(),l=R(),u=B();Ze();var d=Qe(),f=$e(),p=et(),m=tt(),h=k();e.Composer=t.Composer,e.Document=n.Document,e.Schema=r.Schema,e.YAMLError=i.YAMLError,e.YAMLParseError=i.YAMLParseError,e.YAMLWarning=i.YAMLWarning,e.Alias=a.Alias,e.isAlias=o.isAlias,e.isCollection=o.isCollection,e.isDocument=o.isDocument,e.isMap=o.isMap,e.isNode=o.isNode,e.isPair=o.isPair,e.isScalar=o.isScalar,e.isSeq=o.isSeq,e.Pair=s.Pair,e.Scalar=c.Scalar,e.YAMLMap=l.YAMLMap,e.YAMLSeq=u.YAMLSeq,e.Lexer=d.Lexer,e.LineCounter=f.LineCounter,e.Parser=p.Parser,e.parse=m.parse,e.parseAllDocuments=m.parseAllDocuments,e.parseDocument=m.parseDocument,e.stringify=m.stringify,e.visit=h.visit,e.visitAsync=h.visitAsync})))();function parseInstalledVpVersion(e){return(e.match(/^\s*vp\s+v?(\d[^\s]*)/im)??e.match(/Global:\s*v?(\d[^\s]*)/i))?.[1]??`unknown`}const nt=/* @__PURE__ */ new Set([`true`,`True`,`TRUE`]),rt=/* @__PURE__ */ new Set([`false`,`False`,`FALSE`]);function parseNodeManager(e){if(e){if(nt.has(e))return!0;if(rt.has(e))return!1;throw Error(`Invalid node-manager input: "${e}". Expected "true", "false", or unset.`)}}function supportsScopedEnv(e){let t=parseInstalledVpVersion(e);if(t.startsWith(`0.0.0-commit.`))return!0;let n=t.match(/^(\d+)\.(\d+)\.(\d+)/);if(!n)throw Error(`Could not determine the installed Vite+ version for env configuration.`);let[,r,i,a]=n.map(Number);return r>0||i>3||i===3&&a>=1}function nodeManagerOffArgs(e){return parseInstalledVpVersion(e).startsWith(`0.0.0-commit.`)&&console.info("setup-vp: node-manager: false requires a preview build that supports `vp env off node`. If this command is unsupported, use a newer preview or a stable release. setup-vp will not fall back to disabling package-manager management."),supportsScopedEnv(e)?[`env`,`off`,`node`]:[`env`,`off`]}const it=[`npm`,`pnpm`,`yarn`,`bun`];function parsePackageManager(e){if(!e?.trim())return;let t;try{t=(0,J.parse)(e)}catch(e){throw Error(`Invalid package-manager input: ${String(e)}`)}if(t!==``){if(typeof t==`boolean`)return t;if(t&&typeof t==`object`&&!Array.isArray(t)){for(let[e,n]of Object.entries(t))if(!it.includes(e)||typeof n!=`boolean`)throw Error(`Invalid package-manager input: ${e} must be npm, pnpm, yarn, or bun with a boolean value.`);return t}throw Error(`Invalid package-manager input: expected a boolean or a mapping of npm, pnpm, yarn, and bun to booleans.`)}}function packageManagerArgs(e,t){if(e===void 0)return[];if(!supportsScopedEnv(t))throw Error(`package-manager configuration requires Vite+ 0.3.1 or newer.`);return typeof e==`boolean`?e?[]:[[`env`,`off`,`pm`]]:it.filter(t=>e[t]===!1).map(e=>[`env`,`off`,e])}const Y=`Vite+`,X=`vite-plus`;function resolvePath$1(e,t){return f.isAbsolute(e)?e:f.join(t,e)}function isWithin(e,t){let n=f.relative(t,e);return!f.isAbsolute(n)&&n!==`..`&&!n.startsWith(`..${f.sep}`)}function resolveProjectDirectory(e){let{workingDirectory:t,workspaceRoot:n}=e,r=f.isAbsolute(t)?t:f.join(n,t);try{if(!u(r).isDirectory())throw Error(`working-directory is not a directory: ${t} (resolved to ${r})`)}catch(e){throw e instanceof Error&&`code`in e&&e.code===`ENOENT`?Error(`working-directory not found: ${t} (resolved to ${r})`):e}return r}function isWindows(e=process.platform){return e===`win32`}function run(e,t,n={}){let r=x(e,t,{stdio:`inherit`,...n});if(r.error)throw r.error;if(r.status!==0)throw Error(`${e} ${t.join(` `)} exited with code ${r.status??1}`)}function runWithOutput(e,t,n={}){return new Promise((r,i)=>{let a=b(e,t,{...n,stdio:[`ignore`,`pipe`,`pipe`]}),o=``,s=``;a.stdout.on(`data`,e=>{process.stdout.write(e),o=(o+e.toString()).slice(-4e3)}),a.stderr.on(`data`,e=>{process.stderr.write(e),s=(s+e.toString()).slice(-4e3)}),a.on(`error`,i),a.on(`close`,e=>r({exitCode:e??1,stdout:o,stderr:s}))})}function commandPath(e,r=process.env){if(!e||e===`.`||e===`..`||/[\\/:]/.test(e))return;let i=isWindows(),a=i?Object.keys(r).sort().find(e=>e.toUpperCase()===`PATH`):`PATH`,o=a&&r[a]||``,s=i&&!e.toLowerCase().endsWith(`.exe`)?`${e}.exe`:e,c=u(process.cwd(),{bigint:!0});for(let e of o.split(f.delimiter)){let r=i?e.replace(/^"(.*)"$/,`$1`):e;if(f.isAbsolute(r)&&!(i&&f.parse(r).root.length===1))try{let e=u(r,{bigint:!0});if(e.dev===c.dev&&e.ino===c.ino)continue;let a=f.join(r,s);if(!u(a).isFile())continue;return t(a,i?n.F_OK:n.X_OK),a}catch{}}}function getCommandOutput(e,t,n){let r=x(e,t,{cwd:n?.cwd,encoding:`utf8`,stdio:[`ignore`,`pipe`,`pipe`]});if(r.status===0)return r.stdout.trim()}const at=[{filename:`pnpm-lock.yaml`,type:`pnpm`},{filename:`bun.lockb`,type:`bun`},{filename:`bun.lock`,type:`bun`},{filename:`package-lock.json`,type:`npm`},{filename:`npm-shrinkwrap.json`,type:`npm`},{filename:`yarn.lock`,type:`yarn`}];function resolvePath(e,t){return h(e)?e:g(t,e)}function inferLockFileType(e,t){return t.includes(`pnpm`)?{type:`pnpm`,path:e,filename:t}:t.includes(`yarn`)?{type:`yarn`,path:e,filename:t}:t.startsWith(`bun.`)?{type:`bun`,path:e,filename:t}:{type:`npm`,path:e,filename:t}}function detectLockFile(e,t){if(e){let n=resolvePath(e,t);if(i(n)){let e=p(n),t=at.find(t=>t.filename===e);return t?{type:t.type,path:n,filename:e}:inferLockFileType(n,e)}return}let n=c(t);for(let e of at)if(n.includes(e.filename)){let n=g(t,e.filename);return{type:e.type,path:n,filename:e.filename}}}function prepareCacheMetadata(e){let{projectDir:t,cacheDependencyPath:n,logWarning:r}=e,i=detectLockFile(n||void 0,t);if(!i)return r?.(`setup-vp: cache is enabled but no supported lock file was found; skipping cache.`),{ready:!1};let a=getCommandOutput(`vp`,[`pm`,`cache`,`dir`],{cwd:f.dirname(i.path)});return a?{ready:!0,cachePath:a,lockFile:i.path,lockType:i.type}:(r?.(`setup-vp: could not resolve package-manager cache directory for ${i.filename}; skipping cache.`),{ready:!1})}function createLockfileResolver(e){let{getWorkspaceDir:t,info:n,debug:r}=e,a=/^\d+\.\d+\.\d+/;function tryResolveVitePlusVersionFromLockfile(e,t){let i=detectLockfileForProject(e,t);if(!i)return;let a=i.filename.endsWith(`.lockb`)?textBunLockBeside(i):i;if(!a){r(`Cannot read ${i.filename} (binary) to resolve the ${Y} version; using "latest". Use the text bun.lock, or set the \`version\` input.`);return}let o=parseVitePlusVersionFromLockfile(a,workspaceSubPath(m(a.path),e));if(o)return n(`Resolved ${Y} version '${o}' from ${a.filename}`),o;r(`No ${Y} version found in ${a.path}`)}function detectLockfileForProject(e,n){if(n)return detectLockFile(n,e);let r=t(),i=e;for(;;){let e=detectLockFile(void 0,i);if(e)return e;let t=m(i);if(i===r||t===i||!isWithin(t,r))break;i=t}}function textBunLockBeside(e){let t=g(m(e.path),`bun.lock`);return i(t)?{type:`bun`,path:t,filename:`bun.lock`}:void 0}function workspaceSubPath(e,t){if(!isWithin(t,e))return``;let n=_(e,t);return n?n.split(v).join(`/`):``}function parseVitePlusVersionFromLockfile(e,t=``){if(e.filename.endsWith(`.lockb`))return;let n;try{n=s(e.path,`utf-8`)}catch{return}let r;switch(e.type){case`npm`:r=fromNpmLock(n,t);break;case`pnpm`:r=fromPnpmLock(n,t);break;case`yarn`:r=fromYarnLock(n);break;case`bun`:r=fromBunTextLock(n);break;default:return}return r&&a.test(r)?r:void 0}function fromNpmLock(e,t){let n;try{n=JSON.parse(e)}catch{return}let r=n.packages;if(t){let e=r?.[`${t}/node_modules/${X}`]?.version;if(typeof e==`string`)return e;if(!npmPackageDeclaresVitePlus(r?.[t]))return}let i=r?.[`node_modules/${X}`]?.version;if(typeof i==`string`)return i;let a=n.dependencies?.[X]?.version;return typeof a==`string`?a:void 0}function npmPackageDeclaresVitePlus(e){if(!e)return!1;for(let t of[`dependencies`,`devDependencies`]){let n=e[t];if(n&&typeof n==`object`&&`vite-plus`in n)return!0}return!1}function fromPnpmLock(e,t){let n;try{n=(0,J.parse)(e)}catch{return}if(!n||typeof n!=`object`)return;let r=n,i=r.importers;if(i&&typeof i==`object`){let e=t||`.`;return e in i?pnpmImporterVersion(i[e]):void 0}return pnpmImporterVersion(r)||e.match(/^\s*\/?vite-plus@(\d+\.\d+\.\d+[^\s():'"]*)/m)?.[1]}function pnpmImporterVersion(e){if(!e||typeof e!=`object`)return;let t=e;for(let e of[`dependencies`,`devDependencies`,`optionalDependencies`]){let n=t[e];if(n&&typeof n==`object`){let e=n[X],t=typeof e==`string`?e:e?.version;if(typeof t==`string`){let e=t.replace(/\(.*$/,``).trim();if(a.test(e))return e}}}}function fromYarnLock(e){let t=/* @__PURE__ */ new Set,n=e.split(/\r?\n/);for(let e=0;ee.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}}})),tt=/* @__PURE__ */ __commonJSMin((e=>{var t=qe(),n=W(),r=G(),i=fe(),a=O(),o=$e(),s=et();function parseOptions(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new o.LineCounter||null,prettyErrors:t}}function parseAllDocuments(e,n={}){let{lineCounter:i,prettyErrors:a}=parseOptions(n),o=new s.Parser(i?.addNewLine),c=new t.Composer(n),l=Array.from(c.compose(o.parse(e)));if(a&&i)for(let t of l)t.errors.forEach(r.prettifyError(e,i)),t.warnings.forEach(r.prettifyError(e,i));return l.length>0?l:Object.assign([],{empty:!0},c.streamInfo())}function parseDocument(e,n={}){let{lineCounter:i,prettyErrors:a}=parseOptions(n),o=new s.Parser(i?.addNewLine),c=new t.Composer(n),l=null;for(let t of c.compose(o.parse(e),!0,e.length))if(!l)l=t;else if(l.options.logLevel!==`silent`){l.errors.push(new r.YAMLParseError(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return a&&i&&(l.errors.forEach(r.prettifyError(e,i)),l.warnings.forEach(r.prettifyError(e,i))),l}function parse(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let a=parseDocument(e,n);if(!a)return null;if(a.warnings.forEach(e=>i.warn(a.options.logLevel,e)),a.errors.length>0){if(a.options.logLevel!==`silent`)throw a.errors[0];a.errors=[]}return a.toJS(Object.assign({reviver:r},n))}function stringify(e,t,r){let i=null;if(typeof t==`function`||Array.isArray(t)?i=t:r===void 0&&t&&(r=t),typeof r==`string`&&(r=r.length),typeof r==`number`){let e=Math.round(r);r=e<1?void 0:e>8?{indent:8}:{indent:e}}if(e===void 0){let{keepUndefined:e}=r??t??{};if(!e)return}return a.isDocument(e)&&!i?e.toString(r):new n.Document(e,i,r).toString(r)}e.parse=parse,e.parseAllDocuments=parseAllDocuments,e.parseDocument=parseDocument,e.stringify=stringify})),J=(/* @__PURE__ */ __commonJSMin((e=>{var t=qe(),n=W(),r=Me(),i=G(),a=j(),o=O(),s=L(),c=M(),l=R(),u=B();Ze();var d=Qe(),f=$e(),p=et(),m=tt(),h=k();e.Composer=t.Composer,e.Document=n.Document,e.Schema=r.Schema,e.YAMLError=i.YAMLError,e.YAMLParseError=i.YAMLParseError,e.YAMLWarning=i.YAMLWarning,e.Alias=a.Alias,e.isAlias=o.isAlias,e.isCollection=o.isCollection,e.isDocument=o.isDocument,e.isMap=o.isMap,e.isNode=o.isNode,e.isPair=o.isPair,e.isScalar=o.isScalar,e.isSeq=o.isSeq,e.Pair=s.Pair,e.Scalar=c.Scalar,e.YAMLMap=l.YAMLMap,e.YAMLSeq=u.YAMLSeq,e.Lexer=d.Lexer,e.LineCounter=f.LineCounter,e.Parser=p.Parser,e.parse=m.parse,e.parseAllDocuments=m.parseAllDocuments,e.parseDocument=m.parseDocument,e.stringify=m.stringify,e.visit=h.visit,e.visitAsync=h.visitAsync})))();function parseInstalledVpVersion(e){return(e.match(/^\s*vp\s+v?(\d[^\s]*)/im)??e.match(/Global:\s*v?(\d[^\s]*)/i))?.[1]??`unknown`}const nt=/* @__PURE__ */ new Set([`true`,`True`,`TRUE`]),rt=/* @__PURE__ */ new Set([`false`,`False`,`FALSE`]);function parseNodeManager(e){if(e){if(nt.has(e))return!0;if(rt.has(e))return!1;throw Error(`Invalid node-manager input: "${e}". Expected "true", "false", or unset.`)}}function supportsScopedEnv(e){let t=parseInstalledVpVersion(e);if(t.startsWith(`0.0.0-commit.`))return!0;let n=t.match(/^(\d+)\.(\d+)\.(\d+)/);if(!n)throw Error(`Could not determine the installed Vite+ version for env configuration.`);let[,r,i,a]=n.map(Number);return r>0||i>3||i===3&&a>=1}function nodeManagerOffArgs(e){return parseInstalledVpVersion(e).startsWith(`0.0.0-commit.`)&&console.info("setup-vp: node-manager: false requires a preview build that supports `vp env off node`. If this command is unsupported, use a newer preview or a stable release. setup-vp will not fall back to disabling package-manager management."),supportsScopedEnv(e)?[`env`,`off`,`node`]:[`env`,`off`]}const it=[`npm`,`pnpm`,`yarn`,`bun`];function parsePackageManager(e){if(!e?.trim())return;let t;try{t=(0,J.parse)(e)}catch(e){throw Error(`Invalid package-manager input: ${String(e)}`)}if(t!==``){if(typeof t==`boolean`)return t;if(t&&typeof t==`object`&&!Array.isArray(t)){for(let[e,n]of Object.entries(t))if(!it.includes(e)||typeof n!=`boolean`)throw Error(`Invalid package-manager input: ${e} must be npm, pnpm, yarn, or bun with a boolean value.`);return t}throw Error(`Invalid package-manager input: expected a boolean or a mapping of npm, pnpm, yarn, and bun to booleans.`)}}function packageManagerArgs(e,t){if(e===void 0)return[];if(!supportsScopedEnv(t))throw Error(`package-manager configuration requires Vite+ 0.3.1 or newer.`);return typeof e==`boolean`?e?[]:[[`env`,`off`,`pm`]]:it.filter(t=>e[t]===!1).map(e=>[`env`,`off`,e])}const Y=`Vite+`,X=`vite-plus`;function resolvePath$1(e,t){return f.isAbsolute(e)?e:f.join(t,e)}function isWithin(e,t){let n=f.relative(t,e);return!f.isAbsolute(n)&&n!==`..`&&!n.startsWith(`..${f.sep}`)}function resolveProjectDirectory(e){let{workingDirectory:t,workspaceRoot:n}=e,r=f.isAbsolute(t)?t:f.join(n,t);try{if(!u(r).isDirectory())throw Error(`working-directory is not a directory: ${t} (resolved to ${r})`)}catch(e){throw e instanceof Error&&`code`in e&&e.code===`ENOENT`?Error(`working-directory not found: ${t} (resolved to ${r})`):e}return r}function isWindows(e=process.platform){return e===`win32`}function run(e,t,n={}){let r=x(e,t,{stdio:`inherit`,...n});if(r.error)throw r.error;if(r.status!==0)throw Error(`${e} ${t.join(` `)} exited with code ${r.status??1}`)}function runWithOutput(e,t,n={}){return new Promise((r,i)=>{let a=b(e,t,{...n,stdio:[`ignore`,`pipe`,`pipe`]}),o=``,s=``;a.stdout.on(`data`,e=>{process.stdout.write(e),o=(o+e.toString()).slice(-4e3)}),a.stderr.on(`data`,e=>{process.stderr.write(e),s=(s+e.toString()).slice(-4e3)}),a.on(`error`,i),a.on(`close`,e=>r({exitCode:e??1,stdout:o,stderr:s}))})}function commandPath(e,r=process.env){if(!e||e===`.`||e===`..`||/[\\/:]/.test(e))return;let i=isWindows(),a=i?Object.keys(r).sort().find(e=>e.toUpperCase()===`PATH`):`PATH`,o=a&&r[a]||``,s=i&&!e.toLowerCase().endsWith(`.exe`)?`${e}.exe`:e,c=u(process.cwd(),{bigint:!0}),l=i?n.F_OK:n.X_OK;for(let e of o.split(f.delimiter)){let n=i?e.replace(/^"(.*)"$/,`$1`):e;if(f.isAbsolute(n)&&!(i&&f.parse(n).root.length===1))try{let e=u(n,{bigint:!0});if(e.dev===c.dev&&e.ino===c.ino)continue;let r=f.join(n,s);if(!u(r).isFile())continue;return t(r,l),r}catch{}}}function getCommandOutput(e,t,n){let r=x(e,t,{cwd:n?.cwd,encoding:`utf8`,stdio:[`ignore`,`pipe`,`pipe`]});if(r.status===0)return r.stdout.trim()}const at=[{filename:`pnpm-lock.yaml`,type:`pnpm`},{filename:`bun.lockb`,type:`bun`},{filename:`bun.lock`,type:`bun`},{filename:`package-lock.json`,type:`npm`},{filename:`npm-shrinkwrap.json`,type:`npm`},{filename:`yarn.lock`,type:`yarn`}];function resolvePath(e,t){return h(e)?e:g(t,e)}function inferLockFileType(e,t){return t.includes(`pnpm`)?{type:`pnpm`,path:e,filename:t}:t.includes(`yarn`)?{type:`yarn`,path:e,filename:t}:t.startsWith(`bun.`)?{type:`bun`,path:e,filename:t}:{type:`npm`,path:e,filename:t}}function detectLockFile(e,t){if(e){let n=resolvePath(e,t);if(i(n)){let e=p(n),t=at.find(t=>t.filename===e);return t?{type:t.type,path:n,filename:e}:inferLockFileType(n,e)}return}let n=c(t);for(let e of at)if(n.includes(e.filename)){let n=g(t,e.filename);return{type:e.type,path:n,filename:e.filename}}}function prepareCacheMetadata(e){let{projectDir:t,cacheDependencyPath:n,logWarning:r}=e,i=detectLockFile(n||void 0,t);if(!i)return r?.(`setup-vp: cache is enabled but no supported lock file was found; skipping cache.`),{ready:!1};let a=getCommandOutput(`vp`,[`pm`,`cache`,`dir`],{cwd:f.dirname(i.path)});return a?{ready:!0,cachePath:a,lockFile:i.path,lockType:i.type}:(r?.(`setup-vp: could not resolve package-manager cache directory for ${i.filename}; skipping cache.`),{ready:!1})}function createLockfileResolver(e){let{getWorkspaceDir:t,info:n,debug:r}=e,a=/^\d+\.\d+\.\d+/;function tryResolveVitePlusVersionFromLockfile(e,t){let i=detectLockfileForProject(e,t);if(!i)return;let a=i.filename.endsWith(`.lockb`)?textBunLockBeside(i):i;if(!a){r(`Cannot read ${i.filename} (binary) to resolve the ${Y} version; using "latest". Use the text bun.lock, or set the \`version\` input.`);return}let o=parseVitePlusVersionFromLockfile(a,workspaceSubPath(m(a.path),e));if(o)return n(`Resolved ${Y} version '${o}' from ${a.filename}`),o;r(`No ${Y} version found in ${a.path}`)}function detectLockfileForProject(e,n){if(n)return detectLockFile(n,e);let r=t(),i=e;for(;;){let e=detectLockFile(void 0,i);if(e)return e;let t=m(i);if(i===r||t===i||!isWithin(t,r))break;i=t}}function textBunLockBeside(e){let t=g(m(e.path),`bun.lock`);return i(t)?{type:`bun`,path:t,filename:`bun.lock`}:void 0}function workspaceSubPath(e,t){if(!isWithin(t,e))return``;let n=_(e,t);return n?n.split(v).join(`/`):``}function parseVitePlusVersionFromLockfile(e,t=``){if(e.filename.endsWith(`.lockb`))return;let n;try{n=s(e.path,`utf-8`)}catch{return}let r;switch(e.type){case`npm`:r=fromNpmLock(n,t);break;case`pnpm`:r=fromPnpmLock(n,t);break;case`yarn`:r=fromYarnLock(n);break;case`bun`:r=fromBunTextLock(n);break;default:return}return r&&a.test(r)?r:void 0}function fromNpmLock(e,t){let n;try{n=JSON.parse(e)}catch{return}let r=n.packages;if(t){let e=r?.[`${t}/node_modules/${X}`]?.version;if(typeof e==`string`)return e;if(!npmPackageDeclaresVitePlus(r?.[t]))return}let i=r?.[`node_modules/${X}`]?.version;if(typeof i==`string`)return i;let a=n.dependencies?.[X]?.version;return typeof a==`string`?a:void 0}function npmPackageDeclaresVitePlus(e){if(!e)return!1;for(let t of[`dependencies`,`devDependencies`]){let n=e[t];if(n&&typeof n==`object`&&`vite-plus`in n)return!0}return!1}function fromPnpmLock(e,t){let n;try{n=(0,J.parse)(e)}catch{return}if(!n||typeof n!=`object`)return;let r=n,i=r.importers;if(i&&typeof i==`object`){let e=t||`.`;return e in i?pnpmImporterVersion(i[e]):void 0}return pnpmImporterVersion(r)||e.match(/^\s*\/?vite-plus@(\d+\.\d+\.\d+[^\s():'"]*)/m)?.[1]}function pnpmImporterVersion(e){if(!e||typeof e!=`object`)return;let t=e;for(let e of[`dependencies`,`devDependencies`,`optionalDependencies`]){let n=t[e];if(n&&typeof n==`object`){let e=n[X],t=typeof e==`string`?e:e?.version;if(typeof t==`string`){let e=t.replace(/\(.*$/,``).trim();if(a.test(e))return e}}}}function fromYarnLock(e){let t=/* @__PURE__ */ new Set,n=e.split(/\r?\n/);for(let e=0;ee,info:console.info,debug:()=>{},warning:console.warn}}const ot=`https://raw.githubusercontent.com/voidzero-dev/vite-plus`,Z=`packages/cli`,st=/^0\.0\.0-commit\.([0-9a-f]{40})$/i,ct=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;function pkgPrNewCommitSha(e){return e.match(st)?.[1]}function getInstallScriptUrls(e,t=process.platform){let n=isWindows(t)?`install.ps1`:`install.sh`,r=installScriptRef(e);return{pinned:r?[`${ot}/${r}/${Z}/${n}`,`https://cdn.jsdelivr.net/gh/voidzero-dev/vite-plus@${r}/${Z}/${n}`]:[],latest:[`https://viteplus.dev/${n}`,`${ot}/main/${Z}/${n}`]}}function installScriptRef(e){let t=pkgPrNewCommitSha(e);if(t)return t.toLowerCase();if(ct.test(e))return`v${e}`}function readNpmrc(e){try{return s(e,`utf8`)}catch(e){if(e.code===`ENOENT`)return``;throw e}}function analyzeProjectNpmrc(e){let t=/* @__PURE__ */ new Set;for(let n of e.split(/\r?\n/)){let e=n.trim();if(!e||e.startsWith(`;`)||e.startsWith(`#`))continue;let r=e.indexOf(`=`);if(r<0)continue;let i=e.slice(r+1).trim();for(let e of i.matchAll(/\$\{(\w+)\}/g))t.add(e[1])}return{envVarRefs:t}}function readUserConfigLines(e,t){let n=e.HOME||e.USERPROFILE,r=e.NPM_CONFIG_USERCONFIG||e.PNPM_CONFIG_USERCONFIG||n&&f.join(n,`.npmrc`);return(r?readNpmrc(r):``).split(/\r?\n/).filter(e=>!t.has(e.split(`=`)[0].trim().toLowerCase()))}function isReservedAuthVariable(e){return[`GITHUB_TOKEN`,`CI_JOB_TOKEN`,`SYSTEM_ACCESSTOKEN`].includes(e)?!1:/^(?:PATH|HOME|USERPROFILE|TMPDIR|CI)$/i.test(e)||/^(?:SETUP_VP_|RUNNER_|GITHUB_|CI_|SYSTEM_|AGENT_|BUILD_|RELEASE_)/i.test(e)}function writeUserConfig(e,t,n){let r=o(f.join(C(),`setup-vp-npmrc-`)),i=f.join(r,`.npmrc`);d(i,e,{encoding:`utf8`,mode:384});for(let e of[`NPM_CONFIG_USERCONFIG`,`PNPM_CONFIG_USERCONFIG`])t[e]=i,n?.(e,i);return i}function configureAuth(e,t,n,r,i){if(!e){if(!i)return;let{envVarRefs:e}=analyzeProjectNpmrc(readNpmrc(f.join(i,`.npmrc`)));for(let t of e)!isReservedAuthVariable(t)&&n[t]&&r?.(t,n[t]);return}let a;try{a=new URL(e)}catch{throw Error(`Invalid registry-url: "${e}". Must be a valid URL.`)}let o=a.href.endsWith(`/`)?a.href:`${a.href}/`,s=``;t&&(s=`${(t.startsWith(`@`)?t:`@${t}`).toLowerCase()}:`);let c=o.replace(/^\w+:/,``).toLowerCase(),l=readUserConfigLines(n,/* @__PURE__ */ new Set([`${s}registry`,`${c}:_authtoken`]));l.push(`${c}:_authToken=\${NODE_AUTH_TOKEN}`,`${s}registry=${o}`);let u=writeUserConfig(l.filter(Boolean).join(` `)+` diff --git a/dist/gitlab/index.mjs b/dist/gitlab/index.mjs index 32efed9..3f3422d 100644 --- a/dist/gitlab/index.mjs +++ b/dist/gitlab/index.mjs @@ -136,7 +136,7 @@ default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.l /* istanbul ignore else should not happen */ n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let t=this.peek(2);if(t.type===`block-map`&&(this.type===`map-value-ind`&&t.indent===e.indent||this.type===`newline`&&!t.items[t.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type===`map-value-ind`&&t.type!==`flow-collection`){let n=getFirstKeyStartProps(getPrevProps(t));fixFlowSeqItems(e);let r=e.end.splice(1,e.end.length);r.push(this.sourceToken);let i={type:`block-map`,offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let e=this.source.indexOf(` `)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(` -`,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=getFirstKeyStartProps(getPrevProps(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=getFirstKeyStartProps(getPrevProps(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}}})),ot=/* @__PURE__ */ __commonJSMin((e=>{var t=Qe(),n=G(),r=K(),i=_e(),a=O(),o=it(),s=at();function parseOptions(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new o.LineCounter||null,prettyErrors:t}}function parseAllDocuments(e,n={}){let{lineCounter:i,prettyErrors:a}=parseOptions(n),o=new s.Parser(i?.addNewLine),c=new t.Composer(n),l=Array.from(c.compose(o.parse(e)));if(a&&i)for(let t of l)t.errors.forEach(r.prettifyError(e,i)),t.warnings.forEach(r.prettifyError(e,i));return l.length>0?l:Object.assign([],{empty:!0},c.streamInfo())}function parseDocument(e,n={}){let{lineCounter:i,prettyErrors:a}=parseOptions(n),o=new s.Parser(i?.addNewLine),c=new t.Composer(n),l=null;for(let t of c.compose(o.parse(e),!0,e.length))if(!l)l=t;else if(l.options.logLevel!==`silent`){l.errors.push(new r.YAMLParseError(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return a&&i&&(l.errors.forEach(r.prettifyError(e,i)),l.warnings.forEach(r.prettifyError(e,i))),l}function parse(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let a=parseDocument(e,n);if(!a)return null;if(a.warnings.forEach(e=>i.warn(a.options.logLevel,e)),a.errors.length>0){if(a.options.logLevel!==`silent`)throw a.errors[0];a.errors=[]}return a.toJS(Object.assign({reviver:r},n))}function stringify(e,t,r){let i=null;if(typeof t==`function`||Array.isArray(t)?i=t:r===void 0&&t&&(r=t),typeof r==`string`&&(r=r.length),typeof r==`number`){let e=Math.round(r);r=e<1?void 0:e>8?{indent:8}:{indent:e}}if(e===void 0){let{keepUndefined:e}=r??t??{};if(!e)return}return a.isDocument(e)&&!i?e.toString(r):new n.Document(e,i,r).toString(r)}e.parse=parse,e.parseAllDocuments=parseAllDocuments,e.parseDocument=parseDocument,e.stringify=stringify})),Y=(/* @__PURE__ */ __commonJSMin((e=>{var t=Qe(),n=G(),r=Le(),i=K(),a=M(),o=O(),s=R(),c=N(),l=z(),u=V();nt();var d=rt(),f=it(),p=at(),m=ot(),h=k();e.Composer=t.Composer,e.Document=n.Document,e.Schema=r.Schema,e.YAMLError=i.YAMLError,e.YAMLParseError=i.YAMLParseError,e.YAMLWarning=i.YAMLWarning,e.Alias=a.Alias,e.isAlias=o.isAlias,e.isCollection=o.isCollection,e.isDocument=o.isDocument,e.isMap=o.isMap,e.isNode=o.isNode,e.isPair=o.isPair,e.isScalar=o.isScalar,e.isSeq=o.isSeq,e.Pair=s.Pair,e.Scalar=c.Scalar,e.YAMLMap=l.YAMLMap,e.YAMLSeq=u.YAMLSeq,e.Lexer=d.Lexer,e.LineCounter=f.LineCounter,e.Parser=p.Parser,e.parse=m.parse,e.parseAllDocuments=m.parseAllDocuments,e.parseDocument=m.parseDocument,e.stringify=m.stringify,e.visit=h.visit,e.visitAsync=h.visitAsync})))();const X=`Vite+`,Z=`vite-plus`;function resolvePath$1(e,t){return _.isAbsolute(e)?e:_.join(t,e)}function isWithin(e,t){let n=_.relative(t,e);return!_.isAbsolute(n)&&n!==`..`&&!n.startsWith(`..${_.sep}`)}function resolveProjectDirectory(e){let{workingDirectory:t,workspaceRoot:n}=e,r=_.isAbsolute(t)?t:_.join(n,t);try{if(!m(r).isDirectory())throw Error(`working-directory is not a directory: ${t} (resolved to ${r})`)}catch(e){throw e instanceof Error&&`code`in e&&e.code===`ENOENT`?Error(`working-directory not found: ${t} (resolved to ${r})`):e}return r}function isWindows(e=process.platform){return e===`win32`}function run(e,t,n={}){let r=E(e,t,{stdio:`inherit`,...n});if(r.error)throw r.error;if(r.status!==0)throw Error(`${e} ${t.join(` `)} exited with code ${r.status??1}`)}function runWithOutput(e,t,n={}){return new Promise((r,i)=>{let a=T(e,t,{...n,stdio:[`ignore`,`pipe`,`pipe`]}),o=``,s=``;a.stdout.on(`data`,e=>{process.stdout.write(e),o=(o+e.toString()).slice(-4e3)}),a.stderr.on(`data`,e=>{process.stderr.write(e),s=(s+e.toString()).slice(-4e3)}),a.on(`error`,i),a.on(`close`,e=>r({exitCode:e??1,stdout:o,stderr:s}))})}function commandPath(e,r=process.env){if(!e||e===`.`||e===`..`||/[\\/:]/.test(e))return;let i=isWindows(),a=i?Object.keys(r).sort().find(e=>e.toUpperCase()===`PATH`):`PATH`,o=a&&r[a]||``,s=i&&!e.toLowerCase().endsWith(`.exe`)?`${e}.exe`:e,c=m(process.cwd(),{bigint:!0});for(let e of o.split(_.delimiter)){let r=i?e.replace(/^"(.*)"$/,`$1`):e;if(_.isAbsolute(r)&&!(i&&_.parse(r).root.length===1))try{let e=m(r,{bigint:!0});if(e.dev===c.dev&&e.ino===c.ino)continue;let a=_.join(r,s);if(!m(a).isFile())continue;return t(a,i?n.F_OK:n.X_OK),a}catch{}}}function getCommandOutput(e,t,n){let r=E(e,t,{cwd:n?.cwd,encoding:`utf8`,stdio:[`ignore`,`pipe`,`pipe`]});if(r.status===0)return r.stdout.trim()}const st=[{filename:`pnpm-lock.yaml`,type:`pnpm`},{filename:`bun.lockb`,type:`bun`},{filename:`bun.lock`,type:`bun`},{filename:`package-lock.json`,type:`npm`},{filename:`npm-shrinkwrap.json`,type:`npm`},{filename:`yarn.lock`,type:`yarn`}];function resolvePath(e,t){return b(e)?e:x(t,e)}function inferLockFileType(e,t){return t.includes(`pnpm`)?{type:`pnpm`,path:e,filename:t}:t.includes(`yarn`)?{type:`yarn`,path:e,filename:t}:t.startsWith(`bun.`)?{type:`bun`,path:e,filename:t}:{type:`npm`,path:e,filename:t}}function detectLockFile(e,t){if(e){let n=resolvePath(e,t);if(o(n)){let e=v(n),t=st.find(t=>t.filename===e);return t?{type:t.type,path:n,filename:e}:inferLockFileType(n,e)}return}let n=d(t);for(let e of st)if(n.includes(e.filename)){let n=x(t,e.filename);return{type:e.type,path:n,filename:e.filename}}}function prepareCacheMetadata(e){let{projectDir:t,cacheDependencyPath:n,logWarning:r}=e,i=detectLockFile(n||void 0,t);if(!i)return r?.(`setup-vp: cache is enabled but no supported lock file was found; skipping cache.`),{ready:!1};let a=getCommandOutput(`vp`,[`pm`,`cache`,`dir`],{cwd:_.dirname(i.path)});return a?{ready:!0,cachePath:a,lockFile:i.path,lockType:i.type}:(r?.(`setup-vp: could not resolve package-manager cache directory for ${i.filename}; skipping cache.`),{ready:!1})}function createLockfileResolver(e){let{getWorkspaceDir:t,info:n,debug:r}=e,i=/^\d+\.\d+\.\d+/;function tryResolveVitePlusVersionFromLockfile(e,t){let i=detectLockfileForProject(e,t);if(!i)return;let a=i.filename.endsWith(`.lockb`)?textBunLockBeside(i):i;if(!a){r(`Cannot read ${i.filename} (binary) to resolve the ${X} version; using "latest". Use the text bun.lock, or set the \`version\` input.`);return}let o=parseVitePlusVersionFromLockfile(a,workspaceSubPath(y(a.path),e));if(o)return n(`Resolved ${X} version '${o}' from ${a.filename}`),o;r(`No ${X} version found in ${a.path}`)}function detectLockfileForProject(e,n){if(n)return detectLockFile(n,e);let r=t(),i=e;for(;;){let e=detectLockFile(void 0,i);if(e)return e;let t=y(i);if(i===r||t===i||!isWithin(t,r))break;i=t}}function textBunLockBeside(e){let t=x(y(e.path),`bun.lock`);return o(t)?{type:`bun`,path:t,filename:`bun.lock`}:void 0}function workspaceSubPath(e,t){if(!isWithin(t,e))return``;let n=S(e,t);return n?n.split(C).join(`/`):``}function parseVitePlusVersionFromLockfile(e,t=``){if(e.filename.endsWith(`.lockb`))return;let n;try{n=u(e.path,`utf-8`)}catch{return}let r;switch(e.type){case`npm`:r=fromNpmLock(n,t);break;case`pnpm`:r=fromPnpmLock(n,t);break;case`yarn`:r=fromYarnLock(n);break;case`bun`:r=fromBunTextLock(n);break;default:return}return r&&i.test(r)?r:void 0}function fromNpmLock(e,t){let n;try{n=JSON.parse(e)}catch{return}let r=n.packages;if(t){let e=r?.[`${t}/node_modules/${Z}`]?.version;if(typeof e==`string`)return e;if(!npmPackageDeclaresVitePlus(r?.[t]))return}let i=r?.[`node_modules/${Z}`]?.version;if(typeof i==`string`)return i;let a=n.dependencies?.[Z]?.version;return typeof a==`string`?a:void 0}function npmPackageDeclaresVitePlus(e){if(!e)return!1;for(let t of[`dependencies`,`devDependencies`]){let n=e[t];if(n&&typeof n==`object`&&`vite-plus`in n)return!0}return!1}function fromPnpmLock(e,t){let n;try{n=(0,Y.parse)(e)}catch{return}if(!n||typeof n!=`object`)return;let r=n,i=r.importers;if(i&&typeof i==`object`){let e=t||`.`;return e in i?pnpmImporterVersion(i[e]):void 0}return pnpmImporterVersion(r)||e.match(/^\s*\/?vite-plus@(\d+\.\d+\.\d+[^\s():'"]*)/m)?.[1]}function pnpmImporterVersion(e){if(!e||typeof e!=`object`)return;let t=e;for(let e of[`dependencies`,`devDependencies`,`optionalDependencies`]){let n=t[e];if(n&&typeof n==`object`){let e=n[Z],t=typeof e==`string`?e:e?.version;if(typeof t==`string`){let e=t.replace(/\(.*$/,``).trim();if(i.test(e))return e}}}}function fromYarnLock(e){let t=/* @__PURE__ */ new Set,n=e.split(/\r?\n/);for(let e=0;ee.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}}})),ot=/* @__PURE__ */ __commonJSMin((e=>{var t=Qe(),n=G(),r=K(),i=_e(),a=O(),o=it(),s=at();function parseOptions(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new o.LineCounter||null,prettyErrors:t}}function parseAllDocuments(e,n={}){let{lineCounter:i,prettyErrors:a}=parseOptions(n),o=new s.Parser(i?.addNewLine),c=new t.Composer(n),l=Array.from(c.compose(o.parse(e)));if(a&&i)for(let t of l)t.errors.forEach(r.prettifyError(e,i)),t.warnings.forEach(r.prettifyError(e,i));return l.length>0?l:Object.assign([],{empty:!0},c.streamInfo())}function parseDocument(e,n={}){let{lineCounter:i,prettyErrors:a}=parseOptions(n),o=new s.Parser(i?.addNewLine),c=new t.Composer(n),l=null;for(let t of c.compose(o.parse(e),!0,e.length))if(!l)l=t;else if(l.options.logLevel!==`silent`){l.errors.push(new r.YAMLParseError(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return a&&i&&(l.errors.forEach(r.prettifyError(e,i)),l.warnings.forEach(r.prettifyError(e,i))),l}function parse(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let a=parseDocument(e,n);if(!a)return null;if(a.warnings.forEach(e=>i.warn(a.options.logLevel,e)),a.errors.length>0){if(a.options.logLevel!==`silent`)throw a.errors[0];a.errors=[]}return a.toJS(Object.assign({reviver:r},n))}function stringify(e,t,r){let i=null;if(typeof t==`function`||Array.isArray(t)?i=t:r===void 0&&t&&(r=t),typeof r==`string`&&(r=r.length),typeof r==`number`){let e=Math.round(r);r=e<1?void 0:e>8?{indent:8}:{indent:e}}if(e===void 0){let{keepUndefined:e}=r??t??{};if(!e)return}return a.isDocument(e)&&!i?e.toString(r):new n.Document(e,i,r).toString(r)}e.parse=parse,e.parseAllDocuments=parseAllDocuments,e.parseDocument=parseDocument,e.stringify=stringify})),Y=(/* @__PURE__ */ __commonJSMin((e=>{var t=Qe(),n=G(),r=Le(),i=K(),a=M(),o=O(),s=R(),c=N(),l=z(),u=V();nt();var d=rt(),f=it(),p=at(),m=ot(),h=k();e.Composer=t.Composer,e.Document=n.Document,e.Schema=r.Schema,e.YAMLError=i.YAMLError,e.YAMLParseError=i.YAMLParseError,e.YAMLWarning=i.YAMLWarning,e.Alias=a.Alias,e.isAlias=o.isAlias,e.isCollection=o.isCollection,e.isDocument=o.isDocument,e.isMap=o.isMap,e.isNode=o.isNode,e.isPair=o.isPair,e.isScalar=o.isScalar,e.isSeq=o.isSeq,e.Pair=s.Pair,e.Scalar=c.Scalar,e.YAMLMap=l.YAMLMap,e.YAMLSeq=u.YAMLSeq,e.Lexer=d.Lexer,e.LineCounter=f.LineCounter,e.Parser=p.Parser,e.parse=m.parse,e.parseAllDocuments=m.parseAllDocuments,e.parseDocument=m.parseDocument,e.stringify=m.stringify,e.visit=h.visit,e.visitAsync=h.visitAsync})))();const X=`Vite+`,Z=`vite-plus`;function resolvePath$1(e,t){return _.isAbsolute(e)?e:_.join(t,e)}function isWithin(e,t){let n=_.relative(t,e);return!_.isAbsolute(n)&&n!==`..`&&!n.startsWith(`..${_.sep}`)}function resolveProjectDirectory(e){let{workingDirectory:t,workspaceRoot:n}=e,r=_.isAbsolute(t)?t:_.join(n,t);try{if(!m(r).isDirectory())throw Error(`working-directory is not a directory: ${t} (resolved to ${r})`)}catch(e){throw e instanceof Error&&`code`in e&&e.code===`ENOENT`?Error(`working-directory not found: ${t} (resolved to ${r})`):e}return r}function isWindows(e=process.platform){return e===`win32`}function run(e,t,n={}){let r=E(e,t,{stdio:`inherit`,...n});if(r.error)throw r.error;if(r.status!==0)throw Error(`${e} ${t.join(` `)} exited with code ${r.status??1}`)}function runWithOutput(e,t,n={}){return new Promise((r,i)=>{let a=T(e,t,{...n,stdio:[`ignore`,`pipe`,`pipe`]}),o=``,s=``;a.stdout.on(`data`,e=>{process.stdout.write(e),o=(o+e.toString()).slice(-4e3)}),a.stderr.on(`data`,e=>{process.stderr.write(e),s=(s+e.toString()).slice(-4e3)}),a.on(`error`,i),a.on(`close`,e=>r({exitCode:e??1,stdout:o,stderr:s}))})}function commandPath(e,r=process.env){if(!e||e===`.`||e===`..`||/[\\/:]/.test(e))return;let i=isWindows(),a=i?Object.keys(r).sort().find(e=>e.toUpperCase()===`PATH`):`PATH`,o=a&&r[a]||``,s=i&&!e.toLowerCase().endsWith(`.exe`)?`${e}.exe`:e,c=m(process.cwd(),{bigint:!0}),l=i?n.F_OK:n.X_OK;for(let e of o.split(_.delimiter)){let n=i?e.replace(/^"(.*)"$/,`$1`):e;if(_.isAbsolute(n)&&!(i&&_.parse(n).root.length===1))try{let e=m(n,{bigint:!0});if(e.dev===c.dev&&e.ino===c.ino)continue;let r=_.join(n,s);if(!m(r).isFile())continue;return t(r,l),r}catch{}}}function getCommandOutput(e,t,n){let r=E(e,t,{cwd:n?.cwd,encoding:`utf8`,stdio:[`ignore`,`pipe`,`pipe`]});if(r.status===0)return r.stdout.trim()}const st=[{filename:`pnpm-lock.yaml`,type:`pnpm`},{filename:`bun.lockb`,type:`bun`},{filename:`bun.lock`,type:`bun`},{filename:`package-lock.json`,type:`npm`},{filename:`npm-shrinkwrap.json`,type:`npm`},{filename:`yarn.lock`,type:`yarn`}];function resolvePath(e,t){return b(e)?e:x(t,e)}function inferLockFileType(e,t){return t.includes(`pnpm`)?{type:`pnpm`,path:e,filename:t}:t.includes(`yarn`)?{type:`yarn`,path:e,filename:t}:t.startsWith(`bun.`)?{type:`bun`,path:e,filename:t}:{type:`npm`,path:e,filename:t}}function detectLockFile(e,t){if(e){let n=resolvePath(e,t);if(o(n)){let e=v(n),t=st.find(t=>t.filename===e);return t?{type:t.type,path:n,filename:e}:inferLockFileType(n,e)}return}let n=d(t);for(let e of st)if(n.includes(e.filename)){let n=x(t,e.filename);return{type:e.type,path:n,filename:e.filename}}}function prepareCacheMetadata(e){let{projectDir:t,cacheDependencyPath:n,logWarning:r}=e,i=detectLockFile(n||void 0,t);if(!i)return r?.(`setup-vp: cache is enabled but no supported lock file was found; skipping cache.`),{ready:!1};let a=getCommandOutput(`vp`,[`pm`,`cache`,`dir`],{cwd:_.dirname(i.path)});return a?{ready:!0,cachePath:a,lockFile:i.path,lockType:i.type}:(r?.(`setup-vp: could not resolve package-manager cache directory for ${i.filename}; skipping cache.`),{ready:!1})}function createLockfileResolver(e){let{getWorkspaceDir:t,info:n,debug:r}=e,i=/^\d+\.\d+\.\d+/;function tryResolveVitePlusVersionFromLockfile(e,t){let i=detectLockfileForProject(e,t);if(!i)return;let a=i.filename.endsWith(`.lockb`)?textBunLockBeside(i):i;if(!a){r(`Cannot read ${i.filename} (binary) to resolve the ${X} version; using "latest". Use the text bun.lock, or set the \`version\` input.`);return}let o=parseVitePlusVersionFromLockfile(a,workspaceSubPath(y(a.path),e));if(o)return n(`Resolved ${X} version '${o}' from ${a.filename}`),o;r(`No ${X} version found in ${a.path}`)}function detectLockfileForProject(e,n){if(n)return detectLockFile(n,e);let r=t(),i=e;for(;;){let e=detectLockFile(void 0,i);if(e)return e;let t=y(i);if(i===r||t===i||!isWithin(t,r))break;i=t}}function textBunLockBeside(e){let t=x(y(e.path),`bun.lock`);return o(t)?{type:`bun`,path:t,filename:`bun.lock`}:void 0}function workspaceSubPath(e,t){if(!isWithin(t,e))return``;let n=S(e,t);return n?n.split(C).join(`/`):``}function parseVitePlusVersionFromLockfile(e,t=``){if(e.filename.endsWith(`.lockb`))return;let n;try{n=u(e.path,`utf-8`)}catch{return}let r;switch(e.type){case`npm`:r=fromNpmLock(n,t);break;case`pnpm`:r=fromPnpmLock(n,t);break;case`yarn`:r=fromYarnLock(n);break;case`bun`:r=fromBunTextLock(n);break;default:return}return r&&i.test(r)?r:void 0}function fromNpmLock(e,t){let n;try{n=JSON.parse(e)}catch{return}let r=n.packages;if(t){let e=r?.[`${t}/node_modules/${Z}`]?.version;if(typeof e==`string`)return e;if(!npmPackageDeclaresVitePlus(r?.[t]))return}let i=r?.[`node_modules/${Z}`]?.version;if(typeof i==`string`)return i;let a=n.dependencies?.[Z]?.version;return typeof a==`string`?a:void 0}function npmPackageDeclaresVitePlus(e){if(!e)return!1;for(let t of[`dependencies`,`devDependencies`]){let n=e[t];if(n&&typeof n==`object`&&`vite-plus`in n)return!0}return!1}function fromPnpmLock(e,t){let n;try{n=(0,Y.parse)(e)}catch{return}if(!n||typeof n!=`object`)return;let r=n,i=r.importers;if(i&&typeof i==`object`){let e=t||`.`;return e in i?pnpmImporterVersion(i[e]):void 0}return pnpmImporterVersion(r)||e.match(/^\s*\/?vite-plus@(\d+\.\d+\.\d+[^\s():'"]*)/m)?.[1]}function pnpmImporterVersion(e){if(!e||typeof e!=`object`)return;let t=e;for(let e of[`dependencies`,`devDependencies`,`optionalDependencies`]){let n=t[e];if(n&&typeof n==`object`){let e=n[Z],t=typeof e==`string`?e:e?.version;if(typeof t==`string`){let e=t.replace(/\(.*$/,``).trim();if(i.test(e))return e}}}}function fromYarnLock(e){let t=/* @__PURE__ */ new Set,n=e.split(/\r?\n/);for(let e=0;ee,info:console.info,debug:()=>{},warning:console.warn}}const ct=`https://raw.githubusercontent.com/voidzero-dev/vite-plus`,lt=`packages/cli`,ut=/^0\.0\.0-commit\.([0-9a-f]{40})$/i,dt=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;function pkgPrNewCommitSha(e){return e.match(ut)?.[1]}function getInstallScriptUrls(e,t=process.platform){let n=isWindows(t)?`install.ps1`:`install.sh`,r=installScriptRef(e);return{pinned:r?[`${ct}/${r}/${lt}/${n}`,`https://cdn.jsdelivr.net/gh/voidzero-dev/vite-plus@${r}/${lt}/${n}`]:[],latest:[`https://viteplus.dev/${n}`,`${ct}/main/${lt}/${n}`]}}function installScriptRef(e){let t=pkgPrNewCommitSha(e);if(t)return t.toLowerCase();if(dt.test(e))return`v${e}`}function parseInstalledVpVersion(e){return(e.match(/^\s*vp\s+v?(\d[^\s]*)/im)??e.match(/Global:\s*v?(\d[^\s]*)/i))?.[1]??`unknown`}const Q=`SETUP_VP_DIRS_FILE`;function getVitePlusBinDirs(e){let t=x(e.data,`fallback-bin`);return m(t,{throwIfNoEntry:!1})?.isDirectory()?{bin:e.bin,fallbackBin:t}:{bin:e.bin}}function appendFallbackBinToPath(e,t,n=process.platform){let r=isWindows(n)?`;`:`:`;return[...e?e.split(r).filter(e=>e!==t):[],t].join(r)}const ft=/^v?(\d+)\.(\d+)\.\d+(?:-[0-9A-Za-z.-]+)?$/;function supportsVitePlusDirs(e){if(pkgPrNewCommitSha(e))return!0;let t=e.match(ft);if(!t)return!0;let n=Number(t[1]),r=Number(t[2]);return n>0||r>=3}function createVitePlusDirsFile(){return x(te(),`setup-vp-dirs-${ie()}.txt`)}function removeVitePlusDirsFile(e){p(e,{force:!0})}function readVitePlusProbe(e){try{return u(e,`utf8`)}catch(e){if(e.code===`ENOENT`)return;throw e}}function resolveVitePlusBinDirs(e,t,n){if(!t){if(!supportsVitePlusDirs(e))return{bin:n};throw Error(`Vite+ was installed successfully, but setup-vp could not resolve its VpDirs.`)}let r=readVitePlusProbe(t),i=r===void 0?void 0:parseVitePlusDirs(r);if(i)return getVitePlusBinDirs(i);if(!(pkgPrNewCommitSha(e)!==void 0||ft.test(e))&&r!==void 0){let e=parseInstalledVpVersion(r);if(e!==`unknown`&&!supportsVitePlusDirs(e))return{bin:n}}throw Error(`Vite+ was installed successfully, but setup-vp could not resolve its VpDirs.`)}function parseVitePlusDirs(e){let t=/* @__PURE__ */ new Map;for(let n of e.split(/\r?\n/)){let e=n.indexOf(` `);if(e<1)continue;let r=n.slice(0,e).replace(/^\uFEFF/,``),i=n.slice(e+1).trim();i&&t.set(r,i)}let n=t.get(`data`),r=t.get(`bin`),i=t.get(`cache`),a=t.get(`config`),o=t.get(`state`);if(n&&r&&i&&a&&o)return{data:n,bin:r,cache:i,config:a,state:o}}function getInstallScriptCommand(e,t=process.platform,n=!0){if(isWindows(t))return n?{command:`pwsh`,args:[`-Command`,` $dirsFile = $env:${Q} diff --git a/dist/index.mjs b/dist/index.mjs index 41d1831..51078d7 100644 --- a/dist/index.mjs +++ b/dist/index.mjs @@ -329,6 +329,6 @@ default:throw Error(`Unexpected operation: ${e.operator}`)}}),o&&(!a||i(a,o))&&( More info on storage limits: https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions#calculating-minute-and-storage-spending`),this.name=`UsageError`}};UsageError.isUsageErrorMessage=e=>e?e.includes(`insufficient usage`):!1;var RateLimitError=class extends Error{constructor(e){super(e),this.name=`RateLimitError`}},__awaiter$6=function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})},UploadProgress=class{constructor(e){this.contentLength=e,this.sentBytes=0,this.displayedComplete=!1,this.startTime=Date.now()}setSentBytes(e){this.sentBytes=e}getTransferredBytes(){return this.sentBytes}isDone(){return this.getTransferredBytes()===this.contentLength}display(){if(this.displayedComplete)return;let e=this.sentBytes,t=(100*(e/this.contentLength)).toFixed(1),n=Date.now()-this.startTime,r=(e/1048576/(n/1e3)).toFixed(1);info(`Sent ${e} of ${this.contentLength} (${t}%), ${r} MBs/sec`),this.isDone()&&(this.displayedComplete=!0)}onProgress(){return e=>{this.setSentBytes(e.loadedBytes)}}startDisplayTimer(e=1e3){let displayCallback=()=>{this.display(),this.isDone()||(this.timeoutHandle=setTimeout(displayCallback,e))};this.timeoutHandle=setTimeout(displayCallback,e)}stopDisplayTimer(){this.timeoutHandle&&=(clearTimeout(this.timeoutHandle),void 0),this.display()}};function uploadCacheArchiveSDK(e,t,n){return __awaiter$6(this,void 0,void 0,function*(){let r=new k_(e),i=r.getBlockBlobClient(),a=new UploadProgress(n?.archiveSizeBytes??0),o={blockSize:n?.uploadChunkSize,concurrency:n?.uploadConcurrency,maxSingleShotSize:134217728,onProgress:a.onProgress()};try{a.startDisplayTimer(),debug(`BlobClient: ${r.name}:${r.accountName}:${r.containerName}`);let e=yield i.uploadFile(t,o);if(e._response.status>=400)throw new InvalidResponseError(`uploadCacheArchiveSDK: upload failed with status code ${e._response.status}`);return e}catch(e){throw warning(`uploadCacheArchiveSDK: internal error uploading cache archive: ${e.message}`),e}finally{a.stopDisplayTimer()}})}var __awaiter$5=function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})};function isSuccessStatusCode(e){return e?e>=200&&e<300:!1}function isServerErrorStatusCode(e){return!e||e>=500}function isRetryableStatusCode(e){return e?[On.BadGateway,On.ServiceUnavailable,On.GatewayTimeout].includes(e):!1}function sleep(e){return __awaiter$5(this,void 0,void 0,function*(){return new Promise(t=>setTimeout(t,e))})}function retry(e,t,n){return __awaiter$5(this,arguments,void 0,function*(e,t,n,r=2,i=us,a=void 0){let o=``,s=1;for(;s<=r;){let c,l,u=!1;try{c=yield t()}catch(e){a&&(c=a(e)),u=!0,o=e.message}if(c&&(l=n(c),!isServerErrorStatusCode(l)))return c;if(l&&(u=isRetryableStatusCode(l),o=`Cache service responded with ${l}`),debug(`${e} - Attempt ${s} of ${r} failed with error: ${o}`),!u){debug(`${e} - Error is not retryable`);break}yield sleep(i),s++}throw Error(`${e} failed: ${o}`)})}function retryTypedResponse(e,t){return __awaiter$5(this,arguments,void 0,function*(e,t,n=2,r=us){return yield retry(e,t,e=>e.statusCode,n,r,e=>{if(e instanceof Pn)return{statusCode:e.statusCode,result:null,headers:{},error:e}})})}function retryHttpClientResponse(e,t){return __awaiter$5(this,arguments,void 0,function*(e,t,n=2,r=us){return yield retry(e,t,e=>e.message.statusCode,n,r)})}var __awaiter$4=function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})};function pipeResponseToStream(e,t){return __awaiter$4(this,void 0,void 0,function*(){yield v.promisify(Te.pipeline)(e.message,t)})}var DownloadProgress=class{constructor(e){this.contentLength=e,this.segmentIndex=0,this.segmentSize=0,this.segmentOffset=0,this.receivedBytes=0,this.displayedComplete=!1,this.startTime=Date.now()}nextSegment(e){this.segmentOffset+=this.segmentSize,this.segmentIndex+=1,this.segmentSize=e,this.receivedBytes=0,debug(`Downloading segment at offset ${this.segmentOffset} with length ${this.segmentSize}...`)}setReceivedBytes(e){this.receivedBytes=e}getTransferredBytes(){return this.segmentOffset+this.receivedBytes}isDone(){return this.getTransferredBytes()===this.contentLength}display(){if(this.displayedComplete)return;let e=this.segmentOffset+this.receivedBytes,t=(100*(e/this.contentLength)).toFixed(1),n=Date.now()-this.startTime,r=(e/1048576/(n/1e3)).toFixed(1);info(`Received ${e} of ${this.contentLength} (${t}%), ${r} MBs/sec`),this.isDone()&&(this.displayedComplete=!0)}onProgress(){return e=>{this.setReceivedBytes(e.loadedBytes)}}startDisplayTimer(e=1e3){let displayCallback=()=>{this.display(),this.isDone()||(this.timeoutHandle=setTimeout(displayCallback,e))};this.timeoutHandle=setTimeout(displayCallback,e)}stopDisplayTimer(){this.timeoutHandle&&=(clearTimeout(this.timeoutHandle),void 0),this.display()}};function downloadCacheHttpClient(e,t){return __awaiter$4(this,void 0,void 0,function*(){let n=a.createWriteStream(t),r=new HttpClient(`actions/cache`),i=yield retryHttpClientResponse(`downloadCache`,()=>__awaiter$4(this,void 0,void 0,function*(){return r.get(e)}));i.message.socket.setTimeout(ds,()=>{i.message.destroy(),debug(`Aborting download, socket timed out after ${ds} ms`)}),yield pipeResponseToStream(i,n);let o=i.message.headers[`content-length`];if(o){let e=parseInt(o),n=getArchiveFileSizeInBytes(t);if(n!==e)throw Error(`Incomplete download. Expected file size: ${e}, actual file size: ${n}`)}else debug(`Unable to validate download, no Content-Length header`)})}function downloadCacheHttpClientConcurrent(e,t,n){return __awaiter$4(this,void 0,void 0,function*(){let r=yield a.promises.open(t,`w`),i=new HttpClient(`actions/cache`,void 0,{socketTimeout:n.timeoutInMs,keepAlive:!0});try{let t=(yield retryHttpClientResponse(`downloadCacheMetadata`,()=>__awaiter$4(this,void 0,void 0,function*(){return yield i.request(`HEAD`,e,null,{})}))).message.headers[`content-length`];if(t==null)throw Error(`Content-Length not found on blob response`);let a=parseInt(t);if(Number.isNaN(a))throw Error(`Could not interpret Content-Length: ${a}`);let o=[],s=4194304;for(let t=0;t__awaiter$4(this,void 0,void 0,function*(){return yield downloadSegmentRetry(i,e,t,n)})})}o.reverse();let c=0,l=0,u=new DownloadProgress(a);u.startDisplayTimer();let d=u.onProgress(),f=[],p,waitAndWrite=()=>__awaiter$4(this,void 0,void 0,function*(){let e=yield Promise.race(Object.values(f));yield r.write(e.buffer,0,e.count,e.offset),c--,delete f[e.offset],l+=e.count,d({loadedBytes:l})});for(;p=o.pop();)f[p.offset]=p.promiseGetter(),c++,c>=(n.downloadConcurrency??10)&&(yield waitAndWrite());for(;c>0;)yield waitAndWrite()}finally{i.dispose(),yield r.close()}})}function downloadSegmentRetry(e,t,n,r){return __awaiter$4(this,void 0,void 0,function*(){let i=0;for(;;)try{let i=yield promiseWithTimeout(3e4,downloadSegment(e,t,n,r));if(typeof i==`string`)throw Error(`downloadSegmentRetry failed due to timeout`);return i}catch(e){if(i>=5)throw e;i++}})}function downloadSegment(e,t,n,r){return __awaiter$4(this,void 0,void 0,function*(){let i=yield retryHttpClientResponse(`downloadCachePart`,()=>__awaiter$4(this,void 0,void 0,function*(){return yield e.get(t,{Range:`bytes=${n}-${n+r-1}`})}));if(!i.readBodyBuffer)throw Error(`Expected HttpClientResponse to implement readBodyBuffer`);return{offset:n,count:r,buffer:yield i.readBodyBuffer()}})}function downloadCacheStorageSDK(e,t,n){return __awaiter$4(this,void 0,void 0,function*(){let r=new j_(e,void 0,{retryOptions:{tryTimeoutInMs:n.timeoutInMs}}),i=(yield r.getProperties()).contentLength??-1;if(i<0)debug(`Unable to determine content length, downloading file with http-client...`),yield downloadCacheHttpClient(e,t);else{let e=Math.min(134217728,ee.constants.MAX_LENGTH),o=new DownloadProgress(i),s=a.openSync(t,`w`);try{o.startDisplayTimer();let t=new AbortController,c=t.signal;for(;!o.isDone();){let l=o.segmentOffset+o.segmentSize,u=Math.min(e,i-l);o.nextSegment(u);let d=yield promiseWithTimeout(n.segmentTimeoutInMs||36e5,r.downloadToBuffer(l,u,{abortSignal:c,concurrency:n.downloadConcurrency,onProgress:o.onProgress()}));if(d===`timeout`)throw t.abort(),Error(`Aborting cache download as the download time exceeded the timeout.`);Buffer.isBuffer(d)&&a.writeFileSync(s,d)}}finally{o.stopDisplayTimer(),a.closeSync(s)}}})}const promiseWithTimeout=(e,t)=>__awaiter$4(void 0,void 0,void 0,function*(){let n,r=new Promise(t=>{n=setTimeout(()=>t(`timeout`),e)});return Promise.race([t,r]).then(e=>(clearTimeout(n),e))});function getUploadOptions(e){let t={useAzureSdk:!1,uploadConcurrency:4,uploadChunkSize:33554432};return e&&(typeof e.useAzureSdk==`boolean`&&(t.useAzureSdk=e.useAzureSdk),typeof e.uploadConcurrency==`number`&&(t.uploadConcurrency=e.uploadConcurrency),typeof e.uploadChunkSize==`number`&&(t.uploadChunkSize=e.uploadChunkSize)),t.uploadConcurrency=isNaN(Number(process.env.CACHE_UPLOAD_CONCURRENCY))?t.uploadConcurrency:Math.min(32,Number(process.env.CACHE_UPLOAD_CONCURRENCY)),t.uploadChunkSize=isNaN(Number(process.env.CACHE_UPLOAD_CHUNK_SIZE))?t.uploadChunkSize:Math.min(134217728,Number(process.env.CACHE_UPLOAD_CHUNK_SIZE)*1024*1024),debug(`Use Azure SDK: ${t.useAzureSdk}`),debug(`Upload concurrency: ${t.uploadConcurrency}`),debug(`Upload chunk size: ${t.uploadChunkSize}`),t}function getDownloadOptions(e){let t={useAzureSdk:!1,concurrentBlobDownloads:!0,downloadConcurrency:8,timeoutInMs:3e4,segmentTimeoutInMs:6e5,lookupOnly:!1};e&&(typeof e.useAzureSdk==`boolean`&&(t.useAzureSdk=e.useAzureSdk),typeof e.concurrentBlobDownloads==`boolean`&&(t.concurrentBlobDownloads=e.concurrentBlobDownloads),typeof e.downloadConcurrency==`number`&&(t.downloadConcurrency=e.downloadConcurrency),typeof e.timeoutInMs==`number`&&(t.timeoutInMs=e.timeoutInMs),typeof e.segmentTimeoutInMs==`number`&&(t.segmentTimeoutInMs=e.segmentTimeoutInMs),typeof e.lookupOnly==`boolean`&&(t.lookupOnly=e.lookupOnly));let n=process.env.SEGMENT_DOWNLOAD_TIMEOUT_MINS;return n&&!isNaN(Number(n))&&isFinite(Number(n))&&(t.segmentTimeoutInMs=Number(n)*60*1e3),debug(`Use Azure SDK: ${t.useAzureSdk}`),debug(`Download concurrency: ${t.downloadConcurrency}`),debug(`Request timeout (ms): ${t.timeoutInMs}`),debug(`Cache segment download timeout mins env var: ${process.env.SEGMENT_DOWNLOAD_TIMEOUT_MINS}`),debug(`Segment download timeout (ms): ${t.segmentTimeoutInMs}`),debug(`Lookup only: ${t.lookupOnly}`),t}function isGhes(){let e=new URL(process.env.GITHUB_SERVER_URL||`https://github.com`).hostname.trimEnd().toUpperCase(),t=e===`GITHUB.COM`,n=e.endsWith(`.GHE.COM`),r=e.endsWith(`.LOCALHOST`);return!t&&!n&&!r}function getCacheServiceVersion(){return isGhes()?`v1`:process.env.ACTIONS_CACHE_SERVICE_V2?`v2`:`v1`}const N_=[`none`,`read`,`write`,`write-only`];function getCacheMode(){return(process.env.ACTIONS_CACHE_MODE||``).trim().toLowerCase()}function isCacheReadable(e){return!N_.includes(e)||e===`read`||e===`write`}function isCacheWritable(e){return!N_.includes(e)||e===`write`||e===`write-only`}function getCacheServiceURL(){let e=getCacheServiceVersion();switch(e){case`v1`:return process.env.ACTIONS_CACHE_URL||process.env.ACTIONS_RESULTS_URL||``;case`v2`:return process.env.ACTIONS_RESULTS_URL||``;default:throw Error(`Unsupported cache service version: ${e}`)}}var P_=/* @__PURE__ */ __commonJSMin(((e,t)=>{t.exports={name:`@actions/cache`,version:`6.3.0`,description:`Actions cache lib`,keywords:[`github`,`actions`,`cache`],homepage:`https://github.com/actions/toolkit/tree/main/packages/cache`,license:`MIT`,type:`module`,main:`lib/cache.js`,types:`lib/cache.d.ts`,exports:{".":{types:`./lib/cache.d.ts`,import:`./lib/cache.js`}},directories:{lib:`lib`,test:`__tests__`},files:[`lib`,`!.DS_Store`],publishConfig:{access:`public`},repository:{type:`git`,url:`git+https://github.com/actions/toolkit.git`,directory:`packages/cache`},scripts:{"audit-moderate":`npm install && npm audit --json --audit-level=moderate > audit.json`,test:`echo "Error: run tests from root" && exit 1`,tsc:`tsc && cp src/internal/shared/package-version.cjs lib/internal/shared/`},bugs:{url:`https://github.com/actions/toolkit/issues`},dependencies:{"@actions/core":`^3.0.1`,"@actions/exec":`^3.0.0`,"@actions/glob":`^0.7.0`,"@actions/http-client":`^4.0.1`,"@actions/io":`^3.0.2`,"@azure/core-rest-pipeline":`~1.23.0`,"@azure/storage-blob":`~12.31.0`,"@protobuf-ts/runtime-rpc":`^2.11.1`,semver:`^7.8.5`},devDependencies:{"@protobuf-ts/plugin":`^2.11.1`,"@types/node":`^25.9.8`,"@types/semver":`^7.8.0`,typescript:`^5.9.3`},overrides:{"uri-js":`npm:uri-js-replace@^1.0.1`,"node-fetch":`^3.3.2`}}})),F_=(/* @__PURE__ */ __commonJSMin(((e,t)=>{t.exports={version:P_().version}})))();function getUserAgentString(){return`@actions/cache-${F_.version}`}var __awaiter$3=function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})};function getCacheApiUrl(e){let t=getCacheServiceURL();if(!t)throw Error(`Cache Service Url not found, unable to restore cache.`);let n=`${t}_apis/artifactcache/${e}`;return debug(`Resource Url: ${n}`),n}function createAcceptHeader(e,t){return`${e};api-version=${t}`}function getRequestOptions(){return{headers:{Accept:createAcceptHeader(`application/json`,`6.0-preview.1`)}}}function createHttpClient(){let e=new BearerCredentialHandler(process.env.ACTIONS_RUNTIME_TOKEN||``);return new HttpClient(getUserAgentString(),[e],getRequestOptions())}function getCacheEntry(e,t,n){return __awaiter$3(this,void 0,void 0,function*(){let r=createHttpClient(),i=getCacheVersion(t,n?.compressionMethod,n?.enableCrossOsArchive),a=`cache?keys=${encodeURIComponent(e.join(`,`))}&version=${i}`,o=yield retryTypedResponse(`getCacheEntry`,()=>__awaiter$3(this,void 0,void 0,function*(){return r.getJson(getCacheApiUrl(a))}));if(o.statusCode===204)return isDebug()&&(yield printCachesListForDiagnostics(e[0],r,i)),null;if(!isSuccessStatusCode(o.statusCode)){let e=o.error?.message;throw e?.includes(`cache read denied:`)?Error(e):Error(`Cache service responded with ${o.statusCode}`)}let s=o.result,c=s?.archiveLocation;if(!c)throw Error(`Cache not found.`);return setSecret(c),debug(`Cache Result:`),debug(JSON.stringify(s)),s})}function printCachesListForDiagnostics(e,t,n){return __awaiter$3(this,void 0,void 0,function*(){let r=`caches?key=${encodeURIComponent(e)}`,i=yield retryTypedResponse(`listCache`,()=>__awaiter$3(this,void 0,void 0,function*(){return t.getJson(getCacheApiUrl(r))}));if(i.statusCode===200){let t=i.result,r=t?.totalCount;if(r&&r>0){debug(`No matching cache found for cache key '${e}', version '${n} and scope ${process.env.GITHUB_REF}. There exist one or more cache(s) with similar key but they have different version or scope. See more info on cache matching here: https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#matching-a-cache-key \nOther caches with similar key:`);for(let e of t?.artifactCaches||[])debug(`Cache Key: ${e?.cacheKey}, Cache Version: ${e?.cacheVersion}, Cache Scope: ${e?.scope}, Cache Created: ${e?.creationTime}`)}}})}function downloadCache(e,t,n){return __awaiter$3(this,void 0,void 0,function*(){let r=new De(e),i=getDownloadOptions(n);r.hostname.endsWith(`.blob.core.windows.net`)?i.useAzureSdk?yield downloadCacheStorageSDK(e,t,i):i.concurrentBlobDownloads?yield downloadCacheHttpClientConcurrent(e,t,i):yield downloadCacheHttpClient(e,t):yield downloadCacheHttpClient(e,t)})}function reserveCache(e,t,n){return __awaiter$3(this,void 0,void 0,function*(){let r=createHttpClient(),i={key:e,version:getCacheVersion(t,n?.compressionMethod,n?.enableCrossOsArchive),cacheSize:n?.cacheSize};return yield retryTypedResponse(`reserveCache`,()=>__awaiter$3(this,void 0,void 0,function*(){return r.postJson(getCacheApiUrl(`caches`),i)}))})}function getContentRange(e,t){return`bytes ${e}-${t}/*`}function uploadChunk(e,t,n,r,i){return __awaiter$3(this,void 0,void 0,function*(){debug(`Uploading chunk of size ${i-r+1} bytes at offset ${r} with content range: ${getContentRange(r,i)}`);let a={"Content-Type":`application/octet-stream`,"Content-Range":getContentRange(r,i)},o=yield retryHttpClientResponse(`uploadChunk (start: ${r}, end: ${i})`,()=>__awaiter$3(this,void 0,void 0,function*(){return e.sendStream(`PATCH`,t,n(),a)}));if(!isSuccessStatusCode(o.message.statusCode))throw Error(`Cache service responded with ${o.message.statusCode} during upload chunk.`)})}function uploadFile(e,t,n,r){return __awaiter$3(this,void 0,void 0,function*(){let i=getArchiveFileSizeInBytes(n),o=getCacheApiUrl(`caches/${t.toString()}`),s=a.openSync(n,`r`),c=getUploadOptions(r),l=assertDefined(`uploadConcurrency`,c.uploadConcurrency),u=assertDefined(`uploadChunkSize`,c.uploadChunkSize),d=[...Array(l).keys()];debug(`Awaiting all uploads`);let f=0;try{yield Promise.all(d.map(()=>__awaiter$3(this,void 0,void 0,function*(){for(;fa.createReadStream(n,{fd:s,start:r,end:c,autoClose:!1}).on(`error`,e=>{throw Error(`Cache upload failed because file read failed with ${e.message}`)}),r,c)}})))}finally{a.closeSync(s)}})}function commitCache(e,t,n){return __awaiter$3(this,void 0,void 0,function*(){let r={size:n};return yield retryTypedResponse(`commitCache`,()=>__awaiter$3(this,void 0,void 0,function*(){return e.postJson(getCacheApiUrl(`caches/${t.toString()}`),r)}))})}function saveCache$2(e,t,n,r){return __awaiter$3(this,void 0,void 0,function*(){if(getUploadOptions(r).useAzureSdk){if(!n)throw Error(`Azure Storage SDK can only be used when a signed URL is provided.`);yield uploadCacheArchiveSDK(n,t,r)}else{let n=createHttpClient();debug(`Upload cache`),yield uploadFile(n,e,t,r),debug(`Commiting cache`);let i=getArchiveFileSizeInBytes(t);info(`Cache Size: ~${Math.round(i/1048576)} MB (${i} B)`);let a=yield commitCache(n,e,i);if(!isSuccessStatusCode(a.statusCode))throw Error(`Cache service responded with ${a.statusCode} during commit cache.`);info(`Cache saved successfully`)}})}var I_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isJsonObject=e.typeofJsonValue=void 0;function typeofJsonValue(e){let t=typeof e;if(t==`object`){if(Array.isArray(e))return`array`;if(e===null)return`null`}return t}e.typeofJsonValue=typeofJsonValue;function isJsonObject(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}e.isJsonObject=isJsonObject})),L_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.base64encode=e.base64decode=void 0;let t=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`.split(``),n=[];for(let e=0;e>4,s=o,a=2;break;case 2:r[i++]=(s&15)<<4|(o&60)>>2,s=o,a=3;break;case 3:r[i++]=(s&3)<<6|o,a=0}}if(a==1)throw Error(`invalid base64 string.`);return r.subarray(0,i)}e.base64decode=base64decode;function base64encode(e){let n=``,r=0,i,a=0;for(let o=0;o>2],a=(i&3)<<4,r=1;break;case 1:n+=t[a|i>>4],a=(i&15)<<2,r=2;break;case 2:n+=t[a|i>>6],n+=t[i&63],r=0}return r&&(n+=t[a],n+=`=`,r==1&&(n+=`=`)),n}e.base64encode=base64encode})),R_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.utf8read=void 0;let fromCharCodes=e=>String.fromCharCode.apply(String,e);function utf8read(e){if(e.length<1)return``;let t=0,n=[],r=[],i=0,a,o=e.length;for(;t191&&a<224?r[i++]=(a&31)<<6|e[t++]&63:a>239&&a<365?(a=((a&7)<<18|(e[t++]&63)<<12|(e[t++]&63)<<6|e[t++]&63)-65536,r[i++]=55296+(a>>10),r[i++]=56320+(a&1023)):r[i++]=(a&15)<<12|(e[t++]&63)<<6|e[t++]&63,i>8191&&(n.push(fromCharCodes(r)),i=0);return n.length?(i&&n.push(fromCharCodes(r.slice(0,i))),n.join(``)):fromCharCodes(r.slice(0,i))}e.utf8read=utf8read})),z_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.WireType=e.mergeBinaryOptions=e.UnknownFieldHandler=void 0,(function(e){e.symbol=Symbol.for(`protobuf-ts/unknown`),e.onRead=(t,n,r,i,a)=>{(is(n)?n[e.symbol]:n[e.symbol]=[]).push({no:r,wireType:i,data:a})},e.onWrite=(t,n,r)=>{for(let{no:t,wireType:i,data:a}of e.list(n))r.tag(t,i).raw(a)},e.list=(t,n)=>{if(is(t)){let r=t[e.symbol];return n?r.filter(e=>e.no==n):r}return[]},e.last=(t,n)=>e.list(t,n).slice(-1)[0];let is=t=>t&&Array.isArray(t[e.symbol])})(e.UnknownFieldHandler||={});function mergeBinaryOptions(e,t){return Object.assign(Object.assign({},e),t)}e.mergeBinaryOptions=mergeBinaryOptions,(function(e){e[e.Varint=0]=`Varint`,e[e.Bit64=1]=`Bit64`,e[e.LengthDelimited=2]=`LengthDelimited`,e[e.StartGroup=3]=`StartGroup`,e[e.EndGroup=4]=`EndGroup`,e[e.Bit32=5]=`Bit32`})(e.WireType||={})})),B_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.varint32read=e.varint32write=e.int64toString=e.int64fromString=e.varint64write=e.varint64read=void 0;function varint64read(){let e=0,t=0;for(let n=0;n<28;n+=7){let r=this.buf[this.pos++];if(e|=(r&127)<>4,!(n&128))return this.assertBounds(),[e,t];for(let n=3;n<=31;n+=7){let r=this.buf[this.pos++];if(t|=(r&127)<>>r,a=!(!(i>>>7)&&t==0),o=(a?i|128:i)&255;if(n.push(o),!a)return}let r=e>>>28&15|(t&7)<<4,i=!!(t>>3);if(n.push((i?r|128:r)&255),i){for(let e=3;e<31;e+=7){let r=t>>>e,i=!!(r>>>7),a=(i?r|128:r)&255;if(n.push(a),!i)return}n.push(t>>>31&1)}}e.varint64write=varint64write;let t=4294967296;function int64fromString(e){let n=e[0]==`-`;n&&(e=e.slice(1));let r=1e6,i=0,a=0;function add1e6digit(n,o){let s=Number(e.slice(n,o));a*=r,i=i*r+s,i>=t&&(a+=i/t|0,i%=t)}return add1e6digit(-24,-18),add1e6digit(-18,-12),add1e6digit(-12,-6),add1e6digit(-6),[n,i,a]}e.int64fromString=int64fromString;function int64toString(e,n){if(n>>>0<=2097151)return``+(t*n+(e>>>0));let r=e&16777215,i=(e>>>24|n<<8)>>>0&16777215,a=n>>16&65535,o=r+i*6777216+a*6710656,s=i+a*8147497,c=a*2,l=1e7;o>=l&&(s+=Math.floor(o/l),o%=l),s>=l&&(c+=Math.floor(s/l),s%=l);function decimalFrom1e7(e,t){let n=e?String(e):``;return t?`0000000`.slice(n.length)+n:n}return decimalFrom1e7(c,0)+decimalFrom1e7(s,c)+decimalFrom1e7(o,1)}e.int64toString=int64toString;function varint32write(e,t){if(e>=0){for(;e>127;)t.push(e&127|128),e>>>=7;t.push(e)}else{for(let n=0;n<9;n++)t.push(e&127|128),e>>=7;t.push(1)}}e.varint32write=varint32write;function varint32read(){let e=this.buf[this.pos++],t=e&127;if(!(e&128)||(e=this.buf[this.pos++],t|=(e&127)<<7,!(e&128))||(e=this.buf[this.pos++],t|=(e&127)<<14,!(e&128))||(e=this.buf[this.pos++],t|=(e&127)<<21,!(e&128)))return this.assertBounds(),t;e=this.buf[this.pos++],t|=(e&15)<<28;for(let t=5;e&128&&t<10;t++)e=this.buf[this.pos++];if(e&128)throw Error(`invalid varint`);return this.assertBounds(),t>>>0}e.varint32read=varint32read})),V_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PbLong=e.PbULong=e.detectBi=void 0;let t=B_(),n;function detectBi(){let e=/* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8));n=globalThis.BigInt!==void 0&&typeof e.getBigInt64==`function`&&typeof e.getBigUint64==`function`&&typeof e.setBigInt64==`function`&&typeof e.setBigUint64==`function`?{MIN:BigInt(`-9223372036854775808`),MAX:BigInt(`9223372036854775807`),UMIN:BigInt(`0`),UMAX:BigInt(`18446744073709551615`),C:BigInt,V:e}:void 0}e.detectBi=detectBi,detectBi();function assertBi(e){if(!e)throw Error(`BigInt unavailable, see https://github.com/timostamm/protobuf-ts/blob/v1.0.8/MANUAL.md#bigint-support`)}let r=/^-?[0-9]+$/,i=4294967296,a=2147483648;var SharedPbLong=class{constructor(e,t){this.lo=e|0,this.hi=t|0}isZero(){return this.lo==0&&this.hi==0}toNumber(){let e=this.hi*i+(this.lo>>>0);if(!Number.isSafeInteger(e))throw Error(`cannot convert to safe number`);return e}},o=class PbULong extends SharedPbLong{static from(e){if(n)switch(typeof e){case`string`:if(e==`0`)return this.ZERO;if(e==``)throw Error(`string is no integer`);e=n.C(e);case`number`:if(e===0)return this.ZERO;e=n.C(e);case`bigint`:if(!e)return this.ZERO;if(en.UMAX)throw Error(`ulong too large`);return n.V.setBigUint64(0,e,!0),new PbULong(n.V.getInt32(0,!0),n.V.getInt32(4,!0))}else switch(typeof e){case`string`:if(e==`0`)return this.ZERO;if(e=e.trim(),!r.test(e))throw Error(`string is no integer`);let[n,a,o]=t.int64fromString(e);if(n)throw Error(`signed value for ulong`);return new PbULong(a,o);case`number`:if(e==0)return this.ZERO;if(!Number.isSafeInteger(e))throw Error(`number is no integer`);if(e<0)throw Error(`signed value for ulong`);return new PbULong(e,e/i)}throw Error(`unknown value `+typeof e)}toString(){return n?this.toBigInt().toString():t.int64toString(this.lo,this.hi)}toBigInt(){return assertBi(n),n.V.setInt32(0,this.lo,!0),n.V.setInt32(4,this.hi,!0),n.V.getBigUint64(0,!0)}};e.PbULong=o,o.ZERO=new o(0,0);var s=class PbLong extends SharedPbLong{static from(e){if(n)switch(typeof e){case`string`:if(e==`0`)return this.ZERO;if(e==``)throw Error(`string is no integer`);e=n.C(e);case`number`:if(e===0)return this.ZERO;e=n.C(e);case`bigint`:if(!e)return this.ZERO;if(en.MAX)throw Error(`signed long too large`);return n.V.setBigInt64(0,e,!0),new PbLong(n.V.getInt32(0,!0),n.V.getInt32(4,!0))}else switch(typeof e){case`string`:if(e==`0`)return this.ZERO;if(e=e.trim(),!r.test(e))throw Error(`string is no integer`);let[n,o,s]=t.int64fromString(e);if(n){if(s>a||s==a&&o!=0)throw Error(`signed long too small`)}else if(s>=a)throw Error(`signed long too large`);let c=new PbLong(o,s);return n?c.negate():c;case`number`:if(e==0)return this.ZERO;if(!Number.isSafeInteger(e))throw Error(`number is no integer`);return e>0?new PbLong(e,e/i):new PbLong(-e,-e/i).negate()}throw Error(`unknown value `+typeof e)}isNegative(){return!!(this.hi&a)}negate(){let e=~this.hi,t=this.lo;return t?t=~t+1:e+=1,new PbLong(t,e)}toString(){if(n)return this.toBigInt().toString();if(this.isNegative()){let e=this.negate();return`-`+t.int64toString(e.lo,e.hi)}return t.int64toString(this.lo,this.hi)}toBigInt(){return assertBi(n),n.V.setInt32(0,this.lo,!0),n.V.setInt32(4,this.hi,!0),n.V.getBigInt64(0,!0)}};e.PbLong=s,s.ZERO=new s(0,0)})),H_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BinaryReader=e.binaryReadOptions=void 0;let t=z_(),n=V_(),r=B_(),i={readUnknownField:!0,readerFactory:e=>new BinaryReader(e)};function binaryReadOptions(e){return e?Object.assign(Object.assign({},i),e):i}e.binaryReadOptions=binaryReadOptions;var BinaryReader=class{constructor(e,t){this.varint64=r.varint64read,this.uint32=r.varint32read,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=t??new TextDecoder(`utf-8`,{fatal:!0,ignoreBOM:!0})}tag(){let e=this.uint32(),t=e>>>3,n=e&7;if(t<=0||n<0||n>5)throw Error(`illegal tag: field no `+t+` wire type `+n);return[t,n]}skip(e){let n=this.pos;switch(e){case t.WireType.Varint:for(;this.buf[this.pos++]&128;);break;case t.WireType.Bit64:this.pos+=4;case t.WireType.Bit32:this.pos+=4;break;case t.WireType.LengthDelimited:let n=this.uint32();this.pos+=n;break;case t.WireType.StartGroup:let r;for(;(r=this.tag()[1])!==t.WireType.EndGroup;)this.skip(r);break;default:throw Error(`cant skip wire type `+e)}return this.assertBounds(),this.buf.subarray(n,this.pos)}assertBounds(){if(this.pos>this.len)throw RangeError(`premature EOF`)}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)}int64(){return new n.PbLong(...this.varint64())}uint64(){return new n.PbULong(...this.varint64())}sint64(){let[e,t]=this.varint64(),r=-(e&1);return e=(e>>>1|(t&1)<<31)^r,t=t>>>1^r,new n.PbLong(e,t)}bool(){let[e,t]=this.varint64();return e!==0||t!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return new n.PbULong(this.sfixed32(),this.sfixed32())}sfixed64(){return new n.PbLong(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),t=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(t,t+e)}string(){return this.textDecoder.decode(this.bytes())}};e.BinaryReader=BinaryReader})),U_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.assertFloat32=e.assertUInt32=e.assertInt32=e.assertNever=e.assert=void 0;function assert(e,t){if(!e)throw Error(t)}e.assert=assert;function assertNever(e,t){throw Error(t??`Unexpected object: `+e)}e.assertNever=assertNever;function assertInt32(e){if(typeof e!=`number`)throw Error(`invalid int 32: `+typeof e);if(!Number.isInteger(e)||e>2147483647||e<-2147483648)throw Error(`invalid int 32: `+e)}e.assertInt32=assertInt32;function assertUInt32(e){if(typeof e!=`number`)throw Error(`invalid uint 32: `+typeof e);if(!Number.isInteger(e)||e>4294967295||e<0)throw Error(`invalid uint 32: `+e)}e.assertUInt32=assertUInt32;function assertFloat32(e){if(typeof e!=`number`)throw Error(`invalid float 32: `+typeof e);if(Number.isFinite(e)&&(e>34028234663852886e22||e<-34028234663852886e22))throw Error(`invalid float 32: `+e)}e.assertFloat32=assertFloat32})),W_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BinaryWriter=e.binaryWriteOptions=void 0;let t=V_(),n=B_(),r=U_(),i={writeUnknownFields:!0,writerFactory:()=>new BinaryWriter};function binaryWriteOptions(e){return e?Object.assign(Object.assign({},i),e):i}e.binaryWriteOptions=binaryWriteOptions;var BinaryWriter=class{constructor(e){this.stack=[],this.textEncoder=e??new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let t=0;t>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(r.assertUInt32(e);e>127;)this.buf.push(e&127|128),e>>>=7;return this.buf.push(e),this}int32(e){return r.assertInt32(e),n.varint32write(e,this.buf),this}bool(e){return this.buf.push(+!!e),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let t=this.textEncoder.encode(e);return this.uint32(t.byteLength),this.raw(t)}float(e){r.assertFloat32(e);let t=/* @__PURE__ */ new Uint8Array(4);return new DataView(t.buffer).setFloat32(0,e,!0),this.raw(t)}double(e){let t=/* @__PURE__ */ new Uint8Array(8);return new DataView(t.buffer).setFloat64(0,e,!0),this.raw(t)}fixed32(e){r.assertUInt32(e);let t=/* @__PURE__ */ new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),this.raw(t)}sfixed32(e){r.assertInt32(e);let t=/* @__PURE__ */ new Uint8Array(4);return new DataView(t.buffer).setInt32(0,e,!0),this.raw(t)}sint32(e){return r.assertInt32(e),e=(e<<1^e>>31)>>>0,n.varint32write(e,this.buf),this}sfixed64(e){let n=/* @__PURE__ */ new Uint8Array(8),r=new DataView(n.buffer),i=t.PbLong.from(e);return r.setInt32(0,i.lo,!0),r.setInt32(4,i.hi,!0),this.raw(n)}fixed64(e){let n=/* @__PURE__ */ new Uint8Array(8),r=new DataView(n.buffer),i=t.PbULong.from(e);return r.setInt32(0,i.lo,!0),r.setInt32(4,i.hi,!0),this.raw(n)}int64(e){let r=t.PbLong.from(e);return n.varint64write(r.lo,r.hi,this.buf),this}sint64(e){let r=t.PbLong.from(e),i=r.hi>>31,a=r.lo<<1^i,o=(r.hi<<1|r.lo>>>31)^i;return n.varint64write(a,o,this.buf),this}uint64(e){let r=t.PbULong.from(e);return n.varint64write(r.lo,r.hi,this.buf),this}};e.BinaryWriter=BinaryWriter})),G_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.mergeJsonOptions=e.jsonWriteOptions=e.jsonReadOptions=void 0;let t={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0},n={ignoreUnknownFields:!1};function jsonReadOptions(e){return e?Object.assign(Object.assign({},n),e):n}e.jsonReadOptions=jsonReadOptions;function jsonWriteOptions(e){return e?Object.assign(Object.assign({},t),e):t}e.jsonWriteOptions=jsonWriteOptions;function mergeJsonOptions(e,t){let n=Object.assign(Object.assign({},e),t);return n.typeRegistry=[...e?.typeRegistry??[],...t?.typeRegistry??[]],n}e.mergeJsonOptions=mergeJsonOptions})),K_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MESSAGE_TYPE=void 0,e.MESSAGE_TYPE=Symbol.for(`protobuf-ts/message-type`)})),q_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.lowerCamelCase=void 0;function lowerCamelCase(e){let t=!1,n=[];for(let r=0;r{Object.defineProperty(e,"__esModule",{value:!0}),e.readMessageOption=e.readFieldOption=e.readFieldOptions=e.normalizeFieldInfo=e.RepeatType=e.LongType=e.ScalarType=void 0;let t=q_();(function(e){e[e.DOUBLE=1]=`DOUBLE`,e[e.FLOAT=2]=`FLOAT`,e[e.INT64=3]=`INT64`,e[e.UINT64=4]=`UINT64`,e[e.INT32=5]=`INT32`,e[e.FIXED64=6]=`FIXED64`,e[e.FIXED32=7]=`FIXED32`,e[e.BOOL=8]=`BOOL`,e[e.STRING=9]=`STRING`,e[e.BYTES=12]=`BYTES`,e[e.UINT32=13]=`UINT32`,e[e.SFIXED32=15]=`SFIXED32`,e[e.SFIXED64=16]=`SFIXED64`,e[e.SINT32=17]=`SINT32`,e[e.SINT64=18]=`SINT64`})(e.ScalarType||={}),(function(e){e[e.BIGINT=0]=`BIGINT`,e[e.STRING=1]=`STRING`,e[e.NUMBER=2]=`NUMBER`})(e.LongType||={});var n;(function(e){e[e.NO=0]=`NO`,e[e.PACKED=1]=`PACKED`,e[e.UNPACKED=2]=`UNPACKED`})(n=e.RepeatType||={});function normalizeFieldInfo(e){return e.localName=e.localName??t.lowerCamelCase(e.name),e.jsonName=e.jsonName??t.lowerCamelCase(e.name),e.repeat=e.repeat??n.NO,e.opt=e.opt??(!e.repeat&&!e.oneof&&e.kind==`message`),e}e.normalizeFieldInfo=normalizeFieldInfo;function readFieldOptions(e,t,n,r){let i=e.fields.find((e,n)=>e.localName==t||n==t)?.options;return i&&i[n]?r.fromJson(i[n]):void 0}e.readFieldOptions=readFieldOptions;function readFieldOption(e,t,n,r){let i=e.fields.find((e,n)=>e.localName==t||n==t)?.options;if(!i)return;let a=i[n];return a===void 0?a:r?r.fromJson(a):a}e.readFieldOption=readFieldOption;function readMessageOption(e,t,n){let r=e.options[t];return r===void 0?r:n?n.fromJson(r):r}e.readMessageOption=readMessageOption})),Y_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getSelectedOneofValue=e.clearOneofValue=e.setUnknownOneofValue=e.setOneofValue=e.getOneofValue=e.isOneofGroup=void 0;function isOneofGroup(e){if(typeof e!=`object`||!e||!e.hasOwnProperty(`oneofKind`))return!1;switch(typeof e.oneofKind){case`string`:return e[e.oneofKind]!==void 0&&Object.keys(e).length==2;case`undefined`:return Object.keys(e).length==1;default:return!1}}e.isOneofGroup=isOneofGroup;function getOneofValue(e,t){return e[t]}e.getOneofValue=getOneofValue;function setOneofValue(e,t,n){e.oneofKind!==void 0&&delete e[e.oneofKind],e.oneofKind=t,n!==void 0&&(e[t]=n)}e.setOneofValue=setOneofValue;function setUnknownOneofValue(e,t,n){e.oneofKind!==void 0&&delete e[e.oneofKind],e.oneofKind=t,n!==void 0&&t!==void 0&&(e[t]=n)}e.setUnknownOneofValue=setUnknownOneofValue;function clearOneofValue(e){e.oneofKind!==void 0&&delete e[e.oneofKind],e.oneofKind=void 0}e.clearOneofValue=clearOneofValue;function getSelectedOneofValue(e){if(e.oneofKind!==void 0)return e[e.oneofKind]}e.getSelectedOneofValue=getSelectedOneofValue})),X_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ReflectionTypeCheck=void 0;let t=J_(),n=Y_();e.ReflectionTypeCheck=class{constructor(e){this.fields=e.fields??[]}prepare(){if(this.data)return;let e=[],t=[],n=[];for(let r of this.fields)if(r.oneof)n.includes(r.oneof)||(n.push(r.oneof),e.push(r.oneof),t.push(r.oneof));else switch(t.push(r.localName),r.kind){case`scalar`:case`enum`:(!r.opt||r.repeat)&&e.push(r.localName);break;case`message`:r.repeat&&e.push(r.localName);break;case`map`:e.push(r.localName)}this.data={req:e,known:t,oneofs:Object.values(n)}}is(e,t,r=!1){if(t<0)return!0;if(typeof e!=`object`||!e)return!1;this.prepare();let i=Object.keys(e),a=this.data;if(i.length!i.includes(e))||!r&&i.some(e=>!a.known.includes(e)))return!1;if(t<1)return!0;for(let i of a.oneofs){let a=e[i];if(!n.isOneofGroup(a))return!1;if(a.oneofKind===void 0)continue;let o=this.fields.find(e=>e.localName===a.oneofKind);if(!o||!this.field(a[a.oneofKind],o,r,t))return!1}for(let n of this.fields)if(n.oneof===void 0&&!this.field(e[n.localName],n,r,t))return!1;return!0}field(e,n,r,i){let a=n.repeat;switch(n.kind){case`scalar`:return e===void 0?n.opt:a?this.scalars(e,n.T,i,n.L):this.scalar(e,n.T,n.L);case`enum`:return e===void 0?n.opt:a?this.scalars(e,t.ScalarType.INT32,i):this.scalar(e,t.ScalarType.INT32);case`message`:return e===void 0?!0:a?this.messages(e,n.T(),r,i):this.message(e,n.T(),r,i);case`map`:if(typeof e!=`object`||!e)return!1;if(i<2)return!0;if(!this.mapKeys(e,n.K,i))return!1;switch(n.V.kind){case`scalar`:return this.scalars(Object.values(e),n.V.T,i,n.V.L);case`enum`:return this.scalars(Object.values(e),t.ScalarType.INT32,i);case`message`:return this.messages(Object.values(e),n.V.T(),r,i)}}return!0}message(e,t,n,r){return n?t.isAssignable(e,r):t.is(e,r)}messages(e,t,n,r){if(!Array.isArray(e))return!1;if(r<2)return!0;if(n){for(let n=0;nparseInt(e)),n,r);case t.ScalarType.BOOL:return this.scalars(i.slice(0,r).map(e=>e==`true`||e!=`false`&&e),n,r);default:return this.scalars(i,n,r,t.LongType.STRING)}}}})),Z_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.reflectionLongConvert=void 0;let t=J_();function reflectionLongConvert(e,n){switch(n){case t.LongType.BIGINT:return e.toBigInt();case t.LongType.NUMBER:return e.toNumber();default:return e.toString()}}e.reflectionLongConvert=reflectionLongConvert})),Q_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ReflectionJsonReader=void 0;let t=I_(),n=L_(),r=J_(),i=V_(),a=U_(),o=Z_();e.ReflectionJsonReader=class{constructor(e){this.info=e}prepare(){if(this.fMap===void 0){this.fMap={};let e=this.info.fields??[];for(let t of e)this.fMap[t.name]=t,this.fMap[t.jsonName]=t,this.fMap[t.localName]=t}}assert(e,n,r){if(!e){let e=t.typeofJsonValue(r);throw(e==`number`||e==`boolean`)&&(e=r.toString()),Error(`Cannot parse JSON ${e} for ${this.info.typeName}#${n}`)}}read(e,n,i){this.prepare();let a=[];for(let[o,s]of Object.entries(e)){let e=this.fMap[o];if(!e){if(!i.ignoreUnknownFields)throw Error(`Found unknown field while reading ${this.info.typeName} from JSON format. JSON key: ${o}`);continue}let c=e.localName,l;if(e.oneof){if(s===null&&(e.kind!==`enum`||e.T()[0]!==`google.protobuf.NullValue`))continue;if(a.includes(e.oneof))throw Error(`Multiple members of the oneof group "${e.oneof}" of ${this.info.typeName} are present in JSON.`);a.push(e.oneof),l=n[e.oneof]={oneofKind:c}}else l=n;if(e.kind==`map`){if(s===null)continue;this.assert(t.isJsonObject(s),e.name,s);let n=l[c];for(let[t,a]of Object.entries(s)){this.assert(a!==null,e.name+` map value`,null);let o;switch(e.V.kind){case`message`:o=e.V.T().internalJsonRead(a,i);break;case`enum`:if(o=this.enum(e.V.T(),a,e.name,i.ignoreUnknownFields),o===!1)continue;break;case`scalar`:o=this.scalar(a,e.V.T,e.V.L,e.name)}this.assert(o!==void 0,e.name+` map value`,a);let s=t;e.K==r.ScalarType.BOOL&&(s=s==`true`||s!=`false`&&s),s=this.scalar(s,e.K,r.LongType.STRING,e.name).toString(),n[s]=o}}else if(e.repeat){if(s===null)continue;this.assert(Array.isArray(s),e.name,s);let t=l[c];for(let n of s){this.assert(n!==null,e.name,null);let r;switch(e.kind){case`message`:r=e.T().internalJsonRead(n,i);break;case`enum`:if(r=this.enum(e.T(),n,e.name,i.ignoreUnknownFields),r===!1)continue;break;case`scalar`:r=this.scalar(n,e.T,e.L,e.name)}this.assert(r!==void 0,e.name,s),t.push(r)}}else switch(e.kind){case`message`:if(s===null&&e.T().typeName!=`google.protobuf.Value`){this.assert(e.oneof===void 0,e.name+` (oneof member)`,null);continue}l[c]=e.T().internalJsonRead(s,i,l[c]);break;case`enum`:if(s===null)continue;let t=this.enum(e.T(),s,e.name,i.ignoreUnknownFields);if(t===!1)continue;l[c]=t;break;case`scalar`:if(s===null)continue;l[c]=this.scalar(s,e.T,e.L,e.name)}}}enum(e,t,n,r){if(e[0]==`google.protobuf.NullValue`&&a.assert(t===null||t===`NULL_VALUE`,`Unable to parse field ${this.info.typeName}#${n}, enum ${e[0]} only accepts null.`),t===null)return 0;switch(typeof t){case`number`:return a.assert(Number.isInteger(t),`Unable to parse field ${this.info.typeName}#${n}, enum can only be integral number, got ${t}.`),t;case`string`:let i=t;e[2]&&t.substring(0,e[2].length)===e[2]&&(i=t.substring(e[2].length));let o=e[1][i];return o===void 0&&r?!1:(a.assert(typeof o==`number`,`Unable to parse field ${this.info.typeName}#${n}, enum ${e[0]} has no value for "${t}".`),o)}a.assert(!1,`Unable to parse field ${this.info.typeName}#${n}, cannot parse enum value from ${typeof t}".`)}scalar(e,t,s,c){let l;try{switch(t){case r.ScalarType.DOUBLE:case r.ScalarType.FLOAT:if(e===null)return 0;if(e===`NaN`)return NaN;if(e===`Infinity`)return 1/0;if(e===`-Infinity`)return-1/0;if(e===``){l=`empty string`;break}if(typeof e==`string`&&e.trim().length!==e.length){l=`extra whitespace`;break}if(typeof e!=`string`&&typeof e!=`number`)break;let c=Number(e);if(Number.isNaN(c)){l=`not a number`;break}if(!Number.isFinite(c)){l=`too large or small`;break}return t==r.ScalarType.FLOAT&&a.assertFloat32(c),c;case r.ScalarType.INT32:case r.ScalarType.FIXED32:case r.ScalarType.SFIXED32:case r.ScalarType.SINT32:case r.ScalarType.UINT32:if(e===null)return 0;let u;if(typeof e==`number`?u=e:e===``?l=`empty string`:typeof e==`string`&&(e.trim().length===e.length?u=Number(e):l=`extra whitespace`),u===void 0)break;return t==r.ScalarType.UINT32?a.assertUInt32(u):a.assertInt32(u),u;case r.ScalarType.INT64:case r.ScalarType.SFIXED64:case r.ScalarType.SINT64:if(e===null)return o.reflectionLongConvert(i.PbLong.ZERO,s);if(typeof e!=`number`&&typeof e!=`string`)break;return o.reflectionLongConvert(i.PbLong.from(e),s);case r.ScalarType.FIXED64:case r.ScalarType.UINT64:if(e===null)return o.reflectionLongConvert(i.PbULong.ZERO,s);if(typeof e!=`number`&&typeof e!=`string`)break;return o.reflectionLongConvert(i.PbULong.from(e),s);case r.ScalarType.BOOL:if(e===null)return!1;if(typeof e!=`boolean`)break;return e;case r.ScalarType.STRING:if(e===null)return``;if(typeof e!=`string`){l=`extra whitespace`;break}return e;case r.ScalarType.BYTES:if(e===null||e===``)return/* @__PURE__ */ new Uint8Array;if(typeof e!=`string`)break;return n.base64decode(e)}}catch(e){l=e.message}this.assert(!1,c+(l?` - `+l:``),e)}}})),$_=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ReflectionJsonWriter=void 0;let t=L_(),n=V_(),r=J_(),i=U_();e.ReflectionJsonWriter=class{constructor(e){this.fields=e.fields??[]}write(e,t){let n={},r=e;for(let e of this.fields){if(!e.oneof){let i=this.field(e,r[e.localName],t);i!==void 0&&(n[t.useProtoFieldName?e.name:e.jsonName]=i);continue}let a=r[e.oneof];if(a.oneofKind!==e.localName)continue;let o=e.kind==`scalar`||e.kind==`enum`?Object.assign(Object.assign({},t),{emitDefaultValues:!0}):t,s=this.field(e,a[e.localName],o);i.assert(s!==void 0),n[t.useProtoFieldName?e.name:e.jsonName]=s}return n}field(e,t,n){let r;if(e.kind==`map`){i.assert(typeof t==`object`&&!!t);let a={};switch(e.V.kind){case`scalar`:for(let[n,r]of Object.entries(t)){let t=this.scalar(e.V.T,r,e.name,!1,!0);i.assert(t!==void 0),a[n.toString()]=t}break;case`message`:let r=e.V.T();for(let[o,s]of Object.entries(t)){let t=this.message(r,s,e.name,n);i.assert(t!==void 0),a[o.toString()]=t}break;case`enum`:let o=e.V.T();for(let[r,s]of Object.entries(t)){i.assert(s===void 0||typeof s==`number`);let t=this.enum(o,s,e.name,!1,!0,n.enumAsInteger);i.assert(t!==void 0),a[r.toString()]=t}}(n.emitDefaultValues||Object.keys(a).length>0)&&(r=a)}else if(e.repeat){i.assert(Array.isArray(t));let a=[];switch(e.kind){case`scalar`:for(let n=0;n0||n.emitDefaultValues)&&(r=a)}else switch(e.kind){case`scalar`:r=this.scalar(e.T,t,e.name,e.opt,n.emitDefaultValues);break;case`enum`:r=this.enum(e.T(),t,e.name,e.opt,n.emitDefaultValues,n.enumAsInteger);break;case`message`:r=this.message(e.T(),t,e.name,n)}return r}enum(e,t,n,r,a,o){if(e[0]==`google.protobuf.NullValue`)return!a&&!r?void 0:null;if(t===void 0){i.assert(r);return}if(t!==0||a||r)return i.assert(typeof t==`number`),i.assert(Number.isInteger(t)),o||!e[1].hasOwnProperty(t)?t:e[2]?e[2]+e[1][t]:e[1][t]}message(e,t,n,r){return t===void 0?r.emitDefaultValues?null:void 0:e.internalJsonWrite(t,r)}scalar(e,a,o,s,c){if(a===void 0){i.assert(s);return}let l=c||s;switch(e){case r.ScalarType.INT32:case r.ScalarType.SFIXED32:case r.ScalarType.SINT32:return a===0?l?0:void 0:(i.assertInt32(a),a);case r.ScalarType.FIXED32:case r.ScalarType.UINT32:return a===0?l?0:void 0:(i.assertUInt32(a),a);case r.ScalarType.FLOAT:i.assertFloat32(a);case r.ScalarType.DOUBLE:return a===0?l?0:void 0:(i.assert(typeof a==`number`),Number.isNaN(a)?`NaN`:a===1/0?`Infinity`:a===-1/0?`-Infinity`:a);case r.ScalarType.STRING:return a===``?l?``:void 0:(i.assert(typeof a==`string`),a);case r.ScalarType.BOOL:return a===!1?!l&&void 0:(i.assert(typeof a==`boolean`),a);case r.ScalarType.UINT64:case r.ScalarType.FIXED64:i.assert(typeof a==`number`||typeof a==`string`||typeof a==`bigint`);let e=n.PbULong.from(a);return e.isZero()&&!l?void 0:e.toString();case r.ScalarType.INT64:case r.ScalarType.SFIXED64:case r.ScalarType.SINT64:i.assert(typeof a==`number`||typeof a==`string`||typeof a==`bigint`);let o=n.PbLong.from(a);return o.isZero()&&!l?void 0:o.toString();case r.ScalarType.BYTES:return i.assert(a instanceof Uint8Array),a.byteLength?t.base64encode(a):l?``:void 0}}}})),ev=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.reflectionScalarDefault=void 0;let t=J_(),n=Z_(),r=V_();function reflectionScalarDefault(e,i=t.LongType.STRING){switch(e){case t.ScalarType.BOOL:return!1;case t.ScalarType.UINT64:case t.ScalarType.FIXED64:return n.reflectionLongConvert(r.PbULong.ZERO,i);case t.ScalarType.INT64:case t.ScalarType.SFIXED64:case t.ScalarType.SINT64:return n.reflectionLongConvert(r.PbLong.ZERO,i);case t.ScalarType.DOUBLE:case t.ScalarType.FLOAT:return 0;case t.ScalarType.BYTES:return/* @__PURE__ */ new Uint8Array;case t.ScalarType.STRING:return``;default:return 0}}e.reflectionScalarDefault=reflectionScalarDefault})),tv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ReflectionBinaryReader=void 0;let t=z_(),n=J_(),r=Z_(),i=ev();e.ReflectionBinaryReader=class{constructor(e){this.info=e}prepare(){if(!this.fieldNoToField){let e=this.info.fields??[];this.fieldNoToField=new Map(e.map(e=>[e.no,e]))}}read(e,r,i,a){this.prepare();let o=a===void 0?e.len:e.pos+a;for(;e.pos{Object.defineProperty(e,"__esModule",{value:!0}),e.ReflectionBinaryWriter=void 0;let t=z_(),n=J_(),r=U_(),i=V_();e.ReflectionBinaryWriter=class{constructor(e){this.info=e}prepare(){if(!this.fields){let e=this.info.fields?this.info.fields.concat():[];this.fields=e.sort((e,t)=>e.no-t.no)}}write(e,i,a){this.prepare();for(let t of this.fields){let o,s,c=t.repeat,l=t.localName;if(t.oneof){let n=e[t.oneof];if(n.oneofKind!==l)continue;o=n[l],s=!0}else o=e[l],s=!1;switch(t.kind){case`scalar`:case`enum`:let e=t.kind==`enum`?n.ScalarType.INT32:t.T;if(c){if(r.assert(Array.isArray(o)),c==n.RepeatType.PACKED)this.packed(i,e,t.no,o);else for(let n of o)this.scalar(i,e,t.no,n,!0)}else o===void 0?r.assert(t.opt):this.scalar(i,e,t.no,o,s||t.opt);break;case`message`:if(c){r.assert(Array.isArray(o));for(let e of o)this.message(i,a,t.T(),t.no,e)}else this.message(i,a,t.T(),t.no,o);break;case`map`:r.assert(typeof o==`object`&&!!o);for(let[e,n]of Object.entries(o))this.mapEntry(i,a,t,e,n)}}let o=a.writeUnknownFields;o!==!1&&(o===!0?t.UnknownFieldHandler.onWrite:o)(this.info.typeName,e,i)}mapEntry(e,i,a,o,s){e.tag(a.no,t.WireType.LengthDelimited),e.fork();let c=o;switch(a.K){case n.ScalarType.INT32:case n.ScalarType.FIXED32:case n.ScalarType.UINT32:case n.ScalarType.SFIXED32:case n.ScalarType.SINT32:c=Number.parseInt(o);break;case n.ScalarType.BOOL:r.assert(o==`true`||o==`false`),c=o==`true`}switch(this.scalar(e,a.K,1,c,!0),a.V.kind){case`scalar`:this.scalar(e,a.V.T,2,s,!0);break;case`enum`:this.scalar(e,n.ScalarType.INT32,2,s,!0);break;case`message`:this.message(e,i,a.V.T(),2,s)}e.join()}message(e,n,r,i,a){a!==void 0&&(r.internalBinaryWrite(a,e.tag(i,t.WireType.LengthDelimited).fork(),n),e.join())}scalar(e,t,n,r,i){let[a,o,s]=this.scalarInfo(t,r);(!s||i)&&(e.tag(n,a),e[o](r))}packed(e,i,a,o){if(!o.length)return;r.assert(i!==n.ScalarType.BYTES&&i!==n.ScalarType.STRING),e.tag(a,t.WireType.LengthDelimited),e.fork();let[,s]=this.scalarInfo(i);for(let t=0;t{Object.defineProperty(e,"__esModule",{value:!0}),e.reflectionCreate=void 0;let t=ev(),n=K_();function reflectionCreate(e){let r=e.messagePrototype?Object.create(e.messagePrototype):Object.defineProperty({},n.MESSAGE_TYPE,{value:e});for(let n of e.fields){let e=n.localName;if(!n.opt){if(n.oneof)r[n.oneof]={oneofKind:void 0};else if(n.repeat)r[e]=[];else switch(n.kind){case`scalar`:r[e]=t.reflectionScalarDefault(n.T,n.L);break;case`enum`:r[e]=0;break;case`map`:r[e]={}}}}return r}e.reflectionCreate=reflectionCreate})),iv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.reflectionMergePartial=void 0;function reflectionMergePartial(e,t,n){let r,i=n,a;for(let n of e.fields){let e=n.localName;if(n.oneof){let o=i[n.oneof];if(o?.oneofKind==null)continue;if(r=o[e],a=t[n.oneof],a.oneofKind=o.oneofKind,r==null){delete a[e];continue}}else if(r=i[e],a=t,r==null)continue;switch(n.repeat&&(a[e].length=r.length),n.kind){case`scalar`:case`enum`:if(n.repeat)for(let t=0;t{Object.defineProperty(e,"__esModule",{value:!0}),e.reflectionEquals=void 0;let t=J_();function reflectionEquals(e,r,i){if(r===i)return!0;if(!r||!i)return!1;for(let a of e.fields){let e=a.localName,o=a.oneof?r[a.oneof][e]:r[e],s=a.oneof?i[a.oneof][e]:i[e];switch(a.kind){case`enum`:case`scalar`:let e=a.kind==`enum`?t.ScalarType.INT32:a.T;if(!(a.repeat?repeatedPrimitiveEq(e,o,s):primitiveEq(e,o,s)))return!1;break;case`map`:if(!(a.V.kind==`message`?repeatedMsgEq(a.V.T(),n(o),n(s)):repeatedPrimitiveEq(a.V.kind==`enum`?t.ScalarType.INT32:a.V.T,n(o),n(s))))return!1;break;case`message`:let r=a.T();if(!(a.repeat?repeatedMsgEq(r,o,s):r.equals(o,s)))return!1}}return!0}e.reflectionEquals=reflectionEquals;let n=Object.values;function primitiveEq(e,n,r){if(n===r)return!0;if(e!==t.ScalarType.BYTES)return!1;let i=n,a=r;if(i.length!==a.length)return!1;for(let e=0;e{Object.defineProperty(e,"__esModule",{value:!0}),e.MessageType=void 0;let t=K_(),n=J_(),r=X_(),i=Q_(),a=$_(),o=tv(),s=nv(),c=rv(),l=iv(),u=I_(),d=G_(),f=av(),p=W_(),m=H_(),h=Object.getOwnPropertyDescriptors(Object.getPrototypeOf({})),g=h[t.MESSAGE_TYPE]={};e.MessageType=class{constructor(e,t,c){this.defaultCheckDepth=16,this.typeName=e,this.fields=t.map(n.normalizeFieldInfo),this.options=c??{},g.value=this,this.messagePrototype=Object.create(null,h),this.refTypeCheck=new r.ReflectionTypeCheck(this),this.refJsonReader=new i.ReflectionJsonReader(this),this.refJsonWriter=new a.ReflectionJsonWriter(this),this.refBinReader=new o.ReflectionBinaryReader(this),this.refBinWriter=new s.ReflectionBinaryWriter(this)}create(e){let t=c.reflectionCreate(this);return e!==void 0&&l.reflectionMergePartial(this,t,e),t}clone(e){let t=this.create();return l.reflectionMergePartial(this,t,e),t}equals(e,t){return f.reflectionEquals(this,e,t)}is(e,t=this.defaultCheckDepth){return this.refTypeCheck.is(e,t,!1)}isAssignable(e,t=this.defaultCheckDepth){return this.refTypeCheck.is(e,t,!0)}mergePartial(e,t){l.reflectionMergePartial(this,e,t)}fromBinary(e,t){let n=m.binaryReadOptions(t);return this.internalBinaryRead(n.readerFactory(e),e.byteLength,n)}fromJson(e,t){return this.internalJsonRead(e,d.jsonReadOptions(t))}fromJsonString(e,t){let n=JSON.parse(e);return this.fromJson(n,t)}toJson(e,t){return this.internalJsonWrite(e,d.jsonWriteOptions(t))}toJsonString(e,t){let n=this.toJson(e,t);return JSON.stringify(n,null,t?.prettySpaces??0)}toBinary(e,t){let n=p.binaryWriteOptions(t);return this.internalBinaryWrite(e,n.writerFactory(),n).finish()}internalJsonRead(e,t,n){if(typeof e==`object`&&e&&!Array.isArray(e)){let r=n??this.create();return this.refJsonReader.read(e,r,t),r}throw Error(`Unable to parse message ${this.typeName} from JSON ${u.typeofJsonValue(e)}.`)}internalJsonWrite(e,t){return this.refJsonWriter.write(e,t)}internalBinaryWrite(e,t,n){return this.refBinWriter.write(e,t,n),t}internalBinaryRead(e,t,n,r){let i=r??this.create();return this.refBinReader.read(e,i,n,t),i}}})),sv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.containsMessageType=void 0;let t=K_();function containsMessageType(e){return e[t.MESSAGE_TYPE]!=null}e.containsMessageType=containsMessageType})),cv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.listEnumNumbers=e.listEnumNames=e.listEnumValues=e.isEnumObject=void 0;function isEnumObject(e){if(typeof e!=`object`||!e||!e.hasOwnProperty(0))return!1;for(let t of Object.keys(e)){let n=parseInt(t);if(Number.isNaN(n)){let n=e[t];if(n===void 0||typeof n!=`number`||e[n]===void 0)return!1}else{let t=e[n];if(t===void 0||e[t]!==n)return!1}}return!0}e.isEnumObject=isEnumObject;function listEnumValues(e){if(!isEnumObject(e))throw Error(`not a typescript enum object`);let t=[];for(let[n,r]of Object.entries(e))typeof r==`number`&&t.push({name:n,number:r});return t}e.listEnumValues=listEnumValues;function listEnumNames(e){return listEnumValues(e).map(e=>e.name)}e.listEnumNames=listEnumNames;function listEnumNumbers(e){return listEnumValues(e).map(e=>e.number).filter((e,t,n)=>n.indexOf(e)==t)}e.listEnumNumbers=listEnumNumbers})),lv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=I_();Object.defineProperty(e,"typeofJsonValue",{enumerable:!0,get:function(){return t.typeofJsonValue}}),Object.defineProperty(e,"isJsonObject",{enumerable:!0,get:function(){return t.isJsonObject}});var n=L_();Object.defineProperty(e,"base64decode",{enumerable:!0,get:function(){return n.base64decode}}),Object.defineProperty(e,"base64encode",{enumerable:!0,get:function(){return n.base64encode}});var r=R_();Object.defineProperty(e,"utf8read",{enumerable:!0,get:function(){return r.utf8read}});var i=z_();Object.defineProperty(e,"WireType",{enumerable:!0,get:function(){return i.WireType}}),Object.defineProperty(e,"mergeBinaryOptions",{enumerable:!0,get:function(){return i.mergeBinaryOptions}}),Object.defineProperty(e,"UnknownFieldHandler",{enumerable:!0,get:function(){return i.UnknownFieldHandler}});var a=H_();Object.defineProperty(e,"BinaryReader",{enumerable:!0,get:function(){return a.BinaryReader}}),Object.defineProperty(e,"binaryReadOptions",{enumerable:!0,get:function(){return a.binaryReadOptions}});var o=W_();Object.defineProperty(e,"BinaryWriter",{enumerable:!0,get:function(){return o.BinaryWriter}}),Object.defineProperty(e,"binaryWriteOptions",{enumerable:!0,get:function(){return o.binaryWriteOptions}});var s=V_();Object.defineProperty(e,"PbLong",{enumerable:!0,get:function(){return s.PbLong}}),Object.defineProperty(e,"PbULong",{enumerable:!0,get:function(){return s.PbULong}});var c=G_();Object.defineProperty(e,"jsonReadOptions",{enumerable:!0,get:function(){return c.jsonReadOptions}}),Object.defineProperty(e,"jsonWriteOptions",{enumerable:!0,get:function(){return c.jsonWriteOptions}}),Object.defineProperty(e,"mergeJsonOptions",{enumerable:!0,get:function(){return c.mergeJsonOptions}});var l=K_();Object.defineProperty(e,"MESSAGE_TYPE",{enumerable:!0,get:function(){return l.MESSAGE_TYPE}});var u=ov();Object.defineProperty(e,"MessageType",{enumerable:!0,get:function(){return u.MessageType}});var d=J_();Object.defineProperty(e,"ScalarType",{enumerable:!0,get:function(){return d.ScalarType}}),Object.defineProperty(e,"LongType",{enumerable:!0,get:function(){return d.LongType}}),Object.defineProperty(e,"RepeatType",{enumerable:!0,get:function(){return d.RepeatType}}),Object.defineProperty(e,"normalizeFieldInfo",{enumerable:!0,get:function(){return d.normalizeFieldInfo}}),Object.defineProperty(e,"readFieldOptions",{enumerable:!0,get:function(){return d.readFieldOptions}}),Object.defineProperty(e,"readFieldOption",{enumerable:!0,get:function(){return d.readFieldOption}}),Object.defineProperty(e,"readMessageOption",{enumerable:!0,get:function(){return d.readMessageOption}});var f=X_();Object.defineProperty(e,"ReflectionTypeCheck",{enumerable:!0,get:function(){return f.ReflectionTypeCheck}});var p=rv();Object.defineProperty(e,"reflectionCreate",{enumerable:!0,get:function(){return p.reflectionCreate}});var m=ev();Object.defineProperty(e,"reflectionScalarDefault",{enumerable:!0,get:function(){return m.reflectionScalarDefault}});var h=iv();Object.defineProperty(e,"reflectionMergePartial",{enumerable:!0,get:function(){return h.reflectionMergePartial}});var g=av();Object.defineProperty(e,"reflectionEquals",{enumerable:!0,get:function(){return g.reflectionEquals}});var v=tv();Object.defineProperty(e,"ReflectionBinaryReader",{enumerable:!0,get:function(){return v.ReflectionBinaryReader}});var y=nv();Object.defineProperty(e,"ReflectionBinaryWriter",{enumerable:!0,get:function(){return y.ReflectionBinaryWriter}});var b=Q_();Object.defineProperty(e,"ReflectionJsonReader",{enumerable:!0,get:function(){return b.ReflectionJsonReader}});var x=$_();Object.defineProperty(e,"ReflectionJsonWriter",{enumerable:!0,get:function(){return x.ReflectionJsonWriter}});var S=sv();Object.defineProperty(e,"containsMessageType",{enumerable:!0,get:function(){return S.containsMessageType}});var C=Y_();Object.defineProperty(e,"isOneofGroup",{enumerable:!0,get:function(){return C.isOneofGroup}}),Object.defineProperty(e,"setOneofValue",{enumerable:!0,get:function(){return C.setOneofValue}}),Object.defineProperty(e,"getOneofValue",{enumerable:!0,get:function(){return C.getOneofValue}}),Object.defineProperty(e,"clearOneofValue",{enumerable:!0,get:function(){return C.clearOneofValue}}),Object.defineProperty(e,"getSelectedOneofValue",{enumerable:!0,get:function(){return C.getSelectedOneofValue}});var w=cv();Object.defineProperty(e,"listEnumValues",{enumerable:!0,get:function(){return w.listEnumValues}}),Object.defineProperty(e,"listEnumNames",{enumerable:!0,get:function(){return w.listEnumNames}}),Object.defineProperty(e,"listEnumNumbers",{enumerable:!0,get:function(){return w.listEnumNumbers}}),Object.defineProperty(e,"isEnumObject",{enumerable:!0,get:function(){return w.isEnumObject}});var T=q_();Object.defineProperty(e,"lowerCamelCase",{enumerable:!0,get:function(){return T.lowerCamelCase}});var E=U_();Object.defineProperty(e,"assert",{enumerable:!0,get:function(){return E.assert}}),Object.defineProperty(e,"assertNever",{enumerable:!0,get:function(){return E.assertNever}}),Object.defineProperty(e,"assertInt32",{enumerable:!0,get:function(){return E.assertInt32}}),Object.defineProperty(e,"assertUInt32",{enumerable:!0,get:function(){return E.assertUInt32}}),Object.defineProperty(e,"assertFloat32",{enumerable:!0,get:function(){return E.assertFloat32}})})),uv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.readServiceOption=e.readMethodOption=e.readMethodOptions=e.normalizeMethodInfo=void 0;let t=lv();function normalizeMethodInfo(e,n){let r=e;return r.service=n,r.localName=r.localName??t.lowerCamelCase(r.name),r.serverStreaming=!!r.serverStreaming,r.clientStreaming=!!r.clientStreaming,r.options=r.options??{},r.idempotency=r.idempotency??void 0,r}e.normalizeMethodInfo=normalizeMethodInfo;function readMethodOptions(e,t,n,r){let i=e.methods.find((e,n)=>e.localName===t||n===t)?.options;return i&&i[n]?r.fromJson(i[n]):void 0}e.readMethodOptions=readMethodOptions;function readMethodOption(e,t,n,r){let i=e.methods.find((e,n)=>e.localName===t||n===t)?.options;if(!i)return;let a=i[n];return a===void 0?a:r?r.fromJson(a):a}e.readMethodOption=readMethodOption;function readServiceOption(e,t,n){let r=e.options;if(!r)return;let i=r[t];return i===void 0?i:n?n.fromJson(i):i}e.readServiceOption=readServiceOption})),dv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ServiceType=void 0;let t=uv();e.ServiceType=class{constructor(e,n,r){this.typeName=e,this.methods=n.map(e=>t.normalizeMethodInfo(e,this)),this.options=r??{}}}})),fv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.RpcError=void 0,e.RpcError=class extends Error{constructor(e,t=`UNKNOWN`,n){super(e),this.name=`RpcError`,Object.setPrototypeOf(this,new.target.prototype),this.code=t,this.meta=n??{}}toString(){let e=[this.name+`: `+this.message];this.code&&(e.push(``),e.push(`Code: `+this.code)),this.serviceName&&this.methodName&&e.push(`Method: `+this.serviceName+`/`+this.methodName);let t=Object.entries(this.meta);if(t.length){e.push(``),e.push(`Meta:`);for(let[n,r]of t)e.push(` ${n}: ${r}`)}return e.join(` `)}}})),pv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.mergeRpcOptions=void 0;let t=lv();function mergeRpcOptions(e,n){if(!n)return e;let r={};copy(e,r),copy(n,r);for(let i of Object.keys(n)){let a=n[i];switch(i){case`jsonOptions`:r.jsonOptions=t.mergeJsonOptions(e.jsonOptions,r.jsonOptions);break;case`binaryOptions`:r.binaryOptions=t.mergeBinaryOptions(e.binaryOptions,r.binaryOptions);break;case`meta`:r.meta={},copy(e.meta,r.meta),copy(n.meta,r.meta);break;case`interceptors`:r.interceptors=e.interceptors?e.interceptors.concat(a):a.concat()}}return r}e.mergeRpcOptions=mergeRpcOptions;function copy(e,t){if(!e)return;let n=t;for(let[t,r]of Object.entries(e))n[t]=r instanceof Date?new Date(r.getTime()):Array.isArray(r)?r.concat():r}})),mv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Deferred=e.DeferredState=void 0;var t;(function(e){e[e.PENDING=0]=`PENDING`,e[e.REJECTED=1]=`REJECTED`,e[e.RESOLVED=2]=`RESOLVED`})(t=e.DeferredState||={}),e.Deferred=class{constructor(e=!0){this._state=t.PENDING,this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t}),e&&this._promise.catch(e=>{})}get state(){return this._state}get promise(){return this._promise}resolve(e){if(this.state!==t.PENDING)throw Error(`cannot resolve ${t[this.state].toLowerCase()}`);this._resolve(e),this._state=t.RESOLVED}reject(e){if(this.state!==t.PENDING)throw Error(`cannot reject ${t[this.state].toLowerCase()}`);this._reject(e),this._state=t.REJECTED}resolvePending(e){this._state===t.PENDING&&this.resolve(e)}rejectPending(e){this._state===t.PENDING&&this.reject(e)}}})),hv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.RpcOutputStreamController=void 0;let t=mv(),n=lv();e.RpcOutputStreamController=class{constructor(){this._lis={nxt:[],msg:[],err:[],cmp:[]},this._closed=!1,this._itState={q:[]}}onNext(e){return this.addLis(e,this._lis.nxt)}onMessage(e){return this.addLis(e,this._lis.msg)}onError(e){return this.addLis(e,this._lis.err)}onComplete(e){return this.addLis(e,this._lis.cmp)}addLis(e,t){return t.push(e),()=>{let n=t.indexOf(e);n>=0&&t.splice(n,1)}}clearLis(){for(let e of Object.values(this._lis))e.splice(0,e.length)}get closed(){return this._closed!==!1}notifyNext(e,t,r){n.assert(+!!e+ +!!t+ +!!r<=1,`only one emission at a time`),e&&this.notifyMessage(e),t&&this.notifyError(t),r&&this.notifyComplete()}notifyMessage(e){n.assert(!this.closed,`stream is closed`),this.pushIt({value:e,done:!1}),this._lis.msg.forEach(t=>t(e)),this._lis.nxt.forEach(t=>t(e,void 0,!1))}notifyError(e){n.assert(!this.closed,`stream is closed`),this._closed=e,this.pushIt(e),this._lis.err.forEach(t=>t(e)),this._lis.nxt.forEach(t=>t(void 0,e,!1)),this.clearLis()}notifyComplete(){n.assert(!this.closed,`stream is closed`),this._closed=!0,this.pushIt({value:null,done:!0}),this._lis.cmp.forEach(e=>e()),this._lis.nxt.forEach(e=>e(void 0,void 0,!0)),this.clearLis()}[Symbol.asyncIterator](){return this._closed===!0?this.pushIt({value:null,done:!0}):this._closed!==!1&&this.pushIt(this._closed),{next:()=>{let e=this._itState;n.assert(e,`bad state`),n.assert(!e.p,`iterator contract broken`);let r=e.q.shift();return r?`value`in r?Promise.resolve(r):Promise.reject(r):(e.p=new t.Deferred,e.p.promise)}}}pushIt(e){let r=this._itState;if(r.p){let i=r.p;n.assert(i.state==t.DeferredState.PENDING,`iterator contract broken`),`value`in e?i.resolve(e):i.reject(e),delete r.p}else r.q.push(e)}}})),gv=/* @__PURE__ */ __commonJSMin((e=>{var t=e&&e.__awaiter||function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.UnaryCall=void 0,e.UnaryCall=class{constructor(e,t,n,r,i,a,o){this.method=e,this.requestHeaders=t,this.request=n,this.headers=r,this.response=i,this.status=a,this.trailers=o}then(e,t){return this.promiseFinished().then(t=>e?Promise.resolve(e(t)):t,e=>t?Promise.resolve(t(e)):Promise.reject(e))}promiseFinished(){return t(this,void 0,void 0,function*(){let[e,t,n,r]=yield Promise.all([this.headers,this.response,this.status,this.trailers]);return{method:this.method,requestHeaders:this.requestHeaders,request:this.request,headers:e,response:t,status:n,trailers:r}})}}})),_v=/* @__PURE__ */ __commonJSMin((e=>{var t=e&&e.__awaiter||function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.ServerStreamingCall=void 0,e.ServerStreamingCall=class{constructor(e,t,n,r,i,a,o){this.method=e,this.requestHeaders=t,this.request=n,this.headers=r,this.responses=i,this.status=a,this.trailers=o}then(e,t){return this.promiseFinished().then(t=>e?Promise.resolve(e(t)):t,e=>t?Promise.resolve(t(e)):Promise.reject(e))}promiseFinished(){return t(this,void 0,void 0,function*(){let[e,t,n]=yield Promise.all([this.headers,this.status,this.trailers]);return{method:this.method,requestHeaders:this.requestHeaders,request:this.request,headers:e,status:t,trailers:n}})}}})),vv=/* @__PURE__ */ __commonJSMin((e=>{var t=e&&e.__awaiter||function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.ClientStreamingCall=void 0,e.ClientStreamingCall=class{constructor(e,t,n,r,i,a,o){this.method=e,this.requestHeaders=t,this.requests=n,this.headers=r,this.response=i,this.status=a,this.trailers=o}then(e,t){return this.promiseFinished().then(t=>e?Promise.resolve(e(t)):t,e=>t?Promise.resolve(t(e)):Promise.reject(e))}promiseFinished(){return t(this,void 0,void 0,function*(){let[e,t,n,r]=yield Promise.all([this.headers,this.response,this.status,this.trailers]);return{method:this.method,requestHeaders:this.requestHeaders,headers:e,response:t,status:n,trailers:r}})}}})),yv=/* @__PURE__ */ __commonJSMin((e=>{var t=e&&e.__awaiter||function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.DuplexStreamingCall=void 0,e.DuplexStreamingCall=class{constructor(e,t,n,r,i,a,o){this.method=e,this.requestHeaders=t,this.requests=n,this.headers=r,this.responses=i,this.status=a,this.trailers=o}then(e,t){return this.promiseFinished().then(t=>e?Promise.resolve(e(t)):t,e=>t?Promise.resolve(t(e)):Promise.reject(e))}promiseFinished(){return t(this,void 0,void 0,function*(){let[e,t,n]=yield Promise.all([this.headers,this.status,this.trailers]);return{method:this.method,requestHeaders:this.requestHeaders,headers:e,status:t,trailers:n}})}}})),bv=/* @__PURE__ */ __commonJSMin((e=>{var t=e&&e.__awaiter||function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.TestTransport=void 0;let n=fv(),r=lv(),i=hv(),a=pv(),o=gv(),s=_v(),c=vv(),l=yv();var u=class TestTransport{constructor(e){this.suppressUncaughtRejections=!0,this.headerDelay=10,this.responseDelay=50,this.betweenResponseDelay=10,this.afterResponseDelay=10,this.data=e??{}}get sentMessages(){return this.lastInput instanceof TestInputStream?this.lastInput.sent:typeof this.lastInput==`object`?[this.lastInput.single]:[]}get sendComplete(){return this.lastInput instanceof TestInputStream?this.lastInput.completed:typeof this.lastInput==`object`}promiseHeaders(){let e=this.data.headers??TestTransport.defaultHeaders;return e instanceof n.RpcError?Promise.reject(e):Promise.resolve(e)}promiseSingleResponse(e){if(this.data.response instanceof n.RpcError)return Promise.reject(this.data.response);let t;return Array.isArray(this.data.response)?(r.assert(this.data.response.length>0),t=this.data.response[0]):t=this.data.response===void 0?e.O.create():this.data.response,r.assert(e.O.is(t)),Promise.resolve(t)}streamResponses(e,i,a){return t(this,void 0,void 0,function*(){let t=[];if(this.data.response===void 0)t.push(e.O.create());else if(Array.isArray(this.data.response))for(let n of this.data.response)r.assert(e.O.is(n)),t.push(n);else this.data.response instanceof n.RpcError||(r.assert(e.O.is(this.data.response)),t.push(this.data.response));try{yield delay(this.responseDelay,a)(void 0)}catch(e){i.notifyError(e);return}if(this.data.response instanceof n.RpcError){i.notifyError(this.data.response);return}for(let e of t){i.notifyMessage(e);try{yield delay(this.betweenResponseDelay,a)(void 0)}catch(e){i.notifyError(e);return}}if(this.data.status instanceof n.RpcError){i.notifyError(this.data.status);return}if(this.data.trailers instanceof n.RpcError){i.notifyError(this.data.trailers);return}i.notifyComplete()})}promiseStatus(){let e=this.data.status??TestTransport.defaultStatus;return e instanceof n.RpcError?Promise.reject(e):Promise.resolve(e)}promiseTrailers(){let e=this.data.trailers??TestTransport.defaultTrailers;return e instanceof n.RpcError?Promise.reject(e):Promise.resolve(e)}maybeSuppressUncaught(...e){if(this.suppressUncaughtRejections)for(let t of e)t.catch(()=>{})}mergeOptions(e){return a.mergeRpcOptions({},e)}unary(e,t,n){let r=n.meta??{},i=this.promiseHeaders().then(delay(this.headerDelay,n.abort)),a=i.catch(e=>{}).then(delay(this.responseDelay,n.abort)).then(t=>this.promiseSingleResponse(e)),s=a.catch(e=>{}).then(delay(this.afterResponseDelay,n.abort)).then(e=>this.promiseStatus()),c=a.catch(e=>{}).then(delay(this.afterResponseDelay,n.abort)).then(e=>this.promiseTrailers());return this.maybeSuppressUncaught(s,c),this.lastInput={single:t},new o.UnaryCall(e,r,t,i,a,s,c)}serverStreaming(e,t,n){let r=n.meta??{},a=this.promiseHeaders().then(delay(this.headerDelay,n.abort)),o=new i.RpcOutputStreamController,c=a.then(delay(this.responseDelay,n.abort)).catch(()=>{}).then(()=>this.streamResponses(e,o,n.abort)).then(delay(this.afterResponseDelay,n.abort)),l=c.then(()=>this.promiseStatus()),u=c.then(()=>this.promiseTrailers());return this.maybeSuppressUncaught(l,u),this.lastInput={single:t},new s.ServerStreamingCall(e,r,t,a,o,l,u)}clientStreaming(e,t){let n=t.meta??{},r=this.promiseHeaders().then(delay(this.headerDelay,t.abort)),i=r.catch(e=>{}).then(delay(this.responseDelay,t.abort)).then(t=>this.promiseSingleResponse(e)),a=i.catch(e=>{}).then(delay(this.afterResponseDelay,t.abort)).then(e=>this.promiseStatus()),o=i.catch(e=>{}).then(delay(this.afterResponseDelay,t.abort)).then(e=>this.promiseTrailers());return this.maybeSuppressUncaught(a,o),this.lastInput=new TestInputStream(this.data,t.abort),new c.ClientStreamingCall(e,n,this.lastInput,r,i,a,o)}duplex(e,t){let n=t.meta??{},r=this.promiseHeaders().then(delay(this.headerDelay,t.abort)),a=new i.RpcOutputStreamController,o=r.then(delay(this.responseDelay,t.abort)).catch(()=>{}).then(()=>this.streamResponses(e,a,t.abort)).then(delay(this.afterResponseDelay,t.abort)),s=o.then(()=>this.promiseStatus()),c=o.then(()=>this.promiseTrailers());return this.maybeSuppressUncaught(s,c),this.lastInput=new TestInputStream(this.data,t.abort),new l.DuplexStreamingCall(e,n,this.lastInput,r,a,s,c)}};e.TestTransport=u,u.defaultHeaders={responseHeader:`test`},u.defaultStatus={code:`OK`,detail:`all good`},u.defaultTrailers={responseTrailer:`test`};function delay(e,t){return r=>new Promise((i,a)=>{if(t?.aborted)a(new n.RpcError(`user cancel`,`CANCELLED`));else{let o=setTimeout(()=>i(r),e);t&&t.addEventListener(`abort`,e=>{clearTimeout(o),a(new n.RpcError(`user cancel`,`CANCELLED`))})}})}var TestInputStream=class{constructor(e,t){this._completed=!1,this._sent=[],this.data=e,this.abort=t}get sent(){return this._sent}get completed(){return this._completed}send(e){if(this.data.inputMessage instanceof n.RpcError)return Promise.reject(this.data.inputMessage);let t=this.data.inputMessage===void 0?10:this.data.inputMessage;return Promise.resolve(void 0).then(()=>{this._sent.push(e)}).then(delay(t,this.abort))}complete(){if(this.data.inputComplete instanceof n.RpcError)return Promise.reject(this.data.inputComplete);let e=this.data.inputComplete===void 0?10:this.data.inputComplete;return Promise.resolve(void 0).then(()=>{this._completed=!0}).then(delay(e,this.abort))}}})),xv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.stackDuplexStreamingInterceptors=e.stackClientStreamingInterceptors=e.stackServerStreamingInterceptors=e.stackUnaryInterceptors=e.stackIntercept=void 0;let t=lv();function stackIntercept(e,n,r,i,a){if(e==`unary`){let tail=(e,t,r)=>n.unary(e,t,r);for(let e of(i.interceptors??[]).filter(e=>e.interceptUnary).reverse()){let t=tail;tail=(n,r,i)=>e.interceptUnary(t,n,r,i)}return tail(r,a,i)}if(e==`serverStreaming`){let tail=(e,t,r)=>n.serverStreaming(e,t,r);for(let e of(i.interceptors??[]).filter(e=>e.interceptServerStreaming).reverse()){let t=tail;tail=(n,r,i)=>e.interceptServerStreaming(t,n,r,i)}return tail(r,a,i)}if(e==`clientStreaming`){let tail=(e,t)=>n.clientStreaming(e,t);for(let e of(i.interceptors??[]).filter(e=>e.interceptClientStreaming).reverse()){let t=tail;tail=(n,r)=>e.interceptClientStreaming(t,n,r)}return tail(r,i)}if(e==`duplex`){let tail=(e,t)=>n.duplex(e,t);for(let e of(i.interceptors??[]).filter(e=>e.interceptDuplex).reverse()){let t=tail;tail=(n,r)=>e.interceptDuplex(t,n,r)}return tail(r,i)}t.assertNever(e)}e.stackIntercept=stackIntercept;function stackUnaryInterceptors(e,t,n,r){return stackIntercept(`unary`,e,t,r,n)}e.stackUnaryInterceptors=stackUnaryInterceptors;function stackServerStreamingInterceptors(e,t,n,r){return stackIntercept(`serverStreaming`,e,t,r,n)}e.stackServerStreamingInterceptors=stackServerStreamingInterceptors;function stackClientStreamingInterceptors(e,t,n){return stackIntercept(`clientStreaming`,e,t,n)}e.stackClientStreamingInterceptors=stackClientStreamingInterceptors;function stackDuplexStreamingInterceptors(e,t,n){return stackIntercept(`duplex`,e,t,n)}e.stackDuplexStreamingInterceptors=stackDuplexStreamingInterceptors})),Sv=/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ServerCallContextController=void 0,e.ServerCallContextController=class{constructor(e,t,n,r,i={code:`OK`,detail:``}){this._cancelled=!1,this._listeners=[],this.method=e,this.headers=t,this.deadline=n,this.trailers={},this._sendRH=r,this.status=i}notifyCancelled(){if(!this._cancelled){this._cancelled=!0;for(let e of this._listeners)e()}}sendResponseHeaders(e){this._sendRH(e)}get cancelled(){return this._cancelled}onCancel(e){let t=this._listeners;return t.push(e),()=>{let n=t.indexOf(e);n>=0&&t.splice(n,1)}}}})),Cv=(/* @__PURE__ */ __commonJSMin((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=dv();Object.defineProperty(e,"ServiceType",{enumerable:!0,get:function(){return t.ServiceType}});var n=uv();Object.defineProperty(e,"readMethodOptions",{enumerable:!0,get:function(){return n.readMethodOptions}}),Object.defineProperty(e,"readMethodOption",{enumerable:!0,get:function(){return n.readMethodOption}}),Object.defineProperty(e,"readServiceOption",{enumerable:!0,get:function(){return n.readServiceOption}});var r=fv();Object.defineProperty(e,"RpcError",{enumerable:!0,get:function(){return r.RpcError}});var i=pv();Object.defineProperty(e,"mergeRpcOptions",{enumerable:!0,get:function(){return i.mergeRpcOptions}});var a=hv();Object.defineProperty(e,"RpcOutputStreamController",{enumerable:!0,get:function(){return a.RpcOutputStreamController}});var o=bv();Object.defineProperty(e,"TestTransport",{enumerable:!0,get:function(){return o.TestTransport}});var s=mv();Object.defineProperty(e,"Deferred",{enumerable:!0,get:function(){return s.Deferred}}),Object.defineProperty(e,"DeferredState",{enumerable:!0,get:function(){return s.DeferredState}});var c=yv();Object.defineProperty(e,"DuplexStreamingCall",{enumerable:!0,get:function(){return c.DuplexStreamingCall}});var l=vv();Object.defineProperty(e,"ClientStreamingCall",{enumerable:!0,get:function(){return l.ClientStreamingCall}});var u=_v();Object.defineProperty(e,"ServerStreamingCall",{enumerable:!0,get:function(){return u.ServerStreamingCall}});var d=gv();Object.defineProperty(e,"UnaryCall",{enumerable:!0,get:function(){return d.UnaryCall}});var f=xv();Object.defineProperty(e,"stackIntercept",{enumerable:!0,get:function(){return f.stackIntercept}}),Object.defineProperty(e,"stackDuplexStreamingInterceptors",{enumerable:!0,get:function(){return f.stackDuplexStreamingInterceptors}}),Object.defineProperty(e,"stackClientStreamingInterceptors",{enumerable:!0,get:function(){return f.stackClientStreamingInterceptors}}),Object.defineProperty(e,"stackServerStreamingInterceptors",{enumerable:!0,get:function(){return f.stackServerStreamingInterceptors}}),Object.defineProperty(e,"stackUnaryInterceptors",{enumerable:!0,get:function(){return f.stackUnaryInterceptors}});var p=Sv();Object.defineProperty(e,"ServerCallContextController",{enumerable:!0,get:function(){return p.ServerCallContextController}})})))(),$=lv();const wv=new class extends $.MessageType{constructor(){super(`github.actions.results.entities.v1.CacheScope`,[{no:1,name:`scope`,kind:`scalar`,T:9},{no:2,name:`permission`,kind:`scalar`,T:3}])}create(e){let t={scope:``,permission:`0`};return globalThis.Object.defineProperty(t,$.MESSAGE_TYPE,{enumerable:!1,value:this}),e!==void 0&&(0,$.reflectionMergePartial)(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),a=e.pos+t;for(;e.poswv}])}create(e){let t={repositoryId:`0`,scope:[]};return globalThis.Object.defineProperty(t,$.MESSAGE_TYPE,{enumerable:!1,value:this}),e!==void 0&&(0,$.reflectionMergePartial)(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),a=e.pos+t;for(;e.posTv},{no:2,name:`key`,kind:`scalar`,T:9},{no:3,name:`version`,kind:`scalar`,T:9}])}create(e){let t={key:``,version:``};return globalThis.Object.defineProperty(t,$.MESSAGE_TYPE,{enumerable:!1,value:this}),e!==void 0&&(0,$.reflectionMergePartial)(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),a=e.pos+t;for(;e.posTv},{no:2,name:`key`,kind:`scalar`,T:9},{no:3,name:`size_bytes`,kind:`scalar`,T:3},{no:4,name:`version`,kind:`scalar`,T:9}])}create(e){let t={key:``,sizeBytes:`0`,version:``};return globalThis.Object.defineProperty(t,$.MESSAGE_TYPE,{enumerable:!1,value:this}),e!==void 0&&(0,$.reflectionMergePartial)(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),a=e.pos+t;for(;e.posTv},{no:2,name:`key`,kind:`scalar`,T:9},{no:3,name:`restore_keys`,kind:`scalar`,repeat:2,T:9},{no:4,name:`version`,kind:`scalar`,T:9}])}create(e){let t={key:``,restoreKeys:[],version:``};return globalThis.Object.defineProperty(t,$.MESSAGE_TYPE,{enumerable:!1,value:this}),e!==void 0&&(0,$.reflectionMergePartial)(this,t,e),t}internalBinaryRead(e,t,n,r){let i=r??this.create(),a=e.pos+t;for(;e.posDv.fromJson(e,{ignoreUnknownFields:!0}))}FinalizeCacheEntryUpload(e){let t=Ov.toJson(e,{useProtoFieldName:!0,emitDefaultValues:!1});return this.rpc.request(`github.actions.results.api.v1.CacheService`,`FinalizeCacheEntryUpload`,`application/json`,t).then(e=>kv.fromJson(e,{ignoreUnknownFields:!0}))}GetCacheEntryDownloadURL(e){let t=Av.toJson(e,{useProtoFieldName:!0,emitDefaultValues:!1});return this.rpc.request(`github.actions.results.api.v1.CacheService`,`GetCacheEntryDownloadURL`,`application/json`,t).then(e=>jv.fromJson(e,{ignoreUnknownFields:!0}))}};function maskSigUrl(e){if(e)try{let t=new URL(e).searchParams.get(`sig`);t&&(setSecret(t),setSecret(encodeURIComponent(t)))}catch(t){debug(`Failed to parse URL: ${e} ${t instanceof Error?t.message:String(t)}`)}}function maskSecretUrls(e){if(typeof e!=`object`||!e){debug(`body is not an object or is null`);return}`signed_upload_url`in e&&typeof e.signed_upload_url==`string`&&maskSigUrl(e.signed_upload_url),`signed_download_url`in e&&typeof e.signed_download_url==`string`&&maskSigUrl(e.signed_download_url)}var __awaiter$2=function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})},CacheServiceClient=class{constructor(e,t,n,r){this.maxAttempts=5,this.baseRetryIntervalMilliseconds=3e3,this.retryMultiplier=1.5;let i=getRuntimeToken();this.baseUrl=getCacheServiceURL(),t&&(this.maxAttempts=t),n&&(this.baseRetryIntervalMilliseconds=n),r&&(this.retryMultiplier=r),this.httpClient=new HttpClient(e,[new BearerCredentialHandler(i)])}request(e,t,n,r){return __awaiter$2(this,void 0,void 0,function*(){let i=new URL(`/twirp/${e}/${t}`,this.baseUrl).href;debug(`[Request] ${t} ${i}`);let a={"Content-Type":n};try{let{body:e}=yield this.retryableRequest(()=>__awaiter$2(this,void 0,void 0,function*(){return this.httpClient.post(i,JSON.stringify(r),a)}));return e}catch(e){throw Error(`Failed to ${t}: ${e.message}`)}})}retryableRequest(e){return __awaiter$2(this,void 0,void 0,function*(){let t=0,n=``,r=``;for(;t0&&warning(`You've hit a rate limit, your rate limit will reset in ${t} seconds`)}throw new RateLimitError(`Rate limited: ${n}`)}}catch(e){if(e instanceof SyntaxError&&debug(`Raw Body: ${r}`),e instanceof UsageError||e instanceof RateLimitError)throw e;if(NetworkError.isNetworkErrorCode(e?.code))throw new NetworkError(e?.code);i=!0,n=e.message}if(!i)throw Error(`Received non-retryable error: ${n}`);if(t+1===this.maxAttempts)throw Error(`Failed to make request after ${this.maxAttempts} attempts: ${n}`);let a=this.getExponentialRetryTimeMilliseconds(t);info(`Attempt ${t+1} of ${this.maxAttempts} failed with error: ${n}. Retrying request in ${a} ms...`),yield this.sleep(a),t++}throw Error(`Request failed`)})}isSuccessStatusCode(e){return e?e>=200&&e<300:!1}isRetryableHttpStatusCode(e){return e?[On.BadGateway,On.GatewayTimeout,On.InternalServerError,On.ServiceUnavailable].includes(e):!1}sleep(e){return __awaiter$2(this,void 0,void 0,function*(){return new Promise(t=>setTimeout(t,e))})}getExponentialRetryTimeMilliseconds(e){if(e<0)throw Error(`attempt should be a positive integer`);if(e===0)return this.baseRetryIntervalMilliseconds;let t=this.baseRetryIntervalMilliseconds*this.retryMultiplier**+e,n=t*this.retryMultiplier;return Math.trunc(Math.random()*(n-t)+t)}};function internalCacheTwirpClient(e){return new CacheServiceClientJSON(new CacheServiceClient(getUserAgentString(),e?.maxAttempts,e?.retryIntervalMs,e?.retryMultiplier))}var __awaiter$1=function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})};const Mv=process.platform===`win32`;function getTarPath(){return __awaiter$1(this,void 0,void 0,function*(){switch(process.platform){case`win32`:{let e=yield getGnuTarPathOnWindows(),t=ps;if(e)return{path:e,type:ls.GNU};if(s(t))return{path:t,type:ls.BSD};break}case`darwin`:{let e=yield which(`gtar`,!1);return e?{path:e,type:ls.GNU}:{path:yield which(`tar`,!0),type:ls.BSD}}}return{path:yield which(`tar`,!0),type:ls.GNU}})}function getTarArgs(e,t,n){return __awaiter$1(this,arguments,void 0,function*(e,t,n,r=``){let i=[`"${e.path}"`],a=getCacheFileName(t),o=`cache.tar`,s=getWorkingDirectory(),c=e.type===ls.BSD&&t!==cs.Gzip&&Mv;switch(n){case`create`:i.push(`--posix`,`-cf`,c?o:a.replace(RegExp(`\\${u.sep}`,`g`),`/`),`--exclude`,c?o:a.replace(RegExp(`\\${u.sep}`,`g`),`/`),`-P`,`-C`,s.replace(RegExp(`\\${u.sep}`,`g`),`/`),`--files-from`,hs);break;case`extract`:i.push(`-xf`,c?o:r.replace(RegExp(`\\${u.sep}`,`g`),`/`),`-P`,`-C`,c?quoteAbsolutePath(s):s.replace(RegExp(`\\${u.sep}`,`g`),`/`));break;case`list`:i.push(`-tf`,c?o:r.replace(RegExp(`\\${u.sep}`,`g`),`/`),`-P`)}if(e.type===ls.GNU)switch(process.platform){case`win32`:i.push(`--force-local`);break;case`darwin`:i.push(`--delay-directory-restore`)}return i})}function getCommands(e,t){return __awaiter$1(this,arguments,void 0,function*(e,t,n=``){let r,i=yield getTarPath(),a=yield getTarArgs(i,e,t,n),o=t===`create`?yield getCompressionProgram(i,e):yield getDecompressionProgram(i,e,n),s=i.type===ls.BSD&&e!==cs.Gzip&&Mv;return r=s&&t!==`create`?[[...o].join(` `),[...a].join(` `)]:[[...a].join(` `),[...o].join(` `)],{commands:s?r:[r.join(` `)],requiresTempDirectory:s&&t!==`create`}})}function getWorkingDirectory(){return process.env.GITHUB_WORKSPACE??process.cwd()}function quoteAbsolutePath(e){return`"${u.resolve(e).replace(RegExp(`\\${u.sep}`,`g`),`/`)}"`}function getDecompressionProgram(e,t,n){return __awaiter$1(this,void 0,void 0,function*(){let r=e.type===ls.BSD&&t!==cs.Gzip&&Mv;switch(t){case cs.Zstd:return r?[`zstd -d --long=30 --force -o`,ms,quoteAbsolutePath(n)]:[`--use-compress-program`,Mv?`"zstd -d --long=30"`:`unzstd --long=30`];case cs.ZstdWithoutLong:return r?[`zstd -d --force -o`,ms,quoteAbsolutePath(n)]:[`--use-compress-program`,Mv?`"zstd -d"`:`unzstd`];default:return[`-z`]}})}function getCompressionProgram(e,t){return __awaiter$1(this,void 0,void 0,function*(){let n=getCacheFileName(t),r=e.type===ls.BSD&&t!==cs.Gzip&&Mv;switch(t){case cs.Zstd:return r?[`zstd -T0 --long=30 --force -o`,n.replace(RegExp(`\\${u.sep}`,`g`),`/`),ms]:[`--use-compress-program`,Mv?`"zstd -T0 --long=30"`:`zstdmt --long=30`];case cs.ZstdWithoutLong:return r?[`zstd -T0 --force -o`,n.replace(RegExp(`\\${u.sep}`,`g`),`/`),ms]:[`--use-compress-program`,Mv?`"zstd -T0"`:`zstdmt`];default:return[`-z`]}})}function execCommands(e,t){return __awaiter$1(this,void 0,void 0,function*(){for(let n of e)try{yield exec(n,void 0,{cwd:t,env:Object.assign(Object.assign({},process.env),{MSYS:`winsymlinks:nativestrict`})})}catch(e){throw Error(`${n.split(` `)[0]} failed with error: ${e?.message}`)}})}function execReadCommands(e,t,n){return __awaiter$1(this,void 0,void 0,function*(){let{commands:r,requiresTempDirectory:i}=yield getCommands(t,n,e),a=i?yield createTempDirectory():void 0;try{yield execCommands(r,a)}finally{if(a)try{yield rmRF(a)}catch(e){debug(`Failed to delete temporary tar directory: ${e}`)}}})}function listTar(e,t){return __awaiter$1(this,void 0,void 0,function*(){yield execReadCommands(e,t,`list`)})}function extractTar(e,t){return __awaiter$1(this,void 0,void 0,function*(){yield mkdirP(getWorkingDirectory()),yield execReadCommands(e,t,`extract`)})}function createTar(e,t,n){return __awaiter$1(this,void 0,void 0,function*(){l(u.join(e,hs),t.join(` -`));let{commands:r}=yield getCommands(n,`create`);yield execCommands(r,e)})}var __awaiter=function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})},Nv=class ValidationError extends Error{constructor(e){super(e),this.name=`ValidationError`,Object.setPrototypeOf(this,ValidationError.prototype)}},Pv=class ReserveCacheError extends Error{constructor(e){super(e),this.name=`ReserveCacheError`,Object.setPrototypeOf(this,ReserveCacheError.prototype)}},Fv=class CacheWriteDeniedError extends Pv{constructor(e){super(e),this.name=`CacheWriteDeniedError`,Object.setPrototypeOf(this,CacheWriteDeniedError.prototype)}};const Iv=`cache read denied:`;var Lv=class CacheReadDeniedError extends Error{constructor(e){super(e),this.name=`CacheReadDeniedError`,Object.setPrototypeOf(this,CacheReadDeniedError.prototype)}},Rv=class FinalizeCacheError extends Error{constructor(e){super(e),this.name=`FinalizeCacheError`,Object.setPrototypeOf(this,FinalizeCacheError.prototype)}};function checkPaths(e){if(!e||e.length===0)throw new Nv(`Path Validation Error: At least one directory or file path is required`)}function checkKey(e){if(e.length>512)throw new Nv(`Key Validation Error: ${e} cannot be larger than 512 characters.`);if(!/^[^,]*$/.test(e))throw new Nv(`Key Validation Error: ${e} cannot contain commas.`)}function restoreCache$1(e,t,n,r){return __awaiter(this,arguments,void 0,function*(e,t,n,r,i=!1){let a=getCacheServiceVersion();debug(`Cache service version: ${a}`),checkPaths(e);let o=getCacheMode();if(!isCacheReadable(o)){info(`Cache restore skipped: the effective cache-mode '${o}' does not permit reads.`),debug(`Skipped restore for paths [${e.join(`, `)}] with primary key '${t}'.`);return}switch(a){case`v2`:return yield restoreCacheV2(e,t,n,r,i);default:return yield restoreCacheV1(e,t,n,r,i)}})}function restoreCacheV1(e,t,n,r){return __awaiter(this,arguments,void 0,function*(e,t,n,r,i=!1){n||=[];let a=[t,...n];if(debug(`Resolved Keys:`),debug(JSON.stringify(a)),a.length>10)throw new Nv(`Key Validation Error: Keys are limited to a maximum of 10.`);for(let e of a)checkKey(e);let o=yield getCompressionMethod(),s=``;try{let t;try{t=yield getCacheEntry(a,e,{compressionMethod:o,enableCrossOsArchive:i})}catch(e){let t=e?.message??``;throw t.includes(Iv)?new Lv(t):e}if(!t?.archiveLocation)return;if(r?.lookupOnly)return info(`Lookup only - skipping download`),t.cacheKey;s=u.join(yield createTempDirectory(),getCacheFileName(o)),debug(`Archive Path: ${s}`),yield downloadCache(t.archiveLocation,s,r),isDebug()&&(yield listTar(s,o));let n=getArchiveFileSizeInBytes(s);return info(`Cache Size: ~${Math.round(n/1048576)} MB (${n} B)`),yield extractTar(s,o),info(`Cache restored successfully`),t.cacheKey}catch(e){let t=e;if(t.name===Nv.name)throw e;t instanceof Pn&&typeof t.statusCode==`number`&&t.statusCode>=500?error(`Failed to restore: ${e.message}`):warning(`Failed to restore: ${e.message}`)}finally{try{yield unlinkFile(s)}catch(e){debug(`Failed to delete archive: ${e}`)}}})}function restoreCacheV2(e,t,n,r){return __awaiter(this,arguments,void 0,function*(e,t,n,r,i=!1){r=Object.assign(Object.assign({},r),{useAzureSdk:!0}),n||=[];let a=[t,...n];if(debug(`Resolved Keys:`),debug(JSON.stringify(a)),a.length>10)throw new Nv(`Key Validation Error: Keys are limited to a maximum of 10.`);for(let e of a)checkKey(e);let o=``;try{let s=internalCacheTwirpClient(),c=yield getCompressionMethod(),l={key:t,restoreKeys:n,version:getCacheVersion(e,c,i)},d;try{d=yield s.GetCacheEntryDownloadURL(l)}catch(e){let t=e?.message??``;throw t.includes(Iv)?new Lv(t):e}if(!d.ok){debug(`Cache not found for version ${l.version} of keys: ${a.join(`, `)}`);return}if(l.key===d.matchedKey?info(`Cache hit for: ${d.matchedKey}`):info(`Cache hit for restore-key: ${d.matchedKey}`),r?.lookupOnly)return info(`Lookup only - skipping download`),d.matchedKey;o=u.join(yield createTempDirectory(),getCacheFileName(c)),debug(`Archive path: ${o}`),debug(`Starting download of archive to: ${o}`),yield downloadCache(d.signedDownloadUrl,o,r);let f=getArchiveFileSizeInBytes(o);return info(`Cache Size: ~${Math.round(f/1048576)} MB (${f} B)`),isDebug()&&(yield listTar(o,c)),yield extractTar(o,c),info(`Cache restored successfully`),d.matchedKey}catch(e){let t=e;if(t.name===Nv.name)throw e;t instanceof Pn&&typeof t.statusCode==`number`&&t.statusCode>=500?error(`Failed to restore: ${e.message}`):warning(`Failed to restore: ${e.message}`)}finally{try{o&&(yield unlinkFile(o))}catch(e){debug(`Failed to delete archive: ${e}`)}}})}function saveCache$1(e,t,n){return __awaiter(this,arguments,void 0,function*(e,t,n,r=!1){let i=getCacheServiceVersion();debug(`Cache service version: ${i}`),checkPaths(e),checkKey(t);let a=getCacheMode();if(!isCacheWritable(a))return info(`Cache save skipped: the effective cache-mode '${a}' does not permit writes.`),debug(`Skipped save for paths [${e.join(`, `)}] with key '${t}'.`),-1;switch(i){case`v2`:return yield saveCacheV2(e,t,n,r);default:return yield saveCacheV1(e,t,n,r)}})}function saveCacheV1(e,t,n){return __awaiter(this,arguments,void 0,function*(e,t,n,r=!1){let i=yield getCompressionMethod(),a=-1,o=yield resolvePaths(e);if(debug(`Cache Paths:`),debug(`${JSON.stringify(o)}`),o.length===0)throw Error(`Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.`);let s=yield createTempDirectory(),c=u.join(s,getCacheFileName(i));debug(`Archive Path: ${c}`);try{yield createTar(s,o,i),isDebug()&&(yield listTar(c,i));let l=getArchiveFileSizeInBytes(c);if(debug(`File Size: ${l}`),l>10737418240&&!isGhes())throw Error(`Cache size of ~${Math.round(l/1048576)} MB (${l} B) is over the 10GB limit, not saving cache.`);debug(`Reserving Cache`);let u=yield reserveCache(t,e,{compressionMethod:i,enableCrossOsArchive:r,cacheSize:l});if(u?.result?.cacheId)a=u?.result?.cacheId;else if(u?.statusCode===400)throw Error(u?.error?.message??`Cache size of ~${Math.round(l/1048576)} MB (${l} B) is over the data cap limit, not saving cache.`);else{let e=u?.error?.message;throw e?.startsWith(`cache write denied:`)?new Fv(`Unable to reserve cache with key ${t}. More details: ${e}`):new Pv(`Unable to reserve cache with key ${t}, another job may be creating this cache. More details: ${u?.error?.message}`)}debug(`Saving Cache (ID: ${a})`),yield saveCache$2(a,c,``,n)}catch(e){let t=e;if(t.name===Nv.name)throw e;t.name===Pv.name?info(`Failed to save: ${t.message}`):t instanceof Pn&&typeof t.statusCode==`number`&&t.statusCode>=500?error(`Failed to save: ${t.message}`):warning(`Failed to save: ${t.message}`)}finally{try{yield unlinkFile(c)}catch(e){debug(`Failed to delete archive: ${e}`)}}return a})}function saveCacheV2(e,t,n){return __awaiter(this,arguments,void 0,function*(e,t,n,r=!1){n=Object.assign(Object.assign({},n),{uploadChunkSize:67108864,uploadConcurrency:8,useAzureSdk:!0});let i=yield getCompressionMethod(),a=internalCacheTwirpClient(),o=-1,s=yield resolvePaths(e);if(debug(`Cache Paths:`),debug(`${JSON.stringify(s)}`),s.length===0)throw Error(`Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.`);let c=yield createTempDirectory(),l=u.join(c,getCacheFileName(i));debug(`Archive Path: ${l}`);try{yield createTar(c,s,i),isDebug()&&(yield listTar(l,i));let u=getArchiveFileSizeInBytes(l);debug(`File Size: ${u}`),n.archiveSizeBytes=u,debug(`Reserving Cache`);let d=getCacheVersion(e,i,r),f={key:t,version:d},p;try{let e=yield a.CreateCacheEntry(f);if(!e.ok)throw e.message&&!e.message.startsWith(`cache write denied:`)&&warning(`Cache reservation failed: ${e.message}`),Error(e.message||`Response was not ok`);p=e.signedUploadUrl}catch(e){debug(`Failed to reserve cache: ${e}`);let n=e?.message??``;throw n.startsWith(`cache write denied:`)?new Fv(`Unable to reserve cache with key ${t}. More details: ${n}`):new Pv(`Unable to reserve cache with key ${t}, another job may be creating this cache.`)}debug(`Attempting to upload cache located at: ${l}`),yield saveCache$2(o,l,p,n);let m={key:t,version:d,sizeBytes:`${u}`},h=yield a.FinalizeCacheEntryUpload(m);if(debug(`FinalizeCacheEntryUploadResponse: ${h.ok}`),!h.ok)throw h.message?new Rv(h.message):Error(`Unable to finalize cache with key ${t}, another job may be finalizing this cache.`);o=parseInt(h.entryId)}catch(e){let t=e;if(t.name===Nv.name)throw e;t.name===Pv.name?info(`Failed to save: ${t.message}`):t.name===Rv.name?warning(t.message):t instanceof Pn&&typeof t.statusCode==`number`&&t.statusCode>=500?error(`Failed to save: ${t.message}`):warning(`Failed to save: ${t.message}`)}finally{try{yield unlinkFile(l)}catch(e){debug(`Failed to delete archive: ${e}`)}}return o})}function commandPath(e,t=process.env){if(!e||e===`.`||e===`..`||/[\\/:]/.test(e))return;let n=isWindows(),r=n?Object.keys(t).sort().find(e=>e.toUpperCase()===`PATH`):`PATH`,i=r&&t[r]||``,a=n&&!e.toLowerCase().endsWith(`.exe`)?`${e}.exe`:e,o=ge(process.cwd(),{bigint:!0});for(let e of i.split(M.delimiter)){let t=n?e.replace(/^"(.*)"$/,`$1`):e;if(M.isAbsolute(t)&&!(n&&M.parse(t).root.length===1))try{let e=ge(t,{bigint:!0});if(e.dev===o.dev&&e.ino===o.ino)continue;let r=M.join(t,a);if(!ge(r).isFile())continue;return le(r,n?de.F_OK:de.X_OK),r}catch{}}}function resolveSfwEnabled(e,t,n){return e?!pkgPrNewCommitSha(t)||(n(`sfw was requested but is automatically disabled for Vite+ preview build ${t}; Socket Firewall Free will not be used.`),!1):!1}const zv=`v1.15.4`,Bv=`https://github.com/SocketDev/sfw-free/releases/download/${zv}`;function isMuslLinux(){if(process.platform!==`linux`)return!1;try{let e=process.report?.getReport();if(e?.header&&!e.header.glibcVersionRuntime)return!0}catch{}return F(`/etc/alpine-release`)}function getSfwAssetName(e,t,n){if(e===`darwin`){if(t===`arm64`)return`sfw-free-macos-arm64`;if(t===`x64`)return`sfw-free-macos-x86_64`}else if(e===`linux`){if(t===`arm64`)return n?`sfw-free-musl-linux-arm64`:`sfw-free-linux-arm64`;if(t===`x64`)return n?`sfw-free-musl-linux-x86_64`:`sfw-free-linux-x86_64`}else if(isWindows(e)){if(t===`arm64`)return`sfw-free-windows-arm64.exe`;if(t===`x64`)return`sfw-free-windows-x86_64.exe`}throw Error(`Unsupported platform/arch for sfw: ${e}/${t}${e===`linux`?` (${n?`musl`:`glibc`})`:``}`)}const Vv=2e3;function isSfwSupported(e=process.platform,t=process.arch,n=isMuslLinux()){try{return!!getSfwAssetName(e,t,n)}catch{return!1}}function getSfwBinDir(){let e=process.env.RUNNER_TEMP||process.env.TMPDIR||process.env.TEMP||`/tmp`;return ae(e,`sfw-bin`)}async function installSfw(){let e=getSfwAssetName(process.platform,process.arch,isMuslLinux()),t=`${Bv}/${e}`,n=getSfwBinDir();fe(n,{recursive:!0});let r=P(n,isWindows()?`sfw.exe`:`sfw`),i=`sfw-${zv}-${process.platform}-${process.arch}-${isMuslLinux()?`musl`:`glibc`}`;try{let e=await restoreCache$1([n],i);if(e&&F(r))return isWindows()||ue(r,493),addPath(n),info(`sfw restored from cache: ${e}`),r}catch(e){warning(`sfw cache restore failed (${e instanceof Error?e.message:String(e)}); falling through to download.`)}info(`Installing sfw from ${t}...`);let a=``;for(let e=1;e<=2;e++){try{let e=await runDownloadCommand(t,r);if(e===0&&F(r)){isWindows()||ue(r,493),addPath(n),info(`sfw installed at ${r}`);try{await saveCache$1([n],i),info(`sfw cached under key: ${i}`)}catch(e){warning(`sfw cache save failed (${e instanceof Error?e.message:String(e)}); continuing.`)}return r}a=`exit code ${e}`}catch(e){a=e instanceof Error?e.message:String(e)}e<2&&(warning(`Failed to install sfw from ${t} (${a}). Retrying in ${Vv}ms... (attempt ${e+1}/2)`),await se(Vv))}throw Error(`Failed to install sfw from ${t} after 2 attempts: ${a}`)}function findSfwOnPath(){return commandPath(`sfw`)??null}async function setupSfw(e){if(!resolveSfwEnabled(e.sfw,e.version,warning))return{executable:`vp`,sfw:!1};if(e.runInstall.length===0)return info("sfw was requested but `run-install` is disabled; sfw will not be invoked."),{executable:`vp`,sfw:!1};let t=findSfwOnPath();return t?(info(`Using existing sfw on PATH: ${t}`),{executable:t,sfw:!0}):isSfwSupported()?{executable:await installSfw(),sfw:!0}:(warning(`sfw has no published binary for this runner's platform/architecture (${`process.platform=${process.platform}, process.arch=${process.arch}, musl=${isMuslLinux()}`}) and none was found on PATH; falling back to plain \`vp install\`. To enable sfw here, install a working sfw binary on PATH in an earlier step (e.g. via \`socketdev/action@\` or a custom install).`),{executable:`vp`,sfw:!1})}async function runDownloadCommand(e,t){let n={ignoreReturnCode:!0};return isWindows()?exec(`pwsh`,[`-Command`,`Invoke-WebRequest -UseBasicParsing -Uri '${e}' -OutFile '${t}' -TimeoutSec 60`],n):exec(`bash`,[`-c`,`set -o pipefail; curl -fsSL --connect-timeout 5 --max-time 60 -o '${t}' '${e}'`],n)}const Hv=/Command 'vp' not found in PATH/;function isSfwVpNotFoundFlake(e,t){return Hv.test(t)||Hv.test(e)}async function warmPowerShellCommandCache(){if(isWindows())try{await getExecOutput(`powershell.exe`,[`-NoProfile`,`-Command`,`Get-Command vp`],{ignoreReturnCode:!0})}catch(e){info(`PowerShell warm-up failed (${String(e)}); retrying sfw anyway.`)}}function tailOutput(e,t){let n=e.trim();return n.length<=t?n:`…(truncated, showing last ${t} chars)…\n${n.slice(-t)}`}async function runViteInstall(e,t){let n=getConfiguredProjectDir(e),{executable:r,sfw:i}=t;for(let t of e.runInstall){let e=[`install`];t.args&&e.push(...t.args);let a=i?[`vp`,...e]:e,o=getInstallCwd(n,t.cwd),s=`${r} ${a.join(` `)}`,attempt=async e=>{startGroup(`Running ${e} in ${o}...`);try{return await getExecOutput(`"${r.replaceAll(`"`,`\\"`)}"`,a,{cwd:o,ignoreReturnCode:!0})}finally{endGroup()}};try{let e=await attempt(s);if(e.exitCode!==0&&i&&isSfwVpNotFoundFlake(e.stdout,e.stderr)&&(warning(`sfw reported vp as not found even though it is on PATH. This is a known sfw flake on Windows: a cold PowerShell start exceeds sfw's 10s command-resolution timeout and the timeout is misreported as not-found. Warming the PowerShell command cache and retrying once.`),await warmPowerShellCommandCache(),e=await attempt(`${s} (retry)`)),e.exitCode===0){info(`Successfully ran ${s}`);continue}let t=e.stderr.trim()||e.stdout.trim();t&&error(tailOutput(t,4e3),{title:`${s} failed`}),setFailed(`Command "${s}" (cwd: ${o}) exited with code ${e.exitCode}`)}catch(e){setFailed(`Failed to run ${s}: ${String(e)}`)}}}async function restoreCache(e){let t=getConfiguredProjectDir(e),n=detectLockFile$1(e.cacheDependencyPath,t);if(!n){warning(e.cacheDependencyPath?`No lock file found for cache-dependency-path: ${e.cacheDependencyPath}. Skipping cache restore.`:`No lock file found in project directory: ${t}. Skipping cache restore.`),setOutput(`cache-hit`,!1);return}info(`Using lock file: ${n.path}`);let r=ne(n.path);info(`Resolving dependency cache directory in: ${r}`);let i=await getCacheDirectories(n.type,r);if(!i.length){warning(`No cache directories found for ${n.type} in ${r}. Skipping cache restore.`),setOutput(`cache-hit`,!1);return}debug(`Cache paths: ${i.join(`, `)}`),saveState(`CACHE_PATHS`,JSON.stringify(i));let a=process.env.RUNNER_OS||Se(),o=be(),s=await hashFiles(n.path);if(!s)throw Error(`Failed to generate hash for lock file: ${n.path}`);let c=`vite-plus-${a}-${o}-${n.type}-${s}`,l=[`vite-plus-${a}-${o}-${n.type}-`,`vite-plus-${a}-${o}-`];debug(`Primary key: ${c}`),debug(`Restore keys: ${l.join(`, `)}`),saveState(`CACHE_PRIMARY_KEY`,c);let u=await restoreCache$1(i,c,l);u?(info(`Cache restored from key: ${u}`),saveState(`CACHE_MATCHED_KEY`,u),setOutput(`cache-hit`,!0)):(info(`Cache not found`),setOutput(`cache-hit`,!1))}async function saveCache(){let e=getState(`CACHE_PRIMARY_KEY`),t=getState(`CACHE_MATCHED_KEY`),n=getState(`CACHE_PATHS`);if(!e){info(`No cache key found. Skipping cache save.`);return}if(!n){info(`No cache paths found. Skipping cache save.`);return}if(e===t){info(`Cache hit on primary key "${e}". Skipping save.`);return}let r=JSON.parse(n);if(!r.length){info(`Empty cache paths. Skipping cache save.`);return}try{if(await saveCache$1(r,e)===-1){info(`Cache not saved (key already reserved by a concurrent job, or save was skipped).`);return}info(`Cache saved with key: ${e}`)}catch(e){warning(`Failed to save cache: ${String(e)}`)}}function resolvePath$1(e,t){return M.isAbsolute(e)?e:M.join(t,e)}function isWithin(e,t){let n=M.relative(t,e);return!M.isAbsolute(n)&&n!==`..`&&!n.startsWith(`..${M.sep}`)}function createNodeVersionResolver(e){let{getWorkspaceDir:t,info:n}=e;function resolveNodeVersionFile(e,r){let i=resolvePath$1(e,r||t()),a;try{a=pe(i,`utf-8`)}catch{throw Error(`node-version-file not found: ${i}`)}let o=te(i),s;if(s=o===`.tool-versions`?parseToolVersions(a):o===`package.json`?parsePackageJson(a):parsePlainVersionFile(a),!s)throw Error(`No Node.js version found in ${e}`);return s=s.replace(/^v/i,``),n(`Resolved Node.js version '${s}' from ${e}`),s}function parsePlainVersionFile(e){for(let t of e.split(` +`));let{commands:r}=yield getCommands(n,`create`);yield execCommands(r,e)})}var __awaiter=function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r.throw(e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})},Nv=class ValidationError extends Error{constructor(e){super(e),this.name=`ValidationError`,Object.setPrototypeOf(this,ValidationError.prototype)}},Pv=class ReserveCacheError extends Error{constructor(e){super(e),this.name=`ReserveCacheError`,Object.setPrototypeOf(this,ReserveCacheError.prototype)}},Fv=class CacheWriteDeniedError extends Pv{constructor(e){super(e),this.name=`CacheWriteDeniedError`,Object.setPrototypeOf(this,CacheWriteDeniedError.prototype)}};const Iv=`cache read denied:`;var Lv=class CacheReadDeniedError extends Error{constructor(e){super(e),this.name=`CacheReadDeniedError`,Object.setPrototypeOf(this,CacheReadDeniedError.prototype)}},Rv=class FinalizeCacheError extends Error{constructor(e){super(e),this.name=`FinalizeCacheError`,Object.setPrototypeOf(this,FinalizeCacheError.prototype)}};function checkPaths(e){if(!e||e.length===0)throw new Nv(`Path Validation Error: At least one directory or file path is required`)}function checkKey(e){if(e.length>512)throw new Nv(`Key Validation Error: ${e} cannot be larger than 512 characters.`);if(!/^[^,]*$/.test(e))throw new Nv(`Key Validation Error: ${e} cannot contain commas.`)}function restoreCache$1(e,t,n,r){return __awaiter(this,arguments,void 0,function*(e,t,n,r,i=!1){let a=getCacheServiceVersion();debug(`Cache service version: ${a}`),checkPaths(e);let o=getCacheMode();if(!isCacheReadable(o)){info(`Cache restore skipped: the effective cache-mode '${o}' does not permit reads.`),debug(`Skipped restore for paths [${e.join(`, `)}] with primary key '${t}'.`);return}switch(a){case`v2`:return yield restoreCacheV2(e,t,n,r,i);default:return yield restoreCacheV1(e,t,n,r,i)}})}function restoreCacheV1(e,t,n,r){return __awaiter(this,arguments,void 0,function*(e,t,n,r,i=!1){n||=[];let a=[t,...n];if(debug(`Resolved Keys:`),debug(JSON.stringify(a)),a.length>10)throw new Nv(`Key Validation Error: Keys are limited to a maximum of 10.`);for(let e of a)checkKey(e);let o=yield getCompressionMethod(),s=``;try{let t;try{t=yield getCacheEntry(a,e,{compressionMethod:o,enableCrossOsArchive:i})}catch(e){let t=e?.message??``;throw t.includes(Iv)?new Lv(t):e}if(!t?.archiveLocation)return;if(r?.lookupOnly)return info(`Lookup only - skipping download`),t.cacheKey;s=u.join(yield createTempDirectory(),getCacheFileName(o)),debug(`Archive Path: ${s}`),yield downloadCache(t.archiveLocation,s,r),isDebug()&&(yield listTar(s,o));let n=getArchiveFileSizeInBytes(s);return info(`Cache Size: ~${Math.round(n/1048576)} MB (${n} B)`),yield extractTar(s,o),info(`Cache restored successfully`),t.cacheKey}catch(e){let t=e;if(t.name===Nv.name)throw e;t instanceof Pn&&typeof t.statusCode==`number`&&t.statusCode>=500?error(`Failed to restore: ${e.message}`):warning(`Failed to restore: ${e.message}`)}finally{try{yield unlinkFile(s)}catch(e){debug(`Failed to delete archive: ${e}`)}}})}function restoreCacheV2(e,t,n,r){return __awaiter(this,arguments,void 0,function*(e,t,n,r,i=!1){r=Object.assign(Object.assign({},r),{useAzureSdk:!0}),n||=[];let a=[t,...n];if(debug(`Resolved Keys:`),debug(JSON.stringify(a)),a.length>10)throw new Nv(`Key Validation Error: Keys are limited to a maximum of 10.`);for(let e of a)checkKey(e);let o=``;try{let s=internalCacheTwirpClient(),c=yield getCompressionMethod(),l={key:t,restoreKeys:n,version:getCacheVersion(e,c,i)},d;try{d=yield s.GetCacheEntryDownloadURL(l)}catch(e){let t=e?.message??``;throw t.includes(Iv)?new Lv(t):e}if(!d.ok){debug(`Cache not found for version ${l.version} of keys: ${a.join(`, `)}`);return}if(l.key===d.matchedKey?info(`Cache hit for: ${d.matchedKey}`):info(`Cache hit for restore-key: ${d.matchedKey}`),r?.lookupOnly)return info(`Lookup only - skipping download`),d.matchedKey;o=u.join(yield createTempDirectory(),getCacheFileName(c)),debug(`Archive path: ${o}`),debug(`Starting download of archive to: ${o}`),yield downloadCache(d.signedDownloadUrl,o,r);let f=getArchiveFileSizeInBytes(o);return info(`Cache Size: ~${Math.round(f/1048576)} MB (${f} B)`),isDebug()&&(yield listTar(o,c)),yield extractTar(o,c),info(`Cache restored successfully`),d.matchedKey}catch(e){let t=e;if(t.name===Nv.name)throw e;t instanceof Pn&&typeof t.statusCode==`number`&&t.statusCode>=500?error(`Failed to restore: ${e.message}`):warning(`Failed to restore: ${e.message}`)}finally{try{o&&(yield unlinkFile(o))}catch(e){debug(`Failed to delete archive: ${e}`)}}})}function saveCache$1(e,t,n){return __awaiter(this,arguments,void 0,function*(e,t,n,r=!1){let i=getCacheServiceVersion();debug(`Cache service version: ${i}`),checkPaths(e),checkKey(t);let a=getCacheMode();if(!isCacheWritable(a))return info(`Cache save skipped: the effective cache-mode '${a}' does not permit writes.`),debug(`Skipped save for paths [${e.join(`, `)}] with key '${t}'.`),-1;switch(i){case`v2`:return yield saveCacheV2(e,t,n,r);default:return yield saveCacheV1(e,t,n,r)}})}function saveCacheV1(e,t,n){return __awaiter(this,arguments,void 0,function*(e,t,n,r=!1){let i=yield getCompressionMethod(),a=-1,o=yield resolvePaths(e);if(debug(`Cache Paths:`),debug(`${JSON.stringify(o)}`),o.length===0)throw Error(`Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.`);let s=yield createTempDirectory(),c=u.join(s,getCacheFileName(i));debug(`Archive Path: ${c}`);try{yield createTar(s,o,i),isDebug()&&(yield listTar(c,i));let l=getArchiveFileSizeInBytes(c);if(debug(`File Size: ${l}`),l>10737418240&&!isGhes())throw Error(`Cache size of ~${Math.round(l/1048576)} MB (${l} B) is over the 10GB limit, not saving cache.`);debug(`Reserving Cache`);let u=yield reserveCache(t,e,{compressionMethod:i,enableCrossOsArchive:r,cacheSize:l});if(u?.result?.cacheId)a=u?.result?.cacheId;else if(u?.statusCode===400)throw Error(u?.error?.message??`Cache size of ~${Math.round(l/1048576)} MB (${l} B) is over the data cap limit, not saving cache.`);else{let e=u?.error?.message;throw e?.startsWith(`cache write denied:`)?new Fv(`Unable to reserve cache with key ${t}. More details: ${e}`):new Pv(`Unable to reserve cache with key ${t}, another job may be creating this cache. More details: ${u?.error?.message}`)}debug(`Saving Cache (ID: ${a})`),yield saveCache$2(a,c,``,n)}catch(e){let t=e;if(t.name===Nv.name)throw e;t.name===Pv.name?info(`Failed to save: ${t.message}`):t instanceof Pn&&typeof t.statusCode==`number`&&t.statusCode>=500?error(`Failed to save: ${t.message}`):warning(`Failed to save: ${t.message}`)}finally{try{yield unlinkFile(c)}catch(e){debug(`Failed to delete archive: ${e}`)}}return a})}function saveCacheV2(e,t,n){return __awaiter(this,arguments,void 0,function*(e,t,n,r=!1){n=Object.assign(Object.assign({},n),{uploadChunkSize:67108864,uploadConcurrency:8,useAzureSdk:!0});let i=yield getCompressionMethod(),a=internalCacheTwirpClient(),o=-1,s=yield resolvePaths(e);if(debug(`Cache Paths:`),debug(`${JSON.stringify(s)}`),s.length===0)throw Error(`Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.`);let c=yield createTempDirectory(),l=u.join(c,getCacheFileName(i));debug(`Archive Path: ${l}`);try{yield createTar(c,s,i),isDebug()&&(yield listTar(l,i));let u=getArchiveFileSizeInBytes(l);debug(`File Size: ${u}`),n.archiveSizeBytes=u,debug(`Reserving Cache`);let d=getCacheVersion(e,i,r),f={key:t,version:d},p;try{let e=yield a.CreateCacheEntry(f);if(!e.ok)throw e.message&&!e.message.startsWith(`cache write denied:`)&&warning(`Cache reservation failed: ${e.message}`),Error(e.message||`Response was not ok`);p=e.signedUploadUrl}catch(e){debug(`Failed to reserve cache: ${e}`);let n=e?.message??``;throw n.startsWith(`cache write denied:`)?new Fv(`Unable to reserve cache with key ${t}. More details: ${n}`):new Pv(`Unable to reserve cache with key ${t}, another job may be creating this cache.`)}debug(`Attempting to upload cache located at: ${l}`),yield saveCache$2(o,l,p,n);let m={key:t,version:d,sizeBytes:`${u}`},h=yield a.FinalizeCacheEntryUpload(m);if(debug(`FinalizeCacheEntryUploadResponse: ${h.ok}`),!h.ok)throw h.message?new Rv(h.message):Error(`Unable to finalize cache with key ${t}, another job may be finalizing this cache.`);o=parseInt(h.entryId)}catch(e){let t=e;if(t.name===Nv.name)throw e;t.name===Pv.name?info(`Failed to save: ${t.message}`):t.name===Rv.name?warning(t.message):t instanceof Pn&&typeof t.statusCode==`number`&&t.statusCode>=500?error(`Failed to save: ${t.message}`):warning(`Failed to save: ${t.message}`)}finally{try{yield unlinkFile(l)}catch(e){debug(`Failed to delete archive: ${e}`)}}return o})}function commandPath(e,t=process.env){if(!e||e===`.`||e===`..`||/[\\/:]/.test(e))return;let n=isWindows(),r=n?Object.keys(t).sort().find(e=>e.toUpperCase()===`PATH`):`PATH`,i=r&&t[r]||``,a=n&&!e.toLowerCase().endsWith(`.exe`)?`${e}.exe`:e,o=ge(process.cwd(),{bigint:!0}),s=n?de.F_OK:de.X_OK;for(let e of i.split(M.delimiter)){let t=n?e.replace(/^"(.*)"$/,`$1`):e;if(M.isAbsolute(t)&&!(n&&M.parse(t).root.length===1))try{let e=ge(t,{bigint:!0});if(e.dev===o.dev&&e.ino===o.ino)continue;let n=M.join(t,a);if(!ge(n).isFile())continue;return le(n,s),n}catch{}}}function resolveSfwEnabled(e,t,n){return e?!pkgPrNewCommitSha(t)||(n(`sfw was requested but is automatically disabled for Vite+ preview build ${t}; Socket Firewall Free will not be used.`),!1):!1}const zv=`v1.15.4`,Bv=`https://github.com/SocketDev/sfw-free/releases/download/${zv}`;function isMuslLinux(){if(process.platform!==`linux`)return!1;try{let e=process.report?.getReport();if(e?.header&&!e.header.glibcVersionRuntime)return!0}catch{}return F(`/etc/alpine-release`)}function getSfwAssetName(e,t,n){if(e===`darwin`){if(t===`arm64`)return`sfw-free-macos-arm64`;if(t===`x64`)return`sfw-free-macos-x86_64`}else if(e===`linux`){if(t===`arm64`)return n?`sfw-free-musl-linux-arm64`:`sfw-free-linux-arm64`;if(t===`x64`)return n?`sfw-free-musl-linux-x86_64`:`sfw-free-linux-x86_64`}else if(isWindows(e)){if(t===`arm64`)return`sfw-free-windows-arm64.exe`;if(t===`x64`)return`sfw-free-windows-x86_64.exe`}throw Error(`Unsupported platform/arch for sfw: ${e}/${t}${e===`linux`?` (${n?`musl`:`glibc`})`:``}`)}const Vv=2e3;function isSfwSupported(e=process.platform,t=process.arch,n=isMuslLinux()){try{return!!getSfwAssetName(e,t,n)}catch{return!1}}function getSfwBinDir(){let e=process.env.RUNNER_TEMP||process.env.TMPDIR||process.env.TEMP||`/tmp`;return ae(e,`sfw-bin`)}async function installSfw(){let e=getSfwAssetName(process.platform,process.arch,isMuslLinux()),t=`${Bv}/${e}`,n=getSfwBinDir();fe(n,{recursive:!0});let r=P(n,isWindows()?`sfw.exe`:`sfw`),i=`sfw-${zv}-${process.platform}-${process.arch}-${isMuslLinux()?`musl`:`glibc`}`;try{let e=await restoreCache$1([n],i);if(e&&F(r))return isWindows()||ue(r,493),addPath(n),info(`sfw restored from cache: ${e}`),r}catch(e){warning(`sfw cache restore failed (${e instanceof Error?e.message:String(e)}); falling through to download.`)}info(`Installing sfw from ${t}...`);let a=``;for(let e=1;e<=2;e++){try{let e=await runDownloadCommand(t,r);if(e===0&&F(r)){isWindows()||ue(r,493),addPath(n),info(`sfw installed at ${r}`);try{await saveCache$1([n],i),info(`sfw cached under key: ${i}`)}catch(e){warning(`sfw cache save failed (${e instanceof Error?e.message:String(e)}); continuing.`)}return r}a=`exit code ${e}`}catch(e){a=e instanceof Error?e.message:String(e)}e<2&&(warning(`Failed to install sfw from ${t} (${a}). Retrying in ${Vv}ms... (attempt ${e+1}/2)`),await se(Vv))}throw Error(`Failed to install sfw from ${t} after 2 attempts: ${a}`)}function findSfwOnPath(){return commandPath(`sfw`)??null}async function setupSfw(e){if(!resolveSfwEnabled(e.sfw,e.version,warning))return{executable:`vp`,sfw:!1};if(e.runInstall.length===0)return info("sfw was requested but `run-install` is disabled; sfw will not be invoked."),{executable:`vp`,sfw:!1};let t=findSfwOnPath();return t?(info(`Using existing sfw on PATH: ${t}`),{executable:t,sfw:!0}):isSfwSupported()?{executable:await installSfw(),sfw:!0}:(warning(`sfw has no published binary for this runner's platform/architecture (${`process.platform=${process.platform}, process.arch=${process.arch}, musl=${isMuslLinux()}`}) and none was found on PATH; falling back to plain \`vp install\`. To enable sfw here, install a working sfw binary on PATH in an earlier step (e.g. via \`socketdev/action@\` or a custom install).`),{executable:`vp`,sfw:!1})}async function runDownloadCommand(e,t){let n={ignoreReturnCode:!0};return isWindows()?exec(`pwsh`,[`-Command`,`Invoke-WebRequest -UseBasicParsing -Uri '${e}' -OutFile '${t}' -TimeoutSec 60`],n):exec(`bash`,[`-c`,`set -o pipefail; curl -fsSL --connect-timeout 5 --max-time 60 -o '${t}' '${e}'`],n)}const Hv=/Command 'vp' not found in PATH/;function isSfwVpNotFoundFlake(e,t){return Hv.test(t)||Hv.test(e)}async function warmPowerShellCommandCache(){if(isWindows())try{await getExecOutput(`powershell.exe`,[`-NoProfile`,`-Command`,`Get-Command vp`],{ignoreReturnCode:!0})}catch(e){info(`PowerShell warm-up failed (${String(e)}); retrying sfw anyway.`)}}function tailOutput(e,t){let n=e.trim();return n.length<=t?n:`…(truncated, showing last ${t} chars)…\n${n.slice(-t)}`}async function runViteInstall(e,t){let n=getConfiguredProjectDir(e),{executable:r,sfw:i}=t,a=`"${r.replaceAll(`"`,`\\"`)}"`;for(let t of e.runInstall){let e=[`install`,...t.args||[]],o=i?[`vp`,...e]:e,s=getInstallCwd(n,t.cwd),c=`${r} ${o.join(` `)}`;async function attempt(e){startGroup(`Running ${e} in ${s}...`);try{return await getExecOutput(a,o,{cwd:s,ignoreReturnCode:!0})}finally{endGroup()}}try{let e=await attempt(c);if(e.exitCode!==0&&i&&isSfwVpNotFoundFlake(e.stdout,e.stderr)&&(warning(`sfw reported vp as not found even though it is on PATH. This is a known sfw flake on Windows: a cold PowerShell start exceeds sfw's 10s command-resolution timeout and the timeout is misreported as not-found. Warming the PowerShell command cache and retrying once.`),await warmPowerShellCommandCache(),e=await attempt(`${c} (retry)`)),e.exitCode===0){info(`Successfully ran ${c}`);continue}let t=e.stderr.trim()||e.stdout.trim();t&&error(tailOutput(t,4e3),{title:`${c} failed`}),setFailed(`Command "${c}" (cwd: ${s}) exited with code ${e.exitCode}`)}catch(e){setFailed(`Failed to run ${c}: ${String(e)}`)}}}async function restoreCache(e){let t=getConfiguredProjectDir(e),n=detectLockFile$1(e.cacheDependencyPath,t);if(!n){warning(e.cacheDependencyPath?`No lock file found for cache-dependency-path: ${e.cacheDependencyPath}. Skipping cache restore.`:`No lock file found in project directory: ${t}. Skipping cache restore.`),setOutput(`cache-hit`,!1);return}info(`Using lock file: ${n.path}`);let r=ne(n.path);info(`Resolving dependency cache directory in: ${r}`);let i=await getCacheDirectories(n.type,r);if(!i.length){warning(`No cache directories found for ${n.type} in ${r}. Skipping cache restore.`),setOutput(`cache-hit`,!1);return}debug(`Cache paths: ${i.join(`, `)}`),saveState(`CACHE_PATHS`,JSON.stringify(i));let a=process.env.RUNNER_OS||Se(),o=be(),s=await hashFiles(n.path);if(!s)throw Error(`Failed to generate hash for lock file: ${n.path}`);let c=`vite-plus-${a}-${o}-${n.type}-${s}`,l=[`vite-plus-${a}-${o}-${n.type}-`,`vite-plus-${a}-${o}-`];debug(`Primary key: ${c}`),debug(`Restore keys: ${l.join(`, `)}`),saveState(`CACHE_PRIMARY_KEY`,c);let u=await restoreCache$1(i,c,l);u?(info(`Cache restored from key: ${u}`),saveState(`CACHE_MATCHED_KEY`,u),setOutput(`cache-hit`,!0)):(info(`Cache not found`),setOutput(`cache-hit`,!1))}async function saveCache(){let e=getState(`CACHE_PRIMARY_KEY`),t=getState(`CACHE_MATCHED_KEY`),n=getState(`CACHE_PATHS`);if(!e){info(`No cache key found. Skipping cache save.`);return}if(!n){info(`No cache paths found. Skipping cache save.`);return}if(e===t){info(`Cache hit on primary key "${e}". Skipping save.`);return}let r=JSON.parse(n);if(!r.length){info(`Empty cache paths. Skipping cache save.`);return}try{if(await saveCache$1(r,e)===-1){info(`Cache not saved (key already reserved by a concurrent job, or save was skipped).`);return}info(`Cache saved with key: ${e}`)}catch(e){warning(`Failed to save cache: ${String(e)}`)}}function resolvePath$1(e,t){return M.isAbsolute(e)?e:M.join(t,e)}function isWithin(e,t){let n=M.relative(t,e);return!M.isAbsolute(n)&&n!==`..`&&!n.startsWith(`..${M.sep}`)}function createNodeVersionResolver(e){let{getWorkspaceDir:t,info:n}=e;function resolveNodeVersionFile(e,r){let i=resolvePath$1(e,r||t()),a;try{a=pe(i,`utf-8`)}catch{throw Error(`node-version-file not found: ${i}`)}let o=te(i),s;if(s=o===`.tool-versions`?parseToolVersions(a):o===`package.json`?parsePackageJson(a):parsePlainVersionFile(a),!s)throw Error(`No Node.js version found in ${e}`);return s=s.replace(/^v/i,``),n(`Resolved Node.js version '${s}' from ${e}`),s}function parsePlainVersionFile(e){for(let t of e.split(` `)){let e=(t.includes(`#`)?t.slice(0,t.indexOf(`#`)):t).trim();if(e)return normalizeNvmAlias(e)}}function normalizeNvmAlias(e){let t=e.toLowerCase();return t===`node`||t===`stable`?`latest`:e}function parseToolVersions(e){for(let t of e.split(` `)){let e=t.trim();if(!e||e.startsWith(`#`))continue;let[n,...r]=e.split(/\s+/);if(n===`nodejs`||n===`node`){for(let e of r)if(isAsdfInstallableVersion(e))return e}}}function isAsdfInstallableVersion(e){return!!e&&e!==`system`&&!e.startsWith(`ref:`)&&!e.startsWith(`path:`)}function parsePackageJson(e){let t;try{t=JSON.parse(e)}catch{throw Error(`Failed to parse package.json: invalid JSON`)}let n=t.devEngines;if(n?.runtime){let e=findNodeRuntime(n.runtime);if(e)return e}let r=t.engines;if(r?.node&&typeof r.node==`string`)return r.node}function findNodeRuntime(e){let t=Array.isArray(e)?e:[e];for(let e of t)if(e?.name===`node`&&typeof e.version==`string`)return e.version}return{resolveNodeVersionFile}}const{resolveNodeVersionFile:Uv}=createNodeVersionResolver({getWorkspaceDir,info}),Wv=[{filename:`pnpm-lock.yaml`,type:`pnpm`},{filename:`bun.lockb`,type:`bun`},{filename:`bun.lock`,type:`bun`},{filename:`package-lock.json`,type:`npm`},{filename:`npm-shrinkwrap.json`,type:`npm`},{filename:`yarn.lock`,type:`yarn`}];function resolvePath(e,t){return re(e)?e:P(t,e)}function inferLockFileType(e,t){return t.includes(`pnpm`)?{type:`pnpm`,path:e,filename:t}:t.includes(`yarn`)?{type:`yarn`,path:e,filename:t}:t.startsWith(`bun.`)?{type:`bun`,path:e,filename:t}:{type:`npm`,path:e,filename:t}}function detectLockFile(e,t){if(e){let n=resolvePath(e,t);if(F(n)){let e=te(n),t=Wv.find(t=>t.filename===e);return t?{type:t.type,path:n,filename:e}:inferLockFileType(n,e)}return}let n=me(t);for(let e of Wv)if(n.includes(e.filename)){let n=P(t,e.filename);return{type:e.type,path:n,filename:e.filename}}}function createLockfileResolver(e){let{getWorkspaceDir:t,info:n,debug:r}=e,i=/^\d+\.\d+\.\d+/;function tryResolveVitePlusVersionFromLockfile(e,t){let i=detectLockfileForProject(e,t);if(!i)return;let a=i.filename.endsWith(`.lockb`)?textBunLockBeside(i):i;if(!a){r(`Cannot read ${i.filename} (binary) to resolve the ${aa} version; using "latest". Use the text bun.lock, or set the \`version\` input.`);return}let o=parseVitePlusVersionFromLockfile(a,workspaceSubPath(ne(a.path),e));if(o)return n(`Resolved ${aa} version '${o}' from ${a.filename}`),o;r(`No ${aa} version found in ${a.path}`)}function detectLockfileForProject(e,n){if(n)return detectLockFile(n,e);let r=t(),i=e;for(;;){let e=detectLockFile(void 0,i);if(e)return e;let t=ne(i);if(i===r||t===i||!isWithin(t,r))break;i=t}}function textBunLockBeside(e){let t=P(ne(e.path),`bun.lock`);return F(t)?{type:`bun`,path:t,filename:`bun.lock`}:void 0}function workspaceSubPath(e,t){if(!isWithin(t,e))return``;let n=ie(e,t);return n?n.split(oe).join(`/`):``}function parseVitePlusVersionFromLockfile(e,t=``){if(e.filename.endsWith(`.lockb`))return;let n;try{n=pe(e.path,`utf-8`)}catch{return}let r;switch(e.type){case`npm`:r=fromNpmLock(n,t);break;case`pnpm`:r=fromPnpmLock(n,t);break;case`yarn`:r=fromYarnLock(n);break;case`bun`:r=fromBunTextLock(n);break;default:return}return r&&i.test(r)?r:void 0}function fromNpmLock(e,t){let n;try{n=JSON.parse(e)}catch{return}let r=n.packages;if(t){let e=r?.[`${t}/node_modules/${oa}`]?.version;if(typeof e==`string`)return e;if(!npmPackageDeclaresVitePlus(r?.[t]))return}let i=r?.[`node_modules/${oa}`]?.version;if(typeof i==`string`)return i;let a=n.dependencies?.[oa]?.version;return typeof a==`string`?a:void 0}function npmPackageDeclaresVitePlus(e){if(!e)return!1;for(let t of[`dependencies`,`devDependencies`]){let n=e[t];if(n&&typeof n==`object`&&`vite-plus`in n)return!0}return!1}function fromPnpmLock(e,t){let n;try{n=(0,_i.parse)(e)}catch{return}if(!n||typeof n!=`object`)return;let r=n,i=r.importers;if(i&&typeof i==`object`){let e=t||`.`;return e in i?pnpmImporterVersion(i[e]):void 0}return pnpmImporterVersion(r)||e.match(/^\s*\/?vite-plus@(\d+\.\d+\.\d+[^\s():'"]*)/m)?.[1]}function pnpmImporterVersion(e){if(!e||typeof e!=`object`)return;let t=e;for(let e of[`dependencies`,`devDependencies`,`optionalDependencies`]){let n=t[e];if(n&&typeof n==`object`){let e=n[oa],t=typeof e==`string`?e:e?.version;if(typeof t==`string`){let e=t.replace(/\(.*$/,``).trim();if(i.test(e))return e}}}}function fromYarnLock(e){let t=/* @__PURE__ */ new Set,n=e.split(/\r?\n/);for(let e=0;e!isReservedEnvVar(e)&&!!process.env[e]);if(i.length===0){debug(`Project .npmrc at ${t}: no auth env vars to propagate`);return}info(`Detected project .npmrc at ${t}. Propagating auth env vars: ${i.join(`, `)}`);for(let e of i)exportVariable(e,process.env[e])}async function runMain(e){saveState(`IS_POST`,`true`);let t=getConfiguredProjectDir(e),n=e.nodeVersion;!n&&e.nodeVersionFile&&(n=Uv(e.nodeVersionFile,t));let r=Gv(e,t);await installVitePlus({...e,version:r});let i=e.nodeManager===!1||e.packageManager!==void 0?(await getExecOutput(`vp`,[`--version`],{silent:!0})).stdout:``,a=packageManagerArgs(e.packageManager,i);e.nodeManager===!1?(info(`Disabling Vite+ Node.js version management...`),await exec(`vp`,nodeManagerOffArgs(i))):n&&(info(`Setting up Node.js ${n} via vp env use...`),await exec(`vp`,[`env`,`use`,n]));for(let e of a)await exec(`vp`,e);e.registryUrl?configAuthentication(e.registryUrl,e.scope):propagateProjectNpmrcAuth(t),e.cache&&await restoreCache(e);let o=await setupSfw({...e,version:r});e.runInstall.length>0&&await runViteInstall(e,o),await printViteVersion(t)}async function printViteVersion(e){try{let t=(await getExecOutput(`vp`,[`--version`],{cwd:e,silent:!0})).stdout.trim();info(t);let n=parseInstalledVpVersion(t);saveState(`INSTALLED_VERSION`,n),setOutput(`version`,n)}catch(e){warning(`Could not get vp version: ${String(e)}`),setOutput(`version`,`unknown`)}}async function runPost(e){if(e.cache){if(!e.cacheSave){info(`Cache saving is disabled. Skipping cache save.`);return}await saveCache()}}async function main(){let e=getInputs();getState(`IS_POST`)===`true`?await runPost(e):await runMain(e)}main().catch(e=>{console.error(e),setFailed(e instanceof Error?e.message:String(e))});export{runMain,runPost}; \ No newline at end of file diff --git a/src/ci/process.ts b/src/ci/process.ts index ebbb8c7..716d864 100644 --- a/src/ci/process.ts +++ b/src/ci/process.ts @@ -1,5 +1,4 @@ -import { spawn, spawnSync } from "node:child_process"; -import type { SpawnOptions, SpawnSyncOptions } from "node:child_process"; +import { spawn, spawnSync, type SpawnOptions, type SpawnSyncOptions } from "node:child_process"; import { accessSync, constants, statSync } from "node:fs"; import path from "node:path"; import { isWindows } from "./platform.js"; @@ -47,9 +46,10 @@ export function commandPath( .sort() .find((key) => key.toUpperCase() === "PATH") : "PATH"; - const searchPath = (pathKey && env[pathKey]) || ""; + const searchPath = pathKey ? env[pathKey] || "" : ""; const filename = windows && !command.toLowerCase().endsWith(".exe") ? `${command}.exe` : command; - const cwd = statSync(process.cwd(), { bigint: true }); + const cwdStat = statSync(process.cwd(), { bigint: true }); + const accessMode = windows ? constants.F_OK : constants.X_OK; for (const entry of searchPath.split(path.delimiter)) { const directory = windows ? entry.replace(/^"(.*)"$/, "$1") : entry; @@ -62,11 +62,11 @@ export function commandPath( // Filesystem identity covers case aliases and symlinks without assuming // that all volumes on the same operating system use the same case rules. const directoryStat = statSync(directory, { bigint: true }); - if (directoryStat.dev === cwd.dev && directoryStat.ino === cwd.ino) continue; + if (directoryStat.dev === cwdStat.dev && directoryStat.ino === cwdStat.ino) continue; const candidate = path.join(directory, filename); if (!statSync(candidate).isFile()) continue; - accessSync(candidate, windows ? constants.F_OK : constants.X_OK); + accessSync(candidate, accessMode); return candidate; } catch { // Missing or inaccessible entries do not prevent searching the rest of PATH. diff --git a/src/install-sfw-path.test.ts b/src/install-sfw-path.test.ts index 29a6b9b..daa1c88 100644 --- a/src/install-sfw-path.test.ts +++ b/src/install-sfw-path.test.ts @@ -1,3 +1,7 @@ +import { restoreCache, saveCache } from "@actions/cache"; +import { addPath, setFailed } from "@actions/core"; +import { exec } from "@actions/exec"; +import { execFileSync } from "node:child_process"; import { copyFileSync, existsSync, @@ -9,13 +13,9 @@ import { writeFileSync, } from "node:fs"; import { rm } from "node:fs/promises"; -import { execFileSync } from "node:child_process"; import { tmpdir } from "node:os"; import path from "node:path"; import { afterEach, describe, expect, it, vi } from "vite-plus/test"; -import { restoreCache, saveCache } from "@actions/cache"; -import { addPath, setFailed } from "@actions/core"; -import { exec } from "@actions/exec"; import { setupSfw } from "./ci/install-sfw.js"; import { runInstall } from "./ci/run-install.js"; import { isWindows } from "./ci/platform.js"; @@ -38,6 +38,44 @@ vi.mock("@actions/exec", async (importOriginal) => ({ })); const directories: string[] = []; + +function createFixture(prefix: string): { + root: string; + workspace: string; + trustedBin: string; + filename: string; +} { + const root = mkdtempSync(path.join(tmpdir(), prefix)); + directories.push(root); + const workspace = path.join(root, "workspace"); + const trustedBin = path.join(root, "trusted bin"); + mkdirSync(workspace); + mkdirSync(trustedBin); + return { root, workspace, trustedBin, filename: isWindows() ? "sfw.exe" : "sfw" }; +} + +function setNodePreload(root: string, source: string): void { + const hook = path.join(root, "preload.cjs"); + writeFileSync(hook, source); + vi.stubEnv("NODE_OPTIONS", `--require ${JSON.stringify(hook)}`); +} + +function writeExecutable(file: string): void { + mkdirSync(path.dirname(file), { recursive: true }); + if (isWindows()) { + copyFileSync(process.execPath, file); + } else { + writeFileSync(file, '#!/bin/sh\nprintf "%s\\n" "$0" "$@" > "$SETUP_VP_EXECUTION_MARKER"\n', { + mode: 0o755, + }); + } +} + +function expectSameFile(actual: string, expected: string): void { + const { dev, ino } = statSync(expected, { bigint: true }); + expect(statSync(actual, { bigint: true })).toMatchObject({ dev, ino }); +} + afterEach(async () => { vi.unstubAllEnvs(); vi.resetAllMocks(); @@ -50,45 +88,24 @@ describe.each(["portable", "GitHub Actions"] as const)("%s sfw execution", (adap it.each(["existing", "download", "cache"] as const)( "executes the selected %s binary despite workspace binaries and PATH changes", async (source) => { - const root = mkdtempSync(path.join(tmpdir(), "setup-vp-sfw-execute-")); - directories.push(root); - const workspace = path.join(root, "workspace"); + const { root, workspace, trustedBin, filename } = createFixture("setup-vp-sfw-execute-"); const installDir = path.join(workspace, "install directory"); - const trustedBin = path.join(root, "trusted bin"); const marker = path.join(root, "executed"); - const filename = isWindows() ? "sfw.exe" : "sfw"; - mkdirSync(installDir, { recursive: true }); - mkdirSync(trustedBin); + mkdirSync(installDir); vi.stubEnv("SETUP_VP_EXECUTION_MARKER", marker); vi.stubEnv("RUNNER_TEMP", root); vi.stubEnv("SETUP_VP_SFW_CACHE_DIR", undefined); vi.stubEnv("NoDefaultCurrentDirectoryInExePath", undefined); if (isWindows()) { - const hook = path.join(root, "record.cjs"); - writeFileSync( - hook, + setNodePreload( + root, `const fs = require('node:fs'); fs.writeFileSync(process.env.SETUP_VP_EXECUTION_MARKER, [process.argv0, ...process.argv.slice(1)].join('\\n') + '\\n'); process.exit(0);`, ); - vi.stubEnv("NODE_OPTIONS", `--require ${JSON.stringify(hook)}`); } - function writeExecutable(file: string): void { - mkdirSync(path.dirname(file), { recursive: true }); - if (isWindows()) { - copyFileSync(process.execPath, file); - } else { - writeFileSync( - file, - '#!/bin/sh\nprintf "%s\\n" "$0" "$@" > "$SETUP_VP_EXECUTION_MARKER"\n', - { - mode: 0o755, - }, - ); - } - } writeExecutable(path.join(workspace, filename)); writeExecutable(path.join(installDir, filename)); const existing = path.join(trustedBin, filename); @@ -142,11 +159,7 @@ process.exit(0);`, else await runViteInstall(inputs, command); expect(setFailed).not.toHaveBeenCalled(); const [executed, wrapped, ...args] = readFileSync(marker, "utf8").trimEnd().split("\n"); - const expected = statSync(command.executable, { bigint: true }); - expect(statSync(executed!, { bigint: true })).toMatchObject({ - dev: expected.dev, - ino: expected.ino, - }); + expectSameFile(executed!, command.executable); // Node normalizes the first argument to a path before the Windows preload hook. expect(path.basename(wrapped!)).toBe("vp"); expect(args).toEqual(["install", "--frozen-lockfile", "", "two words"]); @@ -162,28 +175,19 @@ process.exit(0);`, it.skipIf(!isWindows())( "rejects a drive-root-relative PATH entry before executing on a different Windows drive", async () => { - const root = mkdtempSync(path.join(tmpdir(), "setup-vp-sfw-drives-")); - directories.push(root); - const workspace = path.join(root, "workspace"); - const trustedBin = path.join(root, "trusted"); + const { root, workspace, trustedBin, filename } = createFixture("setup-vp-sfw-drives-"); const otherDriveRoot = path.join(root, "other-drive"); - mkdirSync(workspace); - mkdirSync(trustedBin); mkdirSync(otherDriveRoot); - const trusted = path.join(trustedBin, "sfw.exe"); - copyFileSync(process.execPath, trusted); + const trusted = path.join(trustedBin, filename); + writeExecutable(trusted); const relativeBin = trustedBin.slice(path.parse(trustedBin).root.length - 1); - const otherBinary = path.join(otherDriveRoot, relativeBin.slice(1), "sfw.exe"); - mkdirSync(path.dirname(otherBinary), { recursive: true }); - copyFileSync(process.execPath, otherBinary); + writeExecutable(path.join(otherDriveRoot, relativeBin.slice(1), filename)); const marker = path.join(root, "executed"); - const hook = path.join(root, "record.cjs"); - writeFileSync( - hook, + setNodePreload( + root, "require('node:fs').writeFileSync(process.env.SETUP_VP_EXECUTION_MARKER, process.execPath); process.exit(0);", ); vi.stubEnv("SETUP_VP_EXECUTION_MARKER", marker); - vi.stubEnv("NODE_OPTIONS", `--require ${JSON.stringify(hook)}`); vi.stubEnv("PATH", `${relativeBin};${trustedBin}`); // SUBST creates a second drive without needing another physical volume. @@ -203,12 +207,7 @@ it.skipIf(!isWindows())( await runInstall([{}], installCwd, command); - const executed = readFileSync(marker, "utf8"); - const expected = statSync(trusted, { bigint: true }); - expect(statSync(executed, { bigint: true })).toMatchObject({ - dev: expected.dev, - ino: expected.ino, - }); + expectSameFile(readFileSync(marker, "utf8"), trusted); } finally { process.chdir(originalCwd); execFileSync(subst, [drive!, "/D"]); @@ -218,15 +217,9 @@ it.skipIf(!isWindows())( ); it("does not execute planted lookup tools or reuse sfw from the working directory", async () => { - const root = mkdtempSync(path.join(tmpdir(), "setup-vp-sfw-path-")); - directories.push(root); - const workspace = path.join(root, "workspace"); - const trustedBin = path.join(root, "trusted bin"); + const { root, workspace, trustedBin, filename } = createFixture("setup-vp-sfw-path-"); const alias = path.join(root, "workspace-alias"); const marker = path.join(root, "lookup-executed"); - const filename = isWindows() ? "sfw.exe" : "sfw"; - mkdirSync(workspace); - mkdirSync(trustedBin); symlinkSync(workspace, alias, isWindows() ? "junction" : "dir"); writeFileSync(path.join(workspace, filename), "workspace executable", { mode: 0o755 }); vi.stubEnv("SETUP_VP_LOOKUP_MARKER", marker); @@ -235,12 +228,10 @@ it("does not execute planted lookup tools or reuse sfw from the working director // A real PE executable makes a regressed execFileSync/spawnSync('where') // run the harmless marker hook, even without invoking a shell. copyFileSync(process.execPath, path.join(workspace, "where.exe")); - const hook = path.join(root, "marker.cjs"); - writeFileSync( - hook, + setNodePreload( + root, "require('node:fs').writeFileSync(process.env.SETUP_VP_LOOKUP_MARKER, 'called'); process.exit(1);", ); - vi.stubEnv("NODE_OPTIONS", `--require ${JSON.stringify(hook)}`); writeFileSync( path.join(workspace, "where.cmd"), '@echo called > "%SETUP_VP_LOOKUP_MARKER%"\r\n@exit /b 1\r\n', diff --git a/src/install-sfw.test.ts b/src/install-sfw.test.ts index df69367..64e1c34 100644 --- a/src/install-sfw.test.ts +++ b/src/install-sfw.test.ts @@ -224,26 +224,22 @@ describe("setupSfw", () => { expect(warning).not.toHaveBeenCalled(); }); - it("uses an existing sfw on PATH on macOS and skips the download", async () => { - // macOS is supported as of vp v0.1.23 — the PATH-detection branch now - // applies to all platforms, not just Linux. - stubPlatform("darwin", "arm64"); - vi.mocked(commandPath).mockReturnValue("/usr/local/bin/sfw"); - expect(await setupSfw(makeInputs())).toEqual({ executable: "/usr/local/bin/sfw", sfw: true }); - expect(info).toHaveBeenCalledWith(expect.stringContaining("Using existing sfw on PATH")); - expect(commandPath).toHaveBeenCalledExactlyOnceWith("sfw"); - expect(restoreCache).not.toHaveBeenCalled(); // installSfw never invoked - expect(exec).not.toHaveBeenCalled(); - }); + it.each([ + ["darwin", "arm64", "/usr/local/bin/sfw"], + ["linux", "x64", "/usr/bin/sfw"], + ] as const)( + "uses an existing sfw on PATH on %s and skips the download", + async (platform, arch, executable) => { + stubPlatform(platform, arch); + vi.mocked(commandPath).mockReturnValue(executable); - it("uses an existing sfw on PATH on Linux and skips the download", async () => { - vi.mocked(commandPath).mockReturnValue("/usr/bin/sfw"); - expect(await setupSfw(makeInputs())).toEqual({ executable: "/usr/bin/sfw", sfw: true }); - expect(info).toHaveBeenCalledWith(expect.stringContaining("Using existing sfw on PATH")); - expect(commandPath).toHaveBeenCalledExactlyOnceWith("sfw"); - expect(restoreCache).not.toHaveBeenCalled(); - expect(exec).not.toHaveBeenCalled(); - }); + expect(await setupSfw(makeInputs())).toEqual({ executable, sfw: true }); + expect(info).toHaveBeenCalledWith(expect.stringContaining("Using existing sfw on PATH")); + expect(commandPath).toHaveBeenCalledExactlyOnceWith("sfw"); + expect(restoreCache).not.toHaveBeenCalled(); + expect(exec).not.toHaveBeenCalled(); + }, + ); it("falls back with a warning on an unsupported arch + no sfw on PATH", async () => { stubPlatform("linux", "ia32"); diff --git a/src/run-install.ts b/src/run-install.ts index 08473f1..e28afda 100644 --- a/src/run-install.ts +++ b/src/run-install.ts @@ -1,5 +1,5 @@ import { startGroup, endGroup, setFailed, info, warning, error as logError } from "@actions/core"; -import { getExecOutput } from "@actions/exec"; +import { getExecOutput, type ExecOutput } from "@actions/exec"; import type { Inputs } from "./types.js"; import type { InstallCommand } from "./ci/types.js"; import { getConfiguredProjectDir, getInstallCwd } from "./utils.js"; @@ -45,56 +45,53 @@ export async function runViteInstall( installCommand: InstallCommand, ): Promise { const projectDir = getConfiguredProjectDir(inputs); - const { executable: cmd, sfw } = installCommand; + const { executable, sfw } = installCommand; + // @actions/exec parses its first parameter as a command line. + const commandLine = `"${executable.replaceAll('"', '\\"')}"`; for (const options of inputs.runInstall) { - const installArgs = ["install"]; - if (options.args) { - installArgs.push(...options.args); - } - + const installArgs = ["install", ...(options.args || [])]; const args = sfw ? ["vp", ...installArgs] : installArgs; const cwd = getInstallCwd(projectDir, options.cwd); - const cmdStr = `${cmd} ${args.join(" ")}`; + const commandLabel = `${executable} ${args.join(" ")}`; - const attempt = async (label: string) => { + async function attempt(label: string): Promise { startGroup(`Running ${label} in ${cwd}...`); try { - // @actions/exec parses its first parameter as a command line. - return await getExecOutput(`"${cmd.replaceAll('"', '\\"')}"`, args, { + return await getExecOutput(commandLine, args, { cwd, ignoreReturnCode: true, }); } finally { endGroup(); } - }; + } try { - let result = await attempt(cmdStr); + let result = await attempt(commandLabel); if (result.exitCode !== 0 && sfw && isSfwVpNotFoundFlake(result.stdout, result.stderr)) { warning( "sfw reported vp as not found even though it is on PATH. This is a known sfw flake on Windows: a cold PowerShell start exceeds sfw's 10s command-resolution timeout and the timeout is misreported as not-found. Warming the PowerShell command cache and retrying once.", ); await warmPowerShellCommandCache(); - result = await attempt(`${cmdStr} (retry)`); + result = await attempt(`${commandLabel} (retry)`); } if (result.exitCode === 0) { - info(`Successfully ran ${cmdStr}`); + info(`Successfully ran ${commandLabel}`); continue; } const detail = result.stderr.trim() || result.stdout.trim(); if (detail) { logError(tailOutput(detail, MAX_ERROR_TAIL), { - title: `${cmdStr} failed`, + title: `${commandLabel} failed`, }); } - setFailed(`Command "${cmdStr}" (cwd: ${cwd}) exited with code ${result.exitCode}`); + setFailed(`Command "${commandLabel}" (cwd: ${cwd}) exited with code ${result.exitCode}`); } catch (error) { - setFailed(`Failed to run ${cmdStr}: ${String(error)}`); + setFailed(`Failed to run ${commandLabel}: ${String(error)}`); } } }