faf 8.2.2 → 8.3.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 +17 -1
- package/dist/cli.js +262 -261
- package/dist/cli.js.map +8 -8
- package/dist/index.js +122 -122
- package/dist/index.js.map +4 -4
- package/dist/interop/cards.d.ts +10 -3
- package/dist/interop/pack.d.ts +11 -1
- package/dist/pack.js +41 -41
- package/dist/pack.js.map +3 -3
- package/package.json +1 -1
- package/project.faf +3 -3
package/dist/interop/cards.d.ts
CHANGED
|
@@ -95,6 +95,11 @@ export declare function upsertCatalogText(text: string | null, incoming: Catalog
|
|
|
95
95
|
text: string;
|
|
96
96
|
changed: boolean;
|
|
97
97
|
};
|
|
98
|
+
/** Why a .fafa gets no MCP Server Card and no registry server.json. */
|
|
99
|
+
export declare const NO_MCP_ENDPOINT = "no mcp endpoint in agent.fafa";
|
|
100
|
+
/** True when the .fafa says it is not an MCP server: it names no mcp endpoint.
|
|
101
|
+
* Then neither MCP card is written, even beside a project.faf. */
|
|
102
|
+
export declare function fafaSkipsMcp(fafa: FafaDoc | undefined): boolean;
|
|
98
103
|
/** The cards an agent.fafa gives with no project.faf (BETTER): the A2A card
|
|
99
104
|
* (when it names an A2A door), the MCP Server Card (when it names a remote MCP
|
|
100
105
|
* URL), the registry server.json (a remote or a package), the AI Catalog, ARD. */
|
|
@@ -104,9 +109,11 @@ export declare function betterTargets(fafa: FafaDoc, opts?: ProjectCardsOptions)
|
|
|
104
109
|
* an agent.fafa alone gives the plain cards ({@link betterTargets}); a
|
|
105
110
|
* project.faf, resident and used, adds FAF's context block to each (the A2A
|
|
106
111
|
* card's extension, the Server Card's and server.json's `_meta`). A card's
|
|
107
|
-
* identity comes from the .fafa at both rungs.
|
|
108
|
-
*
|
|
109
|
-
*
|
|
112
|
+
* identity comes from the .fafa at both rungs. A .fafa with no mcp endpoint
|
|
113
|
+
* (a CLI, a library, an A2A agent) gets no Server Card and no registry entry,
|
|
114
|
+
* and asking for one is refused. With a project.faf and no .fafa, the Server
|
|
115
|
+
* Card and the registry identity come from project.faf, as `faf server-card`
|
|
116
|
+
* writes them.
|
|
110
117
|
*/
|
|
111
118
|
export declare function projectCards(input: {
|
|
112
119
|
/** project.faf — absent means BETTER. */
|
package/dist/interop/pack.d.ts
CHANGED
|
@@ -153,7 +153,13 @@ export interface PackAnswers {
|
|
|
153
153
|
tags?: string[];
|
|
154
154
|
example_requests?: string[];
|
|
155
155
|
packages?: PackPackage[];
|
|
156
|
+
/** What the packages are: an MCP server (default), a CLI or a library. It is
|
|
157
|
+
* the protocol of each package's stdio endpoint. */
|
|
158
|
+
package_kind?: string;
|
|
156
159
|
}
|
|
160
|
+
/** What a package can be. The `.fafa` endpoint protocol is an open vocabulary;
|
|
161
|
+
* these are the ones faf writes for a package. */
|
|
162
|
+
export declare const PACKAGE_KINDS: readonly ["mcp", "cli", "library"];
|
|
157
163
|
/** Write the `.fafa` a set of answers describes. Throws, naming the answer, when one is missing or malformed. */
|
|
158
164
|
export declare function answersToFafa(a: PackAnswers): FafaDoc;
|
|
159
165
|
/** The `.fafa` as the YAML document people keep. */
|
|
@@ -171,7 +177,11 @@ export declare function mcpRemotes(fafa: FafaDoc): Array<{
|
|
|
171
177
|
type: string;
|
|
172
178
|
url: string;
|
|
173
179
|
}>;
|
|
174
|
-
/** True when the `.fafa`
|
|
180
|
+
/** True when the `.fafa` names an MCP endpoint, at a URL or as a package. A
|
|
181
|
+
* CLI, a library or an A2A agent has none, and gets no MCP card. */
|
|
182
|
+
export declare function hasMcpEndpoint(fafa: FafaDoc): boolean;
|
|
183
|
+
/** True when the `.fafa` gives a registry entry: an MCP endpoint, and a package
|
|
184
|
+
* or a remote MCP URL. */
|
|
175
185
|
export declare function hasRegistryEntry(fafa: FafaDoc): boolean;
|
|
176
186
|
/** The registry identity from the `.fafa`: `name`, and `title` when it has one. */
|
|
177
187
|
export declare function registryIdentity(fafa: FafaDoc): {
|
package/dist/pack.js
CHANGED
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
var E0=Symbol.for("yaml.alias"),g0=Symbol.for("yaml.document"),x=Symbol.for("yaml.map"),W$=Symbol.for("yaml.pair"),H0=Symbol.for("yaml.scalar"),
|
|
2
|
-
`)}}S.defaultYaml={explicit:!1,version:"1.2"};S.defaultTags={"!!":"tag:yaml.org,2002:"};function h0($){if(/[\x00-\x19\s,[\]{}]/.test($)){let Z=`Anchor must not contain whitespace or control characters: ${JSON.stringify($)}`;throw Error(Z)}return!0}function V$($){let X=new Set;return s($,{Value(Z,H){if(H.anchor)X.add(H.anchor)}}),X}function q$($,X){for(let Z=1;;++Z){let H=`${$}${Z}`;if(!X.has(H))return H}}function v$($,X){let Z=[],H=new Map,U=null;return{onAnchor:(
|
|
1
|
+
var E0=Symbol.for("yaml.alias"),g0=Symbol.for("yaml.document"),x=Symbol.for("yaml.map"),W$=Symbol.for("yaml.pair"),H0=Symbol.for("yaml.scalar"),a=Symbol.for("yaml.seq"),g=Symbol.for("yaml.node.type"),u=($)=>!!$&&typeof $==="object"&&$[g]===E0,m=($)=>!!$&&typeof $==="object"&&$[g]===g0,v=($)=>!!$&&typeof $==="object"&&$[g]===x,_=($)=>!!$&&typeof $==="object"&&$[g]===W$,O=($)=>!!$&&typeof $==="object"&&$[g]===H0,d=($)=>!!$&&typeof $==="object"&&$[g]===a;function w($){if($&&typeof $==="object")switch($[g]){case x:case a:return!0}return!1}function D($){if($&&typeof $==="object")switch($[g]){case E0:case x:case H0:case a:return!0}return!1}var y0=($)=>(O($)||w($))&&!!$.anchor;var y=Symbol("break visit"),k$=Symbol("skip children"),i=Symbol("remove node");function s($,X){let Z=x$(X);if(m($)){if(W0(null,$.contents,Z,Object.freeze([$]))===i)$.contents=null}else W0(null,$,Z,Object.freeze([]))}s.BREAK=y;s.SKIP=k$;s.REMOVE=i;function W0($,X,Z,H){let U=u$($,X,Z,H);if(D(U)||_(U))return m$($,H,U),W0($,U,Z,H);if(typeof U!=="symbol"){if(w(X)){H=Object.freeze(H.concat(X));for(let z=0;z<X.items.length;++z){let G=W0(z,X.items[z],Z,H);if(typeof G==="number")z=G-1;else if(G===y)return y;else if(G===i)X.items.splice(z,1),z-=1}}else if(_(X)){H=Object.freeze(H.concat(X));let z=W0("key",X.key,Z,H);if(z===y)return y;else if(z===i)X.key=null;let G=W0("value",X.value,Z,H);if(G===y)return y;else if(G===i)X.value=null}}return U}async function f0($,X){let Z=x$(X);if(m($)){if(await V0(null,$.contents,Z,Object.freeze([$]))===i)$.contents=null}else await V0(null,$,Z,Object.freeze([]))}f0.BREAK=y;f0.SKIP=k$;f0.REMOVE=i;async function V0($,X,Z,H){let U=await u$($,X,Z,H);if(D(U)||_(U))return m$($,H,U),V0($,U,Z,H);if(typeof U!=="symbol"){if(w(X)){H=Object.freeze(H.concat(X));for(let z=0;z<X.items.length;++z){let G=await V0(z,X.items[z],Z,H);if(typeof G==="number")z=G-1;else if(G===y)return y;else if(G===i)X.items.splice(z,1),z-=1}}else if(_(X)){H=Object.freeze(H.concat(X));let z=await V0("key",X.key,Z,H);if(z===y)return y;else if(z===i)X.key=null;let G=await V0("value",X.value,Z,H);if(G===y)return y;else if(G===i)X.value=null}}return U}function x$($){if(typeof $==="object"&&($.Collection||$.Node||$.Value))return Object.assign({Alias:$.Node,Map:$.Node,Scalar:$.Node,Seq:$.Node},$.Value&&{Map:$.Value,Scalar:$.Value,Seq:$.Value},$.Collection&&{Map:$.Collection,Seq:$.Collection},$);return $}function u$($,X,Z,H){if(typeof Z==="function")return Z($,X,H);if(v(X))return Z.Map?.($,X,H);if(d(X))return Z.Seq?.($,X,H);if(_(X))return Z.Pair?.($,X,H);if(O(X))return Z.Scalar?.($,X,H);if(u(X))return Z.Alias?.($,X,H);return}function m$($,X,Z){let H=X[X.length-1];if(w(H))H.items[$]=Z;else if(_(H))if($==="key")H.key=Z;else H.value=Z;else if(m(H))H.contents=Z;else{let U=u(H)?"alias":"scalar";throw Error(`Cannot replace node with ${U} parent`)}}var j2={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},S2=($)=>$.replace(/[!,[\]{}]/g,(X)=>j2[X]);class S{constructor($,X){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},S.defaultYaml,$),this.tags=Object.assign({},S.defaultTags,X)}clone(){let $=new S(this.yaml,this.tags);return $.docStart=this.docStart,$}atDocument(){let $=new S(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:S.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},S.defaultTags);break}return $}add($,X){if(this.atNextDocument)this.yaml={explicit:S.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},S.defaultTags),this.atNextDocument=!1;let Z=$.trim().split(/[ \t]+/),H=Z.shift();switch(H){case"%TAG":{if(Z.length!==2){if(X(0,"%TAG directive should contain exactly two parts"),Z.length<2)return!1}let[U,z]=Z;return this.tags[U]=z,!0}case"%YAML":{if(this.yaml.explicit=!0,Z.length!==1)return X(0,"%YAML directive should contain exactly one part"),!1;let[U]=Z;if(U==="1.1"||U==="1.2")return this.yaml.version=U,!0;else{let z=/^\d+\.\d+$/.test(U);return X(6,`Unsupported YAML version ${U}`,z),!1}}default:return X(0,`Unknown directive ${H}`,!0),!1}}tagName($,X){if($==="!")return"!";if($[0]!=="!")return X(`Not a valid tag: ${$}`),null;if($[1]==="<"){let z=$.slice(2,-1);if(z==="!"||z==="!!")return X(`Verbatim tags aren't resolved, so ${$} is invalid.`),null;if($[$.length-1]!==">")X("Verbatim tags must end with a >");return z}let[,Z,H]=$.match(/^(.*!)([^!]*)$/s);if(!H)X(`The ${$} tag has no suffix`);let U=this.tags[Z];if(U)try{return U+decodeURIComponent(H)}catch(z){return X(String(z)),null}if(Z==="!")return $;return X(`Could not resolve tag: ${$}`),null}tagString($){for(let[X,Z]of Object.entries(this.tags))if($.startsWith(Z))return X+S2($.substring(Z.length));return $[0]==="!"?$:`!<${$}>`}toString($){let X=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],Z=Object.entries(this.tags),H;if($&&Z.length>0&&D($.contents)){let U={};s($.contents,(z,G)=>{if(D(G)&&G.tag)U[G.tag]=!0}),H=Object.keys(U)}else H=[];for(let[U,z]of Z){if(U==="!!"&&z==="tag:yaml.org,2002:")continue;if(!$||H.some((G)=>G.startsWith(z)))X.push(`%TAG ${U} ${z}`)}return X.join(`
|
|
2
|
+
`)}}S.defaultYaml={explicit:!1,version:"1.2"};S.defaultTags={"!!":"tag:yaml.org,2002:"};function h0($){if(/[\x00-\x19\s,[\]{}]/.test($)){let Z=`Anchor must not contain whitespace or control characters: ${JSON.stringify($)}`;throw Error(Z)}return!0}function V$($){let X=new Set;return s($,{Value(Z,H){if(H.anchor)X.add(H.anchor)}}),X}function q$($,X){for(let Z=1;;++Z){let H=`${$}${Z}`;if(!X.has(H))return H}}function v$($,X){let Z=[],H=new Map,U=null;return{onAnchor:(z)=>{Z.push(z),U??(U=V$($));let G=q$(X,U);return U.add(G),G},setAnchors:()=>{for(let z of Z){let G=H.get(z);if(typeof G==="object"&&G.anchor&&(O(G.node)||w(G.node)))G.node.anchor=G.anchor;else{let Q=Error("Failed to resolve repeated object (this should not happen)");throw Q.source=z,Q}}},sourceObjects:H}}function e($,X,Z,H){if(H&&typeof H==="object")if(Array.isArray(H))for(let U=0,z=H.length;U<z;++U){let G=H[U],Q=e($,H,String(U),G);if(Q===void 0)delete H[U];else if(Q!==G)H[U]=Q}else if(H instanceof Map)for(let U of Array.from(H.keys())){let z=H.get(U),G=e($,H,U,z);if(G===void 0)H.delete(U);else if(G!==z)H.set(U,G)}else if(H instanceof Set)for(let U of Array.from(H)){let z=e($,H,U,U);if(z===void 0)H.delete(U);else if(z!==U)H.delete(U),H.add(z)}else for(let[U,z]of Object.entries(H)){let G=e($,H,U,z);if(G===void 0)delete H[U];else if(G!==z)H[U]=G}return $.call(X,Z,H)}function A($,X,Z){if(Array.isArray($))return $.map((H,U)=>A(H,String(U),Z));if($&&typeof $.toJSON==="function"){if(!Z||!y0($))return $.toJSON(X,Z);let H={aliasCount:0,count:1,res:void 0};Z.anchors.set($,H),Z.onCreate=(z)=>{H.res=z,delete Z.onCreate};let U=$.toJSON(X,Z);if(Z.onCreate)Z.onCreate(U);return U}if(typeof $==="bigint"&&!Z?.keep)return Number($);return $}class U0{constructor($){Object.defineProperty(this,g,{value:$})}clone(){let $=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if(this.range)$.range=this.range.slice();return $}toJS($,{mapAsMap:X,maxAliasCount:Z,onAnchor:H,reviver:U}={}){if(!m($))throw TypeError("A document argument is required");let z={anchors:new Map,doc:$,keep:!0,mapAsMap:X===!0,mapKeyWarned:!1,maxAliasCount:typeof Z==="number"?Z:100},G=A(this,"",z);if(typeof H==="function")for(let{count:Q,res:J}of z.anchors.values())H(J,Q);return typeof U==="function"?e(U,{"":G},"",G):G}}class z0 extends U0{constructor($){super(E0);this.source=$,Object.defineProperty(this,"tag",{set(){throw Error("Alias nodes cannot have tags")}})}resolve($,X){if(X?.maxAliasCount===0)throw ReferenceError("Alias resolution is disabled");let Z;if(X?.aliasResolveCache)Z=X.aliasResolveCache;else if(Z=[],s($,{Node:(U,z)=>{if(u(z)||y0(z))Z.push(z)}}),X)X.aliasResolveCache=Z;let H=void 0;for(let U of Z){if(U===this)break;if(U.anchor===this.source)H=U}return H}toJSON($,X){if(!X)return{source:this.source};let{anchors:Z,doc:H,maxAliasCount:U}=X,z=this.resolve(H,X);if(!z){let Q=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(Q)}let G=Z.get(z);if(!G)A(z,null,X),G=Z.get(z);if(G?.res===void 0)throw ReferenceError("This should not happen: Alias anchor was not resolved?");if(U>=0){if(G.count+=1,G.aliasCount===0)G.aliasCount=k0(H,z,Z);if(G.count*G.aliasCount>U)throw ReferenceError("Excessive alias count indicates a resource exhaustion attack")}return G.res}toString($,X,Z){let H=`*${this.source}`;if($){if(h0(this.source),$.options.verifyAliasOrder&&!$.anchors.has(this.source)){let U=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(U)}if($.implicitKey)return`${H} `}return H}}function k0($,X,Z){if(u(X)){let H=X.resolve($),U=Z&&H&&Z.get(H);return U?U.count*U.aliasCount:0}else if(w(X)){let H=0;for(let U of X.items){let z=k0($,U,Z);if(z>H)H=z}return H}else if(_(X)){let H=k0($,X.key,Z),U=k0($,X.value,Z);return Math.max(H,U)}return 1}var x0=($)=>!$||typeof $!=="function"&&typeof $!=="object";class F extends U0{constructor($){super(H0);this.value=$}toJSON($,X){return X?.keep?this.value:A(this.value,$,X)}toString(){return String(this.value)}}F.BLOCK_FOLDED="BLOCK_FOLDED";F.BLOCK_LITERAL="BLOCK_LITERAL";F.PLAIN="PLAIN";F.QUOTE_DOUBLE="QUOTE_DOUBLE";F.QUOTE_SINGLE="QUOTE_SINGLE";var C2="tag:yaml.org,2002:";function E2($,X,Z){if(X){let H=Z.filter((z)=>z.tag===X),U=H.find((z)=>!z.format)??H[0];if(!U)throw Error(`Tag ${X} not found`);return U}return Z.find((H)=>H.identify?.($)&&!H.format)}function o($,X,Z){if(m($))$=$.contents;if(D($))return $;if(_($)){let W=Z.schema[x].createNode?.(Z.schema,null,Z);return W.items.push($),W}if($ instanceof String||$ instanceof Number||$ instanceof Boolean||typeof BigInt<"u"&&$ instanceof BigInt)$=$.valueOf();let{aliasDuplicateObjects:H,onAnchor:U,onTagObj:z,schema:G,sourceObjects:Q}=Z,J=void 0;if(H&&$&&typeof $==="object")if(J=Q.get($),J)return J.anchor??(J.anchor=U($)),new z0(J.anchor);else J={anchor:null,node:null},Q.set($,J);if(X?.startsWith("!!"))X=C2+X.slice(2);let B=E2($,X,G.tags);if(!B){if($&&typeof $.toJSON==="function")$=$.toJSON();if(!$||typeof $!=="object"){let W=new F($);if(J)J.node=W;return W}B=$ instanceof Map?G[x]:(Symbol.iterator in Object($))?G[a]:G[x]}if(z)z(B),delete Z.onTagObj;let R=B?.createNode?B.createNode(Z.schema,$,Z):typeof B?.nodeClass?.from==="function"?B.nodeClass.from(Z.schema,$,Z):new F($);if(X)R.tag=X;else if(!B.default)R.tag=B.tag;if(J)J.node=R;return R}function _0($,X,Z){let H=Z;for(let U=X.length-1;U>=0;--U){let z=X[U];if(typeof z==="number"&&Number.isInteger(z)&&z>=0){let G=[];G[z]=H,H=G}else H=new Map([[z,H]])}return o(H,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error("This should not happen, please report a bug.")},schema:$,sourceObjects:new Map})}var q0=($)=>$==null||typeof $==="object"&&!!$[Symbol.iterator]().next().done;class D0 extends U0{constructor($,X){super($);Object.defineProperty(this,"schema",{value:X,configurable:!0,enumerable:!1,writable:!0})}clone($){let X=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));if($)X.schema=$;if(X.items=X.items.map((Z)=>D(Z)||_(Z)?Z.clone($):Z),this.range)X.range=this.range.slice();return X}addIn($,X){if(q0($))this.add(X);else{let[Z,...H]=$,U=this.get(Z,!0);if(w(U))U.addIn(H,X);else if(U===void 0&&this.schema)this.set(Z,_0(this.schema,H,X));else throw Error(`Expected YAML collection at ${Z}. Remaining path: ${H}`)}}deleteIn($){let[X,...Z]=$;if(Z.length===0)return this.delete(X);let H=this.get(X,!0);if(w(H))return H.deleteIn(Z);else throw Error(`Expected YAML collection at ${X}. Remaining path: ${Z}`)}getIn($,X){let[Z,...H]=$,U=this.get(Z,!0);if(H.length===0)return!X&&O(U)?U.value:U;else return w(U)?U.getIn(H,X):void 0}hasAllNullValues($){return this.items.every((X)=>{if(!_(X))return!1;let Z=X.value;return Z==null||$&&O(Z)&&Z.value==null&&!Z.commentBefore&&!Z.comment&&!Z.tag})}hasIn($){let[X,...Z]=$;if(Z.length===0)return this.has(X);let H=this.get(X,!0);return w(H)?H.hasIn(Z):!1}setIn($,X){let[Z,...H]=$;if(H.length===0)this.set(Z,X);else{let U=this.get(Z,!0);if(w(U))U.setIn(H,X);else if(U===void 0&&this.schema)this.set(Z,_0(this.schema,H,X));else throw Error(`Expected YAML collection at ${Z}. Remaining path: ${H}`)}}}var d$=($)=>$.replace(/^(?!$)(?: $)?/gm,"#");function f($,X){if(/^\n+$/.test($))return $.substring(1);return X?$.replace(/^(?! *$)/gm,X):$}var n=($,X,Z)=>$.endsWith(`
|
|
3
3
|
`)?f(Z,X):Z.includes(`
|
|
4
4
|
`)?`
|
|
5
|
-
`+f(Z,X):($.endsWith(" ")?"":" ")+Z;var T$="flow",l$="block",c$="quoted";function K0($,X,Z="flow",{indentAtStart:H,lineWidth:U=80,minContentWidth:
|
|
5
|
+
`+f(Z,X):($.endsWith(" ")?"":" ")+Z;var T$="flow",l$="block",c$="quoted";function K0($,X,Z="flow",{indentAtStart:H,lineWidth:U=80,minContentWidth:z=20,onFold:G,onOverflow:Q}={}){if(!U||U<0)return $;if(U<z)z=0;let J=Math.max(1+z,1+U-X.length);if($.length<=J)return $;let B=[],R={},W=U-X.length;if(typeof H==="number")if(H>U-Math.max(2,z))B.push(0);else W=U-H;let T=void 0,Y=void 0,L=!1,V=-1,I=-1,P=-1;if(Z==="block"){if(V=p$($,V,X.length),V!==-1)W=V+J}for(let M;M=$[V+=1];){if(Z==="quoted"&&M==="\\"){switch(I=V,$[V+1]){case"x":V+=3;break;case"u":V+=5;break;case"U":V+=9;break;default:V+=1}P=V}if(M===`
|
|
6
6
|
`){if(Z==="block")V=p$($,V,X.length);W=V+X.length+J,T=void 0}else{if(M===" "&&Y&&Y!==" "&&Y!==`
|
|
7
7
|
`&&Y!=="\t"){let b=$[V+1];if(b&&b!==" "&&b!==`
|
|
8
|
-
`&&b!=="\t")T=V}if(V>=W)if(T)B.push(T),W=T+J,T=void 0;else if(Z==="quoted"){while(Y===" "||Y==="\t")Y=M,M=$[V+=1],L=!0;let b=V>P+1?V-2:I-1;if(R[b])return $;B.push(b),R[b]=!0,W=b+J,T=void 0}else L=!0}Y=M}if(L&&Q)Q();if(B.length===0)return $;if(
|
|
9
|
-
${X}${$.slice(0,
|
|
10
|
-
${X}${$.slice(b+1,
|
|
11
|
-
`);H=X,U=X+1,
|
|
12
|
-
`){if(G
|
|
8
|
+
`&&b!=="\t")T=V}if(V>=W)if(T)B.push(T),W=T+J,T=void 0;else if(Z==="quoted"){while(Y===" "||Y==="\t")Y=M,M=$[V+=1],L=!0;let b=V>P+1?V-2:I-1;if(R[b])return $;B.push(b),R[b]=!0,W=b+J,T=void 0}else L=!0}Y=M}if(L&&Q)Q();if(B.length===0)return $;if(G)G();let K=$.slice(0,B[0]);for(let M=0;M<B.length;++M){let b=B[M],N=B[M+1]||$.length;if(b===0)K=`
|
|
9
|
+
${X}${$.slice(0,N)}`;else{if(Z==="quoted"&&R[b])K+=`${$[b]}\\`;K+=`
|
|
10
|
+
${X}${$.slice(b+1,N)}`}}return K}function p$($,X,Z){let H=X,U=X+1,z=$[U];while(z===" "||z==="\t")if(X<U+Z)z=$[++X];else{do z=$[++X];while(z&&z!==`
|
|
11
|
+
`);H=X,U=X+1,z=$[U]}return H}var m0=($,X)=>({indentAtStart:X?$.indent.length:$.indentAtStart,lineWidth:$.options.lineWidth,minContentWidth:$.options.minContentWidth}),v0=($)=>/^(%|---|\.\.\.)/m.test($);function g2($,X,Z){if(!X||X<0)return!1;let H=X-Z,U=$.length;if(U<=H)return!1;for(let z=0,G=0;z<U;++z)if($[z]===`
|
|
12
|
+
`){if(z-G>H)return!0;if(G=z+1,U-G<=H)return!1}return!0}function w0($,X){let Z=JSON.stringify($);if(X.options.doubleQuotedAsJSON)return Z;let{implicitKey:H}=X,U=X.options.doubleQuotedMinMultiLineLength,z=X.indent||(v0($)?" ":""),G="",Q=0;for(let J=0,B=Z[J];B;B=Z[++J]){if(B===" "&&Z[J+1]==="\\"&&Z[J+2]==="n")G+=Z.slice(Q,J)+"\\ ",J+=1,Q=J,B="\\";if(B==="\\")switch(Z[J+1]){case"u":{G+=Z.slice(Q,J);let R=Z.substr(J+2,4);switch(R){case"0000":G+="\\0";break;case"0007":G+="\\a";break;case"000b":G+="\\v";break;case"001b":G+="\\e";break;case"0085":G+="\\N";break;case"00a0":G+="\\_";break;case"2028":G+="\\L";break;case"2029":G+="\\P";break;default:if(R.substr(0,2)==="00")G+="\\x"+R.substr(2);else G+=Z.substr(J,6)}J+=5,Q=J+1}break;case"n":if(H||Z[J+2]==='"'||Z.length<U)J+=1;else{G+=Z.slice(Q,J)+`
|
|
13
13
|
|
|
14
|
-
`;while(Z[J+2]==="\\"&&Z[J+3]==="n"&&Z[J+4]!=='"')
|
|
15
|
-
`,J+=2;if(z
|
|
14
|
+
`;while(Z[J+2]==="\\"&&Z[J+3]==="n"&&Z[J+4]!=='"')G+=`
|
|
15
|
+
`,J+=2;if(G+=z,Z[J+2]===" ")G+="\\";J+=1,Q=J+1}break;default:J+=1}}return G=Q?G+Z.slice(Q):Z,H?G:K0(G,z,c$,m0(X,!1))}function Y$($,X){if(X.options.singleQuote===!1||X.implicitKey&&$.includes(`
|
|
16
16
|
`)||/[ \t]\n|\n[ \t]/.test($))return w0($,X);let Z=X.indent||(v0($)?" ":""),H="'"+$.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
17
|
-
${Z}`)+"'";return X.implicitKey?H:K0(H,Z,T$,m0(X,!1))}function T0($,X){let{singleQuote:Z}=X.options,H;if(Z===!1)H=w0;else{let U=$.includes('"'),
|
|
17
|
+
${Z}`)+"'";return X.implicitKey?H:K0(H,Z,T$,m0(X,!1))}function T0($,X){let{singleQuote:Z}=X.options,H;if(Z===!1)H=w0;else{let U=$.includes('"'),z=$.includes("'");if(U&&!z)H=Y$;else if(z&&!U)H=w0;else H=Z?Y$:w0}return H($,X)}var I$;try{I$=new RegExp(`(^|(?<!
|
|
18
18
|
))
|
|
19
19
|
+(?!
|
|
20
|
-
|$)`,"g")}catch{I$=/\n+(?!\n|$)/g}function u0({comment:$,type:X,value:Z},H,U,
|
|
20
|
+
|$)`,"g")}catch{I$=/\n+(?!\n|$)/g}function u0({comment:$,type:X,value:Z},H,U,z){let{blockQuote:G,commentString:Q,lineWidth:J}=H.options;if(!G||/\n[\t ]+$/.test(Z))return T0(Z,H);let B=H.indent||(H.forceBlockIndent||v0(Z)?" ":""),R=G==="literal"?!0:G==="folded"||X===F.BLOCK_FOLDED?!1:X===F.BLOCK_LITERAL?!0:!g2(Z,J,B.length);if(!Z)return R?`|
|
|
21
21
|
`:`>
|
|
22
|
-
`;let W,T;for(T=Z.length;T>0;--T){let
|
|
23
|
-
`&&
|
|
24
|
-
`);if(L===-1)W="-";else if(Z===Y||L!==Y.length-1){if(W="+",
|
|
25
|
-
`)Y=Y.slice(0,-1);Y=Y.replace(I$,`$&${B}`)}let V=!1,I,P=-1;for(I=0;I<Z.length;++I){let
|
|
26
|
-
`)P=I;else break}let K=Z.substring(0,P<I?P+1:I);if(K)Z=Z.substring(K.length),K=K.replace(/\n+/g,`$&${B}`);let b=(V?B?"2":"1":"")+W;if($){if(b+=" "+Q($.replace(/ ?[\r\n]+/g," ")),U)U()}if(!R){let
|
|
27
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${B}`),k=!1,
|
|
22
|
+
`;let W,T;for(T=Z.length;T>0;--T){let N=Z[T-1];if(N!==`
|
|
23
|
+
`&&N!=="\t"&&N!==" ")break}let Y=Z.substring(T),L=Y.indexOf(`
|
|
24
|
+
`);if(L===-1)W="-";else if(Z===Y||L!==Y.length-1){if(W="+",z)z()}else W="";if(Y){if(Z=Z.slice(0,-Y.length),Y[Y.length-1]===`
|
|
25
|
+
`)Y=Y.slice(0,-1);Y=Y.replace(I$,`$&${B}`)}let V=!1,I,P=-1;for(I=0;I<Z.length;++I){let N=Z[I];if(N===" ")V=!0;else if(N===`
|
|
26
|
+
`)P=I;else break}let K=Z.substring(0,P<I?P+1:I);if(K)Z=Z.substring(K.length),K=K.replace(/\n+/g,`$&${B}`);let b=(V?B?"2":"1":"")+W;if($){if(b+=" "+Q($.replace(/ ?[\r\n]+/g," ")),U)U()}if(!R){let N=Z.replace(/\n+/g,`
|
|
27
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${B}`),k=!1,r=m0(H,!0);if(G!=="folded"&&X!==F.BLOCK_FOLDED)r.onOverflow=()=>{k=!0};let O0=K0(`${K}${N}${Y}`,B,l$,r);if(!k)return`>${b}
|
|
28
28
|
${B}${O0}`}return Z=Z.replace(/\n+/g,`$&${B}`),`|${b}
|
|
29
|
-
${B}${K}${Z}${Y}`}function
|
|
30
|
-
`)||R&&/[[\]{},]/.test(
|
|
31
|
-
`)?T0(
|
|
32
|
-
`))return u0($,X,Z,H);if(v0(
|
|
33
|
-
${J}`);if(
|
|
34
|
-
${X.indent}${Q}`}function i$({key:$,value:X},Z,H,U){let{allNullValues:
|
|
35
|
-
${Q}:`}else if(I=`${I}:`,T)I+=n(I,Z.indent,B(T));let P,K,M;if(D(X))P=!!X.spaceBefore,K=X.commentBefore,M=X.comment;else if(P=!1,K=null,M=null,X&&typeof X==="object")X=
|
|
36
|
-
`:"",K){let
|
|
37
|
-
${f(
|
|
29
|
+
${B}${K}${Z}${Y}`}function y2($,X,Z,H){let{type:U,value:z}=$,{actualString:G,implicitKey:Q,indent:J,indentStep:B,inFlow:R}=X;if(Q&&z.includes(`
|
|
30
|
+
`)||R&&/[[\]{},]/.test(z))return T0(z,X);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(z))return Q||R||!z.includes(`
|
|
31
|
+
`)?T0(z,X):u0($,X,Z,H);if(!Q&&!R&&U!==F.PLAIN&&z.includes(`
|
|
32
|
+
`))return u0($,X,Z,H);if(v0(z)){if(J==="")return X.forceBlockIndent=!0,u0($,X,Z,H);else if(Q&&J===B)return T0(z,X)}let W=z.replace(/\n+/g,`$&
|
|
33
|
+
${J}`);if(G){let T=(V)=>V.default&&V.tag!=="tag:yaml.org,2002:str"&&V.test?.test(W),{compat:Y,tags:L}=X.doc.schema;if(L.some(T)||Y?.some(T))return T0(z,X)}return Q?W:K0(W,J,T$,m0(X,!1))}function G0($,X,Z,H){let{implicitKey:U,inFlow:z}=X,G=typeof $.value==="string"?$:Object.assign({},$,{value:String($.value)}),{type:Q}=$;if(Q!==F.QUOTE_DOUBLE){if(/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(G.value))Q=F.QUOTE_DOUBLE}let J=(R)=>{switch(R){case F.BLOCK_FOLDED:case F.BLOCK_LITERAL:return U||z?T0(G.value,X):u0(G,X,Z,H);case F.QUOTE_DOUBLE:return w0(G.value,X);case F.QUOTE_SINGLE:return Y$(G.value,X);case F.PLAIN:return y2(G,X,Z,H);default:return null}},B=J(Q);if(B===null){let{defaultKeyType:R,defaultStringType:W}=X.options,T=U&&R||W;if(B=J(T),B===null)throw Error(`Unsupported default string type ${T}`)}return B}function d0($,X){let Z=Object.assign({blockQuote:!0,commentString:d$,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},$.schema.toStringOptions,X),H;switch(Z.collectionStyle){case"block":H=!1;break;case"flow":H=!0;break;default:H=null}return{anchors:new Set,doc:$,flowCollectionPadding:Z.flowCollectionPadding?" ":"",indent:"",indentStep:typeof Z.indent==="number"?" ".repeat(Z.indent):" ",inFlow:H,options:Z}}function f2($,X){if(X.tag){let U=$.filter((z)=>z.tag===X.tag);if(U.length>0)return U.find((z)=>z.format===X.format)??U[0]}let Z=void 0,H;if(O(X)){H=X.value;let U=$.filter((z)=>z.identify?.(H));if(U.length>1){let z=U.filter((G)=>G.test);if(z.length>0)U=z}Z=U.find((z)=>z.format===X.format)??U.find((z)=>!z.format)}else H=X,Z=$.find((U)=>U.nodeClass&&H instanceof U.nodeClass);if(!Z){let U=H?.constructor?.name??(H===null?"null":typeof H);throw Error(`Tag not resolved for ${U} value`)}return Z}function h2($,X,{anchors:Z,doc:H}){if(!H.directives)return"";let U=[],z=(O($)||w($))&&$.anchor;if(z&&h0(z))Z.add(z),U.push(`&${z}`);let G=$.tag??(X.default?null:X.tag);if(G)U.push(H.directives.tagString(G));return U.join(" ")}function t($,X,Z,H){if(_($))return $.toString(X,Z,H);if(u($)){if(X.doc.directives)return $.toString(X);if(X.resolvedAliases?.has($))throw TypeError("Cannot stringify circular structure without alias nodes");else{if(X.resolvedAliases)X.resolvedAliases.add($);else X.resolvedAliases=new Set([$]);$=$.resolve(X.doc)}}let U=void 0,z=D($)?$:X.doc.createNode($,{onTagObj:(J)=>U=J});U??(U=f2(X.doc.schema.tags,z));let G=h2(z,U,X);if(G.length>0)X.indentAtStart=(X.indentAtStart??0)+G.length+1;let Q=typeof U.stringify==="function"?U.stringify(z,X,Z,H):O(z)?G0(z,X,Z,H):z.toString(X,Z,H);if(!G)return Q;return O(z)||Q[0]==="{"||Q[0]==="["?`${G} ${Q}`:`${G}
|
|
34
|
+
${X.indent}${Q}`}function i$({key:$,value:X},Z,H,U){let{allNullValues:z,doc:G,indent:Q,indentStep:J,options:{commentString:B,indentSeq:R,simpleKeys:W}}=Z,T=D($)&&$.comment||null;if(W){if(T)throw Error("With simple keys, key nodes cannot have comments");if(w($)||!D($)&&typeof $==="object")throw Error("With simple keys, collection cannot be used as a key value")}let Y=!W&&(!$||T&&X==null&&!Z.inFlow||w($)||(O($)?$.type===F.BLOCK_FOLDED||$.type===F.BLOCK_LITERAL:typeof $==="object"));Z=Object.assign({},Z,{allNullValues:!1,implicitKey:!Y&&(W||!z),indent:Q+J});let L=!1,V=!1,I=t($,Z,()=>L=!0,()=>V=!0);if(!Y&&!Z.inFlow&&I.length>1024){if(W)throw Error("With simple keys, single line scalar must not span more than 1024 characters");Y=!0}if(Z.inFlow){if(z||X==null){if(L&&H)H();return I===""?"?":Y?`? ${I}`:I}}else if(z&&!W||X==null&&Y){if(I=`? ${I}`,T&&!L)I+=n(I,Z.indent,B(T));else if(V&&U)U();return I}if(L)T=null;if(Y){if(T)I+=n(I,Z.indent,B(T));I=`? ${I}
|
|
35
|
+
${Q}:`}else if(I=`${I}:`,T)I+=n(I,Z.indent,B(T));let P,K,M;if(D(X))P=!!X.spaceBefore,K=X.commentBefore,M=X.comment;else if(P=!1,K=null,M=null,X&&typeof X==="object")X=G.createNode(X);if(Z.implicitKey=!1,!Y&&!T&&O(X))Z.indentAtStart=I.length+1;if(V=!1,!R&&J.length>=2&&!Z.inFlow&&!Y&&d(X)&&!X.flow&&!X.tag&&!X.anchor)Z.indent=Z.indent.substring(2);let b=!1,N=t(X,Z,()=>b=!0,()=>V=!0),k=" ";if(T||P||K){if(k=P?`
|
|
36
|
+
`:"",K){let r=B(K);k+=`
|
|
37
|
+
${f(r,Z.indent)}`}if(N===""&&!Z.inFlow){if(k===`
|
|
38
38
|
`&&M)k=`
|
|
39
39
|
|
|
40
40
|
`}else k+=`
|
|
41
|
-
${Z.indent}`}else if(!Y&&w(X)){let
|
|
42
|
-
`),f$=O0!==-1,
|
|
43
|
-
${Z.indent}`}}else if(
|
|
44
|
-
`)k="";if(I+=k+
|
|
41
|
+
${Z.indent}`}else if(!Y&&w(X)){let r=N[0],O0=N.indexOf(`
|
|
42
|
+
`),f$=O0!==-1,A2=Z.inFlow??X.flow??X.items.length===0;if(f$||!A2){let h$=!1;if(f$&&(r==="&"||r==="!")){let Z0=N.indexOf(" ");if(r==="&"&&Z0!==-1&&Z0<O0&&N[Z0+1]==="!")Z0=N.indexOf(" ",Z0+1);if(Z0===-1||O0<Z0)h$=!0}if(!h$)k=`
|
|
43
|
+
${Z.indent}`}}else if(N===""||N[0]===`
|
|
44
|
+
`)k="";if(I+=k+N,Z.inFlow){if(b&&H)H()}else if(M&&!b)I+=n(I,Z.indent,B(M));else if(V&&U)U();return I}function F$($,X){if($==="debug"||$==="warn")console.warn(X)}var p0="<<",p={identify:($)=>$===p0||typeof $==="symbol"&&$.description===p0,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new F(Symbol(p0)),{addToJSMap:L$}),stringify:()=>p0},s$=($,X)=>(p.identify(X)||O(X)&&(!X.type||X.type===F.PLAIN)&&p.identify(X.value))&&$?.doc.schema.tags.some((Z)=>Z.tag===p.tag&&Z.default);function L$($,X,Z){let H=n$($,Z);if(d(H))for(let U of H.items)R$($,X,U);else if(Array.isArray(H))for(let U of H)R$($,X,U);else R$($,X,H)}function R$($,X,Z){let H=n$($,Z);if(!v(H))throw Error("Merge sources must be maps or map aliases");let U=H.toJSON(null,$,Map);for(let[z,G]of U)if(X instanceof Map){if(!X.has(z))X.set(z,G)}else if(X instanceof Set)X.add(z);else if(!Object.prototype.hasOwnProperty.call(X,z))Object.defineProperty(X,z,{value:G,writable:!0,enumerable:!0,configurable:!0});return X}function n$($,X){return $&&u(X)?X.resolve($.doc,$):X}function l0($,X,{key:Z,value:H}){if(D(Z)&&Z.addToJSMap)Z.addToJSMap($,X,H);else if(s$($,Z))L$($,X,H);else{let U=A(Z,"",$);if(X instanceof Map)X.set(U,A(H,U,$));else if(X instanceof Set)X.add(U);else{let z=k2(Z,U,$),G=A(H,z,$);if(z in X)Object.defineProperty(X,z,{value:G,writable:!0,enumerable:!0,configurable:!0});else X[z]=G}}return X}function k2($,X,Z){if(X===null)return"";if(typeof X!=="object")return String(X);if(D($)&&Z?.doc){let H=d0(Z.doc,{});H.anchors=new Set;for(let z of Z.anchors.keys())H.anchors.add(z.anchor);H.inFlow=!0,H.inStringifyKey=!0;let U=$.toString(H);if(!Z.mapKeyWarned){let z=JSON.stringify(U);if(z.length>40)z=z.substring(0,36)+'..."';F$(Z.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${z}. Set mapAsMap: true to use object keys.`),Z.mapKeyWarned=!0}return U}return JSON.stringify(X)}function Y0($,X,Z){let H=o($,void 0,Z),U=o(X,void 0,Z);return new j(H,U)}class j{constructor($,X=null){Object.defineProperty(this,g,{value:W$}),this.key=$,this.value=X}clone($){let{key:X,value:Z}=this;if(D(X))X=X.clone($);if(D(Z))Z=Z.clone($);return new j(X,Z)}toJSON($,X){let Z=X?.mapAsMap?new Map:{};return l0(X,Z,this)}toString($,X,Z){return $?.doc?i$(this,$,X,Z):JSON.stringify(this)}}function i0($,X,Z){return(X.inFlow??$.flow?u2:x2)($,X,Z)}function x2({comment:$,items:X},Z,{blockItemPrefix:H,flowChars:U,itemIndent:z,onChompKeep:G,onComment:Q}){let{indent:J,options:{commentString:B}}=Z,R=Object.assign({},Z,{indent:z,type:null}),W=!1,T=[];for(let L=0;L<X.length;++L){let V=X[L],I=null;if(D(V)){if(!W&&V.spaceBefore)T.push("");if(c0(Z,T,V.commentBefore,W),V.comment)I=V.comment}else if(_(V)){let K=D(V.key)?V.key:null;if(K){if(!W&&K.spaceBefore)T.push("");c0(Z,T,K.commentBefore,W)}}W=!1;let P=t(V,R,()=>I=null,()=>W=!0);if(I)P+=n(P,z,B(I));if(W&&I)W=!1;T.push(H+P)}let Y;if(T.length===0)Y=U.start+U.end;else{Y=T[0];for(let L=1;L<T.length;++L){let V=T[L];Y+=V?`
|
|
45
45
|
${J}${V}`:`
|
|
46
46
|
`}}if($){if(Y+=`
|
|
47
|
-
`+f(B($),J),Q)Q()}else if(W&&
|
|
47
|
+
`+f(B($),J),Q)Q()}else if(W&&G)G();return Y}function u2({items:$},X,{flowChars:Z,itemIndent:H}){let{indent:U,indentStep:z,flowCollectionPadding:G,options:{commentString:Q}}=X;H+=z;let J=Object.assign({},X,{indent:H,inFlow:!0,type:null}),B=!1,R=0,W=[];for(let L=0;L<$.length;++L){let V=$[L],I=null;if(D(V)){if(V.spaceBefore)W.push("");if(c0(X,W,V.commentBefore,!1),V.comment)I=V.comment}else if(_(V)){let K=D(V.key)?V.key:null;if(K){if(K.spaceBefore)W.push("");if(c0(X,W,K.commentBefore,!1),K.comment)B=!0}let M=D(V.value)?V.value:null;if(M){if(M.comment)I=M.comment;if(M.commentBefore)B=!0}else if(V.value==null&&K?.comment)I=K.comment}if(I)B=!0;let P=t(V,J,()=>I=null);if(B||(B=W.length>R||P.includes(`
|
|
48
48
|
`)),L<$.length-1)P+=",";else if(X.options.trailingComma){if(X.options.lineWidth>0)B||(B=W.reduce((K,M)=>K+M.length+2,2)+(P.length+2)>X.options.lineWidth);if(B)P+=","}if(I)P+=n(P,H,Q(I));W.push(P),R=W.length}let{start:T,end:Y}=Z;if(W.length===0)return T+Y;else{if(!B){let L=W.reduce((V,I)=>V+I.length+2,2);B=X.options.lineWidth>0&&L>X.options.lineWidth}if(B){let L=T;for(let V of W)L+=V?`
|
|
49
|
-
${
|
|
49
|
+
${z}${U}${V}`:`
|
|
50
50
|
`;return`${L}
|
|
51
|
-
${U}${Y}`}else return`${T}${
|
|
52
|
-
`:" ")}return
|
|
53
|
-
${U.key.commentBefore}`:H.commentBefore;if(H.comment){let
|
|
54
|
-
${
|
|
55
|
-
`))Z.push("..."),Z.push(f(J,""));else Z.push(`... ${J}`)}else Z.push("...");else{let J=$.comment;if(J&&
|
|
51
|
+
${U}${Y}`}else return`${T}${G}${W.join(" ")}${G}${Y}`}}function c0({indent:$,options:{commentString:X}},Z,H,U){if(H&&U)H=H.replace(/^\n+/,"");if(H){let z=f(X(H),$);Z.push(z.trimStart())}}function $0($,X){let Z=O(X)?X.value:X;for(let H of $)if(_(H)){if(H.key===X||H.key===Z)return H;if(O(H.key)&&H.key.value===Z)return H}return}class C extends D0{static get tagName(){return"tag:yaml.org,2002:map"}constructor($){super(x,$);this.items=[]}static from($,X,Z){let{keepUndefined:H,replacer:U}=Z,z=new this($),G=(Q,J)=>{if(typeof U==="function")J=U.call(X,Q,J);else if(Array.isArray(U)&&!U.includes(Q))return;if(J!==void 0||H)z.items.push(Y0(Q,J,Z))};if(X instanceof Map)for(let[Q,J]of X)G(Q,J);else if(X&&typeof X==="object")for(let Q of Object.keys(X))G(Q,X[Q]);if(typeof $.sortMapEntries==="function")z.items.sort($.sortMapEntries);return z}add($,X){let Z;if(_($))Z=$;else if(!$||typeof $!=="object"||!("key"in $))Z=new j($,$?.value);else Z=new j($.key,$.value);let H=$0(this.items,Z.key),U=this.schema?.sortMapEntries;if(H){if(!X)throw Error(`Key ${Z.key} already set`);if(O(H.value)&&x0(Z.value))H.value.value=Z.value;else H.value=Z.value}else if(U){let z=this.items.findIndex((G)=>U(Z,G)<0);if(z===-1)this.items.push(Z);else this.items.splice(z,0,Z)}else this.items.push(Z)}delete($){let X=$0(this.items,$);if(!X)return!1;return this.items.splice(this.items.indexOf(X),1).length>0}get($,X){let H=$0(this.items,$)?.value;return(!X&&O(H)?H.value:H)??void 0}has($){return!!$0(this.items,$)}set($,X){this.add(new j($,X),!0)}toJSON($,X,Z){let H=Z?new Z:X?.mapAsMap?new Map:{};if(X?.onCreate)X.onCreate(H);for(let U of this.items)l0(X,H,U);return H}toString($,X,Z){if(!$)return JSON.stringify(this);for(let H of this.items)if(!_(H))throw Error(`Map items must all be pairs; found ${JSON.stringify(H)} instead`);if(!$.allNullValues&&this.hasAllNullValues(!1))$=Object.assign({},$,{allNullValues:!0});return i0(this,$,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:$.indent||"",onChompKeep:Z,onComment:X})}}var l={collection:"map",default:!0,nodeClass:C,tag:"tag:yaml.org,2002:map",resolve($,X){if(!v($))X("Expected a mapping for this tag");return $},createNode:($,X,Z)=>C.from($,X,Z)};class h extends D0{static get tagName(){return"tag:yaml.org,2002:seq"}constructor($){super(a,$);this.items=[]}add($){this.items.push($)}delete($){let X=s0($);if(typeof X!=="number")return!1;return this.items.splice(X,1).length>0}get($,X){let Z=s0($);if(typeof Z!=="number")return;let H=this.items[Z];return!X&&O(H)?H.value:H}has($){let X=s0($);return typeof X==="number"&&X<this.items.length}set($,X){let Z=s0($);if(typeof Z!=="number")throw Error(`Expected a valid index, not ${$}.`);let H=this.items[Z];if(O(H)&&x0(X))H.value=X;else this.items[Z]=X}toJSON($,X){let Z=[];if(X?.onCreate)X.onCreate(Z);let H=0;for(let U of this.items)Z.push(A(U,String(H++),X));return Z}toString($,X,Z){if(!$)return JSON.stringify(this);return i0(this,$,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:($.indent||"")+" ",onChompKeep:Z,onComment:X})}static from($,X,Z){let{replacer:H}=Z,U=new this($);if(X&&Symbol.iterator in Object(X)){let z=0;for(let G of X){if(typeof H==="function"){let Q=X instanceof Set?G:String(z++);G=H.call(X,Q,G)}U.items.push(o(G,void 0,Z))}}return U}}function s0($){let X=O($)?$.value:$;if(X&&typeof X==="string")X=Number(X);return typeof X==="number"&&Number.isInteger(X)&&X>=0?X:null}var c={collection:"seq",default:!0,nodeClass:h,tag:"tag:yaml.org,2002:seq",resolve($,X){if(!d($))X("Expected a sequence for this tag");return $},createNode:($,X,Z)=>h.from($,X,Z)};var X0={identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify($,X,Z,H){return X=Object.assign({actualString:!0},X),G0($,X,Z,H)}};var J0={identify:($)=>$==null,createNode:()=>new F(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new F(null),stringify:({source:$},X)=>typeof $==="string"&&J0.test.test($)?$:X.options.nullStr};var P0={identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:($)=>new F($[0]==="t"||$[0]==="T"),stringify({source:$,value:X},Z){if($&&P0.test.test($)){let H=$[0]==="t"||$[0]==="T";if(X===H)return $}return X?Z.options.trueStr:Z.options.falseStr}};function E({format:$,minFractionDigits:X,tag:Z,value:H}){if(typeof H==="bigint")return String(H);let U=typeof H==="number"?H:Number(H);if(!isFinite(U))return isNaN(U)?".nan":U<0?"-.inf":".inf";let z=Object.is(H,-0)?"-0":JSON.stringify(H);if(!$&&X&&(!Z||Z==="tag:yaml.org,2002:float")&&/^-?\d/.test(z)&&!z.includes("e")){let G=z.indexOf(".");if(G<0)G=z.length,z+=".";let Q=X-(z.length-G-1);while(Q-- >0)z+="0"}return z}var n0={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:($)=>$.slice(-3).toLowerCase()==="nan"?NaN:$[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:E},r0={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:($)=>parseFloat($),stringify($){let X=Number($.value);return isFinite(X)?X.toExponential():E($)}},a0={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve($){let X=new F(parseFloat($)),Z=$.indexOf(".");if(Z!==-1&&$[$.length-1]==="0")X.minFractionDigits=$.length-Z-1;return X},stringify:E};var o0=($)=>typeof $==="bigint"||Number.isInteger($),O$=($,X,Z,{intAsBigInt:H})=>H?BigInt($):parseInt($.substring(X),Z);function r$($,X,Z){let{value:H}=$;if(o0(H)&&H>=0)return Z+H.toString(X);return E($)}var t0={identify:($)=>o0($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:($,X,Z)=>O$($,2,8,Z),stringify:($)=>r$($,8,"0o")},e0={identify:o0,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:($,X,Z)=>O$($,0,10,Z),stringify:E},$$={identify:($)=>o0($)&&$>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:($,X,Z)=>O$($,2,16,Z),stringify:($)=>r$($,16,"0x")};var a$=[l,c,X0,J0,P0,t0,e0,$$,n0,r0,a0];function o$($){return typeof $==="bigint"||Number.isInteger($)}var X$=({value:$})=>JSON.stringify($),m2=[{identify:($)=>typeof $==="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:($)=>$,stringify:X$},{identify:($)=>$==null,createNode:()=>new F(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:X$},{identify:($)=>typeof $==="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:($)=>$==="true",stringify:X$},{identify:o$,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:($,X,{intAsBigInt:Z})=>Z?BigInt($):parseInt($,10),stringify:({value:$})=>o$($)?$.toString():JSON.stringify($)},{identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:($)=>parseFloat($),stringify:X$}],v2={default:!0,tag:"",test:/^/,resolve($,X){return X(`Unresolved plain scalar ${JSON.stringify($)}`),$}},t$=[l,c].concat(m2,v2);var M0={identify:($)=>$ instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve($,X){if(typeof atob==="function"){let Z=atob($.replace(/[\n\r]/g,"")),H=new Uint8Array(Z.length);for(let U=0;U<Z.length;++U)H[U]=Z.charCodeAt(U);return H}else return X("This environment does not support reading binary tags; either Buffer or atob is required"),$},stringify({comment:$,type:X,value:Z},H,U,z){if(!Z)return"";let G=Z,Q;if(typeof btoa==="function"){let J="";for(let B=0;B<G.length;++B)J+=String.fromCharCode(G[B]);Q=btoa(J)}else throw Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(X??(X=F.BLOCK_LITERAL),X!==F.QUOTE_DOUBLE){let J=Math.max(H.options.lineWidth-H.indent.length,H.options.minContentWidth),B=Math.ceil(Q.length/J),R=Array(B);for(let W=0,T=0;W<B;++W,T+=J)R[W]=Q.substr(T,J);Q=R.join(X===F.BLOCK_LITERAL?`
|
|
52
|
+
`:" ")}return G0({comment:$,type:X,value:Q},H,U,z)}};function _$($,X){if(d($))for(let Z=0;Z<$.items.length;++Z){let H=$.items[Z];if(_(H))continue;else if(v(H)){if(H.items.length>1)X("Each pair must have its own sequence indicator");let U=H.items[0]||new j(new F(null));if(H.commentBefore)U.key.commentBefore=U.key.commentBefore?`${H.commentBefore}
|
|
53
|
+
${U.key.commentBefore}`:H.commentBefore;if(H.comment){let z=U.value??U.key;z.comment=z.comment?`${H.comment}
|
|
54
|
+
${z.comment}`:H.comment}H=U}$.items[Z]=_(H)?H:new j(H)}else X("Expected a sequence for this tag");return $}function D$($,X,Z){let{replacer:H}=Z,U=new h($);U.tag="tag:yaml.org,2002:pairs";let z=0;if(X&&Symbol.iterator in Object(X))for(let G of X){if(typeof H==="function")G=H.call(X,String(z++),G);let Q,J;if(Array.isArray(G))if(G.length===2)Q=G[0],J=G[1];else throw TypeError(`Expected [key, value] tuple: ${G}`);else if(G&&G instanceof Object){let B=Object.keys(G);if(B.length===1)Q=B[0],J=G[Q];else throw TypeError(`Expected tuple with one key, not ${B.length} keys`)}else Q=G;U.items.push(Y0(Q,J,Z))}return U}var b0={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:_$,createNode:D$};class I0 extends h{constructor(){super();this.add=C.prototype.add.bind(this),this.delete=C.prototype.delete.bind(this),this.get=C.prototype.get.bind(this),this.has=C.prototype.has.bind(this),this.set=C.prototype.set.bind(this),this.tag=I0.tag}toJSON($,X){if(!X)return super.toJSON($);let Z=new Map;if(X?.onCreate)X.onCreate(Z);for(let H of this.items){let U,z;if(_(H))U=A(H.key,"",X),z=A(H.value,U,X);else U=A(H,"",X);if(Z.has(U))throw Error("Ordered maps must not include duplicate keys");Z.set(U,z)}return Z}static from($,X,Z){let H=D$($,X,Z),U=new this;return U.items=H.items,U}}I0.tag="tag:yaml.org,2002:omap";var N0={collection:"seq",identify:($)=>$ instanceof Map,nodeClass:I0,default:!1,tag:"tag:yaml.org,2002:omap",resolve($,X){let Z=_$($,X),H=[];for(let{key:U}of Z.items)if(O(U))if(H.includes(U.value))X(`Ordered maps must not include duplicate keys: ${U.value}`);else H.push(U.value);return Object.assign(new I0,Z)},createNode:($,X,Z)=>I0.from($,X,Z)};function e$({value:$,source:X},Z){if(X&&($?K$:w$).test.test(X))return X;return $?Z.options.trueStr:Z.options.falseStr}var K$={identify:($)=>$===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new F(!0),stringify:e$},w$={identify:($)=>$===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new F(!1),stringify:e$};var $2={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:($)=>$.slice(-3).toLowerCase()==="nan"?NaN:$[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:E},X2={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:($)=>parseFloat($.replace(/_/g,"")),stringify($){let X=Number($.value);return isFinite(X)?X.toExponential():E($)}},Z2={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve($){let X=new F(parseFloat($.replace(/_/g,""))),Z=$.indexOf(".");if(Z!==-1){let H=$.substring(Z+1).replace(/_/g,"");if(H[H.length-1]==="0")X.minFractionDigits=H.length}return X},stringify:E};var A0=($)=>typeof $==="bigint"||Number.isInteger($);function Z$($,X,Z,{intAsBigInt:H}){let U=$[0];if(U==="-"||U==="+")X+=1;if($=$.substring(X).replace(/_/g,""),H){switch(Z){case 2:$=`0b${$}`;break;case 8:$=`0o${$}`;break;case 16:$=`0x${$}`;break}let G=BigInt($);return U==="-"?BigInt(-1)*G:G}let z=parseInt($,Z);return U==="-"?-1*z:z}function P$($,X,Z){let{value:H}=$;if(A0(H)){let U=H.toString(X);return H<0?"-"+Z+U.substr(1):Z+U}return E($)}var H2={identify:A0,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:($,X,Z)=>Z$($,2,2,Z),stringify:($)=>P$($,2,"0b")},U2={identify:A0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:($,X,Z)=>Z$($,1,8,Z),stringify:($)=>P$($,8,"0")},z2={identify:A0,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:($,X,Z)=>Z$($,0,10,Z),stringify:E},G2={identify:A0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:($,X,Z)=>Z$($,2,16,Z),stringify:($)=>P$($,16,"0x")};class F0 extends C{constructor($){super($);this.tag=F0.tag}add($){let X;if(_($))X=$;else if($&&typeof $==="object"&&"key"in $&&"value"in $&&$.value===null)X=new j($.key,null);else X=new j($,null);if(!$0(this.items,X.key))this.items.push(X)}get($,X){let Z=$0(this.items,$);return!X&&_(Z)?O(Z.key)?Z.key.value:Z.key:Z}set($,X){if(typeof X!=="boolean")throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof X}`);let Z=$0(this.items,$);if(Z&&!X)this.items.splice(this.items.indexOf(Z),1);else if(!Z&&X)this.items.push(new j($))}toJSON($,X){return super.toJSON($,X,Set)}toString($,X,Z){if(!$)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},$,{allNullValues:!0}),X,Z);else throw Error("Set items must all have null values")}static from($,X,Z){let{replacer:H}=Z,U=new this($);if(X&&Symbol.iterator in Object(X))for(let z of X){if(typeof H==="function")z=H.call(X,z,z);U.items.push(Y0(z,null,Z))}return U}}F0.tag="tag:yaml.org,2002:set";var j0={collection:"map",identify:($)=>$ instanceof Set,nodeClass:F0,default:!1,tag:"tag:yaml.org,2002:set",createNode:($,X,Z)=>F0.from($,X,Z),resolve($,X){if(v($))if($.hasAllNullValues(!0))return Object.assign(new F0,$);else X("Set items must all have null values");else X("Expected a mapping for this tag");return $}};function M$($,X){let Z=$[0],H=Z==="-"||Z==="+"?$.substring(1):$,U=(G)=>X?BigInt(G):Number(G),z=H.replace(/_/g,"").split(":").reduce((G,Q)=>G*U(60)+U(Q),U(0));return Z==="-"?U(-1)*z:z}function J2($){let{value:X}=$,Z=(G)=>G;if(typeof X==="bigint")Z=(G)=>BigInt(G);else if(isNaN(X)||!isFinite(X))return E($);let H="";if(X<0)H="-",X*=Z(-1);let U=Z(60),z=[X%U];if(X<60)z.unshift(0);else if(X=(X-z[0])/U,z.unshift(X%U),X>=60)X=(X-z[0])/U,z.unshift(X);return H+z.map((G)=>String(G).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var H$={identify:($)=>typeof $==="bigint"||Number.isInteger($),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:($,X,{intAsBigInt:Z})=>M$($,Z),stringify:J2},U$={identify:($)=>typeof $==="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:($)=>M$($,!1),stringify:J2},R0={identify:($)=>$ 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($){let X=$.match(R0.test);if(!X)throw Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,Z,H,U,z,G,Q]=X.map(Number),J=X[7]?Number((X[7]+"00").substr(1,3)):0,B=Date.UTC(Z,H-1,U,z||0,G||0,Q||0,J),R=X[8];if(R&&R!=="Z"){let W=M$(R,!1);if(Math.abs(W)<30)W*=60;B-=60000*W}return new Date(B)},stringify:({value:$})=>$?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};var b$=[l,c,X0,J0,K$,w$,H2,U2,z2,G2,$2,X2,Z2,M0,p,N0,b0,j0,H$,U$,R0];var Q2=new Map([["core",a$],["failsafe",[l,c,X0]],["json",t$],["yaml11",b$],["yaml-1.1",b$]]),B2={binary:M0,bool:P0,float:a0,floatExp:r0,floatNaN:n0,floatTime:U$,int:e0,intHex:$$,intOct:t0,intTime:H$,map:l,merge:p,null:J0,omap:N0,pairs:b0,seq:c,set:j0,timestamp:R0},W2={"tag:yaml.org,2002:binary":M0,"tag:yaml.org,2002:merge":p,"tag:yaml.org,2002:omap":N0,"tag:yaml.org,2002:pairs":b0,"tag:yaml.org,2002:set":j0,"tag:yaml.org,2002:timestamp":R0};function z$($,X,Z){let H=Q2.get(X);if(H&&!$)return Z&&!H.includes(p)?H.concat(p):H.slice();let U=H;if(!U)if(Array.isArray($))U=[];else{let z=Array.from(Q2.keys()).filter((G)=>G!=="yaml11").map((G)=>JSON.stringify(G)).join(", ");throw Error(`Unknown schema "${X}"; use one of ${z} or define customTags array`)}if(Array.isArray($))for(let z of $)U=U.concat(z);else if(typeof $==="function")U=$(U.slice());if(Z)U=U.concat(p);return U.reduce((z,G)=>{let Q=typeof G==="string"?B2[G]:G;if(!Q){let J=JSON.stringify(G),B=Object.keys(B2).map((R)=>JSON.stringify(R)).join(", ");throw Error(`Unknown custom tag ${J}; use one of ${B}`)}if(!z.includes(Q))z.push(Q);return z},[])}var d2=($,X)=>$.key<X.key?-1:$.key>X.key?1:0;class S0{constructor({compat:$,customTags:X,merge:Z,resolveKnownTags:H,schema:U,sortMapEntries:z,toStringDefaults:G}){this.compat=Array.isArray($)?z$($,"compat"):$?z$(null,$):null,this.name=typeof U==="string"&&U||"core",this.knownTags=H?W2:{},this.tags=z$(X,this.name,Z),this.toStringOptions=G??null,Object.defineProperty(this,x,{value:l}),Object.defineProperty(this,H0,{value:X0}),Object.defineProperty(this,a,{value:c}),this.sortMapEntries=typeof z==="function"?z:z===!0?d2:null}clone(){let $=Object.create(S0.prototype,Object.getOwnPropertyDescriptors(this));return $.tags=this.tags.slice(),$}}function V2($,X){let Z=[],H=X.directives===!0;if(X.directives!==!1&&$.directives){let J=$.directives.toString($);if(J)Z.push(J),H=!0;else if($.directives.docStart)H=!0}if(H)Z.push("---");let U=d0($,X),{commentString:z}=U.options;if($.commentBefore){if(Z.length!==1)Z.unshift("");let J=z($.commentBefore);Z.unshift(f(J,""))}let G=!1,Q=null;if($.contents){if(D($.contents)){if($.contents.spaceBefore&&H)Z.push("");if($.contents.commentBefore){let R=z($.contents.commentBefore);Z.push(f(R,""))}U.forceBlockIndent=!!$.comment,Q=$.contents.comment}let J=Q?void 0:()=>G=!0,B=t($.contents,U,()=>Q=null,J);if(Q)B+=n(B,"",z(Q));if((B[0]==="|"||B[0]===">")&&Z[Z.length-1]==="---")Z[Z.length-1]=`--- ${B}`;else Z.push(B)}else Z.push(t($.contents,U));if($.directives?.docEnd)if($.comment){let J=z($.comment);if(J.includes(`
|
|
55
|
+
`))Z.push("..."),Z.push(f(J,""));else Z.push(`... ${J}`)}else Z.push("...");else{let J=$.comment;if(J&&G)J=J.replace(/^\n+/,"");if(J){if((!G||Q)&&Z[Z.length-1]!=="")Z.push("");Z.push(f(z(J),""))}}return Z.join(`
|
|
56
56
|
`)+`
|
|
57
|
-
`}class Q0{constructor($,X,Z){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,g,{value:g0});let H=null;if(typeof X==="function"||Array.isArray(X))H=X;else if(Z===void 0&&X)Z=X,X=void 0;let U=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},Z);this.options=U;let{version:
|
|
58
|
-
\r `);function S$($,X,Z){let H=null;if(typeof X==="function"||Array.isArray(X))H=X;else if(Z===void 0&&X)Z=X;if(typeof Z==="string")Z=Z.length;if(typeof Z==="number"){let U=Math.round(Z);Z=U<1?void 0:U>8?{indent:8}:{indent:U}}if($===void 0){let{keepUndefined:U}=Z??X??{};if(!U)return}if(m($)&&!H)return $.toString(Z);return new Q0($,H,Z).toString(Z)}var I2="https://faf.one/ext/context/v1";function J$($,X={}){return{faf:X.fafPointer??"./project.faf",mediaType:"application/vnd.faf+yaml",iana:"https://www.iana.org/assignments/media-types/application/vnd.faf+yaml",deterministic:!0,...X.scoreEndpoint?{scoreEndpoint:X.scoreEndpoint}:{},generated:$.generated??X.now??new Date().toISOString()}}function F2($,X={}){let Z={"one.faf/context":J$($,X)},H=new TextEncoder().encode(JSON.stringify(Z)).length;if(H>4096)throw Error(`publisher-provided _meta is ${H}B — exceeds the registry ${"4096"}B cap`);return{["io.modelcontextprotocol.registry/publisher-provided"]:Z}}var e2="JSONRPC",R2="1.0",g$=["application/vnd.faf+yaml","application/vnd.fafm+yaml","application/vnd.fafa+yaml"],$9="https://static.modelcontextprotocol.io/schemas/v1/server-card.schema.json",X9="https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",L2="1.0",O2="1.0",C$={a2a:"application/a2a-agent-card+json",server_card:"application/mcp-server-card+json",fafa:"application/vnd.fafa+yaml"};function Z9($){return($.endpoints??[]).filter((X)=>String(X.protocol??"").toLowerCase()==="a2a"&&X.location)}function _2($,X={}){let Z=Z9($);if(Z.length>0)return Z;let H=X.doorUrl?.trim();if(H)return[{protocol:"a2a",location:H,version:R2}];return[]}function H9($){try{return`https://${C0($)}/.well-known/fafa`}catch{return}}function U9($,X,Z={}){let H=J$(X,Z),U=$.agent??{},G={fafaSpecVersion:String($.version??O2),mediaTypes:[...g$],provenance:{faf:H.faf,mediaType:H.mediaType},generated:H.generated};if(U.id)G.agentId=U.id;let z=H9($);if(z)G.passport=z;return{uri:I2,description:"FAF passport and project DNA as typed parts",required:!1,params:G}}function G9($){let X=new Set;for(let Z of $.capabilities??[])if(Z.cites_spec&&g$.includes(Z.cites_spec))X.add(Z.cites_spec);return["text/plain",...X]}function z9($,X={}){let Z=$.agent??{},H=_2($,X);if(H.length===0)throw Error("No A2A endpoint in .fafa (need endpoints[].protocol: a2a + location). Will not invent a door.");let U=String(Z.displayName??$.metadata?.persona??Z.name??"").trim(),G=String(Z.description??"").trim(),z=String(Z.version??"").trim();if(!U||!G||!z)throw Error("A2A card needs agent.displayName|name, description, version in .fafa");let Q=String(Z.vendor??"").trim(),J=String(Z.homepage??"").trim(),B=Q&&J?{organization:Q,url:J}:void 0,R=($.capabilities??[]).map((W)=>{let T=String(W.name??"").trim();if(!T)throw Error("A2A skill missing capabilities[].name");let Y=Array.isArray(W.tags)?W.tags.map(String):[],L=W.cites_spec&&g$.includes(W.cites_spec)?[W.cites_spec,"text/plain"]:void 0;return{id:T,name:T,description:String(W.description??"").trim()||T,tags:Y,...L?{inputModes:L}:{}}});return{name:U,description:G,supportedInterfaces:H.map((W)=>({url:String(W.location),protocolBinding:e2,protocolVersion:String(W.version??R2)})),...B?{provider:B}:{},version:z,capabilities:{streaming:!1,pushNotifications:!1,extendedAgentCard:!1,extensions:[...X.extensions??[]]},defaultInputModes:G9($),defaultOutputModes:["text/plain","application/json"],skills:R}}var J9=/^[a-z0-9][a-z0-9._-]*$/,Q9=/^(@[a-z0-9~][a-z0-9-._~]*\/)?[a-z0-9~][a-z0-9-._~]*$/,B9=/^[A-Za-z0-9]([A-Za-z0-9._-]*[A-Za-z0-9])?$/,W9=/^[A-Za-z0-9][^\s]*$/,V9=["a2a","mcp"],q9=/^(?=.{1,253}$)([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,}$/;function q($){return String($??"").trim()}function Q$($){return Array.isArray($)?$.map(q).filter(Boolean):[]}function T9($){return q($).toLowerCase().replace(/^https?:\/\//,"").replace(/\/.*$/,"").replace(/^www\./,"")}function Y9($,X,Z){let H=["display_name","description","version"].filter((U)=>!q($[U]));if(H.length)throw Error(`Missing answer: ${H.join(", ")}`);if(!J9.test(X))throw Error("Short name: lowercase letters, digits, dots, hyphens or underscores.");if(!q9.test(Z))throw Error(`Domain "${$.domain}" is not a domain name (e.g. example.com).`)}function I9($,X){return($.skills??[]).filter((Z)=>q(Z.name)).map((Z)=>({name:q(Z.name),type:q(Z.type)||"tool",description:q(Z.description)||q(Z.name),tags:X.length?X:[q(Z.name).toLowerCase()]}))}function F9($){let X=($.packages??[]).filter((Z)=>q(Z.registryType)&&q(Z.identifier));for(let Z of X){let H=q(Z.registryType),U=q(Z.identifier);if(H==="npm"&&!Q9.test(U))throw Error(`Package "${U}" is not an npm package name (e.g. weather-mcp or @acme/weather).`);if(H==="pypi"&&!B9.test(U))throw Error(`Package "${U}" is not a PyPI package name (e.g. weather-mcp or weather_mcp).`);if(H!=="npm"&&H!=="pypi"&&!W9.test(U))throw Error(`Package "${U}" is not a ${H} package identifier: it must start with a letter or digit and have no spaces.`)}return X.map((Z)=>({registryType:q(Z.registryType),identifier:q(Z.identifier),...q(Z.version)?{version:q(Z.version)}:{}}))}function R9($){if(/\s/.test($))return!1;try{let X=new URL($);return(X.protocol==="http:"||X.protocol==="https:")&&X.hostname!==""}catch{return!1}}function L9($){if(!R9(q($.url)))throw Error(`Where it runs: "${q($.url)}" is not an http(s) URL (or give an npm package).`);if(!V9.includes(q($.protocol).toLowerCase()))throw Error(`Protocol "${q($.protocol)}": a2a or mcp.`)}function O9($,X){let Z=($.endpoints??[]).filter((U)=>q(U.url));Z.forEach(L9);let H=[...Z.map((U)=>({protocol:q(U.protocol).toLowerCase(),transport:"http",location:q(U.url)})),...X.map((U)=>({protocol:"mcp",transport:"stdio",location:U.identifier}))];if(H.length===0)throw Error("Missing answer: endpoints (a URL, or a package people install)");return H}function _9($,X,Z,H){let U={domain:X},G=[["repository",q($.repository)],["icon",q($.icon)],["organizationUrl",q($.organization_url)]];for(let[Q,J]of G)if(J)U[Q]=J;if(Z.length)U.keywords=Z;let z=Q$($.example_requests);if(z.length)U.examples=z;if(H.length)U.packages=H;return U}function D9($){let X=q($.handle).toLowerCase(),Z=T9($.domain);Y9($,X,Z);let H=Q$($.tags),U=F9($),G={name:X,displayName:q($.display_name),id:`urn:air:${Z}:agent:${X}`,...q($.organization)?{vendor:q($.organization)}:{},version:q($.version),description:q($.description),homepage:q($.homepage)||`https://${Z}`,...q($.license)?{license:q($.license)}:{}};return{version:O2,agent:G,capabilities:I9($,H),endpoints:O9($,U),metadata:{cards:_9($,Z,H,U)}}}function K9($){return S$($,{lineWidth:0})}function C0($){let X=q($.agent?.id),Z=/^urn:air:([^:]+):/.exec(X);if(Z)return Z[1];let H=q($.metadata?.cards?.domain);if(H)return H;try{return new URL(q($.agent?.homepage)).hostname.replace(/^www\./,"")}catch{throw Error("The .fafa names no domain (agent.id urn:air, metadata.cards.domain or agent.homepage).")}}function h6($){return y$($)}function y$($){let X=q($.agent?.name).toLowerCase().replace(/[^a-z0-9._-]/g,"-").replace(/^-+|-+$/g,"");if(!X)throw Error("The .fafa needs agent.name (the short name).");return X}function D2($){return`${C0($).split(".").reverse().join(".")}/${y$($)}`}function E$($){let X=$.replace(/\s+/g," ").trim();return X.length<=100?X:`${X.slice(0,97).trimEnd()}...`}function B$($){return($.endpoints??[]).filter((X)=>q(X.protocol).toLowerCase()==="mcp"&&/^https?:\/\//.test(q(X.location))).map((X)=>({type:"streamable-http",url:q(X.location)}))}function w9($){if(!$)return;try{let X=new URL($).hostname.replace(/^www\./,"");return{url:$,source:X.split(".")[0]}}catch{return}}function K2($){let X=$.agent??{},Z=$.metadata?.cards??{},H=q(X.description),U=q(X.version);if(!H||!U)throw Error("An MCP card needs agent.description and agent.version in .fafa");let G={name:D2($),version:U,description:E$(H)},z=q(X.displayName);if(z)G.title=E$(z);let Q=q(X.homepage);if(Q)G.websiteUrl=Q;let J=w9(q(Z.repository));if(J)G.repository=J;if(q(Z.icon))G.icons=[{src:q(Z.icon)}];return G}function w2($){return($.metadata?.cards?.packages??[]).map((X)=>({registryType:q(X.registryType),identifier:q(X.identifier),...q(X.version)?{version:q(X.version)}:{},transport:{type:"stdio"}}))}function k6($){return B$($).length>0||w2($).length>0}function x6($){let X=q($.agent?.displayName);return{name:D2($),...X?{title:E$(X)}:{}}}function P9($,X,Z={}){let H=B$($);if(H.length===0)throw Error("A Server Card describes a remote MCP server: the .fafa has no mcp endpoint at an http(s) URL.");return{$schema:$9,...K2($),remotes:H,...X?{_meta:{"one.faf/context":J$(X,Z)}}:{}}}function M9($,X,Z={}){let H=B$($),U=w2($);if(H.length===0&&U.length===0)throw Error("A registry entry needs a package people install or a remote MCP URL.");return{$schema:X9,...K2($),...U.length?{packages:U}:{},...H.length?{remotes:H}:{},...X?{_meta:F2(X,Z)}:{}}}function b9($,X,Z){if(!X.includes("a2a")||_2($,Z).length===0)return;return Z.a2aCardUrl??`https://${C0($)}/.well-known/agent-card.json`}function P2($,X,Z={}){let H=C0($),U=y$($),G=$.agent??{},z=q(G.displayName)||q(G.name),Q=q(G.description),J=q(G.version),B=Z.now??new Date().toISOString(),R=(Y,L,V)=>({identifier:`urn:air:${H}:${Y}:${U}`,displayName:z,type:L,description:Q,url:V,...J?{version:J}:{},updatedAt:B}),W=[],T=b9($,X,Z);if(T)W.push(R("a2a",C$.a2a,T));if(X.includes("server_card")){let Y=B$($)[0];if(Y)W.push(R("mcp",C$.server_card,`${Y.url.replace(/\/+$/,"")}/server-card`))}if(Z.listFafa!==!1)W.push(R("agent",C$.fafa,`https://${H}/.well-known/fafa`));return W}function M2($){let X=$.agent??{},Z=q(X.vendor)||q(X.displayName)||q(X.name);if(!Z)return;let H;try{H=C0($)}catch{H=void 0}return{displayName:Z,...H?{identifier:H}:{}}}function A9($,X,Z={}){let H=M2($);return{specVersion:L2,...H?{host:H}:{},entries:P2($,X,Z)}}function N9($){let X=$.metadata?.cards??{},Z=Q$(X.keywords),H=Q$(X.examples);return{...Z.length?{tags:Z}:{},...H.length?{representativeQueries:H}:{}}}function j9($,X,Z={}){let H=M2($),U=N9($);return{specVersion:L2,...H?{host:H}:{},entries:P2($,X,Z).map((G)=>({...G,...U}))}}function S9($,X){let Z=new Set(X.cards),H={fafa:$,fafaText:K9($)},{faf:U}=X;if(Z.has("a2a")){let z=[...X.a2aExtensions??[],...U?[U9($,U,X)]:[]];H.a2a=z9($,{extensions:z})}if(Z.has("server_card"))H.server_card=P9($,U,X);if(Z.has("server_json"))H.server_json=M9($,U,X);let G={now:X.now,listFafa:X.listFafa};if(Z.has("ai_catalog"))H.ai_catalog=A9($,X.cards,G);if(Z.has("ard"))H.ard=j9($,X.cards,G);return H}function u6($,X){return S9(D9($),X)}export{x6 as registryIdentity,M9 as projectServerJson,P9 as projectServerCard,S9 as projectPack,j9 as projectArd,A9 as projectAiCatalog,z9 as projectA2ACard,B$ as mcpRemotes,D2 as mcpName,k6 as hasRegistryEntry,K9 as fafaYaml,h6 as fafaHandle,C0 as fafaDomain,U9 as fafaContextExtension,P2 as catalogRows,M2 as catalogHost,u6 as buildPack,N9 as ardHints,D9 as answersToFafa,Z9 as a2aEndpoints,_2 as a2aDoors,X9 as SERVER_JSON_SCHEMA,$9 as SERVER_CARD_SCHEMA,g$ as FAF_MEDIA_TYPES,O2 as FAFA_SPEC_VERSION,C$ as CARD_MEDIA_TYPES,L2 as AI_CATALOG_SPEC_VERSION,R2 as A2A_PROTOCOL_VERSION,e2 as A2A_PROTOCOL_BINDING};
|
|
57
|
+
`}class Q0{constructor($,X,Z){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,g,{value:g0});let H=null;if(typeof X==="function"||Array.isArray(X))H=X;else if(Z===void 0&&X)Z=X,X=void 0;let U=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},Z);this.options=U;let{version:z}=U;if(Z?._directives){if(this.directives=Z._directives.atDocument(),this.directives.yaml.explicit)z=this.directives.yaml.version}else this.directives=new S({version:z});this.setSchema(z,Z),this.contents=$===void 0?null:this.createNode($,H,Z)}clone(){let $=Object.create(Q0.prototype,{[g]:{value:g0}});if($.commentBefore=this.commentBefore,$.comment=this.comment,$.errors=this.errors.slice(),$.warnings=this.warnings.slice(),$.options=Object.assign({},this.options),this.directives)$.directives=this.directives.clone();if($.schema=this.schema.clone(),$.contents=D(this.contents)?this.contents.clone($.schema):this.contents,this.range)$.range=this.range.slice();return $}add($){if(L0(this.contents))this.contents.add($)}addIn($,X){if(L0(this.contents))this.contents.addIn($,X)}createAlias($,X){if(!$.anchor){let Z=V$(this);$.anchor=!X||Z.has(X)?q$(X||"a",Z):X}return new z0($.anchor)}createNode($,X,Z){let H=void 0;if(typeof X==="function")$=X.call({"":$},"",$),H=X;else if(Array.isArray(X)){let V=(P)=>typeof P==="number"||P instanceof String||P instanceof Number,I=X.filter(V).map(String);if(I.length>0)X=X.concat(I);H=X}else if(Z===void 0&&X)Z=X,X=void 0;let{aliasDuplicateObjects:U,anchorPrefix:z,flow:G,keepUndefined:Q,onTagObj:J,tag:B}=Z??{},{onAnchor:R,setAnchors:W,sourceObjects:T}=v$(this,z||"a"),Y={aliasDuplicateObjects:U??!0,keepUndefined:Q??!1,onAnchor:R,onTagObj:J,replacer:H,schema:this.schema,sourceObjects:T},L=o($,B,Y);if(G&&w(L))L.flow=!0;return W(),L}createPair($,X,Z={}){let H=this.createNode($,null,Z),U=this.createNode(X,null,Z);return new j(H,U)}delete($){return L0(this.contents)?this.contents.delete($):!1}deleteIn($){if(q0($)){if(this.contents==null)return!1;return this.contents=null,!0}return L0(this.contents)?this.contents.deleteIn($):!1}get($,X){return w(this.contents)?this.contents.get($,X):void 0}getIn($,X){if(q0($))return!X&&O(this.contents)?this.contents.value:this.contents;return w(this.contents)?this.contents.getIn($,X):void 0}has($){return w(this.contents)?this.contents.has($):!1}hasIn($){if(q0($))return this.contents!==void 0;return w(this.contents)?this.contents.hasIn($):!1}set($,X){if(this.contents==null)this.contents=_0(this.schema,[$],X);else if(L0(this.contents))this.contents.set($,X)}setIn($,X){if(q0($))this.contents=X;else if(this.contents==null)this.contents=_0(this.schema,Array.from($),X);else if(L0(this.contents))this.contents.setIn($,X)}setSchema($,X={}){if(typeof $==="number")$=String($);let Z;switch($){case"1.1":if(this.directives)this.directives.yaml.version="1.1";else this.directives=new S({version:"1.1"});Z={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":if(this.directives)this.directives.yaml.version=$;else this.directives=new S({version:$});Z={resolveKnownTags:!0,schema:"core"};break;case null:if(this.directives)delete this.directives;Z=null;break;default:{let H=JSON.stringify($);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${H}`)}}if(X.schema instanceof Object)this.schema=X.schema;else if(Z)this.schema=new S0(Object.assign(Z,X));else throw Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:$,jsonArg:X,mapAsMap:Z,maxAliasCount:H,onAnchor:U,reviver:z}={}){let G={anchors:new Map,doc:this,keep:!$,mapAsMap:Z===!0,mapKeyWarned:!1,maxAliasCount:typeof H==="number"?H:100},Q=A(this.contents,X??"",G);if(typeof U==="function")for(let{count:J,res:B}of G.anchors.values())U(B,J);return typeof z==="function"?e(z,{"":Q},"",Q):Q}toJSON($,X){return this.toJS({json:!0,jsonArg:$,mapAsMap:!1,onAnchor:X})}toString($={}){if(this.errors.length>0)throw Error("Document with errors cannot be stringified");if("indent"in $&&(!Number.isInteger($.indent)||Number($.indent)<=0)){let X=JSON.stringify($.indent);throw Error(`"indent" option must be a positive integer, not ${X}`)}return V2(this,$)}}function L0($){if(w($))return!0;throw Error("Expected a YAML collection as document contents")}var j$=Symbol("break visit"),n2=Symbol("skip children"),T2=Symbol("remove item");function B0($,X){if("type"in $&&$.type==="document")$={start:$.start,value:$.value};Y2(Object.freeze([]),$,X)}B0.BREAK=j$;B0.SKIP=n2;B0.REMOVE=T2;B0.itemAtPath=($,X)=>{let Z=$;for(let[H,U]of X){let z=Z?.[H];if(z&&"items"in z)Z=z.items[U];else return}return Z};B0.parentCollection=($,X)=>{let Z=B0.itemAtPath($,X.slice(0,-1)),H=X[X.length-1][0],U=Z?.[H];if(U&&"items"in U)return U;throw Error("Parent collection not found")};function Y2($,X,Z){let H=Z(X,$);if(typeof H==="symbol")return H;for(let U of["key","value"]){let z=X[U];if(z&&"items"in z){for(let G=0;G<z.items.length;++G){let Q=Y2(Object.freeze($.concat([[U,G]])),z.items[G],Z);if(typeof Q==="number")G=Q-1;else if(Q===j$)return j$;else if(Q===T2)z.items.splice(G,1),G-=1}if(typeof H==="function"&&U==="key")H=H(X,$)}}return typeof H==="function"?H(X,$):H}var o5=new Set("0123456789ABCDEFabcdef"),t5=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),e5=new Set(",[]{}"),$6=new Set(` ,[]{}
|
|
58
|
+
\r `);function S$($,X,Z){let H=null;if(typeof X==="function"||Array.isArray(X))H=X;else if(Z===void 0&&X)Z=X;if(typeof Z==="string")Z=Z.length;if(typeof Z==="number"){let U=Math.round(Z);Z=U<1?void 0:U>8?{indent:8}:{indent:U}}if($===void 0){let{keepUndefined:U}=Z??X??{};if(!U)return}if(m($)&&!H)return $.toString(Z);return new Q0($,H,Z).toString(Z)}var I2="https://faf.one/ext/context/v1";function J$($,X={}){return{faf:X.fafPointer??"./project.faf",mediaType:"application/vnd.faf+yaml",iana:"https://www.iana.org/assignments/media-types/application/vnd.faf+yaml",deterministic:!0,...X.scoreEndpoint?{scoreEndpoint:X.scoreEndpoint}:{},generated:$.generated??X.now??new Date().toISOString()}}function F2($,X={}){let Z={"one.faf/context":J$($,X)},H=new TextEncoder().encode(JSON.stringify(Z)).length;if(H>4096)throw Error(`publisher-provided _meta is ${H}B — exceeds the registry ${"4096"}B cap`);return{["io.modelcontextprotocol.registry/publisher-provided"]:Z}}var X9="JSONRPC",R2="1.0",g$=["application/vnd.faf+yaml","application/vnd.fafm+yaml","application/vnd.fafa+yaml"],Z9="https://static.modelcontextprotocol.io/schemas/v1/server-card.schema.json",H9="https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",L2="1.0",O2="1.0",C$={a2a:"application/a2a-agent-card+json",server_card:"application/mcp-server-card+json",fafa:"application/vnd.fafa+yaml"};function U9($){return($.endpoints??[]).filter((X)=>String(X.protocol??"").toLowerCase()==="a2a"&&X.location)}function _2($,X={}){let Z=U9($);if(Z.length>0)return Z;let H=X.doorUrl?.trim();if(H)return[{protocol:"a2a",location:H,version:R2}];return[]}function z9($){try{return`https://${C0($)}/.well-known/fafa`}catch{return}}function G9($,X,Z={}){let H=J$(X,Z),U=$.agent??{},z={fafaSpecVersion:String($.version??O2),mediaTypes:[...g$],provenance:{faf:H.faf,mediaType:H.mediaType},generated:H.generated};if(U.id)z.agentId=U.id;let G=z9($);if(G)z.passport=G;return{uri:I2,description:"FAF passport and project DNA as typed parts",required:!1,params:z}}function J9($){let X=new Set;for(let Z of $.capabilities??[])if(Z.cites_spec&&g$.includes(Z.cites_spec))X.add(Z.cites_spec);return["text/plain",...X]}function Q9($,X={}){let Z=$.agent??{},H=_2($,X);if(H.length===0)throw Error("No A2A endpoint in .fafa (need endpoints[].protocol: a2a + location). Will not invent a door.");let U=String(Z.displayName??$.metadata?.persona??Z.name??"").trim(),z=String(Z.description??"").trim(),G=String(Z.version??"").trim();if(!U||!z||!G)throw Error("A2A card needs agent.displayName|name, description, version in .fafa");let Q=String(Z.vendor??"").trim(),J=String(Z.homepage??"").trim(),B=Q&&J?{organization:Q,url:J}:void 0,R=($.capabilities??[]).map((W)=>{let T=String(W.name??"").trim();if(!T)throw Error("A2A skill missing capabilities[].name");let Y=Array.isArray(W.tags)?W.tags.map(String):[],L=W.cites_spec&&g$.includes(W.cites_spec)?[W.cites_spec,"text/plain"]:void 0;return{id:T,name:T,description:String(W.description??"").trim()||T,tags:Y,...L?{inputModes:L}:{}}});return{name:U,description:z,supportedInterfaces:H.map((W)=>({url:String(W.location),protocolBinding:X9,protocolVersion:String(W.version??R2)})),...B?{provider:B}:{},version:G,capabilities:{streaming:!1,pushNotifications:!1,extendedAgentCard:!1,extensions:[...X.extensions??[]]},defaultInputModes:J9($),defaultOutputModes:["text/plain","application/json"],skills:R}}var B9=["mcp","cli","library"],W9=/^[a-z0-9][a-z0-9._-]*$/,V9=/^(@[a-z0-9~][a-z0-9-._~]*\/)?[a-z0-9~][a-z0-9-._~]*$/,q9=/^[A-Za-z0-9]([A-Za-z0-9._-]*[A-Za-z0-9])?$/,T9=/^[A-Za-z0-9][^\s]*$/,Y9=/^[A-Za-z][A-Za-z0-9_-]{0,63}$/,I9=["a2a","mcp"],F9=/^(?=.{1,253}$)([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,}$/;function q($){return String($??"").trim()}function Q$($){return Array.isArray($)?$.map(q).filter(Boolean):[]}function R9($){return q($).toLowerCase().replace(/^https?:\/\//,"").replace(/\/.*$/,"").replace(/^www\./,"")}function L9($,X,Z){let H=["display_name","description","version"].filter((U)=>!q($[U]));if(H.length)throw Error(`Missing answer: ${H.join(", ")}`);if(!W9.test(X))throw Error("Short name: lowercase letters, digits, dots, hyphens or underscores.");if(!F9.test(Z))throw Error(`Domain "${$.domain}" is not a domain name (e.g. example.com).`)}function O9($,X){return($.skills??[]).filter((Z)=>q(Z.name)).map((Z)=>({name:q(Z.name),type:q(Z.type)||"tool",description:q(Z.description)||q(Z.name),tags:X.length?X:[q(Z.name).toLowerCase()]}))}function _9($){let X=($.packages??[]).filter((Z)=>q(Z.registryType)&&q(Z.identifier));for(let Z of X){let H=q(Z.registryType),U=q(Z.identifier);if(H==="npm"&&!V9.test(U))throw Error(`Package "${U}" is not an npm package name (e.g. weather-mcp or @acme/weather).`);if(H==="pypi"&&!q9.test(U))throw Error(`Package "${U}" is not a PyPI package name (e.g. weather-mcp or weather_mcp).`);if(H==="cargo"&&!Y9.test(U))throw Error(`Package "${U}" is not a crate name (e.g. weather-mcp or weather_mcp).`);if(H!=="npm"&&H!=="pypi"&&H!=="cargo"&&!T9.test(U))throw Error(`Package "${U}" is not a ${H} package identifier: it must start with a letter or digit and have no spaces.`)}return X.map((Z)=>({registryType:q(Z.registryType),identifier:q(Z.identifier),...q(Z.version)?{version:q(Z.version)}:{}}))}function D2($){if(/\s/.test($))return!1;try{let X=new URL($);return(X.protocol==="http:"||X.protocol==="https:")&&X.hostname!==""}catch{return!1}}function D9($){if(!D2(q($.url)))throw Error(`Where it runs: "${q($.url)}" is not an http(s) URL (or give an npm package).`);if(!I9.includes(q($.protocol).toLowerCase()))throw Error(`Protocol "${q($.protocol)}": a2a or mcp.`)}function K9($){let X=q($.package_kind).toLowerCase()||"mcp";if(!B9.includes(X))throw Error(`Kind "${q($.package_kind)}" is not one faf knows: mcp, cli or library.`);return X}function w9($,X){let Z=($.endpoints??[]).filter((z)=>q(z.url));Z.forEach(D9);let H=K9($),U=[...Z.map((z)=>({protocol:q(z.protocol).toLowerCase(),transport:"http",location:q(z.url)})),...X.map((z)=>({protocol:H,transport:"stdio",location:z.identifier}))];if(U.length===0)throw Error("Missing answer: endpoints (a URL, or a package people install)");return U}function P9($,X,Z,H){let U={domain:X},z=[["repository",q($.repository)],["icon",q($.icon)],["organizationUrl",q($.organization_url)]];for(let[Q,J]of z)if(J)U[Q]=J;if(Z.length)U.keywords=Z;let G=Q$($.example_requests);if(G.length)U.examples=G;if(H.length)U.packages=H;return U}function M9($){let X=q($.handle).toLowerCase(),Z=R9($.domain);L9($,X,Z);let H=Q$($.tags),U=_9($),z=q($.homepage);if(z&&!D2(z))throw Error(`Homepage: "${z}" is not an http(s) URL.`);let G={name:X,displayName:q($.display_name),id:`urn:air:${Z}:agent:${X}`,...q($.organization)?{vendor:q($.organization)}:{},version:q($.version),description:q($.description),homepage:z||`https://${Z}`,...q($.license)?{license:q($.license)}:{}};return{version:O2,agent:G,capabilities:O9($,H),endpoints:w9($,U),metadata:{cards:P9($,Z,H,U)}}}function b9($){return S$($,{lineWidth:0})}function C0($){let X=q($.agent?.id),Z=/^urn:air:([^:]+):/.exec(X);if(Z)return Z[1];let H=q($.metadata?.cards?.domain);if(H)return H;try{return new URL(q($.agent?.homepage)).hostname.replace(/^www\./,"")}catch{throw Error("The .fafa names no domain (agent.id urn:air, metadata.cards.domain or agent.homepage).")}}function m6($){return y$($)}function y$($){let X=q($.agent?.name).toLowerCase().replace(/[^a-z0-9._-]/g,"-").replace(/^-+|-+$/g,"");if(!X)throw Error("The .fafa needs agent.name (the short name).");return X}function K2($){return`${C0($).split(".").reverse().join(".")}/${y$($)}`}function E$($){let X=$.replace(/\s+/g," ").trim();return X.length<=100?X:`${X.slice(0,97).trimEnd()}...`}function B$($){return($.endpoints??[]).filter((X)=>q(X.protocol).toLowerCase()==="mcp"&&/^https?:\/\//.test(q(X.location))).map((X)=>({type:"streamable-http",url:q(X.location)}))}function N9($){if(!$)return;try{let X=new URL($).hostname.replace(/^www\./,"");return{url:$,source:X.split(".")[0]}}catch{return}}function w2($){let X=$.agent??{},Z=$.metadata?.cards??{},H=q(X.description),U=q(X.version);if(!H||!U)throw Error("An MCP card needs agent.description and agent.version in .fafa");let z={name:K2($),version:U,description:E$(H)},G=q(X.displayName);if(G)z.title=E$(G);let Q=q(X.homepage);if(Q)z.websiteUrl=Q;let J=N9(q(Z.repository));if(J)z.repository=J;if(q(Z.icon))z.icons=[{src:q(Z.icon)}];return z}function P2($){return($.metadata?.cards?.packages??[]).map((X)=>({registryType:q(X.registryType),identifier:q(X.identifier),...q(X.version)?{version:q(X.version)}:{},transport:{type:"stdio"}}))}function M2($){return($.endpoints??[]).some((X)=>q(X.protocol).toLowerCase()==="mcp")}function v6($){return M2($)&&(B$($).length>0||P2($).length>0)}function d6($){let X=q($.agent?.displayName);return{name:K2($),...X?{title:E$(X)}:{}}}function A9($,X,Z={}){let H=B$($);if(H.length===0)throw Error("A Server Card describes a remote MCP server: the .fafa has no mcp endpoint at an http(s) URL.");return{$schema:Z9,...w2($),remotes:H,...X?{_meta:{"one.faf/context":J$(X,Z)}}:{}}}function j9($,X,Z={}){let H=B$($),U=P2($);if(H.length===0&&U.length===0)throw Error("A registry entry needs a package people install or a remote MCP URL.");if(!M2($))throw Error("A registry entry describes an MCP server: the .fafa has no mcp endpoint.");return{$schema:H9,...w2($),...U.length?{packages:U}:{},...H.length?{remotes:H}:{},...X?{_meta:F2(X,Z)}:{}}}function S9($,X,Z){if(!X.includes("a2a")||_2($,Z).length===0)return;return Z.a2aCardUrl??`https://${C0($)}/.well-known/agent-card.json`}function b2($,X,Z={}){let H=C0($),U=y$($),z=$.agent??{},G=q(z.displayName)||q(z.name),Q=q(z.description),J=q(z.version),B=Z.now??new Date().toISOString(),R=(Y,L,V)=>({identifier:`urn:air:${H}:${Y}:${U}`,displayName:G,type:L,description:Q,url:V,...J?{version:J}:{},updatedAt:B}),W=[],T=S9($,X,Z);if(T)W.push(R("a2a",C$.a2a,T));if(X.includes("server_card")){let Y=B$($)[0];if(Y)W.push(R("mcp",C$.server_card,`${Y.url.replace(/\/+$/,"")}/server-card`))}if(Z.listFafa!==!1)W.push(R("agent",C$.fafa,`https://${H}/.well-known/fafa`));return W}function N2($){let X=$.agent??{},Z=q(X.vendor)||q(X.displayName)||q(X.name);if(!Z)return;let H;try{H=C0($)}catch{H=void 0}return{displayName:Z,...H?{identifier:H}:{}}}function C9($,X,Z={}){let H=N2($);return{specVersion:L2,...H?{host:H}:{},entries:b2($,X,Z)}}function E9($){let X=$.metadata?.cards??{},Z=Q$(X.keywords),H=Q$(X.examples);return{...Z.length?{tags:Z}:{},...H.length?{representativeQueries:H}:{}}}function g9($,X,Z={}){let H=N2($),U=E9($);return{specVersion:L2,...H?{host:H}:{},entries:b2($,X,Z).map((z)=>({...z,...U}))}}function y9($,X){let Z=new Set(X.cards),H={fafa:$,fafaText:b9($)},{faf:U}=X;if(Z.has("a2a")){let G=[...X.a2aExtensions??[],...U?[G9($,U,X)]:[]];H.a2a=Q9($,{extensions:G})}if(Z.has("server_card"))H.server_card=A9($,U,X);if(Z.has("server_json"))H.server_json=j9($,U,X);let z={now:X.now,listFafa:X.listFafa};if(Z.has("ai_catalog"))H.ai_catalog=C9($,X.cards,z);if(Z.has("ard"))H.ard=g9($,X.cards,z);return H}function p6($,X){return y9(M9($),X)}export{d6 as registryIdentity,j9 as projectServerJson,A9 as projectServerCard,y9 as projectPack,g9 as projectArd,C9 as projectAiCatalog,Q9 as projectA2ACard,B$ as mcpRemotes,K2 as mcpName,v6 as hasRegistryEntry,M2 as hasMcpEndpoint,b9 as fafaYaml,m6 as fafaHandle,C0 as fafaDomain,G9 as fafaContextExtension,b2 as catalogRows,N2 as catalogHost,p6 as buildPack,E9 as ardHints,M9 as answersToFafa,U9 as a2aEndpoints,_2 as a2aDoors,H9 as SERVER_JSON_SCHEMA,Z9 as SERVER_CARD_SCHEMA,B9 as PACKAGE_KINDS,g$ as FAF_MEDIA_TYPES,O2 as FAFA_SPEC_VERSION,C$ as CARD_MEDIA_TYPES,L2 as AI_CATALOG_SPEC_VERSION,R2 as A2A_PROTOCOL_VERSION,X9 as A2A_PROTOCOL_BINDING};
|
|
59
59
|
|
|
60
|
-
//# debugId=
|
|
60
|
+
//# debugId=46757751ED8F3A4364756E2164756E21
|
|
61
61
|
//# sourceMappingURL=pack.js.map
|