"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./PlainValue-b8036b75.js");var C=function(p){e.j(s,p);var v=e.k(s);function s(){return e.c(this,s),v.call(this,e.T.BLANK_LINE)}return e.b(s,[{key:"includesTrailingLines",get:function(){return!0}},{key:"parse",value:function(n,t){return this.context=n,this.range=new e.R(t,t+1),t+1}}]),s}(e.N),I=function(p){e.j(s,p);var v=e.k(s);function s(l,n){var t;return e.c(this,s),t=v.call(this,l,n),t.node=null,t}return e.b(s,[{key:"includesTrailingLines",get:function(){return!!this.node&&this.node.includesTrailingLines}},{key:"parse",value:function(n,t){this.context=n;var i=n.parseNode,r=n.src,c=n.atLineStart,u=n.lineStart;!c&&this.type===e.T.SEQ_ITEM&&(this.error=new e.g(this,"Sequence items must not have preceding content on the same line"));for(var h=c?t-u:n.indent,a=e.N.endOfWhiteSpace(r,t+1),o=r[a],f=o==="#",g=[],k=null;o===`
`||o==="#";){if(o==="#"){var N=e.N.endOfLine(r,a+1);g.push(new e.R(a,N)),a=N}else{c=!0,u=a+1;var d=e.N.endOfWhiteSpace(r,u);r[d]===`
`&&g.length===0&&(k=new C,u=k.parse({src:r},u)),a=e.N.endOfIndent(r,u)}o=r[a]}if(e.N.nextNodeIsIndented(o,a-(u+h),this.type!==e.T.SEQ_ITEM)?this.node=i({atLineStart:c,inCollection:!1,indent:h,lineStart:u,parent:this},a):o&&u>t+1&&(a=u-1),this.node){if(k){var w=n.parent.items||n.parent.contents;w&&w.push(k)}g.length&&Array.prototype.push.apply(this.props,g),a=this.node.range.end}else if(f){var m=g[0];this.props.push(m),a=m.end}else a=e.N.endOfLine(r,t+1);var S=this.node?this.node.valueRange.end:a;return this.valueRange=new e.R(t,S),a}},{key:"setOrigRanges",value:function(n,t){return t=e.l(e.m(s.prototype),"setOrigRanges",this).call(this,n,t),this.node?this.node.setOrigRanges(n,t):t}},{key:"toString",value:function(){var n=this.context.src,t=this.node,i=this.range,r=this.value;if(r!=null)return r;var c=t?n.slice(i.start,t.range.start)+String(t):n.slice(i.start,i.end);return e.N.addStringTerminator(n,i.end,c)}}]),s}(e.N),R=function(p){e.j(s,p);var v=e.k(s);function s(){return e.c(this,s),v.call(this,e.T.COMMENT)}return e.b(s,[{key:"parse",value:function(n,t){this.context=n;var i=this.parseComment(t);return this.range=new e.R(t,i),i}}]),s}(e.N);function L(p){for(var v=p;v instanceof I;)v=v.node;if(!(v instanceof P))return null;for(var s=v.items.length,l=-1,n=s-1;n>=0;--n){var t=v.items[n];if(t.type===e.T.COMMENT){var i=t.context,r=i.indent,c=i.lineStart;if(r>0&&t.range.start>=c+r)break;l=n}else if(t.type===e.T.BLANK_LINE)l=n;else break}if(l===-1)return null;for(var u=v.items.splice(l,s-l),h=u[0].range.start;v.range.end=h,v.valueRange&&v.valueRange.end>h&&(v.valueRange.end=h),v!==p;)v=v.context.parent;return u}var P=function(p){e.j(s,p);var v=e.k(s);function s(l){var n;e.c(this,s),n=v.call(this,l.type===e.T.SEQ_ITEM?e.T.SEQ:e.T.MAP);for(var t=l.props.length-1;t>=0;--t)if(l.props[t].start<l.context.lineStart){n.props=l.props.slice(0,t+1),l.props=l.props.slice(t+1);var i=l.props[0]||l.valueRange;l.range.start=i.start;break}n.items=[l];var r=L(l);return r&&Array.prototype.push.apply(n.items,r),n}return e.b(s,[{key:"includesTrailingLines",get:function(){return this.items.length>0}},{key:"parse",value:function(n,t){this.context=n;var i=n.parseNode,r=n.src,c=e.N.startOfLine(r,t),u=this.items[0];u.context.parent=this,this.valueRange=e.R.copy(u.valueRange);var h=u.range.start-u.context.lineStart,a=t;a=e.N.normalizeOffset(r,a);for(var o=r[a],f=e.N.endOfWhiteSpace(r,c)===a,g=!1;o;){for(;o===`
`||o==="#";){if(f&&o===`
`&&!g){var k=new C;if(a=k.parse({src:r},a),this.valueRange.end=a,a>=r.length){o=null;break}this.items.push(k),a-=1}else if(o==="#"){if(a<c+h&&!s.nextContentHasIndent(r,a,h))return a;var N=new R;if(a=N.parse({indent:h,lineStart:c,src:r},a),this.items.push(N),this.valueRange.end=a,a>=r.length){o=null;break}}if(c=a+1,a=e.N.endOfIndent(r,c),e.N.atBlank(r,a)){var d=e.N.endOfWhiteSpace(r,a),w=r[d];(!w||w===`
`||w==="#")&&(a=d)}o=r[a],f=!0}if(!o)break;if(a!==c+h&&(f||o!==":")){if(a<c+h){c>t&&(a=c);break}else if(!this.error){var m="All collection items must start at the same column";this.error=new e.Y(this,m)}}if(u.type===e.T.SEQ_ITEM){if(o!=="-"){c>t&&(a=c);break}}else if(o==="-"&&!this.error){var S=r[a+1];if(!S||S===`
`||S==="	"||S===" "){var y="A collection cannot be both a mapping and a sequence";this.error=new e.Y(this,y)}}var O=i({atLineStart:f,inCollection:!0,indent:h,lineStart:c,parent:this},a);if(!O)return a;if(this.items.push(O),this.valueRange.end=O.valueRange.end,a=e.N.normalizeOffset(r,O.range.end),o=r[a],f=!1,g=O.includesTrailingLines,o){for(var T=a-1,E=r[T];E===" "||E==="	";)E=r[--T];E===`
`&&(c=T+1,f=!0)}var M=L(O);M&&Array.prototype.push.apply(this.items,M)}return a}},{key:"setOrigRanges",value:function(n,t){return t=e.l(e.m(s.prototype),"setOrigRanges",this).call(this,n,t),this.items.forEach(function(i){t=i.setOrigRanges(n,t)}),t}},{key:"toString",value:function(){var n=this.context.src,t=this.items,i=this.range,r=this.value;if(r!=null)return r;for(var c=n.slice(i.start,t[0].range.start)+String(t[0]),u=1;u<t.length;++u){var h=t[u],a=h.context,o=a.atLineStart,f=a.indent;if(o)for(var g=0;g<f;++g)c+=" ";c+=String(h)}return e.N.addStringTerminator(n,i.end,c)}}],[{key:"nextContentHasIndent",value:function(n,t,i){var r=e.N.endOfLine(n,t)+1;t=e.N.endOfWhiteSpace(n,r);var c=n[t];return c?t>=r+i?!0:c!=="#"&&c!==`
`?!1:s.nextContentHasIndent(n,t,i):!1}}]),s}(e.N),B=function(p){e.j(s,p);var v=e.k(s);function s(){var l;return e.c(this,s),l=v.call(this,e.T.DIRECTIVE),l.name=null,l}return e.b(s,[{key:"parameters",get:function(){var n=this.rawValue;return n?n.trim().split(/[ \t]+/):[]}},{key:"parseName",value:function(n){for(var t=this.context.src,i=n,r=t[i];r&&r!==`
`&&r!=="	"&&r!==" ";)r=t[i+=1];return this.name=t.slice(n,i),i}},{key:"parseParameters",value:function(n){for(var t=this.context.src,i=n,r=t[i];r&&r!==`
`&&r!=="#";)r=t[i+=1];return this.valueRange=new e.R(n,i),i}},{key:"parse",value:function(n,t){this.context=n;var i=this.parseName(t+1);return i=this.parseParameters(i),i=this.parseComment(i),this.range=new e.R(t,i),i}}]),s}(e.N),A=function(p){e.j(s,p);var v=e.k(s);function s(){var l;return e.c(this,s),l=v.call(this,e.T.DOCUMENT),l.directives=null,l.contents=null,l.directivesEndMarker=null,l.documentEndMarker=null,l}return e.b(s,[{key:"parseDirectives",value:function(n){var t=this.context.src;this.directives=[];for(var i=!0,r=!1,c=n;!e.N.atDocumentBoundary(t,c,e.C.DIRECTIVES_END);)switch(c=s.startCommentOrEndBlankLine(t,c),t[c]){case`
`:if(i){var u=new C;c=u.parse({src:t},c),c<t.length&&this.directives.push(u)}else c+=1,i=!0;break;case"#":{var h=new R;c=h.parse({src:t},c),this.directives.push(h),i=!1}break;case"%":{var a=new B;c=a.parse({parent:this,src:t},c),this.directives.push(a),r=!0,i=!1}break;default:return r?this.error=new e.g(this,"Missing directives-end indicator line"):this.directives.length>0&&(this.contents=this.directives,this.directives=[]),c}return t[c]?(this.directivesEndMarker=new e.R(c,c+3),c+3):(r?this.error=new e.g(this,"Missing directives-end indicator line"):this.directives.length>0&&(this.contents=this.directives,this.directives=[]),c)}},{key:"parseContents",value:function(n){var t=this.context,i=t.parseNode,r=t.src;this.contents||(this.contents=[]);for(var c=n;r[c-1]==="-";)c-=1;var u=e.N.endOfWhiteSpace(r,n),h=c===n;for(this.valueRange=new e.R(u);!e.N.atDocumentBoundary(r,u,e.C.DOCUMENT_END);){switch(r[u]){case`
`:if(h){var a=new C;u=a.parse({src:r},u),u<r.length&&this.contents.push(a)}else u+=1,h=!0;c=u;break;case"#":{var o=new R;u=o.parse({src:r},u),this.contents.push(o),h=!1}break;default:{var f=e.N.endOfIndent(r,u),g={atLineStart:h,indent:-1,inFlow:!1,inCollection:!1,lineStart:c,parent:this},k=i(g,f);if(!k)return this.valueRange.end=f;this.contents.push(k),u=k.range.end,h=!1;var N=L(k);N&&Array.prototype.push.apply(this.contents,N)}}u=s.startCommentOrEndBlankLine(r,u)}if(this.valueRange.end=u,r[u]&&(this.documentEndMarker=new e.R(u,u+3),u+=3,r[u])){if(u=e.N.endOfWhiteSpace(r,u),r[u]==="#"){var d=new R;u=d.parse({src:r},u),this.contents.push(d)}switch(r[u]){case`
`:u+=1;break;case void 0:break;default:this.error=new e.Y(this,"Document end marker line cannot have a non-comment suffix")}}return u}},{key:"parse",value:function(n,t){n.root=this,this.context=n;var i=n.src,r=i.charCodeAt(t)===65279?t+1:t;return r=this.parseDirectives(r),r=this.parseContents(r),r}},{key:"setOrigRanges",value:function(n,t){return t=e.l(e.m(s.prototype),"setOrigRanges",this).call(this,n,t),this.directives.forEach(function(i){t=i.setOrigRanges(n,t)}),this.directivesEndMarker&&(t=this.directivesEndMarker.setOrigRange(n,t)),this.contents.forEach(function(i){t=i.setOrigRanges(n,t)}),this.documentEndMarker&&(t=this.documentEndMarker.setOrigRange(n,t)),t}},{key:"toString",value:function(){var n=this.contents,t=this.directives,i=this.value;if(i!=null)return i;var r=t.join("");return n.length>0&&((t.length>0||n[0].type===e.T.COMMENT)&&(r+=`---
`),r+=n.join("")),r[r.length-1]!==`
`&&(r+=`
`),r}}],[{key:"startCommentOrEndBlankLine",value:function(n,t){var i=e.N.endOfWhiteSpace(n,t),r=n[i];return r==="#"||r===`
`?i:t}}]),s}(e.N),_=function(p){e.j(s,p);var v=e.k(s);function s(){return e.c(this,s),v.apply(this,arguments)}return e.b(s,[{key:"parse",value:function(n,t){this.context=n;var i=n.src,r=e.N.endOfIdentifier(i,t+1);return this.valueRange=new e.R(t+1,r),r=e.N.endOfWhiteSpace(i,r),r=this.parseComment(r),r}}]),s}(e.N),b={CLIP:"CLIP",KEEP:"KEEP",STRIP:"STRIP"},D=function(p){e.j(s,p);var v=e.k(s);function s(l,n){var t;return e.c(this,s),t=v.call(this,l,n),t.blockIndent=null,t.chomping=b.CLIP,t.header=null,t}return e.b(s,[{key:"includesTrailingLines",get:function(){return this.chomping===b.KEEP}},{key:"strValue",get:function(){if(!this.valueRange||!this.context)return null;var n=this.valueRange,t=n.start,i=n.end,r=this.context,c=r.indent,u=r.src;if(this.valueRange.isEmpty())return"";for(var h=null,a=u[i-1];a===`
`||a==="	"||a===" ";){if(i-=1,i<=t){if(this.chomping===b.KEEP)break;return""}a===`
`&&(h=i),a=u[i-1]}var o=i+1;h&&(this.chomping===b.KEEP?(o=h,i=this.valueRange.end):i=h);for(var f=c+this.blockIndent,g=this.type===e.T.BLOCK_FOLDED,k=!0,N="",d="",w=!1,m=t;m<i;++m){for(var S=0;S<f&&u[m]===" ";++S)m+=1;var y=u[m];if(y===`
`)d===`
`?N+=`
`:d=`
`;else{var O=e.N.endOfLine(u,m),T=u.slice(m,O);m=O,g&&(y===" "||y==="	")&&m<o?(d===" "?d=`
`:!w&&!k&&d===`
`&&(d=`

`),N+=d+T,d=O<i&&u[O]||"",w=!0):(N+=d+T,d=g&&m<o?" ":`
`,w=!1),k&&T!==""&&(k=!1)}}return this.chomping===b.STRIP?N:N+`
`}},{key:"parseBlockHeader",value:function(n){for(var t=this.context.src,i=n+1,r="";;){var c=t[i];switch(c){case"-":this.chomping=b.STRIP;break;case"+":this.chomping=b.KEEP;break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":r+=c;break;default:return this.blockIndent=Number(r)||null,this.header=new e.R(n,i),i}i+=1}}},{key:"parseBlockValue",value:function(n){for(var t=this.context,i=t.indent,r=t.src,c=!!this.blockIndent,u=n,h=n,a=1,o=r[u];o===`
`&&(u+=1,!e.N.atDocumentBoundary(r,u));o=r[u]){var f=e.N.endOfBlockIndent(r,i,u);if(f===null)break;var g=r[f],k=f-(u+i);if(this.blockIndent){if(g&&g!==`
`&&k<this.blockIndent){if(r[f]==="#")break;if(!this.error){var d=c?"explicit indentation indicator":"first line",w="Block scalars must not be less indented than their ".concat(d);this.error=new e.g(this,w)}}}else if(r[f]!==`
`){if(k<a){var N="Block scalars with more-indented leading empty lines must use an explicit indentation indicator";this.error=new e.g(this,N)}this.blockIndent=k}else k>a&&(a=k);r[f]===`
`?u=f:u=h=e.N.endOfLine(r,f)}return this.chomping!==b.KEEP&&(u=r[h]?h+1:h),this.valueRange=new e.R(n+1,u),u}},{key:"parse",value:function(n,t){this.context=n;var i=n.src,r=this.parseBlockHeader(t);return r=e.N.endOfWhiteSpace(i,r),r=this.parseComment(r),r=this.parseBlockValue(r),r}},{key:"setOrigRanges",value:function(n,t){return t=e.l(e.m(s.prototype),"setOrigRanges",this).call(this,n,t),this.header?this.header.setOrigRange(n,t):t}}]),s}(e.N),x=function(p){e.j(s,p);var v=e.k(s);function s(l,n){var t;return e.c(this,s),t=v.call(this,l,n),t.items=null,t}return e.b(s,[{key:"prevNodeIsJsonLike",value:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.items.length,t=this.items[n-1];return!!t&&(t.jsonLike||t.type===e.T.COMMENT&&this.prevNodeIsJsonLike(n-1))}},{key:"parse",value:function(n,t){this.context=n;var i=n.parseNode,r=n.src,c=n.indent,u=n.lineStart,h=r[t];this.items=[{char:h,offset:t}];var a=e.N.endOfWhiteSpace(r,t+1);for(h=r[a];h&&h!=="]"&&h!=="}";){switch(h){case`
`:{u=a+1;var o=e.N.endOfWhiteSpace(r,u);if(r[o]===`
`){var f=new C;u=f.parse({src:r},u),this.items.push(f)}if(a=e.N.endOfIndent(r,u),a<=u+c&&(h=r[a],a<u+c||h!=="]"&&h!=="}")){var g="Insufficient indentation in flow collection";this.error=new e.g(this,g)}}break;case",":this.items.push({char:h,offset:a}),a+=1;break;case"#":{var k=new R;a=k.parse({src:r},a),this.items.push(k)}break;case"?":case":":{var N=r[a+1];if(N===`
`||N==="	"||N===" "||N===","||h===":"&&this.prevNodeIsJsonLike()){this.items.push({char:h,offset:a}),a+=1;break}}default:{var d=i({atLineStart:!1,inCollection:!1,inFlow:!0,indent:-1,lineStart:u,parent:this},a);if(!d)return this.valueRange=new e.R(t,a),a;this.items.push(d),a=e.N.normalizeOffset(r,d.range.end)}}a=e.N.endOfWhiteSpace(r,a),h=r[a]}return this.valueRange=new e.R(t,a+1),h&&(this.items.push({char:h,offset:a}),a=e.N.endOfWhiteSpace(r,a+1),a=this.parseComment(a)),a}},{key:"setOrigRanges",value:function(n,t){return t=e.l(e.m(s.prototype),"setOrigRanges",this).call(this,n,t),this.items.forEach(function(i){if(i instanceof e.N)t=i.setOrigRanges(n,t);else if(n.length===0)i.origOffset=i.offset;else{for(var r=t;r<n.length&&!(n[r]>i.offset);)++r;i.origOffset=i.offset+r,t=r}}),t}},{key:"toString",value:function(){var n=this.context.src,t=this.items,i=this.range,r=this.value;if(r!=null)return r;var c=t.filter(function(a){return a instanceof e.N}),u="",h=i.start;return c.forEach(function(a){var o=n.slice(h,a.range.start);h=a.range.end,u+=o+String(a),u[u.length-1]===`
`&&n[h-1]!==`
`&&n[h]===`
`&&(h+=1)}),u+=n.slice(h,i.end),e.N.addStringTerminator(n,i.end,u)}}]),s}(e.N),Q=function(p){e.j(s,p);var v=e.k(s);function s(){return e.c(this,s),v.apply(this,arguments)}return e.b(s,[{key:"strValue",get:function(){if(!this.valueRange||!this.context)return null;var n=[],t=this.valueRange,i=t.start,r=t.end,c=this.context,u=c.indent,h=c.src;h[r-1]!=='"'&&n.push(new e.Y(this,'Missing closing "quote'));for(var a="",o=i+1;o<r-1;++o){var f=h[o];if(f===`
`){e.N.atDocumentBoundary(h,o+1)&&n.push(new e.g(this,"Document boundary indicators are not allowed within string values"));var g=e.N.foldNewline(h,o,u),k=g.fold,N=g.offset,d=g.error;a+=k,o=N,d&&n.push(new e.g(this,"Multi-line double-quoted string needs to be sufficiently indented"))}else if(f==="\\")switch(o+=1,h[o]){case"0":a+="\0";break;case"a":a+="\x07";break;case"b":a+="\b";break;case"e":a+="\x1B";break;case"f":a+="\f";break;case"n":a+=`
`;break;case"r":a+="\r";break;case"t":a+="	";break;case"v":a+="\v";break;case"N":a+="\x85";break;case"_":a+="\xA0";break;case"L":a+="\u2028";break;case"P":a+="\u2029";break;case" ":a+=" ";break;case'"':a+='"';break;case"/":a+="/";break;case"\\":a+="\\";break;case"	":a+="	";break;case"x":a+=this.parseCharCode(o+1,2,n),o+=2;break;case"u":a+=this.parseCharCode(o+1,4,n),o+=4;break;case"U":a+=this.parseCharCode(o+1,8,n),o+=8;break;case`
`:for(;h[o+1]===" "||h[o+1]==="	";)o+=1;break;default:n.push(new e.Y(this,"Invalid escape sequence ".concat(h.substr(o-1,2)))),a+="\\"+h[o]}else if(f===" "||f==="	"){for(var w=o,m=h[o+1];m===" "||m==="	";)o+=1,m=h[o+1];m!==`
`&&(a+=o>w?h.slice(w,o+1):f)}else a+=f}return n.length>0?{errors:n,str:a}:a}},{key:"parseCharCode",value:function(n,t,i){var r=this.context.src,c=r.substr(n,t),u=c.length===t&&/^[0-9a-fA-F]+$/.test(c),h=u?parseInt(c,16):NaN;return isNaN(h)?(i.push(new e.Y(this,"Invalid escape sequence ".concat(r.substr(n-2,t+2)))),r.substr(n-2,t+2)):String.fromCodePoint(h)}},{key:"parse",value:function(n,t){this.context=n;var i=n.src,r=s.endOfQuote(i,t+1);return this.valueRange=new e.R(t,r),r=e.N.endOfWhiteSpace(i,r),r=this.parseComment(r),r}}],[{key:"endOfQuote",value:function(n,t){for(var i=n[t];i&&i!=='"';)t+=i==="\\"?2:1,i=n[t];return t+1}}]),s}(e.N),W=function(p){e.j(s,p);var v=e.k(s);function s(){return e.c(this,s),v.apply(this,arguments)}return e.b(s,[{key:"strValue",get:function(){if(!this.valueRange||!this.context)return null;var n=[],t=this.valueRange,i=t.start,r=t.end,c=this.context,u=c.indent,h=c.src;h[r-1]!=="'"&&n.push(new e.Y(this,"Missing closing 'quote"));for(var a="",o=i+1;o<r-1;++o){var f=h[o];if(f===`
`){e.N.atDocumentBoundary(h,o+1)&&n.push(new e.g(this,"Document boundary indicators are not allowed within string values"));var g=e.N.foldNewline(h,o,u),k=g.fold,N=g.offset,d=g.error;a+=k,o=N,d&&n.push(new e.g(this,"Multi-line single-quoted string needs to be sufficiently indented"))}else if(f==="'")a+=f,o+=1,h[o]!=="'"&&n.push(new e.Y(this,"Unescaped single quote? This should not happen."));else if(f===" "||f==="	"){for(var w=o,m=h[o+1];m===" "||m==="	";)o+=1,m=h[o+1];m!==`
`&&(a+=o>w?h.slice(w,o+1):f)}else a+=f}return n.length>0?{errors:n,str:a}:a}},{key:"parse",value:function(n,t){this.context=n;var i=n.src,r=s.endOfQuote(i,t+1);return this.valueRange=new e.R(t,r),r=e.N.endOfWhiteSpace(i,r),r=this.parseComment(r),r}}],[{key:"endOfQuote",value:function(n,t){for(var i=n[t];i;)if(i==="'"){if(n[t+1]!=="'")break;i=n[t+=2]}else i=n[t+=1];return t+1}}]),s}(e.N);function F(p,v){switch(p){case e.T.ALIAS:return new _(p,v);case e.T.BLOCK_FOLDED:case e.T.BLOCK_LITERAL:return new D(p,v);case e.T.FLOW_MAP:case e.T.FLOW_SEQ:return new x(p,v);case e.T.MAP_KEY:case e.T.MAP_VALUE:case e.T.SEQ_ITEM:return new I(p,v);case e.T.COMMENT:case e.T.PLAIN:return new e.P(p,v);case e.T.QUOTE_DOUBLE:return new Q(p,v);case e.T.QUOTE_SINGLE:return new W(p,v);default:return null}}var j=function(){function p(){var v=this,s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=l.atLineStart,t=l.inCollection,i=l.inFlow,r=l.indent,c=l.lineStart,u=l.parent;e.c(this,p),e.e(this,"parseNode",function(h,a){if(e.N.atDocumentBoundary(v.src,a))return null;var o=new p(v,h),f=o.parseProps(a),g=f.props,k=f.type,N=f.valueStart,d=F(k,g),w=d.parse(o,N);if(d.range=new e.R(a,w),w<=a&&(d.error=new Error("Node#parse consumed no characters"),d.error.parseEnd=w,d.error.source=d,d.range.end=a+1),o.nodeStartsCollection(d)){!d.error&&!o.atLineStart&&o.parent.type===e.T.DOCUMENT&&(d.error=new e.Y(d,"Block collection must not have preceding content here (e.g. directives-end indicator)"));var m=new P(d);return w=m.parse(new p(o),w),m.range=new e.R(a,w),m}return d}),this.atLineStart=n!=null?n:s.atLineStart||!1,this.inCollection=t!=null?t:s.inCollection||!1,this.inFlow=i!=null?i:s.inFlow||!1,this.indent=r!=null?r:s.indent,this.lineStart=c!=null?c:s.lineStart,this.parent=u!=null?u:s.parent||{},this.root=s.root,this.src=s.src}return e.b(p,[{key:"nodeStartsCollection",value:function(s){var l=this.inCollection,n=this.inFlow,t=this.src;if(l||n)return!1;if(s instanceof I)return!0;var i=s.range.end;return t[i]===`
`||t[i-1]===`
`?!1:(i=e.N.endOfWhiteSpace(t,i),t[i]===":")}},{key:"parseProps",value:function(s){var l=this.inFlow,n=this.parent,t=this.src,i=[],r=!1;s=this.atLineStart?e.N.endOfIndent(t,s):e.N.endOfWhiteSpace(t,s);for(var c=t[s];c===e.C.ANCHOR||c===e.C.COMMENT||c===e.C.TAG||c===`
`;){if(c===`
`){var u=s,h=void 0;do h=u+1,u=e.N.endOfIndent(t,h);while(t[u]===`
`);var a=u-(h+this.indent),o=n.type===e.T.SEQ_ITEM&&n.context.atLineStart;if(t[u]!=="#"&&!e.N.nextNodeIsIndented(t[u],a,!o))break;this.atLineStart=!0,this.lineStart=h,r=!1,s=u}else if(c===e.C.COMMENT){var f=e.N.endOfLine(t,s+1);i.push(new e.R(s,f)),s=f}else{var g=e.N.endOfIdentifier(t,s+1);c===e.C.TAG&&t[g]===","&&/^[a-zA-Z0-9-]+\.[a-zA-Z0-9-]+,\d\d\d\d(-\d\d){0,2}\/\S/.test(t.slice(s+1,g+13))&&(g=e.N.endOfIdentifier(t,g+5)),i.push(new e.R(s,g)),r=!0,s=e.N.endOfWhiteSpace(t,g)}c=t[s]}r&&c===":"&&e.N.atBlank(t,s+1,!0)&&(s-=1);var k=p.parseType(t,s,l);return{props:i,type:k,valueStart:s}}}],[{key:"parseType",value:function(s,l,n){switch(s[l]){case"*":return e.T.ALIAS;case">":return e.T.BLOCK_FOLDED;case"|":return e.T.BLOCK_LITERAL;case"{":return e.T.FLOW_MAP;case"[":return e.T.FLOW_SEQ;case"?":return!n&&e.N.atBlank(s,l+1,!0)?e.T.MAP_KEY:e.T.PLAIN;case":":return!n&&e.N.atBlank(s,l+1,!0)?e.T.MAP_VALUE:e.T.PLAIN;case"-":return!n&&e.N.atBlank(s,l+1,!0)?e.T.SEQ_ITEM:e.T.PLAIN;case'"':return e.T.QUOTE_DOUBLE;case"'":return e.T.QUOTE_SINGLE;default:return e.T.PLAIN}}}]),p}();function K(p){var v=[];p.indexOf("\r")!==-1&&(p=p.replace(/\r\n?/g,function(i,r){return i.length>1&&v.push(r),`
`}));var s=[],l=0;do{var n=new A,t=new j({src:p});l=n.parse(t,l),s.push(n)}while(l<p.length);return s.setOrigRanges=function(){if(v.length===0)return!1;for(var i=1;i<v.length;++i)v[i]-=i;for(var r=0,c=0;c<s.length;++c)r=s[c].setOrigRanges(v,r);return v.splice(0,v.length),!0},s.toString=function(){return s.join(`...
`)},s}exports.parse=K;
//# sourceMappingURL=parse-cst.js.map
