harvester-ui-extension/extensions/harvester/1.6.0/plugin/harvester-1.6.0.umd.min.160.js
github-actions[bot] e892df40b1 CI Build Artifacts
2025-08-26 03:29:41 +00:00

2 lines
103 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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