@mcp-use/cli 4.0.2-canary.5 → 5.0.0-canary.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,20 @@
1
+ # Third-party notices
2
+
3
+ `@mcp-use/cli` includes a vendored, minified copy of the `yaml` 2.8.3 parser
4
+ in its Node-only Skills discovery entry point.
5
+
6
+ ## yaml
7
+
8
+ Copyright Eemeli Aro <eemeli@gmail.com>
9
+
10
+ Permission to use, copy, modify, and/or distribute this software for any
11
+ purpose with or without fee is hereby granted, provided that the above
12
+ copyright notice and this permission notice appear in all copies.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
15
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
16
+ FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
17
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
18
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
19
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20
+ PERFORMANCE OF THIS SOFTWARE.
package/dist/bin.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{a as o}from"./chunk-Q53LTBGS.js";import"./chunk-RXKUVCL7.js";import"./chunk-WOT6VMZA.js";import{readFileSync as i}from"fs";import{createRequire as a}from"module";import{dirname as t,join as c,parse as m}from"path";function p(){try{let e=a(import.meta.url).resolve("mcp-use"),n=t(e),s=m(n).root;for(;n!==s;){try{let r=JSON.parse(i(c(n,"package.json"),"utf8"));if(r.name==="mcp-use"&&typeof r.version=="string")return r.version}catch{}n=t(n)}}catch{}}o(process.argv.slice(2),{frameworkVersion:p()??"4.0.2-canary.5"}).then(e=>{process.exitCode=e},e=>{console.error(e instanceof Error?e.message:String(e)),process.exitCode=1});
2
+ import{a as o}from"./chunk-Z6SRTCQC.js";import"./chunk-RXKUVCL7.js";import"./chunk-WOT6VMZA.js";import{readFileSync as i}from"fs";import{createRequire as a}from"module";import{dirname as t,join as c,parse as m}from"path";function p(){try{let e=a(import.meta.url).resolve("mcp-use"),n=t(e),s=m(n).root;for(;n!==s;){try{let r=JSON.parse(i(c(n,"package.json"),"utf8"));if(r.name==="mcp-use"&&typeof r.version=="string")return r.version}catch{}n=t(n)}}catch{}}o(process.argv.slice(2),{frameworkVersion:p()??"5.0.0-canary.6"}).then(e=>{process.exitCode=e},e=>{console.error(e instanceof Error?e.message:String(e)),process.exitCode=1});
@@ -0,0 +1,131 @@
1
+ import{createHash as qs}from"crypto";import{existsSync as Us,lstatSync as Ln,readdirSync as Rs,readFileSync as Cn}from"fs";import{basename as Ne,isAbsolute as $n,relative as Ye,resolve as Oe,sep as he}from"path";var ot=Symbol.for("yaml.alias"),Ze=Symbol.for("yaml.document"),Y=Symbol.for("yaml.map"),jt=Symbol.for("yaml.pair"),q=Symbol.for("yaml.scalar"),ae=Symbol.for("yaml.seq"),B=Symbol.for("yaml.node.type"),Q=e=>!!e&&typeof e=="object"&&e[B]===ot,we=e=>!!e&&typeof e=="object"&&e[B]===Ze,ke=e=>!!e&&typeof e=="object"&&e[B]===Y,I=e=>!!e&&typeof e=="object"&&e[B]===jt,O=e=>!!e&&typeof e=="object"&&e[B]===q,ve=e=>!!e&&typeof e=="object"&&e[B]===ae;function T(e){if(e&&typeof e=="object")switch(e[B]){case Y:case ae:return!0}return!1}function x(e){if(e&&typeof e=="object")switch(e[B]){case ot:case Y:case q:case ae:return!0}return!1}var Kt=e=>(O(e)||T(e))&&!!e.anchor,C=Symbol("break visit"),Bt=Symbol("skip children"),P=Symbol("remove node");function ce(e,t){let n=Mt(t);we(e)?ee(null,e.contents,n,Object.freeze([e]))===P&&(e.contents=null):ee(null,e,n,Object.freeze([]))}ce.BREAK=C;ce.SKIP=Bt;ce.REMOVE=P;function ee(e,t,n,s){let i=Dt(e,t,n,s);if(x(i)||I(i))return Pt(e,s,i),ee(e,i,n,s);if(typeof i!="symbol"){if(T(t)){s=Object.freeze(s.concat(t));for(let r=0;r<t.items.length;++r){let o=ee(r,t.items[r],n,s);if(typeof o=="number")r=o-1;else{if(o===C)return C;o===P&&(t.items.splice(r,1),r-=1)}}}else if(I(t)){s=Object.freeze(s.concat(t));let r=ee("key",t.key,n,s);if(r===C)return C;r===P&&(t.key=null);let o=ee("value",t.value,n,s);if(o===C)return C;o===P&&(t.value=null)}}return i}async function lt(e,t){let n=Mt(t);we(e)?await te(null,e.contents,n,Object.freeze([e]))===P&&(e.contents=null):await te(null,e,n,Object.freeze([]))}lt.BREAK=C;lt.SKIP=Bt;lt.REMOVE=P;async function te(e,t,n,s){let i=await Dt(e,t,n,s);if(x(i)||I(i))return Pt(e,s,i),te(e,i,n,s);if(typeof i!="symbol"){if(T(t)){s=Object.freeze(s.concat(t));for(let r=0;r<t.items.length;++r){let o=await te(r,t.items[r],n,s);if(typeof o=="number")r=o-1;else{if(o===C)return C;o===P&&(t.items.splice(r,1),r-=1)}}}else if(I(t)){s=Object.freeze(s.concat(t));let r=await te("key",t.key,n,s);if(r===C)return C;r===P&&(t.key=null);let o=await te("value",t.value,n,s);if(o===C)return C;o===P&&(t.value=null)}}return i}function Mt(e){return typeof e=="object"&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function Dt(e,t,n,s){if(typeof n=="function")return n(e,t,s);if(ke(t))return n.Map?.(e,t,s);if(ve(t))return n.Seq?.(e,t,s);if(I(t))return n.Pair?.(e,t,s);if(O(t))return n.Scalar?.(e,t,s);if(Q(t))return n.Alias?.(e,t,s)}function Pt(e,t,n){let s=t[t.length-1];if(T(s))s.items[e]=n;else if(I(s))e==="key"?s.key=n:s.value=n;else if(we(s))s.contents=n;else{let i=Q(s)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}var _n={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},jn=e=>e.replace(/[!,[\]{}]/g,t=>_n[t]),ie=class U{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},U.defaultYaml,t),this.tags=Object.assign({},U.defaultTags,n)}clone(){let t=new U(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new U(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:U.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},U.defaultTags);break}return t}add(t,n){this.atNextDocument&&(this.yaml={explicit:U.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},U.defaultTags),this.atNextDocument=!1);let s=t.trim().split(/[ \t]+/),i=s.shift();switch(i){case"%TAG":{if(s.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),s.length<2))return!1;let[r,o]=s;return this.tags[r]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,s.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;let[r]=s;if(r==="1.1"||r==="1.2")return this.yaml.version=r,!0;{let o=/^\d+\.\d+$/.test(r);return n(6,`Unsupported YAML version ${r}`,o),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(t,n){if(t==="!")return"!";if(t[0]!=="!")return n(`Not a valid tag: ${t}`),null;if(t[1]==="<"){let o=t.slice(2,-1);return o==="!"||o==="!!"?(n(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&n("Verbatim tags must end with a >"),o)}let[,s,i]=t.match(/^(.*!)([^!]*)$/s);i||n(`The ${t} tag has no suffix`);let r=this.tags[s];if(r)try{return r+decodeURIComponent(i)}catch(o){return n(String(o)),null}return s==="!"?t:(n(`Could not resolve tag: ${t}`),null)}tagString(t){for(let[n,s]of Object.entries(this.tags))if(t.startsWith(s))return n+jn(t.substring(s.length));return t[0]==="!"?t:`!<${t}>`}toString(t){let n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],s=Object.entries(this.tags),i;if(t&&s.length>0&&x(t.contents)){let r={};ce(t.contents,(o,l)=>{x(l)&&l.tag&&(r[l.tag]=!0)}),i=Object.keys(r)}else i=[];for(let[r,o]of s)r==="!!"&&o==="tag:yaml.org,2002:"||(!t||i.some(l=>l.startsWith(o)))&&n.push(`%TAG ${r} ${o}`);return n.join(`
2
+ `)}};ie.defaultYaml={explicit:!1,version:"1.2"};ie.defaultTags={"!!":"tag:yaml.org,2002:"};function qt(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(t)}return!0}function Ut(e){let t=new Set;return ce(e,{Value(n,s){s.anchor&&t.add(s.anchor)}}),t}function Rt(e,t){for(let n=1;;++n){let s=`${e}${n}`;if(!t.has(s))return s}}function Kn(e,t){let n=[],s=new Map,i=null;return{onAnchor:r=>{n.push(r),i??(i=Ut(e));let o=Rt(t,i);return i.add(o),o},setAnchors:()=>{for(let r of n){let o=s.get(r);if(typeof o=="object"&&o.anchor&&(O(o.node)||T(o.node)))o.node.anchor=o.anchor;else{let l=new Error("Failed to resolve repeated object (this should not happen)");throw l.source=r,l}}},sourceObjects:s}}function ne(e,t,n,s){if(s&&typeof s=="object")if(Array.isArray(s))for(let i=0,r=s.length;i<r;++i){let o=s[i],l=ne(e,s,String(i),o);l===void 0?delete s[i]:l!==o&&(s[i]=l)}else if(s instanceof Map)for(let i of Array.from(s.keys())){let r=s.get(i),o=ne(e,s,i,r);o===void 0?s.delete(i):o!==r&&s.set(i,o)}else if(s instanceof Set)for(let i of Array.from(s)){let r=ne(e,s,i,i);r===void 0?s.delete(i):r!==i&&(s.delete(i),s.add(r))}else for(let[i,r]of Object.entries(s)){let o=ne(e,s,i,r);o===void 0?delete s[i]:o!==r&&(s[i]=o)}return e.call(t,n,s)}function K(e,t,n){if(Array.isArray(e))return e.map((s,i)=>K(s,String(i),n));if(e&&typeof e.toJSON=="function"){if(!n||!Kt(e))return e.toJSON(t,n);let s={aliasCount:0,count:1,res:void 0};n.anchors.set(e,s),n.onCreate=r=>{s.res=r,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e=="bigint"&&!n?.keep?Number(e):e}var at=class{constructor(e){Object.defineProperty(this,B,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:s,reviver:i}={}){if(!we(e))throw new TypeError("A document argument is required");let r={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},o=K(this,"",r);if(typeof s=="function")for(let{count:l,res:a}of r.anchors.values())s(a,l);return typeof i=="function"?ne(i,{"":o},"",o):o}},ct=class extends at{constructor(e){super(ot),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,t){let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],ce(e,{Node:(i,r)=>{(Q(r)||Kt(r))&&n.push(r)}}),t&&(t.aliasResolveCache=n));let s;for(let i of n){if(i===this)break;i.anchor===this.source&&(s=i)}return s}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:s,maxAliasCount:i}=t,r=this.resolve(s,t);if(!r){let l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(l)}let o=n.get(r);if(o||(K(r,null,t),o=n.get(r)),o?.res===void 0){let l="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(l)}if(i>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=Le(s,r,n)),o.count*o.aliasCount>i)){let l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}return o.res}toString(e,t,n){let s=`*${this.source}`;if(e){if(qt(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let i=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(i)}if(e.implicitKey)return`${s} `}return s}};function Le(e,t,n){if(Q(t)){let s=t.resolve(e),i=n&&s&&n.get(s);return i?i.count*i.aliasCount:0}else if(T(t)){let s=0;for(let i of t.items){let r=Le(e,i,n);r>s&&(s=r)}return s}else if(I(t)){let s=Le(e,t.key,n),i=Le(e,t.value,n);return Math.max(s,i)}return 1}var Ft=e=>!e||typeof e!="function"&&typeof e!="object",S=class extends at{constructor(e){super(q),this.value=e}toJSON(e,t){return t?.keep?this.value:K(this.value,e,t)}toString(){return String(this.value)}};S.BLOCK_FOLDED="BLOCK_FOLDED";S.BLOCK_LITERAL="BLOCK_LITERAL";S.PLAIN="PLAIN";S.QUOTE_DOUBLE="QUOTE_DOUBLE";S.QUOTE_SINGLE="QUOTE_SINGLE";var Bn="tag:yaml.org,2002:";function Mn(e,t,n){if(t){let s=n.filter(r=>r.tag===t),i=s.find(r=>!r.format)??s[0];if(!i)throw new Error(`Tag ${t} not found`);return i}return n.find(s=>s.identify?.(e)&&!s.format)}function ye(e,t,n){if(we(e)&&(e=e.contents),x(e))return e;if(I(e)){let u=n.schema[Y].createNode?.(n.schema,null,n);return u.items.push(e),u}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:s,onAnchor:i,onTagObj:r,schema:o,sourceObjects:l}=n,a;if(s&&e&&typeof e=="object"){if(a=l.get(e),a)return a.anchor??(a.anchor=i(e)),new ct(a.anchor);a={anchor:null,node:null},l.set(e,a)}t?.startsWith("!!")&&(t=Bn+t.slice(2));let c=Mn(e,t,o.tags);if(!c){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){let u=new S(e);return a&&(a.node=u),u}c=e instanceof Map?o[Y]:Symbol.iterator in Object(e)?o[ae]:o[Y]}r&&(r(c),delete n.onTagObj);let p=c?.createNode?c.createNode(n.schema,e,n):typeof c?.nodeClass?.from=="function"?c.nodeClass.from(n.schema,e,n):new S(e);return t?p.tag=t:c.default||(p.tag=c.tag),a&&(a.node=p),p}function Be(e,t,n){let s=n;for(let i=t.length-1;i>=0;--i){let r=t[i];if(typeof r=="number"&&Number.isInteger(r)&&r>=0){let o=[];o[r]=s,s=o}else s=new Map([[r,s]])}return ye(s,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}var de=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done,Vt=class extends at{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(n=>x(n)||I(n)?n.clone(e):n),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(de(e))this.add(t);else{let[n,...s]=e,i=this.get(n,!0);if(T(i))i.addIn(s,t);else if(i===void 0&&this.schema)this.set(n,Be(this.schema,s,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${s}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let s=this.get(t,!0);if(T(s))return s.deleteIn(n);throw new Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...s]=e,i=this.get(n,!0);return s.length===0?!t&&O(i)?i.value:i:T(i)?i.getIn(s,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!I(t))return!1;let n=t.value;return n==null||e&&O(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let s=this.get(t,!0);return T(s)?s.hasIn(n):!1}setIn(e,t){let[n,...s]=e;if(s.length===0)this.set(n,t);else{let i=this.get(n,!0);if(T(i))i.setIn(s,t);else if(i===void 0&&this.schema)this.set(n,Be(this.schema,s,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${s}`)}}},Dn=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function R(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var W=(e,t,n)=>e.endsWith(`
3
+ `)?R(n,t):n.includes(`
4
+ `)?`
5
+ `+R(n,t):(e.endsWith(" ")?"":" ")+n,Jt="flow",et="block",Ce="quoted";function De(e,t,n="flow",{indentAtStart:s,lineWidth:i=80,minContentWidth:r=20,onFold:o,onOverflow:l}={}){if(!i||i<0)return e;i<r&&(r=0);let a=Math.max(1+r,1+i-t.length);if(e.length<=a)return e;let c=[],p={},u=i-t.length;typeof s=="number"&&(s>i-Math.max(2,r)?c.push(0):u=i-s);let f,m,b=!1,h=-1,d=-1,g=-1;n===et&&(h=Et(e,h,t.length),h!==-1&&(u=h+a));for(let w;w=e[h+=1];){if(n===Ce&&w==="\\"){switch(d=h,e[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}g=h}if(w===`
6
+ `)n===et&&(h=Et(e,h,t.length)),u=h+t.length+a,f=void 0;else{if(w===" "&&m&&m!==" "&&m!==`
7
+ `&&m!==" "){let v=e[h+1];v&&v!==" "&&v!==`
8
+ `&&v!==" "&&(f=h)}if(h>=u)if(f)c.push(f),u=f+a,f=void 0;else if(n===Ce){for(;m===" "||m===" ";)m=w,w=e[h+=1],b=!0;let v=h>g+1?h-2:d-1;if(p[v])return e;c.push(v),p[v]=!0,u=v+a,f=void 0}else b=!0}m=w}if(b&&l&&l(),c.length===0)return e;o&&o();let y=e.slice(0,c[0]);for(let w=0;w<c.length;++w){let v=c[w],N=c[w+1]||e.length;v===0?y=`
9
+ ${t}${e.slice(0,N)}`:(n===Ce&&p[v]&&(y+=`${e[v]}\\`),y+=`
10
+ ${t}${e.slice(v+1,N)}`)}return y}function Et(e,t,n){let s=t,i=t+1,r=e[i];for(;r===" "||r===" ";)if(t<i+n)r=e[++t];else{do r=e[++t];while(r&&r!==`
11
+ `);s=t,i=t+1,r=e[i]}return s}var Pe=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),qe=e=>/^(%|---|\.\.\.)/m.test(e);function Pn(e,t,n){if(!t||t<0)return!1;let s=t-n,i=e.length;if(i<=s)return!1;for(let r=0,o=0;r<i;++r)if(e[r]===`
12
+ `){if(r-o>s)return!0;if(o=r+1,i-o<=s)return!1}return!0}function ge(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:s}=t,i=t.options.doubleQuotedMinMultiLineLength,r=t.indent||(qe(e)?" ":""),o="",l=0;for(let a=0,c=n[a];c;c=n[++a])if(c===" "&&n[a+1]==="\\"&&n[a+2]==="n"&&(o+=n.slice(l,a)+"\\ ",a+=1,l=a,c="\\"),c==="\\")switch(n[a+1]){case"u":{o+=n.slice(l,a);let p=n.substr(a+2,4);switch(p){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:p.substr(0,2)==="00"?o+="\\x"+p.substr(2):o+=n.substr(a,6)}a+=5,l=a+1}break;case"n":if(s||n[a+2]==='"'||n.length<i)a+=1;else{for(o+=n.slice(l,a)+`
13
+
14
+ `;n[a+2]==="\\"&&n[a+3]==="n"&&n[a+4]!=='"';)o+=`
15
+ `,a+=2;o+=r,n[a+2]===" "&&(o+="\\"),a+=1,l=a+1}break;default:a+=1}return o=l?o+n.slice(l):n,s?o:De(o,r,Ce,Pe(t,!1))}function tt(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
16
+ `)||/[ \t]\n|\n[ \t]/.test(e))return ge(e,t);let n=t.indent||(qe(e)?" ":""),s="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&
17
+ ${n}`)+"'";return t.implicitKey?s:De(s,n,Jt,Pe(t,!1))}function se(e,t){let{singleQuote:n}=t.options,s;if(n===!1)s=ge;else{let i=e.includes('"'),r=e.includes("'");i&&!r?s=tt:r&&!i?s=ge:s=n?tt:ge}return s(e,t)}var nt;try{nt=new RegExp(`(^|(?<!
18
+ ))
19
+ +(?!
20
+ |$)`,"g")}catch{nt=/\n+(?!\n|$)/g}function _e({comment:e,type:t,value:n},s,i,r){let{blockQuote:o,commentString:l,lineWidth:a}=s.options;if(!o||/\n[\t ]+$/.test(n))return se(n,s);let c=s.indent||(s.forceBlockIndent||qe(n)?" ":""),p=o==="literal"?!0:o==="folded"||t===S.BLOCK_FOLDED?!1:t===S.BLOCK_LITERAL?!0:!Pn(n,a,c.length);if(!n)return p?`|
21
+ `:`>
22
+ `;let u,f;for(f=n.length;f>0;--f){let v=n[f-1];if(v!==`
23
+ `&&v!==" "&&v!==" ")break}let m=n.substring(f),b=m.indexOf(`
24
+ `);b===-1?u="-":n===m||b!==m.length-1?(u="+",r&&r()):u="",m&&(n=n.slice(0,-m.length),m[m.length-1]===`
25
+ `&&(m=m.slice(0,-1)),m=m.replace(nt,`$&${c}`));let h=!1,d,g=-1;for(d=0;d<n.length;++d){let v=n[d];if(v===" ")h=!0;else if(v===`
26
+ `)g=d;else break}let y=n.substring(0,g<d?g+1:d);y&&(n=n.substring(y.length),y=y.replace(/\n+/g,`$&${c}`));let w=(h?c?"2":"1":"")+u;if(e&&(w+=" "+l(e.replace(/ ?[\r\n]+/g," ")),i&&i()),!p){let v=n.replace(/\n+/g,`
27
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`),N=!1,E=Pe(s,!0);o!=="folded"&&t!==S.BLOCK_FOLDED&&(E.onOverflow=()=>{N=!0});let A=De(`${y}${v}${m}`,c,et,E);if(!N)return`>${w}
28
+ ${c}${A}`}return n=n.replace(/\n+/g,`$&${c}`),`|${w}
29
+ ${c}${y}${n}${m}`}function qn(e,t,n,s){let{type:i,value:r}=e,{actualString:o,implicitKey:l,indent:a,indentStep:c,inFlow:p}=t;if(l&&r.includes(`
30
+ `)||p&&/[[\]{},]/.test(r))return se(r,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))return l||p||!r.includes(`
31
+ `)?se(r,t):_e(e,t,n,s);if(!l&&!p&&i!==S.PLAIN&&r.includes(`
32
+ `))return _e(e,t,n,s);if(qe(r)){if(a==="")return t.forceBlockIndent=!0,_e(e,t,n,s);if(l&&a===c)return se(r,t)}let u=r.replace(/\n+/g,`$&
33
+ ${a}`);if(o){let f=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(u),{compat:m,tags:b}=t.doc.schema;if(b.some(f)||m?.some(f))return se(r,t)}return l?u:De(u,a,Jt,Pe(t,!1))}function ut(e,t,n,s){let{implicitKey:i,inFlow:r}=t,o=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)}),{type:l}=e;l!==S.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(l=S.QUOTE_DOUBLE);let a=p=>{switch(p){case S.BLOCK_FOLDED:case S.BLOCK_LITERAL:return i||r?se(o.value,t):_e(o,t,n,s);case S.QUOTE_DOUBLE:return ge(o.value,t);case S.QUOTE_SINGLE:return tt(o.value,t);case S.PLAIN:return qn(o,t,n,s);default:return null}},c=a(l);if(c===null){let{defaultKeyType:p,defaultStringType:u}=t.options,f=i&&p||u;if(c=a(f),c===null)throw new Error(`Unsupported default string type ${f}`)}return c}function Yt(e,t){let n=Object.assign({blockQuote:!0,commentString:Dn,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,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},e.schema.toStringOptions,t),s;switch(n.collectionStyle){case"block":s=!1;break;case"flow":s=!0;break;default:s=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:s,options:n}}function Un(e,t){if(t.tag){let i=e.filter(r=>r.tag===t.tag);if(i.length>0)return i.find(r=>r.format===t.format)??i[0]}let n,s;if(O(t)){s=t.value;let i=e.filter(r=>r.identify?.(s));if(i.length>1){let r=i.filter(o=>o.test);r.length>0&&(i=r)}n=i.find(r=>r.format===t.format)??i.find(r=>!r.format)}else s=t,n=e.find(i=>i.nodeClass&&s instanceof i.nodeClass);if(!n){let i=s?.constructor?.name??(s===null?"null":typeof s);throw new Error(`Tag not resolved for ${i} value`)}return n}function Rn(e,t,{anchors:n,doc:s}){if(!s.directives)return"";let i=[],r=(O(e)||T(e))&&e.anchor;r&&qt(r)&&(n.add(r),i.push(`&${r}`));let o=e.tag??(t.default?null:t.tag);return o&&i.push(s.directives.tagString(o)),i.join(" ")}function re(e,t,n,s){if(I(e))return e.toString(t,n,s);if(Q(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw new TypeError("Cannot stringify circular structure without alias nodes");t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let i,r=x(e)?e:t.doc.createNode(e,{onTagObj:a=>i=a});i??(i=Un(t.doc.schema.tags,r));let o=Rn(r,i,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);let l=typeof i.stringify=="function"?i.stringify(r,t,n,s):O(r)?ut(r,t,n,s):r.toString(t,n,s);return o?O(r)||l[0]==="{"||l[0]==="["?`${o} ${l}`:`${o}
34
+ ${t.indent}${l}`:l}function Fn({key:e,value:t},n,s,i){let{allNullValues:r,doc:o,indent:l,indentStep:a,options:{commentString:c,indentSeq:p,simpleKeys:u}}=n,f=x(e)&&e.comment||null;if(u){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(T(e)||!x(e)&&typeof e=="object"){let A="With simple keys, collection cannot be used as a key value";throw new Error(A)}}let m=!u&&(!e||f&&t==null&&!n.inFlow||T(e)||(O(e)?e.type===S.BLOCK_FOLDED||e.type===S.BLOCK_LITERAL:typeof e=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!m&&(u||!r),indent:l+a});let b=!1,h=!1,d=re(e,n,()=>b=!0,()=>h=!0);if(!m&&!n.inFlow&&d.length>1024){if(u)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");m=!0}if(n.inFlow){if(r||t==null)return b&&s&&s(),d===""?"?":m?`? ${d}`:d}else if(r&&!u||t==null&&m)return d=`? ${d}`,f&&!b?d+=W(d,n.indent,c(f)):h&&i&&i(),d;b&&(f=null),m?(f&&(d+=W(d,n.indent,c(f))),d=`? ${d}
35
+ ${l}:`):(d=`${d}:`,f&&(d+=W(d,n.indent,c(f))));let g,y,w;x(t)?(g=!!t.spaceBefore,y=t.commentBefore,w=t.comment):(g=!1,y=null,w=null,t&&typeof t=="object"&&(t=o.createNode(t))),n.implicitKey=!1,!m&&!f&&O(t)&&(n.indentAtStart=d.length+1),h=!1,!p&&a.length>=2&&!n.inFlow&&!m&&ve(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let v=!1,N=re(t,n,()=>v=!0,()=>h=!0),E=" ";if(f||g||y){if(E=g?`
36
+ `:"",y){let A=c(y);E+=`
37
+ ${R(A,n.indent)}`}N===""&&!n.inFlow?E===`
38
+ `&&w&&(E=`
39
+
40
+ `):E+=`
41
+ ${n.indent}`}else if(!m&&T(t)){let A=N[0],k=N.indexOf(`
42
+ `),$=k!==-1,V=n.inFlow??t.flow??t.items.length===0;if($||!V){let X=!1;if($&&(A==="&"||A==="!")){let L=N.indexOf(" ");A==="&"&&L!==-1&&L<k&&N[L+1]==="!"&&(L=N.indexOf(" ",L+1)),(L===-1||k<L)&&(X=!0)}X||(E=`
43
+ ${n.indent}`)}}else(N===""||N[0]===`
44
+ `)&&(E="");return d+=E+N,n.inFlow?v&&s&&s():w&&!v?d+=W(d,n.indent,c(w)):h&&i&&i(),d}function Vn(e,t){(e==="debug"||e==="warn")&&console.warn(t)}var Ae="<<",F={identify:e=>e===Ae||typeof e=="symbol"&&e.description===Ae,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new S(Symbol(Ae)),{addToJSMap:Wt}),stringify:()=>Ae},Jn=(e,t)=>(F.identify(t)||O(t)&&(!t.type||t.type===S.PLAIN)&&F.identify(t.value))&&e?.doc.schema.tags.some(n=>n.tag===F.tag&&n.default);function Wt(e,t,n){if(n=e&&Q(n)?n.resolve(e.doc):n,ve(n))for(let s of n.items)We(e,t,s);else if(Array.isArray(n))for(let s of n)We(e,t,s);else We(e,t,n)}function We(e,t,n){let s=e&&Q(n)?n.resolve(e.doc):n;if(!ke(s))throw new Error("Merge sources must be maps or map aliases");let i=s.toJSON(null,e,Map);for(let[r,o]of i)t instanceof Map?t.has(r)||t.set(r,o):t instanceof Set?t.add(r):Object.prototype.hasOwnProperty.call(t,r)||Object.defineProperty(t,r,{value:o,writable:!0,enumerable:!0,configurable:!0});return t}function Gt(e,t,{key:n,value:s}){if(x(n)&&n.addToJSMap)n.addToJSMap(e,t,s);else if(Jn(e,n))Wt(e,t,s);else{let i=K(n,"",e);if(t instanceof Map)t.set(i,K(s,i,e));else if(t instanceof Set)t.add(i);else{let r=Yn(n,i,e),o=K(s,r,e);r in t?Object.defineProperty(t,r,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[r]=o}}return t}function Yn(e,t,n){if(t===null)return"";if(typeof t!="object")return String(t);if(x(e)&&n?.doc){let s=Yt(n.doc,{});s.anchors=new Set;for(let r of n.anchors.keys())s.anchors.add(r.anchor);s.inFlow=!0,s.inStringifyKey=!0;let i=e.toString(s);if(!n.mapKeyWarned){let r=JSON.stringify(i);r.length>40&&(r=r.substring(0,36)+'..."'),Vn(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${r}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return i}return JSON.stringify(t)}function ft(e,t,n){let s=ye(e,void 0,n),i=ye(t,void 0,n);return new _(s,i)}var _=class Ht{constructor(t,n=null){Object.defineProperty(this,B,{value:jt}),this.key=t,this.value=n}clone(t){let{key:n,value:s}=this;return x(n)&&(n=n.clone(t)),x(s)&&(s=s.clone(t)),new Ht(n,s)}toJSON(t,n){let s=n?.mapAsMap?new Map:{};return Gt(n,s,this)}toString(t,n,s){return t?.doc?Fn(this,t,n,s):JSON.stringify(this)}};function Qt(e,t,n){return(t.inFlow??e.flow?Gn:Wn)(e,t,n)}function Wn({comment:e,items:t},n,{blockItemPrefix:s,flowChars:i,itemIndent:r,onChompKeep:o,onComment:l}){let{indent:a,options:{commentString:c}}=n,p=Object.assign({},n,{indent:r,type:null}),u=!1,f=[];for(let b=0;b<t.length;++b){let h=t[b],d=null;if(x(h))!u&&h.spaceBefore&&f.push(""),Me(n,f,h.commentBefore,u),h.comment&&(d=h.comment);else if(I(h)){let y=x(h.key)?h.key:null;y&&(!u&&y.spaceBefore&&f.push(""),Me(n,f,y.commentBefore,u))}u=!1;let g=re(h,p,()=>d=null,()=>u=!0);d&&(g+=W(g,r,c(d))),u&&d&&(u=!1),f.push(s+g)}let m;if(f.length===0)m=i.start+i.end;else{m=f[0];for(let b=1;b<f.length;++b){let h=f[b];m+=h?`
45
+ ${a}${h}`:`
46
+ `}}return e?(m+=`
47
+ `+R(c(e),a),l&&l()):u&&o&&o(),m}function Gn({items:e},t,{flowChars:n,itemIndent:s}){let{indent:i,indentStep:r,flowCollectionPadding:o,options:{commentString:l}}=t;s+=r;let a=Object.assign({},t,{indent:s,inFlow:!0,type:null}),c=!1,p=0,u=[];for(let b=0;b<e.length;++b){let h=e[b],d=null;if(x(h))h.spaceBefore&&u.push(""),Me(t,u,h.commentBefore,!1),h.comment&&(d=h.comment);else if(I(h)){let y=x(h.key)?h.key:null;y&&(y.spaceBefore&&u.push(""),Me(t,u,y.commentBefore,!1),y.comment&&(c=!0));let w=x(h.value)?h.value:null;w?(w.comment&&(d=w.comment),w.commentBefore&&(c=!0)):h.value==null&&y?.comment&&(d=y.comment)}d&&(c=!0);let g=re(h,a,()=>d=null);c||(c=u.length>p||g.includes(`
48
+ `)),b<e.length-1?g+=",":t.options.trailingComma&&(t.options.lineWidth>0&&(c||(c=u.reduce((y,w)=>y+w.length+2,2)+(g.length+2)>t.options.lineWidth)),c&&(g+=",")),d&&(g+=W(g,s,l(d))),u.push(g),p=u.length}let{start:f,end:m}=n;if(u.length===0)return f+m;if(!c){let b=u.reduce((h,d)=>h+d.length+2,2);c=t.options.lineWidth>0&&b>t.options.lineWidth}if(c){let b=f;for(let h of u)b+=h?`
49
+ ${r}${i}${h}`:`
50
+ `;return`${b}
51
+ ${i}${m}`}else return`${f}${o}${u.join(" ")}${o}${m}`}function Me({indent:e,options:{commentString:t}},n,s,i){if(s&&i&&(s=s.replace(/^\n+/,"")),s){let r=R(t(s),e);n.push(r.trimStart())}}function G(e,t){let n=O(t)?t.value:t;for(let s of e)if(I(s)&&(s.key===t||s.key===n||O(s.key)&&s.key.value===n))return s}var j=class extends Vt{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Y,e),this.items=[]}static from(e,t,n){let{keepUndefined:s,replacer:i}=n,r=new this(e),o=(l,a)=>{if(typeof i=="function")a=i.call(t,l,a);else if(Array.isArray(i)&&!i.includes(l))return;(a!==void 0||s)&&r.items.push(ft(l,a,n))};if(t instanceof Map)for(let[l,a]of t)o(l,a);else if(t&&typeof t=="object")for(let l of Object.keys(t))o(l,t[l]);return typeof e.sortMapEntries=="function"&&r.items.sort(e.sortMapEntries),r}add(e,t){let n;I(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new _(e,e?.value):n=new _(e.key,e.value);let s=G(this.items,n.key),i=this.schema?.sortMapEntries;if(s){if(!t)throw new Error(`Key ${n.key} already set`);O(s.value)&&Ft(n.value)?s.value.value=n.value:s.value=n.value}else if(i){let r=this.items.findIndex(o=>i(n,o)<0);r===-1?this.items.push(n):this.items.splice(r,0,n)}else this.items.push(n)}delete(e){let t=G(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=G(this.items,e)?.value;return(!t&&O(n)?n.value:n)??void 0}has(e){return!!G(this.items,e)}set(e,t){this.add(new _(e,t),!0)}toJSON(e,t,n){let s=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(s);for(let i of this.items)Gt(t,s,i);return s}toString(e,t,n){if(!e)return JSON.stringify(this);for(let s of this.items)if(!I(s))throw new Error(`Map items must all be pairs; found ${JSON.stringify(s)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Qt(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:t})}},ue={collection:"map",default:!0,nodeClass:j,tag:"tag:yaml.org,2002:map",resolve(e,t){return ke(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,n)=>j.from(e,t,n)},H=class extends Vt{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(ae,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=Ie(e);return typeof t!="number"?!1:this.items.splice(t,1).length>0}get(e,t){let n=Ie(e);if(typeof n!="number")return;let s=this.items[n];return!t&&O(s)?s.value:s}has(e){let t=Ie(e);return typeof t=="number"&&t<this.items.length}set(e,t){let n=Ie(e);if(typeof n!="number")throw new Error(`Expected a valid index, not ${e}.`);let s=this.items[n];O(s)&&Ft(t)?s.value=t:this.items[n]=t}toJSON(e,t){let n=[];t?.onCreate&&t.onCreate(n);let s=0;for(let i of this.items)n.push(K(i,String(s++),t));return n}toString(e,t,n){return e?Qt(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){let{replacer:s}=n,i=new this(e);if(t&&Symbol.iterator in Object(t)){let r=0;for(let o of t){if(typeof s=="function"){let l=t instanceof Set?o:String(r++);o=s.call(t,l,o)}i.items.push(ye(o,void 0,n))}}return i}};function Ie(e){let t=O(e)?e.value:e;return t&&typeof t=="string"&&(t=Number(t)),typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}var fe={collection:"seq",default:!0,nodeClass:H,tag:"tag:yaml.org,2002:seq",resolve(e,t){return ve(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,n)=>H.from(e,t,n)},Ue={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,n,s){return t=Object.assign({actualString:!0},t),ut(e,t,n,s)}},Re={identify:e=>e==null,createNode:()=>new S(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new S(null),stringify:({source:e},t)=>typeof e=="string"&&Re.test.test(e)?e:t.options.nullStr},ht={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new S(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},n){if(e&&ht.test.test(e)){let s=e[0]==="t"||e[0]==="T";if(t===s)return e}return t?n.options.trueStr:n.options.falseStr}};function D({format:e,minFractionDigits:t,tag:n,value:s}){if(typeof s=="bigint")return String(s);let i=typeof s=="number"?s:Number(s);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let r=Object.is(s,-0)?"-0":JSON.stringify(s);if(!e&&t&&(!n||n==="tag:yaml.org,2002:float")&&/^\d/.test(r)){let o=r.indexOf(".");o<0&&(o=r.length,r+=".");let l=t-(r.length-o-1);for(;l-- >0;)r+="0"}return r}var Xt={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:D},zt={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():D(e)}},Zt={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let t=new S(parseFloat(e)),n=e.indexOf(".");return n!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-n-1),t},stringify:D},Fe=e=>typeof e=="bigint"||Number.isInteger(e),pt=(e,t,n,{intAsBigInt:s})=>s?BigInt(e):parseInt(e.substring(t),n);function en(e,t,n){let{value:s}=e;return Fe(s)&&s>=0?n+s.toString(t):D(e)}var tn={identify:e=>Fe(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,n)=>pt(e,2,8,n),stringify:e=>en(e,8,"0o")},nn={identify:Fe,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>pt(e,0,10,n),stringify:D},sn={identify:e=>Fe(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>pt(e,2,16,n),stringify:e=>en(e,16,"0x")},Hn=[ue,fe,Ue,Re,ht,tn,nn,sn,Xt,zt,Zt];function Nt(e){return typeof e=="bigint"||Number.isInteger(e)}var Te=({value:e})=>JSON.stringify(e),Qn=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:Te},{identify:e=>e==null,createNode:()=>new S(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Te},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:Te},{identify:Nt,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>Nt(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:Te}],Xn={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},zn=[ue,fe].concat(Qn,Xn),dt={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof atob=="function"){let n=atob(e.replace(/[\n\r]/g,"")),s=new Uint8Array(n.length);for(let i=0;i<n.length;++i)s[i]=n.charCodeAt(i);return s}else return t("This environment does not support reading binary tags; either Buffer or atob is required"),e},stringify({comment:e,type:t,value:n},s,i,r){if(!n)return"";let o=n,l;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(t??(t=S.BLOCK_LITERAL),t!==S.QUOTE_DOUBLE){let a=Math.max(s.options.lineWidth-s.indent.length,s.options.minContentWidth),c=Math.ceil(l.length/a),p=new Array(c);for(let u=0,f=0;u<c;++u,f+=a)p[u]=l.substr(f,a);l=p.join(t===S.BLOCK_LITERAL?`
52
+ `:" ")}return ut({comment:e,type:t,value:l},s,i,r)}};function rn(e,t){if(ve(e))for(let n=0;n<e.items.length;++n){let s=e.items[n];if(!I(s)){if(ke(s)){s.items.length>1&&t("Each pair must have its own sequence indicator");let i=s.items[0]||new _(new S(null));if(s.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${s.commentBefore}
53
+ ${i.key.commentBefore}`:s.commentBefore),s.comment){let r=i.value??i.key;r.comment=r.comment?`${s.comment}
54
+ ${r.comment}`:s.comment}s=i}e.items[n]=I(s)?s:new _(s)}}else t("Expected a sequence for this tag");return e}function on(e,t,n){let{replacer:s}=n,i=new H(e);i.tag="tag:yaml.org,2002:pairs";let r=0;if(t&&Symbol.iterator in Object(t))for(let o of t){typeof s=="function"&&(o=s.call(t,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){let 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(ft(l,a,n))}return i}var mt={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:rn,createNode:on},je=class ln extends H{constructor(){super(),this.add=j.prototype.add.bind(this),this.delete=j.prototype.delete.bind(this),this.get=j.prototype.get.bind(this),this.has=j.prototype.has.bind(this),this.set=j.prototype.set.bind(this),this.tag=ln.tag}toJSON(t,n){if(!n)return super.toJSON(t);let s=new Map;n?.onCreate&&n.onCreate(s);for(let i of this.items){let r,o;if(I(i)?(r=K(i.key,"",n),o=K(i.value,r,n)):r=K(i,"",n),s.has(r))throw new Error("Ordered maps must not include duplicate keys");s.set(r,o)}return s}static from(t,n,s){let i=on(t,n,s),r=new this;return r.items=i.items,r}};je.tag="tag:yaml.org,2002:omap";var gt={collection:"seq",identify:e=>e instanceof Map,nodeClass:je,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let n=rn(e,t),s=[];for(let{key:i}of n.items)O(i)&&(s.includes(i.value)?t(`Ordered maps must not include duplicate keys: ${i.value}`):s.push(i.value));return Object.assign(new je,n)},createNode:(e,t,n)=>je.from(e,t,n)};function an({value:e,source:t},n){return t&&(e?cn:un).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var cn={identify:e=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new S(!0),stringify:an},un={identify:e=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new S(!1),stringify:an},Zn={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:D},es={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():D(e)}},ts={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new S(parseFloat(e.replace(/_/g,""))),n=e.indexOf(".");if(n!==-1){let s=e.substring(n+1).replace(/_/g,"");s[s.length-1]==="0"&&(t.minFractionDigits=s.length)}return t},stringify:D},Se=e=>typeof e=="bigint"||Number.isInteger(e);function Ve(e,t,n,{intAsBigInt:s}){let i=e[0];if((i==="-"||i==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),s){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let o=BigInt(e);return i==="-"?BigInt(-1)*o:o}let r=parseInt(e,n);return i==="-"?-1*r:r}function yt(e,t,n){let{value:s}=e;if(Se(s)){let i=s.toString(t);return s<0?"-"+n+i.substr(1):n+i}return D(e)}var ns={identify:Se,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>Ve(e,2,2,n),stringify:e=>yt(e,2,"0b")},ss={identify:Se,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>Ve(e,1,8,n),stringify:e=>yt(e,8,"0")},is={identify:Se,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>Ve(e,0,10,n),stringify:D},rs={identify:Se,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>Ve(e,2,16,n),stringify:e=>yt(e,16,"0x")},Ke=class fn extends j{constructor(t){super(t),this.tag=fn.tag}add(t){let n;I(t)?n=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?n=new _(t.key,null):n=new _(t,null),G(this.items,n.key)||this.items.push(n)}get(t,n){let s=G(this.items,t);return!n&&I(s)?O(s.key)?s.key.value:s.key:s}set(t,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);let s=G(this.items,t);s&&!n?this.items.splice(this.items.indexOf(s),1):!s&&n&&this.items.push(new _(t))}toJSON(t,n){return super.toJSON(t,n,Set)}toString(t,n,s){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),n,s);throw new Error("Set items must all have null values")}static from(t,n,s){let{replacer:i}=s,r=new this(t);if(n&&Symbol.iterator in Object(n))for(let o of n)typeof i=="function"&&(o=i.call(n,o,o)),r.items.push(ft(o,null,s));return r}};Ke.tag="tag:yaml.org,2002:set";var bt={collection:"map",identify:e=>e instanceof Set,nodeClass:Ke,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>Ke.from(e,t,n),resolve(e,t){if(ke(e)){if(e.hasAllNullValues(!0))return Object.assign(new Ke,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};function wt(e,t){let n=e[0],s=n==="-"||n==="+"?e.substring(1):e,i=o=>t?BigInt(o):Number(o),r=s.replace(/_/g,"").split(":").reduce((o,l)=>o*i(60)+i(l),i(0));return n==="-"?i(-1)*r:r}function hn(e){let{value:t}=e,n=o=>o;if(typeof t=="bigint")n=o=>BigInt(o);else if(isNaN(t)||!isFinite(t))return D(e);let s="";t<0&&(s="-",t*=n(-1));let i=n(60),r=[t%i];return t<60?r.unshift(0):(t=(t-r[0])/i,r.unshift(t%i),t>=60&&(t=(t-r[0])/i,r.unshift(t))),s+r.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var pn={identify:e=>typeof e=="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>wt(e,n),stringify:hn},dn={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>wt(e,!1),stringify:hn},Je={identify:e=>e instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(e){let t=e.match(Je.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,s,i,r,o,l]=t.map(Number),a=t[7]?Number((t[7]+"00").substr(1,3)):0,c=Date.UTC(n,s-1,i,r||0,o||0,l||0,a),p=t[8];if(p&&p!=="Z"){let u=wt(p,!1);Math.abs(u)<30&&(u*=60),c-=6e4*u}return new Date(c)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""},Ot=[ue,fe,Ue,Re,cn,un,ns,ss,is,rs,Zn,es,ts,dt,F,gt,mt,bt,pn,dn,Je],At=new Map([["core",Hn],["failsafe",[ue,fe,Ue]],["json",zn],["yaml11",Ot],["yaml-1.1",Ot]]),It={binary:dt,bool:ht,float:Zt,floatExp:zt,floatNaN:Xt,floatTime:dn,int:nn,intHex:sn,intOct:tn,intTime:pn,map:ue,merge:F,null:Re,omap:gt,pairs:mt,seq:fe,set:bt,timestamp:Je},os={"tag:yaml.org,2002:binary":dt,"tag:yaml.org,2002:merge":F,"tag:yaml.org,2002:omap":gt,"tag:yaml.org,2002:pairs":mt,"tag:yaml.org,2002:set":bt,"tag:yaml.org,2002:timestamp":Je};function Ge(e,t,n){let s=At.get(t);if(s&&!e)return n&&!s.includes(F)?s.concat(F):s.slice();let i=s;if(!i)if(Array.isArray(e))i=[];else{let r=Array.from(At.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${r} or define customTags array`)}if(Array.isArray(e))for(let r of e)i=i.concat(r);else typeof e=="function"&&(i=e(i.slice()));return n&&(i=i.concat(F)),i.reduce((r,o)=>{let l=typeof o=="string"?It[o]:o;if(!l){let a=JSON.stringify(o),c=Object.keys(It).map(p=>JSON.stringify(p)).join(", ");throw new Error(`Unknown custom tag ${a}; use one of ${c}`)}return r.includes(l)||r.push(l),r},[])}var ls=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0,as=class mn{constructor({compat:t,customTags:n,merge:s,resolveKnownTags:i,schema:r,sortMapEntries:o,toStringDefaults:l}){this.compat=Array.isArray(t)?Ge(t,"compat"):t?Ge(null,t):null,this.name=typeof r=="string"&&r||"core",this.knownTags=i?os:{},this.tags=Ge(n,this.name,s),this.toStringOptions=l??null,Object.defineProperty(this,Y,{value:ue}),Object.defineProperty(this,q,{value:Ue}),Object.defineProperty(this,ae,{value:fe}),this.sortMapEntries=typeof o=="function"?o:o===!0?ls:null}clone(){let t=Object.create(mn.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};function cs(e,t){let n=[],s=t.directives===!0;if(t.directives!==!1&&e.directives){let a=e.directives.toString(e);a?(n.push(a),s=!0):e.directives.docStart&&(s=!0)}s&&n.push("---");let i=Yt(e,t),{commentString:r}=i.options;if(e.commentBefore){n.length!==1&&n.unshift("");let a=r(e.commentBefore);n.unshift(R(a,""))}let o=!1,l=null;if(e.contents){if(x(e.contents)){if(e.contents.spaceBefore&&s&&n.push(""),e.contents.commentBefore){let p=r(e.contents.commentBefore);n.push(R(p,""))}i.forceBlockIndent=!!e.comment,l=e.contents.comment}let a=l?void 0:()=>o=!0,c=re(e.contents,i,()=>l=null,a);l&&(c+=W(c,"",r(l))),(c[0]==="|"||c[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${c}`:n.push(c)}else n.push(re(e.contents,i));if(e.directives?.docEnd)if(e.comment){let a=r(e.comment);a.includes(`
55
+ `)?(n.push("..."),n.push(R(a,""))):n.push(`... ${a}`)}else n.push("...");else{let a=e.comment;a&&o&&(a=a.replace(/^\n+/,"")),a&&((!o||l)&&n[n.length-1]!==""&&n.push(""),n.push(R(r(a),"")))}return n.join(`
56
+ `)+`
57
+ `}var gn=class yn{constructor(t,n,s){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,B,{value:Ze});let i=null;typeof n=="function"||Array.isArray(n)?i=n:s===void 0&&n&&(s=n,n=void 0);let 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?._directives?(this.directives=s._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new ie({version:o}),this.setSchema(o,s),this.contents=t===void 0?null:this.createNode(t,i,s)}clone(){let t=Object.create(yn.prototype,{[B]:{value:Ze}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=x(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){z(this.contents)&&this.contents.add(t)}addIn(t,n){z(this.contents)&&this.contents.addIn(t,n)}createAlias(t,n){if(!t.anchor){let s=Ut(this);t.anchor=!n||s.has(n)?Rt(n||"a",s):n}return new ct(t.anchor)}createNode(t,n,s){let i;if(typeof n=="function")t=n.call({"":t},"",t),i=n;else if(Array.isArray(n)){let d=y=>typeof y=="number"||y instanceof String||y instanceof Number,g=n.filter(d).map(String);g.length>0&&(n=n.concat(g)),i=n}else s===void 0&&n&&(s=n,n=void 0);let{aliasDuplicateObjects:r,anchorPrefix:o,flow:l,keepUndefined:a,onTagObj:c,tag:p}=s??{},{onAnchor:u,setAnchors:f,sourceObjects:m}=Kn(this,o||"a"),b={aliasDuplicateObjects:r??!0,keepUndefined:a??!1,onAnchor:u,onTagObj:c,replacer:i,schema:this.schema,sourceObjects:m},h=ye(t,p,b);return l&&T(h)&&(h.flow=!0),f(),h}createPair(t,n,s={}){let i=this.createNode(t,null,s),r=this.createNode(n,null,s);return new _(i,r)}delete(t){return z(this.contents)?this.contents.delete(t):!1}deleteIn(t){return de(t)?this.contents==null?!1:(this.contents=null,!0):z(this.contents)?this.contents.deleteIn(t):!1}get(t,n){return T(this.contents)?this.contents.get(t,n):void 0}getIn(t,n){return de(t)?!n&&O(this.contents)?this.contents.value:this.contents:T(this.contents)?this.contents.getIn(t,n):void 0}has(t){return T(this.contents)?this.contents.has(t):!1}hasIn(t){return de(t)?this.contents!==void 0:T(this.contents)?this.contents.hasIn(t):!1}set(t,n){this.contents==null?this.contents=Be(this.schema,[t],n):z(this.contents)&&this.contents.set(t,n)}setIn(t,n){de(t)?this.contents=n:this.contents==null?this.contents=Be(this.schema,Array.from(t),n):z(this.contents)&&this.contents.setIn(t,n)}setSchema(t,n={}){typeof t=="number"&&(t=String(t));let s;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new ie({version:"1.1"}),s={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new ie({version:t}),s={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,s=null;break;default:{let i=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(s)this.schema=new as(Object.assign(s,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:n,mapAsMap:s,maxAliasCount:i,onAnchor:r,reviver:o}={}){let l={anchors:new Map,doc:this,keep:!t,mapAsMap:s===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},a=K(this.contents,n??"",l);if(typeof r=="function")for(let{count:c,res:p}of l.anchors.values())r(p,c);return typeof o=="function"?ne(o,{"":a},"",a):a}toJSON(t,n){return this.toJS({json:!0,jsonArg:t,mapAsMap:!1,onAnchor:n})}toString(t={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in t&&(!Number.isInteger(t.indent)||Number(t.indent)<=0)){let n=JSON.stringify(t.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return cs(this,t)}};function z(e){if(T(e))return!0;throw new Error("Expected a YAML collection as document contents")}var bn=class extends Error{constructor(e,t,n,s){super(),this.name=e,this.code=n,this.message=s,this.pos=t}},me=class extends bn{constructor(e,t,n){super("YAMLParseError",e,t,n)}},us=class extends bn{constructor(e,t,n){super("YAMLWarning",e,t,n)}},Tt=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(l=>t.linePos(l));let{line:s,col:i}=n.linePos[0];n.message+=` at line ${s}, column ${i}`;let r=i-1,o=e.substring(t.lineStarts[s-1],t.lineStarts[s]).replace(/[\n\r]+$/,"");if(r>=60&&o.length>80){let l=Math.min(r-39,o.length-79);o="\u2026"+o.substring(l),r-=l-1}if(o.length>80&&(o=o.substring(0,79)+"\u2026"),s>1&&/^ *$/.test(o.substring(0,r))){let l=e.substring(t.lineStarts[s-2],t.lineStarts[s-1]);l.length>80&&(l=l.substring(0,79)+`\u2026
58
+ `),o=l+o}if(/[^ ]/.test(o)){let l=1,a=n.linePos[1];a?.line===s&&a.col>i&&(l=Math.max(1,Math.min(a.col-i,80-r)));let c=" ".repeat(r)+"^".repeat(l);n.message+=`:
59
+
60
+ ${o}
61
+ ${c}
62
+ `}};function oe(e,{flow:t,indicator:n,next:s,offset:i,onError:r,parentIndent:o,startOnNewline:l}){let a=!1,c=l,p=l,u="",f="",m=!1,b=!1,h=null,d=null,g=null,y=null,w=null,v=null,N=null;for(let k of e)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),h&&(c&&k.type!=="comment"&&k.type!=="newline"&&r(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),k.type){case"space":!t&&(n!=="doc-start"||s?.type!=="flow-collection")&&k.source.includes(" ")&&(h=k),p=!0;break;case"comment":{p||r(k,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let $=k.source.substring(1)||" ";u?u+=f+$:u=$,f="",c=!1;break}case"newline":c?u?u+=k.source:(!v||n!=="seq-item-ind")&&(a=!0):f+=k.source,c=!0,m=!0,(d||g)&&(y=k),p=!0;break;case"anchor":d&&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),d=k,N??(N=k.offset),c=!1,p=!1,b=!0;break;case"tag":{g&&r(k,"MULTIPLE_TAGS","A node can have at most one tag"),g=k,N??(N=k.offset),c=!1,p=!1,b=!0;break}case n:(d||g)&&r(k,"BAD_PROP_ORDER",`Anchors and tags must be after the ${k.source} indicator`),v&&r(k,"UNEXPECTED_TOKEN",`Unexpected ${k.source} in ${t??"collection"}`),v=k,c=n==="seq-item-ind"||n==="explicit-key-ind",p=!1;break;case"comma":if(t){w&&r(k,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),w=k,c=!1,p=!1;break}default:r(k,"UNEXPECTED_TOKEN",`Unexpected ${k.type} token`),c=!1,p=!1}let E=e[e.length-1],A=E?E.offset+E.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"),h&&(c&&h.indent<=o||s?.type==="block-map"||s?.type==="block-seq")&&r(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:w,found:v,spaceBefore:a,comment:u,hasNewline:m,anchor:d,tag:g,newlineAfterProp:y,end:A,start:N??A}}function be(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes(`
63
+ `))return!0;if(e.end){for(let t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(let t of e.items){for(let n of t.start)if(n.type==="newline")return!0;if(t.sep){for(let n of t.sep)if(n.type==="newline")return!0}if(be(t.key)||be(t.value))return!0}return!1;default:return!0}}function st(e,t,n){if(t?.type==="flow-collection"){let s=t.end[0];s.indent===e&&(s.source==="]"||s.source==="}")&&be(t)&&n(s,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function wn(e,t,n){let{uniqueKeys:s}=e.options;if(s===!1)return!1;let i=typeof s=="function"?s:(r,o)=>r===o||O(r)&&O(o)&&r.value===o.value;return t.some(r=>i(r.key,n))}var xt="All mapping items must start at the same column";function fs({composeNode:e,composeEmptyNode:t},n,s,i,r){let o=r?.nodeClass??j,l=new o(n.schema);n.atRoot&&(n.atRoot=!1);let a=s.offset,c=null;for(let p of s.items){let{start:u,key:f,sep:m,value:b}=p,h=oe(u,{indicator:"explicit-key-ind",next:f??m?.[0],offset:a,onError:i,parentIndent:s.indent,startOnNewline:!0}),d=!h.found;if(d){if(f&&(f.type==="block-seq"?i(a,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in f&&f.indent!==s.indent&&i(a,"BAD_INDENT",xt)),!h.anchor&&!h.tag&&!m){c=h.end,h.comment&&(l.comment?l.comment+=`
64
+ `+h.comment:l.comment=h.comment);continue}(h.newlineAfterProp||be(f))&&i(f??u[u.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==s.indent&&i(a,"BAD_INDENT",xt);n.atKey=!0;let g=h.end,y=f?e(n,f,h,i):t(n,g,u,null,h,i);n.schema.compat&&st(s.indent,f,i),n.atKey=!1,wn(n,l.items,y)&&i(g,"DUPLICATE_KEY","Map keys must be unique");let w=oe(m??[],{indicator:"map-value-ind",next:b,offset:y.range[2],onError:i,parentIndent:s.indent,startOnNewline:!f||f.type==="block-scalar"});if(a=w.end,w.found){d&&(b?.type==="block-map"&&!w.hasNewline&&i(a,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&h.start<w.found.offset-1024&&i(y.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let v=b?e(n,b,w,i):t(n,a,m,null,w,i);n.schema.compat&&st(s.indent,b,i),a=v.range[2];let N=new _(y,v);n.options.keepSourceTokens&&(N.srcToken=p),l.items.push(N)}else{d&&i(y.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),w.comment&&(y.comment?y.comment+=`
65
+ `+w.comment:y.comment=w.comment);let v=new _(y);n.options.keepSourceTokens&&(v.srcToken=p),l.items.push(v)}}return c&&c<a&&i(c,"IMPOSSIBLE","Map comment with trailing content"),l.range=[s.offset,a,c??a],l}function hs({composeNode:e,composeEmptyNode:t},n,s,i,r){let o=r?.nodeClass??H,l=new o(n.schema);n.atRoot&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let a=s.offset,c=null;for(let{start:p,value:u}of s.items){let f=oe(p,{indicator:"seq-item-ind",next:u,offset:a,onError:i,parentIndent:s.indent,startOnNewline:!0});if(!f.found)if(f.anchor||f.tag||u)u?.type==="block-seq"?i(f.end,"BAD_INDENT","All sequence items must start at the same column"):i(a,"MISSING_CHAR","Sequence item without - indicator");else{c=f.end,f.comment&&(l.comment=f.comment);continue}let m=u?e(n,u,f,i):t(n,f.end,p,null,f,i);n.schema.compat&&st(s.indent,u,i),a=m.range[2],l.items.push(m)}return l.range=[s.offset,a,c??a],l}function Ee(e,t,n,s){let i="";if(e){let r=!1,o="";for(let l of e){let{source:a,type:c}=l;switch(c){case"space":r=!0;break;case"comment":{n&&!r&&s(l,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let p=a.substring(1)||" ";i?i+=o+p:i=p,o="";break}case"newline":i&&(o+=a),r=!0;break;default:s(l,"UNEXPECTED_TOKEN",`Unexpected ${c} at node end`)}t+=a.length}}return{comment:i,offset:t}}var He="Block collections are not allowed within flow collections",Qe=e=>e&&(e.type==="block-map"||e.type==="block-seq");function ps({composeNode:e,composeEmptyNode:t},n,s,i,r){let o=s.start.source==="{",l=o?"flow map":"flow sequence",a=r?.nodeClass??(o?j:H),c=new a(n.schema);c.flow=!0;let p=n.atRoot;p&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let u=s.offset+s.start.source.length;for(let d=0;d<s.items.length;++d){let g=s.items[d],{start:y,key:w,sep:v,value:N}=g,E=oe(y,{flow:l,indicator:"explicit-key-ind",next:w??v?.[0],offset:u,onError:i,parentIndent:s.indent,startOnNewline:!1});if(!E.found){if(!E.anchor&&!E.tag&&!v&&!N){d===0&&E.comma?i(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${l}`):d<s.items.length-1&&i(E.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${l}`),E.comment&&(c.comment?c.comment+=`
66
+ `+E.comment:c.comment=E.comment),u=E.end;continue}!o&&n.options.strict&&be(w)&&i(w,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(d===0)E.comma&&i(E.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${l}`);else if(E.comma||i(E.start,"MISSING_CHAR",`Missing , between ${l} items`),E.comment){let A="";e:for(let k of y)switch(k.type){case"comma":case"space":break;case"comment":A=k.source.substring(1);break e;default:break e}if(A){let k=c.items[c.items.length-1];I(k)&&(k=k.value??k.key),k.comment?k.comment+=`
67
+ `+A:k.comment=A,E.comment=E.comment.substring(A.length+1)}}if(!o&&!v&&!E.found){let A=N?e(n,N,E,i):t(n,E.end,v,null,E,i);c.items.push(A),u=A.range[2],Qe(N)&&i(A.range,"BLOCK_IN_FLOW",He)}else{n.atKey=!0;let A=E.end,k=w?e(n,w,E,i):t(n,A,y,null,E,i);Qe(w)&&i(k.range,"BLOCK_IN_FLOW",He),n.atKey=!1;let $=oe(v??[],{flow:l,indicator:"map-value-ind",next:N,offset:k.range[2],onError:i,parentIndent:s.indent,startOnNewline:!1});if($.found){if(!o&&!E.found&&n.options.strict){if(v)for(let L of v){if(L===$.found)break;if(L.type==="newline"){i(L,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}E.start<$.found.offset-1024&&i($.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else N&&("source"in N&&N.source?.[0]===":"?i(N,"MISSING_CHAR",`Missing space after : in ${l}`):i($.start,"MISSING_CHAR",`Missing , or : between ${l} items`));let V=N?e(n,N,$,i):$.found?t(n,$.end,v,null,$,i):null;V?Qe(N)&&i(V.range,"BLOCK_IN_FLOW",He):$.comment&&(k.comment?k.comment+=`
68
+ `+$.comment:k.comment=$.comment);let X=new _(k,V);if(n.options.keepSourceTokens&&(X.srcToken=g),o){let L=c;wn(n,L.items,k)&&i(A,"DUPLICATE_KEY","Map keys must be unique"),L.items.push(X)}else{let L=new j(n.schema);L.flow=!0,L.items.push(X);let St=(V??k).range;L.range=[k.range[0],St[1],St[2]],c.items.push(L)}u=V?V.range[2]:$.end}}let f=o?"}":"]",[m,...b]=s.end,h=u;if(m?.source===f)h=m.offset+m.source.length;else{let d=l[0].toUpperCase()+l.substring(1),g=p?`${d} must end with a ${f}`:`${d} in block collection must be sufficiently indented and end with a ${f}`;i(u,p?"MISSING_CHAR":"BAD_INDENT",g),m&&m.source.length!==1&&b.unshift(m)}if(b.length>0){let d=Ee(b,h,n.options.strict,i);d.comment&&(c.comment?c.comment+=`
69
+ `+d.comment:c.comment=d.comment),c.range=[s.offset,h,d.offset]}else c.range=[s.offset,h,h];return c}function Xe(e,t,n,s,i,r){let o=n.type==="block-map"?fs(e,t,n,s,r):n.type==="block-seq"?hs(e,t,n,s,r):ps(e,t,n,s,r),l=o.constructor;return i==="!"||i===l.tagName?(o.tag=l.tagName,o):(i&&(o.tag=i),o)}function ds(e,t,n,s,i){let r=s.tag,o=r?t.directives.tagName(r.source,f=>i(r,"TAG_RESOLVE_FAILED",f)):null;if(n.type==="block-seq"){let{anchor:f,newlineAfterProp:m}=s,b=f&&r?f.offset>r.offset?f:r:f??r;b&&(!m||m.offset<b.offset)&&i(b,"MISSING_CHAR","Missing newline after block sequence props")}let l=n.type==="block-map"?"map":n.type==="block-seq"?"seq":n.start.source==="{"?"map":"seq";if(!r||!o||o==="!"||o===j.tagName&&l==="map"||o===H.tagName&&l==="seq")return Xe(e,t,n,i,o);let a=t.schema.tags.find(f=>f.tag===o&&f.collection===l);if(!a){let f=t.schema.knownTags[o];if(f?.collection===l)t.schema.tags.push(Object.assign({},f,{default:!1})),a=f;else return f?i(r,"BAD_COLLECTION_TYPE",`${f.tag} used for ${l} collection, but expects ${f.collection??"scalar"}`,!0):i(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),Xe(e,t,n,i,o)}let c=Xe(e,t,n,i,o,a),p=a.resolve?.(c,f=>i(r,"TAG_RESOLVE_FAILED",f),t.options)??c,u=x(p)?p:new S(p);return u.range=c.range,u.tag=o,a?.format&&(u.format=a.format),u}function ms(e,t,n){let s=t.offset,i=gs(t,e.options.strict,n);if(!i)return{value:"",type:null,comment:"",range:[s,s,s]};let r=i.mode===">"?S.BLOCK_FOLDED:S.BLOCK_LITERAL,o=t.source?ys(t.source):[],l=o.length;for(let h=o.length-1;h>=0;--h){let d=o[h][1];if(d===""||d==="\r")l=h;else break}if(l===0){let h=i.chomp==="+"&&o.length>0?`
70
+ `.repeat(Math.max(1,o.length-1)):"",d=s+i.length;return t.source&&(d+=t.source.length),{value:h,type:r,comment:i.comment,range:[s,d,d]}}let a=t.indent+i.indent,c=t.offset+i.length,p=0;for(let h=0;h<l;++h){let[d,g]=o[h];if(g===""||g==="\r")i.indent===0&&d.length>a&&(a=d.length);else{d.length<a&&n(c+d.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),i.indent===0&&(a=d.length),p=h,a===0&&!e.atRoot&&n(c,"BAD_INDENT","Block scalar values in collections must be indented");break}c+=d.length+g.length+1}for(let h=o.length-1;h>=l;--h)o[h][0].length>a&&(l=h+1);let u="",f="",m=!1;for(let h=0;h<p;++h)u+=o[h][0].slice(a)+`
71
+ `;for(let h=p;h<l;++h){let[d,g]=o[h];c+=d.length+g.length+1;let y=g[g.length-1]==="\r";if(y&&(g=g.slice(0,-1)),g&&d.length<a){let w=`Block scalar lines must not be less indented than their ${i.indent?"explicit indentation indicator":"first line"}`;n(c-g.length-(y?2:1),"BAD_INDENT",w),d=""}r===S.BLOCK_LITERAL?(u+=f+d.slice(a)+g,f=`
72
+ `):d.length>a||g[0]===" "?(f===" "?f=`
73
+ `:!m&&f===`
74
+ `&&(f=`
75
+
76
+ `),u+=f+d.slice(a)+g,f=`
77
+ `,m=!0):g===""?f===`
78
+ `?u+=`
79
+ `:f=`
80
+ `:(u+=f+g,f=" ",m=!1)}switch(i.chomp){case"-":break;case"+":for(let h=l;h<o.length;++h)u+=`
81
+ `+o[h][0].slice(a);u[u.length-1]!==`
82
+ `&&(u+=`
83
+ `);break;default:u+=`
84
+ `}let b=s+i.length+t.source.length;return{value:u,type:r,comment:i.comment,range:[s,b,b]}}function gs({offset:e,props:t},n,s){if(t[0].type!=="block-scalar-header")return s(t[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:i}=t[0],r=i[0],o=0,l="",a=-1;for(let f=1;f<i.length;++f){let m=i[f];if(!l&&(m==="-"||m==="+"))l=m;else{let b=Number(m);!o&&b?o=b:a===-1&&(a=e+f)}}a!==-1&&s(a,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let c=!1,p="",u=i.length;for(let f=1;f<t.length;++f){let m=t[f];switch(m.type){case"space":c=!0;case"newline":u+=m.source.length;break;case"comment":n&&!c&&s(m,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),u+=m.source.length,p=m.source.substring(1);break;case"error":s(m,"UNEXPECTED_TOKEN",m.message),u+=m.source.length;break;default:{let b=`Unexpected token in block scalar header: ${m.type}`;s(m,"UNEXPECTED_TOKEN",b);let h=m.source;h&&typeof h=="string"&&(u+=h.length)}}}return{mode:r,indent:o,chomp:l,comment:p,length:u}}function ys(e){let t=e.split(/\n( *)/),n=t[0],s=n.match(/^( *)/),i=[s?.[1]?[s[1],n.slice(s[1].length)]:["",n]];for(let r=1;r<t.length;r+=2)i.push([t[r],t[r+1]]);return i}function bs(e,t,n){let{offset:s,type:i,source:r,end:o}=e,l,a,c=(f,m,b)=>n(s+f,m,b);switch(i){case"scalar":l=S.PLAIN,a=ws(r,c);break;case"single-quoted-scalar":l=S.QUOTE_SINGLE,a=ks(r,c);break;case"double-quoted-scalar":l=S.QUOTE_DOUBLE,a=vs(r,c);break;default:return n(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[s,s+r.length,s+r.length]}}let p=s+r.length,u=Ee(o,p,t,n);return{value:a,type:l,comment:u.comment,range:[s,p,u.offset]}}function ws(e,t){let n="";switch(e[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${e[0]}`;break}case"@":case"`":{n=`reserved character ${e[0]}`;break}}return n&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),kn(e)}function ks(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),kn(e.slice(1,-1)).replace(/''/g,"'")}function kn(e){let t,n;try{t=new RegExp(`(.*?)(?<![ ])[ ]*\r?
85
+ `,"sy"),n=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
86
+ `,"sy")}catch{t=/(.*?)[ \t]*\r?\n/sy,n=/[ \t]*(.*?)[ \t]*\r?\n/sy}let s=t.exec(e);if(!s)return e;let i=s[1],r=" ",o=t.lastIndex;for(n.lastIndex=o;s=n.exec(e);)s[1]===""?r===`
87
+ `?i+=r:r=`
88
+ `:(i+=r+s[1],r=" "),o=n.lastIndex;let l=/[ \t]*(.*)/sy;return l.lastIndex=o,s=l.exec(e),i+r+(s?.[1]??"")}function vs(e,t){let n="";for(let s=1;s<e.length-1;++s){let i=e[s];if(!(i==="\r"&&e[s+1]===`
89
+ `))if(i===`
90
+ `){let{fold:r,offset:o}=Ss(e,s);n+=r,s=o}else if(i==="\\"){let r=e[++s],o=Es[r];if(o)n+=o;else if(r===`
91
+ `)for(r=e[s+1];r===" "||r===" ";)r=e[++s+1];else if(r==="\r"&&e[s+1]===`
92
+ `)for(r=e[++s+1];r===" "||r===" ";)r=e[++s+1];else if(r==="x"||r==="u"||r==="U"){let l={x:2,u:4,U:8}[r];n+=Ns(e,s+1,l,t),s+=l}else{let l=e.substr(s-1,2);t(s-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${l}`),n+=l}}else if(i===" "||i===" "){let r=s,o=e[s+1];for(;o===" "||o===" ";)o=e[++s+1];o!==`
93
+ `&&!(o==="\r"&&e[s+2]===`
94
+ `)&&(n+=s>r?e.slice(r,s+1):i)}else n+=i}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),n}function Ss(e,t){let n="",s=e[t+1];for(;(s===" "||s===" "||s===`
95
+ `||s==="\r")&&!(s==="\r"&&e[t+2]!==`
96
+ `);)s===`
97
+ `&&(n+=`
98
+ `),t+=1,s=e[t+1];return n||(n=" "),{fold:n,offset:t}}var Es={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
99
+ `,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Ns(e,t,n,s){let i=e.substr(t,n),r=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;if(isNaN(r)){let o=e.substr(t-2,n+2);return s(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${o}`),o}return String.fromCodePoint(r)}function vn(e,t,n,s){let{value:i,type:r,comment:o,range:l}=t.type==="block-scalar"?ms(e,t,s):bs(t,e.options.strict,s),a=n?e.directives.tagName(n.source,u=>s(n,"TAG_RESOLVE_FAILED",u)):null,c;e.options.stringKeys&&e.atKey?c=e.schema[q]:a?c=Os(e.schema,i,a,n,s):t.type==="scalar"?c=As(e,i,t,s):c=e.schema[q];let p;try{let u=c.resolve(i,f=>s(n??t,"TAG_RESOLVE_FAILED",f),e.options);p=O(u)?u:new S(u)}catch(u){let f=u instanceof Error?u.message:String(u);s(n??t,"TAG_RESOLVE_FAILED",f),p=new S(i)}return p.range=l,p.source=i,r&&(p.type=r),a&&(p.tag=a),c.format&&(p.format=c.format),o&&(p.comment=o),p}function Os(e,t,n,s,i){if(n==="!")return e[q];let r=[];for(let l of e.tags)if(!l.collection&&l.tag===n)if(l.default&&l.test)r.push(l);else return l;for(let l of r)if(l.test?.test(t))return l;let o=e.knownTags[n];return o&&!o.collection?(e.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(i(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),e[q])}function As({atKey:e,directives:t,schema:n},s,i,r){let o=n.tags.find(l=>(l.default===!0||e&&l.default==="key")&&l.test?.test(s))||n[q];if(n.compat){let l=n.compat.find(a=>a.default&&a.test?.test(s))??n[q];if(o.tag!==l.tag){let a=t.tagString(o.tag),c=t.tagString(l.tag),p=`Value may be parsed as either ${a} or ${c}`;r(i,"TAG_RESOLVE_FAILED",p,!0)}}return o}function Is(e,t,n){if(t){n??(n=t.length);for(let s=n-1;s>=0;--s){let i=t[s];switch(i.type){case"space":case"comment":case"newline":e-=i.source.length;continue}for(i=t[++s];i?.type==="space";)e+=i.source.length,i=t[++s];break}}return e}var Ts={composeNode:Sn,composeEmptyNode:kt};function Sn(e,t,n,s){let i=e.atKey,{spaceBefore:r,comment:o,anchor:l,tag:a}=n,c,p=!0;switch(t.type){case"alias":c=xs(e,t,s),(l||a)&&s(t,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":c=vn(e,t,a,s),l&&(c.anchor=l.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{c=ds(Ts,e,t,n,s),l&&(c.anchor=l.source.substring(1))}catch(u){let f=u instanceof Error?u.message:String(u);s(t,"RESOURCE_EXHAUSTION",f)}break;default:{let u=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;s(t,"UNEXPECTED_TOKEN",u),p=!1}}return c??(c=kt(e,t.offset,void 0,null,n,s)),l&&c.anchor===""&&s(l,"BAD_ALIAS","Anchor cannot be an empty string"),i&&e.options.stringKeys&&(!O(c)||typeof c.value!="string"||c.tag&&c.tag!=="tag:yaml.org,2002:str")&&s(a??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),r&&(c.spaceBefore=!0),o&&(t.type==="scalar"&&t.source===""?c.comment=o:c.commentBefore=o),e.options.keepSourceTokens&&p&&(c.srcToken=t),c}function kt(e,t,n,s,{spaceBefore:i,comment:r,anchor:o,tag:l,end:a},c){let p={type:"scalar",offset:Is(t,n,s),indent:-1,source:""},u=vn(e,p,l,c);return o&&(u.anchor=o.source.substring(1),u.anchor===""&&c(o,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(u.spaceBefore=!0),r&&(u.comment=r,u.range[2]=a),u}function xs({options:e},{offset:t,source:n,end:s},i){let r=new ct(n.substring(1));r.source===""&&i(t,"BAD_ALIAS","Alias cannot be an empty string"),r.source.endsWith(":")&&i(t+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=t+n.length,l=Ee(s,o,e.strict,i);return r.range=[t,o,l.offset],l.comment&&(r.comment=l.comment),r}function $s(e,t,{offset:n,start:s,value:i,end:r},o){let l=Object.assign({_directives:t},e),a=new gn(void 0,l),c={atKey:!1,atRoot:!0,directives:a.directives,options:a.options,schema:a.schema},p=oe(s,{indicator:"doc-start",next:i??r?.[0],offset:n,onError:o,parentIndent:0,startOnNewline:!0});p.found&&(a.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!p.hasNewline&&o(p.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),a.contents=i?Sn(c,i,p,o):kt(c,p.end,s,null,p,o);let u=a.contents.range[2],f=Ee(r,u,!1,o);return f.comment&&(a.comment=f.comment),a.range=[n,u,f.offset],a}function pe(e){if(typeof e=="number")return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:n}=e;return[t,t+(typeof n=="string"?n.length:1)]}function $t(e){let t="",n=!1,s=!1;for(let i=0;i<e.length;++i){let r=e[i];switch(r[0]){case"#":t+=(t===""?"":s?`
100
+
101
+ `:`
102
+ `)+(r.substring(1)||" "),n=!0,s=!1;break;case"%":e[i+1]?.[0]!=="#"&&(i+=1),n=!1;break;default:n||(s=!0),n=!1}}return{comment:t,afterEmptyLine:s}}var Ls=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(t,n,s,i)=>{let r=pe(t);i?this.warnings.push(new us(r,n,s)):this.errors.push(new me(r,n,s))},this.directives=new ie({version:e.version||"1.2"}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:s}=$t(this.prelude);if(n){let i=e.contents;if(t)e.comment=e.comment?`${e.comment}
103
+ ${n}`:n;else if(s||e.directives.docStart||!i)e.commentBefore=n;else if(T(i)&&!i.flow&&i.items.length>0){let r=i.items[0];I(r)&&(r=r.key);let o=r.commentBefore;r.commentBefore=o?`${n}
104
+ ${o}`:n}else{let r=i.commentBefore;i.commentBefore=r?`${n}
105
+ ${r}`:n}}t?(Array.prototype.push.apply(e.errors,this.errors),Array.prototype.push.apply(e.warnings,this.warnings)):(e.errors=this.errors,e.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:$t(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,n=-1){for(let s of e)yield*this.next(s);yield*this.end(t,n)}*next(e){switch(e.type){case"directive":this.directives.add(e.source,(t,n,s)=>{let i=pe(e);i[0]+=t,this.onError(i,"BAD_DIRECTIVE",n,s)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let t=$s(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":{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new me(pe(e),"UNEXPECTED_TOKEN",t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){let n="Unexpected doc-end without preceding document";this.errors.push(new me(pe(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let t=Ee(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let n=this.doc.comment;this.doc.comment=n?`${n}
106
+ ${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new me(pe(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){let n=Object.assign({_directives:this.directives},this.options),s=new gn(void 0,n);this.atDirectives&&this.onError(t,"MISSING_CHAR","Missing directives-end indicator line"),s.range=[0,t,t],this.decorate(s,!1),yield s}}},it=Symbol("break visit"),Cs=Symbol("skip children"),En=Symbol("remove item");function le(e,t){"type"in e&&e.type==="document"&&(e={start:e.start,value:e.value}),Nn(Object.freeze([]),e,t)}le.BREAK=it;le.SKIP=Cs;le.REMOVE=En;le.itemAtPath=(e,t)=>{let n=e;for(let[s,i]of t){let r=n?.[s];if(r&&"items"in r)n=r.items[i];else return}return n};le.parentCollection=(e,t)=>{let n=le.itemAtPath(e,t.slice(0,-1)),s=t[t.length-1][0],i=n?.[s];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function Nn(e,t,n){let s=n(t,e);if(typeof s=="symbol")return s;for(let i of["key","value"]){let r=t[i];if(r&&"items"in r){for(let o=0;o<r.items.length;++o){let l=Nn(Object.freeze(e.concat([[i,o]])),r.items[o],n);if(typeof l=="number")o=l-1;else{if(l===it)return it;l===En&&(r.items.splice(o,1),o-=1)}}typeof s=="function"&&i==="key"&&(s=s(t,e))}}return typeof s=="function"?s(t,e):s}var On="\uFEFF",An="",In="",rt="";function _s(e){switch(e){case On:return"byte-order-mark";case An:return"doc-mode";case In:return"flow-error-end";case rt:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
107
+ `:case`\r
108
+ `:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(e[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}function M(e){switch(e){case void 0:case" ":case`
109
+ `:case"\r":case" ":return!0;default:return!1}}var Lt=new Set("0123456789ABCDEFabcdef"),js=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),xe=new Set(",[]{}"),Ks=new Set(` ,[]{}
110
+ \r `),ze=e=>!e||Ks.has(e),Bs=class{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 n=this.next??"stream";for(;n&&(t||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===" "||t===" ";)t=this.buffer[++e];return!t||t==="#"||t===`
111
+ `?!0:t==="\r"?this.buffer[e+1]===`
112
+ `:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let n=0;for(;t===" ";)t=this.buffer[++n+e];if(t==="\r"){let s=this.buffer[n+e+1];if(s===`
113
+ `||!s&&!this.atEnd)return e+n+1}return t===`
114
+ `||n>=this.indentNext||!t&&!this.atEnd?e+n:-1}if(t==="-"||t==="."){let n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&M(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(`
115
+ `,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]===On&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let t=e.length,n=e.indexOf("#");for(;n!==-1;){let i=e[n-1];if(i===" "||i===" "){t=n-1;break}else n=e.indexOf("#",n+1)}for(;;){let i=e[t-1];if(i===" "||i===" ")t-=1;else break}let s=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-s),this.pushNewline(),"stream"}if(this.atLineEnd()){let t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),"stream"}return yield An,yield*this.parseLineStart()}*parseLineStart(){let 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");let t=this.peek(3);if((t==="---"||t==="...")&&M(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&&!M(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&M(t)){let n=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=n,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let 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(ze),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,n=-1;do e=yield*this.pushNewline(),e>0?(t=yield*this.pushSpaces(!1),this.indentValue=n=t):t=0,t+=yield*this.pushSpaces(!0);while(e+t>0);let s=this.getLine();if(s===null)return this.setNext("flow");if((n!==-1&&n<this.indentNext&&s[0]!=="#"||n===0&&(s.startsWith("---")||s.startsWith("..."))&&M(s[3]))&&!(n===this.indentNext-1&&this.flowLevel===1&&(s[0]==="]"||s[0]==="}")))return this.flowLevel=0,yield In,yield*this.parseLineStart();let i=0;for(;s[i]===",";)i+=yield*this.pushCount(1),i+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(i+=yield*this.pushIndicators(),s[i]){case void 0:return"flow";case"#":return yield*this.pushCount(s.length-i),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(ze),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let r=this.charAt(1);if(this.flowKey||M(r)||r===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),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 i=0;for(;this.buffer[t-1-i]==="\\";)i+=1;if(i%2===0)break;t=this.buffer.indexOf('"',t+1)}let n=this.buffer.substring(0,t),s=n.indexOf(`
116
+ `,this.pos);if(s!==-1){for(;s!==-1;){let i=this.continueScalar(s+1);if(i===-1)break;s=n.indexOf(`
117
+ `,i)}s!==-1&&(t=s-(n[s-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(;;){let 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=>M(t)||t==="#")}*parseBlockScalar(){let e=this.pos-1,t=0,n;e:for(let i=this.pos;n=this.buffer[i];++i)switch(n){case" ":t+=1;break;case`
118
+ `:e=i,t=0;break;case"\r":{let r=this.buffer[i+1];if(!r&&!this.atEnd)return this.setNext("block-scalar");if(r===`
119
+ `)break}default:break e}if(!n&&!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{let i=this.continueScalar(e+1);if(i===-1)break;e=this.buffer.indexOf(`
120
+ `,i)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let s=e+1;for(n=this.buffer[s];n===" ";)n=this.buffer[++s];if(n===" "){for(;n===" "||n===" "||n==="\r"||n===`
121
+ `;)n=this.buffer[++s];e=s-1}else if(!this.blockScalarKeep)do{let i=e-1,r=this.buffer[i];r==="\r"&&(r=this.buffer[--i]);let o=i;for(;r===" ";)r=this.buffer[--i];if(r===`
122
+ `&&i>=this.pos&&i+1+t>o)e=i;else break}while(!0);return yield rt,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,n=this.pos-1,s;for(;s=this.buffer[++n];)if(s===":"){let i=this.buffer[n+1];if(M(i)||e&&xe.has(i))break;t=n}else if(M(s)){let i=this.buffer[n+1];if(s==="\r"&&(i===`
123
+ `?(n+=1,s=`
124
+ `,i=this.buffer[n+1]):t=n),i==="#"||e&&xe.has(i))break;if(s===`
125
+ `){let r=this.continueScalar(n+1);if(r===-1)break;n=Math.max(n,r-2)}}else{if(e&&xe.has(s))break;t=n}return!s&&!this.atEnd?this.setNext("plain-scalar"):(yield rt,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){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(t&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(ze))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let e=this.flowLevel>0,t=this.charAt(1);if(M(t)||e&&xe.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(;!M(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(js.has(t))t=this.buffer[++e];else if(t==="%"&&Lt.has(this.buffer[e+1])&&Lt.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
126
+ `?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
127
+ `?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,n;do n=this.buffer[++t];while(n===" "||e&&n===" ");let s=t-this.pos;return s>0&&(yield this.buffer.substr(this.pos,s),this.pos=t),s}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}},Ms=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t<n;){let i=t+n>>1;this.lineStarts[i]<e?t=i+1:n=i}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};let s=this.lineStarts[t-1];return{line:t,col:e-s+1}}}};function J(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function Ct(e){for(let t=0;t<e.length;++t)switch(e[t].type){case"space":case"comment":case"newline":break;default:return t}return-1}function Tn(e){switch(e?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function $e(e){switch(e.type){case"document":return e.start;case"block-map":{let t=e.items[e.items.length-1];return t.sep??t.start}case"block-seq":return e.items[e.items.length-1].start;default:return[]}}function Z(e){if(e.length===0)return[];let t=e.length;e:for(;--t>=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;e[++t]?.type==="space";);return e.splice(t,e.length)}function _t(e){if(e.start.type==="flow-seq-start")for(let t of e.items)t.sep&&!t.value&&!J(t.start,"explicit-key-ind")&&!J(t.sep,"map-value-ind")&&(t.key&&(t.value=t.key),delete t.key,Tn(t.value)?t.value.end?Array.prototype.push.apply(t.value.end,t.sep):t.value.end=t.sep:Array.prototype.push.apply(t.start,t.sep),delete t.sep)}var Ds=class{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 Bs,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let n of this.lexer.lex(e,t))yield*this.next(n);t||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=_s(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{let n=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:n,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(){let e=this.peek(1);if(this.type==="doc-end"&&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){let 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{let n=this.peek(1);switch(t.type==="block-scalar"?t.indent="indent"in n?n.indent:0:t.type==="flow-collection"&&n.type==="document"&&(t.indent=0),t.type==="flow-collection"&&_t(t),n.type){case"document":n.value=t;break;case"block-scalar":n.props.push(t);break;case"block-map":{let s=n.items[n.items.length-1];if(s.value){n.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}else if(s.sep)s.value=t;else{Object.assign(s,{key:t,sep:[]}),this.onKeyLine=!s.explicitKey;return}break}case"block-seq":{let s=n.items[n.items.length-1];s.value?n.items.push({start:[],value:t}):s.value=t;break}case"flow-collection":{let s=n.items[n.items.length-1];!s||s.value?n.items.push({start:[],key:t,sep:[]}):s.sep?s.value=t:Object.assign(s,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(t.type==="block-map"||t.type==="block-seq")){let s=t.items[t.items.length-1];s&&!s.sep&&!s.value&&s.start.length>0&&Ct(s.start)===-1&&(t.indent===0||s.start.every(i=>i.type!=="comment"||i.indent<t.indent))&&(n.type==="document"?n.end=s.start:n.items.push({start:s.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":{let 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":{Ct(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}let 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"){let t=$e(this.peek(2)),n=Z(t),s;e.end?(s=e.end,s.push(this.sourceToken),delete e.end):s=[this.sourceToken];let i={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:s}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":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(`
128
+ `)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
129
+ `,t)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,t.value){let n="end"in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){Array.prototype.push.apply(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,s=n&&(t.sep||t.explicitKey)&&this.type!=="seq-item-ind",i=[];if(s&&t.sep&&!t.value){let r=[];for(let o=0;o<t.sep.length;++o){let l=t.sep[o];switch(l.type){case"newline":r.push(o);break;case"space":break;case"comment":l.indent>e.indent&&(r.length=0);break;default:r.length=0}}r.length>=2&&(i=t.sep.splice(r[1]))}switch(this.type){case"anchor":case"tag":s||t.value?(i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"explicit-key-ind":!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):s||t.value?(i.push(this.sourceToken),e.items.push({start:i,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),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(J(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if(Tn(t.key)&&!J(t.sep,"newline")){let r=Z(t.start),o=t.key,l=t.sep;l.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:o,sep:l}]})}else i.length>0?t.sep=t.sep.concat(i,this.sourceToken):t.sep.push(this.sourceToken);else if(J(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let r=Z(t.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]})}else t.sep?t.value||s?e.items.push({start:i,key:null,sep:[this.sourceToken]}):J(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":{let r=this.flowScalar(this.type);s||t.value?(e.items.push({start:i,key:r,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(r):(Object.assign(t,{key:r,sep:[]}),this.onKeyLine=!0);return}default:{let r=this.startBlockValue(e);if(r){if(r.type==="block-seq"){if(!t.explicitKey&&t.sep&&!J(t.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else n&&e.items.push({start:i});this.stack.push(r);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(t.value){let n="end"in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){Array.prototype.push.apply(n,t.start),n.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||J(t.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n?.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":{let s=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:s,sep:[]}):t.sep?this.stack.push(s):Object.assign(t,{key:s,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let s=$e(n),i=Z(s);_t(e);let r=e.end.splice(1,e.end.length);r.push(this.sourceToken);let o={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:i,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=o}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let t=this.source.indexOf(`
130
+ `)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
131
+ `,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;let t=$e(e),n=Z(t);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let t=$e(e),n=Z(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!=="comment"||this.indent<=t?!1:e.every(n=>n.type==="newline"||n.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 Ps(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new Ms||null,prettyErrors:t}}function xn(e,t={}){let{lineCounter:n,prettyErrors:s}=Ps(t),i=new Ds(n?.addNewLine),r=new Ls(t),o=null;for(let l of r.compose(i.parse(e),!0,e.length))if(!o)o=l;else if(o.options.logLevel!=="silent"){o.errors.push(new me(l.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return s&&n&&(o.errors.forEach(Tt(e,n)),o.warnings.forEach(Tt(e,n))),o}var Fs=/^[a-z0-9]+(?:-[a-z0-9]+)*$/;function Vs(e,t){if(t.trim()===""||$n(t))throw new TypeError("skills.directory must be a non-empty project-relative path");let n=Oe(e),s=Oe(n,t),i=Ye(n,s);if(i===".."||i.startsWith(`..${he}`)||$n(i))throw new TypeError("skills.directory must stay within the project root");return s}function Js(e,t,n="skills"){if(e===!1)return;let s=typeof e=="object"&&e?.directory!==void 0?e.directory:n;return Vs(t,s)}function Ys(e){let t=e.slice(e.lastIndexOf(".")+1).toLowerCase();return{md:"text/markdown",txt:"text/plain",json:"application/json",yaml:"application/yaml",yml:"application/yaml",js:"text/javascript",mjs:"text/javascript",cjs:"text/javascript",ts:"text/typescript",py:"text/x-python",sh:"text/x-shellscript",html:"text/html",css:"text/css",csv:"text/csv",xml:"application/xml",svg:"image/svg+xml",png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",pdf:"application/pdf",zip:"application/zip"}[t]??"application/octet-stream"}function Ws(e){return e.startsWith("text/")||e==="application/json"||e==="application/yaml"||e==="application/xml"||e==="image/svg+xml"}function Gs(e){let t=[],n=[e],s=i=>{for(let r of Rs(i,{withFileTypes:!0}).sort((o,l)=>o.name.localeCompare(l.name))){let o=Oe(i,r.name),l=Ln(o);l.isSymbolicLink()||(l.isDirectory()?(n.push(o),s(o)):l.isFile()&&t.push(o))}};return s(e),{files:t,directories:n}}function vt(e,t,n){let s=Ye(e,t).split(he).map(encodeURIComponent),i=Ye(t,n).split(he).map(encodeURIComponent),[r,...o]=[...s,...i];return`skill://${r??""}/${o.join("/")}`}function Hs(e){let t=Cn(e,"utf8"),n=/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/.exec(t);if(n?.[1]===void 0)throw new Error(`${e}: SKILL.md must begin with YAML frontmatter`);let s=xn(n[1],{prettyErrors:!0});if(s.errors.length>0)throw new Error(`${e}: invalid YAML frontmatter: ${s.errors[0]?.message}`);let i;try{i=s.toJSON()}catch(a){throw new Error(`${e}: invalid YAML frontmatter: ${a instanceof Error?a.message:String(a)}`,{cause:a})}if(typeof i!="object"||i===null||Array.isArray(i))throw new Error(`${e}: frontmatter must be a YAML mapping`);let r=i,o=r.name,l=r.description;if(typeof o!="string"||o.length<1||o.length>64||!Fs.test(o))throw new Error(`${e}: name must be 1-64 lowercase letters, digits, or single hyphens`);if(o!==Ne(Oe(e,"..")))throw new Error(`${e}: frontmatter name must match its parent directory`);if(typeof l!="string"||l.trim()===""||l.length>1024)throw new Error(`${e}: description must be a non-empty string of at most 1024 characters`);return r}function di(e,t,n="skills"){if(e===!1)return;let s=e===!0||typeof e=="object"&&e!==null,i=Js(e,t,n);if(!Us(i)){if(!s)return;throw new Error(`Skills directory not found: ${i}`)}if(!Ln(i).isDirectory())throw new Error(`Skills path is not a directory: ${i}`);let{files:r,directories:o}=Gs(i),l=r.filter(u=>Ne(u)==="SKILL.md");l.length===0&&console.warn(`[mcp-use] Skills directory is empty: ${i}`);let a=new Map,c=new Map,p=l.map(u=>{let f=Oe(u,"..");if(f===i)throw new Error(`${u}: SKILL.md must be inside a named child directory`);let m=Hs(u),h=r.filter(g=>g.startsWith(`${f}${he}`)).map(g=>{let y=Cn(g),w=vt(i,f,g),v=Ys(g),N=`sha256:${qs("sha256").update(y).digest("hex")}`;return a.has(w)||a.set(w,{uri:w,name:Ne(g),mimeType:v,digest:N,...Ws(v)?{text:y.toString("utf8")}:{blob:y.toString("base64")}}),{uri:w,digest:N}}),d=vt(i,f,u).replace(/\/SKILL\.md$/,"");for(let g of o.filter(y=>y===f||y.startsWith(`${f}${he}`))){let y=Ye(f,g),w=y===""?d:`${d}/${y.split(he).map(encodeURIComponent).join("/")}`;c.set(w,{uri:w,name:y===""?Ne(f):Ne(g)})}return{uri:vt(i,f,u),frontmatter:m,resources:h}});return p.sort((u,f)=>u.uri.localeCompare(f.uri)),{skills:p,resources:[...a.values()].sort((u,f)=>u.uri.localeCompare(f.uri)),directories:[...c.values()].sort((u,f)=>u.uri.localeCompare(f.uri))}}export{Js as a,di as b};
@@ -1,5 +1,5 @@
1
- import{a as L,b as U,c as O,d as R,e as j,f as I,i as A,l as T}from"../chunk-TSMDTAVA.js";import{a as P,b as S,c as N,d as _}from"../chunk-OMRWADFK.js";import{a as D,b as C}from"../chunk-LUVZUL5C.js";import"../chunk-WOT6VMZA.js";import{randomBytes as z}from"crypto";import{existsSync as q}from"fs";import{cp as te,mkdir as M,rm as ne,writeFile as V}from"fs/promises";import{join as m,relative as y,resolve as se}from"path";import ae from"@tailwindcss/vite";import oe from"@vitejs/plugin-react";import{build as x}from"vite";import{createServerModuleRunner as k}from"vite";var ee="/mcp",F="http://localhost:3000";async function re(e,r){let n=k(e,{hmr:!1,sourcemapInterceptor:"node"}),i=process.env.MCP_URL;try{i===void 0&&(process.env.MCP_URL=F);let t=(await n.import(r)).default;if(t===null||typeof t!="object")throw new Error("The server entry must default-export the MCPServer instance.");return t.basePath??ee}finally{i===void 0?delete process.env.MCP_URL:process.env.MCP_URL=i,await n.close()}}async function J(e,r){return re(e,r)}async function B(e,r,n){let i=k(e,{hmr:!1,sourcemapInterceptor:"node"}),s=process.env.MCP_URL;try{s===void 0&&(process.env.MCP_URL=F);let c=(await i.import(r)).default;if(c===null||typeof c!="object")throw new Error("The server entry must default-export the MCPServer instance.");if(typeof c.__primeViews!="function")throw new Error("The entry's default export does not support __primeViews.");c.__primeViews(n),c.__mount()}finally{s===void 0?delete process.env.MCP_URL:process.env.MCP_URL=s,await i.close()}}function W(e){return e.replace(/\/+$/,"")}function ie(e,r){let n=r.replace(/^\/+/,"");return e==="/"?`/${n}`:`${e}/${n}`}function E(e,r){return`${ie(e,`_mcp-use/views/${r}`)}/`}var w="index.js",ce="entry-wrapper.ts",ue=100*1024*1024;async function Y(e,r){let n=m(e,"public");q(n)&&await te(n,r,{recursive:!0})}async function H(e,r,n){let i=m(e,ce);await M(e,{recursive:!0});let s=JSON.stringify(n);return await V(i,[`import server from ${JSON.stringify(r)};`,'import { registerViews } from "mcp-use";',`server[registerViews](${s});`,"export default server;",""].join(`
2
- `)),i}function le(){let e=process.env.MCP_ASSETS_URL;if(!(e===void 0||e.trim()===""))try{return W(new URL(e).href.replace(/\/$/,""))}catch{return}}function $(e,r,n,i){let s=e.replace(/^\/+/,"");return`${n}${E(i,r)}${s}`}function de(e,r,n,i){return e.kind!=="external"?e:{...e,entry:$(e.entry,r,n,i),css:e.css.map(s=>$(s,r,n,i)),...e.scripts!==void 0&&{scripts:e.scripts.map(s=>$(s,r,n,i))}}}async function fe(e,r){let n=m(r.viewsOutDir,e.name),i=await x({root:r.cwd,configFile:r.userViteConfig,envDir:!1,publicDir:!1,logLevel:"warn",cacheDir:r.cacheDir,resolve:{tsconfigPaths:!0,alias:{tailwindcss:U()}},oxc:{jsx:{runtime:"automatic"}},plugins:[ae(),oe(),T({getViews:()=>[e]})],build:{outDir:n,emptyOutDir:!0,write:!r.inline,target:"es2022",sourcemap:r.inline?!1:r.sourceMaps,minify:!0,cssCodeSplit:!1,chunkSizeWarningLimit:1e3,assetsInlineLimit:ue,rollupOptions:{input:{[e.name]:I(e.name)},output:{format:"es",codeSplitting:!r.inline,entryFileNames:"assets/[name]-[hash].js",chunkFileNames:"assets/[name]-[hash].js",assetFileNames:"assets/[name]-[hash][extname]"}}},base:"./"}),s=Array.isArray(i)?i[0]:i;if(s===void 0||!("output"in s))throw new Error(`Client build for view "${e.name}" produced no output.`);let t=s.output,c=Array.isArray(t)?t:Object.values(t),l,p,d,f=[];for(let o of c){if(typeof o!="object"||o===null||!("fileName"in o)||typeof o.fileName!="string")continue;let a=o;a.type==="chunk"&&a.isEntry===!0?(l=a.fileName,d=a.code):a.type==="asset"&&a.fileName.endsWith(".css")&&(p=a.fileName,typeof a.source=="string"?f.push(a.source):a.source instanceof Uint8Array&&f.push(new TextDecoder().decode(a.source)))}if(l===void 0)throw new Error(`Client build produced no entry chunk for view "${e.name}".`);if(r.inline){if(d===void 0)throw new Error(`Client build produced no entry source for view "${e.name}".`);return{kind:"inline",js:d,css:f.join(`
3
- `)}}return{kind:"external",entry:l.replace(/^\/+/,""),css:p!==void 0?[p.replace(/^\/+/,"")]:[]}}async function me(e){let r=performance.now();N(e.cwd,"production");let n=e.mcpDir===void 0?e.cwd:se(e.cwd,e.mcpDir),i=e.entry===void 0?D(n):D(e.cwd,e.entry),s=await C(e.cwd,i);(s==="created"||s==="updated")&&console.log(`[mcp-use] ${s} mcp-env.d.ts`);let t=O(e.cwd),c=e.viewsDir??(e.mcpDir===void 0?void 0:m(e.mcpDir,"views"));q(R(e.cwd,c))||console.log("[mcp-use] views directory not configured.");let l=j(e.cwd,c),p=L(e.cwd),d=e.sourceMaps===!0,f=e.inline===!0,o;if(l.length===0){o??=await A(e.cwd,t.cache,!1);try{await B(o.environments.ssr,i,{});let Z=await H(t.cache,i,{});await x({root:e.cwd,configFile:!1,envDir:!1,publicDir:!1,logLevel:"warn",cacheDir:t.cache,resolve:{tsconfigPaths:!0,alias:P(e.cwd)},plugins:[_(e.cwd)],build:{ssr:Z,outDir:t.build,emptyOutDir:!0,target:"node22",sourcemap:d,minify:!1,rollupOptions:{output:{format:"es",entryFileNames:w}}},ssr:{...S(e.cwd),target:"node"}})}finally{await o?.close()}await Y(e.cwd,m(t.build,"views/public"));let u={buildId:z(8).toString("hex"),entryPoint:w,createdAt:new Date().toISOString(),views:{}};await M(t.build,{recursive:!0}),await V(t.buildManifest,`${JSON.stringify(u,null,2)}
4
- `);let g=Math.round(performance.now()-r);console.log(`[mcp-use] built ${y(e.cwd,i)} \u2192 ${y(e.cwd,t.build)}/${w} (${g}ms)`);return}await ne(t.build,{recursive:!0,force:!0});let v=m(t.build,"views");await M(v,{recursive:!0}),o??=await A(e.cwd,t.cache,!1);let a,h={},b=le();try{a=await J(o.environments.ssr,i);for(let u of l){let g=await fe(u,{cwd:e.cwd,cacheDir:t.cache,viewsOutDir:v,userViteConfig:p,sourceMaps:d,inline:f});b!==void 0&&!f&&(g=de(g,u.name,b,a)),h[u.name]=g}if(b!==void 0&&!f){let u=`${b}${E(a,"<view-name>")}`;console.log(`[mcp-use] MCP_ASSETS_URL set \u2014 publish ${y(e.cwd,v)}/ at ${u}`),a!=="/mcp"&&console.log(`[mcp-use] CDN manifest uses basePath ${a} from server entry`)}await Y(e.cwd,m(v,"public")),await B(o.environments.ssr,i,h)}finally{await o.close()}let G=await H(t.cache,i,h);await x({root:e.cwd,configFile:!1,envDir:!1,publicDir:!1,logLevel:"warn",cacheDir:t.cache,resolve:{tsconfigPaths:!0,alias:P(e.cwd)},oxc:{jsx:{runtime:"automatic"}},plugins:[_(e.cwd)],build:{ssr:G,outDir:t.build,emptyOutDir:!1,target:"node22",sourcemap:d,minify:!1,rollupOptions:{output:{format:"es",entryFileNames:w}}},ssr:{...S(e.cwd),target:"node"}});let K={buildId:z(8).toString("hex"),entryPoint:w,createdAt:new Date().toISOString(),views:h};await M(t.build,{recursive:!0}),await V(t.buildManifest,`${JSON.stringify(K,null,2)}
5
- `);let Q=Math.round(performance.now()-r),X=l.map(u=>u.name).join(", ");console.log(`[mcp-use] built ${y(e.cwd,i)} + views (${X}) \u2192 ${y(e.cwd,t.build)}/${w} (${Q}ms)`)}export{me as runBuild};
1
+ import{a as L,b as U,c as j,d as R,e as T,f as I,i as E,l as F}from"../chunk-TSMDTAVA.js";import{a as _,b as P,c as O,d as k}from"../chunk-OMRWADFK.js";import{a as M,b as N}from"../chunk-LUVZUL5C.js";import"../chunk-WOT6VMZA.js";import{randomBytes as H}from"crypto";import{existsSync as K}from"fs";import{cp as ae,mkdir as b,rm as oe,writeFile as C}from"fs/promises";import{join as p,relative as y,resolve as ce}from"path";import le from"@tailwindcss/vite";import ue from"@vitejs/plugin-react";import{build as V}from"vite";import{createServerModuleRunner as J}from"vite";var te="/mcp",W="http://localhost:3000";async function se(e,i){let s=J(e,{hmr:!1,sourcemapInterceptor:"node"}),t=process.env.MCP_URL;try{t===void 0&&(process.env.MCP_URL=W);let r=(await s.import(i)).default;if(r===null||typeof r!="object")throw new Error("The server entry must default-export the MCPServer instance.");return r.basePath??te}finally{t===void 0?delete process.env.MCP_URL:process.env.MCP_URL=t,await s.close()}}async function z(e,i){return se(e,i)}async function $(e,i,s,t,n){let r=J(e,{hmr:!1,sourcemapInterceptor:"node"}),l=process.env.MCP_URL;try{l===void 0&&(process.env.MCP_URL=W);let o=(await r.import(i)).default;if(o===null||typeof o!="object")throw new Error("The server entry must default-export the MCPServer instance.");if(typeof o.__primeViews!="function")throw new Error("The entry's default export does not support __primeViews.");if(typeof o.__skillsConfig!="function"||typeof o.__primeSkills!="function")throw new Error("The entry's default export does not support Skills over MCP.");let{discoverConfiguredSkills:d}=await import("../internal/skills-loader.js"),u=d(o.__skillsConfig(),t,n);return o.__primeViews(s),o.__primeSkills(u),o.__mount(),u}finally{l===void 0?delete process.env.MCP_URL:process.env.MCP_URL=l,await r.close()}}function Y(e){return e.replace(/\/+$/,"")}function ne(e,i){let s=i.replace(/^\/+/,"");return e==="/"?`/${s}`:`${e}/${s}`}function A(e,i){return`${ne(e,`_mcp-use/views/${i}`)}/`}var w="index.js",de="entry-wrapper.ts",fe=100*1024*1024;async function q(e,i){let s=p(e,"public");K(s)&&await ae(s,i,{recursive:!0})}async function G(e,i,s,t){let n=p(e,de);await b(e,{recursive:!0});let r=JSON.stringify(s),l=JSON.stringify(t);return await C(n,[`import server from ${JSON.stringify(i)};`,'import { registerSkills, registerViews } from "mcp-use";',`server[registerViews](${r});`,`server[registerSkills](${l});`,"export default server;",""].join(`
2
+ `)),n}function me(){let e=process.env.MCP_ASSETS_URL;if(!(e===void 0||e.trim()===""))try{return Y(new URL(e).href.replace(/\/$/,""))}catch{return}}function B(e,i,s,t){let n=e.replace(/^\/+/,"");return`${s}${A(t,i)}${n}`}function pe(e,i,s,t){return e.kind!=="external"?e:{...e,entry:B(e.entry,i,s,t),css:e.css.map(n=>B(n,i,s,t)),...e.scripts!==void 0&&{scripts:e.scripts.map(n=>B(n,i,s,t))}}}async function we(e,i){let s=p(i.viewsOutDir,e.name),t=await V({root:i.cwd,configFile:i.userViteConfig,envDir:!1,publicDir:!1,logLevel:"warn",cacheDir:i.cacheDir,resolve:{tsconfigPaths:!0,alias:{tailwindcss:U()}},oxc:{jsx:{runtime:"automatic"}},plugins:[le(),ue(),F({getViews:()=>[e]})],build:{outDir:s,emptyOutDir:!0,write:!i.inline,target:"es2022",sourcemap:i.inline?!1:i.sourceMaps,minify:!0,cssCodeSplit:!1,chunkSizeWarningLimit:1e3,assetsInlineLimit:fe,rollupOptions:{input:{[e.name]:I(e.name)},output:{format:"es",codeSplitting:!i.inline,entryFileNames:"assets/[name]-[hash].js",chunkFileNames:"assets/[name]-[hash].js",assetFileNames:"assets/[name]-[hash][extname]"}}},base:"./"}),n=Array.isArray(t)?t[0]:t;if(n===void 0||!("output"in n))throw new Error(`Client build for view "${e.name}" produced no output.`);let r=n.output,l=Array.isArray(r)?r:Object.values(r),m,o,d,u=[];for(let c of l){if(typeof c!="object"||c===null||!("fileName"in c)||typeof c.fileName!="string")continue;let a=c;a.type==="chunk"&&a.isEntry===!0?(m=a.fileName,d=a.code):a.type==="asset"&&a.fileName.endsWith(".css")&&(o=a.fileName,typeof a.source=="string"?u.push(a.source):a.source instanceof Uint8Array&&u.push(new TextDecoder().decode(a.source)))}if(m===void 0)throw new Error(`Client build produced no entry chunk for view "${e.name}".`);if(i.inline){if(d===void 0)throw new Error(`Client build produced no entry source for view "${e.name}".`);return{kind:"inline",js:d,css:u.join(`
3
+ `)}}return{kind:"external",entry:m.replace(/^\/+/,""),css:o!==void 0?[o.replace(/^\/+/,"")]:[]}}async function ge(e){let i=performance.now();O(e.cwd,"production");let s=e.mcpDir===void 0?e.cwd:ce(e.cwd,e.mcpDir),t=e.entry===void 0?M(s):M(e.cwd,e.entry),n=await N(e.cwd,t);(n==="created"||n==="updated")&&console.log(`[mcp-use] ${n} mcp-env.d.ts`);let r=j(e.cwd),l=e.viewsDir??(e.mcpDir===void 0?void 0:p(e.mcpDir,"views"));K(R(e.cwd,l))||console.log("[mcp-use] views directory not configured.");let m=T(e.cwd,l),o=L(e.cwd),d=e.sourceMaps===!0,u=e.inline===!0,c,D=e.mcpDir===void 0?"skills":p(e.mcpDir,"skills");if(m.length===0){c??=await E(e.cwd,r.cache,!1);try{let ie=await $(c.environments.ssr,t,{},e.cwd,D),re=await G(r.cache,t,{},ie);await V({root:e.cwd,configFile:!1,envDir:!1,publicDir:!1,logLevel:"warn",cacheDir:r.cache,resolve:{tsconfigPaths:!0,alias:_(e.cwd)},plugins:[k(e.cwd)],build:{ssr:re,outDir:r.build,emptyOutDir:!0,target:"node22",sourcemap:d,minify:!1,rollupOptions:{output:{format:"es",entryFileNames:w}}},ssr:{...P(e.cwd),target:"node"}})}finally{await c?.close()}await q(e.cwd,p(r.build,"views/public"));let f={buildId:H(8).toString("hex"),entryPoint:w,createdAt:new Date().toISOString(),views:{}};await b(r.build,{recursive:!0}),await C(r.buildManifest,`${JSON.stringify(f,null,2)}
4
+ `);let v=Math.round(performance.now()-i);console.log(`[mcp-use] built ${y(e.cwd,t)} \u2192 ${y(e.cwd,r.build)}/${w} (${v}ms)`);return}await oe(r.build,{recursive:!0,force:!0});let a=p(r.build,"views");await b(a,{recursive:!0}),c??=await E(e.cwd,r.cache,!1);let g,h={},x,S=me();try{g=await z(c.environments.ssr,t);for(let f of m){let v=await we(f,{cwd:e.cwd,cacheDir:r.cache,viewsOutDir:a,userViteConfig:o,sourceMaps:d,inline:u});S!==void 0&&!u&&(v=pe(v,f.name,S,g)),h[f.name]=v}if(S!==void 0&&!u){let f=`${S}${A(g,"<view-name>")}`;console.log(`[mcp-use] MCP_ASSETS_URL set \u2014 publish ${y(e.cwd,a)}/ at ${f}`),g!=="/mcp"&&console.log(`[mcp-use] CDN manifest uses basePath ${g} from server entry`)}await q(e.cwd,p(a,"public")),x=await $(c.environments.ssr,t,h,e.cwd,D)}finally{await c.close()}let Q=await G(r.cache,t,h,x);await V({root:e.cwd,configFile:!1,envDir:!1,publicDir:!1,logLevel:"warn",cacheDir:r.cache,resolve:{tsconfigPaths:!0,alias:_(e.cwd)},oxc:{jsx:{runtime:"automatic"}},plugins:[k(e.cwd)],build:{ssr:Q,outDir:r.build,emptyOutDir:!1,target:"node22",sourcemap:d,minify:!1,rollupOptions:{output:{format:"es",entryFileNames:w}}},ssr:{...P(e.cwd),target:"node"}});let X={buildId:H(8).toString("hex"),entryPoint:w,createdAt:new Date().toISOString(),views:h};await b(r.build,{recursive:!0}),await C(r.buildManifest,`${JSON.stringify(X,null,2)}
5
+ `);let Z=Math.round(performance.now()-i),ee=m.map(f=>f.name).join(", ");console.log(`[mcp-use] built ${y(e.cwd,t)} + views (${ee}) \u2192 ${y(e.cwd,r.build)}/${w} (${Z}ms)`)}export{ge as runBuild};