fix(webui): return an interrupted stage's cause and show it in a warning tone

This commit is contained in:
sam committed 2026-10-19 02:05:45 +11:00
1 parent f9861d3ea5
commit eade816ee0
4 files changed
+107 -82

No files matched your search

+2 -1
View File
@@ -297,7 +297,8 @@ func stageViewsFromSteps(steps []task.StepExecution, inFlight bool) []taskStageV
continue
}
view := taskStageView{ID: s.ID, Name: s.Name, Seq: len(stages), Status: mapStepStatus(s.Status, inFlight)}
if s.Status == taskstate.StepFailed {
// A skipped step's detail is its when condition, not a cause.
if s.Status == taskstate.StepFailed || s.Status == taskstate.StepInterrupted {
view.Error = s.Detail
}
if !s.StartedAt.IsZero() {
+19
View File
@@ -34,3 +34,22 @@ func TestEarlyAttemptHistory(t *testing.T) {
})
}
}
func TestStageErrorByStatus(t *testing.T) {
for _, tc := range []struct {
status taskstate.StepStatus
want string
}{
{taskstate.StepFailed, "boom"},
{taskstate.StepInterrupted, "boom"},
{taskstate.StepSkipped, ""},
{taskstate.StepSucceeded, ""},
} {
t.Run(string(tc.status), func(t *testing.T) {
steps := []task.StepExecution{{Kind: task.StepKindStage, Name: "build", Status: tc.status, Detail: "boom"}}
if got := stageViewsFromSteps(steps, false)[0].Error; got != tc.want {
t.Fatalf("error = %q, want %q", got, tc.want)
}
})
}
}
+80 -80
View File
@@ -1,79 +1,79 @@
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&&(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
`).find(e=>e.startsWith(`data: `));if(!t)continue;let n=JSON.parse(t.slice(6));if(n.session_id&&(Id.value=n.session_id),n.type===`delta`&&(o+=n.text,Vd.value=Vd.value?{...Vd.value,text:o}:null),(n.type===`tool`||n.type===`navigate`)&&(a=[...a,n],Vd.value=Vd.value?{...Vd.value,tools:a}:null),n.type===`ask`&&n.ask&&(clearTimeout(l),Vd.value=Vd.value?{...Vd.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`);Ld.value=[...Ld.value,{from:`assistant`,text:o,tool_calls:a}],Vd.value=null,zd.value=`Ready`,await tf()}catch(e){let t=e;t.name===`AbortError`&&!c?(Vd.value={text:`Turn stopped.`,tools:a,isError:!1,turn:r,isRetry:i},zd.value=`Stopped`):(Vd.value={text:`Unable to complete that turn: ${t.message||t}`,tools:a,isError:!0,turn:r?kd(r):void 0,isRetry:i},zd.value=`Error. Retry available.`)}finally{clearTimeout(l),Nd=null,$d=null,Bd.value=!1}}function mf(){zd.value=`Stopping…`,Id.value&&X.chatCancel(Id.value).catch(()=>{}),ef()}function hf(){Ue(()=>{tf().catch(e=>{zd.value=e.message||`Chat unavailable`})}),Ke(()=>{ef()})}async function gf(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 pf({textOverride:`🎤 Voice message`,voice:{data:btoa(n),mime_type:e.type||`audio/webm`}})}var _f=[`aria-label`,`title`,`aria-expanded`,`aria-controls`],vf=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(jd),onClick:i[0]||=e=>n(`toggle`)},[L(`span`,{"aria-hidden":`true`,class:R(r(!e.open))},[k(B(Lu),{size:22})],2),L(`span`,{"aria-hidden":`true`,class:R(r(e.open))},[k(B(vd),{size:22})],2)],8,_f))}}),yf=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(ss),W({"data-slot":`popover`},B(n)),{default:F(t=>[G(e.$slots,`default`,Ye(Ce(t)))]),_:3},16))}}),bf=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(fs),null,{default:F(()=>[k(B(ds),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}))}}),xf=N({__name:`PopoverTrigger`,props:{asChild:{type:Boolean},as:{}},setup(e){let t=e;return(e,n)=>(I(),K(B(ps),W({"data-slot":`popover-trigger`},t),{default:F(()=>[G(e.$slots,`default`)]),_:3},16))}}),Sf=N({__name:`ChatSessionActions`,setup(e){let t=q(!1);Zd(t);function n(e){t.value=!1,rf(e)}function r(e,n){t.value=!1,af(e,n)}return(e,i)=>(I(),K(B(yf),{open:t.value,"onUpdate:open":i[5]||=e=>t.value=e},{default:F(()=>[k(B(xf),{"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(Su))]),_:1})]),_:1}),k(B(bf),{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:hm(r.join(` `))}),r=[])},s=()=>{i&&=(t.push({kind:i.tag,items:i.items.map(e=>hm(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=_m(c),u=e+1<n.length?_m(n[e+1]):null;if(l&&u&&vm(u)&&l.length===u.length){o(),s();let r=[];for(e+=2;e<n.length;e++){let t=_m(n[e]);if(!t||t.length!==l.length){e--;break}r.push(t)}t.push({kind:`table`,head:l.map(e=>hm(e)),rows:r.map(e=>e.map(e=>hm(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:hm(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:hm(c.replace(/^>\s?/,``))})):r.push(c)}return o(),s(),a&&t.push({kind:`pre`,code:a.join(`
`)}),t}function _m(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 vm(e){return e.every(e=>/^:?-{3,}:?$/.test(e))}var ym={class:`[overflow-wrap:anywhere]`},bm={key:0,class:`my-2 overflow-auto rounded-md border border-border bg-background/60 p-3`},xm={class:`font-mono text-[0.85em]`},Sm={key:1,class:`my-3 w-full border-collapse text-[0.92em]`},Cm={key:2,class:`my-2 border-l-[3px] border-primary pl-3 text-fg-muted`},wm={key:3,class:`mt-1 mb-2 text-xl leading-tight font-semibold tracking-[-0.02em]`},Tm={key:4,class:`mt-1 mb-2 text-lg leading-tight font-semibold tracking-[-0.02em]`},Em={key:5,class:`mt-1 mb-2 text-base leading-tight font-semibold tracking-[-0.02em]`},Dm={key:6,class:`my-2.5 flex list-disc flex-col gap-1 pl-5`},Om={key:7,class:`my-2.5 flex list-decimal flex-col gap-1 pl-5`},km={key:8,class:`mb-2.5 last:mb-0`},Am=N({__name:`ChatMarkdown`,props:{text:{}},setup(e){let t=e,n=J(()=>gm(t.text));return(e,t)=>(I(),A(`div`,ym,[(I(!0),A(H,null,j(n.value,(e,t)=>(I(),A(H,{key:t},[e.kind===`pre`?(I(),A(`pre`,bm,[L(`code`,xm,z(e.code),1)])):e.kind===`table`?(I(),A(`table`,Sm,[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(pm,{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(pm,{inline:e},null,8,[`inline`])]))),128))]))),128))])])):e.kind===`blockquote`?(I(),A(`blockquote`,Cm,[k(pm,{inline:e.inline},null,8,[`inline`])])):e.kind===`h1`?(I(),A(`h1`,wm,[k(pm,{inline:e.inline},null,8,[`inline`])])):e.kind===`h2`?(I(),A(`h2`,Tm,[k(pm,{inline:e.inline},null,8,[`inline`])])):e.kind===`h3`?(I(),A(`h3`,Em,[k(pm,{inline:e.inline},null,8,[`inline`])])):e.kind===`ul`?(I(),A(`ul`,Dm,[(I(!0),A(H,null,j(e.items,(e,t)=>(I(),A(`li`,{key:t},[k(pm,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`ol`?(I(),A(`ol`,Om,[(I(!0),A(H,null,j(e.items,(e,t)=>(I(),A(`li`,{key:t},[k(pm,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`p`?(I(),A(`p`,km,[k(pm,{inline:e.inline},null,8,[`inline`])])):P(``,!0)],64))),128))]))}}),jm={class:`truncate`},Mm=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(nu),{"aria-hidden":`true`,class:`size-3.5 shrink-0`}),L(`span`,jm,z(e.label||e.path),1)]),_:1},8,[`to`,`title`])}}}),Nm={key:1,class:`flex items-baseline gap-1.5 [overflow-wrap:anywhere]`},Pm={class:`font-semibold text-foreground`},Fm={key:0,class:`font-mono text-[0.95em] text-fg-subtle`},Im=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(Mm,{key:0,path:e.tool.path,label:e.tool.label},null,8,[`path`,`label`])):(I(),A(`div`,Nm,[k(B(_d),{"aria-hidden":`true`,class:`size-3.5 shrink-0 self-center text-fg-subtle`}),L(`span`,Pm,z(n.value),1),r.value?(I(),A(`code`,Fm,z(r.value),1)):P(``,!0),L(`span`,{class:R(B(U)(`text-fg-muted`,i.value&&`text-danger`))},z(a.value),3)]))}}),Lm={key:0,class:`mb-2 grid gap-0.5 text-xs`},Rm={key:1,class:`mb-2 flex flex-wrap gap-1.5`},zm={key:3,class:`whitespace-pre-wrap`},Bm=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`,Lm,[(I(!0),A(H,null,j(e.tools,(t,n)=>(I(),K(Im,{key:n,tool:t,streaming:e.streaming},null,8,[`tool`,`streaming`]))),128))])):P(``,!0),e.media.length?(I(),A(`div`,Rm,[(I(!0),A(H,null,j(e.media,(e,t)=>(I(),K(om,{key:t,attachment:e},null,8,[`attachment`]))),128))])):P(``,!0),e.assistant?(I(),K(Am,{key:2,text:e.text},null,8,[`text`])):(I(),A(`div`,zm,z(e.text),1)),G(t.$slots,`default`)],2)],2))}}),Vm={class:`text-sm`},Hm={key:0,class:`mt-1 text-fg-muted`},Um={key:1,class:`mt-2 flex flex-wrap gap-2`},Wm=N({__name:`ChatChooseCard`,props Line truncated
`).map(e=>e.trim()).find(Boolean)||``,i=r.length>Tv?`${r.slice(0,Tv).trimEnd()}…`:r;return{text:i,full:n,truncated:i!==n}}function Dv(e){return String(e||`event`).replaceAll(`_`,` `).replace(/\b\w/g,e=>e.toUpperCase())}function Ov(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 kv(e){let t=Number(e);return!Number.isFinite(t)||t<=0?``:t.toLocaleString(`en-US`)}function Av(e){return typeof e==`string`?e:``}function jv(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=Ov(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,Av(t.error),Av(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:[Av(t.previous_stage)&&`after ${Av(t.previous_stage)}`,Av(t.previous_reason)].filter(Boolean).join(`: `)||e.detail||``}}if(e.kind===`agent_finish`){let r=kv(t.iterations),i=kv(t.tokens),a=Number(t.cached_tokens)||0,o=kv((Number(t.prompt_tokens)||0)-a),s=kv(t.completion_tokens),c=kv(t.cached_tokens),l=[r&&`${r} iterations`,i&&`${i} tokens`,o&&`${o} fresh prompt`,s&&`${s} completion`,c&&`${c} cached`,Av(t.model)].filter(Boolean);return{title:`Agent ${Av(t.status)||`finished`}: ${n}`,detail:l.join(` · `)||e.detail||``}}if(e.kind===`remediation_round`){let e=Number(t.of),n=Av(t.author);return{title:`Remediation ${Av(t.round)}${e>0?` of ${e}`:``}`,detail:[n&&`answers ${n}'s review`,t.review_id?`#${Av(t.review_id)}`:``].filter(Boolean).join(` `)}}if(e.kind===`review_approved`){let e=Av(t.pr_number);return{title:`Pull request approved`,detail:[Av(t.author),e&&`#${e}`].filter(Boolean).join(` · `)}}if(e.kind===`step_retried`)return{title:`Attempt ${Av(t.attempt)} of ${Av(t.of)} failed: ${e.stage||`step`}`,detail:Av(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=Av(t.source),n=Av(t.capture_id),r=[{label:`binding ${Av(t.binding_name)||Av(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 ${Av(t.captured_after)}`:``].filter(Boolean).join(` · `)}}return{title:Dv(e.kind||e.type),detail:e.detail||``}}var Mv=[`title`],Nv=N({__name:`ActivityRow`,props:{event:{}},emits:[`open`],setup(e,{emit:t}){let n=wv();n.watchIdentities();let r=e,i=t,a=pv(),o=J(()=>a.taskIDFor(r.event)),s=J(()=>Ev(r.event,n.identityName));function c(){o.value>0&&i(`open`,o.value)}let l=J(()=>r.event.at?ph(r.event.at):`–`);return(e,t)=>(I(),K(B(bv),{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(jv)({...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,Mv)]),_:1}),k(B(Q),null,{default:F(()=>[V(z(l.value),1)]),_:1})]),_:1},8,[`class`,`role`,`tabindex`,`title`,`onKeydown`]))}}),Pv=[{value:`all`,label:`All`},{value:`tasks`,label:`Tasks`},{value:`system`,label:`System`}];function Fv(e){return(Number(e?.task_id)||0)>0}function Iv(e,t){return t===`tasks`?Fv(e):t!==`system`||!Fv(e)}function Lv(e,t){return e.filter(e=>Iv(e,t))}function Rv(e,t){return e>0?``:t===`all`?`Waiting for activity`:t===`tasks`?`No task events yet`:`No system events yet`}function zv(e,t){return`${e}:${t??0}`}function Bv(e){let t=[];for(let n of e){let e=n.kind||n.type||`event`,r=Number(n.task_id)||0,i=zv(Ev(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 Vv={key:0,class:`font-normal text-fg-subtle`},Hv={role:`region`,"aria-label":`Activity`,"ari Line truncated
`,1)[0]??``;return t.length>80?`${t.slice(0,79)}…`:t}function ab(e){return(e?.merged||0)+(e?.completed||0)}function ob(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 sb(e,t){return e.filter(e=>e.required&&!(t[e.name]??``).trim()).map(e=>e.name)}function cb(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 lb(e,t){let n={};for(let r of e){let e=t[r.name];e!==void 0&&e!==``&&(n[r.name]=cb(e,r.type))}return n}var ub=[`onKeydown`],db={key:0,class:`text-sm text-danger`,role:`alert`},fb={key:1,class:`grid gap-1.5`},pb=[`for`],mb={key:0,class:`font-normal text-fg-subtle`},hb=[`id`],gb=[`value`],_b={key:0,class:`text-xs text-fg-subtle`},vb={key:2,class:`grid gap-1.5`},yb=[`id`],bb={class:`block truncate text-[13px] font-medium`},xb={class:`block text-xs text-fg-subtle`},Sb={key:0,class:`text-xs text-fg-subtle`},Cb={key:3,class:`grid gap-3`},wb=[`for`],Tb={class:`font-mono`},Eb={key:0,class:`text-fg-subtle`},Db={class:`grid gap-1.5`},Ob=[`for`],kb={class:`grid gap-1.5`},Ab=[`for`],jb={key:4,class:`text-sm text-danger`,role:`alert`},Mb={class:`flex items-center gap-2 border-t border-border pt-4`},Nb={class:`mr-auto text-xs text-fg-subtle`},Pb=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(ib(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(()=>ob(m.value)),g=J(()=>sb(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:lb(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`,db,z(c.value),1)):P(``,!0),_.value===`none`?P(``,!0):(I(),A(`div`,fb,[L(`label`,{for:`${B(i)}-repo`,class:`text-[13px] font-medium`},[t[5]||=V(`Repository`,-1),v.value?P(``,!0):(I(),A(`span`,mb,` (optional)`))],8,pb),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,gb))),128))],8,hb),s.value.length?(I(),A(`p`,_b,[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`,vb,[L(`span`,{id:`${B(i)}-wf`,class:`text-[13px] font-medium`},`Workflow`,8,yb),k(B(sc),{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(lc),{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`,bb,z(e.name||e.id),1),L(`span`,xb,[V(z(y(e.id)?.runs||0)+` runs`,1),y(e.id)?.runs?(I(),A(H,{key:0},[V(` · `+z(Math.round(B(ab)(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`,Sb,`No enabled workflows.`)):P(``,!0)])),h.value.length?(I(),A(`div`,Cb,[(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`,Tb,z(e.name),1),e.required?(I(),A(`span`,Eb,` · required`)):P(``,!0)],8,wb),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 Xb(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 Zb(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 Qb(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 $b(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 ex=q([]),tx=q([]),nx=q(!0),rx=q(null),ix=q(!0),ax=q(null),ox=q(!1),sx=q(null);async function cx(){try{let e=await X.eventTypes(Jb().workspace);nx.value=e.enabled!==!1,ex.value=e.event_types||[],tx.value=e.proposals||[],rx.value=null}catch(e){rx.value=e.message||String(e)}finally{ix.value=!1}}function lx(e){return{headers:(e.headers||[]).map(e=>({...e})),payload:(e.payload||[]).map(e=>({...e}))}}function ux(e){sx.value=null,ax.value=e}function dx(e){let t=yx.value.find(t=>String(t.id)===e.sample_id);ux({mode:`proposal`,id:null,source:e.source,name:``,rule:lx(e.rule),headersText:``,body:t?.body||``,exampleHeaders:e.headers||{}})}function fx(e=``){ux({mode:`paste`,id:null,source:e,name:``,rule:{headers:[],payload:[]},headersText:``,body:``,exampleHeaders:{}})}function px(e){ux({mode:`edit`,id:e.id,source:e.source,name:e.name,rule:lx(e.rule),headersText:``,body:``,exampleHeaders:{}})}function mx(){ax.value=null}async function hx(){let e=ax.value;if(e){ox.value=!0;try{if(e.mode===`edit`&&e.id)await X.eventTypeUpdate(e.id,{name:e.name,rule:$b(e.rule)});else{let t=e.mode===`paste`?Yb(e.headersText):e.exampleHeaders;await X.eventTypeCreate({source:e.source,name:e.name,rule:e.mode===`paste`?void 0:$b(e.rule),example:{headers:t,body:e.body}})}ax.value=null,await cx()}catch(e){sx.value=e.message||String(e)}finally{ox.value=!1}}}var gx=q(null);async function _x(){let e=gx.value;if(gx.value=null,e)try{await X.eventTypeDelete(e.id),await cx()}catch(e){rx.value=e.message||String(e)}}var vx=100,yx=q([]),bx=q(!0),xx=q(null),Sx=q(!0),Cx=q(null);async function wx(){try{let e=await X.captures(vx);bx.value=e.enabled!==!1,yx.value=e.captures||[],xx.value=null}catch(e){xx.value=e.message||String(e)}finally{Sx.value=!1}}function Tx(e){let t=yx.value.find(t=>t.id===e);return t&&(Cx.value=t),!!t}function Ex(){yx.value.length&&(Cx.value=yx.value[0])}function Dx(){bh(`captures`,()=>{wx(),cx()})}var Ox=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(Qc),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`]))}}),kx=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(tl),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`]))}}),Ax=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(nl),W({"data-slot":`tabs-list`,"data-variant":e.variant},B(n),{class:B(U)(B(Mx)({variant:e.variant}),t.class)}),{default:F(()=>[G(r.$slots,`default`)]),_:3},16,[`data-variant`,`class`]))}}),jx=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(rl),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+`
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 BN=EN(`CharSizeService`),VN=EN(`CoreBrowserService`),HN=EN(`MouseService`),UN=EN(`RenderService`),WN=EN(`SelectionService`),GN=EN(`CharacterJoinerService`),KN=EN(`ThemeService`),qN=EN(`LinkProviderService`),JN=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?eP.isErrorNoTelemetry(e)?new eP(e.message+`
`+e.stack):Error(e.message+`
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};function ZN(e){$N(e)||XN.onUnexpectedError(e)}var QN=`Canceled`;function $N(e){return e instanceof eP||e instanceof Error&&e.name===QN&&e.message===QN}var eP=class extends Error{constructor(){super(QN),this.name=this.message}};function tP(e){return Error(e?`Illegal argument: ${e}`:`Illegal argument`)}var nP=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}},rP=class e extends Error{constructor(t){super(t||`An unexpected bug occurred.`),Object.setPrototypeOf(this,e.prototype)}};function iP(e,t=0){return e[e.length-(1+t)]}var aP;(e=>{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(aP||={});var oP=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>!t(n)||e(n)))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>!e(n)||(t=n,!1)),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||aP.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};oP.empty=new oP(e=>{});function sP(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}var cP;(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);t<n;t++)yield e[t]}e.slice=_;function v(t,n=1/0){let r=[];if(n===0)return[r,t];let i=t[Symbol.iterator]();for(let t=0;t<n;t++){let t=i.next();if(t.done)return[r,e.empty()];r.push(t.value)}return[r,{[Symbol.iterator](){return i}}]}e.consume=v;async function y(e){let t=[];for await(let n of e)t.push(n);return Promise.resolve(t)}e.asyncToArray=y})(cP||={});var lP=null;function uP(e){return lP?.trackDisposable(e),e}function dP(e){lP?.markAsDisposed(e)}function fP(e,t){lP?.setParent(e,t)}function pP(e){return lP?.markAsSingleton(e),e}function mP(e){if(cP.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(e){t.push(e)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}function hP(...e){return gP(()=>mP(e))}function gP(e){let t=uP({dispose:sP(()=>{dP(t),e()})});return t}var _P=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,uP(this)}dispose(){this._isDisposed||(dP(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{mP(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return fP(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(Error(`Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!`).stack):this._toDispose.add(t),t}delete(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),fP(e,null))}};_P.DISABLE_DISPOSED_WARNING=!1;var vP=_P,yP=class{constructor(){this._store=new vP,uP(this),fP(this._store,this)}dispose(){dP(thi Line truncated
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};function YN(e){ZN(e)||JN.onUnexpectedError(e)}var XN=`Canceled`;function ZN(e){return e instanceof QN||e instanceof Error&&e.name===XN&&e.message===XN}var QN=class extends Error{constructor(){super(XN),this.name=this.message}};function $N(e){return Error(e?`Illegal argument: ${e}`:`Illegal argument`)}var eP=class e extends Error{constructor(e){super(e),this.name=`CodeExpectedError`}static fromError(t){if(t instanceof e)return t;let n=new e;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(e){return e.name===`CodeExpectedError`}},tP=class e extends Error{constructor(t){super(t||`An unexpected bug occurred.`),Object.setPrototypeOf(this,e.prototype)}};function nP(e,t=0){return e[e.length-(1+t)]}var rP;(e=>{function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(rP||={});var iP=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>!t(n)||e(n)))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}some(e){let t=!1;return this.iterate(n=>(t=e(n),!t)),t}findFirst(e){let t;return this.iterate(n=>!e(n)||(t=n,!1)),t}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||rP.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};iP.empty=new iP(e=>{});function aP(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}var oP;(e=>{function t(e){return e&&typeof e==`object`&&typeof e[Symbol.iterator]==`function`}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(e){yield e}e.single=i;function a(e){return t(e)?e:i(e)}e.wrap=a;function o(e){return e||n}e.from=o;function*s(e){for(let t=e.length-1;t>=0;t--)yield e[t]}e.reverse=s;function c(e){return!e||e[Symbol.iterator]().next().done===!0}e.isEmpty=c;function l(e){return e[Symbol.iterator]().next().value}e.first=l;function u(e,t){let n=0;for(let r of e)if(t(r,n++))return!0;return!1}e.some=u;function d(e,t){for(let n of e)if(t(n))return n}e.find=d;function*f(e,t){for(let n of e)t(n)&&(yield n)}e.filter=f;function*p(e,t){let n=0;for(let r of e)yield t(r,n++)}e.map=p;function*m(e,t){let n=0;for(let r of e)yield*t(r,n++)}e.flatMap=m;function*h(...e){for(let t of e)yield*t}e.concat=h;function g(e,t,n){let r=n;for(let n of e)r=t(r,n);return r}e.reduce=g;function*_(e,t,n=e.length){for(t<0&&(t+=e.length),n<0?n+=e.length:n>e.length&&(n=e.length);t<n;t++)yield e[t]}e.slice=_;function v(t,n=1/0){let r=[];if(n===0)return[r,t];let i=t[Symbol.iterator]();for(let t=0;t<n;t++){let t=i.next();if(t.done)return[r,e.empty()];r.push(t.value)}return[r,{[Symbol.iterator](){return i}}]}e.consume=v;async function y(e){let t=[];for await(let n of e)t.push(n);return Promise.resolve(t)}e.asyncToArray=y})(oP||={});var sP=null;function cP(e){return sP?.trackDisposable(e),e}function lP(e){sP?.markAsDisposed(e)}function uP(e,t){sP?.setParent(e,t)}function dP(e){return sP?.markAsSingleton(e),e}function fP(e){if(oP.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(e){t.push(e)}if(t.length===1)throw t[0];if(t.length>1)throw AggregateError(t,`Encountered errors while disposing of store`);return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}function pP(...e){return mP(()=>fP(e))}function mP(e){let t=cP({dispose:aP(()=>{lP(t),e()})});return t}var hP=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,cP(this)}dispose(){this._isDisposed||(lP(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{fP(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return uP(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(Error(`Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!`).stack):this._toDispose.add(t),t}delete(e){if(e){if(e===this)throw Error(`Cannot dispose a disposable on itself!`);this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),uP(e,null))}};hP.DISABLE_DISPOSED_WARNING=!1;var gP=hP,_P=class{constructor(){this._store=new gP,cP(this),uP(this._store,this)}dispose(){lP(thi Line truncated
`).slice(2).join(`
`))}},PP=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},FP=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},IP=0,LP=class{constructor(e){this.value=e,this.id=IP++}},RP=2,zP=class{constructor(e){this._size=0,this._options=e,this._leakageMon=AP>0||this._options?.leakWarningThreshold?new MP(e?.onListenerError??ZN,this._options?.leakWarningThreshold??AP):void 0,this._perfMon=this._options?._profName?new kP(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new FP(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||ZN)(n),yP.None}if(this._disposed)return yP.None;t&&(e=e.bind(t));let r=new LP(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=NP.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof LP?(this._deliveryQueue??=new BP,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=gP(()=>{i?.(),this._removeListener(r)});return n instanceof vP?n.add(a):Array.isArray(n)&&n.push(a),a},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*RP<=t.length){let e=0;for(let n=0;n<t.length;n++)t[n]?t[e++]=t[n]:r&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=e}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||ZN;if(!n)e.value(t);else try{e.value(t)}catch(e){n(e)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners){if(this._listeners instanceof LP)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}}this._perfMon?.stop()}hasListeners(){return this._size>0}},BP=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},VP=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new zP,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new zP,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};VP.INSTANCE=new VP;var HP=VP;function UP(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}HP.INSTANCE.onDidChangeZoomLevel;function WP(e){return HP.INSTANCE.getZoomFactor(e)}HP.INSTANCE.onDidChangeFullscreen;var GP=typeof navigator==`object`?navigator.userAgent:``,KP=GP.indexOf(`Firefox`)>=0,qP=GP.indexOf(`AppleWebKit`)>=0,JP=GP.indexOf(`Chrome`)>=0,YP=!JP&&GP.indexOf(`Safari`)>=0;GP.indexOf(`Electron/`),GP.indexOf(`Android`);var XP=!1;if(typeof xP.matchMedia==`function`){let e=xP.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=xP.matchMedia(`(display-mode: fullscreen)`);XP=e.matches,UP(xP,e,({matches:e})=>{XP&&t.matches||(XP=e)} Line truncated
`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(e=>this._handleScroll(e)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};KI=nN([rN(2,AN),rN(3,UN),rN(4,jN),rN(5,JN),rN(6,IN),rN(7,GN)],KI);var qI=class extends yP{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement(`div`),this._container.classList.add(`xterm-decoration-container`),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(e=>this._removeDecoration(e))),this._register(gP(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement(`div`);t.classList.add(`xterm-decoration`),t.classList.toggle(`xterm-decoration-top-layer`,e?.options?.layer===`top`),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display=`none`),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display=`none`,e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?`none`:`block`,this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderLine truncated
`,e.VT=`\v`,e.FF=`\f`,e.CR=`\r`,e.SO=``,e.SI=``,e.DLE=``,e.DC1=``,e.DC2=``,e.DC3=``,e.DC4=``,e.NAK=``,e.SYN=``,e.ETB=``,e.CAN=``,e.EM=``,e.SUB=``,e.ESC=`\x1B`,e.FS=``,e.GS=``,e.RS=``,e.US=``,e.SP=` `,e.DEL=``))($||={});var $I;(e=>(e.PAD=`€`,e.HOP=``,e.BPH=`‚`,e.NBH=`ƒ`,e.IND=`„`,e.NEL=`…`,e.SSA=`†`,e.ESA=`‡`,e.HTS=`ˆ`,e.HTJ=`‰`,e.VTS=`Š`,e.PLD=`‹`,e.PLU=`Œ`,e.RI=``,e.SS2=`Ž`,e.SS3=``,e.DCS=``,e.PU1=`‘`,e.PU2=`’`,e.STS=`“`,e.CCH=`”`,e.MW=`•`,e.SPA=`–`,e.EPA=`—`,e.SOS=`˜`,e.SGCI=`™`,e.SCI=`š`,e.CSI=`›`,e.ST=`œ`,e.OSC=``,e.PM=`ž`,e.APC=`Ÿ`))($I||={});var eL;(e=>e.ST=`${$.ESC}\\`)(eL||={});var tL=class{constructor(e,t,n,r,i,a){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=``}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent=``,this._dataAlreadySent=``,this._compositionView.classList.add(`active`)}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove(`active`),this._isComposing=!1,e){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let t;e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,this._compositionPosition.start):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}},0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,``);this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${$.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+`px`,this._compositionView.style.top=n+`px`,this._compositionView.style.height=t+`px`,this._compositionView.style.lineHeight=t+`px`,this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+`px`;let i=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+`px`,this._textarea.style.top=n+`px`,this._textarea.style.width=Math.max(i.width,1)+`px`,this._textarea.style.height=Math.max(i.height,1)+`px`,this._textarea.style.lineHeight=i.height+`px`}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};tL=nN([rN(2,AN),rN(3,IN),rN(4,MN),rN(5,GN)],tL);var nL=0,rL=0,iL=0,aL=0,oL={css:`#00000000`,rgba:0},sL;(e=>{function t(e,t,n,r){return r===void 0?`#${fL(e)}${fL(t)}${fL(n)}`:`#${fL(e)}${fL(t)}${fL(n)}${fL(r)}`}e.toCss=t;function n(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0}e.toRgba=n;function r(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}e.toColor=r})(sL||={});var cL;(e=>{function t(e,t){if(aL=(t.rgba&255)/255,aL===1)return{css:t.css,rgba:t.rgba};let n=t.rgba>>24&255,r=t.rgba>>16&255,i=t.rgba>>8&255,a=e.rgba>>24&255,o=e.rgba>>16&255,s=e.rgba>>8&255;return nL=a+Math.round((n-a)*aL),rL=o+Math.round((r-o)*aL),iL=s+Math.round((i-s)*aL),{css:sL.toCss(nL,rL,iL),rgba:sL.toRgba(nL,rL,iL)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=dL.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return sL.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[nL,rL,iL]=dL.toChannels(t),{css:sL.toCss(nL,rL,iL),rgba:t}}e.opaque=i;function a(e,t){return aL=Math.round(t*255),[nL,rL,iL]=dL.toChannels(e.rgba),{css:sL.toCss(nL,rL,iL,aL),rgba:sL.toRgba(nL,rL,iL,aL)}}e.opacity=a;function o(e,t){return aL=e.rgba&255,a(e,aL*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.r Line truncated
`))}},MP=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},NP=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},PP=0,FP=class{constructor(e){this.value=e,this.id=PP++}},IP=2,LP=class{constructor(e){this._size=0,this._options=e,this._leakageMon=OP>0||this._options?.leakWarningThreshold?new AP(e?.onListenerError??YN,this._options?.leakWarningThreshold??OP):void 0,this._perfMon=this._options?._profName?new DP(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new NP(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||YN)(n),_P.None}if(this._disposed)return _P.None;t&&(e=e.bind(t));let r=new FP(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=jP.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof FP?(this._deliveryQueue??=new RP,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=mP(()=>{i?.(),this._removeListener(r)});return n instanceof gP?n.add(a):Array.isArray(n)&&n.push(a),a},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*IP<=t.length){let e=0;for(let n=0;n<t.length;n++)t[n]?t[e++]=t[n]:r&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=e}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||YN;if(!n)e.value(t);else try{e.value(t)}catch(e){n(e)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners){if(this._listeners instanceof FP)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}}this._perfMon?.stop()}hasListeners(){return this._size>0}},RP=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},zP=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new LP,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new LP,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};zP.INSTANCE=new zP;var BP=zP;function VP(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}BP.INSTANCE.onDidChangeZoomLevel;function HP(e){return BP.INSTANCE.getZoomFactor(e)}BP.INSTANCE.onDidChangeFullscreen;var UP=typeof navigator==`object`?navigator.userAgent:``,WP=UP.indexOf(`Firefox`)>=0,GP=UP.indexOf(`AppleWebKit`)>=0,KP=UP.indexOf(`Chrome`)>=0,qP=!KP&&UP.indexOf(`Safari`)>=0;UP.indexOf(`Electron/`),UP.indexOf(`Android`);var JP=!1;if(typeof yP.matchMedia==`function`){let e=yP.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=yP.matchMedia(`(display-mode: fullscreen)`);JP=e.matches,VP(yP,e,({matches:e})=>{JP&&t.matches||(JP=e)} Line truncated
`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(e=>this._handleScroll(e)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};WI=eN([tN(2,ON),tN(3,VN),tN(4,kN),tN(5,KN),tN(6,PN),tN(7,UN)],WI);var GI=class extends _P{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement(`div`),this._container.classList.add(`xterm-decoration-container`),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(e=>this._removeDecoration(e))),this._register(mP(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement(`div`);t.classList.add(`xterm-decoration`),t.classList.toggle(`xterm-decoration-top-layer`,e?.options?.layer===`top`),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display=`none`),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display=`none`,e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?`none`:`block`,this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderLine truncated
`,e.VT=`\v`,e.FF=`\f`,e.CR=`\r`,e.SO=``,e.SI=``,e.DLE=``,e.DC1=``,e.DC2=``,e.DC3=``,e.DC4=``,e.NAK=``,e.SYN=``,e.ETB=``,e.CAN=``,e.EM=``,e.SUB=``,e.ESC=`\x1B`,e.FS=``,e.GS=``,e.RS=``,e.US=``,e.SP=` `,e.DEL=``))($||={});var ZI;(e=>(e.PAD=`€`,e.HOP=``,e.BPH=`‚`,e.NBH=`ƒ`,e.IND=`„`,e.NEL=`…`,e.SSA=`†`,e.ESA=`‡`,e.HTS=`ˆ`,e.HTJ=`‰`,e.VTS=`Š`,e.PLD=`‹`,e.PLU=`Œ`,e.RI=``,e.SS2=`Ž`,e.SS3=``,e.DCS=``,e.PU1=`‘`,e.PU2=`’`,e.STS=`“`,e.CCH=`”`,e.MW=`•`,e.SPA=`–`,e.EPA=`—`,e.SOS=`˜`,e.SGCI=`™`,e.SCI=`š`,e.CSI=`›`,e.ST=`œ`,e.OSC=``,e.PM=`ž`,e.APC=`Ÿ`))(ZI||={});var QI;(e=>e.ST=`${$.ESC}\\`)(QI||={});var $I=class{constructor(e,t,n,r,i,a){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=``}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent=``,this._dataAlreadySent=``,this._compositionView.classList.add(`active`)}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove(`active`),this._isComposing=!1,e){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let t;e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,this._compositionPosition.start):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}},0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,``);this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${$.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+`px`,this._compositionView.style.top=n+`px`,this._compositionView.style.height=t+`px`,this._compositionView.style.lineHeight=t+`px`,this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+`px`;let i=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+`px`,this._textarea.style.top=n+`px`,this._textarea.style.width=Math.max(i.width,1)+`px`,this._textarea.style.height=Math.max(i.height,1)+`px`,this._textarea.style.lineHeight=i.height+`px`}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};$I=eN([tN(2,ON),tN(3,PN),tN(4,AN),tN(5,UN)],$I);var eL=0,tL=0,nL=0,rL=0,iL={css:`#00000000`,rgba:0},aL;(e=>{function t(e,t,n,r){return r===void 0?`#${uL(e)}${uL(t)}${uL(n)}`:`#${uL(e)}${uL(t)}${uL(n)}${uL(r)}`}e.toCss=t;function n(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0}e.toRgba=n;function r(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}e.toColor=r})(aL||={});var oL;(e=>{function t(e,t){if(rL=(t.rgba&255)/255,rL===1)return{css:t.css,rgba:t.rgba};let n=t.rgba>>24&255,r=t.rgba>>16&255,i=t.rgba>>8&255,a=e.rgba>>24&255,o=e.rgba>>16&255,s=e.rgba>>8&255;return eL=a+Math.round((n-a)*rL),tL=o+Math.round((r-o)*rL),nL=s+Math.round((i-s)*rL),{css:aL.toCss(eL,tL,nL),rgba:aL.toRgba(eL,tL,nL)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=lL.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return aL.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[eL,tL,nL]=lL.toChannels(t),{css:aL.toCss(eL,tL,nL),rgba:t}}e.opaque=i;function a(e,t){return rL=Math.round(t*255),[eL,tL,nL]=lL.toChannels(e.rgba),{css:aL.toCss(eL,tL,nL,rL),rgba:aL.toRgba(eL,tL,nL,rL)}}e.opacity=a;function o(e,t){return rL=e.rgba&255,a(e,rL*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.r Line truncated
`:`
`)}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(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
`)}};dK.defaultYaml={explicit:!1,version:`1.2`},dK.defaultTags={"!!":`tag:yaml.org,2002:`};function fK(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 pK(e){let t=new Set;return iK(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function mK(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function hK(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=pK(e);let a=mK(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(XG(t.node)||QG(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 gK(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=gK(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=gK(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=gK(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=gK(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function _K(e,t,n){if(Array.isArray(e))return e.map((e,t)=>_K(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!eK(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 vK=class{constructor(e){Object.defineProperty(this,GG,{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(!qG(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=_K(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?gK(i,{"":o},``,o):o}},yK=class extends vK{constructor(e){super(zG),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=[],iK(e,{Node:(e,t)=>{(KG(t)||eK(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||=(_K(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=bK(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(fK(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 bK(e,t,n){if(KG(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(QG(t)){let r=0;for(let i of t.items){let t=bK(e,i,n);t>r&&(r=t)}return r}if(YG(t)){let r=bK(e,t.key,n),i=bK(e,t.value,n);return Math.max(r,i)}return 1}var xK=e=>!e||typeof e!=`function`&&typeof e!=`object`,SK=class extends vK{constructor(e){super(UG),this.value=e}toJSON(e,t){return t?.keep?this.value:_K(this.value,e,t)}toString(){return String(this.value)}};SK.BLOCK_FOLDED=`BLOCK_FOLDED`,SK.BLOCK_LITERAL=`BLOCK_LITERAL`,SK.PLAIN=`PLAIN`,SK.QUOTE_DOUBLE=`QUOTE_DOUBLE`,SK.QUOTE_SINGLE=`QUOTE_SINGLE`;var CK=`tag:yaml.org,2002:`;function wK(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 TK(e,t,n){if(qG(e)&&(e=e.contents),$G(e))return e;if(YG(e)){let t=n.schema[VG].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 yK(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=CK+t.slice(2));let l=wK(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new SK(e);return c&&(c.node=t),t Line truncated
`)?AK(n,t):n.includes(`
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh()),tR&&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=wR(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=zL(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,-TR),TR),t/=TR,t/Math.abs(t)+Math.round(t*(ER-1)))}shouldForceSelection(e){return ZL?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(),DR)}_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&&!(ZL&&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(eI(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(mP(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<DB+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===DB+1&&(this._liveRegion.textContent+=aN.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 rN.get()},set promptLabel(e){rN.set(e)},get tooMuchOutput(){return aN.get()},set tooMuchOutput(e){aN.set(e)}}}_verifyIntegers(...e){for(BB of e)if(BB===1/0||isNaN(BB)||BB%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(BB of e)if(BB&&(BB===1/0||isNaN(BB)||BB%1!=0||BB<0))throw Error(`This API only accepts positive integers`)}},HB=2,UB=1,WB=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(HB,Math.floor(u/e.css.cell.width)),rows:Math.max(UB,Math.floor(l/e.css.cell.height))}}},GB={class:`flex h-[32rem] min-h-0 flex-col gap-2`},KB={key:0,class:`text-sm text-fg-muted`,role:`status`},qB=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 VB({convertEol:!0,disableStdin:!0,cursorBlink:!1,fontFamily:`'IBM Plex Mono', ui-monospace, monospace`,fontSize:13,theme:{background:`#0b0f14`,foreground:`#e6edf3`}}),o=new WB,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`,GB,[r.value===`open`?P(``,!0):(I(),A(`p`,KB,[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)]))}}),JB={class:`flex flex-wrap items-center gap-3 border-b border-border pb-3`},YB={class:`inline-flex items-center gap-2`},XB={class:`inline-flex items-center gap-2`},ZB=`__all__`,QB=N({__name:`TaskLogFilters`,props:{filters:{},stages:{}},emits:[`filter`],setup(e,{emit:t}){let n=e,r=t,i=J(()=>_T.map(e=>({value:e.value||ZB,label:e.label}))),a=J(()=>n.filters.level||ZB),o=J(()=>n.filters.stage||ZB);function s(e){r(`filter`,{...n.filters,...e})}function c(e){s({level:String(e)===ZB?``:String(e)})}function l(e){s({stage:String(e)===ZB?``:String(e)})}return(t,n)=>(I(),A(`div`,JB,[L(`div`,YB,[k(B(Cf),{"model-value":a.value,"onUpdate:modelValue":c},{default:F(()=>[k(B(Af),{size:`sm`,"aria-label":`Filter log entries by level`},{default:F(()=>[k(B(jf))]),_:1}),k(B(wf),null,{default:F(()=>[k(B(Tf),null,{default:F(()=>[(I(!0),A(H,null,j(i.value,e=>(I(),K(B(Df),{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`,XB,[k(B(Cf),{"model-value":o.value,"onUpdate:modelValue":l},{default:F(()=>[k(B(Af),{size:`sm`,"aria-label":`Filter log entries by stage`},{default:F(()=>[k(B(jf))]),_:1}),k(B(wf),null,{default:F(()=>[k(B(Tf),null,{default:F(()=>[k(B(Df),{value:ZB},{default:F(()=>[...n[0]||=[V(`All stages`,-1)]]),_:1}),(I(!0),A(H,null,j(e.stages,e=>(I(),K(B(Df),{key:e,value:e},{default:F(()=>[V(z(e),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`model-value`])])]))}}),$B={class:`sr-only`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`},eV={key:2,class:`flex flex-col items-start gap-2 py-3`},tV={key:0,class:`mt-2 flex flex-wrap items-cent Line truncated
`)}};cK.defaultYaml={explicit:!1,version:`1.2`},cK.defaultTags={"!!":`tag:yaml.org,2002:`};function lK(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 uK(e){let t=new Set;return tK(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function dK(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function fK(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=uK(e);let a=dK(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(qG(t.node)||YG(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 pK(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=pK(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=pK(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=pK(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=pK(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function mK(e,t,n){if(Array.isArray(e))return e.map((e,t)=>mK(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!ZG(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 hK=class{constructor(e){Object.defineProperty(this,HG,{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(!WG(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=mK(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?pK(i,{"":o},``,o):o}},gK=class extends hK{constructor(e){super(IG),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=[],tK(e,{Node:(e,t)=>{(UG(t)||ZG(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||=(mK(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=_K(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(lK(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 _K(e,t,n){if(UG(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(YG(t)){let r=0;for(let i of t.items){let t=_K(e,i,n);t>r&&(r=t)}return r}if(KG(t)){let r=_K(e,t.key,n),i=_K(e,t.value,n);return Math.max(r,i)}return 1}var vK=e=>!e||typeof e!=`function`&&typeof e!=`object`,yK=class extends hK{constructor(e){super(BG),this.value=e}toJSON(e,t){return t?.keep?this.value:mK(this.value,e,t)}toString(){return String(this.value)}};yK.BLOCK_FOLDED=`BLOCK_FOLDED`,yK.BLOCK_LITERAL=`BLOCK_LITERAL`,yK.PLAIN=`PLAIN`,yK.QUOTE_DOUBLE=`QUOTE_DOUBLE`,yK.QUOTE_SINGLE=`QUOTE_SINGLE`;var bK=`tag:yaml.org,2002:`;function xK(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 SK(e,t,n){if(WG(e)&&(e=e.contents),XG(e))return e;if(KG(e)){let t=n.schema[RG].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 gK(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=bK+t.slice(2));let l=xK(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new yK(e);return c&&(c.node=t),t Line truncated
`)?DK(n,t):n.includes(`
`)?`
`+AK(n,t):(e.endsWith(` `)?``:` `)+n,MK=`flow`,NK=`block`,PK=`quoted`;function FK(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=IK(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=IK(e,h,t.length)),d=h+t.length+c,f=void 0;else{if(r===` `&&p&&p!==` `&&p!==`
`+DK(n,t):(e.endsWith(` `)?``:` `)+n,kK=`flow`,AK=`block`,jK=`quoted`;function MK(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=NK(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=NK(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 IK(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 LK=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),RK=e=>/^(%|---|\.\.\.)/m.test(e);function zK(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 BK(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(RK(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 NK(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 PK=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),FK=e=>/^(%|---|\.\.\.)/m.test(e);function IK(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 LK(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(FK(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:FK(o,a,PK,LK(t,!1))}function VK(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
`)||/[ \t]\n|\n[ \t]/.test(e))return BK(e,t);let n=t.indent||(RK(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:FK(r,n,MK,LK(t,!1))}function HK(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=BK;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?VK:i&&!t?BK:n?VK:BK}return r(e,t)}var UK;try{UK=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:MK(o,a,jK,PK(t,!1))}function RK(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
`)||/[ \t]\n|\n[ \t]/.test(e))return LK(e,t);let n=t.indent||(FK(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:MK(r,n,kK,PK(t,!1))}function zK(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=LK;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?RK:i&&!t?LK:n?RK:LK}return r(e,t)}var BK;try{BK=RegExp(`(^|(?<!
))
+(?!
|$)`,`g`)}catch{UK=/\n+(?!\n|$)/g}function WK({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 HK(n,r);let l=r.indent||(r.forceBlockIndent||RK(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===SK.BLOCK_FOLDED?!1:t===SK.BLOCK_LITERAL||!zK(n,c,l.length);if(!n)return u?`|
|$)`,`g`)}catch{BK=/\n+(?!\n|$)/g}function VK({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 zK(n,r);let l=r.indent||(r.forceBlockIndent||FK(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===yK.BLOCK_FOLDED?!1:t===yK.BLOCK_LITERAL||!IK(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(UK,`$&${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(BK,`$&${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=LK(r,!0);o!==`folded`&&t!==SK.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=FK(`${v}${e}${p}`,l,NK,a);if(!i)return`>${y}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${y}\n${l}${v}${n}${p}`}function GK(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 HK(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
`)?HK(a,t):WK(e,t,n,r);if(!s&&!u&&i!==SK.PLAIN&&a.includes(`
`))return WK(e,t,n,r);if(RK(a)){if(c===``)return t.forceBlockIndent=!0,WK(e,t,n,r);if(s&&c===l)return HK(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 HK(a,t)}return s?d:FK(d,c,MK,LK(t,!1))}function KK(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!==SK.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=SK.QUOTE_DOUBLE);let c=e=>{switch(e){case SK.BLOCK_FOLDED:case SK.BLOCK_LITERAL:return i||a?HK(o.value,t):WK(o,t,n,r);case SK.QUOTE_DOUBLE:return BK(o.value,t);case SK.QUOTE_SINGLE:return VK(o.value,t);case SK.PLAIN:return GK(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 qK(e,t){let n=Object.assign({blockQuote:!0,commentString:kK,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 JK(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(XG(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 YK(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(XG(e)||QG(e))&&e.anchor;a&&fK(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 XK(e,t,n,r){if(YG(e))return e.toString(t,n,r);if(KG(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=$G(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=JK(t.doc.schema.tags,a);let o=YK(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):XG(a)?KK(a,t,n,r):a.toString(t,n,r);return o?XG(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function ZK({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=$G(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(QG(e)||!$G(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||QG(e)||(XG(e)?e.type===SK.BLOCK_FOLDED||e.type===SK.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=XK(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+=jK(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=jK(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=jK(g,n.indent,l(f))));let _,v,y;$G(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&&XG(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&ZG(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let b=!1,x=XK(t,n,()=>b=!0,()=>h=!0),S=` `;if(f||_||v){if(S=_?`
`:``,v){let e=l(v);S+=`\n${AK(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=PK(r,!0);o!==`folded`&&t!==yK.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=MK(`${v}${e}${p}`,l,AK,a);if(!i)return`>${y}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${y}\n${l}${v}${n}${p}`}function HK(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 zK(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
`)?zK(a,t):VK(e,t,n,r);if(!s&&!u&&i!==yK.PLAIN&&a.includes(`
`))return VK(e,t,n,r);if(FK(a)){if(c===``)return t.forceBlockIndent=!0,VK(e,t,n,r);if(s&&c===l)return zK(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 zK(a,t)}return s?d:MK(d,c,kK,PK(t,!1))}function UK(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!==yK.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=yK.QUOTE_DOUBLE);let c=e=>{switch(e){case yK.BLOCK_FOLDED:case yK.BLOCK_LITERAL:return i||a?zK(o.value,t):VK(o,t,n,r);case yK.QUOTE_DOUBLE:return LK(o.value,t);case yK.QUOTE_SINGLE:return RK(o.value,t);case yK.PLAIN:return HK(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 WK(e,t){let n=Object.assign({blockQuote:!0,commentString:EK,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 GK(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(qG(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 KK(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(qG(e)||YG(e))&&e.anchor;a&&lK(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 qK(e,t,n,r){if(KG(e))return e.toString(t,n,r);if(UG(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=XG(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=GK(t.doc.schema.tags,a);let o=KK(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):qG(a)?UK(a,t,n,r):a.toString(t,n,r);return o?qG(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function JK({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=XG(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(YG(e)||!XG(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||YG(e)||(qG(e)?e.type===yK.BLOCK_FOLDED||e.type===yK.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=qK(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+=OK(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=OK(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=OK(g,n.indent,l(f))));let _,v,y;XG(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&&qG(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&JG(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let b=!1,x=qK(t,n,()=>b=!0,()=>h=!0),S=` `;if(f||_||v){if(S=_?`
`:``,v){let e=l(v);S+=`\n${DK(e,n.indent)}`}x===``&&!n.inFlow?S===`
`&&y&&(S=`
`):S+=`\n${n.indent}`}else if(!p&&QG(t)){let e=x[0],r=x.indexOf(`
`):S+=`\n${n.indent}`}else if(!p&&YG(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+=jK(g,n.indent,l(y)):h&&i&&i(),g}function QK(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}var $K=`<<`,eq={identify:e=>e===$K||typeof e==`symbol`&&e.description===$K,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new SK(Symbol($K)),{addToJSMap:nq}),stringify:()=>$K},tq=(e,t)=>(eq.identify(t)||XG(t)&&(!t.type||t.type===SK.PLAIN)&&eq.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===eq.tag&&e.default);function nq(e,t,n){let r=iq(e,n);if(ZG(r))for(let n of r.items)rq(e,t,n);else if(Array.isArray(r))for(let n of r)rq(e,t,n);else rq(e,t,r)}function rq(e,t,n){let r=iq(e,n);if(!JG(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 iq(e,t){return e&&KG(t)?t.resolve(e.doc,e):t}function aq(e,t,{key:n,value:r}){if($G(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(tq(e,n))nq(e,t,r);else{let i=_K(n,``,e);if(t instanceof Map)t.set(i,_K(r,i,e));else if(t instanceof Set)t.add(i);else{let a=oq(n,i,e),o=_K(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function oq(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if($G(e)&&n?.doc){let t=qK(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)+`..."`),QK(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 sq(e,t,n){return new cq(TK(e,void 0,n),TK(t,void 0,n))}var cq=class e{constructor(e,t=null){Object.defineProperty(this,GG,{value:HG}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return $G(n)&&(n=n.clone(t)),$G(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return aq(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?ZK(this,e,t,n):JSON.stringify(this)}};function lq(e,t,n){return(t.inFlow??e.flow?dq:uq)(e,t,n)}function uq({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($G(i))!d&&i.spaceBefore&&f.push(``),fq(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(YG(i)){let e=$G(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),fq(n,f,e.commentBefore,d))}d=!1;let s=XK(i,u,()=>o=null,()=>d=!0);o&&(s+=jK(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+=OK(g,n.indent,l(y)):h&&i&&i(),g}function YK(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}var XK=`<<`,ZK={identify:e=>e===XK||typeof e==`symbol`&&e.description===XK,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new yK(Symbol(XK)),{addToJSMap:$K}),stringify:()=>XK},QK=(e,t)=>(ZK.identify(t)||qG(t)&&(!t.type||t.type===yK.PLAIN)&&ZK.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===ZK.tag&&e.default);function $K(e,t,n){let r=tq(e,n);if(JG(r))for(let n of r.items)eq(e,t,n);else if(Array.isArray(r))for(let n of r)eq(e,t,n);else eq(e,t,r)}function eq(e,t,n){let r=tq(e,n);if(!GG(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 tq(e,t){return e&&UG(t)?t.resolve(e.doc,e):t}function nq(e,t,{key:n,value:r}){if(XG(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(QK(e,n))$K(e,t,r);else{let i=mK(n,``,e);if(t instanceof Map)t.set(i,mK(r,i,e));else if(t instanceof Set)t.add(i);else{let a=rq(n,i,e),o=mK(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function rq(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(XG(e)&&n?.doc){let t=WK(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)+`..."`),YK(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 iq(e,t,n){return new aq(SK(e,void 0,n),SK(t,void 0,n))}var aq=class e{constructor(e,t=null){Object.defineProperty(this,HG,{value:zG}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return XG(n)&&(n=n.clone(t)),XG(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return nq(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?JK(this,e,t,n):JSON.stringify(this)}};function oq(e,t,n){return(t.inFlow??e.flow?cq:sq)(e,t,n)}function sq({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(XG(i))!d&&i.spaceBefore&&f.push(``),lq(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(KG(i)){let e=XG(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),lq(n,f,e.commentBefore,d))}d=!1;let s=qK(i,u,()=>o=null,()=>d=!0);o&&(s+=OK(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+=`
`+AK(l(e),c),s&&s()):d&&o&&o(),p}function dq({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($G(i))i.spaceBefore&&d.push(``),fq(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(YG(i)){let e=$G(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),fq(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=$G(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=XK(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+=jK(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 fq({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=AK(t(r),e);n.push(i.trimStart())}}function pq(e,t){let n=XG(t)?t.value:t;for(let r of e)if(YG(r)&&(r.key===t||r.key===n||XG(r.key)&&r.key.value===n))return r}var mq=class extends OK{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(VG,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(sq(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=YG(e)?e:!e||typeof e!=`object`||!(`key`in e)?new cq(e,e?.value):new cq(e.key,e.value);let r=pq(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);XG(r.value)&&xK(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=pq(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=pq(this.items,e)?.value;return(!t&&XG(n)?n.value:n)??void 0}has(e){return!!pq(this.items,e)}set(e,t){this.add(new cq(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)aq(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!YG(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})),lq(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},hq={collection:`map`,default:!0,nodeClass:mq,tag:`tag:yaml.org,2002:map`,resolve(e,t){return JG(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>mq.from(e,t,n)},gq=class extends OK{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(WG,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=_q(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=_q(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&XG(r)?r.value:r}has(e){let t=_q(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=_q(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];XG(r)&&xK(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(_K(e,String(r++),t));return n}toString(e,t,n){return e?lq(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(TK(a,void 0,n))}}return i}};function _q(e){let t=XG(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var vq={collection:`seq`,default:!0,nodeClass:gq,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return ZG(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>gq.from(e,t,n)},yq={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),KK(e,t,n,r)}},bq={identify:e=>e==null,createNode:()=>new SK(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new SK(null),stringify:({source:e},t)=>typeof e==`string`&&bq.test.test(e)?e:t.options.nullStr},xq={identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new SK(e[0]===`t`||e[0]===`T`),stringify({source:e,value:t},n){return e&&xq.test.test(e)&&t===(e[0]===`t`||e[0]===`T`)?e:t?n.options.trueStr:n.options.falseStr}};function Sq({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 Cq={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:Sq},wq={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 KK({comment:e,type:t,value:s},r,i,a)}};function Rq(e,t){if(ZG(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!YG(r)){if(JG(r)){r.items.length>1&&t(`Each pair must have its own sequence indicator`);let e=r.items[0]||new cq(new SK(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]=YG(r)?r:new cq(r)}}else t(`Expected a sequence for this tag`);return e}function zq(e,t,n){let{replacer:r}=n,i=new gq(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(sq(o,s,n))}return i}var Bq={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:Rq,createNode:zq},Vq=class e extends gq{constructor(){super(),this.add=mq.prototype.add.bind(this),this.delete=mq.prototype.delete.bind(this),this.get=mq.prototype.get.bind(this),this.has=mq.prototype.has.bind(this),this.set=mq.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(YG(e)?(r=_K(e.key,``,t),i=_K(e.value,r,t)):r=_K(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=zq(e,t,n),i=new this;return i.items=r.items,i}};Vq.tag=`tag:yaml.org,2002:omap`;var Hq={collection:`seq`,identify:e=>e instanceof Map,nodeClass:Vq,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,t){let n=Rq(e,t),r=[];for(let{key:e}of n.items)XG(e)&&(r.includes(e.value)?t(`Ordered maps must not include duplicate keys: ${e.value}`):r.push(e.value));return Object.assign(new Vq,n)},createNode:(e,t,n)=>Vq.from(e,t,n)};function Uq({value:e,source:t},n){return t&&(e?Wq:Gq).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var Wq={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 SK(!0),stringify:Uq},Gq={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 SK(!1),stringify:Uq},Kq={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:Sq},qq={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():Sq(e)}},Jq={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 SK(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:Sq},Yq=e=>typeof e==`bigint`||Number.isInteger(e);function Xq(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 Zq(e,t,n){let{value:r}=e;if(Yq(r)){let e=r.toString(t);return r<0?`-`+n+e.substr(1):n+e}return Sq(e)}var Qq={identify:Yq,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>Xq(e,2,2,n),stringify:e=>Zq(e,2,`0b`)},$q={identify:Yq,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>Xq(e,1,8,n),stringify:e=>Zq(e,8,`0`)},eJ={identify:Yq,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>Xq(e,0,10,n),stringify:Sq},tJ={identify:Yq,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>Xq(e,2,16,n),stringify:e=>Zq(e,16,`0x`)},nJ=class e extends mq{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=YG(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new cq(e.key,null):new cq(e,null),pq(this.items,t.key)||this.items.push(t)}get(e,t){let n=pq(this.items,e);return!t&&YG(n)?XG(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=pq(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new cq(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(AK(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(AK(a(t),``)))}return n.join(`
`+DK(l(e),c),s&&s()):d&&o&&o(),p}function cq({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(XG(i))i.spaceBefore&&d.push(``),lq(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(KG(i)){let e=XG(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),lq(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=XG(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=qK(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+=OK(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 lq({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=DK(t(r),e);n.push(i.trimStart())}}function uq(e,t){let n=qG(t)?t.value:t;for(let r of e)if(KG(r)&&(r.key===t||r.key===n||qG(r.key)&&r.key.value===n))return r}var dq=class extends TK{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(RG,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(iq(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=KG(e)?e:!e||typeof e!=`object`||!(`key`in e)?new aq(e,e?.value):new aq(e.key,e.value);let r=uq(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);qG(r.value)&&vK(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=uq(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=uq(this.items,e)?.value;return(!t&&qG(n)?n.value:n)??void 0}has(e){return!!uq(this.items,e)}set(e,t){this.add(new aq(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)nq(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!KG(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})),oq(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},fq={collection:`map`,default:!0,nodeClass:dq,tag:`tag:yaml.org,2002:map`,resolve(e,t){return GG(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>dq.from(e,t,n)},pq=class extends TK{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(VG,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=mq(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=mq(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&qG(r)?r.value:r}has(e){let t=mq(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=mq(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];qG(r)&&vK(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(mK(e,String(r++),t));return n}toString(e,t,n){return e?oq(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(SK(a,void 0,n))}}return i}};function mq(e){let t=qG(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var hq={collection:`seq`,default:!0,nodeClass:pq,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return JG(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>pq.from(e,t,n)},gq={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),UK(e,t,n,r)}},_q={identify:e=>e==null,createNode:()=>new yK(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new yK(null),stringify:({source:e},t)=>typeof e==`string`&&_q.test.test(e)?e:t.options.nullStr},vq={identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new yK(e[0]===`t`||e[0]===`T`),stringify({source:e,value:t},n){return e&&vq.test.test(e)&&t===(e[0]===`t`||e[0]===`T`)?e:t?n.options.trueStr:n.options.falseStr}};function yq({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 bq={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:yq},xq={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 UK({comment:e,type:t,value:s},r,i,a)}};function Fq(e,t){if(JG(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!KG(r)){if(GG(r)){r.items.length>1&&t(`Each pair must have its own sequence indicator`);let e=r.items[0]||new aq(new yK(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]=KG(r)?r:new aq(r)}}else t(`Expected a sequence for this tag`);return e}function Iq(e,t,n){let{replacer:r}=n,i=new pq(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(iq(o,s,n))}return i}var Lq={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:Fq,createNode:Iq},Rq=class e extends pq{constructor(){super(),this.add=dq.prototype.add.bind(this),this.delete=dq.prototype.delete.bind(this),this.get=dq.prototype.get.bind(this),this.has=dq.prototype.has.bind(this),this.set=dq.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(KG(e)?(r=mK(e.key,``,t),i=mK(e.value,r,t)):r=mK(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=Iq(e,t,n),i=new this;return i.items=r.items,i}};Rq.tag=`tag:yaml.org,2002:omap`;var zq={collection:`seq`,identify:e=>e instanceof Map,nodeClass:Rq,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,t){let n=Fq(e,t),r=[];for(let{key:e}of n.items)qG(e)&&(r.includes(e.value)?t(`Ordered maps must not include duplicate keys: ${e.value}`):r.push(e.value));return Object.assign(new Rq,n)},createNode:(e,t,n)=>Rq.from(e,t,n)};function Bq({value:e,source:t},n){return t&&(e?Vq:Hq).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var Vq={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 yK(!0),stringify:Bq},Hq={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 yK(!1),stringify:Bq},Uq={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:yq},Wq={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():yq(e)}},Gq={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 yK(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:yq},Kq=e=>typeof e==`bigint`||Number.isInteger(e);function qq(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 Jq(e,t,n){let{value:r}=e;if(Kq(r)){let e=r.toString(t);return r<0?`-`+n+e.substr(1):n+e}return yq(e)}var Yq={identify:Kq,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>qq(e,2,2,n),stringify:e=>Jq(e,2,`0b`)},Xq={identify:Kq,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>qq(e,1,8,n),stringify:e=>Jq(e,8,`0`)},Zq={identify:Kq,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>qq(e,0,10,n),stringify:yq},Qq={identify:Kq,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>qq(e,2,16,n),stringify:e=>Jq(e,16,`0x`)},$q=class e extends dq{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=KG(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new aq(e.key,null):new aq(e,null),uq(this.items,t.key)||this.items.push(t)}get(e,t){let n=uq(this.items,e);return!t&&KG(n)?qG(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=uq(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new aq(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(DK(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(DK(a(t),``)))}return n.join(`
`)+`
`}var _J=class e{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,GG,{value:BG});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 dK({version:a}),this.setSchema(a,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){let t=Object.create(e.prototype,{[GG]:{value:BG}});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=$G(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(e){vJ(this.contents)&&this.contents.add(e)}addIn(e,t){vJ(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=pK(this);e.anchor=!t||n.has(t)?mK(t||`a`,n):t}return new yK(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}=hK(this,a||`a`),p={aliasDuplicateObjects:i??!0,keepUndefined:s??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:f},m=TK(e,l,p);return o&&QG(m)&&(m.flow=!0),d(),m}createPair(e,t,n={}){return new cq(this.createNode(e,null,n),this.createNode(t,null,n))}delete(e){return vJ(this.contents)?this.contents.delete(e):!1}deleteIn(e){return DK(e)?this.contents!=null&&(this.contents=null,!0):vJ(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return QG(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return DK(e)?!t&&XG(this.contents)?this.contents.value:this.contents:QG(this.contents)?this.contents.getIn(e,t):void 0}has(e){return QG(this.contents)?this.contents.has(e):!1}hasIn(e){return DK(e)?this.contents!==void 0:QG(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=EK(this.schema,[e],t):vJ(this.contents)&&this.contents.set(e,t)}setIn(e,t){DK(e)?this.contents=t:this.contents==null?this.contents=EK(this.schema,Array.from(e),t):vJ(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 dK({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 dK({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 hJ(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=_K(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`?gK(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 gJ(this,e)}};function vJ(e){if(QG(e))return!0;throw Error(`Expected a YAML collection as document contents`)}var yJ=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},bJ=class extends yJ{constructor(e,t,n){super(`YAMLParseError`,e,t,n)}},xJ=class extends yJ{constructor(e,t,n){super(`YAMLWarning`,e,t,n)}},SJ=(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 CJ(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 wJ(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(wJ(t.key)||wJ(t.value))return!0}return!1;default:return!0}}function TJ(e,t,n){if(t?.type===`flow-collection`){let r=t.end[0];r.indent===e&&(r.source===`]`||r.source===`}`)&&wJ(t)&&n(r,`BAD_INDENT`,`Flow end indicator should be more indented than parent`,!0)}}function EJ(e,t,n){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let i=typeof r==`function`?r:(e,t)=>e===t||XG(e)&&XG(t)&&e.value===t.value;return t.some(e=>i(e.key,n))}var DJ=`All mapping items must start at the same column`;function OJ({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??mq)(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=CJ(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`,DJ)),!p.anchor&&!p.tag&&!d){c=p.end,p.comment&&(o.comment?o.comment+=`
`+p.comment:o.comment=p.comment);continue}(p.newlineAfterProp||wJ(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`,DJ);n.atKey=!0;let h=p.end,g=u?e(n,u,p,i):t(n,h,l,null,p,i);n.schema.compat&&TJ(r.indent,u,i),n.atKey=!1,EJ(n,o.items,g)&&i(h,`DUPLICATE_KEY`,`Map keys must be unique`);let _=CJ(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&&TJ(r.indent,f,i),s=c.range[2];let l=new cq(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 cq(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 kJ({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??gq)(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=CJ(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&&TJ(r.indent,l,i),s=d.range[2],o.items.push(d)}return o.range=[r.offset,s,c??s],o}function AJ(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 jJ=`Block collections are not allowed within flow collections`,MJ=e=>e&&(e.type===`block-map`||e.type===`block-seq`);function NJ({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=r.start.source===`{`,s=o?`flow map`:`flow sequence`,c=new((a?.nodeClass)??(o?mq:gq))(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=CJ(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&&wJ(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];YG(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],MJ(m)&&i(r.range,`BLOCK_IN_FLOW`,jJ)}else{n.atKey=!0;let a=h.end,g=f?e(n,f,h,i):t(n,a,d,null,h,i);MJ(f)&&i(g.range,`BLOCK_IN_FLOW`,jJ),n.atKey=!1;let _=CJ(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?MJ(m)&&i(v.range,`BLOCK_IN_FLOW`,jJ):_.comment&&(g.comment?g.comment+=`
`+_.comment:g.comment=_.comment);let y=new cq(g,v);if(n.options.keepSourceTokens&&(y.srcToken=l),o){let e=c;EJ(n,e.items,g)&&i(a,`DUPLICATE_KEY`,`Map keys must be unique`),e.items.push(y)}else{let e=new mq(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=AJ(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 PJ(e,t,n,r,i,a){let o=n.type===`block-map`?OJ(e,t,n,r,a):n.type===`block-seq`?kJ(e,t,n,r,a):NJ(e,t,n,r,a),s=o.constructor;return i===`!`||i===s.tagName?(o.tag=s.tagName,o):(i&&(o.tag=i),o)}function FJ(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===mq.tagName&&s===`map`||o===gq.tagName&&s===`seq`)return PJ(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),PJ(e,t,n,i,o)}let l=PJ(e,t,n,i,o,c),u=c.resolve?.(l,e=>i(a,`TAG_RESOLVE_FAILED`,e),t.options)??l,d=$G(u)?u:new SK(u);return d.range=l.range,d.tag=o,c?.format&&(d.format=c.format),d}function IJ(e,t,n){let r=t.offset,i=LJ(t,e.options.strict,n);if(!i)return{value:``,type:null,comment:``,range:[r,r,r]};let a=i.mode===`>`?SK.BLOCK_FOLDED:SK.BLOCK_LITERAL,o=t.source?RJ(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 mJ=class e{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,HG,{value:LG});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 cK({version:a}),this.setSchema(a,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){let t=Object.create(e.prototype,{[HG]:{value:LG}});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=XG(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(e){hJ(this.contents)&&this.contents.add(e)}addIn(e,t){hJ(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=uK(this);e.anchor=!t||n.has(t)?dK(t||`a`,n):t}return new gK(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}=fK(this,a||`a`),p={aliasDuplicateObjects:i??!0,keepUndefined:s??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:f},m=SK(e,l,p);return o&&YG(m)&&(m.flow=!0),d(),m}createPair(e,t,n={}){return new aq(this.createNode(e,null,n),this.createNode(t,null,n))}delete(e){return hJ(this.contents)?this.contents.delete(e):!1}deleteIn(e){return wK(e)?this.contents!=null&&(this.contents=null,!0):hJ(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return YG(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return wK(e)?!t&&qG(this.contents)?this.contents.value:this.contents:YG(this.contents)?this.contents.getIn(e,t):void 0}has(e){return YG(this.contents)?this.contents.has(e):!1}hasIn(e){return wK(e)?this.contents!==void 0:YG(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=CK(this.schema,[e],t):hJ(this.contents)&&this.contents.set(e,t)}setIn(e,t){wK(e)?this.contents=t:this.contents==null?this.contents=CK(this.schema,Array.from(e),t):hJ(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 cK({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 cK({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 fJ(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=mK(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`?pK(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 pJ(this,e)}};function hJ(e){if(YG(e))return!0;throw Error(`Expected a YAML collection as document contents`)}var gJ=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},_J=class extends gJ{constructor(e,t,n){super(`YAMLParseError`,e,t,n)}},vJ=class extends gJ{constructor(e,t,n){super(`YAMLWarning`,e,t,n)}},yJ=(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 bJ(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 xJ(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(xJ(t.key)||xJ(t.value))return!0}return!1;default:return!0}}function SJ(e,t,n){if(t?.type===`flow-collection`){let r=t.end[0];r.indent===e&&(r.source===`]`||r.source===`}`)&&xJ(t)&&n(r,`BAD_INDENT`,`Flow end indicator should be more indented than parent`,!0)}}function CJ(e,t,n){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let i=typeof r==`function`?r:(e,t)=>e===t||qG(e)&&qG(t)&&e.value===t.value;return t.some(e=>i(e.key,n))}var wJ=`All mapping items must start at the same column`;function TJ({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??dq)(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=bJ(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`,wJ)),!p.anchor&&!p.tag&&!d){c=p.end,p.comment&&(o.comment?o.comment+=`
`+p.comment:o.comment=p.comment);continue}(p.newlineAfterProp||xJ(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`,wJ);n.atKey=!0;let h=p.end,g=u?e(n,u,p,i):t(n,h,l,null,p,i);n.schema.compat&&SJ(r.indent,u,i),n.atKey=!1,CJ(n,o.items,g)&&i(h,`DUPLICATE_KEY`,`Map keys must be unique`);let _=bJ(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&&SJ(r.indent,f,i),s=c.range[2];let l=new aq(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 aq(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 EJ({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??pq)(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=bJ(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&&SJ(r.indent,l,i),s=d.range[2],o.items.push(d)}return o.range=[r.offset,s,c??s],o}function DJ(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 OJ=`Block collections are not allowed within flow collections`,kJ=e=>e&&(e.type===`block-map`||e.type===`block-seq`);function AJ({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=r.start.source===`{`,s=o?`flow map`:`flow sequence`,c=new((a?.nodeClass)??(o?dq:pq))(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=bJ(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&&xJ(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];KG(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],kJ(m)&&i(r.range,`BLOCK_IN_FLOW`,OJ)}else{n.atKey=!0;let a=h.end,g=f?e(n,f,h,i):t(n,a,d,null,h,i);kJ(f)&&i(g.range,`BLOCK_IN_FLOW`,OJ),n.atKey=!1;let _=bJ(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?kJ(m)&&i(v.range,`BLOCK_IN_FLOW`,OJ):_.comment&&(g.comment?g.comment+=`
`+_.comment:g.comment=_.comment);let y=new aq(g,v);if(n.options.keepSourceTokens&&(y.srcToken=l),o){let e=c;CJ(n,e.items,g)&&i(a,`DUPLICATE_KEY`,`Map keys must be unique`),e.items.push(y)}else{let e=new dq(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=DJ(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 jJ(e,t,n,r,i,a){let o=n.type===`block-map`?TJ(e,t,n,r,a):n.type===`block-seq`?EJ(e,t,n,r,a):AJ(e,t,n,r,a),s=o.constructor;return i===`!`||i===s.tagName?(o.tag=s.tagName,o):(i&&(o.tag=i),o)}function MJ(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===dq.tagName&&s===`map`||o===pq.tagName&&s===`seq`)return jJ(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),jJ(e,t,n,i,o)}let l=jJ(e,t,n,i,o,c),u=c.resolve?.(l,e=>i(a,`TAG_RESOLVE_FAILED`,e),t.options)??l,d=XG(u)?u:new yK(u);return d.range=l.range,d.tag=o,c?.format&&(d.format=c.format),d}function NJ(e,t,n){let r=t.offset,i=PJ(t,e.options.strict,n);if(!i)return{value:``,type:null,comment:``,range:[r,r,r]};let a=i.mode===`>`?yK.BLOCK_FOLDED:yK.BLOCK_LITERAL,o=t.source?FJ(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===SK.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===yK.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 LJ({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 RJ(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 zJ(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=SK.PLAIN,c=BJ(a,l);break;case`single-quoted-scalar`:s=SK.QUOTE_SINGLE,c=VJ(a,l);break;case`double-quoted-scalar`:s=SK.QUOTE_DOUBLE,c=UJ(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=AJ(o,u,t,n);return{value:c,type:s,comment:d.comment,range:[r,u,d.offset]}}function BJ(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}`),HJ(e)}function VJ(e,t){return(e[e.length-1]!==`'`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing 'quote`),HJ(e.slice(1,-1)).replace(/''/g,`'`)}function HJ(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 PJ({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 FJ(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 IJ(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=yK.PLAIN,c=LJ(a,l);break;case`single-quoted-scalar`:s=yK.QUOTE_SINGLE,c=RJ(a,l);break;case`double-quoted-scalar`:s=yK.QUOTE_DOUBLE,c=BJ(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=DJ(o,u,t,n);return{value:c,type:s,comment:d.comment,range:[r,u,d.offset]}}function LJ(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}`),zJ(e)}function RJ(e,t){return(e[e.length-1]!==`'`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing 'quote`),zJ(e.slice(1,-1)).replace(/''/g,`'`)}function zJ(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 UJ(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 BJ(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}=WJ(e,r);n+=t,r=i}else if(i===`\\`){let i=e[++r],a=GJ[i];if(a)n+=a;else if(i===`
`){let{fold:t,offset:i}=VJ(e,r);n+=t,r=i}else if(i===`\\`){let i=e[++r],a=HJ[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+=KJ(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+=UJ(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 WJ(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 VJ(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 GJ={0:`\0`,a:`\x07`,b:`\b`,e:`\x1B`,f:`\f`,n:`
`,r:`\r`,t:` `,v:`\v`,N:`…`,_:`\xA0`,L:`\u2028`,P:`\u2029`," ":` `,'"':`"`,"/":`/`,"\\":`\\`," ":` `};function KJ(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 qJ(e,t,n,r){let{value:i,type:a,comment:o,range:s}=t.type===`block-scalar`?IJ(e,t,r):zJ(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[UG]:c?JJ(e.schema,i,c,n,r):t.type===`scalar`?YJ(e,i,t,r):e.schema[UG];let u;try{let a=l.resolve(i,e=>r(n??t,`TAG_RESOLVE_FAILED`,e),e.options);u=XG(a)?a:new SK(a)}catch(e){let a=e instanceof Error?e.message:String(e);r(n??t,`TAG_RESOLVE_FAILED`,a),u=new SK(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 JJ(e,t,n,r,i){if(n===`!`)return e[UG];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[UG])}function YJ({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[UG];if(n.compat){let e=n.compat.find(e=>e.default&&e.test?.test(r))??n[UG];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 XJ(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 ZJ={composeNode:QJ,composeEmptyNode:$J};function QJ(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=eY(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=qJ(e,t,c,r),s&&(l.anchor=s.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:try{l=FJ(ZJ,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??=$J(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&&(!XG(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 $J(e,t,n,r,{spaceBefore:i,comment:a,anchor:o,tag:s,end:c},l){let u=qJ(e,{type:`scalar`,offset:XJ(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 eY({options:e},{offset:t,source:n,end:r},i){let a=new yK(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=AJ(r,o,e.strict,i);return a.range=[t,o,s.offset],s.comment&&(a.comment=s.comment),a}function qee(e,t,{offset:n,start:r,value:i,end:a},o){let s=new _J(void 0,Object.assign({_directives:t},e)),c={atKey:!1,atRoot:!0,directives:s.directives,options:s.options,schema:s.schema},l=CJ(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?QJ(c,i,l,o):$J(c,l.end,r,null,l,o);let u=s.contents.range[2],d=AJ(a,u,!1,o);return d.comment&&(s.comment=d.comment),s.range=[n,u,d.offset],s}function tY(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 nY(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 HJ={0:`\0`,a:`\x07`,b:`\b`,e:`\x1B`,f:`\f`,n:`
`,r:`\r`,t:` `,v:`\v`,N:`…`,_:`\xA0`,L:`\u2028`,P:`\u2029`," ":` `,'"':`"`,"/":`/`,"\\":`\\`," ":` `};function UJ(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 WJ(e,t,n,r){let{value:i,type:a,comment:o,range:s}=t.type===`block-scalar`?NJ(e,t,r):IJ(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[BG]:c?GJ(e.schema,i,c,n,r):t.type===`scalar`?KJ(e,i,t,r):e.schema[BG];let u;try{let a=l.resolve(i,e=>r(n??t,`TAG_RESOLVE_FAILED`,e),e.options);u=qG(a)?a:new yK(a)}catch(e){let a=e instanceof Error?e.message:String(e);r(n??t,`TAG_RESOLVE_FAILED`,a),u=new yK(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 GJ(e,t,n,r,i){if(n===`!`)return e[BG];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[BG])}function KJ({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[BG];if(n.compat){let e=n.compat.find(e=>e.default&&e.test?.test(r))??n[BG];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 qJ(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 JJ={composeNode:YJ,composeEmptyNode:XJ};function YJ(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=ZJ(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=WJ(e,t,c,r),s&&(l.anchor=s.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:try{l=MJ(JJ,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??=XJ(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&&(!qG(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 XJ(e,t,n,r,{spaceBefore:i,comment:a,anchor:o,tag:s,end:c},l){let u=WJ(e,{type:`scalar`,offset:qJ(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 ZJ({options:e},{offset:t,source:n,end:r},i){let a=new gK(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=DJ(r,o,e.strict,i);return a.range=[t,o,s.offset],s.comment&&(a.comment=s.comment),a}function QJ(e,t,{offset:n,start:r,value:i,end:a},o){let s=new mJ(void 0,Object.assign({_directives:t},e)),c={atKey:!1,atRoot:!0,directives:s.directives,options:s.options,schema:s.schema},l=bJ(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?YJ(c,i,l,o):XJ(c,l.end,r,null,l,o);let u=s.contents.range[2],d=DJ(a,u,!1,o);return d.comment&&(s.comment=d.comment),s.range=[n,u,d.offset],s}function $J(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 eY(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 rY=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,n,r)=>{let i=tY(e);r?this.warnings.push(new xJ(i,t,n)):this.errors.push(new bJ(i,t,n))},this.directives=new dK({version:e.version||`1.2`}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=nY(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(QG(i)&&!i.flow&&i.items.length>0){let e=i.items[0];YG(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:nY(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=tY(e);i[0]+=t,this.onError(i,`BAD_DIRECTIVE`,n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case`document`:{let t=qee(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 bJ(tY(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 bJ(tY(e),`UNEXPECTED_TOKEN`,`Unexpected doc-end without preceding document`));break}this.doc.directives.docEnd=!0;let t=AJ(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 bJ(tY(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 _J(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}}},iY=Symbol(`break visit`),aY=Symbol(`skip children`),oY=Symbol(`remove item`);function sY(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),cY(Object.freeze([]),e,t)}sY.BREAK=iY,sY.SKIP=aY,sY.REMOVE=oY,sY.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},sY.parentCollection=(e,t)=>{let n=sY.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 cY(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=cY(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===iY)return iY;else r===oY&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}function lY(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 tY=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,n,r)=>{let i=$J(e);r?this.warnings.push(new vJ(i,t,n)):this.errors.push(new _J(i,t,n))},this.directives=new cK({version:e.version||`1.2`}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=eY(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(YG(i)&&!i.flow&&i.items.length>0){let e=i.items[0];KG(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:eY(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=$J(e);i[0]+=t,this.onError(i,`BAD_DIRECTIVE`,n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case`document`:{let t=QJ(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 _J($J(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 _J($J(e),`UNEXPECTED_TOKEN`,`Unexpected doc-end without preceding document`));break}this.doc.directives.docEnd=!0;let t=DJ(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 _J($J(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 mJ(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}}},nY=Symbol(`break visit`),rY=Symbol(`skip children`),iY=Symbol(`remove item`);function aY(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),oY(Object.freeze([]),e,t)}aY.BREAK=nY,aY.SKIP=rY,aY.REMOVE=iY,aY.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},aY.parentCollection=(e,t)=>{let n=aY.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 oY(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=oY(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===nY)return nY;else r===iY&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}function sY(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 uY(e){switch(e){case void 0:case` `:case`
`:case`\r`:case` `:return!0;default:return!1}}var dY=new Set(`0123456789ABCDEFabcdef`),fY=new Set(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()`),pY=new Set(`,[]{}`),mY=new Set(` ,[]{}
\r `),hY=e=>!e||mY.has(e),gY=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 cY(e){switch(e){case void 0:case` `:case`
`:case`\r`:case` `:return!0;default:return!1}}var lY=new Set(`0123456789ABCDEFabcdef`),uY=new Set(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()`),dY=new Set(`,[]{}`),fY=new Set(` ,[]{}
\r `),pY=e=>!e||fY.has(e),mY=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===`...`)&&uY(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===`...`)&&uY(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&&!uY(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===`:`)&&uY(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(hY),`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(`...`))&&uY(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(hY),`flow`;case`"`:case`'`:return this.flowKey=!0,yield*this.parseQuotedScalar();case`:`:{let e=this.charAt(1);if(this.flowKey||uY(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===`...`)&&cY(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===`...`)&&cY(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&&!cY(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===`:`)&&cY(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(pY),`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(`...`))&&cY(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(pY),`flow`;case`"`:case`'`:return this.flowKey=!0,yield*this.parseQuotedScalar();case`:`:{let e=this.charAt(1);if(this.flowKey||cY(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=>uY(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=>cY(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(uY(r)||e&&pY.has(r))break;t=n}else if(uY(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(cY(r)||e&&dY.has(r))break;t=n}else if(cY(r)){let i=this.buffer[n+1];if(r===`\r`&&(i===`
`?(n+=1,r=`
`,i=this.buffer[n+1]):t=n),i===`#`||e&&pY.has(i))break;if(r===`
`){let e=this.continueScalar(n+1);if(e===-1)break;n=Math.max(n,e-2)}}else{if(e&&pY.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(hY),e+=yield*this.pushSpaces(!0);continue loop;case`-`:case`?`:case`:`:{let t=this.flowLevel>0,n=this.charAt(1);if(uY(n)||t&&pY.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(;!uY(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(fY.has(t))t=this.buffer[++e];else if(t===`%`&&dY.has(this.buffer[e+1])&&dY.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&&dY.has(i))break;if(r===`
`){let e=this.continueScalar(n+1);if(e===-1)break;n=Math.max(n,e-2)}}else{if(e&&dY.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(pY),e+=yield*this.pushSpaces(!0);continue loop;case`-`:case`?`:case`:`:{let t=this.flowLevel>0,n=this.charAt(1);if(cY(n)||t&&dY.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(;!cY(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(uY.has(t))t=this.buffer[++e];else if(t===`%`&&lY.has(this.buffer[e+1])&&lY.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)}},_Y=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 vY(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function yY(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 bY(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 xY(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 SY(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 CY(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 wY(e){if(e.start.type===`flow-seq-start`)for(let t of e.items)t.sep&&!t.value&&!vY(t.start,`explicit-key-ind`)&&!vY(t.sep,`map-value-ind`)&&(t.key&&(t.value=t.key),delete t.key,bY(t.value)?t.value.end?CY(t.value.end,t.sep):t.value.end=t.sep:CY(t.start,t.sep),delete t.sep)}var TY=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 gY,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=lY(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`&&wY(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&&yY(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)}},hY=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 gY(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function _Y(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 vY(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 yY(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 bY(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 xY(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 SY(e){if(e.start.type===`flow-seq-start`)for(let t of e.items)t.sep&&!t.value&&!gY(t.start,`explicit-key-ind`)&&!gY(t.sep,`map-value-ind`)&&(t.key&&(t.value=t.key),delete t.key,vY(t.value)?t.value.end?xY(t.value.end,t.sep):t.value.end=t.sep:xY(t.start,t.sep),delete t.sep)}var CY=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 mY,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=sY(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`&&SY(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&&_Y(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)){CY(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(vY(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=SY(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(vY(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(bY(t.key)&&!vY(t.sep,`newline`)){let e=SY(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]}):vY(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&&!vY(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)){CY(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||vY(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)){xY(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(gY(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=bY(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(gY(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(vY(t.key)&&!gY(t.sep,`newline`)){let e=bY(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]}):gY(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&&!gY(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)){xY(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||gY(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=SY(xY(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=SY(xY(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 EY(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new _Y||null,prettyErrors:t}}function DY(e,t={}){let{lineCounter:n,prettyErrors:r}=EY(t),i=new TY(n?.addNewLine),a=new rY(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 bJ(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(SJ(e,n)),o.warnings.forEach(SJ(e,n))),o}function OY(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let i=DY(e,n);if(!i)return null;if(i.warnings.forEach(e=>QK(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 kY(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 qG(e)&&!r?e.toString(n):new _J(e,r,n).toString(n)}var AY=e=>typeof e==`object`&&!!e&&!Array.isArray(e),jY=e=>AY(e)?Object.entries(e).map(([e,t])=>[e,Array.isArray(t)?t:[]]):[];function MY(e){if(AY(e)){if(AY(e.parallel))return{kind:`parallel`,base:[`parallel`],branches:jY(e.parallel)};if(AY(e.switch))return{kind:`switch`,base:[`switch`,`cases`],on:typeof e.switch.on==`string`?e.switch.on:``,branches:jY(e.switch.cases)}}}function NY(e){return e.slice(2).includes(`parallel`)}function PY(e,t){let n=DY(e).getIn(t,!0);if(JG(n))return n.toJSON()}function FY(e,t,n){let r=DY(e);return r.setIn(t,r.createNode(qY(n))),r.toString()}function IY(e,t,n){let r=DY(e),i=t.slice(0,-1),a=NY(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(ZG(o)||(r.setIn(i,r.createNode([])),o=r.getIn(i,!0)),!ZG(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 LY(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 RY(e,t){let n=e.getIn(t,!0),r=MY(JG(n)?n.toJSON():void 0),i=r?e.getIn([...t,...r.base],!0):void 0;if(!r||!JG(i))throw Error(`This step has no branches.`);return{kind:r.kind,branches:i}}function zY(e,t,n){let r=DY(e),{kind:i,branches:a}=RY(r,t);if(LY(n,i),a.has(n))throw Error(`Branch ${n} already exists.`);return a.set(n,r.createNode([])),r.toString()}function BY(e,t,n,r){let i=DY(e),{kind:a,branches:o}=RY(i,t);if(LY(r,a),n!==r&&o.has(r))throw Error(`Branch ${r} already exists.`);let s=o.items.find(e=>XG(e.key)&&e.key.value===n);if(!s||!XG(s.key))throw Error(`Branch ${n} does not exist.`);return s.key.value=r,i.toString()}function VY(e,t,n){let r=DY(e),{kind:i,branches:a}=RY(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 cX(e,t){let n=JSON.stringify(e??{})+` `+(typeof t==`string`?`{{ ${t.replace(/^!/,``)} }}`:``);return[...new Set([...n.matchAll(iX)].map(e=>e[1]))]}function lX(e){let t=DY(e).toJS(),n=aX(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=aX(e)?e:{},p=MY(d),m=p?.kind??(typeof d.type==`string`?d.type:``),h=aX(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||rX(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\./,``)}`:oX(m,h),summary:sX(h),when:typeof d.when==`string`?d.when:void 0,retry:aX(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 cX([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=MY(t);if(n){let{kind:i,base:a,branches:o}=n,c=p(t,String(e+1),0,u*eX,void 0,void 0,[`steps`,e]);m(l,c,[`steps`,e-1]),u++;let d=aX(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)*tX,y=(e,t,n)=>r.push({id:e,type:`lane`,position:{x:t-12,y:u*eX-40},style:{width:`264px`,height:`${(_+1)*eX-24}px`},zIndex:-1,data:{kind:`step`,key:n,title:n,type:``,detail:``,lane:i}}),b=(u+_)*eX;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)*eX,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*eX,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*eX-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 uX={class:`truncate`},dX=`\0`,fX=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===``)?dX:e.modelValue||void 0,disabled:e.disabled,"onUpdate:modelValue":r[0]||=e=>n(`update:modelValue`,e===dX?``: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===``?dX:e.value,disabled:e.disabled,title:e.label,class:`*:[span]:last:min-w-0`},{default:F(()=>[L(`span`,uX,z(e.label),1)]),_:2},1032,[`value`,`disabled`,`title`]))),128))]),_:1})]),_:1},8,[`model-value`,`disabled`]))}}),pX=[`id`],mX=[`value`],hX=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,mX))),128))],8,pX)],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:kX(e)}))}var DX=/^(\s*)(-\s+)?/,OX=/^([^:#\s][^:#]*?)(:)(\s*)(.*)$/;function kX(e){let{code:t,comment:n}=AX(e),r=jX(t);return n&&r.push({text:n,kind:`comment`}),r}function AX(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 jX(e){if(!e)return[];let t=[],n=DX.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=OX.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,...MX(i[4]??``)]):[...t,...MX(r)]}function MX(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 NX(e){return e.split(`
`)[0]?.trim()||`invalid YAML`}function PX(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function FX(e){return typeof e==`string`&&e.trim()!==``}var IX={class:`space-y-4 px-3 py-3`},LX={key:0,class:`rounded-md bg-danger/10 px-2.5 py-1.5 text-xs text-danger`,role:`alert`},RX={key:1,class:`space-y-3`},zX={key:0,class:`block space-y-1.5`},BX=[`id`],VX=[`value`],HX={class:`text-xs font-medium text-fg-muted`},UX={class:`flex items-center gap-2`},WX={key:1,role:`alert`,class:`text-xs text-danger`},GX={key:2,class:`space-y-1.5`},KX=[`title`],qX={key:4,class:`flex flex-wrap items-center gap-1 pt-0.5`},JX={key:0,class:`divide-y divide-border rounded-md border border-border`},YX=[`title`],XX={key:0,class:`space-y-3`},ZX={class:`text-[13px]`},QX={key:0,class:`text-danger`},$X={class:`ml-2 text-xs text-fg-subtle`},eZ={key:1,class:`space-y-3`},tZ={class:`text-[13px]`},nZ={class:`ml-2 text-xs text-fg-subtle`},rZ=[`title`],iZ={key:0,class:`text-xs text-danger`},aZ={class:`space-y-1.5`},oZ={key:0,role:`alert`,class:`text-xs text-danger`},sZ={class:`divide-y divide-border rounded-md border border-border`},cZ={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},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=[`for`],pZ=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(()=>PY(r.yaml,r.path)??{}),o=J(()=>MY(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`,FY(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`?zY(r.yaml,r.path,t):e===`rename`?BY(r.yaml,r.path,t,n):VY(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(()=>KY(r.yaml,r.path)),_=J(()=>SX(a.value)),v=J(()=>m.value?.settings&&a.value.settings?wX(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`,FY(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(JY(ne.value?.yaml??``,`inputs`)??{})),ie=J(()=>Object.entries(JY(ne.value?.yaml??``,`outputs`)??{})),oe=J(()=>Object.entries(JY(r.yaml,`inputs`)??{})),se=J(()=>Object.entries(JY(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()?OY(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?``:kY(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`,IX,[v.value?(I(),A(`p`,LX,z(v.value),1)):P(``,!0),o.value?(I(),A(`section`,RX,[s.value===`switch`?(I(),A(`label`,zX,[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,VX))),128))],8,BX)])):P(``,!0),L(`div`,HX,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`,UX,[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`,WX,z(f.value),1)):P(``,!0)])):P(``,!0),S.value.lead?(I(),A(`section`,GX,[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,KX),S.value.lead.kind===`workflow`?(I(),K(hX,{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(fX,{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`,qX,[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`,JX,[(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,YX),t.kind===`workflow`?(I(),K(hX,{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(fX,{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=bY(yY(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=bY(yY(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 wY(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new hY||null,prettyErrors:t}}function TY(e,t={}){let{lineCounter:n,prettyErrors:r}=wY(t),i=new CY(n?.addNewLine),a=new tY(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 _J(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(yJ(e,n)),o.warnings.forEach(yJ(e,n))),o}function EY(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let i=TY(e,n);if(!i)return null;if(i.warnings.forEach(e=>YK(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 DY(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 WG(e)&&!r?e.toString(n):new mJ(e,r,n).toString(n)}var OY=e=>typeof e==`object`&&!!e&&!Array.isArray(e),kY=e=>OY(e)?Object.entries(e).map(([e,t])=>[e,Array.isArray(t)?t:[]]):[];function AY(e){if(OY(e)){if(OY(e.parallel))return{kind:`parallel`,base:[`parallel`],branches:kY(e.parallel)};if(OY(e.switch))return{kind:`switch`,base:[`switch`,`cases`],on:typeof e.switch.on==`string`?e.switch.on:``,branches:kY(e.switch.cases)}}}function jY(e){return e.slice(2).includes(`parallel`)}function MY(e,t){let n=TY(e).getIn(t,!0);if(GG(n))return n.toJSON()}function NY(e,t,n){let r=TY(e);return r.setIn(t,r.createNode(GY(n))),r.toString()}function PY(e,t,n){let r=TY(e),i=t.slice(0,-1),a=jY(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(JG(o)||(r.setIn(i,r.createNode([])),o=r.getIn(i,!0)),!JG(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 FY(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 IY(e,t){let n=e.getIn(t,!0),r=AY(GG(n)?n.toJSON():void 0),i=r?e.getIn([...t,...r.base],!0):void 0;if(!r||!GG(i))throw Error(`This step has no branches.`);return{kind:r.kind,branches:i}}function LY(e,t,n){let r=TY(e),{kind:i,branches:a}=IY(r,t);if(FY(n,i),a.has(n))throw Error(`Branch ${n} already exists.`);return a.set(n,r.createNode([])),r.toString()}function RY(e,t,n,r){let i=TY(e),{kind:a,branches:o}=IY(i,t);if(FY(r,a),n!==r&&o.has(r))throw Error(`Branch ${r} already exists.`);let s=o.items.find(e=>qG(e.key)&&e.key.value===n);if(!s||!qG(s.key))throw Error(`Branch ${n} does not exist.`);return s.key.value=r,i.toString()}function zY(e,t,n){let r=TY(e),{kind:i,branches:a}=IY(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 oX(e,t){let n=JSON.stringify(e??{})+` `+(typeof t==`string`?`{{ ${t.replace(/^!/,``)} }}`:``);return[...new Set([...n.matchAll(nX)].map(e=>e[1]))]}function sX(e){let t=TY(e).toJS(),n=rX(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=rX(e)?e:{},p=AY(d),m=p?.kind??(typeof d.type==`string`?d.type:``),h=rX(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||tX(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\./,``)}`:iX(m,h),summary:aX(h),when:typeof d.when==`string`?d.when:void 0,retry:rX(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 oX([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=AY(t);if(n){let{kind:i,base:a,branches:o}=n,c=p(t,String(e+1),0,u*QY,void 0,void 0,[`steps`,e]);m(l,c,[`steps`,e-1]),u++;let d=rX(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)*$Y,y=(e,t,n)=>r.push({id:e,type:`lane`,position:{x:t-12,y:u*QY-40},style:{width:`264px`,height:`${(_+1)*QY-24}px`},zIndex:-1,data:{kind:`step`,key:n,title:n,type:``,detail:``,lane:i}}),b=(u+_)*QY;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)*QY,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*QY,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*QY-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 cX={class:`truncate`},lX=`\0`,uX=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(Cf),{"model-value":e.modelValue===``&&e.options.some(e=>e.value===``)?lX:e.modelValue||void 0,disabled:e.disabled,"onUpdate:modelValue":r[0]||=e=>n(`update:modelValue`,e===lX?``:String(e))},{default:F(()=>[k(B(Af),W({size:e.size??`sm`,class:t.$props.class},t.$attrs),{default:F(()=>[k(B(jf),{placeholder:e.placeholder},null,8,[`placeholder`])]),_:1},16,[`size`,`class`]),k(B(wf),{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(Df),{key:e.value,value:e.value===``?lX:e.value,disabled:e.disabled,title:e.label,class:`*:[span]:last:min-w-0`},{default:F(()=>[L(`span`,cX,z(e.label),1)]),_:2},1032,[`value`,`disabled`,`title`]))),128))]),_:1})]),_:1},8,[`model-value`,`disabled`]))}}),dX=[`id`],fX=[`value`],pX=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,fX))),128))],8,dX)],64)):(I(),K(B(Cf),{key:1,"model-value":e.value||void 0,"onUpdate:modelValue":i[1]||=e=>r(`pick`,String(e))},{default:F(()=>[k(B(Af),{"aria-label":e.label,class:R(t.$props.class)},{default:F(()=>[k(B(jf),{placeholder:`Choose workflow`})]),_:1},8,[`aria-label`,`class`]),k(B(wf),null,{default:F(()=>[e.value& Line truncated
`).map((e,t)=>({number:t+1,text:e,tokens:DX(e)}))}var TX=/^(\s*)(-\s+)?/,EX=/^([^:#\s][^:#]*?)(:)(\s*)(.*)$/;function DX(e){let{code:t,comment:n}=OX(e),r=kX(t);return n&&r.push({text:n,kind:`comment`}),r}function OX(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 kX(e){if(!e)return[];let t=[],n=TX.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=EX.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,...AX(i[4]??``)]):[...t,...AX(r)]}function AX(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 jX(e){return e.split(`
`)[0]?.trim()||`invalid YAML`}function MX(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function NX(e){return typeof e==`string`&&e.trim()!==``}var PX={class:`space-y-4 px-3 py-3`},FX={key:0,class:`rounded-md bg-danger/10 px-2.5 py-1.5 text-xs text-danger`,role:`alert`},IX={key:1,class:`space-y-3`},LX={key:0,class:`block space-y-1.5`},RX=[`id`],zX=[`value`],BX={class:`text-xs font-medium text-fg-muted`},VX={class:`flex items-center gap-2`},HX={key:1,role:`alert`,class:`text-xs text-danger`},UX={key:2,class:`space-y-1.5`},WX=[`title`],GX={key:4,class:`flex flex-wrap items-center gap-1 pt-0.5`},KX={key:0,class:`divide-y divide-border rounded-md border border-border`},qX=[`title`],JX={key:0,class:`space-y-3`},YX={class:`text-[13px]`},XX={key:0,class:`text-danger`},ZX={class:`ml-2 text-xs text-fg-subtle`},QX={key:1,class:`space-y-3`},$X={class:`text-[13px]`},eZ={class:`ml-2 text-xs text-fg-subtle`},tZ=[`title`],nZ={key:0,class:`text-xs text-danger`},rZ={class:`space-y-1.5`},iZ={key:0,role:`alert`,class:`text-xs text-danger`},aZ={class:`divide-y divide-border rounded-md border border-border`},oZ={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},sZ={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},cZ={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},lZ={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},uZ=[`for`],dZ=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(()=>MY(r.yaml,r.path)??{}),o=J(()=>AY(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`,NY(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`?LY(r.yaml,r.path,t):e===`rename`?RY(r.yaml,r.path,t,n):zY(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(()=>WY(r.yaml,r.path)),_=J(()=>bX(a.value)),v=J(()=>m.value?.settings&&a.value.settings?SX(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`,NY(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(KY(ne.value?.yaml??``,`inputs`)??{})),ie=J(()=>Object.entries(KY(ne.value?.yaml??``,`outputs`)??{})),oe=J(()=>Object.entries(KY(r.yaml,`inputs`)??{})),se=J(()=>Object.entries(KY(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:cb(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()?EY(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?``:DY(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`,PX,[v.value?(I(),A(`p`,FX,z(v.value),1)):P(``,!0),o.value?(I(),A(`section`,IX,[s.value===`switch`?(I(),A(`label`,LX,[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,zX))),128))],8,RX)])):P(``,!0),L(`div`,BX,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(ud))]),_:1},8,[`aria-label`,`disabled`,`onClick`])]))),128)),L(`div`,VX,[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(Gu))]),_:1},8,[`aria-label`,`disabled`])]),f.value?(I(),A(`p`,HX,z(f.value),1)):P(``,!0)])):P(``,!0),S.value.lead?(I(),A(`section`,UX,[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(gu),{key:0,class:`size-3 text-fg-subtle`})):P(``,!0)],8,WX),S.value.lead.kind===`workflow`?(I(),K(pX,{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(uX,{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(Kf),{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`,GX,[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`,KX,[(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(gu),{key:0,class:`size-3 text-fg-subtle`})):P(``,!0)],8,qX),t.kind===`workflow`?(I(),K(pX,{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(r_),{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(uX,{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(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`,iZ,z(ge.value[e.key]),1)):P(``,!0)],64))]))),128)),L(`section`,aZ,[_.value?(I(),A(`p`,oZ,z(_.value),1)):P(``,!0),L(`div`,sZ,[L(`label`,cZ,[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`,lZ,[r[21]||=L(`span`,{class:`flex-1 text-[13px]`},`If it fails`,-1),k(fX,{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`,uZ,[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`,dZ,[L(`label`,{for:`${B(n)}-backoff`,class:`flex-1 text-[13px]`},`Retry backoff`,8,fZ),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)]))}}),mZ={class:`space-y-1.5`},hZ={class:`flex items-center text-xs font-medium text-fg-muted`},gZ={key:0,class:`divide-y divide-border rounded-md border border-border`},_Z=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(JY(n.yaml,n.field)??{}));function o(e){r(`update:yaml`,YY(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`,mZ,[L(`div`,hZ,[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`,gZ,[(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(fX,{"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)]))}}),vZ={class:`space-y-4 px-3 py-3`},yZ={class:`divide-y divide-border rounded-md border border-border`},bZ={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},xZ={key:0,role:`alert`,class:`px-3 py-2 text-xs text-danger`},SZ={key:1,class:`px-3 py-2 text-xs text-fg-subtle`},CZ={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},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:`space-y-1.5`},OZ=`6f129e29-0e26-5246-99bd-74cb4496203b`,kZ=N({__name:`WorkflowSettings`,props:{yaml:{}},emits:[`update:yaml`],setup(e,{emit:t}){let n=e,r=t,i=e=>{let t=JY(n.yaml,e);return typeof t==`string`?t:``};function a(e,t){r(`update:yaml`,YY(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===OZ)&&a(`identity`,OZ)}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
`).filter(Boolean))},null,8,[`model-value`,`onUpdate:modelValue`])):(I(),A(H,{key:2},[k(B(Kf),{"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`,nZ,z(ge.value[e.key]),1)):P(``,!0)],64))]))),128)),L(`section`,rZ,[_.value?(I(),A(`p`,iZ,z(_.value),1)):P(``,!0),L(`div`,aZ,[L(`label`,oZ,[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`,sZ,[r[21]||=L(`span`,{class:`flex-1 text-[13px]`},`If it fails`,-1),k(uX,{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`,cZ,[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`,lZ,[L(`label`,{for:`${B(n)}-backoff`,class:`flex-1 text-[13px]`},`Retry backoff`,8,uZ),k(B(Kg),{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)]))}}),fZ={class:`space-y-1.5`},pZ={class:`flex items-center text-xs font-medium text-fg-muted`},mZ={key:0,class:`divide-y divide-border rounded-md border border-border`},hZ=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(KY(n.yaml,n.field)??{}));function o(e){r(`update:yaml`,qY(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`,fZ,[L(`div`,pZ,[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(Gu),{"data-icon":`inline-start`}),n[0]||=V(`Add`,-1)]),_:1})]),a.value.length?(I(),A(`div`,mZ,[(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(uX,{"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(r_),{"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(ud))]),_:1},8,[`aria-label`,`onClick`])]))),128))])):P(``,!0)]))}}),gZ={class:`space-y-4 px-3 py-3`},_Z={class:`divide-y divide-border rounded-md border border-border`},vZ={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},yZ={key:0,role:`alert`,class:`px-3 py-2 text-xs text-danger`},bZ={key:1,class:`px-3 py-2 text-xs text-fg-subtle`},xZ={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},SZ={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},CZ={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},wZ={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},TZ={class:`space-y-1.5`},EZ=`6f129e29-0e26-5246-99bd-74cb4496203b`,DZ=N({__name:`WorkflowSettings`,props:{yaml:{}},emits:[`update:yaml`],setup(e,{emit:t}){let n=e,r=t,i=e=>{let t=KY(n.yaml,e);return typeof t==`string`?t:``};function a(e,t){r(`update:yaml`,qY(n.yaml,e,t))}let o=wv(),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===EZ)&&a(`identity`,EZ)}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=jg(),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 Z3(e,t){return n=>{if(!n.code&&!n.key)return!1;let r=Q3(n.code,e);return Array.isArray(e)?e.some(e=>X3(n[r],e,t,n.type===`keyup`)):X3(n[r],e,t,n.type===`keyup`)}}function Q3(e,t){return t.includes(e)?`code`:`key`}function $3(e,t){let n=J(()=>Je(t?.target)??q3),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}),KQ([`blur`,`contextmenu`],s),JQ((...e)=>o(...e),e=>{let n=Je(t?.actInsideInputWithModifier)??!0,a=Je(t?.preventDefault)??!1;if(i=Y3(e),(!i||i&&!n)&&J3(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}),JQ((...e)=>o(...e),e=>{let n=Je(t?.actInsideInputWithModifier)??!0;if(r.value){if((!i||i&&!n)&&J3(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`?Z3(e,a):e}return r}var e6=`vue-flow__node-desc`,t6=`vue-flow__edge-desc`,n6=`vue-flow__aria-live`,r6=[`Enter`,` `,`Escape`],i6={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function a6(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function o6(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 s6(e){return{width:e.offsetWidth,height:e.offsetHeight}}function c6(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function l6(e,t){return{x:c6(e.x,t[0][0],t[1][0]),y:c6(e.y,t[0][1],t[1][1])}}function u6(e){let t=e.getRootNode();return`elementFromPoint`in t?t:window.document}function d6(e){return e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e}function f6(e){return e&&typeof e==`object`&&`id`in e&&`position`in e&&!d6(e)}function p6(e){return f6(e)&&`computedPosition`in e}function m6(e){return!Number.isNaN(e)&&Number.isFinite(e)}function h6(e){return m6(e.width)&&m6(e.height)&&m6(e.x)&&m6(e.y)}function g6(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:N8(e.data)?e.data:{},events:Ge(N8(e.events)?e.events:{})};return Object.assign(t??r,e,{id:e.id.toString(),parentNode:n})}function _6(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:N8(e.data)?e.data:{},events:Ge(N8(e.events)?e.events:{}),label:e.label??``,interactionWidth:e.interactionWidth??n?.interactionWidth,...n??{}};return Object.assign(t??r,e,{id:e.id.toString()})}function v6(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 y6(...e){if(e.length===3){let[t,n,r]=e;return v6(t,n,r,`target`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>d6(e)&&e.source===r).map(e=>n.find(t=>f6(t)&&t.id===e.target))}function b6(...e){if(e.length===3){let[t,n,r]=e;return v6(t,n,r,`source`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>d6(e)&&e.target===r).map(e=>n.find(t=>f6(t)&&t.id===e.source))}function x6({source:e,sourceHandle:t,target:n,targetHandle:r}){return`vueflow__edge-${e}${t??``}-${n}${r??``}`}function S6(e,t){return t.some(t=>d6(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 C6({x:e,y:t},{x:n,y:r,zoom:i}){return{x:e*i+n,y:t*i+r}}function w6({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?g8(s,o):s}function T6(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 E6({x:e,y:t,width:n,height:r}){return{x:e,y:t,x2:e+n,y2:t+r}}function D6({x:e,y:t,x2:n,y2:r}){return{x:e,y:t,width:n-e,height:r-t}}function O6(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=T6(t,E6({...r.computedPosition,...r.dimensions}))}return D6(t)}function k6(e,t,n={x:0,y:0,zoom:1},r=!1,i=!1){let a={...w6(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 Y3(e,t){return n=>{if(!n.code&&!n.key)return!1;let r=X3(n.code,e);return Array.isArray(e)?e.some(e=>J3(n[r],e,t,n.type===`keyup`)):J3(n[r],e,t,n.type===`keyup`)}}function X3(e,t){return t.includes(e)?`code`:`key`}function Z3(e,t){let n=J(()=>Je(t?.target)??G3),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}),WQ([`blur`,`contextmenu`],s),KQ((...e)=>o(...e),e=>{let n=Je(t?.actInsideInputWithModifier)??!0,a=Je(t?.preventDefault)??!1;if(i=q3(e),(!i||i&&!n)&&K3(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}),KQ((...e)=>o(...e),e=>{let n=Je(t?.actInsideInputWithModifier)??!0;if(r.value){if((!i||i&&!n)&&K3(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`?Y3(e,a):e}return r}var Q3=`vue-flow__node-desc`,$3=`vue-flow__edge-desc`,e6=`vue-flow__aria-live`,t6=[`Enter`,` `,`Escape`],n6={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function r6(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function i6(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 a6(e){return{width:e.offsetWidth,height:e.offsetHeight}}function o6(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function s6(e,t){return{x:o6(e.x,t[0][0],t[1][0]),y:o6(e.y,t[0][1],t[1][1])}}function c6(e){let t=e.getRootNode();return`elementFromPoint`in t?t:window.document}function l6(e){return e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e}function u6(e){return e&&typeof e==`object`&&`id`in e&&`position`in e&&!l6(e)}function d6(e){return u6(e)&&`computedPosition`in e}function f6(e){return!Number.isNaN(e)&&Number.isFinite(e)}function p6(e){return f6(e.width)&&f6(e.height)&&f6(e.x)&&f6(e.y)}function m6(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:j8(e.data)?e.data:{},events:Ge(j8(e.events)?e.events:{})};return Object.assign(t??r,e,{id:e.id.toString(),parentNode:n})}function h6(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:j8(e.data)?e.data:{},events:Ge(j8(e.events)?e.events:{}),label:e.label??``,interactionWidth:e.interactionWidth??n?.interactionWidth,...n??{}};return Object.assign(t??r,e,{id:e.id.toString()})}function g6(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 _6(...e){if(e.length===3){let[t,n,r]=e;return g6(t,n,r,`target`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>l6(e)&&e.source===r).map(e=>n.find(t=>u6(t)&&t.id===e.target))}function v6(...e){if(e.length===3){let[t,n,r]=e;return g6(t,n,r,`source`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>l6(e)&&e.target===r).map(e=>n.find(t=>u6(t)&&t.id===e.source))}function y6({source:e,sourceHandle:t,target:n,targetHandle:r}){return`vueflow__edge-${e}${t??``}-${n}${r??``}`}function b6(e,t){return t.some(t=>l6(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 x6({x:e,y:t},{x:n,y:r,zoom:i}){return{x:e*i+n,y:t*i+r}}function S6({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?m8(s,o):s}function C6(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 w6({x:e,y:t,width:n,height:r}){return{x:e,y:t,x2:e+n,y2:t+r}}function T6({x:e,y:t,x2:n,y2:r}){return{x:e,y:t,width:n-e,height:r-t}}function E6(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=C6(t,w6({...r.computedPosition,...r.dimensions}))}return T6(t)}function D6(e,t,n={x:0,y:0,zoom:1},r=!1,i=!1){let a={...S6(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`},u8=class extends Error{constructor(e,...t){super(l8[e]?.call(l8,...t)),this.name=`VueFlowError`,this.code=e,this.args=t}};function d8(e){return`clientX`in e}function f8(e){return`sourceEvent`in e}function p8(e,t){let n=d8(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 m8=()=>typeof navigator<`u`&&(navigator==null?void 0:navigator.userAgent)?.indexOf(`Mac`)>=0;function h8(e){return{width:e.dimensions?.width??e.width??0,height:e.dimensions?.height??e.height??0}}function g8(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}var _8=()=>!0;function v8(e){e?.classList.remove(`valid`,`connecting`,`vue-flow__handle-valid`,`vue-flow__handle-connecting`)}function y8(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())o6(i,a6(e))>0&&r.push(e);return r}var b8=250;function x8(e,t,n,r){let i=[],a=1/0,o=y8(e,n,t+b8);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}=i8(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 S8(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=_8},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:_}=p8(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=C8(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===U3.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=E8(t,e,a,p,n,!0)}return b}function C8(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function w8(e,t){let n=null;return t?n=`valid`:e&&!t&&(n=`invalid`),n}function T8(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}function E8(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===U3.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,...i8(o,c,c.position,!0)}:c}var D8={[B3.Left]:B3.Right,[B3.Right]:B3.Left,[B3.Top]:B3.Bottom,[B3.Bottom]:B3.Top},O8=[`production`,`prod`];function k8(e,...t){A8()&&console.warn(`[Vue Flow]: ${e}`,...t)}function A8(){return!O8.includes(`production`)}function j8(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,...s6(t)}}):null}function M8(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 N8(e){return B(e)!==void 0}function P8(e,t,n,r){if(!e||!e.source||!e.target)return n(new u8(c8.EDGE_INVALID,e?.id??`[ID UNKNOWN]`)),!1;let i;return i=d6(e)?e:{...e,id:x6(e)},i=_6(i,void 0,r),!S6(i,t)&&i}function F8(e,t,n,r,i){if(!t.source||!t.target)return i(new u8(c8.EDGE_INVALID,e.id)),!1;if(!n)return i(new u8(c8.EDGE_NOT_FOUND,e.id)),!1;let{id:a,...o}=e;return{...o,id:r?x6(t):a,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function I8(e,t,n){let r={},i=[];for(let a=0;a<e.length;++a){let o=e[a];if(!f6(o)){n(new u8(c8.NODE_INVALID,o?.id));continue}let s=g6(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 u8(c8.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 L8(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 R8(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}`;L8(`source`,o,`${r}-${a}--Line truncated
`)},z(e.data.summary||e.data.detail),9,d9)):P(``,!0),e.data.when||e.data.retry||e.data.continues?(I(),A(`div`,f9,[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`,m9,z(e.data.when),1)],8,p9)):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,h9)):P(``,!0),e.data.continues?(I(),A(`span`,g9,[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,_9)):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(v5),{type:`source`,position:B(B3).Bottom},null,8,[`position`]),k(B(v5),{id:`data-out`,type:`source`,position:B(B3).Right,class:`!opacity-0`},null,8,[`position`]),e.data.type===`switch`?(I(),K(B(v5),{key:1,id:`otherwise`,type:`source`,position:B(B3).Right,class:`!opacity-0`},null,8,[`position`])):P(``,!0)],2))}}),y9={class:`pointer-events-none size-full rounded-xl border border-dashed border-border bg-muted/30`},b9={class:`flex items-center gap-1 px-2.5 pt-1.5 text-[11px] text-fg-subtle`},Jee={key:0},Yee={key:1,class:`font-mono`},Xee=N({__name:`LaneNode`,props:{data:{}},setup(e){return(t,n)=>(I(),A(`div`,y9,[L(`div`,b9,[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`,Jee,`otherwise`)):(I(),A(`span`,Yee,`= `+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))])]))}}),Zee={class:`flex shrink-0 items-center justify-center gap-1 border-t border-border bg-card p-1`},x9=240,Qee=416,S9=-140,$ee=72,ete=.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&&NY(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=QY(lX(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-$ee))}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
Edge: ${e}`,USEVUEFLOW_OPTIONS:()=>`The options parameter is deprecated and will be removed in the next major version. Please use the id parameter instead`},c8=class extends Error{constructor(e,...t){super(s8[e]?.call(s8,...t)),this.name=`VueFlowError`,this.code=e,this.args=t}};function l8(e){return`clientX`in e}function u8(e){return`sourceEvent`in e}function d8(e,t){let n=l8(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 f8=()=>typeof navigator<`u`&&(navigator==null?void 0:navigator.userAgent)?.indexOf(`Mac`)>=0;function p8(e){return{width:e.dimensions?.width??e.width??0,height:e.dimensions?.height??e.height??0}}function m8(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}var h8=()=>!0;function g8(e){e?.classList.remove(`valid`,`connecting`,`vue-flow__handle-valid`,`vue-flow__handle-connecting`)}function _8(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())i6(i,r6(e))>0&&r.push(e);return r}var v8=250;function y8(e,t,n,r){let i=[],a=1/0,o=_8(e,n,t+v8);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}=n8(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 b8(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=h8},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:_}=d8(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=x8(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===V3.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=w8(t,e,a,p,n,!0)}return b}function x8(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function S8(e,t){let n=null;return t?n=`valid`:e&&!t&&(n=`invalid`),n}function C8(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}function w8(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===V3.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,...n8(o,c,c.position,!0)}:c}var T8={[R3.Left]:R3.Right,[R3.Right]:R3.Left,[R3.Top]:R3.Bottom,[R3.Bottom]:R3.Top},E8=[`production`,`prod`];function D8(e,...t){O8()&&console.warn(`[Vue Flow]: ${e}`,...t)}function O8(){return!E8.includes(`production`)}function k8(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,...a6(t)}}):null}function A8(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 j8(e){return B(e)!==void 0}function M8(e,t,n,r){if(!e||!e.source||!e.target)return n(new c8(o8.EDGE_INVALID,e?.id??`[ID UNKNOWN]`)),!1;let i;return i=l6(e)?e:{...e,id:y6(e)},i=h6(i,void 0,r),!b6(i,t)&&i}function N8(e,t,n,r,i){if(!t.source||!t.target)return i(new c8(o8.EDGE_INVALID,e.id)),!1;if(!n)return i(new c8(o8.EDGE_NOT_FOUND,e.id)),!1;let{id:a,...o}=e;return{...o,id:r?y6(t):a,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function P8(e,t,n){let r={},i=[];for(let a=0;a<e.length;++a){let o=e[a];if(!u6(o)){n(new c8(o8.NODE_INVALID,o?.id));continue}let s=m6(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 c8(o8.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 F8(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 I8(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}`;F8(`source`,o,`${r}-${a}--Line truncated
`)},z(e.data.summary||e.data.detail),9,l9)):P(``,!0),e.data.when||e.data.retry||e.data.continues?(I(),A(`div`,u9,[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(wu),{class:`size-3 shrink-0`,"aria-hidden":`true`}),L(`span`,f9,z(e.data.when),1)],8,d9)):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(qu),{class:`size-3`,"aria-hidden":`true`}),V(`×`+z(e.data.retry),1)],8,p9)):P(``,!0),e.data.continues?(I(),A(`span`,m9,[k(B(id),{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,h9)):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(g5),{type:`source`,position:B(R3).Bottom},null,8,[`position`]),k(B(g5),{id:`data-out`,type:`source`,position:B(R3).Right,class:`!opacity-0`},null,8,[`position`]),e.data.type===`switch`?(I(),K(B(g5),{key:1,id:`otherwise`,type:`source`,position:B(R3).Right,class:`!opacity-0`},null,8,[`position`])):P(``,!0)],2))}}),_9={class:`pointer-events-none size-full rounded-xl border border-dashed border-border bg-muted/30`},v9={class:`flex items-center gap-1 px-2.5 pt-1.5 text-[11px] text-fg-subtle`},y9={key:0},Yee={key:1,class:`font-mono`},Xee=N({__name:`LaneNode`,props:{data:{}},setup(e){return(t,n)=>(I(),A(`div`,_9,[L(`div`,v9,[e.data.lane===`switch`?(I(),A(H,{key:0},[k(B(od),{class:`size-3`,"aria-hidden":`true`}),e.data.title==="default"?(I(),A(`span`,y9,`otherwise`)):(I(),A(`span`,Yee,`= `+z(e.data.title),1))],64)):(I(),A(H,{key:1},[k(B(Eu),{class:`size-3`,"aria-hidden":`true`}),V(z(e.data.title),1)],64))])]))}}),Zee={class:`flex shrink-0 items-center justify-center gap-1 border-t border-border bg-card p-1`},b9=240,Qee=416,x9=-140,$ee=72,ete=.9,S9=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&&jY(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=XY(sX(n.yaml),n.stages??[]);return n.types?.length?{nodes:[{id:`workflow`,type:`step`,position:{x:0,y:x9},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-$ee))}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+b9};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+b9/2,r=e.style?.width?parseFloat(String(e.style.width)):e.type===`step`?b9:32,i=e.position.x+r/2;return Math.abs(i-n)<b9/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&&t> 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=DY(e).toJS(),n=new Map;for(let r of lX(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 ate={class:`flex flex-col gap-3 md:grid md:h-[calc(100dvh-17rem)] md:min-h-[26rem] md:grid-cols-[18rem_1fr]`},ote=[`aria-current`,`onClick`],ste={class:`flex items-center gap-2 text-sm`},cte={class:`font-mono text-xs text-fg-subtle`},lte=[`title`],ute={key:0,class:`px-3 py-2 text-sm text-fg-muted`},dte={key:1,class:`flex min-h-0 flex-col gap-2`},fte={class:`flex items-center gap-2 max-md:flex-wrap`},pte={key:0,class:`rounded-lg border border-border p-4 text-sm text-fg-muted`},mte={key:1,class:`min-h-0 flex-1 overflow-auto rounded-lg border border-border py-2 font-mono text-[13px] leading-6`},hte={class:`inline-block w-4 select-none text-fg-subtle`},gte={key:2,class:`grid min-h-0 flex-1 gap-3 max-md:flex-none md:grid-cols-2`},_te={class:`flex min-h-0 flex-col gap-1`},vte={class:`text-xs font-medium text-fg-muted`},yte={class:`min-h-0 flex-1 max-md:h-72 max-md:flex-none`},bte={class:`flex min-h-0 flex-col gap-1`},xte={class:`min-h-0 flex-1 max-md:h-72 max-md:flex-none`},Ste=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?[]:ite(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`,ate,[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`,ste,[L(`span`,cte,`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,lte)],10,ote)]))),128)),e.revisions.length?P(``,!0):(I(),A(`li`,ute,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`,dte,[L(`div`,fte,[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`,pte,`Workflow removed in this revision.`)):a.value===`yaml`?(I(),A(`pre`,mte,[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`,hte 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 C9(e){let t=TY(e).toJS(),n=new Map;for(let r of sX(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 w9(e,t,n){let r=C9(e),i=C9(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 ate={class:`flex flex-col gap-3 md:grid md:h-[calc(100dvh-17rem)] md:min-h-[26rem] md:grid-cols-[18rem_1fr]`},ote=[`aria-current`,`onClick`],ste={class:`flex items-center gap-2 text-sm`},cte={class:`font-mono text-xs text-fg-subtle`},lte=[`title`],ute={key:0,class:`px-3 py-2 text-sm text-fg-muted`},dte={key:1,class:`flex min-h-0 flex-col gap-2`},fte={class:`flex items-center gap-2 max-md:flex-wrap`},pte={key:0,class:`rounded-lg border border-border p-4 text-sm text-fg-muted`},mte={key:1,class:`min-h-0 flex-1 overflow-auto rounded-lg border border-border py-2 font-mono text-[13px] leading-6`},hte={class:`inline-block w-4 select-none text-fg-subtle`},gte={key:2,class:`grid min-h-0 flex-1 gap-3 max-md:flex-none md:grid-cols-2`},_te={class:`flex min-h-0 flex-col gap-1`},vte={class:`text-xs font-medium text-fg-muted`},yte={class:`min-h-0 flex-1 max-md:h-72 max-md:flex-none`},bte={class:`flex min-h-0 flex-col gap-1`},xte={class:`min-h-0 flex-1 max-md:h-72 max-md:flex-none`},Ste=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?[]:ite(s.value,n.current)),l=J(()=>s.value!==null&&s.value===n.current),u=J(()=>s.value===null?{}:w9(s.value,n.current,`removed`)),d=J(()=>s.value===null?{}:w9(n.current,s.value,`added`)),f={added:`default`,edited:`secondary`,removed:`destructive`};return(t,n)=>(I(),A(`div`,ate,[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`,ste,[L(`span`,cte,`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(ph)(e.at)),9,lte)],10,ote)]))),128)),e.revisions.length?P(``,!0):(I(),A(`li`,ute,z(e.error||`No recorded changes`),1))],2),e.revisions.length?(I(),K(B(Cf),{key:0,"model-value":String(i.value),"onUpdate:modelValue":n[0]||=e=>i.value=Number(e)},{default:F(()=>[k(B(Af),{class:`w-full md:hidden`,"aria-label":`Revision`},{default:F(()=>[k(B(jf))]),_:1}),k(B(wf),null,{default:F(()=>[(I(!0),A(H,null,j(e.revisions,e=>(I(),K(B(Df),{key:e.version,value:String(e.version)},{default:F(()=>[V(`v`+z(e.version)+` · `+z(e.change)+` · `+z(e.actor||`unknown`)+` · `+z(B(ph)(e.at)),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1},8,[`model-value`])):P(``,!0),o.value?(I(),A(`div`,dte,[L(`div`,fte,[k(B(Ox),{modelValue:a.value,"onUpdate:modelValue":n[1]||=e=>a.value=e},{default:F(()=>[k(B(Ax),null,{default:F(()=>[k(B(jx),{value:`yaml`},{default:F(()=>[...n[3]||=[V(`YAML`,-1)]]),_:1}),k(B(jx),{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(Yu),{"data-icon":`inline-start`}),n[5]||=V(` Restore this version`,-1)]),_:1},8,[`disabled`,`title`])]),s.value===null?(I(),A(`p`,pte,`Workflow removed in this revision.`)):a.value===`yaml`?(I(),A(`pre`,mte,[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`,hte 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`,kte,[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,Ate)):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,jte),[[gt,i.value]]),c.value?(I(),A(`span`,Mte,[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)]))}}),Pte=20;function Fte(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:Pte}):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 OY(e)}catch{return null}}function Ite(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=Lte(k9(r.yaml),e);t&&n.push({kind:`workflow`,label:r.id,detail:t})}return n}function Lte(e,t){let n=(O9(e)&&Array.isArray(e.steps)?e.steps:[]).flatMap(e=>MY(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||Rte(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 Rte(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 zte(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(()=>Ite(e.value,{routes:n.intakeRoutes,bindings:r.value,playbooks:t.stateFor(`eda-playbooks`).resource?.value?.playbooks??[],definitions:n.collection.definitions})),reload:i}}var Bte={class:`workflow-editor-toolbar flex shrink-0 items-center gap-2 max-sm:grid max-sm:grid-cols-[1fr_auto]`},Vte={class:`ml-1 font-mono text-xs text-fg-subtle`},Hte={key:0,class:`shrink-0 text-xs font-medium text-fg-muted xl:hidden`},Ute={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`,kte,[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,Ate)):P(``,!0),L(`form`,{class:`flex items-center gap-2 px-3 py-2`,onSubmit:pt(u,[`prevent`])},[k(B(ad),{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,jte),[[gt,i.value]]),c.value?(I(),A(`span`,Mte,[k(B(rb)),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(sd))]),_:1})):(I(),K(B(Y),{key:2,type:`submit`,size:`icon-sm`,"aria-label":`Send`,disabled:!i.value.trim()},{default:F(()=>[k(B(ru))]),_:1},8,[`disabled`]))],32)]))}}),Pte=20;function D9(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:Pte}):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()}),bh(`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 EY(e)}catch{return null}}function Fte(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=Ite(k9(r.yaml),e);t&&n.push({kind:`workflow`,label:r.id,detail:t})}return n}function Ite(e,t){let n=(O9(e)&&Array.isArray(e.steps)?e.steps:[]).flatMap(e=>AY(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||Lte(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 Lte(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 Rte(e){let t=jg(),n=KA(),r=q([]);async function i(){let e=await X.bindings().catch(()=>null);r.value=e?.bindings??[]}return Ue(i),{triggers:J(()=>Fte(e.value,{routes:n.intakeRoutes,bindings:r.value,playbooks:t.stateFor(`eda-playbooks`).resource?.value?.playbooks??[],definitions:n.collection.definitions})),reload:i}}var zte={class:`workflow-editor-toolbar flex shrink-0 items-center gap-2 max-sm:grid max-sm:grid-cols-[1fr_auto]`},Bte={class:`ml-1 font-mono text-xs text-fg-subtle`},Vte={key:0,class:`shrink-0 text-xs font-medium text-fg-muted xl:hidden`},Hte={role:`group`,"aria-label":`Runs`,class:`workflow-run-actions ml-auto flex min-w-0 items-center gap-1 Line truncated
+6 -1
View File
@@ -97,7 +97,12 @@ const nodeClass = computed(() =>
</button>
<div
v-if="stage.error"
class="mt-2 rounded-sm border-l-[3px] border-danger bg-danger-soft px-3 py-2 text-sm break-words whitespace-pre-wrap text-fg-muted"
:class="
cn(
'mt-2 rounded-sm border-l-[3px] px-3 py-2 text-sm break-words whitespace-pre-wrap text-fg-muted',
stage.status === 'interrupted' ? 'border-warn bg-warn-soft' : 'border-danger bg-danger-soft',
)
"
>
{{ stage.error }}
</div>