typebulb 0.27.2 → 0.28.0
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/README.md +11 -4
- package/dist/agents/claude/client.js +212 -212
- package/dist/agents/claude/styles.css +17 -1
- package/dist/agents/pi/client.js +186 -186
- package/dist/agents/pi/matchu-patchu.ts +1 -1
- package/dist/agents/pi/styles.css +17 -1
- package/dist/index.js +224 -202
- package/dist/servers.js +95 -91
- package/package.json +1 -1
package/dist/servers.js
CHANGED
|
@@ -1,157 +1,161 @@
|
|
|
1
1
|
import { createRequire as __cr } from 'module'; const require = __cr(import.meta.url);
|
|
2
|
-
var
|
|
3
|
-
`)}};
|
|
4
|
-
`)?
|
|
2
|
+
var Ea=Object.create;var dr=Object.defineProperty;var Ta=Object.getOwnPropertyDescriptor;var Ca=Object.getOwnPropertyNames;var La=Object.getPrototypeOf,Pa=Object.prototype.hasOwnProperty;var ut=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});var g=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var Ia=(n,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Ca(e))!Pa.call(n,r)&&r!==t&&dr(n,r,{get:()=>e[r],enumerable:!(s=Ta(e,r))||s.enumerable});return n};var xa=(n,e,t)=>(t=n!=null?Ea(La(n)):{},Ia(e||!n||!n.__esModule?dr(t,"default",{value:n,enumerable:!0}):t,n));var O=g(x=>{"use strict";var Tn=Symbol.for("yaml.alias"),Or=Symbol.for("yaml.document"),dt=Symbol.for("yaml.map"),Er=Symbol.for("yaml.pair"),Cn=Symbol.for("yaml.scalar"),pt=Symbol.for("yaml.seq"),V=Symbol.for("yaml.node.type"),il=n=>!!n&&typeof n=="object"&&n[V]===Tn,ol=n=>!!n&&typeof n=="object"&&n[V]===Or,al=n=>!!n&&typeof n=="object"&&n[V]===dt,ll=n=>!!n&&typeof n=="object"&&n[V]===Er,Tr=n=>!!n&&typeof n=="object"&&n[V]===Cn,cl=n=>!!n&&typeof n=="object"&&n[V]===pt;function Cr(n){if(n&&typeof n=="object")switch(n[V]){case dt:case pt:return!0}return!1}function ul(n){if(n&&typeof n=="object")switch(n[V]){case Tn:case dt:case Cn:case pt:return!0}return!1}var fl=n=>(Tr(n)||Cr(n))&&!!n.anchor;x.ALIAS=Tn;x.DOC=Or;x.MAP=dt;x.NODE_TYPE=V;x.PAIR=Er;x.SCALAR=Cn;x.SEQ=pt;x.hasAnchor=fl;x.isAlias=il;x.isCollection=Cr;x.isDocument=ol;x.isMap=al;x.isNode=ul;x.isPair=ll;x.isScalar=Tr;x.isSeq=cl});var Pe=g(Ln=>{"use strict";var I=O(),$=Symbol("break visit"),Lr=Symbol("skip children"),F=Symbol("remove node");function ht(n,e){let t=Pr(e);I.isDocument(n)?ye(null,n.contents,t,Object.freeze([n]))===F&&(n.contents=null):ye(null,n,t,Object.freeze([]))}ht.BREAK=$;ht.SKIP=Lr;ht.REMOVE=F;function ye(n,e,t,s){let r=Ir(n,e,t,s);if(I.isNode(r)||I.isPair(r))return xr(n,s,r),ye(n,r,t,s);if(typeof r!="symbol"){if(I.isCollection(e)){s=Object.freeze(s.concat(e));for(let i=0;i<e.items.length;++i){let o=ye(i,e.items[i],t,s);if(typeof o=="number")i=o-1;else{if(o===$)return $;o===F&&(e.items.splice(i,1),i-=1)}}}else if(I.isPair(e)){s=Object.freeze(s.concat(e));let i=ye("key",e.key,t,s);if(i===$)return $;i===F&&(e.key=null);let o=ye("value",e.value,t,s);if(o===$)return $;o===F&&(e.value=null)}}return r}async function mt(n,e){let t=Pr(e);I.isDocument(n)?await be(null,n.contents,t,Object.freeze([n]))===F&&(n.contents=null):await be(null,n,t,Object.freeze([]))}mt.BREAK=$;mt.SKIP=Lr;mt.REMOVE=F;async function be(n,e,t,s){let r=await Ir(n,e,t,s);if(I.isNode(r)||I.isPair(r))return xr(n,s,r),be(n,r,t,s);if(typeof r!="symbol"){if(I.isCollection(e)){s=Object.freeze(s.concat(e));for(let i=0;i<e.items.length;++i){let o=await be(i,e.items[i],t,s);if(typeof o=="number")i=o-1;else{if(o===$)return $;o===F&&(e.items.splice(i,1),i-=1)}}}else if(I.isPair(e)){s=Object.freeze(s.concat(e));let i=await be("key",e.key,t,s);if(i===$)return $;i===F&&(e.key=null);let o=await be("value",e.value,t,s);if(o===$)return $;o===F&&(e.value=null)}}return r}function Pr(n){return typeof n=="object"&&(n.Collection||n.Node||n.Value)?Object.assign({Alias:n.Node,Map:n.Node,Scalar:n.Node,Seq:n.Node},n.Value&&{Map:n.Value,Scalar:n.Value,Seq:n.Value},n.Collection&&{Map:n.Collection,Seq:n.Collection},n):n}function Ir(n,e,t,s){if(typeof t=="function")return t(n,e,s);if(I.isMap(e))return t.Map?.(n,e,s);if(I.isSeq(e))return t.Seq?.(n,e,s);if(I.isPair(e))return t.Pair?.(n,e,s);if(I.isScalar(e))return t.Scalar?.(n,e,s);if(I.isAlias(e))return t.Alias?.(n,e,s)}function xr(n,e,t){let s=e[e.length-1];if(I.isCollection(s))s.items[n]=t;else if(I.isPair(s))n==="key"?s.key=t:s.value=t;else if(I.isDocument(s))s.contents=t;else{let r=I.isAlias(s)?"alias":"scalar";throw new Error(`Cannot replace node with ${r} parent`)}}Ln.visit=ht;Ln.visitAsync=mt});var Pn=g(qr=>{"use strict";var $r=O(),dl=Pe(),pl={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},hl=n=>n.replace(/[!,[\]{}]/g,e=>pl[e]),Ie=class n{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},n.defaultYaml,e),this.tags=Object.assign({},n.defaultTags,t)}clone(){let e=new n(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new n(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:n.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},n.defaultTags);break}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:n.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},n.defaultTags),this.atNextDocument=!1);let s=e.trim().split(/[ \t]+/),r=s.shift();switch(r){case"%TAG":{if(s.length!==2&&(t(0,"%TAG directive should contain exactly two parts"),s.length<2))return!1;let[i,o]=s;return this.tags[i]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,s.length!==1)return t(0,"%YAML directive should contain exactly one part"),!1;let[i]=s;if(i==="1.1"||i==="1.2")return this.yaml.version=i,!0;{let o=/^\d+\.\d+$/.test(i);return t(6,`Unsupported YAML version ${i}`,o),!1}}default:return t(0,`Unknown directive ${r}`,!0),!1}}tagName(e,t){if(e==="!")return"!";if(e[0]!=="!")return t(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);return o==="!"||o==="!!"?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&t("Verbatim tags must end with a >"),o)}let[,s,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[s];if(i)try{return i+decodeURIComponent(r)}catch(o){return t(String(o)),null}return s==="!"?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,s]of Object.entries(this.tags))if(e.startsWith(s))return t+hl(e.substring(s.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],s=Object.entries(this.tags),r;if(e&&s.length>0&&$r.isNode(e.contents)){let i={};dl.visit(e.contents,(o,a)=>{$r.isNode(a)&&a.tag&&(i[a.tag]=!0)}),r=Object.keys(i)}else r=[];for(let[i,o]of s)i==="!!"&&o==="tag:yaml.org,2002:"||(!e||r.some(a=>a.startsWith(o)))&&t.push(`%TAG ${i} ${o}`);return t.join(`
|
|
3
|
+
`)}};Ie.defaultYaml={explicit:!1,version:"1.2"};Ie.defaultTags={"!!":"tag:yaml.org,2002:"};qr.Directives=Ie});var gt=g(xe=>{"use strict";var _r=O(),ml=Pe();function gl(n){if(/[\x00-\x19\s,[\]{}]/.test(n)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(n)}`;throw new Error(t)}return!0}function Mr(n){let e=new Set;return ml.visit(n,{Value(t,s){s.anchor&&e.add(s.anchor)}}),e}function Rr(n,e){for(let t=1;;++t){let s=`${n}${t}`;if(!e.has(s))return s}}function yl(n,e){let t=[],s=new Map,r=null;return{onAnchor:i=>{t.push(i),r??(r=Mr(n));let o=Rr(e,r);return r.add(o),o},setAnchors:()=>{for(let i of t){let o=s.get(i);if(typeof o=="object"&&o.anchor&&(_r.isScalar(o.node)||_r.isCollection(o.node)))o.node.anchor=o.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=i,a}}},sourceObjects:s}}xe.anchorIsValid=gl;xe.anchorNames=Mr;xe.createNodeAnchors=yl;xe.findNewAnchor=Rr});var In=g(Br=>{"use strict";function $e(n,e,t,s){if(s&&typeof s=="object")if(Array.isArray(s))for(let r=0,i=s.length;r<i;++r){let o=s[r],a=$e(n,s,String(r),o);a===void 0?delete s[r]:a!==o&&(s[r]=a)}else if(s instanceof Map)for(let r of Array.from(s.keys())){let i=s.get(r),o=$e(n,s,r,i);o===void 0?s.delete(r):o!==i&&s.set(r,o)}else if(s instanceof Set)for(let r of Array.from(s)){let i=$e(n,s,r,r);i===void 0?s.delete(r):i!==r&&(s.delete(r),s.add(i))}else for(let[r,i]of Object.entries(s)){let o=$e(n,s,r,i);o===void 0?delete s[r]:o!==i&&(s[r]=o)}return n.call(e,t,s)}Br.applyReviver=$e});var X=g(Fr=>{"use strict";var bl=O();function Dr(n,e,t){if(Array.isArray(n))return n.map((s,r)=>Dr(s,String(r),t));if(n&&typeof n.toJSON=="function"){if(!t||!bl.hasAnchor(n))return n.toJSON(e,t);let s={aliasCount:0,count:1,res:void 0};t.anchors.set(n,s),t.onCreate=i=>{s.res=i,delete t.onCreate};let r=n.toJSON(e,t);return t.onCreate&&t.onCreate(r),r}return typeof n=="bigint"&&!t?.keep?Number(n):n}Fr.toJS=Dr});var yt=g(Ur=>{"use strict";var wl=In(),jr=O(),Sl=X(),xn=class{constructor(e){Object.defineProperty(this,jr.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:s,onAnchor:r,reviver:i}={}){if(!jr.isDocument(e))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof s=="number"?s:100},a=Sl.toJS(this,"",o);if(typeof r=="function")for(let{count:l,res:c}of o.anchors.values())r(c,l);return typeof i=="function"?wl.applyReviver(i,{"":a},"",a):a}};Ur.NodeBase=xn});var qe=g(Kr=>{"use strict";var vl=gt(),kl=Pe(),we=O(),Al=yt(),Nl=X(),$n=class extends Al.NodeBase{constructor(e){super(we.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,t){let s;t?.aliasResolveCache?s=t.aliasResolveCache:(s=[],kl.visit(e,{Node:(i,o)=>{(we.isAlias(o)||we.hasAnchor(o))&&s.push(o)}}),t&&(t.aliasResolveCache=s));let r;for(let i of s){if(i===this)break;i.anchor===this.source&&(r=i)}return r}toJSON(e,t){if(!t)return{source:this.source};let{anchors:s,doc:r,maxAliasCount:i}=t,o=this.resolve(r,t);if(!o){let l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(l)}let a=s.get(o);if(a||(Nl.toJS(o,null,t),a=s.get(o)),a?.res===void 0){let l="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(l)}if(i>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=bt(r,o,s)),a.count*a.aliasCount>i)){let l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}return a.res}toString(e,t,s){let r=`*${this.source}`;if(e){if(vl.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let i=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(i)}if(e.implicitKey)return`${r} `}return r}};function bt(n,e,t){if(we.isAlias(e)){let s=e.resolve(n),r=t&&s&&t.get(s);return r?r.count*r.aliasCount:0}else if(we.isCollection(e)){let s=0;for(let r of e.items){let i=bt(n,r,t);i>s&&(s=i)}return s}else if(we.isPair(e)){let s=bt(n,e.key,t),r=bt(n,e.value,t);return Math.max(s,r)}return 1}Kr.Alias=$n});var C=g(qn=>{"use strict";var Ol=O(),El=yt(),Tl=X(),Cl=n=>!n||typeof n!="function"&&typeof n!="object",Z=class extends El.NodeBase{constructor(e){super(Ol.SCALAR),this.value=e}toJSON(e,t){return t?.keep?this.value:Tl.toJS(this.value,e,t)}toString(){return String(this.value)}};Z.BLOCK_FOLDED="BLOCK_FOLDED";Z.BLOCK_LITERAL="BLOCK_LITERAL";Z.PLAIN="PLAIN";Z.QUOTE_DOUBLE="QUOTE_DOUBLE";Z.QUOTE_SINGLE="QUOTE_SINGLE";qn.Scalar=Z;qn.isScalarValue=Cl});var _e=g(Yr=>{"use strict";var Ll=qe(),le=O(),Jr=C(),Pl="tag:yaml.org,2002:";function Il(n,e,t){if(e){let s=t.filter(i=>i.tag===e),r=s.find(i=>!i.format)??s[0];if(!r)throw new Error(`Tag ${e} not found`);return r}return t.find(s=>s.identify?.(n)&&!s.format)}function xl(n,e,t){if(le.isDocument(n)&&(n=n.contents),le.isNode(n))return n;if(le.isPair(n)){let u=t.schema[le.MAP].createNode?.(t.schema,null,t);return u.items.push(n),u}(n instanceof String||n instanceof Number||n instanceof Boolean||typeof BigInt<"u"&&n instanceof BigInt)&&(n=n.valueOf());let{aliasDuplicateObjects:s,onAnchor:r,onTagObj:i,schema:o,sourceObjects:a}=t,l;if(s&&n&&typeof n=="object"){if(l=a.get(n),l)return l.anchor??(l.anchor=r(n)),new Ll.Alias(l.anchor);l={anchor:null,node:null},a.set(n,l)}e?.startsWith("!!")&&(e=Pl+e.slice(2));let c=Il(n,e,o.tags);if(!c){if(n&&typeof n.toJSON=="function"&&(n=n.toJSON()),!n||typeof n!="object"){let u=new Jr.Scalar(n);return l&&(l.node=u),u}c=n instanceof Map?o[le.MAP]:Symbol.iterator in Object(n)?o[le.SEQ]:o[le.MAP]}i&&(i(c),delete t.onTagObj);let p=c?.createNode?c.createNode(t.schema,n,t):typeof c?.nodeClass?.from=="function"?c.nodeClass.from(t.schema,n,t):new Jr.Scalar(n);return e?p.tag=e:c.default||(p.tag=c.tag),l&&(l.node=p),p}Yr.createNode=xl});var St=g(wt=>{"use strict";var $l=_e(),j=O(),ql=yt();function _n(n,e,t){let s=t;for(let r=e.length-1;r>=0;--r){let i=e[r];if(typeof i=="number"&&Number.isInteger(i)&&i>=0){let o=[];o[i]=s,s=o}else s=new Map([[i,s]])}return $l.createNode(s,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:n,sourceObjects:new Map})}var Vr=n=>n==null||typeof n=="object"&&!!n[Symbol.iterator]().next().done,Mn=class extends ql.NodeBase{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(s=>j.isNode(s)||j.isPair(s)?s.clone(e):s),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(Vr(e))this.add(t);else{let[s,...r]=e,i=this.get(s,!0);if(j.isCollection(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(s,_n(this.schema,r,t));else throw new Error(`Expected YAML collection at ${s}. Remaining path: ${r}`)}}deleteIn(e){let[t,...s]=e;if(s.length===0)return this.delete(t);let r=this.get(t,!0);if(j.isCollection(r))return r.deleteIn(s);throw new Error(`Expected YAML collection at ${t}. Remaining path: ${s}`)}getIn(e,t){let[s,...r]=e,i=this.get(s,!0);return r.length===0?!t&&j.isScalar(i)?i.value:i:j.isCollection(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!j.isPair(t))return!1;let s=t.value;return s==null||e&&j.isScalar(s)&&s.value==null&&!s.commentBefore&&!s.comment&&!s.tag})}hasIn(e){let[t,...s]=e;if(s.length===0)return this.has(t);let r=this.get(t,!0);return j.isCollection(r)?r.hasIn(s):!1}setIn(e,t){let[s,...r]=e;if(r.length===0)this.set(s,t);else{let i=this.get(s,!0);if(j.isCollection(i))i.setIn(r,t);else if(i===void 0&&this.schema)this.set(s,_n(this.schema,r,t));else throw new Error(`Expected YAML collection at ${s}. Remaining path: ${r}`)}}};wt.Collection=Mn;wt.collectionFromPath=_n;wt.isEmptyPath=Vr});var Me=g(vt=>{"use strict";var _l=n=>n.replace(/^(?!$)(?: $)?/gm,"#");function Rn(n,e){return/^\n+$/.test(n)?n.substring(1):e?n.replace(/^(?! *$)/gm,e):n}var Ml=(n,e,t)=>n.endsWith(`
|
|
4
|
+
`)?Rn(t,e):t.includes(`
|
|
5
5
|
`)?`
|
|
6
|
-
`+
|
|
7
|
-
`)t===
|
|
8
|
-
`&&m!==" "){let
|
|
9
|
-
`&&
|
|
10
|
-
${e}${n.slice(0,
|
|
11
|
-
${e}${n.slice(
|
|
12
|
-
`);s=e,r=e+1,i=n[r]}return s}
|
|
13
|
-
`){if(i-o>s)return!0;if(o=i+1,r-o<=s)return!1}return!0}function
|
|
6
|
+
`+Rn(t,e):(n.endsWith(" ")?"":" ")+t;vt.indentComment=Rn;vt.lineComment=Ml;vt.stringifyComment=_l});var Gr=g(Re=>{"use strict";var Rl="flow",Bn="block",kt="quoted";function Bl(n,e,t="flow",{indentAtStart:s,lineWidth:r=80,minContentWidth:i=20,onFold:o,onOverflow:a}={}){if(!r||r<0)return n;r<i&&(i=0);let l=Math.max(1+i,1+r-e.length);if(n.length<=l)return n;let c=[],p={},u=r-e.length;typeof s=="number"&&(s>r-Math.max(2,i)?c.push(0):u=r-s);let f,m,y=!1,d=-1,h=-1,w=-1;t===Bn&&(d=Wr(n,d,e.length),d!==-1&&(u=d+l));for(let v;v=n[d+=1];){if(t===kt&&v==="\\"){switch(h=d,n[d+1]){case"x":d+=3;break;case"u":d+=5;break;case"U":d+=9;break;default:d+=1}w=d}if(v===`
|
|
7
|
+
`)t===Bn&&(d=Wr(n,d,e.length)),u=d+e.length+l,f=void 0;else{if(v===" "&&m&&m!==" "&&m!==`
|
|
8
|
+
`&&m!==" "){let k=n[d+1];k&&k!==" "&&k!==`
|
|
9
|
+
`&&k!==" "&&(f=d)}if(d>=u)if(f)c.push(f),u=f+l,f=void 0;else if(t===kt){for(;m===" "||m===" ";)m=v,v=n[d+=1],y=!0;let k=d>w+1?d-2:h-1;if(p[k])return n;c.push(k),p[k]=!0,u=k+l,f=void 0}else y=!0}m=v}if(y&&a&&a(),c.length===0)return n;o&&o();let S=n.slice(0,c[0]);for(let v=0;v<c.length;++v){let k=c[v],A=c[v+1]||n.length;k===0?S=`
|
|
10
|
+
${e}${n.slice(0,A)}`:(t===kt&&p[k]&&(S+=`${n[k]}\\`),S+=`
|
|
11
|
+
${e}${n.slice(k+1,A)}`)}return S}function Wr(n,e,t){let s=e,r=e+1,i=n[r];for(;i===" "||i===" ";)if(e<r+t)i=n[++e];else{do i=n[++e];while(i&&i!==`
|
|
12
|
+
`);s=e,r=e+1,i=n[r]}return s}Re.FOLD_BLOCK=Bn;Re.FOLD_FLOW=Rl;Re.FOLD_QUOTED=kt;Re.foldFlowLines=Bl});var De=g(Hr=>{"use strict";var R=C(),ee=Gr(),Nt=(n,e)=>({indentAtStart:e?n.indent.length:n.indentAtStart,lineWidth:n.options.lineWidth,minContentWidth:n.options.minContentWidth}),Ot=n=>/^(%|---|\.\.\.)/m.test(n);function Dl(n,e,t){if(!e||e<0)return!1;let s=e-t,r=n.length;if(r<=s)return!1;for(let i=0,o=0;i<r;++i)if(n[i]===`
|
|
13
|
+
`){if(i-o>s)return!0;if(o=i+1,r-o<=s)return!1}return!0}function Be(n,e){let t=JSON.stringify(n);if(e.options.doubleQuotedAsJSON)return t;let{implicitKey:s}=e,r=e.options.doubleQuotedMinMultiLineLength,i=e.indent||(Ot(n)?" ":""),o="",a=0;for(let l=0,c=t[l];c;c=t[++l])if(c===" "&&t[l+1]==="\\"&&t[l+2]==="n"&&(o+=t.slice(a,l)+"\\ ",l+=1,a=l,c="\\"),c==="\\")switch(t[l+1]){case"u":{o+=t.slice(a,l);let p=t.substr(l+2,4);switch(p){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:p.substr(0,2)==="00"?o+="\\x"+p.substr(2):o+=t.substr(l,6)}l+=5,a=l+1}break;case"n":if(s||t[l+2]==='"'||t.length<r)l+=1;else{for(o+=t.slice(a,l)+`
|
|
14
14
|
|
|
15
15
|
`;t[l+2]==="\\"&&t[l+3]==="n"&&t[l+4]!=='"';)o+=`
|
|
16
|
-
`,l+=2;o+=i,t[l+2]===" "&&(o+="\\"),l+=1,a=l+1}break;default:l+=1}return o=a?o+t.slice(a):t,s?o:
|
|
17
|
-
`)||/[ \t]\n|\n[ \t]/.test(n))return
|
|
18
|
-
${t}`)+"'";return e.implicitKey?s:
|
|
16
|
+
`,l+=2;o+=i,t[l+2]===" "&&(o+="\\"),l+=1,a=l+1}break;default:l+=1}return o=a?o+t.slice(a):t,s?o:ee.foldFlowLines(o,i,ee.FOLD_QUOTED,Nt(e,!1))}function Dn(n,e){if(e.options.singleQuote===!1||e.implicitKey&&n.includes(`
|
|
17
|
+
`)||/[ \t]\n|\n[ \t]/.test(n))return Be(n,e);let t=e.indent||(Ot(n)?" ":""),s="'"+n.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
18
|
+
${t}`)+"'";return e.implicitKey?s:ee.foldFlowLines(s,t,ee.FOLD_FLOW,Nt(e,!1))}function Se(n,e){let{singleQuote:t}=e.options,s;if(t===!1)s=Be;else{let r=n.includes('"'),i=n.includes("'");r&&!i?s=Dn:i&&!r?s=Be:s=t?Dn:Be}return s(n,e)}var Fn;try{Fn=new RegExp(`(^|(?<!
|
|
19
19
|
))
|
|
20
20
|
+(?!
|
|
21
|
-
|$)`,"g")}catch{
|
|
21
|
+
|$)`,"g")}catch{Fn=/\n+(?!\n|$)/g}function At({comment:n,type:e,value:t},s,r,i){let{blockQuote:o,commentString:a,lineWidth:l}=s.options;if(!o||/\n[\t ]+$/.test(t))return Se(t,s);let c=s.indent||(s.forceBlockIndent||Ot(t)?" ":""),p=o==="literal"?!0:o==="folded"||e===R.Scalar.BLOCK_FOLDED?!1:e===R.Scalar.BLOCK_LITERAL?!0:!Dl(t,l,c.length);if(!t)return p?`|
|
|
22
22
|
`:`>
|
|
23
|
-
`;let u,f;for(f=t.length;f>0;--f){let
|
|
24
|
-
`&&
|
|
23
|
+
`;let u,f;for(f=t.length;f>0;--f){let A=t[f-1];if(A!==`
|
|
24
|
+
`&&A!==" "&&A!==" ")break}let m=t.substring(f),y=m.indexOf(`
|
|
25
25
|
`);y===-1?u="-":t===m||y!==m.length-1?(u="+",i&&i()):u="",m&&(t=t.slice(0,-m.length),m[m.length-1]===`
|
|
26
|
-
`&&(m=m.slice(0,-1)),m=m.replace(
|
|
27
|
-
`)
|
|
28
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`),N=!1,T=
|
|
29
|
-
${c}${b}`}return t=t.replace(/\n+/g,`$&${c}`),`|${
|
|
30
|
-
${c}${
|
|
31
|
-
`)||p&&/[[\]{},]/.test(i))return
|
|
32
|
-
`)?
|
|
33
|
-
`))return
|
|
34
|
-
${l}`);if(o){let f=d=>d.default&&d.tag!=="tag:yaml.org,2002:str"&&d.test?.test(u),{compat:m,tags:y}=e.doc.schema;if(y.some(f)||m?.some(f))return
|
|
35
|
-
${e.indent}${a}`:a}
|
|
36
|
-
${a}:`):(h=`${h}:`,f&&(h+=
|
|
37
|
-
`:"",
|
|
38
|
-
${
|
|
26
|
+
`&&(m=m.slice(0,-1)),m=m.replace(Fn,`$&${c}`));let d=!1,h,w=-1;for(h=0;h<t.length;++h){let A=t[h];if(A===" ")d=!0;else if(A===`
|
|
27
|
+
`)w=h;else break}let S=t.substring(0,w<h?w+1:h);S&&(t=t.substring(S.length),S=S.replace(/\n+/g,`$&${c}`));let k=(d?c?"2":"1":"")+u;if(n&&(k+=" "+a(n.replace(/ ?[\r\n]+/g," ")),r&&r()),!p){let A=t.replace(/\n+/g,`
|
|
28
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`),N=!1,T=Nt(s,!0);o!=="folded"&&e!==R.Scalar.BLOCK_FOLDED&&(T.onOverflow=()=>{N=!0});let b=ee.foldFlowLines(`${S}${A}${m}`,c,ee.FOLD_BLOCK,T);if(!N)return`>${k}
|
|
29
|
+
${c}${b}`}return t=t.replace(/\n+/g,`$&${c}`),`|${k}
|
|
30
|
+
${c}${S}${t}${m}`}function Fl(n,e,t,s){let{type:r,value:i}=n,{actualString:o,implicitKey:a,indent:l,indentStep:c,inFlow:p}=e;if(a&&i.includes(`
|
|
31
|
+
`)||p&&/[[\]{},]/.test(i))return Se(i,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(i))return a||p||!i.includes(`
|
|
32
|
+
`)?Se(i,e):At(n,e,t,s);if(!a&&!p&&r!==R.Scalar.PLAIN&&i.includes(`
|
|
33
|
+
`))return At(n,e,t,s);if(Ot(i)){if(l==="")return e.forceBlockIndent=!0,At(n,e,t,s);if(a&&l===c)return Se(i,e)}let u=i.replace(/\n+/g,`$&
|
|
34
|
+
${l}`);if(o){let f=d=>d.default&&d.tag!=="tag:yaml.org,2002:str"&&d.test?.test(u),{compat:m,tags:y}=e.doc.schema;if(y.some(f)||m?.some(f))return Se(i,e)}return a?u:ee.foldFlowLines(u,l,ee.FOLD_FLOW,Nt(e,!1))}function jl(n,e,t,s){let{implicitKey:r,inFlow:i}=e,o=typeof n.value=="string"?n:Object.assign({},n,{value:String(n.value)}),{type:a}=n;a!==R.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=R.Scalar.QUOTE_DOUBLE);let l=p=>{switch(p){case R.Scalar.BLOCK_FOLDED:case R.Scalar.BLOCK_LITERAL:return r||i?Se(o.value,e):At(o,e,t,s);case R.Scalar.QUOTE_DOUBLE:return Be(o.value,e);case R.Scalar.QUOTE_SINGLE:return Dn(o.value,e);case R.Scalar.PLAIN:return Fl(o,e,t,s);default:return null}},c=l(a);if(c===null){let{defaultKeyType:p,defaultStringType:u}=e.options,f=r&&p||u;if(c=l(f),c===null)throw new Error(`Unsupported default string type ${f}`)}return c}Hr.stringifyString=jl});var Fe=g(jn=>{"use strict";var Ul=gt(),te=O(),Kl=Me(),Jl=De();function Yl(n,e){let t=Object.assign({blockQuote:!0,commentString:Kl.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},n.schema.toStringOptions,e),s;switch(t.collectionStyle){case"block":s=!1;break;case"flow":s=!0;break;default:s=null}return{anchors:new Set,doc:n,flowCollectionPadding:t.flowCollectionPadding?" ":"",indent:"",indentStep:typeof t.indent=="number"?" ".repeat(t.indent):" ",inFlow:s,options:t}}function Vl(n,e){if(e.tag){let r=n.filter(i=>i.tag===e.tag);if(r.length>0)return r.find(i=>i.format===e.format)??r[0]}let t,s;if(te.isScalar(e)){s=e.value;let r=n.filter(i=>i.identify?.(s));if(r.length>1){let i=r.filter(o=>o.test);i.length>0&&(r=i)}t=r.find(i=>i.format===e.format)??r.find(i=>!i.format)}else s=e,t=n.find(r=>r.nodeClass&&s instanceof r.nodeClass);if(!t){let r=s?.constructor?.name??(s===null?"null":typeof s);throw new Error(`Tag not resolved for ${r} value`)}return t}function Wl(n,e,{anchors:t,doc:s}){if(!s.directives)return"";let r=[],i=(te.isScalar(n)||te.isCollection(n))&&n.anchor;i&&Ul.anchorIsValid(i)&&(t.add(i),r.push(`&${i}`));let o=n.tag??(e.default?null:e.tag);return o&&r.push(s.directives.tagString(o)),r.join(" ")}function Gl(n,e,t,s){if(te.isPair(n))return n.toString(e,t,s);if(te.isAlias(n)){if(e.doc.directives)return n.toString(e);if(e.resolvedAliases?.has(n))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(n):e.resolvedAliases=new Set([n]),n=n.resolve(e.doc)}let r,i=te.isNode(n)?n:e.doc.createNode(n,{onTagObj:l=>r=l});r??(r=Vl(e.doc.schema.tags,i));let o=Wl(i,r,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);let a=typeof r.stringify=="function"?r.stringify(i,e,t,s):te.isScalar(i)?Jl.stringifyString(i,e,t,s):i.toString(e,t,s);return o?te.isScalar(i)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o}
|
|
35
|
+
${e.indent}${a}`:a}jn.createStringifyContext=Yl;jn.stringify=Gl});var Zr=g(Xr=>{"use strict";var W=O(),Qr=C(),zr=Fe(),je=Me();function Hl({key:n,value:e},t,s,r){let{allNullValues:i,doc:o,indent:a,indentStep:l,options:{commentString:c,indentSeq:p,simpleKeys:u}}=t,f=W.isNode(n)&&n.comment||null;if(u){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(W.isCollection(n)||!W.isNode(n)&&typeof n=="object"){let T="With simple keys, collection cannot be used as a key value";throw new Error(T)}}let m=!u&&(!n||f&&e==null&&!t.inFlow||W.isCollection(n)||(W.isScalar(n)?n.type===Qr.Scalar.BLOCK_FOLDED||n.type===Qr.Scalar.BLOCK_LITERAL:typeof n=="object"));t=Object.assign({},t,{allNullValues:!1,implicitKey:!m&&(u||!i),indent:a+l});let y=!1,d=!1,h=zr.stringify(n,t,()=>y=!0,()=>d=!0);if(!m&&!t.inFlow&&h.length>1024){if(u)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");m=!0}if(t.inFlow){if(i||e==null)return y&&s&&s(),h===""?"?":m?`? ${h}`:h}else if(i&&!u||e==null&&m)return h=`? ${h}`,f&&!y?h+=je.lineComment(h,t.indent,c(f)):d&&r&&r(),h;y&&(f=null),m?(f&&(h+=je.lineComment(h,t.indent,c(f))),h=`? ${h}
|
|
36
|
+
${a}:`):(h=`${h}:`,f&&(h+=je.lineComment(h,t.indent,c(f))));let w,S,v;W.isNode(e)?(w=!!e.spaceBefore,S=e.commentBefore,v=e.comment):(w=!1,S=null,v=null,e&&typeof e=="object"&&(e=o.createNode(e))),t.implicitKey=!1,!m&&!f&&W.isScalar(e)&&(t.indentAtStart=h.length+1),d=!1,!p&&l.length>=2&&!t.inFlow&&!m&&W.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(t.indent=t.indent.substring(2));let k=!1,A=zr.stringify(e,t,()=>k=!0,()=>d=!0),N=" ";if(f||w||S){if(N=w?`
|
|
37
|
+
`:"",S){let T=c(S);N+=`
|
|
38
|
+
${je.indentComment(T,t.indent)}`}A===""&&!t.inFlow?N===`
|
|
39
39
|
`&&v&&(N=`
|
|
40
40
|
|
|
41
41
|
`):N+=`
|
|
42
|
-
${t.indent}`}else if(!m&&
|
|
43
|
-
`),L=b!==-1,
|
|
44
|
-
${t.indent}`)}}else(
|
|
45
|
-
`)&&(N="");return h+=N+
|
|
42
|
+
${t.indent}`}else if(!m&&W.isCollection(e)){let T=A[0],b=A.indexOf(`
|
|
43
|
+
`),L=b!==-1,H=t.inFlow??e.flow??e.items.length===0;if(L||!H){let me=!1;if(L&&(T==="&"||T==="!")){let P=A.indexOf(" ");T==="&"&&P!==-1&&P<b&&A[P+1]==="!"&&(P=A.indexOf(" ",P+1)),(P===-1||b<P)&&(me=!0)}me||(N=`
|
|
44
|
+
${t.indent}`)}}else(A===""||A[0]===`
|
|
45
|
+
`)&&(N="");return h+=N+A,t.inFlow?k&&s&&s():v&&!k?h+=je.lineComment(h,t.indent,c(v)):d&&r&&r(),h}Xr.stringifyPair=Hl});var Kn=g(Un=>{"use strict";var ei=ut("process");function Ql(n,...e){n==="debug"&&console.log(...e)}function zl(n,e){(n==="debug"||n==="warn")&&(typeof ei.emitWarning=="function"?ei.emitWarning(e):console.warn(e))}Un.debug=Ql;Un.warn=zl});var Lt=g(Ct=>{"use strict";var Ue=O(),ti=C(),Et="<<",Tt={identify:n=>n===Et||typeof n=="symbol"&&n.description===Et,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new ti.Scalar(Symbol(Et)),{addToJSMap:ni}),stringify:()=>Et},Xl=(n,e)=>(Tt.identify(e)||Ue.isScalar(e)&&(!e.type||e.type===ti.Scalar.PLAIN)&&Tt.identify(e.value))&&n?.doc.schema.tags.some(t=>t.tag===Tt.tag&&t.default);function ni(n,e,t){if(t=n&&Ue.isAlias(t)?t.resolve(n.doc):t,Ue.isSeq(t))for(let s of t.items)Jn(n,e,s);else if(Array.isArray(t))for(let s of t)Jn(n,e,s);else Jn(n,e,t)}function Jn(n,e,t){let s=n&&Ue.isAlias(t)?t.resolve(n.doc):t;if(!Ue.isMap(s))throw new Error("Merge sources must be maps or map aliases");let r=s.toJSON(null,n,Map);for(let[i,o]of r)e instanceof Map?e.has(i)||e.set(i,o):e instanceof Set?e.add(i):Object.prototype.hasOwnProperty.call(e,i)||Object.defineProperty(e,i,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}Ct.addMergeToJSMap=ni;Ct.isMergeKey=Xl;Ct.merge=Tt});var Vn=g(ii=>{"use strict";var Zl=Kn(),si=Lt(),ec=Fe(),ri=O(),Yn=X();function tc(n,e,{key:t,value:s}){if(ri.isNode(t)&&t.addToJSMap)t.addToJSMap(n,e,s);else if(si.isMergeKey(n,t))si.addMergeToJSMap(n,e,s);else{let r=Yn.toJS(t,"",n);if(e instanceof Map)e.set(r,Yn.toJS(s,r,n));else if(e instanceof Set)e.add(r);else{let i=nc(t,r,n),o=Yn.toJS(s,i,n);i in e?Object.defineProperty(e,i,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[i]=o}}return e}function nc(n,e,t){if(e===null)return"";if(typeof e!="object")return String(e);if(ri.isNode(n)&&t?.doc){let s=ec.createStringifyContext(t.doc,{});s.anchors=new Set;for(let i of t.anchors.keys())s.anchors.add(i.anchor);s.inFlow=!0,s.inStringifyKey=!0;let r=n.toString(s);if(!t.mapKeyWarned){let i=JSON.stringify(r);i.length>40&&(i=i.substring(0,36)+'..."'),Zl.warn(t.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${i}. Set mapAsMap: true to use object keys.`),t.mapKeyWarned=!0}return r}return JSON.stringify(e)}ii.addPairToJSMap=tc});var ne=g(Wn=>{"use strict";var oi=_e(),sc=Zr(),rc=Vn(),Pt=O();function ic(n,e,t){let s=oi.createNode(n,void 0,t),r=oi.createNode(e,void 0,t);return new It(s,r)}var It=class n{constructor(e,t=null){Object.defineProperty(this,Pt.NODE_TYPE,{value:Pt.PAIR}),this.key=e,this.value=t}clone(e){let{key:t,value:s}=this;return Pt.isNode(t)&&(t=t.clone(e)),Pt.isNode(s)&&(s=s.clone(e)),new n(t,s)}toJSON(e,t){let s=t?.mapAsMap?new Map:{};return rc.addPairToJSMap(t,s,this)}toString(e,t,s){return e?.doc?sc.stringifyPair(this,e,t,s):JSON.stringify(this)}};Wn.Pair=It;Wn.createPair=ic});var Gn=g(li=>{"use strict";var ce=O(),ai=Fe(),xt=Me();function oc(n,e,t){return(e.inFlow??n.flow?lc:ac)(n,e,t)}function ac({comment:n,items:e},t,{blockItemPrefix:s,flowChars:r,itemIndent:i,onChompKeep:o,onComment:a}){let{indent:l,options:{commentString:c}}=t,p=Object.assign({},t,{indent:i,type:null}),u=!1,f=[];for(let y=0;y<e.length;++y){let d=e[y],h=null;if(ce.isNode(d))!u&&d.spaceBefore&&f.push(""),$t(t,f,d.commentBefore,u),d.comment&&(h=d.comment);else if(ce.isPair(d)){let S=ce.isNode(d.key)?d.key:null;S&&(!u&&S.spaceBefore&&f.push(""),$t(t,f,S.commentBefore,u))}u=!1;let w=ai.stringify(d,p,()=>h=null,()=>u=!0);h&&(w+=xt.lineComment(w,i,c(h))),u&&h&&(u=!1),f.push(s+w)}let m;if(f.length===0)m=r.start+r.end;else{m=f[0];for(let y=1;y<f.length;++y){let d=f[y];m+=d?`
|
|
46
46
|
${l}${d}`:`
|
|
47
47
|
`}}return n?(m+=`
|
|
48
|
-
`+
|
|
49
|
-
`))&&(c=!0),u.push(
|
|
48
|
+
`+xt.indentComment(c(n),l),a&&a()):u&&o&&o(),m}function lc({items:n},e,{flowChars:t,itemIndent:s}){let{indent:r,indentStep:i,flowCollectionPadding:o,options:{commentString:a}}=e;s+=i;let l=Object.assign({},e,{indent:s,inFlow:!0,type:null}),c=!1,p=0,u=[];for(let y=0;y<n.length;++y){let d=n[y],h=null;if(ce.isNode(d))d.spaceBefore&&u.push(""),$t(e,u,d.commentBefore,!1),d.comment&&(h=d.comment);else if(ce.isPair(d)){let S=ce.isNode(d.key)?d.key:null;S&&(S.spaceBefore&&u.push(""),$t(e,u,S.commentBefore,!1),S.comment&&(c=!0));let v=ce.isNode(d.value)?d.value:null;v?(v.comment&&(h=v.comment),v.commentBefore&&(c=!0)):d.value==null&&S?.comment&&(h=S.comment)}h&&(c=!0);let w=ai.stringify(d,l,()=>h=null);y<n.length-1&&(w+=","),h&&(w+=xt.lineComment(w,s,a(h))),!c&&(u.length>p||w.includes(`
|
|
49
|
+
`))&&(c=!0),u.push(w),p=u.length}let{start:f,end:m}=t;if(u.length===0)return f+m;if(!c){let y=u.reduce((d,h)=>d+h.length+2,2);c=e.options.lineWidth>0&&y>e.options.lineWidth}if(c){let y=f;for(let d of u)y+=d?`
|
|
50
50
|
${i}${r}${d}`:`
|
|
51
51
|
`;return`${y}
|
|
52
|
-
${r}${m}`}else return`${f}${o}${u.join(" ")}${o}${m}`}function
|
|
53
|
-
`:" ")}return
|
|
52
|
+
${r}${m}`}else return`${f}${o}${u.join(" ")}${o}${m}`}function $t({indent:n,options:{commentString:e}},t,s,r){if(s&&r&&(s=s.replace(/^\n+/,"")),s){let i=xt.indentComment(e(s),n);t.push(i.trimStart())}}li.stringifyCollection=oc});var re=g(Qn=>{"use strict";var cc=Gn(),uc=Vn(),fc=St(),se=O(),qt=ne(),dc=C();function Ke(n,e){let t=se.isScalar(e)?e.value:e;for(let s of n)if(se.isPair(s)&&(s.key===e||s.key===t||se.isScalar(s.key)&&s.key.value===t))return s}var Hn=class extends fc.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(se.MAP,e),this.items=[]}static from(e,t,s){let{keepUndefined:r,replacer:i}=s,o=new this(e),a=(l,c)=>{if(typeof i=="function")c=i.call(t,l,c);else if(Array.isArray(i)&&!i.includes(l))return;(c!==void 0||r)&&o.items.push(qt.createPair(l,c,s))};if(t instanceof Map)for(let[l,c]of t)a(l,c);else if(t&&typeof t=="object")for(let l of Object.keys(t))a(l,t[l]);return typeof e.sortMapEntries=="function"&&o.items.sort(e.sortMapEntries),o}add(e,t){let s;se.isPair(e)?s=e:!e||typeof e!="object"||!("key"in e)?s=new qt.Pair(e,e?.value):s=new qt.Pair(e.key,e.value);let r=Ke(this.items,s.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw new Error(`Key ${s.key} already set`);se.isScalar(r.value)&&dc.isScalarValue(s.value)?r.value.value=s.value:r.value=s.value}else if(i){let o=this.items.findIndex(a=>i(s,a)<0);o===-1?this.items.push(s):this.items.splice(o,0,s)}else this.items.push(s)}delete(e){let t=Ke(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let r=Ke(this.items,e)?.value;return(!t&&se.isScalar(r)?r.value:r)??void 0}has(e){return!!Ke(this.items,e)}set(e,t){this.add(new qt.Pair(e,t),!0)}toJSON(e,t,s){let r=s?new s:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(r);for(let i of this.items)uc.addPairToJSMap(t,r,i);return r}toString(e,t,s){if(!e)return JSON.stringify(this);for(let r of this.items)if(!se.isPair(r))throw new Error(`Map items must all be pairs; found ${JSON.stringify(r)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),cc.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:s,onComment:t})}};Qn.YAMLMap=Hn;Qn.findPair=Ke});var ve=g(ui=>{"use strict";var pc=O(),ci=re(),hc={collection:"map",default:!0,nodeClass:ci.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(n,e){return pc.isMap(n)||e("Expected a mapping for this tag"),n},createNode:(n,e,t)=>ci.YAMLMap.from(n,e,t)};ui.map=hc});var ie=g(fi=>{"use strict";var mc=_e(),gc=Gn(),yc=St(),Mt=O(),bc=C(),wc=X(),zn=class extends yc.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Mt.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=_t(e);return typeof t!="number"?!1:this.items.splice(t,1).length>0}get(e,t){let s=_t(e);if(typeof s!="number")return;let r=this.items[s];return!t&&Mt.isScalar(r)?r.value:r}has(e){let t=_t(e);return typeof t=="number"&&t<this.items.length}set(e,t){let s=_t(e);if(typeof s!="number")throw new Error(`Expected a valid index, not ${e}.`);let r=this.items[s];Mt.isScalar(r)&&bc.isScalarValue(t)?r.value=t:this.items[s]=t}toJSON(e,t){let s=[];t?.onCreate&&t.onCreate(s);let r=0;for(let i of this.items)s.push(wc.toJS(i,String(r++),t));return s}toString(e,t,s){return e?gc.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:s,onComment:t}):JSON.stringify(this)}static from(e,t,s){let{replacer:r}=s,i=new this(e);if(t&&Symbol.iterator in Object(t)){let o=0;for(let a of t){if(typeof r=="function"){let l=t instanceof Set?a:String(o++);a=r.call(t,l,a)}i.items.push(mc.createNode(a,void 0,s))}}return i}};function _t(n){let e=Mt.isScalar(n)?n.value:n;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}fi.YAMLSeq=zn});var ke=g(pi=>{"use strict";var Sc=O(),di=ie(),vc={collection:"seq",default:!0,nodeClass:di.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(n,e){return Sc.isSeq(n)||e("Expected a sequence for this tag"),n},createNode:(n,e,t)=>di.YAMLSeq.from(n,e,t)};pi.seq=vc});var Je=g(hi=>{"use strict";var kc=De(),Ac={identify:n=>typeof n=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:n=>n,stringify(n,e,t,s){return e=Object.assign({actualString:!0},e),kc.stringifyString(n,e,t,s)}};hi.string=Ac});var Rt=g(yi=>{"use strict";var mi=C(),gi={identify:n=>n==null,createNode:()=>new mi.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new mi.Scalar(null),stringify:({source:n},e)=>typeof n=="string"&&gi.test.test(n)?n:e.options.nullStr};yi.nullTag=gi});var Xn=g(wi=>{"use strict";var Nc=C(),bi={identify:n=>typeof n=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:n=>new Nc.Scalar(n[0]==="t"||n[0]==="T"),stringify({source:n,value:e},t){if(n&&bi.test.test(n)){let s=n[0]==="t"||n[0]==="T";if(e===s)return n}return e?t.options.trueStr:t.options.falseStr}};wi.boolTag=bi});var Ae=g(Si=>{"use strict";function Oc({format:n,minFractionDigits:e,tag:t,value:s}){if(typeof s=="bigint")return String(s);let r=typeof s=="number"?s:Number(s);if(!isFinite(r))return isNaN(r)?".nan":r<0?"-.inf":".inf";let i=Object.is(s,-0)?"-0":JSON.stringify(s);if(!n&&e&&(!t||t==="tag:yaml.org,2002:float")&&/^\d/.test(i)){let o=i.indexOf(".");o<0&&(o=i.length,i+=".");let a=e-(i.length-o-1);for(;a-- >0;)i+="0"}return i}Si.stringifyNumber=Oc});var es=g(Bt=>{"use strict";var Ec=C(),Zn=Ae(),Tc={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:n=>n.slice(-3).toLowerCase()==="nan"?NaN:n[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Zn.stringifyNumber},Cc={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:n=>parseFloat(n),stringify(n){let e=Number(n.value);return isFinite(e)?e.toExponential():Zn.stringifyNumber(n)}},Lc={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(n){let e=new Ec.Scalar(parseFloat(n)),t=n.indexOf(".");return t!==-1&&n[n.length-1]==="0"&&(e.minFractionDigits=n.length-t-1),e},stringify:Zn.stringifyNumber};Bt.float=Lc;Bt.floatExp=Cc;Bt.floatNaN=Tc});var ns=g(Ft=>{"use strict";var vi=Ae(),Dt=n=>typeof n=="bigint"||Number.isInteger(n),ts=(n,e,t,{intAsBigInt:s})=>s?BigInt(n):parseInt(n.substring(e),t);function ki(n,e,t){let{value:s}=n;return Dt(s)&&s>=0?t+s.toString(e):vi.stringifyNumber(n)}var Pc={identify:n=>Dt(n)&&n>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(n,e,t)=>ts(n,2,8,t),stringify:n=>ki(n,8,"0o")},Ic={identify:Dt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(n,e,t)=>ts(n,0,10,t),stringify:vi.stringifyNumber},xc={identify:n=>Dt(n)&&n>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(n,e,t)=>ts(n,2,16,t),stringify:n=>ki(n,16,"0x")};Ft.int=Ic;Ft.intHex=xc;Ft.intOct=Pc});var Ni=g(Ai=>{"use strict";var $c=ve(),qc=Rt(),_c=ke(),Mc=Je(),Rc=Xn(),ss=es(),rs=ns(),Bc=[$c.map,_c.seq,Mc.string,qc.nullTag,Rc.boolTag,rs.intOct,rs.int,rs.intHex,ss.floatNaN,ss.floatExp,ss.float];Ai.schema=Bc});var Ti=g(Ei=>{"use strict";var Dc=C(),Fc=ve(),jc=ke();function Oi(n){return typeof n=="bigint"||Number.isInteger(n)}var jt=({value:n})=>JSON.stringify(n),Uc=[{identify:n=>typeof n=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:n=>n,stringify:jt},{identify:n=>n==null,createNode:()=>new Dc.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:jt},{identify:n=>typeof n=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:n=>n==="true",stringify:jt},{identify:Oi,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(n,e,{intAsBigInt:t})=>t?BigInt(n):parseInt(n,10),stringify:({value:n})=>Oi(n)?n.toString():JSON.stringify(n)},{identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:n=>parseFloat(n),stringify:jt}],Kc={default:!0,tag:"",test:/^/,resolve(n,e){return e(`Unresolved plain scalar ${JSON.stringify(n)}`),n}},Jc=[Fc.map,jc.seq].concat(Uc,Kc);Ei.schema=Jc});var os=g(Ci=>{"use strict";var Ye=ut("buffer"),is=C(),Yc=De(),Vc={identify:n=>n instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(n,e){if(typeof Ye.Buffer=="function")return Ye.Buffer.from(n,"base64");if(typeof atob=="function"){let t=atob(n.replace(/[\n\r]/g,"")),s=new Uint8Array(t.length);for(let r=0;r<t.length;++r)s[r]=t.charCodeAt(r);return s}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),n},stringify({comment:n,type:e,value:t},s,r,i){if(!t)return"";let o=t,a;if(typeof Ye.Buffer=="function")a=o instanceof Ye.Buffer?o.toString("base64"):Ye.Buffer.from(o.buffer).toString("base64");else if(typeof btoa=="function"){let l="";for(let c=0;c<o.length;++c)l+=String.fromCharCode(o[c]);a=btoa(l)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=is.Scalar.BLOCK_LITERAL),e!==is.Scalar.QUOTE_DOUBLE){let l=Math.max(s.options.lineWidth-s.indent.length,s.options.minContentWidth),c=Math.ceil(a.length/l),p=new Array(c);for(let u=0,f=0;u<c;++u,f+=l)p[u]=a.substr(f,l);a=p.join(e===is.Scalar.BLOCK_LITERAL?`
|
|
53
|
+
`:" ")}return Yc.stringifyString({comment:n,type:e,value:a},s,r,i)}};Ci.binary=Vc});var Jt=g(Kt=>{"use strict";var Ut=O(),as=ne(),Wc=C(),Gc=ie();function Li(n,e){if(Ut.isSeq(n))for(let t=0;t<n.items.length;++t){let s=n.items[t];if(!Ut.isPair(s)){if(Ut.isMap(s)){s.items.length>1&&e("Each pair must have its own sequence indicator");let r=s.items[0]||new as.Pair(new Wc.Scalar(null));if(s.commentBefore&&(r.key.commentBefore=r.key.commentBefore?`${s.commentBefore}
|
|
54
54
|
${r.key.commentBefore}`:s.commentBefore),s.comment){let i=r.value??r.key;i.comment=i.comment?`${s.comment}
|
|
55
|
-
${i.comment}`:s.comment}s=r}n.items[t]=Dt.isPair(s)?s:new ss.Pair(s)}}else e("Expected a sequence for this tag");return n}function Oi(n,e,t){let{replacer:s}=t,r=new jc.YAMLSeq(n);r.tag="tag:yaml.org,2002:pairs";let i=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof s=="function"&&(o=s.call(e,String(i++),o));let a,l;if(Array.isArray(o))if(o.length===2)a=o[0],l=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let c=Object.keys(o);if(c.length===1)a=c[0],l=o[a];else throw new TypeError(`Expected tuple with one key, not ${c.length} keys`)}else a=o;r.items.push(ss.createPair(a,l,t))}return r}var Kc={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Ni,createNode:Oi};Ft.createPairs=Oi;Ft.pairs=Kc;Ft.resolvePairs=Ni});var os=g(is=>{"use strict";var Ei=O(),rs=W(),Ue=Z(),Uc=ee(),Ti=jt(),ie=class n extends Uc.YAMLSeq{constructor(){super(),this.add=Ue.YAMLMap.prototype.add.bind(this),this.delete=Ue.YAMLMap.prototype.delete.bind(this),this.get=Ue.YAMLMap.prototype.get.bind(this),this.has=Ue.YAMLMap.prototype.has.bind(this),this.set=Ue.YAMLMap.prototype.set.bind(this),this.tag=n.tag}toJSON(e,t){if(!t)return super.toJSON(e);let s=new Map;t?.onCreate&&t.onCreate(s);for(let r of this.items){let i,o;if(Ei.isPair(r)?(i=rs.toJS(r.key,"",t),o=rs.toJS(r.value,i,t)):i=rs.toJS(r,"",t),s.has(i))throw new Error("Ordered maps must not include duplicate keys");s.set(i,o)}return s}static from(e,t,s){let r=Ti.createPairs(e,t,s),i=new this;return i.items=r.items,i}};ie.tag="tag:yaml.org,2002:omap";var Jc={collection:"seq",identify:n=>n instanceof Map,nodeClass:ie,default:!1,tag:"tag:yaml.org,2002:omap",resolve(n,e){let t=Ti.resolvePairs(n,e),s=[];for(let{key:r}of t.items)Ei.isScalar(r)&&(s.includes(r.value)?e(`Ordered maps must not include duplicate keys: ${r.value}`):s.push(r.value));return Object.assign(new ie,t)},createNode:(n,e,t)=>ie.from(n,e,t)};is.YAMLOMap=ie;is.omap=Jc});var qi=g(as=>{"use strict";var Ci=C();function Li({value:n,source:e},t){return e&&(n?Ii:Pi).test.test(e)?e:n?t.options.trueStr:t.options.falseStr}var Ii={identify:n=>n===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Ci.Scalar(!0),stringify:Li},Pi={identify:n=>n===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Ci.Scalar(!1),stringify:Li};as.falseTag=Pi;as.trueTag=Ii});var xi=g(Kt=>{"use strict";var Yc=C(),ls=ve(),Vc={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:n=>n.slice(-3).toLowerCase()==="nan"?NaN:n[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:ls.stringifyNumber},Wc={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:n=>parseFloat(n.replace(/_/g,"")),stringify(n){let e=Number(n.value);return isFinite(e)?e.toExponential():ls.stringifyNumber(n)}},Gc={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(n){let e=new Yc.Scalar(parseFloat(n.replace(/_/g,""))),t=n.indexOf(".");if(t!==-1){let s=n.substring(t+1).replace(/_/g,"");s[s.length-1]==="0"&&(e.minFractionDigits=s.length)}return e},stringify:ls.stringifyNumber};Kt.float=Gc;Kt.floatExp=Wc;Kt.floatNaN=Vc});var Mi=g(Ye=>{"use strict";var _i=ve(),Je=n=>typeof n=="bigint"||Number.isInteger(n);function Ut(n,e,t,{intAsBigInt:s}){let r=n[0];if((r==="-"||r==="+")&&(e+=1),n=n.substring(e).replace(/_/g,""),s){switch(t){case 2:n=`0b${n}`;break;case 8:n=`0o${n}`;break;case 16:n=`0x${n}`;break}let o=BigInt(n);return r==="-"?BigInt(-1)*o:o}let i=parseInt(n,t);return r==="-"?-1*i:i}function cs(n,e,t){let{value:s}=n;if(Je(s)){let r=s.toString(e);return s<0?"-"+t+r.substr(1):t+r}return _i.stringifyNumber(n)}var Hc={identify:Je,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(n,e,t)=>Ut(n,2,2,t),stringify:n=>cs(n,2,"0b")},Qc={identify:Je,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(n,e,t)=>Ut(n,1,8,t),stringify:n=>cs(n,8,"0")},zc={identify:Je,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(n,e,t)=>Ut(n,0,10,t),stringify:_i.stringifyNumber},Xc={identify:Je,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(n,e,t)=>Ut(n,2,16,t),stringify:n=>cs(n,16,"0x")};Ye.int=zc;Ye.intBin=Hc;Ye.intHex=Xc;Ye.intOct=Qc});var fs=g(us=>{"use strict";var Vt=O(),Jt=z(),Yt=Z(),oe=class n extends Yt.YAMLMap{constructor(e){super(e),this.tag=n.tag}add(e){let t;Vt.isPair(e)?t=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?t=new Jt.Pair(e.key,null):t=new Jt.Pair(e,null),Yt.findPair(this.items,t.key)||this.items.push(t)}get(e,t){let s=Yt.findPair(this.items,e);return!t&&Vt.isPair(s)?Vt.isScalar(s.key)?s.key.value:s.key:s}set(e,t){if(typeof t!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let s=Yt.findPair(this.items,e);s&&!t?this.items.splice(this.items.indexOf(s),1):!s&&t&&this.items.push(new Jt.Pair(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,s){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,s);throw new Error("Set items must all have null values")}static from(e,t,s){let{replacer:r}=s,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let o of t)typeof r=="function"&&(o=r.call(t,o,o)),i.items.push(Jt.createPair(o,null,s));return i}};oe.tag="tag:yaml.org,2002:set";var Zc={collection:"map",identify:n=>n instanceof Set,nodeClass:oe,default:!1,tag:"tag:yaml.org,2002:set",createNode:(n,e,t)=>oe.from(n,e,t),resolve(n,e){if(Vt.isMap(n)){if(n.hasAllNullValues(!0))return Object.assign(new oe,n);e("Set items must all have null values")}else e("Expected a mapping for this tag");return n}};us.YAMLSet=oe;us.set=Zc});var ps=g(Wt=>{"use strict";var eu=ve();function ds(n,e){let t=n[0],s=t==="-"||t==="+"?n.substring(1):n,r=o=>e?BigInt(o):Number(o),i=s.replace(/_/g,"").split(":").reduce((o,a)=>o*r(60)+r(a),r(0));return t==="-"?r(-1)*i:i}function $i(n){let{value:e}=n,t=o=>o;if(typeof e=="bigint")t=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return eu.stringifyNumber(n);let s="";e<0&&(s="-",e*=t(-1));let r=t(60),i=[e%r];return e<60?i.unshift(0):(e=(e-i[0])/r,i.unshift(e%r),e>=60&&(e=(e-i[0])/r,i.unshift(e))),s+i.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var tu={identify:n=>typeof n=="bigint"||Number.isInteger(n),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(n,e,{intAsBigInt:t})=>ds(n,t),stringify:$i},nu={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:n=>ds(n,!1),stringify:$i},Ri={identify:n=>n instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(n){let e=n.match(Ri.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,t,s,r,i,o,a]=e.map(Number),l=e[7]?Number((e[7]+"00").substr(1,3)):0,c=Date.UTC(t,s-1,r,i||0,o||0,a||0,l),p=e[8];if(p&&p!=="Z"){let u=ds(p,!1);Math.abs(u)<30&&(u*=60),c-=6e4*u}return new Date(c)},stringify:({value:n})=>n?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};Wt.floatTime=nu;Wt.intTime=tu;Wt.timestamp=Ri});var Fi=g(Di=>{"use strict";var su=Se(),ru=_t(),iu=we(),ou=je(),au=ns(),Bi=qi(),hs=xi(),Gt=Mi(),lu=Et(),cu=os(),uu=jt(),fu=fs(),ms=ps(),du=[su.map,iu.seq,ou.string,ru.nullTag,Bi.trueTag,Bi.falseTag,Gt.intBin,Gt.intOct,Gt.int,Gt.intHex,hs.floatNaN,hs.floatExp,hs.float,au.binary,lu.merge,cu.omap,uu.pairs,fu.set,ms.intTime,ms.floatTime,ms.timestamp];Di.schema=du});var Qi=g(bs=>{"use strict";var Ji=Se(),pu=_t(),Yi=we(),hu=je(),mu=Gn(),gs=Qn(),ys=Xn(),gu=Si(),yu=Ai(),Vi=ns(),Ve=Et(),Wi=os(),Gi=jt(),ji=Fi(),Hi=fs(),Ht=ps(),Ki=new Map([["core",gu.schema],["failsafe",[Ji.map,Yi.seq,hu.string]],["json",yu.schema],["yaml11",ji.schema],["yaml-1.1",ji.schema]]),Ui={binary:Vi.binary,bool:mu.boolTag,float:gs.float,floatExp:gs.floatExp,floatNaN:gs.floatNaN,floatTime:Ht.floatTime,int:ys.int,intHex:ys.intHex,intOct:ys.intOct,intTime:Ht.intTime,map:Ji.map,merge:Ve.merge,null:pu.nullTag,omap:Wi.omap,pairs:Gi.pairs,seq:Yi.seq,set:Hi.set,timestamp:Ht.timestamp},bu={"tag:yaml.org,2002:binary":Vi.binary,"tag:yaml.org,2002:merge":Ve.merge,"tag:yaml.org,2002:omap":Wi.omap,"tag:yaml.org,2002:pairs":Gi.pairs,"tag:yaml.org,2002:set":Hi.set,"tag:yaml.org,2002:timestamp":Ht.timestamp};function Su(n,e,t){let s=Ki.get(e);if(s&&!n)return t&&!s.includes(Ve.merge)?s.concat(Ve.merge):s.slice();let r=s;if(!r)if(Array.isArray(n))r=[];else{let i=Array.from(Ki.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${i} or define customTags array`)}if(Array.isArray(n))for(let i of n)r=r.concat(i);else typeof n=="function"&&(r=n(r.slice()));return t&&(r=r.concat(Ve.merge)),r.reduce((i,o)=>{let a=typeof o=="string"?Ui[o]:o;if(!a){let l=JSON.stringify(o),c=Object.keys(Ui).map(p=>JSON.stringify(p)).join(", ");throw new Error(`Unknown custom tag ${l}; use one of ${c}`)}return i.includes(a)||i.push(a),i},[])}bs.coreKnownTags=bu;bs.getTags=Su});var vs=g(zi=>{"use strict";var Ss=O(),wu=Se(),vu=we(),Au=je(),Qt=Qi(),ku=(n,e)=>n.key<e.key?-1:n.key>e.key?1:0,ws=class n{constructor({compat:e,customTags:t,merge:s,resolveKnownTags:r,schema:i,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(e)?Qt.getTags(e,"compat"):e?Qt.getTags(null,e):null,this.name=typeof i=="string"&&i||"core",this.knownTags=r?Qt.coreKnownTags:{},this.tags=Qt.getTags(t,this.name,s),this.toStringOptions=a??null,Object.defineProperty(this,Ss.MAP,{value:wu.map}),Object.defineProperty(this,Ss.SCALAR,{value:Au.string}),Object.defineProperty(this,Ss.SEQ,{value:vu.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?ku:null}clone(){let e=Object.create(n.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};zi.Schema=ws});var Zi=g(Xi=>{"use strict";var Nu=O(),As=Re(),We=xe();function Ou(n,e){let t=[],s=e.directives===!0;if(e.directives!==!1&&n.directives){let l=n.directives.toString(n);l?(t.push(l),s=!0):n.directives.docStart&&(s=!0)}s&&t.push("---");let r=As.createStringifyContext(n,e),{commentString:i}=r.options;if(n.commentBefore){t.length!==1&&t.unshift("");let l=i(n.commentBefore);t.unshift(We.indentComment(l,""))}let o=!1,a=null;if(n.contents){if(Nu.isNode(n.contents)){if(n.contents.spaceBefore&&s&&t.push(""),n.contents.commentBefore){let p=i(n.contents.commentBefore);t.push(We.indentComment(p,""))}r.forceBlockIndent=!!n.comment,a=n.contents.comment}let l=a?void 0:()=>o=!0,c=As.stringify(n.contents,r,()=>a=null,l);a&&(c+=We.lineComment(c,"",i(a))),(c[0]==="|"||c[0]===">")&&t[t.length-1]==="---"?t[t.length-1]=`--- ${c}`:t.push(c)}else t.push(As.stringify(n.contents,r));if(n.directives?.docEnd)if(n.comment){let l=i(n.comment);l.includes(`
|
|
56
|
-
`)?(t.push("..."),t.push(
|
|
55
|
+
${i.comment}`:s.comment}s=r}n.items[t]=Ut.isPair(s)?s:new as.Pair(s)}}else e("Expected a sequence for this tag");return n}function Pi(n,e,t){let{replacer:s}=t,r=new Gc.YAMLSeq(n);r.tag="tag:yaml.org,2002:pairs";let i=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof s=="function"&&(o=s.call(e,String(i++),o));let a,l;if(Array.isArray(o))if(o.length===2)a=o[0],l=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let c=Object.keys(o);if(c.length===1)a=c[0],l=o[a];else throw new TypeError(`Expected tuple with one key, not ${c.length} keys`)}else a=o;r.items.push(as.createPair(a,l,t))}return r}var Hc={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Li,createNode:Pi};Kt.createPairs=Pi;Kt.pairs=Hc;Kt.resolvePairs=Li});var us=g(cs=>{"use strict";var Ii=O(),ls=X(),Ve=re(),Qc=ie(),xi=Jt(),ue=class n extends Qc.YAMLSeq{constructor(){super(),this.add=Ve.YAMLMap.prototype.add.bind(this),this.delete=Ve.YAMLMap.prototype.delete.bind(this),this.get=Ve.YAMLMap.prototype.get.bind(this),this.has=Ve.YAMLMap.prototype.has.bind(this),this.set=Ve.YAMLMap.prototype.set.bind(this),this.tag=n.tag}toJSON(e,t){if(!t)return super.toJSON(e);let s=new Map;t?.onCreate&&t.onCreate(s);for(let r of this.items){let i,o;if(Ii.isPair(r)?(i=ls.toJS(r.key,"",t),o=ls.toJS(r.value,i,t)):i=ls.toJS(r,"",t),s.has(i))throw new Error("Ordered maps must not include duplicate keys");s.set(i,o)}return s}static from(e,t,s){let r=xi.createPairs(e,t,s),i=new this;return i.items=r.items,i}};ue.tag="tag:yaml.org,2002:omap";var zc={collection:"seq",identify:n=>n instanceof Map,nodeClass:ue,default:!1,tag:"tag:yaml.org,2002:omap",resolve(n,e){let t=xi.resolvePairs(n,e),s=[];for(let{key:r}of t.items)Ii.isScalar(r)&&(s.includes(r.value)?e(`Ordered maps must not include duplicate keys: ${r.value}`):s.push(r.value));return Object.assign(new ue,t)},createNode:(n,e,t)=>ue.from(n,e,t)};cs.YAMLOMap=ue;cs.omap=zc});var Ri=g(fs=>{"use strict";var $i=C();function qi({value:n,source:e},t){return e&&(n?_i:Mi).test.test(e)?e:n?t.options.trueStr:t.options.falseStr}var _i={identify:n=>n===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new $i.Scalar(!0),stringify:qi},Mi={identify:n=>n===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new $i.Scalar(!1),stringify:qi};fs.falseTag=Mi;fs.trueTag=_i});var Bi=g(Yt=>{"use strict";var Xc=C(),ds=Ae(),Zc={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:n=>n.slice(-3).toLowerCase()==="nan"?NaN:n[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:ds.stringifyNumber},eu={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:n=>parseFloat(n.replace(/_/g,"")),stringify(n){let e=Number(n.value);return isFinite(e)?e.toExponential():ds.stringifyNumber(n)}},tu={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(n){let e=new Xc.Scalar(parseFloat(n.replace(/_/g,""))),t=n.indexOf(".");if(t!==-1){let s=n.substring(t+1).replace(/_/g,"");s[s.length-1]==="0"&&(e.minFractionDigits=s.length)}return e},stringify:ds.stringifyNumber};Yt.float=tu;Yt.floatExp=eu;Yt.floatNaN=Zc});var Fi=g(Ge=>{"use strict";var Di=Ae(),We=n=>typeof n=="bigint"||Number.isInteger(n);function Vt(n,e,t,{intAsBigInt:s}){let r=n[0];if((r==="-"||r==="+")&&(e+=1),n=n.substring(e).replace(/_/g,""),s){switch(t){case 2:n=`0b${n}`;break;case 8:n=`0o${n}`;break;case 16:n=`0x${n}`;break}let o=BigInt(n);return r==="-"?BigInt(-1)*o:o}let i=parseInt(n,t);return r==="-"?-1*i:i}function ps(n,e,t){let{value:s}=n;if(We(s)){let r=s.toString(e);return s<0?"-"+t+r.substr(1):t+r}return Di.stringifyNumber(n)}var nu={identify:We,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(n,e,t)=>Vt(n,2,2,t),stringify:n=>ps(n,2,"0b")},su={identify:We,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(n,e,t)=>Vt(n,1,8,t),stringify:n=>ps(n,8,"0")},ru={identify:We,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(n,e,t)=>Vt(n,0,10,t),stringify:Di.stringifyNumber},iu={identify:We,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(n,e,t)=>Vt(n,2,16,t),stringify:n=>ps(n,16,"0x")};Ge.int=ru;Ge.intBin=nu;Ge.intHex=iu;Ge.intOct=su});var ms=g(hs=>{"use strict";var Ht=O(),Wt=ne(),Gt=re(),fe=class n extends Gt.YAMLMap{constructor(e){super(e),this.tag=n.tag}add(e){let t;Ht.isPair(e)?t=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?t=new Wt.Pair(e.key,null):t=new Wt.Pair(e,null),Gt.findPair(this.items,t.key)||this.items.push(t)}get(e,t){let s=Gt.findPair(this.items,e);return!t&&Ht.isPair(s)?Ht.isScalar(s.key)?s.key.value:s.key:s}set(e,t){if(typeof t!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let s=Gt.findPair(this.items,e);s&&!t?this.items.splice(this.items.indexOf(s),1):!s&&t&&this.items.push(new Wt.Pair(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,s){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,s);throw new Error("Set items must all have null values")}static from(e,t,s){let{replacer:r}=s,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let o of t)typeof r=="function"&&(o=r.call(t,o,o)),i.items.push(Wt.createPair(o,null,s));return i}};fe.tag="tag:yaml.org,2002:set";var ou={collection:"map",identify:n=>n instanceof Set,nodeClass:fe,default:!1,tag:"tag:yaml.org,2002:set",createNode:(n,e,t)=>fe.from(n,e,t),resolve(n,e){if(Ht.isMap(n)){if(n.hasAllNullValues(!0))return Object.assign(new fe,n);e("Set items must all have null values")}else e("Expected a mapping for this tag");return n}};hs.YAMLSet=fe;hs.set=ou});var ys=g(Qt=>{"use strict";var au=Ae();function gs(n,e){let t=n[0],s=t==="-"||t==="+"?n.substring(1):n,r=o=>e?BigInt(o):Number(o),i=s.replace(/_/g,"").split(":").reduce((o,a)=>o*r(60)+r(a),r(0));return t==="-"?r(-1)*i:i}function ji(n){let{value:e}=n,t=o=>o;if(typeof e=="bigint")t=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return au.stringifyNumber(n);let s="";e<0&&(s="-",e*=t(-1));let r=t(60),i=[e%r];return e<60?i.unshift(0):(e=(e-i[0])/r,i.unshift(e%r),e>=60&&(e=(e-i[0])/r,i.unshift(e))),s+i.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var lu={identify:n=>typeof n=="bigint"||Number.isInteger(n),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(n,e,{intAsBigInt:t})=>gs(n,t),stringify:ji},cu={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:n=>gs(n,!1),stringify:ji},Ui={identify:n=>n instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(n){let e=n.match(Ui.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,t,s,r,i,o,a]=e.map(Number),l=e[7]?Number((e[7]+"00").substr(1,3)):0,c=Date.UTC(t,s-1,r,i||0,o||0,a||0,l),p=e[8];if(p&&p!=="Z"){let u=gs(p,!1);Math.abs(u)<30&&(u*=60),c-=6e4*u}return new Date(c)},stringify:({value:n})=>n?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};Qt.floatTime=cu;Qt.intTime=lu;Qt.timestamp=Ui});var Yi=g(Ji=>{"use strict";var uu=ve(),fu=Rt(),du=ke(),pu=Je(),hu=os(),Ki=Ri(),bs=Bi(),zt=Fi(),mu=Lt(),gu=us(),yu=Jt(),bu=ms(),ws=ys(),wu=[uu.map,du.seq,pu.string,fu.nullTag,Ki.trueTag,Ki.falseTag,zt.intBin,zt.intOct,zt.int,zt.intHex,bs.floatNaN,bs.floatExp,bs.float,hu.binary,mu.merge,gu.omap,yu.pairs,bu.set,ws.intTime,ws.floatTime,ws.timestamp];Ji.schema=wu});var to=g(ks=>{"use strict";var Hi=ve(),Su=Rt(),Qi=ke(),vu=Je(),ku=Xn(),Ss=es(),vs=ns(),Au=Ni(),Nu=Ti(),zi=os(),He=Lt(),Xi=us(),Zi=Jt(),Vi=Yi(),eo=ms(),Xt=ys(),Wi=new Map([["core",Au.schema],["failsafe",[Hi.map,Qi.seq,vu.string]],["json",Nu.schema],["yaml11",Vi.schema],["yaml-1.1",Vi.schema]]),Gi={binary:zi.binary,bool:ku.boolTag,float:Ss.float,floatExp:Ss.floatExp,floatNaN:Ss.floatNaN,floatTime:Xt.floatTime,int:vs.int,intHex:vs.intHex,intOct:vs.intOct,intTime:Xt.intTime,map:Hi.map,merge:He.merge,null:Su.nullTag,omap:Xi.omap,pairs:Zi.pairs,seq:Qi.seq,set:eo.set,timestamp:Xt.timestamp},Ou={"tag:yaml.org,2002:binary":zi.binary,"tag:yaml.org,2002:merge":He.merge,"tag:yaml.org,2002:omap":Xi.omap,"tag:yaml.org,2002:pairs":Zi.pairs,"tag:yaml.org,2002:set":eo.set,"tag:yaml.org,2002:timestamp":Xt.timestamp};function Eu(n,e,t){let s=Wi.get(e);if(s&&!n)return t&&!s.includes(He.merge)?s.concat(He.merge):s.slice();let r=s;if(!r)if(Array.isArray(n))r=[];else{let i=Array.from(Wi.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${i} or define customTags array`)}if(Array.isArray(n))for(let i of n)r=r.concat(i);else typeof n=="function"&&(r=n(r.slice()));return t&&(r=r.concat(He.merge)),r.reduce((i,o)=>{let a=typeof o=="string"?Gi[o]:o;if(!a){let l=JSON.stringify(o),c=Object.keys(Gi).map(p=>JSON.stringify(p)).join(", ");throw new Error(`Unknown custom tag ${l}; use one of ${c}`)}return i.includes(a)||i.push(a),i},[])}ks.coreKnownTags=Ou;ks.getTags=Eu});var Os=g(no=>{"use strict";var As=O(),Tu=ve(),Cu=ke(),Lu=Je(),Zt=to(),Pu=(n,e)=>n.key<e.key?-1:n.key>e.key?1:0,Ns=class n{constructor({compat:e,customTags:t,merge:s,resolveKnownTags:r,schema:i,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(e)?Zt.getTags(e,"compat"):e?Zt.getTags(null,e):null,this.name=typeof i=="string"&&i||"core",this.knownTags=r?Zt.coreKnownTags:{},this.tags=Zt.getTags(t,this.name,s),this.toStringOptions=a??null,Object.defineProperty(this,As.MAP,{value:Tu.map}),Object.defineProperty(this,As.SCALAR,{value:Lu.string}),Object.defineProperty(this,As.SEQ,{value:Cu.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?Pu:null}clone(){let e=Object.create(n.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};no.Schema=Ns});var ro=g(so=>{"use strict";var Iu=O(),Es=Fe(),Qe=Me();function xu(n,e){let t=[],s=e.directives===!0;if(e.directives!==!1&&n.directives){let l=n.directives.toString(n);l?(t.push(l),s=!0):n.directives.docStart&&(s=!0)}s&&t.push("---");let r=Es.createStringifyContext(n,e),{commentString:i}=r.options;if(n.commentBefore){t.length!==1&&t.unshift("");let l=i(n.commentBefore);t.unshift(Qe.indentComment(l,""))}let o=!1,a=null;if(n.contents){if(Iu.isNode(n.contents)){if(n.contents.spaceBefore&&s&&t.push(""),n.contents.commentBefore){let p=i(n.contents.commentBefore);t.push(Qe.indentComment(p,""))}r.forceBlockIndent=!!n.comment,a=n.contents.comment}let l=a?void 0:()=>o=!0,c=Es.stringify(n.contents,r,()=>a=null,l);a&&(c+=Qe.lineComment(c,"",i(a))),(c[0]==="|"||c[0]===">")&&t[t.length-1]==="---"?t[t.length-1]=`--- ${c}`:t.push(c)}else t.push(Es.stringify(n.contents,r));if(n.directives?.docEnd)if(n.comment){let l=i(n.comment);l.includes(`
|
|
56
|
+
`)?(t.push("..."),t.push(Qe.indentComment(l,""))):t.push(`... ${l}`)}else t.push("...");else{let l=n.comment;l&&o&&(l=l.replace(/^\n+/,"")),l&&((!o||a)&&t[t.length-1]!==""&&t.push(""),t.push(Qe.indentComment(i(l),"")))}return t.join(`
|
|
57
57
|
`)+`
|
|
58
|
-
`}
|
|
58
|
+
`}so.stringifyDocument=xu});var ze=g(io=>{"use strict";var $u=qe(),Ne=St(),M=O(),qu=ne(),_u=X(),Mu=Os(),Ru=ro(),Ts=gt(),Bu=In(),Du=_e(),Cs=Pn(),Ls=class n{constructor(e,t,s){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,M.NODE_TYPE,{value:M.DOC});let r=null;typeof t=="function"||Array.isArray(t)?r=t:s===void 0&&t&&(s=t,t=void 0);let i=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},s);this.options=i;let{version:o}=i;s?._directives?(this.directives=s._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new Cs.Directives({version:o}),this.setSchema(o,s),this.contents=e===void 0?null:this.createNode(e,r,s)}clone(){let e=Object.create(n.prototype,{[M.NODE_TYPE]:{value:M.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=M.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Oe(this.contents)&&this.contents.add(e)}addIn(e,t){Oe(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let s=Ts.anchorNames(this);e.anchor=!t||s.has(t)?Ts.findNewAnchor(t||"a",s):t}return new $u.Alias(e.anchor)}createNode(e,t,s){let r;if(typeof t=="function")e=t.call({"":e},"",e),r=t;else if(Array.isArray(t)){let h=S=>typeof S=="number"||S instanceof String||S instanceof Number,w=t.filter(h).map(String);w.length>0&&(t=t.concat(w)),r=t}else s===void 0&&t&&(s=t,t=void 0);let{aliasDuplicateObjects:i,anchorPrefix:o,flow:a,keepUndefined:l,onTagObj:c,tag:p}=s??{},{onAnchor:u,setAnchors:f,sourceObjects:m}=Ts.createNodeAnchors(this,o||"a"),y={aliasDuplicateObjects:i??!0,keepUndefined:l??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:m},d=Du.createNode(e,p,y);return a&&M.isCollection(d)&&(d.flow=!0),f(),d}createPair(e,t,s={}){let r=this.createNode(e,null,s),i=this.createNode(t,null,s);return new qu.Pair(r,i)}delete(e){return Oe(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Ne.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):Oe(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return M.isCollection(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return Ne.isEmptyPath(e)?!t&&M.isScalar(this.contents)?this.contents.value:this.contents:M.isCollection(this.contents)?this.contents.getIn(e,t):void 0}has(e){return M.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return Ne.isEmptyPath(e)?this.contents!==void 0:M.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=Ne.collectionFromPath(this.schema,[e],t):Oe(this.contents)&&this.contents.set(e,t)}setIn(e,t){Ne.isEmptyPath(e)?this.contents=t:this.contents==null?this.contents=Ne.collectionFromPath(this.schema,Array.from(e),t):Oe(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e=="number"&&(e=String(e));let s;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new Cs.Directives({version:"1.1"}),s={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new Cs.Directives({version:e}),s={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,s=null;break;default:{let r=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${r}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(s)this.schema=new Mu.Schema(Object.assign(s,t));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:t,mapAsMap:s,maxAliasCount:r,onAnchor:i,reviver:o}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:s===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},l=_u.toJS(this.contents,t??"",a);if(typeof i=="function")for(let{count:c,res:p}of a.anchors.values())i(p,c);return typeof o=="function"?Bu.applyReviver(o,{"":l},"",l):l}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${t}`)}return Ru.stringifyDocument(this,e)}};function Oe(n){if(M.isCollection(n))return!0;throw new Error("Expected a YAML collection as document contents")}io.Document=Ls});var et=g(Ze=>{"use strict";var Xe=class extends Error{constructor(e,t,s,r){super(),this.name=e,this.code=s,this.message=r,this.pos=t}},Ps=class extends Xe{constructor(e,t,s){super("YAMLParseError",e,t,s)}},Is=class extends Xe{constructor(e,t,s){super("YAMLWarning",e,t,s)}},Fu=(n,e)=>t=>{if(t.pos[0]===-1)return;t.linePos=t.pos.map(a=>e.linePos(a));let{line:s,col:r}=t.linePos[0];t.message+=` at line ${s}, column ${r}`;let i=r-1,o=n.substring(e.lineStarts[s-1],e.lineStarts[s]).replace(/[\n\r]+$/,"");if(i>=60&&o.length>80){let a=Math.min(i-39,o.length-79);o="\u2026"+o.substring(a),i-=a-1}if(o.length>80&&(o=o.substring(0,79)+"\u2026"),s>1&&/^ *$/.test(o.substring(0,i))){let a=n.substring(e.lineStarts[s-2],e.lineStarts[s-1]);a.length>80&&(a=a.substring(0,79)+`\u2026
|
|
59
59
|
`),o=a+o}if(/[^ ]/.test(o)){let a=1,l=t.linePos[1];l?.line===s&&l.col>r&&(a=Math.max(1,Math.min(l.col-r,80-i)));let c=" ".repeat(i)+"^".repeat(a);t.message+=`:
|
|
60
60
|
|
|
61
61
|
${o}
|
|
62
62
|
${c}
|
|
63
|
-
`}};
|
|
64
|
-
`))return!0;if(n.end){for(let e of n.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of n.items){for(let t of e.start)if(t.type==="newline")return!0;if(e.sep){for(let t of e.sep)if(t.type==="newline")return!0}if(
|
|
65
|
-
`+d.comment:a.comment=d.comment);continue}(d.newlineAfterProp||
|
|
66
|
-
`+v.comment:
|
|
67
|
-
`+N.comment:c.comment=N.comment),u=N.end;continue}!o&&t.options.strict&&
|
|
68
|
-
`+T:b.comment=T,N.comment=N.comment.substring(T.length+1)}}if(!o&&!
|
|
69
|
-
`+L.comment:b.comment=L.comment);let
|
|
70
|
-
`+h.comment:c.comment=h.comment),c.range=[s.offset,d,h.offset]}else c.range=[s.offset,d,d];return c}
|
|
71
|
-
`.repeat(Math.max(1,o.length-1)):"",h=s+r.length;return e.source&&(h+=e.source.length),{value:d,type:i,comment:r.comment,range:[s,h,h]}}let l=e.indent+r.indent,c=e.offset+r.length,p=0;for(let d=0;d<a;++d){let[h,
|
|
72
|
-
`;for(let d=p;d<a;++d){let[h,
|
|
73
|
-
`):h.length>l||
|
|
63
|
+
`}};Ze.YAMLError=Xe;Ze.YAMLParseError=Ps;Ze.YAMLWarning=Is;Ze.prettifyError=Fu});var tt=g(oo=>{"use strict";function ju(n,{flow:e,indicator:t,next:s,offset:r,onError:i,parentIndent:o,startOnNewline:a}){let l=!1,c=a,p=a,u="",f="",m=!1,y=!1,d=null,h=null,w=null,S=null,v=null,k=null,A=null;for(let b of n)switch(y&&(b.type!=="space"&&b.type!=="newline"&&b.type!=="comma"&&i(b.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),y=!1),d&&(c&&b.type!=="comment"&&b.type!=="newline"&&i(d,"TAB_AS_INDENT","Tabs are not allowed as indentation"),d=null),b.type){case"space":!e&&(t!=="doc-start"||s?.type!=="flow-collection")&&b.source.includes(" ")&&(d=b),p=!0;break;case"comment":{p||i(b,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let L=b.source.substring(1)||" ";u?u+=f+L:u=L,f="",c=!1;break}case"newline":c?u?u+=b.source:(!k||t!=="seq-item-ind")&&(l=!0):f+=b.source,c=!0,m=!0,(h||w)&&(S=b),p=!0;break;case"anchor":h&&i(b,"MULTIPLE_ANCHORS","A node can have at most one anchor"),b.source.endsWith(":")&&i(b.offset+b.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),h=b,A??(A=b.offset),c=!1,p=!1,y=!0;break;case"tag":{w&&i(b,"MULTIPLE_TAGS","A node can have at most one tag"),w=b,A??(A=b.offset),c=!1,p=!1,y=!0;break}case t:(h||w)&&i(b,"BAD_PROP_ORDER",`Anchors and tags must be after the ${b.source} indicator`),k&&i(b,"UNEXPECTED_TOKEN",`Unexpected ${b.source} in ${e??"collection"}`),k=b,c=t==="seq-item-ind"||t==="explicit-key-ind",p=!1;break;case"comma":if(e){v&&i(b,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),v=b,c=!1,p=!1;break}default:i(b,"UNEXPECTED_TOKEN",`Unexpected ${b.type} token`),c=!1,p=!1}let N=n[n.length-1],T=N?N.offset+N.source.length:r;return y&&s&&s.type!=="space"&&s.type!=="newline"&&s.type!=="comma"&&(s.type!=="scalar"||s.source!=="")&&i(s.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),d&&(c&&d.indent<=o||s?.type==="block-map"||s?.type==="block-seq")&&i(d,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:v,found:k,spaceBefore:l,comment:u,hasNewline:m,anchor:h,tag:w,newlineAfterProp:S,end:T,start:A??T}}oo.resolveProps=ju});var en=g(ao=>{"use strict";function xs(n){if(!n)return null;switch(n.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(n.source.includes(`
|
|
64
|
+
`))return!0;if(n.end){for(let e of n.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of n.items){for(let t of e.start)if(t.type==="newline")return!0;if(e.sep){for(let t of e.sep)if(t.type==="newline")return!0}if(xs(e.key)||xs(e.value))return!0}return!1;default:return!0}}ao.containsNewline=xs});var $s=g(lo=>{"use strict";var Uu=en();function Ku(n,e,t){if(e?.type==="flow-collection"){let s=e.end[0];s.indent===n&&(s.source==="]"||s.source==="}")&&Uu.containsNewline(e)&&t(s,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}lo.flowIndentCheck=Ku});var qs=g(uo=>{"use strict";var co=O();function Ju(n,e,t){let{uniqueKeys:s}=n.options;if(s===!1)return!1;let r=typeof s=="function"?s:(i,o)=>i===o||co.isScalar(i)&&co.isScalar(o)&&i.value===o.value;return e.some(i=>r(i.key,t))}uo.mapIncludes=Ju});var yo=g(go=>{"use strict";var fo=ne(),Yu=re(),po=tt(),Vu=en(),ho=$s(),Wu=qs(),mo="All mapping items must start at the same column";function Gu({composeNode:n,composeEmptyNode:e},t,s,r,i){let o=i?.nodeClass??Yu.YAMLMap,a=new o(t.schema);t.atRoot&&(t.atRoot=!1);let l=s.offset,c=null;for(let p of s.items){let{start:u,key:f,sep:m,value:y}=p,d=po.resolveProps(u,{indicator:"explicit-key-ind",next:f??m?.[0],offset:l,onError:r,parentIndent:s.indent,startOnNewline:!0}),h=!d.found;if(h){if(f&&(f.type==="block-seq"?r(l,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in f&&f.indent!==s.indent&&r(l,"BAD_INDENT",mo)),!d.anchor&&!d.tag&&!m){c=d.end,d.comment&&(a.comment?a.comment+=`
|
|
65
|
+
`+d.comment:a.comment=d.comment);continue}(d.newlineAfterProp||Vu.containsNewline(f))&&r(f??u[u.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else d.found?.indent!==s.indent&&r(l,"BAD_INDENT",mo);t.atKey=!0;let w=d.end,S=f?n(t,f,d,r):e(t,w,u,null,d,r);t.schema.compat&&ho.flowIndentCheck(s.indent,f,r),t.atKey=!1,Wu.mapIncludes(t,a.items,S)&&r(w,"DUPLICATE_KEY","Map keys must be unique");let v=po.resolveProps(m??[],{indicator:"map-value-ind",next:y,offset:S.range[2],onError:r,parentIndent:s.indent,startOnNewline:!f||f.type==="block-scalar"});if(l=v.end,v.found){h&&(y?.type==="block-map"&&!v.hasNewline&&r(l,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),t.options.strict&&d.start<v.found.offset-1024&&r(S.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let k=y?n(t,y,v,r):e(t,l,m,null,v,r);t.schema.compat&&ho.flowIndentCheck(s.indent,y,r),l=k.range[2];let A=new fo.Pair(S,k);t.options.keepSourceTokens&&(A.srcToken=p),a.items.push(A)}else{h&&r(S.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),v.comment&&(S.comment?S.comment+=`
|
|
66
|
+
`+v.comment:S.comment=v.comment);let k=new fo.Pair(S);t.options.keepSourceTokens&&(k.srcToken=p),a.items.push(k)}}return c&&c<l&&r(c,"IMPOSSIBLE","Map comment with trailing content"),a.range=[s.offset,l,c??l],a}go.resolveBlockMap=Gu});var wo=g(bo=>{"use strict";var Hu=ie(),Qu=tt(),zu=$s();function Xu({composeNode:n,composeEmptyNode:e},t,s,r,i){let o=i?.nodeClass??Hu.YAMLSeq,a=new o(t.schema);t.atRoot&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let l=s.offset,c=null;for(let{start:p,value:u}of s.items){let f=Qu.resolveProps(p,{indicator:"seq-item-ind",next:u,offset:l,onError:r,parentIndent:s.indent,startOnNewline:!0});if(!f.found)if(f.anchor||f.tag||u)u?.type==="block-seq"?r(f.end,"BAD_INDENT","All sequence items must start at the same column"):r(l,"MISSING_CHAR","Sequence item without - indicator");else{c=f.end,f.comment&&(a.comment=f.comment);continue}let m=u?n(t,u,f,r):e(t,f.end,p,null,f,r);t.schema.compat&&zu.flowIndentCheck(s.indent,u,r),l=m.range[2],a.items.push(m)}return a.range=[s.offset,l,c??l],a}bo.resolveBlockSeq=Xu});var Ee=g(So=>{"use strict";function Zu(n,e,t,s){let r="";if(n){let i=!1,o="";for(let a of n){let{source:l,type:c}=a;switch(c){case"space":i=!0;break;case"comment":{t&&!i&&s(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let p=l.substring(1)||" ";r?r+=o+p:r=p,o="";break}case"newline":r&&(o+=l),i=!0;break;default:s(a,"UNEXPECTED_TOKEN",`Unexpected ${c} at node end`)}e+=l.length}}return{comment:r,offset:e}}So.resolveEnd=Zu});var No=g(Ao=>{"use strict";var ef=O(),tf=ne(),vo=re(),nf=ie(),sf=Ee(),ko=tt(),rf=en(),of=qs(),_s="Block collections are not allowed within flow collections",Ms=n=>n&&(n.type==="block-map"||n.type==="block-seq");function af({composeNode:n,composeEmptyNode:e},t,s,r,i){let o=s.start.source==="{",a=o?"flow map":"flow sequence",l=i?.nodeClass??(o?vo.YAMLMap:nf.YAMLSeq),c=new l(t.schema);c.flow=!0;let p=t.atRoot;p&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let u=s.offset+s.start.source.length;for(let h=0;h<s.items.length;++h){let w=s.items[h],{start:S,key:v,sep:k,value:A}=w,N=ko.resolveProps(S,{flow:a,indicator:"explicit-key-ind",next:v??k?.[0],offset:u,onError:r,parentIndent:s.indent,startOnNewline:!1});if(!N.found){if(!N.anchor&&!N.tag&&!k&&!A){h===0&&N.comma?r(N.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):h<s.items.length-1&&r(N.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),N.comment&&(c.comment?c.comment+=`
|
|
67
|
+
`+N.comment:c.comment=N.comment),u=N.end;continue}!o&&t.options.strict&&rf.containsNewline(v)&&r(v,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(h===0)N.comma&&r(N.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(N.comma||r(N.start,"MISSING_CHAR",`Missing , between ${a} items`),N.comment){let T="";e:for(let b of S)switch(b.type){case"comma":case"space":break;case"comment":T=b.source.substring(1);break e;default:break e}if(T){let b=c.items[c.items.length-1];ef.isPair(b)&&(b=b.value??b.key),b.comment?b.comment+=`
|
|
68
|
+
`+T:b.comment=T,N.comment=N.comment.substring(T.length+1)}}if(!o&&!k&&!N.found){let T=A?n(t,A,N,r):e(t,N.end,k,null,N,r);c.items.push(T),u=T.range[2],Ms(A)&&r(T.range,"BLOCK_IN_FLOW",_s)}else{t.atKey=!0;let T=N.end,b=v?n(t,v,N,r):e(t,T,S,null,N,r);Ms(v)&&r(b.range,"BLOCK_IN_FLOW",_s),t.atKey=!1;let L=ko.resolveProps(k??[],{flow:a,indicator:"map-value-ind",next:A,offset:b.range[2],onError:r,parentIndent:s.indent,startOnNewline:!1});if(L.found){if(!o&&!N.found&&t.options.strict){if(k)for(let P of k){if(P===L.found)break;if(P.type==="newline"){r(P,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}N.start<L.found.offset-1024&&r(L.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else A&&("source"in A&&A.source?.[0]===":"?r(A,"MISSING_CHAR",`Missing space after : in ${a}`):r(L.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let H=A?n(t,A,L,r):L.found?e(t,L.end,k,null,L,r):null;H?Ms(A)&&r(H.range,"BLOCK_IN_FLOW",_s):L.comment&&(b.comment?b.comment+=`
|
|
69
|
+
`+L.comment:b.comment=L.comment);let me=new tf.Pair(b,H);if(t.options.keepSourceTokens&&(me.srcToken=w),o){let P=c;of.mapIncludes(t,P.items,b)&&r(T,"DUPLICATE_KEY","Map keys must be unique"),P.items.push(me)}else{let P=new vo.YAMLMap(t.schema);P.flow=!0,P.items.push(me);let fr=(H??b).range;P.range=[b.range[0],fr[1],fr[2]],c.items.push(P)}u=H?H.range[2]:L.end}}let f=o?"}":"]",[m,...y]=s.end,d=u;if(m?.source===f)d=m.offset+m.source.length;else{let h=a[0].toUpperCase()+a.substring(1),w=p?`${h} must end with a ${f}`:`${h} in block collection must be sufficiently indented and end with a ${f}`;r(u,p?"MISSING_CHAR":"BAD_INDENT",w),m&&m.source.length!==1&&y.unshift(m)}if(y.length>0){let h=sf.resolveEnd(y,d,t.options.strict,r);h.comment&&(c.comment?c.comment+=`
|
|
70
|
+
`+h.comment:c.comment=h.comment),c.range=[s.offset,d,h.offset]}else c.range=[s.offset,d,d];return c}Ao.resolveFlowCollection=af});var Eo=g(Oo=>{"use strict";var lf=O(),cf=C(),uf=re(),ff=ie(),df=yo(),pf=wo(),hf=No();function Rs(n,e,t,s,r,i){let o=t.type==="block-map"?df.resolveBlockMap(n,e,t,s,i):t.type==="block-seq"?pf.resolveBlockSeq(n,e,t,s,i):hf.resolveFlowCollection(n,e,t,s,i),a=o.constructor;return r==="!"||r===a.tagName?(o.tag=a.tagName,o):(r&&(o.tag=r),o)}function mf(n,e,t,s,r){let i=s.tag,o=i?e.directives.tagName(i.source,f=>r(i,"TAG_RESOLVE_FAILED",f)):null;if(t.type==="block-seq"){let{anchor:f,newlineAfterProp:m}=s,y=f&&i?f.offset>i.offset?f:i:f??i;y&&(!m||m.offset<y.offset)&&r(y,"MISSING_CHAR","Missing newline after block sequence props")}let a=t.type==="block-map"?"map":t.type==="block-seq"?"seq":t.start.source==="{"?"map":"seq";if(!i||!o||o==="!"||o===uf.YAMLMap.tagName&&a==="map"||o===ff.YAMLSeq.tagName&&a==="seq")return Rs(n,e,t,r,o);let l=e.schema.tags.find(f=>f.tag===o&&f.collection===a);if(!l){let f=e.schema.knownTags[o];if(f?.collection===a)e.schema.tags.push(Object.assign({},f,{default:!1})),l=f;else return f?r(i,"BAD_COLLECTION_TYPE",`${f.tag} used for ${a} collection, but expects ${f.collection??"scalar"}`,!0):r(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),Rs(n,e,t,r,o)}let c=Rs(n,e,t,r,o,l),p=l.resolve?.(c,f=>r(i,"TAG_RESOLVE_FAILED",f),e.options)??c,u=lf.isNode(p)?p:new cf.Scalar(p);return u.range=c.range,u.tag=o,l?.format&&(u.format=l.format),u}Oo.composeCollection=mf});var Ds=g(To=>{"use strict";var Bs=C();function gf(n,e,t){let s=e.offset,r=yf(e,n.options.strict,t);if(!r)return{value:"",type:null,comment:"",range:[s,s,s]};let i=r.mode===">"?Bs.Scalar.BLOCK_FOLDED:Bs.Scalar.BLOCK_LITERAL,o=e.source?bf(e.source):[],a=o.length;for(let d=o.length-1;d>=0;--d){let h=o[d][1];if(h===""||h==="\r")a=d;else break}if(a===0){let d=r.chomp==="+"&&o.length>0?`
|
|
71
|
+
`.repeat(Math.max(1,o.length-1)):"",h=s+r.length;return e.source&&(h+=e.source.length),{value:d,type:i,comment:r.comment,range:[s,h,h]}}let l=e.indent+r.indent,c=e.offset+r.length,p=0;for(let d=0;d<a;++d){let[h,w]=o[d];if(w===""||w==="\r")r.indent===0&&h.length>l&&(l=h.length);else{h.length<l&&t(c+h.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),r.indent===0&&(l=h.length),p=d,l===0&&!n.atRoot&&t(c,"BAD_INDENT","Block scalar values in collections must be indented");break}c+=h.length+w.length+1}for(let d=o.length-1;d>=a;--d)o[d][0].length>l&&(a=d+1);let u="",f="",m=!1;for(let d=0;d<p;++d)u+=o[d][0].slice(l)+`
|
|
72
|
+
`;for(let d=p;d<a;++d){let[h,w]=o[d];c+=h.length+w.length+1;let S=w[w.length-1]==="\r";if(S&&(w=w.slice(0,-1)),w&&h.length<l){let k=`Block scalar lines must not be less indented than their ${r.indent?"explicit indentation indicator":"first line"}`;t(c-w.length-(S?2:1),"BAD_INDENT",k),h=""}i===Bs.Scalar.BLOCK_LITERAL?(u+=f+h.slice(l)+w,f=`
|
|
73
|
+
`):h.length>l||w[0]===" "?(f===" "?f=`
|
|
74
74
|
`:!m&&f===`
|
|
75
75
|
`&&(f=`
|
|
76
76
|
|
|
77
|
-
`),u+=f+h.slice(l)+
|
|
78
|
-
`,m=!0):
|
|
77
|
+
`),u+=f+h.slice(l)+w,f=`
|
|
78
|
+
`,m=!0):w===""?f===`
|
|
79
79
|
`?u+=`
|
|
80
80
|
`:f=`
|
|
81
|
-
`:(u+=f+
|
|
81
|
+
`:(u+=f+w,f=" ",m=!1)}switch(r.chomp){case"-":break;case"+":for(let d=a;d<o.length;++d)u+=`
|
|
82
82
|
`+o[d][0].slice(l);u[u.length-1]!==`
|
|
83
83
|
`&&(u+=`
|
|
84
84
|
`);break;default:u+=`
|
|
85
|
-
`}let y=s+r.length+e.source.length;return{value:u,type:i,comment:r.comment,range:[s,y,y]}}function
|
|
85
|
+
`}let y=s+r.length+e.source.length;return{value:u,type:i,comment:r.comment,range:[s,y,y]}}function yf({offset:n,props:e},t,s){if(e[0].type!=="block-scalar-header")return s(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:r}=e[0],i=r[0],o=0,a="",l=-1;for(let f=1;f<r.length;++f){let m=r[f];if(!a&&(m==="-"||m==="+"))a=m;else{let y=Number(m);!o&&y?o=y:l===-1&&(l=n+f)}}l!==-1&&s(l,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${r}`);let c=!1,p="",u=r.length;for(let f=1;f<e.length;++f){let m=e[f];switch(m.type){case"space":c=!0;case"newline":u+=m.source.length;break;case"comment":t&&!c&&s(m,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),u+=m.source.length,p=m.source.substring(1);break;case"error":s(m,"UNEXPECTED_TOKEN",m.message),u+=m.source.length;break;default:{let y=`Unexpected token in block scalar header: ${m.type}`;s(m,"UNEXPECTED_TOKEN",y);let d=m.source;d&&typeof d=="string"&&(u+=d.length)}}}return{mode:i,indent:o,chomp:a,comment:p,length:u}}function bf(n){let e=n.split(/\n( *)/),t=e[0],s=t.match(/^( *)/),i=[s?.[1]?[s[1],t.slice(s[1].length)]:["",t]];for(let o=1;o<e.length;o+=2)i.push([e[o],e[o+1]]);return i}To.resolveBlockScalar=gf});var js=g(Lo=>{"use strict";var Fs=C(),wf=Ee();function Sf(n,e,t){let{offset:s,type:r,source:i,end:o}=n,a,l,c=(f,m,y)=>t(s+f,m,y);switch(r){case"scalar":a=Fs.Scalar.PLAIN,l=vf(i,c);break;case"single-quoted-scalar":a=Fs.Scalar.QUOTE_SINGLE,l=kf(i,c);break;case"double-quoted-scalar":a=Fs.Scalar.QUOTE_DOUBLE,l=Af(i,c);break;default:return t(n,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${r}`),{value:"",type:null,comment:"",range:[s,s+i.length,s+i.length]}}let p=s+i.length,u=wf.resolveEnd(o,p,e,t);return{value:l,type:a,comment:u.comment,range:[s,p,u.offset]}}function vf(n,e){let t="";switch(n[0]){case" ":t="a tab character";break;case",":t="flow indicator character ,";break;case"%":t="directive indicator character %";break;case"|":case">":{t=`block scalar indicator ${n[0]}`;break}case"@":case"`":{t=`reserved character ${n[0]}`;break}}return t&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${t}`),Co(n)}function kf(n,e){return(n[n.length-1]!=="'"||n.length===1)&&e(n.length,"MISSING_CHAR","Missing closing 'quote"),Co(n.slice(1,-1)).replace(/''/g,"'")}function Co(n){let e,t;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
86
86
|
`,"sy"),t=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
87
87
|
`,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,t=/[ \t]*(.*?)[ \t]*\r?\n/sy}let s=e.exec(n);if(!s)return n;let r=s[1],i=" ",o=e.lastIndex;for(t.lastIndex=o;s=t.exec(n);)s[1]===""?i===`
|
|
88
88
|
`?r+=i:i=`
|
|
89
|
-
`:(r+=i+s[1],i=" "),o=t.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=o,s=a.exec(n),r+i+(s?.[1]??"")}function
|
|
89
|
+
`:(r+=i+s[1],i=" "),o=t.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=o,s=a.exec(n),r+i+(s?.[1]??"")}function Af(n,e){let t="";for(let s=1;s<n.length-1;++s){let r=n[s];if(!(r==="\r"&&n[s+1]===`
|
|
90
90
|
`))if(r===`
|
|
91
|
-
`){let{fold:i,offset:o}=
|
|
91
|
+
`){let{fold:i,offset:o}=Nf(n,s);t+=i,s=o}else if(r==="\\"){let i=n[++s],o=Of[i];if(o)t+=o;else if(i===`
|
|
92
92
|
`)for(i=n[s+1];i===" "||i===" ";)i=n[++s+1];else if(i==="\r"&&n[s+1]===`
|
|
93
|
-
`)for(i=n[++s+1];i===" "||i===" ";)i=n[++s+1];else if(i==="x"||i==="u"||i==="U"){let a={x:2,u:4,U:8}[i];t+=
|
|
93
|
+
`)for(i=n[++s+1];i===" "||i===" ";)i=n[++s+1];else if(i==="x"||i==="u"||i==="U"){let a={x:2,u:4,U:8}[i];t+=Ef(n,s+1,a,e),s+=a}else{let a=n.substr(s-1,2);e(s-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),t+=a}}else if(r===" "||r===" "){let i=s,o=n[s+1];for(;o===" "||o===" ";)o=n[++s+1];o!==`
|
|
94
94
|
`&&!(o==="\r"&&n[s+2]===`
|
|
95
|
-
`)&&(t+=s>i?n.slice(i,s+1):r)}else t+=r}return(n[n.length-1]!=='"'||n.length===1)&&e(n.length,"MISSING_CHAR",'Missing closing "quote'),t}function
|
|
95
|
+
`)&&(t+=s>i?n.slice(i,s+1):r)}else t+=r}return(n[n.length-1]!=='"'||n.length===1)&&e(n.length,"MISSING_CHAR",'Missing closing "quote'),t}function Nf(n,e){let t="",s=n[e+1];for(;(s===" "||s===" "||s===`
|
|
96
96
|
`||s==="\r")&&!(s==="\r"&&n[e+2]!==`
|
|
97
97
|
`);)s===`
|
|
98
98
|
`&&(t+=`
|
|
99
|
-
`),e+=1,s=n[e+1];return t||(t=" "),{fold:t,offset:e}}var
|
|
100
|
-
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function
|
|
99
|
+
`),e+=1,s=n[e+1];return t||(t=" "),{fold:t,offset:e}}var Of={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
|
100
|
+
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Ef(n,e,t,s){let r=n.substr(e,t),o=r.length===t&&/^[0-9a-fA-F]+$/.test(r)?parseInt(r,16):NaN;if(isNaN(o)){let a=n.substr(e-2,t+2);return s(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}return String.fromCodePoint(o)}Lo.resolveFlowScalar=Sf});var xo=g(Io=>{"use strict";var de=O(),Po=C(),Tf=Ds(),Cf=js();function Lf(n,e,t,s){let{value:r,type:i,comment:o,range:a}=e.type==="block-scalar"?Tf.resolveBlockScalar(n,e,s):Cf.resolveFlowScalar(e,n.options.strict,s),l=t?n.directives.tagName(t.source,u=>s(t,"TAG_RESOLVE_FAILED",u)):null,c;n.options.stringKeys&&n.atKey?c=n.schema[de.SCALAR]:l?c=Pf(n.schema,r,l,t,s):e.type==="scalar"?c=If(n,r,e,s):c=n.schema[de.SCALAR];let p;try{let u=c.resolve(r,f=>s(t??e,"TAG_RESOLVE_FAILED",f),n.options);p=de.isScalar(u)?u:new Po.Scalar(u)}catch(u){let f=u instanceof Error?u.message:String(u);s(t??e,"TAG_RESOLVE_FAILED",f),p=new Po.Scalar(r)}return p.range=a,p.source=r,i&&(p.type=i),l&&(p.tag=l),c.format&&(p.format=c.format),o&&(p.comment=o),p}function Pf(n,e,t,s,r){if(t==="!")return n[de.SCALAR];let i=[];for(let a of n.tags)if(!a.collection&&a.tag===t)if(a.default&&a.test)i.push(a);else return a;for(let a of i)if(a.test?.test(e))return a;let o=n.knownTags[t];return o&&!o.collection?(n.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(r(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${t}`,t!=="tag:yaml.org,2002:str"),n[de.SCALAR])}function If({atKey:n,directives:e,schema:t},s,r,i){let o=t.tags.find(a=>(a.default===!0||n&&a.default==="key")&&a.test?.test(s))||t[de.SCALAR];if(t.compat){let a=t.compat.find(l=>l.default&&l.test?.test(s))??t[de.SCALAR];if(o.tag!==a.tag){let l=e.tagString(o.tag),c=e.tagString(a.tag),p=`Value may be parsed as either ${l} or ${c}`;i(r,"TAG_RESOLVE_FAILED",p,!0)}}return o}Io.composeScalar=Lf});var qo=g($o=>{"use strict";function xf(n,e,t){if(e){t??(t=e.length);for(let s=t-1;s>=0;--s){let r=e[s];switch(r.type){case"space":case"comment":case"newline":n-=r.source.length;continue}for(r=e[++s];r?.type==="space";)n+=r.source.length,r=e[++s];break}}return n}$o.emptyScalarPosition=xf});var Ro=g(Ks=>{"use strict";var $f=qe(),qf=O(),_f=Eo(),_o=xo(),Mf=Ee(),Rf=qo(),Bf={composeNode:Mo,composeEmptyNode:Us};function Mo(n,e,t,s){let r=n.atKey,{spaceBefore:i,comment:o,anchor:a,tag:l}=t,c,p=!0;switch(e.type){case"alias":c=Df(n,e,s),(a||l)&&s(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":c=_o.composeScalar(n,e,l,s),a&&(c.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":c=_f.composeCollection(Bf,n,e,t,s),a&&(c.anchor=a.source.substring(1));break;default:{let u=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;s(e,"UNEXPECTED_TOKEN",u),c=Us(n,e.offset,void 0,null,t,s),p=!1}}return a&&c.anchor===""&&s(a,"BAD_ALIAS","Anchor cannot be an empty string"),r&&n.options.stringKeys&&(!qf.isScalar(c)||typeof c.value!="string"||c.tag&&c.tag!=="tag:yaml.org,2002:str")&&s(l??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),i&&(c.spaceBefore=!0),o&&(e.type==="scalar"&&e.source===""?c.comment=o:c.commentBefore=o),n.options.keepSourceTokens&&p&&(c.srcToken=e),c}function Us(n,e,t,s,{spaceBefore:r,comment:i,anchor:o,tag:a,end:l},c){let p={type:"scalar",offset:Rf.emptyScalarPosition(e,t,s),indent:-1,source:""},u=_o.composeScalar(n,p,a,c);return o&&(u.anchor=o.source.substring(1),u.anchor===""&&c(o,"BAD_ALIAS","Anchor cannot be an empty string")),r&&(u.spaceBefore=!0),i&&(u.comment=i,u.range[2]=l),u}function Df({options:n},{offset:e,source:t,end:s},r){let i=new $f.Alias(t.substring(1));i.source===""&&r(e,"BAD_ALIAS","Alias cannot be an empty string"),i.source.endsWith(":")&&r(e+t.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=e+t.length,a=Mf.resolveEnd(s,o,n.strict,r);return i.range=[e,o,a.offset],a.comment&&(i.comment=a.comment),i}Ks.composeEmptyNode=Us;Ks.composeNode=Mo});var Fo=g(Do=>{"use strict";var Ff=ze(),Bo=Ro(),jf=Ee(),Uf=tt();function Kf(n,e,{offset:t,start:s,value:r,end:i},o){let a=Object.assign({_directives:e},n),l=new Ff.Document(void 0,a),c={atKey:!1,atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},p=Uf.resolveProps(s,{indicator:"doc-start",next:r??i?.[0],offset:t,onError:o,parentIndent:0,startOnNewline:!0});p.found&&(l.directives.docStart=!0,r&&(r.type==="block-map"||r.type==="block-seq")&&!p.hasNewline&&o(p.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),l.contents=r?Bo.composeNode(c,r,p,o):Bo.composeEmptyNode(c,p.end,s,null,p,o);let u=l.contents.range[2],f=jf.resolveEnd(i,u,!1,o);return f.comment&&(l.comment=f.comment),l.range=[t,u,f.offset],l}Do.composeDoc=Kf});var Ys=g(Ko=>{"use strict";var Jf=ut("process"),Yf=Pn(),Vf=ze(),nt=et(),jo=O(),Wf=Fo(),Gf=Ee();function st(n){if(typeof n=="number")return[n,n+1];if(Array.isArray(n))return n.length===2?n:[n[0],n[1]];let{offset:e,source:t}=n;return[e,e+(typeof t=="string"?t.length:1)]}function Uo(n){let e="",t=!1,s=!1;for(let r=0;r<n.length;++r){let i=n[r];switch(i[0]){case"#":e+=(e===""?"":s?`
|
|
101
101
|
|
|
102
102
|
`:`
|
|
103
|
-
`)+(i.substring(1)||" "),t=!0,s=!1;break;case"%":n[r+1]?.[0]!=="#"&&(r+=1),t=!1;break;default:t||(s=!0),t=!1}}return{comment:e,afterEmptyLine:s}}var
|
|
104
|
-
${s}`:s;else if(r||e.directives.docStart||!i)e.commentBefore=s;else if(
|
|
103
|
+
`)+(i.substring(1)||" "),t=!0,s=!1;break;case"%":n[r+1]?.[0]!=="#"&&(r+=1),t=!1;break;default:t||(s=!0),t=!1}}return{comment:e,afterEmptyLine:s}}var Js=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(t,s,r,i)=>{let o=st(t);i?this.warnings.push(new nt.YAMLWarning(o,s,r)):this.errors.push(new nt.YAMLParseError(o,s,r))},this.directives=new Yf.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,t){let{comment:s,afterEmptyLine:r}=Uo(this.prelude);if(s){let i=e.contents;if(t)e.comment=e.comment?`${e.comment}
|
|
104
|
+
${s}`:s;else if(r||e.directives.docStart||!i)e.commentBefore=s;else if(jo.isCollection(i)&&!i.flow&&i.items.length>0){let o=i.items[0];jo.isPair(o)&&(o=o.key);let a=o.commentBefore;o.commentBefore=a?`${s}
|
|
105
105
|
${a}`:s}else{let o=i.commentBefore;i.commentBefore=o?`${s}
|
|
106
|
-
${o}`:s}}t?(Array.prototype.push.apply(e.errors,this.errors),Array.prototype.push.apply(e.warnings,this.warnings)):(e.errors=this.errors,e.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:
|
|
107
|
-
${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new
|
|
106
|
+
${o}`:s}}t?(Array.prototype.push.apply(e.errors,this.errors),Array.prototype.push.apply(e.warnings,this.warnings)):(e.errors=this.errors,e.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Uo(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,s=-1){for(let r of e)yield*this.next(r);yield*this.end(t,s)}*next(e){switch(Jf.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(t,s,r)=>{let i=st(e);i[0]+=t,this.onError(i,"BAD_DIRECTIVE",s,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let t=Wf.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,s=new nt.YAMLParseError(st(e),"UNEXPECTED_TOKEN",t);this.atDirectives||!this.doc?this.errors.push(s):this.doc.errors.push(s);break}case"doc-end":{if(!this.doc){let s="Unexpected doc-end without preceding document";this.errors.push(new nt.YAMLParseError(st(e),"UNEXPECTED_TOKEN",s));break}this.doc.directives.docEnd=!0;let t=Gf.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let s=this.doc.comment;this.doc.comment=s?`${s}
|
|
107
|
+
${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new nt.YAMLParseError(st(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let s=Object.assign({_directives:this.directives},this.options),r=new Vf.Document(void 0,s);this.atDirectives&&this.onError(t,"MISSING_CHAR","Missing directives-end indicator line"),r.range=[0,t,t],this.decorate(r,!1),yield r}}};Ko.Composer=Js});var Vo=g(tn=>{"use strict";var Hf=Ds(),Qf=js(),zf=et(),Jo=De();function Xf(n,e=!0,t){if(n){let s=(r,i,o)=>{let a=typeof r=="number"?r:Array.isArray(r)?r[0]:r.offset;if(t)t(a,i,o);else throw new zf.YAMLParseError([a,a+1],i,o)};switch(n.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Qf.resolveFlowScalar(n,e,s);case"block-scalar":return Hf.resolveBlockScalar({options:{strict:e}},n,s)}}return null}function Zf(n,e){let{implicitKey:t=!1,indent:s,inFlow:r=!1,offset:i=-1,type:o="PLAIN"}=e,a=Jo.stringifyString({type:o,value:n},{implicitKey:t,indent:s>0?" ".repeat(s):"",inFlow:r,options:{blockQuote:!0,lineWidth:-1}}),l=e.end??[{type:"newline",offset:-1,indent:s,source:`
|
|
108
108
|
`}];switch(a[0]){case"|":case">":{let c=a.indexOf(`
|
|
109
109
|
`),p=a.substring(0,c),u=a.substring(c+1)+`
|
|
110
|
-
`,f=[{type:"block-scalar-header",offset:i,indent:s,source:p}];return
|
|
111
|
-
`}),{type:"block-scalar",offset:i,indent:s,props:f,source:u}}case'"':return{type:"double-quoted-scalar",offset:i,indent:s,source:a,end:l};case"'":return{type:"single-quoted-scalar",offset:i,indent:s,source:a,end:l};default:return{type:"scalar",offset:i,indent:s,source:a,end:l}}}function
|
|
110
|
+
`,f=[{type:"block-scalar-header",offset:i,indent:s,source:p}];return Yo(f,l)||f.push({type:"newline",offset:-1,indent:s,source:`
|
|
111
|
+
`}),{type:"block-scalar",offset:i,indent:s,props:f,source:u}}case'"':return{type:"double-quoted-scalar",offset:i,indent:s,source:a,end:l};case"'":return{type:"single-quoted-scalar",offset:i,indent:s,source:a,end:l};default:return{type:"scalar",offset:i,indent:s,source:a,end:l}}}function ed(n,e,t={}){let{afterKey:s=!1,implicitKey:r=!1,inFlow:i=!1,type:o}=t,a="indent"in n?n.indent:null;if(s&&typeof a=="number"&&(a+=2),!o)switch(n.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let c=n.props[0];if(c.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=c.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}let l=Jo.stringifyString({type:o,value:e},{implicitKey:r||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}});switch(l[0]){case"|":case">":td(n,l);break;case'"':Vs(n,l,"double-quoted-scalar");break;case"'":Vs(n,l,"single-quoted-scalar");break;default:Vs(n,l,"scalar")}}function td(n,e){let t=e.indexOf(`
|
|
112
112
|
`),s=e.substring(0,t),r=e.substring(t+1)+`
|
|
113
|
-
`;if(n.type==="block-scalar"){let i=n.props[0];if(i.type!=="block-scalar-header")throw new Error("Invalid block scalar header");i.source=s,n.source=r}else{let{offset:i}=n,o="indent"in n?n.indent:-1,a=[{type:"block-scalar-header",offset:i,indent:o,source:s}];
|
|
114
|
-
`});for(let l of Object.keys(n))l!=="type"&&l!=="offset"&&delete n[l];Object.assign(n,{type:"block-scalar",indent:o,props:a,source:r})}}function
|
|
115
|
-
`};delete n.items,Object.assign(n,{type:t,source:e,end:[r]});break}default:{let s="indent"in n?n.indent:-1,r="end"in n&&Array.isArray(n.end)?n.end.filter(i=>i.type==="space"||i.type==="comment"||i.type==="newline"):[];for(let i of Object.keys(n))i!=="type"&&i!=="offset"&&delete n[i];Object.assign(n,{type:t,indent:s,source:e,end:r})}}}
|
|
113
|
+
`;if(n.type==="block-scalar"){let i=n.props[0];if(i.type!=="block-scalar-header")throw new Error("Invalid block scalar header");i.source=s,n.source=r}else{let{offset:i}=n,o="indent"in n?n.indent:-1,a=[{type:"block-scalar-header",offset:i,indent:o,source:s}];Yo(a,"end"in n?n.end:void 0)||a.push({type:"newline",offset:-1,indent:o,source:`
|
|
114
|
+
`});for(let l of Object.keys(n))l!=="type"&&l!=="offset"&&delete n[l];Object.assign(n,{type:"block-scalar",indent:o,props:a,source:r})}}function Yo(n,e){if(e)for(let t of e)switch(t.type){case"space":case"comment":n.push(t);break;case"newline":return n.push(t),!0}return!1}function Vs(n,e,t){switch(n.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":n.type=t,n.source=e;break;case"block-scalar":{let s=n.props.slice(1),r=e.length;n.props[0].type==="block-scalar-header"&&(r-=n.props[0].source.length);for(let i of s)i.offset+=r;delete n.props,Object.assign(n,{type:t,source:e,end:s});break}case"block-map":case"block-seq":{let r={type:"newline",offset:n.offset+e.length,indent:n.indent,source:`
|
|
115
|
+
`};delete n.items,Object.assign(n,{type:t,source:e,end:[r]});break}default:{let s="indent"in n?n.indent:-1,r="end"in n&&Array.isArray(n.end)?n.end.filter(i=>i.type==="space"||i.type==="comment"||i.type==="newline"):[];for(let i of Object.keys(n))i!=="type"&&i!=="offset"&&delete n[i];Object.assign(n,{type:t,indent:s,source:e,end:r})}}}tn.createScalarToken=Zf;tn.resolveAsScalar=Xf;tn.setScalarValue=ed});var Go=g(Wo=>{"use strict";var nd=n=>"type"in n?sn(n):nn(n);function sn(n){switch(n.type){case"block-scalar":{let e="";for(let t of n.props)e+=sn(t);return e+n.source}case"block-map":case"block-seq":{let e="";for(let t of n.items)e+=nn(t);return e}case"flow-collection":{let e=n.start.source;for(let t of n.items)e+=nn(t);for(let t of n.end)e+=t.source;return e}case"document":{let e=nn(n);if(n.end)for(let t of n.end)e+=t.source;return e}default:{let e=n.source;if("end"in n&&n.end)for(let t of n.end)e+=t.source;return e}}}function nn({start:n,key:e,sep:t,value:s}){let r="";for(let i of n)r+=i.source;if(e&&(r+=sn(e)),t)for(let i of t)r+=i.source;return s&&(r+=sn(s)),r}Wo.stringify=nd});var Xo=g(zo=>{"use strict";var Ws=Symbol("break visit"),sd=Symbol("skip children"),Ho=Symbol("remove item");function pe(n,e){"type"in n&&n.type==="document"&&(n={start:n.start,value:n.value}),Qo(Object.freeze([]),n,e)}pe.BREAK=Ws;pe.SKIP=sd;pe.REMOVE=Ho;pe.itemAtPath=(n,e)=>{let t=n;for(let[s,r]of e){let i=t?.[s];if(i&&"items"in i)t=i.items[r];else return}return t};pe.parentCollection=(n,e)=>{let t=pe.itemAtPath(n,e.slice(0,-1)),s=e[e.length-1][0],r=t?.[s];if(r&&"items"in r)return r;throw new Error("Parent collection not found")};function Qo(n,e,t){let s=t(e,n);if(typeof s=="symbol")return s;for(let r of["key","value"]){let i=e[r];if(i&&"items"in i){for(let o=0;o<i.items.length;++o){let a=Qo(Object.freeze(n.concat([[r,o]])),i.items[o],t);if(typeof a=="number")o=a-1;else{if(a===Ws)return Ws;a===Ho&&(i.items.splice(o,1),o-=1)}}typeof s=="function"&&r==="key"&&(s=s(e,n))}}return typeof s=="function"?s(e,n):s}zo.visit=pe});var rn=g(q=>{"use strict";var Gs=Vo(),rd=Go(),id=Xo(),Hs="\uFEFF",Qs="",zs="",Xs="",od=n=>!!n&&"items"in n,ad=n=>!!n&&(n.type==="scalar"||n.type==="single-quoted-scalar"||n.type==="double-quoted-scalar"||n.type==="block-scalar");function ld(n){switch(n){case Hs:return"<BOM>";case Qs:return"<DOC>";case zs:return"<FLOW_END>";case Xs:return"<SCALAR>";default:return JSON.stringify(n)}}function cd(n){switch(n){case Hs:return"byte-order-mark";case Qs:return"doc-mode";case zs:return"flow-error-end";case Xs:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
|
116
116
|
`:case`\r
|
|
117
|
-
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(n[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}
|
|
118
|
-
`:case"\r":case" ":return!0;default:return!1}}var
|
|
119
|
-
\r `),
|
|
117
|
+
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(n[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}q.createScalarToken=Gs.createScalarToken;q.resolveAsScalar=Gs.resolveAsScalar;q.setScalarValue=Gs.setScalarValue;q.stringify=rd.stringify;q.visit=id.visit;q.BOM=Hs;q.DOCUMENT=Qs;q.FLOW_END=zs;q.SCALAR=Xs;q.isCollection=od;q.isScalar=ad;q.prettyToken=ld;q.tokenType=cd});var tr=g(ea=>{"use strict";var rt=rn();function B(n){switch(n){case void 0:case" ":case`
|
|
118
|
+
`:case"\r":case" ":return!0;default:return!1}}var Zo=new Set("0123456789ABCDEFabcdef"),ud=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),on=new Set(",[]{}"),fd=new Set(` ,[]{}
|
|
119
|
+
\r `),Zs=n=>!n||fd.has(n),er=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let s=this.next??"stream";for(;s&&(t||this.hasChars(1));)s=yield*this.parseNext(s)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===" "||t===" ";)t=this.buffer[++e];return!t||t==="#"||t===`
|
|
120
120
|
`?!0:t==="\r"?this.buffer[e+1]===`
|
|
121
121
|
`:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let s=0;for(;t===" ";)t=this.buffer[++s+e];if(t==="\r"){let r=this.buffer[s+e+1];if(r===`
|
|
122
122
|
`||!r&&!this.atEnd)return e+s+1}return t===`
|
|
123
123
|
`||s>=this.indentNext||!t&&!this.atEnd?e+s:-1}if(t==="-"||t==="."){let s=this.buffer.substr(e,3);if((s==="---"||s==="...")&&B(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
|
|
124
|
-
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===
|
|
124
|
+
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===rt.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let t=e.length,s=e.indexOf("#");for(;s!==-1;){let i=e[s-1];if(i===" "||i===" "){t=s-1;break}else s=e.indexOf("#",s+1)}for(;;){let i=e[t-1];if(i===" "||i===" ")t-=1;else break}let r=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-r),this.pushNewline(),"stream"}if(this.atLineEnd()){let t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),"stream"}return yield rt.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let t=this.peek(3);if((t==="---"||t==="...")&&B(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,t==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!B(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&B(t)){let s=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=s,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let t=yield*this.pushIndicators();switch(e[t]){case"#":yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(Zs),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,s=-1;do e=yield*this.pushNewline(),e>0?(t=yield*this.pushSpaces(!1),this.indentValue=s=t):t=0,t+=yield*this.pushSpaces(!0);while(e+t>0);let r=this.getLine();if(r===null)return this.setNext("flow");if((s!==-1&&s<this.indentNext&&r[0]!=="#"||s===0&&(r.startsWith("---")||r.startsWith("..."))&&B(r[3]))&&!(s===this.indentNext-1&&this.flowLevel===1&&(r[0]==="]"||r[0]==="}")))return this.flowLevel=0,yield rt.FLOW_END,yield*this.parseLineStart();let i=0;for(;r[i]===",";)i+=yield*this.pushCount(1),i+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(i+=yield*this.pushIndicators(),r[i]){case void 0:return"flow";case"#":return yield*this.pushCount(r.length-i),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(Zs),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||B(o)||o===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),t=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;t!==-1&&this.buffer[t+1]==="'";)t=this.buffer.indexOf("'",t+2);else for(;t!==-1;){let i=0;for(;this.buffer[t-1-i]==="\\";)i+=1;if(i%2===0)break;t=this.buffer.indexOf('"',t+1)}let s=this.buffer.substring(0,t),r=s.indexOf(`
|
|
125
125
|
`,this.pos);if(r!==-1){for(;r!==-1;){let i=this.continueScalar(r+1);if(i===-1)break;r=s.indexOf(`
|
|
126
126
|
`,i)}r!==-1&&(t=r-(s[r-1]==="\r"?2:1))}if(t===-1){if(!this.atEnd)return this.setNext("quoted-scalar");t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let t=this.buffer[++e];if(t==="+")this.blockScalarKeep=!0;else if(t>"0"&&t<="9")this.blockScalarIndent=Number(t)-1;else if(t!=="-")break}return yield*this.pushUntil(t=>B(t)||t==="#")}*parseBlockScalar(){let e=this.pos-1,t=0,s;e:for(let i=this.pos;s=this.buffer[i];++i)switch(s){case" ":t+=1;break;case`
|
|
127
127
|
`:e=i,t=0;break;case"\r":{let o=this.buffer[i+1];if(!o&&!this.atEnd)return this.setNext("block-scalar");if(o===`
|
|
128
128
|
`)break}default:break e}if(!s&&!this.atEnd)return this.setNext("block-scalar");if(t>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=t:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let i=this.continueScalar(e+1);if(i===-1)break;e=this.buffer.indexOf(`
|
|
129
129
|
`,i)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let r=e+1;for(s=this.buffer[r];s===" ";)s=this.buffer[++r];if(s===" "){for(;s===" "||s===" "||s==="\r"||s===`
|
|
130
130
|
`;)s=this.buffer[++r];e=r-1}else if(!this.blockScalarKeep)do{let i=e-1,o=this.buffer[i];o==="\r"&&(o=this.buffer[--i]);let a=i;for(;o===" ";)o=this.buffer[--i];if(o===`
|
|
131
|
-
`&&i>=this.pos&&i+1+t>a)e=i;else break}while(!0);return yield
|
|
131
|
+
`&&i>=this.pos&&i+1+t>a)e=i;else break}while(!0);return yield rt.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,s=this.pos-1,r;for(;r=this.buffer[++s];)if(r===":"){let i=this.buffer[s+1];if(B(i)||e&&on.has(i))break;t=s}else if(B(r)){let i=this.buffer[s+1];if(r==="\r"&&(i===`
|
|
132
132
|
`?(s+=1,r=`
|
|
133
|
-
`,i=this.buffer[s+1]):t=s),i==="#"||e&&
|
|
134
|
-
`){let o=this.continueScalar(s+1);if(o===-1)break;s=Math.max(s,o-2)}}else{if(e&&
|
|
133
|
+
`,i=this.buffer[s+1]):t=s),i==="#"||e&&on.has(i))break;if(r===`
|
|
134
|
+
`){let o=this.continueScalar(s+1);if(o===-1)break;s=Math.max(s,o-2)}}else{if(e&&on.has(r))break;t=s}return!r&&!this.atEnd?this.setNext("plain-scalar"):(yield rt.SCALAR,yield*this.pushToIndex(t+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){let s=this.buffer.slice(this.pos,e);return s?(yield s,this.pos+=s.length,s.length):(t&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(Zs))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let e=this.flowLevel>0,t=this.charAt(1);if(B(t)||e&&on.has(t))return e?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}return 0}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,t=this.buffer[e];for(;!B(t)&&t!==">";)t=this.buffer[++e];return yield*this.pushToIndex(t===">"?e+1:e,!1)}else{let e=this.pos+1,t=this.buffer[e];for(;t;)if(ud.has(t))t=this.buffer[++e];else if(t==="%"&&Zo.has(this.buffer[e+1])&&Zo.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
|
|
135
135
|
`?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
|
|
136
|
-
`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,s;do s=this.buffer[++t];while(s===" "||e&&s===" ");let r=t-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=t),r}*pushUntil(e){let t=this.pos,s=this.buffer[t];for(;!e(s);)s=this.buffer[++t];return yield*this.pushToIndex(t,!1)}};
|
|
136
|
+
`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,s;do s=this.buffer[++t];while(s===" "||e&&s===" ");let r=t-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=t),r}*pushUntil(e){let t=this.pos,s=this.buffer[t];for(;!e(s);)s=this.buffer[++t];return yield*this.pushToIndex(t,!1)}};ea.Lexer=er});var sr=g(ta=>{"use strict";var nr=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,s=this.lineStarts.length;for(;t<s;){let i=t+s>>1;this.lineStarts[i]<e?t=i+1:s=i}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};let r=this.lineStarts[t-1];return{line:t,col:e-r+1}}}};ta.LineCounter=nr});var ir=g(oa=>{"use strict";var dd=ut("process"),na=rn(),pd=tr();function oe(n,e){for(let t=0;t<n.length;++t)if(n[t].type===e)return!0;return!1}function sa(n){for(let e=0;e<n.length;++e)switch(n[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function ia(n){switch(n?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function an(n){switch(n.type){case"document":return n.start;case"block-map":{let e=n.items[n.items.length-1];return e.sep??e.start}case"block-seq":return n.items[n.items.length-1].start;default:return[]}}function Te(n){if(n.length===0)return[];let e=n.length;e:for(;--e>=0;)switch(n[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;n[++e]?.type==="space";);return n.splice(e,n.length)}function ra(n){if(n.start.type==="flow-seq-start")for(let e of n.items)e.sep&&!e.value&&!oe(e.start,"explicit-key-ind")&&!oe(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,ia(e.value)?e.value.end?Array.prototype.push.apply(e.value.end,e.sep):e.value.end=e.sep:Array.prototype.push.apply(e.start,e.sep),delete e.sep)}var rr=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new pd.Lexer,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let s of this.lexer.lex(e,t))yield*this.next(s);t||(yield*this.end())}*next(e){if(this.source=e,dd.env.LOG_TOKENS&&console.log("|",na.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=na.tokenType(e);if(t)if(t==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=t,yield*this.step(),t){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let s=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:s,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let t=e??this.stack.pop();if(!t)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield t;else{let s=this.peek(1);switch(t.type==="block-scalar"?t.indent="indent"in s?s.indent:0:t.type==="flow-collection"&&s.type==="document"&&(t.indent=0),t.type==="flow-collection"&&ra(t),s.type){case"document":s.value=t;break;case"block-scalar":s.props.push(t);break;case"block-map":{let r=s.items[s.items.length-1];if(r.value){s.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}else if(r.sep)r.value=t;else{Object.assign(r,{key:t,sep:[]}),this.onKeyLine=!r.explicitKey;return}break}case"block-seq":{let r=s.items[s.items.length-1];r.value?s.items.push({start:[],value:t}):r.value=t;break}case"flow-collection":{let r=s.items[s.items.length-1];!r||r.value?s.items.push({start:[],key:t,sep:[]}):r.sep?r.value=t:Object.assign(r,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((s.type==="document"||s.type==="block-map"||s.type==="block-seq")&&(t.type==="block-map"||t.type==="block-seq")){let r=t.items[t.items.length-1];r&&!r.sep&&!r.value&&r.start.length>0&&sa(r.start)===-1&&(t.indent===0||r.start.every(i=>i.type!=="comment"||i.indent<t.indent))&&(s.type==="document"?s.end=r.start:s.items.push({start:r.start}),t.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{sa(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let t=this.startBlockValue(e);t?this.stack.push(t):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){let t=an(this.peek(2)),s=Te(t),r;e.end?(r=e.end,r.push(this.sourceToken),delete e.end):r=[this.sourceToken];let i={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:s,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let t=this.source.indexOf(`
|
|
137
137
|
`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
|
|
138
|
-
`,t)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,t.value){let s="end"in t.value?t.value.end:void 0;(Array.isArray(s)?s[s.length-1]:void 0)?.type==="comment"?s?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let r=e.items[e.items.length-2]?.value?.end;if(Array.isArray(r)){Array.prototype.push.apply(r,t.start),r.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let s=!this.onKeyLine&&this.indent===e.indent,r=s&&(t.sep||t.explicitKey)&&this.type!=="seq-item-ind",i=[];if(r&&t.sep&&!t.value){let o=[];for(let a=0;a<t.sep.length;++a){let l=t.sep[a];switch(l.type){case"newline":o.push(a);break;case"space":break;case"comment":l.indent>e.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(i=t.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":r||t.value?(i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"explicit-key-ind":!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):r||t.value?(i.push(this.sourceToken),e.items.push({start:i,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(t.explicitKey)if(t.sep)if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(
|
|
138
|
+
`,t)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,t.value){let s="end"in t.value?t.value.end:void 0;(Array.isArray(s)?s[s.length-1]:void 0)?.type==="comment"?s?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let r=e.items[e.items.length-2]?.value?.end;if(Array.isArray(r)){Array.prototype.push.apply(r,t.start),r.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let s=!this.onKeyLine&&this.indent===e.indent,r=s&&(t.sep||t.explicitKey)&&this.type!=="seq-item-ind",i=[];if(r&&t.sep&&!t.value){let o=[];for(let a=0;a<t.sep.length;++a){let l=t.sep[a];switch(l.type){case"newline":o.push(a);break;case"space":break;case"comment":l.indent>e.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(i=t.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":r||t.value?(i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"explicit-key-ind":!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):r||t.value?(i.push(this.sourceToken),e.items.push({start:i,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(t.explicitKey)if(t.sep)if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(oe(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if(ia(t.key)&&!oe(t.sep,"newline")){let o=Te(t.start),a=t.key,l=t.sep;l.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:a,sep:l}]})}else i.length>0?t.sep=t.sep.concat(i,this.sourceToken):t.sep.push(this.sourceToken);else if(oe(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let o=Te(t.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else t.sep?t.value||r?e.items.push({start:i,key:null,sep:[this.sourceToken]}):oe(t.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);r||t.value?(e.items.push({start:i,key:o,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(o):(Object.assign(t,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(e);if(o){if(o.type==="block-seq"){if(!t.explicitKey&&t.sep&&!oe(t.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else s&&e.items.push({start:i});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(t.value){let s="end"in t.value?t.value.end:void 0;(Array.isArray(s)?s[s.length-1]:void 0)?.type==="comment"?s?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let r=e.items[e.items.length-2]?.value?.end;if(Array.isArray(r)){Array.prototype.push.apply(r,t.start),r.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case"anchor":case"tag":if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;t.value||oe(t.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let s=this.startBlockValue(e);if(s){this.stack.push(s);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type==="flow-error-end"){let s;do yield*this.pop(),s=this.peek(1);while(s?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case"map-value-ind":!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let r=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:r,sep:[]}):t.sep?this.stack.push(r):Object.assign(t,{key:r,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let s=this.startBlockValue(e);s?this.stack.push(s):(yield*this.pop(),yield*this.step())}else{let s=this.peek(2);if(s.type==="block-map"&&(this.type==="map-value-ind"&&s.indent===e.indent||this.type==="newline"&&!s.items[s.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&s.type!=="flow-collection"){let r=an(s),i=Te(r);ra(e);let o=e.end.splice(1,e.end.length);o.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:i,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let t=this.source.indexOf(`
|
|
139
139
|
`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
|
|
140
|
-
`,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let t=
|
|
141
|
-
`),t=0;if(e[t]?.trim()!=="---")return null;t++;let s=[];for(;t<e.length&&e[t]?.trim()!=="---";)s.push(e[t]),t++;if(e[t]?.trim()!=="---")return null;t++;let r=
|
|
142
|
-
`)),a=t}else t++}return{frontmatter:r,files:i,warnings:o,bodyEndLine:a}}catch{return null}}function
|
|
140
|
+
`,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let t=an(e),s=Te(t);return s.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let t=an(e),s=Te(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!=="comment"||this.indent<=t?!1:e.every(s=>s.type==="newline"||s.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};oa.Parser=rr});var fa=g(ot=>{"use strict";var aa=Ys(),hd=ze(),it=et(),md=Kn(),gd=O(),yd=sr(),la=ir();function ca(n){let e=n.prettyErrors!==!1;return{lineCounter:n.lineCounter||e&&new yd.LineCounter||null,prettyErrors:e}}function bd(n,e={}){let{lineCounter:t,prettyErrors:s}=ca(e),r=new la.Parser(t?.addNewLine),i=new aa.Composer(e),o=Array.from(i.compose(r.parse(n)));if(s&&t)for(let a of o)a.errors.forEach(it.prettifyError(n,t)),a.warnings.forEach(it.prettifyError(n,t));return o.length>0?o:Object.assign([],{empty:!0},i.streamInfo())}function ua(n,e={}){let{lineCounter:t,prettyErrors:s}=ca(e),r=new la.Parser(t?.addNewLine),i=new aa.Composer(e),o=null;for(let a of i.compose(r.parse(n),!0,n.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new it.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return s&&t&&(o.errors.forEach(it.prettifyError(n,t)),o.warnings.forEach(it.prettifyError(n,t))),o}function wd(n,e,t){let s;typeof e=="function"?s=e:t===void 0&&e&&typeof e=="object"&&(t=e);let r=ua(n,t);if(!r)return null;if(r.warnings.forEach(i=>md.warn(r.options.logLevel,i)),r.errors.length>0){if(r.options.logLevel!=="silent")throw r.errors[0];r.errors=[]}return r.toJS(Object.assign({reviver:s},t))}function Sd(n,e,t){let s=null;if(typeof e=="function"||Array.isArray(e)?s=e:t===void 0&&e&&(t=e),typeof t=="string"&&(t=t.length),typeof t=="number"){let r=Math.round(t);t=r<1?void 0:r>8?{indent:8}:{indent:r}}if(n===void 0){let{keepUndefined:r}=t??e??{};if(!r)return}return gd.isDocument(n)&&!s?n.toString(t):new hd.Document(n,s,t).toString(t)}ot.parse=wd;ot.parseAllDocuments=bd;ot.parseDocument=ua;ot.stringify=Sd});var pa=g(E=>{"use strict";var vd=Ys(),kd=ze(),Ad=Os(),or=et(),Nd=qe(),ae=O(),Od=ne(),Ed=C(),Td=re(),Cd=ie(),Ld=rn(),Pd=tr(),Id=sr(),xd=ir(),ln=fa(),da=Pe();E.Composer=vd.Composer;E.Document=kd.Document;E.Schema=Ad.Schema;E.YAMLError=or.YAMLError;E.YAMLParseError=or.YAMLParseError;E.YAMLWarning=or.YAMLWarning;E.Alias=Nd.Alias;E.isAlias=ae.isAlias;E.isCollection=ae.isCollection;E.isDocument=ae.isDocument;E.isMap=ae.isMap;E.isNode=ae.isNode;E.isPair=ae.isPair;E.isScalar=ae.isScalar;E.isSeq=ae.isSeq;E.Pair=Od.Pair;E.Scalar=Ed.Scalar;E.YAMLMap=Td.YAMLMap;E.YAMLSeq=Cd.YAMLSeq;E.CST=Ld;E.Lexer=Pd.Lexer;E.LineCounter=Id.LineCounter;E.Parser=xd.Parser;E.parse=ln.parse;E.parseAllDocuments=ln.parseAllDocuments;E.parseDocument=ln.parseDocument;E.stringify=ln.stringify;E.visit=da.visit;E.visitAsync=da.visitAsync});import{spawn as hr}from"child_process";import{readdir as Ma,readFile as Ra,writeFile as Dp,unlink as Sn,mkdir as Fp}from"fs/promises";import{mkdirSync as Up,writeFileSync as Kp,appendFileSync as Jp,readFileSync as Ba}from"fs";import*as _ from"path";import{fileURLToPath as Da}from"url";import{realpathSync as $a}from"fs";import{join as wn,resolve as qa}from"path";import{homedir as _a}from"os";function ft(){let n=process.env.TYPEBULB_SERVERS_DIR;return n?wn(n,".."):wn(_a(),".typebulb")}function ge(){return process.env.TYPEBULB_SERVERS_DIR||wn(ft(),"servers")}function Q(n){let e=qa(n),t=e;try{t=$a.native(e)}catch{}return(process.platform==="win32"?t.toLowerCase():t).replace(/\\/g,"/")}function pr(n,e){let t=Q(n),s=Q(e);return t.startsWith(s.endsWith("/")?s:s+"/")?!t.includes("/node_modules/"):!1}function Fa(n){return _.join(ge(),`${n}.json`)}function kn(n){return _.join(ge(),`${n}.log`)}function ja(n){return _.join(ge(),`${n}.wait.json`)}function Ua(n,e=0){try{let t=Ba(kn(n)),s=e>=0&&e<=t.length?e:0;return{text:t.subarray(s).toString("utf8"),offset:t.length}}catch{return{text:"",offset:0}}}function Ka(n){try{return process.kill(n,0),!0}catch(e){return e.code==="EPERM"}}async function vn(n){await Sn(Fa(n)).catch(()=>{}),await Sn(kn(n)).catch(()=>{}),await Sn(ja(n)).catch(()=>{})}async function An(n){let e;try{e=await Ma(ge())}catch{return[]}let t=[];return await Promise.all(e.map(async r=>{if(!/^\d+\.json$/.test(r))return;let i=parseInt(r,10),o;try{o=JSON.parse(await Ra(_.join(ge(),r),"utf8"))}catch{await vn(i);return}o&&typeof o.pid=="number"&&Ka(o.pid)?t.push(o):await vn(i)})),(n?t.filter(r=>r.agent==null&&pr(r.file,n)):t).sort((r,i)=>r.startedAt-i.startedAt)}async function mr(n){try{process.kill(n,"SIGTERM")}catch{}await vn(n)}function gr(n,e){let t=Q(e);return n.filter(s=>s.agent==null&&s.pid!==process.pid&&Q(s.file)===t)}async function Ja(n){let e=gr(await An(),n);for(let t of e)await mr(t.pid);return e}var Ya=n=>new Promise(e=>setTimeout(e,n));function Va(n,e,t){(process.platform==="win32"?hr("cmd",["/c","start","","/b",n,...e],{cwd:t,stdio:"ignore",windowsHide:!0}):hr(n,e,{cwd:t,detached:!0,stdio:"ignore"})).unref()}function Wa(){return _.join(_.dirname(Da(import.meta.url)),"index.js")}function Ga(n,e={}){return{command:process.execPath,args:[Wa(),...e.trust?["--trust"]:[],n,...e.open===!1?["--no-open"]:[]]}}async function Ha(n,e,t,s){let r=await n();if(r)return r;Va(e.command,e.args,t);let i=Date.now()+2e4;for(;Date.now()<i;){await Ya(150);let o=await n();if(o)return o}throw new Error(`Launched ${s} but it did not register within 20s.`)}async function Qa(n,e={}){let t=e.cwd??process.cwd(),s=_.resolve(t,n);return await Ja(s),Ha(async()=>gr(await An(),s)[0],Ga(n,e),t,_.basename(n))}import{readdirSync as Md,readFileSync as Rd,statSync as Bd}from"fs";import{join as ma,basename as Dd}from"path";var J={code:{path:"code.tsx",language:"typescript"},css:{path:"styles.css",language:"css"},html:{path:"index.html",language:"html"},config:{path:"config.json",language:"json"},notes:{path:"notes.md",language:"markdown"},data:{path:"data.txt",language:"text"},infer:{path:"infer.md",language:"markdown"},insight:{path:"insight.json",language:"json"}},z=["code","css","html","data","infer","insight","config","notes"];function yr(n){return z.find(e=>J[e].path===n)}var br="typebulb/v1";function wr(n){return!!n?.startsWith("typebulb")}function Nn(n){return/[:\n"']/.test(n)||n.startsWith(" ")||n.endsWith(" ")?`"${n.replace(/"/g,'\\"')}"`:n}function On(n){return n.startsWith('"')&&n.endsWith('"')?n.slice(1,-1).replace(/\\"/g,'"'):n.startsWith("'")&&n.endsWith("'")?n.slice(1,-1):n}var Sr=/^\*\*(.+)\*\*$/,En=/^(`{3,})(\w*)\s*$/,za=new Set(z.map(n=>J[n].path)),vr=n=>new RegExp(`^${n}\\s*$`);function Y(n){try{let e=n.split(`
|
|
141
|
+
`),t=0;if(e[t]?.trim()!=="---")return null;t++;let s=[];for(;t<e.length&&e[t]?.trim()!=="---";)s.push(e[t]),t++;if(e[t]?.trim()!=="---")return null;t++;let r=el(s);if(!r)return null;let i=new Map,o=[],a=t;for(;t<e.length;){let c=e[t]?.trim()?.match(Sr);if(c){let p=c[1].trim();for(t++;t<e.length&&e[t]?.trim()==="";)t++;let u=e[t]?.match(En);if(!u){o.push(`**${p}** has no code fence \u2014 block skipped`);continue}let f=u[1];t++;let m=[],y=vr(f);for(;t<e.length&&!e[t]?.match(y);)m.push(e[t]),t++;let d=t<e.length;t++,o.push(...Xa(p,m,d)),i.set(p,m.join(`
|
|
142
|
+
`)),a=t}else t++}return{frontmatter:r,files:i,warnings:o,bodyEndLine:a}}catch{return null}}function Xa(n,e,t){let s=[];for(let r=0;r<e.length;r++){let i=e[r]?.trim().match(Sr);i&&za.has(i[1].trim())&&Za(e,r)&&s.push(i[1].trim())}return s.length?s.map(r=>`**${n}** block has an unterminated code fence \u2014 it swallowed the **${r}** block.`):t?[]:[`**${n}** block has an unterminated code fence (it runs to the end of the file).`]}function Za(n,e){let t=e+1;for(;t<n.length&&n[t]?.trim()==="";)t++;return!!n[t]?.match(En)}function el(n){let e={};for(let t of n){let s=t.indexOf(":");if(s===-1)continue;let r=t.slice(0,s).trim(),i=t.slice(s+1).trim();switch(r){case"format":e.format=i;break;case"name":e.name=On(i);break}}return!wr(e.format)||!e.name?null:e}function kr(n){let e=Object.fromEntries(z.map(t=>[t,n.files.get(J[t].path)||""]));return{name:n.frontmatter.name,...e}}function tl(n){let e=n.match(/^`{3,}/gm),t=e?Math.max(...e.map(s=>s.length)):0;return"`".repeat(Math.max(3,t+1))}function nl(n,e){let{path:t}=J[n],s=t.split(".").pop(),r=tl(e);return`**${t}**
|
|
143
143
|
|
|
144
144
|
${r}${s}
|
|
145
145
|
${e}
|
|
146
|
-
${r}`}function
|
|
147
|
-
`)}var
|
|
148
|
-
`).length-1}));return s}function
|
|
146
|
+
${r}`}function Ar(n){let e=z.filter(t=>n[t]).map(t=>nl(t,n[t]));return["---",`format: ${br}`,`name: ${Nn(n.name)}`,"---","",...e].join(`
|
|
147
|
+
`)}var $d=xa(pa(),1);function cn(n){return{...kr(n),server:n.files.get("server.ts")??""}}function ha(n){return!!n.server&&!n.code}function un(n){let e=/^---[^\n]*\n([\s\S]*?)\n---/.exec(n),t=e?/^\s*name:\s*(.+?)\s*$/m.exec(e[1]):null;return t?t[1].replace(/^["']|["']$/g,""):void 0}function qd(n){return(un(n)??"bulb").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"bulb"}function _d(n){return n.replace(/^---[^\n]*\r?\n[\s\S]*?\r?\n---[^\n]*\r?\n?/,"").replace(/^\r?\n+/,"")}function ga(n,e,t){if(e>8)return t;let s;try{s=Md(n,{withFileTypes:!0})}catch{return t}for(let r of s)if(r.isDirectory()){if(r.name.startsWith(".")||r.name==="node_modules")continue;ga(ma(n,r.name),e+1,t)}else r.isFile()&&r.name.endsWith(".bulb.md")&&t.push(ma(n,r.name));return t}function Fd(n){return ga(n,0,[]).map(e=>{let t=0;try{t=Bd(e).mtimeMs}catch{}let s,r=!1;try{let i=Rd(e,"utf8");s=un(i.slice(0,1024));let o=Y(i);r=!!o&&ha(cn(o))}catch{}return{path:e,name:s??Dd(e).replace(/\.bulb\.md$/,""),mtime:t,serverOnly:r}})}import{readFile as jd}from"fs/promises";function ya(n){if(n.server.trim())return"server-side code (server.ts)";let e=n.code;if(/\btb\s*\.\s*fs\b/.test(e)||e.includes("/__fs"))return"the filesystem";if(/\btb\s*\.\s*ai\b/.test(e)||e.includes("/__ai")||n.infer.trim()||/\btb\s*\.\s*infer\b/.test(e))return"AI (your API keys)";if(/\btb\s*\.\s*server\s*\.\s*(?!log\b)\w/.test(e)||e.includes("/__api"))return"server-side code (server.ts)"}async function Ud(n){try{let e=Y(await jd(n,"utf-8"));return e?ya(cn(e)):void 0}catch{return}}var Kd=[/\bimport\s+(?:[^'";]*?from\s*)?['"]([^'"]+)['"]/g,/\bexport\s+[^'";]*?from\s*['"]([^'"]+)['"]/g];function Jd(n){if(/^[./]/.test(n)||/^[a-z][a-z0-9+.-]*:/i.test(n))return null;let e=n.split("/");return n.startsWith("@")?e.slice(0,2).join("/"):e[0]}function Yd(n){let e=[];for(let r of Kd)for(let i of n.matchAll(r)){let o=Jd(i[1]);o&&e.push({root:o,index:i.index??0})}e.sort((r,i)=>r.index-i.index);let t=new Set,s=[];for(let{root:r,index:i}of e)t.has(r)||(t.add(r),s.push({root:r,lineIndex:n.slice(0,i).split(`
|
|
148
|
+
`).length-1}));return s}function ba(n){return Yd(n).map(e=>e.root)}function Vd(n){let e=Y(n);if(!e)return n;let t=e.files.get("code.tsx");if(!t)return n;let s=ba(t);if(!s.length)return n;let r=e.files.get("config.json"),i={};if(r)try{let c=JSON.parse(r);c&&typeof c=="object"&&(i=c)}catch{}let o=i.dependencies&&typeof i.dependencies=="object"?{...i.dependencies}:{},a=s.filter(c=>!(c in o));if(!a.length)return n;for(let c of a)o[c]="latest";i.dependencies=o;let l={name:e.frontmatter.name};for(let[c,p]of e.files){let u=yr(c);u&&(l[u]=p)}return l.config=JSON.stringify(i,null,2),Ar(l)}import{spawn as wa}from"child_process";import{basename as Wd}from"path";function Gd(){return process.env.TYPEBULB_EDITOR||"code"}var Hd=/^(code|code-insiders|codium|vscodium|cursor|windsurf)(\.cmd|\.exe)?$/i;function Qd(n,e,t){return t==null?[e]:Hd.test(Wd(n))?["-g",`${e}:${t}`]:[`+${t}`,e]}function zd(n,e){let t=Gd();return{command:t,args:Qd(t,n,e)}}function Xd(n,e){let{command:t,args:s}=zd(n,e),r=process.platform==="win32"?wa("cmd.exe",["/d","/s","/c",t,...s],{detached:!0,stdio:"ignore",windowsHide:!0}):wa(t,s,{detached:!0,stdio:"ignore"});r.on("error",i=>console.error("[typebulb] editor launch failed:",i?.message??i)),r.unref()}import{readFileSync as Zd,writeFileSync as ep,mkdirSync as tp}from"fs";import{join as np}from"path";function Sa(){return np(ft(),"trust.json")}function ar(){try{let n=JSON.parse(Zd(Sa(),"utf8"));return new Set(Array.isArray(n)?n:[])}catch{return new Set}}function sp(n){tp(ft(),{recursive:!0}),ep(Sa(),JSON.stringify([...n]))}function rp(n){return ar().has(Q(n))}function ip(n,e){let t=ar(),s=Q(n);(e?t.has(s):!t.has(s))||(e?t.add(s):t.delete(s),sp(t))}function op(){return[...ar()]}var lr={anthropic:"ANTHROPIC_API_KEY",openai:"OPENAI_API_KEY",gemini:"GOOGLE_API_KEY",openrouter:"OPENROUTER_API_KEY"};function dn(n){return(n.includes("://")?n:`http://${n}`).replace(/\/+$/,"")}var ap="https://api.typebulb.com/api/models",lp=1440*60*1e3,cp=5e3,up=60*1e3,at=null,fn=null,lt=null;function fp(){return lt}async function dp(){let[n,e]=await Promise.all([hp(),pp()]);return[...mp(e),...n]}async function va(){let n;try{n=await fetch(ap,{signal:AbortSignal.timeout(cp)})}catch(e){return lt=`catalog fetch failed: ${e?.message??e}`,null}if(!n.ok)return lt=`catalog fetch failed: HTTP ${n.status}`,null;try{return await n.json()}catch(e){return lt=`catalog returned an unreadable body: ${e?.message??e}`,null}}async function pp(){if(at&&Date.now()-at.fetchedAt<=lp)return at.models;let n=await va()??await va();return n?(at={models:n,fetchedAt:Date.now()},lt=null,n):at?.models??[]}async function hp(){if(fn&&Date.now()-fn.fetchedAt<=up)return fn.models;let n=dn(process.env.OLLAMA_HOST??"http://localhost:11434"),e=[];try{let t=await fetch(new URL("/api/tags",n).toString());t.ok&&(e=((await t.json()).models??[]).map(r=>r.name).filter(r=>!!r).map(r=>({provider:"ollama",name:r,friendlyName:r,providerName:"Ollama"})))}catch{}return fn={models:e,fetchedAt:Date.now()},e}function mp(n){let e=new Set(Object.entries(lr).filter(([,t])=>!!process.env[t]).map(([t])=>t));return n.filter(t=>e.has(t.provider))}var G=class extends Error{constructor(e,t="unknown",s=!1){super(e),this.code=t,this.retryable=s}},D=class{getPath(e,t){return this.path}parseError(e,t){return this.parseJsonError(e,t)}parseStreamChunk(e){return this.checkAndThrowError(e),this.parseProviderStreamChunk(e)}extractSystemMessages(e,t=`
|
|
149
149
|
|
|
150
|
-
`){let s=e.filter(r=>r.role==="system").map(r=>r.content);return{system:s.length?s.join(t):void 0,conversationMessages:e.filter(r=>r.role!=="system")}}parseJsonError(e,t){if(!e)return{message:`HTTP ${t}`};try{let s=JSON.parse(e);return s.error&&typeof s.error=="object"?{message:s.error.message||`HTTP ${t}`,type:s.error.type}:s.message?{message:s.message}:{message:e}}catch{return{message:e}}}checkAndThrowError(e){if(typeof e!="object"||e===null)return;let t=e;if(t.type==="error"&&"message"in t){let s=t.code||"unknown";throw new
|
|
151
|
-
`)),!t&&r.type==="message"&&r.content&&(t=r.content.filter(i=>i.type==="output_text").map(i=>i.text).join(""));return{text:t,reasoning:s}}parseProviderStreamChunk(e){if(!this.isResponsesApiEvent(e))return null;switch(e.type){case"response.failed":{let s=e.response?.error,r=s?.message||"Response failed",i=s?.code==="insufficient_quota"||s?.code==="rate_limit_exceeded";throw new
|
|
150
|
+
`){let s=e.filter(r=>r.role==="system").map(r=>r.content);return{system:s.length?s.join(t):void 0,conversationMessages:e.filter(r=>r.role!=="system")}}parseJsonError(e,t){if(!e)return{message:`HTTP ${t}`};try{let s=JSON.parse(e);return s.error&&typeof s.error=="object"?{message:s.error.message||`HTTP ${t}`,type:s.error.type}:s.message?{message:s.message}:{message:e}}catch{return{message:e}}}checkAndThrowError(e){if(typeof e!="object"||e===null)return;let t=e;if(t.type==="error"&&"message"in t){let s=t.code||"unknown";throw new G(t.message,s,!!t.retryable)}if(t.error){let s=t.error,r=typeof s=="object"&&s!==null?String(s.type??s.code??""):"",i=/rate_limit|too_many_requests/i.test(r),o=/overloaded|server_error|unavailable/i.test(r),a=/context_length/i.test(r);throw new G(this.extractErrorMessage(t.error),i?"rate_limit":a?"context_exceeded":"unknown",i||o)}}extractErrorMessage(e){if(typeof e=="string")try{let t=JSON.parse(e);return t.error?.message||t.message||e}catch{return e}return typeof e=="object"&&e!==null?e.message||JSON.stringify(e):`${this.providerName} returned an error`}};var pn=class extends D{constructor(){super(...arguments),this.providerName="OpenAI",this.defaultBaseUrl="https://api.openai.com",this.path="/v1/responses",this.effortMap={0:"none",1:"low",2:"medium",3:"high"}}buildHeaders(e){return{Authorization:`Bearer ${e}`,"Content-Type":"application/json",Accept:"application/json"}}buildPayload(e,t,s,r){let i=this.convertMessagesToInput(e),o={model:t,input:i,stream:r};if(s?.webSearch!==!1&&(o.tools=[{type:"web_search"}]),s?.effort!==void 0){let a=this.effortMap[s.effort];o.reasoning=a==="none"?{effort:a}:{effort:a,summary:"auto"}}return o}parseNonStreamingResponse(e){if(!this.isResponsesApiResponse(e))return{text:""};let t=e.output_text||"",s;if(e.output&&Array.isArray(e.output))for(let r of e.output)r.type==="reasoning"&&r.summary&&(s=r.summary.map(i=>i.text).join(`
|
|
151
|
+
`)),!t&&r.type==="message"&&r.content&&(t=r.content.filter(i=>i.type==="output_text").map(i=>i.text).join(""));return{text:t,reasoning:s}}parseProviderStreamChunk(e){if(!this.isResponsesApiEvent(e))return null;switch(e.type){case"response.failed":{let s=e.response?.error,r=s?.message||"Response failed",i=s?.code==="insufficient_quota"||s?.code==="rate_limit_exceeded";throw new G(r,i?"rate_limit":"unknown",i)}case"response.output_text.delta":return{text:e.delta};case"response.reasoning_summary_text.delta":return{reasoning:e.delta};default:return null}}convertMessagesToInput(e){return e.map(t=>t.role==="system"?`System: ${t.content}`:t.role==="user"?`User: ${t.content}`:t.role==="assistant"?`Assistant: ${t.content}`:t.content).join(`
|
|
152
152
|
|
|
153
|
-
`)}isResponsesApiEvent(e){return typeof e=="object"&&e!==null&&"type"in e&&typeof e.type=="string"}isResponsesApiResponse(e){return typeof e=="object"&&e!==null&&e.object==="response"}};var
|
|
153
|
+
`)}isResponsesApiEvent(e){return typeof e=="object"&&e!==null&&"type"in e&&typeof e.type=="string"}isResponsesApiResponse(e){return typeof e=="object"&&e!==null&&e.object==="response"}};var Ce=class extends D{parseNonStreamingResponse(e){if(!this.hasChoices(e))return{text:""};let t=e,s=t.choices[0],r=s?.message,i=r?.content??s?.text??"",o=r?.reasoning??r?.reasoning_content??t.reasoning;return{text:i,reasoning:o}}parseProviderStreamChunk(e){if(!this.hasChoices(e))return null;let t=e.choices[0];if(!t)return null;let s=t.delta||t.message;if(!s)return null;let r=s.content||void 0,i=s.reasoning||s.reasoning_content||void 0;return!r&&!i?null:{text:r,reasoning:i}}hasChoices(e){return typeof e=="object"&&e!==null&&"choices"in e&&Array.isArray(e.choices)}};var hn=class extends Ce{constructor(){super(...arguments),this.providerName="OpenRouter",this.defaultBaseUrl="https://openrouter.ai",this.path="/api/v1/chat/completions",this.effortMap={0:"none",1:"low",2:"medium",3:"high"}}buildHeaders(e,t){let s={Authorization:`Bearer ${e}`,"x-api-key":e,"Content-Type":"application/json",Accept:"application/json","X-Title":"Typebulb"};return t&&(s["HTTP-Referer"]=t,s.Referer=t,s.Origin=t),s}buildPayload(e,t,s,r){let i={model:t,messages:e,stream:r};s?.webSearch===!0&&(i.plugins=[{id:"web"}]);let o=s?.effort;return o!==void 0&&(i.reasoning={effort:this.effortMap[o]}),i}};var mn=class extends D{constructor(){super(...arguments),this.providerName="Anthropic",this.defaultBaseUrl="https://api.anthropic.com",this.path="/v1/messages"}buildHeaders(e){return{"x-api-key":e,"anthropic-version":"2023-06-01","Content-Type":"application/json",Accept:"application/json"}}buildPayload(e,t,s,r){let{system:i,conversationMessages:o}=this.extractSystemMessages(e),a={model:t,max_tokens:this.getMaxTokens(t),messages:this.withLastMessageCached(o),stream:r};s?.webSearch!==!1&&(a.tools=[{type:"web_search_20250305",name:"web_search"}]),i&&(a.system=[{type:"text",text:i,cache_control:{type:"ephemeral"}}]);let l=s?.effort;if(l!==void 0){if(this.isModernModel(t))if(l===0)a.output_config={effort:"low"};else{let c={1:"low",2:"medium",3:"high"};a.thinking={type:"adaptive",display:"summarized"},a.output_config={effort:c[l]}}else if(l!==0){let c={1:2048,2:4096,3:8192};a.thinking={type:"enabled",budget_tokens:c[l]}}}return a}parseNonStreamingResponse(e){if(!this.isAnthropicResponse(e))return{text:""};let t=e.content.filter(r=>r.type==="text").map(r=>r.text).join(""),s=e.content.filter(r=>r.type==="thinking").map(r=>r.thinking).join(`
|
|
154
154
|
|
|
155
|
-
`);return{text:t,reasoning:s||void 0}}parseProviderStreamChunk(e){return this.isAnthropicEvent(e)&&e.type==="content_block_delta"?e.delta.type==="text_delta"?{text:e.delta.text||""}:e.delta.type==="thinking_delta"?{reasoning:e.delta.thinking||""}:null:null}withLastMessageCached(e){let t=e.length-1;return e.map((s,r)=>r===t?{role:s.role,content:[{type:"text",text:s.content,cache_control:{type:"ephemeral"}}]}:s)}isAnthropicResponse(e){return typeof e=="object"&&e!==null&&e.type==="message"&&Array.isArray(e.content)}isAnthropicEvent(e){return typeof e=="object"&&e!==null&&"type"in e}isModernModel(e){let t=e.match(/^claude-[a-z]+-(\d+)(?:-(\d+))?/i);if(!t)return!1;let s=+t[1],r=t[2]?+t[2]:0;return s>4||s===4&&r>=6}getMaxTokens(e){return this.isModernModel(e)?64e3:32e3}};var
|
|
155
|
+
`);return{text:t,reasoning:s||void 0}}parseProviderStreamChunk(e){return this.isAnthropicEvent(e)&&e.type==="content_block_delta"?e.delta.type==="text_delta"?{text:e.delta.text||""}:e.delta.type==="thinking_delta"?{reasoning:e.delta.thinking||""}:null:null}withLastMessageCached(e){let t=e.length-1;return e.map((s,r)=>r===t?{role:s.role,content:[{type:"text",text:s.content,cache_control:{type:"ephemeral"}}]}:s)}isAnthropicResponse(e){return typeof e=="object"&&e!==null&&e.type==="message"&&Array.isArray(e.content)}isAnthropicEvent(e){return typeof e=="object"&&e!==null&&"type"in e}isModernModel(e){let t=e.match(/^claude-[a-z]+-(\d+)(?:-(\d+))?/i);if(!t)return!1;let s=+t[1],r=t[2]?+t[2]:0;return s>4||s===4&&r>=6}getMaxTokens(e){return this.isModernModel(e)?64e3:32e3}};var gn=class extends D{constructor(){super(...arguments),this.providerName="Gemini",this.defaultBaseUrl="https://generativelanguage.googleapis.com",this.path="/v1beta/models",this.budgetMap={0:0,1:1024,2:8192,3:-1}}getPath(e,t){return`/v1beta/models/${e}:${t?"streamGenerateContent":"generateContent"}${t?"?alt=sse":""}`}buildHeaders(e){return{"Content-Type":"application/json","x-goog-api-key":e}}buildPayload(e,t,s,r){let{system:i,conversationMessages:o}=this.extractSystemMessages(e,`
|
|
156
156
|
`),l={contents:o.map(p=>({role:p.role==="assistant"?"model":"user",parts:[{text:p.content}]}))};s?.webSearch!==!1&&(l.tools=[{google_search:{}}]),i&&(l.systemInstruction={role:"system",parts:[{text:i}]});let c=s?.effort;if(c!==void 0){let p=this.geminiVersion(t),u=p!==null&&p>=3?{thinkingLevel:this.thinkingLevelFor(p,c)}:{thinkingBudget:this.budgetMap[c]};l.generationConfig={thinkingConfig:c===0?u:{includeThoughts:!0,...u}}}return l}parseError(e,t){if(!e)return{message:`HTTP ${t}`};try{let s=JSON.parse(e),r=Array.isArray(s)?s[0]?.error:s?.error;return r&&typeof r=="object"?{message:(r.message||`HTTP ${t}`).split(`
|
|
157
|
-
`)[0],type:r.status,code:r.code?.toString()}:s.message?{message:s.message}:{message:e}}catch{return{message:e}}}parseNonStreamingResponse(e){if(this.checkAndThrowError(e),this.checkGeminiError(e),!this.isGeminiResponse(e))return{text:"",status:"failed",error:"Invalid response format"};let t=this.extractParts(e).text||"",s=e.candidates?.[0]?.finishReason,r="complete";return s==="MAX_TOKENS"?r="interrupted":(s==="SAFETY"||s==="RECITATION")&&(r="failed"),{text:t,status:r}}parseProviderStreamChunk(e){if(this.checkGeminiError(e),!this.isGeminiResponse(e))return null;let t=this.extractParts(e);return t.text||t.reasoning?t:null}geminiVersion(e){let t=e.match(/^gemini-(\d+(?:\.\d+)?)/);return t?Number(t[1]):null}thinkingLevelFor(e,t){let s=["minimal","low","medium","high"][t];return s==="minimal"&&e<3.5?"low":s}isGeminiResponse(e){return typeof e=="object"&&e!==null&&"candidates"in e&&Array.isArray(e.candidates)}extractParts(e){let t=e.candidates?.[0]?.content?.parts;if(!t)return{};let s="",r="";for(let i of t)i.text&&(i.thought?r+=i.text:s+=i.text);return{text:s||void 0,reasoning:r||void 0}}checkGeminiError(e){if(this.isGeminiResponse(e)&&e.promptFeedback?.blockReason){let t=e.promptFeedback.blockReason;throw new
|
|
157
|
+
`)[0],type:r.status,code:r.code?.toString()}:s.message?{message:s.message}:{message:e}}catch{return{message:e}}}parseNonStreamingResponse(e){if(this.checkAndThrowError(e),this.checkGeminiError(e),!this.isGeminiResponse(e))return{text:"",status:"failed",error:"Invalid response format"};let t=this.extractParts(e).text||"",s=e.candidates?.[0]?.finishReason,r="complete";return s==="MAX_TOKENS"?r="interrupted":(s==="SAFETY"||s==="RECITATION")&&(r="failed"),{text:t,status:r}}parseProviderStreamChunk(e){if(this.checkGeminiError(e),!this.isGeminiResponse(e))return null;let t=this.extractParts(e);return t.text||t.reasoning?t:null}geminiVersion(e){let t=e.match(/^gemini-(\d+(?:\.\d+)?)/);return t?Number(t[1]):null}thinkingLevelFor(e,t){let s=["minimal","low","medium","high"][t];return s==="minimal"&&e<3.5?"low":s}isGeminiResponse(e){return typeof e=="object"&&e!==null&&"candidates"in e&&Array.isArray(e.candidates)}extractParts(e){let t=e.candidates?.[0]?.content?.parts;if(!t)return{};let s="",r="";for(let i of t)i.text&&(i.thought?r+=i.text:s+=i.text);return{text:s||void 0,reasoning:r||void 0}}checkGeminiError(e){if(this.isGeminiResponse(e)&&e.promptFeedback?.blockReason){let t=e.promptFeedback.blockReason;throw new G(`Prompt blocked: ${t}`)}}};var yn=class extends Ce{constructor(){super(...arguments),this.providerName="Ollama",this.defaultBaseUrl="http://localhost:11434",this.path="/chat/completions"}buildHeaders(e){let t={"Content-Type":"application/json",Accept:"application/json"};return e&&(t.Authorization=`Bearer ${e}`),t}buildPayload(e,t,s,r){return{model:t,messages:e,stream:r}}};var ka=new yn,gp=new Map([["openai",new pn],["openrouter",new hn],["anthropic",new mn],["gemini",new gn],["ollama",ka],["openai-compat",ka]]);function ct(n){let e=gp.get(n);if(!e)throw new Error(`Unsupported protocol: ${n}`);return e}function yp(n,e){return n.replace(/\/+$/,"")+(e.startsWith("/")?e:`/${e}`)}async function cr(n,e){let t=ct(n.protocol),s=t.getPath(n.model,e.stream),r=yp(n.baseUrl,s),i=t.buildHeaders(n.apiKey,e.origin),o=t.buildPayload(e.messages,n.model,{effort:e.effort,webSearch:e.webSearch},e.stream);return e.modifyPayload?.(o),fetch(r,{method:"POST",headers:i,body:JSON.stringify(o),signal:e.signal})}function bp(n,e){let t=n??process.env.TB_AI_PROVIDER,s=e??process.env.TB_AI_MODEL;if(!t)return"No provider specified. Set TB_AI_PROVIDER in your .env file or pass provider in the tb.ai() call.";if(!s)return"No model specified. Set TB_AI_MODEL in your .env file or pass model in the tb.ai() call.";let r;try{r=ct(t)}catch{return`Unknown provider '${t}'.`}if(t==="ollama")return{apiKey:"",baseUrl:`${dn(process.env.OLLAMA_HOST??r.defaultBaseUrl)}/v1`,protocol:t,model:s,isFreeModel:!1};if(t==="openai-compat"){let a=process.env.TB_AI_BASE_URL;return a?{apiKey:process.env.TB_AI_API_KEY??"",baseUrl:a,protocol:t,model:s,isFreeModel:!1}:"No base URL for openai-compat. Set TB_AI_BASE_URL (the OpenAI-style base ending in /v1, e.g. http://localhost:1234/v1) in your .env file."}let i=lr[t];if(!i)return`Unknown provider '${t}'.`;let o=process.env[i];return o?{apiKey:o,baseUrl:r.defaultBaseUrl,protocol:t,model:s,isFreeModel:!1}:`No API key for '${t}'. Set ${i} in your .env file.`}function wp(n,e){let t=[...e.system?[{role:"system",content:e.system}]:[],...e.messages.map(r=>({role:r.role,content:r.content}))],s=e.effort;return cr(n,{messages:t,stream:!0,effort:s!=null&&s>=0&&s<=3?s:void 0,webSearch:e.webSearch??!0,signal:e.signal})}import{readFileSync as Iy,existsSync as Sp}from"fs";import*as he from"path";import{fileURLToPath as vp}from"url";function Aa(){let n=he.dirname(vp(import.meta.url));for(;!Sp(he.join(n,"package.json"));){let e=he.dirname(n);if(e===n)break;n=e}return n}function kp(){return he.join(Aa(),"README.md")}function Ap(){return he.join(Aa(),"description.md")}import*as U from"fs/promises";import*as K from"path";import{readFileSync as Np,existsSync as _y}from"fs";import*as bn from"path";function Op(n){return[...n?[`.env.${n}.local`,`.env.${n}`]:[],".env.local",".env"]}function*Ep(n){for(let e of n.split(`
|
|
158
|
+
`)){let t=e.trim();if(!t||t.startsWith("#"))continue;let s=t.indexOf("=");if(s===-1)continue;let r=t.slice(0,s).trim(),i=t.slice(s+1).trim();(i.startsWith('"')&&i.endsWith('"')||i.startsWith("'")&&i.endsWith("'"))&&(i=i.slice(1,-1)),yield[r,i]}}function Tp(n,e=process.cwd()){for(let t of Op()){let s;try{s=Np(bn.resolve(e,t),"utf-8")}catch{continue}for(let[r,i]of Ep(s))if(r===n)return i}return process.env[n]}var Na=(n,e)=>K.join("typebulbs","u",n,`${e}.bulb.md`),ur=n=>`${n.origin}/u/${encodeURIComponent(n.userSlug)}/${encodeURIComponent(n.slug)}.md`;function Cp(n,e,t){if(/^https?:\/\//i.test(n)){let l=new URL(n),c=l.pathname.split("/").filter(Boolean).map(decodeURIComponent),p=c[0]==="api"&&c[1]==="scripts"?c.slice(2):c;if(p[0]!=="u"||!p[1]||!p[2])throw new Error(`Not a bulb URL: ${n}
|
|
159
|
+
Expected <origin>/u/<user>/<slug>`);let u=p[1],f=p[2].replace(/(\.bulb)?\.md$/,"");return{origin:l.origin,userSlug:u,slug:f,dest:K.join(e,Na(u,f))}}let s=K.resolve(e,n),[r,i,o,a]=s.split(K.sep).slice(-4);if(r!=="typebulbs"||i!=="u"||!o||!a?.endsWith(".bulb.md"))throw new Error(`Not a conventional bulb path: ${n}
|
|
160
|
+
A pull target must be a bulb URL, or a local file at typebulbs/u/<user>/<slug>.bulb.md \u2014 the path is its remote identity.`);return{origin:t,userSlug:o,slug:a.slice(0,-8),dest:s}}async function Lp(n,e={}){let t=await fetch(ur(n),{headers:e.token?{Authorization:`Bearer ${e.token}`}:{},signal:e.timeoutMs?AbortSignal.timeout(e.timeoutMs):void 0});if(!t.ok)return{kind:"http-error",status:t.status};let s=t.headers.get("content-type");if(!s?.includes("text/markdown"))return{kind:"not-markdown",contentType:s};let r=await t.text(),i;try{i=await U.readFile(n.dest,"utf-8")}catch{}if(i!==void 0){if(Pp(i,r))return{kind:"up-to-date",dest:n.dest};if(!e.force){let{mtime:a}=await U.stat(n.dest);return{kind:"conflict",dest:n.dest,localMtime:a,remoteLastModified:t.headers.get("last-modified")}}}await U.mkdir(K.dirname(n.dest),{recursive:!0}),await U.writeFile(n.dest,r);let o=new Date(t.headers.get("last-modified")??"");return isNaN(o.getTime())||await U.utimes(n.dest,new Date,o),{kind:"written",dest:n.dest,created:i===void 0}}function Pp(n,e){let t=i=>i.replace(/\r\n/g,`
|
|
161
|
+
`),s=Y(t(n)),r=Y(t(e));return!s||!r?t(n)===t(e):s.frontmatter.name===r.frontmatter.name&&z.every(i=>(s.files.get(J[i].path)||"")===(r.files.get(J[i].path)||""))}import*as Le from"fs/promises";async function Ip(n,e){let t=await Le.readFile(n.dest,"utf-8"),{mtime:s}=await Le.stat(n.dest),r={Authorization:`Bearer ${e.token}`,"Content-Type":"text/markdown; charset=utf-8"};e.force||(r["If-Unmodified-Since"]=s.toUTCString());let i=await fetch(ur(n),{method:"PUT",body:t,headers:r,signal:e.timeoutMs?AbortSignal.timeout(e.timeoutMs):void 0}),o=await i.text();if(i.status===409)return{kind:"conflict",message:Oa(o)};if(!i.ok)return{kind:"http-error",status:i.status,message:Oa(o)};let a=JSON.parse(o);return await Le.utimes(n.dest,new Date,new Date(a.updatedAt)),{kind:"pushed",created:a.created,serverStripped:a.serverStripped,updatedAt:a.updatedAt}}function Oa(n){try{return JSON.parse(n).error||n}catch{return n}}export{un as bulbName,Na as bulbRelPath,Ap as bundledDescriptionPath,kp as bundledReadmePath,fp as catalogFetchError,Vd as ensureDeclaredDependencies,dp as getFilteredModels,rp as isBulbTrusted,Qa as launchBulbServer,Fd as listBulbFiles,An as listBulbServers,op as listTrustedBulbs,dn as normalizeOllamaHost,Xd as openInEditor,Cp as parsePullTarget,Ud as predictBulbTrust,Lp as pullBulb,Ip as pushBulb,Tp as readEnvVar,Ua as readServerLog,bp as resolveLocalProvider,wp as sendTbAi,kn as serverLogPath,ip as setBulbTrusted,qd as slugifyBulbName,mr as stopBulbServer,_d as stripFrontmatter};
|