@adobe/aio-commerce-lib-app 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,144 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * @license
4
+ *
5
+ * Copyright 2025 Adobe. All rights reserved.
6
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License. You may obtain a copy
8
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software distributed under
11
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
+ * OF ANY KIND, either express or implied. See the License for the specific language
13
+ * governing permissions and limitations under the License.
14
+ */
15
+ import{c as getExecCommand,l as makeOutputDirFor,s as detectPackageManager,t as parseCommerceAppConfig,u as stringifyError}from"../parser-BoZ6cYn-.mjs";import{createRequire}from"module";import{readFile,writeFile}from"fs/promises";import{basename,dirname,join,relative}from"path";import{existsSync}from"fs";import consola,{consola as consola$1}from"consola";import{fileURLToPath}from"url";import{formatTree}from"consola/utils";var __commonJSMin=(cb,mod)=>()=>(mod||cb((mod={exports:{}}).exports,mod),mod.exports),__require=createRequire(import.meta.url),require_identity=__commonJSMin((exports=>{let ALIAS=Symbol.for(`yaml.alias`),DOC=Symbol.for(`yaml.document`),MAP=Symbol.for(`yaml.map`),PAIR=Symbol.for(`yaml.pair`),SCALAR$1=Symbol.for(`yaml.scalar`),SEQ=Symbol.for(`yaml.seq`),NODE_TYPE=Symbol.for(`yaml.node.type`),isAlias=node=>!!node&&typeof node==`object`&&node[NODE_TYPE]===ALIAS,isDocument=node=>!!node&&typeof node==`object`&&node[NODE_TYPE]===DOC,isMap$2=node=>!!node&&typeof node==`object`&&node[NODE_TYPE]===MAP,isPair=node=>!!node&&typeof node==`object`&&node[NODE_TYPE]===PAIR,isScalar$1=node=>!!node&&typeof node==`object`&&node[NODE_TYPE]===SCALAR$1,isSeq$1=node=>!!node&&typeof node==`object`&&node[NODE_TYPE]===SEQ;function isCollection$1(node){if(node&&typeof node==`object`)switch(node[NODE_TYPE]){case MAP:case SEQ:return!0}return!1}function isNode(node){if(node&&typeof node==`object`)switch(node[NODE_TYPE]){case ALIAS:case MAP:case SCALAR$1:case SEQ:return!0}return!1}exports.ALIAS=ALIAS,exports.DOC=DOC,exports.MAP=MAP,exports.NODE_TYPE=NODE_TYPE,exports.PAIR=PAIR,exports.SCALAR=SCALAR$1,exports.SEQ=SEQ,exports.hasAnchor=node=>(isScalar$1(node)||isCollection$1(node))&&!!node.anchor,exports.isAlias=isAlias,exports.isCollection=isCollection$1,exports.isDocument=isDocument,exports.isMap=isMap$2,exports.isNode=isNode,exports.isPair=isPair,exports.isScalar=isScalar$1,exports.isSeq=isSeq$1})),require_visit=__commonJSMin((exports=>{var identity$32=require_identity();let BREAK$1=Symbol(`break visit`),SKIP$1=Symbol(`skip children`),REMOVE$1=Symbol(`remove node`);function visit$5(node,visitor){let visitor_=initVisitor(visitor);identity$32.isDocument(node)?visit_(null,node.contents,visitor_,Object.freeze([node]))===REMOVE$1&&(node.contents=null):visit_(null,node,visitor_,Object.freeze([]))}visit$5.BREAK=BREAK$1,visit$5.SKIP=SKIP$1,visit$5.REMOVE=REMOVE$1;function visit_(key,node,visitor,path){let ctrl=callVisitor(key,node,visitor,path);if(identity$32.isNode(ctrl)||identity$32.isPair(ctrl))return replaceNode(key,path,ctrl),visit_(key,ctrl,visitor,path);if(typeof ctrl!=`symbol`){if(identity$32.isCollection(node)){path=Object.freeze(path.concat(node));for(let i=0;i<node.items.length;++i){let ci=visit_(i,node.items[i],visitor,path);if(typeof ci==`number`)i=ci-1;else if(ci===BREAK$1)return BREAK$1;else ci===REMOVE$1&&(node.items.splice(i,1),--i)}}else if(identity$32.isPair(node)){path=Object.freeze(path.concat(node));let ck=visit_(`key`,node.key,visitor,path);if(ck===BREAK$1)return BREAK$1;ck===REMOVE$1&&(node.key=null);let cv=visit_(`value`,node.value,visitor,path);if(cv===BREAK$1)return BREAK$1;cv===REMOVE$1&&(node.value=null)}}return ctrl}async function visitAsync(node,visitor){let visitor_=initVisitor(visitor);identity$32.isDocument(node)?await visitAsync_(null,node.contents,visitor_,Object.freeze([node]))===REMOVE$1&&(node.contents=null):await visitAsync_(null,node,visitor_,Object.freeze([]))}visitAsync.BREAK=BREAK$1,visitAsync.SKIP=SKIP$1,visitAsync.REMOVE=REMOVE$1;async function visitAsync_(key,node,visitor,path){let ctrl=await callVisitor(key,node,visitor,path);if(identity$32.isNode(ctrl)||identity$32.isPair(ctrl))return replaceNode(key,path,ctrl),visitAsync_(key,ctrl,visitor,path);if(typeof ctrl!=`symbol`){if(identity$32.isCollection(node)){path=Object.freeze(path.concat(node));for(let i=0;i<node.items.length;++i){let ci=await visitAsync_(i,node.items[i],visitor,path);if(typeof ci==`number`)i=ci-1;else if(ci===BREAK$1)return BREAK$1;else ci===REMOVE$1&&(node.items.splice(i,1),--i)}}else if(identity$32.isPair(node)){path=Object.freeze(path.concat(node));let ck=await visitAsync_(`key`,node.key,visitor,path);if(ck===BREAK$1)return BREAK$1;ck===REMOVE$1&&(node.key=null);let cv=await visitAsync_(`value`,node.value,visitor,path);if(cv===BREAK$1)return BREAK$1;cv===REMOVE$1&&(node.value=null)}}return ctrl}function initVisitor(visitor){return typeof visitor==`object`&&(visitor.Collection||visitor.Node||visitor.Value)?Object.assign({Alias:visitor.Node,Map:visitor.Node,Scalar:visitor.Node,Seq:visitor.Node},visitor.Value&&{Map:visitor.Value,Scalar:visitor.Value,Seq:visitor.Value},visitor.Collection&&{Map:visitor.Collection,Seq:visitor.Collection},visitor):visitor}function callVisitor(key,node,visitor,path){if(typeof visitor==`function`)return visitor(key,node,path);if(identity$32.isMap(node))return visitor.Map?.(key,node,path);if(identity$32.isSeq(node))return visitor.Seq?.(key,node,path);if(identity$32.isPair(node))return visitor.Pair?.(key,node,path);if(identity$32.isScalar(node))return visitor.Scalar?.(key,node,path);if(identity$32.isAlias(node))return visitor.Alias?.(key,node,path)}function replaceNode(key,path,node){let parent=path[path.length-1];if(identity$32.isCollection(parent))parent.items[key]=node;else if(identity$32.isPair(parent))key===`key`?parent.key=node:parent.value=node;else if(identity$32.isDocument(parent))parent.contents=node;else{let pt=identity$32.isAlias(parent)?`alias`:`scalar`;throw Error(`Cannot replace node with ${pt} parent`)}}exports.visit=visit$5,exports.visitAsync=visitAsync})),require_directives=__commonJSMin((exports=>{var identity$31=require_identity(),visit$4=require_visit();let escapeChars={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},escapeTagName=tn=>tn.replace(/[!,[\]{}]/g,ch=>escapeChars[ch]);var Directives=class Directives{constructor(yaml,tags$1){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},Directives.defaultYaml,yaml),this.tags=Object.assign({},Directives.defaultTags,tags$1)}clone(){let copy=new Directives(this.yaml,this.tags);return copy.docStart=this.docStart,copy}atDocument(){let res=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);break}return res}add(line,onError){this.atNextDocument&&=(this.yaml={explicit:Directives.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},Directives.defaultTags),!1);let parts=line.trim().split(/[ \t]+/),name=parts.shift();switch(name){case`%TAG`:{if(parts.length!==2&&(onError(0,`%TAG directive should contain exactly two parts`),parts.length<2))return!1;let[handle,prefix]=parts;return this.tags[handle]=prefix,!0}case`%YAML`:{if(this.yaml.explicit=!0,parts.length!==1)return onError(0,`%YAML directive should contain exactly one part`),!1;let[version]=parts;if(version===`1.1`||version===`1.2`)return this.yaml.version=version,!0;{let isValid=/^\d+\.\d+$/.test(version);return onError(6,`Unsupported YAML version ${version}`,isValid),!1}}default:return onError(0,`Unknown directive ${name}`,!0),!1}}tagName(source,onError){if(source===`!`)return`!`;if(source[0]!==`!`)return onError(`Not a valid tag: ${source}`),null;if(source[1]===`<`){let verbatim=source.slice(2,-1);return verbatim===`!`||verbatim===`!!`?(onError(`Verbatim tags aren't resolved, so ${source} is invalid.`),null):(source[source.length-1]!==`>`&&onError(`Verbatim tags must end with a >`),verbatim)}let[,handle,suffix]=source.match(/^(.*!)([^!]*)$/s);suffix||onError(`The ${source} tag has no suffix`);let prefix=this.tags[handle];if(prefix)try{return prefix+decodeURIComponent(suffix)}catch(error){return onError(String(error)),null}return handle===`!`?source:(onError(`Could not resolve tag: ${source}`),null)}tagString(tag){for(let[handle,prefix]of Object.entries(this.tags))if(tag.startsWith(prefix))return handle+escapeTagName(tag.substring(prefix.length));return tag[0]===`!`?tag:`!<${tag}>`}toString(doc){let lines=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],tagEntries=Object.entries(this.tags),tagNames;if(doc&&tagEntries.length>0&&identity$31.isNode(doc.contents)){let tags$1={};visit$4.visit(doc.contents,(_key,node)=>{identity$31.isNode(node)&&node.tag&&(tags$1[node.tag]=!0)}),tagNames=Object.keys(tags$1)}else tagNames=[];for(let[handle,prefix]of tagEntries)handle===`!!`&&prefix===`tag:yaml.org,2002:`||(!doc||tagNames.some(tn=>tn.startsWith(prefix)))&&lines.push(`%TAG ${handle} ${prefix}`);return lines.join(`
16
+ `)}};Directives.defaultYaml={explicit:!1,version:`1.2`},Directives.defaultTags={"!!":`tag:yaml.org,2002:`},exports.Directives=Directives})),require_anchors=__commonJSMin((exports=>{var identity$30=require_identity(),visit$3=require_visit();function anchorIsValid(anchor){if(/[\x00-\x19\s,[\]{}]/.test(anchor)){let msg=`Anchor must not contain whitespace or control characters: ${JSON.stringify(anchor)}`;throw Error(msg)}return!0}function anchorNames(root){let anchors$3=new Set;return visit$3.visit(root,{Value(_key,node){node.anchor&&anchors$3.add(node.anchor)}}),anchors$3}function findNewAnchor(prefix,exclude){for(let i=1;;++i){let name=`${prefix}${i}`;if(!exclude.has(name))return name}}function createNodeAnchors(doc,prefix){let aliasObjects=[],sourceObjects=new Map,prevAnchors=null;return{onAnchor:source=>{aliasObjects.push(source),prevAnchors??=anchorNames(doc);let anchor=findNewAnchor(prefix,prevAnchors);return prevAnchors.add(anchor),anchor},setAnchors:()=>{for(let source of aliasObjects){let ref=sourceObjects.get(source);if(typeof ref==`object`&&ref.anchor&&(identity$30.isScalar(ref.node)||identity$30.isCollection(ref.node)))ref.node.anchor=ref.anchor;else{let error=Error(`Failed to resolve repeated object (this should not happen)`);throw error.source=source,error}}},sourceObjects}}exports.anchorIsValid=anchorIsValid,exports.anchorNames=anchorNames,exports.createNodeAnchors=createNodeAnchors,exports.findNewAnchor=findNewAnchor})),require_applyReviver=__commonJSMin((exports=>{function applyReviver$2(reviver,obj,key,val){if(val&&typeof val==`object`)if(Array.isArray(val))for(let i=0,len=val.length;i<len;++i){let v0=val[i],v1=applyReviver$2(reviver,val,String(i),v0);v1===void 0?delete val[i]:v1!==v0&&(val[i]=v1)}else if(val instanceof Map)for(let k of Array.from(val.keys())){let v0=val.get(k),v1=applyReviver$2(reviver,val,k,v0);v1===void 0?val.delete(k):v1!==v0&&val.set(k,v1)}else if(val instanceof Set)for(let v0 of Array.from(val)){let v1=applyReviver$2(reviver,val,v0,v0);v1===void 0?val.delete(v0):v1!==v0&&(val.delete(v0),val.add(v1))}else for(let[k,v0]of Object.entries(val)){let v1=applyReviver$2(reviver,val,k,v0);v1===void 0?delete val[k]:v1!==v0&&(val[k]=v1)}return reviver.call(obj,key,val)}exports.applyReviver=applyReviver$2})),require_toJS=__commonJSMin((exports=>{var identity$29=require_identity();function toJS$7(value,arg,ctx){if(Array.isArray(value))return value.map((v,i)=>toJS$7(v,String(i),ctx));if(value&&typeof value.toJSON==`function`){if(!ctx||!identity$29.hasAnchor(value))return value.toJSON(arg,ctx);let data={aliasCount:0,count:1,res:void 0};ctx.anchors.set(value,data),ctx.onCreate=res$1=>{data.res=res$1,delete ctx.onCreate};let res=value.toJSON(arg,ctx);return ctx.onCreate&&ctx.onCreate(res),res}return typeof value==`bigint`&&!ctx?.keep?Number(value):value}exports.toJS=toJS$7})),require_Node=__commonJSMin((exports=>{var applyReviver$1=require_applyReviver(),identity$28=require_identity(),toJS$6=require_toJS();exports.NodeBase=class{constructor(type){Object.defineProperty(this,identity$28.NODE_TYPE,{value:type})}clone(){let copy=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(copy.range=this.range.slice()),copy}toJS(doc,{mapAsMap,maxAliasCount,onAnchor,reviver}={}){if(!identity$28.isDocument(doc))throw TypeError(`A document argument is required`);let ctx={anchors:new Map,doc,keep:!0,mapAsMap:mapAsMap===!0,mapKeyWarned:!1,maxAliasCount:typeof maxAliasCount==`number`?maxAliasCount:100},res=toJS$6.toJS(this,``,ctx);if(typeof onAnchor==`function`)for(let{count,res:res$1}of ctx.anchors.values())onAnchor(res$1,count);return typeof reviver==`function`?applyReviver$1.applyReviver(reviver,{"":res},``,res):res}}})),require_Alias=__commonJSMin((exports=>{var anchors$2=require_anchors(),visit$2=require_visit(),identity$27=require_identity(),Node$2=require_Node(),toJS$5=require_toJS(),Alias$4=class extends Node$2.NodeBase{constructor(source){super(identity$27.ALIAS),this.source=source,Object.defineProperty(this,`tag`,{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(doc,ctx){let nodes;ctx?.aliasResolveCache?nodes=ctx.aliasResolveCache:(nodes=[],visit$2.visit(doc,{Node:(_key,node)=>{(identity$27.isAlias(node)||identity$27.hasAnchor(node))&&nodes.push(node)}}),ctx&&(ctx.aliasResolveCache=nodes));let found;for(let node of nodes){if(node===this)break;node.anchor===this.source&&(found=node)}return found}toJSON(_arg,ctx){if(!ctx)return{source:this.source};let{anchors:anchors$3,doc,maxAliasCount}=ctx,source=this.resolve(doc,ctx);if(!source){let msg=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(msg)}let data=anchors$3.get(source);if(data||=(toJS$5.toJS(source,null,ctx),anchors$3.get(source)),!data||data.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(maxAliasCount>=0&&(data.count+=1,data.aliasCount===0&&(data.aliasCount=getAliasCount(doc,source,anchors$3)),data.count*data.aliasCount>maxAliasCount))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`);return data.res}toString(ctx,_onComment,_onChompKeep){let src=`*${this.source}`;if(ctx){if(anchors$2.anchorIsValid(this.source),ctx.options.verifyAliasOrder&&!ctx.anchors.has(this.source)){let msg=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(msg)}if(ctx.implicitKey)return`${src} `}return src}};function getAliasCount(doc,node,anchors$3){if(identity$27.isAlias(node)){let source=node.resolve(doc),anchor=anchors$3&&source&&anchors$3.get(source);return anchor?anchor.count*anchor.aliasCount:0}else if(identity$27.isCollection(node)){let count=0;for(let item of node.items){let c=getAliasCount(doc,item,anchors$3);c>count&&(count=c)}return count}else if(identity$27.isPair(node)){let kc=getAliasCount(doc,node.key,anchors$3),vc=getAliasCount(doc,node.value,anchors$3);return Math.max(kc,vc)}return 1}exports.Alias=Alias$4})),require_Scalar=__commonJSMin((exports=>{var identity$26=require_identity(),Node$1=require_Node(),toJS$4=require_toJS();let isScalarValue=value=>!value||typeof value!=`function`&&typeof value!=`object`;var Scalar$19=class extends Node$1.NodeBase{constructor(value){super(identity$26.SCALAR),this.value=value}toJSON(arg,ctx){return ctx?.keep?this.value:toJS$4.toJS(this.value,arg,ctx)}toString(){return String(this.value)}};Scalar$19.BLOCK_FOLDED=`BLOCK_FOLDED`,Scalar$19.BLOCK_LITERAL=`BLOCK_LITERAL`,Scalar$19.PLAIN=`PLAIN`,Scalar$19.QUOTE_DOUBLE=`QUOTE_DOUBLE`,Scalar$19.QUOTE_SINGLE=`QUOTE_SINGLE`,exports.Scalar=Scalar$19,exports.isScalarValue=isScalarValue})),require_createNode=__commonJSMin((exports=>{var Alias$3=require_Alias(),identity$25=require_identity(),Scalar$18=require_Scalar();function findTagObject(value,tagName,tags$1){if(tagName){let match=tags$1.filter(t=>t.tag===tagName),tagObj=match.find(t=>!t.format)??match[0];if(!tagObj)throw Error(`Tag ${tagName} not found`);return tagObj}return tags$1.find(t=>t.identify?.(value)&&!t.format)}function createNode$4(value,tagName,ctx){if(identity$25.isDocument(value)&&(value=value.contents),identity$25.isNode(value))return value;if(identity$25.isPair(value)){let map$6=ctx.schema[identity$25.MAP].createNode?.(ctx.schema,null,ctx);return map$6.items.push(value),map$6}(value instanceof String||value instanceof Number||value instanceof Boolean||typeof BigInt<`u`&&value instanceof BigInt)&&(value=value.valueOf());let{aliasDuplicateObjects,onAnchor,onTagObj,schema:schema$6,sourceObjects}=ctx,ref;if(aliasDuplicateObjects&&value&&typeof value==`object`){if(ref=sourceObjects.get(value),ref)return ref.anchor??=onAnchor(value),new Alias$3.Alias(ref.anchor);ref={anchor:null,node:null},sourceObjects.set(value,ref)}tagName?.startsWith(`!!`)&&(tagName=`tag:yaml.org,2002:`+tagName.slice(2));let tagObj=findTagObject(value,tagName,schema$6.tags);if(!tagObj){if(value&&typeof value.toJSON==`function`&&(value=value.toJSON()),!value||typeof value!=`object`){let node$1=new Scalar$18.Scalar(value);return ref&&(ref.node=node$1),node$1}tagObj=value instanceof Map?schema$6[identity$25.MAP]:Symbol.iterator in Object(value)?schema$6[identity$25.SEQ]:schema$6[identity$25.MAP]}onTagObj&&(onTagObj(tagObj),delete ctx.onTagObj);let node=tagObj?.createNode?tagObj.createNode(ctx.schema,value,ctx):typeof tagObj?.nodeClass?.from==`function`?tagObj.nodeClass.from(ctx.schema,value,ctx):new Scalar$18.Scalar(value);return tagName?node.tag=tagName:tagObj.default||(node.tag=tagObj.tag),ref&&(ref.node=node),node}exports.createNode=createNode$4})),require_Collection=__commonJSMin((exports=>{var createNode$3=require_createNode(),identity$24=require_identity(),Node=require_Node();function collectionFromPath(schema$6,path,value){let v=value;for(let i=path.length-1;i>=0;--i){let k=path[i];if(typeof k==`number`&&Number.isInteger(k)&&k>=0){let a=[];a[k]=v,v=a}else v=new Map([[k,v]])}return createNode$3.createNode(v,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:schema$6,sourceObjects:new Map})}let isEmptyPath=path=>path==null||typeof path==`object`&&!!path[Symbol.iterator]().next().done;exports.Collection=class extends Node.NodeBase{constructor(type,schema$6){super(type),Object.defineProperty(this,`schema`,{value:schema$6,configurable:!0,enumerable:!1,writable:!0})}clone(schema$6){let copy=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return schema$6&&(copy.schema=schema$6),copy.items=copy.items.map(it=>identity$24.isNode(it)||identity$24.isPair(it)?it.clone(schema$6):it),this.range&&(copy.range=this.range.slice()),copy}addIn(path,value){if(isEmptyPath(path))this.add(value);else{let[key,...rest]=path,node=this.get(key,!0);if(identity$24.isCollection(node))node.addIn(rest,value);else if(node===void 0&&this.schema)this.set(key,collectionFromPath(this.schema,rest,value));else throw Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`)}}deleteIn(path){let[key,...rest]=path;if(rest.length===0)return this.delete(key);let node=this.get(key,!0);if(identity$24.isCollection(node))return node.deleteIn(rest);throw Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`)}getIn(path,keepScalar){let[key,...rest]=path,node=this.get(key,!0);return rest.length===0?!keepScalar&&identity$24.isScalar(node)?node.value:node:identity$24.isCollection(node)?node.getIn(rest,keepScalar):void 0}hasAllNullValues(allowScalar){return this.items.every(node=>{if(!identity$24.isPair(node))return!1;let n=node.value;return n==null||allowScalar&&identity$24.isScalar(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(path){let[key,...rest]=path;if(rest.length===0)return this.has(key);let node=this.get(key,!0);return identity$24.isCollection(node)?node.hasIn(rest):!1}setIn(path,value){let[key,...rest]=path;if(rest.length===0)this.set(key,value);else{let node=this.get(key,!0);if(identity$24.isCollection(node))node.setIn(rest,value);else if(node===void 0&&this.schema)this.set(key,collectionFromPath(this.schema,rest,value));else throw Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`)}}},exports.collectionFromPath=collectionFromPath,exports.isEmptyPath=isEmptyPath})),require_stringifyComment=__commonJSMin((exports=>{let stringifyComment$4=str=>str.replace(/^(?!$)(?: $)?/gm,`#`);function indentComment(comment,indent){return/^\n+$/.test(comment)?comment.substring(1):indent?comment.replace(/^(?! *$)/gm,indent):comment}exports.indentComment=indentComment,exports.lineComment=(str,indent,comment)=>str.endsWith(`
17
+ `)?indentComment(comment,indent):comment.includes(`
18
+ `)?`
19
+ `+indentComment(comment,indent):(str.endsWith(` `)?``:` `)+comment,exports.stringifyComment=stringifyComment$4})),require_foldFlowLines=__commonJSMin((exports=>{let FOLD_BLOCK=`block`,FOLD_QUOTED=`quoted`;function foldFlowLines$1(text,indent,mode=`flow`,{indentAtStart,lineWidth=80,minContentWidth=20,onFold,onOverflow}={}){if(!lineWidth||lineWidth<0)return text;lineWidth<minContentWidth&&(minContentWidth=0);let endStep=Math.max(1+minContentWidth,1+lineWidth-indent.length);if(text.length<=endStep)return text;let folds=[],escapedFolds={},end=lineWidth-indent.length;typeof indentAtStart==`number`&&(indentAtStart>lineWidth-Math.max(2,minContentWidth)?folds.push(0):end=lineWidth-indentAtStart);let split,prev,overflow=!1,i=-1,escStart=-1,escEnd=-1;mode===FOLD_BLOCK&&(i=consumeMoreIndentedLines(text,i,indent.length),i!==-1&&(end=i+endStep));for(let ch;ch=text[i+=1];){if(mode===FOLD_QUOTED&&ch===`\\`){switch(escStart=i,text[i+1]){case`x`:i+=3;break;case`u`:i+=5;break;case`U`:i+=9;break;default:i+=1}escEnd=i}if(ch===`
20
+ `)mode===FOLD_BLOCK&&(i=consumeMoreIndentedLines(text,i,indent.length)),end=i+indent.length+endStep,split=void 0;else{if(ch===` `&&prev&&prev!==` `&&prev!==`
21
+ `&&prev!==` `){let next=text[i+1];next&&next!==` `&&next!==`
22
+ `&&next!==` `&&(split=i)}if(i>=end)if(split)folds.push(split),end=split+endStep,split=void 0;else if(mode===FOLD_QUOTED){for(;prev===` `||prev===` `;)prev=ch,ch=text[i+=1],overflow=!0;let j=i>escEnd+1?i-2:escStart-1;if(escapedFolds[j])return text;folds.push(j),escapedFolds[j]=!0,end=j+endStep,split=void 0}else overflow=!0}prev=ch}if(overflow&&onOverflow&&onOverflow(),folds.length===0)return text;onFold&&onFold();let res=text.slice(0,folds[0]);for(let i$1=0;i$1<folds.length;++i$1){let fold=folds[i$1],end$1=folds[i$1+1]||text.length;fold===0?res=`\n${indent}${text.slice(0,end$1)}`:(mode===FOLD_QUOTED&&escapedFolds[fold]&&(res+=`${text[fold]}\\`),res+=`\n${indent}${text.slice(fold+1,end$1)}`)}return res}function consumeMoreIndentedLines(text,i,indent){let end=i,start=i+1,ch=text[start];for(;ch===` `||ch===` `;)if(i<start+indent)ch=text[++i];else{do ch=text[++i];while(ch&&ch!==`
23
+ `);end=i,start=i+1,ch=text[start]}return end}exports.FOLD_BLOCK=FOLD_BLOCK,exports.FOLD_FLOW=`flow`,exports.FOLD_QUOTED=FOLD_QUOTED,exports.foldFlowLines=foldFlowLines$1})),require_stringifyString=__commonJSMin((exports=>{var Scalar$17=require_Scalar(),foldFlowLines=require_foldFlowLines();let getFoldOptions=(ctx,isBlock$1)=>({indentAtStart:isBlock$1?ctx.indent.length:ctx.indentAtStart,lineWidth:ctx.options.lineWidth,minContentWidth:ctx.options.minContentWidth}),containsDocumentMarker=str=>/^(%|---|\.\.\.)/m.test(str);function lineLengthOverLimit(str,lineWidth,indentLength){if(!lineWidth||lineWidth<0)return!1;let limit=lineWidth-indentLength,strLen=str.length;if(strLen<=limit)return!1;for(let i=0,start=0;i<strLen;++i)if(str[i]===`
24
+ `){if(i-start>limit)return!0;if(start=i+1,strLen-start<=limit)return!1}return!0}function doubleQuotedString(value,ctx){let json=JSON.stringify(value);if(ctx.options.doubleQuotedAsJSON)return json;let{implicitKey}=ctx,minMultiLineLength=ctx.options.doubleQuotedMinMultiLineLength,indent=ctx.indent||(containsDocumentMarker(value)?` `:``),str=``,start=0;for(let i=0,ch=json[i];ch;ch=json[++i])if(ch===` `&&json[i+1]===`\\`&&json[i+2]===`n`&&(str+=json.slice(start,i)+`\\ `,i+=1,start=i,ch=`\\`),ch===`\\`)switch(json[i+1]){case`u`:{str+=json.slice(start,i);let code=json.substr(i+2,4);switch(code){case`0000`:str+=`\\0`;break;case`0007`:str+=`\\a`;break;case`000b`:str+=`\\v`;break;case`001b`:str+=`\\e`;break;case`0085`:str+=`\\N`;break;case`00a0`:str+=`\\_`;break;case`2028`:str+=`\\L`;break;case`2029`:str+=`\\P`;break;default:code.substr(0,2)===`00`?str+=`\\x`+code.substr(2):str+=json.substr(i,6)}i+=5,start=i+1}break;case`n`:if(implicitKey||json[i+2]===`"`||json.length<minMultiLineLength)i+=1;else{for(str+=json.slice(start,i)+`
25
+
26
+ `;json[i+2]===`\\`&&json[i+3]===`n`&&json[i+4]!==`"`;)str+=`
27
+ `,i+=2;str+=indent,json[i+2]===` `&&(str+=`\\`),i+=1,start=i+1}break;default:i+=1}return str=start?str+json.slice(start):json,implicitKey?str:foldFlowLines.foldFlowLines(str,indent,foldFlowLines.FOLD_QUOTED,getFoldOptions(ctx,!1))}function singleQuotedString(value,ctx){if(ctx.options.singleQuote===!1||ctx.implicitKey&&value.includes(`
28
+ `)||/[ \t]\n|\n[ \t]/.test(value))return doubleQuotedString(value,ctx);let indent=ctx.indent||(containsDocumentMarker(value)?` `:``),res=`'`+value.replace(/'/g,`''`).replace(/\n+/g,`$&\n${indent}`)+`'`;return ctx.implicitKey?res:foldFlowLines.foldFlowLines(res,indent,foldFlowLines.FOLD_FLOW,getFoldOptions(ctx,!1))}function quotedString(value,ctx){let{singleQuote}=ctx.options,qs;if(singleQuote===!1)qs=doubleQuotedString;else{let hasDouble=value.includes(`"`),hasSingle=value.includes(`'`);qs=hasDouble&&!hasSingle?singleQuotedString:hasSingle&&!hasDouble?doubleQuotedString:singleQuote?singleQuotedString:doubleQuotedString}return qs(value,ctx)}let blockEndNewlines;try{blockEndNewlines=RegExp(`(^|(?<!
29
+ ))
30
+ +(?!
31
+ |$)`,`g`)}catch{blockEndNewlines=/\n+(?!\n|$)/g}function blockString({comment,type,value},ctx,onComment,onChompKeep){let{blockQuote,commentString,lineWidth}=ctx.options;if(!blockQuote||/\n[\t ]+$/.test(value))return quotedString(value,ctx);let indent=ctx.indent||(ctx.forceBlockIndent||containsDocumentMarker(value)?` `:``),literal=blockQuote===`literal`?!0:blockQuote===`folded`||type===Scalar$17.Scalar.BLOCK_FOLDED?!1:type===Scalar$17.Scalar.BLOCK_LITERAL?!0:!lineLengthOverLimit(value,lineWidth,indent.length);if(!value)return literal?`|
32
+ `:`>
33
+ `;let chomp,endStart;for(endStart=value.length;endStart>0;--endStart){let ch=value[endStart-1];if(ch!==`
34
+ `&&ch!==` `&&ch!==` `)break}let end=value.substring(endStart),endNlPos=end.indexOf(`
35
+ `);endNlPos===-1?chomp=`-`:value===end||endNlPos!==end.length-1?(chomp=`+`,onChompKeep&&onChompKeep()):chomp=``,end&&=(value=value.slice(0,-end.length),end[end.length-1]===`
36
+ `&&(end=end.slice(0,-1)),end.replace(blockEndNewlines,`$&${indent}`));let startWithSpace=!1,startEnd,startNlPos=-1;for(startEnd=0;startEnd<value.length;++startEnd){let ch=value[startEnd];if(ch===` `)startWithSpace=!0;else if(ch===`
37
+ `)startNlPos=startEnd;else break}let start=value.substring(0,startNlPos<startEnd?startNlPos+1:startEnd);start&&=(value=value.substring(start.length),start.replace(/\n+/g,`$&${indent}`));let header=(startWithSpace?indent?`2`:`1`:``)+chomp;if(comment&&(header+=` `+commentString(comment.replace(/ ?[\r\n]+/g,` `)),onComment&&onComment()),!literal){let foldedValue=value.replace(/\n+/g,`
38
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\n+/g,`$&${indent}`),literalFallback=!1,foldOptions=getFoldOptions(ctx,!0);blockQuote!==`folded`&&type!==Scalar$17.Scalar.BLOCK_FOLDED&&(foldOptions.onOverflow=()=>{literalFallback=!0});let body=foldFlowLines.foldFlowLines(`${start}${foldedValue}${end}`,indent,foldFlowLines.FOLD_BLOCK,foldOptions);if(!literalFallback)return`>${header}\n${indent}${body}`}return value=value.replace(/\n+/g,`$&${indent}`),`|${header}\n${indent}${start}${value}${end}`}function plainString(item,ctx,onComment,onChompKeep){let{type,value}=item,{actualString,implicitKey,indent,indentStep,inFlow}=ctx;if(implicitKey&&value.includes(`
39
+ `)||inFlow&&/[[\]{},]/.test(value))return quotedString(value,ctx);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(value))return implicitKey||inFlow||!value.includes(`
40
+ `)?quotedString(value,ctx):blockString(item,ctx,onComment,onChompKeep);if(!implicitKey&&!inFlow&&type!==Scalar$17.Scalar.PLAIN&&value.includes(`
41
+ `))return blockString(item,ctx,onComment,onChompKeep);if(containsDocumentMarker(value)){if(indent===``)return ctx.forceBlockIndent=!0,blockString(item,ctx,onComment,onChompKeep);if(implicitKey&&indent===indentStep)return quotedString(value,ctx)}let str=value.replace(/\n+/g,`$&\n${indent}`);if(actualString){let test=tag=>tag.default&&tag.tag!==`tag:yaml.org,2002:str`&&tag.test?.test(str),{compat,tags:tags$1}=ctx.doc.schema;if(tags$1.some(test)||compat?.some(test))return quotedString(value,ctx)}return implicitKey?str:foldFlowLines.foldFlowLines(str,indent,foldFlowLines.FOLD_FLOW,getFoldOptions(ctx,!1))}function stringifyString$4(item,ctx,onComment,onChompKeep){let{implicitKey,inFlow}=ctx,ss=typeof item.value==`string`?item:Object.assign({},item,{value:String(item.value)}),{type}=item;type!==Scalar$17.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(ss.value)&&(type=Scalar$17.Scalar.QUOTE_DOUBLE);let _stringify=_type=>{switch(_type){case Scalar$17.Scalar.BLOCK_FOLDED:case Scalar$17.Scalar.BLOCK_LITERAL:return implicitKey||inFlow?quotedString(ss.value,ctx):blockString(ss,ctx,onComment,onChompKeep);case Scalar$17.Scalar.QUOTE_DOUBLE:return doubleQuotedString(ss.value,ctx);case Scalar$17.Scalar.QUOTE_SINGLE:return singleQuotedString(ss.value,ctx);case Scalar$17.Scalar.PLAIN:return plainString(ss,ctx,onComment,onChompKeep);default:return null}},res=_stringify(type);if(res===null){let{defaultKeyType,defaultStringType}=ctx.options,t=implicitKey&&defaultKeyType||defaultStringType;if(res=_stringify(t),res===null)throw Error(`Unsupported default string type ${t}`)}return res}exports.stringifyString=stringifyString$4})),require_stringify=__commonJSMin((exports=>{var anchors$1=require_anchors(),identity$23=require_identity(),stringifyComment$3=require_stringifyComment(),stringifyString$3=require_stringifyString();function createStringifyContext(doc,options){let opt=Object.assign({blockQuote:!0,commentString:stringifyComment$3.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,trueStr:`true`,verifyAliasOrder:!0},doc.schema.toStringOptions,options),inFlow;switch(opt.collectionStyle){case`block`:inFlow=!1;break;case`flow`:inFlow=!0;break;default:inFlow=null}return{anchors:new Set,doc,flowCollectionPadding:opt.flowCollectionPadding?` `:``,indent:``,indentStep:typeof opt.indent==`number`?` `.repeat(opt.indent):` `,inFlow,options:opt}}function getTagObject(tags$1,item){if(item.tag){let match=tags$1.filter(t=>t.tag===item.tag);if(match.length>0)return match.find(t=>t.format===item.format)??match[0]}let tagObj,obj;if(identity$23.isScalar(item)){obj=item.value;let match=tags$1.filter(t=>t.identify?.(obj));if(match.length>1){let testMatch=match.filter(t=>t.test);testMatch.length>0&&(match=testMatch)}tagObj=match.find(t=>t.format===item.format)??match.find(t=>!t.format)}else obj=item,tagObj=tags$1.find(t=>t.nodeClass&&obj instanceof t.nodeClass);if(!tagObj){let name=obj?.constructor?.name??(obj===null?`null`:typeof obj);throw Error(`Tag not resolved for ${name} value`)}return tagObj}function stringifyProps(node,tagObj,{anchors:anchors$1$1,doc}){if(!doc.directives)return``;let props=[],anchor=(identity$23.isScalar(node)||identity$23.isCollection(node))&&node.anchor;anchor&&anchors$1.anchorIsValid(anchor)&&(anchors$1$1.add(anchor),props.push(`&${anchor}`));let tag=node.tag??(tagObj.default?null:tagObj.tag);return tag&&props.push(doc.directives.tagString(tag)),props.join(` `)}function stringify$6(item,ctx,onComment,onChompKeep){if(identity$23.isPair(item))return item.toString(ctx,onComment,onChompKeep);if(identity$23.isAlias(item)){if(ctx.doc.directives)return item.toString(ctx);if(ctx.resolvedAliases?.has(item))throw TypeError(`Cannot stringify circular structure without alias nodes`);ctx.resolvedAliases?ctx.resolvedAliases.add(item):ctx.resolvedAliases=new Set([item]),item=item.resolve(ctx.doc)}let tagObj,node=identity$23.isNode(item)?item:ctx.doc.createNode(item,{onTagObj:o=>tagObj=o});tagObj??=getTagObject(ctx.doc.schema.tags,node);let props=stringifyProps(node,tagObj,ctx);props.length>0&&(ctx.indentAtStart=(ctx.indentAtStart??0)+props.length+1);let str=typeof tagObj.stringify==`function`?tagObj.stringify(node,ctx,onComment,onChompKeep):identity$23.isScalar(node)?stringifyString$3.stringifyString(node,ctx,onComment,onChompKeep):node.toString(ctx,onComment,onChompKeep);return props?identity$23.isScalar(node)||str[0]===`{`||str[0]===`[`?`${props} ${str}`:`${props}\n${ctx.indent}${str}`:str}exports.createStringifyContext=createStringifyContext,exports.stringify=stringify$6})),require_stringifyPair=__commonJSMin((exports=>{var identity$22=require_identity(),Scalar$16=require_Scalar(),stringify$5=require_stringify(),stringifyComment$2=require_stringifyComment();function stringifyPair$1({key,value},ctx,onComment,onChompKeep){let{allNullValues,doc,indent,indentStep,options:{commentString,indentSeq,simpleKeys}}=ctx,keyComment=identity$22.isNode(key)&&key.comment||null;if(simpleKeys){if(keyComment)throw Error(`With simple keys, key nodes cannot have comments`);if(identity$22.isCollection(key)||!identity$22.isNode(key)&&typeof key==`object`)throw Error(`With simple keys, collection cannot be used as a key value`)}let explicitKey=!simpleKeys&&(!key||keyComment&&value==null&&!ctx.inFlow||identity$22.isCollection(key)||(identity$22.isScalar(key)?key.type===Scalar$16.Scalar.BLOCK_FOLDED||key.type===Scalar$16.Scalar.BLOCK_LITERAL:typeof key==`object`));ctx=Object.assign({},ctx,{allNullValues:!1,implicitKey:!explicitKey&&(simpleKeys||!allNullValues),indent:indent+indentStep});let keyCommentDone=!1,chompKeep=!1,str=stringify$5.stringify(key,ctx,()=>keyCommentDone=!0,()=>chompKeep=!0);if(!explicitKey&&!ctx.inFlow&&str.length>1024){if(simpleKeys)throw Error(`With simple keys, single line scalar must not span more than 1024 characters`);explicitKey=!0}if(ctx.inFlow){if(allNullValues||value==null)return keyCommentDone&&onComment&&onComment(),str===``?`?`:explicitKey?`? ${str}`:str}else if(allNullValues&&!simpleKeys||value==null&&explicitKey)return str=`? ${str}`,keyComment&&!keyCommentDone?str+=stringifyComment$2.lineComment(str,ctx.indent,commentString(keyComment)):chompKeep&&onChompKeep&&onChompKeep(),str;keyCommentDone&&(keyComment=null),explicitKey?(keyComment&&(str+=stringifyComment$2.lineComment(str,ctx.indent,commentString(keyComment))),str=`? ${str}\n${indent}:`):(str=`${str}:`,keyComment&&(str+=stringifyComment$2.lineComment(str,ctx.indent,commentString(keyComment))));let vsb,vcb,valueComment;identity$22.isNode(value)?(vsb=!!value.spaceBefore,vcb=value.commentBefore,valueComment=value.comment):(vsb=!1,vcb=null,valueComment=null,value&&typeof value==`object`&&(value=doc.createNode(value))),ctx.implicitKey=!1,!explicitKey&&!keyComment&&identity$22.isScalar(value)&&(ctx.indentAtStart=str.length+1),chompKeep=!1,!indentSeq&&indentStep.length>=2&&!ctx.inFlow&&!explicitKey&&identity$22.isSeq(value)&&!value.flow&&!value.tag&&!value.anchor&&(ctx.indent=ctx.indent.substring(2));let valueCommentDone=!1,valueStr=stringify$5.stringify(value,ctx,()=>valueCommentDone=!0,()=>chompKeep=!0),ws=` `;if(keyComment||vsb||vcb){if(ws=vsb?`
42
+ `:``,vcb){let cs=commentString(vcb);ws+=`\n${stringifyComment$2.indentComment(cs,ctx.indent)}`}valueStr===``&&!ctx.inFlow?ws===`
43
+ `&&(ws=`
44
+
45
+ `):ws+=`\n${ctx.indent}`}else if(!explicitKey&&identity$22.isCollection(value)){let vs0=valueStr[0],nl0=valueStr.indexOf(`
46
+ `),hasNewline=nl0!==-1,flow=ctx.inFlow??value.flow??value.items.length===0;if(hasNewline||!flow){let hasPropsLine=!1;if(hasNewline&&(vs0===`&`||vs0===`!`)){let sp0=valueStr.indexOf(` `);vs0===`&`&&sp0!==-1&&sp0<nl0&&valueStr[sp0+1]===`!`&&(sp0=valueStr.indexOf(` `,sp0+1)),(sp0===-1||nl0<sp0)&&(hasPropsLine=!0)}hasPropsLine||(ws=`\n${ctx.indent}`)}}else (valueStr===``||valueStr[0]===`
47
+ `)&&(ws=``);return str+=ws+valueStr,ctx.inFlow?valueCommentDone&&onComment&&onComment():valueComment&&!valueCommentDone?str+=stringifyComment$2.lineComment(str,ctx.indent,commentString(valueComment)):chompKeep&&onChompKeep&&onChompKeep(),str}exports.stringifyPair=stringifyPair$1})),require_log=__commonJSMin((exports=>{var node_process$2=__require(`process`);function debug(logLevel,...messages){logLevel===`debug`&&console.log(...messages)}function warn(logLevel,warning){(logLevel===`debug`||logLevel===`warn`)&&(typeof node_process$2.emitWarning==`function`?node_process$2.emitWarning(warning):console.warn(warning))}exports.debug=debug,exports.warn=warn})),require_merge=__commonJSMin((exports=>{var identity$21=require_identity(),Scalar$15=require_Scalar();let merge$3={identify:value=>value===`<<`||typeof value==`symbol`&&value.description===`<<`,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new Scalar$15.Scalar(Symbol(`<<`)),{addToJSMap:addMergeToJSMap}),stringify:()=>`<<`},isMergeKey=(ctx,key)=>(merge$3.identify(key)||identity$21.isScalar(key)&&(!key.type||key.type===Scalar$15.Scalar.PLAIN)&&merge$3.identify(key.value))&&ctx?.doc.schema.tags.some(tag=>tag.tag===merge$3.tag&&tag.default);function addMergeToJSMap(ctx,map$6,value){if(value=ctx&&identity$21.isAlias(value)?value.resolve(ctx.doc):value,identity$21.isSeq(value))for(let it of value.items)mergeValue(ctx,map$6,it);else if(Array.isArray(value))for(let it of value)mergeValue(ctx,map$6,it);else mergeValue(ctx,map$6,value)}function mergeValue(ctx,map$6,value){let source=ctx&&identity$21.isAlias(value)?value.resolve(ctx.doc):value;if(!identity$21.isMap(source))throw Error(`Merge sources must be maps or map aliases`);let srcMap=source.toJSON(null,ctx,Map);for(let[key,value$1]of srcMap)map$6 instanceof Map?map$6.has(key)||map$6.set(key,value$1):map$6 instanceof Set?map$6.add(key):Object.prototype.hasOwnProperty.call(map$6,key)||Object.defineProperty(map$6,key,{value:value$1,writable:!0,enumerable:!0,configurable:!0});return map$6}exports.addMergeToJSMap=addMergeToJSMap,exports.isMergeKey=isMergeKey,exports.merge=merge$3})),require_addPairToJSMap=__commonJSMin((exports=>{var log$1=require_log(),merge$2=require_merge(),stringify$4=require_stringify(),identity$20=require_identity(),toJS$3=require_toJS();function addPairToJSMap$2(ctx,map$6,{key,value}){if(identity$20.isNode(key)&&key.addToJSMap)key.addToJSMap(ctx,map$6,value);else if(merge$2.isMergeKey(ctx,key))merge$2.addMergeToJSMap(ctx,map$6,value);else{let jsKey=toJS$3.toJS(key,``,ctx);if(map$6 instanceof Map)map$6.set(jsKey,toJS$3.toJS(value,jsKey,ctx));else if(map$6 instanceof Set)map$6.add(jsKey);else{let stringKey=stringifyKey(key,jsKey,ctx),jsValue=toJS$3.toJS(value,stringKey,ctx);stringKey in map$6?Object.defineProperty(map$6,stringKey,{value:jsValue,writable:!0,enumerable:!0,configurable:!0}):map$6[stringKey]=jsValue}}return map$6}function stringifyKey(key,jsKey,ctx){if(jsKey===null)return``;if(typeof jsKey!=`object`)return String(jsKey);if(identity$20.isNode(key)&&ctx?.doc){let strCtx=stringify$4.createStringifyContext(ctx.doc,{});strCtx.anchors=new Set;for(let node of ctx.anchors.keys())strCtx.anchors.add(node.anchor);strCtx.inFlow=!0,strCtx.inStringifyKey=!0;let strKey=key.toString(strCtx);if(!ctx.mapKeyWarned){let jsonStr=JSON.stringify(strKey);jsonStr.length>40&&(jsonStr=jsonStr.substring(0,36)+`..."`),log$1.warn(ctx.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${jsonStr}. Set mapAsMap: true to use object keys.`),ctx.mapKeyWarned=!0}return strKey}return JSON.stringify(jsKey)}exports.addPairToJSMap=addPairToJSMap$2})),require_Pair=__commonJSMin((exports=>{var createNode$2=require_createNode(),stringifyPair=require_stringifyPair(),addPairToJSMap$1=require_addPairToJSMap(),identity$19=require_identity();function createPair(key,value,ctx){return new Pair$7(createNode$2.createNode(key,void 0,ctx),createNode$2.createNode(value,void 0,ctx))}var Pair$7=class Pair$7{constructor(key,value=null){Object.defineProperty(this,identity$19.NODE_TYPE,{value:identity$19.PAIR}),this.key=key,this.value=value}clone(schema$6){let{key,value}=this;return identity$19.isNode(key)&&(key=key.clone(schema$6)),identity$19.isNode(value)&&(value=value.clone(schema$6)),new Pair$7(key,value)}toJSON(_,ctx){let pair=ctx?.mapAsMap?new Map:{};return addPairToJSMap$1.addPairToJSMap(ctx,pair,this)}toString(ctx,onComment,onChompKeep){return ctx?.doc?stringifyPair.stringifyPair(this,ctx,onComment,onChompKeep):JSON.stringify(this)}};exports.Pair=Pair$7,exports.createPair=createPair})),require_stringifyCollection=__commonJSMin((exports=>{var identity$18=require_identity(),stringify$3=require_stringify(),stringifyComment$1=require_stringifyComment();function stringifyCollection$2(collection,ctx,options){return(ctx.inFlow??collection.flow?stringifyFlowCollection:stringifyBlockCollection)(collection,ctx,options)}function stringifyBlockCollection({comment,items},ctx,{blockItemPrefix,flowChars,itemIndent,onChompKeep,onComment}){let{indent,options:{commentString}}=ctx,itemCtx=Object.assign({},ctx,{indent:itemIndent,type:null}),chompKeep=!1,lines=[];for(let i=0;i<items.length;++i){let item=items[i],comment$1=null;if(identity$18.isNode(item))!chompKeep&&item.spaceBefore&&lines.push(``),addCommentBefore(ctx,lines,item.commentBefore,chompKeep),item.comment&&(comment$1=item.comment);else if(identity$18.isPair(item)){let ik=identity$18.isNode(item.key)?item.key:null;ik&&(!chompKeep&&ik.spaceBefore&&lines.push(``),addCommentBefore(ctx,lines,ik.commentBefore,chompKeep))}chompKeep=!1;let str$1=stringify$3.stringify(item,itemCtx,()=>comment$1=null,()=>chompKeep=!0);comment$1&&(str$1+=stringifyComment$1.lineComment(str$1,itemIndent,commentString(comment$1))),chompKeep&&comment$1&&(chompKeep=!1),lines.push(blockItemPrefix+str$1)}let str;if(lines.length===0)str=flowChars.start+flowChars.end;else{str=lines[0];for(let i=1;i<lines.length;++i){let line=lines[i];str+=line?`\n${indent}${line}`:`
48
+ `}}return comment?(str+=`
49
+ `+stringifyComment$1.indentComment(commentString(comment),indent),onComment&&onComment()):chompKeep&&onChompKeep&&onChompKeep(),str}function stringifyFlowCollection({items},ctx,{flowChars,itemIndent}){let{indent,indentStep,flowCollectionPadding:fcPadding,options:{commentString}}=ctx;itemIndent+=indentStep;let itemCtx=Object.assign({},ctx,{indent:itemIndent,inFlow:!0,type:null}),reqNewline=!1,linesAtValue=0,lines=[];for(let i=0;i<items.length;++i){let item=items[i],comment=null;if(identity$18.isNode(item))item.spaceBefore&&lines.push(``),addCommentBefore(ctx,lines,item.commentBefore,!1),item.comment&&(comment=item.comment);else if(identity$18.isPair(item)){let ik=identity$18.isNode(item.key)?item.key:null;ik&&(ik.spaceBefore&&lines.push(``),addCommentBefore(ctx,lines,ik.commentBefore,!1),ik.comment&&(reqNewline=!0));let iv=identity$18.isNode(item.value)?item.value:null;iv?(iv.comment&&(comment=iv.comment),iv.commentBefore&&(reqNewline=!0)):item.value==null&&ik?.comment&&(comment=ik.comment)}comment&&(reqNewline=!0);let str=stringify$3.stringify(item,itemCtx,()=>comment=null);i<items.length-1&&(str+=`,`),comment&&(str+=stringifyComment$1.lineComment(str,itemIndent,commentString(comment))),!reqNewline&&(lines.length>linesAtValue||str.includes(`
50
+ `))&&(reqNewline=!0),lines.push(str),linesAtValue=lines.length}let{start,end}=flowChars;if(lines.length===0)return start+end;if(!reqNewline){let len=lines.reduce((sum,line)=>sum+line.length+2,2);reqNewline=ctx.options.lineWidth>0&&len>ctx.options.lineWidth}if(reqNewline){let str=start;for(let line of lines)str+=line?`\n${indentStep}${indent}${line}`:`
51
+ `;return`${str}\n${indent}${end}`}else return`${start}${fcPadding}${lines.join(` `)}${fcPadding}${end}`}function addCommentBefore({indent,options:{commentString}},lines,comment,chompKeep){if(comment&&chompKeep&&(comment=comment.replace(/^\n+/,``)),comment){let ic=stringifyComment$1.indentComment(commentString(comment),indent);lines.push(ic.trimStart())}}exports.stringifyCollection=stringifyCollection$2})),require_YAMLMap=__commonJSMin((exports=>{var stringifyCollection$1=require_stringifyCollection(),addPairToJSMap=require_addPairToJSMap(),Collection$2=require_Collection(),identity$17=require_identity(),Pair$6=require_Pair(),Scalar$14=require_Scalar();function findPair(items,key){let k=identity$17.isScalar(key)?key.value:key;for(let it of items)if(identity$17.isPair(it)&&(it.key===key||it.key===k||identity$17.isScalar(it.key)&&it.key.value===k))return it}exports.YAMLMap=class extends Collection$2.Collection{static get tagName(){return`tag:yaml.org,2002:map`}constructor(schema$6){super(identity$17.MAP,schema$6),this.items=[]}static from(schema$6,obj,ctx){let{keepUndefined,replacer}=ctx,map$6=new this(schema$6),add=(key,value)=>{if(typeof replacer==`function`)value=replacer.call(obj,key,value);else if(Array.isArray(replacer)&&!replacer.includes(key))return;(value!==void 0||keepUndefined)&&map$6.items.push(Pair$6.createPair(key,value,ctx))};if(obj instanceof Map)for(let[key,value]of obj)add(key,value);else if(obj&&typeof obj==`object`)for(let key of Object.keys(obj))add(key,obj[key]);return typeof schema$6.sortMapEntries==`function`&&map$6.items.sort(schema$6.sortMapEntries),map$6}add(pair,overwrite){let _pair;_pair=identity$17.isPair(pair)?pair:!pair||typeof pair!=`object`||!(`key`in pair)?new Pair$6.Pair(pair,pair?.value):new Pair$6.Pair(pair.key,pair.value);let prev=findPair(this.items,_pair.key),sortEntries=this.schema?.sortMapEntries;if(prev){if(!overwrite)throw Error(`Key ${_pair.key} already set`);identity$17.isScalar(prev.value)&&Scalar$14.isScalarValue(_pair.value)?prev.value.value=_pair.value:prev.value=_pair.value}else if(sortEntries){let i=this.items.findIndex(item=>sortEntries(_pair,item)<0);i===-1?this.items.push(_pair):this.items.splice(i,0,_pair)}else this.items.push(_pair)}delete(key){let it=findPair(this.items,key);return it?this.items.splice(this.items.indexOf(it),1).length>0:!1}get(key,keepScalar){let node=findPair(this.items,key)?.value;return(!keepScalar&&identity$17.isScalar(node)?node.value:node)??void 0}has(key){return!!findPair(this.items,key)}set(key,value){this.add(new Pair$6.Pair(key,value),!0)}toJSON(_,ctx,Type){let map$6=Type?new Type:ctx?.mapAsMap?new Map:{};ctx?.onCreate&&ctx.onCreate(map$6);for(let item of this.items)addPairToJSMap.addPairToJSMap(ctx,map$6,item);return map$6}toString(ctx,onComment,onChompKeep){if(!ctx)return JSON.stringify(this);for(let item of this.items)if(!identity$17.isPair(item))throw Error(`Map items must all be pairs; found ${JSON.stringify(item)} instead`);return!ctx.allNullValues&&this.hasAllNullValues(!1)&&(ctx=Object.assign({},ctx,{allNullValues:!0})),stringifyCollection$1.stringifyCollection(this,ctx,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:ctx.indent||``,onChompKeep,onComment})}},exports.findPair=findPair})),require_map=__commonJSMin((exports=>{var identity$16=require_identity(),YAMLMap$8=require_YAMLMap();exports.map={collection:`map`,default:!0,nodeClass:YAMLMap$8.YAMLMap,tag:`tag:yaml.org,2002:map`,resolve(map$6,onError){return identity$16.isMap(map$6)||onError(`Expected a mapping for this tag`),map$6},createNode:(schema$6,obj,ctx)=>YAMLMap$8.YAMLMap.from(schema$6,obj,ctx)}})),require_YAMLSeq=__commonJSMin((exports=>{var createNode$1=require_createNode(),stringifyCollection=require_stringifyCollection(),Collection$1=require_Collection(),identity$15=require_identity(),Scalar$13=require_Scalar(),toJS$2=require_toJS(),YAMLSeq$9=class extends Collection$1.Collection{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(schema$6){super(identity$15.SEQ,schema$6),this.items=[]}add(value){this.items.push(value)}delete(key){let idx=asItemIndex(key);return typeof idx==`number`?this.items.splice(idx,1).length>0:!1}get(key,keepScalar){let idx=asItemIndex(key);if(typeof idx!=`number`)return;let it=this.items[idx];return!keepScalar&&identity$15.isScalar(it)?it.value:it}has(key){let idx=asItemIndex(key);return typeof idx==`number`&&idx<this.items.length}set(key,value){let idx=asItemIndex(key);if(typeof idx!=`number`)throw Error(`Expected a valid index, not ${key}.`);let prev=this.items[idx];identity$15.isScalar(prev)&&Scalar$13.isScalarValue(value)?prev.value=value:this.items[idx]=value}toJSON(_,ctx){let seq$6=[];ctx?.onCreate&&ctx.onCreate(seq$6);let i=0;for(let item of this.items)seq$6.push(toJS$2.toJS(item,String(i++),ctx));return seq$6}toString(ctx,onComment,onChompKeep){return ctx?stringifyCollection.stringifyCollection(this,ctx,{blockItemPrefix:`- `,flowChars:{start:`[`,end:`]`},itemIndent:(ctx.indent||``)+` `,onChompKeep,onComment}):JSON.stringify(this)}static from(schema$6,obj,ctx){let{replacer}=ctx,seq$6=new this(schema$6);if(obj&&Symbol.iterator in Object(obj)){let i=0;for(let it of obj){if(typeof replacer==`function`){let key=obj instanceof Set?it:String(i++);it=replacer.call(obj,key,it)}seq$6.items.push(createNode$1.createNode(it,void 0,ctx))}}return seq$6}};function asItemIndex(key){let idx=identity$15.isScalar(key)?key.value:key;return idx&&typeof idx==`string`&&(idx=Number(idx)),typeof idx==`number`&&Number.isInteger(idx)&&idx>=0?idx:null}exports.YAMLSeq=YAMLSeq$9})),require_seq=__commonJSMin((exports=>{var identity$14=require_identity(),YAMLSeq$8=require_YAMLSeq();exports.seq={collection:`seq`,default:!0,nodeClass:YAMLSeq$8.YAMLSeq,tag:`tag:yaml.org,2002:seq`,resolve(seq$6,onError){return identity$14.isSeq(seq$6)||onError(`Expected a sequence for this tag`),seq$6},createNode:(schema$6,obj,ctx)=>YAMLSeq$8.YAMLSeq.from(schema$6,obj,ctx)}})),require_string=__commonJSMin((exports=>{var stringifyString$2=require_stringifyString();exports.string={identify:value=>typeof value==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:str=>str,stringify(item,ctx,onComment,onChompKeep){return ctx=Object.assign({actualString:!0},ctx),stringifyString$2.stringifyString(item,ctx,onComment,onChompKeep)}}})),require_null=__commonJSMin((exports=>{var Scalar$12=require_Scalar();let nullTag={identify:value=>value==null,createNode:()=>new Scalar$12.Scalar(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Scalar$12.Scalar(null),stringify:({source},ctx)=>typeof source==`string`&&nullTag.test.test(source)?source:ctx.options.nullStr};exports.nullTag=nullTag})),require_bool$1=__commonJSMin((exports=>{var Scalar$11=require_Scalar();let boolTag={identify:value=>typeof value==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:str=>new Scalar$11.Scalar(str[0]===`t`||str[0]===`T`),stringify({source,value},ctx){return source&&boolTag.test.test(source)&&value===(source[0]===`t`||source[0]===`T`)?source:value?ctx.options.trueStr:ctx.options.falseStr}};exports.boolTag=boolTag})),require_stringifyNumber=__commonJSMin((exports=>{function stringifyNumber$5({format,minFractionDigits,tag,value}){if(typeof value==`bigint`)return String(value);let num=typeof value==`number`?value:Number(value);if(!isFinite(num))return isNaN(num)?`.nan`:num<0?`-.inf`:`.inf`;let n=JSON.stringify(value);if(!format&&minFractionDigits&&(!tag||tag===`tag:yaml.org,2002:float`)&&/^\d/.test(n)){let i=n.indexOf(`.`);i<0&&(i=n.length,n+=`.`);let d=minFractionDigits-(n.length-i-1);for(;d-- >0;)n+=`0`}return n}exports.stringifyNumber=stringifyNumber$5})),require_float$1=__commonJSMin((exports=>{var Scalar$10=require_Scalar(),stringifyNumber$4=require_stringifyNumber();let floatNaN$1={identify:value=>typeof value==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:str=>str.slice(-3).toLowerCase()===`nan`?NaN:str[0]===`-`?-1/0:1/0,stringify:stringifyNumber$4.stringifyNumber};exports.float={identify:value=>typeof value==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(str){let node=new Scalar$10.Scalar(parseFloat(str)),dot=str.indexOf(`.`);return dot!==-1&&str[str.length-1]===`0`&&(node.minFractionDigits=str.length-dot-1),node},stringify:stringifyNumber$4.stringifyNumber},exports.floatExp={identify:value=>typeof value==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:str=>parseFloat(str),stringify(node){let num=Number(node.value);return isFinite(num)?num.toExponential():stringifyNumber$4.stringifyNumber(node)}},exports.floatNaN=floatNaN$1})),require_int$1=__commonJSMin((exports=>{var stringifyNumber$3=require_stringifyNumber();let intIdentify$2=value=>typeof value==`bigint`||Number.isInteger(value),intResolve$1=(str,offset,radix,{intAsBigInt})=>intAsBigInt?BigInt(str):parseInt(str.substring(offset),radix);function intStringify$1(node,radix,prefix){let{value}=node;return intIdentify$2(value)&&value>=0?prefix+value.toString(radix):stringifyNumber$3.stringifyNumber(node)}exports.int={identify:intIdentify$2,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9]+$/,resolve:(str,_onError,opt)=>intResolve$1(str,0,10,opt),stringify:stringifyNumber$3.stringifyNumber},exports.intHex={identify:value=>intIdentify$2(value)&&value>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^0x[0-9a-fA-F]+$/,resolve:(str,_onError,opt)=>intResolve$1(str,2,16,opt),stringify:node=>intStringify$1(node,16,`0x`)},exports.intOct={identify:value=>intIdentify$2(value)&&value>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^0o[0-7]+$/,resolve:(str,_onError,opt)=>intResolve$1(str,2,8,opt),stringify:node=>intStringify$1(node,8,`0o`)}})),require_schema$2=__commonJSMin((exports=>{var map$4=require_map(),_null$2=require_null(),seq$4=require_seq(),string$3=require_string(),bool$2=require_bool$1(),float$3=require_float$1(),int$3=require_int$1();exports.schema=[map$4.map,seq$4.seq,string$3.string,_null$2.nullTag,bool$2.boolTag,int$3.intOct,int$3.int,int$3.intHex,float$3.floatNaN,float$3.floatExp,float$3.float]})),require_schema$1=__commonJSMin((exports=>{var Scalar$9=require_Scalar(),map$3=require_map(),seq$3=require_seq();function intIdentify$1(value){return typeof value==`bigint`||Number.isInteger(value)}let stringifyJSON=({value})=>JSON.stringify(value),jsonScalars=[{identify:value=>typeof value==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:str=>str,stringify:stringifyJSON},{identify:value=>value==null,createNode:()=>new Scalar$9.Scalar(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^null$/,resolve:()=>null,stringify:stringifyJSON},{identify:value=>typeof value==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^true$|^false$/,resolve:str=>str===`true`,stringify:stringifyJSON},{identify:intIdentify$1,default:!0,tag:`tag:yaml.org,2002:int`,test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(str,_onError,{intAsBigInt})=>intAsBigInt?BigInt(str):parseInt(str,10),stringify:({value})=>intIdentify$1(value)?value.toString():JSON.stringify(value)},{identify:value=>typeof value==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:str=>parseFloat(str),stringify:stringifyJSON}];exports.schema=[map$3.map,seq$3.seq].concat(jsonScalars,{default:!0,tag:``,test:/^/,resolve(str,onError){return onError(`Unresolved plain scalar ${JSON.stringify(str)}`),str}})})),require_binary=__commonJSMin((exports=>{var node_buffer=__require(`buffer`),Scalar$8=require_Scalar(),stringifyString$1=require_stringifyString();exports.binary={identify:value=>value instanceof Uint8Array,default:!1,tag:`tag:yaml.org,2002:binary`,resolve(src,onError){if(typeof node_buffer.Buffer==`function`)return node_buffer.Buffer.from(src,`base64`);if(typeof atob==`function`){let str=atob(src.replace(/[\n\r]/g,``)),buffer=new Uint8Array(str.length);for(let i=0;i<str.length;++i)buffer[i]=str.charCodeAt(i);return buffer}else return onError(`This environment does not support reading binary tags; either Buffer or atob is required`),src},stringify({comment,type,value},ctx,onComment,onChompKeep){if(!value)return``;let buf=value,str;if(typeof node_buffer.Buffer==`function`)str=buf instanceof node_buffer.Buffer?buf.toString(`base64`):node_buffer.Buffer.from(buf.buffer).toString(`base64`);else if(typeof btoa==`function`){let s=``;for(let i=0;i<buf.length;++i)s+=String.fromCharCode(buf[i]);str=btoa(s)}else throw Error(`This environment does not support writing binary tags; either Buffer or btoa is required`);if(type??=Scalar$8.Scalar.BLOCK_LITERAL,type!==Scalar$8.Scalar.QUOTE_DOUBLE){let lineWidth=Math.max(ctx.options.lineWidth-ctx.indent.length,ctx.options.minContentWidth),n=Math.ceil(str.length/lineWidth),lines=Array(n);for(let i=0,o=0;i<n;++i,o+=lineWidth)lines[i]=str.substr(o,lineWidth);str=lines.join(type===Scalar$8.Scalar.BLOCK_LITERAL?`
52
+ `:` `)}return stringifyString$1.stringifyString({comment,type,value:str},ctx,onComment,onChompKeep)}}})),require_pairs=__commonJSMin((exports=>{var identity$13=require_identity(),Pair$5=require_Pair(),Scalar$7=require_Scalar(),YAMLSeq$7=require_YAMLSeq();function resolvePairs(seq$6,onError){if(identity$13.isSeq(seq$6))for(let i=0;i<seq$6.items.length;++i){let item=seq$6.items[i];if(!identity$13.isPair(item)){if(identity$13.isMap(item)){item.items.length>1&&onError(`Each pair must have its own sequence indicator`);let pair=item.items[0]||new Pair$5.Pair(new Scalar$7.Scalar(null));if(item.commentBefore&&(pair.key.commentBefore=pair.key.commentBefore?`${item.commentBefore}\n${pair.key.commentBefore}`:item.commentBefore),item.comment){let cn=pair.value??pair.key;cn.comment=cn.comment?`${item.comment}\n${cn.comment}`:item.comment}item=pair}seq$6.items[i]=identity$13.isPair(item)?item:new Pair$5.Pair(item)}}else onError(`Expected a sequence for this tag`);return seq$6}function createPairs(schema$6,iterable,ctx){let{replacer}=ctx,pairs$4=new YAMLSeq$7.YAMLSeq(schema$6);pairs$4.tag=`tag:yaml.org,2002:pairs`;let i=0;if(iterable&&Symbol.iterator in Object(iterable))for(let it of iterable){typeof replacer==`function`&&(it=replacer.call(iterable,String(i++),it));let key,value;if(Array.isArray(it))if(it.length===2)key=it[0],value=it[1];else throw TypeError(`Expected [key, value] tuple: ${it}`);else if(it&&it instanceof Object){let keys=Object.keys(it);if(keys.length===1)key=keys[0],value=it[key];else throw TypeError(`Expected tuple with one key, not ${keys.length} keys`)}else key=it;pairs$4.items.push(Pair$5.createPair(key,value,ctx))}return pairs$4}let pairs$3={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:resolvePairs,createNode:createPairs};exports.createPairs=createPairs,exports.pairs=pairs$3,exports.resolvePairs=resolvePairs})),require_omap=__commonJSMin((exports=>{var identity$12=require_identity(),toJS$1=require_toJS(),YAMLMap$7=require_YAMLMap(),YAMLSeq$6=require_YAMLSeq(),pairs$2=require_pairs(),YAMLOMap=class YAMLOMap extends YAMLSeq$6.YAMLSeq{constructor(){super(),this.add=YAMLMap$7.YAMLMap.prototype.add.bind(this),this.delete=YAMLMap$7.YAMLMap.prototype.delete.bind(this),this.get=YAMLMap$7.YAMLMap.prototype.get.bind(this),this.has=YAMLMap$7.YAMLMap.prototype.has.bind(this),this.set=YAMLMap$7.YAMLMap.prototype.set.bind(this),this.tag=YAMLOMap.tag}toJSON(_,ctx){if(!ctx)return super.toJSON(_);let map$6=new Map;ctx?.onCreate&&ctx.onCreate(map$6);for(let pair of this.items){let key,value;if(identity$12.isPair(pair)?(key=toJS$1.toJS(pair.key,``,ctx),value=toJS$1.toJS(pair.value,key,ctx)):key=toJS$1.toJS(pair,``,ctx),map$6.has(key))throw Error(`Ordered maps must not include duplicate keys`);map$6.set(key,value)}return map$6}static from(schema$6,iterable,ctx){let pairs$1$1=pairs$2.createPairs(schema$6,iterable,ctx),omap$3=new this;return omap$3.items=pairs$1$1.items,omap$3}};YAMLOMap.tag=`tag:yaml.org,2002:omap`;let omap$2={collection:`seq`,identify:value=>value instanceof Map,nodeClass:YAMLOMap,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(seq$6,onError){let pairs$1$1=pairs$2.resolvePairs(seq$6,onError),seenKeys=[];for(let{key}of pairs$1$1.items)identity$12.isScalar(key)&&(seenKeys.includes(key.value)?onError(`Ordered maps must not include duplicate keys: ${key.value}`):seenKeys.push(key.value));return Object.assign(new YAMLOMap,pairs$1$1)},createNode:(schema$6,iterable,ctx)=>YAMLOMap.from(schema$6,iterable,ctx)};exports.YAMLOMap=YAMLOMap,exports.omap=omap$2})),require_bool=__commonJSMin((exports=>{var Scalar$6=require_Scalar();function boolStringify({value,source},ctx){return source&&(value?trueTag:falseTag).test.test(source)?source:value?ctx.options.trueStr:ctx.options.falseStr}let trueTag={identify:value=>value===!0,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Scalar$6.Scalar(!0),stringify:boolStringify},falseTag={identify:value=>value===!1,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Scalar$6.Scalar(!1),stringify:boolStringify};exports.falseTag=falseTag,exports.trueTag=trueTag})),require_float=__commonJSMin((exports=>{var Scalar$5=require_Scalar(),stringifyNumber$2=require_stringifyNumber();let floatNaN={identify:value=>typeof value==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:str=>str.slice(-3).toLowerCase()===`nan`?NaN:str[0]===`-`?-1/0:1/0,stringify:stringifyNumber$2.stringifyNumber};exports.float={identify:value=>typeof value==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(str){let node=new Scalar$5.Scalar(parseFloat(str.replace(/_/g,``))),dot=str.indexOf(`.`);if(dot!==-1){let f=str.substring(dot+1).replace(/_/g,``);f[f.length-1]===`0`&&(node.minFractionDigits=f.length)}return node},stringify:stringifyNumber$2.stringifyNumber},exports.floatExp={identify:value=>typeof value==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:str=>parseFloat(str.replace(/_/g,``)),stringify(node){let num=Number(node.value);return isFinite(num)?num.toExponential():stringifyNumber$2.stringifyNumber(node)}},exports.floatNaN=floatNaN})),require_int=__commonJSMin((exports=>{var stringifyNumber$1=require_stringifyNumber();let intIdentify=value=>typeof value==`bigint`||Number.isInteger(value);function intResolve(str,offset,radix,{intAsBigInt}){let sign=str[0];if((sign===`-`||sign===`+`)&&(offset+=1),str=str.substring(offset).replace(/_/g,``),intAsBigInt){switch(radix){case 2:str=`0b${str}`;break;case 8:str=`0o${str}`;break;case 16:str=`0x${str}`;break}let n$1=BigInt(str);return sign===`-`?BigInt(-1)*n$1:n$1}let n=parseInt(str,radix);return sign===`-`?-1*n:n}function intStringify(node,radix,prefix){let{value}=node;if(intIdentify(value)){let str=value.toString(radix);return value<0?`-`+prefix+str.substr(1):prefix+str}return stringifyNumber$1.stringifyNumber(node)}let intBin={identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(str,_onError,opt)=>intResolve(str,2,2,opt),stringify:node=>intStringify(node,2,`0b`)},intOct={identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(str,_onError,opt)=>intResolve(str,1,8,opt),stringify:node=>intStringify(node,8,`0`)},int$2={identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(str,_onError,opt)=>intResolve(str,0,10,opt),stringify:stringifyNumber$1.stringifyNumber},intHex={identify:intIdentify,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(str,_onError,opt)=>intResolve(str,2,16,opt),stringify:node=>intStringify(node,16,`0x`)};exports.int=int$2,exports.intBin=intBin,exports.intHex=intHex,exports.intOct=intOct})),require_set=__commonJSMin((exports=>{var identity$11=require_identity(),Pair$4=require_Pair(),YAMLMap$6=require_YAMLMap(),YAMLSet=class YAMLSet extends YAMLMap$6.YAMLMap{constructor(schema$6){super(schema$6),this.tag=YAMLSet.tag}add(key){let pair;pair=identity$11.isPair(key)?key:key&&typeof key==`object`&&`key`in key&&`value`in key&&key.value===null?new Pair$4.Pair(key.key,null):new Pair$4.Pair(key,null),YAMLMap$6.findPair(this.items,pair.key)||this.items.push(pair)}get(key,keepPair){let pair=YAMLMap$6.findPair(this.items,key);return!keepPair&&identity$11.isPair(pair)?identity$11.isScalar(pair.key)?pair.key.value:pair.key:pair}set(key,value){if(typeof value!=`boolean`)throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof value}`);let prev=YAMLMap$6.findPair(this.items,key);prev&&!value?this.items.splice(this.items.indexOf(prev),1):!prev&&value&&this.items.push(new Pair$4.Pair(key))}toJSON(_,ctx){return super.toJSON(_,ctx,Set)}toString(ctx,onComment,onChompKeep){if(!ctx)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},ctx,{allNullValues:!0}),onComment,onChompKeep);throw Error(`Set items must all have null values`)}static from(schema$6,iterable,ctx){let{replacer}=ctx,set$3=new this(schema$6);if(iterable&&Symbol.iterator in Object(iterable))for(let value of iterable)typeof replacer==`function`&&(value=replacer.call(iterable,value,value)),set$3.items.push(Pair$4.createPair(value,null,ctx));return set$3}};YAMLSet.tag=`tag:yaml.org,2002:set`;let set$2={collection:`map`,identify:value=>value instanceof Set,nodeClass:YAMLSet,default:!1,tag:`tag:yaml.org,2002:set`,createNode:(schema$6,iterable,ctx)=>YAMLSet.from(schema$6,iterable,ctx),resolve(map$6,onError){if(identity$11.isMap(map$6)){if(map$6.hasAllNullValues(!0))return Object.assign(new YAMLSet,map$6);onError(`Set items must all have null values`)}else onError(`Expected a mapping for this tag`);return map$6}};exports.YAMLSet=YAMLSet,exports.set=set$2})),require_timestamp=__commonJSMin((exports=>{var stringifyNumber=require_stringifyNumber();function parseSexagesimal(str,asBigInt){let sign=str[0],parts=sign===`-`||sign===`+`?str.substring(1):str,num=n=>asBigInt?BigInt(n):Number(n),res=parts.replace(/_/g,``).split(`:`).reduce((res$1,p)=>res$1*num(60)+num(p),num(0));return sign===`-`?num(-1)*res:res}function stringifySexagesimal(node){let{value}=node,num=n=>n;if(typeof value==`bigint`)num=n=>BigInt(n);else if(isNaN(value)||!isFinite(value))return stringifyNumber.stringifyNumber(node);let sign=``;value<0&&(sign=`-`,value*=num(-1));let _60=num(60),parts=[value%_60];return value<60?parts.unshift(0):(value=(value-parts[0])/_60,parts.unshift(value%_60),value>=60&&(value=(value-parts[0])/_60,parts.unshift(value))),sign+parts.map(n=>String(n).padStart(2,`0`)).join(`:`).replace(/000000\d*$/,``)}let intTime={identify:value=>typeof value==`bigint`||Number.isInteger(value),default:!0,tag:`tag:yaml.org,2002:int`,format:`TIME`,test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(str,_onError,{intAsBigInt})=>parseSexagesimal(str,intAsBigInt),stringify:stringifySexagesimal},floatTime={identify:value=>typeof value==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`TIME`,test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:str=>parseSexagesimal(str,!1),stringify:stringifySexagesimal},timestamp$2={identify:value=>value 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(str){let match=str.match(timestamp$2.test);if(!match)throw Error(`!!timestamp expects a date, starting with yyyy-mm-dd`);let[,year,month,day,hour,minute,second]=match.map(Number),millisec=match[7]?Number((match[7]+`00`).substr(1,3)):0,date=Date.UTC(year,month-1,day,hour||0,minute||0,second||0,millisec),tz=match[8];if(tz&&tz!==`Z`){let d=parseSexagesimal(tz,!1);Math.abs(d)<30&&(d*=60),date-=6e4*d}return new Date(date)},stringify:({value})=>value?.toISOString().replace(/(T00:00:00)?\.000Z$/,``)??``};exports.floatTime=floatTime,exports.intTime=intTime,exports.timestamp=timestamp$2})),require_schema=__commonJSMin((exports=>{var map$2=require_map(),_null$1=require_null(),seq$2=require_seq(),string$2=require_string(),binary$1=require_binary(),bool$1=require_bool(),float$1=require_float(),int$1=require_int(),merge$1=require_merge(),omap$1=require_omap(),pairs$1=require_pairs(),set$1=require_set(),timestamp$1=require_timestamp();exports.schema=[map$2.map,seq$2.seq,string$2.string,_null$1.nullTag,bool$1.trueTag,bool$1.falseTag,int$1.intBin,int$1.intOct,int$1.int,int$1.intHex,float$1.floatNaN,float$1.floatExp,float$1.float,binary$1.binary,merge$1.merge,omap$1.omap,pairs$1.pairs,set$1.set,timestamp$1.intTime,timestamp$1.floatTime,timestamp$1.timestamp]})),require_tags=__commonJSMin((exports=>{var map$1=require_map(),_null=require_null(),seq$1=require_seq(),string$1=require_string(),bool=require_bool$1(),float=require_float$1(),int=require_int$1(),schema=require_schema$2(),schema$1=require_schema$1(),binary=require_binary(),merge=require_merge(),omap=require_omap(),pairs=require_pairs(),schema$2=require_schema(),set=require_set(),timestamp=require_timestamp();let schemas=new Map([[`core`,schema.schema],[`failsafe`,[map$1.map,seq$1.seq,string$1.string]],[`json`,schema$1.schema],[`yaml11`,schema$2.schema],[`yaml-1.1`,schema$2.schema]]),tagsByName={binary:binary.binary,bool:bool.boolTag,float:float.float,floatExp:float.floatExp,floatNaN:float.floatNaN,floatTime:timestamp.floatTime,int:int.int,intHex:int.intHex,intOct:int.intOct,intTime:timestamp.intTime,map:map$1.map,merge:merge.merge,null:_null.nullTag,omap:omap.omap,pairs:pairs.pairs,seq:seq$1.seq,set:set.set,timestamp:timestamp.timestamp},coreKnownTags={"tag:yaml.org,2002:binary":binary.binary,"tag:yaml.org,2002:merge":merge.merge,"tag:yaml.org,2002:omap":omap.omap,"tag:yaml.org,2002:pairs":pairs.pairs,"tag:yaml.org,2002:set":set.set,"tag:yaml.org,2002:timestamp":timestamp.timestamp};function getTags(customTags,schemaName,addMergeTag){let schemaTags=schemas.get(schemaName);if(schemaTags&&!customTags)return addMergeTag&&!schemaTags.includes(merge.merge)?schemaTags.concat(merge.merge):schemaTags.slice();let tags$1=schemaTags;if(!tags$1)if(Array.isArray(customTags))tags$1=[];else{let keys=Array.from(schemas.keys()).filter(key=>key!==`yaml11`).map(key=>JSON.stringify(key)).join(`, `);throw Error(`Unknown schema "${schemaName}"; use one of ${keys} or define customTags array`)}if(Array.isArray(customTags))for(let tag of customTags)tags$1=tags$1.concat(tag);else typeof customTags==`function`&&(tags$1=customTags(tags$1.slice()));return addMergeTag&&(tags$1=tags$1.concat(merge.merge)),tags$1.reduce((tags$2,tag)=>{let tagObj=typeof tag==`string`?tagsByName[tag]:tag;if(!tagObj){let tagName=JSON.stringify(tag),keys=Object.keys(tagsByName).map(key=>JSON.stringify(key)).join(`, `);throw Error(`Unknown custom tag ${tagName}; use one of ${keys}`)}return tags$2.includes(tagObj)||tags$2.push(tagObj),tags$2},[])}exports.coreKnownTags=coreKnownTags,exports.getTags=getTags})),require_Schema=__commonJSMin((exports=>{var identity$10=require_identity(),map=require_map(),seq=require_seq(),string=require_string(),tags=require_tags();let sortMapEntriesByKey=(a,b)=>a.key<b.key?-1:a.key>b.key?1:0;exports.Schema=class Schema$2{constructor({compat,customTags,merge:merge$4,resolveKnownTags,schema:schema$6,sortMapEntries,toStringDefaults}){this.compat=Array.isArray(compat)?tags.getTags(compat,`compat`):compat?tags.getTags(null,compat):null,this.name=typeof schema$6==`string`&&schema$6||`core`,this.knownTags=resolveKnownTags?tags.coreKnownTags:{},this.tags=tags.getTags(customTags,this.name,merge$4),this.toStringOptions=toStringDefaults??null,Object.defineProperty(this,identity$10.MAP,{value:map.map}),Object.defineProperty(this,identity$10.SCALAR,{value:string.string}),Object.defineProperty(this,identity$10.SEQ,{value:seq.seq}),this.sortMapEntries=typeof sortMapEntries==`function`?sortMapEntries:sortMapEntries===!0?sortMapEntriesByKey:null}clone(){let copy=Object.create(Schema$2.prototype,Object.getOwnPropertyDescriptors(this));return copy.tags=this.tags.slice(),copy}}})),require_stringifyDocument=__commonJSMin((exports=>{var identity$9=require_identity(),stringify$2=require_stringify(),stringifyComment=require_stringifyComment();function stringifyDocument$1(doc,options){let lines=[],hasDirectives=options.directives===!0;if(options.directives!==!1&&doc.directives){let dir=doc.directives.toString(doc);dir?(lines.push(dir),hasDirectives=!0):doc.directives.docStart&&(hasDirectives=!0)}hasDirectives&&lines.push(`---`);let ctx=stringify$2.createStringifyContext(doc,options),{commentString}=ctx.options;if(doc.commentBefore){lines.length!==1&&lines.unshift(``);let cs=commentString(doc.commentBefore);lines.unshift(stringifyComment.indentComment(cs,``))}let chompKeep=!1,contentComment=null;if(doc.contents){if(identity$9.isNode(doc.contents)){if(doc.contents.spaceBefore&&hasDirectives&&lines.push(``),doc.contents.commentBefore){let cs=commentString(doc.contents.commentBefore);lines.push(stringifyComment.indentComment(cs,``))}ctx.forceBlockIndent=!!doc.comment,contentComment=doc.contents.comment}let onChompKeep=contentComment?void 0:()=>chompKeep=!0,body=stringify$2.stringify(doc.contents,ctx,()=>contentComment=null,onChompKeep);contentComment&&(body+=stringifyComment.lineComment(body,``,commentString(contentComment))),(body[0]===`|`||body[0]===`>`)&&lines[lines.length-1]===`---`?lines[lines.length-1]=`--- ${body}`:lines.push(body)}else lines.push(stringify$2.stringify(doc.contents,ctx));if(doc.directives?.docEnd)if(doc.comment){let cs=commentString(doc.comment);cs.includes(`
53
+ `)?(lines.push(`...`),lines.push(stringifyComment.indentComment(cs,``))):lines.push(`... ${cs}`)}else lines.push(`...`);else{let dc=doc.comment;dc&&chompKeep&&(dc=dc.replace(/^\n+/,``)),dc&&((!chompKeep||contentComment)&&lines[lines.length-1]!==``&&lines.push(``),lines.push(stringifyComment.indentComment(commentString(dc),``)))}return lines.join(`
54
+ `)+`
55
+ `}exports.stringifyDocument=stringifyDocument$1})),require_Document=__commonJSMin((exports=>{var Alias$2=require_Alias(),Collection=require_Collection(),identity$8=require_identity(),Pair$3=require_Pair(),toJS=require_toJS(),Schema$1=require_Schema(),stringifyDocument=require_stringifyDocument(),anchors=require_anchors(),applyReviver=require_applyReviver(),createNode=require_createNode(),directives$1=require_directives(),Document$6=class Document$6{constructor(value,replacer,options){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,identity$8.NODE_TYPE,{value:identity$8.DOC});let _replacer=null;typeof replacer==`function`||Array.isArray(replacer)?_replacer=replacer:options===void 0&&replacer&&(options=replacer,replacer=void 0);let opt=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:`warn`,prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:`1.2`},options);this.options=opt;let{version}=opt;options?._directives?(this.directives=options._directives.atDocument(),this.directives.yaml.explicit&&(version=this.directives.yaml.version)):this.directives=new directives$1.Directives({version}),this.setSchema(version,options),this.contents=value===void 0?null:this.createNode(value,_replacer,options)}clone(){let copy=Object.create(Document$6.prototype,{[identity$8.NODE_TYPE]:{value:identity$8.DOC}});return copy.commentBefore=this.commentBefore,copy.comment=this.comment,copy.errors=this.errors.slice(),copy.warnings=this.warnings.slice(),copy.options=Object.assign({},this.options),this.directives&&(copy.directives=this.directives.clone()),copy.schema=this.schema.clone(),copy.contents=identity$8.isNode(this.contents)?this.contents.clone(copy.schema):this.contents,this.range&&(copy.range=this.range.slice()),copy}add(value){assertCollection(this.contents)&&this.contents.add(value)}addIn(path,value){assertCollection(this.contents)&&this.contents.addIn(path,value)}createAlias(node,name){if(!node.anchor){let prev=anchors.anchorNames(this);node.anchor=!name||prev.has(name)?anchors.findNewAnchor(name||`a`,prev):name}return new Alias$2.Alias(node.anchor)}createNode(value,replacer,options){let _replacer;if(typeof replacer==`function`)value=replacer.call({"":value},``,value),_replacer=replacer;else if(Array.isArray(replacer)){let asStr=replacer.filter(v=>typeof v==`number`||v instanceof String||v instanceof Number).map(String);asStr.length>0&&(replacer=replacer.concat(asStr)),_replacer=replacer}else options===void 0&&replacer&&(options=replacer,replacer=void 0);let{aliasDuplicateObjects,anchorPrefix,flow,keepUndefined,onTagObj,tag}=options??{},{onAnchor,setAnchors,sourceObjects}=anchors.createNodeAnchors(this,anchorPrefix||`a`),ctx={aliasDuplicateObjects:aliasDuplicateObjects??!0,keepUndefined:keepUndefined??!1,onAnchor,onTagObj,replacer:_replacer,schema:this.schema,sourceObjects},node=createNode.createNode(value,tag,ctx);return flow&&identity$8.isCollection(node)&&(node.flow=!0),setAnchors(),node}createPair(key,value,options={}){let k=this.createNode(key,null,options),v=this.createNode(value,null,options);return new Pair$3.Pair(k,v)}delete(key){return assertCollection(this.contents)?this.contents.delete(key):!1}deleteIn(path){return Collection.isEmptyPath(path)?this.contents==null?!1:(this.contents=null,!0):assertCollection(this.contents)?this.contents.deleteIn(path):!1}get(key,keepScalar){return identity$8.isCollection(this.contents)?this.contents.get(key,keepScalar):void 0}getIn(path,keepScalar){return Collection.isEmptyPath(path)?!keepScalar&&identity$8.isScalar(this.contents)?this.contents.value:this.contents:identity$8.isCollection(this.contents)?this.contents.getIn(path,keepScalar):void 0}has(key){return identity$8.isCollection(this.contents)?this.contents.has(key):!1}hasIn(path){return Collection.isEmptyPath(path)?this.contents!==void 0:identity$8.isCollection(this.contents)?this.contents.hasIn(path):!1}set(key,value){this.contents==null?this.contents=Collection.collectionFromPath(this.schema,[key],value):assertCollection(this.contents)&&this.contents.set(key,value)}setIn(path,value){Collection.isEmptyPath(path)?this.contents=value:this.contents==null?this.contents=Collection.collectionFromPath(this.schema,Array.from(path),value):assertCollection(this.contents)&&this.contents.setIn(path,value)}setSchema(version,options={}){typeof version==`number`&&(version=String(version));let opt;switch(version){case`1.1`:this.directives?this.directives.yaml.version=`1.1`:this.directives=new directives$1.Directives({version:`1.1`}),opt={resolveKnownTags:!1,schema:`yaml-1.1`};break;case`1.2`:case`next`:this.directives?this.directives.yaml.version=version:this.directives=new directives$1.Directives({version}),opt={resolveKnownTags:!0,schema:`core`};break;case null:this.directives&&delete this.directives,opt=null;break;default:{let sv=JSON.stringify(version);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${sv}`)}}if(options.schema instanceof Object)this.schema=options.schema;else if(opt)this.schema=new Schema$1.Schema(Object.assign(opt,options));else throw Error(`With a null YAML version, the { schema: Schema } option is required`)}toJS({json,jsonArg,mapAsMap,maxAliasCount,onAnchor,reviver}={}){let ctx={anchors:new Map,doc:this,keep:!json,mapAsMap:mapAsMap===!0,mapKeyWarned:!1,maxAliasCount:typeof maxAliasCount==`number`?maxAliasCount:100},res=toJS.toJS(this.contents,jsonArg??``,ctx);if(typeof onAnchor==`function`)for(let{count,res:res$1}of ctx.anchors.values())onAnchor(res$1,count);return typeof reviver==`function`?applyReviver.applyReviver(reviver,{"":res},``,res):res}toJSON(jsonArg,onAnchor){return this.toJS({json:!0,jsonArg,mapAsMap:!1,onAnchor})}toString(options={}){if(this.errors.length>0)throw Error(`Document with errors cannot be stringified`);if(`indent`in options&&(!Number.isInteger(options.indent)||Number(options.indent)<=0)){let s=JSON.stringify(options.indent);throw Error(`"indent" option must be a positive integer, not ${s}`)}return stringifyDocument.stringifyDocument(this,options)}};function assertCollection(contents){if(identity$8.isCollection(contents))return!0;throw Error(`Expected a YAML collection as document contents`)}exports.Document=Document$6})),require_errors=__commonJSMin((exports=>{var YAMLError=class extends Error{constructor(name,pos,code,message){super(),this.name=name,this.code=code,this.message=message,this.pos=pos}},YAMLParseError=class extends YAMLError{constructor(pos,code,message){super(`YAMLParseError`,pos,code,message)}},YAMLWarning=class extends YAMLError{constructor(pos,code,message){super(`YAMLWarning`,pos,code,message)}};exports.YAMLError=YAMLError,exports.YAMLParseError=YAMLParseError,exports.YAMLWarning=YAMLWarning,exports.prettifyError=(src,lc)=>error=>{if(error.pos[0]===-1)return;error.linePos=error.pos.map(pos=>lc.linePos(pos));let{line,col}=error.linePos[0];error.message+=` at line ${line}, column ${col}`;let ci=col-1,lineStr=src.substring(lc.lineStarts[line-1],lc.lineStarts[line]).replace(/[\n\r]+$/,``);if(ci>=60&&lineStr.length>80){let trimStart=Math.min(ci-39,lineStr.length-79);lineStr=`…`+lineStr.substring(trimStart),ci-=trimStart-1}if(lineStr.length>80&&(lineStr=lineStr.substring(0,79)+`…`),line>1&&/^ *$/.test(lineStr.substring(0,ci))){let prev=src.substring(lc.lineStarts[line-2],lc.lineStarts[line-1]);prev.length>80&&(prev=prev.substring(0,79)+`…
56
+ `),lineStr=prev+lineStr}if(/[^ ]/.test(lineStr)){let count=1,end=error.linePos[1];end&&end.line===line&&end.col>col&&(count=Math.max(1,Math.min(end.col-col,80-ci)));let pointer=` `.repeat(ci)+`^`.repeat(count);error.message+=`:\n\n${lineStr}\n${pointer}\n`}}})),require_resolve_props=__commonJSMin((exports=>{function resolveProps$4(tokens,{flow,indicator,next,offset,onError,parentIndent,startOnNewline}){let spaceBefore=!1,atNewline=startOnNewline,hasSpace=startOnNewline,comment=``,commentSep=``,hasNewline=!1,reqSpace=!1,tab=null,anchor=null,tag=null,newlineAfterProp=null,comma=null,found=null,start=null;for(let token of tokens)switch(reqSpace&&=(token.type!==`space`&&token.type!==`newline`&&token.type!==`comma`&&onError(token.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),!1),tab&&=(atNewline&&token.type!==`comment`&&token.type!==`newline`&&onError(tab,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),null),token.type){case`space`:!flow&&(indicator!==`doc-start`||next?.type!==`flow-collection`)&&token.source.includes(` `)&&(tab=token),hasSpace=!0;break;case`comment`:{hasSpace||onError(token,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let cb=token.source.substring(1)||` `;comment?comment+=commentSep+cb:comment=cb,commentSep=``,atNewline=!1;break}case`newline`:atNewline?comment?comment+=token.source:(!found||indicator!==`seq-item-ind`)&&(spaceBefore=!0):commentSep+=token.source,atNewline=!0,hasNewline=!0,(anchor||tag)&&(newlineAfterProp=token),hasSpace=!0;break;case`anchor`:anchor&&onError(token,`MULTIPLE_ANCHORS`,`A node can have at most one anchor`),token.source.endsWith(`:`)&&onError(token.offset+token.source.length-1,`BAD_ALIAS`,`Anchor ending in : is ambiguous`,!0),anchor=token,start??=token.offset,atNewline=!1,hasSpace=!1,reqSpace=!0;break;case`tag`:tag&&onError(token,`MULTIPLE_TAGS`,`A node can have at most one tag`),tag=token,start??=token.offset,atNewline=!1,hasSpace=!1,reqSpace=!0;break;case indicator:(anchor||tag)&&onError(token,`BAD_PROP_ORDER`,`Anchors and tags must be after the ${token.source} indicator`),found&&onError(token,`UNEXPECTED_TOKEN`,`Unexpected ${token.source} in ${flow??`collection`}`),found=token,atNewline=indicator===`seq-item-ind`||indicator===`explicit-key-ind`,hasSpace=!1;break;case`comma`:if(flow){comma&&onError(token,`UNEXPECTED_TOKEN`,`Unexpected , in ${flow}`),comma=token,atNewline=!1,hasSpace=!1;break}default:onError(token,`UNEXPECTED_TOKEN`,`Unexpected ${token.type} token`),atNewline=!1,hasSpace=!1}let last=tokens[tokens.length-1],end=last?last.offset+last.source.length:offset;return reqSpace&&next&&next.type!==`space`&&next.type!==`newline`&&next.type!==`comma`&&(next.type!==`scalar`||next.source!==``)&&onError(next.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),tab&&(atNewline&&tab.indent<=parentIndent||next?.type===`block-map`||next?.type===`block-seq`)&&onError(tab,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),{comma,found,spaceBefore,comment,hasNewline,anchor,tag,newlineAfterProp,end,start:start??end}}exports.resolveProps=resolveProps$4})),require_util_contains_newline=__commonJSMin((exports=>{function containsNewline(key){if(!key)return null;switch(key.type){case`alias`:case`scalar`:case`double-quoted-scalar`:case`single-quoted-scalar`:if(key.source.includes(`
57
+ `))return!0;if(key.end){for(let st of key.end)if(st.type===`newline`)return!0}return!1;case`flow-collection`:for(let it of key.items){for(let st of it.start)if(st.type===`newline`)return!0;if(it.sep){for(let st of it.sep)if(st.type===`newline`)return!0}if(containsNewline(it.key)||containsNewline(it.value))return!0}return!1;default:return!0}}exports.containsNewline=containsNewline})),require_util_flow_indent_check=__commonJSMin((exports=>{var utilContainsNewline$2=require_util_contains_newline();function flowIndentCheck(indent,fc,onError){if(fc?.type===`flow-collection`){let end=fc.end[0];end.indent===indent&&(end.source===`]`||end.source===`}`)&&utilContainsNewline$2.containsNewline(fc)&&onError(end,`BAD_INDENT`,`Flow end indicator should be more indented than parent`,!0)}}exports.flowIndentCheck=flowIndentCheck})),require_util_map_includes=__commonJSMin((exports=>{var identity$7=require_identity();function mapIncludes(ctx,items,search){let{uniqueKeys}=ctx.options;if(uniqueKeys===!1)return!1;let isEqual=typeof uniqueKeys==`function`?uniqueKeys:(a,b)=>a===b||identity$7.isScalar(a)&&identity$7.isScalar(b)&&a.value===b.value;return items.some(pair=>isEqual(pair.key,search))}exports.mapIncludes=mapIncludes})),require_resolve_block_map=__commonJSMin((exports=>{var Pair$2=require_Pair(),YAMLMap$5=require_YAMLMap(),resolveProps$3=require_resolve_props(),utilContainsNewline$1=require_util_contains_newline(),utilFlowIndentCheck$1=require_util_flow_indent_check(),utilMapIncludes$1=require_util_map_includes();let startColMsg=`All mapping items must start at the same column`;function resolveBlockMap$1({composeNode:composeNode$2,composeEmptyNode:composeEmptyNode$1},ctx,bm,onError,tag){let map$6=new(tag?.nodeClass??YAMLMap$5.YAMLMap)(ctx.schema);ctx.atRoot&&=!1;let offset=bm.offset,commentEnd=null;for(let collItem of bm.items){let{start,key,sep,value}=collItem,keyProps=resolveProps$3.resolveProps(start,{indicator:`explicit-key-ind`,next:key??sep?.[0],offset,onError,parentIndent:bm.indent,startOnNewline:!0}),implicitKey=!keyProps.found;if(implicitKey){if(key&&(key.type===`block-seq`?onError(offset,`BLOCK_AS_IMPLICIT_KEY`,`A block sequence may not be used as an implicit map key`):`indent`in key&&key.indent!==bm.indent&&onError(offset,`BAD_INDENT`,startColMsg)),!keyProps.anchor&&!keyProps.tag&&!sep){commentEnd=keyProps.end,keyProps.comment&&(map$6.comment?map$6.comment+=`
58
+ `+keyProps.comment:map$6.comment=keyProps.comment);continue}(keyProps.newlineAfterProp||utilContainsNewline$1.containsNewline(key))&&onError(key??start[start.length-1],`MULTILINE_IMPLICIT_KEY`,`Implicit keys need to be on a single line`)}else keyProps.found?.indent!==bm.indent&&onError(offset,`BAD_INDENT`,startColMsg);ctx.atKey=!0;let keyStart=keyProps.end,keyNode=key?composeNode$2(ctx,key,keyProps,onError):composeEmptyNode$1(ctx,keyStart,start,null,keyProps,onError);ctx.schema.compat&&utilFlowIndentCheck$1.flowIndentCheck(bm.indent,key,onError),ctx.atKey=!1,utilMapIncludes$1.mapIncludes(ctx,map$6.items,keyNode)&&onError(keyStart,`DUPLICATE_KEY`,`Map keys must be unique`);let valueProps=resolveProps$3.resolveProps(sep??[],{indicator:`map-value-ind`,next:value,offset:keyNode.range[2],onError,parentIndent:bm.indent,startOnNewline:!key||key.type===`block-scalar`});if(offset=valueProps.end,valueProps.found){implicitKey&&(value?.type===`block-map`&&!valueProps.hasNewline&&onError(offset,`BLOCK_AS_IMPLICIT_KEY`,`Nested mappings are not allowed in compact mappings`),ctx.options.strict&&keyProps.start<valueProps.found.offset-1024&&onError(keyNode.range,`KEY_OVER_1024_CHARS`,`The : indicator must be at most 1024 chars after the start of an implicit block mapping key`));let valueNode=value?composeNode$2(ctx,value,valueProps,onError):composeEmptyNode$1(ctx,offset,sep,null,valueProps,onError);ctx.schema.compat&&utilFlowIndentCheck$1.flowIndentCheck(bm.indent,value,onError),offset=valueNode.range[2];let pair=new Pair$2.Pair(keyNode,valueNode);ctx.options.keepSourceTokens&&(pair.srcToken=collItem),map$6.items.push(pair)}else{implicitKey&&onError(keyNode.range,`MISSING_CHAR`,`Implicit map keys need to be followed by map values`),valueProps.comment&&(keyNode.comment?keyNode.comment+=`
59
+ `+valueProps.comment:keyNode.comment=valueProps.comment);let pair=new Pair$2.Pair(keyNode);ctx.options.keepSourceTokens&&(pair.srcToken=collItem),map$6.items.push(pair)}}return commentEnd&&commentEnd<offset&&onError(commentEnd,`IMPOSSIBLE`,`Map comment with trailing content`),map$6.range=[bm.offset,offset,commentEnd??offset],map$6}exports.resolveBlockMap=resolveBlockMap$1})),require_resolve_block_seq=__commonJSMin((exports=>{var YAMLSeq$5=require_YAMLSeq(),resolveProps$2=require_resolve_props(),utilFlowIndentCheck=require_util_flow_indent_check();function resolveBlockSeq$1({composeNode:composeNode$2,composeEmptyNode:composeEmptyNode$1},ctx,bs,onError,tag){let seq$6=new(tag?.nodeClass??YAMLSeq$5.YAMLSeq)(ctx.schema);ctx.atRoot&&=!1,ctx.atKey&&=!1;let offset=bs.offset,commentEnd=null;for(let{start,value}of bs.items){let props=resolveProps$2.resolveProps(start,{indicator:`seq-item-ind`,next:value,offset,onError,parentIndent:bs.indent,startOnNewline:!0});if(!props.found)if(props.anchor||props.tag||value)value&&value.type===`block-seq`?onError(props.end,`BAD_INDENT`,`All sequence items must start at the same column`):onError(offset,`MISSING_CHAR`,`Sequence item without - indicator`);else{commentEnd=props.end,props.comment&&(seq$6.comment=props.comment);continue}let node=value?composeNode$2(ctx,value,props,onError):composeEmptyNode$1(ctx,props.end,start,null,props,onError);ctx.schema.compat&&utilFlowIndentCheck.flowIndentCheck(bs.indent,value,onError),offset=node.range[2],seq$6.items.push(node)}return seq$6.range=[bs.offset,offset,commentEnd??offset],seq$6}exports.resolveBlockSeq=resolveBlockSeq$1})),require_resolve_end=__commonJSMin((exports=>{function resolveEnd$5(end,offset,reqSpace,onError){let comment=``;if(end){let hasSpace=!1,sep=``;for(let token of end){let{source,type}=token;switch(type){case`space`:hasSpace=!0;break;case`comment`:{reqSpace&&!hasSpace&&onError(token,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let cb=source.substring(1)||` `;comment?comment+=sep+cb:comment=cb,sep=``;break}case`newline`:comment&&(sep+=source),hasSpace=!0;break;default:onError(token,`UNEXPECTED_TOKEN`,`Unexpected ${type} at node end`)}offset+=source.length}}return{comment,offset}}exports.resolveEnd=resolveEnd$5})),require_resolve_flow_collection=__commonJSMin((exports=>{var identity$6=require_identity(),Pair$1=require_Pair(),YAMLMap$4=require_YAMLMap(),YAMLSeq$4=require_YAMLSeq(),resolveEnd$4=require_resolve_end(),resolveProps$1=require_resolve_props(),utilContainsNewline=require_util_contains_newline(),utilMapIncludes=require_util_map_includes();let blockMsg=`Block collections are not allowed within flow collections`,isBlock=token=>token&&(token.type===`block-map`||token.type===`block-seq`);function resolveFlowCollection$1({composeNode:composeNode$2,composeEmptyNode:composeEmptyNode$1},ctx,fc,onError,tag){let isMap$3=fc.start.source===`{`,fcName=isMap$3?`flow map`:`flow sequence`,coll=new(tag?.nodeClass??(isMap$3?YAMLMap$4.YAMLMap:YAMLSeq$4.YAMLSeq))(ctx.schema);coll.flow=!0;let atRoot=ctx.atRoot;atRoot&&(ctx.atRoot=!1),ctx.atKey&&=!1;let offset=fc.offset+fc.start.source.length;for(let i=0;i<fc.items.length;++i){let collItem=fc.items[i],{start,key,sep,value}=collItem,props=resolveProps$1.resolveProps(start,{flow:fcName,indicator:`explicit-key-ind`,next:key??sep?.[0],offset,onError,parentIndent:fc.indent,startOnNewline:!1});if(!props.found){if(!props.anchor&&!props.tag&&!sep&&!value){i===0&&props.comma?onError(props.comma,`UNEXPECTED_TOKEN`,`Unexpected , in ${fcName}`):i<fc.items.length-1&&onError(props.start,`UNEXPECTED_TOKEN`,`Unexpected empty item in ${fcName}`),props.comment&&(coll.comment?coll.comment+=`
60
+ `+props.comment:coll.comment=props.comment),offset=props.end;continue}!isMap$3&&ctx.options.strict&&utilContainsNewline.containsNewline(key)&&onError(key,`MULTILINE_IMPLICIT_KEY`,`Implicit keys of flow sequence pairs need to be on a single line`)}if(i===0)props.comma&&onError(props.comma,`UNEXPECTED_TOKEN`,`Unexpected , in ${fcName}`);else if(props.comma||onError(props.start,`MISSING_CHAR`,`Missing , between ${fcName} items`),props.comment){let prevItemComment=``;loop:for(let st of start)switch(st.type){case`comma`:case`space`:break;case`comment`:prevItemComment=st.source.substring(1);break loop;default:break loop}if(prevItemComment){let prev=coll.items[coll.items.length-1];identity$6.isPair(prev)&&(prev=prev.value??prev.key),prev.comment?prev.comment+=`
61
+ `+prevItemComment:prev.comment=prevItemComment,props.comment=props.comment.substring(prevItemComment.length+1)}}if(!isMap$3&&!sep&&!props.found){let valueNode=value?composeNode$2(ctx,value,props,onError):composeEmptyNode$1(ctx,props.end,sep,null,props,onError);coll.items.push(valueNode),offset=valueNode.range[2],isBlock(value)&&onError(valueNode.range,`BLOCK_IN_FLOW`,blockMsg)}else{ctx.atKey=!0;let keyStart=props.end,keyNode=key?composeNode$2(ctx,key,props,onError):composeEmptyNode$1(ctx,keyStart,start,null,props,onError);isBlock(key)&&onError(keyNode.range,`BLOCK_IN_FLOW`,blockMsg),ctx.atKey=!1;let valueProps=resolveProps$1.resolveProps(sep??[],{flow:fcName,indicator:`map-value-ind`,next:value,offset:keyNode.range[2],onError,parentIndent:fc.indent,startOnNewline:!1});if(valueProps.found){if(!isMap$3&&!props.found&&ctx.options.strict){if(sep)for(let st of sep){if(st===valueProps.found)break;if(st.type===`newline`){onError(st,`MULTILINE_IMPLICIT_KEY`,`Implicit keys of flow sequence pairs need to be on a single line`);break}}props.start<valueProps.found.offset-1024&&onError(valueProps.found,`KEY_OVER_1024_CHARS`,`The : indicator must be at most 1024 chars after the start of an implicit flow sequence key`)}}else value&&(`source`in value&&value.source&&value.source[0]===`:`?onError(value,`MISSING_CHAR`,`Missing space after : in ${fcName}`):onError(valueProps.start,`MISSING_CHAR`,`Missing , or : between ${fcName} items`));let valueNode=value?composeNode$2(ctx,value,valueProps,onError):valueProps.found?composeEmptyNode$1(ctx,valueProps.end,sep,null,valueProps,onError):null;valueNode?isBlock(value)&&onError(valueNode.range,`BLOCK_IN_FLOW`,blockMsg):valueProps.comment&&(keyNode.comment?keyNode.comment+=`
62
+ `+valueProps.comment:keyNode.comment=valueProps.comment);let pair=new Pair$1.Pair(keyNode,valueNode);if(ctx.options.keepSourceTokens&&(pair.srcToken=collItem),isMap$3){let map$6=coll;utilMapIncludes.mapIncludes(ctx,map$6.items,keyNode)&&onError(keyStart,`DUPLICATE_KEY`,`Map keys must be unique`),map$6.items.push(pair)}else{let map$6=new YAMLMap$4.YAMLMap(ctx.schema);map$6.flow=!0,map$6.items.push(pair);let endRange=(valueNode??keyNode).range;map$6.range=[keyNode.range[0],endRange[1],endRange[2]],coll.items.push(map$6)}offset=valueNode?valueNode.range[2]:valueProps.end}}let expectedEnd=isMap$3?`}`:`]`,[ce,...ee]=fc.end,cePos=offset;if(ce&&ce.source===expectedEnd)cePos=ce.offset+ce.source.length;else{let name=fcName[0].toUpperCase()+fcName.substring(1),msg=atRoot?`${name} must end with a ${expectedEnd}`:`${name} in block collection must be sufficiently indented and end with a ${expectedEnd}`;onError(offset,atRoot?`MISSING_CHAR`:`BAD_INDENT`,msg),ce&&ce.source.length!==1&&ee.unshift(ce)}if(ee.length>0){let end=resolveEnd$4.resolveEnd(ee,cePos,ctx.options.strict,onError);end.comment&&(coll.comment?coll.comment+=`
63
+ `+end.comment:coll.comment=end.comment),coll.range=[fc.offset,cePos,end.offset]}else coll.range=[fc.offset,cePos,cePos];return coll}exports.resolveFlowCollection=resolveFlowCollection$1})),require_compose_collection=__commonJSMin((exports=>{var identity$5=require_identity(),Scalar$4=require_Scalar(),YAMLMap$3=require_YAMLMap(),YAMLSeq$3=require_YAMLSeq(),resolveBlockMap=require_resolve_block_map(),resolveBlockSeq=require_resolve_block_seq(),resolveFlowCollection=require_resolve_flow_collection();function resolveCollection(CN$1,ctx,token,onError,tagName,tag){let coll=token.type===`block-map`?resolveBlockMap.resolveBlockMap(CN$1,ctx,token,onError,tag):token.type===`block-seq`?resolveBlockSeq.resolveBlockSeq(CN$1,ctx,token,onError,tag):resolveFlowCollection.resolveFlowCollection(CN$1,ctx,token,onError,tag),Coll=coll.constructor;return tagName===`!`||tagName===Coll.tagName?(coll.tag=Coll.tagName,coll):(tagName&&(coll.tag=tagName),coll)}function composeCollection$1(CN$1,ctx,token,props,onError){let tagToken=props.tag,tagName=tagToken?ctx.directives.tagName(tagToken.source,msg=>onError(tagToken,`TAG_RESOLVE_FAILED`,msg)):null;if(token.type===`block-seq`){let{anchor,newlineAfterProp:nl}=props,lastProp=anchor&&tagToken?anchor.offset>tagToken.offset?anchor:tagToken:anchor??tagToken;lastProp&&(!nl||nl.offset<lastProp.offset)&&onError(lastProp,`MISSING_CHAR`,`Missing newline after block sequence props`)}let expType=token.type===`block-map`?`map`:token.type===`block-seq`?`seq`:token.start.source===`{`?`map`:`seq`;if(!tagToken||!tagName||tagName===`!`||tagName===YAMLMap$3.YAMLMap.tagName&&expType===`map`||tagName===YAMLSeq$3.YAMLSeq.tagName&&expType===`seq`)return resolveCollection(CN$1,ctx,token,onError,tagName);let tag=ctx.schema.tags.find(t=>t.tag===tagName&&t.collection===expType);if(!tag){let kt=ctx.schema.knownTags[tagName];if(kt&&kt.collection===expType)ctx.schema.tags.push(Object.assign({},kt,{default:!1})),tag=kt;else return kt?onError(tagToken,`BAD_COLLECTION_TYPE`,`${kt.tag} used for ${expType} collection, but expects ${kt.collection??`scalar`}`,!0):onError(tagToken,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${tagName}`,!0),resolveCollection(CN$1,ctx,token,onError,tagName)}let coll=resolveCollection(CN$1,ctx,token,onError,tagName,tag),res=tag.resolve?.(coll,msg=>onError(tagToken,`TAG_RESOLVE_FAILED`,msg),ctx.options)??coll,node=identity$5.isNode(res)?res:new Scalar$4.Scalar(res);return node.range=coll.range,node.tag=tagName,tag?.format&&(node.format=tag.format),node}exports.composeCollection=composeCollection$1})),require_resolve_block_scalar=__commonJSMin((exports=>{var Scalar$3=require_Scalar();function resolveBlockScalar$2(ctx,scalar,onError){let start=scalar.offset,header=parseBlockScalarHeader(scalar,ctx.options.strict,onError);if(!header)return{value:``,type:null,comment:``,range:[start,start,start]};let type=header.mode===`>`?Scalar$3.Scalar.BLOCK_FOLDED:Scalar$3.Scalar.BLOCK_LITERAL,lines=scalar.source?splitLines(scalar.source):[],chompStart=lines.length;for(let i=lines.length-1;i>=0;--i){let content=lines[i][1];if(content===``||content===`\r`)chompStart=i;else break}if(chompStart===0){let value$1=header.chomp===`+`&&lines.length>0?`
64
+ `.repeat(Math.max(1,lines.length-1)):``,end$1=start+header.length;return scalar.source&&(end$1+=scalar.source.length),{value:value$1,type,comment:header.comment,range:[start,end$1,end$1]}}let trimIndent=scalar.indent+header.indent,offset=scalar.offset+header.length,contentStart=0;for(let i=0;i<chompStart;++i){let[indent,content]=lines[i];if(content===``||content===`\r`)header.indent===0&&indent.length>trimIndent&&(trimIndent=indent.length);else{indent.length<trimIndent&&onError(offset+indent.length,`MISSING_CHAR`,`Block scalars with more-indented leading empty lines must use an explicit indentation indicator`),header.indent===0&&(trimIndent=indent.length),contentStart=i,trimIndent===0&&!ctx.atRoot&&onError(offset,`BAD_INDENT`,`Block scalar values in collections must be indented`);break}offset+=indent.length+content.length+1}for(let i=lines.length-1;i>=chompStart;--i)lines[i][0].length>trimIndent&&(chompStart=i+1);let value=``,sep=``,prevMoreIndented=!1;for(let i=0;i<contentStart;++i)value+=lines[i][0].slice(trimIndent)+`
65
+ `;for(let i=contentStart;i<chompStart;++i){let[indent,content]=lines[i];offset+=indent.length+content.length+1;let crlf=content[content.length-1]===`\r`;if(crlf&&(content=content.slice(0,-1)),content&&indent.length<trimIndent){let message=`Block scalar lines must not be less indented than their ${header.indent?`explicit indentation indicator`:`first line`}`;onError(offset-content.length-(crlf?2:1),`BAD_INDENT`,message),indent=``}type===Scalar$3.Scalar.BLOCK_LITERAL?(value+=sep+indent.slice(trimIndent)+content,sep=`
66
+ `):indent.length>trimIndent||content[0]===` `?(sep===` `?sep=`
67
+ `:!prevMoreIndented&&sep===`
68
+ `&&(sep=`
69
+
70
+ `),value+=sep+indent.slice(trimIndent)+content,sep=`
71
+ `,prevMoreIndented=!0):content===``?sep===`
72
+ `?value+=`
73
+ `:sep=`
74
+ `:(value+=sep+content,sep=` `,prevMoreIndented=!1)}switch(header.chomp){case`-`:break;case`+`:for(let i=chompStart;i<lines.length;++i)value+=`
75
+ `+lines[i][0].slice(trimIndent);value[value.length-1]!==`
76
+ `&&(value+=`
77
+ `);break;default:value+=`
78
+ `}let end=start+header.length+scalar.source.length;return{value,type,comment:header.comment,range:[start,end,end]}}function parseBlockScalarHeader({offset,props},strict,onError){if(props[0].type!==`block-scalar-header`)return onError(props[0],`IMPOSSIBLE`,`Block scalar header not found`),null;let{source}=props[0],mode=source[0],indent=0,chomp=``,error=-1;for(let i=1;i<source.length;++i){let ch=source[i];if(!chomp&&(ch===`-`||ch===`+`))chomp=ch;else{let n=Number(ch);!indent&&n?indent=n:error===-1&&(error=offset+i)}}error!==-1&&onError(error,`UNEXPECTED_TOKEN`,`Block scalar header includes extra characters: ${source}`);let hasSpace=!1,comment=``,length=source.length;for(let i=1;i<props.length;++i){let token=props[i];switch(token.type){case`space`:hasSpace=!0;case`newline`:length+=token.source.length;break;case`comment`:strict&&!hasSpace&&onError(token,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`),length+=token.source.length,comment=token.source.substring(1);break;case`error`:onError(token,`UNEXPECTED_TOKEN`,token.message),length+=token.source.length;break;default:{onError(token,`UNEXPECTED_TOKEN`,`Unexpected token in block scalar header: ${token.type}`);let ts=token.source;ts&&typeof ts==`string`&&(length+=ts.length)}}}return{mode,indent,chomp,comment,length}}function splitLines(source){let split=source.split(/\n( *)/),first=split[0],m=first.match(/^( *)/),lines=[m?.[1]?[m[1],first.slice(m[1].length)]:[``,first]];for(let i=1;i<split.length;i+=2)lines.push([split[i],split[i+1]]);return lines}exports.resolveBlockScalar=resolveBlockScalar$2})),require_resolve_flow_scalar=__commonJSMin((exports=>{var Scalar$2=require_Scalar(),resolveEnd$3=require_resolve_end();function resolveFlowScalar$2(scalar,strict,onError){let{offset,type,source,end}=scalar,_type,value,_onError=(rel,code,msg)=>onError(offset+rel,code,msg);switch(type){case`scalar`:_type=Scalar$2.Scalar.PLAIN,value=plainValue(source,_onError);break;case`single-quoted-scalar`:_type=Scalar$2.Scalar.QUOTE_SINGLE,value=singleQuotedValue(source,_onError);break;case`double-quoted-scalar`:_type=Scalar$2.Scalar.QUOTE_DOUBLE,value=doubleQuotedValue(source,_onError);break;default:return onError(scalar,`UNEXPECTED_TOKEN`,`Expected a flow scalar value, but found: ${type}`),{value:``,type:null,comment:``,range:[offset,offset+source.length,offset+source.length]}}let valueEnd=offset+source.length,re=resolveEnd$3.resolveEnd(end,valueEnd,strict,onError);return{value,type:_type,comment:re.comment,range:[offset,valueEnd,re.offset]}}function plainValue(source,onError){let badChar=``;switch(source[0]){case` `:badChar=`a tab character`;break;case`,`:badChar=`flow indicator character ,`;break;case`%`:badChar=`directive indicator character %`;break;case`|`:case`>`:badChar=`block scalar indicator ${source[0]}`;break;case`@`:case"`":badChar=`reserved character ${source[0]}`;break}return badChar&&onError(0,`BAD_SCALAR_START`,`Plain value cannot start with ${badChar}`),foldLines(source)}function singleQuotedValue(source,onError){return(source[source.length-1]!==`'`||source.length===1)&&onError(source.length,`MISSING_CHAR`,`Missing closing 'quote`),foldLines(source.slice(1,-1)).replace(/''/g,`'`)}function foldLines(source){let first,line;try{first=RegExp(`(.*?)(?<![ ])[ ]*\r?
79
+ `,`sy`),line=RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
80
+ `,`sy`)}catch{first=/(.*?)[ \t]*\r?\n/sy,line=/[ \t]*(.*?)[ \t]*\r?\n/sy}let match=first.exec(source);if(!match)return source;let res=match[1],sep=` `,pos=first.lastIndex;for(line.lastIndex=pos;match=line.exec(source);)match[1]===``?sep===`
81
+ `?res+=sep:sep=`
82
+ `:(res+=sep+match[1],sep=` `),pos=line.lastIndex;let last=/[ \t]*(.*)/sy;return last.lastIndex=pos,match=last.exec(source),res+sep+(match?.[1]??``)}function doubleQuotedValue(source,onError){let res=``;for(let i=1;i<source.length-1;++i){let ch=source[i];if(!(ch===`\r`&&source[i+1]===`
83
+ `))if(ch===`
84
+ `){let{fold,offset}=foldNewline(source,i);res+=fold,i=offset}else if(ch===`\\`){let next=source[++i],cc=escapeCodes[next];if(cc)res+=cc;else if(next===`
85
+ `)for(next=source[i+1];next===` `||next===` `;)next=source[++i+1];else if(next===`\r`&&source[i+1]===`
86
+ `)for(next=source[++i+1];next===` `||next===` `;)next=source[++i+1];else if(next===`x`||next===`u`||next===`U`){let length={x:2,u:4,U:8}[next];res+=parseCharCode(source,i+1,length,onError),i+=length}else{let raw=source.substr(i-1,2);onError(i-1,`BAD_DQ_ESCAPE`,`Invalid escape sequence ${raw}`),res+=raw}}else if(ch===` `||ch===` `){let wsStart=i,next=source[i+1];for(;next===` `||next===` `;)next=source[++i+1];next!==`
87
+ `&&!(next===`\r`&&source[i+2]===`
88
+ `)&&(res+=i>wsStart?source.slice(wsStart,i+1):ch)}else res+=ch}return(source[source.length-1]!==`"`||source.length===1)&&onError(source.length,`MISSING_CHAR`,`Missing closing "quote`),res}function foldNewline(source,offset){let fold=``,ch=source[offset+1];for(;(ch===` `||ch===` `||ch===`
89
+ `||ch===`\r`)&&!(ch===`\r`&&source[offset+2]!==`
90
+ `);)ch===`
91
+ `&&(fold+=`
92
+ `),offset+=1,ch=source[offset+1];return fold||=` `,{fold,offset}}let escapeCodes={0:`\0`,a:`\x07`,b:`\b`,e:`\x1B`,f:`\f`,n:`
93
+ `,r:`\r`,t:` `,v:`\v`,N:`…`,_:`\xA0`,L:`\u2028`,P:`\u2029`," ":` `,'"':`"`,"/":`/`,"\\":`\\`," ":` `};function parseCharCode(source,offset,length,onError){let cc=source.substr(offset,length),code=cc.length===length&&/^[0-9a-fA-F]+$/.test(cc)?parseInt(cc,16):NaN;if(isNaN(code)){let raw=source.substr(offset-2,length+2);return onError(offset-2,`BAD_DQ_ESCAPE`,`Invalid escape sequence ${raw}`),raw}return String.fromCodePoint(code)}exports.resolveFlowScalar=resolveFlowScalar$2})),require_compose_scalar=__commonJSMin((exports=>{var identity$4=require_identity(),Scalar$1=require_Scalar(),resolveBlockScalar$1=require_resolve_block_scalar(),resolveFlowScalar$1=require_resolve_flow_scalar();function composeScalar$1(ctx,token,tagToken,onError){let{value,type,comment,range}=token.type===`block-scalar`?resolveBlockScalar$1.resolveBlockScalar(ctx,token,onError):resolveFlowScalar$1.resolveFlowScalar(token,ctx.options.strict,onError),tagName=tagToken?ctx.directives.tagName(tagToken.source,msg=>onError(tagToken,`TAG_RESOLVE_FAILED`,msg)):null,tag;tag=ctx.options.stringKeys&&ctx.atKey?ctx.schema[identity$4.SCALAR]:tagName?findScalarTagByName(ctx.schema,value,tagName,tagToken,onError):token.type===`scalar`?findScalarTagByTest(ctx,value,token,onError):ctx.schema[identity$4.SCALAR];let scalar;try{let res=tag.resolve(value,msg=>onError(tagToken??token,`TAG_RESOLVE_FAILED`,msg),ctx.options);scalar=identity$4.isScalar(res)?res:new Scalar$1.Scalar(res)}catch(error){let msg=error instanceof Error?error.message:String(error);onError(tagToken??token,`TAG_RESOLVE_FAILED`,msg),scalar=new Scalar$1.Scalar(value)}return scalar.range=range,scalar.source=value,type&&(scalar.type=type),tagName&&(scalar.tag=tagName),tag.format&&(scalar.format=tag.format),comment&&(scalar.comment=comment),scalar}function findScalarTagByName(schema$6,value,tagName,tagToken,onError){if(tagName===`!`)return schema$6[identity$4.SCALAR];let matchWithTest=[];for(let tag of schema$6.tags)if(!tag.collection&&tag.tag===tagName)if(tag.default&&tag.test)matchWithTest.push(tag);else return tag;for(let tag of matchWithTest)if(tag.test?.test(value))return tag;let kt=schema$6.knownTags[tagName];return kt&&!kt.collection?(schema$6.tags.push(Object.assign({},kt,{default:!1,test:void 0})),kt):(onError(tagToken,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${tagName}`,tagName!==`tag:yaml.org,2002:str`),schema$6[identity$4.SCALAR])}function findScalarTagByTest({atKey,directives:directives$2,schema:schema$6},value,token,onError){let tag=schema$6.tags.find(tag$1=>(tag$1.default===!0||atKey&&tag$1.default===`key`)&&tag$1.test?.test(value))||schema$6[identity$4.SCALAR];if(schema$6.compat){let compat=schema$6.compat.find(tag$1=>tag$1.default&&tag$1.test?.test(value))??schema$6[identity$4.SCALAR];tag.tag!==compat.tag&&onError(token,`TAG_RESOLVE_FAILED`,`Value may be parsed as either ${directives$2.tagString(tag.tag)} or ${directives$2.tagString(compat.tag)}`,!0)}return tag}exports.composeScalar=composeScalar$1})),require_util_empty_scalar_position=__commonJSMin((exports=>{function emptyScalarPosition(offset,before,pos){if(before){pos??=before.length;for(let i=pos-1;i>=0;--i){let st=before[i];switch(st.type){case`space`:case`comment`:case`newline`:offset-=st.source.length;continue}for(st=before[++i];st?.type===`space`;)offset+=st.source.length,st=before[++i];break}}return offset}exports.emptyScalarPosition=emptyScalarPosition})),require_compose_node=__commonJSMin((exports=>{var Alias$1=require_Alias(),identity$3=require_identity(),composeCollection=require_compose_collection(),composeScalar=require_compose_scalar(),resolveEnd$2=require_resolve_end(),utilEmptyScalarPosition=require_util_empty_scalar_position();let CN={composeNode:composeNode$1,composeEmptyNode};function composeNode$1(ctx,token,props,onError){let atKey=ctx.atKey,{spaceBefore,comment,anchor,tag}=props,node,isSrcToken=!0;switch(token.type){case`alias`:node=composeAlias(ctx,token,onError),(anchor||tag)&&onError(token,`ALIAS_PROPS`,`An alias node must not specify any properties`);break;case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:case`block-scalar`:node=composeScalar.composeScalar(ctx,token,tag,onError),anchor&&(node.anchor=anchor.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:node=composeCollection.composeCollection(CN,ctx,token,props,onError),anchor&&(node.anchor=anchor.source.substring(1));break;default:onError(token,`UNEXPECTED_TOKEN`,token.type===`error`?token.message:`Unsupported token (type: ${token.type})`),node=composeEmptyNode(ctx,token.offset,void 0,null,props,onError),isSrcToken=!1}return anchor&&node.anchor===``&&onError(anchor,`BAD_ALIAS`,`Anchor cannot be an empty string`),atKey&&ctx.options.stringKeys&&(!identity$3.isScalar(node)||typeof node.value!=`string`||node.tag&&node.tag!==`tag:yaml.org,2002:str`)&&onError(tag??token,`NON_STRING_KEY`,`With stringKeys, all keys must be strings`),spaceBefore&&(node.spaceBefore=!0),comment&&(token.type===`scalar`&&token.source===``?node.comment=comment:node.commentBefore=comment),ctx.options.keepSourceTokens&&isSrcToken&&(node.srcToken=token),node}function composeEmptyNode(ctx,offset,before,pos,{spaceBefore,comment,anchor,tag,end},onError){let token={type:`scalar`,offset:utilEmptyScalarPosition.emptyScalarPosition(offset,before,pos),indent:-1,source:``},node=composeScalar.composeScalar(ctx,token,tag,onError);return anchor&&(node.anchor=anchor.source.substring(1),node.anchor===``&&onError(anchor,`BAD_ALIAS`,`Anchor cannot be an empty string`)),spaceBefore&&(node.spaceBefore=!0),comment&&(node.comment=comment,node.range[2]=end),node}function composeAlias({options},{offset,source,end},onError){let alias=new Alias$1.Alias(source.substring(1));alias.source===``&&onError(offset,`BAD_ALIAS`,`Alias cannot be an empty string`),alias.source.endsWith(`:`)&&onError(offset+source.length-1,`BAD_ALIAS`,`Alias ending in : is ambiguous`,!0);let valueEnd=offset+source.length,re=resolveEnd$2.resolveEnd(end,valueEnd,options.strict,onError);return alias.range=[offset,valueEnd,re.offset],re.comment&&(alias.comment=re.comment),alias}exports.composeEmptyNode=composeEmptyNode,exports.composeNode=composeNode$1})),require_compose_doc=__commonJSMin((exports=>{var Document$5=require_Document(),composeNode=require_compose_node(),resolveEnd$1=require_resolve_end(),resolveProps=require_resolve_props();function composeDoc$1(options,directives$2,{offset,start,value,end},onError){let opts=Object.assign({_directives:directives$2},options),doc=new Document$5.Document(void 0,opts),ctx={atKey:!1,atRoot:!0,directives:doc.directives,options:doc.options,schema:doc.schema},props=resolveProps.resolveProps(start,{indicator:`doc-start`,next:value??end?.[0],offset,onError,parentIndent:0,startOnNewline:!0});props.found&&(doc.directives.docStart=!0,value&&(value.type===`block-map`||value.type===`block-seq`)&&!props.hasNewline&&onError(props.end,`MISSING_CHAR`,`Block collection cannot start on same line with directives-end marker`)),doc.contents=value?composeNode.composeNode(ctx,value,props,onError):composeNode.composeEmptyNode(ctx,props.end,start,null,props,onError);let contentEnd=doc.contents.range[2],re=resolveEnd$1.resolveEnd(end,contentEnd,!1,onError);return re.comment&&(doc.comment=re.comment),doc.range=[offset,contentEnd,re.offset],doc}exports.composeDoc=composeDoc$1})),require_composer=__commonJSMin((exports=>{var node_process$1=__require(`process`),directives=require_directives(),Document$4=require_Document(),errors$3=require_errors(),identity$2=require_identity(),composeDoc=require_compose_doc(),resolveEnd=require_resolve_end();function getErrorPos(src){if(typeof src==`number`)return[src,src+1];if(Array.isArray(src))return src.length===2?src:[src[0],src[1]];let{offset,source}=src;return[offset,offset+(typeof source==`string`?source.length:1)]}function parsePrelude(prelude){let comment=``,atComment=!1,afterEmptyLine=!1;for(let i=0;i<prelude.length;++i){let source=prelude[i];switch(source[0]){case`#`:comment+=(comment===``?``:afterEmptyLine?`
94
+
95
+ `:`
96
+ `)+(source.substring(1)||` `),atComment=!0,afterEmptyLine=!1;break;case`%`:prelude[i+1]?.[0]!==`#`&&(i+=1),atComment=!1;break;default:atComment||(afterEmptyLine=!0),atComment=!1}}return{comment,afterEmptyLine}}exports.Composer=class{constructor(options={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(source,code,message,warning)=>{let pos=getErrorPos(source);warning?this.warnings.push(new errors$3.YAMLWarning(pos,code,message)):this.errors.push(new errors$3.YAMLParseError(pos,code,message))},this.directives=new directives.Directives({version:options.version||`1.2`}),this.options=options}decorate(doc,afterDoc){let{comment,afterEmptyLine}=parsePrelude(this.prelude);if(comment){let dc=doc.contents;if(afterDoc)doc.comment=doc.comment?`${doc.comment}\n${comment}`:comment;else if(afterEmptyLine||doc.directives.docStart||!dc)doc.commentBefore=comment;else if(identity$2.isCollection(dc)&&!dc.flow&&dc.items.length>0){let it=dc.items[0];identity$2.isPair(it)&&(it=it.key);let cb=it.commentBefore;it.commentBefore=cb?`${comment}\n${cb}`:comment}else{let cb=dc.commentBefore;dc.commentBefore=cb?`${comment}\n${cb}`:comment}}afterDoc?(Array.prototype.push.apply(doc.errors,this.errors),Array.prototype.push.apply(doc.warnings,this.warnings)):(doc.errors=this.errors,doc.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:parsePrelude(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(tokens,forceDoc=!1,endOffset=-1){for(let token of tokens)yield*this.next(token);yield*this.end(forceDoc,endOffset)}*next(token){switch(node_process$1.env.LOG_STREAM&&console.dir(token,{depth:null}),token.type){case`directive`:this.directives.add(token.source,(offset,message,warning)=>{let pos=getErrorPos(token);pos[0]+=offset,this.onError(pos,`BAD_DIRECTIVE`,message,warning)}),this.prelude.push(token.source),this.atDirectives=!0;break;case`document`:{let doc=composeDoc.composeDoc(this.options,this.directives,token,this.onError);this.atDirectives&&!doc.directives.docStart&&this.onError(token,`MISSING_CHAR`,`Missing directives-end/doc-start indicator line`),this.decorate(doc,!1),this.doc&&(yield this.doc),this.doc=doc,this.atDirectives=!1;break}case`byte-order-mark`:case`space`:break;case`comment`:case`newline`:this.prelude.push(token.source);break;case`error`:{let msg=token.source?`${token.message}: ${JSON.stringify(token.source)}`:token.message,error=new errors$3.YAMLParseError(getErrorPos(token),`UNEXPECTED_TOKEN`,msg);this.atDirectives||!this.doc?this.errors.push(error):this.doc.errors.push(error);break}case`doc-end`:{if(!this.doc){this.errors.push(new errors$3.YAMLParseError(getErrorPos(token),`UNEXPECTED_TOKEN`,`Unexpected doc-end without preceding document`));break}this.doc.directives.docEnd=!0;let end=resolveEnd.resolveEnd(token.end,token.offset+token.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),end.comment){let dc=this.doc.comment;this.doc.comment=dc?`${dc}\n${end.comment}`:end.comment}this.doc.range[2]=end.offset;break}default:this.errors.push(new errors$3.YAMLParseError(getErrorPos(token),`UNEXPECTED_TOKEN`,`Unsupported token ${token.type}`))}}*end(forceDoc=!1,endOffset=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(forceDoc){let opts=Object.assign({_directives:this.directives},this.options),doc=new Document$4.Document(void 0,opts);this.atDirectives&&this.onError(endOffset,`MISSING_CHAR`,`Missing directives-end indicator line`),doc.range=[0,endOffset,endOffset],this.decorate(doc,!1),yield doc}}}})),require_cst_scalar=__commonJSMin((exports=>{var resolveBlockScalar=require_resolve_block_scalar(),resolveFlowScalar=require_resolve_flow_scalar(),errors$2=require_errors(),stringifyString=require_stringifyString();function resolveAsScalar(token,strict=!0,onError){if(token){let _onError=(pos,code,message)=>{let offset=typeof pos==`number`?pos:Array.isArray(pos)?pos[0]:pos.offset;if(onError)onError(offset,code,message);else throw new errors$2.YAMLParseError([offset,offset+1],code,message)};switch(token.type){case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return resolveFlowScalar.resolveFlowScalar(token,strict,_onError);case`block-scalar`:return resolveBlockScalar.resolveBlockScalar({options:{strict}},token,_onError)}}return null}function createScalarToken(value,context){let{implicitKey=!1,indent,inFlow=!1,offset=-1,type=`PLAIN`}=context,source=stringifyString.stringifyString({type,value},{implicitKey,indent:indent>0?` `.repeat(indent):``,inFlow,options:{blockQuote:!0,lineWidth:-1}}),end=context.end??[{type:`newline`,offset:-1,indent,source:`
97
+ `}];switch(source[0]){case`|`:case`>`:{let he=source.indexOf(`
98
+ `),head=source.substring(0,he),body=source.substring(he+1)+`
99
+ `,props=[{type:`block-scalar-header`,offset,indent,source:head}];return addEndtoBlockProps(props,end)||props.push({type:`newline`,offset:-1,indent,source:`
100
+ `}),{type:`block-scalar`,offset,indent,props,source:body}}case`"`:return{type:`double-quoted-scalar`,offset,indent,source,end};case`'`:return{type:`single-quoted-scalar`,offset,indent,source,end};default:return{type:`scalar`,offset,indent,source,end}}}function setScalarValue(token,value,context={}){let{afterKey=!1,implicitKey=!1,inFlow=!1,type}=context,indent=`indent`in token?token.indent:null;if(afterKey&&typeof indent==`number`&&(indent+=2),!type)switch(token.type){case`single-quoted-scalar`:type=`QUOTE_SINGLE`;break;case`double-quoted-scalar`:type=`QUOTE_DOUBLE`;break;case`block-scalar`:{let header=token.props[0];if(header.type!==`block-scalar-header`)throw Error(`Invalid block scalar header`);type=header.source[0]===`>`?`BLOCK_FOLDED`:`BLOCK_LITERAL`;break}default:type=`PLAIN`}let source=stringifyString.stringifyString({type,value},{implicitKey:implicitKey||indent===null,indent:indent!==null&&indent>0?` `.repeat(indent):``,inFlow,options:{blockQuote:!0,lineWidth:-1}});switch(source[0]){case`|`:case`>`:setBlockScalarValue(token,source);break;case`"`:setFlowScalarValue(token,source,`double-quoted-scalar`);break;case`'`:setFlowScalarValue(token,source,`single-quoted-scalar`);break;default:setFlowScalarValue(token,source,`scalar`)}}function setBlockScalarValue(token,source){let he=source.indexOf(`
101
+ `),head=source.substring(0,he),body=source.substring(he+1)+`
102
+ `;if(token.type===`block-scalar`){let header=token.props[0];if(header.type!==`block-scalar-header`)throw Error(`Invalid block scalar header`);header.source=head,token.source=body}else{let{offset}=token,indent=`indent`in token?token.indent:-1,props=[{type:`block-scalar-header`,offset,indent,source:head}];addEndtoBlockProps(props,`end`in token?token.end:void 0)||props.push({type:`newline`,offset:-1,indent,source:`
103
+ `});for(let key of Object.keys(token))key!==`type`&&key!==`offset`&&delete token[key];Object.assign(token,{type:`block-scalar`,indent,props,source:body})}}function addEndtoBlockProps(props,end){if(end)for(let st of end)switch(st.type){case`space`:case`comment`:props.push(st);break;case`newline`:return props.push(st),!0}return!1}function setFlowScalarValue(token,source,type){switch(token.type){case`scalar`:case`double-quoted-scalar`:case`single-quoted-scalar`:token.type=type,token.source=source;break;case`block-scalar`:{let end=token.props.slice(1),oa=source.length;token.props[0].type===`block-scalar-header`&&(oa-=token.props[0].source.length);for(let tok of end)tok.offset+=oa;delete token.props,Object.assign(token,{type,source,end});break}case`block-map`:case`block-seq`:{let nl={type:`newline`,offset:token.offset+source.length,indent:token.indent,source:`
104
+ `};delete token.items,Object.assign(token,{type,source,end:[nl]});break}default:{let indent=`indent`in token?token.indent:-1,end=`end`in token&&Array.isArray(token.end)?token.end.filter(st=>st.type===`space`||st.type===`comment`||st.type===`newline`):[];for(let key of Object.keys(token))key!==`type`&&key!==`offset`&&delete token[key];Object.assign(token,{type,indent,source,end})}}}exports.createScalarToken=createScalarToken,exports.resolveAsScalar=resolveAsScalar,exports.setScalarValue=setScalarValue})),require_cst_stringify=__commonJSMin((exports=>{let stringify$1=cst$3=>`type`in cst$3?stringifyToken(cst$3):stringifyItem(cst$3);function stringifyToken(token){switch(token.type){case`block-scalar`:{let res=``;for(let tok of token.props)res+=stringifyToken(tok);return res+token.source}case`block-map`:case`block-seq`:{let res=``;for(let item of token.items)res+=stringifyItem(item);return res}case`flow-collection`:{let res=token.start.source;for(let item of token.items)res+=stringifyItem(item);for(let st of token.end)res+=st.source;return res}case`document`:{let res=stringifyItem(token);if(token.end)for(let st of token.end)res+=st.source;return res}default:{let res=token.source;if(`end`in token&&token.end)for(let st of token.end)res+=st.source;return res}}}function stringifyItem({start,key,sep,value}){let res=``;for(let st of start)res+=st.source;if(key&&(res+=stringifyToken(key)),sep)for(let st of sep)res+=st.source;return value&&(res+=stringifyToken(value)),res}exports.stringify=stringify$1})),require_cst_visit=__commonJSMin((exports=>{let BREAK=Symbol(`break visit`),SKIP=Symbol(`skip children`),REMOVE=Symbol(`remove item`);function visit$1(cst$3,visitor){`type`in cst$3&&cst$3.type===`document`&&(cst$3={start:cst$3.start,value:cst$3.value}),_visit(Object.freeze([]),cst$3,visitor)}visit$1.BREAK=BREAK,visit$1.SKIP=SKIP,visit$1.REMOVE=REMOVE,visit$1.itemAtPath=(cst$3,path)=>{let item=cst$3;for(let[field,index]of path){let tok=item?.[field];if(tok&&`items`in tok)item=tok.items[index];else return}return item},visit$1.parentCollection=(cst$3,path)=>{let parent=visit$1.itemAtPath(cst$3,path.slice(0,-1)),field=path[path.length-1][0],coll=parent?.[field];if(coll&&`items`in coll)return coll;throw Error(`Parent collection not found`)};function _visit(path,item,visitor){let ctrl=visitor(item,path);if(typeof ctrl==`symbol`)return ctrl;for(let field of[`key`,`value`]){let token=item[field];if(token&&`items`in token){for(let i=0;i<token.items.length;++i){let ci=_visit(Object.freeze(path.concat([[field,i]])),token.items[i],visitor);if(typeof ci==`number`)i=ci-1;else if(ci===BREAK)return BREAK;else ci===REMOVE&&(token.items.splice(i,1),--i)}typeof ctrl==`function`&&field===`key`&&(ctrl=ctrl(item,path))}}return typeof ctrl==`function`?ctrl(item,path):ctrl}exports.visit=visit$1})),require_cst=__commonJSMin((exports=>{var cstScalar=require_cst_scalar(),cstStringify=require_cst_stringify(),cstVisit=require_cst_visit();let isCollection=token=>!!token&&`items`in token,isScalar=token=>!!token&&(token.type===`scalar`||token.type===`single-quoted-scalar`||token.type===`double-quoted-scalar`||token.type===`block-scalar`);function prettyToken(token){switch(token){case``:return`<BOM>`;case``:return`<DOC>`;case``:return`<FLOW_END>`;case``:return`<SCALAR>`;default:return JSON.stringify(token)}}function tokenType(source){switch(source){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`
105
+ `:case`\r
106
+ `: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(source[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}exports.createScalarToken=cstScalar.createScalarToken,exports.resolveAsScalar=cstScalar.resolveAsScalar,exports.setScalarValue=cstScalar.setScalarValue,exports.stringify=cstStringify.stringify,exports.visit=cstVisit.visit,exports.BOM=``,exports.DOCUMENT=``,exports.FLOW_END=``,exports.SCALAR=``,exports.isCollection=isCollection,exports.isScalar=isScalar,exports.prettyToken=prettyToken,exports.tokenType=tokenType})),require_lexer=__commonJSMin((exports=>{var cst$2=require_cst();function isEmpty(ch){switch(ch){case void 0:case` `:case`
107
+ `:case`\r`:case` `:return!0;default:return!1}}let hexDigits=new Set(`0123456789ABCDEFabcdef`),tagChars=new Set(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()`),flowIndicatorChars=new Set(`,[]{}`),invalidAnchorChars=new Set(` ,[]{}
108
+ \r `),isNotAnchorChar=ch=>!ch||invalidAnchorChars.has(ch);exports.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(source,incomplete=!1){if(source){if(typeof source!=`string`)throw TypeError(`source is not a string`);this.buffer=this.buffer?this.buffer+source:source,this.lineEndPos=null}this.atEnd=!incomplete;let next=this.next??`stream`;for(;next&&(incomplete||this.hasChars(1));)next=yield*this.parseNext(next)}atLineEnd(){let i=this.pos,ch=this.buffer[i];for(;ch===` `||ch===` `;)ch=this.buffer[++i];return!ch||ch===`#`||ch===`
109
+ `?!0:ch===`\r`?this.buffer[i+1]===`
110
+ `:!1}charAt(n){return this.buffer[this.pos+n]}continueScalar(offset){let ch=this.buffer[offset];if(this.indentNext>0){let indent=0;for(;ch===` `;)ch=this.buffer[++indent+offset];if(ch===`\r`){let next=this.buffer[indent+offset+1];if(next===`
111
+ `||!next&&!this.atEnd)return offset+indent+1}return ch===`
112
+ `||indent>=this.indentNext||!ch&&!this.atEnd?offset+indent:-1}if(ch===`-`||ch===`.`){let dt=this.buffer.substr(offset,3);if((dt===`---`||dt===`...`)&&isEmpty(this.buffer[offset+3]))return-1}return offset}getLine(){let end=this.lineEndPos;return(typeof end!=`number`||end!==-1&&end<this.pos)&&(end=this.buffer.indexOf(`
113
+ `,this.pos),this.lineEndPos=end),end===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[end-1]===`\r`&&--end,this.buffer.substring(this.pos,end))}hasChars(n){return this.pos+n<=this.buffer.length}setNext(state){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=state,null}peek(n){return this.buffer.substr(this.pos,n)}*parseNext(next){switch(next){case`stream`:return yield*this.parseStream();case`line-start`:return yield*this.parseLineStart();case`block-start`:return yield*this.parseBlockStart();case`doc`:return yield*this.parseDocument();case`flow`:return yield*this.parseFlowCollection();case`quoted-scalar`:return yield*this.parseQuotedScalar();case`block-scalar`:return yield*this.parseBlockScalar();case`plain-scalar`:return yield*this.parsePlainScalar()}}*parseStream(){let line=this.getLine();if(line===null)return this.setNext(`stream`);if(line[0]===cst$2.BOM&&(yield*this.pushCount(1),line=line.substring(1)),line[0]===`%`){let dirEnd=line.length,cs=line.indexOf(`#`);for(;cs!==-1;){let ch=line[cs-1];if(ch===` `||ch===` `){dirEnd=cs-1;break}else cs=line.indexOf(`#`,cs+1)}for(;;){let ch=line[dirEnd-1];if(ch===` `||ch===` `)--dirEnd;else break}let n=(yield*this.pushCount(dirEnd))+(yield*this.pushSpaces(!0));return yield*this.pushCount(line.length-n),this.pushNewline(),`stream`}if(this.atLineEnd()){let sp=yield*this.pushSpaces(!0);return yield*this.pushCount(line.length-sp),yield*this.pushNewline(),`stream`}return yield cst$2.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let ch=this.charAt(0);if(!ch&&!this.atEnd)return this.setNext(`line-start`);if(ch===`-`||ch===`.`){if(!this.atEnd&&!this.hasChars(4))return this.setNext(`line-start`);let s=this.peek(3);if((s===`---`||s===`...`)&&isEmpty(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,s===`---`?`doc`:`stream`}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!isEmpty(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[ch0,ch1]=this.peek(2);if(!ch1&&!this.atEnd)return this.setNext(`block-start`);if((ch0===`-`||ch0===`?`||ch0===`:`)&&isEmpty(ch1)){let n=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=n,yield*this.parseBlockStart()}return`doc`}*parseDocument(){yield*this.pushSpaces(!0);let line=this.getLine();if(line===null)return this.setNext(`doc`);let n=yield*this.pushIndicators();switch(line[n]){case`#`:yield*this.pushCount(line.length-n);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case`{`:case`[`:return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,`flow`;case`}`:case`]`:return yield*this.pushCount(1),`doc`;case`*`:return yield*this.pushUntil(isNotAnchorChar),`doc`;case`"`:case`'`:return yield*this.parseQuotedScalar();case`|`:case`>`:return n+=yield*this.parseBlockScalarHeader(),n+=yield*this.pushSpaces(!0),yield*this.pushCount(line.length-n),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let nl,sp,indent=-1;do nl=yield*this.pushNewline(),nl>0?(sp=yield*this.pushSpaces(!1),this.indentValue=indent=sp):sp=0,sp+=yield*this.pushSpaces(!0);while(nl+sp>0);let line=this.getLine();if(line===null)return this.setNext(`flow`);if((indent!==-1&&indent<this.indentNext&&line[0]!==`#`||indent===0&&(line.startsWith(`---`)||line.startsWith(`...`))&&isEmpty(line[3]))&&!(indent===this.indentNext-1&&this.flowLevel===1&&(line[0]===`]`||line[0]===`}`)))return this.flowLevel=0,yield cst$2.FLOW_END,yield*this.parseLineStart();let n=0;for(;line[n]===`,`;)n+=yield*this.pushCount(1),n+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(n+=yield*this.pushIndicators(),line[n]){case void 0:return`flow`;case`#`:return yield*this.pushCount(line.length-n),`flow`;case`{`:case`[`:return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,`flow`;case`}`:case`]`:return yield*this.pushCount(1),this.flowKey=!0,--this.flowLevel,this.flowLevel?`flow`:`doc`;case`*`:return yield*this.pushUntil(isNotAnchorChar),`flow`;case`"`:case`'`:return this.flowKey=!0,yield*this.parseQuotedScalar();case`:`:{let next=this.charAt(1);if(this.flowKey||isEmpty(next)||next===`,`)return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),`flow`}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let quote=this.charAt(0),end=this.buffer.indexOf(quote,this.pos+1);if(quote===`'`)for(;end!==-1&&this.buffer[end+1]===`'`;)end=this.buffer.indexOf(`'`,end+2);else for(;end!==-1;){let n=0;for(;this.buffer[end-1-n]===`\\`;)n+=1;if(n%2==0)break;end=this.buffer.indexOf(`"`,end+1)}let qb=this.buffer.substring(0,end),nl=qb.indexOf(`
114
+ `,this.pos);if(nl!==-1){for(;nl!==-1;){let cs=this.continueScalar(nl+1);if(cs===-1)break;nl=qb.indexOf(`
115
+ `,cs)}nl!==-1&&(end=nl-(qb[nl-1]===`\r`?2:1))}if(end===-1){if(!this.atEnd)return this.setNext(`quoted-scalar`);end=this.buffer.length}return yield*this.pushToIndex(end+1,!1),this.flowLevel?`flow`:`doc`}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let i=this.pos;for(;;){let ch=this.buffer[++i];if(ch===`+`)this.blockScalarKeep=!0;else if(ch>`0`&&ch<=`9`)this.blockScalarIndent=Number(ch)-1;else if(ch!==`-`)break}return yield*this.pushUntil(ch=>isEmpty(ch)||ch===`#`)}*parseBlockScalar(){let nl=this.pos-1,indent=0,ch;loop:for(let i$1=this.pos;ch=this.buffer[i$1];++i$1)switch(ch){case` `:indent+=1;break;case`
116
+ `:nl=i$1,indent=0;break;case`\r`:{let next=this.buffer[i$1+1];if(!next&&!this.atEnd)return this.setNext(`block-scalar`);if(next===`
117
+ `)break}default:break loop}if(!ch&&!this.atEnd)return this.setNext(`block-scalar`);if(indent>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=indent:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let cs=this.continueScalar(nl+1);if(cs===-1)break;nl=this.buffer.indexOf(`
118
+ `,cs)}while(nl!==-1);if(nl===-1){if(!this.atEnd)return this.setNext(`block-scalar`);nl=this.buffer.length}}let i=nl+1;for(ch=this.buffer[i];ch===` `;)ch=this.buffer[++i];if(ch===` `){for(;ch===` `||ch===` `||ch===`\r`||ch===`
119
+ `;)ch=this.buffer[++i];nl=i-1}else if(!this.blockScalarKeep)do{let i$1=nl-1,ch$1=this.buffer[i$1];ch$1===`\r`&&(ch$1=this.buffer[--i$1]);let lastChar=i$1;for(;ch$1===` `;)ch$1=this.buffer[--i$1];if(ch$1===`
120
+ `&&i$1>=this.pos&&i$1+1+indent>lastChar)nl=i$1;else break}while(!0);return yield cst$2.SCALAR,yield*this.pushToIndex(nl+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let inFlow=this.flowLevel>0,end=this.pos-1,i=this.pos-1,ch;for(;ch=this.buffer[++i];)if(ch===`:`){let next=this.buffer[i+1];if(isEmpty(next)||inFlow&&flowIndicatorChars.has(next))break;end=i}else if(isEmpty(ch)){let next=this.buffer[i+1];if(ch===`\r`&&(next===`
121
+ `?(i+=1,ch=`
122
+ `,next=this.buffer[i+1]):end=i),next===`#`||inFlow&&flowIndicatorChars.has(next))break;if(ch===`
123
+ `){let cs=this.continueScalar(i+1);if(cs===-1)break;i=Math.max(i,cs-2)}}else{if(inFlow&&flowIndicatorChars.has(ch))break;end=i}return!ch&&!this.atEnd?this.setNext(`plain-scalar`):(yield cst$2.SCALAR,yield*this.pushToIndex(end+1,!0),inFlow?`flow`:`doc`)}*pushCount(n){return n>0?(yield this.buffer.substr(this.pos,n),this.pos+=n,n):0}*pushToIndex(i,allowEmpty){let s=this.buffer.slice(this.pos,i);return s?(yield s,this.pos+=s.length,s.length):(allowEmpty&&(yield``),0)}*pushIndicators(){switch(this.charAt(0)){case`!`:return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case`&`:return(yield*this.pushUntil(isNotAnchorChar))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case`-`:case`?`:case`:`:{let inFlow=this.flowLevel>0,ch1=this.charAt(1);if(isEmpty(ch1)||inFlow&&flowIndicatorChars.has(ch1))return inFlow?this.flowKey&&=!1:this.indentNext=this.indentValue+1,(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}return 0}*pushTag(){if(this.charAt(1)===`<`){let i=this.pos+2,ch=this.buffer[i];for(;!isEmpty(ch)&&ch!==`>`;)ch=this.buffer[++i];return yield*this.pushToIndex(ch===`>`?i+1:i,!1)}else{let i=this.pos+1,ch=this.buffer[i];for(;ch;)if(tagChars.has(ch))ch=this.buffer[++i];else if(ch===`%`&&hexDigits.has(this.buffer[i+1])&&hexDigits.has(this.buffer[i+2]))ch=this.buffer[i+=3];else break;return yield*this.pushToIndex(i,!1)}}*pushNewline(){let ch=this.buffer[this.pos];return ch===`
124
+ `?yield*this.pushCount(1):ch===`\r`&&this.charAt(1)===`
125
+ `?yield*this.pushCount(2):0}*pushSpaces(allowTabs){let i=this.pos-1,ch;do ch=this.buffer[++i];while(ch===` `||allowTabs&&ch===` `);let n=i-this.pos;return n>0&&(yield this.buffer.substr(this.pos,n),this.pos=i),n}*pushUntil(test){let i=this.pos,ch=this.buffer[i];for(;!test(ch);)ch=this.buffer[++i];return yield*this.pushToIndex(i,!1)}}})),require_line_counter=__commonJSMin((exports=>{exports.LineCounter=class{constructor(){this.lineStarts=[],this.addNewLine=offset=>this.lineStarts.push(offset),this.linePos=offset=>{let low=0,high=this.lineStarts.length;for(;low<high;){let mid=low+high>>1;this.lineStarts[mid]<offset?low=mid+1:high=mid}if(this.lineStarts[low]===offset)return{line:low+1,col:1};if(low===0)return{line:0,col:offset};let start=this.lineStarts[low-1];return{line:low,col:offset-start+1}}}}})),require_parser=__commonJSMin((exports=>{var node_process=__require(`process`),cst$1=require_cst(),lexer$1=require_lexer();function includesToken(list,type){for(let i=0;i<list.length;++i)if(list[i].type===type)return!0;return!1}function findNonEmptyIndex(list){for(let i=0;i<list.length;++i)switch(list[i].type){case`space`:case`comment`:case`newline`:break;default:return i}return-1}function isFlowToken(token){switch(token?.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:case`flow-collection`:return!0;default:return!1}}function getPrevProps(parent){switch(parent.type){case`document`:return parent.start;case`block-map`:{let it=parent.items[parent.items.length-1];return it.sep??it.start}case`block-seq`:return parent.items[parent.items.length-1].start;default:return[]}}function getFirstKeyStartProps(prev){if(prev.length===0)return[];let i=prev.length;loop:for(;--i>=0;)switch(prev[i].type){case`doc-start`:case`explicit-key-ind`:case`map-value-ind`:case`seq-item-ind`:case`newline`:break loop}for(;prev[++i]?.type===`space`;);return prev.splice(i,prev.length)}function fixFlowSeqItems(fc){if(fc.start.type===`flow-seq-start`)for(let it of fc.items)it.sep&&!it.value&&!includesToken(it.start,`explicit-key-ind`)&&!includesToken(it.sep,`map-value-ind`)&&(it.key&&(it.value=it.key),delete it.key,isFlowToken(it.value)?it.value.end?Array.prototype.push.apply(it.value.end,it.sep):it.value.end=it.sep:Array.prototype.push.apply(it.start,it.sep),delete it.sep)}exports.Parser=class{constructor(onNewLine){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source=``,this.type=``,this.lexer=new lexer$1.Lexer,this.onNewLine=onNewLine}*parse(source,incomplete=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let lexeme of this.lexer.lex(source,incomplete))yield*this.next(lexeme);incomplete||(yield*this.end())}*next(source){if(this.source=source,node_process.env.LOG_TOKENS&&console.log(`|`,cst$1.prettyToken(source)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=source.length;return}let type=cst$1.tokenType(source);if(type)if(type===`scalar`)this.atNewLine=!1,this.atScalar=!0,this.type=`scalar`;else{switch(this.type=type,yield*this.step(),type){case`newline`:this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+source.length);break;case`space`:this.atNewLine&&source[0]===` `&&(this.indent+=source.length);break;case`explicit-key-ind`:case`map-value-ind`:case`seq-item-ind`:this.atNewLine&&(this.indent+=source.length);break;case`doc-mode`:case`flow-error-end`:return;default:this.atNewLine=!1}this.offset+=source.length}else{let message=`Not a YAML token: ${source}`;yield*this.pop({type:`error`,offset:this.offset,message,source}),this.offset+=source.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let top=this.peek(1);if(this.type===`doc-end`&&(!top||top.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(!top)return yield*this.stream();switch(top.type){case`document`:return yield*this.document(top);case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return yield*this.scalar(top);case`block-scalar`:return yield*this.blockScalar(top);case`block-map`:return yield*this.blockMap(top);case`block-seq`:return yield*this.blockSequence(top);case`flow-collection`:return yield*this.flowCollection(top);case`doc-end`:return yield*this.documentEnd(top)}yield*this.pop()}peek(n){return this.stack[this.stack.length-n]}*pop(error){let token=error??this.stack.pop();if(!token)yield{type:`error`,offset:this.offset,source:``,message:`Tried to pop an empty stack`};else if(this.stack.length===0)yield token;else{let top=this.peek(1);switch(token.type===`block-scalar`?token.indent=`indent`in top?top.indent:0:token.type===`flow-collection`&&top.type===`document`&&(token.indent=0),token.type===`flow-collection`&&fixFlowSeqItems(token),top.type){case`document`:top.value=token;break;case`block-scalar`:top.props.push(token);break;case`block-map`:{let it=top.items[top.items.length-1];if(it.value){top.items.push({start:[],key:token,sep:[]}),this.onKeyLine=!0;return}else if(it.sep)it.value=token;else{Object.assign(it,{key:token,sep:[]}),this.onKeyLine=!it.explicitKey;return}break}case`block-seq`:{let it=top.items[top.items.length-1];it.value?top.items.push({start:[],value:token}):it.value=token;break}case`flow-collection`:{let it=top.items[top.items.length-1];!it||it.value?top.items.push({start:[],key:token,sep:[]}):it.sep?it.value=token:Object.assign(it,{key:token,sep:[]});return}default:yield*this.pop(),yield*this.pop(token)}if((top.type===`document`||top.type===`block-map`||top.type===`block-seq`)&&(token.type===`block-map`||token.type===`block-seq`)){let last=token.items[token.items.length-1];last&&!last.sep&&!last.value&&last.start.length>0&&findNonEmptyIndex(last.start)===-1&&(token.indent===0||last.start.every(st=>st.type!==`comment`||st.indent<token.indent))&&(top.type===`document`?top.end=last.start:top.items.push({start:last.start}),token.items.splice(-1,1))}}}*stream(){switch(this.type){case`directive-line`:yield{type:`directive`,offset:this.offset,source:this.source};return;case`byte-order-mark`:case`space`:case`comment`:case`newline`:yield this.sourceToken;return;case`doc-mode`:case`doc-start`:{let doc={type:`document`,offset:this.offset,start:[]};this.type===`doc-start`&&doc.start.push(this.sourceToken),this.stack.push(doc);return}}yield{type:`error`,offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(doc){if(doc.value)return yield*this.lineEnd(doc);switch(this.type){case`doc-start`:findNonEmptyIndex(doc.start)===-1?doc.start.push(this.sourceToken):(yield*this.pop(),yield*this.step());return;case`anchor`:case`tag`:case`space`:case`comment`:case`newline`:doc.start.push(this.sourceToken);return}let bv=this.startBlockValue(doc);bv?this.stack.push(bv):yield{type:`error`,offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(scalar){if(this.type===`map-value-ind`){let start=getFirstKeyStartProps(getPrevProps(this.peek(2))),sep;scalar.end?(sep=scalar.end,sep.push(this.sourceToken),delete scalar.end):sep=[this.sourceToken];let map$6={type:`block-map`,offset:scalar.offset,indent:scalar.indent,items:[{start,key:scalar,sep}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=map$6}else yield*this.lineEnd(scalar)}*blockScalar(scalar){switch(this.type){case`space`:case`comment`:case`newline`:scalar.props.push(this.sourceToken);return;case`scalar`:if(scalar.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let nl=this.source.indexOf(`
126
+ `)+1;for(;nl!==0;)this.onNewLine(this.offset+nl),nl=this.source.indexOf(`
127
+ `,nl)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(map$6){let it=map$6.items[map$6.items.length-1];switch(this.type){case`newline`:if(this.onKeyLine=!1,it.value){let end=`end`in it.value?it.value.end:void 0;(Array.isArray(end)?end[end.length-1]:void 0)?.type===`comment`?end?.push(this.sourceToken):map$6.items.push({start:[this.sourceToken]})}else it.sep?it.sep.push(this.sourceToken):it.start.push(this.sourceToken);return;case`space`:case`comment`:if(it.value)map$6.items.push({start:[this.sourceToken]});else if(it.sep)it.sep.push(this.sourceToken);else{if(this.atIndentedComment(it.start,map$6.indent)){let end=map$6.items[map$6.items.length-2]?.value?.end;if(Array.isArray(end)){Array.prototype.push.apply(end,it.start),end.push(this.sourceToken),map$6.items.pop();return}}it.start.push(this.sourceToken)}return}if(this.indent>=map$6.indent){let atMapIndent=!this.onKeyLine&&this.indent===map$6.indent,atNextItem=atMapIndent&&(it.sep||it.explicitKey)&&this.type!==`seq-item-ind`,start=[];if(atNextItem&&it.sep&&!it.value){let nl=[];for(let i=0;i<it.sep.length;++i){let st=it.sep[i];switch(st.type){case`newline`:nl.push(i);break;case`space`:break;case`comment`:st.indent>map$6.indent&&(nl.length=0);break;default:nl.length=0}}nl.length>=2&&(start=it.sep.splice(nl[1]))}switch(this.type){case`anchor`:case`tag`:atNextItem||it.value?(start.push(this.sourceToken),map$6.items.push({start}),this.onKeyLine=!0):it.sep?it.sep.push(this.sourceToken):it.start.push(this.sourceToken);return;case`explicit-key-ind`:!it.sep&&!it.explicitKey?(it.start.push(this.sourceToken),it.explicitKey=!0):atNextItem||it.value?(start.push(this.sourceToken),map$6.items.push({start,explicitKey:!0})):this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case`map-value-ind`:if(it.explicitKey)if(it.sep)if(it.value)map$6.items.push({start:[],key:null,sep:[this.sourceToken]});else if(includesToken(it.sep,`map-value-ind`))this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start,key:null,sep:[this.sourceToken]}]});else if(isFlowToken(it.key)&&!includesToken(it.sep,`newline`)){let start$1=getFirstKeyStartProps(it.start),key=it.key,sep=it.sep;sep.push(this.sourceToken),delete it.key,delete it.sep,this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:start$1,key,sep}]})}else start.length>0?it.sep=it.sep.concat(start,this.sourceToken):it.sep.push(this.sourceToken);else if(includesToken(it.start,`newline`))Object.assign(it,{key:null,sep:[this.sourceToken]});else{let start$1=getFirstKeyStartProps(it.start);this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:start$1,key:null,sep:[this.sourceToken]}]})}else it.sep?it.value||atNextItem?map$6.items.push({start,key:null,sep:[this.sourceToken]}):includesToken(it.sep,`map-value-ind`)?this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):it.sep.push(this.sourceToken):Object.assign(it,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let fs=this.flowScalar(this.type);atNextItem||it.value?(map$6.items.push({start,key:fs,sep:[]}),this.onKeyLine=!0):it.sep?this.stack.push(fs):(Object.assign(it,{key:fs,sep:[]}),this.onKeyLine=!0);return}default:{let bv=this.startBlockValue(map$6);if(bv){if(bv.type===`block-seq`){if(!it.explicitKey&&it.sep&&!includesToken(it.sep,`newline`)){yield*this.pop({type:`error`,offset:this.offset,message:`Unexpected block-seq-ind on same line with key`,source:this.source});return}}else atMapIndent&&map$6.items.push({start});this.stack.push(bv);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(seq$6){let it=seq$6.items[seq$6.items.length-1];switch(this.type){case`newline`:if(it.value){let end=`end`in it.value?it.value.end:void 0;(Array.isArray(end)?end[end.length-1]:void 0)?.type===`comment`?end?.push(this.sourceToken):seq$6.items.push({start:[this.sourceToken]})}else it.start.push(this.sourceToken);return;case`space`:case`comment`:if(it.value)seq$6.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(it.start,seq$6.indent)){let end=seq$6.items[seq$6.items.length-2]?.value?.end;if(Array.isArray(end)){Array.prototype.push.apply(end,it.start),end.push(this.sourceToken),seq$6.items.pop();return}}it.start.push(this.sourceToken)}return;case`anchor`:case`tag`:if(it.value||this.indent<=seq$6.indent)break;it.start.push(this.sourceToken);return;case`seq-item-ind`:if(this.indent!==seq$6.indent)break;it.value||includesToken(it.start,`seq-item-ind`)?seq$6.items.push({start:[this.sourceToken]}):it.start.push(this.sourceToken);return}if(this.indent>seq$6.indent){let bv=this.startBlockValue(seq$6);if(bv){this.stack.push(bv);return}}yield*this.pop(),yield*this.step()}*flowCollection(fc){let it=fc.items[fc.items.length-1];if(this.type===`flow-error-end`){let top;do yield*this.pop(),top=this.peek(1);while(top&&top.type===`flow-collection`)}else if(fc.end.length===0){switch(this.type){case`comma`:case`explicit-key-ind`:!it||it.sep?fc.items.push({start:[this.sourceToken]}):it.start.push(this.sourceToken);return;case`map-value-ind`:!it||it.value?fc.items.push({start:[],key:null,sep:[this.sourceToken]}):it.sep?it.sep.push(this.sourceToken):Object.assign(it,{key:null,sep:[this.sourceToken]});return;case`space`:case`comment`:case`newline`:case`anchor`:case`tag`:!it||it.value?fc.items.push({start:[this.sourceToken]}):it.sep?it.sep.push(this.sourceToken):it.start.push(this.sourceToken);return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let fs=this.flowScalar(this.type);!it||it.value?fc.items.push({start:[],key:fs,sep:[]}):it.sep?this.stack.push(fs):Object.assign(it,{key:fs,sep:[]});return}case`flow-map-end`:case`flow-seq-end`:fc.end.push(this.sourceToken);return}let bv=this.startBlockValue(fc);bv?this.stack.push(bv):(yield*this.pop(),yield*this.step())}else{let parent=this.peek(2);if(parent.type===`block-map`&&(this.type===`map-value-ind`&&parent.indent===fc.indent||this.type===`newline`&&!parent.items[parent.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type===`map-value-ind`&&parent.type!==`flow-collection`){let start=getFirstKeyStartProps(getPrevProps(parent));fixFlowSeqItems(fc);let sep=fc.end.splice(1,fc.end.length);sep.push(this.sourceToken);let map$6={type:`block-map`,offset:fc.offset,indent:fc.indent,items:[{start,key:fc,sep}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=map$6}else yield*this.lineEnd(fc)}}flowScalar(type){if(this.onNewLine){let nl=this.source.indexOf(`
128
+ `)+1;for(;nl!==0;)this.onNewLine(this.offset+nl),nl=this.source.indexOf(`
129
+ `,nl)+1}return{type,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(parent){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 start=getFirstKeyStartProps(getPrevProps(parent));return start.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let start=getFirstKeyStartProps(getPrevProps(parent));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(start,indent){return this.type!==`comment`||this.indent<=indent?!1:start.every(st=>st.type===`newline`||st.type===`space`)}*documentEnd(docEnd){this.type!==`doc-mode`&&(docEnd.end?docEnd.end.push(this.sourceToken):docEnd.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(token){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;case`space`:case`comment`:default:token.end?token.end.push(this.sourceToken):token.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}}})),require_public_api=__commonJSMin((exports=>{var composer$1=require_composer(),Document$3=require_Document(),errors$1=require_errors(),log=require_log(),identity$1=require_identity(),lineCounter$1=require_line_counter(),parser$1=require_parser();function parseOptions(options){let prettyErrors=options.prettyErrors!==!1;return{lineCounter:options.lineCounter||prettyErrors&&new lineCounter$1.LineCounter||null,prettyErrors}}function parseAllDocuments(source,options={}){let{lineCounter:lineCounter$2,prettyErrors}=parseOptions(options),parser$1$1=new parser$1.Parser(lineCounter$2?.addNewLine),composer$1$1=new composer$1.Composer(options),docs=Array.from(composer$1$1.compose(parser$1$1.parse(source)));if(prettyErrors&&lineCounter$2)for(let doc of docs)doc.errors.forEach(errors$1.prettifyError(source,lineCounter$2)),doc.warnings.forEach(errors$1.prettifyError(source,lineCounter$2));return docs.length>0?docs:Object.assign([],{empty:!0},composer$1$1.streamInfo())}function parseDocument$1(source,options={}){let{lineCounter:lineCounter$2,prettyErrors}=parseOptions(options),parser$1$1=new parser$1.Parser(lineCounter$2?.addNewLine),composer$1$1=new composer$1.Composer(options),doc=null;for(let _doc of composer$1$1.compose(parser$1$1.parse(source),!0,source.length))if(!doc)doc=_doc;else if(doc.options.logLevel!==`silent`){doc.errors.push(new errors$1.YAMLParseError(_doc.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return prettyErrors&&lineCounter$2&&(doc.errors.forEach(errors$1.prettifyError(source,lineCounter$2)),doc.warnings.forEach(errors$1.prettifyError(source,lineCounter$2))),doc}function parse$1(src,reviver,options){let _reviver;typeof reviver==`function`?_reviver=reviver:options===void 0&&reviver&&typeof reviver==`object`&&(options=reviver);let doc=parseDocument$1(src,options);if(!doc)return null;if(doc.warnings.forEach(warning=>log.warn(doc.options.logLevel,warning)),doc.errors.length>0){if(doc.options.logLevel!==`silent`)throw doc.errors[0];doc.errors=[]}return doc.toJS(Object.assign({reviver:_reviver},options))}function stringify(value,replacer,options){let _replacer=null;if(typeof replacer==`function`||Array.isArray(replacer)?_replacer=replacer:options===void 0&&replacer&&(options=replacer),typeof options==`string`&&(options=options.length),typeof options==`number`){let indent=Math.round(options);options=indent<1?void 0:indent>8?{indent:8}:{indent}}if(value===void 0){let{keepUndefined}=options??replacer??{};if(!keepUndefined)return}return identity$1.isDocument(value)&&!_replacer?value.toString(options):new Document$3.Document(value,_replacer,options).toString(options)}exports.parse=parse$1,exports.parseAllDocuments=parseAllDocuments,exports.parseDocument=parseDocument$1,exports.stringify=stringify})),require_dist=__commonJSMin((exports=>{var composer=require_composer(),Document$2=require_Document(),Schema=require_Schema(),errors=require_errors(),Alias=require_Alias(),identity=require_identity(),Pair=require_Pair(),Scalar=require_Scalar(),YAMLMap$2=require_YAMLMap(),YAMLSeq$2=require_YAMLSeq();require_cst();var lexer=require_lexer(),lineCounter=require_line_counter(),parser=require_parser(),publicApi=require_public_api(),visit=require_visit();exports.Composer=composer.Composer,exports.Document=Document$2.Document,exports.Schema=Schema.Schema,exports.YAMLError=errors.YAMLError,exports.YAMLParseError=errors.YAMLParseError,exports.YAMLWarning=errors.YAMLWarning,exports.Alias=Alias.Alias,exports.isAlias=identity.isAlias,exports.isCollection=identity.isCollection,exports.isDocument=identity.isDocument,exports.isMap=identity.isMap,exports.isNode=identity.isNode,exports.isPair=identity.isPair,exports.isScalar=identity.isScalar,exports.isSeq=identity.isSeq,exports.Pair=Pair.Pair,exports.Scalar=Scalar.Scalar,exports.YAMLMap=YAMLMap$2.YAMLMap,exports.YAMLSeq=YAMLSeq$2.YAMLSeq,exports.Lexer=lexer.Lexer,exports.LineCounter=lineCounter.LineCounter,exports.Parser=parser.Parser,exports.parse=publicApi.parse,exports.parseAllDocuments=publicApi.parseAllDocuments,exports.parseDocument=publicApi.parseDocument,exports.stringify=publicApi.stringify,exports.visit=visit.visit,exports.visitAsync=visit.visitAsync})),import_dist$1=require_dist();async function readYamlFile(path){let doc=new import_dist$1.Document;if(existsSync(path))try{doc=(0,import_dist$1.parseDocument)(await readFile(path,`utf-8`),{keepSourceTokens:!0})}catch{let file=basename(path);throw Error(`Failed to parse ${file}`)}return doc.contents===null&&(doc.contents=new import_dist$1.YAMLMap),doc}function getOrCreateNode(doc,path,options,typeConfig){let node=doc.getIn(path);if(node){if(!typeConfig.typeGuard(node))throw Error(`Expected ${typeConfig.typeName} at path "${path.join(`.`)}".`);return node}doc.hasIn(path)&&doc.deleteIn(path);let pair=doc.createPair(path.at(-1),typeConfig.createNode());return options.onBeforeCreate?.(pair),path.length===1?doc.add(pair):doc.addIn(path.slice(0,-1),pair),doc.getIn(path)}function getOrCreateSeq(doc,path,options){return getOrCreateNode(doc,path,options??{},{typeGuard:import_dist$1.isSeq,createNode:()=>new import_dist$1.YAMLSeq,typeName:`sequence`})}function getOrCreateMap(doc,path,options){return getOrCreateNode(doc,path,options??{},{typeGuard:import_dist$1.isMap,createNode:()=>new import_dist$1.YAMLMap,typeName:`map`})}var import_dist=require_dist();async function createOrUpdateExtConfig(path,config,doc){let extConfigDoc=doc??new import_dist.Document({});return config.hooks??={},config.operations??={workerProcess:[]},config.runtimeManifest??={packages:{}},await buildHooks(extConfigDoc,config.hooks),buildOperations(extConfigDoc,config.operations),buildRuntimeManifest(extConfigDoc,config.runtimeManifest),await writeExtConfig(path,extConfigDoc),extConfigDoc}function buildActionDefinition(action){let actionDef=new import_dist.YAMLMap;actionDef.set(`function`,action.function),actionDef.set(`web`,action.web??`yes`),actionDef.set(`runtime`,action.runtime??`nodejs:22`),actionDef.set(`inputs`,{LOG_LEVEL:`$LOG_LEVEL`,...action.inputs??{}}),actionDef.set(`annotations`,{...action.annotations??{"require-adobe-auth":!0,final:!0}});let includes=action.include??[];if(includes.length>0){let itemSeq=new import_dist.YAMLSeq;itemSeq.flow=!0;for(let[source,target]of includes)itemSeq.items.push(source,target);let seq$6=new import_dist.YAMLSeq;seq$6.items.push(itemSeq),actionDef.set(`include`,seq$6)}return actionDef}function buildOperations(extConfig,operations){getOrCreateMap(extConfig,[`operations`],{onBeforeCreate:pair=>{pair.key.spaceBefore=!0}});let workerProcess=getOrCreateSeq(extConfig,[`operations`,`workerProcess`],{onBeforeCreate:pair=>{pair.key.commentBefore=` These worker processes definitions are auto-generated. Do not remove or manually edit.`}}),missingOps=(operations.workerProcess??[]).filter(op=>workerProcess.items.find(item=>(0,import_dist.isMap)(item)&&item.get(`impl`)===op.impl)===void 0);workerProcess.items.push(...missingOps.map(op=>{let map$6=new import_dist.YAMLMap;return map$6.set(`type`,op.type),map$6.set(`impl`,op.impl),map$6}))}function buildRuntimeManifest(extConfig,manifest){getOrCreateMap(extConfig,[`runtimeManifest`],{onBeforeCreate:pair=>{pair.key.spaceBefore=!0}});let packages=manifest.packages??{};getOrCreateMap(extConfig,[`runtimeManifest`,`packages`]);for(let[name,pkg]of Object.entries(packages)){let packageDef=getOrCreateMap(extConfig,[`runtimeManifest`,`packages`,name],{onBeforeCreate:pair=>{pair.key.commentBefore=` This package definition is auto-generated. Do not remove or manually edit.`}}),actions=new import_dist.YAMLMap;packageDef.set(`license`,pkg.license??`Apache-2.0`),packageDef.set(`actions`,actions);for(let[actionName,action]of Object.entries(pkg.actions??{})){let actionDef=buildActionDefinition(action);actions.set(actionName,actionDef)}}}async function buildHooks(extConfig,hooks){let generatedHooks=`[${Object.keys(hooks).join(`, `)}]`,hooksMap=getOrCreateMap(extConfig,[`hooks`],{onBeforeCreate:pair=>{pair.key.spaceBefore=!0,pair.key.commentBefore=` The ${generatedHooks} hooks are auto-generated. Do not remove or manually edit.`}}),execCommand=getExecCommand(await detectPackageManager());for(let[name,command$1]of Object.entries(hooks)){let fullCommand=`${command$1.replace(`$packageExec`,execCommand)}`,prevValue=(hooksMap.get(name)??``).trim();if(prevValue.endsWith(`js`)||prevValue.endsWith(`ts`))throw Error(`Conflicting hook definition found. The "${name}" hook needs to be a command, not a script.`);prevValue!==``&&!prevValue.includes(fullCommand)?hooksMap.set(name,`${prevValue} && ${fullCommand}`):prevValue===``&&hooksMap.set(name,fullCommand)}}async function writeExtConfig(configPath,doc){await writeFile(configPath,doc.toString({indent:2,lineWidth:0,defaultStringType:`PLAIN`}),`utf-8`)}const PACKAGE_NAME=`app-management`,GENERATED_PATH=`.generated`,GENERATED_ACTIONS_PATH=`${GENERATED_PATH}/${`actions/${PACKAGE_NAME}`}`,EXTENSION_POINT_FOLDER_PATH=`src/commerce-extensibility-1`,APP_MANIFEST_FILE=`app.commerce.manifest.json`,RUNTIME_ACTIONS=[{name:`get-app-config`,templateFile:`get-app-config.js.template`}],EXT_CONFIG={hooks:{"pre-app-build":`$packageExec aio-commerce-lib-app generate manifest`},operations:{workerProcess:[{type:`action`,impl:`${PACKAGE_NAME}/get-app-config`}]},runtimeManifest:{packages:{[PACKAGE_NAME]:{license:`Apache-2.0`,actions:{"get-app-config":{function:`${GENERATED_ACTIONS_PATH}/get-app-config.js`,include:[[`${GENERATED_PATH}/${APP_MANIFEST_FILE}`,`${PACKAGE_NAME}/`]],web:`yes`,runtime:`nodejs:22`,annotations:{"require-adobe-auth":!0,final:!0}}}}}}},__dirname=dirname(fileURLToPath(import.meta.url));async function run(){try{await generateActionFiles(),await updateExtConfig()}catch(error){consola$1.error(stringifyError(error)),process.exit(1)}}async function updateExtConfig(){consola$1.info(`Updating ext.config.yaml...`);let extConfigPath=join(await makeOutputDirFor(EXTENSION_POINT_FOLDER_PATH),`ext.config.yaml`);await createOrUpdateExtConfig(extConfigPath,EXT_CONFIG,await readYamlFile(extConfigPath)),consola$1.success(`Updated ext.config.yaml`)}async function generateActionFiles(){consola$1.start(`Generating runtime actions...`);let outputDir=await makeOutputDirFor(join(EXTENSION_POINT_FOLDER_PATH,GENERATED_ACTIONS_PATH)),templatesDir=join(__dirname,`generate/actions/templates`),outputFiles=[];for(let action of RUNTIME_ACTIONS){let template=await readFile(join(templatesDir,action.templateFile),`utf-8`),actionPath=join(outputDir,`${action.name}.js`);await writeFile(actionPath,template,`utf-8`),outputFiles.push(` ${relative(process.cwd(),actionPath)}`)}consola$1.success(`Generated ${RUNTIME_ACTIONS.length} action(s) in ${GENERATED_ACTIONS_PATH}`),consola$1.log.raw(formatTree(outputFiles,{color:`green`}))}async function run$1(){consola$1.start(`Generating app manifest...`);try{consola$1.info(`Reading app config...`);let config=await parseCommerceAppConfig();consola$1.info(`Generating app manifest...`);let contents=JSON.stringify(config,null,2);await writeFile(join(await makeOutputDirFor(`${EXTENSION_POINT_FOLDER_PATH}/.generated`),APP_MANIFEST_FILE),contents,`utf-8`),consola$1.success(`Generated ${APP_MANIFEST_FILE}`)}catch(error){consola$1.error(stringifyError(error)),process.exit(1)}}const NAMESPACE=`@adobe/aio-commerce-lib-app`,[command,subcommand]=process.argv.slice(2),USAGE=`
130
+ Usage: ${NAMESPACE} <command> [target]
131
+
132
+ Commands:
133
+ generate <target> Generate artifacts
134
+ all Generate app manifest and runtime actions
135
+ manifest Generate app manifest only
136
+ actions Generate runtime actions only
137
+
138
+ help Show this help message
139
+
140
+ Examples:
141
+ ${NAMESPACE} generate all
142
+ ${NAMESPACE} generate manifest
143
+ ${NAMESPACE} generate actions
144
+ `;async function generateAll(){await run(),consola.log.raw(``),await run$1()}const COMMANDS={generate:{actions:run,manifest:run$1,all:generateAll}};async function handleCommand(commandName,target,handlers){function invalidTargetError(message){consola.error(message),consola.info(`Available targets: ${Object.keys(handlers).join(` | `)}`),process.exit(1)}target||invalidTargetError(`No ${commandName} target specified`);let handler=handlers[target];handler||invalidTargetError(`Unknown ${commandName} target: ${target}`),await handler()}async function main(){(!command||command===`help`||command===`--help`||command===`-h`)&&(consola.log.raw(USAGE),process.exit(0));try{let handlers=COMMANDS[command];handlers||(consola.error(`Unknown command: ${command}`),consola.log.raw(USAGE),process.exit(1)),await handleCommand(command,subcommand,handlers)}catch(error){consola.error(stringifyError(error))}}main();export{};