| 126 | ${s}`);if(a){let d=E=>E.default&&E.tag!=="tag:yaml.org,2002:str"&&E.test?.test(C),{compat:B,tags:u}=e.doc.schema;if(u.some(d)||B?.some(d))return SB(o,e)}return r?C:cu(C,s,v7,Gm(e,!1))}function sd(i,e,A,t){let{implicitKey:n,inFlow:o}=e,a=typeof i.value=="string"?i:Object.assign({},i,{value:String(i.value)}),{type:r}=i;r!==$t.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(a.value)&&(r=$t.QUOTE_DOUBLE);let s=g=>{switch(g){case $t.BLOCK_FOLDED:case $t.BLOCK_LITERAL:return n||o?SB(a.value,e):Lm(a,e,A,t);case $t.QUOTE_DOUBLE:return Cu(a.value,e);case $t.QUOTE_SINGLE:return b7(a.value,e);case $t.PLAIN:return YrA(a,e,A,t);default:return null}},l=s(r);if(l===null){let{defaultKeyType:g,defaultStringType:C}=e.options,d=n&&g||C;if(l=s(d),l===null)throw new Error(`Unsupported default string type ${d}`)}return l}function Um(i,e){let A=Object.assign({blockQuote:!0,commentString:ST,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},i.schema.toStringOptions,e),t;switch(A.collectionStyle){case"block":t=!1;break;case"flow":t=!0;break;default:t=null}return{anchors:new Set,doc:i,flowCollectionPadding:A.flowCollectionPadding?" ":"",indent:"",indentStep:typeof A.indent=="number"?" ".repeat(A.indent):" ",inFlow:t,options:A}}function HrA(i,e){if(e.tag){let n=i.filter(o=>o.tag===e.tag);if(n.length>0)return n.find(o=>o.format===e.format)??n[0]}let A,t;if(sn(e)){t=e.value;let n=i.filter(o=>o.identify?.(t));if(n.length>1){let o=n.filter(a=>a.test);o.length>0&&(n=o)}A=n.find(o=>o.format===e.format)??n.find(o=>!o.format)}else t=e,A=i.find(n=>n.nodeClass&&t instanceof n.nodeClass);if(!A){let n=t?.constructor?.name??(t===null?"null":typeof t);throw new Error(`Tag not resolved for ${n} value`)}return A}function zrA(i,e,{anchors:A,doc:t}){if(!t.directives)return"";let n=[],o=(sn(i)||vo(i))&&i.anchor;o&&xm(o)&&(A.add(o),n.push(`&${o}`));let a=i.tag??(e.default?null:e.tag);return a&&n.push(t.directives.tagString(a)),n.join(" ")}function AC(i,e,A,t){if(Tn(i))return i.toString(e,A,t);if(rg(i)){if(e.doc.directives)return i.toString(e);if(e.resolvedAliases?.has(i))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(i):e.resolvedAliases=new Set([i]),i=i.resolve(e.doc)}let n,o=Pn(i)?i:e.doc.createNode(i,{onTagObj:s=>n=s});n??(n=HrA(e.doc.schema.tags,o));let a=zrA(o,n,e);a.length>0&&(e.indentAtStart=(e.indentAtStart??0)+a.length+1);let r=typeof n.stringify=="function"?n.stringify(o,e,A,t):sn(o)?sd(o,e,A,t):o.toString(e,A,t);return a?sn(o)||r[0]==="{"||r[0]==="["?`${a} ${r}`:`${a} |
| 127 | ${e.indent}${r}`:r}function _T({key:i,value:e},A,t,n){let{allNullValues:o,doc:a,indent:r,indentStep:s,options:{commentString:l,indentSeq:g,simpleKeys:C}}=A,d=Pn(i)&&i.comment||null;if(C){if(d)throw new Error("With simple keys, key nodes cannot have comments");if(vo(i)||!Pn(i)&&typeof i=="object"){let F="With simple keys, collection cannot be used as a key value";throw new Error(F)}}let B=!C&&(!i||d&&e==null&&!A.inFlow||vo(i)||(sn(i)?i.type===$t.BLOCK_FOLDED||i.type===$t.BLOCK_LITERAL:typeof i=="object"));A=Object.assign({},A,{allNullValues:!1,implicitKey:!B&&(C||!o),indent:r+s});let u=!1,E=!1,f=AC(i,A,()=>u=!0,()=>E=!0);if(!B&&!A.inFlow&&f.length>1024){if(C)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");B=!0}if(A.inFlow){if(o||e==null)return u&&t&&t(),f===""?"?":B?`? ${f}`:f}else if(o&&!C||e==null&&B)return f=`? ${f}`,d&&!u?f+=i0(f,A.indent,l(d)):E&&n&&n(),f;u&&(d=null),B?(d&&(f+=i0(f,A.indent,l(d))),f=`? ${f} |
| 128 | ${r}:`):(f=`${f}:`,d&&(f+=i0(f,A.indent,l(d))));let m,v,S;Pn(e)?(m=!!e.spaceBefore,v=e.commentBefore,S=e.comment):(m=!1,v=null,S=null,e&&typeof e=="object"&&(e=a.createNode(e))),A.implicitKey=!1,!B&&!d&&sn(e)&&(A.indentAtStart=f.length+1),E=!1,!g&&s.length>=2&&!A.inFlow&&!B&&Wg(e)&&!e.flow&&!e.tag&&!e.anchor&&(A.indent=A.indent.substring(2));let k=!1,M=AC(e,A,()=>k=!0,()=>E=!0),x=" ";if(d||m||v){if(x=m?` |