@skaldapp/runtime 3.0.29 → 3.0.30

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.
@@ -1 +0,0 @@
1
- const e=Symbol.for("yaml.alias"),t=Symbol.for("yaml.document"),s=Symbol.for("yaml.map"),n=Symbol.for("yaml.pair"),i=Symbol.for("yaml.scalar"),o=Symbol.for("yaml.seq"),r=Symbol.for("yaml.node.type"),a=t=>!!t&&"object"==typeof t&&t[r]===e,c=e=>!!e&&"object"==typeof e&&e[r]===t,l=e=>!!e&&"object"==typeof e&&e[r]===s,u=e=>!!e&&"object"==typeof e&&e[r]===n,h=e=>!!e&&"object"==typeof e&&e[r]===i,f=e=>!!e&&"object"==typeof e&&e[r]===o;function d(e){if(e&&"object"==typeof e)switch(e[r]){case s:case o:return!0}return!1}function p(t){if(t&&"object"==typeof t)switch(t[r]){case e:case s:case i:case o:return!0}return!1}const m=e=>(h(e)||d(e))&&!!e.anchor,g=Symbol("break visit"),y=Symbol("skip children"),b=Symbol("remove node");function w(e,t){const s=function(e){if("object"==typeof e&&(e.Collection||e.Node||e.Value))return Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e);return e}(t);if(c(e)){k(null,e.contents,s,Object.freeze([e]))===b&&(e.contents=null)}else k(null,e,s,Object.freeze([]))}function k(e,t,s,n){const i=function(e,t,s,n){return"function"==typeof s?s(e,t,n):l(t)?s.Map?.(e,t,n):f(t)?s.Seq?.(e,t,n):u(t)?s.Pair?.(e,t,n):h(t)?s.Scalar?.(e,t,n):a(t)?s.Alias?.(e,t,n):void 0}(e,t,s,n);if(p(i)||u(i))return function(e,t,s){const n=t[t.length-1];if(d(n))n.items[e]=s;else if(u(n))"key"===e?n.key=s:n.value=s;else{if(!c(n)){const e=a(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${e} parent`)}n.contents=s}}(e,n,i),k(e,i,s,n);if("symbol"!=typeof i)if(d(t)){n=Object.freeze(n.concat(t));for(let e=0;e<t.items.length;++e){const i=k(e,t.items[e],s,n);if("number"==typeof i)e=i-1;else{if(i===g)return g;i===b&&(t.items.splice(e,1),e-=1)}}}else if(u(t)){n=Object.freeze(n.concat(t));const e=k("key",t.key,s,n);if(e===g)return g;e===b&&(t.key=null);const i=k("value",t.value,s,n);if(i===g)return g;i===b&&(t.value=null)}return i}w.BREAK=g,w.SKIP=y,w.REMOVE=b;const v={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},S=e=>e.replace(/[!,[\]{}]/g,e=>v[e]);class E{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},E.defaultYaml,e),this.tags=Object.assign({},E.defaultTags,t)}clone(){const e=new E(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){const e=new E(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:E.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},E.defaultTags)}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:E.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},E.defaultTags),this.atNextDocument=!1);const s=e.trim().split(/[ \t]+/),n=s.shift();switch(n){case"%TAG":{if(2!==s.length&&(t(0,"%TAG directive should contain exactly two parts"),s.length<2))return!1;const[e,n]=s;return this.tags[e]=n,!0}case"%YAML":{if(this.yaml.explicit=!0,1!==s.length)return t(0,"%YAML directive should contain exactly one part"),!1;const[e]=s;if("1.1"===e||"1.2"===e)return this.yaml.version=e,!0;return t(6,`Unsupported YAML version ${e}`,/^\d+\.\d+$/.test(e)),!1}default:return t(0,`Unknown directive ${n}`,!0),!1}}tagName(e,t){if("!"===e)return"!";if("!"!==e[0])return t(`Not a valid tag: ${e}`),null;if("<"===e[1]){const s=e.slice(2,-1);return"!"===s||"!!"===s?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(">"!==e[e.length-1]&&t("Verbatim tags must end with a >"),s)}const[,s,n]=e.match(/^(.*!)([^!]*)$/s);n||t(`The ${e} tag has no suffix`);const i=this.tags[s];if(i)try{return i+decodeURIComponent(n)}catch(o){return t(String(o)),null}return"!"===s?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(const[t,s]of Object.entries(this.tags))if(e.startsWith(s))return t+S(e.substring(s.length));return"!"===e[0]?e:`!<${e}>`}toString(e){const t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],s=Object.entries(this.tags);let n;if(e&&s.length>0&&p(e.contents)){const t={};w(e.contents,(e,s)=>{p(s)&&s.tag&&(t[s.tag]=!0)}),n=Object.keys(t)}else n=[];for(const[i,o]of s)"!!"===i&&"tag:yaml.org,2002:"===o||e&&!n.some(e=>e.startsWith(o))||t.push(`%TAG ${i} ${o}`);return t.join("\n")}}function N(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){const t=JSON.stringify(e);throw new Error(`Anchor must not contain whitespace or control characters: ${t}`)}return!0}function O(e){const t=new Set;return w(e,{Value(e,s){s.anchor&&t.add(s.anchor)}}),t}function A(e,t){for(let s=1;;++s){const n=`${e}${s}`;if(!t.has(n))return n}}function I(e,t,s,n){if(n&&"object"==typeof n)if(Array.isArray(n))for(let i=0,o=n.length;i<o;++i){const t=n[i],s=I(e,n,String(i),t);void 0===s?delete n[i]:s!==t&&(n[i]=s)}else if(n instanceof Map)for(const i of Array.from(n.keys())){const t=n.get(i),s=I(e,n,i,t);void 0===s?n.delete(i):s!==t&&n.set(i,s)}else if(n instanceof Set)for(const i of Array.from(n)){const t=I(e,n,i,i);void 0===t?n.delete(i):t!==i&&(n.delete(i),n.add(t))}else for(const[i,o]of Object.entries(n)){const t=I(e,n,i,o);void 0===t?delete n[i]:t!==o&&(n[i]=t)}return e.call(t,s,n)}function T(e,t,s){if(Array.isArray(e))return e.map((e,t)=>T(e,String(t),s));if(e&&"function"==typeof e.toJSON){if(!s||!m(e))return e.toJSON(t,s);const n={aliasCount:0,count:1,res:void 0};s.anchors.set(e,n),s.onCreate=e=>{n.res=e,delete s.onCreate};const i=e.toJSON(t,s);return s.onCreate&&s.onCreate(i),i}return"bigint"!=typeof e||s?.keep?e:Number(e)}E.defaultYaml={explicit:!1,version:"1.2"},E.defaultTags={"!!":"tag:yaml.org,2002:"};class x{constructor(e){Object.defineProperty(this,r,{value:e})}clone(){const e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:s,onAnchor:n,reviver:i}={}){if(!c(e))throw new TypeError("A document argument is required");const o={anchors:new Map,doc:e,keep:!0,mapAsMap:!0===t,mapKeyWarned:!1,maxAliasCount:"number"==typeof s?s:100},r=T(this,"",o);if("function"==typeof n)for(const{count:a,res:c}of o.anchors.values())n(c,a);return"function"==typeof i?I(i,{"":r},"",r):r}}class L extends x{constructor(t){super(e),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,t){let s,n;t?.aliasResolveCache?s=t.aliasResolveCache:(s=[],w(e,{Node:(e,t)=>{(a(t)||m(t))&&s.push(t)}}),t&&(t.aliasResolveCache=s));for(const i of s){if(i===this)break;i.anchor===this.source&&(n=i)}return n}toJSON(e,t){if(!t)return{source:this.source};const{anchors:s,doc:n,maxAliasCount:i}=t,o=this.resolve(n,t);if(!o){const e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(e)}let r=s.get(o);if(r||(T(o,null,t),r=s.get(o)),void 0===r?.res){throw new ReferenceError("This should not happen: Alias anchor was not resolved?")}if(i>=0&&(r.count+=1,0===r.aliasCount&&(r.aliasCount=$(n,o,s)),r.count*r.aliasCount>i)){throw new ReferenceError("Excessive alias count indicates a resource exhaustion attack")}return r.res}toString(e,t,s){const n=`*${this.source}`;if(e){if(N(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){const e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(e)}if(e.implicitKey)return`${n} `}return n}}function $(e,t,s){if(a(t)){const n=t.resolve(e),i=s&&n&&s.get(n);return i?i.count*i.aliasCount:0}if(d(t)){let n=0;for(const i of t.items){const t=$(e,i,s);t>n&&(n=t)}return n}if(u(t)){const n=$(e,t.key,s),i=$(e,t.value,s);return Math.max(n,i)}return 1}const C=e=>!e||"function"!=typeof e&&"object"!=typeof e;class _ extends x{constructor(e){super(i),this.value=e}toJSON(e,t){return t?.keep?this.value:T(this.value,e,t)}toString(){return String(this.value)}}_.BLOCK_FOLDED="BLOCK_FOLDED",_.BLOCK_LITERAL="BLOCK_LITERAL",_.PLAIN="PLAIN",_.QUOTE_DOUBLE="QUOTE_DOUBLE",_.QUOTE_SINGLE="QUOTE_SINGLE";function B(e,t,n){if(c(e)&&(e=e.contents),p(e))return e;if(u(e)){const t=n.schema[s].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||"undefined"!=typeof BigInt&&e instanceof BigInt)&&(e=e.valueOf());const{aliasDuplicateObjects:i,onAnchor:r,onTagObj:a,schema:l,sourceObjects:h}=n;let f;if(i&&e&&"object"==typeof e){if(f=h.get(e),f)return f.anchor??(f.anchor=r(e)),new L(f.anchor);f={anchor:null,node:null},h.set(e,f)}t?.startsWith("!!")&&(t="tag:yaml.org,2002:"+t.slice(2));let d=function(e,t,s){if(t){const e=s.filter(e=>e.tag===t),n=e.find(e=>!e.format)??e[0];if(!n)throw new Error(`Tag ${t} not found`);return n}return s.find(t=>t.identify?.(e)&&!t.format)}(e,t,l.tags);if(!d){if(e&&"function"==typeof e.toJSON&&(e=e.toJSON()),!e||"object"!=typeof e){const t=new _(e);return f&&(f.node=t),t}d=e instanceof Map?l[s]:Symbol.iterator in Object(e)?l[o]:l[s]}a&&(a(d),delete n.onTagObj);const m=d?.createNode?d.createNode(n.schema,e,n):"function"==typeof d?.nodeClass?.from?d.nodeClass.from(n.schema,e,n):new _(e);return t?m.tag=t:d.default||(m.tag=d.tag),f&&(f.node=m),m}function K(e,t,s){let n=s;for(let i=t.length-1;i>=0;--i){const e=t[i];if("number"==typeof e&&Number.isInteger(e)&&e>=0){const t=[];t[e]=n,n=t}else n=new Map([[e,n]])}return B(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}const j=e=>null==e||"object"==typeof e&&!!e[Symbol.iterator]().next().done;class M extends x{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(t=>p(t)||u(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(j(e))this.add(t);else{const[s,...n]=e,i=this.get(s,!0);if(d(i))i.addIn(n,t);else{if(void 0!==i||!this.schema)throw new Error(`Expected YAML collection at ${s}. Remaining path: ${n}`);this.set(s,K(this.schema,n,t))}}}deleteIn(e){const[t,...s]=e;if(0===s.length)return this.delete(t);const n=this.get(t,!0);if(d(n))return n.deleteIn(s);throw new Error(`Expected YAML collection at ${t}. Remaining path: ${s}`)}getIn(e,t){const[s,...n]=e,i=this.get(s,!0);return 0===n.length?!t&&h(i)?i.value:i:d(i)?i.getIn(n,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!u(t))return!1;const s=t.value;return null==s||e&&h(s)&&null==s.value&&!s.commentBefore&&!s.comment&&!s.tag})}hasIn(e){const[t,...s]=e;if(0===s.length)return this.has(t);const n=this.get(t,!0);return!!d(n)&&n.hasIn(s)}setIn(e,t){const[s,...n]=e;if(0===n.length)this.set(s,t);else{const e=this.get(s,!0);if(d(e))e.setIn(n,t);else{if(void 0!==e||!this.schema)throw new Error(`Expected YAML collection at ${s}. Remaining path: ${n}`);this.set(s,K(this.schema,n,t))}}}}const D=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function q(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}const P=(e,t,s)=>e.endsWith("\n")?q(s,t):s.includes("\n")?"\n"+q(s,t):(e.endsWith(" ")?"":" ")+s,U="flow",R="block",F="quoted";function V(e,t,s="flow",{indentAtStart:n,lineWidth:i=80,minContentWidth:o=20,onFold:r,onOverflow:a}={}){if(!i||i<0)return e;i<o&&(o=0);const c=Math.max(1+o,1+i-t.length);if(e.length<=c)return e;const l=[],u={};let h,f,d=i-t.length;"number"==typeof n&&(n>i-Math.max(2,o)?l.push(0):d=i-n);let p=!1,m=-1,g=-1,y=-1;s===R&&(m=J(e,m,t.length),-1!==m&&(d=m+c));for(let w;w=e[m+=1];){if(s===F&&"\\"===w){switch(g=m,e[m+1]){case"x":m+=3;break;case"u":m+=5;break;case"U":m+=9;break;default:m+=1}y=m}if("\n"===w)s===R&&(m=J(e,m,t.length)),d=m+t.length+c,h=void 0;else{if(" "===w&&f&&" "!==f&&"\n"!==f&&"\t"!==f){const t=e[m+1];t&&" "!==t&&"\n"!==t&&"\t"!==t&&(h=m)}if(m>=d)if(h)l.push(h),d=h+c,h=void 0;else if(s===F){for(;" "===f||"\t"===f;)f=w,w=e[m+=1],p=!0;const t=m>y+1?m-2:g-1;if(u[t])return e;l.push(t),u[t]=!0,d=t+c,h=void 0}else p=!0}f=w}if(p&&a&&a(),0===l.length)return e;r&&r();let b=e.slice(0,l[0]);for(let w=0;w<l.length;++w){const n=l[w],i=l[w+1]||e.length;0===n?b=`\n${t}${e.slice(0,i)}`:(s===F&&u[n]&&(b+=`${e[n]}\\`),b+=`\n${t}${e.slice(n+1,i)}`)}return b}function J(e,t,s){let n=t,i=t+1,o=e[i];for(;" "===o||"\t"===o;)if(t<i+s)o=e[++t];else{do{o=e[++t]}while(o&&"\n"!==o);n=t,i=t+1,o=e[i]}return n}const Y=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),G=e=>/^(%|---|\.\.\.)/m.test(e);function W(e,t){const s=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return s;const{implicitKey:n}=t,i=t.options.doubleQuotedMinMultiLineLength,o=t.indent||(G(e)?" ":"");let r="",a=0;for(let c=0,l=s[c];l;l=s[++c])if(" "===l&&"\\"===s[c+1]&&"n"===s[c+2]&&(r+=s.slice(a,c)+"\\ ",c+=1,a=c,l="\\"),"\\"===l)switch(s[c+1]){case"u":{r+=s.slice(a,c);const e=s.substr(c+2,4);switch(e){case"0000":r+="\\0";break;case"0007":r+="\\a";break;case"000b":r+="\\v";break;case"001b":r+="\\e";break;case"0085":r+="\\N";break;case"00a0":r+="\\_";break;case"2028":r+="\\L";break;case"2029":r+="\\P";break;default:"00"===e.substr(0,2)?r+="\\x"+e.substr(2):r+=s.substr(c,6)}c+=5,a=c+1}break;case"n":if(n||'"'===s[c+2]||s.length<i)c+=1;else{for(r+=s.slice(a,c)+"\n\n";"\\"===s[c+2]&&"n"===s[c+3]&&'"'!==s[c+4];)r+="\n",c+=2;r+=o," "===s[c+2]&&(r+="\\"),c+=1,a=c+1}break;default:c+=1}return r=a?r+s.slice(a):s,n?r:V(r,o,F,Y(t,!1))}function H(e,t){if(!1===t.options.singleQuote||t.implicitKey&&e.includes("\n")||/[ \t]\n|\n[ \t]/.test(e))return W(e,t);const s=t.indent||(G(e)?" ":""),n="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&\n${s}`)+"'";return t.implicitKey?n:V(n,s,U,Y(t,!1))}function Q(e,t){const{singleQuote:s}=t.options;let n;if(!1===s)n=W;else{const t=e.includes('"'),i=e.includes("'");n=t&&!i?H:i&&!t?W:s?H:W}return n(e,t)}let X;try{X=new RegExp("(^|(?<!\n))\n+(?!\n|$)","g")}catch{X=/\n+(?!\n|$)/g}function z({comment:e,type:t,value:s},n,i,o){const{blockQuote:r,commentString:a,lineWidth:c}=n.options;if(!r||/\n[\t ]+$/.test(s))return Q(s,n);const l=n.indent||(n.forceBlockIndent||G(s)?" ":""),u="literal"===r||"folded"!==r&&t!==_.BLOCK_FOLDED&&(t===_.BLOCK_LITERAL||!function(e,t,s){if(!t||t<0)return!1;const n=t-s,i=e.length;if(i<=n)return!1;for(let o=0,r=0;o<i;++o)if("\n"===e[o]){if(o-r>n)return!0;if(r=o+1,i-r<=n)return!1}return!0}(s,c,l.length));if(!s)return u?"|\n":">\n";let h,f;for(f=s.length;f>0;--f){const e=s[f-1];if("\n"!==e&&"\t"!==e&&" "!==e)break}let d=s.substring(f);const p=d.indexOf("\n");-1===p?h="-":s===d||p!==d.length-1?(h="+",o&&o()):h="",d&&(s=s.slice(0,-d.length),"\n"===d[d.length-1]&&(d=d.slice(0,-1)),d=d.replace(X,`$&${l}`));let m,g=!1,y=-1;for(m=0;m<s.length;++m){const e=s[m];if(" "===e)g=!0;else{if("\n"!==e)break;y=m}}let b=s.substring(0,y<m?y+1:m);b&&(s=s.substring(b.length),b=b.replace(/\n+/g,`$&${l}`));let w=(g?l?"2":"1":"")+h;if(e&&(w+=" "+a(e.replace(/ ?[\r\n]+/g," ")),i&&i()),!u){const e=s.replace(/\n+/g,"\n$&").replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`);let i=!1;const o=Y(n,!0);"folded"!==r&&t!==_.BLOCK_FOLDED&&(o.onOverflow=()=>{i=!0});const a=V(`${b}${e}${d}`,l,R,o);if(!i)return`>${w}\n${l}${a}`}return`|${w}\n${l}${b}${s=s.replace(/\n+/g,`$&${l}`)}${d}`}function Z(e,t,s,n){const{implicitKey:i,inFlow:o}=t,r="string"==typeof e.value?e:Object.assign({},e,{value:String(e.value)});let{type:a}=e;a!==_.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(r.value)&&(a=_.QUOTE_DOUBLE);const c=e=>{switch(e){case _.BLOCK_FOLDED:case _.BLOCK_LITERAL:return i||o?Q(r.value,t):z(r,t,s,n);case _.QUOTE_DOUBLE:return W(r.value,t);case _.QUOTE_SINGLE:return H(r.value,t);case _.PLAIN:return function(e,t,s,n){const{type:i,value:o}=e,{actualString:r,implicitKey:a,indent:c,indentStep:l,inFlow:u}=t;if(a&&o.includes("\n")||u&&/[[\]{},]/.test(o))return Q(o,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes("\n")?Q(o,t):z(e,t,s,n);if(!a&&!u&&i!==_.PLAIN&&o.includes("\n"))return z(e,t,s,n);if(G(o)){if(""===c)return t.forceBlockIndent=!0,z(e,t,s,n);if(a&&c===l)return Q(o,t)}const h=o.replace(/\n+/g,`$&\n${c}`);if(r){const e=e=>e.default&&"tag:yaml.org,2002:str"!==e.tag&&e.test?.test(h),{compat:s,tags:n}=t.doc.schema;if(n.some(e)||s?.some(e))return Q(o,t)}return a?h:V(h,c,U,Y(t,!1))}(r,t,s,n);default:return null}};let l=c(a);if(null===l){const{defaultKeyType:e,defaultStringType:s}=t.options,n=i&&e||s;if(l=c(n),null===l)throw new Error(`Unsupported default string type ${n}`)}return l}function ee(e,t){const s=Object.assign({blockQuote:!0,commentString:D,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},e.schema.toStringOptions,t);let n;switch(s.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:e,flowCollectionPadding:s.flowCollectionPadding?" ":"",indent:"",indentStep:"number"==typeof s.indent?" ".repeat(s.indent):" ",inFlow:n,options:s}}function te(e,t,s,n){if(u(e))return e.toString(t,s,n);if(a(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw new TypeError("Cannot stringify circular structure without alias nodes");t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let i;const o=p(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??(i=function(e,t){if(t.tag){const s=e.filter(e=>e.tag===t.tag);if(s.length>0)return s.find(e=>e.format===t.format)??s[0]}let s,n;if(h(t)){n=t.value;let i=e.filter(e=>e.identify?.(n));if(i.length>1){const e=i.filter(e=>e.test);e.length>0&&(i=e)}s=i.find(e=>e.format===t.format)??i.find(e=>!e.format)}else n=t,s=e.find(e=>e.nodeClass&&n instanceof e.nodeClass);if(!s)throw new Error(`Tag not resolved for ${n?.constructor?.name??(null===n?"null":typeof n)} value`);return s}(t.doc.schema.tags,o));const r=function(e,t,{anchors:s,doc:n}){if(!n.directives)return"";const i=[],o=(h(e)||d(e))&&e.anchor;o&&N(o)&&(s.add(o),i.push(`&${o}`));const r=e.tag??(t.default?null:t.tag);return r&&i.push(n.directives.tagString(r)),i.join(" ")}(o,i,t);r.length>0&&(t.indentAtStart=(t.indentAtStart??0)+r.length+1);const c="function"==typeof i.stringify?i.stringify(o,t,s,n):h(o)?Z(o,t,s,n):o.toString(t,s,n);return r?h(o)||"{"===c[0]||"["===c[0]?`${r} ${c}`:`${r}\n${t.indent}${c}`:c}function se(e,t){"debug"!==e&&"warn"!==e||console.warn(t)}const ne="<<",ie={identify:e=>e===ne||"symbol"==typeof e&&e.description===ne,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new _(Symbol(ne)),{addToJSMap:oe}),stringify:()=>ne};function oe(e,t,s){if(s=e&&a(s)?s.resolve(e.doc):s,f(s))for(const n of s.items)re(e,t,n);else if(Array.isArray(s))for(const n of s)re(e,t,n);else re(e,t,s)}function re(e,t,s){const n=e&&a(s)?s.resolve(e.doc):s;if(!l(n))throw new Error("Merge sources must be maps or map aliases");const i=n.toJSON(null,e,Map);for(const[o,r]of i)t instanceof Map?t.has(o)||t.set(o,r):t instanceof Set?t.add(o):Object.prototype.hasOwnProperty.call(t,o)||Object.defineProperty(t,o,{value:r,writable:!0,enumerable:!0,configurable:!0});return t}function ae(e,t,{key:s,value:n}){if(p(s)&&s.addToJSMap)s.addToJSMap(e,t,n);else if(((e,t)=>(ie.identify(t)||h(t)&&(!t.type||t.type===_.PLAIN)&&ie.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===ie.tag&&e.default))(e,s))oe(e,t,n);else{const i=T(s,"",e);if(t instanceof Map)t.set(i,T(n,i,e));else if(t instanceof Set)t.add(i);else{const o=function(e,t,s){if(null===t)return"";if("object"!=typeof t)return String(t);if(p(e)&&s?.doc){const t=ee(s.doc,{});t.anchors=new Set;for(const e of s.anchors.keys())t.anchors.add(e.anchor);t.inFlow=!0,t.inStringifyKey=!0;const n=e.toString(t);if(!s.mapKeyWarned){let e=JSON.stringify(n);e.length>40&&(e=e.substring(0,36)+'..."'),se(s.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${e}. Set mapAsMap: true to use object keys.`),s.mapKeyWarned=!0}return n}return JSON.stringify(t)}(s,i,e),r=T(n,o,e);o in t?Object.defineProperty(t,o,{value:r,writable:!0,enumerable:!0,configurable:!0}):t[o]=r}}return t}function ce(e,t,s){const n=B(e,void 0,s),i=B(t,void 0,s);return new le(n,i)}class le{constructor(e,t=null){Object.defineProperty(this,r,{value:n}),this.key=e,this.value=t}clone(e){let{key:t,value:s}=this;return p(t)&&(t=t.clone(e)),p(s)&&(s=s.clone(e)),new le(t,s)}toJSON(e,t){return ae(t,t?.mapAsMap?new Map:{},this)}toString(e,t,s){return e?.doc?function({key:e,value:t},s,n,i){const{allNullValues:o,doc:r,indent:a,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:m}}=s;let g=p(e)&&e.comment||null;if(m){if(g)throw new Error("With simple keys, key nodes cannot have comments");if(d(e)||!p(e)&&"object"==typeof e)throw new Error("With simple keys, collection cannot be used as a key value")}let y=!m&&(!e||g&&null==t&&!s.inFlow||d(e)||(h(e)?e.type===_.BLOCK_FOLDED||e.type===_.BLOCK_LITERAL:"object"==typeof e));s=Object.assign({},s,{allNullValues:!1,implicitKey:!y&&(m||!o),indent:a+c});let b,w,k,v=!1,S=!1,E=te(e,s,()=>v=!0,()=>S=!0);if(!y&&!s.inFlow&&E.length>1024){if(m)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");y=!0}if(s.inFlow){if(o||null==t)return v&&n&&n(),""===E?"?":y?`? ${E}`:E}else if(o&&!m||null==t&&y)return E=`? ${E}`,g&&!v?E+=P(E,s.indent,l(g)):S&&i&&i(),E;v&&(g=null),y?(g&&(E+=P(E,s.indent,l(g))),E=`? ${E}\n${a}:`):(E=`${E}:`,g&&(E+=P(E,s.indent,l(g)))),p(t)?(b=!!t.spaceBefore,w=t.commentBefore,k=t.comment):(b=!1,w=null,k=null,t&&"object"==typeof t&&(t=r.createNode(t))),s.implicitKey=!1,y||g||!h(t)||(s.indentAtStart=E.length+1),S=!1,u||!(c.length>=2)||s.inFlow||y||!f(t)||t.flow||t.tag||t.anchor||(s.indent=s.indent.substring(2));let N=!1;const O=te(t,s,()=>N=!0,()=>S=!0);let A=" ";if(g||b||w)A=b?"\n":"",w&&(A+=`\n${q(l(w),s.indent)}`),""!==O||s.inFlow?A+=`\n${s.indent}`:"\n"===A&&k&&(A="\n\n");else if(!y&&d(t)){const e=O[0],n=O.indexOf("\n"),i=-1!==n,o=s.inFlow??t.flow??0===t.items.length;if(i||!o){let t=!1;if(i&&("&"===e||"!"===e)){let s=O.indexOf(" ");"&"===e&&-1!==s&&s<n&&"!"===O[s+1]&&(s=O.indexOf(" ",s+1)),(-1===s||n<s)&&(t=!0)}t||(A=`\n${s.indent}`)}}else""!==O&&"\n"!==O[0]||(A="");return E+=A+O,s.inFlow?N&&n&&n():k&&!N?E+=P(E,s.indent,l(k)):S&&i&&i(),E}(this,e,t,s):JSON.stringify(this)}}function ue(e,t,s){return(t.inFlow??e.flow?fe:he)(e,t,s)}function he({comment:e,items:t},s,{blockItemPrefix:n,flowChars:i,itemIndent:o,onChompKeep:r,onComment:a}){const{indent:c,options:{commentString:l}}=s,h=Object.assign({},s,{indent:o,type:null});let f=!1;const d=[];for(let g=0;g<t.length;++g){const e=t[g];let i=null;if(p(e))!f&&e.spaceBefore&&d.push(""),de(s,d,e.commentBefore,f),e.comment&&(i=e.comment);else if(u(e)){const t=p(e.key)?e.key:null;t&&(!f&&t.spaceBefore&&d.push(""),de(s,d,t.commentBefore,f))}f=!1;let r=te(e,h,()=>i=null,()=>f=!0);i&&(r+=P(r,o,l(i))),f&&i&&(f=!1),d.push(n+r)}let m;if(0===d.length)m=i.start+i.end;else{m=d[0];for(let e=1;e<d.length;++e){const t=d[e];m+=t?`\n${c}${t}`:"\n"}}return e?(m+="\n"+q(l(e),c),a&&a()):f&&r&&r(),m}function fe({items:e},t,{flowChars:s,itemIndent:n}){const{indent:i,indentStep:o,flowCollectionPadding:r,options:{commentString:a}}=t;n+=o;const c=Object.assign({},t,{indent:n,inFlow:!0,type:null});let l=!1,h=0;const f=[];for(let g=0;g<e.length;++g){const s=e[g];let i=null;if(p(s))s.spaceBefore&&f.push(""),de(t,f,s.commentBefore,!1),s.comment&&(i=s.comment);else if(u(s)){const e=p(s.key)?s.key:null;e&&(e.spaceBefore&&f.push(""),de(t,f,e.commentBefore,!1),e.comment&&(l=!0));const n=p(s.value)?s.value:null;n?(n.comment&&(i=n.comment),n.commentBefore&&(l=!0)):null==s.value&&e?.comment&&(i=e.comment)}i&&(l=!0);let o=te(s,c,()=>i=null);g<e.length-1&&(o+=","),i&&(o+=P(o,n,a(i))),!l&&(f.length>h||o.includes("\n"))&&(l=!0),f.push(o),h=f.length}const{start:d,end:m}=s;if(0===f.length)return d+m;if(!l){const e=f.reduce((e,t)=>e+t.length+2,2);l=t.options.lineWidth>0&&e>t.options.lineWidth}if(l){let e=d;for(const t of f)e+=t?`\n${o}${i}${t}`:"\n";return`${e}\n${i}${m}`}return`${d}${r}${f.join(" ")}${r}${m}`}function de({indent:e,options:{commentString:t}},s,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){const i=q(t(n),e);s.push(i.trimStart())}}function pe(e,t){const s=h(t)?t.value:t;for(const n of e)if(u(n)){if(n.key===t||n.key===s)return n;if(h(n.key)&&n.key.value===s)return n}}class me extends M{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(s,e),this.items=[]}static from(e,t,s){const{keepUndefined:n,replacer:i}=s,o=new this(e),r=(e,r)=>{if("function"==typeof i)r=i.call(t,e,r);else if(Array.isArray(i)&&!i.includes(e))return;(void 0!==r||n)&&o.items.push(ce(e,r,s))};if(t instanceof Map)for(const[a,c]of t)r(a,c);else if(t&&"object"==typeof t)for(const a of Object.keys(t))r(a,t[a]);return"function"==typeof e.sortMapEntries&&o.items.sort(e.sortMapEntries),o}add(e,t){let s;s=u(e)?e:e&&"object"==typeof e&&"key"in e?new le(e.key,e.value):new le(e,e?.value);const n=pe(this.items,s.key),i=this.schema?.sortMapEntries;if(n){if(!t)throw new Error(`Key ${s.key} already set`);h(n.value)&&C(s.value)?n.value.value=s.value:n.value=s.value}else if(i){const e=this.items.findIndex(e=>i(s,e)<0);-1===e?this.items.push(s):this.items.splice(e,0,s)}else this.items.push(s)}delete(e){const t=pe(this.items,e);if(!t)return!1;return this.items.splice(this.items.indexOf(t),1).length>0}get(e,t){const s=pe(this.items,e),n=s?.value;return(!t&&h(n)?n.value:n)??void 0}has(e){return!!pe(this.items,e)}set(e,t){this.add(new le(e,t),!0)}toJSON(e,t,s){const n=s?new s:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(n);for(const i of this.items)ae(t,n,i);return n}toString(e,t,s){if(!e)return JSON.stringify(this);for(const n of this.items)if(!u(n))throw new Error(`Map items must all be pairs; found ${JSON.stringify(n)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),ue(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:s,onComment:t})}}const ge={collection:"map",default:!0,nodeClass:me,tag:"tag:yaml.org,2002:map",resolve:(e,t)=>(l(e)||t("Expected a mapping for this tag"),e),createNode:(e,t,s)=>me.from(e,t,s)};class ye extends M{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(o,e),this.items=[]}add(e){this.items.push(e)}delete(e){const t=be(e);if("number"!=typeof t)return!1;return this.items.splice(t,1).length>0}get(e,t){const s=be(e);if("number"!=typeof s)return;const n=this.items[s];return!t&&h(n)?n.value:n}has(e){const t=be(e);return"number"==typeof t&&t<this.items.length}set(e,t){const s=be(e);if("number"!=typeof s)throw new Error(`Expected a valid index, not ${e}.`);const n=this.items[s];h(n)&&C(t)?n.value=t:this.items[s]=t}toJSON(e,t){const s=[];t?.onCreate&&t.onCreate(s);let n=0;for(const i of this.items)s.push(T(i,String(n++),t));return s}toString(e,t,s){return e?ue(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:s,onComment:t}):JSON.stringify(this)}static from(e,t,s){const{replacer:n}=s,i=new this(e);if(t&&Symbol.iterator in Object(t)){let e=0;for(let o of t){if("function"==typeof n){const s=t instanceof Set?o:String(e++);o=n.call(t,s,o)}i.items.push(B(o,void 0,s))}}return i}}function be(e){let t=h(e)?e.value:e;return t&&"string"==typeof t&&(t=Number(t)),"number"==typeof t&&Number.isInteger(t)&&t>=0?t:null}const we={collection:"seq",default:!0,nodeClass:ye,tag:"tag:yaml.org,2002:seq",resolve:(e,t)=>(f(e)||t("Expected a sequence for this tag"),e),createNode:(e,t,s)=>ye.from(e,t,s)},ke={identify:e=>"string"==typeof e,default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:(e,t,s,n)=>Z(e,t=Object.assign({actualString:!0},t),s,n)},ve={identify:e=>null==e,createNode:()=>new _(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new _(null),stringify:({source:e},t)=>"string"==typeof e&&ve.test.test(e)?e:t.options.nullStr},Se={identify:e=>"boolean"==typeof e,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new _("t"===e[0]||"T"===e[0]),stringify({source:e,value:t},s){if(e&&Se.test.test(e)){if(t===("t"===e[0]||"T"===e[0]))return e}return t?s.options.trueStr:s.options.falseStr}};function Ee({format:e,minFractionDigits:t,tag:s,value:n}){if("bigint"==typeof n)return String(n);const i="number"==typeof n?n:Number(n);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let o=Object.is(n,-0)?"-0":JSON.stringify(n);if(!e&&t&&(!s||"tag:yaml.org,2002:float"===s)&&/^\d/.test(o)){let e=o.indexOf(".");e<0&&(e=o.length,o+=".");let s=t-(o.length-e-1);for(;s-- >0;)o+="0"}return o}const Ne={identify:e=>"number"==typeof e,default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>"nan"===e.slice(-3).toLowerCase()?NaN:"-"===e[0]?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Ee},Oe={identify:e=>"number"==typeof e,default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){const t=Number(e.value);return isFinite(t)?t.toExponential():Ee(e)}},Ae={identify:e=>"number"==typeof e,default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){const t=new _(parseFloat(e)),s=e.indexOf(".");return-1!==s&&"0"===e[e.length-1]&&(t.minFractionDigits=e.length-s-1),t},stringify:Ee},Ie=e=>"bigint"==typeof e||Number.isInteger(e),Te=(e,t,s,{intAsBigInt:n})=>n?BigInt(e):parseInt(e.substring(t),s);function xe(e,t,s){const{value:n}=e;return Ie(n)&&n>=0?s+n.toString(t):Ee(e)}const Le={identify:e=>Ie(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,s)=>Te(e,2,8,s),stringify:e=>xe(e,8,"0o")},$e={identify:Ie,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,s)=>Te(e,0,10,s),stringify:Ee},Ce={identify:e=>Ie(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,s)=>Te(e,2,16,s),stringify:e=>xe(e,16,"0x")},_e=[ge,we,ke,ve,Se,Le,$e,Ce,Ne,Oe,Ae];function Be(e){return"bigint"==typeof e||Number.isInteger(e)}const Ke=({value:e})=>JSON.stringify(e),je=[ge,we].concat([{identify:e=>"string"==typeof e,default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:Ke},{identify:e=>null==e,createNode:()=>new _(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Ke},{identify:e=>"boolean"==typeof e,default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>"true"===e,stringify:Ke},{identify:Be,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:s})=>s?BigInt(e):parseInt(e,10),stringify:({value:e})=>Be(e)?e.toString():JSON.stringify(e)},{identify:e=>"number"==typeof e,default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:Ke}],{default:!0,tag:"",test:/^/,resolve:(e,t)=>(t(`Unresolved plain scalar ${JSON.stringify(e)}`),e)}),Me={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if("function"==typeof atob){const t=atob(e.replace(/[\n\r]/g,"")),s=new Uint8Array(t.length);for(let e=0;e<t.length;++e)s[e]=t.charCodeAt(e);return s}return t("This environment does not support reading binary tags; either Buffer or atob is required"),e},stringify({comment:e,type:t,value:s},n,i,o){if(!s)return"";const r=s;let a;if("function"!=typeof btoa)throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");{let e="";for(let t=0;t<r.length;++t)e+=String.fromCharCode(r[t]);a=btoa(e)}if(t??(t=_.BLOCK_LITERAL),t!==_.QUOTE_DOUBLE){const e=Math.max(n.options.lineWidth-n.indent.length,n.options.minContentWidth),s=Math.ceil(a.length/e),i=new Array(s);for(let t=0,n=0;t<s;++t,n+=e)i[t]=a.substr(n,e);a=i.join(t===_.BLOCK_LITERAL?"\n":" ")}return Z({comment:e,type:t,value:a},n,i,o)}};function De(e,t){if(f(e))for(let s=0;s<e.items.length;++s){let n=e.items[s];if(!u(n)){if(l(n)){n.items.length>1&&t("Each pair must have its own sequence indicator");const e=n.items[0]||new le(new _(null));if(n.commentBefore&&(e.key.commentBefore=e.key.commentBefore?`${n.commentBefore}\n${e.key.commentBefore}`:n.commentBefore),n.comment){const t=e.value??e.key;t.comment=t.comment?`${n.comment}\n${t.comment}`:n.comment}n=e}e.items[s]=u(n)?n:new le(n)}}else t("Expected a sequence for this tag");return e}function qe(e,t,s){const{replacer:n}=s,i=new ye(e);i.tag="tag:yaml.org,2002:pairs";let o=0;if(t&&Symbol.iterator in Object(t))for(let r of t){let e,a;if("function"==typeof n&&(r=n.call(t,String(o++),r)),Array.isArray(r)){if(2!==r.length)throw new TypeError(`Expected [key, value] tuple: ${r}`);e=r[0],a=r[1]}else if(r&&r instanceof Object){const t=Object.keys(r);if(1!==t.length)throw new TypeError(`Expected tuple with one key, not ${t.length} keys`);e=t[0],a=r[e]}else e=r;i.items.push(ce(e,a,s))}return i}const Pe={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:De,createNode:qe};class Ue extends ye{constructor(){super(),this.add=me.prototype.add.bind(this),this.delete=me.prototype.delete.bind(this),this.get=me.prototype.get.bind(this),this.has=me.prototype.has.bind(this),this.set=me.prototype.set.bind(this),this.tag=Ue.tag}toJSON(e,t){if(!t)return super.toJSON(e);const s=new Map;t?.onCreate&&t.onCreate(s);for(const n of this.items){let e,i;if(u(n)?(e=T(n.key,"",t),i=T(n.value,e,t)):e=T(n,"",t),s.has(e))throw new Error("Ordered maps must not include duplicate keys");s.set(e,i)}return s}static from(e,t,s){const n=qe(e,t,s),i=new this;return i.items=n.items,i}}Ue.tag="tag:yaml.org,2002:omap";const Re={collection:"seq",identify:e=>e instanceof Map,nodeClass:Ue,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){const s=De(e,t),n=[];for(const{key:i}of s.items)h(i)&&(n.includes(i.value)?t(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new Ue,s)},createNode:(e,t,s)=>Ue.from(e,t,s)};function Fe({value:e,source:t},s){return t&&(e?Ve:Je).test.test(t)?t:e?s.options.trueStr:s.options.falseStr}const Ve={identify:e=>!0===e,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new _(!0),stringify:Fe},Je={identify:e=>!1===e,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new _(!1),stringify:Fe},Ye={identify:e=>"number"==typeof e,default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>"nan"===e.slice(-3).toLowerCase()?NaN:"-"===e[0]?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Ee},Ge={identify:e=>"number"==typeof e,default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){const t=Number(e.value);return isFinite(t)?t.toExponential():Ee(e)}},We={identify:e=>"number"==typeof e,default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){const t=new _(parseFloat(e.replace(/_/g,""))),s=e.indexOf(".");if(-1!==s){const n=e.substring(s+1).replace(/_/g,"");"0"===n[n.length-1]&&(t.minFractionDigits=n.length)}return t},stringify:Ee},He=e=>"bigint"==typeof e||Number.isInteger(e);function Qe(e,t,s,{intAsBigInt:n}){const i=e[0];if("-"!==i&&"+"!==i||(t+=1),e=e.substring(t).replace(/_/g,""),n){switch(s){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`}const t=BigInt(e);return"-"===i?BigInt(-1)*t:t}const o=parseInt(e,s);return"-"===i?-1*o:o}function Xe(e,t,s){const{value:n}=e;if(He(n)){const e=n.toString(t);return n<0?"-"+s+e.substr(1):s+e}return Ee(e)}const ze={identify:He,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,s)=>Qe(e,2,2,s),stringify:e=>Xe(e,2,"0b")},Ze={identify:He,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,s)=>Qe(e,1,8,s),stringify:e=>Xe(e,8,"0")},et={identify:He,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,s)=>Qe(e,0,10,s),stringify:Ee},tt={identify:He,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,s)=>Qe(e,2,16,s),stringify:e=>Xe(e,16,"0x")};class st extends me{constructor(e){super(e),this.tag=st.tag}add(e){let t;t=u(e)?e:e&&"object"==typeof e&&"key"in e&&"value"in e&&null===e.value?new le(e.key,null):new le(e,null);pe(this.items,t.key)||this.items.push(t)}get(e,t){const s=pe(this.items,e);return!t&&u(s)?h(s.key)?s.key.value:s.key:s}set(e,t){if("boolean"!=typeof t)throw new Error("Expected boolean value for set(key, value) in a YAML set, not "+typeof t);const s=pe(this.items,e);s&&!t?this.items.splice(this.items.indexOf(s),1):!s&&t&&this.items.push(new le(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,s){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,s);throw new Error("Set items must all have null values")}static from(e,t,s){const{replacer:n}=s,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let o of t)"function"==typeof n&&(o=n.call(t,o,o)),i.items.push(ce(o,null,s));return i}}st.tag="tag:yaml.org,2002:set";const nt={collection:"map",identify:e=>e instanceof Set,nodeClass:st,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,s)=>st.from(e,t,s),resolve(e,t){if(l(e)){if(e.hasAllNullValues(!0))return Object.assign(new st,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};function it(e,t){const s=e[0],n="-"===s||"+"===s?e.substring(1):e,i=e=>t?BigInt(e):Number(e),o=n.replace(/_/g,"").split(":").reduce((e,t)=>e*i(60)+i(t),i(0));return"-"===s?i(-1)*o:o}function ot(e){let{value:t}=e,s=e=>e;if("bigint"==typeof t)s=e=>BigInt(e);else if(isNaN(t)||!isFinite(t))return Ee(e);let n="";t<0&&(n="-",t*=s(-1));const i=s(60),o=[t%i];return t<60?o.unshift(0):(t=(t-o[0])/i,o.unshift(t%i),t>=60&&(t=(t-o[0])/i,o.unshift(t))),n+o.map(e=>String(e).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}const rt={identify:e=>"bigint"==typeof e||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:s})=>it(e,s),stringify:ot},at={identify:e=>"number"==typeof e,default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>it(e,!1),stringify:ot},ct={identify:e=>e instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(e){const t=e.match(ct.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");const[,s,n,i,o,r,a]=t.map(Number),c=t[7]?Number((t[7]+"00").substr(1,3)):0;let l=Date.UTC(s,n-1,i,o||0,r||0,a||0,c);const u=t[8];if(u&&"Z"!==u){let e=it(u,!1);Math.abs(e)<30&&(e*=60),l-=6e4*e}return new Date(l)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""},lt=[ge,we,ke,ve,Ve,Je,ze,Ze,et,tt,Ye,Ge,We,Me,ie,Re,Pe,nt,rt,at,ct],ut=new Map([["core",_e],["failsafe",[ge,we,ke]],["json",je],["yaml11",lt],["yaml-1.1",lt]]),ht={binary:Me,bool:Se,float:Ae,floatExp:Oe,floatNaN:Ne,floatTime:at,int:$e,intHex:Ce,intOct:Le,intTime:rt,map:ge,merge:ie,null:ve,omap:Re,pairs:Pe,seq:we,set:nt,timestamp:ct},ft={"tag:yaml.org,2002:binary":Me,"tag:yaml.org,2002:merge":ie,"tag:yaml.org,2002:omap":Re,"tag:yaml.org,2002:pairs":Pe,"tag:yaml.org,2002:set":nt,"tag:yaml.org,2002:timestamp":ct};function dt(e,t,s){const n=ut.get(t);if(n&&!e)return s&&!n.includes(ie)?n.concat(ie):n.slice();let i=n;if(!i){if(!Array.isArray(e)){const e=Array.from(ut.keys()).filter(e=>"yaml11"!==e).map(e=>JSON.stringify(e)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${e} or define customTags array`)}i=[]}if(Array.isArray(e))for(const o of e)i=i.concat(o);else"function"==typeof e&&(i=e(i.slice()));return s&&(i=i.concat(ie)),i.reduce((e,t)=>{const s="string"==typeof t?ht[t]:t;if(!s){const e=JSON.stringify(t),s=Object.keys(ht).map(e=>JSON.stringify(e)).join(", ");throw new Error(`Unknown custom tag ${e}; use one of ${s}`)}return e.includes(s)||e.push(s),e},[])}const pt=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0;class mt{constructor({compat:e,customTags:t,merge:n,resolveKnownTags:r,schema:a,sortMapEntries:c,toStringDefaults:l}){this.compat=Array.isArray(e)?dt(e,"compat"):e?dt(null,e):null,this.name="string"==typeof a&&a||"core",this.knownTags=r?ft:{},this.tags=dt(t,this.name,n),this.toStringOptions=l??null,Object.defineProperty(this,s,{value:ge}),Object.defineProperty(this,i,{value:ke}),Object.defineProperty(this,o,{value:we}),this.sortMapEntries="function"==typeof c?c:!0===c?pt:null}clone(){const e=Object.create(mt.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}}class gt{constructor(e,s,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,r,{value:t});let i=null;"function"==typeof s||Array.isArray(s)?i=s:void 0===n&&s&&(n=s,s=void 0);const o=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=o;let{version:a}=o;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(a=this.directives.yaml.version)):this.directives=new E({version:a}),this.setSchema(a,n),this.contents=void 0===e?null:this.createNode(e,i,n)}clone(){const e=Object.create(gt.prototype,{[r]:{value:t}});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=p(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){yt(this.contents)&&this.contents.add(e)}addIn(e,t){yt(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){const s=O(this);e.anchor=!t||s.has(t)?A(t||"a",s):t}return new L(e.anchor)}createNode(e,t,s){let n;if("function"==typeof t)e=t.call({"":e},"",e),n=t;else if(Array.isArray(t)){const e=e=>"number"==typeof e||e instanceof String||e instanceof Number,s=t.filter(e).map(String);s.length>0&&(t=t.concat(s)),n=t}else void 0===s&&t&&(s=t,t=void 0);const{aliasDuplicateObjects:i,anchorPrefix:o,flow:r,keepUndefined:a,onTagObj:c,tag:l}=s??{},{onAnchor:u,setAnchors:f,sourceObjects:p}=function(e,t){const s=[],n=new Map;let i=null;return{onAnchor:n=>{s.push(n),i??(i=O(e));const o=A(t,i);return i.add(o),o},setAnchors:()=>{for(const e of s){const t=n.get(e);if("object"!=typeof t||!t.anchor||!h(t.node)&&!d(t.node)){const t=new Error("Failed to resolve repeated object (this should not happen)");throw t.source=e,t}t.node.anchor=t.anchor}},sourceObjects:n}}(this,o||"a"),m=B(e,l,{aliasDuplicateObjects:i??!0,keepUndefined:a??!1,onAnchor:u,onTagObj:c,replacer:n,schema:this.schema,sourceObjects:p});return r&&d(m)&&(m.flow=!0),f(),m}createPair(e,t,s={}){const n=this.createNode(e,null,s),i=this.createNode(t,null,s);return new le(n,i)}delete(e){return!!yt(this.contents)&&this.contents.delete(e)}deleteIn(e){return j(e)?null!=this.contents&&(this.contents=null,!0):!!yt(this.contents)&&this.contents.deleteIn(e)}get(e,t){return d(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return j(e)?!t&&h(this.contents)?this.contents.value:this.contents:d(this.contents)?this.contents.getIn(e,t):void 0}has(e){return!!d(this.contents)&&this.contents.has(e)}hasIn(e){return j(e)?void 0!==this.contents:!!d(this.contents)&&this.contents.hasIn(e)}set(e,t){null==this.contents?this.contents=K(this.schema,[e],t):yt(this.contents)&&this.contents.set(e,t)}setIn(e,t){j(e)?this.contents=t:null==this.contents?this.contents=K(this.schema,Array.from(e),t):yt(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){let s;switch("number"==typeof e&&(e=String(e)),e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new E({version:"1.1"}),s={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new E({version:e}),s={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,s=null;break;default:{const t=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${t}`)}}if(t.schema instanceof Object)this.schema=t.schema;else{if(!s)throw new Error("With a null YAML version, the { schema: Schema } option is required");this.schema=new mt(Object.assign(s,t))}}toJS({json:e,jsonArg:t,mapAsMap:s,maxAliasCount:n,onAnchor:i,reviver:o}={}){const r={anchors:new Map,doc:this,keep:!e,mapAsMap:!0===s,mapKeyWarned:!1,maxAliasCount:"number"==typeof n?n:100},a=T(this.contents,t??"",r);if("function"==typeof i)for(const{count:c,res:l}of r.anchors.values())i(l,c);return"function"==typeof o?I(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 function(e,t){const s=[];let n=!0===t.directives;if(!1!==t.directives&&e.directives){const t=e.directives.toString(e);t?(s.push(t),n=!0):e.directives.docStart&&(n=!0)}n&&s.push("---");const i=ee(e,t),{commentString:o}=i.options;if(e.commentBefore){1!==s.length&&s.unshift("");const t=o(e.commentBefore);s.unshift(q(t,""))}let r=!1,a=null;if(e.contents){if(p(e.contents)){if(e.contents.spaceBefore&&n&&s.push(""),e.contents.commentBefore){const t=o(e.contents.commentBefore);s.push(q(t,""))}i.forceBlockIndent=!!e.comment,a=e.contents.comment}const t=a?void 0:()=>r=!0;let c=te(e.contents,i,()=>a=null,t);a&&(c+=P(c,"",o(a))),"|"!==c[0]&&">"!==c[0]||"---"!==s[s.length-1]?s.push(c):s[s.length-1]=`--- ${c}`}else s.push(te(e.contents,i));if(e.directives?.docEnd)if(e.comment){const t=o(e.comment);t.includes("\n")?(s.push("..."),s.push(q(t,""))):s.push(`... ${t}`)}else s.push("...");else{let t=e.comment;t&&r&&(t=t.replace(/^\n+/,"")),t&&(r&&!a||""===s[s.length-1]||s.push(""),s.push(q(o(t),"")))}return s.join("\n")+"\n"}(this,e)}}function yt(e){if(d(e))return!0;throw new Error("Expected a YAML collection as document contents")}class bt extends Error{constructor(e,t,s,n){super(),this.name=e,this.code=s,this.message=n,this.pos=t}}class wt extends bt{constructor(e,t,s){super("YAMLParseError",e,t,s)}}class kt extends bt{constructor(e,t,s){super("YAMLWarning",e,t,s)}}const vt=(e,t)=>s=>{if(-1===s.pos[0])return;s.linePos=s.pos.map(e=>t.linePos(e));const{line:n,col:i}=s.linePos[0];s.message+=` at line ${n}, column ${i}`;let o=i-1,r=e.substring(t.lineStarts[n-1],t.lineStarts[n]).replace(/[\n\r]+$/,"");if(o>=60&&r.length>80){const e=Math.min(o-39,r.length-79);r="…"+r.substring(e),o-=e-1}if(r.length>80&&(r=r.substring(0,79)+"…"),n>1&&/^ *$/.test(r.substring(0,o))){let s=e.substring(t.lineStarts[n-2],t.lineStarts[n-1]);s.length>80&&(s=s.substring(0,79)+"…\n"),r=s+r}if(/[^ ]/.test(r)){let e=1;const t=s.linePos[1];t?.line===n&&t.col>i&&(e=Math.max(1,Math.min(t.col-i,80-o)));const a=" ".repeat(o)+"^".repeat(e);s.message+=`:\n\n${r}\n${a}\n`}};function St(e,{flow:t,indicator:s,next:n,offset:i,onError:o,parentIndent:r,startOnNewline:a}){let c=!1,l=a,u=a,h="",f="",d=!1,p=!1,m=null,g=null,y=null,b=null,w=null,k=null,v=null;for(const N of e)switch(p&&("space"!==N.type&&"newline"!==N.type&&"comma"!==N.type&&o(N.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),p=!1),m&&(l&&"comment"!==N.type&&"newline"!==N.type&&o(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),m=null),N.type){case"space":t||"doc-start"===s&&"flow-collection"===n?.type||!N.source.includes("\t")||(m=N),u=!0;break;case"comment":{u||o(N,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const e=N.source.substring(1)||" ";h?h+=f+e:h=e,f="",l=!1;break}case"newline":l?h?h+=N.source:k&&"seq-item-ind"===s||(c=!0):f+=N.source,l=!0,d=!0,(g||y)&&(b=N),u=!0;break;case"anchor":g&&o(N,"MULTIPLE_ANCHORS","A node can have at most one anchor"),N.source.endsWith(":")&&o(N.offset+N.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=N,v??(v=N.offset),l=!1,u=!1,p=!0;break;case"tag":y&&o(N,"MULTIPLE_TAGS","A node can have at most one tag"),y=N,v??(v=N.offset),l=!1,u=!1,p=!0;break;case s:(g||y)&&o(N,"BAD_PROP_ORDER",`Anchors and tags must be after the ${N.source} indicator`),k&&o(N,"UNEXPECTED_TOKEN",`Unexpected ${N.source} in ${t??"collection"}`),k=N,l="seq-item-ind"===s||"explicit-key-ind"===s,u=!1;break;case"comma":if(t){w&&o(N,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),w=N,l=!1,u=!1;break}default:o(N,"UNEXPECTED_TOKEN",`Unexpected ${N.type} token`),l=!1,u=!1}const S=e[e.length-1],E=S?S.offset+S.source.length:i;return p&&n&&"space"!==n.type&&"newline"!==n.type&&"comma"!==n.type&&("scalar"!==n.type||""!==n.source)&&o(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m&&(l&&m.indent<=r||"block-map"===n?.type||"block-seq"===n?.type)&&o(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:w,found:k,spaceBefore:c,comment:h,hasNewline:d,anchor:g,tag:y,newlineAfterProp:b,end:E,start:v??E}}function Et(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes("\n"))return!0;if(e.end)for(const t of e.end)if("newline"===t.type)return!0;return!1;case"flow-collection":for(const t of e.items){for(const e of t.start)if("newline"===e.type)return!0;if(t.sep)for(const e of t.sep)if("newline"===e.type)return!0;if(Et(t.key)||Et(t.value))return!0}return!1;default:return!0}}function Nt(e,t,s){if("flow-collection"===t?.type){const n=t.end[0];if(n.indent===e&&("]"===n.source||"}"===n.source)&&Et(t)){s(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}}function Ot(e,t,s){const{uniqueKeys:n}=e.options;if(!1===n)return!1;const i="function"==typeof n?n:(e,t)=>e===t||h(e)&&h(t)&&e.value===t.value;return t.some(e=>i(e.key,s))}const At="All mapping items must start at the same column";function It(e,t,s,n){let i="";if(e){let o=!1,r="";for(const a of e){const{source:e,type:c}=a;switch(c){case"space":o=!0;break;case"comment":{s&&!o&&n(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const t=e.substring(1)||" ";i?i+=r+t:i=t,r="";break}case"newline":i&&(r+=e),o=!0;break;default:n(a,"UNEXPECTED_TOKEN",`Unexpected ${c} at node end`)}t+=e.length}}return{comment:i,offset:t}}const Tt="Block collections are not allowed within flow collections",xt=e=>e&&("block-map"===e.type||"block-seq"===e.type);function Lt(e,t,s,n,i,o){const r="block-map"===s.type?function({composeNode:e,composeEmptyNode:t},s,n,i,o){const r=new(o?.nodeClass??me)(s.schema);s.atRoot&&(s.atRoot=!1);let a=n.offset,c=null;for(const l of n.items){const{start:o,key:u,sep:h,value:f}=l,d=St(o,{indicator:"explicit-key-ind",next:u??h?.[0],offset:a,onError:i,parentIndent:n.indent,startOnNewline:!0}),p=!d.found;if(p){if(u&&("block-seq"===u.type?i(a,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in u&&u.indent!==n.indent&&i(a,"BAD_INDENT",At)),!d.anchor&&!d.tag&&!h){c=d.end,d.comment&&(r.comment?r.comment+="\n"+d.comment:r.comment=d.comment);continue}(d.newlineAfterProp||Et(u))&&i(u??o[o.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else d.found?.indent!==n.indent&&i(a,"BAD_INDENT",At);s.atKey=!0;const m=d.end,g=u?e(s,u,d,i):t(s,m,o,null,d,i);s.schema.compat&&Nt(n.indent,u,i),s.atKey=!1,Ot(s,r.items,g)&&i(m,"DUPLICATE_KEY","Map keys must be unique");const y=St(h??[],{indicator:"map-value-ind",next:f,offset:g.range[2],onError:i,parentIndent:n.indent,startOnNewline:!u||"block-scalar"===u.type});if(a=y.end,y.found){p&&("block-map"!==f?.type||y.hasNewline||i(a,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),s.options.strict&&d.start<y.found.offset-1024&&i(g.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));const o=f?e(s,f,y,i):t(s,a,h,null,y,i);s.schema.compat&&Nt(n.indent,f,i),a=o.range[2];const c=new le(g,o);s.options.keepSourceTokens&&(c.srcToken=l),r.items.push(c)}else{p&&i(g.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),y.comment&&(g.comment?g.comment+="\n"+y.comment:g.comment=y.comment);const e=new le(g);s.options.keepSourceTokens&&(e.srcToken=l),r.items.push(e)}}return c&&c<a&&i(c,"IMPOSSIBLE","Map comment with trailing content"),r.range=[n.offset,a,c??a],r}(e,t,s,n,o):"block-seq"===s.type?function({composeNode:e,composeEmptyNode:t},s,n,i,o){const r=new(o?.nodeClass??ye)(s.schema);s.atRoot&&(s.atRoot=!1),s.atKey&&(s.atKey=!1);let a=n.offset,c=null;for(const{start:l,value:u}of n.items){const o=St(l,{indicator:"seq-item-ind",next:u,offset:a,onError:i,parentIndent:n.indent,startOnNewline:!0});if(!o.found){if(!(o.anchor||o.tag||u)){c=o.end,o.comment&&(r.comment=o.comment);continue}"block-seq"===u?.type?i(o.end,"BAD_INDENT","All sequence items must start at the same column"):i(a,"MISSING_CHAR","Sequence item without - indicator")}const h=u?e(s,u,o,i):t(s,o.end,l,null,o,i);s.schema.compat&&Nt(n.indent,u,i),a=h.range[2],r.items.push(h)}return r.range=[n.offset,a,c??a],r}(e,t,s,n,o):function({composeNode:e,composeEmptyNode:t},s,n,i,o){const r="{"===n.start.source,a=r?"flow map":"flow sequence",c=new(o?.nodeClass??(r?me:ye))(s.schema);c.flow=!0;const l=s.atRoot;l&&(s.atRoot=!1),s.atKey&&(s.atKey=!1);let h=n.offset+n.start.source.length;for(let g=0;g<n.items.length;++g){const o=n.items[g],{start:l,key:f,sep:d,value:p}=o,m=St(l,{flow:a,indicator:"explicit-key-ind",next:f??d?.[0],offset:h,onError:i,parentIndent:n.indent,startOnNewline:!1});if(!m.found){if(!(m.anchor||m.tag||d||p)){0===g&&m.comma?i(m.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):g<n.items.length-1&&i(m.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),m.comment&&(c.comment?c.comment+="\n"+m.comment:c.comment=m.comment),h=m.end;continue}!r&&s.options.strict&&Et(f)&&i(f,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(0===g)m.comma&&i(m.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(m.comma||i(m.start,"MISSING_CHAR",`Missing , between ${a} items`),m.comment){let e="";e:for(const t of l)switch(t.type){case"comma":case"space":break;case"comment":e=t.source.substring(1);break e;default:break e}if(e){let t=c.items[c.items.length-1];u(t)&&(t=t.value??t.key),t.comment?t.comment+="\n"+e:t.comment=e,m.comment=m.comment.substring(e.length+1)}}if(r||d||m.found){s.atKey=!0;const u=m.end,g=f?e(s,f,m,i):t(s,u,l,null,m,i);xt(f)&&i(g.range,"BLOCK_IN_FLOW",Tt),s.atKey=!1;const y=St(d??[],{flow:a,indicator:"map-value-ind",next:p,offset:g.range[2],onError:i,parentIndent:n.indent,startOnNewline:!1});if(y.found){if(!r&&!m.found&&s.options.strict){if(d)for(const e of d){if(e===y.found)break;if("newline"===e.type){i(e,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}m.start<y.found.offset-1024&&i(y.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else p&&("source"in p&&":"===p.source?.[0]?i(p,"MISSING_CHAR",`Missing space after : in ${a}`):i(y.start,"MISSING_CHAR",`Missing , or : between ${a} items`));const b=p?e(s,p,y,i):y.found?t(s,y.end,d,null,y,i):null;b?xt(p)&&i(b.range,"BLOCK_IN_FLOW",Tt):y.comment&&(g.comment?g.comment+="\n"+y.comment:g.comment=y.comment);const w=new le(g,b);if(s.options.keepSourceTokens&&(w.srcToken=o),r){const e=c;Ot(s,e.items,g)&&i(u,"DUPLICATE_KEY","Map keys must be unique"),e.items.push(w)}else{const e=new me(s.schema);e.flow=!0,e.items.push(w);const t=(b??g).range;e.range=[g.range[0],t[1],t[2]],c.items.push(e)}h=b?b.range[2]:y.end}else{const n=p?e(s,p,m,i):t(s,m.end,d,null,m,i);c.items.push(n),h=n.range[2],xt(p)&&i(n.range,"BLOCK_IN_FLOW",Tt)}}const f=r?"}":"]",[d,...p]=n.end;let m=h;if(d?.source===f)m=d.offset+d.source.length;else{const e=a[0].toUpperCase()+a.substring(1);i(h,l?"MISSING_CHAR":"BAD_INDENT",l?`${e} must end with a ${f}`:`${e} in block collection must be sufficiently indented and end with a ${f}`),d&&1!==d.source.length&&p.unshift(d)}if(p.length>0){const e=It(p,m,s.options.strict,i);e.comment&&(c.comment?c.comment+="\n"+e.comment:c.comment=e.comment),c.range=[n.offset,m,e.offset]}else c.range=[n.offset,m,m];return c}(e,t,s,n,o),a=r.constructor;return"!"===i||i===a.tagName?(r.tag=a.tagName,r):(i&&(r.tag=i),r)}function $t(e,t,s){const n=t.offset,i=function({offset:e,props:t},s,n){if("block-scalar-header"!==t[0].type)return n(t[0],"IMPOSSIBLE","Block scalar header not found"),null;const{source:i}=t[0],o=i[0];let r=0,a="",c=-1;for(let f=1;f<i.length;++f){const t=i[f];if(a||"-"!==t&&"+"!==t){const s=Number(t);!r&&s?r=s:-1===c&&(c=e+f)}else a=t}-1!==c&&n(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let l=!1,u="",h=i.length;for(let f=1;f<t.length;++f){const e=t[f];switch(e.type){case"space":l=!0;case"newline":h+=e.source.length;break;case"comment":if(s&&!l){n(e,"MISSING_CHAR","Comments must be separated from other tokens by white space characters")}h+=e.source.length,u=e.source.substring(1);break;case"error":n(e,"UNEXPECTED_TOKEN",e.message),h+=e.source.length;break;default:{n(e,"UNEXPECTED_TOKEN",`Unexpected token in block scalar header: ${e.type}`);const t=e.source;t&&"string"==typeof t&&(h+=t.length)}}}return{mode:o,indent:r,chomp:a,comment:u,length:h}}(t,e.options.strict,s);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};const o=">"===i.mode?_.BLOCK_FOLDED:_.BLOCK_LITERAL,r=t.source?function(e){const t=e.split(/\n( *)/),s=t[0],n=s.match(/^( *)/),i=[n?.[1]?[n[1],s.slice(n[1].length)]:["",s]];for(let o=1;o<t.length;o+=2)i.push([t[o],t[o+1]]);return i}(t.source):[];let a=r.length;for(let m=r.length-1;m>=0;--m){const e=r[m][1];if(""!==e&&"\r"!==e)break;a=m}if(0===a){const e="+"===i.chomp&&r.length>0?"\n".repeat(Math.max(1,r.length-1)):"";let s=n+i.length;return t.source&&(s+=t.source.length),{value:e,type:o,comment:i.comment,range:[n,s,s]}}let c=t.indent+i.indent,l=t.offset+i.length,u=0;for(let m=0;m<a;++m){const[t,n]=r[m];if(""!==n&&"\r"!==n){if(t.length<c){const e="Block scalars with more-indented leading empty lines must use an explicit indentation indicator";s(l+t.length,"MISSING_CHAR",e)}if(0===i.indent&&(c=t.length),u=m,0===c&&!e.atRoot){s(l,"BAD_INDENT","Block scalar values in collections must be indented")}break}0===i.indent&&t.length>c&&(c=t.length),l+=t.length+n.length+1}for(let m=r.length-1;m>=a;--m)r[m][0].length>c&&(a=m+1);let h="",f="",d=!1;for(let m=0;m<u;++m)h+=r[m][0].slice(c)+"\n";for(let m=u;m<a;++m){let[e,t]=r[m];l+=e.length+t.length+1;const n="\r"===t[t.length-1];if(n&&(t=t.slice(0,-1)),t&&e.length<c){const o=`Block scalar lines must not be less indented than their ${i.indent?"explicit indentation indicator":"first line"}`;s(l-t.length-(n?2:1),"BAD_INDENT",o),e=""}o===_.BLOCK_LITERAL?(h+=f+e.slice(c)+t,f="\n"):e.length>c||"\t"===t[0]?(" "===f?f="\n":d||"\n"!==f||(f="\n\n"),h+=f+e.slice(c)+t,f="\n",d=!0):""===t?"\n"===f?h+="\n":f="\n":(h+=f+t,f=" ",d=!1)}switch(i.chomp){case"-":break;case"+":for(let e=a;e<r.length;++e)h+="\n"+r[e][0].slice(c);"\n"!==h[h.length-1]&&(h+="\n");break;default:h+="\n"}const p=n+i.length+t.source.length;return{value:h,type:o,comment:i.comment,range:[n,p,p]}}function Ct(e,t,s){const{offset:n,type:i,source:o,end:r}=e;let a,c;const l=(e,t,i)=>s(n+e,t,i);switch(i){case"scalar":a=_.PLAIN,c=function(e,t){let s="";switch(e[0]){case"\t":s="a tab character";break;case",":s="flow indicator character ,";break;case"%":s="directive indicator character %";break;case"|":case">":s=`block scalar indicator ${e[0]}`;break;case"@":case"`":s=`reserved character ${e[0]}`}s&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${s}`);return _t(e)}(o,l);break;case"single-quoted-scalar":a=_.QUOTE_SINGLE,c=function(e,t){"'"===e[e.length-1]&&1!==e.length||t(e.length,"MISSING_CHAR","Missing closing 'quote");return _t(e.slice(1,-1)).replace(/''/g,"'")}(o,l);break;case"double-quoted-scalar":a=_.QUOTE_DOUBLE,c=function(e,t){let s="";for(let n=1;n<e.length-1;++n){const i=e[n];if("\r"!==i||"\n"!==e[n+1])if("\n"===i){const{fold:t,offset:i}=Bt(e,n);s+=t,n=i}else if("\\"===i){let i=e[++n];const o=Kt[i];if(o)s+=o;else if("\n"===i)for(i=e[n+1];" "===i||"\t"===i;)i=e[1+ ++n];else if("\r"===i&&"\n"===e[n+1])for(i=e[1+ ++n];" "===i||"\t"===i;)i=e[1+ ++n];else if("x"===i||"u"===i||"U"===i){const o={x:2,u:4,U:8}[i];s+=jt(e,n+1,o,t),n+=o}else{const i=e.substr(n-1,2);t(n-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${i}`),s+=i}}else if(" "===i||"\t"===i){const t=n;let o=e[n+1];for(;" "===o||"\t"===o;)o=e[1+ ++n];"\n"===o||"\r"===o&&"\n"===e[n+2]||(s+=n>t?e.slice(t,n+1):i)}else s+=i}'"'===e[e.length-1]&&1!==e.length||t(e.length,"MISSING_CHAR",'Missing closing "quote');return s}(o,l);break;default:return s(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[n,n+o.length,n+o.length]}}const u=n+o.length,h=It(r,u,t,s);return{value:c,type:a,comment:h.comment,range:[n,u,h.offset]}}function _t(e){let t,s;try{t=new RegExp("(.*?)(?<![ \t])[ \t]*\r?\n","sy"),s=new RegExp("[ \t]*(.*?)(?:(?<![ \t])[ \t]*)?\r?\n","sy")}catch{t=/(.*?)[ \t]*\r?\n/sy,s=/[ \t]*(.*?)[ \t]*\r?\n/sy}let n=t.exec(e);if(!n)return e;let i=n[1],o=" ",r=t.lastIndex;for(s.lastIndex=r;n=s.exec(e);)""===n[1]?"\n"===o?i+=o:o="\n":(i+=o+n[1],o=" "),r=s.lastIndex;const a=/[ \t]*(.*)/sy;return a.lastIndex=r,n=a.exec(e),i+o+(n?.[1]??"")}function Bt(e,t){let s="",n=e[t+1];for(;!(" "!==n&&"\t"!==n&&"\n"!==n&&"\r"!==n||"\r"===n&&"\n"!==e[t+2]);)"\n"===n&&(s+="\n"),n=e[(t+=1)+1];return s||(s=" "),{fold:s,offset:t}}const Kt={0:"\0",a:"",b:"\b",e:"",f:"\f",n:"\n",r:"\r",t:"\t",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\","\t":"\t"};function jt(e,t,s,n){const i=e.substr(t,s),o=i.length===s&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;if(isNaN(o)){const i=e.substr(t-2,s+2);return n(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${i}`),i}return String.fromCodePoint(o)}function Mt(e,t,s,n){const{value:o,type:r,comment:a,range:c}="block-scalar"===t.type?$t(e,t,n):Ct(t,e.options.strict,n),l=s?e.directives.tagName(s.source,e=>n(s,"TAG_RESOLVE_FAILED",e)):null;let u,f;u=e.options.stringKeys&&e.atKey?e.schema[i]:l?function(e,t,s,n,o){if("!"===s)return e[i];const r=[];for(const i of e.tags)if(!i.collection&&i.tag===s){if(!i.default||!i.test)return i;r.push(i)}for(const i of r)if(i.test?.test(t))return i;const a=e.knownTags[s];if(a&&!a.collection)return e.tags.push(Object.assign({},a,{default:!1,test:void 0})),a;return o(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,"tag:yaml.org,2002:str"!==s),e[i]}(e.schema,o,l,s,n):"scalar"===t.type?function({atKey:e,directives:t,schema:s},n,o,r){const a=s.tags.find(t=>(!0===t.default||e&&"key"===t.default)&&t.test?.test(n))||s[i];if(s.compat){const e=s.compat.find(e=>e.default&&e.test?.test(n))??s[i];if(a.tag!==e.tag){r(o,"TAG_RESOLVE_FAILED",`Value may be parsed as either ${t.tagString(a.tag)} or ${t.tagString(e.tag)}`,!0)}}return a}(e,o,t,n):e.schema[i];try{const i=u.resolve(o,e=>n(s??t,"TAG_RESOLVE_FAILED",e),e.options);f=h(i)?i:new _(i)}catch(d){const e=d instanceof Error?d.message:String(d);n(s??t,"TAG_RESOLVE_FAILED",e),f=new _(o)}return f.range=c,f.source=o,r&&(f.type=r),l&&(f.tag=l),u.format&&(f.format=u.format),a&&(f.comment=a),f}function Dt(e,t,s){if(t){s??(s=t.length);for(let n=s-1;n>=0;--n){let s=t[n];switch(s.type){case"space":case"comment":case"newline":e-=s.source.length;continue}for(s=t[++n];"space"===s?.type;)e+=s.source.length,s=t[++n];break}}return e}const qt={composeNode:Pt,composeEmptyNode:Ut};function Pt(e,t,s,n){const i=e.atKey,{spaceBefore:o,comment:r,anchor:a,tag:c}=s;let l,u=!0;switch(t.type){case"alias":l=function({options:e},{offset:t,source:s,end:n},i){const o=new L(s.substring(1));""===o.source&&i(t,"BAD_ALIAS","Alias cannot be an empty string");o.source.endsWith(":")&&i(t+s.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);const r=t+s.length,a=It(n,r,e.strict,i);o.range=[t,r,a.offset],a.comment&&(o.comment=a.comment);return o}(e,t,n),(a||c)&&n(t,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":l=Mt(e,t,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":l=function(e,t,s,n,i){const o=n.tag,r=o?t.directives.tagName(o.source,e=>i(o,"TAG_RESOLVE_FAILED",e)):null;if("block-seq"===s.type){const{anchor:e,newlineAfterProp:t}=n,s=e&&o?e.offset>o.offset?e:o:e??o;s&&(!t||t.offset<s.offset)&&i(s,"MISSING_CHAR","Missing newline after block sequence props")}const a="block-map"===s.type?"map":"block-seq"===s.type?"seq":"{"===s.start.source?"map":"seq";if(!o||!r||"!"===r||r===me.tagName&&"map"===a||r===ye.tagName&&"seq"===a)return Lt(e,t,s,i,r);let c=t.schema.tags.find(e=>e.tag===r&&e.collection===a);if(!c){const n=t.schema.knownTags[r];if(n?.collection!==a)return n?i(o,"BAD_COLLECTION_TYPE",`${n.tag} used for ${a} collection, but expects ${n.collection??"scalar"}`,!0):i(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${r}`,!0),Lt(e,t,s,i,r);t.schema.tags.push(Object.assign({},n,{default:!1})),c=n}const l=Lt(e,t,s,i,r,c),u=c.resolve?.(l,e=>i(o,"TAG_RESOLVE_FAILED",e),t.options)??l,h=p(u)?u:new _(u);return h.range=l.range,h.tag=r,c?.format&&(h.format=c.format),h}(qt,e,t,s,n),a&&(l.anchor=a.source.substring(1));break;default:n(t,"UNEXPECTED_TOKEN","error"===t.type?t.message:`Unsupported token (type: ${t.type})`),l=Ut(e,t.offset,void 0,null,s,n),u=!1}if(a&&""===l.anchor&&n(a,"BAD_ALIAS","Anchor cannot be an empty string"),i&&e.options.stringKeys&&(!h(l)||"string"!=typeof l.value||l.tag&&"tag:yaml.org,2002:str"!==l.tag)){n(c??t,"NON_STRING_KEY","With stringKeys, all keys must be strings")}return o&&(l.spaceBefore=!0),r&&("scalar"===t.type&&""===t.source?l.comment=r:l.commentBefore=r),e.options.keepSourceTokens&&u&&(l.srcToken=t),l}function Ut(e,t,s,n,{spaceBefore:i,comment:o,anchor:r,tag:a,end:c},l){const u=Mt(e,{type:"scalar",offset:Dt(t,s,n),indent:-1,source:""},a,l);return r&&(u.anchor=r.source.substring(1),""===u.anchor&&l(r,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(u.spaceBefore=!0),o&&(u.comment=o,u.range[2]=c),u}function Rt(e){if("number"==typeof e)return[e,e+1];if(Array.isArray(e))return 2===e.length?e:[e[0],e[1]];const{offset:t,source:s}=e;return[t,t+("string"==typeof s?s.length:1)]}function Ft(e){let t="",s=!1,n=!1;for(let i=0;i<e.length;++i){const o=e[i];switch(o[0]){case"#":t+=(""===t?"":n?"\n\n":"\n")+(o.substring(1)||" "),s=!0,n=!1;break;case"%":"#"!==e[i+1]?.[0]&&(i+=1),s=!1;break;default:s||(n=!0),s=!1}}return{comment:t,afterEmptyLine:n}}class Vt{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,s,n)=>{const i=Rt(e);n?this.warnings.push(new kt(i,t,s)):this.errors.push(new wt(i,t,s))},this.directives=new E({version:e.version||"1.2"}),this.options=e}decorate(e,t){const{comment:s,afterEmptyLine:n}=Ft(this.prelude);if(s){const i=e.contents;if(t)e.comment=e.comment?`${e.comment}\n${s}`:s;else if(n||e.directives.docStart||!i)e.commentBefore=s;else if(d(i)&&!i.flow&&i.items.length>0){let e=i.items[0];u(e)&&(e=e.key);const t=e.commentBefore;e.commentBefore=t?`${s}\n${t}`:s}else{const e=i.commentBefore;i.commentBefore=e?`${s}\n${e}`:s}}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:Ft(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,s=-1){for(const n of e)yield*this.next(n);yield*this.end(t,s)}*next(e){switch(e.type){case"directive":this.directives.add(e.source,(t,s,n)=>{const i=Rt(e);i[0]+=t,this.onError(i,"BAD_DIRECTIVE",s,n)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{const t=function(e,t,{offset:s,start:n,value:i,end:o},r){const a=Object.assign({_directives:t},e),c=new gt(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=St(n,{indicator:"doc-start",next:i??o?.[0],offset:s,onError:r,parentIndent:0,startOnNewline:!0});u.found&&(c.directives.docStart=!0,!i||"block-map"!==i.type&&"block-seq"!==i.type||u.hasNewline||r(u.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=i?Pt(l,i,u,r):Ut(l,u.end,n,null,u,r);const h=c.contents.range[2],f=It(o,h,!1,r);return f.comment&&(c.comment=f.comment),c.range=[s,h,f.offset],c}(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,s=new wt(Rt(e),"UNEXPECTED_TOKEN",t);this.atDirectives||!this.doc?this.errors.push(s):this.doc.errors.push(s);break}case"doc-end":{if(!this.doc){const t="Unexpected doc-end without preceding document";this.errors.push(new wt(Rt(e),"UNEXPECTED_TOKEN",t));break}this.doc.directives.docEnd=!0;const t=It(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){const e=this.doc.comment;this.doc.comment=e?`${e}\n${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new wt(Rt(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 e=Object.assign({_directives:this.directives},this.options),s=new gt(void 0,e);this.atDirectives&&this.onError(t,"MISSING_CHAR","Missing directives-end indicator line"),s.range=[0,t,t],this.decorate(s,!1),yield s}}}function Jt(e){switch(e){case void 0:case" ":case"\n":case"\r":case"\t":return!0;default:return!1}}const Yt=new Set("0123456789ABCDEFabcdef"),Gt=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Wt=new Set(",[]{}"),Ht=new Set(" ,[]{}\n\r\t"),Qt=e=>!e||Ht.has(e);class Xt{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){if(e){if("string"!=typeof e)throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let s=this.next??"stream";for(;s&&(t||this.hasChars(1));)s=yield*this.parseNext(s)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;" "===t||"\t"===t;)t=this.buffer[++e];return!t||"#"===t||"\n"===t||"\r"===t&&"\n"===this.buffer[e+1]}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let s=0;for(;" "===t;)t=this.buffer[++s+e];if("\r"===t){const t=this.buffer[s+e+1];if("\n"===t||!t&&!this.atEnd)return e+s+1}return"\n"===t||s>=this.indentNext||!t&&!this.atEnd?e+s:-1}if("-"===t||"."===t){const t=this.buffer.substr(e,3);if(("---"===t||"..."===t)&&Jt(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return("number"!=typeof e||-1!==e&&e<this.pos)&&(e=this.buffer.indexOf("\n",this.pos),this.lineEndPos=e),-1===e?this.atEnd?this.buffer.substring(this.pos):null:("\r"===this.buffer[e-1]&&(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(null===e)return this.setNext("stream");if("\ufeff"===e[0]&&(yield*this.pushCount(1),e=e.substring(1)),"%"===e[0]){let t=e.length,s=e.indexOf("#");for(;-1!==s;){const n=e[s-1];if(" "===n||"\t"===n){t=s-1;break}s=e.indexOf("#",s+1)}for(;;){const s=e[t-1];if(" "!==s&&"\t"!==s)break;t-=1}const n=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-n),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"",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 e=this.peek(3);if(("---"===e||"..."===e)&&Jt(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,"---"===e?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!Jt(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)&&Jt(t)){const e=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=e,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);const e=this.getLine();if(null===e)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(Qt),"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,s=-1;do{e=yield*this.pushNewline(),e>0?(t=yield*this.pushSpaces(!1),this.indentValue=s=t):t=0,t+=(yield*this.pushSpaces(!0))}while(e+t>0);const n=this.getLine();if(null===n)return this.setNext("flow");if(-1!==s&&s<this.indentNext&&"#"!==n[0]||0===s&&(n.startsWith("---")||n.startsWith("..."))&&Jt(n[3])){if(!(s===this.indentNext-1&&1===this.flowLevel&&("]"===n[0]||"}"===n[0])))return this.flowLevel=0,yield"",yield*this.parseLineStart()}let i=0;for(;","===n[i];)i+=(yield*this.pushCount(1)),i+=(yield*this.pushSpaces(!0)),this.flowKey=!1;switch(i+=(yield*this.pushIndicators()),n[i]){case void 0:return"flow";case"#":return yield*this.pushCount(n.length-i),"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(Qt),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{const e=this.charAt(1);if(this.flowKey||Jt(e)||","===e)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(;-1!==t&&"'"===this.buffer[t+1];)t=this.buffer.indexOf("'",t+2);else for(;-1!==t;){let e=0;for(;"\\"===this.buffer[t-1-e];)e+=1;if(e%2==0)break;t=this.buffer.indexOf('"',t+1)}const s=this.buffer.substring(0,t);let n=s.indexOf("\n",this.pos);if(-1!==n){for(;-1!==n;){const e=this.continueScalar(n+1);if(-1===e)break;n=s.indexOf("\n",e)}-1!==n&&(t=n-("\r"===s[n-1]?2:1))}if(-1===t){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(e=>Jt(e)||"#"===e)}*parseBlockScalar(){let e,t=this.pos-1,s=0;e:for(let i=this.pos;e=this.buffer[i];++i)switch(e){case" ":s+=1;break;case"\n":t=i,s=0;break;case"\r":{const e=this.buffer[i+1];if(!e&&!this.atEnd)return this.setNext("block-scalar");if("\n"===e)break}default:break e}if(!e&&!this.atEnd)return this.setNext("block-scalar");if(s>=this.indentNext){-1===this.blockScalarIndent?this.indentNext=s:this.indentNext=this.blockScalarIndent+(0===this.indentNext?1:this.indentNext);do{const e=this.continueScalar(t+1);if(-1===e)break;t=this.buffer.indexOf("\n",e)}while(-1!==t);if(-1===t){if(!this.atEnd)return this.setNext("block-scalar");t=this.buffer.length}}let n=t+1;for(e=this.buffer[n];" "===e;)e=this.buffer[++n];if("\t"===e){for(;"\t"===e||" "===e||"\r"===e||"\n"===e;)e=this.buffer[++n];t=n-1}else if(!this.blockScalarKeep)for(;;){let e=t-1,n=this.buffer[e];"\r"===n&&(n=this.buffer[--e]);const i=e;for(;" "===n;)n=this.buffer[--e];if(!("\n"===n&&e>=this.pos&&e+1+s>i))break;t=e}return yield"",yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){const e=this.flowLevel>0;let t,s=this.pos-1,n=this.pos-1;for(;t=this.buffer[++n];)if(":"===t){const t=this.buffer[n+1];if(Jt(t)||e&&Wt.has(t))break;s=n}else if(Jt(t)){let i=this.buffer[n+1];if("\r"===t&&("\n"===i?(n+=1,t="\n",i=this.buffer[n+1]):s=n),"#"===i||e&&Wt.has(i))break;if("\n"===t){const e=this.continueScalar(n+1);if(-1===e)break;n=Math.max(n,e-2)}}else{if(e&&Wt.has(t))break;s=n}return t||this.atEnd?(yield"",yield*this.pushToIndex(s+1,!0),e?"flow":"doc"):this.setNext("plain-scalar")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){const s=this.buffer.slice(this.pos,e);return s?(yield s,this.pos+=s.length,s.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(Qt))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{const e=this.flowLevel>0,t=this.charAt(1);if(Jt(t)||e&&Wt.has(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(;!Jt(t)&&">"!==t;)t=this.buffer[++e];return yield*this.pushToIndex(">"===t?e+1:e,!1)}{let e=this.pos+1,t=this.buffer[e];for(;t;)if(Gt.has(t))t=this.buffer[++e];else{if("%"!==t||!Yt.has(this.buffer[e+1])||!Yt.has(this.buffer[e+2]))break;t=this.buffer[e+=3]}return yield*this.pushToIndex(e,!1)}}*pushNewline(){const e=this.buffer[this.pos];return"\n"===e?yield*this.pushCount(1):"\r"===e&&"\n"===this.charAt(1)?yield*this.pushCount(2):0}*pushSpaces(e){let t,s=this.pos-1;do{t=this.buffer[++s]}while(" "===t||e&&"\t"===t);const n=s-this.pos;return n>0&&(yield this.buffer.substr(this.pos,n),this.pos=s),n}*pushUntil(e){let t=this.pos,s=this.buffer[t];for(;!e(s);)s=this.buffer[++t];return yield*this.pushToIndex(t,!1)}}class zt{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,s=this.lineStarts.length;for(;t<s;){const n=t+s>>1;this.lineStarts[n]<e?t=n+1:s=n}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(0===t)return{line:0,col:e};return{line:t,col:e-this.lineStarts[t-1]+1}}}}function Zt(e,t){for(let s=0;s<e.length;++s)if(e[s].type===t)return!0;return!1}function es(e){for(let t=0;t<e.length;++t)switch(e[t].type){case"space":case"comment":case"newline":break;default:return t}return-1}function ts(e){switch(e?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function ss(e){switch(e.type){case"document":return e.start;case"block-map":{const t=e.items[e.items.length-1];return t.sep??t.start}case"block-seq":return e.items[e.items.length-1].start;default:return[]}}function ns(e){if(0===e.length)return[];let t=e.length;e:for(;--t>=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;"space"===e[++t]?.type;);return e.splice(t,e.length)}function is(e){if("flow-seq-start"===e.start.type)for(const t of e.items)!t.sep||t.value||Zt(t.start,"explicit-key-ind")||Zt(t.sep,"map-value-ind")||(t.key&&(t.value=t.key),delete t.key,ts(t.value)?t.value.end?Array.prototype.push.apply(t.value.end,t.sep):t.value.end=t.sep:Array.prototype.push.apply(t.start,t.sep),delete t.sep)}class os{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 Xt,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&0===this.offset&&this.onNewLine(0);for(const s of this.lexer.lex(e,t))yield*this.next(s);t||(yield*this.end())}*next(e){if(this.source=e,this.atScalar)return this.atScalar=!1,yield*this.step(),void(this.offset+=e.length);const t=function(e){switch(e){case"\ufeff":return"byte-order-mark";case"":return"doc-mode";case"":return"flow-error-end";case"":return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case"\n":case"\r\n":return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(e[0]){case" ":case"\t":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}(e);if(t)if("scalar"===t)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 t=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:t,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("doc-end"!==this.type||"doc-end"===e?.type){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()}else{for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source})}}peek(e){return this.stack[this.stack.length-e]}*pop(e){const t=e??this.stack.pop();if(t)if(0===this.stack.length)yield t;else{const e=this.peek(1);switch("block-scalar"===t.type?t.indent="indent"in e?e.indent:0:"flow-collection"===t.type&&"document"===e.type&&(t.indent=0),"flow-collection"===t.type&&is(t),e.type){case"document":e.value=t;break;case"block-scalar":e.props.push(t);break;case"block-map":{const s=e.items[e.items.length-1];if(s.value)return e.items.push({start:[],key:t,sep:[]}),void(this.onKeyLine=!0);if(!s.sep)return Object.assign(s,{key:t,sep:[]}),void(this.onKeyLine=!s.explicitKey);s.value=t;break}case"block-seq":{const s=e.items[e.items.length-1];s.value?e.items.push({start:[],value:t}):s.value=t;break}case"flow-collection":{const s=e.items[e.items.length-1];return void(!s||s.value?e.items.push({start:[],key:t,sep:[]}):s.sep?s.value=t:Object.assign(s,{key:t,sep:[]}))}default:yield*this.pop(),yield*this.pop(t)}if(!("document"!==e.type&&"block-map"!==e.type&&"block-seq"!==e.type||"block-map"!==t.type&&"block-seq"!==t.type)){const s=t.items[t.items.length-1];s&&!s.sep&&!s.value&&s.start.length>0&&-1===es(s.start)&&(0===t.indent||s.start.every(e=>"comment"!==e.type||e.indent<t.indent))&&("document"===e.type?e.end=s.start:e.items.push({start:s.start}),t.items.splice(-1,1))}}else{const e="Tried to pop an empty stack";yield{type:"error",offset:this.offset,source:"",message:e}}}*stream(){switch(this.type){case"directive-line":return void(yield{type:"directive",offset:this.offset,source:this.source});case"byte-order-mark":case"space":case"comment":case"newline":return void(yield this.sourceToken);case"doc-mode":case"doc-start":{const e={type:"document",offset:this.offset,start:[]};return"doc-start"===this.type&&e.start.push(this.sourceToken),void this.stack.push(e)}}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":return void(-1!==es(e.start)?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken));case"anchor":case"tag":case"space":case"comment":case"newline":return void e.start.push(this.sourceToken)}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("map-value-ind"===this.type){const t=ns(ss(this.peek(2)));let s;e.end?(s=e.end,s.push(this.sourceToken),delete e.end):s=[this.sourceToken];const n={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:t,key:e,sep:s}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=n}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":return void e.props.push(this.sourceToken);case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let e=this.source.indexOf("\n")+1;for(;0!==e;)this.onNewLine(this.offset+e),e=this.source.indexOf("\n",e)+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 s="end"in t.value?t.value.end:void 0,n=Array.isArray(s)?s[s.length-1]:void 0;"comment"===n?.type?s?.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 s=e.items[e.items.length-2],n=s?.value?.end;if(Array.isArray(n))return Array.prototype.push.apply(n,t.start),n.push(this.sourceToken),void e.items.pop()}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){const s=!this.onKeyLine&&this.indent===e.indent,n=s&&(t.sep||t.explicitKey)&&"seq-item-ind"!==this.type;let i=[];if(n&&t.sep&&!t.value){const s=[];for(let n=0;n<t.sep.length;++n){const i=t.sep[n];switch(i.type){case"newline":s.push(n);break;case"space":break;case"comment":i.indent>e.indent&&(s.length=0);break;default:s.length=0}}s.length>=2&&(i=t.sep.splice(s[1]))}switch(this.type){case"anchor":case"tag":return void(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));case"explicit-key-ind":return t.sep||t.explicitKey?n||t.value?(i.push(this.sourceToken),e.items.push({start:i,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}):(t.start.push(this.sourceToken),t.explicitKey=!0),void(this.onKeyLine=!0);case"map-value-ind":if(t.explicitKey)if(t.sep)if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Zt(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)&&!Zt(t.sep,"newline")){const e=ns(t.start),s=t.key,n=t.sep;n.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:e,key:s,sep:n}]})}else i.length>0?t.sep=t.sep.concat(i,this.sourceToken):t.sep.push(this.sourceToken);else if(Zt(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{const e=ns(t.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:e,key:null,sep:[this.sourceToken]}]})}else t.sep?t.value||n?e.items.push({start:i,key:null,sep:[this.sourceToken]}):Zt(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]});return void(this.onKeyLine=!0);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const s=this.flowScalar(this.type);return void(n||t.value?(e.items.push({start:i,key:s,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(s):(Object.assign(t,{key:s,sep:[]}),this.onKeyLine=!0))}default:{const n=this.startBlockValue(e);if(n){if("block-seq"===n.type){if(!t.explicitKey&&t.sep&&!Zt(t.sep,"newline"))return void(yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source}))}else s&&e.items.push({start:i});return void this.stack.push(n)}}}}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 s="end"in t.value?t.value.end:void 0,n=Array.isArray(s)?s[s.length-1]:void 0;"comment"===n?.type?s?.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 s=e.items[e.items.length-2],n=s?.value?.end;if(Array.isArray(n))return Array.prototype.push.apply(n,t.start),n.push(this.sourceToken),void e.items.pop()}t.start.push(this.sourceToken)}return;case"anchor":case"tag":if(t.value||this.indent<=e.indent)break;return void t.start.push(this.sourceToken);case"seq-item-ind":if(this.indent!==e.indent)break;return void(t.value||Zt(t.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken))}if(this.indent>e.indent){const t=this.startBlockValue(e);if(t)return void this.stack.push(t)}yield*this.pop(),yield*this.step()}*flowCollection(e){const t=e.items[e.items.length-1];if("flow-error-end"===this.type){let e;do{yield*this.pop(),e=this.peek(1)}while("flow-collection"===e?.type)}else if(0===e.end.length){switch(this.type){case"comma":case"explicit-key-ind":return void(!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken));case"map-value-ind":return void(!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]}));case"space":case"comment":case"newline":case"anchor":case"tag":return void(!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken));case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const s=this.flowScalar(this.type);return void(!t||t.value?e.items.push({start:[],key:s,sep:[]}):t.sep?this.stack.push(s):Object.assign(t,{key:s,sep:[]}))}case"flow-map-end":case"flow-seq-end":return void e.end.push(this.sourceToken)}const s=this.startBlockValue(e);s?this.stack.push(s):(yield*this.pop(),yield*this.step())}else{const t=this.peek(2);if("block-map"===t.type&&("map-value-ind"===this.type&&t.indent===e.indent||"newline"===this.type&&!t.items[t.items.length-1].sep))yield*this.pop(),yield*this.step();else if("map-value-ind"===this.type&&"flow-collection"!==t.type){const s=ns(ss(t));is(e);const n=e.end.splice(1,e.end.length);n.push(this.sourceToken);const i={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:s,key:e,sep:n}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let e=this.source.indexOf("\n")+1;for(;0!==e;)this.onNewLine(this.offset+e),e=this.source.indexOf("\n",e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;const t=ns(ss(e));return t.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const t=ns(ss(e));return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return"comment"===this.type&&(!(this.indent<=t)&&e.every(e=>"newline"===e.type||"space"===e.type))}*documentEnd(e){"doc-mode"!==this.type&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],"newline"===this.type&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],"newline"===this.type&&(yield*this.pop())}}}function rs(e,t={}){const{lineCounter:s,prettyErrors:n}=function(e){const t=!1!==e.prettyErrors;return{lineCounter:e.lineCounter||t&&new zt||null,prettyErrors:t}}(t),i=new os(s?.addNewLine),o=new Vt(t);let r=null;for(const a of o.compose(i.parse(e),!0,e.length))if(r){if("silent"!==r.options.logLevel){r.errors.push(new wt(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}}else r=a;return n&&s&&(r.errors.forEach(vt(e,s)),r.warnings.forEach(vt(e,s))),r}function as(e,t,s){let n;const i=rs(e,s);if(!i)return null;if(i.warnings.forEach(e=>se(i.options.logLevel,e)),i.errors.length>0){if("silent"!==i.options.logLevel)throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:n},s))}export{as as p};