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