@senchou/core
Version:
Generate TypeScript for Kubernetes resources.
24 lines (23 loc) • 359 kB
JavaScript
"use strict";var Jn=Object.defineProperty,er=Object.defineProperties;var nr=Object.getOwnPropertyDescriptors;var we=Object.getOwnPropertySymbols;var rr=Object.prototype.hasOwnProperty,ir=Object.prototype.propertyIsEnumerable;var Ce=(e,n,r)=>n in e?Jn(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r,B=(e,n)=>{for(var r in n||(n={}))rr.call(n,r)&&Ce(e,r,n[r]);if(we)for(var r of we(n))ir.call(n,r)&&Ce(e,r,n[r]);return e},J=(e,n)=>er(e,nr(n));Object.defineProperty(exports,"__esModule",{value:!0});exports[Symbol.toStringTag]="Module";var lr=require("os"),tr=require("path"),or=require("child_process"),Te=require("fs/promises"),ur=require("@littlethings/log"),ar=require("https");function q(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var sr=q(lr),Ee=q(tr),cr=q(ur),Se=q(ar),pr=Object.defineProperty,$e=Object.getOwnPropertySymbols,fr=Object.prototype.hasOwnProperty,dr=Object.prototype.propertyIsEnumerable,ke=(e,n,r)=>n in e?pr(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r,ee=(e,n)=>{for(var r in n||(n={}))fr.call(n,r)&&ke(e,r,n[r]);if($e)for(var r of $e(n))dr.call(n,r)&&ke(e,r,n[r]);return e};class hr{constructor(n={}){this.code="",this.currentIndent=0,this.indentChar=" ",this.indentAmount=1,(n==null?void 0:n.indentChar)&&(this.indentChar=n.indentChar),(n==null?void 0:n.indentAmount)&&(this.indentAmount=n.indentAmount)}getIndentText(){let n="";for(let r=0;r<this.currentIndent*this.indentAmount;r++)n+=this.indentChar;return n}reset(){this.code="",this.currentIndent=0}line(n){n===void 0?this.code+=`
`:this.code+=this.getIndentText()+n+`
`}indent(){this.currentIndent++}dedent(){this.currentIndent--,this.indentAmount<0&&(this.indentAmount=0)}openBlock(n=""){this.line(n+" {"),this.indent()}closeBlock(n=""){this.dedent(),this.line(`}${n}`)}}var ne={exports:{}};const mr=/[\p{Lu}]/u,gr=/[\p{Ll}]/u,Oe=/^[\p{Lu}](?![\p{Lu}])/gu,Ie=/([\p{Alpha}\p{N}_]|$)/u,Ne=/[_.\- ]+/,yr=new RegExp("^"+Ne.source),Fe=new RegExp(Ne.source+Ie.source,"gu"),Le=new RegExp("\\d+"+Ie.source,"gu"),xr=(e,n,r)=>{let i=!1,l=!1,t=!1;for(let o=0;o<e.length;o++){const u=e[o];i&&mr.test(u)?(e=e.slice(0,o)+"-"+e.slice(o),i=!1,t=l,l=!0,o++):l&&t&&gr.test(u)?(e=e.slice(0,o-1)+"-"+e.slice(o-1),t=l,l=!1,i=!0):(i=n(u)===u&&r(u)!==u,t=l,l=r(u)===u&&n(u)!==u)}return e},vr=(e,n)=>(Oe.lastIndex=0,e.replace(Oe,r=>n(r))),Ar=(e,n)=>(Fe.lastIndex=0,Le.lastIndex=0,e.replace(Fe,(r,i)=>n(i)).replace(Le,r=>n(r))),Re=(e,n)=>{if(!(typeof e=="string"||Array.isArray(e)))throw new TypeError("Expected the input to be `string | string[]`");if(n=ee({pascalCase:!1,preserveConsecutiveUppercase:!1},n),Array.isArray(e)?e=e.map(t=>t.trim()).filter(t=>t.length).join("-"):e=e.trim(),e.length===0)return"";const r=n.locale===!1?t=>t.toLowerCase():t=>t.toLocaleLowerCase(n.locale),i=n.locale===!1?t=>t.toUpperCase():t=>t.toLocaleUpperCase(n.locale);return e.length===1?n.pascalCase?i(e):r(e):(e!==r(e)&&(e=xr(e,r,i)),e=e.replace(yr,""),n.preserveConsecutiveUppercase?e=vr(e,r):e=r(e),n.pascalCase&&(e=i(e.charAt(0))+e.slice(1)),Ar(e,i))};ne.exports=Re;ne.exports.default=Re;var Pe=ne.exports;const ze=e=>Pe(e,{preserveConsecutiveUppercase:!0}),H=e=>Pe(e,{pascalCase:!0,preserveConsecutiveUppercase:!0}),S=e=>H(e),_r=e=>e.split(".").map(H).join(""),br=e=>e,wr=e=>`${e}?.toISOString()`,Cr=e=>e,Tr=e=>n=>`serialize${e}(${n})`,Er=e=>n=>`prelude.serialize(${n}, items => items.map(item => ${e.serialize("item")}).filter(prelude.isNotUndefined))`,Sr=e=>n=>`((${n}) === undefined) ? undefined : (Object.entries(${n}).reduce((r, i) => (i[1] === undefined) ? r : ({ ...r, [i[0]]: ${e.serialize("i[1]")} }), {}))`,$r=e=>e,kr=e=>e,Or=e=>e,Ir=e=>e;var Nr=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",name:_r,union:br,date:wr,enum:Cr,struct:Tr,array:Er,map:Sr,string:$r,boolean:kr,number:Or,any:Ir});const Fr=({coder:e,name:n,options:r})=>{e.line(`export type ${n} = ${r.join(" | ")};`),e.openBlock(`export const is${n} = (input: any): input is ${n} =>`);const i=r.map(l=>`"${l}"`);e.line(`return [${i.join(", ")}].includes(typeof input);`),e.closeBlock(";")},Lr=({coder:e,name:n,members:r})=>{e.openBlock(`export enum ${n}`);for(const i of r){let l=H(i);/^[a-z].*/i.test(l)||(l="_"+l),e.line(`"${l}" = "${i}",`)}e.closeBlock()},Rr=e=>e.hasOwnProperty("properties"),Be=(e,n)=>Array.isArray(e.required)&&e.required.includes(n),Pr=({coder:e,name:n,schema:r,serializers:i,emit:l})=>{let t=null;if(r.additionalProperties&&typeof r.additionalProperties=="object"){const u=S(i.name(`${n}.additionalProperties`));t=l(u,r.additionalProperties)}const o=[];for(const[u,a]of Object.entries(r.properties)){const s=S(i.name(`${n}.${u}`));o.push({name:u,safeName:ze(u),type:l(s,a),required:Be(r,u)})}e.openBlock(`export type ${n} =`);for(const u of o)e.line(`readonly ${u.safeName}${u.required?"":"?"}: ${u.type.type};`);e.closeBlock(t?` & Record<string, ${t.type}>;`:";"),e.line(),e.openBlock(`export type Serialized${n} =`);for(const u of o)e.line(`"${u.name}"${u.required?"":"?"}: ${u.type.serializedType},`);e.closeBlock(t?` & Record<string, ${t.type}>`:";"),e.line(),e.line(`export function serialize${n}(options: undefined): undefined;`),e.line(`export function serialize${n}(options: ${n}): Serialized${n};`),e.line(`export function serialize${n}(options: ${n} | undefined): Serialized${n} | undefined;`),e.openBlock(`export function serialize${n}(options: ${n} | undefined): Serialized${n} | undefined`),e.line("if (options === undefined) return undefined;"),t&&(e.line(`const additionalPropertiesKeys = Object.keys(options).filter(key => ![${o.map(u=>`"${u.safeName}"`).join(", ")}].includes(key));`),e.line(),e.line("const additionalProperties: Record<string, any> = {};"),e.line(),e.openBlock("for (const key of additionalPropertiesKeys)"),e.line("additionalProperties[key] = options[key];"),e.closeBlock(),e.line()),e.openBlock(`const result: Serialized${n} =`);for(const u of o)e.line(`"${u.name}": ${u.type.serialize(`options.${u.safeName}`)},`);t&&e.line(`...(${t.serialize("additionalProperties")}),`),e.closeBlock(";"),e.line(),e.line("return result;"),e.closeBlock()},zr=({coder:e,name:n,pattern:r})=>{e.line(`export type ${n} = string & { __type: "${n}" };`),e.openBlock(`export const is${n} = (input: string): input is ${n} =>`),e.line(`const regex = new RegExp("${r.replaceAll('"','\\"')}");`),e.line("return regex.test(input);"),e.closeBlock(";")};var Br=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",union:Fr,enum:Lr,struct:Pr,pattern:zr});const Dr=e=>e.format==="date-time",jr=e=>Boolean(e.enum&&Array.isArray(e.enum)&&e.enum.length>0&&e.enum.every(n=>typeof n=="string")),De=e=>e,Mr=e=>e.hasOwnProperty("additionalProperties")&&typeof e.additionalProperties=="object",K="#/definitions/",Ur=e=>e&&typeof e=="object"&&typeof e.$ref=="string",Yr=e=>e.replace(K,""),qr=e=>e.hasOwnProperty("anyOf")||e.hasOwnProperty("oneOf"),Hr=["string","number","integer","boolean"],Kr=e=>e&&e.type&&typeof e.type=="string"&&Hr.includes(e.type),Gr=e=>e.anyOf||e.oneOf||[],Vr=e=>e&&e.type==="string"&&typeof e.pattern=="string";class je{constructor(n={}){if(this.schemas={},this.emitters={},this.types={},this.serializers=ee({},Nr),this.generators=ee({},Br),n.schemas&&(this.schemas=n.schemas),n.serializers)for(const[r,i]of Object.entries(n.serializers))this.serializers[r]=i;if(n.generators)for(const[r,i]of Object.entries(n.generators))this.generators[r]=i}render(){const n=new hr;for(n.openBlock("const prelude ="),n.line("id: <T>(x: T) => x,"),n.line("isNotUndefined: <T>(x: T | undefined): x is T => x !== undefined,"),n.openBlock("serialize: <T, U>(x: T, f: (x: T extends undefined ? never : T) => U): T extends undefined ? undefined : U =>"),n.line("// @ts-ignore"),n.line("if (x === undefined) return undefined;"),n.line("// @ts-ignore"),n.line("return f(x);"),n.closeBlock(","),n.closeBlock(";"),n.line();Object.keys(this.emitters).length>0;){const r=Object.keys(this.emitters)[0],l=this.emitters[r](n);n.line(),delete this.emitters[r],l&&(this.types[r]=l)}return n.code}define(n,r){this.schemas[n]=r}alias(n,r){this.schemas[n]={$ref:`${K}${r}`}}emit(n,r){if(typeof r=="function"){if(this.types.hasOwnProperty(n))return;const i=r;this.emitters[n]=l=>{const t=i(l);return t||{type:n,serialize:De,serializedType:n}}}else{if(S(n)!==n)throw new Error(`Name "${n}" must be normalized to "${S(n)}" before emitting.`);const i=r||this.schemas[n];if(!i)throw new Error(`No schema found for "${n}".`);if(Ur(i))return this.ref(i);if(qr(i)){const l=this.union(n,i);if(l)return l}if(Dr(i)){if(i.type&&i.type!=="string")throw new Error(`Expected date-time type to be "string", but got "${i.type}".`);return{type:"Date",serialize:this.serializers.date,serializedType:"string"}}if(jr(i)){if(i.type&&i.type!=="string")throw new Error(`Expected enum type to be "string", but got "${i.type}".`);return this.enum(n,i)}if(Rr(i)){if(i.type&&i.type!=="object")throw new Error(`Expected struct type to be "object", but got "${i.type}".`);return this.struct(n,i)}if(Mr(i)){if(i.type&&i.type!=="object")throw new Error(`Expected map type to be "object", but got "${i.type}".`);const l=this.emit(n,i.additionalProperties);return{type:`{ [key: string]: ${l.type} }`,serialize:this.serializers.map(l),serializedType:`{ [key: string]: ${l.type} }`}}if(Vr(i))return this.pattern(n,i);switch(i.type){case"string":return{type:"string",serialize:this.serializers.string,serializedType:"string"};case"number":case"integer":return{type:"number",serialize:this.serializers.number,serializedType:"number"};case"boolean":return{type:"boolean",serialize:this.serializers.boolean,serializedType:"boolean"};case"array":return this.array(n,i)}return{type:"any",serialize:this.serializers.any,serializedType:"any"}}}ref(n){if(!n.$ref.startsWith(K))throw new Error(`Expected $ref to start with ${K}, but got "${n.$ref}".`);const r=Yr(n.$ref),i=this.serializers.name(r),l=S(i);if(this.types[l])return this.types[l];const t=this.schemas[r];if(!t)throw new Error(`Unable to resolve $ref for "${r}".`);return this.emit(l,t)}union(n,r){const i=[];for(const t of Gr(r)){if(!Kr(t))return;const o=t.type==="integer"?"number":t.type;i.push(o)}const l={type:n,serialize:this.serializers.union,serializedType:n};return this.emit(n,t=>(this.generators.union({coder:t,name:n,options:i}),l)),l}enum(n,r){const i={type:n,serialize:this.serializers.enum,serializedType:n};return this.emit(n,l=>(this.generators.enum({coder:l,name:n,members:r.enum}),i)),i}struct(n,r){const i={type:n,serialize:this.serializers.struct(n),serializedType:`Serialized${n}`};return this.emit(n,l=>(this.generators.struct({coder:l,name:n,schema:r,serializers:this.serializers,emit:this.emit.bind(this)}),i)),i}array(n,r){var i,l;if((!r.hasOwnProperty("items")||typeof r.items!="object")&&(!r.hasOwnProperty("additionalItems")||typeof r.additionalItems!="object"))throw new Error(`Expected array items to be "object", but got "${typeof((i=r.items)!=null?i:r.additionalItems)}".`);const t=this.emit(n,(l=r.additionalItems)!=null?l:r.items);return{type:`Array<${t.type}>`,serialize:this.serializers.array(t),serializedType:`Array<${t.serializedType}>`}}pattern(n,r){const i={type:n,serialize:De,serializedType:n};return this.emit(n,l=>(this.generators.pattern({coder:l,name:n,pattern:r.pattern}),i)),i}}const Me="x-kubernetes-group-version-kind",Wr=e=>{var i;const n=e[Me];if(!n)return null;const[r]=n;return!r||!((i=e.properties)==null?void 0:i.metadata)?null:r};var Ue=(e=>(e.Stable="stable",e.Alpha="alpha",e.Beta="beta",e))(Ue||{});const Xr=/^v(?<major>[0-9]+)((?<level>[a-z]+)(?<minor>[0-9]+))?$/,Ye=e=>{var u,a;const n=e.split("."),r=n[n.length-1],i=n.slice(0,n.length-2).join(""),l=n[n.length-2],t=Xr.exec(l);return{fullName:e,kind:r,namespace:t?i:`${i}.${l}`,version:t?{raw:t[0],major:parseInt(t.groups.major),minor:parseInt((u=t.groups.minor)!=null?u:"0"),level:(a=t.groups.level)!=null?a:Ue.Stable}:null}},re=(e,n=!1)=>{const{kind:r,version:i}=Ye(e);return!i||n||i.raw==="v1"?r:`${r}${H(i.raw)}`},qe=(e,n)=>{const r=re(e.fullName);e.custom&&(n.emit("OwnerReference",{type:"object",required:["apiVersion","kind","name","uid"],properties:{apiVersion:{type:"string"},kind:{type:"string"},name:{type:"string"},uid:{type:"string"},controller:{type:"boolean"},blockOwnerDeletion:{type:"boolean"}}}),n.emit("ApiObjectMetadata",{type:"object",additionalProperties:{},properties:{name:{type:"string"},namespace:{type:"string"},annotations:{type:"object",additionalProperties:{type:"string"}},labels:{type:"object",additionalProperties:{type:"string"}},finalizers:{type:"array",additionalItems:{type:"string"}},ownerReferences:{type:"array",additionalItems:{$ref:"#/definitions/OwnerReference"}}}})),n.emit(r,i=>{const l=()=>{var f;const p=J(B({},e.schema),{required:(f=e.schema.required)!=null?f:[],properties:e.schema.properties||{}});delete p[Me];const c=p.properties;return delete c.apiVersion,delete c.kind,delete c.status,Array.isArray(p.required)&&(p.required=p.required.filter(h=>h!=="apiVersion"&&h!=="kind"&&h!=="status")),e.custom&&(p.properties.metadata={$ref:"#/definitions/ApiObjectMetadata"}),p},o=(()=>n.emit(S(`${r}Props`),l()))(),a=e.schema.required&&Array.isArray(e.schema.required)&&e.schema.required.length>0?"":" = {}";return(()=>{var c,f;const p=`${e.group?`${e.group}/`:""}${e.version}`;i.openBlock(`export type Serialized${r} =`),i.line(`apiVersion: "${e.group?`${e.group}/`:""}${e.version}";`),i.line(`kind: "${e.kind}";`),i.closeBlock(` & ${o.serializedType};`),i.openBlock(`export const is${r} = (input: any): input is Serialized${r} =>`),i.line("return ("),i.indent(),i.line('typeof input === "object" && '),i.line("input !== null &&"),i.line(`input.apiVersion === "${p}" &&`),i.line(`input.kind === "${e.kind}"`),i.dedent(),i.line(");"),i.closeBlock(";"),i.line("/**"),i.line(` * ${(f=(c=e.schema)==null?void 0:c.description)!=null?f:""}`),i.line(" *"),i.line(` * @schema ${e.fullName}`),i.line(" */"),i.openBlock(`export const ${r} = (props: ${o.type}${a}) =>`),i.openBlock("return senchou.wrapTemplate(props,"),i.indent(),i.line(`apiVersion: "${p}" as const,`),i.line(`kind: "${e.kind}" as const,`),i.line(`...serialize${o.type}(props),`),i.dedent(),i.closeBlock(");"),i.closeBlock()})(),{type:o.type,serialize:p=>`${r}(${p})`,serializedType:`Serialized${r}`}})};class Qr{constructor(n={}){this.code="",this.currentIndent=0,this.indentChar=" ",this.indentAmount=1,(n==null?void 0:n.indentChar)&&(this.indentChar=n.indentChar),(n==null?void 0:n.indentAmount)&&(this.indentAmount=n.indentAmount)}getIndentText(){let n="";for(let r=0;r<this.currentIndent*this.indentAmount;r++)n+=this.indentChar;return n}reset(){this.code="",this.currentIndent=0}line(n){n===void 0?this.code+=`
`:this.code+=this.getIndentText()+n+`
`}indent(){this.currentIndent++}dedent(){this.currentIndent--,this.indentAmount<0&&(this.indentAmount=0)}openBlock(n=""){this.line(n+" {"),this.indent()}closeBlock(n=""){this.dedent(),this.line(`}${n}`)}}const He=()=>{const e=new Qr;return e.openBlock("const senchou ="),e.openBlock("wrapTemplate: <T, U>(x: T, y: U): U =>"),e.line("type MaybeTemplate = { __templateType?: string; __data?: object; };"),e.line("const xTemplate = x as unknown as MaybeTemplate"),e.line("const yTemplate = y as unknown as MaybeTemplate"),e.openBlock("if (x && y && xTemplate.__templateType !== undefined)"),e.openBlock('Object.defineProperty(yTemplate, "__templateType", '),e.line("value: xTemplate.__templateType,"),e.line("enumerable: false,"),e.line("configurable: true,"),e.line("writable: true,"),e.closeBlock(");"),e.openBlock('Object.defineProperty(yTemplate, "__data", '),e.line("value: xTemplate.__data,"),e.line("enumerable: false,"),e.line("configurable: true,"),e.line("writable: true,"),e.closeBlock(");"),e.closeBlock(),e.line("return y"),e.closeBlock(","),e.closeBlock(";"),e.code},Zr={generate:e=>{var l,t,o,u,a,s,p,c,f,h,g,y,x;const r=(Array.isArray(e)?e:[e]).sort((v,m)=>{var ve,Ae,_e,be;const Qn=`${(ve=v.spec)==null?void 0:ve.group}/${(Ae=v.spec)==null?void 0:Ae.names.kind}`.toLocaleLowerCase(),Zn=`${(_e=m.spec)==null?void 0:_e.group}/${(be=m.spec)==null?void 0:be.names.kind}`.toLocaleLowerCase();return Qn.localeCompare(Zn)}),i=new je;for(const v of r){const m=(u=(l=v.spec)==null?void 0:l.version)!=null?u:(o=(t=v.spec)==null?void 0:t.versions)==null?void 0:o[0];qe({custom:!0,fullName:(a=v.spec)==null?void 0:a.names.kind,group:(s=v.spec)==null?void 0:s.group,kind:(p=v.spec)==null?void 0:p.names.kind,version:typeof m=="string"?m:m==null?void 0:m.name,schema:typeof m=="string"?(f=(c=v.spec)==null?void 0:c.validation)==null?void 0:f.openAPIV3Schema:(x=(h=m==null?void 0:m.schema)==null?void 0:h.openAPIV3Schema)!=null?x:(y=(g=v.spec)==null?void 0:g.validation)==null?void 0:y.openAPIV3Schema},i)}return He()+i.render()}};/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */function Ke(e){return typeof e=="undefined"||e===null}function Jr(e){return typeof e=="object"&&e!==null}function ei(e){return Array.isArray(e)?e:Ke(e)?[]:[e]}function ni(e,n){var r,i,l,t;if(n)for(t=Object.keys(n),r=0,i=t.length;r<i;r+=1)l=t[r],e[l]=n[l];return e}function ri(e,n){var r="",i;for(i=0;i<n;i+=1)r+=e;return r}function ii(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var li=Ke,ti=Jr,oi=ei,ui=ri,ai=ii,si=ni,_={isNothing:li,isObject:ti,toArray:oi,repeat:ui,isNegativeZero:ai,extend:si};function Ge(e,n){var r="",i=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(r+='in "'+e.mark.name+'" '),r+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!n&&e.mark.snippet&&(r+=`
`+e.mark.snippet),i+" "+r):i}function D(e,n){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=n,this.message=Ge(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}D.prototype=Object.create(Error.prototype);D.prototype.constructor=D;D.prototype.toString=function(n){return this.name+": "+Ge(this,n)};var C=D;function ie(e,n,r,i,l){var t="",o="",u=Math.floor(l/2)-1;return i-n>u&&(t=" ... ",n=i-u+t.length),r-i>u&&(o=" ...",r=i+u-o.length),{str:t+e.slice(n,r).replace(/\t/g,"\u2192")+o,pos:i-n+t.length}}function le(e,n){return _.repeat(" ",n-e.length)+e}function ci(e,n){if(n=Object.create(n||null),!e.buffer)return null;n.maxLength||(n.maxLength=79),typeof n.indent!="number"&&(n.indent=1),typeof n.linesBefore!="number"&&(n.linesBefore=3),typeof n.linesAfter!="number"&&(n.linesAfter=2);for(var r=/\r?\n|\r|\0/g,i=[0],l=[],t,o=-1;t=r.exec(e.buffer);)l.push(t.index),i.push(t.index+t[0].length),e.position<=t.index&&o<0&&(o=i.length-2);o<0&&(o=i.length-1);var u="",a,s,p=Math.min(e.line+n.linesAfter,l.length).toString().length,c=n.maxLength-(n.indent+p+3);for(a=1;a<=n.linesBefore&&!(o-a<0);a++)s=ie(e.buffer,i[o-a],l[o-a],e.position-(i[o]-i[o-a]),c),u=_.repeat(" ",n.indent)+le((e.line-a+1).toString(),p)+" | "+s.str+`
`+u;for(s=ie(e.buffer,i[o],l[o],e.position,c),u+=_.repeat(" ",n.indent)+le((e.line+1).toString(),p)+" | "+s.str+`
`,u+=_.repeat("-",n.indent+p+3+s.pos)+`^
`,a=1;a<=n.linesAfter&&!(o+a>=l.length);a++)s=ie(e.buffer,i[o+a],l[o+a],e.position-(i[o]-i[o+a]),c),u+=_.repeat(" ",n.indent)+le((e.line+a+1).toString(),p)+" | "+s.str+`
`;return u.replace(/\n$/,"")}var pi=ci,fi=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],di=["scalar","sequence","mapping"];function hi(e){var n={};return e!==null&&Object.keys(e).forEach(function(r){e[r].forEach(function(i){n[String(i)]=r})}),n}function mi(e,n){if(n=n||{},Object.keys(n).forEach(function(r){if(fi.indexOf(r)===-1)throw new C('Unknown option "'+r+'" is met in definition of "'+e+'" YAML type.')}),this.options=n,this.tag=e,this.kind=n.kind||null,this.resolve=n.resolve||function(){return!0},this.construct=n.construct||function(r){return r},this.instanceOf=n.instanceOf||null,this.predicate=n.predicate||null,this.represent=n.represent||null,this.representName=n.representName||null,this.defaultStyle=n.defaultStyle||null,this.multi=n.multi||!1,this.styleAliases=hi(n.styleAliases||null),di.indexOf(this.kind)===-1)throw new C('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var b=mi;function Ve(e,n){var r=[];return e[n].forEach(function(i){var l=r.length;r.forEach(function(t,o){t.tag===i.tag&&t.kind===i.kind&&t.multi===i.multi&&(l=o)}),r[l]=i}),r}function gi(){var e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},n,r;function i(l){l.multi?(e.multi[l.kind].push(l),e.multi.fallback.push(l)):e[l.kind][l.tag]=e.fallback[l.tag]=l}for(n=0,r=arguments.length;n<r;n+=1)arguments[n].forEach(i);return e}function te(e){return this.extend(e)}te.prototype.extend=function(n){var r=[],i=[];if(n instanceof b)i.push(n);else if(Array.isArray(n))i=i.concat(n);else if(n&&(Array.isArray(n.implicit)||Array.isArray(n.explicit)))n.implicit&&(r=r.concat(n.implicit)),n.explicit&&(i=i.concat(n.explicit));else throw new C("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");r.forEach(function(t){if(!(t instanceof b))throw new C("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(t.loadKind&&t.loadKind!=="scalar")throw new C("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(t.multi)throw new C("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),i.forEach(function(t){if(!(t instanceof b))throw new C("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var l=Object.create(te.prototype);return l.implicit=(this.implicit||[]).concat(r),l.explicit=(this.explicit||[]).concat(i),l.compiledImplicit=Ve(l,"implicit"),l.compiledExplicit=Ve(l,"explicit"),l.compiledTypeMap=gi(l.compiledImplicit,l.compiledExplicit),l};var We=te,Xe=new b("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),Qe=new b("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),Ze=new b("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),Je=new We({explicit:[Xe,Qe,Ze]});function yi(e){if(e===null)return!0;var n=e.length;return n===1&&e==="~"||n===4&&(e==="null"||e==="Null"||e==="NULL")}function xi(){return null}function vi(e){return e===null}var en=new b("tag:yaml.org,2002:null",{kind:"scalar",resolve:yi,construct:xi,predicate:vi,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function Ai(e){if(e===null)return!1;var n=e.length;return n===4&&(e==="true"||e==="True"||e==="TRUE")||n===5&&(e==="false"||e==="False"||e==="FALSE")}function _i(e){return e==="true"||e==="True"||e==="TRUE"}function bi(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var nn=new b("tag:yaml.org,2002:bool",{kind:"scalar",resolve:Ai,construct:_i,predicate:bi,represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"});function wi(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function Ci(e){return 48<=e&&e<=55}function Ti(e){return 48<=e&&e<=57}function Ei(e){if(e===null)return!1;var n=e.length,r=0,i=!1,l;if(!n)return!1;if(l=e[r],(l==="-"||l==="+")&&(l=e[++r]),l==="0"){if(r+1===n)return!0;if(l=e[++r],l==="b"){for(r++;r<n;r++)if(l=e[r],l!=="_"){if(l!=="0"&&l!=="1")return!1;i=!0}return i&&l!=="_"}if(l==="x"){for(r++;r<n;r++)if(l=e[r],l!=="_"){if(!wi(e.charCodeAt(r)))return!1;i=!0}return i&&l!=="_"}if(l==="o"){for(r++;r<n;r++)if(l=e[r],l!=="_"){if(!Ci(e.charCodeAt(r)))return!1;i=!0}return i&&l!=="_"}}if(l==="_")return!1;for(;r<n;r++)if(l=e[r],l!=="_"){if(!Ti(e.charCodeAt(r)))return!1;i=!0}return!(!i||l==="_")}function Si(e){var n=e,r=1,i;if(n.indexOf("_")!==-1&&(n=n.replace(/_/g,"")),i=n[0],(i==="-"||i==="+")&&(i==="-"&&(r=-1),n=n.slice(1),i=n[0]),n==="0")return 0;if(i==="0"){if(n[1]==="b")return r*parseInt(n.slice(2),2);if(n[1]==="x")return r*parseInt(n.slice(2),16);if(n[1]==="o")return r*parseInt(n.slice(2),8)}return r*parseInt(n,10)}function $i(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1==0&&!_.isNegativeZero(e)}var rn=new b("tag:yaml.org,2002:int",{kind:"scalar",resolve:Ei,construct:Si,predicate:$i,represent:{binary:function(e){return e>=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),ki=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function Oi(e){return!(e===null||!ki.test(e)||e[e.length-1]==="_")}function Ii(e){var n,r;return n=e.replace(/_/g,"").toLowerCase(),r=n[0]==="-"?-1:1,"+-".indexOf(n[0])>=0&&(n=n.slice(1)),n===".inf"?r===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:n===".nan"?NaN:r*parseFloat(n,10)}var Ni=/^[-+]?[0-9]+e/;function Fi(e,n){var r;if(isNaN(e))switch(n){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(n){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(n){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(_.isNegativeZero(e))return"-0.0";return r=e.toString(10),Ni.test(r)?r.replace("e",".e"):r}function Li(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!=0||_.isNegativeZero(e))}var ln=new b("tag:yaml.org,2002:float",{kind:"scalar",resolve:Oi,construct:Ii,predicate:Li,represent:Fi,defaultStyle:"lowercase"}),tn=Je.extend({implicit:[en,nn,rn,ln]}),on=tn,un=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),an=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function Ri(e){return e===null?!1:un.exec(e)!==null||an.exec(e)!==null}function Pi(e){var n,r,i,l,t,o,u,a=0,s=null,p,c,f;if(n=un.exec(e),n===null&&(n=an.exec(e)),n===null)throw new Error("Date resolve error");if(r=+n[1],i=+n[2]-1,l=+n[3],!n[4])return new Date(Date.UTC(r,i,l));if(t=+n[4],o=+n[5],u=+n[6],n[7]){for(a=n[7].slice(0,3);a.length<3;)a+="0";a=+a}return n[9]&&(p=+n[10],c=+(n[11]||0),s=(p*60+c)*6e4,n[9]==="-"&&(s=-s)),f=new Date(Date.UTC(r,i,l,t,o,u,a)),s&&f.setTime(f.getTime()-s),f}function zi(e){return e.toISOString()}var sn=new b("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:Ri,construct:Pi,instanceOf:Date,represent:zi});function Bi(e){return e==="<<"||e===null}var cn=new b("tag:yaml.org,2002:merge",{kind:"scalar",resolve:Bi}),oe=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
\r`;function Di(e){if(e===null)return!1;var n,r,i=0,l=e.length,t=oe;for(r=0;r<l;r++)if(n=t.indexOf(e.charAt(r)),!(n>64)){if(n<0)return!1;i+=6}return i%8==0}function ji(e){var n,r,i=e.replace(/[\r\n=]/g,""),l=i.length,t=oe,o=0,u=[];for(n=0;n<l;n++)n%4==0&&n&&(u.push(o>>16&255),u.push(o>>8&255),u.push(o&255)),o=o<<6|t.indexOf(i.charAt(n));return r=l%4*6,r===0?(u.push(o>>16&255),u.push(o>>8&255),u.push(o&255)):r===18?(u.push(o>>10&255),u.push(o>>2&255)):r===12&&u.push(o>>4&255),new Uint8Array(u)}function Mi(e){var n="",r=0,i,l,t=e.length,o=oe;for(i=0;i<t;i++)i%3==0&&i&&(n+=o[r>>18&63],n+=o[r>>12&63],n+=o[r>>6&63],n+=o[r&63]),r=(r<<8)+e[i];return l=t%3,l===0?(n+=o[r>>18&63],n+=o[r>>12&63],n+=o[r>>6&63],n+=o[r&63]):l===2?(n+=o[r>>10&63],n+=o[r>>4&63],n+=o[r<<2&63],n+=o[64]):l===1&&(n+=o[r>>2&63],n+=o[r<<4&63],n+=o[64],n+=o[64]),n}function Ui(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var pn=new b("tag:yaml.org,2002:binary",{kind:"scalar",resolve:Di,construct:ji,predicate:Ui,represent:Mi}),Yi=Object.prototype.hasOwnProperty,qi=Object.prototype.toString;function Hi(e){if(e===null)return!0;var n=[],r,i,l,t,o,u=e;for(r=0,i=u.length;r<i;r+=1){if(l=u[r],o=!1,qi.call(l)!=="[object Object]")return!1;for(t in l)if(Yi.call(l,t))if(!o)o=!0;else return!1;if(!o)return!1;if(n.indexOf(t)===-1)n.push(t);else return!1}return!0}function Ki(e){return e!==null?e:[]}var fn=new b("tag:yaml.org,2002:omap",{kind:"sequence",resolve:Hi,construct:Ki}),Gi=Object.prototype.toString;function Vi(e){if(e===null)return!0;var n,r,i,l,t,o=e;for(t=new Array(o.length),n=0,r=o.length;n<r;n+=1){if(i=o[n],Gi.call(i)!=="[object Object]"||(l=Object.keys(i),l.length!==1))return!1;t[n]=[l[0],i[l[0]]]}return!0}function Wi(e){if(e===null)return[];var n,r,i,l,t,o=e;for(t=new Array(o.length),n=0,r=o.length;n<r;n+=1)i=o[n],l=Object.keys(i),t[n]=[l[0],i[l[0]]];return t}var dn=new b("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:Vi,construct:Wi}),Xi=Object.prototype.hasOwnProperty;function Qi(e){if(e===null)return!0;var n,r=e;for(n in r)if(Xi.call(r,n)&&r[n]!==null)return!1;return!0}function Zi(e){return e!==null?e:{}}var hn=new b("tag:yaml.org,2002:set",{kind:"mapping",resolve:Qi,construct:Zi}),ue=on.extend({implicit:[sn,cn],explicit:[pn,fn,dn,hn]}),k=Object.prototype.hasOwnProperty,G=1,mn=2,gn=3,V=4,ae=1,Ji=2,yn=3,el=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,nl=/[\x85\u2028\u2029]/,rl=/[,\[\]\{\}]/,xn=/^(?:!|!!|![a-z\-]+!)$/i,vn=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function An(e){return Object.prototype.toString.call(e)}function E(e){return e===10||e===13}function I(e){return e===9||e===32}function T(e){return e===9||e===32||e===10||e===13}function F(e){return e===44||e===91||e===93||e===123||e===125}function il(e){var n;return 48<=e&&e<=57?e-48:(n=e|32,97<=n&&n<=102?n-97+10:-1)}function ll(e){return e===120?2:e===117?4:e===85?8:0}function tl(e){return 48<=e&&e<=57?e-48:-1}function _n(e){return e===48?"\0":e===97?"\x07":e===98?"\b":e===116||e===9?" ":e===110?`
`:e===118?"\v":e===102?"\f":e===114?"\r":e===101?"":e===32?" ":e===34?'"':e===47?"/":e===92?"\\":e===78?"\x85":e===95?"\xA0":e===76?"\u2028":e===80?"\u2029":""}function ol(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}var bn=new Array(256),wn=new Array(256);for(var L=0;L<256;L++)bn[L]=_n(L)?1:0,wn[L]=_n(L);function ul(e,n){this.input=e,this.filename=n.filename||null,this.schema=n.schema||ue,this.onWarning=n.onWarning||null,this.legacy=n.legacy||!1,this.json=n.json||!1,this.listener=n.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function Cn(e,n){var r={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return r.snippet=pi(r),new C(n,r)}function d(e,n){throw Cn(e,n)}function W(e,n){e.onWarning&&e.onWarning.call(null,Cn(e,n))}var Tn={YAML:function(n,r,i){var l,t,o;n.version!==null&&d(n,"duplication of %YAML directive"),i.length!==1&&d(n,"YAML directive accepts exactly one argument"),l=/^([0-9]+)\.([0-9]+)$/.exec(i[0]),l===null&&d(n,"ill-formed argument of the YAML directive"),t=parseInt(l[1],10),o=parseInt(l[2],10),t!==1&&d(n,"unacceptable YAML version of the document"),n.version=i[0],n.checkLineBreaks=o<2,o!==1&&o!==2&&W(n,"unsupported YAML version of the document")},TAG:function(n,r,i){var l,t;i.length!==2&&d(n,"TAG directive accepts exactly two arguments"),l=i[0],t=i[1],xn.test(l)||d(n,"ill-formed tag handle (first argument) of the TAG directive"),k.call(n.tagMap,l)&&d(n,'there is a previously declared suffix for "'+l+'" tag handle'),vn.test(t)||d(n,"ill-formed tag prefix (second argument) of the TAG directive");try{t=decodeURIComponent(t)}catch{d(n,"tag prefix is malformed: "+t)}n.tagMap[l]=t}};function O(e,n,r,i){var l,t,o,u;if(n<r){if(u=e.input.slice(n,r),i)for(l=0,t=u.length;l<t;l+=1)o=u.charCodeAt(l),o===9||32<=o&&o<=1114111||d(e,"expected valid JSON character");else el.test(u)&&d(e,"the stream contains non-printable characters");e.result+=u}}function En(e,n,r,i){var l,t,o,u;for(_.isObject(r)||d(e,"cannot merge mappings; the provided source object is unacceptable"),l=Object.keys(r),o=0,u=l.length;o<u;o+=1)t=l[o],k.call(n,t)||(n[t]=r[t],i[t]=!0)}function R(e,n,r,i,l,t,o,u,a){var s,p;if(Array.isArray(l))for(l=Array.prototype.slice.call(l),s=0,p=l.length;s<p;s+=1)Array.isArray(l[s])&&d(e,"nested arrays are not supported inside keys"),typeof l=="object"&&An(l[s])==="[object Object]"&&(l[s]="[object Object]");if(typeof l=="object"&&An(l)==="[object Object]"&&(l="[object Object]"),l=String(l),n===null&&(n={}),i==="tag:yaml.org,2002:merge")if(Array.isArray(t))for(s=0,p=t.length;s<p;s+=1)En(e,n,t[s],r);else En(e,n,t,r);else!e.json&&!k.call(r,l)&&k.call(n,l)&&(e.line=o||e.line,e.lineStart=u||e.lineStart,e.position=a||e.position,d(e,"duplicated mapping key")),l==="__proto__"?Object.defineProperty(n,l,{configurable:!0,enumerable:!0,writable:!0,value:t}):n[l]=t,delete r[l];return n}function se(e){var n;n=e.input.charCodeAt(e.position),n===10?e.position++:n===13?(e.position++,e.input.charCodeAt(e.position)===10&&e.position++):d(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function A(e,n,r){for(var i=0,l=e.input.charCodeAt(e.position);l!==0;){for(;I(l);)l===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),l=e.input.charCodeAt(++e.position);if(n&&l===35)do l=e.input.charCodeAt(++e.position);while(l!==10&&l!==13&&l!==0);if(E(l))for(se(e),l=e.input.charCodeAt(e.position),i++,e.lineIndent=0;l===32;)e.lineIndent++,l=e.input.charCodeAt(++e.position);else break}return r!==-1&&i!==0&&e.lineIndent<r&&W(e,"deficient indentation"),i}function X(e){var n=e.position,r;return r=e.input.charCodeAt(n),!!((r===45||r===46)&&r===e.input.charCodeAt(n+1)&&r===e.input.charCodeAt(n+2)&&(n+=3,r=e.input.charCodeAt(n),r===0||T(r)))}function ce(e,n){n===1?e.result+=" ":n>1&&(e.result+=_.repeat(`
`,n-1))}function al(e,n,r){var i,l,t,o,u,a,s,p,c=e.kind,f=e.result,h;if(h=e.input.charCodeAt(e.position),T(h)||F(h)||h===35||h===38||h===42||h===33||h===124||h===62||h===39||h===34||h===37||h===64||h===96||(h===63||h===45)&&(l=e.input.charCodeAt(e.position+1),T(l)||r&&F(l)))return!1;for(e.kind="scalar",e.result="",t=o=e.position,u=!1;h!==0;){if(h===58){if(l=e.input.charCodeAt(e.position+1),T(l)||r&&F(l))break}else if(h===35){if(i=e.input.charCodeAt(e.position-1),T(i))break}else{if(e.position===e.lineStart&&X(e)||r&&F(h))break;if(E(h))if(a=e.line,s=e.lineStart,p=e.lineIndent,A(e,!1,-1),e.lineIndent>=n){u=!0,h=e.input.charCodeAt(e.position);continue}else{e.position=o,e.line=a,e.lineStart=s,e.lineIndent=p;break}}u&&(O(e,t,o,!1),ce(e,e.line-a),t=o=e.position,u=!1),I(h)||(o=e.position+1),h=e.input.charCodeAt(++e.position)}return O(e,t,o,!1),e.result?!0:(e.kind=c,e.result=f,!1)}function sl(e,n){var r,i,l;if(r=e.input.charCodeAt(e.position),r!==39)return!1;for(e.kind="scalar",e.result="",e.position++,i=l=e.position;(r=e.input.charCodeAt(e.position))!==0;)if(r===39)if(O(e,i,e.position,!0),r=e.input.charCodeAt(++e.position),r===39)i=e.position,e.position++,l=e.position;else return!0;else E(r)?(O(e,i,l,!0),ce(e,A(e,!1,n)),i=l=e.position):e.position===e.lineStart&&X(e)?d(e,"unexpected end of the document within a single quoted scalar"):(e.position++,l=e.position);d(e,"unexpected end of the stream within a single quoted scalar")}function cl(e,n){var r,i,l,t,o,u;if(u=e.input.charCodeAt(e.position),u!==34)return!1;for(e.kind="scalar",e.result="",e.position++,r=i=e.position;(u=e.input.charCodeAt(e.position))!==0;){if(u===34)return O(e,r,e.position,!0),e.position++,!0;if(u===92){if(O(e,r,e.position,!0),u=e.input.charCodeAt(++e.position),E(u))A(e,!1,n);else if(u<256&&bn[u])e.result+=wn[u],e.position++;else if((o=ll(u))>0){for(l=o,t=0;l>0;l--)u=e.input.charCodeAt(++e.position),(o=il(u))>=0?t=(t<<4)+o:d(e,"expected hexadecimal character");e.result+=ol(t),e.position++}else d(e,"unknown escape sequence");r=i=e.position}else E(u)?(O(e,r,i,!0),ce(e,A(e,!1,n)),r=i=e.position):e.position===e.lineStart&&X(e)?d(e,"unexpected end of the document within a double quoted scalar"):(e.position++,i=e.position)}d(e,"unexpected end of the stream within a double quoted scalar")}function pl(e,n){var r=!0,i,l,t,o=e.tag,u,a=e.anchor,s,p,c,f,h,g=Object.create(null),y,x,v,m;if(m=e.input.charCodeAt(e.position),m===91)p=93,h=!1,u=[];else if(m===123)p=125,h=!0,u={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=u),m=e.input.charCodeAt(++e.position);m!==0;){if(A(e,!0,n),m=e.input.charCodeAt(e.position),m===p)return e.position++,e.tag=o,e.anchor=a,e.kind=h?"mapping":"sequence",e.result=u,!0;r?m===44&&d(e,"expected the node content, but found ','"):d(e,"missed comma between flow collection entries"),x=y=v=null,c=f=!1,m===63&&(s=e.input.charCodeAt(e.position+1),T(s)&&(c=f=!0,e.position++,A(e,!0,n))),i=e.line,l=e.lineStart,t=e.position,P(e,n,G,!1,!0),x=e.tag,y=e.result,A(e,!0,n),m=e.input.charCodeAt(e.position),(f||e.line===i)&&m===58&&(c=!0,m=e.input.charCodeAt(++e.position),A(e,!0,n),P(e,n,G,!1,!0),v=e.result),h?R(e,u,g,x,y,v,i,l,t):c?u.push(R(e,null,g,x,y,v,i,l,t)):u.push(y),A(e,!0,n),m=e.input.charCodeAt(e.position),m===44?(r=!0,m=e.input.charCodeAt(++e.position)):r=!1}d(e,"unexpected end of the stream within a flow collection")}function fl(e,n){var r,i,l=ae,t=!1,o=!1,u=n,a=0,s=!1,p,c;if(c=e.input.charCodeAt(e.position),c===124)i=!1;else if(c===62)i=!0;else return!1;for(e.kind="scalar",e.result="";c!==0;)if(c=e.input.charCodeAt(++e.position),c===43||c===45)ae===l?l=c===43?yn:Ji:d(e,"repeat of a chomping mode identifier");else if((p=tl(c))>=0)p===0?d(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):o?d(e,"repeat of an indentation width identifier"):(u=n+p-1,o=!0);else break;if(I(c)){do c=e.input.charCodeAt(++e.position);while(I(c));if(c===35)do c=e.input.charCodeAt(++e.position);while(!E(c)&&c!==0)}for(;c!==0;){for(se(e),e.lineIndent=0,c=e.input.charCodeAt(e.position);(!o||e.lineIndent<u)&&c===32;)e.lineIndent++,c=e.input.charCodeAt(++e.position);if(!o&&e.lineIndent>u&&(u=e.lineIndent),E(c)){a++;continue}if(e.lineIndent<u){l===yn?e.result+=_.repeat(`
`,t?1+a:a):l===ae&&t&&(e.result+=`
`);break}for(i?I(c)?(s=!0,e.result+=_.repeat(`
`,t?1+a:a)):s?(s=!1,e.result+=_.repeat(`
`,a+1)):a===0?t&&(e.result+=" "):e.result+=_.repeat(`
`,a):e.result+=_.repeat(`
`,t?1+a:a),t=!0,o=!0,a=0,r=e.position;!E(c)&&c!==0;)c=e.input.charCodeAt(++e.position);O(e,r,e.position,!1)}return!0}function Sn(e,n){var r,i=e.tag,l=e.anchor,t=[],o,u=!1,a;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=t),a=e.input.charCodeAt(e.position);a!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,d(e,"tab characters must not be used in indentation")),!(a!==45||(o=e.input.charCodeAt(e.position+1),!T(o))));){if(u=!0,e.position++,A(e,!0,-1)&&e.lineIndent<=n){t.push(null),a=e.input.charCodeAt(e.position);continue}if(r=e.line,P(e,n,gn,!1,!0),t.push(e.result),A(e,!0,-1),a=e.input.charCodeAt(e.position),(e.line===r||e.lineIndent>n)&&a!==0)d(e,"bad indentation of a sequence entry");else if(e.lineIndent<n)break}return u?(e.tag=i,e.anchor=l,e.kind="sequence",e.result=t,!0):!1}function dl(e,n,r){var i,l,t,o,u,a,s=e.tag,p=e.anchor,c={},f=Object.create(null),h=null,g=null,y=null,x=!1,v=!1,m;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=c),m=e.input.charCodeAt(e.position);m!==0;){if(!x&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,d(e,"tab characters must not be used in indentation")),i=e.input.charCodeAt(e.position+1),t=e.line,(m===63||m===58)&&T(i))m===63?(x&&(R(e,c,f,h,g,null,o,u,a),h=g=y=null),v=!0,x=!0,l=!0):x?(x=!1,l=!0):d(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,m=i;else{if(o=e.line,u=e.lineStart,a=e.position,!P(e,r,mn,!1,!0))break;if(e.line===t){for(m=e.input.charCodeAt(e.position);I(m);)m=e.input.charCodeAt(++e.position);if(m===58)m=e.input.charCodeAt(++e.position),T(m)||d(e,"a whitespace character is expected after the key-value separator within a block mapping"),x&&(R(e,c,f,h,g,null,o,u,a),h=g=y=null),v=!0,x=!1,l=!1,h=e.tag,g=e.result;else if(v)d(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=s,e.anchor=p,!0}else if(v)d(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=s,e.anchor=p,!0}if((e.line===t||e.lineIndent>n)&&(x&&(o=e.line,u=e.lineStart,a=e.position),P(e,n,V,!0,l)&&(x?g=e.result:y=e.result),x||(R(e,c,f,h,g,y,o,u,a),h=g=y=null),A(e,!0,-1),m=e.input.charCodeAt(e.position)),(e.line===t||e.lineIndent>n)&&m!==0)d(e,"bad indentation of a mapping entry");else if(e.lineIndent<n)break}return x&&R(e,c,f,h,g,null,o,u,a),v&&(e.tag=s,e.anchor=p,e.kind="mapping",e.result=c),v}function hl(e){var n,r=!1,i=!1,l,t,o;if(o=e.input.charCodeAt(e.position),o!==33)return!1;if(e.tag!==null&&d(e,"duplication of a tag property"),o=e.input.charCodeAt(++e.position),o===60?(r=!0,o=e.input.charCodeAt(++e.position)):o===33?(i=!0,l="!!",o=e.input.charCodeAt(++e.position)):l="!",n=e.position,r){do o=e.input.charCodeAt(++e.position);while(o!==0&&o!==62);e.position<e.length?(t=e.input.slice(n,e.position),o=e.input.charCodeAt(++e.position)):d(e,"unexpected end of the stream within a verbatim tag")}else{for(;o!==0&&!T(o);)o===33&&(i?d(e,"tag suffix cannot contain exclamation marks"):(l=e.input.slice(n-1,e.position+1),xn.test(l)||d(e,"named tag handle cannot contain such characters"),i=!0,n=e.position+1)),o=e.input.charCodeAt(++e.position);t=e.input.slice(n,e.position),rl.test(t)&&d(e,"tag suffix cannot contain flow indicator characters")}t&&!vn.test(t)&&d(e,"tag name cannot contain such characters: "+t);try{t=decodeURIComponent(t)}catch{d(e,"tag name is malformed: "+t)}return r?e.tag=t:k.call(e.tagMap,l)?e.tag=e.tagMap[l]+t:l==="!"?e.tag="!"+t:l==="!!"?e.tag="tag:yaml.org,2002:"+t:d(e,'undeclared tag handle "'+l+'"'),!0}function ml(e){var n,r;if(r=e.input.charCodeAt(e.position),r!==38)return!1;for(e.anchor!==null&&d(e,"duplication of an anchor property"),r=e.input.charCodeAt(++e.position),n=e.position;r!==0&&!T(r)&&!F(r);)r=e.input.charCodeAt(++e.position);return e.position===n&&d(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(n,e.position),!0}function gl(e){var n,r,i;if(i=e.input.charCodeAt(e.position),i!==42)return!1;for(i=e.input.charCodeAt(++e.position),n=e.position;i!==0&&!T(i)&&!F(i);)i=e.input.charCodeAt(++e.position);return e.position===n&&d(e,"name of an alias node must contain at least one character"),r=e.input.slice(n,e.position),k.call(e.anchorMap,r)||d(e,'unidentified alias "'+r+'"'),e.result=e.anchorMap[r],A(e,!0,-1),!0}function P(e,n,r,i,l){var t,o,u,a=1,s=!1,p=!1,c,f,h,g,y,x;if(e.listener!==null&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,t=o=u=V===r||gn===r,i&&A(e,!0,-1)&&(s=!0,e.lineIndent>n?a=1:e.lineIndent===n?a=0:e.lineIndent<n&&(a=-1)),a===1)for(;hl(e)||ml(e);)A(e,!0,-1)?(s=!0,u=t,e.lineIndent>n?a=1:e.lineIndent===n?a=0:e.lineIndent<n&&(a=-1)):u=!1;if(u&&(u=s||l),(a===1||V===r)&&(G===r||mn===r?y=n:y=n+1,x=e.position-e.lineStart,a===1?u&&(Sn(e,x)||dl(e,x,y))||pl(e,y)?p=!0:(o&&fl(e,y)||sl(e,y)||cl(e,y)?p=!0:gl(e)?(p=!0,(e.tag!==null||e.anchor!==null)&&d(e,"alias node should not have any properties")):al(e,y,G===r)&&(p=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):a===0&&(p=u&&Sn(e,x))),e.tag===null)e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);else if(e.tag==="?"){for(e.result!==null&&e.kind!=="scalar"&&d(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),c=0,f=e.implicitTypes.length;c<f;c+=1)if(g=e.implicitTypes[c],g.resolve(e.result)){e.result=g.construct(e.result),e.tag=g.tag,e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);break}}else if(e.tag!=="!"){if(k.call(e.typeMap[e.kind||"fallback"],e.tag))g=e.typeMap[e.kind||"fallback"][e.tag];else for(g=null,h=e.typeMap.multi[e.kind||"fallback"],c=0,f=h.length;c<f;c+=1)if(e.tag.slice(0,h[c].tag.length)===h[c].tag){g=h[c];break}g||d(e,"unknown tag !<"+e.tag+">"),e.result!==null&&g.kind!==e.kind&&d(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+g.kind+'", not "'+e.kind+'"'),g.resolve(e.result,e.tag)?(e.result=g.construct(e.result,e.tag),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):d(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||p}function yl(e){var n=e.position,r,i,l,t=!1,o;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(o=e.input.charCodeAt(e.position))!==0&&(A(e,!0,-1),o=e.input.charCodeAt(e.position),!(e.lineIndent>0||o!==37));){for(t=!0,o=e.input.charCodeAt(++e.position),r=e.position;o!==0&&!T(o);)o=e.input.charCodeAt(++e.position);for(i=e.input.slice(r,e.position),l=[],i.length<1&&d(e,"directive name must not be less than one character in length");o!==0;){for(;I(o);)o=e.input.charCodeAt(++e.position);if(o===35){do o=e.input.charCodeAt(++e.position);while(o!==0&&!E(o));break}if(E(o))break;for(r=e.position;o!==0&&!T(o);)o=e.input.charCodeAt(++e.position);l.push(e.input.slice(r,e.position))}o!==0&&se(e),k.call(Tn,i)?Tn[i](e,i,l):W(e,'unknown document directive "'+i+'"')}if(A(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,A(e,!0,-1)):t&&d(e,"directives end mark is expected"),P(e,e.lineIndent-1,V,!1,!0),A(e,!0,-1),e.checkLineBreaks&&nl.test(e.input.slice(n,e.position))&&W(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&X(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,A(e,!0,-1));return}if(e.position<e.length-1)d(e,"end of the stream or a document separator is expected");else return}function $n(e,n){e=String(e),n=n||{},e.length!==0&&(e.charCodeAt(e.length-1)!==10&&e.charCodeAt(e.length-1)!==13&&(e+=`
`),e.charCodeAt(0)===65279&&(e=e.slice(1)));var r=new ul(e,n),i=e.indexOf("\0");for(i!==-1&&(r.position=i,d(r,"null byte is not allowed in input")),r.input+="\0";r.input.charCodeAt(r.position)===32;)r.lineIndent+=1,r.position+=1;for(;r.position<r.length-1;)yl(r);return r.documents}function xl(e,n,r){n!==null&&typeof n=="object"&&typeof r=="undefined"&&(r=n,n=null);var i=$n(e,r);if(typeof n!="function")return i;for(var l=0,t=i.length;l<t;l+=1)n(i[l])}function vl(e,n){var r=$n(e,n);if(r.length!==0){if(r.length===1)return r[0];throw new C("expected a single document in the stream, but found more")}}var Al=xl,_l=vl,kn={loadAll:Al,load:_l},On=Object.prototype.toString,In=Object.prototype.hasOwnProperty,pe=65279,bl=9,j=10,wl=13,Cl=32,Tl=33,El=34,fe=35,Sl=37,$l=38,kl=39,Ol=42,Nn=44,Il=45,Q=58,Nl=61,Fl=62,Ll=63,Rl=64,Fn=91,Ln=93,Pl=96,Rn=123,zl=124,Pn=125,w={};w[0]="\\0";w[7]="\\a";w[8]="\\b";w[9]="\\t";w[10]="\\n";w[11]="\\v";w[12]="\\f";w[13]="\\r";w[27]="\\e";w[34]='\\"';w[92]="\\\\";w[133]="\\N";w[160]="\\_";w[8232]="\\L";w[8233]="\\P";var Bl=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],Dl=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function jl(e,n){var r,i,l,t,o,u,a;if(n===null)return{};for(r={},i=Object.keys(n),l=0,t=i.length;l<t;l+=1)o=i[l],u=String(n[o]),o.slice(0,2)==="!!"&&(o="tag:yaml.org,2002:"+o.slice(2)),a=e.compiledTypeMap.fallback[o],a&&In.call(a.styleAliases,u)&&(u=a.styleAliases[u]),r[o]=u;return r}function Ml(e){var n,r,i;if(n=e.toString(16).toUpperCase(),e<=255)r="x",i=2;else if(e<=65535)r="u",i=4;else if(e<=4294967295)r="U",i=8;else throw new C("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+r+_.repeat("0",i-n.length)+n}var Ul=1,M=2;function Yl(e){this.schema=e.schema||ue,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=_.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=jl(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.quotingType=e.quotingType==='"'?M:Ul,this.forceQuotes=e.forceQuotes||!1,this.replacer=typeof e.replacer=="function"?e.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function zn(e,n){for(var r=_.repeat(" ",n),i=0,l=-1,t="",o,u=e.length;i<u;)l=e.indexOf(`
`,i),l===-1?(o=e.slice(i),i=u):(o=e.slice(i,l+1),i=l+1),o.length&&o!==`
`&&(t+=r),t+=o;return t}function de(e,n){return`
`+_.repeat(" ",e.indent*n)}function ql(e,n){var r,i,l;for(r=0,i=e.implicitTypes.length;r<i;r+=1)if(l=e.implicitTypes[r],l.resolve(n))return!0;return!1}function Z(e){return e===Cl||e===bl}function U(e){return 32<=e&&e<=126||161<=e&&e<=55295&&e!==8232&&e!==8233||57344<=e&&e<=65533&&e!==pe||65536<=e&&e<=1114111}function Bn(e){return U(e)&&e!==pe&&e!==wl&&e!==j}function Dn(e,n,r){var i=Bn(e),l=i&&!Z(e);return(r?i:i&&e!==Nn&&e!==Fn&&e!==Ln&&e!==Rn&&e!==Pn)&&e!==fe&&!(n===Q&&!l)||Bn(n)&&!Z(n)&&e===fe||n===Q&&l}function Hl(e){return U(e)&&e!==pe&&!Z(e)&&e!==Il&&e!==Ll&&e!==Q&&e!==Nn&&e!==Fn&&e!==Ln&&e!==Rn&&e!==Pn&&e!==fe&&e!==$l&&e!==Ol&&e!==Tl&&e!==zl&&e!==Nl&&e!==Fl&&e!==kl&&e!==El&&e!==Sl&&e!==Rl&&e!==Pl}function Kl(e){return!Z(e)&&e!==Q}function Y(e,n){var r=e.charCodeAt(n),i;return r>=55296&&r<=56319&&n+