fix(ui): frame the task page's attempts, stages, details and inputs, and fit the run tabs on a phone

This commit is contained in:
sam committed 2026-10-19 01:56:38 +11:00
1 parent 30105666e2
commit 580108dd7f
6 files changed
+82 -81

No files matched your search

+72 -72
View File
@@ -1,14 +1,14 @@
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/AccountPage.js","assets/PageHeader.js","assets/createLucideIcon.js","assets/Input.js","assets/AuthenticationPage.js","assets/CredentialBindingsPage.js","assets/PlaybooksPage.js","assets/AgentProfilesPage.js","assets/HarnessPage.js","assets/alert.js","assets/NotFoundPage.js"])))=>i.map(i=>d[i]);
import{A as e,B as t,C as n,D as r,E as i,F as a,H as o,I as s,L as c,M as l,N as u,O as d,P as f,R as p,S as m,T as h,U as g,V as _,W as v,_ as y,a as b,b as x,c as S,d as C,f as w,g as T,h as ee,i as E,j as D,k as te,l as ne,m as re,n as ie,o as ae,p as oe,r as se,s as ce,t as le,u as ue,v as O,w as de,x as fe,y as pe,z as me}from"./alert.js";import{$t as he,A as k,B as ge,Bt as _e,C as A,Ct as j,D as ve,Dn as ye,Dt as be,En as xe,G as Se,Gt as M,H as Ce,It as we,Jt as Te,Kt as Ee,Lt as De,M as N,On as Oe,Pt as ke,Q as Ae,Qt as je,Rt as Me,S as P,Sn as Ne,T as Pe,Tt as Fe,U as Ie,Vt as Le,Xt as F,Z as Re,_t as I,an as ze,b as L,bn as Be,cn as Ve,dn as He,dt as Ue,er as R,gn as We,hn as Ge,ht as Ke,ir as z,it as qe,jn as B,k as V,kn as Je,l as H,n as U,nr as Ye,nt as Xe,ot as Ze,p as Qe,pn as $e,r as et,rr as tt,rt as W,sn as nt,st as rt,t as it,tt as at,wn as ot,wt as G,x as K,xn as q,y as J,yn as st,yt as ct}from"./PageHeader.js";import{D as lt,E as ut,J as dt,M as ft,Q as pt,S as mt,T as Y,X as ht,Y as gt,Z as _t,a as vt,c as yt,i as bt,k as eee,n as xt,o as St,r as X,s as Ct,t as wt,v as Tt,w as Et}from"./createLucideIcon.js";import{a as Dt,c as Ot,i as kt,l as At,n as jt,o as Mt,r as Nt,s as Pt,t as Z}from"./Input.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var Ft=typeof window<`u`,It,Lt=e=>It=e,Rt=Symbol();function zt(e){return e&&typeof e==`object`&&Object.prototype.toString.call(e)===`[object Object]`&&typeof e.toJSON!=`function`}var Bt=typeof window==`object`&&window.window===window?window:typeof self==`object`&&self.self===self?self:typeof global==`object`&&global.global===global?global:typeof globalThis==`object`?globalThis:{HTMLElement:null};function Vt(e,{autoBom:t=!1}={}){return t&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([``,e],{type:e.type}):e}function Ht(e,t,n){let r=new XMLHttpRequest;r.open(`GET`,e),r.responseType=`blob`,r.onload=function(){qt(r.response,t,n)},r.onerror=function(){console.error(`could not download file`)},r.send()}function Ut(e){let t=new XMLHttpRequest;t.open(`HEAD`,e,!1);try{t.send()}catch{}return t.status>=200&&t.status<=299}function Wt(e){try{e.dispatchEvent(new MouseEvent(`click`))}catch{let t=new MouseEvent(`click`,{bubbles:!0,cancelable:!0,view:window,detail:0,screenX:80,screenY:20,clientX:80,clientY:20,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,button:0,relatedTarget:null});e.dispatchEvent(t)}}var Gt=typeof navigator==`object`?navigator:{userAgent:``},Kt=/Macintosh/.test(Gt.userAgent)&&/AppleWebKit/.test(Gt.userAgent)&&!/Safari/.test(Gt.userAgent),qt=Ft?typeof HTMLAnchorElement<`u`&&`download`in HTMLAnchorElement.prototype&&!Kt?Jt:`msSaveOrOpenBlob`in Gt?Yt:Xt:()=>{};function Jt(e,t=`download`,n){let r=document.createElement(`a`);r.download=t,r.rel=`noopener`,typeof e==`string`?(r.href=e,r.origin===location.origin?Wt(r):Ut(r.href)?Ht(e,t,n):(r.target=`_blank`,Wt(r))):(r.href=URL.createObjectURL(e),setTimeout(function(){URL.revokeObjectURL(r.href)},4e4),setTimeout(function(){Wt(r)},0))}function Yt(e,t=`download`,n){if(typeof e==`string`){if(Ut(e))Ht(e,t,n);else{let t=document.createElement(`a`);t.href=e,t.target=`_blank`,setTimeout(function(){Wt(t)})}}else navigator.msSaveOrOpenBlob(Vt(e,n),t)}function Xt(e,t,n,r){if(r||=open(``,`_blank`),r&&(r.document.title=r.document.body.innerText=`downloading...`),typeof e==`string`)return Ht(e,t,n);let i=e.type===`application/octet-stream`,a=/constructor/i.test(String(Bt.HTMLElement))||`safari`in Bt,o=/CriOS\/[\d]+/.test(navigator.userAgent);if((o||i&&a||Kt)&&typeof FileReader<`u`){let t=new FileReader;t.onloadend=function(){let e=t.result;if(typeof e!=`string`)throw r=null,Error(`Wrong reader.result type`);e=o?e:e.replace(/^data:[^;]*;/,`data:attachment/file;`),r?r.location.href=e:location.assign(e),r=null},t.readAsDataURL(e)}else{let t=URL.createObjectURL(e);r?r.location.assign(t):location.href=t,r=null,setTimeout(function(){URL.revokeObjectURL(t)},4e4)}}var{assign:tee}=Object;function Zt(){let e=nt(!0),t=e.run(()=>q({})),n=[],r=[],i=Ge({install(e){Lt(i),i._a=e,e.provide(Rt,i),e.config.globalProperties.$pinia=i,r.forEach(e=>n.push(e)),r=[]},use(e){return this._a?n.push(e):r.push(e),this},_p:n,_a:null,_e:e,_s:new Map,state:t});return i}var Qt=()=>{};function $t(e,t,n,r=Qt){e.add(t);let i=()=>{e.delete(t)&&r()};return!n&&Ve()&&We(i),i}function eLine truncated
import{A as e,B as t,C as n,D as r,E as i,F as a,H as o,I as s,L as c,M as l,N as u,O as d,P as f,R as p,S as m,T as h,U as g,V as _,W as v,_ as y,a as b,b as x,c as S,d as C,f as w,g as T,h as ee,i as E,j as D,k as te,l as ne,m as re,n as ie,o as ae,p as oe,r as se,s as ce,t as le,u as ue,v as O,w as de,x as fe,y as pe,z as me}from"./alert.js";import{$t as he,A as k,B as ge,Bt as _e,C as A,Ct as j,D as ve,Dn as ye,Dt as be,En as xe,G as Se,Gt as M,H as Ce,It as we,Jt as Te,Kt as Ee,Lt as De,M as N,On as Oe,Pt as ke,Q as Ae,Qt as je,Rt as Me,S as P,Sn as Ne,T as Pe,Tt as Fe,U as Ie,Vt as Le,Xt as F,Z as Re,_t as I,an as ze,b as L,bn as Be,cn as Ve,dn as He,dt as Ue,er as R,gn as We,hn as Ge,ht as Ke,ir as z,it as qe,jn as B,k as V,kn as Je,l as H,n as U,nr as Ye,nt as Xe,ot as Ze,p as Qe,pn as $e,r as et,rr as tt,rt as W,sn as nt,st as rt,t as it,tt as at,wn as ot,wt as G,x as K,xn as q,y as J,yn as st,yt as ct}from"./PageHeader.js";import{D as lt,E as ut,J as dt,M as ft,Q as pt,S as mt,T as Y,X as ht,Y as gt,Z as _t,a as vt,c as yt,i as bt,k as eee,n as xt,o as St,r as X,s as Ct,t as wt,v as Tt,w as Et}from"./createLucideIcon.js";import{a as Dt,c as Ot,i as kt,l as At,n as jt,o as Mt,r as Nt,s as Pt,t as Z}from"./Input.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var Ft=typeof window<`u`,It,Lt=e=>It=e,Rt=Symbol();function zt(e){return e&&typeof e==`object`&&Object.prototype.toString.call(e)===`[object Object]`&&typeof e.toJSON!=`function`}var Bt=typeof window==`object`&&window.window===window?window:typeof self==`object`&&self.self===self?self:typeof global==`object`&&global.global===global?global:typeof globalThis==`object`?globalThis:{HTMLElement:null};function Vt(e,{autoBom:t=!1}={}){return t&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([``,e],{type:e.type}):e}function Ht(e,t,n){let r=new XMLHttpRequest;r.open(`GET`,e),r.responseType=`blob`,r.onload=function(){qt(r.response,t,n)},r.onerror=function(){console.error(`could not download file`)},r.send()}function Ut(e){let t=new XMLHttpRequest;t.open(`HEAD`,e,!1);try{t.send()}catch{}return t.status>=200&&t.status<=299}function Wt(e){try{e.dispatchEvent(new MouseEvent(`click`))}catch{let t=new MouseEvent(`click`,{bubbles:!0,cancelable:!0,view:window,detail:0,screenX:80,screenY:20,clientX:80,clientY:20,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,button:0,relatedTarget:null});e.dispatchEvent(t)}}var Gt=typeof navigator==`object`?navigator:{userAgent:``},Kt=/Macintosh/.test(Gt.userAgent)&&/AppleWebKit/.test(Gt.userAgent)&&!/Safari/.test(Gt.userAgent),qt=Ft?typeof HTMLAnchorElement<`u`&&`download`in HTMLAnchorElement.prototype&&!Kt?Jt:`msSaveOrOpenBlob`in Gt?Yt:Xt:()=>{};function Jt(e,t=`download`,n){let r=document.createElement(`a`);r.download=t,r.rel=`noopener`,typeof e==`string`?(r.href=e,r.origin===location.origin?Wt(r):Ut(r.href)?Ht(e,t,n):(r.target=`_blank`,Wt(r))):(r.href=URL.createObjectURL(e),setTimeout(function(){URL.revokeObjectURL(r.href)},4e4),setTimeout(function(){Wt(r)},0))}function Yt(e,t=`download`,n){if(typeof e==`string`){if(Ut(e))Ht(e,t,n);else{let t=document.createElement(`a`);t.href=e,t.target=`_blank`,setTimeout(function(){Wt(t)})}}else navigator.msSaveOrOpenBlob(Vt(e,n),t)}function Xt(e,t,n,r){if(r||=open(``,`_blank`),r&&(r.document.title=r.document.body.innerText=`downloading...`),typeof e==`string`)return Ht(e,t,n);let i=e.type===`application/octet-stream`,a=/constructor/i.test(String(Bt.HTMLElement))||`safari`in Bt,o=/CriOS\/[\d]+/.test(navigator.userAgent);if((o||i&&a||Kt)&&typeof FileReader<`u`){let t=new FileReader;t.onloadend=function(){let e=t.result;if(typeof e!=`string`)throw r=null,Error(`Wrong reader.result type`);e=o?e:e.replace(/^data:[^;]*;/,`data:attachment/file;`),r?r.location.href=e:location.assign(e),r=null},t.readAsDataURL(e)}else{let t=URL.createObjectURL(e);r?r.location.assign(t):location.href=t,r=null,setTimeout(function(){URL.revokeObjectURL(t)},4e4)}}var{assign:tee}=Object;function Zt(){let e=nt(!0),t=e.run(()=>q({})),n=[],r=[],i=Ge({install(e){Lt(i),i._a=e,e.provide(Rt,i),e.config.globalProperties.$pinia=i,r.forEach(e=>n.push(e)),r=[]},use(e){return this._a?n.push(e):r.push(e),this},_p:n,_a:null,_e:e,_s:new Map,state:t});return i}var Qt=()=>{};function $t(e,t,n,r=Qt){e.add(t);let i=()=>{e.delete(t)&&r()};return!n&&Ve()&&We(i),i}function eLine truncated
`);d=n.pop()||``;for(let e of n){let t=e.split(`
`).find(e=>e.startsWith(`data: `));if(!t)continue;let n=JSON.parse(t.slice(6));if(n.session_id&&(Rd.value=n.session_id),n.type===`delta`&&(o+=n.text,Ud.value=Ud.value?{...Ud.value,text:o}:null),(n.type===`tool`||n.type===`navigate`)&&(a=[...a,n],Ud.value=Ud.value?{...Ud.value,tools:a}:null),n.type===`ask`&&n.ask&&(clearTimeout(l),Ud.value=Ud.value?{...Ud.value,ask:n.ask}:null),n.type===`done`&&(s=!0,o||=n.text||``),n.type===`error`)throw Error(n.text)}if(t)break}if(!s)throw Error(`chat stream ended before completion`);zd.value=[...zd.value,{from:`assistant`,text:o,tool_calls:a}],Ud.value=null,Vd.value=`Ready`,await rf()}catch(e){let t=e;t.name===`AbortError`&&!c?(Ud.value={text:`Turn stopped.`,tools:a,isError:!1,turn:r,isRetry:i},Vd.value=`Stopped`):(Ud.value={text:`Unable to complete that turn: ${t.message||t}`,tools:a,isError:!0,turn:r?jd(r):void 0,isRetry:i},Vd.value=`Error. Retry available.`)}finally{clearTimeout(l),Fd=null,tf=null,Hd.value=!1}}function gf(){Vd.value=`Stopping…`,Rd.value&&X.chatCancel(Rd.value).catch(()=>{}),nf()}function _f(){Ue(()=>{rf().catch(e=>{Vd.value=e.message||`Chat unavailable`})}),Ke(()=>{nf()})}async function vf(e){let t=new Uint8Array(await e.arrayBuffer()),n=``;for(let e=0;e<t.length;e+=32768)n+=String.fromCharCode(...t.subarray(e,e+32768));await hf({textOverride:`🎤 Voice message`,voice:{data:btoa(n),mime_type:e.type||`audio/webm`}})}var yf=[`aria-label`,`title`,`aria-expanded`,`aria-controls`],bf=N({__name:`ChatFab`,props:{open:{type:Boolean}},emits:[`toggle`],setup(e,{emit:t}){let n=t;function r(e){return U(`col-start-1 row-start-1 grid place-items-center transition-[opacity,transform] duration-[140ms]`,e?`opacity-100`:`-rotate-45 scale-[0.7] opacity-0`)}return(t,i)=>(I(),A(`button`,{type:`button`,class:`relative z-10 grid size-14 cursor-pointer place-items-center rounded-full border border-border-strong bg-secondary text-primary shadow-[var(--shadow-md)] transition-transform duration-[140ms] hover:-translate-y-px focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary active:translate-y-0`,"aria-label":e.open?`Close chat`:`Chat with Archie`,title:e.open?`Close chat`:`Chat with Archie`,"aria-expanded":e.open,"aria-controls":B(Nd),onClick:i[0]||=e=>n(`toggle`)},[L(`span`,{"aria-hidden":`true`,class:R(r(!e.open))},[k(B(zu),{size:22})],2),L(`span`,{"aria-hidden":`true`,class:R(r(e.open))},[k(B(bd),{size:22})],2)],8,yf))}}),xf=N({__name:`Popover`,props:{defaultOpen:{type:Boolean},open:{type:Boolean},modal:{type:Boolean}},emits:[`update:open`],setup(e,{emit:t}){let n=O(e,t);return(e,t)=>(I(),K(B(ls),W({"data-slot":`popover`},B(n)),{default:F(t=>[G(e.$slots,`default`,Ye(Ce(t)))]),_:3},16))}}),Sf=N({inheritAttrs:!1,__name:`PopoverContent`,props:{forceMount:{type:Boolean},memoDependencies:{},side:{},sideOffset:{default:4},sideFlip:{type:Boolean},align:{default:`center`},alignOffset:{},alignFlip:{type:Boolean},avoidCollisions:{type:Boolean},collisionBoundary:{},collisionPadding:{},arrowPadding:{},hideShiftedArrow:{type:Boolean},sticky:{},hideWhenDetached:{type:Boolean},positionStrategy:{},updatePositionStrategy:{},disableUpdateOnLayoutShift:{type:Boolean},prioritizePosition:{type:Boolean},reference:{},dir:{},asChild:{type:Boolean},as:{},disableOutsidePointerEvents:{type:Boolean},class:{type:[Boolean,null,String,Object,Array]}},emits:[`escapeKeyDown`,`pointerDownOutside`,`focusOutside`,`interactOutside`,`openAutoFocus`,`closeAutoFocus`],setup(e,{emit:t}){let n=e,r=t,i=Tt(n,`class`),a=O(i,r);return(e,t)=>(I(),K(B(ms),null,{default:F(()=>[k(B(ps),W({"data-slot":`popover-content`},{...e.$attrs,...B(a)},{class:B(U)(`bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 flex flex-col gap-2.5 rounded-lg p-2.5 text-sm shadow-md ring-1 duration-100 z-50 w-72 max-w-(--reka-popover-content-available-width) origin-(--reka-popover-content-transform-origin) outline-hidden`,n.class)}),{default:F(()=>[G(e.$slots,`default`)]),_:3},16,[`class`])]),_:3}))}}),Cf=N({__name:`PopoverTrigger`,props:{asChild:{type:Boolean},as:{}},setup(e){let t=e;return(e,n)=>(I(),K(B(hs),W({"data-slot":`popover-trigger`},t),{default:F(()=>[G(e.$slots,`default`)]),_:3},16))}}),wf=N({__name:`ChatSessionActions`,setup(e){let t=q(!1);$d(t);function n(e){t.value=!1,of(e)}function r(e,n){t.value=!1,sf(e,n)}return(e,i)=>(I(),K(B(xf),{open:t.value,"onUpdate:open":i[5]||=e=>t.value=e},{default:F(()=>[k(B(Cf),{"as-child":``},{default:F(()=>[k(B(Y),{variant:`ghost`,size:`icon-sm`,class:`flex-none`,"aria-label":`Session actions`,title:`Session actions`},{default:F(()=>[k(B(wu))]),_:1})]),_:1}),k(B(Sf),{align:`end`,class:`grid w-48 gap-0.5 p-1`},{default:F(()=>[k(B(Y),{variant:`ghost`,size:`sm`,class:`justify-startLine truncated
`),r=[],i=null,a=null,o=()=>{r.length&&(t.push({kind:`p`,inline:vm(r.join(` `))}),r=[])},s=()=>{i&&=(t.push({kind:i.tag,items:i.items.map(e=>vm(e))}),null)};for(let e=0;e<n.length;e++){let c=n[e];if(c.startsWith("```")){o(),s(),a?(t.push({kind:`pre`,code:a.join(`
`)}),a=null):a=[];continue}if(a){a.push(c);continue}let l=bm(c),u=e+1<n.length?bm(n[e+1]):null;if(l&&u&&xm(u)&&l.length===u.length){o(),s();let r=[];for(e+=2;e<n.length;e++){let t=bm(n[e]);if(!t||t.length!==l.length){e--;break}r.push(t)}t.push({kind:`table`,head:l.map(e=>vm(e)),rows:r.map(e=>e.map(e=>vm(e)))});continue}if(!c.trim()){o(),s();continue}let d=c.match(/^(#{1,3})\s+(.+)$/);if(d){o(),s(),t.push({kind:`h${d[1].length}`,inline:vm(d[2])});continue}let f=c.match(/^\s*[-*]\s+(.+)$/),p=c.match(/^\s*\d+[.)]\s+(.+)$/);if(f||p){o();let e=p?`ol`:`ul`;(!i||i.tag!==e)&&(s(),i={tag:e,items:[]}),i.items.push((f||p)[1])}else c.startsWith(`>`)?(o(),s(),t.push({kind:`blockquote`,inline:vm(c.replace(/^>\s?/,``))})):r.push(c)}return o(),s(),a&&t.push({kind:`pre`,code:a.join(`
`)}),t}function bm(e){let t=String(e||``).trim();if(!t.includes(`|`))return null;let n=t.replace(/^\|/,``).replace(/\|$/,``).split(`|`).map(e=>e.trim());return n.length>1&&n.every(e=>e!==``)?n:null}function xm(e){return e.every(e=>/^:?-{3,}:?$/.test(e))}var Sm={class:`[overflow-wrap:anywhere]`},Cm={key:0,class:`my-2 overflow-auto rounded-md border border-border bg-background/60 p-3`},wm={class:`font-mono text-[0.85em]`},Tm={key:1,class:`my-3 w-full border-collapse text-[0.92em]`},Em={key:2,class:`my-2 border-l-[3px] border-primary pl-3 text-fg-muted`},Dm={key:3,class:`mt-1 mb-2 text-xl leading-tight font-semibold tracking-[-0.02em]`},Om={key:4,class:`mt-1 mb-2 text-lg leading-tight font-semibold tracking-[-0.02em]`},km={key:5,class:`mt-1 mb-2 text-base leading-tight font-semibold tracking-[-0.02em]`},Am={key:6,class:`my-2.5 flex list-disc flex-col gap-1 pl-5`},jm={key:7,class:`my-2.5 flex list-decimal flex-col gap-1 pl-5`},Mm={key:8,class:`mb-2.5 last:mb-0`},Nm=N({__name:`ChatMarkdown`,props:{text:{}},setup(e){let t=e,n=J(()=>ym(t.text));return(e,t)=>(I(),A(`div`,Sm,[(I(!0),A(H,null,j(n.value,(e,t)=>(I(),A(H,{key:t},[e.kind===`pre`?(I(),A(`pre`,Cm,[L(`code`,wm,z(e.code),1)])):e.kind===`table`?(I(),A(`table`,Tm,[L(`thead`,null,[L(`tr`,null,[(I(!0),A(H,null,j(e.head,(e,t)=>(I(),A(`th`,{key:t,class:`border border-border bg-muted px-2 py-1.5 text-left font-semibold`},[k(gm,{inline:e},null,8,[`inline`])]))),128))])]),L(`tbody`,null,[(I(!0),A(H,null,j(e.rows,(e,t)=>(I(),A(`tr`,{key:t},[(I(!0),A(H,null,j(e,(e,t)=>(I(),A(`td`,{key:t,class:`border border-border px-2 py-1.5 text-left`},[k(gm,{inline:e},null,8,[`inline`])]))),128))]))),128))])])):e.kind===`blockquote`?(I(),A(`blockquote`,Em,[k(gm,{inline:e.inline},null,8,[`inline`])])):e.kind===`h1`?(I(),A(`h1`,Dm,[k(gm,{inline:e.inline},null,8,[`inline`])])):e.kind===`h2`?(I(),A(`h2`,Om,[k(gm,{inline:e.inline},null,8,[`inline`])])):e.kind===`h3`?(I(),A(`h3`,km,[k(gm,{inline:e.inline},null,8,[`inline`])])):e.kind===`ul`?(I(),A(`ul`,Am,[(I(!0),A(H,null,j(e.items,(e,t)=>(I(),A(`li`,{key:t},[k(gm,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`ol`?(I(),A(`ol`,jm,[(I(!0),A(H,null,j(e.items,(e,t)=>(I(),A(`li`,{key:t},[k(gm,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`p`?(I(),A(`p`,Mm,[k(gm,{inline:e.inline},null,8,[`inline`])])):P(``,!0)],64))),128))]))}}),Pm={class:`truncate`},Fm=N({__name:`ChatNavChip`,props:{path:{},label:{}},setup(e){return(t,n)=>{let r=Fe(`RouterLink`);return I(),K(r,{to:e.path,title:`Go to ${e.label||e.path}`,class:`inline-flex max-w-full items-center gap-1.5 rounded-md border border-primary/45 bg-primary-soft px-2.5 py-1 text-xs font-semibold text-link transition-colors hover:border-primary hover:bg-primary/15 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary`},{default:F(()=>[k(B(iu),{"aria-hidden":`true`,class:`size-3.5 shrink-0`}),L(`span`,Pm,z(e.label||e.path),1)]),_:1},8,[`to`,`title`])}}}),Im={key:1,class:`flex items-baseline gap-1.5 [overflow-wrap:anywhere]`},Lm={class:`font-semibold text-foreground`},Rm={key:0,class:`font-mono text-[0.95em] text-fg-subtle`},zm=N({__name:`ChatToolCall`,props:{tool:{},streaming:{type:Boolean}},setup(e){let t=e,n=J(()=>t.tool.name||t.tool.Name||t.tool.tool||`tool`),r=J(()=>t.tool.parameters||t.tool.Parameters||``),i=J(()=>!!(t.tool.err||t.tool.Err||t.tool.failed)),a=J(()=>t.tool.summary||t.tool.Summary||t.tool.text||t.tool.err||t.tool.Err||(t.streaming?i.value?`failed`:`running…`:`done`));return(t,o)=>e.tool.path?(I(),K(Fm,{key:0,path:e.tool.path,label:e.tool.label},null,8,[`path`,`label`])):(I(),A(`div`,Im,[k(B(yd),{"aria-hidden":`true`,class:`size-3.5 shrink-0 self-center text-fg-subtle`}),L(`span`,Lm,z(n.value),1),r.value?(I(),A(`code`,Rm,z(r.value),1)):P(``,!0),L(`span`,{class:R(B(U)(`text-fg-muted`,i.value&&`text-danger`))},z(a.value),3)]))}}),Bm={key:0,class:`mb-2 grid gap-0.5 text-xs`},Vm={key:1,class:`mb-2 flex flex-wrap gap-1.5`},Hm={key:3,class:`whitespace-pre-wrap`},Um=N({__name:`ChatBubble`,props:{text:{},tools:{default:()=>[]},media:{default:()=>[]},assistant:{type:Boolean,default:!1},streaming:{type:Boolean,default:!1}},setup(e){return(t,n)=>(I(),A(`div`,{class:R([`flex`,e.assistant?`justify-start`:`justify-end`])},[L(`div`,{class:R(B(U)(`max-w-[min(78ch,92%)] rounded-[0.85rem] px-3.5 py-2.5 text-sm leading-normal [overflow-wrap:anywhere]`,e.assistant?`bg-muted`:`bg-primary/15`))},[e.assistant&&e.tools.length?(I(),A(`div`,Bm,[(I(!0),A(H,null,j(e.tools,(t,n)=>(I(),K(zm,{key:n,tool:t,streaming:e.streaming},null,8,[`tool`,`streaming`]))),128))])):P(``,!0),e.media.length?(I(),A(`div`,Vm,[(I(!0),A(H,null,j(e.media,(e,t)=>(I(),K(lm,{key:t,attachment:e},null,8,[`attachment`]))),128))])):P(``,!0),e.assistant?(I(),K(Nm,{key:2,text:e.text},null,8,[`text`])):(I(),A(`div`,Hm,z(e.text),1)),G(t.$slots,`default`)],2)],2))}}),Wm={class:`text-sm`},Gm={key:0,class:`mt-1 text-fg-muted`},Km={key:1,class:`mt-2 flex flex-wrap gap-2`},qm=N({__name:`ChatChooseCard`,props Line truncated
`).map(e=>e.trim()).find(Boolean)||``,i=r.length>Dv?`${r.slice(0,Dv).trimEnd()}…`:r;return{text:i,full:n,truncated:i!==n}}function kv(e){return String(e||`event`).replaceAll(`_`,` `).replace(/\b\w/g,e=>e.toUpperCase())}function Av(e){let t=Number(e);if(!Number.isFinite(t)||t<0)return``;if(t<1e3)return`under 1 s`;let n=t/1e3;if(n<60)return`${n.toFixed(+(n<10))} s`;let r=Math.round(n),i=Math.floor(r/60),a=r%60;if(i<60)return a===0?`${i} min`:`${i} min ${a} s`;let o=Math.floor(i/60),s=i-o*60;return s===0?`${o} h`:`${o} h ${s} min`}function jv(e){let t=Number(e);return!Number.isFinite(t)||t<=0?``:t.toLocaleString(`en-US`)}function Mv(e){return typeof e==`string`?e:``}function Nv(e={}){let t=e.data||{},n=e.stage||`unknown stage`,r=e.workflow?`${e.workflow} workflow`:``;if(e.kind===`stage_start`)return{title:`Started stage: ${n}`,detail:r};if(e.kind===`stage_finish`){let e=Av(t.duration_ms),i=[r,e&&`ran for ${e}`].filter(Boolean).join(` · `);return{title:t.interrupted?`Stage interrupted: ${n}`:t.skipped?`Skipped stage: ${n}`:t.error?`Stage failed: ${n}`:`Finished stage: ${n}`,detail:[i,Mv(t.error),Mv(t.when)].filter(Boolean).join(` · `)}}if(e.kind===`task_retried`){let n=Number(t.retry_count);return{title:Number.isFinite(n)&&n>0?`Retry ${n}`:`Retry requested`,detail:[Mv(t.previous_stage)&&`after ${Mv(t.previous_stage)}`,Mv(t.previous_reason)].filter(Boolean).join(`: `)||e.detail||``}}if(e.kind===`agent_finish`){let r=jv(t.iterations),i=jv(t.tokens),a=Number(t.cached_tokens)||0,o=jv((Number(t.prompt_tokens)||0)-a),s=jv(t.completion_tokens),c=jv(t.cached_tokens),l=[r&&`${r} iterations`,i&&`${i} tokens`,o&&`${o} fresh prompt`,s&&`${s} completion`,c&&`${c} cached`,Mv(t.model)].filter(Boolean);return{title:`Agent ${Mv(t.status)||`finished`}: ${n}`,detail:l.join(` · `)||e.detail||``}}if(e.kind===`remediation_round`){let e=Number(t.of),n=Mv(t.author);return{title:`Remediation ${Mv(t.round)}${e>0?` of ${e}`:``}`,detail:[n&&`answers ${n}'s review`,t.review_id?`#${Mv(t.review_id)}`:``].filter(Boolean).join(` `)}}if(e.kind===`review_approved`){let e=Mv(t.pr_number);return{title:`Pull request approved`,detail:[Mv(t.author),e&&`#${e}`].filter(Boolean).join(` · `)}}if(e.kind===`step_retried`)return{title:`Attempt ${Mv(t.attempt)} of ${Mv(t.of)} failed: ${e.stage||`step`}`,detail:Mv(t.error),tone:`warn`};if(e.kind===`config_captured`)return{title:`Configuration captured`,detail:`The effective task-runtime configuration for this run.`};if(e.kind===`binding_started`){let e=Mv(t.source),n=Mv(t.capture_id),r=[{label:`binding ${Mv(t.binding_name)||Mv(t.binding_id)}`,to:`/events?tab=bindings`},...n?[{label:`captured event`,to:`/events?tab=inspector&capture=${encodeURIComponent(n)}`}]:[]];return t.unsigned===!0?{title:`Started by an unsigned event`,detail:e?`source ${e}`:``,tone:`warn`,links:r}:{title:`Started by an event`,detail:e?`source ${e}`:``,links:r}}if(e.kind===`changes_captured`){let e=t.totals??{},n=Number(e.files);return{title:`Change capture recorded`,detail:[Number.isFinite(n)&&n>0?`${n} file${n===1?``:`s`} changed`:``,t.captured_after?`captured after ${Mv(t.captured_after)}`:``].filter(Boolean).join(` · `)}}return{title:kv(e.kind||e.type),detail:e.detail||``}}var Pv=[`title`],Fv=N({__name:`ActivityRow`,props:{event:{}},emits:[`open`],setup(e,{emit:t}){let n=Ev();n.watchIdentities();let r=e,i=t,a=hv(),o=J(()=>a.taskIDFor(r.event)),s=J(()=>Ov(r.event,n.identityName));function c(){o.value>0&&i(`open`,o.value)}let l=J(()=>r.event.at?gh(r.event.at):`–`);return(e,t)=>(I(),K(B(Sv),{class:R(o.value>0?`cursor-pointer`:``),role:o.value>0?`link`:void 0,tabindex:o.value>0?0:void 0,title:o.value>0?`Open task details`:void 0,onClick:c,onKeydown:[_t(pt(c,[`prevent`]),[`enter`]),_t(pt(c,[`prevent`]),[`space`])]},{default:F(()=>[k(B(Q),{class:`font-medium`},{default:F(()=>[V(z(B(Nv)({...r.event,at:void 0,detail:void 0}).title),1)]),_:1}),k(B(Q),{class:`font-mono`},{default:F(()=>[V(z(o.value>0?`#${o.value}`:`–`),1)]),_:1}),k(B(Q),{class:`w-[55%] max-w-0`},{default:F(()=>[L(`span`,{class:`block truncate`,title:s.value.truncated?s.value.full:void 0},z(s.value.text),9,Pv)]),_:1}),k(B(Q),null,{default:F(()=>[V(z(l.value),1)]),_:1})]),_:1},8,[`class`,`role`,`tabindex`,`title`,`onKeydown`]))}}),Iv=[{value:`all`,label:`All`},{value:`tasks`,label:`Tasks`},{value:`system`,label:`System`}];function Lv(e){return(Number(e?.task_id)||0)>0}function Rv(e,t){return t===`tasks`?Lv(e):t!==`system`||!Lv(e)}function zv(e,t){return e.filter(e=>Rv(e,t))}function Bv(e,t){return e>0?``:t===`all`?`Waiting for activity`:t===`tasks`?`No task events yet`:`No system events yet`}function Vv(e,t){return`${e}:${t??0}`}function Hv(e){let t=[];for(let n of e){let e=n.kind||n.type||`event`,r=Number(n.task_id)||0,i=Vv(Ov(n).text,r),a=t[t.length-1];a&&a.key===i?(a.count+=1,a.events.push(n)):t.push({key:i,label:e,taskID:r,count:1,representative:n,events:[n]})}return t}var Uv={key:0,class:`font-normal text-fg-subtle`},Wv={role:`region`,"aria-label":`Activity`,"ari Line truncated
`,1)[0]??``;return t.length>80?`${t.slice(0,79)}…`:t}function sb(e){return(e?.merged||0)+(e?.completed||0)}function cb(e){return Object.entries(e?.inputs??{}).map(([e,t])=>({name:e,type:t.type,required:t.required===!0})).sort((e,t)=>e.name.localeCompare(t.name))}function lb(e,t){return e.filter(e=>e.required&&!(t[e.name]??``).trim()).map(e=>e.name)}function ub(e,t){switch(t){case`number`:{let t=e.trim();return t!==``&&!Number.isNaN(Number(t))?Number(t):e}case`bool`:return e===`true`||e!==`false`&&e;case`string`:return e;default:try{return JSON.parse(e)}catch{return e}}}function db(e,t){let n={};for(let r of e){let e=t[r.name];e!==void 0&&e!==``&&(n[r.name]=ub(e,r.type))}return n}var fb=[`onKeydown`],pb={key:0,class:`text-sm text-danger`,role:`alert`},mb={key:1,class:`grid gap-1.5`},hb=[`for`],gb={key:0,class:`font-normal text-fg-subtle`},_b=[`id`],vb=[`value`],yb={key:0,class:`text-xs text-fg-subtle`},bb={key:2,class:`grid gap-1.5`},xb=[`id`],Sb={class:`block truncate text-[13px] font-medium`},Cb={class:`block text-xs text-fg-subtle`},wb={key:0,class:`text-xs text-fg-subtle`},Tb={key:3,class:`grid gap-3`},Eb=[`for`],Db={class:`font-mono`},Ob={key:0,class:`text-fg-subtle`},kb={class:`grid gap-1.5`},Ab=[`for`],jb={class:`grid gap-1.5`},Mb=[`for`],Nb={key:4,class:`text-sm text-danger`,role:`alert`},Pb={class:`flex items-center gap-2 border-t border-border pt-4`},Fb={class:`mr-auto text-xs text-fg-subtle`},Ib=N({__name:`NewTaskForm`,props:{workflow:{},draft:{},initialWorkflow:{},initialInstructions:{}},emits:[`started`,`cancel`],setup(e,{emit:t}){let n=e,r=t,i=De(),a=q([]),o=q([]),s=q([]),c=q(``);Ue(async()=>{try{let[e,t]=await Promise.all([X.workflows(),X.repositories()]);a.value=(e?.definitions??[]).filter(e=>e.enabled),o.value=e?.workflows??[],s.value=(t??[]).map(e=>`${e.owner}/${e.name}`)}catch(e){c.value=String(e.message||e)}});let l=q(``),u=q(n.workflow??n.initialWorkflow??``),d=q(n.initialInstructions??``),f=q(ob(d.value)),p=q({});Ee(()=>{!u.value&&a.value[0]&&(u.value=a.value[0].id)});let m=J(()=>a.value.find(e=>e.id===u.value)),h=J(()=>cb(m.value)),g=J(()=>lb(h.value,p.value)),_=J(()=>m.value?.repository??`required`),v=J(()=>_.value!==`optional`&&_.value!==`none`),y=e=>o.value.find(t=>t.workflow===e),b=q(!1),x=q(``),S=J(()=>!(!l.value.trim()&&v.value||!u.value||!f.value.trim())&&g.value.length===0);async function C(){if(S.value&&!b.value){b.value=!0,x.value=``;try{let e=await X.workRequest({repository:_.value===`none`?``:l.value.trim(),workflow:u.value,title:f.value.trim(),instructions:d.value,inputs:db(h.value,p.value),...n.draft?{draft:n.draft}:{}});r(`started`,e.task_id)}catch(e){x.value=String(e.message||e)}finally{b.value=!1}}}return(e,t)=>(I(),A(`form`,{class:`grid gap-5`,onSubmit:pt(C,[`prevent`]),onKeydown:[_t(pt(C,[`meta`,`prevent`]),[`enter`]),_t(pt(C,[`ctrl`,`prevent`]),[`enter`])]},[c.value?(I(),A(`p`,pb,z(c.value),1)):P(``,!0),_.value===`none`?P(``,!0):(I(),A(`div`,mb,[L(`label`,{for:`${B(i)}-repo`,class:`text-[13px] font-medium`},[t[5]||=V(`Repository`,-1),v.value?P(``,!0):(I(),A(`span`,gb,` (optional)`))],8,hb),k(B(Z),{id:`${B(i)}-repo`,modelValue:l.value,"onUpdate:modelValue":t[0]||=e=>l.value=e,class:`font-mono`,placeholder:`owner/repository`,list:`${B(i)}-repos`,required:v.value},null,8,[`id`,`modelValue`,`list`,`required`]),L(`datalist`,{id:`${B(i)}-repos`},[(I(!0),A(H,null,j(s.value,e=>(I(),A(`option`,{key:e,value:e},null,8,vb))),128))],8,_b),s.value.length?(I(),A(`p`,yb,[t[6]||=V(`Configured: `,-1),(I(!0),A(H,null,j(s.value,e=>(I(),K(B(Y),{key:e,type:`button`,variant:`link`,size:`xs`,class:`h-auto px-1 font-mono text-fg-subtle`,onClick:t=>l.value=e},{default:F(()=>[V(z(e),1)]),_:2},1032,[`onClick`]))),128))])):P(``,!0)])),n.workflow?P(``,!0):(I(),A(`div`,bb,[L(`span`,{id:`${B(i)}-wf`,class:`text-[13px] font-medium`},`Workflow`,8,xb),k(B(lc),{modelValue:u.value,"onUpdate:modelValue":t[1]||=e=>u.value=e,"aria-labelledby":`${B(i)}-wf`,class:`grid grid-cols-1 gap-2 sm:grid-cols-3`,loop:``},{default:F(()=>[(I(!0),A(H,null,j(a.value,e=>(I(),K(B(dc),{key:e.id,value:e.id,class:`rounded-md border border-border bg-card px-3 py-2.5 text-left transition-colors hover:bg-secondary focus-visible:outline-2 focus-visible:outline-ring data-[state=checked]:border-primary data-[state=checked]:bg-secondary`},{default:F(()=>[L(`span`,Sb,z(e.name||e.id),1),L(`span`,Cb,[V(z(y(e.id)?.runs||0)+` runs`,1),y(e.id)?.runs?(I(),A(H,{key:0},[V(` · `+z(Math.round(B(sb)(y(e.id))/(y(e.id)?.runs||1)*100))+`% delivered`,1)],64)):P(``,!0)])]),_:2},1032,[`value`]))),128))]),_:1},8,[`modelValue`,`aria-labelledby`]),!a.value.length&&!c.value?(I(),A(`p`,wb,`No enabled workflows.`)):P(``,!0)])),h.value.length?(I(),A(`div`,Tb,[(I(!0),A(H,null,j(h.value,e=>(I(),A(`div`,{key:e.name,class:`grid gap-1.5`},[L(`label`,{for:`${B(i)}-input-${e.name}`,class:`text-[13px] font-medium`},[L(`span`,Db,z(e.name),1),e.required?(I(),A(`span`,Ob,` · required`)):P(``,!0)],8,Eb),k(B(Z),{id:`${B(i)}-input-${e.name}`,"model-value":p.value[e. Line truncated
`)){let e=n.indexOf(`:`);if(e<=0)continue;let r=n.slice(0,e).trim();r&&(t[r]=n.slice(e+1).trim())}return t}function Qb(e,t){if(!e.event_type)return{label:`Unidentified`,identified:!1};let n=t.find(t=>t.id===e.event_type);return{label:n?n.name:`Deleted type`,identified:!0}}function $b(e,t){if(!e)return`No event type`;let n=t.find(t=>t.id===e);return n?`${n.source} / ${n.name}`:`Deleted type`}function ex(e){let t=[...(e.headers||[]).map(e=>`${e.name} = ${e.value}`),...(e.payload||[]).map(e=>e.op===`present`?`${e.path} present`:`${e.path} = ${e.value??``}`)];return t.length?t.join(` · `):`any event`}function tx(e){return{headers:(e.headers||[]).filter(e=>e.name.trim()!==``).map(e=>({name:e.name.trim(),value:e.value})),payload:(e.payload||[]).filter(e=>e.path.trim()!==``).map(e=>e.op===`present`?{path:e.path.trim(),op:e.op}:{path:e.path.trim(),op:e.op,value:e.value??``})}}var nx=q([]),rx=q([]),ix=q(!0),ax=q(null),ox=q(!0),sx=q(null),cx=q(!1),lx=q(null);async function ux(){try{let e=await X.eventTypes(Xb().workspace);ix.value=e.enabled!==!1,nx.value=e.event_types||[],rx.value=e.proposals||[],ax.value=null}catch(e){ax.value=e.message||String(e)}finally{ox.value=!1}}function dx(e){return{headers:(e.headers||[]).map(e=>({...e})),payload:(e.payload||[]).map(e=>({...e}))}}function fx(e){lx.value=null,sx.value=e}function px(e){let t=xx.value.find(t=>String(t.id)===e.sample_id);fx({mode:`proposal`,id:null,source:e.source,name:``,rule:dx(e.rule),headersText:``,body:t?.body||``,exampleHeaders:e.headers||{}})}function mx(e=``){fx({mode:`paste`,id:null,source:e,name:``,rule:{headers:[],payload:[]},headersText:``,body:``,exampleHeaders:{}})}function hx(e){fx({mode:`edit`,id:e.id,source:e.source,name:e.name,rule:dx(e.rule),headersText:``,body:``,exampleHeaders:{}})}function gx(){sx.value=null}async function _x(){let e=sx.value;if(e){cx.value=!0;try{if(e.mode===`edit`&&e.id)await X.eventTypeUpdate(e.id,{name:e.name,rule:tx(e.rule)});else{let t=e.mode===`paste`?Zb(e.headersText):e.exampleHeaders;await X.eventTypeCreate({source:e.source,name:e.name,rule:e.mode===`paste`?void 0:tx(e.rule),example:{headers:t,body:e.body}})}sx.value=null,await ux()}catch(e){lx.value=e.message||String(e)}finally{cx.value=!1}}}var vx=q(null);async function yx(){let e=vx.value;if(vx.value=null,e)try{await X.eventTypeDelete(e.id),await ux()}catch(e){ax.value=e.message||String(e)}}var bx=100,xx=q([]),Sx=q(!0),Cx=q(null),wx=q(!0),Tx=q(null);async function Ex(){try{let e=await X.captures(bx);Sx.value=e.enabled!==!1,xx.value=e.captures||[],Cx.value=null}catch(e){Cx.value=e.message||String(e)}finally{wx.value=!1}}function Dx(e){let t=xx.value.find(t=>t.id===e);return t&&(Tx.value=t),!!t}function Ox(){xx.value.length&&(Tx.value=xx.value[0])}function kx(){Ch(`captures`,()=>{Ex(),ux()})}var Ax=N({__name:`Tabs`,props:{defaultValue:{},orientation:{},dir:{},activationMode:{},modelValue:{},unmountOnHide:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,i=Tt(n,`class`),a=O(i,r);return(e,t)=>(I(),K(B(el),W({"data-slot":`tabs`,"data-orientation":B(a).orientation||`horizontal`},B(a),{class:B(U)(`gap-2 group/tabs flex data-horizontal:flex-col`,n.class)}),{default:F(t=>[G(e.$slots,`default`,Ye(Ce(t)))]),_:3},16,[`data-orientation`,`class`]))}}),jx=N({__name:`TabsContent`,props:{value:{},forceMount:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e,n=Tt(t,`class`);return(e,r)=>(I(),K(B(rl),W({"data-slot":`tabs-content`,class:B(U)(`text-sm flex-1 outline-none`,t.class)},B(n)),{default:F(()=>[G(e.$slots,`default`)]),_:3},16,[`class`]))}}),Mx=N({__name:`TabsList`,props:{loop:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]},variant:{default:`default`}},setup(e){let t=e,n=Tt(t,`class`,`variant`);return(r,i)=>(I(),K(B(il),W({"data-slot":`tabs-list`,"data-variant":e.variant},B(n),{class:B(U)(B(Px)({variant:e.variant}),t.class)}),{default:F(()=>[G(r.$slots,`default`)]),_:3},16,[`data-variant`,`class`]))}}),Nx=N({__name:`TabsTrigger`,props:{value:{},disabled:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e,n=Tt(t,`class`),r=pe(n);return(e,n)=>(I(),K(B(al),W({"data-slot":`tabs-trigger`,class:B(U)(`gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg:not([class*=size-])]:size-4 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:Line truncated
`).find(e=>e.startsWith(`data: `));if(!t)continue;let n=JSON.parse(t.slice(6));if(n.session_id&&(Ld.value=n.session_id),n.type===`delta`&&(o+=n.text,Hd.value=Hd.value?{...Hd.value,text:o}:null),(n.type===`tool`||n.type===`navigate`)&&(a=[...a,n],Hd.value=Hd.value?{...Hd.value,tools:a}:null),n.type===`ask`&&n.ask&&(clearTimeout(l),Hd.value=Hd.value?{...Hd.value,ask:n.ask}:null),n.type===`done`&&(s=!0,o||=n.text||``),n.type===`error`)throw Error(n.text)}if(t)break}if(!s)throw Error(`chat stream ended before completion`);Rd.value=[...Rd.value,{from:`assistant`,text:o,tool_calls:a}],Hd.value=null,Bd.value=`Ready`,await nf()}catch(e){let t=e;t.name===`AbortError`&&!c?(Hd.value={text:`Turn stopped.`,tools:a,isError:!1,turn:r,isRetry:i},Bd.value=`Stopped`):(Hd.value={text:`Unable to complete that turn: ${t.message||t}`,tools:a,isError:!0,turn:r?Ad(r):void 0,isRetry:i},Bd.value=`Error. Retry available.`)}finally{clearTimeout(l),Pd=null,ef=null,Vd.value=!1}}function hf(){Bd.value=`Stopping…`,Ld.value&&X.chatCancel(Ld.value).catch(()=>{}),tf()}function gf(){Ue(()=>{nf().catch(e=>{Bd.value=e.message||`Chat unavailable`})}),Ke(()=>{tf()})}async function _f(e){let t=new Uint8Array(await e.arrayBuffer()),n=``;for(let e=0;e<t.length;e+=32768)n+=String.fromCharCode(...t.subarray(e,e+32768));await mf({textOverride:`🎤 Voice message`,voice:{data:btoa(n),mime_type:e.type||`audio/webm`}})}var vf=[`aria-label`,`title`,`aria-expanded`,`aria-controls`],yf=N({__name:`ChatFab`,props:{open:{type:Boolean}},emits:[`toggle`],setup(e,{emit:t}){let n=t;function r(e){return U(`col-start-1 row-start-1 grid place-items-center transition-[opacity,transform] duration-[140ms]`,e?`opacity-100`:`-rotate-45 scale-[0.7] opacity-0`)}return(t,i)=>(I(),A(`button`,{type:`button`,class:`relative z-10 grid size-14 cursor-pointer place-items-center rounded-full border border-border-strong bg-secondary text-primary shadow-[var(--shadow-md)] transition-transform duration-[140ms] hover:-translate-y-px focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary active:translate-y-0`,"aria-label":e.open?`Close chat`:`Chat with Archie`,title:e.open?`Close chat`:`Chat with Archie`,"aria-expanded":e.open,"aria-controls":B(Md),onClick:i[0]||=e=>n(`toggle`)},[L(`span`,{"aria-hidden":`true`,class:R(r(!e.open))},[k(B(Ru),{size:22})],2),L(`span`,{"aria-hidden":`true`,class:R(r(e.open))},[k(B(yd),{size:22})],2)],8,vf))}}),bf=N({__name:`Popover`,props:{defaultOpen:{type:Boolean},open:{type:Boolean},modal:{type:Boolean}},emits:[`update:open`],setup(e,{emit:t}){let n=O(e,t);return(e,t)=>(I(),K(B(cs),W({"data-slot":`popover`},B(n)),{default:F(t=>[G(e.$slots,`default`,Ye(Ce(t)))]),_:3},16))}}),xf=N({inheritAttrs:!1,__name:`PopoverContent`,props:{forceMount:{type:Boolean},memoDependencies:{},side:{},sideOffset:{default:4},sideFlip:{type:Boolean},align:{default:`center`},alignOffset:{},alignFlip:{type:Boolean},avoidCollisions:{type:Boolean},collisionBoundary:{},collisionPadding:{},arrowPadding:{},hideShiftedArrow:{type:Boolean},sticky:{},hideWhenDetached:{type:Boolean},positionStrategy:{},updatePositionStrategy:{},disableUpdateOnLayoutShift:{type:Boolean},prioritizePosition:{type:Boolean},reference:{},dir:{},asChild:{type:Boolean},as:{},disableOutsidePointerEvents:{type:Boolean},class:{type:[Boolean,null,String,Object,Array]}},emits:[`escapeKeyDown`,`pointerDownOutside`,`focusOutside`,`interactOutside`,`openAutoFocus`,`closeAutoFocus`],setup(e,{emit:t}){let n=e,r=t,i=Tt(n,`class`),a=O(i,r);return(e,t)=>(I(),K(B(ps),null,{default:F(()=>[k(B(fs),W({"data-slot":`popover-content`},{...e.$attrs,...B(a)},{class:B(U)(`bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 flex flex-col gap-2.5 rounded-lg p-2.5 text-sm shadow-md ring-1 duration-100 z-50 w-72 max-w-(--reka-popover-content-available-width) origin-(--reka-popover-content-transform-origin) outline-hidden`,n.class)}),{default:F(()=>[G(e.$slots,`default`)]),_:3},16,[`class`])]),_:3}))}}),Sf=N({__name:`PopoverTrigger`,props:{asChild:{type:Boolean},as:{}},setup(e){let t=e;return(e,n)=>(I(),K(B(ms),W({"data-slot":`popover-trigger`},t),{default:F(()=>[G(e.$slots,`default`)]),_:3},16))}}),Cf=N({__name:`ChatSessionActions`,setup(e){let t=q(!1);Qd(t);function n(e){t.value=!1,af(e)}function r(e,n){t.value=!1,of(e,n)}return(e,i)=>(I(),K(B(bf),{open:t.value,"onUpdate:open":i[5]||=e=>t.value=e},{default:F(()=>[k(B(Sf),{"as-child":``},{default:F(()=>[k(B(Y),{variant:`ghost`,size:`icon-sm`,class:`flex-none`,"aria-label":`Session actions`,title:`Session actions`},{default:F(()=>[k(B(Cu))]),_:1})]),_:1}),k(B(xf),{align:`end`,class:`grid w-48 gap-0.5 p-1`},{default:F(()=>[k(B(Y),{variant:`ghost`,size:`sm`,class:`justify-startLine truncated
`),r=[],i=null,a=null,o=()=>{r.length&&(t.push({kind:`p`,inline:_m(r.join(` `))}),r=[])},s=()=>{i&&=(t.push({kind:i.tag,items:i.items.map(e=>_m(e))}),null)};for(let e=0;e<n.length;e++){let c=n[e];if(c.startsWith("```")){o(),s(),a?(t.push({kind:`pre`,code:a.join(`
`)}),a=null):a=[];continue}if(a){a.push(c);continue}let l=ym(c),u=e+1<n.length?ym(n[e+1]):null;if(l&&u&&bm(u)&&l.length===u.length){o(),s();let r=[];for(e+=2;e<n.length;e++){let t=ym(n[e]);if(!t||t.length!==l.length){e--;break}r.push(t)}t.push({kind:`table`,head:l.map(e=>_m(e)),rows:r.map(e=>e.map(e=>_m(e)))});continue}if(!c.trim()){o(),s();continue}let d=c.match(/^(#{1,3})\s+(.+)$/);if(d){o(),s(),t.push({kind:`h${d[1].length}`,inline:_m(d[2])});continue}let f=c.match(/^\s*[-*]\s+(.+)$/),p=c.match(/^\s*\d+[.)]\s+(.+)$/);if(f||p){o();let e=p?`ol`:`ul`;(!i||i.tag!==e)&&(s(),i={tag:e,items:[]}),i.items.push((f||p)[1])}else c.startsWith(`>`)?(o(),s(),t.push({kind:`blockquote`,inline:_m(c.replace(/^>\s?/,``))})):r.push(c)}return o(),s(),a&&t.push({kind:`pre`,code:a.join(`
`)}),t}function ym(e){let t=String(e||``).trim();if(!t.includes(`|`))return null;let n=t.replace(/^\|/,``).replace(/\|$/,``).split(`|`).map(e=>e.trim());return n.length>1&&n.every(e=>e!==``)?n:null}function bm(e){return e.every(e=>/^:?-{3,}:?$/.test(e))}var xm={class:`[overflow-wrap:anywhere]`},Sm={key:0,class:`my-2 overflow-auto rounded-md border border-border bg-background/60 p-3`},Cm={class:`font-mono text-[0.85em]`},wm={key:1,class:`my-3 w-full border-collapse text-[0.92em]`},Tm={key:2,class:`my-2 border-l-[3px] border-primary pl-3 text-fg-muted`},Em={key:3,class:`mt-1 mb-2 text-xl leading-tight font-semibold tracking-[-0.02em]`},Dm={key:4,class:`mt-1 mb-2 text-lg leading-tight font-semibold tracking-[-0.02em]`},Om={key:5,class:`mt-1 mb-2 text-base leading-tight font-semibold tracking-[-0.02em]`},km={key:6,class:`my-2.5 flex list-disc flex-col gap-1 pl-5`},Am={key:7,class:`my-2.5 flex list-decimal flex-col gap-1 pl-5`},jm={key:8,class:`mb-2.5 last:mb-0`},Mm=N({__name:`ChatMarkdown`,props:{text:{}},setup(e){let t=e,n=J(()=>vm(t.text));return(e,t)=>(I(),A(`div`,xm,[(I(!0),A(H,null,j(n.value,(e,t)=>(I(),A(H,{key:t},[e.kind===`pre`?(I(),A(`pre`,Sm,[L(`code`,Cm,z(e.code),1)])):e.kind===`table`?(I(),A(`table`,wm,[L(`thead`,null,[L(`tr`,null,[(I(!0),A(H,null,j(e.head,(e,t)=>(I(),A(`th`,{key:t,class:`border border-border bg-muted px-2 py-1.5 text-left font-semibold`},[k(hm,{inline:e},null,8,[`inline`])]))),128))])]),L(`tbody`,null,[(I(!0),A(H,null,j(e.rows,(e,t)=>(I(),A(`tr`,{key:t},[(I(!0),A(H,null,j(e,(e,t)=>(I(),A(`td`,{key:t,class:`border border-border px-2 py-1.5 text-left`},[k(hm,{inline:e},null,8,[`inline`])]))),128))]))),128))])])):e.kind===`blockquote`?(I(),A(`blockquote`,Tm,[k(hm,{inline:e.inline},null,8,[`inline`])])):e.kind===`h1`?(I(),A(`h1`,Em,[k(hm,{inline:e.inline},null,8,[`inline`])])):e.kind===`h2`?(I(),A(`h2`,Dm,[k(hm,{inline:e.inline},null,8,[`inline`])])):e.kind===`h3`?(I(),A(`h3`,Om,[k(hm,{inline:e.inline},null,8,[`inline`])])):e.kind===`ul`?(I(),A(`ul`,km,[(I(!0),A(H,null,j(e.items,(e,t)=>(I(),A(`li`,{key:t},[k(hm,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`ol`?(I(),A(`ol`,Am,[(I(!0),A(H,null,j(e.items,(e,t)=>(I(),A(`li`,{key:t},[k(hm,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`p`?(I(),A(`p`,jm,[k(hm,{inline:e.inline},null,8,[`inline`])])):P(``,!0)],64))),128))]))}}),Nm={class:`truncate`},Pm=N({__name:`ChatNavChip`,props:{path:{},label:{}},setup(e){return(t,n)=>{let r=Fe(`RouterLink`);return I(),K(r,{to:e.path,title:`Go to ${e.label||e.path}`,class:`inline-flex max-w-full items-center gap-1.5 rounded-md border border-primary/45 bg-primary-soft px-2.5 py-1 text-xs font-semibold text-link transition-colors hover:border-primary hover:bg-primary/15 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary`},{default:F(()=>[k(B(ru),{"aria-hidden":`true`,class:`size-3.5 shrink-0`}),L(`span`,Nm,z(e.label||e.path),1)]),_:1},8,[`to`,`title`])}}}),Fm={key:1,class:`flex items-baseline gap-1.5 [overflow-wrap:anywhere]`},Im={class:`font-semibold text-foreground`},Lm={key:0,class:`font-mono text-[0.95em] text-fg-subtle`},Rm=N({__name:`ChatToolCall`,props:{tool:{},streaming:{type:Boolean}},setup(e){let t=e,n=J(()=>t.tool.name||t.tool.Name||t.tool.tool||`tool`),r=J(()=>t.tool.parameters||t.tool.Parameters||``),i=J(()=>!!(t.tool.err||t.tool.Err||t.tool.failed)),a=J(()=>t.tool.summary||t.tool.Summary||t.tool.text||t.tool.err||t.tool.Err||(t.streaming?i.value?`failed`:`running…`:`done`));return(t,o)=>e.tool.path?(I(),K(Pm,{key:0,path:e.tool.path,label:e.tool.label},null,8,[`path`,`label`])):(I(),A(`div`,Fm,[k(B(vd),{"aria-hidden":`true`,class:`size-3.5 shrink-0 self-center text-fg-subtle`}),L(`span`,Im,z(n.value),1),r.value?(I(),A(`code`,Lm,z(r.value),1)):P(``,!0),L(`span`,{class:R(B(U)(`text-fg-muted`,i.value&&`text-danger`))},z(a.value),3)]))}}),zm={key:0,class:`mb-2 grid gap-0.5 text-xs`},Bm={key:1,class:`mb-2 flex flex-wrap gap-1.5`},Vm={key:3,class:`whitespace-pre-wrap`},Hm=N({__name:`ChatBubble`,props:{text:{},tools:{default:()=>[]},media:{default:()=>[]},assistant:{type:Boolean,default:!1},streaming:{type:Boolean,default:!1}},setup(e){return(t,n)=>(I(),A(`div`,{class:R([`flex`,e.assistant?`justify-start`:`justify-end`])},[L(`div`,{class:R(B(U)(`max-w-[min(78ch,92%)] rounded-[0.85rem] px-3.5 py-2.5 text-sm leading-normal [overflow-wrap:anywhere]`,e.assistant?`bg-muted`:`bg-primary/15`))},[e.assistant&&e.tools.length?(I(),A(`div`,zm,[(I(!0),A(H,null,j(e.tools,(t,n)=>(I(),K(Rm,{key:n,tool:t,streaming:e.streaming},null,8,[`tool`,`streaming`]))),128))])):P(``,!0),e.media.length?(I(),A(`div`,Bm,[(I(!0),A(H,null,j(e.media,(e,t)=>(I(),K(cm,{key:t,attachment:e},null,8,[`attachment`]))),128))])):P(``,!0),e.assistant?(I(),K(Mm,{key:2,text:e.text},null,8,[`text`])):(I(),A(`div`,Vm,z(e.text),1)),G(t.$slots,`default`)],2)],2))}}),Um={class:`text-sm`},Wm={key:0,class:`mt-1 text-fg-muted`},Gm={key:1,class:`mt-2 flex flex-wrap gap-2`},Km=N({__name:`ChatChooseCard`,props Line truncated
`).map(e=>e.trim()).find(Boolean)||``,i=r.length>Dv?`${r.slice(0,Dv).trimEnd()}…`:r;return{text:i,full:n,truncated:i!==n}}function kv(e){return String(e||`event`).replaceAll(`_`,` `).replace(/\b\w/g,e=>e.toUpperCase())}function Av(e){let t=Number(e);if(!Number.isFinite(t)||t<0)return``;if(t<1e3)return`under 1 s`;let n=t/1e3;if(n<60)return`${n.toFixed(+(n<10))} s`;let r=Math.round(n),i=Math.floor(r/60),a=r%60;if(i<60)return a===0?`${i} min`:`${i} min ${a} s`;let o=Math.floor(i/60),s=i-o*60;return s===0?`${o} h`:`${o} h ${s} min`}function jv(e){let t=Number(e);return!Number.isFinite(t)||t<=0?``:t.toLocaleString(`en-US`)}function Mv(e){return typeof e==`string`?e:``}function Nv(e={}){let t=e.data||{},n=e.stage||`unknown stage`,r=e.workflow?`${e.workflow} workflow`:``;if(e.kind===`stage_start`)return{title:`Started stage: ${n}`,detail:r};if(e.kind===`stage_finish`){let e=Av(t.duration_ms),i=[r,e&&`ran for ${e}`].filter(Boolean).join(` · `);return{title:t.interrupted?`Stage interrupted: ${n}`:t.skipped?`Skipped stage: ${n}`:t.error?`Stage failed: ${n}`:`Finished stage: ${n}`,detail:[i,Mv(t.error),Mv(t.when)].filter(Boolean).join(` · `)}}if(e.kind===`task_retried`){let n=Number(t.retry_count);return{title:Number.isFinite(n)&&n>0?`Retry ${n}`:`Retry requested`,detail:[Mv(t.previous_stage)&&`after ${Mv(t.previous_stage)}`,Mv(t.previous_reason)].filter(Boolean).join(`: `)||e.detail||``}}if(e.kind===`agent_finish`){let r=jv(t.iterations),i=jv(t.tokens),a=Number(t.cached_tokens)||0,o=jv((Number(t.prompt_tokens)||0)-a),s=jv(t.completion_tokens),c=jv(t.cached_tokens),l=[r&&`${r} iterations`,i&&`${i} tokens`,o&&`${o} fresh prompt`,s&&`${s} completion`,c&&`${c} cached`,Mv(t.model)].filter(Boolean);return{title:`Agent ${Mv(t.status)||`finished`}: ${n}`,detail:l.join(` · `)||e.detail||``}}if(e.kind===`remediation_round`){let e=Number(t.of),n=Mv(t.author);return{title:`Remediation ${Mv(t.round)}${e>0?` of ${e}`:``}`,detail:[n&&`answers ${n}'s review`,t.review_id?`#${Mv(t.review_id)}`:``].filter(Boolean).join(` `)}}if(e.kind===`review_approved`){let e=Mv(t.pr_number);return{title:`Pull request approved`,detail:[Mv(t.author),e&&`#${e}`].filter(Boolean).join(` · `)}}if(e.kind===`step_retried`)return{title:`Attempt ${Mv(t.attempt)} of ${Mv(t.of)} failed: ${e.stage||`step`}`,detail:Mv(t.error),tone:`warn`};if(e.kind===`config_captured`)return{title:`Configuration captured`,detail:`The effective task-runtime configuration for this run.`};if(e.kind===`binding_started`){let e=Mv(t.source),n=Mv(t.capture_id),r=[{label:`binding ${Mv(t.binding_name)||Mv(t.binding_id)}`,to:`/events?tab=bindings`},...n?[{label:`captured event`,to:`/events?tab=inspector&capture=${encodeURIComponent(n)}`}]:[]];return t.unsigned===!0?{title:`Started by an unsigned event`,detail:e?`source ${e}`:``,tone:`warn`,links:r}:{title:`Started by an event`,detail:e?`source ${e}`:``,links:r}}if(e.kind===`changes_captured`){let e=t.totals??{},n=Number(e.files);return{title:`Change capture recorded`,detail:[Number.isFinite(n)&&n>0?`${n} file${n===1?``:`s`} changed`:``,t.captured_after?`captured after ${Mv(t.captured_after)}`:``].filter(Boolean).join(` · `)}}return{title:kv(e.kind||e.type),detail:e.detail||``}}var Pv=[`title`],Fv=N({__name:`ActivityRow`,props:{event:{}},emits:[`open`],setup(e,{emit:t}){let n=Ev();n.watchIdentities();let r=e,i=t,a=hv(),o=J(()=>a.taskIDFor(r.event)),s=J(()=>Ov(r.event,n.identityName));function c(){o.value>0&&i(`open`,o.value)}let l=J(()=>r.event.at?hh(r.event.at):`–`);return(e,t)=>(I(),K(B(Sv),{class:R(o.value>0?`cursor-pointer`:``),role:o.value>0?`link`:void 0,tabindex:o.value>0?0:void 0,title:o.value>0?`Open task details`:void 0,onClick:c,onKeydown:[_t(pt(c,[`prevent`]),[`enter`]),_t(pt(c,[`prevent`]),[`space`])]},{default:F(()=>[k(B(Q),{class:`font-medium`},{default:F(()=>[V(z(B(Nv)({...r.event,at:void 0,detail:void 0}).title),1)]),_:1}),k(B(Q),{class:`font-mono`},{default:F(()=>[V(z(o.value>0?`#${o.value}`:`–`),1)]),_:1}),k(B(Q),{class:`w-[55%] max-w-0`},{default:F(()=>[L(`span`,{class:`block truncate`,title:s.value.truncated?s.value.full:void 0},z(s.value.text),9,Pv)]),_:1}),k(B(Q),null,{default:F(()=>[V(z(l.value),1)]),_:1})]),_:1},8,[`class`,`role`,`tabindex`,`title`,`onKeydown`]))}}),Iv=[{value:`all`,label:`All`},{value:`tasks`,label:`Tasks`},{value:`system`,label:`System`}];function Lv(e){return(Number(e?.task_id)||0)>0}function Rv(e,t){return t===`tasks`?Lv(e):t!==`system`||!Lv(e)}function zv(e,t){return e.filter(e=>Rv(e,t))}function Bv(e,t){return e>0?``:t===`all`?`Waiting for activity`:t===`tasks`?`No task events yet`:`No system events yet`}function Vv(e,t){return`${e}:${t??0}`}function Hv(e){let t=[];for(let n of e){let e=n.kind||n.type||`event`,r=Number(n.task_id)||0,i=Vv(Ov(n).text,r),a=t[t.length-1];a&&a.key===i?(a.count+=1,a.events.push(n)):t.push({key:i,label:e,taskID:r,count:1,representative:n,events:[n]})}return t}var Uv={key:0,class:`font-normal text-fg-subtle`},Wv={role:`region`,"aria-label":`Activity`,"ari Line truncated
`,1)[0]??``;return t.length>80?`${t.slice(0,79)}…`:t}function sb(e){return(e?.merged||0)+(e?.completed||0)}function cb(e){return Object.entries(e?.inputs??{}).map(([e,t])=>({name:e,type:t.type,required:t.required===!0})).sort((e,t)=>e.name.localeCompare(t.name))}function lb(e,t){return e.filter(e=>e.required&&!(t[e.name]??``).trim()).map(e=>e.name)}function ub(e,t){switch(t){case`number`:{let t=e.trim();return t!==``&&!Number.isNaN(Number(t))?Number(t):e}case`bool`:return e===`true`||e!==`false`&&e;case`string`:return e;default:try{return JSON.parse(e)}catch{return e}}}function db(e,t){let n={};for(let r of e){let e=t[r.name];e!==void 0&&e!==``&&(n[r.name]=ub(e,r.type))}return n}var fb=[`onKeydown`],pb={key:0,class:`text-sm text-danger`,role:`alert`},mb={key:1,class:`grid gap-1.5`},hb=[`for`],gb={key:0,class:`font-normal text-fg-subtle`},_b=[`id`],vb=[`value`],yb={key:0,class:`text-xs text-fg-subtle`},bb={key:2,class:`grid gap-1.5`},xb=[`id`],Sb={class:`block truncate text-[13px] font-medium`},Cb={class:`block text-xs text-fg-subtle`},wb={key:0,class:`text-xs text-fg-subtle`},Tb={key:3,class:`grid gap-3`},Eb=[`for`],Db={class:`font-mono`},Ob={key:0,class:`text-fg-subtle`},kb={class:`grid gap-1.5`},Ab=[`for`],jb={class:`grid gap-1.5`},Mb=[`for`],Nb={key:4,class:`text-sm text-danger`,role:`alert`},Pb={class:`flex items-center gap-2 border-t border-border pt-4`},Fb={class:`mr-auto text-xs text-fg-subtle`},Ib=N({__name:`NewTaskForm`,props:{workflow:{},draft:{},initialWorkflow:{},initialInstructions:{}},emits:[`started`,`cancel`],setup(e,{emit:t}){let n=e,r=t,i=De(),a=q([]),o=q([]),s=q([]),c=q(``);Ue(async()=>{try{let[e,t]=await Promise.all([X.workflows(),X.repositories()]);a.value=(e?.definitions??[]).filter(e=>e.enabled),o.value=e?.workflows??[],s.value=(t??[]).map(e=>`${e.owner}/${e.name}`)}catch(e){c.value=String(e.message||e)}});let l=q(``),u=q(n.workflow??n.initialWorkflow??``),d=q(n.initialInstructions??``),f=q(ob(d.value)),p=q({});Ee(()=>{!u.value&&a.value[0]&&(u.value=a.value[0].id)});let m=J(()=>a.value.find(e=>e.id===u.value)),h=J(()=>cb(m.value)),g=J(()=>lb(h.value,p.value)),_=J(()=>m.value?.repository??`required`),v=J(()=>_.value!==`optional`&&_.value!==`none`),y=e=>o.value.find(t=>t.workflow===e),b=q(!1),x=q(``),S=J(()=>!(!l.value.trim()&&v.value||!u.value||!f.value.trim())&&g.value.length===0);async function C(){if(S.value&&!b.value){b.value=!0,x.value=``;try{let e=await X.workRequest({repository:_.value===`none`?``:l.value.trim(),workflow:u.value,title:f.value.trim(),instructions:d.value,inputs:db(h.value,p.value),...n.draft?{draft:n.draft}:{}});r(`started`,e.task_id)}catch(e){x.value=String(e.message||e)}finally{b.value=!1}}}return(e,t)=>(I(),A(`form`,{class:`grid gap-5`,onSubmit:pt(C,[`prevent`]),onKeydown:[_t(pt(C,[`meta`,`prevent`]),[`enter`]),_t(pt(C,[`ctrl`,`prevent`]),[`enter`])]},[c.value?(I(),A(`p`,pb,z(c.value),1)):P(``,!0),_.value===`none`?P(``,!0):(I(),A(`div`,mb,[L(`label`,{for:`${B(i)}-repo`,class:`text-[13px] font-medium`},[t[5]||=V(`Repository`,-1),v.value?P(``,!0):(I(),A(`span`,gb,` (optional)`))],8,hb),k(B(Z),{id:`${B(i)}-repo`,modelValue:l.value,"onUpdate:modelValue":t[0]||=e=>l.value=e,class:`font-mono`,placeholder:`owner/repository`,list:`${B(i)}-repos`,required:v.value},null,8,[`id`,`modelValue`,`list`,`required`]),L(`datalist`,{id:`${B(i)}-repos`},[(I(!0),A(H,null,j(s.value,e=>(I(),A(`option`,{key:e,value:e},null,8,vb))),128))],8,_b),s.value.length?(I(),A(`p`,yb,[t[6]||=V(`Configured: `,-1),(I(!0),A(H,null,j(s.value,e=>(I(),K(B(Y),{key:e,type:`button`,variant:`link`,size:`xs`,class:`h-auto px-1 font-mono text-fg-subtle`,onClick:t=>l.value=e},{default:F(()=>[V(z(e),1)]),_:2},1032,[`onClick`]))),128))])):P(``,!0)])),n.workflow?P(``,!0):(I(),A(`div`,bb,[L(`span`,{id:`${B(i)}-wf`,class:`text-[13px] font-medium`},`Workflow`,8,xb),k(B(cc),{modelValue:u.value,"onUpdate:modelValue":t[1]||=e=>u.value=e,"aria-labelledby":`${B(i)}-wf`,class:`grid grid-cols-1 gap-2 sm:grid-cols-3`,loop:``},{default:F(()=>[(I(!0),A(H,null,j(a.value,e=>(I(),K(B(uc),{key:e.id,value:e.id,class:`rounded-md border border-border bg-card px-3 py-2.5 text-left transition-colors hover:bg-secondary focus-visible:outline-2 focus-visible:outline-ring data-[state=checked]:border-primary data-[state=checked]:bg-secondary`},{default:F(()=>[L(`span`,Sb,z(e.name||e.id),1),L(`span`,Cb,[V(z(y(e.id)?.runs||0)+` runs`,1),y(e.id)?.runs?(I(),A(H,{key:0},[V(` · `+z(Math.round(B(sb)(y(e.id))/(y(e.id)?.runs||1)*100))+`% delivered`,1)],64)):P(``,!0)])]),_:2},1032,[`value`]))),128))]),_:1},8,[`modelValue`,`aria-labelledby`]),!a.value.length&&!c.value?(I(),A(`p`,wb,`No enabled workflows.`)):P(``,!0)])),h.value.length?(I(),A(`div`,Tb,[(I(!0),A(H,null,j(h.value,e=>(I(),A(`div`,{key:e.name,class:`grid gap-1.5`},[L(`label`,{for:`${B(i)}-input-${e.name}`,class:`text-[13px] font-medium`},[L(`span`,Db,z(e.name),1),e.required?(I(),A(`span`,Ob,` · required`)):P(``,!0)],8,Eb),k(B(Z),{id:`${B(i)}-input-${e.name}`,"model-value":p.value[e. Line truncated
`)){let e=n.indexOf(`:`);if(e<=0)continue;let r=n.slice(0,e).trim();r&&(t[r]=n.slice(e+1).trim())}return t}function Qb(e,t){if(!e.event_type)return{label:`Unidentified`,identified:!1};let n=t.find(t=>t.id===e.event_type);return{label:n?n.name:`Deleted type`,identified:!0}}function $b(e,t){if(!e)return`No event type`;let n=t.find(t=>t.id===e);return n?`${n.source} / ${n.name}`:`Deleted type`}function ex(e){let t=[...(e.headers||[]).map(e=>`${e.name} = ${e.value}`),...(e.payload||[]).map(e=>e.op===`present`?`${e.path} present`:`${e.path} = ${e.value??``}`)];return t.length?t.join(` · `):`any event`}function tx(e){return{headers:(e.headers||[]).filter(e=>e.name.trim()!==``).map(e=>({name:e.name.trim(),value:e.value})),payload:(e.payload||[]).filter(e=>e.path.trim()!==``).map(e=>e.op===`present`?{path:e.path.trim(),op:e.op}:{path:e.path.trim(),op:e.op,value:e.value??``})}}var nx=q([]),rx=q([]),ix=q(!0),ax=q(null),ox=q(!0),sx=q(null),cx=q(!1),lx=q(null);async function ux(){try{let e=await X.eventTypes(Xb().workspace);ix.value=e.enabled!==!1,nx.value=e.event_types||[],rx.value=e.proposals||[],ax.value=null}catch(e){ax.value=e.message||String(e)}finally{ox.value=!1}}function dx(e){return{headers:(e.headers||[]).map(e=>({...e})),payload:(e.payload||[]).map(e=>({...e}))}}function fx(e){lx.value=null,sx.value=e}function px(e){let t=xx.value.find(t=>String(t.id)===e.sample_id);fx({mode:`proposal`,id:null,source:e.source,name:``,rule:dx(e.rule),headersText:``,body:t?.body||``,exampleHeaders:e.headers||{}})}function mx(e=``){fx({mode:`paste`,id:null,source:e,name:``,rule:{headers:[],payload:[]},headersText:``,body:``,exampleHeaders:{}})}function hx(e){fx({mode:`edit`,id:e.id,source:e.source,name:e.name,rule:dx(e.rule),headersText:``,body:``,exampleHeaders:{}})}function gx(){sx.value=null}async function _x(){let e=sx.value;if(e){cx.value=!0;try{if(e.mode===`edit`&&e.id)await X.eventTypeUpdate(e.id,{name:e.name,rule:tx(e.rule)});else{let t=e.mode===`paste`?Zb(e.headersText):e.exampleHeaders;await X.eventTypeCreate({source:e.source,name:e.name,rule:e.mode===`paste`?void 0:tx(e.rule),example:{headers:t,body:e.body}})}sx.value=null,await ux()}catch(e){lx.value=e.message||String(e)}finally{cx.value=!1}}}var vx=q(null);async function yx(){let e=vx.value;if(vx.value=null,e)try{await X.eventTypeDelete(e.id),await ux()}catch(e){ax.value=e.message||String(e)}}var bx=100,xx=q([]),Sx=q(!0),Cx=q(null),wx=q(!0),Tx=q(null);async function Ex(){try{let e=await X.captures(bx);Sx.value=e.enabled!==!1,xx.value=e.captures||[],Cx.value=null}catch(e){Cx.value=e.message||String(e)}finally{wx.value=!1}}function Dx(e){let t=xx.value.find(t=>t.id===e);return t&&(Tx.value=t),!!t}function Ox(){xx.value.length&&(Tx.value=xx.value[0])}function kx(){Sh(`captures`,()=>{Ex(),ux()})}var Ax=N({__name:`Tabs`,props:{defaultValue:{},orientation:{},dir:{},activationMode:{},modelValue:{},unmountOnHide:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,i=Tt(n,`class`),a=O(i,r);return(e,t)=>(I(),K(B($c),W({"data-slot":`tabs`,"data-orientation":B(a).orientation||`horizontal`},B(a),{class:B(U)(`gap-2 group/tabs flex data-horizontal:flex-col`,n.class)}),{default:F(t=>[G(e.$slots,`default`,Ye(Ce(t)))]),_:3},16,[`data-orientation`,`class`]))}}),jx=N({__name:`TabsContent`,props:{value:{},forceMount:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e,n=Tt(t,`class`);return(e,r)=>(I(),K(B(nl),W({"data-slot":`tabs-content`,class:B(U)(`text-sm flex-1 outline-none`,t.class)},B(n)),{default:F(()=>[G(e.$slots,`default`)]),_:3},16,[`class`]))}}),Mx=N({__name:`TabsList`,props:{loop:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]},variant:{default:`default`}},setup(e){let t=e,n=Tt(t,`class`,`variant`);return(r,i)=>(I(),K(B(rl),W({"data-slot":`tabs-list`,"data-variant":e.variant},B(n),{class:B(U)(B(Px)({variant:e.variant}),t.class)}),{default:F(()=>[G(r.$slots,`default`)]),_:3},16,[`data-variant`,`class`]))}}),Nx=N({__name:`TabsTrigger`,props:{value:{},disabled:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e,n=Tt(t,`class`),r=pe(n);return(e,n)=>(I(),K(B(il),W({"data-slot":`tabs-trigger`,class:B(U)(`gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg:not([class*=size-])]:size-4 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:Line truncated
WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var HN=ON(`CharSizeService`),UN=ON(`CoreBrowserService`),WN=ON(`MouseService`),GN=ON(`RenderService`),KN=ON(`SelectionService`),qN=ON(`CharacterJoinerService`),JN=ON(`ThemeService`),YN=ON(`LinkProviderService`),XN=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?nP.isErrorNoTelemetry(e)?new nP(e.message+`
@@ -23,57 +23,57 @@ WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){t
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh()),rR&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r||!t?!1:this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r?!1:this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=ER(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=VL(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-DR),DR),t/=DR,t/Math.abs(t)+Math.round(t*(OR-1)))}shouldForceSelection(e){return $L?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,!(e.button===2&&this.hasSelection)&&e.button===0){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):e.detail===1?this._handleSingleClick(e):e.detail===2?this._handleDoubleClick(e):e.detail===3&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener(`mouseup`,this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),kR)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener(`mousemove`,this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener(`mouseup`,this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;let t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&t.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){let t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!($L&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._active Line truncated
`))),this._register(this._terminal.onA11yTab(e=>this._handleTab(e))),this._register(this._terminal.onKey(e=>this._handleKey(e.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(nI(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(gP(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<kB+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===kB+1&&(this._liveRegion.textContent+=sN.get())))}_clearLiveRegion(){this._liveRegion.textContent=``,this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let e=n.lines.get(n.ydisp+i),t=[],a=e?.translateToString(!0,void 0,void 0,t)||``,o=(n.ydisp+i+1).toString(),s=this._rowElements[i];s&&(a.length===0?(s.textContent=`\xA0`,this._rowColumns.set(s,[0,1])):(s.textContent=a,this._rowColumns.set(s,t)),s.setAttribute(`aria-posinset`,o),s.setAttribute(`aria-setsize`,r),this._alignRowWidth(s))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce=``)}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2];if(n.getAttribute(`aria-posinset`)===(t===0?`1`:`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==r)return;let i,a;if(t===0?(i=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(i=this._rowElements.shift(),a=n,this._rowContainer.removeChild(i)),i.removeEventListener(`focus`,this._topBoundaryFocusListener),a.removeEventListener(`focus`,this._bottomBoundaryFocusListener),t===0){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement(`afterbegin`,e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error(`anchorNode and/or focusNode are null`);return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let i=({node:e,offset:t})=>{let n=e instanceof Text?e.parentNode:e,r=parseInt(n?.getAttribute(`aria-posinset`),10)-1;if(isNaN(r))return console.warn(`row is invalid. Race condition?`),null;let i=this._rowColumns.get(n);if(!i)return console.warn(`columns is null. Race condition?`),null;let a=t<i.length?i[t]:i.slice(-1)[0]+1;return a>=this._terminal.cols&&(++r,a=0),{row:r,column:a}},a=i(t),o=i(n);if(a&&o){if(a.row>o.row||a.row===o.row&&a.column>=o.column)throw Error(`invalid range`);this._terminal.select(a.column,a.row,(o.row-a.row)*this._terminal.cols-a.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener(`focus`,this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement(`div`);return e.setAttribute(`role`,`listitem`),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform=``;let t=e.getBoundingClientRect().width,n=this._rowColumns.get(e)?.slice(-1)?.[0];if(!n)return;let Line truncated
`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return aN.get()},set promptLabel(e){aN.set(e)},get tooMuchOutput(){return sN.get()},set tooMuchOutput(e){sN.set(e)}}}_verifyIntegers(...e){for(HB of e)if(HB===1/0||isNaN(HB)||HB%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(HB of e)if(HB&&(HB===1/0||isNaN(HB)||HB%1!=0||HB<0))throw Error(`This API only accepts positive integers`)}},WB=2,GB=1,KB=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(WB,Math.floor(u/e.css.cell.width)),rows:Math.max(GB,Math.floor(l/e.css.cell.height))}}},qB={class:`flex h-[32rem] min-h-0 flex-col gap-2`},JB={key:0,class:`text-sm text-fg-muted`,role:`status`},YB=N({__name:`SandboxView`,props:{taskId:{},attempt:{}},setup(e){let t=e,n=q(null),r=q(`connecting`),i=null,a=null,o=null,s=null;function c(){try{o?.fit()}catch{}}return Ue(()=>{let e=n.value;if(!e)return;i=new UB({convertEol:!0,disableStdin:!0,cursorBlink:!1,fontFamily:`'IBM Plex Mono', ui-monospace, monospace`,fontSize:13,theme:{background:`#0b0f14`,foreground:`#e6edf3`}}),o=new KB,i.loadAddon(o),i.open(e),c();let l=window.location.protocol===`https:`?`wss:`:`ws:`,u=new URLSearchParams({attempt:String(t.attempt)}),d=new WebSocket(`${l}//${window.location.host}/api/tasks/${encodeURIComponent(t.taskId)}/sandbox?${u}`);a=d,d.binaryType=`arraybuffer`,d.onopen=()=>{r.value=`open`},d.onmessage=e=>{i&&(typeof e.data==`string`&&(r.value=`failed`),i.write(typeof e.data==`string`?e.data:new Uint8Array(e.data)))},d.onerror=()=>{r.value=`failed`},d.onclose=()=>{r.value!==`failed`&&(r.value=`closed`)},s=new ResizeObserver(c),s.observe(e)}),rt(()=>{s?.disconnect(),s=null,a?.close(),a=null,i?.dispose(),i=null,o=null}),(e,t)=>(I(),A(`div`,qB,[r.value===`open`?P(``,!0):(I(),A(`p`,JB,[r.value===`connecting`?(I(),A(H,{key:0},[V(`Connecting…`)],64)):r.value===`closed`?(I(),A(H,{key:1},[V(`The sandbox ended.`)],64)):(I(),A(H,{key:2},[V(`Sandbox unavailable.`)],64))])),L(`div`,{ref_key:`host`,ref:n,class:`min-h-0 flex-1 overflow-hidden rounded-md border border-border bg-[#0b0f14] p-2`},null,512)]))}}),XB={class:`flex flex-wrap items-center gap-3 border-b border-border pb-3`},ZB={class:`inline-flex items-center gap-2`},QB={class:`inline-flex items-center gap-2`},$B=`__all__`,eV=N({__name:`TaskLogFilters`,props:{filters:{},stages:{}},emits:[`filter`],setup(e,{emit:t}){let n=e,r=t,i=J(()=>yT.map(e=>({value:e.value||$B,label:e.label}))),a=J(()=>n.filters.level||$B),o=J(()=>n.filters.stage||$B);function s(e){r(`filter`,{...n.filters,...e})}function c(e){s({level:String(e)===$B?``:String(e)})}function l(e){s({stage:String(e)===$B?``:String(e)})}return(t,n)=>(I(),A(`div`,XB,[L(`div`,ZB,[k(B(Tf),{"model-value":a.value,"onUpdate:modelValue":c},{default:F(()=>[k(B(Mf),{size:`sm`,"aria-label":`Filter log entries by level`},{default:F(()=>[k(B(Nf))]),_:1}),k(B(Ef),null,{default:F(()=>[k(B(Df),null,{default:F(()=>[(I(!0),A(H,null,j(i.value,e=>(I(),K(B(kf),{key:e.value,value:e.value},{default:F(()=>[V(z(e.label),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`model-value`])]),L(`div`,QB,[k(B(Tf),{"model-value":o.value,"onUpdate:modelValue":l},{default:F(()=>[k(B(Mf),{size:`sm`,"aria-label":`Filter log entries by stage`},{default:F(()=>[k(B(Nf))]),_:1}),k(B(Ef),null,{default:F(()=>[k(B(Df),null,{default:F(()=>[k(B(kf),{value:$B},{default:F(()=>[...n[0]||=[V(`All stages`,-1)]]),_:1}),(I(!0),A(H,null,j(e.stages,e=>(I(),K(B(kf),{key:e,value:e},{default:F(()=>[V(z(e),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`model-value`])])]))}}),tV={class:`sr-only`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`},nV={key:2,class:`flex flex-col items-start gap-2 py-3`},rV={key:0,class:`mt-2 flex flex-wrap items-cent Line truncated
`)}};hK.defaultYaml={explicit:!1,version:`1.2`},hK.defaultTags={"!!":`tag:yaml.org,2002:`};function gK(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 _K(e){let t=new Set;return cK(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function vK(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function yK(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=_K(e);let a=vK(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(eK(t.node)||nK(t.node)))t.node.anchor=t.anchor;else{let t=Error(`Failed to resolve repeated object (this should not happen)`);throw t.source=e,t}}},sourceObjects:r}}function bK(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=bK(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=bK(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=bK(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=bK(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function xK(e,t,n){if(Array.isArray(e))return e.map((e,t)=>xK(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!iK(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}var SK=class{constructor(e){Object.defineProperty(this,YG,{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(!ZG(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=xK(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?bK(i,{"":o},``,o):o}},CK=class extends SK{constructor(e){super(UG),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=[],cK(e,{Node:(e,t)=>{(XG(t)||iK(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||=(xK(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=wK(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(gK(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}};function wK(e,t,n){if(XG(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(nK(t)){let r=0;for(let i of t.items){let t=wK(e,i,n);t>r&&(r=t)}return r}if($G(t)){let r=wK(e,t.key,n),i=wK(e,t.value,n);return Math.max(r,i)}return 1}var TK=e=>!e||typeof e!=`function`&&typeof e!=`object`,EK=class extends SK{constructor(e){super(qG),this.value=e}toJSON(e,t){return t?.keep?this.value:xK(this.value,e,t)}toString(){return String(this.value)}};EK.BLOCK_FOLDED=`BLOCK_FOLDED`,EK.BLOCK_LITERAL=`BLOCK_LITERAL`,EK.PLAIN=`PLAIN`,EK.QUOTE_DOUBLE=`QUOTE_DOUBLE`,EK.QUOTE_SINGLE=`QUOTE_SINGLE`;var DK=`tag:yaml.org,2002:`;function OK(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 kK(e,t,n){if(ZG(e)&&(e=e.contents),rK(e))return e;if($G(e)){let t=n.schema[GG].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 CK(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=DK+t.slice(2));let l=OK(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new EK(e);return c&&(c.node=t),t Line truncated
`)?PK(n,t):n.includes(`
`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return aN.get()},set promptLabel(e){aN.set(e)},get tooMuchOutput(){return sN.get()},set tooMuchOutput(e){sN.set(e)}}}_verifyIntegers(...e){for(HB of e)if(HB===1/0||isNaN(HB)||HB%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(HB of e)if(HB&&(HB===1/0||isNaN(HB)||HB%1!=0||HB<0))throw Error(`This API only accepts positive integers`)}},WB=2,GB=1,KB=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(WB,Math.floor(u/e.css.cell.width)),rows:Math.max(GB,Math.floor(l/e.css.cell.height))}}},qB={class:`flex h-[32rem] min-h-0 flex-col gap-2`},JB={key:0,class:`text-sm text-fg-muted`,role:`status`},YB=N({__name:`SandboxView`,props:{taskId:{},attempt:{}},setup(e){let t=e,n=q(null),r=q(`connecting`),i=null,a=null,o=null,s=null;function c(){try{o?.fit()}catch{}}return Ue(()=>{let e=n.value;if(!e)return;i=new UB({convertEol:!0,disableStdin:!0,cursorBlink:!1,fontFamily:`'IBM Plex Mono', ui-monospace, monospace`,fontSize:13,theme:{background:`#0b0f14`,foreground:`#e6edf3`}}),o=new KB,i.loadAddon(o),i.open(e),c();let l=window.location.protocol===`https:`?`wss:`:`ws:`,u=new URLSearchParams({attempt:String(t.attempt)}),d=new WebSocket(`${l}//${window.location.host}/api/tasks/${encodeURIComponent(t.taskId)}/sandbox?${u}`);a=d,d.binaryType=`arraybuffer`,d.onopen=()=>{r.value=`open`},d.onmessage=e=>{i&&(typeof e.data==`string`&&(r.value=`failed`),i.write(typeof e.data==`string`?e.data:new Uint8Array(e.data)))},d.onerror=()=>{r.value=`failed`},d.onclose=()=>{r.value!==`failed`&&(r.value=`closed`)},s=new ResizeObserver(c),s.observe(e)}),rt(()=>{s?.disconnect(),s=null,a?.close(),a=null,i?.dispose(),i=null,o=null}),(e,t)=>(I(),A(`div`,qB,[r.value===`open`?P(``,!0):(I(),A(`p`,JB,[r.value===`connecting`?(I(),A(H,{key:0},[V(`Connecting…`)],64)):r.value===`closed`?(I(),A(H,{key:1},[V(`The sandbox ended.`)],64)):(I(),A(H,{key:2},[V(`Sandbox unavailable.`)],64))])),L(`div`,{ref_key:`host`,ref:n,class:`min-h-0 flex-1 overflow-hidden rounded-md border border-border bg-[#0b0f14] p-2`},null,512)]))}}),XB={class:`flex flex-wrap items-center gap-3 border-b border-border pb-3`},ZB={class:`inline-flex items-center gap-2`},QB={class:`inline-flex items-center gap-2`},$B=`__all__`,eV=N({__name:`TaskLogFilters`,props:{filters:{},stages:{}},emits:[`filter`],setup(e,{emit:t}){let n=e,r=t,i=J(()=>yT.map(e=>({value:e.value||$B,label:e.label}))),a=J(()=>n.filters.level||$B),o=J(()=>n.filters.stage||$B);function s(e){r(`filter`,{...n.filters,...e})}function c(e){s({level:String(e)===$B?``:String(e)})}function l(e){s({stage:String(e)===$B?``:String(e)})}return(t,n)=>(I(),A(`div`,XB,[L(`div`,ZB,[k(B(wf),{"model-value":a.value,"onUpdate:modelValue":c},{default:F(()=>[k(B(jf),{size:`sm`,"aria-label":`Filter log entries by level`},{default:F(()=>[k(B(Mf))]),_:1}),k(B(Tf),null,{default:F(()=>[k(B(Ef),null,{default:F(()=>[(I(!0),A(H,null,j(i.value,e=>(I(),K(B(Of),{key:e.value,value:e.value},{default:F(()=>[V(z(e.label),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`model-value`])]),L(`div`,QB,[k(B(wf),{"model-value":o.value,"onUpdate:modelValue":l},{default:F(()=>[k(B(jf),{size:`sm`,"aria-label":`Filter log entries by stage`},{default:F(()=>[k(B(Mf))]),_:1}),k(B(Tf),null,{default:F(()=>[k(B(Ef),null,{default:F(()=>[k(B(Of),{value:$B},{default:F(()=>[...n[0]||=[V(`All stages`,-1)]]),_:1}),(I(!0),A(H,null,j(e.stages,e=>(I(),K(B(Of),{key:e,value:e},{default:F(()=>[V(z(e),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`model-value`])])]))}}),tV={class:`sr-only`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`},nV={key:2,class:`flex flex-col items-start gap-2 py-3`},rV={key:0,class:`mt-2 flex flex-wrap items-cent Line truncated
`)}};fK.defaultYaml={explicit:!1,version:`1.2`},fK.defaultTags={"!!":`tag:yaml.org,2002:`};function pK(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 mK(e){let t=new Set;return aK(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function hK(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function gK(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=mK(e);let a=hK(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(ZG(t.node)||$G(t.node)))t.node.anchor=t.anchor;else{let t=Error(`Failed to resolve repeated object (this should not happen)`);throw t.source=e,t}}},sourceObjects:r}}function _K(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=_K(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=_K(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=_K(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=_K(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function vK(e,t,n){if(Array.isArray(e))return e.map((e,t)=>vK(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!tK(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}var yK=class{constructor(e){Object.defineProperty(this,KG,{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(!JG(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=vK(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?_K(i,{"":o},``,o):o}},bK=class extends yK{constructor(e){super(BG),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=[],aK(e,{Node:(e,t)=>{(qG(t)||tK(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||=(vK(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=xK(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(pK(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}};function xK(e,t,n){if(qG(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=xK(e,i,n);t>r&&(r=t)}return r}if(XG(t)){let r=xK(e,t.key,n),i=xK(e,t.value,n);return Math.max(r,i)}return 1}var SK=e=>!e||typeof e!=`function`&&typeof e!=`object`,CK=class extends yK{constructor(e){super(WG),this.value=e}toJSON(e,t){return t?.keep?this.value:vK(this.value,e,t)}toString(){return String(this.value)}};CK.BLOCK_FOLDED=`BLOCK_FOLDED`,CK.BLOCK_LITERAL=`BLOCK_LITERAL`,CK.PLAIN=`PLAIN`,CK.QUOTE_DOUBLE=`QUOTE_DOUBLE`,CK.QUOTE_SINGLE=`QUOTE_SINGLE`;var wK=`tag:yaml.org,2002:`;function TK(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 EK(e,t,n){if(JG(e)&&(e=e.contents),eK(e))return e;if(XG(e)){let t=n.schema[HG].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 bK(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=wK+t.slice(2));let l=TK(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new CK(e);return c&&(c.node=t),t Line truncated
`)?jK(n,t):n.includes(`
`)?`
`+PK(n,t):(e.endsWith(` `)?``:` `)+n,IK=`flow`,LK=`block`,RK=`quoted`;function zK(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=BK(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=BK(e,h,t.length)),d=h+t.length+c,f=void 0;else{if(r===` `&&p&&p!==` `&&p!==`
`+jK(n,t):(e.endsWith(` `)?``:` `)+n,NK=`flow`,PK=`block`,FK=`quoted`;function IK(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=LK(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=LK(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 BK(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 VK=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),HK=e=>/^(%|---|\.\.\.)/m.test(e);function UK(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 WK(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(HK(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)+`
`&&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 LK(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 RK=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),zK=e=>/^(%|---|\.\.\.)/m.test(e);function BK(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 VK(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(zK(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:zK(o,a,RK,VK(t,!1))}function GK(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
`)||/[ \t]\n|\n[ \t]/.test(e))return WK(e,t);let n=t.indent||(HK(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:zK(r,n,IK,VK(t,!1))}function KK(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=WK;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?GK:i&&!t?WK:n?GK:WK}return r(e,t)}var qK;try{qK=RegExp(`(^|(?<!
`,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:IK(o,a,FK,RK(t,!1))}function HK(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
`)||/[ \t]\n|\n[ \t]/.test(e))return VK(e,t);let n=t.indent||(zK(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:IK(r,n,NK,RK(t,!1))}function UK(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=VK;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?HK:i&&!t?VK:n?HK:VK}return r(e,t)}var WK;try{WK=RegExp(`(^|(?<!
))
+(?!
|$)`,`g`)}catch{qK=/\n+(?!\n|$)/g}function JK({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 KK(n,r);let l=r.indent||(r.forceBlockIndent||HK(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===EK.BLOCK_FOLDED?!1:t===EK.BLOCK_LITERAL||!UK(n,c,l.length);if(!n)return u?`|
|$)`,`g`)}catch{WK=/\n+(?!\n|$)/g}function GK({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 UK(n,r);let l=r.indent||(r.forceBlockIndent||zK(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===CK.BLOCK_FOLDED?!1:t===CK.BLOCK_LITERAL||!BK(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(qK,`$&${l}`));let h=!1,g,_=-1;for(g=0;g<n.length;++g){let e=n[g];if(e===` `)h=!0;else if(e===`
`&&(p=p.slice(0,-1)),p.replace(WK,`$&${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=VK(r,!0);o!==`folded`&&t!==EK.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=zK(`${v}${e}${p}`,l,LK,a);if(!i)return`>${y}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${y}\n${l}${v}${n}${p}`}function YK(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 KK(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
`)?KK(a,t):JK(e,t,n,r);if(!s&&!u&&i!==EK.PLAIN&&a.includes(`
`))return JK(e,t,n,r);if(HK(a)){if(c===``)return t.forceBlockIndent=!0,JK(e,t,n,r);if(s&&c===l)return KK(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 KK(a,t)}return s?d:zK(d,c,IK,VK(t,!1))}function XK(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!==EK.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=EK.QUOTE_DOUBLE);let c=e=>{switch(e){case EK.BLOCK_FOLDED:case EK.BLOCK_LITERAL:return i||a?KK(o.value,t):JK(o,t,n,r);case EK.QUOTE_DOUBLE:return WK(o.value,t);case EK.QUOTE_SINGLE:return GK(o.value,t);case EK.PLAIN:return YK(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}function ZK(e,t){let n=Object.assign({blockQuote:!0,commentString:NK,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 QK(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(eK(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 $K(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(eK(e)||nK(e))&&e.anchor;a&&gK(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 eq(e,t,n,r){if($G(e))return e.toString(t,n,r);if(XG(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=rK(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=QK(t.doc.schema.tags,a);let o=$K(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):eK(a)?XK(a,t,n,r):a.toString(t,n,r);return o?eK(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function tq({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=rK(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(nK(e)||!rK(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||nK(e)||(eK(e)?e.type===EK.BLOCK_FOLDED||e.type===EK.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=eq(e,n,()=>m=!0,()=>h=!0);if(!p&&!n.inFlow&&g.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(),g===``?`?`:p?`? ${g}`:g}else if(a&&!d||t==null&&p)return g=`? ${g}`,f&&!m?g+=FK(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=FK(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=FK(g,n.indent,l(f))));let _,v,y;rK(t)?(_=!!t.spaceBefore,v=t.commentBefore,y=t.comment):(_=!1,v=null,y=null,t&&typeof t==`object`&&(t=o.createNode(t))),n.implicitKey=!1,!p&&!f&&eK(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&tK(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let b=!1,x=eq(t,n,()=>b=!0,()=>h=!0),S=` `;if(f||_||v){if(S=_?`
`:``,v){let e=l(v);S+=`\n${PK(e,n.indent)}`}x===``&&!n.inFlow?S===`
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\n+/g,`$&${l}`),i=!1,a=RK(r,!0);o!==`folded`&&t!==CK.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=IK(`${v}${e}${p}`,l,PK,a);if(!i)return`>${y}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${y}\n${l}${v}${n}${p}`}function KK(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 UK(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
`)?UK(a,t):GK(e,t,n,r);if(!s&&!u&&i!==CK.PLAIN&&a.includes(`
`))return GK(e,t,n,r);if(zK(a)){if(c===``)return t.forceBlockIndent=!0,GK(e,t,n,r);if(s&&c===l)return UK(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 UK(a,t)}return s?d:IK(d,c,NK,RK(t,!1))}function qK(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!==CK.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=CK.QUOTE_DOUBLE);let c=e=>{switch(e){case CK.BLOCK_FOLDED:case CK.BLOCK_LITERAL:return i||a?UK(o.value,t):GK(o,t,n,r);case CK.QUOTE_DOUBLE:return VK(o.value,t);case CK.QUOTE_SINGLE:return HK(o.value,t);case CK.PLAIN:return KK(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}function JK(e,t){let n=Object.assign({blockQuote:!0,commentString:AK,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 YK(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(ZG(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 XK(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(ZG(e)||$G(e))&&e.anchor;a&&pK(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 ZK(e,t,n,r){if(XG(e))return e.toString(t,n,r);if(qG(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=eK(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=YK(t.doc.schema.tags,a);let o=XK(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):ZG(a)?qK(a,t,n,r):a.toString(t,n,r);return o?ZG(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function QK({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=eK(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if($G(e)||!eK(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)||(ZG(e)?e.type===CK.BLOCK_FOLDED||e.type===CK.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=ZK(e,n,()=>m=!0,()=>h=!0);if(!p&&!n.inFlow&&g.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(),g===``?`?`:p?`? ${g}`:g}else if(a&&!d||t==null&&p)return g=`? ${g}`,f&&!m?g+=MK(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=MK(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=MK(g,n.indent,l(f))));let _,v,y;eK(t)?(_=!!t.spaceBefore,v=t.commentBefore,y=t.comment):(_=!1,v=null,y=null,t&&typeof t==`object`&&(t=o.createNode(t))),n.implicitKey=!1,!p&&!f&&ZG(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&QG(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let b=!1,x=ZK(t,n,()=>b=!0,()=>h=!0),S=` `;if(f||_||v){if(S=_?`
`:``,v){let e=l(v);S+=`\n${jK(e,n.indent)}`}x===``&&!n.inFlow?S===`
`&&y&&(S=`
`):S+=`\n${n.indent}`}else if(!p&&nK(t)){let e=x[0],r=x.indexOf(`
`):S+=`\n${n.indent}`}else if(!p&&$G(t)){let e=x[0],r=x.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=x.indexOf(` `);e===`&`&&n!==-1&&n<r&&x[n+1]===`!`&&(n=x.indexOf(` `,n+1)),(n===-1||r<n)&&(t=!0)}t||(S=`\n${n.indent}`)}}else(x===``||x[0]===`
`)&&(S=``);return g+=S+x,n.inFlow?b&&r&&r():y&&!b?g+=FK(g,n.indent,l(y)):h&&i&&i(),g}function nq(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}var rq=`<<`,iq={identify:e=>e===rq||typeof e==`symbol`&&e.description===rq,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new EK(Symbol(rq)),{addToJSMap:oq}),stringify:()=>rq},aq=(e,t)=>(iq.identify(t)||eK(t)&&(!t.type||t.type===EK.PLAIN)&&iq.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===iq.tag&&e.default);function oq(e,t,n){let r=cq(e,n);if(tK(r))for(let n of r.items)sq(e,t,n);else if(Array.isArray(r))for(let n of r)sq(e,t,n);else sq(e,t,r)}function sq(e,t,n){let r=cq(e,n);if(!QG(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 cq(e,t){return e&&XG(t)?t.resolve(e.doc,e):t}function lq(e,t,{key:n,value:r}){if(rK(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(aq(e,n))oq(e,t,r);else{let i=xK(n,``,e);if(t instanceof Map)t.set(i,xK(r,i,e));else if(t instanceof Set)t.add(i);else{let a=uq(n,i,e),o=xK(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function uq(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(rK(e)&&n?.doc){let t=ZK(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)+`..."`),nq(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 dq(e,t,n){return new fq(kK(e,void 0,n),kK(t,void 0,n))}var fq=class e{constructor(e,t=null){Object.defineProperty(this,YG,{value:KG}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return rK(n)&&(n=n.clone(t)),rK(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return lq(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?tq(this,e,t,n):JSON.stringify(this)}};function pq(e,t,n){return(t.inFlow??e.flow?hq:mq)(e,t,n)}function mq({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(rK(i))!d&&i.spaceBefore&&f.push(``),gq(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if($G(i)){let e=rK(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),gq(n,f,e.commentBefore,d))}d=!1;let s=eq(i,u,()=>o=null,()=>d=!0);o&&(s+=FK(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}`:`
`)&&(S=``);return g+=S+x,n.inFlow?b&&r&&r():y&&!b?g+=MK(g,n.indent,l(y)):h&&i&&i(),g}function $K(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}var eq=`<<`,tq={identify:e=>e===eq||typeof e==`symbol`&&e.description===eq,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new CK(Symbol(eq)),{addToJSMap:rq}),stringify:()=>eq},nq=(e,t)=>(tq.identify(t)||ZG(t)&&(!t.type||t.type===CK.PLAIN)&&tq.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===tq.tag&&e.default);function rq(e,t,n){let r=aq(e,n);if(QG(r))for(let n of r.items)iq(e,t,n);else if(Array.isArray(r))for(let n of r)iq(e,t,n);else iq(e,t,r)}function iq(e,t,n){let r=aq(e,n);if(!YG(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 aq(e,t){return e&&qG(t)?t.resolve(e.doc,e):t}function oq(e,t,{key:n,value:r}){if(eK(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(nq(e,n))rq(e,t,r);else{let i=vK(n,``,e);if(t instanceof Map)t.set(i,vK(r,i,e));else if(t instanceof Set)t.add(i);else{let a=sq(n,i,e),o=vK(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function sq(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(eK(e)&&n?.doc){let t=JK(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)+`..."`),$K(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 cq(e,t,n){return new lq(EK(e,void 0,n),EK(t,void 0,n))}var lq=class e{constructor(e,t=null){Object.defineProperty(this,KG,{value:UG}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return eK(n)&&(n=n.clone(t)),eK(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return oq(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?QK(this,e,t,n):JSON.stringify(this)}};function uq(e,t,n){return(t.inFlow??e.flow?fq:dq)(e,t,n)}function dq({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(eK(i))!d&&i.spaceBefore&&f.push(``),pq(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(XG(i)){let e=eK(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),pq(n,f,e.commentBefore,d))}d=!1;let s=ZK(i,u,()=>o=null,()=>d=!0);o&&(s+=MK(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+=`
`+PK(l(e),c),s&&s()):d&&o&&o(),p}function hq({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(rK(i))i.spaceBefore&&d.push(``),gq(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if($G(i)){let e=rK(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),gq(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=rK(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=eq(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+=FK(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 gq({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=PK(t(r),e);n.push(i.trimStart())}}function _q(e,t){let n=eK(t)?t.value:t;for(let r of e)if($G(r)&&(r.key===t||r.key===n||eK(r.key)&&r.key.value===n))return r}var vq=class extends MK{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(GG,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(dq(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=$G(e)?e:!e||typeof e!=`object`||!(`key`in e)?new fq(e,e?.value):new fq(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`);eK(r.value)&&TK(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&&eK(n)?n.value:n)??void 0}has(e){return!!_q(this.items,e)}set(e,t){this.add(new fq(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)lq(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!$G(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})),pq(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},yq={collection:`map`,default:!0,nodeClass:vq,tag:`tag:yaml.org,2002:map`,resolve(e,t){return QG(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>vq.from(e,t,n)},bq=class extends MK{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(JG,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=xq(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=xq(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&eK(r)?r.value:r}has(e){let t=xq(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=xq(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];eK(r)&&TK(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(xK(e,String(r++),t));return n}toString(e,t,n){return e?pq(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(kK(a,void 0,n))}}return i}};function xq(e){let t=eK(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var Sq={collection:`seq`,default:!0,nodeClass:bq,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return tK(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>bq.from(e,t,n)},Cq={identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify(e,t,n,r){return t=Object.assign({actualString:!0},t),XK(e,t,n,r)}},wq={identify:e=>e==null,createNode:()=>new EK(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new EK(null),stringify:({source:e},t)=>typeof e==`string`&&wq.test.test(e)?e:t.options.nullStr},Tq={identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new EK(e[0]===`t`||e[0]===`T`),stringify({source:e,value:t},n){return e&&Tq.test.test(e)&&t===(e[0]===`t`||e[0]===`T`)?e:t?n.options.trueStr:n.options.falseStr}};function Eq({format:e,minFractionDigits:t,tag:n,value:r}){if(typeof r==`bigint`)return String(r);let i=typeof r==`number`?r:Number(r);if(!isFinite(i))return isNaN(i)?`.nan`:i<0?`-.inf`:`.inf`;let a=Object.is(r,-0)?`-0`:JSON.stringify(r);if(!e&&t&&(!n||n===`tag:yaml.org,2002:float`)&&/^-?\d/.test(a)&&!a.includes(`e`)){let e=a.indexOf(`.`);e<0&&(e=a.length,a+=`.`);let n=t-(a.length-e-1);for(;n-->0;)a+=`0`}return a}var Dq={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]===`-`?-1/0:1/0,stringify:Eq},Oq={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),string Line truncated
`:` `)}return XK({comment:e,type:t,value:s},r,i,a)}};function Hq(e,t){if(tK(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!$G(r)){if(QG(r)){r.items.length>1&&t(`Each pair must have its own sequence indicator`);let e=r.items[0]||new fq(new EK(null));if(r.commentBefore&&(e.key.commentBefore=e.key.commentBefore?`${r.commentBefore}\n${e.key.commentBefore}`:r.commentBefore),r.comment){let t=e.value??e.key;t.comment=t.comment?`${r.comment}\n${t.comment}`:r.comment}r=e}e.items[n]=$G(r)?r:new fq(r)}}else t(`Expected a sequence for this tag`);return e}function Uq(e,t,n){let{replacer:r}=n,i=new bq(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(dq(o,s,n))}return i}var Wq={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:Hq,createNode:Uq},Gq=class e extends bq{constructor(){super(),this.add=vq.prototype.add.bind(this),this.delete=vq.prototype.delete.bind(this),this.get=vq.prototype.get.bind(this),this.has=vq.prototype.has.bind(this),this.set=vq.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($G(e)?(r=xK(e.key,``,t),i=xK(e.value,r,t)):r=xK(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=Uq(e,t,n),i=new this;return i.items=r.items,i}};Gq.tag=`tag:yaml.org,2002:omap`;var Kq={collection:`seq`,identify:e=>e instanceof Map,nodeClass:Gq,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,t){let n=Hq(e,t),r=[];for(let{key:e}of n.items)eK(e)&&(r.includes(e.value)?t(`Ordered maps must not include duplicate keys: ${e.value}`):r.push(e.value));return Object.assign(new Gq,n)},createNode:(e,t,n)=>Gq.from(e,t,n)};function qq({value:e,source:t},n){return t&&(e?Jq:Yq).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var Jq={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 EK(!0),stringify:qq},Yq={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 EK(!1),stringify:qq},Xq={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]===`-`?-1/0:1/0,stringify:Eq},Zq={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():Eq(e)}},Qq={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 EK(parseFloat(e.replace(/_/g,``))),n=e.indexOf(`.`);if(n!==-1){let r=e.substring(n+1).replace(/_/g,``);r[r.length-1]===`0`&&(t.minFractionDigits=r.length)}return t},stringify:Eq},$q=e=>typeof e==`bigint`||Number.isInteger(e);function eJ(e,t,n,{intAsBigInt:r}){let i=e[0];if((i===`-`||i===`+`)&&(t+=1),e=e.substring(t).replace(/_/g,``),r){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`}let t=BigInt(e);return i===`-`?BigInt(-1)*t:t}let a=parseInt(e,n);return i===`-`?-1*a:a}function tJ(e,t,n){let{value:r}=e;if($q(r)){let e=r.toString(t);return r<0?`-`+n+e.substr(1):n+e}return Eq(e)}var nJ={identify:$q,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>eJ(e,2,2,n),stringify:e=>tJ(e,2,`0b`)},rJ={identify:$q,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>eJ(e,1,8,n),stringify:e=>tJ(e,8,`0`)},iJ={identify:$q,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>eJ(e,0,10,n),stringify:Eq},aJ={identify:$q,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>eJ(e,2,16,n),stringify:e=>tJ(e,16,`0x`)},oJ=class e extends vq{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=$G(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new fq(e.key,null):new fq(e,null),_q(this.items,t.key)||this.items.push(t)}get(e,t){let n=_q(this.items,e);return!t&&$G(n)?eK(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 fq(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 s Line truncated
`)?(n.push(`...`),n.push(PK(t,``))):n.push(`... ${t}`)}else n.push(`...`)}else{let t=e.comment;t&&o&&(t=t.replace(/^\n+/,``)),t&&((!o||s)&&n[n.length-1]!==``&&n.push(``),n.push(PK(a(t),``)))}return n.join(`
`+jK(l(e),c),s&&s()):d&&o&&o(),p}function fq({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(eK(i))i.spaceBefore&&d.push(``),pq(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(XG(i)){let e=eK(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),pq(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=eK(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=ZK(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+=MK(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 pq({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=jK(t(r),e);n.push(i.trimStart())}}function mq(e,t){let n=ZG(t)?t.value:t;for(let r of e)if(XG(r)&&(r.key===t||r.key===n||ZG(r.key)&&r.key.value===n))return r}var hq=class extends kK{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(HG,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(cq(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=XG(e)?e:!e||typeof e!=`object`||!(`key`in e)?new lq(e,e?.value):new lq(e.key,e.value);let r=mq(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);ZG(r.value)&&SK(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=mq(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=mq(this.items,e)?.value;return(!t&&ZG(n)?n.value:n)??void 0}has(e){return!!mq(this.items,e)}set(e,t){this.add(new lq(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)oq(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!XG(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})),uq(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},gq={collection:`map`,default:!0,nodeClass:hq,tag:`tag:yaml.org,2002:map`,resolve(e,t){return YG(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>hq.from(e,t,n)},_q=class extends kK{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(GG,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=vq(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=vq(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&ZG(r)?r.value:r}has(e){let t=vq(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=vq(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];ZG(r)&&SK(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(vK(e,String(r++),t));return n}toString(e,t,n){return e?uq(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(EK(a,void 0,n))}}return i}};function vq(e){let t=ZG(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var yq={collection:`seq`,default:!0,nodeClass:_q,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return QG(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>_q.from(e,t,n)},bq={identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify(e,t,n,r){return t=Object.assign({actualString:!0},t),qK(e,t,n,r)}},xq={identify:e=>e==null,createNode:()=>new CK(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new CK(null),stringify:({source:e},t)=>typeof e==`string`&&xq.test.test(e)?e:t.options.nullStr},Sq={identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new CK(e[0]===`t`||e[0]===`T`),stringify({source:e,value:t},n){return e&&Sq.test.test(e)&&t===(e[0]===`t`||e[0]===`T`)?e:t?n.options.trueStr:n.options.falseStr}};function Cq({format:e,minFractionDigits:t,tag:n,value:r}){if(typeof r==`bigint`)return String(r);let i=typeof r==`number`?r:Number(r);if(!isFinite(i))return isNaN(i)?`.nan`:i<0?`-.inf`:`.inf`;let a=Object.is(r,-0)?`-0`:JSON.stringify(r);if(!e&&t&&(!n||n===`tag:yaml.org,2002:float`)&&/^-?\d/.test(a)&&!a.includes(`e`)){let e=a.indexOf(`.`);e<0&&(e=a.length,a+=`.`);let n=t-(a.length-e-1);for(;n-->0;)a+=`0`}return a}var wq={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]===`-`?-1/0:1/0,stringify:Cq},Tq={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),string Line truncated
`:` `)}return qK({comment:e,type:t,value:s},r,i,a)}};function zq(e,t){if(QG(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!XG(r)){if(YG(r)){r.items.length>1&&t(`Each pair must have its own sequence indicator`);let e=r.items[0]||new lq(new CK(null));if(r.commentBefore&&(e.key.commentBefore=e.key.commentBefore?`${r.commentBefore}\n${e.key.commentBefore}`:r.commentBefore),r.comment){let t=e.value??e.key;t.comment=t.comment?`${r.comment}\n${t.comment}`:r.comment}r=e}e.items[n]=XG(r)?r:new lq(r)}}else t(`Expected a sequence for this tag`);return e}function Bq(e,t,n){let{replacer:r}=n,i=new _q(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(cq(o,s,n))}return i}var Vq={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:zq,createNode:Bq},Hq=class e extends _q{constructor(){super(),this.add=hq.prototype.add.bind(this),this.delete=hq.prototype.delete.bind(this),this.get=hq.prototype.get.bind(this),this.has=hq.prototype.has.bind(this),this.set=hq.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(XG(e)?(r=vK(e.key,``,t),i=vK(e.value,r,t)):r=vK(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=Bq(e,t,n),i=new this;return i.items=r.items,i}};Hq.tag=`tag:yaml.org,2002:omap`;var Uq={collection:`seq`,identify:e=>e instanceof Map,nodeClass:Hq,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,t){let n=zq(e,t),r=[];for(let{key:e}of n.items)ZG(e)&&(r.includes(e.value)?t(`Ordered maps must not include duplicate keys: ${e.value}`):r.push(e.value));return Object.assign(new Hq,n)},createNode:(e,t,n)=>Hq.from(e,t,n)};function Wq({value:e,source:t},n){return t&&(e?Gq:Kq).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var Gq={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 CK(!0),stringify:Wq},Kq={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 CK(!1),stringify:Wq},qq={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]===`-`?-1/0:1/0,stringify:Cq},Jq={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():Cq(e)}},Yq={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 CK(parseFloat(e.replace(/_/g,``))),n=e.indexOf(`.`);if(n!==-1){let r=e.substring(n+1).replace(/_/g,``);r[r.length-1]===`0`&&(t.minFractionDigits=r.length)}return t},stringify:Cq},Xq=e=>typeof e==`bigint`||Number.isInteger(e);function Zq(e,t,n,{intAsBigInt:r}){let i=e[0];if((i===`-`||i===`+`)&&(t+=1),e=e.substring(t).replace(/_/g,``),r){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`}let t=BigInt(e);return i===`-`?BigInt(-1)*t:t}let a=parseInt(e,n);return i===`-`?-1*a:a}function Qq(e,t,n){let{value:r}=e;if(Xq(r)){let e=r.toString(t);return r<0?`-`+n+e.substr(1):n+e}return Cq(e)}var $q={identify:Xq,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>Zq(e,2,2,n),stringify:e=>Qq(e,2,`0b`)},eJ={identify:Xq,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>Zq(e,1,8,n),stringify:e=>Qq(e,8,`0`)},tJ={identify:Xq,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>Zq(e,0,10,n),stringify:Cq},nJ={identify:Xq,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>Zq(e,2,16,n),stringify:e=>Qq(e,16,`0x`)},rJ=class e extends hq{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=XG(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new lq(e.key,null):new lq(e,null),mq(this.items,t.key)||this.items.push(t)}get(e,t){let n=mq(this.items,e);return!t&&XG(n)?ZG(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=mq(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new lq(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 s Line truncated
`)?(n.push(`...`),n.push(jK(t,``))):n.push(`... ${t}`)}else n.push(`...`)}else{let t=e.comment;t&&o&&(t=t.replace(/^\n+/,``)),t&&((!o||s)&&n[n.length-1]!==``&&n.push(``),n.push(jK(a(t),``)))}return n.join(`
`)+`
`}var xJ=class e{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,YG,{value:WG});let r=null;typeof t==`function`||Array.isArray(t)?r=t:n===void 0&&t&&(n=t,t=void 0);let i=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:`warn`,prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:`1.2`},n);this.options=i;let{version:a}=i;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(a=this.directives.yaml.version)):this.directives=new hK({version:a}),this.setSchema(a,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){let t=Object.create(e.prototype,{[YG]:{value:WG}});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=rK(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(e){SJ(this.contents)&&this.contents.add(e)}addIn(e,t){SJ(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=_K(this);e.anchor=!t||n.has(t)?vK(t||`a`,n):t}return new CK(e.anchor)}createNode(e,t,n){let r;if(typeof t==`function`)e=t.call({"":e},``,e),r=t;else if(Array.isArray(t)){let e=t.filter(e=>typeof e==`number`||e instanceof String||e instanceof Number).map(String);e.length>0&&(t=t.concat(e)),r=t}else n===void 0&&t&&(n=t,t=void 0);let{aliasDuplicateObjects:i,anchorPrefix:a,flow:o,keepUndefined:s,onTagObj:c,tag:l}=n??{},{onAnchor:u,setAnchors:d,sourceObjects:f}=yK(this,a||`a`),p={aliasDuplicateObjects:i??!0,keepUndefined:s??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:f},m=kK(e,l,p);return o&&nK(m)&&(m.flow=!0),d(),m}createPair(e,t,n={}){return new fq(this.createNode(e,null,n),this.createNode(t,null,n))}delete(e){return SJ(this.contents)?this.contents.delete(e):!1}deleteIn(e){return jK(e)?this.contents!=null&&(this.contents=null,!0):SJ(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return nK(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return jK(e)?!t&&eK(this.contents)?this.contents.value:this.contents:nK(this.contents)?this.contents.getIn(e,t):void 0}has(e){return nK(this.contents)?this.contents.has(e):!1}hasIn(e){return jK(e)?this.contents!==void 0:nK(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=AK(this.schema,[e],t):SJ(this.contents)&&this.contents.set(e,t)}setIn(e,t){jK(e)?this.contents=t:this.contents==null?this.contents=AK(this.schema,Array.from(e),t):SJ(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e==`number`&&(e=String(e));let n;switch(e){case`1.1`:this.directives?this.directives.yaml.version=`1.1`:this.directives=new hK({version:`1.1`}),n={resolveKnownTags:!1,schema:`yaml-1.1`};break;case`1.2`:case`next`:this.directives?this.directives.yaml.version=e:this.directives=new hK({version:e}),n={resolveKnownTags:!0,schema:`core`};break;case null:this.directives&&delete this.directives,n=null;break;default:{let t=JSON.stringify(e);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${t}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(n)this.schema=new yJ(Object.assign(n,t));else throw Error(`With a null YAML version, the { schema: Schema } option is required`)}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:r,onAnchor:i,reviver:a}={}){let o={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r==`number`?r:100},s=xK(this.contents,t??``,o);if(typeof i==`function`)for(let{count:e,res:t}of o.anchors.values())i(t,e);return typeof a==`function`?bK(a,{"":s},``,s):s}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw Error(`Document with errors cannot be stringified`);if(`indent`in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw Error(`"indent" option must be a positive integer, not ${t}`)}return bJ(this,e)}};function SJ(e){if(nK(e))return!0;throw Error(`Expected a YAML collection as document contents`)}var CJ=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},wJ=class extends CJ{constructor(e,t,n){super(`YAMLParseError`,e,t,n)}},TJ=class extends CJ{constructor(e,t,n){super(`YAMLWarning`,e,t,n)}},EJ=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(e=>t.linePos(e));let{line:r,col:i}=n.linePos[0];n.message+=` at line ${r}, column ${i}`;let a=i-1,o=e.substring(t.lineStarts[r-1],t.lineStarts[r]).replace(/[\n\r]+$/,``);if(a>=60&&o.length>80){let e=Math.min(a-39,o.length-79);o=`…`+o.substring(e),a-=e-1}if(o.length>80&&(o=o.substring(0,79)+`…`),r>1&&/^ *$/.test(o.substring(0,a))){let n=e.substring(t.lineStarts[r-2],t.lineStarts[r-1]);n.length>80&&(n=n.substring(0,79)+`…
`),o=n+o}if(/[^ ]/.test(o)){let e=1,t=n.linePos[1];t?.line===r&&t.col>i&&(e=Math.max(1,Math.min(t.col-i,80-a)));let s=` `.repeat(a)+`^`.repeat(e);n.message+=`:\n\n${o}\n${s}\n`}};function DJ(e,{flow:t,indicator:n,next:r,offset:i,onError:a,parentIndent:o,startOnNewline:s}){let c=!1,l=s,u=s,d=``,f=``,p=!1,m=!1,h=null,g=null,_=null,v=null,y=null,b=null,x=null;for(let i of e)switch(m&&=(i.type!==`space`&&i.type!==`newline`&&i.type!==`comma`&&a(i.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),!1),h&&=(l&&i.type!==`comment`&&i.type!==`newline`&&a(h,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),null),i.type){case`space`:!t&&(n!==`doc-start`||r?.type!==`flow-collection`)&&i.source.includes(` `)&&(h=i),u=!0;break;case`comment`:{u||a(i,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let e=i.source.substring(1)||` `;d?d+=f+e:d=e,f=``,l=!1;break}case`newline`:l?d?d+=i.source:(!b||n!==`seq-item-ind`)&&(c=!0):f+=i.source,l=!0,p=!0,(g||_)&&(v=i),u=!0;break;case`anchor`:g&&a(i,`MULTIPLE_ANCHORS`,`A node can have at most one anchor`),i.source.endsWith(`:`)&&a(i.offset+i.source.length-1,`BAD_ALIAS`,`Anchor ending in : is ambiguous`,!0),g=i,x??=i.offset,l=!1,u=!1,m=!0;break;case`tag`:_&&a(i,`MULTIPLE_TAGS`,`A node can have at most one tag`),_=i,x??=i.offset,l=!1,u=!1,m=!0;break;case n:(g||_)&&a(i,`BAD_PROP_ORDER`,`Anchors and tags must be after the ${i.source} indicator`),b&&a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.source} in ${t??`collection`}`),b=i,l=n===`seq-item-ind`||n===`explicit-key-ind`,u=!1;break;case`comma`:if(t){y&&a(i,`UNEXPECTED_TOKEN`,`Unexpected , in ${t}`),y=i,l=!1,u=!1;break}default:a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.type} token`),l=!1,u=!1}let S=e[e.length-1],C=S?S.offset+S.source.length:i;return m&&r&&r.type!==`space`&&r.type!==`newline`&&r.type!==`comma`&&(r.type!==`scalar`||r.source!==``)&&a(r.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),h&&(l&&h.indent<=o||r?.type===`block-map`||r?.type===`block-seq`)&&a(h,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),{comma:y,found:b,spaceBefore:c,comment:d,hasNewline:p,anchor:g,tag:_,newlineAfterProp:v,end:C,start:x??C}}function OJ(e){if(!e)return null;switch(e.type){case`alias`:case`scalar`:case`double-quoted-scalar`:case`single-quoted-scalar`:if(e.source.includes(`
`))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 e of t.start)if(e.type===`newline`)return!0;if(t.sep){for(let e of t.sep)if(e.type===`newline`)return!0}if(OJ(t.key)||OJ(t.value))return!0}return!1;default:return!0}}function kJ(e,t,n){if(t?.type===`flow-collection`){let r=t.end[0];r.indent===e&&(r.source===`]`||r.source===`}`)&&OJ(t)&&n(r,`BAD_INDENT`,`Flow end indicator should be more indented than parent`,!0)}}function AJ(e,t,n){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let i=typeof r==`function`?r:(e,t)=>e===t||eK(e)&&eK(t)&&e.value===t.value;return t.some(e=>i(e.key,n))}var jJ=`All mapping items must start at the same column`;function MJ({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??vq)(n.schema);n.atRoot&&=!1;let s=r.offset,c=null;for(let a of r.items){let{start:l,key:u,sep:d,value:f}=a,p=DJ(l,{indicator:`explicit-key-ind`,next:u??d?.[0],offset:s,onError:i,parentIndent:r.indent,startOnNewline:!0}),m=!p.found;if(m){if(u&&(u.type===`block-seq`?i(s,`BLOCK_AS_IMPLICIT_KEY`,`A block sequence may not be used as an implicit map key`):`indent`in u&&u.indent!==r.indent&&i(s,`BAD_INDENT`,jJ)),!p.anchor&&!p.tag&&!d){c=p.end,p.comment&&(o.comment?o.comment+=`
`+p.comment:o.comment=p.comment);continue}(p.newlineAfterProp||OJ(u))&&i(u??l[l.length-1],`MULTILINE_IMPLICIT_KEY`,`Implicit keys need to be on a single line`)}else p.found?.indent!==r.indent&&i(s,`BAD_INDENT`,jJ);n.atKey=!0;let h=p.end,g=u?e(n,u,p,i):t(n,h,l,null,p,i);n.schema.compat&&kJ(r.indent,u,i),n.atKey=!1,AJ(n,o.items,g)&&i(h,`DUPLICATE_KEY`,`Map keys must be unique`);let _=DJ(d??[],{indicator:`map-value-ind`,next:f,offset:g.range[2],onError:i,parentIndent:r.indent,startOnNewline:!u||u.type===`block-scalar`});if(s=_.end,_.found){m&&(f?.type===`block-map`&&!_.hasNewline&&i(s,`BLOCK_AS_IMPLICIT_KEY`,`Nested mappings are not allowed in compact mappings`),n.options.strict&&p.start<_.found.offset-1024&&i(g.range,`KEY_OVER_1024_CHARS`,`The : indicator must be at most 1024 chars after the start of an implicit block mapping key`));let c=f?e(n,f,_,i):t(n,s,d,null,_,i);n.schema.compat&&kJ(r.indent,f,i),s=c.range[2];let l=new fq(g,c);n.options.keepSourceTokens&&(l.srcToken=a),o.items.push(l)}else{m&&i(g.range,`MISSING_CHAR`,`Implicit map keys need to be followed by map values`),_.comment&&(g.comment?g.comment+=`
`+_.comment:g.comment=_.comment);let e=new fq(g);n.options.keepSourceTokens&&(e.srcToken=a),o.items.push(e)}}return c&&c<s&&i(c,`IMPOSSIBLE`,`Map comment with trailing content`),o.range=[r.offset,s,c??s],o}function NJ({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??bq)(n.schema);n.atRoot&&=!1,n.atKey&&=!1;let s=r.offset,c=null;for(let{start:a,value:l}of r.items){let u=DJ(a,{indicator:`seq-item-ind`,next:l,offset:s,onError:i,parentIndent:r.indent,startOnNewline:!0});if(!u.found){if(u.anchor||u.tag||l)l?.type===`block-seq`?i(u.end,`BAD_INDENT`,`All sequence items must start at the same column`):i(s,`MISSING_CHAR`,`Sequence item without - indicator`);else{c=u.end,u.comment&&(o.comment=u.comment);continue}}let d=l?e(n,l,u,i):t(n,u.end,a,null,u,i);n.schema.compat&&kJ(r.indent,l,i),s=d.range[2],o.items.push(d)}return o.range=[r.offset,s,c??s],o}function PJ(e,t,n,r){let i=``;if(e){let a=!1,o=``;for(let s of e){let{source:e,type:c}=s;switch(c){case`space`:a=!0;break;case`comment`:{n&&!a&&r(s,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let t=e.substring(1)||` `;i?i+=o+t:i=t,o=``;break}case`newline`:i&&(o+=e),a=!0;break;default:r(s,`UNEXPECTED_TOKEN`,`Unexpected ${c} at node end`)}t+=e.length}}return{comment:i,offset:t}}var FJ=`Block collections are not allowed within flow collections`,IJ=e=>e&&(e.type===`block-map`||e.type===`block-seq`);function LJ({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=r.start.source===`{`,s=o?`flow map`:`flow sequence`,c=new((a?.nodeClass)??(o?vq:bq))(n.schema);c.flow=!0;let l=n.atRoot;l&&(n.atRoot=!1),n.atKey&&=!1;let u=r.offset+r.start.source.length;for(let a=0;a<r.items.length;++a){let l=r.items[a],{start:d,key:f,sep:p,value:m}=l,h=DJ(d,{flow:s,indicator:`explicit-key-ind`,next:f??p?.[0],offset:u,onError:i,parentIndent:r.indent,startOnNewline:!1});if(!h.found){if(!h.anchor&&!h.tag&&!p&&!m){a===0&&h.comma?i(h.comma,`UNEXPECTED_TOKEN`,`Unexpected , in ${s}`):a<r.items.length-1&&i(h.start,`UNEXPECTED_TOKEN`,`Unexpected empty item in ${s}`),h.comment&&(c.comment?c.comment+=`
`+h.comment:c.comment=h.comment),u=h.end;continue}!o&&n.options.strict&&OJ(f)&&i(f,`MULTILINE_IMPLICIT_KEY`,`Implicit keys of flow sequence pairs need to be on a single line`)}if(a===0)h.comma&&i(h.comma,`UNEXPECTED_TOKEN`,`Unexpected , in ${s}`);else if(h.comma||i(h.start,`MISSING_CHAR`,`Missing , between ${s} items`),h.comment){let e=``;loop:for(let t of d)switch(t.type){case`comma`:case`space`:break;case`comment`:e=t.source.substring(1);break loop;default:break loop}if(e){let t=c.items[c.items.length-1];$G(t)&&(t=t.value??t.key),t.comment?t.comment+=`
`+e:t.comment=e,h.comment=h.comment.substring(e.length+1)}}if(!o&&!p&&!h.found){let r=m?e(n,m,h,i):t(n,h.end,p,null,h,i);c.items.push(r),u=r.range[2],IJ(m)&&i(r.range,`BLOCK_IN_FLOW`,FJ)}else{n.atKey=!0;let a=h.end,g=f?e(n,f,h,i):t(n,a,d,null,h,i);IJ(f)&&i(g.range,`BLOCK_IN_FLOW`,FJ),n.atKey=!1;let _=DJ(p??[],{flow:s,indicator:`map-value-ind`,next:m,offset:g.range[2],onError:i,parentIndent:r.indent,startOnNewline:!1});if(_.found){if(!o&&!h.found&&n.options.strict){if(p)for(let e of p){if(e===_.found)break;if(e.type===`newline`){i(e,`MULTILINE_IMPLICIT_KEY`,`Implicit keys of flow sequence pairs need to be on a single line`);break}}h.start<_.found.offset-1024&&i(_.found,`KEY_OVER_1024_CHARS`,`The : indicator must be at most 1024 chars after the start of an implicit flow sequence key`)}}else m&&(`source`in m&&m.source?.[0]===`:`?i(m,`MISSING_CHAR`,`Missing space after : in ${s}`):i(_.start,`MISSING_CHAR`,`Missing , or : between ${s} items`));let v=m?e(n,m,_,i):_.found?t(n,_.end,p,null,_,i):null;v?IJ(m)&&i(v.range,`BLOCK_IN_FLOW`,FJ):_.comment&&(g.comment?g.comment+=`
`+_.comment:g.comment=_.comment);let y=new fq(g,v);if(n.options.keepSourceTokens&&(y.srcToken=l),o){let e=c;AJ(n,e.items,g)&&i(a,`DUPLICATE_KEY`,`Map keys must be unique`),e.items.push(y)}else{let e=new vq(n.schema);e.flow=!0,e.items.push(y);let t=(v??g).range;e.range=[g.range[0],t[1],t[2]],c.items.push(e)}u=v?v.range[2]:_.end}}let d=o?`}`:`]`,[f,...p]=r.end,m=u;if(f?.source===d)m=f.offset+f.source.length;else{let e=s[0].toUpperCase()+s.substring(1),t=l?`${e} must end with a ${d}`:`${e} in block collection must be sufficiently indented and end with a ${d}`;i(u,l?`MISSING_CHAR`:`BAD_INDENT`,t),f&&f.source.length!==1&&p.unshift(f)}if(p.length>0){let e=PJ(p,m,n.options.strict,i);e.comment&&(c.comment?c.comment+=`
`+e.comment:c.comment=e.comment),c.range=[r.offset,m,e.offset]}else c.range=[r.offset,m,m];return c}function RJ(e,t,n,r,i,a){let o=n.type===`block-map`?MJ(e,t,n,r,a):n.type===`block-seq`?NJ(e,t,n,r,a):LJ(e,t,n,r,a),s=o.constructor;return i===`!`||i===s.tagName?(o.tag=s.tagName,o):(i&&(o.tag=i),o)}function zJ(e,t,n,r,i){let a=r.tag,o=a?t.directives.tagName(a.source,e=>i(a,`TAG_RESOLVE_FAILED`,e)):null;if(n.type===`block-seq`){let{anchor:e,newlineAfterProp:t}=r,n=e&&a?e.offset>a.offset?e:a:e??a;n&&(!t||t.offset<n.offset)&&i(n,`MISSING_CHAR`,`Missing newline after block sequence props`)}let s=n.type===`block-map`?`map`:n.type===`block-seq`?`seq`:n.start.source===`{`?`map`:`seq`;if(!a||!o||o===`!`||o===vq.tagName&&s===`map`||o===bq.tagName&&s===`seq`)return RJ(e,t,n,i,o);let c=t.schema.tags.find(e=>e.tag===o&&e.collection===s);if(!c){let r=t.schema.knownTags[o];if(r?.collection===s)t.schema.tags.push(Object.assign({},r,{default:!1})),c=r;else return r?i(a,`BAD_COLLECTION_TYPE`,`${r.tag} used for ${s} collection, but expects ${r.collection??`scalar`}`,!0):i(a,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${o}`,!0),RJ(e,t,n,i,o)}let l=RJ(e,t,n,i,o,c),u=c.resolve?.(l,e=>i(a,`TAG_RESOLVE_FAILED`,e),t.options)??l,d=rK(u)?u:new EK(u);return d.range=l.range,d.tag=o,c?.format&&(d.format=c.format),d}function BJ(e,t,n){let r=t.offset,i=VJ(t,e.options.strict,n);if(!i)return{value:``,type:null,comment:``,range:[r,r,r]};let a=i.mode===`>`?EK.BLOCK_FOLDED:EK.BLOCK_LITERAL,o=t.source?HJ(t.source):[],s=o.length;for(let e=o.length-1;e>=0;--e){let t=o[e][1];if(t===``||t===`\r`)s=e;else break}if(s===0){let e=i.chomp===`+`&&o.length>0?`
`}var vJ=class e{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,KG,{value:VG});let r=null;typeof t==`function`||Array.isArray(t)?r=t:n===void 0&&t&&(n=t,t=void 0);let i=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:`warn`,prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:`1.2`},n);this.options=i;let{version:a}=i;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(a=this.directives.yaml.version)):this.directives=new fK({version:a}),this.setSchema(a,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){let t=Object.create(e.prototype,{[KG]:{value:VG}});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=eK(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(e){yJ(this.contents)&&this.contents.add(e)}addIn(e,t){yJ(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=mK(this);e.anchor=!t||n.has(t)?hK(t||`a`,n):t}return new bK(e.anchor)}createNode(e,t,n){let r;if(typeof t==`function`)e=t.call({"":e},``,e),r=t;else if(Array.isArray(t)){let e=t.filter(e=>typeof e==`number`||e instanceof String||e instanceof Number).map(String);e.length>0&&(t=t.concat(e)),r=t}else n===void 0&&t&&(n=t,t=void 0);let{aliasDuplicateObjects:i,anchorPrefix:a,flow:o,keepUndefined:s,onTagObj:c,tag:l}=n??{},{onAnchor:u,setAnchors:d,sourceObjects:f}=gK(this,a||`a`),p={aliasDuplicateObjects:i??!0,keepUndefined:s??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:f},m=EK(e,l,p);return o&&$G(m)&&(m.flow=!0),d(),m}createPair(e,t,n={}){return new lq(this.createNode(e,null,n),this.createNode(t,null,n))}delete(e){return yJ(this.contents)?this.contents.delete(e):!1}deleteIn(e){return OK(e)?this.contents!=null&&(this.contents=null,!0):yJ(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return $G(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return OK(e)?!t&&ZG(this.contents)?this.contents.value:this.contents:$G(this.contents)?this.contents.getIn(e,t):void 0}has(e){return $G(this.contents)?this.contents.has(e):!1}hasIn(e){return OK(e)?this.contents!==void 0:$G(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=DK(this.schema,[e],t):yJ(this.contents)&&this.contents.set(e,t)}setIn(e,t){OK(e)?this.contents=t:this.contents==null?this.contents=DK(this.schema,Array.from(e),t):yJ(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e==`number`&&(e=String(e));let n;switch(e){case`1.1`:this.directives?this.directives.yaml.version=`1.1`:this.directives=new fK({version:`1.1`}),n={resolveKnownTags:!1,schema:`yaml-1.1`};break;case`1.2`:case`next`:this.directives?this.directives.yaml.version=e:this.directives=new fK({version:e}),n={resolveKnownTags:!0,schema:`core`};break;case null:this.directives&&delete this.directives,n=null;break;default:{let t=JSON.stringify(e);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${t}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(n)this.schema=new gJ(Object.assign(n,t));else throw Error(`With a null YAML version, the { schema: Schema } option is required`)}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:r,onAnchor:i,reviver:a}={}){let o={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r==`number`?r:100},s=vK(this.contents,t??``,o);if(typeof i==`function`)for(let{count:e,res:t}of o.anchors.values())i(t,e);return typeof a==`function`?_K(a,{"":s},``,s):s}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw Error(`Document with errors cannot be stringified`);if(`indent`in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw Error(`"indent" option must be a positive integer, not ${t}`)}return _J(this,e)}};function yJ(e){if($G(e))return!0;throw Error(`Expected a YAML collection as document contents`)}var bJ=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},xJ=class extends bJ{constructor(e,t,n){super(`YAMLParseError`,e,t,n)}},SJ=class extends bJ{constructor(e,t,n){super(`YAMLWarning`,e,t,n)}},CJ=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(e=>t.linePos(e));let{line:r,col:i}=n.linePos[0];n.message+=` at line ${r}, column ${i}`;let a=i-1,o=e.substring(t.lineStarts[r-1],t.lineStarts[r]).replace(/[\n\r]+$/,``);if(a>=60&&o.length>80){let e=Math.min(a-39,o.length-79);o=`…`+o.substring(e),a-=e-1}if(o.length>80&&(o=o.substring(0,79)+`…`),r>1&&/^ *$/.test(o.substring(0,a))){let n=e.substring(t.lineStarts[r-2],t.lineStarts[r-1]);n.length>80&&(n=n.substring(0,79)+`…
`),o=n+o}if(/[^ ]/.test(o)){let e=1,t=n.linePos[1];t?.line===r&&t.col>i&&(e=Math.max(1,Math.min(t.col-i,80-a)));let s=` `.repeat(a)+`^`.repeat(e);n.message+=`:\n\n${o}\n${s}\n`}};function wJ(e,{flow:t,indicator:n,next:r,offset:i,onError:a,parentIndent:o,startOnNewline:s}){let c=!1,l=s,u=s,d=``,f=``,p=!1,m=!1,h=null,g=null,_=null,v=null,y=null,b=null,x=null;for(let i of e)switch(m&&=(i.type!==`space`&&i.type!==`newline`&&i.type!==`comma`&&a(i.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),!1),h&&=(l&&i.type!==`comment`&&i.type!==`newline`&&a(h,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),null),i.type){case`space`:!t&&(n!==`doc-start`||r?.type!==`flow-collection`)&&i.source.includes(` `)&&(h=i),u=!0;break;case`comment`:{u||a(i,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let e=i.source.substring(1)||` `;d?d+=f+e:d=e,f=``,l=!1;break}case`newline`:l?d?d+=i.source:(!b||n!==`seq-item-ind`)&&(c=!0):f+=i.source,l=!0,p=!0,(g||_)&&(v=i),u=!0;break;case`anchor`:g&&a(i,`MULTIPLE_ANCHORS`,`A node can have at most one anchor`),i.source.endsWith(`:`)&&a(i.offset+i.source.length-1,`BAD_ALIAS`,`Anchor ending in : is ambiguous`,!0),g=i,x??=i.offset,l=!1,u=!1,m=!0;break;case`tag`:_&&a(i,`MULTIPLE_TAGS`,`A node can have at most one tag`),_=i,x??=i.offset,l=!1,u=!1,m=!0;break;case n:(g||_)&&a(i,`BAD_PROP_ORDER`,`Anchors and tags must be after the ${i.source} indicator`),b&&a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.source} in ${t??`collection`}`),b=i,l=n===`seq-item-ind`||n===`explicit-key-ind`,u=!1;break;case`comma`:if(t){y&&a(i,`UNEXPECTED_TOKEN`,`Unexpected , in ${t}`),y=i,l=!1,u=!1;break}default:a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.type} token`),l=!1,u=!1}let S=e[e.length-1],C=S?S.offset+S.source.length:i;return m&&r&&r.type!==`space`&&r.type!==`newline`&&r.type!==`comma`&&(r.type!==`scalar`||r.source!==``)&&a(r.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),h&&(l&&h.indent<=o||r?.type===`block-map`||r?.type===`block-seq`)&&a(h,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),{comma:y,found:b,spaceBefore:c,comment:d,hasNewline:p,anchor:g,tag:_,newlineAfterProp:v,end:C,start:x??C}}function TJ(e){if(!e)return null;switch(e.type){case`alias`:case`scalar`:case`double-quoted-scalar`:case`single-quoted-scalar`:if(e.source.includes(`
`))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 e of t.start)if(e.type===`newline`)return!0;if(t.sep){for(let e of t.sep)if(e.type===`newline`)return!0}if(TJ(t.key)||TJ(t.value))return!0}return!1;default:return!0}}function EJ(e,t,n){if(t?.type===`flow-collection`){let r=t.end[0];r.indent===e&&(r.source===`]`||r.source===`}`)&&TJ(t)&&n(r,`BAD_INDENT`,`Flow end indicator should be more indented than parent`,!0)}}function DJ(e,t,n){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let i=typeof r==`function`?r:(e,t)=>e===t||ZG(e)&&ZG(t)&&e.value===t.value;return t.some(e=>i(e.key,n))}var OJ=`All mapping items must start at the same column`;function kJ({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??hq)(n.schema);n.atRoot&&=!1;let s=r.offset,c=null;for(let a of r.items){let{start:l,key:u,sep:d,value:f}=a,p=wJ(l,{indicator:`explicit-key-ind`,next:u??d?.[0],offset:s,onError:i,parentIndent:r.indent,startOnNewline:!0}),m=!p.found;if(m){if(u&&(u.type===`block-seq`?i(s,`BLOCK_AS_IMPLICIT_KEY`,`A block sequence may not be used as an implicit map key`):`indent`in u&&u.indent!==r.indent&&i(s,`BAD_INDENT`,OJ)),!p.anchor&&!p.tag&&!d){c=p.end,p.comment&&(o.comment?o.comment+=`
`+p.comment:o.comment=p.comment);continue}(p.newlineAfterProp||TJ(u))&&i(u??l[l.length-1],`MULTILINE_IMPLICIT_KEY`,`Implicit keys need to be on a single line`)}else p.found?.indent!==r.indent&&i(s,`BAD_INDENT`,OJ);n.atKey=!0;let h=p.end,g=u?e(n,u,p,i):t(n,h,l,null,p,i);n.schema.compat&&EJ(r.indent,u,i),n.atKey=!1,DJ(n,o.items,g)&&i(h,`DUPLICATE_KEY`,`Map keys must be unique`);let _=wJ(d??[],{indicator:`map-value-ind`,next:f,offset:g.range[2],onError:i,parentIndent:r.indent,startOnNewline:!u||u.type===`block-scalar`});if(s=_.end,_.found){m&&(f?.type===`block-map`&&!_.hasNewline&&i(s,`BLOCK_AS_IMPLICIT_KEY`,`Nested mappings are not allowed in compact mappings`),n.options.strict&&p.start<_.found.offset-1024&&i(g.range,`KEY_OVER_1024_CHARS`,`The : indicator must be at most 1024 chars after the start of an implicit block mapping key`));let c=f?e(n,f,_,i):t(n,s,d,null,_,i);n.schema.compat&&EJ(r.indent,f,i),s=c.range[2];let l=new lq(g,c);n.options.keepSourceTokens&&(l.srcToken=a),o.items.push(l)}else{m&&i(g.range,`MISSING_CHAR`,`Implicit map keys need to be followed by map values`),_.comment&&(g.comment?g.comment+=`
`+_.comment:g.comment=_.comment);let e=new lq(g);n.options.keepSourceTokens&&(e.srcToken=a),o.items.push(e)}}return c&&c<s&&i(c,`IMPOSSIBLE`,`Map comment with trailing content`),o.range=[r.offset,s,c??s],o}function AJ({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??_q)(n.schema);n.atRoot&&=!1,n.atKey&&=!1;let s=r.offset,c=null;for(let{start:a,value:l}of r.items){let u=wJ(a,{indicator:`seq-item-ind`,next:l,offset:s,onError:i,parentIndent:r.indent,startOnNewline:!0});if(!u.found){if(u.anchor||u.tag||l)l?.type===`block-seq`?i(u.end,`BAD_INDENT`,`All sequence items must start at the same column`):i(s,`MISSING_CHAR`,`Sequence item without - indicator`);else{c=u.end,u.comment&&(o.comment=u.comment);continue}}let d=l?e(n,l,u,i):t(n,u.end,a,null,u,i);n.schema.compat&&EJ(r.indent,l,i),s=d.range[2],o.items.push(d)}return o.range=[r.offset,s,c??s],o}function jJ(e,t,n,r){let i=``;if(e){let a=!1,o=``;for(let s of e){let{source:e,type:c}=s;switch(c){case`space`:a=!0;break;case`comment`:{n&&!a&&r(s,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let t=e.substring(1)||` `;i?i+=o+t:i=t,o=``;break}case`newline`:i&&(o+=e),a=!0;break;default:r(s,`UNEXPECTED_TOKEN`,`Unexpected ${c} at node end`)}t+=e.length}}return{comment:i,offset:t}}var MJ=`Block collections are not allowed within flow collections`,NJ=e=>e&&(e.type===`block-map`||e.type===`block-seq`);function PJ({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=r.start.source===`{`,s=o?`flow map`:`flow sequence`,c=new((a?.nodeClass)??(o?hq:_q))(n.schema);c.flow=!0;let l=n.atRoot;l&&(n.atRoot=!1),n.atKey&&=!1;let u=r.offset+r.start.source.length;for(let a=0;a<r.items.length;++a){let l=r.items[a],{start:d,key:f,sep:p,value:m}=l,h=wJ(d,{flow:s,indicator:`explicit-key-ind`,next:f??p?.[0],offset:u,onError:i,parentIndent:r.indent,startOnNewline:!1});if(!h.found){if(!h.anchor&&!h.tag&&!p&&!m){a===0&&h.comma?i(h.comma,`UNEXPECTED_TOKEN`,`Unexpected , in ${s}`):a<r.items.length-1&&i(h.start,`UNEXPECTED_TOKEN`,`Unexpected empty item in ${s}`),h.comment&&(c.comment?c.comment+=`
`+h.comment:c.comment=h.comment),u=h.end;continue}!o&&n.options.strict&&TJ(f)&&i(f,`MULTILINE_IMPLICIT_KEY`,`Implicit keys of flow sequence pairs need to be on a single line`)}if(a===0)h.comma&&i(h.comma,`UNEXPECTED_TOKEN`,`Unexpected , in ${s}`);else if(h.comma||i(h.start,`MISSING_CHAR`,`Missing , between ${s} items`),h.comment){let e=``;loop:for(let t of d)switch(t.type){case`comma`:case`space`:break;case`comment`:e=t.source.substring(1);break loop;default:break loop}if(e){let t=c.items[c.items.length-1];XG(t)&&(t=t.value??t.key),t.comment?t.comment+=`
`+e:t.comment=e,h.comment=h.comment.substring(e.length+1)}}if(!o&&!p&&!h.found){let r=m?e(n,m,h,i):t(n,h.end,p,null,h,i);c.items.push(r),u=r.range[2],NJ(m)&&i(r.range,`BLOCK_IN_FLOW`,MJ)}else{n.atKey=!0;let a=h.end,g=f?e(n,f,h,i):t(n,a,d,null,h,i);NJ(f)&&i(g.range,`BLOCK_IN_FLOW`,MJ),n.atKey=!1;let _=wJ(p??[],{flow:s,indicator:`map-value-ind`,next:m,offset:g.range[2],onError:i,parentIndent:r.indent,startOnNewline:!1});if(_.found){if(!o&&!h.found&&n.options.strict){if(p)for(let e of p){if(e===_.found)break;if(e.type===`newline`){i(e,`MULTILINE_IMPLICIT_KEY`,`Implicit keys of flow sequence pairs need to be on a single line`);break}}h.start<_.found.offset-1024&&i(_.found,`KEY_OVER_1024_CHARS`,`The : indicator must be at most 1024 chars after the start of an implicit flow sequence key`)}}else m&&(`source`in m&&m.source?.[0]===`:`?i(m,`MISSING_CHAR`,`Missing space after : in ${s}`):i(_.start,`MISSING_CHAR`,`Missing , or : between ${s} items`));let v=m?e(n,m,_,i):_.found?t(n,_.end,p,null,_,i):null;v?NJ(m)&&i(v.range,`BLOCK_IN_FLOW`,MJ):_.comment&&(g.comment?g.comment+=`
`+_.comment:g.comment=_.comment);let y=new lq(g,v);if(n.options.keepSourceTokens&&(y.srcToken=l),o){let e=c;DJ(n,e.items,g)&&i(a,`DUPLICATE_KEY`,`Map keys must be unique`),e.items.push(y)}else{let e=new hq(n.schema);e.flow=!0,e.items.push(y);let t=(v??g).range;e.range=[g.range[0],t[1],t[2]],c.items.push(e)}u=v?v.range[2]:_.end}}let d=o?`}`:`]`,[f,...p]=r.end,m=u;if(f?.source===d)m=f.offset+f.source.length;else{let e=s[0].toUpperCase()+s.substring(1),t=l?`${e} must end with a ${d}`:`${e} in block collection must be sufficiently indented and end with a ${d}`;i(u,l?`MISSING_CHAR`:`BAD_INDENT`,t),f&&f.source.length!==1&&p.unshift(f)}if(p.length>0){let e=jJ(p,m,n.options.strict,i);e.comment&&(c.comment?c.comment+=`
`+e.comment:c.comment=e.comment),c.range=[r.offset,m,e.offset]}else c.range=[r.offset,m,m];return c}function FJ(e,t,n,r,i,a){let o=n.type===`block-map`?kJ(e,t,n,r,a):n.type===`block-seq`?AJ(e,t,n,r,a):PJ(e,t,n,r,a),s=o.constructor;return i===`!`||i===s.tagName?(o.tag=s.tagName,o):(i&&(o.tag=i),o)}function IJ(e,t,n,r,i){let a=r.tag,o=a?t.directives.tagName(a.source,e=>i(a,`TAG_RESOLVE_FAILED`,e)):null;if(n.type===`block-seq`){let{anchor:e,newlineAfterProp:t}=r,n=e&&a?e.offset>a.offset?e:a:e??a;n&&(!t||t.offset<n.offset)&&i(n,`MISSING_CHAR`,`Missing newline after block sequence props`)}let s=n.type===`block-map`?`map`:n.type===`block-seq`?`seq`:n.start.source===`{`?`map`:`seq`;if(!a||!o||o===`!`||o===hq.tagName&&s===`map`||o===_q.tagName&&s===`seq`)return FJ(e,t,n,i,o);let c=t.schema.tags.find(e=>e.tag===o&&e.collection===s);if(!c){let r=t.schema.knownTags[o];if(r?.collection===s)t.schema.tags.push(Object.assign({},r,{default:!1})),c=r;else return r?i(a,`BAD_COLLECTION_TYPE`,`${r.tag} used for ${s} collection, but expects ${r.collection??`scalar`}`,!0):i(a,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${o}`,!0),FJ(e,t,n,i,o)}let l=FJ(e,t,n,i,o,c),u=c.resolve?.(l,e=>i(a,`TAG_RESOLVE_FAILED`,e),t.options)??l,d=eK(u)?u:new CK(u);return d.range=l.range,d.tag=o,c?.format&&(d.format=c.format),d}function LJ(e,t,n){let r=t.offset,i=RJ(t,e.options.strict,n);if(!i)return{value:``,type:null,comment:``,range:[r,r,r]};let a=i.mode===`>`?CK.BLOCK_FOLDED:CK.BLOCK_LITERAL,o=t.source?zJ(t.source):[],s=o.length;for(let e=o.length-1;e>=0;--e){let t=o[e][1];if(t===``||t===`\r`)s=e;else break}if(s===0){let e=i.chomp===`+`&&o.length>0?`
`.repeat(Math.max(1,o.length-1)):``,n=r+i.length;return t.source&&(n+=t.source.length),{value:e,type:a,comment:i.comment,range:[r,n,n]}}let c=t.indent+i.indent,l=t.offset+i.length,u=0;for(let t=0;t<s;++t){let[r,a]=o[t];if(a===``||a===`\r`)i.indent===0&&r.length>c&&(c=r.length);else{r.length<c&&n(l+r.length,`MISSING_CHAR`,`Block scalars with more-indented leading empty lines must use an explicit indentation indicator`),i.indent===0&&(c=r.length),u=t,c===0&&!e.atRoot&&n(l,`BAD_INDENT`,`Block scalar values in collections must be indented`);break}l+=r.length+a.length+1}for(let e=o.length-1;e>=s;--e)o[e][0].length>c&&(s=e+1);let d=``,f=``,p=!1;for(let e=0;e<u;++e)d+=o[e][0].slice(c)+`
`;for(let e=u;e<s;++e){let[t,r]=o[e];l+=t.length+r.length+1;let s=r[r.length-1]===`\r`;if(s&&(r=r.slice(0,-1)),r&&t.length<c){let e=`Block scalar lines must not be less indented than their ${i.indent?`explicit indentation indicator`:`first line`}`;n(l-r.length-(s?2:1),`BAD_INDENT`,e),t=``}a===EK.BLOCK_LITERAL?(d+=f+t.slice(c)+r,f=`
`;for(let e=u;e<s;++e){let[t,r]=o[e];l+=t.length+r.length+1;let s=r[r.length-1]===`\r`;if(s&&(r=r.slice(0,-1)),r&&t.length<c){let e=`Block scalar lines must not be less indented than their ${i.indent?`explicit indentation indicator`:`first line`}`;n(l-r.length-(s?2:1),`BAD_INDENT`,e),t=``}a===CK.BLOCK_LITERAL?(d+=f+t.slice(c)+r,f=`
`):t.length>c||r[0]===` `?(f===` `?f=`
`:!p&&f===`
`&&(f=`
@@ -86,59 +86,59 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
`+o[e][0].slice(c);d[d.length-1]!==`
`&&(d+=`
`);break;default:d+=`
`}let m=r+i.length+t.source.length;return{value:d,type:a,comment:i.comment,range:[r,m,m]}}function VJ({offset:e,props:t},n,r){if(t[0].type!==`block-scalar-header`)return r(t[0],`IMPOSSIBLE`,`Block scalar header not found`),null;let{source:i}=t[0],a=i[0],o=0,s=``,c=-1;for(let t=1;t<i.length;++t){let n=i[t];if(!s&&(n===`-`||n===`+`))s=n;else{let r=Number(n);!o&&r?o=r:c===-1&&(c=e+t)}}c!==-1&&r(c,`UNEXPECTED_TOKEN`,`Block scalar header includes extra characters: ${i}`);let l=!1,u=``,d=i.length;for(let e=1;e<t.length;++e){let i=t[e];switch(i.type){case`space`:l=!0;case`newline`:d+=i.source.length;break;case`comment`:n&&!l&&r(i,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`),d+=i.source.length,u=i.source.substring(1);break;case`error`:r(i,`UNEXPECTED_TOKEN`,i.message),d+=i.source.length;break;default:{r(i,`UNEXPECTED_TOKEN`,`Unexpected token in block scalar header: ${i.type}`);let e=i.source;e&&typeof e==`string`&&(d+=e.length)}}}return{mode:a,indent:o,chomp:s,comment:u,length:d}}function HJ(e){let t=e.split(/\n( *)/),n=t[0],r=n.match(/^( *)/),i=[r?.[1]?[r[1],n.slice(r[1].length)]:[``,n]];for(let e=1;e<t.length;e+=2)i.push([t[e],t[e+1]]);return i}function UJ(e,t,n){let{offset:r,type:i,source:a,end:o}=e,s,c,l=(e,t,i)=>n(r+e,t,i);switch(i){case`scalar`:s=EK.PLAIN,c=WJ(a,l);break;case`single-quoted-scalar`:s=EK.QUOTE_SINGLE,c=GJ(a,l);break;case`double-quoted-scalar`:s=EK.QUOTE_DOUBLE,c=qJ(a,l);break;default:return n(e,`UNEXPECTED_TOKEN`,`Expected a flow scalar value, but found: ${i}`),{value:``,type:null,comment:``,range:[r,r+a.length,r+a.length]}}let u=r+a.length,d=PJ(o,u,t,n);return{value:c,type:s,comment:d.comment,range:[r,u,d.offset]}}function WJ(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]}`}return n&&t(0,`BAD_SCALAR_START`,`Plain value cannot start with ${n}`),KJ(e)}function GJ(e,t){return(e[e.length-1]!==`'`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing 'quote`),KJ(e.slice(1,-1)).replace(/''/g,`'`)}function KJ(e){let t=/(.*?)\r?\n/sy,n=t.exec(e);if(!n)return e;let r,i;try{r=RegExp(`(?<![ ])[ ]+$`),i=RegExp(`^[ ]+|(?<![ ])[ ]+$`,`g`)}catch{r=/[ \t]+$/,i=/^[ \t]+|[ \t]+$/g}let a=n[1].replace(r,``),o=` `,s=t.lastIndex;for(;n=t.exec(e);){let e=n[1].replace(i,``);e===``?o===`
`}let m=r+i.length+t.source.length;return{value:d,type:a,comment:i.comment,range:[r,m,m]}}function RJ({offset:e,props:t},n,r){if(t[0].type!==`block-scalar-header`)return r(t[0],`IMPOSSIBLE`,`Block scalar header not found`),null;let{source:i}=t[0],a=i[0],o=0,s=``,c=-1;for(let t=1;t<i.length;++t){let n=i[t];if(!s&&(n===`-`||n===`+`))s=n;else{let r=Number(n);!o&&r?o=r:c===-1&&(c=e+t)}}c!==-1&&r(c,`UNEXPECTED_TOKEN`,`Block scalar header includes extra characters: ${i}`);let l=!1,u=``,d=i.length;for(let e=1;e<t.length;++e){let i=t[e];switch(i.type){case`space`:l=!0;case`newline`:d+=i.source.length;break;case`comment`:n&&!l&&r(i,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`),d+=i.source.length,u=i.source.substring(1);break;case`error`:r(i,`UNEXPECTED_TOKEN`,i.message),d+=i.source.length;break;default:{r(i,`UNEXPECTED_TOKEN`,`Unexpected token in block scalar header: ${i.type}`);let e=i.source;e&&typeof e==`string`&&(d+=e.length)}}}return{mode:a,indent:o,chomp:s,comment:u,length:d}}function zJ(e){let t=e.split(/\n( *)/),n=t[0],r=n.match(/^( *)/),i=[r?.[1]?[r[1],n.slice(r[1].length)]:[``,n]];for(let e=1;e<t.length;e+=2)i.push([t[e],t[e+1]]);return i}function BJ(e,t,n){let{offset:r,type:i,source:a,end:o}=e,s,c,l=(e,t,i)=>n(r+e,t,i);switch(i){case`scalar`:s=CK.PLAIN,c=VJ(a,l);break;case`single-quoted-scalar`:s=CK.QUOTE_SINGLE,c=HJ(a,l);break;case`double-quoted-scalar`:s=CK.QUOTE_DOUBLE,c=WJ(a,l);break;default:return n(e,`UNEXPECTED_TOKEN`,`Expected a flow scalar value, but found: ${i}`),{value:``,type:null,comment:``,range:[r,r+a.length,r+a.length]}}let u=r+a.length,d=jJ(o,u,t,n);return{value:c,type:s,comment:d.comment,range:[r,u,d.offset]}}function VJ(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]}`}return n&&t(0,`BAD_SCALAR_START`,`Plain value cannot start with ${n}`),UJ(e)}function HJ(e,t){return(e[e.length-1]!==`'`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing 'quote`),UJ(e.slice(1,-1)).replace(/''/g,`'`)}function UJ(e){let t=/(.*?)\r?\n/sy,n=t.exec(e);if(!n)return e;let r,i;try{r=RegExp(`(?<![ ])[ ]+$`),i=RegExp(`^[ ]+|(?<![ ])[ ]+$`,`g`)}catch{r=/[ \t]+$/,i=/^[ \t]+|[ \t]+$/g}let a=n[1].replace(r,``),o=` `,s=t.lastIndex;for(;n=t.exec(e);){let e=n[1].replace(i,``);e===``?o===`
`?a+=o:o=`
`:(a+=o+e,o=` `),s=t.lastIndex}let c=/[ \t]*(.*)/sy;return c.lastIndex=s,n=c.exec(e),a+o+(n?.[1]??``)}function qJ(e,t){let n=``;for(let r=1;r<e.length-1;++r){let i=e[r];if(i!==`\r`||e[r+1]!==`
`:(a+=o+e,o=` `),s=t.lastIndex}let c=/[ \t]*(.*)/sy;return c.lastIndex=s,n=c.exec(e),a+o+(n?.[1]??``)}function WJ(e,t){let n=``;for(let r=1;r<e.length-1;++r){let i=e[r];if(i!==`\r`||e[r+1]!==`
`){if(i===`
`){let{fold:t,offset:i}=JJ(e,r);n+=t,r=i}else if(i===`\\`){let i=e[++r],a=YJ[i];if(a)n+=a;else if(i===`
`){let{fold:t,offset:i}=GJ(e,r);n+=t,r=i}else if(i===`\\`){let i=e[++r],a=KJ[i];if(a)n+=a;else if(i===`
`)for(i=e[r+1];i===` `||i===` `;)i=e[++r+1];else if(i===`\r`&&e[r+1]===`
`)for(i=e[++r+1];i===` `||i===` `;)i=e[++r+1];else if(i===`x`||i===`u`||i===`U`){let a=i===`x`?2:i===`u`?4:8;n+=XJ(e,r+1,a,t),r+=a}else{let i=e.substr(r-1,2);t(r-1,`BAD_DQ_ESCAPE`,`Invalid escape sequence ${i}`),n+=i}}else if(i===` `||i===` `){let t=r,a=e[r+1];for(;a===` `||a===` `;)a=e[++r+1];a!==`
`)for(i=e[++r+1];i===` `||i===` `;)i=e[++r+1];else if(i===`x`||i===`u`||i===`U`){let a=i===`x`?2:i===`u`?4:8;n+=qJ(e,r+1,a,t),r+=a}else{let i=e.substr(r-1,2);t(r-1,`BAD_DQ_ESCAPE`,`Invalid escape sequence ${i}`),n+=i}}else if(i===` `||i===` `){let t=r,a=e[r+1];for(;a===` `||a===` `;)a=e[++r+1];a!==`
`&&(a!==`\r`||e[r+2]!==`
`)&&(n+=r>t?e.slice(t,r+1):i)}else n+=i}}return(e[e.length-1]!==`"`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing "quote`),n}function JJ(e,t){let n=``,r=e[t+1];for(;(r===` `||r===` `||r===`
`)&&(n+=r>t?e.slice(t,r+1):i)}else n+=i}}return(e[e.length-1]!==`"`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing "quote`),n}function GJ(e,t){let n=``,r=e[t+1];for(;(r===` `||r===` `||r===`
`||r===`\r`)&&(r!==`\r`||e[t+2]===`
`);)r===`
`&&(n+=`
`),t+=1,r=e[t+1];return n||=` `,{fold:n,offset:t}}var YJ={0:`\0`,a:`\x07`,b:`\b`,e:`\x1B`,f:`\f`,n:`
`,r:`\r`,t:` `,v:`\v`,N:`…`,_:`\xA0`,L:`\u2028`,P:`\u2029`," ":` `,'"':`"`,"/":`/`,"\\":`\\`," ":` `};function XJ(e,t,n,r){let i=e.substr(t,n),a=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(a)}catch{let i=e.substr(t-2,n+2);return r(t-2,`BAD_DQ_ESCAPE`,`Invalid escape sequence ${i}`),i}}function ZJ(e,t,n,r){let{value:i,type:a,comment:o,range:s}=t.type===`block-scalar`?BJ(e,t,r):UJ(t,e.options.strict,r),c=n?e.directives.tagName(n.source,e=>r(n,`TAG_RESOLVE_FAILED`,e)):null,l;l=e.options.stringKeys&&e.atKey?e.schema[qG]:c?QJ(e.schema,i,c,n,r):t.type===`scalar`?$J(e,i,t,r):e.schema[qG];let u;try{let a=l.resolve(i,e=>r(n??t,`TAG_RESOLVE_FAILED`,e),e.options);u=eK(a)?a:new EK(a)}catch(e){let a=e instanceof Error?e.message:String(e);r(n??t,`TAG_RESOLVE_FAILED`,a),u=new EK(i)}return u.range=s,u.source=i,a&&(u.type=a),c&&(u.tag=c),l.format&&(u.format=l.format),o&&(u.comment=o),u}function QJ(e,t,n,r,i){if(n===`!`)return e[qG];let a=[];for(let t of e.tags)if(!t.collection&&t.tag===n){if(t.default&&t.test)a.push(t);else return t}for(let e of a)if(e.test?.test(t))return e;let o=e.knownTags[n];return o&&!o.collection?(e.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(i(r,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${n}`,n!==`tag:yaml.org,2002:str`),e[qG])}function $J({atKey:e,directives:t,schema:n},r,i,a){let o=n.tags.find(t=>(t.default===!0||e&&t.default===`key`)&&t.test?.test(r))||n[qG];if(n.compat){let e=n.compat.find(e=>e.default&&e.test?.test(r))??n[qG];o.tag!==e.tag&&a(i,`TAG_RESOLVE_FAILED`,`Value may be parsed as either ${t.tagString(o.tag)} or ${t.tagString(e.tag)}`,!0)}return o}function qee(e,t,n){if(t){n??=t.length;for(let r=n-1;r>=0;--r){let n=t[r];switch(n.type){case`space`:case`comment`:case`newline`:e-=n.source.length;continue}for(n=t[++r];n?.type===`space`;)e+=n.source.length,n=t[++r];break}}return e}var eY={composeNode:tY,composeEmptyNode:nY};function tY(e,t,n,r){let i=e.atKey,{spaceBefore:a,comment:o,anchor:s,tag:c}=n,l,u=!0;switch(t.type){case`alias`:l=rY(e,t,r),(s||c)&&r(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`:l=ZJ(e,t,c,r),s&&(l.anchor=s.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:try{l=zJ(eY,e,t,n,r),s&&(l.anchor=s.source.substring(1))}catch(e){r(t,`RESOURCE_EXHAUSTION`,e instanceof Error?e.message:String(e))}break;default:r(t,`UNEXPECTED_TOKEN`,t.type===`error`?t.message:`Unsupported token (type: ${t.type})`),u=!1}return l??=nY(e,t.offset,void 0,null,n,r),s&&l.anchor===``&&r(s,`BAD_ALIAS`,`Anchor cannot be an empty string`),i&&e.options.stringKeys&&(!eK(l)||typeof l.value!=`string`||l.tag&&l.tag!==`tag:yaml.org,2002:str`)&&r(c??t,`NON_STRING_KEY`,`With stringKeys, all keys must be strings`),a&&(l.spaceBefore=!0),o&&(t.type===`scalar`&&t.source===``?l.comment=o:l.commentBefore=o),e.options.keepSourceTokens&&u&&(l.srcToken=t),l}function nY(e,t,n,r,{spaceBefore:i,comment:a,anchor:o,tag:s,end:c},l){let u=ZJ(e,{type:`scalar`,offset:qee(t,n,r),indent:-1,source:``},s,l);return o&&(u.anchor=o.source.substring(1),u.anchor===``&&l(o,`BAD_ALIAS`,`Anchor cannot be an empty string`)),i&&(u.spaceBefore=!0),a&&(u.comment=a,u.range[2]=c),u}function rY({options:e},{offset:t,source:n,end:r},i){let a=new CK(n.substring(1));a.source===``&&i(t,`BAD_ALIAS`,`Alias cannot be an empty string`),a.source.endsWith(`:`)&&i(t+n.length-1,`BAD_ALIAS`,`Alias ending in : is ambiguous`,!0);let o=t+n.length,s=PJ(r,o,e.strict,i);return a.range=[t,o,s.offset],s.comment&&(a.comment=s.comment),a}function iY(e,t,{offset:n,start:r,value:i,end:a},o){let s=new xJ(void 0,Object.assign({_directives:t},e)),c={atKey:!1,atRoot:!0,directives:s.directives,options:s.options,schema:s.schema},l=DJ(r,{indicator:`doc-start`,next:i??a?.[0],offset:n,onError:o,parentIndent:0,startOnNewline:!0});l.found&&(s.directives.docStart=!0,i&&(i.type===`block-map`||i.type===`block-seq`)&&!l.hasNewline&&o(l.end,`MISSING_CHAR`,`Block collection cannot start on same line with directives-end marker`)),s.contents=i?tY(c,i,l,o):nY(c,l.end,r,null,l,o);let u=s.contents.range[2],d=PJ(a,u,!1,o);return d.comment&&(s.comment=d.comment),s.range=[n,u,d.offset],s}function aY(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 oY(e){let t=``,n=!1,r=!1;for(let i=0;i<e.length;++i){let a=e[i];switch(a[0]){case`#`:t+=(t===``?``:r?`
`),t+=1,r=e[t+1];return n||=` `,{fold:n,offset:t}}var KJ={0:`\0`,a:`\x07`,b:`\b`,e:`\x1B`,f:`\f`,n:`
`,r:`\r`,t:` `,v:`\v`,N:`…`,_:`\xA0`,L:`\u2028`,P:`\u2029`," ":` `,'"':`"`,"/":`/`,"\\":`\\`," ":` `};function qJ(e,t,n,r){let i=e.substr(t,n),a=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(a)}catch{let i=e.substr(t-2,n+2);return r(t-2,`BAD_DQ_ESCAPE`,`Invalid escape sequence ${i}`),i}}function JJ(e,t,n,r){let{value:i,type:a,comment:o,range:s}=t.type===`block-scalar`?LJ(e,t,r):BJ(t,e.options.strict,r),c=n?e.directives.tagName(n.source,e=>r(n,`TAG_RESOLVE_FAILED`,e)):null,l;l=e.options.stringKeys&&e.atKey?e.schema[WG]:c?YJ(e.schema,i,c,n,r):t.type===`scalar`?XJ(e,i,t,r):e.schema[WG];let u;try{let a=l.resolve(i,e=>r(n??t,`TAG_RESOLVE_FAILED`,e),e.options);u=ZG(a)?a:new CK(a)}catch(e){let a=e instanceof Error?e.message:String(e);r(n??t,`TAG_RESOLVE_FAILED`,a),u=new CK(i)}return u.range=s,u.source=i,a&&(u.type=a),c&&(u.tag=c),l.format&&(u.format=l.format),o&&(u.comment=o),u}function YJ(e,t,n,r,i){if(n===`!`)return e[WG];let a=[];for(let t of e.tags)if(!t.collection&&t.tag===n){if(t.default&&t.test)a.push(t);else return t}for(let e of a)if(e.test?.test(t))return e;let o=e.knownTags[n];return o&&!o.collection?(e.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(i(r,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${n}`,n!==`tag:yaml.org,2002:str`),e[WG])}function XJ({atKey:e,directives:t,schema:n},r,i,a){let o=n.tags.find(t=>(t.default===!0||e&&t.default===`key`)&&t.test?.test(r))||n[WG];if(n.compat){let e=n.compat.find(e=>e.default&&e.test?.test(r))??n[WG];o.tag!==e.tag&&a(i,`TAG_RESOLVE_FAILED`,`Value may be parsed as either ${t.tagString(o.tag)} or ${t.tagString(e.tag)}`,!0)}return o}function ZJ(e,t,n){if(t){n??=t.length;for(let r=n-1;r>=0;--r){let n=t[r];switch(n.type){case`space`:case`comment`:case`newline`:e-=n.source.length;continue}for(n=t[++r];n?.type===`space`;)e+=n.source.length,n=t[++r];break}}return e}var QJ={composeNode:$J,composeEmptyNode:eY};function $J(e,t,n,r){let i=e.atKey,{spaceBefore:a,comment:o,anchor:s,tag:c}=n,l,u=!0;switch(t.type){case`alias`:l=qee(e,t,r),(s||c)&&r(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`:l=JJ(e,t,c,r),s&&(l.anchor=s.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:try{l=IJ(QJ,e,t,n,r),s&&(l.anchor=s.source.substring(1))}catch(e){r(t,`RESOURCE_EXHAUSTION`,e instanceof Error?e.message:String(e))}break;default:r(t,`UNEXPECTED_TOKEN`,t.type===`error`?t.message:`Unsupported token (type: ${t.type})`),u=!1}return l??=eY(e,t.offset,void 0,null,n,r),s&&l.anchor===``&&r(s,`BAD_ALIAS`,`Anchor cannot be an empty string`),i&&e.options.stringKeys&&(!ZG(l)||typeof l.value!=`string`||l.tag&&l.tag!==`tag:yaml.org,2002:str`)&&r(c??t,`NON_STRING_KEY`,`With stringKeys, all keys must be strings`),a&&(l.spaceBefore=!0),o&&(t.type===`scalar`&&t.source===``?l.comment=o:l.commentBefore=o),e.options.keepSourceTokens&&u&&(l.srcToken=t),l}function eY(e,t,n,r,{spaceBefore:i,comment:a,anchor:o,tag:s,end:c},l){let u=JJ(e,{type:`scalar`,offset:ZJ(t,n,r),indent:-1,source:``},s,l);return o&&(u.anchor=o.source.substring(1),u.anchor===``&&l(o,`BAD_ALIAS`,`Anchor cannot be an empty string`)),i&&(u.spaceBefore=!0),a&&(u.comment=a,u.range[2]=c),u}function qee({options:e},{offset:t,source:n,end:r},i){let a=new bK(n.substring(1));a.source===``&&i(t,`BAD_ALIAS`,`Alias cannot be an empty string`),a.source.endsWith(`:`)&&i(t+n.length-1,`BAD_ALIAS`,`Alias ending in : is ambiguous`,!0);let o=t+n.length,s=jJ(r,o,e.strict,i);return a.range=[t,o,s.offset],s.comment&&(a.comment=s.comment),a}function tY(e,t,{offset:n,start:r,value:i,end:a},o){let s=new vJ(void 0,Object.assign({_directives:t},e)),c={atKey:!1,atRoot:!0,directives:s.directives,options:s.options,schema:s.schema},l=wJ(r,{indicator:`doc-start`,next:i??a?.[0],offset:n,onError:o,parentIndent:0,startOnNewline:!0});l.found&&(s.directives.docStart=!0,i&&(i.type===`block-map`||i.type===`block-seq`)&&!l.hasNewline&&o(l.end,`MISSING_CHAR`,`Block collection cannot start on same line with directives-end marker`)),s.contents=i?$J(c,i,l,o):eY(c,l.end,r,null,l,o);let u=s.contents.range[2],d=jJ(a,u,!1,o);return d.comment&&(s.comment=d.comment),s.range=[n,u,d.offset],s}function nY(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 rY(e){let t=``,n=!1,r=!1;for(let i=0;i<e.length;++i){let a=e[i];switch(a[0]){case`#`:t+=(t===``?``:r?`
`:`
`)+(a.substring(1)||` `),n=!0,r=!1;break;case`%`:e[i+1]?.[0]!==`#`&&(i+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:t,afterEmptyLine:r}}var sY=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,n,r)=>{let i=aY(e);r?this.warnings.push(new TJ(i,t,n)):this.errors.push(new wJ(i,t,n))},this.directives=new hK({version:e.version||`1.2`}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=oY(this.prelude);if(n){let i=e.contents;if(t)e.comment=e.comment?`${e.comment}\n${n}`:n;else if(r||e.directives.docStart||!i)e.commentBefore=n;else if(nK(i)&&!i.flow&&i.items.length>0){let e=i.items[0];$G(e)&&(e=e.key);let t=e.commentBefore;e.commentBefore=t?`${n}\n${t}`:n}else{let e=i.commentBefore;i.commentBefore=e?`${n}\n${e}`:n}}if(t){for(let t=0;t<this.errors.length;++t)e.errors.push(this.errors[t]);for(let t=0;t<this.warnings.length;++t)e.warnings.push(this.warnings[t])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:oY(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,n=-1){for(let t of e)yield*this.next(t);yield*this.end(t,n)}*next(e){switch(e.type){case`directive`:this.directives.add(e.source,(t,n,r)=>{let i=aY(e);i[0]+=t,this.onError(i,`BAD_DIRECTIVE`,n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case`document`:{let t=iY(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,`MISSING_CHAR`,`Missing directives-end/doc-start indicator line`),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case`byte-order-mark`:case`space`:break;case`comment`:case`newline`:this.prelude.push(e.source);break;case`error`:{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new wJ(aY(e),`UNEXPECTED_TOKEN`,t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case`doc-end`:{if(!this.doc){this.errors.push(new wJ(aY(e),`UNEXPECTED_TOKEN`,`Unexpected doc-end without preceding document`));break}this.doc.directives.docEnd=!0;let t=PJ(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let e=this.doc.comment;this.doc.comment=e?`${e}\n${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new wJ(aY(e),`UNEXPECTED_TOKEN`,`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let e=new xJ(void 0,Object.assign({_directives:this.directives},this.options));this.atDirectives&&this.onError(t,`MISSING_CHAR`,`Missing directives-end indicator line`),e.range=[0,t,t],this.decorate(e,!1),yield e}}},cY=Symbol(`break visit`),lY=Symbol(`skip children`),uY=Symbol(`remove item`);function dY(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),fY(Object.freeze([]),e,t)}dY.BREAK=cY,dY.SKIP=lY,dY.REMOVE=uY,dY.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},dY.parentCollection=(e,t)=>{let n=dY.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 fY(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=fY(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===cY)return cY;else r===uY&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}function pY(e){switch(e){case``:return`byte-order-mark`;case``:return`doc-mode`;case``:return`flow-error-end`;case``:return`scalar`;case`---`:return`doc-start`;case`...`:return`doc-end`;case``:case`
`)+(a.substring(1)||` `),n=!0,r=!1;break;case`%`:e[i+1]?.[0]!==`#`&&(i+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:t,afterEmptyLine:r}}var iY=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,n,r)=>{let i=nY(e);r?this.warnings.push(new SJ(i,t,n)):this.errors.push(new xJ(i,t,n))},this.directives=new fK({version:e.version||`1.2`}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=rY(this.prelude);if(n){let i=e.contents;if(t)e.comment=e.comment?`${e.comment}\n${n}`:n;else if(r||e.directives.docStart||!i)e.commentBefore=n;else if($G(i)&&!i.flow&&i.items.length>0){let e=i.items[0];XG(e)&&(e=e.key);let t=e.commentBefore;e.commentBefore=t?`${n}\n${t}`:n}else{let e=i.commentBefore;i.commentBefore=e?`${n}\n${e}`:n}}if(t){for(let t=0;t<this.errors.length;++t)e.errors.push(this.errors[t]);for(let t=0;t<this.warnings.length;++t)e.warnings.push(this.warnings[t])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:rY(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,n=-1){for(let t of e)yield*this.next(t);yield*this.end(t,n)}*next(e){switch(e.type){case`directive`:this.directives.add(e.source,(t,n,r)=>{let i=nY(e);i[0]+=t,this.onError(i,`BAD_DIRECTIVE`,n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case`document`:{let t=tY(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,`MISSING_CHAR`,`Missing directives-end/doc-start indicator line`),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case`byte-order-mark`:case`space`:break;case`comment`:case`newline`:this.prelude.push(e.source);break;case`error`:{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new xJ(nY(e),`UNEXPECTED_TOKEN`,t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case`doc-end`:{if(!this.doc){this.errors.push(new xJ(nY(e),`UNEXPECTED_TOKEN`,`Unexpected doc-end without preceding document`));break}this.doc.directives.docEnd=!0;let t=jJ(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let e=this.doc.comment;this.doc.comment=e?`${e}\n${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new xJ(nY(e),`UNEXPECTED_TOKEN`,`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let e=new vJ(void 0,Object.assign({_directives:this.directives},this.options));this.atDirectives&&this.onError(t,`MISSING_CHAR`,`Missing directives-end indicator line`),e.range=[0,t,t],this.decorate(e,!1),yield e}}},aY=Symbol(`break visit`),oY=Symbol(`skip children`),sY=Symbol(`remove item`);function cY(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),lY(Object.freeze([]),e,t)}cY.BREAK=aY,cY.SKIP=oY,cY.REMOVE=sY,cY.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},cY.parentCollection=(e,t)=>{let n=cY.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 lY(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=lY(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===aY)return aY;else r===sY&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}function uY(e){switch(e){case``:return`byte-order-mark`;case``:return`doc-mode`;case``:return`flow-error-end`;case``:return`scalar`;case`---`:return`doc-start`;case`...`:return`doc-end`;case``:case`
`:case`\r
`: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}function mY(e){switch(e){case void 0:case` `:case`
`:case`\r`:case` `:return!0;default:return!1}}var hY=new Set(`0123456789ABCDEFabcdef`),gY=new Set(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()`),_Y=new Set(`,[]{}`),vY=new Set(` ,[]{}
\r `),yY=e=>!e||vY.has(e),bY=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer=``,this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){if(e){if(typeof e!=`string`)throw TypeError(`source is not a string`);this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let n=this.next??`stream`;for(;n&&(t||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===` `||t===` `;)t=this.buffer[++e];return!t||t===`#`||t===`
`: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}function dY(e){switch(e){case void 0:case` `:case`
`:case`\r`:case` `:return!0;default:return!1}}var fY=new Set(`0123456789ABCDEFabcdef`),pY=new Set(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()`),mY=new Set(`,[]{}`),hY=new Set(` ,[]{}
\r `),gY=e=>!e||hY.has(e),_Y=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer=``,this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){if(e){if(typeof e!=`string`)throw TypeError(`source is not a string`);this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let n=this.next??`stream`;for(;n&&(t||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===` `||t===` `;)t=this.buffer[++e];return!t||t===`#`||t===`
`||t===`\r`&&this.buffer[e+1]===`
`}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let n=0;for(;t===` `;)t=this.buffer[++n+e];if(t===`\r`){let t=this.buffer[n+e+1];if(t===`
`||!t&&!this.atEnd)return e+n+1}return t===`
`||n>=this.indentNext||!t&&!this.atEnd?e+n:-1}if(t===`-`||t===`.`){let t=this.buffer.substr(e,3);if((t===`---`||t===`...`)&&mY(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!=`number`||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]===`\r`&&--e,this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case`stream`:return yield*this.parseStream();case`line-start`:return yield*this.parseLineStart();case`block-start`:return yield*this.parseBlockStart();case`doc`:return yield*this.parseDocument();case`flow`:return yield*this.parseFlowCollection();case`quoted-scalar`:return yield*this.parseQuotedScalar();case`block-scalar`:return yield*this.parseBlockScalar();case`plain-scalar`:return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext(`stream`);if(e[0]===``&&(yield*this.pushCount(1),e=e.substring(1)),e[0]===`%`){let t=e.length,n=e.indexOf(`#`);for(;n!==-1;){let r=e[n-1];if(r===` `||r===` `){t=n-1;break}n=e.indexOf(`#`,n+1)}for(;;){let n=e[t-1];if(n===` `||n===` `)--t;else break}let r=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-r),this.pushNewline(),`stream`}if(this.atLineEnd()){let t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),`stream`}return yield``,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext(`line-start`);if(e===`-`||e===`.`){if(!this.atEnd&&!this.hasChars(4))return this.setNext(`line-start`);let e=this.peek(3);if((e===`---`||e===`...`)&&mY(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,e===`---`?`doc`:`stream`}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!mY(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext(`block-start`);if((e===`-`||e===`?`||e===`:`)&&mY(t)){let e=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=e,`block-start`}return`doc`}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext(`doc`);let t=yield*this.pushIndicators();switch(e[t]){case`#`:yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case`{`:case`[`:return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,`flow`;case`}`:case`]`:return yield*this.pushCount(1),`doc`;case`*`:return yield*this.pushUntil(yY),`doc`;case`"`:case`'`:return yield*this.parseQuotedScalar();case`|`:case`>`:return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,n=-1;do e=yield*this.pushNewline(),e>0?(t=yield*this.pushSpaces(!1),this.indentValue=n=t):t=0,t+=yield*this.pushSpaces(!0);while(e+t>0);let r=this.getLine();if(r===null)return this.setNext(`flow`);if((n!==-1&&n<this.indentNext&&r[0]!==`#`||n===0&&(r.startsWith(`---`)||r.startsWith(`...`))&&mY(r[3]))&&(n!==this.indentNext-1||this.flowLevel!==1||r[0]!==`]`&&r[0]!==`}`))return this.flowLevel=0,yield``,yield*this.parseLineStart();let i=0;for(;r[i]===`,`;)i+=yield*this.pushCount(1),i+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(i+=yield*this.pushIndicators(),r[i]){case void 0:return`flow`;case`#`:return yield*this.pushCount(r.length-i),`flow`;case`{`:case`[`:return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,`flow`;case`}`:case`]`:return yield*this.pushCount(1),this.flowKey=!0,--this.flowLevel,this.flowLevel?`flow`:`doc`;case`*`:return yield*this.pushUntil(yY),`flow`;case`"`:case`'`:return this.flowKey=!0,yield*this.parseQuotedScalar();case`:`:{let e=this.charAt(1);if(this.flowKey||mY(e)||e===`,`)return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),`flow`}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),t=this.buffer.indexOf(e,this.pos+1);if(e===`'`)for(;t!==-1&&this.buffer[t+1]===`'`;)t=this.buffer.indexOf(`'`,t+2);else for(;t!==-1;){let e=0;for(;this.buffer[t-1-e]===`\\`;)e+=1;if(e%2==0)break;t=this.buffer.indexOf(`"`,t+1)}let n=this.buffer.substring(0,t),r=n.indexOf(`
`||n>=this.indentNext||!t&&!this.atEnd?e+n:-1}if(t===`-`||t===`.`){let t=this.buffer.substr(e,3);if((t===`---`||t===`...`)&&dY(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!=`number`||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]===`\r`&&--e,this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case`stream`:return yield*this.parseStream();case`line-start`:return yield*this.parseLineStart();case`block-start`:return yield*this.parseBlockStart();case`doc`:return yield*this.parseDocument();case`flow`:return yield*this.parseFlowCollection();case`quoted-scalar`:return yield*this.parseQuotedScalar();case`block-scalar`:return yield*this.parseBlockScalar();case`plain-scalar`:return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext(`stream`);if(e[0]===``&&(yield*this.pushCount(1),e=e.substring(1)),e[0]===`%`){let t=e.length,n=e.indexOf(`#`);for(;n!==-1;){let r=e[n-1];if(r===` `||r===` `){t=n-1;break}n=e.indexOf(`#`,n+1)}for(;;){let n=e[t-1];if(n===` `||n===` `)--t;else break}let r=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-r),this.pushNewline(),`stream`}if(this.atLineEnd()){let t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),`stream`}return yield``,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext(`line-start`);if(e===`-`||e===`.`){if(!this.atEnd&&!this.hasChars(4))return this.setNext(`line-start`);let e=this.peek(3);if((e===`---`||e===`...`)&&dY(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,e===`---`?`doc`:`stream`}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!dY(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext(`block-start`);if((e===`-`||e===`?`||e===`:`)&&dY(t)){let e=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=e,`block-start`}return`doc`}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext(`doc`);let t=yield*this.pushIndicators();switch(e[t]){case`#`:yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case`{`:case`[`:return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,`flow`;case`}`:case`]`:return yield*this.pushCount(1),`doc`;case`*`:return yield*this.pushUntil(gY),`doc`;case`"`:case`'`:return yield*this.parseQuotedScalar();case`|`:case`>`:return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,n=-1;do e=yield*this.pushNewline(),e>0?(t=yield*this.pushSpaces(!1),this.indentValue=n=t):t=0,t+=yield*this.pushSpaces(!0);while(e+t>0);let r=this.getLine();if(r===null)return this.setNext(`flow`);if((n!==-1&&n<this.indentNext&&r[0]!==`#`||n===0&&(r.startsWith(`---`)||r.startsWith(`...`))&&dY(r[3]))&&(n!==this.indentNext-1||this.flowLevel!==1||r[0]!==`]`&&r[0]!==`}`))return this.flowLevel=0,yield``,yield*this.parseLineStart();let i=0;for(;r[i]===`,`;)i+=yield*this.pushCount(1),i+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(i+=yield*this.pushIndicators(),r[i]){case void 0:return`flow`;case`#`:return yield*this.pushCount(r.length-i),`flow`;case`{`:case`[`:return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,`flow`;case`}`:case`]`:return yield*this.pushCount(1),this.flowKey=!0,--this.flowLevel,this.flowLevel?`flow`:`doc`;case`*`:return yield*this.pushUntil(gY),`flow`;case`"`:case`'`:return this.flowKey=!0,yield*this.parseQuotedScalar();case`:`:{let e=this.charAt(1);if(this.flowKey||dY(e)||e===`,`)return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),`flow`}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),t=this.buffer.indexOf(e,this.pos+1);if(e===`'`)for(;t!==-1&&this.buffer[t+1]===`'`;)t=this.buffer.indexOf(`'`,t+2);else for(;t!==-1;){let e=0;for(;this.buffer[t-1-e]===`\\`;)e+=1;if(e%2==0)break;t=this.buffer.indexOf(`"`,t+1)}let n=this.buffer.substring(0,t),r=n.indexOf(`
`,this.pos);if(r!==-1){for(;r!==-1;){let e=this.continueScalar(r+1);if(e===-1)break;r=n.indexOf(`
`,e)}r!==-1&&(t=r-(n[r-1]===`\r`?2:1))}if(t===-1){if(!this.atEnd)return this.setNext(`quoted-scalar`);t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?`flow`:`doc`}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let t=this.buffer[++e];if(t===`+`)this.blockScalarKeep=!0;else if(t>`0`&&t<=`9`)this.blockScalarIndent=Number(t)-1;else if(t!==`-`)break}return yield*this.pushUntil(e=>mY(e)||e===`#`)}*parseBlockScalar(){let e=this.pos-1,t=0,n;loop:for(let r=this.pos;n=this.buffer[r];++r)switch(n){case` `:t+=1;break;case`
`,e)}r!==-1&&(t=r-(n[r-1]===`\r`?2:1))}if(t===-1){if(!this.atEnd)return this.setNext(`quoted-scalar`);t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?`flow`:`doc`}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let t=this.buffer[++e];if(t===`+`)this.blockScalarKeep=!0;else if(t>`0`&&t<=`9`)this.blockScalarIndent=Number(t)-1;else if(t!==`-`)break}return yield*this.pushUntil(e=>dY(e)||e===`#`)}*parseBlockScalar(){let e=this.pos-1,t=0,n;loop:for(let r=this.pos;n=this.buffer[r];++r)switch(n){case` `:t+=1;break;case`
`:e=r,t=0;break;case`\r`:{let e=this.buffer[r+1];if(!e&&!this.atEnd)return this.setNext(`block-scalar`);if(e===`
`)break}default:break loop}if(!n&&!this.atEnd)return this.setNext(`block-scalar`);if(t>=this.indentNext){this.indentNext=this.blockScalarIndent===-1?t:this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let t=this.continueScalar(e+1);if(t===-1)break;e=this.buffer.indexOf(`
`,t)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext(`block-scalar`);e=this.buffer.length}}let r=e+1;for(n=this.buffer[r];n===` `;)n=this.buffer[++r];if(n===` `){for(;n===` `||n===` `||n===`\r`||n===`
`;)n=this.buffer[++r];e=r-1}else if(!this.blockScalarKeep)do{let n=e-1,r=this.buffer[n];r===`\r`&&(r=this.buffer[--n]);let i=n;for(;r===` `;)r=this.buffer[--n];if(r===`
`&&n>=this.pos&&n+1+t>i)e=n;else break}while(1);return yield``,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,n=this.pos-1,r;for(;r=this.buffer[++n];)if(r===`:`){let r=this.buffer[n+1];if(mY(r)||e&&_Y.has(r))break;t=n}else if(mY(r)){let i=this.buffer[n+1];if(r===`\r`&&(i===`
`&&n>=this.pos&&n+1+t>i)e=n;else break}while(1);return yield``,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,n=this.pos-1,r;for(;r=this.buffer[++n];)if(r===`:`){let r=this.buffer[n+1];if(dY(r)||e&&mY.has(r))break;t=n}else if(dY(r)){let i=this.buffer[n+1];if(r===`\r`&&(i===`
`?(n+=1,r=`
`,i=this.buffer[n+1]):t=n),i===`#`||e&&_Y.has(i))break;if(r===`
`){let e=this.continueScalar(n+1);if(e===-1)break;n=Math.max(n,e-2)}}else{if(e&&_Y.has(r))break;t=n}return!r&&!this.atEnd?this.setNext(`plain-scalar`):(yield``,yield*this.pushToIndex(t+1,!0),e?`flow`:`doc`)}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(t&&(yield``),0)}*pushIndicators(){let e=0;loop:for(;;){switch(this.charAt(0)){case`!`:e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue loop;case`&`:e+=yield*this.pushUntil(yY),e+=yield*this.pushSpaces(!0);continue loop;case`-`:case`?`:case`:`:{let t=this.flowLevel>0,n=this.charAt(1);if(mY(n)||t&&_Y.has(n)){t?this.flowKey&&=!1:this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue loop}}}break loop}return e}*pushTag(){if(this.charAt(1)===`<`){let e=this.pos+2,t=this.buffer[e];for(;!mY(t)&&t!==`>`;)t=this.buffer[++e];return yield*this.pushToIndex(t===`>`?e+1:e,!1)}{let e=this.pos+1,t=this.buffer[e];for(;t;)if(gY.has(t))t=this.buffer[++e];else if(t===`%`&&hY.has(this.buffer[e+1])&&hY.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
`,i=this.buffer[n+1]):t=n),i===`#`||e&&mY.has(i))break;if(r===`
`){let e=this.continueScalar(n+1);if(e===-1)break;n=Math.max(n,e-2)}}else{if(e&&mY.has(r))break;t=n}return!r&&!this.atEnd?this.setNext(`plain-scalar`):(yield``,yield*this.pushToIndex(t+1,!0),e?`flow`:`doc`)}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(t&&(yield``),0)}*pushIndicators(){let e=0;loop:for(;;){switch(this.charAt(0)){case`!`:e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue loop;case`&`:e+=yield*this.pushUntil(gY),e+=yield*this.pushSpaces(!0);continue loop;case`-`:case`?`:case`:`:{let t=this.flowLevel>0,n=this.charAt(1);if(dY(n)||t&&mY.has(n)){t?this.flowKey&&=!1:this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue loop}}}break loop}return e}*pushTag(){if(this.charAt(1)===`<`){let e=this.pos+2,t=this.buffer[e];for(;!dY(t)&&t!==`>`;)t=this.buffer[++e];return yield*this.pushToIndex(t===`>`?e+1:e,!1)}{let e=this.pos+1,t=this.buffer[e];for(;t;)if(pY.has(t))t=this.buffer[++e];else if(t===`%`&&fY.has(this.buffer[e+1])&&fY.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
`?yield*this.pushCount(1):e===`\r`&&this.charAt(1)===`
`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,n;do n=this.buffer[++t];while(n===` `||e&&n===` `);let r=t-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=t),r}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}},xY=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t<n;){let r=t+n>>1;this.lineStarts[r]<e?t=r+1:n=r}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};let r=this.lineStarts[t-1];return{line:t,col:e-r+1}}}};function SY(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function CY(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 wY(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 TY(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 EY(e){if(e.length===0)return[];let t=e.length;loop: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 loop}for(;e[++t]?.type===`space`;);return e.splice(t,e.length)}function DY(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 OY(e){if(e.start.type===`flow-seq-start`)for(let t of e.items)t.sep&&!t.value&&!SY(t.start,`explicit-key-ind`)&&!SY(t.sep,`map-value-ind`)&&(t.key&&(t.value=t.key),delete t.key,wY(t.value)?t.value.end?DY(t.value.end,t.sep):t.value.end=t.sep:DY(t.start,t.sep),delete t.sep)}var kY=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source=``,this.type=``,this.lexer=new bY,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let n of this.lexer.lex(e,t))yield*this.next(n);t||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=pY(e);if(!t){let t=`Not a YAML token: ${e}`;yield*this.pop({type:`error`,offset:this.offset,message:t,source:e}),this.offset+=e.length}else if(t===`scalar`)this.atNewLine=!1,this.atScalar=!0,this.type=`scalar`;else{switch(this.type=t,yield*this.step(),t){case`newline`:this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case`space`:this.atNewLine&&e[0]===` `&&(this.indent+=e.length);break;case`explicit-key-ind`:case`map-value-ind`:case`seq-item-ind`:this.atNewLine&&(this.indent+=e.length);break;case`doc-mode`:case`flow-error-end`:return;default:this.atNewLine=!1}this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type===`doc-end`&&e?.type!==`doc-end`){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:`doc-end`,offset:this.offset,source:this.source})}else{if(!e)return yield*this.stream();switch(e.type){case`document`:return yield*this.document(e);case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return yield*this.scalar(e);case`block-scalar`:return yield*this.blockScalar(e);case`block-map`:return yield*this.blockMap(e);case`block-seq`:return yield*this.blockSequence(e);case`flow-collection`:return yield*this.flowCollection(e);case`doc-end`:return yield*this.documentEnd(e)}yield*this.pop()}}peek(e){return this.stack[this.stack.length-e]}*pop(e){let t=e??this.stack.pop();if(!t)yield{type:`error`,offset:this.offset,source:``,message:`Tried to pop an empty stack`};else if(this.stack.length===0)yield t;else{let e=this.peek(1);switch(t.type===`block-scalar`?t.indent=`indent`in e?e.indent:0:t.type===`flow-collection`&&e.type===`document`&&(t.indent=0),t.type===`flow-collection`&&OY(t),e.type){case`document`:e.value=t;break;case`block-scalar`:e.props.push(t);break;case`block-map`:{let n=e.items[e.items.length-1];if(n.value){e.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}if(n.sep)n.value=t;else{Object.assign(n,{key:t,sep:[]}),this.onKeyLine=!n.explicitKey;return}break}case`block-seq`:{let n=e.items[e.items.length-1];n.value?e.items.push({start:[],value:t}):n.value=t;break}case`flow-collection`:{let n=e.items[e.items.length-1];!n||n.value?e.items.push({start:[],key:t,sep:[]}):n.sep?n.value=t:Object.assign(n,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((e.type===`document`||e.type===`block-map`||e.type===`block-seq`)&&(t.type===`block-map`||t.type===`block-seq`)){let n=t.items[t.items.length-1];n&&!n.sep&&!n.value&&n.start.length>0&&CY(n.start)===-1&&(t.indent===0||n.start.every(e=>e.type!==`comment`||e.in Line truncated
`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,n;do n=this.buffer[++t];while(n===` `||e&&n===` `);let r=t-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=t),r}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}},vY=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t<n;){let r=t+n>>1;this.lineStarts[r]<e?t=r+1:n=r}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};let r=this.lineStarts[t-1];return{line:t,col:e-r+1}}}};function yY(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function bY(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 xY(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 SY(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 CY(e){if(e.length===0)return[];let t=e.length;loop: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 loop}for(;e[++t]?.type===`space`;);return e.splice(t,e.length)}function wY(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 TY(e){if(e.start.type===`flow-seq-start`)for(let t of e.items)t.sep&&!t.value&&!yY(t.start,`explicit-key-ind`)&&!yY(t.sep,`map-value-ind`)&&(t.key&&(t.value=t.key),delete t.key,xY(t.value)?t.value.end?wY(t.value.end,t.sep):t.value.end=t.sep:wY(t.start,t.sep),delete t.sep)}var EY=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source=``,this.type=``,this.lexer=new _Y,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let n of this.lexer.lex(e,t))yield*this.next(n);t||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=uY(e);if(!t){let t=`Not a YAML token: ${e}`;yield*this.pop({type:`error`,offset:this.offset,message:t,source:e}),this.offset+=e.length}else if(t===`scalar`)this.atNewLine=!1,this.atScalar=!0,this.type=`scalar`;else{switch(this.type=t,yield*this.step(),t){case`newline`:this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case`space`:this.atNewLine&&e[0]===` `&&(this.indent+=e.length);break;case`explicit-key-ind`:case`map-value-ind`:case`seq-item-ind`:this.atNewLine&&(this.indent+=e.length);break;case`doc-mode`:case`flow-error-end`:return;default:this.atNewLine=!1}this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type===`doc-end`&&e?.type!==`doc-end`){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:`doc-end`,offset:this.offset,source:this.source})}else{if(!e)return yield*this.stream();switch(e.type){case`document`:return yield*this.document(e);case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return yield*this.scalar(e);case`block-scalar`:return yield*this.blockScalar(e);case`block-map`:return yield*this.blockMap(e);case`block-seq`:return yield*this.blockSequence(e);case`flow-collection`:return yield*this.flowCollection(e);case`doc-end`:return yield*this.documentEnd(e)}yield*this.pop()}}peek(e){return this.stack[this.stack.length-e]}*pop(e){let t=e??this.stack.pop();if(!t)yield{type:`error`,offset:this.offset,source:``,message:`Tried to pop an empty stack`};else if(this.stack.length===0)yield t;else{let e=this.peek(1);switch(t.type===`block-scalar`?t.indent=`indent`in e?e.indent:0:t.type===`flow-collection`&&e.type===`document`&&(t.indent=0),t.type===`flow-collection`&&TY(t),e.type){case`document`:e.value=t;break;case`block-scalar`:e.props.push(t);break;case`block-map`:{let n=e.items[e.items.length-1];if(n.value){e.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}if(n.sep)n.value=t;else{Object.assign(n,{key:t,sep:[]}),this.onKeyLine=!n.explicitKey;return}break}case`block-seq`:{let n=e.items[e.items.length-1];n.value?e.items.push({start:[],value:t}):n.value=t;break}case`flow-collection`:{let n=e.items[e.items.length-1];!n||n.value?e.items.push({start:[],key:t,sep:[]}):n.sep?n.value=t:Object.assign(n,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((e.type===`document`||e.type===`block-map`||e.type===`block-seq`)&&(t.type===`block-map`||t.type===`block-seq`)){let n=t.items[t.items.length-1];n&&!n.sep&&!n.value&&n.start.length>0&&bY(n.start)===-1&&(t.indent===0||n.start.every(e=>e.type!==`comment`||e.in Line truncated
`)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
`,e)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(this.onKeyLine=!1,t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){DY(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,r=n&&(t.sep||t.explicitKey)&&this.type!==`seq-item-ind`,i=[];if(r&&t.sep&&!t.value){let n=[];for(let r=0;r<t.sep.length;++r){let i=t.sep[r];switch(i.type){case`newline`:n.push(r);break;case`space`:break;case`comment`:i.indent>e.indent&&(n.length=0);break;default:n.length=0}}n.length>=2&&(i=t.sep.splice(n[1]))}switch(this.type){case`anchor`:case`tag`:r||t.value?(i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`explicit-key-ind`:!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):r||t.value?(i.push(this.sourceToken),e.items.push({start:i,explicitKey:!0})):this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case`map-value-ind`:if(t.explicitKey){if(!t.sep){if(SY(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=EY(t.start);this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:null,sep:[this.sourceToken]}]})}}else if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(SY(t.sep,`map-value-ind`))this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if(wY(t.key)&&!SY(t.sep,`newline`)){let e=EY(t.start),n=t.key,r=t.sep;r.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:n,sep:r}]})}else i.length>0?t.sep=t.sep.concat(i,this.sourceToken):t.sep.push(this.sourceToken)}else t.sep?t.value||r?e.items.push({start:i,key:null,sep:[this.sourceToken]}):SY(t.sep,`map-value-ind`)?this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);r||t.value?(e.items.push({start:i,key:n,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(n):(Object.assign(t,{key:n,sep:[]}),this.onKeyLine=!0);return}default:{let r=this.startBlockValue(e);if(r){if(r.type===`block-seq`){if(!t.explicitKey&&t.sep&&!SY(t.sep,`newline`)){yield*this.pop({type:`error`,offset:this.offset,message:`Unexpected block-seq-ind on same line with key`,source:this.source});return}}else n&&e.items.push({start:i});this.stack.push(r);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){DY(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case`anchor`:case`tag`:if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case`seq-item-ind`:if(this.indent!==e.indent)break;t.value||SY(t.start,`seq-item-ind`)?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let t=this.startBlockValue(e);if(t){this.stack.push(t);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type===`flow-error-end`){let e;do yield*this.pop(),e=this.peek(1);while(e?.type===`flow-collection`)}else if(e.end.length===0){switch(this.type){case`comma`:case`explicit-key-ind`:!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case`map-value-ind`:!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case`space`:case`comment`:case`newline`:case`anchor`:case`tag`:!t||t.value?e.ite Line truncated
`,e)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(this.onKeyLine=!1,t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){wY(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,r=n&&(t.sep||t.explicitKey)&&this.type!==`seq-item-ind`,i=[];if(r&&t.sep&&!t.value){let n=[];for(let r=0;r<t.sep.length;++r){let i=t.sep[r];switch(i.type){case`newline`:n.push(r);break;case`space`:break;case`comment`:i.indent>e.indent&&(n.length=0);break;default:n.length=0}}n.length>=2&&(i=t.sep.splice(n[1]))}switch(this.type){case`anchor`:case`tag`:r||t.value?(i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`explicit-key-ind`:!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):r||t.value?(i.push(this.sourceToken),e.items.push({start:i,explicitKey:!0})):this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case`map-value-ind`:if(t.explicitKey){if(!t.sep){if(yY(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=CY(t.start);this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:null,sep:[this.sourceToken]}]})}}else if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(yY(t.sep,`map-value-ind`))this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if(xY(t.key)&&!yY(t.sep,`newline`)){let e=CY(t.start),n=t.key,r=t.sep;r.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:n,sep:r}]})}else i.length>0?t.sep=t.sep.concat(i,this.sourceToken):t.sep.push(this.sourceToken)}else t.sep?t.value||r?e.items.push({start:i,key:null,sep:[this.sourceToken]}):yY(t.sep,`map-value-ind`)?this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);r||t.value?(e.items.push({start:i,key:n,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(n):(Object.assign(t,{key:n,sep:[]}),this.onKeyLine=!0);return}default:{let r=this.startBlockValue(e);if(r){if(r.type===`block-seq`){if(!t.explicitKey&&t.sep&&!yY(t.sep,`newline`)){yield*this.pop({type:`error`,offset:this.offset,message:`Unexpected block-seq-ind on same line with key`,source:this.source});return}}else n&&e.items.push({start:i});this.stack.push(r);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){wY(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case`anchor`:case`tag`:if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case`seq-item-ind`:if(this.indent!==e.indent)break;t.value||yY(t.start,`seq-item-ind`)?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let t=this.startBlockValue(e);if(t){this.stack.push(t);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type===`flow-error-end`){let e;do yield*this.pop(),e=this.peek(1);while(e?.type===`flow-collection`)}else if(e.end.length===0){switch(this.type){case`comma`:case`explicit-key-ind`:!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case`map-value-ind`:!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case`space`:case`comment`:case`newline`:case`anchor`:case`tag`:!t||t.value?e.ite Line truncated
`)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
`,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=EY(TY(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=EY(TY(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}};function AY(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new xY||null,prettyErrors:t}}function jY(e,t={}){let{lineCounter:n,prettyErrors:r}=AY(t),i=new kY(n?.addNewLine),a=new sY(t),o=null;for(let t of a.compose(i.parse(e),!0,e.length))if(!o)o=t;else if(o.options.logLevel!==`silent`){o.errors.push(new wJ(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(EJ(e,n)),o.warnings.forEach(EJ(e,n))),o}function MY(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let i=jY(e,n);if(!i)return null;if(i.warnings.forEach(e=>nq(i.options.logLevel,e)),i.errors.length>0){if(i.options.logLevel!==`silent`)throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},n))}function NY(e,t,n){let r=null;if(typeof t==`function`||Array.isArray(t)?r=t:n===void 0&&t&&(n=t),typeof n==`string`&&(n=n.length),typeof n==`number`){let e=Math.round(n);n=e<1?void 0:e>8?{indent:8}:{indent:e}}if(e===void 0){let{keepUndefined:e}=n??t??{};if(!e)return}return ZG(e)&&!r?e.toString(n):new xJ(e,r,n).toString(n)}var PY=e=>typeof e==`object`&&!!e&&!Array.isArray(e),FY=e=>PY(e)?Object.entries(e).map(([e,t])=>[e,Array.isArray(t)?t:[]]):[];function IY(e){if(PY(e)){if(PY(e.parallel))return{kind:`parallel`,base:[`parallel`],branches:FY(e.parallel)};if(PY(e.switch))return{kind:`switch`,base:[`switch`,`cases`],on:typeof e.switch.on==`string`?e.switch.on:``,branches:FY(e.switch.cases)}}}function LY(e){return e.slice(2).includes(`parallel`)}function RY(e,t){let n=jY(e).getIn(t,!0);if(QG(n))return n.toJSON()}function zY(e,t,n){let r=jY(e);return r.setIn(t,r.createNode(ZY(n))),r.toString()}function BY(e,t,n){let r=jY(e),i=t.slice(0,-1),a=LY(i);if(a&&![`agent.run`,`workflow.call`].includes(n))throw Error(`Branches allow only read-only agents and workflow calls.`);let o=r.getIn(i,!0);if(tK(o)||(r.setIn(i,r.createNode([])),o=r.getIn(i,!0)),!tK(o))return{source:e,path:[]};let s=Math.min(Math.max(Number(t.at(-1))+1,0),o.items.length),c=n===`parallel`?{parallel:{"branch-1":[],"branch-2":[]}}:n===`switch`?{switch:{on:``,cases:{true:[],default:[]}}}:{type:n,...a&&n===`agent.run`?{settings:{read_only:!0}}:{}};return o.items.splice(s,0,r.createNode(c)),{source:r.toString(),path:[...i,s]}}function VY(e,t){if(t===`switch`){if(!e||e.includes(`/`))throw Error(`A case is the value it matches, without a slash.`)}else if(!/^[a-z][a-z0-9]*(?:[.-][a-z0-9]+)*$/.test(e))throw Error(`Use a lowercase branch name with letters, digits, dots or dashes.`)}function HY(e,t){let n=e.getIn(t,!0),r=IY(QG(n)?n.toJSON():void 0),i=r?e.getIn([...t,...r.base],!0):void 0;if(!r||!QG(i))throw Error(`This step has no branches.`);return{kind:r.kind,branches:i}}function UY(e,t,n){let r=jY(e),{kind:i,branches:a}=HY(r,t);if(VY(n,i),a.has(n))throw Error(`Branch ${n} already exists.`);return a.set(n,r.createNode([])),r.toString()}function WY(e,t,n,r){let i=jY(e),{kind:a,branches:o}=HY(i,t);if(VY(r,a),n!==r&&o.has(r))throw Error(`Branch ${r} already exists.`);let s=o.items.find(e=>eK(e.key)&&e.key.value===n);if(!s||!eK(s.key))throw Error(`Branch ${n} does not exist.`);return s.key.value=r,i.toString()}function GY(e,t,n){let r=jY(e),{kind:i,branches:a}=HY(r,t);if(i===`parallel`&&a.items.length<=2)throw Error(`Parallel needs at least two branches.`);if(a.items.length<=1)throw Error(`A switch needs at least one case.`);return Line truncated
`).find(e=>e.trim())?.trim()}}function fX(e,t){let n=JSON.stringify(e??{})+` `+(typeof t==`string`?`{{ ${t.replace(/^!/,``)} }}`:``);return[...new Set([...n.matchAll(cX)].map(e=>e[1]))]}function pX(e){let t=jY(e).toJS(),n=lX(t)&&Array.isArray(t.steps)?t.steps:[],r=[],i=[],a=new Map,o=[],s=new Set,c=`start`;r.push({id:c,type:`step`,position:{x:0,y:0},data:{kind:`start`,key:`start`,title:`Starts when`,type:``,detail:``}});let l=[c],u=1,d=new Map,f=e=>{let t=d.get(e)??0;return d.set(e,t+1),t},p=(e,t,n,i,s,c,l,u)=>{let d=lX(e)?e:{},p=IY(d),m=p?.kind??(typeof d.type==`string`?d.type:``),h=lX(d.settings)?d.settings:{},g=typeof d.id==`string`?d.id:``,_=`step-${t}`,v=s?`${s}/${g||m}`:g||m;r.push({id:_,type:`step`,position:{x:n,y:i},data:{kind:`step`,key:g||t,name:g||void 0,title:g||sX(m),type:m,step:l?.length===2?String(Number(l[1])+1).padStart(2,`0`):void 0,detail:p?.on?`on ${p.on.replace(/^steps\./,``)}`:uX(m,h),summary:dX(h),when:typeof d.when==`string`?d.when:void 0,retry:lX(d.retry)&&typeof d.retry.attempts==`number`?d.retry.attempts:void 0,continues:d.on_failure===`continue`,branch:s,lane:u,path:l,stage:v,occurrence:f(v),...c?{resume:c}:{}}}),g&&a.set(g,_);let y=p?.on?`{{ ${p.on} }}`:``;for(let e of fX([d.settings,y],d.when))o.push({from:e,to:_});return _},m=(e,t,n)=>{e.forEach((r,a)=>i.push({id:`flow-${r}-${t}`,source:r,target:t,kind:`flow`,...s.has(r)?{otherwise:!0}:{},insertAfter:a===e.length-1?n:void 0}))};for(let[e,t]of n.entries()){let n=IY(t);if(n){let{kind:i,base:a,branches:o}=n,c=p(t,String(e+1),0,u*iX,void 0,void 0,[`steps`,e]);m(l,c,[`steps`,e-1]),u++;let d=lX(t)&&typeof t.id==`string`?t.id:i,f=i===`switch`&&!o.some(([e])=>e==="default"),h=o.length+ +!!f,g=[],_=Math.max(1,...o.map(([,e])=>e.length)),v=e=>(e-(h-1)/2)*aX,y=(e,t,n)=>r.push({id:e,type:`lane`,position:{x:t-12,y:u*iX-40},style:{width:`264px`,height:`${(_+1)*iX-24}px`},zIndex:-1,data:{kind:`step`,key:n,title:n,type:``,detail:``,lane:i}}),b=(u+_)*iX;if(o.forEach(([t,n],o)=>{let s=v(o),l=[c],f=[`steps`,e,...a,t];n.forEach((n,r)=>{let a=p(n,`${e+1}-${t}-${r+1}`,s,(u+r)*iX,t,d,[...f,r],i);m(l,a,[...f,r-1]),l=[a]});let h=`add-${e}-${t}`;r.push({id:h,type:`add`,position:{x:s+104,y:b},data:{kind:`step`,key:h,title:``,type:``,detail:``,branch:t,lane:i,insertAfter:[...f,n.length-1]}}),m(l,h),g.push(h),y(`lane-${e}-${t}`,s,t)}),f){let t=v(h-1),n=`pass-${e}`;r.push({id:n,type:`add`,position:{x:t+104,y:b},data:{kind:`step`,key:n,title:``,type:``,detail:``,lane:i}}),s.add(c),m([c],n),s.delete(c),g.push(n),y(`pass-lane-${e}`,t,`default`)}l=g,u+=_+1;continue}let i=p(t,String(e+1),0,u*iX,void 0,void 0,[`steps`,e]);m(l,i,[`steps`,e-1]),l=[i],u++}r.push({id:`add-end`,type:`add`,position:{x:104,y:u*iX-24},data:{kind:`step`,key:`add`,title:``,type:``,detail:``,insertAfter:[`steps`,n.length-1]}}),m(l,`add-end`);for(let{from:e,to:t}of o){let n=a.get(e);n&&(i.some(e=>e.kind===`flow`&&e.source===n&&e.target===t)||i.push({id:`data-${n}-${t}`,source:n,target:t,kind:`data`,label:e,offset:24+14*i.filter(e=>e.kind===`data`).length,sourceHandle:`data-out`,targetHandle:`data-in`}))}return{nodes:r,edges:i}}var mX={class:`truncate`},hX=`\0`,gX=N({inheritAttrs:!1,__name:`OptionSelect`,props:{modelValue:{},options:{},placeholder:{},disabled:{type:Boolean},size:{},class:{}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=t;return(t,r)=>(I(),K(B(Tf),{"model-value":e.modelValue===``&&e.options.some(e=>e.value===``)?hX:e.modelValue||void 0,disabled:e.disabled,"onUpdate:modelValue":r[0]||=e=>n(`update:modelValue`,e===hX?``:String(e))},{default:F(()=>[k(B(Mf),W({size:e.size??`sm`,class:t.$props.class},t.$attrs),{default:F(()=>[k(B(Nf),{placeholder:e.placeholder},null,8,[`placeholder`])]),_:1},16,[`size`,`class`]),k(B(Ef),{position:`popper`,class:`max-w-[min(var(--reka-select-content-available-width),20rem)]`},{default:F(()=>[(I(!0),A(H,null,j(e.options,e=>(I(),K(B(kf),{key:e.value,value:e.value===``?hX:e.value,disabled:e.disabled,title:e.label,class:`*:[span]:last:min-w-0`},{default:F(()=>[L(`span`,mX,z(e.label),1)]),_:2},1032,[`value`,`disabled`,`title`]))),128))]),_:1})]),_:1},8,[`model-value`,`disabled`]))}}),_X=[`id`],vX=[`value`],yX=N({__name:`WorkflowPicker`,props:{value:{},workflows:{},label:{},class:{},editable:{type:Boolean}},emits:[`pick`],setup(e,{emit:t}){let n=De(),r=t;return(t,i)=>e.editable?(I(),A(H,{key:0},[k(B(Z),{"model-value":e.value,list:B(n),"aria-label":e.label,class:R(t.$props.class),placeholder:`Workflow id or {{ reference }}`,"onUpdate:modelValue":i[0]||=e=>r(`pick`,String(e))},null,8,[`model-value`,`list`,`aria-label`,`class`]),L(`datalist`,{id:B(n)},[(I(!0),A(H,null,j(e.workflows,e=>(I(),A(`option`,{key:e.id,value:e.id},null,8,vX))),128))],8,_X)],64)):(I(),K(B(Tf),{key:1,"model-value":e.value||void 0,"onUpdate:modelValue":i[1]||=e=>r(`pick`,String(e))},{default:F(()=>[k(B(Mf),{"aria-label":e.label,class:R(t.$props.class)},{default:F(()=>[k(B(Nf),{placeholder:`Choose workflow`})]),_:1},8,[`aria-label`,`class`]),k(B(Ef),null,{default:F(()=>[e.value& Line truncated
`).map((e,t)=>({number:t+1,text:e,tokens:NX(e)}))}var jX=/^(\s*)(-\s+)?/,MX=/^([^:#\s][^:#]*?)(:)(\s*)(.*)$/;function NX(e){let{code:t,comment:n}=PX(e),r=FX(t);return n&&r.push({text:n,kind:`comment`}),r}function PX(e){let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(t)r===t&&(t=``);else if(r===`"`||r===`'`)t=r;else if(r===`#`&&(n===0||/\s/.test(e[n-1]??``)))return{code:e.slice(0,n),comment:e.slice(n)}}return{code:e,comment:``}}function FX(e){if(!e)return[];let t=[],n=jX.exec(e);n?.[1]&&t.push({text:n[1],kind:`plain`}),n?.[2]&&t.push({text:n[2],kind:`punct`});let r=e.slice(n?.[0].length??0);if(!r)return t;let i=MX.exec(r);return i?(t.push({text:i[1]??``,kind:`key`}),t.push({text:i[2]??`:`,kind:`punct`}),i[3]&&t.push({text:i[3],kind:`plain`}),[...t,...IX(i[4]??``)]):[...t,...IX(r)]}function IX(e){if(!e)return[];let t=/^("[^"]*"?|'[^']*'?)([\s\S]*)$/.exec(e);if(!t)return[{text:e,kind:`plain`}];let n=[{text:t[1]??``,kind:`string`}];return t[2]&&n.push({text:t[2],kind:`plain`}),n}function LX(e){return e.split(`
`)[0]?.trim()||`invalid YAML`}function RX(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function zX(e){return typeof e==`string`&&e.trim()!==``}var BX={class:`space-y-4 px-3 py-3`},VX={key:0,class:`rounded-md bg-danger/10 px-2.5 py-1.5 text-xs text-danger`,role:`alert`},HX={key:1,class:`space-y-3`},UX={key:0,class:`block space-y-1.5`},WX=[`id`],GX=[`value`],KX={class:`text-xs font-medium text-fg-muted`},qX={class:`flex items-center gap-2`},JX={key:1,role:`alert`,class:`text-xs text-danger`},YX={key:2,class:`space-y-1.5`},XX=[`title`],ZX={key:4,class:`flex flex-wrap items-center gap-1 pt-0.5`},QX={key:0,class:`divide-y divide-border rounded-md border border-border`},$X=[`title`],eZ={key:0,class:`space-y-3`},tZ={class:`text-[13px]`},nZ={key:0,class:`text-danger`},rZ={class:`ml-2 text-xs text-fg-subtle`},iZ={key:1,class:`space-y-3`},aZ={class:`text-[13px]`},oZ={class:`ml-2 text-xs text-fg-subtle`},sZ=[`title`],cZ={key:0,class:`text-xs text-danger`},lZ={class:`space-y-1.5`},uZ={key:0,role:`alert`,class:`text-xs text-danger`},dZ={class:`divide-y divide-border rounded-md border border-border`},fZ={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},pZ={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},mZ={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},hZ={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},gZ=[`for`],_Z=N({__name:`StepEditor`,props:{yaml:{},path:{},vocabulary:{},workflows:{},modelAliases:{}},emits:[`update:yaml`],setup(e,{emit:t}){let n=De(),r=e,i=t,a=J(()=>RY(r.yaml,r.path)??{}),o=J(()=>IY(a.value)),s=J(()=>o.value?.kind??(typeof a.value.type==`string`?a.value.type:``)),c=J(()=>o.value?.branches.map(([e])=>e)??[]),l=J(()=>s.value===`parallel`?2:1);function u(e){i(`update:yaml`,zY(r.yaml,r.path,{...a.value,switch:{...a.value.switch,on:e}}))}let d=q(``),f=q(``);function p(e,t,n=``){try{let a=e===`add`?UY(r.yaml,r.path,t):e===`rename`?WY(r.yaml,r.path,t,n):GY(r.yaml,r.path,t);i(`update:yaml`,a),d.value=``,f.value=``}catch(e){f.value=String(e.message)}}let m=J(()=>r.vocabulary.find(e=>e.name===s.value)),h=J(()=>typeof a.value.settings==`object`&&a.value.settings!==null?a.value.settings:{}),g=J(()=>XY(r.yaml,r.path)),_=J(()=>EX(a.value)),v=J(()=>m.value?.settings&&a.value.settings?OX(a.value.settings,m.value.settings,`settings`):``),y=[`mission`,`workflow`,`message`,`body`,`plan`,`then`,`status`,`detail`,`run`,`rules`],b=/mission|body|detail|plan|rules/;function x(e,t){return[`workflow.call`,`workflow.handoff`].includes(s.value)&&e===`workflow`||s.value===`human.approve`&&e===`then`?`workflow`:s.value===`agent.run`&&e===`model`?`select`:t.type===`string`?t.enum?`select`:b.test(e)?`text`:`line`:t.type===`boolean`?`boolean`:t.type===`integer`||t.type===`number`?`number`:t.type===`array`&&t.items?.type===`string`?`lines`:`yaml`}let S=J(()=>{let e=Object.entries(m.value?.settings?.properties??{}).filter(([e])=>s.value!==`workflow.call`||![`inputs`,`outputs`].includes(e)).map(([e,t])=>({key:e,schema:t,kind:x(e,t),options:s.value===`agent.run`&&e===`model`?r.modelAliases:t.enum??[]})),t=e.filter(e=>y.includes(e.key)&&e.kind!==`boolean`).sort((e,t)=>y.indexOf(e.key)-y.indexOf(t.key))[0],n=e.filter(e=>e!==t);return{lead:t,compact:n.filter(e=>[`workflow`,`select`,`line`,`number`,`boolean`].includes(e.kind)),long:n.filter(e=>[`text`,`lines`,`yaml`].includes(e.kind))}}),C=q(!S.value.lead&&!o.value),w=e=>[{value:``,label:`Default`},...e.map(e=>({value:e,label:e}))];function T(e){let{id:t,type:n,...a}=e;i(`update:yaml`,zY(r.yaml,r.path,{id:t,type:n,...a}))}function ee(e,t){T({...a.value,[e]:t})}function E(e){let t={...a.value.retry,...e};ee(`retry`,t.attempts===void 0&&!t.backoff?void 0:{...t,attempts:t.attempts??1})}function D(e,t){let n={...h.value,[e]:t};s.value===`workflow.call`&&e===`wait`&&t!==!0&&delete n.outputs,T({...a.value,settings:n})}function te(e,t){let n={...h.value,[e]:t};s.value===`workflow.call`&&t!==h.value[e]&&(delete n.inputs,delete n.outputs),T({...a.value,settings:n})}let ne=J(()=>r.workflows.find(e=>e.id===h.value.workflow)),re=J(()=>Object.entries(QY(ne.value?.yaml??``,`inputs`)??{})),ie=J(()=>Object.entries(QY(ne.value?.yaml??``,`outputs`)??{})),oe=J(()=>Object.entries(QY(r.yaml,`inputs`)??{})),se=J(()=>Object.entries(QY(r.yaml,`outputs`)??{})),ce=J(()=>h.value.inputs??{}),le=J(()=>h.value.outputs??{}),ue=e=>typeof e==`string`&&e.startsWith(`inputs.`),O=e=>[`object`,`array`].includes(e.type??``),de=e=>ce.value[e]===void 0?``:String(ce.value[e]);function fe(e,t,n){D(`inputs`,{...ce.value,[e]:t===``?void 0:ue(t)?t:ub(t,n??`string`)})}let pe=(e,t,n)=>e.filter(([,e])=>e.type===t.type||e.type===`any`||t.type===`any`).map(([e])=>({value:`${n}.${e}`,label:e})),me=q(null);function he(e){let t=me.value??S.value.lead?.key;if(!t)return;let n=typeof h.value[t]==`string`?h.value[t]:``,r=`{{ steps.${e}.summary }}`;D(t,n?`${n.trimEnd()} ${r}`:r)}let ge=q({});function _e(e,t){try{D(e,t.trim()?MY(t):void 0),ge.value={...ge.value,[e]:``}}catch(t){ge.value={...ge.value,[e]:String(t.m Line truncated
`)[0]}}}let ve=e=>e===void 0?``:NY(e).trimEnd(),ye=(e,t)=>t.title??e.replaceAll(`_`,` `).replace(/^./,e=>e.toUpperCase()),be=e=>typeof h.value[e]==`string`?h.value[e]:``,xe=[{value:``,label:`Park the task`},{value:`continue`,label:`Continue`}];return(t,r)=>(I(),A(`div`,BX,[v.value?(I(),A(`p`,VX,z(v.value),1)):P(``,!0),o.value?(I(),A(`section`,HX,[s.value===`switch`?(I(),A(`label`,UX,[r[15]||=L(`span`,{class:`text-xs font-medium text-fg-muted`,title:`The value whose case runs; a case named default runs when none matches`},`Switch on`,-1),k(B(Z),{"model-value":o.value.on,class:`font-mono`,placeholder:`steps.assess.result.fit`,list:`${B(n)}-switch-on`,onChange:r[0]||=e=>u(e.target.value.trim())},null,8,[`model-value`,`list`]),L(`datalist`,{id:`${B(n)}-switch-on`},[(I(!0),A(H,null,j(g.value,e=>(I(),A(`option`,{key:e,value:`steps.${e}.result.`},null,8,GX))),128))],8,WX)])):P(``,!0),L(`div`,KX,z(s.value===`switch`?`Cases`:`Branches`),1),(I(!0),A(H,null,j(c.value,e=>(I(),A(`div`,{key:e,class:`flex items-center gap-2`},[k(B(Z),{"model-value":e,class:R(s.value===`switch`&&`font-mono`),"aria-label":`${s.value===`switch`?`Case`:`Branch`} ${e}`,onChange:t=>p(`rename`,e,t.target.value.trim())},null,8,[`model-value`,`class`,`aria-label`,`onChange`]),k(B(Y),{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Remove ${e}`,disabled:c.value.length<=l.value,onClick:t=>p(`delete`,e)},{default:F(()=>[k(B(fd))]),_:1},8,[`aria-label`,`disabled`,`onClick`])]))),128)),L(`div`,qX,[k(B(Z),{modelValue:d.value,"onUpdate:modelValue":r[1]||=e=>d.value=e,"aria-label":s.value===`switch`?`New case value`:`New branch name`,placeholder:s.value===`switch`?`Value, or default`:`Branch name`,onKeydown:r[2]||=_t(pt(e=>p(`add`,d.value.trim()),[`prevent`]),[`enter`])},null,8,[`modelValue`,`aria-label`,`placeholder`]),k(B(Y),{type:`button`,size:`icon-sm`,variant:`outline`,"aria-label":s.value===`switch`?`Add case`:`Add branch`,disabled:!d.value.trim(),onClick:r[3]||=e=>p(`add`,d.value.trim())},{default:F(()=>[k(B(qu))]),_:1},8,[`aria-label`,`disabled`])]),f.value?(I(),A(`p`,JX,z(f.value),1)):P(``,!0)])):P(``,!0),S.value.lead?(I(),A(`section`,YX,[L(`div`,{class:`flex items-center gap-1 text-xs font-medium text-fg-muted`,title:S.value.lead.schema.description},[V(z(ye(S.value.lead.key,S.value.lead.schema))+` `,1),S.value.lead.schema.description?(I(),K(B(vu),{key:0,class:`size-3 text-fg-subtle`})):P(``,!0)],8,XX),S.value.lead.kind===`workflow`?(I(),K(yX,{key:0,editable:s.value!==`workflow.call`,value:be(S.value.lead.key),workflows:e.workflows,label:ye(S.value.lead.key,S.value.lead.schema),onPick:r[4]||=e=>te(S.value.lead.key,e)},null,8,[`editable`,`value`,`workflows`,`label`])):S.value.lead.kind===`select`?(I(),K(gX,{key:1,class:`w-full`,"model-value":be(S.value.lead.key),options:w(S.value.lead.options),"aria-label":ye(S.value.lead.key,S.value.lead.schema),"onUpdate:modelValue":r[5]||=e=>D(S.value.lead.key,e||void 0)},null,8,[`model-value`,`options`,`aria-label`])):S.value.lead.kind===`text`?(I(),K(B(Yf),{key:2,"model-value":be(S.value.lead.key),class:`min-h-32 text-[13px] leading-relaxed`,onFocus:r[6]||=e=>me.value=S.value.lead.key,"onUpdate:modelValue":r[7]||=e=>D(S.value.lead.key,String(e))},null,8,[`model-value`])):(I(),K(B(Z),{key:3,"model-value":be(S.value.lead.key),onFocus:r[8]||=e=>me.value=S.value.lead.key,"onUpdate:modelValue":r[9]||=e=>D(S.value.lead.key,String(e))},null,8,[`model-value`])),g.value.length&&S.value.lead.kind!==`select`?(I(),A(`div`,ZX,[r[16]||=L(`span`,{class:`text-[11px] text-fg-subtle`},`Insert`,-1),(I(!0),A(H,null,j(g.value,e=>(I(),K(B(Y),{key:e,type:`button`,variant:`outline`,size:`xs`,class:`font-mono`,title:`{{ steps.${e}.summary }}`,onClick:t=>he(e)},{default:F(()=>[V(z(e),1)]),_:2},1032,[`title`,`onClick`]))),128))])):P(``,!0)])):P(``,!0),k(B(Y),{type:`button`,variant:`ghost`,size:`xs`,class:`-ml-2 text-fg-muted aria-expanded:bg-transparent`,"aria-expanded":C.value,onClick:r[10]||=e=>C.value=!C.value},{default:F(()=>[k(B(ae),{"data-icon":`inline-start`,class:R([`transition-transform`,!C.value&&`-rotate-90`])},null,8,[`class`]),r[17]||=V(`More `,-1)]),_:1},8,[`aria-expanded`]),C.value?(I(),A(H,{key:3},[S.value.compact.length?(I(),A(`section`,QX,[(I(!0),A(H,null,j(S.value.compact,t=>(I(),A(`div`,{key:t.key,class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},[L(`span`,{class:`flex flex-1 items-center gap-1 text-[13px]`,title:t.schema.description},[V(z(ye(t.key,t.schema))+` `,1),t.schema.description?(I(),K(B(vu),{key:0,class:`size-3 text-fg-subtle`})):P(``,!0)],8,$X),t.kind===`workflow`?(I(),K(yX,{key:0,editable:s.value!==`workflow.call`,class:`max-w-48`,value:be(t.key),workflows:e.workflows,label:ye(t.key,t.schema),onPick:e=>te(t.key,e)},null,8,[`editable`,`value`,`workflows`,`label`,`onPick`])):t.kind===`boolean`?(I(),K(B(o_),{key:1,"model-value":h.value[t.key]===!0,"onUpdate:modelValue":e=>D(t.key,e||void 0)},null,8,[`model-value`,`onUpdate:modelValue`])):t.kind===`select`?(I(),K(gX,{key:2,class:`w-40`,"model- Line truncated
`,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=CY(SY(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=CY(SY(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}};function DY(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new vY||null,prettyErrors:t}}function OY(e,t={}){let{lineCounter:n,prettyErrors:r}=DY(t),i=new EY(n?.addNewLine),a=new iY(t),o=null;for(let t of a.compose(i.parse(e),!0,e.length))if(!o)o=t;else if(o.options.logLevel!==`silent`){o.errors.push(new xJ(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(CJ(e,n)),o.warnings.forEach(CJ(e,n))),o}function kY(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let i=OY(e,n);if(!i)return null;if(i.warnings.forEach(e=>$K(i.options.logLevel,e)),i.errors.length>0){if(i.options.logLevel!==`silent`)throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},n))}function AY(e,t,n){let r=null;if(typeof t==`function`||Array.isArray(t)?r=t:n===void 0&&t&&(n=t),typeof n==`string`&&(n=n.length),typeof n==`number`){let e=Math.round(n);n=e<1?void 0:e>8?{indent:8}:{indent:e}}if(e===void 0){let{keepUndefined:e}=n??t??{};if(!e)return}return JG(e)&&!r?e.toString(n):new vJ(e,r,n).toString(n)}var jY=e=>typeof e==`object`&&!!e&&!Array.isArray(e),MY=e=>jY(e)?Object.entries(e).map(([e,t])=>[e,Array.isArray(t)?t:[]]):[];function NY(e){if(jY(e)){if(jY(e.parallel))return{kind:`parallel`,base:[`parallel`],branches:MY(e.parallel)};if(jY(e.switch))return{kind:`switch`,base:[`switch`,`cases`],on:typeof e.switch.on==`string`?e.switch.on:``,branches:MY(e.switch.cases)}}}function PY(e){return e.slice(2).includes(`parallel`)}function FY(e,t){let n=OY(e).getIn(t,!0);if(YG(n))return n.toJSON()}function IY(e,t,n){let r=OY(e);return r.setIn(t,r.createNode(JY(n))),r.toString()}function LY(e,t,n){let r=OY(e),i=t.slice(0,-1),a=PY(i);if(a&&![`agent.run`,`workflow.call`].includes(n))throw Error(`Branches allow only read-only agents and workflow calls.`);let o=r.getIn(i,!0);if(QG(o)||(r.setIn(i,r.createNode([])),o=r.getIn(i,!0)),!QG(o))return{source:e,path:[]};let s=Math.min(Math.max(Number(t.at(-1))+1,0),o.items.length),c=n===`parallel`?{parallel:{"branch-1":[],"branch-2":[]}}:n===`switch`?{switch:{on:``,cases:{true:[],default:[]}}}:{type:n,...a&&n===`agent.run`?{settings:{read_only:!0}}:{}};return o.items.splice(s,0,r.createNode(c)),{source:r.toString(),path:[...i,s]}}function RY(e,t){if(t===`switch`){if(!e||e.includes(`/`))throw Error(`A case is the value it matches, without a slash.`)}else if(!/^[a-z][a-z0-9]*(?:[.-][a-z0-9]+)*$/.test(e))throw Error(`Use a lowercase branch name with letters, digits, dots or dashes.`)}function zY(e,t){let n=e.getIn(t,!0),r=NY(YG(n)?n.toJSON():void 0),i=r?e.getIn([...t,...r.base],!0):void 0;if(!r||!YG(i))throw Error(`This step has no branches.`);return{kind:r.kind,branches:i}}function BY(e,t,n){let r=OY(e),{kind:i,branches:a}=zY(r,t);if(RY(n,i),a.has(n))throw Error(`Branch ${n} already exists.`);return a.set(n,r.createNode([])),r.toString()}function VY(e,t,n,r){let i=OY(e),{kind:a,branches:o}=zY(i,t);if(RY(r,a),n!==r&&o.has(r))throw Error(`Branch ${r} already exists.`);let s=o.items.find(e=>ZG(e.key)&&e.key.value===n);if(!s||!ZG(s.key))throw Error(`Branch ${n} does not exist.`);return s.key.value=r,i.toString()}function HY(e,t,n){let r=OY(e),{kind:i,branches:a}=zY(r,t);if(i===`parallel`&&a.items.length<=2)throw Error(`Parallel needs at least two branches.`);if(a.items.length<=1)throw Error(`A switch needs at least one case.`);return Line truncated
`).find(e=>e.trim())?.trim()}}function lX(e,t){let n=JSON.stringify(e??{})+` `+(typeof t==`string`?`{{ ${t.replace(/^!/,``)} }}`:``);return[...new Set([...n.matchAll(aX)].map(e=>e[1]))]}function uX(e){let t=OY(e).toJS(),n=oX(t)&&Array.isArray(t.steps)?t.steps:[],r=[],i=[],a=new Map,o=[],s=new Set,c=`start`;r.push({id:c,type:`step`,position:{x:0,y:0},data:{kind:`start`,key:`start`,title:`Starts when`,type:``,detail:``}});let l=[c],u=1,d=new Map,f=e=>{let t=d.get(e)??0;return d.set(e,t+1),t},p=(e,t,n,i,s,c,l,u)=>{let d=oX(e)?e:{},p=NY(d),m=p?.kind??(typeof d.type==`string`?d.type:``),h=oX(d.settings)?d.settings:{},g=typeof d.id==`string`?d.id:``,_=`step-${t}`,v=s?`${s}/${g||m}`:g||m;r.push({id:_,type:`step`,position:{x:n,y:i},data:{kind:`step`,key:g||t,name:g||void 0,title:g||iX(m),type:m,step:l?.length===2?String(Number(l[1])+1).padStart(2,`0`):void 0,detail:p?.on?`on ${p.on.replace(/^steps\./,``)}`:sX(m,h),summary:cX(h),when:typeof d.when==`string`?d.when:void 0,retry:oX(d.retry)&&typeof d.retry.attempts==`number`?d.retry.attempts:void 0,continues:d.on_failure===`continue`,branch:s,lane:u,path:l,stage:v,occurrence:f(v),...c?{resume:c}:{}}}),g&&a.set(g,_);let y=p?.on?`{{ ${p.on} }}`:``;for(let e of lX([d.settings,y],d.when))o.push({from:e,to:_});return _},m=(e,t,n)=>{e.forEach((r,a)=>i.push({id:`flow-${r}-${t}`,source:r,target:t,kind:`flow`,...s.has(r)?{otherwise:!0}:{},insertAfter:a===e.length-1?n:void 0}))};for(let[e,t]of n.entries()){let n=NY(t);if(n){let{kind:i,base:a,branches:o}=n,c=p(t,String(e+1),0,u*tX,void 0,void 0,[`steps`,e]);m(l,c,[`steps`,e-1]),u++;let d=oX(t)&&typeof t.id==`string`?t.id:i,f=i===`switch`&&!o.some(([e])=>e==="default"),h=o.length+ +!!f,g=[],_=Math.max(1,...o.map(([,e])=>e.length)),v=e=>(e-(h-1)/2)*nX,y=(e,t,n)=>r.push({id:e,type:`lane`,position:{x:t-12,y:u*tX-40},style:{width:`264px`,height:`${(_+1)*tX-24}px`},zIndex:-1,data:{kind:`step`,key:n,title:n,type:``,detail:``,lane:i}}),b=(u+_)*tX;if(o.forEach(([t,n],o)=>{let s=v(o),l=[c],f=[`steps`,e,...a,t];n.forEach((n,r)=>{let a=p(n,`${e+1}-${t}-${r+1}`,s,(u+r)*tX,t,d,[...f,r],i);m(l,a,[...f,r-1]),l=[a]});let h=`add-${e}-${t}`;r.push({id:h,type:`add`,position:{x:s+104,y:b},data:{kind:`step`,key:h,title:``,type:``,detail:``,branch:t,lane:i,insertAfter:[...f,n.length-1]}}),m(l,h),g.push(h),y(`lane-${e}-${t}`,s,t)}),f){let t=v(h-1),n=`pass-${e}`;r.push({id:n,type:`add`,position:{x:t+104,y:b},data:{kind:`step`,key:n,title:``,type:``,detail:``,lane:i}}),s.add(c),m([c],n),s.delete(c),g.push(n),y(`pass-lane-${e}`,t,`default`)}l=g,u+=_+1;continue}let i=p(t,String(e+1),0,u*tX,void 0,void 0,[`steps`,e]);m(l,i,[`steps`,e-1]),l=[i],u++}r.push({id:`add-end`,type:`add`,position:{x:104,y:u*tX-24},data:{kind:`step`,key:`add`,title:``,type:``,detail:``,insertAfter:[`steps`,n.length-1]}}),m(l,`add-end`);for(let{from:e,to:t}of o){let n=a.get(e);n&&(i.some(e=>e.kind===`flow`&&e.source===n&&e.target===t)||i.push({id:`data-${n}-${t}`,source:n,target:t,kind:`data`,label:e,offset:24+14*i.filter(e=>e.kind===`data`).length,sourceHandle:`data-out`,targetHandle:`data-in`}))}return{nodes:r,edges:i}}var dX={class:`truncate`},fX=`\0`,pX=N({inheritAttrs:!1,__name:`OptionSelect`,props:{modelValue:{},options:{},placeholder:{},disabled:{type:Boolean},size:{},class:{}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=t;return(t,r)=>(I(),K(B(wf),{"model-value":e.modelValue===``&&e.options.some(e=>e.value===``)?fX:e.modelValue||void 0,disabled:e.disabled,"onUpdate:modelValue":r[0]||=e=>n(`update:modelValue`,e===fX?``:String(e))},{default:F(()=>[k(B(jf),W({size:e.size??`sm`,class:t.$props.class},t.$attrs),{default:F(()=>[k(B(Mf),{placeholder:e.placeholder},null,8,[`placeholder`])]),_:1},16,[`size`,`class`]),k(B(Tf),{position:`popper`,class:`max-w-[min(var(--reka-select-content-available-width),20rem)]`},{default:F(()=>[(I(!0),A(H,null,j(e.options,e=>(I(),K(B(Of),{key:e.value,value:e.value===``?fX:e.value,disabled:e.disabled,title:e.label,class:`*:[span]:last:min-w-0`},{default:F(()=>[L(`span`,dX,z(e.label),1)]),_:2},1032,[`value`,`disabled`,`title`]))),128))]),_:1})]),_:1},8,[`model-value`,`disabled`]))}}),mX=[`id`],hX=[`value`],gX=N({__name:`WorkflowPicker`,props:{value:{},workflows:{},label:{},class:{},editable:{type:Boolean}},emits:[`pick`],setup(e,{emit:t}){let n=De(),r=t;return(t,i)=>e.editable?(I(),A(H,{key:0},[k(B(Z),{"model-value":e.value,list:B(n),"aria-label":e.label,class:R(t.$props.class),placeholder:`Workflow id or {{ reference }}`,"onUpdate:modelValue":i[0]||=e=>r(`pick`,String(e))},null,8,[`model-value`,`list`,`aria-label`,`class`]),L(`datalist`,{id:B(n)},[(I(!0),A(H,null,j(e.workflows,e=>(I(),A(`option`,{key:e.id,value:e.id},null,8,hX))),128))],8,mX)],64)):(I(),K(B(wf),{key:1,"model-value":e.value||void 0,"onUpdate:modelValue":i[1]||=e=>r(`pick`,String(e))},{default:F(()=>[k(B(jf),{"aria-label":e.label,class:R(t.$props.class)},{default:F(()=>[k(B(Mf),{placeholder:`Choose workflow`})]),_:1},8,[`aria-label`,`class`]),k(B(Tf),null,{default:F(()=>[e.value& Line truncated
`).map((e,t)=>({number:t+1,text:e,tokens:AX(e)}))}var OX=/^(\s*)(-\s+)?/,kX=/^([^:#\s][^:#]*?)(:)(\s*)(.*)$/;function AX(e){let{code:t,comment:n}=jX(e),r=MX(t);return n&&r.push({text:n,kind:`comment`}),r}function jX(e){let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(t)r===t&&(t=``);else if(r===`"`||r===`'`)t=r;else if(r===`#`&&(n===0||/\s/.test(e[n-1]??``)))return{code:e.slice(0,n),comment:e.slice(n)}}return{code:e,comment:``}}function MX(e){if(!e)return[];let t=[],n=OX.exec(e);n?.[1]&&t.push({text:n[1],kind:`plain`}),n?.[2]&&t.push({text:n[2],kind:`punct`});let r=e.slice(n?.[0].length??0);if(!r)return t;let i=kX.exec(r);return i?(t.push({text:i[1]??``,kind:`key`}),t.push({text:i[2]??`:`,kind:`punct`}),i[3]&&t.push({text:i[3],kind:`plain`}),[...t,...NX(i[4]??``)]):[...t,...NX(r)]}function NX(e){if(!e)return[];let t=/^("[^"]*"?|'[^']*'?)([\s\S]*)$/.exec(e);if(!t)return[{text:e,kind:`plain`}];let n=[{text:t[1]??``,kind:`string`}];return t[2]&&n.push({text:t[2],kind:`plain`}),n}function PX(e){return e.split(`
`)[0]?.trim()||`invalid YAML`}function FX(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function IX(e){return typeof e==`string`&&e.trim()!==``}var LX={class:`space-y-4 px-3 py-3`},RX={key:0,class:`rounded-md bg-danger/10 px-2.5 py-1.5 text-xs text-danger`,role:`alert`},zX={key:1,class:`space-y-3`},BX={key:0,class:`block space-y-1.5`},VX=[`id`],HX=[`value`],UX={class:`text-xs font-medium text-fg-muted`},WX={class:`flex items-center gap-2`},GX={key:1,role:`alert`,class:`text-xs text-danger`},KX={key:2,class:`space-y-1.5`},qX=[`title`],JX={key:4,class:`flex flex-wrap items-center gap-1 pt-0.5`},YX={key:0,class:`divide-y divide-border rounded-md border border-border`},XX=[`title`],ZX={key:0,class:`space-y-3`},QX={class:`text-[13px]`},$X={key:0,class:`text-danger`},eZ={class:`ml-2 text-xs text-fg-subtle`},tZ={key:1,class:`space-y-3`},nZ={class:`text-[13px]`},rZ={class:`ml-2 text-xs text-fg-subtle`},iZ=[`title`],aZ={key:0,class:`text-xs text-danger`},oZ={class:`space-y-1.5`},sZ={key:0,role:`alert`,class:`text-xs text-danger`},cZ={class:`divide-y divide-border rounded-md border border-border`},lZ={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},uZ={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},dZ={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},fZ={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},pZ=[`for`],mZ=N({__name:`StepEditor`,props:{yaml:{},path:{},vocabulary:{},workflows:{},modelAliases:{}},emits:[`update:yaml`],setup(e,{emit:t}){let n=De(),r=e,i=t,a=J(()=>FY(r.yaml,r.path)??{}),o=J(()=>NY(a.value)),s=J(()=>o.value?.kind??(typeof a.value.type==`string`?a.value.type:``)),c=J(()=>o.value?.branches.map(([e])=>e)??[]),l=J(()=>s.value===`parallel`?2:1);function u(e){i(`update:yaml`,IY(r.yaml,r.path,{...a.value,switch:{...a.value.switch,on:e}}))}let d=q(``),f=q(``);function p(e,t,n=``){try{let a=e===`add`?BY(r.yaml,r.path,t):e===`rename`?VY(r.yaml,r.path,t,n):HY(r.yaml,r.path,t);i(`update:yaml`,a),d.value=``,f.value=``}catch(e){f.value=String(e.message)}}let m=J(()=>r.vocabulary.find(e=>e.name===s.value)),h=J(()=>typeof a.value.settings==`object`&&a.value.settings!==null?a.value.settings:{}),g=J(()=>qY(r.yaml,r.path)),_=J(()=>CX(a.value)),v=J(()=>m.value?.settings&&a.value.settings?TX(a.value.settings,m.value.settings,`settings`):``),y=[`mission`,`workflow`,`message`,`body`,`plan`,`then`,`status`,`detail`,`run`,`rules`],b=/mission|body|detail|plan|rules/;function x(e,t){return[`workflow.call`,`workflow.handoff`].includes(s.value)&&e===`workflow`||s.value===`human.approve`&&e===`then`?`workflow`:s.value===`agent.run`&&e===`model`?`select`:t.type===`string`?t.enum?`select`:b.test(e)?`text`:`line`:t.type===`boolean`?`boolean`:t.type===`integer`||t.type===`number`?`number`:t.type===`array`&&t.items?.type===`string`?`lines`:`yaml`}let S=J(()=>{let e=Object.entries(m.value?.settings?.properties??{}).filter(([e])=>s.value!==`workflow.call`||![`inputs`,`outputs`].includes(e)).map(([e,t])=>({key:e,schema:t,kind:x(e,t),options:s.value===`agent.run`&&e===`model`?r.modelAliases:t.enum??[]})),t=e.filter(e=>y.includes(e.key)&&e.kind!==`boolean`).sort((e,t)=>y.indexOf(e.key)-y.indexOf(t.key))[0],n=e.filter(e=>e!==t);return{lead:t,compact:n.filter(e=>[`workflow`,`select`,`line`,`number`,`boolean`].includes(e.kind)),long:n.filter(e=>[`text`,`lines`,`yaml`].includes(e.kind))}}),C=q(!S.value.lead&&!o.value),w=e=>[{value:``,label:`Default`},...e.map(e=>({value:e,label:e}))];function T(e){let{id:t,type:n,...a}=e;i(`update:yaml`,IY(r.yaml,r.path,{id:t,type:n,...a}))}function ee(e,t){T({...a.value,[e]:t})}function E(e){let t={...a.value.retry,...e};ee(`retry`,t.attempts===void 0&&!t.backoff?void 0:{...t,attempts:t.attempts??1})}function D(e,t){let n={...h.value,[e]:t};s.value===`workflow.call`&&e===`wait`&&t!==!0&&delete n.outputs,T({...a.value,settings:n})}function te(e,t){let n={...h.value,[e]:t};s.value===`workflow.call`&&t!==h.value[e]&&(delete n.inputs,delete n.outputs),T({...a.value,settings:n})}let ne=J(()=>r.workflows.find(e=>e.id===h.value.workflow)),re=J(()=>Object.entries(YY(ne.value?.yaml??``,`inputs`)??{})),ie=J(()=>Object.entries(YY(ne.value?.yaml??``,`outputs`)??{})),oe=J(()=>Object.entries(YY(r.yaml,`inputs`)??{})),se=J(()=>Object.entries(YY(r.yaml,`outputs`)??{})),ce=J(()=>h.value.inputs??{}),le=J(()=>h.value.outputs??{}),ue=e=>typeof e==`string`&&e.startsWith(`inputs.`),O=e=>[`object`,`array`].includes(e.type??``),de=e=>ce.value[e]===void 0?``:String(ce.value[e]);function fe(e,t,n){D(`inputs`,{...ce.value,[e]:t===``?void 0:ue(t)?t:ub(t,n??`string`)})}let pe=(e,t,n)=>e.filter(([,e])=>e.type===t.type||e.type===`any`||t.type===`any`).map(([e])=>({value:`${n}.${e}`,label:e})),me=q(null);function he(e){let t=me.value??S.value.lead?.key;if(!t)return;let n=typeof h.value[t]==`string`?h.value[t]:``,r=`{{ steps.${e}.summary }}`;D(t,n?`${n.trimEnd()} ${r}`:r)}let ge=q({});function _e(e,t){try{D(e,t.trim()?kY(t):void 0),ge.value={...ge.value,[e]:``}}catch(t){ge.value={...ge.value,[e]:String(t.m Line truncated
`)[0]}}}let ve=e=>e===void 0?``:AY(e).trimEnd(),ye=(e,t)=>t.title??e.replaceAll(`_`,` `).replace(/^./,e=>e.toUpperCase()),be=e=>typeof h.value[e]==`string`?h.value[e]:``,xe=[{value:``,label:`Park the task`},{value:`continue`,label:`Continue`}];return(t,r)=>(I(),A(`div`,LX,[v.value?(I(),A(`p`,RX,z(v.value),1)):P(``,!0),o.value?(I(),A(`section`,zX,[s.value===`switch`?(I(),A(`label`,BX,[r[15]||=L(`span`,{class:`text-xs font-medium text-fg-muted`,title:`The value whose case runs; a case named default runs when none matches`},`Switch on`,-1),k(B(Z),{"model-value":o.value.on,class:`font-mono`,placeholder:`steps.assess.result.fit`,list:`${B(n)}-switch-on`,onChange:r[0]||=e=>u(e.target.value.trim())},null,8,[`model-value`,`list`]),L(`datalist`,{id:`${B(n)}-switch-on`},[(I(!0),A(H,null,j(g.value,e=>(I(),A(`option`,{key:e,value:`steps.${e}.result.`},null,8,HX))),128))],8,VX)])):P(``,!0),L(`div`,UX,z(s.value===`switch`?`Cases`:`Branches`),1),(I(!0),A(H,null,j(c.value,e=>(I(),A(`div`,{key:e,class:`flex items-center gap-2`},[k(B(Z),{"model-value":e,class:R(s.value===`switch`&&`font-mono`),"aria-label":`${s.value===`switch`?`Case`:`Branch`} ${e}`,onChange:t=>p(`rename`,e,t.target.value.trim())},null,8,[`model-value`,`class`,`aria-label`,`onChange`]),k(B(Y),{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Remove ${e}`,disabled:c.value.length<=l.value,onClick:t=>p(`delete`,e)},{default:F(()=>[k(B(dd))]),_:1},8,[`aria-label`,`disabled`,`onClick`])]))),128)),L(`div`,WX,[k(B(Z),{modelValue:d.value,"onUpdate:modelValue":r[1]||=e=>d.value=e,"aria-label":s.value===`switch`?`New case value`:`New branch name`,placeholder:s.value===`switch`?`Value, or default`:`Branch name`,onKeydown:r[2]||=_t(pt(e=>p(`add`,d.value.trim()),[`prevent`]),[`enter`])},null,8,[`modelValue`,`aria-label`,`placeholder`]),k(B(Y),{type:`button`,size:`icon-sm`,variant:`outline`,"aria-label":s.value===`switch`?`Add case`:`Add branch`,disabled:!d.value.trim(),onClick:r[3]||=e=>p(`add`,d.value.trim())},{default:F(()=>[k(B(Ku))]),_:1},8,[`aria-label`,`disabled`])]),f.value?(I(),A(`p`,GX,z(f.value),1)):P(``,!0)])):P(``,!0),S.value.lead?(I(),A(`section`,KX,[L(`div`,{class:`flex items-center gap-1 text-xs font-medium text-fg-muted`,title:S.value.lead.schema.description},[V(z(ye(S.value.lead.key,S.value.lead.schema))+` `,1),S.value.lead.schema.description?(I(),K(B(_u),{key:0,class:`size-3 text-fg-subtle`})):P(``,!0)],8,qX),S.value.lead.kind===`workflow`?(I(),K(gX,{key:0,editable:s.value!==`workflow.call`,value:be(S.value.lead.key),workflows:e.workflows,label:ye(S.value.lead.key,S.value.lead.schema),onPick:r[4]||=e=>te(S.value.lead.key,e)},null,8,[`editable`,`value`,`workflows`,`label`])):S.value.lead.kind===`select`?(I(),K(pX,{key:1,class:`w-full`,"model-value":be(S.value.lead.key),options:w(S.value.lead.options),"aria-label":ye(S.value.lead.key,S.value.lead.schema),"onUpdate:modelValue":r[5]||=e=>D(S.value.lead.key,e||void 0)},null,8,[`model-value`,`options`,`aria-label`])):S.value.lead.kind===`text`?(I(),K(B(Jf),{key:2,"model-value":be(S.value.lead.key),class:`min-h-32 text-[13px] leading-relaxed`,onFocus:r[6]||=e=>me.value=S.value.lead.key,"onUpdate:modelValue":r[7]||=e=>D(S.value.lead.key,String(e))},null,8,[`model-value`])):(I(),K(B(Z),{key:3,"model-value":be(S.value.lead.key),onFocus:r[8]||=e=>me.value=S.value.lead.key,"onUpdate:modelValue":r[9]||=e=>D(S.value.lead.key,String(e))},null,8,[`model-value`])),g.value.length&&S.value.lead.kind!==`select`?(I(),A(`div`,JX,[r[16]||=L(`span`,{class:`text-[11px] text-fg-subtle`},`Insert`,-1),(I(!0),A(H,null,j(g.value,e=>(I(),K(B(Y),{key:e,type:`button`,variant:`outline`,size:`xs`,class:`font-mono`,title:`{{ steps.${e}.summary }}`,onClick:t=>he(e)},{default:F(()=>[V(z(e),1)]),_:2},1032,[`title`,`onClick`]))),128))])):P(``,!0)])):P(``,!0),k(B(Y),{type:`button`,variant:`ghost`,size:`xs`,class:`-ml-2 text-fg-muted aria-expanded:bg-transparent`,"aria-expanded":C.value,onClick:r[10]||=e=>C.value=!C.value},{default:F(()=>[k(B(ae),{"data-icon":`inline-start`,class:R([`transition-transform`,!C.value&&`-rotate-90`])},null,8,[`class`]),r[17]||=V(`More `,-1)]),_:1},8,[`aria-expanded`]),C.value?(I(),A(H,{key:3},[S.value.compact.length?(I(),A(`section`,YX,[(I(!0),A(H,null,j(S.value.compact,t=>(I(),A(`div`,{key:t.key,class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},[L(`span`,{class:`flex flex-1 items-center gap-1 text-[13px]`,title:t.schema.description},[V(z(ye(t.key,t.schema))+` `,1),t.schema.description?(I(),K(B(_u),{key:0,class:`size-3 text-fg-subtle`})):P(``,!0)],8,XX),t.kind===`workflow`?(I(),K(gX,{key:0,editable:s.value!==`workflow.call`,class:`max-w-48`,value:be(t.key),workflows:e.workflows,label:ye(t.key,t.schema),onPick:e=>te(t.key,e)},null,8,[`editable`,`value`,`workflows`,`label`,`onPick`])):t.kind===`boolean`?(I(),K(B(a_),{key:1,"model-value":h.value[t.key]===!0,"onUpdate:modelValue":e=>D(t.key,e||void 0)},null,8,[`model-value`,`onUpdate:modelValue`])):t.kind===`select`?(I(),K(pX,{key:2,class:`w-40`,"model- Line truncated
`):``,class:`min-h-16 font-mono text-xs`,placeholder:`One per line`,"onUpdate:modelValue":t=>D(e.key,String(t).split(`
`).filter(Boolean))},null,8,[`model-value`,`onUpdate:modelValue`])):(I(),A(H,{key:2},[k(B(Yf),{"model-value":ve(h.value[e.key]),class:`min-h-24 font-mono text-xs`,placeholder:`YAML`,onChange:t=>_e(e.key,t.target.value)},null,8,[`model-value`,`onChange`]),ge.value[e.key]?(I(),A(`span`,cZ,z(ge.value[e.key]),1)):P(``,!0)],64))]))),128)),L(`section`,lZ,[_.value?(I(),A(`p`,uZ,z(_.value),1)):P(``,!0),L(`div`,dZ,[L(`label`,fZ,[r[20]||=L(`span`,{class:`flex-1 text-[13px]`,title:`Empty always runs. A field such as inputs.enabled, !inputs.skip, or steps.plan.result.ready == true`},`Run only when`,-1),k(B(Z),{class:`h-8 w-48 font-mono text-xs`,placeholder:`inputs.enabled`,"aria-invalid":_.value&&_.value.startsWith(`when`)?!0:void 0,"model-value":a.value.when??``,"onUpdate:modelValue":r[11]||=e=>ee(`when`,String(e))},null,8,[`aria-invalid`,`model-value`])]),L(`label`,pZ,[r[21]||=L(`span`,{class:`flex-1 text-[13px]`},`If it fails`,-1),k(gX,{class:`w-36`,"aria-label":`If it fails`,"model-value":a.value.on_failure??``,options:xe,"onUpdate:modelValue":r[12]||=e=>ee(`on_failure`,e||void 0)},null,8,[`model-value`])]),L(`label`,mZ,[r[22]||=L(`span`,{class:`flex-1 text-[13px]`},`Attempts`,-1),k(B(Z),{type:`number`,min:`1`,max:`10`,placeholder:`1`,class:`h-8 w-20 text-right text-[13px]`,"model-value":a.value.retry?.attempts??``,"onUpdate:modelValue":r[13]||=e=>E({attempts:String(e)===``?void 0:Number(String(e))})},null,8,[`model-value`])]),L(`div`,hZ,[L(`label`,{for:`${B(n)}-backoff`,class:`flex-1 text-[13px]`},`Retry backoff`,8,gZ),k(B(Yg),{id:`${B(n)}-backoff`,"model-value":a.value.retry?.backoff??``,units:[`s`,`m`,`h`],"onUpdate:modelValue":r[14]||=e=>E({backoff:e||void 0})},null,8,[`id`,`model-value`])])])])],64)):P(``,!0)]))}}),vZ={class:`space-y-1.5`},yZ={class:`flex items-center text-xs font-medium text-fg-muted`},bZ={key:0,class:`divide-y divide-border rounded-md border border-border`},xZ=N({__name:`SpecList`,props:{yaml:{},field:{}},emits:[`update:yaml`],setup(e,{emit:t}){let n=e,r=t,i=[`string`,`number`,`bool`,`object`,`array`,`any`].map(e=>({value:e,label:e})),a=J(()=>Object.entries(QY(n.yaml,n.field)??{}));function o(e){r(`update:yaml`,$Y(n.yaml,n.field,Object.fromEntries(e.filter(([e])=>e))))}function s(e,t,n){o(a.value.map((r,i)=>i===e?[t,n]:r))}function c(){let e=n.field.slice(0,-1),t=a.value.length+1;for(;a.value.some(([n])=>n===`${e}_${t}`);)t++;o([...a.value,[`${e}_${t}`,{type:`string`}]])}return(t,n)=>(I(),A(`section`,vZ,[L(`div`,yZ,[V(z(e.field===`inputs`?`Inputs`:`Outputs`)+` `,1),k(B(Y),{type:`button`,variant:`ghost`,size:`xs`,class:`ml-auto`,onClick:c},{default:F(()=>[k(B(qu),{"data-icon":`inline-start`}),n[0]||=V(`Add`,-1)]),_:1})]),a.value.length?(I(),A(`div`,bZ,[(I(!0),A(H,null,j(a.value,([t,n],r)=>(I(),A(`div`,{key:r,class:`flex items-center gap-2 px-2 py-1.5`},[k(B(Z),{"model-value":t,class:`h-8 min-w-0 flex-1 font-mono text-xs`,"aria-label":`${e.field} name`,onChange:e=>s(r,e.target.value.trim(),n)},null,8,[`model-value`,`aria-label`,`onChange`]),k(gX,{"model-value":n.type??`string`,options:B(i),class:`w-24`,"aria-label":`${t} type`,"onUpdate:modelValue":e=>s(r,t,{...n,type:e})},null,8,[`model-value`,`options`,`aria-label`,`onUpdate:modelValue`]),k(B(o_),{"model-value":n.required===!0,title:n.required?`Required`:`Optional`,"aria-label":`${t} required`,"onUpdate:modelValue":e=>s(r,t,{...n,required:e||void 0})},null,8,[`model-value`,`title`,`aria-label`,`onUpdate:modelValue`]),k(B(Y),{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":`Remove ${t}`,onClick:e=>o(a.value.filter((e,t)=>t!==r))},{default:F(()=>[k(B(fd))]),_:1},8,[`aria-label`,`onClick`])]))),128))])):P(``,!0)]))}}),SZ={class:`space-y-4 px-3 py-3`},CZ={class:`divide-y divide-border rounded-md border border-border`},wZ={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},TZ={key:0,role:`alert`,class:`px-3 py-2 text-xs text-danger`},EZ={key:1,class:`px-3 py-2 text-xs text-fg-subtle`},DZ={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},OZ={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},kZ={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},AZ={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},jZ={class:`space-y-1.5`},MZ=`6f129e29-0e26-5246-99bd-74cb4496203b`,NZ=N({__name:`WorkflowSettings`,props:{yaml:{}},emits:[`update:yaml`],setup(e,{emit:t}){let n=e,r=t,i=e=>{let t=QY(n.yaml,e);return typeof t==`string`?t:``};function a(e,t){r(`update:yaml`,$Y(n.yaml,e,t))}let o=Ev(),s=q([]),c=q(!0),l=q(``);async function u(){c.value=!0,l.value=``,s.value=[];try{await o.loadOrg();let e=await X.orgAgents(o.homeOrg);s.value=e.agents.filter(e=>e.lifecycle===`active`),!i(`identity`)&&s.value.some(e=>e.id===MZ)&&a(`identity`,MZ)}catch(e){l.value=String(e.message||e)}finally{c.value=!1}}Ue(u);let d=J(()=>{let e=i(`identity`),t=s.value.map(e=>({value:e.id,label:e.display_name}));return e&&!c.value&&!s.value.some(t=>t.id===e)?[{value:e,label:`${e} (unknown)`,disabled:!0},...t]:t}),f=Pg(),p=J(()=>{let e=Object.keys(f.stateFor(`agent-prLine truncated
`).filter(Boolean))},null,8,[`model-value`,`onUpdate:modelValue`])):(I(),A(H,{key:2},[k(B(Jf),{"model-value":ve(h.value[e.key]),class:`min-h-24 font-mono text-xs`,placeholder:`YAML`,onChange:t=>_e(e.key,t.target.value)},null,8,[`model-value`,`onChange`]),ge.value[e.key]?(I(),A(`span`,aZ,z(ge.value[e.key]),1)):P(``,!0)],64))]))),128)),L(`section`,oZ,[_.value?(I(),A(`p`,sZ,z(_.value),1)):P(``,!0),L(`div`,cZ,[L(`label`,lZ,[r[20]||=L(`span`,{class:`flex-1 text-[13px]`,title:`Empty always runs. A field such as inputs.enabled, !inputs.skip, or steps.plan.result.ready == true`},`Run only when`,-1),k(B(Z),{class:`h-8 w-48 font-mono text-xs`,placeholder:`inputs.enabled`,"aria-invalid":_.value&&_.value.startsWith(`when`)?!0:void 0,"model-value":a.value.when??``,"onUpdate:modelValue":r[11]||=e=>ee(`when`,String(e))},null,8,[`aria-invalid`,`model-value`])]),L(`label`,uZ,[r[21]||=L(`span`,{class:`flex-1 text-[13px]`},`If it fails`,-1),k(pX,{class:`w-36`,"aria-label":`If it fails`,"model-value":a.value.on_failure??``,options:xe,"onUpdate:modelValue":r[12]||=e=>ee(`on_failure`,e||void 0)},null,8,[`model-value`])]),L(`label`,dZ,[r[22]||=L(`span`,{class:`flex-1 text-[13px]`},`Attempts`,-1),k(B(Z),{type:`number`,min:`1`,max:`10`,placeholder:`1`,class:`h-8 w-20 text-right text-[13px]`,"model-value":a.value.retry?.attempts??``,"onUpdate:modelValue":r[13]||=e=>E({attempts:String(e)===``?void 0:Number(String(e))})},null,8,[`model-value`])]),L(`div`,fZ,[L(`label`,{for:`${B(n)}-backoff`,class:`flex-1 text-[13px]`},`Retry backoff`,8,pZ),k(B(Jg),{id:`${B(n)}-backoff`,"model-value":a.value.retry?.backoff??``,units:[`s`,`m`,`h`],"onUpdate:modelValue":r[14]||=e=>E({backoff:e||void 0})},null,8,[`id`,`model-value`])])])])],64)):P(``,!0)]))}}),hZ={class:`space-y-1.5`},gZ={class:`flex items-center text-xs font-medium text-fg-muted`},_Z={key:0,class:`divide-y divide-border rounded-md border border-border`},vZ=N({__name:`SpecList`,props:{yaml:{},field:{}},emits:[`update:yaml`],setup(e,{emit:t}){let n=e,r=t,i=[`string`,`number`,`bool`,`object`,`array`,`any`].map(e=>({value:e,label:e})),a=J(()=>Object.entries(YY(n.yaml,n.field)??{}));function o(e){r(`update:yaml`,XY(n.yaml,n.field,Object.fromEntries(e.filter(([e])=>e))))}function s(e,t,n){o(a.value.map((r,i)=>i===e?[t,n]:r))}function c(){let e=n.field.slice(0,-1),t=a.value.length+1;for(;a.value.some(([n])=>n===`${e}_${t}`);)t++;o([...a.value,[`${e}_${t}`,{type:`string`}]])}return(t,n)=>(I(),A(`section`,hZ,[L(`div`,gZ,[V(z(e.field===`inputs`?`Inputs`:`Outputs`)+` `,1),k(B(Y),{type:`button`,variant:`ghost`,size:`xs`,class:`ml-auto`,onClick:c},{default:F(()=>[k(B(Ku),{"data-icon":`inline-start`}),n[0]||=V(`Add`,-1)]),_:1})]),a.value.length?(I(),A(`div`,_Z,[(I(!0),A(H,null,j(a.value,([t,n],r)=>(I(),A(`div`,{key:r,class:`flex items-center gap-2 px-2 py-1.5`},[k(B(Z),{"model-value":t,class:`h-8 min-w-0 flex-1 font-mono text-xs`,"aria-label":`${e.field} name`,onChange:e=>s(r,e.target.value.trim(),n)},null,8,[`model-value`,`aria-label`,`onChange`]),k(pX,{"model-value":n.type??`string`,options:B(i),class:`w-24`,"aria-label":`${t} type`,"onUpdate:modelValue":e=>s(r,t,{...n,type:e})},null,8,[`model-value`,`options`,`aria-label`,`onUpdate:modelValue`]),k(B(a_),{"model-value":n.required===!0,title:n.required?`Required`:`Optional`,"aria-label":`${t} required`,"onUpdate:modelValue":e=>s(r,t,{...n,required:e||void 0})},null,8,[`model-value`,`title`,`aria-label`,`onUpdate:modelValue`]),k(B(Y),{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":`Remove ${t}`,onClick:e=>o(a.value.filter((e,t)=>t!==r))},{default:F(()=>[k(B(dd))]),_:1},8,[`aria-label`,`onClick`])]))),128))])):P(``,!0)]))}}),yZ={class:`space-y-4 px-3 py-3`},bZ={class:`divide-y divide-border rounded-md border border-border`},xZ={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},SZ={key:0,role:`alert`,class:`px-3 py-2 text-xs text-danger`},CZ={key:1,class:`px-3 py-2 text-xs text-fg-subtle`},wZ={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},TZ={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},EZ={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},DZ={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},OZ={class:`space-y-1.5`},kZ=`6f129e29-0e26-5246-99bd-74cb4496203b`,AZ=N({__name:`WorkflowSettings`,props:{yaml:{}},emits:[`update:yaml`],setup(e,{emit:t}){let n=e,r=t,i=e=>{let t=YY(n.yaml,e);return typeof t==`string`?t:``};function a(e,t){r(`update:yaml`,XY(n.yaml,e,t))}let o=Ev(),s=q([]),c=q(!0),l=q(``);async function u(){c.value=!0,l.value=``,s.value=[];try{await o.loadOrg();let e=await X.orgAgents(o.homeOrg);s.value=e.agents.filter(e=>e.lifecycle===`active`),!i(`identity`)&&s.value.some(e=>e.id===kZ)&&a(`identity`,kZ)}catch(e){l.value=String(e.message||e)}finally{c.value=!1}}Ue(u);let d=J(()=>{let e=i(`identity`),t=s.value.map(e=>({value:e.id,label:e.display_name}));return e&&!c.value&&!s.value.some(t=>t.id===e)?[{value:e,label:`${e} (unknown)`,disabled:!0},...t]:t}),f=Ng(),p=J(()=>{let e=Object.keys(f.stateFor(`agent-prLine truncated
`).replace(`
`,`
+`).split(`
`).map(e=>e.trim().toLowerCase());if(i.length===1)return e.toLowerCase()===t.toLowerCase();r||n.add(e.toLowerCase());let a=i.every((e,t)=>n.has(e)&&Array.from(n.values())[t]===i[t]);return r&&n.delete(e.toLowerCase()),a}function t6(e,t){return n=>{if(!n.code&&!n.key)return!1;let r=n6(n.code,e);return Array.isArray(e)?e.some(e=>e6(n[r],e,t,n.type===`keyup`)):e6(n[r],e,t,n.type===`keyup`)}}function n6(e,t){return t.includes(e)?`code`:`key`}function r6(e,t){let n=J(()=>Je(t?.target)??Z3),r=ot(Je(e)===!0),i=!1,a=new Set,o=c(Je(e));M(()=>Je(e),(e,t)=>{typeof t==`boolean`&&typeof e!=`boolean`&&s(),o=c(e)},{immediate:!0}),XQ([`blur`,`contextmenu`],s),QQ((...e)=>o(...e),e=>{let n=Je(t?.actInsideInputWithModifier)??!0,a=Je(t?.preventDefault)??!1;if(i=$3(e),(!i||i&&!n)&&Q3(e))return;let o=e.composedPath?.call(e)?.[0]||e.target,s=o?.nodeName===`BUTTON`||o?.nodeName===`A`;!a&&(i||!s)&&e.preventDefault(),r.value=!0},{eventName:`keydown`,target:n}),QQ((...e)=>o(...e),e=>{let n=Je(t?.actInsideInputWithModifier)??!0;if(r.value){if((!i||i&&!n)&&Q3(e))return;i=!1,r.value=!1}},{eventName:`keyup`,target:n});function s(){i=!1,a.clear(),r.value=Je(e)===!0}function c(e){return e===null?(s(),()=>!1):typeof e==`boolean`?(s(),r.value=e,()=>!1):Array.isArray(e)||typeof e==`string`?t6(e,a):e}return r}var i6=`vue-flow__node-desc`,a6=`vue-flow__edge-desc`,o6=`vue-flow__aria-live`,s6=[`Enter`,` `,`Escape`],c6={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function l6(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function u6(e,t){let n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)}function d6(e){return{width:e.offsetWidth,height:e.offsetHeight}}function f6(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function p6(e,t){return{x:f6(e.x,t[0][0],t[1][0]),y:f6(e.y,t[0][1],t[1][1])}}function m6(e){let t=e.getRootNode();return`elementFromPoint`in t?t:window.document}function h6(e){return e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e}function g6(e){return e&&typeof e==`object`&&`id`in e&&`position`in e&&!h6(e)}function _6(e){return g6(e)&&`computedPosition`in e}function v6(e){return!Number.isNaN(e)&&Number.isFinite(e)}function y6(e){return v6(e.width)&&v6(e.height)&&v6(e.x)&&v6(e.y)}function b6(e,t,n){let r={id:e.id.toString(),type:e.type??`default`,dimensions:Ge({width:0,height:0}),computedPosition:Ge({z:0,...e.position}),handleBounds:{source:[],target:[]},draggable:void 0,selectable:void 0,connectable:void 0,focusable:void 0,selected:!1,dragging:!1,resizing:!1,initialized:!1,isParent:!1,position:{x:0,y:0},data:L8(e.data)?e.data:{},events:Ge(L8(e.events)?e.events:{})};return Object.assign(t??r,e,{id:e.id.toString(),parentNode:n})}function x6(e,t,n){let r={id:e.id.toString(),type:e.type??t?.type??`default`,source:e.source.toString(),target:e.target.toString(),sourceHandle:e.sourceHandle?.toString(),targetHandle:e.targetHandle?.toString(),updatable:e.updatable??n?.updatable,selectable:e.selectable??n?.selectable,focusable:e.focusable??n?.focusable,data:L8(e.data)?e.data:{},events:Ge(L8(e.events)?e.events:{}),label:e.label??``,interactionWidth:e.interactionWidth??n?.interactionWidth,...n??{}};return Object.assign(t??r,e,{id:e.id.toString()})}function S6(e,t,n,r){let i=typeof e==`string`?e:e.id,a=new Set,o=r===`source`?`target`:`source`;for(let e of n)e[o]===i&&a.add(e[r]);return t.filter(e=>a.has(e.id))}function C6(...e){if(e.length===3){let[t,n,r]=e;return S6(t,n,r,`target`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>h6(e)&&e.source===r).map(e=>n.find(t=>g6(t)&&t.id===e.target))}function w6(...e){if(e.length===3){let[t,n,r]=e;return S6(t,n,r,`source`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>h6(e)&&e.target===r).map(e=>n.find(t=>g6(t)&&t.id===e.source))}function T6({source:e,sourceHandle:t,target:n,targetHandle:r}){return`vueflow__edge-${e}${t??``}-${n}${r??``}`}function E6(e,t){return t.some(t=>h6(t)&&t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle))}function D6({x:e,y:t},{x:n,y:r,zoom:i}){return{x:e*i+n,y:t*i+r}}function O6({x:e,y:t},{x:n,y:r,zoom:i},a=!1,o=[1,1]){let s={x:(e-n)/i,y:(t-r)/i};return a?b8(s,o):s}function k6(e,t){return{x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}}function A6({x:e,y:t,width:n,height:r}){return{x:e,y:t,x2:e+n,y2:t+r}}function j6({x:e,y:t,x2:n,y2:r}){return{x:e,y:t,width:n-e,height:r-t}}function M6(e){let t={x:1/0,y:1/0,x2:-1/0,y2:-1/0};for(let n=0;n<e.length;n++){let r=e[n];t=k6(t,A6({...r.computedPosition,...r.dimensions}))}return j6(t)}function N6(e,t,n={x:0,y:0,zoom:1},r=!1,i=!1){let a={...O6(t,n),width:t.width/n.zoom,height:t.height/n.zoom},o=[];for(let t of e){let{dimensions:e,selectable:n=!0,hidden:s= Line truncated
`).map(e=>e.trim().toLowerCase());if(i.length===1)return e.toLowerCase()===t.toLowerCase();r||n.add(e.toLowerCase());let a=i.every((e,t)=>n.has(e)&&Array.from(n.values())[t]===i[t]);return r&&n.delete(e.toLowerCase()),a}function Q3(e,t){return n=>{if(!n.code&&!n.key)return!1;let r=$3(n.code,e);return Array.isArray(e)?e.some(e=>Z3(n[r],e,t,n.type===`keyup`)):Z3(n[r],e,t,n.type===`keyup`)}}function $3(e,t){return t.includes(e)?`code`:`key`}function e6(e,t){let n=J(()=>Je(t?.target)??J3),r=ot(Je(e)===!0),i=!1,a=new Set,o=c(Je(e));M(()=>Je(e),(e,t)=>{typeof t==`boolean`&&typeof e!=`boolean`&&s(),o=c(e)},{immediate:!0}),qQ([`blur`,`contextmenu`],s),YQ((...e)=>o(...e),e=>{let n=Je(t?.actInsideInputWithModifier)??!0,a=Je(t?.preventDefault)??!1;if(i=X3(e),(!i||i&&!n)&&Y3(e))return;let o=e.composedPath?.call(e)?.[0]||e.target,s=o?.nodeName===`BUTTON`||o?.nodeName===`A`;!a&&(i||!s)&&e.preventDefault(),r.value=!0},{eventName:`keydown`,target:n}),YQ((...e)=>o(...e),e=>{let n=Je(t?.actInsideInputWithModifier)??!0;if(r.value){if((!i||i&&!n)&&Y3(e))return;i=!1,r.value=!1}},{eventName:`keyup`,target:n});function s(){i=!1,a.clear(),r.value=Je(e)===!0}function c(e){return e===null?(s(),()=>!1):typeof e==`boolean`?(s(),r.value=e,()=>!1):Array.isArray(e)||typeof e==`string`?Q3(e,a):e}return r}var t6=`vue-flow__node-desc`,n6=`vue-flow__edge-desc`,r6=`vue-flow__aria-live`,i6=[`Enter`,` `,`Escape`],a6={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function o6(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function s6(e,t){let n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)}function c6(e){return{width:e.offsetWidth,height:e.offsetHeight}}function l6(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function u6(e,t){return{x:l6(e.x,t[0][0],t[1][0]),y:l6(e.y,t[0][1],t[1][1])}}function d6(e){let t=e.getRootNode();return`elementFromPoint`in t?t:window.document}function f6(e){return e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e}function p6(e){return e&&typeof e==`object`&&`id`in e&&`position`in e&&!f6(e)}function m6(e){return p6(e)&&`computedPosition`in e}function h6(e){return!Number.isNaN(e)&&Number.isFinite(e)}function g6(e){return h6(e.width)&&h6(e.height)&&h6(e.x)&&h6(e.y)}function _6(e,t,n){let r={id:e.id.toString(),type:e.type??`default`,dimensions:Ge({width:0,height:0}),computedPosition:Ge({z:0,...e.position}),handleBounds:{source:[],target:[]},draggable:void 0,selectable:void 0,connectable:void 0,focusable:void 0,selected:!1,dragging:!1,resizing:!1,initialized:!1,isParent:!1,position:{x:0,y:0},data:P8(e.data)?e.data:{},events:Ge(P8(e.events)?e.events:{})};return Object.assign(t??r,e,{id:e.id.toString(),parentNode:n})}function v6(e,t,n){let r={id:e.id.toString(),type:e.type??t?.type??`default`,source:e.source.toString(),target:e.target.toString(),sourceHandle:e.sourceHandle?.toString(),targetHandle:e.targetHandle?.toString(),updatable:e.updatable??n?.updatable,selectable:e.selectable??n?.selectable,focusable:e.focusable??n?.focusable,data:P8(e.data)?e.data:{},events:Ge(P8(e.events)?e.events:{}),label:e.label??``,interactionWidth:e.interactionWidth??n?.interactionWidth,...n??{}};return Object.assign(t??r,e,{id:e.id.toString()})}function y6(e,t,n,r){let i=typeof e==`string`?e:e.id,a=new Set,o=r===`source`?`target`:`source`;for(let e of n)e[o]===i&&a.add(e[r]);return t.filter(e=>a.has(e.id))}function b6(...e){if(e.length===3){let[t,n,r]=e;return y6(t,n,r,`target`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>f6(e)&&e.source===r).map(e=>n.find(t=>p6(t)&&t.id===e.target))}function x6(...e){if(e.length===3){let[t,n,r]=e;return y6(t,n,r,`source`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>f6(e)&&e.target===r).map(e=>n.find(t=>p6(t)&&t.id===e.source))}function S6({source:e,sourceHandle:t,target:n,targetHandle:r}){return`vueflow__edge-${e}${t??``}-${n}${r??``}`}function C6(e,t){return t.some(t=>f6(t)&&t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle))}function w6({x:e,y:t},{x:n,y:r,zoom:i}){return{x:e*i+n,y:t*i+r}}function T6({x:e,y:t},{x:n,y:r,zoom:i},a=!1,o=[1,1]){let s={x:(e-n)/i,y:(t-r)/i};return a?_8(s,o):s}function E6(e,t){return{x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}}function D6({x:e,y:t,width:n,height:r}){return{x:e,y:t,x2:e+n,y2:t+r}}function O6({x:e,y:t,x2:n,y2:r}){return{x:e,y:t,width:n-e,height:r-t}}function k6(e){let t={x:1/0,y:1/0,x2:-1/0,y2:-1/0};for(let n=0;n<e.length;n++){let r=e[n];t=E6(t,D6({...r.computedPosition,...r.dimensions}))}return O6(t)}function A6(e,t,n={x:0,y:0,zoom:1},r=!1,i=!1){let a={...T6(t,n),width:t.width/n.zoom,height:t.height/n.zoom},o=[];for(let t of e){let{dimensions:e,selectable:n=!0,hidden:s= Line truncated
Node: ${e}`,NODE_NOT_FOUND:e=>`Node not found
Node: ${e}`,NODE_MISSING_PARENT:(e,t)=>`Node is missing a parent
Node: ${e}
@@ -158,10 +158,10 @@ Edge: ${e}
Source: ${t}
Target: ${n}`,EDGE_ORPHANED:e=>`Edge was orphaned (suddenly missing source or target) and has been removed
Edge: ${e}`,EDGE_NOT_FOUND:e=>`Edge not found
Edge: ${e}`,USEVUEFLOW_OPTIONS:()=>`The options parameter is deprecated and will be removed in the next major version. Please use the id parameter instead`},m8=class extends Error{constructor(e,...t){super(p8[e]?.call(p8,...t)),this.name=`VueFlowError`,this.code=e,this.args=t}};function h8(e){return`clientX`in e}function g8(e){return`sourceEvent`in e}function _8(e,t){let n=h8(e),r,i;return n?(r=e.clientX,i=e.clientY):`touches`in e&&e.touches.length>0?(r=e.touches[0].clientX,i=e.touches[0].clientY):`changedTouches`in e&&e.changedTouches.length>0?(r=e.changedTouches[0].clientX,i=e.changedTouches[0].clientY):(r=0,i=0),{x:r-(t?.left??0),y:i-(t?.top??0)}}var v8=()=>typeof navigator<`u`&&(navigator==null?void 0:navigator.userAgent)?.indexOf(`Mac`)>=0;function y8(e){return{width:e.dimensions?.width??e.width??0,height:e.dimensions?.height??e.height??0}}function b8(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}var x8=()=>!0;function S8(e){e?.classList.remove(`valid`,`connecting`,`vue-flow__handle-valid`,`vue-flow__handle-connecting`)}function C8(e,t,n){let r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let e of t.values())u6(i,l6(e))>0&&r.push(e);return r}var w8=250;function T8(e,t,n,r){let i=[],a=1/0,o=C8(e,n,t+w8);for(let n of o){let o=[...n.handleBounds?.source??[],...n.handleBounds?.target??[]];for(let s of o){if(r.nodeId===s.nodeId&&r.type===s.type&&r.id===s.id)continue;let{x:o,y:c}=c8(n,s,s.position,!0),l=Math.sqrt((o-e.x)**2+(c-e.y)**2);l>t||(l<a?(i=[{...s,x:o,y:c}],a=l):l===a&&i.push({...s,x:o,y:c}))}}if(!i.length)return null;if(i.length>1){let e=r.type===`source`?`target`:`source`;return i.find(t=>t.type===e)??i[0]}return i[0]}function E8(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=x8},u,d,f,p){let m=a===`target`,h=t?o.querySelector(`.${s}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:g,y:_}=_8(e),v=o.elementFromPoint(g,_),y=v?.classList.contains(`${s}-flow__handle`)?v:h,b={handleDomNode:y,isValid:!1,connection:null,toHandle:null};if(y){let e=D8(void 0,y),t=y.getAttribute(`data-nodeid`),a=y.getAttribute(`data-handleid`),o=y.classList.contains(`connectable`),s=y.classList.contains(`connectableend`);if(!t||!e)return b;let c={source:m?t:r,sourceHandle:m?a:i,target:m?r:t,targetHandle:m?i:a};b.connection=c,b.isValid=o&&s&&(n===q3.Strict?m&&e===`source`||!m&&e===`target`:t!==r||a!==i)&&l(c,{nodes:d,edges:u,sourceNode:f(c.source),targetNode:f(c.target)}),b.toHandle=A8(t,e,a,p,n,!0)}return b}function D8(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function O8(e,t){let n=null;return t?n=`valid`:e&&!t&&(n=`invalid`),n}function k8(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}function A8(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===q3.Strict?o.handleBounds?.[t]:[...o.handleBounds?.source??[],...o.handleBounds?.target??[]],c=(n?s?.find(e=>e.id===n):s?.[0])??null;return c&&a?{...c,...c8(o,c,c.position,!0)}:c}var j8={[W3.Left]:W3.Right,[W3.Right]:W3.Left,[W3.Top]:W3.Bottom,[W3.Bottom]:W3.Top},M8=[`production`,`prod`];function N8(e,...t){P8()&&console.warn(`[Vue Flow]: ${e}`,...t)}function P8(){return!M8.includes(`production`)}function F8(e,t,n,r,i){let a=t.querySelectorAll(`.vue-flow__handle.${e}`);return a?.length?Array.from(a).map(t=>{let a=t.getBoundingClientRect();return{id:t.getAttribute(`data-handleid`),type:e,nodeId:i,position:t.getAttribute(`data-handlepos`),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...d6(t)}}):null}function I8(e,t,n,r,i,a=!1,o){i.value=!1,e.selected?(a||e.selected&&t)&&(r([e]),qe(()=>{o.blur()})):n([e])}function L8(e){return B(e)!==void 0}function R8(e,t,n,r){if(!e||!e.source||!e.target)return n(new m8(f8.EDGE_INVALID,e?.id??`[ID UNKNOWN]`)),!1;let i;return i=h6(e)?e:{...e,id:T6(e)},i=x6(i,void 0,r),!E6(i,t)&&i}function z8(e,t,n,r,i){if(!t.source||!t.target)return i(new m8(f8.EDGE_INVALID,e.id)),!1;if(!n)return i(new m8(f8.EDGE_NOT_FOUND,e.id)),!1;let{id:a,...o}=e;return{...o,id:r?T6(t):a,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function B8(e,t,n){let r={},i=[];for(let a=0;a<e.length;++a){let o=e[a];if(!g6(o)){n(new m8(f8.NODE_INVALID,o?.id));continue}let s=b6(o,t(o.id),o.parentNode);o.parentNode&&(r[o.parentNode]=!0),i[a]=s}for(let e of i){let a=t(e.parentNode)||i.find(t=>t.id===e.parentNode);e.parentNode&&!a&&n(new m8(f8.NODE_MISSING_PARENT,e.id,e.parentNode)),(e.parentNode||r[e.id])&&(r[e.id]&&(e.isParent=!0),a&&(a.isParent=!0))}return i}function V8(e,t,n,r,i,a){let o=i,s=r.get(o)||new Map;r.set(o,s.set(n,t)),o=`${i}-${e}`;let c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),a){o=`${i}-${e}-${a}`;let s=r.get(o)||new Map;r.set(o,s.set(n,t))}}function H8(e,t,n){e.clear();for(let t of n){let{source:n,target:r,sourceHandle:i=null,targetHandle:a=null}=t,o={edgeId:t.id,source:n,target:r,sourceHandle:i,targetHandle:a},s=`${n}-${i}--${r}-${a}`;V8(`source`,o,`${r}-${a}--Line truncated
`)},z(e.data.summary||e.data.detail),9,h9)):P(``,!0),e.data.when||e.data.retry||e.data.continues?(I(),A(`div`,g9,[e.data.when?(I(),A(`span`,{key:0,class:`flex max-w-full min-w-0 items-center gap-0.5 rounded bg-secondary px-1 font-mono`,title:`Runs only when ${e.data.when}`},[k(B(Eu),{class:`size-3 shrink-0`,"aria-hidden":`true`}),L(`span`,v9,z(e.data.when),1)],8,_9)):P(``,!0),e.data.retry?(I(),A(`span`,{key:1,class:`flex items-center gap-0.5 rounded bg-secondary px-1`,title:`Up to ${e.data.retry} attempts`},[k(B(Yu),{class:`size-3`,"aria-hidden":`true`}),V(`×`+z(e.data.retry),1)],8,y9)):P(``,!0),e.data.continues?(I(),A(`span`,b9,[k(B(od),{class:`size-3`,"aria-hidden":`true`}),r[10]||=V(`continues`,-1)])):P(``,!0)])):P(``,!0),e.data.run?.error?(I(),A(`p`,{key:4,class:`mt-1 line-clamp-2 text-[11px] text-danger`,title:e.data.run.error},z(e.data.run.error),9,Jee)):P(``,!0)],64))]),k(eee,{"enter-from-class":`opacity-0 -translate-y-1`,"enter-active-class":`transition duration-200`,"leave-to-class":`opacity-0`,"leave-active-class":`transition duration-100`},{default:F(()=>[e.data.expanded?(I(),A(`div`,{key:0,class:`nodrag nopan nowheel cursor-auto border-t border-border`,onClick:r[6]||=pt(()=>{},[`stop`])},[G(t.$slots,`default`)])):P(``,!0)]),_:3}),k(B(S5),{type:`source`,position:B(W3).Bottom},null,8,[`position`]),k(B(S5),{id:`data-out`,type:`source`,position:B(W3).Right,class:`!opacity-0`},null,8,[`position`]),e.data.type===`switch`?(I(),K(B(S5),{key:1,id:`otherwise`,type:`source`,position:B(W3).Right,class:`!opacity-0`},null,8,[`position`])):P(``,!0)],2))}}),Xee={class:`pointer-events-none size-full rounded-xl border border-dashed border-border bg-muted/30`},Zee={class:`flex items-center gap-1 px-2.5 pt-1.5 text-[11px] text-fg-subtle`},Qee={key:0},$ee={key:1,class:`font-mono`},ete=N({__name:`LaneNode`,props:{data:{}},setup(e){return(t,n)=>(I(),A(`div`,Xee,[L(`div`,Zee,[e.data.lane===`switch`?(I(),A(H,{key:0},[k(B(cd),{class:`size-3`,"aria-hidden":`true`}),e.data.title==="default"?(I(),A(`span`,Qee,`otherwise`)):(I(),A(`span`,$ee,`= `+z(e.data.title),1))],64)):(I(),A(H,{key:1},[k(B(Ou),{class:`size-3`,"aria-hidden":`true`}),V(z(e.data.title),1)],64))])]))}}),tte={class:`flex shrink-0 items-center justify-center gap-1 border-t border-border bg-card p-1`},x9=240,nte=416,S9=-140,rte=72,ite=.9,C9=N({__name:`WorkflowCanvas`,props:{yaml:{},stages:{},open:{},triggers:{},types:{},readonly:{type:Boolean},restartable:{type:Boolean},marks:{},problems:{},title:{},summary:{}},emits:[`toggle`,`insert`,`duplicate`,`move`,`remove`,`rename`,`restart`],setup(e,{emit:t}){let n=e,r=t,i=J(()=>!!n.types?.length&&!n.readonly),a=J(()=>[...n.types??[],`parallel`,`switch`]),o=J(()=>a.value.filter(e=>[`agent.run`,`workflow.call`].includes(e))),s=e=>e&&LY(e)?o.value:a.value,c=e=>e.kind===`step`?JSON.stringify(e.path??null):e.kind,l=q(null),u=q(null),d=Dt(`(max-width: 767px)`),f=J(()=>{let e=nX(pX(n.yaml),n.stages??[]);return n.types?.length?{nodes:[{id:`workflow`,type:`step`,position:{x:0,y:S9},data:{kind:`workflow`,key:`workflow`,title:n.title||`Workflow`,type:``,detail:n.summary??``}},...e.nodes],edges:[{id:`flow-workflow-start`,source:`workflow`,target:`start`,kind:`flow`},...e.edges]}:e}),p=J(()=>f.value.nodes.filter(e=>e.data.path?.length===2).length),m=q({}),h=q({}),g=J(()=>f.value.nodes.find(e=>e.type===`step`&&c(e.data)===n.open));function _(e,t){m.value={...m.value,[e]:t},g.value?.id!==e&&(h.value={...h.value,[e]:t})}let v=J(()=>{let e=d.value?void 0:g.value?.id;return e&&m.value[e]?Math.max(0,m.value[e]-(h.value[e]??m.value[e])):0}),y=Mt(),b=Ot(v,{duration:J(()=>y.value===`reduce`?0:200)}),x=J(()=>{let e=new Map;for(let t of f.value.nodes){if(t.type!==`step`)continue;let n=(t.id===g.value?.id?h.value[t.id]:void 0)??m.value[t.id];n!==void 0&&e.set(t.position.y,Math.max(e.get(t.position.y)??-72,n-rte))}return[...e]}),S=e=>x.value.reduce((t,[n,r])=>n<e?t+r:t,0);function C(e){let t=e.data,a=c(t),o=t.path,s={triggers:t.kind===`start`?n.triggers??[]:t.triggers,expanded:!d.value&&a===n.open,editable:i.value,problem:o?n.problems?.[a]:void 0,onResize:t=>_(e.id,t)};return n.types?.length&&(s.onToggle=()=>r(`toggle`,a)),i.value&&o&&(s.onRename=e=>r(`rename`,o,e),s.onDuplicate=()=>r(`duplicate`,o),s.onRemove=()=>r(`remove`,o)),{...e,data:{...t,...s}}}let w=e=>{let t=g.value;return d.value||!t||!e.style?.width?!1:e.position.x<=t.position.x&&e.position.x+parseFloat(String(e.style.width))>=t.position.x+x9};function T(e){let t=g.value;if(d.value||!t)return 0;if(e.id===t.id||w(e))return-88;let n=t.position.x+x9/2,r=e.style?.width?parseFloat(String(e.style.width)):e.type===`step`?x9:32,i=e.position.x+r/2;return Math.abs(i-n)<x9/2?0:i<n?-88:88}let ee=J(()=>{let e=g.value;return f.value.nodes.map(t=>{let a=t;t.type===`add`?t={...t,data:{...t.data,types:s(t.data.insertAfter),editable:i.value,onInsert:e=>r(`insert`,t.data.insertAfter,e)}}:t.type===`step`&&(t=C(t));let o=n.marks?.[t.id];o&&(t={...t,data:{...t.data,mark:o}});let c=t.position.x+T(t),l=t Line truncated
Edge: ${e}`,USEVUEFLOW_OPTIONS:()=>`The options parameter is deprecated and will be removed in the next major version. Please use the id parameter instead`},d8=class extends Error{constructor(e,...t){super(u8[e]?.call(u8,...t)),this.name=`VueFlowError`,this.code=e,this.args=t}};function f8(e){return`clientX`in e}function p8(e){return`sourceEvent`in e}function m8(e,t){let n=f8(e),r,i;return n?(r=e.clientX,i=e.clientY):`touches`in e&&e.touches.length>0?(r=e.touches[0].clientX,i=e.touches[0].clientY):`changedTouches`in e&&e.changedTouches.length>0?(r=e.changedTouches[0].clientX,i=e.changedTouches[0].clientY):(r=0,i=0),{x:r-(t?.left??0),y:i-(t?.top??0)}}var h8=()=>typeof navigator<`u`&&(navigator==null?void 0:navigator.userAgent)?.indexOf(`Mac`)>=0;function g8(e){return{width:e.dimensions?.width??e.width??0,height:e.dimensions?.height??e.height??0}}function _8(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}var v8=()=>!0;function y8(e){e?.classList.remove(`valid`,`connecting`,`vue-flow__handle-valid`,`vue-flow__handle-connecting`)}function b8(e,t,n){let r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let e of t.values())s6(i,o6(e))>0&&r.push(e);return r}var x8=250;function S8(e,t,n,r){let i=[],a=1/0,o=b8(e,n,t+x8);for(let n of o){let o=[...n.handleBounds?.source??[],...n.handleBounds?.target??[]];for(let s of o){if(r.nodeId===s.nodeId&&r.type===s.type&&r.id===s.id)continue;let{x:o,y:c}=a8(n,s,s.position,!0),l=Math.sqrt((o-e.x)**2+(c-e.y)**2);l>t||(l<a?(i=[{...s,x:o,y:c}],a=l):l===a&&i.push({...s,x:o,y:c}))}}if(!i.length)return null;if(i.length>1){let e=r.type===`source`?`target`:`source`;return i.find(t=>t.type===e)??i[0]}return i[0]}function C8(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=v8},u,d,f,p){let m=a===`target`,h=t?o.querySelector(`.${s}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:g,y:_}=m8(e),v=o.elementFromPoint(g,_),y=v?.classList.contains(`${s}-flow__handle`)?v:h,b={handleDomNode:y,isValid:!1,connection:null,toHandle:null};if(y){let e=w8(void 0,y),t=y.getAttribute(`data-nodeid`),a=y.getAttribute(`data-handleid`),o=y.classList.contains(`connectable`),s=y.classList.contains(`connectableend`);if(!t||!e)return b;let c={source:m?t:r,sourceHandle:m?a:i,target:m?r:t,targetHandle:m?i:a};b.connection=c,b.isValid=o&&s&&(n===W3.Strict?m&&e===`source`||!m&&e===`target`:t!==r||a!==i)&&l(c,{nodes:d,edges:u,sourceNode:f(c.source),targetNode:f(c.target)}),b.toHandle=D8(t,e,a,p,n,!0)}return b}function w8(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function T8(e,t){let n=null;return t?n=`valid`:e&&!t&&(n=`invalid`),n}function E8(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}function D8(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===W3.Strict?o.handleBounds?.[t]:[...o.handleBounds?.source??[],...o.handleBounds?.target??[]],c=(n?s?.find(e=>e.id===n):s?.[0])??null;return c&&a?{...c,...a8(o,c,c.position,!0)}:c}var O8={[V3.Left]:V3.Right,[V3.Right]:V3.Left,[V3.Top]:V3.Bottom,[V3.Bottom]:V3.Top},k8=[`production`,`prod`];function A8(e,...t){j8()&&console.warn(`[Vue Flow]: ${e}`,...t)}function j8(){return!k8.includes(`production`)}function M8(e,t,n,r,i){let a=t.querySelectorAll(`.vue-flow__handle.${e}`);return a?.length?Array.from(a).map(t=>{let a=t.getBoundingClientRect();return{id:t.getAttribute(`data-handleid`),type:e,nodeId:i,position:t.getAttribute(`data-handlepos`),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...c6(t)}}):null}function N8(e,t,n,r,i,a=!1,o){i.value=!1,e.selected?(a||e.selected&&t)&&(r([e]),qe(()=>{o.blur()})):n([e])}function P8(e){return B(e)!==void 0}function F8(e,t,n,r){if(!e||!e.source||!e.target)return n(new d8(l8.EDGE_INVALID,e?.id??`[ID UNKNOWN]`)),!1;let i;return i=f6(e)?e:{...e,id:S6(e)},i=v6(i,void 0,r),!C6(i,t)&&i}function I8(e,t,n,r,i){if(!t.source||!t.target)return i(new d8(l8.EDGE_INVALID,e.id)),!1;if(!n)return i(new d8(l8.EDGE_NOT_FOUND,e.id)),!1;let{id:a,...o}=e;return{...o,id:r?S6(t):a,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function L8(e,t,n){let r={},i=[];for(let a=0;a<e.length;++a){let o=e[a];if(!p6(o)){n(new d8(l8.NODE_INVALID,o?.id));continue}let s=_6(o,t(o.id),o.parentNode);o.parentNode&&(r[o.parentNode]=!0),i[a]=s}for(let e of i){let a=t(e.parentNode)||i.find(t=>t.id===e.parentNode);e.parentNode&&!a&&n(new d8(l8.NODE_MISSING_PARENT,e.id,e.parentNode)),(e.parentNode||r[e.id])&&(r[e.id]&&(e.isParent=!0),a&&(a.isParent=!0))}return i}function R8(e,t,n,r,i,a){let o=i,s=r.get(o)||new Map;r.set(o,s.set(n,t)),o=`${i}-${e}`;let c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),a){o=`${i}-${e}-${a}`;let s=r.get(o)||new Map;r.set(o,s.set(n,t))}}function z8(e,t,n){e.clear();for(let t of n){let{source:n,target:r,sourceHandle:i=null,targetHandle:a=null}=t,o={edgeId:t.id,source:n,target:r,sourceHandle:i,targetHandle:a},s=`${n}-${i}--${r}-${a}`;R8(`source`,o,`${r}-${a}--Line truncated
`)},z(e.data.summary||e.data.detail),9,f9)):P(``,!0),e.data.when||e.data.retry||e.data.continues?(I(),A(`div`,p9,[e.data.when?(I(),A(`span`,{key:0,class:`flex max-w-full min-w-0 items-center gap-0.5 rounded bg-secondary px-1 font-mono`,title:`Runs only when ${e.data.when}`},[k(B(Tu),{class:`size-3 shrink-0`,"aria-hidden":`true`}),L(`span`,h9,z(e.data.when),1)],8,m9)):P(``,!0),e.data.retry?(I(),A(`span`,{key:1,class:`flex items-center gap-0.5 rounded bg-secondary px-1`,title:`Up to ${e.data.retry} attempts`},[k(B(Ju),{class:`size-3`,"aria-hidden":`true`}),V(`×`+z(e.data.retry),1)],8,g9)):P(``,!0),e.data.continues?(I(),A(`span`,_9,[k(B(ad),{class:`size-3`,"aria-hidden":`true`}),r[10]||=V(`continues`,-1)])):P(``,!0)])):P(``,!0),e.data.run?.error?(I(),A(`p`,{key:4,class:`mt-1 line-clamp-2 text-[11px] text-danger`,title:e.data.run.error},z(e.data.run.error),9,v9)):P(``,!0)],64))]),k(eee,{"enter-from-class":`opacity-0 -translate-y-1`,"enter-active-class":`transition duration-200`,"leave-to-class":`opacity-0`,"leave-active-class":`transition duration-100`},{default:F(()=>[e.data.expanded?(I(),A(`div`,{key:0,class:`nodrag nopan nowheel cursor-auto border-t border-border`,onClick:r[6]||=pt(()=>{},[`stop`])},[G(t.$slots,`default`)])):P(``,!0)]),_:3}),k(B(y5),{type:`source`,position:B(V3).Bottom},null,8,[`position`]),k(B(y5),{id:`data-out`,type:`source`,position:B(V3).Right,class:`!opacity-0`},null,8,[`position`]),e.data.type===`switch`?(I(),K(B(y5),{key:1,id:`otherwise`,type:`source`,position:B(V3).Right,class:`!opacity-0`},null,8,[`position`])):P(``,!0)],2))}}),b9={class:`pointer-events-none size-full rounded-xl border border-dashed border-border bg-muted/30`},Jee={class:`flex items-center gap-1 px-2.5 pt-1.5 text-[11px] text-fg-subtle`},Yee={key:0},Xee={key:1,class:`font-mono`},Zee=N({__name:`LaneNode`,props:{data:{}},setup(e){return(t,n)=>(I(),A(`div`,b9,[L(`div`,Jee,[e.data.lane===`switch`?(I(),A(H,{key:0},[k(B(sd),{class:`size-3`,"aria-hidden":`true`}),e.data.title==="default"?(I(),A(`span`,Yee,`otherwise`)):(I(),A(`span`,Xee,`= `+z(e.data.title),1))],64)):(I(),A(H,{key:1},[k(B(Du),{class:`size-3`,"aria-hidden":`true`}),V(z(e.data.title),1)],64))])]))}}),Qee={class:`flex shrink-0 items-center justify-center gap-1 border-t border-border bg-card p-1`},x9=240,$ee=416,S9=-140,ete=72,tte=.9,C9=N({__name:`WorkflowCanvas`,props:{yaml:{},stages:{},open:{},triggers:{},types:{},readonly:{type:Boolean},restartable:{type:Boolean},marks:{},problems:{},title:{},summary:{}},emits:[`toggle`,`insert`,`duplicate`,`move`,`remove`,`rename`,`restart`],setup(e,{emit:t}){let n=e,r=t,i=J(()=>!!n.types?.length&&!n.readonly),a=J(()=>[...n.types??[],`parallel`,`switch`]),o=J(()=>a.value.filter(e=>[`agent.run`,`workflow.call`].includes(e))),s=e=>e&&PY(e)?o.value:a.value,c=e=>e.kind===`step`?JSON.stringify(e.path??null):e.kind,l=q(null),u=q(null),d=Dt(`(max-width: 767px)`),f=J(()=>{let e=$Y(uX(n.yaml),n.stages??[]);return n.types?.length?{nodes:[{id:`workflow`,type:`step`,position:{x:0,y:S9},data:{kind:`workflow`,key:`workflow`,title:n.title||`Workflow`,type:``,detail:n.summary??``}},...e.nodes],edges:[{id:`flow-workflow-start`,source:`workflow`,target:`start`,kind:`flow`},...e.edges]}:e}),p=J(()=>f.value.nodes.filter(e=>e.data.path?.length===2).length),m=q({}),h=q({}),g=J(()=>f.value.nodes.find(e=>e.type===`step`&&c(e.data)===n.open));function _(e,t){m.value={...m.value,[e]:t},g.value?.id!==e&&(h.value={...h.value,[e]:t})}let v=J(()=>{let e=d.value?void 0:g.value?.id;return e&&m.value[e]?Math.max(0,m.value[e]-(h.value[e]??m.value[e])):0}),y=Mt(),b=Ot(v,{duration:J(()=>y.value===`reduce`?0:200)}),x=J(()=>{let e=new Map;for(let t of f.value.nodes){if(t.type!==`step`)continue;let n=(t.id===g.value?.id?h.value[t.id]:void 0)??m.value[t.id];n!==void 0&&e.set(t.position.y,Math.max(e.get(t.position.y)??-72,n-ete))}return[...e]}),S=e=>x.value.reduce((t,[n,r])=>n<e?t+r:t,0);function C(e){let t=e.data,a=c(t),o=t.path,s={triggers:t.kind===`start`?n.triggers??[]:t.triggers,expanded:!d.value&&a===n.open,editable:i.value,problem:o?n.problems?.[a]:void 0,onResize:t=>_(e.id,t)};return n.types?.length&&(s.onToggle=()=>r(`toggle`,a)),i.value&&o&&(s.onRename=e=>r(`rename`,o,e),s.onDuplicate=()=>r(`duplicate`,o),s.onRemove=()=>r(`remove`,o)),{...e,data:{...t,...s}}}let w=e=>{let t=g.value;return d.value||!t||!e.style?.width?!1:e.position.x<=t.position.x&&e.position.x+parseFloat(String(e.style.width))>=t.position.x+x9};function T(e){let t=g.value;if(d.value||!t)return 0;if(e.id===t.id||w(e))return-88;let n=t.position.x+x9/2,r=e.style?.width?parseFloat(String(e.style.width)):e.type===`step`?x9:32,i=e.position.x+r/2;return Math.abs(i-n)<x9/2?0:i<n?-88:88}let ee=J(()=>{let e=g.value;return f.value.nodes.map(t=>{let a=t;t.type===`add`?t={...t,data:{...t.data,types:s(t.data.insertAfter),editable:i.value,onInsert:e=>r(`insert`,t.data.insertAfter,e)}}:t.type===`step`&&(t=C(t));let o=n.marks?.[t.id];o&&(t={...t,data:{...t.data,mark:o}});let c=t.position.x+T(t),l=t=>e Line truncated
`),r=t.split(`
`),i=Array.from({length:n.length+1},()=>Array(r.length+1).fill(0));for(let e=n.length-1;e>=0;e--)for(let t=r.length-1;t>=0;t--)i[e][t]=n[e]===r[t]?i[e+1][t+1]+1:Math.max(i[e+1][t],i[e][t+1]);let a=[],o=0,s=0;for(;o<n.length&&s<r.length;)n[o]===r[s]?(a.push({kind:`same`,text:n[o++]}),s++):i[o+1][s]>=i[o][s+1]?a.push({kind:`del`,text:n[o++]}):a.push({kind:`add`,text:r[s++]});for(;o<n.length;)a.push({kind:`del`,text:n[o++]});for(;s<r.length;)a.push({kind:`add`,text:r[s++]});return a}function w9(e){let t=jY(e).toJS(),n=new Map;for(let r of pX(e).nodes){let{kind:e,path:i,stage:a,occurrence:o}=r.data;if(r.type!==`step`||e!==`step`||!i||a===void 0)continue;let s=t;for(let e of i)s=s?.[e];n.set(`${a}#${o??0}`,{node:r.id,signature:JSON.stringify(s??null)})}return n}function T9(e,t,n){let r=w9(e),i=w9(t),a={};for(let[e,t]of r){let r=i.get(e);r?r.signature!==t.signature&&(a[t.node]=`changed`):a[t.node]=n}return a}var lte={class:`flex flex-col gap-3 md:grid md:h-[calc(100dvh-17rem)] md:min-h-[26rem] md:grid-cols-[18rem_1fr]`},ute=[`aria-current`,`onClick`],dte={class:`flex items-center gap-2 text-sm`},fte={class:`font-mono text-xs text-fg-subtle`},pte=[`title`],mte={key:0,class:`px-3 py-2 text-sm text-fg-muted`},hte={key:1,class:`flex min-h-0 flex-col gap-2`},gte={class:`flex items-center gap-2 max-md:flex-wrap`},_te={key:0,class:`rounded-lg border border-border p-4 text-sm text-fg-muted`},vte={key:1,class:`min-h-0 flex-1 overflow-auto rounded-lg border border-border py-2 font-mono text-[13px] leading-6`},yte={class:`inline-block w-4 select-none text-fg-subtle`},bte={key:2,class:`grid min-h-0 flex-1 gap-3 max-md:flex-none md:grid-cols-2`},xte={class:`flex min-h-0 flex-col gap-1`},Ste={class:`text-xs font-medium text-fg-muted`},Cte={class:`min-h-0 flex-1 max-md:h-72 max-md:flex-none`},wte={class:`flex min-h-0 flex-col gap-1`},Tte={class:`min-h-0 flex-1 max-md:h-72 max-md:flex-none`},Ete=N({__name:`WorkflowHistory`,props:Xe({revisions:{},current:{},error:{}},{selected:{default:0},selectedModifiers:{},mode:{default:`yaml`},modeModifiers:{}}),emits:Xe([`restore`],[`update:selected`,`update:mode`]),setup(e,{emit:t}){let n=e,r=t,i=Me(e,`selected`),a=Me(e,`mode`);M(()=>n.revisions,e=>{e.some(e=>e.version===i.value)||(i.value=(e.find(e=>e.yaml!==n.current)??e[0])?.version??0)},{immediate:!0});let o=J(()=>n.revisions.find(e=>e.version===i.value)),s=J(()=>o.value?.yaml??null),c=J(()=>s.value===null?[]:cte(s.value,n.current)),l=J(()=>s.value!==null&&s.value===n.current),u=J(()=>s.value===null?{}:T9(s.value,n.current,`removed`)),d=J(()=>s.value===null?{}:T9(n.current,s.value,`added`)),f={added:`default`,edited:`secondary`,removed:`destructive`};return(t,n)=>(I(),A(`div`,lte,[L(`ol`,{class:R(B(U)(`min-h-0 divide-y divide-border overflow-y-auto rounded-lg border border-border`,e.revisions.length&&`max-md:hidden`)),"aria-label":`Revisions`},[(I(!0),A(H,null,j(e.revisions,e=>(I(),A(`li`,{key:e.version},[L(`button`,{type:`button`,class:R([`block w-full px-3 py-2 text-left hover:bg-secondary`,e.version===i.value&&`bg-secondary`]),"aria-current":e.version===i.value,onClick:t=>i.value=e.version},[L(`span`,dte,[L(`span`,fte,`v`+z(e.version),1),k(B(E),{variant:f[e.change]},{default:F(()=>[V(z(e.change),1)]),_:2},1032,[`variant`])]),L(`span`,{class:`mt-0.5 block truncate text-xs text-fg-muted`,title:e.at},z(e.actor||`unknown`)+` · `+z(e.source||`unknown`)+` · `+z(B(gh)(e.at)),9,pte)],10,ute)]))),128)),e.revisions.length?P(``,!0):(I(),A(`li`,mte,z(e.error||`No recorded changes`),1))],2),e.revisions.length?(I(),K(B(Tf),{key:0,"model-value":String(i.value),"onUpdate:modelValue":n[0]||=e=>i.value=Number(e)},{default:F(()=>[k(B(Mf),{class:`w-full md:hidden`,"aria-label":`Revision`},{default:F(()=>[k(B(Nf))]),_:1}),k(B(Ef),null,{default:F(()=>[(I(!0),A(H,null,j(e.revisions,e=>(I(),K(B(kf),{key:e.version,value:String(e.version)},{default:F(()=>[V(`v`+z(e.version)+` · `+z(e.change)+` · `+z(e.actor||`unknown`)+` · `+z(B(gh)(e.at)),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1},8,[`model-value`])):P(``,!0),o.value?(I(),A(`div`,hte,[L(`div`,gte,[k(B(Ax),{modelValue:a.value,"onUpdate:modelValue":n[1]||=e=>a.value=e},{default:F(()=>[k(B(Mx),null,{default:F(()=>[k(B(Nx),{value:`yaml`},{default:F(()=>[...n[3]||=[V(`YAML`,-1)]]),_:1}),k(B(Nx),{value:`canvas`},{default:F(()=>[...n[4]||=[V(`Canvas`,-1)]]),_:1})]),_:1})]),_:1},8,[`modelValue`]),k(B(Y),{type:`button`,size:`sm`,variant:`outline`,class:`ml-auto`,disabled:s.value===null||l.value,title:s.value===null?`Workflow removed`:void 0,onClick:n[2]||=e=>r(`restore`,s.value)},{default:F(()=>[k(B(Zu),{"data-icon":`inline-start`}),n[5]||=V(` Restore this version`,-1)]),_:1},8,[`disabled`,`title`])]),s.value===null?(I(),A(`p`,_te,`Workflow removed in this revision.`)):a.value===`yaml`?(I(),A(`pre`,vte,[L(`code`,null,[(I(!0),A(H,null,j(c.value,(e,t)=>(I(),A(`span`,{key:t,class:R([`block min-h-6 px-3 whitespace-pre-wrap`,{"bg-ok/10":e.kind===`add`,"bg-danger/10 text-danger":e.kind===`del`}])},[L(`span`,yte Line truncated
`),i=Array.from({length:n.length+1},()=>Array(r.length+1).fill(0));for(let e=n.length-1;e>=0;e--)for(let t=r.length-1;t>=0;t--)i[e][t]=n[e]===r[t]?i[e+1][t+1]+1:Math.max(i[e+1][t],i[e][t+1]);let a=[],o=0,s=0;for(;o<n.length&&s<r.length;)n[o]===r[s]?(a.push({kind:`same`,text:n[o++]}),s++):i[o+1][s]>=i[o][s+1]?a.push({kind:`del`,text:n[o++]}):a.push({kind:`add`,text:r[s++]});for(;o<n.length;)a.push({kind:`del`,text:n[o++]});for(;s<r.length;)a.push({kind:`add`,text:r[s++]});return a}function w9(e){let t=OY(e).toJS(),n=new Map;for(let r of uX(e).nodes){let{kind:e,path:i,stage:a,occurrence:o}=r.data;if(r.type!==`step`||e!==`step`||!i||a===void 0)continue;let s=t;for(let e of i)s=s?.[e];n.set(`${a}#${o??0}`,{node:r.id,signature:JSON.stringify(s??null)})}return n}function T9(e,t,n){let r=w9(e),i=w9(t),a={};for(let[e,t]of r){let r=i.get(e);r?r.signature!==t.signature&&(a[t.node]=`changed`):a[t.node]=n}return a}var ote={class:`flex flex-col gap-3 md:grid md:h-[calc(100dvh-17rem)] md:min-h-[26rem] md:grid-cols-[18rem_1fr]`},ste=[`aria-current`,`onClick`],cte={class:`flex items-center gap-2 text-sm`},lte={class:`font-mono text-xs text-fg-subtle`},ute=[`title`],dte={key:0,class:`px-3 py-2 text-sm text-fg-muted`},fte={key:1,class:`flex min-h-0 flex-col gap-2`},pte={class:`flex items-center gap-2 max-md:flex-wrap`},mte={key:0,class:`rounded-lg border border-border p-4 text-sm text-fg-muted`},hte={key:1,class:`min-h-0 flex-1 overflow-auto rounded-lg border border-border py-2 font-mono text-[13px] leading-6`},gte={class:`inline-block w-4 select-none text-fg-subtle`},_te={key:2,class:`grid min-h-0 flex-1 gap-3 max-md:flex-none md:grid-cols-2`},vte={class:`flex min-h-0 flex-col gap-1`},yte={class:`text-xs font-medium text-fg-muted`},bte={class:`min-h-0 flex-1 max-md:h-72 max-md:flex-none`},xte={class:`flex min-h-0 flex-col gap-1`},Ste={class:`min-h-0 flex-1 max-md:h-72 max-md:flex-none`},Cte=N({__name:`WorkflowHistory`,props:Xe({revisions:{},current:{},error:{}},{selected:{default:0},selectedModifiers:{},mode:{default:`yaml`},modeModifiers:{}}),emits:Xe([`restore`],[`update:selected`,`update:mode`]),setup(e,{emit:t}){let n=e,r=t,i=Me(e,`selected`),a=Me(e,`mode`);M(()=>n.revisions,e=>{e.some(e=>e.version===i.value)||(i.value=(e.find(e=>e.yaml!==n.current)??e[0])?.version??0)},{immediate:!0});let o=J(()=>n.revisions.find(e=>e.version===i.value)),s=J(()=>o.value?.yaml??null),c=J(()=>s.value===null?[]:ate(s.value,n.current)),l=J(()=>s.value!==null&&s.value===n.current),u=J(()=>s.value===null?{}:T9(s.value,n.current,`removed`)),d=J(()=>s.value===null?{}:T9(n.current,s.value,`added`)),f={added:`default`,edited:`secondary`,removed:`destructive`};return(t,n)=>(I(),A(`div`,ote,[L(`ol`,{class:R(B(U)(`min-h-0 divide-y divide-border overflow-y-auto rounded-lg border border-border`,e.revisions.length&&`max-md:hidden`)),"aria-label":`Revisions`},[(I(!0),A(H,null,j(e.revisions,e=>(I(),A(`li`,{key:e.version},[L(`button`,{type:`button`,class:R([`block w-full px-3 py-2 text-left hover:bg-secondary`,e.version===i.value&&`bg-secondary`]),"aria-current":e.version===i.value,onClick:t=>i.value=e.version},[L(`span`,cte,[L(`span`,lte,`v`+z(e.version),1),k(B(E),{variant:f[e.change]},{default:F(()=>[V(z(e.change),1)]),_:2},1032,[`variant`])]),L(`span`,{class:`mt-0.5 block truncate text-xs text-fg-muted`,title:e.at},z(e.actor||`unknown`)+` · `+z(e.source||`unknown`)+` · `+z(B(hh)(e.at)),9,ute)],10,ste)]))),128)),e.revisions.length?P(``,!0):(I(),A(`li`,dte,z(e.error||`No recorded changes`),1))],2),e.revisions.length?(I(),K(B(wf),{key:0,"model-value":String(i.value),"onUpdate:modelValue":n[0]||=e=>i.value=Number(e)},{default:F(()=>[k(B(jf),{class:`w-full md:hidden`,"aria-label":`Revision`},{default:F(()=>[k(B(Mf))]),_:1}),k(B(Tf),null,{default:F(()=>[(I(!0),A(H,null,j(e.revisions,e=>(I(),K(B(Of),{key:e.version,value:String(e.version)},{default:F(()=>[V(`v`+z(e.version)+` · `+z(e.change)+` · `+z(e.actor||`unknown`)+` · `+z(B(hh)(e.at)),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1},8,[`model-value`])):P(``,!0),o.value?(I(),A(`div`,fte,[L(`div`,pte,[k(B(Ax),{modelValue:a.value,"onUpdate:modelValue":n[1]||=e=>a.value=e},{default:F(()=>[k(B(Mx),null,{default:F(()=>[k(B(Nx),{value:`yaml`},{default:F(()=>[...n[3]||=[V(`YAML`,-1)]]),_:1}),k(B(Nx),{value:`canvas`},{default:F(()=>[...n[4]||=[V(`Canvas`,-1)]]),_:1})]),_:1})]),_:1},8,[`modelValue`]),k(B(Y),{type:`button`,size:`sm`,variant:`outline`,class:`ml-auto`,disabled:s.value===null||l.value,title:s.value===null?`Workflow removed`:void 0,onClick:n[2]||=e=>r(`restore`,s.value)},{default:F(()=>[k(B(Xu),{"data-icon":`inline-start`}),n[5]||=V(` Restore this version`,-1)]),_:1},8,[`disabled`,`title`])]),s.value===null?(I(),A(`p`,mte,`Workflow removed in this revision.`)):a.value===`yaml`?(I(),A(`pre`,hte,[L(`code`,null,[(I(!0),A(H,null,j(c.value,(e,t)=>(I(),A(`span`,{key:t,class:R([`block min-h-6 px-3 whitespace-pre-wrap`,{"bg-ok/10":e.kind===`add`,"bg-danger/10 text-danger":e.kind===`del`}])},[L(`span`,gte Line truncated
`);s=n.pop()||``;for(let e of n){let t=e.split(`
`).find(e=>e.startsWith(`data: `));if(!t)continue;let n=JSON.parse(t.slice(6));if(n.type===`delta`&&(a.value+=n.text??``),n.type===`tool`&&n.tool&&(o.value=n.tool.replaceAll(`_`,` `)),n.type===`done`&&(c=!0,a.value||=n.text??``),n.type===`error`)throw Error(n.text)}if(t)break}if(!c)throw Error(`the turn ended early`)}catch(e){e.name!==`AbortError`&&(s.value=!0,a.value=String(e.message||e))}finally{c.value=!1,o.value=``,l=void 0,r(`proposed`)}}}return(e,t)=>(I(),A(`div`,Nte,[a.value?(I(),A(`p`,{key:0,class:R([`max-h-40 overflow-y-auto whitespace-pre-wrap border-b border-border px-3 py-2 text-sm`,s.value&&`text-danger`]),role:s.value?`alert`:`status`},z(a.value),11,Pte)):P(``,!0),L(`form`,{class:`flex items-center gap-2 px-3 py-2`,onSubmit:pt(u,[`prevent`])},[k(B(sd),{class:`size-4 shrink-0 text-primary`,"aria-hidden":`true`}),je(L(`input`,{"onUpdate:modelValue":t[0]||=e=>i.value=e,class:`min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-fg-subtle`,placeholder:`Build with Archie`,"aria-label":`Build with Archie`,disabled:c.value},null,8,Fte),[[gt,i.value]]),c.value?(I(),A(`span`,Ite,[k(B(ab)),V(z(o.value),1)])):P(``,!0),c.value?(I(),K(B(Y),{key:1,type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Stop`,onClick:t[1]||=e=>B(l)?.abort()},{default:F(()=>[k(B(ld))]),_:1})):(I(),K(B(Y),{key:2,type:`submit`,size:`icon-sm`,"aria-label":`Send`,disabled:!i.value.trim()},{default:F(()=>[k(B(au))]),_:1},8,[`disabled`]))],32)]))}}),Rte=20;function zte(e){let t=q([]),n=q(``),r=q([]),i=q(0),a=!1,o=q(``),s=q(!1),c=0;async function l(){let r=e.value,i=++c;s.value=!0;try{let s=r?await X.taskPage({workflow:r,limit:Rte}):null;if(e.value!==r||i!==c)return;t.value=(s?.tasks??[]).sort((e,t)=>Number(t.id)-Number(e.id)),o.value=``,(!a||n.value&&!t.value.some(e=>String(e.id)===n.value))&&(n.value=t.value[0]?String(t.value[0].id):``)}catch(t){e.value===r&&i===c&&(o.value=String(t.message||t))}finally{i===c&&(s.value=!1)}}async function u(){if(!n.value){r.value.length&&(r.value=[]),i.value=0;return}let e=n.value,t=await X.taskAttempts(e).catch(()=>null);if(n.value!==e)return;let a=[...t?.attempts??[]].sort((e,t)=>t.attempt-e.attempt)[0],o=a?.stages??[];JSON.stringify(o)!==JSON.stringify(r.value)&&(r.value=o),i.value=a?.attempt??0}function d(e){a=!0,n.value=e}async function f(){await l(),await u()}M(e,()=>{a=!1,t.value=[],n.value=``,o.value=``,f()},{immediate:!0}),M(n,()=>{r.value=[],i.value=0,u()}),Ch(`tasks`,()=>void f(),300);let p=J(()=>t.value.find(e=>String(e.id)===n.value));async function m(e){a=!0,n.value=String(e),await f()}return{runs:t,error:o,loading:s,watched:n,watchedRun:p,stages:r,attempt:i,pick:d,follow:m,refresh:f}}function O9(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function k9(e){try{return MY(e)}catch{return null}}function Bte(e,t){let n=[];for(let[r,i]of Object.entries(t.routes))i===e&&n.push(r==="default"?{kind:`issue`,label:`Unlabelled issues`,detail:`anything no label routes elsewhere`}:{kind:`issue`,label:`Issues labelled ${r}`});for(let r of t.bindings)r.workflow===e&&n.push({kind:`event`,label:r.name||`Event binding`,detail:r.matcher?.source,binding:r});for(let r of t.playbooks){let t=k9(r.yaml);if(!O9(t)||!Array.isArray(t.actions)||!t.actions.some(t=>O9(t)&&t.workflow===e))continue;let i=O9(t.trigger)?t.trigger:{},a=Array.isArray(i.labels)?i.labels.join(`, `):``;n.push({kind:`playbook`,label:r.id,detail:[i.kind,a].filter(Boolean).join(` · `)})}for(let r of t.definitions){if(r.id===e)continue;let t=Vte(k9(r.yaml),e);t&&n.push({kind:`workflow`,label:r.id,detail:t})}return n}function Vte(e,t){let n=(O9(e)&&Array.isArray(e.steps)?e.steps:[]).flatMap(e=>IY(e)?.branches.flatMap(([,e])=>e)??[e]);for(let e of n){if(!O9(e)||!O9(e.settings))continue;let r=e.settings;switch(e.type){case`workflow.call`:if(r.workflow===t)return`calls it`;break;case`workflow.handoff`:if(r.workflow===t||Hte(n,r.workflow).includes(t))return`hands off to it`;break;case`human.approve`:if(r.then===t)return`runs it once approved`}}return``}function Hte(e,t){let n=typeof t==`string`?/\{\{\s*steps\.([\w-]+)\.result\.([\w-]+)\s*\}\}/.exec(t):null;if(!n)return[];let r=e.find(e=>O9(e)&&e.id===n[1]),i=O9(r)&&O9(r.settings)?r.settings.result:void 0,a=O9(i)&&O9(i.properties)?i.properties[n[2]]:void 0;return O9(a)&&Array.isArray(a.enum)?a.enum.map(String):[]}function Ute(e){let t=Pg(),n=JA(),r=q([]);async function i(){let e=await X.bindings().catch(()=>null);r.value=e?.bindings??[]}return Ue(i),{triggers:J(()=>Bte(e.value,{routes:n.intakeRoutes,bindings:r.value,playbooks:t.stateFor(`eda-playbooks`).resource?.value?.playbooks??[],definitions:n.collection.definitions})),reload:i}}var Wte={class:`workflow-editor-toolbar flex shrink-0 items-center gap-2 max-sm:grid max-sm:grid-cols-[1fr_auto]`},Gte={class:`ml-1 font-mono text-xs text-fg-subtle`},Kte={key:0,class:`shrink-0 text-xs font-medium text-fg-muted xl:hidden`},qte={role:`group`,"aria-label":`Runs`,class:`workflow-run-actions ml-auto flex min-w-0 items-center gap-1Line truncated
`).find(e=>e.startsWith(`data: `));if(!t)continue;let n=JSON.parse(t.slice(6));if(n.type===`delta`&&(a.value+=n.text??``),n.type===`tool`&&n.tool&&(o.value=n.tool.replaceAll(`_`,` `)),n.type===`done`&&(c=!0,a.value||=n.text??``),n.type===`error`)throw Error(n.text)}if(t)break}if(!c)throw Error(`the turn ended early`)}catch(e){e.name!==`AbortError`&&(s.value=!0,a.value=String(e.message||e))}finally{c.value=!1,o.value=``,l=void 0,r(`proposed`)}}}return(e,t)=>(I(),A(`div`,Ate,[a.value?(I(),A(`p`,{key:0,class:R([`max-h-40 overflow-y-auto whitespace-pre-wrap border-b border-border px-3 py-2 text-sm`,s.value&&`text-danger`]),role:s.value?`alert`:`status`},z(a.value),11,jte)):P(``,!0),L(`form`,{class:`flex items-center gap-2 px-3 py-2`,onSubmit:pt(u,[`prevent`])},[k(B(od),{class:`size-4 shrink-0 text-primary`,"aria-hidden":`true`}),je(L(`input`,{"onUpdate:modelValue":t[0]||=e=>i.value=e,class:`min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-fg-subtle`,placeholder:`Build with Archie`,"aria-label":`Build with Archie`,disabled:c.value},null,8,Mte),[[gt,i.value]]),c.value?(I(),A(`span`,Nte,[k(B(ab)),V(z(o.value),1)])):P(``,!0),c.value?(I(),K(B(Y),{key:1,type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Stop`,onClick:t[1]||=e=>B(l)?.abort()},{default:F(()=>[k(B(cd))]),_:1})):(I(),K(B(Y),{key:2,type:`submit`,size:`icon-sm`,"aria-label":`Send`,disabled:!i.value.trim()},{default:F(()=>[k(B(iu))]),_:1},8,[`disabled`]))],32)]))}}),Fte=20;function Ite(e){let t=q([]),n=q(``),r=q([]),i=q(0),a=!1,o=q(``),s=q(!1),c=0;async function l(){let r=e.value,i=++c;s.value=!0;try{let s=r?await X.taskPage({workflow:r,limit:Fte}):null;if(e.value!==r||i!==c)return;t.value=(s?.tasks??[]).sort((e,t)=>Number(t.id)-Number(e.id)),o.value=``,(!a||n.value&&!t.value.some(e=>String(e.id)===n.value))&&(n.value=t.value[0]?String(t.value[0].id):``)}catch(t){e.value===r&&i===c&&(o.value=String(t.message||t))}finally{i===c&&(s.value=!1)}}async function u(){if(!n.value){r.value.length&&(r.value=[]),i.value=0;return}let e=n.value,t=await X.taskAttempts(e).catch(()=>null);if(n.value!==e)return;let a=[...t?.attempts??[]].sort((e,t)=>t.attempt-e.attempt)[0],o=a?.stages??[];JSON.stringify(o)!==JSON.stringify(r.value)&&(r.value=o),i.value=a?.attempt??0}function d(e){a=!0,n.value=e}async function f(){await l(),await u()}M(e,()=>{a=!1,t.value=[],n.value=``,o.value=``,f()},{immediate:!0}),M(n,()=>{r.value=[],i.value=0,u()}),Sh(`tasks`,()=>void f(),300);let p=J(()=>t.value.find(e=>String(e.id)===n.value));async function m(e){a=!0,n.value=String(e),await f()}return{runs:t,error:o,loading:s,watched:n,watchedRun:p,stages:r,attempt:i,pick:d,follow:m,refresh:f}}function O9(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function k9(e){try{return kY(e)}catch{return null}}function Lte(e,t){let n=[];for(let[r,i]of Object.entries(t.routes))i===e&&n.push(r==="default"?{kind:`issue`,label:`Unlabelled issues`,detail:`anything no label routes elsewhere`}:{kind:`issue`,label:`Issues labelled ${r}`});for(let r of t.bindings)r.workflow===e&&n.push({kind:`event`,label:r.name||`Event binding`,detail:r.matcher?.source,binding:r});for(let r of t.playbooks){let t=k9(r.yaml);if(!O9(t)||!Array.isArray(t.actions)||!t.actions.some(t=>O9(t)&&t.workflow===e))continue;let i=O9(t.trigger)?t.trigger:{},a=Array.isArray(i.labels)?i.labels.join(`, `):``;n.push({kind:`playbook`,label:r.id,detail:[i.kind,a].filter(Boolean).join(` · `)})}for(let r of t.definitions){if(r.id===e)continue;let t=Rte(k9(r.yaml),e);t&&n.push({kind:`workflow`,label:r.id,detail:t})}return n}function Rte(e,t){let n=(O9(e)&&Array.isArray(e.steps)?e.steps:[]).flatMap(e=>NY(e)?.branches.flatMap(([,e])=>e)??[e]);for(let e of n){if(!O9(e)||!O9(e.settings))continue;let r=e.settings;switch(e.type){case`workflow.call`:if(r.workflow===t)return`calls it`;break;case`workflow.handoff`:if(r.workflow===t||zte(n,r.workflow).includes(t))return`hands off to it`;break;case`human.approve`:if(r.then===t)return`runs it once approved`}}return``}function zte(e,t){let n=typeof t==`string`?/\{\{\s*steps\.([\w-]+)\.result\.([\w-]+)\s*\}\}/.exec(t):null;if(!n)return[];let r=e.find(e=>O9(e)&&e.id===n[1]),i=O9(r)&&O9(r.settings)?r.settings.result:void 0,a=O9(i)&&O9(i.properties)?i.properties[n[2]]:void 0;return O9(a)&&Array.isArray(a.enum)?a.enum.map(String):[]}function Bte(e){let t=Ng(),n=JA(),r=q([]);async function i(){let e=await X.bindings().catch(()=>null);r.value=e?.bindings??[]}return Ue(i),{triggers:J(()=>Lte(e.value,{routes:n.intakeRoutes,bindings:r.value,playbooks:t.stateFor(`eda-playbooks`).resource?.value?.playbooks??[],definitions:n.collection.definitions})),reload:i}}var Vte={class:`workflow-editor-toolbar flex shrink-0 items-center gap-2 max-sm:grid max-sm:grid-cols-[1fr_auto]`},Hte={class:`ml-1 font-mono text-xs text-fg-subtle`},Ute={key:0,class:`shrink-0 text-xs font-medium text-fg-muted xl:hidden`},Wte={role:`group`,"aria-label":`Runs`,class:`workflow-run-actions ml-auto flex min-w-0 items-center gap-1Line truncated
+1 -1
View File
@@ -120,7 +120,7 @@ const startedAt = computed(() => {
</Empty>
<div v-else>
<div class="mb-4 flex flex-wrap items-center gap-3">
<div class="flex flex-wrap items-center gap-3" :class="stages.length || attempt.error ? 'mb-4' : undefined">
<Badge :variant="meta.kind">{{ meta.label }}</Badge>
<span class="text-xs text-fg-muted">{{ startedAt }}</span>
<span v-if="timeLimit" class="text-xs text-fg-muted">{{
+1 -1
View File
@@ -23,7 +23,7 @@ import { RUN_TABS } from "./task-run";
v-for="tab in RUN_TABS"
:key="tab.id"
:value="tab.id"
class="flex-none px-3"
class="flex-none px-2"
>{{
tab.label
}}</TabsTrigger>
+1 -1
View File
@@ -147,7 +147,7 @@ const headerActions = computed(() =>
<dl
v-if="io.length || run.attempts?.called_by"
class="mt-3 grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 text-xs"
class="mt-3 grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 rounded-xl bg-card px-4 py-3 text-xs ring-1 ring-foreground/10"
>
<template v-if="run.attempts?.called_by">
<dt class="text-fg-subtle">Called by</dt>
+5 -4
View File
@@ -16,12 +16,13 @@ const run = useTaskRun();
const attempts = computed(() => [...(run.attempts?.attempts ?? [])].reverse());
const dot = (status?: string) => STATUS_FILL[stageStatusMeta(status).kind];
const panel = "rounded-xl bg-card p-4 ring-1 ring-foreground/10";
const heading = "mb-2 text-[11px] font-medium tracking-[0.06em] text-fg-subtle uppercase";
</script>
<template>
<aside class="grid gap-6" aria-label="Task details">
<section v-if="attempts.length" aria-labelledby="rail-attempts">
<aside class="grid gap-4" aria-label="Task details">
<section v-if="attempts.length" :class="panel" aria-labelledby="rail-attempts">
<h2 id="rail-attempts" :class="heading">Attempts</h2>
<ul class="flex flex-col gap-0.5">
<li v-for="a in attempts" :key="a.attempt">
@@ -47,12 +48,12 @@ const heading = "mb-2 text-[11px] font-medium tracking-[0.06em] text-fg-subtle u
</ul>
</section>
<section aria-labelledby="rail-stages">
<section :class="panel" aria-labelledby="rail-stages">
<h2 id="rail-stages" :class="heading">Stages</h2>
<StageRail :state="run.attempts" />
</section>
<section v-if="run.task" aria-labelledby="rail-details">
<section v-if="run.task" :class="panel" aria-labelledby="rail-details">
<h2 id="rail-details" :class="heading">Details</h2>
<dl class="grid grid-cols-[6.5rem_1fr] gap-x-3 gap-y-2 text-sm">
<dt class="text-fg-subtle">Workflow</dt>
+2 -2
View File
@@ -28,8 +28,8 @@ export interface TaskRunTab {
*/
export const RUN_TABS: TaskRunTab[] = [
{ id: "log", label: "Log" },
{ id: "changes", label: "Changed files" },
{ id: "config", label: "Configuration" },
{ id: "changes", label: "Changes" },
{ id: "config", label: "Config" },
{ id: "debug", label: "Debug" },
{ id: "sandbox", label: "Sandbox" },
];