feat(ui): workflow canvas cards expand in place instead of side panels
This commit is contained in:
21 files changed
+691
-610
No files matched your search
Vendored
+1
-1
@@ -1 +1 @@
|
||||
import{A as e,Ct as t,D as n,Jt as r,O as i,_ as a,b as o,ht as s,kn as c,lt as l,nr as u,s as d,t as f,v as p,x as m,xt as h,y as g,yn as _}from"./PageHeader.js";import{W as v,h as y,n as b}from"./api.js";import{C as x,S,T as C,w,x as T}from"./index.js";var E={class:`rounded-lg border border-border bg-card p-5`,"aria-labelledby":`personal-tokens`},D={class:`mb-3 flex items-center justify-between gap-2`},O={key:0,class:`mb-3 text-sm text-fg-subtle`},k={key:1,class:`mb-3 text-xs text-fg-subtle`},A={key:2,role:`alert`,class:`mb-3 text-sm text-danger`},j={key:3,class:`mb-3 rounded-lg border border-border bg-card p-3`},M={key:4,class:`text-sm text-fg-subtle`},N={key:5,class:`divide-y divide-border rounded-lg border border-border bg-card`,"aria-label":`API tokens`},P={class:`flex-1 truncate text-xs`},F={class:`text-xs text-fg-subtle`},I=e({__name:`PersonalTokensCard`,setup(e){let t=_(!1),a=_([]),f=_(``),v=_(``),b=_(!1);async function x(e,t={}){let n=await fetch(e,{...t,headers:{Accept:`application/json`,"X-Archie-CSRF":`1`}});if(!n.ok)throw Error((await n.text()).trim());return n.status===204?void 0:await n.json()}async function S(e){b.value=!0;try{await e(),v.value=``}catch(e){v.value=String(e.message||e)}finally{b.value=!1}}let w=()=>S(async()=>{let e=await x(`/api/tokens`);t.value=e?.available??!1,a.value=e?.tokens??[]}),I=()=>S(async()=>{f.value=(await x(`/api/tokens`,{method:`POST`}))?.token??``,await w()}),L=e=>S(async()=>{await x(`/api/tokens/${e}`,{method:`DELETE`}),await w()});return l(w),(e,l)=>(s(),m(`section`,E,[p(`div`,D,[l[2]||=p(`h2`,{id:`personal-tokens`,class:`font-medium`},`API tokens`,-1),t.value?(s(),g(c(y),{key:0,size:`sm`,disabled:b.value,onClick:I},{default:r(()=>[i(c(T),{"data-icon":`inline-start`}),l[1]||=n(`New token`,-1)]),_:1},8,[`disabled`])):o(``,!0)]),!t.value&&!b.value&&!v.value?(s(),m(`p`,O,`Personal tokens need a signed-in person.`)):o(``,!0),t.value?(s(),m(`p`,k,[...l[3]||=[n(`Send it as `,-1),p(`code`,null,`Authorization: Bearer <token>`,-1),n(`.`,-1)]])):o(``,!0),v.value?(s(),m(`p`,A,u(v.value),1)):o(``,!0),f.value?(s(),m(`div`,j,[l[4]||=p(`p`,{class:`mb-2 text-xs`},`Not shown again.`,-1),i(c(C),{"model-value":f.value,readonly:``,"aria-label":`New token`,onFocus:l[0]||=e=>e.target.select()},null,8,[`model-value`])])):o(``,!0),t.value&&!a.value.length&&!b.value&&!v.value?(s(),m(`p`,M,`No tokens yet.`)):o(``,!0),a.value.length?(s(),m(`ul`,N,[(s(!0),m(d,null,h(a.value,e=>(s(),m(`li`,{key:e.id,class:`flex items-center gap-3 px-4 py-2.5`},[p(`code`,P,u(e.id.slice(0,12)),1),p(`span`,F,u(new Date(e.created_at).toLocaleString()),1),i(c(y),{variant:`ghost`,size:`sm`,class:`text-danger`,disabled:b.value,onClick:t=>L(e.id)},{default:r(()=>[...l[5]||=[n(`Revoke`,-1)]]),_:1},8,[`disabled`,`onClick`])]))),128))])):o(``,!0)]))}}),L={class:`max-w-2xl space-y-6`},R={class:`text-sm`},z={key:0,class:`rounded-lg border border-border bg-card p-4 text-sm`},B={key:1,role:`alert`,class:`text-sm text-danger`},V={class:`rounded-lg border border-border bg-card p-5`},H={class:`mt-4 divide-y divide-border`},U={class:`min-w-0 flex-1 truncate`},W={key:1,class:`mt-3 text-sm text-muted-foreground`},G={class:`rounded-lg border border-border bg-card p-5 space-y-3`},K={key:0,class:`break-all rounded border border-border p-3 font-mono text-sm`,role:`status`},q={class:`rounded-lg border border-border bg-card p-5`},J={class:`block space-y-1 text-sm`,for:`current-password`},Y={class:`block space-y-1 text-sm`,for:`new-password`},X=e({__name:`AccountPage`,setup(e){let g=_(``),T=()=>F(async()=>{g.value=(await b.recoveryCode()).code}),E=x(),D=_([]),O=_(``),k=_(!1),A=_(``),j=_(``),M=_(``),N=a(()=>S(E.status?.public_url??``));async function P(){try{D.value=(await b.passkeys()).passkeys}catch(e){O.value=String(e.message||e)}}l(P);async function F(e){k.value=!0,O.value=``;try{await e()}catch(e){O.value=String(e.message||e)}finally{k.value=!1}}let X=()=>F(async()=>{await w(!0,A.value),A.value=``,await P()}),Z=e=>F(async()=>{await b.deletePasskey(e),await P()}),Q=()=>F(async()=>{await b.changePassword(j.value,M.value),j.value=M.value=``,window.location.assign(`/`)});return(e,a)=>{let l=t(`RouterLink`);return s(),m(`div`,L,[i(f,{title:`Your account`}),p(`p`,R,u(c(E).status?.user?.display_name),1),e.$route.query.welcome?(s(),m(`p`,z,[a[5]||=n(`Your organisation and admin account are ready. Add a passkey below, `,-1),i(l,{class:`underline`,to:`/org/members`},{default:r(()=>[...a[3]||=[n(`add members`,-1)]]),_:1}),a[6]||=n(`, or `,-1),i(l,{class:`underline`,to:`/settings/authentication`},{default:r(()=>[...a[4]||=[n(`configure OIDC`,-1)]]),_:1}),a[7]||=n(`.`,-1)])):o(``,!0),O.value?(s(),m(`p`,B,[n(u(O.value)+` `,1),a[8]||=p(`a`,{class:`underline`,href:`/?reauth=1`},`Sign in again`,-1)])):o(``,!0),p(`section`,V,[a[14]||=p(`h2`,{class:`font-medium`},`Passkeys`,-1),a[15]||=p(`p`,{class:`mt-1 text-sm text-muted-foreground`},`Sign in with your device or security key.`,-1),p(`ul`,H,[(s(!0),m(d,null,h(D.value,e=>(s(),m(`li`,{key:e.id,Line truncated
|
||||
import{A as e,Ct as t,D as n,Jt as r,O as i,_ as a,b as o,ht as s,kn as c,lt as l,nr as u,s as d,t as f,v as p,x as m,xt as h,y as g,yn as _}from"./PageHeader.js";import{K as v,_ as y,n as b}from"./api.js";import{C as x,S,T as C,w,x as T}from"./index.js";var E={class:`rounded-lg border border-border bg-card p-5`,"aria-labelledby":`personal-tokens`},D={class:`mb-3 flex items-center justify-between gap-2`},O={key:0,class:`mb-3 text-sm text-fg-subtle`},k={key:1,class:`mb-3 text-xs text-fg-subtle`},A={key:2,role:`alert`,class:`mb-3 text-sm text-danger`},j={key:3,class:`mb-3 rounded-lg border border-border bg-card p-3`},M={key:4,class:`text-sm text-fg-subtle`},N={key:5,class:`divide-y divide-border rounded-lg border border-border bg-card`,"aria-label":`API tokens`},P={class:`flex-1 truncate text-xs`},F={class:`text-xs text-fg-subtle`},I=e({__name:`PersonalTokensCard`,setup(e){let t=_(!1),a=_([]),f=_(``),v=_(``),b=_(!1);async function x(e,t={}){let n=await fetch(e,{...t,headers:{Accept:`application/json`,"X-Archie-CSRF":`1`}});if(!n.ok)throw Error((await n.text()).trim());return n.status===204?void 0:await n.json()}async function S(e){b.value=!0;try{await e(),v.value=``}catch(e){v.value=String(e.message||e)}finally{b.value=!1}}let w=()=>S(async()=>{let e=await x(`/api/tokens`);t.value=e?.available??!1,a.value=e?.tokens??[]}),I=()=>S(async()=>{f.value=(await x(`/api/tokens`,{method:`POST`}))?.token??``,await w()}),L=e=>S(async()=>{await x(`/api/tokens/${e}`,{method:`DELETE`}),await w()});return l(w),(e,l)=>(s(),m(`section`,E,[p(`div`,D,[l[2]||=p(`h2`,{id:`personal-tokens`,class:`font-medium`},`API tokens`,-1),t.value?(s(),g(c(y),{key:0,size:`sm`,disabled:b.value,onClick:I},{default:r(()=>[i(c(T),{"data-icon":`inline-start`}),l[1]||=n(`New token`,-1)]),_:1},8,[`disabled`])):o(``,!0)]),!t.value&&!b.value&&!v.value?(s(),m(`p`,O,`Personal tokens need a signed-in person.`)):o(``,!0),t.value?(s(),m(`p`,k,[...l[3]||=[n(`Send it as `,-1),p(`code`,null,`Authorization: Bearer <token>`,-1),n(`.`,-1)]])):o(``,!0),v.value?(s(),m(`p`,A,u(v.value),1)):o(``,!0),f.value?(s(),m(`div`,j,[l[4]||=p(`p`,{class:`mb-2 text-xs`},`Not shown again.`,-1),i(c(C),{"model-value":f.value,readonly:``,"aria-label":`New token`,onFocus:l[0]||=e=>e.target.select()},null,8,[`model-value`])])):o(``,!0),t.value&&!a.value.length&&!b.value&&!v.value?(s(),m(`p`,M,`No tokens yet.`)):o(``,!0),a.value.length?(s(),m(`ul`,N,[(s(!0),m(d,null,h(a.value,e=>(s(),m(`li`,{key:e.id,class:`flex items-center gap-3 px-4 py-2.5`},[p(`code`,P,u(e.id.slice(0,12)),1),p(`span`,F,u(new Date(e.created_at).toLocaleString()),1),i(c(y),{variant:`ghost`,size:`sm`,class:`text-danger`,disabled:b.value,onClick:t=>L(e.id)},{default:r(()=>[...l[5]||=[n(`Revoke`,-1)]]),_:1},8,[`disabled`,`onClick`])]))),128))])):o(``,!0)]))}}),L={class:`max-w-2xl space-y-6`},R={class:`text-sm`},z={key:0,class:`rounded-lg border border-border bg-card p-4 text-sm`},B={key:1,role:`alert`,class:`text-sm text-danger`},V={class:`rounded-lg border border-border bg-card p-5`},H={class:`mt-4 divide-y divide-border`},U={class:`min-w-0 flex-1 truncate`},W={key:1,class:`mt-3 text-sm text-muted-foreground`},G={class:`rounded-lg border border-border bg-card p-5 space-y-3`},K={key:0,class:`break-all rounded border border-border p-3 font-mono text-sm`,role:`status`},q={class:`rounded-lg border border-border bg-card p-5`},J={class:`block space-y-1 text-sm`,for:`current-password`},Y={class:`block space-y-1 text-sm`,for:`new-password`},X=e({__name:`AccountPage`,setup(e){let g=_(``),T=()=>F(async()=>{g.value=(await b.recoveryCode()).code}),E=x(),D=_([]),O=_(``),k=_(!1),A=_(``),j=_(``),M=_(``),N=a(()=>S(E.status?.public_url??``));async function P(){try{D.value=(await b.passkeys()).passkeys}catch(e){O.value=String(e.message||e)}}l(P);async function F(e){k.value=!0,O.value=``;try{await e()}catch(e){O.value=String(e.message||e)}finally{k.value=!1}}let X=()=>F(async()=>{await w(!0,A.value),A.value=``,await P()}),Z=e=>F(async()=>{await b.deletePasskey(e),await P()}),Q=()=>F(async()=>{await b.changePassword(j.value,M.value),j.value=M.value=``,window.location.assign(`/`)});return(e,a)=>{let l=t(`RouterLink`);return s(),m(`div`,L,[i(f,{title:`Your account`}),p(`p`,R,u(c(E).status?.user?.display_name),1),e.$route.query.welcome?(s(),m(`p`,z,[a[5]||=n(`Your organisation and admin account are ready. Add a passkey below, `,-1),i(l,{class:`underline`,to:`/org/members`},{default:r(()=>[...a[3]||=[n(`add members`,-1)]]),_:1}),a[6]||=n(`, or `,-1),i(l,{class:`underline`,to:`/settings/authentication`},{default:r(()=>[...a[4]||=[n(`configure OIDC`,-1)]]),_:1}),a[7]||=n(`.`,-1)])):o(``,!0),O.value?(s(),m(`p`,B,[n(u(O.value)+` `,1),a[8]||=p(`a`,{class:`underline`,href:`/?reauth=1`},`Sign in again`,-1)])):o(``,!0),p(`section`,V,[a[14]||=p(`h2`,{class:`font-medium`},`Passkeys`,-1),a[15]||=p(`p`,{class:`mt-1 text-sm text-muted-foreground`},`Sign in with your device or security key.`,-1),p(`ul`,H,[(s(!0),m(d,null,h(D.value,e=>(s(),m(`li`,{key:e.id,Line truncated
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
import{d as e,o as t,s as n,t as r}from"./CardAccordion.js";import{A as i,D as a,Jt as o,O as s,_ as c,b as l,ht as u,kn as d,lt as f,nr as p,t as m,v as h,x as g,yn as _}from"./PageHeader.js";import{W as v,h as y}from"./api.js";import{T as b,y as x}from"./index.js";var S={key:0,class:`mb-4 text-sm text-destructive`,role:`alert`},C={key:1,class:`text-sm text-fg-muted`},w=`agent-profiles`,T=i({__name:`AgentProfilesPage`,setup(i){let T=e();f(T.load);let E=c(()=>T.drafts[w]?.value),D=_(``),O=_(``),k=c(()=>T.changesFor(w).length>0),A=c(()=>Object.entries(E.value??{}));function j(){if(k.value)return;let e=D.value.trim();if(!e||E.value?.[e])return;let t=T.drafts[w];t&&(t.value||={},t.value[e]={image:``,kit:``,adapter:``,tools:[]},D.value=``,O.value=String(Object.keys(t.value).indexOf(e)))}function M(e,t){e.tools=String(t).split(`,`).map(e=>e.trim()).filter(Boolean)}return(e,i)=>(u(),g(`div`,null,[s(m,{title:`Agent profiles`},{default:o(()=>[s(t,{kinds:[w]},null,8,[`kinds`])]),_:1}),s(n,{kind:w,class:`mb-4`}),d(T).catalogError||d(T).pageErrorFor(w)?(u(),g(`p`,S,p(d(T).catalogError||d(T).pageErrorFor(w)),1)):l(``,!0),h(`form`,{class:`mb-4 flex gap-2`,onSubmit:v(j,[`prevent`])},[s(d(b),{modelValue:D.value,"onUpdate:modelValue":i[0]||=e=>D.value=e,"aria-label":`Profile name`,placeholder:`Profile name`,class:`max-w-xs`,disabled:k.value},null,8,[`modelValue`,`disabled`]),s(d(y),{type:`submit`,disabled:k.value||!D.value.trim()||!!E.value?.[D.value.trim()]},{default:o(()=>[...i[3]||=[a(`Add profile`,-1)]]),_:1},8,[`disabled`])],32),Object.keys(E.value??{}).length?l(``,!0):(u(),g(`p`,C,`No agent profiles.`)),s(r,{open:O.value,"onUpdate:open":i[1]||=e=>O.value=e,items:A.value,title:([e])=>e,"remove-label":`Remove`,mono:``,onRemove:i[2]||=e=>delete E.value[A.value[e][0]]},{default:o(({item:[e,t]})=>[s(d(x),{label:`Image`,for:`${e}-image`},{default:o(()=>[s(d(b),{id:`${e}-image`,modelValue:t.image,"onUpdate:modelValue":e=>t.image=e,placeholder:`Container image`},null,8,[`id`,`modelValue`,`onUpdate:modelValue`])]),_:2},1032,[`for`]),s(d(x),{label:`Kit`,for:`${e}-kit`,hint:`Pinned digest. Used only when Image is empty.`},{default:o(()=>[s(d(b),{id:`${e}-kit`,modelValue:t.kit,"onUpdate:modelValue":e=>t.kit=e,placeholder:`registry/kit@sha256:…`},null,8,[`id`,`modelValue`,`onUpdate:modelValue`])]),_:2},1032,[`for`]),s(d(x),{label:`Adapter`,for:`${e}-adapter`},{default:o(()=>[s(d(b),{id:`${e}-adapter`,modelValue:t.adapter,"onUpdate:modelValue":e=>t.adapter=e},null,8,[`id`,`modelValue`,`onUpdate:modelValue`])]),_:2},1032,[`for`]),s(d(x),{label:`Tools`,for:`${e}-tools`,hint:`Comma-separated tool names.`},{default:o(()=>[s(d(b),{id:`${e}-tools`,"model-value":(t.tools??[]).join(`, `),"onUpdate:modelValue":e=>M(t,e)},null,8,[`id`,`model-value`,`onUpdate:modelValue`])]),_:2},1032,[`for`])]),_:1},8,[`open`,`items`,`title`])]))}});export{T as default};
|
||||
import{d as e,o as t,s as n,t as r}from"./CardAccordion.js";import{A as i,D as a,Jt as o,O as s,_ as c,b as l,ht as u,kn as d,lt as f,nr as p,t as m,v as h,x as g,yn as _}from"./PageHeader.js";import{K as v,_ as y}from"./api.js";import{T as b,y as x}from"./index.js";var S={key:0,class:`mb-4 text-sm text-destructive`,role:`alert`},C={key:1,class:`text-sm text-fg-muted`},w=`agent-profiles`,T=i({__name:`AgentProfilesPage`,setup(i){let T=e();f(T.load);let E=c(()=>T.drafts[w]?.value),D=_(``),O=_(``),k=c(()=>T.changesFor(w).length>0),A=c(()=>Object.entries(E.value??{}));function j(){if(k.value)return;let e=D.value.trim();if(!e||E.value?.[e])return;let t=T.drafts[w];t&&(t.value||={},t.value[e]={image:``,kit:``,adapter:``,tools:[]},D.value=``,O.value=String(Object.keys(t.value).indexOf(e)))}function M(e,t){e.tools=String(t).split(`,`).map(e=>e.trim()).filter(Boolean)}return(e,i)=>(u(),g(`div`,null,[s(m,{title:`Agent profiles`},{default:o(()=>[s(t,{kinds:[w]},null,8,[`kinds`])]),_:1}),s(n,{kind:w,class:`mb-4`}),d(T).catalogError||d(T).pageErrorFor(w)?(u(),g(`p`,S,p(d(T).catalogError||d(T).pageErrorFor(w)),1)):l(``,!0),h(`form`,{class:`mb-4 flex gap-2`,onSubmit:v(j,[`prevent`])},[s(d(b),{modelValue:D.value,"onUpdate:modelValue":i[0]||=e=>D.value=e,"aria-label":`Profile name`,placeholder:`Profile name`,class:`max-w-xs`,disabled:k.value},null,8,[`modelValue`,`disabled`]),s(d(y),{type:`submit`,disabled:k.value||!D.value.trim()||!!E.value?.[D.value.trim()]},{default:o(()=>[...i[3]||=[a(`Add profile`,-1)]]),_:1},8,[`disabled`])],32),Object.keys(E.value??{}).length?l(``,!0):(u(),g(`p`,C,`No agent profiles.`)),s(r,{open:O.value,"onUpdate:open":i[1]||=e=>O.value=e,items:A.value,title:([e])=>e,"remove-label":`Remove`,mono:``,onRemove:i[2]||=e=>delete E.value[A.value[e][0]]},{default:o(({item:[e,t]})=>[s(d(x),{label:`Image`,for:`${e}-image`},{default:o(()=>[s(d(b),{id:`${e}-image`,modelValue:t.image,"onUpdate:modelValue":e=>t.image=e,placeholder:`Container image`},null,8,[`id`,`modelValue`,`onUpdate:modelValue`])]),_:2},1032,[`for`]),s(d(x),{label:`Kit`,for:`${e}-kit`,hint:`Pinned digest. Used only when Image is empty.`},{default:o(()=>[s(d(b),{id:`${e}-kit`,modelValue:t.kit,"onUpdate:modelValue":e=>t.kit=e,placeholder:`registry/kit@sha256:…`},null,8,[`id`,`modelValue`,`onUpdate:modelValue`])]),_:2},1032,[`for`]),s(d(x),{label:`Adapter`,for:`${e}-adapter`},{default:o(()=>[s(d(b),{id:`${e}-adapter`,modelValue:t.adapter,"onUpdate:modelValue":e=>t.adapter=e},null,8,[`id`,`modelValue`,`onUpdate:modelValue`])]),_:2},1032,[`for`]),s(d(x),{label:`Tools`,for:`${e}-tools`,hint:`Comma-separated tool names.`},{default:o(()=>[s(d(b),{id:`${e}-tools`,"model-value":(t.tools??[]).join(`, `),"onUpdate:modelValue":e=>M(t,e)},null,8,[`id`,`model-value`,`onUpdate:modelValue`])]),_:2},1032,[`for`])]),_:1},8,[`open`,`items`,`title`])]))}});export{T as default};
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
import{A as e,Ct as t,D as n,Jt as r,O as i,b as a,ht as o,kn as s,lt as c,nr as l,t as u,v as d,x as f,yn as p}from"./PageHeader.js";import{W as m,h,n as g}from"./api.js";import{T as _}from"./index.js";var v={class:`max-w-2xl`},y={key:0,class:`mb-4 text-sm text-danger`,role:`alert`},b={class:`space-y-3 rounded-lg border border-border bg-card p-5`},x={for:`instance-url`,class:`block space-y-1 text-sm`},S={class:`space-y-3 rounded-lg border border-border bg-card p-5`},C={for:`oidc-issuer`,class:`block space-y-1 text-sm`},w={for:`oidc-client`,class:`block space-y-1 text-sm`},T={for:`oidc-audience`,class:`block space-y-1 text-sm`},E={class:`break-all text-xs text-muted-foreground`},D={class:`text-xs text-muted-foreground`},O={key:0,role:`status`,class:`text-sm`},k=e({__name:`AuthenticationPage`,setup(e){let k=p({public_url:``,oidc_issuer:``,oidc_audience:``,oidc_client_id:``}),A=p(!1),j=p(``),M=p(!1),N=p(!1);c(async()=>{try{k.value=await g.authentication(),A.value=!0}catch(e){j.value=String(e.message||e)}});async function P(){M.value=!0,j.value=``,N.value=!1;try{await g.saveAuthentication(k.value),N.value=!0}catch(e){j.value=String(e.message||e)}finally{M.value=!1}}return(e,c)=>{let p=t(`RouterLink`);return o(),f(`div`,v,[i(u,{title:`Authentication`}),j.value?(o(),f(`p`,y,[n(l(j.value)+` `,1),c[4]||=d(`a`,{class:`underline`,href:`/?reauth=1`},`Sign in again`,-1)])):a(``,!0),A.value?(o(),f(`form`,{key:1,class:`space-y-6`,onSubmit:m(P,[`prevent`])},[d(`section`,b,[c[6]||=d(`h2`,{class:`font-medium`},`Instance URL`,-1),d(`label`,x,[c[5]||=n(`Public address`,-1),i(s(_),{id:`instance-url`,modelValue:k.value.public_url,"onUpdate:modelValue":c[0]||=e=>k.value.public_url=e,type:`url`,required:``},null,8,[`modelValue`])]),c[7]||=d(`p`,{class:`text-xs text-muted-foreground`},`Passkeys require HTTPS and a domain name, or localhost. Once passkeys are enrolled, their domain is fixed.`,-1)]),d(`section`,S,[c[14]||=d(`h2`,{class:`font-medium`},`OpenID Connect`,-1),c[15]||=d(`p`,{class:`text-sm text-muted-foreground`},`Register a public client with authorization code flow and PKCE. Local accounts remain available.`,-1),d(`label`,C,[c[8]||=n(`Issuer URL`,-1),i(s(_),{id:`oidc-issuer`,modelValue:k.value.oidc_issuer,"onUpdate:modelValue":c[1]||=e=>k.value.oidc_issuer=e,type:`url`,placeholder:`https://identity.example.com`},null,8,[`modelValue`])]),d(`label`,w,[c[9]||=n(`Client ID`,-1),i(s(_),{id:`oidc-client`,modelValue:k.value.oidc_client_id,"onUpdate:modelValue":c[2]||=e=>k.value.oidc_client_id=e},null,8,[`modelValue`])]),d(`label`,T,[c[10]||=n(`Access token audience`,-1),i(s(_),{id:`oidc-audience`,modelValue:k.value.oidc_audience,"onUpdate:modelValue":c[3]||=e=>k.value.oidc_audience=e},null,8,[`modelValue`])]),d(`p`,E,`Redirect URI: `+l(k.value.public_url.replace(/\/$/,``))+`/oauth2/callback`,1),d(`p`,D,[c[12]||=n(`Add permitted people by their verified email or provider subject in `,-1),i(p,{class:`underline`,to:`/org/members`},{default:r(()=>[...c[11]||=[n(`Organisation → Members`,-1)]]),_:1}),c[13]||=n(`. Clear the OIDC fields to disable provider sign-in.`,-1)])]),N.value?(o(),f(`p`,O,`Authentication settings saved.`)):a(``,!0),i(s(h),{type:`submit`,disabled:M.value},{default:r(()=>[...c[16]||=[n(`Save`,-1)]]),_:1},8,[`disabled`])],32)):a(``,!0)])}}});export{k as default};
|
||||
import{A as e,Ct as t,D as n,Jt as r,O as i,b as a,ht as o,kn as s,lt as c,nr as l,t as u,v as d,x as f,yn as p}from"./PageHeader.js";import{K as m,_ as h,n as g}from"./api.js";import{T as _}from"./index.js";var v={class:`max-w-2xl`},y={key:0,class:`mb-4 text-sm text-danger`,role:`alert`},b={class:`space-y-3 rounded-lg border border-border bg-card p-5`},x={for:`instance-url`,class:`block space-y-1 text-sm`},S={class:`space-y-3 rounded-lg border border-border bg-card p-5`},C={for:`oidc-issuer`,class:`block space-y-1 text-sm`},w={for:`oidc-client`,class:`block space-y-1 text-sm`},T={for:`oidc-audience`,class:`block space-y-1 text-sm`},E={class:`break-all text-xs text-muted-foreground`},D={class:`text-xs text-muted-foreground`},O={key:0,role:`status`,class:`text-sm`},k=e({__name:`AuthenticationPage`,setup(e){let k=p({public_url:``,oidc_issuer:``,oidc_audience:``,oidc_client_id:``}),A=p(!1),j=p(``),M=p(!1),N=p(!1);c(async()=>{try{k.value=await g.authentication(),A.value=!0}catch(e){j.value=String(e.message||e)}});async function P(){M.value=!0,j.value=``,N.value=!1;try{await g.saveAuthentication(k.value),N.value=!0}catch(e){j.value=String(e.message||e)}finally{M.value=!1}}return(e,c)=>{let p=t(`RouterLink`);return o(),f(`div`,v,[i(u,{title:`Authentication`}),j.value?(o(),f(`p`,y,[n(l(j.value)+` `,1),c[4]||=d(`a`,{class:`underline`,href:`/?reauth=1`},`Sign in again`,-1)])):a(``,!0),A.value?(o(),f(`form`,{key:1,class:`space-y-6`,onSubmit:m(P,[`prevent`])},[d(`section`,b,[c[6]||=d(`h2`,{class:`font-medium`},`Instance URL`,-1),d(`label`,x,[c[5]||=n(`Public address`,-1),i(s(_),{id:`instance-url`,modelValue:k.value.public_url,"onUpdate:modelValue":c[0]||=e=>k.value.public_url=e,type:`url`,required:``},null,8,[`modelValue`])]),c[7]||=d(`p`,{class:`text-xs text-muted-foreground`},`Passkeys require HTTPS and a domain name, or localhost. Once passkeys are enrolled, their domain is fixed.`,-1)]),d(`section`,S,[c[14]||=d(`h2`,{class:`font-medium`},`OpenID Connect`,-1),c[15]||=d(`p`,{class:`text-sm text-muted-foreground`},`Register a public client with authorization code flow and PKCE. Local accounts remain available.`,-1),d(`label`,C,[c[8]||=n(`Issuer URL`,-1),i(s(_),{id:`oidc-issuer`,modelValue:k.value.oidc_issuer,"onUpdate:modelValue":c[1]||=e=>k.value.oidc_issuer=e,type:`url`,placeholder:`https://identity.example.com`},null,8,[`modelValue`])]),d(`label`,w,[c[9]||=n(`Client ID`,-1),i(s(_),{id:`oidc-client`,modelValue:k.value.oidc_client_id,"onUpdate:modelValue":c[2]||=e=>k.value.oidc_client_id=e},null,8,[`modelValue`])]),d(`label`,T,[c[10]||=n(`Access token audience`,-1),i(s(_),{id:`oidc-audience`,modelValue:k.value.oidc_audience,"onUpdate:modelValue":c[3]||=e=>k.value.oidc_audience=e},null,8,[`modelValue`])]),d(`p`,E,`Redirect URI: `+l(k.value.public_url.replace(/\/$/,``))+`/oauth2/callback`,1),d(`p`,D,[c[12]||=n(`Add permitted people by their verified email or provider subject in `,-1),i(p,{class:`underline`,to:`/org/members`},{default:r(()=>[...c[11]||=[n(`Organisation → Members`,-1)]]),_:1}),c[13]||=n(`. Clear the OIDC fields to disable provider sign-in.`,-1)])]),N.value?(o(),f(`p`,O,`Authentication settings saved.`)):a(``,!0),i(s(h),{type:`submit`,disabled:M.value},{default:r(()=>[...c[16]||=[n(`Save`,-1)]]),_:1},8,[`disabled`])],32)):a(``,!0)])}}});export{k as default};
|
||||
Vendored
+2
-2
@@ -1,3 +1,3 @@
|
||||
import{$ as e,$t as t,A as n,At as r,B as i,Bt as a,C as o,Cn as s,Ct as c,D as l,Dn as u,Dt as d,E as f,En as p,Et as m,F as h,Ft as g,G as _,Gt as v,H as y,Ht as b,I as x,It as S,J as C,Jt as w,K as T,Kt as E,L as ee,Lt as te,M as D,Mn as ne,Mt as re,N as ie,Nn as ae,Nt as oe,O,On as se,Ot as ce,P as le,Pt as ue,Q as de,Qn as fe,Qt as pe,R as me,Rt as he,S as ge,Sn as _e,St as k,T as ve,Tn as ye,Tt as be,U as xe,Ut as A,V as Se,Vt as Ce,W as we,Wt as j,X as Te,Xt as Ee,Y as De,Yt as Oe,Z as ke,Zt as Ae,_ as M,_n as je,_t as Me,a as Ne,an as Pe,at as Fe,b as Ie,bn as Le,bt as Re,c as ze,cn as Be,ct as Ve,d as He,dn as Ue,dt as We,en as Ge,er as Ke,et as qe,f as Je,fn as Ye,ft as Xe,g as Ze,gn as Qe,gt as $e,h as et,hn as tt,ht as N,i as nt,in as rt,it,j as at,jt as ot,k as st,kn as P,kt as ct,l as lt,ln as ut,lt as dt,m as ft,mn as pt,mt,n as ht,nn as gt,nr as _t,nt as F,o as vt,on as yt,ot as bt,p as xt,pn as St,pt as Ct,q as wt,qt as Tt,r as Et,rn as Dt,rr as Ot,rt as kt,s as At,sn as jt,st as Mt,tn as Nt,tr as Pt,tt as I,u as Ft,un as It,ut as Lt,v as Rt,vn as zt,vt as Bt,w as Vt,wn as Ht,wt as Ut,x as Wt,xn as L,xt as Gt,y as R,yn as z,yt as Kt,z as qt,zt as Jt}from"./PageHeader.js";import{A as Yt,B as Xt,C as Zt,D as Qt,E as $t,F as en,H as tn,I as nn,L as rn,M as an,N as on,O as sn,P as cn,R as ln,S as un,T as dn,U as fn,V as pn,W as mn,_ as B,a as hn,f as gn,g as _n,h as vn,i as yn,j as bn,k as xn,n as Sn,s as Cn,w as wn,x as Tn,y as En,z as Dn}from"./api.js";import{n as On}from"./pinia.js";import{t as kn}from"./createLucideIcon.js";import{a as An,i as jn,n as Mn,r as Nn,t as Pn}from"./alert.js";var Fn=Object.defineProperty,In=((e,t)=>{let n={};for(var r in e)Fn(n,r,{get:e[r],enumerable:!0});return t||Fn(n,Symbol.toStringTag,{value:`Module`}),n})({BaseTransition:()=>ht,BaseTransitionPropsValidators:()=>Et,Comment:()=>nt,DeprecationTypes:()=>null,EffectScope:()=>t,ErrorCodes:()=>Ne,ErrorTypeStrings:()=>vt,Fragment:()=>At,KeepAlive:()=>ze,ReactiveEffect:()=>Ge,Static:()=>lt,Suspense:()=>Ft,Teleport:()=>He,Text:()=>Je,TrackOpTypes:()=>Nt,Transition:()=>Tn,TransitionGroup:()=>un,TriggerOpTypes:()=>gt,VueElement:()=>Zt,assertNumber:()=>xt,callWithAsyncErrorHandling:()=>ft,callWithErrorHandling:()=>et,camelize:()=>ne,capitalize:()=>ae,cloneVNode:()=>Ze,compatUtils:()=>null,compile:()=>Ln,computed:()=>M,createApp:()=>wn,createBlock:()=>R,createCommentVNode:()=>Ie,createElementBlock:()=>Wt,createElementVNode:()=>Rt,createHydrationRenderer:()=>ge,createPropsRestProxy:()=>o,createRenderer:()=>Vt,createSSRApp:()=>dn,createSlots:()=>ve,createStaticVNode:()=>f,createTextVNode:()=>l,createVNode:()=>O,customRef:()=>Dt,defineAsyncComponent:()=>st,defineComponent:()=>n,defineCustomElement:()=>$t,defineEmits:()=>at,defineExpose:()=>D,defineModel:()=>ie,defineOptions:()=>le,defineProps:()=>h,defineSSRCustomElement:()=>Qt,defineSlots:()=>x,devtools:()=>ee,effect:()=>rt,effectScope:()=>Pe,getCurrentInstance:()=>me,getCurrentScope:()=>yt,getCurrentWatcher:()=>jt,getTransitionRawChildren:()=>qt,guardReactiveProps:()=>i,h:()=>Se,handleError:()=>y,hasInjectionContext:()=>xe,hydrate:()=>sn,hydrateOnIdle:()=>we,hydrateOnInteraction:()=>_,hydrateOnMediaQuery:()=>T,hydrateOnVisible:()=>wt,initCustomFormatter:()=>C,initDirectivesForSSR:()=>xn,inject:()=>De,isMemoSame:()=>Te,isProxy:()=>Be,isReactive:()=>ut,isReadonly:()=>It,isRef:()=>Ue,isRuntimeOnly:()=>ke,isShallow:()=>Ye,isVNode:()=>de,markRaw:()=>St,mergeDefaults:()=>e,mergeModels:()=>qe,mergeProps:()=>I,nextTick:()=>F,nodeOps:()=>Yt,normalizeClass:()=>fe,normalizeProps:()=>Ke,normalizeStyle:()=>Pt,onActivated:()=>kt,onBeforeMount:()=>it,onBeforeUnmount:()=>Fe,onBeforeUpdate:()=>bt,onDeactivated:()=>Mt,onErrorCaptured:()=>Ve,onMounted:()=>dt,onRenderTracked:()=>Lt,onRenderTriggered:()=>We,onScopeDispose:()=>pt,onServerPrefetch:()=>Xe,onUnmounted:()=>Ct,onUpdated:()=>mt,onWatcherCleanup:()=>tt,openBlock:()=>N,patchProp:()=>bn,popScopeId:()=>$e,provide:()=>Me,proxyRefs:()=>Qe,pushScopeId:()=>Bt,queuePostFlushCb:()=>Kt,reactive:()=>je,readonly:()=>zt,ref:()=>z,registerRuntimeCompiler:()=>Re,render:()=>an,renderList:()=>Gt,renderSlot:()=>k,resolveComponent:()=>c,resolveDirective:()=>Ut,resolveDynamicComponent:()=>be,resolveFilter:()=>null,resolveTransitionHooks:()=>m,setBlockTracking:()=>d,setDevtoolsHook:()=>ce,setTransitionHooks:()=>ct,shallowReactive:()=>Le,shallowReadonly:()=>L,shallowRef:()=>_e,ssrContextKey:()=>r,ssrUtils:()=>ot,stop:()=>s,toDisplayString:()=>_t,toHandlerKey:()=>Ot,toHandlers:()=>re,toRaw:()=>Ht,toRef:()=>ye,toRefs:()=>p,toValue:()=>u,transformVNodeArgs:()=>oe,triggerRef:()=>se,unref:()=>P,useAttrs:()=>ue,useCssModule:()=>on,useCssVars:()=>cn,useHost:()=>en,useId:()=>g,useModel:()=>S,useSSRContext:()=>te,useShadowRoot:()=>nn,useSlots:()=>he,useTemplateRef:()=>Jt,useTransitionState:()=>a,vModelCheckbox:()=>rn,vModelDynamic:()=>ln,vModelRadio:()=>Dn,vModelSelect:()=>Xt,vModelText:()=>pn,vShow:()=>tn,version:()=>Ce,warn:()=>b,watch:()=>A,watchEffect:()=>j,waLine truncated
|
||||
import{$ as e,$t as t,A as n,At as r,B as i,Bt as a,C as o,Cn as s,Ct as c,D as l,Dn as u,Dt as d,E as f,En as p,Et as m,F as h,Ft as g,G as _,Gt as v,H as y,Ht as b,I as x,It as S,J as C,Jt as w,K as T,Kt as E,L as ee,Lt as te,M as D,Mn as ne,Mt as re,N as ie,Nn as ae,Nt as oe,O,On as se,Ot as ce,P as le,Pt as ue,Q as de,Qn as fe,Qt as pe,R as me,Rt as he,S as ge,Sn as _e,St as k,T as ve,Tn as ye,Tt as be,U as xe,Ut as A,V as Se,Vt as Ce,W as we,Wt as j,X as Te,Xt as Ee,Y as De,Yt as Oe,Z as ke,Zt as Ae,_ as M,_n as je,_t as Me,a as Ne,an as Pe,at as Fe,b as Ie,bn as Le,bt as Re,c as ze,cn as Be,ct as Ve,d as He,dn as Ue,dt as We,en as Ge,er as Ke,et as qe,f as Je,fn as Ye,ft as Xe,g as Ze,gn as Qe,gt as $e,h as et,hn as tt,ht as N,i as nt,in as rt,it,j as at,jt as ot,k as st,kn as P,kt as ct,l as lt,ln as ut,lt as dt,m as ft,mn as pt,mt,n as ht,nn as gt,nr as _t,nt as F,o as vt,on as yt,ot as bt,p as xt,pn as St,pt as Ct,q as wt,qt as Tt,r as Et,rn as Dt,rr as Ot,rt as kt,s as At,sn as jt,st as Mt,tn as Nt,tr as Pt,tt as I,u as Ft,un as It,ut as Lt,v as Rt,vn as zt,vt as Bt,w as Vt,wn as Ht,wt as Ut,x as Wt,xn as Gt,xt as Kt,y as L,yn as R,yt as qt,z as Jt,zt as Yt}from"./PageHeader.js";import{A as Xt,B as Zt,C as Qt,D as $t,E as en,F as tn,G as nn,H as rn,I as an,K as on,L as sn,M as cn,N as ln,O as un,P as dn,R as fn,T as pn,U as mn,V as hn,W as gn,_ as _n,a as vn,i as yn,j as bn,k as xn,m as Sn,n as Cn,s as wn,v as Tn,w as En,x as Dn,y as z,z as On}from"./api.js";import{n as kn}from"./pinia.js";import{t as An}from"./createLucideIcon.js";import{a as jn,i as Mn,n as Nn,r as Pn,t as Fn}from"./alert.js";var In=Object.defineProperty,Ln=((e,t)=>{let n={};for(var r in e)In(n,r,{get:e[r],enumerable:!0});return t||In(n,Symbol.toStringTag,{value:`Module`}),n})({BaseTransition:()=>ht,BaseTransitionPropsValidators:()=>Et,Comment:()=>nt,DeprecationTypes:()=>null,EffectScope:()=>t,ErrorCodes:()=>Ne,ErrorTypeStrings:()=>vt,Fragment:()=>At,KeepAlive:()=>ze,ReactiveEffect:()=>Ge,Static:()=>lt,Suspense:()=>Ft,Teleport:()=>He,Text:()=>Je,TrackOpTypes:()=>Nt,Transition:()=>Qt,TransitionGroup:()=>En,TriggerOpTypes:()=>gt,VueElement:()=>pn,assertNumber:()=>xt,callWithAsyncErrorHandling:()=>ft,callWithErrorHandling:()=>et,camelize:()=>ne,capitalize:()=>ae,cloneVNode:()=>Ze,compatUtils:()=>null,compile:()=>Rn,computed:()=>M,createApp:()=>en,createBlock:()=>L,createCommentVNode:()=>Ie,createElementBlock:()=>Wt,createElementVNode:()=>Rt,createHydrationRenderer:()=>ge,createPropsRestProxy:()=>o,createRenderer:()=>Vt,createSSRApp:()=>$t,createSlots:()=>ve,createStaticVNode:()=>f,createTextVNode:()=>l,createVNode:()=>O,customRef:()=>Dt,defineAsyncComponent:()=>st,defineComponent:()=>n,defineCustomElement:()=>un,defineEmits:()=>at,defineExpose:()=>D,defineModel:()=>ie,defineOptions:()=>le,defineProps:()=>h,defineSSRCustomElement:()=>xn,defineSlots:()=>x,devtools:()=>ee,effect:()=>rt,effectScope:()=>Pe,getCurrentInstance:()=>me,getCurrentScope:()=>yt,getCurrentWatcher:()=>jt,getTransitionRawChildren:()=>Jt,guardReactiveProps:()=>i,h:()=>Se,handleError:()=>y,hasInjectionContext:()=>xe,hydrate:()=>Xt,hydrateOnIdle:()=>we,hydrateOnInteraction:()=>_,hydrateOnMediaQuery:()=>T,hydrateOnVisible:()=>wt,initCustomFormatter:()=>C,initDirectivesForSSR:()=>bn,inject:()=>De,isMemoSame:()=>Te,isProxy:()=>Be,isReactive:()=>ut,isReadonly:()=>It,isRef:()=>Ue,isRuntimeOnly:()=>ke,isShallow:()=>Ye,isVNode:()=>de,markRaw:()=>St,mergeDefaults:()=>e,mergeModels:()=>qe,mergeProps:()=>I,nextTick:()=>F,nodeOps:()=>cn,normalizeClass:()=>fe,normalizeProps:()=>Ke,normalizeStyle:()=>Pt,onActivated:()=>kt,onBeforeMount:()=>it,onBeforeUnmount:()=>Fe,onBeforeUpdate:()=>bt,onDeactivated:()=>Mt,onErrorCaptured:()=>Ve,onMounted:()=>dt,onRenderTracked:()=>Lt,onRenderTriggered:()=>We,onScopeDispose:()=>pt,onServerPrefetch:()=>Xe,onUnmounted:()=>Ct,onUpdated:()=>mt,onWatcherCleanup:()=>tt,openBlock:()=>N,patchProp:()=>ln,popScopeId:()=>$e,provide:()=>Me,proxyRefs:()=>Qe,pushScopeId:()=>Bt,queuePostFlushCb:()=>qt,reactive:()=>je,readonly:()=>zt,ref:()=>R,registerRuntimeCompiler:()=>Re,render:()=>dn,renderList:()=>Kt,renderSlot:()=>k,resolveComponent:()=>c,resolveDirective:()=>Ut,resolveDynamicComponent:()=>be,resolveFilter:()=>null,resolveTransitionHooks:()=>m,setBlockTracking:()=>d,setDevtoolsHook:()=>ce,setTransitionHooks:()=>ct,shallowReactive:()=>Le,shallowReadonly:()=>Gt,shallowRef:()=>_e,ssrContextKey:()=>r,ssrUtils:()=>ot,stop:()=>s,toDisplayString:()=>_t,toHandlerKey:()=>Ot,toHandlers:()=>re,toRaw:()=>Ht,toRef:()=>ye,toRefs:()=>p,toValue:()=>u,transformVNodeArgs:()=>oe,triggerRef:()=>se,unref:()=>P,useAttrs:()=>ue,useCssModule:()=>tn,useCssVars:()=>an,useHost:()=>sn,useId:()=>g,useModel:()=>S,useSSRContext:()=>te,useShadowRoot:()=>fn,useSlots:()=>he,useTemplateRef:()=>Yt,useTransitionState:()=>a,vModelCheckbox:()=>On,vModelDynamic:()=>Zt,vModelRadio:()=>hn,vModelSelect:()=>rn,vModelText:()=>mn,vShow:()=>gn,version:()=>Ce,warn:()=>b,watch:()=>A,watchEffect:()=>j,Line truncated
|
||||
`)].join(`
|
||||
`))}return()=>i.value||r.value||o.value?Se(t.default({present:o.value})[0],{ref:e=>{let t=U(e);return t?.hasAttribute===void 0||(t?.hasAttribute(`data-reka-popper-content-wrapper`)?a.value=t.firstElementChild:a.value=t),t}}):null}}),[_i,vi]=Wn(`CollapsibleRoot`),yi=n({__name:`CollapsibleRoot`,props:{defaultOpen:{type:Boolean,required:!1,default:!1},open:{type:Boolean,required:!1,default:void 0},disabled:{type:Boolean,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`update:open`],setup(e,{expose:t,emit:n}){let r=e,i=kr(r,`open`,n,{defaultValue:r.defaultOpen,passive:r.open===void 0}),{disabled:a,unmountOnHide:o}=p(r);return vi({contentId:``,disabled:a,open:i,unmountOnHide:o,onOpenToggle:()=>{a.value||(i.value=!i.value)}}),t({open:i}),W(),(t,n)=>(N(),R(P(B),{as:e.as,"as-child":r.asChild,"data-state":P(i)?`open`:`closed`,"data-disabled":P(a)?``:void 0},{default:w(()=>[k(t.$slots,`default`,{open:P(i)})]),_:3},8,[`as`,`as-child`,`data-state`,`data-disabled`]))}}),bi=n({inheritAttrs:!1,__name:`CollapsibleContent`,props:{forceMount:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`contentFound`],setup(e,{emit:t}){let n=e,r=t,i=_i();i.contentId||=di(void 0,`reka-collapsible-content`);let a=z(),{forwardRef:o,currentElement:s}=W(),c=z(0),l=z(0),u=M(()=>i.open.value),d=z(u.value),f=z();A(()=>[u.value,a.value?.present],async()=>{await F();let e=s.value;if(!e)return;f.value=f.value||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();l.value=t.height,c.value=t.width,d.value||(e.style.transitionDuration=f.value.transitionDuration,e.style.animationName=f.value.animationName)},{immediate:!0});let p=M(()=>d.value&&i.open.value);return dt(()=>{requestAnimationFrame(()=>{d.value=!1})}),hr(s,`beforematch`,e=>{requestAnimationFrame(()=>{i.onOpenToggle(),r(`contentFound`)})}),(t,r)=>(N(),R(P(gi),{ref_key:`presentRef`,ref:a,present:e.forceMount||P(i).open.value,"force-mount":!0},{default:w(({present:r})=>[O(P(B),I(t.$attrs,{id:P(i).contentId,ref:P(o),"as-child":n.asChild,as:e.as,hidden:r?void 0:P(i).unmountOnHide.value?``:`until-found`,"data-state":p.value?void 0:P(i).open.value?`open`:`closed`,"data-disabled":P(i).disabled?.value?``:void 0,style:{"--reka-collapsible-content-height":`${l.value}px`,"--reka-collapsible-content-width":`${c.value}px`}}),{default:w(()=>[!P(i).unmountOnHide.value||r?k(t.$slots,`default`,{},void 0,void 0,0):Ie(`v-if`,!0)]),_:2},1040,[`id`,`as-child`,`as`,`hidden`,`data-state`,`data-disabled`,`style`])]),_:3},8,[`present`]))}}),xi=n({__name:`CollapsibleTrigger`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e;W();let n=_i();return(r,i)=>(N(),R(P(B),{type:e.as===`button`?`button`:void 0,as:e.as,"as-child":t.asChild,"aria-controls":P(n).contentId,"aria-expanded":P(n).open.value,"data-state":P(n).open.value?`open`:`closed`,"data-disabled":P(n).disabled?.value?``:void 0,disabled:P(n).disabled?.value,onClick:P(n).onOpenToggle},{default:w(()=>[k(r.$slots,`default`)]),_:3},8,[`type`,`as`,`as-child`,`aria-controls`,`aria-expanded`,`data-state`,`data-disabled`,`disabled`,`onClick`]))}});function Si({type:e,defaultValue:t,modelValue:n}){let r=n||t;return n!==void 0||t!==void 0?Array.isArray(r)?`multiple`:`single`:e??`single`}function Ci({type:e,defaultValue:t,modelValue:n}){return e||Si({type:e,defaultValue:t,modelValue:n})}function wi({type:e,defaultValue:t}){return t===void 0?e===`single`?void 0:[]:t}function Ti(e,t){let n=M(()=>Ci(e)),r=kr(e,`modelValue`,t,{defaultValue:wi(e),passive:e.modelValue===void 0,deep:!0});function i(e){if(n.value===`single`)r.value=Un(e,r.value)?void 0:e;else{let t=Array.isArray(r.value)?[...r.value||[]]:[r.value].filter(Boolean);if(qn(t,e)){let n=t.findIndex(t=>Un(t,e));t.splice(n,1)}else t.push(e);r.value=t}}return{modelValue:r,changeModelValue:i,isSingle:M(()=>n.value===`single`)}}var[Ei,Di]=Wn(`AccordionRoot`),Oi=n({__name:`AccordionRoot`,props:{collapsible:{type:Boolean,required:!1,default:!1},disabled:{type:Boolean,required:!1,default:!1},dir:{type:String,required:!1},orientation:{type:String,required:!1,default:`vertical`},unmountOnHide:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},type:{type:String,required:!1},modelValue:{type:null,required:!1},defaultValue:{type:null,required:!1}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,{dir:i,disabled:a,unmountOnHide:o}=p(n),s=qr(i),{modelValue:c,changeModelValue:l,isSingle:u}=Ti(n,r),{forwardRef:d,currentElement:f}=W();return Di({disabled:a,direction:s,orientation:n.orientation,parentElement:f,isSingle:u,collapsible:n.collapsible,modelValue:c,changeModelValue:l,unmountOnHide:o}),(t,n)=>(N(),R(P(B),{ref:P(d),"as-child":e.asChild,as:e.as},{default:w(()=>[k(t.$sl
Line truncated
|
||||
`))}return()=>i.value||r.value||o.value?Se(t.default({present:o.value})[0],{ref:e=>{let t=H(e);return t?.hasAttribute===void 0||(t?.hasAttribute(`data-reka-popper-content-wrapper`)?a.value=t.firstElementChild:a.value=t),t}}):null}}),[vi,yi]=Gn(`CollapsibleRoot`),bi=n({__name:`CollapsibleRoot`,props:{defaultOpen:{type:Boolean,required:!1,default:!1},open:{type:Boolean,required:!1,default:void 0},disabled:{type:Boolean,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`update:open`],setup(e,{expose:t,emit:n}){let r=e,i=Ar(r,`open`,n,{defaultValue:r.defaultOpen,passive:r.open===void 0}),{disabled:a,unmountOnHide:o}=p(r);return yi({contentId:``,disabled:a,open:i,unmountOnHide:o,onOpenToggle:()=>{a.value||(i.value=!i.value)}}),t({open:i}),U(),(t,n)=>(N(),L(P(z),{as:e.as,"as-child":r.asChild,"data-state":P(i)?`open`:`closed`,"data-disabled":P(a)?``:void 0},{default:w(()=>[k(t.$slots,`default`,{open:P(i)})]),_:3},8,[`as`,`as-child`,`data-state`,`data-disabled`]))}}),xi=n({inheritAttrs:!1,__name:`CollapsibleContent`,props:{forceMount:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`contentFound`],setup(e,{emit:t}){let n=e,r=t,i=vi();i.contentId||=fi(void 0,`reka-collapsible-content`);let a=R(),{forwardRef:o,currentElement:s}=U(),c=R(0),l=R(0),u=M(()=>i.open.value),d=R(u.value),f=R();A(()=>[u.value,a.value?.present],async()=>{await F();let e=s.value;if(!e)return;f.value=f.value||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();l.value=t.height,c.value=t.width,d.value||(e.style.transitionDuration=f.value.transitionDuration,e.style.animationName=f.value.animationName)},{immediate:!0});let p=M(()=>d.value&&i.open.value);return dt(()=>{requestAnimationFrame(()=>{d.value=!1})}),gr(s,`beforematch`,e=>{requestAnimationFrame(()=>{i.onOpenToggle(),r(`contentFound`)})}),(t,r)=>(N(),L(P(_i),{ref_key:`presentRef`,ref:a,present:e.forceMount||P(i).open.value,"force-mount":!0},{default:w(({present:r})=>[O(P(z),I(t.$attrs,{id:P(i).contentId,ref:P(o),"as-child":n.asChild,as:e.as,hidden:r?void 0:P(i).unmountOnHide.value?``:`until-found`,"data-state":p.value?void 0:P(i).open.value?`open`:`closed`,"data-disabled":P(i).disabled?.value?``:void 0,style:{"--reka-collapsible-content-height":`${l.value}px`,"--reka-collapsible-content-width":`${c.value}px`}}),{default:w(()=>[!P(i).unmountOnHide.value||r?k(t.$slots,`default`,{},void 0,void 0,0):Ie(`v-if`,!0)]),_:2},1040,[`id`,`as-child`,`as`,`hidden`,`data-state`,`data-disabled`,`style`])]),_:3},8,[`present`]))}}),Si=n({__name:`CollapsibleTrigger`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e;U();let n=vi();return(r,i)=>(N(),L(P(z),{type:e.as===`button`?`button`:void 0,as:e.as,"as-child":t.asChild,"aria-controls":P(n).contentId,"aria-expanded":P(n).open.value,"data-state":P(n).open.value?`open`:`closed`,"data-disabled":P(n).disabled?.value?``:void 0,disabled:P(n).disabled?.value,onClick:P(n).onOpenToggle},{default:w(()=>[k(r.$slots,`default`)]),_:3},8,[`type`,`as`,`as-child`,`aria-controls`,`aria-expanded`,`data-state`,`data-disabled`,`disabled`,`onClick`]))}});function Ci({type:e,defaultValue:t,modelValue:n}){let r=n||t;return n!==void 0||t!==void 0?Array.isArray(r)?`multiple`:`single`:e??`single`}function wi({type:e,defaultValue:t,modelValue:n}){return e||Ci({type:e,defaultValue:t,modelValue:n})}function Ti({type:e,defaultValue:t}){return t===void 0?e===`single`?void 0:[]:t}function Ei(e,t){let n=M(()=>wi(e)),r=Ar(e,`modelValue`,t,{defaultValue:Ti(e),passive:e.modelValue===void 0,deep:!0});function i(e){if(n.value===`single`)r.value=Wn(e,r.value)?void 0:e;else{let t=Array.isArray(r.value)?[...r.value||[]]:[r.value].filter(Boolean);if(Jn(t,e)){let n=t.findIndex(t=>Wn(t,e));t.splice(n,1)}else t.push(e);r.value=t}}return{modelValue:r,changeModelValue:i,isSingle:M(()=>n.value===`single`)}}var[Di,Oi]=Gn(`AccordionRoot`),ki=n({__name:`AccordionRoot`,props:{collapsible:{type:Boolean,required:!1,default:!1},disabled:{type:Boolean,required:!1,default:!1},dir:{type:String,required:!1},orientation:{type:String,required:!1,default:`vertical`},unmountOnHide:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},type:{type:String,required:!1},modelValue:{type:null,required:!1},defaultValue:{type:null,required:!1}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,{dir:i,disabled:a,unmountOnHide:o}=p(n),s=Jr(i),{modelValue:c,changeModelValue:l,isSingle:u}=Ei(n,r),{forwardRef:d,currentElement:f}=U();return Oi({disabled:a,direction:s,orientation:n.orientation,parentElement:f,isSingle:u,collapsible:n.collapsible,modelValue:c,changeModelValue:l,unmountOnHide:o}),(t,n)=>(N(),L(P(z),{ref:P(d),"as-child":e.asChild,as:e.as},{default:w(()=>[k(t.$sl
Line truncated
|
||||
+1
-1
@@ -1 +1 @@
|
||||
import{d as e,o as t,s as n,t as r}from"./CardAccordion.js";import{A as i,D as a,Jt as o,O as s,_ as c,b as l,ht as u,kn as d,lt as f,nr as p,t as m,x as h,yn as g}from"./PageHeader.js";import{h as _}from"./api.js";import{T as v,v as y,y as b}from"./index.js";var x={key:0,class:`mb-4 text-sm text-destructive`,role:`alert`},S={key:1,class:`text-sm text-fg-muted`},C=`credential-bindings`,w=i({__name:`CredentialBindingsPage`,setup(i){let w=e();f(w.load);let T=c(()=>w.drafts[C]?.value),E=g(``),D=c(()=>w.changesFor(C).length>0);function O(){if(D.value)return;let e=w.drafts[C];e&&(e.value||=[],e.value.push({service:``,org:``,secret:{engine:``,key:``}}),E.value=String(e.value.length-1))}return(e,i)=>(u(),h(`div`,null,[s(m,{title:`Credential bindings`},{default:o(()=>[s(t,{kinds:[C]},null,8,[`kinds`]),s(d(_),{disabled:D.value,onClick:O},{default:o(()=>[...i[2]||=[a(`Add binding`,-1)]]),_:1},8,[`disabled`])]),_:1}),s(n,{kind:C,class:`mb-4`}),d(w).catalogError||d(w).pageErrorFor(C)?(u(),h(`p`,x,p(d(w).catalogError||d(w).pageErrorFor(C)),1)):l(``,!0),T.value?.length?l(``,!0):(u(),h(`p`,S,`No credential bindings.`)),s(r,{open:E.value,"onUpdate:open":i[0]||=e=>E.value=e,items:T.value??[],title:e=>e.service||`New binding`,"remove-label":`Remove`,mono:``,onRemove:i[1]||=e=>T.value.splice(e,1)},{default:o(({item:e,index:t})=>[s(d(b),{label:`Service`,for:`binding-${t}-service`},{default:o(()=>[s(d(v),{id:`binding-${t}-service`,modelValue:e.service,"onUpdate:modelValue":t=>e.service=t},null,8,[`id`,`modelValue`,`onUpdate:modelValue`])]),_:2},1032,[`for`]),s(d(b),{label:`Organisation`,for:`binding-${t}-org`,hint:`Empty uses the default organisation.`},{default:o(()=>[s(d(v),{id:`binding-${t}-org`,modelValue:e.org,"onUpdate:modelValue":t=>e.org=t},null,8,[`id`,`modelValue`,`onUpdate:modelValue`])]),_:2},1032,[`for`]),s(d(b),{label:`Secret`},{default:o(()=>[s(y,{modelValue:e.secret,"onUpdate:modelValue":t=>e.secret=t,"id-prefix":`binding-${t}-secret`},null,8,[`modelValue`,`onUpdate:modelValue`,`id-prefix`])]),_:2},1024)]),_:1},8,[`open`,`items`,`title`])]))}});export{w as default};
|
||||
import{d as e,o as t,s as n,t as r}from"./CardAccordion.js";import{A as i,D as a,Jt as o,O as s,_ as c,b as l,ht as u,kn as d,lt as f,nr as p,t as m,x as h,yn as g}from"./PageHeader.js";import{_}from"./api.js";import{T as v,v as y,y as b}from"./index.js";var x={key:0,class:`mb-4 text-sm text-destructive`,role:`alert`},S={key:1,class:`text-sm text-fg-muted`},C=`credential-bindings`,w=i({__name:`CredentialBindingsPage`,setup(i){let w=e();f(w.load);let T=c(()=>w.drafts[C]?.value),E=g(``),D=c(()=>w.changesFor(C).length>0);function O(){if(D.value)return;let e=w.drafts[C];e&&(e.value||=[],e.value.push({service:``,org:``,secret:{engine:``,key:``}}),E.value=String(e.value.length-1))}return(e,i)=>(u(),h(`div`,null,[s(m,{title:`Credential bindings`},{default:o(()=>[s(t,{kinds:[C]},null,8,[`kinds`]),s(d(_),{disabled:D.value,onClick:O},{default:o(()=>[...i[2]||=[a(`Add binding`,-1)]]),_:1},8,[`disabled`])]),_:1}),s(n,{kind:C,class:`mb-4`}),d(w).catalogError||d(w).pageErrorFor(C)?(u(),h(`p`,x,p(d(w).catalogError||d(w).pageErrorFor(C)),1)):l(``,!0),T.value?.length?l(``,!0):(u(),h(`p`,S,`No credential bindings.`)),s(r,{open:E.value,"onUpdate:open":i[0]||=e=>E.value=e,items:T.value??[],title:e=>e.service||`New binding`,"remove-label":`Remove`,mono:``,onRemove:i[1]||=e=>T.value.splice(e,1)},{default:o(({item:e,index:t})=>[s(d(b),{label:`Service`,for:`binding-${t}-service`},{default:o(()=>[s(d(v),{id:`binding-${t}-service`,modelValue:e.service,"onUpdate:modelValue":t=>e.service=t},null,8,[`id`,`modelValue`,`onUpdate:modelValue`])]),_:2},1032,[`for`]),s(d(b),{label:`Organisation`,for:`binding-${t}-org`,hint:`Empty uses the default organisation.`},{default:o(()=>[s(d(v),{id:`binding-${t}-org`,modelValue:e.org,"onUpdate:modelValue":t=>e.org=t},null,8,[`id`,`modelValue`,`onUpdate:modelValue`])]),_:2},1032,[`for`]),s(d(b),{label:`Secret`},{default:o(()=>[s(y,{modelValue:e.secret,"onUpdate:modelValue":t=>e.secret=t,"id-prefix":`binding-${t}-secret`},null,8,[`modelValue`,`onUpdate:modelValue`,`id-prefix`])]),_:2},1024)]),_:1},8,[`open`,`items`,`title`])]))}});export{w as default};
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
import{A as e,D as t,Jt as n,O as r,at as i,b as a,ht as o,kn as s,lt as c,nr as l,s as u,t as d,v as f,x as p,xt as m,y as h,yn as g}from"./PageHeader.js";import{h as _,n as v,t as y}from"./api.js";import{i as b,n as x,r as S,t as C}from"./alert.js";import{_ as w,a as T,c as E,d as D,f as O,g as k,h as A,i as j,l as M,m as N,n as P,o as F,p as I,r as L,s as R,t as z,u as B}from"./index.js";function V(e,t=Date.now()){if(!e.captured)return`unconfigured`;if(!e.expires_at)return`ready`;let n=Date.parse(e.expires_at);return Number.isNaN(n)?`ready`:n<=t?`expired`:n-t<=18e5?`expiring`:`ready`}function H(e,t,n=80,r=24){let i=t.protocol===`https:`?`wss:`:`ws:`,a=new URLSearchParams({profile:e,cols:String(n),rows:String(r)}).toString();return`${i}//${t.host}/api/harness/terminal?${a}`}var U={class:`flex h-full min-h-0 flex-col gap-2`},W={key:0,class:`text-sm text-muted-foreground`,role:`status`},G=e({__name:`SetupTerminal`,props:{profile:{}},setup(e){let n=e,r=g(null),s=g(`connecting`),l=null,d=null,m=null,h=null;function _(){try{m?.fit()}catch{}}return c(()=>{let e=r.value;if(!e)return;l=new P({convertEol:!0,cursorBlink:!0,fontFamily:`'IBM Plex Mono', ui-monospace, monospace`,fontSize:13,theme:{background:`#0b0f14`,foreground:`#e6edf3`,cursor:`#e6edf3`,selectionBackground:`#264f78`}}),m=new z,l.loadAddon(m),l.open(e),_(),l.focus();let t=new WebSocket(H(n.profile,window.location,l?.cols??80,l?.rows??24));d=t,t.binaryType=`arraybuffer`,t.onopen=()=>{s.value=`open`},t.onmessage=e=>{l&&(typeof e.data==`string`?l.write(e.data):l.write(new Uint8Array(e.data)))},t.onerror=()=>{s.value=`failed`},t.onclose=()=>{s.value=`closed`},l.onData(e=>{t.readyState===WebSocket.OPEN&&t.send(e)}),h=new ResizeObserver(_),h.observe(e)}),i(()=>{h?.disconnect(),h=null,d?.close(),d=null,l?.dispose(),l=null,m=null}),(e,n)=>(o(),p(`div`,U,[s.value===`open`?a(``,!0):(o(),p(`p`,W,[s.value===`connecting`?(o(),p(u,{key:0},[t(`Connecting…`)],64)):s.value===`closed`?(o(),p(u,{key:1},[t(`The terminal session ended.`)],64)):(o(),p(u,{key:2},[t(`Could not open the setup terminal.`)],64))])),f(`div`,{ref_key:`host`,ref:r,class:`min-h-0 flex-1 overflow-hidden rounded-md border border-border bg-[#0b0f14] p-2`},null,512)]))}}),K={key:0,class:`mb-4 text-sm text-danger`,role:`alert`},q={key:1,class:`space-y-2`},J={class:`flex flex-col gap-1 text-sm`},Y=e({__name:`HarnessPage`,setup(e){let i=g(null),P=g(!0),z=g(null),H=g(!1),U=g(``),W=g(!1),Y={ready:{label:`Ready`,variant:`ok`},expiring:{label:`Expiring soon`,variant:`warn`},expired:{label:`Expired`,variant:`danger`},unconfigured:{label:`Not set up`,variant:`idle`}};c(X);async function X(){P.value=!0,z.value=null,H.value=!1;try{let e=await v.harnessBindings();i.value={terminal:e.terminal,bindings:e.bindings??[],profiles:e.profiles??[]},U.value=i.value.profiles[0]??``}catch(e){let t=e instanceof y?e.status:void 0;t===501||t===503?H.value=!0:z.value=e instanceof Error?e.message:String(e),i.value=null}finally{P.value=!1}}function Z(){i.value?.terminal&&U.value&&(W.value=!0)}function Q(e){if(!e)return`—`;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function $(e){return e.scopes?.length?e.scopes.join(`, `):`—`}return(e,c)=>(o(),p(`div`,null,[r(d,{title:`Harness`}),z.value?(o(),p(`p`,K,l(z.value),1)):a(``,!0),P.value?(o(),p(`div`,q,[r(s(L),{class:`h-24 w-full`}),r(s(L),{class:`h-40 w-full`})])):H.value?(o(),h(s(w),{key:2},{default:n(()=>[r(s(A),null,{default:n(()=>[r(s(N),null,{default:n(()=>[...c[1]||=[t(`Harness bindings are not configured`,-1)]]),_:1}),r(s(k),null,{default:n(()=>[...c[2]||=[t(`Credential bindings and OAuth tokens unavailable.`,-1)]]),_:1})]),_:1})]),_:1})):i.value?(o(),p(u,{key:3},[i.value.terminal?(o(),h(s(I),{key:1,class:`mb-4`},{default:n(()=>[r(s(O),{class:`flex flex-wrap items-end gap-3`},{default:n(()=>[f(`label`,J,[c[6]||=f(`span`,{class:`text-muted-foreground`},`Profile`,-1),r(s(T),{size:`sm`,modelValue:U.value,"onUpdate:modelValue":c[0]||=e=>U.value=e,class:`min-w-48`,disabled:!i.value.profiles.length},{default:n(()=>[i.value.profiles.length?a(``,!0):(o(),h(s(j),{key:0,value:``},{default:n(()=>[...c[5]||=[t(`No profiles configured`,-1)]]),_:1})),(o(!0),p(u,null,m(i.value.profiles,e=>(o(),h(s(j),{key:e,value:e},{default:n(()=>[t(l(e),1)]),_:2},1032,[`value`]))),128))]),_:1},8,[`modelValue`,`disabled`])]),r(s(_),{disabled:!U.value,onClick:Z},{default:n(()=>[...c[7]||=[t(`Open setup terminal`,-1)]]),_:1},8,[`disabled`])]),_:1})]),_:1})):(o(),h(s(S),{key:0,class:`mb-4`},{default:n(()=>[r(s(C),null,{default:n(()=>[...c[3]||=[t(`Setup terminal unavailable`,-1)]]),_:1}),r(s(x),null,{default:n(()=>[...c[4]||=[t(`Start the daemon with a container runtime and a harness token to log in to a CLI from here. Bindings are still listed below.`,-1)]]),_:1})]),_:1})),W.value&&U.value?(o(),h(s(I),{key:2,class:`mb-4`},{default:n(()=>[r(s(O),{class:`h-96`},{default:n(()=>[r(G,{profile:U.value},null,8,[`profile`])]),_:1})]),_:1})):a(``,!0),r(s(I),null,{default:n(()=>[r(s(O),Line truncated
|
||||
import{A as e,D as t,Jt as n,O as r,at as i,b as a,ht as o,kn as s,lt as c,nr as l,s as u,t as d,v as f,x as p,xt as m,y as h,yn as g}from"./PageHeader.js";import{_,n as v,t as y}from"./api.js";import{i as b,n as x,r as S,t as C}from"./alert.js";import{_ as w,a as T,c as E,d as D,f as O,g as k,h as A,i as j,l as M,m as N,n as P,o as F,p as I,r as L,s as R,t as z,u as B}from"./index.js";function V(e,t=Date.now()){if(!e.captured)return`unconfigured`;if(!e.expires_at)return`ready`;let n=Date.parse(e.expires_at);return Number.isNaN(n)?`ready`:n<=t?`expired`:n-t<=18e5?`expiring`:`ready`}function H(e,t,n=80,r=24){let i=t.protocol===`https:`?`wss:`:`ws:`,a=new URLSearchParams({profile:e,cols:String(n),rows:String(r)}).toString();return`${i}//${t.host}/api/harness/terminal?${a}`}var U={class:`flex h-full min-h-0 flex-col gap-2`},W={key:0,class:`text-sm text-muted-foreground`,role:`status`},G=e({__name:`SetupTerminal`,props:{profile:{}},setup(e){let n=e,r=g(null),s=g(`connecting`),l=null,d=null,m=null,h=null;function _(){try{m?.fit()}catch{}}return c(()=>{let e=r.value;if(!e)return;l=new P({convertEol:!0,cursorBlink:!0,fontFamily:`'IBM Plex Mono', ui-monospace, monospace`,fontSize:13,theme:{background:`#0b0f14`,foreground:`#e6edf3`,cursor:`#e6edf3`,selectionBackground:`#264f78`}}),m=new z,l.loadAddon(m),l.open(e),_(),l.focus();let t=new WebSocket(H(n.profile,window.location,l?.cols??80,l?.rows??24));d=t,t.binaryType=`arraybuffer`,t.onopen=()=>{s.value=`open`},t.onmessage=e=>{l&&(typeof e.data==`string`?l.write(e.data):l.write(new Uint8Array(e.data)))},t.onerror=()=>{s.value=`failed`},t.onclose=()=>{s.value=`closed`},l.onData(e=>{t.readyState===WebSocket.OPEN&&t.send(e)}),h=new ResizeObserver(_),h.observe(e)}),i(()=>{h?.disconnect(),h=null,d?.close(),d=null,l?.dispose(),l=null,m=null}),(e,n)=>(o(),p(`div`,U,[s.value===`open`?a(``,!0):(o(),p(`p`,W,[s.value===`connecting`?(o(),p(u,{key:0},[t(`Connecting…`)],64)):s.value===`closed`?(o(),p(u,{key:1},[t(`The terminal session ended.`)],64)):(o(),p(u,{key:2},[t(`Could not open the setup terminal.`)],64))])),f(`div`,{ref_key:`host`,ref:r,class:`min-h-0 flex-1 overflow-hidden rounded-md border border-border bg-[#0b0f14] p-2`},null,512)]))}}),K={key:0,class:`mb-4 text-sm text-danger`,role:`alert`},q={key:1,class:`space-y-2`},J={class:`flex flex-col gap-1 text-sm`},Y=e({__name:`HarnessPage`,setup(e){let i=g(null),P=g(!0),z=g(null),H=g(!1),U=g(``),W=g(!1),Y={ready:{label:`Ready`,variant:`ok`},expiring:{label:`Expiring soon`,variant:`warn`},expired:{label:`Expired`,variant:`danger`},unconfigured:{label:`Not set up`,variant:`idle`}};c(X);async function X(){P.value=!0,z.value=null,H.value=!1;try{let e=await v.harnessBindings();i.value={terminal:e.terminal,bindings:e.bindings??[],profiles:e.profiles??[]},U.value=i.value.profiles[0]??``}catch(e){let t=e instanceof y?e.status:void 0;t===501||t===503?H.value=!0:z.value=e instanceof Error?e.message:String(e),i.value=null}finally{P.value=!1}}function Z(){i.value?.terminal&&U.value&&(W.value=!0)}function Q(e){if(!e)return`—`;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function $(e){return e.scopes?.length?e.scopes.join(`, `):`—`}return(e,c)=>(o(),p(`div`,null,[r(d,{title:`Harness`}),z.value?(o(),p(`p`,K,l(z.value),1)):a(``,!0),P.value?(o(),p(`div`,q,[r(s(L),{class:`h-24 w-full`}),r(s(L),{class:`h-40 w-full`})])):H.value?(o(),h(s(w),{key:2},{default:n(()=>[r(s(A),null,{default:n(()=>[r(s(N),null,{default:n(()=>[...c[1]||=[t(`Harness bindings are not configured`,-1)]]),_:1}),r(s(k),null,{default:n(()=>[...c[2]||=[t(`Credential bindings and OAuth tokens unavailable.`,-1)]]),_:1})]),_:1})]),_:1})):i.value?(o(),p(u,{key:3},[i.value.terminal?(o(),h(s(I),{key:1,class:`mb-4`},{default:n(()=>[r(s(O),{class:`flex flex-wrap items-end gap-3`},{default:n(()=>[f(`label`,J,[c[6]||=f(`span`,{class:`text-muted-foreground`},`Profile`,-1),r(s(T),{size:`sm`,modelValue:U.value,"onUpdate:modelValue":c[0]||=e=>U.value=e,class:`min-w-48`,disabled:!i.value.profiles.length},{default:n(()=>[i.value.profiles.length?a(``,!0):(o(),h(s(j),{key:0,value:``},{default:n(()=>[...c[5]||=[t(`No profiles configured`,-1)]]),_:1})),(o(!0),p(u,null,m(i.value.profiles,e=>(o(),h(s(j),{key:e,value:e},{default:n(()=>[t(l(e),1)]),_:2},1032,[`value`]))),128))]),_:1},8,[`modelValue`,`disabled`])]),r(s(_),{disabled:!U.value,onClick:Z},{default:n(()=>[...c[7]||=[t(`Open setup terminal`,-1)]]),_:1},8,[`disabled`])]),_:1})]),_:1})):(o(),h(s(S),{key:0,class:`mb-4`},{default:n(()=>[r(s(C),null,{default:n(()=>[...c[3]||=[t(`Setup terminal unavailable`,-1)]]),_:1}),r(s(x),null,{default:n(()=>[...c[4]||=[t(`Start the daemon with a container runtime and a harness token to log in to a CLI from here. Bindings are still listed below.`,-1)]]),_:1})]),_:1})),W.value&&U.value?(o(),h(s(I),{key:2,class:`mb-4`},{default:n(()=>[r(s(O),{class:`h-96`},{default:n(()=>[r(G,{profile:U.value},null,8,[`profile`])]),_:1})]),_:1})):a(``,!0),r(s(I),null,{default:n(()=>[r(s(O),null,Line truncated
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
import{d as e,o as t,s as n,t as r}from"./CardAccordion.js";import{A as i,D as a,Jt as o,O as s,_ as c,b as l,ht as u,kn as d,lt as f,nr as p,t as m,v as h,x as g,yn as _}from"./PageHeader.js";import{W as v,h as y}from"./api.js";import{T as b,b as x}from"./index.js";var S={key:0,class:`mb-4 text-sm text-destructive`,role:`alert`},C={key:1,class:`text-sm text-fg-muted`},w=`eda-playbooks`,T=i({__name:`PlaybooksPage`,setup(i){let T=e();f(T.load);let E=c(()=>T.drafts[w]?.value),D=_(``),O=_(``),k=c(()=>T.changesFor(w).length>0);function A(){if(k.value)return;let e=D.value.trim();if(!e||E.value?.playbooks.some(t=>t.id===e))return;let t=T.drafts[w];t&&(t.value||={playbooks:[]},t.value.playbooks.push({id:e,yaml:``}),D.value=``,O.value=String(t.value.playbooks.length-1))}return(e,i)=>(u(),g(`div`,null,[s(m,{title:`Playbooks`},{default:o(()=>[s(t,{kinds:[w]},null,8,[`kinds`])]),_:1}),s(n,{kind:w,class:`mb-4`}),d(T).catalogError||d(T).pageErrorFor(w)?(u(),g(`p`,S,p(d(T).catalogError||d(T).pageErrorFor(w)),1)):l(``,!0),h(`form`,{class:`mb-4 flex gap-2`,onSubmit:v(A,[`prevent`])},[s(d(b),{modelValue:D.value,"onUpdate:modelValue":i[0]||=e=>D.value=e,"aria-label":`Playbook ID`,placeholder:`Playbook ID`,class:`max-w-xs`,disabled:k.value},null,8,[`modelValue`,`disabled`]),s(d(y),{type:`submit`,disabled:k.value||!D.value.trim()||E.value?.playbooks.some(e=>e.id===D.value.trim())},{default:o(()=>[...i[3]||=[a(`Add playbook`,-1)]]),_:1},8,[`disabled`])],32),E.value?.playbooks.length?l(``,!0):(u(),g(`p`,C,`No playbooks installed.`)),s(r,{open:O.value,"onUpdate:open":i[1]||=e=>O.value=e,items:E.value?.playbooks??[],title:e=>e.id,"remove-label":`Remove`,mono:``,onRemove:i[2]||=e=>E.value.playbooks.splice(e,1)},{default:o(({item:e,index:t})=>[s(d(x),{id:`playbook-${t}`,modelValue:e.yaml,"onUpdate:modelValue":t=>e.yaml=t,"aria-label":`${e.id} YAML`,class:`mb-3 min-h-64 font-mono`,spellcheck:`false`},null,8,[`id`,`modelValue`,`onUpdate:modelValue`,`aria-label`])]),_:1},8,[`open`,`items`,`title`])]))}});export{T as default};
|
||||
import{d as e,o as t,s as n,t as r}from"./CardAccordion.js";import{A as i,D as a,Jt as o,O as s,_ as c,b as l,ht as u,kn as d,lt as f,nr as p,t as m,v as h,x as g,yn as _}from"./PageHeader.js";import{K as v,_ as y}from"./api.js";import{T as b,b as x}from"./index.js";var S={key:0,class:`mb-4 text-sm text-destructive`,role:`alert`},C={key:1,class:`text-sm text-fg-muted`},w=`eda-playbooks`,T=i({__name:`PlaybooksPage`,setup(i){let T=e();f(T.load);let E=c(()=>T.drafts[w]?.value),D=_(``),O=_(``),k=c(()=>T.changesFor(w).length>0);function A(){if(k.value)return;let e=D.value.trim();if(!e||E.value?.playbooks.some(t=>t.id===e))return;let t=T.drafts[w];t&&(t.value||={playbooks:[]},t.value.playbooks.push({id:e,yaml:``}),D.value=``,O.value=String(t.value.playbooks.length-1))}return(e,i)=>(u(),g(`div`,null,[s(m,{title:`Playbooks`},{default:o(()=>[s(t,{kinds:[w]},null,8,[`kinds`])]),_:1}),s(n,{kind:w,class:`mb-4`}),d(T).catalogError||d(T).pageErrorFor(w)?(u(),g(`p`,S,p(d(T).catalogError||d(T).pageErrorFor(w)),1)):l(``,!0),h(`form`,{class:`mb-4 flex gap-2`,onSubmit:v(A,[`prevent`])},[s(d(b),{modelValue:D.value,"onUpdate:modelValue":i[0]||=e=>D.value=e,"aria-label":`Playbook ID`,placeholder:`Playbook ID`,class:`max-w-xs`,disabled:k.value},null,8,[`modelValue`,`disabled`]),s(d(y),{type:`submit`,disabled:k.value||!D.value.trim()||E.value?.playbooks.some(e=>e.id===D.value.trim())},{default:o(()=>[...i[3]||=[a(`Add playbook`,-1)]]),_:1},8,[`disabled`])],32),E.value?.playbooks.length?l(``,!0):(u(),g(`p`,C,`No playbooks installed.`)),s(r,{open:O.value,"onUpdate:open":i[1]||=e=>O.value=e,items:E.value?.playbooks??[],title:e=>e.id,"remove-label":`Remove`,mono:``,onRemove:i[2]||=e=>E.value.playbooks.splice(e,1)},{default:o(({item:e,index:t})=>[s(d(x),{id:`playbook-${t}`,modelValue:e.yaml,"onUpdate:modelValue":t=>e.yaml=t,"aria-label":`${e.id} YAML`,class:`mb-3 min-h-64 font-mono`,spellcheck:`false`},null,8,[`id`,`modelValue`,`onUpdate:modelValue`,`aria-label`])]),_:1},8,[`open`,`items`,`title`])]))}});export{T as default};
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
import{A as e,Jt as t,Qn as n,St as r,ht as i,kn as a,tt as o,x as s,y as c}from"./PageHeader.js";import{_ as l,b as u,f as d,g as f}from"./api.js";import{t as p}from"./createLucideIcon.js";var m=p({name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]}),h=e({__name:`Badge`,props:{asChild:{type:Boolean},as:{},variant:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let n=e,s=d(n,`class`);return(u,d)=>(i(),c(a(l),o({"data-slot":`badge`,"data-variant":e.variant,class:a(f)(a(g)({variant:e.variant}),n.class)},a(s)),{default:t(()=>[r(u.$slots,`default`)]),_:3},16,[`data-variant`,`class`]))}}),g=u(`h-5 gap-1 rounded-sm border border-transparent px-2 py-0.5 text-xs font-medium transition-all has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&>svg]:size-3! group/badge inline-flex w-fit shrink-0 items-center justify-center overflow-hidden whitespace-nowrap focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,destructive:`bg-destructive/10 [a]:hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 text-destructive dark:bg-destructive/20`,outline:`border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground`,ghost:`hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`,ok:`bg-ok-soft text-ok`,warn:`bg-warn-soft text-warn`,danger:`bg-danger-soft text-danger`,info:`bg-info-soft text-info`,idle:`bg-idle-soft text-idle`}},defaultVariants:{variant:`default`}}),_=e({__name:`Alert`,props:{class:{type:[Boolean,null,String,Object,Array]},variant:{}},setup(e){let t=e;return(o,c)=>(i(),s(`div`,{"data-slot":`alert`,class:n(a(f)(a(b)({variant:e.variant}),t.class)),role:`alert`},[r(o.$slots,`default`)],2))}}),v=e({__name:`AlertDescription`,props:{class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e;return(e,o)=>(i(),s(`div`,{"data-slot":`alert-description`,class:n(a(f)(`text-muted-foreground text-sm text-balance md:text-pretty [&_p:not(:last-child)]:mb-4 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground`,t.class))},[r(e.$slots,`default`)],2))}}),y=e({__name:`AlertTitle`,props:{class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e;return(e,o)=>(i(),s(`div`,{"data-slot":`alert-title`,class:n(a(f)(`font-medium group-has-[>svg]/alert:col-start-2 cn-font-heading [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground`,t.class))},[r(e.$slots,`default`)],2))}}),b=u(`grid gap-0.5 rounded-lg border px-2.5 py-2 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*=size-])]:size-4 group/alert relative w-full`,{variants:{variant:{default:`bg-card text-card-foreground`,destructive:`text-destructive bg-card *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current`}},defaultVariants:{variant:`default`}});export{m as a,h as i,v as n,_ as r,y as t};
|
||||
import{A as e,Jt as t,Qn as n,St as r,ht as i,kn as a,tt as o,x as s,y as c}from"./PageHeader.js";import{S as l,m as u,v as d,y as f}from"./api.js";import{t as p}from"./createLucideIcon.js";var m=p({name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]}),h=e({__name:`Badge`,props:{asChild:{type:Boolean},as:{},variant:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let n=e,s=u(n,`class`);return(l,u)=>(i(),c(a(f),o({"data-slot":`badge`,"data-variant":e.variant,class:a(d)(a(g)({variant:e.variant}),n.class)},a(s)),{default:t(()=>[r(l.$slots,`default`)]),_:3},16,[`data-variant`,`class`]))}}),g=l(`h-5 gap-1 rounded-sm border border-transparent px-2 py-0.5 text-xs font-medium transition-all has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&>svg]:size-3! group/badge inline-flex w-fit shrink-0 items-center justify-center overflow-hidden whitespace-nowrap focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,destructive:`bg-destructive/10 [a]:hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 text-destructive dark:bg-destructive/20`,outline:`border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground`,ghost:`hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`,ok:`bg-ok-soft text-ok`,warn:`bg-warn-soft text-warn`,danger:`bg-danger-soft text-danger`,info:`bg-info-soft text-info`,idle:`bg-idle-soft text-idle`}},defaultVariants:{variant:`default`}}),_=e({__name:`Alert`,props:{class:{type:[Boolean,null,String,Object,Array]},variant:{}},setup(e){let t=e;return(o,c)=>(i(),s(`div`,{"data-slot":`alert`,class:n(a(d)(a(b)({variant:e.variant}),t.class)),role:`alert`},[r(o.$slots,`default`)],2))}}),v=e({__name:`AlertDescription`,props:{class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e;return(e,o)=>(i(),s(`div`,{"data-slot":`alert-description`,class:n(a(d)(`text-muted-foreground text-sm text-balance md:text-pretty [&_p:not(:last-child)]:mb-4 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground`,t.class))},[r(e.$slots,`default`)],2))}}),y=e({__name:`AlertTitle`,props:{class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e;return(e,o)=>(i(),s(`div`,{"data-slot":`alert-title`,class:n(a(d)(`font-medium group-has-[>svg]/alert:col-start-2 cn-font-heading [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground`,t.class))},[r(e.$slots,`default`)],2))}}),b=l(`grid gap-0.5 rounded-lg border px-2.5 py-2 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*=size-])]:size-4 group/alert relative w-full`,{variants:{variant:{default:`bg-card text-card-foreground`,destructive:`text-destructive bg-card *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current`}},defaultVariants:{variant:`default`}});export{m as a,h as i,v as n,_ as r,y as t};
|
||||
Vendored
+3
-3
@@ -1,3 +1,3 @@
|
||||
import{$n as e,A as t,An as n,Bn as r,Bt as i,Dn as a,En as o,Et as s,Fn as c,Gn as l,Hn as u,In as d,Jn as f,Jt as p,Kn as m,Ln as h,Mn as g,Nn as _,O as ee,Pn as v,Qn as y,R as b,Rn as te,S as ne,Sn as x,St as S,U as re,Un as ie,Ut as C,V as ae,Vn as oe,Wn as w,Wt as T,Xn as E,Y as se,Yn as D,Zn as O,_ as k,_n as ce,dn as le,g as ue,ht as A,i as j,ir as de,jn as fe,kn as M,kt as pe,l as me,lt as N,m as he,mn as ge,mt as _e,n as ve,nt as ye,on as be,ot as xe,pt as Se,qn as P,r as Ce,rn as we,s as Te,tt as Ee,w as De,wn as Oe,xn as ke,y as Ae,yn as je,yt as Me,z as Ne,zn as F}from"./PageHeader.js";var Pe=void 0,Fe=typeof window<`u`&&window.trustedTypes;if(Fe)try{Pe=Fe.createPolicy(`vue`,{createHTML:e=>e})}catch{}var Ie=Pe?e=>Pe.createHTML(e):e=>e,Le=`http://www.w3.org/2000/svg`,Re=`http://www.w3.org/1998/Math/MathML`,I=typeof document<`u`?document:null,ze=I&&I.createElement(`template`),Be={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{let t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,r)=>{let i=t===`svg`?I.createElementNS(Le,e):t===`mathml`?I.createElementNS(Re,e):n?I.createElement(e,{is:n}):I.createElement(e);return e===`select`&&r&&r.multiple!=null&&i.setAttribute(`multiple`,r.multiple),i},createText:e=>I.createTextNode(e),createComment:e=>I.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>I.querySelector(e),setScopeId(e,t){e.setAttribute(t,``)},insertStaticContent(e,t,n,r,i,a){let o=n?n.previousSibling:t.lastChild;if(i&&(i===a||i.nextSibling))for(;t.insertBefore(i.cloneNode(!0),n),i!==a&&(i=i.nextSibling););else{ze.innerHTML=Ie(r===`svg`?`<svg>${e}</svg>`:r===`mathml`?`<math>${e}</math>`:e);let i=ze.content;if(r===`svg`||r===`mathml`){let e=i.firstChild;for(;e.firstChild;)i.appendChild(e.firstChild);i.removeChild(e)}t.insertBefore(i,n)}return[o?o.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},L=`transition`,Ve=`animation`,He=Symbol(`_vtc`),Ue={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},We=v({},Ce,Ue),Ge=(e=>(e.displayName=`Transition`,e.props=We,e))((e,{slots:t})=>ae(ve,qe(e),t)),R=(e,t=[])=>{F(e)?e.forEach(e=>e(...t)):e&&e(...t)},Ke=e=>e?F(e)?e.some(e=>e.length>1):e.length>1:!1;function qe(e){let t={};for(let n in e)n in Ue||(t[n]=e[n]);if(e.css===!1)return t;let{name:n=`v`,type:r,duration:i,enterFromClass:a=`${n}-enter-from`,enterActiveClass:o=`${n}-enter-active`,enterToClass:s=`${n}-enter-to`,appearFromClass:c=a,appearActiveClass:l=o,appearToClass:u=s,leaveFromClass:d=`${n}-leave-from`,leaveActiveClass:f=`${n}-leave-active`,leaveToClass:p=`${n}-leave-to`}=e,m=Je(i),h=m&&m[0],g=m&&m[1],{onBeforeEnter:_,onEnter:ee,onEnterCancelled:y,onLeave:b,onLeaveCancelled:te,onBeforeAppear:ne=_,onAppear:x=ee,onAppearCancelled:S=y}=t,re=(e,t,n,r)=>{e._enterCancelled=r,B(e,t?u:s),B(e,t?l:o),n&&n()},ie=(e,t)=>{e._isLeaving=!1,B(e,d),B(e,p),B(e,f),t&&t()},C=e=>(t,n)=>{let i=e?x:ee,o=()=>re(t,e,n);R(i,[t,o]),Xe(()=>{B(t,e?c:a),z(t,e?u:s),Ke(i)||Qe(t,r,h,o)})};return v(t,{onBeforeEnter(e){R(_,[e]),z(e,a),z(e,o)},onBeforeAppear(e){R(ne,[e]),z(e,c),z(e,l)},onEnter:C(!1),onAppear:C(!0),onLeave(e,t){e._isLeaving=!0;let n=()=>ie(e,t);z(e,d),e._enterCancelled?(z(e,f),nt(e)):(nt(e),z(e,f)),Xe(()=>{e._isLeaving&&(B(e,d),z(e,p),Ke(b)||Qe(e,r,g,n))}),R(b,[e,n])},onEnterCancelled(e){re(e,!1,void 0,!0),R(y,[e])},onAppearCancelled(e){re(e,!0,void 0,!0),R(S,[e])},onLeaveCancelled(e){ie(e),R(te,[e])}})}function Je(e){if(e==null)return null;if(u(e))return[Ye(e.enter),Ye(e.leave)];{let t=Ye(e);return[t,t]}}function Ye(e){return de(e)}function z(e,t){t.split(/\s+/).forEach(t=>t&&e.classList.add(t)),(e[He]||(e[He]=new Set)).add(t)}function B(e,t){t.split(/\s+/).forEach(t=>t&&e.classList.remove(t));let n=e[He];n&&(n.delete(t),n.size||(e[He]=void 0))}function Xe(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}var Ze=0;function Qe(e,t,n,r){let i=e._endId=++Ze,a=()=>{i===e._endId&&r()};if(n!=null)return setTimeout(a,n);let{type:o,timeout:s,propCount:c}=$e(e,t);if(!o)return r();let l=o+`end`,u=0,d=()=>{e.removeEventListener(l,f),a()},f=t=>{t.target===e&&++u>=c&&d()};setTimeout(()=>{u<c&&d()},s+1),e.addEventListener(l,f)}function $e(e,t){let n=window.getComputedStyle(e),r=e=>(n[e]||``).split(`, `),i=r(`${L}Delay`),a=r(`${L}Duration`),o=et(i,a),s=r(`${Ve}Delay`),c=r(`${Ve}Duration`),l=et(s,c),u=null,d=0,f=0;t===L?o>0&&(u=L,d=o,f=a.length):t===Ve?l>0&&(u=Ve,d=l,f=c.length):(d=Math.max(o,l),u=d>0?o>l?L:Ve:null,f=u?u===L?a.length:c.length:0);let p=u===L&&/\b(?:transform|all)(?:,|$)/.test(r(`${L}Property`).toString());return{type:u,timeout:d,propCount:f,hasTransform:p}}function et(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((t,n)=>tt(tLine truncated
|
||||
`))),e[U]=H(i);let a=r||i.props&&i.props.type===`number`;V(e,t?`change`:`input`,t=>{t.target.composing||e[U](on(e.value,n,a))}),(n||a)&&V(e,`change`,()=>{e.value=on(e.value,n,a)}),t||(V(e,`compositionstart`,nn),V(e,`compositionend`,rn),V(e,`change`,rn))},mounted(e,{value:t,modifiers:{trim:n,number:r}}){let i=t??``,a=e[an];delete e[an],a!==void 0&&(e.type===`text`||e.type===`textarea`)&&e.value!==a?e[U](on(e.value,n,r)):e.value=i},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:i,number:a}},o){if(e[U]=H(o),e.composing)return;let s=(a||e.type===`number`)&&!/^0\d/.test(e.value)?O(e.value):e.value,c=t??``;if(s===c)return;let l=e.getRootNode();(l instanceof Document||l instanceof ShadowRoot)&&l.activeElement===e&&e.type!==`range`&&(r&&t===n||i&&e.value.trim()===c)||(e.value=c)}},cn={deep:!0,created(e,t,n){e[U]=H(n),V(e,`change`,()=>{let t=e._modelValue,n=mn(e),r=e.checked,i=e[U];if(F(t)){let e=E(t,n),a=e!==-1;if(r&&!a)i(t.concat(n));else if(!r&&a){let n=[...t];n.splice(e,1),i(n)}}else if(l(t)){let e=new Set(t);r?e.add(n):e.delete(n),i(e)}else i(hn(e,r))})},mounted:ln,beforeUpdate(e,t,n){e[U]=H(n),ln(e,t,n)}};function ln(e,{value:t,oldValue:n},r){e._modelValue=t;let i;if(F(t))i=E(t,r.props.value)>-1;else if(l(t))i=t.has(r.props.value);else{if(t===n)return;i=D(t,hn(e,!0))}e.checked!==i&&(e.checked=i)}var un={created(e,{value:t},n){e.checked=D(t,n.props.value),e[U]=H(n),V(e,`change`,()=>{e[U](mn(e))})},beforeUpdate(e,{value:t,oldValue:n},r){e[U]=H(r),t!==n&&(e.checked=D(t,r.props.value))}},dn={deep:!0,created(e,{value:t,modifiers:{number:n}},r){e._modelValue=t,V(e,`change`,()=>{let t=Array.prototype.filter.call(e.options,e=>e.selected).map(e=>n?O(mn(e)):mn(e)),r=e.multiple,i=r?l(e._modelValue)?new Set(t):t:t[0],a=e._pendingValue=[r,r?F(i)?t.slice():t:i];try{e[U](i)}finally{ye(()=>{e._pendingValue===a&&(e._pendingValue=void 0)})}}),e[U]=H(r)},mounted(e,{value:t}){pn(e,t)},beforeUpdate(e,{value:t},n){e._modelValue=t,e[U]=H(n)},updated(e,{value:t}){let n=e._pendingValue;e._pendingValue=void 0,(!n||n[0]!==e.multiple||!fn(t,n[1],n[0]))&&pn(e,t)}};function fn(e,t,n){if(!n||F(e))return D(e,t);if(l(e)){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}return!1}function pn(e,t){let n=e.multiple,r=F(t);if(!n||r||l(t)){for(let i=0,a=e.options.length;i<a;i++){let a=e.options[i],o=mn(a);if(n){if(r){let e=typeof o;a.selected=e===`string`||e===`number`?t.some(e=>String(e)===String(o)):E(t,o)>-1}else a.selected=t.has(o)}else if(D(mn(a),t)){e.selectedIndex!==i&&(e.selectedIndex=i);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function mn(e){return`_value`in e?e._value:e.value}function hn(e,t){let n=t?`_trueValue`:`_falseValue`;return n in e?e[n]:t}var gn={created(e,t,n){vn(e,t,n,null,`created`)},mounted(e,t,n){vn(e,t,n,null,`mounted`)},beforeUpdate(e,t,n,r){vn(e,t,n,r,`beforeUpdate`)},updated(e,t,n,r){vn(e,t,n,r,`updated`)}};function _n(e,t){switch(e){case`SELECT`:return dn;case`TEXTAREA`:return sn;default:switch(t){case`checkbox`:return cn;case`radio`:return un;default:return sn}}}function vn(e,t,n,r,i){let a=_n(e.tagName,n.props&&n.props.type)[i];a&&a(e,t,n,r)}function yn(){sn.getSSRProps=({value:e})=>({value:e}),un.getSSRProps=({value:e},t)=>{if(t.props&&D(t.props.value,e))return{checked:!0}},cn.getSSRProps=({value:e},t)=>{if(F(e)){if(t.props&&E(e,t.props.value)>-1)return{checked:!0}}else if(l(e)){if(t.props&&e.has(t.props.value))return{checked:!0}}else if(e)return{checked:!0}},gn.getSSRProps=(e,t)=>{if(typeof t.type!=`string`)return;let n=_n(t.type.toUpperCase(),t.props&&t.props.type);if(n.getSSRProps)return n.getSSRProps(e,t)}}var bn=[`ctrl`,`shift`,`alt`,`meta`],xn={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>`button`in e&&e.button!==0,middle:e=>`button`in e&&e.button!==1,right:e=>`button`in e&&e.button!==2,exact:(e,t)=>bn.some(n=>e[`${n}Key`]&&!t.includes(n))},Sn=(e,t)=>{if(!e)return e;let n=e._withMods||={},r=t.join(`.`);return n[r]||(n[r]=((n,...r)=>{for(let e=0;e<t.length;e++){let r=xn[t[e]];if(r&&r(n,t))return}return e(n,...r)}))},Cn={esc:`escape`,space:` `,up:`arrow-up`,left:`arrow-left`,right:`arrow-right`,down:`arrow-down`,delete:`backspace`},wn=(e,t)=>{let n=e._withKeys||={},r=t.join(`.`);return n[r]||(n[r]=(n=>{if(!(`key`in n))return;let r=d(n.key);if(t.some(e=>e===r||Cn[e]===r))return e(n)}))},Tn=v({patchProp:Ft},Be),En,Dn=!1;function On(){return En||=De(Tn)}function kn(){return En=Dn?En:ne(Tn),Dn=!0,En}var An=((...e)=>{On().render(...e)}),jn=((...e)=>{kn().hydrate(...e)}),Mn=((...e)=>{let t=On().createApp(...e),{mount:n}=t;return t.mount=e=>{let i=Fn(e);if(!i)return;let a=t._component;!r(a)&&!a.render&&!a.template&&(a.template=i.innerHTML),i.nodeType===1&&(i.textContent=``);let o=n(i,!1,Pn(i));return i instanceof Element&&(i.removeAttribute(`v-cloak`),i.setAttribute(`data-v-app`,``)),o},t}),Nn=((...e)=>{let t=kn().createApp(...e),{mount:
Line truncated
|
||||
`)[0].slice(0,200)}catch{}return`${e.status} ${e.statusText}`}var $i;function ea(e){$i=e}var ta=class extends Error{status;constructor(e,t){super(e),this.name=`ApiError`,this.status=t}};function na(e){let t=e instanceof ta?e.status:void 0,n=e instanceof Error&&e.message?e.message:`Action failed`;return t===401?{kind:`session-expired`,message:n}:t!==void 0&&t>=400&&t<500?{kind:`refused`,message:n}:{kind:`broken`,message:n}}async function ra(e,t){let n=await fetch(e,t);if($i?.(n.status===401),!n.ok)throw new ta(await Qi(n),n.status);return n}async function $(e,t={}){let{method:n=`GET`,body:r,timeoutMs:i=Zi,parse:a=!0}=t,o={Accept:`application/json`},s={method:n,headers:o,signal:AbortSignal.timeout(i)};n!==`GET`&&(o[`Content-Type`]=`application/json`,o[`X-Archie-CSRF`]=`1`),r!==void 0&&(s.body=JSON.stringify(r));let c=await ra(e,s);return a?await c.json():void 0}var ia={recoveryCode:()=>$(`/api/account/recovery`,{method:`POST`,body:{}}),recoverAccount:(e,t,n)=>$(`/api/auth/recover`,{method:`POST`,body:{email:e,code:t,password:n},parse:!1}),authStatus:()=>$(`/api/auth/status`),setupAccount:e=>$(`/api/auth/setup`,{method:`POST`,body:e}),signIn:(e,t)=>$(`/api/auth/login`,{method:`POST`,body:{email:e,password:t}}),signOut:()=>$(`/api/auth/logout`,{method:`POST`,body:{},parse:!1}),createAccount:e=>$(`/api/accounts`,{method:`POST`,body:e}),changePassword:(e,t)=>$(`/api/account/password`,{method:`POST`,body:{current_password:e,new_password:t},parse:!1}),authentication:()=>$(`/api/authentication`),saveAuthentication:e=>$(`/api/authentication`,{method:`PUT`,body:e,parse:!1}),passkeys:()=>$(`/api/account/passkeys`),deletePasskey:e=>$(`/api/account/passkeys/${encodeURIComponent(e)}`,{method:`DELETE`,body:{},parse:!1}),beginPasskey:e=>$(e?`/api/account/passkeys/begin`:`/api/auth/passkey/begin`,{method:`POST`,body:{}}),finishPasskey:(e,t,n)=>$(e?`/api/account/passkeys/finish`:`/api/auth/passkey/finish`,{method:`POST`,body:{credential:t,name:n}}),secretEngines:()=>$(`/api/secret-engines`),checkSecret:e=>$(`/api/secret-references/check`,{method:`POST`,body:e}),health:()=>$(`/health/detailed`),services:()=>$(`/api/services`),policies:()=>$(`/api/access/policies`),putPolicy:e=>$(`/api/access/policies`,{method:`PUT`,body:e}),deletePolicy:e=>$(`/api/access/policies`,{method:`DELETE`,body:e,parse:!1}),orgs:()=>$(`/api/orgs`),orgCreate:e=>$(`/api/orgs`,{method:`POST`,body:e}),org:e=>$(`/api/orgs/${encodeURIComponent(e)}`),orgWorkspaces:e=>$(`/api/orgs/${encodeURIComponent(e)}/workspaces`),createOrgWorkspace:(e,t)=>$(`/api/orgs/${encodeURIComponent(e)}/workspaces`,{method:`POST`,body:t}),orgAgents:e=>$(`/api/orgs/${encodeURIComponent(e)}/agents`),orgMembers:e=>$(`/api/orgs/${encodeURIComponent(e)}/members`),addOrgMember:(e,t)=>$(`/api/orgs/${encodeURIComponent(e)}/members`,{method:`POST`,body:t}),setOrgMember:(e,t,n)=>$(`/api/orgs/${encodeURIComponent(e)}/members/${encodeURIComponent(t)}`,{method:`PUT`,body:n}),removeOrgMember:(e,t,n)=>$(`/api/orgs/${encodeURIComponent(e)}/members/${encodeURIComponent(t)}`+Q({workspace:n}),{method:`DELETE`,parse:!1}),assignOrgAgent:(e,t)=>$(`/api/orgs/${encodeURIComponent(e)}/agents/${encodeURIComponent(t)}`,{method:`PUT`}),alerts:()=>$(`/api/alerts`),dismissAlert:e=>$(`/api/alerts/${e}/dismiss`,{method:`POST`,parse:!1}),identities:()=>$(`/api/identities`),identityCreate:e=>$(`/api/identities`,{method:`POST`,body:e}),identityCommand:(e,t,n)=>$(`/api/identities/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,{method:`POST`,body:n}),summary:()=>$(`/api/summary`),tasks:()=>$(`/api/tasks`),taskPage:async e=>{let t=await ra(`/api/tasks`+Q(e),{headers:{Accept:`application/json`},signal:AbortSignal.timeout(Zi)});return{tasks:await t.json(),next:t.headers.get(`X-Next-Cursor`)}},taskMeta:()=>$(`/api/task-meta`),task:e=>$(`/api/tasks/${encodeURIComponent(e)}`),taskAttempts:e=>$(`/api/tasks/${encodeURIComponent(e)}/attempts`),taskChanges:(e,t)=>$(`/api/tasks/${encodeURIComponent(e)}/changes`+Q(t)),taskDebug:(e,t)=>$(`/api/tasks/${encodeURIComponent(e)}/debug`+Q(t)),taskAction:(e,t,n)=>$(`/api/tasks/${encodeURIComponent(e)}/action`,{method:`POST`,body:{action:t,...n}}),setup:()=>$(`/api/setup`),capabilities:()=>$(`/api/capabilities`),workflows:()=>$(`/api/workflows`),workflowEnabled:(e,t)=>$(`/api/workflows/${encodeURIComponent(e)}/enabled`,{method:`PUT`,body:{enabled:t},parse:!1}),checkRepository:e=>$(`/api/control-plane/resources/repository-policies/check`,{method:`POST`,body:e,timeoutMs:35e3}),repositories:()=>$(`/api/repositories`),workRequest:e=>$(`/api/work-requests`,{method:`POST`,body:e}),skills:()=>$(`/api/skills`),channels:()=>$(`/api/channels`),curators:()=>$(`/api/curators`),channelReload:e=>$(`/api/channels/${encodeURIComponent(e)}/reload`,{method:`POST`,body:{}}),config:()=>$(`/api/config`),logs:e=>$(`/api/logs`+Q(e)),taskLogs:(e,t)=>$(`/api/tasks/${encodeURIComponent(e)}/logs`+Q(t)),taskLogDownloadURL:(e,t)=>`/api/tasks/${encodeURIComponent(e)}/logs/download`+(t==null?``:`?attempt=${t}`),ver
Line truncated
|
||||
import{$n as e,A as t,An as n,Bn as r,Bt as i,Dn as a,En as o,Et as s,Fn as c,Gn as l,Hn as u,In as d,Jn as f,Jt as p,Kn as m,Ln as h,Mn as g,Nn as _,O as ee,Pn as v,Qn as y,R as b,Rn as te,S as ne,Sn as x,St as S,U as C,Un as re,Ut as w,V as ie,Vn as ae,Wn as T,Wt as E,Xn as D,Y as oe,Yn as O,Zn as k,_ as A,_n as se,dn as ce,g as le,ht as j,i as M,ir as ue,jn as de,kn as N,kt as fe,l as pe,lt as P,m as me,mn as he,mt as ge,n as _e,nt as ve,on as ye,ot as be,pt as xe,qn as Se,r as Ce,rn as we,s as Te,tt as Ee,w as De,wn as Oe,xn as ke,y as Ae,yn as je,yt as Me,z as Ne,zn as F}from"./PageHeader.js";var Pe=void 0,Fe=typeof window<`u`&&window.trustedTypes;if(Fe)try{Pe=Fe.createPolicy(`vue`,{createHTML:e=>e})}catch{}var Ie=Pe?e=>Pe.createHTML(e):e=>e,Le=`http://www.w3.org/2000/svg`,Re=`http://www.w3.org/1998/Math/MathML`,I=typeof document<`u`?document:null,ze=I&&I.createElement(`template`),Be={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{let t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,r)=>{let i=t===`svg`?I.createElementNS(Le,e):t===`mathml`?I.createElementNS(Re,e):n?I.createElement(e,{is:n}):I.createElement(e);return e===`select`&&r&&r.multiple!=null&&i.setAttribute(`multiple`,r.multiple),i},createText:e=>I.createTextNode(e),createComment:e=>I.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>I.querySelector(e),setScopeId(e,t){e.setAttribute(t,``)},insertStaticContent(e,t,n,r,i,a){let o=n?n.previousSibling:t.lastChild;if(i&&(i===a||i.nextSibling))for(;t.insertBefore(i.cloneNode(!0),n),i!==a&&(i=i.nextSibling););else{ze.innerHTML=Ie(r===`svg`?`<svg>${e}</svg>`:r===`mathml`?`<math>${e}</math>`:e);let i=ze.content;if(r===`svg`||r===`mathml`){let e=i.firstChild;for(;e.firstChild;)i.appendChild(e.firstChild);i.removeChild(e)}t.insertBefore(i,n)}return[o?o.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},L=`transition`,Ve=`animation`,He=Symbol(`_vtc`),Ue={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},We=v({},Ce,Ue),Ge=(e=>(e.displayName=`Transition`,e.props=We,e))((e,{slots:t})=>ie(_e,qe(e),t)),R=(e,t=[])=>{F(e)?e.forEach(e=>e(...t)):e&&e(...t)},Ke=e=>e?F(e)?e.some(e=>e.length>1):e.length>1:!1;function qe(e){let t={};for(let n in e)n in Ue||(t[n]=e[n]);if(e.css===!1)return t;let{name:n=`v`,type:r,duration:i,enterFromClass:a=`${n}-enter-from`,enterActiveClass:o=`${n}-enter-active`,enterToClass:s=`${n}-enter-to`,appearFromClass:c=a,appearActiveClass:l=o,appearToClass:u=s,leaveFromClass:d=`${n}-leave-from`,leaveActiveClass:f=`${n}-leave-active`,leaveToClass:p=`${n}-leave-to`}=e,m=Je(i),h=m&&m[0],g=m&&m[1],{onBeforeEnter:_,onEnter:ee,onEnterCancelled:y,onLeave:b,onLeaveCancelled:te,onBeforeAppear:ne=_,onAppear:x=ee,onAppearCancelled:S=y}=t,C=(e,t,n,r)=>{e._enterCancelled=r,B(e,t?u:s),B(e,t?l:o),n&&n()},re=(e,t)=>{e._isLeaving=!1,B(e,d),B(e,p),B(e,f),t&&t()},w=e=>(t,n)=>{let i=e?x:ee,o=()=>C(t,e,n);R(i,[t,o]),Xe(()=>{B(t,e?c:a),z(t,e?u:s),Ke(i)||Qe(t,r,h,o)})};return v(t,{onBeforeEnter(e){R(_,[e]),z(e,a),z(e,o)},onBeforeAppear(e){R(ne,[e]),z(e,c),z(e,l)},onEnter:w(!1),onAppear:w(!0),onLeave(e,t){e._isLeaving=!0;let n=()=>re(e,t);z(e,d),e._enterCancelled?(z(e,f),nt(e)):(nt(e),z(e,f)),Xe(()=>{e._isLeaving&&(B(e,d),z(e,p),Ke(b)||Qe(e,r,g,n))}),R(b,[e,n])},onEnterCancelled(e){C(e,!1,void 0,!0),R(y,[e])},onAppearCancelled(e){C(e,!0,void 0,!0),R(S,[e])},onLeaveCancelled(e){re(e),R(te,[e])}})}function Je(e){if(e==null)return null;if(u(e))return[Ye(e.enter),Ye(e.leave)];{let t=Ye(e);return[t,t]}}function Ye(e){return ue(e)}function z(e,t){t.split(/\s+/).forEach(t=>t&&e.classList.add(t)),(e[He]||(e[He]=new Set)).add(t)}function B(e,t){t.split(/\s+/).forEach(t=>t&&e.classList.remove(t));let n=e[He];n&&(n.delete(t),n.size||(e[He]=void 0))}function Xe(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}var Ze=0;function Qe(e,t,n,r){let i=e._endId=++Ze,a=()=>{i===e._endId&&r()};if(n!=null)return setTimeout(a,n);let{type:o,timeout:s,propCount:c}=$e(e,t);if(!o)return r();let l=o+`end`,u=0,d=()=>{e.removeEventListener(l,f),a()},f=t=>{t.target===e&&++u>=c&&d()};setTimeout(()=>{u<c&&d()},s+1),e.addEventListener(l,f)}function $e(e,t){let n=window.getComputedStyle(e),r=e=>(n[e]||``).split(`, `),i=r(`${L}Delay`),a=r(`${L}Duration`),o=et(i,a),s=r(`${Ve}Delay`),c=r(`${Ve}Duration`),l=et(s,c),u=null,d=0,f=0;t===L?o>0&&(u=L,d=o,f=a.length):t===Ve?l>0&&(u=Ve,d=l,f=c.length):(d=Math.max(o,l),u=d>0?o>l?L:Ve:null,f=u?u===L?a.length:c.length:0);let p=u===L&&/\b(?:transform|all)(?:,|$)/.test(r(`${L}Property`).toString());return{type:u,timeout:d,propCount:f,hasTransform:p}}function et(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((t,n)=>tt(t)+ttLine truncated
|
||||
`))),e[U]=H(i);let a=r||i.props&&i.props.type===`number`;V(e,t?`change`:`input`,t=>{t.target.composing||e[U](on(e.value,n,a))}),(n||a)&&V(e,`change`,()=>{e.value=on(e.value,n,a)}),t||(V(e,`compositionstart`,nn),V(e,`compositionend`,rn),V(e,`change`,rn))},mounted(e,{value:t,modifiers:{trim:n,number:r}}){let i=t??``,a=e[an];delete e[an],a!==void 0&&(e.type===`text`||e.type===`textarea`)&&e.value!==a?e[U](on(e.value,n,r)):e.value=i},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:i,number:a}},o){if(e[U]=H(o),e.composing)return;let s=(a||e.type===`number`)&&!/^0\d/.test(e.value)?k(e.value):e.value,c=t??``;if(s===c)return;let l=e.getRootNode();(l instanceof Document||l instanceof ShadowRoot)&&l.activeElement===e&&e.type!==`range`&&(r&&t===n||i&&e.value.trim()===c)||(e.value=c)}},cn={deep:!0,created(e,t,n){e[U]=H(n),V(e,`change`,()=>{let t=e._modelValue,n=mn(e),r=e.checked,i=e[U];if(F(t)){let e=D(t,n),a=e!==-1;if(r&&!a)i(t.concat(n));else if(!r&&a){let n=[...t];n.splice(e,1),i(n)}}else if(l(t)){let e=new Set(t);r?e.add(n):e.delete(n),i(e)}else i(hn(e,r))})},mounted:ln,beforeUpdate(e,t,n){e[U]=H(n),ln(e,t,n)}};function ln(e,{value:t,oldValue:n},r){e._modelValue=t;let i;if(F(t))i=D(t,r.props.value)>-1;else if(l(t))i=t.has(r.props.value);else{if(t===n)return;i=O(t,hn(e,!0))}e.checked!==i&&(e.checked=i)}var un={created(e,{value:t},n){e.checked=O(t,n.props.value),e[U]=H(n),V(e,`change`,()=>{e[U](mn(e))})},beforeUpdate(e,{value:t,oldValue:n},r){e[U]=H(r),t!==n&&(e.checked=O(t,r.props.value))}},dn={deep:!0,created(e,{value:t,modifiers:{number:n}},r){e._modelValue=t,V(e,`change`,()=>{let t=Array.prototype.filter.call(e.options,e=>e.selected).map(e=>n?k(mn(e)):mn(e)),r=e.multiple,i=r?l(e._modelValue)?new Set(t):t:t[0],a=e._pendingValue=[r,r?F(i)?t.slice():t:i];try{e[U](i)}finally{ve(()=>{e._pendingValue===a&&(e._pendingValue=void 0)})}}),e[U]=H(r)},mounted(e,{value:t}){pn(e,t)},beforeUpdate(e,{value:t},n){e._modelValue=t,e[U]=H(n)},updated(e,{value:t}){let n=e._pendingValue;e._pendingValue=void 0,(!n||n[0]!==e.multiple||!fn(t,n[1],n[0]))&&pn(e,t)}};function fn(e,t,n){if(!n||F(e))return O(e,t);if(l(e)){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}return!1}function pn(e,t){let n=e.multiple,r=F(t);if(!n||r||l(t)){for(let i=0,a=e.options.length;i<a;i++){let a=e.options[i],o=mn(a);if(n){if(r){let e=typeof o;a.selected=e===`string`||e===`number`?t.some(e=>String(e)===String(o)):D(t,o)>-1}else a.selected=t.has(o)}else if(O(mn(a),t)){e.selectedIndex!==i&&(e.selectedIndex=i);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function mn(e){return`_value`in e?e._value:e.value}function hn(e,t){let n=t?`_trueValue`:`_falseValue`;return n in e?e[n]:t}var gn={created(e,t,n){vn(e,t,n,null,`created`)},mounted(e,t,n){vn(e,t,n,null,`mounted`)},beforeUpdate(e,t,n,r){vn(e,t,n,r,`beforeUpdate`)},updated(e,t,n,r){vn(e,t,n,r,`updated`)}};function _n(e,t){switch(e){case`SELECT`:return dn;case`TEXTAREA`:return sn;default:switch(t){case`checkbox`:return cn;case`radio`:return un;default:return sn}}}function vn(e,t,n,r,i){let a=_n(e.tagName,n.props&&n.props.type)[i];a&&a(e,t,n,r)}function yn(){sn.getSSRProps=({value:e})=>({value:e}),un.getSSRProps=({value:e},t)=>{if(t.props&&O(t.props.value,e))return{checked:!0}},cn.getSSRProps=({value:e},t)=>{if(F(e)){if(t.props&&D(e,t.props.value)>-1)return{checked:!0}}else if(l(e)){if(t.props&&e.has(t.props.value))return{checked:!0}}else if(e)return{checked:!0}},gn.getSSRProps=(e,t)=>{if(typeof t.type!=`string`)return;let n=_n(t.type.toUpperCase(),t.props&&t.props.type);if(n.getSSRProps)return n.getSSRProps(e,t)}}var bn=[`ctrl`,`shift`,`alt`,`meta`],xn={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>`button`in e&&e.button!==0,middle:e=>`button`in e&&e.button!==1,right:e=>`button`in e&&e.button!==2,exact:(e,t)=>bn.some(n=>e[`${n}Key`]&&!t.includes(n))},Sn=(e,t)=>{if(!e)return e;let n=e._withMods||={},r=t.join(`.`);return n[r]||(n[r]=((n,...r)=>{for(let e=0;e<t.length;e++){let r=xn[t[e]];if(r&&r(n,t))return}return e(n,...r)}))},Cn={esc:`escape`,space:` `,up:`arrow-up`,left:`arrow-left`,right:`arrow-right`,down:`arrow-down`,delete:`backspace`},wn=(e,t)=>{let n=e._withKeys||={},r=t.join(`.`);return n[r]||(n[r]=(n=>{if(!(`key`in n))return;let r=d(n.key);if(t.some(e=>e===r||Cn[e]===r))return e(n)}))},Tn=v({patchProp:Ft},Be),En,Dn=!1;function On(){return En||=De(Tn)}function kn(){return En=Dn?En:ne(Tn),Dn=!0,En}var An=((...e)=>{On().render(...e)}),jn=((...e)=>{kn().hydrate(...e)}),Mn=((...e)=>{let t=On().createApp(...e),{mount:n}=t;return t.mount=e=>{let i=Fn(e);if(!i)return;let a=t._component;!r(a)&&!a.render&&!a.template&&(a.template=i.innerHTML),i.nodeType===1&&(i.textContent=``);let o=n(i,!1,Pn(i));return i instanceof Element&&(i.removeAttribute(`v-cloak`),i.setAttribute(`data-v-app`,``)),o},t}),Nn=((...e)=>{let t=kn().createApp(...e),{mount:
Line truncated
|
||||
`)[0].slice(0,200)}catch{}return`${e.status} ${e.statusText}`}var ca;function la(e){ca=e}var ua=class extends Error{status;constructor(e,t){super(e),this.name=`ApiError`,this.status=t}};function da(e){let t=e instanceof ua?e.status:void 0,n=e instanceof Error&&e.message?e.message:`Action failed`;return t===401?{kind:`session-expired`,message:n}:t!==void 0&&t>=400&&t<500?{kind:`refused`,message:n}:{kind:`broken`,message:n}}async function fa(e,t){let n=await fetch(e,t);if(ca?.(n.status===401),!n.ok)throw new ua(await sa(n),n.status);return n}async function $(e,t={}){let{method:n=`GET`,body:r,timeoutMs:i=oa,parse:a=!0}=t,o={Accept:`application/json`},s={method:n,headers:o,signal:AbortSignal.timeout(i)};n!==`GET`&&(o[`Content-Type`]=`application/json`,o[`X-Archie-CSRF`]=`1`),r!==void 0&&(s.body=JSON.stringify(r));let c=await fa(e,s);return a?await c.json():void 0}var pa={recoveryCode:()=>$(`/api/account/recovery`,{method:`POST`,body:{}}),recoverAccount:(e,t,n)=>$(`/api/auth/recover`,{method:`POST`,body:{email:e,code:t,password:n},parse:!1}),authStatus:()=>$(`/api/auth/status`),setupAccount:e=>$(`/api/auth/setup`,{method:`POST`,body:e}),signIn:(e,t)=>$(`/api/auth/login`,{method:`POST`,body:{email:e,password:t}}),signOut:()=>$(`/api/auth/logout`,{method:`POST`,body:{},parse:!1}),createAccount:e=>$(`/api/accounts`,{method:`POST`,body:e}),changePassword:(e,t)=>$(`/api/account/password`,{method:`POST`,body:{current_password:e,new_password:t},parse:!1}),authentication:()=>$(`/api/authentication`),saveAuthentication:e=>$(`/api/authentication`,{method:`PUT`,body:e,parse:!1}),passkeys:()=>$(`/api/account/passkeys`),deletePasskey:e=>$(`/api/account/passkeys/${encodeURIComponent(e)}`,{method:`DELETE`,body:{},parse:!1}),beginPasskey:e=>$(e?`/api/account/passkeys/begin`:`/api/auth/passkey/begin`,{method:`POST`,body:{}}),finishPasskey:(e,t,n)=>$(e?`/api/account/passkeys/finish`:`/api/auth/passkey/finish`,{method:`POST`,body:{credential:t,name:n}}),secretEngines:()=>$(`/api/secret-engines`),checkSecret:e=>$(`/api/secret-references/check`,{method:`POST`,body:e}),health:()=>$(`/health/detailed`),services:()=>$(`/api/services`),policies:()=>$(`/api/access/policies`),putPolicy:e=>$(`/api/access/policies`,{method:`PUT`,body:e}),deletePolicy:e=>$(`/api/access/policies`,{method:`DELETE`,body:e,parse:!1}),orgs:()=>$(`/api/orgs`),orgCreate:e=>$(`/api/orgs`,{method:`POST`,body:e}),org:e=>$(`/api/orgs/${encodeURIComponent(e)}`),orgWorkspaces:e=>$(`/api/orgs/${encodeURIComponent(e)}/workspaces`),createOrgWorkspace:(e,t)=>$(`/api/orgs/${encodeURIComponent(e)}/workspaces`,{method:`POST`,body:t}),orgAgents:e=>$(`/api/orgs/${encodeURIComponent(e)}/agents`),orgMembers:e=>$(`/api/orgs/${encodeURIComponent(e)}/members`),addOrgMember:(e,t)=>$(`/api/orgs/${encodeURIComponent(e)}/members`,{method:`POST`,body:t}),setOrgMember:(e,t,n)=>$(`/api/orgs/${encodeURIComponent(e)}/members/${encodeURIComponent(t)}`,{method:`PUT`,body:n}),removeOrgMember:(e,t,n)=>$(`/api/orgs/${encodeURIComponent(e)}/members/${encodeURIComponent(t)}`+Q({workspace:n}),{method:`DELETE`,parse:!1}),assignOrgAgent:(e,t)=>$(`/api/orgs/${encodeURIComponent(e)}/agents/${encodeURIComponent(t)}`,{method:`PUT`}),alerts:()=>$(`/api/alerts`),dismissAlert:e=>$(`/api/alerts/${e}/dismiss`,{method:`POST`,parse:!1}),identities:()=>$(`/api/identities`),identityCreate:e=>$(`/api/identities`,{method:`POST`,body:e}),identityCommand:(e,t,n)=>$(`/api/identities/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,{method:`POST`,body:n}),summary:()=>$(`/api/summary`),tasks:()=>$(`/api/tasks`),taskPage:async e=>{let t=await fa(`/api/tasks`+Q(e),{headers:{Accept:`application/json`},signal:AbortSignal.timeout(oa)});return{tasks:await t.json(),next:t.headers.get(`X-Next-Cursor`)}},taskMeta:()=>$(`/api/task-meta`),task:e=>$(`/api/tasks/${encodeURIComponent(e)}`),taskAttempts:e=>$(`/api/tasks/${encodeURIComponent(e)}/attempts`),taskChanges:(e,t)=>$(`/api/tasks/${encodeURIComponent(e)}/changes`+Q(t)),taskDebug:(e,t)=>$(`/api/tasks/${encodeURIComponent(e)}/debug`+Q(t)),taskAction:(e,t,n)=>$(`/api/tasks/${encodeURIComponent(e)}/action`,{method:`POST`,body:{action:t,...n}}),setup:()=>$(`/api/setup`),capabilities:()=>$(`/api/capabilities`),workflows:()=>$(`/api/workflows`),workflowEnabled:(e,t)=>$(`/api/workflows/${encodeURIComponent(e)}/enabled`,{method:`PUT`,body:{enabled:t},parse:!1}),checkRepository:e=>$(`/api/control-plane/resources/repository-policies/check`,{method:`POST`,body:e,timeoutMs:35e3}),repositories:()=>$(`/api/repositories`),workRequest:e=>$(`/api/work-requests`,{method:`POST`,body:e}),skills:()=>$(`/api/skills`),channels:()=>$(`/api/channels`),curators:()=>$(`/api/curators`),channelReload:e=>$(`/api/channels/${encodeURIComponent(e)}/reload`,{method:`POST`,body:{}}),config:()=>$(`/api/config`),logs:e=>$(`/api/logs`+Q(e)),taskLogs:(e,t)=>$(`/api/tasks/${encodeURIComponent(e)}/logs`+Q(t)),taskLogDownloadURL:(e,t)=>`/api/tasks/${encodeURIComponent(e)}/logs/download`+(t==null?``:`?attempt=${t}`),ver
Line truncated
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
.xterm{cursor:text;-webkit-user-select:none;user-select:none;position:relative}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{z-index:5;position:absolute;top:0}.xterm .xterm-helper-textarea{opacity:0;z-index:-5;white-space:nowrap;resize:none;border:0;width:0;height:0;margin:0;padding:0;position:absolute;top:0;left:-9999em;overflow:hidden}.xterm .composition-view{color:#fff;white-space:nowrap;z-index:1;background:#000;display:none;position:absolute}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{cursor:default;background-color:#000;position:absolute;inset:0;overflow-y:scroll}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;top:0;left:0}.xterm-char-measure-element{visibility:hidden;line-height:normal;display:inline-block;position:absolute;top:0;left:-9999em}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{z-index:10;color:#0000;pointer-events:none;position:absolute;inset:0}.xterm .xterm-accessibility-tree:not(.debug) ::selection{color:#0000}.xterm .xterm-accessibility-tree{-webkit-user-select:text;user-select:text;white-space:pre;font-family:monospace}.xterm .xterm-accessibility-tree>div{transform-origin:0;width:fit-content}.xterm .live-region{width:1px;height:1px;position:absolute;left:-9999px;overflow:hidden}.xterm-dim{opacity:1!important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{-webkit-text-decoration:underline double;text-decoration:underline double}.xterm-underline-3{-webkit-text-decoration:underline wavy;text-decoration:underline wavy}.xterm-underline-4{-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.xterm-underline-5{-webkit-text-decoration:underline dashed;text-decoration:underline dashed}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:underline overline}.xterm-overline.xterm-underline-2{-webkit-text-decoration:overline double underline;text-decoration:overline double underline}.xterm-overline.xterm-underline-3{-webkit-text-decoration:overline wavy underline;text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{-webkit-text-decoration:overline dotted underline;text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{-webkit-text-decoration:overline dashed underline;text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;pointer-events:none;position:absolute;top:0;right:0}.xterm-decoration-top{z-index:2;position:relative}.xterm .xterm-scrollable-element>.scrollbar{cursor:default}.xterm .xterm-scrollable-element>.scrollbar>.scra{cursor:pointer;font-size:11px!important}.xterm .xterm-scrollable-element>.visible{opacity:1;z-index:11;background:0 0;transition:opacity .1s linear}.xterm .xterm-scrollable-element>.invisible{opacity:0;pointer-events:none}.xterm .xterm-scrollable-element>.invisible.fade{transition:opacity .8s linear}.xterm .xterm-scrollable-element>.shadow{display:none;position:absolute}.xterm .xterm-scrollable-element>.shadow.top{width:100%;height:3px;box-shadow:var(--vscode-scrollbar-shadow,#000) 0 6px 6px -6px inset;display:block;top:0;left:3px}.xterm .xterm-scrollable-element>.shadow.left{width:3px;height:100%;box-shadow:var(--vscode-scrollbar-shadow,#000) 6px 0 6px -6px inset;display:block;top:3px;left:0}.xterm .xterm-scrollable-element>.shadow.top-left-corner{width:3px;height:3px;display:block;top:0;left:0}.xterm .xterm-scrollable-element>.shadow.top.left{box-shadow:var(--vscode-scrollbar-shadow,#000) 6px 0 6px -6px inset}.vue-flow{z-index:0;direction:ltr;width:100%;height:100%;position:relative;overflow:hidden}.vue-flow__container{width:100%;height:100%;position:absolute;top:0;left:0}.vue-flow__pane{z-index:1}.vue-flow__pane.draggable{cursor:grab}.vue-flow__pane.selection{cursor:pointer}.vue-flow__pane.dragging{cursor:grabbing}.vue-flow__transformationpane{transform-origin:0 0;z-index:2;pointer-events:none}.vue-flow__viewport{z-index:4;overflow:clip}.vue-flow__selection{z-index:6}.vue-flow__edge-labels{pointer-events:none;-webkit-user-select:none;user-select:none;width:100%;height:100%;position:absolute}.vue-flow__nodesselection-rect:focus,.vue-flow__nodesselection-rect:focus-visible{outline:none}.vue-flow .vue-flow__edges{pointer-events:none;overflow:visible}.vue-flow__edge-path,.vue-flow__connection-path{stroke:#b1b1b7;stroke-width:1px;fill:none}.vue-flow__edge{pointer-events:visibleStroke;cursor:pointer}.vue-flow__edge.animated path{stroke-dasharray:5;animation:.5s linear infinite dashdraw}.vue-flow__edge.animated path.vue-flow__edge-interaction{stroke-dasharLine truncated
|
||||
.xterm{cursor:text;-webkit-user-select:none;user-select:none;position:relative}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{z-index:5;position:absolute;top:0}.xterm .xterm-helper-textarea{opacity:0;z-index:-5;white-space:nowrap;resize:none;border:0;width:0;height:0;margin:0;padding:0;position:absolute;top:0;left:-9999em;overflow:hidden}.xterm .composition-view{color:#fff;white-space:nowrap;z-index:1;background:#000;display:none;position:absolute}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{cursor:default;background-color:#000;position:absolute;inset:0;overflow-y:scroll}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;top:0;left:0}.xterm-char-measure-element{visibility:hidden;line-height:normal;display:inline-block;position:absolute;top:0;left:-9999em}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{z-index:10;color:#0000;pointer-events:none;position:absolute;inset:0}.xterm .xterm-accessibility-tree:not(.debug) ::selection{color:#0000}.xterm .xterm-accessibility-tree{-webkit-user-select:text;user-select:text;white-space:pre;font-family:monospace}.xterm .xterm-accessibility-tree>div{transform-origin:0;width:fit-content}.xterm .live-region{width:1px;height:1px;position:absolute;left:-9999px;overflow:hidden}.xterm-dim{opacity:1!important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{-webkit-text-decoration:underline double;text-decoration:underline double}.xterm-underline-3{-webkit-text-decoration:underline wavy;text-decoration:underline wavy}.xterm-underline-4{-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.xterm-underline-5{-webkit-text-decoration:underline dashed;text-decoration:underline dashed}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:underline overline}.xterm-overline.xterm-underline-2{-webkit-text-decoration:overline double underline;text-decoration:overline double underline}.xterm-overline.xterm-underline-3{-webkit-text-decoration:overline wavy underline;text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{-webkit-text-decoration:overline dotted underline;text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{-webkit-text-decoration:overline dashed underline;text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;pointer-events:none;position:absolute;top:0;right:0}.xterm-decoration-top{z-index:2;position:relative}.xterm .xterm-scrollable-element>.scrollbar{cursor:default}.xterm .xterm-scrollable-element>.scrollbar>.scra{cursor:pointer;font-size:11px!important}.xterm .xterm-scrollable-element>.visible{opacity:1;z-index:11;background:0 0;transition:opacity .1s linear}.xterm .xterm-scrollable-element>.invisible{opacity:0;pointer-events:none}.xterm .xterm-scrollable-element>.invisible.fade{transition:opacity .8s linear}.xterm .xterm-scrollable-element>.shadow{display:none;position:absolute}.xterm .xterm-scrollable-element>.shadow.top{width:100%;height:3px;box-shadow:var(--vscode-scrollbar-shadow,#000) 0 6px 6px -6px inset;display:block;top:0;left:3px}.xterm .xterm-scrollable-element>.shadow.left{width:3px;height:100%;box-shadow:var(--vscode-scrollbar-shadow,#000) 6px 0 6px -6px inset;display:block;top:3px;left:0}.xterm .xterm-scrollable-element>.shadow.top-left-corner{width:3px;height:3px;display:block;top:0;left:0}.xterm .xterm-scrollable-element>.shadow.top.left{box-shadow:var(--vscode-scrollbar-shadow,#000) 6px 0 6px -6px inset}.vue-flow{z-index:0;direction:ltr;width:100%;height:100%;position:relative;overflow:hidden}.vue-flow__container{width:100%;height:100%;position:absolute;top:0;left:0}.vue-flow__pane{z-index:1}.vue-flow__pane.draggable{cursor:grab}.vue-flow__pane.selection{cursor:pointer}.vue-flow__pane.dragging{cursor:grabbing}.vue-flow__transformationpane{transform-origin:0 0;z-index:2;pointer-events:none}.vue-flow__viewport{z-index:4;overflow:clip}.vue-flow__selection{z-index:6}.vue-flow__edge-labels{pointer-events:none;-webkit-user-select:none;user-select:none;width:100%;height:100%;position:absolute}.vue-flow__nodesselection-rect:focus,.vue-flow__nodesselection-rect:focus-visible{outline:none}.vue-flow .vue-flow__edges{pointer-events:none;overflow:visible}.vue-flow__edge-path,.vue-flow__connection-path{stroke:#b1b1b7;stroke-width:1px;fill:none}.vue-flow__edge{pointer-events:visibleStroke;cursor:pointer}.vue-flow__edge.animated path{stroke-dasharray:5;animation:.5s linear infinite dashdraw}.vue-flow__edge.animated path.vue-flow__edge-interaction{stroke-dasharLine truncated
|
||||
Vendored
+82
-81
@@ -1,79 +1,79 @@
|
||||
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/AccountPage.js","assets/PageHeader.js","assets/api.js","assets/AuthenticationPage.js","assets/CredentialBindingsPage.js","assets/CardAccordion.js","assets/pinia.js","assets/createLucideIcon.js","assets/alert.js","assets/PlaybooksPage.js","assets/AgentProfilesPage.js","assets/HarnessPage.js","assets/NotFoundPage.js"])))=>i.map(i=>d[i]);
|
||||
import{$ as e,A as t,B as n,C as r,D as i,E as a,F as o,G as s,H as c,I as l,J as u,K as d,L as f,M as p,N as m,O as h,P as g,Q as _,R as v,S as y,T as b,U as x,V as S,W as C,X as w,Y as ee,Z as te,_ as T,a as E,at as ne,b as re,c as ie,ct as ae,d as D,dt as O,et as oe,f as se,ft as ce,g as le,h as ue,i as de,it as fe,j as pe,k as me,l as he,lt as ge,m as _e,n as ve,nt as ye,o as be,ot as xe,p as Se,q as Ce,r as we,rt as Te,s as Ee,st as De,t as Oe,tt as ke,u as Ae,ut as je,v as Me,w as Ne,x as Pe,y as Fe,z as Ie}from"./CardAccordion.js";import{$ as Le,A as k,B as Re,C as ze,Ct as Be,D as A,Dn as Ve,En as He,Ft as Ue,It as We,Jt as j,Kt as Ge,Mt as Ke,O as M,Pt as qe,Qn as N,R as Je,Rt as Ye,Sn as Xe,St as P,Tn as Ze,Tt as Qe,Ut as F,V as $e,Wt as et,X as tt,Xt as nt,Y as rt,Zt as it,_ as I,_n as at,_t as ot,an as st,at as ct,b as L,bn as lt,d as ut,dn as dt,er as ft,et as pt,ht as R,it as mt,kn as z,lt as ht,mn as gt,nr as B,nt as _t,on as vt,pn as yt,pt as bt,rn as xt,s as V,t as St,tr as Ct,tt as H,v as U,vn as wt,wn as Tt,x as W,xt as G,y as K,yn as q,zt as Et}from"./PageHeader.js";import{B as Dt,H as Ot,U as kt,V as At,W as jt,_ as Mt,b as Nt,c as Pt,d as Ft,f as It,g as J,h as Y,l as Lt,m as Rt,n as X,o as zt,p as Bt,r as Vt,t as Ht,u as Ut,v as Wt,w as Gt,x as Kt}from"./api.js";import{n as qt,r as Jt,t as Yt}from"./pinia.js";import{t as Xt}from"./createLucideIcon.js";import{a as Zt,i as Qt,n as $t,r as en,t as tn}from"./alert.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)}})();function nn(e,t,n){let r=e.findIndex(e=>ce(e,t)),i=e.findIndex(e=>ce(e,n));if(r===-1||i===-1)return[];let[a,o]=[r,i].sort((e,t)=>e-t);return e.slice(a,o+1)}function rn(e,t=-1/0,n=1/0){return Math.min(n,Math.max(t,e))}function an(e,t){let n=e,r=t.toString(),i=r.indexOf(`.`),a=i>=0?r.length-i:0;if(a>0){let e=10**a;n=Math.round(n*e)/e}return n}function on(e,t,n,r){t=Number(t),n=Number(n);let i=(e-(Number.isNaN(t)?0:t))%r,a=an(Math.abs(i)*2>=r?e+Math.sign(i)*(r-Math.abs(i)):e-i,r);return Number.isNaN(t)?!Number.isNaN(n)&&a>n&&(a=Math.floor(an(n/r,r))*r):a<t?a=t:!Number.isNaN(n)&&a>n&&(a=t+Math.floor(an((n-t)/r,r))*r),a=an(a,r),a}var sn=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Bopomofo}]/u,cn=/android/i;function ln(){return typeof navigator<`u`&&cn.test(navigator.userAgent)}function un(e){let t=q(!1),n=q(!0),r=q(!1),i=I(()=>t.value&&n.value);function a(){t.value=!0,n.value=!0,r.value=!1}function o(e){e.data&&(sn.test(e.data)?(n.value=!0,r.value=!0):ln()&&!r.value&&(n.value=!1))}function s(n){_t(()=>{t.value=!1,e?.(n)})}return{isComposing:t,shouldDeferInput:i,handleCompositionStart:a,handleCompositionUpdate:o,handleCompositionEnd:s}}function dn(e){let t=I(()=>z(e)),n=I(()=>new Intl.Collator(`en`,{usage:`search`,...t.value}));return{startsWith:(e,t)=>t.length===0||(e=e.normalize(`NFC`),t=t.normalize(`NFC`),n.value.compare(e.slice(0,t.length),t)===0),endsWith:(e,t)=>t.length===0||(e=e.normalize(`NFC`),t=t.normalize(`NFC`),n.value.compare(e.slice(-t.length),t)===0),contains:(e,t)=>{if(t.length===0)return!0;if(e=e.normalize(`NFC`),t=t.normalize(`NFC`),t.length>e.length)return!1;let r=n.value.compare;if(e.includes(t))return!0;let i=t.length;for(let n=0;n+i<=e.length;n++)if(r(t,e.slice(n,n+i))===0)return!0;return!1}}}function fn(e){return I(()=>!Ve(e)||!!u(e)?.closest(`form`))}function pn(){let e=Je()?.vnode?.scopeId;return e?{[e]:``}:{}}function mn(t,n){let r=fe(!1,300);ne(()=>{r.value=!1});let i=q(null),a=e();function o(){i.value=null,r.value=!1}function s(e,t){if(!t)return;let n=e.currentTarget,a={x:e.clientX,y:e.clientY},o=gn(a,hn(a,n.getBoundingClientRect()),1),s=_n(t.getBoundingClientRect()),c=yn([...o,...s]);i.value=c,r.value=!0}return et(e=>{if(t.value&&n.value){let r=t.value,i=n.value,a=e=>s(e,i),o=e=>s(e,r);r.addEventListener(`pointerleave`,a),i.addEventListener(`pointerleave`,o),e(()=>{r.removeEventListener(`pointerleave`,a),i.removeEventListener(`pointerleave`,o)})}}),et(e=>{if(i.value){let r=e=>{if(!i.value||!(e.target instanceof Element))return;let r=e.target,s={x:e.clientX,y:e.clientY},c=t.value?.contains(r)||n.value?.contains(r),l=!vn(s,i.value),u=!!r.closest(`[data-grace-area-trigger]`);c?o():(l||u)&&(o(),a.trigger())},s=t.value?.ownerDocument;s?.addEventListener(`pointermove`,r),e(()=>s?.removeEventListener(`pointermove`,r))}}),{isPointerInTransit:r,onPointerExit:a.on}}fuLine truncated
|
||||
import{$ as e,A as t,B as n,C as r,D as i,E as a,F as o,G as s,H as c,I as l,J as u,K as d,L as f,M as p,N as m,O as h,P as g,Q as _,R as v,S as y,T as b,U as ee,V as x,W as S,X as C,Y as te,Z as ne,_ as w,a as T,at as re,b as E,c as ie,ct as ae,d as D,dt as O,et as oe,f as se,ft as ce,g as le,h as ue,i as de,it as fe,j as pe,k as me,l as he,lt as ge,m as _e,n as ve,nt as ye,o as be,ot as xe,p as Se,q as Ce,r as we,rt as Te,s as Ee,st as De,t as Oe,tt as ke,u as Ae,ut as je,v as Me,w as Ne,x as Pe,y as Fe,z as Ie}from"./CardAccordion.js";import{$ as Le,A as k,B as Re,C as ze,Ct as Be,D as A,Dn as Ve,En as He,Ft as Ue,It as We,Jt as j,Kt as Ge,Mt as Ke,O as M,Pt as qe,Qn as N,R as Je,Rt as Ye,Sn as Xe,St as P,Tn as Ze,Tt as Qe,Ut as F,V as $e,Wt as et,X as tt,Xt as nt,Y as rt,Zt as it,_ as I,_n as at,_t as ot,an as st,at as ct,b as L,bn as lt,d as ut,dn as dt,er as ft,et as pt,ht as R,it as mt,kn as z,lt as ht,mn as gt,nr as B,nt as _t,on as vt,pn as yt,pt as bt,rn as xt,s as V,t as St,tr as Ct,tt as H,v as U,vn as wt,wn as Tt,x as W,xt as G,y as K,yn as q,zt as Et}from"./PageHeader.js";import{C as Dt,E as Ot,G as kt,H as At,K as jt,S as Mt,U as Nt,W as Pt,_ as J,b as Ft,c as It,d as Lt,f as Rt,g as zt,h as Bt,l as Vt,m as Ht,n as Y,o as Ut,p as Wt,r as Gt,t as Kt,u as qt,v as X,y as Jt}from"./api.js";import{n as Yt,r as Xt,t as Zt}from"./pinia.js";import{t as Qt}from"./createLucideIcon.js";import{a as $t,i as en,n as tn,r as nn,t as rn}from"./alert.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)}})();function an(e,t,n){let r=e.findIndex(e=>ce(e,t)),i=e.findIndex(e=>ce(e,n));if(r===-1||i===-1)return[];let[a,o]=[r,i].sort((e,t)=>e-t);return e.slice(a,o+1)}function on(e,t=-1/0,n=1/0){return Math.min(n,Math.max(t,e))}function sn(e,t){let n=e,r=t.toString(),i=r.indexOf(`.`),a=i>=0?r.length-i:0;if(a>0){let e=10**a;n=Math.round(n*e)/e}return n}function cn(e,t,n,r){t=Number(t),n=Number(n);let i=(e-(Number.isNaN(t)?0:t))%r,a=sn(Math.abs(i)*2>=r?e+Math.sign(i)*(r-Math.abs(i)):e-i,r);return Number.isNaN(t)?!Number.isNaN(n)&&a>n&&(a=Math.floor(sn(n/r,r))*r):a<t?a=t:!Number.isNaN(n)&&a>n&&(a=t+Math.floor(sn((n-t)/r,r))*r),a=sn(a,r),a}var ln=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Bopomofo}]/u,un=/android/i;function dn(){return typeof navigator<`u`&&un.test(navigator.userAgent)}function fn(e){let t=q(!1),n=q(!0),r=q(!1),i=I(()=>t.value&&n.value);function a(){t.value=!0,n.value=!0,r.value=!1}function o(e){e.data&&(ln.test(e.data)?(n.value=!0,r.value=!0):dn()&&!r.value&&(n.value=!1))}function s(n){_t(()=>{t.value=!1,e?.(n)})}return{isComposing:t,shouldDeferInput:i,handleCompositionStart:a,handleCompositionUpdate:o,handleCompositionEnd:s}}function pn(e){let t=I(()=>z(e)),n=I(()=>new Intl.Collator(`en`,{usage:`search`,...t.value}));return{startsWith:(e,t)=>t.length===0||(e=e.normalize(`NFC`),t=t.normalize(`NFC`),n.value.compare(e.slice(0,t.length),t)===0),endsWith:(e,t)=>t.length===0||(e=e.normalize(`NFC`),t=t.normalize(`NFC`),n.value.compare(e.slice(-t.length),t)===0),contains:(e,t)=>{if(t.length===0)return!0;if(e=e.normalize(`NFC`),t=t.normalize(`NFC`),t.length>e.length)return!1;let r=n.value.compare;if(e.includes(t))return!0;let i=t.length;for(let n=0;n+i<=e.length;n++)if(r(t,e.slice(n,n+i))===0)return!0;return!1}}}function mn(e){return I(()=>!Ve(e)||!!u(e)?.closest(`form`))}function hn(){let e=Je()?.vnode?.scopeId;return e?{[e]:``}:{}}function gn(t,n){let r=fe(!1,300);re(()=>{r.value=!1});let i=q(null),a=e();function o(){i.value=null,r.value=!1}function s(e,t){if(!t)return;let n=e.currentTarget,a={x:e.clientX,y:e.clientY},o=vn(a,_n(a,n.getBoundingClientRect()),1),s=yn(t.getBoundingClientRect()),c=xn([...o,...s]);i.value=c,r.value=!0}return et(e=>{if(t.value&&n.value){let r=t.value,i=n.value,a=e=>s(e,i),o=e=>s(e,r);r.addEventListener(`pointerleave`,a),i.addEventListener(`pointerleave`,o),e(()=>{r.removeEventListener(`pointerleave`,a),i.removeEventListener(`pointerleave`,o)})}}),et(e=>{if(i.value){let r=e=>{if(!i.value||!(e.target instanceof Element))return;let r=e.target,s={x:e.clientX,y:e.clientY},c=t.value?.contains(r)||n.value?.contains(r),l=!bn(s,i.value),u=!!r.closest(`[data-grace-area-trigger]`);c?o():(l||u)&&(o(),a.trigger())},s=t.value?.ownerDocument;s?.addEventListener(`pointermove`,r),e(()=>s?.removeEventListener(`pointermove`,r))}}),{isPointerInTransit:r,onPoinLine 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&&(zc.value=n.session_id),n.type===`delta`&&(o+=n.text,Wc.value=Wc.value?{...Wc.value,text:o}:null),(n.type===`tool`||n.type===`navigate`)&&(a=[...a,n],Wc.value=Wc.value?{...Wc.value,tools:a}:null),n.type===`ask`&&n.ask&&(clearTimeout(l),Wc.value=Wc.value?{...Wc.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`);Bc.value=[...Bc.value,{from:`assistant`,text:o,tool_calls:a}],Wc.value=null,Hc.value=`Ready`,await il()}catch(e){let t=e;t.name===`AbortError`&&!c?(Wc.value={text:`Turn stopped.`,tools:a,isError:!1,turn:r,isRetry:i},Hc.value=`Stopped`):(Wc.value={text:`Unable to complete that turn: ${t.message||t}`,tools:a,isError:!0,turn:r?Mc(r):void 0,isRetry:i},Hc.value=`Error. Retry available.`)}finally{clearTimeout(l),Ic=null,nl=null,Uc.value=!1}}function gl(){Hc.value=`Stopping…`,zc.value&&X.chatCancel(zc.value).catch(()=>{}),rl()}function _l(){ht(()=>{il().catch(e=>{Hc.value=e.message||`Chat unavailable`})}),bt(()=>{rl()})}async function vl(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 hl({textOverride:`🎤 Voice message`,voice:{data:btoa(n),mime_type:e.type||`audio/webm`}})}var yl=[`aria-label`,`title`,`aria-expanded`,`aria-controls`],bl=k({__name:`ChatFab`,props:{open:{type:Boolean}},emits:[`toggle`],setup(e,{emit:t}){let n=t;function r(e){return J(`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)=>(R(),W(`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":z(Pc),onClick:i[0]||=e=>n(`toggle`)},[U(`span`,{"aria-hidden":`true`,class:N(r(!e.open))},[M(z(Ys),{size:22})],2),U(`span`,{"aria-hidden":`true`,class:N(r(e.open))},[M(z(Sc),{size:22})],2)],8,yl))}}),xl=k({__name:`Select`,props:{open:{type:Boolean},defaultOpen:{type:Boolean},defaultValue:{},modelValue:{},nullableValue:{},by:{type:[String,Function]},dir:{},multiple:{type:Boolean},autocomplete:{},disabled:{type:Boolean},name:{},required:{type:Boolean}},emits:[`update:modelValue`,`update:open`],setup(e,{emit:t}){let n=v(e,t);return(e,t)=>(R(),K(z(La),H({"data-slot":`select`},z(n)),{default:j(t=>[P(e.$slots,`default`,ft(Re(t)))]),_:3},16))}}),Sl=k({inheritAttrs:!1,__name:`SelectContent`,props:{forceMount:{type:Boolean},position:{default:`item-aligned`},bodyLock:{type:Boolean},loop:{type:Boolean},memoDependencies:{},side:{},sideOffset:{},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:[`closeAutoFocus`,`escapeKeyDown`,`pointerDownOutside`],setup(e,{emit:t}){let n=e,r=t,i=It(n,`class`),a=v(i,r);return(t,r)=>(R(),K(z(io),null,{default:j(()=>[M(z(Ya),H({"data-slot":`select-content`,"data-align-trigger":e.position===`item-aligned`},{...t.$attrs,...z(a)},{class:z(J)(`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 min-w-36 rounded-lg shadow-md ring-1 duration-100 data-[side=inline-start]:slide-in-from-right-2 data-[side=inline-end]:slide-in-from-left-2 cn-menu-translucent relative z-50 max-h-(--reka-select-content-available-height) origin-(--reka-select-content-transform-origin) overflow-x-hidden overflow-y-auto data-[align-trigger=true]:animate-none`,e.position===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,n.class)}),{default:j(()=>[M(z(Dl)),M(z(uo),{"data-position":e.position,class:N(z(J)(`data-[position=popper]:h-(--reka-select-trigger-height) data-[position=popper]:w-full data-[position=popper]:min-w-(--reka-select-trigger-width)`))},{default:j(()=>[P(t.$slots,`default`)]),_:3
Line truncated
|
||||
`),r=[],i=null,a=null,o=()=>{r.length&&(t.push({kind:`p`,inline:bd(r.join(` `))}),r=[])},s=()=>{i&&=(t.push({kind:i.tag,items:i.items.map(e=>bd(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=Sd(c),u=e+1<n.length?Sd(n[e+1]):null;if(l&&u&&Cd(u)&&l.length===u.length){o(),s();let r=[];for(e+=2;e<n.length;e++){let t=Sd(n[e]);if(!t||t.length!==l.length){e--;break}r.push(t)}t.push({kind:`table`,head:l.map(e=>bd(e)),rows:r.map(e=>e.map(e=>bd(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:bd(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:bd(c.replace(/^>\s?/,``))})):r.push(c)}return o(),s(),a&&t.push({kind:`pre`,code:a.join(`
|
||||
`)}),t}function Sd(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 Cd(e){return e.every(e=>/^:?-{3,}:?$/.test(e))}var wd={class:`[overflow-wrap:anywhere]`},Td={key:0,class:`my-2 overflow-auto rounded-md border border-border bg-background/60 p-3`},Ed={class:`font-mono text-[0.85em]`},Dd={key:1,class:`my-3 w-full border-collapse text-[0.92em]`},Od={key:2,class:`my-2 border-l-[3px] border-primary pl-3 text-fg-muted`},kd={key:3,class:`mt-1 mb-2 text-xl leading-tight font-semibold tracking-[-0.02em]`},Ad={key:4,class:`mt-1 mb-2 text-lg leading-tight font-semibold tracking-[-0.02em]`},jd={key:5,class:`mt-1 mb-2 text-base leading-tight font-semibold tracking-[-0.02em]`},Md={key:6,class:`my-2.5 flex list-disc flex-col gap-1 pl-5`},Nd={key:7,class:`my-2.5 flex list-decimal flex-col gap-1 pl-5`},Pd={key:8,class:`mb-2.5 last:mb-0`},Fd=k({__name:`ChatMarkdown`,props:{text:{}},setup(e){let t=e,n=I(()=>xd(t.text));return(e,t)=>(R(),W(`div`,wd,[(R(!0),W(V,null,G(n.value,(e,t)=>(R(),W(V,{key:t},[e.kind===`pre`?(R(),W(`pre`,Td,[U(`code`,Ed,B(e.code),1)])):e.kind===`table`?(R(),W(`table`,Dd,[U(`thead`,null,[U(`tr`,null,[(R(!0),W(V,null,G(e.head,(e,t)=>(R(),W(`th`,{key:t,class:`border border-border bg-muted px-2 py-1.5 text-left font-semibold`},[M(vd,{inline:e},null,8,[`inline`])]))),128))])]),U(`tbody`,null,[(R(!0),W(V,null,G(e.rows,(e,t)=>(R(),W(`tr`,{key:t},[(R(!0),W(V,null,G(e,(e,t)=>(R(),W(`td`,{key:t,class:`border border-border px-2 py-1.5 text-left`},[M(vd,{inline:e},null,8,[`inline`])]))),128))]))),128))])])):e.kind===`blockquote`?(R(),W(`blockquote`,Od,[M(vd,{inline:e.inline},null,8,[`inline`])])):e.kind===`h1`?(R(),W(`h1`,kd,[M(vd,{inline:e.inline},null,8,[`inline`])])):e.kind===`h2`?(R(),W(`h2`,Ad,[M(vd,{inline:e.inline},null,8,[`inline`])])):e.kind===`h3`?(R(),W(`h3`,jd,[M(vd,{inline:e.inline},null,8,[`inline`])])):e.kind===`ul`?(R(),W(`ul`,Md,[(R(!0),W(V,null,G(e.items,(e,t)=>(R(),W(`li`,{key:t},[M(vd,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`ol`?(R(),W(`ol`,Nd,[(R(!0),W(V,null,G(e.items,(e,t)=>(R(),W(`li`,{key:t},[M(vd,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`p`?(R(),W(`p`,Pd,[M(vd,{inline:e.inline},null,8,[`inline`])])):L(``,!0)],64))),128))]))}}),Id={class:`truncate`},Ld=k({__name:`ChatNavChip`,props:{path:{},label:{}},setup(e){return(t,n)=>{let r=Be(`RouterLink`);return R(),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:j(()=>[M(z(Ss),{"aria-hidden":`true`,class:`size-3.5 shrink-0`}),U(`span`,Id,B(e.label||e.path),1)]),_:1},8,[`to`,`title`])}}}),Rd={key:1,class:`flex items-baseline gap-1.5 [overflow-wrap:anywhere]`},zd={class:`font-semibold text-foreground`},Bd={key:0,class:`font-mono text-[0.95em] text-fg-subtle`},Vd=k({__name:`ChatToolCall`,props:{tool:{},streaming:{type:Boolean}},setup(e){let t=e,n=I(()=>t.tool.name||t.tool.Name||t.tool.tool||`tool`),r=I(()=>t.tool.parameters||t.tool.Parameters||``),i=I(()=>!!(t.tool.err||t.tool.Err||t.tool.failed)),a=I(()=>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?(R(),K(Ld,{key:0,path:e.tool.path,label:e.tool.label},null,8,[`path`,`label`])):(R(),W(`div`,Rd,[M(z(xc),{"aria-hidden":`true`,class:`size-3.5 shrink-0 self-center text-fg-subtle`}),U(`span`,zd,B(n.value),1),r.value?(R(),W(`code`,Bd,B(r.value),1)):L(``,!0),U(`span`,{class:N(z(J)(`text-fg-muted`,i.value&&`text-danger`))},B(a.value),3)]))}}),Hd={key:0,class:`mb-2 grid gap-0.5 text-xs`},Ud={key:1,class:`mb-2 flex flex-wrap gap-1.5`},Wd={key:3,class:`whitespace-pre-wrap`},Gd=k({__name:`ChatBubble`,props:{text:{},tools:{default:()=>[]},media:{default:()=>[]},assistant:{type:Boolean,default:!1},streaming:{type:Boolean,default:!1}},setup(e){return(t,n)=>(R(),W(`div`,{class:N([`flex`,e.assistant?`justify-start`:`justify-end`])},[U(`div`,{class:N(z(J)(`max-w-[min(78ch,86%)] rounded-[0.85rem] px-4 py-3 leading-normal [overflow-wrap:anywhere]`,e.assistant?`bg-muted`:`bg-primary/15`))},[e.assistant&&e.tools.length?(R(),W(`div`,Hd,[(R(!0),W(V,null,G(e.tools,(t,n)=>(R(),K(Vd,{key:n,tool:t,streaming:e.streaming},null,8,[`tool`,`streaming`]))),128))])):L(``,!0),e.media.length?(R(),W(`div`,Ud,[(R(!0),W(V,null,G(e.media,(e,t)=>(R(),K(dd,{key:t,attachment:e},null,8,[`attachment`]))),128))])):L(``,!0),e.assistant?(R(),K(Fd,{key:2,text:e.text},null,8,[`text`])):(R(),W(`div`,Wd,B(e.text),1)),P(t.$slots,`default`)],2)],2))}}),Kd={class:`text-sm`},qd={key:0,class:`mt-1 text-fg-muted`},Jd={key:1,class:`mt-2 flex flex-wrap gap-2`},Yd=k({__name:`ChatChooseCard`,props:{choose:{}}
Line truncated
|
||||
`).map(e=>e.trim()).find(Boolean)||``,i=r.length>n_?`${r.slice(0,n_).trimEnd()}…`:r;return{text:i,full:n,truncated:i!==n}}function i_(e){return String(e||`event`).replaceAll(`_`,` `).replace(/\b\w/g,e=>e.toUpperCase())}function a_(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 o_(e){let t=Number(e);return!Number.isFinite(t)||t<=0?``:t.toLocaleString(`en-US`)}function s_(e){return typeof e==`string`?e:``}function c_(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=a_(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,s_(t.error),s_(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:[s_(t.previous_stage)&&`after ${s_(t.previous_stage)}`,s_(t.previous_reason)].filter(Boolean).join(`: `)||e.detail||``}}if(e.kind===`agent_finish`){let r=o_(t.iterations),i=o_(t.tokens),a=Number(t.cached_tokens)||0,o=o_((Number(t.prompt_tokens)||0)-a),s=o_(t.completion_tokens),c=o_(t.cached_tokens),l=[r&&`${r} iterations`,i&&`${i} tokens`,o&&`${o} fresh prompt`,s&&`${s} completion`,c&&`${c} cached`,s_(t.model)].filter(Boolean);return{title:`Agent ${s_(t.status)||`finished`}: ${n}`,detail:l.join(` · `)||e.detail||``}}if(e.kind===`remediation_round`){let e=Number(t.of),n=s_(t.author);return{title:`Remediation ${s_(t.round)}${e>0?` of ${e}`:``}`,detail:[n&&`answers ${n}'s review`,t.review_id?`#${s_(t.review_id)}`:``].filter(Boolean).join(` `)}}if(e.kind===`review_approved`){let e=s_(t.pr_number);return{title:`Pull request approved`,detail:[s_(t.author),e&&`#${e}`].filter(Boolean).join(` · `)}}if(e.kind===`step_retried`)return{title:`Attempt ${s_(t.attempt)} of ${s_(t.of)} failed: ${e.stage||`step`}`,detail:s_(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=s_(t.source),n=s_(t.capture_id),r=[{label:`binding ${s_(t.binding_name)||s_(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 ${s_(t.captured_after)}`:``].filter(Boolean).join(` · `)}}return{title:i_(e.kind||e.type),detail:e.detail||``}}var l_=[`title`],u_=k({__name:`ActivityRow`,props:{event:{}},emits:[`open`],setup(e,{emit:t}){let n=t_();n.watchIdentities();let r=e,i=t,a=Wg(),o=I(()=>a.taskIDFor(r.event)),s=I(()=>r_(r.event,n.identityName));function c(){o.value>0&&i(`open`,o.value)}let l=I(()=>r.event.at?Cg(r.event.at):`—`);return(e,t)=>(R(),K(z(Zg),{class:N(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:[kt(jt(c,[`prevent`]),[`enter`]),kt(jt(c,[`prevent`]),[`space`])]},{default:j(()=>[M(z(Q),{class:`font-medium`},{default:j(()=>[A(B(z(c_)({...r.event,at:void 0,detail:void 0}).title),1)]),_:1}),M(z(Q),{class:`font-mono`},{default:j(()=>[A(B(o.value>0?`#${o.value}`:`—`),1)]),_:1}),M(z(Q),{class:`w-[55%] max-w-0`},{default:j(()=>[U(`span`,{class:`block truncate`,title:s.value.truncated?s.value.full:void 0},B(s.value.text),9,l_)]),_:1}),M(z(Q),null,{default:j(()=>[A(B(l.value),1)]),_:1})]),_:1},8,[`class`,`role`,`tabindex`,`title`,`onKeydown`]))}}),d_=[{value:`all`,label:`All`},{value:`tasks`,label:`Tasks`},{value:`system`,label:`System`}];function f_(e){return(Number(e?.task_id)||0)>0}function p_(e,t){return t===`tasks`?f_(e):t!==`system`||!f_(e)}function m_(e,t){return e.filter(e=>p_(e,t))}function h_(e,t){return e>0?``:t===`all`?`Waiting for activity`:t===`tasks`?`No task events yet`:`No system events yet`}function g_(e,t){return`${e}:${t??0}`}function __(e){let t=[];for(let n of e){let e=n.kind||n.type||`event`,r=Number(n.task_id)||0,i=g_(r_(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 v_={key:0,class:`font-normal text-fg-subtle`},y_={role:`region`,"aria-label":`Activity`,"ari
Line truncated
|
||||
`,1)[0]??``;return t.length>80?`${t.slice(0,79)}…`:t}function Iv(e){return(e?.merged||0)+(e?.completed||0)}function Lv(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 Rv(e,t){return e.filter(e=>e.required&&!(t[e.name]??``).trim()).map(e=>e.name)}function zv(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 Bv(e,t){let n={};for(let r of e){let e=t[r.name];e!==void 0&&e!==``&&(n[r.name]=zv(e,r.type))}return n}var Vv=[`onKeydown`],Hv={key:0,class:`text-sm text-danger`,role:`alert`},Uv={key:1,class:`grid gap-1.5`},Wv=[`for`],Gv={key:0,class:`font-normal text-fg-subtle`},Kv=[`id`],qv=[`value`],Jv={key:0,class:`text-xs text-fg-subtle`},Yv={key:2,class:`grid gap-1.5`},Xv=[`id`],Zv={class:`block truncate font-mono text-[13px] font-medium`},Qv={class:`block text-xs text-fg-subtle`},$v={key:0,class:`text-xs text-fg-subtle`},ey={key:3,class:`grid gap-3`},ty=[`for`],ny={class:`font-mono`},ry={key:0,class:`text-fg-subtle`},oee={class:`text-xs text-fg-subtle`},iy={class:`grid gap-1.5`},ay=[`for`],oy={class:`grid gap-1.5`},sy=[`for`],cy={key:4,class:`text-sm text-danger`,role:`alert`},ly={class:`flex items-center gap-2 border-t border-border pt-4`},uy={class:`mr-auto text-xs text-fg-subtle`},dy=k({__name:`NewTaskForm`,props:{workflow:{},draft:{},initialWorkflow:{},initialInstructions:{}},emits:[`started`,`cancel`],setup(e,{emit:t}){let n=e,r=t,i=Ue(),a=q([]),o=q([]),s=q([]),c=q(``);ht(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(Fv(d.value)),p=q({});et(()=>{!u.value&&a.value[0]&&(u.value=a.value[0].id)});let m=I(()=>a.value.find(e=>e.id===u.value)),h=I(()=>Lv(m.value)),g=I(()=>Rv(h.value,p.value)),_=I(()=>m.value?.repository??`required`),v=I(()=>_.value!==`optional`&&_.value!==`none`),y=e=>o.value.find(t=>t.workflow===e),b=q(!1),x=q(``),S=I(()=>!(!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:Bv(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)=>(R(),W(`form`,{class:`grid gap-5`,onSubmit:jt(C,[`prevent`]),onKeydown:[kt(jt(C,[`meta`,`prevent`]),[`enter`]),kt(jt(C,[`ctrl`,`prevent`]),[`enter`])]},[c.value?(R(),W(`p`,Hv,B(c.value),1)):L(``,!0),_.value===`none`?L(``,!0):(R(),W(`div`,Uv,[U(`label`,{for:`${z(i)}-repo`,class:`text-[13px] font-medium`},[t[5]||=A(`Repository`,-1),v.value?L(``,!0):(R(),W(`span`,Gv,` (optional)`))],8,Wv),M(z(Z),{id:`${z(i)}-repo`,modelValue:l.value,"onUpdate:modelValue":t[0]||=e=>l.value=e,class:`font-mono`,placeholder:`owner/repository`,list:`${z(i)}-repos`,required:v.value},null,8,[`id`,`modelValue`,`list`,`required`]),U(`datalist`,{id:`${z(i)}-repos`},[(R(!0),W(V,null,G(s.value,e=>(R(),W(`option`,{key:e,value:e},null,8,qv))),128))],8,Kv),s.value.length?(R(),W(`p`,Jv,[t[6]||=A(`Configured: `,-1),(R(!0),W(V,null,G(s.value,e=>(R(),K(z(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:j(()=>[A(B(e),1)]),_:2},1032,[`onClick`]))),128))])):L(``,!0)])),n.workflow?L(``,!0):(R(),W(`div`,Yv,[U(`span`,{id:`${z(i)}-wf`,class:`text-[13px] font-medium`},`Workflow`,8,Xv),M(z(Ea),{modelValue:u.value,"onUpdate:modelValue":t[1]||=e=>u.value=e,"aria-labelledby":`${z(i)}-wf`,class:`grid grid-cols-1 gap-2 sm:grid-cols-3`,loop:``},{default:j(()=>[(R(!0),W(V,null,G(a.value,e=>(R(),K(z(Oa),{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:j(()=>[U(`span`,Zv,B(e.name||e.id),1),U(`span`,Qv,[A(B(y(e.id)?.runs||0)+` runs`,1),y(e.id)?.runs?(R(),W(V,{key:0},[A(` · `+B(Math.round(z(Iv)(y(e.id))/(y(e.id)?.runs||1)*100))+`% delivered`,1)],64)):L(``,!0)])]),_:2},1032,[`value`]))),128))]),_:1},8,[`modelValue`,`aria-labelledby`]),!a.value.length&&!c.value?(R(),W(`p`,$v,`No enabled workflows.`)):L(``,!0)])),h.value.length?(R(),W(`div`,ey,[(R(!0),W(V,null,G(h.value,e=>(R(),W(`div`,{key:e.name,class:`grid gap-1.5`},[U(`label`,{for:`${z(i)}-input-${e.name}`,class:`text-[13px] font-medium`},[U(`span`,ny,B(e.name),1),e.required?(R(),W(`span`,ry,` · required`)):L(``,!0)],8,ty),M(z(Z),{id:`${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 ky(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 Ay(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 jy(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 My(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 Ny=q([]),Py=q([]),Fy=q(!0),Iy=q(null),Ly=q(null),Ry=q(!1),zy=q(null);async function By(){try{let e=await X.eventTypes(Dy().workspace);Fy.value=e.enabled!==!1,Ny.value=e.event_types||[],Py.value=e.proposals||[],Iy.value=null}catch(e){Iy.value=e.message||String(e)}}function Vy(e){return{headers:(e.headers||[]).map(e=>({...e})),payload:(e.payload||[]).map(e=>({...e}))}}function Hy(e){zy.value=null,Ly.value=e}function Uy(e){let t=Zy.value.find(t=>String(t.id)===e.sample_id);Hy({mode:`proposal`,id:null,source:e.source,name:``,rule:Vy(e.rule),headersText:``,body:t?.body||``,exampleHeaders:e.headers||{}})}function Wy(e=``){Hy({mode:`paste`,id:null,source:e,name:``,rule:{headers:[],payload:[]},headersText:``,body:``,exampleHeaders:{}})}function Gy(e){Hy({mode:`edit`,id:e.id,source:e.source,name:e.name,rule:Vy(e.rule),headersText:``,body:``,exampleHeaders:{}})}function Ky(){Ly.value=null}async function qy(){let e=Ly.value;if(e){Ry.value=!0;try{if(e.mode===`edit`&&e.id)await X.eventTypeUpdate(e.id,{name:e.name,rule:My(e.rule)});else{let t=e.mode===`paste`?Oy(e.headersText):e.exampleHeaders;await X.eventTypeCreate({source:e.source,name:e.name,rule:e.mode===`paste`?void 0:My(e.rule),example:{headers:t,body:e.body}})}Ly.value=null,await By()}catch(e){zy.value=e.message||String(e)}finally{Ry.value=!1}}}var Jy=q(null);async function Yy(){let e=Jy.value;if(Jy.value=null,e)try{await X.eventTypeDelete(e.id),await By()}catch(e){Iy.value=e.message||String(e)}}var Xy=100,Zy=q([]),Qy=q(!0),$y=q(null),eb=q(!0),tb=q(null);async function nb(){try{let e=await X.captures(Xy);Qy.value=e.enabled!==!1,Zy.value=e.captures||[],$y.value=null}catch(e){$y.value=e.message||String(e)}finally{eb.value=!1}}function rb(e){let t=Zy.value.find(t=>t.id===e);return t&&(tb.value=t),!!t}function ib(){Zy.value.length&&(tb.value=Zy.value[0])}function ab(){Fe(`captures`,()=>{nb(),By()})}var ob=k({__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=It(n,`class`),a=v(i,r);return(e,t)=>(R(),K(z(vo),H({"data-slot":`tabs`,"data-orientation":z(a).orientation||`horizontal`},z(a),{class:z(J)(`gap-2 group/tabs flex data-horizontal:flex-col`,n.class)}),{default:j(t=>[P(e.$slots,`default`,ft(Re(t)))]),_:3},16,[`data-orientation`,`class`]))}}),sb=k({__name:`TabsContent`,props:{value:{},forceMount:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e,n=It(t,`class`);return(e,r)=>(R(),K(z(xo),H({"data-slot":`tabs-content`,class:z(J)(`text-sm flex-1 outline-none`,t.class)},z(n)),{default:j(()=>[P(e.$slots,`default`)]),_:3},16,[`class`]))}}),cb=k({__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=It(t,`class`,`variant`);return(r,i)=>(R(),K(z(So),H({"data-slot":`tabs-list`,"data-variant":e.variant},z(n),{class:z(J)(z(ub)({variant:e.variant}),t.class)}),{default:j(()=>[P(r.$slots,`default`)]),_:3},16,[`data-variant`,`class`]))}}),lb=k({__name:`TabsTrigger`,props:{value:{},disabled:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e,n=It(t,`class`),r=Ie(n);return(e,n)=>(R(),K(z(Co),H({"data-slot":`tabs-trigger`,class:z(J)(`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:outline-ring disabled:pointerLine truncated
|
||||
`).find(e=>e.startsWith(`data: `));if(!t)continue;let n=JSON.parse(t.slice(6));if(n.session_id&&(Hc.value=n.session_id),n.type===`delta`&&(o+=n.text,qc.value=qc.value?{...qc.value,text:o}:null),(n.type===`tool`||n.type===`navigate`)&&(a=[...a,n],qc.value=qc.value?{...qc.value,tools:a}:null),n.type===`ask`&&n.ask&&(clearTimeout(l),qc.value=qc.value?{...qc.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`);Uc.value=[...Uc.value,{from:`assistant`,text:o,tool_calls:a}],qc.value=null,Gc.value=`Ready`,await sl()}catch(e){let t=e;t.name===`AbortError`&&!c?(qc.value={text:`Turn stopped.`,tools:a,isError:!1,turn:r,isRetry:i},Gc.value=`Stopped`):(qc.value={text:`Unable to complete that turn: ${t.message||t}`,tools:a,isError:!0,turn:r?Fc(r):void 0,isRetry:i},Gc.value=`Error. Retry available.`)}finally{clearTimeout(l),zc=null,al=null,Kc.value=!1}}function yl(){Gc.value=`Stopping…`,Hc.value&&Y.chatCancel(Hc.value).catch(()=>{}),ol()}function bl(){ht(()=>{sl().catch(e=>{Gc.value=e.message||`Chat unavailable`})}),bt(()=>{ol()})}async function xl(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 vl({textOverride:`🎤 Voice message`,voice:{data:btoa(n),mime_type:e.type||`audio/webm`}})}var Sl=[`aria-label`,`title`,`aria-expanded`,`aria-controls`],Cl=k({__name:`ChatFab`,props:{open:{type:Boolean}},emits:[`toggle`],setup(e,{emit:t}){let n=t;function r(e){return X(`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)=>(R(),W(`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":z(Lc),onClick:i[0]||=e=>n(`toggle`)},[U(`span`,{"aria-hidden":`true`,class:N(r(!e.open))},[M(z(Qs),{size:22})],2),U(`span`,{"aria-hidden":`true`,class:N(r(e.open))},[M(z(Tc),{size:22})],2)],8,Sl))}}),wl=k({__name:`Select`,props:{open:{type:Boolean},defaultOpen:{type:Boolean},defaultValue:{},modelValue:{},nullableValue:{},by:{type:[String,Function]},dir:{},multiple:{type:Boolean},autocomplete:{},disabled:{type:Boolean},name:{},required:{type:Boolean}},emits:[`update:modelValue`,`update:open`],setup(e,{emit:t}){let n=v(e,t);return(e,t)=>(R(),K(z(za),H({"data-slot":`select`},z(n)),{default:j(t=>[P(e.$slots,`default`,ft(Re(t)))]),_:3},16))}}),Tl=k({inheritAttrs:!1,__name:`SelectContent`,props:{forceMount:{type:Boolean},position:{default:`item-aligned`},bodyLock:{type:Boolean},loop:{type:Boolean},memoDependencies:{},side:{},sideOffset:{},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:[`closeAutoFocus`,`escapeKeyDown`,`pointerDownOutside`],setup(e,{emit:t}){let n=e,r=t,i=Ht(n,`class`),a=v(i,r);return(t,r)=>(R(),K(z(oo),null,{default:j(()=>[M(z(Za),H({"data-slot":`select-content`,"data-align-trigger":e.position===`item-aligned`},{...t.$attrs,...z(a)},{class:z(X)(`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 min-w-36 rounded-lg shadow-md ring-1 duration-100 data-[side=inline-start]:slide-in-from-right-2 data-[side=inline-end]:slide-in-from-left-2 cn-menu-translucent relative z-50 max-h-(--reka-select-content-available-height) origin-(--reka-select-content-transform-origin) overflow-x-hidden overflow-y-auto data-[align-trigger=true]:animate-none`,e.position===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,n.class)}),{default:j(()=>[M(z(Al)),M(z(po),{"data-position":e.position,class:N(z(X)(`data-[position=popper]:h-(--reka-select-trigger-height) data-[position=popper]:w-full data-[position=popper]:min-w-(--reka-select-trigger-width)`))},{default:j(()=>[P(t.$slots,`default`)]),_:3
Line truncated
|
||||
`),r=[],i=null,a=null,o=()=>{r.length&&(t.push({kind:`p`,inline:Cd(r.join(` `))}),r=[])},s=()=>{i&&=(t.push({kind:i.tag,items:i.items.map(e=>Cd(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=Td(c),u=e+1<n.length?Td(n[e+1]):null;if(l&&u&&Ed(u)&&l.length===u.length){o(),s();let r=[];for(e+=2;e<n.length;e++){let t=Td(n[e]);if(!t||t.length!==l.length){e--;break}r.push(t)}t.push({kind:`table`,head:l.map(e=>Cd(e)),rows:r.map(e=>e.map(e=>Cd(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:Cd(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:Cd(c.replace(/^>\s?/,``))})):r.push(c)}return o(),s(),a&&t.push({kind:`pre`,code:a.join(`
|
||||
`)}),t}function Td(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 Ed(e){return e.every(e=>/^:?-{3,}:?$/.test(e))}var Dd={class:`[overflow-wrap:anywhere]`},Od={key:0,class:`my-2 overflow-auto rounded-md border border-border bg-background/60 p-3`},kd={class:`font-mono text-[0.85em]`},Ad={key:1,class:`my-3 w-full border-collapse text-[0.92em]`},jd={key:2,class:`my-2 border-l-[3px] border-primary pl-3 text-fg-muted`},Md={key:3,class:`mt-1 mb-2 text-xl leading-tight font-semibold tracking-[-0.02em]`},Nd={key:4,class:`mt-1 mb-2 text-lg leading-tight font-semibold tracking-[-0.02em]`},Pd={key:5,class:`mt-1 mb-2 text-base leading-tight font-semibold tracking-[-0.02em]`},Fd={key:6,class:`my-2.5 flex list-disc flex-col gap-1 pl-5`},Id={key:7,class:`my-2.5 flex list-decimal flex-col gap-1 pl-5`},Ld={key:8,class:`mb-2.5 last:mb-0`},Rd=k({__name:`ChatMarkdown`,props:{text:{}},setup(e){let t=e,n=I(()=>wd(t.text));return(e,t)=>(R(),W(`div`,Dd,[(R(!0),W(V,null,G(n.value,(e,t)=>(R(),W(V,{key:t},[e.kind===`pre`?(R(),W(`pre`,Od,[U(`code`,kd,B(e.code),1)])):e.kind===`table`?(R(),W(`table`,Ad,[U(`thead`,null,[U(`tr`,null,[(R(!0),W(V,null,G(e.head,(e,t)=>(R(),W(`th`,{key:t,class:`border border-border bg-muted px-2 py-1.5 text-left font-semibold`},[M(xd,{inline:e},null,8,[`inline`])]))),128))])]),U(`tbody`,null,[(R(!0),W(V,null,G(e.rows,(e,t)=>(R(),W(`tr`,{key:t},[(R(!0),W(V,null,G(e,(e,t)=>(R(),W(`td`,{key:t,class:`border border-border px-2 py-1.5 text-left`},[M(xd,{inline:e},null,8,[`inline`])]))),128))]))),128))])])):e.kind===`blockquote`?(R(),W(`blockquote`,jd,[M(xd,{inline:e.inline},null,8,[`inline`])])):e.kind===`h1`?(R(),W(`h1`,Md,[M(xd,{inline:e.inline},null,8,[`inline`])])):e.kind===`h2`?(R(),W(`h2`,Nd,[M(xd,{inline:e.inline},null,8,[`inline`])])):e.kind===`h3`?(R(),W(`h3`,Pd,[M(xd,{inline:e.inline},null,8,[`inline`])])):e.kind===`ul`?(R(),W(`ul`,Fd,[(R(!0),W(V,null,G(e.items,(e,t)=>(R(),W(`li`,{key:t},[M(xd,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`ol`?(R(),W(`ol`,Id,[(R(!0),W(V,null,G(e.items,(e,t)=>(R(),W(`li`,{key:t},[M(xd,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`p`?(R(),W(`p`,Ld,[M(xd,{inline:e.inline},null,8,[`inline`])])):L(``,!0)],64))),128))]))}}),zd={class:`truncate`},Bd=k({__name:`ChatNavChip`,props:{path:{},label:{}},setup(e){return(t,n)=>{let r=Be(`RouterLink`);return R(),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:j(()=>[M(z(ws),{"aria-hidden":`true`,class:`size-3.5 shrink-0`}),U(`span`,zd,B(e.label||e.path),1)]),_:1},8,[`to`,`title`])}}}),Vd={key:1,class:`flex items-baseline gap-1.5 [overflow-wrap:anywhere]`},Hd={class:`font-semibold text-foreground`},Ud={key:0,class:`font-mono text-[0.95em] text-fg-subtle`},Wd=k({__name:`ChatToolCall`,props:{tool:{},streaming:{type:Boolean}},setup(e){let t=e,n=I(()=>t.tool.name||t.tool.Name||t.tool.tool||`tool`),r=I(()=>t.tool.parameters||t.tool.Parameters||``),i=I(()=>!!(t.tool.err||t.tool.Err||t.tool.failed)),a=I(()=>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?(R(),K(Bd,{key:0,path:e.tool.path,label:e.tool.label},null,8,[`path`,`label`])):(R(),W(`div`,Vd,[M(z(wc),{"aria-hidden":`true`,class:`size-3.5 shrink-0 self-center text-fg-subtle`}),U(`span`,Hd,B(n.value),1),r.value?(R(),W(`code`,Ud,B(r.value),1)):L(``,!0),U(`span`,{class:N(z(X)(`text-fg-muted`,i.value&&`text-danger`))},B(a.value),3)]))}}),Gd={key:0,class:`mb-2 grid gap-0.5 text-xs`},Kd={key:1,class:`mb-2 flex flex-wrap gap-1.5`},qd={key:3,class:`whitespace-pre-wrap`},Jd=k({__name:`ChatBubble`,props:{text:{},tools:{default:()=>[]},media:{default:()=>[]},assistant:{type:Boolean,default:!1},streaming:{type:Boolean,default:!1}},setup(e){return(t,n)=>(R(),W(`div`,{class:N([`flex`,e.assistant?`justify-start`:`justify-end`])},[U(`div`,{class:N(z(X)(`max-w-[min(78ch,86%)] rounded-[0.85rem] px-4 py-3 leading-normal [overflow-wrap:anywhere]`,e.assistant?`bg-muted`:`bg-primary/15`))},[e.assistant&&e.tools.length?(R(),W(`div`,Gd,[(R(!0),W(V,null,G(e.tools,(t,n)=>(R(),K(Wd,{key:n,tool:t,streaming:e.streaming},null,8,[`tool`,`streaming`]))),128))])):L(``,!0),e.media.length?(R(),W(`div`,Kd,[(R(!0),W(V,null,G(e.media,(e,t)=>(R(),K(md,{key:t,attachment:e},null,8,[`attachment`]))),128))])):L(``,!0),e.assistant?(R(),K(Rd,{key:2,text:e.text},null,8,[`text`])):(R(),W(`div`,qd,B(e.text),1)),P(t.$slots,`default`)],2)],2))}}),Yd={class:`text-sm`},Xd={key:0,class:`mt-1 text-fg-muted`},Zd={key:1,class:`mt-2 flex flex-wrap gap-2`},Qd=k({__name:`ChatChooseCard`,props:{choose:{}}
Line truncated
|
||||
`).map(e=>e.trim()).find(Boolean)||``,i=r.length>a_?`${r.slice(0,a_).trimEnd()}…`:r;return{text:i,full:n,truncated:i!==n}}function s_(e){return String(e||`event`).replaceAll(`_`,` `).replace(/\b\w/g,e=>e.toUpperCase())}function c_(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 l_(e){let t=Number(e);return!Number.isFinite(t)||t<=0?``:t.toLocaleString(`en-US`)}function u_(e){return typeof e==`string`?e:``}function d_(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=c_(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,u_(t.error),u_(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:[u_(t.previous_stage)&&`after ${u_(t.previous_stage)}`,u_(t.previous_reason)].filter(Boolean).join(`: `)||e.detail||``}}if(e.kind===`agent_finish`){let r=l_(t.iterations),i=l_(t.tokens),a=Number(t.cached_tokens)||0,o=l_((Number(t.prompt_tokens)||0)-a),s=l_(t.completion_tokens),c=l_(t.cached_tokens),l=[r&&`${r} iterations`,i&&`${i} tokens`,o&&`${o} fresh prompt`,s&&`${s} completion`,c&&`${c} cached`,u_(t.model)].filter(Boolean);return{title:`Agent ${u_(t.status)||`finished`}: ${n}`,detail:l.join(` · `)||e.detail||``}}if(e.kind===`remediation_round`){let e=Number(t.of),n=u_(t.author);return{title:`Remediation ${u_(t.round)}${e>0?` of ${e}`:``}`,detail:[n&&`answers ${n}'s review`,t.review_id?`#${u_(t.review_id)}`:``].filter(Boolean).join(` `)}}if(e.kind===`review_approved`){let e=u_(t.pr_number);return{title:`Pull request approved`,detail:[u_(t.author),e&&`#${e}`].filter(Boolean).join(` · `)}}if(e.kind===`step_retried`)return{title:`Attempt ${u_(t.attempt)} of ${u_(t.of)} failed: ${e.stage||`step`}`,detail:u_(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=u_(t.source),n=u_(t.capture_id),r=[{label:`binding ${u_(t.binding_name)||u_(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 ${u_(t.captured_after)}`:``].filter(Boolean).join(` · `)}}return{title:s_(e.kind||e.type),detail:e.detail||``}}var f_=[`title`],p_=k({__name:`ActivityRow`,props:{event:{}},emits:[`open`],setup(e,{emit:t}){let n=i_();n.watchIdentities();let r=e,i=t,a=qg(),o=I(()=>a.taskIDFor(r.event)),s=I(()=>o_(r.event,n.identityName));function c(){o.value>0&&i(`open`,o.value)}let l=I(()=>r.event.at?Eg(r.event.at):`—`);return(e,t)=>(R(),K(z(e_),{class:N(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:[kt(jt(c,[`prevent`]),[`enter`]),kt(jt(c,[`prevent`]),[`space`])]},{default:j(()=>[M(z(Q),{class:`font-medium`},{default:j(()=>[A(B(z(d_)({...r.event,at:void 0,detail:void 0}).title),1)]),_:1}),M(z(Q),{class:`font-mono`},{default:j(()=>[A(B(o.value>0?`#${o.value}`:`—`),1)]),_:1}),M(z(Q),{class:`w-[55%] max-w-0`},{default:j(()=>[U(`span`,{class:`block truncate`,title:s.value.truncated?s.value.full:void 0},B(s.value.text),9,f_)]),_:1}),M(z(Q),null,{default:j(()=>[A(B(l.value),1)]),_:1})]),_:1},8,[`class`,`role`,`tabindex`,`title`,`onKeydown`]))}}),m_=[{value:`all`,label:`All`},{value:`tasks`,label:`Tasks`},{value:`system`,label:`System`}];function h_(e){return(Number(e?.task_id)||0)>0}function g_(e,t){return t===`tasks`?h_(e):t!==`system`||!h_(e)}function __(e,t){return e.filter(e=>g_(e,t))}function v_(e,t){return e>0?``:t===`all`?`Waiting for activity`:t===`tasks`?`No task events yet`:`No system events yet`}function y_(e,t){return`${e}:${t??0}`}function b_(e){let t=[];for(let n of e){let e=n.kind||n.type||`event`,r=Number(n.task_id)||0,i=y_(o_(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 x_={key:0,class:`font-normal text-fg-subtle`},S_={role:`region`,"aria-label":`Activity`,"ari
Line truncated
|
||||
`,1)[0]??``;return t.length>80?`${t.slice(0,79)}…`:t}function zv(e){return(e?.merged||0)+(e?.completed||0)}function Bv(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 Vv(e,t){return e.filter(e=>e.required&&!(t[e.name]??``).trim()).map(e=>e.name)}function Hv(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 Uv(e,t){let n={};for(let r of e){let e=t[r.name];e!==void 0&&e!==``&&(n[r.name]=Hv(e,r.type))}return n}var Wv=[`onKeydown`],Gv={key:0,class:`text-sm text-danger`,role:`alert`},Kv={key:1,class:`grid gap-1.5`},qv=[`for`],Jv={key:0,class:`font-normal text-fg-subtle`},Yv=[`id`],Xv=[`value`],Zv={key:0,class:`text-xs text-fg-subtle`},Qv={key:2,class:`grid gap-1.5`},$v=[`id`],ey={class:`block truncate font-mono text-[13px] font-medium`},ty={class:`block text-xs text-fg-subtle`},ny={key:0,class:`text-xs text-fg-subtle`},ry={key:3,class:`grid gap-3`},iy=[`for`],oee={class:`font-mono`},ay={key:0,class:`text-fg-subtle`},oy={class:`text-xs text-fg-subtle`},sy={class:`grid gap-1.5`},cy=[`for`],ly={class:`grid gap-1.5`},uy=[`for`],dy={key:4,class:`text-sm text-danger`,role:`alert`},fy={class:`flex items-center gap-2 border-t border-border pt-4`},py={class:`mr-auto text-xs text-fg-subtle`},my=k({__name:`NewTaskForm`,props:{workflow:{},draft:{},initialWorkflow:{},initialInstructions:{}},emits:[`started`,`cancel`],setup(e,{emit:t}){let n=e,r=t,i=Ue(),a=q([]),o=q([]),s=q([]),c=q(``);ht(async()=>{try{let[e,t]=await Promise.all([Y.workflows(),Y.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(Rv(d.value)),p=q({});et(()=>{!u.value&&a.value[0]&&(u.value=a.value[0].id)});let m=I(()=>a.value.find(e=>e.id===u.value)),h=I(()=>Bv(m.value)),g=I(()=>Vv(h.value,p.value)),_=I(()=>m.value?.repository??`required`),v=I(()=>_.value!==`optional`&&_.value!==`none`),y=e=>o.value.find(t=>t.workflow===e),b=q(!1),ee=q(``),x=I(()=>!(!l.value.trim()&&v.value||!u.value||!f.value.trim())&&g.value.length===0);async function S(){if(x.value&&!b.value){b.value=!0,ee.value=``;try{let e=await Y.workRequest({repository:_.value===`none`?``:l.value.trim(),workflow:u.value,title:f.value.trim(),instructions:d.value,inputs:Uv(h.value,p.value),...n.draft?{draft:n.draft}:{}});r(`started`,e.task_id)}catch(e){ee.value=String(e.message||e)}finally{b.value=!1}}}return(e,t)=>(R(),W(`form`,{class:`grid gap-5`,onSubmit:jt(S,[`prevent`]),onKeydown:[kt(jt(S,[`meta`,`prevent`]),[`enter`]),kt(jt(S,[`ctrl`,`prevent`]),[`enter`])]},[c.value?(R(),W(`p`,Gv,B(c.value),1)):L(``,!0),_.value===`none`?L(``,!0):(R(),W(`div`,Kv,[U(`label`,{for:`${z(i)}-repo`,class:`text-[13px] font-medium`},[t[5]||=A(`Repository`,-1),v.value?L(``,!0):(R(),W(`span`,Jv,` (optional)`))],8,qv),M(z(Z),{id:`${z(i)}-repo`,modelValue:l.value,"onUpdate:modelValue":t[0]||=e=>l.value=e,class:`font-mono`,placeholder:`owner/repository`,list:`${z(i)}-repos`,required:v.value},null,8,[`id`,`modelValue`,`list`,`required`]),U(`datalist`,{id:`${z(i)}-repos`},[(R(!0),W(V,null,G(s.value,e=>(R(),W(`option`,{key:e,value:e},null,8,Xv))),128))],8,Yv),s.value.length?(R(),W(`p`,Zv,[t[6]||=A(`Configured: `,-1),(R(!0),W(V,null,G(s.value,e=>(R(),K(z(J),{key:e,type:`button`,variant:`link`,size:`xs`,class:`h-auto px-1 font-mono text-fg-subtle`,onClick:t=>l.value=e},{default:j(()=>[A(B(e),1)]),_:2},1032,[`onClick`]))),128))])):L(``,!0)])),n.workflow?L(``,!0):(R(),W(`div`,Qv,[U(`span`,{id:`${z(i)}-wf`,class:`text-[13px] font-medium`},`Workflow`,8,$v),M(z(Oa),{modelValue:u.value,"onUpdate:modelValue":t[1]||=e=>u.value=e,"aria-labelledby":`${z(i)}-wf`,class:`grid grid-cols-1 gap-2 sm:grid-cols-3`,loop:``},{default:j(()=>[(R(!0),W(V,null,G(a.value,e=>(R(),K(z(Aa),{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:j(()=>[U(`span`,ey,B(e.name||e.id),1),U(`span`,ty,[A(B(y(e.id)?.runs||0)+` runs`,1),y(e.id)?.runs?(R(),W(V,{key:0},[A(` · `+B(Math.round(z(zv)(y(e.id))/(y(e.id)?.runs||1)*100))+`% delivered`,1)],64)):L(``,!0)])]),_:2},1032,[`value`]))),128))]),_:1},8,[`modelValue`,`aria-labelledby`]),!a.value.length&&!c.value?(R(),W(`p`,ny,`No enabled workflows.`)):L(``,!0)])),h.value.length?(R(),W(`div`,ry,[(R(!0),W(V,null,G(h.value,e=>(R(),W(`div`,{key:e.name,class:`grid gap-1.5`},[U(`label`,{for:`${z(i)}-input-${e.name}`,class:`text-[13px] font-medium`},[U(`span`,oee,B(e.name),1),e.required?(R(),W(`span`,ay,` · required`)):L(``,!0)],8,iy),M(z(Z),{id
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 My(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 Ny(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 Py(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 Fy(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 Iy=q([]),Ly=q([]),Ry=q(!0),zy=q(null),By=q(null),Vy=q(!1),Hy=q(null);async function Uy(){try{let e=await Y.eventTypes(Ay().workspace);Ry.value=e.enabled!==!1,Iy.value=e.event_types||[],Ly.value=e.proposals||[],zy.value=null}catch(e){zy.value=e.message||String(e)}}function Wy(e){return{headers:(e.headers||[]).map(e=>({...e})),payload:(e.payload||[]).map(e=>({...e}))}}function Gy(e){Hy.value=null,By.value=e}function Ky(e){let t=eb.value.find(t=>String(t.id)===e.sample_id);Gy({mode:`proposal`,id:null,source:e.source,name:``,rule:Wy(e.rule),headersText:``,body:t?.body||``,exampleHeaders:e.headers||{}})}function qy(e=``){Gy({mode:`paste`,id:null,source:e,name:``,rule:{headers:[],payload:[]},headersText:``,body:``,exampleHeaders:{}})}function Jy(e){Gy({mode:`edit`,id:e.id,source:e.source,name:e.name,rule:Wy(e.rule),headersText:``,body:``,exampleHeaders:{}})}function Yy(){By.value=null}async function Xy(){let e=By.value;if(e){Vy.value=!0;try{if(e.mode===`edit`&&e.id)await Y.eventTypeUpdate(e.id,{name:e.name,rule:Fy(e.rule)});else{let t=e.mode===`paste`?jy(e.headersText):e.exampleHeaders;await Y.eventTypeCreate({source:e.source,name:e.name,rule:e.mode===`paste`?void 0:Fy(e.rule),example:{headers:t,body:e.body}})}By.value=null,await Uy()}catch(e){Hy.value=e.message||String(e)}finally{Vy.value=!1}}}var Zy=q(null);async function Qy(){let e=Zy.value;if(Zy.value=null,e)try{await Y.eventTypeDelete(e.id),await Uy()}catch(e){zy.value=e.message||String(e)}}var $y=100,eb=q([]),tb=q(!0),nb=q(null),rb=q(!0),ib=q(null);async function ab(){try{let e=await Y.captures($y);tb.value=e.enabled!==!1,eb.value=e.captures||[],nb.value=null}catch(e){nb.value=e.message||String(e)}finally{rb.value=!1}}function ob(e){let t=eb.value.find(t=>t.id===e);return t&&(ib.value=t),!!t}function sb(){eb.value.length&&(ib.value=eb.value[0])}function cb(){Fe(`captures`,()=>{ab(),Uy()})}var lb=k({__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=Ht(n,`class`),a=v(i,r);return(e,t)=>(R(),K(z(bo),H({"data-slot":`tabs`,"data-orientation":z(a).orientation||`horizontal`},z(a),{class:z(X)(`gap-2 group/tabs flex data-horizontal:flex-col`,n.class)}),{default:j(t=>[P(e.$slots,`default`,ft(Re(t)))]),_:3},16,[`data-orientation`,`class`]))}}),ub=k({__name:`TabsContent`,props:{value:{},forceMount:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e,n=Ht(t,`class`);return(e,r)=>(R(),K(z(Co),H({"data-slot":`tabs-content`,class:z(X)(`text-sm flex-1 outline-none`,t.class)},z(n)),{default:j(()=>[P(e.$slots,`default`)]),_:3},16,[`class`]))}}),db=k({__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=Ht(t,`class`,`variant`);return(r,i)=>(R(),K(z(wo),H({"data-slot":`tabs-list`,"data-variant":e.variant},z(n),{class:z(X)(z(pb)({variant:e.variant}),t.class)}),{default:j(()=>[P(r.$slots,`default`)]),_:3},16,[`data-variant`,`class`]))}}),fb=k({__name:`TabsTrigger`,props:{value:{},disabled:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e,n=Ht(t,`class`),r=Ie(n);return(e,n)=>(R(),K(z(To),H({"data-slot":`tabs-trigger`,class:z(X)(`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:outline-ring disabled:pointerLine 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 $j=zj(`CharSizeService`),eM=zj(`CoreBrowserService`),tM=zj(`MouseService`),nM=zj(`RenderService`),rM=zj(`SelectionService`),iM=zj(`CharacterJoinerService`),aM=zj(`ThemeService`),oM=zj(`LinkProviderService`),sM=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?pM.isErrorNoTelemetry(e)?new pM(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 rM=Uj(`CharSizeService`),iM=Uj(`CoreBrowserService`),aM=Uj(`MouseService`),oM=Uj(`RenderService`),sM=Uj(`SelectionService`),cM=Uj(`CharacterJoinerService`),lM=Uj(`ThemeService`),uM=Uj(`LinkProviderService`),dM=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?_M.isErrorNoTelemetry(e)?new _M(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 cM(e){uM(e)||sM.onUnexpectedError(e)}var lM=`Canceled`;function uM(e){return e instanceof dM||e instanceof Error&&e.name===lM&&e.message===lM}var dM=class extends Error{constructor(){super(lM),this.name=this.message}};function fM(e){return Error(e?`Illegal argument: ${e}`:`Illegal argument`)}var pM=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`}},mM=class e extends Error{constructor(t){super(t||`An unexpected bug occurred.`),Object.setPrototypeOf(this,e.prototype)}};function hM(e,t=0){return e[e.length-(1+t)]}var gM;(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})(gM||={});var _M=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||gM.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};_M.empty=new _M(e=>{});function vM(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 yM;(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})(yM||={});var bM=null;function xM(e){return bM?.trackDisposable(e),e}function SM(e){bM?.markAsDisposed(e)}function CM(e,t){bM?.setParent(e,t)}function wM(e){return bM?.markAsSingleton(e),e}function TM(e){if(yM.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 EM(...e){return DM(()=>TM(e))}function DM(e){let t=xM({dispose:vM(()=>{SM(t),e()})});return t}var OM=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,xM(this)}dispose(){this._isDisposed||(SM(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{TM(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return CM(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),CM(e,null))}};OM.DISABLE_DISPOSED_WARNING=!1;var kM=OM,AM=class{constructor(){this._store=new kM,xM(this),CM(this._store,this)}dispose(){SM(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 fM(e){mM(e)||dM.onUnexpectedError(e)}var pM=`Canceled`;function mM(e){return e instanceof hM||e instanceof Error&&e.name===pM&&e.message===pM}var hM=class extends Error{constructor(){super(pM),this.name=this.message}};function gM(e){return Error(e?`Illegal argument: ${e}`:`Illegal argument`)}var _M=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`}},vM=class e extends Error{constructor(t){super(t||`An unexpected bug occurred.`),Object.setPrototypeOf(this,e.prototype)}};function yM(e,t=0){return e[e.length-(1+t)]}var bM;(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})(bM||={});var xM=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||bM.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};xM.empty=new xM(e=>{});function SM(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 CM;(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})(CM||={});var wM=null;function TM(e){return wM?.trackDisposable(e),e}function EM(e){wM?.markAsDisposed(e)}function DM(e,t){wM?.setParent(e,t)}function OM(e){return wM?.markAsSingleton(e),e}function kM(e){if(CM.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 AM(...e){return jM(()=>kM(e))}function jM(e){let t=TM({dispose:SM(()=>{EM(t),e()})});return t}var MM=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,TM(this)}dispose(){this._isDisposed||(EM(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{kM(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return DM(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),DM(e,null))}};MM.DISABLE_DISPOSED_WARNING=!1;var NM=MM,PM=class{constructor(){this._store=new NM,TM(this),DM(this._store,this)}dispose(){EM(thi
Line truncated
|
||||
`).slice(2).join(`
|
||||
`))}},GM=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},KM=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},qM=0,JM=class{constructor(e){this.value=e,this.id=qM++}},YM=2,XM=class{constructor(e){this._size=0,this._options=e,this._leakageMon=VM>0||this._options?.leakWarningThreshold?new UM(e?.onListenerError??cM,this._options?.leakWarningThreshold??VM):void 0,this._perfMon=this._options?._profName?new BM(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 KM(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||cM)(n),AM.None}if(this._disposed)return AM.None;t&&(e=e.bind(t));let r=new JM(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=WM.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof JM?(this._deliveryQueue??=new ZM,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=DM(()=>{i?.(),this._removeListener(r)});return n instanceof kM?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*YM<=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||cM;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 JM)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}},ZM=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}},QM=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new XM,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new XM,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}};QM.INSTANCE=new QM;var $M=QM;function eN(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}$M.INSTANCE.onDidChangeZoomLevel;function tN(e){return $M.INSTANCE.getZoomFactor(e)}$M.INSTANCE.onDidChangeFullscreen;var nN=typeof navigator==`object`?navigator.userAgent:``,rN=nN.indexOf(`Firefox`)>=0,iN=nN.indexOf(`AppleWebKit`)>=0,aN=nN.indexOf(`Chrome`)>=0,oN=!aN&&nN.indexOf(`Safari`)>=0;nN.indexOf(`Electron/`),nN.indexOf(`Android`);var sN=!1;if(typeof MM.matchMedia==`function`){let e=MM.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=MM.matchMedia(`(display-mode: fullscreen)`);sN=e.matches,eN(MM,e,({matches:e})=>{sN&&t.matches||(sN=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}};rF=pj([mj(2,Vj),mj(3,eM),mj(4,Hj),mj(5,aM),mj(6,qj),mj(7,nM)],rF);var iF=class extends AM{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(DM(()=>{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 uF;(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=``))(uF||={});var dF;(e=>e.ST=`${$.ESC}\\`)(dF||={});var fF=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)}}};fF=pj([mj(2,Vj),mj(3,qj),mj(4,Uj),mj(5,nM)],fF);var pF=0,mF=0,hF=0,gF=0,_F={css:`#00000000`,rgba:0},vF;(e=>{function t(e,t,n,r){return r===void 0?`#${CF(e)}${CF(t)}${CF(n)}`:`#${CF(e)}${CF(t)}${CF(n)}${CF(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})(vF||={});var yF;(e=>{function t(e,t){if(gF=(t.rgba&255)/255,gF===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 pF=a+Math.round((n-a)*gF),mF=o+Math.round((r-o)*gF),hF=s+Math.round((i-s)*gF),{css:vF.toCss(pF,mF,hF),rgba:vF.toRgba(pF,mF,hF)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=SF.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return vF.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[pF,mF,hF]=SF.toChannels(t),{css:vF.toCss(pF,mF,hF),rgba:t}}e.opaque=i;function a(e,t){return gF=Math.round(t*255),[pF,mF,hF]=SF.toChannels(e.rgba),{css:vF.toCss(pF,mF,hF,gF),rgba:vF.toRgba(pF,mF,hF,gF)}}e.opacity=a;function o(e,t){return gF=e.rgba&255,a(e,gF*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.r
Line truncated
|
||||
`))}},YM=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},XM=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},ZM=0,QM=class{constructor(e){this.value=e,this.id=ZM++}},$M=2,eN=class{constructor(e){this._size=0,this._options=e,this._leakageMon=GM>0||this._options?.leakWarningThreshold?new qM(e?.onListenerError??fM,this._options?.leakWarningThreshold??GM):void 0,this._perfMon=this._options?._profName?new WM(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 XM(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||fM)(n),PM.None}if(this._disposed)return PM.None;t&&(e=e.bind(t));let r=new QM(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=JM.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof QM?(this._deliveryQueue??=new tN,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=jM(()=>{i?.(),this._removeListener(r)});return n instanceof NM?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*$M<=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||fM;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 QM)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}},tN=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}},nN=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new eN,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new eN,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}};nN.INSTANCE=new nN;var rN=nN;function iN(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}rN.INSTANCE.onDidChangeZoomLevel;function aN(e){return rN.INSTANCE.getZoomFactor(e)}rN.INSTANCE.onDidChangeFullscreen;var oN=typeof navigator==`object`?navigator.userAgent:``,sN=oN.indexOf(`Firefox`)>=0,cN=oN.indexOf(`AppleWebKit`)>=0,lN=oN.indexOf(`Chrome`)>=0,uN=!lN&&oN.indexOf(`Safari`)>=0;oN.indexOf(`Electron/`),oN.indexOf(`Android`);var dN=!1;if(typeof IM.matchMedia==`function`){let e=IM.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=IM.matchMedia(`(display-mode: fullscreen)`);dN=e.matches,iN(IM,e,({matches:e})=>{dN&&t.matches||(dN=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}};sF=_j([vj(2,Gj),vj(3,iM),vj(4,Kj),vj(5,lM),vj(6,Zj),vj(7,oM)],sF);var cF=class extends PM{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(jM(()=>{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 mF;(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=``))(mF||={});var hF;(e=>e.ST=`${$.ESC}\\`)(hF||={});var gF=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)}}};gF=_j([vj(2,Gj),vj(3,Zj),vj(4,qj),vj(5,oM)],gF);var _F=0,vF=0,yF=0,bF=0,xF={css:`#00000000`,rgba:0},SF;(e=>{function t(e,t,n,r){return r===void 0?`#${DF(e)}${DF(t)}${DF(n)}`:`#${DF(e)}${DF(t)}${DF(n)}${DF(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})(SF||={});var CF;(e=>{function t(e,t){if(bF=(t.rgba&255)/255,bF===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 _F=a+Math.round((n-a)*bF),vF=o+Math.round((r-o)*bF),yF=s+Math.round((i-s)*bF),{css:SF.toCss(_F,vF,yF),rgba:SF.toRgba(_F,vF,yF)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=EF.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return SF.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[_F,vF,yF]=EF.toChannels(t),{css:SF.toCss(_F,vF,yF),rgba:t}}e.opaque=i;function a(e,t){return bF=Math.round(t*255),[_F,vF,yF]=EF.toChannels(e.rgba),{css:SF.toCss(_F,vF,yF,bF),rgba:SF.toRgba(_F,vF,yF,bF)}}e.opacity=a;function o(e,t){return bF=e.rgba&255,a(e,bF*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()),mI&&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=LI(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=QF(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,-RI),RI),t/=RI,t/Math.abs(t)+Math.round(t*(zI-1)))}shouldForceSelection(e){return uI?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(),BI)}_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&&!(uI&&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(pP(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(DM(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<BR+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
||||
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===BR+1&&(this._liveRegion.textContent+=vj.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 gj.get()},set promptLabel(e){gj.set(e)},get tooMuchOutput(){return vj.get()},set tooMuchOutput(e){vj.set(e)}}}_verifyIntegers(...e){for($R of e)if($R===1/0||isNaN($R)||$R%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for($R of e)if($R&&($R===1/0||isNaN($R)||$R%1!=0||$R<0))throw Error(`This API only accepts positive integers`)}},tz=2,nz=1,rz=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(tz,Math.floor(u/e.css.cell.width)),rows:Math.max(nz,Math.floor(l/e.css.cell.height))}}},iz={class:`flex h-[32rem] min-h-0 flex-col gap-2`},az={key:0,class:`text-sm text-muted-foreground`,role:`status`},oz=k({__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 ht(()=>{let e=n.value;if(!e)return;i=new ez({convertEol:!0,disableStdin:!0,cursorBlink:!1,fontFamily:`'IBM Plex Mono', ui-monospace, monospace`,fontSize:13,theme:{background:`#0b0f14`,foreground:`#e6edf3`}}),o=new rz,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)}),ct(()=>{s?.disconnect(),s=null,a?.close(),a=null,i?.dispose(),i=null,o=null}),(e,t)=>(R(),W(`div`,iz,[r.value===`open`?L(``,!0):(R(),W(`p`,az,[r.value===`connecting`?(R(),W(V,{key:0},[A(`Connecting…`)],64)):r.value===`closed`?(R(),W(V,{key:1},[A(`The sandbox view ended.`)],64)):(R(),W(V,{key:2},[A(`The sandbox view is unavailable.`)],64))])),U(`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)]))}}),sz={class:`flex flex-wrap items-center gap-3 border-b border-border pb-3`},cz={class:`inline-flex items-center gap-2`},lz={class:`inline-flex items-center gap-2`},uz=`__all__`,dz=k({__name:`TaskLogFilters`,props:{filters:{},stages:{}},emits:[`filter`],setup(e,{emit:t}){let n=e,r=t,i=I(()=>nw.map(e=>({value:e.value||uz,label:e.label}))),a=I(()=>n.filters.level||uz),o=I(()=>n.filters.stage||uz);function s(e){r(`filter`,{...n.filters,...e})}function c(e){s({level:String(e)===uz?``:String(e)})}function l(e){s({stage:String(e)===uz?``:String(e)})}return(t,n)=>(R(),W(`div`,sz,[U(`div`,cz,[M(z(xl),{"model-value":a.value,"aria-label":`Filter log entries by level`,"onUpdate:modelValue":c},{default:j(()=>[M(z(Ol),{size:`sm`},{default:j(()=>[M(z(kl))]),_:1}),M(z(Sl),null,{default:j(()=>[M(z(Cl),null,{default:j(()=>[(R(!0),W(V,null,G(i.value,e=>(R(),K(z(Tl),{key:e.value,value:e.value},{default:j(()=>[A(B(e.label),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`model-value`])]),U(`div`,lz,[M(z(xl),{"model-value":o.value,"aria-label":`Filter log entries by stage`,"onUpdate:modelValue":l},{default:j(()=>[M(z(Ol),{size:`sm`},{default:j(()=>[M(z(kl))]),_:1}),M(z(Sl),null,{default:j(()=>[M(z(Cl),null,{default:j(()=>[M(z(Tl),{value:uz},{default:j(()=>[...n[0]||=[A(`All stages`,-1)]]),_:1}),(R(!0),W(V,null,G(e.stages,e=>(R(),K(z(Tl),{key:e,value:e},{default:j(()=>[A(B(e),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`model-value`])])]))}}),fz={class:`sr-only`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`},pz={key:2,class:`flex flex-col items-start gap-2 py-3`},mz={key:0,class:`mt-2
Line truncated
|
||||
`)}};MW.defaultYaml={explicit:!1,version:`1.2`},MW.defaultTags={"!!":`tag:yaml.org,2002:`};function NW(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 PW(e){let t=new Set;return TW(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function FW(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function IW(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=PW(e);let a=FW(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(_W(t.node)||yW(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 LW(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=LW(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=LW(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=LW(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=LW(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function RW(e,t,n){if(Array.isArray(e))return e.map((e,t)=>RW(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!xW(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 zW=class{constructor(e){Object.defineProperty(this,fW,{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(!mW(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=RW(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?LW(i,{"":o},``,o):o}},BW=class extends zW{constructor(e){super(oW),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=[],TW(e,{Node:(e,t)=>{(pW(t)||xW(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||=(RW(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=VW(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(NW(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 VW(e,t,n){if(pW(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(yW(t)){let r=0;for(let i of t.items){let t=VW(e,i,n);t>r&&(r=t)}return r}if(gW(t)){let r=VW(e,t.key,n),i=VW(e,t.value,n);return Math.max(r,i)}return 1}var HW=e=>!e||typeof e!=`function`&&typeof e!=`object`,UW=class extends zW{constructor(e){super(uW),this.value=e}toJSON(e,t){return t?.keep?this.value:RW(this.value,e,t)}toString(){return String(this.value)}};UW.BLOCK_FOLDED=`BLOCK_FOLDED`,UW.BLOCK_LITERAL=`BLOCK_LITERAL`,UW.PLAIN=`PLAIN`,UW.QUOTE_DOUBLE=`QUOTE_DOUBLE`,UW.QUOTE_SINGLE=`QUOTE_SINGLE`;var WW=`tag:yaml.org,2002:`;function GW(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 KW(e,t,n){if(mW(e)&&(e=e.contents),bW(e))return e;if(gW(e)){let t=n.schema[cW].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 BW(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=WW+t.slice(2));let l=GW(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new UW(e);return c&&(c.node=t),t
Line truncated
|
||||
`)?ZW(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()),vI&&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=VI(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=nI(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,-HI),HI),t/=HI,t/Math.abs(t)+Math.round(t*(UI-1)))}shouldForceSelection(e){return mI?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(),WI)}_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&&!(mI&&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(_P(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(jM(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<WR+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
||||
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===WR+1&&(this._liveRegion.textContent+=Sj.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 bj.get()},set promptLabel(e){bj.set(e)},get tooMuchOutput(){return Sj.get()},set tooMuchOutput(e){Sj.set(e)}}}_verifyIntegers(...e){for(rz of e)if(rz===1/0||isNaN(rz)||rz%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(rz of e)if(rz&&(rz===1/0||isNaN(rz)||rz%1!=0||rz<0))throw Error(`This API only accepts positive integers`)}},az=2,oz=1,sz=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(az,Math.floor(u/e.css.cell.width)),rows:Math.max(oz,Math.floor(l/e.css.cell.height))}}},cz={class:`flex h-[32rem] min-h-0 flex-col gap-2`},lz={key:0,class:`text-sm text-muted-foreground`,role:`status`},uz=k({__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 ht(()=>{let e=n.value;if(!e)return;i=new iz({convertEol:!0,disableStdin:!0,cursorBlink:!1,fontFamily:`'IBM Plex Mono', ui-monospace, monospace`,fontSize:13,theme:{background:`#0b0f14`,foreground:`#e6edf3`}}),o=new sz,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)}),ct(()=>{s?.disconnect(),s=null,a?.close(),a=null,i?.dispose(),i=null,o=null}),(e,t)=>(R(),W(`div`,cz,[r.value===`open`?L(``,!0):(R(),W(`p`,lz,[r.value===`connecting`?(R(),W(V,{key:0},[A(`Connecting…`)],64)):r.value===`closed`?(R(),W(V,{key:1},[A(`The sandbox view ended.`)],64)):(R(),W(V,{key:2},[A(`The sandbox view is unavailable.`)],64))])),U(`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)]))}}),dz={class:`flex flex-wrap items-center gap-3 border-b border-border pb-3`},fz={class:`inline-flex items-center gap-2`},pz={class:`inline-flex items-center gap-2`},mz=`__all__`,hz=k({__name:`TaskLogFilters`,props:{filters:{},stages:{}},emits:[`filter`],setup(e,{emit:t}){let n=e,r=t,i=I(()=>aw.map(e=>({value:e.value||mz,label:e.label}))),a=I(()=>n.filters.level||mz),o=I(()=>n.filters.stage||mz);function s(e){r(`filter`,{...n.filters,...e})}function c(e){s({level:String(e)===mz?``:String(e)})}function l(e){s({stage:String(e)===mz?``:String(e)})}return(t,n)=>(R(),W(`div`,dz,[U(`div`,fz,[M(z(wl),{"model-value":a.value,"aria-label":`Filter log entries by level`,"onUpdate:modelValue":c},{default:j(()=>[M(z(jl),{size:`sm`},{default:j(()=>[M(z(Ml))]),_:1}),M(z(Tl),null,{default:j(()=>[M(z(El),null,{default:j(()=>[(R(!0),W(V,null,G(i.value,e=>(R(),K(z(Ol),{key:e.value,value:e.value},{default:j(()=>[A(B(e.label),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`model-value`])]),U(`div`,pz,[M(z(wl),{"model-value":o.value,"aria-label":`Filter log entries by stage`,"onUpdate:modelValue":l},{default:j(()=>[M(z(jl),{size:`sm`},{default:j(()=>[M(z(Ml))]),_:1}),M(z(Tl),null,{default:j(()=>[M(z(El),null,{default:j(()=>[M(z(Ol),{value:mz},{default:j(()=>[...n[0]||=[A(`All stages`,-1)]]),_:1}),(R(!0),W(V,null,G(e.stages,e=>(R(),K(z(Ol),{key:e,value:e},{default:j(()=>[A(B(e),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`model-value`])])]))}}),gz={class:`sr-only`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`},_z={key:2,class:`flex flex-col items-start gap-2 py-3`},vz={key:0,class:`mt-2
Line truncated
|
||||
`)}};IW.defaultYaml={explicit:!1,version:`1.2`},IW.defaultTags={"!!":`tag:yaml.org,2002:`};function LW(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 RW(e){let t=new Set;return kW(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function zW(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function BW(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=RW(e);let a=zW(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(xW(t.node)||CW(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 VW(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=VW(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=VW(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=VW(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=VW(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function HW(e,t,n){if(Array.isArray(e))return e.map((e,t)=>HW(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!TW(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 UW=class{constructor(e){Object.defineProperty(this,gW,{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(!vW(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=HW(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?VW(i,{"":o},``,o):o}},WW=class extends UW{constructor(e){super(uW),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=[],kW(e,{Node:(e,t)=>{(_W(t)||TW(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||=(HW(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=GW(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(LW(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 GW(e,t,n){if(_W(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(CW(t)){let r=0;for(let i of t.items){let t=GW(e,i,n);t>r&&(r=t)}return r}if(bW(t)){let r=GW(e,t.key,n),i=GW(e,t.value,n);return Math.max(r,i)}return 1}var KW=e=>!e||typeof e!=`function`&&typeof e!=`object`,qW=class extends UW{constructor(e){super(mW),this.value=e}toJSON(e,t){return t?.keep?this.value:HW(this.value,e,t)}toString(){return String(this.value)}};qW.BLOCK_FOLDED=`BLOCK_FOLDED`,qW.BLOCK_LITERAL=`BLOCK_LITERAL`,qW.PLAIN=`PLAIN`,qW.QUOTE_DOUBLE=`QUOTE_DOUBLE`,qW.QUOTE_SINGLE=`QUOTE_SINGLE`;var JW=`tag:yaml.org,2002:`;function YW(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 XW(e,t,n){if(vW(e)&&(e=e.contents),wW(e))return e;if(bW(e)){let t=n.schema[fW].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 WW(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=JW+t.slice(2));let l=YW(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new qW(e);return c&&(c.node=t),t
Line truncated
|
||||
`)?tG(n,t):n.includes(`
|
||||
`)?`
|
||||
`+ZW(n,t):(e.endsWith(` `)?``:` `)+n,$W=`flow`,eG=`block`,tG=`quoted`;function nG(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=rG(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=rG(e,h,t.length)),d=h+t.length+c,f=void 0;else{if(r===` `&&p&&p!==` `&&p!==`
|
||||
`+tG(n,t):(e.endsWith(` `)?``:` `)+n,rG=`flow`,iG=`block`,aG=`quoted`;function oG(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=sG(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=sG(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 rG(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 iG=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),aG=e=>/^(%|---|\.\.\.)/m.test(e);function oG(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 sG(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(aG(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 sG(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 cG=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),lG=e=>/^(%|---|\.\.\.)/m.test(e);function uG(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 dG(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(lG(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:nG(o,a,tG,iG(t,!1))}function cG(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
|
||||
`)||/[ \t]\n|\n[ \t]/.test(e))return sG(e,t);let n=t.indent||(aG(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:nG(r,n,$W,iG(t,!1))}function lG(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=sG;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?cG:i&&!t?sG:n?cG:sG}return r(e,t)}var uG;try{uG=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:oG(o,a,aG,cG(t,!1))}function fG(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
|
||||
`)||/[ \t]\n|\n[ \t]/.test(e))return dG(e,t);let n=t.indent||(lG(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:oG(r,n,rG,cG(t,!1))}function pG(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=dG;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?fG:i&&!t?dG:n?fG:dG}return r(e,t)}var mG;try{mG=RegExp(`(^|(?<!
|
||||
))
|
||||
+(?!
|
||||
|$)`,`g`)}catch{uG=/\n+(?!\n|$)/g}function dG({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 lG(n,r);let l=r.indent||(r.forceBlockIndent||aG(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===UW.BLOCK_FOLDED?!1:t===UW.BLOCK_LITERAL||!oG(n,c,l.length);if(!n)return u?`|
|
||||
|$)`,`g`)}catch{mG=/\n+(?!\n|$)/g}function hG({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 pG(n,r);let l=r.indent||(r.forceBlockIndent||lG(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===qW.BLOCK_FOLDED?!1:t===qW.BLOCK_LITERAL||!uG(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(uG,`$&${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(mG,`$&${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=iG(r,!0);o!==`folded`&&t!==UW.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=nG(`${v}${e}${p}`,l,eG,a);if(!i)return`>${y}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${y}\n${l}${v}${n}${p}`}function fG(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 lG(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
|
||||
`)?lG(a,t):dG(e,t,n,r);if(!s&&!u&&i!==UW.PLAIN&&a.includes(`
|
||||
`))return dG(e,t,n,r);if(aG(a)){if(c===``)return t.forceBlockIndent=!0,dG(e,t,n,r);if(s&&c===l)return lG(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 lG(a,t)}return s?d:nG(d,c,$W,iG(t,!1))}function pG(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!==UW.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=UW.QUOTE_DOUBLE);let c=e=>{switch(e){case UW.BLOCK_FOLDED:case UW.BLOCK_LITERAL:return i||a?lG(o.value,t):dG(o,t,n,r);case UW.QUOTE_DOUBLE:return sG(o.value,t);case UW.QUOTE_SINGLE:return cG(o.value,t);case UW.PLAIN:return fG(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 mG(e,t){let n=Object.assign({blockQuote:!0,commentString:XW,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 hG(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(_W(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 gG(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(_W(e)||yW(e))&&e.anchor;a&&NW(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 _G(e,t,n,r){if(gW(e))return e.toString(t,n,r);if(pW(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=bW(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=hG(t.doc.schema.tags,a);let o=gG(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):_W(a)?pG(a,t,n,r):a.toString(t,n,r);return o?_W(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function vG({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=bW(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(yW(e)||!bW(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||yW(e)||(_W(e)?e.type===UW.BLOCK_FOLDED||e.type===UW.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=_G(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+=QW(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=QW(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=QW(g,n.indent,l(f))));let _,v,y;bW(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&&_W(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&vW(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let b=!1,x=_G(t,n,()=>b=!0,()=>h=!0),S=` `;if(f||_||v){if(S=_?`
|
||||
`:``,v){let e=l(v);S+=`\n${ZW(e,n.indent)}`}x===``&&!n.inFlow?S===`
|
||||
`&&y&&(S=`
|
||||
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\n+/g,`$&${l}`),i=!1,a=cG(r,!0);o!==`folded`&&t!==qW.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=oG(`${v}${e}${p}`,l,iG,a);if(!i)return`>${y}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${y}\n${l}${v}${n}${p}`}function gG(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 pG(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
|
||||
`)?pG(a,t):hG(e,t,n,r);if(!s&&!u&&i!==qW.PLAIN&&a.includes(`
|
||||
`))return hG(e,t,n,r);if(lG(a)){if(c===``)return t.forceBlockIndent=!0,hG(e,t,n,r);if(s&&c===l)return pG(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 pG(a,t)}return s?d:oG(d,c,rG,cG(t,!1))}function _G(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!==qW.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=qW.QUOTE_DOUBLE);let c=e=>{switch(e){case qW.BLOCK_FOLDED:case qW.BLOCK_LITERAL:return i||a?pG(o.value,t):hG(o,t,n,r);case qW.QUOTE_DOUBLE:return dG(o.value,t);case qW.QUOTE_SINGLE:return fG(o.value,t);case qW.PLAIN:return gG(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 vG(e,t){let n=Object.assign({blockQuote:!0,commentString:eG,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 yG(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(xW(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 bG(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(xW(e)||CW(e))&&e.anchor;a&&LW(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 xG(e,t,n,r){if(bW(e))return e.toString(t,n,r);if(_W(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=wW(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=yG(t.doc.schema.tags,a);let o=bG(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):xW(a)?_G(a,t,n,r):a.toString(t,n,r);return o?xW(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function SG({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=wW(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(CW(e)||!wW(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||CW(e)||(xW(e)?e.type===qW.BLOCK_FOLDED||e.type===qW.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=xG(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+=nG(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=nG(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=nG(g,n.indent,l(f))));let _,v,y;wW(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&&xW(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&SW(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let b=!1,ee=xG(t,n,()=>b=!0,()=>h=!0),x=` `;if(f||_||v){if(x=_?`
|
||||
`:``,v){let e=l(v);x+=`\n${tG(e,n.indent)}`}ee===``&&!n.inFlow?x===`
|
||||
`&&y&&(x=`
|
||||
|
||||
`):S+=`\n${n.indent}`}else if(!p&&yW(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+=QW(g,n.indent,l(y)):h&&i&&i(),g}function yG(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}var bG=`<<`,xG={identify:e=>e===bG||typeof e==`symbol`&&e.description===bG,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new UW(Symbol(bG)),{addToJSMap:CG}),stringify:()=>bG},SG=(e,t)=>(xG.identify(t)||_W(t)&&(!t.type||t.type===UW.PLAIN)&&xG.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===xG.tag&&e.default);function CG(e,t,n){let r=TG(e,n);if(vW(r))for(let n of r.items)wG(e,t,n);else if(Array.isArray(r))for(let n of r)wG(e,t,n);else wG(e,t,r)}function wG(e,t,n){let r=TG(e,n);if(!hW(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 TG(e,t){return e&&pW(t)?t.resolve(e.doc,e):t}function EG(e,t,{key:n,value:r}){if(bW(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(SG(e,n))CG(e,t,r);else{let i=RW(n,``,e);if(t instanceof Map)t.set(i,RW(r,i,e));else if(t instanceof Set)t.add(i);else{let a=DG(n,i,e),o=RW(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function DG(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(bW(e)&&n?.doc){let t=mG(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)+`..."`),yG(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 OG(e,t,n){return new kG(KW(e,void 0,n),KW(t,void 0,n))}var kG=class e{constructor(e,t=null){Object.defineProperty(this,fW,{value:lW}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return bW(n)&&(n=n.clone(t)),bW(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return EG(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?vG(this,e,t,n):JSON.stringify(this)}};function AG(e,t,n){return(t.inFlow??e.flow?MG:jG)(e,t,n)}function jG({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(bW(i))!d&&i.spaceBefore&&f.push(``),NG(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(gW(i)){let e=bW(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),NG(n,f,e.commentBefore,d))}d=!1;let s=_G(i,u,()=>o=null,()=>d=!0);o&&(s+=QW(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}`:`
|
||||
`):x+=`\n${n.indent}`}else if(!p&&CW(t)){let e=ee[0],r=ee.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=ee.indexOf(` `);e===`&`&&n!==-1&&n<r&&ee[n+1]===`!`&&(n=ee.indexOf(` `,n+1)),(n===-1||r<n)&&(t=!0)}t||(x=`\n${n.indent}`)}}else(ee===``||ee[0]===`
|
||||
`)&&(x=``);return g+=x+ee,n.inFlow?b&&r&&r():y&&!b?g+=nG(g,n.indent,l(y)):h&&i&&i(),g}function CG(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}var wG=`<<`,TG={identify:e=>e===wG||typeof e==`symbol`&&e.description===wG,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new qW(Symbol(wG)),{addToJSMap:DG}),stringify:()=>wG},EG=(e,t)=>(TG.identify(t)||xW(t)&&(!t.type||t.type===qW.PLAIN)&&TG.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===TG.tag&&e.default);function DG(e,t,n){let r=kG(e,n);if(SW(r))for(let n of r.items)OG(e,t,n);else if(Array.isArray(r))for(let n of r)OG(e,t,n);else OG(e,t,r)}function OG(e,t,n){let r=kG(e,n);if(!yW(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 kG(e,t){return e&&_W(t)?t.resolve(e.doc,e):t}function AG(e,t,{key:n,value:r}){if(wW(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(EG(e,n))DG(e,t,r);else{let i=HW(n,``,e);if(t instanceof Map)t.set(i,HW(r,i,e));else if(t instanceof Set)t.add(i);else{let a=jG(n,i,e),o=HW(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function jG(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(wW(e)&&n?.doc){let t=vG(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)+`..."`),CG(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 MG(e,t,n){return new NG(XW(e,void 0,n),XW(t,void 0,n))}var NG=class e{constructor(e,t=null){Object.defineProperty(this,gW,{value:pW}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return wW(n)&&(n=n.clone(t)),wW(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return AG(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?SG(this,e,t,n):JSON.stringify(this)}};function PG(e,t,n){return(t.inFlow??e.flow?IG:FG)(e,t,n)}function FG({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(wW(i))!d&&i.spaceBefore&&f.push(``),LG(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(bW(i)){let e=wW(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),LG(n,f,e.commentBefore,d))}d=!1;let s=xG(i,u,()=>o=null,()=>d=!0);o&&(s+=nG(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+=`
|
||||
`+ZW(l(e),c),s&&s()):d&&o&&o(),p}function MG({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(bW(i))i.spaceBefore&&d.push(``),NG(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(gW(i)){let e=bW(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),NG(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=bW(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=_G(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+=QW(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 NG({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=ZW(t(r),e);n.push(i.trimStart())}}function PG(e,t){let n=_W(t)?t.value:t;for(let r of e)if(gW(r)&&(r.key===t||r.key===n||_W(r.key)&&r.key.value===n))return r}var FG=class extends YW{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(cW,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(OG(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=gW(e)?e:!e||typeof e!=`object`||!(`key`in e)?new kG(e,e?.value):new kG(e.key,e.value);let r=PG(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);_W(r.value)&&HW(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=PG(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=PG(this.items,e)?.value;return(!t&&_W(n)?n.value:n)??void 0}has(e){return!!PG(this.items,e)}set(e,t){this.add(new kG(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)EG(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!gW(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})),AG(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},IG={collection:`map`,default:!0,nodeClass:FG,tag:`tag:yaml.org,2002:map`,resolve(e,t){return hW(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>FG.from(e,t,n)},LG=class extends YW{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(dW,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=RG(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=RG(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&_W(r)?r.value:r}has(e){let t=RG(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=RG(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];_W(r)&&HW(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(RW(e,String(r++),t));return n}toString(e,t,n){return e?AG(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(KW(a,void 0,n))}}return i}};function RG(e){let t=_W(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var zG={collection:`seq`,default:!0,nodeClass:LG,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return vW(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>LG.from(e,t,n)},BG={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),pG(e,t,n,r)}},VG={identify:e=>e==null,createNode:()=>new UW(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new UW(null),stringify:({source:e},t)=>typeof e==`string`&&VG.test.test(e)?e:t.options.nullStr},HG={identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new UW(e[0]===`t`||e[0]===`T`),stringify({source:e,value:t},n){return e&&HG.test.test(e)&&t===(e[0]===`t`||e[0]===`T`)?e:t?n.options.trueStr:n.options.falseStr}};function UG({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 WG={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:UG},GG={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 pG({comment:e,type:t,value:s},r,i,a)}};function aK(e,t){if(vW(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!gW(r)){if(hW(r)){r.items.length>1&&t(`Each pair must have its own sequence indicator`);let e=r.items[0]||new kG(new UW(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]=gW(r)?r:new kG(r)}}else t(`Expected a sequence for this tag`);return e}function oK(e,t,n){let{replacer:r}=n,i=new LG(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(OG(o,s,n))}return i}var sK={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:aK,createNode:oK},cK=class e extends LG{constructor(){super(),this.add=FG.prototype.add.bind(this),this.delete=FG.prototype.delete.bind(this),this.get=FG.prototype.get.bind(this),this.has=FG.prototype.has.bind(this),this.set=FG.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(gW(e)?(r=RW(e.key,``,t),i=RW(e.value,r,t)):r=RW(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=oK(e,t,n),i=new this;return i.items=r.items,i}};cK.tag=`tag:yaml.org,2002:omap`;var lK={collection:`seq`,identify:e=>e instanceof Map,nodeClass:cK,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,t){let n=aK(e,t),r=[];for(let{key:e}of n.items)_W(e)&&(r.includes(e.value)?t(`Ordered maps must not include duplicate keys: ${e.value}`):r.push(e.value));return Object.assign(new cK,n)},createNode:(e,t,n)=>cK.from(e,t,n)};function uK({value:e,source:t},n){return t&&(e?dK:fK).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var dK={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 UW(!0),stringify:uK},fK={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 UW(!1),stringify:uK},pK={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:UG},mK={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():UG(e)}},hK={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 UW(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:UG},gK=e=>typeof e==`bigint`||Number.isInteger(e);function _K(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 vK(e,t,n){let{value:r}=e;if(gK(r)){let e=r.toString(t);return r<0?`-`+n+e.substr(1):n+e}return UG(e)}var yK={identify:gK,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>_K(e,2,2,n),stringify:e=>vK(e,2,`0b`)},bK={identify:gK,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>_K(e,1,8,n),stringify:e=>vK(e,8,`0`)},xK={identify:gK,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>_K(e,0,10,n),stringify:UG},SK={identify:gK,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>_K(e,2,16,n),stringify:e=>vK(e,16,`0x`)},CK=class e extends FG{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=gW(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new kG(e.key,null):new kG(e,null),PG(this.items,t.key)||this.items.push(t)}get(e,t){let n=PG(this.items,e);return!t&&gW(n)?_W(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=PG(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new kG(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(ZW(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(ZW(a(t),``)))}return n.join(`
|
||||
`+tG(l(e),c),s&&s()):d&&o&&o(),p}function IG({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(wW(i))i.spaceBefore&&d.push(``),LG(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(bW(i)){let e=wW(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),LG(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=wW(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=xG(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+=nG(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 LG({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=tG(t(r),e);n.push(i.trimStart())}}function RG(e,t){let n=xW(t)?t.value:t;for(let r of e)if(bW(r)&&(r.key===t||r.key===n||xW(r.key)&&r.key.value===n))return r}var zG=class extends $W{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(fW,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(MG(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=bW(e)?e:!e||typeof e!=`object`||!(`key`in e)?new NG(e,e?.value):new NG(e.key,e.value);let r=RG(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);xW(r.value)&&KW(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=RG(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=RG(this.items,e)?.value;return(!t&&xW(n)?n.value:n)??void 0}has(e){return!!RG(this.items,e)}set(e,t){this.add(new NG(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)AG(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!bW(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})),PG(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},BG={collection:`map`,default:!0,nodeClass:zG,tag:`tag:yaml.org,2002:map`,resolve(e,t){return yW(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>zG.from(e,t,n)},VG=class extends $W{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(hW,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=HG(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=HG(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&xW(r)?r.value:r}has(e){let t=HG(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=HG(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];xW(r)&&KW(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(HW(e,String(r++),t));return n}toString(e,t,n){return e?PG(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(XW(a,void 0,n))}}return i}};function HG(e){let t=xW(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var UG={collection:`seq`,default:!0,nodeClass:VG,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return SW(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>VG.from(e,t,n)},WG={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),_G(e,t,n,r)}},GG={identify:e=>e==null,createNode:()=>new qW(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new qW(null),stringify:({source:e},t)=>typeof e==`string`&&GG.test.test(e)?e:t.options.nullStr},KG={identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new qW(e[0]===`t`||e[0]===`T`),stringify({source:e,value:t},n){return e&&KG.test.test(e)&&t===(e[0]===`t`||e[0]===`T`)?e:t?n.options.trueStr:n.options.falseStr}};function qG({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 JG={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:qG},YG={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 _G({comment:e,type:t,value:s},r,i,a)}};function lK(e,t){if(SW(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!bW(r)){if(yW(r)){r.items.length>1&&t(`Each pair must have its own sequence indicator`);let e=r.items[0]||new NG(new qW(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]=bW(r)?r:new NG(r)}}else t(`Expected a sequence for this tag`);return e}function uK(e,t,n){let{replacer:r}=n,i=new VG(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(MG(o,s,n))}return i}var dK={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:lK,createNode:uK},fK=class e extends VG{constructor(){super(),this.add=zG.prototype.add.bind(this),this.delete=zG.prototype.delete.bind(this),this.get=zG.prototype.get.bind(this),this.has=zG.prototype.has.bind(this),this.set=zG.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(bW(e)?(r=HW(e.key,``,t),i=HW(e.value,r,t)):r=HW(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=uK(e,t,n),i=new this;return i.items=r.items,i}};fK.tag=`tag:yaml.org,2002:omap`;var pK={collection:`seq`,identify:e=>e instanceof Map,nodeClass:fK,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,t){let n=lK(e,t),r=[];for(let{key:e}of n.items)xW(e)&&(r.includes(e.value)?t(`Ordered maps must not include duplicate keys: ${e.value}`):r.push(e.value));return Object.assign(new fK,n)},createNode:(e,t,n)=>fK.from(e,t,n)};function mK({value:e,source:t},n){return t&&(e?hK:gK).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var hK={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 qW(!0),stringify:mK},gK={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 qW(!1),stringify:mK},_K={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:qG},vK={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():qG(e)}},yK={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 qW(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:qG},bK=e=>typeof e==`bigint`||Number.isInteger(e);function xK(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 SK(e,t,n){let{value:r}=e;if(bK(r)){let e=r.toString(t);return r<0?`-`+n+e.substr(1):n+e}return qG(e)}var CK={identify:bK,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>xK(e,2,2,n),stringify:e=>SK(e,2,`0b`)},wK={identify:bK,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>xK(e,1,8,n),stringify:e=>SK(e,8,`0`)},TK={identify:bK,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>xK(e,0,10,n),stringify:qG},EK={identify:bK,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>xK(e,2,16,n),stringify:e=>SK(e,16,`0x`)},DK=class e extends zG{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=bW(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new NG(e.key,null):new NG(e,null),RG(this.items,t.key)||this.items.push(t)}get(e,t){let n=RG(this.items,e);return!t&&bW(n)?xW(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=RG(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new NG(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(tG(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(tG(a(t),``)))}return n.join(`
|
||||
`)+`
|
||||
`}var RK=class e{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,fW,{value:sW});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 MW({version:a}),this.setSchema(a,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){let t=Object.create(e.prototype,{[fW]:{value:sW}});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=bW(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(e){zK(this.contents)&&this.contents.add(e)}addIn(e,t){zK(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=PW(this);e.anchor=!t||n.has(t)?FW(t||`a`,n):t}return new BW(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}=IW(this,a||`a`),p={aliasDuplicateObjects:i??!0,keepUndefined:s??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:f},m=KW(e,l,p);return o&&yW(m)&&(m.flow=!0),d(),m}createPair(e,t,n={}){return new kG(this.createNode(e,null,n),this.createNode(t,null,n))}delete(e){return zK(this.contents)?this.contents.delete(e):!1}deleteIn(e){return JW(e)?this.contents!=null&&(this.contents=null,!0):zK(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return yW(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return JW(e)?!t&&_W(this.contents)?this.contents.value:this.contents:yW(this.contents)?this.contents.getIn(e,t):void 0}has(e){return yW(this.contents)?this.contents.has(e):!1}hasIn(e){return JW(e)?this.contents!==void 0:yW(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=qW(this.schema,[e],t):zK(this.contents)&&this.contents.set(e,t)}setIn(e,t){JW(e)?this.contents=t:this.contents==null?this.contents=qW(this.schema,Array.from(e),t):zK(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 MW({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 MW({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 IK(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=RW(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`?LW(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 LK(this,e)}};function zK(e){if(yW(e))return!0;throw Error(`Expected a YAML collection as document contents`)}var BK=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},VK=class extends BK{constructor(e,t,n){super(`YAMLParseError`,e,t,n)}},HK=class extends BK{constructor(e,t,n){super(`YAMLWarning`,e,t,n)}},UK=(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 WK(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 GK(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(GK(t.key)||GK(t.value))return!0}return!1;default:return!0}}function KK(e,t,n){if(t?.type===`flow-collection`){let r=t.end[0];r.indent===e&&(r.source===`]`||r.source===`}`)&&GK(t)&&n(r,`BAD_INDENT`,`Flow end indicator should be more indented than parent`,!0)}}function qK(e,t,n){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let i=typeof r==`function`?r:(e,t)=>e===t||_W(e)&&_W(t)&&e.value===t.value;return t.some(e=>i(e.key,n))}var JK=`All mapping items must start at the same column`;function YK({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??FG)(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=WK(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`,JK)),!p.anchor&&!p.tag&&!d){c=p.end,p.comment&&(o.comment?o.comment+=`
|
||||
`+p.comment:o.comment=p.comment);continue}(p.newlineAfterProp||GK(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`,JK);n.atKey=!0;let h=p.end,g=u?e(n,u,p,i):t(n,h,l,null,p,i);n.schema.compat&&KK(r.indent,u,i),n.atKey=!1,qK(n,o.items,g)&&i(h,`DUPLICATE_KEY`,`Map keys must be unique`);let _=WK(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&&KK(r.indent,f,i),s=c.range[2];let l=new kG(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 kG(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 XK({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??LG)(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=WK(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&&KK(r.indent,l,i),s=d.range[2],o.items.push(d)}return o.range=[r.offset,s,c??s],o}function ZK(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 QK=`Block collections are not allowed within flow collections`,$K=e=>e&&(e.type===`block-map`||e.type===`block-seq`);function eq({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=r.start.source===`{`,s=o?`flow map`:`flow sequence`,c=new((a?.nodeClass)??(o?FG:LG))(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=WK(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&&GK(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];gW(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],$K(m)&&i(r.range,`BLOCK_IN_FLOW`,QK)}else{n.atKey=!0;let a=h.end,g=f?e(n,f,h,i):t(n,a,d,null,h,i);$K(f)&&i(g.range,`BLOCK_IN_FLOW`,QK),n.atKey=!1;let _=WK(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?$K(m)&&i(v.range,`BLOCK_IN_FLOW`,QK):_.comment&&(g.comment?g.comment+=`
|
||||
`+_.comment:g.comment=_.comment);let y=new kG(g,v);if(n.options.keepSourceTokens&&(y.srcToken=l),o){let e=c;qK(n,e.items,g)&&i(a,`DUPLICATE_KEY`,`Map keys must be unique`),e.items.push(y)}else{let e=new FG(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=ZK(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 tq(e,t,n,r,i,a){let o=n.type===`block-map`?YK(e,t,n,r,a):n.type===`block-seq`?XK(e,t,n,r,a):eq(e,t,n,r,a),s=o.constructor;return i===`!`||i===s.tagName?(o.tag=s.tagName,o):(i&&(o.tag=i),o)}function nq(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===FG.tagName&&s===`map`||o===LG.tagName&&s===`seq`)return tq(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),tq(e,t,n,i,o)}let l=tq(e,t,n,i,o,c),u=c.resolve?.(l,e=>i(a,`TAG_RESOLVE_FAILED`,e),t.options)??l,d=bW(u)?u:new UW(u);return d.range=l.range,d.tag=o,c?.format&&(d.format=c.format),d}function rq(e,t,n){let r=t.offset,i=iq(t,e.options.strict,n);if(!i)return{value:``,type:null,comment:``,range:[r,r,r]};let a=i.mode===`>`?UW.BLOCK_FOLDED:UW.BLOCK_LITERAL,o=t.source?aq(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 HK=class e{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,gW,{value:dW});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 IW({version:a}),this.setSchema(a,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){let t=Object.create(e.prototype,{[gW]:{value:dW}});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=wW(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(e){UK(this.contents)&&this.contents.add(e)}addIn(e,t){UK(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=RW(this);e.anchor=!t||n.has(t)?zW(t||`a`,n):t}return new WW(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}=BW(this,a||`a`),p={aliasDuplicateObjects:i??!0,keepUndefined:s??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:f},m=XW(e,l,p);return o&&CW(m)&&(m.flow=!0),d(),m}createPair(e,t,n={}){return new NG(this.createNode(e,null,n),this.createNode(t,null,n))}delete(e){return UK(this.contents)?this.contents.delete(e):!1}deleteIn(e){return QW(e)?this.contents!=null&&(this.contents=null,!0):UK(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return CW(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return QW(e)?!t&&xW(this.contents)?this.contents.value:this.contents:CW(this.contents)?this.contents.getIn(e,t):void 0}has(e){return CW(this.contents)?this.contents.has(e):!1}hasIn(e){return QW(e)?this.contents!==void 0:CW(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=ZW(this.schema,[e],t):UK(this.contents)&&this.contents.set(e,t)}setIn(e,t){QW(e)?this.contents=t:this.contents==null?this.contents=ZW(this.schema,Array.from(e),t):UK(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 IW({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 IW({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 BK(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=HW(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`?VW(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 VK(this,e)}};function UK(e){if(CW(e))return!0;throw Error(`Expected a YAML collection as document contents`)}var WK=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},GK=class extends WK{constructor(e,t,n){super(`YAMLParseError`,e,t,n)}},KK=class extends WK{constructor(e,t,n){super(`YAMLWarning`,e,t,n)}},qK=(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 JK(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,ee=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,ee??=i.offset,l=!1,u=!1,m=!0;break;case`tag`:_&&a(i,`MULTIPLE_TAGS`,`A node can have at most one tag`),_=i,ee??=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 x=e[e.length-1],S=x?x.offset+x.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:S,start:ee??S}}function YK(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(YK(t.key)||YK(t.value))return!0}return!1;default:return!0}}function XK(e,t,n){if(t?.type===`flow-collection`){let r=t.end[0];r.indent===e&&(r.source===`]`||r.source===`}`)&&YK(t)&&n(r,`BAD_INDENT`,`Flow end indicator should be more indented than parent`,!0)}}function ZK(e,t,n){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let i=typeof r==`function`?r:(e,t)=>e===t||xW(e)&&xW(t)&&e.value===t.value;return t.some(e=>i(e.key,n))}var QK=`All mapping items must start at the same column`;function $K({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??zG)(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=JK(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`,QK)),!p.anchor&&!p.tag&&!d){c=p.end,p.comment&&(o.comment?o.comment+=`
|
||||
`+p.comment:o.comment=p.comment);continue}(p.newlineAfterProp||YK(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`,QK);n.atKey=!0;let h=p.end,g=u?e(n,u,p,i):t(n,h,l,null,p,i);n.schema.compat&&XK(r.indent,u,i),n.atKey=!1,ZK(n,o.items,g)&&i(h,`DUPLICATE_KEY`,`Map keys must be unique`);let _=JK(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&&XK(r.indent,f,i),s=c.range[2];let l=new NG(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 NG(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 eq({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??VG)(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=JK(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&&XK(r.indent,l,i),s=d.range[2],o.items.push(d)}return o.range=[r.offset,s,c??s],o}function tq(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 nq=`Block collections are not allowed within flow collections`,rq=e=>e&&(e.type===`block-map`||e.type===`block-seq`);function iq({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=r.start.source===`{`,s=o?`flow map`:`flow sequence`,c=new((a?.nodeClass)??(o?zG:VG))(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=JK(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&&YK(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];bW(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],rq(m)&&i(r.range,`BLOCK_IN_FLOW`,nq)}else{n.atKey=!0;let a=h.end,g=f?e(n,f,h,i):t(n,a,d,null,h,i);rq(f)&&i(g.range,`BLOCK_IN_FLOW`,nq),n.atKey=!1;let _=JK(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?rq(m)&&i(v.range,`BLOCK_IN_FLOW`,nq):_.comment&&(g.comment?g.comment+=`
|
||||
`+_.comment:g.comment=_.comment);let y=new NG(g,v);if(n.options.keepSourceTokens&&(y.srcToken=l),o){let e=c;ZK(n,e.items,g)&&i(a,`DUPLICATE_KEY`,`Map keys must be unique`),e.items.push(y)}else{let e=new zG(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=tq(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 aq(e,t,n,r,i,a){let o=n.type===`block-map`?$K(e,t,n,r,a):n.type===`block-seq`?eq(e,t,n,r,a):iq(e,t,n,r,a),s=o.constructor;return i===`!`||i===s.tagName?(o.tag=s.tagName,o):(i&&(o.tag=i),o)}function oq(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===zG.tagName&&s===`map`||o===VG.tagName&&s===`seq`)return aq(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),aq(e,t,n,i,o)}let l=aq(e,t,n,i,o,c),u=c.resolve?.(l,e=>i(a,`TAG_RESOLVE_FAILED`,e),t.options)??l,d=wW(u)?u:new qW(u);return d.range=l.range,d.tag=o,c?.format&&(d.format=c.format),d}function sq(e,t,n){let r=t.offset,i=cq(t,e.options.strict,n);if(!i)return{value:``,type:null,comment:``,range:[r,r,r]};let a=i.mode===`>`?qW.BLOCK_FOLDED:qW.BLOCK_LITERAL,o=t.source?lq(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===UW.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===qW.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 iq({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 aq(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 oq(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=UW.PLAIN,c=sq(a,l);break;case`single-quoted-scalar`:s=UW.QUOTE_SINGLE,c=cq(a,l);break;case`double-quoted-scalar`:s=UW.QUOTE_DOUBLE,c=uq(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=ZK(o,u,t,n);return{value:c,type:s,comment:d.comment,range:[r,u,d.offset]}}function sq(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}`),lq(e)}function cq(e,t){return(e[e.length-1]!==`'`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing 'quote`),lq(e.slice(1,-1)).replace(/''/g,`'`)}function lq(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 cq({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 lq(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 uq(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=qW.PLAIN,c=dq(a,l);break;case`single-quoted-scalar`:s=qW.QUOTE_SINGLE,c=fq(a,l);break;case`double-quoted-scalar`:s=qW.QUOTE_DOUBLE,c=mq(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=tq(o,u,t,n);return{value:c,type:s,comment:d.comment,range:[r,u,d.offset]}}function dq(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}`),pq(e)}function fq(e,t){return(e[e.length-1]!==`'`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing 'quote`),pq(e.slice(1,-1)).replace(/''/g,`'`)}function pq(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 uq(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 mq(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}=dq(e,r);n+=t,r=i}else if(i===`\\`){let i=e[++r],a=fq[i];if(a)n+=a;else if(i===`
|
||||
`){let{fold:t,offset:i}=hq(e,r);n+=t,r=i}else if(i===`\\`){let i=e[++r],a=gq[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+=pq(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+=_q(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 dq(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 hq(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 fq={0:`\0`,a:`\x07`,b:`\b`,e:`\x1B`,f:`\f`,n:`
|
||||
`,r:`\r`,t:` `,v:`\v`,N:`
`,_:`\xA0`,L:`\u2028`,P:`\u2029`," ":` `,'"':`"`,"/":`/`,"\\":`\\`," ":` `};function pq(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 mq(e,t,n,r){let{value:i,type:a,comment:o,range:s}=t.type===`block-scalar`?rq(e,t,r):oq(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[uW]:c?hq(e.schema,i,c,n,r):t.type===`scalar`?gq(e,i,t,r):e.schema[uW];let u;try{let a=l.resolve(i,e=>r(n??t,`TAG_RESOLVE_FAILED`,e),e.options);u=_W(a)?a:new UW(a)}catch(e){let a=e instanceof Error?e.message:String(e);r(n??t,`TAG_RESOLVE_FAILED`,a),u=new UW(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 hq(e,t,n,r,i){if(n===`!`)return e[uW];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[uW])}function gq({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[uW];if(n.compat){let e=n.compat.find(e=>e.default&&e.test?.test(r))??n[uW];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 _q(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 vq={composeNode:yq,composeEmptyNode:bq};function yq(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=xq(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=mq(e,t,c,r),s&&(l.anchor=s.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:try{l=nq(vq,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??=bq(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&&(!_W(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 bq(e,t,n,r,{spaceBefore:i,comment:a,anchor:o,tag:s,end:c},l){let u=mq(e,{type:`scalar`,offset:_q(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 xq({options:e},{offset:t,source:n,end:r},i){let a=new BW(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=ZK(r,o,e.strict,i);return a.range=[t,o,s.offset],s.comment&&(a.comment=s.comment),a}function Sq(e,t,{offset:n,start:r,value:i,end:a},o){let s=new RK(void 0,Object.assign({_directives:t},e)),c={atKey:!1,atRoot:!0,directives:s.directives,options:s.options,schema:s.schema},l=WK(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?yq(c,i,l,o):bq(c,l.end,r,null,l,o);let u=s.contents.range[2],d=ZK(a,u,!1,o);return d.comment&&(s.comment=d.comment),s.range=[n,u,d.offset],s}function Cq(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 wq(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 gq={0:`\0`,a:`\x07`,b:`\b`,e:`\x1B`,f:`\f`,n:`
|
||||
`,r:`\r`,t:` `,v:`\v`,N:`
`,_:`\xA0`,L:`\u2028`,P:`\u2029`," ":` `,'"':`"`,"/":`/`,"\\":`\\`," ":` `};function _q(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 vq(e,t,n,r){let{value:i,type:a,comment:o,range:s}=t.type===`block-scalar`?sq(e,t,r):uq(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[mW]:c?yq(e.schema,i,c,n,r):t.type===`scalar`?bq(e,i,t,r):e.schema[mW];let u;try{let a=l.resolve(i,e=>r(n??t,`TAG_RESOLVE_FAILED`,e),e.options);u=xW(a)?a:new qW(a)}catch(e){let a=e instanceof Error?e.message:String(e);r(n??t,`TAG_RESOLVE_FAILED`,a),u=new qW(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 yq(e,t,n,r,i){if(n===`!`)return e[mW];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[mW])}function bq({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[mW];if(n.compat){let e=n.compat.find(e=>e.default&&e.test?.test(r))??n[mW];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 xq(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 Sq={composeNode:Cq,composeEmptyNode:wq};function Cq(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=Tq(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=vq(e,t,c,r),s&&(l.anchor=s.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:try{l=oq(Sq,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??=wq(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&&(!xW(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 wq(e,t,n,r,{spaceBefore:i,comment:a,anchor:o,tag:s,end:c},l){let u=vq(e,{type:`scalar`,offset:xq(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 Tq({options:e},{offset:t,source:n,end:r},i){let a=new WW(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=tq(r,o,e.strict,i);return a.range=[t,o,s.offset],s.comment&&(a.comment=s.comment),a}function Eq(e,t,{offset:n,start:r,value:i,end:a},o){let s=new HK(void 0,Object.assign({_directives:t},e)),c={atKey:!1,atRoot:!0,directives:s.directives,options:s.options,schema:s.schema},l=JK(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?Cq(c,i,l,o):wq(c,l.end,r,null,l,o);let u=s.contents.range[2],d=tq(a,u,!1,o);return d.comment&&(s.comment=d.comment),s.range=[n,u,d.offset],s}function Dq(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 Oq(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 Tq=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,n,r)=>{let i=Cq(e);r?this.warnings.push(new HK(i,t,n)):this.errors.push(new VK(i,t,n))},this.directives=new MW({version:e.version||`1.2`}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=wq(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(yW(i)&&!i.flow&&i.items.length>0){let e=i.items[0];gW(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:wq(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=Cq(e);i[0]+=t,this.onError(i,`BAD_DIRECTIVE`,n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case`document`:{let t=Sq(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 VK(Cq(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 VK(Cq(e),`UNEXPECTED_TOKEN`,`Unexpected doc-end without preceding document`));break}this.doc.directives.docEnd=!0;let t=ZK(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 VK(Cq(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 RK(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}}},Eq=Symbol(`break visit`),Dq=Symbol(`skip children`),Oq=Symbol(`remove item`);function kq(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),Aq(Object.freeze([]),e,t)}kq.BREAK=Eq,kq.SKIP=Dq,kq.REMOVE=Oq,kq.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},kq.parentCollection=(e,t)=>{let n=kq.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 Aq(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=Aq(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===Eq)return Eq;else r===Oq&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}function jq(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 kq=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,n,r)=>{let i=Dq(e);r?this.warnings.push(new KK(i,t,n)):this.errors.push(new GK(i,t,n))},this.directives=new IW({version:e.version||`1.2`}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=Oq(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(CW(i)&&!i.flow&&i.items.length>0){let e=i.items[0];bW(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:Oq(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=Dq(e);i[0]+=t,this.onError(i,`BAD_DIRECTIVE`,n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case`document`:{let t=Eq(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 GK(Dq(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 GK(Dq(e),`UNEXPECTED_TOKEN`,`Unexpected doc-end without preceding document`));break}this.doc.directives.docEnd=!0;let t=tq(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 GK(Dq(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 HK(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}}},Aq=Symbol(`break visit`),jq=Symbol(`skip children`),Mq=Symbol(`remove item`);function Nq(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),Pq(Object.freeze([]),e,t)}Nq.BREAK=Aq,Nq.SKIP=jq,Nq.REMOVE=Mq,Nq.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},Nq.parentCollection=(e,t)=>{let n=Nq.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 Pq(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=Pq(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===Aq)return Aq;else r===Mq&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}function Fq(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 Mq(e){switch(e){case void 0:case` `:case`
|
||||
`:case`\r`:case` `:return!0;default:return!1}}var Nq=new Set(`0123456789ABCDEFabcdef`),Pq=new Set(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()`),Fq=new Set(`,[]{}`),Iq=new Set(` ,[]{}
|
||||
\r `),Lq=e=>!e||Iq.has(e),Rq=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 Iq(e){switch(e){case void 0:case` `:case`
|
||||
`:case`\r`:case` `:return!0;default:return!1}}var Lq=new Set(`0123456789ABCDEFabcdef`),Rq=new Set(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()`),zq=new Set(`,[]{}`),Bq=new Set(` ,[]{}
|
||||
\r `),Vq=e=>!e||Bq.has(e),Hq=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===`...`)&&Mq(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===`...`)&&Mq(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&&!Mq(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===`:`)&&Mq(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(Lq),`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(`...`))&&Mq(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(Lq),`flow`;case`"`:case`'`:return this.flowKey=!0,yield*this.parseQuotedScalar();case`:`:{let e=this.charAt(1);if(this.flowKey||Mq(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===`...`)&&Iq(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===`...`)&&Iq(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&&!Iq(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===`:`)&&Iq(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(Vq),`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(`...`))&&Iq(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(Vq),`flow`;case`"`:case`'`:return this.flowKey=!0,yield*this.parseQuotedScalar();case`:`:{let e=this.charAt(1);if(this.flowKey||Iq(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=>Mq(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=>Iq(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(Mq(r)||e&&Fq.has(r))break;t=n}else if(Mq(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(Iq(r)||e&&zq.has(r))break;t=n}else if(Iq(r)){let i=this.buffer[n+1];if(r===`\r`&&(i===`
|
||||
`?(n+=1,r=`
|
||||
`,i=this.buffer[n+1]):t=n),i===`#`||e&&Fq.has(i))break;if(r===`
|
||||
`){let e=this.continueScalar(n+1);if(e===-1)break;n=Math.max(n,e-2)}}else{if(e&&Fq.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(Lq),e+=yield*this.pushSpaces(!0);continue loop;case`-`:case`?`:case`:`:{let t=this.flowLevel>0,n=this.charAt(1);if(Mq(n)||t&&Fq.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(;!Mq(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(Pq.has(t))t=this.buffer[++e];else if(t===`%`&&Nq.has(this.buffer[e+1])&&Nq.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&&zq.has(i))break;if(r===`
|
||||
`){let e=this.continueScalar(n+1);if(e===-1)break;n=Math.max(n,e-2)}}else{if(e&&zq.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(Vq),e+=yield*this.pushSpaces(!0);continue loop;case`-`:case`?`:case`:`:{let t=this.flowLevel>0,n=this.charAt(1);if(Iq(n)||t&&zq.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(;!Iq(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(Rq.has(t))t=this.buffer[++e];else if(t===`%`&&Lq.has(this.buffer[e+1])&&Lq.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)}},zq=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 Bq(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function Vq(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 Hq(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 Uq(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 Wq(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 Gq(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 Kq(e){if(e.start.type===`flow-seq-start`)for(let t of e.items)t.sep&&!t.value&&!Bq(t.start,`explicit-key-ind`)&&!Bq(t.sep,`map-value-ind`)&&(t.key&&(t.value=t.key),delete t.key,Hq(t.value)?t.value.end?Gq(t.value.end,t.sep):t.value.end=t.sep:Gq(t.start,t.sep),delete t.sep)}var qq=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 Rq,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=jq(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`&&Kq(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&&Vq(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)}},Uq=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 Wq(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function Gq(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 Kq(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 qq(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 Jq(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 Yq(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 Xq(e){if(e.start.type===`flow-seq-start`)for(let t of e.items)t.sep&&!t.value&&!Wq(t.start,`explicit-key-ind`)&&!Wq(t.sep,`map-value-ind`)&&(t.key&&(t.value=t.key),delete t.key,Kq(t.value)?t.value.end?Yq(t.value.end,t.sep):t.value.end=t.sep:Yq(t.start,t.sep),delete t.sep)}var Zq=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 Hq,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=Fq(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`&&Xq(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&&Gq(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)){Gq(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(Bq(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=Wq(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(Bq(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(Hq(t.key)&&!Bq(t.sep,`newline`)){let e=Wq(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]}):Bq(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&&!Bq(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)){Gq(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||Bq(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)){Yq(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(Wq(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=Jq(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(Wq(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(Kq(t.key)&&!Wq(t.sep,`newline`)){let e=Jq(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]}):Wq(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&&!Wq(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)){Yq(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||Wq(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=Wq(Uq(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=Wq(Uq(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 Jq(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new zq||null,prettyErrors:t}}function Yq(e,t={}){let{lineCounter:n,prettyErrors:r}=Jq(t),i=new qq(n?.addNewLine),a=new Tq(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 VK(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(UK(e,n)),o.warnings.forEach(UK(e,n))),o}function Xq(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let i=Yq(e,n);if(!i)return null;if(i.warnings.forEach(e=>yG(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 Zq(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 mW(e)&&!r?e.toString(n):new RK(e,r,n).toString(n)}var Qq=e=>typeof e==`object`&&!!e&&!Array.isArray(e),$q=e=>Qq(e)?Object.entries(e).map(([e,t])=>[e,Array.isArray(t)?t:[]]):[];function eJ(e){if(Qq(e)){if(Qq(e.parallel))return{kind:`parallel`,base:[`parallel`],branches:$q(e.parallel)};if(Qq(e.switch))return{kind:`switch`,base:[`switch`,`cases`],on:typeof e.switch.on==`string`?e.switch.on:``,branches:$q(e.switch.cases)}}}function tJ(e){return e.slice(2).includes(`parallel`)}function nJ(e,t){let n=Yq(e).getIn(t,!0);if(hW(n))return n.toJSON()}function rJ(e,t,n){let r=Yq(e);return r.setIn(t,r.createNode(mJ(n))),r.toString()}function iJ(e,t,n){let r=Yq(e),i=t.slice(0,-1),a=tJ(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(vW(o)||(r.setIn(i,r.createNode([])),o=r.getIn(i,!0)),!vW(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 aJ(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 oJ(e,t){let n=e.getIn(t,!0),r=eJ(hW(n)?n.toJSON():void 0),i=r?e.getIn([...t,...r.base],!0):void 0;if(!r||!hW(i))throw Error(`This step has no branches.`);return{kind:r.kind,branches:i}}function sJ(e,t,n){let r=Yq(e),{kind:i,branches:a}=oJ(r,t);if(aJ(n,i),a.has(n))throw Error(`Branch ${n} already exists.`);return a.set(n,r.createNode([])),r.toString()}function cJ(e,t,n,r){let i=Yq(e),{kind:a,branches:o}=oJ(i,t);if(aJ(r,a),n!==r&&o.has(r))throw Error(`Branch ${r} already exists.`);let s=o.items.find(e=>_W(e.key)&&e.key.value===n);if(!s||!_W(s.key))throw Error(`Branch ${n} does not exist.`);return s.key.value=r,i.toString()}function lJ(e,t,n){let r=Yq(e),{kind:i,branches:a}=oJ(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 OJ(e,t){let n=JSON.stringify(e??{})+` `+(typeof t==`string`?`{{ ${t.replace(/^!/,``)} }}`:``);return[...new Set([...n.matchAll(wJ)].map(e=>e[1]))]}function kJ(e){let t=Yq(e).toJS(),n=TJ(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=TJ(e)?e:{},p=eJ(d),m=p?.kind??(typeof d.type==`string`?d.type:``),h=TJ(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,title:g||CJ(m),type:m,role:_J(m),step:l?.length===2?String(Number(l[1])+1).padStart(2,`0`):void 0,detail:p?.on?`on ${p.on.replace(/^steps\./,``)}`:EJ(m,h),summary:DJ(h),when:typeof d.when==`string`?d.when:void 0,retry:TJ(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 OJ([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=eJ(t);if(n){let{kind:i,base:a,branches:o}=n,c=p(t,String(e+1),0,u*bJ,void 0,void 0,[`steps`,e]);m(l,c,[`steps`,e-1]),u++;let d=TJ(t)&&typeof t.id==`string`?t.id:i,f=i===`switch`&&!o.some(([e])=>e==="default"),h=o.length+ +!!f,g=[],_=0;o.forEach(([t,n],o)=>{let s=(o-(h-1)/2)*xJ,l=[c],f=[`steps`,e,...a,t];n.forEach((n,r)=>{let a=p(n,`${e+1}-${t}-${r+1}`,s,(u+r)*bJ,t,d,[...f,r],i);m(l,a,[...f,r-1]),l=[a]}),_=Math.max(_,n.length);let v=`add-${e}-${t}`;r.push({id:v,type:`add`,position:{x:s+104,y:(u+n.length)*bJ},data:{kind:`step`,key:v,title:``,type:``,detail:``,branch:t,lane:i,insertAfter:[...f,n.length-1]}}),m(l,v),g.push(v)});let v=(Math.max(_,1)+1)*bJ-24;o.forEach(([t],n)=>{let a=(n-(h-1)/2)*xJ;r.push({id:`lane-${e}-${t}`,type:`lane`,position:{x:a-12,y:u*bJ-40},style:{width:`264px`,height:`${v}px`},zIndex:-1,data:{kind:`step`,key:t,title:t,type:``,detail:``,lane:i}})}),f&&(g.push(c),s.add(c)),l=g,u+=Math.max(_,1)+1;continue}let i=p(t,String(e+1),0,u*bJ,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*bJ-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 AJ={agent:Es,command:mc,repo:Hs,gate:uc,forge:Xs,human:_c,review:zs,workflow:bc},jJ={agent:`Agents`,command:`Commands`,repo:`Repository`,gate:`Checks`,forge:`Issues and PRs`,human:`People`,review:`Review`,workflow:`Flow`};function MJ(e){return e===`parallel`?Hs:e===`switch`?fc:AJ[e.split(`.`)[0]]??bc}function NJ(e){return Object.keys(jJ).map(t=>({title:jJ[t],icon:AJ[t],types:e.filter(e=>e.split(`.`)[0]===t)})).filter(e=>e.types.length)}var PJ=k({__name:`WorkflowPicker`,props:{value:{},workflows:{},label:{}},emits:[`pick`],setup(e,{emit:t}){let n=t;return(t,r)=>(R(),K(z(xl),{"model-value":e.value||void 0,"onUpdate:modelValue":r[0]||=e=>n(`pick`,String(e))},{default:j(()=>[M(z(Ol),{"aria-label":e.label},{default:j(()=>[M(z(kl),{placeholder:`Choose workflow`})]),_:1},8,[`aria-label`]),M(z(Sl),null,{default:j(()=>[e.value&&!e.workflows.some(t=>t.id===e.value)?(R(),K(z(Tl),{key:0,value:e.value,disabled:``},{default:j(()=>[A(B(e.value)+` (unavailable)`,1)]),_:1},8,[`value`])):L(``,!0),(R(!0),W(V,null,G(e.workflows,e=>(R(),K(z(Tl),{key:e.id,value:e.id},{default:j(()=>[A(B(e.id),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1},8,[`model-value`]))}});function FJ(e){return e.ok?`Valid`:e.line?`Line ${e.line}: ${e.message}`:e.message}function IJ(e,t=[]){let n=Yq(e),r=n.errors[0];if(r)return{ok:!1,message:ZJ(r.message),line:r.linePos?.[0]?.line};let i=n.toJS();if(!QJ(i))return{ok:!1,message:`A workflow is a mapping with an id and steps.`};let a=typeof i.id==`string`?i.id.trim():``;if(!a)return{ok:!1,message:`workflow id is required`};let o=i.steps;if(o==null||o===``)return{ok:!1,message:`workflow ${a} has no steps`};if(!Array.isArray(o))return{ok:!1,message:`workflow ${a}: steps must be a list`};if(!o.length)return{ok:!1,message:`workflow ${a} has no steps`};let s=new Map(t.map(e=>[e.name,e])),c=typeof i.repository==`string`&&i.repository.trim()?i.repository.trim():`required`,l=[],u=new Set;for(let[e,t]of o.entries()){let n=`workflow ${a} step ${e+1}`,r=BJ(t);if(r)return{ok:!1,message:`${n}: ${r}`};let i=eJ(t);if(i){if(i.kind===`sLine truncated
|
||||
`).map((e,t)=>({number:t+1,text:e,tokens:qJ(e)}))}var GJ=/^(\s*)(-\s+)?/,KJ=/^([^:#\s][^:#]*?)(:)(\s*)(.*)$/;function qJ(e){let{code:t,comment:n}=JJ(e),r=YJ(t);return n&&r.push({text:n,kind:`comment`}),r}function JJ(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 YJ(e){if(!e)return[];let t=[],n=GJ.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=KJ.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,...XJ(i[4]??``)]):[...t,...XJ(r)]}function XJ(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 ZJ(e){return e.split(`
|
||||
`)[0]?.trim()||`invalid YAML`}function QJ(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function $J(e){return typeof e==`string`&&e.trim()!==``}var eY={class:`flex h-full w-[24rem] flex-col border-l border-border bg-card shadow-xl`},tY={class:`flex items-center gap-2.5 border-b border-border px-4 py-3`},nY={class:`flex size-8 shrink-0 items-center justify-center rounded-md bg-secondary text-primary`},rY={class:`min-w-0 flex-1`},iY={class:`truncate font-mono text-[11px] text-fg-subtle`},aY={class:`flex-1 space-y-5 overflow-y-auto px-4 py-4`},oY={key:0,class:`rounded-md bg-danger/10 px-2.5 py-1.5 text-xs text-danger`,role:`alert`},sY={key:1,class:`space-y-3`},cY={key:0,class:`block space-y-1.5`},lY={id:`switch-on`},uY=[`value`],dY={class:`text-xs font-medium text-muted-foreground`},fY={class:`flex items-center gap-2`},pY={key:1,role:`alert`,class:`text-xs text-danger`},mY={key:2,class:`space-y-1.5`},hY=[`title`],gY={key:4,class:`flex flex-wrap items-center gap-1 pt-0.5`},_Y={key:3,class:`divide-y divide-border rounded-md border border-border`},vY=[`title`],yY={key:0,class:`space-y-3`},bY={class:`text-[13px]`},xY={key:0,class:`text-danger`},SY={class:`ml-2 text-xs text-fg-subtle`},CY={key:1,class:`space-y-3`},wY={class:`text-[13px]`},TY={class:`ml-2 text-xs text-fg-subtle`},EY=[`title`],DY={key:0,class:`text-xs text-danger`},OY={class:`space-y-2`},kY={key:0,role:`alert`,class:`text-xs text-danger`},AY={class:`divide-y divide-border rounded-md border border-border`},jY={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},MY={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},NY={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},PY={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},FY=[`for`],IY={class:`flex items-center border-t border-border px-4 py-2.5`},LY=k({__name:`StepEditor`,props:{yaml:{},path:{},vocabulary:{},workflows:{},modelAliases:{}},emits:[`update:yaml`,`close`,`remove`],setup(e,{emit:t}){let n=Ue(),r=e,i=t,a=I(()=>nJ(r.yaml,r.path)??{}),o=I(()=>eJ(a.value)),s=I(()=>o.value?.kind??(typeof a.value.type==`string`?a.value.type:``)),c=I(()=>o.value?.branches.map(([e])=>e)??[]),l=I(()=>s.value===`parallel`?2:1);function u(e){i(`update:yaml`,rJ(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`?sJ(r.yaml,r.path,t):e===`rename`?cJ(r.yaml,r.path,t,n):lJ(r.yaml,r.path,t);i(`update:yaml`,a),d.value=``,f.value=``}catch(e){f.value=String(e.message)}}let m=I(()=>r.vocabulary.find(e=>e.name===s.value)),h=I(()=>typeof a.value.settings==`object`&&a.value.settings!==null?a.value.settings:{}),g=I(()=>pJ(r.yaml,r.path)),_=I(()=>BJ(a.value)),v=I(()=>m.value?.settings&&a.value.settings?HJ(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=I(()=>{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))}});function C(e){let{id:t,type:n,...a}=e;i(`update:yaml`,rJ(r.yaml,r.path,{id:t,type:n,...a}))}function w(e,t){C({...a.value,[e]:t})}function ee(e){let t={...a.value.retry,...e};w(`retry`,t.attempts===void 0&&!t.backoff?void 0:{...t,attempts:t.attempts??1})}function te(e,t){let n={...h.value,[e]:t};s.value===`workflow.call`&&e===`wait`&&t!==!0&&delete n.outputs,C({...a.value,settings:n})}function T(e,t){let n={...h.value,[e]:t};s.value===`workflow.call`&&t!==h.value[e]&&(delete n.inputs,delete n.outputs),C({...a.value,settings:n})}let E=I(()=>r.workflows.find(e=>e.id===h.value.workflow)),ne=I(()=>Object.entries(hJ(E.value?.yaml??``,`inputs`)??{})),re=I(()=>Object.entries(hJ(E.value?.yaml??``,`outputs`)??{})),ie=I(()=>Object.entries(hJ(r.yaml,`inputs`)??{})),ae=I(()=>Object.entries(hJ(r.yaml,`outputs`)??{})),D=I(()=>h.value.inputs??{}),O=I(()=>h.value.outputs??{}),oe=e=>typeof e==`string`&&e.startsWith(`inputs.`),se=e=>D.value[e]===void 0?``:String(D.value[e]);function ce(e,t,n){te(`inputs`,{...D.value,[e]:t===``?void 0:oe(t)?t:zv(t,n??`string`)})}let le=q(null);function ue(e,t){let n=le.value??S.value.lead?.key;if(!n)return;let r=typeof h.value[n]==`string`?h.value[n]:`Line truncated
|
||||
`)[0]}}}let pe=e=>e===void 0?``:Zq(e).trimEnd(),me=(e,t)=>t.title??e.replaceAll(`_`,` `).replace(/^./,e=>e.toUpperCase()),he=e=>typeof h.value[e]==`string`?h.value[e]:``;return(t,r)=>(R(),W(`aside`,eY,[U(`header`,tY,[U(`span`,nY,[(R(),K(Qe(z(MJ)(s.value)),{class:`size-4`}))]),U(`div`,rY,[M(z(Z),{"model-value":a.value.id??``,class:`h-7 truncate border-transparent px-1 font-medium shadow-none hover:border-input dark:bg-transparent`,placeholder:z(CJ)(s.value),"aria-label":`Step id`,"onUpdate:modelValue":r[0]||=e=>w(`id`,String(e))},null,8,[`model-value`,`placeholder`]),U(`div`,iY,B(s.value),1)]),M(z(Y),{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Close`,onClick:r[1]||=e=>i(`close`)},{default:j(()=>[M(z(Sc))]),_:1})]),U(`div`,aY,[v.value?(R(),W(`p`,oY,B(v.value),1)):L(``,!0),o.value?(R(),W(`section`,sY,[s.value===`switch`?(R(),W(`label`,cY,[r[18]||=U(`span`,{class:`text-xs font-medium text-muted-foreground`,title:`The value whose case runs; a case named default runs when none matches`},`Switch on`,-1),M(z(Z),{"model-value":o.value.on,class:`font-mono`,placeholder:`steps.assess.result.fit`,list:`switch-on`,onChange:r[2]||=e=>u(e.target.value.trim())},null,8,[`model-value`]),U(`datalist`,lY,[(R(!0),W(V,null,G(g.value,e=>(R(),W(`option`,{key:e,value:`steps.${e}.result.`},null,8,uY))),128))])])):L(``,!0),U(`div`,dY,B(s.value===`switch`?`Cases`:`Branches`),1),(R(!0),W(V,null,G(c.value,e=>(R(),W(`div`,{key:e,class:`flex items-center gap-2`},[M(z(Z),{"model-value":e,class:N(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`]),M(z(Y),{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Remove ${e}`,disabled:c.value.length<=l.value,onClick:t=>p(`delete`,e)},{default:j(()=>[M(z(Ne))]),_:1},8,[`aria-label`,`disabled`,`onClick`])]))),128)),U(`div`,fY,[M(z(Z),{modelValue:d.value,"onUpdate:modelValue":r[3]||=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[4]||=kt(jt(e=>p(`add`,d.value.trim()),[`prevent`]),[`enter`])},null,8,[`modelValue`,`aria-label`,`placeholder`]),M(z(Y),{type:`button`,size:`icon-sm`,variant:`outline`,"aria-label":s.value===`switch`?`Add case`:`Add branch`,disabled:!d.value.trim(),onClick:r[5]||=e=>p(`add`,d.value.trim())},{default:j(()=>[M(z(rc))]),_:1},8,[`aria-label`,`disabled`])]),f.value?(R(),W(`p`,pY,B(f.value),1)):L(``,!0)])):L(``,!0),S.value.lead?(R(),W(`section`,mY,[U(`div`,{class:`flex items-center gap-1 text-xs font-medium text-muted-foreground`,title:S.value.lead.schema.description},[A(B(me(S.value.lead.key,S.value.lead.schema))+` `,1),S.value.lead.schema.description?(R(),K(z(Ps),{key:0,class:`size-3 text-fg-subtle`})):L(``,!0)],8,hY),S.value.lead.kind===`workflow`?(R(),K(PJ,{key:0,value:he(S.value.lead.key),workflows:e.workflows,label:me(S.value.lead.key,S.value.lead.schema),onPick:r[6]||=e=>T(S.value.lead.key,e)},null,8,[`value`,`workflows`,`label`])):S.value.lead.kind===`select`?(R(),K(z(Mv),{key:1,size:`sm`,class:`w-full`,"model-value":he(S.value.lead.key),"onUpdate:modelValue":r[7]||=e=>te(S.value.lead.key,String(e)||void 0)},{default:j(()=>[M(z(Nv),{value:``},{default:j(()=>[...r[19]||=[A(`Default`,-1)]]),_:1}),(R(!0),W(V,null,G(S.value.lead.options,e=>(R(),K(z(Nv),{key:e,value:e},{default:j(()=>[A(B(e),1)]),_:2},1032,[`value`]))),128))]),_:1},8,[`model-value`])):S.value.lead.kind===`text`?(R(),K(z(Kl),{key:2,"model-value":he(S.value.lead.key),class:`min-h-40 text-[13px] leading-relaxed`,onFocus:r[8]||=e=>le.value=S.value.lead.key,"onUpdate:modelValue":r[9]||=e=>te(S.value.lead.key,String(e))},null,8,[`model-value`])):(R(),K(z(Z),{key:3,"model-value":he(S.value.lead.key),onFocus:r[10]||=e=>le.value=S.value.lead.key,"onUpdate:modelValue":r[11]||=e=>te(S.value.lead.key,String(e))},null,8,[`model-value`])),g.value.length&&S.value.lead.kind!==`select`?(R(),W(`div`,gY,[r[20]||=U(`span`,{class:`text-[11px] text-fg-subtle`},`Insert`,-1),(R(!0),W(V,null,G(g.value,e=>(R(),W(V,{key:e},[M(z(Y),{type:`button`,variant:`outline`,size:`xs`,class:`font-mono`,onClick:t=>ue(e,`summary`)},{default:j(()=>[A(B(e),1)]),_:2},1032,[`onClick`]),M(z(Y),{type:`button`,variant:`outline`,size:`xs`,class:`font-mono`,onClick:t=>ue(e,`result`)},{default:j(()=>[A(B(e)+`.result`,1)]),_:2},1032,[`onClick`])],64))),128))])):L(``,!0)])):L(``,!0),S.value.compact.length?(R(),W(`section`,_Y,[(R(!0),W(V,null,G(S.value.compact,t=>(R(),W(`div`,{key:t.key,class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},[U(`span`,{class:`flex flex-1 items-center gap-1 text-[13px]`,title:t.schema.description},[A(B(me(t.key,t.schema))+` `,1),t.schema.description?(R(),K(z(Ps),{key:0,class:`size-3 text-fg-subtle`})):L(``,!0)],8,vY),t.kind===`workflow`?(R(),K(PJ,{key:0,class:`max-w-48`,value:he(t.key),workflows:e.workflows,label:me(t.key,t.schema),onPick:e=>T(t.key,e)},null,8,[`Line truncated
|
||||
`):``,class:`min-h-16 font-mono text-xs`,placeholder:`One per line`,"onUpdate:modelValue":t=>te(e.key,String(t).split(`
|
||||
`).filter(Boolean))},null,8,[`model-value`,`onUpdate:modelValue`])):(R(),W(V,{key:2},[M(z(Kl),{"model-value":pe(h.value[e.key]),class:`min-h-24 font-mono text-xs`,placeholder:`YAML`,onChange:t=>fe(e.key,t.target.value)},null,8,[`model-value`,`onChange`]),de.value[e.key]?(R(),W(`span`,DY,B(de.value[e.key]),1)):L(``,!0)],64))]))),128)),U(`section`,OY,[r[36]||=U(`div`,{class:`text-xs font-medium text-muted-foreground`},`Flow`,-1),r[37]||=U(`p`,{class:`text-xs text-fg-muted`},`Leave the condition empty to always run. Use a field such as inputs.enabled, !inputs.skip, or steps.plan.result.ready == true.`,-1),_.value?(R(),W(`p`,kY,B(_.value),1)):L(``,!0),U(`div`,AY,[U(`label`,jY,[r[31]||=U(`span`,{class:`flex-1 text-[13px]`},`Run only when`,-1),M(z(Z),{class:`h-7 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[12]||=e=>w(`when`,String(e))},null,8,[`aria-invalid`,`model-value`])]),U(`label`,MY,[r[34]||=U(`span`,{class:`flex-1 text-[13px]`},`If it fails`,-1),M(z(Mv),{size:`sm`,"model-value":a.value.on_failure??``,"onUpdate:modelValue":r[13]||=e=>w(`on_failure`,String(e)||void 0)},{default:j(()=>[M(z(Nv),{value:``},{default:j(()=>[...r[32]||=[A(`Park the task`,-1)]]),_:1}),M(z(Nv),{value:`continue`},{default:j(()=>[...r[33]||=[A(`Continue`,-1)]]),_:1})]),_:1},8,[`model-value`])]),U(`label`,NY,[r[35]||=U(`span`,{class:`flex-1 text-[13px]`},`Attempts`,-1),M(z(Z),{type:`number`,min:`1`,max:`10`,placeholder:`1`,class:`h-7 w-20 text-right text-[13px]`,"model-value":a.value.retry?.attempts??``,"onUpdate:modelValue":r[14]||=e=>ee({attempts:String(e)===``?void 0:Number(String(e))})},null,8,[`model-value`])]),U(`div`,PY,[U(`label`,{for:`${z(n)}-backoff`,class:`flex-1 text-[13px]`},`Retry backoff`,8,FY),M(z(ph),{id:`${z(n)}-backoff`,"model-value":a.value.retry?.backoff??``,units:[`s`,`m`,`h`],"onUpdate:modelValue":r[15]||=e=>ee({backoff:e||void 0})},null,8,[`id`,`model-value`])])])])]),U(`footer`,IY,[M(z(Y),{type:`button`,variant:`ghost`,size:`sm`,class:`text-danger`,onClick:r[16]||=e=>i(`remove`)},{default:j(()=>[M(z(Ne)),r[38]||=A(`Delete step`,-1)]),_:1}),M(z(Y),{type:`button`,size:`sm`,class:`ml-auto`,onClick:r[17]||=e=>i(`close`)},{default:j(()=>[...r[39]||=[A(`Done`,-1)]]),_:1})])]))}}),RY=`repository_path`;function zY(e,t,n){let r=[];for(let[n,i]of e){let e=t[n];e?.from===`path`&&e.path.trim()&&r.push({name:n,path:e.path.trim(),type:i.type??`string`,required:i.required===!0})}return n.trim()&&r.push({name:RY,path:n.trim(),type:`string`,required:!0}),r}function BY(e){return Array.isArray(e)?`array`:e===null?`null`:typeof e==`boolean`?`bool`:typeof e==`object`?`object`:typeof e}function VY(e,t,n){let r=[];for(let[i,a]of e){let e=t[i],o=a.type??`string`;if(!(e&&(e.from===`path`?e.path.trim():e.value!==``))){a.required&&r.push(`${i} is required`);continue}if(e.from===`path`){let e=n?.failures?.find(e=>e.field_name===i);e&&r.push(`${i}: ${e.reason}`);continue}let s=BY(yb(e.value,o));o!==`any`&&s!==o&&r.push(`${i} is ${o}, but ${JSON.stringify(e.value)} is not`)}return n?.failures?.some(e=>e.field_name===`repository_path`)&&r.push(`the repository path does not resolve`),r}function HY(e,t){let n={};for(let[r,i]of e){let e=t[r];e?.from===`path`&&e.path.trim()?n[r]={param:r}:e?.from===`value`&&e.value!==``&&(n[r]={value:yb(e.value,i.type??`string`)})}return n}function UY(e,t){let n=e=>t.find(t=>t.name===e)?.path??``,r={};for(let[t,i]of Object.entries(e.inputs??{}))r[t]=i.param?{from:`path`,path:n(i.param),value:``}:{from:`value`,path:``,value:typeof i.value==`string`?i.value:JSON.stringify(i.value)};return{rows:r,repositoryPath:n(e.repo_param)}}function WY(e,t=``){return Array.isArray(e)?e.slice(0,3).flatMap((e,n)=>{let r=`${t}[${n}]`;return[r,...WY(e,r)]}):e&&typeof e==`object`?Object.entries(e).flatMap(([e,n])=>{let r=t?`${t}.${e}`:e;return[r,...WY(n,r)]}):[]}function GY(e){try{return e?.body?JSON.parse(e.body):null}catch{return null}}function KY(e){try{let t=JSON.parse(e.headers??`{}`);return Object.fromEntries(Object.entries(t).map(([e,t])=>[e,Array.isArray(t)?t.join(`, `):String(t)]))}catch{return{}}}function qY(e){let t=typeof e==`string`?e:JSON.stringify(e);return t.length>80?`${t.slice(0,80)}…`:t}var JY={class:`flex h-full flex-col`},YY={class:`flex items-center gap-2 border-b border-border px-4 py-3`},XY={class:`min-w-0 flex-1 truncate text-sm font-medium`},ZY={key:0,class:`flex flex-1 items-center justify-center`},QY={class:`space-y-1.5`},$Y={key:1,class:`space-y-1.5`},eX=[`title`],tX={class:`space-y-1.5`},nX={id:`bind-paths`},rX=[`value`],iX={class:`divide-y divide-border rounded-md border border-border`},aX={class:`flex items-center gap-1.5 text-xs`},oX={class:`font-mono`},sX={class:`text-fg-subtle`},cX={key:0,class:`text-danger`,title:`Required`},lX={key:2,class:`text-xs text-danger`},uX=[`title`],dX={key:0,class:`space-y-1 px-3 py-2`},fX={key:0,class:`text-xs text-danger`},pX={key:1,class:`truLine 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=Jq(qq(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=Jq(qq(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 Qq(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new Uq||null,prettyErrors:t}}function $q(e,t={}){let{lineCounter:n,prettyErrors:r}=Qq(t),i=new Zq(n?.addNewLine),a=new kq(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 GK(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(qK(e,n)),o.warnings.forEach(qK(e,n))),o}function eJ(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let i=$q(e,n);if(!i)return null;if(i.warnings.forEach(e=>CG(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 tJ(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 vW(e)&&!r?e.toString(n):new HK(e,r,n).toString(n)}var nJ=e=>typeof e==`object`&&!!e&&!Array.isArray(e),rJ=e=>nJ(e)?Object.entries(e).map(([e,t])=>[e,Array.isArray(t)?t:[]]):[];function iJ(e){if(nJ(e)){if(nJ(e.parallel))return{kind:`parallel`,base:[`parallel`],branches:rJ(e.parallel)};if(nJ(e.switch))return{kind:`switch`,base:[`switch`,`cases`],on:typeof e.switch.on==`string`?e.switch.on:``,branches:rJ(e.switch.cases)}}}function aJ(e){return e.slice(2).includes(`parallel`)}function oJ(e,t){let n=$q(e).getIn(t,!0);if(yW(n))return n.toJSON()}function sJ(e,t,n){let r=$q(e);return r.setIn(t,r.createNode(vJ(n))),r.toString()}function cJ(e,t,n){let r=$q(e),i=t.slice(0,-1),a=aJ(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(SW(o)||(r.setIn(i,r.createNode([])),o=r.getIn(i,!0)),!SW(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 lJ(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 uJ(e,t){let n=e.getIn(t,!0),r=iJ(yW(n)?n.toJSON():void 0),i=r?e.getIn([...t,...r.base],!0):void 0;if(!r||!yW(i))throw Error(`This step has no branches.`);return{kind:r.kind,branches:i}}function dJ(e,t,n){let r=$q(e),{kind:i,branches:a}=uJ(r,t);if(lJ(n,i),a.has(n))throw Error(`Branch ${n} already exists.`);return a.set(n,r.createNode([])),r.toString()}function fJ(e,t,n,r){let i=$q(e),{kind:a,branches:o}=uJ(i,t);if(lJ(r,a),n!==r&&o.has(r))throw Error(`Branch ${r} already exists.`);let s=o.items.find(e=>xW(e.key)&&e.key.value===n);if(!s||!xW(s.key))throw Error(`Branch ${n} does not exist.`);return s.key.value=r,i.toString()}function pJ(e,t,n){let r=$q(e),{kind:i,branches:a}=uJ(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 jJ(e,t){let n=JSON.stringify(e??{})+` `+(typeof t==`string`?`{{ ${t.replace(/^!/,``)} }}`:``);return[...new Set([...n.matchAll(DJ)].map(e=>e[1]))]}function MJ(e){let t=$q(e).toJS(),n=OJ(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=OJ(e)?e:{},p=iJ(d),m=p?.kind??(typeof d.type==`string`?d.type:``),h=OJ(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||EJ(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\./,``)}`:kJ(m,h),summary:AJ(h),when:typeof d.when==`string`?d.when:void 0,retry:OJ(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 jJ([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=iJ(t);if(n){let{kind:i,base:a,branches:o}=n,c=p(t,String(e+1),0,u*CJ,void 0,void 0,[`steps`,e]);m(l,c,[`steps`,e-1]),u++;let d=OJ(t)&&typeof t.id==`string`?t.id:i,f=i===`switch`&&!o.some(([e])=>e==="default"),h=o.length+ +!!f,g=[],_=0;o.forEach(([t,n],o)=>{let s=(o-(h-1)/2)*wJ,l=[c],f=[`steps`,e,...a,t];n.forEach((n,r)=>{let a=p(n,`${e+1}-${t}-${r+1}`,s,(u+r)*CJ,t,d,[...f,r],i);m(l,a,[...f,r-1]),l=[a]}),_=Math.max(_,n.length);let v=`add-${e}-${t}`;r.push({id:v,type:`add`,position:{x:s+104,y:(u+n.length)*CJ},data:{kind:`step`,key:v,title:``,type:``,detail:``,branch:t,lane:i,insertAfter:[...f,n.length-1]}}),m(l,v),g.push(v)});let v=(Math.max(_,1)+1)*CJ-24;o.forEach(([t],n)=>{let a=(n-(h-1)/2)*wJ;r.push({id:`lane-${e}-${t}`,type:`lane`,position:{x:a-12,y:u*CJ-40},style:{width:`264px`,height:`${v}px`},zIndex:-1,data:{kind:`step`,key:t,title:t,type:``,detail:``,lane:i}})}),f&&(g.push(c),s.add(c)),l=g,u+=Math.max(_,1)+1;continue}let i=p(t,String(e+1),0,u*CJ,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*CJ-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 NJ=`\0`,PJ=k({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)=>(R(),K(z(wl),{"model-value":e.modelValue===``&&e.options.some(e=>e.value===``)?NJ:e.modelValue||void 0,disabled:e.disabled,"onUpdate:modelValue":r[0]||=e=>n(`update:modelValue`,e===NJ?``:String(e))},{default:j(()=>[M(z(jl),H({size:e.size??`sm`,class:t.$props.class},t.$attrs),{default:j(()=>[M(z(Ml),{placeholder:e.placeholder},null,8,[`placeholder`])]),_:1},16,[`size`,`class`]),M(z(Tl),null,{default:j(()=>[(R(!0),W(V,null,G(e.options,e=>(R(),K(z(Ol),{key:e.value,value:e.value===``?NJ:e.value,disabled:e.disabled},{default:j(()=>[A(B(e.label),1)]),_:2},1032,[`value`,`disabled`]))),128))]),_:1})]),_:1},8,[`model-value`,`disabled`]))}}),FJ=k({__name:`WorkflowPicker`,props:{value:{},workflows:{},label:{}},emits:[`pick`],setup(e,{emit:t}){let n=t;return(t,r)=>(R(),K(z(wl),{"model-value":e.value||void 0,"onUpdate:modelValue":r[0]||=e=>n(`pick`,String(e))},{default:j(()=>[M(z(jl),{"aria-label":e.label},{default:j(()=>[M(z(Ml),{placeholder:`Choose workflow`})]),_:1},8,[`aria-label`]),M(z(Tl),null,{default:j(()=>[e.value&&!e.workflows.some(t=>t.id===e.value)?(R(),K(z(Ol),{key:0,value:e.value,disabled:``},{default:j(()=>[A(B(e.value)+` (unavailable)`,1)]),_:1},8,[`value`])):L(``,!0),(R(!0),W(V,null,G(e.workflows,e=>(R(),K(z(Ol),{key:e.id,value:e.id},{default:j(()=>[A(B(e.id),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1},8,[`model-value`]))}});function IJ(e){return e.ok?`Valid`:e.line?`Line ${e.line}: ${e.message}`:e.message}function LJ(e,t=[]){let n=$q(e),r=n.errors[0];if(r)return{ok:!1,message:QJ(r.message),line:r.linePos?.[0]?.line};let i=n.toJS();if(!$J(i))return{ok:!1,message:`A workflow is a mapping with an id and steps.`};let a=typeof i.id==`string`?i.id.trim():``;if(!a)return{ok:!1,message:`workflow id is required`};let o=i.steps;if(o==null||o===``)return{ok:!1,message:`workflow ${a} has no steps`};if(!Array.isAr
Line truncated
|
||||
`).map((e,t)=>({number:t+1,text:e,tokens:JJ(e)}))}var KJ=/^(\s*)(-\s+)?/,qJ=/^([^:#\s][^:#]*?)(:)(\s*)(.*)$/;function JJ(e){let{code:t,comment:n}=YJ(e),r=XJ(t);return n&&r.push({text:n,kind:`comment`}),r}function YJ(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 XJ(e){if(!e)return[];let t=[],n=KJ.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=qJ.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,...ZJ(i[4]??``)]):[...t,...ZJ(r)]}function ZJ(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 QJ(e){return e.split(`
|
||||
`)[0]?.trim()||`invalid YAML`}function $J(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function eY(e){return typeof e==`string`&&e.trim()!==``}var tY={class:`space-y-4 px-3 py-3`},nY={key:0,class:`rounded-md bg-danger/10 px-2.5 py-1.5 text-xs text-danger`,role:`alert`},rY={key:1,class:`space-y-3`},iY={key:0,class:`block space-y-1.5`},aY=[`id`],oY=[`value`],sY={class:`text-xs font-medium text-muted-foreground`},cY={class:`flex items-center gap-2`},lY={key:1,role:`alert`,class:`text-xs text-danger`},uY={key:2,class:`space-y-1.5`},dY=[`title`],fY={key:4,class:`flex flex-wrap items-center gap-1 pt-0.5`},pY={key:0,class:`divide-y divide-border rounded-md border border-border`},mY=[`title`],hY={key:0,class:`space-y-3`},gY={class:`text-[13px]`},_Y={key:0,class:`text-danger`},vY={class:`ml-2 text-xs text-fg-subtle`},yY={key:1,class:`space-y-3`},bY={class:`text-[13px]`},xY={class:`ml-2 text-xs text-fg-subtle`},SY=[`title`],CY={key:0,class:`text-xs text-danger`},wY={class:`space-y-1.5`},TY={key:0,role:`alert`,class:`text-xs text-danger`},EY={class:`divide-y divide-border rounded-md border border-border`},DY={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},OY={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},kY={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},AY={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},jY=[`for`],MY=k({__name:`StepEditor`,props:{yaml:{},path:{},vocabulary:{},workflows:{},modelAliases:{}},emits:[`update:yaml`],setup(e,{emit:t}){let n=Ue(),r=e,i=t,a=I(()=>oJ(r.yaml,r.path)??{}),o=I(()=>iJ(a.value)),s=I(()=>o.value?.kind??(typeof a.value.type==`string`?a.value.type:``)),c=I(()=>o.value?.branches.map(([e])=>e)??[]),l=I(()=>s.value===`parallel`?2:1);function u(e){i(`update:yaml`,sJ(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`?dJ(r.yaml,r.path,t):e===`rename`?fJ(r.yaml,r.path,t,n):pJ(r.yaml,r.path,t);i(`update:yaml`,a),d.value=``,f.value=``}catch(e){f.value=String(e.message)}}let m=I(()=>r.vocabulary.find(e=>e.name===s.value)),h=I(()=>typeof a.value.settings==`object`&&a.value.settings!==null?a.value.settings:{}),g=I(()=>_J(r.yaml,r.path)),_=I(()=>VJ(a.value)),v=I(()=>m.value?.settings&&a.value.settings?UJ(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 ee(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 x=I(()=>{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:ee(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))}}),S=q(!x.value.lead&&!o.value),C=e=>[{value:``,label:`Default`},...e.map(e=>({value:e,label:e}))];function te(e){let{id:t,type:n,...a}=e;i(`update:yaml`,sJ(r.yaml,r.path,{id:t,type:n,...a}))}function ne(e,t){te({...a.value,[e]:t})}function w(e){let t={...a.value.retry,...e};ne(`retry`,t.attempts===void 0&&!t.backoff?void 0:{...t,attempts:t.attempts??1})}function T(e,t){let n={...h.value,[e]:t};s.value===`workflow.call`&&e===`wait`&&t!==!0&&delete n.outputs,te({...a.value,settings:n})}function re(e,t){let n={...h.value,[e]:t};s.value===`workflow.call`&&t!==h.value[e]&&(delete n.inputs,delete n.outputs),te({...a.value,settings:n})}let E=I(()=>r.workflows.find(e=>e.id===h.value.workflow)),ie=I(()=>Object.entries(yJ(E.value?.yaml??``,`inputs`)??{})),ae=I(()=>Object.entries(yJ(E.value?.yaml??``,`outputs`)??{})),D=I(()=>Object.entries(yJ(r.yaml,`inputs`)??{})),O=I(()=>Object.entries(yJ(r.yaml,`outputs`)??{})),oe=I(()=>h.value.inputs??{}),se=I(()=>h.value.outputs??{}),ce=e=>typeof e==`string`&&e.startsWith(`inputs.`),le=e=>[`object`,`array`].includes(e.type??``),ue=e=>oe.value[e]===void 0?``:String(oe.value[e]);function de(e,t,n){T(`inputs`,{...oe.value,[e]:t===``?void 0:ce(t)?t:Hv(t,n??`string`)})}let fe=(e,t,n)=>e.filter(([,e])=>e.type===t.type||e.type===`any`||t.type===`any`).map(([e])=>({value:`${n}.${e}`,label:e})),pe=q(null);function me(e,t){let n=pe.value??x.value.lead?.key;if(!n)return;let r=typeof h.value[n]==`string`?h.value[n]:``,i=`{{ steps.${e}.${t} }}`;T(n,r?`${r.trimEnd()} ${i}`:i)}let he=q({});function ge(e,t){try{T(e,t.trim()?eJ(t):void 0),he.value={...he.value,[e]:``}}catch(t){he.value={...he.value,[e]:S
Line truncated
|
||||
`)[0]}}}let _e=e=>e===void 0?``:tJ(e).trimEnd(),ve=(e,t)=>t.title??e.replaceAll(`_`,` `).replace(/^./,e=>e.toUpperCase()),ye=e=>typeof h.value[e]==`string`?h.value[e]:``,be=[{value:``,label:`Park the task`},{value:`continue`,label:`Continue`}];return(t,r)=>(R(),W(`div`,tY,[v.value?(R(),W(`p`,nY,B(v.value),1)):L(``,!0),o.value?(R(),W(`section`,rY,[s.value===`switch`?(R(),W(`label`,iY,[r[15]||=U(`span`,{class:`text-xs font-medium text-muted-foreground`,title:`The value whose case runs; a case named default runs when none matches`},`Switch on`,-1),M(z(Z),{"model-value":o.value.on,class:`font-mono`,placeholder:`steps.assess.result.fit`,list:`${z(n)}-switch-on`,onChange:r[0]||=e=>u(e.target.value.trim())},null,8,[`model-value`,`list`]),U(`datalist`,{id:`${z(n)}-switch-on`},[(R(!0),W(V,null,G(g.value,e=>(R(),W(`option`,{key:e,value:`steps.${e}.result.`},null,8,oY))),128))],8,aY)])):L(``,!0),U(`div`,sY,B(s.value===`switch`?`Cases`:`Branches`),1),(R(!0),W(V,null,G(c.value,e=>(R(),W(`div`,{key:e,class:`flex items-center gap-2`},[M(z(Z),{"model-value":e,class:N(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`]),M(z(J),{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Remove ${e}`,disabled:c.value.length<=l.value,onClick:t=>p(`delete`,e)},{default:j(()=>[M(z(Ne))]),_:1},8,[`aria-label`,`disabled`,`onClick`])]))),128)),U(`div`,cY,[M(z(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]||=kt(jt(e=>p(`add`,d.value.trim()),[`prevent`]),[`enter`])},null,8,[`modelValue`,`aria-label`,`placeholder`]),M(z(J),{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:j(()=>[M(z(oc))]),_:1},8,[`aria-label`,`disabled`])]),f.value?(R(),W(`p`,lY,B(f.value),1)):L(``,!0)])):L(``,!0),x.value.lead?(R(),W(`section`,uY,[U(`div`,{class:`flex items-center gap-1 text-xs font-medium text-muted-foreground`,title:x.value.lead.schema.description},[A(B(ve(x.value.lead.key,x.value.lead.schema))+` `,1),x.value.lead.schema.description?(R(),K(z(Fs),{key:0,class:`size-3 text-fg-subtle`})):L(``,!0)],8,dY),x.value.lead.kind===`workflow`?(R(),K(FJ,{key:0,value:ye(x.value.lead.key),workflows:e.workflows,label:ve(x.value.lead.key,x.value.lead.schema),onPick:r[4]||=e=>re(x.value.lead.key,e)},null,8,[`value`,`workflows`,`label`])):x.value.lead.kind===`select`?(R(),K(PJ,{key:1,class:`w-full`,"model-value":ye(x.value.lead.key),options:C(x.value.lead.options),"aria-label":ve(x.value.lead.key,x.value.lead.schema),"onUpdate:modelValue":r[5]||=e=>T(x.value.lead.key,e||void 0)},null,8,[`model-value`,`options`,`aria-label`])):x.value.lead.kind===`text`?(R(),K(z(Yl),{key:2,"model-value":ye(x.value.lead.key),class:`min-h-32 text-[13px] leading-relaxed`,onFocus:r[6]||=e=>pe.value=x.value.lead.key,"onUpdate:modelValue":r[7]||=e=>T(x.value.lead.key,String(e))},null,8,[`model-value`])):(R(),K(z(Z),{key:3,"model-value":ye(x.value.lead.key),onFocus:r[8]||=e=>pe.value=x.value.lead.key,"onUpdate:modelValue":r[9]||=e=>T(x.value.lead.key,String(e))},null,8,[`model-value`])),g.value.length&&x.value.lead.kind!==`select`?(R(),W(`div`,fY,[r[16]||=U(`span`,{class:`text-[11px] text-fg-subtle`},`Insert`,-1),(R(!0),W(V,null,G(g.value,e=>(R(),W(V,{key:e},[M(z(J),{type:`button`,variant:`outline`,size:`xs`,class:`font-mono`,onClick:t=>me(e,`summary`)},{default:j(()=>[A(B(e),1)]),_:2},1032,[`onClick`]),M(z(J),{type:`button`,variant:`outline`,size:`xs`,class:`font-mono`,onClick:t=>me(e,`result`)},{default:j(()=>[A(B(e)+`.result`,1)]),_:2},1032,[`onClick`])],64))),128))])):L(``,!0)])):L(``,!0),M(z(J),{type:`button`,variant:`ghost`,size:`xs`,class:`-ml-2 text-muted-foreground`,"aria-expanded":S.value,onClick:r[10]||=e=>S.value=!S.value},{default:j(()=>[M(z($t),{"data-icon":`inline-start`,class:N([`transition-transform`,!S.value&&`-rotate-90`])},null,8,[`class`]),r[17]||=A(`More `,-1)]),_:1},8,[`aria-expanded`]),S.value?(R(),W(V,{key:3},[x.value.compact.length?(R(),W(`section`,pY,[(R(!0),W(V,null,G(x.value.compact,t=>(R(),W(`div`,{key:t.key,class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},[U(`span`,{class:`flex flex-1 items-center gap-1 text-[13px]`,title:t.schema.description},[A(B(ve(t.key,t.schema))+` `,1),t.schema.description?(R(),K(z(Fs),{key:0,class:`size-3 text-fg-subtle`})):L(``,!0)],8,mY),t.kind===`workflow`?(R(),K(FJ,{key:0,class:`max-w-48`,value:ye(t.key),workflows:e.workflows,label:ve(t.key,t.schema),onPick:e=>re(t.key,e)},null,8,[`value`,`workflows`,`label`,`onPick`])):t.kind===`boolean`?(R(),K(z(Dh),{key:1,"model-value":h.value[t.key]===!0,"onUpdate:modelValue":e=>T(t.key,e||void 0)},null,8,[`model-value`,`onUpdate:modelValue`])):t.kind===`selecLine truncated
|
||||
`):``,class:`min-h-16 font-mono text-xs`,placeholder:`One per line`,"onUpdate:modelValue":t=>T(e.key,String(t).split(`
|
||||
`).filter(Boolean))},null,8,[`model-value`,`onUpdate:modelValue`])):(R(),W(V,{key:2},[M(z(Yl),{"model-value":_e(h.value[e.key]),class:`min-h-24 font-mono text-xs`,placeholder:`YAML`,onChange:t=>ge(e.key,t.target.value)},null,8,[`model-value`,`onChange`]),he.value[e.key]?(R(),W(`span`,CY,B(he.value[e.key]),1)):L(``,!0)],64))]))),128)),U(`section`,wY,[_.value?(R(),W(`p`,TY,B(_.value),1)):L(``,!0),U(`div`,EY,[U(`label`,DY,[r[20]||=U(`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),M(z(Z),{class:`h-7 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=>ne(`when`,String(e))},null,8,[`aria-invalid`,`model-value`])]),U(`label`,OY,[r[21]||=U(`span`,{class:`flex-1 text-[13px]`},`If it fails`,-1),M(PJ,{class:`w-36`,"aria-label":`If it fails`,"model-value":a.value.on_failure??``,options:be,"onUpdate:modelValue":r[12]||=e=>ne(`on_failure`,e||void 0)},null,8,[`model-value`])]),U(`label`,kY,[r[22]||=U(`span`,{class:`flex-1 text-[13px]`},`Attempts`,-1),M(z(Z),{type:`number`,min:`1`,max:`10`,placeholder:`1`,class:`h-7 w-20 text-right text-[13px]`,"model-value":a.value.retry?.attempts??``,"onUpdate:modelValue":r[13]||=e=>w({attempts:String(e)===``?void 0:Number(String(e))})},null,8,[`model-value`])]),U(`div`,AY,[U(`label`,{for:`${z(n)}-backoff`,class:`flex-1 text-[13px]`},`Retry backoff`,8,jY),M(z(gh),{id:`${z(n)}-backoff`,"model-value":a.value.retry?.backoff??``,units:[`s`,`m`,`h`],"onUpdate:modelValue":r[14]||=e=>w({backoff:e||void 0})},null,8,[`id`,`model-value`])])])])],64)):L(``,!0)]))}}),NY={class:`space-y-1.5`},PY={class:`flex items-center text-xs font-medium text-muted-foreground`},FY={key:0,class:`divide-y divide-border rounded-md border border-border`},IY=k({__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=I(()=>Object.entries(yJ(n.yaml,n.field)??{}));function o(e){r(`update:yaml`,bJ(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)=>(R(),W(`section`,NY,[U(`div`,PY,[A(B(e.field===`inputs`?`Inputs`:`Outputs`)+` `,1),M(z(J),{type:`button`,variant:`ghost`,size:`xs`,class:`ml-auto`,onClick:c},{default:j(()=>[M(z(oc),{"data-icon":`inline-start`}),n[0]||=A(`Add`,-1)]),_:1})]),a.value.length?(R(),W(`div`,FY,[(R(!0),W(V,null,G(a.value,([t,n],r)=>(R(),W(`div`,{key:r,class:`flex items-center gap-2 px-2 py-1.5`},[M(z(Z),{"model-value":t,class:`h-7 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`]),M(PJ,{"model-value":n.type??`string`,options:z(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`]),M(z(Dh),{"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`]),M(z(J),{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":`Remove ${t}`,onClick:e=>o(a.value.filter((e,t)=>t!==r))},{default:j(()=>[M(z(Ne))]),_:1},8,[`aria-label`,`onClick`])]))),128))])):L(``,!0)]))}}),LY={class:`space-y-4 px-3 py-3`},RY={class:`divide-y divide-border rounded-md border border-border`},zY={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},BY={key:0,role:`alert`,class:`px-3 py-2 text-xs text-danger`},VY={key:1,class:`px-3 py-2 text-xs text-fg-subtle`},HY={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},UY={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},WY={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},GY={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},KY={class:`space-y-1.5`},qY=`6f129e29-0e26-5246-99bd-74cb4496203b`,JY=k({__name:`WorkflowSettings`,props:{yaml:{}},emits:[`update:yaml`],setup(e,{emit:t}){let n=e,r=t,i=e=>{let t=yJ(n.yaml,e);return typeof t==`string`?t:``};function a(e,t){r(`update:yaml`,bJ(n.yaml,e,t))}let o=i_(),s=q([]),c=q(!0),l=q(``);async function u(){c.value=!0,l.value=``,s.value=[];try{await o.loadOrg();let e=await Y.orgAgents(o.homeOrg);s.value=e.agents.filter(e=>e.lifecycle===`active`),!i(`identity`)&&s.value.some(e=>e.id===qY)&&a(`identity`,qY)}catch(e){l.value=String(e.message||e)}finally{c.value=!1}}ht(u);let d=I(()=>{let e=i(`identity`),t=s.value.map(e=>({value:e.id,label:e.display_name}));return e&&!s.value.some(t=>t.id===e)?[{value:e,label:`${e} (unknown)`,disabled:!0},...t]:t}),f=D(),p=I(()=>{let e=Object.keys(f.stateFor(`agent-profiLine 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 w4(e,t){return n=>{if(!n.code&&!n.key)return!1;let r=T4(n.code,e);return Array.isArray(e)?e.some(e=>C4(n[r],e,t,n.type===`keyup`)):C4(n[r],e,t,n.type===`keyup`)}}function T4(e,t){return t.includes(e)?`code`:`key`}function E4(e,t){let n=I(()=>Ve(t?.target)??b4),r=Xe(Ve(e)===!0),i=!1,a=new Set,o=c(Ve(e));F(()=>Ve(e),(e,t)=>{typeof t==`boolean`&&typeof e!=`boolean`&&s(),o=c(e)},{immediate:!0}),vZ([`blur`,`contextmenu`],s),bZ((...e)=>o(...e),e=>{let n=Ve(t?.actInsideInputWithModifier)??!0,a=Ve(t?.preventDefault)??!1;if(i=S4(e),(!i||i&&!n)&&x4(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}),bZ((...e)=>o(...e),e=>{let n=Ve(t?.actInsideInputWithModifier)??!0;if(r.value){if((!i||i&&!n)&&x4(e))return;i=!1,r.value=!1}},{eventName:`keyup`,target:n});function s(){i=!1,a.clear(),r.value=Ve(e)===!0}function c(e){return e===null?(s(),()=>!1):typeof e==`boolean`?(s(),r.value=e,()=>!1):Array.isArray(e)||typeof e==`string`?w4(e,a):e}return r}var D4=`vue-flow__node-desc`,O4=`vue-flow__edge-desc`,k4=`vue-flow__aria-live`,A4=[`Enter`,` `,`Escape`],j4={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function M4(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function N4(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 P4(e){return{width:e.offsetWidth,height:e.offsetHeight}}function F4(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function I4(e,t){return{x:F4(e.x,t[0][0],t[1][0]),y:F4(e.y,t[0][1],t[1][1])}}function L4(e){let t=e.getRootNode();return`elementFromPoint`in t?t:window.document}function R4(e){return e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e}function z4(e){return e&&typeof e==`object`&&`id`in e&&`position`in e&&!R4(e)}function B4(e){return z4(e)&&`computedPosition`in e}function V4(e){return!Number.isNaN(e)&&Number.isFinite(e)}function H4(e){return V4(e.width)&&V4(e.height)&&V4(e.x)&&V4(e.y)}function U4(e,t,n){let r={id:e.id.toString(),type:e.type??`default`,dimensions:yt({width:0,height:0}),computedPosition:yt({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:o6(e.data)?e.data:{},events:yt(o6(e.events)?e.events:{})};return Object.assign(t??r,e,{id:e.id.toString(),parentNode:n})}function W4(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:o6(e.data)?e.data:{},events:yt(o6(e.events)?e.events:{}),label:e.label??``,interactionWidth:e.interactionWidth??n?.interactionWidth,...n??{}};return Object.assign(t??r,e,{id:e.id.toString()})}function G4(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 K4(...e){if(e.length===3){let[t,n,r]=e;return G4(t,n,r,`target`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>R4(e)&&e.source===r).map(e=>n.find(t=>z4(t)&&t.id===e.target))}function q4(...e){if(e.length===3){let[t,n,r]=e;return G4(t,n,r,`source`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>R4(e)&&e.target===r).map(e=>n.find(t=>z4(t)&&t.id===e.source))}function J4({source:e,sourceHandle:t,target:n,targetHandle:r}){return`vueflow__edge-${e}${t??``}-${n}${r??``}`}function Y4(e,t){return t.some(t=>R4(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 X4({x:e,y:t},{x:n,y:r,zoom:i}){return{x:e*i+n,y:t*i+r}}function Z4({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?U3(s,o):s}function Q4(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 $4({x:e,y:t,width:n,height:r}){return{x:e,y:t,x2:e+n,y2:t+r}}function e3({x:e,y:t,x2:n,y2:r}){return{x:e,y:t,width:n-e,height:r-t}}function t3(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=Q4(t,$4({...r.computedPosition,...r.dimensions}))}return e3(t)}function n3(e,t,n={x:0,y:0,zoom:1},r=!1,i=!1){let a={...Z4(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 _4(e,t){return n=>{if(!n.code&&!n.key)return!1;let r=v4(n.code,e);return Array.isArray(e)?e.some(e=>g4(n[r],e,t,n.type===`keyup`)):g4(n[r],e,t,n.type===`keyup`)}}function v4(e,t){return t.includes(e)?`code`:`key`}function y4(e,t){let n=I(()=>Ve(t?.target)??p4),r=Xe(Ve(e)===!0),i=!1,a=new Set,o=c(Ve(e));F(()=>Ve(e),(e,t)=>{typeof t==`boolean`&&typeof e!=`boolean`&&s(),o=c(e)},{immediate:!0}),dZ([`blur`,`contextmenu`],s),pZ((...e)=>o(...e),e=>{let n=Ve(t?.actInsideInputWithModifier)??!0,a=Ve(t?.preventDefault)??!1;if(i=h4(e),(!i||i&&!n)&&m4(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}),pZ((...e)=>o(...e),e=>{let n=Ve(t?.actInsideInputWithModifier)??!0;if(r.value){if((!i||i&&!n)&&m4(e))return;i=!1,r.value=!1}},{eventName:`keyup`,target:n});function s(){i=!1,a.clear(),r.value=Ve(e)===!0}function c(e){return e===null?(s(),()=>!1):typeof e==`boolean`?(s(),r.value=e,()=>!1):Array.isArray(e)||typeof e==`string`?_4(e,a):e}return r}var b4=`vue-flow__node-desc`,x4=`vue-flow__edge-desc`,S4=`vue-flow__aria-live`,C4=[`Enter`,` `,`Escape`],w4={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function T4(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function E4(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 D4(e){return{width:e.offsetWidth,height:e.offsetHeight}}function O4(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function k4(e,t){return{x:O4(e.x,t[0][0],t[1][0]),y:O4(e.y,t[0][1],t[1][1])}}function A4(e){let t=e.getRootNode();return`elementFromPoint`in t?t:window.document}function j4(e){return e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e}function M4(e){return e&&typeof e==`object`&&`id`in e&&`position`in e&&!j4(e)}function N4(e){return M4(e)&&`computedPosition`in e}function P4(e){return!Number.isNaN(e)&&Number.isFinite(e)}function F4(e){return P4(e.width)&&P4(e.height)&&P4(e.x)&&P4(e.y)}function I4(e,t,n){let r={id:e.id.toString(),type:e.type??`default`,dimensions:yt({width:0,height:0}),computedPosition:yt({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:$3(e.data)?e.data:{},events:yt($3(e.events)?e.events:{})};return Object.assign(t??r,e,{id:e.id.toString(),parentNode:n})}function L4(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:$3(e.data)?e.data:{},events:yt($3(e.events)?e.events:{}),label:e.label??``,interactionWidth:e.interactionWidth??n?.interactionWidth,...n??{}};return Object.assign(t??r,e,{id:e.id.toString()})}function R4(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 z4(...e){if(e.length===3){let[t,n,r]=e;return R4(t,n,r,`target`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>j4(e)&&e.source===r).map(e=>n.find(t=>M4(t)&&t.id===e.target))}function B4(...e){if(e.length===3){let[t,n,r]=e;return R4(t,n,r,`source`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>j4(e)&&e.target===r).map(e=>n.find(t=>M4(t)&&t.id===e.source))}function V4({source:e,sourceHandle:t,target:n,targetHandle:r}){return`vueflow__edge-${e}${t??``}-${n}${r??``}`}function H4(e,t){return t.some(t=>j4(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 U4({x:e,y:t},{x:n,y:r,zoom:i}){return{x:e*i+n,y:t*i+r}}function W4({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?I3(s,o):s}function G4(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 K4({x:e,y:t,width:n,height:r}){return{x:e,y:t,x2:e+n,y2:t+r}}function q4({x:e,y:t,x2:n,y2:r}){return{x:e,y:t,width:n-e,height:r-t}}function J4(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=G4(t,K4({...r.computedPosition,...r.dimensions}))}return q4(t)}function Y4(e,t,n={x:0,y:0,zoom:1},r=!1,i=!1){let a={...W4(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,6 +158,7 @@ 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`},L3=class extends Error{constructor(e,...t){super(I3[e]?.call(I3,...t)),this.name=`VueFlowError`,this.code=e,this.args=t}};function R3(e){return`clientX`in e}function z3(e){return`sourceEvent`in e}function B3(e,t){let n=R3(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 V3=()=>typeof navigator<`u`&&(navigator==null?void 0:navigator.userAgent)?.indexOf(`Mac`)>=0;function H3(e){return{width:e.dimensions?.width??e.width??0,height:e.dimensions?.height??e.height??0}}function U3(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}var W3=()=>!0;function G3(e){e?.classList.remove(`valid`,`connecting`,`vue-flow__handle-valid`,`vue-flow__handle-connecting`)}function K3(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())N4(i,M4(e))>0&&r.push(e);return r}var q3=250;function J3(e,t,n,r){let i=[],a=1/0,o=K3(e,n,t+q3);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}=j3(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 Y3(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=W3},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:_}=B3(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=X3(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===h4.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=$3(t,e,a,p,n,!0)}return b}function X3(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function Z3(e,t){let n=null;return t?n=`valid`:e&&!t&&(n=`invalid`),n}function Q3(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}function $3(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===h4.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,...j3(o,c,c.position,!0)}:c}var e6={[f4.Left]:f4.Right,[f4.Right]:f4.Left,[f4.Top]:f4.Bottom,[f4.Bottom]:f4.Top},t6=[`production`,`prod`];function n6(e,...t){r6()&&console.warn(`[Vue Flow]: ${e}`,...t)}function r6(){return!t6.includes(`production`)}function i6(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,...P4(t)}}):null}function a6(e,t,n,r,i,a=!1,o){i.value=!1,e.selected?(a||e.selected&&t)&&(r([e]),_t(()=>{o.blur()})):n([e])}function o6(e){return z(e)!==void 0}function s6(e,t,n,r){if(!e||!e.source||!e.target)return n(new L3(F3.EDGE_INVALID,e?.id??`[ID UNKNOWN]`)),!1;let i;return i=R4(e)?e:{...e,id:J4(e)},i=W4(i,void 0,r),!Y4(i,t)&&i}function c6(e,t,n,r,i){if(!t.source||!t.target)return i(new L3(F3.EDGE_INVALID,e.id)),!1;if(!n)return i(new L3(F3.EDGE_NOT_FOUND,e.id)),!1;let{id:a,...o}=e;return{...o,id:r?J4(t):a,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function l6(e,t,n){let r={},i=[];for(let a=0;a<e.length;++a){let o=e[a];if(!z4(o)){n(new L3(F3.NODE_INVALID,o?.id));continue}let s=U4(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 L3(F3.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 u6(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 d6(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}`;u6(`source`,o,`${r}-${a}--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`},A3=class extends Error{constructor(e,...t){super(k3[e]?.call(k3,...t)),this.name=`VueFlowError`,this.code=e,this.args=t}};function j3(e){return`clientX`in e}function M3(e){return`sourceEvent`in e}function N3(e,t){let n=j3(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 P3=()=>typeof navigator<`u`&&(navigator==null?void 0:navigator.userAgent)?.indexOf(`Mac`)>=0;function F3(e){return{width:e.dimensions?.width??e.width??0,height:e.dimensions?.height??e.height??0}}function I3(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}var L3=()=>!0;function R3(e){e?.classList.remove(`valid`,`connecting`,`vue-flow__handle-valid`,`vue-flow__handle-connecting`)}function z3(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())E4(i,T4(e))>0&&r.push(e);return r}var B3=250;function V3(e,t,n,r){let i=[],a=1/0,o=z3(e,n,t+B3);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}=w3(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 H3(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=L3},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:_}=N3(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=U3(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===c4.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=K3(t,e,a,p,n,!0)}return b}function U3(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function W3(e,t){let n=null;return t?n=`valid`:e&&!t&&(n=`invalid`),n}function G3(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}function K3(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===c4.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,...w3(o,c,c.position,!0)}:c}var q3={[a4.Left]:a4.Right,[a4.Right]:a4.Left,[a4.Top]:a4.Bottom,[a4.Bottom]:a4.Top},J3=[`production`,`prod`];function Y3(e,...t){X3()&&console.warn(`[Vue Flow]: ${e}`,...t)}function X3(){return!J3.includes(`production`)}function Z3(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,...D4(t)}}):null}function Q3(e,t,n,r,i,a=!1,o){i.value=!1,e.selected?(a||e.selected&&t)&&(r([e]),_t(()=>{o.blur()})):n([e])}function $3(e){return z(e)!==void 0}function e6(e,t,n,r){if(!e||!e.source||!e.target)return n(new A3(O3.EDGE_INVALID,e?.id??`[ID UNKNOWN]`)),!1;let i;return i=j4(e)?e:{...e,id:V4(e)},i=L4(i,void 0,r),!H4(i,t)&&i}function t6(e,t,n,r,i){if(!t.source||!t.target)return i(new A3(O3.EDGE_INVALID,e.id)),!1;if(!n)return i(new A3(O3.EDGE_NOT_FOUND,e.id)),!1;let{id:a,...o}=e;return{...o,id:r?V4(t):a,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function n6(e,t,n){let r={},i=[];for(let a=0;a<e.length;++a){let o=e[a];if(!M4(o)){n(new A3(O3.NODE_INVALID,o?.id));continue}let s=I4(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 A3(O3.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 r6(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 i6(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}`;r6(`source`,o,`${r}-${a}--Line truncated
|
||||
`)},B(e.data.summary||e.data.detail),9,r7)):L(``,!0),e.data.when||e.data.retry||e.data.continues?(R(),W(`div`,i7,[e.data.when?(R(),W(`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}`},[M(z(Us),{class:`size-3 shrink-0`,"aria-hidden":`true`}),U(`span`,o7,B(e.data.when),1)],8,a7)):L(``,!0),e.data.retry?(R(),W(`span`,{key:1,class:`flex items-center gap-0.5 rounded bg-secondary px-1`,title:`Up to ${e.data.retry} attempts`},[M(z(cc),{class:`size-3`,"aria-hidden":`true`}),A(`×`+B(e.data.retry),1)],8,s7)):L(``,!0),e.data.continues?(R(),W(`span`,c7,[M(z(hc),{class:`size-3`,"aria-hidden":`true`}),n[10]||=A(`continues`,-1)])):L(``,!0)])):L(``,!0),e.data.run?.error?(R(),W(`p`,{key:4,class:`mt-1 line-clamp-2 text-[11px] text-danger`,title:e.data.run.error},B(e.data.run.error),9,l7)):L(``,!0)],64))]),M(Dt,{"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:j(()=>[e.data.expanded?(R(),W(`div`,{key:0,class:`nodrag nopan nowheel cursor-auto border-t border-border`,onClick:n[6]||=jt(()=>{},[`stop`])},[P(t.$slots,`default`)])):L(``,!0)]),_:3}),M(z(R6),{type:`source`,position:z(a4).Bottom},null,8,[`position`]),M(z(R6),{id:`data-out`,type:`source`,position:z(a4).Right,class:`!opacity-0`},null,8,[`position`]),e.data.type===`switch`?(R(),K(z(R6),{key:1,id:`otherwise`,type:`source`,position:z(a4).Right,class:`!opacity-0`},null,8,[`position`])):L(``,!0)],2))}}),d7={class:`pointer-events-none size-full rounded-xl border border-dashed border-border bg-muted/30`},f7={class:`flex items-center gap-1 px-2.5 pt-1.5 text-[11px] text-fg-subtle`},p7={key:0},m7={key:1,class:`font-mono`},h7=k({__name:`LaneNode`,props:{data:{}},setup(e){return(t,n)=>(R(),W(`div`,d7,[U(`div`,f7,[e.data.lane===`switch`?(R(),W(V,{key:0},[M(z(gc),{class:`size-3`,"aria-hidden":`true`}),e.data.title==="default"?(R(),W(`span`,p7,`otherwise`)):(R(),W(`span`,m7,`= `+B(e.data.title),1))],64)):(R(),W(V,{key:1},[M(z(Gs),{class:`size-3`,"aria-hidden":`true`}),A(B(e.data.title),1)],64))])]))}}),g7=240,_7=-140,v7=72,y7=.9,b7=k({__name:`WorkflowCanvas`,props:{yaml:{},stages:{},open:{},triggers:{},types:{},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=I(()=>!!n.types?.length),a=I(()=>[...n.types??[],`parallel`,`switch`]),o=I(()=>a.value.filter(e=>[`agent.run`,`workflow.call`].includes(e))),s=e=>e&&aJ(e)?o.value:a.value,c=e=>e.kind===`step`?JSON.stringify(e.path??null):e.kind,l=q(null),u=I(()=>{let e=xJ(MJ(n.yaml),n.stages??[]);return i.value?{nodes:[{id:`workflow`,type:`step`,position:{x:0,y:_7},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}),d=I(()=>u.value.nodes.filter(e=>e.data.path?.length===2).length),f=q({}),p=q({}),m=I(()=>u.value.nodes.find(e=>e.type===`step`&&c(e.data)===n.open));function h(e,t){f.value={...f.value,[e]:t},m.value?.id!==e&&(p.value={...p.value,[e]:t})}let g=I(()=>{let e=m.value?.id;return e&&f.value[e]?Math.max(0,f.value[e]-(p.value[e]??f.value[e])):0}),_=Lt(),v=Rt(g,{duration:I(()=>_.value===`reduce`?0:200)}),y=I(()=>{let e=new Map;for(let t of u.value.nodes){if(t.type!==`step`)continue;let n=(t.id===m.value?.id?p.value[t.id]:void 0)??f.value[t.id];n!==void 0&&e.set(t.position.y,Math.max(e.get(t.position.y)??-72,n-v7))}return[...e]}),b=e=>y.value.reduce((t,[n,r])=>n<e?t+r:t,0);function ee(e){let t=e.data,a=c(t),o=t.path,s={triggers:t.kind===`start`?n.triggers??[]:t.triggers,expanded:a===n.open,editable:i.value,problem:o?n.problems?.[a]:void 0,onResize:t=>h(e.id,t)};return i.value&&(s.onToggle=()=>r(`toggle`,a),o&&(s.onRename=e=>r(`rename`,o,e),s.onDuplicate=()=>r(`duplicate`,o),s.onRemove=()=>r(`remove`,o))),{...e,data:{...t,...s}}}let x=I(()=>{let e=m.value;return u.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=ee(t));let o=n.marks?.[t.id];o&&(t={...t,data:{...t.data,mark:o}});let{x:c}=t.position,l=t=>e&&t>e.position.y?v.value:0,u=t.position.y+b(t.position.y)+l(t.position.y);if(a===e)return{...t,position:{x:c-88,y:u},zIndex:10};if(t.type===`lane`&&t.style){let e=t.position.y+parseFloat(t.style.height),n=e+b(e)+l(e)-u;return{...t,position:{x:c,y:u},style:{...t.style,height:`${n}px`}}}return{...t,position:{x:c,y:u}}})}),S=I(()=>new Map(u.value.nodes.map(e=>[e.id,e.data.run?.status]))),C=q(null),te=I(()=>C.value??m.value?.id),ne=I(()=>u.value.edges.filter(e=>e.kind===`flow`||e.source===te.value||e.target===te.value).map(({label:e,offset:t,insertAfter:n,otherwise:a,...o})=>o.kind===`flow`?{...o,type:`insert`,...a?{sourceHandle:`othLine 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 O7(e){let t=Yq(e).toJS(),n=new Map;for(let r of kJ(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 k7(e,t,n){let r=O7(e),i=O7(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 A7={class:`grid h-[calc(100dvh-17rem)] min-h-[26rem] grid-cols-[18rem_1fr] gap-3`},j7={class:`min-h-0 divide-y divide-border overflow-y-auto rounded-lg border border-border`,"aria-label":`Revisions`},M7=[`aria-current`,`onClick`],N7={class:`flex items-center gap-2 text-sm`},P7={class:`font-mono text-xs text-fg-subtle`},F7=[`title`],I7={key:0,class:`px-3 py-2 text-sm text-muted-foreground`},L7={key:0,class:`flex min-h-0 flex-col gap-2`},R7={class:`flex items-center gap-2`},z7={class:`text-xs text-muted-foreground`},B7={key:0,class:`rounded-lg border border-border p-4 text-sm text-muted-foreground`},V7={key:1,class:`min-h-0 flex-1 overflow-auto rounded-lg border border-border py-2 font-mono text-[13px] leading-6`},H7={class:`inline-block w-4 select-none text-fg-subtle`},U7={key:2,class:`grid min-h-0 flex-1 grid-cols-2 gap-3`},W7={class:`flex min-h-0 flex-col gap-1`},G7={class:`text-xs font-medium text-muted-foreground`},K7={class:`min-h-0 flex-1`},q7={class:`flex min-h-0 flex-col gap-1`},J7={class:`min-h-0 flex-1`},Y7=k({__name:`WorkflowHistory`,props:pt({revisions:{},current:{},error:{}},{selected:{default:0},selectedModifiers:{},mode:{default:`yaml`},modeModifiers:{}}),emits:pt([`restore`],[`update:selected`,`update:mode`]),setup(e,{emit:t}){let n=e,r=t,i=We(e,`selected`),a=We(e,`mode`);F(()=>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=I(()=>n.revisions.find(e=>e.version===i.value)),s=I(()=>o.value?.yaml??null),c=I(()=>s.value===null?[]:D7(s.value,n.current)),l=I(()=>s.value!==null&&s.value===n.current),u=I(()=>s.value===null?{}:k7(s.value,n.current,`removed`)),d=I(()=>s.value===null?{}:k7(n.current,s.value,`added`)),f={added:`default`,edited:`secondary`,removed:`destructive`};return(t,n)=>(R(),W(`div`,A7,[U(`ol`,j7,[(R(!0),W(V,null,G(e.revisions,e=>(R(),W(`li`,{key:e.version},[U(`button`,{type:`button`,class:N([`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},[U(`span`,N7,[U(`span`,P7,`v`+B(e.version),1),M(z(Qt),{variant:f[e.change]},{default:j(()=>[A(B(e.change),1)]),_:2},1032,[`variant`])]),U(`span`,{class:`mt-0.5 block truncate text-xs text-muted-foreground`,title:e.at},B(e.actor||`unknown`)+` · `+B(e.source||`unknown`)+` · `+B(z(Cg)(e.at)),9,F7)],10,M7)]))),128)),e.revisions.length?L(``,!0):(R(),W(`li`,I7,B(e.error||`No recorded changes`),1))]),o.value?(R(),W(`div`,L7,[U(`div`,R7,[M(z(ob),{modelValue:a.value,"onUpdate:modelValue":n[0]||=e=>a.value=e},{default:j(()=>[M(z(cb),null,{default:j(()=>[M(z(lb),{value:`yaml`},{default:j(()=>[...n[2]||=[A(`YAML`,-1)]]),_:1}),M(z(lb),{value:`canvas`},{default:j(()=>[...n[3]||=[A(`Canvas`,-1)]]),_:1})]),_:1})]),_:1},8,[`modelValue`]),U(`span`,z7,B(l.value?`Same as the current definition`:`Compared with the current definition`),1),M(z(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[1]||=e=>r(`restore`,s.value)},{default:j(()=>[M(z(oc),{"data-icon":`inline-start`}),n[4]||=A(` Restore this version`,-1)]),_:1},8,[`disabled`,`title`])]),s.value===null?(R(),W(`p`,B7,`Workflow removed in this revision.`)):a.value===`yaml`?(R(),W(`pre`,V7,[U(`code`,null,[(R(!0),W(V,null,G(c.value,(e,t)=>(R(),W(`span`,{key:t,class:N([`block min-h-6 px-3 whitespace-pre-wrap`,{"bg-ok/10":e.kind===`add`,"bg-danger/10 text-danger":e.kind===`del`}])},[U(`span`,H7,B(e.kind===`add`?`+`:e.kind===`del`?`-`:``),1),A(B(e.text),1)],2))),128))])])):(R(),W(`div`,U7,[U(`div`,W7,[U(`span`,G7,`v`+B(o.value.version),1),U(`div`,K7,[M(C7,{yaml:s.value,marks:u.value},null,8,[`yaml`,`marks`])])]),U(`div`,q7,[n[5]||=U(`span`,{class:`text-xs font-medium text-muted-foreground`},`Current`,-1),U(`div`,J7,[M(C7,{yaml:e.current,marks:d.value},null,8,[`yaml`,`marks`])])])]))])):L(``,!0)]))}}),X7=`workflow-definitions`;function Z7(e){let t=D(),n=q([]),r=q(``);async function i(){try{n.value=await t.history(X7),r.value=``}c
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 T7(e){let t=$q(e).toJS(),n=new Map;for(let r of MJ(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 E7(e,t,n){let r=T7(e),i=T7(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 D7={class:`grid h-[calc(100dvh-17rem)] min-h-[26rem] grid-cols-[18rem_1fr] gap-3`},O7={class:`min-h-0 divide-y divide-border overflow-y-auto rounded-lg border border-border`,"aria-label":`Revisions`},k7=[`aria-current`,`onClick`],A7={class:`flex items-center gap-2 text-sm`},j7={class:`font-mono text-xs text-fg-subtle`},M7=[`title`],N7={key:0,class:`px-3 py-2 text-sm text-muted-foreground`},P7={key:0,class:`flex min-h-0 flex-col gap-2`},F7={class:`flex items-center gap-2`},I7={class:`text-xs text-muted-foreground`},L7={key:0,class:`rounded-lg border border-border p-4 text-sm text-muted-foreground`},R7={key:1,class:`min-h-0 flex-1 overflow-auto rounded-lg border border-border py-2 font-mono text-[13px] leading-6`},z7={class:`inline-block w-4 select-none text-fg-subtle`},B7={key:2,class:`grid min-h-0 flex-1 grid-cols-2 gap-3`},V7={class:`flex min-h-0 flex-col gap-1`},H7={class:`text-xs font-medium text-muted-foreground`},U7={class:`min-h-0 flex-1`},W7={class:`flex min-h-0 flex-col gap-1`},G7={class:`min-h-0 flex-1`},K7=k({__name:`WorkflowHistory`,props:pt({revisions:{},current:{},error:{}},{selected:{default:0},selectedModifiers:{},mode:{default:`yaml`},modeModifiers:{}}),emits:pt([`restore`],[`update:selected`,`update:mode`]),setup(e,{emit:t}){let n=e,r=t,i=We(e,`selected`),a=We(e,`mode`);F(()=>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=I(()=>n.revisions.find(e=>e.version===i.value)),s=I(()=>o.value?.yaml??null),c=I(()=>s.value===null?[]:w7(s.value,n.current)),l=I(()=>s.value!==null&&s.value===n.current),u=I(()=>s.value===null?{}:E7(s.value,n.current,`removed`)),d=I(()=>s.value===null?{}:E7(n.current,s.value,`added`)),f={added:`default`,edited:`secondary`,removed:`destructive`};return(t,n)=>(R(),W(`div`,D7,[U(`ol`,O7,[(R(!0),W(V,null,G(e.revisions,e=>(R(),W(`li`,{key:e.version},[U(`button`,{type:`button`,class:N([`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},[U(`span`,A7,[U(`span`,j7,`v`+B(e.version),1),M(z(en),{variant:f[e.change]},{default:j(()=>[A(B(e.change),1)]),_:2},1032,[`variant`])]),U(`span`,{class:`mt-0.5 block truncate text-xs text-muted-foreground`,title:e.at},B(e.actor||`unknown`)+` · `+B(e.source||`unknown`)+` · `+B(z(Eg)(e.at)),9,M7)],10,k7)]))),128)),e.revisions.length?L(``,!0):(R(),W(`li`,N7,B(e.error||`No recorded changes`),1))]),o.value?(R(),W(`div`,P7,[U(`div`,F7,[M(z(lb),{modelValue:a.value,"onUpdate:modelValue":n[0]||=e=>a.value=e},{default:j(()=>[M(z(db),null,{default:j(()=>[M(z(fb),{value:`yaml`},{default:j(()=>[...n[2]||=[A(`YAML`,-1)]]),_:1}),M(z(fb),{value:`canvas`},{default:j(()=>[...n[3]||=[A(`Canvas`,-1)]]),_:1})]),_:1})]),_:1},8,[`modelValue`]),U(`span`,I7,B(l.value?`Same as the current definition`:`Compared with the current definition`),1),M(z(J),{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[1]||=e=>r(`restore`,s.value)},{default:j(()=>[M(z(lc),{"data-icon":`inline-start`}),n[4]||=A(` Restore this version`,-1)]),_:1},8,[`disabled`,`title`])]),s.value===null?(R(),W(`p`,L7,`Workflow removed in this revision.`)):a.value===`yaml`?(R(),W(`pre`,R7,[U(`code`,null,[(R(!0),W(V,null,G(c.value,(e,t)=>(R(),W(`span`,{key:t,class:N([`block min-h-6 px-3 whitespace-pre-wrap`,{"bg-ok/10":e.kind===`add`,"bg-danger/10 text-danger":e.kind===`del`}])},[U(`span`,z7,B(e.kind===`add`?`+`:e.kind===`del`?`-`:``),1),A(B(e.text),1)],2))),128))])])):(R(),W(`div`,B7,[U(`div`,V7,[U(`span`,H7,`v`+B(o.value.version),1),U(`div`,U7,[M(b7,{yaml:s.value,marks:u.value},null,8,[`yaml`,`marks`])])]),U(`div`,W7,[n[5]||=U(`span`,{class:`text-xs font-medium text-muted-foreground`},`Current`,-1),U(`div`,G7,[M(b7,{yaml:e.current,marks:d.value},null,8,[`yaml`,`marks`])])])]))])):L(``,!0)]))}}),q7=`workflow-definitions`;function J7(e){let t=D(),n=q([]),r=q(``);async function i(){try{n.value=await t.history(q7),r.value=``}c
Line truncated
|
||||
@@ -0,0 +1,20 @@
|
||||
<script setup lang="ts">
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
||||
|
||||
// A Select whose options may include the empty value, which reka-ui reserves
|
||||
// for clearing: it travels as a sentinel and comes back as "".
|
||||
const EMPTY = "\u0000";
|
||||
defineOptions({ inheritAttrs: false });
|
||||
type Option = { value: string; label: string; disabled?: boolean };
|
||||
defineProps<{ modelValue: string; options: Option[]; placeholder?: string; disabled?: boolean; size?: "sm" | "default"; class?: string }>();
|
||||
const emit = defineEmits<{ "update:modelValue": [string] }>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Select :model-value="modelValue === '' && options.some((o) => o.value === '') ? EMPTY : modelValue || undefined" :disabled="disabled" @update:model-value="emit('update:modelValue', $event === EMPTY ? '' : String($event))">
|
||||
<SelectTrigger :size="size ?? 'sm'" :class="$props.class" v-bind="$attrs"><SelectValue :placeholder="placeholder" /></SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem v-for="option in options" :key="option.value" :value="option.value === '' ? EMPTY : option.value" :disabled="option.disabled">{{ option.label }}</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</template>
|
||||
@@ -0,0 +1,48 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from "vue";
|
||||
import { Plus, Trash2 } from "@lucide/vue";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Switch } from "@/components/ui/switch";
|
||||
import OptionSelect from "./OptionSelect.vue";
|
||||
import { setWorkflowField, workflowField } from "./workflow-edit";
|
||||
|
||||
// A workflow's declared inputs or outputs: name, type and whether required.
|
||||
const props = defineProps<{ yaml: string; field: "inputs" | "outputs" }>();
|
||||
const emit = defineEmits<{ "update:yaml": [string] }>();
|
||||
|
||||
type Spec = { type?: string; required?: boolean };
|
||||
const TYPES = ["string", "number", "bool", "object", "array", "any"].map((value) => ({ value, label: value }));
|
||||
|
||||
const list = computed(() => Object.entries((workflowField(props.yaml, props.field) as Record<string, Spec> | undefined) ?? {}));
|
||||
function write(entries: [string, Spec][]): void {
|
||||
emit("update:yaml", setWorkflowField(props.yaml, props.field, Object.fromEntries(entries.filter(([name]) => name))));
|
||||
}
|
||||
function edit(index: number, name: string, spec: Spec): void {
|
||||
write(list.value.map((entry, i) => (i === index ? [name, spec] : entry)));
|
||||
}
|
||||
function add(): void {
|
||||
const stem = props.field.slice(0, -1);
|
||||
let n = list.value.length + 1;
|
||||
while (list.value.some(([name]) => name === `${stem}_${n}`)) n++;
|
||||
write([...list.value, [`${stem}_${n}`, { type: "string" }]]);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="space-y-1.5">
|
||||
<div class="flex items-center text-xs font-medium text-muted-foreground">
|
||||
{{ field === "inputs" ? "Inputs" : "Outputs" }}
|
||||
<Button type="button" variant="ghost" size="xs" class="ml-auto" @click="add"><Plus data-icon="inline-start" />Add</Button>
|
||||
</div>
|
||||
<div v-if="list.length" class="divide-y divide-border rounded-md border border-border">
|
||||
<div v-for="([name, spec], i) in list" :key="i" class="flex items-center gap-2 px-2 py-1.5">
|
||||
<Input :model-value="name" class="h-7 min-w-0 flex-1 font-mono text-xs" :aria-label="`${field} name`" @change="edit(i, ($event.target as HTMLInputElement).value.trim(), spec)" />
|
||||
<OptionSelect :model-value="spec.type ?? 'string'" :options="TYPES" class="w-24" :aria-label="`${name} type`" @update:model-value="edit(i, name, { ...spec, type: $event })" />
|
||||
<Switch :model-value="spec.required === true" :title="spec.required ? 'Required' : 'Optional'" :aria-label="`${name} required`" @update:model-value="edit(i, name, { ...spec, required: $event || undefined })" />
|
||||
<Button type="button" variant="ghost" size="icon-xs" :aria-label="`Remove ${name}`" @click="write(list.filter((_, j) => j !== i))"><Trash2 /></Button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
+82
-148
@@ -1,7 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { NativeSelect, NativeSelectOption } from "@/components/ui/native-select";
|
||||
import { computed, ref, useId } from "vue";
|
||||
import { CircleHelp, Plus, Trash2, X } from "@lucide/vue";
|
||||
import { ChevronDown, CircleHelp, Plus, Trash2 } from "@lucide/vue";
|
||||
import { parse, stringify } from "yaml";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
@@ -9,18 +8,17 @@ import { DurationInput } from "@/components/ui/duration-input";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Switch } from "@/components/ui/switch";
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
import { stepIcon } from "./step-icons";
|
||||
import { addBranch, branchingOf, deleteBranch, renameBranch, earlierStepIDs, replaceStep, stepAt, workflowField, type StepPath, type StepRecord } from "./workflow-edit";
|
||||
import type { WorkflowDefinitionEntry } from "@/stores/workflows";
|
||||
import type { InputSpec } from "./bind-event";
|
||||
import { inputValue } from "./work-request";
|
||||
import OptionSelect from "./OptionSelect.vue";
|
||||
import WorkflowPicker from "./WorkflowPicker.vue";
|
||||
import { stepTitle } from "./workflow-graph";
|
||||
import { stepControlsProblem, settingsProblem, type SettingsSchema, type StepTypeInfo } from "./workflow-yaml";
|
||||
|
||||
const uid = useId();
|
||||
const props = defineProps<{ yaml: string; path: StepPath; vocabulary: StepTypeInfo[]; workflows: WorkflowDefinitionEntry[]; modelAliases: string[] }>();
|
||||
const emit = defineEmits<{ "update:yaml": [string]; close: []; remove: [] }>();
|
||||
const emit = defineEmits<{ "update:yaml": [string] }>();
|
||||
|
||||
const step = computed<StepRecord>(() => stepAt(props.yaml, props.path) ?? {});
|
||||
const branching = computed(() => branchingOf(step.value));
|
||||
@@ -66,8 +64,8 @@ function kindOf(key: string, schema: SettingsSchema): Kind {
|
||||
return "yaml";
|
||||
}
|
||||
|
||||
// The setting that says what the step does leads, on its own; choices and
|
||||
// switches follow in a compact block; structured settings come last.
|
||||
// The setting that says what the step does leads, on its own; everything else
|
||||
// waits behind More.
|
||||
const fields = computed(() => {
|
||||
const entries = Object.entries(info.value?.settings?.properties ?? {})
|
||||
.filter(([key]) => type.value !== "workflow.call" || !["inputs", "outputs"].includes(key))
|
||||
@@ -80,6 +78,8 @@ const fields = computed(() => {
|
||||
long: rest.filter((field) => ["text", "lines", "yaml"].includes(field.kind)),
|
||||
};
|
||||
});
|
||||
const more = ref(!fields.value.lead && !branching.value);
|
||||
const choices = (options: string[]) => [{ value: "", label: "Default" }, ...options.map((option) => ({ value: option, label: option }))];
|
||||
|
||||
function write(next: StepRecord): void {
|
||||
// id and type lead, the way a step is read.
|
||||
@@ -117,10 +117,13 @@ const callerOutputs = computed(() => Object.entries((workflowField(props.yaml, "
|
||||
const inputMap = computed(() => (settings.value.inputs ?? {}) as Record<string, unknown>);
|
||||
const outputMap = computed(() => (settings.value.outputs ?? {}) as Record<string, string>);
|
||||
const isReference = (value: unknown) => typeof value === "string" && value.startsWith("inputs.");
|
||||
const structured = (spec: InputSpec) => ["object", "array"].includes(spec.type ?? "");
|
||||
const inputText = (name: string) => inputMap.value[name] === undefined ? "" : String(inputMap.value[name]);
|
||||
function setCallInput(name: string, value: string, inputType?: string): void {
|
||||
setSetting("inputs", { ...inputMap.value, [name]: value === "" ? undefined : isReference(value) ? value : inputValue(value, inputType ?? "string") });
|
||||
}
|
||||
const matching = (list: [string, InputSpec][], spec: InputSpec, prefix: string) =>
|
||||
list.filter(([, other]) => other.type === spec.type || other.type === "any" || spec.type === "any").map(([key]) => ({ value: `${prefix}.${key}`, label: key }));
|
||||
|
||||
// A reference goes into the text setting last focused: that is how this step
|
||||
// is connected to an earlier step's result.
|
||||
@@ -146,87 +149,65 @@ const asYaml = (value: unknown) => (value === undefined ? "" : stringify(value).
|
||||
const label = (key: string, schema: SettingsSchema) =>
|
||||
schema.title ?? key.replaceAll("_", " ").replace(/^./, (c) => c.toUpperCase());
|
||||
const text = (key: string) => (typeof settings.value[key] === "string" ? (settings.value[key] as string) : "");
|
||||
const ON_FAILURE = [{ value: "", label: "Park the task" }, { value: "continue", label: "Continue" }];
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<aside class="flex h-full w-[24rem] flex-col border-l border-border bg-card shadow-xl">
|
||||
<header class="flex items-center gap-2.5 border-b border-border px-4 py-3">
|
||||
<span class="flex size-8 shrink-0 items-center justify-center rounded-md bg-secondary text-primary">
|
||||
<component :is="stepIcon(type)" class="size-4" />
|
||||
</span>
|
||||
<div class="min-w-0 flex-1">
|
||||
<Input
|
||||
:model-value="(step.id as string) ?? ''"
|
||||
class="h-7 truncate border-transparent px-1 font-medium shadow-none hover:border-input dark:bg-transparent"
|
||||
:placeholder="stepTitle(type)"
|
||||
aria-label="Step id"
|
||||
@update:model-value="(value) => setField('id', String(value))"
|
||||
/>
|
||||
<div class="truncate font-mono text-[11px] text-fg-subtle">{{ type }}</div>
|
||||
<div class="space-y-4 px-3 py-3">
|
||||
<p v-if="problem" class="rounded-md bg-danger/10 px-2.5 py-1.5 text-xs text-danger" role="alert">{{ problem }}</p>
|
||||
|
||||
<section v-if="branching" class="space-y-3">
|
||||
<label v-if="type === 'switch'" class="block space-y-1.5">
|
||||
<span class="text-xs font-medium text-muted-foreground" title="The value whose case runs; a case named default runs when none matches">Switch on</span>
|
||||
<Input :model-value="branching.on" class="font-mono" placeholder="steps.assess.result.fit" :list="`${uid}-switch-on`" @change="setOn(($event.target as HTMLInputElement).value.trim())" />
|
||||
<datalist :id="`${uid}-switch-on`"><option v-for="id in earlier" :key="id" :value="`steps.${id}.result.`" /></datalist>
|
||||
</label>
|
||||
<div class="text-xs font-medium text-muted-foreground">{{ type === "switch" ? "Cases" : "Branches" }}</div>
|
||||
<div v-for="name in branches" :key="name" class="flex items-center gap-2">
|
||||
<Input :model-value="name" :class="type === 'switch' && 'font-mono'" :aria-label="`${type === 'switch' ? 'Case' : 'Branch'} ${name}`" @change="changeBranch('rename', name, ($event.target as HTMLInputElement).value.trim())" />
|
||||
<Button type="button" variant="ghost" size="icon-sm" :aria-label="`Remove ${name}`" :disabled="branches.length <= minBranches" @click="changeBranch('delete', name)"><Trash2 /></Button>
|
||||
</div>
|
||||
<Button type="button" variant="ghost" size="icon-sm" aria-label="Close" @click="emit('close')"><X /></Button>
|
||||
</header>
|
||||
<div class="flex items-center gap-2">
|
||||
<Input v-model="newBranch" :aria-label="type === 'switch' ? 'New case value' : 'New branch name'" :placeholder="type === 'switch' ? 'Value, or default' : 'Branch name'" @keydown.enter.prevent="changeBranch('add', newBranch.trim())" />
|
||||
<Button type="button" size="icon-sm" variant="outline" :aria-label="type === 'switch' ? 'Add case' : 'Add branch'" :disabled="!newBranch.trim()" @click="changeBranch('add', newBranch.trim())"><Plus /></Button>
|
||||
</div>
|
||||
<p v-if="branchError" role="alert" class="text-xs text-danger">{{ branchError }}</p>
|
||||
</section>
|
||||
|
||||
<div class="flex-1 space-y-5 overflow-y-auto px-4 py-4">
|
||||
<p v-if="problem" class="rounded-md bg-danger/10 px-2.5 py-1.5 text-xs text-danger" role="alert">{{ problem }}</p>
|
||||
|
||||
<section v-if="branching" class="space-y-3">
|
||||
<template v-if="type === 'switch'">
|
||||
<label class="block space-y-1.5">
|
||||
<span class="text-xs font-medium text-muted-foreground" title="The value whose case runs; a case named default runs when none matches">Switch on</span>
|
||||
<Input :model-value="branching.on" class="font-mono" placeholder="steps.assess.result.fit" list="switch-on" @change="setOn(($event.target as HTMLInputElement).value.trim())" />
|
||||
<datalist id="switch-on"><option v-for="id in earlier" :key="id" :value="`steps.${id}.result.`" /></datalist>
|
||||
</label>
|
||||
<section v-if="fields.lead" class="space-y-1.5">
|
||||
<div class="flex items-center gap-1 text-xs font-medium text-muted-foreground" :title="fields.lead.schema.description">
|
||||
{{ label(fields.lead.key, fields.lead.schema) }}
|
||||
<CircleHelp v-if="fields.lead.schema.description" class="size-3 text-fg-subtle" />
|
||||
</div>
|
||||
<WorkflowPicker v-if="fields.lead.kind === 'workflow'" :value="text(fields.lead.key)" :workflows="workflows" :label="label(fields.lead.key, fields.lead.schema)" @pick="setTarget(fields.lead.key, $event)" />
|
||||
<OptionSelect v-else-if="fields.lead.kind === 'select'" class="w-full" :model-value="text(fields.lead.key)" :options="choices(fields.lead.options)" :aria-label="label(fields.lead.key, fields.lead.schema)" @update:model-value="setSetting(fields.lead.key, $event || undefined)" />
|
||||
<Textarea
|
||||
v-else-if="fields.lead.kind === 'text'"
|
||||
:model-value="text(fields.lead.key)"
|
||||
class="min-h-32 text-[13px] leading-relaxed"
|
||||
@focus="focused = fields.lead.key"
|
||||
@update:model-value="setSetting(fields.lead.key, String($event))"
|
||||
/>
|
||||
<Input
|
||||
v-else
|
||||
:model-value="text(fields.lead.key)"
|
||||
@focus="focused = fields.lead.key"
|
||||
@update:model-value="setSetting(fields.lead.key, String($event))"
|
||||
/>
|
||||
<div v-if="earlier.length && fields.lead.kind !== 'select'" class="flex flex-wrap items-center gap-1 pt-0.5">
|
||||
<span class="text-[11px] text-fg-subtle">Insert</span>
|
||||
<template v-for="id in earlier" :key="id">
|
||||
<Button type="button" variant="outline" size="xs" class="font-mono" @click="reference(id, 'summary')">{{ id }}</Button>
|
||||
<Button type="button" variant="outline" size="xs" class="font-mono" @click="reference(id, 'result')">{{ id }}.result</Button>
|
||||
</template>
|
||||
<div class="text-xs font-medium text-muted-foreground">{{ type === "switch" ? "Cases" : "Branches" }}</div>
|
||||
<div v-for="name in branches" :key="name" class="flex items-center gap-2">
|
||||
<Input :model-value="name" :class="type === 'switch' && 'font-mono'" :aria-label="`${type === 'switch' ? 'Case' : 'Branch'} ${name}`" @change="changeBranch('rename', name, ($event.target as HTMLInputElement).value.trim())" />
|
||||
<Button type="button" variant="ghost" size="icon-sm" :aria-label="`Remove ${name}`" :disabled="branches.length <= minBranches" @click="changeBranch('delete', name)"><Trash2 /></Button>
|
||||
</div>
|
||||
<div class="flex items-center gap-2">
|
||||
<Input v-model="newBranch" :aria-label="type === 'switch' ? 'New case value' : 'New branch name'" :placeholder="type === 'switch' ? 'Value, or default' : 'Branch name'" @keydown.enter.prevent="changeBranch('add', newBranch.trim())" />
|
||||
<Button type="button" size="icon-sm" variant="outline" :aria-label="type === 'switch' ? 'Add case' : 'Add branch'" :disabled="!newBranch.trim()" @click="changeBranch('add', newBranch.trim())"><Plus /></Button>
|
||||
</div>
|
||||
<p v-if="branchError" role="alert" class="text-xs text-danger">{{ branchError }}</p>
|
||||
</section>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section v-if="fields.lead" class="space-y-1.5">
|
||||
<div class="flex items-center gap-1 text-xs font-medium text-muted-foreground" :title="fields.lead.schema.description">
|
||||
{{ label(fields.lead.key, fields.lead.schema) }}
|
||||
<CircleHelp v-if="fields.lead.schema.description" class="size-3 text-fg-subtle" />
|
||||
</div>
|
||||
<WorkflowPicker v-if="fields.lead.kind === 'workflow'" :value="text(fields.lead.key)" :workflows="workflows" :label="label(fields.lead.key, fields.lead.schema)" @pick="setTarget(fields.lead.key, $event)" />
|
||||
<NativeSelect
|
||||
size="sm"
|
||||
v-else-if="fields.lead.kind === 'select'" class="w-full"
|
||||
:model-value="text(fields.lead.key)"
|
||||
@update:model-value="(value) => setSetting(fields.lead.key, String(value) || undefined)"
|
||||
>
|
||||
<NativeSelectOption value="">Default</NativeSelectOption>
|
||||
<NativeSelectOption v-for="option in fields.lead.options" :key="option" :value="option">{{ option }}</NativeSelectOption>
|
||||
</NativeSelect>
|
||||
<Textarea
|
||||
v-else-if="fields.lead.kind === 'text'"
|
||||
:model-value="text(fields.lead.key)"
|
||||
class="min-h-40 text-[13px] leading-relaxed"
|
||||
@focus="focused = fields.lead.key"
|
||||
@update:model-value="setSetting(fields.lead.key, String($event))"
|
||||
/>
|
||||
<Input
|
||||
v-else
|
||||
:model-value="text(fields.lead.key)"
|
||||
@focus="focused = fields.lead.key"
|
||||
@update:model-value="setSetting(fields.lead.key, String($event))"
|
||||
/>
|
||||
<div v-if="earlier.length && fields.lead.kind !== 'select'" class="flex flex-wrap items-center gap-1 pt-0.5">
|
||||
<span class="text-[11px] text-fg-subtle">Insert</span>
|
||||
<template v-for="id in earlier" :key="id">
|
||||
<Button type="button" variant="outline" size="xs" class="font-mono" @click="reference(id, 'summary')">{{ id }}</Button>
|
||||
<Button type="button" variant="outline" size="xs" class="font-mono" @click="reference(id, 'result')">{{ id }}.result</Button>
|
||||
</template>
|
||||
</div>
|
||||
</section>
|
||||
<Button type="button" variant="ghost" size="xs" class="-ml-2 text-muted-foreground" :aria-expanded="more" @click="more = !more">
|
||||
<ChevronDown data-icon="inline-start" class="transition-transform" :class="!more && '-rotate-90'" />More
|
||||
</Button>
|
||||
|
||||
<template v-if="more">
|
||||
<section v-if="fields.compact.length" class="divide-y divide-border rounded-md border border-border">
|
||||
<div v-for="field in fields.compact" :key="field.key" class="flex min-h-10 items-center gap-3 px-3 py-1.5">
|
||||
<span class="flex flex-1 items-center gap-1 text-[13px]" :title="field.schema.description">
|
||||
@@ -234,20 +215,8 @@ const text = (key: string) => (typeof settings.value[key] === "string" ? (settin
|
||||
<CircleHelp v-if="field.schema.description" class="size-3 text-fg-subtle" />
|
||||
</span>
|
||||
<WorkflowPicker v-if="field.kind === 'workflow'" class="max-w-48" :value="text(field.key)" :workflows="workflows" :label="label(field.key, field.schema)" @pick="setTarget(field.key, $event)" />
|
||||
<Switch
|
||||
v-else-if="field.kind === 'boolean'"
|
||||
:model-value="settings[field.key] === true"
|
||||
@update:model-value="setSetting(field.key, $event || undefined)"
|
||||
/>
|
||||
<NativeSelect
|
||||
size="sm"
|
||||
v-else-if="field.kind === 'select'" class="max-w-40"
|
||||
:model-value="text(field.key)"
|
||||
@update:model-value="(value) => setSetting(field.key, String(value) || undefined)"
|
||||
>
|
||||
<NativeSelectOption value="">Default</NativeSelectOption>
|
||||
<NativeSelectOption v-for="option in field.options" :key="option" :value="option">{{ option }}</NativeSelectOption>
|
||||
</NativeSelect>
|
||||
<Switch v-else-if="field.kind === 'boolean'" :model-value="settings[field.key] === true" @update:model-value="setSetting(field.key, $event || undefined)" />
|
||||
<OptionSelect v-else-if="field.kind === 'select'" class="w-40" :model-value="text(field.key)" :options="choices(field.options)" :aria-label="label(field.key, field.schema)" @update:model-value="setSetting(field.key, $event || undefined)" />
|
||||
<Input
|
||||
v-else-if="field.kind === 'number'"
|
||||
type="number"
|
||||
@@ -255,13 +224,7 @@ const text = (key: string) => (typeof settings.value[key] === "string" ? (settin
|
||||
:model-value="(settings[field.key] as number | undefined) ?? ''"
|
||||
@update:model-value="(value) => setSetting(field.key, String(value) === '' ? undefined : Number(String(value)))"
|
||||
/>
|
||||
<Input
|
||||
v-else
|
||||
class="h-7 w-40 text-[13px]"
|
||||
:model-value="text(field.key)"
|
||||
@focus="focused = field.key"
|
||||
@update:model-value="(value) => setSetting(field.key, String(value))"
|
||||
/>
|
||||
<Input v-else class="h-7 w-40 text-[13px]" :model-value="text(field.key)" @focus="focused = field.key" @update:model-value="(value) => setSetting(field.key, String(value))" />
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -270,17 +233,16 @@ const text = (key: string) => (typeof settings.value[key] === "string" ? (settin
|
||||
<div class="text-xs font-medium text-muted-foreground">Inputs</div>
|
||||
<div v-for="[name, spec] in callInputs" :key="name" class="space-y-1.5">
|
||||
<div class="text-[13px]">{{ name }}<span v-if="spec.required" class="text-danger"> *</span><span class="ml-2 text-xs text-fg-subtle">{{ spec.type }}</span></div>
|
||||
<NativeSelect size="sm" :aria-label="`${name} source`" class="w-full" :model-value="isReference(inputMap[name]) || ['object', 'array'].includes(spec.type ?? '') ? 'input' : 'value'" @update:model-value="(value) => setCallInput(name, String(value) === 'input' ? 'inputs.' : '')">
|
||||
<NativeSelectOption v-if="!['object', 'array'].includes(spec.type ?? '')" value="value">Value</NativeSelectOption>
|
||||
<NativeSelectOption value="input">Caller input</NativeSelectOption>
|
||||
</NativeSelect>
|
||||
<NativeSelect size="sm" v-if="isReference(inputMap[name]) || ['object', 'array'].includes(spec.type ?? '')" :aria-label="name" class="w-full" :model-value="inputText(name)" @update:model-value="(value) => setCallInput(name, String(value))">
|
||||
<NativeSelectOption value="">Choose input</NativeSelectOption>
|
||||
<NativeSelectOption v-for="[key] in callerInputs.filter(([, input]) => input.type === spec.type || input.type === 'any' || spec.type === 'any')" :key="key" :value="`inputs.${key}`">{{ key }}</NativeSelectOption>
|
||||
</NativeSelect>
|
||||
<NativeSelect size="sm" v-else-if="spec.type === 'bool'" :aria-label="name" class="w-full" :model-value="inputText(name)" @update:model-value="(value) => setCallInput(name, String(value), spec.type)">
|
||||
<NativeSelectOption value="">Unset</NativeSelectOption><NativeSelectOption value="true">True</NativeSelectOption><NativeSelectOption value="false">False</NativeSelectOption>
|
||||
</NativeSelect>
|
||||
<OptionSelect
|
||||
v-if="!structured(spec)"
|
||||
class="w-full"
|
||||
:aria-label="`${name} source`"
|
||||
:model-value="isReference(inputMap[name]) ? 'input' : 'value'"
|
||||
:options="[{ value: 'value', label: 'Value' }, { value: 'input', label: 'Caller input' }]"
|
||||
@update:model-value="setCallInput(name, $event === 'input' ? 'inputs.' : '')"
|
||||
/>
|
||||
<OptionSelect v-if="isReference(inputMap[name]) || structured(spec)" class="w-full" :aria-label="name" placeholder="Choose input" :model-value="inputText(name) === 'inputs.' ? '' : inputText(name)" :options="matching(callerInputs, spec, 'inputs')" @update:model-value="setCallInput(name, $event)" />
|
||||
<OptionSelect v-else-if="spec.type === 'bool'" class="w-full" :aria-label="name" :model-value="inputText(name)" :options="[{ value: '', label: 'Unset' }, { value: 'true', label: 'True' }, { value: 'false', label: 'False' }]" @update:model-value="setCallInput(name, $event, spec.type)" />
|
||||
<Input v-else :aria-label="name" :type="spec.type === 'number' ? 'number' : 'text'" step="any" :model-value="inputText(name)" @update:model-value="setCallInput(name, String($event), spec.type)" />
|
||||
</div>
|
||||
</section>
|
||||
@@ -288,10 +250,7 @@ const text = (key: string) => (typeof settings.value[key] === "string" ? (settin
|
||||
<div class="text-xs font-medium text-muted-foreground">Outputs</div>
|
||||
<div v-for="[name, spec] in callOutputs" :key="name" class="space-y-1.5">
|
||||
<div class="text-[13px]">{{ name }}<span class="ml-2 text-xs text-fg-subtle">{{ spec.type }}</span></div>
|
||||
<NativeSelect size="sm" :aria-label="`${name} output`" :disabled="settings.wait !== true" class="w-full" :model-value="outputMap[name] ?? ''" @update:model-value="(value) => setSetting('outputs', { ...outputMap, [name]: String(value) || undefined })">
|
||||
<NativeSelectOption value="">Do not publish</NativeSelectOption>
|
||||
<NativeSelectOption v-for="[key] in callerOutputs.filter(([, output]) => output.type === spec.type || spec.type === 'any' || output.type === 'any')" :key="key" :value="`outputs.${key}`">{{ key }}</NativeSelectOption>
|
||||
</NativeSelect>
|
||||
<OptionSelect class="w-full" :aria-label="`${name} output`" :disabled="settings.wait !== true" :model-value="outputMap[name] ?? ''" :options="[{ value: '', label: 'Do not publish' }, ...matching(callerOutputs, spec, 'outputs')]" @update:model-value="setSetting('outputs', { ...outputMap, [name]: $event || undefined })" />
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
@@ -301,13 +260,7 @@ const text = (key: string) => (typeof settings.value[key] === "string" ? (settin
|
||||
{{ label(field.key, field.schema) }}
|
||||
<CircleHelp v-if="field.schema.description" class="size-3 text-fg-subtle" />
|
||||
</div>
|
||||
<Textarea
|
||||
v-if="field.kind === 'text'"
|
||||
:model-value="text(field.key)"
|
||||
class="min-h-20 text-[13px]"
|
||||
@focus="focused = field.key"
|
||||
@update:model-value="setSetting(field.key, String($event))"
|
||||
/>
|
||||
<Textarea v-if="field.kind === 'text'" :model-value="text(field.key)" class="min-h-20 text-[13px]" @focus="focused = field.key" @update:model-value="setSetting(field.key, String($event))" />
|
||||
<Textarea
|
||||
v-else-if="field.kind === 'lines'"
|
||||
:model-value="Array.isArray(settings[field.key]) ? (settings[field.key] as string[]).join('\n') : ''"
|
||||
@@ -316,23 +269,16 @@ const text = (key: string) => (typeof settings.value[key] === "string" ? (settin
|
||||
@update:model-value="setSetting(field.key, String($event).split('\n').filter(Boolean))"
|
||||
/>
|
||||
<template v-else>
|
||||
<Textarea
|
||||
:model-value="asYaml(settings[field.key])"
|
||||
class="min-h-24 font-mono text-xs"
|
||||
placeholder="YAML"
|
||||
@change="setYamlSetting(field.key, ($event.target as HTMLTextAreaElement).value)"
|
||||
/>
|
||||
<Textarea :model-value="asYaml(settings[field.key])" class="min-h-24 font-mono text-xs" placeholder="YAML" @change="setYamlSetting(field.key, ($event.target as HTMLTextAreaElement).value)" />
|
||||
<span v-if="yamlErrors[field.key]" class="text-xs text-danger">{{ yamlErrors[field.key] }}</span>
|
||||
</template>
|
||||
</section>
|
||||
|
||||
<section class="space-y-2">
|
||||
<div class="text-xs font-medium text-muted-foreground">Flow</div>
|
||||
<p class="text-xs text-fg-muted">Leave the condition empty to always run. Use a field such as inputs.enabled, !inputs.skip, or steps.plan.result.ready == true.</p>
|
||||
<section class="space-y-1.5">
|
||||
<p v-if="flowProblem" role="alert" class="text-xs text-danger">{{ flowProblem }}</p>
|
||||
<div class="divide-y divide-border rounded-md border border-border">
|
||||
<label class="flex min-h-10 items-center gap-3 px-3 py-1.5">
|
||||
<span class="flex-1 text-[13px]">Run only when</span>
|
||||
<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</span>
|
||||
<Input
|
||||
class="h-7 w-48 font-mono text-xs"
|
||||
placeholder="inputs.enabled"
|
||||
@@ -343,14 +289,7 @@ const text = (key: string) => (typeof settings.value[key] === "string" ? (settin
|
||||
</label>
|
||||
<label class="flex min-h-10 items-center gap-3 px-3 py-1.5">
|
||||
<span class="flex-1 text-[13px]">If it fails</span>
|
||||
<NativeSelect
|
||||
size="sm"
|
||||
:model-value="(step.on_failure as string) ?? ''"
|
||||
@update:model-value="(value) => setField('on_failure', String(value) || undefined)"
|
||||
>
|
||||
<NativeSelectOption value="">Park the task</NativeSelectOption>
|
||||
<NativeSelectOption value="continue">Continue</NativeSelectOption>
|
||||
</NativeSelect>
|
||||
<OptionSelect class="w-36" aria-label="If it fails" :model-value="(step.on_failure as string) ?? ''" :options="ON_FAILURE" @update:model-value="setField('on_failure', $event || undefined)" />
|
||||
</label>
|
||||
<label class="flex min-h-10 items-center gap-3 px-3 py-1.5">
|
||||
<span class="flex-1 text-[13px]">Attempts</span>
|
||||
@@ -375,11 +314,6 @@ const text = (key: string) => (typeof settings.value[key] === "string" ? (settin
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<footer class="flex items-center border-t border-border px-4 py-2.5">
|
||||
<Button type="button" variant="ghost" size="sm" class="text-danger" @click="emit('remove')"><Trash2 />Delete step</Button>
|
||||
<Button type="button" size="sm" class="ml-auto" @click="emit('close')">Done</Button>
|
||||
</footer>
|
||||
</aside>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
+124
-59
@@ -1,12 +1,27 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from "vue";
|
||||
import { computed, nextTick, onBeforeUnmount, onMounted, ref } from "vue";
|
||||
import { Handle, Position } from "@vue-flow/core";
|
||||
import { Flag, Play, Repeat, SkipForward, Webhook, CircleDot, BookOpen, Workflow } from "@lucide/vue";
|
||||
import { CircleAlert, CircleCheck, CircleMinus, CircleX, Copy, EllipsisVertical, Flag, LoaderCircle, Pencil, Play, Repeat, Settings2, SkipForward, Trash2 } from "@lucide/vue";
|
||||
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { stepIcon } from "./step-icons";
|
||||
import { stepTitle, type StepNodeData } from "./workflow-graph";
|
||||
|
||||
const props = defineProps<{ data: StepNodeData }>();
|
||||
export interface StepCardData extends StepNodeData {
|
||||
expanded?: boolean;
|
||||
editable?: boolean;
|
||||
problem?: string;
|
||||
onToggle?: () => void;
|
||||
onResize?: (height: number) => void;
|
||||
onRename?: (name: string) => void;
|
||||
onDuplicate?: () => void;
|
||||
onRemove?: () => void;
|
||||
}
|
||||
|
||||
const props = defineProps<{ data: StepCardData }>();
|
||||
|
||||
const STATE_CLASSES: Record<string, string> = {
|
||||
ok: "border-ok/70",
|
||||
@@ -23,26 +38,31 @@ const MARK_CLASSES: Record<string, string> = {
|
||||
};
|
||||
|
||||
const stateClass = computed(() => {
|
||||
if (props.data.kind === "start") return "border-primary/60";
|
||||
if (props.data.mark) return MARK_CLASSES[props.data.mark];
|
||||
return STATE_CLASSES[props.data.run?.status ?? ""] ?? "border-border";
|
||||
});
|
||||
|
||||
const ROLE_CLASSES: Record<string, string> = {
|
||||
decision: "border-l-4 border-l-warn",
|
||||
waiting: "border-l-4 border-l-info",
|
||||
exit: "border-l-4 border-l-primary",
|
||||
};
|
||||
const STATUS = {
|
||||
ok: { icon: CircleCheck, class: "text-ok", label: "Done" },
|
||||
failed: { icon: CircleX, class: "text-danger", label: "Failed" },
|
||||
interrupted: { icon: CircleAlert, class: "text-warn", label: "Interrupted" },
|
||||
running: { icon: LoaderCircle, class: "text-info animate-spin", label: "Running" },
|
||||
skipped: { icon: CircleMinus, class: "text-fg-subtle", label: "Skipped" },
|
||||
} as const;
|
||||
const status = computed(() => {
|
||||
const run = props.data.run?.status;
|
||||
if (run) return STATUS[run as keyof typeof STATUS] ?? null;
|
||||
if (props.data.problem) return { icon: CircleAlert, class: "text-warn", label: props.data.problem };
|
||||
if (props.data.editable && props.data.kind === "step") return { icon: CircleCheck, class: "text-ok/70", label: "Ready" };
|
||||
return null;
|
||||
});
|
||||
|
||||
const TRIGGER_ICONS = { issue: CircleDot, event: Webhook, playbook: BookOpen, workflow: Workflow };
|
||||
|
||||
const STATE_LABELS: Record<string, string> = {
|
||||
ok: "Done",
|
||||
failed: "Failed",
|
||||
interrupted: "Interrupted",
|
||||
running: "Running",
|
||||
skipped: "Skipped",
|
||||
};
|
||||
const badge = computed(() => {
|
||||
if (props.data.kind === "start") return { icon: Play, label: "Trigger" };
|
||||
if (props.data.kind === "workflow") return { icon: Settings2, label: "Workflow" };
|
||||
return { icon: stepIcon(props.data.type), label: stepTitle(props.data.type) };
|
||||
});
|
||||
const number = computed(() => (props.data.step ? `${Number(props.data.step)}.` : ""));
|
||||
|
||||
function duration(ms?: number): string {
|
||||
if (ms === undefined) return "";
|
||||
@@ -50,54 +70,99 @@ function duration(ms?: number): string {
|
||||
const seconds = Math.round(ms / 1000);
|
||||
return seconds < 60 ? `${seconds}s` : `${Math.floor(seconds / 60)}m ${seconds % 60}s`;
|
||||
}
|
||||
|
||||
const card = ref<HTMLElement | null>(null);
|
||||
let observer: ResizeObserver | undefined;
|
||||
onMounted(() => {
|
||||
observer = new ResizeObserver(() => props.data.onResize?.(card.value?.offsetHeight ?? 0));
|
||||
if (card.value) observer.observe(card.value);
|
||||
});
|
||||
onBeforeUnmount(() => observer?.disconnect());
|
||||
|
||||
const renaming = ref(false);
|
||||
const nameInput = ref<InstanceType<typeof Input> | null>(null);
|
||||
async function rename(): Promise<void> {
|
||||
renaming.value = true;
|
||||
await nextTick();
|
||||
((nameInput.value?.$el as HTMLInputElement | undefined) ?? null)?.select();
|
||||
}
|
||||
function commitRename(event: Event): void {
|
||||
if (!renaming.value) return;
|
||||
renaming.value = false;
|
||||
const name = (event.target as HTMLInputElement).value.trim();
|
||||
if (name !== (props.data.name ?? "")) props.data.onRename?.(name);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
class="w-60 rounded-lg border bg-card px-3 py-2 text-left shadow-sm"
|
||||
:class="[stateClass, ROLE_CLASSES[data.role ?? ''], data.selected && 'ring-2 ring-ring', 'cursor-pointer transition-colors hover:border-muted-foreground']"
|
||||
ref="card"
|
||||
class="rounded-lg border bg-card text-left shadow-sm transition-[width,box-shadow] duration-200"
|
||||
:class="[stateClass, data.expanded ? 'w-[26rem] shadow-lg ring-2 ring-ring/60' : 'w-60 hover:border-muted-foreground', data.onToggle && 'cursor-pointer']"
|
||||
>
|
||||
<Handle v-if="data.kind !== 'start'" type="target" :position="Position.Top" />
|
||||
<Handle v-if="data.kind !== 'workflow'" type="target" :position="Position.Top" />
|
||||
<Handle id="data-in" type="target" :position="Position.Right" class="!opacity-0" />
|
||||
<div class="flex items-center gap-1.5">
|
||||
<Play v-if="data.kind === 'start'" class="size-3.5 text-primary" aria-hidden="true" />
|
||||
<component :is="stepIcon(data.type)" v-else class="size-3.5 shrink-0 text-muted-foreground" aria-hidden="true" />
|
||||
<span v-if="data.step" class="font-mono text-[11px] text-fg-subtle">{{ data.step }}</span>
|
||||
<span class="truncate text-sm font-medium" :title="data.title">{{ data.title }}</span>
|
||||
</div>
|
||||
<div v-if="data.mark" class="text-[11px] font-medium" :class="{ 'text-ok': data.mark === 'added', 'text-danger': data.mark === 'removed', 'text-warn': data.mark === 'changed' }">{{ data.mark === "added" ? "Added" : data.mark === "removed" ? "Removed" : "Changed" }}</div>
|
||||
<div v-if="data.type && data.title !== stepTitle(data.type)" class="truncate font-mono text-[11px] text-fg-subtle">{{ data.type }}</div>
|
||||
<ul v-if="data.kind === 'start' && data.triggers?.length" class="mt-1 space-y-0.5">
|
||||
<li v-for="trigger in data.triggers" :key="trigger.kind + trigger.label" class="flex items-center gap-1.5 text-xs" :title="trigger.detail">
|
||||
<component :is="TRIGGER_ICONS[trigger.kind]" class="size-3 shrink-0 text-primary" aria-hidden="true" />
|
||||
<span class="truncate">{{ trigger.label }}</span>
|
||||
<span v-if="trigger.detail" class="truncate text-fg-subtle">{{ trigger.detail }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
<div v-else-if="data.kind === 'start'" class="mt-0.5 text-xs text-muted-foreground">Nothing starts it yet.</div>
|
||||
<div v-else-if="data.detail" class="mt-0.5 truncate text-xs text-muted-foreground" :title="data.detail">{{ data.detail }}</div>
|
||||
<p v-if="data.summary" class="mt-1 line-clamp-2 text-xs leading-snug text-foreground/80" :title="data.summary">{{ data.summary }}</p>
|
||||
<div v-if="data.when || data.retry || data.continues" class="mt-1 flex flex-wrap gap-1 text-[11px]">
|
||||
<span v-if="data.when" class="flex max-w-full min-w-0 items-center gap-0.5 rounded bg-secondary px-1 font-mono" :title="`Runs only when ${data.when}`">
|
||||
<Flag class="size-3 shrink-0" aria-hidden="true" /><span class="truncate">{{ data.when }}</span>
|
||||
</span>
|
||||
<span v-if="data.retry" class="flex items-center gap-0.5 rounded bg-secondary px-1" :title="`Up to ${data.retry} attempts`">
|
||||
<Repeat class="size-3" aria-hidden="true" />×{{ data.retry }}
|
||||
</span>
|
||||
<span v-if="data.continues" class="flex items-center gap-0.5 rounded bg-secondary px-1" title="A failure does not stop the run">
|
||||
<SkipForward class="size-3" aria-hidden="true" />continues</span>
|
||||
</div>
|
||||
<div
|
||||
v-if="data.run"
|
||||
class="mt-1 flex items-center gap-1.5 text-[11px]"
|
||||
:class="{ 'text-ok': data.run.status === 'ok', 'text-danger': data.run.status === 'failed', 'text-info': data.run.status === 'running', 'text-warn': data.run.status === 'interrupted', 'text-fg-subtle': data.run.status === 'skipped' }"
|
||||
:title="data.run.error || undefined"
|
||||
>
|
||||
<span class="size-1.5 rounded-full bg-current" aria-hidden="true" />
|
||||
{{ STATE_LABELS[data.run.status] ?? data.run.status }}
|
||||
<span v-if="data.run.duration_ms !== undefined" class="text-fg-subtle">{{ duration(data.run.duration_ms) }}</span>
|
||||
<span v-if="data.run.error" class="truncate text-danger">{{ data.run.error }}</span>
|
||||
<div class="px-3 py-2.5" @click="data.onToggle?.()">
|
||||
<div class="flex items-center gap-1.5">
|
||||
<Badge variant="outline" class="max-w-40 gap-1 bg-background">
|
||||
<component :is="badge.icon" class="text-primary" aria-hidden="true" /><span class="truncate">{{ badge.label }}</span>
|
||||
</Badge>
|
||||
<span v-if="data.run?.duration_ms !== undefined" class="ml-auto font-mono text-[11px] text-fg-subtle">{{ duration(data.run.duration_ms) }}</span>
|
||||
<component :is="status.icon" v-if="status" class="size-4 shrink-0" :class="[status.class, data.run?.duration_ms === undefined && 'ml-auto']" :aria-label="status.label" :title="data.run?.error || status.label" />
|
||||
<span v-else class="ml-auto" />
|
||||
<DropdownMenu v-if="data.editable && data.kind === 'step'">
|
||||
<DropdownMenuTrigger as-child>
|
||||
<Button variant="ghost" size="icon-xs" class="nodrag nopan -mr-1.5" aria-label="Step actions" @click.stop><EllipsisVertical /></Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="end" class="w-40">
|
||||
<DropdownMenuItem @select="rename"><Pencil />Rename</DropdownMenuItem>
|
||||
<DropdownMenuItem v-if="!['parallel', 'switch'].includes(data.type)" @select="data.onDuplicate?.()"><Copy />Duplicate</DropdownMenuItem>
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuItem variant="destructive" @select="data.onRemove?.()"><Trash2 />Delete</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
</div>
|
||||
<div class="mt-1.5 flex min-w-0 items-baseline gap-1 text-sm font-medium">
|
||||
<span v-if="number" class="shrink-0">{{ number }}</span>
|
||||
<Input
|
||||
v-if="renaming"
|
||||
ref="nameInput"
|
||||
:model-value="data.name ?? ''"
|
||||
class="nodrag nopan h-6 px-1 text-sm"
|
||||
aria-label="Step id"
|
||||
:placeholder="stepTitle(data.type)"
|
||||
@click.stop
|
||||
@keydown.enter.prevent="commitRename"
|
||||
@keydown.esc="renaming = false"
|
||||
@blur="commitRename"
|
||||
/>
|
||||
<span v-else class="truncate" :title="data.title">{{ data.title }}</span>
|
||||
</div>
|
||||
<div v-if="data.mark" class="text-[11px] font-medium" :class="{ 'text-ok': data.mark === 'added', 'text-danger': data.mark === 'removed', 'text-warn': data.mark === 'changed' }">{{ data.mark === "added" ? "Added" : data.mark === "removed" ? "Removed" : "Changed" }}</div>
|
||||
<template v-if="!data.expanded">
|
||||
<ul v-if="data.kind === 'start' && data.triggers?.length" class="mt-1 space-y-0.5">
|
||||
<li v-for="trigger in data.triggers" :key="trigger.kind + trigger.label" class="truncate text-xs text-muted-foreground" :title="trigger.detail">{{ trigger.label }}</li>
|
||||
</ul>
|
||||
<div v-else-if="data.kind === 'start'" class="mt-0.5 text-xs text-muted-foreground">Manual runs only</div>
|
||||
<div v-else-if="data.summary || data.detail" class="mt-0.5 truncate text-xs text-muted-foreground" :title="[data.detail, data.summary].filter(Boolean).join('\n')">{{ data.summary || data.detail }}</div>
|
||||
<div v-if="data.when || data.retry || data.continues" class="mt-1 flex flex-wrap gap-1 text-[11px]">
|
||||
<span v-if="data.when" class="flex max-w-full min-w-0 items-center gap-0.5 rounded bg-secondary px-1 font-mono" :title="`Runs only when ${data.when}`">
|
||||
<Flag class="size-3 shrink-0" aria-hidden="true" /><span class="truncate">{{ data.when }}</span>
|
||||
</span>
|
||||
<span v-if="data.retry" class="flex items-center gap-0.5 rounded bg-secondary px-1" :title="`Up to ${data.retry} attempts`">
|
||||
<Repeat class="size-3" aria-hidden="true" />×{{ data.retry }}
|
||||
</span>
|
||||
<span v-if="data.continues" class="flex items-center gap-0.5 rounded bg-secondary px-1" title="A failure does not stop the run">
|
||||
<SkipForward class="size-3" aria-hidden="true" />continues</span>
|
||||
</div>
|
||||
<p v-if="data.run?.error" class="mt-1 line-clamp-2 text-[11px] text-danger" :title="data.run.error">{{ data.run.error }}</p>
|
||||
</template>
|
||||
</div>
|
||||
<Transition 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">
|
||||
<div v-if="data.expanded" class="nodrag nopan nowheel cursor-auto border-t border-border" @click.stop>
|
||||
<slot />
|
||||
</div>
|
||||
</Transition>
|
||||
<Handle type="source" :position="Position.Bottom" />
|
||||
<Handle id="data-out" type="source" :position="Position.Right" class="!opacity-0" />
|
||||
<Handle v-if="data.type === 'switch'" id="otherwise" type="source" :position="Position.Right" class="!opacity-0" />
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import { Plus } from "@lucide/vue";
|
||||
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { statusKind, statusLabel, type Binding } from "@/bindings/binding-draft";
|
||||
import BindEvent from "./BindEvent.vue";
|
||||
import SpecList from "./SpecList.vue";
|
||||
import type { WorkflowTrigger } from "./workflow-triggers";
|
||||
|
||||
defineProps<{ yaml: string; triggers: WorkflowTrigger[] }>();
|
||||
const emit = defineEmits<{ "update:yaml": [string]; bound: [] }>();
|
||||
|
||||
// The bind flow takes over the card; a null binding is a new one.
|
||||
const binding = ref<Binding | null | undefined>();
|
||||
function bound(): void {
|
||||
binding.value = undefined;
|
||||
emit("bound");
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<BindEvent v-if="binding !== undefined" :yaml="yaml" :binding="binding" @back="binding = undefined" @saved="bound" />
|
||||
<div v-else class="space-y-4 px-3 py-3">
|
||||
<section class="space-y-1.5">
|
||||
<div class="flex justify-end">
|
||||
<Button type="button" variant="ghost" size="xs" @click="binding = null"><Plus data-icon="inline-start" />Bind an event</Button>
|
||||
</div>
|
||||
<ul v-if="triggers.length" class="divide-y divide-border rounded-md border border-border">
|
||||
<li v-for="trigger in triggers" :key="trigger.kind + trigger.label" class="text-[13px]">
|
||||
<button v-if="trigger.binding" type="button" class="flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-secondary" @click="binding = trigger.binding">
|
||||
<span class="truncate">{{ trigger.label }}</span>
|
||||
<Badge v-if="trigger.binding.status !== 'armed'" :variant="statusKind(trigger.binding.status)">{{ statusLabel(trigger.binding.status) }}</Badge>
|
||||
<span v-if="trigger.detail" class="ml-auto truncate text-xs text-fg-subtle">{{ trigger.detail }}</span>
|
||||
</button>
|
||||
<RouterLink v-else-if="trigger.kind === 'workflow' || trigger.kind === 'playbook'" :to="trigger.kind === 'workflow' ? { path: '/workflows', query: { workflow: trigger.label } } : { path: '/org/playbooks' }" class="flex items-center gap-2 px-3 py-2 hover:bg-secondary">
|
||||
<span class="truncate">{{ trigger.label }}</span><span class="ml-auto truncate text-xs text-fg-subtle">{{ trigger.detail }}</span>
|
||||
</RouterLink>
|
||||
<div v-else class="flex items-center gap-2 px-3 py-2" title="Built-in issue routing. Disable this workflow to stop it running automatically.">
|
||||
<span class="truncate">{{ trigger.label }}</span>
|
||||
<Badge v-if="trigger.kind === 'issue'" variant="outline" class="ml-auto">Built-in</Badge>
|
||||
<span v-if="trigger.detail" class="ml-auto truncate text-xs text-fg-subtle">{{ trigger.detail }}</span>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<p v-else class="text-xs text-fg-subtle">Manual runs only.</p>
|
||||
</section>
|
||||
<SpecList :yaml="yaml" field="inputs" @update:yaml="emit('update:yaml', $event)" />
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,8 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, watch } from "vue";
|
||||
import { computed, nextTick, ref, watch } from "vue";
|
||||
import { VueFlow, type NodeMouseEvent, type VueFlowStore } from "@vue-flow/core";
|
||||
import { Background } from "@vue-flow/background";
|
||||
import { Controls } from "@vue-flow/controls";
|
||||
import { usePreferredReducedMotion, useTransition } from "@vueuse/core";
|
||||
import { ArrowDown, ArrowUp, Copy, Pencil, RotateCcw, Trash2 } from "@lucide/vue";
|
||||
import "@vue-flow/core/dist/style.css";
|
||||
import "@vue-flow/controls/dist/style.css";
|
||||
@@ -20,17 +21,18 @@ import {
|
||||
} from "@/components/ui/dropdown-menu";
|
||||
import AddNode from "./AddNode.vue";
|
||||
import InsertEdge from "./InsertEdge.vue";
|
||||
import StepNode from "./StepNode.vue";
|
||||
import StepNode, { type StepCardData } from "./StepNode.vue";
|
||||
import StepTypeItems from "./StepTypeItems.vue";
|
||||
import { inParallel, type StepPath } from "./workflow-edit";
|
||||
import LaneNode from "./LaneNode.vue";
|
||||
import { restartAt, stepTitle, withRuns, workflowGraph, type StageRun, type StepNodeData } from "./workflow-graph";
|
||||
import { restartAt, stepTitle, withRuns, workflowGraph, type GraphNode, type StageRun, type StepNodeData } from "./workflow-graph";
|
||||
import type { WorkflowTrigger } from "./workflow-triggers";
|
||||
|
||||
const props = defineProps<{
|
||||
yaml: string;
|
||||
stages?: StageRun[];
|
||||
selected?: StepPath | null;
|
||||
/** The card open in place: "workflow", "start", or a step's path as JSON. */
|
||||
open?: string | null;
|
||||
triggers?: WorkflowTrigger[];
|
||||
/** Step type names; when given, the canvas offers editing. */
|
||||
types?: string[];
|
||||
@@ -38,51 +40,120 @@ const props = defineProps<{
|
||||
restartable?: boolean;
|
||||
/** Steps that differ from the definition being compared, by node id. */
|
||||
marks?: Record<string, "added" | "removed" | "changed">;
|
||||
/** What is wrong with each step, by its path as JSON. */
|
||||
problems?: Record<string, string>;
|
||||
/** The workflow card's title and one-line summary. */
|
||||
title?: string;
|
||||
summary?: string;
|
||||
}>();
|
||||
const emit = defineEmits<{
|
||||
edit: [StepPath];
|
||||
settings: [];
|
||||
toggle: [key: string];
|
||||
insert: [after: StepPath, type: string];
|
||||
duplicate: [StepPath];
|
||||
move: [StepPath, -1 | 1];
|
||||
remove: [StepPath];
|
||||
rename: [StepPath, string];
|
||||
restart: [from: string];
|
||||
}>();
|
||||
|
||||
const NODE_WIDTH = 240;
|
||||
const OPEN_WIDTH = 416;
|
||||
const TOP = -140;
|
||||
const editable = computed(() => !!props.types?.length);
|
||||
const types = computed(() => [...(props.types ?? []), "parallel", "switch"]);
|
||||
const branchTypes = computed(() => types.value.filter((type) => ["agent.run", "workflow.call"].includes(type)));
|
||||
const typesAt = (path?: StepPath) => (path && inParallel(path) ? branchTypes.value : types.value);
|
||||
const keyOf = (data: StepNodeData) => (data.kind === "step" ? JSON.stringify(data.path ?? null) : data.kind);
|
||||
|
||||
const container = ref<HTMLElement | null>(null);
|
||||
const graph = computed(() => withRuns(workflowGraph(props.yaml), props.stages ?? []));
|
||||
const selectedKey = computed(() => JSON.stringify(props.selected ?? null));
|
||||
const graph = computed(() => {
|
||||
const laid = withRuns(workflowGraph(props.yaml), props.stages ?? []);
|
||||
if (!editable.value) return laid;
|
||||
// Workflow-wide settings sit on a card above the trigger.
|
||||
const workflow: GraphNode = { id: "workflow", type: "step", position: { x: 0, y: TOP }, data: { kind: "workflow", key: "workflow", title: props.title || "Workflow", type: "", detail: props.summary ?? "" } };
|
||||
return { nodes: [workflow, ...laid.nodes], edges: [{ id: "flow-workflow-start", source: "workflow", target: "start", kind: "flow" as const }, ...laid.edges] };
|
||||
});
|
||||
const stepCount = computed(() => graph.value.nodes.filter((node) => node.data.path?.length === 2).length);
|
||||
const nodes = computed(() =>
|
||||
graph.value.nodes.map((node) => {
|
||||
|
||||
// Rows are laid out for cards BASE tall. A taller card pushes everything below
|
||||
// it down by the difference, measured rather than guessed, and an open card
|
||||
// grows where it sits while the cards below slide down with it.
|
||||
const BASE = 72;
|
||||
const heights = ref<Record<string, number>>({});
|
||||
const closedHeights = ref<Record<string, number>>({});
|
||||
const anchor = computed(() => graph.value.nodes.find((node) => node.type === "step" && keyOf(node.data) === props.open));
|
||||
function resized(id: string, height: number): void {
|
||||
heights.value = { ...heights.value, [id]: height };
|
||||
if (anchor.value?.id !== id) closedHeights.value = { ...closedHeights.value, [id]: height };
|
||||
}
|
||||
const growth = computed(() => {
|
||||
const id = anchor.value?.id;
|
||||
return id && heights.value[id] ? Math.max(0, heights.value[id] - (closedHeights.value[id] ?? heights.value[id])) : 0;
|
||||
});
|
||||
const motion = usePreferredReducedMotion();
|
||||
const shift = useTransition(growth, { duration: computed(() => (motion.value === "reduce" ? 0 : 200)) });
|
||||
const rows = computed(() => {
|
||||
const excess = new Map<number, number>();
|
||||
for (const node of graph.value.nodes) {
|
||||
if (node.type !== "step") continue;
|
||||
const height = (node.id === anchor.value?.id ? closedHeights.value[node.id] : undefined) ?? heights.value[node.id];
|
||||
if (height !== undefined) excess.set(node.position.y, Math.max(excess.get(node.position.y) ?? -BASE, height - BASE));
|
||||
}
|
||||
return [...excess];
|
||||
});
|
||||
const pushed = (y: number) => rows.value.reduce((sum, [row, excess]) => (row < y ? sum + excess : sum), 0);
|
||||
|
||||
function card(node: GraphNode): GraphNode {
|
||||
const data = node.data;
|
||||
const key = keyOf(data);
|
||||
const path = data.path;
|
||||
const extra: Partial<StepCardData> = {
|
||||
triggers: data.kind === "start" ? (props.triggers ?? []) : data.triggers,
|
||||
expanded: key === props.open,
|
||||
editable: editable.value,
|
||||
problem: path ? props.problems?.[key] : undefined,
|
||||
onResize: (height: number) => resized(node.id, height),
|
||||
};
|
||||
if (editable.value) {
|
||||
extra.onToggle = () => emit("toggle", key);
|
||||
if (path) {
|
||||
extra.onRename = (name: string) => emit("rename", path, name);
|
||||
extra.onDuplicate = () => emit("duplicate", path);
|
||||
extra.onRemove = () => emit("remove", path);
|
||||
}
|
||||
}
|
||||
return { ...node, data: { ...data, ...extra } };
|
||||
}
|
||||
|
||||
const nodes = computed(() => {
|
||||
const open = anchor.value;
|
||||
return graph.value.nodes.map((node) => {
|
||||
const original = node;
|
||||
if (node.type === "add")
|
||||
return { ...node, data: { ...node.data, types: typesAt(node.data.insertAfter), editable: editable.value, onInsert: (type: string) => emit("insert", node.data.insertAfter!, type) } };
|
||||
if (node.data.kind === "start") return { ...node, data: { ...node.data, triggers: props.triggers ?? [] } };
|
||||
// Each trigger past the second makes the start node a line taller.
|
||||
const drop = Math.max(0, (props.triggers?.length ?? 0) - 2) * 18;
|
||||
if (drop) node = { ...node, position: { ...node.position, y: node.position.y + drop } };
|
||||
if (node.type === "lane") return node;
|
||||
node = { ...node, data: { ...node.data, types: typesAt(node.data.insertAfter), editable: editable.value, onInsert: (type: string) => emit("insert", node.data.insertAfter!, type) } as StepNodeData };
|
||||
else if (node.type === "step") node = card(node);
|
||||
const mark = props.marks?.[node.id];
|
||||
if (mark) node = { ...node, data: { ...node.data, mark } };
|
||||
return JSON.stringify(node.data.path ?? null) === selectedKey.value && props.selected
|
||||
? { ...node, data: { ...node.data, selected: true } }
|
||||
: node;
|
||||
}),
|
||||
);
|
||||
const { x } = node.position;
|
||||
const opened = (at: number) => (open && at > open.position.y ? shift.value : 0);
|
||||
const y = node.position.y + pushed(node.position.y) + opened(node.position.y);
|
||||
if (original === open) return { ...node, position: { x: x - (OPEN_WIDTH - NODE_WIDTH) / 2, y }, zIndex: 10 };
|
||||
// A lane grows with the cards inside it.
|
||||
if (node.type === "lane" && node.style) {
|
||||
const top = node.position.y;
|
||||
const bottom = top + parseFloat(node.style.height);
|
||||
const height = bottom + pushed(bottom) + opened(bottom) - y;
|
||||
return { ...node, position: { x, y }, style: { ...node.style, height: `${height}px` } };
|
||||
}
|
||||
return { ...node, position: { x, y } };
|
||||
});
|
||||
});
|
||||
// The run's trace: an edge lights once the run has reached its target, in the
|
||||
// colour of how that step went, and moves while the step is running.
|
||||
const runs = computed(() => new Map(graph.value.nodes.map((node) => [node.id, node.data.run?.status])));
|
||||
// Data edges bundle into noise, so only the hovered or selected step's show.
|
||||
// Data edges bundle into noise, so only the hovered or open step's show.
|
||||
const hovered = ref<string | null>(null);
|
||||
const focusId = computed(
|
||||
() => hovered.value ?? graph.value.nodes.find((node) => props.selected && JSON.stringify(node.data.path ?? null) === selectedKey.value)?.id,
|
||||
);
|
||||
const focusId = computed(() => hovered.value ?? anchor.value?.id);
|
||||
const edges = computed(() =>
|
||||
graph.value.edges
|
||||
.filter((edge) => edge.kind === "flow" || edge.source === focusId.value || edge.target === focusId.value)
|
||||
@@ -106,6 +177,7 @@ const edges = computed(() =>
|
||||
|
||||
const ZOOM = 0.9;
|
||||
let flow: VueFlowStore | undefined;
|
||||
const top = computed(() => (editable.value ? TOP : 0));
|
||||
|
||||
// Start at a readable size rather than shrinking a long workflow until
|
||||
// nothing on it can be read, scrolled to the furthest step the watched run has
|
||||
@@ -118,13 +190,22 @@ function place(store?: VueFlowStore): void {
|
||||
const height = container.value?.clientHeight ?? 560;
|
||||
// Scroll only when the furthest step reached would be out of view.
|
||||
const reached = graph.value.nodes.find((node) => props.marks?.[node.id]) ?? graph.value.nodes.filter((node) => node.data.run).at(-1);
|
||||
const below = reached && 24 + (reached.position.y + 180) * ZOOM > height;
|
||||
const y = below ? height / 3 - reached.position.y * ZOOM : 24;
|
||||
const below = reached && 24 + (reached.position.y - top.value + 180) * ZOOM > height;
|
||||
const y = below ? height / 3 - reached.position.y * ZOOM : 24 - top.value * ZOOM;
|
||||
void flow.setViewport({ x: width / 2 - NODE_WIDTH * ZOOM / 2, y, zoom: ZOOM }, { duration: animate ? 300 : 0 });
|
||||
}
|
||||
|
||||
watch(() => graph.value.nodes.filter((node) => node.data.run).length, () => place());
|
||||
watch(() => props.marks, () => place());
|
||||
// A card opened low on the canvas scrolls up so its form is in view.
|
||||
watch(anchor, async (node) => {
|
||||
await nextTick();
|
||||
if (!node || !flow) return;
|
||||
const { x, y, zoom } = flow.getViewport();
|
||||
const screenTop = (node.position.y + pushed(node.position.y)) * zoom + y;
|
||||
const height = container.value?.clientHeight ?? 560;
|
||||
if (screenTop < 8 || screenTop > height / 2) void flow.setViewport({ x, y: y - screenTop + 24, zoom }, { duration: 250 });
|
||||
});
|
||||
|
||||
// The right-click menu opens at the pointer, for the step under it or for the
|
||||
// canvas itself.
|
||||
@@ -136,14 +217,9 @@ function openMenu(event: MouseEvent, step?: StepNodeData): void {
|
||||
menu.value = { open: true, x: event.clientX - (box?.left ?? 0), y: event.clientY - (box?.top ?? 0), step };
|
||||
}
|
||||
function onNodeMenu({ event, node }: NodeMouseEvent): void {
|
||||
if (node.type !== "step") return;
|
||||
if (node.type !== "step" || (node.data as StepNodeData).kind === "workflow") return;
|
||||
openMenu(event as MouseEvent, node.data as StepNodeData);
|
||||
}
|
||||
function onNodeClick({ node }: NodeMouseEvent): void {
|
||||
if ((node.data as StepNodeData).kind === "start" && editable.value) return emit("settings");
|
||||
const path = (node.data as StepNodeData).path;
|
||||
if (editable.value && path) emit("edit", path);
|
||||
}
|
||||
const menuPath = computed(() => menu.value.step?.path);
|
||||
const restart = computed(() => (props.restartable && menuPath.value ? restartAt(graph.value, menuPath.value) : null));
|
||||
const menuIndex = computed(() => Number(menuPath.value?.at(-1)));
|
||||
@@ -163,14 +239,13 @@ const beforePath = computed(() => menuPath.value ? [...menuPath.value.slice(0, -
|
||||
:max-zoom="1.5"
|
||||
pan-on-scroll
|
||||
@pane-ready="place"
|
||||
@node-click="onNodeClick"
|
||||
@node-mouse-enter="hovered = $event.node.id"
|
||||
@node-mouse-leave="hovered = null"
|
||||
@node-context-menu="onNodeMenu"
|
||||
@pane-context-menu="openMenu($event as MouseEvent)"
|
||||
>
|
||||
<template #node-step="nodeProps">
|
||||
<StepNode v-bind="nodeProps" />
|
||||
<StepNode v-bind="nodeProps"><slot name="body" :data="nodeProps.data" /></StepNode>
|
||||
</template>
|
||||
<template #node-lane="nodeProps">
|
||||
<LaneNode v-bind="nodeProps" />
|
||||
@@ -196,7 +271,7 @@ const beforePath = computed(() => menuPath.value ? [...menuPath.value.slice(0, -
|
||||
<DropdownMenuItem :disabled="restart.blocked" @select="emit('restart', restart.from)"><RotateCcw />{{ restart.label }}</DropdownMenuItem>
|
||||
<DropdownMenuSeparator />
|
||||
</template>
|
||||
<DropdownMenuItem @select="emit('edit', menuPath)"><Pencil />Edit</DropdownMenuItem>
|
||||
<DropdownMenuItem @select="emit('toggle', JSON.stringify(menuPath))"><Pencil />Edit</DropdownMenuItem>
|
||||
<DropdownMenuSub>
|
||||
<DropdownMenuSubTrigger>Insert before</DropdownMenuSubTrigger>
|
||||
<DropdownMenuSubContent class="w-52"><StepTypeItems :types="typesAt(menuPath)" @pick="emit('insert', beforePath, $event)" /></DropdownMenuSubContent>
|
||||
|
||||
@@ -8,9 +8,8 @@ import {
|
||||
AlertDialogHeader,
|
||||
AlertDialogTitle,
|
||||
} from "@/components/ui/alert-dialog";
|
||||
import { NativeSelect, NativeSelectOption } from "@/components/ui/native-select";
|
||||
import { computed, ref, watch } from "vue";
|
||||
import { Ellipsis, RotateCcw, Trash2, X } from "@lucide/vue";
|
||||
import { Ellipsis, RotateCcw, Trash2 } from "@lucide/vue";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
@@ -28,13 +27,15 @@ import { restartAt, withRuns, workflowGraph } from "./workflow-graph";
|
||||
import { api } from "@/lib/api";
|
||||
import StepEditor from "./StepEditor.vue";
|
||||
import WorkflowSettings from "./WorkflowSettings.vue";
|
||||
import TriggerSettings from "./TriggerSettings.vue";
|
||||
import OptionSelect from "./OptionSelect.vue";
|
||||
import RunWorkflowButton from "./RunWorkflowButton.vue";
|
||||
import TaskRowActions from "@/tasks/TaskRowActions.vue";
|
||||
import WorkflowCanvas from "./WorkflowCanvas.vue";
|
||||
import WorkflowHistory from "./WorkflowHistory.vue";
|
||||
import { useWorkflowHistory } from "./workflow-history";
|
||||
import { revisionOfRun, type WorkflowRevision } from "./workflow-revisions";
|
||||
import { deleteStep, duplicateStep, insertStep, moveStep, type StepPath } from "./workflow-edit";
|
||||
import { deleteStep, duplicateStep, insertStep, moveStep, replaceStep, stepAt, workflowField, type StepPath } from "./workflow-edit";
|
||||
import { useWorkflowRuns } from "./workflow-runs";
|
||||
import { useWorkflowTriggers } from "./workflow-triggers";
|
||||
import { cloneControlPlaneValue, useSettingsStore } from "@/stores/settings";
|
||||
@@ -46,6 +47,8 @@ import {
|
||||
} from "@/stores/workflows";
|
||||
import {
|
||||
parseWorkflowYaml,
|
||||
settingsProblem,
|
||||
stepControlsProblem,
|
||||
validationLabel,
|
||||
yamlLines,
|
||||
yamlTokenClass,
|
||||
@@ -68,27 +71,28 @@ defineProps<{ runsCount?: number }>();
|
||||
const id = ref("");
|
||||
const yaml = ref("");
|
||||
const loadedYaml = ref("");
|
||||
const selectedStep = ref<StepPath | null>(null);
|
||||
// The slide-in panel shows one thing: a step's editor, or the workflow's settings.
|
||||
const settingsOpen = ref(false);
|
||||
watch(selectedStep, (path) => {
|
||||
if (path) settingsOpen.value = false;
|
||||
});
|
||||
// The one card open in place: "workflow", "start", or a step's path as JSON.
|
||||
const open = ref<string | null>(null);
|
||||
const openPath = computed<StepPath | null>(() => (open.value?.startsWith("[") ? (JSON.parse(open.value) as StepPath) : null));
|
||||
function openStepAt(path: StepPath | null): void {
|
||||
open.value = path ? JSON.stringify(path) : null;
|
||||
}
|
||||
const localError = ref("");
|
||||
|
||||
const { runs, error: runsError, loading: runsLoading, watched, watchedRun, stages, attempt, pick, follow, refresh } = useWorkflowRuns(selected);
|
||||
const stepTab = ref("definition");
|
||||
const selectedNode = computed(() => withRuns(workflowGraph(yaml.value), stages.value).nodes.find((node) => JSON.stringify(node.data.path) === JSON.stringify(selectedStep.value))?.data);
|
||||
function openStep(path: StepPath): void {
|
||||
selectedStep.value = path;
|
||||
stepTab.value = selectedNode.value?.run && watchedRun.value ? "run" : "definition";
|
||||
const graph = computed(() => withRuns(workflowGraph(yaml.value), stages.value));
|
||||
function toggle(key: string): void {
|
||||
open.value = open.value === key ? null : key;
|
||||
const run = graph.value.nodes.find((node) => JSON.stringify(node.data.path ?? null) === open.value)?.data.run;
|
||||
stepTab.value = run && watchedRun.value ? "run" : "definition";
|
||||
}
|
||||
watch(watched, () => { selectedStep.value = null; restartError.value = ""; });
|
||||
watch(watched, () => { open.value = null; restartError.value = ""; });
|
||||
|
||||
// A parked run restarts at a step through the retry action, keeping the
|
||||
// results of the steps before it.
|
||||
const restartable = computed(() => watchedRun.value?.status === "parked");
|
||||
const selectedRestart = computed(() => restartable.value && selectedStep.value ? restartAt(withRuns(workflowGraph(yaml.value), stages.value), selectedStep.value) : null);
|
||||
const openRestart = computed(() => restartable.value && openPath.value ? restartAt(graph.value, openPath.value) : null);
|
||||
const restarting = ref(false);
|
||||
const restartError = ref("");
|
||||
async function restartFrom(from: string): Promise<void> {
|
||||
@@ -120,7 +124,7 @@ function openRevision(version: number): void {
|
||||
// A restored version is an unsaved edit: nothing is written until Save.
|
||||
function restoreRevision(restored: string): void {
|
||||
yaml.value = restored;
|
||||
selectedStep.value = null;
|
||||
open.value = null;
|
||||
view.value = "canvas";
|
||||
}
|
||||
|
||||
@@ -130,22 +134,26 @@ function insertAt(after: StepPath, type: string): void {
|
||||
stepTab.value = "definition";
|
||||
const inserted = insertStep(yaml.value, after, type);
|
||||
yaml.value = inserted.source;
|
||||
selectedStep.value = inserted.path;
|
||||
openStepAt(inserted.path);
|
||||
}
|
||||
function duplicateAt(path: StepPath): void {
|
||||
stepTab.value = "definition";
|
||||
const copied = duplicateStep(yaml.value, path);
|
||||
yaml.value = copied.source;
|
||||
selectedStep.value = copied.path;
|
||||
openStepAt(copied.path);
|
||||
}
|
||||
function moveAt(path: StepPath, delta: -1 | 1): void {
|
||||
const moved = moveStep(yaml.value, path, delta);
|
||||
yaml.value = moved.source;
|
||||
if (selectedStep.value) selectedStep.value = moved.path;
|
||||
if (openPath.value) openStepAt(moved.path);
|
||||
}
|
||||
function removeAt(path: StepPath): void {
|
||||
yaml.value = deleteStep(yaml.value, path);
|
||||
selectedStep.value = null;
|
||||
open.value = null;
|
||||
}
|
||||
function renameAt(path: StepPath, name: string): void {
|
||||
const { id: _id, type, ...rest } = stepAt(yaml.value, path) ?? {};
|
||||
yaml.value = replaceStep(yaml.value, path, { id: name || undefined, type, ...rest });
|
||||
}
|
||||
|
||||
const shippedEntry = computed(() =>
|
||||
@@ -159,7 +167,7 @@ function load(value: string): void {
|
||||
id.value = entry?.id ?? value;
|
||||
yaml.value = entry?.yaml ?? `id: ${value}\nsteps: []\n`;
|
||||
loadedYaml.value = yaml.value;
|
||||
selectedStep.value = null;
|
||||
open.value = null;
|
||||
localError.value = "";
|
||||
}
|
||||
|
||||
@@ -233,6 +241,31 @@ const parsed = computed(() => parseWorkflowYaml(yaml.value, vocabulary.value));
|
||||
const stored = computed(() => collection.value.definitions.find((entry) => entry.id === selected.value)?.yaml);
|
||||
const dirty = computed(() => yaml.value !== (stored.value ?? ""));
|
||||
const view = ref("canvas");
|
||||
// What each step lacks, read the way its editor reads it.
|
||||
const problems = computed(() =>
|
||||
Object.fromEntries(
|
||||
graph.value.nodes.flatMap((node) => {
|
||||
const path = node.data.path;
|
||||
const step = path && stepAt(yaml.value, path);
|
||||
if (!step) return [];
|
||||
const schema = vocabulary.value.find((info) => info.name === step.type)?.settings;
|
||||
const problem = stepControlsProblem(step) || (schema && step.settings ? settingsProblem(step.settings, schema, "settings") : "");
|
||||
return problem ? [[JSON.stringify(path), problem]] : [];
|
||||
}),
|
||||
),
|
||||
);
|
||||
const WORKS_ON: Record<string, string> = { optional: "Repository if given", none: "No repository" };
|
||||
const REQUIRED = "Works on a repository";
|
||||
const workflowSummary = computed(() =>
|
||||
[WORKS_ON[String(workflowField(yaml.value, "repository") ?? "")] ?? REQUIRED, workflowField(yaml.value, "profile")].filter(Boolean).join(" · "),
|
||||
);
|
||||
const runOptions = computed(() => [
|
||||
{ value: "", label: "Definition only" },
|
||||
...runs.value.map((run) => ({
|
||||
value: String(run.id),
|
||||
label: [`${run.source === "test" ? "Test" : "Run"} #${run.id}`, run.title, run.status, runRevision(run) ? `v${runRevision(run)!.version}` : ""].filter(Boolean).join(" · "),
|
||||
})),
|
||||
]);
|
||||
const lines = computed(() => yamlLines(yaml.value));
|
||||
|
||||
// The highlight layer sits behind the textarea and never scrolls by itself, so
|
||||
@@ -256,18 +289,7 @@ function syncScroll(event: Event): void {
|
||||
<TabsTrigger v-if="$slots.runs" value="runs">Runs <span class="ml-1 font-mono text-xs text-fg-subtle">{{ runsCount ?? 0 }}</span></TabsTrigger>
|
||||
</TabsList>
|
||||
<div v-if="runs.length && view === 'canvas'" class="flex min-w-0 items-center gap-1">
|
||||
<NativeSelect
|
||||
size="sm"
|
||||
:model-value="watched"
|
||||
aria-label="Run shown on the canvas"
|
||||
class="min-w-0 max-w-64"
|
||||
@update:model-value="(value) => pick(String(value))"
|
||||
>
|
||||
<NativeSelectOption value="">Definition only</NativeSelectOption>
|
||||
<NativeSelectOption v-for="run in runs" :key="run.id" :value="String(run.id)">{{
|
||||
[`${run.source === "test" ? "Test" : "Run"} #${run.id}`, run.title, run.status, runRevision(run) ? `v${runRevision(run)!.version}` : ""].filter(Boolean).join(" · ")
|
||||
}}</NativeSelectOption>
|
||||
</NativeSelect>
|
||||
<OptionSelect :model-value="watched" :options="runOptions" aria-label="Run shown on the canvas" class="min-w-0 max-w-64" @update:model-value="pick" />
|
||||
<template v-if="watchedRun">
|
||||
<RouterLink :to="`/tasks/${watchedRun.id}`" class="shrink-0 px-1 text-xs text-muted-foreground hover:text-foreground hover:underline">Open</RouterLink>
|
||||
<button v-if="watchedRevision" type="button" class="shrink-0 px-1 font-mono text-xs text-muted-foreground hover:text-foreground hover:underline" title="Open the version this run used" @click="openRevision(watchedRevision.version)">v{{ watchedRevision.version }}</button>
|
||||
@@ -297,7 +319,7 @@ function syncScroll(event: Event): void {
|
||||
<Spinner v-if="state.saving" data-icon="inline-start" />Save</Button>
|
||||
</template>
|
||||
</div>
|
||||
<p v-if="runsLoading" class="text-xs text-fg-muted" role="status">Loading recent runs…</p>
|
||||
<p v-if="runsLoading && !runs.length" class="text-xs text-fg-muted" role="status">Loading recent runs…</p>
|
||||
<div v-else-if="runsError" class="text-sm text-danger" role="alert">
|
||||
<p>Could not load recent runs: {{ runsError }}</p>
|
||||
<Button type="button" variant="outline" size="sm" @click="refresh">Retry runs</Button>
|
||||
@@ -311,60 +333,44 @@ function syncScroll(event: Event): void {
|
||||
<WorkflowCanvas
|
||||
:yaml="yaml"
|
||||
:stages="stages"
|
||||
:selected="selectedStep"
|
||||
:open="open"
|
||||
:triggers="triggers"
|
||||
:types="stepTypeNames"
|
||||
:restartable="restartable"
|
||||
@edit="openStep"
|
||||
:problems="problems"
|
||||
:title="parsed.ok ? parsed.id : id"
|
||||
:summary="workflowSummary"
|
||||
@toggle="toggle"
|
||||
@restart="restartFrom"
|
||||
@settings="selectedStep = null; settingsOpen = true"
|
||||
@insert="insertAt"
|
||||
@duplicate="duplicateAt"
|
||||
@move="moveAt"
|
||||
@remove="removeAt"
|
||||
/>
|
||||
<Transition
|
||||
enter-from-class="translate-x-full opacity-0"
|
||||
leave-to-class="translate-x-full opacity-0"
|
||||
enter-active-class="transition duration-200"
|
||||
leave-active-class="transition duration-150"
|
||||
@rename="renameAt"
|
||||
>
|
||||
<div v-if="settingsOpen" class="absolute inset-y-0 right-0 max-w-full overflow-hidden rounded-r-lg">
|
||||
<WorkflowSettings v-model:yaml="yaml" :triggers="triggers" @close="settingsOpen = false" @bound="reloadTriggers" />
|
||||
</div>
|
||||
</Transition>
|
||||
<Transition
|
||||
enter-from-class="translate-x-full opacity-0"
|
||||
leave-to-class="translate-x-full opacity-0"
|
||||
enter-active-class="transition duration-200"
|
||||
leave-active-class="transition duration-150"
|
||||
>
|
||||
<div v-if="selectedStep" class="absolute inset-y-0 right-0 flex max-w-full flex-col overflow-hidden rounded-r-lg border-l border-border bg-card shadow-xl">
|
||||
<template v-if="selectedNode?.run && watchedRun">
|
||||
<div class="flex items-center gap-2 border-b border-border px-3 py-2">
|
||||
<template #body="{ data }">
|
||||
<WorkflowSettings v-if="data.kind === 'workflow'" v-model:yaml="yaml" />
|
||||
<TriggerSettings v-else-if="data.kind === 'start'" v-model:yaml="yaml" :triggers="triggers" @bound="reloadTriggers" />
|
||||
<template v-else-if="data.path">
|
||||
<div v-if="data.run && watchedRun" class="flex items-center gap-2 border-b border-border px-3 py-2">
|
||||
<Tabs v-model="stepTab"><TabsList><TabsTrigger value="run">Run</TabsTrigger><TabsTrigger value="definition">Definition</TabsTrigger></TabsList></Tabs>
|
||||
<span class="min-w-0 flex-1 truncate text-xs" :title="selectedNode.run.name">{{ selectedNode.run.name }}</span>
|
||||
<Button v-if="selectedRestart" type="button" size="sm" variant="outline" :disabled="restarting || selectedRestart.blocked" @click="restartFrom(selectedRestart.from)"><RotateCcw />{{ selectedRestart.label }}</Button>
|
||||
<Button type="button" variant="ghost" size="icon-sm" aria-label="Close step details" @click="selectedStep = null"><X /></Button>
|
||||
<Button v-if="openRestart" type="button" size="sm" variant="outline" class="ml-auto" :disabled="restarting || openRestart.blocked" @click="restartFrom(openRestart.from)"><RotateCcw />{{ openRestart.label }}</Button>
|
||||
</div>
|
||||
<div v-if="stepTab === 'run'" class="min-h-0 w-[32rem] max-w-[calc(100vw-3rem)] flex-1 overflow-y-auto">
|
||||
<StepRun :task="watchedRun" :attempt="attempt" :stage="selectedNode.run" :stages="stages" />
|
||||
<div v-if="data.run && watchedRun && stepTab === 'run'" class="max-h-[32rem] overflow-y-auto">
|
||||
<StepRun :task="watchedRun" :attempt="attempt" :stage="data.run" :stages="stages" />
|
||||
</div>
|
||||
<StepEditor
|
||||
v-else
|
||||
:key="open ?? ''"
|
||||
v-model:yaml="yaml"
|
||||
:workflows="collection.definitions"
|
||||
:path="data.path"
|
||||
:vocabulary="vocabulary"
|
||||
:model-aliases="modelAliases"
|
||||
/>
|
||||
</template>
|
||||
<StepEditor
|
||||
:workflows="collection.definitions"
|
||||
class="min-h-0 flex-1"
|
||||
v-if="stepTab === 'definition' || !selectedNode?.run || !watchedRun"
|
||||
:key="JSON.stringify(selectedStep)"
|
||||
v-model:yaml="yaml"
|
||||
:path="selectedStep"
|
||||
:vocabulary="vocabulary"
|
||||
:model-aliases="modelAliases"
|
||||
@close="selectedStep = null"
|
||||
@remove="removeAt(selectedStep)"
|
||||
/>
|
||||
</div>
|
||||
</Transition>
|
||||
</template>
|
||||
</WorkflowCanvas>
|
||||
</div>
|
||||
</TabsContent>
|
||||
<TabsContent value="history">
|
||||
|
||||
@@ -2,63 +2,28 @@
|
||||
import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
import { NativeSelect, NativeSelectOption } from "@/components/ui/native-select";
|
||||
import { computed, ref, onMounted } from "vue";
|
||||
import { Plus, Trash2, X } from "@lucide/vue";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { Switch } from "@/components/ui/switch";
|
||||
import { statusKind, statusLabel, type Binding } from "@/bindings/binding-draft";
|
||||
import { api } from "@/lib/api";
|
||||
import type { Identity } from "@/stores/org";
|
||||
import { useOrgStore } from "@/stores/org";
|
||||
import BindEvent from "./BindEvent.vue";
|
||||
import { useSettingsStore } from "@/stores/settings";
|
||||
import OptionSelect from "./OptionSelect.vue";
|
||||
import SpecList from "./SpecList.vue";
|
||||
import { setWorkflowField, workflowField } from "./workflow-edit";
|
||||
import type { WorkflowTrigger } from "./workflow-triggers";
|
||||
|
||||
const props = defineProps<{ yaml: string; triggers: WorkflowTrigger[] }>();
|
||||
const emit = defineEmits<{ "update:yaml": [string]; close: []; bound: [] }>();
|
||||
|
||||
// The bind flow replaces the settings in this panel; null binding is a new one.
|
||||
const binding = ref<Binding | null | undefined>();
|
||||
function bound(): void {
|
||||
binding.value = undefined;
|
||||
emit("bound");
|
||||
}
|
||||
|
||||
type Spec = { type?: string; required?: boolean };
|
||||
const TYPES = ["string", "number", "bool", "object", "array", "any"];
|
||||
// Kept out of the template: a literal reference there would close the
|
||||
// template's own interpolation.
|
||||
const EMPTY = {
|
||||
inputs: "Takes none. Steps read declared inputs as {{ inputs.name }}.",
|
||||
outputs: "Writes none. A calling workflow can read declared outputs.",
|
||||
};
|
||||
const props = defineProps<{ yaml: string }>();
|
||||
const emit = defineEmits<{ "update:yaml": [string] }>();
|
||||
|
||||
const text = (key: string) => {
|
||||
const value = workflowField(props.yaml, key);
|
||||
return typeof value === "string" ? value : "";
|
||||
};
|
||||
const specs = (key: "inputs" | "outputs") =>
|
||||
computed(() => Object.entries((workflowField(props.yaml, key) as Record<string, Spec> | undefined) ?? {}));
|
||||
const inputs = specs("inputs");
|
||||
const outputs = specs("outputs");
|
||||
|
||||
function set(key: string, value: unknown): void {
|
||||
emit("update:yaml", setWorkflowField(props.yaml, key, value));
|
||||
}
|
||||
function setSpec(key: "inputs" | "outputs", entries: [string, Spec][]): void {
|
||||
set(key, Object.fromEntries(entries.filter(([name]) => name)));
|
||||
}
|
||||
function editSpec(key: "inputs" | "outputs", list: [string, Spec][], index: number, name: string, spec: Spec): void {
|
||||
setSpec(key, list.map((entry, i) => (i === index ? [name, spec] : entry)));
|
||||
}
|
||||
function addSpec(key: "inputs" | "outputs", list: [string, Spec][]): void {
|
||||
let n = list.length + 1;
|
||||
while (list.some(([name]) => name === `${key.slice(0, -1)}_${n}`)) n++;
|
||||
setSpec(key, [...list, [`${key.slice(0, -1)}_${n}`, { type: "string" }]]);
|
||||
}
|
||||
|
||||
// The identity a run acts as must be an agent, never a person; a workflow
|
||||
// naming none is refused when it runs, so it defaults to the agent identity
|
||||
@@ -82,6 +47,19 @@ async function loadAgents(): Promise<void> {
|
||||
} finally { identitiesLoading.value = false; }
|
||||
}
|
||||
onMounted(loadAgents);
|
||||
const identityOptions = computed(() => {
|
||||
const current = text("identity");
|
||||
const options = agents.value.map((agent) => ({ value: agent.id, label: agent.display_name }));
|
||||
return current && !agents.value.some((agent) => agent.id === current) ? [{ value: current, label: `${current} (unknown)`, disabled: true }, ...options] : options;
|
||||
});
|
||||
|
||||
const settings = useSettingsStore();
|
||||
const profileOptions = computed(() => {
|
||||
const names = Object.keys((settings.stateFor("agent-profiles").resource?.value ?? {}) as Record<string, unknown>).sort();
|
||||
const current = text("profile");
|
||||
if (current && !names.includes(current)) names.unshift(current);
|
||||
return [{ value: "", label: "Default" }, ...names.map((name) => ({ value: name, label: name }))];
|
||||
});
|
||||
|
||||
const MODES = [
|
||||
{ value: "required", label: "Repository", hint: "Clones the task's repository" },
|
||||
@@ -97,160 +75,70 @@ const needs = computed<{ captures?: boolean; gate_retries?: number }>(() => {
|
||||
const value = workflowField(props.yaml, "needs");
|
||||
return value && typeof value === "object" ? (value as { captures?: boolean; gate_retries?: number }) : {};
|
||||
});
|
||||
function setNeeds(next: { captures?: boolean; gate_retries?: number }): void {
|
||||
set("needs", next);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<aside class="flex h-full w-[24rem] max-w-full flex-col border-l border-border bg-card shadow-xl">
|
||||
<BindEvent v-if="binding !== undefined" :yaml="yaml" :binding="binding" @back="binding = undefined" @saved="bound" />
|
||||
<template v-else>
|
||||
<header class="flex items-center gap-2 border-b border-border px-4 py-3">
|
||||
<div class="min-w-0 flex-1">
|
||||
<div class="text-sm font-medium">Workflow settings</div>
|
||||
</div>
|
||||
<Button type="button" variant="ghost" size="icon-sm" aria-label="Close" @click="emit('close')"><X /></Button>
|
||||
</header>
|
||||
|
||||
<div class="flex-1 space-y-5 overflow-y-auto px-4 py-4">
|
||||
<section class="space-y-1.5">
|
||||
<div class="text-xs font-medium text-muted-foreground">Works on</div>
|
||||
<div class="space-y-4 px-3 py-3">
|
||||
<div class="divide-y divide-border rounded-md border border-border">
|
||||
<label class="flex min-h-10 items-center gap-3 px-3 py-1.5">
|
||||
<span class="flex-1 text-[13px]">Runs as</span>
|
||||
<OptionSelect
|
||||
:model-value="text('identity')"
|
||||
:options="identityOptions"
|
||||
aria-label="Execution identity"
|
||||
:placeholder="identitiesLoading ? 'Loading agents…' : 'Choose an agent'"
|
||||
:disabled="identitiesLoading || !!identitiesError"
|
||||
class="w-44"
|
||||
@update:model-value="set('identity', $event)"
|
||||
/>
|
||||
</label>
|
||||
<p v-if="identitiesError" role="alert" class="px-3 py-2 text-xs text-danger">{{ identitiesError }} <Button variant="link" size="xs" @click="loadAgents">Retry</Button></p>
|
||||
<p v-else-if="!identitiesLoading && !agents.length" class="px-3 py-2 text-xs text-fg-subtle">No active agents in your organisation.</p>
|
||||
<label class="flex min-h-10 items-center gap-3 px-3 py-1.5">
|
||||
<span class="flex-1 text-[13px]">Container profile</span>
|
||||
<OptionSelect :model-value="text('profile')" :options="profileOptions" aria-label="Container profile" class="w-44" @update:model-value="set('profile', $event || undefined)" />
|
||||
</label>
|
||||
<div class="flex min-h-10 items-center gap-3 px-3 py-1.5">
|
||||
<span class="flex-1 text-[13px]">Works on</span>
|
||||
<ToggleGroup
|
||||
type="single"
|
||||
variant="outline"
|
||||
size="sm"
|
||||
class="w-full"
|
||||
:model-value="repository"
|
||||
aria-label="Works on"
|
||||
@update:model-value="(value) => { if (value) set('repository', value === 'required' ? undefined : String(value)); }"
|
||||
>
|
||||
<ToggleGroupItem v-for="mode in MODES" :key="mode.value" :value="mode.value" :title="mode.hint" class="flex-1">{{ mode.label }}</ToggleGroupItem>
|
||||
<ToggleGroupItem v-for="mode in MODES" :key="mode.value" :value="mode.value" :title="mode.hint">{{ mode.label }}</ToggleGroupItem>
|
||||
</ToggleGroup>
|
||||
</section>
|
||||
|
||||
<section v-for="[key, list] in [['inputs', inputs], ['outputs', outputs]] as const" :key="key" class="space-y-1.5">
|
||||
<div class="flex items-center text-xs font-medium text-muted-foreground">
|
||||
{{ key === "inputs" ? "Inputs" : "Outputs" }}
|
||||
<Button type="button" variant="ghost" size="xs" class="ml-auto" @click="addSpec(key, list)"><Plus data-icon="inline-start" />Add</Button>
|
||||
</div>
|
||||
<div v-if="list.length" class="divide-y divide-border rounded-md border border-border">
|
||||
<div v-for="([name, spec], i) in list" :key="i" class="flex items-center gap-2 px-2 py-1.5">
|
||||
<Input
|
||||
:model-value="name"
|
||||
class="h-7 min-w-0 flex-1 font-mono text-xs"
|
||||
:aria-label="`${key} name`"
|
||||
@change="editSpec(key, list, i, ($event.target as HTMLInputElement).value.trim(), spec)"
|
||||
/>
|
||||
<NativeSelect
|
||||
size="sm"
|
||||
:model-value="spec.type ?? 'string'"
|
||||
@update:model-value="(value) => editSpec(key, list, i, name, { ...spec, type: String(value) })"
|
||||
>
|
||||
<NativeSelectOption v-for="type in TYPES" :key="type" :value="type">{{ type }}</NativeSelectOption>
|
||||
</NativeSelect>
|
||||
<Switch
|
||||
:model-value="spec.required === true"
|
||||
:title="spec.required ? 'Required' : 'Optional'"
|
||||
@update:model-value="editSpec(key, list, i, name, { ...spec, required: $event || undefined })"
|
||||
/>
|
||||
<Button type="button" variant="ghost" size="icon-xs" :aria-label="`Remove ${name}`" @click="setSpec(key, list.filter((_: unknown, j: number) => j !== i))">
|
||||
<Trash2 />
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
<p v-else class="text-xs text-fg-subtle">
|
||||
{{ EMPTY[key] }}
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<section class="space-y-1.5">
|
||||
<label for="workflow-instructions" class="text-xs font-medium text-muted-foreground">Instructions</label>
|
||||
<Textarea
|
||||
id="workflow-instructions"
|
||||
:model-value="text('instructions')"
|
||||
:rows="5"
|
||||
class="font-mono text-[13px]"
|
||||
@change="set('instructions', ($event.target as HTMLTextAreaElement).value)"
|
||||
</div>
|
||||
<label class="flex min-h-10 items-center gap-3 px-3 py-1.5">
|
||||
<span class="flex-1 text-[13px]" title="Stages return structured output through capture tools">Captures</span>
|
||||
<Switch :model-value="needs.captures === true" @update:model-value="set('needs', { ...needs, captures: $event || undefined })" />
|
||||
</label>
|
||||
<label class="flex min-h-10 items-center gap-3 px-3 py-1.5">
|
||||
<span class="flex-1 text-[13px]">Gate retries</span>
|
||||
<Input
|
||||
type="number"
|
||||
min="0"
|
||||
placeholder="0"
|
||||
class="h-7 w-20 text-right text-[13px]"
|
||||
:model-value="needs.gate_retries ?? ''"
|
||||
@update:model-value="(value) => set('needs', { ...needs, gate_retries: String(value) === '' ? undefined : Number(String(value)) })"
|
||||
/>
|
||||
</section>
|
||||
|
||||
<section class="space-y-1.5">
|
||||
<div class="text-xs font-medium text-muted-foreground">Runs as</div>
|
||||
<div class="divide-y divide-border rounded-md border border-border">
|
||||
<label class="flex min-h-10 items-center gap-3 px-3 py-1.5">
|
||||
<span class="flex-1 text-[13px]">Identity</span>
|
||||
<NativeSelect
|
||||
:model-value="text('identity')"
|
||||
aria-label="Execution identity"
|
||||
:disabled="identitiesLoading || !!identitiesError"
|
||||
class="w-44 text-[13px]"
|
||||
@update:model-value="(value) => set('identity', String(value))"
|
||||
>
|
||||
<NativeSelectOption v-if="!text('identity')" value="" disabled>{{ identitiesLoading ? 'Loading agents…' : 'Choose an agent' }}</NativeSelectOption>
|
||||
<NativeSelectOption v-if="text('identity') && !agents.some((agent) => agent.id === text('identity'))" :value="text('identity')" disabled>{{ text('identity') }} (unknown)</NativeSelectOption>
|
||||
<NativeSelectOption v-for="agent in agents" :key="agent.id" :value="agent.id">{{ agent.display_name }}</NativeSelectOption>
|
||||
</NativeSelect>
|
||||
</label>
|
||||
<p v-if="identitiesError" role="alert" class="px-3 py-2 text-xs text-danger">{{ identitiesError }} <Button variant="link" size="xs" @click="loadAgents">Retry</Button></p>
|
||||
<p v-else-if="!identitiesLoading && !agents.length" class="px-3 py-2 text-xs text-fg-subtle">No active agents are assigned to your organisation.</p>
|
||||
<label class="flex min-h-10 items-center gap-3 px-3 py-1.5">
|
||||
<span class="flex-1 text-[13px]">Container profile</span>
|
||||
<Input
|
||||
:model-value="text('profile')"
|
||||
placeholder="default"
|
||||
class="h-7 w-44 text-[13px]"
|
||||
@change="set('profile', ($event.target as HTMLInputElement).value.trim())"
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="space-y-1.5">
|
||||
<div class="text-xs font-medium text-muted-foreground">Run needs</div>
|
||||
<div class="divide-y divide-border rounded-md border border-border">
|
||||
<label class="flex min-h-10 items-center gap-3 px-3 py-1.5">
|
||||
<span class="flex-1 text-[13px]">Captures</span>
|
||||
<Switch :model-value="needs.captures === true" @update:model-value="setNeeds({ ...needs, captures: $event || undefined })" />
|
||||
</label>
|
||||
<label class="flex min-h-10 items-center gap-3 px-3 py-1.5">
|
||||
<span class="flex-1 text-[13px]">Gate retries</span>
|
||||
<Input
|
||||
type="number"
|
||||
min="0"
|
||||
placeholder="0"
|
||||
class="h-7 w-20 text-right text-[13px]"
|
||||
:model-value="needs.gate_retries ?? ''"
|
||||
@update:model-value="(value) => setNeeds({ ...needs, gate_retries: String(value) === '' ? undefined : Number(String(value)) })"
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="space-y-1.5">
|
||||
<div class="flex items-center text-xs font-medium text-muted-foreground">Starts when
|
||||
<Button type="button" variant="ghost" size="xs" class="ml-auto" @click="binding = null"><Plus data-icon="inline-start" />Bind an event</Button>
|
||||
</div>
|
||||
<ul v-if="triggers.length" class="divide-y divide-border rounded-md border border-border">
|
||||
<li v-for="trigger in triggers" :key="trigger.kind + trigger.label" class="text-[13px]">
|
||||
<button v-if="trigger.binding" type="button" class="flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-secondary" @click="binding = trigger.binding">
|
||||
<span class="truncate">{{ trigger.label }}</span>
|
||||
<Badge v-if="trigger.binding.status !== 'armed'" :variant="statusKind(trigger.binding.status)">{{ statusLabel(trigger.binding.status) }}</Badge>
|
||||
<span v-if="trigger.detail" class="ml-auto truncate text-xs text-fg-subtle">{{ trigger.detail }}</span>
|
||||
</button>
|
||||
<RouterLink v-else-if="trigger.kind==='workflow' || trigger.kind==='playbook'" :to="trigger.kind==='workflow'?{path:'/workflows',query:{workflow:trigger.label}}:{path:'/org/playbooks'}" class="flex items-center gap-2 px-3 py-2 hover:bg-secondary">
|
||||
<span class="truncate">{{trigger.label}}</span><span class="ml-auto truncate text-xs text-fg-subtle">{{trigger.detail}}</span>
|
||||
</RouterLink>
|
||||
<div v-else class="flex items-center gap-2 px-3 py-2" title="Built-in issue routing. Disable this workflow to stop it running automatically.">
|
||||
<span class="truncate">{{ trigger.label }}</span>
|
||||
<Badge v-if="trigger.kind==='issue'" variant="outline" class="ml-auto">Built-in</Badge>
|
||||
<span v-if="trigger.detail" class="ml-auto truncate text-xs text-fg-subtle">{{ trigger.detail }}</span>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<p v-else class="text-xs text-fg-subtle">Nothing starts it automatically.</p>
|
||||
</section>
|
||||
</label>
|
||||
</div>
|
||||
</template>
|
||||
</aside>
|
||||
|
||||
<section class="space-y-1.5">
|
||||
<label for="workflow-instructions" class="text-xs font-medium text-muted-foreground">Instructions</label>
|
||||
<Textarea
|
||||
id="workflow-instructions"
|
||||
:model-value="text('instructions')"
|
||||
:rows="4"
|
||||
class="font-mono text-[13px]"
|
||||
@change="set('instructions', ($event.target as HTMLTextAreaElement).value)"
|
||||
/>
|
||||
</section>
|
||||
|
||||
<SpecList :yaml="yaml" field="outputs" @update:yaml="emit('update:yaml', $event)" />
|
||||
</div>
|
||||
</template>
|
||||
@@ -10,14 +10,13 @@ import type { WorkflowTrigger } from "./workflow-triggers";
|
||||
*/
|
||||
|
||||
export interface StepNodeData {
|
||||
kind: "start" | "step";
|
||||
/** What the step means to the run: work, a gate that decides, a pause for a
|
||||
* person, or an exit that ends or hands off the run. */
|
||||
role?: StepRole;
|
||||
kind: "start" | "step" | "workflow";
|
||||
/** The top-level step's position in run order, as shown on the node. */
|
||||
step?: string;
|
||||
/** The step's id, or its 1-based position when it has none. */
|
||||
key: string;
|
||||
/** The id the step declares, if any. */
|
||||
name?: string;
|
||||
title: string;
|
||||
type: string;
|
||||
detail: string;
|
||||
@@ -42,19 +41,10 @@ export interface StepNodeData {
|
||||
mark?: "added" | "removed" | "changed";
|
||||
/** Where the step lives in the YAML document, for editing it. */
|
||||
path?: (string | number)[];
|
||||
selected?: boolean;
|
||||
triggers?: WorkflowTrigger[];
|
||||
insertAfter?: (string | number)[];
|
||||
}
|
||||
|
||||
export type StepRole = "work" | "decision" | "waiting" | "exit";
|
||||
|
||||
function stepRole(type: string): StepRole {
|
||||
if (type.startsWith("gate.") || type === "switch") return "decision";
|
||||
if (type === "human.approve") return "waiting";
|
||||
if (type === "workflow.finish" || type === "workflow.handoff") return "exit";
|
||||
return "work";
|
||||
}
|
||||
|
||||
/** One recorded run of a step, from the task's attempts view. */
|
||||
export interface AgentRun {
|
||||
@@ -286,9 +276,9 @@ export function workflowGraph(source: string): WorkflowGraph {
|
||||
data: {
|
||||
kind: "step",
|
||||
key: stepID || key,
|
||||
name: stepID || undefined,
|
||||
title: stepID || stepTitle(type),
|
||||
type,
|
||||
role: stepRole(type),
|
||||
step: path?.length === 2 ? String(Number(path[1]) + 1).padStart(2, "0") : undefined,
|
||||
detail: branching?.on ? `on ${branching.on.replace(/^steps\./, "")}` : stepDetail(type, settings),
|
||||
summary: stepSummary(settings),
|
||||
|
||||
@@ -51,7 +51,7 @@ export function useWorkflowRuns(workflow: Ref<string>) {
|
||||
|
||||
async function loadStages(): Promise<void> {
|
||||
if (!watched.value) {
|
||||
stages.value = [];
|
||||
if (stages.value.length) stages.value = [];
|
||||
attempt.value = 0;
|
||||
return;
|
||||
}
|
||||
@@ -59,7 +59,10 @@ export function useWorkflowRuns(workflow: Ref<string>) {
|
||||
const view = await api.taskAttempts<AttemptsView>(requested).catch(() => null);
|
||||
if (watched.value !== requested) return;
|
||||
const latest = [...(view?.attempts ?? [])].sort((a, b) => b.attempt - a.attempt)[0];
|
||||
stages.value = latest?.stages ?? [];
|
||||
// A live refresh that changed nothing must not redraw the canvas, which
|
||||
// would close any menu open on it.
|
||||
const next = latest?.stages ?? [];
|
||||
if (JSON.stringify(next) !== JSON.stringify(stages.value)) stages.value = next;
|
||||
attempt.value = latest?.attempt ?? 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user