@caiquecamargo/vite-plugin-netlify-cms 0.0.3 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -1,20 +1,20 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const Be=require("fs/promises"),Te=require("path"),_s=require("url"),ht=Symbol.for("yaml.alias"),lt=Symbol.for("yaml.document"),W=Symbol.for("yaml.map"),qt=Symbol.for("yaml.pair"),R=Symbol.for("yaml.scalar"),ce=Symbol.for("yaml.seq"),M=Symbol.for("yaml.node.type"),X=s=>!!s&&typeof s=="object"&&s[M]===ht,ke=s=>!!s&&typeof s=="object"&&s[M]===lt,z=s=>!!s&&typeof s=="object"&&s[M]===W,I=s=>!!s&&typeof s=="object"&&s[M]===qt,A=s=>!!s&&typeof s=="object"&&s[M]===R,fe=s=>!!s&&typeof s=="object"&&s[M]===ce;function L(s){if(s&&typeof s=="object")switch(s[M]){case W:case ce:return!0}return!1}function T(s){if(s&&typeof s=="object")switch(s[M]){case ht:case W:case R:case ce:return!0}return!1}const vs=s=>(A(s)||L(s))&&!!s.anchor;class dt{constructor(e){Object.defineProperty(this,M,{value:e})}clone(){const e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}}const _=Symbol("break visit"),Ut=Symbol("skip children"),K=Symbol("remove node");function J(s,e){const t=Rt(e);ke(s)?ne(null,s.contents,t,Object.freeze([s]))===K&&(s.contents=null):ne(null,s,t,Object.freeze([]))}J.BREAK=_;J.SKIP=Ut;J.REMOVE=K;function ne(s,e,t,n){const i=Vt(s,e,t,n);if(T(i)||I(i))return Wt(s,n,i),ne(s,i,t,n);if(typeof i!="symbol"){if(L(e)){n=Object.freeze(n.concat(e));for(let r=0;r<e.items.length;++r){const o=ne(r,e.items[r],t,n);if(typeof o=="number")r=o-1;else{if(o===_)return _;o===K&&(e.items.splice(r,1),r-=1)}}}else if(I(e)){n=Object.freeze(n.concat(e));const r=ne("key",e.key,t,n);if(r===_)return _;r===K&&(e.key=null);const o=ne("value",e.value,t,n);if(o===_)return _;o===K&&(e.value=null)}}return i}async function Ke(s,e){const t=Rt(e);ke(s)?await ie(null,s.contents,t,Object.freeze([s]))===K&&(s.contents=null):await ie(null,s,t,Object.freeze([]))}Ke.BREAK=_;Ke.SKIP=Ut;Ke.REMOVE=K;async function ie(s,e,t,n){const i=await Vt(s,e,t,n);if(T(i)||I(i))return Wt(s,n,i),ie(s,i,t,n);if(typeof i!="symbol"){if(L(e)){n=Object.freeze(n.concat(e));for(let r=0;r<e.items.length;++r){const o=await ie(r,e.items[r],t,n);if(typeof o=="number")r=o-1;else{if(o===_)return _;o===K&&(e.items.splice(r,1),r-=1)}}}else if(I(e)){n=Object.freeze(n.concat(e));const r=await ie("key",e.key,t,n);if(r===_)return _;r===K&&(e.key=null);const o=await ie("value",e.value,t,n);if(o===_)return _;o===K&&(e.value=null)}}return i}function Rt(s){return typeof s=="object"&&(s.Collection||s.Node||s.Value)?Object.assign({Alias:s.Node,Map:s.Node,Scalar:s.Node,Seq:s.Node},s.Value&&{Map:s.Value,Scalar:s.Value,Seq:s.Value},s.Collection&&{Map:s.Collection,Seq:s.Collection},s):s}function Vt(s,e,t,n){if(typeof t=="function")return t(s,e,n);if(z(e))return t.Map?.(s,e,n);if(fe(e))return t.Seq?.(s,e,n);if(I(e))return t.Pair?.(s,e,n);if(A(e))return t.Scalar?.(s,e,n);if(X(e))return t.Alias?.(s,e,n)}function Wt(s,e,t){const n=e[e.length-1];if(L(n))n.items[s]=t;else if(I(n))s==="key"?n.key=t:n.value=t;else if(ke(n))n.contents=t;else{const i=X(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}const Bs={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},js=s=>s.replace(/[!,[\]{}]/g,e=>Bs[e]);class C{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},C.defaultYaml,e),this.tags=Object.assign({},C.defaultTags,t)}clone(){const e=new C(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){const e=new C(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:C.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},C.defaultTags);break}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:C.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},C.defaultTags),this.atNextDocument=!1);const n=e.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(t(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;const[r,o]=n;return this.tags[r]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return t(0,"%YAML directive should contain exactly one part"),!1;const[r]=n;if(r==="1.1"||r==="1.2")return this.yaml.version=r,!0;{const o=/^\d+\.\d+$/.test(r);return t(6,`Unsupported YAML version ${r}`,o),!1}}default:return t(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e==="!")return"!";if(e[0]!=="!")return t(`Not a valid tag: ${e}`),null;if(e[1]==="<"){const o=e.slice(2,-1);return o==="!"||o==="!!"?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&t("Verbatim tags must end with a >"),o)}const[,n,i]=e.match(/^(.*!)([^!]*)$/);i||t(`The ${e} tag has no suffix`);const r=this.tags[n];return r?r+decodeURIComponent(i):n==="!"?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(const[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+js(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){const t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags);let i;if(e&&n.length>0&&T(e.contents)){const r={};J(e.contents,(o,l)=>{T(l)&&l.tag&&(r[l.tag]=!0)}),i=Object.keys(r)}else i=[];for(const[r,o]of n)r==="!!"&&o==="tag:yaml.org,2002:"||(!e||i.some(l=>l.startsWith(o)))&&t.push(`%TAG ${r} ${o}`);return t.join(`
2
- `)}}C.defaultYaml={explicit:!1,version:"1.2"};C.defaultTags={"!!":"tag:yaml.org,2002:"};function Jt(s){if(/[\x00-\x19\s,[\]{}]/.test(s)){const t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(s)}`;throw new Error(t)}return!0}function Yt(s){const e=new Set;return J(s,{Value(t,n){n.anchor&&e.add(n.anchor)}}),e}function Gt(s,e){for(let t=1;;++t){const n=`${s}${t}`;if(!e.has(n))return n}}function Ms(s,e){const t=[],n=new Map;let i=null;return{onAnchor:r=>{t.push(r),i||(i=Yt(s));const o=Gt(e,i);return i.add(o),o},setAnchors:()=>{for(const r of t){const o=n.get(r);if(typeof o=="object"&&o.anchor&&(A(o.node)||L(o.node)))o.node.anchor=o.anchor;else{const l=new Error("Failed to resolve repeated object (this should not happen)");throw l.source=r,l}}},sourceObjects:n}}class Fe extends dt{constructor(e){super(ht),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e){let t;return J(e,{Node:(n,i)=>{if(i===this)return J.BREAK;i.anchor===this.source&&(t=i)}}),t}toJSON(e,t){if(!t)return{source:this.source};const{anchors:n,doc:i,maxAliasCount:r}=t,o=this.resolve(i);if(!o){const a=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(a)}const l=n.get(o);if(!l||l.res===void 0){const a="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(a)}if(r>=0&&(l.count+=1,l.aliasCount===0&&(l.aliasCount=$e(i,o,n)),l.count*l.aliasCount>r)){const a="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(a)}return l.res}toString(e,t,n){const i=`*${this.source}`;if(e){if(Jt(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){const r=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(r)}if(e.implicitKey)return`${i} `}return i}}function $e(s,e,t){if(X(e)){const n=e.resolve(s),i=t&&n&&t.get(n);return i?i.count*i.aliasCount:0}else if(L(e)){let n=0;for(const i of e.items){const r=$e(s,i,t);r>n&&(n=r)}return n}else if(I(e)){const n=$e(s,e.key,t),i=$e(s,e.value,t);return Math.max(n,i)}return 1}function F(s,e,t){if(Array.isArray(s))return s.map((n,i)=>F(n,String(i),t));if(s&&typeof s.toJSON=="function"){if(!t||!vs(s))return s.toJSON(e,t);const n={aliasCount:0,count:1,res:void 0};t.anchors.set(s,n),t.onCreate=r=>{n.res=r,delete t.onCreate};const i=s.toJSON(e,t);return t.onCreate&&t.onCreate(i),i}return typeof s=="bigint"&&!t?.keep?Number(s):s}const Qt=s=>!s||typeof s!="function"&&typeof s!="object";class N extends dt{constructor(e){super(R),this.value=e}toJSON(e,t){return t?.keep?this.value:F(this.value,e,t)}toString(){return String(this.value)}}N.BLOCK_FOLDED="BLOCK_FOLDED";N.BLOCK_LITERAL="BLOCK_LITERAL";N.PLAIN="PLAIN";N.QUOTE_DOUBLE="QUOTE_DOUBLE";N.QUOTE_SINGLE="QUOTE_SINGLE";const Ps="tag:yaml.org,2002:";function Ds(s,e,t){if(e){const n=t.filter(r=>r.tag===e),i=n.find(r=>!r.format)??n[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return t.find(n=>n.identify?.(s)&&!n.format)}function be(s,e,t){if(ke(s)&&(s=s.contents),T(s))return s;if(I(s)){const f=t.schema[W].createNode?.(t.schema,null,t);return f.items.push(s),f}(s instanceof String||s instanceof Number||s instanceof Boolean||typeof BigInt<"u"&&s instanceof BigInt)&&(s=s.valueOf());const{aliasDuplicateObjects:n,onAnchor:i,onTagObj:r,schema:o,sourceObjects:l}=t;let a;if(n&&s&&typeof s=="object"){if(a=l.get(s),a)return a.anchor||(a.anchor=i(s)),new Fe(a.anchor);a={anchor:null,node:null},l.set(s,a)}e?.startsWith("!!")&&(e=Ps+e.slice(2));let c=Ds(s,e,o.tags);if(!c){if(s&&typeof s.toJSON=="function"&&(s=s.toJSON()),!s||typeof s!="object"){const f=new N(s);return a&&(a.node=f),f}c=s instanceof Map?o[W]:Symbol.iterator in Object(s)?o[ce]:o[W]}r&&(r(c),delete t.onTagObj);const u=c?.createNode?c.createNode(t.schema,s,t):new N(s);return e&&(u.tag=e),a&&(a.node=u),u}function je(s,e,t){let n=t;for(let i=e.length-1;i>=0;--i){const r=e[i];if(typeof r=="number"&&Number.isInteger(r)&&r>=0){const o=[];o[r]=n,n=o}else n=new Map([[r,n]])}return be(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:s,sourceObjects:new Map})}const me=s=>s==null||typeof s=="object"&&!!s[Symbol.iterator]().next().done;class qe extends dt{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){const t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(n=>T(n)||I(n)?n.clone(e):n),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(me(e))this.add(t);else{const[n,...i]=e,r=this.get(n,!0);if(L(r))r.addIn(i,t);else if(r===void 0&&this.schema)this.set(n,je(this.schema,i,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(e){const[t,...n]=e;if(n.length===0)return this.delete(t);const i=this.get(t,!0);if(L(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){const[n,...i]=e,r=this.get(n,!0);return i.length===0?!t&&A(r)?r.value:r:L(r)?r.getIn(i,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!I(t))return!1;const n=t.value;return n==null||e&&A(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){const[t,...n]=e;if(n.length===0)return this.has(t);const i=this.get(t,!0);return L(i)?i.hasIn(n):!1}setIn(e,t){const[n,...i]=e;if(i.length===0)this.set(n,t);else{const r=this.get(n,!0);if(L(r))r.setIn(i,t);else if(r===void 0&&this.schema)this.set(n,je(this.schema,i,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}}qe.maxFlowStringSingleLineLength=60;const Ks=s=>s.replace(/^(?!$)(?: $)?/gm,"#");function U(s,e){return/^\n+$/.test(s)?s.substring(1):e?s.replace(/^(?! *$)/gm,e):s}const V=(s,e,t)=>s.endsWith(`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const _e=require("fs/promises"),ze=require("path"),ut=Symbol.for("yaml.alias"),ot=Symbol.for("yaml.document"),W=Symbol.for("yaml.map"),Ft=Symbol.for("yaml.pair"),R=Symbol.for("yaml.scalar"),ce=Symbol.for("yaml.seq"),j=Symbol.for("yaml.node.type"),X=s=>!!s&&typeof s=="object"&&s[j]===ut,ke=s=>!!s&&typeof s=="object"&&s[j]===ot,z=s=>!!s&&typeof s=="object"&&s[j]===W,I=s=>!!s&&typeof s=="object"&&s[j]===Ft,A=s=>!!s&&typeof s=="object"&&s[j]===R,fe=s=>!!s&&typeof s=="object"&&s[j]===ce;function T(s){if(s&&typeof s=="object")switch(s[j]){case W:case ce:return!0}return!1}function L(s){if(s&&typeof s=="object")switch(s[j]){case ut:case W:case R:case ce:return!0}return!1}const Cs=s=>(A(s)||T(s))&&!!s.anchor;class ht{constructor(e){Object.defineProperty(this,j,{value:e})}clone(){const e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}}const v=Symbol("break visit"),qt=Symbol("skip children"),K=Symbol("remove node");function J(s,e){const t=Ut(e);ke(s)?ne(null,s.contents,t,Object.freeze([s]))===K&&(s.contents=null):ne(null,s,t,Object.freeze([]))}J.BREAK=v;J.SKIP=qt;J.REMOVE=K;function ne(s,e,t,n){const i=Rt(s,e,t,n);if(L(i)||I(i))return Vt(s,n,i),ne(s,i,t,n);if(typeof i!="symbol"){if(T(e)){n=Object.freeze(n.concat(e));for(let r=0;r<e.items.length;++r){const o=ne(r,e.items[r],t,n);if(typeof o=="number")r=o-1;else{if(o===v)return v;o===K&&(e.items.splice(r,1),r-=1)}}}else if(I(e)){n=Object.freeze(n.concat(e));const r=ne("key",e.key,t,n);if(r===v)return v;r===K&&(e.key=null);const o=ne("value",e.value,t,n);if(o===v)return v;o===K&&(e.value=null)}}return i}async function De(s,e){const t=Ut(e);ke(s)?await ie(null,s.contents,t,Object.freeze([s]))===K&&(s.contents=null):await ie(null,s,t,Object.freeze([]))}De.BREAK=v;De.SKIP=qt;De.REMOVE=K;async function ie(s,e,t,n){const i=await Rt(s,e,t,n);if(L(i)||I(i))return Vt(s,n,i),ie(s,i,t,n);if(typeof i!="symbol"){if(T(e)){n=Object.freeze(n.concat(e));for(let r=0;r<e.items.length;++r){const o=await ie(r,e.items[r],t,n);if(typeof o=="number")r=o-1;else{if(o===v)return v;o===K&&(e.items.splice(r,1),r-=1)}}}else if(I(e)){n=Object.freeze(n.concat(e));const r=await ie("key",e.key,t,n);if(r===v)return v;r===K&&(e.key=null);const o=await ie("value",e.value,t,n);if(o===v)return v;o===K&&(e.value=null)}}return i}function Ut(s){return typeof s=="object"&&(s.Collection||s.Node||s.Value)?Object.assign({Alias:s.Node,Map:s.Node,Scalar:s.Node,Seq:s.Node},s.Value&&{Map:s.Value,Scalar:s.Value,Seq:s.Value},s.Collection&&{Map:s.Collection,Seq:s.Collection},s):s}function Rt(s,e,t,n){if(typeof t=="function")return t(s,e,n);if(z(e))return t.Map?.(s,e,n);if(fe(e))return t.Seq?.(s,e,n);if(I(e))return t.Pair?.(s,e,n);if(A(e))return t.Scalar?.(s,e,n);if(X(e))return t.Alias?.(s,e,n)}function Vt(s,e,t){const n=e[e.length-1];if(T(n))n.items[s]=t;else if(I(n))s==="key"?n.key=t:n.value=t;else if(ke(n))n.contents=t;else{const i=X(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}const vs={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},_s=s=>s.replace(/[!,[\]{}]/g,e=>vs[e]);class C{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},C.defaultYaml,e),this.tags=Object.assign({},C.defaultTags,t)}clone(){const e=new C(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){const e=new C(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:C.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},C.defaultTags);break}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:C.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},C.defaultTags),this.atNextDocument=!1);const n=e.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(t(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;const[r,o]=n;return this.tags[r]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return t(0,"%YAML directive should contain exactly one part"),!1;const[r]=n;if(r==="1.1"||r==="1.2")return this.yaml.version=r,!0;{const o=/^\d+\.\d+$/.test(r);return t(6,`Unsupported YAML version ${r}`,o),!1}}default:return t(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e==="!")return"!";if(e[0]!=="!")return t(`Not a valid tag: ${e}`),null;if(e[1]==="<"){const o=e.slice(2,-1);return o==="!"||o==="!!"?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&t("Verbatim tags must end with a >"),o)}const[,n,i]=e.match(/^(.*!)([^!]*)$/);i||t(`The ${e} tag has no suffix`);const r=this.tags[n];return r?r+decodeURIComponent(i):n==="!"?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(const[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+_s(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){const t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags);let i;if(e&&n.length>0&&L(e.contents)){const r={};J(e.contents,(o,l)=>{L(l)&&l.tag&&(r[l.tag]=!0)}),i=Object.keys(r)}else i=[];for(const[r,o]of n)r==="!!"&&o==="tag:yaml.org,2002:"||(!e||i.some(l=>l.startsWith(o)))&&t.push(`%TAG ${r} ${o}`);return t.join(`
2
+ `)}}C.defaultYaml={explicit:!1,version:"1.2"};C.defaultTags={"!!":"tag:yaml.org,2002:"};function Wt(s){if(/[\x00-\x19\s,[\]{}]/.test(s)){const t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(s)}`;throw new Error(t)}return!0}function Jt(s){const e=new Set;return J(s,{Value(t,n){n.anchor&&e.add(n.anchor)}}),e}function Yt(s,e){for(let t=1;;++t){const n=`${s}${t}`;if(!e.has(n))return n}}function Bs(s,e){const t=[],n=new Map;let i=null;return{onAnchor:r=>{t.push(r),i||(i=Jt(s));const o=Yt(e,i);return i.add(o),o},setAnchors:()=>{for(const r of t){const o=n.get(r);if(typeof o=="object"&&o.anchor&&(A(o.node)||T(o.node)))o.node.anchor=o.anchor;else{const l=new Error("Failed to resolve repeated object (this should not happen)");throw l.source=r,l}}},sourceObjects:n}}class Ke extends ht{constructor(e){super(ut),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e){let t;return J(e,{Node:(n,i)=>{if(i===this)return J.BREAK;i.anchor===this.source&&(t=i)}}),t}toJSON(e,t){if(!t)return{source:this.source};const{anchors:n,doc:i,maxAliasCount:r}=t,o=this.resolve(i);if(!o){const a=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(a)}const l=n.get(o);if(!l||l.res===void 0){const a="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(a)}if(r>=0&&(l.count+=1,l.aliasCount===0&&(l.aliasCount=Le(i,o,n)),l.count*l.aliasCount>r)){const a="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(a)}return l.res}toString(e,t,n){const i=`*${this.source}`;if(e){if(Wt(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){const r=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(r)}if(e.implicitKey)return`${i} `}return i}}function Le(s,e,t){if(X(e)){const n=e.resolve(s),i=t&&n&&t.get(n);return i?i.count*i.aliasCount:0}else if(T(e)){let n=0;for(const i of e.items){const r=Le(s,i,t);r>n&&(n=r)}return n}else if(I(e)){const n=Le(s,e.key,t),i=Le(s,e.value,t);return Math.max(n,i)}return 1}function F(s,e,t){if(Array.isArray(s))return s.map((n,i)=>F(n,String(i),t));if(s&&typeof s.toJSON=="function"){if(!t||!Cs(s))return s.toJSON(e,t);const n={aliasCount:0,count:1,res:void 0};t.anchors.set(s,n),t.onCreate=r=>{n.res=r,delete t.onCreate};const i=s.toJSON(e,t);return t.onCreate&&t.onCreate(i),i}return typeof s=="bigint"&&!t?.keep?Number(s):s}const Gt=s=>!s||typeof s!="function"&&typeof s!="object";class N extends ht{constructor(e){super(R),this.value=e}toJSON(e,t){return t?.keep?this.value:F(this.value,e,t)}toString(){return String(this.value)}}N.BLOCK_FOLDED="BLOCK_FOLDED";N.BLOCK_LITERAL="BLOCK_LITERAL";N.PLAIN="PLAIN";N.QUOTE_DOUBLE="QUOTE_DOUBLE";N.QUOTE_SINGLE="QUOTE_SINGLE";const Ms="tag:yaml.org,2002:";function js(s,e,t){if(e){const n=t.filter(r=>r.tag===e),i=n.find(r=>!r.format)??n[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return t.find(n=>n.identify?.(s)&&!n.format)}function be(s,e,t){if(ke(s)&&(s=s.contents),L(s))return s;if(I(s)){const f=t.schema[W].createNode?.(t.schema,null,t);return f.items.push(s),f}(s instanceof String||s instanceof Number||s instanceof Boolean||typeof BigInt<"u"&&s instanceof BigInt)&&(s=s.valueOf());const{aliasDuplicateObjects:n,onAnchor:i,onTagObj:r,schema:o,sourceObjects:l}=t;let a;if(n&&s&&typeof s=="object"){if(a=l.get(s),a)return a.anchor||(a.anchor=i(s)),new Ke(a.anchor);a={anchor:null,node:null},l.set(s,a)}e?.startsWith("!!")&&(e=Ms+e.slice(2));let c=js(s,e,o.tags);if(!c){if(s&&typeof s.toJSON=="function"&&(s=s.toJSON()),!s||typeof s!="object"){const f=new N(s);return a&&(a.node=f),f}c=s instanceof Map?o[W]:Symbol.iterator in Object(s)?o[ce]:o[W]}r&&(r(c),delete t.onTagObj);const u=c?.createNode?c.createNode(t.schema,s,t):new N(s);return e&&(u.tag=e),a&&(a.node=u),u}function Be(s,e,t){let n=t;for(let i=e.length-1;i>=0;--i){const r=e[i];if(typeof r=="number"&&Number.isInteger(r)&&r>=0){const o=[];o[r]=n,n=o}else n=new Map([[r,n]])}return be(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:s,sourceObjects:new Map})}const me=s=>s==null||typeof s=="object"&&!!s[Symbol.iterator]().next().done;class Fe extends ht{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){const t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(n=>L(n)||I(n)?n.clone(e):n),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(me(e))this.add(t);else{const[n,...i]=e,r=this.get(n,!0);if(T(r))r.addIn(i,t);else if(r===void 0&&this.schema)this.set(n,Be(this.schema,i,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(e){const[t,...n]=e;if(n.length===0)return this.delete(t);const i=this.get(t,!0);if(T(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){const[n,...i]=e,r=this.get(n,!0);return i.length===0?!t&&A(r)?r.value:r:T(r)?r.getIn(i,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!I(t))return!1;const n=t.value;return n==null||e&&A(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){const[t,...n]=e;if(n.length===0)return this.has(t);const i=this.get(t,!0);return T(i)?i.hasIn(n):!1}setIn(e,t){const[n,...i]=e;if(i.length===0)this.set(n,t);else{const r=this.get(n,!0);if(T(r))r.setIn(i,t);else if(r===void 0&&this.schema)this.set(n,Be(this.schema,i,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}}Fe.maxFlowStringSingleLineLength=60;const Ps=s=>s.replace(/^(?!$)(?: $)?/gm,"#");function U(s,e){return/^\n+$/.test(s)?s.substring(1):e?s.replace(/^(?! *$)/gm,e):s}const V=(s,e,t)=>s.endsWith(`
3
3
  `)?U(t,e):t.includes(`
4
4
  `)?`
5
- `+U(t,e):(s.endsWith(" ")?"":" ")+t,Ht="flow",at="block",Ce="quoted";function Ue(s,e,t="flow",{indentAtStart:n,lineWidth:i=80,minContentWidth:r=20,onFold:o,onOverflow:l}={}){if(!i||i<0)return s;const a=Math.max(1+r,1+i-e.length);if(s.length<=a)return s;const c=[],u={};let f=i-e.length;typeof n=="number"&&(n>i-Math.max(2,r)?c.push(0):f=i-n);let h,p,y=!1,d=-1,m=-1,b=-1;t===at&&(d=Tt(s,d),d!==-1&&(f=d+a));for(let k;k=s[d+=1];){if(t===Ce&&k==="\\"){switch(m=d,s[d+1]){case"x":d+=3;break;case"u":d+=5;break;case"U":d+=9;break;default:d+=1}b=d}if(k===`
6
- `)t===at&&(d=Tt(s,d)),f=d+a,h=void 0;else{if(k===" "&&p&&p!==" "&&p!==`
5
+ `+U(t,e):(s.endsWith(" ")?"":" ")+t,Qt="flow",lt="block",$e="quoted";function qe(s,e,t="flow",{indentAtStart:n,lineWidth:i=80,minContentWidth:r=20,onFold:o,onOverflow:l}={}){if(!i||i<0)return s;const a=Math.max(1+r,1+i-e.length);if(s.length<=a)return s;const c=[],u={};let f=i-e.length;typeof n=="number"&&(n>i-Math.max(2,r)?c.push(0):f=i-n);let h,p,y=!1,d=-1,m=-1,b=-1;t===lt&&(d=Tt(s,d),d!==-1&&(f=d+a));for(let k;k=s[d+=1];){if(t===$e&&k==="\\"){switch(m=d,s[d+1]){case"x":d+=3;break;case"u":d+=5;break;case"U":d+=9;break;default:d+=1}b=d}if(k===`
6
+ `)t===lt&&(d=Tt(s,d)),f=d+a,h=void 0;else{if(k===" "&&p&&p!==" "&&p!==`
7
7
  `&&p!==" "){const S=s[d+1];S&&S!==" "&&S!==`
8
- `&&S!==" "&&(h=d)}if(d>=f)if(h)c.push(h),f=h+a,h=void 0;else if(t===Ce){for(;p===" "||p===" ";)p=k,k=s[d+=1],y=!0;const S=d>b+1?d-2:m-1;if(u[S])return s;c.push(S),u[S]=!0,f=S+a,h=void 0}else y=!0}p=k}if(y&&l&&l(),c.length===0)return s;o&&o();let w=s.slice(0,c[0]);for(let k=0;k<c.length;++k){const S=c[k],O=c[k+1]||s.length;S===0?w=`
9
- ${e}${s.slice(0,O)}`:(t===Ce&&u[S]&&(w+=`${s[S]}\\`),w+=`
8
+ `&&S!==" "&&(h=d)}if(d>=f)if(h)c.push(h),f=h+a,h=void 0;else if(t===$e){for(;p===" "||p===" ";)p=k,k=s[d+=1],y=!0;const S=d>b+1?d-2:m-1;if(u[S])return s;c.push(S),u[S]=!0,f=S+a,h=void 0}else y=!0}p=k}if(y&&l&&l(),c.length===0)return s;o&&o();let w=s.slice(0,c[0]);for(let k=0;k<c.length;++k){const S=c[k],O=c[k+1]||s.length;S===0?w=`
9
+ ${e}${s.slice(0,O)}`:(t===$e&&u[S]&&(w+=`${s[S]}\\`),w+=`
10
10
  ${e}${s.slice(S+1,O)}`)}return w}function Tt(s,e){let t=s[e+1];for(;t===" "||t===" ";){do t=s[e+=1];while(t&&t!==`
11
- `);t=s[e+1]}return e}const Re=s=>({indentAtStart:s.indentAtStart,lineWidth:s.options.lineWidth,minContentWidth:s.options.minContentWidth}),Ve=s=>/^(%|---|\.\.\.)/m.test(s);function Fs(s,e,t){if(!e||e<0)return!1;const n=e-t,i=s.length;if(i<=n)return!1;for(let r=0,o=0;r<i;++r)if(s[r]===`
12
- `){if(r-o>n)return!0;if(o=r+1,i-o<=n)return!1}return!0}function ye(s,e){const t=JSON.stringify(s);if(e.options.doubleQuotedAsJSON)return t;const{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,r=e.indent||(Ve(s)?" ":"");let o="",l=0;for(let a=0,c=t[a];c;c=t[++a])if(c===" "&&t[a+1]==="\\"&&t[a+2]==="n"&&(o+=t.slice(l,a)+"\\ ",a+=1,l=a,c="\\"),c==="\\")switch(t[a+1]){case"u":{o+=t.slice(l,a);const u=t.substr(a+2,4);switch(u){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:u.substr(0,2)==="00"?o+="\\x"+u.substr(2):o+=t.substr(a,6)}a+=5,l=a+1}break;case"n":if(n||t[a+2]==='"'||t.length<i)a+=1;else{for(o+=t.slice(l,a)+`
11
+ `);t=s[e+1]}return e}const Ue=s=>({indentAtStart:s.indentAtStart,lineWidth:s.options.lineWidth,minContentWidth:s.options.minContentWidth}),Re=s=>/^(%|---|\.\.\.)/m.test(s);function Ds(s,e,t){if(!e||e<0)return!1;const n=e-t,i=s.length;if(i<=n)return!1;for(let r=0,o=0;r<i;++r)if(s[r]===`
12
+ `){if(r-o>n)return!0;if(o=r+1,i-o<=n)return!1}return!0}function ye(s,e){const t=JSON.stringify(s);if(e.options.doubleQuotedAsJSON)return t;const{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,r=e.indent||(Re(s)?" ":"");let o="",l=0;for(let a=0,c=t[a];c;c=t[++a])if(c===" "&&t[a+1]==="\\"&&t[a+2]==="n"&&(o+=t.slice(l,a)+"\\ ",a+=1,l=a,c="\\"),c==="\\")switch(t[a+1]){case"u":{o+=t.slice(l,a);const u=t.substr(a+2,4);switch(u){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:u.substr(0,2)==="00"?o+="\\x"+u.substr(2):o+=t.substr(a,6)}a+=5,l=a+1}break;case"n":if(n||t[a+2]==='"'||t.length<i)a+=1;else{for(o+=t.slice(l,a)+`
13
13
 
14
14
  `;t[a+2]==="\\"&&t[a+3]==="n"&&t[a+4]!=='"';)o+=`
15
- `,a+=2;o+=r,t[a+2]===" "&&(o+="\\"),a+=1,l=a+1}break;default:a+=1}return o=l?o+t.slice(l):t,n?o:Ue(o,r,Ce,Re(e))}function ct(s,e){if(e.options.singleQuote===!1||e.implicitKey&&s.includes(`
16
- `)||/[ \t]\n|\n[ \t]/.test(s))return ye(s,e);const t=e.indent||(Ve(s)?" ":""),n="'"+s.replace(/'/g,"''").replace(/\n+/g,`$&
17
- ${t}`)+"'";return e.implicitKey?n:Ue(n,t,Ht,Re(e))}function re(s,e){const{singleQuote:t}=e.options;let n;if(t===!1)n=ye;else{const i=s.includes('"'),r=s.includes("'");i&&!r?n=ct:r&&!i?n=ye:n=t?ct:ye}return n(s,e)}function _e({comment:s,type:e,value:t},n,i,r){const{blockQuote:o,commentString:l,lineWidth:a}=n.options;if(!o||/\n[\t ]+$/.test(t)||/^\s*$/.test(t))return re(t,n);const c=n.indent||(n.forceBlockIndent||Ve(t)?" ":""),u=o==="literal"?!0:o==="folded"||e===N.BLOCK_FOLDED?!1:e===N.BLOCK_LITERAL?!0:!Fs(t,a,c.length);if(!t)return u?`|
15
+ `,a+=2;o+=r,t[a+2]===" "&&(o+="\\"),a+=1,l=a+1}break;default:a+=1}return o=l?o+t.slice(l):t,n?o:qe(o,r,$e,Ue(e))}function at(s,e){if(e.options.singleQuote===!1||e.implicitKey&&s.includes(`
16
+ `)||/[ \t]\n|\n[ \t]/.test(s))return ye(s,e);const t=e.indent||(Re(s)?" ":""),n="'"+s.replace(/'/g,"''").replace(/\n+/g,`$&
17
+ ${t}`)+"'";return e.implicitKey?n:qe(n,t,Qt,Ue(e))}function re(s,e){const{singleQuote:t}=e.options;let n;if(t===!1)n=ye;else{const i=s.includes('"'),r=s.includes("'");i&&!r?n=at:r&&!i?n=ye:n=t?at:ye}return n(s,e)}function Ce({comment:s,type:e,value:t},n,i,r){const{blockQuote:o,commentString:l,lineWidth:a}=n.options;if(!o||/\n[\t ]+$/.test(t)||/^\s*$/.test(t))return re(t,n);const c=n.indent||(n.forceBlockIndent||Re(t)?" ":""),u=o==="literal"?!0:o==="folded"||e===N.BLOCK_FOLDED?!1:e===N.BLOCK_LITERAL?!0:!Ds(t,a,c.length);if(!t)return u?`|
18
18
  `:`>
19
19
  `;let f,h;for(h=t.length;h>0;--h){const g=t[h-1];if(g!==`
20
20
  `&&g!==" "&&g!==" ")break}let p=t.substring(h);const y=p.indexOf(`
@@ -22,47 +22,47 @@ ${t}`)+"'";return e.implicitKey?n:Ue(n,t,Ht,Re(e))}function re(s,e){const{single
22
22
  `&&(p=p.slice(0,-1)),p=p.replace(/\n+(?!\n|$)/g,`$&${c}`));let d=!1,m,b=-1;for(m=0;m<t.length;++m){const g=t[m];if(g===" ")d=!0;else if(g===`
23
23
  `)b=m;else break}let w=t.substring(0,b<m?b+1:m);w&&(t=t.substring(w.length),w=w.replace(/\n+/g,`$&${c}`));let S=(u?"|":">")+(d?c?"2":"1":"")+f;if(s&&(S+=" "+l(s.replace(/ ?[\r\n]+/g," ")),i&&i()),u)return t=t.replace(/\n+/g,`$&${c}`),`${S}
24
24
  ${c}${w}${t}${p}`;t=t.replace(/\n+/g,`
25
- $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`);const O=Ue(`${w}${t}${p}`,c,at,Re(n));return`${S}
26
- ${c}${O}`}function qs(s,e,t,n){const{type:i,value:r}=s,{actualString:o,implicitKey:l,indent:a,indentStep:c,inFlow:u}=e;if(l&&/[\n[\]{},]/.test(r)||u&&/[[\]{},]/.test(r))return re(r,e);if(!r||/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))return l||u||!r.includes(`
27
- `)?re(r,e):_e(s,e,t,n);if(!l&&!u&&i!==N.PLAIN&&r.includes(`
28
- `))return _e(s,e,t,n);if(Ve(r)){if(a==="")return e.forceBlockIndent=!0,_e(s,e,t,n);if(l&&a===c)return re(r,e)}const f=r.replace(/\n+/g,`$&
29
- ${a}`);if(o){const h=d=>d.default&&d.tag!=="tag:yaml.org,2002:str"&&d.test?.test(f),{compat:p,tags:y}=e.doc.schema;if(y.some(h)||p?.some(h))return re(r,e)}return l?f:Ue(f,a,Ht,Re(e))}function Ne(s,e,t,n){const{implicitKey:i,inFlow:r}=e,o=typeof s.value=="string"?s:Object.assign({},s,{value:String(s.value)});let{type:l}=s;l!==N.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(l=N.QUOTE_DOUBLE);const a=u=>{switch(u){case N.BLOCK_FOLDED:case N.BLOCK_LITERAL:return i||r?re(o.value,e):_e(o,e,t,n);case N.QUOTE_DOUBLE:return ye(o.value,e);case N.QUOTE_SINGLE:return ct(o.value,e);case N.PLAIN:return qs(o,e,t,n);default:return null}};let c=a(l);if(c===null){const{defaultKeyType:u,defaultStringType:f}=e.options,h=i&&u||f;if(c=a(h),c===null)throw new Error(`Unsupported default string type ${h}`)}return c}function xt(s,e){const t=Object.assign({blockQuote:!0,commentString:Ks,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},s.schema.toStringOptions,e);let n;switch(t.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:s,flowCollectionPadding:t.flowCollectionPadding?" ":"",indent:"",indentStep:typeof t.indent=="number"?" ".repeat(t.indent):" ",inFlow:n,options:t}}function Us(s,e){if(e.tag){const i=s.filter(r=>r.tag===e.tag);if(i.length>0)return i.find(r=>r.format===e.format)??i[0]}let t,n;if(A(e)){n=e.value;const i=s.filter(r=>r.identify?.(n));t=i.find(r=>r.format===e.format)??i.find(r=>!r.format)}else n=e,t=s.find(i=>i.nodeClass&&n instanceof i.nodeClass);if(!t){const i=n?.constructor?.name??typeof n;throw new Error(`Tag not resolved for ${i} value`)}return t}function Rs(s,e,{anchors:t,doc:n}){if(!n.directives)return"";const i=[],r=(A(s)||L(s))&&s.anchor;r&&Jt(r)&&(t.add(r),i.push(`&${r}`));const o=s.tag?s.tag:e.default?null:e.tag;return o&&i.push(n.directives.tagString(o)),i.join(" ")}function H(s,e,t,n){if(I(s))return s.toString(e,t,n);if(X(s)){if(e.doc.directives)return s.toString(e);if(e.resolvedAliases?.has(s))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(s):e.resolvedAliases=new Set([s]),s=s.resolve(e.doc)}let i;const r=T(s)?s:e.doc.createNode(s,{onTagObj:a=>i=a});i||(i=Us(e.doc.schema.tags,r));const o=Rs(r,i,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);const l=typeof i.stringify=="function"?i.stringify(r,e,t,n):A(r)?Ne(r,e,t,n):r.toString(e,t,n);return o?A(r)||l[0]==="{"||l[0]==="["?`${o} ${l}`:`${o}
30
- ${e.indent}${l}`:l}function Vs({key:s,value:e},t,n,i){const{allNullValues:r,doc:o,indent:l,indentStep:a,options:{commentString:c,indentSeq:u,simpleKeys:f}}=t;let h=T(s)&&s.comment||null;if(f){if(h)throw new Error("With simple keys, key nodes cannot have comments");if(L(s)){const E="With simple keys, collection cannot be used as a key value";throw new Error(E)}}let p=!f&&(!s||h&&e==null&&!t.inFlow||L(s)||(A(s)?s.type===N.BLOCK_FOLDED||s.type===N.BLOCK_LITERAL:typeof s=="object"));t=Object.assign({},t,{allNullValues:!1,implicitKey:!p&&(f||!r),indent:l+a});let y=!1,d=!1,m=H(s,t,()=>y=!0,()=>d=!0);if(!p&&!t.inFlow&&m.length>1024){if(f)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(t.inFlow){if(r||e==null)return y&&n&&n(),m===""?"?":p?`? ${m}`:m}else if(r&&!f||e==null&&p)return m=`? ${m}`,h&&!y?m+=V(m,t.indent,c(h)):d&&i&&i(),m;y&&(h=null),p?(h&&(m+=V(m,t.indent,c(h))),m=`? ${m}
31
- ${l}:`):(m=`${m}:`,h&&(m+=V(m,t.indent,c(h))));let b,w,k;T(e)?(b=!!e.spaceBefore,w=e.commentBefore,k=e.comment):(b=!1,w=null,k=null,e&&typeof e=="object"&&(e=o.createNode(e))),t.implicitKey=!1,!p&&!h&&A(e)&&(t.indentAtStart=m.length+1),d=!1,!u&&a.length>=2&&!t.inFlow&&!p&&fe(e)&&!e.flow&&!e.tag&&!e.anchor&&(t.indent=t.indent.substring(2));let S=!1;const O=H(e,t,()=>S=!0,()=>d=!0);let g=" ";if(h||b||w){if(g=b?`
25
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`);const O=qe(`${w}${t}${p}`,c,lt,Ue(n));return`${S}
26
+ ${c}${O}`}function Ks(s,e,t,n){const{type:i,value:r}=s,{actualString:o,implicitKey:l,indent:a,indentStep:c,inFlow:u}=e;if(l&&/[\n[\]{},]/.test(r)||u&&/[[\]{},]/.test(r))return re(r,e);if(!r||/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))return l||u||!r.includes(`
27
+ `)?re(r,e):Ce(s,e,t,n);if(!l&&!u&&i!==N.PLAIN&&r.includes(`
28
+ `))return Ce(s,e,t,n);if(Re(r)){if(a==="")return e.forceBlockIndent=!0,Ce(s,e,t,n);if(l&&a===c)return re(r,e)}const f=r.replace(/\n+/g,`$&
29
+ ${a}`);if(o){const h=d=>d.default&&d.tag!=="tag:yaml.org,2002:str"&&d.test?.test(f),{compat:p,tags:y}=e.doc.schema;if(y.some(h)||p?.some(h))return re(r,e)}return l?f:qe(f,a,Qt,Ue(e))}function Ne(s,e,t,n){const{implicitKey:i,inFlow:r}=e,o=typeof s.value=="string"?s:Object.assign({},s,{value:String(s.value)});let{type:l}=s;l!==N.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(l=N.QUOTE_DOUBLE);const a=u=>{switch(u){case N.BLOCK_FOLDED:case N.BLOCK_LITERAL:return i||r?re(o.value,e):Ce(o,e,t,n);case N.QUOTE_DOUBLE:return ye(o.value,e);case N.QUOTE_SINGLE:return at(o.value,e);case N.PLAIN:return Ks(o,e,t,n);default:return null}};let c=a(l);if(c===null){const{defaultKeyType:u,defaultStringType:f}=e.options,h=i&&u||f;if(c=a(h),c===null)throw new Error(`Unsupported default string type ${h}`)}return c}function Ht(s,e){const t=Object.assign({blockQuote:!0,commentString:Ps,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},s.schema.toStringOptions,e);let n;switch(t.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:s,flowCollectionPadding:t.flowCollectionPadding?" ":"",indent:"",indentStep:typeof t.indent=="number"?" ".repeat(t.indent):" ",inFlow:n,options:t}}function Fs(s,e){if(e.tag){const i=s.filter(r=>r.tag===e.tag);if(i.length>0)return i.find(r=>r.format===e.format)??i[0]}let t,n;if(A(e)){n=e.value;const i=s.filter(r=>r.identify?.(n));t=i.find(r=>r.format===e.format)??i.find(r=>!r.format)}else n=e,t=s.find(i=>i.nodeClass&&n instanceof i.nodeClass);if(!t){const i=n?.constructor?.name??typeof n;throw new Error(`Tag not resolved for ${i} value`)}return t}function qs(s,e,{anchors:t,doc:n}){if(!n.directives)return"";const i=[],r=(A(s)||T(s))&&s.anchor;r&&Wt(r)&&(t.add(r),i.push(`&${r}`));const o=s.tag?s.tag:e.default?null:e.tag;return o&&i.push(n.directives.tagString(o)),i.join(" ")}function H(s,e,t,n){if(I(s))return s.toString(e,t,n);if(X(s)){if(e.doc.directives)return s.toString(e);if(e.resolvedAliases?.has(s))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(s):e.resolvedAliases=new Set([s]),s=s.resolve(e.doc)}let i;const r=L(s)?s:e.doc.createNode(s,{onTagObj:a=>i=a});i||(i=Fs(e.doc.schema.tags,r));const o=qs(r,i,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);const l=typeof i.stringify=="function"?i.stringify(r,e,t,n):A(r)?Ne(r,e,t,n):r.toString(e,t,n);return o?A(r)||l[0]==="{"||l[0]==="["?`${o} ${l}`:`${o}
30
+ ${e.indent}${l}`:l}function Us({key:s,value:e},t,n,i){const{allNullValues:r,doc:o,indent:l,indentStep:a,options:{commentString:c,indentSeq:u,simpleKeys:f}}=t;let h=L(s)&&s.comment||null;if(f){if(h)throw new Error("With simple keys, key nodes cannot have comments");if(T(s)){const E="With simple keys, collection cannot be used as a key value";throw new Error(E)}}let p=!f&&(!s||h&&e==null&&!t.inFlow||T(s)||(A(s)?s.type===N.BLOCK_FOLDED||s.type===N.BLOCK_LITERAL:typeof s=="object"));t=Object.assign({},t,{allNullValues:!1,implicitKey:!p&&(f||!r),indent:l+a});let y=!1,d=!1,m=H(s,t,()=>y=!0,()=>d=!0);if(!p&&!t.inFlow&&m.length>1024){if(f)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(t.inFlow){if(r||e==null)return y&&n&&n(),m===""?"?":p?`? ${m}`:m}else if(r&&!f||e==null&&p)return m=`? ${m}`,h&&!y?m+=V(m,t.indent,c(h)):d&&i&&i(),m;y&&(h=null),p?(h&&(m+=V(m,t.indent,c(h))),m=`? ${m}
31
+ ${l}:`):(m=`${m}:`,h&&(m+=V(m,t.indent,c(h))));let b,w,k;L(e)?(b=!!e.spaceBefore,w=e.commentBefore,k=e.comment):(b=!1,w=null,k=null,e&&typeof e=="object"&&(e=o.createNode(e))),t.implicitKey=!1,!p&&!h&&A(e)&&(t.indentAtStart=m.length+1),d=!1,!u&&a.length>=2&&!t.inFlow&&!p&&fe(e)&&!e.flow&&!e.tag&&!e.anchor&&(t.indent=t.indent.substring(2));let S=!1;const O=H(e,t,()=>S=!0,()=>d=!0);let g=" ";if(h||b||w){if(g=b?`
32
32
  `:"",w){const E=c(w);g+=`
33
33
  ${U(E,t.indent)}`}O===""&&!t.inFlow?g===`
34
34
  `&&(g=`
35
35
 
36
36
  `):g+=`
37
- ${t.indent}`}else if(!p&&L(e)){const E=O[0],q=O.indexOf(`
38
- `),ee=q!==-1,v=t.inFlow??e.flow??e.items.length===0;if(ee||!v){let Lt=!1;if(ee&&(E==="&"||E==="!")){let Y=O.indexOf(" ");E==="&"&&Y!==-1&&Y<q&&O[Y+1]==="!"&&(Y=O.indexOf(" ",Y+1)),(Y===-1||q<Y)&&(Lt=!0)}Lt||(g=`
37
+ ${t.indent}`}else if(!p&&T(e)){const E=O[0],q=O.indexOf(`
38
+ `),ee=q!==-1,_=t.inFlow??e.flow??e.items.length===0;if(ee||!_){let It=!1;if(ee&&(E==="&"||E==="!")){let Y=O.indexOf(" ");E==="&"&&Y!==-1&&Y<q&&O[Y+1]==="!"&&(Y=O.indexOf(" ",Y+1)),(Y===-1||q<Y)&&(It=!0)}It||(g=`
39
39
  ${t.indent}`)}}else(O===""||O[0]===`
40
- `)&&(g="");return m+=g+O,t.inFlow?S&&n&&n():k&&!S?m+=V(m,t.indent,c(k)):d&&i&&i(),m}function Xt(s,e){(s==="debug"||s==="warn")&&(typeof process<"u"&&process.emitWarning?process.emitWarning(e):console.warn(e))}const $t="<<";function zt(s,e,{key:t,value:n}){if(s?.doc.schema.merge&&Ws(t))if(n=X(n)?n.resolve(s.doc):n,fe(n))for(const i of n.items)Ze(s,e,i);else if(Array.isArray(n))for(const i of n)Ze(s,e,i);else Ze(s,e,n);else{const i=F(t,"",s);if(e instanceof Map)e.set(i,F(n,i,s));else if(e instanceof Set)e.add(i);else{const r=Js(t,i,s),o=F(n,r,s);r in e?Object.defineProperty(e,r,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[r]=o}}return e}const Ws=s=>s===$t||A(s)&&s.value===$t&&(!s.type||s.type===N.PLAIN);function Ze(s,e,t){const n=s&&X(t)?t.resolve(s.doc):t;if(!z(n))throw new Error("Merge sources must be maps or map aliases");const i=n.toJSON(null,s,Map);for(const[r,o]of i)e instanceof Map?e.has(r)||e.set(r,o):e instanceof Set?e.add(r):Object.prototype.hasOwnProperty.call(e,r)||Object.defineProperty(e,r,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}function Js(s,e,t){if(e===null)return"";if(typeof e!="object")return String(e);if(T(s)&&t&&t.doc){const n=xt(t.doc,{});n.anchors=new Set;for(const r of t.anchors.keys())n.anchors.add(r.anchor);n.inFlow=!0,n.inStringifyKey=!0;const i=s.toString(n);if(!t.mapKeyWarned){let r=JSON.stringify(i);r.length>40&&(r=r.substring(0,36)+'..."'),Xt(t.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${r}. Set mapAsMap: true to use object keys.`),t.mapKeyWarned=!0}return i}return JSON.stringify(e)}function pt(s,e,t){const n=be(s,void 0,t),i=be(e,void 0,t);return new $(n,i)}class ${constructor(e,t=null){Object.defineProperty(this,M,{value:qt}),this.key=e,this.value=t}clone(e){let{key:t,value:n}=this;return T(t)&&(t=t.clone(e)),T(n)&&(n=n.clone(e)),new $(t,n)}toJSON(e,t){const n=t?.mapAsMap?new Map:{};return zt(t,n,this)}toString(e,t,n){return e?.doc?Vs(this,e,t,n):JSON.stringify(this)}}function Zt(s,e,t){return(e.inFlow??s.flow?Gs:Ys)(s,e,t)}function Ys({comment:s,items:e},t,{blockItemPrefix:n,flowChars:i,itemIndent:r,onChompKeep:o,onComment:l}){const{indent:a,options:{commentString:c}}=t,u=Object.assign({},t,{indent:r,type:null});let f=!1;const h=[];for(let y=0;y<e.length;++y){const d=e[y];let m=null;if(T(d))!f&&d.spaceBefore&&h.push(""),Me(t,h,d.commentBefore,f),d.comment&&(m=d.comment);else if(I(d)){const w=T(d.key)?d.key:null;w&&(!f&&w.spaceBefore&&h.push(""),Me(t,h,w.commentBefore,f))}f=!1;let b=H(d,u,()=>m=null,()=>f=!0);m&&(b+=V(b,r,c(m))),f&&m&&(f=!1),h.push(n+b)}let p;if(h.length===0)p=i.start+i.end;else{p=h[0];for(let y=1;y<h.length;++y){const d=h[y];p+=d?`
40
+ `)&&(g="");return m+=g+O,t.inFlow?S&&n&&n():k&&!S?m+=V(m,t.indent,c(k)):d&&i&&i(),m}function xt(s,e){(s==="debug"||s==="warn")&&(typeof process<"u"&&process.emitWarning?process.emitWarning(e):console.warn(e))}const Lt="<<";function Xt(s,e,{key:t,value:n}){if(s?.doc.schema.merge&&Rs(t))if(n=X(n)?n.resolve(s.doc):n,fe(n))for(const i of n.items)Ze(s,e,i);else if(Array.isArray(n))for(const i of n)Ze(s,e,i);else Ze(s,e,n);else{const i=F(t,"",s);if(e instanceof Map)e.set(i,F(n,i,s));else if(e instanceof Set)e.add(i);else{const r=Vs(t,i,s),o=F(n,r,s);r in e?Object.defineProperty(e,r,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[r]=o}}return e}const Rs=s=>s===Lt||A(s)&&s.value===Lt&&(!s.type||s.type===N.PLAIN);function Ze(s,e,t){const n=s&&X(t)?t.resolve(s.doc):t;if(!z(n))throw new Error("Merge sources must be maps or map aliases");const i=n.toJSON(null,s,Map);for(const[r,o]of i)e instanceof Map?e.has(r)||e.set(r,o):e instanceof Set?e.add(r):Object.prototype.hasOwnProperty.call(e,r)||Object.defineProperty(e,r,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}function Vs(s,e,t){if(e===null)return"";if(typeof e!="object")return String(e);if(L(s)&&t&&t.doc){const n=Ht(t.doc,{});n.anchors=new Set;for(const r of t.anchors.keys())n.anchors.add(r.anchor);n.inFlow=!0,n.inStringifyKey=!0;const i=s.toString(n);if(!t.mapKeyWarned){let r=JSON.stringify(i);r.length>40&&(r=r.substring(0,36)+'..."'),xt(t.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${r}. Set mapAsMap: true to use object keys.`),t.mapKeyWarned=!0}return i}return JSON.stringify(e)}function dt(s,e,t){const n=be(s,void 0,t),i=be(e,void 0,t);return new $(n,i)}class ${constructor(e,t=null){Object.defineProperty(this,j,{value:Ft}),this.key=e,this.value=t}clone(e){let{key:t,value:n}=this;return L(t)&&(t=t.clone(e)),L(n)&&(n=n.clone(e)),new $(t,n)}toJSON(e,t){const n=t?.mapAsMap?new Map:{};return Xt(t,n,this)}toString(e,t,n){return e?.doc?Us(this,e,t,n):JSON.stringify(this)}}function zt(s,e,t){return(e.inFlow??s.flow?Js:Ws)(s,e,t)}function Ws({comment:s,items:e},t,{blockItemPrefix:n,flowChars:i,itemIndent:r,onChompKeep:o,onComment:l}){const{indent:a,options:{commentString:c}}=t,u=Object.assign({},t,{indent:r,type:null});let f=!1;const h=[];for(let y=0;y<e.length;++y){const d=e[y];let m=null;if(L(d))!f&&d.spaceBefore&&h.push(""),Me(t,h,d.commentBefore,f),d.comment&&(m=d.comment);else if(I(d)){const w=L(d.key)?d.key:null;w&&(!f&&w.spaceBefore&&h.push(""),Me(t,h,w.commentBefore,f))}f=!1;let b=H(d,u,()=>m=null,()=>f=!0);m&&(b+=V(b,r,c(m))),f&&m&&(f=!1),h.push(n+b)}let p;if(h.length===0)p=i.start+i.end;else{p=h[0];for(let y=1;y<h.length;++y){const d=h[y];p+=d?`
41
41
  ${a}${d}`:`
42
42
  `}}return s?(p+=`
43
- `+U(c(s),a),l&&l()):f&&o&&o(),p}function Gs({comment:s,items:e},t,{flowChars:n,itemIndent:i,onComment:r}){const{indent:o,indentStep:l,flowCollectionPadding:a,options:{commentString:c}}=t;i+=l;const u=Object.assign({},t,{indent:i,inFlow:!0,type:null});let f=!1,h=0;const p=[];for(let b=0;b<e.length;++b){const w=e[b];let k=null;if(T(w))w.spaceBefore&&p.push(""),Me(t,p,w.commentBefore,!1),w.comment&&(k=w.comment);else if(I(w)){const O=T(w.key)?w.key:null;O&&(O.spaceBefore&&p.push(""),Me(t,p,O.commentBefore,!1),O.comment&&(f=!0));const g=T(w.value)?w.value:null;g?(g.comment&&(k=g.comment),g.commentBefore&&(f=!0)):w.value==null&&O&&O.comment&&(k=O.comment)}k&&(f=!0);let S=H(w,u,()=>k=null);b<e.length-1&&(S+=","),k&&(S+=V(S,i,c(k))),!f&&(p.length>h||S.includes(`
44
- `))&&(f=!0),p.push(S),h=p.length}let y;const{start:d,end:m}=n;if(p.length===0)y=d+m;else if(f||(f=p.reduce((w,k)=>w+k.length+2,2)>qe.maxFlowStringSingleLineLength),f){y=d;for(const b of p)y+=b?`
43
+ `+U(c(s),a),l&&l()):f&&o&&o(),p}function Js({comment:s,items:e},t,{flowChars:n,itemIndent:i,onComment:r}){const{indent:o,indentStep:l,flowCollectionPadding:a,options:{commentString:c}}=t;i+=l;const u=Object.assign({},t,{indent:i,inFlow:!0,type:null});let f=!1,h=0;const p=[];for(let b=0;b<e.length;++b){const w=e[b];let k=null;if(L(w))w.spaceBefore&&p.push(""),Me(t,p,w.commentBefore,!1),w.comment&&(k=w.comment);else if(I(w)){const O=L(w.key)?w.key:null;O&&(O.spaceBefore&&p.push(""),Me(t,p,O.commentBefore,!1),O.comment&&(f=!0));const g=L(w.value)?w.value:null;g?(g.comment&&(k=g.comment),g.commentBefore&&(f=!0)):w.value==null&&O&&O.comment&&(k=O.comment)}k&&(f=!0);let S=H(w,u,()=>k=null);b<e.length-1&&(S+=","),k&&(S+=V(S,i,c(k))),!f&&(p.length>h||S.includes(`
44
+ `))&&(f=!0),p.push(S),h=p.length}let y;const{start:d,end:m}=n;if(p.length===0)y=d+m;else if(f||(f=p.reduce((w,k)=>w+k.length+2,2)>Fe.maxFlowStringSingleLineLength),f){y=d;for(const b of p)y+=b?`
45
45
  ${l}${o}${b}`:`
46
46
  `;y+=`
47
- ${o}${m}`}else y=`${d}${a}${p.join(" ")}${a}${m}`;return s&&(y+=V(y,c(s),o),r&&r()),y}function Me({indent:s,options:{commentString:e}},t,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){const r=U(e(n),s);t.push(r.trimStart())}}function G(s,e){const t=A(e)?e.value:e;for(const n of s)if(I(n)&&(n.key===e||n.key===t||A(n.key)&&n.key.value===t))return n}class j extends qe{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(W,e),this.items=[]}add(e,t){let n;I(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new $(e,e?.value):n=new $(e.key,e.value);const i=G(this.items,n.key),r=this.schema?.sortMapEntries;if(i){if(!t)throw new Error(`Key ${n.key} already set`);A(i.value)&&Qt(n.value)?i.value.value=n.value:i.value=n.value}else if(r){const o=this.items.findIndex(l=>r(n,l)<0);o===-1?this.items.push(n):this.items.splice(o,0,n)}else this.items.push(n)}delete(e){const t=G(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){const i=G(this.items,e)?.value;return(!t&&A(i)?i.value:i)??void 0}has(e){return!!G(this.items,e)}set(e,t){this.add(new $(e,t),!0)}toJSON(e,t,n){const i=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(i);for(const r of this.items)zt(t,i,r);return i}toString(e,t,n){if(!e)return JSON.stringify(this);for(const i of this.items)if(!I(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Zt(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:t})}}function Qs(s,e,t){const{keepUndefined:n,replacer:i}=t,r=new j(s),o=(l,a)=>{if(typeof i=="function")a=i.call(e,l,a);else if(Array.isArray(i)&&!i.includes(l))return;(a!==void 0||n)&&r.items.push(pt(l,a,t))};if(e instanceof Map)for(const[l,a]of e)o(l,a);else if(e&&typeof e=="object")for(const l of Object.keys(e))o(l,e[l]);return typeof s.sortMapEntries=="function"&&r.items.sort(s.sortMapEntries),r}const ue={collection:"map",createNode:Qs,default:!0,nodeClass:j,tag:"tag:yaml.org,2002:map",resolve(s,e){return z(s)||e("Expected a mapping for this tag"),s}};class Z extends qe{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(ce,e),this.items=[]}add(e){this.items.push(e)}delete(e){const t=Ee(e);return typeof t!="number"?!1:this.items.splice(t,1).length>0}get(e,t){const n=Ee(e);if(typeof n!="number")return;const i=this.items[n];return!t&&A(i)?i.value:i}has(e){const t=Ee(e);return typeof t=="number"&&t<this.items.length}set(e,t){const n=Ee(e);if(typeof n!="number")throw new Error(`Expected a valid index, not ${e}.`);const i=this.items[n];A(i)&&Qt(t)?i.value=t:this.items[n]=t}toJSON(e,t){const n=[];t?.onCreate&&t.onCreate(n);let i=0;for(const r of this.items)n.push(F(r,String(i++),t));return n}toString(e,t,n){return e?Zt(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:n,onComment:t}):JSON.stringify(this)}}function Ee(s){let e=A(s)?s.value:s;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}function Hs(s,e,t){const{replacer:n}=t,i=new Z(s);if(e&&Symbol.iterator in Object(e)){let r=0;for(let o of e){if(typeof n=="function"){const l=e instanceof Set?o:String(r++);o=n.call(e,l,o)}i.items.push(be(o,void 0,t))}}return i}const he={collection:"seq",createNode:Hs,default:!0,nodeClass:Z,tag:"tag:yaml.org,2002:seq",resolve(s,e){return fe(s)||e("Expected a sequence for this tag"),s}},We={identify:s=>typeof s=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:s=>s,stringify(s,e,t,n){return e=Object.assign({actualString:!0},e),Ne(s,e,t,n)}},Je={identify:s=>s==null,createNode:()=>new N(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new N(null),stringify:({source:s},e)=>typeof s=="string"&&Je.test.test(s)?s:e.options.nullStr},mt={identify:s=>typeof s=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:s=>new N(s[0]==="t"||s[0]==="T"),stringify({source:s,value:e},t){if(s&&mt.test.test(s)){const n=s[0]==="t"||s[0]==="T";if(e===n)return s}return e?t.options.trueStr:t.options.falseStr}};function D({format:s,minFractionDigits:e,tag:t,value:n}){if(typeof n=="bigint")return String(n);const i=typeof n=="number"?n:Number(n);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let r=JSON.stringify(n);if(!s&&e&&(!t||t==="tag:yaml.org,2002:float")&&/^\d/.test(r)){let o=r.indexOf(".");o<0&&(o=r.length,r+=".");let l=e-(r.length-o-1);for(;l-- >0;)r+="0"}return r}const es={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF|nan|NaN|NAN))$/,resolve:s=>s.slice(-3).toLowerCase()==="nan"?NaN:s[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:D},ts={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:s=>parseFloat(s),stringify(s){const e=Number(s.value);return isFinite(e)?e.toExponential():D(s)}},ss={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(s){const e=new N(parseFloat(s)),t=s.indexOf(".");return t!==-1&&s[s.length-1]==="0"&&(e.minFractionDigits=s.length-t-1),e},stringify:D},Ye=s=>typeof s=="bigint"||Number.isInteger(s),gt=(s,e,t,{intAsBigInt:n})=>n?BigInt(s):parseInt(s.substring(e),t);function ns(s,e,t){const{value:n}=s;return Ye(n)&&n>=0?t+n.toString(e):D(s)}const is={identify:s=>Ye(s)&&s>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(s,e,t)=>gt(s,2,8,t),stringify:s=>ns(s,8,"0o")},rs={identify:Ye,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(s,e,t)=>gt(s,0,10,t),stringify:D},os={identify:s=>Ye(s)&&s>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(s,e,t)=>gt(s,2,16,t),stringify:s=>ns(s,16,"0x")},xs=[ue,he,We,Je,mt,is,rs,os,es,ts,ss];function Ct(s){return typeof s=="bigint"||Number.isInteger(s)}const Ie=({value:s})=>JSON.stringify(s),Xs=[{identify:s=>typeof s=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:s=>s,stringify:Ie},{identify:s=>s==null,createNode:()=>new N(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Ie},{identify:s=>typeof s=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true|false$/,resolve:s=>s==="true",stringify:Ie},{identify:Ct,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(s,e,{intAsBigInt:t})=>t?BigInt(s):parseInt(s,10),stringify:({value:s})=>Ct(s)?s.toString():JSON.stringify(s)},{identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:s=>parseFloat(s),stringify:Ie}],zs={default:!0,tag:"",test:/^/,resolve(s,e){return e(`Unresolved plain scalar ${JSON.stringify(s)}`),s}},Zs=[ue,he].concat(Xs,zs),yt={identify:s=>s instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(s,e){if(typeof Buffer=="function")return Buffer.from(s,"base64");if(typeof atob=="function"){const t=atob(s.replace(/[\n\r]/g,"")),n=new Uint8Array(t.length);for(let i=0;i<t.length;++i)n[i]=t.charCodeAt(i);return n}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),s},stringify({comment:s,type:e,value:t},n,i,r){const o=t;let l;if(typeof Buffer=="function")l=o instanceof Buffer?o.toString("base64"):Buffer.from(o.buffer).toString("base64");else if(typeof btoa=="function"){let a="";for(let c=0;c<o.length;++c)a+=String.fromCharCode(o[c]);l=btoa(a)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e||(e=N.BLOCK_LITERAL),e!==N.QUOTE_DOUBLE){const a=Math.max(n.options.lineWidth-n.indent.length,n.options.minContentWidth),c=Math.ceil(l.length/a),u=new Array(c);for(let f=0,h=0;f<c;++f,h+=a)u[f]=l.substr(h,a);l=u.join(e===N.BLOCK_LITERAL?`
48
- `:" ")}return Ne({comment:s,type:e,value:l},n,i,r)}};function ls(s,e){if(fe(s))for(let t=0;t<s.items.length;++t){let n=s.items[t];if(!I(n)){if(z(n)){n.items.length>1&&e("Each pair must have its own sequence indicator");const i=n.items[0]||new $(new N(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore}
47
+ ${o}${m}`}else y=`${d}${a}${p.join(" ")}${a}${m}`;return s&&(y+=V(y,c(s),o),r&&r()),y}function Me({indent:s,options:{commentString:e}},t,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){const r=U(e(n),s);t.push(r.trimStart())}}function G(s,e){const t=A(e)?e.value:e;for(const n of s)if(I(n)&&(n.key===e||n.key===t||A(n.key)&&n.key.value===t))return n}class M extends Fe{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(W,e),this.items=[]}add(e,t){let n;I(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new $(e,e?.value):n=new $(e.key,e.value);const i=G(this.items,n.key),r=this.schema?.sortMapEntries;if(i){if(!t)throw new Error(`Key ${n.key} already set`);A(i.value)&&Gt(n.value)?i.value.value=n.value:i.value=n.value}else if(r){const o=this.items.findIndex(l=>r(n,l)<0);o===-1?this.items.push(n):this.items.splice(o,0,n)}else this.items.push(n)}delete(e){const t=G(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){const i=G(this.items,e)?.value;return(!t&&A(i)?i.value:i)??void 0}has(e){return!!G(this.items,e)}set(e,t){this.add(new $(e,t),!0)}toJSON(e,t,n){const i=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(i);for(const r of this.items)Xt(t,i,r);return i}toString(e,t,n){if(!e)return JSON.stringify(this);for(const i of this.items)if(!I(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),zt(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:t})}}function Ys(s,e,t){const{keepUndefined:n,replacer:i}=t,r=new M(s),o=(l,a)=>{if(typeof i=="function")a=i.call(e,l,a);else if(Array.isArray(i)&&!i.includes(l))return;(a!==void 0||n)&&r.items.push(dt(l,a,t))};if(e instanceof Map)for(const[l,a]of e)o(l,a);else if(e&&typeof e=="object")for(const l of Object.keys(e))o(l,e[l]);return typeof s.sortMapEntries=="function"&&r.items.sort(s.sortMapEntries),r}const ue={collection:"map",createNode:Ys,default:!0,nodeClass:M,tag:"tag:yaml.org,2002:map",resolve(s,e){return z(s)||e("Expected a mapping for this tag"),s}};class Z extends Fe{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(ce,e),this.items=[]}add(e){this.items.push(e)}delete(e){const t=Ee(e);return typeof t!="number"?!1:this.items.splice(t,1).length>0}get(e,t){const n=Ee(e);if(typeof n!="number")return;const i=this.items[n];return!t&&A(i)?i.value:i}has(e){const t=Ee(e);return typeof t=="number"&&t<this.items.length}set(e,t){const n=Ee(e);if(typeof n!="number")throw new Error(`Expected a valid index, not ${e}.`);const i=this.items[n];A(i)&&Gt(t)?i.value=t:this.items[n]=t}toJSON(e,t){const n=[];t?.onCreate&&t.onCreate(n);let i=0;for(const r of this.items)n.push(F(r,String(i++),t));return n}toString(e,t,n){return e?zt(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:n,onComment:t}):JSON.stringify(this)}}function Ee(s){let e=A(s)?s.value:s;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}function Gs(s,e,t){const{replacer:n}=t,i=new Z(s);if(e&&Symbol.iterator in Object(e)){let r=0;for(let o of e){if(typeof n=="function"){const l=e instanceof Set?o:String(r++);o=n.call(e,l,o)}i.items.push(be(o,void 0,t))}}return i}const he={collection:"seq",createNode:Gs,default:!0,nodeClass:Z,tag:"tag:yaml.org,2002:seq",resolve(s,e){return fe(s)||e("Expected a sequence for this tag"),s}},Ve={identify:s=>typeof s=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:s=>s,stringify(s,e,t,n){return e=Object.assign({actualString:!0},e),Ne(s,e,t,n)}},We={identify:s=>s==null,createNode:()=>new N(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new N(null),stringify:({source:s},e)=>typeof s=="string"&&We.test.test(s)?s:e.options.nullStr},pt={identify:s=>typeof s=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:s=>new N(s[0]==="t"||s[0]==="T"),stringify({source:s,value:e},t){if(s&&pt.test.test(s)){const n=s[0]==="t"||s[0]==="T";if(e===n)return s}return e?t.options.trueStr:t.options.falseStr}};function D({format:s,minFractionDigits:e,tag:t,value:n}){if(typeof n=="bigint")return String(n);const i=typeof n=="number"?n:Number(n);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let r=JSON.stringify(n);if(!s&&e&&(!t||t==="tag:yaml.org,2002:float")&&/^\d/.test(r)){let o=r.indexOf(".");o<0&&(o=r.length,r+=".");let l=e-(r.length-o-1);for(;l-- >0;)r+="0"}return r}const Zt={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF|nan|NaN|NAN))$/,resolve:s=>s.slice(-3).toLowerCase()==="nan"?NaN:s[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:D},es={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:s=>parseFloat(s),stringify(s){const e=Number(s.value);return isFinite(e)?e.toExponential():D(s)}},ts={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(s){const e=new N(parseFloat(s)),t=s.indexOf(".");return t!==-1&&s[s.length-1]==="0"&&(e.minFractionDigits=s.length-t-1),e},stringify:D},Je=s=>typeof s=="bigint"||Number.isInteger(s),mt=(s,e,t,{intAsBigInt:n})=>n?BigInt(s):parseInt(s.substring(e),t);function ss(s,e,t){const{value:n}=s;return Je(n)&&n>=0?t+n.toString(e):D(s)}const ns={identify:s=>Je(s)&&s>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(s,e,t)=>mt(s,2,8,t),stringify:s=>ss(s,8,"0o")},is={identify:Je,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(s,e,t)=>mt(s,0,10,t),stringify:D},rs={identify:s=>Je(s)&&s>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(s,e,t)=>mt(s,2,16,t),stringify:s=>ss(s,16,"0x")},Qs=[ue,he,Ve,We,pt,ns,is,rs,Zt,es,ts];function $t(s){return typeof s=="bigint"||Number.isInteger(s)}const Ie=({value:s})=>JSON.stringify(s),Hs=[{identify:s=>typeof s=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:s=>s,stringify:Ie},{identify:s=>s==null,createNode:()=>new N(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Ie},{identify:s=>typeof s=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true|false$/,resolve:s=>s==="true",stringify:Ie},{identify:$t,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(s,e,{intAsBigInt:t})=>t?BigInt(s):parseInt(s,10),stringify:({value:s})=>$t(s)?s.toString():JSON.stringify(s)},{identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:s=>parseFloat(s),stringify:Ie}],xs={default:!0,tag:"",test:/^/,resolve(s,e){return e(`Unresolved plain scalar ${JSON.stringify(s)}`),s}},Xs=[ue,he].concat(Hs,xs),gt={identify:s=>s instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(s,e){if(typeof Buffer=="function")return Buffer.from(s,"base64");if(typeof atob=="function"){const t=atob(s.replace(/[\n\r]/g,"")),n=new Uint8Array(t.length);for(let i=0;i<t.length;++i)n[i]=t.charCodeAt(i);return n}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),s},stringify({comment:s,type:e,value:t},n,i,r){const o=t;let l;if(typeof Buffer=="function")l=o instanceof Buffer?o.toString("base64"):Buffer.from(o.buffer).toString("base64");else if(typeof btoa=="function"){let a="";for(let c=0;c<o.length;++c)a+=String.fromCharCode(o[c]);l=btoa(a)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e||(e=N.BLOCK_LITERAL),e!==N.QUOTE_DOUBLE){const a=Math.max(n.options.lineWidth-n.indent.length,n.options.minContentWidth),c=Math.ceil(l.length/a),u=new Array(c);for(let f=0,h=0;f<c;++f,h+=a)u[f]=l.substr(h,a);l=u.join(e===N.BLOCK_LITERAL?`
48
+ `:" ")}return Ne({comment:s,type:e,value:l},n,i,r)}};function os(s,e){if(fe(s))for(let t=0;t<s.items.length;++t){let n=s.items[t];if(!I(n)){if(z(n)){n.items.length>1&&e("Each pair must have its own sequence indicator");const i=n.items[0]||new $(new N(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore}
49
49
  ${i.key.commentBefore}`:n.commentBefore),n.comment){const r=i.value??i.key;r.comment=r.comment?`${n.comment}
50
- ${r.comment}`:n.comment}n=i}s.items[t]=I(n)?n:new $(n)}}else e("Expected a sequence for this tag");return s}function as(s,e,t){const{replacer:n}=t,i=new Z(s);i.tag="tag:yaml.org,2002:pairs";let r=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof n=="function"&&(o=n.call(e,String(r++),o));let l,a;if(Array.isArray(o))if(o.length===2)l=o[0],a=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){const c=Object.keys(o);if(c.length===1)l=c[0],a=o[l];else throw new TypeError(`Expected { key: value } tuple: ${o}`)}else l=o;i.items.push(pt(l,a,t))}return i}const bt={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:ls,createNode:as};class oe extends Z{constructor(){super(),this.add=j.prototype.add.bind(this),this.delete=j.prototype.delete.bind(this),this.get=j.prototype.get.bind(this),this.has=j.prototype.has.bind(this),this.set=j.prototype.set.bind(this),this.tag=oe.tag}toJSON(e,t){if(!t)return super.toJSON(e);const n=new Map;t?.onCreate&&t.onCreate(n);for(const i of this.items){let r,o;if(I(i)?(r=F(i.key,"",t),o=F(i.value,r,t)):r=F(i,"",t),n.has(r))throw new Error("Ordered maps must not include duplicate keys");n.set(r,o)}return n}}oe.tag="tag:yaml.org,2002:omap";const wt={collection:"seq",identify:s=>s instanceof Map,nodeClass:oe,default:!1,tag:"tag:yaml.org,2002:omap",resolve(s,e){const t=ls(s,e),n=[];for(const{key:i}of t.items)A(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new oe,t)},createNode(s,e,t){const n=as(s,e,t),i=new oe;return i.items=n.items,i}};function cs({value:s,source:e},t){return e&&(s?fs:us).test.test(e)?e:s?t.options.trueStr:t.options.falseStr}const fs={identify:s=>s===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new N(!0),stringify:cs},us={identify:s=>s===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/i,resolve:()=>new N(!1),stringify:cs},en={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?\.(?:inf|Inf|INF|nan|NaN|NAN)$/,resolve:s=>s.slice(-3).toLowerCase()==="nan"?NaN:s[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:D},tn={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:s=>parseFloat(s.replace(/_/g,"")),stringify(s){const e=Number(s.value);return isFinite(e)?e.toExponential():D(s)}},sn={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(s){const e=new N(parseFloat(s.replace(/_/g,""))),t=s.indexOf(".");if(t!==-1){const n=s.substring(t+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:D},Oe=s=>typeof s=="bigint"||Number.isInteger(s);function Ge(s,e,t,{intAsBigInt:n}){const i=s[0];if((i==="-"||i==="+")&&(e+=1),s=s.substring(e).replace(/_/g,""),n){switch(t){case 2:s=`0b${s}`;break;case 8:s=`0o${s}`;break;case 16:s=`0x${s}`;break}const o=BigInt(s);return i==="-"?BigInt(-1)*o:o}const r=parseInt(s,t);return i==="-"?-1*r:r}function St(s,e,t){const{value:n}=s;if(Oe(n)){const i=n.toString(e);return n<0?"-"+t+i.substr(1):t+i}return D(s)}const nn={identify:Oe,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(s,e,t)=>Ge(s,2,2,t),stringify:s=>St(s,2,"0b")},rn={identify:Oe,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(s,e,t)=>Ge(s,1,8,t),stringify:s=>St(s,8,"0")},on={identify:Oe,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(s,e,t)=>Ge(s,0,10,t),stringify:D},ln={identify:Oe,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(s,e,t)=>Ge(s,2,16,t),stringify:s=>St(s,16,"0x")};class le extends j{constructor(e){super(e),this.tag=le.tag}add(e){let t;I(e)?t=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?t=new $(e.key,null):t=new $(e,null),G(this.items,t.key)||this.items.push(t)}get(e,t){const n=G(this.items,e);return!t&&I(n)?A(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);const n=G(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new $(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw new Error("Set items must all have null values")}}le.tag="tag:yaml.org,2002:set";const kt={collection:"map",identify:s=>s instanceof Set,nodeClass:le,default:!1,tag:"tag:yaml.org,2002:set",resolve(s,e){if(z(s)){if(s.hasAllNullValues(!0))return Object.assign(new le,s);e("Set items must all have null values")}else e("Expected a mapping for this tag");return s},createNode(s,e,t){const{replacer:n}=t,i=new le(s);if(e&&Symbol.iterator in Object(e))for(let r of e)typeof n=="function"&&(r=n.call(e,r,r)),i.items.push(pt(r,null,t));return i}};function Nt(s,e){const t=s[0],n=t==="-"||t==="+"?s.substring(1):s,i=o=>e?BigInt(o):Number(o),r=n.replace(/_/g,"").split(":").reduce((o,l)=>o*i(60)+i(l),i(0));return t==="-"?i(-1)*r:r}function hs(s){let{value:e}=s,t=o=>o;if(typeof e=="bigint")t=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return D(s);let n="";e<0&&(n="-",e*=t(-1));const i=t(60),r=[e%i];return e<60?r.unshift(0):(e=(e-r[0])/i,r.unshift(e%i),e>=60&&(e=(e-r[0])/i,r.unshift(e))),n+r.map(o=>o<10?"0"+String(o):String(o)).join(":").replace(/000000\d*$/,"")}const ds={identify:s=>typeof s=="bigint"||Number.isInteger(s),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(s,e,{intAsBigInt:t})=>Nt(s,t),stringify:hs},ps={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:s=>Nt(s,!1),stringify:hs},Qe={identify:s=>s 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(s){const e=s.match(Qe.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");const[,t,n,i,r,o,l]=e.map(Number),a=e[7]?Number((e[7]+"00").substr(1,3)):0;let c=Date.UTC(t,n-1,i,r||0,o||0,l||0,a);const u=e[8];if(u&&u!=="Z"){let f=Nt(u,!1);Math.abs(f)<30&&(f*=60),c-=6e4*f}return new Date(c)},stringify:({value:s})=>s.toISOString().replace(/((T00:00)?:00)?\.000Z$/,"")},_t=[ue,he,We,Je,fs,us,nn,rn,on,ln,en,tn,sn,yt,wt,bt,kt,ds,ps,Qe],vt=new Map([["core",xs],["failsafe",[ue,he,We]],["json",Zs],["yaml11",_t],["yaml-1.1",_t]]),Bt={binary:yt,bool:mt,float:ss,floatExp:ts,floatNaN:es,floatTime:ps,int:rs,intHex:os,intOct:is,intTime:ds,map:ue,null:Je,omap:wt,pairs:bt,seq:he,set:kt,timestamp:Qe},an={"tag:yaml.org,2002:binary":yt,"tag:yaml.org,2002:omap":wt,"tag:yaml.org,2002:pairs":bt,"tag:yaml.org,2002:set":kt,"tag:yaml.org,2002:timestamp":Qe};function et(s,e){let t=vt.get(e);if(!t)if(Array.isArray(s))t=[];else{const n=Array.from(vt.keys()).filter(i=>i!=="yaml11").map(i=>JSON.stringify(i)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${n} or define customTags array`)}if(Array.isArray(s))for(const n of s)t=t.concat(n);else typeof s=="function"&&(t=s(t.slice()));return t.map(n=>{if(typeof n!="string")return n;const i=Bt[n];if(i)return i;const r=Object.keys(Bt).map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown custom tag "${n}"; use one of ${r}`)})}const cn=(s,e)=>s.key<e.key?-1:s.key>e.key?1:0;class He{constructor({compat:e,customTags:t,merge:n,resolveKnownTags:i,schema:r,sortMapEntries:o,toStringDefaults:l}){this.compat=Array.isArray(e)?et(e,"compat"):e?et(null,e):null,this.merge=!!n,this.name=typeof r=="string"&&r||"core",this.knownTags=i?an:{},this.tags=et(t,this.name),this.toStringOptions=l??null,Object.defineProperty(this,W,{value:ue}),Object.defineProperty(this,R,{value:We}),Object.defineProperty(this,ce,{value:he}),this.sortMapEntries=typeof o=="function"?o:o===!0?cn:null}clone(){const e=Object.create(He.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}}function fn(s,e){const t=[];let n=e.directives===!0;if(e.directives!==!1&&s.directives){const a=s.directives.toString(s);a?(t.push(a),n=!0):s.directives.docStart&&(n=!0)}n&&t.push("---");const i=xt(s,e),{commentString:r}=i.options;if(s.commentBefore){t.length!==1&&t.unshift("");const a=r(s.commentBefore);t.unshift(U(a,""))}let o=!1,l=null;if(s.contents){if(T(s.contents)){if(s.contents.spaceBefore&&n&&t.push(""),s.contents.commentBefore){const u=r(s.contents.commentBefore);t.push(U(u,""))}i.forceBlockIndent=!!s.comment,l=s.contents.comment}const a=l?void 0:()=>o=!0;let c=H(s.contents,i,()=>l=null,a);l&&(c+=V(c,"",r(l))),(c[0]==="|"||c[0]===">")&&t[t.length-1]==="---"?t[t.length-1]=`--- ${c}`:t.push(c)}else t.push(H(s.contents,i));if(s.directives?.docEnd)if(s.comment){const a=r(s.comment);a.includes(`
50
+ ${r.comment}`:n.comment}n=i}s.items[t]=I(n)?n:new $(n)}}else e("Expected a sequence for this tag");return s}function ls(s,e,t){const{replacer:n}=t,i=new Z(s);i.tag="tag:yaml.org,2002:pairs";let r=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof n=="function"&&(o=n.call(e,String(r++),o));let l,a;if(Array.isArray(o))if(o.length===2)l=o[0],a=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){const c=Object.keys(o);if(c.length===1)l=c[0],a=o[l];else throw new TypeError(`Expected { key: value } tuple: ${o}`)}else l=o;i.items.push(dt(l,a,t))}return i}const yt={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:os,createNode:ls};class oe extends Z{constructor(){super(),this.add=M.prototype.add.bind(this),this.delete=M.prototype.delete.bind(this),this.get=M.prototype.get.bind(this),this.has=M.prototype.has.bind(this),this.set=M.prototype.set.bind(this),this.tag=oe.tag}toJSON(e,t){if(!t)return super.toJSON(e);const n=new Map;t?.onCreate&&t.onCreate(n);for(const i of this.items){let r,o;if(I(i)?(r=F(i.key,"",t),o=F(i.value,r,t)):r=F(i,"",t),n.has(r))throw new Error("Ordered maps must not include duplicate keys");n.set(r,o)}return n}}oe.tag="tag:yaml.org,2002:omap";const bt={collection:"seq",identify:s=>s instanceof Map,nodeClass:oe,default:!1,tag:"tag:yaml.org,2002:omap",resolve(s,e){const t=os(s,e),n=[];for(const{key:i}of t.items)A(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new oe,t)},createNode(s,e,t){const n=ls(s,e,t),i=new oe;return i.items=n.items,i}};function as({value:s,source:e},t){return e&&(s?cs:fs).test.test(e)?e:s?t.options.trueStr:t.options.falseStr}const cs={identify:s=>s===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new N(!0),stringify:as},fs={identify:s=>s===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/i,resolve:()=>new N(!1),stringify:as},zs={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?\.(?:inf|Inf|INF|nan|NaN|NAN)$/,resolve:s=>s.slice(-3).toLowerCase()==="nan"?NaN:s[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:D},Zs={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:s=>parseFloat(s.replace(/_/g,"")),stringify(s){const e=Number(s.value);return isFinite(e)?e.toExponential():D(s)}},en={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(s){const e=new N(parseFloat(s.replace(/_/g,""))),t=s.indexOf(".");if(t!==-1){const n=s.substring(t+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:D},Oe=s=>typeof s=="bigint"||Number.isInteger(s);function Ye(s,e,t,{intAsBigInt:n}){const i=s[0];if((i==="-"||i==="+")&&(e+=1),s=s.substring(e).replace(/_/g,""),n){switch(t){case 2:s=`0b${s}`;break;case 8:s=`0o${s}`;break;case 16:s=`0x${s}`;break}const o=BigInt(s);return i==="-"?BigInt(-1)*o:o}const r=parseInt(s,t);return i==="-"?-1*r:r}function wt(s,e,t){const{value:n}=s;if(Oe(n)){const i=n.toString(e);return n<0?"-"+t+i.substr(1):t+i}return D(s)}const tn={identify:Oe,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(s,e,t)=>Ye(s,2,2,t),stringify:s=>wt(s,2,"0b")},sn={identify:Oe,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(s,e,t)=>Ye(s,1,8,t),stringify:s=>wt(s,8,"0")},nn={identify:Oe,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(s,e,t)=>Ye(s,0,10,t),stringify:D},rn={identify:Oe,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(s,e,t)=>Ye(s,2,16,t),stringify:s=>wt(s,16,"0x")};class le extends M{constructor(e){super(e),this.tag=le.tag}add(e){let t;I(e)?t=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?t=new $(e.key,null):t=new $(e,null),G(this.items,t.key)||this.items.push(t)}get(e,t){const n=G(this.items,e);return!t&&I(n)?A(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);const n=G(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new $(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw new Error("Set items must all have null values")}}le.tag="tag:yaml.org,2002:set";const St={collection:"map",identify:s=>s instanceof Set,nodeClass:le,default:!1,tag:"tag:yaml.org,2002:set",resolve(s,e){if(z(s)){if(s.hasAllNullValues(!0))return Object.assign(new le,s);e("Set items must all have null values")}else e("Expected a mapping for this tag");return s},createNode(s,e,t){const{replacer:n}=t,i=new le(s);if(e&&Symbol.iterator in Object(e))for(let r of e)typeof n=="function"&&(r=n.call(e,r,r)),i.items.push(dt(r,null,t));return i}};function kt(s,e){const t=s[0],n=t==="-"||t==="+"?s.substring(1):s,i=o=>e?BigInt(o):Number(o),r=n.replace(/_/g,"").split(":").reduce((o,l)=>o*i(60)+i(l),i(0));return t==="-"?i(-1)*r:r}function us(s){let{value:e}=s,t=o=>o;if(typeof e=="bigint")t=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return D(s);let n="";e<0&&(n="-",e*=t(-1));const i=t(60),r=[e%i];return e<60?r.unshift(0):(e=(e-r[0])/i,r.unshift(e%i),e>=60&&(e=(e-r[0])/i,r.unshift(e))),n+r.map(o=>o<10?"0"+String(o):String(o)).join(":").replace(/000000\d*$/,"")}const hs={identify:s=>typeof s=="bigint"||Number.isInteger(s),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(s,e,{intAsBigInt:t})=>kt(s,t),stringify:us},ds={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:s=>kt(s,!1),stringify:us},Ge={identify:s=>s 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(s){const e=s.match(Ge.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");const[,t,n,i,r,o,l]=e.map(Number),a=e[7]?Number((e[7]+"00").substr(1,3)):0;let c=Date.UTC(t,n-1,i,r||0,o||0,l||0,a);const u=e[8];if(u&&u!=="Z"){let f=kt(u,!1);Math.abs(f)<30&&(f*=60),c-=6e4*f}return new Date(c)},stringify:({value:s})=>s.toISOString().replace(/((T00:00)?:00)?\.000Z$/,"")},Ct=[ue,he,Ve,We,cs,fs,tn,sn,nn,rn,zs,Zs,en,gt,bt,yt,St,hs,ds,Ge],vt=new Map([["core",Qs],["failsafe",[ue,he,Ve]],["json",Xs],["yaml11",Ct],["yaml-1.1",Ct]]),_t={binary:gt,bool:pt,float:ts,floatExp:es,floatNaN:Zt,floatTime:ds,int:is,intHex:rs,intOct:ns,intTime:hs,map:ue,null:We,omap:bt,pairs:yt,seq:he,set:St,timestamp:Ge},on={"tag:yaml.org,2002:binary":gt,"tag:yaml.org,2002:omap":bt,"tag:yaml.org,2002:pairs":yt,"tag:yaml.org,2002:set":St,"tag:yaml.org,2002:timestamp":Ge};function et(s,e){let t=vt.get(e);if(!t)if(Array.isArray(s))t=[];else{const n=Array.from(vt.keys()).filter(i=>i!=="yaml11").map(i=>JSON.stringify(i)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${n} or define customTags array`)}if(Array.isArray(s))for(const n of s)t=t.concat(n);else typeof s=="function"&&(t=s(t.slice()));return t.map(n=>{if(typeof n!="string")return n;const i=_t[n];if(i)return i;const r=Object.keys(_t).map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown custom tag "${n}"; use one of ${r}`)})}const ln=(s,e)=>s.key<e.key?-1:s.key>e.key?1:0;class Qe{constructor({compat:e,customTags:t,merge:n,resolveKnownTags:i,schema:r,sortMapEntries:o,toStringDefaults:l}){this.compat=Array.isArray(e)?et(e,"compat"):e?et(null,e):null,this.merge=!!n,this.name=typeof r=="string"&&r||"core",this.knownTags=i?on:{},this.tags=et(t,this.name),this.toStringOptions=l??null,Object.defineProperty(this,W,{value:ue}),Object.defineProperty(this,R,{value:Ve}),Object.defineProperty(this,ce,{value:he}),this.sortMapEntries=typeof o=="function"?o:o===!0?ln:null}clone(){const e=Object.create(Qe.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}}function an(s,e){const t=[];let n=e.directives===!0;if(e.directives!==!1&&s.directives){const a=s.directives.toString(s);a?(t.push(a),n=!0):s.directives.docStart&&(n=!0)}n&&t.push("---");const i=Ht(s,e),{commentString:r}=i.options;if(s.commentBefore){t.length!==1&&t.unshift("");const a=r(s.commentBefore);t.unshift(U(a,""))}let o=!1,l=null;if(s.contents){if(L(s.contents)){if(s.contents.spaceBefore&&n&&t.push(""),s.contents.commentBefore){const u=r(s.contents.commentBefore);t.push(U(u,""))}i.forceBlockIndent=!!s.comment,l=s.contents.comment}const a=l?void 0:()=>o=!0;let c=H(s.contents,i,()=>l=null,a);l&&(c+=V(c,"",r(l))),(c[0]==="|"||c[0]===">")&&t[t.length-1]==="---"?t[t.length-1]=`--- ${c}`:t.push(c)}else t.push(H(s.contents,i));if(s.directives?.docEnd)if(s.comment){const a=r(s.comment);a.includes(`
51
51
  `)?(t.push("..."),t.push(U(a,""))):t.push(`... ${a}`)}else t.push("...");else{let a=s.comment;a&&o&&(a=a.replace(/^\n+/,"")),a&&((!o||l)&&t[t.length-1]!==""&&t.push(""),t.push(U(r(a),"")))}return t.join(`
52
52
  `)+`
53
- `}function ge(s,e,t,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,r=n.length;i<r;++i){const o=n[i],l=ge(s,n,String(i),o);l===void 0?delete n[i]:l!==o&&(n[i]=l)}else if(n instanceof Map)for(const i of Array.from(n.keys())){const r=n.get(i),o=ge(s,n,i,r);o===void 0?n.delete(i):o!==r&&n.set(i,o)}else if(n instanceof Set)for(const i of Array.from(n)){const r=ge(s,n,i,i);r===void 0?n.delete(i):r!==i&&(n.delete(i),n.add(r))}else for(const[i,r]of Object.entries(n)){const o=ge(s,n,i,r);o===void 0?delete n[i]:o!==r&&(n[i]=o)}return s.call(e,t,n)}class de{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,M,{value:lt});let i=null;typeof t=="function"||Array.isArray(t)?i=t:n===void 0&&t&&(n=t,t=void 0);const r=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,uniqueKeys:!0,version:"1.2"},n);this.options=r;let{version:o}=r;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new C({version:o}),this.setSchema(o,n),e===void 0?this.contents=null:this.contents=this.createNode(e,i,n)}clone(){const e=Object.create(de.prototype,{[M]:{value:lt}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=T(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){te(this.contents)&&this.contents.add(e)}addIn(e,t){te(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){const n=Yt(this);e.anchor=!t||n.has(t)?Gt(t||"a",n):t}return new Fe(e.anchor)}createNode(e,t,n){let i;if(typeof t=="function")e=t.call({"":e},"",e),i=t;else if(Array.isArray(t)){const m=w=>typeof w=="number"||w instanceof String||w instanceof Number,b=t.filter(m).map(String);b.length>0&&(t=t.concat(b)),i=t}else n===void 0&&t&&(n=t,t=void 0);const{aliasDuplicateObjects:r,anchorPrefix:o,flow:l,keepUndefined:a,onTagObj:c,tag:u}=n??{},{onAnchor:f,setAnchors:h,sourceObjects:p}=Ms(this,o||"a"),y={aliasDuplicateObjects:r??!0,keepUndefined:a??!1,onAnchor:f,onTagObj:c,replacer:i,schema:this.schema,sourceObjects:p},d=be(e,u,y);return l&&L(d)&&(d.flow=!0),h(),d}createPair(e,t,n={}){const i=this.createNode(e,null,n),r=this.createNode(t,null,n);return new $(i,r)}delete(e){return te(this.contents)?this.contents.delete(e):!1}deleteIn(e){return me(e)?this.contents==null?!1:(this.contents=null,!0):te(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return L(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return me(e)?!t&&A(this.contents)?this.contents.value:this.contents:L(this.contents)?this.contents.getIn(e,t):void 0}has(e){return L(this.contents)?this.contents.has(e):!1}hasIn(e){return me(e)?this.contents!==void 0:L(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=je(this.schema,[e],t):te(this.contents)&&this.contents.set(e,t)}setIn(e,t){me(e)?this.contents=t:this.contents==null?this.contents=je(this.schema,Array.from(e),t):te(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e=="number"&&(e=String(e));let n;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new C({version:"1.1"}),n={merge:!0,resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new C({version:e}),n={merge:!1,resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{const i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(n)this.schema=new He(Object.assign(n,t));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:i,onAnchor:r,reviver:o}={}){const l={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100,stringify:H},a=F(this.contents,t??"",l);if(typeof r=="function")for(const{count:c,res:u}of l.anchors.values())r(u,c);return typeof o=="function"?ge(o,{"":a},"",a):a}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){const t=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${t}`)}return fn(this,e)}}function te(s){if(L(s))return!0;throw new Error("Expected a YAML collection as document contents")}class Ot extends Error{constructor(e,t,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=t}}class Q extends Ot{constructor(e,t,n){super("YAMLParseError",e,t,n)}}class ms extends Ot{constructor(e,t,n){super("YAMLWarning",e,t,n)}}const Pe=(s,e)=>t=>{if(t.pos[0]===-1)return;t.linePos=t.pos.map(l=>e.linePos(l));const{line:n,col:i}=t.linePos[0];t.message+=` at line ${n}, column ${i}`;let r=i-1,o=s.substring(e.lineStarts[n-1],e.lineStarts[n]).replace(/[\n\r]+$/,"");if(r>=60&&o.length>80){const l=Math.min(r-39,o.length-79);o="…"+o.substring(l),r-=l-1}if(o.length>80&&(o=o.substring(0,79)+"…"),n>1&&/^ *$/.test(o.substring(0,r))){let l=s.substring(e.lineStarts[n-2],e.lineStarts[n-1]);l.length>80&&(l=l.substring(0,79)+`…
53
+ `}function ge(s,e,t,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,r=n.length;i<r;++i){const o=n[i],l=ge(s,n,String(i),o);l===void 0?delete n[i]:l!==o&&(n[i]=l)}else if(n instanceof Map)for(const i of Array.from(n.keys())){const r=n.get(i),o=ge(s,n,i,r);o===void 0?n.delete(i):o!==r&&n.set(i,o)}else if(n instanceof Set)for(const i of Array.from(n)){const r=ge(s,n,i,i);r===void 0?n.delete(i):r!==i&&(n.delete(i),n.add(r))}else for(const[i,r]of Object.entries(n)){const o=ge(s,n,i,r);o===void 0?delete n[i]:o!==r&&(n[i]=o)}return s.call(e,t,n)}class de{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,j,{value:ot});let i=null;typeof t=="function"||Array.isArray(t)?i=t:n===void 0&&t&&(n=t,t=void 0);const r=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,uniqueKeys:!0,version:"1.2"},n);this.options=r;let{version:o}=r;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new C({version:o}),this.setSchema(o,n),e===void 0?this.contents=null:this.contents=this.createNode(e,i,n)}clone(){const e=Object.create(de.prototype,{[j]:{value:ot}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=L(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){te(this.contents)&&this.contents.add(e)}addIn(e,t){te(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){const n=Jt(this);e.anchor=!t||n.has(t)?Yt(t||"a",n):t}return new Ke(e.anchor)}createNode(e,t,n){let i;if(typeof t=="function")e=t.call({"":e},"",e),i=t;else if(Array.isArray(t)){const m=w=>typeof w=="number"||w instanceof String||w instanceof Number,b=t.filter(m).map(String);b.length>0&&(t=t.concat(b)),i=t}else n===void 0&&t&&(n=t,t=void 0);const{aliasDuplicateObjects:r,anchorPrefix:o,flow:l,keepUndefined:a,onTagObj:c,tag:u}=n??{},{onAnchor:f,setAnchors:h,sourceObjects:p}=Bs(this,o||"a"),y={aliasDuplicateObjects:r??!0,keepUndefined:a??!1,onAnchor:f,onTagObj:c,replacer:i,schema:this.schema,sourceObjects:p},d=be(e,u,y);return l&&T(d)&&(d.flow=!0),h(),d}createPair(e,t,n={}){const i=this.createNode(e,null,n),r=this.createNode(t,null,n);return new $(i,r)}delete(e){return te(this.contents)?this.contents.delete(e):!1}deleteIn(e){return me(e)?this.contents==null?!1:(this.contents=null,!0):te(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return T(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return me(e)?!t&&A(this.contents)?this.contents.value:this.contents:T(this.contents)?this.contents.getIn(e,t):void 0}has(e){return T(this.contents)?this.contents.has(e):!1}hasIn(e){return me(e)?this.contents!==void 0:T(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=Be(this.schema,[e],t):te(this.contents)&&this.contents.set(e,t)}setIn(e,t){me(e)?this.contents=t:this.contents==null?this.contents=Be(this.schema,Array.from(e),t):te(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e=="number"&&(e=String(e));let n;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new C({version:"1.1"}),n={merge:!0,resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new C({version:e}),n={merge:!1,resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{const i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(n)this.schema=new Qe(Object.assign(n,t));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:i,onAnchor:r,reviver:o}={}){const l={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100,stringify:H},a=F(this.contents,t??"",l);if(typeof r=="function")for(const{count:c,res:u}of l.anchors.values())r(u,c);return typeof o=="function"?ge(o,{"":a},"",a):a}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){const t=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${t}`)}return an(this,e)}}function te(s){if(T(s))return!0;throw new Error("Expected a YAML collection as document contents")}class Nt extends Error{constructor(e,t,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=t}}class Q extends Nt{constructor(e,t,n){super("YAMLParseError",e,t,n)}}class ps extends Nt{constructor(e,t,n){super("YAMLWarning",e,t,n)}}const je=(s,e)=>t=>{if(t.pos[0]===-1)return;t.linePos=t.pos.map(l=>e.linePos(l));const{line:n,col:i}=t.linePos[0];t.message+=` at line ${n}, column ${i}`;let r=i-1,o=s.substring(e.lineStarts[n-1],e.lineStarts[n]).replace(/[\n\r]+$/,"");if(r>=60&&o.length>80){const l=Math.min(r-39,o.length-79);o="…"+o.substring(l),r-=l-1}if(o.length>80&&(o=o.substring(0,79)+"…"),n>1&&/^ *$/.test(o.substring(0,r))){let l=s.substring(e.lineStarts[n-2],e.lineStarts[n-1]);l.length>80&&(l=l.substring(0,79)+`…
54
54
  `),o=l+o}if(/[^ ]/.test(o)){let l=1;const a=t.linePos[1];a&&a.line===n&&a.col>i&&(l=Math.min(a.col-i,80-r));const c=" ".repeat(r)+"^".repeat(l);t.message+=`:
55
55
 
56
56
  ${o}
57
57
  ${c}
58
58
  `}};function ae(s,{flow:e,indicator:t,next:n,offset:i,onError:r,startOnNewline:o}){let l=!1,a=o,c=o,u="",f="",h=!1,p=!1,y=!1,d=null,m=null,b=null,w=null,k=null;for(const g of s)switch(y&&(g.type!=="space"&&g.type!=="newline"&&g.type!=="comma"&&r(g.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),y=!1),g.type){case"space":!e&&a&&t!=="doc-start"&&g.source[0]===" "&&r(g,"TAB_AS_INDENT","Tabs are not allowed as indentation"),c=!0;break;case"comment":{c||r(g,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const E=g.source.substring(1)||" ";u?u+=f+E:u=E,f="",a=!1;break}case"newline":a?u?u+=g.source:l=!0:f+=g.source,a=!0,h=!0,(d||m)&&(p=!0),c=!0;break;case"anchor":d&&r(g,"MULTIPLE_ANCHORS","A node can have at most one anchor"),g.source.endsWith(":")&&r(g.offset+g.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),d=g,k===null&&(k=g.offset),a=!1,c=!1,y=!0;break;case"tag":{m&&r(g,"MULTIPLE_TAGS","A node can have at most one tag"),m=g,k===null&&(k=g.offset),a=!1,c=!1,y=!0;break}case t:(d||m)&&r(g,"BAD_PROP_ORDER",`Anchors and tags must be after the ${g.source} indicator`),w&&r(g,"UNEXPECTED_TOKEN",`Unexpected ${g.source} in ${e??"collection"}`),w=g,a=!1,c=!1;break;case"comma":if(e){b&&r(g,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),b=g,a=!1,c=!1;break}default:r(g,"UNEXPECTED_TOKEN",`Unexpected ${g.type} token`),a=!1,c=!1}const S=s[s.length-1],O=S?S.offset+S.source.length:i;return y&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&r(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),{comma:b,found:w,spaceBefore:l,comment:u,hasNewline:h,hasNewlineAfterProp:p,anchor:d,tag:m,end:O,start:k??O}}function we(s){if(!s)return null;switch(s.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(s.source.includes(`
59
- `))return!0;if(s.end){for(const e of s.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(const e of s.items){for(const t of e.start)if(t.type==="newline")return!0;if(e.sep){for(const t of e.sep)if(t.type==="newline")return!0}if(we(e.key)||we(e.value))return!0}return!1;default:return!0}}function ft(s,e,t){if(e?.type==="flow-collection"){const n=e.end[0];n.indent===s&&(n.source==="]"||n.source==="}")&&we(e)&&t(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function gs(s,e,t){const{uniqueKeys:n}=s.options;if(n===!1)return!1;const i=typeof n=="function"?n:(r,o)=>r===o||A(r)&&A(o)&&r.value===o.value&&!(r.value==="<<"&&s.schema.merge);return e.some(r=>i(r.key,t))}const jt="All mapping items must start at the same column";function un({composeNode:s,composeEmptyNode:e},t,n,i){const r=new j(t.schema);t.atRoot&&(t.atRoot=!1);let o=n.offset,l=null;for(const a of n.items){const{start:c,key:u,sep:f,value:h}=a,p=ae(c,{indicator:"explicit-key-ind",next:u??f?.[0],offset:o,onError:i,startOnNewline:!0}),y=!p.found;if(y){if(u&&(u.type==="block-seq"?i(o,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in u&&u.indent!==n.indent&&i(o,"BAD_INDENT",jt)),!p.anchor&&!p.tag&&!f){l=p.end,p.comment&&(r.comment?r.comment+=`
60
- `+p.comment:r.comment=p.comment);continue}(p.hasNewlineAfterProp||we(u))&&i(u??c[c.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else p.found?.indent!==n.indent&&i(o,"BAD_INDENT",jt);const d=p.end,m=u?s(t,u,p,i):e(t,d,c,null,p,i);t.schema.compat&&ft(n.indent,u,i),gs(t,r.items,m)&&i(d,"DUPLICATE_KEY","Map keys must be unique");const b=ae(f??[],{indicator:"map-value-ind",next:h,offset:m.range[2],onError:i,startOnNewline:!u||u.type==="block-scalar"});if(o=b.end,b.found){y&&(h?.type==="block-map"&&!b.hasNewline&&i(o,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),t.options.strict&&p.start<b.found.offset-1024&&i(m.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));const w=h?s(t,h,b,i):e(t,o,f,null,b,i);t.schema.compat&&ft(n.indent,h,i),o=w.range[2];const k=new $(m,w);t.options.keepSourceTokens&&(k.srcToken=a),r.items.push(k)}else{y&&i(m.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),b.comment&&(m.comment?m.comment+=`
61
- `+b.comment:m.comment=b.comment);const w=new $(m);t.options.keepSourceTokens&&(w.srcToken=a),r.items.push(w)}}return l&&l<o&&i(l,"IMPOSSIBLE","Map comment with trailing content"),r.range=[n.offset,o,l??o],r}function hn({composeNode:s,composeEmptyNode:e},t,n,i){const r=new Z(t.schema);t.atRoot&&(t.atRoot=!1);let o=n.offset,l=null;for(const{start:a,value:c}of n.items){const u=ae(a,{indicator:"seq-item-ind",next:c,offset:o,onError:i,startOnNewline:!0});if(!u.found)if(u.anchor||u.tag||c)c&&c.type==="block-seq"?i(u.end,"BAD_INDENT","All sequence items must start at the same column"):i(o,"MISSING_CHAR","Sequence item without - indicator");else{l=u.end,u.comment&&(r.comment=u.comment);continue}const f=c?s(t,c,u,i):e(t,u.end,a,null,u,i);t.schema.compat&&ft(n.indent,c,i),o=f.range[2],r.items.push(f)}return r.range=[n.offset,o,l??o],r}function Ae(s,e,t,n){let i="";if(s){let r=!1,o="";for(const l of s){const{source:a,type:c}=l;switch(c){case"space":r=!0;break;case"comment":{t&&!r&&n(l,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const u=a.substring(1)||" ";i?i+=o+u:i=u,o="";break}case"newline":i&&(o+=a),r=!0;break;default:n(l,"UNEXPECTED_TOKEN",`Unexpected ${c} at node end`)}e+=a.length}}return{comment:i,offset:e}}const tt="Block collections are not allowed within flow collections",st=s=>s&&(s.type==="block-map"||s.type==="block-seq");function dn({composeNode:s,composeEmptyNode:e},t,n,i){const r=n.start.source==="{",o=r?"flow map":"flow sequence",l=r?new j(t.schema):new Z(t.schema);l.flow=!0;const a=t.atRoot;a&&(t.atRoot=!1);let c=n.offset+n.start.source.length;for(let y=0;y<n.items.length;++y){const d=n.items[y],{start:m,key:b,sep:w,value:k}=d,S=ae(m,{flow:o,indicator:"explicit-key-ind",next:b??w?.[0],offset:c,onError:i,startOnNewline:!1});if(!S.found){if(!S.anchor&&!S.tag&&!w&&!k){y===0&&S.comma?i(S.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${o}`):y<n.items.length-1&&i(S.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${o}`),S.comment&&(l.comment?l.comment+=`
59
+ `))return!0;if(s.end){for(const e of s.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(const e of s.items){for(const t of e.start)if(t.type==="newline")return!0;if(e.sep){for(const t of e.sep)if(t.type==="newline")return!0}if(we(e.key)||we(e.value))return!0}return!1;default:return!0}}function ct(s,e,t){if(e?.type==="flow-collection"){const n=e.end[0];n.indent===s&&(n.source==="]"||n.source==="}")&&we(e)&&t(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function ms(s,e,t){const{uniqueKeys:n}=s.options;if(n===!1)return!1;const i=typeof n=="function"?n:(r,o)=>r===o||A(r)&&A(o)&&r.value===o.value&&!(r.value==="<<"&&s.schema.merge);return e.some(r=>i(r.key,t))}const Bt="All mapping items must start at the same column";function cn({composeNode:s,composeEmptyNode:e},t,n,i){const r=new M(t.schema);t.atRoot&&(t.atRoot=!1);let o=n.offset,l=null;for(const a of n.items){const{start:c,key:u,sep:f,value:h}=a,p=ae(c,{indicator:"explicit-key-ind",next:u??f?.[0],offset:o,onError:i,startOnNewline:!0}),y=!p.found;if(y){if(u&&(u.type==="block-seq"?i(o,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in u&&u.indent!==n.indent&&i(o,"BAD_INDENT",Bt)),!p.anchor&&!p.tag&&!f){l=p.end,p.comment&&(r.comment?r.comment+=`
60
+ `+p.comment:r.comment=p.comment);continue}(p.hasNewlineAfterProp||we(u))&&i(u??c[c.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else p.found?.indent!==n.indent&&i(o,"BAD_INDENT",Bt);const d=p.end,m=u?s(t,u,p,i):e(t,d,c,null,p,i);t.schema.compat&&ct(n.indent,u,i),ms(t,r.items,m)&&i(d,"DUPLICATE_KEY","Map keys must be unique");const b=ae(f??[],{indicator:"map-value-ind",next:h,offset:m.range[2],onError:i,startOnNewline:!u||u.type==="block-scalar"});if(o=b.end,b.found){y&&(h?.type==="block-map"&&!b.hasNewline&&i(o,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),t.options.strict&&p.start<b.found.offset-1024&&i(m.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));const w=h?s(t,h,b,i):e(t,o,f,null,b,i);t.schema.compat&&ct(n.indent,h,i),o=w.range[2];const k=new $(m,w);t.options.keepSourceTokens&&(k.srcToken=a),r.items.push(k)}else{y&&i(m.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),b.comment&&(m.comment?m.comment+=`
61
+ `+b.comment:m.comment=b.comment);const w=new $(m);t.options.keepSourceTokens&&(w.srcToken=a),r.items.push(w)}}return l&&l<o&&i(l,"IMPOSSIBLE","Map comment with trailing content"),r.range=[n.offset,o,l??o],r}function fn({composeNode:s,composeEmptyNode:e},t,n,i){const r=new Z(t.schema);t.atRoot&&(t.atRoot=!1);let o=n.offset,l=null;for(const{start:a,value:c}of n.items){const u=ae(a,{indicator:"seq-item-ind",next:c,offset:o,onError:i,startOnNewline:!0});if(!u.found)if(u.anchor||u.tag||c)c&&c.type==="block-seq"?i(u.end,"BAD_INDENT","All sequence items must start at the same column"):i(o,"MISSING_CHAR","Sequence item without - indicator");else{l=u.end,u.comment&&(r.comment=u.comment);continue}const f=c?s(t,c,u,i):e(t,u.end,a,null,u,i);t.schema.compat&&ct(n.indent,c,i),o=f.range[2],r.items.push(f)}return r.range=[n.offset,o,l??o],r}function Ae(s,e,t,n){let i="";if(s){let r=!1,o="";for(const l of s){const{source:a,type:c}=l;switch(c){case"space":r=!0;break;case"comment":{t&&!r&&n(l,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const u=a.substring(1)||" ";i?i+=o+u:i=u,o="";break}case"newline":i&&(o+=a),r=!0;break;default:n(l,"UNEXPECTED_TOKEN",`Unexpected ${c} at node end`)}e+=a.length}}return{comment:i,offset:e}}const tt="Block collections are not allowed within flow collections",st=s=>s&&(s.type==="block-map"||s.type==="block-seq");function un({composeNode:s,composeEmptyNode:e},t,n,i){const r=n.start.source==="{",o=r?"flow map":"flow sequence",l=r?new M(t.schema):new Z(t.schema);l.flow=!0;const a=t.atRoot;a&&(t.atRoot=!1);let c=n.offset+n.start.source.length;for(let y=0;y<n.items.length;++y){const d=n.items[y],{start:m,key:b,sep:w,value:k}=d,S=ae(m,{flow:o,indicator:"explicit-key-ind",next:b??w?.[0],offset:c,onError:i,startOnNewline:!1});if(!S.found){if(!S.anchor&&!S.tag&&!w&&!k){y===0&&S.comma?i(S.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${o}`):y<n.items.length-1&&i(S.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${o}`),S.comment&&(l.comment?l.comment+=`
62
62
  `+S.comment:l.comment=S.comment),c=S.end;continue}!r&&t.options.strict&&we(b)&&i(b,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(y===0)S.comma&&i(S.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${o}`);else if(S.comma||i(S.start,"MISSING_CHAR",`Missing , between ${o} items`),S.comment){let O="";e:for(const g of m)switch(g.type){case"comma":case"space":break;case"comment":O=g.source.substring(1);break e;default:break e}if(O){let g=l.items[l.items.length-1];I(g)&&(g=g.value??g.key),g.comment?g.comment+=`
63
- `+O:g.comment=O,S.comment=S.comment.substring(O.length+1)}}if(!r&&!w&&!S.found){const O=k?s(t,k,S,i):e(t,S.end,w,null,S,i);l.items.push(O),c=O.range[2],st(k)&&i(O.range,"BLOCK_IN_FLOW",tt)}else{const O=S.end,g=b?s(t,b,S,i):e(t,O,m,null,S,i);st(b)&&i(g.range,"BLOCK_IN_FLOW",tt);const E=ae(w??[],{flow:o,indicator:"map-value-ind",next:k,offset:g.range[2],onError:i,startOnNewline:!1});if(E.found){if(!r&&!S.found&&t.options.strict){if(w)for(const v of w){if(v===E.found)break;if(v.type==="newline"){i(v,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}S.start<E.found.offset-1024&&i(E.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else k&&("source"in k&&k.source&&k.source[0]===":"?i(k,"MISSING_CHAR",`Missing space after : in ${o}`):i(E.start,"MISSING_CHAR",`Missing , or : between ${o} items`));const q=k?s(t,k,E,i):E.found?e(t,E.end,w,null,E,i):null;q?st(k)&&i(q.range,"BLOCK_IN_FLOW",tt):E.comment&&(g.comment?g.comment+=`
64
- `+E.comment:g.comment=E.comment);const ee=new $(g,q);if(t.options.keepSourceTokens&&(ee.srcToken=d),r){const v=l;gs(t,v.items,g)&&i(O,"DUPLICATE_KEY","Map keys must be unique"),v.items.push(ee)}else{const v=new j(t.schema);v.flow=!0,v.items.push(ee),l.items.push(v)}c=q?q.range[2]:E.end}}const u=r?"}":"]",[f,...h]=n.end;let p=c;if(f&&f.source===u)p=f.offset+f.source.length;else{const y=o[0].toUpperCase()+o.substring(1),d=a?`${y} must end with a ${u}`:`${y} in block collection must be sufficiently indented and end with a ${u}`;i(c,a?"MISSING_CHAR":"BAD_INDENT",d),f&&f.source.length!==1&&h.unshift(f)}if(h.length>0){const y=Ae(h,p,t.options.strict,i);y.comment&&(l.comment?l.comment+=`
65
- `+y.comment:l.comment=y.comment),l.range=[n.offset,p,y.offset]}else l.range=[n.offset,p,p];return l}function pn(s,e,t,n,i){let r;switch(t.type){case"block-map":{r=un(s,e,t,i);break}case"block-seq":{r=hn(s,e,t,i);break}case"flow-collection":{r=dn(s,e,t,i);break}}if(!n)return r;const o=e.directives.tagName(n.source,h=>i(n,"TAG_RESOLVE_FAILED",h));if(!o)return r;const l=r.constructor;if(o==="!"||o===l.tagName)return r.tag=l.tagName,r;const a=z(r)?"map":"seq";let c=e.schema.tags.find(h=>h.collection===a&&h.tag===o);if(!c){const h=e.schema.knownTags[o];if(h&&h.collection===a)e.schema.tags.push(Object.assign({},h,{default:!1})),c=h;else return i(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),r.tag=o,r}const u=c.resolve(r,h=>i(n,"TAG_RESOLVE_FAILED",h),e.options),f=T(u)?u:new N(u);return f.range=r.range,f.tag=o,c?.format&&(f.format=c.format),f}function ys(s,e,t){const n=s.offset,i=mn(s,e,t);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};const r=i.mode===">"?N.BLOCK_FOLDED:N.BLOCK_LITERAL,o=s.source?gn(s.source):[];let l=o.length;for(let d=o.length-1;d>=0;--d){const m=o[d][1];if(m===""||m==="\r")l=d;else break}if(l===0){const d=i.chomp==="+"&&o.length>0?`
63
+ `+O:g.comment=O,S.comment=S.comment.substring(O.length+1)}}if(!r&&!w&&!S.found){const O=k?s(t,k,S,i):e(t,S.end,w,null,S,i);l.items.push(O),c=O.range[2],st(k)&&i(O.range,"BLOCK_IN_FLOW",tt)}else{const O=S.end,g=b?s(t,b,S,i):e(t,O,m,null,S,i);st(b)&&i(g.range,"BLOCK_IN_FLOW",tt);const E=ae(w??[],{flow:o,indicator:"map-value-ind",next:k,offset:g.range[2],onError:i,startOnNewline:!1});if(E.found){if(!r&&!S.found&&t.options.strict){if(w)for(const _ of w){if(_===E.found)break;if(_.type==="newline"){i(_,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}S.start<E.found.offset-1024&&i(E.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else k&&("source"in k&&k.source&&k.source[0]===":"?i(k,"MISSING_CHAR",`Missing space after : in ${o}`):i(E.start,"MISSING_CHAR",`Missing , or : between ${o} items`));const q=k?s(t,k,E,i):E.found?e(t,E.end,w,null,E,i):null;q?st(k)&&i(q.range,"BLOCK_IN_FLOW",tt):E.comment&&(g.comment?g.comment+=`
64
+ `+E.comment:g.comment=E.comment);const ee=new $(g,q);if(t.options.keepSourceTokens&&(ee.srcToken=d),r){const _=l;ms(t,_.items,g)&&i(O,"DUPLICATE_KEY","Map keys must be unique"),_.items.push(ee)}else{const _=new M(t.schema);_.flow=!0,_.items.push(ee),l.items.push(_)}c=q?q.range[2]:E.end}}const u=r?"}":"]",[f,...h]=n.end;let p=c;if(f&&f.source===u)p=f.offset+f.source.length;else{const y=o[0].toUpperCase()+o.substring(1),d=a?`${y} must end with a ${u}`:`${y} in block collection must be sufficiently indented and end with a ${u}`;i(c,a?"MISSING_CHAR":"BAD_INDENT",d),f&&f.source.length!==1&&h.unshift(f)}if(h.length>0){const y=Ae(h,p,t.options.strict,i);y.comment&&(l.comment?l.comment+=`
65
+ `+y.comment:l.comment=y.comment),l.range=[n.offset,p,y.offset]}else l.range=[n.offset,p,p];return l}function hn(s,e,t,n,i){let r;switch(t.type){case"block-map":{r=cn(s,e,t,i);break}case"block-seq":{r=fn(s,e,t,i);break}case"flow-collection":{r=un(s,e,t,i);break}}if(!n)return r;const o=e.directives.tagName(n.source,h=>i(n,"TAG_RESOLVE_FAILED",h));if(!o)return r;const l=r.constructor;if(o==="!"||o===l.tagName)return r.tag=l.tagName,r;const a=z(r)?"map":"seq";let c=e.schema.tags.find(h=>h.collection===a&&h.tag===o);if(!c){const h=e.schema.knownTags[o];if(h&&h.collection===a)e.schema.tags.push(Object.assign({},h,{default:!1})),c=h;else return i(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),r.tag=o,r}const u=c.resolve(r,h=>i(n,"TAG_RESOLVE_FAILED",h),e.options),f=L(u)?u:new N(u);return f.range=r.range,f.tag=o,c?.format&&(f.format=c.format),f}function gs(s,e,t){const n=s.offset,i=dn(s,e,t);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};const r=i.mode===">"?N.BLOCK_FOLDED:N.BLOCK_LITERAL,o=s.source?pn(s.source):[];let l=o.length;for(let d=o.length-1;d>=0;--d){const m=o[d][1];if(m===""||m==="\r")l=d;else break}if(l===0){const d=i.chomp==="+"&&o.length>0?`
66
66
  `.repeat(Math.max(1,o.length-1)):"";let m=n+i.length;return s.source&&(m+=s.source.length),{value:d,type:r,comment:i.comment,range:[n,m,m]}}let a=s.indent+i.indent,c=s.offset+i.length,u=0;for(let d=0;d<l;++d){const[m,b]=o[d];if(b===""||b==="\r")i.indent===0&&m.length>a&&(a=m.length);else{if(m.length<a){const w="Block scalars with more-indented leading empty lines must use an explicit indentation indicator";t(c+m.length,"MISSING_CHAR",w)}i.indent===0&&(a=m.length),u=d;break}c+=m.length+b.length+1}for(let d=o.length-1;d>=l;--d)o[d][0].length>a&&(l=d+1);let f="",h="",p=!1;for(let d=0;d<u;++d)f+=o[d][0].slice(a)+`
67
67
  `;for(let d=u;d<l;++d){let[m,b]=o[d];c+=m.length+b.length+1;const w=b[b.length-1]==="\r";if(w&&(b=b.slice(0,-1)),b&&m.length<a){const S=`Block scalar lines must not be less indented than their ${i.indent?"explicit indentation indicator":"first line"}`;t(c-b.length-(w?2:1),"BAD_INDENT",S),m=""}r===N.BLOCK_LITERAL?(f+=h+m.slice(a)+b,h=`
68
68
  `):m.length>a||b[0]===" "?(h===" "?h=`
@@ -77,46 +77,46 @@ ${c}
77
77
  `+o[d][0].slice(a);f[f.length-1]!==`
78
78
  `&&(f+=`
79
79
  `);break;default:f+=`
80
- `}const y=n+i.length+s.source.length;return{value:f,type:r,comment:i.comment,range:[n,y,y]}}function mn({offset:s,props:e},t,n){if(e[0].type!=="block-scalar-header")return n(e[0],"IMPOSSIBLE","Block scalar header not found"),null;const{source:i}=e[0],r=i[0];let o=0,l="",a=-1;for(let h=1;h<i.length;++h){const p=i[h];if(!l&&(p==="-"||p==="+"))l=p;else{const y=Number(p);!o&&y?o=y:a===-1&&(a=s+h)}}a!==-1&&n(a,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let c=!1,u="",f=i.length;for(let h=1;h<e.length;++h){const p=e[h];switch(p.type){case"space":c=!0;case"newline":f+=p.source.length;break;case"comment":t&&!c&&n(p,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),f+=p.source.length,u=p.source.substring(1);break;case"error":n(p,"UNEXPECTED_TOKEN",p.message),f+=p.source.length;break;default:{const y=`Unexpected token in block scalar header: ${p.type}`;n(p,"UNEXPECTED_TOKEN",y);const d=p.source;d&&typeof d=="string"&&(f+=d.length)}}}return{mode:r,indent:o,chomp:l,comment:u,length:f}}function gn(s){const e=s.split(/\n( *)/),t=e[0],n=t.match(/^( *)/),r=[n?.[1]?[n[1],t.slice(n[1].length)]:["",t]];for(let o=1;o<e.length;o+=2)r.push([e[o],e[o+1]]);return r}function bs(s,e,t){const{offset:n,type:i,source:r,end:o}=s;let l,a;const c=(h,p,y)=>t(n+h,p,y);switch(i){case"scalar":l=N.PLAIN,a=yn(r,c);break;case"single-quoted-scalar":l=N.QUOTE_SINGLE,a=bn(r,c);break;case"double-quoted-scalar":l=N.QUOTE_DOUBLE,a=wn(r,c);break;default:return t(s,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[n,n+r.length,n+r.length]}}const u=n+r.length,f=Ae(o,u,e,t);return{value:a,type:l,comment:f.comment,range:[n,u,f.offset]}}function yn(s,e){let t="";switch(s[0]){case" ":t="a tab character";break;case",":t="flow indicator character ,";break;case"%":t="directive indicator character %";break;case"|":case">":{t=`block scalar indicator ${s[0]}`;break}case"@":case"`":{t=`reserved character ${s[0]}`;break}}return t&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${t}`),ws(s)}function bn(s,e){return(s[s.length-1]!=="'"||s.length===1)&&e(s.length,"MISSING_CHAR","Missing closing 'quote"),ws(s.slice(1,-1)).replace(/''/g,"'")}function ws(s){let e,t;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
80
+ `}const y=n+i.length+s.source.length;return{value:f,type:r,comment:i.comment,range:[n,y,y]}}function dn({offset:s,props:e},t,n){if(e[0].type!=="block-scalar-header")return n(e[0],"IMPOSSIBLE","Block scalar header not found"),null;const{source:i}=e[0],r=i[0];let o=0,l="",a=-1;for(let h=1;h<i.length;++h){const p=i[h];if(!l&&(p==="-"||p==="+"))l=p;else{const y=Number(p);!o&&y?o=y:a===-1&&(a=s+h)}}a!==-1&&n(a,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let c=!1,u="",f=i.length;for(let h=1;h<e.length;++h){const p=e[h];switch(p.type){case"space":c=!0;case"newline":f+=p.source.length;break;case"comment":t&&!c&&n(p,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),f+=p.source.length,u=p.source.substring(1);break;case"error":n(p,"UNEXPECTED_TOKEN",p.message),f+=p.source.length;break;default:{const y=`Unexpected token in block scalar header: ${p.type}`;n(p,"UNEXPECTED_TOKEN",y);const d=p.source;d&&typeof d=="string"&&(f+=d.length)}}}return{mode:r,indent:o,chomp:l,comment:u,length:f}}function pn(s){const e=s.split(/\n( *)/),t=e[0],n=t.match(/^( *)/),r=[n?.[1]?[n[1],t.slice(n[1].length)]:["",t]];for(let o=1;o<e.length;o+=2)r.push([e[o],e[o+1]]);return r}function ys(s,e,t){const{offset:n,type:i,source:r,end:o}=s;let l,a;const c=(h,p,y)=>t(n+h,p,y);switch(i){case"scalar":l=N.PLAIN,a=mn(r,c);break;case"single-quoted-scalar":l=N.QUOTE_SINGLE,a=gn(r,c);break;case"double-quoted-scalar":l=N.QUOTE_DOUBLE,a=yn(r,c);break;default:return t(s,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[n,n+r.length,n+r.length]}}const u=n+r.length,f=Ae(o,u,e,t);return{value:a,type:l,comment:f.comment,range:[n,u,f.offset]}}function mn(s,e){let t="";switch(s[0]){case" ":t="a tab character";break;case",":t="flow indicator character ,";break;case"%":t="directive indicator character %";break;case"|":case">":{t=`block scalar indicator ${s[0]}`;break}case"@":case"`":{t=`reserved character ${s[0]}`;break}}return t&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${t}`),bs(s)}function gn(s,e){return(s[s.length-1]!=="'"||s.length===1)&&e(s.length,"MISSING_CHAR","Missing closing 'quote"),bs(s.slice(1,-1)).replace(/''/g,"'")}function bs(s){let e,t;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
81
81
  `,"sy"),t=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
82
82
  `,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,t=/[ \t]*(.*?)[ \t]*\r?\n/sy}let n=e.exec(s);if(!n)return s;let i=n[1],r=" ",o=e.lastIndex;for(t.lastIndex=o;n=t.exec(s);)n[1]===""?r===`
83
83
  `?i+=r:r=`
84
- `:(i+=r+n[1],r=" "),o=t.lastIndex;const l=/[ \t]*(.*)/sy;return l.lastIndex=o,n=l.exec(s),i+r+(n?.[1]??"")}function wn(s,e){let t="";for(let n=1;n<s.length-1;++n){const i=s[n];if(!(i==="\r"&&s[n+1]===`
84
+ `:(i+=r+n[1],r=" "),o=t.lastIndex;const l=/[ \t]*(.*)/sy;return l.lastIndex=o,n=l.exec(s),i+r+(n?.[1]??"")}function yn(s,e){let t="";for(let n=1;n<s.length-1;++n){const i=s[n];if(!(i==="\r"&&s[n+1]===`
85
85
  `))if(i===`
86
- `){const{fold:r,offset:o}=Sn(s,n);t+=r,n=o}else if(i==="\\"){let r=s[++n];const o=kn[r];if(o)t+=o;else if(r===`
86
+ `){const{fold:r,offset:o}=bn(s,n);t+=r,n=o}else if(i==="\\"){let r=s[++n];const o=wn[r];if(o)t+=o;else if(r===`
87
87
  `)for(r=s[n+1];r===" "||r===" ";)r=s[++n+1];else if(r==="\r"&&s[n+1]===`
88
- `)for(r=s[++n+1];r===" "||r===" ";)r=s[++n+1];else if(r==="x"||r==="u"||r==="U"){const l={x:2,u:4,U:8}[r];t+=Nn(s,n+1,l,e),n+=l}else{const l=s.substr(n-1,2);e(n-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${l}`),t+=l}}else if(i===" "||i===" "){const r=n;let o=s[n+1];for(;o===" "||o===" ";)o=s[++n+1];o!==`
88
+ `)for(r=s[++n+1];r===" "||r===" ";)r=s[++n+1];else if(r==="x"||r==="u"||r==="U"){const l={x:2,u:4,U:8}[r];t+=Sn(s,n+1,l,e),n+=l}else{const l=s.substr(n-1,2);e(n-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${l}`),t+=l}}else if(i===" "||i===" "){const r=n;let o=s[n+1];for(;o===" "||o===" ";)o=s[++n+1];o!==`
89
89
  `&&!(o==="\r"&&s[n+2]===`
90
- `)&&(t+=n>r?s.slice(r,n+1):i)}else t+=i}return(s[s.length-1]!=='"'||s.length===1)&&e(s.length,"MISSING_CHAR",'Missing closing "quote'),t}function Sn(s,e){let t="",n=s[e+1];for(;(n===" "||n===" "||n===`
90
+ `)&&(t+=n>r?s.slice(r,n+1):i)}else t+=i}return(s[s.length-1]!=='"'||s.length===1)&&e(s.length,"MISSING_CHAR",'Missing closing "quote'),t}function bn(s,e){let t="",n=s[e+1];for(;(n===" "||n===" "||n===`
91
91
  `||n==="\r")&&!(n==="\r"&&s[e+2]!==`
92
92
  `);)n===`
93
93
  `&&(t+=`
94
- `),e+=1,n=s[e+1];return t||(t=" "),{fold:t,offset:e}}const kn={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
95
- `,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Nn(s,e,t,n){const i=s.substr(e,t),o=i.length===t&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;if(isNaN(o)){const l=s.substr(e-2,t+2);return n(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${l}`),l}return String.fromCodePoint(o)}function Ss(s,e,t,n){const{value:i,type:r,comment:o,range:l}=e.type==="block-scalar"?ys(e,s.options.strict,n):bs(e,s.options.strict,n),a=t?s.directives.tagName(t.source,f=>n(t,"TAG_RESOLVE_FAILED",f)):null,c=t&&a?On(s.schema,i,a,t,n):e.type==="scalar"?An(s,i,e,n):s.schema[R];let u;try{const f=c.resolve(i,h=>n(t??e,"TAG_RESOLVE_FAILED",h),s.options);u=A(f)?f:new N(f)}catch(f){const h=f instanceof Error?f.message:String(f);n(t??e,"TAG_RESOLVE_FAILED",h),u=new N(i)}return u.range=l,u.source=i,r&&(u.type=r),a&&(u.tag=a),c.format&&(u.format=c.format),o&&(u.comment=o),u}function On(s,e,t,n,i){if(t==="!")return s[R];const r=[];for(const l of s.tags)if(!l.collection&&l.tag===t)if(l.default&&l.test)r.push(l);else return l;for(const l of r)if(l.test?.test(e))return l;const o=s.knownTags[t];return o&&!o.collection?(s.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(i(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${t}`,t!=="tag:yaml.org,2002:str"),s[R])}function An({directives:s,schema:e},t,n,i){const r=e.tags.find(o=>o.default&&o.test?.test(t))||e[R];if(e.compat){const o=e.compat.find(l=>l.default&&l.test?.test(t))??e[R];if(r.tag!==o.tag){const l=s.tagString(r.tag),a=s.tagString(o.tag),c=`Value may be parsed as either ${l} or ${a}`;i(n,"TAG_RESOLVE_FAILED",c,!0)}}return r}function En(s,e,t){if(e){t===null&&(t=e.length);for(let n=t-1;n>=0;--n){let i=e[n];switch(i.type){case"space":case"comment":case"newline":s-=i.source.length;continue}for(i=e[++n];i?.type==="space";)s+=i.source.length,i=e[++n];break}}return s}const In={composeNode:ks,composeEmptyNode:At};function ks(s,e,t,n){const{spaceBefore:i,comment:r,anchor:o,tag:l}=t;let a,c=!0;switch(e.type){case"alias":a=Ln(s,e,n),(o||l)&&n(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":a=Ss(s,e,l,n),o&&(a.anchor=o.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":a=pn(In,s,e,l,n),o&&(a.anchor=o.source.substring(1));break;default:{const u=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;n(e,"UNEXPECTED_TOKEN",u),a=At(s,e.offset,void 0,null,t,n),c=!1}}return o&&a.anchor===""&&n(o,"BAD_ALIAS","Anchor cannot be an empty string"),i&&(a.spaceBefore=!0),r&&(e.type==="scalar"&&e.source===""?a.comment=r:a.commentBefore=r),s.options.keepSourceTokens&&c&&(a.srcToken=e),a}function At(s,e,t,n,{spaceBefore:i,comment:r,anchor:o,tag:l,end:a},c){const u={type:"scalar",offset:En(e,t,n),indent:-1,source:""},f=Ss(s,u,l,c);return o&&(f.anchor=o.source.substring(1),f.anchor===""&&c(o,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(f.spaceBefore=!0),r&&(f.comment=r,f.range[2]=a),f}function Ln({options:s},{offset:e,source:t,end:n},i){const r=new Fe(t.substring(1));r.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),r.source.endsWith(":")&&i(e+t.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);const o=e+t.length,l=Ae(n,o,s.strict,i);return r.range=[e,o,l.offset],l.comment&&(r.comment=l.comment),r}function Tn(s,e,{offset:t,start:n,value:i,end:r},o){const l=Object.assign({_directives:e},s),a=new de(void 0,l),c={atRoot:!0,directives:a.directives,options:a.options,schema:a.schema},u=ae(n,{indicator:"doc-start",next:i??r?.[0],offset:t,onError:o,startOnNewline:!0});u.found&&(a.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!u.hasNewline&&o(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),a.contents=i?ks(c,i,u,o):At(c,u.end,n,null,u,o);const f=a.contents.range[2],h=Ae(r,f,!1,o);return h.comment&&(a.comment=h.comment),a.range=[t,f,h.offset],a}function pe(s){if(typeof s=="number")return[s,s+1];if(Array.isArray(s))return s.length===2?s:[s[0],s[1]];const{offset:e,source:t}=s;return[e,e+(typeof t=="string"?t.length:1)]}function Mt(s){let e="",t=!1,n=!1;for(let i=0;i<s.length;++i){const r=s[i];switch(r[0]){case"#":e+=(e===""?"":n?`
94
+ `),e+=1,n=s[e+1];return t||(t=" "),{fold:t,offset:e}}const wn={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
95
+ `,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Sn(s,e,t,n){const i=s.substr(e,t),o=i.length===t&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;if(isNaN(o)){const l=s.substr(e-2,t+2);return n(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${l}`),l}return String.fromCodePoint(o)}function ws(s,e,t,n){const{value:i,type:r,comment:o,range:l}=e.type==="block-scalar"?gs(e,s.options.strict,n):ys(e,s.options.strict,n),a=t?s.directives.tagName(t.source,f=>n(t,"TAG_RESOLVE_FAILED",f)):null,c=t&&a?kn(s.schema,i,a,t,n):e.type==="scalar"?Nn(s,i,e,n):s.schema[R];let u;try{const f=c.resolve(i,h=>n(t??e,"TAG_RESOLVE_FAILED",h),s.options);u=A(f)?f:new N(f)}catch(f){const h=f instanceof Error?f.message:String(f);n(t??e,"TAG_RESOLVE_FAILED",h),u=new N(i)}return u.range=l,u.source=i,r&&(u.type=r),a&&(u.tag=a),c.format&&(u.format=c.format),o&&(u.comment=o),u}function kn(s,e,t,n,i){if(t==="!")return s[R];const r=[];for(const l of s.tags)if(!l.collection&&l.tag===t)if(l.default&&l.test)r.push(l);else return l;for(const l of r)if(l.test?.test(e))return l;const o=s.knownTags[t];return o&&!o.collection?(s.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(i(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${t}`,t!=="tag:yaml.org,2002:str"),s[R])}function Nn({directives:s,schema:e},t,n,i){const r=e.tags.find(o=>o.default&&o.test?.test(t))||e[R];if(e.compat){const o=e.compat.find(l=>l.default&&l.test?.test(t))??e[R];if(r.tag!==o.tag){const l=s.tagString(r.tag),a=s.tagString(o.tag),c=`Value may be parsed as either ${l} or ${a}`;i(n,"TAG_RESOLVE_FAILED",c,!0)}}return r}function On(s,e,t){if(e){t===null&&(t=e.length);for(let n=t-1;n>=0;--n){let i=e[n];switch(i.type){case"space":case"comment":case"newline":s-=i.source.length;continue}for(i=e[++n];i?.type==="space";)s+=i.source.length,i=e[++n];break}}return s}const An={composeNode:Ss,composeEmptyNode:Ot};function Ss(s,e,t,n){const{spaceBefore:i,comment:r,anchor:o,tag:l}=t;let a,c=!0;switch(e.type){case"alias":a=En(s,e,n),(o||l)&&n(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":a=ws(s,e,l,n),o&&(a.anchor=o.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":a=hn(An,s,e,l,n),o&&(a.anchor=o.source.substring(1));break;default:{const u=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;n(e,"UNEXPECTED_TOKEN",u),a=Ot(s,e.offset,void 0,null,t,n),c=!1}}return o&&a.anchor===""&&n(o,"BAD_ALIAS","Anchor cannot be an empty string"),i&&(a.spaceBefore=!0),r&&(e.type==="scalar"&&e.source===""?a.comment=r:a.commentBefore=r),s.options.keepSourceTokens&&c&&(a.srcToken=e),a}function Ot(s,e,t,n,{spaceBefore:i,comment:r,anchor:o,tag:l,end:a},c){const u={type:"scalar",offset:On(e,t,n),indent:-1,source:""},f=ws(s,u,l,c);return o&&(f.anchor=o.source.substring(1),f.anchor===""&&c(o,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(f.spaceBefore=!0),r&&(f.comment=r,f.range[2]=a),f}function En({options:s},{offset:e,source:t,end:n},i){const r=new Ke(t.substring(1));r.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),r.source.endsWith(":")&&i(e+t.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);const o=e+t.length,l=Ae(n,o,s.strict,i);return r.range=[e,o,l.offset],l.comment&&(r.comment=l.comment),r}function In(s,e,{offset:t,start:n,value:i,end:r},o){const l=Object.assign({_directives:e},s),a=new de(void 0,l),c={atRoot:!0,directives:a.directives,options:a.options,schema:a.schema},u=ae(n,{indicator:"doc-start",next:i??r?.[0],offset:t,onError:o,startOnNewline:!0});u.found&&(a.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!u.hasNewline&&o(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),a.contents=i?Ss(c,i,u,o):Ot(c,u.end,n,null,u,o);const f=a.contents.range[2],h=Ae(r,f,!1,o);return h.comment&&(a.comment=h.comment),a.range=[t,f,h.offset],a}function pe(s){if(typeof s=="number")return[s,s+1];if(Array.isArray(s))return s.length===2?s:[s[0],s[1]];const{offset:e,source:t}=s;return[e,e+(typeof t=="string"?t.length:1)]}function Mt(s){let e="",t=!1,n=!1;for(let i=0;i<s.length;++i){const r=s[i];switch(r[0]){case"#":e+=(e===""?"":n?`
96
96
 
97
97
  `:`
98
- `)+(r.substring(1)||" "),t=!0,n=!1;break;case"%":s[i+1]?.[0]!=="#"&&(i+=1),t=!1;break;default:t||(n=!0),t=!1}}return{comment:e,afterEmptyLine:n}}class Et{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(t,n,i,r)=>{const o=pe(t);r?this.warnings.push(new ms(o,n,i)):this.errors.push(new Q(o,n,i))},this.directives=new C({version:e.version||"1.2"}),this.options=e}decorate(e,t){const{comment:n,afterEmptyLine:i}=Mt(this.prelude);if(n){const r=e.contents;if(t)e.comment=e.comment?`${e.comment}
99
- ${n}`:n;else if(i||e.directives.docStart||!r)e.commentBefore=n;else if(L(r)&&!r.flow&&r.items.length>0){let o=r.items[0];I(o)&&(o=o.key);const l=o.commentBefore;o.commentBefore=l?`${n}
98
+ `)+(r.substring(1)||" "),t=!0,n=!1;break;case"%":s[i+1]?.[0]!=="#"&&(i+=1),t=!1;break;default:t||(n=!0),t=!1}}return{comment:e,afterEmptyLine:n}}class At{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(t,n,i,r)=>{const o=pe(t);r?this.warnings.push(new ps(o,n,i)):this.errors.push(new Q(o,n,i))},this.directives=new C({version:e.version||"1.2"}),this.options=e}decorate(e,t){const{comment:n,afterEmptyLine:i}=Mt(this.prelude);if(n){const r=e.contents;if(t)e.comment=e.comment?`${e.comment}
99
+ ${n}`:n;else if(i||e.directives.docStart||!r)e.commentBefore=n;else if(T(r)&&!r.flow&&r.items.length>0){let o=r.items[0];I(o)&&(o=o.key);const l=o.commentBefore;o.commentBefore=l?`${n}
100
100
  ${l}`:n}else{const o=r.commentBefore;r.commentBefore=o?`${n}
101
- ${o}`:n}}t?(Array.prototype.push.apply(e.errors,this.errors),Array.prototype.push.apply(e.warnings,this.warnings)):(e.errors=this.errors,e.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Mt(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,n=-1){for(const i of e)yield*this.next(i);yield*this.end(t,n)}*next(e){switch(e.type){case"directive":this.directives.add(e.source,(t,n,i)=>{const r=pe(e);r[0]+=t,this.onError(r,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{const t=Tn(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{const t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new Q(pe(e),"UNEXPECTED_TOKEN",t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){const n="Unexpected doc-end without preceding document";this.errors.push(new Q(pe(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;const t=Ae(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){const n=this.doc.comment;this.doc.comment=n?`${n}
102
- ${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new Q(pe(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){const n=Object.assign({_directives:this.directives},this.options),i=new de(void 0,n);this.atDirectives&&this.onError(t,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,t,t],this.decorate(i,!1),yield i}}}function $n(s,e=!0,t){if(s){const n=(i,r,o)=>{const l=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(t)t(l,r,o);else throw new Q([l,l+1],r,o)};switch(s.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return bs(s,e,n);case"block-scalar":return ys(s,e,n)}}return null}function Cn(s,e){const{implicitKey:t=!1,indent:n,inFlow:i=!1,offset:r=-1,type:o="PLAIN"}=e,l=Ne({type:o,value:s},{implicitKey:t,indent:n>0?" ".repeat(n):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),a=e.end??[{type:"newline",offset:-1,indent:n,source:`
101
+ ${o}`:n}}t?(Array.prototype.push.apply(e.errors,this.errors),Array.prototype.push.apply(e.warnings,this.warnings)):(e.errors=this.errors,e.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Mt(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,n=-1){for(const i of e)yield*this.next(i);yield*this.end(t,n)}*next(e){switch(e.type){case"directive":this.directives.add(e.source,(t,n,i)=>{const r=pe(e);r[0]+=t,this.onError(r,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{const t=In(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{const t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new Q(pe(e),"UNEXPECTED_TOKEN",t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){const n="Unexpected doc-end without preceding document";this.errors.push(new Q(pe(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;const t=Ae(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){const n=this.doc.comment;this.doc.comment=n?`${n}
102
+ ${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new Q(pe(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){const n=Object.assign({_directives:this.directives},this.options),i=new de(void 0,n);this.atDirectives&&this.onError(t,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,t,t],this.decorate(i,!1),yield i}}}function Tn(s,e=!0,t){if(s){const n=(i,r,o)=>{const l=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(t)t(l,r,o);else throw new Q([l,l+1],r,o)};switch(s.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return ys(s,e,n);case"block-scalar":return gs(s,e,n)}}return null}function Ln(s,e){const{implicitKey:t=!1,indent:n,inFlow:i=!1,offset:r=-1,type:o="PLAIN"}=e,l=Ne({type:o,value:s},{implicitKey:t,indent:n>0?" ".repeat(n):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),a=e.end??[{type:"newline",offset:-1,indent:n,source:`
103
103
  `}];switch(l[0]){case"|":case">":{const c=l.indexOf(`
104
104
  `),u=l.substring(0,c),f=l.substring(c+1)+`
105
- `,h=[{type:"block-scalar-header",offset:r,indent:n,source:u}];return Ns(h,a)||h.push({type:"newline",offset:-1,indent:n,source:`
106
- `}),{type:"block-scalar",offset:r,indent:n,props:h,source:f}}case'"':return{type:"double-quoted-scalar",offset:r,indent:n,source:l,end:a};case"'":return{type:"single-quoted-scalar",offset:r,indent:n,source:l,end:a};default:return{type:"scalar",offset:r,indent:n,source:l,end:a}}}function _n(s,e,t={}){let{afterKey:n=!1,implicitKey:i=!1,inFlow:r=!1,type:o}=t,l="indent"in s?s.indent:null;if(n&&typeof l=="number"&&(l+=2),!o)switch(s.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{const c=s.props[0];if(c.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=c.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}const a=Ne({type:o,value:e},{implicitKey:i||l===null,indent:l!==null&&l>0?" ".repeat(l):"",inFlow:r,options:{blockQuote:!0,lineWidth:-1}});switch(a[0]){case"|":case">":vn(s,a);break;case'"':nt(s,a,"double-quoted-scalar");break;case"'":nt(s,a,"single-quoted-scalar");break;default:nt(s,a,"scalar")}}function vn(s,e){const t=e.indexOf(`
105
+ `,h=[{type:"block-scalar-header",offset:r,indent:n,source:u}];return ks(h,a)||h.push({type:"newline",offset:-1,indent:n,source:`
106
+ `}),{type:"block-scalar",offset:r,indent:n,props:h,source:f}}case'"':return{type:"double-quoted-scalar",offset:r,indent:n,source:l,end:a};case"'":return{type:"single-quoted-scalar",offset:r,indent:n,source:l,end:a};default:return{type:"scalar",offset:r,indent:n,source:l,end:a}}}function $n(s,e,t={}){let{afterKey:n=!1,implicitKey:i=!1,inFlow:r=!1,type:o}=t,l="indent"in s?s.indent:null;if(n&&typeof l=="number"&&(l+=2),!o)switch(s.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{const c=s.props[0];if(c.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=c.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}const a=Ne({type:o,value:e},{implicitKey:i||l===null,indent:l!==null&&l>0?" ".repeat(l):"",inFlow:r,options:{blockQuote:!0,lineWidth:-1}});switch(a[0]){case"|":case">":Cn(s,a);break;case'"':nt(s,a,"double-quoted-scalar");break;case"'":nt(s,a,"single-quoted-scalar");break;default:nt(s,a,"scalar")}}function Cn(s,e){const t=e.indexOf(`
107
107
  `),n=e.substring(0,t),i=e.substring(t+1)+`
108
- `;if(s.type==="block-scalar"){const r=s.props[0];if(r.type!=="block-scalar-header")throw new Error("Invalid block scalar header");r.source=n,s.source=i}else{const{offset:r}=s,o="indent"in s?s.indent:-1,l=[{type:"block-scalar-header",offset:r,indent:o,source:n}];Ns(l,"end"in s?s.end:void 0)||l.push({type:"newline",offset:-1,indent:o,source:`
109
- `});for(const a of Object.keys(s))a!=="type"&&a!=="offset"&&delete s[a];Object.assign(s,{type:"block-scalar",indent:o,props:l,source:i})}}function Ns(s,e){if(e)for(const t of e)switch(t.type){case"space":case"comment":s.push(t);break;case"newline":return s.push(t),!0}return!1}function nt(s,e,t){switch(s.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":s.type=t,s.source=e;break;case"block-scalar":{const n=s.props.slice(1);let i=e.length;s.props[0].type==="block-scalar-header"&&(i-=s.props[0].source.length);for(const r of n)r.offset+=i;delete s.props,Object.assign(s,{type:t,source:e,end:n});break}case"block-map":case"block-seq":{const i={type:"newline",offset:s.offset+e.length,indent:s.indent,source:`
110
- `};delete s.items,Object.assign(s,{type:t,source:e,end:[i]});break}default:{const n="indent"in s?s.indent:-1,i="end"in s&&Array.isArray(s.end)?s.end.filter(r=>r.type==="space"||r.type==="comment"||r.type==="newline"):[];for(const r of Object.keys(s))r!=="type"&&r!=="offset"&&delete s[r];Object.assign(s,{type:t,indent:n,source:e,end:i})}}}const Bn=s=>"type"in s?De(s):ve(s);function De(s){switch(s.type){case"block-scalar":{let e="";for(const t of s.props)e+=De(t);return e+s.source}case"block-map":case"block-seq":{let e="";for(const t of s.items)e+=ve(t);return e}case"flow-collection":{let e=s.start.source;for(const t of s.items)e+=ve(t);for(const t of s.end)e+=t.source;return e}case"document":{let e=ve(s);if(s.end)for(const t of s.end)e+=t.source;return e}default:{let e=s.source;if("end"in s&&s.end)for(const t of s.end)e+=t.source;return e}}}function ve({start:s,key:e,sep:t,value:n}){let i="";for(const r of s)i+=r.source;if(e&&(i+=De(e)),t)for(const r of t)i+=r.source;return n&&(i+=De(n)),i}const ut=Symbol("break visit"),jn=Symbol("skip children"),Os=Symbol("remove item");function x(s,e){"type"in s&&s.type==="document"&&(s={start:s.start,value:s.value}),As(Object.freeze([]),s,e)}x.BREAK=ut;x.SKIP=jn;x.REMOVE=Os;x.itemAtPath=(s,e)=>{let t=s;for(const[n,i]of e){const r=t?.[n];if(r&&"items"in r)t=r.items[i];else return}return t};x.parentCollection=(s,e)=>{const t=x.itemAtPath(s,e.slice(0,-1)),n=e[e.length-1][0],i=t?.[n];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function As(s,e,t){let n=t(e,s);if(typeof n=="symbol")return n;for(const i of["key","value"]){const r=e[i];if(r&&"items"in r){for(let o=0;o<r.items.length;++o){const l=As(Object.freeze(s.concat([[i,o]])),r.items[o],t);if(typeof l=="number")o=l-1;else{if(l===ut)return ut;l===Os&&(r.items.splice(o,1),o-=1)}}typeof n=="function"&&i==="key"&&(n=n(e,s))}}return typeof n=="function"?n(e,s):n}const xe="\uFEFF",Xe="",ze="",Se="",Mn=s=>!!s&&"items"in s,Pn=s=>!!s&&(s.type==="scalar"||s.type==="single-quoted-scalar"||s.type==="double-quoted-scalar"||s.type==="block-scalar");function Dn(s){switch(s){case xe:return"<BOM>";case Xe:return"<DOC>";case ze:return"<FLOW_END>";case Se:return"<SCALAR>";default:return JSON.stringify(s)}}function Es(s){switch(s){case xe:return"byte-order-mark";case Xe:return"doc-mode";case ze:return"flow-error-end";case Se:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
108
+ `;if(s.type==="block-scalar"){const r=s.props[0];if(r.type!=="block-scalar-header")throw new Error("Invalid block scalar header");r.source=n,s.source=i}else{const{offset:r}=s,o="indent"in s?s.indent:-1,l=[{type:"block-scalar-header",offset:r,indent:o,source:n}];ks(l,"end"in s?s.end:void 0)||l.push({type:"newline",offset:-1,indent:o,source:`
109
+ `});for(const a of Object.keys(s))a!=="type"&&a!=="offset"&&delete s[a];Object.assign(s,{type:"block-scalar",indent:o,props:l,source:i})}}function ks(s,e){if(e)for(const t of e)switch(t.type){case"space":case"comment":s.push(t);break;case"newline":return s.push(t),!0}return!1}function nt(s,e,t){switch(s.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":s.type=t,s.source=e;break;case"block-scalar":{const n=s.props.slice(1);let i=e.length;s.props[0].type==="block-scalar-header"&&(i-=s.props[0].source.length);for(const r of n)r.offset+=i;delete s.props,Object.assign(s,{type:t,source:e,end:n});break}case"block-map":case"block-seq":{const i={type:"newline",offset:s.offset+e.length,indent:s.indent,source:`
110
+ `};delete s.items,Object.assign(s,{type:t,source:e,end:[i]});break}default:{const n="indent"in s?s.indent:-1,i="end"in s&&Array.isArray(s.end)?s.end.filter(r=>r.type==="space"||r.type==="comment"||r.type==="newline"):[];for(const r of Object.keys(s))r!=="type"&&r!=="offset"&&delete s[r];Object.assign(s,{type:t,indent:n,source:e,end:i})}}}const vn=s=>"type"in s?Pe(s):ve(s);function Pe(s){switch(s.type){case"block-scalar":{let e="";for(const t of s.props)e+=Pe(t);return e+s.source}case"block-map":case"block-seq":{let e="";for(const t of s.items)e+=ve(t);return e}case"flow-collection":{let e=s.start.source;for(const t of s.items)e+=ve(t);for(const t of s.end)e+=t.source;return e}case"document":{let e=ve(s);if(s.end)for(const t of s.end)e+=t.source;return e}default:{let e=s.source;if("end"in s&&s.end)for(const t of s.end)e+=t.source;return e}}}function ve({start:s,key:e,sep:t,value:n}){let i="";for(const r of s)i+=r.source;if(e&&(i+=Pe(e)),t)for(const r of t)i+=r.source;return n&&(i+=Pe(n)),i}const ft=Symbol("break visit"),_n=Symbol("skip children"),Ns=Symbol("remove item");function x(s,e){"type"in s&&s.type==="document"&&(s={start:s.start,value:s.value}),Os(Object.freeze([]),s,e)}x.BREAK=ft;x.SKIP=_n;x.REMOVE=Ns;x.itemAtPath=(s,e)=>{let t=s;for(const[n,i]of e){const r=t?.[n];if(r&&"items"in r)t=r.items[i];else return}return t};x.parentCollection=(s,e)=>{const t=x.itemAtPath(s,e.slice(0,-1)),n=e[e.length-1][0],i=t?.[n];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function Os(s,e,t){let n=t(e,s);if(typeof n=="symbol")return n;for(const i of["key","value"]){const r=e[i];if(r&&"items"in r){for(let o=0;o<r.items.length;++o){const l=Os(Object.freeze(s.concat([[i,o]])),r.items[o],t);if(typeof l=="number")o=l-1;else{if(l===ft)return ft;l===Ns&&(r.items.splice(o,1),o-=1)}}typeof n=="function"&&i==="key"&&(n=n(e,s))}}return typeof n=="function"?n(e,s):n}const He="\uFEFF",xe="",Xe="",Se="",Bn=s=>!!s&&"items"in s,Mn=s=>!!s&&(s.type==="scalar"||s.type==="single-quoted-scalar"||s.type==="double-quoted-scalar"||s.type==="block-scalar");function jn(s){switch(s){case He:return"<BOM>";case xe:return"<DOC>";case Xe:return"<FLOW_END>";case Se:return"<SCALAR>";default:return JSON.stringify(s)}}function As(s){switch(s){case He:return"byte-order-mark";case xe:return"doc-mode";case Xe:return"flow-error-end";case Se:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
111
111
  `:case`\r
112
- `: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(s[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}const Kn=Object.freeze(Object.defineProperty({__proto__:null,BOM:xe,DOCUMENT:Xe,FLOW_END:ze,SCALAR:Se,createScalarToken:Cn,isCollection:Mn,isScalar:Pn,prettyToken:Dn,resolveAsScalar:$n,setScalarValue:_n,stringify:Bn,tokenType:Es,visit:x},Symbol.toStringTag,{value:"Module"}));function B(s){switch(s){case void 0:case" ":case`
113
- `:case"\r":case" ":return!0;default:return!1}}const Pt="0123456789ABCDEFabcdef".split(""),Fn="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()".split(""),it=",[]{}".split(""),qn=` ,[]{}
114
- \r `.split(""),rt=s=>!s||qn.includes(s);class Is{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){e&&(this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null),this.atEnd=!t;let n=this.next??"stream";for(;n&&(t||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===" "||t===" ";)t=this.buffer[++e];return!t||t==="#"||t===`
112
+ `: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(s[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}const Pn=Object.freeze(Object.defineProperty({__proto__:null,BOM:He,DOCUMENT:xe,FLOW_END:Xe,SCALAR:Se,createScalarToken:Ln,isCollection:Bn,isScalar:Mn,prettyToken:jn,resolveAsScalar:Tn,setScalarValue:$n,stringify:vn,tokenType:As,visit:x},Symbol.toStringTag,{value:"Module"}));function B(s){switch(s){case void 0:case" ":case`
113
+ `:case"\r":case" ":return!0;default:return!1}}const jt="0123456789ABCDEFabcdef".split(""),Dn="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()".split(""),it=",[]{}".split(""),Kn=` ,[]{}
114
+ \r `.split(""),rt=s=>!s||Kn.includes(s);class Es{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){e&&(this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null),this.atEnd=!t;let n=this.next??"stream";for(;n&&(t||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===" "||t===" ";)t=this.buffer[++e];return!t||t==="#"||t===`
115
115
  `?!0:t==="\r"?this.buffer[e+1]===`
116
116
  `:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let n=0;for(;t===" ";)t=this.buffer[++n+e];if(t==="\r"){const i=this.buffer[n+e+1];if(i===`
117
117
  `||!i&&!this.atEnd)return e+n+1}return t===`
118
118
  `||n>=this.indentNext||!t&&!this.atEnd?e+n:-1}if(t==="-"||t==="."){const n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&B(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
119
- `,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){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 e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===xe&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let t=e.length;const n=e.indexOf("#");if(n!==-1){const r=e[n-1];(r===" "||r===" ")&&(t=n-1)}for(;;){const r=e[t-1];if(r===" "||r===" ")t-=1;else break}const i=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-i),this.pushNewline(),"stream"}if(this.atLineEnd()){const t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),"stream"}return yield Xe,yield*this.parseLineStart()}*parseLineStart(){const e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");const t=this.peek(3);if(t==="---"&&B(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,"doc";if(t==="..."&&B(this.charAt(3)))return yield*this.pushCount(3),"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!B(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){const[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&B(t)){const 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);const e=this.getLine();if(e===null)return this.setNext("doc");let t=yield*this.pushIndicators();switch(e[t]){case"#":yield*this.pushCount(e.length-t);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(rt),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,n=-1;do e=yield*this.pushNewline(),e>0?(t=yield*this.pushSpaces(!1),this.indentValue=n=t):t=0,t+=yield*this.pushSpaces(!0);while(e+t>0);const i=this.getLine();if(i===null)return this.setNext("flow");if((n!==-1&&n<this.indentNext&&i[0]!=="#"||n===0&&(i.startsWith("---")||i.startsWith("..."))&&B(i[3]))&&!(n===this.indentNext-1&&this.flowLevel===1&&(i[0]==="]"||i[0]==="}")))return this.flowLevel=0,yield ze,yield*this.parseLineStart();let r=0;for(;i[r]===",";)r+=yield*this.pushCount(1),r+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(r+=yield*this.pushIndicators(),i[r]){case void 0:return"flow";case"#":return yield*this.pushCount(i.length-r),"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-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(rt),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{const o=this.charAt(1);if(this.flowKey||B(o)||o===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){const e=this.charAt(0);let t=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;t!==-1&&this.buffer[t+1]==="'";)t=this.buffer.indexOf("'",t+2);else for(;t!==-1;){let r=0;for(;this.buffer[t-1-r]==="\\";)r+=1;if(r%2===0)break;t=this.buffer.indexOf('"',t+1)}const n=this.buffer.substring(0,t);let i=n.indexOf(`
119
+ `,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){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 e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===He&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let t=e.length;const n=e.indexOf("#");if(n!==-1){const r=e[n-1];(r===" "||r===" ")&&(t=n-1)}for(;;){const r=e[t-1];if(r===" "||r===" ")t-=1;else break}const i=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-i),this.pushNewline(),"stream"}if(this.atLineEnd()){const t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),"stream"}return yield xe,yield*this.parseLineStart()}*parseLineStart(){const e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");const t=this.peek(3);if(t==="---"&&B(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,"doc";if(t==="..."&&B(this.charAt(3)))return yield*this.pushCount(3),"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!B(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){const[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&B(t)){const 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);const e=this.getLine();if(e===null)return this.setNext("doc");let t=yield*this.pushIndicators();switch(e[t]){case"#":yield*this.pushCount(e.length-t);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(rt),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,n=-1;do e=yield*this.pushNewline(),e>0?(t=yield*this.pushSpaces(!1),this.indentValue=n=t):t=0,t+=yield*this.pushSpaces(!0);while(e+t>0);const i=this.getLine();if(i===null)return this.setNext("flow");if((n!==-1&&n<this.indentNext&&i[0]!=="#"||n===0&&(i.startsWith("---")||i.startsWith("..."))&&B(i[3]))&&!(n===this.indentNext-1&&this.flowLevel===1&&(i[0]==="]"||i[0]==="}")))return this.flowLevel=0,yield Xe,yield*this.parseLineStart();let r=0;for(;i[r]===",";)r+=yield*this.pushCount(1),r+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(r+=yield*this.pushIndicators(),i[r]){case void 0:return"flow";case"#":return yield*this.pushCount(i.length-r),"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-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(rt),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{const o=this.charAt(1);if(this.flowKey||B(o)||o===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){const e=this.charAt(0);let t=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;t!==-1&&this.buffer[t+1]==="'";)t=this.buffer.indexOf("'",t+2);else for(;t!==-1;){let r=0;for(;this.buffer[t-1-r]==="\\";)r+=1;if(r%2===0)break;t=this.buffer.indexOf('"',t+1)}const n=this.buffer.substring(0,t);let i=n.indexOf(`
120
120
  `,this.pos);if(i!==-1){for(;i!==-1;){const r=this.continueScalar(i+1);if(r===-1)break;i=n.indexOf(`
121
121
  `,r)}i!==-1&&(t=i-(n[i-1]==="\r"?2:1))}if(t===-1){if(!this.atEnd)return this.setNext("quoted-scalar");t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){const t=this.buffer[++e];if(t==="+")this.blockScalarKeep=!0;else if(t>"0"&&t<="9")this.blockScalarIndent=Number(t)-1;else if(t!=="-")break}return yield*this.pushUntil(t=>B(t)||t==="#")}*parseBlockScalar(){let e=this.pos-1,t=0,n;e:for(let i=this.pos;n=this.buffer[i];++i)switch(n){case" ":t+=1;break;case`
122
122
  `:e=i,t=0;break;case"\r":{const r=this.buffer[i+1];if(!r&&!this.atEnd)return this.setNext("block-scalar");if(r===`
@@ -125,10 +125,11 @@ ${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.pus
125
125
  `&&i>=this.pos&&i+1+t>o)e=i;else break}while(!0);return yield Se,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){const e=this.flowLevel>0;let t=this.pos-1,n=this.pos-1,i;for(;i=this.buffer[++n];)if(i===":"){const r=this.buffer[n+1];if(B(r)||e&&r===",")break;t=n}else if(B(i)){let r=this.buffer[n+1];if(i==="\r"&&(r===`
126
126
  `?(n+=1,i=`
127
127
  `,r=this.buffer[n+1]):t=n),r==="#"||e&&it.includes(r))break;if(i===`
128
- `){const o=this.continueScalar(n+1);if(o===-1)break;n=Math.max(n,o-2)}}else{if(e&&it.includes(i))break;t=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield Se,yield*this.pushToIndex(t+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){const n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(t&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(rt))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{const e=this.flowLevel>0,t=this.charAt(1);if(B(t)||e&&it.includes(t))return e?this.flowKey&&(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 e=this.pos+2,t=this.buffer[e];for(;!B(t)&&t!==">";)t=this.buffer[++e];return yield*this.pushToIndex(t===">"?e+1:e,!1)}else{let e=this.pos+1,t=this.buffer[e];for(;t;)if(Fn.includes(t))t=this.buffer[++e];else if(t==="%"&&Pt.includes(this.buffer[e+1])&&Pt.includes(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){const e=this.buffer[this.pos];return e===`
128
+ `){const o=this.continueScalar(n+1);if(o===-1)break;n=Math.max(n,o-2)}}else{if(e&&it.includes(i))break;t=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield Se,yield*this.pushToIndex(t+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){const n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(t&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(rt))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{const e=this.flowLevel>0,t=this.charAt(1);if(B(t)||e&&it.includes(t))return e?this.flowKey&&(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 e=this.pos+2,t=this.buffer[e];for(;!B(t)&&t!==">";)t=this.buffer[++e];return yield*this.pushToIndex(t===">"?e+1:e,!1)}else{let e=this.pos+1,t=this.buffer[e];for(;t;)if(Dn.includes(t))t=this.buffer[++e];else if(t==="%"&&jt.includes(this.buffer[e+1])&&jt.includes(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){const e=this.buffer[this.pos];return e===`
129
129
  `?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
130
- `?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,n;do n=this.buffer[++t];while(n===" "||e&&n===" ");const i=t-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=t),i}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}}class Ls{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t<n;){const r=t+n>>1;this.lineStarts[r]<e?t=r+1:n=r}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};const i=this.lineStarts[t-1];return{line:t,col:e-i+1}}}}function P(s,e){for(let t=0;t<s.length;++t)if(s[t].type===e)return!0;return!1}function Dt(s){for(let e=0;e<s.length;++e)switch(s[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function Ts(s){switch(s?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function Le(s){switch(s.type){case"document":return s.start;case"block-map":{const e=s.items[s.items.length-1];return e.sep??e.start}case"block-seq":return s.items[s.items.length-1].start;default:return[]}}function se(s){if(s.length===0)return[];let e=s.length;e:for(;--e>=0;)switch(s[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;s[++e]?.type==="space";);return s.splice(e,s.length)}function Kt(s){if(s.start.type==="flow-seq-start")for(const e of s.items)e.sep&&!e.value&&!P(e.start,"explicit-key-ind")&&!P(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,Ts(e.value)?e.value.end?Array.prototype.push.apply(e.value.end,e.sep):e.value.end=e.sep:Array.prototype.push.apply(e.start,e.sep),delete e.sep)}class It{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new Is,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(const n of this.lexer.lex(e,t))yield*this.next(n);t||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}const t=Es(e);if(t)if(t==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=t,yield*this.step(),t){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{const n=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:n,source:e}),this.offset+=e.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(){const e=this.peek(1);if(this.type==="doc-end"&&(!e||e.type!=="doc-end")){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){const t=e??this.stack.pop();if(t)if(this.stack.length===0)yield t;else{const n=this.peek(1);switch(t.type==="block-scalar"?t.indent="indent"in n?n.indent:0:t.type==="flow-collection"&&n.type==="document"&&(t.indent=0),t.type==="flow-collection"&&Kt(t),n.type){case"document":n.value=t;break;case"block-scalar":n.props.push(t);break;case"block-map":{const i=n.items[n.items.length-1];if(i.value){n.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=t;else{Object.assign(i,{key:t,sep:[]}),this.onKeyLine=!P(i.start,"explicit-key-ind");return}break}case"block-seq":{const i=n.items[n.items.length-1];i.value?n.items.push({start:[],value:t}):i.value=t;break}case"flow-collection":{const i=n.items[n.items.length-1];!i||i.value?n.items.push({start:[],key:t,sep:[]}):i.sep?i.value=t:Object.assign(i,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(t.type==="block-map"||t.type==="block-seq")){const i=t.items[t.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&Dt(i.start)===-1&&(t.indent===0||i.start.every(r=>r.type!=="comment"||r.indent<t.indent))&&(n.type==="document"?n.end=i.start:n.items.push({start:i.start}),t.items.splice(-1,1))}}else{const n="Tried to pop an empty stack";yield{type:"error",offset:this.offset,source:"",message:n}}}*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":{const e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{Dt(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}const t=this.startBlockValue(e);t?this.stack.push(t):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){const t=Le(this.peek(2)),n=se(t);let i;e.end?(i=e.end,i.push(this.sourceToken),delete e.end):i=[this.sourceToken];const r={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:i}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=r}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let t=this.source.indexOf(`
130
+ `?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,n;do n=this.buffer[++t];while(n===" "||e&&n===" ");const i=t-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=t),i}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}}class Is{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t<n;){const r=t+n>>1;this.lineStarts[r]<e?t=r+1:n=r}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};const i=this.lineStarts[t-1];return{line:t,col:e-i+1}}}}function P(s,e){for(let t=0;t<s.length;++t)if(s[t].type===e)return!0;return!1}function Pt(s){for(let e=0;e<s.length;++e)switch(s[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function Ts(s){switch(s?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function Te(s){switch(s.type){case"document":return s.start;case"block-map":{const e=s.items[s.items.length-1];return e.sep??e.start}case"block-seq":return s.items[s.items.length-1].start;default:return[]}}function se(s){if(s.length===0)return[];let e=s.length;e:for(;--e>=0;)switch(s[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;s[++e]?.type==="space";);return s.splice(e,s.length)}function Dt(s){if(s.start.type==="flow-seq-start")for(const e of s.items)e.sep&&!e.value&&!P(e.start,"explicit-key-ind")&&!P(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,Ts(e.value)?e.value.end?Array.prototype.push.apply(e.value.end,e.sep):e.value.end=e.sep:Array.prototype.push.apply(e.start,e.sep),delete e.sep)}class Et{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new Es,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(const n of this.lexer.lex(e,t))yield*this.next(n);t||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}const t=As(e);if(t)if(t==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=t,yield*this.step(),t){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{const n=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:n,source:e}),this.offset+=e.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(){const e=this.peek(1);if(this.type==="doc-end"&&(!e||e.type!=="doc-end")){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){const t=e??this.stack.pop();if(t)if(this.stack.length===0)yield t;else{const n=this.peek(1);switch(t.type==="block-scalar"?t.indent="indent"in n?n.indent:0:t.type==="flow-collection"&&n.type==="document"&&(t.indent=0),t.type==="flow-collection"&&Dt(t),n.type){case"document":n.value=t;break;case"block-scalar":n.props.push(t);break;case"block-map":{const i=n.items[n.items.length-1];if(i.value){n.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=t;else{Object.assign(i,{key:t,sep:[]}),this.onKeyLine=!P(i.start,"explicit-key-ind");return}break}case"block-seq":{const i=n.items[n.items.length-1];i.value?n.items.push({start:[],value:t}):i.value=t;break}case"flow-collection":{const i=n.items[n.items.length-1];!i||i.value?n.items.push({start:[],key:t,sep:[]}):i.sep?i.value=t:Object.assign(i,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(t.type==="block-map"||t.type==="block-seq")){const i=t.items[t.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&Pt(i.start)===-1&&(t.indent===0||i.start.every(r=>r.type!=="comment"||r.indent<t.indent))&&(n.type==="document"?n.end=i.start:n.items.push({start:i.start}),t.items.splice(-1,1))}}else{const n="Tried to pop an empty stack";yield{type:"error",offset:this.offset,source:"",message:n}}}*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":{const e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{Pt(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}const t=this.startBlockValue(e);t?this.stack.push(t):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){const t=Te(this.peek(2)),n=se(t);let i;e.end?(i=e.end,i.push(this.sourceToken),delete e.end):i=[this.sourceToken];const r={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:i}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=r}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let t=this.source.indexOf(`
131
131
  `)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
132
- `,t)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){const t=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,t.value){const n="end"in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){const i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){Array.prototype.push.apply(i,t.start),i.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){const n=!this.onKeyLine&&this.indent===e.indent&&t.sep;let i=[];if(n&&t.sep&&!t.value){const r=[];for(let o=0;o<t.sep.length;++o){const l=t.sep[o];switch(l.type){case"newline":r.push(o);break;case"space":break;case"comment":l.indent>e.indent&&(r.length=0);break;default:r.length=0}}r.length>=2&&(i=t.sep.splice(r[1]))}switch(this.type){case"anchor":case"tag":n||t.value?(i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"explicit-key-ind":!t.sep&&!P(t.start,"explicit-key-ind")?t.start.push(this.sourceToken):n||t.value?(i.push(this.sourceToken),e.items.push({start:i})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]}),this.onKeyLine=!0;return;case"map-value-ind":if(P(t.start,"explicit-key-ind"))if(t.sep)if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(P(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if(Ts(t.key)&&!P(t.sep,"newline")){const r=se(t.start),o=t.key,l=t.sep;l.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:o,sep:l}]})}else i.length>0?t.sep=t.sep.concat(i,this.sourceToken):t.sep.push(this.sourceToken);else if(P(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{const r=se(t.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]})}else t.sep?t.value||n?e.items.push({start:i,key:null,sep:[this.sourceToken]}):P(t.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const r=this.flowScalar(this.type);n||t.value?(e.items.push({start:i,key:r,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(r):(Object.assign(t,{key:r,sep:[]}),this.onKeyLine=!0);return}default:{const r=this.startBlockValue(e);if(r){n&&r.type!=="block-seq"&&P(t.start,"explicit-key-ind")&&e.items.push({start:i}),this.stack.push(r);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){const t=e.items[e.items.length-1];switch(this.type){case"newline":if(t.value){const n="end"in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){const i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){Array.prototype.push.apply(i,t.start),i.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case"anchor":case"tag":if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;t.value||P(t.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){const n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){const t=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n&&n.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case"map-value-ind":!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const i=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:i,sep:[]}):t.sep?this.stack.push(i):Object.assign(t,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}const n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{const n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){const i=Le(n),r=se(i);Kt(e);const o=e.end.splice(1,e.end.length);o.push(this.sourceToken);const l={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:r,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=l}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let t=this.source.indexOf(`
132
+ `,t)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){const t=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,t.value){const n="end"in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){const i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){Array.prototype.push.apply(i,t.start),i.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){const n=!this.onKeyLine&&this.indent===e.indent&&t.sep;let i=[];if(n&&t.sep&&!t.value){const r=[];for(let o=0;o<t.sep.length;++o){const l=t.sep[o];switch(l.type){case"newline":r.push(o);break;case"space":break;case"comment":l.indent>e.indent&&(r.length=0);break;default:r.length=0}}r.length>=2&&(i=t.sep.splice(r[1]))}switch(this.type){case"anchor":case"tag":n||t.value?(i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"explicit-key-ind":!t.sep&&!P(t.start,"explicit-key-ind")?t.start.push(this.sourceToken):n||t.value?(i.push(this.sourceToken),e.items.push({start:i})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]}),this.onKeyLine=!0;return;case"map-value-ind":if(P(t.start,"explicit-key-ind"))if(t.sep)if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(P(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if(Ts(t.key)&&!P(t.sep,"newline")){const r=se(t.start),o=t.key,l=t.sep;l.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:o,sep:l}]})}else i.length>0?t.sep=t.sep.concat(i,this.sourceToken):t.sep.push(this.sourceToken);else if(P(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{const r=se(t.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]})}else t.sep?t.value||n?e.items.push({start:i,key:null,sep:[this.sourceToken]}):P(t.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const r=this.flowScalar(this.type);n||t.value?(e.items.push({start:i,key:r,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(r):(Object.assign(t,{key:r,sep:[]}),this.onKeyLine=!0);return}default:{const r=this.startBlockValue(e);if(r){n&&r.type!=="block-seq"&&P(t.start,"explicit-key-ind")&&e.items.push({start:i}),this.stack.push(r);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){const t=e.items[e.items.length-1];switch(this.type){case"newline":if(t.value){const n="end"in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){const i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){Array.prototype.push.apply(i,t.start),i.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case"anchor":case"tag":if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;t.value||P(t.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){const n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){const t=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n&&n.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case"map-value-ind":!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const i=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:i,sep:[]}):t.sep?this.stack.push(i):Object.assign(t,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}const n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{const n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){const i=Te(n),r=se(i);Dt(e);const o=e.end.splice(1,e.end.length);o.push(this.sourceToken);const l={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:r,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=l}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let t=this.source.indexOf(`
133
133
  `)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
134
- `,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;const t=Le(e),n=se(t);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n}]}}case"map-value-ind":{this.onKeyLine=!0;const t=Le(e),n=se(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!=="comment"||this.indent<=t?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}}function $s(s){const e=s.prettyErrors!==!1;return{lineCounter:s.lineCounter||e&&new Ls||null,prettyErrors:e}}function Un(s,e={}){const{lineCounter:t,prettyErrors:n}=$s(e),i=new It(t?.addNewLine),r=new Et(e),o=Array.from(r.compose(i.parse(s)));if(n&&t)for(const l of o)l.errors.forEach(Pe(s,t)),l.warnings.forEach(Pe(s,t));return o.length>0?o:Object.assign([],{empty:!0},r.streamInfo())}function Cs(s,e={}){const{lineCounter:t,prettyErrors:n}=$s(e),i=new It(t?.addNewLine),r=new Et(e);let o=null;for(const l of r.compose(i.parse(s),!0,s.length))if(!o)o=l;else if(o.options.logLevel!=="silent"){o.errors.push(new Q(l.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&t&&(o.errors.forEach(Pe(s,t)),o.warnings.forEach(Pe(s,t))),o}function Rn(s,e,t){let n;typeof e=="function"?n=e:t===void 0&&e&&typeof e=="object"&&(t=e);const i=Cs(s,t);if(!i)return null;if(i.warnings.forEach(r=>Xt(i.options.logLevel,r)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:n},t))}function Vn(s,e,t){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:t===void 0&&e&&(t=e),typeof t=="string"&&(t=t.length),typeof t=="number"){const i=Math.round(t);t=i<1?void 0:i>8?{indent:8}:{indent:i}}if(s===void 0){const{keepUndefined:i}=t??e??{};if(!i)return}return new de(s,n,t).toString(t)}const Wn=Object.freeze(Object.defineProperty({__proto__:null,Alias:Fe,CST:Kn,Composer:Et,Document:de,Lexer:Is,LineCounter:Ls,Pair:$,Parser:It,Scalar:N,Schema:He,YAMLError:Ot,YAMLMap:j,YAMLParseError:Q,YAMLSeq:Z,YAMLWarning:ms,isAlias:X,isCollection:L,isDocument:ke,isMap:z,isNode:T,isPair:I,isScalar:A,isSeq:fe,parse:Rn,parseAllDocuments:Un,parseDocument:Cs,stringify:Vn,visit:J,visitAsync:Ke},Symbol.toStringTag,{value:"Module"})),ot=Te.dirname(_s.fileURLToPath(typeof document>"u"?new(require("url")).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("index.cjs.js",document.baseURI).href)),Jn=s=>s,Yn=s=>s,Gn=s=>s,Qn=s=>({widget:"boolean",...s}),Hn=s=>({widget:"code",...s}),xn=s=>({widget:"color",...s}),Xn=s=>({widget:"datetime",...s}),zn=s=>({widget:"hidden",...s}),Zn=s=>({widget:"file",...s}),ei=s=>({widget:"image",...s}),ti=s=>({widget:"list",...s}),si=s=>({widget:"map",...s}),ni=s=>({widget:"number",...s}),ii=s=>({widget:"object",...s}),ri=s=>({widget:"relation",...s}),oi=s=>({widget:"select",...s}),li=s=>({widget:"string",...s}),ai=s=>({widget:"text",...s}),ci=async s=>{try{await Be.readdir(s)}catch{await Be.mkdir(s,{recursive:!0})}},fi=async(s,e)=>{await Be.writeFile(e,s)},ui=async s=>{try{await Be.readFile(s);const{default:e}=await import(s);return e}catch{throw new Error("Config file not found")}},Ft=async s=>{const{configFile:e="./netlify.config.ts",config:t,saveFolder:n="./public/admin"}=s??{};await ci(Te.join(ot,n));const i=t??await ui(Te.join(ot,e)),r=Wn.stringify(i);await fi(r,Te.join(ot,n,"config.yml"))};async function hi(s){return{name:"vite-plugin-netlify-cms",buildStart:async()=>{await Ft()},handleHotUpdate:async({file:e})=>{e.endsWith("netlify.config.ts")&&await Ft(s)}}}exports.default=hi;exports.defineBooleanWidget=Qn;exports.defineCodeWidget=Hn;exports.defineColorWidget=xn;exports.defineConfig=Jn;exports.defineDateTimeWidget=Xn;exports.defineFileCollection=Gn;exports.defineFileWidget=Zn;exports.defineFolderCollection=Yn;exports.defineHiddenWidget=zn;exports.defineImageWidget=ei;exports.defineListWidget=ti;exports.defineMapWidget=si;exports.defineNumberWidget=ni;exports.defineObjectWidget=ii;exports.defineRelationWidget=ri;exports.defineSelectWidget=oi;exports.defineStringWidget=li;exports.defineTextWidget=ai;
134
+ `,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;const t=Te(e),n=se(t);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n}]}}case"map-value-ind":{this.onKeyLine=!0;const t=Te(e),n=se(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!=="comment"||this.indent<=t?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}}function Ls(s){const e=s.prettyErrors!==!1;return{lineCounter:s.lineCounter||e&&new Is||null,prettyErrors:e}}function Fn(s,e={}){const{lineCounter:t,prettyErrors:n}=Ls(e),i=new Et(t?.addNewLine),r=new At(e),o=Array.from(r.compose(i.parse(s)));if(n&&t)for(const l of o)l.errors.forEach(je(s,t)),l.warnings.forEach(je(s,t));return o.length>0?o:Object.assign([],{empty:!0},r.streamInfo())}function $s(s,e={}){const{lineCounter:t,prettyErrors:n}=Ls(e),i=new Et(t?.addNewLine),r=new At(e);let o=null;for(const l of r.compose(i.parse(s),!0,s.length))if(!o)o=l;else if(o.options.logLevel!=="silent"){o.errors.push(new Q(l.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&t&&(o.errors.forEach(je(s,t)),o.warnings.forEach(je(s,t))),o}function qn(s,e,t){let n;typeof e=="function"?n=e:t===void 0&&e&&typeof e=="object"&&(t=e);const i=$s(s,t);if(!i)return null;if(i.warnings.forEach(r=>xt(i.options.logLevel,r)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:n},t))}function Un(s,e,t){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:t===void 0&&e&&(t=e),typeof t=="string"&&(t=t.length),typeof t=="number"){const i=Math.round(t);t=i<1?void 0:i>8?{indent:8}:{indent:i}}if(s===void 0){const{keepUndefined:i}=t??e??{};if(!i)return}return new de(s,n,t).toString(t)}const Rn=Object.freeze(Object.defineProperty({__proto__:null,Alias:Ke,CST:Pn,Composer:At,Document:de,Lexer:Es,LineCounter:Is,Pair:$,Parser:Et,Scalar:N,Schema:Qe,YAMLError:Nt,YAMLMap:M,YAMLParseError:Q,YAMLSeq:Z,YAMLWarning:ps,isAlias:X,isCollection:T,isDocument:ke,isMap:z,isNode:L,isPair:I,isScalar:A,isSeq:fe,parse:qn,parseAllDocuments:Fn,parseDocument:$s,stringify:Un,visit:J,visitAsync:De},Symbol.toStringTag,{value:"Module"})),Vn=s=>s,Wn=s=>s,Jn=s=>s,Yn=s=>({widget:"boolean",...s}),Gn=s=>({widget:"code",...s}),Qn=s=>({widget:"color",...s}),Hn=s=>({widget:"datetime",...s}),xn=s=>({widget:"hidden",...s}),Xn=s=>({widget:"file",...s}),zn=s=>({widget:"image",...s}),Zn=s=>({widget:"list",...s}),ei=s=>({widget:"map",...s}),ti=s=>({widget:"number",...s}),si=s=>({widget:"object",...s}),ni=s=>({widget:"relation",...s}),ii=s=>({widget:"select",...s}),ri=s=>({widget:"string",...s}),oi=s=>({widget:"text",...s}),li=async s=>{try{await _e.readdir(s)}catch{await _e.mkdir(s,{recursive:!0})}},ai=async(s,e)=>{await _e.writeFile(e,s)},ci=async s=>{try{await _e.readFile(s);const{default:e}=await import(s);return e}catch{throw new Error(`Config file not found on ${s}`)}},Kt=async(s,e)=>{const{configFile:t="./netlify.config.ts",config:n,saveFolder:i="./public/admin"}=e??{};await li(ze.join(s,i));const r=n??await ci(ze.join(s,t)),o=Rn.stringify(r);await ai(o,ze.join(s,i,"config.yml"))};async function fi(s){let e="";return{name:"vite-plugin-netlify-cms",configResolved:t=>{e=t.root},buildStart:async()=>{await Kt(e,s)},handleHotUpdate:async({file:t})=>{t.endsWith("netlify.config.ts")&&await Kt(e,s)}}}exports.default=fi;exports.defineBooleanWidget=Yn;exports.defineCodeWidget=Gn;exports.defineColorWidget=Qn;exports.defineConfig=Vn;exports.defineDateTimeWidget=Hn;exports.defineFileCollection=Jn;exports.defineFileWidget=Xn;exports.defineFolderCollection=Wn;exports.defineHiddenWidget=xn;exports.defineImageWidget=zn;exports.defineListWidget=Zn;exports.defineMapWidget=ei;exports.defineNumberWidget=ti;exports.defineObjectWidget=si;exports.defineRelationWidget=ni;exports.defineSelectWidget=ii;exports.defineStringWidget=ri;exports.defineTextWidget=oi;
135
+ //# sourceMappingURL=index.cjs.js.map