UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

41 lines (39 loc) • 36.6 kB
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{A as t,k as n}from"./deferred-ui-support-DZEPWjAk.js";import{C as r,F as i,O as a,U as o,d as s,f as c,g as l,j as u,l as d,u as f,x as p}from"./_6____________________.js";import{c as m,h}from"./markdown-runtime-CtlJb8xA.js";function g(e){if(e&&typeof e==`object`)switch(e[w]){case b:case C:return!0}return!1}function _(e){if(e&&typeof e==`object`)switch(e[w]){case v:case b:case S:case C:return!0}return!1}var v,y,b,x,S,C,w,T,E,ee,D,O,te,ne;function k(){return(k=e((()=>{v=Symbol.for(`yaml.alias`),y=Symbol.for(`yaml.document`),b=Symbol.for(`yaml.map`),x=Symbol.for(`yaml.pair`),S=Symbol.for(`yaml.scalar`),C=Symbol.for(`yaml.seq`),w=Symbol.for(`yaml.node.type`),T=e=>!!e&&typeof e==`object`&&e[w]===v,E=e=>!!e&&typeof e==`object`&&e[w]===y,ee=e=>!!e&&typeof e==`object`&&e[w]===b,D=e=>!!e&&typeof e==`object`&&e[w]===x,O=e=>!!e&&typeof e==`object`&&e[w]===S,te=e=>!!e&&typeof e==`object`&&e[w]===C,ne=e=>(O(e)||g(e))&&!!e.anchor})))()}function A(e,t){let n=re(t);E(e)?j(null,e.contents,n,Object.freeze([e]))===N&&(e.contents=null):j(null,e,n,Object.freeze([]))}function j(e,t,n,r){let i=ie(e,t,n,r);if(_(i)||D(i))return ae(e,r,i),j(e,i,n,r);if(typeof i!=`symbol`){if(g(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=j(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===M)return M;else i===N&&(t.items.splice(e,1),--e)}}else if(D(t)){r=Object.freeze(r.concat(t));let e=j(`key`,t.key,n,r);if(e===M)return M;e===N&&(t.key=null);let i=j(`value`,t.value,n,r);if(i===M)return M;i===N&&(t.value=null)}}return i}function re(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 ie(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(ee(t))return n.Map?.(e,t,r);if(te(t))return n.Seq?.(e,t,r);if(D(t))return n.Pair?.(e,t,r);if(O(t))return n.Scalar?.(e,t,r);if(T(t))return n.Alias?.(e,t,r)}function ae(e,t,n){let r=t[t.length-1];if(g(r))r.items[e]=n;else if(D(r))e===`key`?r.key=n:r.value=n;else if(E(r))r.contents=n;else{let e=T(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}var M,oe,N;function se(){return(se=e((()=>{k(),M=Symbol(`break visit`),oe=Symbol(`skip children`),N=Symbol(`remove node`),A.BREAK=M,A.SKIP=oe,A.REMOVE=N})))()}var ce,le,ue;function de(){return(de=e((()=>{k(),se(),ce={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},le=e=>e.replace(/[!,[\]{}]/g,e=>ce[e]),ue=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)}return t}add(t,n){this.atNextDocument&&=(this.yaml={explicit:e.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},e.defaultTags),!1);let r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case`%TAG`:{if(r.length!==2&&(n(0,`%TAG directive should contain exactly two parts`),r.length<2))return!1;let[e,t]=r;return this.tags[e]=t,!0}case`%YAML`:{if(this.yaml.explicit=!0,r.length!==1)return n(0,`%YAML directive should contain exactly one part`),!1;let[e]=r;if(e===`1.1`||e===`1.2`)return this.yaml.version=e,!0;{let t=/^\d+\.\d+$/.test(e);return n(6,`Unsupported YAML version ${e}`,t),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e===`!`)return`!`;if(e[0]!==`!`)return t(`Not a valid tag: ${e}`),null;if(e[1]===`<`){let n=e.slice(2,-1);return n===`!`||n===`!!`?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==`>`&&t(`Verbatim tags must end with a >`),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return n===`!`?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+le(e.substring(n.length));return e[0]===`!`?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],n=Object.entries(this.tags),r;if(e&&n.length>0&&_(e.contents)){let t={};A(e.contents,(e,n)=>{_(n)&&n.tag&&(t[n.tag]=!0)}),r=Object.keys(t)}else r=[];for(let[i,a]of n)(i!==`!!`||a!==`tag:yaml.org,2002:`)&&(!e||r.some(e=>e.startsWith(a)))&&t.push(`%TAG ${i} ${a}`);return t.join(` `)}},ue.defaultYaml={explicit:!1,version:`1.2`},ue.defaultTags={"!!":`tag:yaml.org,2002:`}})))()}function fe(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function pe(){return(pe=e((()=>{se()})))()}function me(e,t,n,r){if(r&&typeof r==`object`){if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=me(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=me(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=me(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=me(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function P(e,t,n){if(Array.isArray(e))return e.map((e,t)=>P(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!ne(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,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}function F(){return(F=e((()=>{k()})))()}var he;function ge(){return(ge=e((()=>{k(),F(),he=class{constructor(e){Object.defineProperty(this,w,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!E(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=P(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?me(i,{"":o},``,o):o}}})))()}function _e(e,t,n){if(T(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(g(t)){let r=0;for(let i of t.items){let t=_e(e,i,n);t>r&&(r=t)}return r}if(D(t)){let r=_e(e,t.key,n),i=_e(e,t.value,n);return Math.max(r,i)}return 1}var ve;function I(){return(I=e((()=>{pe(),se(),k(),ge(),F(),ve=class extends he{constructor(e){super(v),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],A(e,{Node:(e,t)=>{(T(t)||ne(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}if(r&&t){let{anchors:e,doc:n,maxAliasCount:i}=t,a=e.get(r);if(a||=(P(r,null,t),e.get(r)),a?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=_e(n,r,e)),a.count*a.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`)}return r}toJSON(e,t){if(!t)return{source:this.source};let n=this.resolve(t.doc,t);if(!n){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}return t.anchors.get(n).res}toString(e,t,n){let r=`*${this.source}`;if(e){if(fe(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}}})))()}var ye,L;function R(){return(R=e((()=>{k(),ge(),F(),ye=e=>!e||typeof e!=`function`&&typeof e!=`object`,L=class extends he{constructor(e){super(S),this.value=e}toJSON(e,t){return t?.keep?this.value:P(this.value,e,t)}toString(){return String(this.value)}},L.BLOCK_FOLDED=`BLOCK_FOLDED`,L.BLOCK_LITERAL=`BLOCK_LITERAL`,L.PLAIN=`PLAIN`,L.QUOTE_DOUBLE=`QUOTE_DOUBLE`,L.QUOTE_SINGLE=`QUOTE_SINGLE`})))()}function be(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function xe(e,t,n){if(E(e)&&(e=e.contents),_(e))return e;if(D(e)){let t=n.schema[b].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??(c.anchor=i(e)),new ve(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=Se+t.slice(2));let l=be(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new L(e);return c&&(c.node=t),t}l=e instanceof Map?o[b]:Symbol.iterator in Object(e)?o[C]:o[b]}a&&(a(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from==`function`?l.nodeClass.from(n.schema,e,n):new L(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}var Se;function z(){return(z=e((()=>{I(),k(),R(),Se=`tag:yaml.org,2002:`})))()}function Ce(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if(typeof n==`number`&&Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else r=new Map([[n,r]])}return xe(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}var we,Te;function Ee(){return(Ee=e((()=>{z(),k(),ge(),we=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done,Te=class extends he{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>_(t)||D(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(we(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(g(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,Ce(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(g(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&O(i)?i.value:i:g(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!D(t))return!1;let n=t.value;return n==null||e&&O(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let r=this.get(t,!0);return g(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let e=this.get(n,!0);if(g(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,Ce(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}}})))()}function B(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var De,V;function Oe(){return(Oe=e((()=>{De=e=>e.replace(/^(?!$)(?: $)?/gm,`#`),V=(e,t,n)=>e.endsWith(` `)?B(n,t):n.includes(` `)?` `+B(n,t):(e.endsWith(` `)?``:` `)+n})))()}function ke(e,t,n=`flow`,{indentAtStart:r,lineWidth:i=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!i||i<0)return e;i<a&&(a=0);let c=Math.max(1+a,1+i-t.length);if(e.length<=c)return e;let l=[],u={},d=i-t.length;typeof r==`number`&&(r>i-Math.max(2,a)?l.push(0):d=i-r);let f,p,m=!1,h=-1,g=-1,_=-1;n===`block`&&(h=Ae(e,h,t.length),h!==-1&&(d=h+c));for(let r;r=e[h+=1];){if(n===`quoted`&&r===`\\`){switch(g=h,e[h+1]){case`x`:h+=3;break;case`u`:h+=5;break;case`U`:h+=9;break;default:h+=1}_=h}if(r===` `)n===`block`&&(h=Ae(e,h,t.length)),d=h+t.length+c,f=void 0;else{if(r===` `&&p&&p!==` `&&p!==` `&&p!==` `){let t=e[h+1];t&&t!==` `&&t!==` `&&t!==` `&&(f=h)}if(h>=d){if(f)l.push(f),d=f+c,f=void 0;else if(n===`quoted`){for(;p===` `||p===` `;)p=r,r=e[h+=1],m=!0;let t=h>_+1?h-2:g-1;if(u[t])return e;l.push(t),u[t]=!0,d=t+c,f=void 0}else m=!0}}p=r}if(m&&s&&s(),l.length===0)return e;o&&o();let v=e.slice(0,l[0]);for(let r=0;r<l.length;++r){let i=l[r],a=l[r+1]||e.length;i===0?v=`\n${t}${e.slice(0,a)}`:(n===`quoted`&&u[i]&&(v+=`${e[i]}\\`),v+=`\n${t}${e.slice(i+1,a)}`)}return v}function Ae(e,t,n){let r=t,i=t+1,a=e[i];for(;a===` `||a===` `;)if(t<i+n)a=e[++t];else{do a=e[++t];while(a&&a!==` `);r=t,i=t+1,a=e[i]}return r}var je,Me,Ne;function Pe(){return(Pe=e((()=>{je=`flow`,Me=`block`,Ne=`quoted`})))()}function Fe(e,t,n){if(!t||t<0)return!1;let r=t-n,i=e.length;if(i<=r)return!1;for(let t=0,n=0;t<i;++t)if(e[t]===` `){if(t-n>r)return!0;if(n=t+1,i-n<=r)return!1}return!0}function H(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(Be(e)?` `:``),o=``,s=0;for(let e=0,t=n[e];t;t=n[++e])if(t===` `&&n[e+1]===`\\`&&n[e+2]===`n`&&(o+=n.slice(s,e)+`\\ `,e+=1,s=e,t=`\\`),t===`\\`)switch(n[e+1]){case`u`:{o+=n.slice(s,e);let t=n.substr(e+2,4);switch(t){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:t.substr(0,2)===`00`?o+=`\\x`+t.substr(2):o+=n.substr(e,6)}e+=5,s=e+1}break;case`n`:if(r||n[e+2]===`"`||n.length<i)e+=1;else{for(o+=n.slice(s,e)+` `;n[e+2]===`\\`&&n[e+3]===`n`&&n[e+4]!==`"`;)o+=` `,e+=2;o+=a,n[e+2]===` `&&(o+=`\\`),e+=1,s=e+1}break;default:e+=1}return o=s?o+n.slice(s):n,r?o:ke(o,a,Ne,W(t,!1))}function Ie(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(` `)||/[ \t]\n|\n[ \t]/.test(e))return H(e,t);let n=t.indent||(Be(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:ke(r,n,je,W(t,!1))}function U(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=H;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?Ie:i&&!t?H:n?Ie:H}return r(e,t)}function Le({comment:e,type:t,value:n},r,i,a){let{blockQuote:o,commentString:s,lineWidth:c}=r.options;if(!o||/\n[\t ]+$/.test(n))return U(n,r);let l=r.indent||(r.forceBlockIndent||Be(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===L.BLOCK_FOLDED?!1:t===L.BLOCK_LITERAL||!Fe(n,c,l.length);if(!n)return u?`| `:`> `;let d,f;for(f=n.length;f>0;--f){let e=n[f-1];if(e!==` `&&e!==` `&&e!==` `)break}let p=n.substring(f),m=p.indexOf(` `);m===-1?d=`-`:n===p||m!==p.length-1?(d=`+`,a&&a()):d=``,p&&=(n=n.slice(0,-p.length),p[p.length-1]===` `&&(p=p.slice(0,-1)),p.replace(Ve,`$&${l}`));let h=!1,g,_=-1;for(g=0;g<n.length;++g){let e=n[g];if(e===` `)h=!0;else if(e===` `)_=g;else break}let v=n.substring(0,_<g?_+1:g);v&&=(n=n.substring(v.length),v.replace(/\n+/g,`$&${l}`));let y=(h?l?`2`:`1`:``)+d;if(e&&(y+=` `+s(e.replace(/ ?[\r\n]+/g,` `)),i&&i()),!u){let e=n.replace(/\n+/g,` $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\n+/g,`$&${l}`),i=!1,a=W(r,!0);o!==`folded`&&t!==L.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=ke(`${v}${e}${p}`,l,Me,a);if(!i)return`>${y}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${y}\n${l}${v}${n}${p}`}function Re(e,t,n,r){let{type:i,value:a}=e,{actualString:o,implicitKey:s,indent:c,indentStep:l,inFlow:u}=t;if(s&&a.includes(` `)||u&&/[[\]{},]/.test(a))return U(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(` `)?U(a,t):Le(e,t,n,r);if(!s&&!u&&i!==L.PLAIN&&a.includes(` `))return Le(e,t,n,r);if(Be(a)){if(c===``)return t.forceBlockIndent=!0,Le(e,t,n,r);if(s&&c===l)return U(a,t)}let d=a.replace(/\n+/g,`$&\n${c}`);if(o){let e=e=>e.default&&e.tag!==`tag:yaml.org,2002:str`&&e.test?.test(d),{compat:n,tags:r}=t.doc.schema;if(r.some(e)||n?.some(e))return U(a,t)}return s?d:ke(d,c,je,W(t,!1))}function ze(e,t,n,r){let{implicitKey:i,inFlow:a}=t,o=typeof e.value==`string`?e:Object.assign({},e,{value:String(e.value)}),{type:s}=e;s!==L.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=L.QUOTE_DOUBLE);let c=e=>{switch(e){case L.BLOCK_FOLDED:case L.BLOCK_LITERAL:return i||a?U(o.value,t):Le(o,t,n,r);case L.QUOTE_DOUBLE:return H(o.value,t);case L.QUOTE_SINGLE:return Ie(o.value,t);case L.PLAIN:return Re(o,t,n,r);default:return null}},l=c(s);if(l===null){let{defaultKeyType:e,defaultStringType:n}=t.options,r=i&&e||n;if(l=c(r),l===null)throw Error(`Unsupported default string type ${r}`)}return l}var W,Be,Ve;function He(){return(He=e((()=>{R(),Pe(),W=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),Be=e=>/^(%|---|\.\.\.)/m.test(e);try{Ve=RegExp(`(^|(?<! )) +(?! |$)`,`g`)}catch{Ve=/\n+(?!\n|$)/g}})))()}function Ue(e,t){let n=Object.assign({blockQuote:!0,commentString:De,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),r;switch(n.collectionStyle){case`block`:r=!1;break;case`flow`:r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?` `:``,indent:``,indentStep:typeof n.indent==`number`?` `.repeat(n.indent):` `,inFlow:r,options:n}}function We(e,t){if(t.tag){let n=e.filter(e=>e.tag===t.tag);if(n.length>0)return n.find(e=>e.format===t.format)??n[0]}let n,r;if(O(t)){r=t.value;let i=e.filter(e=>e.identify?.(r));if(i.length>1){let e=i.filter(e=>e.test);e.length>0&&(i=e)}n=i.find(e=>e.format===t.format)??i.find(e=>!e.format)}else r=t,n=e.find(e=>e.nodeClass&&r instanceof e.nodeClass);if(!n){let e=r?.constructor?.name??(r===null?`null`:typeof r);throw Error(`Tag not resolved for ${e} value`)}return n}function Ge(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(O(e)||g(e))&&e.anchor;a&&fe(a)&&(n.add(a),i.push(`&${a}`));let o=e.tag??(t.default?null:t.tag);return o&&i.push(r.directives.tagString(o)),i.join(` `)}function Ke(e,t,n,r){if(D(e))return e.toString(t,n,r);if(T(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw 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,a=_(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=We(t.doc.schema.tags,a);let o=Ge(a,i,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);let s=typeof i.stringify==`function`?i.stringify(a,t,n,r):O(a)?ze(a,t,n,r):a.toString(t,n,r);return o?O(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function qe(){return(qe=e((()=>{pe(),k(),Oe(),He()})))()}function Je({key:e,value:t},n,r,i){let{allNullValues:a,doc:o,indent:s,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=n,f=_(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(g(e)||!_(e)&&typeof e==`object`)throw Error(`With simple keys, collection cannot be used as a key value`)}let p=!d&&(!e||f&&t==null&&!n.inFlow||g(e)||(O(e)?e.type===L.BLOCK_FOLDED||e.type===L.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,v=Ke(e,n,()=>m=!0,()=>h=!0);if(!p&&!n.inFlow&&v.length>1024){if(d)throw Error(`With simple keys, single line scalar must not span more than 1024 characters`);p=!0}if(n.inFlow){if(a||t==null)return m&&r&&r(),v===``?`?`:p?`? ${v}`:v}else if(a&&!d||t==null&&p)return v=`? ${v}`,f&&!m?v+=V(v,n.indent,l(f)):h&&i&&i(),v;m&&(f=null),p?(f&&(v+=V(v,n.indent,l(f))),v=`? ${v}\n${s}:`):(v=`${v}:`,f&&(v+=V(v,n.indent,l(f))));let y,b,x;_(t)?(y=!!t.spaceBefore,b=t.commentBefore,x=t.comment):(y=!1,b=null,x=null,t&&typeof t==`object`&&(t=o.createNode(t))),n.implicitKey=!1,!p&&!f&&O(t)&&(n.indentAtStart=v.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&te(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let S=!1,C=Ke(t,n,()=>S=!0,()=>h=!0),w=` `;if(f||y||b){if(w=y?` `:``,b){let e=l(b);w+=`\n${B(e,n.indent)}`}C===``&&!n.inFlow?w===` `&&x&&(w=` `):w+=`\n${n.indent}`}else if(!p&&g(t)){let e=C[0],r=C.indexOf(` `),i=r!==-1,a=n.inFlow??t.flow??t.items.length===0;if(i||!a){let t=!1;if(i&&(e===`&`||e===`!`)){let n=C.indexOf(` `);e===`&`&&n!==-1&&n<r&&C[n+1]===`!`&&(n=C.indexOf(` `,n+1)),(n===-1||r<n)&&(t=!0)}t||(w=`\n${n.indent}`)}}else(C===``||C[0]===` `)&&(w=``);return v+=w+C,n.inFlow?S&&r&&r():x&&!S?v+=V(v,n.indent,l(x)):h&&i&&i(),v}function Ye(){return(Ye=e((()=>{k(),R(),qe(),Oe()})))()}function Xe(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}function Ze(e,t,n){let r=$e(e,n);if(te(r))for(let n of r.items)Qe(e,t,n);else if(Array.isArray(r))for(let n of r)Qe(e,t,n);else Qe(e,t,r)}function Qe(e,t,n){let r=$e(e,n);if(!ee(r))throw Error(`Merge sources must be maps or map aliases`);let i=r.toJSON(null,e,Map);for(let[e,n]of i)t instanceof Map?t.has(e)||t.set(e,n):t instanceof Set?t.add(e):Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0});return t}function $e(e,t){return e&&T(t)?t.resolve(e.doc,e):t}var et,tt,nt;function rt(){return(rt=e((()=>{k(),R(),et=`<<`,tt={identify:e=>e===et||typeof e==`symbol`&&e.description===et,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new L(Symbol(et)),{addToJSMap:Ze}),stringify:()=>et},nt=(e,t)=>(tt.identify(t)||O(t)&&(!t.type||t.type===L.PLAIN)&&tt.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===tt.tag&&e.default)})))()}function it(e,t,{key:n,value:r}){if(_(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(nt(e,n))Ze(e,t,r);else{let i=P(n,``,e);if(t instanceof Map)t.set(i,P(r,i,e));else if(t instanceof Set)t.add(i);else{let a=at(n,i,e),o=P(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function at(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(_(e)&&n?.doc){let t=Ue(n.doc,{});t.anchors=new Set;for(let e of n.anchors.keys())t.anchors.add(e.anchor);t.inFlow=!0,t.inStringifyKey=!0;let r=e.toString(t);if(!n.mapKeyWarned){let e=JSON.stringify(r);e.length>40&&(e=e.substring(0,36)+`..."`),Xe(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${e}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(t)}function ot(){return(ot=e((()=>{rt(),qe(),k(),F()})))()}function st(e,t,n){let r=xe(e,void 0,n),i=xe(t,void 0,n);return new G(r,i)}var G;function K(){return(K=e((()=>{z(),Ye(),ot(),k(),G=class e{constructor(e,t=null){Object.defineProperty(this,w,{value:x}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return _(n)&&(n=n.clone(t)),_(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return it(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?Je(this,e,t,n):JSON.stringify(this)}}})))()}function ct(e,t,n){return(t.inFlow??e.flow?ut:lt)(e,t,n)}function lt({comment:e,items:t},n,{blockItemPrefix:r,flowChars:i,itemIndent:a,onChompKeep:o,onComment:s}){let{indent:c,options:{commentString:l}}=n,u=Object.assign({},n,{indent:a,type:null}),d=!1,f=[];for(let e=0;e<t.length;++e){let i=t[e],o=null;if(_(i))!d&&i.spaceBefore&&f.push(``),dt(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(D(i)){let e=_(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),dt(n,f,e.commentBefore,d))}d=!1;let s=Ke(i,u,()=>o=null,()=>d=!0);o&&(s+=V(s,a,l(o))),d&&o&&(d=!1),f.push(r+s)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let e=1;e<f.length;++e){let t=f[e];p+=t?`\n${c}${t}`:` `}}return e?(p+=` `+B(l(e),c),s&&s()):d&&o&&o(),p}function ut({items:e},t,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=t;r+=a;let c=Object.assign({},t,{indent:r,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let n=0;n<e.length;++n){let i=e[n],a=null;if(_(i))i.spaceBefore&&d.push(``),dt(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(D(i)){let e=_(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),dt(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=_(i.value)?i.value:null;n?(n.comment&&(a=n.comment),n.commentBefore&&(l=!0)):i.value==null&&e?.comment&&(a=e.comment)}a&&(l=!0);let o=Ke(i,c,()=>a=null);l||=d.length>u||o.includes(` `),n<e.length-1?o+=`,`:t.options.trailingComma&&(t.options.lineWidth>0&&(l||=d.reduce((e,t)=>e+t.length+2,2)+(o.length+2)>t.options.lineWidth),l&&(o+=`,`)),a&&(o+=V(o,r,s(a))),d.push(o),u=d.length}let{start:f,end:p}=n;if(d.length===0)return f+p;if(!l){let e=d.reduce((e,t)=>e+t.length+2,2);l=t.options.lineWidth>0&&e>t.options.lineWidth}if(l){let e=f;for(let t of d)e+=t?`\n${a}${i}${t}`:` `;return`${e}\n${i}${p}`}return`${f}${o}${d.join(` `)}${o}${p}`}function dt({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=B(t(r),e);n.push(i.trimStart())}}function ft(){return(ft=e((()=>{k(),qe(),Oe()})))()}function q(e,t){let n=O(t)?t.value:t;for(let r of e)if(D(r)&&(r.key===t||r.key===n||O(r.key)&&r.key.value===n))return r}var J;function Y(){return(Y=e((()=>{ft(),ot(),Ee(),k(),K(),R(),J=class extends Te{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(b,e),this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:i}=n,a=new this(e),o=(e,o)=>{if(typeof i==`function`)o=i.call(t,e,o);else if(Array.isArray(i)&&!i.includes(e))return;(o!==void 0||r)&&a.items.push(st(e,o,n))};if(t instanceof Map)for(let[e,n]of t)o(e,n);else if(t&&typeof t==`object`)for(let e of Object.keys(t))o(e,t[e]);return typeof e.sortMapEntries==`function`&&a.items.sort(e.sortMapEntries),a}add(e,t){let n;n=D(e)?e:!e||typeof e!=`object`||!(`key`in e)?new G(e,e?.value):new G(e.key,e.value);let r=q(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);O(r.value)&&ye(n.value)?r.value.value=n.value:r.value=n.value}else if(i){let e=this.items.findIndex(e=>i(n,e)<0);e===-1?this.items.push(n):this.items.splice(e,0,n)}else this.items.push(n)}delete(e){let t=q(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=q(this.items,e)?.value;return(!t&&O(n)?n.value:n)??void 0}has(e){return!!q(this.items,e)}set(e,t){this.add(new G(e,t),!0)}toJSON(e,t,n){let r=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(r);for(let e of this.items)it(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!D(e))throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),ct(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}}})))()}var pt;function X(){return(X=e((()=>{k(),Y(),pt={collection:`map`,default:!0,nodeClass:J,tag:`tag:yaml.org,2002:map`,resolve(e,t){return ee(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>J.from(e,t,n)}})))()}function mt(e){let t=O(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var ht;function Z(){return(Z=e((()=>{z(),ft(),Ee(),k(),R(),F(),ht=class extends Te{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(C,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=mt(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=mt(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&O(r)?r.value:r}has(e){let t=mt(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=mt(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];O(r)&&ye(t)?r.value=t:this.items[n]=t}toJSON(e,t){let n=[];t?.onCreate&&t.onCreate(n);let r=0;for(let e of this.items)n.push(P(e,String(r++),t));return n}toString(e,t,n){return e?ct(this,e,{blockItemPrefix:`- `,flowChars:{start:`[`,end:`]`},itemIndent:(e.indent||``)+` `,onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t)){let e=0;for(let a of t){if(typeof r==`function`){let n=t instanceof Set?a:String(e++);a=r.call(t,n,a)}i.items.push(xe(a,void 0,n))}}return i}}})))()}var gt;function Q(){return(Q=e((()=>{k(),Z(),gt={collection:`seq`,default:!0,nodeClass:ht,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return te(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>ht.from(e,t,n)}})))()}function _t(){return(_t=e((()=>{He()})))()}function vt(){return(vt=e((()=>{R()})))()}function yt(){return(yt=e((()=>{R()})))()}function bt(){return(bt=e((()=>{R()})))()}function xt(){return(xt=e((()=>{X(),vt(),Q(),_t(),yt(),bt()})))()}function St(e){return typeof e==`bigint`||Number.isInteger(e)}var Ct,wt;function Tt(){return(Tt=e((()=>{R(),X(),Q(),Ct=({value:e})=>JSON.stringify(e),wt=[{identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify:Ct},{identify:e=>e==null,createNode:()=>new L(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^null$/,resolve:()=>null,stringify:Ct},{identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^true$|^false$/,resolve:e=>e===`true`,stringify:Ct},{identify:St,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})=>St(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:Ct}],[pt,gt].concat(wt,{default:!0,tag:``,test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}})})))()}function Et(){return(Et=e((()=>{R(),He()})))()}function Dt(e,t,n){let{replacer:r}=n,i=new ht(e);i.tag=`tag:yaml.org,2002:pairs`;let a=0;if(t&&Symbol.iterator in Object(t))for(let e of t){typeof r==`function`&&(e=r.call(t,String(a++),e));let o,s;if(Array.isArray(e)){if(e.length===2)o=e[0],s=e[1];else throw TypeError(`Expected [key, value] tuple: ${e}`)}else if(e&&e instanceof Object){let t=Object.keys(e);if(t.length===1)o=t[0],s=e[o];else throw TypeError(`Expected tuple with one key, not ${t.length} keys`)}else o=e;i.items.push(st(o,s,n))}return i}function Ot(){return(Ot=e((()=>{K(),R(),Z()})))()}var kt;function At(){return(At=e((()=>{k(),F(),Y(),Z(),Ot(),kt=class e extends ht{constructor(){super(),this.add=J.prototype.add.bind(this),this.delete=J.prototype.delete.bind(this),this.get=J.prototype.get.bind(this),this.has=J.prototype.has.bind(this),this.set=J.prototype.set.bind(this),this.tag=e.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t?.onCreate&&t.onCreate(n);for(let e of this.items){let r,i;if(D(e)?(r=P(e.key,``,t),i=P(e.value,r,t)):r=P(e,``,t),n.has(r))throw Error(`Ordered maps must not include duplicate keys`);n.set(r,i)}return n}static from(e,t,n){let r=Dt(e,t,n),i=new this;return i.items=r.items,i}},kt.tag=`tag:yaml.org,2002:omap`})))()}function jt(){return(jt=e((()=>{R()})))()}function Mt(){return(Mt=e((()=>{R()})))()}var Nt;function Pt(){return(Pt=e((()=>{k(),K(),Y(),Nt=class e extends J{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=D(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new G(e.key,null):new G(e,null),q(this.items,t.key)||this.items.push(t)}get(e,t){let n=q(this.items,e);return!t&&D(n)?O(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!=`boolean`)throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=q(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new G(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw Error(`Set items must all have null values`)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let e of t)typeof r==`function`&&(e=r.call(t,e,e)),i.items.push(st(e,null,n));return i}},Nt.tag=`tag:yaml.org,2002:set`})))()}function Ft(){return(Ft=e((()=>{X(),vt(),Q(),_t(),Et(),jt(),Mt(),rt(),At(),Ot(),Pt()})))()}function It(){return(It=e((()=>{X(),vt(),Q(),_t(),yt(),bt(),xt(),Tt(),Et(),rt(),At(),Ot(),Ft(),Pt()})))()}function Lt(){return(Lt=e((()=>{X(),Q(),_t(),It()})))()}function Rt(){return(Rt=e((()=>{qe()})))()}function zt(){return(zt=e((()=>{I(),Ee(),K(),Lt(),Rt(),pe(),z(),de()})))()}function Bt(){return(Bt=e((()=>{K(),Y()})))()}function Vt(){return(Vt=e((()=>{Z()})))()}function Ht(){return(Ht=e((()=>{K(),Y(),Z()})))()}function Ut(){return(Ut=e((()=>{R(),Y(),Z(),Bt(),Vt(),Ht()})))()}function Wt(){return(Wt=e((()=>{R()})))()}function Gt(){return(Gt=e((()=>{R()})))()}function Kt(){return(Kt=e((()=>{R(),Wt(),Gt()})))()}function qt(){return(qt=e((()=>{I(),Ut(),Kt()})))()}function Jt(){return(Jt=e((()=>{zt(),qt()})))()}function Yt(){return(Yt=e((()=>{de(),zt(),Jt()})))()}function Xt(){return(Xt=e((()=>{Wt(),Gt(),He()})))()}function $(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),Zt(Object.freeze([]),e,t)}function Zt(e,t,n){let r=n(t,e);if(typeof r==`symbol`)return r;for(let i of[`key`,`value`]){let a=t[i];if(a&&`items`in a){for(let t=0;t<a.items.length;++t){let r=Zt(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===Qt)return Qt;else r===en&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}var Qt,$t,en;function tn(){return(tn=e((()=>{Qt=Symbol(`break visit`),$t=Symbol(`skip children`),en=Symbol(`remove item`),$.BREAK=Qt,$.SKIP=$t,$.REMOVE=en,$.itemAtPath=(e,t)=>{let n=e;for(let[e,r]of t){let t=n?.[e];if(t&&`items`in t)n=t.items[r];else return}return n},$.parentCollection=(e,t)=>{let n=$.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n?.[r];if(i&&`items`in i)return i;throw Error(`Parent collection not found`)}})))()}function nn(){return(nn=e((()=>{Xt(),tn()})))()}function rn(){return(rn=e((()=>{nn()})))()}function an(){return(an=e((()=>{nn(),rn()})))()}function on(){return(on=e((()=>{Yt(),zt(),an()})))()}function sn(){return(sn=e((()=>{Yt(),zt(),Lt(),I(),K(),R(),Y(),Z(),nn(),rn(),an(),on(),se()})))()}function cn(){return(cn=e((()=>{sn()})))()}function ln(e){return e.replace(/^\uFEFF/,``).replace(/\r\n/g,` `).replace(/\r/g,` `)}function un(e){let t=pn.exec(e);if(!t)return;let n=t[0].length,r=e.slice(n),i=fn.exec(r);if(i)return{block:r.slice(0,i.index),body:r.slice(i.index+i[0].length)}}function dn(e){let t=ln(e);return(un(t)?.body??t).trim()}var fn,pn;function mn(){return(mn=e((()=>{cn(),fn=/(?:^|\n)---[^\S\n]*(?:\n|(?![\s\S]))/,pn=/^---[^\S\n]*\n/})))()}function hn(e){let t=i(()=>_n(e.content)),o=i(()=>h(dn(e.content),{mode:`document`,remoteImages:!1,codeBlockChrome:`none`,fileLinks:!1}));return u(a,{get when(){return!e.message},get fallback(){var t=vn();return s(t,()=>e.message),t},get children(){return u(a,{get when(){return c(()=>!!e.markdown)()?/\.md$/iu.test(e.path):e.markdown},get fallback(){var e=yn();return s(e,u(r,{get each(){return t()},children:(e,t)=>(()=>{var n=bn();return s(n,e),d(()=>t(),e=>{l(n,`data-chunk`,e)}),n})()})),e},get children(){return u(n,{tag:`article`,class:`markdown`,get onClick(){return e.onClick},get html(){return o()}})}})}})}function gn(e,t){let n=(e.target instanceof Element?e.target.closest(`a[href]`):null)?.getAttribute(`href`);if(!n||/^[a-z][a-z0-9+.-]*:|^\/\//iu.test(n))return null;e.preventDefault();let r=new URL(n,new URL(t,`https://skill.invalid/`));try{return decodeURIComponent(r.pathname.slice(1))}catch{return null}}function _n(e){let t=e.split(` `),n=[];for(let e=0;e<t.length;e+=64)n.push(t.slice(e,e+64).join(` `));return n}var vn,yn,bn;function xn(){return(xn=e((()=>{f(),o(),mn(),m(),t(),vn=p(`<p role=status>`),yn=p(`<div class=code-content>`),bn=p(`<pre class=code-chunk>`)})))()}export{gn as n,xn as r,hn as t};