house-lights 1.9.0 → 1.9.2
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/package.json +1 -1
- package/skills/cast-list/assets/map.html +24 -24
- package/skills/cast-list/assets/playbill.html +33 -16
- package/skills/cast-list/assets/plot.html +11 -11
- package/skills/cast-list/scripts/engine.mjs +82 -82
- /package/skills/cast-list/examples/avaliacoes/{Evaluate Bodega Azul - Frete 2026-10-30.csv → evaluate-bodega-azul-frete-2026-10-30.csv} +0 -0
- /package/skills/cast-list/examples/avaliacoes/{Evaluate Bodega Azul - Pedidos 2026-10-30.csv → evaluate-bodega-azul-pedidos-2026-10-30.csv} +0 -0
|
@@ -1,76 +1,76 @@
|
|
|
1
1
|
// GENERATED by tools/assets.mjs (way engine v0.259.0). Do not edit.
|
|
2
2
|
import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
|
|
3
|
-
var
|
|
4
|
-
`)}};
|
|
5
|
-
`)?
|
|
3
|
+
var Ic=Object.create;var Ri=Object.defineProperty;var Rc=Object.getOwnPropertyDescriptor;var Fc=Object.getOwnPropertyNames;var jc=Object.getPrototypeOf,Dc=Object.prototype.hasOwnProperty;var $n=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var R=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var _c=(e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Fc(t))!Dc.call(e,r)&&r!==n&&Ri(e,r,{get:()=>t[r],enumerable:!(s=Rc(t,r))||s.enumerable});return e};var Fs=(e,t,n)=>(n=e!=null?Ic(jc(e)):{},_c(t||!e||!e.__esModule?Ri(n,"default",{value:e,enumerable:!0}):n,e));var Z=R(me=>{"use strict";var _s=Symbol.for("yaml.alias"),Ui=Symbol.for("yaml.document"),Sn=Symbol.for("yaml.map"),Wi=Symbol.for("yaml.pair"),Bs=Symbol.for("yaml.scalar"),On=Symbol.for("yaml.seq"),je=Symbol.for("yaml.node.type"),Xc=e=>!!e&&typeof e=="object"&&e[je]===_s,Qc=e=>!!e&&typeof e=="object"&&e[je]===Ui,Zc=e=>!!e&&typeof e=="object"&&e[je]===Sn,ef=e=>!!e&&typeof e=="object"&&e[je]===Wi,Yi=e=>!!e&&typeof e=="object"&&e[je]===Bs,tf=e=>!!e&&typeof e=="object"&&e[je]===On;function zi(e){if(e&&typeof e=="object")switch(e[je]){case Sn:case On:return!0}return!1}function nf(e){if(e&&typeof e=="object")switch(e[je]){case _s:case Sn:case Bs:case On:return!0}return!1}var sf=e=>(Yi(e)||zi(e))&&!!e.anchor;me.ALIAS=_s;me.DOC=Ui;me.MAP=Sn;me.NODE_TYPE=je;me.PAIR=Wi;me.SCALAR=Bs;me.SEQ=On;me.hasAnchor=sf;me.isAlias=Xc;me.isCollection=zi;me.isDocument=Qc;me.isMap=Zc;me.isNode=nf;me.isPair=ef;me.isScalar=Yi;me.isSeq=tf});var Ct=R(Ks=>{"use strict";var de=Z(),ve=Symbol("break visit"),Vi=Symbol("skip children"),Me=Symbol("remove node");function An(e,t){let n=Ji(t);de.isDocument(e)?ct(null,e.contents,n,Object.freeze([e]))===Me&&(e.contents=null):ct(null,e,n,Object.freeze([]))}An.BREAK=ve;An.SKIP=Vi;An.REMOVE=Me;function ct(e,t,n,s){let r=Gi(e,t,n,s);if(de.isNode(r)||de.isPair(r))return Hi(e,s,r),ct(e,r,n,s);if(typeof r!="symbol"){if(de.isCollection(t)){s=Object.freeze(s.concat(t));for(let i=0;i<t.items.length;++i){let o=ct(i,t.items[i],n,s);if(typeof o=="number")i=o-1;else{if(o===ve)return ve;o===Me&&(t.items.splice(i,1),i-=1)}}}else if(de.isPair(t)){s=Object.freeze(s.concat(t));let i=ct("key",t.key,n,s);if(i===ve)return ve;i===Me&&(t.key=null);let o=ct("value",t.value,n,s);if(o===ve)return ve;o===Me&&(t.value=null)}}return r}async function Nn(e,t){let n=Ji(t);de.isDocument(e)?await ft(null,e.contents,n,Object.freeze([e]))===Me&&(e.contents=null):await ft(null,e,n,Object.freeze([]))}Nn.BREAK=ve;Nn.SKIP=Vi;Nn.REMOVE=Me;async function ft(e,t,n,s){let r=await Gi(e,t,n,s);if(de.isNode(r)||de.isPair(r))return Hi(e,s,r),ft(e,r,n,s);if(typeof r!="symbol"){if(de.isCollection(t)){s=Object.freeze(s.concat(t));for(let i=0;i<t.items.length;++i){let o=await ft(i,t.items[i],n,s);if(typeof o=="number")i=o-1;else{if(o===ve)return ve;o===Me&&(t.items.splice(i,1),i-=1)}}}else if(de.isPair(t)){s=Object.freeze(s.concat(t));let i=await ft("key",t.key,n,s);if(i===ve)return ve;i===Me&&(t.key=null);let o=await ft("value",t.value,n,s);if(o===ve)return ve;o===Me&&(t.value=null)}}return r}function Ji(e){return typeof e=="object"&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function Gi(e,t,n,s){if(typeof n=="function")return n(e,t,s);if(de.isMap(t))return n.Map?.(e,t,s);if(de.isSeq(t))return n.Seq?.(e,t,s);if(de.isPair(t))return n.Pair?.(e,t,s);if(de.isScalar(t))return n.Scalar?.(e,t,s);if(de.isAlias(t))return n.Alias?.(e,t,s)}function Hi(e,t,n){let s=t[t.length-1];if(de.isCollection(s))s.items[e]=n;else if(de.isPair(s))e==="key"?s.key=n:s.value=n;else if(de.isDocument(s))s.contents=n;else{let r=de.isAlias(s)?"alias":"scalar";throw new Error(`Cannot replace node with ${r} parent`)}}Ks.visit=An;Ks.visitAsync=Nn});var Us=R(Qi=>{"use strict";var Xi=Z(),rf=Ct(),of={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},af=e=>e.replace(/[!,[\]{}]/g,t=>of[t]),Pt=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,n){this.atNextDocument&&(this.yaml={explicit:e.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},e.defaultTags),this.atNextDocument=!1);let s=t.trim().split(/[ \t]+/),r=s.shift();switch(r){case"%TAG":{if(s.length!==2&&(n(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 n(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 n(6,`Unsupported YAML version ${i}`,o),!1}}default:return n(0,`Unknown directive ${r}`,!0),!1}}tagName(t,n){if(t==="!")return"!";if(t[0]!=="!")return n(`Not a valid tag: ${t}`),null;if(t[1]==="<"){let o=t.slice(2,-1);return o==="!"||o==="!!"?(n(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&n("Verbatim tags must end with a >"),o)}let[,s,r]=t.match(/^(.*!)([^!]*)$/s);r||n(`The ${t} tag has no suffix`);let i=this.tags[s];if(i)try{return i+decodeURIComponent(r)}catch(o){return n(String(o)),null}return s==="!"?t:(n(`Could not resolve tag: ${t}`),null)}tagString(t){for(let[n,s]of Object.entries(this.tags))if(t.startsWith(s))return n+af(t.substring(s.length));return t[0]==="!"?t:`!<${t}>`}toString(t){let n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],s=Object.entries(this.tags),r;if(t&&s.length>0&&Xi.isNode(t.contents)){let i={};rf.visit(t.contents,(o,a)=>{Xi.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:"||(!t||r.some(a=>a.startsWith(o)))&&n.push(`%TAG ${i} ${o}`);return n.join(`
|
|
4
|
+
`)}};Pt.defaultYaml={explicit:!1,version:"1.2"};Pt.defaultTags={"!!":"tag:yaml.org,2002:"};Qi.Directives=Pt});var En=R(qt=>{"use strict";var Zi=Z(),lf=Ct();function cf(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(n)}return!0}function eo(e){let t=new Set;return lf.visit(e,{Value(n,s){s.anchor&&t.add(s.anchor)}}),t}function to(e,t){for(let n=1;;++n){let s=`${e}${n}`;if(!t.has(s))return s}}function ff(e,t){let n=[],s=new Map,r=null;return{onAnchor:i=>{n.push(i),r??(r=eo(e));let o=to(t,r);return r.add(o),o},setAnchors:()=>{for(let i of n){let o=s.get(i);if(typeof o=="object"&&o.anchor&&(Zi.isScalar(o.node)||Zi.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}}qt.anchorIsValid=cf;qt.anchorNames=eo;qt.createNodeAnchors=ff;qt.findNewAnchor=to});var Ws=R(no=>{"use strict";function Lt(e,t,n,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=Lt(e,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=Lt(e,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=Lt(e,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=Lt(e,s,r,i);o===void 0?delete s[r]:o!==i&&(s[r]=o)}return e.call(t,n,s)}no.applyReviver=Lt});var Ke=R(ro=>{"use strict";var uf=Z();function so(e,t,n){if(Array.isArray(e))return e.map((s,r)=>so(s,String(r),n));if(e&&typeof e.toJSON=="function"){if(!n||!uf.hasAnchor(e))return e.toJSON(t,n);let s={aliasCount:0,count:1,res:void 0};n.anchors.set(e,s),n.onCreate=i=>{s.res=i,delete n.onCreate};let r=e.toJSON(t,n);return n.onCreate&&n.onCreate(r),r}return typeof e=="bigint"&&!n?.keep?Number(e):e}ro.toJS=so});var xn=R(oo=>{"use strict";var df=Ws(),io=Z(),pf=Ke(),Ys=class{constructor(t){Object.defineProperty(this,io.NODE_TYPE,{value:t})}clone(){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:n,maxAliasCount:s,onAnchor:r,reviver:i}={}){if(!io.isDocument(t))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:t,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof s=="number"?s:100},a=pf.toJS(this,"",o);if(typeof r=="function")for(let{count:c,res:f}of o.anchors.values())r(f,c);return typeof i=="function"?df.applyReviver(i,{"":a},"",a):a}};oo.NodeBase=Ys});var Mt=R(ao=>{"use strict";var hf=En(),mf=Ct(),ut=Z(),gf=xn(),yf=Ke(),zs=class extends gf.NodeBase{constructor(t){super(ut.ALIAS),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t,n){if(n?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let s;n?.aliasResolveCache?s=n.aliasResolveCache:(s=[],mf.visit(t,{Node:(i,o)=>{(ut.isAlias(o)||ut.hasAnchor(o))&&s.push(o)}}),n&&(n.aliasResolveCache=s));let r;for(let i of s){if(i===this)break;i.anchor===this.source&&(r=i)}if(r&&n){let{anchors:i,doc:o,maxAliasCount:a}=n,c=i.get(r);if(c||(yf.toJS(r,null,n),c=i.get(r)),c?.res===void 0){let f="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(f)}if(a>=0&&(c.count+=1,c.aliasCount===0&&(c.aliasCount=Tn(o,r,i)),c.count*c.aliasCount>a)){let f="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(f)}}return r}toJSON(t,n){if(!n)return{source:this.source};let s=this.resolve(n.doc,n);if(!s){let r=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(r)}return n.anchors.get(s).res}toString(t,n,s){let r=`*${this.source}`;if(t){if(hf.anchorIsValid(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){let i=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(i)}if(t.implicitKey)return`${r} `}return r}};function Tn(e,t,n){if(ut.isAlias(t)){let s=t.resolve(e),r=n&&s&&n.get(s);return r?r.count*r.aliasCount:0}else if(ut.isCollection(t)){let s=0;for(let r of t.items){let i=Tn(e,r,n);i>s&&(s=i)}return s}else if(ut.isPair(t)){let s=Tn(e,t.key,n),r=Tn(e,t.value,n);return Math.max(s,r)}return 1}ao.Alias=zs});var ue=R(Vs=>{"use strict";var bf=Z(),wf=xn(),kf=Ke(),$f=e=>!e||typeof e!="function"&&typeof e!="object",Ue=class extends wf.NodeBase{constructor(t){super(bf.SCALAR),this.value=t}toJSON(t,n){return n?.keep?this.value:kf.toJS(this.value,t,n)}toString(){return String(this.value)}};Ue.BLOCK_FOLDED="BLOCK_FOLDED";Ue.BLOCK_LITERAL="BLOCK_LITERAL";Ue.PLAIN="PLAIN";Ue.QUOTE_DOUBLE="QUOTE_DOUBLE";Ue.QUOTE_SINGLE="QUOTE_SINGLE";Vs.Scalar=Ue;Vs.isScalarValue=$f});var It=R(co=>{"use strict";var vf=Mt(),Ze=Z(),lo=ue(),Sf="tag:yaml.org,2002:";function Of(e,t,n){if(t){let s=n.filter(i=>i.tag===t),r=s.find(i=>!i.format)??s[0];if(!r)throw new Error(`Tag ${t} not found`);return r}return n.find(s=>s.identify?.(e)&&!s.format)}function Af(e,t,n){if(Ze.isDocument(e)&&(e=e.contents),Ze.isNode(e))return e;if(Ze.isPair(e)){let u=n.schema[Ze.MAP].createNode?.(n.schema,null,n);return u.items.push(e),u}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:s,onAnchor:r,onTagObj:i,schema:o,sourceObjects:a}=n,c;if(s&&e&&typeof e=="object"){if(c=a.get(e),c)return c.anchor??(c.anchor=r(e)),new vf.Alias(c.anchor);c={anchor:null,node:null},a.set(e,c)}t?.startsWith("!!")&&(t=Sf+t.slice(2));let f=Of(e,t,o.tags);if(!f){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){let u=new lo.Scalar(e);return c&&(c.node=u),u}f=e instanceof Map?o[Ze.MAP]:Symbol.iterator in Object(e)?o[Ze.SEQ]:o[Ze.MAP]}i&&(i(f),delete n.onTagObj);let g=f?.createNode?f.createNode(n.schema,e,n):typeof f?.nodeClass?.from=="function"?f.nodeClass.from(n.schema,e,n):new lo.Scalar(e);return t?g.tag=t:f.default||(g.tag=f.tag),c&&(c.node=g),g}co.createNode=Af});var Pn=R(Cn=>{"use strict";var Nf=It(),Ie=Z(),Ef=xn();function Js(e,t,n){let s=n;for(let r=t.length-1;r>=0;--r){let i=t[r];if(typeof i=="number"&&Number.isInteger(i)&&i>=0){let o=[];o[i]=s,s=o}else s=new Map([[i,s]])}return Nf.createNode(s,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}var fo=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done,Gs=class extends Ef.NodeBase{constructor(t,n){super(t),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(t){let n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(n.schema=t),n.items=n.items.map(s=>Ie.isNode(s)||Ie.isPair(s)?s.clone(t):s),this.range&&(n.range=this.range.slice()),n}addIn(t,n){if(fo(t))this.add(n);else{let[s,...r]=t,i=this.get(s,!0);if(Ie.isCollection(i))i.addIn(r,n);else if(i===void 0&&this.schema)this.set(s,Js(this.schema,r,n));else throw new Error(`Expected YAML collection at ${s}. Remaining path: ${r}`)}}deleteIn(t){let[n,...s]=t;if(s.length===0)return this.delete(n);let r=this.get(n,!0);if(Ie.isCollection(r))return r.deleteIn(s);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${s}`)}getIn(t,n){let[s,...r]=t,i=this.get(s,!0);return r.length===0?!n&&Ie.isScalar(i)?i.value:i:Ie.isCollection(i)?i.getIn(r,n):void 0}hasAllNullValues(t){return this.items.every(n=>{if(!Ie.isPair(n))return!1;let s=n.value;return s==null||t&&Ie.isScalar(s)&&s.value==null&&!s.commentBefore&&!s.comment&&!s.tag})}hasIn(t){let[n,...s]=t;if(s.length===0)return this.has(n);let r=this.get(n,!0);return Ie.isCollection(r)?r.hasIn(s):!1}setIn(t,n){let[s,...r]=t;if(r.length===0)this.set(s,n);else{let i=this.get(s,!0);if(Ie.isCollection(i))i.setIn(r,n);else if(i===void 0&&this.schema)this.set(s,Js(this.schema,r,n));else throw new Error(`Expected YAML collection at ${s}. Remaining path: ${r}`)}}};Cn.Collection=Gs;Cn.collectionFromPath=Js;Cn.isEmptyPath=fo});var Rt=R(qn=>{"use strict";var xf=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function Hs(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var Tf=(e,t,n)=>e.endsWith(`
|
|
5
|
+
`)?Hs(n,t):n.includes(`
|
|
6
6
|
`)?`
|
|
7
|
-
`+
|
|
8
|
-
`)n===
|
|
7
|
+
`+Hs(n,t):(e.endsWith(" ")?"":" ")+n;qn.indentComment=Hs;qn.lineComment=Tf;qn.stringifyComment=xf});var po=R(Ft=>{"use strict";var Cf="flow",Xs="block",Ln="quoted";function Pf(e,t,n="flow",{indentAtStart:s,lineWidth:r=80,minContentWidth:i=20,onFold:o,onOverflow:a}={}){if(!r||r<0)return e;r<i&&(i=0);let c=Math.max(1+i,1+r-t.length);if(e.length<=c)return e;let f=[],g={},u=r-t.length;typeof s=="number"&&(s>r-Math.max(2,i)?f.push(0):u=r-s);let l,p,d=!1,m=-1,y=-1,k=-1;n===Xs&&(m=uo(e,m,t.length),m!==-1&&(u=m+c));for(let S;S=e[m+=1];){if(n===Ln&&S==="\\"){switch(y=m,e[m+1]){case"x":m+=3;break;case"u":m+=5;break;case"U":m+=9;break;default:m+=1}k=m}if(S===`
|
|
8
|
+
`)n===Xs&&(m=uo(e,m,t.length)),u=m+t.length+c,l=void 0;else{if(S===" "&&p&&p!==" "&&p!==`
|
|
9
9
|
`&&p!==" "){let T=e[m+1];T&&T!==" "&&T!==`
|
|
10
|
-
`&&T!==" "&&(l=m)}if(m>=u)if(l)f.push(l),u=l+c,l=void 0;else if(n===
|
|
11
|
-
${t}${e.slice(0,N)}`:(n===
|
|
12
|
-
${t}${e.slice(T+1,N)}`)}return v}function
|
|
13
|
-
`);s=t,r=t+1,i=e[r]}return s}Ft.FOLD_BLOCK=
|
|
14
|
-
`){if(i-o>s)return!0;if(o=i+1,r-o<=s)return!1}return!0}function jt(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:s}=t,r=t.options.doubleQuotedMinMultiLineLength,i=t.indent||(
|
|
10
|
+
`&&T!==" "&&(l=m)}if(m>=u)if(l)f.push(l),u=l+c,l=void 0;else if(n===Ln){for(;p===" "||p===" ";)p=S,S=e[m+=1],d=!0;let T=m>k+1?m-2:y-1;if(g[T])return e;f.push(T),g[T]=!0,u=T+c,l=void 0}else d=!0}p=S}if(d&&a&&a(),f.length===0)return e;o&&o();let v=e.slice(0,f[0]);for(let S=0;S<f.length;++S){let T=f[S],N=f[S+1]||e.length;T===0?v=`
|
|
11
|
+
${t}${e.slice(0,N)}`:(n===Ln&&g[T]&&(v+=`${e[T]}\\`),v+=`
|
|
12
|
+
${t}${e.slice(T+1,N)}`)}return v}function uo(e,t,n){let s=t,r=t+1,i=e[r];for(;i===" "||i===" ";)if(t<r+n)i=e[++t];else{do i=e[++t];while(i&&i!==`
|
|
13
|
+
`);s=t,r=t+1,i=e[r]}return s}Ft.FOLD_BLOCK=Xs;Ft.FOLD_FLOW=Cf;Ft.FOLD_QUOTED=Ln;Ft.foldFlowLines=Pf});var Dt=R(ho=>{"use strict";var Pe=ue(),We=po(),In=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),Rn=e=>/^(%|---|\.\.\.)/m.test(e);function qf(e,t,n){if(!t||t<0)return!1;let s=t-n,r=e.length;if(r<=s)return!1;for(let i=0,o=0;i<r;++i)if(e[i]===`
|
|
14
|
+
`){if(i-o>s)return!0;if(o=i+1,r-o<=s)return!1}return!0}function jt(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:s}=t,r=t.options.doubleQuotedMinMultiLineLength,i=t.indent||(Rn(e)?" ":""),o="",a=0;for(let c=0,f=n[c];f;f=n[++c])if(f===" "&&n[c+1]==="\\"&&n[c+2]==="n"&&(o+=n.slice(a,c)+"\\ ",c+=1,a=c,f="\\"),f==="\\")switch(n[c+1]){case"u":{o+=n.slice(a,c);let g=n.substr(c+2,4);switch(g){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:g.substr(0,2)==="00"?o+="\\x"+g.substr(2):o+=n.substr(c,6)}c+=5,a=c+1}break;case"n":if(s||n[c+2]==='"'||n.length<r)c+=1;else{for(o+=n.slice(a,c)+`
|
|
15
15
|
|
|
16
16
|
`;n[c+2]==="\\"&&n[c+3]==="n"&&n[c+4]!=='"';)o+=`
|
|
17
|
-
`,c+=2;o+=i,n[c+2]===" "&&(o+="\\"),c+=1,a=c+1}break;default:c+=1}return o=a?o+n.slice(a):n,s?o:We.foldFlowLines(o,i,We.FOLD_QUOTED,
|
|
18
|
-
`)||/[ \t]\n|\n[ \t]/.test(e))return jt(e,t);let n=t.indent||(
|
|
19
|
-
${n}`)+"'";return t.implicitKey?s:We.foldFlowLines(s,n,We.FOLD_FLOW,
|
|
17
|
+
`,c+=2;o+=i,n[c+2]===" "&&(o+="\\"),c+=1,a=c+1}break;default:c+=1}return o=a?o+n.slice(a):n,s?o:We.foldFlowLines(o,i,We.FOLD_QUOTED,In(t,!1))}function Qs(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
|
|
18
|
+
`)||/[ \t]\n|\n[ \t]/.test(e))return jt(e,t);let n=t.indent||(Rn(e)?" ":""),s="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
19
|
+
${n}`)+"'";return t.implicitKey?s:We.foldFlowLines(s,n,We.FOLD_FLOW,In(t,!1))}function dt(e,t){let{singleQuote:n}=t.options,s;if(n===!1)s=jt;else{let r=e.includes('"'),i=e.includes("'");r&&!i?s=Qs:i&&!r?s=jt:s=n?Qs:jt}return s(e,t)}var Zs;try{Zs=new RegExp(`(^|(?<!
|
|
20
20
|
))
|
|
21
21
|
+(?!
|
|
22
|
-
|$)`,"g")}catch{
|
|
22
|
+
|$)`,"g")}catch{Zs=/\n+(?!\n|$)/g}function Mn({comment:e,type:t,value:n},s,r,i){let{blockQuote:o,commentString:a,lineWidth:c}=s.options;if(!o||/\n[\t ]+$/.test(n))return dt(n,s);let f=s.indent||(s.forceBlockIndent||Rn(n)?" ":""),g=o==="literal"?!0:o==="folded"||t===Pe.Scalar.BLOCK_FOLDED?!1:t===Pe.Scalar.BLOCK_LITERAL?!0:!qf(n,c,f.length);if(!n)return g?`|
|
|
23
23
|
`:`>
|
|
24
24
|
`;let u,l;for(l=n.length;l>0;--l){let N=n[l-1];if(N!==`
|
|
25
25
|
`&&N!==" "&&N!==" ")break}let p=n.substring(l),d=p.indexOf(`
|
|
26
26
|
`);d===-1?u="-":n===p||d!==p.length-1?(u="+",i&&i()):u="",p&&(n=n.slice(0,-p.length),p[p.length-1]===`
|
|
27
|
-
`&&(p=p.slice(0,-1)),p=p.replace(
|
|
27
|
+
`&&(p=p.slice(0,-1)),p=p.replace(Zs,`$&${f}`));let m=!1,y,k=-1;for(y=0;y<n.length;++y){let N=n[y];if(N===" ")m=!0;else if(N===`
|
|
28
28
|
`)k=y;else break}let v=n.substring(0,k<y?k+1:y);v&&(n=n.substring(v.length),v=v.replace(/\n+/g,`$&${f}`));let T=(m?f?"2":"1":"")+u;if(e&&(T+=" "+a(e.replace(/ ?[\r\n]+/g," ")),r&&r()),!g){let N=n.replace(/\n+/g,`
|
|
29
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${f}`),
|
|
29
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${f}`),P=!1,M=In(s,!0);o!=="folded"&&t!==Pe.Scalar.BLOCK_FOLDED&&(M.onOverflow=()=>{P=!0});let C=We.foldFlowLines(`${v}${N}${p}`,f,We.FOLD_BLOCK,M);if(!P)return`>${T}
|
|
30
30
|
${f}${C}`}return n=n.replace(/\n+/g,`$&${f}`),`|${T}
|
|
31
|
-
${f}${v}${n}${p}`}function
|
|
31
|
+
${f}${v}${n}${p}`}function Lf(e,t,n,s){let{type:r,value:i}=e,{actualString:o,implicitKey:a,indent:c,indentStep:f,inFlow:g}=t;if(a&&i.includes(`
|
|
32
32
|
`)||g&&/[[\]{},]/.test(i))return dt(i,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(i))return a||g||!i.includes(`
|
|
33
|
-
`)?dt(i,t):
|
|
34
|
-
`))return
|
|
35
|
-
${c}`);if(o){let l=m=>m.default&&m.tag!=="tag:yaml.org,2002:str"&&m.test?.test(u),{compat:p,tags:d}=t.doc.schema;if(d.some(l)||p?.some(l))return dt(i,t)}return a?u:We.foldFlowLines(u,c,We.FOLD_FLOW,
|
|
36
|
-
${t.indent}${a}`:a}
|
|
37
|
-
${a}:`):(y=`${y}:`,l&&(y+=Bt.lineComment(y,n.indent,f(l))));let k,v,S;De.isNode(t)?(k=!!t.spaceBefore,v=t.commentBefore,S=t.comment):(k=!1,v=null,S=null,t&&typeof t=="object"&&(t=o.createNode(t))),n.implicitKey=!1,!p&&!l&&De.isScalar(t)&&(n.indentAtStart=y.length+1),m=!1,!g&&c.length>=2&&!n.inFlow&&!p&&De.isSeq(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let T=!1,N=
|
|
38
|
-
`:"",v){let M=f(v);
|
|
39
|
-
${Bt.indentComment(M,n.indent)}`}N===""&&!n.inFlow?
|
|
40
|
-
`&&S&&(
|
|
33
|
+
`)?dt(i,t):Mn(e,t,n,s);if(!a&&!g&&r!==Pe.Scalar.PLAIN&&i.includes(`
|
|
34
|
+
`))return Mn(e,t,n,s);if(Rn(i)){if(c==="")return t.forceBlockIndent=!0,Mn(e,t,n,s);if(a&&c===f)return dt(i,t)}let u=i.replace(/\n+/g,`$&
|
|
35
|
+
${c}`);if(o){let l=m=>m.default&&m.tag!=="tag:yaml.org,2002:str"&&m.test?.test(u),{compat:p,tags:d}=t.doc.schema;if(d.some(l)||p?.some(l))return dt(i,t)}return a?u:We.foldFlowLines(u,c,We.FOLD_FLOW,In(t,!1))}function Mf(e,t,n,s){let{implicitKey:r,inFlow:i}=t,o=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)}),{type:a}=e;a!==Pe.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=Pe.Scalar.QUOTE_DOUBLE);let c=g=>{switch(g){case Pe.Scalar.BLOCK_FOLDED:case Pe.Scalar.BLOCK_LITERAL:return r||i?dt(o.value,t):Mn(o,t,n,s);case Pe.Scalar.QUOTE_DOUBLE:return jt(o.value,t);case Pe.Scalar.QUOTE_SINGLE:return Qs(o.value,t);case Pe.Scalar.PLAIN:return Lf(o,t,n,s);default:return null}},f=c(a);if(f===null){let{defaultKeyType:g,defaultStringType:u}=t.options,l=r&&g||u;if(f=c(l),f===null)throw new Error(`Unsupported default string type ${l}`)}return f}ho.stringifyString=Mf});var _t=R(er=>{"use strict";var If=En(),Ye=Z(),Rf=Rt(),Ff=Dt();function jf(e,t){let n=Object.assign({blockQuote:!0,commentString:Rf.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,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},e.schema.toStringOptions,t),s;switch(n.collectionStyle){case"block":s=!1;break;case"flow":s=!0;break;default:s=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:s,options:n}}function Df(e,t){if(t.tag){let r=e.filter(i=>i.tag===t.tag);if(r.length>0)return r.find(i=>i.format===t.format)??r[0]}let n,s;if(Ye.isScalar(t)){s=t.value;let r=e.filter(i=>i.identify?.(s));if(r.length>1){let i=r.filter(o=>o.test);i.length>0&&(r=i)}n=r.find(i=>i.format===t.format)??r.find(i=>!i.format)}else s=t,n=e.find(r=>r.nodeClass&&s instanceof r.nodeClass);if(!n){let r=s?.constructor?.name??(s===null?"null":typeof s);throw new Error(`Tag not resolved for ${r} value`)}return n}function _f(e,t,{anchors:n,doc:s}){if(!s.directives)return"";let r=[],i=(Ye.isScalar(e)||Ye.isCollection(e))&&e.anchor;i&&If.anchorIsValid(i)&&(n.add(i),r.push(`&${i}`));let o=e.tag??(t.default?null:t.tag);return o&&r.push(s.directives.tagString(o)),r.join(" ")}function Bf(e,t,n,s){if(Ye.isPair(e))return e.toString(t,n,s);if(Ye.isAlias(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw new TypeError("Cannot stringify circular structure without alias nodes");t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let r,i=Ye.isNode(e)?e:t.doc.createNode(e,{onTagObj:c=>r=c});r??(r=Df(t.doc.schema.tags,i));let o=_f(i,r,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);let a=typeof r.stringify=="function"?r.stringify(i,t,n,s):Ye.isScalar(i)?Ff.stringifyString(i,t,n,s):i.toString(t,n,s);return o?Ye.isScalar(i)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o}
|
|
36
|
+
${t.indent}${a}`:a}er.createStringifyContext=jf;er.stringify=Bf});var bo=R(yo=>{"use strict";var De=Z(),mo=ue(),go=_t(),Bt=Rt();function Kf({key:e,value:t},n,s,r){let{allNullValues:i,doc:o,indent:a,indentStep:c,options:{commentString:f,indentSeq:g,simpleKeys:u}}=n,l=De.isNode(e)&&e.comment||null;if(u){if(l)throw new Error("With simple keys, key nodes cannot have comments");if(De.isCollection(e)||!De.isNode(e)&&typeof e=="object"){let M="With simple keys, collection cannot be used as a key value";throw new Error(M)}}let p=!u&&(!e||l&&t==null&&!n.inFlow||De.isCollection(e)||(De.isScalar(e)?e.type===mo.Scalar.BLOCK_FOLDED||e.type===mo.Scalar.BLOCK_LITERAL:typeof e=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(u||!i),indent:a+c});let d=!1,m=!1,y=go.stringify(e,n,()=>d=!0,()=>m=!0);if(!p&&!n.inFlow&&y.length>1024){if(u)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(n.inFlow){if(i||t==null)return d&&s&&s(),y===""?"?":p?`? ${y}`:y}else if(i&&!u||t==null&&p)return y=`? ${y}`,l&&!d?y+=Bt.lineComment(y,n.indent,f(l)):m&&r&&r(),y;d&&(l=null),p?(l&&(y+=Bt.lineComment(y,n.indent,f(l))),y=`? ${y}
|
|
37
|
+
${a}:`):(y=`${y}:`,l&&(y+=Bt.lineComment(y,n.indent,f(l))));let k,v,S;De.isNode(t)?(k=!!t.spaceBefore,v=t.commentBefore,S=t.comment):(k=!1,v=null,S=null,t&&typeof t=="object"&&(t=o.createNode(t))),n.implicitKey=!1,!p&&!l&&De.isScalar(t)&&(n.indentAtStart=y.length+1),m=!1,!g&&c.length>=2&&!n.inFlow&&!p&&De.isSeq(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let T=!1,N=go.stringify(t,n,()=>T=!0,()=>m=!0),P=" ";if(l||k||v){if(P=k?`
|
|
38
|
+
`:"",v){let M=f(v);P+=`
|
|
39
|
+
${Bt.indentComment(M,n.indent)}`}N===""&&!n.inFlow?P===`
|
|
40
|
+
`&&S&&(P=`
|
|
41
41
|
|
|
42
|
-
`):
|
|
42
|
+
`):P+=`
|
|
43
43
|
${n.indent}`}else if(!p&&De.isCollection(t)){let M=N[0],C=N.indexOf(`
|
|
44
|
-
`),$=C!==-1,L=n.inFlow??t.flow??t.items.length===0;if($||!L){let K=!1;if($&&(M==="&"||M==="!")){let
|
|
44
|
+
`),$=C!==-1,L=n.inFlow??t.flow??t.items.length===0;if($||!L){let K=!1;if($&&(M==="&"||M==="!")){let J=N.indexOf(" ");M==="&"&&J!==-1&&J<C&&N[J+1]==="!"&&(J=N.indexOf(" ",J+1)),(J===-1||C<J)&&(K=!0)}K||(P=`
|
|
45
45
|
${n.indent}`)}}else(N===""||N[0]===`
|
|
46
|
-
`)&&(
|
|
46
|
+
`)&&(P="");return y+=P+N,n.inFlow?T&&s&&s():S&&!T?y+=Bt.lineComment(y,n.indent,f(S)):m&&r&&r(),y}yo.stringifyPair=Kf});var nr=R(tr=>{"use strict";var wo=$n("process");function Uf(e,...t){e==="debug"&&console.log(...t)}function Wf(e,t){(e==="debug"||e==="warn")&&(typeof wo.emitWarning=="function"?wo.emitWarning(t):console.warn(t))}tr.debug=Uf;tr.warn=Wf});var Bn=R(_n=>{"use strict";var Dn=Z(),ko=ue(),Fn="<<",jn={identify:e=>e===Fn||typeof e=="symbol"&&e.description===Fn,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new ko.Scalar(Symbol(Fn)),{addToJSMap:$o}),stringify:()=>Fn},Yf=(e,t)=>(jn.identify(t)||Dn.isScalar(t)&&(!t.type||t.type===ko.Scalar.PLAIN)&&jn.identify(t.value))&&e?.doc.schema.tags.some(n=>n.tag===jn.tag&&n.default);function $o(e,t,n){let s=vo(e,n);if(Dn.isSeq(s))for(let r of s.items)sr(e,t,r);else if(Array.isArray(s))for(let r of s)sr(e,t,r);else sr(e,t,s)}function sr(e,t,n){let s=vo(e,n);if(!Dn.isMap(s))throw new Error("Merge sources must be maps or map aliases");let r=s.toJSON(null,e,Map);for(let[i,o]of r)t instanceof Map?t.has(i)||t.set(i,o):t instanceof Set?t.add(i):Object.prototype.hasOwnProperty.call(t,i)||Object.defineProperty(t,i,{value:o,writable:!0,enumerable:!0,configurable:!0});return t}function vo(e,t){return e&&Dn.isAlias(t)?t.resolve(e.doc,e):t}_n.addMergeToJSMap=$o;_n.isMergeKey=Yf;_n.merge=jn});var ir=R(Ao=>{"use strict";var zf=nr(),So=Bn(),Vf=_t(),Oo=Z(),rr=Ke();function Jf(e,t,{key:n,value:s}){if(Oo.isNode(n)&&n.addToJSMap)n.addToJSMap(e,t,s);else if(So.isMergeKey(e,n))So.addMergeToJSMap(e,t,s);else{let r=rr.toJS(n,"",e);if(t instanceof Map)t.set(r,rr.toJS(s,r,e));else if(t instanceof Set)t.add(r);else{let i=Gf(n,r,e),o=rr.toJS(s,i,e);i in t?Object.defineProperty(t,i,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[i]=o}}return t}function Gf(e,t,n){if(t===null)return"";if(typeof t!="object")return String(t);if(Oo.isNode(e)&&n?.doc){let s=Vf.createStringifyContext(n.doc,{});s.anchors=new Set;for(let i of n.anchors.keys())s.anchors.add(i.anchor);s.inFlow=!0,s.inStringifyKey=!0;let r=e.toString(s);if(!n.mapKeyWarned){let i=JSON.stringify(r);i.length>40&&(i=i.substring(0,36)+'..."'),zf.warn(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${i}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(t)}Ao.addPairToJSMap=Jf});var ze=R(or=>{"use strict";var No=It(),Hf=bo(),Xf=ir(),Kn=Z();function Qf(e,t,n){let s=No.createNode(e,void 0,n),r=No.createNode(t,void 0,n);return new Un(s,r)}var Un=class e{constructor(t,n=null){Object.defineProperty(this,Kn.NODE_TYPE,{value:Kn.PAIR}),this.key=t,this.value=n}clone(t){let{key:n,value:s}=this;return Kn.isNode(n)&&(n=n.clone(t)),Kn.isNode(s)&&(s=s.clone(t)),new e(n,s)}toJSON(t,n){let s=n?.mapAsMap?new Map:{};return Xf.addPairToJSMap(n,s,this)}toString(t,n,s){return t?.doc?Hf.stringifyPair(this,t,n,s):JSON.stringify(this)}};or.Pair=Un;or.createPair=Qf});var ar=R(xo=>{"use strict";var et=Z(),Eo=_t(),Wn=Rt();function Zf(e,t,n){return(t.inFlow??e.flow?tu:eu)(e,t,n)}function eu({comment:e,items:t},n,{blockItemPrefix:s,flowChars:r,itemIndent:i,onChompKeep:o,onComment:a}){let{indent:c,options:{commentString:f}}=n,g=Object.assign({},n,{indent:i,type:null}),u=!1,l=[];for(let d=0;d<t.length;++d){let m=t[d],y=null;if(et.isNode(m))!u&&m.spaceBefore&&l.push(""),Yn(n,l,m.commentBefore,u),m.comment&&(y=m.comment);else if(et.isPair(m)){let v=et.isNode(m.key)?m.key:null;v&&(!u&&v.spaceBefore&&l.push(""),Yn(n,l,v.commentBefore,u))}u=!1;let k=Eo.stringify(m,g,()=>y=null,()=>u=!0);y&&(k+=Wn.lineComment(k,i,f(y))),u&&y&&(u=!1),l.push(s+k)}let p;if(l.length===0)p=r.start+r.end;else{p=l[0];for(let d=1;d<l.length;++d){let m=l[d];p+=m?`
|
|
47
47
|
${c}${m}`:`
|
|
48
48
|
`}}return e?(p+=`
|
|
49
|
-
`+
|
|
50
|
-
`)),d<e.length-1?k+=",":t.options.trailingComma&&(t.options.lineWidth>0&&(f||(f=u.reduce((v,S)=>v+S.length+2,2)+(k.length+2)>t.options.lineWidth)),f&&(k+=",")),y&&(k+=
|
|
49
|
+
`+Wn.indentComment(f(e),c),a&&a()):u&&o&&o(),p}function tu({items:e},t,{flowChars:n,itemIndent:s}){let{indent:r,indentStep:i,flowCollectionPadding:o,options:{commentString:a}}=t;s+=i;let c=Object.assign({},t,{indent:s,inFlow:!0,type:null}),f=!1,g=0,u=[];for(let d=0;d<e.length;++d){let m=e[d],y=null;if(et.isNode(m))m.spaceBefore&&u.push(""),Yn(t,u,m.commentBefore,!1),m.comment&&(y=m.comment);else if(et.isPair(m)){let v=et.isNode(m.key)?m.key:null;v&&(v.spaceBefore&&u.push(""),Yn(t,u,v.commentBefore,!1),v.comment&&(f=!0));let S=et.isNode(m.value)?m.value:null;S?(S.comment&&(y=S.comment),S.commentBefore&&(f=!0)):m.value==null&&v?.comment&&(y=v.comment)}y&&(f=!0);let k=Eo.stringify(m,c,()=>y=null);f||(f=u.length>g||k.includes(`
|
|
50
|
+
`)),d<e.length-1?k+=",":t.options.trailingComma&&(t.options.lineWidth>0&&(f||(f=u.reduce((v,S)=>v+S.length+2,2)+(k.length+2)>t.options.lineWidth)),f&&(k+=",")),y&&(k+=Wn.lineComment(k,s,a(y))),u.push(k),g=u.length}let{start:l,end:p}=n;if(u.length===0)return l+p;if(!f){let d=u.reduce((m,y)=>m+y.length+2,2);f=t.options.lineWidth>0&&d>t.options.lineWidth}if(f){let d=l;for(let m of u)d+=m?`
|
|
51
51
|
${i}${r}${m}`:`
|
|
52
52
|
`;return`${d}
|
|
53
|
-
${r}${p}`}else return`${l}${o}${u.join(" ")}${o}${p}`}function
|
|
54
|
-
`:" ")}return
|
|
53
|
+
${r}${p}`}else return`${l}${o}${u.join(" ")}${o}${p}`}function Yn({indent:e,options:{commentString:t}},n,s,r){if(s&&r&&(s=s.replace(/^\n+/,"")),s){let i=Wn.indentComment(t(s),e);n.push(i.trimStart())}}xo.stringifyCollection=Zf});var Je=R(cr=>{"use strict";var nu=ar(),su=ir(),ru=Pn(),Ve=Z(),zn=ze(),iu=ue();function Kt(e,t){let n=Ve.isScalar(t)?t.value:t;for(let s of e)if(Ve.isPair(s)&&(s.key===t||s.key===n||Ve.isScalar(s.key)&&s.key.value===n))return s}var lr=class extends ru.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(Ve.MAP,t),this.items=[]}static from(t,n,s){let{keepUndefined:r,replacer:i}=s,o=new this(t),a=(c,f)=>{if(typeof i=="function")f=i.call(n,c,f);else if(Array.isArray(i)&&!i.includes(c))return;(f!==void 0||r)&&o.items.push(zn.createPair(c,f,s))};if(n instanceof Map)for(let[c,f]of n)a(c,f);else if(n&&typeof n=="object")for(let c of Object.keys(n))a(c,n[c]);return typeof t.sortMapEntries=="function"&&o.items.sort(t.sortMapEntries),o}add(t,n){let s;Ve.isPair(t)?s=t:!t||typeof t!="object"||!("key"in t)?s=new zn.Pair(t,t?.value):s=new zn.Pair(t.key,t.value);let r=Kt(this.items,s.key),i=this.schema?.sortMapEntries;if(r){if(!n)throw new Error(`Key ${s.key} already set`);Ve.isScalar(r.value)&&iu.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(t){let n=Kt(this.items,t);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(t,n){let r=Kt(this.items,t)?.value;return(!n&&Ve.isScalar(r)?r.value:r)??void 0}has(t){return!!Kt(this.items,t)}set(t,n){this.add(new zn.Pair(t,n),!0)}toJSON(t,n,s){let r=s?new s:n?.mapAsMap?new Map:{};n?.onCreate&&n.onCreate(r);for(let i of this.items)su.addPairToJSMap(n,r,i);return r}toString(t,n,s){if(!t)return JSON.stringify(this);for(let r of this.items)if(!Ve.isPair(r))throw new Error(`Map items must all be pairs; found ${JSON.stringify(r)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),nu.stringifyCollection(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:s,onComment:n})}};cr.YAMLMap=lr;cr.findPair=Kt});var pt=R(Co=>{"use strict";var ou=Z(),To=Je(),au={collection:"map",default:!0,nodeClass:To.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(e,t){return ou.isMap(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,n)=>To.YAMLMap.from(e,t,n)};Co.map=au});var Ge=R(Po=>{"use strict";var lu=It(),cu=ar(),fu=Pn(),Jn=Z(),uu=ue(),du=Ke(),fr=class extends fu.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(Jn.SEQ,t),this.items=[]}add(t){this.items.push(t)}delete(t){let n=Vn(t);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(t,n){let s=Vn(t);if(typeof s!="number")return;let r=this.items[s];return!n&&Jn.isScalar(r)?r.value:r}has(t){let n=Vn(t);return typeof n=="number"&&n<this.items.length}set(t,n){let s=Vn(t);if(typeof s!="number")throw new Error(`Expected a valid index, not ${t}.`);let r=this.items[s];Jn.isScalar(r)&&uu.isScalarValue(n)?r.value=n:this.items[s]=n}toJSON(t,n){let s=[];n?.onCreate&&n.onCreate(s);let r=0;for(let i of this.items)s.push(du.toJS(i,String(r++),n));return s}toString(t,n,s){return t?cu.stringifyCollection(this,t,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(t.indent||"")+" ",onChompKeep:s,onComment:n}):JSON.stringify(this)}static from(t,n,s){let{replacer:r}=s,i=new this(t);if(n&&Symbol.iterator in Object(n)){let o=0;for(let a of n){if(typeof r=="function"){let c=n instanceof Set?a:String(o++);a=r.call(n,c,a)}i.items.push(lu.createNode(a,void 0,s))}}return i}};function Vn(e){let t=Jn.isScalar(e)?e.value:e;return t&&typeof t=="string"&&(t=Number(t)),typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}Po.YAMLSeq=fr});var ht=R(Lo=>{"use strict";var pu=Z(),qo=Ge(),hu={collection:"seq",default:!0,nodeClass:qo.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(e,t){return pu.isSeq(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,n)=>qo.YAMLSeq.from(e,t,n)};Lo.seq=hu});var Ut=R(Mo=>{"use strict";var mu=Dt(),gu={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,n,s){return t=Object.assign({actualString:!0},t),mu.stringifyString(e,t,n,s)}};Mo.string=gu});var Gn=R(Fo=>{"use strict";var Io=ue(),Ro={identify:e=>e==null,createNode:()=>new Io.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Io.Scalar(null),stringify:({source:e},t)=>typeof e=="string"&&Ro.test.test(e)?e:t.options.nullStr};Fo.nullTag=Ro});var ur=R(Do=>{"use strict";var yu=ue(),jo={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new yu.Scalar(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},n){if(e&&jo.test.test(e)){let s=e[0]==="t"||e[0]==="T";if(t===s)return e}return t?n.options.trueStr:n.options.falseStr}};Do.boolTag=jo});var mt=R(_o=>{"use strict";function bu({format:e,minFractionDigits:t,tag:n,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(!e&&t&&(!n||n==="tag:yaml.org,2002:float")&&/^-?\d/.test(i)&&!i.includes("e")){let o=i.indexOf(".");o<0&&(o=i.length,i+=".");let a=t-(i.length-o-1);for(;a-- >0;)i+="0"}return i}_o.stringifyNumber=bu});var pr=R(Hn=>{"use strict";var wu=ue(),dr=mt(),ku={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:dr.stringifyNumber},$u={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():dr.stringifyNumber(e)}},vu={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let t=new wu.Scalar(parseFloat(e)),n=e.indexOf(".");return n!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-n-1),t},stringify:dr.stringifyNumber};Hn.float=vu;Hn.floatExp=$u;Hn.floatNaN=ku});var mr=R(Qn=>{"use strict";var Bo=mt(),Xn=e=>typeof e=="bigint"||Number.isInteger(e),hr=(e,t,n,{intAsBigInt:s})=>s?BigInt(e):parseInt(e.substring(t),n);function Ko(e,t,n){let{value:s}=e;return Xn(s)&&s>=0?n+s.toString(t):Bo.stringifyNumber(e)}var Su={identify:e=>Xn(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,n)=>hr(e,2,8,n),stringify:e=>Ko(e,8,"0o")},Ou={identify:Xn,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>hr(e,0,10,n),stringify:Bo.stringifyNumber},Au={identify:e=>Xn(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>hr(e,2,16,n),stringify:e=>Ko(e,16,"0x")};Qn.int=Ou;Qn.intHex=Au;Qn.intOct=Su});var Wo=R(Uo=>{"use strict";var Nu=pt(),Eu=Gn(),xu=ht(),Tu=Ut(),Cu=ur(),gr=pr(),yr=mr(),Pu=[Nu.map,xu.seq,Tu.string,Eu.nullTag,Cu.boolTag,yr.intOct,yr.int,yr.intHex,gr.floatNaN,gr.floatExp,gr.float];Uo.schema=Pu});var Vo=R(zo=>{"use strict";var qu=ue(),Lu=pt(),Mu=ht();function Yo(e){return typeof e=="bigint"||Number.isInteger(e)}var Zn=({value:e})=>JSON.stringify(e),Iu=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:Zn},{identify:e=>e==null,createNode:()=>new qu.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Zn},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:Zn},{identify:Yo,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>Yo(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:Zn}],Ru={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},Fu=[Lu.map,Mu.seq].concat(Iu,Ru);zo.schema=Fu});var wr=R(Jo=>{"use strict";var Wt=$n("buffer"),br=ue(),ju=Dt(),Du={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof Wt.Buffer=="function")return Wt.Buffer.from(e,"base64");if(typeof atob=="function"){let n=atob(e.replace(/[\n\r]/g,"")),s=new Uint8Array(n.length);for(let r=0;r<n.length;++r)s[r]=n.charCodeAt(r);return s}else return t("This environment does not support reading binary tags; either Buffer or atob is required"),e},stringify({comment:e,type:t,value:n},s,r,i){if(!n)return"";let o=n,a;if(typeof Wt.Buffer=="function")a=o instanceof Wt.Buffer?o.toString("base64"):Wt.Buffer.from(o.buffer).toString("base64");else if(typeof btoa=="function"){let c="";for(let f=0;f<o.length;++f)c+=String.fromCharCode(o[f]);a=btoa(c)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(t??(t=br.Scalar.BLOCK_LITERAL),t!==br.Scalar.QUOTE_DOUBLE){let c=Math.max(s.options.lineWidth-s.indent.length,s.options.minContentWidth),f=Math.ceil(a.length/c),g=new Array(f);for(let u=0,l=0;u<f;++u,l+=c)g[u]=a.substr(l,c);a=g.join(t===br.Scalar.BLOCK_LITERAL?`
|
|
54
|
+
`:" ")}return ju.stringifyString({comment:e,type:t,value:a},s,r,i)}};Jo.binary=Du});var ns=R(ts=>{"use strict";var es=Z(),kr=ze(),_u=ue(),Bu=Ge();function Go(e,t){if(es.isSeq(e))for(let n=0;n<e.items.length;++n){let s=e.items[n];if(!es.isPair(s)){if(es.isMap(s)){s.items.length>1&&t("Each pair must have its own sequence indicator");let r=s.items[0]||new kr.Pair(new _u.Scalar(null));if(s.commentBefore&&(r.key.commentBefore=r.key.commentBefore?`${s.commentBefore}
|
|
55
55
|
${r.key.commentBefore}`:s.commentBefore),s.comment){let i=r.value??r.key;i.comment=i.comment?`${s.comment}
|
|
56
|
-
${i.comment}`:s.comment}s=r}e.items[n]=Qn.isPair(s)?s:new wr.Pair(s)}}else t("Expected a sequence for this tag");return e}function Go(e,t,n){let{replacer:s}=n,r=new _u.YAMLSeq(e);r.tag="tag:yaml.org,2002:pairs";let i=0;if(t&&Symbol.iterator in Object(t))for(let o of t){typeof s=="function"&&(o=s.call(t,String(i++),o));let a,c;if(Array.isArray(o))if(o.length===2)a=o[0],c=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let f=Object.keys(o);if(f.length===1)a=f[0],c=o[a];else throw new TypeError(`Expected tuple with one key, not ${f.length} keys`)}else a=o;r.items.push(wr.createPair(a,c,n))}return r}var Bu={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Jo,createNode:Go};Zn.createPairs=Go;Zn.pairs=Bu;Zn.resolvePairs=Jo});var vr=R($r=>{"use strict";var Ho=Z(),kr=Ke(),Yt=Je(),Ku=Ge(),Xo=es(),tt=class e extends Ku.YAMLSeq{constructor(){super(),this.add=Yt.YAMLMap.prototype.add.bind(this),this.delete=Yt.YAMLMap.prototype.delete.bind(this),this.get=Yt.YAMLMap.prototype.get.bind(this),this.has=Yt.YAMLMap.prototype.has.bind(this),this.set=Yt.YAMLMap.prototype.set.bind(this),this.tag=e.tag}toJSON(t,n){if(!n)return super.toJSON(t);let s=new Map;n?.onCreate&&n.onCreate(s);for(let r of this.items){let i,o;if(Ho.isPair(r)?(i=kr.toJS(r.key,"",n),o=kr.toJS(r.value,i,n)):i=kr.toJS(r,"",n),s.has(i))throw new Error("Ordered maps must not include duplicate keys");s.set(i,o)}return s}static from(t,n,s){let r=Xo.createPairs(t,n,s),i=new this;return i.items=r.items,i}};tt.tag="tag:yaml.org,2002:omap";var Uu={collection:"seq",identify:e=>e instanceof Map,nodeClass:tt,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let n=Xo.resolvePairs(e,t),s=[];for(let{key:r}of n.items)Ho.isScalar(r)&&(s.includes(r.value)?t(`Ordered maps must not include duplicate keys: ${r.value}`):s.push(r.value));return Object.assign(new tt,n)},createNode:(e,t,n)=>tt.from(e,t,n)};$r.YAMLOMap=tt;$r.omap=Uu});var na=R(Sr=>{"use strict";var Qo=ue();function Zo({value:e,source:t},n){return t&&(e?ea:ta).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var ea={identify:e=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Qo.Scalar(!0),stringify:Zo},ta={identify:e=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Qo.Scalar(!1),stringify:Zo};Sr.falseTag=ta;Sr.trueTag=ea});var sa=R(ts=>{"use strict";var Wu=ue(),Or=mt(),Yu={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Or.stringifyNumber},zu={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():Or.stringifyNumber(e)}},Vu={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new Wu.Scalar(parseFloat(e.replace(/_/g,""))),n=e.indexOf(".");if(n!==-1){let s=e.substring(n+1).replace(/_/g,"");s[s.length-1]==="0"&&(t.minFractionDigits=s.length)}return t},stringify:Or.stringifyNumber};ts.float=Vu;ts.floatExp=zu;ts.floatNaN=Yu});var ia=R(Vt=>{"use strict";var ra=mt(),zt=e=>typeof e=="bigint"||Number.isInteger(e);function ns(e,t,n,{intAsBigInt:s}){let r=e[0];if((r==="-"||r==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),s){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let o=BigInt(e);return r==="-"?BigInt(-1)*o:o}let i=parseInt(e,n);return r==="-"?-1*i:i}function Ar(e,t,n){let{value:s}=e;if(zt(s)){let r=s.toString(t);return s<0?"-"+n+r.substr(1):n+r}return ra.stringifyNumber(e)}var Ju={identify:zt,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>ns(e,2,2,n),stringify:e=>Ar(e,2,"0b")},Gu={identify:zt,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>ns(e,1,8,n),stringify:e=>Ar(e,8,"0")},Hu={identify:zt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>ns(e,0,10,n),stringify:ra.stringifyNumber},Xu={identify:zt,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>ns(e,2,16,n),stringify:e=>Ar(e,16,"0x")};Vt.int=Hu;Vt.intBin=Ju;Vt.intHex=Xu;Vt.intOct=Gu});var Er=R(Nr=>{"use strict";var is=Z(),ss=ze(),rs=Je(),nt=class e extends rs.YAMLMap{constructor(t){super(t),this.tag=e.tag}add(t){let n;is.isPair(t)?n=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?n=new ss.Pair(t.key,null):n=new ss.Pair(t,null),rs.findPair(this.items,n.key)||this.items.push(n)}get(t,n){let s=rs.findPair(this.items,t);return!n&&is.isPair(s)?is.isScalar(s.key)?s.key.value:s.key:s}set(t,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);let s=rs.findPair(this.items,t);s&&!n?this.items.splice(this.items.indexOf(s),1):!s&&n&&this.items.push(new ss.Pair(t))}toJSON(t,n){return super.toJSON(t,n,Set)}toString(t,n,s){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),n,s);throw new Error("Set items must all have null values")}static from(t,n,s){let{replacer:r}=s,i=new this(t);if(n&&Symbol.iterator in Object(n))for(let o of n)typeof r=="function"&&(o=r.call(n,o,o)),i.items.push(ss.createPair(o,null,s));return i}};nt.tag="tag:yaml.org,2002:set";var Qu={collection:"map",identify:e=>e instanceof Set,nodeClass:nt,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>nt.from(e,t,n),resolve(e,t){if(is.isMap(e)){if(e.hasAllNullValues(!0))return Object.assign(new nt,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};Nr.YAMLSet=nt;Nr.set=Qu});var Tr=R(os=>{"use strict";var Zu=mt();function xr(e,t){let n=e[0],s=n==="-"||n==="+"?e.substring(1):e,r=o=>t?BigInt(o):Number(o),i=s.replace(/_/g,"").split(":").reduce((o,a)=>o*r(60)+r(a),r(0));return n==="-"?r(-1)*i:i}function oa(e){let{value:t}=e,n=o=>o;if(typeof t=="bigint")n=o=>BigInt(o);else if(isNaN(t)||!isFinite(t))return Zu.stringifyNumber(e);let s="";t<0&&(s="-",t*=n(-1));let r=n(60),i=[t%r];return t<60?i.unshift(0):(t=(t-i[0])/r,i.unshift(t%r),t>=60&&(t=(t-i[0])/r,i.unshift(t))),s+i.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var ed={identify:e=>typeof e=="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>xr(e,n),stringify:oa},td={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>xr(e,!1),stringify:oa},aa={identify:e=>e instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(e){let t=e.match(aa.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,s,r,i,o,a]=t.map(Number),c=t[7]?Number((t[7]+"00").substr(1,3)):0,f=Date.UTC(n,s-1,r,i||0,o||0,a||0,c),g=t[8];if(g&&g!=="Z"){let u=xr(g,!1);Math.abs(u)<30&&(u*=60),f-=6e4*u}return new Date(f)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};os.floatTime=td;os.intTime=ed;os.timestamp=aa});var fa=R(ca=>{"use strict";var nd=pt(),sd=Vn(),rd=ht(),id=Ut(),od=br(),la=na(),Cr=sa(),as=ia(),ad=Dn(),ld=vr(),cd=es(),fd=Er(),qr=Tr(),ud=[nd.map,rd.seq,id.string,sd.nullTag,la.trueTag,la.falseTag,as.intBin,as.intOct,as.int,as.intHex,Cr.floatNaN,Cr.floatExp,Cr.float,od.binary,ad.merge,ld.omap,cd.pairs,fd.set,qr.intTime,qr.floatTime,qr.timestamp];ca.schema=ud});var ka=R(Mr=>{"use strict";var ha=pt(),dd=Vn(),ma=ht(),pd=Ut(),hd=fr(),Pr=dr(),Lr=hr(),md=Uo(),gd=zo(),ga=br(),Jt=Dn(),ya=vr(),ba=es(),ua=fa(),wa=Er(),ls=Tr(),da=new Map([["core",md.schema],["failsafe",[ha.map,ma.seq,pd.string]],["json",gd.schema],["yaml11",ua.schema],["yaml-1.1",ua.schema]]),pa={binary:ga.binary,bool:hd.boolTag,float:Pr.float,floatExp:Pr.floatExp,floatNaN:Pr.floatNaN,floatTime:ls.floatTime,int:Lr.int,intHex:Lr.intHex,intOct:Lr.intOct,intTime:ls.intTime,map:ha.map,merge:Jt.merge,null:dd.nullTag,omap:ya.omap,pairs:ba.pairs,seq:ma.seq,set:wa.set,timestamp:ls.timestamp},yd={"tag:yaml.org,2002:binary":ga.binary,"tag:yaml.org,2002:merge":Jt.merge,"tag:yaml.org,2002:omap":ya.omap,"tag:yaml.org,2002:pairs":ba.pairs,"tag:yaml.org,2002:set":wa.set,"tag:yaml.org,2002:timestamp":ls.timestamp};function bd(e,t,n){let s=da.get(t);if(s&&!e)return n&&!s.includes(Jt.merge)?s.concat(Jt.merge):s.slice();let r=s;if(!r)if(Array.isArray(e))r=[];else{let i=Array.from(da.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${i} or define customTags array`)}if(Array.isArray(e))for(let i of e)r=r.concat(i);else typeof e=="function"&&(r=e(r.slice()));return n&&(r=r.concat(Jt.merge)),r.reduce((i,o)=>{let a=typeof o=="string"?pa[o]:o;if(!a){let c=JSON.stringify(o),f=Object.keys(pa).map(g=>JSON.stringify(g)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${f}`)}return i.includes(a)||i.push(a),i},[])}Mr.coreKnownTags=yd;Mr.getTags=bd});var Fr=R($a=>{"use strict";var Ir=Z(),wd=pt(),kd=ht(),$d=Ut(),cs=ka(),vd=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0,Rr=class e{constructor({compat:t,customTags:n,merge:s,resolveKnownTags:r,schema:i,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(t)?cs.getTags(t,"compat"):t?cs.getTags(null,t):null,this.name=typeof i=="string"&&i||"core",this.knownTags=r?cs.coreKnownTags:{},this.tags=cs.getTags(n,this.name,s),this.toStringOptions=a??null,Object.defineProperty(this,Ir.MAP,{value:wd.map}),Object.defineProperty(this,Ir.SCALAR,{value:$d.string}),Object.defineProperty(this,Ir.SEQ,{value:kd.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?vd:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};$a.Schema=Rr});var Sa=R(va=>{"use strict";var Sd=Z(),jr=_t(),Gt=Rt();function Od(e,t){let n=[],s=t.directives===!0;if(t.directives!==!1&&e.directives){let c=e.directives.toString(e);c?(n.push(c),s=!0):e.directives.docStart&&(s=!0)}s&&n.push("---");let r=jr.createStringifyContext(e,t),{commentString:i}=r.options;if(e.commentBefore){n.length!==1&&n.unshift("");let c=i(e.commentBefore);n.unshift(Gt.indentComment(c,""))}let o=!1,a=null;if(e.contents){if(Sd.isNode(e.contents)){if(e.contents.spaceBefore&&s&&n.push(""),e.contents.commentBefore){let g=i(e.contents.commentBefore);n.push(Gt.indentComment(g,""))}r.forceBlockIndent=!!e.comment,a=e.contents.comment}let c=a?void 0:()=>o=!0,f=jr.stringify(e.contents,r,()=>a=null,c);a&&(f+=Gt.lineComment(f,"",i(a))),(f[0]==="|"||f[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${f}`:n.push(f)}else n.push(jr.stringify(e.contents,r));if(e.directives?.docEnd)if(e.comment){let c=i(e.comment);c.includes(`
|
|
56
|
+
${i.comment}`:s.comment}s=r}e.items[n]=es.isPair(s)?s:new kr.Pair(s)}}else t("Expected a sequence for this tag");return e}function Ho(e,t,n){let{replacer:s}=n,r=new Bu.YAMLSeq(e);r.tag="tag:yaml.org,2002:pairs";let i=0;if(t&&Symbol.iterator in Object(t))for(let o of t){typeof s=="function"&&(o=s.call(t,String(i++),o));let a,c;if(Array.isArray(o))if(o.length===2)a=o[0],c=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let f=Object.keys(o);if(f.length===1)a=f[0],c=o[a];else throw new TypeError(`Expected tuple with one key, not ${f.length} keys`)}else a=o;r.items.push(kr.createPair(a,c,n))}return r}var Ku={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Go,createNode:Ho};ts.createPairs=Ho;ts.pairs=Ku;ts.resolvePairs=Go});var Sr=R(vr=>{"use strict";var Xo=Z(),$r=Ke(),Yt=Je(),Uu=Ge(),Qo=ns(),tt=class e extends Uu.YAMLSeq{constructor(){super(),this.add=Yt.YAMLMap.prototype.add.bind(this),this.delete=Yt.YAMLMap.prototype.delete.bind(this),this.get=Yt.YAMLMap.prototype.get.bind(this),this.has=Yt.YAMLMap.prototype.has.bind(this),this.set=Yt.YAMLMap.prototype.set.bind(this),this.tag=e.tag}toJSON(t,n){if(!n)return super.toJSON(t);let s=new Map;n?.onCreate&&n.onCreate(s);for(let r of this.items){let i,o;if(Xo.isPair(r)?(i=$r.toJS(r.key,"",n),o=$r.toJS(r.value,i,n)):i=$r.toJS(r,"",n),s.has(i))throw new Error("Ordered maps must not include duplicate keys");s.set(i,o)}return s}static from(t,n,s){let r=Qo.createPairs(t,n,s),i=new this;return i.items=r.items,i}};tt.tag="tag:yaml.org,2002:omap";var Wu={collection:"seq",identify:e=>e instanceof Map,nodeClass:tt,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let n=Qo.resolvePairs(e,t),s=[];for(let{key:r}of n.items)Xo.isScalar(r)&&(s.includes(r.value)?t(`Ordered maps must not include duplicate keys: ${r.value}`):s.push(r.value));return Object.assign(new tt,n)},createNode:(e,t,n)=>tt.from(e,t,n)};vr.YAMLOMap=tt;vr.omap=Wu});var sa=R(Or=>{"use strict";var Zo=ue();function ea({value:e,source:t},n){return t&&(e?ta:na).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var ta={identify:e=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Zo.Scalar(!0),stringify:ea},na={identify:e=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Zo.Scalar(!1),stringify:ea};Or.falseTag=na;Or.trueTag=ta});var ra=R(ss=>{"use strict";var Yu=ue(),Ar=mt(),zu={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Ar.stringifyNumber},Vu={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():Ar.stringifyNumber(e)}},Ju={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new Yu.Scalar(parseFloat(e.replace(/_/g,""))),n=e.indexOf(".");if(n!==-1){let s=e.substring(n+1).replace(/_/g,"");s[s.length-1]==="0"&&(t.minFractionDigits=s.length)}return t},stringify:Ar.stringifyNumber};ss.float=Ju;ss.floatExp=Vu;ss.floatNaN=zu});var oa=R(Vt=>{"use strict";var ia=mt(),zt=e=>typeof e=="bigint"||Number.isInteger(e);function rs(e,t,n,{intAsBigInt:s}){let r=e[0];if((r==="-"||r==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),s){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let o=BigInt(e);return r==="-"?BigInt(-1)*o:o}let i=parseInt(e,n);return r==="-"?-1*i:i}function Nr(e,t,n){let{value:s}=e;if(zt(s)){let r=s.toString(t);return s<0?"-"+n+r.substr(1):n+r}return ia.stringifyNumber(e)}var Gu={identify:zt,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>rs(e,2,2,n),stringify:e=>Nr(e,2,"0b")},Hu={identify:zt,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>rs(e,1,8,n),stringify:e=>Nr(e,8,"0")},Xu={identify:zt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>rs(e,0,10,n),stringify:ia.stringifyNumber},Qu={identify:zt,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>rs(e,2,16,n),stringify:e=>Nr(e,16,"0x")};Vt.int=Xu;Vt.intBin=Gu;Vt.intHex=Qu;Vt.intOct=Hu});var xr=R(Er=>{"use strict";var as=Z(),is=ze(),os=Je(),nt=class e extends os.YAMLMap{constructor(t){super(t),this.tag=e.tag}add(t){let n;as.isPair(t)?n=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?n=new is.Pair(t.key,null):n=new is.Pair(t,null),os.findPair(this.items,n.key)||this.items.push(n)}get(t,n){let s=os.findPair(this.items,t);return!n&&as.isPair(s)?as.isScalar(s.key)?s.key.value:s.key:s}set(t,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);let s=os.findPair(this.items,t);s&&!n?this.items.splice(this.items.indexOf(s),1):!s&&n&&this.items.push(new is.Pair(t))}toJSON(t,n){return super.toJSON(t,n,Set)}toString(t,n,s){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),n,s);throw new Error("Set items must all have null values")}static from(t,n,s){let{replacer:r}=s,i=new this(t);if(n&&Symbol.iterator in Object(n))for(let o of n)typeof r=="function"&&(o=r.call(n,o,o)),i.items.push(is.createPair(o,null,s));return i}};nt.tag="tag:yaml.org,2002:set";var Zu={collection:"map",identify:e=>e instanceof Set,nodeClass:nt,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>nt.from(e,t,n),resolve(e,t){if(as.isMap(e)){if(e.hasAllNullValues(!0))return Object.assign(new nt,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};Er.YAMLSet=nt;Er.set=Zu});var Cr=R(ls=>{"use strict";var ed=mt();function Tr(e,t){let n=e[0],s=n==="-"||n==="+"?e.substring(1):e,r=o=>t?BigInt(o):Number(o),i=s.replace(/_/g,"").split(":").reduce((o,a)=>o*r(60)+r(a),r(0));return n==="-"?r(-1)*i:i}function aa(e){let{value:t}=e,n=o=>o;if(typeof t=="bigint")n=o=>BigInt(o);else if(isNaN(t)||!isFinite(t))return ed.stringifyNumber(e);let s="";t<0&&(s="-",t*=n(-1));let r=n(60),i=[t%r];return t<60?i.unshift(0):(t=(t-i[0])/r,i.unshift(t%r),t>=60&&(t=(t-i[0])/r,i.unshift(t))),s+i.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var td={identify:e=>typeof e=="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>Tr(e,n),stringify:aa},nd={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>Tr(e,!1),stringify:aa},la={identify:e=>e instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(e){let t=e.match(la.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,s,r,i,o,a]=t.map(Number),c=t[7]?Number((t[7]+"00").substr(1,3)):0,f=Date.UTC(n,s-1,r,i||0,o||0,a||0,c),g=t[8];if(g&&g!=="Z"){let u=Tr(g,!1);Math.abs(u)<30&&(u*=60),f-=6e4*u}return new Date(f)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};ls.floatTime=nd;ls.intTime=td;ls.timestamp=la});var ua=R(fa=>{"use strict";var sd=pt(),rd=Gn(),id=ht(),od=Ut(),ad=wr(),ca=sa(),Pr=ra(),cs=oa(),ld=Bn(),cd=Sr(),fd=ns(),ud=xr(),qr=Cr(),dd=[sd.map,id.seq,od.string,rd.nullTag,ca.trueTag,ca.falseTag,cs.intBin,cs.intOct,cs.int,cs.intHex,Pr.floatNaN,Pr.floatExp,Pr.float,ad.binary,ld.merge,cd.omap,fd.pairs,ud.set,qr.intTime,qr.floatTime,qr.timestamp];fa.schema=dd});var $a=R(Ir=>{"use strict";var ma=pt(),pd=Gn(),ga=ht(),hd=Ut(),md=ur(),Lr=pr(),Mr=mr(),gd=Wo(),yd=Vo(),ya=wr(),Jt=Bn(),ba=Sr(),wa=ns(),da=ua(),ka=xr(),fs=Cr(),pa=new Map([["core",gd.schema],["failsafe",[ma.map,ga.seq,hd.string]],["json",yd.schema],["yaml11",da.schema],["yaml-1.1",da.schema]]),ha={binary:ya.binary,bool:md.boolTag,float:Lr.float,floatExp:Lr.floatExp,floatNaN:Lr.floatNaN,floatTime:fs.floatTime,int:Mr.int,intHex:Mr.intHex,intOct:Mr.intOct,intTime:fs.intTime,map:ma.map,merge:Jt.merge,null:pd.nullTag,omap:ba.omap,pairs:wa.pairs,seq:ga.seq,set:ka.set,timestamp:fs.timestamp},bd={"tag:yaml.org,2002:binary":ya.binary,"tag:yaml.org,2002:merge":Jt.merge,"tag:yaml.org,2002:omap":ba.omap,"tag:yaml.org,2002:pairs":wa.pairs,"tag:yaml.org,2002:set":ka.set,"tag:yaml.org,2002:timestamp":fs.timestamp};function wd(e,t,n){let s=pa.get(t);if(s&&!e)return n&&!s.includes(Jt.merge)?s.concat(Jt.merge):s.slice();let r=s;if(!r)if(Array.isArray(e))r=[];else{let i=Array.from(pa.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${i} or define customTags array`)}if(Array.isArray(e))for(let i of e)r=r.concat(i);else typeof e=="function"&&(r=e(r.slice()));return n&&(r=r.concat(Jt.merge)),r.reduce((i,o)=>{let a=typeof o=="string"?ha[o]:o;if(!a){let c=JSON.stringify(o),f=Object.keys(ha).map(g=>JSON.stringify(g)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${f}`)}return i.includes(a)||i.push(a),i},[])}Ir.coreKnownTags=bd;Ir.getTags=wd});var jr=R(va=>{"use strict";var Rr=Z(),kd=pt(),$d=ht(),vd=Ut(),us=$a(),Sd=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0,Fr=class e{constructor({compat:t,customTags:n,merge:s,resolveKnownTags:r,schema:i,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(t)?us.getTags(t,"compat"):t?us.getTags(null,t):null,this.name=typeof i=="string"&&i||"core",this.knownTags=r?us.coreKnownTags:{},this.tags=us.getTags(n,this.name,s),this.toStringOptions=a??null,Object.defineProperty(this,Rr.MAP,{value:kd.map}),Object.defineProperty(this,Rr.SCALAR,{value:vd.string}),Object.defineProperty(this,Rr.SEQ,{value:$d.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?Sd:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};va.Schema=Fr});var Oa=R(Sa=>{"use strict";var Od=Z(),Dr=_t(),Gt=Rt();function Ad(e,t){let n=[],s=t.directives===!0;if(t.directives!==!1&&e.directives){let c=e.directives.toString(e);c?(n.push(c),s=!0):e.directives.docStart&&(s=!0)}s&&n.push("---");let r=Dr.createStringifyContext(e,t),{commentString:i}=r.options;if(e.commentBefore){n.length!==1&&n.unshift("");let c=i(e.commentBefore);n.unshift(Gt.indentComment(c,""))}let o=!1,a=null;if(e.contents){if(Od.isNode(e.contents)){if(e.contents.spaceBefore&&s&&n.push(""),e.contents.commentBefore){let g=i(e.contents.commentBefore);n.push(Gt.indentComment(g,""))}r.forceBlockIndent=!!e.comment,a=e.contents.comment}let c=a?void 0:()=>o=!0,f=Dr.stringify(e.contents,r,()=>a=null,c);a&&(f+=Gt.lineComment(f,"",i(a))),(f[0]==="|"||f[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${f}`:n.push(f)}else n.push(Dr.stringify(e.contents,r));if(e.directives?.docEnd)if(e.comment){let c=i(e.comment);c.includes(`
|
|
57
57
|
`)?(n.push("..."),n.push(Gt.indentComment(c,""))):n.push(`... ${c}`)}else n.push("...");else{let c=e.comment;c&&o&&(c=c.replace(/^\n+/,"")),c&&((!o||a)&&n[n.length-1]!==""&&n.push(""),n.push(Gt.indentComment(i(c),"")))}return n.join(`
|
|
58
58
|
`)+`
|
|
59
|
-
`}
|
|
59
|
+
`}Sa.stringifyDocument=Ad});var Ht=R(Aa=>{"use strict";var Nd=Mt(),gt=Pn(),Te=Z(),Ed=ze(),xd=Ke(),Td=jr(),Cd=Oa(),_r=En(),Pd=Ws(),qd=It(),Br=Us(),Kr=class e{constructor(t,n,s){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Te.NODE_TYPE,{value:Te.DOC});let r=null;typeof n=="function"||Array.isArray(n)?r=n:s===void 0&&n&&(s=n,n=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 Br.Directives({version:o}),this.setSchema(o,s),this.contents=t===void 0?null:this.createNode(t,r,s)}clone(){let t=Object.create(e.prototype,{[Te.NODE_TYPE]:{value:Te.DOC}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=Te.isNode(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){yt(this.contents)&&this.contents.add(t)}addIn(t,n){yt(this.contents)&&this.contents.addIn(t,n)}createAlias(t,n){if(!t.anchor){let s=_r.anchorNames(this);t.anchor=!n||s.has(n)?_r.findNewAnchor(n||"a",s):n}return new Nd.Alias(t.anchor)}createNode(t,n,s){let r;if(typeof n=="function")t=n.call({"":t},"",t),r=n;else if(Array.isArray(n)){let y=v=>typeof v=="number"||v instanceof String||v instanceof Number,k=n.filter(y).map(String);k.length>0&&(n=n.concat(k)),r=n}else s===void 0&&n&&(s=n,n=void 0);let{aliasDuplicateObjects:i,anchorPrefix:o,flow:a,keepUndefined:c,onTagObj:f,tag:g}=s??{},{onAnchor:u,setAnchors:l,sourceObjects:p}=_r.createNodeAnchors(this,o||"a"),d={aliasDuplicateObjects:i??!0,keepUndefined:c??!1,onAnchor:u,onTagObj:f,replacer:r,schema:this.schema,sourceObjects:p},m=qd.createNode(t,g,d);return a&&Te.isCollection(m)&&(m.flow=!0),l(),m}createPair(t,n,s={}){let r=this.createNode(t,null,s),i=this.createNode(n,null,s);return new Ed.Pair(r,i)}delete(t){return yt(this.contents)?this.contents.delete(t):!1}deleteIn(t){return gt.isEmptyPath(t)?this.contents==null?!1:(this.contents=null,!0):yt(this.contents)?this.contents.deleteIn(t):!1}get(t,n){return Te.isCollection(this.contents)?this.contents.get(t,n):void 0}getIn(t,n){return gt.isEmptyPath(t)?!n&&Te.isScalar(this.contents)?this.contents.value:this.contents:Te.isCollection(this.contents)?this.contents.getIn(t,n):void 0}has(t){return Te.isCollection(this.contents)?this.contents.has(t):!1}hasIn(t){return gt.isEmptyPath(t)?this.contents!==void 0:Te.isCollection(this.contents)?this.contents.hasIn(t):!1}set(t,n){this.contents==null?this.contents=gt.collectionFromPath(this.schema,[t],n):yt(this.contents)&&this.contents.set(t,n)}setIn(t,n){gt.isEmptyPath(t)?this.contents=n:this.contents==null?this.contents=gt.collectionFromPath(this.schema,Array.from(t),n):yt(this.contents)&&this.contents.setIn(t,n)}setSchema(t,n={}){typeof t=="number"&&(t=String(t));let s;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new Br.Directives({version:"1.1"}),s={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new Br.Directives({version:t}),s={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,s=null;break;default:{let r=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${r}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(s)this.schema=new Td.Schema(Object.assign(s,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:n,mapAsMap:s,maxAliasCount:r,onAnchor:i,reviver:o}={}){let a={anchors:new Map,doc:this,keep:!t,mapAsMap:s===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},c=xd.toJS(this.contents,n??"",a);if(typeof i=="function")for(let{count:f,res:g}of a.anchors.values())i(g,f);return typeof o=="function"?Pd.applyReviver(o,{"":c},"",c):c}toJSON(t,n){return this.toJS({json:!0,jsonArg:t,mapAsMap:!1,onAnchor:n})}toString(t={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in t&&(!Number.isInteger(t.indent)||Number(t.indent)<=0)){let n=JSON.stringify(t.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return Cd.stringifyDocument(this,t)}};function yt(e){if(Te.isCollection(e))return!0;throw new Error("Expected a YAML collection as document contents")}Aa.Document=Kr});var Zt=R(Qt=>{"use strict";var Xt=class extends Error{constructor(t,n,s,r){super(),this.name=t,this.code=s,this.message=r,this.pos=n}},Ur=class extends Xt{constructor(t,n,s){super("YAMLParseError",t,n,s)}},Wr=class extends Xt{constructor(t,n,s){super("YAMLWarning",t,n,s)}},Ld=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(a=>t.linePos(a));let{line:s,col:r}=n.linePos[0];n.message+=` at line ${s}, column ${r}`;let i=r-1,o=e.substring(t.lineStarts[s-1],t.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=e.substring(t.lineStarts[s-2],t.lineStarts[s-1]);a.length>80&&(a=a.substring(0,79)+`\u2026
|
|
60
60
|
`),o=a+o}if(/[^ ]/.test(o)){let a=1,c=n.linePos[1];c?.line===s&&c.col>r&&(a=Math.max(1,Math.min(c.col-r,80-i)));let f=" ".repeat(i)+"^".repeat(a);n.message+=`:
|
|
61
61
|
|
|
62
62
|
${o}
|
|
63
63
|
${f}
|
|
64
|
-
`}};Qt.YAMLError=Xt;Qt.YAMLParseError=
|
|
65
|
-
`))return!0;if(e.end){for(let t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(let t of e.items){for(let n of t.start)if(n.type==="newline")return!0;if(t.sep){for(let n of t.sep)if(n.type==="newline")return!0}if(
|
|
66
|
-
`+m.comment:a.comment=m.comment);continue}(m.newlineAfterProp||
|
|
67
|
-
`+S.comment:v.comment=S.comment);let T=new
|
|
68
|
-
`+
|
|
69
|
-
`+M:C.comment=M,
|
|
70
|
-
`+$.comment:C.comment=$.comment);let K=new
|
|
71
|
-
`+y.comment:f.comment=y.comment),f.range=[s.offset,m,y.offset]}else f.range=[s.offset,m,m];return f}
|
|
64
|
+
`}};Qt.YAMLError=Xt;Qt.YAMLParseError=Ur;Qt.YAMLWarning=Wr;Qt.prettifyError=Ld});var en=R(Na=>{"use strict";function Md(e,{flow:t,indicator:n,next:s,offset:r,onError:i,parentIndent:o,startOnNewline:a}){let c=!1,f=a,g=a,u="",l="",p=!1,d=!1,m=null,y=null,k=null,v=null,S=null,T=null,N=null;for(let C of e)switch(d&&(C.type!=="space"&&C.type!=="newline"&&C.type!=="comma"&&i(C.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),d=!1),m&&(f&&C.type!=="comment"&&C.type!=="newline"&&i(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),m=null),C.type){case"space":!t&&(n!=="doc-start"||s?.type!=="flow-collection")&&C.source.includes(" ")&&(m=C),g=!0;break;case"comment":{g||i(C,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let $=C.source.substring(1)||" ";u?u+=l+$:u=$,l="",f=!1;break}case"newline":f?u?u+=C.source:(!T||n!=="seq-item-ind")&&(c=!0):l+=C.source,f=!0,p=!0,(y||k)&&(v=C),g=!0;break;case"anchor":y&&i(C,"MULTIPLE_ANCHORS","A node can have at most one anchor"),C.source.endsWith(":")&&i(C.offset+C.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),y=C,N??(N=C.offset),f=!1,g=!1,d=!0;break;case"tag":{k&&i(C,"MULTIPLE_TAGS","A node can have at most one tag"),k=C,N??(N=C.offset),f=!1,g=!1,d=!0;break}case n:(y||k)&&i(C,"BAD_PROP_ORDER",`Anchors and tags must be after the ${C.source} indicator`),T&&i(C,"UNEXPECTED_TOKEN",`Unexpected ${C.source} in ${t??"collection"}`),T=C,f=n==="seq-item-ind"||n==="explicit-key-ind",g=!1;break;case"comma":if(t){S&&i(C,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),S=C,f=!1,g=!1;break}default:i(C,"UNEXPECTED_TOKEN",`Unexpected ${C.type} token`),f=!1,g=!1}let P=e[e.length-1],M=P?P.offset+P.source.length:r;return d&&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"),m&&(f&&m.indent<=o||s?.type==="block-map"||s?.type==="block-seq")&&i(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:S,found:T,spaceBefore:c,comment:u,hasNewline:p,anchor:y,tag:k,newlineAfterProp:v,end:M,start:N??M}}Na.resolveProps=Md});var ds=R(Ea=>{"use strict";function Yr(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes(`
|
|
65
|
+
`))return!0;if(e.end){for(let t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(let t of e.items){for(let n of t.start)if(n.type==="newline")return!0;if(t.sep){for(let n of t.sep)if(n.type==="newline")return!0}if(Yr(t.key)||Yr(t.value))return!0}return!1;default:return!0}}Ea.containsNewline=Yr});var zr=R(xa=>{"use strict";var Id=ds();function Rd(e,t,n){if(t?.type==="flow-collection"){let s=t.end[0];s.indent===e&&(s.source==="]"||s.source==="}")&&Id.containsNewline(t)&&n(s,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}xa.flowIndentCheck=Rd});var Vr=R(Ca=>{"use strict";var Ta=Z();function Fd(e,t,n){let{uniqueKeys:s}=e.options;if(s===!1)return!1;let r=typeof s=="function"?s:(i,o)=>i===o||Ta.isScalar(i)&&Ta.isScalar(o)&&i.value===o.value;return t.some(i=>r(i.key,n))}Ca.mapIncludes=Fd});var Ra=R(Ia=>{"use strict";var Pa=ze(),jd=Je(),qa=en(),Dd=ds(),La=zr(),_d=Vr(),Ma="All mapping items must start at the same column";function Bd({composeNode:e,composeEmptyNode:t},n,s,r,i){let o=i?.nodeClass??jd.YAMLMap,a=new o(n.schema);n.atRoot&&(n.atRoot=!1);let c=s.offset,f=null;for(let g of s.items){let{start:u,key:l,sep:p,value:d}=g,m=qa.resolveProps(u,{indicator:"explicit-key-ind",next:l??p?.[0],offset:c,onError:r,parentIndent:s.indent,startOnNewline:!0}),y=!m.found;if(y){if(l&&(l.type==="block-seq"?r(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in l&&l.indent!==s.indent&&r(c,"BAD_INDENT",Ma)),!m.anchor&&!m.tag&&!p){f=m.end,m.comment&&(a.comment?a.comment+=`
|
|
66
|
+
`+m.comment:a.comment=m.comment);continue}(m.newlineAfterProp||Dd.containsNewline(l))&&r(l??u[u.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else m.found?.indent!==s.indent&&r(c,"BAD_INDENT",Ma);n.atKey=!0;let k=m.end,v=l?e(n,l,m,r):t(n,k,u,null,m,r);n.schema.compat&&La.flowIndentCheck(s.indent,l,r),n.atKey=!1,_d.mapIncludes(n,a.items,v)&&r(k,"DUPLICATE_KEY","Map keys must be unique");let S=qa.resolveProps(p??[],{indicator:"map-value-ind",next:d,offset:v.range[2],onError:r,parentIndent:s.indent,startOnNewline:!l||l.type==="block-scalar"});if(c=S.end,S.found){y&&(d?.type==="block-map"&&!S.hasNewline&&r(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&m.start<S.found.offset-1024&&r(v.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let T=d?e(n,d,S,r):t(n,c,p,null,S,r);n.schema.compat&&La.flowIndentCheck(s.indent,d,r),c=T.range[2];let N=new Pa.Pair(v,T);n.options.keepSourceTokens&&(N.srcToken=g),a.items.push(N)}else{y&&r(v.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),S.comment&&(v.comment?v.comment+=`
|
|
67
|
+
`+S.comment:v.comment=S.comment);let T=new Pa.Pair(v);n.options.keepSourceTokens&&(T.srcToken=g),a.items.push(T)}}return f&&f<c&&r(f,"IMPOSSIBLE","Map comment with trailing content"),a.range=[s.offset,c,f??c],a}Ia.resolveBlockMap=Bd});var ja=R(Fa=>{"use strict";var Kd=Ge(),Ud=en(),Wd=zr();function Yd({composeNode:e,composeEmptyNode:t},n,s,r,i){let o=i?.nodeClass??Kd.YAMLSeq,a=new o(n.schema);n.atRoot&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let c=s.offset,f=null;for(let{start:g,value:u}of s.items){let l=Ud.resolveProps(g,{indicator:"seq-item-ind",next:u,offset:c,onError:r,parentIndent:s.indent,startOnNewline:!0});if(!l.found)if(l.anchor||l.tag||u)u?.type==="block-seq"?r(l.end,"BAD_INDENT","All sequence items must start at the same column"):r(c,"MISSING_CHAR","Sequence item without - indicator");else{f=l.end,l.comment&&(a.comment=l.comment);continue}let p=u?e(n,u,l,r):t(n,l.end,g,null,l,r);n.schema.compat&&Wd.flowIndentCheck(s.indent,u,r),c=p.range[2],a.items.push(p)}return a.range=[s.offset,c,f??c],a}Fa.resolveBlockSeq=Yd});var bt=R(Da=>{"use strict";function zd(e,t,n,s){let r="";if(e){let i=!1,o="";for(let a of e){let{source:c,type:f}=a;switch(f){case"space":i=!0;break;case"comment":{n&&!i&&s(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let g=c.substring(1)||" ";r?r+=o+g:r=g,o="";break}case"newline":r&&(o+=c),i=!0;break;default:s(a,"UNEXPECTED_TOKEN",`Unexpected ${f} at node end`)}t+=c.length}}return{comment:r,offset:t}}Da.resolveEnd=zd});var Ua=R(Ka=>{"use strict";var Vd=Z(),Jd=ze(),_a=Je(),Gd=Ge(),Hd=bt(),Ba=en(),Xd=ds(),Qd=Vr(),Jr="Block collections are not allowed within flow collections",Gr=e=>e&&(e.type==="block-map"||e.type==="block-seq");function Zd({composeNode:e,composeEmptyNode:t},n,s,r,i){let o=s.start.source==="{",a=o?"flow map":"flow sequence",c=i?.nodeClass??(o?_a.YAMLMap:Gd.YAMLSeq),f=new c(n.schema);f.flow=!0;let g=n.atRoot;g&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let u=s.offset+s.start.source.length;for(let y=0;y<s.items.length;++y){let k=s.items[y],{start:v,key:S,sep:T,value:N}=k,P=Ba.resolveProps(v,{flow:a,indicator:"explicit-key-ind",next:S??T?.[0],offset:u,onError:r,parentIndent:s.indent,startOnNewline:!1});if(!P.found){if(!P.anchor&&!P.tag&&!T&&!N){y===0&&P.comma?r(P.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):y<s.items.length-1&&r(P.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),P.comment&&(f.comment?f.comment+=`
|
|
68
|
+
`+P.comment:f.comment=P.comment),u=P.end;continue}!o&&n.options.strict&&Xd.containsNewline(S)&&r(S,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(y===0)P.comma&&r(P.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(P.comma||r(P.start,"MISSING_CHAR",`Missing , between ${a} items`),P.comment){let M="";e:for(let C of v)switch(C.type){case"comma":case"space":break;case"comment":M=C.source.substring(1);break e;default:break e}if(M){let C=f.items[f.items.length-1];Vd.isPair(C)&&(C=C.value??C.key),C.comment?C.comment+=`
|
|
69
|
+
`+M:C.comment=M,P.comment=P.comment.substring(M.length+1)}}if(!o&&!T&&!P.found){let M=N?e(n,N,P,r):t(n,P.end,T,null,P,r);f.items.push(M),u=M.range[2],Gr(N)&&r(M.range,"BLOCK_IN_FLOW",Jr)}else{n.atKey=!0;let M=P.end,C=S?e(n,S,P,r):t(n,M,v,null,P,r);Gr(S)&&r(C.range,"BLOCK_IN_FLOW",Jr),n.atKey=!1;let $=Ba.resolveProps(T??[],{flow:a,indicator:"map-value-ind",next:N,offset:C.range[2],onError:r,parentIndent:s.indent,startOnNewline:!1});if($.found){if(!o&&!P.found&&n.options.strict){if(T)for(let J of T){if(J===$.found)break;if(J.type==="newline"){r(J,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}P.start<$.found.offset-1024&&r($.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else N&&("source"in N&&N.source?.[0]===":"?r(N,"MISSING_CHAR",`Missing space after : in ${a}`):r($.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let L=N?e(n,N,$,r):$.found?t(n,$.end,T,null,$,r):null;L?Gr(N)&&r(L.range,"BLOCK_IN_FLOW",Jr):$.comment&&(C.comment?C.comment+=`
|
|
70
|
+
`+$.comment:C.comment=$.comment);let K=new Jd.Pair(C,L);if(n.options.keepSourceTokens&&(K.srcToken=k),o){let J=f;Qd.mapIncludes(n,J.items,C)&&r(M,"DUPLICATE_KEY","Map keys must be unique"),J.items.push(K)}else{let J=new _a.YAMLMap(n.schema);J.flow=!0,J.items.push(K);let fe=(L??C).range;J.range=[C.range[0],fe[1],fe[2]],f.items.push(J)}u=L?L.range[2]:$.end}}let l=o?"}":"]",[p,...d]=s.end,m=u;if(p?.source===l)m=p.offset+p.source.length;else{let y=a[0].toUpperCase()+a.substring(1),k=g?`${y} must end with a ${l}`:`${y} in block collection must be sufficiently indented and end with a ${l}`;r(u,g?"MISSING_CHAR":"BAD_INDENT",k),p&&p.source.length!==1&&d.unshift(p)}if(d.length>0){let y=Hd.resolveEnd(d,m,n.options.strict,r);y.comment&&(f.comment?f.comment+=`
|
|
71
|
+
`+y.comment:f.comment=y.comment),f.range=[s.offset,m,y.offset]}else f.range=[s.offset,m,m];return f}Ka.resolveFlowCollection=Zd});var Ya=R(Wa=>{"use strict";var ep=Z(),tp=ue(),np=Je(),sp=Ge(),rp=Ra(),ip=ja(),op=Ua();function Hr(e,t,n,s,r,i){let o=n.type==="block-map"?rp.resolveBlockMap(e,t,n,s,i):n.type==="block-seq"?ip.resolveBlockSeq(e,t,n,s,i):op.resolveFlowCollection(e,t,n,s,i),a=o.constructor;return r==="!"||r===a.tagName?(o.tag=a.tagName,o):(r&&(o.tag=r),o)}function ap(e,t,n,s,r){let i=s.tag,o=i?t.directives.tagName(i.source,l=>r(i,"TAG_RESOLVE_FAILED",l)):null;if(n.type==="block-seq"){let{anchor:l,newlineAfterProp:p}=s,d=l&&i?l.offset>i.offset?l:i:l??i;d&&(!p||p.offset<d.offset)&&r(d,"MISSING_CHAR","Missing newline after block sequence props")}let a=n.type==="block-map"?"map":n.type==="block-seq"?"seq":n.start.source==="{"?"map":"seq";if(!i||!o||o==="!"||o===np.YAMLMap.tagName&&a==="map"||o===sp.YAMLSeq.tagName&&a==="seq")return Hr(e,t,n,r,o);let c=t.schema.tags.find(l=>l.tag===o&&l.collection===a);if(!c){let l=t.schema.knownTags[o];if(l?.collection===a)t.schema.tags.push(Object.assign({},l,{default:!1})),c=l;else return l?r(i,"BAD_COLLECTION_TYPE",`${l.tag} used for ${a} collection, but expects ${l.collection??"scalar"}`,!0):r(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),Hr(e,t,n,r,o)}let f=Hr(e,t,n,r,o,c),g=c.resolve?.(f,l=>r(i,"TAG_RESOLVE_FAILED",l),t.options)??f,u=ep.isNode(g)?g:new tp.Scalar(g);return u.range=f.range,u.tag=o,c?.format&&(u.format=c.format),u}Wa.composeCollection=ap});var Qr=R(za=>{"use strict";var Xr=ue();function lp(e,t,n){let s=t.offset,r=cp(t,e.options.strict,n);if(!r)return{value:"",type:null,comment:"",range:[s,s,s]};let i=r.mode===">"?Xr.Scalar.BLOCK_FOLDED:Xr.Scalar.BLOCK_LITERAL,o=t.source?fp(t.source):[],a=o.length;for(let m=o.length-1;m>=0;--m){let y=o[m][1];if(y===""||y==="\r")a=m;else break}if(a===0){let m=r.chomp==="+"&&o.length>0?`
|
|
72
72
|
`.repeat(Math.max(1,o.length-1)):"",y=s+r.length;return t.source&&(y+=t.source.length),{value:m,type:i,comment:r.comment,range:[s,y,y]}}let c=t.indent+r.indent,f=t.offset+r.length,g=0;for(let m=0;m<a;++m){let[y,k]=o[m];if(k===""||k==="\r")r.indent===0&&y.length>c&&(c=y.length);else{y.length<c&&n(f+y.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),r.indent===0&&(c=y.length),g=m,c===0&&!e.atRoot&&n(f,"BAD_INDENT","Block scalar values in collections must be indented");break}f+=y.length+k.length+1}for(let m=o.length-1;m>=a;--m)o[m][0].length>c&&(a=m+1);let u="",l="",p=!1;for(let m=0;m<g;++m)u+=o[m][0].slice(c)+`
|
|
73
|
-
`;for(let m=g;m<a;++m){let[y,k]=o[m];f+=y.length+k.length+1;let v=k[k.length-1]==="\r";if(v&&(k=k.slice(0,-1)),k&&y.length<c){let T=`Block scalar lines must not be less indented than their ${r.indent?"explicit indentation indicator":"first line"}`;n(f-k.length-(v?2:1),"BAD_INDENT",T),y=""}i===
|
|
73
|
+
`;for(let m=g;m<a;++m){let[y,k]=o[m];f+=y.length+k.length+1;let v=k[k.length-1]==="\r";if(v&&(k=k.slice(0,-1)),k&&y.length<c){let T=`Block scalar lines must not be less indented than their ${r.indent?"explicit indentation indicator":"first line"}`;n(f-k.length-(v?2:1),"BAD_INDENT",T),y=""}i===Xr.Scalar.BLOCK_LITERAL?(u+=l+y.slice(c)+k,l=`
|
|
74
74
|
`):y.length>c||k[0]===" "?(l===" "?l=`
|
|
75
75
|
`:!p&&l===`
|
|
76
76
|
`&&(l=`
|
|
@@ -83,65 +83,65 @@ ${f}
|
|
|
83
83
|
`+o[m][0].slice(c);u[u.length-1]!==`
|
|
84
84
|
`&&(u+=`
|
|
85
85
|
`);break;default:u+=`
|
|
86
|
-
`}let d=s+r.length+t.source.length;return{value:u,type:i,comment:r.comment,range:[s,d,d]}}function
|
|
86
|
+
`}let d=s+r.length+t.source.length;return{value:u,type:i,comment:r.comment,range:[s,d,d]}}function cp({offset:e,props:t},n,s){if(t[0].type!=="block-scalar-header")return s(t[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:r}=t[0],i=r[0],o=0,a="",c=-1;for(let l=1;l<r.length;++l){let p=r[l];if(!a&&(p==="-"||p==="+"))a=p;else{let d=Number(p);!o&&d?o=d:c===-1&&(c=e+l)}}c!==-1&&s(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${r}`);let f=!1,g="",u=r.length;for(let l=1;l<t.length;++l){let p=t[l];switch(p.type){case"space":f=!0;case"newline":u+=p.source.length;break;case"comment":n&&!f&&s(p,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),u+=p.source.length,g=p.source.substring(1);break;case"error":s(p,"UNEXPECTED_TOKEN",p.message),u+=p.source.length;break;default:{let d=`Unexpected token in block scalar header: ${p.type}`;s(p,"UNEXPECTED_TOKEN",d);let m=p.source;m&&typeof m=="string"&&(u+=m.length)}}}return{mode:i,indent:o,chomp:a,comment:g,length:u}}function fp(e){let t=e.split(/\n( *)/),n=t[0],s=n.match(/^( *)/),i=[s?.[1]?[s[1],n.slice(s[1].length)]:["",n]];for(let o=1;o<t.length;o+=2)i.push([t[o],t[o+1]]);return i}za.resolveBlockScalar=lp});var ei=R(Ja=>{"use strict";var Zr=ue(),up=bt();function dp(e,t,n){let{offset:s,type:r,source:i,end:o}=e,a,c,f=(l,p,d)=>n(s+l,p,d);switch(r){case"scalar":a=Zr.Scalar.PLAIN,c=pp(i,f);break;case"single-quoted-scalar":a=Zr.Scalar.QUOTE_SINGLE,c=hp(i,f);break;case"double-quoted-scalar":a=Zr.Scalar.QUOTE_DOUBLE,c=mp(i,f);break;default:return n(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${r}`),{value:"",type:null,comment:"",range:[s,s+i.length,s+i.length]}}let g=s+i.length,u=up.resolveEnd(o,g,t,n);return{value:c,type:a,comment:u.comment,range:[s,g,u.offset]}}function pp(e,t){let n="";switch(e[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${e[0]}`;break}case"@":case"`":{n=`reserved character ${e[0]}`;break}}return n&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),Va(e)}function hp(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),Va(e.slice(1,-1)).replace(/''/g,"'")}function Va(e){let t=/(.*?)\r?\n/sy,n=t.exec(e);if(!n)return e;let s,r;try{s=new RegExp("(?<![ ])[ ]+$"),r=new RegExp("^[ ]+|(?<![ ])[ ]+$","g")}catch{s=/[ \t]+$/,r=/^[ \t]+|[ \t]+$/g}let i=n[1].replace(s,""),o=" ",a=t.lastIndex;for(;n=t.exec(e);){let f=n[1].replace(r,"");f===""?o===`
|
|
87
87
|
`?i+=o:o=`
|
|
88
|
-
`:(i+=o+f,o=" "),a=t.lastIndex}let c=/[ \t]*(.*)/sy;return c.lastIndex=a,n=c.exec(e),i+o+(n?.[1]??"")}function
|
|
88
|
+
`:(i+=o+f,o=" "),a=t.lastIndex}let c=/[ \t]*(.*)/sy;return c.lastIndex=a,n=c.exec(e),i+o+(n?.[1]??"")}function mp(e,t){let n="";for(let s=1;s<e.length-1;++s){let r=e[s];if(!(r==="\r"&&e[s+1]===`
|
|
89
89
|
`))if(r===`
|
|
90
|
-
`){let{fold:i,offset:o}=
|
|
90
|
+
`){let{fold:i,offset:o}=gp(e,s);n+=i,s=o}else if(r==="\\"){let i=e[++s],o=yp[i];if(o)n+=o;else if(i===`
|
|
91
91
|
`)for(i=e[s+1];i===" "||i===" ";)i=e[++s+1];else if(i==="\r"&&e[s+1]===`
|
|
92
|
-
`)for(i=e[++s+1];i===" "||i===" ";)i=e[++s+1];else if(i==="x"||i==="u"||i==="U"){let a=i==="x"?2:i==="u"?4:8;n+=
|
|
92
|
+
`)for(i=e[++s+1];i===" "||i===" ";)i=e[++s+1];else if(i==="x"||i==="u"||i==="U"){let a=i==="x"?2:i==="u"?4:8;n+=bp(e,s+1,a,t),s+=a}else{let a=e.substr(s-1,2);t(s-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),n+=a}}else if(r===" "||r===" "){let i=s,o=e[s+1];for(;o===" "||o===" ";)o=e[++s+1];o!==`
|
|
93
93
|
`&&!(o==="\r"&&e[s+2]===`
|
|
94
|
-
`)&&(n+=s>i?e.slice(i,s+1):r)}else n+=r}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),n}function
|
|
94
|
+
`)&&(n+=s>i?e.slice(i,s+1):r)}else n+=r}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),n}function gp(e,t){let n="",s=e[t+1];for(;(s===" "||s===" "||s===`
|
|
95
95
|
`||s==="\r")&&!(s==="\r"&&e[t+2]!==`
|
|
96
96
|
`);)s===`
|
|
97
97
|
`&&(n+=`
|
|
98
|
-
`),t+=1,s=e[t+1];return n||(n=" "),{fold:n,offset:t}}var
|
|
99
|
-
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function
|
|
98
|
+
`),t+=1,s=e[t+1];return n||(n=" "),{fold:n,offset:t}}var yp={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
|
99
|
+
`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function bp(e,t,n,s){let r=e.substr(t,n),o=r.length===n&&/^[0-9a-fA-F]+$/.test(r)?parseInt(r,16):NaN;try{return String.fromCodePoint(o)}catch{let a=e.substr(t-2,n+2);return s(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}Ja.resolveFlowScalar=dp});var Xa=R(Ha=>{"use strict";var st=Z(),Ga=ue(),wp=Qr(),kp=ei();function $p(e,t,n,s){let{value:r,type:i,comment:o,range:a}=t.type==="block-scalar"?wp.resolveBlockScalar(e,t,s):kp.resolveFlowScalar(t,e.options.strict,s),c=n?e.directives.tagName(n.source,u=>s(n,"TAG_RESOLVE_FAILED",u)):null,f;e.options.stringKeys&&e.atKey?f=e.schema[st.SCALAR]:c?f=vp(e.schema,r,c,n,s):t.type==="scalar"?f=Sp(e,r,t,s):f=e.schema[st.SCALAR];let g;try{let u=f.resolve(r,l=>s(n??t,"TAG_RESOLVE_FAILED",l),e.options);g=st.isScalar(u)?u:new Ga.Scalar(u)}catch(u){let l=u instanceof Error?u.message:String(u);s(n??t,"TAG_RESOLVE_FAILED",l),g=new Ga.Scalar(r)}return g.range=a,g.source=r,i&&(g.type=i),c&&(g.tag=c),f.format&&(g.format=f.format),o&&(g.comment=o),g}function vp(e,t,n,s,r){if(n==="!")return e[st.SCALAR];let i=[];for(let a of e.tags)if(!a.collection&&a.tag===n)if(a.default&&a.test)i.push(a);else return a;for(let a of i)if(a.test?.test(t))return a;let o=e.knownTags[n];return o&&!o.collection?(e.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(r(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),e[st.SCALAR])}function Sp({atKey:e,directives:t,schema:n},s,r,i){let o=n.tags.find(a=>(a.default===!0||e&&a.default==="key")&&a.test?.test(s))||n[st.SCALAR];if(n.compat){let a=n.compat.find(c=>c.default&&c.test?.test(s))??n[st.SCALAR];if(o.tag!==a.tag){let c=t.tagString(o.tag),f=t.tagString(a.tag),g=`Value may be parsed as either ${c} or ${f}`;i(r,"TAG_RESOLVE_FAILED",g,!0)}}return o}Ha.composeScalar=$p});var Za=R(Qa=>{"use strict";function Op(e,t,n){if(t){n??(n=t.length);for(let s=n-1;s>=0;--s){let r=t[s];switch(r.type){case"space":case"comment":case"newline":e-=r.source.length;continue}for(r=t[++s];r?.type==="space";)e+=r.source.length,r=t[++s];break}}return e}Qa.emptyScalarPosition=Op});var nl=R(ni=>{"use strict";var Ap=Mt(),Np=Z(),Ep=Ya(),el=Xa(),xp=bt(),Tp=Za(),Cp={composeNode:tl,composeEmptyNode:ti};function tl(e,t,n,s){let r=e.atKey,{spaceBefore:i,comment:o,anchor:a,tag:c}=n,f,g=!0;switch(t.type){case"alias":f=Pp(e,t,s),(a||c)&&s(t,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":f=el.composeScalar(e,t,c,s),a&&(f.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{f=Ep.composeCollection(Cp,e,t,n,s),a&&(f.anchor=a.source.substring(1))}catch(u){let l=u instanceof Error?u.message:String(u);s(t,"RESOURCE_EXHAUSTION",l)}break;default:{let u=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;s(t,"UNEXPECTED_TOKEN",u),g=!1}}return f??(f=ti(e,t.offset,void 0,null,n,s)),a&&f.anchor===""&&s(a,"BAD_ALIAS","Anchor cannot be an empty string"),r&&e.options.stringKeys&&(!Np.isScalar(f)||typeof f.value!="string"||f.tag&&f.tag!=="tag:yaml.org,2002:str")&&s(c??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),i&&(f.spaceBefore=!0),o&&(t.type==="scalar"&&t.source===""?f.comment=o:f.commentBefore=o),e.options.keepSourceTokens&&g&&(f.srcToken=t),f}function ti(e,t,n,s,{spaceBefore:r,comment:i,anchor:o,tag:a,end:c},f){let g={type:"scalar",offset:Tp.emptyScalarPosition(t,n,s),indent:-1,source:""},u=el.composeScalar(e,g,a,f);return o&&(u.anchor=o.source.substring(1),u.anchor===""&&f(o,"BAD_ALIAS","Anchor cannot be an empty string")),r&&(u.spaceBefore=!0),i&&(u.comment=i,u.range[2]=c),u}function Pp({options:e},{offset:t,source:n,end:s},r){let i=new Ap.Alias(n.substring(1));i.source===""&&r(t,"BAD_ALIAS","Alias cannot be an empty string"),i.source.endsWith(":")&&r(t+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=t+n.length,a=xp.resolveEnd(s,o,e.strict,r);return i.range=[t,o,a.offset],a.comment&&(i.comment=a.comment),i}ni.composeEmptyNode=ti;ni.composeNode=tl});var il=R(rl=>{"use strict";var qp=Ht(),sl=nl(),Lp=bt(),Mp=en();function Ip(e,t,{offset:n,start:s,value:r,end:i},o){let a=Object.assign({_directives:t},e),c=new qp.Document(void 0,a),f={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},g=Mp.resolveProps(s,{indicator:"doc-start",next:r??i?.[0],offset:n,onError:o,parentIndent:0,startOnNewline:!0});g.found&&(c.directives.docStart=!0,r&&(r.type==="block-map"||r.type==="block-seq")&&!g.hasNewline&&o(g.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=r?sl.composeNode(f,r,g,o):sl.composeEmptyNode(f,g.end,s,null,g,o);let u=c.contents.range[2],l=Lp.resolveEnd(i,u,!1,o);return l.comment&&(c.comment=l.comment),c.range=[n,u,l.offset],c}rl.composeDoc=Ip});var ri=R(ll=>{"use strict";var Rp=$n("process"),Fp=Us(),jp=Ht(),tn=Zt(),ol=Z(),Dp=il(),_p=bt();function nn(e){if(typeof e=="number")return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:n}=e;return[t,t+(typeof n=="string"?n.length:1)]}function al(e){let t="",n=!1,s=!1;for(let r=0;r<e.length;++r){let i=e[r];switch(i[0]){case"#":t+=(t===""?"":s?`
|
|
100
100
|
|
|
101
101
|
`:`
|
|
102
|
-
`)+(i.substring(1)||" "),n=!0,s=!1;break;case"%":e[r+1]?.[0]!=="#"&&(r+=1),n=!1;break;default:n||(s=!0),n=!1}}return{comment:t,afterEmptyLine:s}}var
|
|
103
|
-
${s}`:s;else if(r||t.directives.docStart||!i)t.commentBefore=s;else if(
|
|
102
|
+
`)+(i.substring(1)||" "),n=!0,s=!1;break;case"%":e[r+1]?.[0]!=="#"&&(r+=1),n=!1;break;default:n||(s=!0),n=!1}}return{comment:t,afterEmptyLine:s}}var si=class{constructor(t={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,s,r,i)=>{let o=nn(n);i?this.warnings.push(new tn.YAMLWarning(o,s,r)):this.errors.push(new tn.YAMLParseError(o,s,r))},this.directives=new Fp.Directives({version:t.version||"1.2"}),this.options=t}decorate(t,n){let{comment:s,afterEmptyLine:r}=al(this.prelude);if(s){let i=t.contents;if(n)t.comment=t.comment?`${t.comment}
|
|
103
|
+
${s}`:s;else if(r||t.directives.docStart||!i)t.commentBefore=s;else if(ol.isCollection(i)&&!i.flow&&i.items.length>0){let o=i.items[0];ol.isPair(o)&&(o=o.key);let a=o.commentBefore;o.commentBefore=a?`${s}
|
|
104
104
|
${a}`:s}else{let o=i.commentBefore;i.commentBefore=o?`${s}
|
|
105
|
-
${o}`:s}}if(n){for(let i=0;i<this.errors.length;++i)t.errors.push(this.errors[i]);for(let i=0;i<this.warnings.length;++i)t.warnings.push(this.warnings[i])}else t.errors=this.errors,t.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:
|
|
106
|
-
${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new tn.YAMLParseError(nn(t),"UNEXPECTED_TOKEN",`Unsupported token ${t.type}`))}}*end(t=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(t){let s=Object.assign({_directives:this.directives},this.options),r=new
|
|
105
|
+
${o}`:s}}if(n){for(let i=0;i<this.errors.length;++i)t.errors.push(this.errors[i]);for(let i=0;i<this.warnings.length;++i)t.warnings.push(this.warnings[i])}else t.errors=this.errors,t.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:al(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(t,n=!1,s=-1){for(let r of t)yield*this.next(r);yield*this.end(n,s)}*next(t){switch(Rp.env.LOG_STREAM&&console.dir(t,{depth:null}),t.type){case"directive":this.directives.add(t.source,(n,s,r)=>{let i=nn(t);i[0]+=n,this.onError(i,"BAD_DIRECTIVE",s,r)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{let n=Dp.composeDoc(this.options,this.directives,t,this.onError);this.atDirectives&&!n.directives.docStart&&this.onError(t,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(n,!1),this.doc&&(yield this.doc),this.doc=n,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(t.source);break;case"error":{let n=t.source?`${t.message}: ${JSON.stringify(t.source)}`:t.message,s=new tn.YAMLParseError(nn(t),"UNEXPECTED_TOKEN",n);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 tn.YAMLParseError(nn(t),"UNEXPECTED_TOKEN",s));break}this.doc.directives.docEnd=!0;let n=_p.resolveEnd(t.end,t.offset+t.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){let s=this.doc.comment;this.doc.comment=s?`${s}
|
|
106
|
+
${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new tn.YAMLParseError(nn(t),"UNEXPECTED_TOKEN",`Unsupported token ${t.type}`))}}*end(t=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(t){let s=Object.assign({_directives:this.directives},this.options),r=new jp.Document(void 0,s);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),r.range=[0,n,n],this.decorate(r,!1),yield r}}};ll.Composer=si});var ul=R(ps=>{"use strict";var Bp=Qr(),Kp=ei(),Up=Zt(),cl=Dt();function Wp(e,t=!0,n){if(e){let s=(r,i,o)=>{let a=typeof r=="number"?r:Array.isArray(r)?r[0]:r.offset;if(n)n(a,i,o);else throw new Up.YAMLParseError([a,a+1],i,o)};switch(e.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Kp.resolveFlowScalar(e,t,s);case"block-scalar":return Bp.resolveBlockScalar({options:{strict:t}},e,s)}}return null}function Yp(e,t){let{implicitKey:n=!1,indent:s,inFlow:r=!1,offset:i=-1,type:o="PLAIN"}=t,a=cl.stringifyString({type:o,value:e},{implicitKey:n,indent:s>0?" ".repeat(s):"",inFlow:r,options:{blockQuote:!0,lineWidth:-1}}),c=t.end??[{type:"newline",offset:-1,indent:s,source:`
|
|
107
107
|
`}];switch(a[0]){case"|":case">":{let f=a.indexOf(`
|
|
108
108
|
`),g=a.substring(0,f),u=a.substring(f+1)+`
|
|
109
|
-
`,l=[{type:"block-scalar-header",offset:i,indent:s,source:g}];return
|
|
110
|
-
`}),{type:"block-scalar",offset:i,indent:s,props:l,source:u}}case'"':return{type:"double-quoted-scalar",offset:i,indent:s,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:i,indent:s,source:a,end:c};default:return{type:"scalar",offset:i,indent:s,source:a,end:c}}}function
|
|
109
|
+
`,l=[{type:"block-scalar-header",offset:i,indent:s,source:g}];return fl(l,c)||l.push({type:"newline",offset:-1,indent:s,source:`
|
|
110
|
+
`}),{type:"block-scalar",offset:i,indent:s,props:l,source:u}}case'"':return{type:"double-quoted-scalar",offset:i,indent:s,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:i,indent:s,source:a,end:c};default:return{type:"scalar",offset:i,indent:s,source:a,end:c}}}function zp(e,t,n={}){let{afterKey:s=!1,implicitKey:r=!1,inFlow:i=!1,type:o}=n,a="indent"in e?e.indent:null;if(s&&typeof a=="number"&&(a+=2),!o)switch(e.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let f=e.props[0];if(f.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=f.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}let c=cl.stringifyString({type:o,value:t},{implicitKey:r||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":Vp(e,c);break;case'"':ii(e,c,"double-quoted-scalar");break;case"'":ii(e,c,"single-quoted-scalar");break;default:ii(e,c,"scalar")}}function Vp(e,t){let n=t.indexOf(`
|
|
111
111
|
`),s=t.substring(0,n),r=t.substring(n+1)+`
|
|
112
|
-
`;if(e.type==="block-scalar"){let i=e.props[0];if(i.type!=="block-scalar-header")throw new Error("Invalid block scalar header");i.source=s,e.source=r}else{let{offset:i}=e,o="indent"in e?e.indent:-1,a=[{type:"block-scalar-header",offset:i,indent:o,source:s}];
|
|
113
|
-
`});for(let c of Object.keys(e))c!=="type"&&c!=="offset"&&delete e[c];Object.assign(e,{type:"block-scalar",indent:o,props:a,source:r})}}function
|
|
114
|
-
`};delete e.items,Object.assign(e,{type:n,source:t,end:[r]});break}default:{let s="indent"in e?e.indent:-1,r="end"in e&&Array.isArray(e.end)?e.end.filter(i=>i.type==="space"||i.type==="comment"||i.type==="newline"):[];for(let i of Object.keys(e))i!=="type"&&i!=="offset"&&delete e[i];Object.assign(e,{type:n,indent:s,source:t,end:r})}}}
|
|
112
|
+
`;if(e.type==="block-scalar"){let i=e.props[0];if(i.type!=="block-scalar-header")throw new Error("Invalid block scalar header");i.source=s,e.source=r}else{let{offset:i}=e,o="indent"in e?e.indent:-1,a=[{type:"block-scalar-header",offset:i,indent:o,source:s}];fl(a,"end"in e?e.end:void 0)||a.push({type:"newline",offset:-1,indent:o,source:`
|
|
113
|
+
`});for(let c of Object.keys(e))c!=="type"&&c!=="offset"&&delete e[c];Object.assign(e,{type:"block-scalar",indent:o,props:a,source:r})}}function fl(e,t){if(t)for(let n of t)switch(n.type){case"space":case"comment":e.push(n);break;case"newline":return e.push(n),!0}return!1}function ii(e,t,n){switch(e.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":e.type=n,e.source=t;break;case"block-scalar":{let s=e.props.slice(1),r=t.length;e.props[0].type==="block-scalar-header"&&(r-=e.props[0].source.length);for(let i of s)i.offset+=r;delete e.props,Object.assign(e,{type:n,source:t,end:s});break}case"block-map":case"block-seq":{let r={type:"newline",offset:e.offset+t.length,indent:e.indent,source:`
|
|
114
|
+
`};delete e.items,Object.assign(e,{type:n,source:t,end:[r]});break}default:{let s="indent"in e?e.indent:-1,r="end"in e&&Array.isArray(e.end)?e.end.filter(i=>i.type==="space"||i.type==="comment"||i.type==="newline"):[];for(let i of Object.keys(e))i!=="type"&&i!=="offset"&&delete e[i];Object.assign(e,{type:n,indent:s,source:t,end:r})}}}ps.createScalarToken=Yp;ps.resolveAsScalar=Wp;ps.setScalarValue=zp});var pl=R(dl=>{"use strict";var Jp=e=>"type"in e?ms(e):hs(e);function ms(e){switch(e.type){case"block-scalar":{let t="";for(let n of e.props)t+=ms(n);return t+e.source}case"block-map":case"block-seq":{let t="";for(let n of e.items)t+=hs(n);return t}case"flow-collection":{let t=e.start.source;for(let n of e.items)t+=hs(n);for(let n of e.end)t+=n.source;return t}case"document":{let t=hs(e);if(e.end)for(let n of e.end)t+=n.source;return t}default:{let t=e.source;if("end"in e&&e.end)for(let n of e.end)t+=n.source;return t}}}function hs({start:e,key:t,sep:n,value:s}){let r="";for(let i of e)r+=i.source;if(t&&(r+=ms(t)),n)for(let i of n)r+=i.source;return s&&(r+=ms(s)),r}dl.stringify=Jp});var yl=R(gl=>{"use strict";var oi=Symbol("break visit"),Gp=Symbol("skip children"),hl=Symbol("remove item");function rt(e,t){"type"in e&&e.type==="document"&&(e={start:e.start,value:e.value}),ml(Object.freeze([]),e,t)}rt.BREAK=oi;rt.SKIP=Gp;rt.REMOVE=hl;rt.itemAtPath=(e,t)=>{let n=e;for(let[s,r]of t){let i=n?.[s];if(i&&"items"in i)n=i.items[r];else return}return n};rt.parentCollection=(e,t)=>{let n=rt.itemAtPath(e,t.slice(0,-1)),s=t[t.length-1][0],r=n?.[s];if(r&&"items"in r)return r;throw new Error("Parent collection not found")};function ml(e,t,n){let s=n(t,e);if(typeof s=="symbol")return s;for(let r of["key","value"]){let i=t[r];if(i&&"items"in i){for(let o=0;o<i.items.length;++o){let a=ml(Object.freeze(e.concat([[r,o]])),i.items[o],n);if(typeof a=="number")o=a-1;else{if(a===oi)return oi;a===hl&&(i.items.splice(o,1),o-=1)}}typeof s=="function"&&r==="key"&&(s=s(t,e))}}return typeof s=="function"?s(t,e):s}gl.visit=rt});var gs=R(Se=>{"use strict";var ai=ul(),Hp=pl(),Xp=yl(),li="\uFEFF",ci="",fi="",ui="",Qp=e=>!!e&&"items"in e,Zp=e=>!!e&&(e.type==="scalar"||e.type==="single-quoted-scalar"||e.type==="double-quoted-scalar"||e.type==="block-scalar");function eh(e){switch(e){case li:return"<BOM>";case ci:return"<DOC>";case fi:return"<FLOW_END>";case ui:return"<SCALAR>";default:return JSON.stringify(e)}}function th(e){switch(e){case li:return"byte-order-mark";case ci:return"doc-mode";case fi:return"flow-error-end";case ui:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
|
115
115
|
`:case`\r
|
|
116
|
-
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(e[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}Se.createScalarToken=
|
|
117
|
-
`:case"\r":case" ":return!0;default:return!1}}var
|
|
118
|
-
\r `),
|
|
116
|
+
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(e[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}Se.createScalarToken=ai.createScalarToken;Se.resolveAsScalar=ai.resolveAsScalar;Se.setScalarValue=ai.setScalarValue;Se.stringify=Hp.stringify;Se.visit=Xp.visit;Se.BOM=li;Se.DOCUMENT=ci;Se.FLOW_END=fi;Se.SCALAR=ui;Se.isCollection=Qp;Se.isScalar=Zp;Se.prettyToken=eh;Se.tokenType=th});var hi=R(wl=>{"use strict";var sn=gs();function qe(e){switch(e){case void 0:case" ":case`
|
|
117
|
+
`:case"\r":case" ":return!0;default:return!1}}var bl=new Set("0123456789ABCDEFabcdef"),nh=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),ys=new Set(",[]{}"),sh=new Set(` ,[]{}
|
|
118
|
+
\r `),di=e=>!e||sh.has(e),pi=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(t,n=!1){if(t){if(typeof t!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+t:t,this.lineEndPos=null}this.atEnd=!n;let s=this.next??"stream";for(;s&&(n||this.hasChars(1));)s=yield*this.parseNext(s)}atLineEnd(){let t=this.pos,n=this.buffer[t];for(;n===" "||n===" ";)n=this.buffer[++t];return!n||n==="#"||n===`
|
|
119
119
|
`?!0:n==="\r"?this.buffer[t+1]===`
|
|
120
120
|
`:!1}charAt(t){return this.buffer[this.pos+t]}continueScalar(t){let n=this.buffer[t];if(this.indentNext>0){let s=0;for(;n===" ";)n=this.buffer[++s+t];if(n==="\r"){let r=this.buffer[s+t+1];if(r===`
|
|
121
121
|
`||!r&&!this.atEnd)return t+s+1}return n===`
|
|
122
|
-
`||s>=this.indentNext||!n&&!this.atEnd?t+s:-1}if(n==="-"||n==="."){let s=this.buffer.substr(t,3);if((s==="---"||s==="...")&&
|
|
123
|
-
`,this.pos),this.lineEndPos=t),t===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[t-1]==="\r"&&(t-=1),this.buffer.substring(this.pos,t))}hasChars(t){return this.pos+t<=this.buffer.length}setNext(t){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=t,null}peek(t){return this.buffer.substr(this.pos,t)}*parseNext(t){switch(t){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 t=this.getLine();if(t===null)return this.setNext("stream");if(t[0]===sn.BOM&&(yield*this.pushCount(1),t=t.substring(1)),t[0]==="%"){let n=t.length,s=t.indexOf("#");for(;s!==-1;){let i=t[s-1];if(i===" "||i===" "){n=s-1;break}else s=t.indexOf("#",s+1)}for(;;){let i=t[n-1];if(i===" "||i===" ")n-=1;else break}let r=(yield*this.pushCount(n))+(yield*this.pushSpaces(!0));return yield*this.pushCount(t.length-r),this.pushNewline(),"stream"}if(this.atLineEnd()){let n=yield*this.pushSpaces(!0);return yield*this.pushCount(t.length-n),yield*this.pushNewline(),"stream"}return yield sn.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let t=this.charAt(0);if(!t&&!this.atEnd)return this.setNext("line-start");if(t==="-"||t==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let n=this.peek(3);if((n==="---"||n==="...")&&
|
|
122
|
+
`||s>=this.indentNext||!n&&!this.atEnd?t+s:-1}if(n==="-"||n==="."){let s=this.buffer.substr(t,3);if((s==="---"||s==="...")&&qe(this.buffer[t+3]))return-1}return t}getLine(){let t=this.lineEndPos;return(typeof t!="number"||t!==-1&&t<this.pos)&&(t=this.buffer.indexOf(`
|
|
123
|
+
`,this.pos),this.lineEndPos=t),t===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[t-1]==="\r"&&(t-=1),this.buffer.substring(this.pos,t))}hasChars(t){return this.pos+t<=this.buffer.length}setNext(t){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=t,null}peek(t){return this.buffer.substr(this.pos,t)}*parseNext(t){switch(t){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 t=this.getLine();if(t===null)return this.setNext("stream");if(t[0]===sn.BOM&&(yield*this.pushCount(1),t=t.substring(1)),t[0]==="%"){let n=t.length,s=t.indexOf("#");for(;s!==-1;){let i=t[s-1];if(i===" "||i===" "){n=s-1;break}else s=t.indexOf("#",s+1)}for(;;){let i=t[n-1];if(i===" "||i===" ")n-=1;else break}let r=(yield*this.pushCount(n))+(yield*this.pushSpaces(!0));return yield*this.pushCount(t.length-r),this.pushNewline(),"stream"}if(this.atLineEnd()){let n=yield*this.pushSpaces(!0);return yield*this.pushCount(t.length-n),yield*this.pushNewline(),"stream"}return yield sn.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let t=this.charAt(0);if(!t&&!this.atEnd)return this.setNext("line-start");if(t==="-"||t==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let n=this.peek(3);if((n==="---"||n==="...")&&qe(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,n==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!qe(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[t,n]=this.peek(2);if(!n&&!this.atEnd)return this.setNext("block-start");if((t==="-"||t==="?"||t===":")&&qe(n)){let s=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=s,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let t=this.getLine();if(t===null)return this.setNext("doc");let n=yield*this.pushIndicators();switch(t[n]){case"#":yield*this.pushCount(t.length-n);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(di),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return n+=yield*this.parseBlockScalarHeader(),n+=yield*this.pushSpaces(!0),yield*this.pushCount(t.length-n),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let t,n,s=-1;do t=yield*this.pushNewline(),t>0?(n=yield*this.pushSpaces(!1),this.indentValue=s=n):n=0,n+=yield*this.pushSpaces(!0);while(t+n>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("..."))&&qe(r[3]))&&!(s===this.indentNext-1&&this.flowLevel===1&&(r[0]==="]"||r[0]==="}")))return this.flowLevel=0,yield sn.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(di),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||qe(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 t=this.charAt(0),n=this.buffer.indexOf(t,this.pos+1);if(t==="'")for(;n!==-1&&this.buffer[n+1]==="'";)n=this.buffer.indexOf("'",n+2);else for(;n!==-1;){let i=0;for(;this.buffer[n-1-i]==="\\";)i+=1;if(i%2===0)break;n=this.buffer.indexOf('"',n+1)}let s=this.buffer.substring(0,n),r=s.indexOf(`
|
|
124
124
|
`,this.pos);if(r!==-1){for(;r!==-1;){let i=this.continueScalar(r+1);if(i===-1)break;r=s.indexOf(`
|
|
125
|
-
`,i)}r!==-1&&(n=r-(s[r-1]==="\r"?2:1))}if(n===-1){if(!this.atEnd)return this.setNext("quoted-scalar");n=this.buffer.length}return yield*this.pushToIndex(n+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let t=this.pos;for(;;){let n=this.buffer[++t];if(n==="+")this.blockScalarKeep=!0;else if(n>"0"&&n<="9")this.blockScalarIndent=Number(n)-1;else if(n!=="-")break}return yield*this.pushUntil(n=>
|
|
125
|
+
`,i)}r!==-1&&(n=r-(s[r-1]==="\r"?2:1))}if(n===-1){if(!this.atEnd)return this.setNext("quoted-scalar");n=this.buffer.length}return yield*this.pushToIndex(n+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let t=this.pos;for(;;){let n=this.buffer[++t];if(n==="+")this.blockScalarKeep=!0;else if(n>"0"&&n<="9")this.blockScalarIndent=Number(n)-1;else if(n!=="-")break}return yield*this.pushUntil(n=>qe(n)||n==="#")}*parseBlockScalar(){let t=this.pos-1,n=0,s;e:for(let i=this.pos;s=this.buffer[i];++i)switch(s){case" ":n+=1;break;case`
|
|
126
126
|
`:t=i,n=0;break;case"\r":{let o=this.buffer[i+1];if(!o&&!this.atEnd)return this.setNext("block-scalar");if(o===`
|
|
127
127
|
`)break}default:break e}if(!s&&!this.atEnd)return this.setNext("block-scalar");if(n>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=n:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let i=this.continueScalar(t+1);if(i===-1)break;t=this.buffer.indexOf(`
|
|
128
128
|
`,i)}while(t!==-1);if(t===-1){if(!this.atEnd)return this.setNext("block-scalar");t=this.buffer.length}}let r=t+1;for(s=this.buffer[r];s===" ";)s=this.buffer[++r];if(s===" "){for(;s===" "||s===" "||s==="\r"||s===`
|
|
129
129
|
`;)s=this.buffer[++r];t=r-1}else if(!this.blockScalarKeep)do{let i=t-1,o=this.buffer[i];o==="\r"&&(o=this.buffer[--i]);let a=i;for(;o===" ";)o=this.buffer[--i];if(o===`
|
|
130
|
-
`&&i>=this.pos&&i+1+n>a)t=i;else break}while(!0);return yield sn.SCALAR,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let t=this.flowLevel>0,n=this.pos-1,s=this.pos-1,r;for(;r=this.buffer[++s];)if(r===":"){let i=this.buffer[s+1];if(
|
|
130
|
+
`&&i>=this.pos&&i+1+n>a)t=i;else break}while(!0);return yield sn.SCALAR,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let t=this.flowLevel>0,n=this.pos-1,s=this.pos-1,r;for(;r=this.buffer[++s];)if(r===":"){let i=this.buffer[s+1];if(qe(i)||t&&ys.has(i))break;n=s}else if(qe(r)){let i=this.buffer[s+1];if(r==="\r"&&(i===`
|
|
131
131
|
`?(s+=1,r=`
|
|
132
|
-
`,i=this.buffer[s+1]):n=s),i==="#"||t&&
|
|
133
|
-
`){let o=this.continueScalar(s+1);if(o===-1)break;s=Math.max(s,o-2)}}else{if(t&&
|
|
132
|
+
`,i=this.buffer[s+1]):n=s),i==="#"||t&&ys.has(i))break;if(r===`
|
|
133
|
+
`){let o=this.continueScalar(s+1);if(o===-1)break;s=Math.max(s,o-2)}}else{if(t&&ys.has(r))break;n=s}return!r&&!this.atEnd?this.setNext("plain-scalar"):(yield sn.SCALAR,yield*this.pushToIndex(n+1,!0),t?"flow":"doc")}*pushCount(t){return t>0?(yield this.buffer.substr(this.pos,t),this.pos+=t,t):0}*pushToIndex(t,n){let s=this.buffer.slice(this.pos,t);return s?(yield s,this.pos+=s.length,s.length):(n&&(yield""),0)}*pushIndicators(){let t=0;e:for(;;){switch(this.charAt(0)){case"!":t+=yield*this.pushTag(),t+=yield*this.pushSpaces(!0);continue e;case"&":t+=yield*this.pushUntil(di),t+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let n=this.flowLevel>0,s=this.charAt(1);if(qe(s)||n&&ys.has(s)){n?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,t+=yield*this.pushCount(1),t+=yield*this.pushSpaces(!0);continue e}}}break e}return t}*pushTag(){if(this.charAt(1)==="<"){let t=this.pos+2,n=this.buffer[t];for(;!qe(n)&&n!==">";)n=this.buffer[++t];return yield*this.pushToIndex(n===">"?t+1:t,!1)}else{let t=this.pos+1,n=this.buffer[t];for(;n;)if(nh.has(n))n=this.buffer[++t];else if(n==="%"&&bl.has(this.buffer[t+1])&&bl.has(this.buffer[t+2]))n=this.buffer[t+=3];else break;return yield*this.pushToIndex(t,!1)}}*pushNewline(){let t=this.buffer[this.pos];return t===`
|
|
134
134
|
`?yield*this.pushCount(1):t==="\r"&&this.charAt(1)===`
|
|
135
|
-
`?yield*this.pushCount(2):0}*pushSpaces(t){let n=this.pos-1,s;do s=this.buffer[++n];while(s===" "||t&&s===" ");let r=n-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=n),r}*pushUntil(t){let n=this.pos,s=this.buffer[n];for(;!t(s);)s=this.buffer[++n];return yield*this.pushToIndex(n,!1)}};
|
|
135
|
+
`?yield*this.pushCount(2):0}*pushSpaces(t){let n=this.pos-1,s;do s=this.buffer[++n];while(s===" "||t&&s===" ");let r=n-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=n),r}*pushUntil(t){let n=this.pos,s=this.buffer[n];for(;!t(s);)s=this.buffer[++n];return yield*this.pushToIndex(n,!1)}};wl.Lexer=pi});var gi=R(kl=>{"use strict";var mi=class{constructor(){this.lineStarts=[],this.addNewLine=t=>this.lineStarts.push(t),this.linePos=t=>{let n=0,s=this.lineStarts.length;for(;n<s;){let i=n+s>>1;this.lineStarts[i]<t?n=i+1:s=i}if(this.lineStarts[n]===t)return{line:n+1,col:1};if(n===0)return{line:0,col:t};let r=this.lineStarts[n-1];return{line:n,col:t-r+1}}}};kl.LineCounter=mi});var bi=R(Al=>{"use strict";var rh=$n("process"),$l=gs(),ih=hi();function He(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function vl(e){for(let t=0;t<e.length;++t)switch(e[t].type){case"space":case"comment":case"newline":break;default:return t}return-1}function Ol(e){switch(e?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function bs(e){switch(e.type){case"document":return e.start;case"block-map":{let t=e.items[e.items.length-1];return t.sep??t.start}case"block-seq":return e.items[e.items.length-1].start;default:return[]}}function wt(e){if(e.length===0)return[];let t=e.length;e:for(;--t>=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;e[++t]?.type==="space";);return e.splice(t,e.length)}function ws(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let n=0;n<t.length;++n)e.push(t[n])}function Sl(e){if(e.start.type==="flow-seq-start")for(let t of e.items)t.sep&&!t.value&&!He(t.start,"explicit-key-ind")&&!He(t.sep,"map-value-ind")&&(t.key&&(t.value=t.key),delete t.key,Ol(t.value)?t.value.end?ws(t.value.end,t.sep):t.value.end=t.sep:ws(t.start,t.sep),delete t.sep)}var yi=class{constructor(t){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new ih.Lexer,this.onNewLine=t}*parse(t,n=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let s of this.lexer.lex(t,n))yield*this.next(s);n||(yield*this.end())}*next(t){if(this.source=t,rh.env.LOG_TOKENS&&console.log("|",$l.prettyToken(t)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=t.length;return}let n=$l.tokenType(t);if(n)if(n==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=n,yield*this.step(),n){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+t.length);break;case"space":this.atNewLine&&t[0]===" "&&(this.indent+=t.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=t.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=t.length}else{let s=`Not a YAML token: ${t}`;yield*this.pop({type:"error",offset:this.offset,message:s,source:t}),this.offset+=t.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 t=this.peek(1);if(this.type==="doc-end"&&t?.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(!t)return yield*this.stream();switch(t.type){case"document":return yield*this.document(t);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(t);case"block-scalar":return yield*this.blockScalar(t);case"block-map":return yield*this.blockMap(t);case"block-seq":return yield*this.blockSequence(t);case"flow-collection":return yield*this.flowCollection(t);case"doc-end":return yield*this.documentEnd(t)}yield*this.pop()}peek(t){return this.stack[this.stack.length-t]}*pop(t){let n=t??this.stack.pop();if(!n)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield n;else{let s=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in s?s.indent:0:n.type==="flow-collection"&&s.type==="document"&&(n.indent=0),n.type==="flow-collection"&&Sl(n),s.type){case"document":s.value=n;break;case"block-scalar":s.props.push(n);break;case"block-map":{let r=s.items[s.items.length-1];if(r.value){s.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(r.sep)r.value=n;else{Object.assign(r,{key:n,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:n}):r.value=n;break}case"flow-collection":{let r=s.items[s.items.length-1];!r||r.value?s.items.push({start:[],key:n,sep:[]}):r.sep?r.value=n:Object.assign(r,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((s.type==="document"||s.type==="block-map"||s.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){let r=n.items[n.items.length-1];r&&!r.sep&&!r.value&&r.start.length>0&&vl(r.start)===-1&&(n.indent===0||r.start.every(i=>i.type!=="comment"||i.indent<n.indent))&&(s.type==="document"?s.end=r.start:s.items.push({start:r.start}),n.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let t={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&t.start.push(this.sourceToken),this.stack.push(t);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(t){if(t.value)return yield*this.lineEnd(t);switch(this.type){case"doc-start":{vl(t.start)!==-1?(yield*this.pop(),yield*this.step()):t.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":t.start.push(this.sourceToken);return}let n=this.startBlockValue(t);n?this.stack.push(n):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(t){if(this.type==="map-value-ind"){let n=bs(this.peek(2)),s=wt(n),r;t.end?(r=t.end,r.push(this.sourceToken),delete t.end):r=[this.sourceToken];let i={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:s,key:t,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(t)}*blockScalar(t){switch(this.type){case"space":case"comment":case"newline":t.props.push(this.sourceToken);return;case"scalar":if(t.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let n=this.source.indexOf(`
|
|
136
136
|
`)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
|
|
137
|
-
`,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(t){let n=t.items[t.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){let s="end"in n.value?n.value.end:void 0;(Array.isArray(s)?s[s.length-1]:void 0)?.type==="comment"?s?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,t.indent)){let r=t.items[t.items.length-2]?.value?.end;if(Array.isArray(r)){
|
|
137
|
+
`,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(t){let n=t.items[t.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){let s="end"in n.value?n.value.end:void 0;(Array.isArray(s)?s[s.length-1]:void 0)?.type==="comment"?s?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,t.indent)){let r=t.items[t.items.length-2]?.value?.end;if(Array.isArray(r)){ws(r,n.start),r.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=t.indent){let s=!this.onKeyLine&&this.indent===t.indent,r=s&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind",i=[];if(r&&n.sep&&!n.value){let o=[];for(let a=0;a<n.sep.length;++a){let c=n.sep[a];switch(c.type){case"newline":o.push(a);break;case"space":break;case"comment":c.indent>t.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(i=n.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":r||n.value?(i.push(this.sourceToken),t.items.push({start:i}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):r||n.value?(i.push(this.sourceToken),t.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(n.explicitKey)if(n.sep)if(n.value)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if(He(n.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(Ol(n.key)&&!He(n.sep,"newline")){let o=wt(n.start),a=n.key,c=n.sep;c.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:a,sep:c}]})}else i.length>0?n.sep=n.sep.concat(i,this.sourceToken):n.sep.push(this.sourceToken);else if(He(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{let o=wt(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||r?t.items.push({start:i,key:null,sep:[this.sourceToken]}):He(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{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||n.value?(t.items.push({start:i,key:o,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(o):(Object.assign(n,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(t);if(o){if(o.type==="block-seq"){if(!n.explicitKey&&n.sep&&!He(n.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else s&&t.items.push({start:i});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){let n=t.items[t.items.length-1];switch(this.type){case"newline":if(n.value){let s="end"in n.value?n.value.end:void 0;(Array.isArray(s)?s[s.length-1]:void 0)?.type==="comment"?s?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,t.indent)){let r=t.items[t.items.length-2]?.value?.end;if(Array.isArray(r)){ws(r,n.start),r.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=t.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==t.indent)break;n.value||He(n.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>t.indent){let s=this.startBlockValue(t);if(s){this.stack.push(s);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){let n=t.items[t.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(t.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!n||n.sep?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?t.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?t.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let r=this.flowScalar(this.type);!n||n.value?t.items.push({start:[],key:r,sep:[]}):n.sep?this.stack.push(r):Object.assign(n,{key:r,sep:[]});return}case"flow-map-end":case"flow-seq-end":t.end.push(this.sourceToken);return}let s=this.startBlockValue(t);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===t.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=bs(s),i=wt(r);Sl(t);let o=t.end.splice(1,t.end.length);o.push(this.sourceToken);let a={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:i,key:t,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(t)}}flowScalar(t){if(this.onNewLine){let n=this.source.indexOf(`
|
|
138
138
|
`)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
|
|
139
|
-
`,n)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let n=
|
|
140
|
-
`).length}var he=e=>e.normalize("NFD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[\s._-]+/g,""),
|
|
141
|
-
`),s=n.findIndex(r=>new RegExp(`^\\s*${t}:`).test(r));return s<0?1:/:\s*[|>][-+]?\s*$/.test(n[s])?s+2:s+1}var Eh=new Set(["LogCustomTelemetryEvent","CSATQuestion","SearchAndSummarizeContent","SearchKnowledgeSources"]),xh={topics:"topic",actions:"action",knowledge:"knowledge",variables:"variable"},Th=/^workflows\/([^/]+)\/(.+)$/;function Ch(e,t,n){let s={id:e,facts:{},children:[],unknown:[],names:{},texts:[],contract:[],flows:[],telemetry:[]},r=[],i=new Map,o=[],a=d=>kt(d,"/").replace(/(\.topic)?\.mcs\.ya?ml$|\.ya?ml$/,""),c=[],f=[],g=[],u=[],l=new Map;for(let d of[...t].sort((m,y)=>m.path.localeCompare(y.path))){let m=Th.exec(d.path);if(m&&(/\.json$/.test(d.path)||/^metadata\.ya?ml$/.test(m[2]))){let $=l.get(m[1])??{json:{}};if(l.set(m[1],$),/\.json$/.test(d.path)){try{$.json[m[2]]={file:d.path,text:d.text,data:JSON.parse(d.text)}}catch{s.unknown.push({file:d.path,why:"json"})}continue}let L=ql(d.text);L==="yaml"||L==="empty"?s.unknown.push({file:d.path,why:L}):[$.meta,$.metaFile]=[ae(L.data),d.path];continue}if(!/\.ya?ml$/.test(d.path)){s.unknown.push({file:d.path,why:"file"});continue}let y=ql(d.text);if(y==="yaml"||y==="empty"){s.unknown.push({file:d.path,why:y});continue}let k=ae(y.data),v=/^agents\/([^/]+)\//.exec(d.path)?.[1],S=s.facts;if(v){let $=s.children.find(L=>L.name===v);$||s.children.push($={name:v,facts:{}}),S=$.facts}let T=($,L,K=S)=>(K[$]??=[]).push({file:d.path,line:y.lineOf(L??k)});if(v&&T(`child:${v}`,k,s.facts),!v&&/^settings\.mcs\.ya?ml$/.test(d.path)&&k){s.schemaName=X(k.schemaName)??s.schemaName,s.displayName=X(k.displayName)??s.displayName,X(k.authenticationMode)&&T(`auth:${k.authenticationMode}`);let $=ae(k.configuration),L=ae($?.settings)?.GenerativeActionsEnabled;typeof L=="boolean"&&T(`setting:generative=${L?"on":"off"}`,$),$?.isAgentConnectable===!0&&T("setting:connectable",$);continue}let N=n?[...$t(k)].map($=>$.kind).find($=>!n.has($)):void 0;if(N&&s.unknown.push({file:d.path,why:"kind",kind:N}),typeof k?.kind!="string"){N||s.unknown.push({file:d.path,why:"kind"});continue}if(k.state==="Inactive"||k.status==="Inactive"){T(`disabled:${xh[d.path.split("/")[v?2:0]]??"component"}:${a(d.path)}`);continue}let q=d.text,M=($,L,K)=>{v||!X(K)||Oh.test(kt(d.path,"/"))||s.texts.push({source:$,file:d.path,line:Nh(q,L),text:K.trimEnd().slice(0,Ah)})},C=($,L)=>{X($)&&(T("instructions:present",L),/\b(Today|Now)\(\)/.test($)&&T("ms:date-context",L))};switch(k.kind){case"GptComponentMetadata":{s.displayName??=X(k.displayName),C(k.instructions,k),M("instructions","instructions",k.instructions),M("instructions","responseInstructions",k.responseInstructions);let $=ae(k.aISettings),L=fe=>fe===!0?"on":"off";typeof $?.useModelKnowledge=="boolean"&&T(`setting:model-knowledge=${L($.useModelKnowledge)}`,$),X($?.contentModeration)&&T(`setting:moderation=${$.contentModeration.toLowerCase()}`,$),typeof $?.isSemanticSearchEnabled=="boolean"&&T(`setting:semantic-search=${L($.isSemanticSearchEnabled)}`,$);let K=ae(k.gptCapabilities);typeof K?.webBrowsing=="boolean"&&T(`setting:web-browsing=${L(K.webBrowsing)}`,K);let V=ae(ae(k.aISettings)?.model);X(V?.modelNameHint)&&T(`model:${V.modelNameHint}`,V);break}case"AgentDialog":{let $=ae(k.beginDialog);X($?.kind)&&T(`trigger:${$.kind}`,$),C(ae(k.settings)?.instructions,k.settings);break}case"AdaptiveDialog":{let $=ae(k.beginDialog),L=X($?.kind);L&&T(`trigger:${L}`,$),L&&i.set(`${v??""}/${a(d.path)}`,L),X(k.modelDescription)&&T("topics:with-model-description");let K=an(ae($?.intent)?.triggerQueries).length;!v&&L==="OnRecognizedIntent"&&!X(k.modelDescription)&&!K&&f.push({kind:"topic",name:a(d.path),at:{file:d.path,line:y.lineOf(k)}}),M("descriptions","modelDescription",k.modelDescription);let V=an(k.inputs).some(fe=>ae(fe)?.kind==="AutomaticTaskInput"&&ae(fe)?.shouldPromptUser===!1);L==="OnRecognizedIntent"&&V&&T("ms:orchestrator-variables",$),L==="OnError"&&q.includes("System.Error.SubCode")&&T("ms:rai-error-handling",$),L==="OnKnowledgeRequested"&&[...$t($)].some(fe=>fe.kind==="SendActivity")&&T("ms:knowledge-hold-message",$),L==="OnGeneratedResponse"&&q.includes("System.ContinueResponse")&&T("ms:prevent-tool-call-leaks",$);break}case"TaskDialog":{let $=ae(k.action);M("descriptions","modelDescription",k.modelDescription),!v&&!X(k.modelDescription)&&f.push({kind:"action",name:a(d.path),at:{file:d.path,line:y.lineOf(k)}});let L=X($?.connectionReference);if($?.kind==="InvokeConnectorTaskAction"&&L&&(T(`connector:${ln(L)}`,$),X($.operationId)&&T(`operation:${ln(L)}/${$.operationId}`,$)),$?.kind==="InvokeExternalAgentTaskAction"&&ae($.operationDetails)?.kind==="ModelContextProtocolMetadata"&&L&&T(`mcp:${ln(L)}`,$),$?.kind==="InvokeConnectedAgentTaskAction"&&X($.botSchemaName)&&(T(`calls:${$.botSchemaName}`,$),v||s.contract.push({calls:$.botSchemaName,...X(k.modelDisplayName)?{name:k.modelDisplayName}:{},history:ae($.historyType)?.kind==="ConversationHistory",inputs:an(k.inputs).map(K=>X(ae(K)?.propertyName)).filter(K=>!!K),description:X(k.modelDescription)?.trim()??"",file:d.path,line:y.lineOf($)})),$?.kind==="InvokeFlowTaskAction"&&X($.flowId)){T(`flow:${$.flowId}`,$);let K=X(k.modelDisplayName)??X(ae(k["mcs.metadata"])?.componentName);K&&(s.names[$.flowId]??=K)}break}case"KnowledgeSourceConfiguration":{let $=ae(k.source);X($?.kind)&&T(`knowledge:${$.kind}`,$),$&&"triggerCondition"in $&&T("yaml-only:triggerCondition",$),r.push({file:d.path,line:y.lineOf(k)});break}case"GlobalVariableComponent":{let $=ae(k.variable)??k,L=X($.name)??(X(k.schemaName)?kt(k.schemaName,"."):void 0);if(!L)break;T(`var:${L}`),$.isExternalInitializationAllowed===!0&&T(`var-in:${L}`),v||g.push({name:L,at:{file:d.path,line:y.lineOf(k)}});break}case"ConnectionReferencesSourceFile":for(let $ of an(k.connectionReferences).map(ae)){let L=X($?.connectorId)?kt($.connectorId,"/"):X($?.connectionReferenceLogicalName)?ln($.connectionReferenceLogicalName):void 0;L&&T(`connref:${L}`,$),L&&X($?.displayName)&&(s.names[L]=$.displayName)}break}for(let $ of $t(k,!0))T(`disabled:node:${$.kind}`,$);for(let $ of $t(k)){if(Eh.has($.kind)&&T(`node:${$.kind}`,$),$.kind==="LogCustomTelemetryEvent"&&!v&&(X($.eventName)&&!$.eventName.trim().startsWith("=")?u.push({name:$.eventName.trim(),properties:$.properties,at:{file:d.path,line:y.lineOf($)}}):s.unknown.push({file:d.path,why:"telemetry"})),$.kind==="InvokeConnectorAction"&&X($.connectionReference)){let K=ln($.connectionReference);T(`connector:${K}`,$),X($.operationId)&&T(`operation:${K}/${$.operationId}`,$)}if($.kind==="InvokeFlowAction"&&X($.flowId)&&T(`flow:${$.flowId}`,$),($.kind==="BeginDialog"||$.kind==="ReplaceDialog")&&X($.dialog)){let K=$.dialog;c.push(K),K.startsWith("=")?K.includes("Switch(")&&T("ms:dynamic-topic-redirect",$):o.push({topic:`${v??""}/${kt(K,".topic.")}`,into:S,at:{file:d.path,line:y.lineOf($)}})}let L=K=>typeof K=="string"&&K.includes("System.Activity.ChannelId");($.kind==="ConditionGroup"&&an($.conditions).some(K=>L(ae(K)?.condition))||$.kind==="SetVariable"&&L($.value))&&T("ms:channel-aware-behavior",$),($.kind==="SendActivity"||$.kind==="Question")&&JSON.stringify($).includes("<br")&&T("ms:line-breaks-in-messages",$)}}r.length&&(s.facts[`knowledge:count=${r.length}`]=r);for(let d of u){let m=_i(d.name,s),y=Bi(d.properties);(s.facts[`telemetry:event:${m}`]??=[]).push(d.at);for(let k of y??[])(s.facts[`telemetry:field:${m}/${k}`]??=[]).push(d.at);s.telemetry.push({name:d.name,form:m,...y?{fields:y}:{},...d.at})}let p=new Set([s.facts,...s.children.map(d=>d.facts)].flatMap(d=>Object.keys(d)).filter(d=>d.startsWith("flow:")).map(d=>d.slice(5)));for(let[d,{meta:m,metaFile:y,json:k}]of[...l].sort(([v],[S])=>v.localeCompare(S))){let v=X(m?.jsonFileName)??Object.keys(k)[0],S=v?k[v]:void 0,T=X(m?.workflowId),N=d.replace(/-[0-9a-f]{6,}$/i,"");if(!S){y&&s.unknown.push({file:y,why:"flow"});continue}let q=Di(S.data);if(!q||!T){s.unknown.push({file:S.file,why:"flow"});continue}let M=X(m?.displayName)??X(ae(ae(S.data)?.properties)?.displayName)??N,C=p.has(T);if(s.flows.push({id:T,name:M,folder:d,uses:q.uses.map($=>$.key),returns:!!q.returns,called:C,file:S.file}),s.names[T]??=M,!C){(s.facts[`orphan:flow:${N}`]??=[]).push({file:y??S.file,line:1}),s.names[N]??=M;continue}for(let $ of q.uses)(s.facts[`flow-uses:${$.key}`]??=[]).push({file:S.file,line:js(S.text,$.action)});q.returns&&(s.facts["flow-returns"]??=[]).push({file:S.file,line:js(S.text,q.returns)})}for(let d of f)c.some(m=>m===d.name||m.endsWith(`.${d.name}`))||(s.facts[`orphan:${d.kind}:${d.name}`]??=[]).push(d.at);for(let d of g)t.some(y=>y.path!==d.at.file&&new RegExp(`\\bGlobal\\.${d.name}\\b`).test(y.text))||(delete s.facts[`var:${d.name}`],delete s.facts[`var-in:${d.name}`],(s.facts[`orphan:variable:${d.name}`]??=[]).push(d.at));for(let d of o){let m=i.get(d.topic);(d.into[m?`reaches:${m}`:`calls:topic:${kt(d.topic,"/")}`]??=[]).push(d.at)}for(let d of[s.facts,...s.children.map(m=>m.facts)])for(let[m,y]of Object.entries(d))d[m]=y.filter((k,v)=>y.findIndex(S=>S.file===k.file&&S.line===k.line)===v);return s}function qh(e){let t=new Set,n=r=>{if(!r||typeof r!="object")return;let{const:i,enum:o}=r;if(typeof i=="string"&&t.add(i),Array.isArray(o))for(let a of o)typeof a=="string"&&t.add(a)},s=r=>{if(Array.isArray(r))return r.forEach(s);if(!r||typeof r!="object")return;let i=r;n(i.kind),n(i.properties?.kind);for(let o of Object.values(i))s(o)};for(let r of Object.values(e.definitions??{}))s(r);return t}var vt=Rs(ws(),1);function ks(e,t){let n=new vt.LineCounter,s=(0,vt.parseDocument)(e,{lineCounter:n,prettyErrors:!1}),r=o=>{for(let a=o;a.length;a=a.slice(0,-1)){let c=s.getIn(a,!0);if(c?.range)return n.linePos(c.range[0]).line}return 1};if(s.errors.length)return{ok:!1,problem:{line:n.linePos(s.errors[0].pos[0]).line,key:"syntax",detail:s.errors[0].code}};let i=s.toJS();return!i||typeof i!="object"||Array.isArray(i)||i.format!==t||!(0,vt.isMap)(s.contents)?{ok:!1,problem:{line:r(["format"]),key:"format"}}:{ok:!0,format:{raw:i,doc:s,at:r,lineOf:o=>n.linePos(o).line}}}var $s=[{id:"orchestrator-variables",name:"Orchestrator-Generated Variables",sign:"an OnRecognizedIntent topic with an AutomaticTaskInput that has shouldPromptUser: false"},{id:"rai-error-handling",name:"RAI Error Handling",sign:"the OnError topic reads System.Error.SubCode"},{id:"knowledge-hold-message",name:"Knowledge Hold Message",sign:"an OnKnowledgeRequested topic that sends a message"},{id:"prevent-tool-call-leaks",name:"Prevent Tool Call Leaks",sign:"an OnGeneratedResponse topic that sets System.ContinueResponse"},{id:"dynamic-topic-redirect",name:"Dynamic Topic Redirect",sign:"a BeginDialog whose dialog is a =Switch( expression"},{id:"channel-aware-behavior",name:"Channel-Aware Behavior",sign:"a condition or SetVariable that reads System.Activity.ChannelId (not a tool input)"},{id:"date-context",name:"Date Context",sign:"the instructions use Today() or Now()"},{id:"line-breaks-in-messages",name:"Line Breaks in Messages",sign:"<br /> inside a SendActivity or Question"},{id:"conversation-history-variable",name:"Conversation History Variable"},{id:"chain-of-thought-logging",name:"Chain of Thought Logging"},{id:"deterministic-mcp-calls",name:"Deterministic MCP Calls"},{id:"prevent-child-agent-responses",name:"Prevent Child Agent Responses"},{id:"jit-glossary",name:"JIT Glossary"},{id:"jit-user-context",name:"JIT User Context"},{id:"teams-production-hardening",name:"Teams Production Hardening"}];var wi={conversation:{en:"A. Conversation",pt:"A. Conversa"},integrations:{en:"B. Integrations",pt:"B. Integra\xE7\xF5es"},knowledge:{en:"C. Knowledge",pt:"C. Conhecimento"},orchestration:{en:"D. Orchestrator",pt:"D. Orquestrador"},governance:{en:"E. Governance",pt:"E. Governan\xE7a"},text:{en:"F. Text",pt:"F. Texto"},microsoft:{en:"Microsoft patterns",pt:"Padr\xF5es Microsoft"},declared:{en:"Declared",pt:"Declarado"}},vs={"trigger:OnConversationStart":{dim:"conversation",en:"Greeting",pt:"Boas-vindas"},"trigger:OnUnknownIntent":{dim:"conversation",en:"Fallback (when it does not understand)",pt:"Fallback (quando n\xE3o entende)"},"trigger:OnEscalate":{dim:"conversation",en:"Escalation to a person",pt:"Escalonamento para humano",lacks:{en:["does not escalate to a person","do not escalate to a person"],pt:["n\xE3o escala para humano","n\xE3o escalam para humano"]}},"trigger:OnError":{dim:"conversation",en:"Error handling",pt:"Tratamento de erro",lacks:{en:["does not handle errors","do not handle errors"],pt:["n\xE3o trata erro","n\xE3o tratam erro"]}},"trigger:OnRecognizedIntent":{dim:"conversation",en:"A topic of its own, by intent",pt:"T\xF3pico pr\xF3prio, por inten\xE7\xE3o"},"trigger:OnRedirect":{dim:"orchestration",en:"Takes a call from the orchestrator",pt:"Recebe chamada do orquestrador",lacks:{en:["takes no call from the orchestrator","take no call from the orchestrator"],pt:["n\xE3o recebe chamada do orquestrador","n\xE3o recebem chamada do orquestrador"]}},"trigger:OnSelectIntent":{dim:"conversation",en:"Disambiguation (\xABdid you mean\u2026\xBB)",pt:"Desambigua\xE7\xE3o (\xABvoc\xEA quis dizer\u2026\xBB)"},"trigger:OnSignIn":{dim:"conversation",en:"Sign-in",pt:"Login"},"trigger:OnGeneratedResponse":{dim:"conversation",en:"Reviews the generated answer",pt:"Revisa a resposta gerada"},"trigger:OnKnowledgeRequested":{dim:"knowledge",en:"Before searching knowledge",pt:"Antes de buscar no conhecimento"},"trigger:OnToolSelected":{dim:"orchestration",en:"Child chosen as a tool",pt:"Filho escolhido como ferramenta"},"trigger:OnActivity":{dim:"conversation",en:"On every message",pt:"Em toda mensagem"},"setting:generative=on":{dim:"conversation",en:"Generative orchestration on",pt:"Orquestra\xE7\xE3o generativa ligada"},"setting:generative=off":{dim:"conversation",en:"Generative orchestration off",pt:"Orquestra\xE7\xE3o generativa desligada"},"setting:model-knowledge=on":{dim:"governance",en:"The model's general knowledge on",pt:"Conhecimento geral do modelo ligado"},"setting:model-knowledge=off":{dim:"governance",en:"The model's general knowledge off",pt:"Conhecimento geral do modelo desligado"},"setting:semantic-search=on":{dim:"knowledge",en:"Semantic search on",pt:"Busca sem\xE2ntica ligada"},"setting:semantic-search=off":{dim:"knowledge",en:"Semantic search off",pt:"Busca sem\xE2ntica desligada"},"setting:web-browsing=on":{dim:"knowledge",en:"Web browsing on",pt:"Navega\xE7\xE3o na web ligada"},"setting:web-browsing=off":{dim:"knowledge",en:"Web browsing off",pt:"Navega\xE7\xE3o na web desligada"},"setting:connectable":{dim:"orchestration",en:"Can be called by an orchestrator",pt:"Pode ser chamado por um orquestrador"},"called-with:history":{dim:"orchestration",en:"Receives the conversation history",pt:"Recebe o hist\xF3rico da conversa",lacks:{en:["does not receive the conversation history from the orchestrator","do not receive the conversation history from the orchestrator"],pt:["n\xE3o recebe o hist\xF3rico da conversa do orquestrador","n\xE3o recebem o hist\xF3rico da conversa do orquestrador"]}},"routing:described":{dim:"orchestration",en:"Has a routing description",pt:"Tem descri\xE7\xE3o de roteamento",lacks:{en:["has no routing description","have no routing description"],pt:["n\xE3o tem descri\xE7\xE3o de roteamento","n\xE3o t\xEAm descri\xE7\xE3o de roteamento"]}},"flow-returns":{dim:"integrations",en:"The flow returns an answer",pt:"O fluxo devolve uma resposta",lacks:{en:["has a flow that returns nothing","have a flow that returns nothing"],pt:["tem fluxo que n\xE3o devolve nada","t\xEAm fluxo que n\xE3o devolve nada"]}},"flow-uses:child-flow":{dim:"integrations",en:"The flow calls another flow",pt:"O fluxo chama outro fluxo"},"topics:with-model-description":{dim:"conversation",en:"Topics described for the model",pt:"T\xF3picos descritos para o modelo"},"instructions:present":{dim:"governance",en:"Has instructions",pt:"Tem instru\xE7\xF5es",lacks:{en:["has no instructions","have no instructions"],pt:["n\xE3o tem instru\xE7\xF5es","n\xE3o t\xEAm instru\xE7\xF5es"]}},"node:LogCustomTelemetryEvent":{dim:"governance",en:"Logs telemetry",pt:"Registra telemetria",lacks:{en:["logs no telemetry","log no telemetry"],pt:["n\xE3o registra telemetria","n\xE3o registram telemetria"]}},"node:CSATQuestion":{dim:"governance",en:"Asks for satisfaction (CSAT)",pt:"Pergunta a satisfa\xE7\xE3o (CSAT)",lacks:{en:["does not ask for satisfaction","do not ask for satisfaction"],pt:["n\xE3o pergunta a satisfa\xE7\xE3o","n\xE3o perguntam a satisfa\xE7\xE3o"]}},"node:SearchAndSummarizeContent":{dim:"knowledge",en:"Generative answers from knowledge",pt:"Respostas generativas sobre o conhecimento"},"node:SearchKnowledgeSources":{dim:"knowledge",en:"Searches the knowledge sources",pt:"Busca nas fontes de conhecimento"},"yaml-only:triggerCondition":{dim:"knowledge",en:"Search condition only in YAML (the editor may erase it)",pt:"Condi\xE7\xE3o de busca s\xF3 no YAML (a tela pode apagar)"},"knowledge:SharePointSearchSource":{dim:"knowledge",en:"Knowledge in SharePoint",pt:"Conhecimento no SharePoint"},"declared:kpi":{dim:"declared",en:"KPI declared",pt:"KPI declarado",lacks:{en:["has no KPI declared","have no KPI declared"],pt:["n\xE3o tem KPI declarado","n\xE3o t\xEAm KPI declarado"]}},"eval:run":{dim:"governance",en:"Passed through an evaluation",pt:"Passou por uma avalia\xE7\xE3o",lacks:{en:["has no evaluation","have no evaluation"],pt:["n\xE3o tem avalia\xE7\xE3o","n\xE3o t\xEAm avalia\xE7\xE3o"]}},"declared:team":{dim:"declared",en:"Team declared",pt:"Equipe declarada",lacks:{en:["has no team declared","have no team declared"],pt:["n\xE3o tem equipe declarada","n\xE3o t\xEAm equipe declarada"]}},"declared:owner":{dim:"declared",en:"Owner declared",pt:"Respons\xE1vel declarado",lacks:{en:["has no owner declared","have no owner declared"],pt:["n\xE3o tem respons\xE1vel declarado","n\xE3o t\xEAm respons\xE1vel declarado"]}}},Ph=Object.fromEntries($s.map(e=>[e.id,e.name])),Lh=[["called-with:input:","orchestration","Receives <value> from the orchestrator","Recebe <valor> do orquestrador"],["flow-uses:http:","integrations","Flow calls","Fluxo chama"],["flow-uses:connector:","integrations","Flow uses the connector","Fluxo usa o conector"],["flow-uses:operation:","integrations","Flow uses the operation","Fluxo usa a opera\xE7\xE3o"],["orphan:topic:","governance","Topic nobody calls","T\xF3pico que ningu\xE9m chama"],["orphan:action:","governance","Tool nobody can choose","Ferramenta que ningu\xE9m escolhe"],["orphan:variable:","governance","Variable nobody uses","Vari\xE1vel que ningu\xE9m usa"],["orphan:flow:","governance","Flow nobody calls","Fluxo que ningu\xE9m chama"],["disabled:node:","governance","Switched-off node","N\xF3 desligado"],["telemetry:event:","governance","Logs the event","Registra o evento"],["telemetry:field:","governance","The event carries the field (<event>/<field>)","O evento leva o campo (<evento>/<campo>)"],["disabled:","governance","Switched off","Desligado"],["reaches:","conversation","A topic leads to it (part of trigger:<value>)","Um t\xF3pico leva a ele (parte de trigger:<valor>)"],["calls:topic:","conversation","Calls the topic (one not found)","Chama o t\xF3pico (n\xE3o encontrado)"],["trigger:","conversation","Trigger","Gatilho"],["setting:","conversation","Setting","Configura\xE7\xE3o"],["connector:","integrations","Connector","Conector"],["operation:","integrations","Operation","Opera\xE7\xE3o"],["connref:","integrations","Connection reference","Refer\xEAncia de conex\xE3o"],["mcp:","integrations","MCP server","Servidor MCP"],["flow:","integrations","Flow","Fluxo"],["knowledge:","knowledge","Knowledge","Conhecimento"],["node:","governance","Node","N\xF3"],["calls:","orchestration","Calls","Chama"],["child:","orchestration","Child","Filho"],["var-in:","orchestration","Receives from the orchestrator","Recebe do orquestrador"],["var:","orchestration","Global variable","Vari\xE1vel global"],["model:","governance","Model","Modelo"],["auth:","governance","Sign-in","Login"],["ms:","microsoft","Microsoft pattern:","Padr\xE3o Microsoft:"],["text:","text","Text:","Texto:"],["declared:","declared","Declared:","Declarado:"]],Ll=e=>Lh.find(([t])=>e.startsWith(t)),Ml=e=>!!vs[e]?.lacks;function cn(e){return e.startsWith("reaches:")?cn(`trigger:${e.slice(8)}`):vs[e]?.dim??Ll(e)?.[1]??"governance"}var Qe=(e,t)=>t.endsWith("*")?e.startsWith(t.slice(0,-1)):e===t,Il=80;function St(e){if(e.startsWith("reaches:"))return`trigger:${e.slice(8)}`;if(e.startsWith("telemetry:event:"))return"node:LogCustomTelemetryEvent";if(e.startsWith("telemetry:field:"))return`telemetry:event:${e.slice(16,e.lastIndexOf("/"))}`}var $e=(e,t)=>e.split("{agent}").join(t==="pt"?"\u2039nome\u203A":"\u2039name\u203A"),Rl=e=>({form:e.slice(16,e.lastIndexOf("/")),field:e.slice(e.lastIndexOf("/")+1)}),Pl=(e,t)=>t?.[e]??e;function re(e,t,n){let s=vs[e];if(s)return s[t];if(e.startsWith("text:block:")){let a=e.endsWith("~variant"),c=a?e.slice(0,-8):e,f=n?.[c]??c.slice(11);return a?`${f} (${t==="pt"?"varia\xE7\xE3o":"variation"})`:f}if(e.startsWith("text:link-domain:"))return`${t==="pt"?"Link para":"Link to"} ${e.slice(17)}`;if(e==="text:email")return t==="pt"?"Cita um e-mail":"Mentions an e-mail";if(e.startsWith("text:")){let[a,c]=[e.slice(5).split("=")[0],e.includes("=")?e.slice(e.indexOf("=")+1):void 0],f=n?.[`text:${a}`]??a;return c===void 0?f:`${f} = ${c}`}if(e.startsWith("reaches:")){let a=re(`trigger:${e.slice(8)}`,t);return t==="pt"?`Um t\xF3pico leva a \xAB${a}\xBB`:`A topic leads to \xAB${a}\xBB`}if(e.startsWith("called-with:input:"))return t==="pt"?`Recebe \xAB${e.slice(18)}\xBB do orquestrador`:`Receives \xAB${e.slice(18)}\xBB from the orchestrator`;if(e.startsWith("telemetry:event:"))return t==="pt"?`Registra o evento \xAB${$e(e.slice(16),t)}\xBB`:`Logs the event \xAB${$e(e.slice(16),t)}\xBB`;if(e.startsWith("telemetry:field:")){let{form:a,field:c}=Rl(e),f=$e(a,t);return t==="pt"?`\xAB${f}\xBB leva \xAB${c}\xBB`:`\xAB${f}\xBB carries \xAB${c}\xBB`}let r=/^knowledge:count=(\d+)$/.exec(e);if(r){let a=Number(r[1]);return t==="pt"?`${a} ${a===1?"fonte":"fontes"} de conhecimento`:`${a} knowledge ${a===1?"source":"sources"}`}let i=Ll(e);if(!i)return e;let o=e.slice(i[0].length);if(i[0]==="ms:"&&(o=Ph[o]??o),i[0]==="auth:"&&o==="None")return t==="pt"?"Sem login":"No sign-in";if(e.startsWith("setting:moderation="))return t==="pt"?`Modera\xE7\xE3o de conte\xFAdo: ${e.slice(19)}`:`Content moderation: ${e.slice(19)}`;if(["connector:","connref:","mcp:","calls:","flow:","flow-uses:connector:","orphan:flow:"].includes(i[0])&&(o=Pl(o,n)),i[0]==="disabled:"&&(o=o.replace(":"," ")),i[0]==="operation:"||i[0]==="flow-uses:operation:"){let[a,c]=[o.slice(0,o.indexOf("/")),o.slice(o.indexOf("/")+1)];o=`${Pl(a,n)} \xB7 ${c}`}return`${i[t==="pt"?3:2]} ${o}`}function Ss(e,t,n,s){let r=vs[e]?.lacks?.[t];if(r)return r[n===1?0:1];if(e.startsWith("reaches:")){let o=re(`trigger:${e.slice(8)}`,t);return t==="pt"?`${n===1?"tem":"t\xEAm"} \xAB${o}\xBB, mas nenhum t\xF3pico leva a ele`:`${n===1?"has":"have"} \xAB${o}\xBB, but no topic leads to it`}if(e.startsWith("called-with:input:"))return t==="pt"?`${n===1?"n\xE3o recebe":"n\xE3o recebem"} \xAB${e.slice(18)}\xBB do orquestrador`:`${n===1?"does":"do"} not receive \xAB${e.slice(18)}\xBB from the orchestrator`;if(e.startsWith("telemetry:event:")){let o=$e(e.slice(16),t);return t==="pt"?`${n===1?"n\xE3o registra":"n\xE3o registram"} o evento \xAB${o}\xBB`:`${n===1?"does":"do"} not log the event \xAB${o}\xBB`}if(e.startsWith("telemetry:field:")){let{form:o,field:a}=Rl(e),c=$e(o,t);return t==="pt"?`${n===1?"registra":"registram"} \xAB${c}\xBB sem \xAB${a}\xBB`:`${n===1?"logs":"log"} \xAB${c}\xBB without \xAB${a}\xBB`}if(e.startsWith("calls:topic:"))return t==="pt"?`${n===1?"n\xE3o chama":"n\xE3o chamam"} o t\xF3pico ${e.slice(12)}`:`${n===1?"does":"do"} not call the topic ${e.slice(12)}`;let i=re(e,t,s);return t==="pt"?`${n===1?"n\xE3o tem":"n\xE3o t\xEAm"} \xAB${i}\xBB`:`${n===1?"does":"do"} not have \xAB${i}\xBB`}var Fl="cast-list/profile-v1",$i=["orchestrator","specialist"],ki={roles:{},threshold:.7,minAgents:3,rules:[],markers:[],blocks:[],types:[],focusAreas:[],ignore:[],microsoftPatterns:!0},Mh=["format","name","roles","threshold","min_agents","rules","markers","blocks","types","focus_areas","ignore","microsoft_patterns"],Ih=["instructions","descriptions","all"],Rh=new Set(["trigger","setting","topics","instructions","connector","operation","connref","mcp","flow","knowledge","node","calls","reaches","child","var","var-in","model","auth","ms","declared","text","yaml-only","called-with","routing","flow-uses","flow-returns","orphan","disabled","telemetry","eval"]),Fh=e=>Rh.has(e.split(":")[0]),it=e=>!!e&&typeof e=="object"&&!Array.isArray(e),le=e=>typeof e=="string"?e.trim():typeof e=="number"?String(e):"",Os=e=>Array.isArray(e)?e.map(le).filter(Boolean):le(e)?[le(e)]:[],jl=e=>$i.includes(e);function jh(e){let t=ks(e,Fl);if(!t.ok)return{problems:[t.problem.key==="format"?{...t.problem,format:Fl}:t.problem]};let{raw:n,at:s}=t.format,r=[];for(let N of Object.keys(n))Mh.includes(N)||r.push({line:s([N]),key:"unknownKey",what:N});let i=(N,q,M)=>(le(N)||r.push({line:s(M),key:"missing",what:q}),le(N)),o=(N,q)=>{let M=new Set;q.forEach((C,$)=>{C&&M.has(C)&&r.push({line:s([N,$]),key:"duplicate",what:N,id:C}),M.add(C)})},a=N=>Array.isArray(n[N])?n[N]:[],c=n.threshold===void 0?ki.threshold:Number(n.threshold);c>0&&c<=1||r.push({line:s(["threshold"]),key:"threshold",value:le(n.threshold)});let f=n.min_agents===void 0?ki.minAgents:Number(n.min_agents);Number.isInteger(f)&&f>=1||r.push({line:s(["min_agents"]),key:"minAgents",value:le(n.min_agents)});let g={},u=it(n.roles)?n.roles:{};for(let N of Object.keys(u))jl(N)?g[N]=le(u[N])==="*"?"*":Os(u[N]):r.push({line:s(["roles",N]),key:"role",what:`roles.${N}`,value:N});let l=(N,q,M)=>(jl(le(N))||r.push({line:s(M),key:"role",what:q,value:le(N)}),le(N)),p=(N,q,M)=>{let C=Os(N);for(let $ of C)Fh($)||r.push({line:s(M),key:"prefix",what:q,value:$});return C},d=a("rules").filter(it).map((N,q)=>{let M=`rules[${q}]`,C=p(N.has,M,["rules",q])[0],$=p(N.not,M,["rules",q])[0],L=p(N.when,M,["rules",q]);return!C&&!$&&r.push({line:s(["rules",q]),key:"rule",what:M}),{id:i(N.id,`${M}.id`,["rules",q]),...N.role!==void 0?{role:l(N.role,`${M}.role`,["rules",q,"role"])}:{},...L.length?{when:L}:{},...C?{has:C}:{},...$?{not:$}:{},says:le(N.says)||C||`not ${$}`}});o("rules",d.map(N=>N.id));let m=a("markers").filter(it).map((N,q)=>{let M=`markers[${q}]`,C=i(N.pattern,`${M}.pattern`,["markers",q]);try{C&&new RegExp(C,"i")}catch(K){r.push({line:s(["markers",q]),key:"regex",what:`${M}.pattern`,detail:K.message.replace(/^Invalid regular expression: /,"")})}let $=le(N.in)||"instructions";Ih.includes($)||r.push({line:s(["markers",q]),key:"in",what:`${M}.in`,value:$});let L=i(N.id,`${M}.id`,["markers",q]);return{id:L,name:le(N.name)||L,in:$,pattern:C,...le(N.value)?{value:le(N.value)}:{}}});o("markers",m.map(N=>N.id));let y=a("blocks").filter(it).map((N,q)=>{let M=i(N.id,`blocks[${q}].id`,["blocks",q]);return{id:M,name:le(N.name)||M,text:i(N.text,`blocks[${q}].text`,["blocks",q]),role:N.role!==void 0?l(N.role,`blocks[${q}].role`,["blocks",q,"role"]):"specialist"}});o("blocks",y.map(N=>N.id));let k=a("types").filter(it).map((N,q)=>{let M=`types[${q}]`,C=it(N.when)?N.when:{},$=Object.fromEntries(["all","any","none"].filter(V=>C[V]!==void 0).map(V=>[V,p(C[V],M,["types",q])]));!$.all?.length&&!$.any?.length&&r.push({line:s(["types",q]),key:"when",what:M});let L=N.min_agents===void 0?2:Number(N.min_agents);Number.isInteger(L)&&L>=1||r.push({line:s(["types",q,"min_agents"]),key:"minAgents",value:le(N.min_agents)});let K=i(N.id,`${M}.id`,["types",q]);return{id:K,name:le(N.name)||K,when:$,minAgents:L}});o("types",k.map(N=>N.id));let v=a("focus_areas").filter(it).map((N,q)=>{let M=Os(N.facts);M.length||r.push({line:s(["focus_areas",q]),key:"missing",what:`focus_areas[${q}].facts`});let C=i(N.id,`focus_areas[${q}].id`,["focus_areas",q]);return{id:C,name:le(N.name)||C,facts:M}});o("focus_areas",v.map(N=>N.id));let S=n.microsoft_patterns,T={...le(n.name)?{name:le(n.name)}:{},roles:g,threshold:c,minAgents:f,rules:d,markers:m,blocks:y,types:k,focusAreas:v,ignore:Os(n.ignore),microsoftPatterns:!(S===!1||le(S).toLowerCase()==="off")};return r.length?{problems:r}:{profile:T,problems:r}}var Dh=e=>Object.keys(e.facts).some(t=>t.startsWith("calls:")&&!t.startsWith("calls:topic:"));function Dl(e,t,n={}){let{orchestrator:s,specialist:r}=t.roles,i=(f,g)=>Array.isArray(f)&&f.includes(g),o=Object.fromEntries(e.map(f=>[f.id,i(s,f.id)?"orchestrator":i(r,f.id)?"specialist":n[f.id]??(s==="*"?"orchestrator":r==="*"?"specialist":Dh(f)?"orchestrator":"specialist")])),a=new Set(e.map(f=>f.id)),c=[s,r].flatMap(f=>Array.isArray(f)?f:[]).filter(f=>!a.has(f));return{roles:o,unmatched:c}}function _l(e,t,n,s){let r=(i,o)=>Object.keys(i).some(a=>Qe(a,o));return Object.fromEntries(e.map(i=>{if(t[i.id]!=="specialist")return[i.id,[]];if(s[i.id]?.length)return[i.id,s[i.id]];let o=n.types.filter(({when:a})=>(a.all??[]).every(c=>r(i.facts,c))&&(!a.any?.length||a.any.some(c=>r(i.facts,c)))&&!(a.none??[]).some(c=>r(i.facts,c)));return[i.id,o.map(a=>a.id)]}))}var Re=Rs(ws());var fn="cast-list/cast-v1",_h=["accepted","rejected"],Bh=["platform","specialist","orchestrator"],Kh=e=>Bh.includes(e)||/^type:[\w-]+$/.test(e),Uh=["format","name","agents","blocks","declared","decisions"],Wh=e=>!!e&&typeof e=="object"&&!Array.isArray(e),ge=e=>typeof e=="string"?e.trim():typeof e=="number"||typeof e=="boolean"?String(e):"";function Yh(e){let t=ks(e,fn);if(!t.ok)return{problems:[t.problem.key==="format"?{...t.problem,format:fn}:t.problem]};let{raw:n,at:s}=t.format,r=[];for(let l of Object.keys(n))Uh.includes(l)||r.push({line:s([l]),key:"unknownKey",what:l});let i=l=>(Array.isArray(n[l])?n[l]:[]).filter(Wh),o=(l,p,d)=>(ge(l)||r.push({line:s(d),key:"missing",what:p}),ge(l)),a=(l,p)=>{let d=new Set;p.forEach((m,y)=>{m&&d.has(m)&&r.push({line:s([l,y]),key:"duplicate",what:l,id:m}),d.add(m)})},c=i("agents").map((l,p)=>{let d=ge(l.role);$i.includes(d)||r.push({line:s(["agents",p,"role"]),key:"role",what:`agents[${p}].role`,value:d});let m=Array.isArray(l.types)?l.types.map(ge).filter(Boolean):[];return{id:o(l.id,`agents[${p}].id`,["agents",p]),role:d,...m.length?{types:m}:{}}}),f=i("blocks").map((l,p)=>({id:o(l.id,`blocks[${p}].id`,["blocks",p]),text:o(l.text,`blocks[${p}].text`,["blocks",p])}));a("blocks",f.map(l=>l.id)),a("agents",c.map(l=>l.id));let g=i("declared").map((l,p)=>({agent:o(l.agent,`declared[${p}].agent`,["declared",p]),key:o(l.key,`declared[${p}].key`,["declared",p]),value:ge(l.value),source:ge(l.source)}));a("declared",g.map(l=>`${l.agent} ${l.key}`));let u=i("decisions").map((l,p)=>{let d=ge(l.status),m=ge(l.scope);return _h.includes(d)||r.push({line:s(["decisions",p,"status"]),key:"status",value:d}),Kh(m)||r.push({line:s(["decisions",p,"scope"]),key:"scope",value:m}),{key:o(l.key,`decisions[${p}].key`,["decisions",p]),status:d,scope:m,why:ge(l.why)}});return a("decisions",u.map(l=>l.key)),r.length?{problems:r}:{cast:{...ge(n.name)?{name:ge(n.name)}:{},agents:c,blocks:f,declared:g,decisions:u},problems:r}}var zh=` What people said about the agents, and what was decided. build.mjs keeps it up to date; edit it, or fill the
|
|
142
|
-
workbook's \xABDeclared\xBB sheet and the \xABDecision\xBB column and read it back with --from.`,
|
|
139
|
+
`,n)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let n=bs(t),s=wt(n);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 n=bs(t),s=wt(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,n){return this.type!=="comment"||this.indent<=n?!1:t.every(s=>s.type==="newline"||s.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};Al.Parser=yi});var Cl=R(on=>{"use strict";var Nl=ri(),oh=Ht(),rn=Zt(),ah=nr(),lh=Z(),ch=gi(),El=bi();function xl(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new ch.LineCounter||null,prettyErrors:t}}function fh(e,t={}){let{lineCounter:n,prettyErrors:s}=xl(t),r=new El.Parser(n?.addNewLine),i=new Nl.Composer(t),o=Array.from(i.compose(r.parse(e)));if(s&&n)for(let a of o)a.errors.forEach(rn.prettifyError(e,n)),a.warnings.forEach(rn.prettifyError(e,n));return o.length>0?o:Object.assign([],{empty:!0},i.streamInfo())}function Tl(e,t={}){let{lineCounter:n,prettyErrors:s}=xl(t),r=new El.Parser(n?.addNewLine),i=new Nl.Composer(t),o=null;for(let a of i.compose(r.parse(e),!0,e.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new rn.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return s&&n&&(o.errors.forEach(rn.prettifyError(e,n)),o.warnings.forEach(rn.prettifyError(e,n))),o}function uh(e,t,n){let s;typeof t=="function"?s=t:n===void 0&&t&&typeof t=="object"&&(n=t);let r=Tl(e,n);if(!r)return null;if(r.warnings.forEach(i=>ah.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},n))}function dh(e,t,n){let s=null;if(typeof t=="function"||Array.isArray(t)?s=t:n===void 0&&t&&(n=t),typeof n=="string"&&(n=n.length),typeof n=="number"){let r=Math.round(n);n=r<1?void 0:r>8?{indent:8}:{indent:r}}if(e===void 0){let{keepUndefined:r}=n??t??{};if(!r)return}return lh.isDocument(e)&&!s?e.toString(n):new oh.Document(e,s,n).toString(n)}on.parse=uh;on.parseAllDocuments=fh;on.parseDocument=Tl;on.stringify=dh});var $s=R(re=>{"use strict";var ph=ri(),hh=Ht(),mh=jr(),wi=Zt(),gh=Mt(),Xe=Z(),yh=ze(),bh=ue(),wh=Je(),kh=Ge(),$h=gs(),vh=hi(),Sh=gi(),Oh=bi(),ks=Cl(),Pl=Ct();re.Composer=ph.Composer;re.Document=hh.Document;re.Schema=mh.Schema;re.YAMLError=wi.YAMLError;re.YAMLParseError=wi.YAMLParseError;re.YAMLWarning=wi.YAMLWarning;re.Alias=gh.Alias;re.isAlias=Xe.isAlias;re.isCollection=Xe.isCollection;re.isDocument=Xe.isDocument;re.isMap=Xe.isMap;re.isNode=Xe.isNode;re.isPair=Xe.isPair;re.isScalar=Xe.isScalar;re.isSeq=Xe.isSeq;re.Pair=yh.Pair;re.Scalar=bh.Scalar;re.YAMLMap=wh.YAMLMap;re.YAMLSeq=kh.YAMLSeq;re.CST=$h;re.Lexer=vh.Lexer;re.LineCounter=Sh.LineCounter;re.Parser=Oh.Parser;re.parse=ks.parse;re.parseAllDocuments=ks.parseAllDocuments;re.parseDocument=ks.parseDocument;re.stringify=ks.stringify;re.visit=Pl.visit;re.visitAsync=Pl.visitAsync});import{readdirSync as Bc,readFileSync as Kc}from"node:fs";import{basename as Uc,join as js}from"node:path";var Wc=/^agent\.mcs\.ya?ml$/,Yc=/\.ya?ml$/,zc=/(^|\/)workflows\/.+\.json$/,Fi=e=>Bc(e,{withFileTypes:!0}).filter(t=>!t.name.startsWith(".")&&t.name!=="node_modules");function ji(e,t=""){return Fi(e).flatMap(n=>{let s=t?`${t}/${n.name}`:n.name;return n.isDirectory()?ji(js(e,n.name),s):n.isFile()?[{path:s,text:Yc.test(n.name)||zc.test(s)?Kc(js(e,n.name),"utf8"):""}]:[]})}function Di(e){let t=Fi(e);return t.some(n=>n.isFile()&&Wc.test(n.name))?[{id:Uc(e),dir:e,files:ji(e)}]:t.filter(n=>n.isDirectory()).flatMap(n=>Di(js(e,n.name)))}var ke=e=>e&&typeof e=="object"&&!Array.isArray(e)?e:void 0,vn=e=>typeof e=="string"&&e.trim()?e:void 0;function Vc(e){let t=ke(ke(ke(e)?.properties)?.definition)??ke(ke(e)?.definition);return t&&(ke(t.actions)||ke(t.triggers))?t:void 0}function*Tt(e){for(let[t,n]of Object.entries(ke(e)??{})){let s=ke(n);if(s){yield[t,s],yield*Tt(s.actions),yield*Tt(ke(s.else)?.actions);for(let r of Object.values(ke(s.cases)??{}))yield*Tt(ke(r)?.actions);yield*Tt(ke(s.default)?.actions)}}}var Jc=e=>/^https?:\/\/([^/?#:@]+)/i.exec(e)?.[1]?.toLowerCase(),Gc=e=>e.slice(e.lastIndexOf("/")+1);function _i(e){let t=Vc(e);if(!t)return;let n={uses:[]},s=(r,i)=>n.uses.some(o=>o.key===r)||n.uses.push({key:r,action:i});for(let[r,i]of Tt(t.actions)){let o=ke(i.inputs),a=ke(o?.host);switch(i.type){case"OpenApiConnection":case"OpenApiConnectionWebhook":{let c=vn(a?.apiId)?Gc(a.apiId):vn(a?.connectionName);if(!c)break;s(`connector:${c}`,r),vn(a?.operationId)&&s(`operation:${c}/${a.operationId}`,r);break}case"Http":{let c=vn(o?.uri)&&Jc(o.uri);c&&s(`http:${c}`,r);break}case"Workflow":s("child-flow",r);break;case"Response":n.returns??=r;break}}return n}function Ds(e,t){let n=e.indexOf(`${JSON.stringify(t)}:`);return n<0?1:e.slice(0,n).split(`
|
|
140
|
+
`).length}var he=e=>e.normalize("NFD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[\s._-]+/g,""),Hc="{agent}";function Bi(e,t){let n=[];for(let o=0;o<e.length;o++)for(let a of he(e[o]))n.push({c:a,at:o});let s=n.map(o=>o.c).join(""),r=t.schemaName?.slice(t.schemaName.indexOf("_")+1),i=[...new Set([t.id,r,t.displayName].filter(o=>!!o).map(he).filter(o=>o.length>=3))].sort((o,a)=>a.length-o.length);for(let o of i){let a=s.indexOf(o);if(a<0)continue;let c=n[a].at,f=n[a+o.length-1].at+1;return`${e.slice(0,c)}${Hc}${e.slice(f)}`}return e}function Ki(e){if(typeof e!="string")return;let t=e.trim().replace(/^=\s*/,"").trim();if(!t.startsWith("{")||!t.endsWith("}"))return;let n=t.slice(1,-1),s=[],r=0,i,o="";for(let c=0;c<n.length;c++){let f=n[c];if(i){o+=f,f===i&&(n[c+1]===i?o+=n[++c]:i=void 0);continue}f==='"'||f==="'"?i=f:f==="{"||f==="("||f==="["?r++:(f==="}"||f===")"||f==="]")&&r--,f===","&&r===0?(s.push(o),o=""):o+=f}if(i||r)return;o.trim()&&s.push(o);let a=[];for(let c of s){let f=/^\s*(?:'((?:[^']|'')+)'|"((?:[^"]|"")+)"|([A-Za-z_][\w]*))\s*:/.exec(c);if(!f)return;a.push((f[1]??f[2]??f[3]).replace(/''|""/g,g=>g[0]))}return a}var Le=Fs($s()),ae=e=>e&&typeof e=="object"&&!Array.isArray(e)?e:void 0,X=e=>typeof e=="string"&&e.trim()?e:void 0,an=e=>Array.isArray(e)?e:[];function ql(e){if(!e.trim())return"empty";let t=new Le.LineCounter,n=(0,Le.parseDocument)(e,{lineCounter:t,uniqueKeys:!1});if(n.errors.length)return"yaml";let s=new WeakMap,r=o=>{if((0,Le.isMap)(o)){let a={};o.range&&s.set(a,o.range[0]);for(let c of o.items)a[String((0,Le.isScalar)(c.key)?c.key.value:c.key)]=r(c.value);return a}return(0,Le.isSeq)(o)?o.items.map(r):(0,Le.isScalar)(o)?o.value:o},i=r(n.contents);return i==null?"empty":{data:i,lineOf:o=>o&&typeof o=="object"&&s.has(o)?t.linePos(s.get(o)).line:void 0}}function*$t(e,t=!1){if(Array.isArray(e))for(let s of e)yield*$t(s,t);let n=ae(e);if(n){if(n.disabled===!0){t&&typeof n.kind=="string"&&(yield n);return}typeof n.kind=="string"&&!t&&(yield n);for(let s of Object.values(n))yield*$t(s,t)}}var ln=e=>e.split(".")[1]??e,kt=(e,t)=>e.slice(e.lastIndexOf(t)+(e.includes(t)?t.length:0)),Ah=/(^|[\s._-])(copy|c[oó]pia|new|test|teste)([\s._-]|$)|\.[a-z]{2}-[A-Z]{2}(\.topic)?\.mcs\.ya?ml$/i,Nh=5e4;function Eh(e,t){let n=e.split(`
|
|
141
|
+
`),s=n.findIndex(r=>new RegExp(`^\\s*${t}:`).test(r));return s<0?1:/:\s*[|>][-+]?\s*$/.test(n[s])?s+2:s+1}var xh=new Set(["LogCustomTelemetryEvent","CSATQuestion","SearchAndSummarizeContent","SearchKnowledgeSources"]),Th={topics:"topic",actions:"action",knowledge:"knowledge",variables:"variable"},Ch=/^workflows\/([^/]+)\/(.+)$/;function Ph(e,t,n){let s={id:e,facts:{},children:[],unknown:[],names:{},texts:[],contract:[],flows:[],telemetry:[]},r=[],i=new Map,o=[],a=d=>kt(d,"/").replace(/(\.topic)?\.mcs\.ya?ml$|\.ya?ml$/,""),c=[],f=[],g=[],u=[],l=new Map;for(let d of[...t].sort((m,y)=>m.path.localeCompare(y.path))){let m=Ch.exec(d.path);if(m&&(/\.json$/.test(d.path)||/^metadata\.ya?ml$/.test(m[2]))){let $=l.get(m[1])??{json:{}};if(l.set(m[1],$),/\.json$/.test(d.path)){try{$.json[m[2]]={file:d.path,text:d.text,data:JSON.parse(d.text)}}catch{s.unknown.push({file:d.path,why:"json"})}continue}let L=ql(d.text);L==="yaml"||L==="empty"?s.unknown.push({file:d.path,why:L}):[$.meta,$.metaFile]=[ae(L.data),d.path];continue}if(!/\.ya?ml$/.test(d.path)){s.unknown.push({file:d.path,why:"file"});continue}let y=ql(d.text);if(y==="yaml"||y==="empty"){s.unknown.push({file:d.path,why:y});continue}let k=ae(y.data),v=/^agents\/([^/]+)\//.exec(d.path)?.[1],S=s.facts;if(v){let $=s.children.find(L=>L.name===v);$||s.children.push($={name:v,facts:{}}),S=$.facts}let T=($,L,K=S)=>(K[$]??=[]).push({file:d.path,line:y.lineOf(L??k)});if(v&&T(`child:${v}`,k,s.facts),!v&&/^settings\.mcs\.ya?ml$/.test(d.path)&&k){s.schemaName=X(k.schemaName)??s.schemaName,s.displayName=X(k.displayName)??s.displayName,X(k.authenticationMode)&&T(`auth:${k.authenticationMode}`);let $=ae(k.configuration),L=ae($?.settings)?.GenerativeActionsEnabled;typeof L=="boolean"&&T(`setting:generative=${L?"on":"off"}`,$),$?.isAgentConnectable===!0&&T("setting:connectable",$);continue}let N=n?[...$t(k)].map($=>$.kind).find($=>!n.has($)):void 0;if(N&&s.unknown.push({file:d.path,why:"kind",kind:N}),typeof k?.kind!="string"){N||s.unknown.push({file:d.path,why:"kind"});continue}if(k.state==="Inactive"||k.status==="Inactive"){T(`disabled:${Th[d.path.split("/")[v?2:0]]??"component"}:${a(d.path)}`);continue}let P=d.text,M=($,L,K)=>{v||!X(K)||Ah.test(kt(d.path,"/"))||s.texts.push({source:$,file:d.path,line:Eh(P,L),text:K.trimEnd().slice(0,Nh)})},C=($,L)=>{X($)&&(T("instructions:present",L),/\b(Today|Now)\(\)/.test($)&&T("ms:date-context",L))};switch(k.kind){case"GptComponentMetadata":{s.displayName??=X(k.displayName),C(k.instructions,k),M("instructions","instructions",k.instructions),M("instructions","responseInstructions",k.responseInstructions);let $=ae(k.aISettings),L=fe=>fe===!0?"on":"off";typeof $?.useModelKnowledge=="boolean"&&T(`setting:model-knowledge=${L($.useModelKnowledge)}`,$),X($?.contentModeration)&&T(`setting:moderation=${$.contentModeration.toLowerCase()}`,$),typeof $?.isSemanticSearchEnabled=="boolean"&&T(`setting:semantic-search=${L($.isSemanticSearchEnabled)}`,$);let K=ae(k.gptCapabilities);typeof K?.webBrowsing=="boolean"&&T(`setting:web-browsing=${L(K.webBrowsing)}`,K);let J=ae(ae(k.aISettings)?.model);X(J?.modelNameHint)&&T(`model:${J.modelNameHint}`,J);break}case"AgentDialog":{let $=ae(k.beginDialog);X($?.kind)&&T(`trigger:${$.kind}`,$),C(ae(k.settings)?.instructions,k.settings);break}case"AdaptiveDialog":{let $=ae(k.beginDialog),L=X($?.kind);L&&T(`trigger:${L}`,$),L&&i.set(`${v??""}/${a(d.path)}`,L),X(k.modelDescription)&&T("topics:with-model-description");let K=an(ae($?.intent)?.triggerQueries).length;!v&&L==="OnRecognizedIntent"&&!X(k.modelDescription)&&!K&&f.push({kind:"topic",name:a(d.path),at:{file:d.path,line:y.lineOf(k)}}),M("descriptions","modelDescription",k.modelDescription);let J=an(k.inputs).some(fe=>ae(fe)?.kind==="AutomaticTaskInput"&&ae(fe)?.shouldPromptUser===!1);L==="OnRecognizedIntent"&&J&&T("ms:orchestrator-variables",$),L==="OnError"&&P.includes("System.Error.SubCode")&&T("ms:rai-error-handling",$),L==="OnKnowledgeRequested"&&[...$t($)].some(fe=>fe.kind==="SendActivity")&&T("ms:knowledge-hold-message",$),L==="OnGeneratedResponse"&&P.includes("System.ContinueResponse")&&T("ms:prevent-tool-call-leaks",$);break}case"TaskDialog":{let $=ae(k.action);M("descriptions","modelDescription",k.modelDescription),!v&&!X(k.modelDescription)&&f.push({kind:"action",name:a(d.path),at:{file:d.path,line:y.lineOf(k)}});let L=X($?.connectionReference);if($?.kind==="InvokeConnectorTaskAction"&&L&&(T(`connector:${ln(L)}`,$),X($.operationId)&&T(`operation:${ln(L)}/${$.operationId}`,$)),$?.kind==="InvokeExternalAgentTaskAction"&&ae($.operationDetails)?.kind==="ModelContextProtocolMetadata"&&L&&T(`mcp:${ln(L)}`,$),$?.kind==="InvokeConnectedAgentTaskAction"&&X($.botSchemaName)&&(T(`calls:${$.botSchemaName}`,$),v||s.contract.push({calls:$.botSchemaName,...X(k.modelDisplayName)?{name:k.modelDisplayName}:{},history:ae($.historyType)?.kind==="ConversationHistory",inputs:an(k.inputs).map(K=>X(ae(K)?.propertyName)).filter(K=>!!K),description:X(k.modelDescription)?.trim()??"",file:d.path,line:y.lineOf($)})),$?.kind==="InvokeFlowTaskAction"&&X($.flowId)){T(`flow:${$.flowId}`,$);let K=X(k.modelDisplayName)??X(ae(k["mcs.metadata"])?.componentName);K&&(s.names[$.flowId]??=K)}break}case"KnowledgeSourceConfiguration":{let $=ae(k.source);X($?.kind)&&T(`knowledge:${$.kind}`,$),$&&"triggerCondition"in $&&T("yaml-only:triggerCondition",$),r.push({file:d.path,line:y.lineOf(k)});break}case"GlobalVariableComponent":{let $=ae(k.variable)??k,L=X($.name)??(X(k.schemaName)?kt(k.schemaName,"."):void 0);if(!L)break;T(`var:${L}`),$.isExternalInitializationAllowed===!0&&T(`var-in:${L}`),v||g.push({name:L,at:{file:d.path,line:y.lineOf(k)}});break}case"ConnectionReferencesSourceFile":for(let $ of an(k.connectionReferences).map(ae)){let L=X($?.connectorId)?kt($.connectorId,"/"):X($?.connectionReferenceLogicalName)?ln($.connectionReferenceLogicalName):void 0;L&&T(`connref:${L}`,$),L&&X($?.displayName)&&(s.names[L]=$.displayName)}break}for(let $ of $t(k,!0))T(`disabled:node:${$.kind}`,$);for(let $ of $t(k)){if(xh.has($.kind)&&T(`node:${$.kind}`,$),$.kind==="LogCustomTelemetryEvent"&&!v&&(X($.eventName)&&!$.eventName.trim().startsWith("=")?u.push({name:$.eventName.trim(),properties:$.properties,at:{file:d.path,line:y.lineOf($)}}):s.unknown.push({file:d.path,why:"telemetry"})),$.kind==="InvokeConnectorAction"&&X($.connectionReference)){let K=ln($.connectionReference);T(`connector:${K}`,$),X($.operationId)&&T(`operation:${K}/${$.operationId}`,$)}if($.kind==="InvokeFlowAction"&&X($.flowId)&&T(`flow:${$.flowId}`,$),($.kind==="BeginDialog"||$.kind==="ReplaceDialog")&&X($.dialog)){let K=$.dialog;c.push(K),K.startsWith("=")?K.includes("Switch(")&&T("ms:dynamic-topic-redirect",$):o.push({topic:`${v??""}/${kt(K,".topic.")}`,into:S,at:{file:d.path,line:y.lineOf($)}})}let L=K=>typeof K=="string"&&K.includes("System.Activity.ChannelId");($.kind==="ConditionGroup"&&an($.conditions).some(K=>L(ae(K)?.condition))||$.kind==="SetVariable"&&L($.value))&&T("ms:channel-aware-behavior",$),($.kind==="SendActivity"||$.kind==="Question")&&JSON.stringify($).includes("<br")&&T("ms:line-breaks-in-messages",$)}}r.length&&(s.facts[`knowledge:count=${r.length}`]=r);for(let d of u){let m=Bi(d.name,s),y=Ki(d.properties);(s.facts[`telemetry:event:${m}`]??=[]).push(d.at);for(let k of y??[])(s.facts[`telemetry:field:${m}/${k}`]??=[]).push(d.at);s.telemetry.push({name:d.name,form:m,...y?{fields:y}:{},...d.at})}let p=new Set([s.facts,...s.children.map(d=>d.facts)].flatMap(d=>Object.keys(d)).filter(d=>d.startsWith("flow:")).map(d=>d.slice(5)));for(let[d,{meta:m,metaFile:y,json:k}]of[...l].sort(([v],[S])=>v.localeCompare(S))){let v=X(m?.jsonFileName)??Object.keys(k)[0],S=v?k[v]:void 0,T=X(m?.workflowId),N=d.replace(/-[0-9a-f]{6,}$/i,"");if(!S){y&&s.unknown.push({file:y,why:"flow"});continue}let P=_i(S.data);if(!P||!T){s.unknown.push({file:S.file,why:"flow"});continue}let M=X(m?.displayName)??X(ae(ae(S.data)?.properties)?.displayName)??N,C=p.has(T);if(s.flows.push({id:T,name:M,folder:d,uses:P.uses.map($=>$.key),returns:!!P.returns,called:C,file:S.file}),s.names[T]??=M,!C){(s.facts[`orphan:flow:${N}`]??=[]).push({file:y??S.file,line:1}),s.names[N]??=M;continue}for(let $ of P.uses)(s.facts[`flow-uses:${$.key}`]??=[]).push({file:S.file,line:Ds(S.text,$.action)});P.returns&&(s.facts["flow-returns"]??=[]).push({file:S.file,line:Ds(S.text,P.returns)})}for(let d of f)c.some(m=>m===d.name||m.endsWith(`.${d.name}`))||(s.facts[`orphan:${d.kind}:${d.name}`]??=[]).push(d.at);for(let d of g)t.some(y=>y.path!==d.at.file&&new RegExp(`\\bGlobal\\.${d.name}\\b`).test(y.text))||(delete s.facts[`var:${d.name}`],delete s.facts[`var-in:${d.name}`],(s.facts[`orphan:variable:${d.name}`]??=[]).push(d.at));for(let d of o){let m=i.get(d.topic);(d.into[m?`reaches:${m}`:`calls:topic:${kt(d.topic,"/")}`]??=[]).push(d.at)}for(let d of[s.facts,...s.children.map(m=>m.facts)])for(let[m,y]of Object.entries(d))d[m]=y.filter((k,v)=>y.findIndex(S=>S.file===k.file&&S.line===k.line)===v);return s}function qh(e){let t=new Set,n=r=>{if(!r||typeof r!="object")return;let{const:i,enum:o}=r;if(typeof i=="string"&&t.add(i),Array.isArray(o))for(let a of o)typeof a=="string"&&t.add(a)},s=r=>{if(Array.isArray(r))return r.forEach(s);if(!r||typeof r!="object")return;let i=r;n(i.kind),n(i.properties?.kind);for(let o of Object.values(i))s(o)};for(let r of Object.values(e.definitions??{}))s(r);return t}var vt=Fs($s(),1);function vs(e,t){let n=new vt.LineCounter,s=(0,vt.parseDocument)(e,{lineCounter:n,prettyErrors:!1}),r=o=>{for(let a=o;a.length;a=a.slice(0,-1)){let c=s.getIn(a,!0);if(c?.range)return n.linePos(c.range[0]).line}return 1};if(s.errors.length)return{ok:!1,problem:{line:n.linePos(s.errors[0].pos[0]).line,key:"syntax",detail:s.errors[0].code}};let i=s.toJS();return!i||typeof i!="object"||Array.isArray(i)||i.format!==t||!(0,vt.isMap)(s.contents)?{ok:!1,problem:{line:r(["format"]),key:"format"}}:{ok:!0,format:{raw:i,doc:s,at:r,lineOf:o=>n.linePos(o).line}}}var Ss=[{id:"orchestrator-variables",name:"Orchestrator-Generated Variables",sign:"an OnRecognizedIntent topic with an AutomaticTaskInput that has shouldPromptUser: false"},{id:"rai-error-handling",name:"RAI Error Handling",sign:"the OnError topic reads System.Error.SubCode"},{id:"knowledge-hold-message",name:"Knowledge Hold Message",sign:"an OnKnowledgeRequested topic that sends a message"},{id:"prevent-tool-call-leaks",name:"Prevent Tool Call Leaks",sign:"an OnGeneratedResponse topic that sets System.ContinueResponse"},{id:"dynamic-topic-redirect",name:"Dynamic Topic Redirect",sign:"a BeginDialog whose dialog is a =Switch( expression"},{id:"channel-aware-behavior",name:"Channel-Aware Behavior",sign:"a condition or SetVariable that reads System.Activity.ChannelId (not a tool input)"},{id:"date-context",name:"Date Context",sign:"the instructions use Today() or Now()"},{id:"line-breaks-in-messages",name:"Line Breaks in Messages",sign:"<br /> inside a SendActivity or Question"},{id:"conversation-history-variable",name:"Conversation History Variable"},{id:"chain-of-thought-logging",name:"Chain of Thought Logging"},{id:"deterministic-mcp-calls",name:"Deterministic MCP Calls"},{id:"prevent-child-agent-responses",name:"Prevent Child Agent Responses"},{id:"jit-glossary",name:"JIT Glossary"},{id:"jit-user-context",name:"JIT User Context"},{id:"teams-production-hardening",name:"Teams Production Hardening"}];var ki={conversation:{en:"A. Conversation",pt:"A. Conversa"},integrations:{en:"B. Integrations",pt:"B. Integra\xE7\xF5es"},knowledge:{en:"C. Knowledge",pt:"C. Conhecimento"},orchestration:{en:"D. Orchestrator",pt:"D. Orquestrador"},governance:{en:"E. Governance",pt:"E. Governan\xE7a"},text:{en:"F. Text",pt:"F. Texto"},microsoft:{en:"Microsoft patterns",pt:"Padr\xF5es Microsoft"},declared:{en:"Declared",pt:"Declarado"}},fn={"trigger:OnConversationStart":{dim:"conversation",en:"Greeting",pt:"Boas-vindas"},"trigger:OnUnknownIntent":{dim:"conversation",en:"Fallback (when it does not understand)",pt:"Fallback (quando n\xE3o entende)"},"trigger:OnEscalate":{dim:"conversation",en:"Escalation to a person",pt:"Escalonamento para humano",lacks:{en:["does not escalate to a person","do not escalate to a person"],pt:["n\xE3o escala para humano","n\xE3o escalam para humano"]}},"trigger:OnError":{dim:"conversation",en:"Error handling",pt:"Tratamento de erro",lacks:{en:["does not handle errors","do not handle errors"],pt:["n\xE3o trata erro","n\xE3o tratam erro"]}},"trigger:OnRecognizedIntent":{dim:"conversation",en:"A topic of its own, by intent",pt:"T\xF3pico pr\xF3prio, por inten\xE7\xE3o"},"trigger:OnRedirect":{dim:"orchestration",phrase:!0,en:"Takes a call from the orchestrator",pt:"Recebe chamada do orquestrador",lacks:{en:["takes no call from the orchestrator","take no call from the orchestrator"],pt:["n\xE3o recebe chamada do orquestrador","n\xE3o recebem chamada do orquestrador"]}},"trigger:OnSelectIntent":{dim:"conversation",en:"Disambiguation (\xABdid you mean\u2026\xBB)",pt:"Desambigua\xE7\xE3o (\xABvoc\xEA quis dizer\u2026\xBB)"},"trigger:OnSignIn":{dim:"conversation",en:"Sign-in",pt:"Login"},"trigger:OnGeneratedResponse":{dim:"conversation",phrase:!0,en:"Reviews the generated answer",pt:"Revisa a resposta gerada"},"trigger:OnKnowledgeRequested":{dim:"knowledge",en:"Before searching knowledge",pt:"Antes de buscar no conhecimento"},"trigger:OnToolSelected":{dim:"orchestration",en:"Child chosen as a tool",pt:"Filho escolhido como ferramenta"},"trigger:OnActivity":{dim:"conversation",en:"On every message",pt:"Em toda mensagem"},"setting:generative=on":{dim:"conversation",en:"Generative orchestration on",pt:"Orquestra\xE7\xE3o generativa ligada"},"setting:generative=off":{dim:"conversation",en:"Generative orchestration off",pt:"Orquestra\xE7\xE3o generativa desligada"},"setting:model-knowledge=on":{dim:"governance",en:"The model's general knowledge on",pt:"Conhecimento geral do modelo ligado"},"setting:model-knowledge=off":{dim:"governance",en:"The model's general knowledge off",pt:"Conhecimento geral do modelo desligado"},"setting:semantic-search=on":{dim:"knowledge",en:"Semantic search on",pt:"Busca sem\xE2ntica ligada"},"setting:semantic-search=off":{dim:"knowledge",en:"Semantic search off",pt:"Busca sem\xE2ntica desligada"},"setting:web-browsing=on":{dim:"knowledge",en:"Web browsing on",pt:"Navega\xE7\xE3o na web ligada"},"setting:web-browsing=off":{dim:"knowledge",en:"Web browsing off",pt:"Navega\xE7\xE3o na web desligada"},"setting:connectable":{dim:"orchestration",phrase:!0,en:"Can be called by an orchestrator",pt:"Pode ser chamado por um orquestrador"},"called-with:history":{dim:"orchestration",phrase:!0,en:"Receives the conversation history",pt:"Recebe o hist\xF3rico da conversa",lacks:{en:["does not receive the conversation history from the orchestrator","do not receive the conversation history from the orchestrator"],pt:["n\xE3o recebe o hist\xF3rico da conversa do orquestrador","n\xE3o recebem o hist\xF3rico da conversa do orquestrador"]}},"routing:described":{dim:"orchestration",phrase:!0,en:"Has a routing description",pt:"Tem descri\xE7\xE3o de roteamento",lacks:{en:["has no routing description","have no routing description"],pt:["n\xE3o tem descri\xE7\xE3o de roteamento","n\xE3o t\xEAm descri\xE7\xE3o de roteamento"]}},"flow-returns":{dim:"integrations",phrase:!0,en:"The flow returns an answer",pt:"O fluxo devolve uma resposta",lacks:{en:["has a flow that returns nothing","have a flow that returns nothing"],pt:["tem fluxo que n\xE3o devolve nada","t\xEAm fluxo que n\xE3o devolve nada"]}},"flow-uses:child-flow":{dim:"integrations",phrase:!0,en:"The flow calls another flow",pt:"O fluxo chama outro fluxo"},"topics:with-model-description":{dim:"conversation",en:"Topics described for the model",pt:"T\xF3picos descritos para o modelo"},"instructions:present":{dim:"governance",phrase:!0,en:"Has instructions",pt:"Tem instru\xE7\xF5es",lacks:{en:["has no instructions","have no instructions"],pt:["n\xE3o tem instru\xE7\xF5es","n\xE3o t\xEAm instru\xE7\xF5es"]}},"node:LogCustomTelemetryEvent":{dim:"governance",phrase:!0,en:"Logs telemetry",pt:"Registra telemetria",lacks:{en:["logs no telemetry","log no telemetry"],pt:["n\xE3o registra telemetria","n\xE3o registram telemetria"]}},"node:CSATQuestion":{dim:"governance",phrase:!0,en:"Asks for satisfaction (CSAT)",pt:"Pergunta a satisfa\xE7\xE3o (CSAT)",lacks:{en:["does not ask for satisfaction","do not ask for satisfaction"],pt:["n\xE3o pergunta a satisfa\xE7\xE3o","n\xE3o perguntam a satisfa\xE7\xE3o"]}},"node:SearchAndSummarizeContent":{dim:"knowledge",en:"Generative answers from knowledge",pt:"Respostas generativas sobre o conhecimento"},"node:SearchKnowledgeSources":{dim:"knowledge",phrase:!0,en:"Searches the knowledge sources",pt:"Busca nas fontes de conhecimento"},"yaml-only:triggerCondition":{dim:"knowledge",en:"Search condition only in YAML (the editor may erase it)",pt:"Condi\xE7\xE3o de busca s\xF3 no YAML (a tela pode apagar)"},"knowledge:SharePointSearchSource":{dim:"knowledge",en:"Knowledge in SharePoint",pt:"Conhecimento no SharePoint"},"declared:kpi":{dim:"declared",en:"KPI declared",pt:"KPI declarado",lacks:{en:["has no KPI declared","have no KPI declared"],pt:["n\xE3o tem KPI declarado","n\xE3o t\xEAm KPI declarado"]}},"eval:run":{dim:"governance",phrase:!0,en:"Passed through an evaluation",pt:"Passou por uma avalia\xE7\xE3o",lacks:{en:["has no evaluation","have no evaluation"],pt:["n\xE3o tem avalia\xE7\xE3o","n\xE3o t\xEAm avalia\xE7\xE3o"]}},"declared:team":{dim:"declared",en:"Team declared",pt:"Equipe declarada",lacks:{en:["has no team declared","have no team declared"],pt:["n\xE3o tem equipe declarada","n\xE3o t\xEAm equipe declarada"]}},"declared:owner":{dim:"declared",en:"Owner declared",pt:"Respons\xE1vel declarado",lacks:{en:["has no owner declared","have no owner declared"],pt:["n\xE3o tem respons\xE1vel declarado","n\xE3o t\xEAm respons\xE1vel declarado"]}}},Lh=Object.fromEntries(Ss.map(e=>[e.id,e.name])),Mh=[["called-with:input:","orchestration","Receives <value> from the orchestrator","Recebe <valor> do orquestrador"],["flow-uses:http:","integrations","Flow calls","Fluxo chama"],["flow-uses:connector:","integrations","Flow uses the connector","Fluxo usa o conector"],["flow-uses:operation:","integrations","Flow uses the operation","Fluxo usa a opera\xE7\xE3o"],["orphan:topic:","governance","Topic nobody calls","T\xF3pico que ningu\xE9m chama"],["orphan:action:","governance","Tool nobody can choose","Ferramenta que ningu\xE9m escolhe"],["orphan:variable:","governance","Variable nobody uses","Vari\xE1vel que ningu\xE9m usa"],["orphan:flow:","governance","Flow nobody calls","Fluxo que ningu\xE9m chama"],["disabled:node:","governance","Switched-off node","N\xF3 desligado"],["telemetry:event:","governance","Logs the event","Registra o evento"],["telemetry:field:","governance","The event carries the field (<event>/<field>)","O evento leva o campo (<evento>/<campo>)"],["disabled:","governance","Switched off","Desligado"],["reaches:","conversation","A topic leads to it (part of trigger:<value>)","Um t\xF3pico leva a ele (parte de trigger:<valor>)"],["calls:topic:","conversation","Calls the topic (one not found)","Chama o t\xF3pico (n\xE3o encontrado)"],["trigger:","conversation","Trigger","Gatilho"],["setting:","conversation","Setting","Configura\xE7\xE3o"],["connector:","integrations","Connector","Conector"],["operation:","integrations","Operation","Opera\xE7\xE3o"],["connref:","integrations","Connection reference","Refer\xEAncia de conex\xE3o"],["mcp:","integrations","MCP server","Servidor MCP"],["flow:","integrations","Flow","Fluxo"],["knowledge:","knowledge","Knowledge","Conhecimento"],["node:","governance","Node","N\xF3"],["calls:","orchestration","Calls","Chama"],["child:","orchestration","Child","Filho"],["var-in:","orchestration","Receives from the orchestrator","Recebe do orquestrador"],["var:","orchestration","Global variable","Vari\xE1vel global"],["model:","governance","Model","Modelo"],["auth:","governance","Sign-in","Login"],["ms:","microsoft","Microsoft pattern:","Padr\xE3o Microsoft:"],["text:","text","Text:","Texto:"],["declared:","declared","Declared:","Declarado:"]],Ll=e=>Mh.find(([t])=>e.startsWith(t)),Ml=e=>!!fn[e]?.lacks;function un(e){return e.startsWith("reaches:")?un(`trigger:${e.slice(8)}`):fn[e]?.dim??Ll(e)?.[1]??"governance"}var Qe=(e,t)=>t.endsWith("*")?e.startsWith(t.slice(0,-1)):e===t,Il=80;function St(e){if(e.startsWith("reaches:"))return`trigger:${e.slice(8)}`;if(e.startsWith("telemetry:event:"))return"node:LogCustomTelemetryEvent";if(e.startsWith("telemetry:field:"))return`telemetry:event:${e.slice(16,e.lastIndexOf("/"))}`}var $e=(e,t)=>e.split("{agent}").join(t==="pt"?"\u2039nome\u203A":"\u2039name\u203A"),Rl=e=>({form:e.slice(16,e.lastIndexOf("/")),field:e.slice(e.lastIndexOf("/")+1)}),Ih={shared_commondataserviceforapps:"Microsoft Dataverse",shared_sharepointonline:"SharePoint",shared_office365:"Office 365 Outlook",shared_office365users:"Office 365 Users",shared_teams:"Microsoft Teams",shared_approvals:"Approvals",shared_onedriveforbusiness:"OneDrive for Business",shared_excelonlinebusiness:"Excel Online (Business)",shared_sql:"SQL Server",shared_azureblob:"Azure Blob Storage",shared_planner:"Planner",shared_outlook:"Outlook.com",shared_webcontents:"HTTP with Microsoft Entra ID",shared_servicenow:"ServiceNow",shared_salesforce:"Salesforce"},cn=(e,t)=>t?.[e]??Ih[e]??e,Rh=["called-with:input:","telemetry:event:","telemetry:field:","flow-uses:","var-in:","reaches:"],Fl=e=>!!fn[e]?.phrase||Rh.some(t=>e.startsWith(t));function ne(e,t,n){let s=fn[e];if(s)return s[t];if(e.startsWith("text:block:")){let a=e.endsWith("~variant"),c=a?e.slice(0,-8):e,f=n?.[c]??c.slice(11);return a?`${f} (${t==="pt"?"varia\xE7\xE3o":"variation"})`:f}if(e.startsWith("text:link-domain:"))return`${t==="pt"?"Link para":"Link to"} ${e.slice(17)}`;if(e==="text:email")return t==="pt"?"Cita um e-mail":"Mentions an e-mail";if(e.startsWith("text:")){let[a,c]=[e.slice(5).split("=")[0],e.includes("=")?e.slice(e.indexOf("=")+1):void 0],f=n?.[`text:${a}`]??a;return c===void 0?f:`${f} = ${c}`}if(e.startsWith("reaches:")){let a=ne(`trigger:${e.slice(8)}`,t);return t==="pt"?`Um t\xF3pico leva a \xAB${a}\xBB`:`A topic leads to \xAB${a}\xBB`}if(e.startsWith("called-with:input:"))return t==="pt"?`Recebe \xAB${e.slice(18)}\xBB do orquestrador`:`Receives \xAB${e.slice(18)}\xBB from the orchestrator`;if(e.startsWith("telemetry:event:"))return t==="pt"?`Registra o evento \xAB${$e(e.slice(16),t)}\xBB`:`Logs the event \xAB${$e(e.slice(16),t)}\xBB`;if(e.startsWith("telemetry:field:")){let{form:a,field:c}=Rl(e),f=$e(a,t);return t==="pt"?`\xAB${f}\xBB leva \xAB${c}\xBB`:`\xAB${f}\xBB carries \xAB${c}\xBB`}let r=/^knowledge:count=(\d+)$/.exec(e);if(r){let a=Number(r[1]);return t==="pt"?`${a} ${a===1?"fonte":"fontes"} de conhecimento`:`${a} knowledge ${a===1?"source":"sources"}`}let i=Ll(e);if(!i)return e;let o=e.slice(i[0].length);if(i[0]==="ms:"&&(o=Lh[o]??o),i[0]==="auth:"&&o==="None")return t==="pt"?"Sem login":"No sign-in";if(e.startsWith("setting:moderation="))return t==="pt"?`Modera\xE7\xE3o de conte\xFAdo: ${e.slice(19)}`:`Content moderation: ${e.slice(19)}`;if(["connector:","connref:","mcp:","calls:","flow:","flow-uses:connector:","orphan:flow:"].includes(i[0])&&(o=cn(o,n)),i[0]==="disabled:"&&(o=o.replace(":"," ")),i[0]==="operation:"||i[0]==="flow-uses:operation:"){let[a,c]=[o.slice(0,o.indexOf("/")),o.slice(o.indexOf("/")+1)];o=`${cn(a,n)} \xB7 ${c}`}return`${i[t==="pt"?3:2]} ${o}`}function Os(e,t,n,s){let r=fn[e]?.lacks?.[t];if(r)return r[n===1?0:1];if(e.startsWith("reaches:")){let o=ne(`trigger:${e.slice(8)}`,t);return t==="pt"?`${n===1?"tem":"t\xEAm"} \xAB${o}\xBB, mas nenhum t\xF3pico leva a ele`:`${n===1?"has":"have"} \xAB${o}\xBB, but no topic leads to it`}if(e.startsWith("called-with:input:"))return t==="pt"?`${n===1?"n\xE3o recebe":"n\xE3o recebem"} \xAB${e.slice(18)}\xBB do orquestrador`:`${n===1?"does":"do"} not receive \xAB${e.slice(18)}\xBB from the orchestrator`;if(e.startsWith("telemetry:event:")){let o=$e(e.slice(16),t);return t==="pt"?`${n===1?"n\xE3o registra":"n\xE3o registram"} o evento \xAB${o}\xBB`:`${n===1?"does":"do"} not log the event \xAB${o}\xBB`}if(e.startsWith("telemetry:field:")){let{form:o,field:a}=Rl(e),c=$e(o,t);return t==="pt"?`${n===1?"registra":"registram"} \xAB${c}\xBB sem \xAB${a}\xBB`:`${n===1?"logs":"log"} \xAB${c}\xBB without \xAB${a}\xBB`}if(e.startsWith("calls:topic:"))return t==="pt"?`${n===1?"n\xE3o chama":"n\xE3o chamam"} o t\xF3pico ${e.slice(12)}`:`${n===1?"does":"do"} not call the topic ${e.slice(12)}`;let i=ne(e,t,s);return t==="pt"?`${n===1?"n\xE3o tem":"n\xE3o t\xEAm"} \xAB${i}\xBB`:`${n===1?"does":"do"} not have \xAB${i}\xBB`}var jl="cast-list/profile-v1",vi=["orchestrator","specialist"],$i={roles:{},threshold:.7,minAgents:3,rules:[],markers:[],blocks:[],types:[],focusAreas:[],ignore:[],microsoftPatterns:!0},Fh=["format","name","roles","threshold","min_agents","rules","markers","blocks","types","focus_areas","ignore","microsoft_patterns"],jh=["instructions","descriptions","all"],Dh=new Set(["trigger","setting","topics","instructions","connector","operation","connref","mcp","flow","knowledge","node","calls","reaches","child","var","var-in","model","auth","ms","declared","text","yaml-only","called-with","routing","flow-uses","flow-returns","orphan","disabled","telemetry","eval"]),_h=e=>Dh.has(e.split(":")[0]),it=e=>!!e&&typeof e=="object"&&!Array.isArray(e),le=e=>typeof e=="string"?e.trim():typeof e=="number"?String(e):"",As=e=>Array.isArray(e)?e.map(le).filter(Boolean):le(e)?[le(e)]:[],Dl=e=>vi.includes(e);function Bh(e){let t=vs(e,jl);if(!t.ok)return{problems:[t.problem.key==="format"?{...t.problem,format:jl}:t.problem]};let{raw:n,at:s}=t.format,r=[];for(let N of Object.keys(n))Fh.includes(N)||r.push({line:s([N]),key:"unknownKey",what:N});let i=(N,P,M)=>(le(N)||r.push({line:s(M),key:"missing",what:P}),le(N)),o=(N,P)=>{let M=new Set;P.forEach((C,$)=>{C&&M.has(C)&&r.push({line:s([N,$]),key:"duplicate",what:N,id:C}),M.add(C)})},a=N=>Array.isArray(n[N])?n[N]:[],c=n.threshold===void 0?$i.threshold:Number(n.threshold);c>0&&c<=1||r.push({line:s(["threshold"]),key:"threshold",value:le(n.threshold)});let f=n.min_agents===void 0?$i.minAgents:Number(n.min_agents);Number.isInteger(f)&&f>=1||r.push({line:s(["min_agents"]),key:"minAgents",value:le(n.min_agents)});let g={},u=it(n.roles)?n.roles:{};for(let N of Object.keys(u))Dl(N)?g[N]=le(u[N])==="*"?"*":As(u[N]):r.push({line:s(["roles",N]),key:"role",what:`roles.${N}`,value:N});let l=(N,P,M)=>(Dl(le(N))||r.push({line:s(M),key:"role",what:P,value:le(N)}),le(N)),p=(N,P,M)=>{let C=As(N);for(let $ of C)_h($)||r.push({line:s(M),key:"prefix",what:P,value:$});return C},d=a("rules").filter(it).map((N,P)=>{let M=`rules[${P}]`,C=p(N.has,M,["rules",P])[0],$=p(N.not,M,["rules",P])[0],L=p(N.when,M,["rules",P]);return!C&&!$&&r.push({line:s(["rules",P]),key:"rule",what:M}),{id:i(N.id,`${M}.id`,["rules",P]),...N.role!==void 0?{role:l(N.role,`${M}.role`,["rules",P,"role"])}:{},...L.length?{when:L}:{},...C?{has:C}:{},...$?{not:$}:{},says:le(N.says)||C||`not ${$}`}});o("rules",d.map(N=>N.id));let m=a("markers").filter(it).map((N,P)=>{let M=`markers[${P}]`,C=i(N.pattern,`${M}.pattern`,["markers",P]);try{C&&new RegExp(C,"i")}catch(K){r.push({line:s(["markers",P]),key:"regex",what:`${M}.pattern`,detail:K.message.replace(/^Invalid regular expression: /,"")})}let $=le(N.in)||"instructions";jh.includes($)||r.push({line:s(["markers",P]),key:"in",what:`${M}.in`,value:$});let L=i(N.id,`${M}.id`,["markers",P]);return{id:L,name:le(N.name)||L,in:$,pattern:C,...le(N.value)?{value:le(N.value)}:{}}});o("markers",m.map(N=>N.id));let y=a("blocks").filter(it).map((N,P)=>{let M=i(N.id,`blocks[${P}].id`,["blocks",P]);return{id:M,name:le(N.name)||M,text:i(N.text,`blocks[${P}].text`,["blocks",P]),role:N.role!==void 0?l(N.role,`blocks[${P}].role`,["blocks",P,"role"]):"specialist"}});o("blocks",y.map(N=>N.id));let k=a("types").filter(it).map((N,P)=>{let M=`types[${P}]`,C=it(N.when)?N.when:{},$=Object.fromEntries(["all","any","none"].filter(J=>C[J]!==void 0).map(J=>[J,p(C[J],M,["types",P])]));!$.all?.length&&!$.any?.length&&r.push({line:s(["types",P]),key:"when",what:M});let L=N.min_agents===void 0?2:Number(N.min_agents);Number.isInteger(L)&&L>=1||r.push({line:s(["types",P,"min_agents"]),key:"minAgents",value:le(N.min_agents)});let K=i(N.id,`${M}.id`,["types",P]);return{id:K,name:le(N.name)||K,when:$,minAgents:L}});o("types",k.map(N=>N.id));let v=a("focus_areas").filter(it).map((N,P)=>{let M=As(N.facts);M.length||r.push({line:s(["focus_areas",P]),key:"missing",what:`focus_areas[${P}].facts`});let C=i(N.id,`focus_areas[${P}].id`,["focus_areas",P]);return{id:C,name:le(N.name)||C,facts:M}});o("focus_areas",v.map(N=>N.id));let S=n.microsoft_patterns,T={...le(n.name)?{name:le(n.name)}:{},roles:g,threshold:c,minAgents:f,rules:d,markers:m,blocks:y,types:k,focusAreas:v,ignore:As(n.ignore),microsoftPatterns:!(S===!1||le(S).toLowerCase()==="off")};return r.length?{problems:r}:{profile:T,problems:r}}var Kh=e=>Object.keys(e.facts).some(t=>t.startsWith("calls:")&&!t.startsWith("calls:topic:"));function _l(e,t,n={}){let{orchestrator:s,specialist:r}=t.roles,i=(f,g)=>Array.isArray(f)&&f.includes(g),o=Object.fromEntries(e.map(f=>[f.id,i(s,f.id)?"orchestrator":i(r,f.id)?"specialist":n[f.id]??(s==="*"?"orchestrator":r==="*"?"specialist":Kh(f)?"orchestrator":"specialist")])),a=new Set(e.map(f=>f.id)),c=[s,r].flatMap(f=>Array.isArray(f)?f:[]).filter(f=>!a.has(f));return{roles:o,unmatched:c}}function Bl(e,t,n,s){let r=(i,o)=>Object.keys(i).some(a=>Qe(a,o));return Object.fromEntries(e.map(i=>{if(t[i.id]!=="specialist")return[i.id,[]];if(s[i.id]?.length)return[i.id,s[i.id]];let o=n.types.filter(({when:a})=>(a.all??[]).every(c=>r(i.facts,c))&&(!a.any?.length||a.any.some(c=>r(i.facts,c)))&&!(a.none??[]).some(c=>r(i.facts,c)));return[i.id,o.map(a=>a.id)]}))}var Re=Fs($s());var dn="cast-list/cast-v1",Uh=["accepted","rejected"],Wh=["platform","specialist","orchestrator"],Yh=e=>Wh.includes(e)||/^type:[\w-]+$/.test(e),zh=["format","name","agents","blocks","declared","decisions"],Vh=e=>!!e&&typeof e=="object"&&!Array.isArray(e),ge=e=>typeof e=="string"?e.trim():typeof e=="number"||typeof e=="boolean"?String(e):"";function Jh(e){let t=vs(e,dn);if(!t.ok)return{problems:[t.problem.key==="format"?{...t.problem,format:dn}:t.problem]};let{raw:n,at:s}=t.format,r=[];for(let l of Object.keys(n))zh.includes(l)||r.push({line:s([l]),key:"unknownKey",what:l});let i=l=>(Array.isArray(n[l])?n[l]:[]).filter(Vh),o=(l,p,d)=>(ge(l)||r.push({line:s(d),key:"missing",what:p}),ge(l)),a=(l,p)=>{let d=new Set;p.forEach((m,y)=>{m&&d.has(m)&&r.push({line:s([l,y]),key:"duplicate",what:l,id:m}),d.add(m)})},c=i("agents").map((l,p)=>{let d=ge(l.role);vi.includes(d)||r.push({line:s(["agents",p,"role"]),key:"role",what:`agents[${p}].role`,value:d});let m=Array.isArray(l.types)?l.types.map(ge).filter(Boolean):[];return{id:o(l.id,`agents[${p}].id`,["agents",p]),role:d,...m.length?{types:m}:{}}}),f=i("blocks").map((l,p)=>({id:o(l.id,`blocks[${p}].id`,["blocks",p]),text:o(l.text,`blocks[${p}].text`,["blocks",p])}));a("blocks",f.map(l=>l.id)),a("agents",c.map(l=>l.id));let g=i("declared").map((l,p)=>({agent:o(l.agent,`declared[${p}].agent`,["declared",p]),key:o(l.key,`declared[${p}].key`,["declared",p]),value:ge(l.value),source:ge(l.source)}));a("declared",g.map(l=>`${l.agent} ${l.key}`));let u=i("decisions").map((l,p)=>{let d=ge(l.status),m=ge(l.scope);return Uh.includes(d)||r.push({line:s(["decisions",p,"status"]),key:"status",value:d}),Yh(m)||r.push({line:s(["decisions",p,"scope"]),key:"scope",value:m}),{key:o(l.key,`decisions[${p}].key`,["decisions",p]),status:d,scope:m,why:ge(l.why)}});return a("decisions",u.map(l=>l.key)),r.length?{problems:r}:{cast:{...ge(n.name)?{name:ge(n.name)}:{},agents:c,blocks:f,declared:g,decisions:u},problems:r}}var Gh=` What people said about the agents, and what was decided. build.mjs keeps it up to date; edit it, or fill the
|
|
142
|
+
workbook's \xABDeclared\xBB sheet and the \xABDecision\xBB column and read it back with --from.`,Hh={agents:e=>ge(e.id),blocks:e=>ge(e.id),declared:e=>`${ge(e.agent)} ${ge(e.key)}`,decisions:e=>ge(e.key)},Xh=e=>Object.fromEntries(Object.entries(e).filter(([,t])=>t!==""&&t!==void 0));function Qh(e,t){let n=t?(0,Re.parseDocument)(t):void 0,s=n&&!n.errors.length&&(0,Re.isMap)(n.contents)?n:new Re.Document({format:dn});s!==n&&(s.commentBefore=Gh),s.get("format")!==dn&&s.set("format",dn),e.name===void 0?s.delete("name"):s.get("name")!==e.name&&s.set("name",e.name);for(let[r,i]of Object.entries(Hh)){let o=e[r];if(!o.length){s.delete(r);continue}let a=s.get(r,!0);if((0,Re.isSeq)(a)||s.set(r,a=s.createNode([])),!(0,Re.isSeq)(a))continue;let c=new Map(a.items.filter(Re.isMap).map(f=>[i(f.toJSON()),f]));a.items=o.map(f=>{let g=Xh(f),u=c.get(i(g));if(!u){let l=s.createNode(g);return l.flow=r!=="blocks",l}for(let[l,p]of Object.entries(g))JSON.stringify(u.toJSON()[l])!==JSON.stringify(p)&&u.set(l,p);for(let l of Object.keys(u.toJSON()))l in g||u.delete(l);return u})}return s.toString({lineWidth:0,flowCollectionPadding:!0})}function Zh(e,t="en"){let n=t==="pt";switch(e.key){case"syntax":return n?`n\xE3o se l\xEA como YAML (${e.detail})`:`does not read as YAML (${e.detail})`;case"format":return n?`\xABformat\xBB precisa ser ${e.format}`:`\xABformat\xBB must be ${e.format}`;case"missing":return n?`falta \xAB${e.what}\xBB`:`\xAB${e.what}\xBB is missing`;case"duplicate":return n?`${e.what}: o id \xAB${e.id}\xBB se repete`:`${e.what}: the id \xAB${e.id}\xBB is repeated`;case"unknownKey":return n?`\xAB${e.what}\xBB n\xE3o \xE9 um campo deste arquivo`:`\xAB${e.what}\xBB is not a field of this file`;case"threshold":return n?`\xABthreshold\xBB vai de 0 a 1, como 0.7 (est\xE1 \xAB${e.value}\xBB)`:`\xABthreshold\xBB goes from 0 to 1, like 0.7 (it is \xAB${e.value}\xBB)`;case"minAgents":return n?`\xABmin_agents\xBB \xE9 um n\xFAmero inteiro a partir de 1 (est\xE1 \xAB${e.value}\xBB)`:`\xABmin_agents\xBB is a whole number from 1 (it is \xAB${e.value}\xBB)`;case"role":return n?`\xAB${e.what}\xBB \xE9 orchestrator ou specialist (est\xE1 \xAB${e.value}\xBB)`:`\xAB${e.what}\xBB is orchestrator or specialist (it is \xAB${e.value}\xBB)`;case"status":return n?`\xABstatus\xBB \xE9 accepted ou rejected (est\xE1 \xAB${e.value}\xBB)`:`\xABstatus\xBB is accepted or rejected (it is \xAB${e.value}\xBB)`;case"scope":return n?`\xABscope\xBB \xE9 platform, specialist, orchestrator ou type:<tipo> (est\xE1 \xAB${e.value}\xBB)`:`\xABscope\xBB is platform, specialist, orchestrator or type:<type> (it is \xAB${e.value}\xBB)`;case"regex":return n?`\xAB${e.what}\xBB n\xE3o \xE9 uma express\xE3o regular v\xE1lida (${e.detail})`:`\xAB${e.what}\xBB is not a valid regular expression (${e.detail})`;case"in":return n?`\xAB${e.what}\xBB \xE9 instructions, descriptions ou all (est\xE1 \xAB${e.value}\xBB)`:`\xAB${e.what}\xBB is instructions, descriptions or all (it is \xAB${e.value}\xBB)`;case"when":return n?`\xAB${e.what}\xBB precisa de \xABwhen\xBB com all, any ou none`:`\xAB${e.what}\xBB needs a \xABwhen\xBB with all, any or none`;case"prefix":return n?`\xAB${e.what}\xBB: nenhuma chave come\xE7a como \xAB${e.value}\xBB (veja references/keys.md)`:`\xAB${e.what}\xBB: no key starts like \xAB${e.value}\xBB (see references/keys.md)`;case"rule":return n?`\xAB${e.what}\xBB precisa de \xABhas\xBB ou \xABnot\xBB: o que conferir`:`\xAB${e.what}\xBB needs \xABhas\xBB or \xABnot\xBB: what to check`}}function Kl(e,t){let n=e.split(/\s+/).filter(Boolean),s=t.split(/\s+/).filter(Boolean);if(n.length>2e3||s.length>2e3)return[{op:"del",text:n.join(" ")},{op:"add",text:s.join(" ")}];let r=Array.from({length:n.length+1},()=>new Uint16Array(s.length+1));for(let f=n.length-1;f>=0;f--)for(let g=s.length-1;g>=0;g--)r[f][g]=n[f]===s[g]?r[f+1][g+1]+1:Math.max(r[f+1][g],r[f][g+1]);let i=[],o=(f,g)=>{let u=i[i.length-1];u?.op===f?u.text+=` ${g}`:i.push({op:f,text:g})},a=0,c=0;for(;a<n.length||c<s.length;)a<n.length&&c<s.length&&n[a]===s[c]?o("same",(a++,c++,n[a-1])):c<s.length&&(a===n.length||r[a][c+1]>=r[a+1][c])?o("add",s[c++]):o("del",n[a++]);for(let f=0;f+1<i.length;f++)i[f].op==="add"&&i[f+1].op==="del"&&([i[f],i[f+1]]=[i[f+1],i[f]]);return i}var Ul=.85,Si=.5,em=8,Oi=5;function tm(e){return e.normalize("NFD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/https?:\/\/\S+|www\.\S+/g," #url ").replace(/\d+([.,]\d+)?/g," #n ").replace(/[^a-z#\s]+/g," ").split(/\s+/).filter(Boolean)}var nm=e=>{if(e.length<=Oi)return new Set([e.join(" ")]);let t=new Set;for(let n=0;n+Oi<=e.length;n++)t.add(e.slice(n,n+Oi).join(" "));return t},zl=(e,t)=>{let n=0;for(let s of e)t.has(s)&&n++;return n},Wl=(e,t)=>{let n=zl(e,t);return n/(e.size+t.size-n||1)},Ns=(e,t)=>zl(e,t)/(Math.min(e.size,t.size)||1);var Ai=(e,t,n,s)=>{let r=tm(e);return{agent:s,file:t,line:n,text:e,words:r,shingles:nm(r)}};function sm(e,t){let n=[],s=-1,r=e.text.split(`
|
|
143
143
|
`),i=o=>{if(s<0)return;let a=r.slice(s,o).join(`
|
|
144
|
-
`).trim(),c=Oi(a,e.file,e.line+s,t);c.words.length>=Xh&&n.push(c),s=-1};return r.forEach((o,a)=>{o.trim()?s<0&&(s=a):i(a)}),i(r.length),n}var tm=(e,t)=>{let n=e.filter(r=>!r.startsWith("#")).slice(0,5).join("-")||"block",s=n;for(let r=2;t.has(s);r++)s=`${n}-${r}`;return t.add(s),s},Wl=e=>{let t=e.split(/\s+/).filter(Boolean);return t.slice(0,8).join(" ")+(t.length>8?"\u2026":"")};function zl(e,t,n){let s=e.flatMap(u=>u.texts.flatMap(l=>em(l,u.id))),r=[];for(let u of s){let l=r.find(p=>As(p[0].shingles,u.shingles)>=vi);l?l.push(u):r.push([u])}let i=n.map(u=>({...u,block:Oi(u.text,"profile",0)})),o=t.map(u=>({...u,block:Oi(u.text,"cast",0)})),a=new Set([...n.map(u=>u.id),...t.map(u=>u.id)]),c=[],f=new Set;for(let u of r){let l=i.find(v=>!f.has(v.id)&&As(v.block.shingles,u[0].shingles)>=vi);if(new Set(u.map(v=>v.agent)).size<2&&!l)continue;let p=v=>u.filter(S=>Ul(S.shingles,v.shingles)>=Kl).length,d=l?.block??u.reduce((v,S)=>p(S)>p(v)?S:v,u[0]),m=l?void 0:o.find(v=>!f.has(v.id)&&As(v.block.shingles,d.shingles)>=vi),y=l?.id??m?.id??tm(d.words,a);f.add(y);let k={id:y,label:Wl(d.text),text:d.text,...l?{official:l.name}:{},holders:{},variants:{}};for(let v of u){let S=v.agent,T=Ul(d.shingles,v.shingles)>=Kl?1:As(d.shingles,v.shingles);T===1?(k.holders[S]??={file:v.file,line:v.line},delete k.variants[S]):!k.holders[S]&&(!k.variants[S]||T>k.variants[S].similarity)&&(k.variants[S]={source:{file:v.file,line:v.line},similarity:T,text:v.text,diff:Bl(d.text,v.text)})}c.push(k)}for(let u of i.filter(l=>!f.has(l.id)))c.push({id:u.id,label:Wl(u.text),text:u.text,official:u.name,holders:{},variants:{}});let g=Object.fromEntries(e.map(u=>[u.id,{}]));for(let u of c){for(let[l,p]of Object.entries(u.holders))g[l][`text:block:${u.id}`]=[p];for(let[l,p]of Object.entries(u.variants))g[l][`text:block:${u.id}~variant`]=[p.source]}return{families:c,facts:g}}var nm=/https?:\/\/([^\s/)\]>"'«»]+)/gi,sm=/[\w.+-]+@[\w-]+(\.[\w-]+)+/g,rm=(e,t)=>e.line+(e.text.slice(0,t).match(/\n/g)?.length??0),im=e=>e.toLowerCase().replace(/\s+/g," ").trim();function Vl(e,t){let n={},s={};for(let r of e){let i=n[r.id]={},o=s[r.id]={},a=(c,f,g)=>(i[c]??=[]).push({file:f.file,line:rm(f,g)});for(let c of r.texts){for(let f of t.filter(g=>g.in==="all"||g.in===c.source))for(let g of c.text.matchAll(new RegExp(f.pattern,"gi"))){if(!f.value){a(`text:${f.id}`,c,g.index);continue}let u=im(f.value.replace(/\$(\d)/g,(l,p)=>g[Number(p)]??""));u&&(a(`text:${f.id}=${u}`,c,g.index),(o[f.id]??=[]).includes(u)||o[f.id].push(u))}if(c.source==="instructions"){for(let f of c.text.matchAll(nm))a(`text:link-domain:${f[1].toLowerCase().replace(/[.,;:]+$/,"")}`,c,f.index);for(let f of c.text.matchAll(sm))a("text:email",c,f.index)}}for(let[c,f]of Object.entries(i))i[c]=f.filter((g,u)=>f.findIndex(l=>l.file===g.file&&l.line===g.line)===u)}return{facts:n,values:s}}function Jl(e,t,n){let s=[];for(let r of t.filter(i=>i.value)){for(let i of["specialist","orchestrator"]){let o={};for(let[a,c]of Object.entries(e))if(n[a]===i)for(let f of c[r.id]??[])(o[f]??=[]).push(a);Object.keys(o).length>1&&s.push({kind:"values",marker:r,role:i,byValue:o})}for(let[i,o]of Object.entries(e))(o[r.id]??[]).length>1&&s.push({kind:"twice",marker:r,agent:i,values:o[r.id]})}return s}var om=/^(no|não|nao|false|off|0)$/i,am=new Set($s.filter(e=>!e.sign).map(e=>`ms:${e.id}`)),lm=e=>e.includes(":")&&!e.startsWith("declared:")&&!am.has(e),cm=e=>e.startsWith("declared:")?e:`declared:${e}`,Ai=e=>e.endsWith("~variant"),Ns=e=>/^(orphan|disabled):/.test(e);function fm(e){let t=new Map;for(let s of e)for(let r of s.telemetry??[]){let i=t.get(he(r.form))??new Map;t.set(he(r.form),i),i.set(r.form,(i.get(r.form)??new Set).add(s.id))}let n=new Map;for(let s of t.values()){let[r]=[...s].sort(([i,o],[a,c])=>c.size-o.size||i.localeCompare(a));for(let i of s.keys())n.set(i,r[0])}return n}function um(e,t){if(e.startsWith("telemetry:event:"))return`telemetry:event:${t.get(e.slice(16))??e.slice(16)}`;if(e.startsWith("telemetry:field:")){let n=e.lastIndexOf("/"),s=e.slice(16,n);return`telemetry:field:${t.get(s)??s}${e.slice(n)}`}return e}function dm(e,t,n,s){let r=Object.fromEntries(n.agents.map(h=>[h.id,h.role])),{roles:i,unmatched:o}=Dl(e,t,r),a=h=>t.ignore.includes(h)||!t.microsoftPatterns&&h.startsWith("ms:"),c=[],f=zl(e,n.blocks,t.blocks),g=Vl(e,t.markers),u=new Map(e.filter(h=>h.schemaName).map(h=>[h.schemaName,h.id])),l=e.flatMap(h=>(h.contract??[]).map(O=>({...O,caller:h.id,...u.has(O.calls)?{agent:u.get(O.calls)}:{}}))),p={};for(let h of l.filter(O=>O.agent)){let O=p[h.agent]??={},P={file:`${h.caller}/${h.file}`,line:h.line},B=ee=>(O[ee]??=[]).push(P);h.history&&B("called-with:history");for(let ee of h.inputs)B(`called-with:input:${ee}`);h.description&&B("routing:described")}let d=fm(e),m=h=>{let O={};for(let[P,B]of Object.entries(h.facts))(O[um(P,d)]??=[]).push(...B);return{...O,...f.facts[h.id],...g.facts[h.id],...p[h.id]}},y=e.map(h=>{let O=m(h),P=Object.fromEntries(Object.entries(O).filter(([B])=>!a(B)));for(let B of n.declared.filter(ee=>ee.agent===h.id)){let ee=!om.test(B.value);if(lm(B.key)){let ie=B.key in O;ee!==ie&&c.push({agent:h.id,key:B.key,declared:B.value||"yes",observed:ie,source:B.source})}else ee&&(P[cm(B.key)]??=[]).push({file:B.source?`declared: ${B.source}`:"declared"})}return{id:h.id,role:i[h.id],...h.schemaName?{schemaName:h.schemaName}:{},...h.displayName?{displayName:h.displayName}:{},facts:P,children:h.children}}),k=h=>y.filter(O=>O.role===h),v=(h,O=y)=>O.filter(P=>h in P.facts),S=(h,O=y)=>O.flatMap(P=>P.facts[h]??[]),T=[...new Set(y.flatMap(h=>Object.keys(h.facts)))].sort(),N=h=>n.decisions.find(O=>O.key===h),q=_l(y,i,t,Object.fromEntries(n.agents.filter(h=>h.types?.length).map(h=>[h.id,h.types]))),M=h=>h==="platform"?y:h.startsWith("type:")?y.filter(O=>q[O.id]?.includes(h.slice(5))):k(h),C=[];for(let h of["specialist","orchestrator"]){let O=k(h);if(O.length<t.minAgents)continue;let P=k(h==="specialist"?"orchestrator":"specialist");for(let B of T){if(B.startsWith("declared:")||St(B)||Ai(B)||Ns(B)||C.some(xt=>xt.key===B))continue;let ie=v(B,O).length/O.length;if(ie<t.threshold)continue;let U=P.length>0&&v(B,P).length/P.length>=(P.length>=t.minAgents?t.threshold:1),Ae=N(B);C.push({key:B,role:h,scope:Ae?.scope??(U?"platform":h),share:ie,agents:v(B).map(xt=>xt.id),sources:S(B),...Ae?{decision:Ae}:{}})}}let $=[];for(let h of t.types){let O=M(`type:${h.id}`);if(O.length){if(O.length<h.minAgents){$.push({type:h.id,agents:O.map(P=>P.id)});continue}for(let P of T){if(P.startsWith("declared:")||St(P)||Ai(P)||Ns(P)||C.some(ie=>ie.key===P))continue;let B=v(P,O).length/O.length;if(B<t.threshold)continue;let ee=N(P);C.push({key:P,role:"specialist",scope:ee?.scope??`type:${h.id}`,share:B,agents:v(P).map(ie=>ie.id),sources:S(P),...ee?{decision:ee}:{}})}}}for(let h of t.blocks){let O=`text:block:${h.id}`,P=C.find(ie=>ie.key===O);if(P){P.official=h.name;continue}let B=k(h.role),ee=N(O);C.push({key:O,role:h.role,scope:ee?.scope??h.role,share:B.length?v(O,B).length/B.length:0,agents:v(O).map(ie=>ie.id),sources:S(O),official:h.name,...ee?{decision:ee}:{}})}for(let h of n.decisions.filter(O=>O.status==="accepted"&&!C.some(P=>P.key===O.key))){let O=M(h.scope),P=v(h.key,O);C.push({key:h.key,role:h.scope==="orchestrator"?"orchestrator":"specialist",scope:h.scope,share:O.length?P.length/O.length:0,agents:P.map(B=>B.id),sources:S(h.key),decision:h})}for(let h of T.filter(O=>St(O))){let O=C.find(ie=>ie.key===St(h));if(!O)continue;let P=M(O.scope).filter(ie=>O.key in ie.facts),B=P.length?v(h,P).length/P.length:0;if(B<t.threshold)continue;let ee=N(h)??O.decision;C.push({key:h,role:O.role,scope:O.scope,share:B,agents:v(h).map(ie=>ie.id),sources:S(h),partOf:O.key,...ee?{decision:ee}:{}})}C.sort((h,O)=>h.scope.localeCompare(O.scope)||h.key.localeCompare(O.key));let L=e.flatMap(h=>(h.telemetry??[]).map(O=>{let P=s?.rows.filter(B=>B.agent===h.id&&he(B.event)===he(O.name));return{...O,agent:h.id,as:d.get(O.form)??O.form,...s?{fired:P.reduce((B,ee)=>B+ee.count,0)}:{}}})),K=new Set(L.filter(h=>!h.fields).map(h=>`${h.agent} ${h.as}`)),V=(h,O)=>O.startsWith("telemetry:field:")&&K.has(`${h} ${O.slice(16,O.lastIndexOf("/"))}`),fe=C.filter(h=>h.decision?.status!=="rejected").flatMap(h=>M(h.scope).filter(O=>!(h.key in O.facts)&&(!h.partOf||h.partOf in O.facts)&&!V(O.id,h.key)).map(O=>({agent:O.id,key:h.key,scope:h.scope,...h.partOf?{partOf:h.partOf}:{},...`${h.key}~variant`in O.facts?{variant:!0}:{}}))).sort((h,O)=>h.agent.localeCompare(O.agent)||h.key.localeCompare(O.key)),Oe=[],E=[];for(let h of T){if(h.startsWith("declared:")||St(h)||Ai(h)||Ns(h))continue;let O=v(h),P={key:h,agents:O.map(B=>B.id),sources:S(h)};O.every(B=>B.role==="orchestrator")?E.push(P):O.length===1&&Oe.push(P)}let A=(h,O)=>Object.keys(h.facts).some(P=>Qe(P,O)),I=t.rules.map(h=>({rule:h,agents:(h.role?k(h.role):y).filter(O=>(h.when??[]).every(P=>A(O,P))).filter(O=>h.has!==void 0&&!A(O,h.has)||h.not!==void 0&&A(O,h.not)).map(O=>O.id)})).filter(h=>h.agents.length),Y=y.some(h=>h.role==="orchestrator"),G=new Set(l.map(h=>h.agent)),w=y.flatMap(h=>Object.keys(h.facts).filter(Ns).sort().map(O=>{let[P,B,...ee]=O.split(":");return{agent:h.id,key:O,how:P,what:B,name:ee.join(":"),sources:h.facts[O]}}));return{...t.name??n.name?{name:t.name??n.name}:{},roles:i,unmatched:o,agents:y,patterns:C,offPattern:fe,solos:Oe,orchestratorDoes:E,gaps:I,conflicts:c,unknown:e.flatMap(h=>h.unknown.map(O=>({...O,agent:h.id}))),names:Object.assign({},...e.map(h=>h.names??{}),...e.map(h=>h.schemaName&&h.displayName?{[h.schemaName]:h.displayName}:{}),...f.families.map(h=>({[`text:block:${h.id}`]:h.official??h.label})),...t.markers.map(h=>({[`text:${h.id}`]:h.name}))),types:q,typeNames:Object.fromEntries(t.types.map(h=>[h.id,h.name])),typeNotes:$,blocks:f.families,markerFindings:Jl(g.values,t.markers,i),contract:{routes:l,missing:l.filter(h=>!h.agent),uncalled:Y?y.filter(h=>h.role==="specialist"&&!G.has(h.id)).map(h=>h.id):[],short:l.filter(h=>h.description&&h.description.length<Il)},flows:e.flatMap(h=>(h.flows??[]).map(O=>({...O,agent:h.id}))),unused:w,telemetry:{events:L,spellings:L.filter(h=>h.as!==h.form),notFired:s?L.filter(h=>h.fired===0&&s.rows.some(O=>O.agent===h.agent)):[],silent:s?e.map(h=>h.id).filter(h=>!s.rows.some(O=>O.agent===h)):[],...s?{days:s.days,file:s.file}:{}}}}var pm={specialist:{en:["specialist","specialists"],pt:["especialista","especialistas"]},orchestrator:{en:["orchestrator","orchestrators"],pt:["orquestrador","orquestradores"]}},Ee=(e,t,n)=>pm[e][t][n===1?0:1],Es={en:{summary:"Summary",matrix:"Matrix",patterns:"Patterns",text:"Text",off:"Off pattern",gaps:"Gaps",conflicts:"Conflicts",agents:"Cast",evidence:"Evidence",declared:"Declared",unknown:"Not understood",routing:"Routing",unused:"Unused",telemetry:"Telemetry",written:"As written",form:"Form",fields:"Fields",fired:e=>`Fired (${e} days)`,notRead:"not read",caller:"Caller",called:"Called",history:"History",inputs:"Inputs",routingText:"Routing description",chars:"Characters",notInFolder:"not in the folder",what:"What",how:"How",thing:{topic:"topic",action:"tool",variable:"variable",flow:"flow",node:"node",knowledge:"knowledge source"},orphan:"nobody uses it",disabled:"switched off",dimension:"Dimension",fact:"Fact",key:"Key",agent:"Who",name:"Name",role:"Role",scope:"Scope",share:"Share",have:"Who has it",lack:"Who lacks it",decision:"Decision",why:"Why",missing:"Missing",accepted:"Accepted pattern",rule:"Rule",says:"Says",notMet:"Who does not meet it",value:"Value",source:"Source",inYaml:"In the YAML",file:"File",line:"Line",facts:"Facts",alone:"Only it has",children:"Children",kind:"Kind",types:"Types",id:"Id",label:"Label",body:"Text",variant:"Variation",official:"Official",type:"type",yes:"yes",no:"no",accept:"accepted",reject:"rejected",platform:"platform",specialist:"specialist",orchestrator:"orchestrator",staff:"Staff",pdi:"Development plan",situation_:"Situation",manager:"Manager",teamCol:"Team",ownerCol:"Owner",hired:"Hired",publishedCol:"Published",items:"Plan items",item:"Item",group:"Group",situation:{hiring:"being hired",noOwner:"no owner",neverPublished:"never published",noEval:"no evaluation",pdi:"in a plan",ok:"in good standing"},pdiGroup:{contradictions:"contradiction",contract:"contract",off:"off pattern",rules:"rule",text:"text",telemetry:"telemetry",cleanup:"cleanup"},title:"The cast, compared",look:"To look at",nothing:"Nothing to look at",privacy:"This file holds the client\u2019s data: keep it in the client\u2019s environment.",count:{agents:"In the cast",orchestrators:"Orchestrators",specialists:"Specialists",patterns:"Patterns",off:"Off a pattern",gaps:"Rules not met",conflicts:"Conflicts",solos:"Only one has it",unused:"Unused or switched off"},why_:{yaml:"YAML that does not read",empty:"empty",kind:"a kind Copilot Studio does not have",file:"not a Copilot Studio file",json:"JSON that does not read",flow:"a flow in a shape the analysis does not know",telemetry:"a telemetry event whose name is a formula"}},pt:{summary:"Resumo",matrix:"Matriz",patterns:"Padr\xF5es",text:"Texto",off:"Fora do padr\xE3o",gaps:"Lacunas",conflicts:"Conflitos",agents:"Elenco",evidence:"Evid\xEAncias",declared:"Declarado",unknown:"N\xE3o entendeu",routing:"Roteamento",unused:"Sem uso",telemetry:"Telemetria",written:"Como est\xE1 escrito",form:"Forma",fields:"Campos",fired:e=>`Disparou (${e} dias)`,notRead:"n\xE3o lido",caller:"Quem chama",called:"Chamado",history:"Hist\xF3rico",inputs:"Entradas",routingText:"Descri\xE7\xE3o de roteamento",chars:"Caracteres",notInFolder:"n\xE3o est\xE1 na pasta",what:"O qu\xEA",how:"Como",thing:{topic:"t\xF3pico",action:"ferramenta",variable:"vari\xE1vel",flow:"fluxo",node:"n\xF3",knowledge:"fonte de conhecimento"},orphan:"ningu\xE9m usa",disabled:"desligado",dimension:"Dimens\xE3o",fact:"Fato",key:"Chave",agent:"Quem",name:"Nome",role:"Papel",scope:"Escopo",share:"Quantos",have:"Quem tem",lack:"Quem falta",decision:"Decis\xE3o",why:"Por qu\xEA",missing:"Falta",accepted:"Padr\xE3o aceito",rule:"Regra",says:"Diz",notMet:"Quem n\xE3o cumpre",value:"Valor",source:"Fonte",inYaml:"No YAML",file:"Arquivo",line:"Linha",facts:"Fatos",alone:"S\xF3 ele tem",children:"Filhos",kind:"Kind",types:"Tipos",id:"Id",label:"R\xF3tulo",body:"Texto",variant:"Varia\xE7\xE3o",official:"Oficial",type:"tipo",yes:"sim",no:"n\xE3o",accept:"aceito",reject:"rejeitado",platform:"plataforma",specialist:"especialista",orchestrator:"orquestrador",staff:"Quadro de pessoal",pdi:"PDI",situation_:"Situa\xE7\xE3o",manager:"Gestor",teamCol:"Equipe",ownerCol:"Respons\xE1vel",hired:"Admiss\xE3o",publishedCol:"Publica\xE7\xE3o",items:"Itens de PDI",item:"Item",group:"Grupo",situation:{hiring:"em admiss\xE3o",noOwner:"sem respons\xE1vel",neverPublished:"nunca publicado",noEval:"sem avalia\xE7\xE3o",pdi:"em PDI",ok:"em dia"},pdiGroup:{contradictions:"contradi\xE7\xE3o",contract:"contrato",off:"fora do padr\xE3o",rules:"regra",text:"texto",telemetry:"telemetria",cleanup:"limpeza"},title:"Elenco comparado",look:"Para olhar",nothing:"Nada para olhar",privacy:"Este arquivo tem dados do cliente: deixe-o no ambiente dele.",count:{agents:"No elenco",orchestrators:"Orquestradores",specialists:"Especialistas",patterns:"Padr\xF5es",off:"Fora do padr\xE3o",gaps:"Regras n\xE3o cumpridas",conflicts:"Conflitos",solos:"S\xF3 um tem",unused:"Sem uso ou desligado"},why_:{yaml:"YAML que n\xE3o se l\xEA",empty:"vazio",kind:"um kind que o Copilot Studio n\xE3o tem",file:"n\xE3o \xE9 arquivo do Copilot Studio",json:"JSON que n\xE3o se l\xEA",flow:"um fluxo num formato que a an\xE1lise n\xE3o conhece",telemetry:"um evento de telemetria com o nome em f\xF3rmula"}}};var _e=e=>e.join(", "),Xl=[{key:"contradictions",en:"Contradictions",pt:"Contradi\xE7\xF5es",keys:["conflict","contradiction"]},{key:"contract",en:"Contract and telemetry",pt:"Contrato e telemetria",keys:["spelling","contract","flow","telemetry"]},{key:"off",en:"Off pattern",pt:"Fora do padr\xE3o",keys:["off","values","twice","type"]},{key:"rules",en:"Rules",pt:"Regras",keys:["gap"]},{key:"solo",en:"Only one has it",pt:"S\xF3 um tem",keys:["solo"],folded:!0},{key:"unused",en:"Unused",pt:"Sem uso",keys:["unused"],folded:!0},{key:"unknown",en:"Not understood",pt:"N\xE3o entendeu",keys:["unknown","unmatched"]}],Gl=Xl.flatMap(e=>e.keys);function Ni(e){return Xl.map(t=>({key:t.key,en:t.en,pt:t.pt,folded:!!t.folded,looks:e.flatMap((n,s)=>t.keys.includes(n.key)?[{look:n,at:s}]:[])})).filter(t=>t.looks.length)}var Hl=e=>e.replace(/(\.topic)?\.mcs\.ya?ml$/,"");function hm(e){let t=[],n=(l,p)=>re(l,p,e.names);for(let l of e.conflicts){let p=l.source?`\xAB${l.source}\xBB`:null,[d,m]=[n(l.key,"en"),n(l.key,"pt")];t.push(l.observed?{key:"conflict",agents:[l.agent],fact:l.key,en:`${l.agent}: ${p??"what was declared"} says it does not have \xAB${d}\xBB, but the YAML has it`,pt:`${l.agent}: ${p??"o declarado"} diz que n\xE3o tem \xAB${m}\xBB, mas o YAML tem`}:{key:"conflict",agents:[l.agent],fact:l.key,en:`${l.agent}: ${p??"what was declared"} says it has \xAB${d}\xBB, but the YAML does not`,pt:`${l.agent}: ${p??"o declarado"} diz que tem \xAB${m}\xBB, mas o YAML n\xE3o tem`})}let s=(l,p)=>Object.keys(e.agents.find(d=>d.id===l)?.facts??{}).filter(d=>Qe(d,p));for(let l of e.gaps.filter(p=>p.rule.not&&!p.rule.has))for(let p of[...l.agents].sort()){let d=s(p,l.rule.not)[0]??l.rule.not,m=(l.rule.when??[]).map(k=>s(p,k)[0]??k),y=k=>m.length?`\xAB${m.map(v=>n(v,k)).join(k==="pt"?"\xBB e \xAB":"\xBB and \xAB")}\xBB, ${k==="pt"?"mas tamb\xE9m":"but also"} \xAB${n(d,k)}\xBB`:`\xAB${n(d,k)}\xBB`;t.push({key:"contradiction",agents:[p],fact:d,en:`${p} has ${y("en")} (rule \xAB${l.rule.says}\xBB)`,pt:`${p} tem ${y("pt")} (regra \xAB${l.rule.says}\xBB)`})}for(let l of e.contract.missing)t.push({key:"contract",agents:[l.caller],fact:`calls:${l.calls}`,en:`The orchestrator calls \xAB${l.name??l.calls}\xBB, which is not in the folder`,pt:`O orquestrador chama \xAB${l.name??l.calls}\xBB, que n\xE3o est\xE1 na pasta`});for(let l of e.contract.uncalled)t.push({key:"contract",agents:[l],en:`${l} is in the folder, but no orchestrator calls it`,pt:`${l} est\xE1 na pasta, mas nenhum orquestrador o chama`});for(let l of e.contract.short){let p=l.description.length;t.push({key:"contract",agents:[l.agent],fact:"routing:described",en:`The routing description of ${l.agent} has only ${p} characters`,pt:`A descri\xE7\xE3o de roteamento de ${l.agent} tem s\xF3 ${p} caracteres`})}for(let l of e.flows.filter(p=>p.called&&!p.returns))t.push({key:"flow",agents:[l.agent],fact:"flow-returns",en:`The flow \xAB${l.name}\xBB of ${l.agent} returns nothing`,pt:`O fluxo \xAB${l.name}\xBB de ${l.agent} n\xE3o devolve nada`});let r=new Map;for(let l of e.telemetry.spellings)r.set(`${l.agent} ${l.form}`,l);for(let l of r.values())t.push({key:"spelling",agents:[l.agent],fact:`telemetry:event:${l.as}`,en:`${l.agent} logs \xAB${l.name}\xBB; the others, \xAB${$e(l.as,"en")}\xBB: the same event?`,pt:`${l.agent} registra \xAB${l.name}\xBB; os outros, \xAB${$e(l.as,"pt")}\xBB: \xE9 o mesmo evento?`});let i=e.telemetry.days;for(let l of e.telemetry.notFired)t.push({key:"telemetry",agents:[l.agent],fact:`telemetry:event:${l.as}`,en:`The event \xAB${l.name}\xBB of ${l.agent} did not fire in ${i} days`,pt:`O evento \xAB${l.name}\xBB de ${l.agent} n\xE3o disparou em ${i} dias`});for(let l of e.telemetry.silent)t.push({key:"telemetry",agents:[l],en:`${l} has no line in the telemetry: is it connected to Application Insights?`,pt:`${l} n\xE3o tem nenhuma linha na telemetria: est\xE1 ligado ao Application Insights?`});let o=l=>l.startsWith("type:")?e.typeNames[l.slice(5)]??l.slice(5):void 0,a=new Map;for(let l of e.offPattern){let p=e.roles[l.agent],d=`${l.key} ${p} ${l.scope} ${l.variant?"v":""}`,m=a.get(d)??{key:l.key,role:p,type:o(l.scope),variant:!!l.variant,agents:[]};m.agents.push(l.agent),a.set(d,m)}for(let l of a.values()){let p=l.agents.length,d=e.patterns.find(S=>S.key===l.key),m=d?.decision?.status==="accepted",y=S=>l.type?S==="pt"?`${p} ${Ee(l.role,S,p)} de ${l.type}`:`${p} ${l.type} ${Ee(l.role,S,p)}`:`${p} ${Ee(l.role,S,p)}`,k=!!d?.official;if(l.variant){let S=T=>T==="pt"?`do bloco${k?" oficial":""} \xAB${n(l.key,T)}\xBB`:`of the${k?" official":""} block \xAB${n(l.key,T)}\xBB`;t.push({key:"off",agents:l.agents,fact:l.key,en:`${y("en")} ${p===1?"has":"have"} a variation ${S("en")} (${_e(l.agents)}): align it?`,pt:`${y("pt")} ${p===1?"tem":"t\xEAm"} uma varia\xE7\xE3o ${S("pt")} (${_e(l.agents)}): alinhar?`});continue}let v=S=>`${y(S)} ${Ss(l.key,S,p,e.names)} (${_e(l.agents)})`;t.push({key:"off",agents:l.agents,fact:l.key,en:m?`${v("en")}, and the pattern was accepted: correct it?`:k?`${v("en")}: add it?`:`${v("en")}: on purpose?`,pt:m?`${v("pt")}, e o padr\xE3o foi aceito: corrigir?`:k?`${v("pt")}: incluir?`:`${v("pt")}: \xE9 intencional?`})}for(let l of e.gaps.filter(p=>p.rule.has)){let p=l.agents.filter(m=>!e.offPattern.some(y=>y.agent===m&&y.key===l.rule.has)).sort(),d=p.length;d&&t.push({key:"gap",agents:p,fact:l.rule.has,en:`Rule \xAB${l.rule.says}\xBB: ${d}${l.rule.role?` ${Ee(l.rule.role,"en",d)}`:""} ${d===1?"does":"do"} not meet it (${_e(p)})`,pt:`Regra \xAB${l.rule.says}\xBB: ${d}${l.rule.role?` ${Ee(l.rule.role,"pt",d)}`:""} n\xE3o ${d===1?"cumpre":"cumprem"} (${_e(p)})`})}for(let l of e.markerFindings)if(l.kind==="values"){let p=[...new Set(Object.values(l.byValue).flat())],d=p.length,m=Object.entries(l.byValue).sort(([k,v],[S,T])=>T.length-v.length||k.localeCompare(S)).map(([k,v])=>`${k} {in} ${v.length}`),y=Object.keys(l.byValue).length;t.push({key:"values",agents:p.sort(),fact:`text:${l.marker.id}`,en:`${d} ${Ee(l.role,"en",d)} set \xAB${l.marker.name}\xBB in ${y} ways (${m.join("; ").replace(/\{in\}/g,"in")}): unify?`,pt:`${d} ${Ee(l.role,"pt",d)} definem \xAB${l.marker.name}\xBB de ${y} jeitos (${m.join("; ").replace(/\{in\}/g,"em")}): unificar?`})}else t.push({key:"twice",agents:[l.agent],fact:`text:${l.marker.id}`,en:`${l.agent} sets \xAB${l.marker.name}\xBB ${l.values.length===2?"twice":`${l.values.length} times`} (${l.values.join("; ")}): which one holds?`,pt:`${l.agent} define \xAB${l.marker.name}\xBB ${l.values.length===2?"duas vezes":`${l.values.length} vezes`} (${l.values.join("; ")}): qual vale?`});let c=new Set(e.solos.filter(l=>/^(connector|mcp):/.test(l.key)).map(l=>`${l.agents[0]} ${l.key.slice(l.key.indexOf(":")+1)}`)),f=e.gaps.filter(l=>l.rule.not).flatMap(l=>l.agents.map(p=>({agent:p,keys:[...l.rule.when??[],l.rule.not]})));for(let l of e.solos){let p=l.agents[0],d=l.key.startsWith("connref:")?l.key.slice(8):l.key.startsWith("operation:")?l.key.slice(10).split("/")[0]:void 0;d&&c.has(`${p} ${d}`)||f.some(m=>m.agent===p&&m.keys.some(y=>Qe(l.key,y)))||t.push({key:"solo",agents:[p],fact:l.key,en:`Only ${p} has \xAB${n(l.key,"en")}\xBB: innovation or debt?`,pt:`S\xF3 ${p} tem \xAB${n(l.key,"pt")}\xBB: inova\xE7\xE3o ou d\xEDvida?`})}let g={topic:["the topic","o t\xF3pico"],action:["the tool","a ferramenta"],variable:["the variable","a vari\xE1vel"],flow:["the flow","o fluxo"],knowledge:["the knowledge source","a fonte de conhecimento"]};for(let l of e.unused){let[p,d]=g[l.what]??["",""],m=e.names[l.name]??l.name;if(l.how==="orphan"){let y=l.what==="variable"?["remove it?","remover?"]:["remove it or switch it on?","remover ou ligar?"],k=l.what==="variable"?["uses","usa"]:l.what==="action"?["can choose","pode escolher"]:["calls","chama"];t.push({key:"unused",agents:[l.agent],fact:l.key,en:`Nobody ${k[0]} ${p} \xAB${m}\xBB (${l.agent}): ${y[0]}`,pt:`Ningu\xE9m ${k[1]} ${d} \xAB${m}\xBB (${l.agent}): ${y[1]}`})}else if(l.what==="node")for(let y of[...new Set(l.sources.map(k=>k.file))])t.push({key:"unused",agents:[l.agent],fact:l.key,en:`${l.agent} has a switched-off node in \xAB${Hl(y)}\xBB (${l.name}): remove it?`,pt:`${l.agent} tem um n\xF3 desligado em \xAB${Hl(y)}\xBB (${l.name}): remover?`});else t.push({key:"unused",agents:[l.agent],fact:l.key,en:`${l.agent} has ${p||l.what} \xAB${m}\xBB switched off: remove it?`,pt:`${l.agent} tem ${d||l.what} \xAB${m}\xBB ${d.startsWith("a ")?"desligada":"desligado"}: remover?`})}for(let l of e.typeNotes){let p=e.typeNames[l.type]??l.type,d=l.agents.length;t.push({key:"type",agents:l.agents,en:`The type \xAB${p}\xBB has ${d} ${Ee("specialist","en",d)} (${_e(l.agents)}): nothing to compare in it`,pt:`O tipo \xAB${p}\xBB tem ${d} ${Ee("specialist","pt",d)} (${_e(l.agents)}): nada a comparar dentro dele`})}let u=new Map;for(let l of e.unknown)u.set(l.agent,[...u.get(l.agent)??[],l.file]);for(let[l,p]of u){let d=p.length;t.push({key:"unknown",agents:[l],en:`${l}: the analysis did not understand ${d} ${d===1?"file":"files"} (${_e(p)})`,pt:`${l}: a an\xE1lise n\xE3o entendeu ${d} ${d===1?"arquivo":"arquivos"} (${_e(p)})`})}for(let l of e.unmatched)t.push({key:"unmatched",agents:[],en:`The profile names \xAB${l}\xBB, which is not in the folder`,pt:`O perfil cita \xAB${l}\xBB, que n\xE3o est\xE1 na pasta`});return t.sort((l,p)=>Gl.indexOf(l.key)-Gl.indexOf(p.key))}function ot(e){let t=r=>e.offPattern.some(i=>i.key===r.key||i.partOf===r.key),n=r=>r.share===1&&!r.decision&&!t(r),s=e.patterns.filter(r=>!r.partOf);return{look:s.filter(r=>!n(r)),everyone:s.filter(n)}}var Ql=new TextEncoder,Ei=e=>e.replace(/[&<>"]/g,t=>({"&":"&","<":"<",">":">",'"':"""})[t]).replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g,""),un=e=>e<26?String.fromCharCode(65+e):un(Math.floor(e/26)-1)+String.fromCharCode(65+e%26),mm=e=>e.replace(/[:\\/?*[\]]/g," ").slice(0,31)||"Sheet";function gm(e){let t=[{}],n=l=>JSON.stringify([l.bold??!1,l.fill??"",l.color??"",l.center??!1,l.wrap??!1]),s=new Map([[n({}),0]]);for(let l of e)for(let p of l.rows)for(let d of p){if(typeof d!="object")continue;let{v:m,...y}=d,k=n(y);s.has(k)||(s.set(k,t.length),t.push(y))}let r=new Map([["|",0]]),i=new Map([["",0]]),o=l=>{let p=`${l.bold?"b":""}|${l.color??""}`;return r.has(p)||r.set(p,r.size),r.get(p)},a=l=>l.fill?(i.has(l.fill)||i.set(l.fill,i.size+1),i.get(l.fill)):0,c=t.map(l=>{let p=l.center||l.wrap?`<alignment${l.center?' horizontal="center"':""}${l.wrap?' wrapText="1"':""} vertical="top"/>`:'<alignment vertical="top"/>';return`<xf numFmtId="0" fontId="${o(l)}" fillId="${a(l)}" borderId="${l.fill||l.bold?1:0}" xfId="0" applyFont="1" applyFill="1" applyBorder="1" applyAlignment="1">${p}</xf>`}),f=[...r.keys()].map(l=>{let[p,d]=l.split("|");return`<font>${p?"<b/>":""}<sz val="11"/>${d?`<color rgb="FF${d}"/>`:""}<name val="Calibri"/><family val="2"/></font>`}),g=['<fill><patternFill patternType="none"/></fill>','<fill><patternFill patternType="gray125"/></fill>',...[...i.keys()].filter(Boolean).map(l=>`<fill><patternFill patternType="solid"><fgColor rgb="FF${l}"/><bgColor indexed="64"/></patternFill></fill>`)];return{xml:`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
144
|
+
`).trim(),c=Ai(a,e.file,e.line+s,t);c.words.length>=em&&n.push(c),s=-1};return r.forEach((o,a)=>{o.trim()?s<0&&(s=a):i(a)}),i(r.length),n}var rm=(e,t)=>{let n=e.filter(r=>!r.startsWith("#")).slice(0,5).join("-")||"block",s=n;for(let r=2;t.has(s);r++)s=`${n}-${r}`;return t.add(s),s},Yl=e=>{let t=e.split(/\s+/).filter(Boolean);return t.slice(0,8).join(" ")+(t.length>8?"\u2026":"")};function Vl(e,t,n){let s=e.flatMap(u=>u.texts.flatMap(l=>sm(l,u.id))),r=[];for(let u of s){let l=r.find(p=>Ns(p[0].shingles,u.shingles)>=Si);l?l.push(u):r.push([u])}let i=n.map(u=>({...u,block:Ai(u.text,"profile",0)})),o=t.map(u=>({...u,block:Ai(u.text,"cast",0)})),a=new Set([...n.map(u=>u.id),...t.map(u=>u.id)]),c=[],f=new Set;for(let u of r){let l=i.find(v=>!f.has(v.id)&&Ns(v.block.shingles,u[0].shingles)>=Si);if(new Set(u.map(v=>v.agent)).size<2&&!l)continue;let p=v=>u.filter(S=>Wl(S.shingles,v.shingles)>=Ul).length,d=l?.block??u.reduce((v,S)=>p(S)>p(v)?S:v,u[0]),m=l?void 0:o.find(v=>!f.has(v.id)&&Ns(v.block.shingles,d.shingles)>=Si),y=l?.id??m?.id??rm(d.words,a);f.add(y);let k={id:y,label:Yl(d.text),text:d.text,...l?{official:l.name}:{},holders:{},variants:{}};for(let v of u){let S=v.agent,T=Wl(d.shingles,v.shingles)>=Ul?1:Ns(d.shingles,v.shingles);T===1?(k.holders[S]??={file:v.file,line:v.line},delete k.variants[S]):!k.holders[S]&&(!k.variants[S]||T>k.variants[S].similarity)&&(k.variants[S]={source:{file:v.file,line:v.line},similarity:T,text:v.text,diff:Kl(d.text,v.text)})}c.push(k)}for(let u of i.filter(l=>!f.has(l.id)))c.push({id:u.id,label:Yl(u.text),text:u.text,official:u.name,holders:{},variants:{}});let g=Object.fromEntries(e.map(u=>[u.id,{}]));for(let u of c){for(let[l,p]of Object.entries(u.holders))g[l][`text:block:${u.id}`]=[p];for(let[l,p]of Object.entries(u.variants))g[l][`text:block:${u.id}~variant`]=[p.source]}return{families:c,facts:g}}var im=/https?:\/\/([^\s/)\]>"'«»]+)/gi,om=/[\w.+-]+@[\w-]+(\.[\w-]+)+/g,am=(e,t)=>e.line+(e.text.slice(0,t).match(/\n/g)?.length??0),lm=e=>e.toLowerCase().replace(/\s+/g," ").trim();function Jl(e,t){let n={},s={};for(let r of e){let i=n[r.id]={},o=s[r.id]={},a=(c,f,g)=>(i[c]??=[]).push({file:f.file,line:am(f,g)});for(let c of r.texts){for(let f of t.filter(g=>g.in==="all"||g.in===c.source))for(let g of c.text.matchAll(new RegExp(f.pattern,"gi"))){if(!f.value){a(`text:${f.id}`,c,g.index);continue}let u=lm(f.value.replace(/\$(\d)/g,(l,p)=>g[Number(p)]??""));u&&(a(`text:${f.id}=${u}`,c,g.index),(o[f.id]??=[]).includes(u)||o[f.id].push(u))}if(c.source==="instructions"){for(let f of c.text.matchAll(im))a(`text:link-domain:${f[1].toLowerCase().replace(/[.,;:]+$/,"")}`,c,f.index);for(let f of c.text.matchAll(om))a("text:email",c,f.index)}}for(let[c,f]of Object.entries(i))i[c]=f.filter((g,u)=>f.findIndex(l=>l.file===g.file&&l.line===g.line)===u)}return{facts:n,values:s}}function Gl(e,t,n){let s=[];for(let r of t.filter(i=>i.value)){for(let i of["specialist","orchestrator"]){let o={};for(let[a,c]of Object.entries(e))if(n[a]===i)for(let f of c[r.id]??[])(o[f]??=[]).push(a);Object.keys(o).length>1&&s.push({kind:"values",marker:r,role:i,byValue:o})}for(let[i,o]of Object.entries(e))(o[r.id]??[]).length>1&&s.push({kind:"twice",marker:r,agent:i,values:o[r.id]})}return s}var cm=/^(no|não|nao|false|off|0)$/i,fm=new Set(Ss.filter(e=>!e.sign).map(e=>`ms:${e.id}`)),um=e=>e.includes(":")&&!e.startsWith("declared:")&&!fm.has(e),dm=e=>e.startsWith("declared:")?e:`declared:${e}`,Ni=e=>e.endsWith("~variant"),Es=e=>/^(orphan|disabled):/.test(e);function pm(e){let t=new Map;for(let s of e)for(let r of s.telemetry??[]){let i=t.get(he(r.form))??new Map;t.set(he(r.form),i),i.set(r.form,(i.get(r.form)??new Set).add(s.id))}let n=new Map;for(let s of t.values()){let[r]=[...s].sort(([i,o],[a,c])=>c.size-o.size||i.localeCompare(a));for(let i of s.keys())n.set(i,r[0])}return n}function hm(e,t){if(e.startsWith("telemetry:event:"))return`telemetry:event:${t.get(e.slice(16))??e.slice(16)}`;if(e.startsWith("telemetry:field:")){let n=e.lastIndexOf("/"),s=e.slice(16,n);return`telemetry:field:${t.get(s)??s}${e.slice(n)}`}return e}function mm(e,t,n,s){let r=Object.fromEntries(n.agents.map(h=>[h.id,h.role])),{roles:i,unmatched:o}=_l(e,t,r),a=h=>t.ignore.includes(h)||!t.microsoftPatterns&&h.startsWith("ms:"),c=[],f=Vl(e,n.blocks,t.blocks),g=Jl(e,t.markers),u=new Map(e.filter(h=>h.schemaName).map(h=>[h.schemaName,h.id])),l=e.flatMap(h=>(h.contract??[]).map(O=>({...O,caller:h.id,...u.has(O.calls)?{agent:u.get(O.calls)}:{}}))),p={};for(let h of l.filter(O=>O.agent)){let O=p[h.agent]??={},q={file:`${h.caller}/${h.file}`,line:h.line},B=ee=>(O[ee]??=[]).push(q);h.history&&B("called-with:history");for(let ee of h.inputs)B(`called-with:input:${ee}`);h.description&&B("routing:described")}let d=pm(e),m=h=>{let O={};for(let[q,B]of Object.entries(h.facts))(O[hm(q,d)]??=[]).push(...B);return{...O,...f.facts[h.id],...g.facts[h.id],...p[h.id]}},y=e.map(h=>{let O=m(h),q=Object.fromEntries(Object.entries(O).filter(([B])=>!a(B)));for(let B of n.declared.filter(ee=>ee.agent===h.id)){let ee=!cm.test(B.value);if(um(B.key)){let ie=B.key in O;ee!==ie&&c.push({agent:h.id,key:B.key,declared:B.value||"yes",observed:ie,source:B.source})}else ee&&(q[dm(B.key)]??=[]).push({file:B.source?`declared: ${B.source}`:"declared"})}return{id:h.id,role:i[h.id],...h.schemaName?{schemaName:h.schemaName}:{},...h.displayName?{displayName:h.displayName}:{},facts:q,children:h.children}}),k=h=>y.filter(O=>O.role===h),v=(h,O=y)=>O.filter(q=>h in q.facts),S=(h,O=y)=>O.flatMap(q=>q.facts[h]??[]),T=[...new Set(y.flatMap(h=>Object.keys(h.facts)))].sort(),N=h=>n.decisions.find(O=>O.key===h),P=Bl(y,i,t,Object.fromEntries(n.agents.filter(h=>h.types?.length).map(h=>[h.id,h.types]))),M=h=>h==="platform"?y:h.startsWith("type:")?y.filter(O=>P[O.id]?.includes(h.slice(5))):k(h),C=[];for(let h of["specialist","orchestrator"]){let O=k(h);if(O.length<t.minAgents)continue;let q=k(h==="specialist"?"orchestrator":"specialist");for(let B of T){if(B.startsWith("declared:")||St(B)||Ni(B)||Es(B)||C.some(xt=>xt.key===B))continue;let ie=v(B,O).length/O.length;if(ie<t.threshold)continue;let U=q.length>0&&v(B,q).length/q.length>=(q.length>=t.minAgents?t.threshold:1),Ae=N(B);C.push({key:B,role:h,scope:Ae?.scope??(U?"platform":h),share:ie,agents:v(B).map(xt=>xt.id),sources:S(B),...Ae?{decision:Ae}:{}})}}let $=[];for(let h of t.types){let O=M(`type:${h.id}`);if(O.length){if(O.length<h.minAgents){$.push({type:h.id,agents:O.map(q=>q.id)});continue}for(let q of T){if(q.startsWith("declared:")||St(q)||Ni(q)||Es(q)||C.some(ie=>ie.key===q))continue;let B=v(q,O).length/O.length;if(B<t.threshold)continue;let ee=N(q);C.push({key:q,role:"specialist",scope:ee?.scope??`type:${h.id}`,share:B,agents:v(q).map(ie=>ie.id),sources:S(q),...ee?{decision:ee}:{}})}}}for(let h of t.blocks){let O=`text:block:${h.id}`,q=C.find(ie=>ie.key===O);if(q){q.official=h.name;continue}let B=k(h.role),ee=N(O);C.push({key:O,role:h.role,scope:ee?.scope??h.role,share:B.length?v(O,B).length/B.length:0,agents:v(O).map(ie=>ie.id),sources:S(O),official:h.name,...ee?{decision:ee}:{}})}for(let h of n.decisions.filter(O=>O.status==="accepted"&&!C.some(q=>q.key===O.key))){let O=M(h.scope),q=v(h.key,O);C.push({key:h.key,role:h.scope==="orchestrator"?"orchestrator":"specialist",scope:h.scope,share:O.length?q.length/O.length:0,agents:q.map(B=>B.id),sources:S(h.key),decision:h})}for(let h of T.filter(O=>St(O))){let O=C.find(ie=>ie.key===St(h));if(!O)continue;let q=M(O.scope).filter(ie=>O.key in ie.facts),B=q.length?v(h,q).length/q.length:0;if(B<t.threshold)continue;let ee=N(h)??O.decision;C.push({key:h,role:O.role,scope:O.scope,share:B,agents:v(h).map(ie=>ie.id),sources:S(h),partOf:O.key,...ee?{decision:ee}:{}})}C.sort((h,O)=>h.scope.localeCompare(O.scope)||h.key.localeCompare(O.key));let L=e.flatMap(h=>(h.telemetry??[]).map(O=>{let q=s?.rows.filter(B=>B.agent===h.id&&he(B.event)===he(O.name));return{...O,agent:h.id,as:d.get(O.form)??O.form,...s?{fired:q.reduce((B,ee)=>B+ee.count,0)}:{}}})),K=new Set(L.filter(h=>!h.fields).map(h=>`${h.agent} ${h.as}`)),J=(h,O)=>O.startsWith("telemetry:field:")&&K.has(`${h} ${O.slice(16,O.lastIndexOf("/"))}`),fe=C.filter(h=>h.decision?.status!=="rejected").flatMap(h=>M(h.scope).filter(O=>!(h.key in O.facts)&&(!h.partOf||h.partOf in O.facts)&&!J(O.id,h.key)).map(O=>({agent:O.id,key:h.key,scope:h.scope,...h.partOf?{partOf:h.partOf}:{},...`${h.key}~variant`in O.facts?{variant:!0}:{}}))).sort((h,O)=>h.agent.localeCompare(O.agent)||h.key.localeCompare(O.key)),Oe=[],E=[];for(let h of T){if(h.startsWith("declared:")||St(h)||Ni(h)||Es(h))continue;let O=v(h),q={key:h,agents:O.map(B=>B.id),sources:S(h)};O.every(B=>B.role==="orchestrator")?E.push(q):O.length===1&&Oe.push(q)}let A=(h,O)=>Object.keys(h.facts).some(q=>Qe(q,O)),I=t.rules.map(h=>({rule:h,agents:(h.role?k(h.role):y).filter(O=>(h.when??[]).every(q=>A(O,q))).filter(O=>h.has!==void 0&&!A(O,h.has)||h.not!==void 0&&A(O,h.not)).map(O=>O.id)})).filter(h=>h.agents.length),Y=y.some(h=>h.role==="orchestrator"),G=new Set(l.map(h=>h.agent)),w=y.flatMap(h=>Object.keys(h.facts).filter(Es).sort().map(O=>{let[q,B,...ee]=O.split(":");return{agent:h.id,key:O,how:q,what:B,name:ee.join(":"),sources:h.facts[O]}}));return{...t.name??n.name?{name:t.name??n.name}:{},roles:i,unmatched:o,agents:y,patterns:C,offPattern:fe,solos:Oe,orchestratorDoes:E,gaps:I,conflicts:c,unknown:e.flatMap(h=>h.unknown.map(O=>({...O,agent:h.id}))),names:Object.assign({},...e.map(h=>h.names??{}),...e.map(h=>h.schemaName&&h.displayName?{[h.schemaName]:h.displayName}:{}),...f.families.map(h=>({[`text:block:${h.id}`]:h.official??h.label})),...t.markers.map(h=>({[`text:${h.id}`]:h.name}))),types:P,typeNames:Object.fromEntries(t.types.map(h=>[h.id,h.name])),typeNotes:$,blocks:f.families,markerFindings:Gl(g.values,t.markers,i),contract:{routes:l,missing:l.filter(h=>!h.agent),uncalled:Y?y.filter(h=>h.role==="specialist"&&!G.has(h.id)).map(h=>h.id):[],short:l.filter(h=>h.description&&h.description.length<Il)},flows:e.flatMap(h=>(h.flows??[]).map(O=>({...O,agent:h.id}))),unused:w,telemetry:{events:L,spellings:L.filter(h=>h.as!==h.form),notFired:s?L.filter(h=>h.fired===0&&s.rows.some(O=>O.agent===h.agent)):[],silent:s?e.map(h=>h.id).filter(h=>!s.rows.some(O=>O.agent===h)):[],...s?{days:s.days,file:s.file}:{}}}}var gm={specialist:{en:["specialist","specialists"],pt:["especialista","especialistas"]},orchestrator:{en:["orchestrator","orchestrators"],pt:["orquestrador","orquestradores"]}},Ee=(e,t,n)=>gm[e][t][n===1?0:1],xs={en:{summary:"Summary",matrix:"Matrix",patterns:"Patterns",text:"Text",off:"Off pattern",gaps:"Gaps",conflicts:"Conflicts",agents:"Cast",evidence:"Evidence",declared:"Declared",unknown:"Not understood",routing:"Routing",unused:"Unused",telemetry:"Telemetry",written:"As written",form:"Form",fields:"Fields",fired:e=>`Fired (${e} days)`,notRead:"not read",caller:"Caller",called:"Called",history:"History",inputs:"Inputs",routingText:"Routing description",chars:"Characters",notInFolder:"not in the folder",what:"What",how:"How",thing:{topic:"topic",action:"tool",variable:"variable",flow:"flow",node:"node",knowledge:"knowledge source"},orphan:"nobody uses it",disabled:"switched off",dimension:"Dimension",fact:"Fact",key:"Key",agent:"Who",name:"Name",role:"Role",scope:"Scope",share:"Share",have:"Who has it",lack:"Who lacks it",decision:"Decision",why:"Why",missing:"Missing",accepted:"Accepted pattern",rule:"Rule",says:"Says",notMet:"Who does not meet it",value:"Value",source:"Source",inYaml:"In the YAML",file:"File",line:"Line",facts:"Facts",alone:"Only it has",children:"Children",kind:"Kind",types:"Types",id:"Id",label:"Label",body:"Text",variant:"Variation",official:"Official",type:"type",yes:"yes",no:"no",accept:"accepted",reject:"rejected",platform:"platform",specialist:"specialist",orchestrator:"orchestrator",staff:"Staff",pdi:"Development plan",situation_:"Situation",manager:"Manager",teamCol:"Team",ownerCol:"Owner",hired:"Hired",publishedCol:"Published",items:"Plan items",item:"Item",group:"Group",situation:{hiring:"being hired",noOwner:"no owner",neverPublished:"never published",noEval:"no evaluation",pdi:"in a plan",ok:"in good standing"},pdiGroup:{contradictions:"contradiction",contract:"contract",off:"off pattern",rules:"rule",text:"text",telemetry:"telemetry",cleanup:"cleanup"},title:"The cast, compared",look:"To look at",nothing:"Nothing to look at",privacy:"This file holds the client\u2019s data: keep it in the client\u2019s environment.",count:{agents:"In the cast",orchestrators:"Orchestrators",specialists:"Specialists",patterns:"Patterns",off:"Off a pattern",gaps:"Rules not met",conflicts:"Conflicts",solos:"Only one has it",unused:"Unused or switched off"},why_:{yaml:"YAML that does not read",empty:"empty",kind:"a kind Copilot Studio does not have",file:"not a Copilot Studio file",json:"JSON that does not read",flow:"a flow in a shape the analysis does not know",telemetry:"a telemetry event whose name is a formula"}},pt:{summary:"Resumo",matrix:"Matriz",patterns:"Padr\xF5es",text:"Texto",off:"Fora do padr\xE3o",gaps:"Lacunas",conflicts:"Conflitos",agents:"Elenco",evidence:"Evid\xEAncias",declared:"Declarado",unknown:"N\xE3o entendeu",routing:"Roteamento",unused:"Sem uso",telemetry:"Telemetria",written:"Como est\xE1 escrito",form:"Forma",fields:"Campos",fired:e=>`Disparou (${e} dias)`,notRead:"n\xE3o lido",caller:"Quem chama",called:"Chamado",history:"Hist\xF3rico",inputs:"Entradas",routingText:"Descri\xE7\xE3o de roteamento",chars:"Caracteres",notInFolder:"n\xE3o est\xE1 na pasta",what:"O qu\xEA",how:"Como",thing:{topic:"t\xF3pico",action:"ferramenta",variable:"vari\xE1vel",flow:"fluxo",node:"n\xF3",knowledge:"fonte de conhecimento"},orphan:"ningu\xE9m usa",disabled:"desligado",dimension:"Dimens\xE3o",fact:"Fato",key:"Chave",agent:"Quem",name:"Nome",role:"Papel",scope:"Escopo",share:"Quantos",have:"Quem tem",lack:"Quem falta",decision:"Decis\xE3o",why:"Por qu\xEA",missing:"Falta",accepted:"Padr\xE3o aceito",rule:"Regra",says:"Diz",notMet:"Quem n\xE3o cumpre",value:"Valor",source:"Fonte",inYaml:"No YAML",file:"Arquivo",line:"Linha",facts:"Fatos",alone:"S\xF3 ele tem",children:"Filhos",kind:"Kind",types:"Tipos",id:"Id",label:"R\xF3tulo",body:"Texto",variant:"Varia\xE7\xE3o",official:"Oficial",type:"tipo",yes:"sim",no:"n\xE3o",accept:"aceito",reject:"rejeitado",platform:"plataforma",specialist:"especialista",orchestrator:"orquestrador",staff:"Quadro de pessoal",pdi:"PDI",situation_:"Situa\xE7\xE3o",manager:"Gestor",teamCol:"Equipe",ownerCol:"Respons\xE1vel",hired:"Admiss\xE3o",publishedCol:"Publica\xE7\xE3o",items:"Itens de PDI",item:"Item",group:"Grupo",situation:{hiring:"em admiss\xE3o",noOwner:"sem respons\xE1vel",neverPublished:"nunca publicado",noEval:"sem avalia\xE7\xE3o",pdi:"em PDI",ok:"em dia"},pdiGroup:{contradictions:"contradi\xE7\xE3o",contract:"contrato",off:"fora do padr\xE3o",rules:"regra",text:"texto",telemetry:"telemetria",cleanup:"limpeza"},title:"Elenco comparado",look:"Para olhar",nothing:"Nada para olhar",privacy:"Este arquivo tem dados do cliente: deixe-o no ambiente dele.",count:{agents:"No elenco",orchestrators:"Orquestradores",specialists:"Especialistas",patterns:"Padr\xF5es",off:"Fora do padr\xE3o",gaps:"Regras n\xE3o cumpridas",conflicts:"Conflitos",solos:"S\xF3 um tem",unused:"Sem uso ou desligado"},why_:{yaml:"YAML que n\xE3o se l\xEA",empty:"vazio",kind:"um kind que o Copilot Studio n\xE3o tem",file:"n\xE3o \xE9 arquivo do Copilot Studio",json:"JSON que n\xE3o se l\xEA",flow:"um fluxo num formato que a an\xE1lise n\xE3o conhece",telemetry:"um evento de telemetria com o nome em f\xF3rmula"}}};var _e=e=>e.join(", "),Ql=[{key:"contradictions",en:"Contradictions",pt:"Contradi\xE7\xF5es",keys:["conflict","contradiction"]},{key:"contract",en:"Contract and telemetry",pt:"Contrato e telemetria",keys:["spelling","contract","flow","telemetry"]},{key:"off",en:"Off pattern",pt:"Fora do padr\xE3o",keys:["off","values","twice","type"]},{key:"rules",en:"Rules",pt:"Regras",keys:["gap"]},{key:"solo",en:"Only one has it",pt:"S\xF3 um tem",keys:["solo"],folded:!0},{key:"unused",en:"Unused",pt:"Sem uso",keys:["unused"],folded:!0},{key:"unknown",en:"Not understood",pt:"N\xE3o entendeu",keys:["unknown","unmatched"]}],Hl=Ql.flatMap(e=>e.keys);function Ei(e){return Ql.map(t=>({key:t.key,en:t.en,pt:t.pt,folded:!!t.folded,looks:e.flatMap((n,s)=>t.keys.includes(n.key)?[{look:n,at:s}]:[])})).filter(t=>t.looks.length)}var Xl=e=>e.replace(/(\.topic)?\.mcs\.ya?ml$/,"");function ym(e){let t=[],n=(l,p)=>ne(l,p,e.names);for(let l of e.conflicts){let p=l.source?`\xAB${l.source}\xBB`:null,[d,m]=[n(l.key,"en"),n(l.key,"pt")];t.push(l.observed?{key:"conflict",agents:[l.agent],fact:l.key,en:`${l.agent}: ${p??"what was declared"} says it does not have \xAB${d}\xBB, but the YAML has it`,pt:`${l.agent}: ${p??"o declarado"} diz que n\xE3o tem \xAB${m}\xBB, mas o YAML tem`}:{key:"conflict",agents:[l.agent],fact:l.key,en:`${l.agent}: ${p??"what was declared"} says it has \xAB${d}\xBB, but the YAML does not`,pt:`${l.agent}: ${p??"o declarado"} diz que tem \xAB${m}\xBB, mas o YAML n\xE3o tem`})}let s=(l,p)=>Object.keys(e.agents.find(d=>d.id===l)?.facts??{}).filter(d=>Qe(d,p));for(let l of e.gaps.filter(p=>p.rule.not&&!p.rule.has))for(let p of[...l.agents].sort()){let d=s(p,l.rule.not)[0]??l.rule.not,m=(l.rule.when??[]).map(k=>s(p,k)[0]??k),y=k=>m.length?`\xAB${m.map(v=>n(v,k)).join(k==="pt"?"\xBB e \xAB":"\xBB and \xAB")}\xBB, ${k==="pt"?"mas tamb\xE9m":"but also"} \xAB${n(d,k)}\xBB`:`\xAB${n(d,k)}\xBB`;t.push({key:"contradiction",agents:[p],fact:d,en:`${p} has ${y("en")} (rule \xAB${l.rule.says}\xBB)`,pt:`${p} tem ${y("pt")} (regra \xAB${l.rule.says}\xBB)`})}for(let l of e.contract.missing)t.push({key:"contract",agents:[l.caller],fact:`calls:${l.calls}`,en:`The orchestrator calls \xAB${l.name??l.calls}\xBB, which is not in the folder`,pt:`O orquestrador chama \xAB${l.name??l.calls}\xBB, que n\xE3o est\xE1 na pasta`});for(let l of e.contract.uncalled)t.push({key:"contract",agents:[l],en:`${l} is in the folder, but no orchestrator calls it`,pt:`${l} est\xE1 na pasta, mas nenhum orquestrador o chama`});for(let l of e.contract.short){let p=l.description.length;t.push({key:"contract",agents:[l.agent],fact:"routing:described",en:`The routing description of ${l.agent} has only ${p} characters`,pt:`A descri\xE7\xE3o de roteamento de ${l.agent} tem s\xF3 ${p} caracteres`})}for(let l of e.flows.filter(p=>p.called&&!p.returns))t.push({key:"flow",agents:[l.agent],fact:"flow-returns",en:`The flow \xAB${l.name}\xBB of ${l.agent} returns nothing`,pt:`O fluxo \xAB${l.name}\xBB de ${l.agent} n\xE3o devolve nada`});let r=new Map;for(let l of e.telemetry.spellings)r.set(`${l.agent} ${l.form}`,l);for(let l of r.values())t.push({key:"spelling",agents:[l.agent],fact:`telemetry:event:${l.as}`,en:`${l.agent} logs \xAB${l.name}\xBB; the others, \xAB${$e(l.as,"en")}\xBB: the same event?`,pt:`${l.agent} registra \xAB${l.name}\xBB; os outros, \xAB${$e(l.as,"pt")}\xBB: \xE9 o mesmo evento?`});let i=e.telemetry.days;for(let l of e.telemetry.notFired)t.push({key:"telemetry",agents:[l.agent],fact:`telemetry:event:${l.as}`,en:`The event \xAB${l.name}\xBB of ${l.agent} did not fire in ${i} days`,pt:`O evento \xAB${l.name}\xBB de ${l.agent} n\xE3o disparou em ${i} dias`});for(let l of e.telemetry.silent)t.push({key:"telemetry",agents:[l],en:`${l} has no line in the telemetry: is it connected to Application Insights?`,pt:`${l} n\xE3o tem nenhuma linha na telemetria: est\xE1 ligado ao Application Insights?`});let o=l=>l.startsWith("type:")?e.typeNames[l.slice(5)]??l.slice(5):void 0,a=new Map;for(let l of e.offPattern){let p=e.roles[l.agent],d=`${l.key} ${p} ${l.scope} ${l.variant?"v":""}`,m=a.get(d)??{key:l.key,role:p,type:o(l.scope),variant:!!l.variant,agents:[]};m.agents.push(l.agent),a.set(d,m)}for(let l of a.values()){let p=l.agents.length,d=e.patterns.find(S=>S.key===l.key),m=d?.decision?.status==="accepted",y=S=>l.type?S==="pt"?`${p} ${Ee(l.role,S,p)} de ${l.type}`:`${p} ${l.type} ${Ee(l.role,S,p)}`:`${p} ${Ee(l.role,S,p)}`,k=!!d?.official;if(l.variant){let S=T=>T==="pt"?`do bloco${k?" oficial":""} \xAB${n(l.key,T)}\xBB`:`of the${k?" official":""} block \xAB${n(l.key,T)}\xBB`;t.push({key:"off",agents:l.agents,fact:l.key,en:`${y("en")} ${p===1?"has":"have"} a variation ${S("en")} (${_e(l.agents)}): align it?`,pt:`${y("pt")} ${p===1?"tem":"t\xEAm"} uma varia\xE7\xE3o ${S("pt")} (${_e(l.agents)}): alinhar?`});continue}let v=S=>`${y(S)} ${Os(l.key,S,p,e.names)} (${_e(l.agents)})`;t.push({key:"off",agents:l.agents,fact:l.key,en:m?`${v("en")}, and the pattern was accepted: correct it?`:k?`${v("en")}: add it?`:`${v("en")}: on purpose?`,pt:m?`${v("pt")}, e o padr\xE3o foi aceito: corrigir?`:k?`${v("pt")}: incluir?`:`${v("pt")}: \xE9 intencional?`})}for(let l of e.gaps.filter(p=>p.rule.has)){let p=l.agents.filter(m=>!e.offPattern.some(y=>y.agent===m&&y.key===l.rule.has)).sort(),d=p.length;d&&t.push({key:"gap",agents:p,fact:l.rule.has,en:`Rule \xAB${l.rule.says}\xBB: ${d}${l.rule.role?` ${Ee(l.rule.role,"en",d)}`:""} ${d===1?"does":"do"} not meet it (${_e(p)})`,pt:`Regra \xAB${l.rule.says}\xBB: ${d}${l.rule.role?` ${Ee(l.rule.role,"pt",d)}`:""} n\xE3o ${d===1?"cumpre":"cumprem"} (${_e(p)})`})}for(let l of e.markerFindings)if(l.kind==="values"){let p=[...new Set(Object.values(l.byValue).flat())],d=p.length,m=Object.entries(l.byValue).sort(([k,v],[S,T])=>T.length-v.length||k.localeCompare(S)).map(([k,v])=>`${k} {in} ${v.length}`),y=Object.keys(l.byValue).length;t.push({key:"values",agents:p.sort(),fact:`text:${l.marker.id}`,en:`${d} ${Ee(l.role,"en",d)} set \xAB${l.marker.name}\xBB in ${y} ways (${m.join("; ").replace(/\{in\}/g,"in")}): unify?`,pt:`${d} ${Ee(l.role,"pt",d)} definem \xAB${l.marker.name}\xBB de ${y} jeitos (${m.join("; ").replace(/\{in\}/g,"em")}): unificar?`})}else t.push({key:"twice",agents:[l.agent],fact:`text:${l.marker.id}`,en:`${l.agent} sets \xAB${l.marker.name}\xBB ${l.values.length===2?"twice":`${l.values.length} times`} (${l.values.join("; ")}): which one holds?`,pt:`${l.agent} define \xAB${l.marker.name}\xBB ${l.values.length===2?"duas vezes":`${l.values.length} vezes`} (${l.values.join("; ")}): qual vale?`});let c=new Set(e.solos.filter(l=>/^(connector|mcp):/.test(l.key)).map(l=>`${l.agents[0]} ${l.key.slice(l.key.indexOf(":")+1)}`)),f=e.gaps.filter(l=>l.rule.not).flatMap(l=>l.agents.map(p=>({agent:p,keys:[...l.rule.when??[],l.rule.not]})));for(let l of e.solos){let p=l.agents[0],d=l.key.startsWith("connref:")?l.key.slice(8):l.key.startsWith("operation:")?l.key.slice(10).split("/")[0]:void 0;d&&c.has(`${p} ${d}`)||f.some(m=>m.agent===p&&m.keys.some(y=>Qe(l.key,y)))||t.push({key:"solo",agents:[p],fact:l.key,en:`Only ${p} has \xAB${n(l.key,"en")}\xBB: innovation or debt?`,pt:`S\xF3 ${p} tem \xAB${n(l.key,"pt")}\xBB: inova\xE7\xE3o ou d\xEDvida?`})}let g={topic:["the topic","o t\xF3pico"],action:["the tool","a ferramenta"],variable:["the variable","a vari\xE1vel"],flow:["the flow","o fluxo"],knowledge:["the knowledge source","a fonte de conhecimento"]};for(let l of e.unused){let[p,d]=g[l.what]??["",""],m=e.names[l.name]??l.name;if(l.how==="orphan"){let y=l.what==="variable"?["remove it?","remover?"]:["remove it or switch it on?","remover ou ligar?"],k=l.what==="variable"?["uses","usa"]:l.what==="action"?["can choose","pode escolher"]:["calls","chama"];t.push({key:"unused",agents:[l.agent],fact:l.key,en:`Nobody ${k[0]} ${p} \xAB${m}\xBB (${l.agent}): ${y[0]}`,pt:`Ningu\xE9m ${k[1]} ${d} \xAB${m}\xBB (${l.agent}): ${y[1]}`})}else if(l.what==="node")for(let y of[...new Set(l.sources.map(k=>k.file))])t.push({key:"unused",agents:[l.agent],fact:l.key,en:`${l.agent} has a switched-off node in \xAB${Xl(y)}\xBB (${l.name}): remove it?`,pt:`${l.agent} tem um n\xF3 desligado em \xAB${Xl(y)}\xBB (${l.name}): remover?`});else t.push({key:"unused",agents:[l.agent],fact:l.key,en:`${l.agent} has ${p||l.what} \xAB${m}\xBB switched off: remove it?`,pt:`${l.agent} tem ${d||l.what} \xAB${m}\xBB ${d.startsWith("a ")?"desligada":"desligado"}: remover?`})}for(let l of e.typeNotes){let p=e.typeNames[l.type]??l.type,d=l.agents.length;t.push({key:"type",agents:l.agents,en:`The type \xAB${p}\xBB has ${d} ${Ee("specialist","en",d)} (${_e(l.agents)}): nothing to compare in it`,pt:`O tipo \xAB${p}\xBB tem ${d} ${Ee("specialist","pt",d)} (${_e(l.agents)}): nada a comparar dentro dele`})}let u=new Map;for(let l of e.unknown)u.set(l.agent,[...u.get(l.agent)??[],l.file]);for(let[l,p]of u){let d=p.length;t.push({key:"unknown",agents:[l],en:`${l}: the analysis did not understand ${d} ${d===1?"file":"files"} (${_e(p)})`,pt:`${l}: a an\xE1lise n\xE3o entendeu ${d} ${d===1?"arquivo":"arquivos"} (${_e(p)})`})}for(let l of e.unmatched)t.push({key:"unmatched",agents:[],en:`The profile names \xAB${l}\xBB, which is not in the folder`,pt:`O perfil cita \xAB${l}\xBB, que n\xE3o est\xE1 na pasta`});return t.sort((l,p)=>Hl.indexOf(l.key)-Hl.indexOf(p.key))}function ot(e){let t=r=>e.offPattern.some(i=>i.key===r.key||i.partOf===r.key),n=r=>r.share===1&&!r.decision&&!t(r),s=e.patterns.filter(r=>!r.partOf);return{look:s.filter(r=>!n(r)),everyone:s.filter(n)}}var Zl=new TextEncoder,xi=e=>e.replace(/[&<>"]/g,t=>({"&":"&","<":"<",">":">",'"':"""})[t]).replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g,""),pn=e=>e<26?String.fromCharCode(65+e):pn(Math.floor(e/26)-1)+String.fromCharCode(65+e%26),bm=e=>e.replace(/[:\\/?*[\]]/g," ").slice(0,31)||"Sheet";function wm(e){let t=[{}],n=l=>JSON.stringify([l.bold??!1,l.fill??"",l.color??"",l.center??!1,l.wrap??!1]),s=new Map([[n({}),0]]);for(let l of e)for(let p of l.rows)for(let d of p){if(typeof d!="object")continue;let{v:m,...y}=d,k=n(y);s.has(k)||(s.set(k,t.length),t.push(y))}let r=new Map([["|",0]]),i=new Map([["",0]]),o=l=>{let p=`${l.bold?"b":""}|${l.color??""}`;return r.has(p)||r.set(p,r.size),r.get(p)},a=l=>l.fill?(i.has(l.fill)||i.set(l.fill,i.size+1),i.get(l.fill)):0,c=t.map(l=>{let p=l.center||l.wrap?`<alignment${l.center?' horizontal="center"':""}${l.wrap?' wrapText="1"':""} vertical="top"/>`:'<alignment vertical="top"/>';return`<xf numFmtId="0" fontId="${o(l)}" fillId="${a(l)}" borderId="${l.fill||l.bold?1:0}" xfId="0" applyFont="1" applyFill="1" applyBorder="1" applyAlignment="1">${p}</xf>`}),f=[...r.keys()].map(l=>{let[p,d]=l.split("|");return`<font>${p?"<b/>":""}<sz val="11"/>${d?`<color rgb="FF${d}"/>`:""}<name val="Calibri"/><family val="2"/></font>`}),g=['<fill><patternFill patternType="none"/></fill>','<fill><patternFill patternType="gray125"/></fill>',...[...i.keys()].filter(Boolean).map(l=>`<fill><patternFill patternType="solid"><fgColor rgb="FF${l}"/><bgColor indexed="64"/></patternFill></fill>`)];return{xml:`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
145
145
|
<styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
|
|
146
146
|
<fonts count="${f.length}">${f.join("")}</fonts>
|
|
147
147
|
<fills count="${g.length}">${g.join("")}</fills>
|
|
@@ -149,15 +149,15 @@ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.pus
|
|
|
149
149
|
<cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs>
|
|
150
150
|
<cellXfs count="${c.length}">${c.join("")}</cellXfs>
|
|
151
151
|
<cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles>
|
|
152
|
-
</styleSheet>`,styleOf:l=>typeof l=="object"?s.get(n((({v:p,...d})=>d)(l)))??0:0}}function
|
|
152
|
+
</styleSheet>`,styleOf:l=>typeof l=="object"?s.get(n((({v:p,...d})=>d)(l)))??0:0}}function km(e,t){let n=Math.max(e.columns.length,...e.rows.map(c=>c.length),1),s=e.rows.map((c,f)=>{let g=c.map((u,l)=>{let p=`${pn(l)}${f+1}`,d=typeof u=="object"?u.v:u,m=t(u),y=m?` s="${m}"`:"";return d===""||d===void 0||d===null?m?`<c r="${p}"${y}/>`:"":typeof d=="number"?`<c r="${p}"${y}><v>${d}</v></c>`:`<c r="${p}"${y} t="inlineStr"><is><t xml:space="preserve">${xi(String(d))}</t></is></c>`}).join("");return`<row r="${f+1}">${g}</row>`}),r=`${pn(n-1)}${Math.max(1,e.rows.length)}`,i=e.header?'<pane ySplit="1" topLeftCell="A2" activePane="bottomLeft" state="frozen"/><selection pane="bottomLeft" activeCell="A2" sqref="A2"/>':"",o=e.columns.length?`<cols>${e.columns.map((c,f)=>`<col min="${f+1}" max="${f+1}" width="${c.width}" customWidth="1"/>`).join("")}</cols>`:"",a=e.header&&e.rows.length>1?`<autoFilter ref="A1:${pn(Math.max(0,e.columns.length-1))}${e.rows.length}"/>`:"";return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
153
153
|
<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
|
|
154
154
|
<dimension ref="A1:${r}"/><sheetViews><sheetView workbookViewId="0">${i}</sheetView></sheetViews><sheetFormatPr defaultRowHeight="15"/>${o}<sheetData>${s.join("")}</sheetData>${a}
|
|
155
|
-
</worksheet>`}function
|
|
155
|
+
</worksheet>`}function ec(e){let{xml:t,styleOf:n}=wm(e),s=e.map(o=>bm(o.name)),r=e.map((o,a)=>o.header&&o.rows.length>1?`<definedName name="_xlnm._FilterDatabase" localSheetId="${a}" hidden="1">'${xi(s[a]).replace(/'/g,"''")}'!$A$1:$${pn(Math.max(0,o.columns.length-1))}$${o.rows.length}</definedName>`:"").join(""),i=[["[Content_Types].xml",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
156
156
|
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/><Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"/>${e.map((o,a)=>`<Override PartName="/xl/worksheets/sheet${a+1}.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/>`).join("")}</Types>`],["_rels/.rels",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
157
157
|
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/></Relationships>`],["xl/workbook.xml",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
158
|
-
<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><bookViews><workbookView/></bookViews><sheets>${s.map((o,a)=>`<sheet name="${
|
|
159
|
-
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">${e.map((o,a)=>`<Relationship Id="rId${a+1}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet${a+1}.xml"/>`).join("")}<Relationship Id="rId${e.length+1}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/></Relationships>`],["xl/styles.xml",t],...e.map((o,a)=>[`xl/worksheets/sheet${a+1}.xml`,
|
|
160
|
-
`)[0].trim(),
|
|
161
|
-
`),n=t.findIndex(r=>/^\s*([-*•]|\d+[.)])\s+/.test(r));if(n<0)return[];let s=[];for(let r of t.slice(n)){let i=/^\s*(?:[-*•]|\d+[.)])\s+(.*)$/.exec(r);if(!i)break;s.push(i[1].trim())}return s.slice(0,5)};function Ti(e,t,n,s,r,i,o){let a=E=>e.agents.find(A=>A.id===E)?.displayName??E,c=(E,A)=>{let I=s.declared.find(Y=>Y.agent===E&&Y.key===A);return I&&{value:I.value,source:I.source}},f=s.declared.some(E=>Am.includes(E.key)),g=s.declared.some(E=>E.key==="team"||E.key==="kpi"),u=xi(e),l=[...Ts(t,e),...u.flatMap(E=>{let A=s.decisions.find(Y=>Y.key===E.key&&Y.status==="rejected"&&E.types.some(G=>Y.scope===`type:${G}`)),I=A?e.typeNames[A.scope.slice(5)]??A.scope.slice(5):"";return A?[{agent:E.agent,group:"cleanup",keys:[E.key],en:`Remove the access \xAB${re(E.key,"en",e.names)}\xBB`,pt:`Tirar o acesso \xAB${re(E.key,"pt",e.names)}\xBB`,why:{en:`The team decided the post \xAB${I}\xBB does not need it.`,pt:`O time decidiu que o cargo \xAB${I}\xBB n\xE3o precisa.`}}]:[]})],p=e.contract.missing.map(E=>({id:E.calls,name:E.name??E.calls,caller:E.caller})),d=e.agents.map(E=>c(E.id,"environment")?.value).filter(E=>!!E),m=[...new Set(d)].sort((E,A)=>d.filter(I=>I===A).length-d.filter(I=>I===E).length)[0],y=E=>{let A=[],I=c(E,"environment")?.value;return I&&m&&I!==m&&A.push("hiring"),f&&!c(E,"owner")&&A.push("noOwner"),f&&c(E,"created-on")&&!c(E,"last-published")&&A.push("neverPublished"),o&&!o.some(Y=>Y.agent===E)&&A.push("noEval"),A.push(l.some(Y=>Y.agent===E&&Y.group!=="cleanup")?"pdi":"ok"),A},k=E=>({id:E,name:a(E),situation:y(E)}),v=e.agents.map(E=>E.id),S=E=>E.map(A=>({id:A,name:a(A)})),T=p.map(E=>({id:E.id,name:E.name})),N=[{key:"cast",people:S(v)},{key:"hiring",people:[...T,...S(v.filter(E=>y(E).includes("hiring")))]},...f?[{key:"noOwner",people:S(v.filter(E=>y(E).includes("noOwner")))},{key:"neverPublished",people:S(v.filter(E=>y(E).includes("neverPublished")))}]:[],...o?[{key:"noEval",people:S(v.filter(E=>y(E).includes("noEval")))}]:[],{key:"pdi",people:S(v.filter(E=>y(E).includes("pdi")))},{key:"ok",people:S(v.filter(E=>y(E).includes("ok")))}],q=e.agents.filter(E=>E.role==="orchestrator").map(E=>k(E.id)),M=e.agents.filter(E=>E.role==="specialist"),C=[...new Set(M.flatMap(E=>e.types[E.id]??[]))],$=[...C.map(E=>({id:E,name:e.typeNames[E]??E,people:M.filter(A=>(e.types[A.id]??[]).includes(E)).map(A=>k(A.id))})),...M.some(E=>!(e.types[E.id]??[]).length)?[{id:"",name:"",people:M.filter(E=>!(e.types[E.id]??[]).length).map(E=>k(E.id))}]:[]],L=(E,A)=>({key:E,en:dn(E,"en",e.names),pt:dn(E,"pt",e.names),proposal:A}),K=(E,A,I)=>{let Y=e.patterns.filter(P=>!P.partOf&&(P.scope===E||E!=="platform"&&P.scope==="platform")),G=Y.filter(P=>P.decision?.status==="accepted"),w=new Set(e.offPattern.map(P=>P.key)),h=G.length?G.map(P=>L(P.key,!1)):Y.filter(P=>w.has(P.key)).map(P=>L(P.key,!0)),O=r.filter(P=>P.has&&(!P.role||P.role===I)&&!h.some(B=>B.key===P.has)).map(P=>L(P.has,!1));return{scope:E,name:A,requirements:[...h,...O]}},V=[K("specialist",{en:"Specialist",pt:"Especialista"},"specialist"),...C.map(E=>K(`type:${E}`,{en:`Specialist \xB7 ${e.typeNames[E]??E}`,pt:`Especialista \xB7 ${e.typeNames[E]??E}`},"specialist")),...q.length?[K("orchestrator",{en:"Orchestrator",pt:"Orquestrador"},"orchestrator")]:[]],fe=e.agents.map(E=>{let I=n.find(U=>U.id===E.id)?.texts.find(U=>U.source==="instructions")?.text??"",Y=Object.keys(E.facts),G=U=>({en:re(U,"en",e.names),pt:re(U,"pt",e.names)}),w=Y.filter(U=>/^(operation|mcp|flow-uses|knowledge):/.test(U)&&!U.startsWith("knowledge:count")).map(G),h=Y.filter(U=>U.startsWith("text:")&&!U.endsWith("~variant")).map(G),O=e.contract.routes.find(U=>U.agent===E.id)?.caller,P=e.telemetry.events.filter(U=>U.agent===E.id),B=i&&{days:i.days,starts:i.rows.filter(U=>U.agent===E.id&&U.event==="TopicStart").reduce((U,Ae)=>U+Ae.count,0),errors:P.reduce((U,Ae)=>U+(Ae.fired??0),0),notFired:e.telemetry.notFired.filter(U=>U.agent===E.id).map(U=>U.name),silent:e.telemetry.silent.includes(E.id)},ee=[...new Set(["YAML",...i?[i.file]:[],...(o??[]).filter(U=>U.agent===E.id).map(U=>U.file),...s.declared.filter(U=>U.agent===E.id).map(U=>U.source.split(" \u203A ")[0])])],ie=l.filter(U=>U.agent===E.id);return{id:E.id,name:a(E.id),role:E.role==="orchestrator"?"orchestrator":"specialist",types:(e.types[E.id]??[]).map(U=>e.typeNames[U]??U),...I?{title:Nm(I)}:{},...O?{manager:a(O)}:{},...c(E.id,"team")?{team:c(E.id,"team")}:{},...c(E.id,"owner")?{owner:c(E.id,"owner")}:{},...c(E.id,"created-on")?{created:c(E.id,"created-on")}:{},...c(E.id,"last-published")?{published:c(E.id,"last-published")}:{},...E.schemaName?{schemaName:E.schemaName}:{},...c(E.id,"environment")?{environment:c(E.id,"environment")}:{},summary:Em(I),tools:w,conduct:h,...c(E.id,"kpi")?{goal:c(E.id,"kpi")}:{},...B?{performance:B}:{},...o?{certifications:o.filter(U=>U.agent===E.id)}:{},access:u.filter(U=>U.agent===E.id),pdi:ie,sources:ee,seal:ie.some(U=>U.group!=="cleanup")?"pdi":"ok"}}),Oe=[...f?[]:["inventory"],...g?[]:["team"],...i?[]:["telemetry"]];return{...e.name?{name:e.name}:{},staff:N,missing:Oe,org:{orchestrators:q,types:$,ghosts:p},posts:V,resumes:fe}}var xm=e=>Zl(e),Tm={bold:!0,fill:"E8EEF7"},Cm={v:"\u25CF",fill:"DDF3E6",center:!0},qm={v:"\xD7",fill:"FFD5CC",center:!0,bold:!0},Pm={v:"\u25D0",fill:"FFF3C4",center:!0},Lm={v:"\u2248",fill:"FFF6DC",center:!0,bold:!0},tc=Object.keys(wi);function Mm(e,t,n,s="en"){let r=Es[s],i=(w,h,O)=>({key:w,name:r[w],header:!0,columns:h.map(([P,B])=>({title:P,width:B})),rows:[h.map(([P])=>({v:P,...Tm})),...O]}),o=w=>r[e.roles[w]],a=w=>w.startsWith("type:")?`${r.type}:${e.typeNames[w.slice(5)]??w.slice(5)}`:r[w],c=w=>(e.types[w]??[]).map(h=>e.typeNames[h]??h).join(" \xB7 "),f=w=>re(w,s,e.names),g=[...e.agents].sort((w,h)=>w.role===h.role?w.id.localeCompare(h.id):w.role==="orchestrator"?-1:1),u=[...new Set([...g.flatMap(w=>Object.keys(w.facts)),...e.patterns.map(w=>w.key)])].filter(w=>!w.endsWith("~variant")).sort((w,h)=>tc.indexOf(cn(w))-tc.indexOf(cn(h))||w.localeCompare(h)),l=new Set(e.offPattern.map(w=>`${w.agent} ${w.key}`)),p=w=>e.agents.filter(h=>h.role===w).length,d={key:"summary",name:r.summary,header:!1,columns:[{title:"",width:28},{title:"",width:100}],rows:[[{v:e.name??r.title,bold:!0},""],[{v:r.privacy,color:"B42318"},""],[r.count.agents,e.agents.length],[r.count.orchestrators,p("orchestrator")],[r.count.specialists,p("specialist")],[r.count.patterns,e.patterns.length],[r.count.off,new Set(e.offPattern.map(w=>w.agent)).size],[r.count.gaps,e.gaps.length],[r.count.conflicts,e.conflicts.length],[r.count.solos,t.filter(w=>w.key==="solo").length],[r.count.unused,e.unused.length],["",""],[{v:t.length?r.look:r.nothing,bold:!0},""],...Ni(t).flatMap(w=>[[{v:`${w[s]} \xB7 ${w.looks.length}`,bold:!0},""],...w.looks.map(({look:h})=>["",{v:h[s],wrap:!0}])])]},m=i("matrix",[[r.dimension,18],[r.fact,40],[r.key,34],...g.map(w=>[w.id,14])],u.map(w=>[wi[cn(w)][s],f(w),w,...g.map(h=>w in h.facts?w.startsWith("declared:")?Pm:Cm:`${w}~variant`in h.facts?Lm:l.has(`${h.id} ${w}`)?qm:"")])),{look:y,everyone:k}=ot(e),v=i("patterns",[[r.key,34],[r.fact,40],[r.scope,14],[r.role,14],[r.share,10],[r.have,50],[r.lack,40],[r.decision,12],[r.why,50]],[...y,...k].map(w=>{let h=e.offPattern.filter(O=>O.key===w.key).map(O=>O.agent);return[w.key,f(w.key),a(w.scope),r[w.role],`${Math.round(w.share*100)}%`,w.agents.join(", "),h.join(", "),w.decision?r[w.decision.status==="accepted"?"accept":"reject"]:"",w.decision?.why??""]})),S=i("off",[[r.agent,24],[r.role,14],[r.missing,44],[r.key,34],[r.scope,14],[r.accepted,14]],e.offPattern.map(w=>[w.agent,o(w.agent),f(w.key),w.key,a(w.scope),e.patterns.find(h=>h.key===w.key)?.decision?.status==="accepted"?r.yes:""])),T=i("gaps",[[r.rule,16],[r.says,50],[r.role,14],[r.notMet,60]],e.gaps.map(w=>[w.rule.id,w.rule.says,w.rule.role?r[w.rule.role]:"",w.agents.join(", ")])),N=i("conflicts",[[r.agent,24],[r.fact,40],[r.key,34],[r.declared,20],[r.source,40],[r.inYaml,12]],e.conflicts.map(w=>[w.agent,f(w.key),w.key,w.declared,w.source,w.observed?r.yes:r.no])),q=i("agents",[[r.agent,24],[r.name,32],[r.role,14],[r.types,24],[r.facts,8],[r.off,44],[r.alone,44],[r.children,24],[r.unknown,12]],g.map(w=>[w.id,w.displayName??"",r[w.role],c(w.id),Object.keys(w.facts).length,e.offPattern.filter(h=>h.agent===w.id).map(h=>f(h.key)).join("; "),e.solos.filter(h=>h.agents[0]===w.id).map(h=>f(h.key)).join("; "),w.children.map(h=>h.name).join(", "),e.unknown.filter(h=>h.agent===w.id).length||""])),M=i("evidence",[[r.agent,30],[r.fact,40],[r.key,34],[r.file,50],[r.line,8]],g.flatMap(w=>[{who:w.id,facts:w.facts},...w.children.map(h=>({who:`${w.id} \u203A ${h.name}`,facts:h.facts}))]).flatMap(({who:w,facts:h})=>Object.entries(h).sort(([O],[P])=>O.localeCompare(P)).flatMap(([O,P])=>P.map(B=>[w,f(O),O,B.file,B.line??""])))),C=i("declared",[[r.agent,24],[r.key,34],[r.value,40],[r.source,40]],n.declared.map(w=>[w.agent,w.key,w.value,w.source])),$=i("text",[[r.id,28],[r.label,36],[r.body,70],[r.have,50],[r.variant,40],[r.official,10]],e.blocks.map(w=>[w.id,w.official??w.label,{v:w.text,wrap:!0},Object.keys(w.holders).sort().join(", "),Object.entries(w.variants).sort(([h],[O])=>h.localeCompare(O)).map(([h,O])=>`${h} (${Math.round(O.similarity*100)}%)`).join(", "),w.official?r.yes:""])),L=i("routing",[[r.caller,24],[r.called,30],[r.history,10],[r.inputs,30],[r.routingText,70],[r.chars,10],[r.file,44]],e.contract.routes.map(w=>[w.caller,w.agent??`${w.name??w.calls} (${r.notInFolder})`,w.history?r.yes:r.no,w.inputs.join(", "),{v:w.description,wrap:!0},w.description.length,`${w.file}${w.line?`:${w.line}`:""}`])),K=e.telemetry.days,V=i("telemetry",[[r.agent,24],[r.written,30],[r.form,28],[r.fields,50],[r.file,44],...K?[[r.fired(K),16]]:[]],e.telemetry.events.map(w=>[w.agent,w.name,$e(w.as,s),w.fields?w.fields.join(", "):r.notRead,`${w.file}${w.line?`:${w.line}`:""}`,...K?[w.fired===void 0||e.telemetry.silent.includes(w.agent)?"\u2014":w.fired===0?{v:0,color:"B42318",bold:!0}:w.fired]:[]])),fe=i("unused",[[r.agent,24],[r.what,16],[r.name,30],[r.how,14],[r.file,50]],e.unused.flatMap(w=>w.sources.map(h=>[w.agent,r.thing[w.what]??w.what,e.names[w.name]??w.name,r[w.how],`${h.file}${h.line?`:${h.line}`:""}`]))),Oe=Ti(e,t,[],n,[]),E=w=>Oe.staff.filter(h=>h.key!=="cast"&&h.people.some(O=>O.id===w)).map(h=>r.situation[h.key]).join(", "),A=Ts(t,e),I=i("staff",[[r.agent,24],[r.name,32],[r.situation_,34],[r.manager,24],[r.teamCol,22],[r.ownerCol,30],[r.hired,14],[r.publishedCol,14],[r.items,10]],Oe.resumes.map(w=>[w.id,w.name,E(w.id),w.manager??"",w.team?.value??"",w.owner?.value??"",w.created?.value??"",w.published?.value??"",A.filter(h=>h.agent===w.id).length||""])),Y=i("pdi",[[r.agent,24],[r.item,60],[r.why,70],[r.key,40],[r.group,18]],A.map(w=>[w.agent,w[s],{v:w.why[s],wrap:!0},w.keys.join(", "),r.pdiGroup[w.group]])),G=[d,m,v,...e.blocks.length?[$]:[],...e.contract.routes.length?[L]:[],...e.telemetry.events.length?[V]:[],S,T,N,...e.unused.length?[fe]:[],q,I,...A.length?[Y]:[],M,C];return e.unknown.length&&G.push(i("unknown",[[r.agent,24],[r.file,50],[r.why,40],[r.kind,24]],e.unknown.map(w=>[w.agent,w.file,r.why_[w.why],w.kind??""]))),G}var Fe=e=>String(e??"").normalize("NFD").replace(/[̀-ͯ]/g,"").trim().toLowerCase(),pn=Object.values(Es),nc=(e,t)=>e.find(n=>pn.some(s=>Fe(s[t])===Fe(n.name)));function sc(e,...t){let n=t.map(s=>e?.rows[0]?.findIndex(r=>pn.some(i=>Fe(i[s])===Fe(r)))??-1);return s=>n.map(r=>r<0?"":String(s[r]??"").trim())}var rc=(e,t)=>t.find(([,n])=>pn.some(s=>Fe(s[n])===Fe(e)))?.[0],ic=e=>e.slice(1).filter(t=>t.some(n=>String(n??"").trim())),oc=(e,t)=>JSON.stringify(e)===JSON.stringify(t);function Im(e,t,n={}){let s=[],r=[],i=nc(t,"declared");if(i){let a=sc(i,"agent","key","value","source"),c=[];ic(i.rows).forEach((u,l)=>{let[p,d,m,y]=a(u);!p||!d?r.push(`${i.name}, ${l+2}: \xAB${a(i.rows[0])[p?1:0]}\xBB ?`):c.push({agent:p,key:d,value:m,source:y})});let f=u=>`${u.agent} ${u.key}`,g=0;for(let u of c){let l=e.declared.find(p=>f(p)===f(u));l?oc(l,u)||s.push({key:`d${++g}`,kind:"declared",op:"set",before:l,after:u}):s.push({key:`d${++g}`,kind:"declared",op:"add",after:u})}for(let u of e.declared)c.some(l=>f(l)===f(u))||s.push({key:`d${++g}`,kind:"declared",op:"remove",before:u})}let o=nc(t,"patterns");if(o){let a=sc(o,"key","scope","decision","why"),c=0;for(let f of ic(o.rows)){let[g,u,l,p]=a(f);if(!g)continue;let d=e.decisions.find(S=>S.key===g);if(!l){d&&s.push({key:`p${++c}`,kind:"decision",op:"remove",before:d});continue}let m=rc(l,[["accepted","accept"],["rejected","reject"]]),y=/^(tipo|type)\s*:\s*(.+)$/i.exec(u),k=y?Object.entries(n).find(([S,T])=>Fe(T)===Fe(y[2])||Fe(S)===Fe(y[2]))?.[0]:void 0,v=y?k?`type:${k}`:void 0:rc(u,[["platform","platform"],["specialist","specialist"],["orchestrator","orchestrator"]]);if(!m)r.push(`${o.name}, ${g}: \xAB${l}\xBB \u2014 ${pn.map(S=>`${S.accept}/${S.reject}`).join(", ")}`);else if(!v)r.push(`${o.name}, ${g}: \xAB${u}\xBB \u2014 ${pn.map(S=>`${S.platform}/${S.specialist}/${S.orchestrator}`).join(", ")}`);else{let S={key:g,status:m,scope:v,why:p};d?oc(d,S)||s.push({key:`p${++c}`,kind:"decision",op:"set",before:d,after:S}):s.push({key:`p${++c}`,kind:"decision",op:"add",after:S})}}}return{changes:s,problems:r}}function Rm(e,t,n){let s={...e,declared:[...e.declared],decisions:[...e.decisions]};for(let r of t.filter(i=>n.includes(i.key)))if(r.kind==="declared"){let i=a=>`${a.agent} ${a.key}`,o=r.before?s.declared.findIndex(a=>i(a)===i(r.before)):-1;r.op==="add"?s.declared.push(r.after):r.op==="set"?s.declared[o]=r.after:s.declared.splice(o,1)}else{let i=r.before?s.decisions.findIndex(o=>o.key===r.before.key):-1;r.op==="add"?s.decisions.push(r.after):r.op==="set"?s.decisions[i]=r.after:s.decisions.splice(i,1)}return s}var mn="#8C8578";var Cs="#C8442C",lc="#2E8F62";var ac=e=>Math.round(e*10)/10,hn=e=>[ac(e[0]),ac(e[1])],Be=(e,t,n=22,s="start",r)=>({type:"text",at:hn(e),text:t,size:n,anchor:s,...r?{style:{color:r}}:{}}),cc=(e,t,n)=>({type:"line",from:hn(e),to:hn(t),...n?{style:n}:{}}),fc=(e,t,n)=>({type:"arrow",from:hn(e),to:hn(t),...n?{style:n}:{}});var Fm=(e,t)=>e.length*t*.48;function qs(e,t,n){let s=[],r="";for(let i of e.split(/\s+/).filter(Boolean)){let o=r?`${r} ${i}`:i;r&&Fm(o,t)>n?(s.push(r),r=i):r=o}return r&&s.push(r),s.length?s:[""]}var Ot=150,gn=40,jm=24,uc=250,dc="#7B4FC9",pc=17,hc=23,Ci=5,qi=4,Dm=/^(auth|model|setting|topics|connref|operation):/,_m={en:{chapters:["The cast","What repeats","Who is off","What is missing","What to decide"],cast:(e,t)=>e?`${e} ${e===1?"orchestrator calls":"orchestrators call"} ${t} ${t===1?"specialist":"specialists"}.`:`${t} ${t===1?"specialist":"specialists"}, with no orchestrator.`,repeats:(e,t,n)=>e?`${e} patterns: ${t} of the platform, ${n} of the specialists.`:"Nothing repeats enough to be a pattern yet.",off:e=>e.length?`Off a pattern: ${e.join(", ")}.`:"Nobody is off a pattern.",missing:e=>e?`${e} ${e===1?"rule is":"rules are"} not met.`:"Every rule is met.",decide:e=>e?`${e} ${e===1?"thing":"things"} to decide.`:"Nothing left to decide.",unused:e=>`${e} ${e===1?"thing nobody uses or switched off":"things nobody uses or switched off"}: remove or switch on?`,pattern:e=>`A pattern? \xAB${e}\xBB`,platform:"platform",specialist:"specialists",more:e=>`and ${e} more on the map`,none:"nothing"},pt:{chapters:["O elenco","O que se repete","Quem est\xE1 fora","O que falta","O que decidir"],cast:(e,t)=>e?`${e} ${e===1?"orquestrador chama":"orquestradores chamam"} ${t} ${t===1?"especialista":"especialistas"}.`:`${t} ${t===1?"especialista":"especialistas"}, sem orquestrador.`,repeats:(e,t,n)=>e?`${e} padr\xF5es: ${t} da plataforma, ${n} dos especialistas.`:"Nada se repete o bastante para ser padr\xE3o ainda.",off:e=>e.length?`Fora do padr\xE3o: ${e.join(", ")}.`:"Ningu\xE9m est\xE1 fora do padr\xE3o.",missing:e=>e?`${e} ${e===1?"regra n\xE3o \xE9 cumprida":"regras n\xE3o s\xE3o cumpridas"}.`:"Todas as regras s\xE3o cumpridas.",decide:e=>e?`${e} ${e===1?"coisa":"coisas"} para decidir.`:"Nada em aberto para decidir.",unused:e=>`${e} ${e===1?"coisa sem uso ou desligada":"coisas sem uso ou desligadas"}: remover ou ligar?`,pattern:e=>`Padr\xE3o? \xAB${e}\xBB`,platform:"plataforma",specialist:"especialistas",more:e=>`e mais ${e} no mapa`,none:"nada"}};function Bm(e,t,n="en"){let s=_m[n],r=e.agents.filter(A=>A.role==="orchestrator").sort((A,I)=>A.id.localeCompare(I.id)),i=Object.keys(e.typeNames),o=A=>{let I=(e.types[A]??[])[0];return I===void 0?i.length:i.indexOf(I)},a=e.agents.filter(A=>A.role==="specialist").sort((A,I)=>o(A.id)-o(I.id)||A.id.localeCompare(I.id)),c=i.length>0&&a.some(A=>(e.types[A.id]??[]).length),f=c?390:340,g=Math.max(1,Math.ceil(a.length/jm)),u=Math.max(1,Math.ceil(a.length/g)),l=Math.max(1e3,gn*2+Math.max(u,r.length)*Ot),p=(A,I)=>l/2+(A-(I-1)/2)*Ot,d=A=>Ml(A)?0:Dm.test(A)?2:1,m=[{...Be([gn,52],e.name??s.chapters[0],30),chapter:s.chapters[0],say:`${e.name?`${e.name}: `:""}${s.cast(r.length,a.length)}`}],y=(A,I,Y)=>qs(A,15,Ot-12).slice(0,2).forEach((G,w)=>m.push(Be([I[0],I[1]+w*18],G,15,"middle",Y))),k=170,v=new Map;r.forEach((A,I)=>{let Y=p(I,r.length);v.set(A.id,[Y,k]),m.push({type:"prop",name:"robot",at:[Y,k],size:70}),y(A.id,[Y,k+24],mn)}),a.forEach((A,I)=>{let Y=Math.floor(I/u),G=Math.min(u,a.length-Y*u),w=[p(I%u,G),f+Y*uc];v.set(A.id,w),m.push({type:"prop",name:"robot",at:w,size:64}),y(A.id,[w[0],w[1]+24])});for(let A of r){let I=v.get(A.id);for(let Y of a.filter(G=>G.schemaName&&`calls:${G.schemaName}`in A.facts)){let G=v.get(Y.id);G[1]===f&&m.push(fc([I[0],I[1]+44],[G[0],G[1]-(c?118:76)],{color:mn}))}}if(c){let A=[];a.forEach(I=>{let Y=(e.types[I.id]??[])[0],G=Y===void 0?n==="pt"?"sem tipo":"no type":e.typeNames[Y]??Y,[w,h]=v.get(I.id),O=A[A.length-1];O&&O.name===G&&O.y===h?O.xs.push(w):A.push({name:G,xs:[w],y:h})});for(let I of A){let[Y,G]=[Math.min(...I.xs),Math.max(...I.xs)];m.push(Be([(Y+G)/2,I.y-92],I.name,16,"middle",dc),cc([Y-Ot/2+14,I.y-84],[G+Ot/2-14,I.y-84],{color:dc}))}}let S=f+(g-1)*uc+160,T=(l-gn*2)/3,N=S,q=(A,I,Y,G,w)=>{let h=gn+A*T;m.push({...Be([h,S],I,22,"start",w),chapter:I,say:Y});let O=S+34,P=G.slice(0,Ci);G.length>Ci&&P.push(s.more(G.length-Ci)),P.length||P.push(s.none);for(let B of P){let ee=qs(B,pc,T-30),ie=ee.length>qi?[...ee.slice(0,qi-1),`${ee[qi-1]}\u2026`]:ee;ie.forEach((U,Ae)=>m.push(Be([h+(Ae?14:0),O+Ae*hc],`${Ae?"":"\xB7 "}${U}`,pc,"start",mn))),O+=ie.length*hc+6}N=Math.max(N,O)},M=e.patterns.filter(A=>!A.partOf).sort((A,I)=>d(A.key)-d(I.key)||(A.scope===I.scope?0:A.scope==="platform"?-1:1)||I.share-A.share||A.key.localeCompare(I.key)),C=A=>A==="platform"?s.platform:s.specialist;q(0,s.chapters[1],s.repeats(e.patterns.length,e.patterns.filter(A=>A.scope==="platform").length,e.patterns.filter(A=>A.scope!=="platform").length),M.map(A=>`${re(A.key,n,e.names)} \xB7 ${C(A.scope)}${A.share<1?` \xB7 ${Math.round(A.share*100)}%`:""}`),lc);let $=[...new Set(e.offPattern.map(A=>A.agent))].sort();$.forEach((A,I)=>{let Y=v.get(A),G=h=>h.variant?`${n==="pt"?"varia\xE7\xE3o de":"a variation of"} \xAB${re(h.key,n,e.names)}\xBB`:Ss(h.key,n,1,e.names),w=e.offPattern.filter(h=>h.agent===A).sort((h,O)=>d(h.key)-d(O.key)).flatMap(h=>qs(G(h),13,Ot-10)).slice(0,4);m.push({...Be([Y[0]+34,Y[1]-50],"\xD7",30,"middle",Cs),...I===0?{chapter:s.chapters[2],say:s.off($)}:{}}),w.forEach((h,O)=>m.push(Be([Y[0],Y[1]+66+O*16],h,13,"middle",Cs)))}),$.length||m.push({...Be([l-gn,92],s.off([]),16,"end",mn),chapter:s.chapters[2],say:s.off([])});let L=e.gaps.flatMap(A=>{let I=A.agents.filter(Y=>!e.offPattern.some(G=>G.agent===Y&&G.key===A.rule.has)).length;return I?[n==="pt"?`\xAB${A.rule.says}\xBB: ${I}${A.rule.role?` ${Ee(A.rule.role,n,I)}`:""} n\xE3o ${I===1?"cumpre":"cumprem"}`:`\xAB${A.rule.says}\xBB: ${I}${A.rule.role?` ${Ee(A.rule.role,n,I)}`:""} ${I===1?"does":"do"} not meet it`]:[]});L.push(...t.filter(A=>A.key==="telemetry").map(A=>A[n]),...t.filter(A=>A.key==="contract"||A.key==="flow").map(A=>A[n]));let K=e.unknown.length;K&&L.push(n==="pt"?`${K} ${K===1?"arquivo n\xE3o entendido":"arquivos n\xE3o entendidos"}`:`${K} ${K===1?"file":"files"} not understood`),q(1,s.chapters[3],s.missing(t.filter(A=>A.key==="gap").length),L,Cs);let V=t.filter(A=>A.key==="unused").length,{look:fe}=ot(e),Oe=[...t.filter(A=>A.key==="conflict"||A.key==="spelling"||A.key==="values"||A.key==="twice").map(A=>A[n]),...V?[s.unused(V)]:[],...fe.filter(A=>!A.decision).map(A=>s.pattern(re(A.key,n,e.names))),...t.filter(A=>A.key==="solo").map(A=>A[n])];return q(2,s.chapters[4],s.decide(Oe.length),Oe),{id:(e.name??"cast").toLowerCase().normalize("NFD").replace(/[̀-ͯ]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,60)||"cast",title:e.name??s.chapters[0],width:l,height:Math.min(4e3,N+40),background:"plain",locale:n==="pt"?"pt-BR":"en-US",steps:m}}var At={client:80,orchestrator:290,specialist:590,flow:880,system:1110},at=96,Pi=110,mc=46,J=(e,t)=>({en:e,pt:t});function Km(e,t,n,s){let r=b=>e.agents.find(D=>D.id===b)?.displayName??b,i=b=>e.typeNames[b]??b,o=new Set(s?e.telemetry.silent:[]),a=b=>s&&!o.has(b)?s.rows.filter(D=>D.agent===b&&D.event==="TopicStart").reduce((D,H)=>D+H.count,0):void 0,c=[],f=[],g=[],u=e.agents.filter(b=>b.role==="specialist"),l=[...new Set(u.flatMap(b=>e.types[b.id]??[]))],p=new Set,d=Pi;for(let b of[...l,""]){let D=u.filter(j=>!p.has(j.id)&&(b?(e.types[j.id]??[])[0]===b:!(e.types[j.id]??[]).length));if(!D.length)continue;let H=d-34;for(let j of D){p.add(j.id);let z=(e.types[j.id]??[]).map(i);c.push({id:j.id,kind:"specialist",label:r(j.id),sub:z.length?J(z.join(" \xB7 "),z.join(" \xB7 ")):J("specialist","especialista"),x:At.specialist,y:d,...v(j.id)}),d+=at}b&&g.push({label:i(b),y1:H,y2:d-at+34}),d+=mc}let m=Math.max(d-mc-at,Pi),y=Math.round((Pi+m)/2),k=e.agents.filter(b=>b.role==="orchestrator");k.forEach((b,D)=>c.push({id:b.id,kind:"orchestrator",label:r(b.id),sub:J("routes and hands over","classifica e encaminha"),x:At.orchestrator,y:y+(D-(k.length-1)/2)*at,...v(b.id)})),c.unshift({id:"client",kind:"client",label:"",sub:J("who is served","quem \xE9 atendido"),x:At.client,y});function v(b){let D=a(b);return o.has(b)?{silent:!0}:D!==void 0?{volume:D}:{}}let S=b=>c.find(D=>D.id===b);for(let b of k)f.push({from:"client",to:b.id,kind:"traffic",...S(b.id)?.volume!==void 0?{volume:S(b.id).volume}:{},...o.has(b.id)?{dashed:!0}:{}});let T=b=>e.offPattern.filter(D=>D.agent===b&&D.key.startsWith("called-with:")),N=(b,D)=>T(b).map(H=>H.key==="called-with:history"?D==="pt"?"SEM hist\xF3rico":"NO history":`${D==="pt"?"SEM":"NO"} \xAB${H.key.slice(18)}\xBB`).join(" \xB7 "),q=m+at,M=0;for(let b of e.contract.routes){if(!b.agent){S(b.calls)||c.push({id:b.calls,kind:"ghost",label:b.name??b.calls,sub:J("called, not in the folder","chamado, fora da pasta"),x:At.orchestrator+40,y:q+M++*at}),f.push({from:b.caller,to:b.calls,kind:"traffic",tone:"ghost",dashed:!0,label:J("calls it, but it is not in the folder","chama, mas n\xE3o est\xE1 na pasta")});continue}let D=e.contract.short.some(z=>z.agent===b.agent&&z.caller===b.caller),H=T(b.agent).length,j=S(b.agent);f.push({from:b.caller,to:b.agent,kind:"traffic",...j?.volume!==void 0?{volume:j.volume}:{},...o.has(b.agent)?{dashed:!0}:{},...H?{tone:"bad",label:J(N(b.agent,"en"),N(b.agent,"pt"))}:D?{tone:"amber",label:J(`routed by \xAB${b.description}\xBB`,`roteado por \xAB${b.description}\xBB`)}:{}})}let C=b=>`flow:${b.id??b.name}`,$=b=>{if(b.startsWith("http:"))return{id:`sys:${b}`,label:b.slice(5),sub:J("HTTP","HTTP")};if(b.startsWith("connector:"))return{id:`sys:${b}`,label:e.names[b.slice(10)]??b.slice(10),sub:J("connector","conector")};if(b.startsWith("mcp:"))return{id:`sys:${b}`,label:e.names[b.slice(4)]??b.slice(4),sub:J("MCP server","servidor MCP")}},L=new Map,K=new Map,V=(b,D,H)=>{let j=$(b);if(!j)return;let z=K.get(j.id)??{...j,kind:"system",x:At.system,y:0,reach:[]};return z.reach.push({from:D,live:H}),K.set(j.id,z),j.id};for(let b of e.flows){if(!S(b.agent))continue;let H=C(b),j=L.get(H)??{id:H,kind:"flow",label:b.name,sub:J("flow","fluxo"),x:At.flow,y:0,unused:!0};b.called&&(j.unused=!1),L.set(H,j),f.push({from:b.agent,to:H,kind:"structure",...b.called?b.returns?{}:{tone:"amber",label:J("returns nothing","n\xE3o devolve nada")}:{tone:"ghost",dashed:!0,label:J("nobody calls it","ningu\xE9m chama")}})}for(let b of e.flows){let D=L.get(C(b));for(let H of b.uses){let j=V(H,S(b.agent).y,b.called);j&&!f.some(z=>z.from===D.id&&z.to===j)&&f.push({from:D.id,to:j,kind:"structure",...H.startsWith("http:")?{label:J("HTTP","HTTP")}:{},...b.called?{}:{tone:"ghost",dashed:!0}})}}for(let b of u){let D=Object.keys(b.facts);for(let H of D.filter(j=>j.startsWith("connector:")||j.startsWith("mcp:"))){let j=V(H,S(b.id).y,!0),z=D.filter(pe=>pe.startsWith(`operation:${H.slice(10)}/`)).map(pe=>pe.slice(pe.indexOf("/")+1));j&&f.push({from:b.id,to:j,kind:"structure",...z.length?{label:J(z.join(", "),z.join(", "))}:{}})}}let fe=(b,D)=>{let H=b.map(z=>({n:z,want:D(z)})).sort((z,pe)=>z.want-pe.want||z.n.label.localeCompare(pe.n.label)),j=-1/0;for(let z of H)z.n.y=Math.round(Math.max(z.want,j+at*.82)),j=z.n.y},Oe=[...L.values()];fe(Oe,b=>gc(f.filter(D=>D.to===b.id).map(D=>S(D.from).y))),c.push(...Oe);let E=[...K.values()];for(let b of E)b.unused=!b.reach.some(D=>D.live);fe(E,b=>gc(f.filter(D=>D.to===b.id).map(D=>c.find(H=>H.id===D.from)?.y??y))),c.push(...E.map(({reach:b,...D})=>D));let A=e.agents.map(b=>b.id),I=b=>b==="platform"?A:b.startsWith("type:")?u.filter(D=>(e.types[D.id]??[]).includes(b.slice(5))).map(D=>D.id):e.agents.filter(D=>D.role===b).map(D=>D.id),Y=b=>b==="platform"?J("platform","de plataforma"):b.startsWith("type:")?J(`of the type \xAB${i(b.slice(5))}\xBB`,`do tipo \xAB${i(b.slice(5))}\xBB`):b==="orchestrator"?J("of the orchestrators","dos orquestradores"):J("of the specialists","dos especialistas"),{look:G}=ot(e),h=[...e.patterns.filter(b=>b.decision?.status==="accepted"),...G].filter((b,D,H)=>!b.partOf&&H.findIndex(j=>j.key===b.key&&j.scope===b.scope)===D).slice(0,8).map(b=>{let D=I(b.scope),H=e.offPattern.filter(F=>F.key===b.key&&F.scope===b.scope),j=H.filter(F=>!F.variant).map(F=>F.agent),z=H.filter(F=>F.variant).map(F=>F.agent),pe=D.filter(F=>!j.includes(F)&&!z.includes(F)),Ne=F=>F.map(r).join(", "),te=Y(b.scope),se=F=>[j.length?F==="pt"?`Fora: ${Ne(j)}.`:`Off: ${Ne(j)}.`:"",z.length?F==="pt"?`Varia\xE7\xE3o: ${Ne(z)}.`:`A variation: ${Ne(z)}.`:""].filter(Boolean).join(" ");return{id:`pattern:${b.key}`,name:J(re(b.key,"en",e.names),re(b.key,"pt",e.names)),caption:J(`\xAB${re(b.key,"en",e.names)}\xBB \u2014 a pattern ${te.en} (${pe.length} of ${D.length}). ${se("en")}`.trim(),`\xAB${re(b.key,"pt",e.names)}\xBB \u2014 padr\xE3o ${te.pt} (${pe.length} de ${D.length}). ${se("pt")}`.trim()),ok:pe,amber:z,bad:j}}),O=(b,D,H,j,z,pe)=>{let Ne=[...new Set(j)],te=[...new Set(z)].filter(se=>!Ne.includes(se));return{id:b,name:D,caption:H,bad:Ne,amber:te,ok:pe.filter(se=>!Ne.includes(se)&&!te.includes(se))}},P=e.contract.routes.flatMap(b=>b.agent?[b.agent]:[]),B=t.filter(b=>b.key==="flow"||b.key==="contract"&&b.fact==="routing:described");h.push(O("contract",J("Contract","Contrato"),J("What the orchestrator passes, and how it routes: red is what is missing; amber, a short routing description or a flow that returns nothing.","O que o orquestrador passa, e como encaminha: em vermelho o que falta; em \xE2mbar, uma descri\xE7\xE3o de roteamento curta ou um fluxo que n\xE3o devolve nada."),u.filter(b=>T(b.id).length).map(b=>b.id),B.flatMap(b=>b.agents),P));let ee=t.filter(b=>b.key==="spelling"||b.key==="telemetry"||b.fact?.startsWith("telemetry:")||b.fact==="node:LogCustomTelemetryEvent"),ie=[...o,...e.offPattern.filter(b=>b.key==="node:LogCustomTelemetryEvent").map(b=>b.agent)];h.push(O("telemetry",J("Telemetry","Telemetria"),J("Who logs, and what fires: red logs nothing or has no line; amber spells an event another way, misses a field, or has an event that did not fire.","Quem registra, e o que dispara: em vermelho quem n\xE3o registra ou n\xE3o tem linha; em \xE2mbar um evento escrito de outro jeito, um campo que falta ou um evento que n\xE3o disparou."),ie,ee.flatMap(b=>b.agents),A)),h.push(O("unused",J("Unused","Sem uso"),J("What nobody uses, or is switched off: remove it or switch it on?","O que ningu\xE9m usa, ou est\xE1 desligado: remover ou ligar?"),[],e.unused.map(b=>b.agent),A));let U=e.contract.routes.map((b,D)=>{let H=b.agent??b.calls,j=b.agent?r(b.agent):b.name??b.calls,z=[{node:"client",text:J("The customer writes.","O cliente escreve.")}],pe=b.agent&&e.contract.short.some(te=>te.agent===b.agent&&te.caller===b.caller);if(z.push(pe?{node:b.caller,warn:!0,quote:b.description,text:J(`The orchestrator hands over to ${j} by a routing description of ${b.description.length} characters.`,`O orquestrador encaminha para ${j} por uma descri\xE7\xE3o de roteamento de ${b.description.length} caracteres.`)}:{node:b.caller,quote:b.description,text:J(`The orchestrator hands over to ${j}.`,`O orquestrador encaminha para ${j}.`)}),!b.agent)return z.push({node:H,warn:!0,text:J(`It calls ${j}, which is not in the folder: not cloned, or gone?`,`Chama ${j}, que n\xE3o est\xE1 na pasta: n\xE3o foi clonado, ou n\xE3o existe mais?`)}),{id:`scene-${D+1}`,to:H,title:J(j,j),steps:z};let Ne=T(b.agent);if(Ne.length){let te=se=>Ne.map(F=>F.key==="called-with:history"?se==="pt"?"o hist\xF3rico":"the history":`\xAB${F.key.slice(18)}\xBB`).join(se==="pt"?" e SEM ":" and WITHOUT ");z.push({node:b.agent,warn:!0,text:J(`${j} is called WITHOUT ${te("en")}: it does not know what the customer already said.`,`${j} \xE9 chamado SEM ${te("pt")}: n\xE3o sabe o que o cliente j\xE1 disse.`)})}else{let te=se=>[b.history?se==="pt"?"o hist\xF3rico":"the history":"",...b.inputs.map(F=>`\xAB${F}\xBB`)].filter(Boolean).join(se==="pt"?" e ":" and ")||(se==="pt"?"a chamada":"the call");z.push({node:b.agent,text:J(`${j} gets ${te("en")}.`,`${j} recebe ${te("pt")}.`)})}for(let te of e.flows.filter(se=>se.agent===b.agent&&se.called)){z.push(te.returns?{node:C(te),text:J(`It uses the flow \xAB${te.name}\xBB.`,`Usa o fluxo \xAB${te.name}\xBB.`)}:{node:C(te),warn:!0,text:J(`The flow \xAB${te.name}\xBB returns nothing to ${j}.`,`O fluxo \xAB${te.name}\xBB n\xE3o devolve nada para ${j}.`)});for(let se of te.uses){let F=$(se);F&&z.push({node:F.id,text:J(`The flow reaches ${F.label}.`,`O fluxo chega a ${F.label}.`)})}}for(let te of f.filter(se=>se.from===b.agent&&se.to.startsWith("sys:"))){let se=c.find(F=>F.id===te.to);z.push({node:se.id,text:J(`It uses ${se.label}${te.label?` (${te.label.en})`:""}.`,`Usa ${se.label}${te.label?` (${te.label.pt})`:""}.`)})}return z.push({node:b.caller,text:J("The answer goes back to the customer through the orchestrator.","A resposta volta ao cliente pelo orquestrador.")}),{id:`scene-${D+1}`,to:H,title:J(j,j),steps:z}}),Ae=xi(e),xt=e.agents.map(b=>{let H=n.find(F=>F.id===b.id)?.texts.filter(F=>F.source==="instructions").reduce((F,xe)=>F+xe.text.length,0)??0,j=[];for(let F of e.blocks)F.holders[b.id]?j.push({kind:F.official?"official":"shared",size:F.text.length,label:F.official??F.label}):F.variants[b.id]&&j.push({kind:"variant",size:F.variants[b.id].text.length,label:F.official??F.label});let z=j.reduce((F,xe)=>F+xe.size,0);for(let F of Object.keys(b.facts).filter(xe=>xe.startsWith("text:")&&!xe.startsWith("text:block:")&&!xe.endsWith("~variant")))j.push({kind:"marker",size:12,label:re(F,"pt",e.names)});H>z&&j.push({kind:"own",size:H-z});let pe=["platform",b.role,...(e.types[b.id]??[]).map(F=>`type:${F}`)],Ne=new Set(e.offPattern.map(F=>F.key)),se=e.patterns.filter(F=>!F.partOf&&pe.includes(F.scope)&&(F.decision?.status==="accepted"||Ne.has(F.key))).filter((F,xe,bn)=>bn.findIndex(Lc=>Lc.key===F.key)===xe).map(F=>{let xe=e.offPattern.find(bn=>bn.agent===b.id&&bn.key===F.key);return{key:F.key,en:dn(F.key,"en",e.names),pt:dn(F.key,"pt",e.names),state:xe?xe.variant?"decide":"off":"ok"}});return{id:b.id,name:r(b.id),role:b.role==="orchestrator"?"orchestrator":"specialist",types:(e.types[b.id]??[]).map(i),...v(b.id),fingerprint:j,checks:se,access:Ae.filter(F=>F.agent===b.id).map(F=>J(F.en,F.pt))}}),Pc=Math.max(...c.map(b=>b.y))+90;return{...e.name?{name:e.name}:{},width:1220,height:Pc,hasTelemetry:!!s,...s?{days:s.days}:{},groups:g,nodes:c,edges:f,lenses:h,scenes:U,actors:xt}}var gc=e=>e.length?e.reduce((t,n)=>t+n,0)/e.length:0;function Um(e,t){let n=e.replace(/^/,""),s=n.slice(0,n.search(/\r?\n|$/)),r=g=>s.split('"').filter((u,l)=>l%2===0).join("").split(g).length,i=r(";")>r(",")?";":",",o=[],a=[],c="",f=!1;for(let g=0;g<n.length;g++){let u=n[g];f?u==='"'&&n[g+1]==='"'?c+=n[++g]:u==='"'?f=!1:c+=u:u==='"'?f=!0:u===i?(a.push(c),c=""):u===`
|
|
158
|
+
<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><bookViews><workbookView/></bookViews><sheets>${s.map((o,a)=>`<sheet name="${xi(o)}" sheetId="${a+1}" r:id="rId${a+1}"/>`).join("")}</sheets>${r?`<definedNames>${r}</definedNames>`:""}</workbook>`],["xl/_rels/workbook.xml.rels",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
159
|
+
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">${e.map((o,a)=>`<Relationship Id="rId${a+1}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet${a+1}.xml"/>`).join("")}<Relationship Id="rId${e.length+1}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/></Relationships>`],["xl/styles.xml",t],...e.map((o,a)=>[`xl/worksheets/sheet${a+1}.xml`,km(o,n)])];return Sm(i.map(([o,a])=>[o,Zl.encode(a)]))}var $m=(()=>{let e=new Uint32Array(256);for(let t=0;t<256;t++){let n=t;for(let s=0;s<8;s++)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n>>>0}return e})();function vm(e){let t=4294967295;for(let n=0;n<e.length;n++)t=$m[(t^e[n])&255]^t>>>8;return(t^4294967295)>>>0}function Sm(e){let t=[],n=[],s=0;for(let[f,g]of e){let u=Zl.encode(f),l=vm(g),p=new DataView(new ArrayBuffer(30));p.setUint32(0,67324752,!0),p.setUint16(4,20,!0),p.setUint16(6,2048,!0),p.setUint16(8,0,!0),p.setUint32(14,l,!0),p.setUint32(18,g.length,!0),p.setUint32(22,g.length,!0),p.setUint16(26,u.length,!0),t.push(new Uint8Array(p.buffer),u,g);let d=new DataView(new ArrayBuffer(46));d.setUint32(0,33639248,!0),d.setUint16(4,20,!0),d.setUint16(6,20,!0),d.setUint16(8,2048,!0),d.setUint32(16,l,!0),d.setUint32(20,g.length,!0),d.setUint32(24,g.length,!0),d.setUint16(28,u.length,!0),d.setUint32(42,s,!0),n.push(new Uint8Array(d.buffer),u),s+=30+u.length+g.length}let r=n.reduce((f,g)=>f+g.length,0),i=new DataView(new ArrayBuffer(22));i.setUint32(0,101010256,!0),i.setUint16(8,e.length,!0),i.setUint16(10,e.length,!0),i.setUint32(12,r,!0),i.setUint32(16,s,!0);let o=[...t,...n,new Uint8Array(i.buffer)],a=new Uint8Array(o.reduce((f,g)=>f+g.length,0)),c=0;for(let f of o)a.set(f,c),c+=f.length;return a}var tc=["contradictions","contract","off","rules","text","telemetry","cleanup"],Om=e=>e.key==="spelling"||e.key==="telemetry"||!!e.fact?.startsWith("telemetry:")||e.fact==="node:LogCustomTelemetryEvent";function Am(e){if(e.key==="conflict"||e.key==="contradiction")return"contradictions";if(Om(e))return"telemetry";if(e.key==="contract"||e.key==="flow"||e.key==="off"&&e.fact?.startsWith("called-with:"))return"contract";if(e.key==="off")return"off";if(e.key==="gap")return"rules";if(e.key==="twice")return"text";if(e.key==="unused")return"cleanup"}var Ts=e=>/«([^»]*)»/.exec(e)?.[1]??"";function Nm(e,t,n){let s=i=>ne(e.fact??"",i,n.names),r=e.fact??"";if(r==="trigger:OnEscalate")return{en:"Learn to hand over to a person",pt:"Aprender a encaminhar para uma pessoa"};if(e.key==="contradiction")return{en:`Remove \xAB${s("en")}\xBB`,pt:`Tirar \xAB${s("pt")}\xBB`};if(e.key==="contract"&&r.startsWith("calls:")){let i=Ts(e.en);return{en:`Bring \xAB${i}\xBB into the folder, or remove the call`,pt:`Trazer \xAB${i}\xBB para a pasta, ou tirar a chamada`}}if(r==="routing:described")return{en:"Write the routing description: what it solves",pt:"Escrever a descri\xE7\xE3o de roteamento: o que ele resolve"};if(e.key==="flow"){let i=Ts(e.en);return{en:`Make the flow \xAB${i}\xBB return its result`,pt:`Fazer o fluxo \xAB${i}\xBB devolver o resultado`}}if(e.key==="spelling")return{en:`Name the event like the others: \xAB${$e(r.slice(16),"en")}\xBB`,pt:`Chamar o evento como os outros: \xAB${$e(r.slice(16),"pt")}\xBB`};if(e.key==="telemetry"&&!r)return{en:"Connect the telemetry to Application Insights",pt:"Ligar a telemetria ao Application Insights"};if(e.key==="telemetry"){let i=Ts(e.en);return{en:`Check that the event \xAB${i}\xBB fires`,pt:`Conferir se o evento \xAB${i}\xBB dispara`}}if(r.startsWith("telemetry:field:")){let[i,o]=r.slice(16).split("/");return{en:`Log \xAB${o}\xBB in the event \xAB${$e(i,"en")}\xBB`,pt:`Registrar \xAB${o}\xBB no evento \xAB${$e(i,"pt")}\xBB`}}if(r==="node:LogCustomTelemetryEvent")return{en:"Log telemetry",pt:"Registrar telemetria"};if(r.startsWith("text:block:")&&n.offPattern.some(i=>i.agent===t&&i.key===r&&i.variant))return{en:`Align the official block \xAB${s("en")}\xBB`,pt:`Alinhar o bloco oficial \xAB${s("pt")}\xBB`};if(r.startsWith("text:block:"))return{en:`Use the official block \xAB${s("en")}\xBB`,pt:`Usar o bloco oficial \xAB${s("pt")}\xBB`};if(r==="declared:kpi")return{en:"Declare a goal (KPI)",pt:"Declarar uma meta (KPI)"};if(e.key==="twice")return{en:`Settle on one \xAB${s("en")}\xBB`,pt:`Escolher um s\xF3 \xAB${s("pt")}\xBB`};if(e.key==="unused"){let i=n.unused.find(g=>g.agent===t&&g.key===r);if(i?.how==="disabled"&&r.startsWith("disabled:node:")){let g=(i.sources[0]?.file??"").replace(/(\.topic)?\.mcs\.ya?ml$/,"");return{en:`Remove the switched-off node in \xAB${g}\xBB`,pt:`Remover o n\xF3 desligado em \xAB${g}\xBB`}}let o=r.split(":")[1],a=i?.name??Ts(e.en);if(o==="variable")return{en:`Remove the variable \xAB${a}\xBB`,pt:`Remover a vari\xE1vel \xAB${a}\xBB`};let f={flow:{en:"the flow",pt:"o fluxo"},topic:{en:"the topic",pt:"o t\xF3pico"},action:{en:"the tool",pt:"a ferramenta"},knowledge:{en:"the knowledge source",pt:"a fonte de conhecimento"}}[o]??{en:"",pt:""};return{en:`Remove or switch on ${f.en} \xAB${a}\xBB`.replace(" "," "),pt:`Remover ou ligar ${f.pt} \xAB${a}\xBB`.replace(" "," ")}}return e.key==="conflict"?{en:`Check \xAB${s("en")}\xBB against what was declared`,pt:`Conferir \xAB${s("pt")}\xBB com o declarado`}:{en:`Have \xAB${s("en")}\xBB`,pt:`Ter \xAB${s("pt")}\xBB`}}function Cs(e,t){let n=[];for(let r of e){let i=Am(r);if(i)for(let o of r.agents){let a=n.filter(c=>c.agent===o);if(!(r.fact&&a.some(c=>c.keys.includes(r.fact)))){if(r.fact?.startsWith("called-with:")){let c=a.find(l=>l.keys.some(p=>p.startsWith("called-with:"))),f=c??{agent:o,group:i,keys:[],en:"",pt:"",why:{en:"",pt:""}};c||n.push(f),f.keys.push(r.fact);let g=f.keys.map(l=>l==="called-with:history"?{en:"the conversation history",pt:"o hist\xF3rico da conversa"}:{en:`\xAB${l.slice(18)}\xBB`,pt:`\xAB${l.slice(18)}\xBB`}),u=l=>g.map(p=>p[l]).join(l==="pt"?" e ":" and ");f.en=`Receive ${u("en")} from the orchestrator`,f.pt=`Receber do gestor ${u("pt")}`,f.why={en:`${f.why.en} ${r.en}`.trim(),pt:`${f.why.pt} ${r.pt}`.trim()};continue}n.push({agent:o,group:i,keys:r.fact?[r.fact]:[],...Nm(r,o,t),why:{en:r.en,pt:r.pt}})}}}let s=[...new Set(t.agents.map(r=>r.id))];return n.sort((r,i)=>s.indexOf(r.agent)-s.indexOf(i.agent)||tc.indexOf(r.group)-tc.indexOf(i.group))}function Ti(e){let t=new Map,n=/^(connector|operation|mcp|flow-uses):/;for(let r of Object.keys(e.typeNames)){let i=e.agents.filter(a=>a.role==="specialist"&&(e.types[a.id]??[]).includes(r));if(i.length<2)continue;let o=[...new Set(i.flatMap(a=>Object.keys(a.facts).filter(c=>n.test(c))))].sort();for(let a of o){let c=i.filter(u=>a in u.facts);if(c.length!==1)continue;let f=`${c[0].id} ${a}`,g=t.get(f)??{agent:c[0].id,key:a,types:[]};g.types.push(r),t.set(f,g)}}return[...t.values()].filter(r=>!(r.key.startsWith("operation:")&&t.has(`${r.agent} connector:${r.key.slice(10,r.key.indexOf("/"))}`))).map(r=>{let i=r.types.map(c=>e.typeNames[c]??c),o=c=>ne(r.key,c,e.names),a=c=>i.map(f=>`\xAB${f}\xBB`).join(c==="pt"?" e ":" and ");return{agent:r.agent,types:r.types,typeNames:i,key:r.key,en:`\xAB${o("en")}\xBB \u2014 only it has this in ${i.length>1?"the types":"the type"} ${a("en")}: does the post need it?`,pt:`\xAB${o("pt")}\xBB \u2014 s\xF3 ele tem ${i.length>1?"nos tipos":"no tipo"} ${a("pt")}: o cargo precisa?`}})}var Em={"trigger:OnEscalate":{en:"Hands over to a person (escalation)",pt:"Sabe encaminhar para uma pessoa (escalonamento)"},"called-with:history":{en:"Gets the conversation history from the orchestrator",pt:"Recebe do gestor o hist\xF3rico da conversa"},"node:LogCustomTelemetryEvent":{en:"Logs its own errors (telemetry)",pt:"Registra os pr\xF3prios erros (telemetria)"},"declared:kpi":{en:"Has a goal (KPI)",pt:"Tem uma meta (KPI)"},"declared:owner":{en:"Has an owner",pt:"Tem um respons\xE1vel"},"declared:team":{en:"Has a team",pt:"Tem uma equipe"}},hn=(e,t,n={})=>Em[e]?.[t]??(Fl(e)?ne(e,t,n):t==="pt"?`Tem \xAB${ne(e,t,n)}\xBB`:`Has \xAB${ne(e,t,n)}\xBB`);var xm=["owner","environment","created-on","last-published"],Tm=e=>/^\s*([^\n]*?[.!?])(\s|$)/.exec(e)?.[1].trim()??e.split(`
|
|
160
|
+
`)[0].trim(),Cm=e=>{let t=e.split(`
|
|
161
|
+
`),n=t.findIndex(r=>/^\s*([-*•]|\d+[.)])\s+/.test(r));if(n<0)return[];let s=[];for(let r of t.slice(n)){let i=/^\s*(?:[-*•]|\d+[.)])\s+(.*)$/.exec(r);if(!i)break;s.push(i[1].trim())}return s.slice(0,5)};function Ci(e,t,n,s,r,i,o){let a=E=>e.agents.find(A=>A.id===E)?.displayName??E,c=(E,A)=>{let I=s.declared.find(Y=>Y.agent===E&&Y.key===A);return I&&{value:I.value,source:I.source}},f=s.declared.some(E=>xm.includes(E.key)),g=s.declared.some(E=>E.key==="team"||E.key==="kpi"),u=Ti(e),l=[...Cs(t,e),...u.flatMap(E=>{let A=s.decisions.find(Y=>Y.key===E.key&&Y.status==="rejected"&&E.types.some(G=>Y.scope===`type:${G}`)),I=A?e.typeNames[A.scope.slice(5)]??A.scope.slice(5):"";return A?[{agent:E.agent,group:"cleanup",keys:[E.key],en:`Remove the access \xAB${ne(E.key,"en",e.names)}\xBB`,pt:`Tirar o acesso \xAB${ne(E.key,"pt",e.names)}\xBB`,why:{en:`The team decided the post \xAB${I}\xBB does not need it.`,pt:`O time decidiu que o cargo \xAB${I}\xBB n\xE3o precisa.`}}]:[]})],p=e.contract.missing.map(E=>({id:E.calls,name:E.name??E.calls,caller:E.caller})),d=e.agents.map(E=>c(E.id,"environment")?.value).filter(E=>!!E),m=[...new Set(d)].sort((E,A)=>d.filter(I=>I===A).length-d.filter(I=>I===E).length)[0],y=E=>{let A=[],I=c(E,"environment")?.value;return I&&m&&I!==m&&A.push("hiring"),f&&!c(E,"owner")&&A.push("noOwner"),f&&c(E,"created-on")&&!c(E,"last-published")&&A.push("neverPublished"),o&&!o.some(Y=>Y.agent===E)&&A.push("noEval"),A.push(l.some(Y=>Y.agent===E&&Y.group!=="cleanup")?"pdi":"ok"),A},k=E=>({id:E,name:a(E),situation:y(E)}),v=e.agents.map(E=>E.id),S=E=>E.map(A=>({id:A,name:a(A)})),T=p.map(E=>({id:E.id,name:E.name})),N=[{key:"cast",people:S(v)},{key:"hiring",people:[...T,...S(v.filter(E=>y(E).includes("hiring")))]},...f?[{key:"noOwner",people:S(v.filter(E=>y(E).includes("noOwner")))},{key:"neverPublished",people:S(v.filter(E=>y(E).includes("neverPublished")))}]:[],...o?[{key:"noEval",people:S(v.filter(E=>y(E).includes("noEval")))}]:[],{key:"pdi",people:S(v.filter(E=>y(E).includes("pdi")))},{key:"ok",people:S(v.filter(E=>y(E).includes("ok")))}],P=e.agents.filter(E=>E.role==="orchestrator").map(E=>k(E.id)),M=e.agents.filter(E=>E.role==="specialist"),C=[...new Set(M.flatMap(E=>e.types[E.id]??[]))],$=[...C.map(E=>({id:E,name:e.typeNames[E]??E,people:M.filter(A=>(e.types[A.id]??[])[0]===E).map(A=>({...k(A.id),...(e.types[A.id]??[]).length>1?{alsoIn:(e.types[A.id]??[]).slice(1).map(I=>e.typeNames[I]??I)}:{}}))})).filter(E=>E.people.length),...M.some(E=>!(e.types[E.id]??[]).length)?[{id:"",name:"",people:M.filter(E=>!(e.types[E.id]??[]).length).map(E=>k(E.id))}]:[]],L=(E,A)=>({key:E,en:hn(E,"en",e.names),pt:hn(E,"pt",e.names),proposal:A}),K=(E,A,I)=>{let Y=e.patterns.filter(q=>!q.partOf&&(q.scope===E||E!=="platform"&&q.scope==="platform")),G=Y.filter(q=>q.decision?.status==="accepted"),w=new Set(e.offPattern.map(q=>q.key)),h=G.length?G.map(q=>L(q.key,!1)):Y.filter(q=>w.has(q.key)).map(q=>L(q.key,!0)),O=r.filter(q=>q.has&&(!q.role||q.role===I)&&!h.some(B=>B.key===q.has)).map(q=>L(q.has,!1));return{scope:E,name:A,requirements:[...h,...O]}},J=[K("specialist",{en:"Specialist",pt:"Especialista"},"specialist"),...C.map(E=>K(`type:${E}`,{en:`Specialist \xB7 ${e.typeNames[E]??E}`,pt:`Especialista \xB7 ${e.typeNames[E]??E}`},"specialist")),...P.length?[K("orchestrator",{en:"Orchestrator",pt:"Orquestrador"},"orchestrator")]:[]],fe=e.agents.map(E=>{let I=n.find(U=>U.id===E.id)?.texts.find(U=>U.source==="instructions")?.text??"",Y=Object.keys(E.facts),G=U=>({en:ne(U,"en",e.names),pt:ne(U,"pt",e.names)}),w=Y.filter(U=>/^(operation|mcp|flow-uses|knowledge):/.test(U)&&!U.startsWith("knowledge:count")).map(G),h=Y.filter(U=>U.startsWith("text:")&&!U.endsWith("~variant")).map(G),O=e.contract.routes.find(U=>U.agent===E.id)?.caller,q=e.telemetry.events.filter(U=>U.agent===E.id),B=i&&{days:i.days,starts:i.rows.filter(U=>U.agent===E.id&&U.event==="TopicStart").reduce((U,Ae)=>U+Ae.count,0),errors:q.reduce((U,Ae)=>U+(Ae.fired??0),0),notFired:e.telemetry.notFired.filter(U=>U.agent===E.id).map(U=>U.name),silent:e.telemetry.silent.includes(E.id)},ee=[...new Set(["YAML",...i?[i.file]:[],...(o??[]).filter(U=>U.agent===E.id).map(U=>U.file),...s.declared.filter(U=>U.agent===E.id).map(U=>U.source.split(" \u203A ")[0])])],ie=l.filter(U=>U.agent===E.id);return{id:E.id,name:a(E.id),role:E.role==="orchestrator"?"orchestrator":"specialist",types:(e.types[E.id]??[]).map(U=>e.typeNames[U]??U),...I?{title:Tm(I)}:{},...O?{manager:a(O)}:{},...c(E.id,"team")?{team:c(E.id,"team")}:{},...c(E.id,"owner")?{owner:c(E.id,"owner")}:{},...c(E.id,"created-on")?{created:c(E.id,"created-on")}:{},...c(E.id,"last-published")?{published:c(E.id,"last-published")}:{},...E.schemaName?{schemaName:E.schemaName}:{},...c(E.id,"environment")?{environment:c(E.id,"environment")}:{},summary:Cm(I),tools:w,conduct:h,...c(E.id,"kpi")?{goal:c(E.id,"kpi")}:{},...B?{performance:B}:{},...o?{certifications:o.filter(U=>U.agent===E.id)}:{},access:u.filter(U=>U.agent===E.id),pdi:ie,sources:ee,seal:ie.some(U=>U.group!=="cleanup")?"pdi":"ok"}}),Oe=[...f?[]:["inventory"],...g?[]:["team"],...i?[]:["telemetry"]];return{...e.name?{name:e.name}:{},staff:N,missing:Oe,org:{orchestrators:P,types:$,ghosts:p},posts:J,resumes:fe}}var Pm=e=>ec(e),qm={bold:!0,fill:"E8EEF7"},Lm={v:"\u25CF",fill:"DDF3E6",center:!0},Mm={v:"\xD7",fill:"FFD5CC",center:!0,bold:!0},Im={v:"\u25D0",fill:"FFF3C4",center:!0},Rm={v:"\u2248",fill:"FFF6DC",center:!0,bold:!0},nc=Object.keys(ki);function Fm(e,t,n,s="en"){let r=xs[s],i=(w,h,O)=>({key:w,name:r[w],header:!0,columns:h.map(([q,B])=>({title:q,width:B})),rows:[h.map(([q])=>({v:q,...qm})),...O]}),o=w=>r[e.roles[w]],a=w=>w.startsWith("type:")?`${r.type}:${e.typeNames[w.slice(5)]??w.slice(5)}`:r[w],c=w=>(e.types[w]??[]).map(h=>e.typeNames[h]??h).join(" \xB7 "),f=w=>ne(w,s,e.names),g=[...e.agents].sort((w,h)=>w.role===h.role?w.id.localeCompare(h.id):w.role==="orchestrator"?-1:1),u=[...new Set([...g.flatMap(w=>Object.keys(w.facts)),...e.patterns.map(w=>w.key)])].filter(w=>!w.endsWith("~variant")).sort((w,h)=>nc.indexOf(un(w))-nc.indexOf(un(h))||w.localeCompare(h)),l=new Set(e.offPattern.map(w=>`${w.agent} ${w.key}`)),p=w=>e.agents.filter(h=>h.role===w).length,d={key:"summary",name:r.summary,header:!1,columns:[{title:"",width:28},{title:"",width:100}],rows:[[{v:e.name??r.title,bold:!0},""],[{v:r.privacy,color:"B42318"},""],[r.count.agents,e.agents.length],[r.count.orchestrators,p("orchestrator")],[r.count.specialists,p("specialist")],[r.count.patterns,e.patterns.length],[r.count.off,new Set(e.offPattern.map(w=>w.agent)).size],[r.count.gaps,e.gaps.length],[r.count.conflicts,e.conflicts.length],[r.count.solos,t.filter(w=>w.key==="solo").length],[r.count.unused,e.unused.length],["",""],[{v:t.length?r.look:r.nothing,bold:!0},""],...Ei(t).flatMap(w=>[[{v:`${w[s]} \xB7 ${w.looks.length}`,bold:!0},""],...w.looks.map(({look:h})=>["",{v:h[s],wrap:!0}])])]},m=i("matrix",[[r.dimension,18],[r.fact,40],[r.key,34],...g.map(w=>[w.id,14])],u.map(w=>[ki[un(w)][s],f(w),w,...g.map(h=>w in h.facts?w.startsWith("declared:")?Im:Lm:`${w}~variant`in h.facts?Rm:l.has(`${h.id} ${w}`)?Mm:"")])),{look:y,everyone:k}=ot(e),v=i("patterns",[[r.key,34],[r.fact,40],[r.scope,14],[r.role,14],[r.share,10],[r.have,50],[r.lack,40],[r.decision,12],[r.why,50]],[...y,...k].map(w=>{let h=e.offPattern.filter(O=>O.key===w.key).map(O=>O.agent);return[w.key,f(w.key),a(w.scope),r[w.role],`${Math.round(w.share*100)}%`,w.agents.join(", "),h.join(", "),w.decision?r[w.decision.status==="accepted"?"accept":"reject"]:"",w.decision?.why??""]})),S=i("off",[[r.agent,24],[r.role,14],[r.missing,44],[r.key,34],[r.scope,14],[r.accepted,14]],e.offPattern.map(w=>[w.agent,o(w.agent),f(w.key),w.key,a(w.scope),e.patterns.find(h=>h.key===w.key)?.decision?.status==="accepted"?r.yes:""])),T=i("gaps",[[r.rule,16],[r.says,50],[r.role,14],[r.notMet,60]],e.gaps.map(w=>[w.rule.id,w.rule.says,w.rule.role?r[w.rule.role]:"",w.agents.join(", ")])),N=i("conflicts",[[r.agent,24],[r.fact,40],[r.key,34],[r.declared,20],[r.source,40],[r.inYaml,12]],e.conflicts.map(w=>[w.agent,f(w.key),w.key,w.declared,w.source,w.observed?r.yes:r.no])),P=i("agents",[[r.agent,24],[r.name,32],[r.role,14],[r.types,24],[r.facts,8],[r.off,44],[r.alone,44],[r.children,24],[r.unknown,12]],g.map(w=>[w.id,w.displayName??"",r[w.role],c(w.id),Object.keys(w.facts).length,e.offPattern.filter(h=>h.agent===w.id).map(h=>f(h.key)).join("; "),e.solos.filter(h=>h.agents[0]===w.id).map(h=>f(h.key)).join("; "),w.children.map(h=>h.name).join(", "),e.unknown.filter(h=>h.agent===w.id).length||""])),M=i("evidence",[[r.agent,30],[r.fact,40],[r.key,34],[r.file,50],[r.line,8]],g.flatMap(w=>[{who:w.id,facts:w.facts},...w.children.map(h=>({who:`${w.id} \u203A ${h.name}`,facts:h.facts}))]).flatMap(({who:w,facts:h})=>Object.entries(h).sort(([O],[q])=>O.localeCompare(q)).flatMap(([O,q])=>q.map(B=>[w,f(O),O,B.file,B.line??""])))),C=i("declared",[[r.agent,24],[r.key,34],[r.value,40],[r.source,40]],n.declared.map(w=>[w.agent,w.key,w.value,w.source])),$=i("text",[[r.id,28],[r.label,36],[r.body,70],[r.have,50],[r.variant,40],[r.official,10]],e.blocks.map(w=>[w.id,w.official??w.label,{v:w.text,wrap:!0},Object.keys(w.holders).sort().join(", "),Object.entries(w.variants).sort(([h],[O])=>h.localeCompare(O)).map(([h,O])=>`${h} (${Math.round(O.similarity*100)}%)`).join(", "),w.official?r.yes:""])),L=i("routing",[[r.caller,24],[r.called,30],[r.history,10],[r.inputs,30],[r.routingText,70],[r.chars,10],[r.file,44]],e.contract.routes.map(w=>[w.caller,w.agent??`${w.name??w.calls} (${r.notInFolder})`,w.history?r.yes:r.no,w.inputs.join(", "),{v:w.description,wrap:!0},w.description.length,`${w.file}${w.line?`:${w.line}`:""}`])),K=e.telemetry.days,J=i("telemetry",[[r.agent,24],[r.written,30],[r.form,28],[r.fields,50],[r.file,44],...K?[[r.fired(K),16]]:[]],e.telemetry.events.map(w=>[w.agent,w.name,$e(w.as,s),w.fields?w.fields.join(", "):r.notRead,`${w.file}${w.line?`:${w.line}`:""}`,...K?[w.fired===void 0||e.telemetry.silent.includes(w.agent)?"\u2014":w.fired===0?{v:0,color:"B42318",bold:!0}:w.fired]:[]])),fe=i("unused",[[r.agent,24],[r.what,16],[r.name,30],[r.how,14],[r.file,50]],e.unused.flatMap(w=>w.sources.map(h=>[w.agent,r.thing[w.what]??w.what,e.names[w.name]??w.name,r[w.how],`${h.file}${h.line?`:${h.line}`:""}`]))),Oe=Ci(e,t,[],n,[]),E=w=>Oe.staff.filter(h=>h.key!=="cast"&&h.people.some(O=>O.id===w)).map(h=>r.situation[h.key]).join(", "),A=Cs(t,e),I=i("staff",[[r.agent,24],[r.name,32],[r.situation_,34],[r.manager,24],[r.teamCol,22],[r.ownerCol,30],[r.hired,14],[r.publishedCol,14],[r.items,10]],Oe.resumes.map(w=>[w.id,w.name,E(w.id),w.manager??"",w.team?.value??"",w.owner?.value??"",w.created?.value??"",w.published?.value??"",A.filter(h=>h.agent===w.id).length||""])),Y=i("pdi",[[r.agent,24],[r.item,60],[r.why,70],[r.key,40],[r.group,18]],A.map(w=>[w.agent,w[s],{v:w.why[s],wrap:!0},w.keys.join(", "),r.pdiGroup[w.group]])),G=[d,m,v,...e.blocks.length?[$]:[],...e.contract.routes.length?[L]:[],...e.telemetry.events.length?[J]:[],S,T,N,...e.unused.length?[fe]:[],P,I,...A.length?[Y]:[],M,C];return e.unknown.length&&G.push(i("unknown",[[r.agent,24],[r.file,50],[r.why,40],[r.kind,24]],e.unknown.map(w=>[w.agent,w.file,r.why_[w.why],w.kind??""]))),G}var Fe=e=>String(e??"").normalize("NFD").replace(/[̀-ͯ]/g,"").trim().toLowerCase(),mn=Object.values(xs),sc=(e,t)=>e.find(n=>mn.some(s=>Fe(s[t])===Fe(n.name)));function rc(e,...t){let n=t.map(s=>e?.rows[0]?.findIndex(r=>mn.some(i=>Fe(i[s])===Fe(r)))??-1);return s=>n.map(r=>r<0?"":String(s[r]??"").trim())}var ic=(e,t)=>t.find(([,n])=>mn.some(s=>Fe(s[n])===Fe(e)))?.[0],oc=e=>e.slice(1).filter(t=>t.some(n=>String(n??"").trim())),ac=(e,t)=>JSON.stringify(e)===JSON.stringify(t);function jm(e,t,n={}){let s=[],r=[],i=sc(t,"declared");if(i){let a=rc(i,"agent","key","value","source"),c=[];oc(i.rows).forEach((u,l)=>{let[p,d,m,y]=a(u);!p||!d?r.push(`${i.name}, ${l+2}: \xAB${a(i.rows[0])[p?1:0]}\xBB ?`):c.push({agent:p,key:d,value:m,source:y})});let f=u=>`${u.agent} ${u.key}`,g=0;for(let u of c){let l=e.declared.find(p=>f(p)===f(u));l?ac(l,u)||s.push({key:`d${++g}`,kind:"declared",op:"set",before:l,after:u}):s.push({key:`d${++g}`,kind:"declared",op:"add",after:u})}for(let u of e.declared)c.some(l=>f(l)===f(u))||s.push({key:`d${++g}`,kind:"declared",op:"remove",before:u})}let o=sc(t,"patterns");if(o){let a=rc(o,"key","scope","decision","why"),c=0;for(let f of oc(o.rows)){let[g,u,l,p]=a(f);if(!g)continue;let d=e.decisions.find(S=>S.key===g);if(!l){d&&s.push({key:`p${++c}`,kind:"decision",op:"remove",before:d});continue}let m=ic(l,[["accepted","accept"],["rejected","reject"]]),y=/^(tipo|type)\s*:\s*(.+)$/i.exec(u),k=y?Object.entries(n).find(([S,T])=>Fe(T)===Fe(y[2])||Fe(S)===Fe(y[2]))?.[0]:void 0,v=y?k?`type:${k}`:void 0:ic(u,[["platform","platform"],["specialist","specialist"],["orchestrator","orchestrator"]]);if(!m)r.push(`${o.name}, ${g}: \xAB${l}\xBB \u2014 ${mn.map(S=>`${S.accept}/${S.reject}`).join(", ")}`);else if(!v)r.push(`${o.name}, ${g}: \xAB${u}\xBB \u2014 ${mn.map(S=>`${S.platform}/${S.specialist}/${S.orchestrator}`).join(", ")}`);else{let S={key:g,status:m,scope:v,why:p};d?ac(d,S)||s.push({key:`p${++c}`,kind:"decision",op:"set",before:d,after:S}):s.push({key:`p${++c}`,kind:"decision",op:"add",after:S})}}}return{changes:s,problems:r}}function Dm(e,t,n){let s={...e,declared:[...e.declared],decisions:[...e.decisions]};for(let r of t.filter(i=>n.includes(i.key)))if(r.kind==="declared"){let i=a=>`${a.agent} ${a.key}`,o=r.before?s.declared.findIndex(a=>i(a)===i(r.before)):-1;r.op==="add"?s.declared.push(r.after):r.op==="set"?s.declared[o]=r.after:s.declared.splice(o,1)}else{let i=r.before?s.decisions.findIndex(o=>o.key===r.before.key):-1;r.op==="add"?s.decisions.push(r.after):r.op==="set"?s.decisions[i]=r.after:s.decisions.splice(i,1)}return s}var yn="#8C8578";var Ps="#C8442C",cc="#2E8F62";var lc=e=>Math.round(e*10)/10,gn=e=>[lc(e[0]),lc(e[1])],Be=(e,t,n=22,s="start",r)=>({type:"text",at:gn(e),text:t,size:n,anchor:s,...r?{style:{color:r}}:{}}),fc=(e,t,n)=>({type:"line",from:gn(e),to:gn(t),...n?{style:n}:{}}),uc=(e,t,n)=>({type:"arrow",from:gn(e),to:gn(t),...n?{style:n}:{}});var _m=(e,t)=>e.length*t*.48;function qs(e,t,n){let s=[],r="";for(let i of e.split(/\s+/).filter(Boolean)){let o=r?`${r} ${i}`:i;r&&_m(o,t)>n?(s.push(r),r=i):r=o}return r&&s.push(r),s.length?s:[""]}var Ot=150,bn=40,Bm=24,dc=250,pc="#7B4FC9",hc=17,mc=23,Pi=5,qi=4,Km=/^(auth|model|setting|topics|connref|operation):/,Um={en:{chapters:["The cast","What repeats","Who is off","What is missing","What to decide"],cast:(e,t)=>e?`${e} ${e===1?"orchestrator calls":"orchestrators call"} ${t} ${t===1?"specialist":"specialists"}.`:`${t} ${t===1?"specialist":"specialists"}, with no orchestrator.`,repeats:(e,t,n)=>e?`${e} patterns: ${t} of the platform, ${n} of the specialists.`:"Nothing repeats enough to be a pattern yet.",off:e=>e.length?`Off a pattern: ${e.join(", ")}.`:"Nobody is off a pattern.",missing:e=>e?`${e} ${e===1?"rule is":"rules are"} not met.`:"Every rule is met.",decide:e=>e?`${e} ${e===1?"thing":"things"} to decide.`:"Nothing left to decide.",unused:e=>`${e} ${e===1?"thing nobody uses or switched off":"things nobody uses or switched off"}: remove or switch on?`,pattern:e=>`A pattern? \xAB${e}\xBB`,platform:"platform",specialist:"specialists",more:e=>`and ${e} more on the map`,none:"nothing"},pt:{chapters:["O elenco","O que se repete","Quem est\xE1 fora","O que falta","O que decidir"],cast:(e,t)=>e?`${e} ${e===1?"orquestrador chama":"orquestradores chamam"} ${t} ${t===1?"especialista":"especialistas"}.`:`${t} ${t===1?"especialista":"especialistas"}, sem orquestrador.`,repeats:(e,t,n)=>e?`${e} padr\xF5es: ${t} da plataforma, ${n} dos especialistas.`:"Nada se repete o bastante para ser padr\xE3o ainda.",off:e=>e.length?`Fora do padr\xE3o: ${e.join(", ")}.`:"Ningu\xE9m est\xE1 fora do padr\xE3o.",missing:e=>e?`${e} ${e===1?"regra n\xE3o \xE9 cumprida":"regras n\xE3o s\xE3o cumpridas"}.`:"Todas as regras s\xE3o cumpridas.",decide:e=>e?`${e} ${e===1?"coisa":"coisas"} para decidir.`:"Nada em aberto para decidir.",unused:e=>`${e} ${e===1?"coisa sem uso ou desligada":"coisas sem uso ou desligadas"}: remover ou ligar?`,pattern:e=>`Padr\xE3o? \xAB${e}\xBB`,platform:"plataforma",specialist:"especialistas",more:e=>`e mais ${e} no mapa`,none:"nada"}};function Wm(e,t,n="en"){let s=Um[n],r=e.agents.filter(A=>A.role==="orchestrator").sort((A,I)=>A.id.localeCompare(I.id)),i=Object.keys(e.typeNames),o=A=>{let I=(e.types[A]??[])[0];return I===void 0?i.length:i.indexOf(I)},a=e.agents.filter(A=>A.role==="specialist").sort((A,I)=>o(A.id)-o(I.id)||A.id.localeCompare(I.id)),c=i.length>0&&a.some(A=>(e.types[A.id]??[]).length),f=c?390:340,g=Math.max(1,Math.ceil(a.length/Bm)),u=Math.max(1,Math.ceil(a.length/g)),l=Math.max(1e3,bn*2+Math.max(u,r.length)*Ot),p=(A,I)=>l/2+(A-(I-1)/2)*Ot,d=A=>Ml(A)?0:Km.test(A)?2:1,m=[{...Be([bn,52],e.name??s.chapters[0],30),chapter:s.chapters[0],say:`${e.name?`${e.name}: `:""}${s.cast(r.length,a.length)}`}],y=(A,I,Y)=>qs(A,15,Ot-12).slice(0,2).forEach((G,w)=>m.push(Be([I[0],I[1]+w*18],G,15,"middle",Y))),k=170,v=new Map;r.forEach((A,I)=>{let Y=p(I,r.length);v.set(A.id,[Y,k]),m.push({type:"prop",name:"robot",at:[Y,k],size:70}),y(A.id,[Y,k+24],yn)}),a.forEach((A,I)=>{let Y=Math.floor(I/u),G=Math.min(u,a.length-Y*u),w=[p(I%u,G),f+Y*dc];v.set(A.id,w),m.push({type:"prop",name:"robot",at:w,size:64}),y(A.id,[w[0],w[1]+24])});for(let A of r){let I=v.get(A.id);for(let Y of a.filter(G=>G.schemaName&&`calls:${G.schemaName}`in A.facts)){let G=v.get(Y.id);G[1]===f&&m.push(uc([I[0],I[1]+44],[G[0],G[1]-(c?118:76)],{color:yn}))}}if(c){let A=[];a.forEach(I=>{let Y=(e.types[I.id]??[])[0],G=Y===void 0?n==="pt"?"sem tipo":"no type":e.typeNames[Y]??Y,[w,h]=v.get(I.id),O=A[A.length-1];O&&O.name===G&&O.y===h?O.xs.push(w):A.push({name:G,xs:[w],y:h})});for(let I of A){let[Y,G]=[Math.min(...I.xs),Math.max(...I.xs)];m.push(Be([(Y+G)/2,I.y-92],I.name,16,"middle",pc),fc([Y-Ot/2+14,I.y-84],[G+Ot/2-14,I.y-84],{color:pc}))}}let S=f+(g-1)*dc+160,T=(l-bn*2)/3,N=S,P=(A,I,Y,G,w)=>{let h=bn+A*T;m.push({...Be([h,S],I,22,"start",w),chapter:I,say:Y});let O=S+34,q=G.slice(0,Pi);G.length>Pi&&q.push(s.more(G.length-Pi)),q.length||q.push(s.none);for(let B of q){let ee=qs(B,hc,T-30),ie=ee.length>qi?[...ee.slice(0,qi-1),`${ee[qi-1]}\u2026`]:ee;ie.forEach((U,Ae)=>m.push(Be([h+(Ae?14:0),O+Ae*mc],`${Ae?"":"\xB7 "}${U}`,hc,"start",yn))),O+=ie.length*mc+6}N=Math.max(N,O)},M=e.patterns.filter(A=>!A.partOf).sort((A,I)=>d(A.key)-d(I.key)||(A.scope===I.scope?0:A.scope==="platform"?-1:1)||I.share-A.share||A.key.localeCompare(I.key)),C=A=>A==="platform"?s.platform:s.specialist;P(0,s.chapters[1],s.repeats(e.patterns.length,e.patterns.filter(A=>A.scope==="platform").length,e.patterns.filter(A=>A.scope!=="platform").length),M.map(A=>`${ne(A.key,n,e.names)} \xB7 ${C(A.scope)}${A.share<1?` \xB7 ${Math.round(A.share*100)}%`:""}`),cc);let $=[...new Set(e.offPattern.map(A=>A.agent))].sort();$.forEach((A,I)=>{let Y=v.get(A),G=h=>h.variant?`${n==="pt"?"varia\xE7\xE3o de":"a variation of"} \xAB${ne(h.key,n,e.names)}\xBB`:Os(h.key,n,1,e.names),w=e.offPattern.filter(h=>h.agent===A).sort((h,O)=>d(h.key)-d(O.key)).flatMap(h=>qs(G(h),13,Ot-10)).slice(0,4);m.push({...Be([Y[0]+34,Y[1]-50],"\xD7",30,"middle",Ps),...I===0?{chapter:s.chapters[2],say:s.off($)}:{}}),w.forEach((h,O)=>m.push(Be([Y[0],Y[1]+66+O*16],h,13,"middle",Ps)))}),$.length||m.push({...Be([l-bn,92],s.off([]),16,"end",yn),chapter:s.chapters[2],say:s.off([])});let L=e.gaps.flatMap(A=>{let I=A.agents.filter(Y=>!e.offPattern.some(G=>G.agent===Y&&G.key===A.rule.has)).length;return I?[n==="pt"?`\xAB${A.rule.says}\xBB: ${I}${A.rule.role?` ${Ee(A.rule.role,n,I)}`:""} n\xE3o ${I===1?"cumpre":"cumprem"}`:`\xAB${A.rule.says}\xBB: ${I}${A.rule.role?` ${Ee(A.rule.role,n,I)}`:""} ${I===1?"does":"do"} not meet it`]:[]});L.push(...t.filter(A=>A.key==="telemetry").map(A=>A[n]),...t.filter(A=>A.key==="contract"||A.key==="flow").map(A=>A[n]));let K=e.unknown.length;K&&L.push(n==="pt"?`${K} ${K===1?"arquivo n\xE3o entendido":"arquivos n\xE3o entendidos"}`:`${K} ${K===1?"file":"files"} not understood`),P(1,s.chapters[3],s.missing(t.filter(A=>A.key==="gap").length),L,Ps);let J=t.filter(A=>A.key==="unused").length,{look:fe}=ot(e),Oe=[...t.filter(A=>A.key==="conflict"||A.key==="spelling"||A.key==="values"||A.key==="twice").map(A=>A[n]),...J?[s.unused(J)]:[],...fe.filter(A=>!A.decision).map(A=>s.pattern(ne(A.key,n,e.names))),...t.filter(A=>A.key==="solo").map(A=>A[n])];return P(2,s.chapters[4],s.decide(Oe.length),Oe),{id:(e.name??"cast").toLowerCase().normalize("NFD").replace(/[̀-ͯ]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,60)||"cast",title:e.name??s.chapters[0],width:l,height:Math.min(4e3,N+40),background:"plain",locale:n==="pt"?"pt-BR":"en-US",steps:m}}var At={client:80,orchestrator:290,specialist:590,flow:880,system:1110},at=96,Li=110,gc=46,V=(e,t)=>({en:e,pt:t});function Ym(e,t,n,s){let r=b=>e.agents.find(D=>D.id===b)?.displayName??b,i=b=>e.typeNames[b]??b,o=new Set(s?e.telemetry.silent:[]),a=b=>s&&!o.has(b)?s.rows.filter(D=>D.agent===b&&D.event==="TopicStart").reduce((D,H)=>D+H.count,0):void 0,c=[],f=[],g=[],u=e.agents.filter(b=>b.role==="specialist"),l=[...new Set(u.flatMap(b=>e.types[b.id]??[]))],p=new Set,d=Li;for(let b of[...l,""]){let D=u.filter(F=>!p.has(F.id)&&(b?(e.types[F.id]??[])[0]===b:!(e.types[F.id]??[]).length));if(!D.length)continue;let H=d-34;for(let F of D){p.add(F.id);let z=(e.types[F.id]??[]).map(i);c.push({id:F.id,kind:"specialist",label:r(F.id),sub:z.length?V(z.join(" \xB7 "),z.join(" \xB7 ")):V("specialist","especialista"),x:At.specialist,y:d,...v(F.id)}),d+=at}b&&g.push({label:i(b),y1:H,y2:d-at+34}),d+=gc}let m=Math.max(d-gc-at,Li),y=Math.round((Li+m)/2),k=e.agents.filter(b=>b.role==="orchestrator");k.forEach((b,D)=>c.push({id:b.id,kind:"orchestrator",label:r(b.id),sub:V("routes and hands over","classifica e encaminha"),x:At.orchestrator,y:y+(D-(k.length-1)/2)*at,...v(b.id)})),c.unshift({id:"client",kind:"client",label:"",sub:V("who is served","quem \xE9 atendido"),x:At.client,y});function v(b){let D=a(b);return o.has(b)?{silent:!0}:D!==void 0?{volume:D}:{}}let S=b=>c.find(D=>D.id===b);for(let b of k)f.push({from:"client",to:b.id,kind:"traffic",...S(b.id)?.volume!==void 0?{volume:S(b.id).volume}:{},...o.has(b.id)?{dashed:!0}:{}});let T=b=>e.offPattern.filter(D=>D.agent===b&&D.key.startsWith("called-with:")),N=(b,D)=>T(b).map(H=>H.key==="called-with:history"?D==="pt"?"SEM hist\xF3rico":"NO history":`${D==="pt"?"SEM":"NO"} \xAB${H.key.slice(18)}\xBB`).join(" \xB7 "),P=m+at,M=0;for(let b of e.contract.routes){if(!b.agent){S(b.calls)||c.push({id:b.calls,kind:"ghost",label:b.name??b.calls,sub:V("called, not in the folder","chamado, fora da pasta"),x:At.orchestrator+40,y:P+M++*at}),f.push({from:b.caller,to:b.calls,kind:"traffic",tone:"ghost",dashed:!0,label:V("calls it, but it is not in the folder","chama, mas n\xE3o est\xE1 na pasta")});continue}let D=e.contract.short.some(z=>z.agent===b.agent&&z.caller===b.caller),H=T(b.agent).length,F=S(b.agent);f.push({from:b.caller,to:b.agent,kind:"traffic",...F?.volume!==void 0?{volume:F.volume}:{},...o.has(b.agent)?{dashed:!0}:{},...H?{tone:"bad",label:V(N(b.agent,"en"),N(b.agent,"pt"))}:D?{tone:"amber",label:V(`routed by \xAB${b.description}\xBB`,`roteado por \xAB${b.description}\xBB`)}:{}})}let C=b=>`flow:${b.id??b.name}`,$=b=>{if(b.startsWith("http:"))return{id:`sys:${b}`,label:b.slice(5),sub:V("HTTP","HTTP")};if(b.startsWith("connector:"))return{id:`sys:${b}`,label:cn(b.slice(10),e.names),sub:V("connector","conector")};if(b.startsWith("mcp:"))return{id:`sys:${b}`,label:cn(b.slice(4),e.names),sub:V("MCP server","servidor MCP")};if(b.startsWith("knowledge:")&&!b.startsWith("knowledge:count"))return{id:`sys:${b}`,label:ne(b,"en",e.names),labels:V(ne(b,"en",e.names),ne(b,"pt",e.names)),sub:V("knowledge","conhecimento")}},L=new Map,K=new Map,J=(b,D,H)=>{let F=$(b);if(!F)return;let z=K.get(F.id)??{...F,kind:"system",x:At.system,y:0,reach:[]};return z.reach.push({from:D,live:H}),K.set(F.id,z),F.id};for(let b of e.flows){if(!S(b.agent))continue;let H=C(b),F=L.get(H)??{id:H,kind:"flow",label:b.name,sub:V("flow","fluxo"),x:At.flow,y:0,unused:!0};b.called&&(F.unused=!1),L.set(H,F),f.push({from:b.agent,to:H,kind:"structure",...b.called?b.returns?{}:{tone:"amber",label:V("returns nothing","n\xE3o devolve nada")}:{tone:"ghost",dashed:!0,label:V("nobody calls it","ningu\xE9m chama")}})}for(let b of e.flows){let D=L.get(C(b));for(let H of b.uses){let F=J(H,S(b.agent).y,b.called);F&&!f.some(z=>z.from===D.id&&z.to===F)&&f.push({from:D.id,to:F,kind:"structure",...H.startsWith("http:")?{label:V("HTTP","HTTP")}:{},...b.called?{}:{tone:"ghost",dashed:!0}})}}for(let b of u){let D=Object.keys(b.facts);for(let H of D.filter(F=>F.startsWith("connector:")||F.startsWith("mcp:")||F.startsWith("knowledge:")&&!F.startsWith("knowledge:count"))){let F=J(H,S(b.id).y,!0),z=D.filter(pe=>pe.startsWith(`operation:${H.slice(10)}/`)).map(pe=>pe.slice(pe.indexOf("/")+1));F&&f.push({from:b.id,to:F,kind:"structure",...z.length?{label:V(z.join(", "),z.join(", "))}:{}})}}let fe=(b,D)=>{let H=b.map(z=>({n:z,want:D(z)})).sort((z,pe)=>z.want-pe.want||z.n.label.localeCompare(pe.n.label)),F=-1/0;for(let z of H)z.n.y=Math.round(Math.max(z.want,F+at*.82)),F=z.n.y},Oe=[...L.values()];fe(Oe,b=>yc(f.filter(D=>D.to===b.id).map(D=>S(D.from).y))),c.push(...Oe);let E=[...K.values()];for(let b of E)b.unused=!b.reach.some(D=>D.live);fe(E,b=>yc(f.filter(D=>D.to===b.id).map(D=>c.find(H=>H.id===D.from)?.y??y))),c.push(...E.map(({reach:b,...D})=>D));let A=e.agents.map(b=>b.id),I=b=>b==="platform"?A:b.startsWith("type:")?u.filter(D=>(e.types[D.id]??[]).includes(b.slice(5))).map(D=>D.id):e.agents.filter(D=>D.role===b).map(D=>D.id),Y=b=>b==="platform"?V("platform","de plataforma"):b.startsWith("type:")?V(`of the type \xAB${i(b.slice(5))}\xBB`,`do tipo \xAB${i(b.slice(5))}\xBB`):b==="orchestrator"?V("of the orchestrators","dos orquestradores"):V("of the specialists","dos especialistas"),{look:G}=ot(e),h=[...e.patterns.filter(b=>b.decision?.status==="accepted"),...G].filter((b,D,H)=>!b.partOf&&H.findIndex(F=>F.key===b.key&&F.scope===b.scope)===D).slice(0,8).map(b=>{let D=I(b.scope),H=e.offPattern.filter(j=>j.key===b.key&&j.scope===b.scope),F=H.filter(j=>!j.variant).map(j=>j.agent),z=H.filter(j=>j.variant).map(j=>j.agent),pe=D.filter(j=>!F.includes(j)&&!z.includes(j)),Ne=j=>j.map(r).join(", "),se=Y(b.scope),te=j=>[F.length?j==="pt"?`Fora: ${Ne(F)}.`:`Off: ${Ne(F)}.`:"",z.length?j==="pt"?`Varia\xE7\xE3o: ${Ne(z)}.`:`A variation: ${Ne(z)}.`:""].filter(Boolean).join(" ");return{id:`pattern:${b.key}`,name:V(ne(b.key,"en",e.names),ne(b.key,"pt",e.names)),caption:V(`\xAB${ne(b.key,"en",e.names)}\xBB \u2014 a pattern ${se.en} (${pe.length} of ${D.length}). ${te("en")}`.trim(),`\xAB${ne(b.key,"pt",e.names)}\xBB \u2014 padr\xE3o ${se.pt} (${pe.length} de ${D.length}). ${te("pt")}`.trim()),ok:pe,amber:z,bad:F}}),O=(b,D,H,F,z,pe)=>{let Ne=[...new Set(F)],se=[...new Set(z)].filter(te=>!Ne.includes(te));return{id:b,name:D,caption:H,bad:Ne,amber:se,ok:pe.filter(te=>!Ne.includes(te)&&!se.includes(te))}},q=e.contract.routes.flatMap(b=>b.agent?[b.agent]:[]),B=t.filter(b=>b.key==="flow"||b.key==="contract"&&b.fact==="routing:described");h.push(O("contract",V("Contract","Contrato"),V("What the orchestrator passes, and how it routes: red is what is missing; amber, a short routing description or a flow that returns nothing.","O que o orquestrador passa, e como encaminha: em vermelho o que falta; em \xE2mbar, uma descri\xE7\xE3o de roteamento curta ou um fluxo que n\xE3o devolve nada."),u.filter(b=>T(b.id).length).map(b=>b.id),B.flatMap(b=>b.agents),q));let ee=t.filter(b=>b.key==="spelling"||b.key==="telemetry"||b.fact?.startsWith("telemetry:")||b.fact==="node:LogCustomTelemetryEvent"),ie=[...o,...e.offPattern.filter(b=>b.key==="node:LogCustomTelemetryEvent").map(b=>b.agent)];h.push(O("telemetry",V("Telemetry","Telemetria"),V("Who logs, and what fires: red logs nothing or has no line; amber spells an event another way, misses a field, or has an event that did not fire.","Quem registra, e o que dispara: em vermelho quem n\xE3o registra ou n\xE3o tem linha; em \xE2mbar um evento escrito de outro jeito, um campo que falta ou um evento que n\xE3o disparou."),ie,ee.flatMap(b=>b.agents),A)),h.push(O("unused",V("Unused","Sem uso"),V("What nobody uses, or is switched off: remove it or switch it on?","O que ningu\xE9m usa, ou est\xE1 desligado: remover ou ligar?"),[],e.unused.map(b=>b.agent),A));let U=e.contract.routes.map((b,D)=>{let H=b.agent??b.calls,F=b.agent?r(b.agent):b.name??b.calls,z=[{node:"client",text:V("The customer writes.","O cliente escreve.")}],pe=b.agent&&e.contract.short.some(se=>se.agent===b.agent&&se.caller===b.caller);if(z.push(pe?{node:b.caller,warn:!0,quote:b.description,text:V(`The orchestrator hands over to ${F} by a routing description of ${b.description.length} characters.`,`O orquestrador encaminha para ${F} por uma descri\xE7\xE3o de roteamento de ${b.description.length} caracteres.`)}:{node:b.caller,quote:b.description,text:V(`The orchestrator hands over to ${F}.`,`O orquestrador encaminha para ${F}.`)}),!b.agent)return z.push({node:H,warn:!0,text:V(`It calls ${F}, which is not in the folder: not cloned, or gone?`,`Chama ${F}, que n\xE3o est\xE1 na pasta: n\xE3o foi clonado, ou n\xE3o existe mais?`)}),{id:`scene-${D+1}`,to:H,title:V(F,F),steps:z};let Ne=T(b.agent);if(Ne.length){let se=te=>Ne.map(j=>j.key==="called-with:history"?te==="pt"?"o hist\xF3rico":"the history":`\xAB${j.key.slice(18)}\xBB`).join(te==="pt"?" e SEM ":" and WITHOUT ");z.push({node:b.agent,warn:!0,text:V(`${F} is called WITHOUT ${se("en")}: it does not know what the customer already said.`,`${F} \xE9 chamado SEM ${se("pt")}: n\xE3o sabe o que o cliente j\xE1 disse.`)})}else{let se=te=>[b.history?te==="pt"?"o hist\xF3rico":"the history":"",...b.inputs.map(j=>`\xAB${j}\xBB`)].filter(Boolean).join(te==="pt"?" e ":" and ")||(te==="pt"?"a chamada":"the call");z.push({node:b.agent,text:V(`${F} gets ${se("en")}.`,`${F} recebe ${se("pt")}.`)})}for(let se of e.flows.filter(te=>te.agent===b.agent&&te.called)){z.push(se.returns?{node:C(se),text:V(`It uses the flow \xAB${se.name}\xBB.`,`Usa o fluxo \xAB${se.name}\xBB.`)}:{node:C(se),warn:!0,text:V(`The flow \xAB${se.name}\xBB returns nothing to ${F}.`,`O fluxo \xAB${se.name}\xBB n\xE3o devolve nada para ${F}.`)});for(let te of se.uses){let j=$(te);j&&z.push({node:j.id,text:V(`The flow reaches ${j.label}.`,`O fluxo chega a ${j.label}.`)})}}for(let se of f.filter(te=>te.from===b.agent&&te.to.startsWith("sys:"))){let te=c.find(j=>j.id===se.to);z.push(te.id.startsWith("sys:knowledge:")?{node:te.id,text:V(`It looks it up in \xAB${te.labels.en}\xBB.`,`Consulta \xAB${te.labels.pt}\xBB.`)}:{node:te.id,text:V(`It uses ${te.label}${se.label?` (${se.label.en})`:""}.`,`Usa ${te.label}${se.label?` (${se.label.pt})`:""}.`)})}return z.push({node:b.caller,text:V("The answer goes back to the customer through the orchestrator.","A resposta volta ao cliente pelo orquestrador.")}),{id:`scene-${D+1}`,to:H,title:V(F,F),steps:z}}),Ae=Ti(e),xt=e.agents.map(b=>{let H=n.find(j=>j.id===b.id)?.texts.filter(j=>j.source==="instructions").reduce((j,xe)=>j+xe.text.length,0)??0,F=[];for(let j of e.blocks)j.holders[b.id]?F.push({kind:j.official?"official":"shared",size:j.text.length,label:j.official??j.label}):j.variants[b.id]&&F.push({kind:"variant",size:j.variants[b.id].text.length,label:j.official??j.label});let z=F.reduce((j,xe)=>j+xe.size,0);for(let j of Object.keys(b.facts).filter(xe=>xe.startsWith("text:")&&!xe.startsWith("text:block:")&&!xe.endsWith("~variant")))F.push({kind:"marker",size:12,label:ne(j,"pt",e.names)});H>z&&F.push({kind:"own",size:H-z});let pe=["platform",b.role,...(e.types[b.id]??[]).map(j=>`type:${j}`)],Ne=new Set(e.offPattern.map(j=>j.key)),te=e.patterns.filter(j=>!j.partOf&&pe.includes(j.scope)&&(j.decision?.status==="accepted"||Ne.has(j.key))).filter((j,xe,kn)=>kn.findIndex(Mc=>Mc.key===j.key)===xe).map(j=>{let xe=e.offPattern.find(kn=>kn.agent===b.id&&kn.key===j.key);return{key:j.key,en:hn(j.key,"en",e.names),pt:hn(j.key,"pt",e.names),state:xe?xe.variant?"decide":"off":"ok"}});return{id:b.id,name:r(b.id),role:b.role==="orchestrator"?"orchestrator":"specialist",types:(e.types[b.id]??[]).map(i),...v(b.id),fingerprint:F,checks:te,access:Ae.filter(j=>j.agent===b.id).map(j=>V(j.en,j.pt))}}),Lc=Math.max(...c.map(b=>b.y))+90;return{...e.name?{name:e.name}:{},width:1220,height:Lc,hasTelemetry:!!s,...s?{days:s.days}:{},groups:g,nodes:c,edges:f,lenses:h,scenes:U,actors:xt}}var yc=e=>e.length?e.reduce((t,n)=>t+n,0)/e.length:0;function zm(e,t){let n=e.replace(/^/,""),s=n.slice(0,n.search(/\r?\n|$/)),r=g=>s.split('"').filter((u,l)=>l%2===0).join("").split(g).length,i=r(";")>r(",")?";":",",o=[],a=[],c="",f=!1;for(let g=0;g<n.length;g++){let u=n[g];f?u==='"'&&n[g+1]==='"'?c+=n[++g]:u==='"'?f=!1:c+=u:u==='"'?f=!0:u===i?(a.push(c),c=""):u===`
|
|
162
162
|
`||u==="\r"?(u==="\r"&&n[g+1]===`
|
|
163
|
-
`&&g++,a.push(c),o.push(a),a=[],c=""):c+=u}return(c||a.length)&&o.push([...a,c]),{name:t,rows:o}}function Ps(e){let t=new Map;for(let n of e)for(let s of[n.schemaName,n.id,n.displayName])s&&he(s)&&t.set(he(s),n.id);return n=>t.get(he(n))}function yc(e,t,n,s){let r=e.rows[0]??[];if(s){let f=r.findIndex(g=>he(g)===he(s));return f>=0?{at:f}:{problem:"header",titles:r}}let i=r.map((f,g)=>new Set(e.rows.slice(1).map(u=>t(u[g]??"")).filter(Boolean)).size),o=Math.max(0,...i),a=i.flatMap((f,g)=>f===o?[g]:[]);if(o<Math.min(2,n))return{problem:"none",titles:r};let c=e.rows.slice(1).every(f=>new Set(a.map(g=>t(f[g]??"")).filter(Boolean)).size<=1);return a.length>1&&!c?{problem:"tie",titles:a.map(f=>r[f])}:{at:a[0]}}var Wm={dono:"team",responsavel:"team",equipe:"team",time:"team",squad:"team",proprietario:"owner","owner-name":"owner",indicador:"kpi",kpis:"kpi"},Li=e=>{let t=e.normalize("NFD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");return Wm[t]??t},Ym=new Set(["itemtype","tipodoitem","tipo","type"]),zm=new Set(["agent","agente","agents","agentes","copilotstudioagent","microsoftcopilotstudio/agents"]);function Vm(e,t,n,s){let r=Ps(t),i=yc(e,r,t.length,s.agentColumn);if(!("at"in i))return{changes:[],unmatched:[],problem:i};let o=e.rows[0],a=o.findIndex(p=>Ym.has(he(p))),c=p=>`${s.file}${e.name?` \u203A ${e.name}`:""} \u203A ${s.lang==="pt"?"linha":"line"} ${p}`,f=new Map,g=[];e.rows.slice(1).forEach((p,d)=>{if(!p.some(k=>k.trim())||a>=0&&p[a]?.trim()&&!zm.has(he(p[a])))return;let m=(p[i.at]??"").trim(),y=r(m);if(!y)return g.push({line:d+2,value:m});o.forEach((k,v)=>{let S=(p[v]??"").trim();v===i.at||v===a||!S||!Li(k)||r(S)===y||f.set(`${y} ${Li(k)}`,{agent:y,key:Li(k),value:S,source:c(d+2)})})});let u=[],l=0;for(let p of f.values()){let d=n.declared.find(m=>m.agent===p.agent&&m.key===p.key);d?(d.value!==p.value||d.source!==p.source)&&u.push({key:`d${++l}`,kind:"declared",op:"set",before:d,after:p}):u.push({key:`d${++l}`,kind:"declared",op:"add",after:p})}return{changes:u,unmatched:g}}function Jm(e){let t=new Map;for(let n of e)n.kind==="declared"&&n.after&&t.set(`${n.after.agent} ${n.after.key}`,n);return[...t.values()].map((n,s)=>({...n,key:`d${s+1}`}))}var Gm=new Set(["evento","event","eventname","name","nome"]),Hm=new Set(["vezes","count","contagem","times","total"]);function Xm(e,t,n){let s=Ps(t),r=yc(e,s,t.length,n.agentColumn);if(!("at"in r))return{problem:r};let i=e.rows[0],o=i.findIndex((f,g)=>g!==r.at&&Gm.has(he(f)));if(o<0)return{problem:{problem:"event",titles:i}};let a=i.findIndex(f=>Hm.has(he(f))),c=[];return e.rows.slice(1).forEach((f,g)=>{let u=s(f[r.at]??""),l=(f[o]??"").trim();if(!u||!l)return;let p=a>=0?Number((f[a]??"").replace(/[^\d]/g,""))||0:1;c.push({agent:u,event:l,count:p,line:g+2})}),{days:n.days,file:n.file,rows:c}}var Qm=e=>e.split(/[\\/]/).pop()??e;function Zm(e){let t=Qm(e).replace(/\.csv$/i,"").replace(/\s*\(\d+\)$/,"").replace(/^Evaluate\s+/i,""),n=/^(.*?)\s+(\d{4}-\d{2}-\d{2}|\d{1,2}[-_.]\d{1,2}[-_.]\d{2,4}|\d{8})$/.exec(t);return n?{who:n[1],date:n[2]}:{who:t}}function eg(e,t){let n=Ps(t),s={sets:[],unknown:[]};for(let{name:r,table:i}of e){let{who:o,date:a}=Zm(r),c=n(o);if(!c){s.unknown.push({file:r,why:"who"});continue}let f=i.rows[0]??[],g=f.flatMap(m=>/^result_(\d+)$/i.exec(m.trim())?.[1]??[]).map(Number).sort((m,y)=>m-y);if(!g.length){s.unknown.push({file:r,why:"format"});continue}let u=m=>f.findIndex(y=>y.trim().toLowerCase()===m.toLowerCase()),l=i.rows.slice(1).filter(m=>m.some(y=>y.trim())),p=(m,y)=>(m[u(`result_${y}`)]??"").trim().toLowerCase()==="pass",d=g.map(m=>({name:l.map(k=>(k[u(`testMethodType_${m}`)]??"").trim()).find(Boolean)||`#${m}`,passed:l.filter(k=>p(k,m)).length,total:l.length}));s.sets.push({agent:c,file:r,...a?{date:a}:{},total:l.length,passed:l.filter(m=>g.every(y=>p(m,y))).length,methods:d})}return s}function tg(e,t){return e.map(n=>{let s=t.filter(r=>r.agent===n.id);return s.length?{...n,facts:{...n.facts,"eval:run":s.map(r=>({file:r.file,line:1}))}}:n})}var bc=["and","or","not"];var Mi=["person","person-pointing","person-sitting","house","car","bus","coin","phone","document","server","bank","cloud","queue","desk","computer","clock","lock","money-arrow","tree","school","hospital","factory","truck","cart","safe","bulb","gear","database","robot","ship","container","warehouse","box","pallet","shop","shelf","field","cup","function","api-gateway","cache","cluster","board","book","pencil"],Ls={pessoa:"person","pessoa-apontando":"person-pointing","pessoa-sentada":"person-sitting",casa:"house",carro:"car",onibus:"bus",moeda:"coin",celular:"phone",documento:"document",servidor:"server",banco:"bank",nuvem:"cloud",fila:"queue",mesa:"desk",computador:"computer",relogio:"clock",cadeado:"lock","seta-dinheiro":"money-arrow"},Ms=e=>Mi.includes(e)?e:typeof e=="string"&&Object.hasOwn(Ls,e)?Ls[e]:void 0;var kc=e=>Ms(e)!==void 0,x={skin:"#E8C6A5",shirt:"#A9BCC3",wood:"#D8C29C",gold:"#F2C94C",paper:"#FFFFFF",screen:"#DCE8F0",device:"#5B6B7C",roof:"#D9785F",wall:"#F3E3C3",car:"#7FA7C9",bus:"#E9C46A",green:"#7DBE8A",dark:"#4A4A4A",metal:"#C9D3DD",board:"#2F4F3F",chalk:"#F2EFE6"},_=(e,t,n,s,r,i)=>({kind:"polygon",points:[[e,t],[e+n,t],[e+n,t+s],[e,t+s]],fill:r,main:i}),W=(...e)=>({kind:"polyline",points:e});function $c(e){return[{kind:"polygon",points:[[-.15,-.72],[.15,-.72],[.19,-.38],[-.19,-.38]],fill:x.shirt,main:!0},{kind:"circle",c:[0,-.87],r:.11,fill:x.skin},...e,W([-.08,-.38],[-.1,0]),W([.08,-.38],[.1,0])]}var wc=$c([W([-.15,-.7],[-.25,-.42]),W([.15,-.7],[.25,-.42])]);function ng(e,t,n){let s=([r,i])=>[n+r*t,i*t];return e.map(r=>r.kind==="circle"?{...r,c:s(r.c),r:r.r*t}:{...r,points:r.points.map(s)})}function sg(){let e=[[-.28,-.3,.18],[-.06,-.45,.25],[.2,-.4,.21],[.37,-.27,.13]],t=[];for(let n=0;n<=24;n++){let s=-.46+.96*n/24,r=e.filter(([i,,o])=>Math.abs(s-i)<=o).map(([i,o,a])=>o-Math.sqrt(Math.max(0,a*a-(s-i)**2)));r.length&&t.push([s,Math.min(...r)])}return[...t,[.42,-.12],[-.4,-.12]]}var K0={person:wc,"person-pointing":$c([W([-.15,-.7],[-.25,-.42]),W([.15,-.69],[.47,-.73])]),"person-sitting":[W([-.3,-.8],[-.27,-.4]),W([-.32,-.4],[.2,-.4]),W([-.27,-.4],[-.27,0]),W([.16,-.4],[.16,0]),{kind:"polygon",points:[[-.22,-.77],[.04,-.77],[.06,-.44],[-.22,-.44]],fill:x.shirt,main:!0},{kind:"circle",c:[-.08,-.9],r:.1,fill:x.skin},W([-.1,-.44],[.3,-.44],[.32,0]),W([0,-.74],[.18,-.55],[.3,-.58])],house:[_(-.4,-.6,.8,.6,x.wall,!0),{kind:"polygon",points:[[-.5,-.58],[0,-1],[.5,-.58]],fill:x.roof},_(-.08,-.32,.16,.32,x.wood),_(.16,-.46,.16,.14,x.screen)],car:[{kind:"polygon",fill:x.car,main:!0,points:[[-.5,-.14],[-.5,-.32],[-.3,-.36],[-.18,-.56],[.2,-.56],[.32,-.36],[.5,-.32],[.5,-.14]]},{kind:"polygon",points:[[-.14,-.51],[.17,-.51],[.25,-.37],[-.22,-.37]],fill:x.screen},{kind:"circle",c:[-.28,-.12],r:.1,fill:x.dark},{kind:"circle",c:[.28,-.12],r:.1,fill:x.dark}],bus:[_(-.5,-.66,1,.52,x.bus,!0),...[-.42,-.21,0,.21].map(e=>_(e,-.6,.15,.16,x.screen)),W([-.5,-.3],[.5,-.3]),{kind:"circle",c:[-.3,-.12],r:.1,fill:x.dark},{kind:"circle",c:[.3,-.12],r:.1,fill:x.dark}],coin:[{kind:"circle",c:[0,-.42],r:.4,fill:x.gold,main:!0},{kind:"circle",c:[0,-.42],r:.3},{kind:"curve",points:[[.1,-.56],[-.08,-.57],[-.09,-.46],[.08,-.39],[.08,-.29],[-.11,-.28]]},W([0,-.64],[0,-.2])],phone:[_(-.26,-1,.52,1,x.device,!0),_(-.2,-.92,.4,.76,x.screen),{kind:"circle",c:[0,-.08],r:.035,fill:x.paper}],document:[{kind:"polygon",points:[[-.36,-1],[.16,-1],[.36,-.8],[.36,0],[-.36,0]],fill:x.paper,main:!0},W([.16,-1],[.16,-.8],[.36,-.8]),...[-.66,-.5,-.34,-.18].map(e=>W([-.22,e],[.22,e]))],server:[-1,-.66,-.32].flatMap(e=>[_(-.36,e,.72,.3,x.metal,!0),W([-.26,e+.15],[.06,e+.15]),{kind:"circle",c:[.22,e+.15],r:.035,fill:x.green}]),bank:[{kind:"polygon",points:[[-.5,-.74],[0,-1],[.5,-.74]],fill:x.wall,main:!0},_(-.45,-.74,.9,.08,x.wall),...[-.33,-.11,.11,.33].map(e=>_(e-.04,-.66,.08,.56,x.paper)),_(-.5,-.1,1,.1,x.wall)],cloud:[{kind:"polygon",points:sg(),fill:x.paper,main:!0}],queue:[-.32,0,.32].flatMap(e=>ng(wc,.7,e)),desk:[_(-.5,-.5,1,.07,x.wood,!0),W([-.42,-.43],[-.42,0]),W([.42,-.43],[.42,0])],computer:[_(-.45,-1,.9,.6,x.device,!0),_(-.39,-.94,.78,.48,x.screen),{kind:"polygon",points:[[-.06,-.4],[.06,-.4],[.1,-.1],[-.1,-.1]],fill:x.device},_(-.25,-.1,.5,.08,x.device)],clock:[{kind:"circle",c:[0,-.48],r:.45,fill:x.paper,main:!0},...[[0,-.9,0,-.82],[.42,-.48,.34,-.48],[0,-.06,0,-.14],[-.42,-.48,-.34,-.48]].map(([e,t,n,s])=>W([e,t],[n,s])),W([0,-.48],[0,-.78]),W([0,-.48],[.2,-.48])],lock:[{kind:"curve",points:[[-.22,-.52],[-.22,-.76],[0,-.96],[.22,-.76],[.22,-.52]]},_(-.36,-.54,.72,.54,x.bus,!0),{kind:"circle",c:[0,-.32],r:.06,fill:x.dark},W([0,-.28],[0,-.14])],"money-arrow":[{kind:"polygon",fill:x.green,main:!0,points:[[-.5,-.4],[.12,-.4],[.12,-.56],[.5,-.3],[.12,-.04],[.12,-.2],[-.5,-.2]]},{kind:"circle",c:[-.2,-.3],r:.16,fill:x.gold},W([-.2,-.4],[-.2,-.2])],tree:[_(-.07,-.36,.14,.36,x.wood),{kind:"circle",c:[0,-.64],r:.3,fill:x.green,main:!0}],school:[_(-.45,-.6,.9,.6,x.wall,!0),{kind:"polygon",points:[[-.5,-.6],[0,-.82],[.5,-.6]],fill:x.roof},_(-.08,-.28,.16,.28,x.wood),_(-.36,-.48,.16,.12,x.screen),_(.2,-.48,.16,.12,x.screen),W([0,-.82],[0,-1]),{kind:"polygon",points:[[0,-1],[.17,-.95],[0,-.9]],fill:x.roof}],hospital:[_(-.4,-.8,.8,.8,x.paper,!0),_(-.045,-.7,.09,.26,"#C8442C"),_(-.13,-.615,.26,.09,"#C8442C"),_(-.1,-.24,.2,.24,x.metal)],factory:[{kind:"polygon",points:[[-.5,0],[-.5,-.5],[-.25,-.65],[-.25,-.5],[0,-.65],[0,-.5],[.25,-.65],[.25,-.5],[.5,-.5],[.5,0]],fill:x.wall,main:!0},_(.3,-.95,.12,.3,x.dark),_(-.38,-.32,.16,.12,x.screen),_(-.08,-.32,.16,.12,x.screen),_(.22,-.32,.16,.12,x.screen)],truck:[_(-.5,-.62,.62,.46,x.metal,!0),{kind:"polygon",points:[[.12,-.16],[.12,-.5],[.34,-.5],[.48,-.32],[.48,-.16]],fill:x.bus},{kind:"polygon",points:[[.18,-.46],[.32,-.46],[.42,-.33],[.18,-.33]],fill:x.screen},{kind:"circle",c:[-.3,-.1],r:.1,fill:x.dark},{kind:"circle",c:[.3,-.1],r:.1,fill:x.dark}],cart:[W([-.48,-.78],[-.4,-.62]),{kind:"polygon",points:[[-.4,-.62],[.42,-.62],[.32,-.26],[-.3,-.26]],fill:x.metal,main:!0},W([-.3,-.26],[-.3,-.14],[.32,-.14]),{kind:"circle",c:[-.22,-.07],r:.06,fill:x.dark},{kind:"circle",c:[.24,-.07],r:.06,fill:x.dark}],safe:[_(-.4,-.82,.8,.82,x.device,!0),_(-.3,-.72,.6,.62,x.metal),{kind:"circle",c:[0,-.41],r:.13,fill:x.paper},W([0,-.41],[.08,-.47])],bulb:[{kind:"circle",c:[0,-.62],r:.3,fill:x.gold,main:!0},_(-.13,-.33,.26,.2,x.metal),{kind:"curve",points:[[-.09,-.52],[0,-.66],[.09,-.52]]},W([-.08,-.08],[.08,-.08])],gear:[{kind:"polygon",points:[[.42,-.5],[.296,-.378],[.297,-.203],[.122,-.204],[0,-.08],[-.122,-.204],[-.297,-.203],[-.296,-.378],[-.42,-.5],[-.296,-.622],[-.297,-.797],[-.122,-.796],[-0,-.92],[.122,-.796],[.297,-.797],[.296,-.622]],fill:x.metal,main:!0},{kind:"circle",c:[0,-.5],r:.12,fill:x.paper}],database:[{kind:"polygon",points:[[-.35,-.8],[.35,-.8],[.35,-.16],[-.35,-.16]],fill:x.screen,main:!0},{kind:"polygon",points:[[.35,-.8],[.303,-.755],[.175,-.722],[0,-.71],[-.175,-.722],[-.303,-.755],[-.35,-.8],[-.303,-.845],[-.175,-.878],[-0,-.89],[.175,-.878],[.303,-.845]],fill:x.metal},{kind:"curve",points:[[-.35,-.16],[0,-.06],[.35,-.16]]},{kind:"curve",points:[[-.35,-.58],[0,-.48],[.35,-.58]]},{kind:"curve",points:[[-.35,-.37],[0,-.27],[.35,-.37]]}],robot:[W([0,-.95],[0,-1]),_(-.22,-.95,.44,.3,x.metal),{kind:"circle",c:[-.09,-.81],r:.045,fill:x.screen},{kind:"circle",c:[.09,-.81],r:.045,fill:x.screen},_(-.28,-.62,.56,.42,x.metal,!0),W([-.28,-.55],[-.42,-.35]),W([.28,-.55],[.42,-.35]),_(-.2,-.2,.12,.2,x.device),_(.08,-.2,.12,.2,x.device)],ship:[{kind:"polygon",points:[[-.48,-.3],[.48,-.3],[.36,-.04],[-.4,-.04]],fill:x.car,main:!0},_(-.42,-.62,.14,.32,x.wall),_(-.24,-.5,.2,.2,x.roof),_(-.02,-.5,.2,.2,x.bus),_(.2,-.5,.2,.2,x.green),{kind:"curve",points:[[-.5,0],[-.3,-.04],[-.1,0],[.1,-.04],[.3,0],[.5,-.04]]}],container:[_(-.46,-.52,.92,.52,x.roof,!0),...[-.3,-.15,0,.15,.3].map(e=>W([e,-.48],[e,-.04]))],warehouse:[{kind:"polygon",points:[[-.46,0],[.46,0],[.46,-.55],[0,-.82],[-.46,-.55]],fill:x.wall,main:!0},_(-.2,-.38,.4,.38,x.metal),W([-.2,-.26],[.2,-.26]),W([-.2,-.13],[.2,-.13])],box:[_(-.36,-.5,.52,.5,x.wood,!0),{kind:"polygon",points:[[-.36,-.5],[.16,-.5],[.36,-.64],[-.16,-.64]],fill:x.wood},{kind:"polygon",points:[[.16,0],[.36,-.14],[.36,-.64],[.16,-.5]],fill:x.wood},W([-.1,-.5],[.1,-.64])],pallet:[_(-.46,-.12,.92,.06,x.wood),...[-.42,-.05,.32].map(e=>_(e,-.06,.1,.06,x.wood)),_(-.42,-.5,.4,.38,x.wood,!0),_(.02,-.5,.4,.38,x.wood),_(-.2,-.82,.4,.32,x.wood)],shop:[_(-.42,-.6,.84,.6,x.wall,!0),{kind:"polygon",points:[[-.48,-.6],[.48,-.6],[.42,-.78],[-.42,-.78]],fill:x.roof},_(-.34,-.48,.34,.26,x.screen),_(.08,-.42,.24,.42,x.wood)],shelf:[_(-.4,-.92,.8,.92,x.paper,!0),W([-.4,-.62],[.4,-.62]),W([-.4,-.32],[.4,-.32]),_(-.32,-.8,.16,.18,x.roof),_(-.1,-.78,.14,.16,x.bus),_(.1,-.5,.22,.18,x.green),_(-.3,-.2,.24,.2,x.wood)],field:[W([-.48,0],[.48,0]),...[-.3,0,.3].flatMap(e=>[{kind:"curve",points:[[e,0],[e-.02,-.25],[e,-.5]]},{kind:"circle",c:[e-.08,-.32],r:.07,fill:x.green,main:!0},{kind:"circle",c:[e+.08,-.42],r:.07,fill:x.green,main:!0},{kind:"circle",c:[e,-.52],r:.06,fill:x.roof}])],cup:[{kind:"polygon",points:[[-.26,-.52],[.26,-.52],[.2,-.1],[-.2,-.1]],fill:x.paper,main:!0},{kind:"curve",points:[[.24,-.44],[.4,-.38],[.22,-.2]]},{kind:"polygon",points:[[-.46,-.1],[.46,-.1],[.36,0],[-.36,0]],fill:x.paper},{kind:"curve",points:[[-.08,-.62],[-.02,-.72],[-.08,-.84]]},{kind:"curve",points:[[.08,-.62],[.14,-.72],[.08,-.84]]}],function:[_(-.38,-.72,.76,.62,x.screen,!0),W([-.14,-.62],[0,-.62],[.14,-.2]),W([.02,-.42],[-.14,-.2])],"api-gateway":[_(-.12,-.8,.24,.8,x.metal,!0),W([-.48,-.55],[-.16,-.55]),W([-.24,-.62],[-.16,-.55],[-.24,-.48]),W([.16,-.3],[.48,-.3]),W([.4,-.37],[.48,-.3],[.4,-.23])],cache:[_(-.34,-.66,.68,.66,x.metal,!0),{kind:"polygon",points:[[.04,-.58],[-.12,-.3],[0,-.3],[-.06,-.08],[.14,-.38],[.02,-.38]],fill:x.gold}],cluster:[{kind:"curve",points:[[-.4,-.8],[0,-.86],[.4,-.8],[.48,-.45],[.4,-.1],[0,-.04],[-.4,-.1],[-.48,-.45],[-.4,-.8]]},_(-.3,-.7,.24,.2,x.screen,!0),_(.06,-.7,.24,.2,x.screen,!0),_(-.12,-.38,.24,.2,x.screen,!0)],board:[_(-.48,-.9,.96,.6,x.board,!0),_(-.34,-.76,.42,.03,x.chalk),_(-.34,-.62,.58,.03,x.chalk),_(-.34,-.48,.3,.03,x.chalk),W([-.3,-.3],[-.36,0]),W([.3,-.3],[.36,0])],book:[{kind:"polygon",points:[[0,-.62],[-.46,-.7],[-.46,-.1],[0,-.04]],fill:x.paper,main:!0},{kind:"polygon",points:[[0,-.62],[.46,-.7],[.46,-.1],[0,-.04]],fill:x.paper,main:!0},W([-.36,-.52],[-.1,-.48]),W([-.36,-.38],[-.1,-.34]),W([.1,-.48],[.36,-.52]),W([.1,-.34],[.36,-.38])],pencil:[{kind:"polygon",points:[[-.38,-.12],[.22,-.72],[.34,-.6],[-.26,0]],fill:x.bus,main:!0},{kind:"polygon",points:[[.22,-.72],[.34,-.6],[.44,-.86]],fill:x.wood},{kind:"polygon",points:[[-.38,-.12],[-.26,0],[-.46,-.02]],fill:x.roof}]},vc=["happy","sad","surprised","worried","idea"],rg={person:[0,-.87,.11],"person-pointing":[0,-.87,.11],"person-sitting":[-.08,-.9,.1]},Sc=e=>{let t=Ms(e);return!!t&&t in rg};var Oc=["spin","drive","steam","talk","pulse","float"],ig=["lesson","pitch","arch","decision","data","timeline","story"],Ac=8,Nc=6,Ec=2e5,xc=6e5,Tc=24;var qc=["card","line","arrow","polyline","polygon","curve","circle","ellipse","plot","text","highlight","pause","prop","repeat","when","move","link","counter","row","column","grid","axis","timeline","balloon","brace","note","table","bars","chain","animate","lottie"],Nt=["text","prop","card","counter","circle","ellipse"],Cc=["row","column","grid","chain"],og=50;function ce(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t}: expected an object.`)}function oe(e,t){if(typeof e!="string"||!e.trim()||e.length>2e3)throw new Error(`${t}: expected text of 1 to 2000 characters.`)}function Q(e,t,n=-1e4,s=1e4){if(typeof e!="number"||!Number.isFinite(e)||e<n||e>s)throw new Error(`${t}: expected a number between ${n} and ${s}.`)}function be(e,t){if(typeof e=="string"){if(oe(e,t),e.length>300)throw new Error(`${t}: expression too long.`)}else Q(e,t)}function ye(e,t){if(!Array.isArray(e)||e.length!==2)throw new Error(`${t}: expected [x, y].`);e.forEach((n,s)=>be(n,`${t}[${s}]`))}function Ce(e,t){e!==void 0&&oe(e,t)}function we(e,t,n){if(e!==void 0&&(typeof e!="string"||!t.includes(e)))throw new Error(`${n}: choose one of ${t.join(", ")}.`)}function Is(e){if(!/^[A-Za-z_][A-Za-z_0-9]*$/.test(e)||["__proto__","constructor","prototype",...bc].includes(e))throw new Error(`Invalid variable name: "${e}".`)}var Et=(e,t)=>t.includes("{")||e.exact.has(t)||[...e.repeated].some(n=>t.startsWith(`${n}-`)&&/^\d+$/.test(t.slice(n.length+1)));function lt(e,t,n,s){s&&e[t]===void 0&&(e[t]=[0,0]),ye(e[t],`${n}.${t}`)}function yn(e,t,n,s,r=!1){if(ce(e,t),++n.count>500)throw new Error(`${t}: a recipe draws at most 500 steps, counting those inside repeat and when.`);if(s){for(let a of["chapter","say","duration"])if(e[a]!==void 0)throw new Error(`${t}.${a}: put it on the ${s} step itself, not on a step inside it.`);if(e.type==="pause")throw new Error(`${t}: a pause cannot go inside ${s}.`);if(e.type==="repeat"&&s==="repeat")throw new Error(`${t}: a repeat cannot go inside another repeat.`);if(Cc.includes(s)&&e.place!==void 0)throw new Error(`${t}.place: the ${s} places the steps inside it.`)}if(!qc.includes(e.type))throw new Error(`${t}: unknown type "${e.type}".`);for(let a of["id","say","chapter"])Ce(e[a],`${t}.${a}`);if(e.duration!==void 0&&Q(e.duration,`${t}.duration`,0,3e4),e.nudge!==void 0){if(["pause","move","link","animate"].includes(e.type))throw new Error(`${t}.nudge: a ${e.type} has no place of its own to move.`);if(!Array.isArray(e.nudge)||e.nudge.length!==2)throw new Error(`${t}.nudge: use [dx, dy].`);e.nudge.forEach((a,c)=>Q(a,`${t}.nudge[${c}]`,-900,900))}let i=s!==null&&Cc.includes(s)||r;if(e.place!==void 0){if(!Nt.includes(e.type))throw new Error(`${t}.place: only ${Nt.join(", ")} can be placed.`);if(ce(e.place,`${t}.place`),oe(e.place.to,`${t}.place.to`),!Et(n,String(e.place.to)))throw new Error(`${t}.place.to: no earlier step has the id "${e.place.to}".`);if(!["below","above","left","right"].includes(e.place.side))throw new Error(`${t}.place.side: choose one of below, above, left, right.`);e.place.gap!==void 0&&Q(e.place.gap,`${t}.place.gap`,-200,400),we(e.place.align,["center","start","end"],`${t}.place.align`)}let o=i||e.place!==void 0;if(e.style!==void 0){ce(e.style,`${t}.style`);for(let a of["color","fill"]){let c=e.style[a];if(c!==void 0&&(typeof c!="string"||!/^(#[\da-f]{3,8}|[a-z]+)$/i.test(c)))throw new Error(`${t}.style.${a}: use a hex colour or a colour name, no URLs.`)}for(let a of["width","roughness","bowing"])e.style[a]!==void 0&&Q(e.style[a],`${t}.style.${a}`,0,20);if(e.style.opacity!==void 0&&Q(e.style.opacity,`${t}.style.opacity`,0,1),e.style.dashed!==void 0&&typeof e.style.dashed!="boolean")throw new Error(`${t}: dashed must be a boolean.`);we(e.style.fillStyle,["hachure","solid","zigzag","cross-hatch","dots"],`${t}.style.fillStyle`)}switch(e.type){case"line":case"arrow":case"highlight":ye(e.from,`${t}.from`),ye(e.to,`${t}.to`),e.thickness!==void 0&&Q(e.thickness,`${t}.thickness`,1,200);break;case"polyline":case"polygon":case"curve":if(!Array.isArray(e.points)||e.points.length<(e.type==="polygon"?3:2)||e.points.length>500)throw new Error(`${t}: points needs ${e.type==="polygon"?3:2} to 500 points.`);e.points.forEach((a,c)=>ye(a,`${t}.points[${c}]`));break;case"circle":case"ellipse":lt(e,"center",t,o);for(let a of e.type==="circle"?["r"]:["rx","ry"])be(e[a],`${t}.${a}`),typeof e[a]=="number"&&Q(e[a],`${t}.${a}`,0);break;case"text":lt(e,"at",t,o),oe(e.text,`${t}.text`),e.size!==void 0&&Q(e.size,`${t}.size`,1,200),e.rotate!==void 0&&Q(e.rotate,`${t}.rotate`,-360,360),we(e.font,["hand","body"],`${t}.font`),we(e.anchor,["start","middle","end"],`${t}.anchor`);break;case"card":lt(e,"at",t,o),be(e.w,`${t}.w`),be(e.h,`${t}.h`);for(let a of["w","h"])typeof e[a]=="number"&&Q(e[a],`${t}.${a}`,40);if(oe(e.title,`${t}.title`),e.lines!==void 0){if(!Array.isArray(e.lines)||e.lines.length>6)throw new Error(`${t}: at most 6 lines per card.`);e.lines.forEach((a,c)=>oe(a,`${t}.lines[${c}]`))}break;case"plot":oe(e.fn,`${t}.fn`),e.var!==void 0&&(oe(e.var,`${t}.var`),Is(String(e.var))),ye(e.domain,`${t}.domain`),ye(e.range,`${t}.range`),ce(e.box,`${t}.box`);for(let a of["x","y","w","h"])be(e.box[a],`${t}.box.${a}`);if(e.samples!==void 0&&(Q(e.samples,`${t}.samples`,2,1e3),!Number.isInteger(e.samples)))throw new Error(`${t}: samples must be an integer.`);break;case"pause":Q(e.ms,`${t}.ms`,0,3e4),Ce(e.ask,`${t}.ask`);break;case"prop":if(!kc(e.name)&&!n.figures.has(String(e.name))){let a=n.figures.size?`, or one the recipe defines (${[...n.figures].join(", ")})`:"";throw new Error(`${t}.name: unknown prop "${String(e.name)}"; use one of ${Mi.join(", ")}${a}.`)}if(lt(e,"at",t,o),e.size!==void 0&&(be(e.size,`${t}.size`),typeof e.size=="number"&&Q(e.size,`${t}.size`,10,1e3)),Ce(e.label,`${t}.label`),e.flip!==void 0&&typeof e.flip!="boolean")throw new Error(`${t}.flip: expected true or false.`);if(e.mood!==void 0){if(!Sc(e.name))throw new Error(`${t}.mood: only a person (person, person-pointing, person-sitting) has a face.`);we(e.mood,vc,`${t}.mood`)}break;case"repeat":if(be(e.times,`${t}.times`),typeof e.times=="number"&&(Q(e.times,`${t}.times`,0,og),!Number.isInteger(e.times)))throw new Error(`${t}.times: expected a whole number.`);yn(e.step,`${t}.step`,n,"repeat",i);break;case"when":if(be(e.if,`${t}.if`),!Array.isArray(e.steps)||e.steps.length===0||e.steps.length>50)throw new Error(`${t}.steps: expected 1 to 50 steps.`);e.steps.forEach((a,c)=>yn(a,`${t}.steps[${c}]`,n,s??"when"));break;case"move":if(oe(e.target,`${t}.target`),!Et(n,String(e.target)))throw new Error(`${t}.target: no earlier step has the id "${e.target}".`);ye(e.to,`${t}.to`),we(e.along,["line","curve"],`${t}.along`),e.ms!==void 0&&Q(e.ms,`${t}.ms`,200,5e3);break;case"lottie":if(oe(e.src,`${t}.src`),ye(e.at,`${t}.at`),e.size!==void 0&&(be(e.size,`${t}.size`),typeof e.size=="number"&&Q(e.size,`${t}.size`,24,1e3)),e.loop!==void 0&&typeof e.loop!="boolean")throw new Error(`${t}.loop: expected true or false.`);break;case"animate":if(oe(e.target,`${t}.target`),!Et(n,String(e.target)))throw new Error(`${t}.target: no earlier step has the id "${e.target}".`);if(we(e.effect,[...Oc,"stop"],`${t}.effect`),e.effect===void 0)throw new Error(`${t}.effect: choose one of ${[...Oc,"stop"].join(", ")}.`);we(e.speed,["slow","fast"],`${t}.speed`);break;case"link":for(let a of["from","to"])if(oe(e[a],`${t}.${a}`),!Et(n,String(e[a])))throw new Error(`${t}.${a}: no earlier step has the id "${e[a]}".`);Ce(e.label,`${t}.label`);break;case"counter":if(lt(e,"at",t,o),be(e.value,`${t}.value`),e.format!==void 0&&(oe(e.format,`${t}.format`),!String(e.format).includes("{v")))throw new Error(`${t}.format: show the number as {v}, e.g. "R$ {v:0}".`);e.size!==void 0&&Q(e.size,`${t}.size`,1,200),we(e.anchor,["start","middle","end"],`${t}.anchor`);break;case"row":case"column":case"grid":if(i)throw new Error(`${t}: a ${e.type} cannot go inside another ${s}.`);if(lt(e,"at",t,!1),e.gap!==void 0&&Q(e.gap,`${t}.gap`,0,400),e.type==="grid"){if(Q(e.columns,`${t}.columns`,1,12),!Number.isInteger(e.columns))throw new Error(`${t}.columns: expected a whole number.`)}else we(e.align,["center","start","end"],`${t}.align`);if(!Array.isArray(e.steps)||e.steps.length===0||e.steps.length>50)throw new Error(`${t}.steps: expected 1 to 50 steps.`);e.steps.forEach((a,c)=>{ce(a,`${t}.steps[${c}]`);let f=a.type==="repeat"?a.step?.type:a.type;if(!Nt.includes(f))throw new Error(`${t}.steps[${c}]: a ${e.type} holds only ${Nt.join(", ")} (or a repeat of one).`);yn(a,`${t}.steps[${c}]`,n,e.type)});break;case"chain":if(i)throw new Error(`${t}: a chain cannot go inside a ${s}.`);if(lt(e,"at",t,!1),e.gap!==void 0&&e.gap!=="auto"&&Q(e.gap,`${t}.gap`,0,400),we(e.direction,["right","down"],`${t}.direction`),e.wrap!==void 0&&typeof e.wrap!="boolean")throw new Error(`${t}.wrap: expected true or false.`);if(Ce(e.forward,`${t}.forward`),Ce(e.back,`${t}.back`),e.size!==void 0&&(be(e.size,`${t}.size`),typeof e.size=="number"&&Q(e.size,`${t}.size`,10,1e3)),!Array.isArray(e.steps)||e.steps.length<2||e.steps.length>12)throw new Error(`${t}.steps: a chain joins 2 to 12 pieces.`);e.steps.forEach((a,c)=>{if(ce(a,`${t}.steps[${c}]`),!Nt.includes(a.type))throw new Error(`${t}.steps[${c}]: a chain holds only ${Nt.join(", ")}.`);yn(a,`${t}.steps[${c}]`,n,"chain")});break;case"axis":case"timeline":if(ye(e.from,`${t}.from`),ye(e.to,`${t}.to`),ye(e.domain,`${t}.domain`),e.type==="axis"){if(e.ticks!==void 0){if(Array.isArray(e.ticks)){if(e.ticks.length>30)throw new Error(`${t}.ticks: at most 30 marks.`);e.ticks.forEach((a,c)=>Q(a,`${t}.ticks[${c}]`))}else if(Q(e.ticks,`${t}.ticks`,0,30),!Number.isInteger(e.ticks))throw new Error(`${t}.ticks: expected a whole number.`)}if(Ce(e.label,`${t}.label`),e.format!==void 0&&(oe(e.format,`${t}.format`),!String(e.format).includes("{v")))throw new Error(`${t}.format: show the number as {v}, e.g. "{v} km".`)}else{if(!Array.isArray(e.marks)||e.marks.length===0||e.marks.length>20)throw new Error(`${t}.marks: expected 1 to 20 marks.`);e.marks.forEach((a,c)=>{ce(a,`${t}.marks[${c}]`),be(a.at,`${t}.marks[${c}].at`),Ce(a.label,`${t}.marks[${c}].label`),Ce(a.text,`${t}.marks[${c}].text`)})}break;case"balloon":if(oe(e.to,`${t}.to`),!Et(n,String(e.to)))throw new Error(`${t}.to: no earlier step has the id "${e.to}".`);if(oe(e.text,`${t}.text`),String(e.text).length>300)throw new Error(`${t}.text: keep a balloon under 300 characters.`);we(e.side,["below","above","left","right"],`${t}.side`),we(e.kind,["speech","thought"],`${t}.kind`),e.width!==void 0&&Q(e.width,`${t}.width`,80,600),e.size!==void 0&&Q(e.size,`${t}.size`,12,60);break;case"brace":if(ye(e.from,`${t}.from`),ye(e.to,`${t}.to`),Ce(e.label,`${t}.label`),e.flip!==void 0&&typeof e.flip!="boolean")throw new Error(`${t}.flip: expected true or false.`);break;case"note":if(ye(e.at,`${t}.at`),oe(e.text,`${t}.text`),e.to===void 0==(e.point===void 0))throw new Error(`${t}: a note points either to an element (to) or to a point (point).`);if(e.to!==void 0){if(oe(e.to,`${t}.to`),!Et(n,String(e.to)))throw new Error(`${t}.to: no earlier step has the id "${e.to}".`)}else ye(e.point,`${t}.point`);e.size!==void 0&&Q(e.size,`${t}.size`,12,60);break;case"table":if(ye(e.at,`${t}.at`),!Array.isArray(e.rows)||e.rows.length===0||e.rows.length>12)throw new Error(`${t}.rows: expected 1 to 12 rows.`);if(e.rows.forEach((a,c)=>{if(!Array.isArray(a)||a.length===0||a.length>6)throw new Error(`${t}.rows[${c}]: expected 1 to 6 cells.`);a.forEach((f,g)=>{if(typeof f!="string"||f.length>120)throw new Error(`${t}.rows[${c}][${g}]: expected text of up to 120 characters.`)})}),e.header!==void 0&&typeof e.header!="boolean")throw new Error(`${t}.header: expected true or false.`);e.size!==void 0&&Q(e.size,`${t}.size`,12,40);break;case"bars":ce(e.box,`${t}.box`);for(let a of["x","y","w","h"])be(e.box[a],`${t}.box.${a}`);if(!Array.isArray(e.values)||e.values.length===0||e.values.length>12)throw new Error(`${t}.values: expected 1 to 12 values.`);if(e.values.forEach((a,c)=>be(a,`${t}.values[${c}]`)),e.labels!==void 0){if(!Array.isArray(e.labels)||e.labels.length>e.values.length)throw new Error(`${t}.labels: at most one label per value.`);e.labels.forEach((a,c)=>oe(a,`${t}.labels[${c}]`))}if(e.max!==void 0&&be(e.max,`${t}.max`),e.format!==void 0&&(oe(e.format,`${t}.format`),!String(e.format).includes("{v")))throw new Error(`${t}.format: show the number as {v}, e.g. "{v}%".`);break}typeof e.id=="string"&&(s==="repeat"?n.repeated:n.exact).add(e.id)}function ag(e,t){let n=`defs.${e}`;if(!/^[a-z][a-z0-9-]{1,30}$/.test(e))throw new Error(`${n}: a figure's name is 2 to 31 lowercase letters, digits or -, starting with a letter.`);if(Ms(e)||Object.hasOwn(Ls,e)||qc.includes(e)||["define","title","param","switch","var"].includes(e))throw new Error(`${n}: "${e}" is already a prop or a step; choose another name.`);if(ce(t,n),!Array.isArray(t.shapes)||t.shapes.length===0||t.shapes.length>Tc)throw new Error(`${n}.shapes: expected 1 to ${Tc} shapes.`);let s=(r,i)=>{if(typeof r!="number"||!Number.isInteger(r)||r<0||r>100)throw new Error(`${i}: expected a whole number from 0 to 100 (the figure's grid, y down; it stands at 50,100).`)};t.shapes.forEach((r,i)=>{let o=`${n}.shapes[${i}]`;if(ce(r,o),r.fill!==void 0&&(typeof r.fill!="string"||!/^(#[0-9a-fA-F]{3,8}|[a-z]{3,20})$/.test(r.fill)))throw new Error(`${o}.fill: a colour, as hex or a plain name.`);if(r.kind==="circle"){if(!Array.isArray(r.c)||r.c.length!==2)throw new Error(`${o}.c: expected [x, y].`);r.c.forEach((c,f)=>s(c,`${o}.c[${f}]`)),s(r.r,`${o}.r`);return}if(!["polygon","polyline","curve"].includes(r.kind))throw new Error(`${o}.kind: choose one of polygon, polyline, curve, circle.`);let a=r.kind==="polygon"?3:2;if(!Array.isArray(r.points)||r.points.length<a||r.points.length>40)throw new Error(`${o}.points: a ${r.kind} takes ${a} to 40 points.`);r.points.forEach((c,f)=>{if(!Array.isArray(c)||c.length!==2)throw new Error(`${o}.points[${f}]: expected [x, y].`);c.forEach((g,u)=>s(g,`${o}.points[${f}][${u}]`))})})}function lg(e,t){let n=`lottie "${e}"`;ce(t,n);let s=JSON.stringify(t).length;if(s>Ec)throw new Error(`${n}: ${Math.round(s/1e3)} KB; an animation can have at most ${Ec/1e3} KB.`);for(let i of["fr","ip","op","w","h"])Q(t[i],`${n}.${i}`,0,1e5);if(typeof t.v!="string"||!Array.isArray(t.layers))throw new Error(`${n}: not a Lottie animation (it needs v and layers).`);let r=(i,o)=>{if(Array.isArray(i))return i.forEach((a,c)=>r(a,`${o}[${c}]`));if(!(!i||typeof i!="object"))for(let[a,c]of Object.entries(i)){if(a==="x"&&typeof c=="string")throw new Error(`${n}: the animation has an expression (code inside it, at ${o}); only animations without expressions play.`);r(c,`${o}.${a}`)}};r(t.layers,"layers");for(let i of Array.isArray(t.assets)?t.assets:[]){let o=i?.p;if(typeof o=="string"&&o&&!o.startsWith("data:")&&!Array.isArray(i.layers))throw new Error(`${n}: an image from outside the animation ("${o.slice(0,40)}"); only images inside it (data:) are kept.`)}return s}function cg(e){ce(e,"The recipe");let t=e;Q(t.width,"width",100,4e3),Q(t.height,"height",100,4e3);for(let r of["id","title","category"])Ce(t[r],r);if(t.locale!==void 0&&!(typeof t.locale=="string"&&/^[a-zA-Z]{2,3}(-[a-zA-Z0-9]{2,8})*$/.test(t.locale)&&Intl.NumberFormat.supportedLocalesOf([t.locale]).length>0))throw new Error('locale: expected a language tag such as "en-US" or "pt-BR".');if(we(t.background,["dots","grid","plain"],"background"),we(t.kind,ig,"kind"),Ce(t.source,"source"),t.quiz!==void 0&&t.kind!==void 0&&t.kind!=="lesson")throw new Error(`quiz: only a lesson has a quiz (this drawing is a ${t.kind}).`);if(we(t.theme,["paper","chalkboard"],"theme"),t.quiz!==void 0){if(ce(t.quiz,"quiz"),oe(t.quiz.question,"quiz.question"),!Array.isArray(t.quiz.options)||t.quiz.options.length<2||t.quiz.options.length>4)throw new Error("quiz.options: expected 2 to 4 options.");if(t.quiz.options.forEach((r,i)=>{if(ce(r,`quiz.options[${i}]`),oe(r.text,`quiz.options[${i}].text`),oe(r.why,`quiz.options[${i}].why`),typeof r.right!="boolean")throw new Error(`quiz.options[${i}].right: expected true or false.`)}),t.quiz.options.filter(r=>r.right===!0).length!==1)throw new Error("quiz.options: exactly one option is right.")}if(t.learning!==void 0){ce(t.learning,"learning");for(let r of["goal","question","answer","caveat"])oe(t.learning[r],`learning.${r}`)}if(t.params!==void 0){ce(t.params,"params");for(let[r,i]of Object.entries(t.params))if(Is(r),ce(i,`params.${r}`),oe(i.label,`params.${r}.label`),Q(i.min,`${r}.min`),Q(i.max,`${r}.max`),Q(i.step,`${r}.step`,1e-6),Q(i.value,`${r}.value`,i.min,i.max),i.max<=i.min)throw new Error(`${r}: max must be greater than min.`)}if(t.vars!==void 0){ce(t.vars,"vars");for(let[r,i]of Object.entries(t.vars))Is(r),be(i,`vars.${r}`)}if(t.switches!==void 0){ce(t.switches,"switches");let r=Object.entries(t.switches);if(r.length>8)throw new Error("switches: at most 8.");for(let[i,o]of r){if(Is(i),Object.hasOwn(t.params??{},i)||Object.hasOwn(t.vars??{},i))throw new Error(`switches.${i}: the name is already a param or a var.`);if(ce(o,`switches.${i}`),oe(o.label,`switches.${i}.label`),typeof o.on!="boolean")throw new Error(`switches.${i}.on: expected true or false.`)}}if(!Array.isArray(t.steps)||t.steps.length===0||t.steps.length>250)throw new Error("A recipe needs 1 to 250 steps.");let n=new Set;if(t.defs!==void 0){ce(t.defs,"defs");let r=Object.entries(t.defs);if(r.length>Ac)throw new Error(`defs: at most ${Ac} figures.`);for(let[i,o]of r)ag(i,o),n.add(i)}if(t.lotties!==void 0){ce(t.lotties,"lotties");let r=Object.entries(t.lotties);if(r.length>Nc)throw new Error(`lotties: at most ${Nc} animations.`);let i=r.reduce((o,[a,c])=>o+lg(a,c),0);if(i>xc)throw new Error(`lotties: ${Math.round(i/1e3)} KB in all; at most ${xc/1e3} KB.`)}if(t.credits!==void 0){if(!Array.isArray(t.credits)||t.credits.length>5)throw new Error("credits: at most 5 lines.");t.credits.forEach((r,i)=>oe(r,`credits[${i}]`))}let s={exact:new Set,repeated:new Set,count:0,figures:n};return t.steps.forEach((r,i)=>yn(r,`Step ${i+1}`,s,null)),{...t,id:t.id??"pasted",title:t.title??"",background:t.background??"dots"}}export{ki as DEFAULT_PROFILE,ji as agentsIn,Rm as applyChanges,dm as compare,Vm as declaredFrom,eg as evalsFrom,Ch as extractAgent,Xm as firedFrom,Im as fromSheets,Ni as groupLooks,ot as groupPatterns,qh as knownKinds,re as labelOf,Bm as lessonOf,Jm as mergeDeclared,Ti as playbillOf,Hh as problemText,Yh as readCast,Um as readCsv,jh as readProfile,hm as reviewCast,Km as stageOf,cg as validateScene,tg as withEvals,xm as workbookFile,Mm as workbookOf,Gh as writeCast};
|
|
163
|
+
`&&g++,a.push(c),o.push(a),a=[],c=""):c+=u}return(c||a.length)&&o.push([...a,c]),{name:t,rows:o}}function Ls(e){let t=new Map;for(let n of e)for(let s of[n.schemaName,n.id,n.displayName])s&&he(s)&&t.set(he(s),n.id);return n=>t.get(he(n))}function bc(e,t,n,s){let r=e.rows[0]??[];if(s){let f=r.findIndex(g=>he(g)===he(s));return f>=0?{at:f}:{problem:"header",titles:r}}let i=r.map((f,g)=>new Set(e.rows.slice(1).map(u=>t(u[g]??"")).filter(Boolean)).size),o=Math.max(0,...i),a=i.flatMap((f,g)=>f===o?[g]:[]);if(o<Math.min(2,n))return{problem:"none",titles:r};let c=e.rows.slice(1).every(f=>new Set(a.map(g=>t(f[g]??"")).filter(Boolean)).size<=1);return a.length>1&&!c?{problem:"tie",titles:a.map(f=>r[f])}:{at:a[0]}}var Vm={dono:"team",responsavel:"team",equipe:"team",time:"team",squad:"team",proprietario:"owner","owner-name":"owner",indicador:"kpi",kpis:"kpi"},Mi=e=>{let t=e.normalize("NFD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");return Vm[t]??t},Jm=new Set(["itemtype","tipodoitem","tipo","type"]),Gm=new Set(["agent","agente","agents","agentes","copilotstudioagent","microsoftcopilotstudio/agents"]);function Hm(e,t,n,s){let r=Ls(t),i=bc(e,r,t.length,s.agentColumn);if(!("at"in i))return{changes:[],unmatched:[],problem:i};let o=e.rows[0],a=o.findIndex(p=>Jm.has(he(p))),c=p=>`${s.file}${e.name?` \u203A ${e.name}`:""} \u203A ${s.lang==="pt"?"linha":"line"} ${p}`,f=new Map,g=[];e.rows.slice(1).forEach((p,d)=>{if(!p.some(k=>k.trim())||a>=0&&p[a]?.trim()&&!Gm.has(he(p[a])))return;let m=(p[i.at]??"").trim(),y=r(m);if(!y)return g.push({line:d+2,value:m});o.forEach((k,v)=>{let S=(p[v]??"").trim();v===i.at||v===a||!S||!Mi(k)||r(S)===y||f.set(`${y} ${Mi(k)}`,{agent:y,key:Mi(k),value:S,source:c(d+2)})})});let u=[],l=0;for(let p of f.values()){let d=n.declared.find(m=>m.agent===p.agent&&m.key===p.key);d?(d.value!==p.value||d.source!==p.source)&&u.push({key:`d${++l}`,kind:"declared",op:"set",before:d,after:p}):u.push({key:`d${++l}`,kind:"declared",op:"add",after:p})}return{changes:u,unmatched:g}}function Xm(e){let t=new Map;for(let n of e)n.kind==="declared"&&n.after&&t.set(`${n.after.agent} ${n.after.key}`,n);return[...t.values()].map((n,s)=>({...n,key:`d${s+1}`}))}var Qm=new Set(["evento","event","eventname","name","nome"]),Zm=new Set(["vezes","count","contagem","times","total"]);function eg(e,t,n){let s=Ls(t),r=bc(e,s,t.length,n.agentColumn);if(!("at"in r))return{problem:r};let i=e.rows[0],o=i.findIndex((f,g)=>g!==r.at&&Qm.has(he(f)));if(o<0)return{problem:{problem:"event",titles:i}};let a=i.findIndex(f=>Zm.has(he(f))),c=[];return e.rows.slice(1).forEach((f,g)=>{let u=s(f[r.at]??""),l=(f[o]??"").trim();if(!u||!l)return;let p=a>=0?Number((f[a]??"").replace(/[^\d]/g,""))||0:1;c.push({agent:u,event:l,count:p,line:g+2})}),{days:n.days,file:n.file,rows:c}}var tg=e=>e.split(/[\\/]/).pop()??e;function ng(e){let t=tg(e).replace(/\.csv$/i,"").replace(/\s*\(\d+\)$/,"").replace(/^Evaluate[\s_-]+/i,""),n=/^(.*?)[\s_-]+(\d{4}-\d{2}-\d{2}|\d{1,2}[-_.]\d{1,2}[-_.]\d{2,4}|\d{8})$/.exec(t);return n?{who:n[1],date:n[2]}:{who:t}}function sg(e,t){let n=Ls(t),s={sets:[],unknown:[]};for(let{name:r,table:i}of e){let{who:o,date:a}=ng(r),c=n(o);if(!c){s.unknown.push({file:r,why:"who"});continue}let f=i.rows[0]??[],g=f.flatMap(m=>/^result_(\d+)$/i.exec(m.trim())?.[1]??[]).map(Number).sort((m,y)=>m-y);if(!g.length){s.unknown.push({file:r,why:"format"});continue}let u=m=>f.findIndex(y=>y.trim().toLowerCase()===m.toLowerCase()),l=i.rows.slice(1).filter(m=>m.some(y=>y.trim())),p=(m,y)=>(m[u(`result_${y}`)]??"").trim().toLowerCase()==="pass",d=g.map(m=>({name:l.map(k=>(k[u(`testMethodType_${m}`)]??"").trim()).find(Boolean)||`#${m}`,passed:l.filter(k=>p(k,m)).length,total:l.length}));s.sets.push({agent:c,file:r,...a?{date:a}:{},total:l.length,passed:l.filter(m=>g.every(y=>p(m,y))).length,methods:d})}return s}function rg(e,t){return e.map(n=>{let s=t.filter(r=>r.agent===n.id);return s.length?{...n,facts:{...n.facts,"eval:run":s.map(r=>({file:r.file,line:1}))}}:n})}var wc=["and","or","not"];var Ii=["person","person-pointing","person-sitting","house","car","bus","coin","phone","document","server","bank","cloud","queue","desk","computer","clock","lock","money-arrow","tree","school","hospital","factory","truck","cart","safe","bulb","gear","database","robot","ship","container","warehouse","box","pallet","shop","shelf","field","cup","function","api-gateway","cache","cluster","board","book","pencil"],Ms={pessoa:"person","pessoa-apontando":"person-pointing","pessoa-sentada":"person-sitting",casa:"house",carro:"car",onibus:"bus",moeda:"coin",celular:"phone",documento:"document",servidor:"server",banco:"bank",nuvem:"cloud",fila:"queue",mesa:"desk",computador:"computer",relogio:"clock",cadeado:"lock","seta-dinheiro":"money-arrow"},Is=e=>Ii.includes(e)?e:typeof e=="string"&&Object.hasOwn(Ms,e)?Ms[e]:void 0;var $c=e=>Is(e)!==void 0,x={skin:"#E8C6A5",shirt:"#A9BCC3",wood:"#D8C29C",gold:"#F2C94C",paper:"#FFFFFF",screen:"#DCE8F0",device:"#5B6B7C",roof:"#D9785F",wall:"#F3E3C3",car:"#7FA7C9",bus:"#E9C46A",green:"#7DBE8A",dark:"#4A4A4A",metal:"#C9D3DD",board:"#2F4F3F",chalk:"#F2EFE6"},_=(e,t,n,s,r,i)=>({kind:"polygon",points:[[e,t],[e+n,t],[e+n,t+s],[e,t+s]],fill:r,main:i}),W=(...e)=>({kind:"polyline",points:e});function vc(e){return[{kind:"polygon",points:[[-.15,-.72],[.15,-.72],[.19,-.38],[-.19,-.38]],fill:x.shirt,main:!0},{kind:"circle",c:[0,-.87],r:.11,fill:x.skin},...e,W([-.08,-.38],[-.1,0]),W([.08,-.38],[.1,0])]}var kc=vc([W([-.15,-.7],[-.25,-.42]),W([.15,-.7],[.25,-.42])]);function ig(e,t,n){let s=([r,i])=>[n+r*t,i*t];return e.map(r=>r.kind==="circle"?{...r,c:s(r.c),r:r.r*t}:{...r,points:r.points.map(s)})}function og(){let e=[[-.28,-.3,.18],[-.06,-.45,.25],[.2,-.4,.21],[.37,-.27,.13]],t=[];for(let n=0;n<=24;n++){let s=-.46+.96*n/24,r=e.filter(([i,,o])=>Math.abs(s-i)<=o).map(([i,o,a])=>o-Math.sqrt(Math.max(0,a*a-(s-i)**2)));r.length&&t.push([s,Math.min(...r)])}return[...t,[.42,-.12],[-.4,-.12]]}var Y0={person:kc,"person-pointing":vc([W([-.15,-.7],[-.25,-.42]),W([.15,-.69],[.47,-.73])]),"person-sitting":[W([-.3,-.8],[-.27,-.4]),W([-.32,-.4],[.2,-.4]),W([-.27,-.4],[-.27,0]),W([.16,-.4],[.16,0]),{kind:"polygon",points:[[-.22,-.77],[.04,-.77],[.06,-.44],[-.22,-.44]],fill:x.shirt,main:!0},{kind:"circle",c:[-.08,-.9],r:.1,fill:x.skin},W([-.1,-.44],[.3,-.44],[.32,0]),W([0,-.74],[.18,-.55],[.3,-.58])],house:[_(-.4,-.6,.8,.6,x.wall,!0),{kind:"polygon",points:[[-.5,-.58],[0,-1],[.5,-.58]],fill:x.roof},_(-.08,-.32,.16,.32,x.wood),_(.16,-.46,.16,.14,x.screen)],car:[{kind:"polygon",fill:x.car,main:!0,points:[[-.5,-.14],[-.5,-.32],[-.3,-.36],[-.18,-.56],[.2,-.56],[.32,-.36],[.5,-.32],[.5,-.14]]},{kind:"polygon",points:[[-.14,-.51],[.17,-.51],[.25,-.37],[-.22,-.37]],fill:x.screen},{kind:"circle",c:[-.28,-.12],r:.1,fill:x.dark},{kind:"circle",c:[.28,-.12],r:.1,fill:x.dark}],bus:[_(-.5,-.66,1,.52,x.bus,!0),...[-.42,-.21,0,.21].map(e=>_(e,-.6,.15,.16,x.screen)),W([-.5,-.3],[.5,-.3]),{kind:"circle",c:[-.3,-.12],r:.1,fill:x.dark},{kind:"circle",c:[.3,-.12],r:.1,fill:x.dark}],coin:[{kind:"circle",c:[0,-.42],r:.4,fill:x.gold,main:!0},{kind:"circle",c:[0,-.42],r:.3},{kind:"curve",points:[[.1,-.56],[-.08,-.57],[-.09,-.46],[.08,-.39],[.08,-.29],[-.11,-.28]]},W([0,-.64],[0,-.2])],phone:[_(-.26,-1,.52,1,x.device,!0),_(-.2,-.92,.4,.76,x.screen),{kind:"circle",c:[0,-.08],r:.035,fill:x.paper}],document:[{kind:"polygon",points:[[-.36,-1],[.16,-1],[.36,-.8],[.36,0],[-.36,0]],fill:x.paper,main:!0},W([.16,-1],[.16,-.8],[.36,-.8]),...[-.66,-.5,-.34,-.18].map(e=>W([-.22,e],[.22,e]))],server:[-1,-.66,-.32].flatMap(e=>[_(-.36,e,.72,.3,x.metal,!0),W([-.26,e+.15],[.06,e+.15]),{kind:"circle",c:[.22,e+.15],r:.035,fill:x.green}]),bank:[{kind:"polygon",points:[[-.5,-.74],[0,-1],[.5,-.74]],fill:x.wall,main:!0},_(-.45,-.74,.9,.08,x.wall),...[-.33,-.11,.11,.33].map(e=>_(e-.04,-.66,.08,.56,x.paper)),_(-.5,-.1,1,.1,x.wall)],cloud:[{kind:"polygon",points:og(),fill:x.paper,main:!0}],queue:[-.32,0,.32].flatMap(e=>ig(kc,.7,e)),desk:[_(-.5,-.5,1,.07,x.wood,!0),W([-.42,-.43],[-.42,0]),W([.42,-.43],[.42,0])],computer:[_(-.45,-1,.9,.6,x.device,!0),_(-.39,-.94,.78,.48,x.screen),{kind:"polygon",points:[[-.06,-.4],[.06,-.4],[.1,-.1],[-.1,-.1]],fill:x.device},_(-.25,-.1,.5,.08,x.device)],clock:[{kind:"circle",c:[0,-.48],r:.45,fill:x.paper,main:!0},...[[0,-.9,0,-.82],[.42,-.48,.34,-.48],[0,-.06,0,-.14],[-.42,-.48,-.34,-.48]].map(([e,t,n,s])=>W([e,t],[n,s])),W([0,-.48],[0,-.78]),W([0,-.48],[.2,-.48])],lock:[{kind:"curve",points:[[-.22,-.52],[-.22,-.76],[0,-.96],[.22,-.76],[.22,-.52]]},_(-.36,-.54,.72,.54,x.bus,!0),{kind:"circle",c:[0,-.32],r:.06,fill:x.dark},W([0,-.28],[0,-.14])],"money-arrow":[{kind:"polygon",fill:x.green,main:!0,points:[[-.5,-.4],[.12,-.4],[.12,-.56],[.5,-.3],[.12,-.04],[.12,-.2],[-.5,-.2]]},{kind:"circle",c:[-.2,-.3],r:.16,fill:x.gold},W([-.2,-.4],[-.2,-.2])],tree:[_(-.07,-.36,.14,.36,x.wood),{kind:"circle",c:[0,-.64],r:.3,fill:x.green,main:!0}],school:[_(-.45,-.6,.9,.6,x.wall,!0),{kind:"polygon",points:[[-.5,-.6],[0,-.82],[.5,-.6]],fill:x.roof},_(-.08,-.28,.16,.28,x.wood),_(-.36,-.48,.16,.12,x.screen),_(.2,-.48,.16,.12,x.screen),W([0,-.82],[0,-1]),{kind:"polygon",points:[[0,-1],[.17,-.95],[0,-.9]],fill:x.roof}],hospital:[_(-.4,-.8,.8,.8,x.paper,!0),_(-.045,-.7,.09,.26,"#C8442C"),_(-.13,-.615,.26,.09,"#C8442C"),_(-.1,-.24,.2,.24,x.metal)],factory:[{kind:"polygon",points:[[-.5,0],[-.5,-.5],[-.25,-.65],[-.25,-.5],[0,-.65],[0,-.5],[.25,-.65],[.25,-.5],[.5,-.5],[.5,0]],fill:x.wall,main:!0},_(.3,-.95,.12,.3,x.dark),_(-.38,-.32,.16,.12,x.screen),_(-.08,-.32,.16,.12,x.screen),_(.22,-.32,.16,.12,x.screen)],truck:[_(-.5,-.62,.62,.46,x.metal,!0),{kind:"polygon",points:[[.12,-.16],[.12,-.5],[.34,-.5],[.48,-.32],[.48,-.16]],fill:x.bus},{kind:"polygon",points:[[.18,-.46],[.32,-.46],[.42,-.33],[.18,-.33]],fill:x.screen},{kind:"circle",c:[-.3,-.1],r:.1,fill:x.dark},{kind:"circle",c:[.3,-.1],r:.1,fill:x.dark}],cart:[W([-.48,-.78],[-.4,-.62]),{kind:"polygon",points:[[-.4,-.62],[.42,-.62],[.32,-.26],[-.3,-.26]],fill:x.metal,main:!0},W([-.3,-.26],[-.3,-.14],[.32,-.14]),{kind:"circle",c:[-.22,-.07],r:.06,fill:x.dark},{kind:"circle",c:[.24,-.07],r:.06,fill:x.dark}],safe:[_(-.4,-.82,.8,.82,x.device,!0),_(-.3,-.72,.6,.62,x.metal),{kind:"circle",c:[0,-.41],r:.13,fill:x.paper},W([0,-.41],[.08,-.47])],bulb:[{kind:"circle",c:[0,-.62],r:.3,fill:x.gold,main:!0},_(-.13,-.33,.26,.2,x.metal),{kind:"curve",points:[[-.09,-.52],[0,-.66],[.09,-.52]]},W([-.08,-.08],[.08,-.08])],gear:[{kind:"polygon",points:[[.42,-.5],[.296,-.378],[.297,-.203],[.122,-.204],[0,-.08],[-.122,-.204],[-.297,-.203],[-.296,-.378],[-.42,-.5],[-.296,-.622],[-.297,-.797],[-.122,-.796],[-0,-.92],[.122,-.796],[.297,-.797],[.296,-.622]],fill:x.metal,main:!0},{kind:"circle",c:[0,-.5],r:.12,fill:x.paper}],database:[{kind:"polygon",points:[[-.35,-.8],[.35,-.8],[.35,-.16],[-.35,-.16]],fill:x.screen,main:!0},{kind:"polygon",points:[[.35,-.8],[.303,-.755],[.175,-.722],[0,-.71],[-.175,-.722],[-.303,-.755],[-.35,-.8],[-.303,-.845],[-.175,-.878],[-0,-.89],[.175,-.878],[.303,-.845]],fill:x.metal},{kind:"curve",points:[[-.35,-.16],[0,-.06],[.35,-.16]]},{kind:"curve",points:[[-.35,-.58],[0,-.48],[.35,-.58]]},{kind:"curve",points:[[-.35,-.37],[0,-.27],[.35,-.37]]}],robot:[W([0,-.95],[0,-1]),_(-.22,-.95,.44,.3,x.metal),{kind:"circle",c:[-.09,-.81],r:.045,fill:x.screen},{kind:"circle",c:[.09,-.81],r:.045,fill:x.screen},_(-.28,-.62,.56,.42,x.metal,!0),W([-.28,-.55],[-.42,-.35]),W([.28,-.55],[.42,-.35]),_(-.2,-.2,.12,.2,x.device),_(.08,-.2,.12,.2,x.device)],ship:[{kind:"polygon",points:[[-.48,-.3],[.48,-.3],[.36,-.04],[-.4,-.04]],fill:x.car,main:!0},_(-.42,-.62,.14,.32,x.wall),_(-.24,-.5,.2,.2,x.roof),_(-.02,-.5,.2,.2,x.bus),_(.2,-.5,.2,.2,x.green),{kind:"curve",points:[[-.5,0],[-.3,-.04],[-.1,0],[.1,-.04],[.3,0],[.5,-.04]]}],container:[_(-.46,-.52,.92,.52,x.roof,!0),...[-.3,-.15,0,.15,.3].map(e=>W([e,-.48],[e,-.04]))],warehouse:[{kind:"polygon",points:[[-.46,0],[.46,0],[.46,-.55],[0,-.82],[-.46,-.55]],fill:x.wall,main:!0},_(-.2,-.38,.4,.38,x.metal),W([-.2,-.26],[.2,-.26]),W([-.2,-.13],[.2,-.13])],box:[_(-.36,-.5,.52,.5,x.wood,!0),{kind:"polygon",points:[[-.36,-.5],[.16,-.5],[.36,-.64],[-.16,-.64]],fill:x.wood},{kind:"polygon",points:[[.16,0],[.36,-.14],[.36,-.64],[.16,-.5]],fill:x.wood},W([-.1,-.5],[.1,-.64])],pallet:[_(-.46,-.12,.92,.06,x.wood),...[-.42,-.05,.32].map(e=>_(e,-.06,.1,.06,x.wood)),_(-.42,-.5,.4,.38,x.wood,!0),_(.02,-.5,.4,.38,x.wood),_(-.2,-.82,.4,.32,x.wood)],shop:[_(-.42,-.6,.84,.6,x.wall,!0),{kind:"polygon",points:[[-.48,-.6],[.48,-.6],[.42,-.78],[-.42,-.78]],fill:x.roof},_(-.34,-.48,.34,.26,x.screen),_(.08,-.42,.24,.42,x.wood)],shelf:[_(-.4,-.92,.8,.92,x.paper,!0),W([-.4,-.62],[.4,-.62]),W([-.4,-.32],[.4,-.32]),_(-.32,-.8,.16,.18,x.roof),_(-.1,-.78,.14,.16,x.bus),_(.1,-.5,.22,.18,x.green),_(-.3,-.2,.24,.2,x.wood)],field:[W([-.48,0],[.48,0]),...[-.3,0,.3].flatMap(e=>[{kind:"curve",points:[[e,0],[e-.02,-.25],[e,-.5]]},{kind:"circle",c:[e-.08,-.32],r:.07,fill:x.green,main:!0},{kind:"circle",c:[e+.08,-.42],r:.07,fill:x.green,main:!0},{kind:"circle",c:[e,-.52],r:.06,fill:x.roof}])],cup:[{kind:"polygon",points:[[-.26,-.52],[.26,-.52],[.2,-.1],[-.2,-.1]],fill:x.paper,main:!0},{kind:"curve",points:[[.24,-.44],[.4,-.38],[.22,-.2]]},{kind:"polygon",points:[[-.46,-.1],[.46,-.1],[.36,0],[-.36,0]],fill:x.paper},{kind:"curve",points:[[-.08,-.62],[-.02,-.72],[-.08,-.84]]},{kind:"curve",points:[[.08,-.62],[.14,-.72],[.08,-.84]]}],function:[_(-.38,-.72,.76,.62,x.screen,!0),W([-.14,-.62],[0,-.62],[.14,-.2]),W([.02,-.42],[-.14,-.2])],"api-gateway":[_(-.12,-.8,.24,.8,x.metal,!0),W([-.48,-.55],[-.16,-.55]),W([-.24,-.62],[-.16,-.55],[-.24,-.48]),W([.16,-.3],[.48,-.3]),W([.4,-.37],[.48,-.3],[.4,-.23])],cache:[_(-.34,-.66,.68,.66,x.metal,!0),{kind:"polygon",points:[[.04,-.58],[-.12,-.3],[0,-.3],[-.06,-.08],[.14,-.38],[.02,-.38]],fill:x.gold}],cluster:[{kind:"curve",points:[[-.4,-.8],[0,-.86],[.4,-.8],[.48,-.45],[.4,-.1],[0,-.04],[-.4,-.1],[-.48,-.45],[-.4,-.8]]},_(-.3,-.7,.24,.2,x.screen,!0),_(.06,-.7,.24,.2,x.screen,!0),_(-.12,-.38,.24,.2,x.screen,!0)],board:[_(-.48,-.9,.96,.6,x.board,!0),_(-.34,-.76,.42,.03,x.chalk),_(-.34,-.62,.58,.03,x.chalk),_(-.34,-.48,.3,.03,x.chalk),W([-.3,-.3],[-.36,0]),W([.3,-.3],[.36,0])],book:[{kind:"polygon",points:[[0,-.62],[-.46,-.7],[-.46,-.1],[0,-.04]],fill:x.paper,main:!0},{kind:"polygon",points:[[0,-.62],[.46,-.7],[.46,-.1],[0,-.04]],fill:x.paper,main:!0},W([-.36,-.52],[-.1,-.48]),W([-.36,-.38],[-.1,-.34]),W([.1,-.48],[.36,-.52]),W([.1,-.34],[.36,-.38])],pencil:[{kind:"polygon",points:[[-.38,-.12],[.22,-.72],[.34,-.6],[-.26,0]],fill:x.bus,main:!0},{kind:"polygon",points:[[.22,-.72],[.34,-.6],[.44,-.86]],fill:x.wood},{kind:"polygon",points:[[-.38,-.12],[-.26,0],[-.46,-.02]],fill:x.roof}]},Sc=["happy","sad","surprised","worried","idea"],ag={person:[0,-.87,.11],"person-pointing":[0,-.87,.11],"person-sitting":[-.08,-.9,.1]},Oc=e=>{let t=Is(e);return!!t&&t in ag};var Ac=["spin","drive","steam","talk","pulse","float"],lg=["lesson","pitch","arch","decision","data","timeline","story"],Nc=8,Ec=6,xc=2e5,Tc=6e5,Cc=24;var qc=["card","line","arrow","polyline","polygon","curve","circle","ellipse","plot","text","highlight","pause","prop","repeat","when","move","link","counter","row","column","grid","axis","timeline","balloon","brace","note","table","bars","chain","animate","lottie"],Nt=["text","prop","card","counter","circle","ellipse"],Pc=["row","column","grid","chain"],cg=50;function ce(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t}: expected an object.`)}function oe(e,t){if(typeof e!="string"||!e.trim()||e.length>2e3)throw new Error(`${t}: expected text of 1 to 2000 characters.`)}function Q(e,t,n=-1e4,s=1e4){if(typeof e!="number"||!Number.isFinite(e)||e<n||e>s)throw new Error(`${t}: expected a number between ${n} and ${s}.`)}function be(e,t){if(typeof e=="string"){if(oe(e,t),e.length>300)throw new Error(`${t}: expression too long.`)}else Q(e,t)}function ye(e,t){if(!Array.isArray(e)||e.length!==2)throw new Error(`${t}: expected [x, y].`);e.forEach((n,s)=>be(n,`${t}[${s}]`))}function Ce(e,t){e!==void 0&&oe(e,t)}function we(e,t,n){if(e!==void 0&&(typeof e!="string"||!t.includes(e)))throw new Error(`${n}: choose one of ${t.join(", ")}.`)}function Rs(e){if(!/^[A-Za-z_][A-Za-z_0-9]*$/.test(e)||["__proto__","constructor","prototype",...wc].includes(e))throw new Error(`Invalid variable name: "${e}".`)}var Et=(e,t)=>t.includes("{")||e.exact.has(t)||[...e.repeated].some(n=>t.startsWith(`${n}-`)&&/^\d+$/.test(t.slice(n.length+1)));function lt(e,t,n,s){s&&e[t]===void 0&&(e[t]=[0,0]),ye(e[t],`${n}.${t}`)}function wn(e,t,n,s,r=!1){if(ce(e,t),++n.count>500)throw new Error(`${t}: a recipe draws at most 500 steps, counting those inside repeat and when.`);if(s){for(let a of["chapter","say","duration"])if(e[a]!==void 0)throw new Error(`${t}.${a}: put it on the ${s} step itself, not on a step inside it.`);if(e.type==="pause")throw new Error(`${t}: a pause cannot go inside ${s}.`);if(e.type==="repeat"&&s==="repeat")throw new Error(`${t}: a repeat cannot go inside another repeat.`);if(Pc.includes(s)&&e.place!==void 0)throw new Error(`${t}.place: the ${s} places the steps inside it.`)}if(!qc.includes(e.type))throw new Error(`${t}: unknown type "${e.type}".`);for(let a of["id","say","chapter"])Ce(e[a],`${t}.${a}`);if(e.duration!==void 0&&Q(e.duration,`${t}.duration`,0,3e4),e.nudge!==void 0){if(["pause","move","link","animate"].includes(e.type))throw new Error(`${t}.nudge: a ${e.type} has no place of its own to move.`);if(!Array.isArray(e.nudge)||e.nudge.length!==2)throw new Error(`${t}.nudge: use [dx, dy].`);e.nudge.forEach((a,c)=>Q(a,`${t}.nudge[${c}]`,-900,900))}let i=s!==null&&Pc.includes(s)||r;if(e.place!==void 0){if(!Nt.includes(e.type))throw new Error(`${t}.place: only ${Nt.join(", ")} can be placed.`);if(ce(e.place,`${t}.place`),oe(e.place.to,`${t}.place.to`),!Et(n,String(e.place.to)))throw new Error(`${t}.place.to: no earlier step has the id "${e.place.to}".`);if(!["below","above","left","right"].includes(e.place.side))throw new Error(`${t}.place.side: choose one of below, above, left, right.`);e.place.gap!==void 0&&Q(e.place.gap,`${t}.place.gap`,-200,400),we(e.place.align,["center","start","end"],`${t}.place.align`)}let o=i||e.place!==void 0;if(e.style!==void 0){ce(e.style,`${t}.style`);for(let a of["color","fill"]){let c=e.style[a];if(c!==void 0&&(typeof c!="string"||!/^(#[\da-f]{3,8}|[a-z]+)$/i.test(c)))throw new Error(`${t}.style.${a}: use a hex colour or a colour name, no URLs.`)}for(let a of["width","roughness","bowing"])e.style[a]!==void 0&&Q(e.style[a],`${t}.style.${a}`,0,20);if(e.style.opacity!==void 0&&Q(e.style.opacity,`${t}.style.opacity`,0,1),e.style.dashed!==void 0&&typeof e.style.dashed!="boolean")throw new Error(`${t}: dashed must be a boolean.`);we(e.style.fillStyle,["hachure","solid","zigzag","cross-hatch","dots"],`${t}.style.fillStyle`)}switch(e.type){case"line":case"arrow":case"highlight":ye(e.from,`${t}.from`),ye(e.to,`${t}.to`),e.thickness!==void 0&&Q(e.thickness,`${t}.thickness`,1,200);break;case"polyline":case"polygon":case"curve":if(!Array.isArray(e.points)||e.points.length<(e.type==="polygon"?3:2)||e.points.length>500)throw new Error(`${t}: points needs ${e.type==="polygon"?3:2} to 500 points.`);e.points.forEach((a,c)=>ye(a,`${t}.points[${c}]`));break;case"circle":case"ellipse":lt(e,"center",t,o);for(let a of e.type==="circle"?["r"]:["rx","ry"])be(e[a],`${t}.${a}`),typeof e[a]=="number"&&Q(e[a],`${t}.${a}`,0);break;case"text":lt(e,"at",t,o),oe(e.text,`${t}.text`),e.size!==void 0&&Q(e.size,`${t}.size`,1,200),e.rotate!==void 0&&Q(e.rotate,`${t}.rotate`,-360,360),we(e.font,["hand","body"],`${t}.font`),we(e.anchor,["start","middle","end"],`${t}.anchor`);break;case"card":lt(e,"at",t,o),be(e.w,`${t}.w`),be(e.h,`${t}.h`);for(let a of["w","h"])typeof e[a]=="number"&&Q(e[a],`${t}.${a}`,40);if(oe(e.title,`${t}.title`),e.lines!==void 0){if(!Array.isArray(e.lines)||e.lines.length>6)throw new Error(`${t}: at most 6 lines per card.`);e.lines.forEach((a,c)=>oe(a,`${t}.lines[${c}]`))}break;case"plot":oe(e.fn,`${t}.fn`),e.var!==void 0&&(oe(e.var,`${t}.var`),Rs(String(e.var))),ye(e.domain,`${t}.domain`),ye(e.range,`${t}.range`),ce(e.box,`${t}.box`);for(let a of["x","y","w","h"])be(e.box[a],`${t}.box.${a}`);if(e.samples!==void 0&&(Q(e.samples,`${t}.samples`,2,1e3),!Number.isInteger(e.samples)))throw new Error(`${t}: samples must be an integer.`);break;case"pause":Q(e.ms,`${t}.ms`,0,3e4),Ce(e.ask,`${t}.ask`);break;case"prop":if(!$c(e.name)&&!n.figures.has(String(e.name))){let a=n.figures.size?`, or one the recipe defines (${[...n.figures].join(", ")})`:"";throw new Error(`${t}.name: unknown prop "${String(e.name)}"; use one of ${Ii.join(", ")}${a}.`)}if(lt(e,"at",t,o),e.size!==void 0&&(be(e.size,`${t}.size`),typeof e.size=="number"&&Q(e.size,`${t}.size`,10,1e3)),Ce(e.label,`${t}.label`),e.flip!==void 0&&typeof e.flip!="boolean")throw new Error(`${t}.flip: expected true or false.`);if(e.mood!==void 0){if(!Oc(e.name))throw new Error(`${t}.mood: only a person (person, person-pointing, person-sitting) has a face.`);we(e.mood,Sc,`${t}.mood`)}break;case"repeat":if(be(e.times,`${t}.times`),typeof e.times=="number"&&(Q(e.times,`${t}.times`,0,cg),!Number.isInteger(e.times)))throw new Error(`${t}.times: expected a whole number.`);wn(e.step,`${t}.step`,n,"repeat",i);break;case"when":if(be(e.if,`${t}.if`),!Array.isArray(e.steps)||e.steps.length===0||e.steps.length>50)throw new Error(`${t}.steps: expected 1 to 50 steps.`);e.steps.forEach((a,c)=>wn(a,`${t}.steps[${c}]`,n,s??"when"));break;case"move":if(oe(e.target,`${t}.target`),!Et(n,String(e.target)))throw new Error(`${t}.target: no earlier step has the id "${e.target}".`);ye(e.to,`${t}.to`),we(e.along,["line","curve"],`${t}.along`),e.ms!==void 0&&Q(e.ms,`${t}.ms`,200,5e3);break;case"lottie":if(oe(e.src,`${t}.src`),ye(e.at,`${t}.at`),e.size!==void 0&&(be(e.size,`${t}.size`),typeof e.size=="number"&&Q(e.size,`${t}.size`,24,1e3)),e.loop!==void 0&&typeof e.loop!="boolean")throw new Error(`${t}.loop: expected true or false.`);break;case"animate":if(oe(e.target,`${t}.target`),!Et(n,String(e.target)))throw new Error(`${t}.target: no earlier step has the id "${e.target}".`);if(we(e.effect,[...Ac,"stop"],`${t}.effect`),e.effect===void 0)throw new Error(`${t}.effect: choose one of ${[...Ac,"stop"].join(", ")}.`);we(e.speed,["slow","fast"],`${t}.speed`);break;case"link":for(let a of["from","to"])if(oe(e[a],`${t}.${a}`),!Et(n,String(e[a])))throw new Error(`${t}.${a}: no earlier step has the id "${e[a]}".`);Ce(e.label,`${t}.label`);break;case"counter":if(lt(e,"at",t,o),be(e.value,`${t}.value`),e.format!==void 0&&(oe(e.format,`${t}.format`),!String(e.format).includes("{v")))throw new Error(`${t}.format: show the number as {v}, e.g. "R$ {v:0}".`);e.size!==void 0&&Q(e.size,`${t}.size`,1,200),we(e.anchor,["start","middle","end"],`${t}.anchor`);break;case"row":case"column":case"grid":if(i)throw new Error(`${t}: a ${e.type} cannot go inside another ${s}.`);if(lt(e,"at",t,!1),e.gap!==void 0&&Q(e.gap,`${t}.gap`,0,400),e.type==="grid"){if(Q(e.columns,`${t}.columns`,1,12),!Number.isInteger(e.columns))throw new Error(`${t}.columns: expected a whole number.`)}else we(e.align,["center","start","end"],`${t}.align`);if(!Array.isArray(e.steps)||e.steps.length===0||e.steps.length>50)throw new Error(`${t}.steps: expected 1 to 50 steps.`);e.steps.forEach((a,c)=>{ce(a,`${t}.steps[${c}]`);let f=a.type==="repeat"?a.step?.type:a.type;if(!Nt.includes(f))throw new Error(`${t}.steps[${c}]: a ${e.type} holds only ${Nt.join(", ")} (or a repeat of one).`);wn(a,`${t}.steps[${c}]`,n,e.type)});break;case"chain":if(i)throw new Error(`${t}: a chain cannot go inside a ${s}.`);if(lt(e,"at",t,!1),e.gap!==void 0&&e.gap!=="auto"&&Q(e.gap,`${t}.gap`,0,400),we(e.direction,["right","down"],`${t}.direction`),e.wrap!==void 0&&typeof e.wrap!="boolean")throw new Error(`${t}.wrap: expected true or false.`);if(Ce(e.forward,`${t}.forward`),Ce(e.back,`${t}.back`),e.size!==void 0&&(be(e.size,`${t}.size`),typeof e.size=="number"&&Q(e.size,`${t}.size`,10,1e3)),!Array.isArray(e.steps)||e.steps.length<2||e.steps.length>12)throw new Error(`${t}.steps: a chain joins 2 to 12 pieces.`);e.steps.forEach((a,c)=>{if(ce(a,`${t}.steps[${c}]`),!Nt.includes(a.type))throw new Error(`${t}.steps[${c}]: a chain holds only ${Nt.join(", ")}.`);wn(a,`${t}.steps[${c}]`,n,"chain")});break;case"axis":case"timeline":if(ye(e.from,`${t}.from`),ye(e.to,`${t}.to`),ye(e.domain,`${t}.domain`),e.type==="axis"){if(e.ticks!==void 0){if(Array.isArray(e.ticks)){if(e.ticks.length>30)throw new Error(`${t}.ticks: at most 30 marks.`);e.ticks.forEach((a,c)=>Q(a,`${t}.ticks[${c}]`))}else if(Q(e.ticks,`${t}.ticks`,0,30),!Number.isInteger(e.ticks))throw new Error(`${t}.ticks: expected a whole number.`)}if(Ce(e.label,`${t}.label`),e.format!==void 0&&(oe(e.format,`${t}.format`),!String(e.format).includes("{v")))throw new Error(`${t}.format: show the number as {v}, e.g. "{v} km".`)}else{if(!Array.isArray(e.marks)||e.marks.length===0||e.marks.length>20)throw new Error(`${t}.marks: expected 1 to 20 marks.`);e.marks.forEach((a,c)=>{ce(a,`${t}.marks[${c}]`),be(a.at,`${t}.marks[${c}].at`),Ce(a.label,`${t}.marks[${c}].label`),Ce(a.text,`${t}.marks[${c}].text`)})}break;case"balloon":if(oe(e.to,`${t}.to`),!Et(n,String(e.to)))throw new Error(`${t}.to: no earlier step has the id "${e.to}".`);if(oe(e.text,`${t}.text`),String(e.text).length>300)throw new Error(`${t}.text: keep a balloon under 300 characters.`);we(e.side,["below","above","left","right"],`${t}.side`),we(e.kind,["speech","thought"],`${t}.kind`),e.width!==void 0&&Q(e.width,`${t}.width`,80,600),e.size!==void 0&&Q(e.size,`${t}.size`,12,60);break;case"brace":if(ye(e.from,`${t}.from`),ye(e.to,`${t}.to`),Ce(e.label,`${t}.label`),e.flip!==void 0&&typeof e.flip!="boolean")throw new Error(`${t}.flip: expected true or false.`);break;case"note":if(ye(e.at,`${t}.at`),oe(e.text,`${t}.text`),e.to===void 0==(e.point===void 0))throw new Error(`${t}: a note points either to an element (to) or to a point (point).`);if(e.to!==void 0){if(oe(e.to,`${t}.to`),!Et(n,String(e.to)))throw new Error(`${t}.to: no earlier step has the id "${e.to}".`)}else ye(e.point,`${t}.point`);e.size!==void 0&&Q(e.size,`${t}.size`,12,60);break;case"table":if(ye(e.at,`${t}.at`),!Array.isArray(e.rows)||e.rows.length===0||e.rows.length>12)throw new Error(`${t}.rows: expected 1 to 12 rows.`);if(e.rows.forEach((a,c)=>{if(!Array.isArray(a)||a.length===0||a.length>6)throw new Error(`${t}.rows[${c}]: expected 1 to 6 cells.`);a.forEach((f,g)=>{if(typeof f!="string"||f.length>120)throw new Error(`${t}.rows[${c}][${g}]: expected text of up to 120 characters.`)})}),e.header!==void 0&&typeof e.header!="boolean")throw new Error(`${t}.header: expected true or false.`);e.size!==void 0&&Q(e.size,`${t}.size`,12,40);break;case"bars":ce(e.box,`${t}.box`);for(let a of["x","y","w","h"])be(e.box[a],`${t}.box.${a}`);if(!Array.isArray(e.values)||e.values.length===0||e.values.length>12)throw new Error(`${t}.values: expected 1 to 12 values.`);if(e.values.forEach((a,c)=>be(a,`${t}.values[${c}]`)),e.labels!==void 0){if(!Array.isArray(e.labels)||e.labels.length>e.values.length)throw new Error(`${t}.labels: at most one label per value.`);e.labels.forEach((a,c)=>oe(a,`${t}.labels[${c}]`))}if(e.max!==void 0&&be(e.max,`${t}.max`),e.format!==void 0&&(oe(e.format,`${t}.format`),!String(e.format).includes("{v")))throw new Error(`${t}.format: show the number as {v}, e.g. "{v}%".`);break}typeof e.id=="string"&&(s==="repeat"?n.repeated:n.exact).add(e.id)}function fg(e,t){let n=`defs.${e}`;if(!/^[a-z][a-z0-9-]{1,30}$/.test(e))throw new Error(`${n}: a figure's name is 2 to 31 lowercase letters, digits or -, starting with a letter.`);if(Is(e)||Object.hasOwn(Ms,e)||qc.includes(e)||["define","title","param","switch","var"].includes(e))throw new Error(`${n}: "${e}" is already a prop or a step; choose another name.`);if(ce(t,n),!Array.isArray(t.shapes)||t.shapes.length===0||t.shapes.length>Cc)throw new Error(`${n}.shapes: expected 1 to ${Cc} shapes.`);let s=(r,i)=>{if(typeof r!="number"||!Number.isInteger(r)||r<0||r>100)throw new Error(`${i}: expected a whole number from 0 to 100 (the figure's grid, y down; it stands at 50,100).`)};t.shapes.forEach((r,i)=>{let o=`${n}.shapes[${i}]`;if(ce(r,o),r.fill!==void 0&&(typeof r.fill!="string"||!/^(#[0-9a-fA-F]{3,8}|[a-z]{3,20})$/.test(r.fill)))throw new Error(`${o}.fill: a colour, as hex or a plain name.`);if(r.kind==="circle"){if(!Array.isArray(r.c)||r.c.length!==2)throw new Error(`${o}.c: expected [x, y].`);r.c.forEach((c,f)=>s(c,`${o}.c[${f}]`)),s(r.r,`${o}.r`);return}if(!["polygon","polyline","curve"].includes(r.kind))throw new Error(`${o}.kind: choose one of polygon, polyline, curve, circle.`);let a=r.kind==="polygon"?3:2;if(!Array.isArray(r.points)||r.points.length<a||r.points.length>40)throw new Error(`${o}.points: a ${r.kind} takes ${a} to 40 points.`);r.points.forEach((c,f)=>{if(!Array.isArray(c)||c.length!==2)throw new Error(`${o}.points[${f}]: expected [x, y].`);c.forEach((g,u)=>s(g,`${o}.points[${f}][${u}]`))})})}function ug(e,t){let n=`lottie "${e}"`;ce(t,n);let s=JSON.stringify(t).length;if(s>xc)throw new Error(`${n}: ${Math.round(s/1e3)} KB; an animation can have at most ${xc/1e3} KB.`);for(let i of["fr","ip","op","w","h"])Q(t[i],`${n}.${i}`,0,1e5);if(typeof t.v!="string"||!Array.isArray(t.layers))throw new Error(`${n}: not a Lottie animation (it needs v and layers).`);let r=(i,o)=>{if(Array.isArray(i))return i.forEach((a,c)=>r(a,`${o}[${c}]`));if(!(!i||typeof i!="object"))for(let[a,c]of Object.entries(i)){if(a==="x"&&typeof c=="string")throw new Error(`${n}: the animation has an expression (code inside it, at ${o}); only animations without expressions play.`);r(c,`${o}.${a}`)}};r(t.layers,"layers");for(let i of Array.isArray(t.assets)?t.assets:[]){let o=i?.p;if(typeof o=="string"&&o&&!o.startsWith("data:")&&!Array.isArray(i.layers))throw new Error(`${n}: an image from outside the animation ("${o.slice(0,40)}"); only images inside it (data:) are kept.`)}return s}function dg(e){ce(e,"The recipe");let t=e;Q(t.width,"width",100,4e3),Q(t.height,"height",100,4e3);for(let r of["id","title","category"])Ce(t[r],r);if(t.locale!==void 0&&!(typeof t.locale=="string"&&/^[a-zA-Z]{2,3}(-[a-zA-Z0-9]{2,8})*$/.test(t.locale)&&Intl.NumberFormat.supportedLocalesOf([t.locale]).length>0))throw new Error('locale: expected a language tag such as "en-US" or "pt-BR".');if(we(t.background,["dots","grid","plain"],"background"),we(t.kind,lg,"kind"),Ce(t.source,"source"),t.quiz!==void 0&&t.kind!==void 0&&t.kind!=="lesson")throw new Error(`quiz: only a lesson has a quiz (this drawing is a ${t.kind}).`);if(we(t.theme,["paper","chalkboard"],"theme"),t.quiz!==void 0){if(ce(t.quiz,"quiz"),oe(t.quiz.question,"quiz.question"),!Array.isArray(t.quiz.options)||t.quiz.options.length<2||t.quiz.options.length>4)throw new Error("quiz.options: expected 2 to 4 options.");if(t.quiz.options.forEach((r,i)=>{if(ce(r,`quiz.options[${i}]`),oe(r.text,`quiz.options[${i}].text`),oe(r.why,`quiz.options[${i}].why`),typeof r.right!="boolean")throw new Error(`quiz.options[${i}].right: expected true or false.`)}),t.quiz.options.filter(r=>r.right===!0).length!==1)throw new Error("quiz.options: exactly one option is right.")}if(t.learning!==void 0){ce(t.learning,"learning");for(let r of["goal","question","answer","caveat"])oe(t.learning[r],`learning.${r}`)}if(t.params!==void 0){ce(t.params,"params");for(let[r,i]of Object.entries(t.params))if(Rs(r),ce(i,`params.${r}`),oe(i.label,`params.${r}.label`),Q(i.min,`${r}.min`),Q(i.max,`${r}.max`),Q(i.step,`${r}.step`,1e-6),Q(i.value,`${r}.value`,i.min,i.max),i.max<=i.min)throw new Error(`${r}: max must be greater than min.`)}if(t.vars!==void 0){ce(t.vars,"vars");for(let[r,i]of Object.entries(t.vars))Rs(r),be(i,`vars.${r}`)}if(t.switches!==void 0){ce(t.switches,"switches");let r=Object.entries(t.switches);if(r.length>8)throw new Error("switches: at most 8.");for(let[i,o]of r){if(Rs(i),Object.hasOwn(t.params??{},i)||Object.hasOwn(t.vars??{},i))throw new Error(`switches.${i}: the name is already a param or a var.`);if(ce(o,`switches.${i}`),oe(o.label,`switches.${i}.label`),typeof o.on!="boolean")throw new Error(`switches.${i}.on: expected true or false.`)}}if(!Array.isArray(t.steps)||t.steps.length===0||t.steps.length>250)throw new Error("A recipe needs 1 to 250 steps.");let n=new Set;if(t.defs!==void 0){ce(t.defs,"defs");let r=Object.entries(t.defs);if(r.length>Nc)throw new Error(`defs: at most ${Nc} figures.`);for(let[i,o]of r)fg(i,o),n.add(i)}if(t.lotties!==void 0){ce(t.lotties,"lotties");let r=Object.entries(t.lotties);if(r.length>Ec)throw new Error(`lotties: at most ${Ec} animations.`);let i=r.reduce((o,[a,c])=>o+ug(a,c),0);if(i>Tc)throw new Error(`lotties: ${Math.round(i/1e3)} KB in all; at most ${Tc/1e3} KB.`)}if(t.credits!==void 0){if(!Array.isArray(t.credits)||t.credits.length>5)throw new Error("credits: at most 5 lines.");t.credits.forEach((r,i)=>oe(r,`credits[${i}]`))}let s={exact:new Set,repeated:new Set,count:0,figures:n};return t.steps.forEach((r,i)=>wn(r,`Step ${i+1}`,s,null)),{...t,id:t.id??"pasted",title:t.title??"",background:t.background??"dots"}}export{$i as DEFAULT_PROFILE,Di as agentsIn,Dm as applyChanges,mm as compare,Hm as declaredFrom,sg as evalsFrom,Ph as extractAgent,eg as firedFrom,jm as fromSheets,Ei as groupLooks,ot as groupPatterns,qh as knownKinds,ne as labelOf,Wm as lessonOf,Xm as mergeDeclared,Ci as playbillOf,Zh as problemText,Jh as readCast,zm as readCsv,Bh as readProfile,ym as reviewCast,Ym as stageOf,dg as validateScene,rg as withEvals,Pm as workbookFile,Fm as workbookOf,Qh as writeCast};
|