house-lights 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/skills/cast-list/assets/map.html +53 -32
- package/skills/cast-list/examples/agents/bodega-cupons/workflows/AbrirChamadoERP-7d1c2a4e/metadata.yml +3 -0
- package/skills/cast-list/examples/agents/bodega-cupons/workflows/AbrirChamadoERP-7d1c2a4e/workflow.json +41 -0
- package/skills/cast-list/examples/agents/bodega-devolucoes/workflows/AbrirChamadoERP-7d1c2a4e/metadata.yml +3 -0
- package/skills/cast-list/examples/agents/bodega-devolucoes/workflows/AbrirChamadoERP-7d1c2a4e/workflow.json +56 -0
- package/skills/cast-list/examples/agents/bodega-frete/variables/PreferenciaAntiga.mcs.yml +9 -0
- package/skills/cast-list/examples/agents/bodega-loja-fisica/topics/AvisoAntigo.topic.mcs.yml +12 -0
- package/skills/cast-list/examples/agents/bodega-loja-fisica/workflows/ListarLojas-3f2a9c1d/metadata.yml +3 -0
- package/skills/cast-list/examples/agents/bodega-loja-fisica/workflows/ListarLojas-3f2a9c1d/workflow.json +56 -0
- package/skills/cast-list/examples/agents/bodega-orquestrador/actions/AgenteCupons.mcs.yml +1 -1
- package/skills/cast-list/examples/agents/bodega-orquestrador/actions/AgenteFidelidade.mcs.yml +24 -0
- package/skills/cast-list/examples/agents/bodega-orquestrador/actions/AgenteFrete.mcs.yml +2 -14
- package/skills/cast-list/examples/agents/bodega-pedidos/topics/Escalate.topic.mcs.yml +5 -0
- package/skills/cast-list/examples/agents/bodega-pedidos/workflows/AbrirChamadoERP-7d1c2a4e/metadata.yml +3 -0
- package/skills/cast-list/examples/agents/bodega-pedidos/workflows/AbrirChamadoERP-7d1c2a4e/workflow.json +56 -0
- package/skills/cast-list/references/format.md +20 -0
- package/skills/cast-list/references/keys.md +14 -0
- package/skills/cast-list/scripts/engine.mjs +111 -110
|
@@ -1,158 +1,159 @@
|
|
|
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 Xl=Object.create;var ar=Object.defineProperty;var Ql=Object.getOwnPropertyDescriptor;var Zl=Object.getOwnPropertyNames;var ec=Object.getPrototypeOf,tc=Object.prototype.hasOwnProperty;var Ht=(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 C=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var nc=(e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Zl(t))!tc.call(e,i)&&i!==n&&ar(e,i,{get:()=>t[i],enumerable:!(s=Ql(t,i))||s.enumerable});return e};var ds=(e,t,n)=>(n=e!=null?Xl(ec(e)):{},nc(t||!e||!e.__esModule?ar(n,"default",{value:e,enumerable:!0}):n,e));var K=C(Q=>{"use strict";var ms=Symbol.for("yaml.alias"),dr=Symbol.for("yaml.document"),Qt=Symbol.for("yaml.map"),pr=Symbol.for("yaml.pair"),gs=Symbol.for("yaml.scalar"),Zt=Symbol.for("yaml.seq"),be=Symbol.for("yaml.node.type"),dc=e=>!!e&&typeof e=="object"&&e[be]===ms,pc=e=>!!e&&typeof e=="object"&&e[be]===dr,hc=e=>!!e&&typeof e=="object"&&e[be]===Qt,mc=e=>!!e&&typeof e=="object"&&e[be]===pr,hr=e=>!!e&&typeof e=="object"&&e[be]===gs,gc=e=>!!e&&typeof e=="object"&&e[be]===Zt;function mr(e){if(e&&typeof e=="object")switch(e[be]){case Qt:case Zt:return!0}return!1}function yc(e){if(e&&typeof e=="object")switch(e[be]){case ms:case Qt:case gs:case Zt:return!0}return!1}var bc=e=>(hr(e)||mr(e))&&!!e.anchor;Q.ALIAS=ms;Q.DOC=dr;Q.MAP=Qt;Q.NODE_TYPE=be;Q.PAIR=pr;Q.SCALAR=gs;Q.SEQ=Zt;Q.hasAnchor=bc;Q.isAlias=dc;Q.isCollection=mr;Q.isDocument=pc;Q.isMap=hc;Q.isNode=yc;Q.isPair=mc;Q.isScalar=hr;Q.isSeq=gc});var lt=C(ys=>{"use strict";var H=K(),re=Symbol("break visit"),gr=Symbol("skip children"),he=Symbol("remove node");function en(e,t){let n=yr(t);H.isDocument(e)?Ke(null,e.contents,n,Object.freeze([e]))===he&&(e.contents=null):Ke(null,e,n,Object.freeze([]))}en.BREAK=re;en.SKIP=gr;en.REMOVE=he;function Ke(e,t,n,s){let i=br(e,t,n,s);if(H.isNode(i)||H.isPair(i))return wr(e,s,i),Ke(e,i,n,s);if(typeof i!="symbol"){if(H.isCollection(t)){s=Object.freeze(s.concat(t));for(let r=0;r<t.items.length;++r){let o=Ke(r,t.items[r],n,s);if(typeof o=="number")r=o-1;else{if(o===re)return re;o===he&&(t.items.splice(r,1),r-=1)}}}else if(H.isPair(t)){s=Object.freeze(s.concat(t));let r=Ke("key",t.key,n,s);if(r===re)return re;r===he&&(t.key=null);let o=Ke("value",t.value,n,s);if(o===re)return re;o===he&&(t.value=null)}}return i}async function tn(e,t){let n=yr(t);H.isDocument(e)?await Ue(null,e.contents,n,Object.freeze([e]))===he&&(e.contents=null):await Ue(null,e,n,Object.freeze([]))}tn.BREAK=re;tn.SKIP=gr;tn.REMOVE=he;async function Ue(e,t,n,s){let i=await br(e,t,n,s);if(H.isNode(i)||H.isPair(i))return wr(e,s,i),Ue(e,i,n,s);if(typeof i!="symbol"){if(H.isCollection(t)){s=Object.freeze(s.concat(t));for(let r=0;r<t.items.length;++r){let o=await Ue(r,t.items[r],n,s);if(typeof o=="number")r=o-1;else{if(o===re)return re;o===he&&(t.items.splice(r,1),r-=1)}}}else if(H.isPair(t)){s=Object.freeze(s.concat(t));let r=await Ue("key",t.key,n,s);if(r===re)return re;r===he&&(t.key=null);let o=await Ue("value",t.value,n,s);if(o===re)return re;o===he&&(t.value=null)}}return i}function yr(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 br(e,t,n,s){if(typeof n=="function")return n(e,t,s);if(H.isMap(t))return n.Map?.(e,t,s);if(H.isSeq(t))return n.Seq?.(e,t,s);if(H.isPair(t))return n.Pair?.(e,t,s);if(H.isScalar(t))return n.Scalar?.(e,t,s);if(H.isAlias(t))return n.Alias?.(e,t,s)}function wr(e,t,n){let s=t[t.length-1];if(H.isCollection(s))s.items[e]=n;else if(H.isPair(s))e==="key"?s.key=n:s.value=n;else if(H.isDocument(s))s.contents=n;else{let i=H.isAlias(s)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}ys.visit=en;ys.visitAsync=tn});var bs=C($r=>{"use strict";var kr=K(),wc=lt(),kc={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},$c=e=>e.replace(/[!,[\]{}]/g,t=>kc[t]),ct=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]+/),i=s.shift();switch(i){case"%TAG":{if(s.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),s.length<2))return!1;let[r,o]=s;return this.tags[r]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,s.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;let[r]=s;if(r==="1.1"||r==="1.2")return this.yaml.version=r,!0;{let o=/^\d+\.\d+$/.test(r);return n(6,`Unsupported YAML version ${r}`,o),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(t,n){if(t==="!")return"!";if(t[0]!=="!")return n(`Not a valid tag: ${t}`),null;if(t[1]==="<"){let o=t.slice(2,-1);return o==="!"||o==="!!"?(n(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&n("Verbatim tags must end with a >"),o)}let[,s,i]=t.match(/^(.*!)([^!]*)$/s);i||n(`The ${t} tag has no suffix`);let r=this.tags[s];if(r)try{return r+decodeURIComponent(i)}catch(o){return n(String(o)),null}return s==="!"?t:(n(`Could not resolve tag: ${t}`),null)}tagString(t){for(let[n,s]of Object.entries(this.tags))if(t.startsWith(s))return n+$c(t.substring(s.length));return t[0]==="!"?t:`!<${t}>`}toString(t){let n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],s=Object.entries(this.tags),i;if(t&&s.length>0&&kr.isNode(t.contents)){let r={};wc.visit(t.contents,(o,a)=>{kr.isNode(a)&&a.tag&&(r[a.tag]=!0)}),i=Object.keys(r)}else i=[];for(let[r,o]of s)r==="!!"&&o==="tag:yaml.org,2002:"||(!t||i.some(a=>a.startsWith(o)))&&n.push(`%TAG ${r} ${o}`);return n.join(`
|
|
4
|
+
`)}};ct.defaultYaml={explicit:!1,version:"1.2"};ct.defaultTags={"!!":"tag:yaml.org,2002:"};$r.Directives=ct});var nn=C(ft=>{"use strict";var Sr=K(),Sc=lt();function vc(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 vr(e){let t=new Set;return Sc.visit(e,{Value(n,s){s.anchor&&t.add(s.anchor)}}),t}function Or(e,t){for(let n=1;;++n){let s=`${e}${n}`;if(!t.has(s))return s}}function Oc(e,t){let n=[],s=new Map,i=null;return{onAnchor:r=>{n.push(r),i??(i=vr(e));let o=Or(t,i);return i.add(o),o},setAnchors:()=>{for(let r of n){let o=s.get(r);if(typeof o=="object"&&o.anchor&&(Sr.isScalar(o.node)||Sr.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=r,a}}},sourceObjects:s}}ft.anchorIsValid=vc;ft.anchorNames=vr;ft.createNodeAnchors=Oc;ft.findNewAnchor=Or});var ws=C(Ar=>{"use strict";function ut(e,t,n,s){if(s&&typeof s=="object")if(Array.isArray(s))for(let i=0,r=s.length;i<r;++i){let o=s[i],a=ut(e,s,String(i),o);a===void 0?delete s[i]:a!==o&&(s[i]=a)}else if(s instanceof Map)for(let i of Array.from(s.keys())){let r=s.get(i),o=ut(e,s,i,r);o===void 0?s.delete(i):o!==r&&s.set(i,o)}else if(s instanceof Set)for(let i of Array.from(s)){let r=ut(e,s,i,i);r===void 0?s.delete(i):r!==i&&(s.delete(i),s.add(r))}else for(let[i,r]of Object.entries(s)){let o=ut(e,s,i,r);o===void 0?delete s[i]:o!==r&&(s[i]=o)}return e.call(t,n,s)}Ar.applyReviver=ut});var ve=C(Er=>{"use strict";var Ac=K();function Nr(e,t,n){if(Array.isArray(e))return e.map((s,i)=>Nr(s,String(i),n));if(e&&typeof e.toJSON=="function"){if(!n||!Ac.hasAnchor(e))return e.toJSON(t,n);let s={aliasCount:0,count:1,res:void 0};n.anchors.set(e,s),n.onCreate=r=>{s.res=r,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e=="bigint"&&!n?.keep?Number(e):e}Er.toJS=Nr});var sn=C(Cr=>{"use strict";var Nc=ws(),xr=K(),Ec=ve(),ks=class{constructor(t){Object.defineProperty(this,xr.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:i,reviver:r}={}){if(!xr.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=Ec.toJS(this,"",o);if(typeof i=="function")for(let{count:l,res:f}of o.anchors.values())i(f,l);return typeof r=="function"?Nc.applyReviver(r,{"":a},"",a):a}};Cr.NodeBase=ks});var dt=C(Tr=>{"use strict";var xc=nn(),Cc=lt(),Ye=K(),Tc=sn(),qc=ve(),$s=class extends Tc.NodeBase{constructor(t){super(Ye.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=[],Cc.visit(t,{Node:(r,o)=>{(Ye.isAlias(o)||Ye.hasAnchor(o))&&s.push(o)}}),n&&(n.aliasResolveCache=s));let i;for(let r of s){if(r===this)break;r.anchor===this.source&&(i=r)}if(i&&n){let{anchors:r,doc:o,maxAliasCount:a}=n,l=r.get(i);if(l||(qc.toJS(i,null,n),l=r.get(i)),l?.res===void 0){let f="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(f)}if(a>=0&&(l.count+=1,l.aliasCount===0&&(l.aliasCount=rn(o,i,r)),l.count*l.aliasCount>a)){let f="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(f)}}return i}toJSON(t,n){if(!n)return{source:this.source};let s=this.resolve(n.doc,n);if(!s){let i=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(i)}return n.anchors.get(s).res}toString(t,n,s){let i=`*${this.source}`;if(t){if(xc.anchorIsValid(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){let r=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(r)}if(t.implicitKey)return`${i} `}return i}};function rn(e,t,n){if(Ye.isAlias(t)){let s=t.resolve(e),i=n&&s&&n.get(s);return i?i.count*i.aliasCount:0}else if(Ye.isCollection(t)){let s=0;for(let i of t.items){let r=rn(e,i,n);r>s&&(s=r)}return s}else if(Ye.isPair(t)){let s=rn(e,t.key,n),i=rn(e,t.value,n);return Math.max(s,i)}return 1}Tr.Alias=$s});var G=C(Ss=>{"use strict";var Mc=K(),Pc=sn(),Lc=ve(),Ic=e=>!e||typeof e!="function"&&typeof e!="object",Oe=class extends Pc.NodeBase{constructor(t){super(Mc.SCALAR),this.value=t}toJSON(t,n){return n?.keep?this.value:Lc.toJS(this.value,t,n)}toString(){return String(this.value)}};Oe.BLOCK_FOLDED="BLOCK_FOLDED";Oe.BLOCK_LITERAL="BLOCK_LITERAL";Oe.PLAIN="PLAIN";Oe.QUOTE_DOUBLE="QUOTE_DOUBLE";Oe.QUOTE_SINGLE="QUOTE_SINGLE";Ss.Scalar=Oe;Ss.isScalarValue=Ic});var pt=C(Mr=>{"use strict";var Rc=dt(),Le=K(),qr=G(),Fc="tag:yaml.org,2002:";function Dc(e,t,n){if(t){let s=n.filter(r=>r.tag===t),i=s.find(r=>!r.format)??s[0];if(!i)throw new Error(`Tag ${t} not found`);return i}return n.find(s=>s.identify?.(e)&&!s.format)}function jc(e,t,n){if(Le.isDocument(e)&&(e=e.contents),Le.isNode(e))return e;if(Le.isPair(e)){let d=n.schema[Le.MAP].createNode?.(n.schema,null,n);return d.items.push(e),d}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:s,onAnchor:i,onTagObj:r,schema:o,sourceObjects:a}=n,l;if(s&&e&&typeof e=="object"){if(l=a.get(e),l)return l.anchor??(l.anchor=i(e)),new Rc.Alias(l.anchor);l={anchor:null,node:null},a.set(e,l)}t?.startsWith("!!")&&(t=Fc+t.slice(2));let f=Dc(e,t,o.tags);if(!f){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){let d=new qr.Scalar(e);return l&&(l.node=d),d}f=e instanceof Map?o[Le.MAP]:Symbol.iterator in Object(e)?o[Le.SEQ]:o[Le.MAP]}r&&(r(f),delete n.onTagObj);let c=f?.createNode?f.createNode(n.schema,e,n):typeof f?.nodeClass?.from=="function"?f.nodeClass.from(n.schema,e,n):new qr.Scalar(e);return t?c.tag=t:f.default||(c.tag=f.tag),l&&(l.node=c),c}Mr.createNode=jc});var an=C(on=>{"use strict";var _c=pt(),me=K(),Bc=sn();function vs(e,t,n){let s=n;for(let i=t.length-1;i>=0;--i){let r=t[i];if(typeof r=="number"&&Number.isInteger(r)&&r>=0){let o=[];o[r]=s,s=o}else s=new Map([[r,s]])}return _c.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 Pr=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done,Os=class extends Bc.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=>me.isNode(s)||me.isPair(s)?s.clone(t):s),this.range&&(n.range=this.range.slice()),n}addIn(t,n){if(Pr(t))this.add(n);else{let[s,...i]=t,r=this.get(s,!0);if(me.isCollection(r))r.addIn(i,n);else if(r===void 0&&this.schema)this.set(s,vs(this.schema,i,n));else throw new Error(`Expected YAML collection at ${s}. Remaining path: ${i}`)}}deleteIn(t){let[n,...s]=t;if(s.length===0)return this.delete(n);let i=this.get(n,!0);if(me.isCollection(i))return i.deleteIn(s);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${s}`)}getIn(t,n){let[s,...i]=t,r=this.get(s,!0);return i.length===0?!n&&me.isScalar(r)?r.value:r:me.isCollection(r)?r.getIn(i,n):void 0}hasAllNullValues(t){return this.items.every(n=>{if(!me.isPair(n))return!1;let s=n.value;return s==null||t&&me.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 i=this.get(n,!0);return me.isCollection(i)?i.hasIn(s):!1}setIn(t,n){let[s,...i]=t;if(i.length===0)this.set(s,n);else{let r=this.get(s,!0);if(me.isCollection(r))r.setIn(i,n);else if(r===void 0&&this.schema)this.set(s,vs(this.schema,i,n));else throw new Error(`Expected YAML collection at ${s}. Remaining path: ${i}`)}}};on.Collection=Os;on.collectionFromPath=vs;on.isEmptyPath=Pr});var ht=C(ln=>{"use strict";var Kc=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function As(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var Uc=(e,t,n)=>e.endsWith(`
|
|
5
|
+
`)?As(n,t):n.includes(`
|
|
6
6
|
`)?`
|
|
7
|
-
`+
|
|
8
|
-
`)n===
|
|
9
|
-
`&&
|
|
10
|
-
`&&
|
|
11
|
-
${t}${e.slice(0
|
|
12
|
-
${t}${e.slice(
|
|
13
|
-
`);s=t,i=t+1,r=e[i]}return s}
|
|
14
|
-
`){if(r-o>s)return!0;if(o=r+1,i-o<=s)return!1}return!0}function
|
|
7
|
+
`+As(n,t):(e.endsWith(" ")?"":" ")+n;ln.indentComment=As;ln.lineComment=Uc;ln.stringifyComment=Kc});var Ir=C(mt=>{"use strict";var Yc="flow",Ns="block",cn="quoted";function zc(e,t,n="flow",{indentAtStart:s,lineWidth:i=80,minContentWidth:r=20,onFold:o,onOverflow:a}={}){if(!i||i<0)return e;i<r&&(r=0);let l=Math.max(1+r,1+i-t.length);if(e.length<=l)return e;let f=[],c={},d=i-t.length;typeof s=="number"&&(s>i-Math.max(2,r)?f.push(0):d=i-s);let u,h,b=!1,m=-1,y=-1,O=-1;n===Ns&&(m=Lr(e,m,t.length),m!==-1&&(d=m+l));for(let S;S=e[m+=1];){if(n===cn&&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}O=m}if(S===`
|
|
8
|
+
`)n===Ns&&(m=Lr(e,m,t.length)),d=m+t.length+l,u=void 0;else{if(S===" "&&h&&h!==" "&&h!==`
|
|
9
|
+
`&&h!==" "){let M=e[m+1];M&&M!==" "&&M!==`
|
|
10
|
+
`&&M!==" "&&(u=m)}if(m>=d)if(u)f.push(u),d=u+l,u=void 0;else if(n===cn){for(;h===" "||h===" ";)h=S,S=e[m+=1],b=!0;let M=m>O+1?m-2:y-1;if(c[M])return e;f.push(M),c[M]=!0,d=M+l,u=void 0}else b=!0}h=S}if(b&&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 M=f[S],$=f[S+1]||e.length;M===0?v=`
|
|
11
|
+
${t}${e.slice(0,$)}`:(n===cn&&c[M]&&(v+=`${e[M]}\\`),v+=`
|
|
12
|
+
${t}${e.slice(M+1,$)}`)}return v}function Lr(e,t,n){let s=t,i=t+1,r=e[i];for(;r===" "||r===" ";)if(t<i+n)r=e[++t];else{do r=e[++t];while(r&&r!==`
|
|
13
|
+
`);s=t,i=t+1,r=e[i]}return s}mt.FOLD_BLOCK=Ns;mt.FOLD_FLOW=Yc;mt.FOLD_QUOTED=cn;mt.foldFlowLines=zc});var yt=C(Rr=>{"use strict";var ue=G(),Ae=Ir(),un=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),dn=e=>/^(%|---|\.\.\.)/m.test(e);function Wc(e,t,n){if(!t||t<0)return!1;let s=t-n,i=e.length;if(i<=s)return!1;for(let r=0,o=0;r<i;++r)if(e[r]===`
|
|
14
|
+
`){if(r-o>s)return!0;if(o=r+1,i-o<=s)return!1}return!0}function gt(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:s}=t,i=t.options.doubleQuotedMinMultiLineLength,r=t.indent||(dn(e)?" ":""),o="",a=0;for(let l=0,f=n[l];f;f=n[++l])if(f===" "&&n[l+1]==="\\"&&n[l+2]==="n"&&(o+=n.slice(a,l)+"\\ ",l+=1,a=l,f="\\"),f==="\\")switch(n[l+1]){case"u":{o+=n.slice(a,l);let c=n.substr(l+2,4);switch(c){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:c.substr(0,2)==="00"?o+="\\x"+c.substr(2):o+=n.substr(l,6)}l+=5,a=l+1}break;case"n":if(s||n[l+2]==='"'||n.length<i)l+=1;else{for(o+=n.slice(a,l)+`
|
|
15
15
|
|
|
16
|
-
`;n[
|
|
17
|
-
`,
|
|
18
|
-
`)||/[ \t]\n|\n[ \t]/.test(e))return
|
|
19
|
-
${n}`)+"'";return t.implicitKey?s
|
|
16
|
+
`;n[l+2]==="\\"&&n[l+3]==="n"&&n[l+4]!=='"';)o+=`
|
|
17
|
+
`,l+=2;o+=r,n[l+2]===" "&&(o+="\\"),l+=1,a=l+1}break;default:l+=1}return o=a?o+n.slice(a):n,s?o:Ae.foldFlowLines(o,r,Ae.FOLD_QUOTED,un(t,!1))}function Es(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
|
|
18
|
+
`)||/[ \t]\n|\n[ \t]/.test(e))return gt(e,t);let n=t.indent||(dn(e)?" ":""),s="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
19
|
+
${n}`)+"'";return t.implicitKey?s:Ae.foldFlowLines(s,n,Ae.FOLD_FLOW,un(t,!1))}function ze(e,t){let{singleQuote:n}=t.options,s;if(n===!1)s=gt;else{let i=e.includes('"'),r=e.includes("'");i&&!r?s=Es:r&&!i?s=gt:s=n?Es:gt}return s(e,t)}var xs;try{xs=new RegExp(`(^|(?<!
|
|
20
20
|
))
|
|
21
21
|
+(?!
|
|
22
|
-
|$)`,"g")}catch{
|
|
22
|
+
|$)`,"g")}catch{xs=/\n+(?!\n|$)/g}function fn({comment:e,type:t,value:n},s,i,r){let{blockQuote:o,commentString:a,lineWidth:l}=s.options;if(!o||/\n[\t ]+$/.test(n))return ze(n,s);let f=s.indent||(s.forceBlockIndent||dn(n)?" ":""),c=o==="literal"?!0:o==="folded"||t===ue.Scalar.BLOCK_FOLDED?!1:t===ue.Scalar.BLOCK_LITERAL?!0:!Wc(n,l,f.length);if(!n)return c?`|
|
|
23
23
|
`:`>
|
|
24
|
-
`;let
|
|
25
|
-
|
|
26
|
-
`);
|
|
27
|
-
`&&(
|
|
28
|
-
`)
|
|
29
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${
|
|
30
|
-
${
|
|
31
|
-
${
|
|
32
|
-
`)||
|
|
33
|
-
`)?
|
|
34
|
-
`))return
|
|
35
|
-
${
|
|
36
|
-
${t.indent}${a}`:a}
|
|
37
|
-
${a}:`):(
|
|
38
|
-
`:"",
|
|
39
|
-
${
|
|
40
|
-
`&&
|
|
24
|
+
`;let d,u;for(u=n.length;u>0;--u){let $=n[u-1];if($!==`
|
|
25
|
+
`&&$!==" "&&$!==" ")break}let h=n.substring(u),b=h.indexOf(`
|
|
26
|
+
`);b===-1?d="-":n===h||b!==h.length-1?(d="+",r&&r()):d="",h&&(n=n.slice(0,-h.length),h[h.length-1]===`
|
|
27
|
+
`&&(h=h.slice(0,-1)),h=h.replace(xs,`$&${f}`));let m=!1,y,O=-1;for(y=0;y<n.length;++y){let $=n[y];if($===" ")m=!0;else if($===`
|
|
28
|
+
`)O=y;else break}let v=n.substring(0,O<y?O+1:y);v&&(n=n.substring(v.length),v=v.replace(/\n+/g,`$&${f}`));let M=(m?f?"2":"1":"")+d;if(e&&(M+=" "+a(e.replace(/ ?[\r\n]+/g," ")),i&&i()),!c){let $=n.replace(/\n+/g,`
|
|
29
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${f}`),N=!1,q=un(s,!0);o!=="folded"&&t!==ue.Scalar.BLOCK_FOLDED&&(q.onOverflow=()=>{N=!0});let g=Ae.foldFlowLines(`${v}${$}${h}`,f,Ae.FOLD_BLOCK,q);if(!N)return`>${M}
|
|
30
|
+
${f}${g}`}return n=n.replace(/\n+/g,`$&${f}`),`|${M}
|
|
31
|
+
${f}${v}${n}${h}`}function Vc(e,t,n,s){let{type:i,value:r}=e,{actualString:o,implicitKey:a,indent:l,indentStep:f,inFlow:c}=t;if(a&&r.includes(`
|
|
32
|
+
`)||c&&/[[\]{},]/.test(r))return ze(r,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))return a||c||!r.includes(`
|
|
33
|
+
`)?ze(r,t):fn(e,t,n,s);if(!a&&!c&&i!==ue.Scalar.PLAIN&&r.includes(`
|
|
34
|
+
`))return fn(e,t,n,s);if(dn(r)){if(l==="")return t.forceBlockIndent=!0,fn(e,t,n,s);if(a&&l===f)return ze(r,t)}let d=r.replace(/\n+/g,`$&
|
|
35
|
+
${l}`);if(o){let u=m=>m.default&&m.tag!=="tag:yaml.org,2002:str"&&m.test?.test(d),{compat:h,tags:b}=t.doc.schema;if(b.some(u)||h?.some(u))return ze(r,t)}return a?d:Ae.foldFlowLines(d,l,Ae.FOLD_FLOW,un(t,!1))}function Jc(e,t,n,s){let{implicitKey:i,inFlow:r}=t,o=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)}),{type:a}=e;a!==ue.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=ue.Scalar.QUOTE_DOUBLE);let l=c=>{switch(c){case ue.Scalar.BLOCK_FOLDED:case ue.Scalar.BLOCK_LITERAL:return i||r?ze(o.value,t):fn(o,t,n,s);case ue.Scalar.QUOTE_DOUBLE:return gt(o.value,t);case ue.Scalar.QUOTE_SINGLE:return Es(o.value,t);case ue.Scalar.PLAIN:return Vc(o,t,n,s);default:return null}},f=l(a);if(f===null){let{defaultKeyType:c,defaultStringType:d}=t.options,u=i&&c||d;if(f=l(u),f===null)throw new Error(`Unsupported default string type ${u}`)}return f}Rr.stringifyString=Jc});var bt=C(Cs=>{"use strict";var Gc=nn(),Ne=K(),Hc=ht(),Xc=yt();function Qc(e,t){let n=Object.assign({blockQuote:!0,commentString:Hc.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 Zc(e,t){if(t.tag){let i=e.filter(r=>r.tag===t.tag);if(i.length>0)return i.find(r=>r.format===t.format)??i[0]}let n,s;if(Ne.isScalar(t)){s=t.value;let i=e.filter(r=>r.identify?.(s));if(i.length>1){let r=i.filter(o=>o.test);r.length>0&&(i=r)}n=i.find(r=>r.format===t.format)??i.find(r=>!r.format)}else s=t,n=e.find(i=>i.nodeClass&&s instanceof i.nodeClass);if(!n){let i=s?.constructor?.name??(s===null?"null":typeof s);throw new Error(`Tag not resolved for ${i} value`)}return n}function ef(e,t,{anchors:n,doc:s}){if(!s.directives)return"";let i=[],r=(Ne.isScalar(e)||Ne.isCollection(e))&&e.anchor;r&&Gc.anchorIsValid(r)&&(n.add(r),i.push(`&${r}`));let o=e.tag??(t.default?null:t.tag);return o&&i.push(s.directives.tagString(o)),i.join(" ")}function tf(e,t,n,s){if(Ne.isPair(e))return e.toString(t,n,s);if(Ne.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 i,r=Ne.isNode(e)?e:t.doc.createNode(e,{onTagObj:l=>i=l});i??(i=Zc(t.doc.schema.tags,r));let o=ef(r,i,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);let a=typeof i.stringify=="function"?i.stringify(r,t,n,s):Ne.isScalar(r)?Xc.stringifyString(r,t,n,s):r.toString(t,n,s);return o?Ne.isScalar(r)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o}
|
|
36
|
+
${t.indent}${a}`:a}Cs.createStringifyContext=Qc;Cs.stringify=tf});var _r=C(jr=>{"use strict";var we=K(),Fr=G(),Dr=bt(),wt=ht();function nf({key:e,value:t},n,s,i){let{allNullValues:r,doc:o,indent:a,indentStep:l,options:{commentString:f,indentSeq:c,simpleKeys:d}}=n,u=we.isNode(e)&&e.comment||null;if(d){if(u)throw new Error("With simple keys, key nodes cannot have comments");if(we.isCollection(e)||!we.isNode(e)&&typeof e=="object"){let q="With simple keys, collection cannot be used as a key value";throw new Error(q)}}let h=!d&&(!e||u&&t==null&&!n.inFlow||we.isCollection(e)||(we.isScalar(e)?e.type===Fr.Scalar.BLOCK_FOLDED||e.type===Fr.Scalar.BLOCK_LITERAL:typeof e=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!h&&(d||!r),indent:a+l});let b=!1,m=!1,y=Dr.stringify(e,n,()=>b=!0,()=>m=!0);if(!h&&!n.inFlow&&y.length>1024){if(d)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");h=!0}if(n.inFlow){if(r||t==null)return b&&s&&s(),y===""?"?":h?`? ${y}`:y}else if(r&&!d||t==null&&h)return y=`? ${y}`,u&&!b?y+=wt.lineComment(y,n.indent,f(u)):m&&i&&i(),y;b&&(u=null),h?(u&&(y+=wt.lineComment(y,n.indent,f(u))),y=`? ${y}
|
|
37
|
+
${a}:`):(y=`${y}:`,u&&(y+=wt.lineComment(y,n.indent,f(u))));let O,v,S;we.isNode(t)?(O=!!t.spaceBefore,v=t.commentBefore,S=t.comment):(O=!1,v=null,S=null,t&&typeof t=="object"&&(t=o.createNode(t))),n.implicitKey=!1,!h&&!u&&we.isScalar(t)&&(n.indentAtStart=y.length+1),m=!1,!c&&l.length>=2&&!n.inFlow&&!h&&we.isSeq(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let M=!1,$=Dr.stringify(t,n,()=>M=!0,()=>m=!0),N=" ";if(u||O||v){if(N=O?`
|
|
38
|
+
`:"",v){let q=f(v);N+=`
|
|
39
|
+
${wt.indentComment(q,n.indent)}`}$===""&&!n.inFlow?N===`
|
|
40
|
+
`&&S&&(N=`
|
|
41
41
|
|
|
42
|
-
`):
|
|
43
|
-
${n.indent}`}else if(!
|
|
44
|
-
`),
|
|
45
|
-
${n.indent}`)}}else(
|
|
46
|
-
`)&&(
|
|
47
|
-
${
|
|
48
|
-
`}}return e?(
|
|
49
|
-
`+
|
|
50
|
-
`)),
|
|
51
|
-
${r}${i}${
|
|
52
|
-
`;return`${
|
|
53
|
-
${i}${
|
|
54
|
-
`:" ")}return
|
|
42
|
+
`):N+=`
|
|
43
|
+
${n.indent}`}else if(!h&&we.isCollection(t)){let q=$[0],g=$.indexOf(`
|
|
44
|
+
`),E=g!==-1,L=n.inFlow??t.flow??t.items.length===0;if(E||!L){let Y=!1;if(E&&(q==="&"||q==="!")){let F=$.indexOf(" ");q==="&"&&F!==-1&&F<g&&$[F+1]==="!"&&(F=$.indexOf(" ",F+1)),(F===-1||g<F)&&(Y=!0)}Y||(N=`
|
|
45
|
+
${n.indent}`)}}else($===""||$[0]===`
|
|
46
|
+
`)&&(N="");return y+=N+$,n.inFlow?M&&s&&s():S&&!M?y+=wt.lineComment(y,n.indent,f(S)):m&&i&&i(),y}jr.stringifyPair=nf});var qs=C(Ts=>{"use strict";var Br=Ht("process");function sf(e,...t){e==="debug"&&console.log(...t)}function rf(e,t){(e==="debug"||e==="warn")&&(typeof Br.emitWarning=="function"?Br.emitWarning(t):console.warn(t))}Ts.debug=sf;Ts.warn=rf});var yn=C(gn=>{"use strict";var mn=K(),Kr=G(),pn="<<",hn={identify:e=>e===pn||typeof e=="symbol"&&e.description===pn,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Kr.Scalar(Symbol(pn)),{addToJSMap:Ur}),stringify:()=>pn},of=(e,t)=>(hn.identify(t)||mn.isScalar(t)&&(!t.type||t.type===Kr.Scalar.PLAIN)&&hn.identify(t.value))&&e?.doc.schema.tags.some(n=>n.tag===hn.tag&&n.default);function Ur(e,t,n){let s=Yr(e,n);if(mn.isSeq(s))for(let i of s.items)Ms(e,t,i);else if(Array.isArray(s))for(let i of s)Ms(e,t,i);else Ms(e,t,s)}function Ms(e,t,n){let s=Yr(e,n);if(!mn.isMap(s))throw new Error("Merge sources must be maps or map aliases");let i=s.toJSON(null,e,Map);for(let[r,o]of i)t instanceof Map?t.has(r)||t.set(r,o):t instanceof Set?t.add(r):Object.prototype.hasOwnProperty.call(t,r)||Object.defineProperty(t,r,{value:o,writable:!0,enumerable:!0,configurable:!0});return t}function Yr(e,t){return e&&mn.isAlias(t)?t.resolve(e.doc,e):t}gn.addMergeToJSMap=Ur;gn.isMergeKey=of;gn.merge=hn});var Ls=C(Vr=>{"use strict";var af=qs(),zr=yn(),lf=bt(),Wr=K(),Ps=ve();function cf(e,t,{key:n,value:s}){if(Wr.isNode(n)&&n.addToJSMap)n.addToJSMap(e,t,s);else if(zr.isMergeKey(e,n))zr.addMergeToJSMap(e,t,s);else{let i=Ps.toJS(n,"",e);if(t instanceof Map)t.set(i,Ps.toJS(s,i,e));else if(t instanceof Set)t.add(i);else{let r=ff(n,i,e),o=Ps.toJS(s,r,e);r in t?Object.defineProperty(t,r,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[r]=o}}return t}function ff(e,t,n){if(t===null)return"";if(typeof t!="object")return String(t);if(Wr.isNode(e)&&n?.doc){let s=lf.createStringifyContext(n.doc,{});s.anchors=new Set;for(let r of n.anchors.keys())s.anchors.add(r.anchor);s.inFlow=!0,s.inStringifyKey=!0;let i=e.toString(s);if(!n.mapKeyWarned){let r=JSON.stringify(i);r.length>40&&(r=r.substring(0,36)+'..."'),af.warn(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${r}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return i}return JSON.stringify(t)}Vr.addPairToJSMap=cf});var Ee=C(Is=>{"use strict";var Jr=pt(),uf=_r(),df=Ls(),bn=K();function pf(e,t,n){let s=Jr.createNode(e,void 0,n),i=Jr.createNode(t,void 0,n);return new wn(s,i)}var wn=class e{constructor(t,n=null){Object.defineProperty(this,bn.NODE_TYPE,{value:bn.PAIR}),this.key=t,this.value=n}clone(t){let{key:n,value:s}=this;return bn.isNode(n)&&(n=n.clone(t)),bn.isNode(s)&&(s=s.clone(t)),new e(n,s)}toJSON(t,n){let s=n?.mapAsMap?new Map:{};return df.addPairToJSMap(n,s,this)}toString(t,n,s){return t?.doc?uf.stringifyPair(this,t,n,s):JSON.stringify(this)}};Is.Pair=wn;Is.createPair=pf});var Rs=C(Hr=>{"use strict";var Ie=K(),Gr=bt(),kn=ht();function hf(e,t,n){return(t.inFlow??e.flow?gf:mf)(e,t,n)}function mf({comment:e,items:t},n,{blockItemPrefix:s,flowChars:i,itemIndent:r,onChompKeep:o,onComment:a}){let{indent:l,options:{commentString:f}}=n,c=Object.assign({},n,{indent:r,type:null}),d=!1,u=[];for(let b=0;b<t.length;++b){let m=t[b],y=null;if(Ie.isNode(m))!d&&m.spaceBefore&&u.push(""),$n(n,u,m.commentBefore,d),m.comment&&(y=m.comment);else if(Ie.isPair(m)){let v=Ie.isNode(m.key)?m.key:null;v&&(!d&&v.spaceBefore&&u.push(""),$n(n,u,v.commentBefore,d))}d=!1;let O=Gr.stringify(m,c,()=>y=null,()=>d=!0);y&&(O+=kn.lineComment(O,r,f(y))),d&&y&&(d=!1),u.push(s+O)}let h;if(u.length===0)h=i.start+i.end;else{h=u[0];for(let b=1;b<u.length;++b){let m=u[b];h+=m?`
|
|
47
|
+
${l}${m}`:`
|
|
48
|
+
`}}return e?(h+=`
|
|
49
|
+
`+kn.indentComment(f(e),l),a&&a()):d&&o&&o(),h}function gf({items:e},t,{flowChars:n,itemIndent:s}){let{indent:i,indentStep:r,flowCollectionPadding:o,options:{commentString:a}}=t;s+=r;let l=Object.assign({},t,{indent:s,inFlow:!0,type:null}),f=!1,c=0,d=[];for(let b=0;b<e.length;++b){let m=e[b],y=null;if(Ie.isNode(m))m.spaceBefore&&d.push(""),$n(t,d,m.commentBefore,!1),m.comment&&(y=m.comment);else if(Ie.isPair(m)){let v=Ie.isNode(m.key)?m.key:null;v&&(v.spaceBefore&&d.push(""),$n(t,d,v.commentBefore,!1),v.comment&&(f=!0));let S=Ie.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 O=Gr.stringify(m,l,()=>y=null);f||(f=d.length>c||O.includes(`
|
|
50
|
+
`)),b<e.length-1?O+=",":t.options.trailingComma&&(t.options.lineWidth>0&&(f||(f=d.reduce((v,S)=>v+S.length+2,2)+(O.length+2)>t.options.lineWidth)),f&&(O+=",")),y&&(O+=kn.lineComment(O,s,a(y))),d.push(O),c=d.length}let{start:u,end:h}=n;if(d.length===0)return u+h;if(!f){let b=d.reduce((m,y)=>m+y.length+2,2);f=t.options.lineWidth>0&&b>t.options.lineWidth}if(f){let b=u;for(let m of d)b+=m?`
|
|
51
|
+
${r}${i}${m}`:`
|
|
52
|
+
`;return`${b}
|
|
53
|
+
${i}${h}`}else return`${u}${o}${d.join(" ")}${o}${h}`}function $n({indent:e,options:{commentString:t}},n,s,i){if(s&&i&&(s=s.replace(/^\n+/,"")),s){let r=kn.indentComment(t(s),e);n.push(r.trimStart())}}Hr.stringifyCollection=hf});var Ce=C(Ds=>{"use strict";var yf=Rs(),bf=Ls(),wf=an(),xe=K(),Sn=Ee(),kf=G();function kt(e,t){let n=xe.isScalar(t)?t.value:t;for(let s of e)if(xe.isPair(s)&&(s.key===t||s.key===n||xe.isScalar(s.key)&&s.key.value===n))return s}var Fs=class extends wf.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(xe.MAP,t),this.items=[]}static from(t,n,s){let{keepUndefined:i,replacer:r}=s,o=new this(t),a=(l,f)=>{if(typeof r=="function")f=r.call(n,l,f);else if(Array.isArray(r)&&!r.includes(l))return;(f!==void 0||i)&&o.items.push(Sn.createPair(l,f,s))};if(n instanceof Map)for(let[l,f]of n)a(l,f);else if(n&&typeof n=="object")for(let l of Object.keys(n))a(l,n[l]);return typeof t.sortMapEntries=="function"&&o.items.sort(t.sortMapEntries),o}add(t,n){let s;xe.isPair(t)?s=t:!t||typeof t!="object"||!("key"in t)?s=new Sn.Pair(t,t?.value):s=new Sn.Pair(t.key,t.value);let i=kt(this.items,s.key),r=this.schema?.sortMapEntries;if(i){if(!n)throw new Error(`Key ${s.key} already set`);xe.isScalar(i.value)&&kf.isScalarValue(s.value)?i.value.value=s.value:i.value=s.value}else if(r){let o=this.items.findIndex(a=>r(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 i=kt(this.items,t)?.value;return(!n&&xe.isScalar(i)?i.value:i)??void 0}has(t){return!!kt(this.items,t)}set(t,n){this.add(new Sn.Pair(t,n),!0)}toJSON(t,n,s){let i=s?new s:n?.mapAsMap?new Map:{};n?.onCreate&&n.onCreate(i);for(let r of this.items)bf.addPairToJSMap(n,i,r);return i}toString(t,n,s){if(!t)return JSON.stringify(this);for(let i of this.items)if(!xe.isPair(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),yf.stringifyCollection(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:s,onComment:n})}};Ds.YAMLMap=Fs;Ds.findPair=kt});var We=C(Qr=>{"use strict";var $f=K(),Xr=Ce(),Sf={collection:"map",default:!0,nodeClass:Xr.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(e,t){return $f.isMap(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,n)=>Xr.YAMLMap.from(e,t,n)};Qr.map=Sf});var Te=C(Zr=>{"use strict";var vf=pt(),Of=Rs(),Af=an(),On=K(),Nf=G(),Ef=ve(),js=class extends Af.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(On.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 i=this.items[s];return!n&&On.isScalar(i)?i.value:i}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 i=this.items[s];On.isScalar(i)&&Nf.isScalarValue(n)?i.value=n:this.items[s]=n}toJSON(t,n){let s=[];n?.onCreate&&n.onCreate(s);let i=0;for(let r of this.items)s.push(Ef.toJS(r,String(i++),n));return s}toString(t,n,s){return t?Of.stringifyCollection(this,t,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(t.indent||"")+" ",onChompKeep:s,onComment:n}):JSON.stringify(this)}static from(t,n,s){let{replacer:i}=s,r=new this(t);if(n&&Symbol.iterator in Object(n)){let o=0;for(let a of n){if(typeof i=="function"){let l=n instanceof Set?a:String(o++);a=i.call(n,l,a)}r.items.push(vf.createNode(a,void 0,s))}}return r}};function vn(e){let t=On.isScalar(e)?e.value:e;return t&&typeof t=="string"&&(t=Number(t)),typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}Zr.YAMLSeq=js});var Ve=C(to=>{"use strict";var xf=K(),eo=Te(),Cf={collection:"seq",default:!0,nodeClass:eo.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(e,t){return xf.isSeq(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,n)=>eo.YAMLSeq.from(e,t,n)};to.seq=Cf});var $t=C(no=>{"use strict";var Tf=yt(),qf={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),Tf.stringifyString(e,t,n,s)}};no.string=qf});var An=C(ro=>{"use strict";var so=G(),io={identify:e=>e==null,createNode:()=>new so.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new so.Scalar(null),stringify:({source:e},t)=>typeof e=="string"&&io.test.test(e)?e:t.options.nullStr};ro.nullTag=io});var _s=C(ao=>{"use strict";var Mf=G(),oo={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new Mf.Scalar(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},n){if(e&&oo.test.test(e)){let s=e[0]==="t"||e[0]==="T";if(t===s)return e}return t?n.options.trueStr:n.options.falseStr}};ao.boolTag=oo});var Je=C(lo=>{"use strict";function Pf({format:e,minFractionDigits:t,tag:n,value:s}){if(typeof s=="bigint")return String(s);let i=typeof s=="number"?s:Number(s);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let r=Object.is(s,-0)?"-0":JSON.stringify(s);if(!e&&t&&(!n||n==="tag:yaml.org,2002:float")&&/^-?\d/.test(r)&&!r.includes("e")){let o=r.indexOf(".");o<0&&(o=r.length,r+=".");let a=t-(r.length-o-1);for(;a-- >0;)r+="0"}return r}lo.stringifyNumber=Pf});var Ks=C(Nn=>{"use strict";var Lf=G(),Bs=Je(),If={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:Bs.stringifyNumber},Rf={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():Bs.stringifyNumber(e)}},Ff={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 Lf.Scalar(parseFloat(e)),n=e.indexOf(".");return n!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-n-1),t},stringify:Bs.stringifyNumber};Nn.float=Ff;Nn.floatExp=Rf;Nn.floatNaN=If});var Ys=C(xn=>{"use strict";var co=Je(),En=e=>typeof e=="bigint"||Number.isInteger(e),Us=(e,t,n,{intAsBigInt:s})=>s?BigInt(e):parseInt(e.substring(t),n);function fo(e,t,n){let{value:s}=e;return En(s)&&s>=0?n+s.toString(t):co.stringifyNumber(e)}var Df={identify:e=>En(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,n)=>Us(e,2,8,n),stringify:e=>fo(e,8,"0o")},jf={identify:En,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>Us(e,0,10,n),stringify:co.stringifyNumber},_f={identify:e=>En(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>Us(e,2,16,n),stringify:e=>fo(e,16,"0x")};xn.int=jf;xn.intHex=_f;xn.intOct=Df});var po=C(uo=>{"use strict";var Bf=We(),Kf=An(),Uf=Ve(),Yf=$t(),zf=_s(),zs=Ks(),Ws=Ys(),Wf=[Bf.map,Uf.seq,Yf.string,Kf.nullTag,zf.boolTag,Ws.intOct,Ws.int,Ws.intHex,zs.floatNaN,zs.floatExp,zs.float];uo.schema=Wf});var go=C(mo=>{"use strict";var Vf=G(),Jf=We(),Gf=Ve();function ho(e){return typeof e=="bigint"||Number.isInteger(e)}var Cn=({value:e})=>JSON.stringify(e),Hf=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:Cn},{identify:e=>e==null,createNode:()=>new Vf.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Cn},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:Cn},{identify:ho,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})=>ho(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:Cn}],Xf={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},Qf=[Jf.map,Gf.seq].concat(Hf,Xf);mo.schema=Qf});var Js=C(yo=>{"use strict";var St=Ht("buffer"),Vs=G(),Zf=yt(),eu={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof St.Buffer=="function")return St.Buffer.from(e,"base64");if(typeof atob=="function"){let n=atob(e.replace(/[\n\r]/g,"")),s=new Uint8Array(n.length);for(let i=0;i<n.length;++i)s[i]=n.charCodeAt(i);return s}else return t("This environment does not support reading binary tags; either Buffer or atob is required"),e},stringify({comment:e,type:t,value:n},s,i,r){if(!n)return"";let o=n,a;if(typeof St.Buffer=="function")a=o instanceof St.Buffer?o.toString("base64"):St.Buffer.from(o.buffer).toString("base64");else if(typeof btoa=="function"){let l="";for(let f=0;f<o.length;++f)l+=String.fromCharCode(o[f]);a=btoa(l)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(t??(t=Vs.Scalar.BLOCK_LITERAL),t!==Vs.Scalar.QUOTE_DOUBLE){let l=Math.max(s.options.lineWidth-s.indent.length,s.options.minContentWidth),f=Math.ceil(a.length/l),c=new Array(f);for(let d=0,u=0;d<f;++d,u+=l)c[d]=a.substr(u,l);a=c.join(t===Vs.Scalar.BLOCK_LITERAL?`
|
|
54
|
+
`:" ")}return Zf.stringifyString({comment:e,type:t,value:a},s,i,r)}};yo.binary=eu});var Mn=C(qn=>{"use strict";var Tn=K(),Gs=Ee(),tu=G(),nu=Te();function bo(e,t){if(Tn.isSeq(e))for(let n=0;n<e.items.length;++n){let s=e.items[n];if(!Tn.isPair(s)){if(Tn.isMap(s)){s.items.length>1&&t("Each pair must have its own sequence indicator");let i=s.items[0]||new Gs.Pair(new tu.Scalar(null));if(s.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${s.commentBefore}
|
|
55
55
|
${i.key.commentBefore}`:s.commentBefore),s.comment){let r=i.value??i.key;r.comment=r.comment?`${s.comment}
|
|
56
|
-
${r.comment}`:s.comment}s=i}e.items[n]=An.isPair(s)?s:new Bs.Pair(s)}}else t("Expected a sequence for this tag");return e}function fo(e,t,n){let{replacer:s}=n,i=new Kf.YAMLSeq(e);i.tag="tag:yaml.org,2002:pairs";let r=0;if(t&&Symbol.iterator in Object(t))for(let o of t){typeof s=="function"&&(o=s.call(t,String(r++),o));let 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 l=Object.keys(o);if(l.length===1)a=l[0],c=o[a];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=o;i.items.push(Bs.createPair(a,c,n))}return i}var Uf={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:co,createNode:fo};On.createPairs=fo;On.pairs=Uf;On.resolvePairs=co});var Ys=C(Us=>{"use strict";var uo=D(),Ks=ke(),yt=Ne(),Yf=Ee(),po=Nn(),Me=class e extends Yf.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 i of this.items){let r,o;if(uo.isPair(i)?(r=Ks.toJS(i.key,"",n),o=Ks.toJS(i.value,r,n)):r=Ks.toJS(i,"",n),s.has(r))throw new Error("Ordered maps must not include duplicate keys");s.set(r,o)}return s}static from(t,n,s){let i=po.createPairs(t,n,s),r=new this;return r.items=i.items,r}};Me.tag="tag:yaml.org,2002:omap";var zf={collection:"seq",identify:e=>e instanceof Map,nodeClass:Me,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let n=po.resolvePairs(e,t),s=[];for(let{key:i}of n.items)uo.isScalar(i)&&(s.includes(i.value)?t(`Ordered maps must not include duplicate keys: ${i.value}`):s.push(i.value));return Object.assign(new Me,n)},createNode:(e,t,n)=>Me.from(e,t,n)};Us.YAMLOMap=Me;Us.omap=zf});var bo=C(zs=>{"use strict";var ho=V();function mo({value:e,source:t},n){return t&&(e?go:yo).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var go={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 ho.Scalar(!0),stringify:mo},yo={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 ho.Scalar(!1),stringify:mo};zs.falseTag=yo;zs.trueTag=go});var wo=C(En=>{"use strict";var Vf=V(),Vs=ze(),Wf={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:Vs.stringifyNumber},Jf={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():Vs.stringifyNumber(e)}},Gf={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 Vf.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:Vs.stringifyNumber};En.float=Gf;En.floatExp=Jf;En.floatNaN=Wf});var So=C(wt=>{"use strict";var ko=ze(),bt=e=>typeof e=="bigint"||Number.isInteger(e);function xn(e,t,n,{intAsBigInt:s}){let i=e[0];if((i==="-"||i==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),s){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let o=BigInt(e);return i==="-"?BigInt(-1)*o:o}let r=parseInt(e,n);return i==="-"?-1*r:r}function Ws(e,t,n){let{value:s}=e;if(bt(s)){let i=s.toString(t);return s<0?"-"+n+i.substr(1):n+i}return ko.stringifyNumber(e)}var Xf={identify:bt,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>xn(e,2,2,n),stringify:e=>Ws(e,2,"0b")},Hf={identify:bt,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>xn(e,1,8,n),stringify:e=>Ws(e,8,"0")},Qf={identify:bt,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>xn(e,0,10,n),stringify:ko.stringifyNumber},Zf={identify:bt,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>xn(e,2,16,n),stringify:e=>Ws(e,16,"0x")};wt.int=Qf;wt.intBin=Xf;wt.intHex=Zf;wt.intOct=Hf});var Gs=C(Js=>{"use strict";var qn=D(),Cn=Ae(),Tn=Ne(),Le=class e extends Tn.YAMLMap{constructor(t){super(t),this.tag=e.tag}add(t){let n;qn.isPair(t)?n=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?n=new Cn.Pair(t.key,null):n=new Cn.Pair(t,null),Tn.findPair(this.items,n.key)||this.items.push(n)}get(t,n){let s=Tn.findPair(this.items,t);return!n&&qn.isPair(s)?qn.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=Tn.findPair(this.items,t);s&&!n?this.items.splice(this.items.indexOf(s),1):!s&&n&&this.items.push(new Cn.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:i}=s,r=new this(t);if(n&&Symbol.iterator in Object(n))for(let o of n)typeof i=="function"&&(o=i.call(n,o,o)),r.items.push(Cn.createPair(o,null,s));return r}};Le.tag="tag:yaml.org,2002:set";var eu={collection:"map",identify:e=>e instanceof Set,nodeClass:Le,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>Le.from(e,t,n),resolve(e,t){if(qn.isMap(e)){if(e.hasAllNullValues(!0))return Object.assign(new Le,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};Js.YAMLSet=Le;Js.set=eu});var Hs=C(Pn=>{"use strict";var tu=ze();function Xs(e,t){let n=e[0],s=n==="-"||n==="+"?e.substring(1):e,i=o=>t?BigInt(o):Number(o),r=s.replace(/_/g,"").split(":").reduce((o,a)=>o*i(60)+i(a),i(0));return n==="-"?i(-1)*r:r}function $o(e){let{value:t}=e,n=o=>o;if(typeof t=="bigint")n=o=>BigInt(o);else if(isNaN(t)||!isFinite(t))return tu.stringifyNumber(e);let s="";t<0&&(s="-",t*=n(-1));let i=n(60),r=[t%i];return t<60?r.unshift(0):(t=(t-r[0])/i,r.unshift(t%i),t>=60&&(t=(t-r[0])/i,r.unshift(t))),s+r.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var nu={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})=>Xs(e,n),stringify:$o},su={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=>Xs(e,!1),stringify:$o},vo={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(vo.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,s,i,r,o,a]=t.map(Number),c=t[7]?Number((t[7]+"00").substr(1,3)):0,l=Date.UTC(n,s-1,i,r||0,o||0,a||0,c),d=t[8];if(d&&d!=="Z"){let f=Xs(d,!1);Math.abs(f)<30&&(f*=60),l-=6e4*f}return new Date(l)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};Pn.floatTime=su;Pn.intTime=nu;Pn.timestamp=vo});var No=C(Oo=>{"use strict";var iu=Ue(),ru=wn(),ou=Ye(),au=mt(),lu=_s(),Ao=bo(),Qs=wo(),Mn=So(),cu=un(),fu=Ys(),uu=Nn(),du=Gs(),Zs=Hs(),pu=[iu.map,ou.seq,au.string,ru.nullTag,Ao.trueTag,Ao.falseTag,Mn.intBin,Mn.intOct,Mn.int,Mn.intHex,Qs.floatNaN,Qs.floatExp,Qs.float,lu.binary,cu.merge,fu.omap,uu.pairs,du.set,Zs.intTime,Zs.floatTime,Zs.timestamp];Oo.schema=pu});var Ro=C(ni=>{"use strict";var To=Ue(),hu=wn(),qo=Ye(),mu=mt(),gu=Ps(),ei=Ls(),ti=Rs(),yu=io(),bu=ao(),Po=_s(),kt=un(),Mo=Ys(),Lo=Nn(),Eo=No(),Io=Gs(),Ln=Hs(),xo=new Map([["core",yu.schema],["failsafe",[To.map,qo.seq,mu.string]],["json",bu.schema],["yaml11",Eo.schema],["yaml-1.1",Eo.schema]]),Co={binary:Po.binary,bool:gu.boolTag,float:ei.float,floatExp:ei.floatExp,floatNaN:ei.floatNaN,floatTime:Ln.floatTime,int:ti.int,intHex:ti.intHex,intOct:ti.intOct,intTime:Ln.intTime,map:To.map,merge:kt.merge,null:hu.nullTag,omap:Mo.omap,pairs:Lo.pairs,seq:qo.seq,set:Io.set,timestamp:Ln.timestamp},wu={"tag:yaml.org,2002:binary":Po.binary,"tag:yaml.org,2002:merge":kt.merge,"tag:yaml.org,2002:omap":Mo.omap,"tag:yaml.org,2002:pairs":Lo.pairs,"tag:yaml.org,2002:set":Io.set,"tag:yaml.org,2002:timestamp":Ln.timestamp};function ku(e,t,n){let s=xo.get(t);if(s&&!e)return n&&!s.includes(kt.merge)?s.concat(kt.merge):s.slice();let i=s;if(!i)if(Array.isArray(e))i=[];else{let r=Array.from(xo.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${r} or define customTags array`)}if(Array.isArray(e))for(let r of e)i=i.concat(r);else typeof e=="function"&&(i=e(i.slice()));return n&&(i=i.concat(kt.merge)),i.reduce((r,o)=>{let a=typeof o=="string"?Co[o]:o;if(!a){let c=JSON.stringify(o),l=Object.keys(Co).map(d=>JSON.stringify(d)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return r.includes(a)||r.push(a),r},[])}ni.coreKnownTags=wu;ni.getTags=ku});var ri=C(Do=>{"use strict";var si=D(),Su=Ue(),$u=Ye(),vu=mt(),In=Ro(),Au=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0,ii=class e{constructor({compat:t,customTags:n,merge:s,resolveKnownTags:i,schema:r,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(t)?In.getTags(t,"compat"):t?In.getTags(null,t):null,this.name=typeof r=="string"&&r||"core",this.knownTags=i?In.coreKnownTags:{},this.tags=In.getTags(n,this.name,s),this.toStringOptions=a??null,Object.defineProperty(this,si.MAP,{value:Su.map}),Object.defineProperty(this,si.SCALAR,{value:vu.string}),Object.defineProperty(this,si.SEQ,{value:$u.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?Au:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};Do.Schema=ii});var jo=C(Fo=>{"use strict";var Ou=D(),oi=dt(),St=lt();function Nu(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 i=oi.createStringifyContext(e,t),{commentString:r}=i.options;if(e.commentBefore){n.length!==1&&n.unshift("");let c=r(e.commentBefore);n.unshift(St.indentComment(c,""))}let o=!1,a=null;if(e.contents){if(Ou.isNode(e.contents)){if(e.contents.spaceBefore&&s&&n.push(""),e.contents.commentBefore){let d=r(e.contents.commentBefore);n.push(St.indentComment(d,""))}i.forceBlockIndent=!!e.comment,a=e.contents.comment}let c=a?void 0:()=>o=!0,l=oi.stringify(e.contents,i,()=>a=null,c);a&&(l+=St.lineComment(l,"",r(a))),(l[0]==="|"||l[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${l}`:n.push(l)}else n.push(oi.stringify(e.contents,i));if(e.directives?.docEnd)if(e.comment){let c=r(e.comment);c.includes(`
|
|
57
|
-
`)?(n.push("..."),n.push(
|
|
56
|
+
${r.comment}`:s.comment}s=i}e.items[n]=Tn.isPair(s)?s:new Gs.Pair(s)}}else t("Expected a sequence for this tag");return e}function wo(e,t,n){let{replacer:s}=n,i=new nu.YAMLSeq(e);i.tag="tag:yaml.org,2002:pairs";let r=0;if(t&&Symbol.iterator in Object(t))for(let o of t){typeof s=="function"&&(o=s.call(t,String(r++),o));let a,l;if(Array.isArray(o))if(o.length===2)a=o[0],l=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let f=Object.keys(o);if(f.length===1)a=f[0],l=o[a];else throw new TypeError(`Expected tuple with one key, not ${f.length} keys`)}else a=o;i.items.push(Gs.createPair(a,l,n))}return i}var su={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:bo,createNode:wo};qn.createPairs=wo;qn.pairs=su;qn.resolvePairs=bo});var Qs=C(Xs=>{"use strict";var ko=K(),Hs=ve(),vt=Ce(),iu=Te(),$o=Mn(),Re=class e extends iu.YAMLSeq{constructor(){super(),this.add=vt.YAMLMap.prototype.add.bind(this),this.delete=vt.YAMLMap.prototype.delete.bind(this),this.get=vt.YAMLMap.prototype.get.bind(this),this.has=vt.YAMLMap.prototype.has.bind(this),this.set=vt.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 i of this.items){let r,o;if(ko.isPair(i)?(r=Hs.toJS(i.key,"",n),o=Hs.toJS(i.value,r,n)):r=Hs.toJS(i,"",n),s.has(r))throw new Error("Ordered maps must not include duplicate keys");s.set(r,o)}return s}static from(t,n,s){let i=$o.createPairs(t,n,s),r=new this;return r.items=i.items,r}};Re.tag="tag:yaml.org,2002:omap";var ru={collection:"seq",identify:e=>e instanceof Map,nodeClass:Re,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let n=$o.resolvePairs(e,t),s=[];for(let{key:i}of n.items)ko.isScalar(i)&&(s.includes(i.value)?t(`Ordered maps must not include duplicate keys: ${i.value}`):s.push(i.value));return Object.assign(new Re,n)},createNode:(e,t,n)=>Re.from(e,t,n)};Xs.YAMLOMap=Re;Xs.omap=ru});var No=C(Zs=>{"use strict";var So=G();function vo({value:e,source:t},n){return t&&(e?Oo:Ao).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var Oo={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 So.Scalar(!0),stringify:vo},Ao={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 So.Scalar(!1),stringify:vo};Zs.falseTag=Ao;Zs.trueTag=Oo});var Eo=C(Pn=>{"use strict";var ou=G(),ei=Je(),au={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:ei.stringifyNumber},lu={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():ei.stringifyNumber(e)}},cu={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 ou.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:ei.stringifyNumber};Pn.float=cu;Pn.floatExp=lu;Pn.floatNaN=au});var Co=C(At=>{"use strict";var xo=Je(),Ot=e=>typeof e=="bigint"||Number.isInteger(e);function Ln(e,t,n,{intAsBigInt:s}){let i=e[0];if((i==="-"||i==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),s){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let o=BigInt(e);return i==="-"?BigInt(-1)*o:o}let r=parseInt(e,n);return i==="-"?-1*r:r}function ti(e,t,n){let{value:s}=e;if(Ot(s)){let i=s.toString(t);return s<0?"-"+n+i.substr(1):n+i}return xo.stringifyNumber(e)}var fu={identify:Ot,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>Ln(e,2,2,n),stringify:e=>ti(e,2,"0b")},uu={identify:Ot,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>Ln(e,1,8,n),stringify:e=>ti(e,8,"0")},du={identify:Ot,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>Ln(e,0,10,n),stringify:xo.stringifyNumber},pu={identify:Ot,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>Ln(e,2,16,n),stringify:e=>ti(e,16,"0x")};At.int=du;At.intBin=fu;At.intHex=pu;At.intOct=uu});var si=C(ni=>{"use strict";var Fn=K(),In=Ee(),Rn=Ce(),Fe=class e extends Rn.YAMLMap{constructor(t){super(t),this.tag=e.tag}add(t){let n;Fn.isPair(t)?n=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?n=new In.Pair(t.key,null):n=new In.Pair(t,null),Rn.findPair(this.items,n.key)||this.items.push(n)}get(t,n){let s=Rn.findPair(this.items,t);return!n&&Fn.isPair(s)?Fn.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=Rn.findPair(this.items,t);s&&!n?this.items.splice(this.items.indexOf(s),1):!s&&n&&this.items.push(new In.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:i}=s,r=new this(t);if(n&&Symbol.iterator in Object(n))for(let o of n)typeof i=="function"&&(o=i.call(n,o,o)),r.items.push(In.createPair(o,null,s));return r}};Fe.tag="tag:yaml.org,2002:set";var hu={collection:"map",identify:e=>e instanceof Set,nodeClass:Fe,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>Fe.from(e,t,n),resolve(e,t){if(Fn.isMap(e)){if(e.hasAllNullValues(!0))return Object.assign(new Fe,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};ni.YAMLSet=Fe;ni.set=hu});var ri=C(Dn=>{"use strict";var mu=Je();function ii(e,t){let n=e[0],s=n==="-"||n==="+"?e.substring(1):e,i=o=>t?BigInt(o):Number(o),r=s.replace(/_/g,"").split(":").reduce((o,a)=>o*i(60)+i(a),i(0));return n==="-"?i(-1)*r:r}function To(e){let{value:t}=e,n=o=>o;if(typeof t=="bigint")n=o=>BigInt(o);else if(isNaN(t)||!isFinite(t))return mu.stringifyNumber(e);let s="";t<0&&(s="-",t*=n(-1));let i=n(60),r=[t%i];return t<60?r.unshift(0):(t=(t-r[0])/i,r.unshift(t%i),t>=60&&(t=(t-r[0])/i,r.unshift(t))),s+r.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var gu={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})=>ii(e,n),stringify:To},yu={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=>ii(e,!1),stringify:To},qo={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(qo.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,s,i,r,o,a]=t.map(Number),l=t[7]?Number((t[7]+"00").substr(1,3)):0,f=Date.UTC(n,s-1,i,r||0,o||0,a||0,l),c=t[8];if(c&&c!=="Z"){let d=ii(c,!1);Math.abs(d)<30&&(d*=60),f-=6e4*d}return new Date(f)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};Dn.floatTime=yu;Dn.intTime=gu;Dn.timestamp=qo});var Lo=C(Po=>{"use strict";var bu=We(),wu=An(),ku=Ve(),$u=$t(),Su=Js(),Mo=No(),oi=Eo(),jn=Co(),vu=yn(),Ou=Qs(),Au=Mn(),Nu=si(),ai=ri(),Eu=[bu.map,ku.seq,$u.string,wu.nullTag,Mo.trueTag,Mo.falseTag,jn.intBin,jn.intOct,jn.int,jn.intHex,oi.floatNaN,oi.floatExp,oi.float,Su.binary,vu.merge,Ou.omap,Au.pairs,Nu.set,ai.intTime,ai.floatTime,ai.timestamp];Po.schema=Eu});var Yo=C(fi=>{"use strict";var Do=We(),xu=An(),jo=Ve(),Cu=$t(),Tu=_s(),li=Ks(),ci=Ys(),qu=po(),Mu=go(),_o=Js(),Nt=yn(),Bo=Qs(),Ko=Mn(),Io=Lo(),Uo=si(),_n=ri(),Ro=new Map([["core",qu.schema],["failsafe",[Do.map,jo.seq,Cu.string]],["json",Mu.schema],["yaml11",Io.schema],["yaml-1.1",Io.schema]]),Fo={binary:_o.binary,bool:Tu.boolTag,float:li.float,floatExp:li.floatExp,floatNaN:li.floatNaN,floatTime:_n.floatTime,int:ci.int,intHex:ci.intHex,intOct:ci.intOct,intTime:_n.intTime,map:Do.map,merge:Nt.merge,null:xu.nullTag,omap:Bo.omap,pairs:Ko.pairs,seq:jo.seq,set:Uo.set,timestamp:_n.timestamp},Pu={"tag:yaml.org,2002:binary":_o.binary,"tag:yaml.org,2002:merge":Nt.merge,"tag:yaml.org,2002:omap":Bo.omap,"tag:yaml.org,2002:pairs":Ko.pairs,"tag:yaml.org,2002:set":Uo.set,"tag:yaml.org,2002:timestamp":_n.timestamp};function Lu(e,t,n){let s=Ro.get(t);if(s&&!e)return n&&!s.includes(Nt.merge)?s.concat(Nt.merge):s.slice();let i=s;if(!i)if(Array.isArray(e))i=[];else{let r=Array.from(Ro.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${r} or define customTags array`)}if(Array.isArray(e))for(let r of e)i=i.concat(r);else typeof e=="function"&&(i=e(i.slice()));return n&&(i=i.concat(Nt.merge)),i.reduce((r,o)=>{let a=typeof o=="string"?Fo[o]:o;if(!a){let l=JSON.stringify(o),f=Object.keys(Fo).map(c=>JSON.stringify(c)).join(", ");throw new Error(`Unknown custom tag ${l}; use one of ${f}`)}return r.includes(a)||r.push(a),r},[])}fi.coreKnownTags=Pu;fi.getTags=Lu});var pi=C(zo=>{"use strict";var ui=K(),Iu=We(),Ru=Ve(),Fu=$t(),Bn=Yo(),Du=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0,di=class e{constructor({compat:t,customTags:n,merge:s,resolveKnownTags:i,schema:r,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(t)?Bn.getTags(t,"compat"):t?Bn.getTags(null,t):null,this.name=typeof r=="string"&&r||"core",this.knownTags=i?Bn.coreKnownTags:{},this.tags=Bn.getTags(n,this.name,s),this.toStringOptions=a??null,Object.defineProperty(this,ui.MAP,{value:Iu.map}),Object.defineProperty(this,ui.SCALAR,{value:Fu.string}),Object.defineProperty(this,ui.SEQ,{value:Ru.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?Du:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};zo.Schema=di});var Vo=C(Wo=>{"use strict";var ju=K(),hi=bt(),Et=ht();function _u(e,t){let n=[],s=t.directives===!0;if(t.directives!==!1&&e.directives){let l=e.directives.toString(e);l?(n.push(l),s=!0):e.directives.docStart&&(s=!0)}s&&n.push("---");let i=hi.createStringifyContext(e,t),{commentString:r}=i.options;if(e.commentBefore){n.length!==1&&n.unshift("");let l=r(e.commentBefore);n.unshift(Et.indentComment(l,""))}let o=!1,a=null;if(e.contents){if(ju.isNode(e.contents)){if(e.contents.spaceBefore&&s&&n.push(""),e.contents.commentBefore){let c=r(e.contents.commentBefore);n.push(Et.indentComment(c,""))}i.forceBlockIndent=!!e.comment,a=e.contents.comment}let l=a?void 0:()=>o=!0,f=hi.stringify(e.contents,i,()=>a=null,l);a&&(f+=Et.lineComment(f,"",r(a))),(f[0]==="|"||f[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${f}`:n.push(f)}else n.push(hi.stringify(e.contents,i));if(e.directives?.docEnd)if(e.comment){let l=r(e.comment);l.includes(`
|
|
57
|
+
`)?(n.push("..."),n.push(Et.indentComment(l,""))):n.push(`... ${l}`)}else n.push("...");else{let l=e.comment;l&&o&&(l=l.replace(/^\n+/,"")),l&&((!o||a)&&n[n.length-1]!==""&&n.push(""),n.push(Et.indentComment(r(l),"")))}return n.join(`
|
|
58
58
|
`)+`
|
|
59
|
-
`}
|
|
60
|
-
`),o=a+o}if(/[^ ]/.test(o)){let a=1,
|
|
59
|
+
`}Wo.stringifyDocument=_u});var xt=C(Jo=>{"use strict";var Bu=dt(),Ge=an(),le=K(),Ku=Ee(),Uu=ve(),Yu=pi(),zu=Vo(),mi=nn(),Wu=ws(),Vu=pt(),gi=bs(),yi=class e{constructor(t,n,s){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,le.NODE_TYPE,{value:le.DOC});let i=null;typeof n=="function"||Array.isArray(n)?i=n:s===void 0&&n&&(s=n,n=void 0);let r=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},s);this.options=r;let{version:o}=r;s?._directives?(this.directives=s._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new gi.Directives({version:o}),this.setSchema(o,s),this.contents=t===void 0?null:this.createNode(t,i,s)}clone(){let t=Object.create(e.prototype,{[le.NODE_TYPE]:{value:le.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=le.isNode(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){He(this.contents)&&this.contents.add(t)}addIn(t,n){He(this.contents)&&this.contents.addIn(t,n)}createAlias(t,n){if(!t.anchor){let s=mi.anchorNames(this);t.anchor=!n||s.has(n)?mi.findNewAnchor(n||"a",s):n}return new Bu.Alias(t.anchor)}createNode(t,n,s){let i;if(typeof n=="function")t=n.call({"":t},"",t),i=n;else if(Array.isArray(n)){let y=v=>typeof v=="number"||v instanceof String||v instanceof Number,O=n.filter(y).map(String);O.length>0&&(n=n.concat(O)),i=n}else s===void 0&&n&&(s=n,n=void 0);let{aliasDuplicateObjects:r,anchorPrefix:o,flow:a,keepUndefined:l,onTagObj:f,tag:c}=s??{},{onAnchor:d,setAnchors:u,sourceObjects:h}=mi.createNodeAnchors(this,o||"a"),b={aliasDuplicateObjects:r??!0,keepUndefined:l??!1,onAnchor:d,onTagObj:f,replacer:i,schema:this.schema,sourceObjects:h},m=Vu.createNode(t,c,b);return a&&le.isCollection(m)&&(m.flow=!0),u(),m}createPair(t,n,s={}){let i=this.createNode(t,null,s),r=this.createNode(n,null,s);return new Ku.Pair(i,r)}delete(t){return He(this.contents)?this.contents.delete(t):!1}deleteIn(t){return Ge.isEmptyPath(t)?this.contents==null?!1:(this.contents=null,!0):He(this.contents)?this.contents.deleteIn(t):!1}get(t,n){return le.isCollection(this.contents)?this.contents.get(t,n):void 0}getIn(t,n){return Ge.isEmptyPath(t)?!n&&le.isScalar(this.contents)?this.contents.value:this.contents:le.isCollection(this.contents)?this.contents.getIn(t,n):void 0}has(t){return le.isCollection(this.contents)?this.contents.has(t):!1}hasIn(t){return Ge.isEmptyPath(t)?this.contents!==void 0:le.isCollection(this.contents)?this.contents.hasIn(t):!1}set(t,n){this.contents==null?this.contents=Ge.collectionFromPath(this.schema,[t],n):He(this.contents)&&this.contents.set(t,n)}setIn(t,n){Ge.isEmptyPath(t)?this.contents=n:this.contents==null?this.contents=Ge.collectionFromPath(this.schema,Array.from(t),n):He(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 gi.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 gi.Directives({version:t}),s={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,s=null;break;default:{let i=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(s)this.schema=new Yu.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:i,onAnchor:r,reviver:o}={}){let a={anchors:new Map,doc:this,keep:!t,mapAsMap:s===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},l=Uu.toJS(this.contents,n??"",a);if(typeof r=="function")for(let{count:f,res:c}of a.anchors.values())r(c,f);return typeof o=="function"?Wu.applyReviver(o,{"":l},"",l):l}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 zu.stringifyDocument(this,t)}};function He(e){if(le.isCollection(e))return!0;throw new Error("Expected a YAML collection as document contents")}Jo.Document=yi});var qt=C(Tt=>{"use strict";var Ct=class extends Error{constructor(t,n,s,i){super(),this.name=t,this.code=s,this.message=i,this.pos=n}},bi=class extends Ct{constructor(t,n,s){super("YAMLParseError",t,n,s)}},wi=class extends Ct{constructor(t,n,s){super("YAMLWarning",t,n,s)}},Ju=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(a=>t.linePos(a));let{line:s,col:i}=n.linePos[0];n.message+=` at line ${s}, column ${i}`;let r=i-1,o=e.substring(t.lineStarts[s-1],t.lineStarts[s]).replace(/[\n\r]+$/,"");if(r>=60&&o.length>80){let a=Math.min(r-39,o.length-79);o="\u2026"+o.substring(a),r-=a-1}if(o.length>80&&(o=o.substring(0,79)+"\u2026"),s>1&&/^ *$/.test(o.substring(0,r))){let a=e.substring(t.lineStarts[s-2],t.lineStarts[s-1]);a.length>80&&(a=a.substring(0,79)+`\u2026
|
|
60
|
+
`),o=a+o}if(/[^ ]/.test(o)){let a=1,l=n.linePos[1];l?.line===s&&l.col>i&&(a=Math.max(1,Math.min(l.col-i,80-r)));let f=" ".repeat(r)+"^".repeat(a);n.message+=`:
|
|
61
61
|
|
|
62
62
|
${o}
|
|
63
|
-
${
|
|
64
|
-
`}};
|
|
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
|
-
`+
|
|
67
|
-
`+
|
|
68
|
-
`+
|
|
69
|
-
`+q:
|
|
70
|
-
`+
|
|
71
|
-
`+
|
|
72
|
-
`.repeat(Math.max(1,o.length-1)):"",
|
|
73
|
-
`;for(let
|
|
74
|
-
`):
|
|
75
|
-
`:!
|
|
63
|
+
${f}
|
|
64
|
+
`}};Tt.YAMLError=Ct;Tt.YAMLParseError=bi;Tt.YAMLWarning=wi;Tt.prettifyError=Ju});var Mt=C(Go=>{"use strict";function Gu(e,{flow:t,indicator:n,next:s,offset:i,onError:r,parentIndent:o,startOnNewline:a}){let l=!1,f=a,c=a,d="",u="",h=!1,b=!1,m=null,y=null,O=null,v=null,S=null,M=null,$=null;for(let g of e)switch(b&&(g.type!=="space"&&g.type!=="newline"&&g.type!=="comma"&&r(g.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),b=!1),m&&(f&&g.type!=="comment"&&g.type!=="newline"&&r(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),m=null),g.type){case"space":!t&&(n!=="doc-start"||s?.type!=="flow-collection")&&g.source.includes(" ")&&(m=g),c=!0;break;case"comment":{c||r(g,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let E=g.source.substring(1)||" ";d?d+=u+E:d=E,u="",f=!1;break}case"newline":f?d?d+=g.source:(!M||n!=="seq-item-ind")&&(l=!0):u+=g.source,f=!0,h=!0,(y||O)&&(v=g),c=!0;break;case"anchor":y&&r(g,"MULTIPLE_ANCHORS","A node can have at most one anchor"),g.source.endsWith(":")&&r(g.offset+g.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),y=g,$??($=g.offset),f=!1,c=!1,b=!0;break;case"tag":{O&&r(g,"MULTIPLE_TAGS","A node can have at most one tag"),O=g,$??($=g.offset),f=!1,c=!1,b=!0;break}case n:(y||O)&&r(g,"BAD_PROP_ORDER",`Anchors and tags must be after the ${g.source} indicator`),M&&r(g,"UNEXPECTED_TOKEN",`Unexpected ${g.source} in ${t??"collection"}`),M=g,f=n==="seq-item-ind"||n==="explicit-key-ind",c=!1;break;case"comma":if(t){S&&r(g,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),S=g,f=!1,c=!1;break}default:r(g,"UNEXPECTED_TOKEN",`Unexpected ${g.type} token`),f=!1,c=!1}let N=e[e.length-1],q=N?N.offset+N.source.length:i;return b&&s&&s.type!=="space"&&s.type!=="newline"&&s.type!=="comma"&&(s.type!=="scalar"||s.source!=="")&&r(s.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m&&(f&&m.indent<=o||s?.type==="block-map"||s?.type==="block-seq")&&r(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:S,found:M,spaceBefore:l,comment:d,hasNewline:h,anchor:y,tag:O,newlineAfterProp:v,end:q,start:$??q}}Go.resolveProps=Gu});var Kn=C(Ho=>{"use strict";function ki(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(ki(t.key)||ki(t.value))return!0}return!1;default:return!0}}Ho.containsNewline=ki});var $i=C(Xo=>{"use strict";var Hu=Kn();function Xu(e,t,n){if(t?.type==="flow-collection"){let s=t.end[0];s.indent===e&&(s.source==="]"||s.source==="}")&&Hu.containsNewline(t)&&n(s,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}Xo.flowIndentCheck=Xu});var Si=C(Zo=>{"use strict";var Qo=K();function Qu(e,t,n){let{uniqueKeys:s}=e.options;if(s===!1)return!1;let i=typeof s=="function"?s:(r,o)=>r===o||Qo.isScalar(r)&&Qo.isScalar(o)&&r.value===o.value;return t.some(r=>i(r.key,n))}Zo.mapIncludes=Qu});var ra=C(ia=>{"use strict";var ea=Ee(),Zu=Ce(),ta=Mt(),ed=Kn(),na=$i(),td=Si(),sa="All mapping items must start at the same column";function nd({composeNode:e,composeEmptyNode:t},n,s,i,r){let o=r?.nodeClass??Zu.YAMLMap,a=new o(n.schema);n.atRoot&&(n.atRoot=!1);let l=s.offset,f=null;for(let c of s.items){let{start:d,key:u,sep:h,value:b}=c,m=ta.resolveProps(d,{indicator:"explicit-key-ind",next:u??h?.[0],offset:l,onError:i,parentIndent:s.indent,startOnNewline:!0}),y=!m.found;if(y){if(u&&(u.type==="block-seq"?i(l,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in u&&u.indent!==s.indent&&i(l,"BAD_INDENT",sa)),!m.anchor&&!m.tag&&!h){f=m.end,m.comment&&(a.comment?a.comment+=`
|
|
66
|
+
`+m.comment:a.comment=m.comment);continue}(m.newlineAfterProp||ed.containsNewline(u))&&i(u??d[d.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else m.found?.indent!==s.indent&&i(l,"BAD_INDENT",sa);n.atKey=!0;let O=m.end,v=u?e(n,u,m,i):t(n,O,d,null,m,i);n.schema.compat&&na.flowIndentCheck(s.indent,u,i),n.atKey=!1,td.mapIncludes(n,a.items,v)&&i(O,"DUPLICATE_KEY","Map keys must be unique");let S=ta.resolveProps(h??[],{indicator:"map-value-ind",next:b,offset:v.range[2],onError:i,parentIndent:s.indent,startOnNewline:!u||u.type==="block-scalar"});if(l=S.end,S.found){y&&(b?.type==="block-map"&&!S.hasNewline&&i(l,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&m.start<S.found.offset-1024&&i(v.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let M=b?e(n,b,S,i):t(n,l,h,null,S,i);n.schema.compat&&na.flowIndentCheck(s.indent,b,i),l=M.range[2];let $=new ea.Pair(v,M);n.options.keepSourceTokens&&($.srcToken=c),a.items.push($)}else{y&&i(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 M=new ea.Pair(v);n.options.keepSourceTokens&&(M.srcToken=c),a.items.push(M)}}return f&&f<l&&i(f,"IMPOSSIBLE","Map comment with trailing content"),a.range=[s.offset,l,f??l],a}ia.resolveBlockMap=nd});var aa=C(oa=>{"use strict";var sd=Te(),id=Mt(),rd=$i();function od({composeNode:e,composeEmptyNode:t},n,s,i,r){let o=r?.nodeClass??sd.YAMLSeq,a=new o(n.schema);n.atRoot&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let l=s.offset,f=null;for(let{start:c,value:d}of s.items){let u=id.resolveProps(c,{indicator:"seq-item-ind",next:d,offset:l,onError:i,parentIndent:s.indent,startOnNewline:!0});if(!u.found)if(u.anchor||u.tag||d)d?.type==="block-seq"?i(u.end,"BAD_INDENT","All sequence items must start at the same column"):i(l,"MISSING_CHAR","Sequence item without - indicator");else{f=u.end,u.comment&&(a.comment=u.comment);continue}let h=d?e(n,d,u,i):t(n,u.end,c,null,u,i);n.schema.compat&&rd.flowIndentCheck(s.indent,d,i),l=h.range[2],a.items.push(h)}return a.range=[s.offset,l,f??l],a}oa.resolveBlockSeq=od});var Xe=C(la=>{"use strict";function ad(e,t,n,s){let i="";if(e){let r=!1,o="";for(let a of e){let{source:l,type:f}=a;switch(f){case"space":r=!0;break;case"comment":{n&&!r&&s(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let c=l.substring(1)||" ";i?i+=o+c:i=c,o="";break}case"newline":i&&(o+=l),r=!0;break;default:s(a,"UNEXPECTED_TOKEN",`Unexpected ${f} at node end`)}t+=l.length}}return{comment:i,offset:t}}la.resolveEnd=ad});var da=C(ua=>{"use strict";var ld=K(),cd=Ee(),ca=Ce(),fd=Te(),ud=Xe(),fa=Mt(),dd=Kn(),pd=Si(),vi="Block collections are not allowed within flow collections",Oi=e=>e&&(e.type==="block-map"||e.type==="block-seq");function hd({composeNode:e,composeEmptyNode:t},n,s,i,r){let o=s.start.source==="{",a=o?"flow map":"flow sequence",l=r?.nodeClass??(o?ca.YAMLMap:fd.YAMLSeq),f=new l(n.schema);f.flow=!0;let c=n.atRoot;c&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let d=s.offset+s.start.source.length;for(let y=0;y<s.items.length;++y){let O=s.items[y],{start:v,key:S,sep:M,value:$}=O,N=fa.resolveProps(v,{flow:a,indicator:"explicit-key-ind",next:S??M?.[0],offset:d,onError:i,parentIndent:s.indent,startOnNewline:!1});if(!N.found){if(!N.anchor&&!N.tag&&!M&&!$){y===0&&N.comma?i(N.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):y<s.items.length-1&&i(N.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),N.comment&&(f.comment?f.comment+=`
|
|
68
|
+
`+N.comment:f.comment=N.comment),d=N.end;continue}!o&&n.options.strict&&dd.containsNewline(S)&&i(S,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(y===0)N.comma&&i(N.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(N.comma||i(N.start,"MISSING_CHAR",`Missing , between ${a} items`),N.comment){let q="";e:for(let g of v)switch(g.type){case"comma":case"space":break;case"comment":q=g.source.substring(1);break e;default:break e}if(q){let g=f.items[f.items.length-1];ld.isPair(g)&&(g=g.value??g.key),g.comment?g.comment+=`
|
|
69
|
+
`+q:g.comment=q,N.comment=N.comment.substring(q.length+1)}}if(!o&&!M&&!N.found){let q=$?e(n,$,N,i):t(n,N.end,M,null,N,i);f.items.push(q),d=q.range[2],Oi($)&&i(q.range,"BLOCK_IN_FLOW",vi)}else{n.atKey=!0;let q=N.end,g=S?e(n,S,N,i):t(n,q,v,null,N,i);Oi(S)&&i(g.range,"BLOCK_IN_FLOW",vi),n.atKey=!1;let E=fa.resolveProps(M??[],{flow:a,indicator:"map-value-ind",next:$,offset:g.range[2],onError:i,parentIndent:s.indent,startOnNewline:!1});if(E.found){if(!o&&!N.found&&n.options.strict){if(M)for(let F of M){if(F===E.found)break;if(F.type==="newline"){i(F,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}N.start<E.found.offset-1024&&i(E.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else $&&("source"in $&&$.source?.[0]===":"?i($,"MISSING_CHAR",`Missing space after : in ${a}`):i(E.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let L=$?e(n,$,E,i):E.found?t(n,E.end,M,null,E,i):null;L?Oi($)&&i(L.range,"BLOCK_IN_FLOW",vi):E.comment&&(g.comment?g.comment+=`
|
|
70
|
+
`+E.comment:g.comment=E.comment);let Y=new cd.Pair(g,L);if(n.options.keepSourceTokens&&(Y.srcToken=O),o){let F=f;pd.mapIncludes(n,F.items,g)&&i(q,"DUPLICATE_KEY","Map keys must be unique"),F.items.push(Y)}else{let F=new ca.YAMLMap(n.schema);F.flow=!0,F.items.push(Y);let k=(L??g).range;F.range=[g.range[0],k[1],k[2]],f.items.push(F)}d=L?L.range[2]:E.end}}let u=o?"}":"]",[h,...b]=s.end,m=d;if(h?.source===u)m=h.offset+h.source.length;else{let y=a[0].toUpperCase()+a.substring(1),O=c?`${y} must end with a ${u}`:`${y} in block collection must be sufficiently indented and end with a ${u}`;i(d,c?"MISSING_CHAR":"BAD_INDENT",O),h&&h.source.length!==1&&b.unshift(h)}if(b.length>0){let y=ud.resolveEnd(b,m,n.options.strict,i);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}ua.resolveFlowCollection=hd});var ha=C(pa=>{"use strict";var md=K(),gd=G(),yd=Ce(),bd=Te(),wd=ra(),kd=aa(),$d=da();function Ai(e,t,n,s,i,r){let o=n.type==="block-map"?wd.resolveBlockMap(e,t,n,s,r):n.type==="block-seq"?kd.resolveBlockSeq(e,t,n,s,r):$d.resolveFlowCollection(e,t,n,s,r),a=o.constructor;return i==="!"||i===a.tagName?(o.tag=a.tagName,o):(i&&(o.tag=i),o)}function Sd(e,t,n,s,i){let r=s.tag,o=r?t.directives.tagName(r.source,u=>i(r,"TAG_RESOLVE_FAILED",u)):null;if(n.type==="block-seq"){let{anchor:u,newlineAfterProp:h}=s,b=u&&r?u.offset>r.offset?u:r:u??r;b&&(!h||h.offset<b.offset)&&i(b,"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(!r||!o||o==="!"||o===yd.YAMLMap.tagName&&a==="map"||o===bd.YAMLSeq.tagName&&a==="seq")return Ai(e,t,n,i,o);let l=t.schema.tags.find(u=>u.tag===o&&u.collection===a);if(!l){let u=t.schema.knownTags[o];if(u?.collection===a)t.schema.tags.push(Object.assign({},u,{default:!1})),l=u;else return u?i(r,"BAD_COLLECTION_TYPE",`${u.tag} used for ${a} collection, but expects ${u.collection??"scalar"}`,!0):i(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),Ai(e,t,n,i,o)}let f=Ai(e,t,n,i,o,l),c=l.resolve?.(f,u=>i(r,"TAG_RESOLVE_FAILED",u),t.options)??f,d=md.isNode(c)?c:new gd.Scalar(c);return d.range=f.range,d.tag=o,l?.format&&(d.format=l.format),d}pa.composeCollection=Sd});var Ei=C(ma=>{"use strict";var Ni=G();function vd(e,t,n){let s=t.offset,i=Od(t,e.options.strict,n);if(!i)return{value:"",type:null,comment:"",range:[s,s,s]};let r=i.mode===">"?Ni.Scalar.BLOCK_FOLDED:Ni.Scalar.BLOCK_LITERAL,o=t.source?Ad(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=i.chomp==="+"&&o.length>0?`
|
|
72
|
+
`.repeat(Math.max(1,o.length-1)):"",y=s+i.length;return t.source&&(y+=t.source.length),{value:m,type:r,comment:i.comment,range:[s,y,y]}}let l=t.indent+i.indent,f=t.offset+i.length,c=0;for(let m=0;m<a;++m){let[y,O]=o[m];if(O===""||O==="\r")i.indent===0&&y.length>l&&(l=y.length);else{y.length<l&&n(f+y.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),i.indent===0&&(l=y.length),c=m,l===0&&!e.atRoot&&n(f,"BAD_INDENT","Block scalar values in collections must be indented");break}f+=y.length+O.length+1}for(let m=o.length-1;m>=a;--m)o[m][0].length>l&&(a=m+1);let d="",u="",h=!1;for(let m=0;m<c;++m)d+=o[m][0].slice(l)+`
|
|
73
|
+
`;for(let m=c;m<a;++m){let[y,O]=o[m];f+=y.length+O.length+1;let v=O[O.length-1]==="\r";if(v&&(O=O.slice(0,-1)),O&&y.length<l){let M=`Block scalar lines must not be less indented than their ${i.indent?"explicit indentation indicator":"first line"}`;n(f-O.length-(v?2:1),"BAD_INDENT",M),y=""}r===Ni.Scalar.BLOCK_LITERAL?(d+=u+y.slice(l)+O,u=`
|
|
74
|
+
`):y.length>l||O[0]===" "?(u===" "?u=`
|
|
75
|
+
`:!h&&u===`
|
|
76
76
|
`&&(u=`
|
|
77
77
|
|
|
78
|
-
`),
|
|
79
|
-
`,
|
|
80
|
-
`?
|
|
78
|
+
`),d+=u+y.slice(l)+O,u=`
|
|
79
|
+
`,h=!0):O===""?u===`
|
|
80
|
+
`?d+=`
|
|
81
81
|
`:u=`
|
|
82
|
-
`:(
|
|
83
|
-
`+o[
|
|
84
|
-
`&&(
|
|
85
|
-
`);break;default:
|
|
86
|
-
`}let
|
|
82
|
+
`:(d+=u+O,u=" ",h=!1)}switch(i.chomp){case"-":break;case"+":for(let m=a;m<o.length;++m)d+=`
|
|
83
|
+
`+o[m][0].slice(l);d[d.length-1]!==`
|
|
84
|
+
`&&(d+=`
|
|
85
|
+
`);break;default:d+=`
|
|
86
|
+
`}let b=s+i.length+t.source.length;return{value:d,type:r,comment:i.comment,range:[s,b,b]}}function Od({offset:e,props:t},n,s){if(t[0].type!=="block-scalar-header")return s(t[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:i}=t[0],r=i[0],o=0,a="",l=-1;for(let u=1;u<i.length;++u){let h=i[u];if(!a&&(h==="-"||h==="+"))a=h;else{let b=Number(h);!o&&b?o=b:l===-1&&(l=e+u)}}l!==-1&&s(l,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let f=!1,c="",d=i.length;for(let u=1;u<t.length;++u){let h=t[u];switch(h.type){case"space":f=!0;case"newline":d+=h.source.length;break;case"comment":n&&!f&&s(h,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),d+=h.source.length,c=h.source.substring(1);break;case"error":s(h,"UNEXPECTED_TOKEN",h.message),d+=h.source.length;break;default:{let b=`Unexpected token in block scalar header: ${h.type}`;s(h,"UNEXPECTED_TOKEN",b);let m=h.source;m&&typeof m=="string"&&(d+=m.length)}}}return{mode:r,indent:o,chomp:a,comment:c,length:d}}function Ad(e){let t=e.split(/\n( *)/),n=t[0],s=n.match(/^( *)/),r=[s?.[1]?[s[1],n.slice(s[1].length)]:["",n]];for(let o=1;o<t.length;o+=2)r.push([t[o],t[o+1]]);return r}ma.resolveBlockScalar=vd});var Ci=C(ya=>{"use strict";var xi=G(),Nd=Xe();function Ed(e,t,n){let{offset:s,type:i,source:r,end:o}=e,a,l,f=(u,h,b)=>n(s+u,h,b);switch(i){case"scalar":a=xi.Scalar.PLAIN,l=xd(r,f);break;case"single-quoted-scalar":a=xi.Scalar.QUOTE_SINGLE,l=Cd(r,f);break;case"double-quoted-scalar":a=xi.Scalar.QUOTE_DOUBLE,l=Td(r,f);break;default:return n(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[s,s+r.length,s+r.length]}}let c=s+r.length,d=Nd.resolveEnd(o,c,t,n);return{value:l,type:a,comment:d.comment,range:[s,c,d.offset]}}function xd(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}`),ga(e)}function Cd(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),ga(e.slice(1,-1)).replace(/''/g,"'")}function ga(e){let t=/(.*?)\r?\n/sy,n=t.exec(e);if(!n)return e;let s,i;try{s=new RegExp("(?<![ ])[ ]+$"),i=new RegExp("^[ ]+|(?<![ ])[ ]+$","g")}catch{s=/[ \t]+$/,i=/^[ \t]+|[ \t]+$/g}let r=n[1].replace(s,""),o=" ",a=t.lastIndex;for(;n=t.exec(e);){let f=n[1].replace(i,"");f===""?o===`
|
|
87
87
|
`?r+=o:o=`
|
|
88
|
-
`:(r+=o+
|
|
88
|
+
`:(r+=o+f,o=" "),a=t.lastIndex}let l=/[ \t]*(.*)/sy;return l.lastIndex=a,n=l.exec(e),r+o+(n?.[1]??"")}function Td(e,t){let n="";for(let s=1;s<e.length-1;++s){let i=e[s];if(!(i==="\r"&&e[s+1]===`
|
|
89
89
|
`))if(i===`
|
|
90
|
-
`){let{fold:r,offset:o}=
|
|
90
|
+
`){let{fold:r,offset:o}=qd(e,s);n+=r,s=o}else if(i==="\\"){let r=e[++s],o=Md[r];if(o)n+=o;else if(r===`
|
|
91
91
|
`)for(r=e[s+1];r===" "||r===" ";)r=e[++s+1];else if(r==="\r"&&e[s+1]===`
|
|
92
|
-
`)for(r=e[++s+1];r===" "||r===" ";)r=e[++s+1];else if(r==="x"||r==="u"||r==="U"){let a=r==="x"?2:r==="u"?4:8;n+=
|
|
92
|
+
`)for(r=e[++s+1];r===" "||r===" ";)r=e[++s+1];else if(r==="x"||r==="u"||r==="U"){let a=r==="x"?2:r==="u"?4:8;n+=Pd(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(i===" "||i===" "){let r=s,o=e[s+1];for(;o===" "||o===" ";)o=e[++s+1];o!==`
|
|
93
93
|
`&&!(o==="\r"&&e[s+2]===`
|
|
94
|
-
`)&&(n+=s>r?e.slice(r,s+1):i)}else n+=i}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),n}function
|
|
94
|
+
`)&&(n+=s>r?e.slice(r,s+1):i)}else n+=i}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),n}function qd(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 Md={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 Pd(e,t,n,s){let i=e.substr(t,n),o=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,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}}ya.resolveFlowScalar=Ed});var ka=C(wa=>{"use strict";var De=K(),ba=G(),Ld=Ei(),Id=Ci();function Rd(e,t,n,s){let{value:i,type:r,comment:o,range:a}=t.type==="block-scalar"?Ld.resolveBlockScalar(e,t,s):Id.resolveFlowScalar(t,e.options.strict,s),l=n?e.directives.tagName(n.source,d=>s(n,"TAG_RESOLVE_FAILED",d)):null,f;e.options.stringKeys&&e.atKey?f=e.schema[De.SCALAR]:l?f=Fd(e.schema,i,l,n,s):t.type==="scalar"?f=Dd(e,i,t,s):f=e.schema[De.SCALAR];let c;try{let d=f.resolve(i,u=>s(n??t,"TAG_RESOLVE_FAILED",u),e.options);c=De.isScalar(d)?d:new ba.Scalar(d)}catch(d){let u=d instanceof Error?d.message:String(d);s(n??t,"TAG_RESOLVE_FAILED",u),c=new ba.Scalar(i)}return c.range=a,c.source=i,r&&(c.type=r),l&&(c.tag=l),f.format&&(c.format=f.format),o&&(c.comment=o),c}function Fd(e,t,n,s,i){if(n==="!")return e[De.SCALAR];let r=[];for(let a of e.tags)if(!a.collection&&a.tag===n)if(a.default&&a.test)r.push(a);else return a;for(let a of r)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):(i(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),e[De.SCALAR])}function Dd({atKey:e,directives:t,schema:n},s,i,r){let o=n.tags.find(a=>(a.default===!0||e&&a.default==="key")&&a.test?.test(s))||n[De.SCALAR];if(n.compat){let a=n.compat.find(l=>l.default&&l.test?.test(s))??n[De.SCALAR];if(o.tag!==a.tag){let l=t.tagString(o.tag),f=t.tagString(a.tag),c=`Value may be parsed as either ${l} or ${f}`;r(i,"TAG_RESOLVE_FAILED",c,!0)}}return o}wa.composeScalar=Rd});var Sa=C($a=>{"use strict";function jd(e,t,n){if(t){n??(n=t.length);for(let s=n-1;s>=0;--s){let i=t[s];switch(i.type){case"space":case"comment":case"newline":e-=i.source.length;continue}for(i=t[++s];i?.type==="space";)e+=i.source.length,i=t[++s];break}}return e}$a.emptyScalarPosition=jd});var Aa=C(qi=>{"use strict";var _d=dt(),Bd=K(),Kd=ha(),va=ka(),Ud=Xe(),Yd=Sa(),zd={composeNode:Oa,composeEmptyNode:Ti};function Oa(e,t,n,s){let i=e.atKey,{spaceBefore:r,comment:o,anchor:a,tag:l}=n,f,c=!0;switch(t.type){case"alias":f=Wd(e,t,s),(a||l)&&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=va.composeScalar(e,t,l,s),a&&(f.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{f=Kd.composeCollection(zd,e,t,n,s),a&&(f.anchor=a.source.substring(1))}catch(d){let u=d instanceof Error?d.message:String(d);s(t,"RESOURCE_EXHAUSTION",u)}break;default:{let d=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;s(t,"UNEXPECTED_TOKEN",d),c=!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"),i&&e.options.stringKeys&&(!Bd.isScalar(f)||typeof f.value!="string"||f.tag&&f.tag!=="tag:yaml.org,2002:str")&&s(l??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),r&&(f.spaceBefore=!0),o&&(t.type==="scalar"&&t.source===""?f.comment=o:f.commentBefore=o),e.options.keepSourceTokens&&c&&(f.srcToken=t),f}function Ti(e,t,n,s,{spaceBefore:i,comment:r,anchor:o,tag:a,end:l},f){let c={type:"scalar",offset:Yd.emptyScalarPosition(t,n,s),indent:-1,source:""},d=va.composeScalar(e,c,a,f);return o&&(d.anchor=o.source.substring(1),d.anchor===""&&f(o,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(d.spaceBefore=!0),r&&(d.comment=r,d.range[2]=l),d}function Wd({options:e},{offset:t,source:n,end:s},i){let r=new _d.Alias(n.substring(1));r.source===""&&i(t,"BAD_ALIAS","Alias cannot be an empty string"),r.source.endsWith(":")&&i(t+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=t+n.length,a=Ud.resolveEnd(s,o,e.strict,i);return r.range=[t,o,a.offset],a.comment&&(r.comment=a.comment),r}qi.composeEmptyNode=Ti;qi.composeNode=Oa});var xa=C(Ea=>{"use strict";var Vd=xt(),Na=Aa(),Jd=Xe(),Gd=Mt();function Hd(e,t,{offset:n,start:s,value:i,end:r},o){let a=Object.assign({_directives:t},e),l=new Vd.Document(void 0,a),f={atKey:!1,atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},c=Gd.resolveProps(s,{indicator:"doc-start",next:i??r?.[0],offset:n,onError:o,parentIndent:0,startOnNewline:!0});c.found&&(l.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!c.hasNewline&&o(c.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),l.contents=i?Na.composeNode(f,i,c,o):Na.composeEmptyNode(f,c.end,s,null,c,o);let d=l.contents.range[2],u=Jd.resolveEnd(r,d,!1,o);return u.comment&&(l.comment=u.comment),l.range=[n,d,u.offset],l}Ea.composeDoc=Hd});var Pi=C(qa=>{"use strict";var Xd=Ht("process"),Qd=bs(),Zd=xt(),Pt=qt(),Ca=K(),ep=xa(),tp=Xe();function Lt(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 Ta(e){let t="",n=!1,s=!1;for(let i=0;i<e.length;++i){let r=e[i];switch(r[0]){case"#":t+=(t===""?"":s?`
|
|
100
100
|
|
|
101
101
|
`:`
|
|
102
|
-
`)+(r.substring(1)||" "),n=!0,s=!1;break;case"%":e[i+1]?.[0]!=="#"&&(i+=1),n=!1;break;default:n||(s=!0),n=!1}}return{comment:t,afterEmptyLine:s}}var
|
|
103
|
-
${s}`:s;else if(i||t.directives.docStart||!r)t.commentBefore=s;else if(
|
|
102
|
+
`)+(r.substring(1)||" "),n=!0,s=!1;break;case"%":e[i+1]?.[0]!=="#"&&(i+=1),n=!1;break;default:n||(s=!0),n=!1}}return{comment:t,afterEmptyLine:s}}var Mi=class{constructor(t={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,s,i,r)=>{let o=Lt(n);r?this.warnings.push(new Pt.YAMLWarning(o,s,i)):this.errors.push(new Pt.YAMLParseError(o,s,i))},this.directives=new Qd.Directives({version:t.version||"1.2"}),this.options=t}decorate(t,n){let{comment:s,afterEmptyLine:i}=Ta(this.prelude);if(s){let r=t.contents;if(n)t.comment=t.comment?`${t.comment}
|
|
103
|
+
${s}`:s;else if(i||t.directives.docStart||!r)t.commentBefore=s;else if(Ca.isCollection(r)&&!r.flow&&r.items.length>0){let o=r.items[0];Ca.isPair(o)&&(o=o.key);let a=o.commentBefore;o.commentBefore=a?`${s}
|
|
104
104
|
${a}`:s}else{let o=r.commentBefore;r.commentBefore=o?`${s}
|
|
105
|
-
${o}`:s}}if(n){for(let r=0;r<this.errors.length;++r)t.errors.push(this.errors[r]);for(let r=0;r<this.warnings.length;++r)t.warnings.push(this.warnings[r])}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
|
|
107
|
-
`}];switch(a[0]){case"|":case">":{let
|
|
108
|
-
`),
|
|
109
|
-
`,u=[{type:"block-scalar-header",offset:r,indent:s,source:
|
|
110
|
-
`}),{type:"block-scalar",offset:r,indent:s,props:u,source:
|
|
105
|
+
${o}`:s}}if(n){for(let r=0;r<this.errors.length;++r)t.errors.push(this.errors[r]);for(let r=0;r<this.warnings.length;++r)t.warnings.push(this.warnings[r])}else t.errors=this.errors,t.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Ta(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(t,n=!1,s=-1){for(let i of t)yield*this.next(i);yield*this.end(n,s)}*next(t){switch(Xd.env.LOG_STREAM&&console.dir(t,{depth:null}),t.type){case"directive":this.directives.add(t.source,(n,s,i)=>{let r=Lt(t);r[0]+=n,this.onError(r,"BAD_DIRECTIVE",s,i)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{let n=ep.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 Pt.YAMLParseError(Lt(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 Pt.YAMLParseError(Lt(t),"UNEXPECTED_TOKEN",s));break}this.doc.directives.docEnd=!0;let n=tp.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 Pt.YAMLParseError(Lt(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),i=new Zd.Document(void 0,s);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,n,n],this.decorate(i,!1),yield i}}};qa.Composer=Mi});var La=C(Un=>{"use strict";var np=Ei(),sp=Ci(),ip=qt(),Ma=yt();function rp(e,t=!0,n){if(e){let s=(i,r,o)=>{let a=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(n)n(a,r,o);else throw new ip.YAMLParseError([a,a+1],r,o)};switch(e.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return sp.resolveFlowScalar(e,t,s);case"block-scalar":return np.resolveBlockScalar({options:{strict:t}},e,s)}}return null}function op(e,t){let{implicitKey:n=!1,indent:s,inFlow:i=!1,offset:r=-1,type:o="PLAIN"}=t,a=Ma.stringifyString({type:o,value:e},{implicitKey:n,indent:s>0?" ".repeat(s):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),l=t.end??[{type:"newline",offset:-1,indent:s,source:`
|
|
107
|
+
`}];switch(a[0]){case"|":case">":{let f=a.indexOf(`
|
|
108
|
+
`),c=a.substring(0,f),d=a.substring(f+1)+`
|
|
109
|
+
`,u=[{type:"block-scalar-header",offset:r,indent:s,source:c}];return Pa(u,l)||u.push({type:"newline",offset:-1,indent:s,source:`
|
|
110
|
+
`}),{type:"block-scalar",offset:r,indent:s,props:u,source:d}}case'"':return{type:"double-quoted-scalar",offset:r,indent:s,source:a,end:l};case"'":return{type:"single-quoted-scalar",offset:r,indent:s,source:a,end:l};default:return{type:"scalar",offset:r,indent:s,source:a,end:l}}}function ap(e,t,n={}){let{afterKey:s=!1,implicitKey:i=!1,inFlow:r=!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 l=Ma.stringifyString({type:o,value:t},{implicitKey:i||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:r,options:{blockQuote:!0,lineWidth:-1}});switch(l[0]){case"|":case">":lp(e,l);break;case'"':Li(e,l,"double-quoted-scalar");break;case"'":Li(e,l,"single-quoted-scalar");break;default:Li(e,l,"scalar")}}function lp(e,t){let n=t.indexOf(`
|
|
111
111
|
`),s=t.substring(0,n),i=t.substring(n+1)+`
|
|
112
|
-
`;if(e.type==="block-scalar"){let r=e.props[0];if(r.type!=="block-scalar-header")throw new Error("Invalid block scalar header");r.source=s,e.source=i}else{let{offset:r}=e,o="indent"in e?e.indent:-1,a=[{type:"block-scalar-header",offset:r,indent:o,source:s}];
|
|
113
|
-
`});for(let
|
|
114
|
-
`};delete e.items,Object.assign(e,{type:n,source:t,end:[i]});break}default:{let s="indent"in e?e.indent:-1,i="end"in e&&Array.isArray(e.end)?e.end.filter(r=>r.type==="space"||r.type==="comment"||r.type==="newline"):[];for(let r of Object.keys(e))r!=="type"&&r!=="offset"&&delete e[r];Object.assign(e,{type:n,indent:s,source:t,end:i})}}}
|
|
112
|
+
`;if(e.type==="block-scalar"){let r=e.props[0];if(r.type!=="block-scalar-header")throw new Error("Invalid block scalar header");r.source=s,e.source=i}else{let{offset:r}=e,o="indent"in e?e.indent:-1,a=[{type:"block-scalar-header",offset:r,indent:o,source:s}];Pa(a,"end"in e?e.end:void 0)||a.push({type:"newline",offset:-1,indent:o,source:`
|
|
113
|
+
`});for(let l of Object.keys(e))l!=="type"&&l!=="offset"&&delete e[l];Object.assign(e,{type:"block-scalar",indent:o,props:a,source:i})}}function Pa(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 Li(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),i=t.length;e.props[0].type==="block-scalar-header"&&(i-=e.props[0].source.length);for(let r of s)r.offset+=i;delete e.props,Object.assign(e,{type:n,source:t,end:s});break}case"block-map":case"block-seq":{let i={type:"newline",offset:e.offset+t.length,indent:e.indent,source:`
|
|
114
|
+
`};delete e.items,Object.assign(e,{type:n,source:t,end:[i]});break}default:{let s="indent"in e?e.indent:-1,i="end"in e&&Array.isArray(e.end)?e.end.filter(r=>r.type==="space"||r.type==="comment"||r.type==="newline"):[];for(let r of Object.keys(e))r!=="type"&&r!=="offset"&&delete e[r];Object.assign(e,{type:n,indent:s,source:t,end:i})}}}Un.createScalarToken=op;Un.resolveAsScalar=rp;Un.setScalarValue=ap});var Ra=C(Ia=>{"use strict";var cp=e=>"type"in e?zn(e):Yn(e);function zn(e){switch(e.type){case"block-scalar":{let t="";for(let n of e.props)t+=zn(n);return t+e.source}case"block-map":case"block-seq":{let t="";for(let n of e.items)t+=Yn(n);return t}case"flow-collection":{let t=e.start.source;for(let n of e.items)t+=Yn(n);for(let n of e.end)t+=n.source;return t}case"document":{let t=Yn(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 Yn({start:e,key:t,sep:n,value:s}){let i="";for(let r of e)i+=r.source;if(t&&(i+=zn(t)),n)for(let r of n)i+=r.source;return s&&(i+=zn(s)),i}Ia.stringify=cp});var _a=C(ja=>{"use strict";var Ii=Symbol("break visit"),fp=Symbol("skip children"),Fa=Symbol("remove item");function je(e,t){"type"in e&&e.type==="document"&&(e={start:e.start,value:e.value}),Da(Object.freeze([]),e,t)}je.BREAK=Ii;je.SKIP=fp;je.REMOVE=Fa;je.itemAtPath=(e,t)=>{let n=e;for(let[s,i]of t){let r=n?.[s];if(r&&"items"in r)n=r.items[i];else return}return n};je.parentCollection=(e,t)=>{let n=je.itemAtPath(e,t.slice(0,-1)),s=t[t.length-1][0],i=n?.[s];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function Da(e,t,n){let s=n(t,e);if(typeof s=="symbol")return s;for(let i of["key","value"]){let r=t[i];if(r&&"items"in r){for(let o=0;o<r.items.length;++o){let a=Da(Object.freeze(e.concat([[i,o]])),r.items[o],n);if(typeof a=="number")o=a-1;else{if(a===Ii)return Ii;a===Fa&&(r.items.splice(o,1),o-=1)}}typeof s=="function"&&i==="key"&&(s=s(t,e))}}return typeof s=="function"?s(t,e):s}ja.visit=je});var Wn=C(oe=>{"use strict";var Ri=La(),up=Ra(),dp=_a(),Fi="\uFEFF",Di="",ji="",_i="",pp=e=>!!e&&"items"in e,hp=e=>!!e&&(e.type==="scalar"||e.type==="single-quoted-scalar"||e.type==="double-quoted-scalar"||e.type==="block-scalar");function mp(e){switch(e){case Fi:return"<BOM>";case Di:return"<DOC>";case ji:return"<FLOW_END>";case _i:return"<SCALAR>";default:return JSON.stringify(e)}}function gp(e){switch(e){case Fi:return"byte-order-mark";case Di:return"doc-mode";case ji:return"flow-error-end";case _i: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}
|
|
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}oe.createScalarToken=Ri.createScalarToken;oe.resolveAsScalar=Ri.resolveAsScalar;oe.setScalarValue=Ri.setScalarValue;oe.stringify=up.stringify;oe.visit=dp.visit;oe.BOM=Fi;oe.DOCUMENT=Di;oe.FLOW_END=ji;oe.SCALAR=_i;oe.isCollection=pp;oe.isScalar=hp;oe.prettyToken=mp;oe.tokenType=gp});var Ui=C(Ka=>{"use strict";var It=Wn();function de(e){switch(e){case void 0:case" ":case`
|
|
117
|
+
`:case"\r":case" ":return!0;default:return!1}}var Ba=new Set("0123456789ABCDEFabcdef"),yp=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Vn=new Set(",[]{}"),bp=new Set(` ,[]{}
|
|
118
|
+
\r `),Bi=e=>!e||bp.has(e),Ki=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 i=this.buffer[s+t+1];if(i===`
|
|
121
121
|
`||!i&&!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]===
|
|
122
|
+
`||s>=this.indentNext||!n&&!this.atEnd?t+s:-1}if(n==="-"||n==="."){let s=this.buffer.substr(t,3);if((s==="---"||s==="...")&&de(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]===It.BOM&&(yield*this.pushCount(1),t=t.substring(1)),t[0]==="%"){let n=t.length,s=t.indexOf("#");for(;s!==-1;){let r=t[s-1];if(r===" "||r===" "){n=s-1;break}else s=t.indexOf("#",s+1)}for(;;){let r=t[n-1];if(r===" "||r===" ")n-=1;else break}let i=(yield*this.pushCount(n))+(yield*this.pushSpaces(!0));return yield*this.pushCount(t.length-i),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 It.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==="...")&&de(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&&!de(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===":")&&de(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(Bi),"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 i=this.getLine();if(i===null)return this.setNext("flow");if((s!==-1&&s<this.indentNext&&i[0]!=="#"||s===0&&(i.startsWith("---")||i.startsWith("..."))&&de(i[3]))&&!(s===this.indentNext-1&&this.flowLevel===1&&(i[0]==="]"||i[0]==="}")))return this.flowLevel=0,yield It.FLOW_END,yield*this.parseLineStart();let r=0;for(;i[r]===",";)r+=yield*this.pushCount(1),r+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(r+=yield*this.pushIndicators(),i[r]){case void 0:return"flow";case"#":return yield*this.pushCount(i.length-r),"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(Bi),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||de(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 r=0;for(;this.buffer[n-1-r]==="\\";)r+=1;if(r%2===0)break;n=this.buffer.indexOf('"',n+1)}let s=this.buffer.substring(0,n),i=s.indexOf(`
|
|
124
124
|
`,this.pos);if(i!==-1){for(;i!==-1;){let r=this.continueScalar(i+1);if(r===-1)break;i=s.indexOf(`
|
|
125
|
-
`,r)}i!==-1&&(n=i-(s[i-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
|
+
`,r)}i!==-1&&(n=i-(s[i-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=>de(n)||n==="#")}*parseBlockScalar(){let t=this.pos-1,n=0,s;e:for(let r=this.pos;s=this.buffer[r];++r)switch(s){case" ":n+=1;break;case`
|
|
126
126
|
`:t=r,n=0;break;case"\r":{let o=this.buffer[r+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 r=this.continueScalar(t+1);if(r===-1)break;t=this.buffer.indexOf(`
|
|
128
128
|
`,r)}while(t!==-1);if(t===-1){if(!this.atEnd)return this.setNext("block-scalar");t=this.buffer.length}}let i=t+1;for(s=this.buffer[i];s===" ";)s=this.buffer[++i];if(s===" "){for(;s===" "||s===" "||s==="\r"||s===`
|
|
129
129
|
`;)s=this.buffer[++i];t=i-1}else if(!this.blockScalarKeep)do{let r=t-1,o=this.buffer[r];o==="\r"&&(o=this.buffer[--r]);let a=r;for(;o===" ";)o=this.buffer[--r];if(o===`
|
|
130
|
-
`&&r>=this.pos&&r+1+n>a)t=r;else break}while(!0);return yield
|
|
130
|
+
`&&r>=this.pos&&r+1+n>a)t=r;else break}while(!0);return yield It.SCALAR,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let t=this.flowLevel>0,n=this.pos-1,s=this.pos-1,i;for(;i=this.buffer[++s];)if(i===":"){let r=this.buffer[s+1];if(de(r)||t&&Vn.has(r))break;n=s}else if(de(i)){let r=this.buffer[s+1];if(i==="\r"&&(r===`
|
|
131
131
|
`?(s+=1,i=`
|
|
132
|
-
`,r=this.buffer[s+1]):n=s),r==="#"||t&&
|
|
133
|
-
`){let o=this.continueScalar(s+1);if(o===-1)break;s=Math.max(s,o-2)}}else{if(t&&
|
|
132
|
+
`,r=this.buffer[s+1]):n=s),r==="#"||t&&Vn.has(r))break;if(i===`
|
|
133
|
+
`){let o=this.continueScalar(s+1);if(o===-1)break;s=Math.max(s,o-2)}}else{if(t&&Vn.has(i))break;n=s}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield It.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(Bi),t+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let n=this.flowLevel>0,s=this.charAt(1);if(de(s)||n&&Vn.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(;!de(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(yp.has(n))n=this.buffer[++t];else if(n==="%"&&Ba.has(this.buffer[t+1])&&Ba.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 i=n-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=n),i}*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 i=n-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=n),i}*pushUntil(t){let n=this.pos,s=this.buffer[n];for(;!t(s);)s=this.buffer[++n];return yield*this.pushToIndex(n,!1)}};Ka.Lexer=Ki});var zi=C(Ua=>{"use strict";var Yi=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 r=n+s>>1;this.lineStarts[r]<t?n=r+1:s=r}if(this.lineStarts[n]===t)return{line:n+1,col:1};if(n===0)return{line:0,col:t};let i=this.lineStarts[n-1];return{line:n,col:t-i+1}}}};Ua.LineCounter=Yi});var Vi=C(Ja=>{"use strict";var wp=Ht("process"),Ya=Wn(),kp=Ui();function qe(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function za(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 Va(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 Jn(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 Qe(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 Gn(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 Wa(e){if(e.start.type==="flow-seq-start")for(let t of e.items)t.sep&&!t.value&&!qe(t.start,"explicit-key-ind")&&!qe(t.sep,"map-value-ind")&&(t.key&&(t.value=t.key),delete t.key,Va(t.value)?t.value.end?Gn(t.value.end,t.sep):t.value.end=t.sep:Gn(t.start,t.sep),delete t.sep)}var Wi=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 kp.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,wp.env.LOG_TOKENS&&console.log("|",Ya.prettyToken(t)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=t.length;return}let n=Ya.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"&&Wa(n),s.type){case"document":s.value=n;break;case"block-scalar":s.props.push(n);break;case"block-map":{let i=s.items[s.items.length-1];if(i.value){s.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=n;else{Object.assign(i,{key:n,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{let i=s.items[s.items.length-1];i.value?s.items.push({start:[],value:n}):i.value=n;break}case"flow-collection":{let i=s.items[s.items.length-1];!i||i.value?s.items.push({start:[],key:n,sep:[]}):i.sep?i.value=n:Object.assign(i,{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 i=n.items[n.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&za(i.start)===-1&&(n.indent===0||i.start.every(r=>r.type!=="comment"||r.indent<n.indent))&&(s.type==="document"?s.end=i.start:s.items.push({start:i.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":{za(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=Jn(this.peek(2)),s=Qe(n),i;t.end?(i=t.end,i.push(this.sourceToken),delete t.end):i=[this.sourceToken];let r={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:s,key:t,sep:i}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=r}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 i=t.items[t.items.length-2]?.value?.end;if(Array.isArray(i)){
|
|
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 i=t.items[t.items.length-2]?.value?.end;if(Array.isArray(i)){Gn(i,n.start),i.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,i=s&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind",r=[];if(i&&n.sep&&!n.value){let o=[];for(let a=0;a<n.sep.length;++a){let l=n.sep[a];switch(l.type){case"newline":o.push(a);break;case"space":break;case"comment":l.indent>t.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(r=n.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":i||n.value?(r.push(this.sourceToken),t.items.push({start:r}),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):i||n.value?(r.push(this.sourceToken),t.items.push({start:r,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(qe(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]});else if(Va(n.key)&&!qe(n.sep,"newline")){let o=Qe(n.start),a=n.key,l=n.sep;l.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:l}]})}else r.length>0?n.sep=n.sep.concat(r,this.sourceToken):n.sep.push(this.sourceToken);else if(qe(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{let o=Qe(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||i?t.items.push({start:r,key:null,sep:[this.sourceToken]}):qe(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);i||n.value?(t.items.push({start:r,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&&!qe(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:r});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 i=t.items[t.items.length-2]?.value?.end;if(Array.isArray(i)){Gn(i,n.start),i.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||qe(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 i=this.flowScalar(this.type);!n||n.value?t.items.push({start:[],key:i,sep:[]}):n.sep?this.stack.push(i):Object.assign(n,{key:i,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 i=Jn(s),r=Qe(i);Wa(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:r,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
|
-
`),s=n.findIndex(i=>new RegExp(`^\\s*${t}:`).test(i));return s<0?1:/:\s*[|>][-+]?\s*$/.test(n[s])?s+2:s+1}var Tp=new Set(["LogCustomTelemetryEvent","CSATQuestion","SearchAndSummarizeContent","SearchKnowledgeSources"]);function qp(e,t,n){let s={id:e,facts:{},children:[],unknown:[],names:{},texts:[]},i=[],r=new Map,o=[],a=c=>Xe(c,"/").replace(/(\.topic)?\.mcs\.ya?ml$|\.ya?ml$/,"");for(let c of[...t].sort((l,d)=>l.path.localeCompare(d.path))){if(!/\.ya?ml$/.test(c.path)){s.unknown.push({file:c.path,why:"file"});continue}let l=Np(c.text);if(l==="yaml"||l==="empty"){s.unknown.push({file:c.path,why:l});continue}let d=W(l.data),f=/^agents\/([^/]+)\//.exec(c.path)?.[1],u=s.facts;if(f){let h=s.children.find(k=>k.name===f);h||s.children.push(h={name:f,facts:{}}),u=h.facts}let p=(h,k,x=u)=>(x[h]??=[]).push({file:c.path,line:l.lineOf(k??d)});if(f&&p(`child:${f}`,d,s.facts),!f&&/^settings\.mcs\.ya?ml$/.test(c.path)&&d){s.schemaName=B(d.schemaName)??s.schemaName,s.displayName=B(d.displayName)??s.displayName,B(d.authenticationMode)&&p(`auth:${d.authenticationMode}`);let h=W(d.configuration),k=W(h?.settings)?.GenerativeActionsEnabled;typeof k=="boolean"&&p(`setting:generative=${k?"on":"off"}`,h),h?.isAgentConnectable===!0&&p("setting:connectable",h);continue}let y=n?[...Mt(d)].map(h=>h.kind).find(h=>!n.has(h)):void 0;if(y&&s.unknown.push({file:c.path,why:"kind",kind:y}),typeof d?.kind!="string"){y||s.unknown.push({file:c.path,why:"kind"});continue}let g=c.text,w=(h,k,x)=>{f||!B(x)||Ep.test(Xe(c.path,"/"))||s.texts.push({source:h,file:c.path,line:Cp(g,k),text:x.trimEnd().slice(0,xp)})},N=(h,k)=>{B(h)&&(p("instructions:present",k),/\b(Today|Now)\(\)/.test(h)&&p("ms:date-context",k))};switch(d.kind){case"GptComponentMetadata":{s.displayName??=B(d.displayName),N(d.instructions,d),w("instructions","instructions",d.instructions),w("instructions","responseInstructions",d.responseInstructions);let h=W(d.aISettings),k=O=>O===!0?"on":"off";typeof h?.useModelKnowledge=="boolean"&&p(`setting:model-knowledge=${k(h.useModelKnowledge)}`,h),B(h?.contentModeration)&&p(`setting:moderation=${h.contentModeration.toLowerCase()}`,h),typeof h?.isSemanticSearchEnabled=="boolean"&&p(`setting:semantic-search=${k(h.isSemanticSearchEnabled)}`,h);let x=W(d.gptCapabilities);typeof x?.webBrowsing=="boolean"&&p(`setting:web-browsing=${k(x.webBrowsing)}`,x);let S=W(W(d.aISettings)?.model);B(S?.modelNameHint)&&p(`model:${S.modelNameHint}`,S);break}case"AgentDialog":{let h=W(d.beginDialog);B(h?.kind)&&p(`trigger:${h.kind}`,h),N(W(d.settings)?.instructions,d.settings);break}case"AdaptiveDialog":{let h=W(d.beginDialog),k=B(h?.kind);k&&p(`trigger:${k}`,h),k&&r.set(`${f??""}/${a(c.path)}`,k),B(d.modelDescription)&&p("topics:with-model-description"),w("descriptions","modelDescription",d.modelDescription);let x=Bi(d.inputs).some(S=>W(S)?.kind==="AutomaticTaskInput"&&W(S)?.shouldPromptUser===!1);k==="OnRecognizedIntent"&&x&&p("ms:orchestrator-variables",h),k==="OnError"&&g.includes("System.Error.SubCode")&&p("ms:rai-error-handling",h),k==="OnKnowledgeRequested"&&[...Mt(h)].some(S=>S.kind==="SendActivity")&&p("ms:knowledge-hold-message",h),k==="OnGeneratedResponse"&&g.includes("System.ContinueResponse")&&p("ms:prevent-tool-call-leaks",h);break}case"TaskDialog":{let h=W(d.action);w("descriptions","modelDescription",d.modelDescription);let k=B(h?.connectionReference);if(h?.kind==="InvokeConnectorTaskAction"&&k&&(p(`connector:${Pt(k)}`,h),B(h.operationId)&&p(`operation:${Pt(k)}/${h.operationId}`,h)),h?.kind==="InvokeExternalAgentTaskAction"&&W(h.operationDetails)?.kind==="ModelContextProtocolMetadata"&&k&&p(`mcp:${Pt(k)}`,h),h?.kind==="InvokeConnectedAgentTaskAction"&&B(h.botSchemaName)&&p(`calls:${h.botSchemaName}`,h),h?.kind==="InvokeFlowTaskAction"&&B(h.flowId)){p(`flow:${h.flowId}`,h);let x=B(d.modelDisplayName)??B(W(d["mcs.metadata"])?.componentName);x&&(s.names[h.flowId]??=x)}break}case"KnowledgeSourceConfiguration":{let h=W(d.source);B(h?.kind)&&p(`knowledge:${h.kind}`,h),h&&"triggerCondition"in h&&p("yaml-only:triggerCondition",h),i.push({file:c.path,line:l.lineOf(d)});break}case"GlobalVariableComponent":{let h=W(d.variable)??d,k=B(h.name)??(B(d.schemaName)?Xe(d.schemaName,"."):void 0);if(!k)break;p(`var:${k}`),h.isExternalInitializationAllowed===!0&&p(`var-in:${k}`);break}case"ConnectionReferencesSourceFile":for(let h of Bi(d.connectionReferences).map(W)){let k=B(h?.connectorId)?Xe(h.connectorId,"/"):B(h?.connectionReferenceLogicalName)?Pt(h.connectionReferenceLogicalName):void 0;k&&p(`connref:${k}`,h),k&&B(h?.displayName)&&(s.names[k]=h.displayName)}break}for(let h of Mt(d)){if(Tp.has(h.kind)&&p(`node:${h.kind}`,h),h.kind==="InvokeConnectorAction"&&B(h.connectionReference)){let x=Pt(h.connectionReference);p(`connector:${x}`,h),B(h.operationId)&&p(`operation:${x}/${h.operationId}`,h)}if(h.kind==="InvokeFlowAction"&&B(h.flowId)&&p(`flow:${h.flowId}`,h),(h.kind==="BeginDialog"||h.kind==="ReplaceDialog")&&B(h.dialog)){let x=h.dialog;x.startsWith("=")?x.includes("Switch(")&&p("ms:dynamic-topic-redirect",h):o.push({topic:`${f??""}/${Xe(x,".topic.")}`,into:u,at:{file:c.path,line:l.lineOf(h)}})}let k=x=>typeof x=="string"&&x.includes("System.Activity.ChannelId");(h.kind==="ConditionGroup"&&Bi(h.conditions).some(x=>k(W(x)?.condition))||h.kind==="SetVariable"&&k(h.value))&&p("ms:channel-aware-behavior",h),(h.kind==="SendActivity"||h.kind==="Question")&&JSON.stringify(h).includes("<br")&&p("ms:line-breaks-in-messages",h)}}i.length&&(s.facts[`knowledge:count=${i.length}`]=i);for(let c of o){let l=r.get(c.topic);(c.into[l?`reaches:${l}`:`calls:topic:${Xe(c.topic,"/")}`]??=[]).push(c.at)}for(let c of[s.facts,...s.children.map(l=>l.facts)])for(let[l,d]of Object.entries(c))c[l]=d.filter((f,u)=>d.findIndex(p=>p.file===f.file&&p.line===f.line)===u);return s}function Pp(e){let t=new Set,n=i=>{if(!i||typeof i!="object")return;let{const:r,enum:o}=i;if(typeof r=="string"&&t.add(r),Array.isArray(o))for(let a of o)typeof a=="string"&&t.add(a)},s=i=>{if(Array.isArray(i))return i.forEach(s);if(!i||typeof i!="object")return;let r=i;n(r.kind),n(r.properties?.kind);for(let o of Object.values(r))s(o)};for(let i of Object.values(e.definitions??{}))s(i);return t}var He=rs(zn(),1);function Vn(e,t){let n=new He.LineCounter,s=(0,He.parseDocument)(e,{lineCounter:n,prettyErrors:!1}),i=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 r=s.toJS();return!r||typeof r!="object"||Array.isArray(r)||r.format!==t||!(0,He.isMap)(s.contents)?{ok:!1,problem:{line:i(["format"]),key:"format"}}:{ok:!0,format:{raw:r,doc:s,at:i,lineOf:o=>n.linePos(o).line}}}var Wn=[{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"}},Jn={"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"},"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"]}},"declared:owner":{dim:"declared",en:"Owner declared",pt:"Dono declarado",lacks:{en:["has no owner declared","have no owner declared"],pt:["n\xE3o tem dono declarado","n\xE3o t\xEAm dono declarado"]}}},Mp=Object.fromEntries(Wn.map(e=>[e.id,e.name])),Lp=[["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:"]],Ja=e=>Lp.find(([t])=>e.startsWith(t)),Ga=e=>!!Jn[e]?.lacks;function Lt(e){return e.startsWith("reaches:")?Lt(`trigger:${e.slice(8)}`):Jn[e]?.dim??Ja(e)?.[1]??"governance"}var Te=(e,t)=>t.endsWith("*")?e.startsWith(t.slice(0,-1)):e===t,Qe=e=>e.startsWith("reaches:")?`trigger:${e.slice(8)}`:void 0,Wa=(e,t)=>t?.[e]??e;function ae(e,t,n){let s=Jn[e];if(s)return s[t];if(e.startsWith("text:block:")){let a=e.endsWith("~variant"),c=a?e.slice(0,-8):e,l=n?.[c]??c.slice(11);return a?`${l} (${t==="pt"?"varia\xE7\xE3o":"variation"})`:l}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],l=n?.[`text:${a}`]??a;return c===void 0?l:`${l} = ${c}`}if(e.startsWith("reaches:")){let a=ae(`trigger:${e.slice(8)}`,t);return t==="pt"?`Um t\xF3pico leva a \xAB${a}\xBB`:`A topic leads to \xAB${a}\xBB`}let i=/^knowledge:count=(\d+)$/.exec(e);if(i){let a=Number(i[1]);return t==="pt"?`${a} ${a===1?"fonte":"fontes"} de conhecimento`:`${a} knowledge ${a===1?"source":"sources"}`}let r=Ja(e);if(!r)return e;let o=e.slice(r[0].length);if(r[0]==="ms:"&&(o=Mp[o]??o),r[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:"].includes(r[0])&&(o=Wa(o,n)),r[0]==="operation:"){let[a,c]=[o.slice(0,o.indexOf("/")),o.slice(o.indexOf("/")+1)];o=`${Wa(a,n)} \xB7 ${c}`}return`${r[t==="pt"?3:2]} ${o}`}function Gn(e,t,n,s){let i=Jn[e]?.lacks?.[t];if(i)return i[n===1?0:1];if(e.startsWith("reaches:")){let o=ae(`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("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 r=ae(e,t,s);return t==="pt"?`${n===1?"n\xE3o tem":"n\xE3o t\xEAm"} \xAB${r}\xBB`:`${n===1?"does":"do"} not have \xAB${r}\xBB`}var Xa="cast-list/profile-v1",Yi=["orchestrator","specialist"],Ui={roles:{},threshold:.7,minAgents:3,rules:[],markers:[],blocks:[],types:[],focusAreas:[],ignore:[],microsoftPatterns:!0},Ip=["format","name","roles","threshold","min_agents","rules","markers","blocks","types","focus_areas","ignore","microsoft_patterns"],Rp=["instructions","descriptions","all"],Dp=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"]),Fp=e=>Dp.has(e.split(":")[0]),De=e=>!!e&&typeof e=="object"&&!Array.isArray(e),Y=e=>typeof e=="string"?e.trim():typeof e=="number"?String(e):"",Xn=e=>Array.isArray(e)?e.map(Y).filter(Boolean):Y(e)?[Y(e)]:[],Ha=e=>Yi.includes(e);function jp(e){let t=Vn(e,Xa);if(!t.ok)return{problems:[t.problem.key==="format"?{...t.problem,format:Xa}:t.problem]};let{raw:n,at:s}=t.format,i=[];for(let S of Object.keys(n))Ip.includes(S)||i.push({line:s([S]),key:"unknownKey",what:S});let r=(S,O,q)=>(Y(S)||i.push({line:s(q),key:"missing",what:O}),Y(S)),o=(S,O)=>{let q=new Set;O.forEach((E,I)=>{E&&q.has(E)&&i.push({line:s([S,I]),key:"duplicate",what:S,id:E}),q.add(E)})},a=S=>Array.isArray(n[S])?n[S]:[],c=n.threshold===void 0?Ui.threshold:Number(n.threshold);c>0&&c<=1||i.push({line:s(["threshold"]),key:"threshold",value:Y(n.threshold)});let l=n.min_agents===void 0?Ui.minAgents:Number(n.min_agents);Number.isInteger(l)&&l>=1||i.push({line:s(["min_agents"]),key:"minAgents",value:Y(n.min_agents)});let d={},f=De(n.roles)?n.roles:{};for(let S of Object.keys(f))Ha(S)?d[S]=Y(f[S])==="*"?"*":Xn(f[S]):i.push({line:s(["roles",S]),key:"role",what:`roles.${S}`,value:S});let u=(S,O,q)=>(Ha(Y(S))||i.push({line:s(q),key:"role",what:O,value:Y(S)}),Y(S)),p=(S,O,q)=>{let E=Xn(S);for(let I of E)Fp(I)||i.push({line:s(q),key:"prefix",what:O,value:I});return E},y=a("rules").filter(De).map((S,O)=>{let q=`rules[${O}]`,E=p(S.has,q,["rules",O])[0],I=p(S.not,q,["rules",O])[0],b=p(S.when,q,["rules",O]);return!E&&!I&&i.push({line:s(["rules",O]),key:"rule",what:q}),{id:r(S.id,`${q}.id`,["rules",O]),...S.role!==void 0?{role:u(S.role,`${q}.role`,["rules",O,"role"])}:{},...b.length?{when:b}:{},...E?{has:E}:{},...I?{not:I}:{},says:Y(S.says)||E||`not ${I}`}});o("rules",y.map(S=>S.id));let g=a("markers").filter(De).map((S,O)=>{let q=`markers[${O}]`,E=r(S.pattern,`${q}.pattern`,["markers",O]);try{E&&new RegExp(E,"i")}catch(m){i.push({line:s(["markers",O]),key:"regex",what:`${q}.pattern`,detail:m.message.replace(/^Invalid regular expression: /,"")})}let I=Y(S.in)||"instructions";Rp.includes(I)||i.push({line:s(["markers",O]),key:"in",what:`${q}.in`,value:I});let b=r(S.id,`${q}.id`,["markers",O]);return{id:b,name:Y(S.name)||b,in:I,pattern:E,...Y(S.value)?{value:Y(S.value)}:{}}});o("markers",g.map(S=>S.id));let w=a("blocks").filter(De).map((S,O)=>{let q=r(S.id,`blocks[${O}].id`,["blocks",O]);return{id:q,name:Y(S.name)||q,text:r(S.text,`blocks[${O}].text`,["blocks",O]),role:S.role!==void 0?u(S.role,`blocks[${O}].role`,["blocks",O,"role"]):"specialist"}});o("blocks",w.map(S=>S.id));let N=a("types").filter(De).map((S,O)=>{let q=`types[${O}]`,E=De(S.when)?S.when:{},I=Object.fromEntries(["all","any","none"].filter(v=>E[v]!==void 0).map(v=>[v,p(E[v],q,["types",O])]));!I.all?.length&&!I.any?.length&&i.push({line:s(["types",O]),key:"when",what:q});let b=S.min_agents===void 0?2:Number(S.min_agents);Number.isInteger(b)&&b>=1||i.push({line:s(["types",O,"min_agents"]),key:"minAgents",value:Y(S.min_agents)});let m=r(S.id,`${q}.id`,["types",O]);return{id:m,name:Y(S.name)||m,when:I,minAgents:b}});o("types",N.map(S=>S.id));let h=a("focus_areas").filter(De).map((S,O)=>{let q=Xn(S.facts);q.length||i.push({line:s(["focus_areas",O]),key:"missing",what:`focus_areas[${O}].facts`});let E=r(S.id,`focus_areas[${O}].id`,["focus_areas",O]);return{id:E,name:Y(S.name)||E,facts:q}});o("focus_areas",h.map(S=>S.id));let k=n.microsoft_patterns,x={...Y(n.name)?{name:Y(n.name)}:{},roles:d,threshold:c,minAgents:l,rules:y,markers:g,blocks:w,types:N,focusAreas:h,ignore:Xn(n.ignore),microsoftPatterns:!(k===!1||Y(k).toLowerCase()==="off")};return i.length?{problems:i}:{profile:x,problems:i}}var _p=e=>Object.keys(e.facts).some(t=>t.startsWith("calls:")&&!t.startsWith("calls:topic:"));function Qa(e,t,n={}){let{orchestrator:s,specialist:i}=t.roles,r=(l,d)=>Array.isArray(l)&&l.includes(d),o=Object.fromEntries(e.map(l=>[l.id,r(s,l.id)?"orchestrator":r(i,l.id)?"specialist":n[l.id]??(s==="*"?"orchestrator":i==="*"?"specialist":_p(l)?"orchestrator":"specialist")])),a=new Set(e.map(l=>l.id)),c=[s,i].flatMap(l=>Array.isArray(l)?l:[]).filter(l=>!a.has(l));return{roles:o,unmatched:c}}function Za(e,t,n,s){let i=(r,o)=>Object.keys(r).some(a=>Te(a,o));return Object.fromEntries(e.map(r=>{if(t[r.id]!=="specialist")return[r.id,[]];if(s[r.id]?.length)return[r.id,s[r.id]];let o=n.types.filter(({when:a})=>(a.all??[]).every(c=>i(r.facts,c))&&(!a.any?.length||a.any.some(c=>i(r.facts,c)))&&!(a.none??[]).some(c=>i(r.facts,c)));return[r.id,o.map(a=>a.id)]}))}var he=rs(zn());var It="cast-list/cast-v1",Bp=["accepted","rejected"],Kp=["platform","specialist","orchestrator"],Up=e=>Kp.includes(e)||/^type:[\w-]+$/.test(e),Yp=["format","name","agents","blocks","declared","decisions"],zp=e=>!!e&&typeof e=="object"&&!Array.isArray(e),H=e=>typeof e=="string"?e.trim():typeof e=="number"||typeof e=="boolean"?String(e):"";function Vp(e){let t=Vn(e,It);if(!t.ok)return{problems:[t.problem.key==="format"?{...t.problem,format:It}:t.problem]};let{raw:n,at:s}=t.format,i=[];for(let u of Object.keys(n))Yp.includes(u)||i.push({line:s([u]),key:"unknownKey",what:u});let r=u=>(Array.isArray(n[u])?n[u]:[]).filter(zp),o=(u,p,y)=>(H(u)||i.push({line:s(y),key:"missing",what:p}),H(u)),a=(u,p)=>{let y=new Set;p.forEach((g,w)=>{g&&y.has(g)&&i.push({line:s([u,w]),key:"duplicate",what:u,id:g}),y.add(g)})},c=r("agents").map((u,p)=>{let y=H(u.role);Yi.includes(y)||i.push({line:s(["agents",p,"role"]),key:"role",what:`agents[${p}].role`,value:y});let g=Array.isArray(u.types)?u.types.map(H).filter(Boolean):[];return{id:o(u.id,`agents[${p}].id`,["agents",p]),role:y,...g.length?{types:g}:{}}}),l=r("blocks").map((u,p)=>({id:o(u.id,`blocks[${p}].id`,["blocks",p]),text:o(u.text,`blocks[${p}].text`,["blocks",p])}));a("blocks",l.map(u=>u.id)),a("agents",c.map(u=>u.id));let d=r("declared").map((u,p)=>({agent:o(u.agent,`declared[${p}].agent`,["declared",p]),key:o(u.key,`declared[${p}].key`,["declared",p]),value:H(u.value),source:H(u.source)}));a("declared",d.map(u=>`${u.agent} ${u.key}`));let f=r("decisions").map((u,p)=>{let y=H(u.status),g=H(u.scope);return Bp.includes(y)||i.push({line:s(["decisions",p,"status"]),key:"status",value:y}),Up(g)||i.push({line:s(["decisions",p,"scope"]),key:"scope",value:g}),{key:o(u.key,`decisions[${p}].key`,["decisions",p]),status:y,scope:g,why:H(u.why)}});return a("decisions",f.map(u=>u.key)),i.length?{problems:i}:{cast:{...H(n.name)?{name:H(n.name)}:{},agents:c,blocks:l,declared:d,decisions:f},problems:i}}var Wp=` What people said about the agents, and what was decided. build.mjs keeps it up to date; edit it, or fill the
|
|
141
|
-
workbook's \xABDeclared\xBB sheet and the \xABDecision\xBB column and read it back with --from.`,Jp={agents:e=>H(e.id),blocks:e=>H(e.id),declared:e=>`${H(e.agent)} ${H(e.key)}`,decisions:e=>H(e.key)},Gp=e=>Object.fromEntries(Object.entries(e).filter(([,t])=>t!==""&&t!==void 0));function Xp(e,t){let n=t?(0,he.parseDocument)(t):void 0,s=n&&!n.errors.length&&(0,he.isMap)(n.contents)?n:new he.Document({format:It});s!==n&&(s.commentBefore=Wp),s.get("format")!==It&&s.set("format",It),e.name===void 0?s.delete("name"):s.get("name")!==e.name&&s.set("name",e.name);for(let[i,r]of Object.entries(Jp)){let o=e[i];if(!o.length){s.delete(i);continue}let a=s.get(i,!0);if((0,he.isSeq)(a)||s.set(i,a=s.createNode([])),!(0,he.isSeq)(a))continue;let c=new Map(a.items.filter(he.isMap).map(l=>[r(l.toJSON()),l]));a.items=o.map(l=>{let d=Gp(l),f=c.get(r(d));if(!f){let u=s.createNode(d);return u.flow=i!=="blocks",u}for(let[u,p]of Object.entries(d))JSON.stringify(f.toJSON()[u])!==JSON.stringify(p)&&f.set(u,p);for(let u of Object.keys(f.toJSON()))u in d||f.delete(u);return f})}return s.toString({lineWidth:0,flowCollectionPadding:!0})}function Hp(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 el(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 i=Array.from({length:n.length+1},()=>new Uint16Array(s.length+1));for(let l=n.length-1;l>=0;l--)for(let d=s.length-1;d>=0;d--)i[l][d]=n[l]===s[d]?i[l+1][d+1]+1:Math.max(i[l+1][d],i[l][d+1]);let r=[],o=(l,d)=>{let f=r[r.length-1];f?.op===l?f.text+=` ${d}`:r.push({op:l,text:d})},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||i[a][c+1]>=i[a+1][c])?o("add",s[c++]):o("del",n[a++]);for(let l=0;l+1<r.length;l++)r[l].op==="add"&&r[l+1].op==="del"&&([r[l],r[l+1]]=[r[l+1],r[l]]);return r}var tl=.85,zi=.5,Qp=8,Vi=5;function Zp(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 eh=e=>{if(e.length<=Vi)return new Set([e.join(" ")]);let t=new Set;for(let n=0;n+Vi<=e.length;n++)t.add(e.slice(n,n+Vi).join(" "));return t},il=(e,t)=>{let n=0;for(let s of e)t.has(s)&&n++;return n},nl=(e,t)=>{let n=il(e,t);return n/(e.size+t.size-n||1)},Hn=(e,t)=>il(e,t)/(Math.min(e.size,t.size)||1);var Wi=(e,t,n,s)=>{let i=Zp(e);return{agent:s,file:t,line:n,text:e,words:i,shingles:eh(i)}};function th(e,t){let n=[],s=-1,i=e.text.split(`
|
|
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=Jn(t),s=Qe(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=Jn(t),s=Qe(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())}}};Ja.Parser=Wi});var Za=C(Ft=>{"use strict";var Ga=Pi(),$p=xt(),Rt=qt(),Sp=qs(),vp=K(),Op=zi(),Ha=Vi();function Xa(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new Op.LineCounter||null,prettyErrors:t}}function Ap(e,t={}){let{lineCounter:n,prettyErrors:s}=Xa(t),i=new Ha.Parser(n?.addNewLine),r=new Ga.Composer(t),o=Array.from(r.compose(i.parse(e)));if(s&&n)for(let a of o)a.errors.forEach(Rt.prettifyError(e,n)),a.warnings.forEach(Rt.prettifyError(e,n));return o.length>0?o:Object.assign([],{empty:!0},r.streamInfo())}function Qa(e,t={}){let{lineCounter:n,prettyErrors:s}=Xa(t),i=new Ha.Parser(n?.addNewLine),r=new Ga.Composer(t),o=null;for(let a of r.compose(i.parse(e),!0,e.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new Rt.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return s&&n&&(o.errors.forEach(Rt.prettifyError(e,n)),o.warnings.forEach(Rt.prettifyError(e,n))),o}function Np(e,t,n){let s;typeof t=="function"?s=t:n===void 0&&t&&typeof t=="object"&&(n=t);let i=Qa(e,n);if(!i)return null;if(i.warnings.forEach(r=>Sp.warn(i.options.logLevel,r)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:s},n))}function Ep(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 i=Math.round(n);n=i<1?void 0:i>8?{indent:8}:{indent:i}}if(e===void 0){let{keepUndefined:i}=n??t??{};if(!i)return}return vp.isDocument(e)&&!s?e.toString(n):new $p.Document(e,s,n).toString(n)}Ft.parse=Np;Ft.parseAllDocuments=Ap;Ft.parseDocument=Qa;Ft.stringify=Ep});var Xn=C(U=>{"use strict";var xp=Pi(),Cp=xt(),Tp=pi(),Ji=qt(),qp=dt(),Me=K(),Mp=Ee(),Pp=G(),Lp=Ce(),Ip=Te(),Rp=Wn(),Fp=Ui(),Dp=zi(),jp=Vi(),Hn=Za(),el=lt();U.Composer=xp.Composer;U.Document=Cp.Document;U.Schema=Tp.Schema;U.YAMLError=Ji.YAMLError;U.YAMLParseError=Ji.YAMLParseError;U.YAMLWarning=Ji.YAMLWarning;U.Alias=qp.Alias;U.isAlias=Me.isAlias;U.isCollection=Me.isCollection;U.isDocument=Me.isDocument;U.isMap=Me.isMap;U.isNode=Me.isNode;U.isPair=Me.isPair;U.isScalar=Me.isScalar;U.isSeq=Me.isSeq;U.Pair=Mp.Pair;U.Scalar=Pp.Scalar;U.YAMLMap=Lp.YAMLMap;U.YAMLSeq=Ip.YAMLSeq;U.CST=Rp;U.Lexer=Fp.Lexer;U.LineCounter=Dp.LineCounter;U.Parser=jp.Parser;U.parse=Hn.parse;U.parseAllDocuments=Hn.parseAllDocuments;U.parseDocument=Hn.parseDocument;U.stringify=Hn.stringify;U.visit=el.visit;U.visitAsync=el.visitAsync});import{readdirSync as sc,readFileSync as ic}from"node:fs";import{basename as rc,join as ps}from"node:path";var oc=/^agent\.mcs\.ya?ml$/,ac=/\.ya?ml$/,lc=/(^|\/)workflows\/.+\.json$/,lr=e=>sc(e,{withFileTypes:!0}).filter(t=>!t.name.startsWith(".")&&t.name!=="node_modules");function cr(e,t=""){return lr(e).flatMap(n=>{let s=t?`${t}/${n.name}`:n.name;return n.isDirectory()?cr(ps(e,n.name),s):n.isFile()?[{path:s,text:ac.test(n.name)||lc.test(s)?ic(ps(e,n.name),"utf8"):""}]:[]})}function fr(e){let t=lr(e);return t.some(n=>n.isFile()&&oc.test(n.name))?[{id:rc(e),dir:e,files:cr(e)}]:t.filter(n=>n.isDirectory()).flatMap(n=>fr(ps(e,n.name)))}var se=e=>e&&typeof e=="object"&&!Array.isArray(e)?e:void 0,Xt=e=>typeof e=="string"&&e.trim()?e:void 0;function cc(e){let t=se(se(se(e)?.properties)?.definition)??se(se(e)?.definition);return t&&(se(t.actions)||se(t.triggers))?t:void 0}function*at(e){for(let[t,n]of Object.entries(se(e)??{})){let s=se(n);if(s){yield[t,s],yield*at(s.actions),yield*at(se(s.else)?.actions);for(let i of Object.values(se(s.cases)??{}))yield*at(se(i)?.actions);yield*at(se(s.default)?.actions)}}}var fc=e=>/^https?:\/\/([^/?#:@]+)/i.exec(e)?.[1]?.toLowerCase(),uc=e=>e.slice(e.lastIndexOf("/")+1);function ur(e){let t=cc(e);if(!t)return;let n={uses:[]},s=(i,r)=>n.uses.some(o=>o.key===i)||n.uses.push({key:i,action:r});for(let[i,r]of at(t.actions)){let o=se(r.inputs),a=se(o?.host);switch(r.type){case"OpenApiConnection":case"OpenApiConnectionWebhook":{let l=Xt(a?.apiId)?uc(a.apiId):Xt(a?.connectionName);if(!l)break;s(`connector:${l}`,i),Xt(a?.operationId)&&s(`operation:${l}/${a.operationId}`,i);break}case"Http":{let l=Xt(o?.uri)&&fc(o.uri);l&&s(`http:${l}`,i);break}case"Workflow":s("child-flow",i);break;case"Response":n.returns??=i;break}}return n}function hs(e,t){let n=e.indexOf(`${JSON.stringify(t)}:`);return n<0?1:e.slice(0,n).split(`
|
|
140
|
+
`).length}var pe=ds(Xn()),W=e=>e&&typeof e=="object"&&!Array.isArray(e)?e:void 0,_=e=>typeof e=="string"&&e.trim()?e:void 0,Dt=e=>Array.isArray(e)?e:[];function tl(e){if(!e.trim())return"empty";let t=new pe.LineCounter,n=(0,pe.parseDocument)(e,{lineCounter:t,uniqueKeys:!1});if(n.errors.length)return"yaml";let s=new WeakMap,i=o=>{if((0,pe.isMap)(o)){let a={};o.range&&s.set(a,o.range[0]);for(let l of o.items)a[String((0,pe.isScalar)(l.key)?l.key.value:l.key)]=i(l.value);return a}return(0,pe.isSeq)(o)?o.items.map(i):(0,pe.isScalar)(o)?o.value:o},r=i(n.contents);return r==null?"empty":{data:r,lineOf:o=>o&&typeof o=="object"&&s.has(o)?t.linePos(s.get(o)).line:void 0}}function*et(e,t=!1){if(Array.isArray(e))for(let s of e)yield*et(s,t);let n=W(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*et(s,t)}}var jt=e=>e.split(".")[1]??e,Ze=(e,t)=>e.slice(e.lastIndexOf(t)+(e.includes(t)?t.length:0)),_p=/(^|[\s._-])(copy|c[oó]pia|new|test|teste)([\s._-]|$)|\.[a-z]{2}-[A-Z]{2}(\.topic)?\.mcs\.ya?ml$/i,Bp=5e4;function Kp(e,t){let n=e.split(`
|
|
141
|
+
`),s=n.findIndex(i=>new RegExp(`^\\s*${t}:`).test(i));return s<0?1:/:\s*[|>][-+]?\s*$/.test(n[s])?s+2:s+1}var Up=new Set(["LogCustomTelemetryEvent","CSATQuestion","SearchAndSummarizeContent","SearchKnowledgeSources"]),Yp={topics:"topic",actions:"action",knowledge:"knowledge",variables:"variable"},zp=/^workflows\/([^/]+)\/(.+)$/;function Wp(e,t,n){let s={id:e,facts:{},children:[],unknown:[],names:{},texts:[],contract:[],flows:[]},i=[],r=new Map,o=[],a=h=>Ze(h,"/").replace(/(\.topic)?\.mcs\.ya?ml$|\.ya?ml$/,""),l=[],f=[],c=[],d=new Map;for(let h of[...t].sort((b,m)=>b.path.localeCompare(m.path))){let b=zp.exec(h.path);if(b&&(/\.json$/.test(h.path)||/^metadata\.ya?ml$/.test(b[2]))){let g=d.get(b[1])??{json:{}};if(d.set(b[1],g),/\.json$/.test(h.path)){try{g.json[b[2]]={file:h.path,text:h.text,data:JSON.parse(h.text)}}catch{s.unknown.push({file:h.path,why:"json"})}continue}let E=tl(h.text);E==="yaml"||E==="empty"?s.unknown.push({file:h.path,why:E}):[g.meta,g.metaFile]=[W(E.data),h.path];continue}if(!/\.ya?ml$/.test(h.path)){s.unknown.push({file:h.path,why:"file"});continue}let m=tl(h.text);if(m==="yaml"||m==="empty"){s.unknown.push({file:h.path,why:m});continue}let y=W(m.data),O=/^agents\/([^/]+)\//.exec(h.path)?.[1],v=s.facts;if(O){let g=s.children.find(E=>E.name===O);g||s.children.push(g={name:O,facts:{}}),v=g.facts}let S=(g,E,L=v)=>(L[g]??=[]).push({file:h.path,line:m.lineOf(E??y)});if(O&&S(`child:${O}`,y,s.facts),!O&&/^settings\.mcs\.ya?ml$/.test(h.path)&&y){s.schemaName=_(y.schemaName)??s.schemaName,s.displayName=_(y.displayName)??s.displayName,_(y.authenticationMode)&&S(`auth:${y.authenticationMode}`);let g=W(y.configuration),E=W(g?.settings)?.GenerativeActionsEnabled;typeof E=="boolean"&&S(`setting:generative=${E?"on":"off"}`,g),g?.isAgentConnectable===!0&&S("setting:connectable",g);continue}let M=n?[...et(y)].map(g=>g.kind).find(g=>!n.has(g)):void 0;if(M&&s.unknown.push({file:h.path,why:"kind",kind:M}),typeof y?.kind!="string"){M||s.unknown.push({file:h.path,why:"kind"});continue}if(y.state==="Inactive"||y.status==="Inactive"){S(`disabled:${Yp[h.path.split("/")[O?2:0]]??"component"}:${a(h.path)}`);continue}let $=h.text,N=(g,E,L)=>{O||!_(L)||_p.test(Ze(h.path,"/"))||s.texts.push({source:g,file:h.path,line:Kp($,E),text:L.trimEnd().slice(0,Bp)})},q=(g,E)=>{_(g)&&(S("instructions:present",E),/\b(Today|Now)\(\)/.test(g)&&S("ms:date-context",E))};switch(y.kind){case"GptComponentMetadata":{s.displayName??=_(y.displayName),q(y.instructions,y),N("instructions","instructions",y.instructions),N("instructions","responseInstructions",y.responseInstructions);let g=W(y.aISettings),E=F=>F===!0?"on":"off";typeof g?.useModelKnowledge=="boolean"&&S(`setting:model-knowledge=${E(g.useModelKnowledge)}`,g),_(g?.contentModeration)&&S(`setting:moderation=${g.contentModeration.toLowerCase()}`,g),typeof g?.isSemanticSearchEnabled=="boolean"&&S(`setting:semantic-search=${E(g.isSemanticSearchEnabled)}`,g);let L=W(y.gptCapabilities);typeof L?.webBrowsing=="boolean"&&S(`setting:web-browsing=${E(L.webBrowsing)}`,L);let Y=W(W(y.aISettings)?.model);_(Y?.modelNameHint)&&S(`model:${Y.modelNameHint}`,Y);break}case"AgentDialog":{let g=W(y.beginDialog);_(g?.kind)&&S(`trigger:${g.kind}`,g),q(W(y.settings)?.instructions,y.settings);break}case"AdaptiveDialog":{let g=W(y.beginDialog),E=_(g?.kind);E&&S(`trigger:${E}`,g),E&&r.set(`${O??""}/${a(h.path)}`,E),_(y.modelDescription)&&S("topics:with-model-description");let L=Dt(W(g?.intent)?.triggerQueries).length;!O&&E==="OnRecognizedIntent"&&!_(y.modelDescription)&&!L&&f.push({kind:"topic",name:a(h.path),at:{file:h.path,line:m.lineOf(y)}}),N("descriptions","modelDescription",y.modelDescription);let Y=Dt(y.inputs).some(F=>W(F)?.kind==="AutomaticTaskInput"&&W(F)?.shouldPromptUser===!1);E==="OnRecognizedIntent"&&Y&&S("ms:orchestrator-variables",g),E==="OnError"&&$.includes("System.Error.SubCode")&&S("ms:rai-error-handling",g),E==="OnKnowledgeRequested"&&[...et(g)].some(F=>F.kind==="SendActivity")&&S("ms:knowledge-hold-message",g),E==="OnGeneratedResponse"&&$.includes("System.ContinueResponse")&&S("ms:prevent-tool-call-leaks",g);break}case"TaskDialog":{let g=W(y.action);N("descriptions","modelDescription",y.modelDescription),!O&&!_(y.modelDescription)&&f.push({kind:"action",name:a(h.path),at:{file:h.path,line:m.lineOf(y)}});let E=_(g?.connectionReference);if(g?.kind==="InvokeConnectorTaskAction"&&E&&(S(`connector:${jt(E)}`,g),_(g.operationId)&&S(`operation:${jt(E)}/${g.operationId}`,g)),g?.kind==="InvokeExternalAgentTaskAction"&&W(g.operationDetails)?.kind==="ModelContextProtocolMetadata"&&E&&S(`mcp:${jt(E)}`,g),g?.kind==="InvokeConnectedAgentTaskAction"&&_(g.botSchemaName)&&(S(`calls:${g.botSchemaName}`,g),O||s.contract.push({calls:g.botSchemaName,..._(y.modelDisplayName)?{name:y.modelDisplayName}:{},history:W(g.historyType)?.kind==="ConversationHistory",inputs:Dt(y.inputs).map(L=>_(W(L)?.propertyName)).filter(L=>!!L),description:_(y.modelDescription)?.trim()??"",file:h.path,line:m.lineOf(g)})),g?.kind==="InvokeFlowTaskAction"&&_(g.flowId)){S(`flow:${g.flowId}`,g);let L=_(y.modelDisplayName)??_(W(y["mcs.metadata"])?.componentName);L&&(s.names[g.flowId]??=L)}break}case"KnowledgeSourceConfiguration":{let g=W(y.source);_(g?.kind)&&S(`knowledge:${g.kind}`,g),g&&"triggerCondition"in g&&S("yaml-only:triggerCondition",g),i.push({file:h.path,line:m.lineOf(y)});break}case"GlobalVariableComponent":{let g=W(y.variable)??y,E=_(g.name)??(_(y.schemaName)?Ze(y.schemaName,"."):void 0);if(!E)break;S(`var:${E}`),g.isExternalInitializationAllowed===!0&&S(`var-in:${E}`),O||c.push({name:E,at:{file:h.path,line:m.lineOf(y)}});break}case"ConnectionReferencesSourceFile":for(let g of Dt(y.connectionReferences).map(W)){let E=_(g?.connectorId)?Ze(g.connectorId,"/"):_(g?.connectionReferenceLogicalName)?jt(g.connectionReferenceLogicalName):void 0;E&&S(`connref:${E}`,g),E&&_(g?.displayName)&&(s.names[E]=g.displayName)}break}for(let g of et(y,!0))S(`disabled:node:${g.kind}`,g);for(let g of et(y)){if(Up.has(g.kind)&&S(`node:${g.kind}`,g),g.kind==="InvokeConnectorAction"&&_(g.connectionReference)){let L=jt(g.connectionReference);S(`connector:${L}`,g),_(g.operationId)&&S(`operation:${L}/${g.operationId}`,g)}if(g.kind==="InvokeFlowAction"&&_(g.flowId)&&S(`flow:${g.flowId}`,g),(g.kind==="BeginDialog"||g.kind==="ReplaceDialog")&&_(g.dialog)){let L=g.dialog;l.push(L),L.startsWith("=")?L.includes("Switch(")&&S("ms:dynamic-topic-redirect",g):o.push({topic:`${O??""}/${Ze(L,".topic.")}`,into:v,at:{file:h.path,line:m.lineOf(g)}})}let E=L=>typeof L=="string"&&L.includes("System.Activity.ChannelId");(g.kind==="ConditionGroup"&&Dt(g.conditions).some(L=>E(W(L)?.condition))||g.kind==="SetVariable"&&E(g.value))&&S("ms:channel-aware-behavior",g),(g.kind==="SendActivity"||g.kind==="Question")&&JSON.stringify(g).includes("<br")&&S("ms:line-breaks-in-messages",g)}}i.length&&(s.facts[`knowledge:count=${i.length}`]=i);let u=new Set([s.facts,...s.children.map(h=>h.facts)].flatMap(h=>Object.keys(h)).filter(h=>h.startsWith("flow:")).map(h=>h.slice(5)));for(let[h,{meta:b,metaFile:m,json:y}]of[...d].sort(([O],[v])=>O.localeCompare(v))){let O=_(b?.jsonFileName)??Object.keys(y)[0],v=O?y[O]:void 0,S=_(b?.workflowId),M=h.replace(/-[0-9a-f]{6,}$/i,"");if(!v){m&&s.unknown.push({file:m,why:"flow"});continue}let $=ur(v.data);if(!$||!S){s.unknown.push({file:v.file,why:"flow"});continue}let N=_(b?.displayName)??_(W(W(v.data)?.properties)?.displayName)??M,q=u.has(S);if(s.flows.push({id:S,name:N,folder:h,uses:$.uses.map(g=>g.key),returns:!!$.returns,called:q,file:v.file}),s.names[S]??=N,!q){(s.facts[`orphan:flow:${M}`]??=[]).push({file:m??v.file,line:1}),s.names[M]??=N;continue}for(let g of $.uses)(s.facts[`flow-uses:${g.key}`]??=[]).push({file:v.file,line:hs(v.text,g.action)});$.returns&&(s.facts["flow-returns"]??=[]).push({file:v.file,line:hs(v.text,$.returns)})}for(let h of f)l.some(b=>b===h.name||b.endsWith(`.${h.name}`))||(s.facts[`orphan:${h.kind}:${h.name}`]??=[]).push(h.at);for(let h of c)t.some(m=>m.path!==h.at.file&&new RegExp(`\\bGlobal\\.${h.name}\\b`).test(m.text))||(delete s.facts[`var:${h.name}`],delete s.facts[`var-in:${h.name}`],(s.facts[`orphan:variable:${h.name}`]??=[]).push(h.at));for(let h of o){let b=r.get(h.topic);(h.into[b?`reaches:${b}`:`calls:topic:${Ze(h.topic,"/")}`]??=[]).push(h.at)}for(let h of[s.facts,...s.children.map(b=>b.facts)])for(let[b,m]of Object.entries(h))h[b]=m.filter((y,O)=>m.findIndex(v=>v.file===y.file&&v.line===y.line)===O);return s}function Vp(e){let t=new Set,n=i=>{if(!i||typeof i!="object")return;let{const:r,enum:o}=i;if(typeof r=="string"&&t.add(r),Array.isArray(o))for(let a of o)typeof a=="string"&&t.add(a)},s=i=>{if(Array.isArray(i))return i.forEach(s);if(!i||typeof i!="object")return;let r=i;n(r.kind),n(r.properties?.kind);for(let o of Object.values(r))s(o)};for(let i of Object.values(e.definitions??{}))s(i);return t}var tt=ds(Xn(),1);function Qn(e,t){let n=new tt.LineCounter,s=(0,tt.parseDocument)(e,{lineCounter:n,prettyErrors:!1}),i=o=>{for(let a=o;a.length;a=a.slice(0,-1)){let l=s.getIn(a,!0);if(l?.range)return n.linePos(l.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 r=s.toJS();return!r||typeof r!="object"||Array.isArray(r)||r.format!==t||!(0,tt.isMap)(s.contents)?{ok:!1,problem:{line:i(["format"]),key:"format"}}:{ok:!0,format:{raw:r,doc:s,at:i,lineOf:o=>n.linePos(o).line}}}var Zn=[{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 Gi={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"}},es={"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"]}},"declared:owner":{dim:"declared",en:"Owner declared",pt:"Dono declarado",lacks:{en:["has no owner declared","have no owner declared"],pt:["n\xE3o tem dono declarado","n\xE3o t\xEAm dono declarado"]}}},Jp=Object.fromEntries(Zn.map(e=>[e.id,e.name])),Gp=[["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"],["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:"]],sl=e=>Gp.find(([t])=>e.startsWith(t)),il=e=>!!es[e]?.lacks;function _t(e){return e.startsWith("reaches:")?_t(`trigger:${e.slice(8)}`):es[e]?.dim??sl(e)?.[1]??"governance"}var Pe=(e,t)=>t.endsWith("*")?e.startsWith(t.slice(0,-1)):e===t,rl=80,nt=e=>e.startsWith("reaches:")?`trigger:${e.slice(8)}`:void 0,nl=(e,t)=>t?.[e]??e;function ce(e,t,n){let s=es[e];if(s)return s[t];if(e.startsWith("text:block:")){let a=e.endsWith("~variant"),l=a?e.slice(0,-8):e,f=n?.[l]??l.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,l]=[e.slice(5).split("=")[0],e.includes("=")?e.slice(e.indexOf("=")+1):void 0],f=n?.[`text:${a}`]??a;return l===void 0?f:`${f} = ${l}`}if(e.startsWith("reaches:")){let a=ce(`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`;let i=/^knowledge:count=(\d+)$/.exec(e);if(i){let a=Number(i[1]);return t==="pt"?`${a} ${a===1?"fonte":"fontes"} de conhecimento`:`${a} knowledge ${a===1?"source":"sources"}`}let r=sl(e);if(!r)return e;let o=e.slice(r[0].length);if(r[0]==="ms:"&&(o=Jp[o]??o),r[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(r[0])&&(o=nl(o,n)),r[0]==="disabled:"&&(o=o.replace(":"," ")),r[0]==="operation:"||r[0]==="flow-uses:operation:"){let[a,l]=[o.slice(0,o.indexOf("/")),o.slice(o.indexOf("/")+1)];o=`${nl(a,n)} \xB7 ${l}`}return`${r[t==="pt"?3:2]} ${o}`}function ts(e,t,n,s){let i=es[e]?.lacks?.[t];if(i)return i[n===1?0:1];if(e.startsWith("reaches:")){let o=ce(`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("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 r=ce(e,t,s);return t==="pt"?`${n===1?"n\xE3o tem":"n\xE3o t\xEAm"} \xAB${r}\xBB`:`${n===1?"does":"do"} not have \xAB${r}\xBB`}var ol="cast-list/profile-v1",Xi=["orchestrator","specialist"],Hi={roles:{},threshold:.7,minAgents:3,rules:[],markers:[],blocks:[],types:[],focusAreas:[],ignore:[],microsoftPatterns:!0},Hp=["format","name","roles","threshold","min_agents","rules","markers","blocks","types","focus_areas","ignore","microsoft_patterns"],Xp=["instructions","descriptions","all"],Qp=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"]),Zp=e=>Qp.has(e.split(":")[0]),_e=e=>!!e&&typeof e=="object"&&!Array.isArray(e),V=e=>typeof e=="string"?e.trim():typeof e=="number"?String(e):"",ns=e=>Array.isArray(e)?e.map(V).filter(Boolean):V(e)?[V(e)]:[],al=e=>Xi.includes(e);function eh(e){let t=Qn(e,ol);if(!t.ok)return{problems:[t.problem.key==="format"?{...t.problem,format:ol}:t.problem]};let{raw:n,at:s}=t.format,i=[];for(let $ of Object.keys(n))Hp.includes($)||i.push({line:s([$]),key:"unknownKey",what:$});let r=($,N,q)=>(V($)||i.push({line:s(q),key:"missing",what:N}),V($)),o=($,N)=>{let q=new Set;N.forEach((g,E)=>{g&&q.has(g)&&i.push({line:s([$,E]),key:"duplicate",what:$,id:g}),q.add(g)})},a=$=>Array.isArray(n[$])?n[$]:[],l=n.threshold===void 0?Hi.threshold:Number(n.threshold);l>0&&l<=1||i.push({line:s(["threshold"]),key:"threshold",value:V(n.threshold)});let f=n.min_agents===void 0?Hi.minAgents:Number(n.min_agents);Number.isInteger(f)&&f>=1||i.push({line:s(["min_agents"]),key:"minAgents",value:V(n.min_agents)});let c={},d=_e(n.roles)?n.roles:{};for(let $ of Object.keys(d))al($)?c[$]=V(d[$])==="*"?"*":ns(d[$]):i.push({line:s(["roles",$]),key:"role",what:`roles.${$}`,value:$});let u=($,N,q)=>(al(V($))||i.push({line:s(q),key:"role",what:N,value:V($)}),V($)),h=($,N,q)=>{let g=ns($);for(let E of g)Zp(E)||i.push({line:s(q),key:"prefix",what:N,value:E});return g},b=a("rules").filter(_e).map(($,N)=>{let q=`rules[${N}]`,g=h($.has,q,["rules",N])[0],E=h($.not,q,["rules",N])[0],L=h($.when,q,["rules",N]);return!g&&!E&&i.push({line:s(["rules",N]),key:"rule",what:q}),{id:r($.id,`${q}.id`,["rules",N]),...$.role!==void 0?{role:u($.role,`${q}.role`,["rules",N,"role"])}:{},...L.length?{when:L}:{},...g?{has:g}:{},...E?{not:E}:{},says:V($.says)||g||`not ${E}`}});o("rules",b.map($=>$.id));let m=a("markers").filter(_e).map(($,N)=>{let q=`markers[${N}]`,g=r($.pattern,`${q}.pattern`,["markers",N]);try{g&&new RegExp(g,"i")}catch(Y){i.push({line:s(["markers",N]),key:"regex",what:`${q}.pattern`,detail:Y.message.replace(/^Invalid regular expression: /,"")})}let E=V($.in)||"instructions";Xp.includes(E)||i.push({line:s(["markers",N]),key:"in",what:`${q}.in`,value:E});let L=r($.id,`${q}.id`,["markers",N]);return{id:L,name:V($.name)||L,in:E,pattern:g,...V($.value)?{value:V($.value)}:{}}});o("markers",m.map($=>$.id));let y=a("blocks").filter(_e).map(($,N)=>{let q=r($.id,`blocks[${N}].id`,["blocks",N]);return{id:q,name:V($.name)||q,text:r($.text,`blocks[${N}].text`,["blocks",N]),role:$.role!==void 0?u($.role,`blocks[${N}].role`,["blocks",N,"role"]):"specialist"}});o("blocks",y.map($=>$.id));let O=a("types").filter(_e).map(($,N)=>{let q=`types[${N}]`,g=_e($.when)?$.when:{},E=Object.fromEntries(["all","any","none"].filter(F=>g[F]!==void 0).map(F=>[F,h(g[F],q,["types",N])]));!E.all?.length&&!E.any?.length&&i.push({line:s(["types",N]),key:"when",what:q});let L=$.min_agents===void 0?2:Number($.min_agents);Number.isInteger(L)&&L>=1||i.push({line:s(["types",N,"min_agents"]),key:"minAgents",value:V($.min_agents)});let Y=r($.id,`${q}.id`,["types",N]);return{id:Y,name:V($.name)||Y,when:E,minAgents:L}});o("types",O.map($=>$.id));let v=a("focus_areas").filter(_e).map(($,N)=>{let q=ns($.facts);q.length||i.push({line:s(["focus_areas",N]),key:"missing",what:`focus_areas[${N}].facts`});let g=r($.id,`focus_areas[${N}].id`,["focus_areas",N]);return{id:g,name:V($.name)||g,facts:q}});o("focus_areas",v.map($=>$.id));let S=n.microsoft_patterns,M={...V(n.name)?{name:V(n.name)}:{},roles:c,threshold:l,minAgents:f,rules:b,markers:m,blocks:y,types:O,focusAreas:v,ignore:ns(n.ignore),microsoftPatterns:!(S===!1||V(S).toLowerCase()==="off")};return i.length?{problems:i}:{profile:M,problems:i}}var th=e=>Object.keys(e.facts).some(t=>t.startsWith("calls:")&&!t.startsWith("calls:topic:"));function ll(e,t,n={}){let{orchestrator:s,specialist:i}=t.roles,r=(f,c)=>Array.isArray(f)&&f.includes(c),o=Object.fromEntries(e.map(f=>[f.id,r(s,f.id)?"orchestrator":r(i,f.id)?"specialist":n[f.id]??(s==="*"?"orchestrator":i==="*"?"specialist":th(f)?"orchestrator":"specialist")])),a=new Set(e.map(f=>f.id)),l=[s,i].flatMap(f=>Array.isArray(f)?f:[]).filter(f=>!a.has(f));return{roles:o,unmatched:l}}function cl(e,t,n,s){let i=(r,o)=>Object.keys(r).some(a=>Pe(a,o));return Object.fromEntries(e.map(r=>{if(t[r.id]!=="specialist")return[r.id,[]];if(s[r.id]?.length)return[r.id,s[r.id]];let o=n.types.filter(({when:a})=>(a.all??[]).every(l=>i(r.facts,l))&&(!a.any?.length||a.any.some(l=>i(r.facts,l)))&&!(a.none??[]).some(l=>i(r.facts,l)));return[r.id,o.map(a=>a.id)]}))}var ge=ds(Xn());var Bt="cast-list/cast-v1",nh=["accepted","rejected"],sh=["platform","specialist","orchestrator"],ih=e=>sh.includes(e)||/^type:[\w-]+$/.test(e),rh=["format","name","agents","blocks","declared","decisions"],oh=e=>!!e&&typeof e=="object"&&!Array.isArray(e),Z=e=>typeof e=="string"?e.trim():typeof e=="number"||typeof e=="boolean"?String(e):"";function ah(e){let t=Qn(e,Bt);if(!t.ok)return{problems:[t.problem.key==="format"?{...t.problem,format:Bt}:t.problem]};let{raw:n,at:s}=t.format,i=[];for(let u of Object.keys(n))rh.includes(u)||i.push({line:s([u]),key:"unknownKey",what:u});let r=u=>(Array.isArray(n[u])?n[u]:[]).filter(oh),o=(u,h,b)=>(Z(u)||i.push({line:s(b),key:"missing",what:h}),Z(u)),a=(u,h)=>{let b=new Set;h.forEach((m,y)=>{m&&b.has(m)&&i.push({line:s([u,y]),key:"duplicate",what:u,id:m}),b.add(m)})},l=r("agents").map((u,h)=>{let b=Z(u.role);Xi.includes(b)||i.push({line:s(["agents",h,"role"]),key:"role",what:`agents[${h}].role`,value:b});let m=Array.isArray(u.types)?u.types.map(Z).filter(Boolean):[];return{id:o(u.id,`agents[${h}].id`,["agents",h]),role:b,...m.length?{types:m}:{}}}),f=r("blocks").map((u,h)=>({id:o(u.id,`blocks[${h}].id`,["blocks",h]),text:o(u.text,`blocks[${h}].text`,["blocks",h])}));a("blocks",f.map(u=>u.id)),a("agents",l.map(u=>u.id));let c=r("declared").map((u,h)=>({agent:o(u.agent,`declared[${h}].agent`,["declared",h]),key:o(u.key,`declared[${h}].key`,["declared",h]),value:Z(u.value),source:Z(u.source)}));a("declared",c.map(u=>`${u.agent} ${u.key}`));let d=r("decisions").map((u,h)=>{let b=Z(u.status),m=Z(u.scope);return nh.includes(b)||i.push({line:s(["decisions",h,"status"]),key:"status",value:b}),ih(m)||i.push({line:s(["decisions",h,"scope"]),key:"scope",value:m}),{key:o(u.key,`decisions[${h}].key`,["decisions",h]),status:b,scope:m,why:Z(u.why)}});return a("decisions",d.map(u=>u.key)),i.length?{problems:i}:{cast:{...Z(n.name)?{name:Z(n.name)}:{},agents:l,blocks:f,declared:c,decisions:d},problems:i}}var lh=` 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.`,ch={agents:e=>Z(e.id),blocks:e=>Z(e.id),declared:e=>`${Z(e.agent)} ${Z(e.key)}`,decisions:e=>Z(e.key)},fh=e=>Object.fromEntries(Object.entries(e).filter(([,t])=>t!==""&&t!==void 0));function uh(e,t){let n=t?(0,ge.parseDocument)(t):void 0,s=n&&!n.errors.length&&(0,ge.isMap)(n.contents)?n:new ge.Document({format:Bt});s!==n&&(s.commentBefore=lh),s.get("format")!==Bt&&s.set("format",Bt),e.name===void 0?s.delete("name"):s.get("name")!==e.name&&s.set("name",e.name);for(let[i,r]of Object.entries(ch)){let o=e[i];if(!o.length){s.delete(i);continue}let a=s.get(i,!0);if((0,ge.isSeq)(a)||s.set(i,a=s.createNode([])),!(0,ge.isSeq)(a))continue;let l=new Map(a.items.filter(ge.isMap).map(f=>[r(f.toJSON()),f]));a.items=o.map(f=>{let c=fh(f),d=l.get(r(c));if(!d){let u=s.createNode(c);return u.flow=i!=="blocks",u}for(let[u,h]of Object.entries(c))JSON.stringify(d.toJSON()[u])!==JSON.stringify(h)&&d.set(u,h);for(let u of Object.keys(d.toJSON()))u in c||d.delete(u);return d})}return s.toString({lineWidth:0,flowCollectionPadding:!0})}function dh(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 fl(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 i=Array.from({length:n.length+1},()=>new Uint16Array(s.length+1));for(let f=n.length-1;f>=0;f--)for(let c=s.length-1;c>=0;c--)i[f][c]=n[f]===s[c]?i[f+1][c+1]+1:Math.max(i[f+1][c],i[f][c+1]);let r=[],o=(f,c)=>{let d=r[r.length-1];d?.op===f?d.text+=` ${c}`:r.push({op:f,text:c})},a=0,l=0;for(;a<n.length||l<s.length;)a<n.length&&l<s.length&&n[a]===s[l]?o("same",(a++,l++,n[a-1])):l<s.length&&(a===n.length||i[a][l+1]>=i[a+1][l])?o("add",s[l++]):o("del",n[a++]);for(let f=0;f+1<r.length;f++)r[f].op==="add"&&r[f+1].op==="del"&&([r[f],r[f+1]]=[r[f+1],r[f]]);return r}var ul=.85,Qi=.5,ph=8,Zi=5;function hh(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 mh=e=>{if(e.length<=Zi)return new Set([e.join(" ")]);let t=new Set;for(let n=0;n+Zi<=e.length;n++)t.add(e.slice(n,n+Zi).join(" "));return t},hl=(e,t)=>{let n=0;for(let s of e)t.has(s)&&n++;return n},dl=(e,t)=>{let n=hl(e,t);return n/(e.size+t.size-n||1)},ss=(e,t)=>hl(e,t)/(Math.min(e.size,t.size)||1);var er=(e,t,n,s)=>{let i=hh(e);return{agent:s,file:t,line:n,text:e,words:i,shingles:mh(i)}};function gh(e,t){let n=[],s=-1,i=e.text.split(`
|
|
142
143
|
`),r=o=>{if(s<0)return;let a=i.slice(s,o).join(`
|
|
143
|
-
`).trim(),c=Wi(a,e.file,e.line+s,t);c.words.length>=Qp&&n.push(c),s=-1};return i.forEach((o,a)=>{o.trim()?s<0&&(s=a):r(a)}),r(i.length),n}var nh=(e,t)=>{let n=e.filter(i=>!i.startsWith("#")).slice(0,5).join("-")||"block",s=n;for(let i=2;t.has(s);i++)s=`${n}-${i}`;return t.add(s),s},sl=e=>{let t=e.split(/\s+/).filter(Boolean);return t.slice(0,8).join(" ")+(t.length>8?"\u2026":"")};function rl(e,t,n){let s=e.flatMap(f=>f.texts.flatMap(u=>th(u,f.id))),i=[];for(let f of s){let u=i.find(p=>Hn(p[0].shingles,f.shingles)>=zi);u?u.push(f):i.push([f])}let r=n.map(f=>({...f,block:Wi(f.text,"profile",0)})),o=t.map(f=>({...f,block:Wi(f.text,"cast",0)})),a=new Set([...n.map(f=>f.id),...t.map(f=>f.id)]),c=[],l=new Set;for(let f of i){let u=r.find(h=>!l.has(h.id)&&Hn(h.block.shingles,f[0].shingles)>=zi);if(new Set(f.map(h=>h.agent)).size<2&&!u)continue;let p=h=>f.filter(k=>nl(k.shingles,h.shingles)>=tl).length,y=u?.block??f.reduce((h,k)=>p(k)>p(h)?k:h,f[0]),g=u?void 0:o.find(h=>!l.has(h.id)&&Hn(h.block.shingles,y.shingles)>=zi),w=u?.id??g?.id??nh(y.words,a);l.add(w);let N={id:w,label:sl(y.text),text:y.text,...u?{official:u.name}:{},holders:{},variants:{}};for(let h of f){let k=h.agent,x=nl(y.shingles,h.shingles)>=tl?1:Hn(y.shingles,h.shingles);x===1?(N.holders[k]??={file:h.file,line:h.line},delete N.variants[k]):!N.holders[k]&&(!N.variants[k]||x>N.variants[k].similarity)&&(N.variants[k]={source:{file:h.file,line:h.line},similarity:x,text:h.text,diff:el(y.text,h.text)})}c.push(N)}for(let f of r.filter(u=>!l.has(u.id)))c.push({id:f.id,label:sl(f.text),text:f.text,official:f.name,holders:{},variants:{}});let d=Object.fromEntries(e.map(f=>[f.id,{}]));for(let f of c){for(let[u,p]of Object.entries(f.holders))d[u][`text:block:${f.id}`]=[p];for(let[u,p]of Object.entries(f.variants))d[u][`text:block:${f.id}~variant`]=[p.source]}return{families:c,facts:d}}var sh=/https?:\/\/([^\s/)\]>"'«»]+)/gi,ih=/[\w.+-]+@[\w-]+(\.[\w-]+)+/g,rh=(e,t)=>e.line+(e.text.slice(0,t).match(/\n/g)?.length??0),oh=e=>e.toLowerCase().replace(/\s+/g," ").trim();function ol(e,t){let n={},s={};for(let i of e){let r=n[i.id]={},o=s[i.id]={},a=(c,l,d)=>(r[c]??=[]).push({file:l.file,line:rh(l,d)});for(let c of i.texts){for(let l of t.filter(d=>d.in==="all"||d.in===c.source))for(let d of c.text.matchAll(new RegExp(l.pattern,"gi"))){if(!l.value){a(`text:${l.id}`,c,d.index);continue}let f=oh(l.value.replace(/\$(\d)/g,(u,p)=>d[Number(p)]??""));f&&(a(`text:${l.id}=${f}`,c,d.index),(o[l.id]??=[]).includes(f)||o[l.id].push(f))}if(c.source==="instructions"){for(let l of c.text.matchAll(sh))a(`text:link-domain:${l[1].toLowerCase().replace(/[.,;:]+$/,"")}`,c,l.index);for(let l of c.text.matchAll(ih))a("text:email",c,l.index)}}for(let[c,l]of Object.entries(r))r[c]=l.filter((d,f)=>l.findIndex(u=>u.file===d.file&&u.line===d.line)===f)}return{facts:n,values:s}}function al(e,t,n){let s=[];for(let i of t.filter(r=>r.value)){for(let r of["specialist","orchestrator"]){let o={};for(let[a,c]of Object.entries(e))if(n[a]===r)for(let l of c[i.id]??[])(o[l]??=[]).push(a);Object.keys(o).length>1&&s.push({kind:"values",marker:i,role:r,byValue:o})}for(let[r,o]of Object.entries(e))(o[i.id]??[]).length>1&&s.push({kind:"twice",marker:i,agent:r,values:o[i.id]})}return s}var ah=/^(no|não|nao|false|off|0)$/i,lh=new Set(Wn.filter(e=>!e.sign).map(e=>`ms:${e.id}`)),ch=e=>e.includes(":")&&!e.startsWith("declared:")&&!lh.has(e),fh=e=>e.startsWith("declared:")?e:`declared:${e}`,Ji=e=>e.endsWith("~variant");function uh(e,t,n){let s=Object.fromEntries(n.agents.map(b=>[b.id,b.role])),{roles:i,unmatched:r}=Qa(e,t,s),o=b=>t.ignore.includes(b)||!t.microsoftPatterns&&b.startsWith("ms:"),a=[],c=rl(e,n.blocks,t.blocks),l=ol(e,t.markers),d=b=>({...b.facts,...c.facts[b.id],...l.facts[b.id]}),f=e.map(b=>{let m=d(b),v=Object.fromEntries(Object.entries(m).filter(([P])=>!o(P)));for(let P of n.declared.filter(U=>U.agent===b.id)){let U=!ah.test(P.value);if(ch(P.key)){let A=P.key in m;U!==A&&a.push({agent:b.id,key:P.key,declared:P.value||"yes",observed:A,source:P.source})}else U&&(v[fh(P.key)]??=[]).push({file:P.source?`declared: ${P.source}`:"declared"})}return{id:b.id,role:i[b.id],...b.schemaName?{schemaName:b.schemaName}:{},...b.displayName?{displayName:b.displayName}:{},facts:v,children:b.children}}),u=b=>f.filter(m=>m.role===b),p=(b,m=f)=>m.filter(v=>b in v.facts),y=(b,m=f)=>m.flatMap(v=>v.facts[b]??[]),g=[...new Set(f.flatMap(b=>Object.keys(b.facts)))].sort(),w=b=>n.decisions.find(m=>m.key===b),N=Za(f,i,t,Object.fromEntries(n.agents.filter(b=>b.types?.length).map(b=>[b.id,b.types]))),h=b=>b==="platform"?f:b.startsWith("type:")?f.filter(m=>N[m.id]?.includes(b.slice(5))):u(b),k=[];for(let b of["specialist","orchestrator"]){let m=u(b);if(m.length<t.minAgents)continue;let v=u(b==="specialist"?"orchestrator":"specialist");for(let P of g){if(P.startsWith("declared:")||Qe(P)||Ji(P)||k.some(_=>_.key===P))continue;let A=p(P,m).length/m.length;if(A<t.threshold)continue;let L=v.length>0&&p(P,v).length/v.length>=(v.length>=t.minAgents?t.threshold:1),F=w(P);k.push({key:P,role:b,scope:F?.scope??(L?"platform":b),share:A,agents:p(P).map(_=>_.id),sources:y(P),...F?{decision:F}:{}})}}let x=[];for(let b of t.types){let m=h(`type:${b.id}`);if(m.length){if(m.length<b.minAgents){x.push({type:b.id,agents:m.map(v=>v.id)});continue}for(let v of g){if(v.startsWith("declared:")||Qe(v)||Ji(v)||k.some(A=>A.key===v))continue;let P=p(v,m).length/m.length;if(P<t.threshold)continue;let U=w(v);k.push({key:v,role:"specialist",scope:U?.scope??`type:${b.id}`,share:P,agents:p(v).map(A=>A.id),sources:y(v),...U?{decision:U}:{}})}}}for(let b of t.blocks){let m=`text:block:${b.id}`,v=k.find(A=>A.key===m);if(v){v.official=b.name;continue}let P=u(b.role),U=w(m);k.push({key:m,role:b.role,scope:U?.scope??b.role,share:P.length?p(m,P).length/P.length:0,agents:p(m).map(A=>A.id),sources:y(m),official:b.name,...U?{decision:U}:{}})}for(let b of n.decisions.filter(m=>m.status==="accepted"&&!k.some(v=>v.key===m.key))){let m=h(b.scope),v=p(b.key,m);k.push({key:b.key,role:b.scope==="orchestrator"?"orchestrator":"specialist",scope:b.scope,share:m.length?v.length/m.length:0,agents:v.map(P=>P.id),sources:y(b.key),decision:b})}for(let b of g.filter(m=>Qe(m))){let m=k.find(A=>A.key===Qe(b));if(!m)continue;let v=h(m.scope).filter(A=>m.key in A.facts),P=v.length?p(b,v).length/v.length:0;if(P<t.threshold)continue;let U=w(b)??m.decision;k.push({key:b,role:m.role,scope:m.scope,share:P,agents:p(b).map(A=>A.id),sources:y(b),partOf:m.key,...U?{decision:U}:{}})}k.sort((b,m)=>b.scope.localeCompare(m.scope)||b.key.localeCompare(m.key));let S=k.filter(b=>b.decision?.status!=="rejected").flatMap(b=>h(b.scope).filter(m=>!(b.key in m.facts)&&(!b.partOf||b.partOf in m.facts)).map(m=>({agent:m.id,key:b.key,scope:b.scope,...b.partOf?{partOf:b.partOf}:{},...`${b.key}~variant`in m.facts?{variant:!0}:{}}))).sort((b,m)=>b.agent.localeCompare(m.agent)||b.key.localeCompare(m.key)),O=[],q=[];for(let b of g){if(b.startsWith("declared:")||Qe(b)||Ji(b))continue;let m=p(b),v={key:b,agents:m.map(P=>P.id),sources:y(b)};m.every(P=>P.role==="orchestrator")?q.push(v):m.length===1&&O.push(v)}let E=(b,m)=>Object.keys(b.facts).some(v=>Te(v,m)),I=t.rules.map(b=>({rule:b,agents:(b.role?u(b.role):f).filter(m=>(b.when??[]).every(v=>E(m,v))).filter(m=>b.has!==void 0&&!E(m,b.has)||b.not!==void 0&&E(m,b.not)).map(m=>m.id)})).filter(b=>b.agents.length);return{...t.name??n.name?{name:t.name??n.name}:{},roles:i,unmatched:r,agents:f,patterns:k,offPattern:S,solos:O,orchestratorDoes:q,gaps:I,conflicts:a,unknown:e.flatMap(b=>b.unknown.map(m=>({...m,agent:b.id}))),names:Object.assign({},...e.map(b=>b.names??{}),...e.map(b=>b.schemaName&&b.displayName?{[b.schemaName]:b.displayName}:{}),...c.families.map(b=>({[`text:block:${b.id}`]:b.official??b.label})),...t.markers.map(b=>({[`text:${b.id}`]:b.name}))),types:N,typeNames:Object.fromEntries(t.types.map(b=>[b.id,b.name])),typeNotes:x,blocks:c.families,markerFindings:al(l.values,t.markers,i)}}var dh={specialist:{en:["specialist","specialists"],pt:["especialista","especialistas"]},orchestrator:{en:["orchestrator","orchestrators"],pt:["orquestrador","orquestradores"]}},ie=(e,t,n)=>dh[e][t][n===1?0:1],Qn={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",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",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"},why_:{yaml:"YAML that does not read",empty:"empty",kind:"a kind Copilot Studio does not have",file:"not a Copilot Studio file"}},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",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",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"},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"}}};var be=e=>e.join(", "),ll=["conflict","contradiction","off","gap","values","twice","solo","type","unknown","unmatched"];function ph(e){let t=[],n=(l,d)=>ae(l,d,e.names);for(let l of e.conflicts){let d=l.source?`\xAB${l.source}\xBB`:null,[f,u]=[n(l.key,"en"),n(l.key,"pt")];t.push(l.observed?{key:"conflict",agents:[l.agent],fact:l.key,en:`${l.agent}: ${d??"what was declared"} says it does not have \xAB${f}\xBB, but the YAML has it`,pt:`${l.agent}: ${d??"o declarado"} diz que n\xE3o tem \xAB${u}\xBB, mas o YAML tem`}:{key:"conflict",agents:[l.agent],fact:l.key,en:`${l.agent}: ${d??"what was declared"} says it has \xAB${f}\xBB, but the YAML does not`,pt:`${l.agent}: ${d??"o declarado"} diz que tem \xAB${u}\xBB, mas o YAML n\xE3o tem`})}let s=(l,d)=>Object.keys(e.agents.find(f=>f.id===l)?.facts??{}).filter(f=>Te(f,d));for(let l of e.gaps.filter(d=>d.rule.not&&!d.rule.has))for(let d of[...l.agents].sort()){let f=s(d,l.rule.not)[0]??l.rule.not,u=(l.rule.when??[]).map(y=>s(d,y)[0]??y),p=y=>u.length?`\xAB${u.map(g=>n(g,y)).join(y==="pt"?"\xBB e \xAB":"\xBB and \xAB")}\xBB, ${y==="pt"?"mas tamb\xE9m":"but also"} \xAB${n(f,y)}\xBB`:`\xAB${n(f,y)}\xBB`;t.push({key:"contradiction",agents:[d],fact:f,en:`${d} has ${p("en")} (rule \xAB${l.rule.says}\xBB)`,pt:`${d} tem ${p("pt")} (regra \xAB${l.rule.says}\xBB)`})}let i=l=>l.startsWith("type:")?e.typeNames[l.slice(5)]??l.slice(5):void 0,r=new Map;for(let l of e.offPattern){let d=e.roles[l.agent],f=`${l.key} ${d} ${l.scope} ${l.variant?"v":""}`,u=r.get(f)??{key:l.key,role:d,type:i(l.scope),variant:!!l.variant,agents:[]};u.agents.push(l.agent),r.set(f,u)}for(let l of r.values()){let d=l.agents.length,f=e.patterns.find(w=>w.key===l.key),u=f?.decision?.status==="accepted",p=w=>l.type?w==="pt"?`${d} ${ie(l.role,w,d)} de ${l.type}`:`${d} ${l.type} ${ie(l.role,w,d)}`:`${d} ${ie(l.role,w,d)}`,y=!!f?.official;if(l.variant){let w=N=>N==="pt"?`do bloco${y?" oficial":""} \xAB${n(l.key,N)}\xBB`:`of the${y?" official":""} block \xAB${n(l.key,N)}\xBB`;t.push({key:"off",agents:l.agents,fact:l.key,en:`${p("en")} ${d===1?"has":"have"} a variation ${w("en")} (${be(l.agents)}): align it?`,pt:`${p("pt")} ${d===1?"tem":"t\xEAm"} uma varia\xE7\xE3o ${w("pt")} (${be(l.agents)}): alinhar?`});continue}let g=w=>`${p(w)} ${Gn(l.key,w,d,e.names)} (${be(l.agents)})`;t.push({key:"off",agents:l.agents,fact:l.key,en:u?`${g("en")}, and the pattern was accepted: correct it?`:y?`${g("en")}: add it?`:`${g("en")}: on purpose?`,pt:u?`${g("pt")}, e o padr\xE3o foi aceito: corrigir?`:y?`${g("pt")}: incluir?`:`${g("pt")}: \xE9 intencional?`})}for(let l of e.gaps.filter(d=>d.rule.has)){let d=l.agents.filter(u=>!e.offPattern.some(p=>p.agent===u&&p.key===l.rule.has)).sort(),f=d.length;f&&t.push({key:"gap",agents:d,fact:l.rule.has,en:`Rule \xAB${l.rule.says}\xBB: ${f}${l.rule.role?` ${ie(l.rule.role,"en",f)}`:""} ${f===1?"does":"do"} not meet it (${be(d)})`,pt:`Regra \xAB${l.rule.says}\xBB: ${f}${l.rule.role?` ${ie(l.rule.role,"pt",f)}`:""} n\xE3o ${f===1?"cumpre":"cumprem"} (${be(d)})`})}for(let l of e.markerFindings)if(l.kind==="values"){let d=[...new Set(Object.values(l.byValue).flat())],f=d.length,u=Object.entries(l.byValue).sort(([y,g],[w,N])=>N.length-g.length||y.localeCompare(w)).map(([y,g])=>`${y} {in} ${g.length}`),p=Object.keys(l.byValue).length;t.push({key:"values",agents:d.sort(),fact:`text:${l.marker.id}`,en:`${f} ${ie(l.role,"en",f)} set \xAB${l.marker.name}\xBB in ${p} ways (${u.join("; ").replace(/\{in\}/g,"in")}): unify?`,pt:`${f} ${ie(l.role,"pt",f)} definem \xAB${l.marker.name}\xBB de ${p} jeitos (${u.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 o=new Set(e.solos.filter(l=>/^(connector|mcp):/.test(l.key)).map(l=>`${l.agents[0]} ${l.key.slice(l.key.indexOf(":")+1)}`)),a=e.gaps.filter(l=>l.rule.not).flatMap(l=>l.agents.map(d=>({agent:d,keys:[...l.rule.when??[],l.rule.not]})));for(let l of e.solos){let d=l.agents[0],f=l.key.startsWith("connref:")?l.key.slice(8):l.key.startsWith("operation:")?l.key.slice(10).split("/")[0]:void 0;f&&o.has(`${d} ${f}`)||a.some(u=>u.agent===d&&u.keys.some(p=>Te(l.key,p)))||t.push({key:"solo",agents:[d],fact:l.key,en:`Only ${d} has \xAB${n(l.key,"en")}\xBB: innovation or debt?`,pt:`S\xF3 ${d} tem \xAB${n(l.key,"pt")}\xBB: inova\xE7\xE3o ou d\xEDvida?`})}for(let l of e.typeNotes){let d=e.typeNames[l.type]??l.type,f=l.agents.length;t.push({key:"type",agents:l.agents,en:`The type \xAB${d}\xBB has ${f} ${ie("specialist","en",f)} (${be(l.agents)}): nothing to compare in it`,pt:`O tipo \xAB${d}\xBB tem ${f} ${ie("specialist","pt",f)} (${be(l.agents)}): nada a comparar dentro dele`})}let c=new Map;for(let l of e.unknown)c.set(l.agent,[...c.get(l.agent)??[],l.file]);for(let[l,d]of c){let f=d.length;t.push({key:"unknown",agents:[l],en:`${l}: the analysis did not understand ${f} ${f===1?"file":"files"} (${be(d)})`,pt:`${l}: a an\xE1lise n\xE3o entendeu ${f} ${f===1?"arquivo":"arquivos"} (${be(d)})`})}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,d)=>ll.indexOf(l.key)-ll.indexOf(d.key))}function Rt(e){let t=i=>e.offPattern.some(r=>r.key===i.key||r.partOf===i.key),n=i=>i.share===1&&!i.decision&&!t(i),s=e.patterns.filter(i=>!i.partOf);return{look:s.filter(i=>!n(i)),everyone:s.filter(n)}}var cl=new TextEncoder,Gi=e=>e.replace(/[&<>"]/g,t=>({"&":"&","<":"<",">":">",'"':"""})[t]).replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g,""),Dt=e=>e<26?String.fromCharCode(65+e):Dt(Math.floor(e/26)-1)+String.fromCharCode(65+e%26),hh=e=>e.replace(/[:\\/?*[\]]/g," ").slice(0,31)||"Sheet";function mh(e){let t=[{}],n=u=>JSON.stringify([u.bold??!1,u.fill??"",u.color??"",u.center??!1,u.wrap??!1]),s=new Map([[n({}),0]]);for(let u of e)for(let p of u.rows)for(let y of p){if(typeof y!="object")continue;let{v:g,...w}=y,N=n(w);s.has(N)||(s.set(N,t.length),t.push(w))}let i=new Map([["|",0]]),r=new Map([["",0]]),o=u=>{let p=`${u.bold?"b":""}|${u.color??""}`;return i.has(p)||i.set(p,i.size),i.get(p)},a=u=>u.fill?(r.has(u.fill)||r.set(u.fill,r.size+1),r.get(u.fill)):0,c=t.map(u=>{let p=u.center||u.wrap?`<alignment${u.center?' horizontal="center"':""}${u.wrap?' wrapText="1"':""} vertical="top"/>`:'<alignment vertical="top"/>';return`<xf numFmtId="0" fontId="${o(u)}" fillId="${a(u)}" borderId="${u.fill||u.bold?1:0}" xfId="0" applyFont="1" applyFill="1" applyBorder="1" applyAlignment="1">${p}</xf>`}),l=[...i.keys()].map(u=>{let[p,y]=u.split("|");return`<font>${p?"<b/>":""}<sz val="11"/>${y?`<color rgb="FF${y}"/>`:""}<name val="Calibri"/><family val="2"/></font>`}),d=['<fill><patternFill patternType="none"/></fill>','<fill><patternFill patternType="gray125"/></fill>',...[...r.keys()].filter(Boolean).map(u=>`<fill><patternFill patternType="solid"><fgColor rgb="FF${u}"/><bgColor indexed="64"/></patternFill></fill>`)];return{xml:`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
144
|
+
`).trim(),l=er(a,e.file,e.line+s,t);l.words.length>=ph&&n.push(l),s=-1};return i.forEach((o,a)=>{o.trim()?s<0&&(s=a):r(a)}),r(i.length),n}var yh=(e,t)=>{let n=e.filter(i=>!i.startsWith("#")).slice(0,5).join("-")||"block",s=n;for(let i=2;t.has(s);i++)s=`${n}-${i}`;return t.add(s),s},pl=e=>{let t=e.split(/\s+/).filter(Boolean);return t.slice(0,8).join(" ")+(t.length>8?"\u2026":"")};function ml(e,t,n){let s=e.flatMap(d=>d.texts.flatMap(u=>gh(u,d.id))),i=[];for(let d of s){let u=i.find(h=>ss(h[0].shingles,d.shingles)>=Qi);u?u.push(d):i.push([d])}let r=n.map(d=>({...d,block:er(d.text,"profile",0)})),o=t.map(d=>({...d,block:er(d.text,"cast",0)})),a=new Set([...n.map(d=>d.id),...t.map(d=>d.id)]),l=[],f=new Set;for(let d of i){let u=r.find(v=>!f.has(v.id)&&ss(v.block.shingles,d[0].shingles)>=Qi);if(new Set(d.map(v=>v.agent)).size<2&&!u)continue;let h=v=>d.filter(S=>dl(S.shingles,v.shingles)>=ul).length,b=u?.block??d.reduce((v,S)=>h(S)>h(v)?S:v,d[0]),m=u?void 0:o.find(v=>!f.has(v.id)&&ss(v.block.shingles,b.shingles)>=Qi),y=u?.id??m?.id??yh(b.words,a);f.add(y);let O={id:y,label:pl(b.text),text:b.text,...u?{official:u.name}:{},holders:{},variants:{}};for(let v of d){let S=v.agent,M=dl(b.shingles,v.shingles)>=ul?1:ss(b.shingles,v.shingles);M===1?(O.holders[S]??={file:v.file,line:v.line},delete O.variants[S]):!O.holders[S]&&(!O.variants[S]||M>O.variants[S].similarity)&&(O.variants[S]={source:{file:v.file,line:v.line},similarity:M,text:v.text,diff:fl(b.text,v.text)})}l.push(O)}for(let d of r.filter(u=>!f.has(u.id)))l.push({id:d.id,label:pl(d.text),text:d.text,official:d.name,holders:{},variants:{}});let c=Object.fromEntries(e.map(d=>[d.id,{}]));for(let d of l){for(let[u,h]of Object.entries(d.holders))c[u][`text:block:${d.id}`]=[h];for(let[u,h]of Object.entries(d.variants))c[u][`text:block:${d.id}~variant`]=[h.source]}return{families:l,facts:c}}var bh=/https?:\/\/([^\s/)\]>"'«»]+)/gi,wh=/[\w.+-]+@[\w-]+(\.[\w-]+)+/g,kh=(e,t)=>e.line+(e.text.slice(0,t).match(/\n/g)?.length??0),$h=e=>e.toLowerCase().replace(/\s+/g," ").trim();function gl(e,t){let n={},s={};for(let i of e){let r=n[i.id]={},o=s[i.id]={},a=(l,f,c)=>(r[l]??=[]).push({file:f.file,line:kh(f,c)});for(let l of i.texts){for(let f of t.filter(c=>c.in==="all"||c.in===l.source))for(let c of l.text.matchAll(new RegExp(f.pattern,"gi"))){if(!f.value){a(`text:${f.id}`,l,c.index);continue}let d=$h(f.value.replace(/\$(\d)/g,(u,h)=>c[Number(h)]??""));d&&(a(`text:${f.id}=${d}`,l,c.index),(o[f.id]??=[]).includes(d)||o[f.id].push(d))}if(l.source==="instructions"){for(let f of l.text.matchAll(bh))a(`text:link-domain:${f[1].toLowerCase().replace(/[.,;:]+$/,"")}`,l,f.index);for(let f of l.text.matchAll(wh))a("text:email",l,f.index)}}for(let[l,f]of Object.entries(r))r[l]=f.filter((c,d)=>f.findIndex(u=>u.file===c.file&&u.line===c.line)===d)}return{facts:n,values:s}}function yl(e,t,n){let s=[];for(let i of t.filter(r=>r.value)){for(let r of["specialist","orchestrator"]){let o={};for(let[a,l]of Object.entries(e))if(n[a]===r)for(let f of l[i.id]??[])(o[f]??=[]).push(a);Object.keys(o).length>1&&s.push({kind:"values",marker:i,role:r,byValue:o})}for(let[r,o]of Object.entries(e))(o[i.id]??[]).length>1&&s.push({kind:"twice",marker:i,agent:r,values:o[i.id]})}return s}var Sh=/^(no|não|nao|false|off|0)$/i,vh=new Set(Zn.filter(e=>!e.sign).map(e=>`ms:${e.id}`)),Oh=e=>e.includes(":")&&!e.startsWith("declared:")&&!vh.has(e),Ah=e=>e.startsWith("declared:")?e:`declared:${e}`,tr=e=>e.endsWith("~variant"),is=e=>/^(orphan|disabled):/.test(e);function Nh(e,t,n){let s=Object.fromEntries(n.agents.map(p=>[p.id,p.role])),{roles:i,unmatched:r}=ll(e,t,s),o=p=>t.ignore.includes(p)||!t.microsoftPatterns&&p.startsWith("ms:"),a=[],l=ml(e,n.blocks,t.blocks),f=gl(e,t.markers),c=new Map(e.filter(p=>p.schemaName).map(p=>[p.schemaName,p.id])),d=e.flatMap(p=>(p.contract??[]).map(w=>({...w,caller:p.id,...c.has(w.calls)?{agent:c.get(w.calls)}:{}}))),u={};for(let p of d.filter(w=>w.agent)){let w=u[p.agent]??={},x={file:`${p.caller}/${p.file}`,line:p.line},T=j=>(w[j]??=[]).push(x);p.history&&T("called-with:history");for(let j of p.inputs)T(`called-with:input:${j}`);p.description&&T("routing:described")}let h=p=>({...p.facts,...l.facts[p.id],...f.facts[p.id],...u[p.id]}),b=e.map(p=>{let w=h(p),x=Object.fromEntries(Object.entries(w).filter(([T])=>!o(T)));for(let T of n.declared.filter(j=>j.agent===p.id)){let j=!Sh.test(T.value);if(Oh(T.key)){let D=T.key in w;j!==D&&a.push({agent:p.id,key:T.key,declared:T.value||"yes",observed:D,source:T.source})}else j&&(x[Ah(T.key)]??=[]).push({file:T.source?`declared: ${T.source}`:"declared"})}return{id:p.id,role:i[p.id],...p.schemaName?{schemaName:p.schemaName}:{},...p.displayName?{displayName:p.displayName}:{},facts:x,children:p.children}}),m=p=>b.filter(w=>w.role===p),y=(p,w=b)=>w.filter(x=>p in x.facts),O=(p,w=b)=>w.flatMap(x=>x.facts[p]??[]),v=[...new Set(b.flatMap(p=>Object.keys(p.facts)))].sort(),S=p=>n.decisions.find(w=>w.key===p),M=cl(b,i,t,Object.fromEntries(n.agents.filter(p=>p.types?.length).map(p=>[p.id,p.types]))),$=p=>p==="platform"?b:p.startsWith("type:")?b.filter(w=>M[w.id]?.includes(p.slice(5))):m(p),N=[];for(let p of["specialist","orchestrator"]){let w=m(p);if(w.length<t.minAgents)continue;let x=m(p==="specialist"?"orchestrator":"specialist");for(let T of v){if(T.startsWith("declared:")||nt(T)||tr(T)||is(T)||N.some(ot=>ot.key===T))continue;let D=y(T,w).length/w.length;if(D<t.threshold)continue;let ie=x.length>0&&y(T,x).length/x.length>=(x.length>=t.minAgents?t.threshold:1),Se=S(T);N.push({key:T,role:p,scope:Se?.scope??(ie?"platform":p),share:D,agents:y(T).map(ot=>ot.id),sources:O(T),...Se?{decision:Se}:{}})}}let q=[];for(let p of t.types){let w=$(`type:${p.id}`);if(w.length){if(w.length<p.minAgents){q.push({type:p.id,agents:w.map(x=>x.id)});continue}for(let x of v){if(x.startsWith("declared:")||nt(x)||tr(x)||is(x)||N.some(D=>D.key===x))continue;let T=y(x,w).length/w.length;if(T<t.threshold)continue;let j=S(x);N.push({key:x,role:"specialist",scope:j?.scope??`type:${p.id}`,share:T,agents:y(x).map(D=>D.id),sources:O(x),...j?{decision:j}:{}})}}}for(let p of t.blocks){let w=`text:block:${p.id}`,x=N.find(D=>D.key===w);if(x){x.official=p.name;continue}let T=m(p.role),j=S(w);N.push({key:w,role:p.role,scope:j?.scope??p.role,share:T.length?y(w,T).length/T.length:0,agents:y(w).map(D=>D.id),sources:O(w),official:p.name,...j?{decision:j}:{}})}for(let p of n.decisions.filter(w=>w.status==="accepted"&&!N.some(x=>x.key===w.key))){let w=$(p.scope),x=y(p.key,w);N.push({key:p.key,role:p.scope==="orchestrator"?"orchestrator":"specialist",scope:p.scope,share:w.length?x.length/w.length:0,agents:x.map(T=>T.id),sources:O(p.key),decision:p})}for(let p of v.filter(w=>nt(w))){let w=N.find(D=>D.key===nt(p));if(!w)continue;let x=$(w.scope).filter(D=>w.key in D.facts),T=x.length?y(p,x).length/x.length:0;if(T<t.threshold)continue;let j=S(p)??w.decision;N.push({key:p,role:w.role,scope:w.scope,share:T,agents:y(p).map(D=>D.id),sources:O(p),partOf:w.key,...j?{decision:j}:{}})}N.sort((p,w)=>p.scope.localeCompare(w.scope)||p.key.localeCompare(w.key));let g=N.filter(p=>p.decision?.status!=="rejected").flatMap(p=>$(p.scope).filter(w=>!(p.key in w.facts)&&(!p.partOf||p.partOf in w.facts)).map(w=>({agent:w.id,key:p.key,scope:p.scope,...p.partOf?{partOf:p.partOf}:{},...`${p.key}~variant`in w.facts?{variant:!0}:{}}))).sort((p,w)=>p.agent.localeCompare(w.agent)||p.key.localeCompare(w.key)),E=[],L=[];for(let p of v){if(p.startsWith("declared:")||nt(p)||tr(p)||is(p))continue;let w=y(p),x={key:p,agents:w.map(T=>T.id),sources:O(p)};w.every(T=>T.role==="orchestrator")?L.push(x):w.length===1&&E.push(x)}let Y=(p,w)=>Object.keys(p.facts).some(x=>Pe(x,w)),F=t.rules.map(p=>({rule:p,agents:(p.role?m(p.role):b).filter(w=>(p.when??[]).every(x=>Y(w,x))).filter(w=>p.has!==void 0&&!Y(w,p.has)||p.not!==void 0&&Y(w,p.not)).map(w=>w.id)})).filter(p=>p.agents.length),k=b.some(p=>p.role==="orchestrator"),I=new Set(d.map(p=>p.agent)),X=b.flatMap(p=>Object.keys(p.facts).filter(is).sort().map(w=>{let[x,T,...j]=w.split(":");return{agent:p.id,key:w,how:x,what:T,name:j.join(":"),sources:p.facts[w]}}));return{...t.name??n.name?{name:t.name??n.name}:{},roles:i,unmatched:r,agents:b,patterns:N,offPattern:g,solos:E,orchestratorDoes:L,gaps:F,conflicts:a,unknown:e.flatMap(p=>p.unknown.map(w=>({...w,agent:p.id}))),names:Object.assign({},...e.map(p=>p.names??{}),...e.map(p=>p.schemaName&&p.displayName?{[p.schemaName]:p.displayName}:{}),...l.families.map(p=>({[`text:block:${p.id}`]:p.official??p.label})),...t.markers.map(p=>({[`text:${p.id}`]:p.name}))),types:M,typeNames:Object.fromEntries(t.types.map(p=>[p.id,p.name])),typeNotes:q,blocks:l.families,markerFindings:yl(f.values,t.markers,i),contract:{routes:d,missing:d.filter(p=>!p.agent),uncalled:k?b.filter(p=>p.role==="specialist"&&!I.has(p.id)).map(p=>p.id):[],short:d.filter(p=>p.description&&p.description.length<rl)},flows:e.flatMap(p=>(p.flows??[]).map(w=>({...w,agent:p.id}))),unused:X}}var Eh={specialist:{en:["specialist","specialists"],pt:["especialista","especialistas"]},orchestrator:{en:["orchestrator","orchestrators"],pt:["orquestrador","orquestradores"]}},ae=(e,t,n)=>Eh[e][t][n===1?0:1],rs={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",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",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"}},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",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",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"}}};var ke=e=>e.join(", "),bl=["conflict","contradiction","contract","flow","off","gap","values","twice","solo","unused","type","unknown","unmatched"],wl=e=>e.replace(/(\.topic)?\.mcs\.ya?ml$/,"");function xh(e){let t=[],n=(c,d)=>ce(c,d,e.names);for(let c of e.conflicts){let d=c.source?`\xAB${c.source}\xBB`:null,[u,h]=[n(c.key,"en"),n(c.key,"pt")];t.push(c.observed?{key:"conflict",agents:[c.agent],fact:c.key,en:`${c.agent}: ${d??"what was declared"} says it does not have \xAB${u}\xBB, but the YAML has it`,pt:`${c.agent}: ${d??"o declarado"} diz que n\xE3o tem \xAB${h}\xBB, mas o YAML tem`}:{key:"conflict",agents:[c.agent],fact:c.key,en:`${c.agent}: ${d??"what was declared"} says it has \xAB${u}\xBB, but the YAML does not`,pt:`${c.agent}: ${d??"o declarado"} diz que tem \xAB${h}\xBB, mas o YAML n\xE3o tem`})}let s=(c,d)=>Object.keys(e.agents.find(u=>u.id===c)?.facts??{}).filter(u=>Pe(u,d));for(let c of e.gaps.filter(d=>d.rule.not&&!d.rule.has))for(let d of[...c.agents].sort()){let u=s(d,c.rule.not)[0]??c.rule.not,h=(c.rule.when??[]).map(m=>s(d,m)[0]??m),b=m=>h.length?`\xAB${h.map(y=>n(y,m)).join(m==="pt"?"\xBB e \xAB":"\xBB and \xAB")}\xBB, ${m==="pt"?"mas tamb\xE9m":"but also"} \xAB${n(u,m)}\xBB`:`\xAB${n(u,m)}\xBB`;t.push({key:"contradiction",agents:[d],fact:u,en:`${d} has ${b("en")} (rule \xAB${c.rule.says}\xBB)`,pt:`${d} tem ${b("pt")} (regra \xAB${c.rule.says}\xBB)`})}for(let c of e.contract.missing)t.push({key:"contract",agents:[c.caller],fact:`calls:${c.calls}`,en:`The orchestrator calls \xAB${c.name??c.calls}\xBB, which is not in the folder`,pt:`O orquestrador chama \xAB${c.name??c.calls}\xBB, que n\xE3o est\xE1 na pasta`});for(let c of e.contract.uncalled)t.push({key:"contract",agents:[c],en:`${c} is in the folder, but no orchestrator calls it`,pt:`${c} est\xE1 na pasta, mas nenhum orquestrador o chama`});for(let c of e.contract.short){let d=c.description.length;t.push({key:"contract",agents:[c.agent],fact:"routing:described",en:`The routing description of ${c.agent} has only ${d} characters`,pt:`A descri\xE7\xE3o de roteamento de ${c.agent} tem s\xF3 ${d} caracteres`})}for(let c of e.flows.filter(d=>d.called&&!d.returns))t.push({key:"flow",agents:[c.agent],fact:"flow-returns",en:`The flow \xAB${c.name}\xBB of ${c.agent} returns nothing`,pt:`O fluxo \xAB${c.name}\xBB de ${c.agent} n\xE3o devolve nada`});let i=c=>c.startsWith("type:")?e.typeNames[c.slice(5)]??c.slice(5):void 0,r=new Map;for(let c of e.offPattern){let d=e.roles[c.agent],u=`${c.key} ${d} ${c.scope} ${c.variant?"v":""}`,h=r.get(u)??{key:c.key,role:d,type:i(c.scope),variant:!!c.variant,agents:[]};h.agents.push(c.agent),r.set(u,h)}for(let c of r.values()){let d=c.agents.length,u=e.patterns.find(O=>O.key===c.key),h=u?.decision?.status==="accepted",b=O=>c.type?O==="pt"?`${d} ${ae(c.role,O,d)} de ${c.type}`:`${d} ${c.type} ${ae(c.role,O,d)}`:`${d} ${ae(c.role,O,d)}`,m=!!u?.official;if(c.variant){let O=v=>v==="pt"?`do bloco${m?" oficial":""} \xAB${n(c.key,v)}\xBB`:`of the${m?" official":""} block \xAB${n(c.key,v)}\xBB`;t.push({key:"off",agents:c.agents,fact:c.key,en:`${b("en")} ${d===1?"has":"have"} a variation ${O("en")} (${ke(c.agents)}): align it?`,pt:`${b("pt")} ${d===1?"tem":"t\xEAm"} uma varia\xE7\xE3o ${O("pt")} (${ke(c.agents)}): alinhar?`});continue}let y=O=>`${b(O)} ${ts(c.key,O,d,e.names)} (${ke(c.agents)})`;t.push({key:"off",agents:c.agents,fact:c.key,en:h?`${y("en")}, and the pattern was accepted: correct it?`:m?`${y("en")}: add it?`:`${y("en")}: on purpose?`,pt:h?`${y("pt")}, e o padr\xE3o foi aceito: corrigir?`:m?`${y("pt")}: incluir?`:`${y("pt")}: \xE9 intencional?`})}for(let c of e.gaps.filter(d=>d.rule.has)){let d=c.agents.filter(h=>!e.offPattern.some(b=>b.agent===h&&b.key===c.rule.has)).sort(),u=d.length;u&&t.push({key:"gap",agents:d,fact:c.rule.has,en:`Rule \xAB${c.rule.says}\xBB: ${u}${c.rule.role?` ${ae(c.rule.role,"en",u)}`:""} ${u===1?"does":"do"} not meet it (${ke(d)})`,pt:`Regra \xAB${c.rule.says}\xBB: ${u}${c.rule.role?` ${ae(c.rule.role,"pt",u)}`:""} n\xE3o ${u===1?"cumpre":"cumprem"} (${ke(d)})`})}for(let c of e.markerFindings)if(c.kind==="values"){let d=[...new Set(Object.values(c.byValue).flat())],u=d.length,h=Object.entries(c.byValue).sort(([m,y],[O,v])=>v.length-y.length||m.localeCompare(O)).map(([m,y])=>`${m} {in} ${y.length}`),b=Object.keys(c.byValue).length;t.push({key:"values",agents:d.sort(),fact:`text:${c.marker.id}`,en:`${u} ${ae(c.role,"en",u)} set \xAB${c.marker.name}\xBB in ${b} ways (${h.join("; ").replace(/\{in\}/g,"in")}): unify?`,pt:`${u} ${ae(c.role,"pt",u)} definem \xAB${c.marker.name}\xBB de ${b} jeitos (${h.join("; ").replace(/\{in\}/g,"em")}): unificar?`})}else t.push({key:"twice",agents:[c.agent],fact:`text:${c.marker.id}`,en:`${c.agent} sets \xAB${c.marker.name}\xBB ${c.values.length===2?"twice":`${c.values.length} times`} (${c.values.join("; ")}): which one holds?`,pt:`${c.agent} define \xAB${c.marker.name}\xBB ${c.values.length===2?"duas vezes":`${c.values.length} vezes`} (${c.values.join("; ")}): qual vale?`});let o=new Set(e.solos.filter(c=>/^(connector|mcp):/.test(c.key)).map(c=>`${c.agents[0]} ${c.key.slice(c.key.indexOf(":")+1)}`)),a=e.gaps.filter(c=>c.rule.not).flatMap(c=>c.agents.map(d=>({agent:d,keys:[...c.rule.when??[],c.rule.not]})));for(let c of e.solos){let d=c.agents[0],u=c.key.startsWith("connref:")?c.key.slice(8):c.key.startsWith("operation:")?c.key.slice(10).split("/")[0]:void 0;u&&o.has(`${d} ${u}`)||a.some(h=>h.agent===d&&h.keys.some(b=>Pe(c.key,b)))||t.push({key:"solo",agents:[d],fact:c.key,en:`Only ${d} has \xAB${n(c.key,"en")}\xBB: innovation or debt?`,pt:`S\xF3 ${d} tem \xAB${n(c.key,"pt")}\xBB: inova\xE7\xE3o ou d\xEDvida?`})}let l={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 c of e.unused){let[d,u]=l[c.what]??["",""],h=e.names[c.name]??c.name;if(c.how==="orphan"){let b=c.what==="variable"?["remove it?","remover?"]:["remove it or switch it on?","remover ou ligar?"],m=c.what==="variable"?["uses","usa"]:c.what==="action"?["can choose","pode escolher"]:["calls","chama"];t.push({key:"unused",agents:[c.agent],fact:c.key,en:`Nobody ${m[0]} ${d} \xAB${h}\xBB (${c.agent}): ${b[0]}`,pt:`Ningu\xE9m ${m[1]} ${u} \xAB${h}\xBB (${c.agent}): ${b[1]}`})}else if(c.what==="node")for(let b of[...new Set(c.sources.map(m=>m.file))])t.push({key:"unused",agents:[c.agent],fact:c.key,en:`${c.agent} has a switched-off node in \xAB${wl(b)}\xBB (${c.name}): remove it?`,pt:`${c.agent} tem um n\xF3 desligado em \xAB${wl(b)}\xBB (${c.name}): remover?`});else t.push({key:"unused",agents:[c.agent],fact:c.key,en:`${c.agent} has ${d||c.what} \xAB${h}\xBB switched off: remove it?`,pt:`${c.agent} tem ${u||c.what} \xAB${h}\xBB ${u.startsWith("a ")?"desligada":"desligado"}: remover?`})}for(let c of e.typeNotes){let d=e.typeNames[c.type]??c.type,u=c.agents.length;t.push({key:"type",agents:c.agents,en:`The type \xAB${d}\xBB has ${u} ${ae("specialist","en",u)} (${ke(c.agents)}): nothing to compare in it`,pt:`O tipo \xAB${d}\xBB tem ${u} ${ae("specialist","pt",u)} (${ke(c.agents)}): nada a comparar dentro dele`})}let f=new Map;for(let c of e.unknown)f.set(c.agent,[...f.get(c.agent)??[],c.file]);for(let[c,d]of f){let u=d.length;t.push({key:"unknown",agents:[c],en:`${c}: the analysis did not understand ${u} ${u===1?"file":"files"} (${ke(d)})`,pt:`${c}: a an\xE1lise n\xE3o entendeu ${u} ${u===1?"arquivo":"arquivos"} (${ke(d)})`})}for(let c of e.unmatched)t.push({key:"unmatched",agents:[],en:`The profile names \xAB${c}\xBB, which is not in the folder`,pt:`O perfil cita \xAB${c}\xBB, que n\xE3o est\xE1 na pasta`});return t.sort((c,d)=>bl.indexOf(c.key)-bl.indexOf(d.key))}function Kt(e){let t=i=>e.offPattern.some(r=>r.key===i.key||r.partOf===i.key),n=i=>i.share===1&&!i.decision&&!t(i),s=e.patterns.filter(i=>!i.partOf);return{look:s.filter(i=>!n(i)),everyone:s.filter(n)}}var kl=new TextEncoder,nr=e=>e.replace(/[&<>"]/g,t=>({"&":"&","<":"<",">":">",'"':"""})[t]).replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g,""),Ut=e=>e<26?String.fromCharCode(65+e):Ut(Math.floor(e/26)-1)+String.fromCharCode(65+e%26),Ch=e=>e.replace(/[:\\/?*[\]]/g," ").slice(0,31)||"Sheet";function Th(e){let t=[{}],n=u=>JSON.stringify([u.bold??!1,u.fill??"",u.color??"",u.center??!1,u.wrap??!1]),s=new Map([[n({}),0]]);for(let u of e)for(let h of u.rows)for(let b of h){if(typeof b!="object")continue;let{v:m,...y}=b,O=n(y);s.has(O)||(s.set(O,t.length),t.push(y))}let i=new Map([["|",0]]),r=new Map([["",0]]),o=u=>{let h=`${u.bold?"b":""}|${u.color??""}`;return i.has(h)||i.set(h,i.size),i.get(h)},a=u=>u.fill?(r.has(u.fill)||r.set(u.fill,r.size+1),r.get(u.fill)):0,l=t.map(u=>{let h=u.center||u.wrap?`<alignment${u.center?' horizontal="center"':""}${u.wrap?' wrapText="1"':""} vertical="top"/>`:'<alignment vertical="top"/>';return`<xf numFmtId="0" fontId="${o(u)}" fillId="${a(u)}" borderId="${u.fill||u.bold?1:0}" xfId="0" applyFont="1" applyFill="1" applyBorder="1" applyAlignment="1">${h}</xf>`}),f=[...i.keys()].map(u=>{let[h,b]=u.split("|");return`<font>${h?"<b/>":""}<sz val="11"/>${b?`<color rgb="FF${b}"/>`:""}<name val="Calibri"/><family val="2"/></font>`}),c=['<fill><patternFill patternType="none"/></fill>','<fill><patternFill patternType="gray125"/></fill>',...[...r.keys()].filter(Boolean).map(u=>`<fill><patternFill patternType="solid"><fgColor rgb="FF${u}"/><bgColor indexed="64"/></patternFill></fill>`)];return{xml:`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
144
145
|
<styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
|
|
145
|
-
<fonts count="${
|
|
146
|
-
<fills count="${
|
|
146
|
+
<fonts count="${f.length}">${f.join("")}</fonts>
|
|
147
|
+
<fills count="${c.length}">${c.join("")}</fills>
|
|
147
148
|
<borders count="2"><border><left/><right/><top/><bottom/><diagonal/></border><border><left style="thin"><color rgb="FFD0D7E2"/></left><right style="thin"><color rgb="FFD0D7E2"/></right><top style="thin"><color rgb="FFD0D7E2"/></top><bottom style="thin"><color rgb="FFD0D7E2"/></bottom><diagonal/></border></borders>
|
|
148
149
|
<cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs>
|
|
149
|
-
<cellXfs count="${
|
|
150
|
+
<cellXfs count="${l.length}">${l.join("")}</cellXfs>
|
|
150
151
|
<cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles>
|
|
151
|
-
</styleSheet>`,styleOf:u=>typeof u=="object"?s.get(n((({v:
|
|
152
|
+
</styleSheet>`,styleOf:u=>typeof u=="object"?s.get(n((({v:h,...b})=>b)(u)))??0:0}}function qh(e,t){let n=Math.max(e.columns.length,...e.rows.map(l=>l.length),1),s=e.rows.map((l,f)=>{let c=l.map((d,u)=>{let h=`${Ut(u)}${f+1}`,b=typeof d=="object"?d.v:d,m=t(d),y=m?` s="${m}"`:"";return b===""||b===void 0||b===null?m?`<c r="${h}"${y}/>`:"":typeof b=="number"?`<c r="${h}"${y}><v>${b}</v></c>`:`<c r="${h}"${y} t="inlineStr"><is><t xml:space="preserve">${nr(String(b))}</t></is></c>`}).join("");return`<row r="${f+1}">${c}</row>`}),i=`${Ut(n-1)}${Math.max(1,e.rows.length)}`,r=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((l,f)=>`<col min="${f+1}" max="${f+1}" width="${l.width}" customWidth="1"/>`).join("")}</cols>`:"",a=e.header&&e.rows.length>1?`<autoFilter ref="A1:${Ut(Math.max(0,e.columns.length-1))}${e.rows.length}"/>`:"";return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
152
153
|
<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
|
|
153
154
|
<dimension ref="A1:${i}"/><sheetViews><sheetView workbookViewId="0">${r}</sheetView></sheetViews><sheetFormatPr defaultRowHeight="15"/>${o}<sheetData>${s.join("")}</sheetData>${a}
|
|
154
|
-
</worksheet>`}function
|
|
155
|
+
</worksheet>`}function $l(e){let{xml:t,styleOf:n}=Th(e),s=e.map(o=>Ch(o.name)),i=e.map((o,a)=>o.header&&o.rows.length>1?`<definedName name="_xlnm._FilterDatabase" localSheetId="${a}" hidden="1">'${nr(s[a]).replace(/'/g,"''")}'!$A$1:$${Ut(Math.max(0,o.columns.length-1))}$${o.rows.length}</definedName>`:"").join(""),r=[["[Content_Types].xml",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
155
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"?>
|
|
156
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"?>
|
|
157
|
-
<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="${
|
|
158
|
-
<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`,gh(o,n)])];return wh(r.map(([o,a])=>[o,cl.encode(a)]))}var yh=(()=>{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 bh(e){let t=4294967295;for(let n=0;n<e.length;n++)t=yh[(t^e[n])&255]^t>>>8;return(t^4294967295)>>>0}function wh(e){let t=[],n=[],s=0;for(let[l,d]of e){let f=cl.encode(l),u=bh(d),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,u,!0),p.setUint32(18,d.length,!0),p.setUint32(22,d.length,!0),p.setUint16(26,f.length,!0),t.push(new Uint8Array(p.buffer),f,d);let y=new DataView(new ArrayBuffer(46));y.setUint32(0,33639248,!0),y.setUint16(4,20,!0),y.setUint16(6,20,!0),y.setUint16(8,2048,!0),y.setUint32(16,u,!0),y.setUint32(20,d.length,!0),y.setUint32(24,d.length,!0),y.setUint16(28,f.length,!0),y.setUint32(42,s,!0),n.push(new Uint8Array(y.buffer),f),s+=30+f.length+d.length}let i=n.reduce((l,d)=>l+d.length,0),r=new DataView(new ArrayBuffer(22));r.setUint32(0,101010256,!0),r.setUint16(8,e.length,!0),r.setUint16(10,e.length,!0),r.setUint32(12,i,!0),r.setUint32(16,s,!0);let o=[...t,...n,new Uint8Array(r.buffer)],a=new Uint8Array(o.reduce((l,d)=>l+d.length,0)),c=0;for(let l of o)a.set(l,c),c+=l.length;return a}var kh=e=>fl(e),Sh={bold:!0,fill:"E8EEF7"},$h={v:"\u25CF",fill:"DDF3E6",center:!0},vh={v:"\xD7",fill:"FFD5CC",center:!0,bold:!0},Ah={v:"\u25D0",fill:"FFF3C4",center:!0},Oh={v:"\u2248",fill:"FFF6DC",center:!0,bold:!0},ul=Object.keys(Ki);function Nh(e,t,n,s="en"){let i=Qn[s],r=(m,v,P)=>({key:m,name:i[m],header:!0,columns:v.map(([U,A])=>({title:U,width:A})),rows:[v.map(([U])=>({v:U,...Sh})),...P]}),o=m=>i[e.roles[m]],a=m=>m.startsWith("type:")?`${i.type}:${e.typeNames[m.slice(5)]??m.slice(5)}`:i[m],c=m=>(e.types[m]??[]).map(v=>e.typeNames[v]??v).join(" \xB7 "),l=m=>ae(m,s,e.names),d=[...e.agents].sort((m,v)=>m.role===v.role?m.id.localeCompare(v.id):m.role==="orchestrator"?-1:1),f=[...new Set([...d.flatMap(m=>Object.keys(m.facts)),...e.patterns.map(m=>m.key)])].filter(m=>!m.endsWith("~variant")).sort((m,v)=>ul.indexOf(Lt(m))-ul.indexOf(Lt(v))||m.localeCompare(v)),u=new Set(e.offPattern.map(m=>`${m.agent} ${m.key}`)),p=m=>e.agents.filter(v=>v.role===m).length,y={key:"summary",name:i.summary,header:!1,columns:[{title:"",width:28},{title:"",width:100}],rows:[[{v:e.name??i.title,bold:!0},""],[{v:i.privacy,color:"B42318"},""],[i.count.agents,e.agents.length],[i.count.orchestrators,p("orchestrator")],[i.count.specialists,p("specialist")],[i.count.patterns,e.patterns.length],[i.count.off,new Set(e.offPattern.map(m=>m.agent)).size],[i.count.gaps,e.gaps.length],[i.count.conflicts,e.conflicts.length],[i.count.solos,t.filter(m=>m.key==="solo").length],["",""],[{v:t.length?i.look:i.nothing,bold:!0},""],...t.map(m=>["",{v:m[s],wrap:!0}])]},g=r("matrix",[[i.dimension,18],[i.fact,40],[i.key,34],...d.map(m=>[m.id,14])],f.map(m=>[Ki[Lt(m)][s],l(m),m,...d.map(v=>m in v.facts?m.startsWith("declared:")?Ah:$h:`${m}~variant`in v.facts?Oh:u.has(`${v.id} ${m}`)?vh:"")])),{look:w,everyone:N}=Rt(e),h=r("patterns",[[i.key,34],[i.fact,40],[i.scope,14],[i.role,14],[i.share,10],[i.have,50],[i.lack,40],[i.decision,12],[i.why,50]],[...w,...N].map(m=>{let v=e.offPattern.filter(P=>P.key===m.key).map(P=>P.agent);return[m.key,l(m.key),a(m.scope),i[m.role],`${Math.round(m.share*100)}%`,m.agents.join(", "),v.join(", "),m.decision?i[m.decision.status==="accepted"?"accept":"reject"]:"",m.decision?.why??""]})),k=r("off",[[i.agent,24],[i.role,14],[i.missing,44],[i.key,34],[i.scope,14],[i.accepted,14]],e.offPattern.map(m=>[m.agent,o(m.agent),l(m.key),m.key,a(m.scope),e.patterns.find(v=>v.key===m.key)?.decision?.status==="accepted"?i.yes:""])),x=r("gaps",[[i.rule,16],[i.says,50],[i.role,14],[i.notMet,60]],e.gaps.map(m=>[m.rule.id,m.rule.says,m.rule.role?i[m.rule.role]:"",m.agents.join(", ")])),S=r("conflicts",[[i.agent,24],[i.fact,40],[i.key,34],[i.declared,20],[i.source,40],[i.inYaml,12]],e.conflicts.map(m=>[m.agent,l(m.key),m.key,m.declared,m.source,m.observed?i.yes:i.no])),O=r("agents",[[i.agent,24],[i.name,32],[i.role,14],[i.types,24],[i.facts,8],[i.off,44],[i.alone,44],[i.children,24],[i.unknown,12]],d.map(m=>[m.id,m.displayName??"",i[m.role],c(m.id),Object.keys(m.facts).length,e.offPattern.filter(v=>v.agent===m.id).map(v=>l(v.key)).join("; "),e.solos.filter(v=>v.agents[0]===m.id).map(v=>l(v.key)).join("; "),m.children.map(v=>v.name).join(", "),e.unknown.filter(v=>v.agent===m.id).length||""])),q=r("evidence",[[i.agent,30],[i.fact,40],[i.key,34],[i.file,50],[i.line,8]],d.flatMap(m=>[{who:m.id,facts:m.facts},...m.children.map(v=>({who:`${m.id} \u203A ${v.name}`,facts:v.facts}))]).flatMap(({who:m,facts:v})=>Object.entries(v).sort(([P],[U])=>P.localeCompare(U)).flatMap(([P,U])=>U.map(A=>[m,l(P),P,A.file,A.line??""])))),E=r("declared",[[i.agent,24],[i.key,34],[i.value,40],[i.source,40]],n.declared.map(m=>[m.agent,m.key,m.value,m.source])),I=r("text",[[i.id,28],[i.label,36],[i.body,70],[i.have,50],[i.variant,40],[i.official,10]],e.blocks.map(m=>[m.id,m.official??m.label,{v:m.text,wrap:!0},Object.keys(m.holders).sort().join(", "),Object.entries(m.variants).sort(([v],[P])=>v.localeCompare(P)).map(([v,P])=>`${v} (${Math.round(P.similarity*100)}%)`).join(", "),m.official?i.yes:""])),b=[y,g,h,...e.blocks.length?[I]:[],k,x,S,O,q,E];return e.unknown.length&&b.push(r("unknown",[[i.agent,24],[i.file,50],[i.why,40],[i.kind,24]],e.unknown.map(m=>[m.agent,m.file,i.why_[m.why],m.kind??""]))),b}var me=e=>String(e??"").normalize("NFD").replace(/[̀-ͯ]/g,"").trim().toLowerCase(),Ft=Object.values(Qn),dl=(e,t)=>e.find(n=>Ft.some(s=>me(s[t])===me(n.name)));function pl(e,...t){let n=t.map(s=>e?.rows[0]?.findIndex(i=>Ft.some(r=>me(r[s])===me(i)))??-1);return s=>n.map(i=>i<0?"":String(s[i]??"").trim())}var hl=(e,t)=>t.find(([,n])=>Ft.some(s=>me(s[n])===me(e)))?.[0],ml=e=>e.slice(1).filter(t=>t.some(n=>String(n??"").trim())),gl=(e,t)=>JSON.stringify(e)===JSON.stringify(t);function Eh(e,t,n={}){let s=[],i=[],r=dl(t,"declared");if(r){let a=pl(r,"agent","key","value","source"),c=[];ml(r.rows).forEach((f,u)=>{let[p,y,g,w]=a(f);!p||!y?i.push(`${r.name}, ${u+2}: \xAB${a(r.rows[0])[p?1:0]}\xBB ?`):c.push({agent:p,key:y,value:g,source:w})});let l=f=>`${f.agent} ${f.key}`,d=0;for(let f of c){let u=e.declared.find(p=>l(p)===l(f));u?gl(u,f)||s.push({key:`d${++d}`,kind:"declared",op:"set",before:u,after:f}):s.push({key:`d${++d}`,kind:"declared",op:"add",after:f})}for(let f of e.declared)c.some(u=>l(u)===l(f))||s.push({key:`d${++d}`,kind:"declared",op:"remove",before:f})}let o=dl(t,"patterns");if(o){let a=pl(o,"key","scope","decision","why"),c=0;for(let l of ml(o.rows)){let[d,f,u,p]=a(l);if(!d)continue;let y=e.decisions.find(k=>k.key===d);if(!u){y&&s.push({key:`p${++c}`,kind:"decision",op:"remove",before:y});continue}let g=hl(u,[["accepted","accept"],["rejected","reject"]]),w=/^(tipo|type)\s*:\s*(.+)$/i.exec(f),N=w?Object.entries(n).find(([k,x])=>me(x)===me(w[2])||me(k)===me(w[2]))?.[0]:void 0,h=w?N?`type:${N}`:void 0:hl(f,[["platform","platform"],["specialist","specialist"],["orchestrator","orchestrator"]]);if(!g)i.push(`${o.name}, ${d}: \xAB${u}\xBB \u2014 ${Ft.map(k=>`${k.accept}/${k.reject}`).join(", ")}`);else if(!h)i.push(`${o.name}, ${d}: \xAB${f}\xBB \u2014 ${Ft.map(k=>`${k.platform}/${k.specialist}/${k.orchestrator}`).join(", ")}`);else{let k={key:d,status:g,scope:h,why:p};y?gl(y,k)||s.push({key:`p${++c}`,kind:"decision",op:"set",before:y,after:k}):s.push({key:`p${++c}`,kind:"decision",op:"add",after:k})}}}return{changes:s,problems:i}}function xh(e,t,n){let s={...e,declared:[...e.declared],decisions:[...e.decisions]};for(let i of t.filter(r=>n.includes(r.key)))if(i.kind==="declared"){let r=a=>`${a.agent} ${a.key}`,o=i.before?s.declared.findIndex(a=>r(a)===r(i.before)):-1;i.op==="add"?s.declared.push(i.after):i.op==="set"?s.declared[o]=i.after:s.declared.splice(o,1)}else{let r=i.before?s.decisions.findIndex(o=>o.key===i.before.key):-1;i.op==="add"?s.decisions.push(i.after):i.op==="set"?s.decisions[r]=i.after:s.decisions.splice(r,1)}return s}var _t="#8C8578";var Zn="#C8442C",bl="#2E8F62";var yl=e=>Math.round(e*10)/10,jt=e=>[yl(e[0]),yl(e[1])],we=(e,t,n=22,s="start",i)=>({type:"text",at:jt(e),text:t,size:n,anchor:s,...i?{style:{color:i}}:{}}),wl=(e,t,n)=>({type:"line",from:jt(e),to:jt(t),...n?{style:n}:{}}),kl=(e,t,n)=>({type:"arrow",from:jt(e),to:jt(t),...n?{style:n}:{}});var Ch=(e,t)=>e.length*t*.48;function es(e,t,n){let s=[],i="";for(let r of e.split(/\s+/).filter(Boolean)){let o=i?`${i} ${r}`:r;i&&Ch(o,t)>n?(s.push(i),i=r):i=o}return i&&s.push(i),s.length?s:[""]}var Ze=150,Bt=40,Th=24,Sl=250,$l="#7B4FC9",vl=17,Al=23,Xi=5,Hi=4,qh=/^(auth|model|setting|topics|connref|operation):/,Ph={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.",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.",pattern:e=>`Padr\xE3o? \xAB${e}\xBB`,platform:"plataforma",specialist:"especialistas",more:e=>`e mais ${e} no mapa`,none:"nada"}};function Mh(e,t,n="en"){let s=Ph[n],i=e.agents.filter(A=>A.role==="orchestrator").sort((A,L)=>A.id.localeCompare(L.id)),r=Object.keys(e.typeNames),o=A=>{let L=(e.types[A]??[])[0];return L===void 0?r.length:r.indexOf(L)},a=e.agents.filter(A=>A.role==="specialist").sort((A,L)=>o(A.id)-o(L.id)||A.id.localeCompare(L.id)),c=r.length>0&&a.some(A=>(e.types[A.id]??[]).length),l=c?390:340,d=Math.max(1,Math.ceil(a.length/Th)),f=Math.max(1,Math.ceil(a.length/d)),u=Math.max(1e3,Bt*2+Math.max(f,i.length)*Ze),p=(A,L)=>u/2+(A-(L-1)/2)*Ze,y=A=>Ga(A)?0:qh.test(A)?2:1,g=[{...we([Bt,52],e.name??s.chapters[0],30),chapter:s.chapters[0],say:`${e.name?`${e.name}: `:""}${s.cast(i.length,a.length)}`}],w=(A,L,F)=>es(A,15,Ze-12).slice(0,2).forEach((_,se)=>g.push(we([L[0],L[1]+se*18],_,15,"middle",F))),N=170,h=new Map;i.forEach((A,L)=>{let F=p(L,i.length);h.set(A.id,[F,N]),g.push({type:"prop",name:"robot",at:[F,N],size:70}),w(A.id,[F,N+24],_t)}),a.forEach((A,L)=>{let F=Math.floor(L/f),_=Math.min(f,a.length-F*f),se=[p(L%f,_),l+F*Sl];h.set(A.id,se),g.push({type:"prop",name:"robot",at:se,size:64}),w(A.id,[se[0],se[1]+24])});for(let A of i){let L=h.get(A.id);for(let F of a.filter(_=>_.schemaName&&`calls:${_.schemaName}`in A.facts)){let _=h.get(F.id);_[1]===l&&g.push(kl([L[0],L[1]+44],[_[0],_[1]-(c?118:76)],{color:_t}))}}if(c){let A=[];a.forEach(L=>{let F=(e.types[L.id]??[])[0],_=F===void 0?n==="pt"?"sem tipo":"no type":e.typeNames[F]??F,[se,G]=h.get(L.id),re=A[A.length-1];re&&re.name===_&&re.y===G?re.xs.push(se):A.push({name:_,xs:[se],y:G})});for(let L of A){let[F,_]=[Math.min(...L.xs),Math.max(...L.xs)];g.push(we([(F+_)/2,L.y-92],L.name,16,"middle",$l),wl([F-Ze/2+14,L.y-84],[_+Ze/2-14,L.y-84],{color:$l}))}}let k=l+(d-1)*Sl+160,x=(u-Bt*2)/3,S=k,O=(A,L,F,_,se)=>{let G=Bt+A*x;g.push({...we([G,k],L,22,"start",se),chapter:L,say:F});let re=k+34,Ut=_.slice(0,Xi);_.length>Xi&&Ut.push(s.more(_.length-Xi)),Ut.length||Ut.push(s.none);for(let jl of Ut){let Yt=es(jl,vl,x-30),Zi=Yt.length>Hi?[...Yt.slice(0,Hi-1),`${Yt[Hi-1]}\u2026`]:Yt;Zi.forEach((_l,is)=>g.push(we([G+(is?14:0),re+is*Al],`${is?"":"\xB7 "}${_l}`,vl,"start",_t))),re+=Zi.length*Al+6}S=Math.max(S,re)},q=e.patterns.filter(A=>!A.partOf).sort((A,L)=>y(A.key)-y(L.key)||(A.scope===L.scope?0:A.scope==="platform"?-1:1)||L.share-A.share||A.key.localeCompare(L.key)),E=A=>A==="platform"?s.platform:s.specialist;O(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),q.map(A=>`${ae(A.key,n,e.names)} \xB7 ${E(A.scope)}${A.share<1?` \xB7 ${Math.round(A.share*100)}%`:""}`),bl);let I=[...new Set(e.offPattern.map(A=>A.agent))].sort();I.forEach((A,L)=>{let F=h.get(A),_=G=>G.variant?`${n==="pt"?"varia\xE7\xE3o de":"a variation of"} \xAB${ae(G.key,n,e.names)}\xBB`:Gn(G.key,n,1,e.names),se=e.offPattern.filter(G=>G.agent===A).sort((G,re)=>y(G.key)-y(re.key)).flatMap(G=>es(_(G),13,Ze-10)).slice(0,4);g.push({...we([F[0]+34,F[1]-50],"\xD7",30,"middle",Zn),...L===0?{chapter:s.chapters[2],say:s.off(I)}:{}}),se.forEach((G,re)=>g.push(we([F[0],F[1]+66+re*16],G,13,"middle",Zn)))}),I.length||g.push({...we([u-Bt,92],s.off([]),16,"end",_t),chapter:s.chapters[2],say:s.off([])});let b=e.gaps.flatMap(A=>{let L=A.agents.filter(F=>!e.offPattern.some(_=>_.agent===F&&_.key===A.rule.has)).length;return L?[n==="pt"?`\xAB${A.rule.says}\xBB: ${L}${A.rule.role?` ${ie(A.rule.role,n,L)}`:""} n\xE3o ${L===1?"cumpre":"cumprem"}`:`\xAB${A.rule.says}\xBB: ${L}${A.rule.role?` ${ie(A.rule.role,n,L)}`:""} ${L===1?"does":"do"} not meet it`]:[]}),m=e.unknown.length;m&&b.push(n==="pt"?`${m} ${m===1?"arquivo n\xE3o entendido":"arquivos n\xE3o entendidos"}`:`${m} ${m===1?"file":"files"} not understood`),O(1,s.chapters[3],s.missing(t.filter(A=>A.key==="gap").length),b,Zn);let{look:v}=Rt(e),P=[...t.filter(A=>A.key==="conflict"||A.key==="values"||A.key==="twice").map(A=>A[n]),...v.filter(A=>!A.decision).map(A=>s.pattern(ae(A.key,n,e.names))),...t.filter(A=>A.key==="solo").map(A=>A[n])];return O(2,s.chapters[4],s.decide(P.length),P),{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:u,height:Math.min(4e3,S+40),background:"plain",locale:n==="pt"?"pt-BR":"en-US",steps:g}}var Ol=["and","or","not"];var Qi=["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"],ts={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"},ns=e=>Qi.includes(e)?e:typeof e=="string"&&Object.hasOwn(ts,e)?ts[e]:void 0;var El=e=>ns(e)!==void 0,$={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"},T=(e,t,n,s,i,r)=>({kind:"polygon",points:[[e,t],[e+n,t],[e+n,t+s],[e,t+s]],fill:i,main:r}),M=(...e)=>({kind:"polyline",points:e});function xl(e){return[{kind:"polygon",points:[[-.15,-.72],[.15,-.72],[.19,-.38],[-.19,-.38]],fill:$.shirt,main:!0},{kind:"circle",c:[0,-.87],r:.11,fill:$.skin},...e,M([-.08,-.38],[-.1,0]),M([.08,-.38],[.1,0])]}var Nl=xl([M([-.15,-.7],[-.25,-.42]),M([.15,-.7],[.25,-.42])]);function Lh(e,t,n){let s=([i,r])=>[n+i*t,r*t];return e.map(i=>i.kind==="circle"?{...i,c:s(i.c),r:i.r*t}:{...i,points:i.points.map(s)})}function Ih(){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,i=e.filter(([r,,o])=>Math.abs(s-r)<=o).map(([r,o,a])=>o-Math.sqrt(Math.max(0,a*a-(s-r)**2)));i.length&&t.push([s,Math.min(...i)])}return[...t,[.42,-.12],[-.4,-.12]]}var e0={person:Nl,"person-pointing":xl([M([-.15,-.7],[-.25,-.42]),M([.15,-.69],[.47,-.73])]),"person-sitting":[M([-.3,-.8],[-.27,-.4]),M([-.32,-.4],[.2,-.4]),M([-.27,-.4],[-.27,0]),M([.16,-.4],[.16,0]),{kind:"polygon",points:[[-.22,-.77],[.04,-.77],[.06,-.44],[-.22,-.44]],fill:$.shirt,main:!0},{kind:"circle",c:[-.08,-.9],r:.1,fill:$.skin},M([-.1,-.44],[.3,-.44],[.32,0]),M([0,-.74],[.18,-.55],[.3,-.58])],house:[T(-.4,-.6,.8,.6,$.wall,!0),{kind:"polygon",points:[[-.5,-.58],[0,-1],[.5,-.58]],fill:$.roof},T(-.08,-.32,.16,.32,$.wood),T(.16,-.46,.16,.14,$.screen)],car:[{kind:"polygon",fill:$.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:$.screen},{kind:"circle",c:[-.28,-.12],r:.1,fill:$.dark},{kind:"circle",c:[.28,-.12],r:.1,fill:$.dark}],bus:[T(-.5,-.66,1,.52,$.bus,!0),...[-.42,-.21,0,.21].map(e=>T(e,-.6,.15,.16,$.screen)),M([-.5,-.3],[.5,-.3]),{kind:"circle",c:[-.3,-.12],r:.1,fill:$.dark},{kind:"circle",c:[.3,-.12],r:.1,fill:$.dark}],coin:[{kind:"circle",c:[0,-.42],r:.4,fill:$.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]]},M([0,-.64],[0,-.2])],phone:[T(-.26,-1,.52,1,$.device,!0),T(-.2,-.92,.4,.76,$.screen),{kind:"circle",c:[0,-.08],r:.035,fill:$.paper}],document:[{kind:"polygon",points:[[-.36,-1],[.16,-1],[.36,-.8],[.36,0],[-.36,0]],fill:$.paper,main:!0},M([.16,-1],[.16,-.8],[.36,-.8]),...[-.66,-.5,-.34,-.18].map(e=>M([-.22,e],[.22,e]))],server:[-1,-.66,-.32].flatMap(e=>[T(-.36,e,.72,.3,$.metal,!0),M([-.26,e+.15],[.06,e+.15]),{kind:"circle",c:[.22,e+.15],r:.035,fill:$.green}]),bank:[{kind:"polygon",points:[[-.5,-.74],[0,-1],[.5,-.74]],fill:$.wall,main:!0},T(-.45,-.74,.9,.08,$.wall),...[-.33,-.11,.11,.33].map(e=>T(e-.04,-.66,.08,.56,$.paper)),T(-.5,-.1,1,.1,$.wall)],cloud:[{kind:"polygon",points:Ih(),fill:$.paper,main:!0}],queue:[-.32,0,.32].flatMap(e=>Lh(Nl,.7,e)),desk:[T(-.5,-.5,1,.07,$.wood,!0),M([-.42,-.43],[-.42,0]),M([.42,-.43],[.42,0])],computer:[T(-.45,-1,.9,.6,$.device,!0),T(-.39,-.94,.78,.48,$.screen),{kind:"polygon",points:[[-.06,-.4],[.06,-.4],[.1,-.1],[-.1,-.1]],fill:$.device},T(-.25,-.1,.5,.08,$.device)],clock:[{kind:"circle",c:[0,-.48],r:.45,fill:$.paper,main:!0},...[[0,-.9,0,-.82],[.42,-.48,.34,-.48],[0,-.06,0,-.14],[-.42,-.48,-.34,-.48]].map(([e,t,n,s])=>M([e,t],[n,s])),M([0,-.48],[0,-.78]),M([0,-.48],[.2,-.48])],lock:[{kind:"curve",points:[[-.22,-.52],[-.22,-.76],[0,-.96],[.22,-.76],[.22,-.52]]},T(-.36,-.54,.72,.54,$.bus,!0),{kind:"circle",c:[0,-.32],r:.06,fill:$.dark},M([0,-.28],[0,-.14])],"money-arrow":[{kind:"polygon",fill:$.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:$.gold},M([-.2,-.4],[-.2,-.2])],tree:[T(-.07,-.36,.14,.36,$.wood),{kind:"circle",c:[0,-.64],r:.3,fill:$.green,main:!0}],school:[T(-.45,-.6,.9,.6,$.wall,!0),{kind:"polygon",points:[[-.5,-.6],[0,-.82],[.5,-.6]],fill:$.roof},T(-.08,-.28,.16,.28,$.wood),T(-.36,-.48,.16,.12,$.screen),T(.2,-.48,.16,.12,$.screen),M([0,-.82],[0,-1]),{kind:"polygon",points:[[0,-1],[.17,-.95],[0,-.9]],fill:$.roof}],hospital:[T(-.4,-.8,.8,.8,$.paper,!0),T(-.045,-.7,.09,.26,"#C8442C"),T(-.13,-.615,.26,.09,"#C8442C"),T(-.1,-.24,.2,.24,$.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:$.wall,main:!0},T(.3,-.95,.12,.3,$.dark),T(-.38,-.32,.16,.12,$.screen),T(-.08,-.32,.16,.12,$.screen),T(.22,-.32,.16,.12,$.screen)],truck:[T(-.5,-.62,.62,.46,$.metal,!0),{kind:"polygon",points:[[.12,-.16],[.12,-.5],[.34,-.5],[.48,-.32],[.48,-.16]],fill:$.bus},{kind:"polygon",points:[[.18,-.46],[.32,-.46],[.42,-.33],[.18,-.33]],fill:$.screen},{kind:"circle",c:[-.3,-.1],r:.1,fill:$.dark},{kind:"circle",c:[.3,-.1],r:.1,fill:$.dark}],cart:[M([-.48,-.78],[-.4,-.62]),{kind:"polygon",points:[[-.4,-.62],[.42,-.62],[.32,-.26],[-.3,-.26]],fill:$.metal,main:!0},M([-.3,-.26],[-.3,-.14],[.32,-.14]),{kind:"circle",c:[-.22,-.07],r:.06,fill:$.dark},{kind:"circle",c:[.24,-.07],r:.06,fill:$.dark}],safe:[T(-.4,-.82,.8,.82,$.device,!0),T(-.3,-.72,.6,.62,$.metal),{kind:"circle",c:[0,-.41],r:.13,fill:$.paper},M([0,-.41],[.08,-.47])],bulb:[{kind:"circle",c:[0,-.62],r:.3,fill:$.gold,main:!0},T(-.13,-.33,.26,.2,$.metal),{kind:"curve",points:[[-.09,-.52],[0,-.66],[.09,-.52]]},M([-.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:$.metal,main:!0},{kind:"circle",c:[0,-.5],r:.12,fill:$.paper}],database:[{kind:"polygon",points:[[-.35,-.8],[.35,-.8],[.35,-.16],[-.35,-.16]],fill:$.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:$.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:[M([0,-.95],[0,-1]),T(-.22,-.95,.44,.3,$.metal),{kind:"circle",c:[-.09,-.81],r:.045,fill:$.screen},{kind:"circle",c:[.09,-.81],r:.045,fill:$.screen},T(-.28,-.62,.56,.42,$.metal,!0),M([-.28,-.55],[-.42,-.35]),M([.28,-.55],[.42,-.35]),T(-.2,-.2,.12,.2,$.device),T(.08,-.2,.12,.2,$.device)],ship:[{kind:"polygon",points:[[-.48,-.3],[.48,-.3],[.36,-.04],[-.4,-.04]],fill:$.car,main:!0},T(-.42,-.62,.14,.32,$.wall),T(-.24,-.5,.2,.2,$.roof),T(-.02,-.5,.2,.2,$.bus),T(.2,-.5,.2,.2,$.green),{kind:"curve",points:[[-.5,0],[-.3,-.04],[-.1,0],[.1,-.04],[.3,0],[.5,-.04]]}],container:[T(-.46,-.52,.92,.52,$.roof,!0),...[-.3,-.15,0,.15,.3].map(e=>M([e,-.48],[e,-.04]))],warehouse:[{kind:"polygon",points:[[-.46,0],[.46,0],[.46,-.55],[0,-.82],[-.46,-.55]],fill:$.wall,main:!0},T(-.2,-.38,.4,.38,$.metal),M([-.2,-.26],[.2,-.26]),M([-.2,-.13],[.2,-.13])],box:[T(-.36,-.5,.52,.5,$.wood,!0),{kind:"polygon",points:[[-.36,-.5],[.16,-.5],[.36,-.64],[-.16,-.64]],fill:$.wood},{kind:"polygon",points:[[.16,0],[.36,-.14],[.36,-.64],[.16,-.5]],fill:$.wood},M([-.1,-.5],[.1,-.64])],pallet:[T(-.46,-.12,.92,.06,$.wood),...[-.42,-.05,.32].map(e=>T(e,-.06,.1,.06,$.wood)),T(-.42,-.5,.4,.38,$.wood,!0),T(.02,-.5,.4,.38,$.wood),T(-.2,-.82,.4,.32,$.wood)],shop:[T(-.42,-.6,.84,.6,$.wall,!0),{kind:"polygon",points:[[-.48,-.6],[.48,-.6],[.42,-.78],[-.42,-.78]],fill:$.roof},T(-.34,-.48,.34,.26,$.screen),T(.08,-.42,.24,.42,$.wood)],shelf:[T(-.4,-.92,.8,.92,$.paper,!0),M([-.4,-.62],[.4,-.62]),M([-.4,-.32],[.4,-.32]),T(-.32,-.8,.16,.18,$.roof),T(-.1,-.78,.14,.16,$.bus),T(.1,-.5,.22,.18,$.green),T(-.3,-.2,.24,.2,$.wood)],field:[M([-.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:$.green,main:!0},{kind:"circle",c:[e+.08,-.42],r:.07,fill:$.green,main:!0},{kind:"circle",c:[e,-.52],r:.06,fill:$.roof}])],cup:[{kind:"polygon",points:[[-.26,-.52],[.26,-.52],[.2,-.1],[-.2,-.1]],fill:$.paper,main:!0},{kind:"curve",points:[[.24,-.44],[.4,-.38],[.22,-.2]]},{kind:"polygon",points:[[-.46,-.1],[.46,-.1],[.36,0],[-.36,0]],fill:$.paper},{kind:"curve",points:[[-.08,-.62],[-.02,-.72],[-.08,-.84]]},{kind:"curve",points:[[.08,-.62],[.14,-.72],[.08,-.84]]}],function:[T(-.38,-.72,.76,.62,$.screen,!0),M([-.14,-.62],[0,-.62],[.14,-.2]),M([.02,-.42],[-.14,-.2])],"api-gateway":[T(-.12,-.8,.24,.8,$.metal,!0),M([-.48,-.55],[-.16,-.55]),M([-.24,-.62],[-.16,-.55],[-.24,-.48]),M([.16,-.3],[.48,-.3]),M([.4,-.37],[.48,-.3],[.4,-.23])],cache:[T(-.34,-.66,.68,.66,$.metal,!0),{kind:"polygon",points:[[.04,-.58],[-.12,-.3],[0,-.3],[-.06,-.08],[.14,-.38],[.02,-.38]],fill:$.gold}],cluster:[{kind:"curve",points:[[-.4,-.8],[0,-.86],[.4,-.8],[.48,-.45],[.4,-.1],[0,-.04],[-.4,-.1],[-.48,-.45],[-.4,-.8]]},T(-.3,-.7,.24,.2,$.screen,!0),T(.06,-.7,.24,.2,$.screen,!0),T(-.12,-.38,.24,.2,$.screen,!0)],board:[T(-.48,-.9,.96,.6,$.board,!0),T(-.34,-.76,.42,.03,$.chalk),T(-.34,-.62,.58,.03,$.chalk),T(-.34,-.48,.3,.03,$.chalk),M([-.3,-.3],[-.36,0]),M([.3,-.3],[.36,0])],book:[{kind:"polygon",points:[[0,-.62],[-.46,-.7],[-.46,-.1],[0,-.04]],fill:$.paper,main:!0},{kind:"polygon",points:[[0,-.62],[.46,-.7],[.46,-.1],[0,-.04]],fill:$.paper,main:!0},M([-.36,-.52],[-.1,-.48]),M([-.36,-.38],[-.1,-.34]),M([.1,-.48],[.36,-.52]),M([.1,-.34],[.36,-.38])],pencil:[{kind:"polygon",points:[[-.38,-.12],[.22,-.72],[.34,-.6],[-.26,0]],fill:$.bus,main:!0},{kind:"polygon",points:[[.22,-.72],[.34,-.6],[.44,-.86]],fill:$.wood},{kind:"polygon",points:[[-.38,-.12],[-.26,0],[-.46,-.02]],fill:$.roof}]},Cl=["happy","sad","surprised","worried","idea"],Rh={person:[0,-.87,.11],"person-pointing":[0,-.87,.11],"person-sitting":[-.08,-.9,.1]},Tl=e=>{let t=ns(e);return!!t&&t in Rh};var ql=["spin","drive","steam","talk","pulse","float"],Dh=["lesson","pitch","arch","decision","data","timeline","story"],Pl=8,Ml=6,Ll=2e5,Il=6e5,Rl=24;var Fl=["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"],et=["text","prop","card","counter","circle","ellipse"],Dl=["row","column","grid","chain"],Fh=50;function z(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t}: expected an object.`)}function K(e,t){if(typeof e!="string"||!e.trim()||e.length>2e3)throw new Error(`${t}: expected text of 1 to 2000 characters.`)}function R(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 Z(e,t){if(typeof e=="string"){if(K(e,t),e.length>300)throw new Error(`${t}: expression too long.`)}else R(e,t)}function Q(e,t){if(!Array.isArray(e)||e.length!==2)throw new Error(`${t}: expected [x, y].`);e.forEach((n,s)=>Z(n,`${t}[${s}]`))}function le(e,t){e!==void 0&&K(e,t)}function ee(e,t,n){if(e!==void 0&&(typeof e!="string"||!t.includes(e)))throw new Error(`${n}: choose one of ${t.join(", ")}.`)}function ss(e){if(!/^[A-Za-z_][A-Za-z_0-9]*$/.test(e)||["__proto__","constructor","prototype",...Ol].includes(e))throw new Error(`Invalid variable name: "${e}".`)}var tt=(e,t)=>t.includes("{")||e.exact.has(t)||[...e.repeated].some(n=>t.startsWith(`${n}-`)&&/^\d+$/.test(t.slice(n.length+1)));function Fe(e,t,n,s){s&&e[t]===void 0&&(e[t]=[0,0]),Q(e[t],`${n}.${t}`)}function Kt(e,t,n,s,i=!1){if(z(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(Dl.includes(s)&&e.place!==void 0)throw new Error(`${t}.place: the ${s} places the steps inside it.`)}if(!Fl.includes(e.type))throw new Error(`${t}: unknown type "${e.type}".`);for(let a of["id","say","chapter"])le(e[a],`${t}.${a}`);if(e.duration!==void 0&&R(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)=>R(a,`${t}.nudge[${c}]`,-900,900))}let r=s!==null&&Dl.includes(s)||i;if(e.place!==void 0){if(!et.includes(e.type))throw new Error(`${t}.place: only ${et.join(", ")} can be placed.`);if(z(e.place,`${t}.place`),K(e.place.to,`${t}.place.to`),!tt(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&&R(e.place.gap,`${t}.place.gap`,-200,400),ee(e.place.align,["center","start","end"],`${t}.place.align`)}let o=r||e.place!==void 0;if(e.style!==void 0){z(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&&R(e.style[a],`${t}.style.${a}`,0,20);if(e.style.opacity!==void 0&&R(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.`);ee(e.style.fillStyle,["hachure","solid","zigzag","cross-hatch","dots"],`${t}.style.fillStyle`)}switch(e.type){case"line":case"arrow":case"highlight":Q(e.from,`${t}.from`),Q(e.to,`${t}.to`),e.thickness!==void 0&&R(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)=>Q(a,`${t}.points[${c}]`));break;case"circle":case"ellipse":Fe(e,"center",t,o);for(let a of e.type==="circle"?["r"]:["rx","ry"])Z(e[a],`${t}.${a}`),typeof e[a]=="number"&&R(e[a],`${t}.${a}`,0);break;case"text":Fe(e,"at",t,o),K(e.text,`${t}.text`),e.size!==void 0&&R(e.size,`${t}.size`,1,200),e.rotate!==void 0&&R(e.rotate,`${t}.rotate`,-360,360),ee(e.font,["hand","body"],`${t}.font`),ee(e.anchor,["start","middle","end"],`${t}.anchor`);break;case"card":Fe(e,"at",t,o),Z(e.w,`${t}.w`),Z(e.h,`${t}.h`);for(let a of["w","h"])typeof e[a]=="number"&&R(e[a],`${t}.${a}`,40);if(K(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)=>K(a,`${t}.lines[${c}]`))}break;case"plot":K(e.fn,`${t}.fn`),e.var!==void 0&&(K(e.var,`${t}.var`),ss(String(e.var))),Q(e.domain,`${t}.domain`),Q(e.range,`${t}.range`),z(e.box,`${t}.box`);for(let a of["x","y","w","h"])Z(e.box[a],`${t}.box.${a}`);if(e.samples!==void 0&&(R(e.samples,`${t}.samples`,2,1e3),!Number.isInteger(e.samples)))throw new Error(`${t}: samples must be an integer.`);break;case"pause":R(e.ms,`${t}.ms`,0,3e4),le(e.ask,`${t}.ask`);break;case"prop":if(!El(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 ${Qi.join(", ")}${a}.`)}if(Fe(e,"at",t,o),e.size!==void 0&&(Z(e.size,`${t}.size`),typeof e.size=="number"&&R(e.size,`${t}.size`,10,1e3)),le(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(!Tl(e.name))throw new Error(`${t}.mood: only a person (person, person-pointing, person-sitting) has a face.`);ee(e.mood,Cl,`${t}.mood`)}break;case"repeat":if(Z(e.times,`${t}.times`),typeof e.times=="number"&&(R(e.times,`${t}.times`,0,Fh),!Number.isInteger(e.times)))throw new Error(`${t}.times: expected a whole number.`);Kt(e.step,`${t}.step`,n,"repeat",r);break;case"when":if(Z(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)=>Kt(a,`${t}.steps[${c}]`,n,s??"when"));break;case"move":if(K(e.target,`${t}.target`),!tt(n,String(e.target)))throw new Error(`${t}.target: no earlier step has the id "${e.target}".`);Q(e.to,`${t}.to`),ee(e.along,["line","curve"],`${t}.along`),e.ms!==void 0&&R(e.ms,`${t}.ms`,200,5e3);break;case"lottie":if(K(e.src,`${t}.src`),Q(e.at,`${t}.at`),e.size!==void 0&&(Z(e.size,`${t}.size`),typeof e.size=="number"&&R(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(K(e.target,`${t}.target`),!tt(n,String(e.target)))throw new Error(`${t}.target: no earlier step has the id "${e.target}".`);if(ee(e.effect,[...ql,"stop"],`${t}.effect`),e.effect===void 0)throw new Error(`${t}.effect: choose one of ${[...ql,"stop"].join(", ")}.`);ee(e.speed,["slow","fast"],`${t}.speed`);break;case"link":for(let a of["from","to"])if(K(e[a],`${t}.${a}`),!tt(n,String(e[a])))throw new Error(`${t}.${a}: no earlier step has the id "${e[a]}".`);le(e.label,`${t}.label`);break;case"counter":if(Fe(e,"at",t,o),Z(e.value,`${t}.value`),e.format!==void 0&&(K(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&&R(e.size,`${t}.size`,1,200),ee(e.anchor,["start","middle","end"],`${t}.anchor`);break;case"row":case"column":case"grid":if(r)throw new Error(`${t}: a ${e.type} cannot go inside another ${s}.`);if(Fe(e,"at",t,!1),e.gap!==void 0&&R(e.gap,`${t}.gap`,0,400),e.type==="grid"){if(R(e.columns,`${t}.columns`,1,12),!Number.isInteger(e.columns))throw new Error(`${t}.columns: expected a whole number.`)}else ee(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)=>{z(a,`${t}.steps[${c}]`);let l=a.type==="repeat"?a.step?.type:a.type;if(!et.includes(l))throw new Error(`${t}.steps[${c}]: a ${e.type} holds only ${et.join(", ")} (or a repeat of one).`);Kt(a,`${t}.steps[${c}]`,n,e.type)});break;case"chain":if(r)throw new Error(`${t}: a chain cannot go inside a ${s}.`);if(Fe(e,"at",t,!1),e.gap!==void 0&&e.gap!=="auto"&&R(e.gap,`${t}.gap`,0,400),ee(e.direction,["right","down"],`${t}.direction`),e.wrap!==void 0&&typeof e.wrap!="boolean")throw new Error(`${t}.wrap: expected true or false.`);if(le(e.forward,`${t}.forward`),le(e.back,`${t}.back`),e.size!==void 0&&(Z(e.size,`${t}.size`),typeof e.size=="number"&&R(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(z(a,`${t}.steps[${c}]`),!et.includes(a.type))throw new Error(`${t}.steps[${c}]: a chain holds only ${et.join(", ")}.`);Kt(a,`${t}.steps[${c}]`,n,"chain")});break;case"axis":case"timeline":if(Q(e.from,`${t}.from`),Q(e.to,`${t}.to`),Q(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)=>R(a,`${t}.ticks[${c}]`))}else if(R(e.ticks,`${t}.ticks`,0,30),!Number.isInteger(e.ticks))throw new Error(`${t}.ticks: expected a whole number.`)}if(le(e.label,`${t}.label`),e.format!==void 0&&(K(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)=>{z(a,`${t}.marks[${c}]`),Z(a.at,`${t}.marks[${c}].at`),le(a.label,`${t}.marks[${c}].label`),le(a.text,`${t}.marks[${c}].text`)})}break;case"balloon":if(K(e.to,`${t}.to`),!tt(n,String(e.to)))throw new Error(`${t}.to: no earlier step has the id "${e.to}".`);if(K(e.text,`${t}.text`),String(e.text).length>300)throw new Error(`${t}.text: keep a balloon under 300 characters.`);ee(e.side,["below","above","left","right"],`${t}.side`),ee(e.kind,["speech","thought"],`${t}.kind`),e.width!==void 0&&R(e.width,`${t}.width`,80,600),e.size!==void 0&&R(e.size,`${t}.size`,12,60);break;case"brace":if(Q(e.from,`${t}.from`),Q(e.to,`${t}.to`),le(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(Q(e.at,`${t}.at`),K(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(K(e.to,`${t}.to`),!tt(n,String(e.to)))throw new Error(`${t}.to: no earlier step has the id "${e.to}".`)}else Q(e.point,`${t}.point`);e.size!==void 0&&R(e.size,`${t}.size`,12,60);break;case"table":if(Q(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((l,d)=>{if(typeof l!="string"||l.length>120)throw new Error(`${t}.rows[${c}][${d}]: 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&&R(e.size,`${t}.size`,12,40);break;case"bars":z(e.box,`${t}.box`);for(let a of["x","y","w","h"])Z(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)=>Z(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)=>K(a,`${t}.labels[${c}]`))}if(e.max!==void 0&&Z(e.max,`${t}.max`),e.format!==void 0&&(K(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 jh(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(ns(e)||Object.hasOwn(ts,e)||Fl.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(z(t,n),!Array.isArray(t.shapes)||t.shapes.length===0||t.shapes.length>Rl)throw new Error(`${n}.shapes: expected 1 to ${Rl} shapes.`);let s=(i,r)=>{if(typeof i!="number"||!Number.isInteger(i)||i<0||i>100)throw new Error(`${r}: expected a whole number from 0 to 100 (the figure's grid, y down; it stands at 50,100).`)};t.shapes.forEach((i,r)=>{let o=`${n}.shapes[${r}]`;if(z(i,o),i.fill!==void 0&&(typeof i.fill!="string"||!/^(#[0-9a-fA-F]{3,8}|[a-z]{3,20})$/.test(i.fill)))throw new Error(`${o}.fill: a colour, as hex or a plain name.`);if(i.kind==="circle"){if(!Array.isArray(i.c)||i.c.length!==2)throw new Error(`${o}.c: expected [x, y].`);i.c.forEach((c,l)=>s(c,`${o}.c[${l}]`)),s(i.r,`${o}.r`);return}if(!["polygon","polyline","curve"].includes(i.kind))throw new Error(`${o}.kind: choose one of polygon, polyline, curve, circle.`);let a=i.kind==="polygon"?3:2;if(!Array.isArray(i.points)||i.points.length<a||i.points.length>40)throw new Error(`${o}.points: a ${i.kind} takes ${a} to 40 points.`);i.points.forEach((c,l)=>{if(!Array.isArray(c)||c.length!==2)throw new Error(`${o}.points[${l}]: expected [x, y].`);c.forEach((d,f)=>s(d,`${o}.points[${l}][${f}]`))})})}function _h(e,t){let n=`lottie "${e}"`;z(t,n);let s=JSON.stringify(t).length;if(s>Ll)throw new Error(`${n}: ${Math.round(s/1e3)} KB; an animation can have at most ${Ll/1e3} KB.`);for(let r of["fr","ip","op","w","h"])R(t[r],`${n}.${r}`,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 i=(r,o)=>{if(Array.isArray(r))return r.forEach((a,c)=>i(a,`${o}[${c}]`));if(!(!r||typeof r!="object"))for(let[a,c]of Object.entries(r)){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.`);i(c,`${o}.${a}`)}};i(t.layers,"layers");for(let r of Array.isArray(t.assets)?t.assets:[]){let o=r?.p;if(typeof o=="string"&&o&&!o.startsWith("data:")&&!Array.isArray(r.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 Bh(e){z(e,"The recipe");let t=e;R(t.width,"width",100,4e3),R(t.height,"height",100,4e3);for(let i of["id","title","category"])le(t[i],i);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(ee(t.background,["dots","grid","plain"],"background"),ee(t.kind,Dh,"kind"),le(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(ee(t.theme,["paper","chalkboard"],"theme"),t.quiz!==void 0){if(z(t.quiz,"quiz"),K(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((i,r)=>{if(z(i,`quiz.options[${r}]`),K(i.text,`quiz.options[${r}].text`),K(i.why,`quiz.options[${r}].why`),typeof i.right!="boolean")throw new Error(`quiz.options[${r}].right: expected true or false.`)}),t.quiz.options.filter(i=>i.right===!0).length!==1)throw new Error("quiz.options: exactly one option is right.")}if(t.learning!==void 0){z(t.learning,"learning");for(let i of["goal","question","answer","caveat"])K(t.learning[i],`learning.${i}`)}if(t.params!==void 0){z(t.params,"params");for(let[i,r]of Object.entries(t.params))if(ss(i),z(r,`params.${i}`),K(r.label,`params.${i}.label`),R(r.min,`${i}.min`),R(r.max,`${i}.max`),R(r.step,`${i}.step`,1e-6),R(r.value,`${i}.value`,r.min,r.max),r.max<=r.min)throw new Error(`${i}: max must be greater than min.`)}if(t.vars!==void 0){z(t.vars,"vars");for(let[i,r]of Object.entries(t.vars))ss(i),Z(r,`vars.${i}`)}if(t.switches!==void 0){z(t.switches,"switches");let i=Object.entries(t.switches);if(i.length>8)throw new Error("switches: at most 8.");for(let[r,o]of i){if(ss(r),Object.hasOwn(t.params??{},r)||Object.hasOwn(t.vars??{},r))throw new Error(`switches.${r}: the name is already a param or a var.`);if(z(o,`switches.${r}`),K(o.label,`switches.${r}.label`),typeof o.on!="boolean")throw new Error(`switches.${r}.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){z(t.defs,"defs");let i=Object.entries(t.defs);if(i.length>Pl)throw new Error(`defs: at most ${Pl} figures.`);for(let[r,o]of i)jh(r,o),n.add(r)}if(t.lotties!==void 0){z(t.lotties,"lotties");let i=Object.entries(t.lotties);if(i.length>Ml)throw new Error(`lotties: at most ${Ml} animations.`);let r=i.reduce((o,[a,c])=>o+_h(a,c),0);if(r>Il)throw new Error(`lotties: ${Math.round(r/1e3)} KB in all; at most ${Il/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((i,r)=>K(i,`credits[${r}]`))}let s={exact:new Set,repeated:new Set,count:0,figures:n};return t.steps.forEach((i,r)=>Kt(i,`Step ${r+1}`,s,null)),{...t,id:t.id??"pasted",title:t.title??"",background:t.background??"dots"}}export{Ui as DEFAULT_PROFILE,sr as agentsIn,xh as applyChanges,uh as compare,qp as extractAgent,Eh as fromSheets,Rt as groupPatterns,Pp as knownKinds,ae as labelOf,Mh as lessonOf,Hp as problemText,Vp as readCast,jp as readProfile,ph as reviewCast,Bh as validateScene,kh as workbookFile,Nh as workbookOf,Xp as writeCast};
|
|
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="${nr(o)}" sheetId="${a+1}" r:id="rId${a+1}"/>`).join("")}</sheets>${i?`<definedNames>${i}</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`,qh(o,n)])];return Lh(r.map(([o,a])=>[o,kl.encode(a)]))}var Mh=(()=>{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 Ph(e){let t=4294967295;for(let n=0;n<e.length;n++)t=Mh[(t^e[n])&255]^t>>>8;return(t^4294967295)>>>0}function Lh(e){let t=[],n=[],s=0;for(let[f,c]of e){let d=kl.encode(f),u=Ph(c),h=new DataView(new ArrayBuffer(30));h.setUint32(0,67324752,!0),h.setUint16(4,20,!0),h.setUint16(6,2048,!0),h.setUint16(8,0,!0),h.setUint32(14,u,!0),h.setUint32(18,c.length,!0),h.setUint32(22,c.length,!0),h.setUint16(26,d.length,!0),t.push(new Uint8Array(h.buffer),d,c);let b=new DataView(new ArrayBuffer(46));b.setUint32(0,33639248,!0),b.setUint16(4,20,!0),b.setUint16(6,20,!0),b.setUint16(8,2048,!0),b.setUint32(16,u,!0),b.setUint32(20,c.length,!0),b.setUint32(24,c.length,!0),b.setUint16(28,d.length,!0),b.setUint32(42,s,!0),n.push(new Uint8Array(b.buffer),d),s+=30+d.length+c.length}let i=n.reduce((f,c)=>f+c.length,0),r=new DataView(new ArrayBuffer(22));r.setUint32(0,101010256,!0),r.setUint16(8,e.length,!0),r.setUint16(10,e.length,!0),r.setUint32(12,i,!0),r.setUint32(16,s,!0);let o=[...t,...n,new Uint8Array(r.buffer)],a=new Uint8Array(o.reduce((f,c)=>f+c.length,0)),l=0;for(let f of o)a.set(f,l),l+=f.length;return a}var Ih=e=>$l(e),Rh={bold:!0,fill:"E8EEF7"},Fh={v:"\u25CF",fill:"DDF3E6",center:!0},Dh={v:"\xD7",fill:"FFD5CC",center:!0,bold:!0},jh={v:"\u25D0",fill:"FFF3C4",center:!0},_h={v:"\u2248",fill:"FFF6DC",center:!0,bold:!0},Sl=Object.keys(Gi);function Bh(e,t,n,s="en"){let i=rs[s],r=(k,I,X)=>({key:k,name:i[k],header:!0,columns:I.map(([p,w])=>({title:p,width:w})),rows:[I.map(([p])=>({v:p,...Rh})),...X]}),o=k=>i[e.roles[k]],a=k=>k.startsWith("type:")?`${i.type}:${e.typeNames[k.slice(5)]??k.slice(5)}`:i[k],l=k=>(e.types[k]??[]).map(I=>e.typeNames[I]??I).join(" \xB7 "),f=k=>ce(k,s,e.names),c=[...e.agents].sort((k,I)=>k.role===I.role?k.id.localeCompare(I.id):k.role==="orchestrator"?-1:1),d=[...new Set([...c.flatMap(k=>Object.keys(k.facts)),...e.patterns.map(k=>k.key)])].filter(k=>!k.endsWith("~variant")).sort((k,I)=>Sl.indexOf(_t(k))-Sl.indexOf(_t(I))||k.localeCompare(I)),u=new Set(e.offPattern.map(k=>`${k.agent} ${k.key}`)),h=k=>e.agents.filter(I=>I.role===k).length,b={key:"summary",name:i.summary,header:!1,columns:[{title:"",width:28},{title:"",width:100}],rows:[[{v:e.name??i.title,bold:!0},""],[{v:i.privacy,color:"B42318"},""],[i.count.agents,e.agents.length],[i.count.orchestrators,h("orchestrator")],[i.count.specialists,h("specialist")],[i.count.patterns,e.patterns.length],[i.count.off,new Set(e.offPattern.map(k=>k.agent)).size],[i.count.gaps,e.gaps.length],[i.count.conflicts,e.conflicts.length],[i.count.solos,t.filter(k=>k.key==="solo").length],[i.count.unused,e.unused.length],["",""],[{v:t.length?i.look:i.nothing,bold:!0},""],...t.map(k=>["",{v:k[s],wrap:!0}])]},m=r("matrix",[[i.dimension,18],[i.fact,40],[i.key,34],...c.map(k=>[k.id,14])],d.map(k=>[Gi[_t(k)][s],f(k),k,...c.map(I=>k in I.facts?k.startsWith("declared:")?jh:Fh:`${k}~variant`in I.facts?_h:u.has(`${I.id} ${k}`)?Dh:"")])),{look:y,everyone:O}=Kt(e),v=r("patterns",[[i.key,34],[i.fact,40],[i.scope,14],[i.role,14],[i.share,10],[i.have,50],[i.lack,40],[i.decision,12],[i.why,50]],[...y,...O].map(k=>{let I=e.offPattern.filter(X=>X.key===k.key).map(X=>X.agent);return[k.key,f(k.key),a(k.scope),i[k.role],`${Math.round(k.share*100)}%`,k.agents.join(", "),I.join(", "),k.decision?i[k.decision.status==="accepted"?"accept":"reject"]:"",k.decision?.why??""]})),S=r("off",[[i.agent,24],[i.role,14],[i.missing,44],[i.key,34],[i.scope,14],[i.accepted,14]],e.offPattern.map(k=>[k.agent,o(k.agent),f(k.key),k.key,a(k.scope),e.patterns.find(I=>I.key===k.key)?.decision?.status==="accepted"?i.yes:""])),M=r("gaps",[[i.rule,16],[i.says,50],[i.role,14],[i.notMet,60]],e.gaps.map(k=>[k.rule.id,k.rule.says,k.rule.role?i[k.rule.role]:"",k.agents.join(", ")])),$=r("conflicts",[[i.agent,24],[i.fact,40],[i.key,34],[i.declared,20],[i.source,40],[i.inYaml,12]],e.conflicts.map(k=>[k.agent,f(k.key),k.key,k.declared,k.source,k.observed?i.yes:i.no])),N=r("agents",[[i.agent,24],[i.name,32],[i.role,14],[i.types,24],[i.facts,8],[i.off,44],[i.alone,44],[i.children,24],[i.unknown,12]],c.map(k=>[k.id,k.displayName??"",i[k.role],l(k.id),Object.keys(k.facts).length,e.offPattern.filter(I=>I.agent===k.id).map(I=>f(I.key)).join("; "),e.solos.filter(I=>I.agents[0]===k.id).map(I=>f(I.key)).join("; "),k.children.map(I=>I.name).join(", "),e.unknown.filter(I=>I.agent===k.id).length||""])),q=r("evidence",[[i.agent,30],[i.fact,40],[i.key,34],[i.file,50],[i.line,8]],c.flatMap(k=>[{who:k.id,facts:k.facts},...k.children.map(I=>({who:`${k.id} \u203A ${I.name}`,facts:I.facts}))]).flatMap(({who:k,facts:I})=>Object.entries(I).sort(([X],[p])=>X.localeCompare(p)).flatMap(([X,p])=>p.map(w=>[k,f(X),X,w.file,w.line??""])))),g=r("declared",[[i.agent,24],[i.key,34],[i.value,40],[i.source,40]],n.declared.map(k=>[k.agent,k.key,k.value,k.source])),E=r("text",[[i.id,28],[i.label,36],[i.body,70],[i.have,50],[i.variant,40],[i.official,10]],e.blocks.map(k=>[k.id,k.official??k.label,{v:k.text,wrap:!0},Object.keys(k.holders).sort().join(", "),Object.entries(k.variants).sort(([I],[X])=>I.localeCompare(X)).map(([I,X])=>`${I} (${Math.round(X.similarity*100)}%)`).join(", "),k.official?i.yes:""])),L=r("routing",[[i.caller,24],[i.called,30],[i.history,10],[i.inputs,30],[i.routingText,70],[i.chars,10],[i.file,44]],e.contract.routes.map(k=>[k.caller,k.agent??`${k.name??k.calls} (${i.notInFolder})`,k.history?i.yes:i.no,k.inputs.join(", "),{v:k.description,wrap:!0},k.description.length,`${k.file}${k.line?`:${k.line}`:""}`])),Y=r("unused",[[i.agent,24],[i.what,16],[i.name,30],[i.how,14],[i.file,50]],e.unused.flatMap(k=>k.sources.map(I=>[k.agent,i.thing[k.what]??k.what,e.names[k.name]??k.name,i[k.how],`${I.file}${I.line?`:${I.line}`:""}`]))),F=[b,m,v,...e.blocks.length?[E]:[],...e.contract.routes.length?[L]:[],S,M,$,...e.unused.length?[Y]:[],N,q,g];return e.unknown.length&&F.push(r("unknown",[[i.agent,24],[i.file,50],[i.why,40],[i.kind,24]],e.unknown.map(k=>[k.agent,k.file,i.why_[k.why],k.kind??""]))),F}var ye=e=>String(e??"").normalize("NFD").replace(/[̀-ͯ]/g,"").trim().toLowerCase(),Yt=Object.values(rs),vl=(e,t)=>e.find(n=>Yt.some(s=>ye(s[t])===ye(n.name)));function Ol(e,...t){let n=t.map(s=>e?.rows[0]?.findIndex(i=>Yt.some(r=>ye(r[s])===ye(i)))??-1);return s=>n.map(i=>i<0?"":String(s[i]??"").trim())}var Al=(e,t)=>t.find(([,n])=>Yt.some(s=>ye(s[n])===ye(e)))?.[0],Nl=e=>e.slice(1).filter(t=>t.some(n=>String(n??"").trim())),El=(e,t)=>JSON.stringify(e)===JSON.stringify(t);function Kh(e,t,n={}){let s=[],i=[],r=vl(t,"declared");if(r){let a=Ol(r,"agent","key","value","source"),l=[];Nl(r.rows).forEach((d,u)=>{let[h,b,m,y]=a(d);!h||!b?i.push(`${r.name}, ${u+2}: \xAB${a(r.rows[0])[h?1:0]}\xBB ?`):l.push({agent:h,key:b,value:m,source:y})});let f=d=>`${d.agent} ${d.key}`,c=0;for(let d of l){let u=e.declared.find(h=>f(h)===f(d));u?El(u,d)||s.push({key:`d${++c}`,kind:"declared",op:"set",before:u,after:d}):s.push({key:`d${++c}`,kind:"declared",op:"add",after:d})}for(let d of e.declared)l.some(u=>f(u)===f(d))||s.push({key:`d${++c}`,kind:"declared",op:"remove",before:d})}let o=vl(t,"patterns");if(o){let a=Ol(o,"key","scope","decision","why"),l=0;for(let f of Nl(o.rows)){let[c,d,u,h]=a(f);if(!c)continue;let b=e.decisions.find(S=>S.key===c);if(!u){b&&s.push({key:`p${++l}`,kind:"decision",op:"remove",before:b});continue}let m=Al(u,[["accepted","accept"],["rejected","reject"]]),y=/^(tipo|type)\s*:\s*(.+)$/i.exec(d),O=y?Object.entries(n).find(([S,M])=>ye(M)===ye(y[2])||ye(S)===ye(y[2]))?.[0]:void 0,v=y?O?`type:${O}`:void 0:Al(d,[["platform","platform"],["specialist","specialist"],["orchestrator","orchestrator"]]);if(!m)i.push(`${o.name}, ${c}: \xAB${u}\xBB \u2014 ${Yt.map(S=>`${S.accept}/${S.reject}`).join(", ")}`);else if(!v)i.push(`${o.name}, ${c}: \xAB${d}\xBB \u2014 ${Yt.map(S=>`${S.platform}/${S.specialist}/${S.orchestrator}`).join(", ")}`);else{let S={key:c,status:m,scope:v,why:h};b?El(b,S)||s.push({key:`p${++l}`,kind:"decision",op:"set",before:b,after:S}):s.push({key:`p${++l}`,kind:"decision",op:"add",after:S})}}}return{changes:s,problems:i}}function Uh(e,t,n){let s={...e,declared:[...e.declared],decisions:[...e.decisions]};for(let i of t.filter(r=>n.includes(r.key)))if(i.kind==="declared"){let r=a=>`${a.agent} ${a.key}`,o=i.before?s.declared.findIndex(a=>r(a)===r(i.before)):-1;i.op==="add"?s.declared.push(i.after):i.op==="set"?s.declared[o]=i.after:s.declared.splice(o,1)}else{let r=i.before?s.decisions.findIndex(o=>o.key===i.before.key):-1;i.op==="add"?s.decisions.push(i.after):i.op==="set"?s.decisions[r]=i.after:s.decisions.splice(r,1)}return s}var Wt="#8C8578";var os="#C8442C",Cl="#2E8F62";var xl=e=>Math.round(e*10)/10,zt=e=>[xl(e[0]),xl(e[1])],$e=(e,t,n=22,s="start",i)=>({type:"text",at:zt(e),text:t,size:n,anchor:s,...i?{style:{color:i}}:{}}),Tl=(e,t,n)=>({type:"line",from:zt(e),to:zt(t),...n?{style:n}:{}}),ql=(e,t,n)=>({type:"arrow",from:zt(e),to:zt(t),...n?{style:n}:{}});var Yh=(e,t)=>e.length*t*.48;function as(e,t,n){let s=[],i="";for(let r of e.split(/\s+/).filter(Boolean)){let o=i?`${i} ${r}`:r;i&&Yh(o,t)>n?(s.push(i),i=r):i=o}return i&&s.push(i),s.length?s:[""]}var st=150,Vt=40,zh=24,Ml=250,Pl="#7B4FC9",Ll=17,Il=23,sr=5,ir=4,Wh=/^(auth|model|setting|topics|connref|operation):/,Vh={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 Jh(e,t,n="en"){let s=Vh[n],i=e.agents.filter(p=>p.role==="orchestrator").sort((p,w)=>p.id.localeCompare(w.id)),r=Object.keys(e.typeNames),o=p=>{let w=(e.types[p]??[])[0];return w===void 0?r.length:r.indexOf(w)},a=e.agents.filter(p=>p.role==="specialist").sort((p,w)=>o(p.id)-o(w.id)||p.id.localeCompare(w.id)),l=r.length>0&&a.some(p=>(e.types[p.id]??[]).length),f=l?390:340,c=Math.max(1,Math.ceil(a.length/zh)),d=Math.max(1,Math.ceil(a.length/c)),u=Math.max(1e3,Vt*2+Math.max(d,i.length)*st),h=(p,w)=>u/2+(p-(w-1)/2)*st,b=p=>il(p)?0:Wh.test(p)?2:1,m=[{...$e([Vt,52],e.name??s.chapters[0],30),chapter:s.chapters[0],say:`${e.name?`${e.name}: `:""}${s.cast(i.length,a.length)}`}],y=(p,w,x)=>as(p,15,st-12).slice(0,2).forEach((T,j)=>m.push($e([w[0],w[1]+j*18],T,15,"middle",x))),O=170,v=new Map;i.forEach((p,w)=>{let x=h(w,i.length);v.set(p.id,[x,O]),m.push({type:"prop",name:"robot",at:[x,O],size:70}),y(p.id,[x,O+24],Wt)}),a.forEach((p,w)=>{let x=Math.floor(w/d),T=Math.min(d,a.length-x*d),j=[h(w%d,T),f+x*Ml];v.set(p.id,j),m.push({type:"prop",name:"robot",at:j,size:64}),y(p.id,[j[0],j[1]+24])});for(let p of i){let w=v.get(p.id);for(let x of a.filter(T=>T.schemaName&&`calls:${T.schemaName}`in p.facts)){let T=v.get(x.id);T[1]===f&&m.push(ql([w[0],w[1]+44],[T[0],T[1]-(l?118:76)],{color:Wt}))}}if(l){let p=[];a.forEach(w=>{let x=(e.types[w.id]??[])[0],T=x===void 0?n==="pt"?"sem tipo":"no type":e.typeNames[x]??x,[j,D]=v.get(w.id),ie=p[p.length-1];ie&&ie.name===T&&ie.y===D?ie.xs.push(j):p.push({name:T,xs:[j],y:D})});for(let w of p){let[x,T]=[Math.min(...w.xs),Math.max(...w.xs)];m.push($e([(x+T)/2,w.y-92],w.name,16,"middle",Pl),Tl([x-st/2+14,w.y-84],[T+st/2-14,w.y-84],{color:Pl}))}}let S=f+(c-1)*Ml+160,M=(u-Vt*2)/3,$=S,N=(p,w,x,T,j)=>{let D=Vt+p*M;m.push({...$e([D,S],w,22,"start",j),chapter:w,say:x});let ie=S+34,Se=T.slice(0,sr);T.length>sr&&Se.push(s.more(T.length-sr)),Se.length||Se.push(s.none);for(let ot of Se){let Gt=as(ot,Ll,M-30),or=Gt.length>ir?[...Gt.slice(0,ir-1),`${Gt[ir-1]}\u2026`]:Gt;or.forEach((Hl,us)=>m.push($e([D+(us?14:0),ie+us*Il],`${us?"":"\xB7 "}${Hl}`,Ll,"start",Wt))),ie+=or.length*Il+6}$=Math.max($,ie)},q=e.patterns.filter(p=>!p.partOf).sort((p,w)=>b(p.key)-b(w.key)||(p.scope===w.scope?0:p.scope==="platform"?-1:1)||w.share-p.share||p.key.localeCompare(w.key)),g=p=>p==="platform"?s.platform:s.specialist;N(0,s.chapters[1],s.repeats(e.patterns.length,e.patterns.filter(p=>p.scope==="platform").length,e.patterns.filter(p=>p.scope!=="platform").length),q.map(p=>`${ce(p.key,n,e.names)} \xB7 ${g(p.scope)}${p.share<1?` \xB7 ${Math.round(p.share*100)}%`:""}`),Cl);let E=[...new Set(e.offPattern.map(p=>p.agent))].sort();E.forEach((p,w)=>{let x=v.get(p),T=D=>D.variant?`${n==="pt"?"varia\xE7\xE3o de":"a variation of"} \xAB${ce(D.key,n,e.names)}\xBB`:ts(D.key,n,1,e.names),j=e.offPattern.filter(D=>D.agent===p).sort((D,ie)=>b(D.key)-b(ie.key)).flatMap(D=>as(T(D),13,st-10)).slice(0,4);m.push({...$e([x[0]+34,x[1]-50],"\xD7",30,"middle",os),...w===0?{chapter:s.chapters[2],say:s.off(E)}:{}}),j.forEach((D,ie)=>m.push($e([x[0],x[1]+66+ie*16],D,13,"middle",os)))}),E.length||m.push({...$e([u-Vt,92],s.off([]),16,"end",Wt),chapter:s.chapters[2],say:s.off([])});let L=e.gaps.flatMap(p=>{let w=p.agents.filter(x=>!e.offPattern.some(T=>T.agent===x&&T.key===p.rule.has)).length;return w?[n==="pt"?`\xAB${p.rule.says}\xBB: ${w}${p.rule.role?` ${ae(p.rule.role,n,w)}`:""} n\xE3o ${w===1?"cumpre":"cumprem"}`:`\xAB${p.rule.says}\xBB: ${w}${p.rule.role?` ${ae(p.rule.role,n,w)}`:""} ${w===1?"does":"do"} not meet it`]:[]});L.push(...t.filter(p=>p.key==="contract"||p.key==="flow").map(p=>p[n]));let Y=e.unknown.length;Y&&L.push(n==="pt"?`${Y} ${Y===1?"arquivo n\xE3o entendido":"arquivos n\xE3o entendidos"}`:`${Y} ${Y===1?"file":"files"} not understood`),N(1,s.chapters[3],s.missing(t.filter(p=>p.key==="gap").length),L,os);let F=t.filter(p=>p.key==="unused").length,{look:k}=Kt(e),I=[...t.filter(p=>p.key==="conflict"||p.key==="values"||p.key==="twice").map(p=>p[n]),...F?[s.unused(F)]:[],...k.filter(p=>!p.decision).map(p=>s.pattern(ce(p.key,n,e.names))),...t.filter(p=>p.key==="solo").map(p=>p[n])];return N(2,s.chapters[4],s.decide(I.length),I),{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:u,height:Math.min(4e3,$+40),background:"plain",locale:n==="pt"?"pt-BR":"en-US",steps:m}}var Rl=["and","or","not"];var rr=["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"},cs=e=>rr.includes(e)?e:typeof e=="string"&&Object.hasOwn(ls,e)?ls[e]:void 0;var Dl=e=>cs(e)!==void 0,A={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"},P=(e,t,n,s,i,r)=>({kind:"polygon",points:[[e,t],[e+n,t],[e+n,t+s],[e,t+s]],fill:i,main:r}),R=(...e)=>({kind:"polyline",points:e});function jl(e){return[{kind:"polygon",points:[[-.15,-.72],[.15,-.72],[.19,-.38],[-.19,-.38]],fill:A.shirt,main:!0},{kind:"circle",c:[0,-.87],r:.11,fill:A.skin},...e,R([-.08,-.38],[-.1,0]),R([.08,-.38],[.1,0])]}var Fl=jl([R([-.15,-.7],[-.25,-.42]),R([.15,-.7],[.25,-.42])]);function Gh(e,t,n){let s=([i,r])=>[n+i*t,r*t];return e.map(i=>i.kind==="circle"?{...i,c:s(i.c),r:i.r*t}:{...i,points:i.points.map(s)})}function Hh(){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,i=e.filter(([r,,o])=>Math.abs(s-r)<=o).map(([r,o,a])=>o-Math.sqrt(Math.max(0,a*a-(s-r)**2)));i.length&&t.push([s,Math.min(...i)])}return[...t,[.42,-.12],[-.4,-.12]]}var y0={person:Fl,"person-pointing":jl([R([-.15,-.7],[-.25,-.42]),R([.15,-.69],[.47,-.73])]),"person-sitting":[R([-.3,-.8],[-.27,-.4]),R([-.32,-.4],[.2,-.4]),R([-.27,-.4],[-.27,0]),R([.16,-.4],[.16,0]),{kind:"polygon",points:[[-.22,-.77],[.04,-.77],[.06,-.44],[-.22,-.44]],fill:A.shirt,main:!0},{kind:"circle",c:[-.08,-.9],r:.1,fill:A.skin},R([-.1,-.44],[.3,-.44],[.32,0]),R([0,-.74],[.18,-.55],[.3,-.58])],house:[P(-.4,-.6,.8,.6,A.wall,!0),{kind:"polygon",points:[[-.5,-.58],[0,-1],[.5,-.58]],fill:A.roof},P(-.08,-.32,.16,.32,A.wood),P(.16,-.46,.16,.14,A.screen)],car:[{kind:"polygon",fill:A.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:A.screen},{kind:"circle",c:[-.28,-.12],r:.1,fill:A.dark},{kind:"circle",c:[.28,-.12],r:.1,fill:A.dark}],bus:[P(-.5,-.66,1,.52,A.bus,!0),...[-.42,-.21,0,.21].map(e=>P(e,-.6,.15,.16,A.screen)),R([-.5,-.3],[.5,-.3]),{kind:"circle",c:[-.3,-.12],r:.1,fill:A.dark},{kind:"circle",c:[.3,-.12],r:.1,fill:A.dark}],coin:[{kind:"circle",c:[0,-.42],r:.4,fill:A.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]]},R([0,-.64],[0,-.2])],phone:[P(-.26,-1,.52,1,A.device,!0),P(-.2,-.92,.4,.76,A.screen),{kind:"circle",c:[0,-.08],r:.035,fill:A.paper}],document:[{kind:"polygon",points:[[-.36,-1],[.16,-1],[.36,-.8],[.36,0],[-.36,0]],fill:A.paper,main:!0},R([.16,-1],[.16,-.8],[.36,-.8]),...[-.66,-.5,-.34,-.18].map(e=>R([-.22,e],[.22,e]))],server:[-1,-.66,-.32].flatMap(e=>[P(-.36,e,.72,.3,A.metal,!0),R([-.26,e+.15],[.06,e+.15]),{kind:"circle",c:[.22,e+.15],r:.035,fill:A.green}]),bank:[{kind:"polygon",points:[[-.5,-.74],[0,-1],[.5,-.74]],fill:A.wall,main:!0},P(-.45,-.74,.9,.08,A.wall),...[-.33,-.11,.11,.33].map(e=>P(e-.04,-.66,.08,.56,A.paper)),P(-.5,-.1,1,.1,A.wall)],cloud:[{kind:"polygon",points:Hh(),fill:A.paper,main:!0}],queue:[-.32,0,.32].flatMap(e=>Gh(Fl,.7,e)),desk:[P(-.5,-.5,1,.07,A.wood,!0),R([-.42,-.43],[-.42,0]),R([.42,-.43],[.42,0])],computer:[P(-.45,-1,.9,.6,A.device,!0),P(-.39,-.94,.78,.48,A.screen),{kind:"polygon",points:[[-.06,-.4],[.06,-.4],[.1,-.1],[-.1,-.1]],fill:A.device},P(-.25,-.1,.5,.08,A.device)],clock:[{kind:"circle",c:[0,-.48],r:.45,fill:A.paper,main:!0},...[[0,-.9,0,-.82],[.42,-.48,.34,-.48],[0,-.06,0,-.14],[-.42,-.48,-.34,-.48]].map(([e,t,n,s])=>R([e,t],[n,s])),R([0,-.48],[0,-.78]),R([0,-.48],[.2,-.48])],lock:[{kind:"curve",points:[[-.22,-.52],[-.22,-.76],[0,-.96],[.22,-.76],[.22,-.52]]},P(-.36,-.54,.72,.54,A.bus,!0),{kind:"circle",c:[0,-.32],r:.06,fill:A.dark},R([0,-.28],[0,-.14])],"money-arrow":[{kind:"polygon",fill:A.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:A.gold},R([-.2,-.4],[-.2,-.2])],tree:[P(-.07,-.36,.14,.36,A.wood),{kind:"circle",c:[0,-.64],r:.3,fill:A.green,main:!0}],school:[P(-.45,-.6,.9,.6,A.wall,!0),{kind:"polygon",points:[[-.5,-.6],[0,-.82],[.5,-.6]],fill:A.roof},P(-.08,-.28,.16,.28,A.wood),P(-.36,-.48,.16,.12,A.screen),P(.2,-.48,.16,.12,A.screen),R([0,-.82],[0,-1]),{kind:"polygon",points:[[0,-1],[.17,-.95],[0,-.9]],fill:A.roof}],hospital:[P(-.4,-.8,.8,.8,A.paper,!0),P(-.045,-.7,.09,.26,"#C8442C"),P(-.13,-.615,.26,.09,"#C8442C"),P(-.1,-.24,.2,.24,A.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:A.wall,main:!0},P(.3,-.95,.12,.3,A.dark),P(-.38,-.32,.16,.12,A.screen),P(-.08,-.32,.16,.12,A.screen),P(.22,-.32,.16,.12,A.screen)],truck:[P(-.5,-.62,.62,.46,A.metal,!0),{kind:"polygon",points:[[.12,-.16],[.12,-.5],[.34,-.5],[.48,-.32],[.48,-.16]],fill:A.bus},{kind:"polygon",points:[[.18,-.46],[.32,-.46],[.42,-.33],[.18,-.33]],fill:A.screen},{kind:"circle",c:[-.3,-.1],r:.1,fill:A.dark},{kind:"circle",c:[.3,-.1],r:.1,fill:A.dark}],cart:[R([-.48,-.78],[-.4,-.62]),{kind:"polygon",points:[[-.4,-.62],[.42,-.62],[.32,-.26],[-.3,-.26]],fill:A.metal,main:!0},R([-.3,-.26],[-.3,-.14],[.32,-.14]),{kind:"circle",c:[-.22,-.07],r:.06,fill:A.dark},{kind:"circle",c:[.24,-.07],r:.06,fill:A.dark}],safe:[P(-.4,-.82,.8,.82,A.device,!0),P(-.3,-.72,.6,.62,A.metal),{kind:"circle",c:[0,-.41],r:.13,fill:A.paper},R([0,-.41],[.08,-.47])],bulb:[{kind:"circle",c:[0,-.62],r:.3,fill:A.gold,main:!0},P(-.13,-.33,.26,.2,A.metal),{kind:"curve",points:[[-.09,-.52],[0,-.66],[.09,-.52]]},R([-.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:A.metal,main:!0},{kind:"circle",c:[0,-.5],r:.12,fill:A.paper}],database:[{kind:"polygon",points:[[-.35,-.8],[.35,-.8],[.35,-.16],[-.35,-.16]],fill:A.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:A.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:[R([0,-.95],[0,-1]),P(-.22,-.95,.44,.3,A.metal),{kind:"circle",c:[-.09,-.81],r:.045,fill:A.screen},{kind:"circle",c:[.09,-.81],r:.045,fill:A.screen},P(-.28,-.62,.56,.42,A.metal,!0),R([-.28,-.55],[-.42,-.35]),R([.28,-.55],[.42,-.35]),P(-.2,-.2,.12,.2,A.device),P(.08,-.2,.12,.2,A.device)],ship:[{kind:"polygon",points:[[-.48,-.3],[.48,-.3],[.36,-.04],[-.4,-.04]],fill:A.car,main:!0},P(-.42,-.62,.14,.32,A.wall),P(-.24,-.5,.2,.2,A.roof),P(-.02,-.5,.2,.2,A.bus),P(.2,-.5,.2,.2,A.green),{kind:"curve",points:[[-.5,0],[-.3,-.04],[-.1,0],[.1,-.04],[.3,0],[.5,-.04]]}],container:[P(-.46,-.52,.92,.52,A.roof,!0),...[-.3,-.15,0,.15,.3].map(e=>R([e,-.48],[e,-.04]))],warehouse:[{kind:"polygon",points:[[-.46,0],[.46,0],[.46,-.55],[0,-.82],[-.46,-.55]],fill:A.wall,main:!0},P(-.2,-.38,.4,.38,A.metal),R([-.2,-.26],[.2,-.26]),R([-.2,-.13],[.2,-.13])],box:[P(-.36,-.5,.52,.5,A.wood,!0),{kind:"polygon",points:[[-.36,-.5],[.16,-.5],[.36,-.64],[-.16,-.64]],fill:A.wood},{kind:"polygon",points:[[.16,0],[.36,-.14],[.36,-.64],[.16,-.5]],fill:A.wood},R([-.1,-.5],[.1,-.64])],pallet:[P(-.46,-.12,.92,.06,A.wood),...[-.42,-.05,.32].map(e=>P(e,-.06,.1,.06,A.wood)),P(-.42,-.5,.4,.38,A.wood,!0),P(.02,-.5,.4,.38,A.wood),P(-.2,-.82,.4,.32,A.wood)],shop:[P(-.42,-.6,.84,.6,A.wall,!0),{kind:"polygon",points:[[-.48,-.6],[.48,-.6],[.42,-.78],[-.42,-.78]],fill:A.roof},P(-.34,-.48,.34,.26,A.screen),P(.08,-.42,.24,.42,A.wood)],shelf:[P(-.4,-.92,.8,.92,A.paper,!0),R([-.4,-.62],[.4,-.62]),R([-.4,-.32],[.4,-.32]),P(-.32,-.8,.16,.18,A.roof),P(-.1,-.78,.14,.16,A.bus),P(.1,-.5,.22,.18,A.green),P(-.3,-.2,.24,.2,A.wood)],field:[R([-.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:A.green,main:!0},{kind:"circle",c:[e+.08,-.42],r:.07,fill:A.green,main:!0},{kind:"circle",c:[e,-.52],r:.06,fill:A.roof}])],cup:[{kind:"polygon",points:[[-.26,-.52],[.26,-.52],[.2,-.1],[-.2,-.1]],fill:A.paper,main:!0},{kind:"curve",points:[[.24,-.44],[.4,-.38],[.22,-.2]]},{kind:"polygon",points:[[-.46,-.1],[.46,-.1],[.36,0],[-.36,0]],fill:A.paper},{kind:"curve",points:[[-.08,-.62],[-.02,-.72],[-.08,-.84]]},{kind:"curve",points:[[.08,-.62],[.14,-.72],[.08,-.84]]}],function:[P(-.38,-.72,.76,.62,A.screen,!0),R([-.14,-.62],[0,-.62],[.14,-.2]),R([.02,-.42],[-.14,-.2])],"api-gateway":[P(-.12,-.8,.24,.8,A.metal,!0),R([-.48,-.55],[-.16,-.55]),R([-.24,-.62],[-.16,-.55],[-.24,-.48]),R([.16,-.3],[.48,-.3]),R([.4,-.37],[.48,-.3],[.4,-.23])],cache:[P(-.34,-.66,.68,.66,A.metal,!0),{kind:"polygon",points:[[.04,-.58],[-.12,-.3],[0,-.3],[-.06,-.08],[.14,-.38],[.02,-.38]],fill:A.gold}],cluster:[{kind:"curve",points:[[-.4,-.8],[0,-.86],[.4,-.8],[.48,-.45],[.4,-.1],[0,-.04],[-.4,-.1],[-.48,-.45],[-.4,-.8]]},P(-.3,-.7,.24,.2,A.screen,!0),P(.06,-.7,.24,.2,A.screen,!0),P(-.12,-.38,.24,.2,A.screen,!0)],board:[P(-.48,-.9,.96,.6,A.board,!0),P(-.34,-.76,.42,.03,A.chalk),P(-.34,-.62,.58,.03,A.chalk),P(-.34,-.48,.3,.03,A.chalk),R([-.3,-.3],[-.36,0]),R([.3,-.3],[.36,0])],book:[{kind:"polygon",points:[[0,-.62],[-.46,-.7],[-.46,-.1],[0,-.04]],fill:A.paper,main:!0},{kind:"polygon",points:[[0,-.62],[.46,-.7],[.46,-.1],[0,-.04]],fill:A.paper,main:!0},R([-.36,-.52],[-.1,-.48]),R([-.36,-.38],[-.1,-.34]),R([.1,-.48],[.36,-.52]),R([.1,-.34],[.36,-.38])],pencil:[{kind:"polygon",points:[[-.38,-.12],[.22,-.72],[.34,-.6],[-.26,0]],fill:A.bus,main:!0},{kind:"polygon",points:[[.22,-.72],[.34,-.6],[.44,-.86]],fill:A.wood},{kind:"polygon",points:[[-.38,-.12],[-.26,0],[-.46,-.02]],fill:A.roof}]},_l=["happy","sad","surprised","worried","idea"],Xh={person:[0,-.87,.11],"person-pointing":[0,-.87,.11],"person-sitting":[-.08,-.9,.1]},Bl=e=>{let t=cs(e);return!!t&&t in Xh};var Kl=["spin","drive","steam","talk","pulse","float"],Qh=["lesson","pitch","arch","decision","data","timeline","story"],Ul=8,Yl=6,zl=2e5,Wl=6e5,Vl=24;var Gl=["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"],it=["text","prop","card","counter","circle","ellipse"],Jl=["row","column","grid","chain"],Zh=50;function J(e,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error(`${t}: expected an object.`)}function z(e,t){if(typeof e!="string"||!e.trim()||e.length>2e3)throw new Error(`${t}: expected text of 1 to 2000 characters.`)}function B(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 te(e,t){if(typeof e=="string"){if(z(e,t),e.length>300)throw new Error(`${t}: expression too long.`)}else B(e,t)}function ee(e,t){if(!Array.isArray(e)||e.length!==2)throw new Error(`${t}: expected [x, y].`);e.forEach((n,s)=>te(n,`${t}[${s}]`))}function fe(e,t){e!==void 0&&z(e,t)}function ne(e,t,n){if(e!==void 0&&(typeof e!="string"||!t.includes(e)))throw new Error(`${n}: choose one of ${t.join(", ")}.`)}function fs(e){if(!/^[A-Za-z_][A-Za-z_0-9]*$/.test(e)||["__proto__","constructor","prototype",...Rl].includes(e))throw new Error(`Invalid variable name: "${e}".`)}var rt=(e,t)=>t.includes("{")||e.exact.has(t)||[...e.repeated].some(n=>t.startsWith(`${n}-`)&&/^\d+$/.test(t.slice(n.length+1)));function Be(e,t,n,s){s&&e[t]===void 0&&(e[t]=[0,0]),ee(e[t],`${n}.${t}`)}function Jt(e,t,n,s,i=!1){if(J(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(Jl.includes(s)&&e.place!==void 0)throw new Error(`${t}.place: the ${s} places the steps inside it.`)}if(!Gl.includes(e.type))throw new Error(`${t}: unknown type "${e.type}".`);for(let a of["id","say","chapter"])fe(e[a],`${t}.${a}`);if(e.duration!==void 0&&B(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,l)=>B(a,`${t}.nudge[${l}]`,-900,900))}let r=s!==null&&Jl.includes(s)||i;if(e.place!==void 0){if(!it.includes(e.type))throw new Error(`${t}.place: only ${it.join(", ")} can be placed.`);if(J(e.place,`${t}.place`),z(e.place.to,`${t}.place.to`),!rt(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&&B(e.place.gap,`${t}.place.gap`,-200,400),ne(e.place.align,["center","start","end"],`${t}.place.align`)}let o=r||e.place!==void 0;if(e.style!==void 0){J(e.style,`${t}.style`);for(let a of["color","fill"]){let l=e.style[a];if(l!==void 0&&(typeof l!="string"||!/^(#[\da-f]{3,8}|[a-z]+)$/i.test(l)))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&&B(e.style[a],`${t}.style.${a}`,0,20);if(e.style.opacity!==void 0&&B(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.`);ne(e.style.fillStyle,["hachure","solid","zigzag","cross-hatch","dots"],`${t}.style.fillStyle`)}switch(e.type){case"line":case"arrow":case"highlight":ee(e.from,`${t}.from`),ee(e.to,`${t}.to`),e.thickness!==void 0&&B(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,l)=>ee(a,`${t}.points[${l}]`));break;case"circle":case"ellipse":Be(e,"center",t,o);for(let a of e.type==="circle"?["r"]:["rx","ry"])te(e[a],`${t}.${a}`),typeof e[a]=="number"&&B(e[a],`${t}.${a}`,0);break;case"text":Be(e,"at",t,o),z(e.text,`${t}.text`),e.size!==void 0&&B(e.size,`${t}.size`,1,200),e.rotate!==void 0&&B(e.rotate,`${t}.rotate`,-360,360),ne(e.font,["hand","body"],`${t}.font`),ne(e.anchor,["start","middle","end"],`${t}.anchor`);break;case"card":Be(e,"at",t,o),te(e.w,`${t}.w`),te(e.h,`${t}.h`);for(let a of["w","h"])typeof e[a]=="number"&&B(e[a],`${t}.${a}`,40);if(z(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,l)=>z(a,`${t}.lines[${l}]`))}break;case"plot":z(e.fn,`${t}.fn`),e.var!==void 0&&(z(e.var,`${t}.var`),fs(String(e.var))),ee(e.domain,`${t}.domain`),ee(e.range,`${t}.range`),J(e.box,`${t}.box`);for(let a of["x","y","w","h"])te(e.box[a],`${t}.box.${a}`);if(e.samples!==void 0&&(B(e.samples,`${t}.samples`,2,1e3),!Number.isInteger(e.samples)))throw new Error(`${t}: samples must be an integer.`);break;case"pause":B(e.ms,`${t}.ms`,0,3e4),fe(e.ask,`${t}.ask`);break;case"prop":if(!Dl(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 ${rr.join(", ")}${a}.`)}if(Be(e,"at",t,o),e.size!==void 0&&(te(e.size,`${t}.size`),typeof e.size=="number"&&B(e.size,`${t}.size`,10,1e3)),fe(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(!Bl(e.name))throw new Error(`${t}.mood: only a person (person, person-pointing, person-sitting) has a face.`);ne(e.mood,_l,`${t}.mood`)}break;case"repeat":if(te(e.times,`${t}.times`),typeof e.times=="number"&&(B(e.times,`${t}.times`,0,Zh),!Number.isInteger(e.times)))throw new Error(`${t}.times: expected a whole number.`);Jt(e.step,`${t}.step`,n,"repeat",r);break;case"when":if(te(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,l)=>Jt(a,`${t}.steps[${l}]`,n,s??"when"));break;case"move":if(z(e.target,`${t}.target`),!rt(n,String(e.target)))throw new Error(`${t}.target: no earlier step has the id "${e.target}".`);ee(e.to,`${t}.to`),ne(e.along,["line","curve"],`${t}.along`),e.ms!==void 0&&B(e.ms,`${t}.ms`,200,5e3);break;case"lottie":if(z(e.src,`${t}.src`),ee(e.at,`${t}.at`),e.size!==void 0&&(te(e.size,`${t}.size`),typeof e.size=="number"&&B(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(z(e.target,`${t}.target`),!rt(n,String(e.target)))throw new Error(`${t}.target: no earlier step has the id "${e.target}".`);if(ne(e.effect,[...Kl,"stop"],`${t}.effect`),e.effect===void 0)throw new Error(`${t}.effect: choose one of ${[...Kl,"stop"].join(", ")}.`);ne(e.speed,["slow","fast"],`${t}.speed`);break;case"link":for(let a of["from","to"])if(z(e[a],`${t}.${a}`),!rt(n,String(e[a])))throw new Error(`${t}.${a}: no earlier step has the id "${e[a]}".`);fe(e.label,`${t}.label`);break;case"counter":if(Be(e,"at",t,o),te(e.value,`${t}.value`),e.format!==void 0&&(z(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&&B(e.size,`${t}.size`,1,200),ne(e.anchor,["start","middle","end"],`${t}.anchor`);break;case"row":case"column":case"grid":if(r)throw new Error(`${t}: a ${e.type} cannot go inside another ${s}.`);if(Be(e,"at",t,!1),e.gap!==void 0&&B(e.gap,`${t}.gap`,0,400),e.type==="grid"){if(B(e.columns,`${t}.columns`,1,12),!Number.isInteger(e.columns))throw new Error(`${t}.columns: expected a whole number.`)}else ne(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,l)=>{J(a,`${t}.steps[${l}]`);let f=a.type==="repeat"?a.step?.type:a.type;if(!it.includes(f))throw new Error(`${t}.steps[${l}]: a ${e.type} holds only ${it.join(", ")} (or a repeat of one).`);Jt(a,`${t}.steps[${l}]`,n,e.type)});break;case"chain":if(r)throw new Error(`${t}: a chain cannot go inside a ${s}.`);if(Be(e,"at",t,!1),e.gap!==void 0&&e.gap!=="auto"&&B(e.gap,`${t}.gap`,0,400),ne(e.direction,["right","down"],`${t}.direction`),e.wrap!==void 0&&typeof e.wrap!="boolean")throw new Error(`${t}.wrap: expected true or false.`);if(fe(e.forward,`${t}.forward`),fe(e.back,`${t}.back`),e.size!==void 0&&(te(e.size,`${t}.size`),typeof e.size=="number"&&B(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,l)=>{if(J(a,`${t}.steps[${l}]`),!it.includes(a.type))throw new Error(`${t}.steps[${l}]: a chain holds only ${it.join(", ")}.`);Jt(a,`${t}.steps[${l}]`,n,"chain")});break;case"axis":case"timeline":if(ee(e.from,`${t}.from`),ee(e.to,`${t}.to`),ee(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,l)=>B(a,`${t}.ticks[${l}]`))}else if(B(e.ticks,`${t}.ticks`,0,30),!Number.isInteger(e.ticks))throw new Error(`${t}.ticks: expected a whole number.`)}if(fe(e.label,`${t}.label`),e.format!==void 0&&(z(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,l)=>{J(a,`${t}.marks[${l}]`),te(a.at,`${t}.marks[${l}].at`),fe(a.label,`${t}.marks[${l}].label`),fe(a.text,`${t}.marks[${l}].text`)})}break;case"balloon":if(z(e.to,`${t}.to`),!rt(n,String(e.to)))throw new Error(`${t}.to: no earlier step has the id "${e.to}".`);if(z(e.text,`${t}.text`),String(e.text).length>300)throw new Error(`${t}.text: keep a balloon under 300 characters.`);ne(e.side,["below","above","left","right"],`${t}.side`),ne(e.kind,["speech","thought"],`${t}.kind`),e.width!==void 0&&B(e.width,`${t}.width`,80,600),e.size!==void 0&&B(e.size,`${t}.size`,12,60);break;case"brace":if(ee(e.from,`${t}.from`),ee(e.to,`${t}.to`),fe(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(ee(e.at,`${t}.at`),z(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(z(e.to,`${t}.to`),!rt(n,String(e.to)))throw new Error(`${t}.to: no earlier step has the id "${e.to}".`)}else ee(e.point,`${t}.point`);e.size!==void 0&&B(e.size,`${t}.size`,12,60);break;case"table":if(ee(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,l)=>{if(!Array.isArray(a)||a.length===0||a.length>6)throw new Error(`${t}.rows[${l}]: expected 1 to 6 cells.`);a.forEach((f,c)=>{if(typeof f!="string"||f.length>120)throw new Error(`${t}.rows[${l}][${c}]: 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&&B(e.size,`${t}.size`,12,40);break;case"bars":J(e.box,`${t}.box`);for(let a of["x","y","w","h"])te(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,l)=>te(a,`${t}.values[${l}]`)),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,l)=>z(a,`${t}.labels[${l}]`))}if(e.max!==void 0&&te(e.max,`${t}.max`),e.format!==void 0&&(z(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 em(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(cs(e)||Object.hasOwn(ls,e)||Gl.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(J(t,n),!Array.isArray(t.shapes)||t.shapes.length===0||t.shapes.length>Vl)throw new Error(`${n}.shapes: expected 1 to ${Vl} shapes.`);let s=(i,r)=>{if(typeof i!="number"||!Number.isInteger(i)||i<0||i>100)throw new Error(`${r}: expected a whole number from 0 to 100 (the figure's grid, y down; it stands at 50,100).`)};t.shapes.forEach((i,r)=>{let o=`${n}.shapes[${r}]`;if(J(i,o),i.fill!==void 0&&(typeof i.fill!="string"||!/^(#[0-9a-fA-F]{3,8}|[a-z]{3,20})$/.test(i.fill)))throw new Error(`${o}.fill: a colour, as hex or a plain name.`);if(i.kind==="circle"){if(!Array.isArray(i.c)||i.c.length!==2)throw new Error(`${o}.c: expected [x, y].`);i.c.forEach((l,f)=>s(l,`${o}.c[${f}]`)),s(i.r,`${o}.r`);return}if(!["polygon","polyline","curve"].includes(i.kind))throw new Error(`${o}.kind: choose one of polygon, polyline, curve, circle.`);let a=i.kind==="polygon"?3:2;if(!Array.isArray(i.points)||i.points.length<a||i.points.length>40)throw new Error(`${o}.points: a ${i.kind} takes ${a} to 40 points.`);i.points.forEach((l,f)=>{if(!Array.isArray(l)||l.length!==2)throw new Error(`${o}.points[${f}]: expected [x, y].`);l.forEach((c,d)=>s(c,`${o}.points[${f}][${d}]`))})})}function tm(e,t){let n=`lottie "${e}"`;J(t,n);let s=JSON.stringify(t).length;if(s>zl)throw new Error(`${n}: ${Math.round(s/1e3)} KB; an animation can have at most ${zl/1e3} KB.`);for(let r of["fr","ip","op","w","h"])B(t[r],`${n}.${r}`,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 i=(r,o)=>{if(Array.isArray(r))return r.forEach((a,l)=>i(a,`${o}[${l}]`));if(!(!r||typeof r!="object"))for(let[a,l]of Object.entries(r)){if(a==="x"&&typeof l=="string")throw new Error(`${n}: the animation has an expression (code inside it, at ${o}); only animations without expressions play.`);i(l,`${o}.${a}`)}};i(t.layers,"layers");for(let r of Array.isArray(t.assets)?t.assets:[]){let o=r?.p;if(typeof o=="string"&&o&&!o.startsWith("data:")&&!Array.isArray(r.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 nm(e){J(e,"The recipe");let t=e;B(t.width,"width",100,4e3),B(t.height,"height",100,4e3);for(let i of["id","title","category"])fe(t[i],i);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(ne(t.background,["dots","grid","plain"],"background"),ne(t.kind,Qh,"kind"),fe(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(ne(t.theme,["paper","chalkboard"],"theme"),t.quiz!==void 0){if(J(t.quiz,"quiz"),z(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((i,r)=>{if(J(i,`quiz.options[${r}]`),z(i.text,`quiz.options[${r}].text`),z(i.why,`quiz.options[${r}].why`),typeof i.right!="boolean")throw new Error(`quiz.options[${r}].right: expected true or false.`)}),t.quiz.options.filter(i=>i.right===!0).length!==1)throw new Error("quiz.options: exactly one option is right.")}if(t.learning!==void 0){J(t.learning,"learning");for(let i of["goal","question","answer","caveat"])z(t.learning[i],`learning.${i}`)}if(t.params!==void 0){J(t.params,"params");for(let[i,r]of Object.entries(t.params))if(fs(i),J(r,`params.${i}`),z(r.label,`params.${i}.label`),B(r.min,`${i}.min`),B(r.max,`${i}.max`),B(r.step,`${i}.step`,1e-6),B(r.value,`${i}.value`,r.min,r.max),r.max<=r.min)throw new Error(`${i}: max must be greater than min.`)}if(t.vars!==void 0){J(t.vars,"vars");for(let[i,r]of Object.entries(t.vars))fs(i),te(r,`vars.${i}`)}if(t.switches!==void 0){J(t.switches,"switches");let i=Object.entries(t.switches);if(i.length>8)throw new Error("switches: at most 8.");for(let[r,o]of i){if(fs(r),Object.hasOwn(t.params??{},r)||Object.hasOwn(t.vars??{},r))throw new Error(`switches.${r}: the name is already a param or a var.`);if(J(o,`switches.${r}`),z(o.label,`switches.${r}.label`),typeof o.on!="boolean")throw new Error(`switches.${r}.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){J(t.defs,"defs");let i=Object.entries(t.defs);if(i.length>Ul)throw new Error(`defs: at most ${Ul} figures.`);for(let[r,o]of i)em(r,o),n.add(r)}if(t.lotties!==void 0){J(t.lotties,"lotties");let i=Object.entries(t.lotties);if(i.length>Yl)throw new Error(`lotties: at most ${Yl} animations.`);let r=i.reduce((o,[a,l])=>o+tm(a,l),0);if(r>Wl)throw new Error(`lotties: ${Math.round(r/1e3)} KB in all; at most ${Wl/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((i,r)=>z(i,`credits[${r}]`))}let s={exact:new Set,repeated:new Set,count:0,figures:n};return t.steps.forEach((i,r)=>Jt(i,`Step ${r+1}`,s,null)),{...t,id:t.id??"pasted",title:t.title??"",background:t.background??"dots"}}export{Hi as DEFAULT_PROFILE,fr as agentsIn,Uh as applyChanges,Nh as compare,Wp as extractAgent,Kh as fromSheets,Kt as groupPatterns,Vp as knownKinds,ce as labelOf,Jh as lessonOf,dh as problemText,ah as readCast,eh as readProfile,xh as reviewCast,nm as validateScene,Ih as workbookFile,Bh as workbookOf,uh as writeCast};
|