import{c as Je,d as Ye,r as ie,aa as Ws,u as Gs,t as lt,b as I,f as dt,g as ve,ab as Hs,ac as Qs,j as Bn,h as te,ad as Ht,ae as zs,af as Xs,ag as xs,ah as Zs,ai as ei,aj as ti,ak as _n,n as at,l as Te,e as Pn,o as Mn,R as Kn,i as jt,al as ni,w as Rt,U as je,$ as Dn,T as jn,am as si,an as ye,ao as pn,ap as ii,aq as ri,W as Lt,I as Ct,ar as oi,k as Qt,D as li,as as ai,at as ci,au as fi,av as ui,p as hi,L as di,aw as gn,ax as mi,ay as pi,az as gi,a3 as yi,Q as bi,aA as wi,aB as yn,aC as Si}from"./index-CriPLLD7.js";import{B as qt,e as ki,C as Ni,m as Oi,u as Ai,L as Ti}from"./index-Df5zok-J.js";const[Rn,bn]=Je("action-bar"),qn=Symbol(Rn),Ii={placeholder:Boolean,safeAreaInsetBottom:lt};var Ei=Ye({name:Rn,props:Ii,setup(n,{slots:e}){const t=ie(),s=Ws(t,bn),{linkChildren:i}=Gs(qn);i();const r=()=>{var o;return I("div",{ref:t,class:[bn(),{"van-safe-area-bottom":n.safeAreaInsetBottom}]},[(o=e.default)==null?void 0:o.call(e)])};return()=>n.placeholder?s(r):r()}});const Li=dt(Ei),[Ci,vi]=Je("action-bar-button"),$i=ve({},Hs,{type:String,text:String,icon:String,color:String,loading:Boolean,disabled:Boolean});var Bi=Ye({name:Ci,props:$i,setup(n,{slots:e}){const t=Qs(),{parent:s,index:i}=Bn(qn),r=te(()=>{if(s){const l=s.children[i.value-1];return!(l&&"isButton"in l)}}),o=te(()=>{if(s){const l=s.children[i.value+1];return!(l&&"isButton"in l)}});return Ht({isButton:!0}),()=>{const{type:l,icon:a,text:c,color:h,loading:f,disabled:m}=n;return I(qt,{class:vi([l,{last:o.value,first:r.value}]),size:"large",type:l,icon:a,color:h,loading:f,disabled:m,onClick:t},{default:()=>[e.default?e.default():c]})}}});const wn=dt(Bi);let _i=0;function Pi(){const n=zs(),{name:e="unknown"}=(n==null?void 0:n.type)||{};return`${e}-${++_i}`}const Mi=Symbol(),Ki=()=>Xs(Mi,null);function Fn(n){return Array.isArray(n)?!n.length:n===0?!1:!n}function Di(n,e){if(Fn(n)){if(e.required)return!1;if(e.validateEmpty===!1)return!0}return!(e.pattern&&!e.pattern.test(String(n)))}function ji(n,e){return new Promise(t=>{const s=e.validator(n,e);if(ti(s)){s.then(t);return}t(s)})}function Sn(n,e){const{message:t}=e;return _n(t)?t(n,e):t||""}function Ri({target:n}){n.composing=!0}function kn({target:n}){n.composing&&(n.composing=!1,n.dispatchEvent(new Event("input")))}function qi(n,e){const t=xs();n.style.height="auto";let s=n.scrollHeight;if(ei(e)){const{maxHeight:i,minHeight:r}=e;i!==void 0&&(s=Math.min(s,i)),r!==void 0&&(s=Math.max(s,r))}s&&(n.style.height=`${s}px`,Zs(t))}function Fi(n){return n==="number"?{type:"text",inputmode:"decimal"}:n==="digit"?{type:"tel",inputmode:"numeric"}:{type:n}}function ee(n){return[...n].length}function vt(n,e){return[...n].slice(0,e).join("")}const[Ui,U]=Je("field"),Vi={id:String,name:String,leftIcon:String,rightIcon:String,autofocus:Boolean,clearable:Boolean,maxlength:at,max:Number,min:Number,formatter:Function,clearIcon:Te("clear"),modelValue:Mn(""),inputAlign:String,placeholder:String,autocomplete:String,autocapitalize:String,autocorrect:String,errorMessage:String,enterkeyhint:String,clearTrigger:Te("focus"),formatTrigger:Te("onChange"),spellcheck:{type:Boolean,default:null},error:{type:Boolean,default:null},disabled:{type:Boolean,default:null},readonly:{type:Boolean,default:null}},Ji=ve({},ki,Vi,{rows:at,type:Te("text"),rules:Array,autosize:[Boolean,Object],labelWidth:at,labelClass:Pn,labelAlign:String,showWordLimit:Boolean,errorMessageAlign:String,colon:{type:Boolean,default:null}});var Yi=Ye({name:Ui,props:Ji,emits:["blur","focus","clear","keypress","clickInput","endValidate","startValidate","clickLeftIcon","clickRightIcon","update:modelValue"],setup(n,{emit:e,slots:t}){const s=Pi(),i=Kn({status:"unvalidated",focused:!1,validateMessage:""}),r=ie(),o=ie(),l=ie(),{parent:a}=Bn(si),c=()=>{var g;return String((g=n.modelValue)!=null?g:"")},h=g=>{if(ye(n[g]))return n[g];if(a&&ye(a.props[g]))return a.props[g]},f=te(()=>{const g=h("readonly");if(n.clearable&&!g){const E=c()!=="",L=n.clearTrigger==="always"||n.clearTrigger==="focus"&&i.focused;return E&&L}return!1}),m=te(()=>l.value&&t.input?l.value():n.modelValue),d=te(()=>{var g;const E=h("required");return E==="auto"?(g=n.rules)==null?void 0:g.some(L=>L.required):E}),b=g=>g.reduce((E,L)=>E.then(()=>{if(i.status==="failed")return;let{value:K}=m;if(L.formatter&&(K=L.formatter(K,L)),!Di(K,L)){i.status="failed",i.validateMessage=Sn(K,L);return}if(L.validator)return Fn(K)&&L.validateEmpty===!1?void 0:ji(K,L).then(D=>{D&&typeof D=="string"?(i.status="failed",i.validateMessage=D):D===!1&&(i.status="failed",i.validateMessage=Sn(K,L))})}),Promise.resolve()),u=()=>{i.status="unvalidated",i.validateMessage=""},p=()=>e("endValidate",{status:i.status,message:i.validateMessage}),y=(g=n.rules)=>new Promise(E=>{u(),g?(e("startValidate"),b(g).then(()=>{i.status==="failed"?(E({name:n.name,message:i.validateMessage}),p()):(i.status="passed",E(),p())})):E()}),w=g=>{if(a&&n.rules){const{validateTrigger:E}=a.props,L=pn(E).includes(g),K=n.rules.filter(D=>D.trigger?pn(D.trigger).includes(g):L);K.length&&y(K)}},O=g=>{var E;const{maxlength:L}=n;if(ye(L)&&ee(g)>+L){const K=c();if(K&&ee(K)===+L)return K;const D=(E=r.value)==null?void 0:E.selectionEnd;if(i.focused&&D){const ae=[...g],ce=ae.length-+L;return ae.splice(D-ce,ce),ae.join("")}return vt(g,+L)}return g},S=(g,E="onChange")=>{var L,K;const D=g;g=O(g);const ae=ee(D)-ee(g);if(n.type==="number"||n.type==="digit"){const Q=n.type==="number";g=ii(g,Q,Q),E==="onBlur"&&g!==""&&(n.min!==void 0||n.max!==void 0)&&(g=ri(+g,(L=n.min)!=null?L:-1/0,(K=n.max)!=null?K:1/0).toString())}let ce=0;if(n.formatter&&E===n.formatTrigger){const{formatter:Q,maxlength:Z}=n;if(g=Q(g),ye(Z)&&ee(g)>+Z&&(g=vt(g,+Z)),r.value&&i.focused){const{selectionEnd:ze}=r.value,mn=vt(D,ze);ce=ee(Q(mn))-ee(mn)}}if(r.value&&r.value.value!==g)if(i.focused){let{selectionStart:Q,selectionEnd:Z}=r.value;if(r.value.value=g,ye(Q)&&ye(Z)){const ze=ee(g);ae?(Q-=ae,Z-=ae):ce&&(Q+=ce,Z+=ce),r.value.setSelectionRange(Math.min(Q,ze),Math.min(Z,ze))}}else r.value.value=g;g!==n.modelValue&&e("update:modelValue",g)},A=g=>{g.target.composing||S(g.target.value)},N=()=>{var g;return(g=r.value)==null?void 0:g.blur()},v=()=>{var g;return(g=r.value)==null?void 0:g.focus()},k=()=>{const g=r.value;n.type==="textarea"&&n.autosize&&g&&qi(g,n.autosize)},P=g=>{i.focused=!0,e("focus",g),je(k),h("readonly")&&N()},H=g=>{i.focused=!1,S(c(),"onBlur"),e("blur",g),!h("readonly")&&(w("onBlur"),je(k),ai())},x=g=>e("clickInput",g),M=g=>e("clickLeftIcon",g),Qe=g=>e("clickRightIcon",g),Ms=g=>{Lt(g),e("update:modelValue",""),e("clear",g)},hn=te(()=>{if(typeof n.error=="boolean")return n.error;if(a&&a.props.showError&&i.status==="failed")return!0}),Ks=te(()=>{const g=h("labelWidth"),E=h("labelAlign");if(g&&E!=="top")return{width:jt(g)}}),Ds=g=>{g.keyCode===13&&(!(a&&a.props.submitOnEnter)&&n.type!=="textarea"&&Lt(g),n.type==="search"&&N()),e("keypress",g)},dn=()=>n.id||`${s}-input`,js=()=>i.status,Rs=()=>{const g=U("control",[h("inputAlign"),{error:hn.value,custom:!!t.input,"min-height":n.type==="textarea"&&!n.autosize}]);if(t.input)return I("div",{class:g,onClick:x},[t.input()]);const E={id:dn(),ref:r,name:n.name,rows:n.rows!==void 0?+n.rows:void 0,class:g,disabled:h("disabled"),readonly:h("readonly"),autofocus:n.autofocus,placeholder:n.placeholder,autocomplete:n.autocomplete,autocapitalize:n.autocapitalize,autocorrect:n.autocorrect,enterkeyhint:n.enterkeyhint,spellcheck:n.spellcheck,"aria-labelledby":n.label?`${s}-label`:void 0,"data-allow-mismatch":"attribute",onBlur:H,onFocus:P,onInput:A,onClick:x,onChange:kn,onKeypress:Ds,onCompositionend:kn,onCompositionstart:Ri};return n.type==="textarea"?I("textarea",E,null):I("input",Qt(Fi(n.type),E),null)},qs=()=>{const g=t["left-icon"];if(n.leftIcon||g)return I("div",{class:U("left-icon"),onClick:M},[g?g():I(Ct,{name:n.leftIcon,classPrefix:n.iconPrefix},null)])},Fs=()=>{const g=t["right-icon"];if(n.rightIcon||g)return I("div",{class:U("right-icon"),onClick:Qe},[g?g():I(Ct,{name:n.rightIcon,classPrefix:n.iconPrefix},null)])},Us=()=>{if(n.showWordLimit&&n.maxlength){const g=ee(c());return I("div",{class:U("word-limit")},[I("span",{class:U("word-num")},[g]),li("/"),n.maxlength])}},Vs=()=>{if(a&&a.props.showErrorMessage===!1)return;const g=n.errorMessage||i.validateMessage;if(g){const E=t["error-message"],L=h("errorMessageAlign");return I("div",{class:U("error-message",L)},[E?E({message:g}):g])}},Js=()=>{const g=h("labelWidth"),E=h("labelAlign"),L=h("colon")?":":"";if(t.label)return[t.label(),L];if(n.label)return I("label",{id:`${s}-label`,for:t.input?void 0:dn(),"data-allow-mismatch":"attribute",onClick:K=>{Lt(K),v()},style:E==="top"&&g?{width:jt(g)}:void 0},[n.label+L])},Ys=()=>[I("div",{class:U("body")},[Rs(),f.value&&I(Ct,{ref:o,name:n.clearIcon,class:U("clear")},null),Fs(),t.button&&I("div",{class:U("button")},[t.button()])]),Us(),Vs()];return Ht({blur:N,focus:v,validate:y,formValue:m,resetValidation:u,getValidationStatus:js}),ni(oi,{customValue:l,resetValidation:u,validateWithTrigger:w}),Rt(()=>n.modelValue,()=>{S(c()),u(),w("onChange"),je(k)}),Dn(()=>{S(c(),n.formatTrigger),je(k)}),jn("touchstart",Ms,{target:te(()=>{var g;return(g=o.value)==null?void 0:g.$el})}),()=>{const g=h("disabled"),E=h("labelAlign"),L=qs(),K=()=>{const D=Js();return E==="top"?[L,D].filter(Boolean):D||[]};return I(Ni,{size:n.size,class:U({error:hn.value,disabled:g,[`label-${E}`]:E}),center:n.center,border:n.border,isLink:n.isLink,clickable:n.clickable,titleStyle:Ks.value,valueClass:U("value"),titleClass:[U("label",[E,{required:d.value}]),n.labelClass],arrowDirection:n.arrowDirection},{icon:L&&E!=="top"?()=>L:null,title:K,value:Ys,extra:t.extra})}}});const go=dt(Yi),[Wi,Y,Xe]=Je("dialog"),Gi=ve({},ci,{title:String,theme:String,width:at,message:[String,Function],callback:Function,allowHtml:Boolean,className:Pn,transition:Te("van-dialog-bounce"),messageAlign:String,closeOnPopstate:lt,showCancelButton:Boolean,cancelButtonText:String,cancelButtonColor:String,cancelButtonDisabled:Boolean,confirmButtonText:String,confirmButtonColor:String,confirmButtonDisabled:Boolean,showConfirmButton:lt,closeOnClickOverlay:Boolean}),Hi=[...fi,"transition","closeOnPopstate"];var Qi=Ye({name:Wi,props:Gi,emits:["confirm","cancel","keydown","update:show"],setup(n,{emit:e,slots:t}){const s=ie(),i=Kn({confirm:!1,cancel:!1}),r=y=>e("update:show",y),o=y=>{var w;r(!1),(w=n.callback)==null||w.call(n,y)},l=y=>()=>{n.show&&(e(y),n.beforeClose?(i[y]=!0,gi(n.beforeClose,{args:[y],done(){o(y),i[y]=!1},canceled(){i[y]=!1}})):o(y))},a=l("cancel"),c=l("confirm"),h=ui(y=>{var w,O;if(y.target!==((O=(w=s.value)==null?void 0:w.popupRef)==null?void 0:O.value))return;({Enter:n.showConfirmButton?c:gn,Escape:n.showCancelButton?a:gn})[y.key](),e("keydown",y)},["enter","esc"]),f=()=>{const y=t.title?t.title():n.title;if(y)return I("div",{class:Y("header",{isolated:!n.message&&!t.default})},[y])},m=y=>{const{message:w,allowHtml:O,messageAlign:S}=n,A=Y("message",{"has-title":y,[S]:S}),N=_n(w)?w():w;return O&&typeof N=="string"?I("div",{class:A,innerHTML:N},null):I("div",{class:A},[N])},d=()=>{if(t.default)return I("div",{class:Y("content")},[t.default()]);const{title:y,message:w,allowHtml:O}=n;if(w){const S=!!(y||t.title);return I("div",{key:O?1:0,class:Y("content",{isolated:!S})},[m(S)])}},b=()=>I("div",{class:[pi,Y("footer")]},[n.showCancelButton&&I(qt,{size:"large",text:n.cancelButtonText||Xe("cancel"),class:Y("cancel"),style:{color:n.cancelButtonColor},loading:i.cancel,disabled:n.cancelButtonDisabled,onClick:a},null),n.showConfirmButton&&I(qt,{size:"large",text:n.confirmButtonText||Xe("confirm"),class:[Y("confirm"),{[mi]:n.showCancelButton}],style:{color:n.confirmButtonColor},loading:i.confirm,disabled:n.confirmButtonDisabled,onClick:c},null)]),u=()=>I(Li,{class:Y("footer")},{default:()=>[n.showCancelButton&&I(wn,{type:"warning",text:n.cancelButtonText||Xe("cancel"),class:Y("cancel"),color:n.cancelButtonColor,loading:i.cancel,disabled:n.cancelButtonDisabled,onClick:a},null),n.showConfirmButton&&I(wn,{type:"danger",text:n.confirmButtonText||Xe("confirm"),class:Y("confirm"),color:n.confirmButtonColor,loading:i.confirm,disabled:n.confirmButtonDisabled,onClick:c},null)]}),p=()=>t.footer?t.footer():n.theme==="round-button"?u():b();return()=>{const{width:y,title:w,theme:O,message:S,className:A}=n;return I(di,Qt({ref:s,role:"dialog",class:[Y([O]),A],style:{width:jt(y)},tabindex:0,"aria-labelledby":w||S,onKeydown:h,"onUpdate:show":r},hi(n,Hi)),{default:()=>[f(),d(),p()]})}}});let Ft;const zi={title:"",width:"",theme:null,message:"",overlay:!0,callback:null,teleport:"body",className:"",allowHtml:!1,lockScroll:!0,transition:void 0,beforeClose:null,overlayClass:"",overlayStyle:void 0,messageAlign:"",cancelButtonText:"",cancelButtonColor:null,cancelButtonDisabled:!1,confirmButtonText:"",confirmButtonColor:null,confirmButtonDisabled:!1,showConfirmButton:!0,showCancelButton:!1,closeOnPopstate:!0,closeOnClickOverlay:!1};let Xi=ve({},zi);function xi(){({instance:Ft}=Oi({setup(){const{state:e,toggle:t}=Ai();return()=>I(Qi,Qt(e,{"onUpdate:show":t}),null)}}))}function Zi(n){return yi?new Promise((e,t)=>{Ft||xi(),Ft.open(ve({},Xi,n,{callback:s=>{(s==="confirm"?e:t)(s)}}))}):Promise.resolve(void 0)}const yo=n=>Zi(ve({showCancelButton:!0},n)),[er,be,tr]=Je("list"),nr={error:Boolean,offset:Mn(300),loading:Boolean,disabled:Boolean,finished:Boolean,scroller:Object,errorText:String,direction:Te("down"),loadingText:String,finishedText:String,immediateCheck:lt};var sr=Ye({name:er,props:nr,emits:["load","update:error","update:loading"],setup(n,{emit:e,slots:t}){const s=ie(n.loading),i=ie(),r=ie(),o=Ki(),l=bi(i),a=te(()=>n.scroller||l.value),c=()=>{je(()=>{if(s.value||n.finished||n.disabled||n.error||(o==null?void 0:o.value)===!1)return;const{direction:b}=n,u=+n.offset,p=yn(a);if(!p.height||Si(i))return;let y=!1;const w=yn(r);b==="up"?y=p.top-w.top<=u:y=w.bottom-p.bottom<=u,y&&(s.value=!0,e("update:loading",!0),e("load"))})},h=()=>{if(n.finished){const b=t.finished?t.finished():n.finishedText;if(b)return I("div",{class:be("finished-text")},[b])}},f=()=>{e("update:error",!1),c()},m=()=>{if(n.error){const b=t.error?t.error():n.errorText;if(b)return I("div",{role:"button",class:be("error-text"),tabindex:0,onClick:f},[b])}},d=()=>{if(s.value&&!n.finished&&!n.disabled)return I("div",{class:be("loading")},[t.loading?t.loading():I(Ti,{class:be("loading-icon")},{default:()=>[n.loadingText||tr("loading")]})])};return Rt(()=>[n.loading,n.finished,n.error],c),o&&Rt(o,b=>{b&&c()}),wi(()=>{s.value=n.loading}),Dn(()=>{n.immediateCheck&&c()}),Ht({check:c}),jn("scroll",c,{target:a,passive:!0}),()=>{var b;const u=(b=t.default)==null?void 0:b.call(t),p=I("div",{ref:r,class:be("placeholder")},null);return I("div",{ref:i,role:"feed",class:be(),"aria-busy":s.value},[n.direction==="down"?u:p,d(),h(),m(),n.direction==="up"?u:p])}}});const bo=dt(sr),zt=Symbol.for("yaml.alias"),Ut=Symbol.for("yaml.document"),re=Symbol.for("yaml.map"),Un=Symbol.for("yaml.pair"),X=Symbol.for("yaml.scalar"),$e=Symbol.for("yaml.seq"),J=Symbol.for("yaml.node.type"),pe=n=>!!n&&typeof n=="object"&&n[J]===zt,ge=n=>!!n&&typeof n=="object"&&n[J]===Ut,Be=n=>!!n&&typeof n=="object"&&n[J]===re,$=n=>!!n&&typeof n=="object"&&n[J]===Un,C=n=>!!n&&typeof n=="object"&&n[J]===X,_e=n=>!!n&&typeof n=="object"&&n[J]===$e;function B(n){if(n&&typeof n=="object")switch(n[J]){case re:case $e:return!0}return!1}function _(n){if(n&&typeof n=="object")switch(n[J]){case zt:case re:case X:case $e:return!0}return!1}const ir=n=>(C(n)||B(n))&&!!n.anchor,q=Symbol("break visit"),Vn=Symbol("skip children"),z=Symbol("remove node");function oe(n,e){const t=Jn(e);ge(n)?ke(null,n.contents,t,Object.freeze([n]))===z&&(n.contents=null):ke(null,n,t,Object.freeze([]))}oe.BREAK=q;oe.SKIP=Vn;oe.REMOVE=z;function ke(n,e,t,s){const i=Yn(n,e,t,s);if(_(i)||$(i))return Wn(n,s,i),ke(n,i,t,s);if(typeof i!="symbol"){if(B(e)){s=Object.freeze(s.concat(e));for(let r=0;r<e.items.length;++r){const o=ke(r,e.items[r],t,s);if(typeof o=="number")r=o-1;else{if(o===q)return q;o===z&&(e.items.splice(r,1),r-=1)}}}else if($(e)){s=Object.freeze(s.concat(e));const r=ke("key",e.key,t,s);if(r===q)return q;r===z&&(e.key=null);const o=ke("value",e.value,t,s);if(o===q)return q;o===z&&(e.value=null)}}return i}async function mt(n,e){const t=Jn(e);ge(n)?await Ne(null,n.contents,t,Object.freeze([n]))===z&&(n.contents=null):await Ne(null,n,t,Object.freeze([]))}mt.BREAK=q;mt.SKIP=Vn;mt.REMOVE=z;async function Ne(n,e,t,s){const i=await Yn(n,e,t,s);if(_(i)||$(i))return Wn(n,s,i),Ne(n,i,t,s);if(typeof i!="symbol"){if(B(e)){s=Object.freeze(s.concat(e));for(let r=0;r<e.items.length;++r){const o=await Ne(r,e.items[r],t,s);if(typeof o=="number")r=o-1;else{if(o===q)return q;o===z&&(e.items.splice(r,1),r-=1)}}}else if($(e)){s=Object.freeze(s.concat(e));const r=await Ne("key",e.key,t,s);if(r===q)return q;r===z&&(e.key=null);const o=await Ne("value",e.value,t,s);if(o===q)return q;o===z&&(e.value=null)}}return i}function Jn(n){return typeof n=="object"&&(n.Collection||n.Node||n.Value)?Object.assign({Alias:n.Node,Map:n.Node,Scalar:n.Node,Seq:n.Node},n.Value&&{Map:n.Value,Scalar:n.Value,Seq:n.Value},n.Collection&&{Map:n.Collection,Seq:n.Collection},n):n}function Yn(n,e,t,s){var i,r,o,l,a;if(typeof t=="function")return t(n,e,s);if(Be(e))return(i=t.Map)==null?void 0:i.call(t,n,e,s);if(_e(e))return(r=t.Seq)==null?void 0:r.call(t,n,e,s);if($(e))return(o=t.Pair)==null?void 0:o.call(t,n,e,s);if(C(e))return(l=t.Scalar)==null?void 0:l.call(t,n,e,s);if(pe(e))return(a=t.Alias)==null?void 0:a.call(t,n,e,s)}function Wn(n,e,t){const s=e[e.length-1];if(B(s))s.items[n]=t;else if($(s))n==="key"?s.key=t:s.value=t;else if(ge(s))s.contents=t;else{const i=pe(s)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}const rr={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},or=n=>n.replace(/[!,[\]{}]/g,e=>rr[e]);class R{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},R.defaultYaml,e),this.tags=Object.assign({},R.defaultTags,t)}clone(){const e=new R(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){const e=new R(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:R.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},R.defaultTags);break}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:R.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},R.defaultTags),this.atNextDocument=!1);const s=e.trim().split(/[ \t]+/),i=s.shift();switch(i){case"%TAG":{if(s.length!==2&&(t(0,"%TAG directive should contain exactly two parts"),s.length<2))return!1;const[r,o]=s;return this.tags[r]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,s.length!==1)return t(0,"%YAML directive should contain exactly one part"),!1;const[r]=s;if(r==="1.1"||r==="1.2")return this.yaml.version=r,!0;{const o=/^\d+\.\d+$/.test(r);return t(6,`Unsupported YAML version ${r}`,o),!1}}default:return t(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e==="!")return"!";if(e[0]!=="!")return t(`Not a valid tag: ${e}`),null;if(e[1]==="<"){const o=e.slice(2,-1);return o==="!"||o==="!!"?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&t("Verbatim tags must end with a >"),o)}const[,s,i]=e.match(/^(.*!)([^!]*)$/s);i||t(`The ${e} tag has no suffix`);const r=this.tags[s];if(r)try{return r+decodeURIComponent(i)}catch(o){return t(String(o)),null}return s==="!"?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(const[t,s]of Object.entries(this.tags))if(e.startsWith(s))return t+or(e.substring(s.length));return e[0]==="!"?e:`!<${e}>`}toString(e){const t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],s=Object.entries(this.tags);let i;if(e&&s.length>0&&_(e.contents)){const r={};oe(e.contents,(o,l)=>{_(l)&&l.tag&&(r[l.tag]=!0)}),i=Object.keys(r)}else i=[];for(const[r,o]of s)r==="!!"&&o==="tag:yaml.org,2002:"||(!e||i.some(l=>l.startsWith(o)))&&t.push(`%TAG ${r} ${o}`);return t.join(`
`)}}R.defaultYaml={explicit:!1,version:"1.2"};R.defaultTags={"!!":"tag:yaml.org,2002:"};function Gn(n){if(/[\x00-\x19\s,[\]{}]/.test(n)){const t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(n)}`;throw new Error(t)}return!0}function Hn(n){const e=new Set;return oe(n,{Value(t,s){s.anchor&&e.add(s.anchor)}}),e}function Qn(n,e){for(let t=1;;++t){const s=`${n}${t}`;if(!e.has(s))return s}}function lr(n,e){const t=[],s=new Map;let i=null;return{onAnchor:r=>{t.push(r),i||(i=Hn(n));const o=Qn(e,i);return i.add(o),o},setAnchors:()=>{for(const r of t){const o=s.get(r);if(typeof o=="object"&&o.anchor&&(C(o.node)||B(o.node)))o.node.anchor=o.anchor;else{const l=new Error("Failed to resolve repeated object (this should not happen)");throw l.source=r,l}}},sourceObjects:s}}function Oe(n,e,t,s){if(s&&typeof s=="object")if(Array.isArray(s))for(let i=0,r=s.length;i<r;++i){const o=s[i],l=Oe(n,s,String(i),o);l===void 0?delete s[i]:l!==o&&(s[i]=l)}else if(s instanceof Map)for(const i of Array.from(s.keys())){const r=s.get(i),o=Oe(n,s,i,r);o===void 0?s.delete(i):o!==r&&s.set(i,o)}else if(s instanceof Set)for(const i of Array.from(s)){const r=Oe(n,s,i,i);r===void 0?s.delete(i):r!==i&&(s.delete(i),s.add(r))}else for(const[i,r]of Object.entries(s)){const o=Oe(n,s,i,r);o===void 0?delete s[i]:o!==r&&(s[i]=o)}return n.call(e,t,s)}function V(n,e,t){if(Array.isArray(n))return n.map((s,i)=>V(s,String(i),t));if(n&&typeof n.toJSON=="function"){if(!t||!ir(n))return n.toJSON(e,t);const s={aliasCount:0,count:1,res:void 0};t.anchors.set(n,s),t.onCreate=r=>{s.res=r,delete t.onCreate};const i=n.toJSON(e,t);return t.onCreate&&t.onCreate(i),i}return typeof n=="bigint"&&!(t!=null&&t.keep)?Number(n):n}class Xt{constructor(e){Object.defineProperty(this,J,{value:e})}clone(){const e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:s,onAnchor:i,reviver:r}={}){if(!ge(e))throw new TypeError("A document argument is required");const o={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof s=="number"?s:100},l=V(this,"",o);if(typeof i=="function")for(const{count:a,res:c}of o.anchors.values())i(c,a);return typeof r=="function"?Oe(r,{"":l},"",l):l}}class pt extends Xt{constructor(e){super(zt),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e){let t;return oe(e,{Node:(s,i)=>{if(i===this)return oe.BREAK;i.anchor===this.source&&(t=i)}}),t}toJSON(e,t){if(!t)return{source:this.source};const{anchors:s,doc:i,maxAliasCount:r}=t,o=this.resolve(i);if(!o){const a=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(a)}let l=s.get(o);if(l||(V(o,null,t),l=s.get(o)),!l||l.res===void 0){const a="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(a)}if(r>=0&&(l.count+=1,l.aliasCount===0&&(l.aliasCount=st(i,o,s)),l.count*l.aliasCount>r)){const a="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(a)}return l.res}toString(e,t,s){const i=`*${this.source}`;if(e){if(Gn(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){const r=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(r)}if(e.implicitKey)return`${i} `}return i}}function st(n,e,t){if(pe(e)){const s=e.resolve(n),i=t&&s&&t.get(s);return i?i.count*i.aliasCount:0}else if(B(e)){let s=0;for(const i of e.items){const r=st(n,i,t);r>s&&(s=r)}return s}else if($(e)){const s=st(n,e.key,t),i=st(n,e.value,t);return Math.max(s,i)}return 1}const zn=n=>!n||typeof n!="function"&&typeof n!="object";class T extends Xt{constructor(e){super(X),this.value=e}toJSON(e,t){return t!=null&&t.keep?this.value:V(this.value,e,t)}toString(){return String(this.value)}}T.BLOCK_FOLDED="BLOCK_FOLDED";T.BLOCK_LITERAL="BLOCK_LITERAL";T.PLAIN="PLAIN";T.QUOTE_DOUBLE="QUOTE_DOUBLE";T.QUOTE_SINGLE="QUOTE_SINGLE";const ar="tag:yaml.org,2002:";function cr(n,e,t){if(e){const s=t.filter(r=>r.tag===e),i=s.find(r=>!r.format)??s[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return t.find(s=>{var i;return((i=s.identify)==null?void 0:i.call(s,n))&&!s.format})}function Fe(n,e,t){var f,m,d;if(ge(n)&&(n=n.contents),_(n))return n;if($(n)){const b=(m=(f=t.schema[re]).createNode)==null?void 0:m.call(f,t.schema,null,t);return b.items.push(n),b}(n instanceof String||n instanceof Number||n instanceof Boolean||typeof BigInt<"u"&&n instanceof BigInt)&&(n=n.valueOf());const{aliasDuplicateObjects:s,onAnchor:i,onTagObj:r,schema:o,sourceObjects:l}=t;let a;if(s&&n&&typeof n=="object"){if(a=l.get(n),a)return a.anchor||(a.anchor=i(n)),new pt(a.anchor);a={anchor:null,node:null},l.set(n,a)}e!=null&&e.startsWith("!!")&&(e=ar+e.slice(2));let c=cr(n,e,o.tags);if(!c){if(n&&typeof n.toJSON=="function"&&(n=n.toJSON()),!n||typeof n!="object"){const b=new T(n);return a&&(a.node=b),b}c=n instanceof Map?o[re]:Symbol.iterator in Object(n)?o[$e]:o[re]}r&&(r(c),delete t.onTagObj);const h=c!=null&&c.createNode?c.createNode(t.schema,n,t):typeof((d=c==null?void 0:c.nodeClass)==null?void 0:d.from)=="function"?c.nodeClass.from(t.schema,n,t):new T(n);return e?h.tag=e:c.default||(h.tag=c.tag),a&&(a.node=h),h}function ct(n,e,t){let s=t;for(let i=e.length-1;i>=0;--i){const r=e[i];if(typeof r=="number"&&Number.isInteger(r)&&r>=0){const o=[];o[r]=s,s=o}else s=new Map([[r,s]])}return Fe(s,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:n,sourceObjects:new Map})}const Re=n=>n==null||typeof n=="object"&&!!n[Symbol.iterator]().next().done;class Xn extends Xt{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(s=>_(s)||$(s)?s.clone(e):s),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(Re(e))this.add(t);else{const[s,...i]=e,r=this.get(s,!0);if(B(r))r.addIn(i,t);else if(r===void 0&&this.schema)this.set(s,ct(this.schema,i,t));else throw new Error(`Expected YAML collection at ${s}. Remaining path: ${i}`)}}deleteIn(e){const[t,...s]=e;if(s.length===0)return this.delete(t);const i=this.get(t,!0);if(B(i))return i.deleteIn(s);throw new Error(`Expected YAML collection at ${t}. Remaining path: ${s}`)}getIn(e,t){const[s,...i]=e,r=this.get(s,!0);return i.length===0?!t&&C(r)?r.value:r:B(r)?r.getIn(i,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!$(t))return!1;const s=t.value;return s==null||e&&C(s)&&s.value==null&&!s.commentBefore&&!s.comment&&!s.tag})}hasIn(e){const[t,...s]=e;if(s.length===0)return this.has(t);const i=this.get(t,!0);return B(i)?i.hasIn(s):!1}setIn(e,t){const[s,...i]=e;if(i.length===0)this.set(s,t);else{const r=this.get(s,!0);if(B(r))r.setIn(i,t);else if(r===void 0&&this.schema)this.set(s,ct(this.schema,i,t));else throw new Error(`Expected YAML collection at ${s}. Remaining path: ${i}`)}}}const fr=n=>n.replace(/^(?!$)(?: $)?/gm,"#");function ne(n,e){return/^\n+$/.test(n)?n.substring(1):e?n.replace(/^(?! *$)/gm,e):n}const ue=(n,e,t)=>n.endsWith(`
`)?ne(t,e):t.includes(`
`)?`
`+ne(t,e):(n.endsWith(" ")?"":" ")+t,xn="flow",Vt="block",it="quoted";function gt(n,e,t="flow",{indentAtStart:s,lineWidth:i=80,minContentWidth:r=20,onFold:o,onOverflow:l}={}){if(!i||i<0)return n;i<r&&(r=0);const a=Math.max(1+r,1+i-e.length);if(n.length<=a)return n;const c=[],h={};let f=i-e.length;typeof s=="number"&&(s>i-Math.max(2,r)?c.push(0):f=i-s);let m,d,b=!1,u=-1,p=-1,y=-1;t===Vt&&(u=Nn(n,u,e.length),u!==-1&&(f=u+a));for(let O;O=n[u+=1];){if(t===it&&O==="\\"){switch(p=u,n[u+1]){case"x":u+=3;break;case"u":u+=5;break;case"U":u+=9;break;default:u+=1}y=u}if(O===`
`)t===Vt&&(u=Nn(n,u,e.length)),f=u+e.length+a,m=void 0;else{if(O===" "&&d&&d!==" "&&d!==`
`&&d!=="	"){const S=n[u+1];S&&S!==" "&&S!==`
`&&S!=="	"&&(m=u)}if(u>=f)if(m)c.push(m),f=m+a,m=void 0;else if(t===it){for(;d===" "||d==="	";)d=O,O=n[u+=1],b=!0;const S=u>y+1?u-2:p-1;if(h[S])return n;c.push(S),h[S]=!0,f=S+a,m=void 0}else b=!0}d=O}if(b&&l&&l(),c.length===0)return n;o&&o();let w=n.slice(0,c[0]);for(let O=0;O<c.length;++O){const S=c[O],A=c[O+1]||n.length;S===0?w=`
${e}${n.slice(0,A)}`:(t===it&&h[S]&&(w+=`${n[S]}\\`),w+=`
${e}${n.slice(S+1,A)}`)}return w}function Nn(n,e,t){let s=e,i=e+1,r=n[i];for(;r===" "||r==="	";)if(e<i+t)r=n[++e];else{do r=n[++e];while(r&&r!==`
`);s=e,i=e+1,r=n[i]}return s}const yt=(n,e)=>({indentAtStart:e?n.indent.length:n.indentAtStart,lineWidth:n.options.lineWidth,minContentWidth:n.options.minContentWidth}),bt=n=>/^(%|---|\.\.\.)/m.test(n);function ur(n,e,t){if(!e||e<0)return!1;const s=e-t,i=n.length;if(i<=s)return!1;for(let r=0,o=0;r<i;++r)if(n[r]===`
`){if(r-o>s)return!0;if(o=r+1,i-o<=s)return!1}return!0}function qe(n,e){const t=JSON.stringify(n);if(e.options.doubleQuotedAsJSON)return t;const{implicitKey:s}=e,i=e.options.doubleQuotedMinMultiLineLength,r=e.indent||(bt(n)?"  ":"");let o="",l=0;for(let a=0,c=t[a];c;c=t[++a])if(c===" "&&t[a+1]==="\\"&&t[a+2]==="n"&&(o+=t.slice(l,a)+"\\ ",a+=1,l=a,c="\\"),c==="\\")switch(t[a+1]){case"u":{o+=t.slice(l,a);const h=t.substr(a+2,4);switch(h){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:h.substr(0,2)==="00"?o+="\\x"+h.substr(2):o+=t.substr(a,6)}a+=5,l=a+1}break;case"n":if(s||t[a+2]==='"'||t.length<i)a+=1;else{for(o+=t.slice(l,a)+`

`;t[a+2]==="\\"&&t[a+3]==="n"&&t[a+4]!=='"';)o+=`
`,a+=2;o+=r,t[a+2]===" "&&(o+="\\"),a+=1,l=a+1}break;default:a+=1}return o=l?o+t.slice(l):t,s?o:gt(o,r,it,yt(e,!1))}function Jt(n,e){if(e.options.singleQuote===!1||e.implicitKey&&n.includes(`
`)||/[ \t]\n|\n[ \t]/.test(n))return qe(n,e);const t=e.indent||(bt(n)?"  ":""),s="'"+n.replace(/'/g,"''").replace(/\n+/g,`$&
${t}`)+"'";return e.implicitKey?s:gt(s,t,xn,yt(e,!1))}function Ae(n,e){const{singleQuote:t}=e.options;let s;if(t===!1)s=qe;else{const i=n.includes('"'),r=n.includes("'");i&&!r?s=Jt:r&&!i?s=qe:s=t?Jt:qe}return s(n,e)}let Yt;try{Yt=new RegExp(`(^|(?<!
))
+(?!
|$)`,"g")}catch{Yt=/\n+(?!\n|$)/g}function rt({comment:n,type:e,value:t},s,i,r){const{blockQuote:o,commentString:l,lineWidth:a}=s.options;if(!o||/\n[\t ]+$/.test(t)||/^\s*$/.test(t))return Ae(t,s);const c=s.indent||(s.forceBlockIndent||bt(t)?"  ":""),h=o==="literal"?!0:o==="folded"||e===T.BLOCK_FOLDED?!1:e===T.BLOCK_LITERAL?!0:!ur(t,a,c.length);if(!t)return h?`|
`:`>
`;let f,m;for(m=t.length;m>0;--m){const N=t[m-1];if(N!==`
`&&N!=="	"&&N!==" ")break}let d=t.substring(m);const b=d.indexOf(`
`);b===-1?f="-":t===d||b!==d.length-1?(f="+",r&&r()):f="",d&&(t=t.slice(0,-d.length),d[d.length-1]===`
`&&(d=d.slice(0,-1)),d=d.replace(Yt,`$&${c}`));let u=!1,p,y=-1;for(p=0;p<t.length;++p){const N=t[p];if(N===" ")u=!0;else if(N===`
`)y=p;else break}let w=t.substring(0,y<p?y+1:p);w&&(t=t.substring(w.length),w=w.replace(/\n+/g,`$&${c}`));let S=(h?"|":">")+(u?c?"2":"1":"")+f;if(n&&(S+=" "+l(n.replace(/ ?[\r\n]+/g," ")),i&&i()),h)return t=t.replace(/\n+/g,`$&${c}`),`${S}
${c}${w}${t}${d}`;t=t.replace(/\n+/g,`
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`);const A=gt(`${w}${t}${d}`,c,Vt,yt(s,!0));return`${S}
${c}${A}`}function hr(n,e,t,s){const{type:i,value:r}=n,{actualString:o,implicitKey:l,indent:a,indentStep:c,inFlow:h}=e;if(l&&r.includes(`
`)||h&&/[[\]{},]/.test(r))return Ae(r,e);if(!r||/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))return l||h||!r.includes(`
`)?Ae(r,e):rt(n,e,t,s);if(!l&&!h&&i!==T.PLAIN&&r.includes(`
`))return rt(n,e,t,s);if(bt(r)){if(a==="")return e.forceBlockIndent=!0,rt(n,e,t,s);if(l&&a===c)return Ae(r,e)}const f=r.replace(/\n+/g,`$&
${a}`);if(o){const m=u=>{var p;return u.default&&u.tag!=="tag:yaml.org,2002:str"&&((p=u.test)==null?void 0:p.test(f))},{compat:d,tags:b}=e.doc.schema;if(b.some(m)||d!=null&&d.some(m))return Ae(r,e)}return l?f:gt(f,a,xn,yt(e,!1))}function We(n,e,t,s){const{implicitKey:i,inFlow:r}=e,o=typeof n.value=="string"?n:Object.assign({},n,{value:String(n.value)});let{type:l}=n;l!==T.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(l=T.QUOTE_DOUBLE);const a=h=>{switch(h){case T.BLOCK_FOLDED:case T.BLOCK_LITERAL:return i||r?Ae(o.value,e):rt(o,e,t,s);case T.QUOTE_DOUBLE:return qe(o.value,e);case T.QUOTE_SINGLE:return Jt(o.value,e);case T.PLAIN:return hr(o,e,t,s);default:return null}};let c=a(l);if(c===null){const{defaultKeyType:h,defaultStringType:f}=e.options,m=i&&h||f;if(c=a(m),c===null)throw new Error(`Unsupported default string type ${m}`)}return c}function Zn(n,e){const t=Object.assign({blockQuote:!0,commentString:fr,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},n.schema.toStringOptions,e);let s;switch(t.collectionStyle){case"block":s=!1;break;case"flow":s=!0;break;default:s=null}return{anchors:new Set,doc:n,flowCollectionPadding:t.flowCollectionPadding?" ":"",indent:"",indentStep:typeof t.indent=="number"?" ".repeat(t.indent):"  ",inFlow:s,options:t}}function dr(n,e){var i;if(e.tag){const r=n.filter(o=>o.tag===e.tag);if(r.length>0)return r.find(o=>o.format===e.format)??r[0]}let t,s;if(C(e)){s=e.value;let r=n.filter(o=>{var l;return(l=o.identify)==null?void 0:l.call(o,s)});if(r.length>1){const o=r.filter(l=>l.test);o.length>0&&(r=o)}t=r.find(o=>o.format===e.format)??r.find(o=>!o.format)}else s=e,t=n.find(r=>r.nodeClass&&s instanceof r.nodeClass);if(!t){const r=((i=s==null?void 0:s.constructor)==null?void 0:i.name)??typeof s;throw new Error(`Tag not resolved for ${r} value`)}return t}function mr(n,e,{anchors:t,doc:s}){if(!s.directives)return"";const i=[],r=(C(n)||B(n))&&n.anchor;r&&Gn(r)&&(t.add(r),i.push(`&${r}`));const o=n.tag?n.tag:e.default?null:e.tag;return o&&i.push(s.directives.tagString(o)),i.join(" ")}function Le(n,e,t,s){var a;if($(n))return n.toString(e,t,s);if(pe(n)){if(e.doc.directives)return n.toString(e);if((a=e.resolvedAliases)!=null&&a.has(n))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(n):e.resolvedAliases=new Set([n]),n=n.resolve(e.doc)}let i;const r=_(n)?n:e.doc.createNode(n,{onTagObj:c=>i=c});i||(i=dr(e.doc.schema.tags,r));const o=mr(r,i,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);const l=typeof i.stringify=="function"?i.stringify(r,e,t,s):C(r)?We(r,e,t,s):r.toString(e,t,s);return o?C(r)||l[0]==="{"||l[0]==="["?`${o} ${l}`:`${o}
${e.indent}${l}`:l}function pr({key:n,value:e},t,s,i){const{allNullValues:r,doc:o,indent:l,indentStep:a,options:{commentString:c,indentSeq:h,simpleKeys:f}}=t;let m=_(n)&&n.comment||null;if(f){if(m)throw new Error("With simple keys, key nodes cannot have comments");if(B(n)||!_(n)&&typeof n=="object"){const v="With simple keys, collection cannot be used as a key value";throw new Error(v)}}let d=!f&&(!n||m&&e==null&&!t.inFlow||B(n)||(C(n)?n.type===T.BLOCK_FOLDED||n.type===T.BLOCK_LITERAL:typeof n=="object"));t=Object.assign({},t,{allNullValues:!1,implicitKey:!d&&(f||!r),indent:l+a});let b=!1,u=!1,p=Le(n,t,()=>b=!0,()=>u=!0);if(!d&&!t.inFlow&&p.length>1024){if(f)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");d=!0}if(t.inFlow){if(r||e==null)return b&&s&&s(),p===""?"?":d?`? ${p}`:p}else if(r&&!f||e==null&&d)return p=`? ${p}`,m&&!b?p+=ue(p,t.indent,c(m)):u&&i&&i(),p;b&&(m=null),d?(m&&(p+=ue(p,t.indent,c(m))),p=`? ${p}
${l}:`):(p=`${p}:`,m&&(p+=ue(p,t.indent,c(m))));let y,w,O;_(e)?(y=!!e.spaceBefore,w=e.commentBefore,O=e.comment):(y=!1,w=null,O=null,e&&typeof e=="object"&&(e=o.createNode(e))),t.implicitKey=!1,!d&&!m&&C(e)&&(t.indentAtStart=p.length+1),u=!1,!h&&a.length>=2&&!t.inFlow&&!d&&_e(e)&&!e.flow&&!e.tag&&!e.anchor&&(t.indent=t.indent.substring(2));let S=!1;const A=Le(e,t,()=>S=!0,()=>u=!0);let N=" ";if(m||y||w){if(N=y?`
`:"",w){const v=c(w);N+=`
${ne(v,t.indent)}`}A===""&&!t.inFlow?N===`
`&&(N=`

`):N+=`
${t.indent}`}else if(!d&&B(e)){const v=A[0],k=A.indexOf(`
`),P=k!==-1,H=t.inFlow??e.flow??e.items.length===0;if(P||!H){let x=!1;if(P&&(v==="&"||v==="!")){let M=A.indexOf(" ");v==="&"&&M!==-1&&M<k&&A[M+1]==="!"&&(M=A.indexOf(" ",M+1)),(M===-1||k<M)&&(x=!0)}x||(N=`
${t.indent}`)}}else(A===""||A[0]===`
`)&&(N="");return p+=N+A,t.inFlow?S&&s&&s():O&&!S?p+=ue(p,t.indent,c(O)):u&&i&&i(),p}function es(n,e){(n==="debug"||n==="warn")&&(typeof process<"u"&&process.emitWarning?process.emitWarning(e):console.warn(e))}const xe="<<",se={identify:n=>n===xe||typeof n=="symbol"&&n.description===xe,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new T(Symbol(xe)),{addToJSMap:ts}),stringify:()=>xe},gr=(n,e)=>(se.identify(e)||C(e)&&(!e.type||e.type===T.PLAIN)&&se.identify(e.value))&&(n==null?void 0:n.doc.schema.tags.some(t=>t.tag===se.tag&&t.default));function ts(n,e,t){if(t=n&&pe(t)?t.resolve(n.doc):t,_e(t))for(const s of t.items)$t(n,e,s);else if(Array.isArray(t))for(const s of t)$t(n,e,s);else $t(n,e,t)}function $t(n,e,t){const s=n&&pe(t)?t.resolve(n.doc):t;if(!Be(s))throw new Error("Merge sources must be maps or map aliases");const i=s.toJSON(null,n,Map);for(const[r,o]of i)e instanceof Map?e.has(r)||e.set(r,o):e instanceof Set?e.add(r):Object.prototype.hasOwnProperty.call(e,r)||Object.defineProperty(e,r,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}function ns(n,e,{key:t,value:s}){if(_(t)&&t.addToJSMap)t.addToJSMap(n,e,s);else if(gr(n,t))ts(n,e,s);else{const i=V(t,"",n);if(e instanceof Map)e.set(i,V(s,i,n));else if(e instanceof Set)e.add(i);else{const r=yr(t,i,n),o=V(s,r,n);r in e?Object.defineProperty(e,r,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[r]=o}}return e}function yr(n,e,t){if(e===null)return"";if(typeof e!="object")return String(e);if(_(n)&&(t!=null&&t.doc)){const s=Zn(t.doc,{});s.anchors=new Set;for(const r of t.anchors.keys())s.anchors.add(r.anchor);s.inFlow=!0,s.inStringifyKey=!0;const i=n.toString(s);if(!t.mapKeyWarned){let r=JSON.stringify(i);r.length>40&&(r=r.substring(0,36)+'..."'),es(t.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${r}. Set mapAsMap: true to use object keys.`),t.mapKeyWarned=!0}return i}return JSON.stringify(e)}function xt(n,e,t){const s=Fe(n,void 0,t),i=Fe(e,void 0,t);return new j(s,i)}class j{constructor(e,t=null){Object.defineProperty(this,J,{value:Un}),this.key=e,this.value=t}clone(e){let{key:t,value:s}=this;return _(t)&&(t=t.clone(e)),_(s)&&(s=s.clone(e)),new j(t,s)}toJSON(e,t){const s=t!=null&&t.mapAsMap?new Map:{};return ns(t,s,this)}toString(e,t,s){return e!=null&&e.doc?pr(this,e,t,s):JSON.stringify(this)}}function ss(n,e,t){return(e.inFlow??n.flow?wr:br)(n,e,t)}function br({comment:n,items:e},t,{blockItemPrefix:s,flowChars:i,itemIndent:r,onChompKeep:o,onComment:l}){const{indent:a,options:{commentString:c}}=t,h=Object.assign({},t,{indent:r,type:null});let f=!1;const m=[];for(let b=0;b<e.length;++b){const u=e[b];let p=null;if(_(u))!f&&u.spaceBefore&&m.push(""),ft(t,m,u.commentBefore,f),u.comment&&(p=u.comment);else if($(u)){const w=_(u.key)?u.key:null;w&&(!f&&w.spaceBefore&&m.push(""),ft(t,m,w.commentBefore,f))}f=!1;let y=Le(u,h,()=>p=null,()=>f=!0);p&&(y+=ue(y,r,c(p))),f&&p&&(f=!1),m.push(s+y)}let d;if(m.length===0)d=i.start+i.end;else{d=m[0];for(let b=1;b<m.length;++b){const u=m[b];d+=u?`
${a}${u}`:`
`}}return n?(d+=`
`+ne(c(n),a),l&&l()):f&&o&&o(),d}function wr({items:n},e,{flowChars:t,itemIndent:s}){const{indent:i,indentStep:r,flowCollectionPadding:o,options:{commentString:l}}=e;s+=r;const a=Object.assign({},e,{indent:s,inFlow:!0,type:null});let c=!1,h=0;const f=[];for(let b=0;b<n.length;++b){const u=n[b];let p=null;if(_(u))u.spaceBefore&&f.push(""),ft(e,f,u.commentBefore,!1),u.comment&&(p=u.comment);else if($(u)){const w=_(u.key)?u.key:null;w&&(w.spaceBefore&&f.push(""),ft(e,f,w.commentBefore,!1),w.comment&&(c=!0));const O=_(u.value)?u.value:null;O?(O.comment&&(p=O.comment),O.commentBefore&&(c=!0)):u.value==null&&(w!=null&&w.comment)&&(p=w.comment)}p&&(c=!0);let y=Le(u,a,()=>p=null);b<n.length-1&&(y+=","),p&&(y+=ue(y,s,l(p))),!c&&(f.length>h||y.includes(`
`))&&(c=!0),f.push(y),h=f.length}const{start:m,end:d}=t;if(f.length===0)return m+d;if(!c){const b=f.reduce((u,p)=>u+p.length+2,2);c=e.options.lineWidth>0&&b>e.options.lineWidth}if(c){let b=m;for(const u of f)b+=u?`
${r}${i}${u}`:`
`;return`${b}
${i}${d}`}else return`${m}${o}${f.join(" ")}${o}${d}`}function ft({indent:n,options:{commentString:e}},t,s,i){if(s&&i&&(s=s.replace(/^\n+/,"")),s){const r=ne(e(s),n);t.push(r.trimStart())}}function he(n,e){const t=C(e)?e.value:e;for(const s of n)if($(s)&&(s.key===e||s.key===t||C(s.key)&&s.key.value===t))return s}class F extends Xn{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(re,e),this.items=[]}static from(e,t,s){const{keepUndefined:i,replacer:r}=s,o=new this(e),l=(a,c)=>{if(typeof r=="function")c=r.call(t,a,c);else if(Array.isArray(r)&&!r.includes(a))return;(c!==void 0||i)&&o.items.push(xt(a,c,s))};if(t instanceof Map)for(const[a,c]of t)l(a,c);else if(t&&typeof t=="object")for(const a of Object.keys(t))l(a,t[a]);return typeof e.sortMapEntries=="function"&&o.items.sort(e.sortMapEntries),o}add(e,t){var o;let s;$(e)?s=e:!e||typeof e!="object"||!("key"in e)?s=new j(e,e==null?void 0:e.value):s=new j(e.key,e.value);const i=he(this.items,s.key),r=(o=this.schema)==null?void 0:o.sortMapEntries;if(i){if(!t)throw new Error(`Key ${s.key} already set`);C(i.value)&&zn(s.value)?i.value.value=s.value:i.value=s.value}else if(r){const l=this.items.findIndex(a=>r(s,a)<0);l===-1?this.items.push(s):this.items.splice(l,0,s)}else this.items.push(s)}delete(e){const t=he(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){const s=he(this.items,e),i=s==null?void 0:s.value;return(!t&&C(i)?i.value:i)??void 0}has(e){return!!he(this.items,e)}set(e,t){this.add(new j(e,t),!0)}toJSON(e,t,s){const i=s?new s:t!=null&&t.mapAsMap?new Map:{};t!=null&&t.onCreate&&t.onCreate(i);for(const r of this.items)ns(t,i,r);return i}toString(e,t,s){if(!e)return JSON.stringify(this);for(const i of this.items)if(!$(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),ss(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:s,onComment:t})}}const Pe={collection:"map",default:!0,nodeClass:F,tag:"tag:yaml.org,2002:map",resolve(n,e){return Be(n)||e("Expected a mapping for this tag"),n},createNode:(n,e,t)=>F.from(n,e,t)};class le extends Xn{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super($e,e),this.items=[]}add(e){this.items.push(e)}delete(e){const t=Ze(e);return typeof t!="number"?!1:this.items.splice(t,1).length>0}get(e,t){const s=Ze(e);if(typeof s!="number")return;const i=this.items[s];return!t&&C(i)?i.value:i}has(e){const t=Ze(e);return typeof t=="number"&&t<this.items.length}set(e,t){const s=Ze(e);if(typeof s!="number")throw new Error(`Expected a valid index, not ${e}.`);const i=this.items[s];C(i)&&zn(t)?i.value=t:this.items[s]=t}toJSON(e,t){const s=[];t!=null&&t.onCreate&&t.onCreate(s);let i=0;for(const r of this.items)s.push(V(r,String(i++),t));return s}toString(e,t,s){return e?ss(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+"  ",onChompKeep:s,onComment:t}):JSON.stringify(this)}static from(e,t,s){const{replacer:i}=s,r=new this(e);if(t&&Symbol.iterator in Object(t)){let o=0;for(let l of t){if(typeof i=="function"){const a=t instanceof Set?l:String(o++);l=i.call(t,a,l)}r.items.push(Fe(l,void 0,s))}}return r}}function Ze(n){let e=C(n)?n.value:n;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}const Me={collection:"seq",default:!0,nodeClass:le,tag:"tag:yaml.org,2002:seq",resolve(n,e){return _e(n)||e("Expected a sequence for this tag"),n},createNode:(n,e,t)=>le.from(n,e,t)},wt={identify:n=>typeof n=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:n=>n,stringify(n,e,t,s){return e=Object.assign({actualString:!0},e),We(n,e,t,s)}},St={identify:n=>n==null,createNode:()=>new T(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new T(null),stringify:({source:n},e)=>typeof n=="string"&&St.test.test(n)?n:e.options.nullStr},Zt={identify:n=>typeof n=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:n=>new T(n[0]==="t"||n[0]==="T"),stringify({source:n,value:e},t){if(n&&Zt.test.test(n)){const s=n[0]==="t"||n[0]==="T";if(e===s)return n}return e?t.options.trueStr:t.options.falseStr}};function G({format:n,minFractionDigits:e,tag:t,value:s}){if(typeof s=="bigint")return String(s);const i=typeof s=="number"?s:Number(s);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let r=JSON.stringify(s);if(!n&&e&&(!t||t==="tag:yaml.org,2002:float")&&/^\d/.test(r)){let o=r.indexOf(".");o<0&&(o=r.length,r+=".");let l=e-(r.length-o-1);for(;l-- >0;)r+="0"}return r}const is={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:n=>n.slice(-3).toLowerCase()==="nan"?NaN:n[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:G},rs={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:n=>parseFloat(n),stringify(n){const e=Number(n.value);return isFinite(e)?e.toExponential():G(n)}},os={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(n){const e=new T(parseFloat(n)),t=n.indexOf(".");return t!==-1&&n[n.length-1]==="0"&&(e.minFractionDigits=n.length-t-1),e},stringify:G},kt=n=>typeof n=="bigint"||Number.isInteger(n),en=(n,e,t,{intAsBigInt:s})=>s?BigInt(n):parseInt(n.substring(e),t);function ls(n,e,t){const{value:s}=n;return kt(s)&&s>=0?t+s.toString(e):G(n)}const as={identify:n=>kt(n)&&n>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(n,e,t)=>en(n,2,8,t),stringify:n=>ls(n,8,"0o")},cs={identify:kt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(n,e,t)=>en(n,0,10,t),stringify:G},fs={identify:n=>kt(n)&&n>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(n,e,t)=>en(n,2,16,t),stringify:n=>ls(n,16,"0x")},Sr=[Pe,Me,wt,St,Zt,as,cs,fs,is,rs,os];function On(n){return typeof n=="bigint"||Number.isInteger(n)}const et=({value:n})=>JSON.stringify(n),kr=[{identify:n=>typeof n=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:n=>n,stringify:et},{identify:n=>n==null,createNode:()=>new T(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:et},{identify:n=>typeof n=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true|false$/,resolve:n=>n==="true",stringify:et},{identify:On,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(n,e,{intAsBigInt:t})=>t?BigInt(n):parseInt(n,10),stringify:({value:n})=>On(n)?n.toString():JSON.stringify(n)},{identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:n=>parseFloat(n),stringify:et}],Nr={default:!0,tag:"",test:/^/,resolve(n,e){return e(`Unresolved plain scalar ${JSON.stringify(n)}`),n}},Or=[Pe,Me].concat(kr,Nr),tn={identify:n=>n instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(n,e){if(typeof Buffer=="function")return Buffer.from(n,"base64");if(typeof atob=="function"){const t=atob(n.replace(/[\n\r]/g,"")),s=new Uint8Array(t.length);for(let i=0;i<t.length;++i)s[i]=t.charCodeAt(i);return s}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),n},stringify({comment:n,type:e,value:t},s,i,r){const o=t;let l;if(typeof Buffer=="function")l=o instanceof Buffer?o.toString("base64"):Buffer.from(o.buffer).toString("base64");else if(typeof btoa=="function"){let a="";for(let c=0;c<o.length;++c)a+=String.fromCharCode(o[c]);l=btoa(a)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e||(e=T.BLOCK_LITERAL),e!==T.QUOTE_DOUBLE){const a=Math.max(s.options.lineWidth-s.indent.length,s.options.minContentWidth),c=Math.ceil(l.length/a),h=new Array(c);for(let f=0,m=0;f<c;++f,m+=a)h[f]=l.substr(m,a);l=h.join(e===T.BLOCK_LITERAL?`
`:" ")}return We({comment:n,type:e,value:l},s,i,r)}};function us(n,e){if(_e(n))for(let t=0;t<n.items.length;++t){let s=n.items[t];if(!$(s)){if(Be(s)){s.items.length>1&&e("Each pair must have its own sequence indicator");const i=s.items[0]||new j(new T(null));if(s.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${s.commentBefore}
${i.key.commentBefore}`:s.commentBefore),s.comment){const r=i.value??i.key;r.comment=r.comment?`${s.comment}
${r.comment}`:s.comment}s=i}n.items[t]=$(s)?s:new j(s)}}else e("Expected a sequence for this tag");return n}function hs(n,e,t){const{replacer:s}=t,i=new le(n);i.tag="tag:yaml.org,2002:pairs";let r=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof s=="function"&&(o=s.call(e,String(r++),o));let l,a;if(Array.isArray(o))if(o.length===2)l=o[0],a=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){const c=Object.keys(o);if(c.length===1)l=c[0],a=o[l];else throw new TypeError(`Expected tuple with one key, not ${c.length} keys`)}else l=o;i.items.push(xt(l,a,t))}return i}const nn={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:us,createNode:hs};class Ie extends le{constructor(){super(),this.add=F.prototype.add.bind(this),this.delete=F.prototype.delete.bind(this),this.get=F.prototype.get.bind(this),this.has=F.prototype.has.bind(this),this.set=F.prototype.set.bind(this),this.tag=Ie.tag}toJSON(e,t){if(!t)return super.toJSON(e);const s=new Map;t!=null&&t.onCreate&&t.onCreate(s);for(const i of this.items){let r,o;if($(i)?(r=V(i.key,"",t),o=V(i.value,r,t)):r=V(i,"",t),s.has(r))throw new Error("Ordered maps must not include duplicate keys");s.set(r,o)}return s}static from(e,t,s){const i=hs(e,t,s),r=new this;return r.items=i.items,r}}Ie.tag="tag:yaml.org,2002:omap";const sn={collection:"seq",identify:n=>n instanceof Map,nodeClass:Ie,default:!1,tag:"tag:yaml.org,2002:omap",resolve(n,e){const t=us(n,e),s=[];for(const{key:i}of t.items)C(i)&&(s.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):s.push(i.value));return Object.assign(new Ie,t)},createNode:(n,e,t)=>Ie.from(n,e,t)};function ds({value:n,source:e},t){return e&&(n?ms:ps).test.test(e)?e:n?t.options.trueStr:t.options.falseStr}const ms={identify:n=>n===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new T(!0),stringify:ds},ps={identify:n=>n===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new T(!1),stringify:ds},Ar={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:n=>n.slice(-3).toLowerCase()==="nan"?NaN:n[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:G},Tr={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:n=>parseFloat(n.replace(/_/g,"")),stringify(n){const e=Number(n.value);return isFinite(e)?e.toExponential():G(n)}},Ir={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(n){const e=new T(parseFloat(n.replace(/_/g,""))),t=n.indexOf(".");if(t!==-1){const s=n.substring(t+1).replace(/_/g,"");s[s.length-1]==="0"&&(e.minFractionDigits=s.length)}return e},stringify:G},Ge=n=>typeof n=="bigint"||Number.isInteger(n);function Nt(n,e,t,{intAsBigInt:s}){const i=n[0];if((i==="-"||i==="+")&&(e+=1),n=n.substring(e).replace(/_/g,""),s){switch(t){case 2:n=`0b${n}`;break;case 8:n=`0o${n}`;break;case 16:n=`0x${n}`;break}const o=BigInt(n);return i==="-"?BigInt(-1)*o:o}const r=parseInt(n,t);return i==="-"?-1*r:r}function rn(n,e,t){const{value:s}=n;if(Ge(s)){const i=s.toString(e);return s<0?"-"+t+i.substr(1):t+i}return G(n)}const Er={identify:Ge,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(n,e,t)=>Nt(n,2,2,t),stringify:n=>rn(n,2,"0b")},Lr={identify:Ge,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(n,e,t)=>Nt(n,1,8,t),stringify:n=>rn(n,8,"0")},Cr={identify:Ge,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(n,e,t)=>Nt(n,0,10,t),stringify:G},vr={identify:Ge,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(n,e,t)=>Nt(n,2,16,t),stringify:n=>rn(n,16,"0x")};class Ee extends F{constructor(e){super(e),this.tag=Ee.tag}add(e){let t;$(e)?t=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?t=new j(e.key,null):t=new j(e,null),he(this.items,t.key)||this.items.push(t)}get(e,t){const s=he(this.items,e);return!t&&$(s)?C(s.key)?s.key.value:s.key:s}set(e,t){if(typeof t!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);const s=he(this.items,e);s&&!t?this.items.splice(this.items.indexOf(s),1):!s&&t&&this.items.push(new j(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,s){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,s);throw new Error("Set items must all have null values")}static from(e,t,s){const{replacer:i}=s,r=new this(e);if(t&&Symbol.iterator in Object(t))for(let o of t)typeof i=="function"&&(o=i.call(t,o,o)),r.items.push(xt(o,null,s));return r}}Ee.tag="tag:yaml.org,2002:set";const on={collection:"map",identify:n=>n instanceof Set,nodeClass:Ee,default:!1,tag:"tag:yaml.org,2002:set",createNode:(n,e,t)=>Ee.from(n,e,t),resolve(n,e){if(Be(n)){if(n.hasAllNullValues(!0))return Object.assign(new Ee,n);e("Set items must all have null values")}else e("Expected a mapping for this tag");return n}};function ln(n,e){const t=n[0],s=t==="-"||t==="+"?n.substring(1):n,i=o=>e?BigInt(o):Number(o),r=s.replace(/_/g,"").split(":").reduce((o,l)=>o*i(60)+i(l),i(0));return t==="-"?i(-1)*r:r}function gs(n){let{value:e}=n,t=o=>o;if(typeof e=="bigint")t=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return G(n);let s="";e<0&&(s="-",e*=t(-1));const i=t(60),r=[e%i];return e<60?r.unshift(0):(e=(e-r[0])/i,r.unshift(e%i),e>=60&&(e=(e-r[0])/i,r.unshift(e))),s+r.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}const ys={identify:n=>typeof n=="bigint"||Number.isInteger(n),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(n,e,{intAsBigInt:t})=>ln(n,t),stringify:gs},bs={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:n=>ln(n,!1),stringify:gs},Ot={identify:n=>n 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(n){const e=n.match(Ot.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");const[,t,s,i,r,o,l]=e.map(Number),a=e[7]?Number((e[7]+"00").substr(1,3)):0;let c=Date.UTC(t,s-1,i,r||0,o||0,l||0,a);const h=e[8];if(h&&h!=="Z"){let f=ln(h,!1);Math.abs(f)<30&&(f*=60),c-=6e4*f}return new Date(c)},stringify:({value:n})=>n.toISOString().replace(/((T00:00)?:00)?\.000Z$/,"")},An=[Pe,Me,wt,St,ms,ps,Er,Lr,Cr,vr,Ar,Tr,Ir,tn,se,sn,nn,on,ys,bs,Ot],Tn=new Map([["core",Sr],["failsafe",[Pe,Me,wt]],["json",Or],["yaml11",An],["yaml-1.1",An]]),In={binary:tn,bool:Zt,float:os,floatExp:rs,floatNaN:is,floatTime:bs,int:cs,intHex:fs,intOct:as,intTime:ys,map:Pe,merge:se,null:St,omap:sn,pairs:nn,seq:Me,set:on,timestamp:Ot},$r={"tag:yaml.org,2002:binary":tn,"tag:yaml.org,2002:merge":se,"tag:yaml.org,2002:omap":sn,"tag:yaml.org,2002:pairs":nn,"tag:yaml.org,2002:set":on,"tag:yaml.org,2002:timestamp":Ot};function Bt(n,e,t){const s=Tn.get(e);if(s&&!n)return t&&!s.includes(se)?s.concat(se):s.slice();let i=s;if(!i)if(Array.isArray(n))i=[];else{const r=Array.from(Tn.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${r} or define customTags array`)}if(Array.isArray(n))for(const r of n)i=i.concat(r);else typeof n=="function"&&(i=n(i.slice()));return t&&(i=i.concat(se)),i.reduce((r,o)=>{const l=typeof o=="string"?In[o]:o;if(!l){const a=JSON.stringify(o),c=Object.keys(In).map(h=>JSON.stringify(h)).join(", ");throw new Error(`Unknown custom tag ${a}; use one of ${c}`)}return r.includes(l)||r.push(l),r},[])}const Br=(n,e)=>n.key<e.key?-1:n.key>e.key?1:0;class At{constructor({compat:e,customTags:t,merge:s,resolveKnownTags:i,schema:r,sortMapEntries:o,toStringDefaults:l}){this.compat=Array.isArray(e)?Bt(e,"compat"):e?Bt(null,e):null,this.name=typeof r=="string"&&r||"core",this.knownTags=i?$r:{},this.tags=Bt(t,this.name,s),this.toStringOptions=l??null,Object.defineProperty(this,re,{value:Pe}),Object.defineProperty(this,X,{value:wt}),Object.defineProperty(this,$e,{value:Me}),this.sortMapEntries=typeof o=="function"?o:o===!0?Br:null}clone(){const e=Object.create(At.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}}function _r(n,e){var a;const t=[];let s=e.directives===!0;if(e.directives!==!1&&n.directives){const c=n.directives.toString(n);c?(t.push(c),s=!0):n.directives.docStart&&(s=!0)}s&&t.push("---");const i=Zn(n,e),{commentString:r}=i.options;if(n.commentBefore){t.length!==1&&t.unshift("");const c=r(n.commentBefore);t.unshift(ne(c,""))}let o=!1,l=null;if(n.contents){if(_(n.contents)){if(n.contents.spaceBefore&&s&&t.push(""),n.contents.commentBefore){const f=r(n.contents.commentBefore);t.push(ne(f,""))}i.forceBlockIndent=!!n.comment,l=n.contents.comment}const c=l?void 0:()=>o=!0;let h=Le(n.contents,i,()=>l=null,c);l&&(h+=ue(h,"",r(l))),(h[0]==="|"||h[0]===">")&&t[t.length-1]==="---"?t[t.length-1]=`--- ${h}`:t.push(h)}else t.push(Le(n.contents,i));if((a=n.directives)!=null&&a.docEnd)if(n.comment){const c=r(n.comment);c.includes(`
`)?(t.push("..."),t.push(ne(c,""))):t.push(`... ${c}`)}else t.push("...");else{let c=n.comment;c&&o&&(c=c.replace(/^\n+/,"")),c&&((!o||l)&&t[t.length-1]!==""&&t.push(""),t.push(ne(r(c),"")))}return t.join(`
`)+`
`}class Ke{constructor(e,t,s){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,J,{value:Ut});let i=null;typeof t=="function"||Array.isArray(t)?i=t:s===void 0&&t&&(s=t,t=void 0);const r=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},s);this.options=r;let{version:o}=r;s!=null&&s._directives?(this.directives=s._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new R({version:o}),this.setSchema(o,s),this.contents=e===void 0?null:this.createNode(e,i,s)}clone(){const e=Object.create(Ke.prototype,{[J]:{value:Ut}});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=_(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){we(this.contents)&&this.contents.add(e)}addIn(e,t){we(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){const s=Hn(this);e.anchor=!t||s.has(t)?Qn(t||"a",s):t}return new pt(e.anchor)}createNode(e,t,s){let i;if(typeof t=="function")e=t.call({"":e},"",e),i=t;else if(Array.isArray(t)){const p=w=>typeof w=="number"||w instanceof String||w instanceof Number,y=t.filter(p).map(String);y.length>0&&(t=t.concat(y)),i=t}else s===void 0&&t&&(s=t,t=void 0);const{aliasDuplicateObjects:r,anchorPrefix:o,flow:l,keepUndefined:a,onTagObj:c,tag:h}=s??{},{onAnchor:f,setAnchors:m,sourceObjects:d}=lr(this,o||"a"),b={aliasDuplicateObjects:r??!0,keepUndefined:a??!1,onAnchor:f,onTagObj:c,replacer:i,schema:this.schema,sourceObjects:d},u=Fe(e,h,b);return l&&B(u)&&(u.flow=!0),m(),u}createPair(e,t,s={}){const i=this.createNode(e,null,s),r=this.createNode(t,null,s);return new j(i,r)}delete(e){return we(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Re(e)?this.contents==null?!1:(this.contents=null,!0):we(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return B(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return Re(e)?!t&&C(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):!1}hasIn(e){return Re(e)?this.contents!==void 0:B(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=ct(this.schema,[e],t):we(this.contents)&&this.contents.set(e,t)}setIn(e,t){Re(e)?this.contents=t:this.contents==null?this.contents=ct(this.schema,Array.from(e),t):we(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e=="number"&&(e=String(e));let s;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new R({version:"1.1"}),s={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new R({version:e}),s={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,s=null;break;default:{const i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(s)this.schema=new At(Object.assign(s,t));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:t,mapAsMap:s,maxAliasCount:i,onAnchor:r,reviver:o}={}){const l={anchors:new Map,doc:this,keep:!e,mapAsMap:s===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},a=V(this.contents,t??"",l);if(typeof r=="function")for(const{count:c,res:h}of l.anchors.values())r(h,c);return typeof o=="function"?Oe(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 _r(this,e)}}function we(n){if(B(n))return!0;throw new Error("Expected a YAML collection as document contents")}class an extends Error{constructor(e,t,s,i){super(),this.name=e,this.code=s,this.message=i,this.pos=t}}class de extends an{constructor(e,t,s){super("YAMLParseError",e,t,s)}}class ws extends an{constructor(e,t,s){super("YAMLWarning",e,t,s)}}const ut=(n,e)=>t=>{if(t.pos[0]===-1)return;t.linePos=t.pos.map(l=>e.linePos(l));const{line:s,col:i}=t.linePos[0];t.message+=` at line ${s}, column ${i}`;let r=i-1,o=n.substring(e.lineStarts[s-1],e.lineStarts[s]).replace(/[\n\r]+$/,"");if(r>=60&&o.length>80){const l=Math.min(r-39,o.length-79);o="…"+o.substring(l),r-=l-1}if(o.length>80&&(o=o.substring(0,79)+"…"),s>1&&/^ *$/.test(o.substring(0,r))){let l=n.substring(e.lineStarts[s-2],e.lineStarts[s-1]);l.length>80&&(l=l.substring(0,79)+`…
`),o=l+o}if(/[^ ]/.test(o)){let l=1;const a=t.linePos[1];a&&a.line===s&&a.col>i&&(l=Math.max(1,Math.min(a.col-i,80-r)));const c=" ".repeat(r)+"^".repeat(l);t.message+=`:

${o}
${c}
`}};function Ce(n,{flow:e,indicator:t,next:s,offset:i,onError:r,parentIndent:o,startOnNewline:l}){let a=!1,c=l,h=l,f="",m="",d=!1,b=!1,u=null,p=null,y=null,w=null,O=null,S=null,A=null;for(const k of n)switch(b&&(k.type!=="space"&&k.type!=="newline"&&k.type!=="comma"&&r(k.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),b=!1),u&&(c&&k.type!=="comment"&&k.type!=="newline"&&r(u,"TAB_AS_INDENT","Tabs are not allowed as indentation"),u=null),k.type){case"space":!e&&(t!=="doc-start"||(s==null?void 0:s.type)!=="flow-collection")&&k.source.includes("	")&&(u=k),h=!0;break;case"comment":{h||r(k,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const P=k.source.substring(1)||" ";f?f+=m+P:f=P,m="",c=!1;break}case"newline":c?f?f+=k.source:a=!0:m+=k.source,c=!0,d=!0,(p||y)&&(w=k),h=!0;break;case"anchor":p&&r(k,"MULTIPLE_ANCHORS","A node can have at most one anchor"),k.source.endsWith(":")&&r(k.offset+k.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),p=k,A===null&&(A=k.offset),c=!1,h=!1,b=!0;break;case"tag":{y&&r(k,"MULTIPLE_TAGS","A node can have at most one tag"),y=k,A===null&&(A=k.offset),c=!1,h=!1,b=!0;break}case t:(p||y)&&r(k,"BAD_PROP_ORDER",`Anchors and tags must be after the ${k.source} indicator`),S&&r(k,"UNEXPECTED_TOKEN",`Unexpected ${k.source} in ${e??"collection"}`),S=k,c=t==="seq-item-ind"||t==="explicit-key-ind",h=!1;break;case"comma":if(e){O&&r(k,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),O=k,c=!1,h=!1;break}default:r(k,"UNEXPECTED_TOKEN",`Unexpected ${k.type} token`),c=!1,h=!1}const N=n[n.length-1],v=N?N.offset+N.source.length:i;return b&&s&&s.type!=="space"&&s.type!=="newline"&&s.type!=="comma"&&(s.type!=="scalar"||s.source!=="")&&r(s.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),u&&(c&&u.indent<=o||(s==null?void 0:s.type)==="block-map"||(s==null?void 0:s.type)==="block-seq")&&r(u,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:O,found:S,spaceBefore:a,comment:f,hasNewline:d,anchor:p,tag:y,newlineAfterProp:w,end:v,start:A??v}}function Ue(n){if(!n)return null;switch(n.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(n.source.includes(`
`))return!0;if(n.end){for(const e of n.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(const e of n.items){for(const t of e.start)if(t.type==="newline")return!0;if(e.sep){for(const t of e.sep)if(t.type==="newline")return!0}if(Ue(e.key)||Ue(e.value))return!0}return!1;default:return!0}}function Wt(n,e,t){if((e==null?void 0:e.type)==="flow-collection"){const s=e.end[0];s.indent===n&&(s.source==="]"||s.source==="}")&&Ue(e)&&t(s,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function Ss(n,e,t){const{uniqueKeys:s}=n.options;if(s===!1)return!1;const i=typeof s=="function"?s:(r,o)=>r===o||C(r)&&C(o)&&r.value===o.value;return e.some(r=>i(r.key,t))}const En="All mapping items must start at the same column";function Pr({composeNode:n,composeEmptyNode:e},t,s,i,r){var h;const o=(r==null?void 0:r.nodeClass)??F,l=new o(t.schema);t.atRoot&&(t.atRoot=!1);let a=s.offset,c=null;for(const f of s.items){const{start:m,key:d,sep:b,value:u}=f,p=Ce(m,{indicator:"explicit-key-ind",next:d??(b==null?void 0:b[0]),offset:a,onError:i,parentIndent:s.indent,startOnNewline:!0}),y=!p.found;if(y){if(d&&(d.type==="block-seq"?i(a,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in d&&d.indent!==s.indent&&i(a,"BAD_INDENT",En)),!p.anchor&&!p.tag&&!b){c=p.end,p.comment&&(l.comment?l.comment+=`
`+p.comment:l.comment=p.comment);continue}(p.newlineAfterProp||Ue(d))&&i(d??m[m.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else((h=p.found)==null?void 0:h.indent)!==s.indent&&i(a,"BAD_INDENT",En);t.atKey=!0;const w=p.end,O=d?n(t,d,p,i):e(t,w,m,null,p,i);t.schema.compat&&Wt(s.indent,d,i),t.atKey=!1,Ss(t,l.items,O)&&i(w,"DUPLICATE_KEY","Map keys must be unique");const S=Ce(b??[],{indicator:"map-value-ind",next:u,offset:O.range[2],onError:i,parentIndent:s.indent,startOnNewline:!d||d.type==="block-scalar"});if(a=S.end,S.found){y&&((u==null?void 0:u.type)==="block-map"&&!S.hasNewline&&i(a,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),t.options.strict&&p.start<S.found.offset-1024&&i(O.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));const A=u?n(t,u,S,i):e(t,a,b,null,S,i);t.schema.compat&&Wt(s.indent,u,i),a=A.range[2];const N=new j(O,A);t.options.keepSourceTokens&&(N.srcToken=f),l.items.push(N)}else{y&&i(O.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),S.comment&&(O.comment?O.comment+=`
`+S.comment:O.comment=S.comment);const A=new j(O);t.options.keepSourceTokens&&(A.srcToken=f),l.items.push(A)}}return c&&c<a&&i(c,"IMPOSSIBLE","Map comment with trailing content"),l.range=[s.offset,a,c??a],l}function Mr({composeNode:n,composeEmptyNode:e},t,s,i,r){const o=(r==null?void 0:r.nodeClass)??le,l=new o(t.schema);t.atRoot&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let a=s.offset,c=null;for(const{start:h,value:f}of s.items){const m=Ce(h,{indicator:"seq-item-ind",next:f,offset:a,onError:i,parentIndent:s.indent,startOnNewline:!0});if(!m.found)if(m.anchor||m.tag||f)f&&f.type==="block-seq"?i(m.end,"BAD_INDENT","All sequence items must start at the same column"):i(a,"MISSING_CHAR","Sequence item without - indicator");else{c=m.end,m.comment&&(l.comment=m.comment);continue}const d=f?n(t,f,m,i):e(t,m.end,h,null,m,i);t.schema.compat&&Wt(s.indent,f,i),a=d.range[2],l.items.push(d)}return l.range=[s.offset,a,c??a],l}function He(n,e,t,s){let i="";if(n){let r=!1,o="";for(const l of n){const{source:a,type:c}=l;switch(c){case"space":r=!0;break;case"comment":{t&&!r&&s(l,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const h=a.substring(1)||" ";i?i+=o+h:i=h,o="";break}case"newline":i&&(o+=a),r=!0;break;default:s(l,"UNEXPECTED_TOKEN",`Unexpected ${c} at node end`)}e+=a.length}}return{comment:i,offset:e}}const _t="Block collections are not allowed within flow collections",Pt=n=>n&&(n.type==="block-map"||n.type==="block-seq");function Kr({composeNode:n,composeEmptyNode:e},t,s,i,r){const o=s.start.source==="{",l=o?"flow map":"flow sequence",a=(r==null?void 0:r.nodeClass)??(o?F:le),c=new a(t.schema);c.flow=!0;const h=t.atRoot;h&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let f=s.offset+s.start.source.length;for(let p=0;p<s.items.length;++p){const y=s.items[p],{start:w,key:O,sep:S,value:A}=y,N=Ce(w,{flow:l,indicator:"explicit-key-ind",next:O??(S==null?void 0:S[0]),offset:f,onError:i,parentIndent:s.indent,startOnNewline:!1});if(!N.found){if(!N.anchor&&!N.tag&&!S&&!A){p===0&&N.comma?i(N.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${l}`):p<s.items.length-1&&i(N.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${l}`),N.comment&&(c.comment?c.comment+=`
`+N.comment:c.comment=N.comment),f=N.end;continue}!o&&t.options.strict&&Ue(O)&&i(O,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(p===0)N.comma&&i(N.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${l}`);else if(N.comma||i(N.start,"MISSING_CHAR",`Missing , between ${l} items`),N.comment){let v="";e:for(const k of w)switch(k.type){case"comma":case"space":break;case"comment":v=k.source.substring(1);break e;default:break e}if(v){let k=c.items[c.items.length-1];$(k)&&(k=k.value??k.key),k.comment?k.comment+=`
`+v:k.comment=v,N.comment=N.comment.substring(v.length+1)}}if(!o&&!S&&!N.found){const v=A?n(t,A,N,i):e(t,N.end,S,null,N,i);c.items.push(v),f=v.range[2],Pt(A)&&i(v.range,"BLOCK_IN_FLOW",_t)}else{t.atKey=!0;const v=N.end,k=O?n(t,O,N,i):e(t,v,w,null,N,i);Pt(O)&&i(k.range,"BLOCK_IN_FLOW",_t),t.atKey=!1;const P=Ce(S??[],{flow:l,indicator:"map-value-ind",next:A,offset:k.range[2],onError:i,parentIndent:s.indent,startOnNewline:!1});if(P.found){if(!o&&!N.found&&t.options.strict){if(S)for(const M of S){if(M===P.found)break;if(M.type==="newline"){i(M,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}N.start<P.found.offset-1024&&i(P.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else A&&("source"in A&&A.source&&A.source[0]===":"?i(A,"MISSING_CHAR",`Missing space after : in ${l}`):i(P.start,"MISSING_CHAR",`Missing , or : between ${l} items`));const H=A?n(t,A,P,i):P.found?e(t,P.end,S,null,P,i):null;H?Pt(A)&&i(H.range,"BLOCK_IN_FLOW",_t):P.comment&&(k.comment?k.comment+=`
`+P.comment:k.comment=P.comment);const x=new j(k,H);if(t.options.keepSourceTokens&&(x.srcToken=y),o){const M=c;Ss(t,M.items,k)&&i(v,"DUPLICATE_KEY","Map keys must be unique"),M.items.push(x)}else{const M=new F(t.schema);M.flow=!0,M.items.push(x);const Qe=(H??k).range;M.range=[k.range[0],Qe[1],Qe[2]],c.items.push(M)}f=H?H.range[2]:P.end}}const m=o?"}":"]",[d,...b]=s.end;let u=f;if(d&&d.source===m)u=d.offset+d.source.length;else{const p=l[0].toUpperCase()+l.substring(1),y=h?`${p} must end with a ${m}`:`${p} in block collection must be sufficiently indented and end with a ${m}`;i(f,h?"MISSING_CHAR":"BAD_INDENT",y),d&&d.source.length!==1&&b.unshift(d)}if(b.length>0){const p=He(b,u,t.options.strict,i);p.comment&&(c.comment?c.comment+=`
`+p.comment:c.comment=p.comment),c.range=[s.offset,u,p.offset]}else c.range=[s.offset,u,u];return c}function Mt(n,e,t,s,i,r){const o=t.type==="block-map"?Pr(n,e,t,s,r):t.type==="block-seq"?Mr(n,e,t,s,r):Kr(n,e,t,s,r),l=o.constructor;return i==="!"||i===l.tagName?(o.tag=l.tagName,o):(i&&(o.tag=i),o)}function Dr(n,e,t,s,i){var m;const r=s.tag,o=r?e.directives.tagName(r.source,d=>i(r,"TAG_RESOLVE_FAILED",d)):null;if(t.type==="block-seq"){const{anchor:d,newlineAfterProp:b}=s,u=d&&r?d.offset>r.offset?d:r:d??r;u&&(!b||b.offset<u.offset)&&i(u,"MISSING_CHAR","Missing newline after block sequence props")}const l=t.type==="block-map"?"map":t.type==="block-seq"?"seq":t.start.source==="{"?"map":"seq";if(!r||!o||o==="!"||o===F.tagName&&l==="map"||o===le.tagName&&l==="seq")return Mt(n,e,t,i,o);let a=e.schema.tags.find(d=>d.tag===o&&d.collection===l);if(!a){const d=e.schema.knownTags[o];if(d&&d.collection===l)e.schema.tags.push(Object.assign({},d,{default:!1})),a=d;else return d!=null&&d.collection?i(r,"BAD_COLLECTION_TYPE",`${d.tag} used for ${l} collection, but expects ${d.collection}`,!0):i(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),Mt(n,e,t,i,o)}const c=Mt(n,e,t,i,o,a),h=((m=a.resolve)==null?void 0:m.call(a,c,d=>i(r,"TAG_RESOLVE_FAILED",d),e.options))??c,f=_(h)?h:new T(h);return f.range=c.range,f.tag=o,a!=null&&a.format&&(f.format=a.format),f}function ks(n,e,t){const s=e.offset,i=jr(e,n.options.strict,t);if(!i)return{value:"",type:null,comment:"",range:[s,s,s]};const r=i.mode===">"?T.BLOCK_FOLDED:T.BLOCK_LITERAL,o=e.source?Rr(e.source):[];let l=o.length;for(let u=o.length-1;u>=0;--u){const p=o[u][1];if(p===""||p==="\r")l=u;else break}if(l===0){const u=i.chomp==="+"&&o.length>0?`
`.repeat(Math.max(1,o.length-1)):"";let p=s+i.length;return e.source&&(p+=e.source.length),{value:u,type:r,comment:i.comment,range:[s,p,p]}}let a=e.indent+i.indent,c=e.offset+i.length,h=0;for(let u=0;u<l;++u){const[p,y]=o[u];if(y===""||y==="\r")i.indent===0&&p.length>a&&(a=p.length);else{p.length<a&&t(c+p.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),i.indent===0&&(a=p.length),h=u,a===0&&!n.atRoot&&t(c,"BAD_INDENT","Block scalar values in collections must be indented");break}c+=p.length+y.length+1}for(let u=o.length-1;u>=l;--u)o[u][0].length>a&&(l=u+1);let f="",m="",d=!1;for(let u=0;u<h;++u)f+=o[u][0].slice(a)+`
`;for(let u=h;u<l;++u){let[p,y]=o[u];c+=p.length+y.length+1;const w=y[y.length-1]==="\r";if(w&&(y=y.slice(0,-1)),y&&p.length<a){const S=`Block scalar lines must not be less indented than their ${i.indent?"explicit indentation indicator":"first line"}`;t(c-y.length-(w?2:1),"BAD_INDENT",S),p=""}r===T.BLOCK_LITERAL?(f+=m+p.slice(a)+y,m=`
`):p.length>a||y[0]==="	"?(m===" "?m=`
`:!d&&m===`
`&&(m=`

`),f+=m+p.slice(a)+y,m=`
`,d=!0):y===""?m===`
`?f+=`
`:m=`
`:(f+=m+y,m=" ",d=!1)}switch(i.chomp){case"-":break;case"+":for(let u=l;u<o.length;++u)f+=`
`+o[u][0].slice(a);f[f.length-1]!==`
`&&(f+=`
`);break;default:f+=`
`}const b=s+i.length+e.source.length;return{value:f,type:r,comment:i.comment,range:[s,b,b]}}function jr({offset:n,props:e},t,s){if(e[0].type!=="block-scalar-header")return s(e[0],"IMPOSSIBLE","Block scalar header not found"),null;const{source:i}=e[0],r=i[0];let o=0,l="",a=-1;for(let m=1;m<i.length;++m){const d=i[m];if(!l&&(d==="-"||d==="+"))l=d;else{const b=Number(d);!o&&b?o=b:a===-1&&(a=n+m)}}a!==-1&&s(a,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let c=!1,h="",f=i.length;for(let m=1;m<e.length;++m){const d=e[m];switch(d.type){case"space":c=!0;case"newline":f+=d.source.length;break;case"comment":t&&!c&&s(d,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),f+=d.source.length,h=d.source.substring(1);break;case"error":s(d,"UNEXPECTED_TOKEN",d.message),f+=d.source.length;break;default:{const b=`Unexpected token in block scalar header: ${d.type}`;s(d,"UNEXPECTED_TOKEN",b);const u=d.source;u&&typeof u=="string"&&(f+=u.length)}}}return{mode:r,indent:o,chomp:l,comment:h,length:f}}function Rr(n){const e=n.split(/\n( *)/),t=e[0],s=t.match(/^( *)/),r=[s!=null&&s[1]?[s[1],t.slice(s[1].length)]:["",t]];for(let o=1;o<e.length;o+=2)r.push([e[o],e[o+1]]);return r}function Ns(n,e,t){const{offset:s,type:i,source:r,end:o}=n;let l,a;const c=(m,d,b)=>t(s+m,d,b);switch(i){case"scalar":l=T.PLAIN,a=qr(r,c);break;case"single-quoted-scalar":l=T.QUOTE_SINGLE,a=Fr(r,c);break;case"double-quoted-scalar":l=T.QUOTE_DOUBLE,a=Ur(r,c);break;default:return t(n,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[s,s+r.length,s+r.length]}}const h=s+r.length,f=He(o,h,e,t);return{value:a,type:l,comment:f.comment,range:[s,h,f.offset]}}function qr(n,e){let t="";switch(n[0]){case"	":t="a tab character";break;case",":t="flow indicator character ,";break;case"%":t="directive indicator character %";break;case"|":case">":{t=`block scalar indicator ${n[0]}`;break}case"@":case"`":{t=`reserved character ${n[0]}`;break}}return t&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${t}`),Os(n)}function Fr(n,e){return(n[n.length-1]!=="'"||n.length===1)&&e(n.length,"MISSING_CHAR","Missing closing 'quote"),Os(n.slice(1,-1)).replace(/''/g,"'")}function Os(n){let e,t;try{e=new RegExp(`(.*?)(?<![ 	])[ 	]*\r?
`,"sy"),t=new RegExp(`[ 	]*(.*?)(?:(?<![ 	])[ 	]*)?\r?
`,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,t=/[ \t]*(.*?)[ \t]*\r?\n/sy}let s=e.exec(n);if(!s)return n;let i=s[1],r=" ",o=e.lastIndex;for(t.lastIndex=o;s=t.exec(n);)s[1]===""?r===`
`?i+=r:r=`
`:(i+=r+s[1],r=" "),o=t.lastIndex;const l=/[ \t]*(.*)/sy;return l.lastIndex=o,s=l.exec(n),i+r+((s==null?void 0:s[1])??"")}function Ur(n,e){let t="";for(let s=1;s<n.length-1;++s){const i=n[s];if(!(i==="\r"&&n[s+1]===`
`))if(i===`
`){const{fold:r,offset:o}=Vr(n,s);t+=r,s=o}else if(i==="\\"){let r=n[++s];const o=Jr[r];if(o)t+=o;else if(r===`
`)for(r=n[s+1];r===" "||r==="	";)r=n[++s+1];else if(r==="\r"&&n[s+1]===`
`)for(r=n[++s+1];r===" "||r==="	";)r=n[++s+1];else if(r==="x"||r==="u"||r==="U"){const l={x:2,u:4,U:8}[r];t+=Yr(n,s+1,l,e),s+=l}else{const l=n.substr(s-1,2);e(s-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${l}`),t+=l}}else if(i===" "||i==="	"){const r=s;let o=n[s+1];for(;o===" "||o==="	";)o=n[++s+1];o!==`
`&&!(o==="\r"&&n[s+2]===`
`)&&(t+=s>r?n.slice(r,s+1):i)}else t+=i}return(n[n.length-1]!=='"'||n.length===1)&&e(n.length,"MISSING_CHAR",'Missing closing "quote'),t}function Vr(n,e){let t="",s=n[e+1];for(;(s===" "||s==="	"||s===`
`||s==="\r")&&!(s==="\r"&&n[e+2]!==`
`);)s===`
`&&(t+=`
`),e+=1,s=n[e+1];return t||(t=" "),{fold:t,offset:e}}const Jr={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
`,r:"\r",t:"	",v:"\v",N:"",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\","	":"	"};function Yr(n,e,t,s){const i=n.substr(e,t),o=i.length===t&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;if(isNaN(o)){const l=n.substr(e-2,t+2);return s(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${l}`),l}return String.fromCodePoint(o)}function As(n,e,t,s){const{value:i,type:r,comment:o,range:l}=e.type==="block-scalar"?ks(n,e,s):Ns(e,n.options.strict,s),a=t?n.directives.tagName(t.source,f=>s(t,"TAG_RESOLVE_FAILED",f)):null;let c;n.options.stringKeys&&n.atKey?c=n.schema[X]:a?c=Wr(n.schema,i,a,t,s):e.type==="scalar"?c=Gr(n,i,e,s):c=n.schema[X];let h;try{const f=c.resolve(i,m=>s(t??e,"TAG_RESOLVE_FAILED",m),n.options);h=C(f)?f:new T(f)}catch(f){const m=f instanceof Error?f.message:String(f);s(t??e,"TAG_RESOLVE_FAILED",m),h=new T(i)}return h.range=l,h.source=i,r&&(h.type=r),a&&(h.tag=a),c.format&&(h.format=c.format),o&&(h.comment=o),h}function Wr(n,e,t,s,i){var l;if(t==="!")return n[X];const r=[];for(const a of n.tags)if(!a.collection&&a.tag===t)if(a.default&&a.test)r.push(a);else return a;for(const a of r)if((l=a.test)!=null&&l.test(e))return a;const o=n.knownTags[t];return o&&!o.collection?(n.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(i(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${t}`,t!=="tag:yaml.org,2002:str"),n[X])}function Gr({atKey:n,directives:e,schema:t},s,i,r){const o=t.tags.find(l=>{var a;return(l.default===!0||n&&l.default==="key")&&((a=l.test)==null?void 0:a.test(s))})||t[X];if(t.compat){const l=t.compat.find(a=>{var c;return a.default&&((c=a.test)==null?void 0:c.test(s))})??t[X];if(o.tag!==l.tag){const a=e.tagString(o.tag),c=e.tagString(l.tag),h=`Value may be parsed as either ${a} or ${c}`;r(i,"TAG_RESOLVE_FAILED",h,!0)}}return o}function Hr(n,e,t){if(e){t===null&&(t=e.length);for(let s=t-1;s>=0;--s){let i=e[s];switch(i.type){case"space":case"comment":case"newline":n-=i.source.length;continue}for(i=e[++s];(i==null?void 0:i.type)==="space";)n+=i.source.length,i=e[++s];break}}return n}const Qr={composeNode:Ts,composeEmptyNode:cn};function Ts(n,e,t,s){const i=n.atKey,{spaceBefore:r,comment:o,anchor:l,tag:a}=t;let c,h=!0;switch(e.type){case"alias":c=zr(n,e,s),(l||a)&&s(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":c=As(n,e,a,s),l&&(c.anchor=l.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":c=Dr(Qr,n,e,t,s),l&&(c.anchor=l.source.substring(1));break;default:{const f=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;s(e,"UNEXPECTED_TOKEN",f),c=cn(n,e.offset,void 0,null,t,s),h=!1}}return l&&c.anchor===""&&s(l,"BAD_ALIAS","Anchor cannot be an empty string"),i&&n.options.stringKeys&&(!C(c)||typeof c.value!="string"||c.tag&&c.tag!=="tag:yaml.org,2002:str")&&s(a??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),r&&(c.spaceBefore=!0),o&&(e.type==="scalar"&&e.source===""?c.comment=o:c.commentBefore=o),n.options.keepSourceTokens&&h&&(c.srcToken=e),c}function cn(n,e,t,s,{spaceBefore:i,comment:r,anchor:o,tag:l,end:a},c){const h={type:"scalar",offset:Hr(e,t,s),indent:-1,source:""},f=As(n,h,l,c);return o&&(f.anchor=o.source.substring(1),f.anchor===""&&c(o,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(f.spaceBefore=!0),r&&(f.comment=r,f.range[2]=a),f}function zr({options:n},{offset:e,source:t,end:s},i){const r=new pt(t.substring(1));r.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),r.source.endsWith(":")&&i(e+t.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);const o=e+t.length,l=He(s,o,n.strict,i);return r.range=[e,o,l.offset],l.comment&&(r.comment=l.comment),r}function Xr(n,e,{offset:t,start:s,value:i,end:r},o){const l=Object.assign({_directives:e},n),a=new Ke(void 0,l),c={atKey:!1,atRoot:!0,directives:a.directives,options:a.options,schema:a.schema},h=Ce(s,{indicator:"doc-start",next:i??(r==null?void 0:r[0]),offset:t,onError:o,parentIndent:0,startOnNewline:!0});h.found&&(a.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!h.hasNewline&&o(h.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),a.contents=i?Ts(c,i,h,o):cn(c,h.end,s,null,h,o);const f=a.contents.range[2],m=He(r,f,!1,o);return m.comment&&(a.comment=m.comment),a.range=[t,f,m.offset],a}function De(n){if(typeof n=="number")return[n,n+1];if(Array.isArray(n))return n.length===2?n:[n[0],n[1]];const{offset:e,source:t}=n;return[e,e+(typeof t=="string"?t.length:1)]}function Ln(n){var i;let e="",t=!1,s=!1;for(let r=0;r<n.length;++r){const o=n[r];switch(o[0]){case"#":e+=(e===""?"":s?`

`:`
`)+(o.substring(1)||" "),t=!0,s=!1;break;case"%":((i=n[r+1])==null?void 0:i[0])!=="#"&&(r+=1),t=!1;break;default:t||(s=!0),t=!1}}return{comment:e,afterEmptyLine:s}}class fn{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(t,s,i,r)=>{const o=De(t);r?this.warnings.push(new ws(o,s,i)):this.errors.push(new de(o,s,i))},this.directives=new R({version:e.version||"1.2"}),this.options=e}decorate(e,t){const{comment:s,afterEmptyLine:i}=Ln(this.prelude);if(s){const r=e.contents;if(t)e.comment=e.comment?`${e.comment}
${s}`:s;else if(i||e.directives.docStart||!r)e.commentBefore=s;else if(B(r)&&!r.flow&&r.items.length>0){let o=r.items[0];$(o)&&(o=o.key);const l=o.commentBefore;o.commentBefore=l?`${s}
${l}`:s}else{const o=r.commentBefore;r.commentBefore=o?`${s}
${o}`:s}}t?(Array.prototype.push.apply(e.errors,this.errors),Array.prototype.push.apply(e.warnings,this.warnings)):(e.errors=this.errors,e.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Ln(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,s=-1){for(const i of e)yield*this.next(i);yield*this.end(t,s)}*next(e){switch(e.type){case"directive":this.directives.add(e.source,(t,s,i)=>{const r=De(e);r[0]+=t,this.onError(r,"BAD_DIRECTIVE",s,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{const t=Xr(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{const t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,s=new de(De(e),"UNEXPECTED_TOKEN",t);this.atDirectives||!this.doc?this.errors.push(s):this.doc.errors.push(s);break}case"doc-end":{if(!this.doc){const s="Unexpected doc-end without preceding document";this.errors.push(new de(De(e),"UNEXPECTED_TOKEN",s));break}this.doc.directives.docEnd=!0;const t=He(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){const s=this.doc.comment;this.doc.comment=s?`${s}
${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new de(De(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){const s=Object.assign({_directives:this.directives},this.options),i=new Ke(void 0,s);this.atDirectives&&this.onError(t,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,t,t],this.decorate(i,!1),yield i}}}function xr(n,e=!0,t){if(n){const s=(i,r,o)=>{const l=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(t)t(l,r,o);else throw new de([l,l+1],r,o)};switch(n.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Ns(n,e,s);case"block-scalar":return ks({options:{strict:e}},n,s)}}return null}function Zr(n,e){const{implicitKey:t=!1,indent:s,inFlow:i=!1,offset:r=-1,type:o="PLAIN"}=e,l=We({type:o,value:n},{implicitKey:t,indent:s>0?" ".repeat(s):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),a=e.end??[{type:"newline",offset:-1,indent:s,source:`
`}];switch(l[0]){case"|":case">":{const c=l.indexOf(`
`),h=l.substring(0,c),f=l.substring(c+1)+`
`,m=[{type:"block-scalar-header",offset:r,indent:s,source:h}];return Is(m,a)||m.push({type:"newline",offset:-1,indent:s,source:`
`}),{type:"block-scalar",offset:r,indent:s,props:m,source:f}}case'"':return{type:"double-quoted-scalar",offset:r,indent:s,source:l,end:a};case"'":return{type:"single-quoted-scalar",offset:r,indent:s,source:l,end:a};default:return{type:"scalar",offset:r,indent:s,source:l,end:a}}}function eo(n,e,t={}){let{afterKey:s=!1,implicitKey:i=!1,inFlow:r=!1,type:o}=t,l="indent"in n?n.indent:null;if(s&&typeof l=="number"&&(l+=2),!o)switch(n.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{const c=n.props[0];if(c.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=c.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}const a=We({type:o,value:e},{implicitKey:i||l===null,indent:l!==null&&l>0?" ".repeat(l):"",inFlow:r,options:{blockQuote:!0,lineWidth:-1}});switch(a[0]){case"|":case">":to(n,a);break;case'"':Kt(n,a,"double-quoted-scalar");break;case"'":Kt(n,a,"single-quoted-scalar");break;default:Kt(n,a,"scalar")}}function to(n,e){const t=e.indexOf(`
`),s=e.substring(0,t),i=e.substring(t+1)+`
`;if(n.type==="block-scalar"){const r=n.props[0];if(r.type!=="block-scalar-header")throw new Error("Invalid block scalar header");r.source=s,n.source=i}else{const{offset:r}=n,o="indent"in n?n.indent:-1,l=[{type:"block-scalar-header",offset:r,indent:o,source:s}];Is(l,"end"in n?n.end:void 0)||l.push({type:"newline",offset:-1,indent:o,source:`
`});for(const a of Object.keys(n))a!=="type"&&a!=="offset"&&delete n[a];Object.assign(n,{type:"block-scalar",indent:o,props:l,source:i})}}function Is(n,e){if(e)for(const t of e)switch(t.type){case"space":case"comment":n.push(t);break;case"newline":return n.push(t),!0}return!1}function Kt(n,e,t){switch(n.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":n.type=t,n.source=e;break;case"block-scalar":{const s=n.props.slice(1);let i=e.length;n.props[0].type==="block-scalar-header"&&(i-=n.props[0].source.length);for(const r of s)r.offset+=i;delete n.props,Object.assign(n,{type:t,source:e,end:s});break}case"block-map":case"block-seq":{const i={type:"newline",offset:n.offset+e.length,indent:n.indent,source:`
`};delete n.items,Object.assign(n,{type:t,source:e,end:[i]});break}default:{const s="indent"in n?n.indent:-1,i="end"in n&&Array.isArray(n.end)?n.end.filter(r=>r.type==="space"||r.type==="comment"||r.type==="newline"):[];for(const r of Object.keys(n))r!=="type"&&r!=="offset"&&delete n[r];Object.assign(n,{type:t,indent:s,source:e,end:i})}}}const no=n=>"type"in n?ht(n):ot(n);function ht(n){switch(n.type){case"block-scalar":{let e="";for(const t of n.props)e+=ht(t);return e+n.source}case"block-map":case"block-seq":{let e="";for(const t of n.items)e+=ot(t);return e}case"flow-collection":{let e=n.start.source;for(const t of n.items)e+=ot(t);for(const t of n.end)e+=t.source;return e}case"document":{let e=ot(n);if(n.end)for(const t of n.end)e+=t.source;return e}default:{let e=n.source;if("end"in n&&n.end)for(const t of n.end)e+=t.source;return e}}}function ot({start:n,key:e,sep:t,value:s}){let i="";for(const r of n)i+=r.source;if(e&&(i+=ht(e)),t)for(const r of t)i+=r.source;return s&&(i+=ht(s)),i}const Gt=Symbol("break visit"),so=Symbol("skip children"),Es=Symbol("remove item");function me(n,e){"type"in n&&n.type==="document"&&(n={start:n.start,value:n.value}),Ls(Object.freeze([]),n,e)}me.BREAK=Gt;me.SKIP=so;me.REMOVE=Es;me.itemAtPath=(n,e)=>{let t=n;for(const[s,i]of e){const r=t==null?void 0:t[s];if(r&&"items"in r)t=r.items[i];else return}return t};me.parentCollection=(n,e)=>{const t=me.itemAtPath(n,e.slice(0,-1)),s=e[e.length-1][0],i=t==null?void 0:t[s];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function Ls(n,e,t){let s=t(e,n);if(typeof s=="symbol")return s;for(const i of["key","value"]){const r=e[i];if(r&&"items"in r){for(let o=0;o<r.items.length;++o){const l=Ls(Object.freeze(n.concat([[i,o]])),r.items[o],t);if(typeof l=="number")o=l-1;else{if(l===Gt)return Gt;l===Es&&(r.items.splice(o,1),o-=1)}}typeof s=="function"&&i==="key"&&(s=s(e,n))}}return typeof s=="function"?s(e,n):s}const Tt="\uFEFF",It="",Et="",Ve="",io=n=>!!n&&"items"in n,ro=n=>!!n&&(n.type==="scalar"||n.type==="single-quoted-scalar"||n.type==="double-quoted-scalar"||n.type==="block-scalar");function oo(n){switch(n){case Tt:return"<BOM>";case It:return"<DOC>";case Et:return"<FLOW_END>";case Ve:return"<SCALAR>";default:return JSON.stringify(n)}}function Cs(n){switch(n){case Tt:return"byte-order-mark";case It:return"doc-mode";case Et:return"flow-error-end";case Ve:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
`:case`\r
`: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(n[0]){case" ":case"	":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}const lo=Object.freeze(Object.defineProperty({__proto__:null,BOM:Tt,DOCUMENT:It,FLOW_END:Et,SCALAR:Ve,createScalarToken:Zr,isCollection:io,isScalar:ro,prettyToken:oo,resolveAsScalar:xr,setScalarValue:eo,stringify:no,tokenType:Cs,visit:me},Symbol.toStringTag,{value:"Module"}));function W(n){switch(n){case void 0:case" ":case`
`:case"\r":case"	":return!0;default:return!1}}const Cn=new Set("0123456789ABCDEFabcdef"),ao=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),tt=new Set(",[]{}"),co=new Set(` ,[]{}
\r	`),Dt=n=>!n||co.has(n);class vs{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let s=this.next??"stream";for(;s&&(t||this.hasChars(1));)s=yield*this.parseNext(s)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===" "||t==="	";)t=this.buffer[++e];return!t||t==="#"||t===`
`?!0:t==="\r"?this.buffer[e+1]===`
`:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let s=0;for(;t===" ";)t=this.buffer[++s+e];if(t==="\r"){const i=this.buffer[s+e+1];if(i===`
`||!i&&!this.atEnd)return e+s+1}return t===`
`||s>=this.indentNext||!t&&!this.atEnd?e+s:-1}if(t==="-"||t==="."){const s=this.buffer.substr(e,3);if((s==="---"||s==="...")&&W(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===Tt&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let t=e.length,s=e.indexOf("#");for(;s!==-1;){const r=e[s-1];if(r===" "||r==="	"){t=s-1;break}else s=e.indexOf("#",s+1)}for(;;){const r=e[t-1];if(r===" "||r==="	")t-=1;else break}const i=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-i),this.pushNewline(),"stream"}if(this.atLineEnd()){const t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),"stream"}return yield It,yield*this.parseLineStart()}*parseLineStart(){const e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");const t=this.peek(3);if((t==="---"||t==="...")&&W(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,t==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!W(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===":")&&W(t)){const s=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=s,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);const e=this.getLine();if(e===null)return this.setNext("doc");let t=yield*this.pushIndicators();switch(e[t]){case"#":yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(Dt),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,s=-1;do e=yield*this.pushNewline(),e>0?(t=yield*this.pushSpaces(!1),this.indentValue=s=t):t=0,t+=yield*this.pushSpaces(!0);while(e+t>0);const i=this.getLine();if(i===null)return this.setNext("flow");if((s!==-1&&s<this.indentNext&&i[0]!=="#"||s===0&&(i.startsWith("---")||i.startsWith("..."))&&W(i[3]))&&!(s===this.indentNext-1&&this.flowLevel===1&&(i[0]==="]"||i[0]==="}")))return this.flowLevel=0,yield Et,yield*this.parseLineStart();let r=0;for(;i[r]===",";)r+=yield*this.pushCount(1),r+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(r+=yield*this.pushIndicators(),i[r]){case void 0:return"flow";case"#":return yield*this.pushCount(i.length-r),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(Dt),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{const o=this.charAt(1);if(this.flowKey||W(o)||o===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){const e=this.charAt(0);let t=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;t!==-1&&this.buffer[t+1]==="'";)t=this.buffer.indexOf("'",t+2);else for(;t!==-1;){let r=0;for(;this.buffer[t-1-r]==="\\";)r+=1;if(r%2===0)break;t=this.buffer.indexOf('"',t+1)}const s=this.buffer.substring(0,t);let i=s.indexOf(`
`,this.pos);if(i!==-1){for(;i!==-1;){const r=this.continueScalar(i+1);if(r===-1)break;i=s.indexOf(`
`,r)}i!==-1&&(t=i-(s[i-1]==="\r"?2:1))}if(t===-1){if(!this.atEnd)return this.setNext("quoted-scalar");t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){const t=this.buffer[++e];if(t==="+")this.blockScalarKeep=!0;else if(t>"0"&&t<="9")this.blockScalarIndent=Number(t)-1;else if(t!=="-")break}return yield*this.pushUntil(t=>W(t)||t==="#")}*parseBlockScalar(){let e=this.pos-1,t=0,s;e:for(let r=this.pos;s=this.buffer[r];++r)switch(s){case" ":t+=1;break;case`
`:e=r,t=0;break;case"\r":{const o=this.buffer[r+1];if(!o&&!this.atEnd)return this.setNext("block-scalar");if(o===`
`)break}default:break e}if(!s&&!this.atEnd)return this.setNext("block-scalar");if(t>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=t:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{const r=this.continueScalar(e+1);if(r===-1)break;e=this.buffer.indexOf(`
`,r)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let i=e+1;for(s=this.buffer[i];s===" ";)s=this.buffer[++i];if(s==="	"){for(;s==="	"||s===" "||s==="\r"||s===`
`;)s=this.buffer[++i];e=i-1}else if(!this.blockScalarKeep)do{let r=e-1,o=this.buffer[r];o==="\r"&&(o=this.buffer[--r]);const l=r;for(;o===" ";)o=this.buffer[--r];if(o===`
`&&r>=this.pos&&r+1+t>l)e=r;else break}while(!0);return yield Ve,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){const e=this.flowLevel>0;let t=this.pos-1,s=this.pos-1,i;for(;i=this.buffer[++s];)if(i===":"){const r=this.buffer[s+1];if(W(r)||e&&tt.has(r))break;t=s}else if(W(i)){let r=this.buffer[s+1];if(i==="\r"&&(r===`
`?(s+=1,i=`
`,r=this.buffer[s+1]):t=s),r==="#"||e&&tt.has(r))break;if(i===`
`){const o=this.continueScalar(s+1);if(o===-1)break;s=Math.max(s,o-2)}}else{if(e&&tt.has(i))break;t=s}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield Ve,yield*this.pushToIndex(t+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){const s=this.buffer.slice(this.pos,e);return s?(yield s,this.pos+=s.length,s.length):(t&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(Dt))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{const e=this.flowLevel>0,t=this.charAt(1);if(W(t)||e&&tt.has(t))return e?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}return 0}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,t=this.buffer[e];for(;!W(t)&&t!==">";)t=this.buffer[++e];return yield*this.pushToIndex(t===">"?e+1:e,!1)}else{let e=this.pos+1,t=this.buffer[e];for(;t;)if(ao.has(t))t=this.buffer[++e];else if(t==="%"&&Cn.has(this.buffer[e+1])&&Cn.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){const e=this.buffer[this.pos];return e===`
`?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,s;do s=this.buffer[++t];while(s===" "||e&&s==="	");const i=t-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=t),i}*pushUntil(e){let t=this.pos,s=this.buffer[t];for(;!e(s);)s=this.buffer[++t];return yield*this.pushToIndex(t,!1)}}class $s{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,s=this.lineStarts.length;for(;t<s;){const r=t+s>>1;this.lineStarts[r]<e?t=r+1:s=r}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};const i=this.lineStarts[t-1];return{line:t,col:e-i+1}}}}function fe(n,e){for(let t=0;t<n.length;++t)if(n[t].type===e)return!0;return!1}function vn(n){for(let e=0;e<n.length;++e)switch(n[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function Bs(n){switch(n==null?void 0:n.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function nt(n){switch(n.type){case"document":return n.start;case"block-map":{const e=n.items[n.items.length-1];return e.sep??e.start}case"block-seq":return n.items[n.items.length-1].start;default:return[]}}function Se(n){var t;if(n.length===0)return[];let e=n.length;e:for(;--e>=0;)switch(n[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;((t=n[++e])==null?void 0:t.type)==="space";);return n.splice(e,n.length)}function $n(n){if(n.start.type==="flow-seq-start")for(const e of n.items)e.sep&&!e.value&&!fe(e.start,"explicit-key-ind")&&!fe(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,Bs(e.value)?e.value.end?Array.prototype.push.apply(e.value.end,e.sep):e.value.end=e.sep:Array.prototype.push.apply(e.start,e.sep),delete e.sep)}class un{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 vs,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(const s of this.lexer.lex(e,t))yield*this.next(s);t||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}const t=Cs(e);if(t)if(t==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=t,yield*this.step(),t){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{const s=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:s,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){const e=this.peek(1);if(this.type==="doc-end"&&(!e||e.type!=="doc-end")){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){const t=e??this.stack.pop();if(!t)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield t;else{const s=this.peek(1);switch(t.type==="block-scalar"?t.indent="indent"in s?s.indent:0:t.type==="flow-collection"&&s.type==="document"&&(t.indent=0),t.type==="flow-collection"&&$n(t),s.type){case"document":s.value=t;break;case"block-scalar":s.props.push(t);break;case"block-map":{const i=s.items[s.items.length-1];if(i.value){s.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=t;else{Object.assign(i,{key:t,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{const i=s.items[s.items.length-1];i.value?s.items.push({start:[],value:t}):i.value=t;break}case"flow-collection":{const i=s.items[s.items.length-1];!i||i.value?s.items.push({start:[],key:t,sep:[]}):i.sep?i.value=t:Object.assign(i,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((s.type==="document"||s.type==="block-map"||s.type==="block-seq")&&(t.type==="block-map"||t.type==="block-seq")){const i=t.items[t.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&vn(i.start)===-1&&(t.indent===0||i.start.every(r=>r.type!=="comment"||r.indent<t.indent))&&(s.type==="document"?s.end=i.start:s.items.push({start:i.start}),t.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{const e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{vn(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}const t=this.startBlockValue(e);t?this.stack.push(t):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){const t=nt(this.peek(2)),s=Se(t);let i;e.end?(i=e.end,i.push(this.sourceToken),delete e.end):i=[this.sourceToken];const r={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:s,key:e,sep:i}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=r}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let t=this.source.indexOf(`
`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
`,t)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){var s;const t=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,t.value){const i="end"in t.value?t.value.end:void 0,r=Array.isArray(i)?i[i.length-1]:void 0;(r==null?void 0:r.type)==="comment"?i==null||i.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){const i=e.items[e.items.length-2],r=(s=i==null?void 0:i.value)==null?void 0:s.end;if(Array.isArray(r)){Array.prototype.push.apply(r,t.start),r.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){const i=!this.onKeyLine&&this.indent===e.indent,r=i&&(t.sep||t.explicitKey)&&this.type!=="seq-item-ind";let o=[];if(r&&t.sep&&!t.value){const l=[];for(let a=0;a<t.sep.length;++a){const c=t.sep[a];switch(c.type){case"newline":l.push(a);break;case"space":break;case"comment":c.indent>e.indent&&(l.length=0);break;default:l.length=0}}l.length>=2&&(o=t.sep.splice(l[1]))}switch(this.type){case"anchor":case"tag":r||t.value?(o.push(this.sourceToken),e.items.push({start:o}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"explicit-key-ind":!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):r||t.value?(o.push(this.sourceToken),e.items.push({start:o,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(t.explicitKey)if(t.sep)if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(fe(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]});else if(Bs(t.key)&&!fe(t.sep,"newline")){const l=Se(t.start),a=t.key,c=t.sep;c.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:l,key:a,sep:c}]})}else o.length>0?t.sep=t.sep.concat(o,this.sourceToken):t.sep.push(this.sourceToken);else if(fe(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{const l=Se(t.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:l,key:null,sep:[this.sourceToken]}]})}else t.sep?t.value||r?e.items.push({start:o,key:null,sep:[this.sourceToken]}):fe(t.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const l=this.flowScalar(this.type);r||t.value?(e.items.push({start:o,key:l,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(l):(Object.assign(t,{key:l,sep:[]}),this.onKeyLine=!0);return}default:{const l=this.startBlockValue(e);if(l){i&&l.type!=="block-seq"&&e.items.push({start:o}),this.stack.push(l);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){var s;const t=e.items[e.items.length-1];switch(this.type){case"newline":if(t.value){const i="end"in t.value?t.value.end:void 0,r=Array.isArray(i)?i[i.length-1]:void 0;(r==null?void 0:r.type)==="comment"?i==null||i.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){const i=e.items[e.items.length-2],r=(s=i==null?void 0:i.value)==null?void 0:s.end;if(Array.isArray(r)){Array.prototype.push.apply(r,t.start),r.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case"anchor":case"tag":if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;t.value||fe(t.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){const i=this.startBlockValue(e);if(i){this.stack.push(i);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){const t=e.items[e.items.length-1];if(this.type==="flow-error-end"){let s;do yield*this.pop(),s=this.peek(1);while(s&&s.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case"map-value-ind":!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const i=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:i,sep:[]}):t.sep?this.stack.push(i):Object.assign(t,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}const s=this.startBlockValue(e);s?this.stack.push(s):(yield*this.pop(),yield*this.step())}else{const s=this.peek(2);if(s.type==="block-map"&&(this.type==="map-value-ind"&&s.indent===e.indent||this.type==="newline"&&!s.items[s.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&s.type!=="flow-collection"){const i=nt(s),r=Se(i);$n(e);const o=e.end.splice(1,e.end.length);o.push(this.sourceToken);const l={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:r,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=l}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let t=this.source.indexOf(`
`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
`,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;const t=nt(e),s=Se(t);return s.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const t=nt(e),s=Se(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!=="comment"||this.indent<=t?!1:e.every(s=>s.type==="newline"||s.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}}function _s(n){const e=n.prettyErrors!==!1;return{lineCounter:n.lineCounter||e&&new $s||null,prettyErrors:e}}function fo(n,e={}){const{lineCounter:t,prettyErrors:s}=_s(e),i=new un(t==null?void 0:t.addNewLine),r=new fn(e),o=Array.from(r.compose(i.parse(n)));if(s&&t)for(const l of o)l.errors.forEach(ut(n,t)),l.warnings.forEach(ut(n,t));return o.length>0?o:Object.assign([],{empty:!0},r.streamInfo())}function Ps(n,e={}){const{lineCounter:t,prettyErrors:s}=_s(e),i=new un(t==null?void 0:t.addNewLine),r=new fn(e);let o=null;for(const l of r.compose(i.parse(n),!0,n.length))if(!o)o=l;else if(o.options.logLevel!=="silent"){o.errors.push(new de(l.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return s&&t&&(o.errors.forEach(ut(n,t)),o.warnings.forEach(ut(n,t))),o}function uo(n,e,t){let s;typeof e=="function"?s=e:t===void 0&&e&&typeof e=="object"&&(t=e);const i=Ps(n,t);if(!i)return null;if(i.warnings.forEach(r=>es(i.options.logLevel,r)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:s},t))}function ho(n,e,t){let s=null;if(typeof e=="function"||Array.isArray(e)?s=e:t===void 0&&e&&(t=e),typeof t=="string"&&(t=t.length),typeof t=="number"){const i=Math.round(t);t=i<1?void 0:i>8?{indent:8}:{indent:i}}if(n===void 0){const{keepUndefined:i}=t??e??{};if(!i)return}return ge(n)&&!s?n.toString(t):new Ke(n,s,t).toString(t)}const wo=Object.freeze(Object.defineProperty({__proto__:null,Alias:pt,CST:lo,Composer:fn,Document:Ke,Lexer:vs,LineCounter:$s,Pair:j,Parser:un,Scalar:T,Schema:At,YAMLError:an,YAMLMap:F,YAMLParseError:de,YAMLSeq:le,YAMLWarning:ws,isAlias:pe,isCollection:B,isDocument:ge,isMap:Be,isNode:_,isPair:$,isScalar:C,isSeq:_e,parse:uo,parseAllDocuments:fo,parseDocument:Ps,stringify:ho,visit:oe,visitAsync:mt},Symbol.toStringTag,{value:"Module"}));export{go as F,bo as L,wo as Y,yo as a,Qi as s};
