@hallohuman/hightea 0.1.31 → 0.1.33
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.
- package/dist/bin.js +26 -20
- package/dist/chunk-3emak1d3.js +2 -0
- package/dist/chunk-3w7svm2r.js +2 -0
- package/dist/chunk-4gpw7vjp.js +139 -0
- package/dist/{chunk-5s85pw9m.js → chunk-88mhcx5q.js} +1 -1
- package/dist/chunk-9fxpgay8.js +9 -0
- package/dist/chunk-a1vwy98c.js +1 -0
- package/dist/chunk-axj8ef03.js +1 -0
- package/dist/chunk-dw3tmpqv.js +1 -0
- package/dist/chunk-e9s05rg6.js +4 -0
- package/dist/chunk-evg5apz3.js +2 -0
- package/dist/chunk-jaf9mk6s.js +2 -0
- package/dist/{chunk-r9yjtfhp.js → chunk-kjkww5cr.js} +4 -4
- package/dist/chunk-kq5y08g7.js +5 -0
- package/dist/chunk-ntj1fcak.js +1 -0
- package/dist/chunk-p1142ccr.js +1 -0
- package/dist/chunk-q669464j.js +13 -0
- package/dist/chunk-tay0pyz4.js +58 -0
- package/dist/chunk-vzkbknwq.js +5 -0
- package/dist/chunk-ym5anbc7.js +5 -0
- package/dist/plugin/plugin.json +4 -1
- package/dist/plugin/plugin.mjs +36 -36
- package/package.json +1 -1
- package/dist/chunk-19pwmgzg.js +0 -5
- package/dist/chunk-5zb06f9b.js +0 -2
- package/dist/chunk-69dva4cx.js +0 -58
- package/dist/chunk-8rbp82rh.js +0 -139
- package/dist/chunk-8x5daqht.js +0 -1
- package/dist/chunk-9pv1nvfv.js +0 -5
- package/dist/chunk-db8mr7mp.js +0 -1
- package/dist/chunk-dkzzzkex.js +0 -13
- package/dist/chunk-f04t1q6v.js +0 -2
- package/dist/chunk-gcqhggbh.js +0 -1
- package/dist/chunk-jdzvh3gk.js +0 -1
- package/dist/chunk-p616vcdm.js +0 -4
- package/dist/chunk-xj3c5jgm.js +0 -5
- package/dist/chunk-xy8j3npr.js +0 -1
package/dist/chunk-8rbp82rh.js
DELETED
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import{f,E,T,b,i}from"./chunk-f04t1q6v.js";import"./chunk-r9yjtfhp.js";import{t,e}from"./chunk-xj3c5jgm.js";import{createRequire as ur}from"node:module";var v=(s,n)=>()=>(n||s((n={exports:{}}).exports,n),n.exports);var We=ur(import.meta.url);var I=v(function(wr){var Mt=Symbol.for("yaml.alias"),Qs=Symbol.for("yaml.document"),Qe=Symbol.for("yaml.map"),Hs=Symbol.for("yaml.pair"),xt=Symbol.for("yaml.scalar"),He=Symbol.for("yaml.seq"),V=Symbol.for("yaml.node.type"),hr=(s)=>!!s&&typeof s==="object"&&s[V]===Mt,dr=(s)=>!!s&&typeof s==="object"&&s[V]===Qs,pr=(s)=>!!s&&typeof s==="object"&&s[V]===Qe,mr=(s)=>!!s&&typeof s==="object"&&s[V]===Hs,Gs=(s)=>!!s&&typeof s==="object"&&s[V]===xt,yr=(s)=>!!s&&typeof s==="object"&&s[V]===He;function Xs(s){if(s&&typeof s==="object")switch(s[V]){case Qe:case He:return!0}return!1}function gr(s){if(s&&typeof s==="object")switch(s[V]){case Mt:case Qe:case xt:case He:return!0}return!1}var br=(s)=>(Gs(s)||Xs(s))&&!!s.anchor;wr.ALIAS=Mt;wr.DOC=Qs;wr.MAP=Qe;wr.NODE_TYPE=V;wr.PAIR=Hs;wr.SCALAR=xt;wr.SEQ=He;wr.hasAnchor=br;wr.isAlias=hr;wr.isCollection=Xs;wr.isDocument=dr;wr.isMap=pr;wr.isNode=gr;wr.isPair=mr;wr.isScalar=Gs;wr.isSeq=yr});var Ne=v(function(xr){var B=I(),j=Symbol("break visit"),zs=Symbol("skip children"),Y=Symbol("remove node");function Ge(s,n){let r=Zs(n);if(B.isDocument(s)){if(he(null,s.contents,r,Object.freeze([s]))===Y)s.contents=null}else he(null,s,r,Object.freeze([]))}Ge.BREAK=j;Ge.SKIP=zs;Ge.REMOVE=Y;function he(s,n,r,o){let a=en(s,n,r,o);if(B.isNode(a)||B.isPair(a))return tn(s,o,a),he(s,a,r,o);if(typeof a!=="symbol"){if(B.isCollection(n)){o=Object.freeze(o.concat(n));for(let l=0;l<n.items.length;++l){let c=he(l,n.items[l],r,o);if(typeof c==="number")l=c-1;else if(c===j)return j;else if(c===Y)n.items.splice(l,1),l-=1}}else if(B.isPair(n)){o=Object.freeze(o.concat(n));let l=he("key",n.key,r,o);if(l===j)return j;else if(l===Y)n.key=null;let c=he("value",n.value,r,o);if(c===j)return j;else if(c===Y)n.value=null}}return a}async function Xe(s,n){let r=Zs(n);if(B.isDocument(s)){if(await de(null,s.contents,r,Object.freeze([s]))===Y)s.contents=null}else await de(null,s,r,Object.freeze([]))}Xe.BREAK=j;Xe.SKIP=zs;Xe.REMOVE=Y;async function de(s,n,r,o){let a=await en(s,n,r,o);if(B.isNode(a)||B.isPair(a))return tn(s,o,a),de(s,a,r,o);if(typeof a!=="symbol"){if(B.isCollection(n)){o=Object.freeze(o.concat(n));for(let l=0;l<n.items.length;++l){let c=await de(l,n.items[l],r,o);if(typeof c==="number")l=c-1;else if(c===j)return j;else if(c===Y)n.items.splice(l,1),l-=1}}else if(B.isPair(n)){o=Object.freeze(o.concat(n));let l=await de("key",n.key,r,o);if(l===j)return j;else if(l===Y)n.key=null;let c=await de("value",n.value,r,o);if(c===j)return j;else if(c===Y)n.value=null}}return a}function Zs(s){if(typeof s==="object"&&(s.Collection||s.Node||s.Value))return Object.assign({Alias:s.Node,Map:s.Node,Scalar:s.Node,Seq:s.Node},s.Value&&{Map:s.Value,Scalar:s.Value,Seq:s.Value},s.Collection&&{Map:s.Collection,Seq:s.Collection},s);return s}function en(s,n,r,o){if(typeof r==="function")return r(s,n,o);if(B.isMap(n))return r.Map?.(s,n,o);if(B.isSeq(n))return r.Seq?.(s,n,o);if(B.isPair(n))return r.Pair?.(s,n,o);if(B.isScalar(n))return r.Scalar?.(s,n,o);if(B.isAlias(n))return r.Alias?.(s,n,o);return}function tn(s,n,r){let o=n[n.length-1];if(B.isCollection(o))o.items[s]=r;else if(B.isPair(o))if(s==="key")o.key=r;else o.value=r;else if(B.isDocument(o))o.contents=r;else{let a=B.isAlias(o)?"alias":"scalar";throw Error(`Cannot replace node with ${a} parent`)}}xr.visit=Ge;xr.visitAsync=Xe});var Dt=v(function(Fr){var sn=I(),jr=Ne(),Kr={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Rr=(s)=>s.replace(/[!,[\]{}]/g,(n)=>Kr[n]);class K{constructor(s,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},K.defaultYaml,s),this.tags=Object.assign({},K.defaultTags,n)}clone(){let s=new K(this.yaml,this.tags);return s.docStart=this.docStart,s}atDocument(){let s=new K(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:K.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},K.defaultTags);break}return s}add(s,n){if(this.atNextDocument)this.yaml={explicit:K.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},K.defaultTags),this.atNextDocument=!1;let r=s.trim().split(/[ \t]+/),o=r.shift();switch(o){case"%TAG":{if(r.length!==2){if(n(0,"%TAG directive should contain exactly two parts"),r.length<2)return!1}let[a,l]=r;return this.tags[a]=l,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;let[a]=r;if(a==="1.1"||a==="1.2")return this.yaml.version=a,!0;else{let l=/^\d+\.\d+$/.test(a);return n(6,`Unsupported YAML version ${a}`,l),!1}}default:return n(0,`Unknown directive ${o}`,!0),!1}}tagName(s,n){if(s==="!")return"!";if(s[0]!=="!")return n(`Not a valid tag: ${s}`),null;if(s[1]==="<"){let l=s.slice(2,-1);if(l==="!"||l==="!!")return n(`Verbatim tags aren't resolved, so ${s} is invalid.`),null;if(s[s.length-1]!==">")n("Verbatim tags must end with a >");return l}let[,r,o]=s.match(/^(.*!)([^!]*)$/s);if(!o)n(`The ${s} tag has no suffix`);let a=this.tags[r];if(a)try{return a+decodeURIComponent(o)}catch(l){return n(String(l)),null}if(r==="!")return s;return n(`Could not resolve tag: ${s}`),null}tagString(s){for(let[n,r]of Object.entries(this.tags))if(s.startsWith(r))return n+Rr(s.substring(r.length));return s[0]==="!"?s:`!<${s}>`}toString(s){let n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags),o;if(s&&r.length>0&&sn.isNode(s.contents)){let a={};jr.visit(s.contents,(l,c)=>{if(sn.isNode(c)&&c.tag)a[c.tag]=!0}),o=Object.keys(a)}else o=[];for(let[a,l]of r){if(a==="!!"&&l==="tag:yaml.org,2002:")continue;if(!s||o.some((c)=>c.startsWith(l)))n.push(`%TAG ${a} ${l}`)}return n.join(`
|
|
2
|
-
`)}}K.defaultYaml={explicit:!1,version:"1.2"};K.defaultTags={"!!":"tag:yaml.org,2002:"};Fr.Directives=K});var ze=v(function(Wr){var nn=I(),Yr=Ne();function Jr(s){if(/[\x00-\x19\s,[\]{}]/.test(s)){let r=`Anchor must not contain whitespace or control characters: ${JSON.stringify(s)}`;throw Error(r)}return!0}function rn(s){let n=new Set;return Yr.visit(s,{Value(r,o){if(o.anchor)n.add(o.anchor)}}),n}function on(s,n){for(let r=1;;++r){let o=`${s}${r}`;if(!n.has(o))return o}}function Vr(s,n){let r=[],o=new Map,a=null;return{onAnchor:(l)=>{r.push(l),a??(a=rn(s));let c=on(n,a);return a.add(c),c},setAnchors:()=>{for(let l of r){let c=o.get(l);if(typeof c==="object"&&c.anchor&&(nn.isScalar(c.node)||nn.isCollection(c.node)))c.node.anchor=c.anchor;else{let u=Error("Failed to resolve repeated object (this should not happen)");throw u.source=l,u}}},sourceObjects:o}}Wr.anchorIsValid=Jr;Wr.anchorNames=rn;Wr.createNodeAnchors=Vr;Wr.findNewAnchor=on});var Bt=v(function(zr){function Ae(s,n,r,o){if(o&&typeof o==="object")if(Array.isArray(o))for(let a=0,l=o.length;a<l;++a){let c=o[a],u=Ae(s,o,String(a),c);if(u===void 0)delete o[a];else if(u!==c)o[a]=u}else if(o instanceof Map)for(let a of Array.from(o.keys())){let l=o.get(a),c=Ae(s,o,a,l);if(c===void 0)o.delete(a);else if(c!==l)o.set(a,c)}else if(o instanceof Set)for(let a of Array.from(o)){let l=Ae(s,o,a,a);if(l===void 0)o.delete(a);else if(l!==a)o.delete(a),o.add(l)}else for(let[a,l]of Object.entries(o)){let c=Ae(s,o,a,l);if(c===void 0)delete o[a];else if(c!==l)o[a]=c}return s.call(n,r,o)}zr.applyReviver=Ae});var H=v(function(to){var eo=I();function an(s,n,r){if(Array.isArray(s))return s.map((o,a)=>an(o,String(a),r));if(s&&typeof s.toJSON==="function"){if(!r||!eo.hasAnchor(s))return s.toJSON(n,r);let o={aliasCount:0,count:1,res:void 0};r.anchors.set(s,o),r.onCreate=(l)=>{o.res=l,delete r.onCreate};let a=s.toJSON(n,r);if(r.onCreate)r.onCreate(a);return a}if(typeof s==="bigint"&&!r?.keep)return Number(s);return s}to.toJS=an});var Ze=v(function(ro){var no=Bt(),ln=I(),io=H();class cn{constructor(s){Object.defineProperty(this,ln.NODE_TYPE,{value:s})}clone(){let s=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if(this.range)s.range=this.range.slice();return s}toJS(s,{mapAsMap:n,maxAliasCount:r,onAnchor:o,reviver:a}={}){if(!ln.isDocument(s))throw TypeError("A document argument is required");let l={anchors:new Map,doc:s,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r==="number"?r:100},c=io.toJS(this,"",l);if(typeof o==="function")for(let{count:u,res:h}of l.anchors.values())o(h,u);return typeof a==="function"?no.applyReviver(a,{"":c},"",c):c}}ro.NodeBase=cn});var Oe=v(function(uo){var ao=ze(),lo=Ne(),pe=I(),co=Ze(),fo=H();class fn extends co.NodeBase{constructor(s){super(pe.ALIAS);this.source=s,Object.defineProperty(this,"tag",{set(){throw Error("Alias nodes cannot have tags")}})}resolve(s,n){let r;if(n?.aliasResolveCache)r=n.aliasResolveCache;else if(r=[],lo.visit(s,{Node:(a,l)=>{if(pe.isAlias(l)||pe.hasAnchor(l))r.push(l)}}),n)n.aliasResolveCache=r;let o=void 0;for(let a of r){if(a===this)break;if(a.anchor===this.source)o=a}return o}toJSON(s,n){if(!n)return{source:this.source};let{anchors:r,doc:o,maxAliasCount:a}=n,l=this.resolve(o,n);if(!l){let u=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(u)}let c=r.get(l);if(!c)fo.toJS(l,null,n),c=r.get(l);if(!c||c.res===void 0)throw ReferenceError("This should not happen: Alias anchor was not resolved?");if(a>=0){if(c.count+=1,c.aliasCount===0)c.aliasCount=et(o,l,r);if(c.count*c.aliasCount>a)throw ReferenceError("Excessive alias count indicates a resource exhaustion attack")}return c.res}toString(s,n,r){let o=`*${this.source}`;if(s){if(ao.anchorIsValid(this.source),s.options.verifyAliasOrder&&!s.anchors.has(this.source)){let a=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(a)}if(s.implicitKey)return`${o} `}return o}}function et(s,n,r){if(pe.isAlias(n)){let o=n.resolve(s),a=r&&o&&r.get(o);return a?a.count*a.aliasCount:0}else if(pe.isCollection(n)){let o=0;for(let a of n.items){let l=et(s,a,r);if(l>o)o=l}return o}else if(pe.isPair(n)){let o=et(s,n.key,r),a=et(s,n.value,r);return Math.max(o,a)}return 1}uo.Alias=fn});var M=v(function(bo){var po=I(),mo=Ze(),yo=H(),go=(s)=>!s||typeof s!=="function"&&typeof s!=="object";class ie extends mo.NodeBase{constructor(s){super(po.SCALAR);this.value=s}toJSON(s,n){return n?.keep?this.value:yo.toJS(this.value,s,n)}toString(){return String(this.value)}}ie.BLOCK_FOLDED="BLOCK_FOLDED";ie.BLOCK_LITERAL="BLOCK_LITERAL";ie.PLAIN="PLAIN";ie.QUOTE_DOUBLE="QUOTE_DOUBLE";ie.QUOTE_SINGLE="QUOTE_SINGLE";bo.Scalar=ie;bo.isScalarValue=go});var qe=v(function(Oo){var vo=Oe(),re=I(),un=M(),ko="tag:yaml.org,2002:";function No(s,n,r){if(n){let o=r.filter((l)=>l.tag===n),a=o.find((l)=>!l.format)??o[0];if(!a)throw Error(`Tag ${n} not found`);return a}return r.find((o)=>o.identify?.(s)&&!o.format)}function Ao(s,n,r){if(re.isDocument(s))s=s.contents;if(re.isNode(s))return s;if(re.isPair(s)){let p=r.schema[re.MAP].createNode?.(r.schema,null,r);return p.items.push(s),p}if(s instanceof String||s instanceof Number||s instanceof Boolean||typeof BigInt<"u"&&s instanceof BigInt)s=s.valueOf();let{aliasDuplicateObjects:o,onAnchor:a,onTagObj:l,schema:c,sourceObjects:u}=r,h=void 0;if(o&&s&&typeof s==="object")if(h=u.get(s),h)return h.anchor??(h.anchor=a(s)),new vo.Alias(h.anchor);else h={anchor:null,node:null},u.set(s,h);if(n?.startsWith("!!"))n=ko+n.slice(2);let d=No(s,n,c.tags);if(!d){if(s&&typeof s.toJSON==="function")s=s.toJSON();if(!s||typeof s!=="object"){let p=new un.Scalar(s);if(h)h.node=p;return p}d=s instanceof Map?c[re.MAP]:(Symbol.iterator in Object(s))?c[re.SEQ]:c[re.MAP]}if(l)l(d),delete r.onTagObj;let g=d?.createNode?d.createNode(r.schema,s,r):typeof d?.nodeClass?.from==="function"?d.nodeClass.from(r.schema,s,r):new un.Scalar(s);if(n)g.tag=n;else if(!d.default)g.tag=d.tag;if(h)h.node=g;return g}Oo.createNode=Ao});var tt=v(function(To){var Eo=qe(),J=I(),Lo=Ze();function jt(s,n,r){let o=r;for(let a=n.length-1;a>=0;--a){let l=n[a];if(typeof l==="number"&&Number.isInteger(l)&&l>=0){let c=[];c[l]=o,o=c}else o=new Map([[l,o]])}return Eo.createNode(o,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error("This should not happen, please report a bug.")},schema:s,sourceObjects:new Map})}var hn=(s)=>s==null||typeof s==="object"&&!!s[Symbol.iterator]().next().done;class dn extends Lo.NodeBase{constructor(s,n){super(s);Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(s){let n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if(s)n.schema=s;if(n.items=n.items.map((r)=>J.isNode(r)||J.isPair(r)?r.clone(s):r),this.range)n.range=this.range.slice();return n}addIn(s,n){if(hn(s))this.add(n);else{let[r,...o]=s,a=this.get(r,!0);if(J.isCollection(a))a.addIn(o,n);else if(a===void 0&&this.schema)this.set(r,jt(this.schema,o,n));else throw Error(`Expected YAML collection at ${r}. Remaining path: ${o}`)}}deleteIn(s){let[n,...r]=s;if(r.length===0)return this.delete(n);let o=this.get(n,!0);if(J.isCollection(o))return o.deleteIn(r);else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}getIn(s,n){let[r,...o]=s,a=this.get(r,!0);if(o.length===0)return!n&&J.isScalar(a)?a.value:a;else return J.isCollection(a)?a.getIn(o,n):void 0}hasAllNullValues(s){return this.items.every((n)=>{if(!J.isPair(n))return!1;let r=n.value;return r==null||s&&J.isScalar(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(s){let[n,...r]=s;if(r.length===0)return this.has(n);let o=this.get(n,!0);return J.isCollection(o)?o.hasIn(r):!1}setIn(s,n){let[r,...o]=s;if(o.length===0)this.set(r,n);else{let a=this.get(r,!0);if(J.isCollection(a))a.setIn(o,n);else if(a===void 0&&this.schema)this.set(r,jt(this.schema,o,n));else throw Error(`Expected YAML collection at ${r}. Remaining path: ${o}`)}}}To.Collection=dn;To.collectionFromPath=jt;To.isEmptyPath=hn});var Ee=v(function(Mo){var Po=(s)=>s.replace(/^(?!$)(?: $)?/gm,"#");function Kt(s,n){if(/^\n+$/.test(s))return s.substring(1);return n?s.replace(/^(?! *$)/gm,n):s}var $o=(s,n,r)=>s.endsWith(`
|
|
3
|
-
`)?Kt(r,n):r.includes(`
|
|
4
|
-
`)?`
|
|
5
|
-
`+Kt(r,n):(s.endsWith(" ")?"":" ")+r;Mo.indentComment=Kt;Mo.lineComment=$o;Mo.stringifyComment=Po});var mn=v(function(Ko){function jo(s,n,r="flow",{indentAtStart:o,lineWidth:a=80,minContentWidth:l=20,onFold:c,onOverflow:u}={}){if(!a||a<0)return s;if(a<l)l=0;let h=Math.max(1+l,1+a-n.length);if(s.length<=h)return s;let d=[],g={},p=a-n.length;if(typeof o==="number")if(o>a-Math.max(2,l))d.push(0);else p=a-o;let m=void 0,S=void 0,k=!1,y=-1,w=-1,A=-1;if(r==="block"){if(y=pn(s,y,n.length),y!==-1)p=y+h}for(let q;q=s[y+=1];){if(r==="quoted"&&q==="\\"){switch(w=y,s[y+1]){case"x":y+=3;break;case"u":y+=5;break;case"U":y+=9;break;default:y+=1}A=y}if(q===`
|
|
6
|
-
`){if(r==="block")y=pn(s,y,n.length);p=y+n.length+h,m=void 0}else{if(q===" "&&S&&S!==" "&&S!==`
|
|
7
|
-
`&&S!=="\t"){let L=s[y+1];if(L&&L!==" "&&L!==`
|
|
8
|
-
`&&L!=="\t")m=y}if(y>=p)if(m)d.push(m),p=m+h,m=void 0;else if(r==="quoted"){while(S===" "||S==="\t")S=q,q=s[y+=1],k=!0;let L=y>A+1?y-2:w-1;if(g[L])return s;d.push(L),g[L]=!0,p=L+h,m=void 0}else k=!0}S=q}if(k&&u)u();if(d.length===0)return s;if(c)c();let O=s.slice(0,d[0]);for(let q=0;q<d.length;++q){let L=d[q],C=d[q+1]||s.length;if(L===0)O=`
|
|
9
|
-
${n}${s.slice(0,C)}`;else{if(r==="quoted"&&g[L])O+=`${s[L]}\\`;O+=`
|
|
10
|
-
${n}${s.slice(L+1,C)}`}}return O}function pn(s,n,r){let o=n,a=n+1,l=s[a];while(l===" "||l==="\t")if(n<a+r)l=s[++n];else{do l=s[++n];while(l&&l!==`
|
|
11
|
-
`);o=n,a=n+1,l=s[a]}return o}Ko.FOLD_BLOCK="block";Ko.FOLD_FLOW="flow";Ko.FOLD_QUOTED="quoted";Ko.foldFlowLines=jo});var Te=v(function(Qo){var F=M(),G=mn(),nt=(s,n)=>({indentAtStart:n?s.indent.length:s.indentAtStart,lineWidth:s.options.lineWidth,minContentWidth:s.options.minContentWidth}),it=(s)=>/^(%|---|\.\.\.)/m.test(s);function Jo(s,n,r){if(!n||n<0)return!1;let o=n-r,a=s.length;if(a<=o)return!1;for(let l=0,c=0;l<a;++l)if(s[l]===`
|
|
12
|
-
`){if(l-c>o)return!0;if(c=l+1,a-c<=o)return!1}return!0}function Le(s,n){let r=JSON.stringify(s);if(n.options.doubleQuotedAsJSON)return r;let{implicitKey:o}=n,a=n.options.doubleQuotedMinMultiLineLength,l=n.indent||(it(s)?" ":""),c="",u=0;for(let h=0,d=r[h];d;d=r[++h]){if(d===" "&&r[h+1]==="\\"&&r[h+2]==="n")c+=r.slice(u,h)+"\\ ",h+=1,u=h,d="\\";if(d==="\\")switch(r[h+1]){case"u":{c+=r.slice(u,h);let g=r.substr(h+2,4);switch(g){case"0000":c+="\\0";break;case"0007":c+="\\a";break;case"000b":c+="\\v";break;case"001b":c+="\\e";break;case"0085":c+="\\N";break;case"00a0":c+="\\_";break;case"2028":c+="\\L";break;case"2029":c+="\\P";break;default:if(g.substr(0,2)==="00")c+="\\x"+g.substr(2);else c+=r.substr(h,6)}h+=5,u=h+1}break;case"n":if(o||r[h+2]==='"'||r.length<a)h+=1;else{c+=r.slice(u,h)+`
|
|
13
|
-
|
|
14
|
-
`;while(r[h+2]==="\\"&&r[h+3]==="n"&&r[h+4]!=='"')c+=`
|
|
15
|
-
`,h+=2;if(c+=l,r[h+2]===" ")c+="\\";h+=1,u=h+1}break;default:h+=1}}return c=u?c+r.slice(u):r,o?c:G.foldFlowLines(c,l,G.FOLD_QUOTED,nt(n,!1))}function Rt(s,n){if(n.options.singleQuote===!1||n.implicitKey&&s.includes(`
|
|
16
|
-
`)||/[ \t]\n|\n[ \t]/.test(s))return Le(s,n);let r=n.indent||(it(s)?" ":""),o="'"+s.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
17
|
-
${r}`)+"'";return n.implicitKey?o:G.foldFlowLines(o,r,G.FOLD_FLOW,nt(n,!1))}function me(s,n){let{singleQuote:r}=n.options,o;if(r===!1)o=Le;else{let a=s.includes('"'),l=s.includes("'");if(a&&!l)o=Rt;else if(l&&!a)o=Le;else o=r?Rt:Le}return o(s,n)}var Ft;try{Ft=new RegExp(`(^|(?<!
|
|
18
|
-
))
|
|
19
|
-
+(?!
|
|
20
|
-
|$)`,"g")}catch{Ft=/\n+(?!\n|$)/g}function st({comment:s,type:n,value:r},o,a,l){let{blockQuote:c,commentString:u,lineWidth:h}=o.options;if(!c||/\n[\t ]+$/.test(r))return me(r,o);let d=o.indent||(o.forceBlockIndent||it(r)?" ":""),g=c==="literal"?!0:c==="folded"||n===F.Scalar.BLOCK_FOLDED?!1:n===F.Scalar.BLOCK_LITERAL?!0:!Jo(r,h,d.length);if(!r)return g?`|
|
|
21
|
-
`:`>
|
|
22
|
-
`;let p,m;for(m=r.length;m>0;--m){let C=r[m-1];if(C!==`
|
|
23
|
-
`&&C!=="\t"&&C!==" ")break}let S=r.substring(m),k=S.indexOf(`
|
|
24
|
-
`);if(k===-1)p="-";else if(r===S||k!==S.length-1){if(p="+",l)l()}else p="";if(S){if(r=r.slice(0,-S.length),S[S.length-1]===`
|
|
25
|
-
`)S=S.slice(0,-1);S=S.replace(Ft,`$&${d}`)}let y=!1,w,A=-1;for(w=0;w<r.length;++w){let C=r[w];if(C===" ")y=!0;else if(C===`
|
|
26
|
-
`)A=w;else break}let O=r.substring(0,A<w?A+1:w);if(O)r=r.substring(O.length),O=O.replace(/\n+/g,`$&${d}`);let L=(y?d?"2":"1":"")+p;if(s){if(L+=" "+u(s.replace(/ ?[\r\n]+/g," ")),a)a()}if(!g){let C=r.replace(/\n+/g,`
|
|
27
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${d}`),_=!1,P=nt(o,!0);if(c!=="folded"&&n!==F.Scalar.BLOCK_FOLDED)P.onOverflow=()=>{_=!0};let N=G.foldFlowLines(`${O}${C}${S}`,d,G.FOLD_BLOCK,P);if(!_)return`>${L}
|
|
28
|
-
${d}${N}`}return r=r.replace(/\n+/g,`$&${d}`),`|${L}
|
|
29
|
-
${d}${O}${r}${S}`}function Vo(s,n,r,o){let{type:a,value:l}=s,{actualString:c,implicitKey:u,indent:h,indentStep:d,inFlow:g}=n;if(u&&l.includes(`
|
|
30
|
-
`)||g&&/[[\]{},]/.test(l))return me(l,n);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(l))return u||g||!l.includes(`
|
|
31
|
-
`)?me(l,n):st(s,n,r,o);if(!u&&!g&&a!==F.Scalar.PLAIN&&l.includes(`
|
|
32
|
-
`))return st(s,n,r,o);if(it(l)){if(h==="")return n.forceBlockIndent=!0,st(s,n,r,o);else if(u&&h===d)return me(l,n)}let p=l.replace(/\n+/g,`$&
|
|
33
|
-
${h}`);if(c){let m=(y)=>y.default&&y.tag!=="tag:yaml.org,2002:str"&&y.test?.test(p),{compat:S,tags:k}=n.doc.schema;if(k.some(m)||S?.some(m))return me(l,n)}return u?p:G.foldFlowLines(p,h,G.FOLD_FLOW,nt(n,!1))}function Wo(s,n,r,o){let{implicitKey:a,inFlow:l}=n,c=typeof s.value==="string"?s:Object.assign({},s,{value:String(s.value)}),{type:u}=s;if(u!==F.Scalar.QUOTE_DOUBLE){if(/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(c.value))u=F.Scalar.QUOTE_DOUBLE}let h=(g)=>{switch(g){case F.Scalar.BLOCK_FOLDED:case F.Scalar.BLOCK_LITERAL:return a||l?me(c.value,n):st(c,n,r,o);case F.Scalar.QUOTE_DOUBLE:return Le(c.value,n);case F.Scalar.QUOTE_SINGLE:return Rt(c.value,n);case F.Scalar.PLAIN:return Vo(c,n,r,o);default:return null}},d=h(u);if(d===null){let{defaultKeyType:g,defaultStringType:p}=n.options,m=a&&g||p;if(d=h(m),d===null)throw Error(`Unsupported default string type ${m}`)}return d}Qo.stringifyString=Wo});var Ce=v(function(na){var Go=ze(),X=I(),Xo=Ee(),zo=Te();function Zo(s,n){let r=Object.assign({blockQuote:!0,commentString:Xo.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trueStr:"true",verifyAliasOrder:!0},s.schema.toStringOptions,n),o;switch(r.collectionStyle){case"block":o=!1;break;case"flow":o=!0;break;default:o=null}return{anchors:new Set,doc:s,flowCollectionPadding:r.flowCollectionPadding?" ":"",indent:"",indentStep:typeof r.indent==="number"?" ".repeat(r.indent):" ",inFlow:o,options:r}}function ea(s,n){if(n.tag){let a=s.filter((l)=>l.tag===n.tag);if(a.length>0)return a.find((l)=>l.format===n.format)??a[0]}let r=void 0,o;if(X.isScalar(n)){o=n.value;let a=s.filter((l)=>l.identify?.(o));if(a.length>1){let l=a.filter((c)=>c.test);if(l.length>0)a=l}r=a.find((l)=>l.format===n.format)??a.find((l)=>!l.format)}else o=n,r=s.find((a)=>a.nodeClass&&o instanceof a.nodeClass);if(!r){let a=o?.constructor?.name??(o===null?"null":typeof o);throw Error(`Tag not resolved for ${a} value`)}return r}function ta(s,n,{anchors:r,doc:o}){if(!o.directives)return"";let a=[],l=(X.isScalar(s)||X.isCollection(s))&&s.anchor;if(l&&Go.anchorIsValid(l))r.add(l),a.push(`&${l}`);let c=s.tag??(n.default?null:n.tag);if(c)a.push(o.directives.tagString(c));return a.join(" ")}function sa(s,n,r,o){if(X.isPair(s))return s.toString(n,r,o);if(X.isAlias(s)){if(n.doc.directives)return s.toString(n);if(n.resolvedAliases?.has(s))throw TypeError("Cannot stringify circular structure without alias nodes");else{if(n.resolvedAliases)n.resolvedAliases.add(s);else n.resolvedAliases=new Set([s]);s=s.resolve(n.doc)}}let a=void 0,l=X.isNode(s)?s:n.doc.createNode(s,{onTagObj:(h)=>a=h});a??(a=ea(n.doc.schema.tags,l));let c=ta(l,a,n);if(c.length>0)n.indentAtStart=(n.indentAtStart??0)+c.length+1;let u=typeof a.stringify==="function"?a.stringify(l,n,r,o):X.isScalar(l)?zo.stringifyString(l,n,r,o):l.toString(n,r,o);if(!c)return u;return X.isScalar(l)||u[0]==="{"||u[0]==="["?`${c} ${u}`:`${c}
|
|
34
|
-
${n.indent}${u}`}na.createStringifyContext=Zo;na.stringify=sa});var bn=v(function(aa){var W=I(),yn=M(),gn=Ce(),_e=Ee();function oa({key:s,value:n},r,o,a){let{allNullValues:l,doc:c,indent:u,indentStep:h,options:{commentString:d,indentSeq:g,simpleKeys:p}}=r,m=W.isNode(s)&&s.comment||null;if(p){if(m)throw Error("With simple keys, key nodes cannot have comments");if(W.isCollection(s)||!W.isNode(s)&&typeof s==="object")throw Error("With simple keys, collection cannot be used as a key value")}let S=!p&&(!s||m&&n==null&&!r.inFlow||W.isCollection(s)||(W.isScalar(s)?s.type===yn.Scalar.BLOCK_FOLDED||s.type===yn.Scalar.BLOCK_LITERAL:typeof s==="object"));r=Object.assign({},r,{allNullValues:!1,implicitKey:!S&&(p||!l),indent:u+h});let k=!1,y=!1,w=gn.stringify(s,r,()=>k=!0,()=>y=!0);if(!S&&!r.inFlow&&w.length>1024){if(p)throw Error("With simple keys, single line scalar must not span more than 1024 characters");S=!0}if(r.inFlow){if(l||n==null){if(k&&o)o();return w===""?"?":S?`? ${w}`:w}}else if(l&&!p||n==null&&S){if(w=`? ${w}`,m&&!k)w+=_e.lineComment(w,r.indent,d(m));else if(y&&a)a();return w}if(k)m=null;if(S){if(m)w+=_e.lineComment(w,r.indent,d(m));w=`? ${w}
|
|
35
|
-
${u}:`}else if(w=`${w}:`,m)w+=_e.lineComment(w,r.indent,d(m));let A,O,q;if(W.isNode(n))A=!!n.spaceBefore,O=n.commentBefore,q=n.comment;else if(A=!1,O=null,q=null,n&&typeof n==="object")n=c.createNode(n);if(r.implicitKey=!1,!S&&!m&&W.isScalar(n))r.indentAtStart=w.length+1;if(y=!1,!g&&h.length>=2&&!r.inFlow&&!S&&W.isSeq(n)&&!n.flow&&!n.tag&&!n.anchor)r.indent=r.indent.substring(2);let L=!1,C=gn.stringify(n,r,()=>L=!0,()=>y=!0),_=" ";if(m||A||O){if(_=A?`
|
|
36
|
-
`:"",O){let P=d(O);_+=`
|
|
37
|
-
${_e.indentComment(P,r.indent)}`}if(C===""&&!r.inFlow){if(_===`
|
|
38
|
-
`)_=`
|
|
39
|
-
|
|
40
|
-
`}else _+=`
|
|
41
|
-
${r.indent}`}else if(!S&&W.isCollection(n)){let P=C[0],N=C.indexOf(`
|
|
42
|
-
`),x=N!==-1,Q=r.inFlow??n.flow??n.items.length===0;if(x||!Q){let ue=!1;if(x&&(P==="&"||P==="!")){let D=C.indexOf(" ");if(P==="&"&&D!==-1&&D<N&&C[D+1]==="!")D=C.indexOf(" ",D+1);if(D===-1||N<D)ue=!0}if(!ue)_=`
|
|
43
|
-
${r.indent}`}}else if(C===""||C[0]===`
|
|
44
|
-
`)_="";if(w+=_+C,r.inFlow){if(L&&o)o()}else if(q&&!L)w+=_e.lineComment(w,r.indent,d(q));else if(y&&a)a();return w}aa.stringifyPair=oa});var Ut=v(function(ua){var wn=We("process");function ca(s,...n){if(s==="debug")console.log(...n)}function fa(s,n){if(s==="debug"||s==="warn")if(typeof wn.emitWarning==="function")wn.emitWarning(n);else console.warn(n)}ua.debug=ca;ua.warn=fa});var at=v(function(ma){var Ie=I(),Sn=M(),rt="<<",ot={identify:(s)=>s===rt||typeof s==="symbol"&&s.description===rt,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Sn.Scalar(Symbol(rt)),{addToJSMap:vn}),stringify:()=>rt},pa=(s,n)=>(ot.identify(n)||Ie.isScalar(n)&&(!n.type||n.type===Sn.Scalar.PLAIN)&&ot.identify(n.value))&&s?.doc.schema.tags.some((r)=>r.tag===ot.tag&&r.default);function vn(s,n,r){if(r=s&&Ie.isAlias(r)?r.resolve(s.doc):r,Ie.isSeq(r))for(let o of r.items)Yt(s,n,o);else if(Array.isArray(r))for(let o of r)Yt(s,n,o);else Yt(s,n,r)}function Yt(s,n,r){let o=s&&Ie.isAlias(r)?r.resolve(s.doc):r;if(!Ie.isMap(o))throw Error("Merge sources must be maps or map aliases");let a=o.toJSON(null,s,Map);for(let[l,c]of a)if(n instanceof Map){if(!n.has(l))n.set(l,c)}else if(n instanceof Set)n.add(l);else if(!Object.prototype.hasOwnProperty.call(n,l))Object.defineProperty(n,l,{value:c,writable:!0,enumerable:!0,configurable:!0});return n}ma.addMergeToJSMap=vn;ma.isMergeKey=pa;ma.merge=ot});var Vt=v(function(Na){var wa=Ut(),kn=at(),Sa=Ce(),Nn=I(),Jt=H();function va(s,n,{key:r,value:o}){if(Nn.isNode(r)&&r.addToJSMap)r.addToJSMap(s,n,o);else if(kn.isMergeKey(s,r))kn.addMergeToJSMap(s,n,o);else{let a=Jt.toJS(r,"",s);if(n instanceof Map)n.set(a,Jt.toJS(o,a,s));else if(n instanceof Set)n.add(a);else{let l=ka(r,a,s),c=Jt.toJS(o,l,s);if(l in n)Object.defineProperty(n,l,{value:c,writable:!0,enumerable:!0,configurable:!0});else n[l]=c}}return n}function ka(s,n,r){if(n===null)return"";if(typeof n!=="object")return String(n);if(Nn.isNode(s)&&r?.doc){let o=Sa.createStringifyContext(r.doc,{});o.anchors=new Set;for(let l of r.anchors.keys())o.anchors.add(l.anchor);o.inFlow=!0,o.inStringifyKey=!0;let a=s.toString(o);if(!r.mapKeyWarned){let l=JSON.stringify(a);if(l.length>40)l=l.substring(0,36)+'..."';wa.warn(r.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${l}. Set mapAsMap: true to use object keys.`),r.mapKeyWarned=!0}return a}return JSON.stringify(n)}Na.addPairToJSMap=va});var z=v(function(La){var An=qe(),Oa=bn(),qa=Vt(),lt=I();function Ea(s,n,r){let o=An.createNode(s,void 0,r),a=An.createNode(n,void 0,r);return new ct(o,a)}class ct{constructor(s,n=null){Object.defineProperty(this,lt.NODE_TYPE,{value:lt.PAIR}),this.key=s,this.value=n}clone(s){let{key:n,value:r}=this;if(lt.isNode(n))n=n.clone(s);if(lt.isNode(r))r=r.clone(s);return new ct(n,r)}toJSON(s,n){let r=n?.mapAsMap?new Map:{};return qa.addPairToJSMap(n,r,this)}toString(s,n,r){return s?.doc?Oa.stringifyPair(this,s,n,r):JSON.stringify(this)}}La.Pair=ct;La.createPair=Ea});var Wt=v(function($a){var oe=I(),On=Ce(),ft=Ee();function _a(s,n,r){return(n.inFlow??s.flow?Pa:Ia)(s,n,r)}function Ia({comment:s,items:n},r,{blockItemPrefix:o,flowChars:a,itemIndent:l,onChompKeep:c,onComment:u}){let{indent:h,options:{commentString:d}}=r,g=Object.assign({},r,{indent:l,type:null}),p=!1,m=[];for(let k=0;k<n.length;++k){let y=n[k],w=null;if(oe.isNode(y)){if(!p&&y.spaceBefore)m.push("");if(ut(r,m,y.commentBefore,p),y.comment)w=y.comment}else if(oe.isPair(y)){let O=oe.isNode(y.key)?y.key:null;if(O){if(!p&&O.spaceBefore)m.push("");ut(r,m,O.commentBefore,p)}}p=!1;let A=On.stringify(y,g,()=>w=null,()=>p=!0);if(w)A+=ft.lineComment(A,l,d(w));if(p&&w)p=!1;m.push(o+A)}let S;if(m.length===0)S=a.start+a.end;else{S=m[0];for(let k=1;k<m.length;++k){let y=m[k];S+=y?`
|
|
45
|
-
${h}${y}`:`
|
|
46
|
-
`}}if(s){if(S+=`
|
|
47
|
-
`+ft.indentComment(d(s),h),u)u()}else if(p&&c)c();return S}function Pa({items:s},n,{flowChars:r,itemIndent:o}){let{indent:a,indentStep:l,flowCollectionPadding:c,options:{commentString:u}}=n;o+=l;let h=Object.assign({},n,{indent:o,inFlow:!0,type:null}),d=!1,g=0,p=[];for(let k=0;k<s.length;++k){let y=s[k],w=null;if(oe.isNode(y)){if(y.spaceBefore)p.push("");if(ut(n,p,y.commentBefore,!1),y.comment)w=y.comment}else if(oe.isPair(y)){let O=oe.isNode(y.key)?y.key:null;if(O){if(O.spaceBefore)p.push("");if(ut(n,p,O.commentBefore,!1),O.comment)d=!0}let q=oe.isNode(y.value)?y.value:null;if(q){if(q.comment)w=q.comment;if(q.commentBefore)d=!0}else if(y.value==null&&O?.comment)w=O.comment}if(w)d=!0;let A=On.stringify(y,h,()=>w=null);if(k<s.length-1)A+=",";if(w)A+=ft.lineComment(A,o,u(w));if(!d&&(p.length>g||A.includes(`
|
|
48
|
-
`)))d=!0;p.push(A),g=p.length}let{start:m,end:S}=r;if(p.length===0)return m+S;else{if(!d){let k=p.reduce((y,w)=>y+w.length+2,2);d=n.options.lineWidth>0&&k>n.options.lineWidth}if(d){let k=m;for(let y of p)k+=y?`
|
|
49
|
-
${l}${a}${y}`:`
|
|
50
|
-
`;return`${k}
|
|
51
|
-
${a}${S}`}else return`${m}${c}${p.join(" ")}${c}${S}`}}function ut({indent:s,options:{commentString:n}},r,o,a){if(o&&a)o=o.replace(/^\n+/,"");if(o){let l=ft.indentComment(n(o),s);r.push(l.trimStart())}}$a.stringifyCollection=_a});var ee=v(function(Ka){var xa=Wt(),Da=Vt(),Ba=tt(),Z=I(),ht=z(),ja=M();function Pe(s,n){let r=Z.isScalar(n)?n.value:n;for(let o of s)if(Z.isPair(o)){if(o.key===n||o.key===r)return o;if(Z.isScalar(o.key)&&o.key.value===r)return o}return}class qn extends Ba.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(s){super(Z.MAP,s);this.items=[]}static from(s,n,r){let{keepUndefined:o,replacer:a}=r,l=new this(s),c=(u,h)=>{if(typeof a==="function")h=a.call(n,u,h);else if(Array.isArray(a)&&!a.includes(u))return;if(h!==void 0||o)l.items.push(ht.createPair(u,h,r))};if(n instanceof Map)for(let[u,h]of n)c(u,h);else if(n&&typeof n==="object")for(let u of Object.keys(n))c(u,n[u]);if(typeof s.sortMapEntries==="function")l.items.sort(s.sortMapEntries);return l}add(s,n){let r;if(Z.isPair(s))r=s;else if(!s||typeof s!=="object"||!("key"in s))r=new ht.Pair(s,s?.value);else r=new ht.Pair(s.key,s.value);let o=Pe(this.items,r.key),a=this.schema?.sortMapEntries;if(o){if(!n)throw Error(`Key ${r.key} already set`);if(Z.isScalar(o.value)&&ja.isScalarValue(r.value))o.value.value=r.value;else o.value=r.value}else if(a){let l=this.items.findIndex((c)=>a(r,c)<0);if(l===-1)this.items.push(r);else this.items.splice(l,0,r)}else this.items.push(r)}delete(s){let n=Pe(this.items,s);if(!n)return!1;return this.items.splice(this.items.indexOf(n),1).length>0}get(s,n){let o=Pe(this.items,s)?.value;return(!n&&Z.isScalar(o)?o.value:o)??void 0}has(s){return!!Pe(this.items,s)}set(s,n){this.add(new ht.Pair(s,n),!0)}toJSON(s,n,r){let o=r?new r:n?.mapAsMap?new Map:{};if(n?.onCreate)n.onCreate(o);for(let a of this.items)Da.addPairToJSMap(n,o,a);return o}toString(s,n,r){if(!s)return JSON.stringify(this);for(let o of this.items)if(!Z.isPair(o))throw Error(`Map items must all be pairs; found ${JSON.stringify(o)} instead`);if(!s.allNullValues&&this.hasAllNullValues(!1))s=Object.assign({},s,{allNullValues:!0});return xa.stringifyCollection(this,s,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:s.indent||"",onChompKeep:r,onComment:n})}}Ka.YAMLMap=qn;Ka.findPair=Pe});var ye=v(function(Ja){var Ua=I(),En=ee(),Ya={collection:"map",default:!0,nodeClass:En.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(s,n){if(!Ua.isMap(s))n("Expected a mapping for this tag");return s},createNode:(s,n,r)=>En.YAMLMap.from(s,n,r)};Ja.map=Ya});var te=v(function(za){var Wa=qe(),Qa=Wt(),Ha=tt(),pt=I(),Ga=M(),Xa=H();class Ln extends Ha.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(s){super(pt.SEQ,s);this.items=[]}add(s){this.items.push(s)}delete(s){let n=dt(s);if(typeof n!=="number")return!1;return this.items.splice(n,1).length>0}get(s,n){let r=dt(s);if(typeof r!=="number")return;let o=this.items[r];return!n&&pt.isScalar(o)?o.value:o}has(s){let n=dt(s);return typeof n==="number"&&n<this.items.length}set(s,n){let r=dt(s);if(typeof r!=="number")throw Error(`Expected a valid index, not ${s}.`);let o=this.items[r];if(pt.isScalar(o)&&Ga.isScalarValue(n))o.value=n;else this.items[r]=n}toJSON(s,n){let r=[];if(n?.onCreate)n.onCreate(r);let o=0;for(let a of this.items)r.push(Xa.toJS(a,String(o++),n));return r}toString(s,n,r){if(!s)return JSON.stringify(this);return Qa.stringifyCollection(this,s,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(s.indent||"")+" ",onChompKeep:r,onComment:n})}static from(s,n,r){let{replacer:o}=r,a=new this(s);if(n&&Symbol.iterator in Object(n)){let l=0;for(let c of n){if(typeof o==="function"){let u=n instanceof Set?c:String(l++);c=o.call(n,u,c)}a.items.push(Wa.createNode(c,void 0,r))}}return a}}function dt(s){let n=pt.isScalar(s)?s.value:s;if(n&&typeof n==="string")n=Number(n);return typeof n==="number"&&Number.isInteger(n)&&n>=0?n:null}za.YAMLSeq=Ln});var ge=v(function(sl){var el=I(),Tn=te(),tl={collection:"seq",default:!0,nodeClass:Tn.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(s,n){if(!el.isSeq(s))n("Expected a sequence for this tag");return s},createNode:(s,n,r)=>Tn.YAMLSeq.from(s,n,r)};sl.seq=tl});var $e=v(function(ol){var il=Te(),rl={identify:(s)=>typeof s==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:(s)=>s,stringify(s,n,r,o){return n=Object.assign({actualString:!0},n),il.stringifyString(s,n,r,o)}};ol.string=rl});var mt=v(function(ll){var Cn=M(),_n={identify:(s)=>s==null,createNode:()=>new Cn.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Cn.Scalar(null),stringify:({source:s},n)=>typeof s==="string"&&_n.test.test(s)?s:n.options.nullStr};ll.nullTag=_n});var Qt=v(function(ul){var fl=M(),In={identify:(s)=>typeof s==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:(s)=>new fl.Scalar(s[0]==="t"||s[0]==="T"),stringify({source:s,value:n},r){if(s&&In.test.test(s)){let o=s[0]==="t"||s[0]==="T";if(n===o)return s}return n?r.options.trueStr:r.options.falseStr}};ul.boolTag=In});var be=v(function(pl){function dl({format:s,minFractionDigits:n,tag:r,value:o}){if(typeof o==="bigint")return String(o);let a=typeof o==="number"?o:Number(o);if(!isFinite(a))return isNaN(a)?".nan":a<0?"-.inf":".inf";let l=JSON.stringify(o);if(!s&&n&&(!r||r==="tag:yaml.org,2002:float")&&/^\d/.test(l)){let c=l.indexOf(".");if(c<0)c=l.length,l+=".";let u=n-(l.length-c-1);while(u-- >0)l+="0"}return l}pl.stringifyNumber=dl});var Gt=v(function(Sl){var yl=M(),Ht=be(),gl={identify:(s)=>typeof s==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:(s)=>s.slice(-3).toLowerCase()==="nan"?NaN:s[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Ht.stringifyNumber},bl={identify:(s)=>typeof s==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:(s)=>parseFloat(s),stringify(s){let n=Number(s.value);return isFinite(n)?n.toExponential():Ht.stringifyNumber(s)}},wl={identify:(s)=>typeof s==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(s){let n=new yl.Scalar(parseFloat(s)),r=s.indexOf(".");if(r!==-1&&s[s.length-1]==="0")n.minFractionDigits=s.length-r-1;return n},stringify:Ht.stringifyNumber};Sl.float=wl;Sl.floatExp=bl;Sl.floatNaN=gl});var zt=v(function(El){var Pn=be(),yt=(s)=>typeof s==="bigint"||Number.isInteger(s),Xt=(s,n,r,{intAsBigInt:o})=>o?BigInt(s):parseInt(s.substring(n),r);function $n(s,n,r){let{value:o}=s;if(yt(o)&&o>=0)return r+o.toString(n);return Pn.stringifyNumber(s)}var Al={identify:(s)=>yt(s)&&s>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(s,n,r)=>Xt(s,2,8,r),stringify:(s)=>$n(s,8,"0o")},Ol={identify:yt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(s,n,r)=>Xt(s,0,10,r),stringify:Pn.stringifyNumber},ql={identify:(s)=>yt(s)&&s>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(s,n,r)=>Xt(s,2,16,r),stringify:(s)=>$n(s,16,"0x")};El.int=Ol;El.intHex=ql;El.intOct=Al});var Mn=v(function(Dl){var _l=ye(),Il=mt(),Pl=ge(),$l=$e(),Ml=Qt(),Zt=Gt(),es=zt(),xl=[_l.map,Pl.seq,$l.string,Il.nullTag,Ml.boolTag,es.intOct,es.int,es.intHex,Zt.floatNaN,Zt.floatExp,Zt.float];Dl.schema=xl});var Dn=v(function(Jl){var jl=M(),Kl=ye(),Rl=ge();function xn(s){return typeof s==="bigint"||Number.isInteger(s)}var gt=({value:s})=>JSON.stringify(s),Fl=[{identify:(s)=>typeof s==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:(s)=>s,stringify:gt},{identify:(s)=>s==null,createNode:()=>new jl.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:gt},{identify:(s)=>typeof s==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:(s)=>s==="true",stringify:gt},{identify:xn,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(s,n,{intAsBigInt:r})=>r?BigInt(s):parseInt(s,10),stringify:({value:s})=>xn(s)?s.toString():JSON.stringify(s)},{identify:(s)=>typeof s==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:(s)=>parseFloat(s),stringify:gt}],Ul={default:!0,tag:"",test:/^/,resolve(s,n){return n(`Unresolved plain scalar ${JSON.stringify(s)}`),s}},Yl=[Kl.map,Rl.seq].concat(Fl,Ul);Jl.schema=Yl});var ss=v(function(Hl){var Me=We("buffer"),ts=M(),Wl=Te(),Ql={identify:(s)=>s instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(s,n){if(typeof Me.Buffer==="function")return Me.Buffer.from(s,"base64");else if(typeof atob==="function"){let r=atob(s.replace(/[\n\r]/g,"")),o=new Uint8Array(r.length);for(let a=0;a<r.length;++a)o[a]=r.charCodeAt(a);return o}else return n("This environment does not support reading binary tags; either Buffer or atob is required"),s},stringify({comment:s,type:n,value:r},o,a,l){if(!r)return"";let c=r,u;if(typeof Me.Buffer==="function")u=c instanceof Me.Buffer?c.toString("base64"):Me.Buffer.from(c.buffer).toString("base64");else if(typeof btoa==="function"){let h="";for(let d=0;d<c.length;++d)h+=String.fromCharCode(c[d]);u=btoa(h)}else throw Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(n??(n=ts.Scalar.BLOCK_LITERAL),n!==ts.Scalar.QUOTE_DOUBLE){let h=Math.max(o.options.lineWidth-o.indent.length,o.options.minContentWidth),d=Math.ceil(u.length/h),g=Array(d);for(let p=0,m=0;p<d;++p,m+=h)g[p]=u.substr(m,h);u=g.join(n===ts.Scalar.BLOCK_LITERAL?`
|
|
52
|
-
`:" ")}return Wl.stringifyString({comment:s,type:n,value:u},o,a,l)}};Hl.binary=Ql});var wt=v(function(ec){var bt=I(),ns=z(),Xl=M(),zl=te();function Bn(s,n){if(bt.isSeq(s))for(let r=0;r<s.items.length;++r){let o=s.items[r];if(bt.isPair(o))continue;else if(bt.isMap(o)){if(o.items.length>1)n("Each pair must have its own sequence indicator");let a=o.items[0]||new ns.Pair(new Xl.Scalar(null));if(o.commentBefore)a.key.commentBefore=a.key.commentBefore?`${o.commentBefore}
|
|
53
|
-
${a.key.commentBefore}`:o.commentBefore;if(o.comment){let l=a.value??a.key;l.comment=l.comment?`${o.comment}
|
|
54
|
-
${l.comment}`:o.comment}o=a}s.items[r]=bt.isPair(o)?o:new ns.Pair(o)}else n("Expected a sequence for this tag");return s}function jn(s,n,r){let{replacer:o}=r,a=new zl.YAMLSeq(s);a.tag="tag:yaml.org,2002:pairs";let l=0;if(n&&Symbol.iterator in Object(n))for(let c of n){if(typeof o==="function")c=o.call(n,String(l++),c);let u,h;if(Array.isArray(c))if(c.length===2)u=c[0],h=c[1];else throw TypeError(`Expected [key, value] tuple: ${c}`);else if(c&&c instanceof Object){let d=Object.keys(c);if(d.length===1)u=d[0],h=c[u];else throw TypeError(`Expected tuple with one key, not ${d.length} keys`)}else u=c;a.items.push(ns.createPair(u,h,r))}return a}var Zl={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Bn,createNode:jn};ec.createPairs=jn;ec.pairs=Zl;ec.resolvePairs=Bn});var rs=v(function(oc){var Kn=I(),is=H(),xe=ee(),ic=te(),Rn=wt();class ae extends ic.YAMLSeq{constructor(){super();this.add=xe.YAMLMap.prototype.add.bind(this),this.delete=xe.YAMLMap.prototype.delete.bind(this),this.get=xe.YAMLMap.prototype.get.bind(this),this.has=xe.YAMLMap.prototype.has.bind(this),this.set=xe.YAMLMap.prototype.set.bind(this),this.tag=ae.tag}toJSON(s,n){if(!n)return super.toJSON(s);let r=new Map;if(n?.onCreate)n.onCreate(r);for(let o of this.items){let a,l;if(Kn.isPair(o))a=is.toJS(o.key,"",n),l=is.toJS(o.value,a,n);else a=is.toJS(o,"",n);if(r.has(a))throw Error("Ordered maps must not include duplicate keys");r.set(a,l)}return r}static from(s,n,r){let o=Rn.createPairs(s,n,r),a=new this;return a.items=o.items,a}}ae.tag="tag:yaml.org,2002:omap";var rc={collection:"seq",identify:(s)=>s instanceof Map,nodeClass:ae,default:!1,tag:"tag:yaml.org,2002:omap",resolve(s,n){let r=Rn.resolvePairs(s,n),o=[];for(let{key:a}of r.items)if(Kn.isScalar(a))if(o.includes(a.value))n(`Ordered maps must not include duplicate keys: ${a.value}`);else o.push(a.value);return Object.assign(new ae,r)},createNode:(s,n,r)=>ae.from(s,n,r)};oc.YAMLOMap=ae;oc.omap=rc});var Vn=v(function(cc){var Fn=M();function Un({value:s,source:n},r){if(n&&(s?Yn:Jn).test.test(n))return n;return s?r.options.trueStr:r.options.falseStr}var Yn={identify:(s)=>s===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Fn.Scalar(!0),stringify:Un},Jn={identify:(s)=>s===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Fn.Scalar(!1),stringify:Un};cc.falseTag=Jn;cc.trueTag=Yn});var Wn=v(function(yc){var hc=M(),os=be(),dc={identify:(s)=>typeof s==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:(s)=>s.slice(-3).toLowerCase()==="nan"?NaN:s[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:os.stringifyNumber},pc={identify:(s)=>typeof s==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:(s)=>parseFloat(s.replace(/_/g,"")),stringify(s){let n=Number(s.value);return isFinite(n)?n.toExponential():os.stringifyNumber(s)}},mc={identify:(s)=>typeof s==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(s){let n=new hc.Scalar(parseFloat(s.replace(/_/g,""))),r=s.indexOf(".");if(r!==-1){let o=s.substring(r+1).replace(/_/g,"");if(o[o.length-1]==="0")n.minFractionDigits=o.length}return n},stringify:os.stringifyNumber};yc.float=mc;yc.floatExp=pc;yc.floatNaN=dc});var Hn=v(function(Ac){var Qn=be(),De=(s)=>typeof s==="bigint"||Number.isInteger(s);function St(s,n,r,{intAsBigInt:o}){let a=s[0];if(a==="-"||a==="+")n+=1;if(s=s.substring(n).replace(/_/g,""),o){switch(r){case 2:s=`0b${s}`;break;case 8:s=`0o${s}`;break;case 16:s=`0x${s}`;break}let c=BigInt(s);return a==="-"?BigInt(-1)*c:c}let l=parseInt(s,r);return a==="-"?-1*l:l}function as(s,n,r){let{value:o}=s;if(De(o)){let a=o.toString(n);return o<0?"-"+r+a.substr(1):r+a}return Qn.stringifyNumber(s)}var Sc={identify:De,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(s,n,r)=>St(s,2,2,r),stringify:(s)=>as(s,2,"0b")},vc={identify:De,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(s,n,r)=>St(s,1,8,r),stringify:(s)=>as(s,8,"0")},kc={identify:De,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(s,n,r)=>St(s,0,10,r),stringify:Qn.stringifyNumber},Nc={identify:De,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(s,n,r)=>St(s,2,16,r),stringify:(s)=>as(s,16,"0x")};Ac.int=kc;Ac.intBin=Sc;Ac.intHex=Nc;Ac.intOct=vc});var ls=v(function(Cc){var Nt=I(),vt=z(),kt=ee();class le extends kt.YAMLMap{constructor(s){super(s);this.tag=le.tag}add(s){let n;if(Nt.isPair(s))n=s;else if(s&&typeof s==="object"&&"key"in s&&"value"in s&&s.value===null)n=new vt.Pair(s.key,null);else n=new vt.Pair(s,null);if(!kt.findPair(this.items,n.key))this.items.push(n)}get(s,n){let r=kt.findPair(this.items,s);return!n&&Nt.isPair(r)?Nt.isScalar(r.key)?r.key.value:r.key:r}set(s,n){if(typeof n!=="boolean")throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);let r=kt.findPair(this.items,s);if(r&&!n)this.items.splice(this.items.indexOf(r),1);else if(!r&&n)this.items.push(new vt.Pair(s))}toJSON(s,n){return super.toJSON(s,n,Set)}toString(s,n,r){if(!s)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},s,{allNullValues:!0}),n,r);else throw Error("Set items must all have null values")}static from(s,n,r){let{replacer:o}=r,a=new this(s);if(n&&Symbol.iterator in Object(n))for(let l of n){if(typeof o==="function")l=o.call(n,l,l);a.items.push(vt.createPair(l,null,r))}return a}}le.tag="tag:yaml.org,2002:set";var Tc={collection:"map",identify:(s)=>s instanceof Set,nodeClass:le,default:!1,tag:"tag:yaml.org,2002:set",createNode:(s,n,r)=>le.from(s,n,r),resolve(s,n){if(Nt.isMap(s))if(s.hasAllNullValues(!0))return Object.assign(new le,s);else n("Set items must all have null values");else n("Expected a mapping for this tag");return s}};Cc.YAMLSet=le;Cc.set=Tc});var fs=v(function(xc){var Pc=be();function cs(s,n){let r=s[0],o=r==="-"||r==="+"?s.substring(1):s,a=(c)=>n?BigInt(c):Number(c),l=o.replace(/_/g,"").split(":").reduce((c,u)=>c*a(60)+a(u),a(0));return r==="-"?a(-1)*l:l}function Gn(s){let{value:n}=s,r=(c)=>c;if(typeof n==="bigint")r=(c)=>BigInt(c);else if(isNaN(n)||!isFinite(n))return Pc.stringifyNumber(s);let o="";if(n<0)o="-",n*=r(-1);let a=r(60),l=[n%a];if(n<60)l.unshift(0);else if(n=(n-l[0])/a,l.unshift(n%a),n>=60)n=(n-l[0])/a,l.unshift(n);return o+l.map((c)=>String(c).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var $c={identify:(s)=>typeof s==="bigint"||Number.isInteger(s),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(s,n,{intAsBigInt:r})=>cs(s,r),stringify:Gn},Mc={identify:(s)=>typeof s==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:(s)=>cs(s,!1),stringify:Gn},Xn={identify:(s)=>s 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(s){let n=s.match(Xn.test);if(!n)throw Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,r,o,a,l,c,u]=n.map(Number),h=n[7]?Number((n[7]+"00").substr(1,3)):0,d=Date.UTC(r,o-1,a,l||0,c||0,u||0,h),g=n[8];if(g&&g!=="Z"){let p=cs(g,!1);if(Math.abs(p)<30)p*=60;d-=60000*p}return new Date(d)},stringify:({value:s})=>s?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};xc.floatTime=Mc;xc.intTime=$c;xc.timestamp=Xn});var Zn=v(function(Gc){var Kc=ye(),Rc=mt(),Fc=ge(),Uc=$e(),Yc=ss(),zn=Vn(),us=Wn(),At=Hn(),Jc=at(),Vc=rs(),Wc=wt(),Qc=ls(),hs=fs(),Hc=[Kc.map,Fc.seq,Uc.string,Rc.nullTag,zn.trueTag,zn.falseTag,At.intBin,At.intOct,At.int,At.intHex,us.floatNaN,us.floatExp,us.float,Yc.binary,Jc.merge,Vc.omap,Wc.pairs,Qc.set,hs.intTime,hs.floatTime,hs.timestamp];Gc.schema=Hc});var ci=v(function(of){var ni=ye(),zc=mt(),ii=ge(),Zc=$e(),ef=Qt(),ds=Gt(),ps=zt(),tf=Mn(),sf=Dn(),ri=ss(),Be=at(),oi=rs(),ai=wt(),ei=Zn(),li=ls(),Ot=fs(),ti=new Map([["core",tf.schema],["failsafe",[ni.map,ii.seq,Zc.string]],["json",sf.schema],["yaml11",ei.schema],["yaml-1.1",ei.schema]]),si={binary:ri.binary,bool:ef.boolTag,float:ds.float,floatExp:ds.floatExp,floatNaN:ds.floatNaN,floatTime:Ot.floatTime,int:ps.int,intHex:ps.intHex,intOct:ps.intOct,intTime:Ot.intTime,map:ni.map,merge:Be.merge,null:zc.nullTag,omap:oi.omap,pairs:ai.pairs,seq:ii.seq,set:li.set,timestamp:Ot.timestamp},nf={"tag:yaml.org,2002:binary":ri.binary,"tag:yaml.org,2002:merge":Be.merge,"tag:yaml.org,2002:omap":oi.omap,"tag:yaml.org,2002:pairs":ai.pairs,"tag:yaml.org,2002:set":li.set,"tag:yaml.org,2002:timestamp":Ot.timestamp};function rf(s,n,r){let o=ti.get(n);if(o&&!s)return r&&!o.includes(Be.merge)?o.concat(Be.merge):o.slice();let a=o;if(!a)if(Array.isArray(s))a=[];else{let l=Array.from(ti.keys()).filter((c)=>c!=="yaml11").map((c)=>JSON.stringify(c)).join(", ");throw Error(`Unknown schema "${n}"; use one of ${l} or define customTags array`)}if(Array.isArray(s))for(let l of s)a=a.concat(l);else if(typeof s==="function")a=s(a.slice());if(r)a=a.concat(Be.merge);return a.reduce((l,c)=>{let u=typeof c==="string"?si[c]:c;if(!u){let h=JSON.stringify(c),d=Object.keys(si).map((g)=>JSON.stringify(g)).join(", ");throw Error(`Unknown custom tag ${h}; use one of ${d}`)}if(!l.includes(u))l.push(u);return l},[])}of.coreKnownTags=nf;of.getTags=rf});var gs=v(function(df){var ms=I(),cf=ye(),ff=ge(),uf=$e(),qt=ci(),hf=(s,n)=>s.key<n.key?-1:s.key>n.key?1:0;class ys{constructor({compat:s,customTags:n,merge:r,resolveKnownTags:o,schema:a,sortMapEntries:l,toStringDefaults:c}){this.compat=Array.isArray(s)?qt.getTags(s,"compat"):s?qt.getTags(null,s):null,this.name=typeof a==="string"&&a||"core",this.knownTags=o?qt.coreKnownTags:{},this.tags=qt.getTags(n,this.name,r),this.toStringOptions=c??null,Object.defineProperty(this,ms.MAP,{value:cf.map}),Object.defineProperty(this,ms.SCALAR,{value:uf.string}),Object.defineProperty(this,ms.SEQ,{value:ff.seq}),this.sortMapEntries=typeof l==="function"?l:l===!0?hf:null}clone(){let s=Object.create(ys.prototype,Object.getOwnPropertyDescriptors(this));return s.tags=this.tags.slice(),s}}df.Schema=ys});var fi=v(function(gf){var mf=I(),bs=Ce(),je=Ee();function yf(s,n){let r=[],o=n.directives===!0;if(n.directives!==!1&&s.directives){let h=s.directives.toString(s);if(h)r.push(h),o=!0;else if(s.directives.docStart)o=!0}if(o)r.push("---");let a=bs.createStringifyContext(s,n),{commentString:l}=a.options;if(s.commentBefore){if(r.length!==1)r.unshift("");let h=l(s.commentBefore);r.unshift(je.indentComment(h,""))}let c=!1,u=null;if(s.contents){if(mf.isNode(s.contents)){if(s.contents.spaceBefore&&o)r.push("");if(s.contents.commentBefore){let g=l(s.contents.commentBefore);r.push(je.indentComment(g,""))}a.forceBlockIndent=!!s.comment,u=s.contents.comment}let h=u?void 0:()=>c=!0,d=bs.stringify(s.contents,a,()=>u=null,h);if(u)d+=je.lineComment(d,"",l(u));if((d[0]==="|"||d[0]===">")&&r[r.length-1]==="---")r[r.length-1]=`--- ${d}`;else r.push(d)}else r.push(bs.stringify(s.contents,a));if(s.directives?.docEnd)if(s.comment){let h=l(s.comment);if(h.includes(`
|
|
55
|
-
`))r.push("..."),r.push(je.indentComment(h,""));else r.push(`... ${h}`)}else r.push("...");else{let h=s.comment;if(h&&c)h=h.replace(/^\n+/,"");if(h){if((!c||u)&&r[r.length-1]!=="")r.push("");r.push(je.indentComment(l(h),""))}}return r.join(`
|
|
56
|
-
`)+`
|
|
57
|
-
`}gf.stringifyDocument=yf});var Ke=v(function(qf){var wf=Oe(),we=tt(),R=I(),Sf=z(),vf=H(),kf=gs(),Nf=fi(),ws=ze(),Af=Bt(),Of=qe(),Ss=Dt();class vs{constructor(s,n,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,R.NODE_TYPE,{value:R.DOC});let o=null;if(typeof n==="function"||Array.isArray(n))o=n;else if(r===void 0&&n)r=n,n=void 0;let a=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},r);this.options=a;let{version:l}=a;if(r?._directives){if(this.directives=r._directives.atDocument(),this.directives.yaml.explicit)l=this.directives.yaml.version}else this.directives=new Ss.Directives({version:l});this.setSchema(l,r),this.contents=s===void 0?null:this.createNode(s,o,r)}clone(){let s=Object.create(vs.prototype,{[R.NODE_TYPE]:{value:R.DOC}});if(s.commentBefore=this.commentBefore,s.comment=this.comment,s.errors=this.errors.slice(),s.warnings=this.warnings.slice(),s.options=Object.assign({},this.options),this.directives)s.directives=this.directives.clone();if(s.schema=this.schema.clone(),s.contents=R.isNode(this.contents)?this.contents.clone(s.schema):this.contents,this.range)s.range=this.range.slice();return s}add(s){if(Se(this.contents))this.contents.add(s)}addIn(s,n){if(Se(this.contents))this.contents.addIn(s,n)}createAlias(s,n){if(!s.anchor){let r=ws.anchorNames(this);s.anchor=!n||r.has(n)?ws.findNewAnchor(n||"a",r):n}return new wf.Alias(s.anchor)}createNode(s,n,r){let o=void 0;if(typeof n==="function")s=n.call({"":s},"",s),o=n;else if(Array.isArray(n)){let y=(A)=>typeof A==="number"||A instanceof String||A instanceof Number,w=n.filter(y).map(String);if(w.length>0)n=n.concat(w);o=n}else if(r===void 0&&n)r=n,n=void 0;let{aliasDuplicateObjects:a,anchorPrefix:l,flow:c,keepUndefined:u,onTagObj:h,tag:d}=r??{},{onAnchor:g,setAnchors:p,sourceObjects:m}=ws.createNodeAnchors(this,l||"a"),S={aliasDuplicateObjects:a??!0,keepUndefined:u??!1,onAnchor:g,onTagObj:h,replacer:o,schema:this.schema,sourceObjects:m},k=Of.createNode(s,d,S);if(c&&R.isCollection(k))k.flow=!0;return p(),k}createPair(s,n,r={}){let o=this.createNode(s,null,r),a=this.createNode(n,null,r);return new Sf.Pair(o,a)}delete(s){return Se(this.contents)?this.contents.delete(s):!1}deleteIn(s){if(we.isEmptyPath(s)){if(this.contents==null)return!1;return this.contents=null,!0}return Se(this.contents)?this.contents.deleteIn(s):!1}get(s,n){return R.isCollection(this.contents)?this.contents.get(s,n):void 0}getIn(s,n){if(we.isEmptyPath(s))return!n&&R.isScalar(this.contents)?this.contents.value:this.contents;return R.isCollection(this.contents)?this.contents.getIn(s,n):void 0}has(s){return R.isCollection(this.contents)?this.contents.has(s):!1}hasIn(s){if(we.isEmptyPath(s))return this.contents!==void 0;return R.isCollection(this.contents)?this.contents.hasIn(s):!1}set(s,n){if(this.contents==null)this.contents=we.collectionFromPath(this.schema,[s],n);else if(Se(this.contents))this.contents.set(s,n)}setIn(s,n){if(we.isEmptyPath(s))this.contents=n;else if(this.contents==null)this.contents=we.collectionFromPath(this.schema,Array.from(s),n);else if(Se(this.contents))this.contents.setIn(s,n)}setSchema(s,n={}){if(typeof s==="number")s=String(s);let r;switch(s){case"1.1":if(this.directives)this.directives.yaml.version="1.1";else this.directives=new Ss.Directives({version:"1.1"});r={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":if(this.directives)this.directives.yaml.version=s;else this.directives=new Ss.Directives({version:s});r={resolveKnownTags:!0,schema:"core"};break;case null:if(this.directives)delete this.directives;r=null;break;default:{let o=JSON.stringify(s);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${o}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(r)this.schema=new kf.Schema(Object.assign(r,n));else throw Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:s,jsonArg:n,mapAsMap:r,maxAliasCount:o,onAnchor:a,reviver:l}={}){let c={anchors:new Map,doc:this,keep:!s,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof o==="number"?o:100},u=vf.toJS(this.contents,n??"",c);if(typeof a==="function")for(let{count:h,res:d}of c.anchors.values())a(d,h);return typeof l==="function"?Af.applyReviver(l,{"":u},"",u):u}toJSON(s,n){return this.toJS({json:!0,jsonArg:s,mapAsMap:!1,onAnchor:n})}toString(s={}){if(this.errors.length>0)throw Error("Document with errors cannot be stringified");if("indent"in s&&(!Number.isInteger(s.indent)||Number(s.indent)<=0)){let n=JSON.stringify(s.indent);throw Error(`"indent" option must be a positive integer, not ${n}`)}return Nf.stringifyDocument(this,s)}}function Se(s){if(R.isCollection(s))return!0;throw Error("Expected a YAML collection as document contents")}qf.Document=vs});var Re=v(function(Tf){class Et extends Error{constructor(s,n,r,o){super();this.name=s,this.code=r,this.message=o,this.pos=n}}class ui extends Et{constructor(s,n,r){super("YAMLParseError",s,n,r)}}class hi extends Et{constructor(s,n,r){super("YAMLWarning",s,n,r)}}var Lf=(s,n)=>(r)=>{if(r.pos[0]===-1)return;r.linePos=r.pos.map((u)=>n.linePos(u));let{line:o,col:a}=r.linePos[0];r.message+=` at line ${o}, column ${a}`;let l=a-1,c=s.substring(n.lineStarts[o-1],n.lineStarts[o]).replace(/[\n\r]+$/,"");if(l>=60&&c.length>80){let u=Math.min(l-39,c.length-79);c="…"+c.substring(u),l-=u-1}if(c.length>80)c=c.substring(0,79)+"…";if(o>1&&/^ *$/.test(c.substring(0,l))){let u=s.substring(n.lineStarts[o-2],n.lineStarts[o-1]);if(u.length>80)u=u.substring(0,79)+`…
|
|
58
|
-
`;c=u+c}if(/[^ ]/.test(c)){let u=1,h=r.linePos[1];if(h&&h.line===o&&h.col>a)u=Math.max(1,Math.min(h.col-a,80-l));let d=" ".repeat(l)+"^".repeat(u);r.message+=`:
|
|
59
|
-
|
|
60
|
-
${c}
|
|
61
|
-
${d}
|
|
62
|
-
`}};Tf.YAMLError=Et;Tf.YAMLParseError=ui;Tf.YAMLWarning=hi;Tf.prettifyError=Lf});var Fe=v(function(Mf){function $f(s,{flow:n,indicator:r,next:o,offset:a,onError:l,parentIndent:c,startOnNewline:u}){let h=!1,d=u,g=u,p="",m="",S=!1,k=!1,y=null,w=null,A=null,O=null,q=null,L=null,C=null;for(let N of s){if(k){if(N.type!=="space"&&N.type!=="newline"&&N.type!=="comma")l(N.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");k=!1}if(y){if(d&&N.type!=="comment"&&N.type!=="newline")l(y,"TAB_AS_INDENT","Tabs are not allowed as indentation");y=null}switch(N.type){case"space":if(!n&&(r!=="doc-start"||o?.type!=="flow-collection")&&N.source.includes("\t"))y=N;g=!0;break;case"comment":{if(!g)l(N,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let x=N.source.substring(1)||" ";if(!p)p=x;else p+=m+x;m="",d=!1;break}case"newline":if(d){if(p)p+=N.source;else if(!L||r!=="seq-item-ind")h=!0}else m+=N.source;if(d=!0,S=!0,w||A)O=N;g=!0;break;case"anchor":if(w)l(N,"MULTIPLE_ANCHORS","A node can have at most one anchor");if(N.source.endsWith(":"))l(N.offset+N.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0);w=N,C??(C=N.offset),d=!1,g=!1,k=!0;break;case"tag":{if(A)l(N,"MULTIPLE_TAGS","A node can have at most one tag");A=N,C??(C=N.offset),d=!1,g=!1,k=!0;break}case r:if(w||A)l(N,"BAD_PROP_ORDER",`Anchors and tags must be after the ${N.source} indicator`);if(L)l(N,"UNEXPECTED_TOKEN",`Unexpected ${N.source} in ${n??"collection"}`);L=N,d=r==="seq-item-ind"||r==="explicit-key-ind",g=!1;break;case"comma":if(n){if(q)l(N,"UNEXPECTED_TOKEN",`Unexpected , in ${n}`);q=N,d=!1,g=!1;break}default:l(N,"UNEXPECTED_TOKEN",`Unexpected ${N.type} token`),d=!1,g=!1}}let _=s[s.length-1],P=_?_.offset+_.source.length:a;if(k&&o&&o.type!=="space"&&o.type!=="newline"&&o.type!=="comma"&&(o.type!=="scalar"||o.source!==""))l(o.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space");if(y&&(d&&y.indent<=c||o?.type==="block-map"||o?.type==="block-seq"))l(y,"TAB_AS_INDENT","Tabs are not allowed as indentation");return{comma:q,found:L,spaceBefore:h,comment:p,hasNewline:S,anchor:w,tag:A,newlineAfterProp:O,end:P,start:C??P}}Mf.resolveProps=$f});var Lt=v(function(Df){function ks(s){if(!s)return null;switch(s.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(s.source.includes(`
|
|
63
|
-
`))return!0;if(s.end){for(let n of s.end)if(n.type==="newline")return!0}return!1;case"flow-collection":for(let n of s.items){for(let r of n.start)if(r.type==="newline")return!0;if(n.sep){for(let r of n.sep)if(r.type==="newline")return!0}if(ks(n.key)||ks(n.value))return!0}return!1;default:return!0}}Df.containsNewline=ks});var Ns=v(function(Rf){var jf=Lt();function Kf(s,n,r){if(n?.type==="flow-collection"){let o=n.end[0];if(o.indent===s&&(o.source==="]"||o.source==="}")&&jf.containsNewline(n))r(o,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}Rf.flowIndentCheck=Kf});var As=v(function(Yf){var di=I();function Uf(s,n,r){let{uniqueKeys:o}=s.options;if(o===!1)return!1;let a=typeof o==="function"?o:(l,c)=>l===c||di.isScalar(l)&&di.isScalar(c)&&l.value===c.value;return n.some((l)=>a(l.key,r))}Yf.mapIncludes=Uf});var bi=v(function(Gf){var pi=z(),Vf=ee(),mi=Fe(),Wf=Lt(),yi=Ns(),Qf=As(),gi="All mapping items must start at the same column";function Hf({composeNode:s,composeEmptyNode:n},r,o,a,l){let u=new(l?.nodeClass??Vf.YAMLMap)(r.schema);if(r.atRoot)r.atRoot=!1;let h=o.offset,d=null;for(let g of o.items){let{start:p,key:m,sep:S,value:k}=g,y=mi.resolveProps(p,{indicator:"explicit-key-ind",next:m??S?.[0],offset:h,onError:a,parentIndent:o.indent,startOnNewline:!0}),w=!y.found;if(w){if(m){if(m.type==="block-seq")a(h,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key");else if("indent"in m&&m.indent!==o.indent)a(h,"BAD_INDENT",gi)}if(!y.anchor&&!y.tag&&!S){if(d=y.end,y.comment)if(u.comment)u.comment+=`
|
|
64
|
-
`+y.comment;else u.comment=y.comment;continue}if(y.newlineAfterProp||Wf.containsNewline(m))a(m??p[p.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else if(y.found?.indent!==o.indent)a(h,"BAD_INDENT",gi);r.atKey=!0;let A=y.end,O=m?s(r,m,y,a):n(r,A,p,null,y,a);if(r.schema.compat)yi.flowIndentCheck(o.indent,m,a);if(r.atKey=!1,Qf.mapIncludes(r,u.items,O))a(A,"DUPLICATE_KEY","Map keys must be unique");let q=mi.resolveProps(S??[],{indicator:"map-value-ind",next:k,offset:O.range[2],onError:a,parentIndent:o.indent,startOnNewline:!m||m.type==="block-scalar"});if(h=q.end,q.found){if(w){if(k?.type==="block-map"&&!q.hasNewline)a(h,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings");if(r.options.strict&&y.start<q.found.offset-1024)a(O.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key")}let L=k?s(r,k,q,a):n(r,h,S,null,q,a);if(r.schema.compat)yi.flowIndentCheck(o.indent,k,a);h=L.range[2];let C=new pi.Pair(O,L);if(r.options.keepSourceTokens)C.srcToken=g;u.items.push(C)}else{if(w)a(O.range,"MISSING_CHAR","Implicit map keys need to be followed by map values");if(q.comment)if(O.comment)O.comment+=`
|
|
65
|
-
`+q.comment;else O.comment=q.comment;let L=new pi.Pair(O);if(r.options.keepSourceTokens)L.srcToken=g;u.items.push(L)}}if(d&&d<h)a(d,"IMPOSSIBLE","Map comment with trailing content");return u.range=[o.offset,h,d??h],u}Gf.resolveBlockMap=Hf});var wi=v(function(su){var zf=te(),Zf=Fe(),eu=Ns();function tu({composeNode:s,composeEmptyNode:n},r,o,a,l){let u=new(l?.nodeClass??zf.YAMLSeq)(r.schema);if(r.atRoot)r.atRoot=!1;if(r.atKey)r.atKey=!1;let h=o.offset,d=null;for(let{start:g,value:p}of o.items){let m=Zf.resolveProps(g,{indicator:"seq-item-ind",next:p,offset:h,onError:a,parentIndent:o.indent,startOnNewline:!0});if(!m.found)if(m.anchor||m.tag||p)if(p&&p.type==="block-seq")a(m.end,"BAD_INDENT","All sequence items must start at the same column");else a(h,"MISSING_CHAR","Sequence item without - indicator");else{if(d=m.end,m.comment)u.comment=m.comment;continue}let S=p?s(r,p,m,a):n(r,m.end,g,null,m,a);if(r.schema.compat)eu.flowIndentCheck(o.indent,p,a);h=S.range[2],u.items.push(S)}return u.range=[o.offset,h,d??h],u}su.resolveBlockSeq=tu});var ve=v(function(ru){function iu(s,n,r,o){let a="";if(s){let l=!1,c="";for(let u of s){let{source:h,type:d}=u;switch(d){case"space":l=!0;break;case"comment":{if(r&&!l)o(u,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let g=h.substring(1)||" ";if(!a)a=g;else a+=c+g;c="";break}case"newline":if(a)c+=h;l=!0;break;default:o(u,"UNEXPECTED_TOKEN",`Unexpected ${d} at node end`)}n+=h.length}}return{comment:a,offset:n}}ru.resolveEnd=iu});var ki=v(function(pu){var au=I(),lu=z(),Si=ee(),cu=te(),fu=ve(),vi=Fe(),uu=Lt(),hu=As(),Os="Block collections are not allowed within flow collections",qs=(s)=>s&&(s.type==="block-map"||s.type==="block-seq");function du({composeNode:s,composeEmptyNode:n},r,o,a,l){let c=o.start.source==="{",u=c?"flow map":"flow sequence",d=new(l?.nodeClass??(c?Si.YAMLMap:cu.YAMLSeq))(r.schema);d.flow=!0;let g=r.atRoot;if(g)r.atRoot=!1;if(r.atKey)r.atKey=!1;let p=o.offset+o.start.source.length;for(let w=0;w<o.items.length;++w){let A=o.items[w],{start:O,key:q,sep:L,value:C}=A,_=vi.resolveProps(O,{flow:u,indicator:"explicit-key-ind",next:q??L?.[0],offset:p,onError:a,parentIndent:o.indent,startOnNewline:!1});if(!_.found){if(!_.anchor&&!_.tag&&!L&&!C){if(w===0&&_.comma)a(_.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${u}`);else if(w<o.items.length-1)a(_.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${u}`);if(_.comment)if(d.comment)d.comment+=`
|
|
66
|
-
`+_.comment;else d.comment=_.comment;p=_.end;continue}if(!c&&r.options.strict&&uu.containsNewline(q))a(q,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(w===0){if(_.comma)a(_.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${u}`)}else{if(!_.comma)a(_.start,"MISSING_CHAR",`Missing , between ${u} items`);if(_.comment){let P="";e:for(let N of O)switch(N.type){case"comma":case"space":break;case"comment":P=N.source.substring(1);break e;default:break e}if(P){let N=d.items[d.items.length-1];if(au.isPair(N))N=N.value??N.key;if(N.comment)N.comment+=`
|
|
67
|
-
`+P;else N.comment=P;_.comment=_.comment.substring(P.length+1)}}}if(!c&&!L&&!_.found){let P=C?s(r,C,_,a):n(r,_.end,L,null,_,a);if(d.items.push(P),p=P.range[2],qs(C))a(P.range,"BLOCK_IN_FLOW",Os)}else{r.atKey=!0;let P=_.end,N=q?s(r,q,_,a):n(r,P,O,null,_,a);if(qs(q))a(N.range,"BLOCK_IN_FLOW",Os);r.atKey=!1;let x=vi.resolveProps(L??[],{flow:u,indicator:"map-value-ind",next:C,offset:N.range[2],onError:a,parentIndent:o.indent,startOnNewline:!1});if(x.found){if(!c&&!_.found&&r.options.strict){if(L)for(let D of L){if(D===x.found)break;if(D.type==="newline"){a(D,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}if(_.start<x.found.offset-1024)a(x.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else if(C)if("source"in C&&C.source&&C.source[0]===":")a(C,"MISSING_CHAR",`Missing space after : in ${u}`);else a(x.start,"MISSING_CHAR",`Missing , or : between ${u} items`);let Q=C?s(r,C,x,a):x.found?n(r,x.end,L,null,x,a):null;if(Q){if(qs(C))a(Q.range,"BLOCK_IN_FLOW",Os)}else if(x.comment)if(N.comment)N.comment+=`
|
|
68
|
-
`+x.comment;else N.comment=x.comment;let ue=new lu.Pair(N,Q);if(r.options.keepSourceTokens)ue.srcToken=A;if(c){let D=d;if(hu.mapIncludes(r,D.items,N))a(P,"DUPLICATE_KEY","Map keys must be unique");D.items.push(ue)}else{let D=new Si.YAMLMap(r.schema);D.flow=!0,D.items.push(ue);let Ws=(Q??N).range;D.range=[N.range[0],Ws[1],Ws[2]],d.items.push(D)}p=Q?Q.range[2]:x.end}}let m=c?"}":"]",[S,...k]=o.end,y=p;if(S&&S.source===m)y=S.offset+S.source.length;else{let w=u[0].toUpperCase()+u.substring(1),A=g?`${w} must end with a ${m}`:`${w} in block collection must be sufficiently indented and end with a ${m}`;if(a(p,g?"MISSING_CHAR":"BAD_INDENT",A),S&&S.source.length!==1)k.unshift(S)}if(k.length>0){let w=fu.resolveEnd(k,y,r.options.strict,a);if(w.comment)if(d.comment)d.comment+=`
|
|
69
|
-
`+w.comment;else d.comment=w.comment;d.range=[o.offset,y,w.offset]}else d.range=[o.offset,y,y];return d}pu.resolveFlowCollection=du});var Ni=v(function(Au){var yu=I(),gu=M(),bu=ee(),wu=te(),Su=bi(),vu=wi(),ku=ki();function Es(s,n,r,o,a,l){let c=r.type==="block-map"?Su.resolveBlockMap(s,n,r,o,l):r.type==="block-seq"?vu.resolveBlockSeq(s,n,r,o,l):ku.resolveFlowCollection(s,n,r,o,l),u=c.constructor;if(a==="!"||a===u.tagName)return c.tag=u.tagName,c;if(a)c.tag=a;return c}function Nu(s,n,r,o,a){let l=o.tag,c=!l?null:n.directives.tagName(l.source,(m)=>a(l,"TAG_RESOLVE_FAILED",m));if(r.type==="block-seq"){let{anchor:m,newlineAfterProp:S}=o,k=m&&l?m.offset>l.offset?m:l:m??l;if(k&&(!S||S.offset<k.offset))a(k,"MISSING_CHAR","Missing newline after block sequence props")}let u=r.type==="block-map"?"map":r.type==="block-seq"?"seq":r.start.source==="{"?"map":"seq";if(!l||!c||c==="!"||c===bu.YAMLMap.tagName&&u==="map"||c===wu.YAMLSeq.tagName&&u==="seq")return Es(s,n,r,a,c);let h=n.schema.tags.find((m)=>m.tag===c&&m.collection===u);if(!h){let m=n.schema.knownTags[c];if(m&&m.collection===u)n.schema.tags.push(Object.assign({},m,{default:!1})),h=m;else{if(m)a(l,"BAD_COLLECTION_TYPE",`${m.tag} used for ${u} collection, but expects ${m.collection??"scalar"}`,!0);else a(l,"TAG_RESOLVE_FAILED",`Unresolved tag: ${c}`,!0);return Es(s,n,r,a,c)}}let d=Es(s,n,r,a,c,h),g=h.resolve?.(d,(m)=>a(l,"TAG_RESOLVE_FAILED",m),n.options)??d,p=yu.isNode(g)?g:new gu.Scalar(g);if(p.range=d.range,p.tag=c,h?.format)p.format=h.format;return p}Au.composeCollection=Nu});var Ts=v(function(Tu){var Ls=M();function qu(s,n,r){let o=n.offset,a=Eu(n,s.options.strict,r);if(!a)return{value:"",type:null,comment:"",range:[o,o,o]};let l=a.mode===">"?Ls.Scalar.BLOCK_FOLDED:Ls.Scalar.BLOCK_LITERAL,c=n.source?Lu(n.source):[],u=c.length;for(let y=c.length-1;y>=0;--y){let w=c[y][1];if(w===""||w==="\r")u=y;else break}if(u===0){let y=a.chomp==="+"&&c.length>0?`
|
|
70
|
-
`.repeat(Math.max(1,c.length-1)):"",w=o+a.length;if(n.source)w+=n.source.length;return{value:y,type:l,comment:a.comment,range:[o,w,w]}}let h=n.indent+a.indent,d=n.offset+a.length,g=0;for(let y=0;y<u;++y){let[w,A]=c[y];if(A===""||A==="\r"){if(a.indent===0&&w.length>h)h=w.length}else{if(w.length<h)r(d+w.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator");if(a.indent===0)h=w.length;if(g=y,h===0&&!s.atRoot)r(d,"BAD_INDENT","Block scalar values in collections must be indented");break}d+=w.length+A.length+1}for(let y=c.length-1;y>=u;--y)if(c[y][0].length>h)u=y+1;let p="",m="",S=!1;for(let y=0;y<g;++y)p+=c[y][0].slice(h)+`
|
|
71
|
-
`;for(let y=g;y<u;++y){let[w,A]=c[y];d+=w.length+A.length+1;let O=A[A.length-1]==="\r";if(O)A=A.slice(0,-1);if(A&&w.length<h){let L=`Block scalar lines must not be less indented than their ${a.indent?"explicit indentation indicator":"first line"}`;r(d-A.length-(O?2:1),"BAD_INDENT",L),w=""}if(l===Ls.Scalar.BLOCK_LITERAL)p+=m+w.slice(h)+A,m=`
|
|
72
|
-
`;else if(w.length>h||A[0]==="\t"){if(m===" ")m=`
|
|
73
|
-
`;else if(!S&&m===`
|
|
74
|
-
`)m=`
|
|
75
|
-
|
|
76
|
-
`;p+=m+w.slice(h)+A,m=`
|
|
77
|
-
`,S=!0}else if(A==="")if(m===`
|
|
78
|
-
`)p+=`
|
|
79
|
-
`;else m=`
|
|
80
|
-
`;else p+=m+A,m=" ",S=!1}switch(a.chomp){case"-":break;case"+":for(let y=u;y<c.length;++y)p+=`
|
|
81
|
-
`+c[y][0].slice(h);if(p[p.length-1]!==`
|
|
82
|
-
`)p+=`
|
|
83
|
-
`;break;default:p+=`
|
|
84
|
-
`}let k=o+a.length+n.source.length;return{value:p,type:l,comment:a.comment,range:[o,k,k]}}function Eu({offset:s,props:n},r,o){if(n[0].type!=="block-scalar-header")return o(n[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:a}=n[0],l=a[0],c=0,u="",h=-1;for(let m=1;m<a.length;++m){let S=a[m];if(!u&&(S==="-"||S==="+"))u=S;else{let k=Number(S);if(!c&&k)c=k;else if(h===-1)h=s+m}}if(h!==-1)o(h,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${a}`);let d=!1,g="",p=a.length;for(let m=1;m<n.length;++m){let S=n[m];switch(S.type){case"space":d=!0;case"newline":p+=S.source.length;break;case"comment":if(r&&!d)o(S,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");p+=S.source.length,g=S.source.substring(1);break;case"error":o(S,"UNEXPECTED_TOKEN",S.message),p+=S.source.length;break;default:{let k=`Unexpected token in block scalar header: ${S.type}`;o(S,"UNEXPECTED_TOKEN",k);let y=S.source;if(y&&typeof y==="string")p+=y.length}}}return{mode:l,indent:c,chomp:u,comment:g,length:p}}function Lu(s){let n=s.split(/\n( *)/),r=n[0],o=r.match(/^( *)/),l=[o?.[1]?[o[1],r.slice(o[1].length)]:["",r]];for(let c=1;c<n.length;c+=2)l.push([n[c],n[c+1]]);return l}Tu.resolveBlockScalar=qu});var _s=v(function(ju){var Cs=M(),_u=ve();function Iu(s,n,r){let{offset:o,type:a,source:l,end:c}=s,u,h,d=(m,S,k)=>r(o+m,S,k);switch(a){case"scalar":u=Cs.Scalar.PLAIN,h=Pu(l,d);break;case"single-quoted-scalar":u=Cs.Scalar.QUOTE_SINGLE,h=$u(l,d);break;case"double-quoted-scalar":u=Cs.Scalar.QUOTE_DOUBLE,h=Mu(l,d);break;default:return r(s,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${a}`),{value:"",type:null,comment:"",range:[o,o+l.length,o+l.length]}}let g=o+l.length,p=_u.resolveEnd(c,g,n,r);return{value:h,type:u,comment:p.comment,range:[o,g,p.offset]}}function Pu(s,n){let r="";switch(s[0]){case"\t":r="a tab character";break;case",":r="flow indicator character ,";break;case"%":r="directive indicator character %";break;case"|":case">":{r=`block scalar indicator ${s[0]}`;break}case"@":case"`":{r=`reserved character ${s[0]}`;break}}if(r)n(0,"BAD_SCALAR_START",`Plain value cannot start with ${r}`);return Ai(s)}function $u(s,n){if(s[s.length-1]!=="'"||s.length===1)n(s.length,"MISSING_CHAR","Missing closing 'quote");return Ai(s.slice(1,-1)).replace(/''/g,"'")}function Ai(s){let n,r;try{n=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
85
|
-
`,"sy"),r=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
86
|
-
`,"sy")}catch{n=/(.*?)[ \t]*\r?\n/sy,r=/[ \t]*(.*?)[ \t]*\r?\n/sy}let o=n.exec(s);if(!o)return s;let a=o[1],l=" ",c=n.lastIndex;r.lastIndex=c;while(o=r.exec(s)){if(o[1]==="")if(l===`
|
|
87
|
-
`)a+=l;else l=`
|
|
88
|
-
`;else a+=l+o[1],l=" ";c=r.lastIndex}let u=/[ \t]*(.*)/sy;return u.lastIndex=c,o=u.exec(s),a+l+(o?.[1]??"")}function Mu(s,n){let r="";for(let o=1;o<s.length-1;++o){let a=s[o];if(a==="\r"&&s[o+1]===`
|
|
89
|
-
`)continue;if(a===`
|
|
90
|
-
`){let{fold:l,offset:c}=xu(s,o);r+=l,o=c}else if(a==="\\"){let l=s[++o],c=Du[l];if(c)r+=c;else if(l===`
|
|
91
|
-
`){l=s[o+1];while(l===" "||l==="\t")l=s[++o+1]}else if(l==="\r"&&s[o+1]===`
|
|
92
|
-
`){l=s[++o+1];while(l===" "||l==="\t")l=s[++o+1]}else if(l==="x"||l==="u"||l==="U"){let u={x:2,u:4,U:8}[l];r+=Bu(s,o+1,u,n),o+=u}else{let u=s.substr(o-1,2);n(o-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${u}`),r+=u}}else if(a===" "||a==="\t"){let l=o,c=s[o+1];while(c===" "||c==="\t")c=s[++o+1];if(c!==`
|
|
93
|
-
`&&!(c==="\r"&&s[o+2]===`
|
|
94
|
-
`))r+=o>l?s.slice(l,o+1):a}else r+=a}if(s[s.length-1]!=='"'||s.length===1)n(s.length,"MISSING_CHAR",'Missing closing "quote');return r}function xu(s,n){let r="",o=s[n+1];while(o===" "||o==="\t"||o===`
|
|
95
|
-
`||o==="\r"){if(o==="\r"&&s[n+2]!==`
|
|
96
|
-
`)break;if(o===`
|
|
97
|
-
`)r+=`
|
|
98
|
-
`;n+=1,o=s[n+1]}if(!r)r=" ";return{fold:r,offset:n}}var Du={"0":"\x00",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
|
99
|
-
`,r:"\r",t:"\t",v:"\v",N:"
",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\","\t":"\t"};function Bu(s,n,r,o){let a=s.substr(n,r),c=a.length===r&&/^[0-9a-fA-F]+$/.test(a)?parseInt(a,16):NaN;if(isNaN(c)){let u=s.substr(n-2,r+2);return o(n-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${u}`),u}return String.fromCodePoint(c)}ju.resolveFlowScalar=Iu});var qi=v(function(Vu){var ce=I(),Oi=M(),Ru=Ts(),Fu=_s();function Uu(s,n,r,o){let{value:a,type:l,comment:c,range:u}=n.type==="block-scalar"?Ru.resolveBlockScalar(s,n,o):Fu.resolveFlowScalar(n,s.options.strict,o),h=r?s.directives.tagName(r.source,(p)=>o(r,"TAG_RESOLVE_FAILED",p)):null,d;if(s.options.stringKeys&&s.atKey)d=s.schema[ce.SCALAR];else if(h)d=Yu(s.schema,a,h,r,o);else if(n.type==="scalar")d=Ju(s,a,n,o);else d=s.schema[ce.SCALAR];let g;try{let p=d.resolve(a,(m)=>o(r??n,"TAG_RESOLVE_FAILED",m),s.options);g=ce.isScalar(p)?p:new Oi.Scalar(p)}catch(p){let m=p instanceof Error?p.message:String(p);o(r??n,"TAG_RESOLVE_FAILED",m),g=new Oi.Scalar(a)}if(g.range=u,g.source=a,l)g.type=l;if(h)g.tag=h;if(d.format)g.format=d.format;if(c)g.comment=c;return g}function Yu(s,n,r,o,a){if(r==="!")return s[ce.SCALAR];let l=[];for(let u of s.tags)if(!u.collection&&u.tag===r)if(u.default&&u.test)l.push(u);else return u;for(let u of l)if(u.test?.test(n))return u;let c=s.knownTags[r];if(c&&!c.collection)return s.tags.push(Object.assign({},c,{default:!1,test:void 0})),c;return a(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${r}`,r!=="tag:yaml.org,2002:str"),s[ce.SCALAR]}function Ju({atKey:s,directives:n,schema:r},o,a,l){let c=r.tags.find((u)=>(u.default===!0||s&&u.default==="key")&&u.test?.test(o))||r[ce.SCALAR];if(r.compat){let u=r.compat.find((h)=>h.default&&h.test?.test(o))??r[ce.SCALAR];if(c.tag!==u.tag){let h=n.tagString(c.tag),d=n.tagString(u.tag),g=`Value may be parsed as either ${h} or ${d}`;l(a,"TAG_RESOLVE_FAILED",g,!0)}}return c}Vu.composeScalar=Uu});var Ei=v(function(Hu){function Qu(s,n,r){if(n){r??(r=n.length);for(let o=r-1;o>=0;--o){let a=n[o];switch(a.type){case"space":case"comment":case"newline":s-=a.source.length;continue}a=n[++o];while(a?.type==="space")s+=a.source.length,a=n[++o];break}}return s}Hu.emptyScalarPosition=Qu});var Ci=v(function(ih){var Xu=Oe(),zu=I(),Zu=Ni(),Li=qi(),eh=ve(),th=Ei(),sh={composeNode:Ti,composeEmptyNode:Is};function Ti(s,n,r,o){let a=s.atKey,{spaceBefore:l,comment:c,anchor:u,tag:h}=r,d,g=!0;switch(n.type){case"alias":if(d=nh(s,n,o),u||h)o(n,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":if(d=Li.composeScalar(s,n,h,o),u)d.anchor=u.source.substring(1);break;case"block-map":case"block-seq":case"flow-collection":if(d=Zu.composeCollection(sh,s,n,r,o),u)d.anchor=u.source.substring(1);break;default:{let p=n.type==="error"?n.message:`Unsupported token (type: ${n.type})`;o(n,"UNEXPECTED_TOKEN",p),d=Is(s,n.offset,void 0,null,r,o),g=!1}}if(u&&d.anchor==="")o(u,"BAD_ALIAS","Anchor cannot be an empty string");if(a&&s.options.stringKeys&&(!zu.isScalar(d)||typeof d.value!=="string"||d.tag&&d.tag!=="tag:yaml.org,2002:str"))o(h??n,"NON_STRING_KEY","With stringKeys, all keys must be strings");if(l)d.spaceBefore=!0;if(c)if(n.type==="scalar"&&n.source==="")d.comment=c;else d.commentBefore=c;if(s.options.keepSourceTokens&&g)d.srcToken=n;return d}function Is(s,n,r,o,{spaceBefore:a,comment:l,anchor:c,tag:u,end:h},d){let g={type:"scalar",offset:th.emptyScalarPosition(n,r,o),indent:-1,source:""},p=Li.composeScalar(s,g,u,d);if(c){if(p.anchor=c.source.substring(1),p.anchor==="")d(c,"BAD_ALIAS","Anchor cannot be an empty string")}if(a)p.spaceBefore=!0;if(l)p.comment=l,p.range[2]=h;return p}function nh({options:s},{offset:n,source:r,end:o},a){let l=new Xu.Alias(r.substring(1));if(l.source==="")a(n,"BAD_ALIAS","Alias cannot be an empty string");if(l.source.endsWith(":"))a(n+r.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let c=n+r.length,u=eh.resolveEnd(o,c,s.strict,a);if(l.range=[n,c,u.offset],u.comment)l.comment=u.comment;return l}ih.composeEmptyNode=Is;ih.composeNode=Ti});var Ii=v(function(uh){var ah=Ke(),_i=Ci(),lh=ve(),ch=Fe();function fh(s,n,{offset:r,start:o,value:a,end:l},c){let u=Object.assign({_directives:n},s),h=new ah.Document(void 0,u),d={atKey:!1,atRoot:!0,directives:h.directives,options:h.options,schema:h.schema},g=ch.resolveProps(o,{indicator:"doc-start",next:a??l?.[0],offset:r,onError:c,parentIndent:0,startOnNewline:!0});if(g.found){if(h.directives.docStart=!0,a&&(a.type==="block-map"||a.type==="block-seq")&&!g.hasNewline)c(g.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")}h.contents=a?_i.composeNode(d,a,g,c):_i.composeEmptyNode(d,g.end,o,null,g,c);let p=h.contents.range[2],m=lh.resolveEnd(l,p,!1,c);if(m.comment)h.comment=m.comment;return h.range=[r,p,m.offset],h}uh.composeDoc=fh});var Ps=v(function(bh){var dh=We("process"),ph=Dt(),mh=Ke(),Ue=Re(),Pi=I(),yh=Ii(),gh=ve();function Ye(s){if(typeof s==="number")return[s,s+1];if(Array.isArray(s))return s.length===2?s:[s[0],s[1]];let{offset:n,source:r}=s;return[n,n+(typeof r==="string"?r.length:1)]}function $i(s){let n="",r=!1,o=!1;for(let a=0;a<s.length;++a){let l=s[a];switch(l[0]){case"#":n+=(n===""?"":o?`
|
|
100
|
-
|
|
101
|
-
`:`
|
|
102
|
-
`)+(l.substring(1)||" "),r=!0,o=!1;break;case"%":if(s[a+1]?.[0]!=="#")a+=1;r=!1;break;default:if(!r)o=!0;r=!1}}return{comment:n,afterEmptyLine:o}}class Mi{constructor(s={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,r,o,a)=>{let l=Ye(n);if(a)this.warnings.push(new Ue.YAMLWarning(l,r,o));else this.errors.push(new Ue.YAMLParseError(l,r,o))},this.directives=new ph.Directives({version:s.version||"1.2"}),this.options=s}decorate(s,n){let{comment:r,afterEmptyLine:o}=$i(this.prelude);if(r){let a=s.contents;if(n)s.comment=s.comment?`${s.comment}
|
|
103
|
-
${r}`:r;else if(o||s.directives.docStart||!a)s.commentBefore=r;else if(Pi.isCollection(a)&&!a.flow&&a.items.length>0){let l=a.items[0];if(Pi.isPair(l))l=l.key;let c=l.commentBefore;l.commentBefore=c?`${r}
|
|
104
|
-
${c}`:r}else{let l=a.commentBefore;a.commentBefore=l?`${r}
|
|
105
|
-
${l}`:r}}if(n)Array.prototype.push.apply(s.errors,this.errors),Array.prototype.push.apply(s.warnings,this.warnings);else s.errors=this.errors,s.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:$i(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(s,n=!1,r=-1){for(let o of s)yield*this.next(o);yield*this.end(n,r)}*next(s){if(dh.env.LOG_STREAM)console.dir(s,{depth:null});switch(s.type){case"directive":this.directives.add(s.source,(n,r,o)=>{let a=Ye(s);a[0]+=n,this.onError(a,"BAD_DIRECTIVE",r,o)}),this.prelude.push(s.source),this.atDirectives=!0;break;case"document":{let n=yh.composeDoc(this.options,this.directives,s,this.onError);if(this.atDirectives&&!n.directives.docStart)this.onError(s,"MISSING_CHAR","Missing directives-end/doc-start indicator line");if(this.decorate(n,!1),this.doc)yield this.doc;this.doc=n,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(s.source);break;case"error":{let n=s.source?`${s.message}: ${JSON.stringify(s.source)}`:s.message,r=new Ue.YAMLParseError(Ye(s),"UNEXPECTED_TOKEN",n);if(this.atDirectives||!this.doc)this.errors.push(r);else this.doc.errors.push(r);break}case"doc-end":{if(!this.doc){this.errors.push(new Ue.YAMLParseError(Ye(s),"UNEXPECTED_TOKEN","Unexpected doc-end without preceding document"));break}this.doc.directives.docEnd=!0;let n=gh.resolveEnd(s.end,s.offset+s.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){let r=this.doc.comment;this.doc.comment=r?`${r}
|
|
106
|
-
${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new Ue.YAMLParseError(Ye(s),"UNEXPECTED_TOKEN",`Unsupported token ${s.type}`))}}*end(s=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(s){let r=Object.assign({_directives:this.directives},this.options),o=new mh.Document(void 0,r);if(this.atDirectives)this.onError(n,"MISSING_CHAR","Missing directives-end indicator line");o.range=[0,n,n],this.decorate(o,!1),yield o}}}bh.Composer=Mi});var Bi=v(function(Eh){var Sh=Ts(),vh=_s(),kh=Re(),xi=Te();function Nh(s,n=!0,r){if(s){let o=(a,l,c)=>{let u=typeof a==="number"?a:Array.isArray(a)?a[0]:a.offset;if(r)r(u,l,c);else throw new kh.YAMLParseError([u,u+1],l,c)};switch(s.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return vh.resolveFlowScalar(s,n,o);case"block-scalar":return Sh.resolveBlockScalar({options:{strict:n}},s,o)}}return null}function Ah(s,n){let{implicitKey:r=!1,indent:o,inFlow:a=!1,offset:l=-1,type:c="PLAIN"}=n,u=xi.stringifyString({type:c,value:s},{implicitKey:r,indent:o>0?" ".repeat(o):"",inFlow:a,options:{blockQuote:!0,lineWidth:-1}}),h=n.end??[{type:"newline",offset:-1,indent:o,source:`
|
|
107
|
-
`}];switch(u[0]){case"|":case">":{let d=u.indexOf(`
|
|
108
|
-
`),g=u.substring(0,d),p=u.substring(d+1)+`
|
|
109
|
-
`,m=[{type:"block-scalar-header",offset:l,indent:o,source:g}];if(!Di(m,h))m.push({type:"newline",offset:-1,indent:o,source:`
|
|
110
|
-
`});return{type:"block-scalar",offset:l,indent:o,props:m,source:p}}case'"':return{type:"double-quoted-scalar",offset:l,indent:o,source:u,end:h};case"'":return{type:"single-quoted-scalar",offset:l,indent:o,source:u,end:h};default:return{type:"scalar",offset:l,indent:o,source:u,end:h}}}function Oh(s,n,r={}){let{afterKey:o=!1,implicitKey:a=!1,inFlow:l=!1,type:c}=r,u="indent"in s?s.indent:null;if(o&&typeof u==="number")u+=2;if(!c)switch(s.type){case"single-quoted-scalar":c="QUOTE_SINGLE";break;case"double-quoted-scalar":c="QUOTE_DOUBLE";break;case"block-scalar":{let d=s.props[0];if(d.type!=="block-scalar-header")throw Error("Invalid block scalar header");c=d.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:c="PLAIN"}let h=xi.stringifyString({type:c,value:n},{implicitKey:a||u===null,indent:u!==null&&u>0?" ".repeat(u):"",inFlow:l,options:{blockQuote:!0,lineWidth:-1}});switch(h[0]){case"|":case">":qh(s,h);break;case'"':$s(s,h,"double-quoted-scalar");break;case"'":$s(s,h,"single-quoted-scalar");break;default:$s(s,h,"scalar")}}function qh(s,n){let r=n.indexOf(`
|
|
111
|
-
`),o=n.substring(0,r),a=n.substring(r+1)+`
|
|
112
|
-
`;if(s.type==="block-scalar"){let l=s.props[0];if(l.type!=="block-scalar-header")throw Error("Invalid block scalar header");l.source=o,s.source=a}else{let{offset:l}=s,c="indent"in s?s.indent:-1,u=[{type:"block-scalar-header",offset:l,indent:c,source:o}];if(!Di(u,"end"in s?s.end:void 0))u.push({type:"newline",offset:-1,indent:c,source:`
|
|
113
|
-
`});for(let h of Object.keys(s))if(h!=="type"&&h!=="offset")delete s[h];Object.assign(s,{type:"block-scalar",indent:c,props:u,source:a})}}function Di(s,n){if(n)for(let r of n)switch(r.type){case"space":case"comment":s.push(r);break;case"newline":return s.push(r),!0}return!1}function $s(s,n,r){switch(s.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":s.type=r,s.source=n;break;case"block-scalar":{let o=s.props.slice(1),a=n.length;if(s.props[0].type==="block-scalar-header")a-=s.props[0].source.length;for(let l of o)l.offset+=a;delete s.props,Object.assign(s,{type:r,source:n,end:o});break}case"block-map":case"block-seq":{let a={type:"newline",offset:s.offset+n.length,indent:s.indent,source:`
|
|
114
|
-
`};delete s.items,Object.assign(s,{type:r,source:n,end:[a]});break}default:{let o="indent"in s?s.indent:-1,a="end"in s&&Array.isArray(s.end)?s.end.filter((l)=>l.type==="space"||l.type==="comment"||l.type==="newline"):[];for(let l of Object.keys(s))if(l!=="type"&&l!=="offset")delete s[l];Object.assign(s,{type:r,indent:o,source:n,end:a})}}}Eh.createScalarToken=Ah;Eh.resolveAsScalar=Nh;Eh.setScalarValue=Oh});var ji=v(function(Ih){var _h=(s)=>("type"in s)?Ct(s):Tt(s);function Ct(s){switch(s.type){case"block-scalar":{let n="";for(let r of s.props)n+=Ct(r);return n+s.source}case"block-map":case"block-seq":{let n="";for(let r of s.items)n+=Tt(r);return n}case"flow-collection":{let n=s.start.source;for(let r of s.items)n+=Tt(r);for(let r of s.end)n+=r.source;return n}case"document":{let n=Tt(s);if(s.end)for(let r of s.end)n+=r.source;return n}default:{let n=s.source;if("end"in s&&s.end)for(let r of s.end)n+=r.source;return n}}}function Tt({start:s,key:n,sep:r,value:o}){let a="";for(let l of s)a+=l.source;if(n)a+=Ct(n);if(r)for(let l of r)a+=l.source;if(o)a+=Ct(o);return a}Ih.stringify=_h});var Fi=v(function(Mh){var Ms=Symbol("break visit"),$h=Symbol("skip children"),Ki=Symbol("remove item");function fe(s,n){if("type"in s&&s.type==="document")s={start:s.start,value:s.value};Ri(Object.freeze([]),s,n)}fe.BREAK=Ms;fe.SKIP=$h;fe.REMOVE=Ki;fe.itemAtPath=(s,n)=>{let r=s;for(let[o,a]of n){let l=r?.[o];if(l&&"items"in l)r=l.items[a];else return}return r};fe.parentCollection=(s,n)=>{let r=fe.itemAtPath(s,n.slice(0,-1)),o=n[n.length-1][0],a=r?.[o];if(a&&"items"in a)return a;throw Error("Parent collection not found")};function Ri(s,n,r){let o=r(n,s);if(typeof o==="symbol")return o;for(let a of["key","value"]){let l=n[a];if(l&&"items"in l){for(let c=0;c<l.items.length;++c){let u=Ri(Object.freeze(s.concat([[a,c]])),l.items[c],r);if(typeof u==="number")c=u-1;else if(u===Ms)return Ms;else if(u===Ki)l.items.splice(c,1),c-=1}if(typeof o==="function"&&a==="key")o=o(n,s)}}return typeof o==="function"?o(n,s):o}Mh.visit=fe});var _t=v(function(Uh){var xs=Bi(),Dh=ji(),Bh=Fi(),Ds="\uFEFF",Bs="\x02",js="\x18",Ks="\x1F",jh=(s)=>!!s&&("items"in s),Kh=(s)=>!!s&&(s.type==="scalar"||s.type==="single-quoted-scalar"||s.type==="double-quoted-scalar"||s.type==="block-scalar");function Rh(s){switch(s){case Ds:return"<BOM>";case Bs:return"<DOC>";case js:return"<FLOW_END>";case Ks:return"<SCALAR>";default:return JSON.stringify(s)}}function Fh(s){switch(s){case Ds:return"byte-order-mark";case Bs:return"doc-mode";case js:return"flow-error-end";case Ks:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
|
115
|
-
`:case`\r
|
|
116
|
-
`: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(s[0]){case" ":case"\t":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}Uh.createScalarToken=xs.createScalarToken;Uh.resolveAsScalar=xs.resolveAsScalar;Uh.setScalarValue=xs.setScalarValue;Uh.stringify=Dh.stringify;Uh.visit=Bh.visit;Uh.BOM=Ds;Uh.DOCUMENT=Bs;Uh.FLOW_END=js;Uh.SCALAR=Ks;Uh.isCollection=jh;Uh.isScalar=Kh;Uh.prettyToken=Rh;Uh.tokenType=Fh});var Fs=v(function(rd){var Je=_t();function U(s){switch(s){case void 0:case" ":case`
|
|
117
|
-
`:case"\r":case"\t":return!0;default:return!1}}var Ui=new Set("0123456789ABCDEFabcdef"),nd=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),It=new Set(",[]{}"),id=new Set(` ,[]{}
|
|
118
|
-
\r `),Rs=(s)=>!s||id.has(s);class Yi{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(s,n=!1){if(s){if(typeof s!=="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+s:s,this.lineEndPos=null}this.atEnd=!n;let r=this.next??"stream";while(r&&(n||this.hasChars(1)))r=yield*this.parseNext(r)}atLineEnd(){let s=this.pos,n=this.buffer[s];while(n===" "||n==="\t")n=this.buffer[++s];if(!n||n==="#"||n===`
|
|
119
|
-
`)return!0;if(n==="\r")return this.buffer[s+1]===`
|
|
120
|
-
`;return!1}charAt(s){return this.buffer[this.pos+s]}continueScalar(s){let n=this.buffer[s];if(this.indentNext>0){let r=0;while(n===" ")n=this.buffer[++r+s];if(n==="\r"){let o=this.buffer[r+s+1];if(o===`
|
|
121
|
-
`||!o&&!this.atEnd)return s+r+1}return n===`
|
|
122
|
-
`||r>=this.indentNext||!n&&!this.atEnd?s+r:-1}if(n==="-"||n==="."){let r=this.buffer.substr(s,3);if((r==="---"||r==="...")&&U(this.buffer[s+3]))return-1}return s}getLine(){let s=this.lineEndPos;if(typeof s!=="number"||s!==-1&&s<this.pos)s=this.buffer.indexOf(`
|
|
123
|
-
`,this.pos),this.lineEndPos=s;if(s===-1)return this.atEnd?this.buffer.substring(this.pos):null;if(this.buffer[s-1]==="\r")s-=1;return this.buffer.substring(this.pos,s)}hasChars(s){return this.pos+s<=this.buffer.length}setNext(s){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=s,null}peek(s){return this.buffer.substr(this.pos,s)}*parseNext(s){switch(s){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 s=this.getLine();if(s===null)return this.setNext("stream");if(s[0]===Je.BOM)yield*this.pushCount(1),s=s.substring(1);if(s[0]==="%"){let n=s.length,r=s.indexOf("#");while(r!==-1){let a=s[r-1];if(a===" "||a==="\t"){n=r-1;break}else r=s.indexOf("#",r+1)}while(!0){let a=s[n-1];if(a===" "||a==="\t")n-=1;else break}let o=(yield*this.pushCount(n))+(yield*this.pushSpaces(!0));return yield*this.pushCount(s.length-o),this.pushNewline(),"stream"}if(this.atLineEnd()){let n=yield*this.pushSpaces(!0);return yield*this.pushCount(s.length-n),yield*this.pushNewline(),"stream"}return yield Je.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let s=this.charAt(0);if(!s&&!this.atEnd)return this.setNext("line-start");if(s==="-"||s==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let n=this.peek(3);if((n==="---"||n==="...")&&U(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,n==="---"?"doc":"stream"}if(this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!U(this.charAt(1)))this.indentNext=this.indentValue;return yield*this.parseBlockStart()}*parseBlockStart(){let[s,n]=this.peek(2);if(!n&&!this.atEnd)return this.setNext("block-start");if((s==="-"||s==="?"||s===":")&&U(n)){let r=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=r,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let s=this.getLine();if(s===null)return this.setNext("doc");let n=yield*this.pushIndicators();switch(s[n]){case"#":yield*this.pushCount(s.length-n);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(Rs),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return n+=yield*this.parseBlockScalarHeader(),n+=yield*this.pushSpaces(!0),yield*this.pushCount(s.length-n),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let s,n,r=-1;do{if(s=yield*this.pushNewline(),s>0)n=yield*this.pushSpaces(!1),this.indentValue=r=n;else n=0;n+=yield*this.pushSpaces(!0)}while(s+n>0);let o=this.getLine();if(o===null)return this.setNext("flow");if(r!==-1&&r<this.indentNext&&o[0]!=="#"||r===0&&(o.startsWith("---")||o.startsWith("..."))&&U(o[3])){if(!(r===this.indentNext-1&&this.flowLevel===1&&(o[0]==="]"||o[0]==="}")))return this.flowLevel=0,yield Je.FLOW_END,yield*this.parseLineStart()}let a=0;while(o[a]===",")a+=yield*this.pushCount(1),a+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(a+=yield*this.pushIndicators(),o[a]){case void 0:return"flow";case"#":return yield*this.pushCount(o.length-a),"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(Rs),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let l=this.charAt(1);if(this.flowKey||U(l)||l===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let s=this.charAt(0),n=this.buffer.indexOf(s,this.pos+1);if(s==="'")while(n!==-1&&this.buffer[n+1]==="'")n=this.buffer.indexOf("'",n+2);else while(n!==-1){let a=0;while(this.buffer[n-1-a]==="\\")a+=1;if(a%2===0)break;n=this.buffer.indexOf('"',n+1)}let r=this.buffer.substring(0,n),o=r.indexOf(`
|
|
124
|
-
`,this.pos);if(o!==-1){while(o!==-1){let a=this.continueScalar(o+1);if(a===-1)break;o=r.indexOf(`
|
|
125
|
-
`,a)}if(o!==-1)n=o-(r[o-1]==="\r"?2:1)}if(n===-1){if(!this.atEnd)return this.setNext("quoted-scalar");n=this.buffer.length}return yield*this.pushToIndex(n+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let s=this.pos;while(!0){let n=this.buffer[++s];if(n==="+")this.blockScalarKeep=!0;else if(n>"0"&&n<="9")this.blockScalarIndent=Number(n)-1;else if(n!=="-")break}return yield*this.pushUntil((n)=>U(n)||n==="#")}*parseBlockScalar(){let s=this.pos-1,n=0,r;e:for(let a=this.pos;r=this.buffer[a];++a)switch(r){case" ":n+=1;break;case`
|
|
126
|
-
`:s=a,n=0;break;case"\r":{let l=this.buffer[a+1];if(!l&&!this.atEnd)return this.setNext("block-scalar");if(l===`
|
|
127
|
-
`)break}default:break e}if(!r&&!this.atEnd)return this.setNext("block-scalar");if(n>=this.indentNext){if(this.blockScalarIndent===-1)this.indentNext=n;else this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let a=this.continueScalar(s+1);if(a===-1)break;s=this.buffer.indexOf(`
|
|
128
|
-
`,a)}while(s!==-1);if(s===-1){if(!this.atEnd)return this.setNext("block-scalar");s=this.buffer.length}}let o=s+1;r=this.buffer[o];while(r===" ")r=this.buffer[++o];if(r==="\t"){while(r==="\t"||r===" "||r==="\r"||r===`
|
|
129
|
-
`)r=this.buffer[++o];s=o-1}else if(!this.blockScalarKeep)do{let a=s-1,l=this.buffer[a];if(l==="\r")l=this.buffer[--a];let c=a;while(l===" ")l=this.buffer[--a];if(l===`
|
|
130
|
-
`&&a>=this.pos&&a+1+n>c)s=a;else break}while(!0);return yield Je.SCALAR,yield*this.pushToIndex(s+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let s=this.flowLevel>0,n=this.pos-1,r=this.pos-1,o;while(o=this.buffer[++r])if(o===":"){let a=this.buffer[r+1];if(U(a)||s&&It.has(a))break;n=r}else if(U(o)){let a=this.buffer[r+1];if(o==="\r")if(a===`
|
|
131
|
-
`)r+=1,o=`
|
|
132
|
-
`,a=this.buffer[r+1];else n=r;if(a==="#"||s&&It.has(a))break;if(o===`
|
|
133
|
-
`){let l=this.continueScalar(r+1);if(l===-1)break;r=Math.max(r,l-2)}}else{if(s&&It.has(o))break;n=r}if(!o&&!this.atEnd)return this.setNext("plain-scalar");return yield Je.SCALAR,yield*this.pushToIndex(n+1,!0),s?"flow":"doc"}*pushCount(s){if(s>0)return yield this.buffer.substr(this.pos,s),this.pos+=s,s;return 0}*pushToIndex(s,n){let r=this.buffer.slice(this.pos,s);if(r)return yield r,this.pos+=r.length,r.length;else if(n)yield"";return 0}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(Rs))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let s=this.flowLevel>0,n=this.charAt(1);if(U(n)||s&&It.has(n)){if(!s)this.indentNext=this.indentValue+1;else if(this.flowKey)this.flowKey=!1;return(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}}return 0}*pushTag(){if(this.charAt(1)==="<"){let s=this.pos+2,n=this.buffer[s];while(!U(n)&&n!==">")n=this.buffer[++s];return yield*this.pushToIndex(n===">"?s+1:s,!1)}else{let s=this.pos+1,n=this.buffer[s];while(n)if(nd.has(n))n=this.buffer[++s];else if(n==="%"&&Ui.has(this.buffer[s+1])&&Ui.has(this.buffer[s+2]))n=this.buffer[s+=3];else break;return yield*this.pushToIndex(s,!1)}}*pushNewline(){let s=this.buffer[this.pos];if(s===`
|
|
134
|
-
`)return yield*this.pushCount(1);else if(s==="\r"&&this.charAt(1)===`
|
|
135
|
-
`)return yield*this.pushCount(2);else return 0}*pushSpaces(s){let n=this.pos-1,r;do r=this.buffer[++n];while(r===" "||s&&r==="\t");let o=n-this.pos;if(o>0)yield this.buffer.substr(this.pos,o),this.pos=n;return o}*pushUntil(s){let n=this.pos,r=this.buffer[n];while(!s(r))r=this.buffer[++n];return yield*this.pushToIndex(n,!1)}}rd.Lexer=Yi});var Us=v(function(ad){class Ji{constructor(){this.lineStarts=[],this.addNewLine=(s)=>this.lineStarts.push(s),this.linePos=(s)=>{let n=0,r=this.lineStarts.length;while(n<r){let a=n+r>>1;if(this.lineStarts[a]<s)n=a+1;else r=a}if(this.lineStarts[n]===s)return{line:n+1,col:1};if(n===0)return{line:0,col:s};let o=this.lineStarts[n-1];return{line:n,col:s-o+1}}}}ad.LineCounter=Ji});var Ys=v(function(ud){var cd=We("process"),Vi=_t(),fd=Fs();function se(s,n){for(let r=0;r<s.length;++r)if(s[r].type===n)return!0;return!1}function Wi(s){for(let n=0;n<s.length;++n)switch(s[n].type){case"space":case"comment":case"newline":break;default:return n}return-1}function Hi(s){switch(s?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function Pt(s){switch(s.type){case"document":return s.start;case"block-map":{let n=s.items[s.items.length-1];return n.sep??n.start}case"block-seq":return s.items[s.items.length-1].start;default:return[]}}function ke(s){if(s.length===0)return[];let n=s.length;e:while(--n>=0)switch(s[n].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}while(s[++n]?.type==="space");return s.splice(n,s.length)}function Qi(s){if(s.start.type==="flow-seq-start"){for(let n of s.items)if(n.sep&&!n.value&&!se(n.start,"explicit-key-ind")&&!se(n.sep,"map-value-ind")){if(n.key)n.value=n.key;if(delete n.key,Hi(n.value))if(n.value.end)Array.prototype.push.apply(n.value.end,n.sep);else n.value.end=n.sep;else Array.prototype.push.apply(n.start,n.sep);delete n.sep}}}class Gi{constructor(s){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new fd.Lexer,this.onNewLine=s}*parse(s,n=!1){if(this.onNewLine&&this.offset===0)this.onNewLine(0);for(let r of this.lexer.lex(s,n))yield*this.next(r);if(!n)yield*this.end()}*next(s){if(this.source=s,cd.env.LOG_TOKENS)console.log("|",Vi.prettyToken(s));if(this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=s.length;return}let n=Vi.tokenType(s);if(!n){let r=`Not a YAML token: ${s}`;yield*this.pop({type:"error",offset:this.offset,message:r,source:s}),this.offset+=s.length}else if(n==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=n,yield*this.step(),n){case"newline":if(this.atNewLine=!0,this.indent=0,this.onNewLine)this.onNewLine(this.offset+s.length);break;case"space":if(this.atNewLine&&s[0]===" ")this.indent+=s.length;break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":if(this.atNewLine)this.indent+=s.length;break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=s.length}}*end(){while(this.stack.length>0)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let s=this.peek(1);if(this.type==="doc-end"&&(!s||s.type!=="doc-end")){while(this.stack.length>0)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!s)return yield*this.stream();switch(s.type){case"document":return yield*this.document(s);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(s);case"block-scalar":return yield*this.blockScalar(s);case"block-map":return yield*this.blockMap(s);case"block-seq":return yield*this.blockSequence(s);case"flow-collection":return yield*this.flowCollection(s);case"doc-end":return yield*this.documentEnd(s)}yield*this.pop()}peek(s){return this.stack[this.stack.length-s]}*pop(s){let n=s??this.stack.pop();if(!n)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield n;else{let r=this.peek(1);if(n.type==="block-scalar")n.indent="indent"in r?r.indent:0;else if(n.type==="flow-collection"&&r.type==="document")n.indent=0;if(n.type==="flow-collection")Qi(n);switch(r.type){case"document":r.value=n;break;case"block-scalar":r.props.push(n);break;case"block-map":{let o=r.items[r.items.length-1];if(o.value){r.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(o.sep)o.value=n;else{Object.assign(o,{key:n,sep:[]}),this.onKeyLine=!o.explicitKey;return}break}case"block-seq":{let o=r.items[r.items.length-1];if(o.value)r.items.push({start:[],value:n});else o.value=n;break}case"flow-collection":{let o=r.items[r.items.length-1];if(!o||o.value)r.items.push({start:[],key:n,sep:[]});else if(o.sep)o.value=n;else Object.assign(o,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((r.type==="document"||r.type==="block-map"||r.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){let o=n.items[n.items.length-1];if(o&&!o.sep&&!o.value&&o.start.length>0&&Wi(o.start)===-1&&(n.indent===0||o.start.every((a)=>a.type!=="comment"||a.indent<n.indent))){if(r.type==="document")r.end=o.start;else r.items.push({start:o.start});n.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 s={type:"document",offset:this.offset,start:[]};if(this.type==="doc-start")s.start.push(this.sourceToken);this.stack.push(s);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(s){if(s.value)return yield*this.lineEnd(s);switch(this.type){case"doc-start":{if(Wi(s.start)!==-1)yield*this.pop(),yield*this.step();else s.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":s.start.push(this.sourceToken);return}let n=this.startBlockValue(s);if(n)this.stack.push(n);else yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(s){if(this.type==="map-value-ind"){let n=Pt(this.peek(2)),r=ke(n),o;if(s.end)o=s.end,o.push(this.sourceToken),delete s.end;else o=[this.sourceToken];let a={type:"block-map",offset:s.offset,indent:s.indent,items:[{start:r,key:s,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(s)}*blockScalar(s){switch(this.type){case"space":case"comment":case"newline":s.props.push(this.sourceToken);return;case"scalar":if(s.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let n=this.source.indexOf(`
|
|
136
|
-
`)+1;while(n!==0)this.onNewLine(this.offset+n),n=this.source.indexOf(`
|
|
137
|
-
`,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(s){let n=s.items[s.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){let r="end"in n.value?n.value.end:void 0;if((Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment")r?.push(this.sourceToken);else s.items.push({start:[this.sourceToken]})}else if(n.sep)n.sep.push(this.sourceToken);else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)s.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,s.indent)){let o=s.items[s.items.length-2]?.value?.end;if(Array.isArray(o)){Array.prototype.push.apply(o,n.start),o.push(this.sourceToken),s.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=s.indent){let r=!this.onKeyLine&&this.indent===s.indent,o=r&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind",a=[];if(o&&n.sep&&!n.value){let l=[];for(let c=0;c<n.sep.length;++c){let u=n.sep[c];switch(u.type){case"newline":l.push(c);break;case"space":break;case"comment":if(u.indent>s.indent)l.length=0;break;default:l.length=0}}if(l.length>=2)a=n.sep.splice(l[1])}switch(this.type){case"anchor":case"tag":if(o||n.value)a.push(this.sourceToken),s.items.push({start:a}),this.onKeyLine=!0;else if(n.sep)n.sep.push(this.sourceToken);else n.start.push(this.sourceToken);return;case"explicit-key-ind":if(!n.sep&&!n.explicitKey)n.start.push(this.sourceToken),n.explicitKey=!0;else if(o||n.value)a.push(this.sourceToken),s.items.push({start:a,explicitKey:!0});else 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(n.explicitKey)if(!n.sep)if(se(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{let l=ke(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:l,key:null,sep:[this.sourceToken]}]})}else if(n.value)s.items.push({start:[],key:null,sep:[this.sourceToken]});else if(se(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:null,sep:[this.sourceToken]}]});else if(Hi(n.key)&&!se(n.sep,"newline")){let l=ke(n.start),{key:c,sep:u}=n;u.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:l,key:c,sep:u}]})}else if(a.length>0)n.sep=n.sep.concat(a,this.sourceToken);else n.sep.push(this.sourceToken);else if(!n.sep)Object.assign(n,{key:null,sep:[this.sourceToken]});else if(n.value||o)s.items.push({start:a,key:null,sep:[this.sourceToken]});else if(se(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]});else n.sep.push(this.sourceToken);this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let l=this.flowScalar(this.type);if(o||n.value)s.items.push({start:a,key:l,sep:[]}),this.onKeyLine=!0;else if(n.sep)this.stack.push(l);else Object.assign(n,{key:l,sep:[]}),this.onKeyLine=!0;return}default:{let l=this.startBlockValue(s);if(l){if(l.type==="block-seq"){if(!n.explicitKey&&n.sep&&!se(n.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 if(r)s.items.push({start:a});this.stack.push(l);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(s){let n=s.items[s.items.length-1];switch(this.type){case"newline":if(n.value){let r="end"in n.value?n.value.end:void 0;if((Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment")r?.push(this.sourceToken);else s.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)s.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,s.indent)){let o=s.items[s.items.length-2]?.value?.end;if(Array.isArray(o)){Array.prototype.push.apply(o,n.start),o.push(this.sourceToken),s.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=s.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==s.indent)break;if(n.value||se(n.start,"seq-item-ind"))s.items.push({start:[this.sourceToken]});else n.start.push(this.sourceToken);return}if(this.indent>s.indent){let r=this.startBlockValue(s);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(s){let n=s.items[s.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while(r&&r.type==="flow-collection")}else if(s.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":if(!n||n.sep)s.items.push({start:[this.sourceToken]});else n.start.push(this.sourceToken);return;case"map-value-ind":if(!n||n.value)s.items.push({start:[],key:null,sep:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":if(!n||n.value)s.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);if(!n||n.value)s.items.push({start:[],key:o,sep:[]});else if(n.sep)this.stack.push(o);else Object.assign(n,{key:o,sep:[]});return}case"flow-map-end":case"flow-seq-end":s.end.push(this.sourceToken);return}let r=this.startBlockValue(s);if(r)this.stack.push(r);else yield*this.pop(),yield*this.step()}else{let r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===s.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){let o=Pt(r),a=ke(o);Qi(s);let l=s.end.splice(1,s.end.length);l.push(this.sourceToken);let c={type:"block-map",offset:s.offset,indent:s.indent,items:[{start:a,key:s,sep:l}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=c}else yield*this.lineEnd(s)}}flowScalar(s){if(this.onNewLine){let n=this.source.indexOf(`
|
|
138
|
-
`)+1;while(n!==0)this.onNewLine(this.offset+n),n=this.source.indexOf(`
|
|
139
|
-
`,n)+1}return{type:s,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(s){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 n=Pt(s),r=ke(n);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let n=Pt(s),r=ke(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(s,n){if(this.type!=="comment")return!1;if(this.indent<=n)return!1;return s.every((r)=>r.type==="newline"||r.type==="space")}*documentEnd(s){if(this.type!=="doc-mode"){if(s.end)s.end.push(this.sourceToken);else s.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}*lineEnd(s){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:if(s.end)s.end.push(this.sourceToken);else s.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}}ud.Parser=Gi});var tr=v(function(Sd){var Xi=Ps(),dd=Ke(),Ve=Re(),pd=Ut(),md=I(),yd=Us(),zi=Ys();function Zi(s){let n=s.prettyErrors!==!1;return{lineCounter:s.lineCounter||n&&new yd.LineCounter||null,prettyErrors:n}}function gd(s,n={}){let{lineCounter:r,prettyErrors:o}=Zi(n),a=new zi.Parser(r?.addNewLine),l=new Xi.Composer(n),c=Array.from(l.compose(a.parse(s)));if(o&&r)for(let u of c)u.errors.forEach(Ve.prettifyError(s,r)),u.warnings.forEach(Ve.prettifyError(s,r));if(c.length>0)return c;return Object.assign([],{empty:!0},l.streamInfo())}function er(s,n={}){let{lineCounter:r,prettyErrors:o}=Zi(n),a=new zi.Parser(r?.addNewLine),l=new Xi.Composer(n),c=null;for(let u of l.compose(a.parse(s),!0,s.length))if(!c)c=u;else if(c.options.logLevel!=="silent"){c.errors.push(new Ve.YAMLParseError(u.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(o&&r)c.errors.forEach(Ve.prettifyError(s,r)),c.warnings.forEach(Ve.prettifyError(s,r));return c}function bd(s,n,r){let o=void 0;if(typeof n==="function")o=n;else if(r===void 0&&n&&typeof n==="object")r=n;let a=er(s,r);if(!a)return null;if(a.warnings.forEach((l)=>pd.warn(a.options.logLevel,l)),a.errors.length>0)if(a.options.logLevel!=="silent")throw a.errors[0];else a.errors=[];return a.toJS(Object.assign({reviver:o},r))}function wd(s,n,r){let o=null;if(typeof n==="function"||Array.isArray(n))o=n;else if(r===void 0&&n)r=n;if(typeof r==="string")r=r.length;if(typeof r==="number"){let a=Math.round(r);r=a<1?void 0:a>8?{indent:8}:{indent:a}}if(s===void 0){let{keepUndefined:a}=r??n??{};if(!a)return}if(md.isDocument(s)&&!o)return s.toString(r);return new dd.Document(s,o,r).toString(r)}Sd.parse=bd;Sd.parseAllDocuments=gd;Sd.parseDocument=er;Sd.stringify=wd});import{execFileSync as yp}from"node:child_process";import{readFile as gp}from"node:fs/promises";import{basename as bp,dirname as wp,extname as cr,resolve as Sp}from"node:path";import{pathToFileURL as vp}from"node:url";var Od=Ps(),qd=Ke(),Ed=gs(),Js=Re(),Ld=Oe(),ne=I(),Td=z(),Cd=M(),_d=ee(),Id=te(),Vm=_t(),Pd=Fs(),$d=Us(),Md=Ys(),$t=tr(),sr=Ne();var xd=Od.Composer,Dd=qd.Document,Bd=Ed.Schema,{YAMLError:jd,YAMLParseError:Kd,YAMLWarning:Rd}=Js,Fd=Ld.Alias,{isAlias:Ud,isCollection:Yd,isDocument:Jd,isMap:Vd,isNode:Wd,isPair:Qd,isScalar:Hd,isSeq:Gd}=ne,Xd=Td.Pair,zd=Cd.Scalar,Zd=_d.YAMLMap,ep=Id.YAMLSeq;var tp=Pd.Lexer,sp=$d.LineCounter,np=Md.Parser,{parse:Vs,parseAllDocuments:ip,parseDocument:rp,stringify:op}=$t,{visit:ap,visitAsync:lp}=sr;var nr=["process_started","process_healthy","process_completed","process_completed_successfully","process_log_ready"],ir=["always","on_failure","exit_on_failure","no"],cp=(s)=>/^[A-Za-z0-9_@%+=:,./-]+$/u.test(s)?s:`'${s.replaceAll("'","'\\''")}'`,or=(s,n)=>{if(typeof n==="string"&&n.trim()!=="")return n;if(Array.isArray(n)&&n.length>0&&n.every((r)=>typeof r==="string"))return n.map(cp).join(" ");throw Error(`${s}: no command`)},fp=(s,n)=>{if(n===void 0)return;if(Array.isArray(n)){if(n.length===0)return;throw Error(`${s}: an environment list cannot say which values are secret references; use a map of name to {"$secret": "<name>"}`)}if(n===null||typeof n!=="object")throw Error(`${s}: environment must be a map`);let r={};for(let[o,a]of Object.entries(n)){let l=a!==null&&typeof a==="object"?a.$secret:void 0;if(typeof l!=="string"||l.length===0)throw Error(`${s}: env ${o} is a literal value; the neutral record carries only {"$secret": "<name>"}`);r[o]={$secret:l}}return r},up=(s)=>{let n=s.schedule??s,r=typeof n.cron==="string"?n.cron:void 0,o=typeof n.interval==="string"?n.interval:void 0,a=typeof s.timezone==="string"?s.timezone:void 0,l=typeof s.run_on_start==="boolean"?s.run_on_start:void 0;if(r===void 0&&o===void 0&&a===void 0&&l===void 0)return;return{...r!==void 0?{cron:r}:{},...o!==void 0?{interval:o}:{},...a!==void 0?{timezone:a}:{},...l!==void 0?{run_on_start:l}:{}}},hp=(s,n)=>{let r=n.restart??n.restart_policy;if(r===void 0)return;let o=r!==null&&typeof r==="object"?r:void 0,a=o===void 0?r:o.policy;if(typeof a!=="string"||!ir.includes(a))throw Error(`${s}: restart policy ${JSON.stringify(a)} is not one of ${ir.join(", ")}`);let l=o!==void 0&&typeof o.backoff_seconds==="number"?o.backoff_seconds:void 0,c=o!==void 0&&typeof o.max_restarts==="number"?o.max_restarts:void 0;return{policy:a,...l!==void 0?{backoff_seconds:l}:{},...c!==void 0?{max_restarts:c}:{}}},dp=(s,n)=>{let r=n.depends_on;if(r===void 0)return;let o=(a,l)=>{if(l===void 0)return{name:a,condition:"process_started"};if(typeof l!=="string"||!nr.includes(l))throw Error(`${s}: depends_on ${a} condition ${JSON.stringify(l)} is not one of ${nr.join(", ")}`);return{name:a,condition:l}};if(Array.isArray(r))return r.map((a)=>{if(typeof a!=="string")throw Error(`${s}: depends_on must name services`);return o(a,void 0)});if(r!==null&&typeof r==="object")return Object.entries(r).map(([a,l])=>{let c=l!==null&&typeof l==="object"?l.condition:void 0;return o(a,c)});throw Error(`${s}: depends_on must be a list or a map`)},pp=(s,n)=>{let r=n.readiness_probe??n.liveness_probe;if(r===void 0)return;if(r===null||typeof r!=="object")throw Error(`${s}: the health probe must be a map`);let o=r;if(o.exec?.command!==void 0)return{exec:or(`${s} health`,o.exec.command)};let a=o.http_get;if(a!==void 0&&typeof a.path==="string"&&typeof a.port==="number"){let l=typeof a.host==="string"?a.host:void 0,c=a.scheme==="https"||a.scheme==="http"?a.scheme:void 0;return{http:{port:a.port,...l!==void 0?{host:l}:{},path:a.path,...c!==void 0?{scheme:c}:{}}}}throw Error(`${s}: the health probe is neither exec.command nor http_get with path and port`)},ar=[{keys:["command"],to:["command"],read:(s,n)=>({command:or(s,n.command)})},{keys:["working_dir"],to:["cwd"],read:(s,n)=>typeof n.working_dir==="string"?{cwd:n.working_dir}:{}},{keys:["environment"],to:["env"],read:(s,n)=>{let r=fp(s,n.environment);return r===void 0?{}:{env:r}}},{keys:["schedule","cron","interval","timezone","run_on_start"],to:["schedule"],read:(s,n)=>{let r=up(n);return r===void 0?{}:{schedule:r}}},{keys:["restart","restart_policy"],to:["restart"],read:(s,n)=>{let r=hp(s,n);return r===void 0?{}:{restart:r}}},{keys:["depends_on"],to:["depends_on"],read:(s,n)=>{let r=dp(s,n);return r===void 0?{}:{depends_on:r}}},{keys:["readiness_probe","liveness_probe"],to:["health"],read:(s,n)=>{let r=pp(s,n);return r===void 0?{}:{health:r}}}],rr=new Set(ar.flatMap((s)=>s.keys));function mp(s,n){for(let r of Object.keys(n))if(!rr.has(r))throw Error(`${s}: ${r} is not a field this client carries, and the driver's record cannot hold it (carried: ${[...rr].join(", ")})`);return Object.assign({},...ar.map((r)=>r.read(s,n)))}function lr(s,n){let r;try{r=Vs(s.text)}catch(l){throw Error(`${s.path}: ${l.message}`)}if(r===null||typeof r!=="object")throw Error(`${s.path}: not a process-compose document`);let o=r.processes;if(o===void 0)throw Error(`${s.path}: no processes map; this is not a process-compose file`);if(o===null||typeof o!=="object")throw Error(`${s.path}: processes must be a map`);let a=[];for(let[l,c]of Object.entries(o)){if(c===null||typeof c!=="object")throw Error(`${l}: an entry must be a map`);let u=c;if(u.extends!==void 0)throw Error(`${l}: extends is not representable; the machine lists it read-only`);a.push({name:l,source:n,...mp(l,u)})}if(a.length===0)throw Error(`${s.path}: processes is empty; nothing to apply`);return a}var fr=new Set([".ts",".mts",".js",".mjs"]),kp=(s)=>s!==null&&typeof s==="object";async function Np(s,n){if(fr.has(cr(s))){let o=await import(vp(s).href);if(o.default===void 0)throw Error(`${s}: the program has no default export`);let a=typeof o.default==="function"?await o.default():o.default;if(!kp(a))throw Error(`${s}: the default export is not a plan object`);return a}let r=await gp(s,"utf8");return{services:lr({path:s,text:r},n)}}async function Ap(s){if(fr.has(cr(s)))return f("program",bp(s));let n;try{n=yp("git",["-C",wp(s),"rev-parse","--short=12","HEAD"],{encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{n="no-commit"}return f("file",`${s}@${n}`)}function Op(s){if(s.origin.trim().length===0||s.workspace.trim().length===0)return;let n={origin:s.origin.trim(),workspace:s.workspace.trim(),sessionFile:s.sessionFile,json:s.json},r=t();return{async mintHostJoin(o){let a=await e(n,r,{method:"POST",path:"/join-links",body:{purpose:"host",agentMemberIds:[...o]},what:"mint a host join link",label:"HOST_JOIN"});if("error"in a)throw Error(a.error);let l=a.answer;if(typeof l.id!=="string"||typeof l.code!=="string"||typeof l.expiresAt!=="string")throw Error(`HOST_JOIN_ANSWER_INVALID: the workspace minted a link without id, code and expiresAt (${JSON.stringify(a.answer).slice(0,300)})`);return{id:l.id,code:l.code,url:typeof l.url==="string"?l.url:"",expiresAt:l.expiresAt}}}}var qp=(s,n,r)=>{if(s.json){console.log(JSON.stringify(n,null,2));return}console.log(`machine ${s.machine}; source ${r.kind}:${r.id}`);for(let l of b(n))console.log(l);let o=n.agents;if(n.create.length+n.change.length+n.remove.length+(o===void 0?0:o.create.length+o.change.length+o.remove.length)+(n.hosts?.pending.length??0)===0)console.log("nothing to do")};async function iy(s,n){let r;try{if(n.stop&&n.keep)throw Error("--stop and --keep answer the same question differently; pass one");let o=Sp(s),a=await Ap(o),l=await Np(o,a);if((l.services!==void 0||l.agents!==void 0)&&n.machine.length===0)throw Error("--machine <url> is required: the machine's ahpd WebSocket endpoint");if(n.machine.length>0)r=await i(n.machine,{token:n.token,clientId:"hightea-apply"});let u=r??{call:async()=>{throw Error("this plan names no services or agents, so no ahpd channel is read")}},h=n.stop?"stop":n.keep?"keep":void 0,d=Op(n),g=await E(l,u,{source:a,prune:n.prune,...h===void 0?{}:{removal:h},...d===void 0?{}:{hostJoin:d}});if(qp(n,g,a),!n.yes){if(!n.json)console.log("nothing sent; run again with --yes to apply");return 0}let p=await T(g,u,d);if(n.json)console.log(JSON.stringify(p,null,2));else{let m=p.written.length===0?"nothing":p.written.join(", "),S=p.removed.length===0?"nothing":p.removed.join(", "),k=p.kept.length===0?"":`; kept ${p.kept.join(", ")}`,y=p.hostLinks===void 0||p.hostLinks.length===0?"":`; minted ${p.hostLinks.length} host ${p.hostLinks.length===1?"link":"links"}`;if(console.log(`wrote ${m}; removed ${S}${k}${y}`),p.hostNote!==void 0)console.log(`note: ${p.hostNote}`);for(let w of p.hostLinks??[])console.log(`host ${w.name}: join with ${w.link.url||w.link.code} (single use; expires ${w.link.expiresAt})`)}return 0}catch(o){return console.error(o.message),1}finally{r?.close()}}export{iy as applyFile};
|
package/dist/chunk-8x5daqht.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{p}from"./chunk-5zb06f9b.js";import"./chunk-9pv1nvfv.js";import"./chunk-69dva4cx.js";export{p as hostTrust};
|
package/dist/chunk-9pv1nvfv.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{g,k,c,a,d,u,l,y}from"./chunk-69dva4cx.js";import{readdir as ce,readFile as re,realpath as Ie,rm as ut}from"node:fs/promises";import{createRequire as Jn}from"node:module";import{homedir as Ln,hostname as xn}from"node:os";import{basename as mt,dirname as x,isAbsolute as yt,join as P,resolve as Fn}from"node:path";import{fromEnvRef as Kn,isRecord as F,readJsonObject as wt,readSecret as jn,secretRef as Gn,writeJsonAtomic as Te}from"@ahpd/sdk";import{fileVault as Bn}from"@ahpd/server/dist/vault.js";import{createHash as Ce,randomBytes as St}from"node:crypto";import{constants as Q}from"node:fs";import{link as Tt,lstat as ue,mkdir as De,mkdtemp as Nt,open as Ue,realpath as Et,rm as At}from"node:fs/promises";import{dirname as ie,join as B}from"node:path";import{isDeepStrictEqual as $e}from"node:util";import{fileVault as Pe}from"@ahpd/server/dist/vault.js";function b(e){throw Error(e)}function Je(e){return e!==null&&typeof e==="object"&&"code"in e&&typeof e.code==="string"?e.code:void 0}async function z(e){await De(e,{mode:448}).catch((i)=>{if(Je(i)!=="EEXIST")b("HOST_JOIN_CUSTODY_IO")});let t=await ue(e);if(!t.isDirectory()||t.uid!==process.getuid?.()||(t.mode&63)!==0)b("HOST_JOIN_UNSAFE_PATH")}async function Ht(e){let t=await Ue(e,Q.O_RDONLY|Q.O_DIRECTORY|Q.O_NOFOLLOW);try{await t.sync()}finally{await t.close()}}async function Y(e){let t=await Ue(e,Q.O_RDONLY|Q.O_NOFOLLOW);try{await t.sync()}finally{await t.close()}for(let i=ie(e);;i=ie(i))if(await Ht(i),i===ie(i))break}function ge(e){if(typeof e.origin!=="string"||typeof e.workspaceSlug!=="string"||typeof e.code!=="string"||typeof e.pluginVersion!=="string"||typeof e.ahpdVersion!=="string")b("HOST_JOIN_INVALID_INTENT");let t;try{t=new URL(e.origin)}catch{return b("HOST_JOIN_INVALID_INTENT")}let i=c(e.code);if(t.protocol!=="https:"||t.username||t.password||t.search||t.hash||t.pathname!=="/"||!i||!e.workspaceSlug||/[\s/\\?#]/u.test(e.workspaceSlug)||!e.pluginVersion||!e.ahpdVersion)b("HOST_JOIN_INVALID_INTENT");if(e.name!==void 0&&(typeof e.name!=="string"||e.name.trim()===""||e.name.length>64||[...e.name].some((w)=>{let s=w.codePointAt(0)??0;return s<32||s===127})))b("HOST_JOIN_INVALID_INTENT");if(e.app!==void 0&&!k(e.app))b("HOST_JOIN_INVALID_INTENT");if(e.hostId!==void 0&&(typeof e.hostId!=="string"||!/^[A-Za-z0-9_.:-]{1,128}$/u.test(e.hostId)))b("HOST_JOIN_INVALID_INTENT");if(e.ownerConfiguration===null&&e.app===void 0)b("HOST_JOIN_INVALID_INTENT");let f;try{f=e.ownerConfiguration===null?null:JSON.parse(JSON.stringify(e.ownerConfiguration))}catch{return b("HOST_JOIN_INVALID_INTENT")}if(f!==null&&(typeof f!=="object"||!$e(f,e.ownerConfiguration)))b("HOST_JOIN_INVALID_INTENT");return{...e,origin:t.origin,code:i,ownerConfiguration:f}}async function Le(e,t){let i=ge(t),f=await Fe(e),w=B(f,"hightea"),s=B(w,"claims"),p=Ce("sha256").update(JSON.stringify([i.origin,i.workspaceSlug,i.code])).digest("hex"),S=B(s,p),T=B(S,"ahpd");try{for(let E of[w,s,S,T])await z(E);let N=B(T,"vault.json"),_=await Nt(B(T,".claim-"));try{let E=B(_,"vault.json"),C=Pe({file:E});await C.set("host:hightea",`Bearer ${St(32).toString("base64url")}`),await C.set("host:hightea-join",JSON.stringify({schema:1,...i}));try{await Tt(E,N)}catch(D){if(Je(D)!=="EEXIST")b("HOST_JOIN_CUSTODY_PUBLICATION_FAILED")}let{authorization:R,credentialHash:H,intent:J}=await Ke(N);if(J.origin!==i.origin||J.workspaceSlug!==i.workspaceSlug||J.code!==i.code||J.app!==i.app||J.hostId!==i.hostId||!$e(J.ownerConfiguration,i.ownerConfiguration))b("HOST_JOIN_CLAIM_CONFLICT");return await Y(N),{home:S,vaultFile:N,authorization:R,credentialHash:H,intent:J}}finally{await At(_,{recursive:!0})}}catch(N){if(N instanceof Error&&/^HOST_JOIN_[A-Z_]+$/u.test(N.message))throw N;return b("HOST_JOIN_CUSTODY_IO")}}async function xe(e,t,i){let f=ge(i);if(f.hostId===void 0)b("HOST_JOIN_INVALID_INTENT");try{let w=await Fe(e),s=B(w,"hightea"),p=B(s,"claims");if(ie(t)!==p)b("HOST_JOIN_NO_CLAIM_FOR_HOST");let S=B(t,"ahpd");for(let _ of[s,p,t,S])await z(_);let T=B(S,"vault.json"),N=await Ke(T);if(N.intent.origin!==f.origin||N.intent.workspaceSlug!==f.workspaceSlug||N.intent.hostId!==void 0&&f.hostId!==N.intent.hostId)b("HOST_JOIN_CLAIM_CONFLICT");return await Y(T),{home:t,vaultFile:T,authorization:N.authorization,credentialHash:N.credentialHash,intent:f}}catch(w){if(w instanceof Error&&/^HOST_JOIN_[A-Z_]+$/u.test(w.message))throw w;return b("HOST_JOIN_NO_CLAIM_FOR_HOST")}}async function Fe(e){try{await De(e,{recursive:!0,mode:448});let t=await ue(e);if(!t.isDirectory()||t.uid!==process.getuid?.()||(t.mode&18)!==0)b("HOST_JOIN_UNSAFE_PATH");return await Et(e)}catch{return b("HOST_JOIN_UNSAFE_PATH")}}async function Ke(e){let t=await ue(e);if(!t.isFile()||t.uid!==process.getuid?.()||(t.mode&511)!==384)b("HOST_JOIN_UNSAFE_PATH");let i=Pe({file:e}),f=await i.get("host:hightea"),w=await i.get("host:hightea-join");if(!f||!/^Bearer [A-Za-z0-9_-]{43}$/u.test(f)||!w)b("HOST_JOIN_CLAIM_CORRUPT");let s;try{s=JSON.parse(w)}catch{return b("HOST_JOIN_CLAIM_CORRUPT")}if(!s||typeof s!=="object"||!("schema"in s)||s.schema!==1)b("HOST_JOIN_CLAIM_CORRUPT");let p;try{p=ge(s)}catch{return b("HOST_JOIN_CLAIM_CORRUPT")}return{authorization:f,credentialHash:`sha256:${Ce("sha256").update(f.slice(7),"utf8").digest("hex")}`,intent:p}}import{link as kt,lstat as Rt,mkdtemp as bt,rm as vt}from"node:fs/promises";import{join as ee}from"node:path";import{isDeepStrictEqual as Ct}from"node:util";import{isRecordSlug as Dt,readJsonObject as Ut,writeJsonAtomic as je}from"@ahpd/sdk";async function Ge(e,t){return Me(e,ee(e.home,"ahpd"),"config.json",t)}async function Be(e,t){if(!Dt(t.id))throw Error("HOST_JOIN_CONFIG_CONFLICT");let i=ee(e.home,"ahpd","agents");await z(i),await Me(e,i,`${t.id}.json`,{...t})}async function Me(e,t,i,f){let w=ee(t,i),s;try{if(JSON.stringify(f).includes(e.authorization))throw Error("HOST_JOIN_CONFIG_SECRET");s=await bt(ee(t,".config-"));let p=ee(s,"config.json");je(p,f,{mode:384});try{await kt(p,w)}catch(_){if(!_||typeof _!=="object"||!("code"in _)||_.code!=="EEXIST")throw Error("HOST_JOIN_CONFIG_PUBLICATION_FAILED")}let S=await Rt(w);if(!S.isFile()||S.uid!==process.getuid?.()||(S.mode&511)!==384)throw Error("HOST_JOIN_UNSAFE_PATH");let T=Ut(w);if(!T.ok)throw Error("HOST_JOIN_CONFIG_CORRUPT");let N={};for(let[_,E]of Object.entries(f)){let C=_==="unattendedAutoApprove"&&E===!1||_==="pluginMarketplaces"&&Array.isArray(E)&&E.length===0;if(i==="config.json"&&C&&!Object.hasOwn(T.value,_)){N[_]=E;continue}if(!Ct(T.value[_],E))throw Error("HOST_JOIN_CONFIG_CONFLICT")}if(Object.keys(N).length>0)je(w,{...T.value,...N},{mode:384});return await Y(w),w}catch(p){if(p instanceof Error&&/^HOST_JOIN_[A-Z_]+$/u.test(p.message))throw p;throw Error("HOST_JOIN_CONFIG_IO")}finally{if(s!==void 0)await vt(s,{recursive:!0})}}import{isRecord as V}from"@ahpd/sdk";class te extends Error{kind;status;serverCode;constructor(e,t,i){super(e);this.kind=e;this.status=t;this.serverCode=i}}function $t(e,t){if(e===401||e===403)return"HOST_JOIN_NOT_AUTHORIZED";if(t==="AGENT_HOST_CONFLICT"||t==="HOST_REGISTRATION_CONFLICT")return"HOST_JOIN_AGENT_BOUND";if(t==="HOST_REGISTRATION_UNSETTLED")return"HOST_JOIN_UNSETTLED";return"HOST_JOIN_REJECTED"}async function Ve(e){await Y(e.vaultFile);let t=e.intent,i=new Request(`${t.origin}/api/ws/${encodeURIComponent(t.workspaceSlug)}/join/${encodeURIComponent(t.code)}`,{method:"POST",redirect:"error",headers:{"content-type":"application/json"},signal:AbortSignal.timeout(1e4),body:JSON.stringify({credentialHash:e.credentialHash,pluginVersion:t.pluginVersion,ahpdVersion:t.ahpdVersion,...t.name===void 0?{}:{name:t.name},...t.app===void 0?{}:{app:t.app},...t.hostId===void 0?{}:{hostId:t.hostId}})}),f;try{f=await fetch(i)}catch{throw Error("HOST_JOIN_NETWORK_UNKNOWN")}if(f.status===410){let s;try{s=await f.json()}catch{}if(V(s)&&V(s.error)&&s.error.code==="HOST_REGISTRATION_CANCELLED")throw Error("HOST_JOIN_CANCELLED");throw Error("HOST_JOIN_LINK_UNAVAILABLE")}if(f.status>=500){let s;try{s=await f.json()}catch{}let p=V(s)&&V(s.error)&&g(s.error.code)?s.error.code:void 0;if(p==="HOST_REGISTRATION_UNSETTLED")throw new te("HOST_JOIN_UNSETTLED",f.status,p);throw Error("HOST_JOIN_REMOTE_UNAVAILABLE")}if(!f.ok){let s;try{s=await f.json()}catch{}let p=V(s)&&V(s.error)&&g(s.error.code)?s.error.code:void 0;throw new te($t(f.status,p),f.status,p)}let w;try{w=await f.json()}catch{throw Error("HOST_JOIN_RECEIPT_INVALID")}if(!V(w)||typeof w.workspaceId!=="string"||!/^ws_[A-Za-z0-9_-]{1,64}$/u.test(w.workspaceId)||typeof w.hostId!=="string"||!/^[A-Za-z0-9_.:-]{1,128}$/u.test(w.hostId)||w.state!=="pending"&&w.state!=="registered"||w.agentMemberId!==void 0&&(typeof w.agentMemberId!=="string"||!/^[A-Za-z0-9_.:-]{1,128}$/u.test(w.agentMemberId)))throw Error("HOST_JOIN_RECEIPT_INVALID");return{workspaceId:w.workspaceId,hostId:w.hostId,state:w.state,...w.agentMemberId===void 0?{}:{agentMemberId:w.agentMemberId}}}import{access as Pt,stat as fe}from"node:fs/promises";import{constants as Jt}from"node:fs";import{delimiter as Lt,dirname as We,isAbsolute as xt,join as Ft}from"node:path";import{fileURLToPath as Kt}from"node:url";import{fromEnvRef as jt,isRecord as M,isRecordSlug as Gt,readJsonObject as Bt,scopeOf as Mt,secretPaths as Vt,secretRef as Wt}from"@ahpd/sdk";import{checkManifest as zt,checkStandalone as Yt,readManifest as Zt,readStandalone as Xt,resolvePlugin as qt}from"@ahpd/server/dist/plugins.js";function U(e="HOST_JOIN_OWNER_RESOURCE"){throw Error(e)}function ze(e){let t=jt(e);if(t!==void 0){if(!process.env[t])U();return!0}let i=Wt(e);if(i===void 0)return!1;return Mt(i),!0}async function Qt(e){let t=xt(e)?[e]:(process.env.PATH??"").split(Lt).map((i)=>Ft(i,e));for(let i of t)try{if(await Pt(i,Jt.X_OK),(await fe(i)).isFile())return}catch{}U()}async function ne(e){let t=Bt(e);if(!t.ok)U("HOST_JOIN_OWNER_INPUT");let i=t.value;if(!Array.isArray(i.agents)||i.agents.length===0||!Array.isArray(i.plugins)||i.plugins.length===0||!Array.isArray(i.records))U();let f=new Set,w=new Set,s=[];try{for(let _ of i.plugins){let E=typeof _==="string"?{source:_}:_;if(!M(E)||typeof E.source!=="string"||E.enabled===!1)U();let R=qt(E,{cwd:We(e),configDir:We(e)});if(!R.path||!(await fe(R.path)).isFile())U();let H=R.manifestPath?Xt(R.manifestPath):R.packageDir?Zt(R.packageDir):void 0;if(!H||H.problem||(H.standalone?Yt(H):zt(H,R.packageDir)))U();if(H.name==="@ahpd/bot"||H.name==="bot")U("HOST_JOIN_OWNER_BOT");for(let D of H.contracts?.engines??[])f.add(D);for(let D of H.contracts?.agents??[])w.add(D);if(E.options!==void 0&&!M(E.options))U();let J=M(E.options)?E.options:{};for(let D of Vt(H.optionsSchema??{},J)){let L=J;for(let j of D.split("."))L=M(L)?L[j]:void 0;if(L!==void 0&&!ze(L))U("HOST_JOIN_OWNER_SECRET")}s.push({...E,source:R.manifestPath??R.packageDir??R.path})}let p=[],S=new Set(w);for(let _ of i.records){if(!M(_)||typeof _.id!=="string"||!Gt(_.id)||S.has(_.id)||typeof _.engine!=="string"||!f.has(_.engine)||typeof _.owner!=="string"||typeof _.name!=="string"||!M(_.config)||_.mode!==void 0&&_.mode!=="enabled")U();if(_.model!==void 0&&(typeof _.model!=="string"||_.model.trim()===""))U();if(_.engine==="acp"&&typeof _.config.command!=="string")U();if(_.config.command!==void 0){if(typeof _.config.command!=="string"||!_.config.command)U();await Qt(_.config.command)}if(_.config.env!==void 0){if(!M(_.config.env))U();for(let E of Object.values(_.config.env))if(!ze(E))U("HOST_JOIN_OWNER_SECRET")}S.add(_.id),p.push(_)}let T=[],N=new Set;for(let _ of i.agents){if(!Array.isArray(_)||_.length!==2||typeof _[0]!=="string"||!_[0]||N.has(_[0])||!M(_[1])||typeof _[1].provider!=="string"||!S.has(_[1].provider)||typeof _[1].workingDirectory!=="string")U();let E=new URL(_[1].workingDirectory);if(E.protocol!=="file:"||E.hostname||!(await fe(Kt(E))).isDirectory())U();if(_[1].settings!==void 0&&!M(_[1].settings))U();N.add(_[0]),T.push([_[0],{provider:_[1].provider,workingDirectory:E.href,..._[1].settings===void 0?{}:{settings:_[1].settings}}])}return{agents:T,plugins:s,records:p}}catch(p){if(p instanceof Error&&/^HOST_JOIN_OWNER_[A-Z_]+$/u.test(p.message))throw p;return U()}}import{constants as en}from"node:fs";import{access as tn,mkdir as nn,stat as rn,writeFile as on}from"node:fs/promises";import{createRequire as sn}from"node:module";import{dirname as Ze,resolve as Xe}from"node:path";import{pathToFileURL as an}from"node:url";class se extends Error{file;entry;constructor(e,t){super("HOST_JOIN_OWNER_CONFIG_NEEDS_AGENT");this.file=e;this.entry=t}}function dn(){try{return Ze(sn(import.meta.url).resolve("@ahpd/agent-acp/package.json"))}catch{throw Error("HOST_JOIN_AGENT_PLUGIN_MISSING")}}function qe(e,t,i){return[t,{provider:e.id,workingDirectory:an(Xe(i)).href}]}function cn(e,t,i){return JSON.stringify(qe(e,t,i))}function ln(e,t){let[i,f]=qe(e.app,e.agentMemberId,e.workingDirectory);return`${JSON.stringify({plugins:[t],records:[{id:e.app.id,engine:"acp",owner:"host",name:e.app.name,config:{command:e.app.command}}],agents:[[i,f]]},null,2)}
|
|
2
|
-
`}async function Qe(e){let t=Xe(e.file);if(await tn(t,en.F_OK).then(()=>!0,()=>!1))return Ye(t,e);await nn(Ze(t),{recursive:!0,mode:448});try{await on(t,ln(e,dn()),{flag:"wx",mode:384})}catch(f){if(f!==null&&typeof f==="object"&&"code"in f&&f.code==="EEXIST")return Ye(t,e);throw Error("HOST_JOIN_OWNER_FILE_IO")}let i=await rn(t);if(!i.isFile()||i.uid!==process.getuid?.()||(i.mode&511)!==384)throw Error("HOST_JOIN_UNSAFE_PATH");return ne(t)}async function Ye(e,t){let i=await ne(e);if(i.agents.some(([f])=>f===t.agentMemberId))return i;throw new se(e,cn(t.app,t.agentMemberId,t.workingDirectory))}import{access as Mn}from"node:fs/promises";import{constants as Vn}from"node:fs";import{createHash as un}from"node:crypto";import{lstat as et,mkdir as gn,mkdtemp as fn,readFile as pe,rename as hn,rm as pn,writeFile as he}from"node:fs/promises";import{isAbsolute as tt,join as K,normalize as ae}from"node:path";var mn="hightea-pipe",ye="bundle.json";function we(e){return K(e,"hightea","plugins")}async function nt(e){let t;try{t=await pe(K(e,"plugin.json"))}catch{throw Error("HOST_JOIN_PLUGIN_BUNDLE")}let i;try{i=JSON.parse(t.toString("utf8"))}catch{throw Error("HOST_JOIN_PLUGIN_BUNDLE")}let f=typeof i==="object"&&i!==null&&"main"in i?i.main:void 0,w=typeof i==="object"&&i!==null&&"id"in i?i.id:void 0,s=typeof i==="object"&&i!==null&&"version"in i?i.version:void 0;if(w!==mn||typeof s!=="string"||typeof f!=="string"||tt(f)||ae(f).startsWith("..")||ae(f).includes("/")||["plugin.json",ye].includes(ae(f)))throw Error("HOST_JOIN_PLUGIN_BUNDLE");let p;try{p=await pe(K(e,f))}catch{throw Error("HOST_JOIN_PLUGIN_BUNDLE")}return{manifestBytes:t,version:s,main:ae(f),mainBytes:p,sha256:yn(t,p)}}function yn(e,t){return un("sha256").update(e).update("\x00").update(t).digest("hex")}async function de(e){let t=K(e,".."),i;try{i=JSON.parse(await pe(K(t,ye),"utf8"))}catch(w){return{ok:!1,reason:rt(w)?"missing":"corrupt"}}let f;try{f=await nt(t)}catch{return{ok:!1,reason:"corrupt"}}if(typeof i!=="object"||i===null||!("version"in i)||!("sha256"in i)||typeof i.version!=="string"||i.sha256!==f.sha256)return{ok:!1,reason:"corrupt"};return{ok:!0,bundle:{manifest:e,version:i.version,sha256:f.sha256}}}async function _e(e,t,i){if(!tt(e)||!/^[0-9A-Za-z.+-]+$/u.test(i))throw Error("HOST_JOIN_UNSAFE_PATH");let f=await nt(t);if(f.version!==i)throw Error("HOST_JOIN_PLUGIN_BUNDLE");try{await gn(e,{recursive:!0,mode:448});let T=await et(e);if(!T.isDirectory()||T.uid!==process.getuid?.()||(T.mode&18)!==0)throw Error("unsafe")}catch{throw Error("HOST_JOIN_UNSAFE_PATH")}let w=we(e);for(let T of[K(e,"hightea"),w])await z(T);let s=K(w,i),p=K(s,"plugin.json");if(!await wn(s)){let T=await fn(K(w,`.${i}-`));try{await he(K(T,"plugin.json"),f.manifestBytes,{mode:384}),await he(K(T,f.main),f.mainBytes,{mode:384}),await he(K(T,ye),`${JSON.stringify({version:i,sha256:f.sha256})}
|
|
3
|
-
`,{mode:384});try{await hn(T,s)}catch(N){if(!me(N,"EEXIST")&&!me(N,"ENOTEMPTY"))throw Error("HOST_JOIN_CONFIG_IO")}}finally{await pn(T,{recursive:!0,force:!0})}}let S=await de(p);if(!S.ok||S.bundle.sha256!==f.sha256||S.bundle.version!==i)throw Error("HOST_JOIN_PLUGIN_BUNDLE_CONFLICT");return S.bundle}async function wn(e){try{return await et(e),!0}catch(t){if(rt(t))return!1;throw Error("HOST_JOIN_UNSAFE_PATH")}}function rt(e){return me(e,"ENOENT")}function me(e,t){return typeof e==="object"&&e!==null&&"code"in e&&e.code===t}import{createPrivateKey as Hn,createPublicKey as kn,generateKeyPairSync as Rn,sign as co}from"node:crypto";import{appendFile as uo,chmod as bn,readFile as ot,rename as vn,writeFile as Cn}from"node:fs/promises";import{join as it}from"node:path";var Qr=Buffer.from("302a300506032b6570032100","hex");import{createHash as In}from"node:crypto";import{existsSync as On,readFileSync as Sn}from"node:fs";import{join as Tn}from"node:path";var Nn="trusted-keys.json",h=/^(?=.{1,64}$)[A-Za-z0-9][A-Za-z0-9._-]*(?: [A-Za-z0-9._-]+)*$/u,En=/^[A-Za-z0-9_-]{42}[AEIMQUYcgkosw048]$/u,An=(e)=>Buffer.from(e).toString("base64url");function r(e){if(!En.test(e))return{error:"TRUST_KEY_INVALID: the public key must be 43 base64url characters (a raw 32-byte Ed25519 key), as the browser's Members page shows it"};return{keyId:An(In("sha256").update(Buffer.from(e,"base64url")).digest())}}function m(e){let t=Tn(e,Nn);if(!On(t))return{state:"missing",file:t};let i;try{i=JSON.parse(Sn(t,"utf8"))}catch(w){throw Error(`TRUST_FILE_UNREADABLE: ${t} is not JSON (${w.message})`)}let f=i;if(typeof i!=="object"||i===null||f.v!==1||!Array.isArray(f.keys))throw Error(`TRUST_FILE_UNREADABLE: ${t} is not a version 1 list of trusted keys`);for(let w of f.keys){let s=w,p=typeof s.publicKey==="string"?r(s.publicKey):void 0;if(typeof s.name!=="string"||!h.test(s.name)||p===void 0||"error"in p||s.keyId!==p.keyId||typeof s.addedAt!=="string")throw Error(`TRUST_FILE_UNREADABLE: ${t} holds an entry that is not a valid trusted key: ${JSON.stringify(w)}`)}return{state:"read",file:t,keys:f.keys}}var st="host-signing-key";async function at(e){try{await ot(it(e,st))}catch(t){if(t.code==="ENOENT")return{state:"missing"}}try{return{state:"ok",key:await Dn(e)}}catch(t){return{state:"unreadable",reason:t instanceof Error?t.message:String(t)}}}async function Dn(e,t=()=>Date.now()){let i=it(e,st),f;try{f=await ot(i,"utf8")}catch(S){if(S.code!=="ENOENT")throw Error(`HOST_KEY_UNREADABLE: ${i} exists but cannot be read (${String(S)}); it is never regenerated, fix or remove it by hand`)}if(f===void 0){let S=Rn("ed25519").privateKey.export({format:"pem",type:"pkcs8"}).toString(),T=`${i}.${String(process.pid)}.tmp`;await Cn(T,S,{mode:384,flag:"wx"}),await bn(T,384),await vn(T,i),f=S}let w;try{if(w=Hn({key:f,format:"pem"}),w.asymmetricKeyType!=="ed25519")throw Error(`a ${String(w.asymmetricKeyType)} key, not Ed25519`)}catch(S){throw Error(`HOST_KEY_UNREADABLE: ${i} is not an Ed25519 PKCS8 key (${String(S)}); it is never regenerated, fix or remove it by hand`)}let s=kn(w).export({format:"jwk"}).x,p=s===void 0?{error:"no public key"}:r(s);if("error"in p)throw Error(`HOST_KEY_UNREADABLE: ${i}: ${p.error}`);return{privateKey:w,trusted:{name:"this-host",keyId:p.keyId,publicKey:s,addedAt:new Date(t()).toISOString()}}}import{createServer as Un}from"node:net";var dt="hightea";function ct(e){return`http://127.0.0.1:${String(e)}/mcp`}function $n(e){let t=2166136261;for(let i of new TextEncoder().encode(e))t^=i,t=Math.imul(t,16777619)>>>0;return 40000+t%20000}async function lt(e){let t=$n(e);for(let i=0;i<200;i+=1){let f=40000+(t-40000+i)%20000;if(await Pn(f))return f}throw Error(`HOST_TOOLS_PORT_UNAVAILABLE: every port from ${String(t)} to ${String(t+199)} on 127.0.0.1 is taken`)}async function Pn(e){let t=Un();return await new Promise((i)=>{t.once("error",()=>{i(!1)}),t.listen(e,"127.0.0.1",()=>{t.close(()=>{i(!0)})})})}var Wn="hightea host join --origin https://your-deployment --workspace SLUG --code CODE --owner-config /absolute/owner.json",zn=(e)=>[...e].some((t)=>{let i=t.codePointAt(0)??0;return i<32||i===127});function Yn(e=xn()){let t=e.trim();return t===""||t.length>64||zn(t)?void 0:t}var Zn="https://hightea.ai/docs/host#owner";class Ne extends Error{file;constructor(e){super("HOST_JOIN_OWNER_CONFIG_MISSING");this.file=e}}var Xn=(e)=>`no owner config at ${e}: write one listing the plugins, agent records and agents this computer runs — `+`the three fields with an example of each are at ${Zn} — then run the same command again. Nothing was redeemed and nothing was written.`,qn=(e,t)=>`the owner config at ${e} does not map the agent this computer just created. Add this pair to its "agents" array — `+`${t} — then run the same command again; the registration is pending and resumes.`;class Ee extends Error{appName;install;constructor(e,t){super("HOST_JOIN_APP_MISSING");this.appName=e;this.install=t}}var Qn=(e)=>`${e.appName} is not on this computer: install it with \`${e.install}\`, then run the same command again. Nothing was redeemed and nothing was written.`,X={HOST_JOIN_USAGE:`Expected: ${Wn}`,HOST_JOIN_INPUT:"Command input could not be read. Use --help for the supported options.",HOST_JOIN_INVALID_INTENT:"Use an HTTPS deployment origin, workspace slug and valid join code.",HOST_JOIN_OWNER_INPUT:"The --owner-config file must exist and contain a JSON object; its contents were not printed.",HOST_JOIN_OWNER_RESOURCE:"Check the explicit agent mappings, provider plugins, working directories, executables and referenced credentials in --owner-config. No code was redeemed.",HOST_JOIN_OWNER_SECRET:"Replace inline provider secrets with existing ahpd fromEnv or SecretRef values; the referenced resource must be available locally.",HOST_JOIN_OWNER_BOT:"@ahpd/bot is not allowed on a member host (bots run on the server); remove it from this owner's plugin list",HOST_JOIN_UNSAFE_PATH:"The selected configuration path must be owned by this user and private; symlinks and shared files are not used.",HOST_JOIN_CLAIM_CONFLICT:"This claim already holds different deployment or owner settings. Keep its vault and use the original settings to resume.",HOST_JOIN_CLAIM_CORRUPT:"The selected claim vault is invalid. Keep it for recovery; joining will not replace its credential.",HOST_JOIN_NO_CLAIM_FOR_HOST:"This computer holds no claim for that host. Join without --host to register this computer as a new host; --host only extends a host this computer already holds, reusing its credential.",HOST_JOIN_NETWORK_UNKNOWN:"The registration result is unknown. Keep this claim and rerun the same command to recover its receipt.",HOST_JOIN_REMOTE_UNAVAILABLE:"The deployment could not complete registration. Keep this claim and rerun the same command later.",HOST_JOIN_CANCELLED:"The owner cancelled this host registration. Keep the existing claim; request a new join code for another registration.",HOST_JOIN_LINK_UNAVAILABLE:"This join code is expired or unavailable. Keep the existing claim; request a new code if registration was not completed.",HOST_JOIN_REJECTED:"The deployment rejected registration. Check the deployment and workspace; the selected credential was retained.",HOST_JOIN_NOT_AUTHORIZED:"The deployment refused this account for that workspace or agent. Join with the account that owns the agents in --owner-config; the selected credential was retained.",HOST_JOIN_AGENT_BOUND:"The deployment refused this registration; the server code on this line says which case it is. AGENT_HOST_CONFLICT: an agent in --owner-config already belongs to another active host — revoke that host, then mint a new code. HOST_REGISTRATION_CONFLICT: this code was already redeemed by a different host registration — join with the claim that computer already holds, or mint a new code. Never revoke a host on the strength of this line alone; the selected credential was retained.",HOST_JOIN_UNSETTLED:"The workspace did not answer this registration within a minute. The code is unspent and this claim is intact; wait a minute, then run the same command again.",HOST_JOIN_RECEIPT_INVALID:"The deployment returned an invalid registration receipt. Keep this claim and retry against the correct deployment.",HOST_JOIN_CONFIG_CONFLICT:"Existing host configuration has different bindings or required settings. It was preserved; reconcile it with the original claim before retrying.",HOST_JOIN_CONFIG_CORRUPT:"Existing host configuration is invalid JSON. It was preserved for local repair; rerun after repairing it.",HOST_JOIN_CLAIM_VERSION:"This join code's claim was started by another hightea version. Finish it with that version, or request a new join code; nothing was redeemed or written.",HOST_JOIN_PLUGIN_BUNDLE:"This installation's host plugin is missing or unreadable. Reinstall @hallohuman/hightea; no configuration was written.",HOST_JOIN_PLUGIN_BUNDLE_CONFLICT:"The installed host plugin for this version differs from this installation's copy. It was preserved; reinstall the same version or repair that directory. No configuration was written.",HOST_JOIN_AGENT_PLUGIN_MISSING:"This installation cannot find @ahpd/agent-acp, the plugin that runs agent apps. Reinstall @hallohuman/hightea; nothing was redeemed.",HOST_JOIN_APPS_ROW_MISSING:"This installation's app list and the daemon's rows disagree. Reinstall @hallohuman/hightea; nothing was redeemed.",HOST_JOIN_OWNER_FILE_IO:"The owner config could not be written. No existing file was replaced; check the folder's permissions and retry."};function W(e,t){let i=process.env[e]||P(Ln(),t);if(!yt(i))throw Error("HOST_JOIN_UNSAFE_PATH");return i}function er(){let e=Jn(import.meta.url).resolve("@ahpd/server/package.json");return{node:process.execPath,main:P(x(e),"dist","main.js")}}var Oe=(e)=>`'${e.replaceAll("'","'\\''")}'`;function oe(e,t=er()){return`XDG_CONFIG_HOME=${Oe(e)} ${Oe(t.node)} ${Oe(t.main)} start`}var tr={JOIN_LINK_INVALID:"the join code is no longer valid",JOIN_LINK_NOT_FOUND:"no such join code in that workspace",ROLE_NOT_ALLOWED:"the join code does not allow this role",NOT_A_MEMBER:"the signed-in account is not a member of that workspace",FORBIDDEN:"an agent in --owner-config belongs to another account",HOST_REGISTRATION_CANCELLED:"the owner cancelled this registration",HOST_REGISTRATION_CONFLICT:"this code was redeemed for a different host registration; a computer that already has a host joins with the claim it already holds",AGENT_HOST_CONFLICT:"an agent already belongs to another active host; revoke that host, then mint a new code",HOST_REGISTRATION_MISSING:"the pending registration is gone",HOST_REGISTRATION_UNSETTLED:"the workspace has not answered the registration within a minute; run the same command again",INVALID_REQUEST:"the deployment did not accept this request's shape",BAD_ORIGIN:"the request came from another site",UNAUTHENTICATED:"the request carried no signed-in account",WORKSPACE_NOT_FOUND:"no such workspace for this account",PEOPLE_LIMIT:"that workspace is at its beta limit of people",AGENTS_LIMIT:"that workspace is at its beta limit of agents"},nr={HOST_JOIN_NOT_AUTHORIZED:3,HOST_JOIN_AGENT_BOUND:4,HOST_JOIN_REJECTED:1,HOST_JOIN_UNSETTLED:2};function rr(e){let t=e.serverCode===void 0?"":` The deployment says ${tr[e.serverCode]}.`;return`${e.kind}: ${X[e.kind]}${t} (HTTP ${e.status}, server code ${e.serverCode??"unrecognised"})`}async function v(e,t){try{let{origin:i,workspace:f,code:w,ownerConfig:s}=e;if(!i||!f||!w||!s)throw Error("HOST_JOIN_USAGE");let p=Fn(s),S=await Mn(p,Vn.F_OK).then(()=>!0,()=>!1);if(!S&&e.ownerConfigIsDefault!==!0)throw Error("HOST_JOIN_OWNER_INPUT");if(!S&&e.app===void 0)throw new Ne(p);let T=e.app===void 0?void 0:l(e.app);if(T!==void 0&&!await y(T))throw new Ee(T.name,u(T));let N=S?await ne(p):null,_=W("XDG_CONFIG_HOME",".config"),E=W("XDG_DATA_HOME",P(".local","share")),C=Yn(),R={origin:i,workspaceSlug:f,code:w,pluginVersion:t.version,ahpdVersion:"0.15.0-rc.4",ownerConfiguration:N,...C===void 0?{}:{name:C},...e.app===void 0?{}:{app:e.app},...e.hostId===void 0?{}:{hostId:e.hostId}},H;if(e.hostId===void 0)H=await Le(_,R);else{let G=await n(e.hostId);if("error"in G)throw Error("HOST_JOIN_NO_CLAIM_FOR_HOST");H=await xe(_,G.claim,R)}if(H.intent.pluginVersion!==t.version)throw Error("HOST_JOIN_CLAIM_VERSION");let J=Bn({file:H.vaultFile}),D=async(G)=>{let be=Gn(G),ve=Kn(G);if(ve!==void 0){if(!process.env[ve])throw Error("HOST_JOIN_OWNER_RESOURCE")}else if(be!==void 0)try{await jn(J,be)}catch{throw Error("HOST_JOIN_OWNER_RESOURCE")}else if(Array.isArray(G))for(let le of G)await D(le);else if(F(G))for(let le of Object.values(G))await D(le)};if(N!==null)await D(N);let L=await _e(E,t.directory,t.version),j=await Ve(H);if(j.state==="pending")return console.log("Host registration pending. Run the same command again to resume."),2;let q=T===void 0?N:await Qe({file:p,app:T,agentMemberId:fr(j.agentMemberId),workingDirectory:e.workingDirectory??process.cwd()});if(q===null)throw Error("HOST_JOIN_OWNER_INPUT");if(T!==void 0)await D(q);for(let G of q.records)await Be(H,G);let ke=new URL(`/gateway/${encodeURIComponent(j.workspaceId)}/host`,H.intent.origin);ke.protocol="wss:";let Re=await lt(H.home);return await Ge(H,{host:"127.0.0.1",updateCheck:!1,httpApi:!1,modelApi:!1,mcpTools:"none",unattendedAutoApprove:!1,pluginMarketplaces:[],mcpServers:{[dt]:{type:"http",url:ct(Re)}},plugins:[...q.plugins,{source:L.manifest,grants:[..._t],options:{cloudUrl:ke.href,workspaceId:j.workspaceId,agents:q.agents,mcpUrl:new URL(`/w/${encodeURIComponent(j.workspaceId)}`,H.intent.origin).href,hostToolsPort:Re,headers:{[a]:j.hostId,authorization:{$secret:"host:hightea"}}}}]}),console.log(`Host registered; local configuration saved. Start it with: ${oe(H.home)}`),0}catch(i){if(i instanceof te)return console.error(rr(i)),nr[i.kind];if(i instanceof Ne)return console.error(Xn(i.file)),1;if(i instanceof se)return console.error(qn(i.file,i.entry)),1;if(i instanceof Ee)return console.error(Qn(i)),1;let f=i instanceof Error&&/^HOST_JOIN_[A-Z_]+$/u.test(i.message)?i.message:"HOST_JOIN_INPUT";return console.error(`${f}: ${X[f]??"Local claim storage could not be safely published or flushed. Keep the existing files, check filesystem access and retry; no replacement credential was selected."}`),1}}function Ae(e){return F(e)&&F(e.options)&&typeof(e.options.workspaceId??e.options.houseId)==="string"&&F(e.options.headers)&&typeof(e.options.headers[a]??e.options.headers[d])==="string"}async function He(e){let t=P(e,"ahpd","config.json"),i;try{i=await re(t,"utf8")}catch(N){return typeof N==="object"&&N!==null&&"code"in N&&N.code==="ENOENT"?{claim:e,state:"pending"}:{claim:e,state:"unreadable",config:t}}let f;try{f=JSON.parse(i)}catch{return{claim:e,state:"unreadable",config:t}}let s=(F(f)&&Array.isArray(f.plugins)?f.plugins:[]).find(Ae);if(s===void 0||typeof s.source!=="string"||!F(s.options)||!F(s.options.headers))return{claim:e,state:"unreadable",config:t};let p=s.source,S=await de(p),T=!S.ok?S.reason:S.bundle.version===mt(x(p))?"ok":"wrong-version";return{claim:e,state:"joined",config:t,start:oe(e),pluginBundle:p,bundle:T,...S.ok?{pluginVersion:S.bundle.version}:{},workspaceId:String(s.options.workspaceId??s.options.houseId),hostId:String(s.options.headers[a]??s.options.headers[d]),...typeof s.options.cloudUrl==="string"?{gateway:s.options.cloudUrl}:{},signingKey:await ir(x(t)),...await or(x(t))}}async function or(e){let t=await It(e);if(t===void 0||t instanceof Error)return{};return{heldBundle:{from:t.from,toVersion:t.toVersion,connected:await Ot(e)===t.toVersion}}}async function ir(e){let t=await at(e);if(t.state==="ok")return{state:"ok",keyId:t.key.trusted.keyId,publicKey:t.key.trusted.publicKey};return t}function sr(e){if(e===void 0||e.state==="missing")return"(made on this host's first start)";if(e.state==="unreadable")return`unreadable: ${e.reason}`;return`${e.keyId} public ${e.publicKey} (another machine trusts it with: hightea host trust add <name> ${e.publicKey})`}function ar(e,t){if(e===void 0)return"";return e===t?`, version ${e}`:`, version ${e}; this CLI is ${t}`}async function A(e){let t;try{t=P(W("XDG_CONFIG_HOME",".config"),"hightea","claims")}catch{return console.error(`HOST_STATUS_UNSAFE_PATH: ${X.HOST_JOIN_UNSAFE_PATH}`),1}let i=[];try{i=(await ce(t)).filter((s)=>!s.startsWith(".")).sort()}catch(s){if(!(typeof s==="object"&&s!==null&&("code"in s)&&s.code==="ENOENT"))return console.error(`HOST_STATUS_UNREADABLE: cannot list ${t}`),1}let f=await Promise.all(i.map((s)=>He(P(t,s))));if(e.json)console.log(JSON.stringify({version:e.version,claims:t,hosts:f},null,2));else for(let s of f)if(s.state==="pending")console.log(`pending ${s.claim} (registration not finished; rerun the same join command)`);else if(s.state==="unreadable")console.log(`unreadable ${s.config}`);else console.log([`joined workspace ${s.workspaceId} host ${s.hostId}`,` gateway ${s.gateway??"(none)"}`,` config ${s.config}`,` start ${s.start}`,` plugin ${s.pluginBundle} (${s.bundle}${ar(s.pluginVersion,e.version)})`,` key ${sr(s.signingKey)}`,...s.heldBundle===void 0?[]:[` held ${s.heldBundle.from} until this host connects at ${s.heldBundle.toVersion}${s.heldBundle.connected?" (it has; the next `hightea host update` removes it)":""}`]].join(`
|
|
4
|
-
`));let w=f.filter((s)=>s.state==="joined"&&s.bundle!=="ok");for(let s of w){let p=s.bundle==="missing"?"is missing":s.bundle==="corrupt"?"does not match its recorded hash":`records version ${s.pluginVersion}, not the version its directory names`,S=s.bundle==="wrong-version"?"Restore the bundle that directory name records, or re-join with a new code to install this CLI's bundle.":"Re-join with a new code to install this version's bundle.";console.error(`HOST_STATUS_PLUGIN_BUNDLE: the plugin bundle ${s.pluginBundle} ${p}; the host cannot load it. ${S}`)}if(w.length>0)return 2;if(f.some((s)=>s.state==="unreadable"))return console.error("HOST_STATUS_CONFIG_UNREADABLE: a saved host configuration could not be read; it was left unchanged."),1;if(!f.some((s)=>s.state==="joined"))return console.error(`HOST_STATUS_NONE: no joined host under ${t}.`),1;return 0}var _t=["session:write","session:state","session:list","chat:turns","agent:list"],Se=["service:watch","service:logs","service:put","service:remove","service:start","service:stop","service:restart","service:accept"],gt=["services:list","services:get","services:put","services:delete","services:control"];async function n(e){let t;try{t=P(W("XDG_CONFIG_HOME",".config"),"hightea","claims")}catch{return{error:`SERVICE_UNSAFE_PATH: ${X.HOST_JOIN_UNSAFE_PATH}`}}let i=[];try{i=(await ce(t)).filter((p)=>!p.startsWith(".")).sort()}catch(p){if(!(typeof p==="object"&&p!==null&&("code"in p)&&p.code==="ENOENT"))return{error:`SERVICE_HOST_UNREADABLE: cannot list ${t}`}}let f=await Promise.all(i.map((p)=>He(P(t,p)))),w=f.filter((p)=>p.state==="joined"),s=e?.trim();if(s!==void 0&&s!==""){let p=w.find((S)=>S.hostId===s);if(p===void 0)return{error:`SERVICE_HOST_UNKNOWN: no joined host ${s} on this machine (joined here: ${w.map((S)=>S.hostId).join(", ")||"none"})`};return ft(p)}if(w.length===0){let p=f.find((S)=>S.state==="unreadable");return{error:p===void 0?`SERVICE_NO_HOST: no joined host under ${t}; join this machine with \`hightea host join\` first`:`SERVICE_HOST_UNREADABLE: ${p.config} could not be read; it was left unchanged`}}if(w.length>1)return{error:`SERVICE_HOST_AMBIGUOUS: this machine holds ${w.length} joined hosts (${w.map((p)=>p.hostId).join(", ")}); name one with --host <id>`};return ft(w[0])}function ft(e){let t=e.config;return{claim:e.claim,configDir:x(t),config:t,workspaceId:e.workspaceId,hostId:e.hostId,...e.gateway===void 0?{}:{gateway:e.gateway}}}async function o(e="/proc"){let t;try{t=await ce(e)}catch{return[]}let i=[],f=new Set;for(let w of t){if(!/^\d+$/u.test(w))continue;let s;try{s=(await re(P(e,w,"cmdline"),"utf8")).split("\x00").filter((H)=>H!=="")}catch{continue}let p=s.indexOf("--config-file"),S=p<0?void 0:s[p+1];if(S===void 0||!yt(S)||f.has(S))continue;f.add(S);let T=x(S),N=(H)=>{let J=s.indexOf(H),D=J<0?void 0:s[J+1];return D===void 0||D===""?void 0:D},_=N("--port"),E=_!==void 0&&/^\d{1,5}$/u.test(_)?Number(_):void 0,C=N("--connection-token-file"),R=N("--host")??"127.0.0.1";i.push({pid:Number(w),config:S,configDir:T,hostIds:await dr(S),host:R,...E===void 0?{}:{port:E},...C===void 0?{}:{connectionTokenFile:C}})}return i}async function dr(e){let t;try{t=JSON.parse(await re(e,"utf8"))}catch{return[]}if(!F(t)||!Array.isArray(t.plugins))return[];let i=new Set;for(let f of t.plugins){if(!F(f)||!F(f.options)||!F(f.options.headers))continue;let w=f.options.headers[a]??f.options.headers[d];if(typeof w==="string"&&w!=="")i.add(w)}return[...i]}async function I(e){let t=await n(e.host);if("error"in t)return console.error(t.error),1;let i=wt(t.config);if(!i.ok)return console.error(`SERVICE_CONFIG_UNREADABLE: ${t.config} could not be read as a JSON object; it was left unchanged`),1;let f=Array.isArray(i.value.plugins)?i.value.plugins:[],w=f.findIndex(Ae),s=f[w];if(s===void 0)return console.error(`SERVICE_CONFIG_UNREADABLE: ${t.config} holds no Hightea plugin entry; it was left unchanged`),1;if(s.grants!==void 0&&!(Array.isArray(s.grants)&&s.grants.every((R)=>typeof R==="string")))return console.error(`SERVICE_CONFIG_UNREADABLE: the Hightea plugin entry's grants in ${t.config} are not a list of grants; it was left unchanged`),1;let p=s.grants??[],S=[...Se,...gt],T=gt,N=p.filter((R)=>!T.includes(R)),_=e.enable?[...N,...Se.filter((R)=>!N.includes(R))]:p.filter((R)=>!S.includes(R)),E=`Hightea managing this machine's services (host ${t.hostId})`;if(_.length===p.length&&_.every((R,H)=>R===p[H]))return console.log(`${E} is already ${e.enable?"enabled":"disabled"}; ${t.config} was left unchanged.`),0;let C=f.slice();C[w]={...s,grants:_};try{Te(t.config,{...i.value,plugins:C},{mode:384})}catch(R){return console.error(`SERVICE_CONFIG_UNWRITABLE: ${t.config}: ${R.message}`),1}return console.log(`${E} is now ${e.enable?"enabled":"disabled"}: ${e.enable?"added":"removed"} ${Se.join(", ")} in ${t.config}.`),console.log(`It takes effect when this host's ahpd next loads its configuration; restart it with: ${oe(t.claim)}`),0}function ht(e){let t=/^(\d+)\.(\d+)\.(\d+)(-dev\.[0-9a-f]{8})?$/u.exec(e);return t===null?void 0:[Number(t[1]),Number(t[2]),Number(t[3]),t[4]===void 0?1:0]}function cr(e,t){for(let i=0;i<4;i++)if(e[i]!==t[i])return e[i]-t[i];return 0}var Z="pipe-update.json",lr="pipe-connected.json";async function It(e){let t;try{t=await re(P(e,Z),"utf8")}catch(f){return F(f)&&f.code==="ENOENT"?void 0:Error(`cannot read ${P(e,Z)}`)}let i;try{i=JSON.parse(t)}catch{return Error(`${P(e,Z)} is not JSON`)}if(!F(i)||typeof i.from!=="string"||typeof i.to!=="string"||typeof i.fromVersion!=="string"||typeof i.toVersion!=="string"||typeof i.at!=="string")return Error(`${P(e,Z)} is not an update record`);return{from:i.from,to:i.to,fromVersion:i.fromVersion,toVersion:i.toVersion,at:i.at}}async function Ot(e){try{let t=JSON.parse(await re(P(e,lr),"utf8"));return F(t)&&typeof t.version==="string"?t.version:void 0}catch{return}}async function ur(){let e;try{e=P(W("XDG_CONFIG_HOME",".config"),"hightea","claims")}catch{return{error:`HOST_UPDATE_UNSAFE_PATH: ${X.HOST_JOIN_UNSAFE_PATH}`}}let t;try{t=(await ce(e)).filter((i)=>!i.startsWith(".")).sort()}catch{return{error:`HOST_UPDATE_HOST_UNREADABLE: cannot list ${e}`}}return{claims:e,entries:await Promise.all(t.map((i)=>He(P(e,i))))}}async function gr(e,t){let i,f;try{i=await Ie(x(e.from))}catch{return{refused:"it cannot be resolved"}}try{f=await Ie(we(W("XDG_DATA_HOME",P(".local","share"))))}catch{return{refused:"the plugin bundles root cannot be resolved"}}if(x(i)!==f)return{refused:`it is not directly under the plugin bundles root ${f}`};if(mt(i)!==e.fromVersion)return{refused:`it is not the bundle directory of version ${e.fromVersion}`};for(let w of t){if(w.pluginBundle===void 0)continue;let s;try{s=await Ie(x(w.pluginBundle))}catch{continue}if(s===i)return{refused:`${w.config} names it now`}}return{directory:i}}async function pt(e){let t=await It(e.configDir);if(t===void 0)return;if(t instanceof Error){console.error(`HOST_UPDATE_RECORD_UNREADABLE: ${t.message}; no bundle was removed`);return}if(await Ot(e.configDir)!==t.toVersion){console.log(`Keeping the previous plugin bundle ${x(t.from)} until this host connects at ${t.toVersion}; restart it with: ${oe(e.claim)}`);return}let f=await ur();if("error"in f){console.error(`${f.error}; the previous bundle ${x(t.from)} was kept`);return}let w=f.entries.filter((p)=>p.pluginBundle===t.from||p.state==="unreadable");if(w.length>0){console.log(`Keeping the previous plugin bundle ${x(t.from)}: ${w.map((p)=>p.state==="unreadable"?`${p.config} (unreadable)`:p.config).join(", ")} may still name it.`);return}let s=await gr(t,f.entries);if("refused"in s){console.error(`HOST_UPDATE_PRUNE_REFUSED: ${x(t.from)}: ${s.refused}; nothing was removed`);return}try{await ut(s.directory,{recursive:!0,force:!0}),await ut(P(e.configDir,Z),{force:!0})}catch(p){console.error(`HOST_UPDATE_PRUNE_FAILED: ${x(t.from)}: ${p.message}`);return}console.log(`Removed the previous plugin bundle ${x(t.from)} (${t.fromVersion}); this host has connected at ${t.toVersion}.`)}async function O(e,t){let i=await n(e.host);if("error"in i)return console.error(i.error.replace(/^SERVICE_/u,"HOST_UPDATE_")),1;let f=wt(i.config);if(!f.ok)return console.error(`HOST_UPDATE_CONFIG_UNREADABLE: ${i.config} could not be read as a JSON object; it was left unchanged`),1;let w=Array.isArray(f.value.plugins)?f.value.plugins:[],s=w.findIndex(Ae),p=w[s];if(p===void 0||typeof p.source!=="string")return console.error(`HOST_UPDATE_CONFIG_UNREADABLE: ${i.config} holds no Hightea plugin entry with a source; it was left unchanged`),1;let S=await de(p.source);if(!S.ok)return console.error(`HOST_UPDATE_BUNDLE_UNREADABLE: the installed plugin bundle ${p.source} is ${S.reason}; nothing changed. \`hightea host status\` names the repair.`),1;let T=S.bundle.version,N=ht(T),_=ht(t.version);if(N===void 0||_===void 0)return console.error(`HOST_UPDATE_VERSION_UNREADABLE: cannot order the installed bundle ${T} against this CLI's ${t.version} (each must be x.y.z or x.y.z-dev.<hash8>); nothing changed`),1;let E=cr(_,N)||(t.version===T?0:1);if(E<0)return console.error(`HOST_UPDATE_DOWNGRADE: host ${i.hostId} runs plugin bundle ${T}, newer than this CLI's ${t.version}; nothing changed. Update the CLI instead.`),1;if(E===0)return console.log(`Host ${i.hostId} already runs plugin bundle ${T}; ${i.config} was left unchanged.`),await pt(i),0;await pt(i);let C;try{C=await _e(W("XDG_DATA_HOME",P(".local","share")),t.directory,t.version)}catch(L){let j=L instanceof Error&&/^HOST_JOIN_[A-Z_]+$/u.test(L.message)?L.message:"HOST_JOIN_CONFIG_IO";return console.error(`${j.replace(/^HOST_JOIN_/u,"HOST_UPDATE_")}: ${X[j]??"the new bundle could not be installed"} ${i.config} was left unchanged.`),1}let R={from:p.source,to:C.manifest,fromVersion:T,toVersion:C.version,at:new Date().toISOString()},H=w.slice(),J=Array.isArray(p.grants)?p.grants.filter((L)=>typeof L==="string"):[],D=_t.filter((L)=>!J.includes(L));H[s]={...p,source:C.manifest,...D.length===0?{}:{grants:[...J,...D]}};try{Te(P(i.configDir,Z),R,{mode:384}),Te(i.config,{...f.value,plugins:H},{mode:384})}catch(L){return console.error(`HOST_UPDATE_CONFIG_UNWRITABLE: ${i.config}: ${L.message}`),1}return console.log(`Host ${i.hostId} now loads plugin bundle ${C.version} (was ${T}), same host id and credentials; ${i.config} changed only its source${D.length===0?"":` and added the missing ${D.join(", ")} grants`}.`),console.log(`The previous bundle ${x(p.source)} is kept until the host connects at ${C.version}. Restart it with: ${oe(i.claim)}`),0}function fr(e){if(e===void 0||e==="")throw Error("HOST_JOIN_RECEIPT_INVALID");return e}
|
|
5
|
-
export{h,r,m,v,A,n,o,I,O};
|
package/dist/chunk-db8mr7mp.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{N,u,l,y,R,x}from"./chunk-69dva4cx.js";export{N as agentAppsOnPath,y as appInstalled,l as describedApp,u as installLineOf,R as isShippedApp,x as noAgentAppsLine};
|