feat(ui): schedules table, runs page and Schedule trigger

Schedules list as a table with enable, run now, edit, duplicate, delete and
view runs; built-ins only enable, retime and run. The runs page links each
run's tasks through its capture's dispatches. The Start node gains a Schedule
trigger that picks or creates a schedule and binds the schedule source to the
workflow. Times show in a per-browser display zone set under Appearance; the
cron time zone and run retention are edited on the Schedules page.
This commit is contained in:
sam committed 2026-10-26 00:57:52 +11:00
1 parent 8026c07319
commit 0f75475b91
52 files changed
+1425 -131

No files matched your search

+3
View File
@@ -152,6 +152,9 @@ func wireOrgSurface(srv *webui.Server, store storecontract.TaskStore) {
if orgs, ok := store.(org.API); ok {
srv.Orgs = orgs
}
if schedules, ok := store.(webui.ScheduleStore); ok {
srv.Schedules = schedules
}
}
// wireCatalog attaches the Gateway-owned surfaces the dashboard reads over the
+3
View File
@@ -11,6 +11,9 @@ import (
"github.com/samcharles93/archie-core/internal/webui"
)
// The State Store client serves the dashboard's schedules (wireOrgSurface).
var _ webui.ScheduleStore = (*staterpc.Client)(nil)
func wireServiceLogs(opts Options, srv *webui.Server, tasks *staterpc.Client, chat *gatewayrpc.Client, feed *logging.Feed) (func(), error) {
srv.LogFeed = feed
srv.LogSources = map[string]webui.LogSource{
+239
View File
@@ -0,0 +1,239 @@
package webui
import (
"context"
"encoding/json"
"errors"
"net/http"
"time"
"github.com/samcharles93/archie-core/internal/domain/org"
"github.com/samcharles93/archie-core/internal/domain/scheduling"
"github.com/samcharles93/archie-core/internal/domain/storecontract"
)
// ScheduleStore is the State Store's schedule contract as the dashboard uses
// it.
type ScheduleStore interface {
ListSchedules(ctx context.Context) ([]scheduling.Schedule, error)
GetSchedule(ctx context.Context, id string) (scheduling.Schedule, error)
PutSchedule(ctx context.Context, s scheduling.Schedule) (scheduling.Schedule, error)
DeleteSchedule(ctx context.Context, id string) error
RequestScheduleRun(ctx context.Context, id string) (scheduling.Run, error)
ListScheduleRuns(ctx context.Context, scheduleID string, limit int) ([]scheduling.Run, error)
}
// scheduleRunsShown is how many runs the runs page lists.
const scheduleRunsShown = 100
type scheduleOwnerView struct {
Kind scheduling.OwnerKind `json:"kind"`
ID string `json:"id,omitempty"`
// Name is the owning org's name, resolved here so the dashboard never
// stores or invents one.
Name string `json:"name,omitempty"`
}
type scheduleRunView struct {
ID int64 `json:"id"`
ScheduleID string `json:"schedule_id"`
ScheduledFor time.Time `json:"scheduled_for"`
Started *time.Time `json:"started,omitempty"`
Finished *time.Time `json:"finished,omitempty"`
Result scheduling.RunResult `json:"result"`
Error string `json:"error,omitempty"`
TaskIDs []int64 `json:"task_ids,omitempty"`
}
type scheduleView struct {
ID string `json:"id"`
Name string `json:"name"`
Owner scheduleOwnerView `json:"owner"`
Enabled bool `json:"enabled"`
BuiltIn bool `json:"built_in"`
Timing scheduling.Timing `json:"timing"`
NextRun *time.Time `json:"next_run,omitempty"`
LastRun *scheduleRunView `json:"last_run,omitempty"`
}
// scheduleInput is what the dashboard may set on a schedule. Owner and
// built-in are the store's to decide.
type scheduleInput struct {
Name string `json:"name"`
Enabled bool `json:"enabled"`
Timing scheduling.Timing `json:"timing"`
}
func optionalTime(t time.Time) *time.Time {
if t.IsZero() {
return nil
}
return &t
}
func runView(r scheduling.Run) scheduleRunView {
return scheduleRunView{
ID: r.ID, ScheduleID: r.ScheduleID, ScheduledFor: r.ScheduledFor,
Started: optionalTime(r.Started), Finished: optionalTime(r.Finished),
Result: r.Result, Error: r.Error,
}
}
func (s *Server) ownerView(ctx context.Context, owner scheduling.Owner, names map[org.OrgID]string) scheduleOwnerView {
view := scheduleOwnerView{Kind: owner.Kind, ID: owner.ID}
id := org.OrgID(owner.ID)
if owner.Kind == scheduling.OwnerInstance {
id = org.DefaultOrgID
}
name, ok := names[id]
if !ok && s.Orgs != nil {
if found, err := s.Orgs.GetOrg(ctx, id); err == nil {
name = found.Name
}
names[id] = name
}
view.Name = name
return view
}
func (s *Server) scheduleView(ctx context.Context, sched scheduling.Schedule, names map[org.OrgID]string) scheduleView {
view := scheduleView{
ID: sched.ID, Name: sched.Name, Owner: s.ownerView(ctx, sched.Owner, names),
Enabled: sched.Enabled, BuiltIn: sched.BuiltIn, Timing: sched.Timing,
NextRun: optionalTime(sched.NextRun),
}
if sched.LastRun != nil {
last := runView(*sched.LastRun)
view.LastRun = &last
}
return view
}
func (s *Server) scheduleError(ctx context.Context, w http.ResponseWriter, op string, err error) {
switch {
case errors.Is(err, scheduling.ErrNotFound):
http.Error(w, "schedule not found", http.StatusNotFound)
case errors.Is(err, scheduling.ErrBuiltIn):
http.Error(w, scheduling.ErrBuiltIn.Error(), http.StatusConflict)
case errors.Is(err, scheduling.ErrInvalidSpec):
http.Error(w, err.Error(), http.StatusBadRequest)
default:
s.Log.ErrorContext(ctx, op, "err", err)
http.Error(w, op+" failed", http.StatusInternalServerError)
}
}
func (s *Server) schedulesReady(w http.ResponseWriter) bool {
if s.Schedules == nil {
http.Error(w, "schedules unavailable", http.StatusServiceUnavailable)
return false
}
return true
}
func (s *Server) handleSchedules(w http.ResponseWriter, r *http.Request) {
if !s.schedulesReady(w) {
return
}
list, err := s.Schedules.ListSchedules(r.Context())
if err != nil {
s.scheduleError(r.Context(), w, "list schedules", err)
return
}
names := map[org.OrgID]string{}
views := make([]scheduleView, 0, len(list))
for _, sched := range list {
views = append(views, s.scheduleView(r.Context(), sched, names))
}
writeJSON(w, map[string]any{"schedules": views})
}
// handleSchedulePut creates the schedule or replaces what the dashboard may
// change on it. New schedules belong to the instance.
func (s *Server) handleSchedulePut(w http.ResponseWriter, r *http.Request) {
if !s.authorizeTaskMutation(w, r) || !s.schedulesReady(w) {
return
}
var input scheduleInput
if err := json.NewDecoder(http.MaxBytesReader(w, r.Body, 64<<10)).Decode(&input); err != nil {
http.Error(w, "invalid schedule", http.StatusBadRequest)
return
}
id := r.PathValue("id")
sched, err := s.Schedules.GetSchedule(r.Context(), id)
switch {
case errors.Is(err, scheduling.ErrNotFound):
sched = scheduling.Schedule{ID: id, Owner: scheduling.Owner{Kind: scheduling.OwnerInstance}}
case err != nil:
s.scheduleError(r.Context(), w, "get schedule", err)
return
}
sched.Name, sched.Enabled, sched.Timing = input.Name, input.Enabled, input.Timing
saved, err := s.Schedules.PutSchedule(r.Context(), sched)
if err != nil {
s.scheduleError(r.Context(), w, "save schedule", err)
return
}
writeJSON(w, s.scheduleView(r.Context(), saved, map[org.OrgID]string{}))
}
func (s *Server) handleScheduleDelete(w http.ResponseWriter, r *http.Request) {
if !s.authorizeTaskMutation(w, r) || !s.schedulesReady(w) {
return
}
if err := s.Schedules.DeleteSchedule(r.Context(), r.PathValue("id")); err != nil {
s.scheduleError(r.Context(), w, "delete schedule", err)
return
}
w.WriteHeader(http.StatusNoContent)
}
func (s *Server) handleScheduleRunNow(w http.ResponseWriter, r *http.Request) {
if !s.authorizeTaskMutation(w, r) || !s.schedulesReady(w) {
return
}
run, err := s.Schedules.RequestScheduleRun(r.Context(), r.PathValue("id"))
if err != nil {
s.scheduleError(r.Context(), w, "run schedule", err)
return
}
writeJSON(w, runView(run))
}
// handleScheduleRuns lists a schedule's runs, each with the tasks its firing
// started: the binding dispatches recorded against the run's capture.
func (s *Server) handleScheduleRuns(w http.ResponseWriter, r *http.Request) {
if !s.schedulesReady(w) {
return
}
runs, err := s.Schedules.ListScheduleRuns(r.Context(), r.PathValue("id"), scheduleRunsShown)
if err != nil {
s.scheduleError(r.Context(), w, "list schedule runs", err)
return
}
views := make([]scheduleRunView, 0, len(runs))
for _, run := range runs {
view := runView(run)
view.TaskIDs = s.runTasks(r.Context(), run.CaptureID)
views = append(views, view)
}
writeJSON(w, map[string]any{"runs": views})
}
func (s *Server) runTasks(ctx context.Context, captureID string) []int64 {
if captureID == "" || s.Dispatches == nil {
return nil
}
dispatches, err := s.Dispatches.ListDispatches(ctx, storecontract.DispatchFilter{CaptureID: captureID, Limit: 50})
if err != nil {
s.Log.WarnContext(ctx, "schedule run tasks unavailable", "capture", captureID, "err", err)
return nil
}
var ids []int64
for _, d := range dispatches {
if d.TaskID != 0 {
ids = append(ids, d.TaskID)
}
}
return ids
}
+4 -3
View File
@@ -307,9 +307,10 @@ func routeOverride(action access.Action, path string) (access.Action, access.Res
return actionManage(action), access.KindIdentity, segmentValue(path, 2), true
case matchPrefix(path, "/api/orgs"):
return orgRouteAction(action, path), access.KindOrg, segmentValue(path, 2), true
case matchPrefix(path, "/api/extensions"):
// Installing and enabling an extension runs a process on the host, so it
// is the same administration as editing a control-plane resource.
case matchPrefix(path, "/api/extensions"), matchPrefix(path, "/api/schedules"):
// Installing and enabling an extension runs a process on the host, and
// a schedule runs unattended as the instance, so both are the same
// administration as editing a control-plane resource.
return actionManage(action), access.KindPolicy, segmentValue(path, 2), true
case matchPrefix(path, "/api/control-plane/resources"):
return controlPlaneResourceRoute(action, path)
+4
View File
@@ -199,6 +199,10 @@ func TestAdministrationRoutes(t *testing.T) {
{http.MethodGet, "/api/access/policies", access.ActionRead},
{http.MethodPut, "/api/access/policies", access.ActionManagePolicies},
{http.MethodDelete, "/api/access/policies", access.ActionManagePolicies},
{http.MethodGet, "/api/schedules", access.ActionRead},
{http.MethodPut, "/api/schedules/nightly", access.ActionManageIdentities},
{http.MethodPost, "/api/schedules/nightly/runs", access.ActionManageIdentities},
{http.MethodDelete, "/api/schedules/nightly", access.ActionDelete},
}
for _, tt := range tests {
t.Run(tt.method+" "+tt.path, func(t *testing.T) {
+9
View File
@@ -206,6 +206,10 @@ type Server struct {
// routes 503 and lists bindings without their last outcome.
Dispatches storecontract.DispatchLedger
// Schedules reads and edits the instance's schedules and their runs. Nil
// answers the /api/schedules routes 503.
Schedules ScheduleStore
// Sources persists capture sources and their signing setting.
// Optional: nil makes every
// /api/sources route answer 503 and marks no binding unsigned.
@@ -281,6 +285,11 @@ func (s *Server) registerCoreRoutes(mux *http.ServeMux) {
mux.HandleFunc("GET /api/skills", instanceOnly(s.handleSkills))
mux.HandleFunc("GET /api/curators", instanceOnly(s.handleCurators))
mux.HandleFunc("GET /api/captures", s.handleCaptures)
mux.HandleFunc("GET /api/schedules", instanceOnly(s.handleSchedules))
mux.HandleFunc("PUT /api/schedules/{id}", instanceOnly(s.handleSchedulePut))
mux.HandleFunc("DELETE /api/schedules/{id}", instanceOnly(s.handleScheduleDelete))
mux.HandleFunc("GET /api/schedules/{id}/runs", instanceOnly(s.handleScheduleRuns))
mux.HandleFunc("POST /api/schedules/{id}/runs", instanceOnly(s.handleScheduleRunNow))
mux.HandleFunc("GET /api/channels", instanceOnly(s.handleChannels))
mux.HandleFunc("POST /api/channels/{id}/reload", instanceOnly(s.handleChannelReload))
mux.HandleFunc("GET /api/version", s.handleVersion)
+1 -1
View File
@@ -1 +1 @@
import{A as e,C as t,Ct as n,D as r,M as i,S as a,Tt as o,Xt as s,_t as c,b as l,dt as u,ir as d,jn as f,k as p,l as m,t as h,x as g,xn as _,y as v}from"./PageHeader.js";import{M as y,at as b,r as x}from"./createLucideIcon.js";import{t as S}from"./input.js";import{C,I as w,L as T,N as E,R as D,_ as O,g as k,w as A}from"./index.js";var j={key:0,class:`text-fg-subtle`},M={key:1,role:`alert`,class:`mb-3 text-danger`},N={key:2,class:`mb-3 rounded-lg border border-border p-3`},P={key:3,class:`text-fg-subtle`},F={key:4,class:`divide-y divide-border`,"aria-label":`API tokens`},I={class:`flex-1 truncate text-xs`},L={class:`text-xs text-fg-subtle`},R=i({__name:`PersonalTokensCard`,setup(i){let o=_(!1),h=_([]),v=_(``),b=_(``),C=_(!1);async function w(e){C.value=!0;try{await e(),b.value=``}catch(e){b.value=String(e.message||e)}finally{C.value=!1}}let T=()=>w(async()=>{let e=await x.tokens();o.value=e?.available??!1,h.value=e?.tokens??[]}),D=()=>w(async()=>{v.value=(await x.createToken())?.token??``,await T()}),O=e=>w(async()=>{await x.revokeToken(e),await T()});return u(T),(i,u)=>(c(),g(f(k),{title:`API tokens`,description:o.value?`Send it as Authorization: Bearer <token>.`:void 0},r({default:s(()=>[!o.value&&!C.value&&!b.value?(c(),t(`p`,j,`Personal tokens need a signed-in person.`)):a(``,!0),b.value?(c(),t(`p`,M,d(b.value),1)):a(``,!0),v.value?(c(),t(`div`,N,[u[2]||=l(`p`,{class:`mb-2 text-xs`},`Not shown again.`,-1),e(f(S),{"model-value":v.value,readonly:``,"aria-label":`New token`,onFocus:u[0]||=e=>e.target.select()},null,8,[`model-value`])])):a(``,!0),o.value&&!h.value.length&&!C.value&&!b.value?(c(),t(`p`,P,`No tokens yet.`)):a(``,!0),h.value.length?(c(),t(`ul`,F,[(c(!0),t(m,null,n(h.value,n=>(c(),t(`li`,{key:n.id,class:`flex items-center gap-3 py-2`},[l(`code`,I,d(n.id.slice(0,12)),1),l(`span`,L,[e(f(A),{at:n.created_at},null,8,[`at`])]),e(f(y),{variant:`ghost`,size:`sm`,class:`text-danger`,disabled:C.value,onClick:e=>O(n.id)},{default:s(()=>[...u[3]||=[p(`Revoke`,-1)]]),_:1},8,[`disabled`,`onClick`])]))),128))])):a(``,!0)]),_:2},[o.value?{name:`action`,fn:s(()=>[e(f(y),{size:`sm`,disabled:C.value,onClick:D},{default:s(()=>[e(f(E),{"data-icon":`inline-start`}),u[1]||=p(`New token`,-1)]),_:1},8,[`disabled`])]),key:`0`}:void 0]),1032,[`description`]))}}),z={class:`mx-auto max-w-[80ch]`},B={class:`text-sm text-fg-muted`},V={key:1,role:`alert`,class:`mb-4 text-sm text-danger`},H={key:0,class:`mb-3 divide-y divide-border`},U={class:`min-w-0 flex-1 truncate`},W={key:2,class:`text-fg-muted`},G={key:0,class:`break-all rounded-md border border-border p-3 font-mono`,role:`status`},K={class:`flex justify-end border-t border-border pt-3`},q=i({__name:`AccountPage`,setup(r){let i=_(``),E=()=>J(async()=>{i.value=(await x.recoveryCode()).code}),A=T(),j=_([]),M=_(``),N=_(!1),P=_(``),F=_(``),I=_(``),L=v(()=>w(A.status?.public_url??``));async function q(){try{j.value=(await x.passkeys()).passkeys}catch(e){M.value=String(e.message||e)}}u(q);async function J(e){N.value=!0,M.value=``;try{await e()}catch(e){M.value=String(e.message||e)}finally{N.value=!1}}let Y=()=>J(async()=>{await D(!0,P.value),P.value=``,await q()}),X=e=>J(async()=>{await x.deletePasskey(e),await q()}),Z=()=>J(async()=>{await x.changePassword(F.value,I.value),F.value=I.value=``,window.location.assign(`/`)});return(r,u)=>{let _=o(`RouterLink`);return c(),t(`div`,z,[e(h,{title:`Your account`},{default:s(()=>[l(`span`,B,d(f(A).status?.user?.display_name),1)]),_:1}),r.$route.query.welcome?(c(),g(f(C),{key:0,class:`mb-4`},{default:s(()=>[u[5]||=p(`Your organisation and admin account are ready. Add a passkey below, `,-1),e(_,{class:`underline`,to:`/org/members`},{default:s(()=>[...u[3]||=[p(`add members`,-1)]]),_:1}),u[6]||=p(`, or `,-1),e(_,{class:`underline`,to:`/settings/authentication`},{default:s(()=>[...u[4]||=[p(`configure OIDC`,-1)]]),_:1}),u[7]||=p(`.`,-1)]),_:1})):a(``,!0),M.value?(c(),t(`p`,V,[p(d(M.value)+` `,1),u[8]||=l(`a`,{class:`underline`,href:`/?reauth=1`},`Sign in again`,-1)])):a(``,!0),e(f(k),{title:`Passkeys`},{default:s(()=>[j.value.length?(c(),t(`ul`,H,[(c(!0),t(m,null,n(j.value,n=>(c(),t(`li`,{key:n.id,class:`flex items-center gap-3 py-2`},[l(`span`,U,d(n.name),1),e(f(y),{variant:`ghost`,size:`sm`,class:`text-danger`,disabled:N.value,onClick:e=>X(n.id)},{default:s(()=>[...u[9]||=[p(`Remove`,-1)]]),_:1},8,[`disabled`,`onClick`])]))),128))])):a(``,!0),L.value?(c(),t(`form`,{key:1,class:`flex flex-wrap gap-2`,onSubmit:b(Y,[`prevent`])},[e(f(S),{modelValue:P.value,"onUpdate:modelValue":u[0]||=e=>P.value=e,"aria-label":`Passkey name`,placeholder:`Passkey name (optional)`,maxlength:`200`,class:`min-w-40 flex-1`},null,8,[`modelValue`]),e(f(y),{type:`submit`,disabled:N.value},{default:s(()=>[...u[10]||=[p(`Add passkey`,-1)]]),_:1},8,[`disabled`])],32)):(c(),t(`p`,W,[u[12]||=p(`Passkeys need an HTTPS domain or localhost. Set the instance URL in `,-1),e(_,{class:`underline`,to:`/settings/authentication`},{default:s(()=>[...u[11]||=[p(`Authentication sett Line truncated
import{A as e,C as t,Ct as n,D as r,M as i,S as a,Tt as o,Xt as s,_t as c,b as l,dt as u,ir as d,jn as f,k as p,l as m,t as h,x as g,xn as _,y as v}from"./PageHeader.js";import{M as y,at as b,r as x}from"./createLucideIcon.js";import{t as S}from"./input.js";import{r as C}from"./alert.js";import{B as w,E as T,F as E,H as D,M as O,V as k,w as A}from"./index.js";var j={key:0,class:`text-fg-subtle`},M={key:1,role:`alert`,class:`mb-3 text-danger`},N={key:2,class:`mb-3 rounded-lg border border-border p-3`},P={key:3,class:`text-fg-subtle`},F={key:4,class:`divide-y divide-border`,"aria-label":`API tokens`},I={class:`flex-1 truncate text-xs`},L={class:`text-xs text-fg-subtle`},R=i({__name:`PersonalTokensCard`,setup(i){let o=_(!1),h=_([]),v=_(``),b=_(``),C=_(!1);async function w(e){C.value=!0;try{await e(),b.value=``}catch(e){b.value=String(e.message||e)}finally{C.value=!1}}let T=()=>w(async()=>{let e=await x.tokens();o.value=e?.available??!1,h.value=e?.tokens??[]}),D=()=>w(async()=>{v.value=(await x.createToken())?.token??``,await T()}),k=e=>w(async()=>{await x.revokeToken(e),await T()});return u(T),(i,u)=>(c(),g(f(A),{title:`API tokens`,description:o.value?`Send it as Authorization: Bearer <token>.`:void 0},r({default:s(()=>[!o.value&&!C.value&&!b.value?(c(),t(`p`,j,`Personal tokens need a signed-in person.`)):a(``,!0),b.value?(c(),t(`p`,M,d(b.value),1)):a(``,!0),v.value?(c(),t(`div`,N,[u[2]||=l(`p`,{class:`mb-2 text-xs`},`Not shown again.`,-1),e(f(S),{"model-value":v.value,readonly:``,"aria-label":`New token`,onFocus:u[0]||=e=>e.target.select()},null,8,[`model-value`])])):a(``,!0),o.value&&!h.value.length&&!C.value&&!b.value?(c(),t(`p`,P,`No tokens yet.`)):a(``,!0),h.value.length?(c(),t(`ul`,F,[(c(!0),t(m,null,n(h.value,n=>(c(),t(`li`,{key:n.id,class:`flex items-center gap-3 py-2`},[l(`code`,I,d(n.id.slice(0,12)),1),l(`span`,L,[e(f(O),{at:n.created_at},null,8,[`at`])]),e(f(y),{variant:`ghost`,size:`sm`,class:`text-danger`,disabled:C.value,onClick:e=>k(n.id)},{default:s(()=>[...u[3]||=[p(`Revoke`,-1)]]),_:1},8,[`disabled`,`onClick`])]))),128))])):a(``,!0)]),_:2},[o.value?{name:`action`,fn:s(()=>[e(f(y),{size:`sm`,disabled:C.value,onClick:D},{default:s(()=>[e(f(E),{"data-icon":`inline-start`}),u[1]||=p(`New token`,-1)]),_:1},8,[`disabled`])]),key:`0`}:void 0]),1032,[`description`]))}}),z={class:`mx-auto max-w-[80ch]`},B={class:`text-sm text-fg-muted`},V={key:1,role:`alert`,class:`mb-4 text-sm text-danger`},H={key:0,class:`mb-3 divide-y divide-border`},U={class:`min-w-0 flex-1 truncate`},W={key:2,class:`text-fg-muted`},G={key:0,class:`break-all rounded-md border border-border p-3 font-mono`,role:`status`},K={class:`flex justify-end border-t border-border pt-3`},q=i({__name:`AccountPage`,setup(r){let i=_(``),E=()=>J(async()=>{i.value=(await x.recoveryCode()).code}),O=k(),j=_([]),M=_(``),N=_(!1),P=_(``),F=_(``),I=_(``),L=v(()=>w(O.status?.public_url??``));async function q(){try{j.value=(await x.passkeys()).passkeys}catch(e){M.value=String(e.message||e)}}u(q);async function J(e){N.value=!0,M.value=``;try{await e()}catch(e){M.value=String(e.message||e)}finally{N.value=!1}}let Y=()=>J(async()=>{await D(!0,P.value),P.value=``,await q()}),X=e=>J(async()=>{await x.deletePasskey(e),await q()}),Z=()=>J(async()=>{await x.changePassword(F.value,I.value),F.value=I.value=``,window.location.assign(`/`)});return(r,u)=>{let _=o(`RouterLink`);return c(),t(`div`,z,[e(h,{title:`Your account`},{default:s(()=>[l(`span`,B,d(f(O).status?.user?.display_name),1)]),_:1}),r.$route.query.welcome?(c(),g(f(C),{key:0,class:`mb-4`},{default:s(()=>[u[5]||=p(`Your organisation and admin account are ready. Add a passkey below, `,-1),e(_,{class:`underline`,to:`/org/members`},{default:s(()=>[...u[3]||=[p(`add members`,-1)]]),_:1}),u[6]||=p(`, or `,-1),e(_,{class:`underline`,to:`/settings/authentication`},{default:s(()=>[...u[4]||=[p(`configure OIDC`,-1)]]),_:1}),u[7]||=p(`.`,-1)]),_:1})):a(``,!0),M.value?(c(),t(`p`,V,[p(d(M.value)+` `,1),u[8]||=l(`a`,{class:`underline`,href:`/?reauth=1`},`Sign in again`,-1)])):a(``,!0),e(f(A),{title:`Passkeys`},{default:s(()=>[j.value.length?(c(),t(`ul`,H,[(c(!0),t(m,null,n(j.value,n=>(c(),t(`li`,{key:n.id,class:`flex items-center gap-3 py-2`},[l(`span`,U,d(n.name),1),e(f(y),{variant:`ghost`,size:`sm`,class:`text-danger`,disabled:N.value,onClick:e=>X(n.id)},{default:s(()=>[...u[9]||=[p(`Remove`,-1)]]),_:1},8,[`disabled`,`onClick`])]))),128))])):a(``,!0),L.value?(c(),t(`form`,{key:1,class:`flex flex-wrap gap-2`,onSubmit:b(Y,[`prevent`])},[e(f(S),{modelValue:P.value,"onUpdate:modelValue":u[0]||=e=>P.value=e,"aria-label":`Passkey name`,placeholder:`Passkey name (optional)`,maxlength:`200`,class:`min-w-40 flex-1`},null,8,[`modelValue`]),e(f(y),{type:`submit`,disabled:N.value},{default:s(()=>[...u[10]||=[p(`Add passkey`,-1)]]),_:1},8,[`disabled`])],32)):(c(),t(`p`,W,[u[12]||=p(`Passkeys need an HTTPS domain or localhost. Set the instance URL in `,-1),e(_,{class:`underline`,to:`/settings/authentication`},{default:s(()=>[...u[Line truncated
+1 -1
View File
@@ -1 +1 @@
import{A as e,C as t,M as n,S as r,Xt as i,_t as a,b as o,dt as s,ir as c,jn as l,k as u,t as d,x as f,xn as p,y as m}from"./PageHeader.js";import{M as h,at as g}from"./createLucideIcon.js";import{t as _}from"./input.js";import{_ as v,b as y,d as b,f as x,m as S,r as C,v as w,y as T}from"./index.js";var E={key:0,class:`mb-4 text-sm text-danger`,role:`alert`},D=`agent-profiles`,O=n({__name:`AgentProfilesPage`,setup(n){let O=y();s(O.load);let k=m(()=>O.drafts[D]?.value),A=p(``),j=p(``),M=m(()=>O.changesFor(D).length>0),N=m(()=>Object.entries(k.value??{}));function P(){if(M.value)return;let e=A.value.trim();if(!e||k.value?.[e])return;let t=O.drafts[D];t&&(t.value||={},t.value[e]={image:``,kit:``,adapter:``,tools:[]},A.value=``,j.value=String(Object.keys(t.value).indexOf(e)))}function F(e,t){e.tools=String(t).split(`,`).map(e=>e.trim()).filter(Boolean)}return(n,s)=>(a(),t(`div`,null,[e(d,{title:`Agent profiles`},{default:i(()=>[e(w,{kinds:[D]},null,8,[`kinds`])]),_:1}),e(T,{kind:D,class:`mb-4`}),l(O).catalogError||l(O).pageErrorFor(D)?(a(),t(`p`,E,c(l(O).catalogError||l(O).pageErrorFor(D)),1)):r(``,!0),o(`form`,{class:`mb-4 flex flex-wrap gap-2`,onSubmit:g(P,[`prevent`])},[e(l(_),{modelValue:A.value,"onUpdate:modelValue":s[0]||=e=>A.value=e,"aria-label":`Profile name`,placeholder:`Profile name`,class:`max-w-xs`,disabled:M.value},null,8,[`modelValue`,`disabled`]),e(l(h),{type:`submit`,disabled:M.value||!A.value.trim()||!!k.value?.[A.value.trim()]},{default:i(()=>[...s[3]||=[u(`Add profile`,-1)]]),_:1},8,[`disabled`])],32),Object.keys(k.value??{}).length?r(``,!0):(a(),f(l(S),{key:1},{default:i(()=>[e(l(x),null,{default:i(()=>[e(l(b),null,{default:i(()=>[...s[4]||=[u(`No agent profiles`,-1)]]),_:1})]),_:1})]),_:1})),e(C,{open:j.value,"onUpdate:open":s[1]||=e=>j.value=e,items:N.value,title:([e])=>e,"remove-label":`Remove`,mono:``,onRemove:s[2]||=e=>delete k.value[N.value[e][0]]},{default:i(({item:[t,n]})=>[e(l(v),{label:`Image`,for:`${t}-image`},{default:i(()=>[e(l(_),{id:`${t}-image`,modelValue:n.image,"onUpdate:modelValue":e=>n.image=e,placeholder:`Container image`},null,8,[`id`,`modelValue`,`onUpdate:modelValue`])]),_:2},1032,[`for`]),e(l(v),{label:`Kit`,for:`${t}-kit`,hint:`Pinned digest. Used only when Image is empty.`},{default:i(()=>[e(l(_),{id:`${t}-kit`,modelValue:n.kit,"onUpdate:modelValue":e=>n.kit=e,placeholder:`registry/kit@sha256:…`},null,8,[`id`,`modelValue`,`onUpdate:modelValue`])]),_:2},1032,[`for`]),e(l(v),{label:`Adapter`,for:`${t}-adapter`},{default:i(()=>[e(l(_),{id:`${t}-adapter`,modelValue:n.adapter,"onUpdate:modelValue":e=>n.adapter=e},null,8,[`id`,`modelValue`,`onUpdate:modelValue`])]),_:2},1032,[`for`]),e(l(v),{label:`Tools`,for:`${t}-tools`,hint:`Comma-separated tool names.`},{default:i(()=>[e(l(_),{id:`${t}-tools`,"model-value":(n.tools??[]).join(`, `),"onUpdate:modelValue":e=>F(n,e)},null,8,[`id`,`model-value`,`onUpdate:modelValue`])]),_:2},1032,[`for`])]),_:1},8,[`open`,`items`,`title`])]))}});export{O as default};
import{A as e,C as t,M as n,S as r,Xt as i,_t as a,b as o,dt as s,ir as c,jn as l,k as u,t as d,x as f,xn as p,y as m}from"./PageHeader.js";import{M as h,at as g}from"./createLucideIcon.js";import{n as _,o as v,t as y}from"./HistoryLink.js";import{t as b}from"./input.js";import{E as x,S,_ as C,a as w,y as T}from"./index.js";var E={key:0,class:`mb-4 text-sm text-danger`,role:`alert`},D=`agent-profiles`,O=n({__name:`AgentProfilesPage`,setup(n){let O=v();s(O.load);let k=m(()=>O.drafts[D]?.value),A=p(``),j=p(``),M=m(()=>O.changesFor(D).length>0),N=m(()=>Object.entries(k.value??{}));function P(){if(M.value)return;let e=A.value.trim();if(!e||k.value?.[e])return;let t=O.drafts[D];t&&(t.value||={},t.value[e]={image:``,kit:``,adapter:``,tools:[]},A.value=``,j.value=String(Object.keys(t.value).indexOf(e)))}function F(e,t){e.tools=String(t).split(`,`).map(e=>e.trim()).filter(Boolean)}return(n,s)=>(a(),t(`div`,null,[e(d,{title:`Agent profiles`},{default:i(()=>[e(y,{kinds:[D]},null,8,[`kinds`])]),_:1}),e(_,{kind:D,class:`mb-4`}),l(O).catalogError||l(O).pageErrorFor(D)?(a(),t(`p`,E,c(l(O).catalogError||l(O).pageErrorFor(D)),1)):r(``,!0),o(`form`,{class:`mb-4 flex flex-wrap gap-2`,onSubmit:g(P,[`prevent`])},[e(l(b),{modelValue:A.value,"onUpdate:modelValue":s[0]||=e=>A.value=e,"aria-label":`Profile name`,placeholder:`Profile name`,class:`max-w-xs`,disabled:M.value},null,8,[`modelValue`,`disabled`]),e(l(h),{type:`submit`,disabled:M.value||!A.value.trim()||!!k.value?.[A.value.trim()]},{default:i(()=>[...s[3]||=[u(`Add profile`,-1)]]),_:1},8,[`disabled`])],32),Object.keys(k.value??{}).length?r(``,!0):(a(),f(l(S),{key:1},{default:i(()=>[e(l(T),null,{default:i(()=>[e(l(C),null,{default:i(()=>[...s[4]||=[u(`No agent profiles`,-1)]]),_:1})]),_:1})]),_:1})),e(w,{open:j.value,"onUpdate:open":s[1]||=e=>j.value=e,items:N.value,title:([e])=>e,"remove-label":`Remove`,mono:``,onRemove:s[2]||=e=>delete k.value[N.value[e][0]]},{default:i(({item:[t,n]})=>[e(l(x),{label:`Image`,for:`${t}-image`},{default:i(()=>[e(l(b),{id:`${t}-image`,modelValue:n.image,"onUpdate:modelValue":e=>n.image=e,placeholder:`Container image`},null,8,[`id`,`modelValue`,`onUpdate:modelValue`])]),_:2},1032,[`for`]),e(l(x),{label:`Kit`,for:`${t}-kit`,hint:`Pinned digest. Used only when Image is empty.`},{default:i(()=>[e(l(b),{id:`${t}-kit`,modelValue:n.kit,"onUpdate:modelValue":e=>n.kit=e,placeholder:`registry/kit@sha256:…`},null,8,[`id`,`modelValue`,`onUpdate:modelValue`])]),_:2},1032,[`for`]),e(l(x),{label:`Adapter`,for:`${t}-adapter`},{default:i(()=>[e(l(b),{id:`${t}-adapter`,modelValue:n.adapter,"onUpdate:modelValue":e=>n.adapter=e},null,8,[`id`,`modelValue`,`onUpdate:modelValue`])]),_:2},1032,[`for`]),e(l(x),{label:`Tools`,for:`${t}-tools`,hint:`Comma-separated tool names.`},{default:i(()=>[e(l(b),{id:`${t}-tools`,"model-value":(n.tools??[]).join(`, `),"onUpdate:modelValue":e=>F(n,e)},null,8,[`id`,`model-value`,`onUpdate:modelValue`])]),_:2},1032,[`for`])]),_:1},8,[`open`,`items`,`title`])]))}});export{O as default};
+1 -1
View File
@@ -1 +1 @@
import{A as e,C as t,M as n,S as r,Xt as i,_t as a,b as o,dt as s,ir as c,jn as l,k as u,t as d,x as f,xn as p,y as m}from"./PageHeader.js";import{M as h,at as g,r as _}from"./createLucideIcon.js";import{t as v}from"./input.js";import{F as y,P as b,_ as x,g as S}from"./index.js";var C={key:0,class:`mb-4 text-sm text-danger`,role:`alert`},w={class:`flex items-center gap-2`},T={class:`min-w-0 flex-1 select-all break-all rounded-md border border-border bg-muted px-2 py-1.5 font-mono text-xs`},E={class:`flex items-center justify-end gap-2 border-t border-border pt-3`},D=n({__name:`AuthenticationPage`,setup(n){let D=p({public_url:``,oidc_issuer:``,oidc_audience:``,oidc_client_id:``}),O=p(!1),k=p(``),A=p(!1),j=p(!1);s(async()=>{try{D.value=await _.authentication(),O.value=!0}catch(e){k.value=String(e.message||e)}});let M=m(()=>`${D.value.public_url.replace(/\/$/,``)}/oauth2/callback`),N=p(!1);async function P(){await navigator.clipboard.writeText(M.value),N.value=!0,setTimeout(()=>N.value=!1,1500)}async function F(){A.value=!0,k.value=``,j.value=!1;try{await _.saveAuthentication(D.value),j.value=!0}catch(e){k.value=String(e.message||e)}finally{A.value=!1}}return(n,s)=>(a(),t(`div`,null,[e(d,{title:`Authentication`}),k.value?(a(),t(`p`,C,[u(c(k.value)+` `,1),s[4]||=o(`a`,{class:`underline`,href:`/?reauth=1`},`Sign in again`,-1)])):r(``,!0),O.value?(a(),t(`form`,{key:1,onSubmit:g(F,[`prevent`])},[e(l(S),{title:`Instance URL`},{default:i(()=>[e(l(x),{label:`Public address`,for:`instance-url`,hint:`Passkeys require HTTPS and a domain name, or localhost. Once passkeys are enrolled, their domain is fixed.`},{default:i(()=>[e(l(v),{id:`instance-url`,modelValue:D.value.public_url,"onUpdate:modelValue":s[0]||=e=>D.value.public_url=e,type:`url`,required:``},null,8,[`modelValue`])]),_:1})]),_:1}),e(l(S),{title:`OpenID Connect`},{default:i(()=>[e(l(x),{label:`Issuer URL`,for:`oidc-issuer`},{default:i(()=>[e(l(v),{id:`oidc-issuer`,modelValue:D.value.oidc_issuer,"onUpdate:modelValue":s[1]||=e=>D.value.oidc_issuer=e,type:`url`,placeholder:`https://identity.example.com`},null,8,[`modelValue`])]),_:1}),e(l(x),{label:`Client ID`,for:`oidc-client`},{default:i(()=>[e(l(v),{id:`oidc-client`,modelValue:D.value.oidc_client_id,"onUpdate:modelValue":s[2]||=e=>D.value.oidc_client_id=e},null,8,[`modelValue`])]),_:1}),e(l(x),{label:`Access token audience`,for:`oidc-audience`},{default:i(()=>[e(l(v),{id:`oidc-audience`,modelValue:D.value.oidc_audience,"onUpdate:modelValue":s[3]||=e=>D.value.oidc_audience=e},null,8,[`modelValue`])]),_:1}),e(l(x),{label:`Redirect URI`,hint:`Add permitted people in Organisation → Members.`},{default:i(()=>[o(`div`,w,[o(`code`,T,c(M.value),1),e(l(h),{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Copy redirect URI`,title:`Copy redirect URI`,onClick:P},{default:i(()=>[N.value?(a(),f(l(y),{key:0})):(a(),f(l(b),{key:1}))]),_:1})])]),_:1}),o(`div`,E,[j.value?(a(),f(l(y),{key:0,role:`status`,"aria-label":`Saved`,class:`size-4 text-fg-muted`})):r(``,!0),e(l(h),{type:`submit`,disabled:A.value},{default:i(()=>[...s[5]||=[u(`Save`,-1)]]),_:1},8,[`disabled`])])]),_:1})],32)):r(``,!0)]))}});export{D as default};
import{A as e,C as t,M as n,S as r,Xt as i,_t as a,b as o,dt as s,ir as c,jn as l,k as u,t as d,x as f,xn as p,y as m}from"./PageHeader.js";import{M as h,at as g,r as _}from"./createLucideIcon.js";import{t as v}from"./input.js";import{t as y}from"./check.js";import{E as b,L as x,w as S}from"./index.js";var C={key:0,class:`mb-4 text-sm text-danger`,role:`alert`},w={class:`flex items-center gap-2`},T={class:`min-w-0 flex-1 select-all break-all rounded-md border border-border bg-muted px-2 py-1.5 font-mono text-xs`},E={class:`flex items-center justify-end gap-2 border-t border-border pt-3`},D=n({__name:`AuthenticationPage`,setup(n){let D=p({public_url:``,oidc_issuer:``,oidc_audience:``,oidc_client_id:``}),O=p(!1),k=p(``),A=p(!1),j=p(!1);s(async()=>{try{D.value=await _.authentication(),O.value=!0}catch(e){k.value=String(e.message||e)}});let M=m(()=>`${D.value.public_url.replace(/\/$/,``)}/oauth2/callback`),N=p(!1);async function P(){await navigator.clipboard.writeText(M.value),N.value=!0,setTimeout(()=>N.value=!1,1500)}async function F(){A.value=!0,k.value=``,j.value=!1;try{await _.saveAuthentication(D.value),j.value=!0}catch(e){k.value=String(e.message||e)}finally{A.value=!1}}return(n,s)=>(a(),t(`div`,null,[e(d,{title:`Authentication`}),k.value?(a(),t(`p`,C,[u(c(k.value)+` `,1),s[4]||=o(`a`,{class:`underline`,href:`/?reauth=1`},`Sign in again`,-1)])):r(``,!0),O.value?(a(),t(`form`,{key:1,onSubmit:g(F,[`prevent`])},[e(l(S),{title:`Instance URL`},{default:i(()=>[e(l(b),{label:`Public address`,for:`instance-url`,hint:`Passkeys require HTTPS and a domain name, or localhost. Once passkeys are enrolled, their domain is fixed.`},{default:i(()=>[e(l(v),{id:`instance-url`,modelValue:D.value.public_url,"onUpdate:modelValue":s[0]||=e=>D.value.public_url=e,type:`url`,required:``},null,8,[`modelValue`])]),_:1})]),_:1}),e(l(S),{title:`OpenID Connect`},{default:i(()=>[e(l(b),{label:`Issuer URL`,for:`oidc-issuer`},{default:i(()=>[e(l(v),{id:`oidc-issuer`,modelValue:D.value.oidc_issuer,"onUpdate:modelValue":s[1]||=e=>D.value.oidc_issuer=e,type:`url`,placeholder:`https://identity.example.com`},null,8,[`modelValue`])]),_:1}),e(l(b),{label:`Client ID`,for:`oidc-client`},{default:i(()=>[e(l(v),{id:`oidc-client`,modelValue:D.value.oidc_client_id,"onUpdate:modelValue":s[2]||=e=>D.value.oidc_client_id=e},null,8,[`modelValue`])]),_:1}),e(l(b),{label:`Access token audience`,for:`oidc-audience`},{default:i(()=>[e(l(v),{id:`oidc-audience`,modelValue:D.value.oidc_audience,"onUpdate:modelValue":s[3]||=e=>D.value.oidc_audience=e},null,8,[`modelValue`])]),_:1}),e(l(b),{label:`Redirect URI`,hint:`Add permitted people in Organisation → Members.`},{default:i(()=>[o(`div`,w,[o(`code`,T,c(M.value),1),e(l(h),{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Copy redirect URI`,title:`Copy redirect URI`,onClick:P},{default:i(()=>[N.value?(a(),f(l(y),{key:0})):(a(),f(l(x),{key:1}))]),_:1})])]),_:1}),o(`div`,E,[j.value?(a(),f(l(y),{key:0,role:`status`,"aria-label":`Saved`,class:`size-4 text-fg-muted`})):r(``,!0),e(l(h),{type:`submit`,disabled:A.value},{default:i(()=>[...s[5]||=[u(`Save`,-1)]]),_:1},8,[`disabled`])])]),_:1})],32)):r(``,!0)]))}});export{D as default};
+1
View File
@@ -0,0 +1 @@
import{I as e,M as t,S as n}from"./badge.js";import{Gt as r,Kt as i,M as a,U as o,Z as s,hn as c,xn as l,y as u,yt as d}from"./PageHeader.js";import{P as f}from"./createLucideIcon.js";function p(n){let r=t(``,1e3);return{search:r,handleTypeaheadSearch:(t,i)=>{if(r.value+=t,n)n(t);else{let t=e(),n=i.map(e=>({...e,textValue:e.value?.textValue??e.ref.textContent?.trim()??``})),a=n.find(e=>e.ref===t),o=h(n.map(e=>e.textValue),r.value,a?.textValue),s=n.find(e=>e.textValue===o);return s&&s.ref.focus(),s?.ref}},resetTypeahead:()=>{r.value=``}}}function m(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function h(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=m(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function g(){let e=l();return{primitiveElement:e,currentElement:u(()=>[`#text`,`#comment`].includes(e.value?.$el.nodeName)?e.value?.$el.nextElementSibling:n(e))}}var _=`menu.itemSelect`,v=[`Enter`,` `],y=[`ArrowDown`,`PageUp`,`Home`],b=[`ArrowUp`,`PageDown`,`End`],x=[...y,...b],S={ltr:[...v,`ArrowRight`],rtl:[...v,`ArrowLeft`]},C={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]};function w(e){return e?`open`:`closed`}function T(e){return e===`indeterminate`}function E(e){return T(e)?`indeterminate`:e?`checked`:`unchecked`}function D(e){let{onEntryFocus:t,onEntryFocusOnce:n,...r}=e;return r}function O(t){let n=e();for(let r of t)if(r===n||(r.focus(),e()!==n))return}function k(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e].x,s=t[e].y,c=t[a].x,l=t[a].y;s>r!=l>r&&n<(c-o)*(r-s)/(l-s)+o&&(i=!i)}return i}function A(e,t){return t?k({x:e.clientX,y:e.clientY},t):!1}function j(e){return e.pointerType===`mouse`}var M=`data-reka-collection-item`;function N(e={}){let{key:t=``,isProvider:n=!1}=e,p=`${t}CollectionProvider`,m;if(n){let e=l(new Map);m={collectionRef:l(),itemMap:e},d(p,m)}else m=s(p);let h=(e,t=!1)=>{if(!m.collectionRef.value)return;let n=m.itemMap.value.get(e);return n&&(t||n.ref.dataset.disabled!==``)?n:void 0},_=(e=!1)=>{let t=m.collectionRef.value;if(!t)return[];let n=Array.from(t.querySelectorAll(`[${M}]`)),r=new Map(n.map((e,t)=>[e,t])),i=Array.from(m.itemMap.value.values()).sort((e,t)=>(r.get(e.ref)??-1)-(r.get(t.ref)??-1));return e?i:i.filter(e=>e.ref.dataset.disabled!==``)},v=a({name:`CollectionSlot`,inheritAttrs:!1,setup(e,{slots:t,attrs:n}){let{primitiveElement:i,currentElement:a}=g();return r(a,()=>{m.collectionRef.value=a.value}),()=>o(f,{ref:i,...n},t)}}),y=a({name:`CollectionItem`,inheritAttrs:!1,props:{value:{validator:()=>!0}},setup(e,{slots:t,attrs:n}){let{primitiveElement:r,currentElement:a}=g();return i(t=>{if(a.value){let n=c(a.value);m.itemMap.value.set(n,{ref:a.value,value:e.value}),t(()=>m.itemMap.value.delete(n))}}),()=>o(f,{...n,[M]:``,ref:r},t)}});return{getItems:_,getItem:h,reactiveItems:u(()=>Array.from(m.itemMap.value.values())),itemMapSize:u(()=>m.itemMap.value.size),CollectionSlot:v,CollectionItem:y}}export{m as _,v as a,O as c,T as d,j as f,p as g,g as h,b as i,E as l,D as m,x as n,C as o,A as p,_ as r,S as s,N as t,w as u};
+1 -1
View File
@@ -1 +1 @@
import{A as e,C as t,M as n,S as r,Xt as i,_t as a,dt as o,ir as s,jn as c,k as l,t as u,x as d,xn as f,y as p}from"./PageHeader.js";import{M as m}from"./createLucideIcon.js";import{t as h}from"./input.js";import{_ as g,b as _,d as v,f as y,h as b,m as x,r as S,v as C,y as w}from"./index.js";var T={key:0,class:`mb-4 text-sm text-danger`,role:`alert`},E=`credential-bindings`,D=n({__name:`CredentialBindingsPage`,setup(n){let D=_();o(D.load);let O=p(()=>D.drafts[E]?.value),k=f(``),A=p(()=>D.changesFor(E).length>0);function j(){if(A.value)return;let e=D.drafts[E];e&&(e.value||=[],e.value.push({service:``,org:``,secret:{engine:``,key:``}}),k.value=String(e.value.length-1))}return(n,o)=>(a(),t(`div`,null,[e(u,{title:`Credential bindings`},{default:i(()=>[e(C,{kinds:[E]},null,8,[`kinds`]),e(c(m),{disabled:A.value,onClick:j},{default:i(()=>[...o[2]||=[l(`Add binding`,-1)]]),_:1},8,[`disabled`])]),_:1}),e(w,{kind:E,class:`mb-4`}),c(D).catalogError||c(D).pageErrorFor(E)?(a(),t(`p`,T,s(c(D).catalogError||c(D).pageErrorFor(E)),1)):r(``,!0),O.value?.length?r(``,!0):(a(),d(c(x),{key:1},{default:i(()=>[e(c(y),null,{default:i(()=>[e(c(v),null,{default:i(()=>[...o[3]||=[l(`No credential bindings`,-1)]]),_:1})]),_:1})]),_:1})),e(S,{open:k.value,"onUpdate:open":o[0]||=e=>k.value=e,items:O.value??[],title:e=>e.service||`New binding`,"remove-label":`Remove`,mono:``,onRemove:o[1]||=e=>O.value.splice(e,1)},{default:i(({item:t,index:n})=>[e(c(g),{label:`Service`,for:`binding-${n}-service`},{default:i(()=>[e(c(h),{id:`binding-${n}-service`,modelValue:t.service,"onUpdate:modelValue":e=>t.service=e},null,8,[`id`,`modelValue`,`onUpdate:modelValue`])]),_:2},1032,[`for`]),e(c(g),{label:`Organisation`,for:`binding-${n}-org`,hint:`Empty uses the default organisation.`},{default:i(()=>[e(c(h),{id:`binding-${n}-org`,modelValue:t.org,"onUpdate:modelValue":e=>t.org=e},null,8,[`id`,`modelValue`,`onUpdate:modelValue`])]),_:2},1032,[`for`]),e(c(g),{label:`Secret`},{default:i(()=>[e(b,{modelValue:t.secret,"onUpdate:modelValue":e=>t.secret=e,"id-prefix":`binding-${n}-secret`},null,8,[`modelValue`,`onUpdate:modelValue`,`id-prefix`])]),_:2},1024)]),_:1},8,[`open`,`items`,`title`])]))}});export{D as default};
import{A as e,C as t,M as n,S as r,Xt as i,_t as a,dt as o,ir as s,jn as c,k as l,t as u,x as d,xn as f,y as p}from"./PageHeader.js";import{M as m}from"./createLucideIcon.js";import{n as h,o as g,t as _}from"./HistoryLink.js";import{t as v}from"./input.js";import{C as y,E as b,S as x,_ as S,a as C,y as w}from"./index.js";var T={key:0,class:`mb-4 text-sm text-danger`,role:`alert`},E=`credential-bindings`,D=n({__name:`CredentialBindingsPage`,setup(n){let D=g();o(D.load);let O=p(()=>D.drafts[E]?.value),k=f(``),A=p(()=>D.changesFor(E).length>0);function j(){if(A.value)return;let e=D.drafts[E];e&&(e.value||=[],e.value.push({service:``,org:``,secret:{engine:``,key:``}}),k.value=String(e.value.length-1))}return(n,o)=>(a(),t(`div`,null,[e(u,{title:`Credential bindings`},{default:i(()=>[e(_,{kinds:[E]},null,8,[`kinds`]),e(c(m),{disabled:A.value,onClick:j},{default:i(()=>[...o[2]||=[l(`Add binding`,-1)]]),_:1},8,[`disabled`])]),_:1}),e(h,{kind:E,class:`mb-4`}),c(D).catalogError||c(D).pageErrorFor(E)?(a(),t(`p`,T,s(c(D).catalogError||c(D).pageErrorFor(E)),1)):r(``,!0),O.value?.length?r(``,!0):(a(),d(c(x),{key:1},{default:i(()=>[e(c(w),null,{default:i(()=>[e(c(S),null,{default:i(()=>[...o[3]||=[l(`No credential bindings`,-1)]]),_:1})]),_:1})]),_:1})),e(C,{open:k.value,"onUpdate:open":o[0]||=e=>k.value=e,items:O.value??[],title:e=>e.service||`New binding`,"remove-label":`Remove`,mono:``,onRemove:o[1]||=e=>O.value.splice(e,1)},{default:i(({item:t,index:n})=>[e(c(b),{label:`Service`,for:`binding-${n}-service`},{default:i(()=>[e(c(v),{id:`binding-${n}-service`,modelValue:t.service,"onUpdate:modelValue":e=>t.service=e},null,8,[`id`,`modelValue`,`onUpdate:modelValue`])]),_:2},1032,[`for`]),e(c(b),{label:`Organisation`,for:`binding-${n}-org`,hint:`Empty uses the default organisation.`},{default:i(()=>[e(c(v),{id:`binding-${n}-org`,modelValue:t.org,"onUpdate:modelValue":e=>t.org=e},null,8,[`id`,`modelValue`,`onUpdate:modelValue`])]),_:2},1032,[`for`]),e(c(b),{label:`Secret`},{default:i(()=>[e(y,{modelValue:t.secret,"onUpdate:modelValue":e=>t.secret=e,"id-prefix":`binding-${n}-secret`},null,8,[`modelValue`,`onUpdate:modelValue`,`id-prefix`])]),_:2},1024)]),_:1},8,[`open`,`items`,`title`])]))}});export{D as default};
+1 -1
View File
@@ -1 +1 @@
import{t as e}from"./badge.js";import{A as t,C as n,Ct as r,M as i,S as a,Xt as o,_t as s,b as c,dt as l,ir as u,jn as d,k as f,l as p,st as m,t as h,x as g,xn as _}from"./PageHeader.js";import{M as v,n as y,r as b}from"./createLucideIcon.js";import{A as x,C as S,D as C,M as w,O as T,S as E,T as D,a as O,c as k,d as A,f as j,g as M,i as N,j as ee,k as P,l as F,m as I,n as L,o as R,s as z,t as B,u as V,w as H,x as U}from"./index.js";function W(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 G(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 K={class:`flex h-full min-h-0 flex-col gap-2`},q={key:0,class:`text-sm text-fg-muted`,role:`status`},J=i({__name:`SetupTerminal`,props:{profile:{}},setup(e){let t=e,r=_(null),i=_(`connecting`),o=null,u=null,d=null,h=null;function g(){try{d?.fit()}catch{}}return l(()=>{let e=r.value;if(!e)return;o=new L({convertEol:!0,cursorBlink:!0,fontFamily:`'IBM Plex Mono', ui-monospace, monospace`,fontSize:13,theme:{background:`#0b0f14`,foreground:`#e6edf3`,cursor:`#e6edf3`,selectionBackground:`#264f78`}}),d=new B,o.loadAddon(d),o.open(e),g(),o.focus();let n=new WebSocket(G(t.profile,window.location,o?.cols??80,o?.rows??24));u=n,n.binaryType=`arraybuffer`,n.onopen=()=>{i.value=`open`},n.onmessage=e=>{o&&(typeof e.data==`string`?o.write(e.data):o.write(new Uint8Array(e.data)))},n.onerror=()=>{i.value=`failed`},n.onclose=()=>{i.value=`closed`},o.onData(e=>{n.readyState===WebSocket.OPEN&&n.send(e)}),h=new ResizeObserver(g),h.observe(e)}),m(()=>{h?.disconnect(),h=null,u?.close(),u=null,o?.dispose(),o=null,d=null}),(e,t)=>(s(),n(`div`,K,[i.value===`open`?a(``,!0):(s(),n(`p`,q,[i.value===`connecting`?(s(),n(p,{key:0},[f(`Connecting…`)],64)):i.value===`closed`?(s(),n(p,{key:1},[f(`The terminal session ended.`)],64)):(s(),n(p,{key:2},[f(`Could not open the setup terminal.`)],64))])),c(`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)]))}}),Y={key:1,class:`flex flex-col gap-2`},X={class:`flex flex-wrap items-end gap-3`},Z={class:`flex flex-col gap-1 text-sm`},Q={class:`h-96`},$=i({__name:`HarnessPage`,setup(i){let m=_(null),L=_(!0),B=_(null),G=_(!1),K=_(``),q=_(!1),$={ready:{label:`Ready`,variant:`ok`},expiring:{label:`Expiring soon`,variant:`warn`},expired:{label:`Expired`,variant:`danger`},unconfigured:{label:`Not set up`,variant:`idle`}};l(te);async function te(){L.value=!0,B.value=null,G.value=!1;try{let e=await b.harnessBindings();m.value={terminal:e.terminal,bindings:e.bindings??[],profiles:e.profiles??[]},K.value=m.value.profiles[0]??``}catch(e){let t=e instanceof y?e.status:void 0;t===501||t===503?G.value=!0:B.value=e instanceof Error?e.message:String(e),m.value=null}finally{L.value=!1}}function ne(){m.value?.terminal&&K.value&&(q.value=!0)}function re(e){return e.scopes?.length?e.scopes.join(`, `):`–`}return(i,l)=>(s(),n(`div`,null,[t(h,{title:`Harness`}),B.value?(s(),g(d(S),{key:0,variant:`destructive`,class:`mb-4`},{default:o(()=>[t(d(U),null,{default:o(()=>[...l[1]||=[f(`Could not load the harness`,-1)]]),_:1}),t(d(E),null,{default:o(()=>[f(u(B.value),1)]),_:1})]),_:1})):a(``,!0),L.value?(s(),n(`div`,Y,[t(d(D),{class:`h-24 w-full`}),t(d(D),{class:`h-40 w-full`})])):G.value?(s(),g(d(I),{key:2},{default:o(()=>[t(d(j),null,{default:o(()=>[t(d(A),null,{default:o(()=>[...l[2]||=[f(`Harness bindings are not configured`,-1)]]),_:1})]),_:1})]),_:1})):m.value?(s(),n(p,{key:3},[m.value.terminal?(s(),g(d(M),{key:1},{default:o(()=>[c(`div`,X,[c(`div`,Z,[t(d(N),{for:`harness-profile`,class:`text-fg-muted`},{default:o(()=>[...l[5]||=[f(`Profile`,-1)]]),_:1}),t(d(w),{modelValue:K.value,"onUpdate:modelValue":l[0]||=e=>K.value=e,disabled:!m.value.profiles.length},{default:o(()=>[t(d(T),{id:`harness-profile`,size:`sm`,class:`min-w-48`},{default:o(()=>[t(d(C),{placeholder:`No profiles configured`})]),_:1}),t(d(ee),null,{default:o(()=>[t(d(x),null,{default:o(()=>[(s(!0),n(p,null,r(m.value.profiles,e=>(s(),g(d(P),{key:e,value:e},{default:o(()=>[f(u(e),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`modelValue`,`disabled`])]),t(d(v),{disabled:!K.value,onClick:ne},{default:o(()=>[...l[6]||=[f(`Open setup terminal`,-1)]]),_:1},8,[`disabled`])])]),_:1})):(s(),g(d(S),{key:0,class:`mb-4`},{default:o(()=>[t(d(U),null,{default:o(()=>[...l[3]||=[f(`Setup terminal unavailable`,-1)]]),_:1}),t(d(E),null,{default:o(()=>[...l[4]||=[f(`Start the daemon with a container runtime and a harness token to log in to a CLI from here.`,-1)]]),_:1})]),_:1})),q.value&&K.value?(s(),g(d(M),{key:2},{default:o(()=>[c(`div`,Q,[t(J,{profile:K.value},null,8,[`profile`])])]),_:1})):a(``,!0),t(d(M),null,{default:o(()=>[t(d(V),null,{default:o(()=>[t(d(O),null,{deLine truncated
import{t as e}from"./badge.js";import{A as t,C as n,Ct as r,M as i,S as a,Xt as o,_t as s,b as c,dt as l,ir as u,jn as d,k as f,l as p,st as m,t as h,x as g,xn as _}from"./PageHeader.js";import{M as ee,n as v,r as y}from"./createLucideIcon.js";import{a as b,i as x,n as S,o as C,s as w,t as T}from"./select.js";import{a as E,i as D,n as O,o as k,r as A,s as j,t as M}from"./table.js";import{n as N,r as P,t as F}from"./alert.js";import{M as I,S as L,_ as R,n as z,r as B,s as V,w as H,y as U}from"./index.js";function W(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 G(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 K={class:`flex h-full min-h-0 flex-col gap-2`},q={key:0,class:`text-sm text-fg-muted`,role:`status`},J=i({__name:`SetupTerminal`,props:{profile:{}},setup(e){let t=e,r=_(null),i=_(`connecting`),o=null,u=null,d=null,h=null;function g(){try{d?.fit()}catch{}}return l(()=>{let e=r.value;if(!e)return;o=new B({convertEol:!0,cursorBlink:!0,fontFamily:`'IBM Plex Mono', ui-monospace, monospace`,fontSize:13,theme:{background:`#0b0f14`,foreground:`#e6edf3`,cursor:`#e6edf3`,selectionBackground:`#264f78`}}),d=new z,o.loadAddon(d),o.open(e),g(),o.focus();let n=new WebSocket(G(t.profile,window.location,o?.cols??80,o?.rows??24));u=n,n.binaryType=`arraybuffer`,n.onopen=()=>{i.value=`open`},n.onmessage=e=>{o&&(typeof e.data==`string`?o.write(e.data):o.write(new Uint8Array(e.data)))},n.onerror=()=>{i.value=`failed`},n.onclose=()=>{i.value=`closed`},o.onData(e=>{n.readyState===WebSocket.OPEN&&n.send(e)}),h=new ResizeObserver(g),h.observe(e)}),m(()=>{h?.disconnect(),h=null,u?.close(),u=null,o?.dispose(),o=null,d=null}),(e,t)=>(s(),n(`div`,K,[i.value===`open`?a(``,!0):(s(),n(`p`,q,[i.value===`connecting`?(s(),n(p,{key:0},[f(`Connecting…`)],64)):i.value===`closed`?(s(),n(p,{key:1},[f(`The terminal session ended.`)],64)):(s(),n(p,{key:2},[f(`Could not open the setup terminal.`)],64))])),c(`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)]))}}),Y={key:1,class:`flex flex-col gap-2`},X={class:`flex flex-wrap items-end gap-3`},Z={class:`flex flex-col gap-1 text-sm`},Q={class:`h-96`},$=i({__name:`HarnessPage`,setup(i){let m=_(null),z=_(!0),B=_(null),G=_(!1),K=_(``),q=_(!1),$={ready:{label:`Ready`,variant:`ok`},expiring:{label:`Expiring soon`,variant:`warn`},expired:{label:`Expired`,variant:`danger`},unconfigured:{label:`Not set up`,variant:`idle`}};l(te);async function te(){z.value=!0,B.value=null,G.value=!1;try{let e=await y.harnessBindings();m.value={terminal:e.terminal,bindings:e.bindings??[],profiles:e.profiles??[]},K.value=m.value.profiles[0]??``}catch(e){let t=e instanceof v?e.status:void 0;t===501||t===503?G.value=!0:B.value=e instanceof Error?e.message:String(e),m.value=null}finally{z.value=!1}}function ne(){m.value?.terminal&&K.value&&(q.value=!0)}function re(e){return e.scopes?.length?e.scopes.join(`, `):`–`}return(i,l)=>(s(),n(`div`,null,[t(h,{title:`Harness`}),B.value?(s(),g(d(P),{key:0,variant:`destructive`,class:`mb-4`},{default:o(()=>[t(d(F),null,{default:o(()=>[...l[1]||=[f(`Could not load the harness`,-1)]]),_:1}),t(d(N),null,{default:o(()=>[f(u(B.value),1)]),_:1})]),_:1})):a(``,!0),z.value?(s(),n(`div`,Y,[t(d(j),{class:`h-24 w-full`}),t(d(j),{class:`h-40 w-full`})])):G.value?(s(),g(d(L),{key:2},{default:o(()=>[t(d(U),null,{default:o(()=>[t(d(R),null,{default:o(()=>[...l[2]||=[f(`Harness bindings are not configured`,-1)]]),_:1})]),_:1})]),_:1})):m.value?(s(),n(p,{key:3},[m.value.terminal?(s(),g(d(H),{key:1},{default:o(()=>[c(`div`,X,[c(`div`,Z,[t(d(V),{for:`harness-profile`,class:`text-fg-muted`},{default:o(()=>[...l[5]||=[f(`Profile`,-1)]]),_:1}),t(d(w),{modelValue:K.value,"onUpdate:modelValue":l[0]||=e=>K.value=e,disabled:!m.value.profiles.length},{default:o(()=>[t(d(S),{id:`harness-profile`,size:`sm`,class:`min-w-48`},{default:o(()=>[t(d(T),{placeholder:`No profiles configured`})]),_:1}),t(d(C),null,{default:o(()=>[t(d(b),null,{default:o(()=>[(s(!0),n(p,null,r(m.value.profiles,e=>(s(),g(d(x),{key:e,value:e},{default:o(()=>[f(u(e),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`modelValue`,`disabled`])]),t(d(ee),{disabled:!K.value,onClick:ne},{default:o(()=>[...l[6]||=[f(`Open setup terminal`,-1)]]),_:1},8,[`disabled`])])]),_:1})):(s(),g(d(P),{key:0,class:`mb-4`},{default:o(()=>[t(d(F),null,{default:o(()=>[...l[3]||=[f(`Setup terminal unavailable`,-1)]]),_:1}),t(d(N),null,{default:o(()=>[...l[4]||=[f(`Start the daemon with a container runtime and a harness token to log in to a CLI from here.`,-1)]]),_:1})]),_:1})),q.value&&K.value?(s(),g(d(H),{key:2},{default:o(()=>[c(`div`,Q,[t(J,{profile:K.value},null,8,[`profile`])])]),_:1})):a(``,!0Line truncated
+1
View File
@@ -0,0 +1 @@
import{E as e,L as t,a as n,c as r,d as i,f as a,g as o,h as s,j as c,l,m as u,o as d,p as f,r as p,s as m,t as h,u as g,y as _}from"./badge.js";import{A as v,C as y,Ct as b,Dt as ee,Gt as te,H as x,M as S,On as ne,S as C,Tt as w,Xt as T,_t as E,b as D,dt as re,gn as ie,ht as O,ir as k,jn as A,k as j,l as M,nr as N,r as ae,rt as P,wt as F,x as I,xn as L,y as R,yn as z}from"./PageHeader.js";import{C as oe,M as se,N as ce,a as le,at as B,c as ue,o as de,r as V,t as fe}from"./createLucideIcon.js";import{n as H}from"./pinia.js";import{n as U,t as pe}from"./nullish.js";import{i as me}from"./duration.js";import{n as he,r as ge,t as _e}from"./alert.js";function W(e,t){return pe(e)?!1:Array.isArray(e)?e.some(e=>U(e,t)):U(e,t)}function ve({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 ye({type:e,defaultValue:t,modelValue:n}){return e||ve({type:e,defaultValue:t,modelValue:n})}function be({type:e,defaultValue:t}){return t===void 0?e===`single`?void 0:[]:t}function xe(t,n){let r=R(()=>ye(t)),i=e(t,`modelValue`,n,{defaultValue:be(t),passive:t.modelValue===void 0,deep:!0});function a(e){if(r.value===`single`)i.value=U(e,i.value)?void 0:e;else{let t=Array.isArray(i.value)?[...i.value||[]]:[i.value].filter(Boolean);if(W(t,e)){let n=t.findIndex(t=>U(t,e));t.splice(n,1)}else t.push(e);i.value=t}}return{modelValue:i,changeModelValue:a,isSingle:R(()=>r.value===`single`)}}var[G,Se]=t(`PopoverRoot`),Ce=S({__name:`PopoverRoot`,props:{defaultOpen:{type:Boolean,required:!1,default:!1},open:{type:Boolean,required:!1,default:void 0},modal:{type:Boolean,required:!1,default:!1}},emits:[`update:open`],setup(t,{emit:n}){let r=t,i=n,{modal:a}=ne(r),o=e(r,`open`,i,{defaultValue:r.defaultOpen,passive:r.open===void 0});return Se({contentId:``,triggerId:``,modal:a,open:o,onOpenChange:e=>{o.value=e},onOpenToggle:()=>{o.value=!o.value},triggerElement:L(),hasCustomAnchor:L(!1)}),(e,t)=>(E(),I(A(d),null,{default:T(()=>[F(e.$slots,`default`,{open:A(o),close:()=>o.value=!1})]),_:3}))}}),we=S({__name:`PopoverContentImpl`,props:{trapFocus:{type:Boolean,required:!1},memoDependencies:{type:Array,required:!1},side:{type:null,required:!1},sideOffset:{type:Number,required:!1},sideFlip:{type:Boolean,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},alignFlip:{type:Boolean,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},hideShiftedArrow:{type:Boolean,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1},disableUpdateOnLayoutShift:{type:Boolean,required:!1},prioritizePosition:{type:Boolean,required:!1},reference:{type:null,required:!1},dir:{type:String,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1}},emits:[`escapeKeyDown`,`pointerDownOutside`,`focusOutside`,`interactOutside`,`openAutoFocus`,`closeAutoFocus`],setup(e,{emit:t}){let n=e,i=t,a=u(c(n,`trapFocus`,`disableOutsidePointerEvents`)),{forwardRef:d}=s(),f=G();return o(),(t,n)=>(E(),I(A(r),{"as-child":``,loop:``,trapped:e.trapFocus,onMountAutoFocus:n[5]||=e=>i(`openAutoFocus`,e),onUnmountAutoFocus:n[6]||=e=>i(`closeAutoFocus`,e)},{default:T(()=>[v(A(l),{"as-child":``,"disable-outside-pointer-events":e.disableOutsidePointerEvents,onPointerDownOutside:n[0]||=e=>i(`pointerDownOutside`,e),onInteractOutside:n[1]||=e=>i(`interactOutside`,e),onEscapeKeyDown:n[2]||=e=>i(`escapeKeyDown`,e),onFocusOutside:n[3]||=e=>i(`focusOutside`,e),onDismiss:n[4]||=e=>A(f).onOpenChange(!1)},{default:T(()=>[v(A(p),P(A(a),{id:A(f).contentId,ref:A(d),"data-state":A(f).open.value?`open`:`closed`,"aria-labelledby":A(f).triggerId,style:{"--reka-popover-content-transform-origin":`var(--reka-popper-transform-origin)`,"--reka-popover-content-available-width":`var(--reka-popper-available-width)`,"--reka-popover-content-available-height":`var(--reka-popper-available-height)`,"--reka-popover-trigger-width":`var(--reka-popper-anchor-width)`,"--reka-popover-trigger-height":`var(--reka-popper-anchor-height)`},role:`dialog`}),{default:T(()=>[F(t.$slots,`default`)]),_:3},16,[`id`,`data-state`,`aria-labelledby`])]),_:3},8,[`disable-outside-pointer-events`])]),_:3},8,[`trapped`]))}}),Te=S({__name:`PopoverContentModal`,props:{memoDependencies:{type:Array,required:!1},side:{type:null,required:!1},sideOffset:{type:Number,required:!1},sideFlip:{type:Boolean,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},alignFlip:{type:Boolean,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},hideShiftedArrow:{type:Boolean,required:!Line truncated
+1 -1
View File
@@ -1 +1 @@
import{A as e,C as t,M as n,Tt as r,Xt as i,_t as a,jn as o,k as s,t as c}from"./PageHeader.js";import{d as l,f as u,m as d,p as f}from"./index.js";var p=n({__name:`NotFoundPage`,setup(n){return(n,p)=>{let m=r(`RouterLink`);return a(),t(`div`,null,[e(c,{title:`Page not found`}),e(o(d),null,{default:i(()=>[e(o(u),null,{default:i(()=>[e(o(l),null,{default:i(()=>[...p[0]||=[s(`No page at this address`,-1)]]),_:1}),e(o(f),null,{default:i(()=>[e(m,{to:`/`},{default:i(()=>[...p[1]||=[s(`Return to dashboard`,-1)]]),_:1})]),_:1})]),_:1})]),_:1})])}}});export{p as default};
import{A as e,C as t,M as n,Tt as r,Xt as i,_t as a,jn as o,k as s,t as c}from"./PageHeader.js";import{S as l,_ as u,b as d,y as f}from"./index.js";var p=n({__name:`NotFoundPage`,setup(n){return(n,p)=>{let m=r(`RouterLink`);return a(),t(`div`,null,[e(c,{title:`Page not found`}),e(o(l),null,{default:i(()=>[e(o(f),null,{default:i(()=>[e(o(u),null,{default:i(()=>[...p[0]||=[s(`No page at this address`,-1)]]),_:1}),e(o(d),null,{default:i(()=>[e(m,{to:`/`},{default:i(()=>[...p[1]||=[s(`Return to dashboard`,-1)]]),_:1})]),_:1})]),_:1})]),_:1})])}}});export{p as default};
+1 -1
View File
@@ -1 +1 @@
import{A as e,C as t,M as n,S as r,Xt as i,_t as a,b as o,dt as s,ir as c,jn as l,k as u,t as d,x as f,xn as p,y as m}from"./PageHeader.js";import{M as h,at as g}from"./createLucideIcon.js";import{t as _}from"./input.js";import{E as v,b as y,d as b,f as x,m as S,r as C,v as w,y as T}from"./index.js";var E={key:0,class:`mb-4 text-sm text-danger`,role:`alert`},D=`eda-playbooks`,O=n({__name:`PlaybooksPage`,setup(n){let O=y();s(O.load);let k=m(()=>O.drafts[D]?.value),A=p(``),j=p(``),M=m(()=>O.changesFor(D).length>0);function N(){if(M.value)return;let e=A.value.trim();if(!e||k.value?.playbooks.some(t=>t.id===e))return;let t=O.drafts[D];t&&(t.value||={playbooks:[]},t.value.playbooks.push({id:e,yaml:``}),A.value=``,j.value=String(t.value.playbooks.length-1))}return(n,s)=>(a(),t(`div`,null,[e(d,{title:`Playbooks`},{default:i(()=>[e(w,{kinds:[D]},null,8,[`kinds`])]),_:1}),e(T,{kind:D,class:`mb-4`}),l(O).catalogError||l(O).pageErrorFor(D)?(a(),t(`p`,E,c(l(O).catalogError||l(O).pageErrorFor(D)),1)):r(``,!0),o(`form`,{class:`mb-4 flex flex-wrap gap-2`,onSubmit:g(N,[`prevent`])},[e(l(_),{modelValue:A.value,"onUpdate:modelValue":s[0]||=e=>A.value=e,"aria-label":`Playbook ID`,placeholder:`Playbook ID`,class:`max-w-xs`,disabled:M.value},null,8,[`modelValue`,`disabled`]),e(l(h),{type:`submit`,disabled:M.value||!A.value.trim()||k.value?.playbooks.some(e=>e.id===A.value.trim())},{default:i(()=>[...s[3]||=[u(`Add playbook`,-1)]]),_:1},8,[`disabled`])],32),k.value?.playbooks.length?r(``,!0):(a(),f(l(S),{key:1},{default:i(()=>[e(l(x),null,{default:i(()=>[e(l(b),null,{default:i(()=>[...s[4]||=[u(`No playbooks installed`,-1)]]),_:1})]),_:1})]),_:1})),e(C,{open:j.value,"onUpdate:open":s[1]||=e=>j.value=e,items:k.value?.playbooks??[],title:e=>e.id,"remove-label":`Remove`,mono:``,onRemove:s[2]||=e=>k.value.playbooks.splice(e,1)},{default:i(({item:t,index:n})=>[e(l(v),{id:`playbook-${n}`,modelValue:t.yaml,"onUpdate:modelValue":e=>t.yaml=e,"aria-label":`${t.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{O as default};
import{A as e,C as t,M as n,S as r,Xt as i,_t as a,b as o,dt as s,ir as c,jn as l,k as u,t as d,x as f,xn as p,y as m}from"./PageHeader.js";import{M as h,at as g}from"./createLucideIcon.js";import{n as _,o as v,t as y}from"./HistoryLink.js";import{t as b}from"./input.js";import{t as x}from"./textarea.js";import{S,_ as C,a as w,y as T}from"./index.js";var E={key:0,class:`mb-4 text-sm text-danger`,role:`alert`},D=`eda-playbooks`,O=n({__name:`PlaybooksPage`,setup(n){let O=v();s(O.load);let k=m(()=>O.drafts[D]?.value),A=p(``),j=p(``),M=m(()=>O.changesFor(D).length>0);function N(){if(M.value)return;let e=A.value.trim();if(!e||k.value?.playbooks.some(t=>t.id===e))return;let t=O.drafts[D];t&&(t.value||={playbooks:[]},t.value.playbooks.push({id:e,yaml:``}),A.value=``,j.value=String(t.value.playbooks.length-1))}return(n,s)=>(a(),t(`div`,null,[e(d,{title:`Playbooks`},{default:i(()=>[e(y,{kinds:[D]},null,8,[`kinds`])]),_:1}),e(_,{kind:D,class:`mb-4`}),l(O).catalogError||l(O).pageErrorFor(D)?(a(),t(`p`,E,c(l(O).catalogError||l(O).pageErrorFor(D)),1)):r(``,!0),o(`form`,{class:`mb-4 flex flex-wrap gap-2`,onSubmit:g(N,[`prevent`])},[e(l(b),{modelValue:A.value,"onUpdate:modelValue":s[0]||=e=>A.value=e,"aria-label":`Playbook ID`,placeholder:`Playbook ID`,class:`max-w-xs`,disabled:M.value},null,8,[`modelValue`,`disabled`]),e(l(h),{type:`submit`,disabled:M.value||!A.value.trim()||k.value?.playbooks.some(e=>e.id===A.value.trim())},{default:i(()=>[...s[3]||=[u(`Add playbook`,-1)]]),_:1},8,[`disabled`])],32),k.value?.playbooks.length?r(``,!0):(a(),f(l(S),{key:1},{default:i(()=>[e(l(T),null,{default:i(()=>[e(l(C),null,{default:i(()=>[...s[4]||=[u(`No playbooks installed`,-1)]]),_:1})]),_:1})]),_:1})),e(w,{open:j.value,"onUpdate:open":s[1]||=e=>j.value=e,items:k.value?.playbooks??[],title:e=>e.id,"remove-label":`Remove`,mono:``,onRemove:s[2]||=e=>k.value.playbooks.splice(e,1)},{default:i(({item:t,index:n})=>[e(l(x),{id:`playbook-${n}`,modelValue:t.yaml,"onUpdate:modelValue":e=>t.yaml=e,"aria-label":`${t.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{O as default};
+1
View File
@@ -0,0 +1 @@
import{t as e}from"./badge.js";import{A as t,C as n,Ct as r,Gt as i,M as a,S as o,Tt as s,Xt as c,_t as l,b as u,ht as d,ir as f,jn as p,k as m,l as h,t as g,x as _,xn as v,y}from"./PageHeader.js";import{M as b,r as x}from"./createLucideIcon.js";import{G as S,i as C,s as w,t as T}from"./schedule.js";import{s as E}from"./table.js";import{I as D,M as O,w as k,z as A}from"./index.js";var j={key:0,class:`mb-4 text-sm text-danger`,role:`alert`},M={key:0,class:`space-y-2`},N={class:`tabular-nums text-fg-muted`},P={class:`block max-w-md break-words whitespace-normal text-danger`},F={class:`flex flex-wrap gap-2`},I=a({__name:`ScheduleRunsPage`,setup(a){let I=S(),L=y(()=>String(I.params.id??``)),R=v(null),z=v(null),B=v(``);async function V(){let e=L.value;try{let[t,n]=await Promise.all([x.schedules(),x.scheduleRuns(e)]);if(e!==L.value)return;R.value=t.schedules?.find(t=>t.id===e)??null,z.value=n.runs??[],B.value=``}catch(t){e===L.value&&(B.value=t instanceof Error?t.message:String(t))}}i(L,()=>{z.value=null,V()},{immediate:!0});let H=setInterval(()=>void V(),15e3);d(()=>clearInterval(H));async function U(){B.value=``;try{await x.scheduleRunNow(L.value),await V()}catch(e){B.value=e instanceof Error?e.message:String(e)}}let W=[{id:`scheduled`,label:`Scheduled`,fixed:!0,sort:e=>e.scheduled_for},{id:`started`,label:`Started`},{id:`duration`,label:`Duration`},{id:`result`,label:`Result`,sort:e=>e.result},{id:`error`,label:`Error`},{id:`tasks`,label:`Tasks`}];return(i,a)=>{let d=s(`RouterLink`);return l(),n(`div`,null,[t(g,{title:R.value?.name||`Schedule runs`},{default:c(()=>[t(p(b),{variant:`ghost`,size:`sm`,"as-child":``},{default:c(()=>[t(d,{to:`/org/schedules`},{default:c(()=>[t(p(A),{"data-icon":`inline-start`}),a[0]||=m(`Schedules`,-1)]),_:1})]),_:1}),t(p(b),{size:`sm`,disabled:!R.value,onClick:U},{default:c(()=>[t(p(D),{"data-icon":`inline-start`}),a[1]||=m(`Run now`,-1)]),_:1},8,[`disabled`])]),_:1},8,[`title`]),B.value?(l(),n(`p`,j,f(B.value),1)):o(``,!0),t(p(k),null,{default:c(()=>[!z.value&&!B.value?(l(),n(`div`,M,[t(p(E),{class:`h-8 w-full`}),t(p(E),{class:`h-8 w-full`})])):z.value?(l(),_(p(w),{key:1,columns:W,rows:z.value,"row-key":e=>String(e.id),"storage-key":`schedule-runs`,"initial-sort":{id:`scheduled`,desc:!0}},{empty:c(()=>[...a[2]||=[u(`p`,{class:`py-4 text-center text-sm text-fg-subtle`},`No runs yet.`,-1)]]),"cell-scheduled":c(({row:e})=>[t(p(O),{at:e.scheduled_for,absolute:``},null,8,[`at`])]),"cell-started":c(({row:e})=>[t(p(O),{at:e.started,absolute:``},null,8,[`at`])]),"cell-duration":c(({row:e})=>[u(`span`,N,f(p(C)(e)||`–`),1)]),"cell-result":c(({row:n})=>[t(p(e),{variant:p(T)[n.result]??`idle`},{default:c(()=>[m(f(n.result),1)]),_:2},1032,[`variant`])]),"cell-error":c(({row:e})=>[u(`span`,P,f(e.error),1)]),"cell-tasks":c(({row:e})=>[u(`span`,F,[(l(!0),n(h,null,r(e.task_ids??[],e=>(l(),_(d,{key:e,to:`/tasks/${e}`,class:`font-mono hover:underline`},{default:c(()=>[m(`#`+f(e),1)]),_:2},1032,[`to`]))),128))])]),_:1},8,[`rows`,`row-key`])):o(``,!0)]),_:1})])}}});export{I as default};
+1
View File
@@ -0,0 +1 @@
import{t as e}from"./badge.js";import{A as t,C as n,Ct as r,M as ee,S as i,Tt as te,Xt as a,_t as o,b as s,dt as c,ht as l,ir as u,jn as d,k as f,l as p,t as ne,x as m,xn as h,y as g}from"./PageHeader.js";import{M as _,r as v}from"./createLucideIcon.js";import{r as re}from"./pinia.js";import{a as ie,d as ae,g as oe,i as se,p as y,s as ce}from"./schedule.js";import{a as le,n as ue,o as de,t as fe}from"./HistoryLink.js";import{s as b}from"./table.js";import{A as pe,D as me,E as x,F as S,M as C,N as he,O as ge,P as _e,R as ve,S as ye,T as be,_ as xe,c as Se,d as Ce,f as w,g as T,h as E,i as D,j as O,k,l as A,m as we,o as j,p as Te,t as Ee,u as De,v as Oe,w as M,x as ke,y as Ae}from"./index.js";var je={key:0,class:`mb-4 text-sm text-danger`,role:`alert`},Me={key:0,class:`text-sm text-danger`,role:`alert`},Ne={key:1,class:`space-y-2`},Pe={class:`flex items-center gap-2`},Fe={class:`truncate`},Ie={class:`text-fg-muted`},Le=[`title`],Re={key:1,class:`text-fg-subtle`},ze={class:`tabular-nums text-fg-muted`},Be={key:1,class:`text-fg-subtle`},Ve={key:0,class:`text-sm text-danger`,role:`alert`},N=`schedule-settings`,P=ee({__name:`SchedulesPage`,setup(ee){let P=h(null),F=h(``),I=h(``),L;async function R(){try{let e=await v.schedules();P.value=e.schedules??[],F.value=``}catch(e){F.value=e instanceof Error?e.message:String(e)}}c(()=>{R(),L=setInterval(()=>void R(),3e4)}),l(()=>clearInterval(L));let z=de(),{catalog:He}=re(z);c(z.load);let B=g(()=>le(He.value,`schedules`)),V=g(()=>z.drafts[N]?.value),H=g(()=>z.pageErrorFor(N)),Ue=g(()=>V.value?.time_zone||`UTC`),We=he(),Ge=e=>_e(new Date(e),We.timeZone),Ke=e=>ie(e.timing,Ue.value,Ge),U=e=>e.owner.name||e.owner.id||e.owner.kind,qe=[{id:`enabled`,label:`Enabled`,fixed:!0,class:`w-0`},{id:`name`,label:`Name`,fixed:!0,sort:e=>e.name.toLowerCase()},{id:`owner`,label:`Owner`,sort:U},{id:`interval`,label:`Interval`},{id:`last`,label:`Last Run`,sort:e=>e.last_run?.scheduled_for??``},{id:`duration`,label:`Last Duration`},{id:`next`,label:`Next Run`,sort:e=>e.next_run??``}];function W(e){if(!P.value)return;let t=P.value.findIndex(t=>t.id===e.id);t<0?P.value.push(e):P.value[t]=e}async function G(e){I.value=``;try{await e()}catch(e){I.value=e instanceof Error?e.message:String(e)}}let Je=(e,t)=>G(async()=>W(await v.scheduleSave(e.id,{...e,enabled:t}))),K=e=>G(async()=>{await v.scheduleRunNow(e.id),await R()}),q=h(null),J=h(``),Y=h(!1);function X(e,t){q.value=e,J.value=t,Y.value=!0}function Z(){return{id:crypto.randomUUID(),name:``,owner:{kind:`instance`},enabled:!0,built_in:!1,timing:{kind:`interval`,interval:`24h0m0s`}}}let Q=()=>X(Z(),`New schedule`),Ye=e=>X({...Z(),name:`${e.name} copy`,timing:{...e.timing},enabled:!1},`Duplicate schedule`),$=h(null),Xe=()=>G(async()=>{let e=$.value;$.value=null,e&&(await v.scheduleDelete(e.id),P.value=P.value?.filter(t=>t.id!==e.id)??null)});return(ee,c)=>{let l=te(`RouterLink`);return o(),n(`div`,null,[t(ne,{title:`Schedules`},{default:a(()=>[t(fe,{kinds:B.value.map(e=>e.kind)},null,8,[`kinds`]),t(d(_),{size:`sm`,disabled:!P.value,onClick:Q},{default:a(()=>[t(d(S),{"data-icon":`inline-start`}),c[5]||=f(`Add schedule`,-1)]),_:1},8,[`disabled`])]),_:1}),(o(!0),n(p,null,r(B.value,e=>(o(),m(ue,{key:e.kind,kind:e.kind,class:`mb-4`},null,8,[`kind`]))),128)),I.value?(o(),n(`p`,je,u(I.value),1)):i(``,!0),t(d(M),null,{default:a(()=>[F.value?(o(),n(`p`,Me,u(F.value),1)):P.value?(o(),m(d(ce),{key:2,columns:qe,rows:P.value,"row-key":e=>e.id,"storage-key":`schedules`,"initial-sort":{id:`name`,desc:!1}},{empty:a(()=>[t(d(ye),null,{default:a(()=>[t(d(Oe),{variant:`icon`},{default:a(()=>[t(d(ve))]),_:1}),t(d(Ae),null,{default:a(()=>[t(d(xe),null,{default:a(()=>[...c[6]||=[f(`No schedules yet`,-1)]]),_:1})]),_:1}),t(d(ke),null,{default:a(()=>[t(d(_),{size:`sm`,onClick:Q},{default:a(()=>[t(d(S),{"data-icon":`inline-start`}),c[7]||=f(`Add schedule`,-1)]),_:1})]),_:1})]),_:1})]),"cell-enabled":a(({row:e})=>[t(d(be),{"model-value":e.enabled,"aria-label":`${e.name} enabled`,"onUpdate:modelValue":t=>Je(e,t)},null,8,[`model-value`,`aria-label`,`onUpdate:modelValue`])]),"cell-name":a(({row:t})=>[s(`span`,Pe,[s(`span`,Fe,u(t.name),1),t.built_in?(o(),m(d(e),{key:0,variant:`outline`},{default:a(()=>[...c[8]||=[f(`Built-in`,-1)]]),_:1})):i(``,!0)])]),"cell-owner":a(({row:e})=>[s(`span`,Ie,u(U(e)),1)]),"cell-interval":a(({row:e})=>[s(`span`,{title:e.timing.kind===`cron`?e.timing.cron:void 0},u(Ke(e)),9,Le)]),"cell-last":a(({row:r})=>[r.last_run?(o(),m(l,{key:0,to:`/org/schedules/${encodeURIComponent(r.id)}/runs`,class:`inline-flex items-center gap-2 hover:underline`},{default:a(()=>[t(d(C),{at:r.last_run.started||r.last_run.scheduled_for},null,8,[`at`]),r.last_run.result===`failed`?(o(),m(d(e),{key:0,variant:`danger`,title:r.last_run.error},{default:a(()=>[...c[9]||=[f(`failed`,-1)]]),_:1},8,[`title`])):r.last_run.result===`running`?(o(),m(d(e),{key:1,variant:`idle`},{default:a(()=>[...c[10]||=[f(`running`,-1)]]),_:1})):i(``,!0)]),_:2},1032,[`to`])):(o(),n(`span`,Re,`–`))])Line truncated
+1
View File
@@ -0,0 +1 @@
import{S as e}from"./badge.js";import{M as t,Xt as n,_t as r,jn as i,kn as a,wt as o,x as s,y as c}from"./PageHeader.js";import{N as l}from"./createLucideIcon.js";function u(e,t=-1/0,n=1/0){return Math.min(n,Math.max(t,e))}function d(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 f(e,t,n,r){t=Number(t),n=Number(n);let i=(e-(Number.isNaN(t)?0:t))%r,a=d(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(d(n/r,r))*r):a<t?a=t:!Number.isNaN(n)&&a>n&&(a=t+Math.floor(d((n-t)/r,r))*r),a=d(a,r),a}function p(t){return c(()=>!a(t)||!!e(t)?.closest(`form`))}var m=t({__name:`VisuallyHidden`,props:{feature:{type:String,required:!1,default:`focusable`},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`span`}},setup(e){return(t,a)=>(r(),s(i(l),{as:e.as,"as-child":e.asChild,"aria-hidden":e.feature===`fully-hidden`?`true`:void 0,"data-hidden":e.feature===`fully-hidden`?``:void 0,tabindex:e.feature===`fully-hidden`?`-1`:void 0,style:{position:`absolute`,border:0,width:`1px`,height:`1px`,padding:0,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,clipPath:`inset(50%)`,whiteSpace:`nowrap`,wordWrap:`normal`,top:`-1px`,left:`-1px`}},{default:n(()=>[o(t.$slots,`default`)]),_:3},8,[`as`,`as-child`,`aria-hidden`,`data-hidden`,`tabindex`]))}});export{f as i,p as n,u as r,m as t};
+1
View File
@@ -0,0 +1 @@
import{C as e,M as t,_t as n,er as r,jn as i,n as a,r as o,wt as s}from"./PageHeader.js";var c=t({__name:`Alert`,props:{class:{type:[Boolean,null,String,Object,Array]},variant:{}},setup(t){let a=t;return(c,l)=>(n(),e(`div`,{"data-slot":`alert`,class:r(i(o)(i(d)({variant:t.variant}),a.class)),role:`alert`},[s(c.$slots,`default`)],2))}}),l=t({__name:`AlertDescription`,props:{class:{type:[Boolean,null,String,Object,Array]}},setup(t){let a=t;return(t,c)=>(n(),e(`div`,{"data-slot":`alert-description`,class:r(i(o)(`text-fg-muted text-sm text-balance md:text-pretty [&_p:not(:last-child)]:mb-4 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground`,a.class))},[s(t.$slots,`default`)],2))}}),u=t({__name:`AlertTitle`,props:{class:{type:[Boolean,null,String,Object,Array]}},setup(t){let a=t;return(t,c)=>(n(),e(`div`,{"data-slot":`alert-title`,class:r(i(o)(`font-medium group-has-[>svg]/alert:col-start-2 cn-font-heading [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground`,a.class))},[s(t.$slots,`default`)],2))}}),d=a(`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`,warn:`border-warn/40 bg-warn-soft *:[svg]:text-warn`}},defaultVariants:{variant:`default`}});export{l as n,c as r,u as t};
+2 -2
View File
@@ -1,3 +1,3 @@
import{$ as e,$t as t,A as n,An as r,At as i,B as a,Bt as o,C as s,Cn as c,Ct as l,D as u,Dn as d,Dt as f,E as p,En as m,Et as h,F as g,Fn as _,Ft as v,G as y,Gt as b,H as x,Ht as S,I as C,It as w,J as T,Jt as E,K as ee,Kt as D,L as O,Lt as te,M as k,Mt as ne,N as re,Nt as ie,O as ae,On as oe,Ot as se,P as ce,Pn as le,Pt as ue,Q as de,Qt as fe,R as pe,Rt as me,S as he,Sn as ge,St as _e,T as ve,Tn as ye,Tt as be,U as xe,Ut as Se,V as Ce,Vt as we,W as Te,Wt as Ee,X as De,Xt as Oe,Y as ke,Yt as Ae,Z as je,Zt as Me,_ as Ne,_n as Pe,_t as A,a as Fe,an as Ie,ar as Le,at as Re,b as ze,bn as Be,bt as Ve,c as He,cn as Ue,ct as We,d as Ge,dn as Ke,dt as qe,en as Je,er as Ye,et as Xe,f as Ze,fn as Qe,ft as $e,g as et,gn as tt,gt as nt,h as rt,hn as it,ht as at,i as ot,in as st,ir as ct,it as j,j as lt,jn as M,jt as ut,k as dt,kn as N,kt as ft,l as pt,ln as mt,lt as ht,m as gt,mn as _t,mt as vt,n as yt,nn as bt,nr as xt,nt as St,o as Ct,on as wt,ot as Tt,p as Et,pn as Dt,pt as Ot,q as kt,qt as At,r as jt,rn as Mt,rr as Nt,rt as Pt,s as Ft,sn as It,st as Lt,tn as Rt,tt as zt,u as Bt,un as Vt,ut as Ht,v as Ut,vn as Wt,vt as Gt,w as Kt,wn as qt,wt as P,x as F,xn as I,xt as Jt,y as L,yn as Yt,yt as Xt,z as Zt,zt as Qt}from"./PageHeader.js";import{$ as $t,B as en,C as tn,F as nn,G as rn,H as an,I as on,J as sn,K as cn,L as ln,N as un,Q as dn,R as fn,U as pn,V as mn,W as hn,X as gn,Y as _n,Z as vn,at as yn,et as bn,it as xn,nt as Sn,q as Cn,rt as wn,t as Tn,tt as En,z as Dn}from"./createLucideIcon.js";var On=Object.defineProperty,kn=(e,t)=>{let n={};for(var r in e)On(n,r,{get:e[r],enumerable:!0});return t||On(n,Symbol.toStringTag,{value:`Module`}),n},An=kn({BaseTransition:()=>ot,BaseTransitionPropsValidators:()=>Fe,Comment:()=>Ct,DeprecationTypes:()=>null,EffectScope:()=>Rt,ErrorCodes:()=>Ft,ErrorTypeStrings:()=>He,Fragment:()=>pt,KeepAlive:()=>Bt,ReactiveEffect:()=>bt,Static:()=>Ge,Suspense:()=>Ze,Teleport:()=>Et,Text:()=>gt,TrackOpTypes:()=>Mt,Transition:()=>on,TransitionGroup:()=>ln,TriggerOpTypes:()=>st,VueElement:()=>fn,assertNumber:()=>rt,callWithAsyncErrorHandling:()=>et,callWithErrorHandling:()=>Ne,camelize:()=>le,capitalize:()=>_,cloneVNode:()=>Ut,compatUtils:()=>null,compile:()=>jn,computed:()=>L,createApp:()=>Dn,createBlock:()=>F,createCommentVNode:()=>he,createElementBlock:()=>s,createElementVNode:()=>ze,createHydrationRenderer:()=>Kt,createPropsRestProxy:()=>ve,createRenderer:()=>p,createSSRApp:()=>en,createSlots:()=>u,createStaticVNode:()=>ae,createTextVNode:()=>dt,createVNode:()=>n,customRef:()=>Ie,defineAsyncComponent:()=>lt,defineComponent:()=>k,defineCustomElement:()=>mn,defineEmits:()=>re,defineExpose:()=>ce,defineModel:()=>g,defineOptions:()=>C,defineProps:()=>O,defineSSRCustomElement:()=>an,defineSlots:()=>pe,devtools:()=>Zt,effect:()=>wt,effectScope:()=>It,getCurrentInstance:()=>a,getCurrentScope:()=>Ue,getCurrentWatcher:()=>mt,getTransitionRawChildren:()=>Ce,guardReactiveProps:()=>x,h:()=>xe,handleError:()=>Te,hasInjectionContext:()=>y,hydrate:()=>pn,hydrateOnIdle:()=>ee,hydrateOnInteraction:()=>kt,hydrateOnMediaQuery:()=>T,hydrateOnVisible:()=>ke,initCustomFormatter:()=>De,initDirectivesForSSR:()=>hn,inject:()=>je,isMemoSame:()=>de,isProxy:()=>Vt,isReactive:()=>Ke,isReadonly:()=>Qe,isRef:()=>Dt,isRuntimeOnly:()=>e,isShallow:()=>_t,isVNode:()=>Xe,markRaw:()=>it,mergeDefaults:()=>zt,mergeModels:()=>St,mergeProps:()=>Pt,nextTick:()=>j,nodeOps:()=>rn,normalizeClass:()=>Ye,normalizeProps:()=>xt,normalizeStyle:()=>Nt,onActivated:()=>Re,onBeforeMount:()=>Tt,onBeforeUnmount:()=>Lt,onBeforeUpdate:()=>We,onDeactivated:()=>ht,onErrorCaptured:()=>Ht,onMounted:()=>qe,onRenderTracked:()=>$e,onRenderTriggered:()=>Ot,onScopeDispose:()=>tt,onServerPrefetch:()=>vt,onUnmounted:()=>at,onUpdated:()=>nt,onWatcherCleanup:()=>Pe,openBlock:()=>A,patchProp:()=>cn,popScopeId:()=>Gt,provide:()=>Xt,proxyRefs:()=>Wt,pushScopeId:()=>Ve,queuePostFlushCb:()=>Jt,reactive:()=>Yt,readonly:()=>Be,ref:()=>I,registerRuntimeCompiler:()=>_e,render:()=>Cn,renderList:()=>l,renderSlot:()=>P,resolveComponent:()=>be,resolveDirective:()=>h,resolveDynamicComponent:()=>f,resolveFilter:()=>null,resolveTransitionHooks:()=>se,setBlockTracking:()=>ft,setDevtoolsHook:()=>i,setTransitionHooks:()=>ut,shallowReactive:()=>ge,shallowReadonly:()=>c,shallowRef:()=>qt,ssrContextKey:()=>ne,ssrUtils:()=>ie,stop:()=>ye,toDisplayString:()=>ct,toHandlerKey:()=>Le,toHandlers:()=>ue,toRaw:()=>m,toRef:()=>d,toRefs:()=>oe,toValue:()=>N,transformVNodeArgs:()=>v,triggerRef:()=>r,unref:()=>M,useAttrs:()=>w,useCssModule:()=>sn,useCssVars:()=>_n,useHost:()=>gn,useId:()=>te,useModel:()=>me,useSSRContext:()=>Qt,useShadowRoot:()=>vn,useSlots:()=>o,useTemplateRef:()=>we,useTransitionState:()=>S,vModelCheckbox:()=>dn,vModelDynamic:()=>$t,vModelRadio:()=>bn,vModelSelect:()=>En,vModelText:()=>Sn,vShow:()=>wn,version:()=>Se,warn:()=>Ee,watch:()=>b,watchEffect:()=>D,watchPostEffect:()=>At,watchSyncEffect:()=>E,withAsyncContext:()=>Ae,withCtx:()=>Oe,withDefaults:()=>Me,withDirectives:Line truncated
import{$ as e,$t as t,A as n,An as r,At as i,B as a,Bt as o,C as s,Cn as c,Ct as l,D as u,Dn as d,Dt as f,E as p,En as m,Et as h,F as g,Fn as _,Ft as v,G as y,Gt as b,H as x,Ht as S,I as C,It as w,J as T,Jt as E,K as ee,Kt as D,L as O,Lt as te,M as k,Mt as ne,N as re,Nt as ie,O as ae,On as oe,Ot as se,P as ce,Pn as le,Pt as ue,Q as de,Qt as fe,R as pe,Rt as me,S as he,Sn as ge,St as _e,T as ve,Tn as ye,Tt as be,U as xe,Ut as Se,V as Ce,Vt as we,W as Te,Wt as Ee,X as De,Xt as Oe,Y as ke,Yt as Ae,Z as je,Zt as Me,_ as Ne,_n as Pe,_t as A,a as Fe,an as Ie,ar as Le,at as Re,b as ze,bn as Be,bt as Ve,c as He,cn as Ue,ct as We,d as Ge,dn as Ke,dt as qe,en as Je,er as Ye,et as Xe,f as Ze,fn as Qe,ft as $e,g as et,gn as tt,gt as nt,h as rt,hn as it,ht as at,i as ot,in as st,ir as ct,it as j,j as lt,jn as M,jt as ut,k as dt,kn as N,kt as ft,l as pt,ln as mt,lt as ht,m as gt,mn as _t,mt as vt,n as yt,nn as bt,nr as xt,nt as St,o as Ct,on as wt,ot as Tt,p as Et,pn as Dt,pt as Ot,q as kt,qt as At,r as jt,rn as Mt,rr as Nt,rt as Pt,s as Ft,sn as It,st as Lt,tn as Rt,tt as zt,u as Bt,un as Vt,ut as Ht,v as Ut,vn as Wt,vt as Gt,w as Kt,wn as qt,wt as P,x as F,xn as I,xt as Jt,y as L,yn as Yt,yt as Xt,z as Zt,zt as Qt}from"./PageHeader.js";import{$ as $t,B as en,C as tn,F as nn,G as rn,H as an,I as on,J as sn,K as cn,L as ln,N as un,Q as dn,R as fn,U as pn,V as mn,W as hn,X as gn,Y as _n,Z as vn,at as yn,et as bn,it as xn,nt as Sn,q as Cn,rt as wn,tt as Tn,z as En}from"./createLucideIcon.js";var Dn=Object.defineProperty,On=(e,t)=>{let n={};for(var r in e)Dn(n,r,{get:e[r],enumerable:!0});return t||Dn(n,Symbol.toStringTag,{value:`Module`}),n},kn=On({BaseTransition:()=>ot,BaseTransitionPropsValidators:()=>Fe,Comment:()=>Ct,DeprecationTypes:()=>null,EffectScope:()=>Rt,ErrorCodes:()=>Ft,ErrorTypeStrings:()=>He,Fragment:()=>pt,KeepAlive:()=>Bt,ReactiveEffect:()=>bt,Static:()=>Ge,Suspense:()=>Ze,Teleport:()=>Et,Text:()=>gt,TrackOpTypes:()=>Mt,Transition:()=>on,TransitionGroup:()=>ln,TriggerOpTypes:()=>st,VueElement:()=>fn,assertNumber:()=>rt,callWithAsyncErrorHandling:()=>et,callWithErrorHandling:()=>Ne,camelize:()=>le,capitalize:()=>_,cloneVNode:()=>Ut,compatUtils:()=>null,compile:()=>An,computed:()=>L,createApp:()=>En,createBlock:()=>F,createCommentVNode:()=>he,createElementBlock:()=>s,createElementVNode:()=>ze,createHydrationRenderer:()=>Kt,createPropsRestProxy:()=>ve,createRenderer:()=>p,createSSRApp:()=>en,createSlots:()=>u,createStaticVNode:()=>ae,createTextVNode:()=>dt,createVNode:()=>n,customRef:()=>Ie,defineAsyncComponent:()=>lt,defineComponent:()=>k,defineCustomElement:()=>mn,defineEmits:()=>re,defineExpose:()=>ce,defineModel:()=>g,defineOptions:()=>C,defineProps:()=>O,defineSSRCustomElement:()=>an,defineSlots:()=>pe,devtools:()=>Zt,effect:()=>wt,effectScope:()=>It,getCurrentInstance:()=>a,getCurrentScope:()=>Ue,getCurrentWatcher:()=>mt,getTransitionRawChildren:()=>Ce,guardReactiveProps:()=>x,h:()=>xe,handleError:()=>Te,hasInjectionContext:()=>y,hydrate:()=>pn,hydrateOnIdle:()=>ee,hydrateOnInteraction:()=>kt,hydrateOnMediaQuery:()=>T,hydrateOnVisible:()=>ke,initCustomFormatter:()=>De,initDirectivesForSSR:()=>hn,inject:()=>je,isMemoSame:()=>de,isProxy:()=>Vt,isReactive:()=>Ke,isReadonly:()=>Qe,isRef:()=>Dt,isRuntimeOnly:()=>e,isShallow:()=>_t,isVNode:()=>Xe,markRaw:()=>it,mergeDefaults:()=>zt,mergeModels:()=>St,mergeProps:()=>Pt,nextTick:()=>j,nodeOps:()=>rn,normalizeClass:()=>Ye,normalizeProps:()=>xt,normalizeStyle:()=>Nt,onActivated:()=>Re,onBeforeMount:()=>Tt,onBeforeUnmount:()=>Lt,onBeforeUpdate:()=>We,onDeactivated:()=>ht,onErrorCaptured:()=>Ht,onMounted:()=>qe,onRenderTracked:()=>$e,onRenderTriggered:()=>Ot,onScopeDispose:()=>tt,onServerPrefetch:()=>vt,onUnmounted:()=>at,onUpdated:()=>nt,onWatcherCleanup:()=>Pe,openBlock:()=>A,patchProp:()=>cn,popScopeId:()=>Gt,provide:()=>Xt,proxyRefs:()=>Wt,pushScopeId:()=>Ve,queuePostFlushCb:()=>Jt,reactive:()=>Yt,readonly:()=>Be,ref:()=>I,registerRuntimeCompiler:()=>_e,render:()=>Cn,renderList:()=>l,renderSlot:()=>P,resolveComponent:()=>be,resolveDirective:()=>h,resolveDynamicComponent:()=>f,resolveFilter:()=>null,resolveTransitionHooks:()=>se,setBlockTracking:()=>ft,setDevtoolsHook:()=>i,setTransitionHooks:()=>ut,shallowReactive:()=>ge,shallowReadonly:()=>c,shallowRef:()=>qt,ssrContextKey:()=>ne,ssrUtils:()=>ie,stop:()=>ye,toDisplayString:()=>ct,toHandlerKey:()=>Le,toHandlers:()=>ue,toRaw:()=>m,toRef:()=>d,toRefs:()=>oe,toValue:()=>N,transformVNodeArgs:()=>v,triggerRef:()=>r,unref:()=>M,useAttrs:()=>w,useCssModule:()=>sn,useCssVars:()=>_n,useHost:()=>gn,useId:()=>te,useModel:()=>me,useSSRContext:()=>Qt,useShadowRoot:()=>vn,useSlots:()=>o,useTemplateRef:()=>we,useTransitionState:()=>S,vModelCheckbox:()=>dn,vModelDynamic:()=>$t,vModelRadio:()=>bn,vModelSelect:()=>Tn,vModelText:()=>Sn,vShow:()=>wn,version:()=>Se,warn:()=>Ee,watch:()=>b,watchEffect:()=>D,watchPostEffect:()=>At,watchSyncEffect:()=>E,withAsyncContext:()=>Ae,withCtx:()=>Oe,withDefaults:()=>Me,withDirectives:()=>fe,wLine truncated
`)].join(`
`))}return()=>i.value||r.value||s.value?xe(t.default({present:s.value})[0],{ref:e=>{let t=H(e);return t?.hasAttribute===void 0||(t?.hasAttribute(`data-reka-popper-content-wrapper`)?o.value=t.firstElementChild:o.value=t),t}}):null}}),oi=`dismissableLayer.pointerDownOutside`,si=`dismissableLayer.focusOutside`;function ci(e){if(typeof e!=`object`||!e)return!1;let t=e.ownerDocument?.defaultView;return typeof Element<`u`&&e instanceof Element||!!t&&e instanceof t.Element}function li(e,t){if(!ci(t))return!1;if(e.contains(t))return!0;let n=t.closest(`[data-dismissable-layer]`),r=e.dataset.dismissableLayer===``?e:e.querySelector(`[data-dismissable-layer]`),i=Array.from(e.ownerDocument.querySelectorAll(`[data-dismissable-layer]`));return!!(n&&(r===n||i.indexOf(r)<i.indexOf(n)))}function ui(e,t,n=!0){let r=I(!1),i=I(()=>{});return D(a=>{if(!B||!N(n))return;let o=t?.value?.ownerDocument??globalThis.document,s=async n=>{let a=n.target;if(t?.value&&a){if(li(t.value,a))o.removeEventListener(`click`,i.value),r.value=!1;else{if(n.target&&!r.value){let t={originalEvent:n};function r(){zn(oi,e,t)}n.pointerType===`touch`?(o.removeEventListener(`click`,i.value),i.value=r,o.addEventListener(`click`,i.value,{once:!0})):r()}else o.removeEventListener(`click`,i.value);r.value=!1}}},c=window.setTimeout(()=>{o.addEventListener(`pointerdown`,s)},0);a(()=>{window.clearTimeout(c),o.removeEventListener(`pointerdown`,s),o.removeEventListener(`click`,i.value)})}),{onPointerDownCapture:()=>{N(n)&&(r.value=!0)}}}function di(e,t,n=!0){let r=I(!1);return D(i=>{if(!B||!N(n))return;let a=t?.value?.ownerDocument??globalThis.document,o=async n=>{if(!t?.value)return;await j(),await j();let i=n.target;t.value&&i&&!li(t.value,i)&&n.target&&!r.value&&zn(si,e,{originalEvent:n})};a.addEventListener(`focusin`,o),i(()=>a.removeEventListener(`focusin`,o))}),{onFocusCapture:()=>{N(n)&&(r.value=!0)},onBlurCapture:()=>{N(n)&&(r.value=!1)}}}var U=Yt({layersRoot:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),fi=k({__name:`DismissableLayer`,props:{disableOutsidePointerEvents:{type:Boolean,required:!1,default:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},present:{type:Boolean,required:!1,default:!0}},emits:[`escapeKeyDown`,`pointerDownOutside`,`focusOutside`,`interactOutside`,`dismiss`],setup(e,{emit:t}){let n=e,r=t,{forwardRef:i,currentElement:a}=Br(),o=L(()=>a.value?.ownerDocument??globalThis.document),s=L(()=>U.layersRoot),c=L(()=>a.value?Array.from(s.value).indexOf(a.value):-1),l=L(()=>U.layersWithOutsidePointerEventsDisabled.size>0),u=L(()=>{let e=Array.from(s.value),[t]=[...U.layersWithOutsidePointerEventsDisabled].slice(-1),n=e.indexOf(t);return c.value>=n}),d=ui(async e=>{let t=[...U.branches].some(t=>t?.contains(e.target));n.present&&u.value&&!t&&(r(`pointerDownOutside`,e),r(`interactOutside`,e),await j(),e.defaultPrevented||r(`dismiss`))},a,()=>n.present),f=di(e=>{let t=[...U.branches].some(t=>t?.contains(e.target));n.present&&!t&&(r(`focusOutside`,e),r(`interactOutside`,e),e.defaultPrevented||r(`dismiss`))},a);return fr(`Escape`,e=>{n.present&&c.value===s.value.size-1&&(r(`escapeKeyDown`,e),e.defaultPrevented||r(`dismiss`))},{target:()=>o.value?.defaultView??globalThis.window}),b([a,()=>n.disableOutsidePointerEvents,()=>n.present],([e,t,n],r,i)=>{if(e&&n&&t){let t=e.ownerDocument;wr(t,e),U.layersWithOutsidePointerEventsDisabled.add(e),i(()=>{U.layersWithOutsidePointerEventsDisabled.delete(e),Tr(t,e)})}},{immediate:!0}),b([a,()=>n.present],([e,t],n,r)=>{e&&t&&(s.value.add(e),r(()=>{s.value.delete(e)}))},{immediate:!0}),D(e=>{e(()=>{a.value&&(s.value.delete(a.value),U.layersWithOutsidePointerEventsDisabled.delete(a.value))})}),(t,n)=>(A(),F(M(un),{ref:M(i),"as-child":e.asChild,as:e.as,"data-dismissable-layer":``,style:Nt({pointerEvents:l.value?u.value?`auto`:`none`:void 0}),onFocusCapture:M(f).onFocusCapture,onBlurCapture:M(f).onBlurCapture,onPointerdownCapture:M(d).onPointerDownCapture},{default:Oe(()=>[P(t.$slots,`default`)]),_:3},8,[`as-child`,`as`,`style`,`onFocusCapture`,`onBlurCapture`,`onPointerdownCapture`]))}}),pi=Hn(()=>I([]));function mi(){let e=pi();return{add(t){let n=e.value[0];t!==n&&n?.pause(),e.value=hi(e.value,t),e.value.unshift(t)},remove(t){e.value=hi(e.value,t),e.value[0]?.resume()}}}function hi(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}var gi=`focusScope.autoFocusOnMount`,_i=`focusScope.autoFocusOnUnmount`,vi={bubbles:!1,cancelable:!0};function yi(e,t){let n=t;for(;n;){if(e.contains(n))return!0;n=n.getRootNode().host??null}return!1}function bi(e,{select:t=!1}={}){let n=R();for(let r of e)if(W(r,{select:t}),R()!==n)return!0}function xi(e){let t=Si(e);return[Ci(t,e),Ci(t.reverse(),e)]}function Si(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n Line truncated
`))}return()=>i.value||r.value||s.value?xe(t.default({present:s.value})[0],{ref:e=>{let t=V(e);return t?.hasAttribute===void 0||(t?.hasAttribute(`data-reka-popper-content-wrapper`)?o.value=t.firstElementChild:o.value=t),t}}):null}}),$r=`dismissableLayer.pointerDownOutside`,ei=`dismissableLayer.focusOutside`;function ti(e){if(typeof e!=`object`||!e)return!1;let t=e.ownerDocument?.defaultView;return typeof Element<`u`&&e instanceof Element||!!t&&e instanceof t.Element}function ni(e,t){if(!ti(t))return!1;if(e.contains(t))return!0;let n=t.closest(`[data-dismissable-layer]`),r=e.dataset.dismissableLayer===``?e:e.querySelector(`[data-dismissable-layer]`),i=Array.from(e.ownerDocument.querySelectorAll(`[data-dismissable-layer]`));return!!(n&&(r===n||i.indexOf(r)<i.indexOf(n)))}function ri(e,t,n=!0){let r=I(!1),i=I(()=>{});return D(a=>{if(!B||!N(n))return;let o=t?.value?.ownerDocument??globalThis.document,s=async n=>{let a=n.target;if(t?.value&&a){if(ni(t.value,a))o.removeEventListener(`click`,i.value),r.value=!1;else{if(n.target&&!r.value){let t={originalEvent:n};function r(){Mn($r,e,t)}n.pointerType===`touch`?(o.removeEventListener(`click`,i.value),i.value=r,o.addEventListener(`click`,i.value,{once:!0})):r()}else o.removeEventListener(`click`,i.value);r.value=!1}}},c=window.setTimeout(()=>{o.addEventListener(`pointerdown`,s)},0);a(()=>{window.clearTimeout(c),o.removeEventListener(`pointerdown`,s),o.removeEventListener(`click`,i.value)})}),{onPointerDownCapture:()=>{N(n)&&(r.value=!0)}}}function ii(e,t,n=!0){let r=I(!1);return D(i=>{if(!B||!N(n))return;let a=t?.value?.ownerDocument??globalThis.document,o=async n=>{if(!t?.value)return;await j(),await j();let i=n.target;t.value&&i&&!ni(t.value,i)&&n.target&&!r.value&&Mn(ei,e,{originalEvent:n})};a.addEventListener(`focusin`,o),i(()=>a.removeEventListener(`focusin`,o))}),{onFocusCapture:()=>{N(n)&&(r.value=!0)},onBlurCapture:()=>{N(n)&&(r.value=!1)}}}var H=Yt({layersRoot:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ai=k({__name:`DismissableLayer`,props:{disableOutsidePointerEvents:{type:Boolean,required:!1,default:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},present:{type:Boolean,required:!1,default:!0}},emits:[`escapeKeyDown`,`pointerDownOutside`,`focusOutside`,`interactOutside`,`dismiss`],setup(e,{emit:t}){let n=e,r=t,{forwardRef:i,currentElement:a}=Nr(),o=L(()=>a.value?.ownerDocument??globalThis.document),s=L(()=>H.layersRoot),c=L(()=>a.value?Array.from(s.value).indexOf(a.value):-1),l=L(()=>H.layersWithOutsidePointerEventsDisabled.size>0),u=L(()=>{let e=Array.from(s.value),[t]=[...H.layersWithOutsidePointerEventsDisabled].slice(-1),n=e.indexOf(t);return c.value>=n}),d=ri(async e=>{let t=[...H.branches].some(t=>t?.contains(e.target));n.present&&u.value&&!t&&(r(`pointerDownOutside`,e),r(`interactOutside`,e),await j(),e.defaultPrevented||r(`dismiss`))},a,()=>n.present),f=ii(e=>{let t=[...H.branches].some(t=>t?.contains(e.target));n.present&&!t&&(r(`focusOutside`,e),r(`interactOutside`,e),e.defaultPrevented||r(`dismiss`))},a);return ar(`Escape`,e=>{n.present&&c.value===s.value.size-1&&(r(`escapeKeyDown`,e),e.defaultPrevented||r(`dismiss`))},{target:()=>o.value?.defaultView??globalThis.window}),b([a,()=>n.disableOutsidePointerEvents,()=>n.present],([e,t,n],r,i)=>{if(e&&n&&t){let t=e.ownerDocument;_r(t,e),H.layersWithOutsidePointerEventsDisabled.add(e),i(()=>{H.layersWithOutsidePointerEventsDisabled.delete(e),vr(t,e)})}},{immediate:!0}),b([a,()=>n.present],([e,t],n,r)=>{e&&t&&(s.value.add(e),r(()=>{s.value.delete(e)}))},{immediate:!0}),D(e=>{e(()=>{a.value&&(s.value.delete(a.value),H.layersWithOutsidePointerEventsDisabled.delete(a.value))})}),(t,n)=>(A(),F(M(un),{ref:M(i),"as-child":e.asChild,as:e.as,"data-dismissable-layer":``,style:Nt({pointerEvents:l.value?u.value?`auto`:`none`:void 0}),onFocusCapture:M(f).onFocusCapture,onBlurCapture:M(f).onBlurCapture,onPointerdownCapture:M(d).onPointerDownCapture},{default:Oe(()=>[P(t.$slots,`default`)]),_:3},8,[`as-child`,`as`,`style`,`onFocusCapture`,`onBlurCapture`,`onPointerdownCapture`]))}}),oi=Pn(()=>I([]));function si(){let e=oi();return{add(t){let n=e.value[0];t!==n&&n?.pause(),e.value=ci(e.value,t),e.value.unshift(t)},remove(t){e.value=ci(e.value,t),e.value[0]?.resume()}}}function ci(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}var li=`focusScope.autoFocusOnMount`,ui=`focusScope.autoFocusOnUnmount`,di={bubbles:!1,cancelable:!0};function fi(e,t){let n=t;for(;n;){if(e.contains(n))return!0;n=n.getRootNode().host??null}return!1}function pi(e,{select:t=!1}={}){let n=R();for(let r of e)if(U(r,{select:t}),R()!==n)return!0}function mi(e){let t=hi(e);return[gi(t,e),gi(t.reverse(),e)]}function hi(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n Line truncated
+1
View File
@@ -0,0 +1 @@
import{t as e}from"./createLucideIcon.js";var t=e({name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]});export{t};
+1
View File
@@ -0,0 +1 @@
import{t as e}from"./createLucideIcon.js";var t=e({name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]}),n=e({name:`chevron-up`,size:24,node:[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]});export{t as n,n as t};
+1 -1
View File
@@ -1,3 +1,3 @@
import{$n as e,A as t,B as n,Bn as r,Cn as i,Dn as a,E as o,En as s,Fn as c,G as l,Gn as u,Gt as d,Hn as f,Ht as p,In as m,Jn as h,Kn as g,Ln as ee,M as _,Mn as v,Nn as y,On as b,Ot as x,Pn as S,Qn as C,Rn as w,U as T,Un as E,V as te,Vn as D,Wn as ne,Xn as re,Xt as ie,Yn as O,Z as ae,Zn as k,_t as oe,a as se,an as ce,bn as le,cn as ue,ct as de,d as fe,dt as pe,er as me,g as he,gn as ge,gt as _e,ht as ve,i as ye,it as be,jn as A,jt as xe,kn as Se,l as Ce,n as we,o as Te,or as Ee,pn as De,qn as j,r as Oe,rt as ke,tr as Ae,v as je,w as Me,wn as Ne,wt as Pe,x as Fe,xn as Ie,xt as Le,y as Re,yn as ze,zn as Be}from"./PageHeader.js";var Ve=void 0,He=typeof window<`u`&&window.trustedTypes;if(He)try{Ve=He.createPolicy(`vue`,{createHTML:e=>e})}catch{}var Ue=Ve?e=>Ve.createHTML(e):e=>e,We=`http://www.w3.org/2000/svg`,Ge=`http://www.w3.org/1998/Math/MathML`,M=typeof document<`u`?document:null,Ke=M&&M.createElement(`template`),qe={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`?M.createElementNS(We,e):t===`mathml`?M.createElementNS(Ge,e):n?M.createElement(e,{is:n}):M.createElement(e);return e===`select`&&r&&r.multiple!=null&&i.setAttribute(`multiple`,r.multiple),i},createText:e=>M.createTextNode(e),createComment:e=>M.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>M.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{Ke.innerHTML=Ue(r===`svg`?`<svg>${e}</svg>`:r===`mathml`?`<math>${e}</math>`:e);let i=Ke.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]}},N=`transition`,P=`animation`,F=Symbol(`_vtc`),Je={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},Ye=m({},se,Je),Xe=(e=>(e.displayName=`Transition`,e.props=Ye,e))((e,{slots:t})=>T(ye,Qe(e),t)),I=(e,t=[])=>{D(e)?e.forEach(e=>e(...t)):e&&e(...t)},Ze=e=>e?D(e)?e.some(e=>e.length>1):e.length>1:!1;function Qe(e){let t={};for(let n in e)n in Je||(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,h=$e(i),g=h&&h[0],ee=h&&h[1],{onBeforeEnter:_,onEnter:v,onEnterCancelled:y,onLeave:b,onLeaveCancelled:x,onBeforeAppear:S=_,onAppear:C=v,onAppearCancelled:w=y}=t,T=(e,t,n,r)=>{e._enterCancelled=r,R(e,t?u:s),R(e,t?l:o),n&&n()},E=(e,t)=>{e._isLeaving=!1,R(e,d),R(e,p),R(e,f),t&&t()},te=e=>(t,n)=>{let i=e?C:v,o=()=>T(t,e,n);I(i,[t,o]),tt(()=>{R(t,e?c:a),L(t,e?u:s),Ze(i)||rt(t,r,g,o)})};return m(t,{onBeforeEnter(e){I(_,[e]),L(e,a),L(e,o)},onBeforeAppear(e){I(S,[e]),L(e,c),L(e,l)},onEnter:te(!1),onAppear:te(!0),onLeave(e,t){e._isLeaving=!0;let n=()=>E(e,t);L(e,d),e._enterCancelled?(L(e,f),st(e)):(st(e),L(e,f)),tt(()=>{e._isLeaving&&(R(e,d),L(e,p),Ze(b)||rt(e,r,ee,n))}),I(b,[e,n])},onEnterCancelled(e){T(e,!1,void 0,!0),I(y,[e])},onAppearCancelled(e){T(e,!0,void 0,!0),I(w,[e])},onLeaveCancelled(e){E(e),I(x,[e])}})}function $e(e){if(e==null)return null;if(ne(e))return[et(e.enter),et(e.leave)];{let t=et(e);return[t,t]}}function et(e){return Ee(e)}function L(e,t){t.split(/\s+/).forEach(t=>t&&e.classList.add(t)),(e[F]||(e[F]=new Set)).add(t)}function R(e,t){t.split(/\s+/).forEach(t=>t&&e.classList.remove(t));let n=e[F];n&&(n.delete(t),n.size||(e[F]=void 0))}function tt(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}var nt=0;function rt(e,t,n,r){let i=e._endId=++nt,a=()=>{i===e._endId&&r()};if(n!=null)return setTimeout(a,n);let{type:o,timeout:s,propCount:c}=it(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 it(e,t){let n=window.getComputedStyle(e),r=e=>(n[e]||``).split(`, `),i=r(`${N}Delay`),a=r(`${N}Duration`),o=at(i,a),s=r(`${P}Delay`),c=r(`${P}Duration`),l=at(s,c),u=null,d=0,f=0;t===N?o>0&&(u=N,d=o,f=a.length):t===P?l>0&&(u=P,d=l,f=c.length):(d=Math.max(o,l),u=d>0?o>l?N:P:null,f=u?u===N?a.length:c.length:0);let p=u===N&&/\b(?:transform|all)(?:,|$)/.test(r(`${N}Property`).toString());return{type:u,timeout:d,propCount:f,hasTransform:p}}function at(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((tLine truncated
`))),e[q]=K(i);let a=r||i.props&&i.props.type===`number`;W(e,t?`change`:`input`,t=>{t.target.composing||e[q](rn(e.value,n,a))}),(n||a)&&W(e,`change`,()=>{e.value=rn(e.value,n,a)}),t||(W(e,`compositionstart`,tn),W(e,`compositionend`,nn),W(e,`change`,nn))},mounted(e,{value:t,modifiers:{trim:n,number:r}}){let i=t??``,a=e[J];delete e[J],a!==void 0&&(e.type===`text`||e.type===`textarea`)&&e.value!==a?e[q](rn(e.value,n,r)):e.value=i},beforeUpdate(t,{value:n,oldValue:r,modifiers:{lazy:i,trim:a,number:o}},s){if(t[q]=K(s),t.composing)return;let c=(o||t.type===`number`)&&!/^0\d/.test(t.value)?e(t.value):t.value,l=n??``;if(c===l)return;let u=t.getRootNode();(u instanceof Document||u instanceof ShadowRoot)&&u.activeElement===t&&t.type!==`range`&&(i&&n===r||a&&t.value.trim()===l)||(t.value=l)}},on={deep:!0,created(e,t,n){e[q]=K(n),W(e,`change`,()=>{let t=e._modelValue,n=Y(e),r=e.checked,i=e[q];if(D(t)){let e=C(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(j(t)){let e=new Set(t);r?e.add(n):e.delete(n),i(e)}else i(fn(e,r))})},mounted:sn,beforeUpdate(e,t,n){e[q]=K(n),sn(e,t,n)}};function sn(e,{value:t,oldValue:n},r){e._modelValue=t;let i;if(D(t))i=C(t,r.props.value)>-1;else if(j(t))i=t.has(r.props.value);else{if(t===n)return;i=k(t,fn(e,!0))}e.checked!==i&&(e.checked=i)}var cn={created(e,{value:t},n){e.checked=k(t,n.props.value),e[q]=K(n),W(e,`change`,()=>{e[q](Y(e))})},beforeUpdate(e,{value:t,oldValue:n},r){e[q]=K(r),t!==n&&(e.checked=k(t,r.props.value))}},ln={deep:!0,created(t,{value:n,modifiers:{number:r}},i){t._modelValue=n,W(t,`change`,()=>{let n=Array.prototype.filter.call(t.options,e=>e.selected).map(t=>r?e(Y(t)):Y(t)),i=t.multiple,a=i?j(t._modelValue)?new Set(n):n:n[0],o=t._pendingValue=[i,i?D(a)?n.slice():n:a];try{t[q](a)}finally{be(()=>{t._pendingValue===o&&(t._pendingValue=void 0)})}}),t[q]=K(i)},mounted(e,{value:t}){dn(e,t)},beforeUpdate(e,{value:t},n){e._modelValue=t,e[q]=K(n)},updated(e,{value:t}){let n=e._pendingValue;e._pendingValue=void 0,(!n||n[0]!==e.multiple||!un(t,n[1],n[0]))&&dn(e,t)}};function un(e,t,n){if(!n||D(e))return k(e,t);if(j(e)){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}return!1}function dn(e,t){let n=e.multiple,r=D(t);if(!n||r||j(t)){for(let i=0,a=e.options.length;i<a;i++){let a=e.options[i],o=Y(a);if(n){if(r){let e=typeof o;a.selected=e===`string`||e===`number`?t.some(e=>String(e)===String(o)):C(t,o)>-1}else a.selected=t.has(o)}else if(k(Y(a),t)){e.selectedIndex!==i&&(e.selectedIndex=i);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function Y(e){return`_value`in e?e._value:e.value}function fn(e,t){let n=t?`_trueValue`:`_falseValue`;return n in e?e[n]:t}var pn={created(e,t,n){hn(e,t,n,null,`created`)},mounted(e,t,n){hn(e,t,n,null,`mounted`)},beforeUpdate(e,t,n,r){hn(e,t,n,r,`beforeUpdate`)},updated(e,t,n,r){hn(e,t,n,r,`updated`)}};function mn(e,t){switch(e){case`SELECT`:return ln;case`TEXTAREA`:return an;default:switch(t){case`checkbox`:return on;case`radio`:return cn;default:return an}}}function hn(e,t,n,r,i){let a=mn(e.tagName,n.props&&n.props.type)[i];a&&a(e,t,n,r)}function gn(){an.getSSRProps=({value:e})=>({value:e}),cn.getSSRProps=({value:e},t)=>{if(t.props&&k(t.props.value,e))return{checked:!0}},on.getSSRProps=({value:e},t)=>{if(D(e)){if(t.props&&C(e,t.props.value)>-1)return{checked:!0}}else if(j(e)){if(t.props&&e.has(t.props.value))return{checked:!0}}else if(e)return{checked:!0}},pn.getSSRProps=(e,t)=>{if(typeof t.type!=`string`)return;let n=mn(t.type.toUpperCase(),t.props&&t.props.type);if(n.getSSRProps)return n.getSSRProps(e,t)}}var _n=[`ctrl`,`shift`,`alt`,`meta`],vn={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)=>_n.some(n=>e[`${n}Key`]&&!t.includes(n))},yn=(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=vn[t[e]];if(r&&r(n,t))return}return e(n,...r)}))},bn={esc:`escape`,space:` `,up:`arrow-up`,left:`arrow-left`,right:`arrow-right`,down:`arrow-down`,delete:`backspace`},xn=(e,t)=>{let n=e._withKeys||={},r=t.join(`.`);return n[r]||(n[r]=(n=>{if(!(`key`in n))return;let r=w(n.key);if(t.some(e=>e===r||bn[e]===r))return e(n)}))},Sn=m({patchProp:Ft},qe),Cn,wn=!1;function Tn(){return Cn||=o(Sn)}function En(){return Cn=wn?Cn:Me(Sn),wn=!0,Cn}var Dn=((...e)=>{Tn().render(...e)}),On=((...e)=>{En().hydrate(...e)}),kn=((...e)=>{let t=Tn().createApp(...e),{mount:n}=t;return t.mount=e=>{let r=Mn(e);if(!r)return;let i=t._component;!f(i)&&!i.render&&!i.template&&(i.template=r.innerHTML),r.nodeType===1&&(r.textContent=``);let a=n(r,!1,jn(r));return r instanceof Element&&(r.removeAttribute(`v-cloak`),r.setAttribute(`data-v-app`,``)),a},t}),An=((...e)=>{let t=En().createApp(...e),{mount:n}=t;retur Line truncated
`)[0].slice(0,200)}catch{}return`${e.status} ${e.statusText}`}var Dr;function Or(e){Dr=e}var kr=class extends Error{status;constructor(e,t){super(e),this.name=`ApiError`,this.status=t}};function Ar(e){let t=e instanceof kr?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 jr(e,t){let n=await fetch(e,t);if(Dr?.(n.status===401),!n.ok)throw new kr(await Er(n),n.status);return n}async function Q(e,t={}){let{method:n=`GET`,body:r,timeoutMs:i=Tr,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 jr(e,s);return a?await c.json():void 0}var Mr={recoveryCode:()=>Q(`/api/account/recovery`,{method:`POST`,body:{}}),recoverAccount:(e,t,n)=>Q(`/api/auth/recover`,{method:`POST`,body:{email:e,code:t,password:n},parse:!1}),authStatus:()=>Q(`/api/auth/status`),setupAccount:e=>Q(`/api/auth/setup`,{method:`POST`,body:e}),signIn:(e,t)=>Q(`/api/auth/login`,{method:`POST`,body:{email:e,password:t}}),signOut:()=>Q(`/api/auth/logout`,{method:`POST`,body:{},parse:!1}),createAccount:e=>Q(`/api/accounts`,{method:`POST`,body:e}),changePassword:(e,t)=>Q(`/api/account/password`,{method:`POST`,body:{current_password:e,new_password:t},parse:!1}),authentication:()=>Q(`/api/authentication`),saveAuthentication:e=>Q(`/api/authentication`,{method:`PUT`,body:e,parse:!1}),tokens:()=>Q(`/api/tokens`),createToken:()=>Q(`/api/tokens`,{method:`POST`,body:{}}),revokeToken:e=>Q(`/api/tokens/${encodeURIComponent(e)}`,{method:`DELETE`,body:{},parse:!1}),passkeys:()=>Q(`/api/account/passkeys`),deletePasskey:e=>Q(`/api/account/passkeys/${encodeURIComponent(e)}`,{method:`DELETE`,body:{},parse:!1}),beginPasskey:e=>Q(e?`/api/account/passkeys/begin`:`/api/auth/passkey/begin`,{method:`POST`,body:{}}),finishPasskey:(e,t,n)=>Q(e?`/api/account/passkeys/finish`:`/api/auth/passkey/finish`,{method:`POST`,body:{credential:t,name:n}}),secretEngines:()=>Q(`/api/secret-engines`),checkSecret:e=>Q(`/api/secret-references/check`,{method:`POST`,body:e}),health:()=>Q(`/health/detailed`),services:()=>Q(`/api/services`),policies:()=>Q(`/api/access/policies`),putPolicy:e=>Q(`/api/access/policies`,{method:`PUT`,body:e}),deletePolicy:e=>Q(`/api/access/policies`,{method:`DELETE`,body:e,parse:!1}),orgs:()=>Q(`/api/orgs`),orgCreate:e=>Q(`/api/orgs`,{method:`POST`,body:e}),org:e=>Q(`/api/orgs/${encodeURIComponent(e)}`),orgWorkspaces:e=>Q(`/api/orgs/${encodeURIComponent(e)}/workspaces`),createOrgWorkspace:(e,t)=>Q(`/api/orgs/${encodeURIComponent(e)}/workspaces`,{method:`POST`,body:t}),orgAgents:e=>Q(`/api/orgs/${encodeURIComponent(e)}/agents`),orgMembers:e=>Q(`/api/orgs/${encodeURIComponent(e)}/members`),addOrgMember:(e,t)=>Q(`/api/orgs/${encodeURIComponent(e)}/members`,{method:`POST`,body:t}),setOrgMember:(e,t,n)=>Q(`/api/orgs/${encodeURIComponent(e)}/members/${encodeURIComponent(t)}`,{method:`PUT`,body:n}),removeOrgMember:(e,t,n)=>Q(`/api/orgs/${encodeURIComponent(e)}/members/${encodeURIComponent(t)}`+Z({workspace:n}),{method:`DELETE`,parse:!1}),assignOrgAgent:(e,t)=>Q(`/api/orgs/${encodeURIComponent(e)}/agents/${encodeURIComponent(t)}`,{method:`PUT`}),alerts:()=>Q(`/api/alerts`),dismissAlert:e=>Q(`/api/alerts/${e}/dismiss`,{method:`POST`,parse:!1}),identities:()=>Q(`/api/identities`),identityCreate:e=>Q(`/api/identities`,{method:`POST`,body:e}),identityCommand:(e,t,n)=>Q(`/api/identities/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,{method:`POST`,body:n}),summary:()=>Q(`/api/summary`),tasks:()=>Q(`/api/tasks`),taskPage:async e=>{let t=await jr(`/api/tasks`+Z(e),{headers:{Accept:`application/json`},signal:AbortSignal.timeout(Tr)});return{tasks:await t.json(),next:t.headers.get(`X-Next-Cursor`)}},taskMeta:()=>Q(`/api/task-meta`),task:e=>Q(`/api/tasks/${encodeURIComponent(e)}`),taskAttempts:e=>Q(`/api/tasks/${encodeURIComponent(e)}/attempts`),taskChanges:(e,t)=>Q(`/api/tasks/${encodeURIComponent(e)}/changes`+Z(t)),taskDebug:(e,t)=>Q(`/api/tasks/${encodeURIComponent(e)}/debug`+Z(t)),taskAction:(e,t,n)=>Q(`/api/tasks/${encodeURIComponent(e)}/action`,{method:`POST`,body:{action:t,...n}}),setup:()=>Q(`/api/setup`),capabilities:()=>Q(`/api/capabilities`),workflows:()=>Q(`/api/workflows`),workflowEnabled:(e,t)=>Q(`/api/workflows/${encodeURIComponent(e)}/enabled`,{method:`PUT`,body:{enabled:t},parse:!1}),checkRepository:e=>Q(`/api/control-plane/resources/repository-policies/check`,{method:`POST`,body:e,timeoutMs:35e3}),repositories:()=>Q(`/api/repositories`),workRequest:e=>Q(`/api/work-requests`,{method:`POST`,body:e}),skills:()=>Q(`/api/skills`),channels:()=>Q(`/api/channels`),curators:()=>Q(`/api/curators`),channelReload:e=>Q(`/api/channels/${encodeURIComponent(e)}/reload`,{method:`POST`,body:{}}),config:()=>Q(`/api/config`),audit:(e={})=>Q(`/api/audit`Line truncated
`)[0].slice(0,200)}catch{}return`${e.status} ${e.statusText}`}var Dr;function Or(e){Dr=e}var kr=class extends Error{status;constructor(e,t){super(e),this.name=`ApiError`,this.status=t}};function Ar(e){let t=e instanceof kr?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 jr(e,t){let n=await fetch(e,t);if(Dr?.(n.status===401),!n.ok)throw new kr(await Er(n),n.status);return n}async function Q(e,t={}){let{method:n=`GET`,body:r,timeoutMs:i=Tr,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 jr(e,s);return a?await c.json():void 0}var Mr={recoveryCode:()=>Q(`/api/account/recovery`,{method:`POST`,body:{}}),recoverAccount:(e,t,n)=>Q(`/api/auth/recover`,{method:`POST`,body:{email:e,code:t,password:n},parse:!1}),authStatus:()=>Q(`/api/auth/status`),setupAccount:e=>Q(`/api/auth/setup`,{method:`POST`,body:e}),signIn:(e,t)=>Q(`/api/auth/login`,{method:`POST`,body:{email:e,password:t}}),signOut:()=>Q(`/api/auth/logout`,{method:`POST`,body:{},parse:!1}),createAccount:e=>Q(`/api/accounts`,{method:`POST`,body:e}),changePassword:(e,t)=>Q(`/api/account/password`,{method:`POST`,body:{current_password:e,new_password:t},parse:!1}),authentication:()=>Q(`/api/authentication`),saveAuthentication:e=>Q(`/api/authentication`,{method:`PUT`,body:e,parse:!1}),tokens:()=>Q(`/api/tokens`),createToken:()=>Q(`/api/tokens`,{method:`POST`,body:{}}),revokeToken:e=>Q(`/api/tokens/${encodeURIComponent(e)}`,{method:`DELETE`,body:{},parse:!1}),passkeys:()=>Q(`/api/account/passkeys`),deletePasskey:e=>Q(`/api/account/passkeys/${encodeURIComponent(e)}`,{method:`DELETE`,body:{},parse:!1}),beginPasskey:e=>Q(e?`/api/account/passkeys/begin`:`/api/auth/passkey/begin`,{method:`POST`,body:{}}),finishPasskey:(e,t,n)=>Q(e?`/api/account/passkeys/finish`:`/api/auth/passkey/finish`,{method:`POST`,body:{credential:t,name:n}}),secretEngines:()=>Q(`/api/secret-engines`),checkSecret:e=>Q(`/api/secret-references/check`,{method:`POST`,body:e}),health:()=>Q(`/health/detailed`),services:()=>Q(`/api/services`),policies:()=>Q(`/api/access/policies`),putPolicy:e=>Q(`/api/access/policies`,{method:`PUT`,body:e}),deletePolicy:e=>Q(`/api/access/policies`,{method:`DELETE`,body:e,parse:!1}),schedules:()=>Q(`/api/schedules`),scheduleSave:(e,t)=>Q(`/api/schedules/${encodeURIComponent(e)}`,{method:`PUT`,body:t}),scheduleDelete:e=>Q(`/api/schedules/${encodeURIComponent(e)}`,{method:`DELETE`,parse:!1}),scheduleRunNow:e=>Q(`/api/schedules/${encodeURIComponent(e)}/runs`,{method:`POST`,body:{}}),scheduleRuns:e=>Q(`/api/schedules/${encodeURIComponent(e)}/runs`),orgs:()=>Q(`/api/orgs`),orgCreate:e=>Q(`/api/orgs`,{method:`POST`,body:e}),org:e=>Q(`/api/orgs/${encodeURIComponent(e)}`),orgWorkspaces:e=>Q(`/api/orgs/${encodeURIComponent(e)}/workspaces`),createOrgWorkspace:(e,t)=>Q(`/api/orgs/${encodeURIComponent(e)}/workspaces`,{method:`POST`,body:t}),orgAgents:e=>Q(`/api/orgs/${encodeURIComponent(e)}/agents`),orgMembers:e=>Q(`/api/orgs/${encodeURIComponent(e)}/members`),addOrgMember:(e,t)=>Q(`/api/orgs/${encodeURIComponent(e)}/members`,{method:`POST`,body:t}),setOrgMember:(e,t,n)=>Q(`/api/orgs/${encodeURIComponent(e)}/members/${encodeURIComponent(t)}`,{method:`PUT`,body:n}),removeOrgMember:(e,t,n)=>Q(`/api/orgs/${encodeURIComponent(e)}/members/${encodeURIComponent(t)}`+Z({workspace:n}),{method:`DELETE`,parse:!1}),assignOrgAgent:(e,t)=>Q(`/api/orgs/${encodeURIComponent(e)}/agents/${encodeURIComponent(t)}`,{method:`PUT`}),alerts:()=>Q(`/api/alerts`),dismissAlert:e=>Q(`/api/alerts/${e}/dismiss`,{method:`POST`,parse:!1}),identities:()=>Q(`/api/identities`),identityCreate:e=>Q(`/api/identities`,{method:`POST`,body:e}),identityCommand:(e,t,n)=>Q(`/api/identities/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,{method:`POST`,body:n}),summary:()=>Q(`/api/summary`),tasks:()=>Q(`/api/tasks`),taskPage:async e=>{let t=await jr(`/api/tasks`+Z(e),{headers:{Accept:`application/json`},signal:AbortSignal.timeout(Tr)});return{tasks:await t.json(),next:t.headers.get(`X-Next-Cursor`)}},taskMeta:()=>Q(`/api/task-meta`),task:e=>Q(`/api/tasks/${encodeURIComponent(e)}`),taskAttempts:e=>Q(`/api/tasks/${encodeURIComponent(e)}/attempts`),taskChanges:(e,t)=>Q(`/api/tasks/${encodeURIComponent(e)}/changes`+Z(t)),taskDebug:(e,t)=>Q(`/api/tasks/${encodeURIComponent(e)}/debug`+Z(t)),taskAction:(e,t,n)=>Q(`/api/tasks/${encodeURIComponent(e)}/action`,{method:`POST`,body:{action:t,...n}}),setup:()=>Q(`/api/setup`),capabilities:()=>Q(`/api/capabilities`),workflows:()=>Q(`/api/workflows`),workflowEnabled:(e,t)=>Q(`/api/workflows/${encodeURIComponent(e)}/enabled`,{method:`PUT`,body:{enabled:t},parse:!1}),checkRepository:e=>Q(`/api/control-plane/resources/repository-policies/check`,{method:`POSLine truncated
+1
View File
@@ -0,0 +1 @@
var e=[`INPUT`,`TEXTAREA`];function t(t,r,i,a={}){if(!r||a.enableIgnoredElement&&e.includes(r.nodeName))return null;let{arrowKeyOptions:o=`both`,attributeName:s=`[data-reka-collection-item]`,itemsArray:c=[],loop:l=!0,dir:u=`ltr`,preventScroll:d=!0,focus:f=!1}=a,[p,m,h,g,_,v]=[t.key===`ArrowRight`,t.key===`ArrowLeft`,t.key===`ArrowUp`,t.key===`ArrowDown`,t.key===`Home`,t.key===`End`],y=h||g,b=p||m;if(!_&&!v&&(!y&&!b||o===`vertical`&&b||o===`horizontal`&&y))return null;let x=i?Array.from(i.querySelectorAll(s)):c;if(!x.length)return null;d&&t.preventDefault();let S=null;return b||y?S=n(x,r,{goForward:y?g:u===`ltr`?p:m,loop:l}):_?S=x.at(0)||null:v&&(S=x.at(-1)||null),f&&S?.focus(),S}function n(e,t,r,i=e.includes(t)?e.length:e.length+1){if(--i===0)return null;let a=e.indexOf(t),o;if(o=a===-1?r.goForward?0:e.length-1:r.goForward?a+1:a-1,!r.loop&&(o<0||o>=e.length))return null;let s=e[(o+e.length)%e.length];return s?s.hasAttribute(`disabled`)&&s.getAttribute(`disabled`)!==`false`?n(e,s,r,i):s:null}var r={ns:1e-6,us:.001,µs:.001,ms:1,s:1e3,m:6e4,h:36e5},i=[`ms`,`s`,`m`,`h`];function a(e){let t=e.trim();if(t===`0`)return 0;let n=t.startsWith(`-`)?-1:1,i=t.replace(/^[-+]/,``);if(i===``)return null;let a=/(\d+(?:\.\d*)?|\.\d+)(ns|us|µs|ms|s|m|h)/gy,o=0,s=0,c;for(;(c=a.exec(i))!==null;)o+=Number(c[1])*r[c[2]],s=a.lastIndex;return s===i.length?n*o:null}function o(e){return Number(e.toFixed(9)).toString()}function s(e){if(e===0)return`0s`;let t=e<0?`-`:``,n=Math.abs(e);if(n<1e3)return`${t}${o(n)}ms`;let r=Math.floor(n/36e5);n-=r*36e5;let i=Math.floor(n/6e4);n-=i*6e4;let a=`${o(n/1e3)}s`;return r>0?`${t}${r}h${i}m${a}`:i>0?`${t}${i}m${a}`:`${t}${a}`}function c(e){for(let t of[`h`,`m`,`s`]){let n=r[t];if(e!==0&&e%n===0)return{value:e/n,unit:t}}return e===0?{value:0,unit:`s`}:{value:e,unit:`ms`}}function l(e,t){return e*r[t]}export{c as a,a as i,s as n,t as o,l as r,i as t};
+1 -1
View File
@@ -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
+103 -103
View File
@@ -1,12 +1,12 @@
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/css2.js","assets/css.js","assets/html.js","assets/javascript.js","assets/javascript2.js","assets/AccountPage.js","assets/PageHeader.js","assets/createLucideIcon.js","assets/input.js","assets/AuthenticationPage.js","assets/CredentialBindingsPage.js","assets/PlaybooksPage.js","assets/AgentProfilesPage.js","assets/HarnessPage.js","assets/badge.js","assets/NotFoundPage.js"])))=>i.map(i=>d[i]);
import{A as e,B as t,C as n,D as r,E as i,F as a,H as o,I as s,L as c,M as l,N as u,O as d,P as f,R as p,S as m,T as h,V as g,_,a as v,b as y,c as b,d as x,f as S,g as C,h as w,i as T,j as ee,k as te,l as E,m as ne,n as D,o as re,p as ie,r as O,s as ae,t as k,u as oe,v as se,w as ce,x as le,y as ue,z as de}from"./badge.js";import{$t as fe,A,B as pe,Bt as me,C as j,Ct as M,D as he,Dn as ge,Dt as _e,En as ve,G as ye,Gt as N,H as be,It as xe,Jt as Se,Kt as Ce,Lt as we,M as P,On as Te,Pt as Ee,Q as De,Qt as Oe,Rt as ke,S as F,Sn as Ae,T as je,Tt as Me,U as Ne,Vt as Pe,Xt as I,Z as Fe,_t as L,an as Ie,b as R,bn as Le,cn as Re,dn as ze,dt as Be,er as z,gn as Ve,hn as He,ht as Ue,ir as B,it as We,jn as V,k as H,kn as Ge,l as U,m as Ke,n as qe,nr as Je,nt as Ye,o as Xe,ot as Ze,p as Qe,pn as $e,r as W,rr as et,rt as G,sn as tt,st as nt,t as rt,tt as it,wn as at,wt as K,x as q,xn as J,y as Y,yn as ot,yt as st}from"./PageHeader.js";import{C as ct,D as lt,I as ut,M as X,N as dt,P as ft,a as eee,at as pt,c as mt,i as ht,it as gt,j as _t,n as vt,nt as tee,o as nee,r as Z,rt as yt,s as bt,t as xt,tt as ree,z as iee}from"./createLucideIcon.js";import{a as St,c as aee,d as oee,f as see,i as cee,l as lee,n as Ct,o as wt,p as Tt,r as Et,s as Dt,t as Q,u as Ot}from"./input.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var uee=typeof window<`u`,kt,At=e=>kt=e,jt=Symbol();function Mt(e){return e&&typeof e==`object`&&Object.prototype.toString.call(e)===`[object Object]`&&typeof e.toJSON!=`function`}var Nt=typeof window==`object`&&window.window===window?window:typeof self==`object`&&self.self===self?self:typeof global==`object`&&global.global===global?global:typeof globalThis==`object`?globalThis:{HTMLElement:null};function dee(e,{autoBom:t=!1}={}){return t&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([``,e],{type:e.type}):e}function Pt(e,t,n){let r=new XMLHttpRequest;r.open(`GET`,e),r.responseType=`blob`,r.onload=function(){zt(r.response,t,n)},r.onerror=function(){console.error(`could not download file`)},r.send()}function Ft(e){let t=new XMLHttpRequest;t.open(`HEAD`,e,!1);try{t.send()}catch{}return t.status>=200&&t.status<=299}function It(e){try{e.dispatchEvent(new MouseEvent(`click`))}catch{let t=new MouseEvent(`click`,{bubbles:!0,cancelable:!0,view:window,detail:0,screenX:80,screenY:20,clientX:80,clientY:20,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,button:0,relatedTarget:null});e.dispatchEvent(t)}}var Lt=typeof navigator==`object`?navigator:{userAgent:``},Rt=/Macintosh/.test(Lt.userAgent)&&/AppleWebKit/.test(Lt.userAgent)&&!/Safari/.test(Lt.userAgent),zt=uee?typeof HTMLAnchorElement<`u`&&`download`in HTMLAnchorElement.prototype&&!Rt?Bt:`msSaveOrOpenBlob`in Lt?Vt:Ht:()=>{};function Bt(e,t=`download`,n){let r=document.createElement(`a`);r.download=t,r.rel=`noopener`,typeof e==`string`?(r.href=e,r.origin===location.origin?It(r):Ft(r.href)?Pt(e,t,n):(r.target=`_blank`,It(r))):(r.href=URL.createObjectURL(e),setTimeout(function(){URL.revokeObjectURL(r.href)},4e4),setTimeout(function(){It(r)},0))}function Vt(e,t=`download`,n){if(typeof e==`string`){if(Ft(e))Pt(e,t,n);else{let t=document.createElement(`a`);t.href=e,t.target=`_blank`,setTimeout(function(){It(t)})}}else navigator.msSaveOrOpenBlob(dee(e,n),t)}function Ht(e,t,n,r){if(r||=open(``,`_blank`),r&&(r.document.title=r.document.body.innerText=`downloading...`),typeof e==`string`)return Pt(e,t,n);let i=e.type===`application/octet-stream`,a=/constructor/i.test(String(Nt.HTMLElement))||`safari`in Nt,o=/CriOS\/[\d]+/.test(navigator.userAgent);if((o||i&&a||Rt)&&typeof FileReader<`u`){let t=new FileReader;t.onloadend=function(){let e=t.result;if(typeof e!=`string`)throw r=null,Error(`Wrong reader.result type`);e=o?e:e.replace(/^data:[^;]*;/,`data:attachment/file;`),r?r.location.href=e:location.assign(e),r=null},t.readAsDataURL(e)}else{let t=URL.createObjectURL(e);r?r.location.assign(t):location.href=t,r=null,setTimeout(function(){URL.revokeObjectURL(t)},4e4)}}var{assign:fee}=Object;function Ut(){let e=tt(!0),t=e.run(()=>J({})),n=[],r=[],i=He({install(e){At(i),i._a=e,e.provide(jt,i),e.config.globalProperties.$pinia=i,r.forEach(e=>n.push(e)),r=[]},use(e){return this._a?n.push(e):r.push(e),this},_p:n,_a:null,_e:e,_s:new Map,state:t});return i}var Wt=()=>{};function Gt(e,t,n,r=Wt){e.add(t);let i=()=>{e.delete(t)&&Line truncated
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/css2.js","assets/css.js","assets/html.js","assets/javascript.js","assets/javascript2.js","assets/AccountPage.js","assets/PageHeader.js","assets/createLucideIcon.js","assets/input.js","assets/alert.js","assets/AuthenticationPage.js","assets/check.js","assets/CredentialBindingsPage.js","assets/HistoryLink.js","assets/badge.js","assets/pinia.js","assets/nullish.js","assets/duration.js","assets/SchedulesPage.js","assets/schedule.js","assets/Collection.js","assets/textarea.js","assets/table.js","assets/ScheduleRunsPage.js","assets/PlaybooksPage.js","assets/AgentProfilesPage.js","assets/HarnessPage.js","assets/select.js","assets/VisuallyHidden.js","assets/chevron-up.js","assets/NotFoundPage.js"])))=>i.map(i=>d[i]);
import{A as e,C as t,D as n,E as r,F as i,I as a,L as o,M as s,N as c,P as l,R as u,S as d,_ as f,a as p,b as m,c as h,d as g,f as _,h as v,i as y,k as b,l as x,m as S,o as ee,p as C,r as te,s as ne,t as w,u as T,v as re,w as E,x as ie,y as ae}from"./badge.js";import{$t as D,A as O,B as oe,Bt as se,C as k,Ct as A,D as ce,Dn as le,Dt as j,En as ue,Gt as M,H as de,It as fe,Jt as pe,Kt as me,Lt as he,M as N,On as ge,Pt as _e,Q as ve,Qt as ye,Rt as be,S as P,Sn as xe,T as Se,Tt as Ce,U as we,Vt as Te,Xt as F,Z as Ee,_t as I,an as De,b as L,bn as Oe,cn as ke,dt as Ae,er as R,gn as je,hn as Me,ht as Ne,ir as z,it as Pe,jn as B,k as V,kn as Fe,l as H,m as Ie,n as Le,nr as Re,nt as ze,o as Be,ot as Ve,p as He,pn as Ue,r as U,rr as We,rt as W,sn as Ge,st as Ke,t as qe,wn as Je,wt as G,x as K,xn as q,y as J,yn as Ye,yt as Xe}from"./PageHeader.js";import{C as Ze,D as Qe,I as $e,M as Y,N as et,at as tt,i as nt,it as rt,j as it,n as at,r as X,rt as ot,s as st,t as ct,z as lt}from"./createLucideIcon.js";import{n as ut,r as dt,t as ft}from"./pinia.js";import{A as pt,B as mt,C as ht,D as gt,E as _t,F as vt,G as yt,H as bt,I as xt,K as St,L as Ct,M as wt,N as Tt,O as Et,P as Dt,R as Ot,S as kt,T as At,U as jt,V as Mt,W as Nt,_ as Pt,b as Ft,c as It,d as Lt,f as Rt,g as zt,h as Bt,j as Vt,k as Ht,l as Ut,m as Wt,n as Gt,o as Kt,p as qt,q as Jt,r as Yt,s as Xt,u as Zt,v as Qt,w as $t,x as en,y as tn,z as nn}from"./schedule.js";import{n as rn,t as an}from"./nullish.js";import{i as on,n as sn,r as cn,t as ln}from"./VisuallyHidden.js";import{a as un,c as dn,d as fn,f as pn,g as mn,h as hn,i as gn,l as _n,m as vn,n as yn,o as bn,p as xn,r as Sn,s as Cn,t as wn,u as Tn}from"./HistoryLink.js";import{i as En,n as Dn,o as On}from"./duration.js";import{g as kn,h as An,t as jn,u as Mn}from"./Collection.js";import{a as Nn,c as Pn,i as Fn,n as In,o as Ln,r as Rn,s as zn,t as Bn}from"./select.js";import{a as Vn,d as Hn,f as Un,i as Wn,l as Gn,n as Kn,o as qn,r as Jn,s as Yn,t as Z,u as Xn}from"./input.js";import{t as Zn}from"./check.js";import{n as Qn,t as $n}from"./chevron-up.js";import{t as er}from"./textarea.js";import{a as tr,i as nr,n as rr,o as ir,r as ar,s as or,t as sr}from"./table.js";import{n as cr,r as lr,t as ur}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)}})();var dr=typeof document<`u`,fr=/#/g,pr=/&/g,mr=/\//g,hr=/=/g,gr=/\?/g,_r=/\+/g,vr=/%5B/g,yr=/%5D/g,br=/%5E/g,xr=/%60/g,Sr=/%7B/g,Cr=/%7C/g,wr=/%7D/g,Tr=/%20/g;function Er(e){return e==null?``:encodeURI(``+e).replace(Cr,`|`).replace(vr,`[`).replace(yr,`]`)}function Dr(e){return Er(e).replace(Sr,`{`).replace(wr,`}`).replace(br,`^`)}function Or(e){return Er(e).replace(_r,`%2B`).replace(Tr,`+`).replace(fr,`%23`).replace(pr,`%26`).replace(xr,"`").replace(Sr,`{`).replace(wr,`}`).replace(br,`^`)}function kr(e){return Or(e).replace(hr,`%3D`)}function Ar(e){return Er(e).replace(fr,`%23`).replace(gr,`%3F`)}function jr(e){return Ar(e).replace(mr,`%2F`)}function Mr(e){if(e==null)return null;try{return decodeURIComponent(``+e)}catch{}return``+e}var Nr=/\/$/,Pr=e=>e.replace(Nr,``);function Fr(e,t,n=`/`){let r,i={},a=``,o=``,s=t.indexOf(`#`),c=t.indexOf(`?`);return c=s>=0&&c>s?-1:c,c>=0&&(r=t.slice(0,c),a=t.slice(c,s>0?s:t.length),i=e(a.slice(1))),s>=0&&(r||=t.slice(0,s),o=t.slice(s,t.length)),r=Ur(r??t,n),{fullPath:r+a+o,path:r,query:i,hash:Mr(o)}}function Ir(e,t){let n=t.query?e(t.query):``;return t.path+(n&&`?`)+n+(t.hash||``)}function Lr(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||`/`}function Rr(e,t,n){let r=t.matched.length-1,i=n.matched.length-1;return r>-1&&r===i&&zr(t.matched[r],n.matched[i])&&Br(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function zr(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function Br(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(!Vr(e[n],t[n]))return!1;return!0}function Vr(e,t){return Dt(e)?Hr(e,t):Dt(t)?Hr(t,e):(e&&e.valueOf())===(t&&t.valueOf())}function Hr(e,t){return Dt(t)?e.length===t.length&&e.every((e,n)=>e===t[n]):e.length===1&&e[0]===t}function Ur(e,t){if(Tt(e))return e;if(!e)return t;let n=t.split(`/`),r=e.split(`/`),i=r[r.length-1];(i===`..`||i===`.`)&&r.push(``);let a=n.length-1,o,s;for(o=0;o<r.length;o++)if(s=r[o],s!==`.`){if(s===`..`)a>1&&a--;else break}return n.slice(0,a).join(`/`)+`/`+r.slice(o).join(`/`)}var Wr={path:`/`,nameLine truncated
`);p=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&&(Zu.value=n.session_id),n.type===`delta`&&(o+=n.text,rd.value=rd.value?{...rd.value,text:o}:null),(n.type===`tool`||n.type===`navigate`)&&(a=[...a,n],rd.value=rd.value?{...rd.value,tools:a}:null),n.type===`ask`&&n.ask&&(clearTimeout(l),rd.value=rd.value?{...rd.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`);Qu.value=!i&&n.trim()===`/new`?[]:[...Qu.value,{from:`assistant`,text:o,tool_calls:a}],rd.value=null,ed.value=`Ready`,await pd()}catch(e){let t=e;o&&(Qu.value=[...Qu.value,{from:`assistant`,text:o,tool_calls:a}],a=[]),t.name===`AbortError`&&!c?(rd.value={text:`Turn stopped.`,tools:a,isError:!1,turn:r,isRetry:i},ed.value=`Stopped`):(rd.value={text:`Unable to complete that turn: ${t.message||t}`,tools:a,isError:!0,turn:r?qu(r):void 0,isRetry:i},ed.value=`Error. Retry available.`)}finally{clearTimeout(l),Ju=null,dd=null,td.value=!1,yd.after?.()}}function Od(){ed.value=`Stopping…`,Zu.value&&Z.chatCancel(Zu.value).catch(()=>{}),fd()}function kd(){Be(()=>{pd().catch(e=>{ed.value=e.message||`Chat unavailable`})}),Ue(()=>{fd()})}async function Ad(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 Dd({textOverride:`🎤 Voice message`,voice:{data:btoa(n),mime_type:e.type||`audio/webm`}})}var jd={class:`grid gap-1 p-1`},Md={key:0,class:`text-xs text-fg-subtle`},Nd=`__default__`,Pd=P({__name:`ChatSettings`,setup(e){let t=Y(()=>ad.value||Nd),n=Y(()=>{let e=id.value.models_by_provider||{},t=Object.entries(e).filter(([,e])=>e.length);return t.length?t:[[``,id.value.models||[]]]});return(e,r)=>(L(),j(`div`,jd,[V(ed)===`Ready`?F(``,!0):(L(),j(`span`,Md,B(V(ed)),1)),A(V(zu),{"model-value":t.value,"onUpdate:modelValue":r[0]||=e=>V(vd)(e===Nd?``:String(e??``))},{default:I(()=>[A(V(Uu),{size:`sm`,class:`w-full`,"aria-label":`Model`},{default:I(()=>[A(V(Wu))]),_:1}),A(V(Bu),null,{default:I(()=>[A(V(Hu),{value:Nd},{default:I(()=>[...r[1]||=[H(`Default`,-1)]]),_:1}),(L(!0),j(U,null,M(n.value,([e,t])=>(L(),q(V(Vu),{key:e},{default:I(()=>[e?(L(),q(V(Ate),{key:0},{default:I(()=>[H(B(e),1)]),_:2},1024)):F(``,!0),(L(!0),j(U,null,M(t,e=>(L(),q(V(Hu),{key:e,value:e},{default:I(()=>[H(B(e),1)]),_:2},1032,[`value`]))),128))]),_:2},1024))),128))]),_:1})]),_:1},8,[`model-value`])]))}}),Fd=P({__name:`ChatSessionActions`,setup(e){let t=J(!1);Hte(t);function n(e){t.value=!1,_d(e)}function r(e,n){t.value=!1,Gte(e,n)}return(e,i)=>(L(),q(V(Iu),{open:t.value,"onUpdate:open":i[5]||=e=>t.value=e},{default:I(()=>[A(V(Ru),{"as-child":``},{default:I(()=>[A(V(X),{variant:`ghost`,size:`icon-sm`,class:`flex-none`,"aria-label":`More`,title:`More`},{default:I(()=>[A(V($l))]),_:1})]),_:1}),A(V(Lu),{align:`end`,class:`grid w-64 gap-0.5 p-1`},{default:I(()=>[V(Zu)?(L(),j(U,{key:0},[A(V(X),{variant:`ghost`,size:`sm`,class:`justify-start`,onClick:i[0]||=e=>n(`/retry`)},{default:I(()=>[A(V(_te),{"data-icon":`inline-start`}),i[6]||=H(`Retry`,-1)]),_:1}),A(V(X),{variant:`ghost`,size:`sm`,class:`justify-start`,onClick:i[1]||=e=>n(`/undo`)},{default:I(()=>[A(V(Mu),{"data-icon":`inline-start`}),i[7]||=H(`Undo`,-1)]),_:1}),A(V(X),{variant:`ghost`,size:`sm`,class:`justify-start`,onClick:i[2]||=e=>r(`/title`,`Session title`)},{default:I(()=>[A(V(Su),{"data-icon":`inline-start`}),i[8]||=H(`Rename`,-1)]),_:1}),A(V(X),{variant:`ghost`,size:`sm`,class:`justify-start`,onClick:i[3]||=e=>r(`/branch`,`Branch name (optional)`)},{default:I(()=>[A(V(su),{"data-icon":`inline-start`}),i[9]||=H(`Branch`,-1)]),_:1}),A(V(X),{variant:`ghost`,size:`sm`,class:`justify-start`,onClick:i[4]||=e=>n(`/compress --preview`)},{default:I(()=>[A(V(xte),{"data-icon":`inline-start`}),i[10]||=H(`Preview compression`,-1)]),_:1}),A(V(Ote),{class:`my-1`})],64)):F(``,!0),A(Pd)]),_:1})]),_:1},8,[`open`]))}}),Id=new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`});function Ld(e){return e.title||e.branch_name||(e.created_at?Id.format(new Date(e.created_at)):`New chat`)}var Rd={class:`min-w-0 flex-1`},zd=P({__name:`ChatSessionList`,setup(e){return(e,t)=>(L(),j(`div`,Rd,[A(V(zu),{"model-value":V(Zu),disabled:!V(Xu).length,"onUpdate:modelValue":t[0]||=e=>V(md)(String(e))},{default:I(()=>[A(V(Uu),{size:`sm`,class:`w-full`,"aria-label":`Conversation`},{default:I(()=>[A(V(Wu),{placeholder:`No conversations yet`})]),_:1}),A(V(Bu),null,{default:I(()=>[A(V(Vu),null,{default:I(()=>[(L(!0),j(U,null,M(V(Xu),e=>(L(),q(V(Hu),{key:e.session_id,value:e.session_id},{default:I(()=>[H(B(V(Ld)(e)),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`model-value`,`disabled`])]))}}),Bd={class:`flex items-center gap-1 border-b px-3 py-2`},Vd=P({__name:`ChatBar`,setup(e){return(e,t)=>(L(),j(`div`,Bd,[A(zd),A(V(X),{variant:`ghost`,size:`icon-sm`,class:`flex-none`,title:`New chat`,"a Line truncated
`))],64)):K(n.$slots,`default`,{},void 0,void 0,1)])],10,gm))}}),ym=P({__name:`CodeBlockContent`,props:{wrap:{type:Boolean,default:!1},lineNumbers:{type:Boolean,default:!1},startLine:{default:1},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e,n=me();function r(e){let t=``;for(let n of e)if(n.type!==Xe){if(n.type===Ke)t+=n.children;else if(n.type===U&&Array.isArray(n.children)){let e=r(n.children);if(e===null)return null;t+=e}else return null}return t}function i(){if(!t.lineNumbers)return null;let e=r(n.default?.()??[]);return e===null?null:e.replace(/\n$/,``).split(`
`)}return(n,r)=>(L(),q(V(dt),{as:`pre`,"data-slot":`code-block-content`,"data-wrap":e.wrap||void 0,"data-numbered":e.lineNumbers||void 0,dir:`ltr`,tabindex:`0`,style:et({counterReset:`line ${e.startLine-1}`}),class:z(V(W)(`px-3 py-3 leading-relaxed group-has-data-[slot=code-block-header]/code-block:pt-2 group-has-data-[slot=code-block-footer]/code-block:pb-2 group-data-[size=sm]/code-block:px-2.5 group-data-[size=sm]/code-block:py-2.5 group-data-[size=sm]/code-block:group-has-data-[slot=code-block-header]/code-block:pt-1.5 min-h-0 min-w-0 scroll-fade-x scrollbar-thin overflow-auto text-start font-mono outline-none data-wrap:scroll-fade-y data-wrap:wrap-break-word data-wrap:whitespace-pre-wrap`,t.class))},{default:I(()=>[A(V(dt),{as:`code`,"data-slot":`code-block-code`,class:`grid min-h-lh min-w-max content-start in-data-numbered:grid-cols-[auto_1fr] in-data-wrap:min-w-0`},{default:I(()=>[(L(!0),j(U,null,M([i()],(e,t)=>(L(),j(U,{key:t},[e?(L(!0),j(U,{key:0},M(e,(e,t)=>(L(),q(vm,{key:t},{default:I(()=>[H(B(e),1)]),_:2},1024))),128)):K(n.$slots,`default`,{},void 0,void 0,1)],64))),128))]),_:3})]),_:3},8,[`data-wrap`,`data-numbered`,`style`,`class`]))}}),bm={"aria-live":`polite`,class:`sr-only`},xm=P({inheritAttrs:!1,__name:`CodeBlockCopyButton`,props:{asChild:{type:Boolean},as:{default:`button`},value:{},variant:{default:`ghost`},size:{default:`icon-xs`},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e,{copy:n,copied:r}=wt({copiedDuring:2e3,legacy:!0});return(i,a)=>(L(),j(U,null,[A(V(X),G(i.$attrs,{"data-slot":`code-block-copy-button`,"data-copied":V(r)||void 0,as:e.as,"as-child":e.asChild,variant:e.variant,size:e.size,"aria-label":V(r)?`Copied`:`Copy`,class:V(W)(``,t.class),onClick:a[0]||=e=>V(n)(t.value)}),{default:I(()=>[V(r)?(L(),q(V(zl),{key:0})):(L(),q(V(Xl),{key:1}))]),_:1},16,[`data-copied`,`as`,`as-child`,`variant`,`size`,`aria-label`,`class`]),R(`span`,bm,B(V(r)?`Copied`:``),1)],64))}}),Sm=P({__name:`CodeBlockToken`,props:{token:{}},setup(e){return(t,n)=>(L(),j(`span`,{style:et(e.token.htmlStyle),class:`text-(--shiki-light) dark:text-(--shiki-dark)`},B(e.token.content),5))}}),Cm=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function wm(e){return Tm(e)}function Tm(e){return Array.isArray(e)?Em(e):e instanceof RegExp?e:typeof e==`object`?Dm(e):e}function Em(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=Tm(e[n]);return t}function Dm(e){let t={};for(let n in e)t[n]=Tm(e[n]);return t}function Om(e,...t){return t.forEach(t=>{for(let n in t)e[n]=t[n]}),e}function km(e){let t=~e.lastIndexOf(`/`)||~e.lastIndexOf(`\\`);return t===0?e:~t===e.length-1?km(e.substring(0,e.length-1)):e.substr(~t+1)}var Am=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,jm=class{static hasCaptures(e){return e!==null&&(Am.lastIndex=0,Am.test(e))}static replaceCaptures(e,t,n){return e.replace(Am,(e,r,i,a)=>{let o=n[parseInt(r||i,10)];if(o){let e=t.substring(o.start,o.end);for(;e[0]===`.`;)e=e.substring(1);switch(a){case`downcase`:return e.toLowerCase();case`upcase`:return e.toUpperCase();default:return e}}else return e})}};function Mm(e,t){return e<t?-1:+(e>t)}function Nm(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let r=0;r<n;r++){let n=Mm(e[r],t[r]);if(n!==0)return n}return 0}return n-r}function Pm(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function Fm(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,`\\$&`)}var Im=class{constructor(e){this.fn=e}cache=new Map;get(e){if(this.cache.has(e))return this.cache.get(e);let t=this.fn(e);return this.cache.set(e,t),t}},Lm=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(Hm(e),t)}static createFromParsedTheme(e,t){return Gm(e,t)}_cachedMatchRoot=new Im(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;let t=e.scopeName,n=this._cachedMatchRoot.get(t).find(t=>zm(e.parent,t.parentScopes));return n?new Vm(n.fontStyle,n.foreground,n.background):null}},Rm=class e{constructor(e,t){this.parent=e,this.scopeName=t}static push(t,n){for(let r of n)t=new e(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new e(n,t[r]);return n}push(t){return new e(this,t)}getSegments(){let e=this,t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(` `)}extends(e){return this===e||this.parent!==null&&this.parent.extends(e)}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push(n.scopeName),n=n.parent;return n===e?t.reverse():void 0}};function zm(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let r=t[n],i=!1;if(r===`>`){if(n===t.length-1)return!1;r=t[++n],i=!0}for(;e&&!Bm(e.scopeName,r);){if(i)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function Bm( Line truncated
`)}findNextMatchSync(e,t,n){let r=this.scanner.findNextMatchSync(e,t,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},Nh=class{constructor(e,t){this.languageId=e,this.tokenType=t}},Ph=class e{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,t){this._defaultAttributes=new Nh(e,8),this._embeddedLanguagesMatcher=new Fh(Object.entries(t||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?e._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}static _NULL_SCOPE_METADATA=new Nh(0,0);_getBasicScopeAttributes=new Im(e=>new Nh(this._scopeToLanguage(e),this._toStandardTokenType(e)));_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(t){let n=t.match(e.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case`comment`:return 1;case`string`:return 2;case`regex`:return 3;case`meta.embedded`:return 0}throw Error(`Unexpected match for standard token type!`)}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},Fh=class{values;scopesRegExp;constructor(e){if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);let t=e.map(([e,t])=>Fm(e));t.sort(),t.reverse(),this.scopesRegExp=RegExp(`^((${t.join(`)|(`)}))($|\\.)`,``)}}match(e){if(!this.scopesRegExp)return;let t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}};typeof process<`u`&&{}.VSCODE_TEXTMATE_DEBUG;var Ih=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function Lh(e,t,n,r,i,a,o,s){let c=t.content.length,l=!1,u=-1;if(o){let o=Rh(e,t,n,r,i,a);i=o.stack,r=o.linePos,n=o.isFirstLine,u=o.anchorPosition}let d=Date.now();for(;!l;){if(s!==0&&Date.now()-d>s)return new Ih(i,!0);f()}return new Ih(i,!1);function f(){let o=zh(e,t,n,r,i,u);if(!o){a.produce(i,c),l=!0;return}let s=o.captureIndices,d=o.matchedRuleId,f=s&&s.length>0?s[0].end>r:!1;if(d===yh){let o=i.getRule(e);a.produce(i,s[0].start),i=i.withContentNameScopesList(i.nameScopesList),Wh(e,t,n,i,a,o.endCaptures,s),a.produce(i,s[0].end);let d=i;if(i=i.parent,u=d.getAnchorPos(),!f&&d.getEnterPos()===r){i=d,a.produce(i,c),l=!0;return}}else{let o=e.getRule(d);a.produce(i,s[0].start);let p=i,m=o.getName(t.content,s),h=i.contentNameScopesList.pushAttributed(m,e);if(i=i.push(d,r,u,s[0].end===c,null,h,h),o instanceof Dh){let r=o;Wh(e,t,n,i,a,r.beginCaptures,s),a.produce(i,s[0].end),u=s[0].end;let d=r.getContentName(t.content,s),m=h.pushAttributed(d,e);if(i=i.withContentNameScopesList(m),r.endHasBackReferences&&(i=i.withEndRule(r.getEndWithResolvedBackReferences(t.content,s))),!f&&p.hasSameRuleAs(i)){i=i.pop(),a.produce(i,c),l=!0;return}}else if(o instanceof Oh){let r=o;Wh(e,t,n,i,a,r.beginCaptures,s),a.produce(i,s[0].end),u=s[0].end;let d=r.getContentName(t.content,s),m=h.pushAttributed(d,e);if(i=i.withContentNameScopesList(m),r.whileHasBackReferences&&(i=i.withEndRule(r.getWhileWithResolvedBackReferences(t.content,s))),!f&&p.hasSameRuleAs(i)){i=i.pop(),a.produce(i,c),l=!0;return}}else if(Wh(e,t,n,i,a,o.captures,s),a.produce(i,s[0].end),i=i.pop(),!f){i=i.safePop(),a.produce(i,c),l=!0;return}}s[0].end>r&&(r=s[0].end,n=!1)}}function Rh(e,t,n,r,i,a){let o=i.beginRuleCapturedEOL?0:-1,s=[];for(let t=i;t;t=t.pop()){let n=t.getRule(e);n instanceof Oh&&s.push({rule:n,stack:t})}for(let c=s.pop();c;c=s.pop()){let{ruleScanner:s,findOptions:l}=Uh(c.rule,e,c.stack.endRule,n,r===o),u=s.findNextMatchSync(t,r,l);if(u){if(u.ruleId!==bh){i=c.stack.pop();break}u.captureIndices&&u.captureIndices.length&&(a.produce(c.stack,u.captureIndices[0].start),Wh(e,t,n,c.stack,a,c.rule.whileCaptures,u.captureIndices),a.produce(c.stack,u.captureIndices[0].end),o=u.captureIndices[0].end,u.captureIndices[0].end>r&&(r=u.captureIndices[0].end,n=!1))}else{i=c.stack.pop();break}}return{stack:i,linePos:r,anchorPosition:o,isFirstLine:n}}function zh(e,t,n,r,i,a){let o=Bh(e,t,n,r,i,a),s=e.getInjections();if(s.length===0)return o;let c=Vh(s,e,t,n,r,i,a);if(!c)return o;if(!o)return c;let l=o.captureIndices[0].start,u=c.captureIndices[0].start;return u<l||c.priorityMatch&&u===l?c:o}function Bh(e,t,n,r,i,a){let{ruleScanner:o,findOptions:s}=Hh(i.getRule(e),e,i.endRule,n,r===a),c=o.findNextMatchSync(t,r,s);return c?{captureIndices:c.captureIndices,matchedRuleId:c.ruleId}:null}function Vh(e,t,n,r,i,a,o){let s=Number.MAX_VALUE,c=null,l,u=0,d=a.contentNameScopesList.getScopeNames();for(let a=0,f=e.length;a<f;a++){let f=e[a];if(!f.matcher(d))continue;let{ruleScanner:p,findOptions:m}=Hh(t.getRule(f.ruleId),t,null,r,i===o),h=p.findNextMatchSync(n,i,m);if(!h)continue;let g=h.captureIndices[0].start;if(!(g>=s)&&(s=g,c=h.captureIndices,l=h.ruleId,u=f.priority,s===i))break}return c?{priorityMatch:u===-1,captureIndices:c,matchedRuleId:l}:null}function Hh(e,t,n,r,i){return{ruleScanner:e.compileAG(t,n,r,i),findOptions:0}}function Uh(e,t,n,r,i){return{ruleScanner:e.compileWhileAG(t,n,r,i),findOptions:0}}function Wh(e,t,n,r,i,a,o){if(a.length===0)return;let s=t.content,c=Math.min(a. Line truncated
`;let a=this.createOnigString(e),o=a.content.length,s=new tg(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=Lh(this,a,i,0,t,s,!0,r);return nh(a),{lineLength:o,lineTokens:s,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function Zh(e,t){return e=wm(e),e.repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var Qh=class e{constructor(e,t,n){this.parent=e,this.scopePath=t,this.tokenAttributes=n}static fromExtension(t,n){let r=t,i=t?.scopePath??null;for(let t of n)i=Rm.push(i,t.scopeNames),r=new e(r,i,t.encodedTokenAttributes);return r}static createRoot(t,n){return new e(null,new Rm(null,t),n)}static createRootAndLookUpScopeName(t,n,r){let i=r.getMetadataForScope(t),a=new Rm(null,t),o=r.themeProvider.themeMatch(a),s=e.mergeAttributes(n,i,o);return new e(null,a,s)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(` `)}equals(t){return e.equals(this,t)}static equals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.scopeName!==t.scopeName||e.tokenAttributes!==t.tokenAttributes)return!1;e=e.parent,t=t.parent}while(1)}static mergeAttributes(e,t,n){let r=-1,i=0,a=0;return n!==null&&(r=n.fontStyle,i=n.foregroundId,a=n.backgroundId),Xm.set(e,t.languageId,t.tokenType,null,r,i,a)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(` `)===-1)return e._pushAttributed(this,t,n);let r=t.split(/ /g),i=this;for(let t of r)i=e._pushAttributed(i,t,n);return i}static _pushAttributed(t,n,r){let i=r.getMetadataForScope(n),a=t.scopePath.push(n),o=r.themeProvider.themeMatch(a),s=e.mergeAttributes(t.tokenAttributes,i,o);return new e(t,a,s)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push({encodedTokenAttributes:n.tokenAttributes,scopeNames:n.scopePath.getExtensionIfDefined(n.parent?.scopePath??null)}),n=n.parent;return n===e?t.reverse():void 0}},$h=class e{constructor(e,t,n,r,i,a,o,s){this.parent=e,this.ruleId=t,this.beginRuleCapturedEOL=i,this.endRule=a,this.nameScopesList=o,this.contentNameScopesList=s,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=n,this._anchorPos=r}_stackElementBrand=void 0;static NULL=new e(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return t!==null&&e._equals(this,t)}static _equals(e,t){return e===t?!0:this._structuralEquals(e,t)?Qh.equals(e.contentNameScopesList,t.contentNameScopesList):!1}static _structuralEquals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.depth!==t.depth||e.ruleId!==t.ruleId||e.endRule!==t.endRule)return!1;e=e.parent,t=t.parent}while(1)}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){e._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,i,a,o,s){return new e(this,t,n,r,i,a,o,s)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){let e=[];return this._writeString(e,0),`[`+e.join(`,`)+`]`}_writeString(e,t){return this.parent&&(t=this.parent._writeString(e,t)),e[t++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,t}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(t){return this.endRule===t?this:new e(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let t=this;for(;t&&t._enterPos===e._enterPos;){if(t.ruleId===e.ruleId)return!0;t=t.parent}return!1}toStateStackFrame(){return{ruleId:Sh(this.ruleId),beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(t,n){let r=Qh.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new e(t,xh(n.ruleId),n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,Qh.fromExtension(r,n.contentNameScopesList))}},eg=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(e=>e===`*`?(this.allowAny=!0,[]):$m(e,Jh).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>$m(e,Jh).map(e=>e.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(let t of this.unbalancedBracketScopes)if(t(e))return!1;for(let t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},tg=class{constructor(e,t,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._l Line truncated
`).find(e=>e.startsWith(`data: `));if(!t)continue;let n=JSON.parse(t.slice(6));if(n.session_id&&(Ql.value=n.session_id),n.type===`delta`&&(o+=n.text,iu.value=iu.value?{...iu.value,text:o}:null),(n.type===`tool`||n.type===`navigate`)&&(a=[...a,n],iu.value=iu.value?{...iu.value,tools:a}:null),n.type===`ask`&&n.ask&&(clearTimeout(l),iu.value=iu.value?{...iu.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`);$l.value=!i&&n.trim()===`/new`?[]:[...$l.value,{from:`assistant`,text:o,tool_calls:a}],iu.value=null,tu.value=`Ready`,await gu()}catch(e){let t=e;o&&($l.value=[...$l.value,{from:`assistant`,text:o,tool_calls:a}],a=[]),t.name===`AbortError`&&!c?(iu.value={text:`Turn stopped.`,tools:a,isError:!1,turn:r,isRetry:i},tu.value=`Stopped`):(iu.value={text:`Unable to complete that turn: ${t.message||t}`,tools:a,isError:!0,turn:r?Kl(r):void 0,isRetry:i},tu.value=`Error. Retry available.`)}finally{clearTimeout(l),Yl=null,mu=null,nu.value=!1,wu.after?.()}}function Fu(){tu.value=`Stopping…`,Ql.value&&X.chatCancel(Ql.value).catch(()=>{}),hu()}function Iu(){Ae(()=>{gu().catch(e=>{tu.value=e.message||`Chat unavailable`})}),Ne(()=>{hu()})}async function Lu(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 Pu({textOverride:`🎤 Voice message`,voice:{data:btoa(n),mime_type:e.type||`audio/webm`}})}var Ru={class:`grid gap-1 p-1`},zu={key:0,class:`text-xs text-fg-subtle`},Bu=`__default__`,Vu=N({__name:`ChatSettings`,setup(e){let t=J(()=>ou.value||Bu),n=J(()=>{let e=au.value.models_by_provider||{},t=Object.entries(e).filter(([,e])=>e.length);return t.length?t:[[``,au.value.models||[]]]});return(e,r)=>(I(),k(`div`,Ru,[B(tu)===`Ready`?P(``,!0):(I(),k(`span`,zu,z(B(tu)),1)),O(B(zn),{"model-value":t.value,"onUpdate:modelValue":r[0]||=e=>B(Cu)(e===Bu?``:String(e??``))},{default:F(()=>[O(B(In),{size:`sm`,class:`w-full`,"aria-label":`Model`},{default:F(()=>[O(B(Bn))]),_:1}),O(B(Ln),null,{default:F(()=>[O(B(Fn),{value:Bu},{default:F(()=>[...r[1]||=[V(`Default`,-1)]]),_:1}),(I(!0),k(H,null,A(n.value,([e,t])=>(I(),K(B(Nn),{key:e},{default:F(()=>[e?(I(),K(B(Rn),{key:0},{default:F(()=>[V(z(e),1)]),_:2},1024)):P(``,!0),(I(!0),k(H,null,A(t,e=>(I(),K(B(Fn),{key:e,value:e},{default:F(()=>[V(z(e),1)]),_:2},1032,[`value`]))),128))]),_:2},1024))),128))]),_:1})]),_:1},8,[`model-value`])]))}}),Hu=N({__name:`ChatSessionActions`,setup(e){let t=q(!1);fu(t);function n(e){t.value=!1,xu(e)}function r(e,n){t.value=!1,Su(e,n)}return(e,i)=>(I(),K(B(vn),{open:t.value,"onUpdate:open":i[5]||=e=>t.value=e},{default:F(()=>[O(B(pn),{"as-child":``},{default:F(()=>[O(B(Y),{variant:`ghost`,size:`icon-sm`,class:`flex-none`,"aria-label":`More`,title:`More`},{default:F(()=>[O(B(Ic))]),_:1})]),_:1}),O(B(xn),{align:`end`,class:`grid w-64 gap-0.5 p-1`},{default:F(()=>[B(Ql)?(I(),k(H,{key:0},[O(B(Y),{variant:`ghost`,size:`sm`,class:`justify-start`,onClick:i[0]||=e=>n(`/retry`)},{default:F(()=>[O(B(hl),{"data-icon":`inline-start`}),i[6]||=V(`Retry`,-1)]),_:1}),O(B(Y),{variant:`ghost`,size:`sm`,class:`justify-start`,onClick:i[1]||=e=>n(`/undo`)},{default:F(()=>[O(B(kl),{"data-icon":`inline-start`}),i[7]||=V(`Undo`,-1)]),_:1}),O(B(Y),{variant:`ghost`,size:`sm`,class:`justify-start`,onClick:i[2]||=e=>r(`/title`,`Session title`)},{default:F(()=>[O(B(ll),{"data-icon":`inline-start`}),i[8]||=V(`Rename`,-1)]),_:1}),O(B(Y),{variant:`ghost`,size:`sm`,class:`justify-start`,onClick:i[3]||=e=>r(`/branch`,`Branch name (optional)`)},{default:F(()=>[O(B(Wc),{"data-icon":`inline-start`}),i[9]||=V(`Branch`,-1)]),_:1}),O(B(Y),{variant:`ghost`,size:`sm`,class:`justify-start`,onClick:i[4]||=e=>n(`/compress --preview`)},{default:F(()=>[O(B(xl),{"data-icon":`inline-start`}),i[10]||=V(`Preview compression`,-1)]),_:1}),O(B(Il),{class:`my-1`})],64)):P(``,!0),O(Vu)]),_:1})]),_:1},8,[`open`]))}}),Uu=new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`});function Wu(e){return e.title||e.branch_name||(e.created_at?Uu.format(new Date(e.created_at)):`New chat`)}var Gu={class:`min-w-0 flex-1`},Ku=N({__name:`ChatSessionList`,setup(e){return(e,t)=>(I(),k(`div`,Gu,[O(B(zn),{"model-value":B(Ql),disabled:!B(Zl).length,"onUpdate:modelValue":t[0]||=e=>B(_u)(String(e))},{default:F(()=>[O(B(In),{size:`sm`,class:`w-full`,"aria-label":`Conversation`},{default:F(()=>[O(B(Bn),{placeholder:`No conversations yet`})]),_:1}),O(B(Ln),null,{default:F(()=>[O(B(Nn),null,{default:F(()=>[(I(!0),k(H,null,A(B(Zl),e=>(I(),K(B(Fn),{key:e.session_id,value:e.session_id},{default:F(()=>[V(z(B(Wu)(e)),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`model-value`,`disabled`])]))}}),qu={class:`flex items-center gap-1 border-b px-3 py-2`},Ju=N({__name:`ChatBar`,setup(e){return(e,t)=>(I(),k(`div`,qu,[O(Ku),O(B(Y),{variant:`ghost`,size:`icon-sm`,class:`flex-none`,title:`New chat`,"aria-la Line truncated
`))],64)):G(n.$slots,`default`,{},void 0,void 0,1)])],10,yf))}}),Sf=N({__name:`CodeBlockContent`,props:{wrap:{type:Boolean,default:!1},lineNumbers:{type:Boolean,default:!1},startLine:{default:1},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e,n=se();function r(e){let t=``;for(let n of e)if(n.type!==Be){if(n.type===Ie)t+=n.children;else if(n.type===H&&Array.isArray(n.children)){let e=r(n.children);if(e===null)return null;t+=e}else return null}return t}function i(){if(!t.lineNumbers)return null;let e=r(n.default?.()??[]);return e===null?null:e.replace(/\n$/,``).split(`
`)}return(n,r)=>(I(),K(B(et),{as:`pre`,"data-slot":`code-block-content`,"data-wrap":e.wrap||void 0,"data-numbered":e.lineNumbers||void 0,dir:`ltr`,tabindex:`0`,style:We({counterReset:`line ${e.startLine-1}`}),class:R(B(U)(`px-3 py-3 leading-relaxed group-has-data-[slot=code-block-header]/code-block:pt-2 group-has-data-[slot=code-block-footer]/code-block:pb-2 group-data-[size=sm]/code-block:px-2.5 group-data-[size=sm]/code-block:py-2.5 group-data-[size=sm]/code-block:group-has-data-[slot=code-block-header]/code-block:pt-1.5 min-h-0 min-w-0 scroll-fade-x scrollbar-thin overflow-auto text-start font-mono outline-none data-wrap:scroll-fade-y data-wrap:wrap-break-word data-wrap:whitespace-pre-wrap`,t.class))},{default:F(()=>[O(B(et),{as:`code`,"data-slot":`code-block-code`,class:`grid min-h-lh min-w-max content-start in-data-numbered:grid-cols-[auto_1fr] in-data-wrap:min-w-0`},{default:F(()=>[(I(!0),k(H,null,A([i()],(e,t)=>(I(),k(H,{key:t},[e?(I(!0),k(H,{key:0},A(e,(e,t)=>(I(),K(xf,{key:t},{default:F(()=>[V(z(e),1)]),_:2},1024))),128)):G(n.$slots,`default`,{},void 0,void 0,1)],64))),128))]),_:3})]),_:3},8,[`data-wrap`,`data-numbered`,`style`,`class`]))}}),Cf={"aria-live":`polite`,class:`sr-only`},wf=N({inheritAttrs:!1,__name:`CodeBlockCopyButton`,props:{asChild:{type:Boolean},as:{default:`button`},value:{},variant:{default:`ghost`},size:{default:`icon-xs`},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e,{copy:n,copied:r}=qn({copiedDuring:2e3,legacy:!0});return(i,a)=>(I(),k(H,null,[O(B(Y),W(i.$attrs,{"data-slot":`code-block-copy-button`,"data-copied":B(r)||void 0,as:e.as,"as-child":e.asChild,variant:e.variant,size:e.size,"aria-label":B(r)?`Copied`:`Copy`,class:B(U)(``,t.class),onClick:a[0]||=e=>B(n)(t.value)}),{default:F(()=>[B(r)?(I(),K(B(Zn),{key:0})):(I(),K(B(Nc),{key:1}))]),_:1},16,[`data-copied`,`as`,`as-child`,`variant`,`size`,`aria-label`,`class`]),L(`span`,Cf,z(B(r)?`Copied`:``),1)],64))}}),Tf=N({__name:`CodeBlockToken`,props:{token:{}},setup(e){return(t,n)=>(I(),k(`span`,{style:We(e.token.htmlStyle),class:`text-(--shiki-light) dark:text-(--shiki-dark)`},z(e.token.content),5))}}),Ef=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function Df(e){return Of(e)}function Of(e){return Array.isArray(e)?kf(e):e instanceof RegExp?e:typeof e==`object`?Af(e):e}function kf(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=Of(e[n]);return t}function Af(e){let t={};for(let n in e)t[n]=Of(e[n]);return t}function jf(e,...t){return t.forEach(t=>{for(let n in t)e[n]=t[n]}),e}function Mf(e){let t=~e.lastIndexOf(`/`)||~e.lastIndexOf(`\\`);return t===0?e:~t===e.length-1?Mf(e.substring(0,e.length-1)):e.substr(~t+1)}var Nf=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,Pf=class{static hasCaptures(e){return e!==null&&(Nf.lastIndex=0,Nf.test(e))}static replaceCaptures(e,t,n){return e.replace(Nf,(e,r,i,a)=>{let o=n[parseInt(r||i,10)];if(o){let e=t.substring(o.start,o.end);for(;e[0]===`.`;)e=e.substring(1);switch(a){case`downcase`:return e.toLowerCase();case`upcase`:return e.toUpperCase();default:return e}}else return e})}};function Ff(e,t){return e<t?-1:+(e>t)}function If(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let r=0;r<n;r++){let n=Ff(e[r],t[r]);if(n!==0)return n}return 0}return n-r}function Lf(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function Rf(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,`\\$&`)}var zf=class{constructor(e){this.fn=e}cache=new Map;get(e){if(this.cache.has(e))return this.cache.get(e);let t=this.fn(e);return this.cache.set(e,t),t}},Bf=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(Gf(e),t)}static createFromParsedTheme(e,t){return Jf(e,t)}_cachedMatchRoot=new zf(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;let t=e.scopeName,n=this._cachedMatchRoot.get(t).find(t=>Hf(e.parent,t.parentScopes));return n?new Wf(n.fontStyle,n.foreground,n.background):null}},Vf=class e{constructor(e,t){this.parent=e,this.scopeName=t}static push(t,n){for(let r of n)t=new e(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new e(n,t[r]);return n}push(t){return new e(this,t)}getSegments(){let e=this,t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(` `)}extends(e){return this===e||this.parent!==null&&this.parent.extends(e)}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push(n.scopeName),n=n.parent;return n===e?t.reverse():void 0}};function Hf(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let r=t[n],i=!1;if(r===`>`){if(n===t.length-1)return!1;r=t[++n],i=!0}for(;e&&!Uf(e.scopeName,r);){if(i)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function Uf( Line truncated
`)}findNextMatchSync(e,t,n){let r=this.scanner.findNextMatchSync(e,t,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},Ip=class{constructor(e,t){this.languageId=e,this.tokenType=t}},Lp=class e{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,t){this._defaultAttributes=new Ip(e,8),this._embeddedLanguagesMatcher=new Rp(Object.entries(t||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?e._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}static _NULL_SCOPE_METADATA=new Ip(0,0);_getBasicScopeAttributes=new zf(e=>new Ip(this._scopeToLanguage(e),this._toStandardTokenType(e)));_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(t){let n=t.match(e.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case`comment`:return 1;case`string`:return 2;case`regex`:return 3;case`meta.embedded`:return 0}throw Error(`Unexpected match for standard token type!`)}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},Rp=class{values;scopesRegExp;constructor(e){if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);let t=e.map(([e,t])=>Rf(e));t.sort(),t.reverse(),this.scopesRegExp=RegExp(`^((${t.join(`)|(`)}))($|\\.)`,``)}}match(e){if(!this.scopesRegExp)return;let t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}};typeof process<`u`&&{}.VSCODE_TEXTMATE_DEBUG;var zp=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function Bp(e,t,n,r,i,a,o,s){let c=t.content.length,l=!1,u=-1;if(o){let o=Vp(e,t,n,r,i,a);i=o.stack,r=o.linePos,n=o.isFirstLine,u=o.anchorPosition}let d=Date.now();for(;!l;){if(s!==0&&Date.now()-d>s)return new zp(i,!0);f()}return new zp(i,!1);function f(){let o=Hp(e,t,n,r,i,u);if(!o){a.produce(i,c),l=!0;return}let s=o.captureIndices,d=o.matchedRuleId,f=s&&s.length>0?s[0].end>r:!1;if(d===Sp){let o=i.getRule(e);a.produce(i,s[0].start),i=i.withContentNameScopesList(i.nameScopesList),qp(e,t,n,i,a,o.endCaptures,s),a.produce(i,s[0].end);let d=i;if(i=i.parent,u=d.getAnchorPos(),!f&&d.getEnterPos()===r){i=d,a.produce(i,c),l=!0;return}}else{let o=e.getRule(d);a.produce(i,s[0].start);let p=i,m=o.getName(t.content,s),h=i.contentNameScopesList.pushAttributed(m,e);if(i=i.push(d,r,u,s[0].end===c,null,h,h),o instanceof Ap){let r=o;qp(e,t,n,i,a,r.beginCaptures,s),a.produce(i,s[0].end),u=s[0].end;let d=r.getContentName(t.content,s),m=h.pushAttributed(d,e);if(i=i.withContentNameScopesList(m),r.endHasBackReferences&&(i=i.withEndRule(r.getEndWithResolvedBackReferences(t.content,s))),!f&&p.hasSameRuleAs(i)){i=i.pop(),a.produce(i,c),l=!0;return}}else if(o instanceof jp){let r=o;qp(e,t,n,i,a,r.beginCaptures,s),a.produce(i,s[0].end),u=s[0].end;let d=r.getContentName(t.content,s),m=h.pushAttributed(d,e);if(i=i.withContentNameScopesList(m),r.whileHasBackReferences&&(i=i.withEndRule(r.getWhileWithResolvedBackReferences(t.content,s))),!f&&p.hasSameRuleAs(i)){i=i.pop(),a.produce(i,c),l=!0;return}}else if(qp(e,t,n,i,a,o.captures,s),a.produce(i,s[0].end),i=i.pop(),!f){i=i.safePop(),a.produce(i,c),l=!0;return}}s[0].end>r&&(r=s[0].end,n=!1)}}function Vp(e,t,n,r,i,a){let o=i.beginRuleCapturedEOL?0:-1,s=[];for(let t=i;t;t=t.pop()){let n=t.getRule(e);n instanceof jp&&s.push({rule:n,stack:t})}for(let c=s.pop();c;c=s.pop()){let{ruleScanner:s,findOptions:l}=Kp(c.rule,e,c.stack.endRule,n,r===o),u=s.findNextMatchSync(t,r,l);if(u){if(u.ruleId!==Cp){i=c.stack.pop();break}u.captureIndices&&u.captureIndices.length&&(a.produce(c.stack,u.captureIndices[0].start),qp(e,t,n,c.stack,a,c.rule.whileCaptures,u.captureIndices),a.produce(c.stack,u.captureIndices[0].end),o=u.captureIndices[0].end,u.captureIndices[0].end>r&&(r=u.captureIndices[0].end,n=!1))}else{i=c.stack.pop();break}}return{stack:i,linePos:r,anchorPosition:o,isFirstLine:n}}function Hp(e,t,n,r,i,a){let o=Up(e,t,n,r,i,a),s=e.getInjections();if(s.length===0)return o;let c=Wp(s,e,t,n,r,i,a);if(!c)return o;if(!o)return c;let l=o.captureIndices[0].start,u=c.captureIndices[0].start;return u<l||c.priorityMatch&&u===l?c:o}function Up(e,t,n,r,i,a){let{ruleScanner:o,findOptions:s}=Gp(i.getRule(e),e,i.endRule,n,r===a),c=o.findNextMatchSync(t,r,s);return c?{captureIndices:c.captureIndices,matchedRuleId:c.ruleId}:null}function Wp(e,t,n,r,i,a,o){let s=Number.MAX_VALUE,c=null,l,u=0,d=a.contentNameScopesList.getScopeNames();for(let a=0,f=e.length;a<f;a++){let f=e[a];if(!f.matcher(d))continue;let{ruleScanner:p,findOptions:m}=Gp(t.getRule(f.ruleId),t,null,r,i===o),h=p.findNextMatchSync(n,i,m);if(!h)continue;let g=h.captureIndices[0].start;if(!(g>=s)&&(s=g,c=h.captureIndices,l=h.ruleId,u=f.priority,s===i))break}return c?{priorityMatch:u===-1,captureIndices:c,matchedRuleId:l}:null}function Gp(e,t,n,r,i){return{ruleScanner:e.compileAG(t,n,r,i),findOptions:0}}function Kp(e,t,n,r,i){return{ruleScanner:e.compileWhileAG(t,n,r,i),findOptions:0}}function qp(e,t,n,r,i,a,o){if(a.length===0)return;let s=t.content,c=Math.min(a. Line truncated
`;let a=this.createOnigString(e),o=a.content.length,s=new im(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=Bp(this,a,i,0,t,s,!0,r);return ap(a),{lineLength:o,lineTokens:s,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function em(e,t){return e=Df(e),e.repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var tm=class e{constructor(e,t,n){this.parent=e,this.scopePath=t,this.tokenAttributes=n}static fromExtension(t,n){let r=t,i=t?.scopePath??null;for(let t of n)i=Vf.push(i,t.scopeNames),r=new e(r,i,t.encodedTokenAttributes);return r}static createRoot(t,n){return new e(null,new Vf(null,t),n)}static createRootAndLookUpScopeName(t,n,r){let i=r.getMetadataForScope(t),a=new Vf(null,t),o=r.themeProvider.themeMatch(a),s=e.mergeAttributes(n,i,o);return new e(null,a,s)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(` `)}equals(t){return e.equals(this,t)}static equals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.scopeName!==t.scopeName||e.tokenAttributes!==t.tokenAttributes)return!1;e=e.parent,t=t.parent}while(1)}static mergeAttributes(e,t,n){let r=-1,i=0,a=0;return n!==null&&(r=n.fontStyle,i=n.foregroundId,a=n.backgroundId),$f.set(e,t.languageId,t.tokenType,null,r,i,a)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(` `)===-1)return e._pushAttributed(this,t,n);let r=t.split(/ /g),i=this;for(let t of r)i=e._pushAttributed(i,t,n);return i}static _pushAttributed(t,n,r){let i=r.getMetadataForScope(n),a=t.scopePath.push(n),o=r.themeProvider.themeMatch(a),s=e.mergeAttributes(t.tokenAttributes,i,o);return new e(t,a,s)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push({encodedTokenAttributes:n.tokenAttributes,scopeNames:n.scopePath.getExtensionIfDefined(n.parent?.scopePath??null)}),n=n.parent;return n===e?t.reverse():void 0}},nm=class e{constructor(e,t,n,r,i,a,o,s){this.parent=e,this.ruleId=t,this.beginRuleCapturedEOL=i,this.endRule=a,this.nameScopesList=o,this.contentNameScopesList=s,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=n,this._anchorPos=r}_stackElementBrand=void 0;static NULL=new e(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return t!==null&&e._equals(this,t)}static _equals(e,t){return e===t?!0:this._structuralEquals(e,t)?tm.equals(e.contentNameScopesList,t.contentNameScopesList):!1}static _structuralEquals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.depth!==t.depth||e.ruleId!==t.ruleId||e.endRule!==t.endRule)return!1;e=e.parent,t=t.parent}while(1)}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){e._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,i,a,o,s){return new e(this,t,n,r,i,a,o,s)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){let e=[];return this._writeString(e,0),`[`+e.join(`,`)+`]`}_writeString(e,t){return this.parent&&(t=this.parent._writeString(e,t)),e[t++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,t}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(t){return this.endRule===t?this:new e(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let t=this;for(;t&&t._enterPos===e._enterPos;){if(t.ruleId===e.ruleId)return!0;t=t.parent}return!1}toStateStackFrame(){return{ruleId:Tp(this.ruleId),beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(t,n){let r=tm.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new e(t,wp(n.ruleId),n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,tm.fromExtension(r,n.contentNameScopesList))}},rm=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(e=>e===`*`?(this.allowAny=!0,[]):np(e,Zp).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>np(e,Zp).map(e=>e.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(let t of this.unbalancedBracketScopes)if(t(e))return!1;for(let t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},im=class{constructor(e,t,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._l Line truncated
\f\r &/=>`.split(``),`
\f\r "&'/=>\``.split(``)],[`\0
\f\r "&'/<=>`.split(``),`\0
@@ -14,10 +14,10 @@ import{A as e,B as t,C as n,D as r,E as i,F as a,H as o,I as s,L as c,M as l,N a
\f\r &>`.split(``),`\0
\f\r "&'<=>\``.split(``)],[`\0
\f\r "&'<=>\``.split(``),`\0
\f\r "&'<=>\``.split(``)]],single:[[`&'`.split(``),`"&'\``.split(``)],[`\0&'`.split(``),`\0"&'\``.split(``)]],double:[[`"&`.split(``),`"&'\``.split(``)],[`\0"&`.split(``),`\0"&'\``.split(``)]]};function Lv(e,t,n,r){let i=r.schema,a=i.space!==`svg`&&r.settings.omitOptionalTags,o=i.space===`svg`?r.settings.closeEmptyElements:r.settings.voids.includes(e.tagName.toLowerCase()),s=[],c;i.space===`html`&&e.tagName===`svg`&&(r.schema=E_);let l=Rv(r,e.properties),u=r.all(i.space===`html`&&e.tagName===`template`?e.content:e);return r.schema=i,u&&(o=!1),(l||!a||!Av(e,t,n))&&(s.push(`<`,e.tagName,l?` `+l:``),o&&(i.space===`svg`||r.settings.closeSelfClosing)&&(c=l.charAt(l.length-1),(!r.settings.tightSelfClosing||c===`/`||c&&c!==`"`&&c!==`'`)&&s.push(` `),s.push(`/`)),s.push(`>`)),s.push(u),!o&&(!a||!mv(e,t,n))&&s.push(`</`+e.tagName+`>`),s.join(``)}function Rv(e,t){let n=[],r=-1,i;if(t){for(i in t)if(t[i]!==null&&t[i]!==void 0){let r=zv(e,i,t[i]);r&&n.push(r)}}for(;++r<n.length;){let t=e.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&t!==`"`&&t!==`'`&&(n[r]+=` `)}return n.join(``)}function zv(e,t,n){let r=S_(e.schema,t),i=e.settings.allowParseErrors&&e.schema.space===`html`?0:1,a=+!e.settings.allowDangerousCharacters,o=e.quote,s;if(r.overloadedBoolean&&(n===r.attribute||n===``)?n=!0:(r.boolean||r.overloadedBoolean)&&(typeof n!=`string`||n===r.attribute||n===``)&&(n=!!n),n==null||n===!1||typeof n==`number`&&Number.isNaN(n))return``;let c=X_(r.attribute,Object.assign({},e.settings.characterReferences,{subset:Iv.name[i][a]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?rv:iv)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?c:(e.settings.preferUnquoted&&(s=X_(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:Iv.unquoted[i][a]}))),s!==n&&(e.settings.quoteSmart&&nv(n,o)>nv(n,e.alternative)&&(o=e.alternative),s=o+X_(n,Object.assign({},e.settings.characterReferences,{subset:(o===`'`?Iv.single:Iv.double)[i][a],attribute:!0}))+o),c+(s&&`=`+s))}var Bv=[`<`,`&`];function Vv(e,t,n,r){return n&&n.type===`element`&&(n.tagName===`script`||n.tagName===`style`)?e.value:X_(e.value,Object.assign({},r.settings.characterReferences,{subset:Bv}))}function Hv(e,t,n,r){return r.settings.allowDangerousHtml?e.value:Vv(e,t,n,r)}function Uv(e,t,n,r){return r.all(e)}var Wv=O_(`type`,{invalid:Gv,unknown:Kv,handlers:{comment:ev,doctype:tv,element:Lv,raw:Hv,root:Uv,text:Vv}});function Gv(e){throw Error("Expected node, not `"+e+"`")}function Kv(e){throw Error("Cannot compile unknown node `"+e.type+"`")}var qv={},Jv={},Yv=[];function Xv(e,t){let n=t||qv,r=n.quote||`"`,i=r===`"`?`'`:`"`;if(r!==`"`&&r!==`'`)throw Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:Zv,all:Qv,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||Kg,characterReferences:n.characterReferences||Jv,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space===`svg`?E_:T_,quote:r,alternative:i}.one(Array.isArray(e)?{type:`root`,children:e}:e,void 0,void 0)}function Zv(e,t,n){return Wv(e,t,n,this)}function Qv(e){let t=[],n=e&&e.children||Yv,r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join(``)}var $v=/\s+/g;function ey(e,t){if(!t)return e;e.properties||={},e.properties.class||=[],typeof e.properties.class==`string`&&(e.properties.class=e.properties.class.split($v)),Array.isArray(e.properties.class)||(e.properties.class=[]);let n=Array.isArray(t)?t:t.split($v);for(let t of n)t&&!e.properties.class.includes(t)&&e.properties.class.push(t);return e}function ty(e){let t=mg(e,!0).map(([e])=>e);function n(n){if(n===e.length)return{line:t.length-1,character:t.at(-1).length};let r=n,i=0;for(let e of t){if(r<e.length)break;r-=e.length,i++}return{line:i,character:r}}function r(e,n){let r=0;for(let n=0;n<e;n++)r+=t[n].length;return r+=n,r}return{lines:t,indexToPos:n,posToIndex:r}}var ny=[`color`,`background-color`];function ry(e,t){let n=0,r=[];for(let i of t)i>n&&r.push({...e,content:e.content.slice(n,i),offset:e.offset+n}),n=i;return n<e.content.length&&r.push({...e,content:e.content.slice(n),offset:e.offset+n}),r}function iy(e,t){let n=0,r=e.length;for(;n<r;){let i=n+(r-n>>1);e[i]<=t?n=i+1:r=i}return n}function ay(e,t){let n=[...t instanceof Set?t:new Set(t)].sort((e,t)=>e-t);return n.length?e.map(e=>e.flatMap(e=>{let t=e.offset+e.content.length,r=iy(n,e.offset),i=r;for(;i<n.length&&n[i]<t;)i++;if(r===i)return e;let a=n.slice(rLine truncated
`}));let n={type:`element`,tagName:`span`,properties:{class:`line`},children:[]},r=0;for(let a of e){let e={type:`element`,tagName:`span`,properties:{...a.htmlAttrs},children:[{type:`text`,value:a.content}]},c=cy(a.htmlStyle||sy(a));c&&(e.properties.style=c);for(let o of i)e=o?.span?.call(p,e,t+1,r,n,a)||e;s===`inline`?o.children.push(e):s===`classic`&&n.children.push(e),r+=a.content.length}if(s===`classic`){for(let e of i)n=e?.line?.call(p,n,t+1)||n;f.push(n),a.push(n)}else s===`inline`&&f.push(n)}),s===`classic`){for(let e of i)d=e?.code?.call(p,d)||d;u.children.push(d);for(let e of i)u=e?.pre?.call(p,u)||u;o.children.push(u)}else if(s===`inline`){let e=[],t={type:`element`,tagName:`span`,properties:{class:`line`},children:[]};for(let n of o.children)n.type===`element`&&n.tagName===`br`?(e.push(t),t={type:`element`,tagName:`span`,properties:{class:`line`},children:[]}):(n.type===`element`||n.type===`text`)&&t.children.push(n);e.push(t);let n={type:`element`,tagName:`code`,properties:{},children:e};for(let e of i)n=e?.code?.call(p,n)||n;o.children=[];for(let e=0;e<n.children.length;e++){e>0&&o.children.push({type:`element`,tagName:`br`,properties:{},children:[]});let t=n.children[e];t.type===`element`&&o.children.push(...t.children)}}let m=o;for(let e of i)m=e?.root?.call(p,m)||m;return r&&Og(m,r),m}function Fy(e){return e.map(e=>{let t=[],n=``,r;return e.forEach((i,a)=>{let o=!(i.fontStyle&&(i.fontStyle&Wm.Underline||i.fontStyle&Wm.Strikethrough));o&&jy.test(i.content)&&e[a+1]?(r===void 0&&(r=i.offset),n+=i.content):n?(o?t.push({...i,offset:r,content:n+i.content}):t.push({content:n,offset:r},i),r=void 0,n=``):t.push(i)}),t})}function Iy(e){return e.map(e=>e.flatMap(e=>{if(jy.test(e.content))return e;let t=e.content.match(My);if(!t)return e;let[,n,r,i]=t;if(!n&&!i)return e;let a=[{...e,offset:e.offset+n.length,content:r}];return n&&a.unshift({content:n,offset:e.offset}),i&&a.push({content:i,offset:e.offset+n.length+r.length}),a}))}function Ly(e){return e.map(e=>{let t=[];for(let n of e){if(t.length===0){t.push({...n});continue}let e=t.at(-1),r=cy(e.htmlStyle||sy(e)),i=cy(n.htmlStyle||sy(n)),a=e.fontStyle&&(e.fontStyle&Wm.Underline||e.fontStyle&Wm.Strikethrough),o=n.fontStyle&&(n.fontStyle&Wm.Underline||n.fontStyle&Wm.Strikethrough);!a&&!o&&r===i?e.content+=n.content:t.push({...n})}return t})}var Ry=Xv;function zy(e,t,n){let r={meta:{},options:n,codeToHast:(t,n)=>Ny(e,t,n),codeToTokens:(t,n)=>ky(e,t,n)},i=Ry(Ny(e,t,n,r));for(let e of py(n))i=e.postprocess?.call(r,i,n)||i;return i}async function By(e){let t=await Eg(e);return{getLastGrammarState:(...e)=>Ig(t,...e),codeToTokensBase:(e,n)=>Oy(t,e,n),codeToTokensWithThemes:(e,n)=>Wg(t,e,n),codeToTokens:(e,n)=>ky(t,e,n),codeToHast:(e,n)=>Ny(t,e,n),codeToHtml:(e,n)=>zy(t,e,n),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}var Vy=4294967295;function Hy(e){return!e.sticky&&!e.rawOptions?.strategy}function Uy(e,t){return{index:e,captureIndices:t.map(e=>e==null?{start:Vy,end:Vy,length:0}:{start:e[0],end:e[1],length:e[1]-e[0]})}}var Wy=class{patterns;options;regexps;lastSearches;constructor(e,t={}){this.patterns=e,this.options=t;let{forgiving:n=!1,cache:r,regexConstructor:i}=t;if(!i)throw Error("Option `regexConstructor` is not provided");this.regexps=e.map(e=>{if(typeof e!=`string`)return e;let t=r?.get(e);if(t){if(t instanceof RegExp)return t;if(n)return null;throw t}try{let t=i(e);return r?.set(e,t),t}catch(t){if(r?.set(e,t),n)return null;throw t}}),this.lastSearches=this.regexps.map(e=>e&&Hy(e)?{strId:0,searchedFrom:0,matchIndex:-1,indices:null}:null)}findNextMatchSync(e,t,n){let r=typeof e==`string`?e:e.content,i=typeof e==`string`?0:e.id||0,a=-1,o=0,s=null;for(let e=0;e<this.regexps.length;e++){let n=this.regexps[e];if(n)try{let c=i?this.lastSearches[e]:null,l,u;if(c&&c.strId===i&&c.searchedFrom<=t&&(c.matchIndex===-1||c.matchIndex>=t))l=c.matchIndex,u=c.indices;else{n.lastIndex=t;let e=n.exec(r);l=e?e.index:-1,u=e?e.indices:null,c&&(c.strId=i,c.searchedFrom=t,c.matchIndex=l,c.indices=u)}if(l===-1)continue;if(l===t)return Uy(e,u);(a===-1||l<o)&&(a=e,o=l,s=u)}catch(e){if(this.options.forgiving)continue;throw e}}return a===-1?null:Uy(a,s)}},Gy=0;function Ky(e){return{content:e,id:++Gy}}function qy(e){if([...e].length!==1)throw Error(`Expected "${e}" to be a single code point`);return e.codePointAt(0)}function Jy(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}var Yy=new Set([`alnum`,`alpha`,`ascii`,`blank`,`cntrl`,`digit`,`graph`,`lower`,`print`,`punct`,`space`,`upper`,`word`,`xdigit`]),Xy=String.raw;function Zy(e,t){if(e==null)throw Error(t??`Value expected`);return e}var Qy=Xy`\[\^?`,$y=`c.? | C(?:-.?)?|${Xy`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${Xy`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${Xy`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${Xy`o\{[^\}]*\}?`}|${Xy`\d{1,3}`}`,eb=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,tb=new RegExp(Xy`
\f\r "&'<=>\``.split(``)]],single:[[`&'`.split(``),`"&'\``.split(``)],[`\0&'`.split(``),`\0"&'\``.split(``)]],double:[[`"&`.split(``),`"&'\``.split(``)],[`\0"&`.split(``),`\0"&'\``.split(``)]]};function zg(e,t,n,r){let i=r.schema,a=i.space!==`svg`&&r.settings.omitOptionalTags,o=i.space===`svg`?r.settings.closeEmptyElements:r.settings.voids.includes(e.tagName.toLowerCase()),s=[],c;i.space===`html`&&e.tagName===`svg`&&(r.schema=Oh);let l=Bg(r,e.properties),u=r.all(i.space===`html`&&e.tagName===`template`?e.content:e);return r.schema=i,u&&(o=!1),(l||!a||!Mg(e,t,n))&&(s.push(`<`,e.tagName,l?` `+l:``),o&&(i.space===`svg`||r.settings.closeSelfClosing)&&(c=l.charAt(l.length-1),(!r.settings.tightSelfClosing||c===`/`||c&&c!==`"`&&c!==`'`)&&s.push(` `),s.push(`/`)),s.push(`>`)),s.push(u),!o&&(!a||!gg(e,t,n))&&s.push(`</`+e.tagName+`>`),s.join(``)}function Bg(e,t){let n=[],r=-1,i;if(t){for(i in t)if(t[i]!==null&&t[i]!==void 0){let r=Vg(e,i,t[i]);r&&n.push(r)}}for(;++r<n.length;){let t=e.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&t!==`"`&&t!==`'`&&(n[r]+=` `)}return n.join(``)}function Vg(e,t,n){let r=wh(e.schema,t),i=e.settings.allowParseErrors&&e.schema.space===`html`?0:1,a=+!e.settings.allowDangerousCharacters,o=e.quote,s;if(r.overloadedBoolean&&(n===r.attribute||n===``)?n=!0:(r.boolean||r.overloadedBoolean)&&(typeof n!=`string`||n===r.attribute||n===``)&&(n=!!n),n==null||n===!1||typeof n==`number`&&Number.isNaN(n))return``;let c=Qh(r.attribute,Object.assign({},e.settings.characterReferences,{subset:Rg.name[i][a]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?ag:og)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?c:(e.settings.preferUnquoted&&(s=Qh(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:Rg.unquoted[i][a]}))),s!==n&&(e.settings.quoteSmart&&ig(n,o)>ig(n,e.alternative)&&(o=e.alternative),s=o+Qh(n,Object.assign({},e.settings.characterReferences,{subset:(o===`'`?Rg.single:Rg.double)[i][a],attribute:!0}))+o),c+(s&&`=`+s))}var Hg=[`<`,`&`];function Ug(e,t,n,r){return n&&n.type===`element`&&(n.tagName===`script`||n.tagName===`style`)?e.value:Qh(e.value,Object.assign({},r.settings.characterReferences,{subset:Hg}))}function Wg(e,t,n,r){return r.settings.allowDangerousHtml?e.value:Ug(e,t,n,r)}function Gg(e,t,n,r){return r.all(e)}var Kg=Ah(`type`,{invalid:qg,unknown:Jg,handlers:{comment:ng,doctype:rg,element:zg,raw:Wg,root:Gg,text:Ug}});function qg(e){throw Error("Expected node, not `"+e+"`")}function Jg(e){throw Error("Cannot compile unknown node `"+e.type+"`")}var Yg={},Xg={},Zg=[];function Qg(e,t){let n=t||Yg,r=n.quote||`"`,i=r===`"`?`'`:`"`;if(r!==`"`&&r!==`'`)throw Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:$g,all:e_,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||Ym,characterReferences:n.characterReferences||Xg,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space===`svg`?Oh:Dh,quote:r,alternative:i}.one(Array.isArray(e)?{type:`root`,children:e}:e,void 0,void 0)}function $g(e,t,n){return Kg(e,t,n,this)}function e_(e){let t=[],n=e&&e.children||Zg,r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join(``)}var t_=/\s+/g;function n_(e,t){if(!t)return e;e.properties||={},e.properties.class||=[],typeof e.properties.class==`string`&&(e.properties.class=e.properties.class.split(t_)),Array.isArray(e.properties.class)||(e.properties.class=[]);let n=Array.isArray(t)?t:t.split(t_);for(let t of n)t&&!e.properties.class.includes(t)&&e.properties.class.push(t);return e}function r_(e){let t=_m(e,!0).map(([e])=>e);function n(n){if(n===e.length)return{line:t.length-1,character:t.at(-1).length};let r=n,i=0;for(let e of t){if(r<e.length)break;r-=e.length,i++}return{line:i,character:r}}function r(e,n){let r=0;for(let n=0;n<e;n++)r+=t[n].length;return r+=n,r}return{lines:t,indexToPos:n,posToIndex:r}}var i_=[`color`,`background-color`];function a_(e,t){let n=0,r=[];for(let i of t)i>n&&r.push({...e,content:e.content.slice(n,i),offset:e.offset+n}),n=i;return n<e.content.length&&r.push({...e,content:e.content.slice(n),offset:e.offset+n}),r}function o_(e,t){let n=0,r=e.length;for(;n<r;){let i=n+(r-n>>1);e[i]<=t?n=i+1:r=i}return n}function s_(e,t){let n=[...t instanceof Set?t:new Set(t)].sort((e,t)=>e-t);return n.length?e.map(e=>e.flatMap(e=>{let t=e.offset+e.content.length,r=o_(n,e.offset),i=r;for(;i<n.length&&n[i]<t;)i++;if(r===i)return e;let a=n.slice(rLine truncated
`}));let n={type:`element`,tagName:`span`,properties:{class:`line`},children:[]},r=0;for(let a of e){let e={type:`element`,tagName:`span`,properties:{...a.htmlAttrs},children:[{type:`text`,value:a.content}]},c=u_(a.htmlStyle||l_(a));c&&(e.properties.style=c);for(let o of i)e=o?.span?.call(p,e,t+1,r,n,a)||e;s===`inline`?o.children.push(e):s===`classic`&&n.children.push(e),r+=a.content.length}if(s===`classic`){for(let e of i)n=e?.line?.call(p,n,t+1)||n;f.push(n),a.push(n)}else s===`inline`&&f.push(n)}),s===`classic`){for(let e of i)d=e?.code?.call(p,d)||d;u.children.push(d);for(let e of i)u=e?.pre?.call(p,u)||u;o.children.push(u)}else if(s===`inline`){let e=[],t={type:`element`,tagName:`span`,properties:{class:`line`},children:[]};for(let n of o.children)n.type===`element`&&n.tagName===`br`?(e.push(t),t={type:`element`,tagName:`span`,properties:{class:`line`},children:[]}):(n.type===`element`||n.type===`text`)&&t.children.push(n);e.push(t);let n={type:`element`,tagName:`code`,properties:{},children:e};for(let e of i)n=e?.code?.call(p,n)||n;o.children=[];for(let e=0;e<n.children.length;e++){e>0&&o.children.push({type:`element`,tagName:`br`,properties:{},children:[]});let t=n.children[e];t.type===`element`&&o.children.push(...t.children)}}let m=o;for(let e of i)m=e?.root?.call(p,m)||m;return r&&jm(m,r),m}function L_(e){return e.map(e=>{let t=[],n=``,r;return e.forEach((i,a)=>{let o=!(i.fontStyle&&(i.fontStyle&qf.Underline||i.fontStyle&qf.Strikethrough));o&&N_.test(i.content)&&e[a+1]?(r===void 0&&(r=i.offset),n+=i.content):n?(o?t.push({...i,offset:r,content:n+i.content}):t.push({content:n,offset:r},i),r=void 0,n=``):t.push(i)}),t})}function R_(e){return e.map(e=>e.flatMap(e=>{if(N_.test(e.content))return e;let t=e.content.match(P_);if(!t)return e;let[,n,r,i]=t;if(!n&&!i)return e;let a=[{...e,offset:e.offset+n.length,content:r}];return n&&a.unshift({content:n,offset:e.offset}),i&&a.push({content:i,offset:e.offset+n.length+r.length}),a}))}function z_(e){return e.map(e=>{let t=[];for(let n of e){if(t.length===0){t.push({...n});continue}let e=t.at(-1),r=u_(e.htmlStyle||l_(e)),i=u_(n.htmlStyle||l_(n)),a=e.fontStyle&&(e.fontStyle&qf.Underline||e.fontStyle&qf.Strikethrough),o=n.fontStyle&&(n.fontStyle&qf.Underline||n.fontStyle&qf.Strikethrough);!a&&!o&&r===i?e.content+=n.content:t.push({...n})}return t})}var B_=Qg;function V_(e,t,n){let r={meta:{},options:n,codeToHast:(t,n)=>F_(e,t,n),codeToTokens:(t,n)=>j_(e,t,n)},i=B_(F_(e,t,n,r));for(let e of h_(n))i=e.postprocess?.call(r,i,n)||i;return i}async function H_(e){let t=await km(e);return{getLastGrammarState:(...e)=>zm(t,...e),codeToTokensBase:(e,n)=>A_(t,e,n),codeToTokensWithThemes:(e,n)=>qm(t,e,n),codeToTokens:(e,n)=>j_(t,e,n),codeToHast:(e,n)=>F_(t,e,n),codeToHtml:(e,n)=>V_(t,e,n),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}var U_=4294967295;function W_(e){return!e.sticky&&!e.rawOptions?.strategy}function G_(e,t){return{index:e,captureIndices:t.map(e=>e==null?{start:U_,end:U_,length:0}:{start:e[0],end:e[1],length:e[1]-e[0]})}}var K_=class{patterns;options;regexps;lastSearches;constructor(e,t={}){this.patterns=e,this.options=t;let{forgiving:n=!1,cache:r,regexConstructor:i}=t;if(!i)throw Error("Option `regexConstructor` is not provided");this.regexps=e.map(e=>{if(typeof e!=`string`)return e;let t=r?.get(e);if(t){if(t instanceof RegExp)return t;if(n)return null;throw t}try{let t=i(e);return r?.set(e,t),t}catch(t){if(r?.set(e,t),n)return null;throw t}}),this.lastSearches=this.regexps.map(e=>e&&W_(e)?{strId:0,searchedFrom:0,matchIndex:-1,indices:null}:null)}findNextMatchSync(e,t,n){let r=typeof e==`string`?e:e.content,i=typeof e==`string`?0:e.id||0,a=-1,o=0,s=null;for(let e=0;e<this.regexps.length;e++){let n=this.regexps[e];if(n)try{let c=i?this.lastSearches[e]:null,l,u;if(c&&c.strId===i&&c.searchedFrom<=t&&(c.matchIndex===-1||c.matchIndex>=t))l=c.matchIndex,u=c.indices;else{n.lastIndex=t;let e=n.exec(r);l=e?e.index:-1,u=e?e.indices:null,c&&(c.strId=i,c.searchedFrom=t,c.matchIndex=l,c.indices=u)}if(l===-1)continue;if(l===t)return G_(e,u);(a===-1||l<o)&&(a=e,o=l,s=u)}catch(e){if(this.options.forgiving)continue;throw e}}return a===-1?null:G_(a,s)}},q_=0;function J_(e){return{content:e,id:++q_}}function Y_(e){if([...e].length!==1)throw Error(`Expected "${e}" to be a single code point`);return e.codePointAt(0)}function X_(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}var Z_=new Set([`alnum`,`alpha`,`ascii`,`blank`,`cntrl`,`digit`,`graph`,`lower`,`print`,`punct`,`space`,`upper`,`word`,`xdigit`]),Q_=String.raw;function $_(e,t){if(e==null)throw Error(t??`Value expected`);return e}var ev=Q_`\[\^?`,tv=`c.? | C(?:-.?)?|${Q_`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${Q_`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${Q_`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${Q_`o\{[^\}]*\}?`}|${Q_`\d{1,3}`}`,nv=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,rv=new RegExp(Q_`
\\ (?:
${$y}
${tv}
| [gk]<[^>]*>?
| [gk]'[^']*'?
| .
@@ -34,20 +34,20 @@ import{A as e,B as t,C as n,D as r,E as i,F as a,H as o,I as s,L as c,M as l,N a
)?
| \*[^\)]*\)?
)?
| (?:${eb.source})+
| ${Qy}
| (?:${nv.source})+
| ${ev}
| .
`.replace(/\s+/g,``),`gsu`),nb=new RegExp(Xy`
`.replace(/\s+/g,``),`gsu`),iv=new RegExp(Q_`
\\ (?:
${$y}
${tv}
| .
)
| \[:(?:\^?\p{Alpha}+|\^):\]
| ${Qy}
| ${ev}
| &&
| .
`.replace(/\s+/g,``),`gsu`);function rb(e,t={}){let n={flags:``,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}};if(typeof e!=`string`)throw Error(`String expected as pattern`);let r=Nb(n.flags),i=[r.extended],a={captureGroup:n.rules.captureGroup,getCurrentModX(){return i.at(-1)},numOpenGroups:0,popModX(){i.pop()},pushModX(e){i.push(e)},replaceCurrentModX(e){i[i.length-1]=e},singleline:n.rules.singleline},o=[],s;for(tb.lastIndex=0;s=tb.exec(e);){let t=ib(a,e,s[0],tb.lastIndex);t.tokens?o.push(...t.tokens):t.token&&o.push(t.token),t.lastIndex!==void 0&&(tb.lastIndex=t.lastIndex)}let c=[],l=0;o.filter(e=>e.type===`GroupOpen`).forEach(e=>{e.kind===`capturing`?e.number=++l:e.raw===`(`&&c.push(e)}),l||c.forEach((e,t)=>{e.kind=`capturing`,e.number=t+1});let u=l||c.length;return{tokens:o.map(e=>e.type===`EscapedNumber`?Fb(e,u):e).flat(),flags:r}}function ib(e,t,n,r){let[i,a]=n;if(n===`[`||n===`[^`){let e=ab(t,n,r);return{tokens:e.tokens,lastIndex:e.lastIndex}}if(i===`\\`){if(`AbBGyYzZ`.includes(a))return{token:lb(n,n)};if(/^\\g[<']/.test(n)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(n))throw Error(`Invalid group name "${n}"`);return{token:Cb(n)}}if(/^\\k[<']/.test(n)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(n))throw Error(`Invalid group name "${n}"`);return{token:ub(n)}}if(a===`K`)return{token:_b(`keep`,n)};if(a===`N`||a===`R`)return{token:gb(`newline`,n,{negate:a===`N`})};if(a===`O`)return{token:gb(`any`,n)};if(a===`X`)return{token:gb(`text_segment`,n)};let e=sb(n,{inCharClass:!1});return Array.isArray(e)?{tokens:e}:{token:e}}if(i===`(`){if(a===`*`)return{token:Ob(n)};if(n===`(?{`)throw Error(`Unsupported callout "${n}"`);if(n.startsWith(`(?#`)){if(t[r]!==`)`)throw Error(`Unclosed comment group "(?#"`);return{lastIndex:r+1}}if(/^\(\?[-imx]+[:)]$/.test(n))return{token:Db(n,e)};if(e.pushModX(e.getCurrentModX()),e.numOpenGroups++,n===`(`&&!e.captureGroup||n===`(?:`)return{token:bb(`group`,n)};if(n===`(?>`)return{token:bb(`atomic`,n)};if(n===`(?=`||n===`(?!`||n===`(?<=`||n===`(?<!`)return{token:bb(n[2]===`<`?`lookbehind`:`lookahead`,n,{negate:n.endsWith(`!`)})};if(n===`(`&&e.captureGroup||n.startsWith(`(?<`)&&n.endsWith(`>`)||n.startsWith(`(?'`)&&n.endsWith(`'`))return{token:bb(`capturing`,n,{...n!==`(`&&{name:n.slice(3,-1)}})};if(n.startsWith(`(?~`)){if(n===`(?~|`)throw Error(`Unsupported absence function kind "${n}"`);return{token:bb(`absence_repeater`,n)}}throw Error(n===`(?(`?`Unsupported conditional "${n}"`:`Invalid or unsupported group option "${n}"`)}if(n===`)`){if(e.popModX(),e.numOpenGroups--,e.numOpenGroups<0)throw Error(`Unmatched ")"`);return{token:yb(n)}}if(e.getCurrentModX()){if(n===`#`){let e=t.indexOf(`
`,r);return{lastIndex:e===-1?t.length:e}}if(/^\s$/.test(n)){let e=/\s+/y;return e.lastIndex=r,{lastIndex:e.exec(t)?e.lastIndex:r}}}return n===`.`?{token:gb(`dot`,n)}:n===`^`||n===`$`?{token:lb(e.singleline?{"^":Xy`\A`,$:Xy`\Z`}[n]:n,n)}:n===`|`?{token:cb(n)}:eb.test(n)?{tokens:Ib(n)}:{token:db(qy(n),n)}}function ab(e,t,n){let r=[hb(t[1]===`^`,t)],i=1,a;for(nb.lastIndex=n;a=nb.exec(e);){let e=a[0];if(e[0]===`[`&&e[1]!==`:`)i++,r.push(hb(e[1]===`^`,e));else if(e===`]`){if(r.at(-1).type===`CharacterClassOpen`)r.push(db(93,e));else if(i--,r.push(fb(e)),!i)break}else{let t=ob(e);Array.isArray(t)?r.push(...t):r.push(t)}}return{tokens:r,lastIndex:nb.lastIndex||e.length}}function ob(e){if(e[0]===`\\`)return sb(e,{inCharClass:!0});if(e[0]===`[`){let t=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);if(!t||!Yy.has(t.groups.name))throw Error(`Invalid POSIX class "${e}"`);return gb(`posix`,e,{value:t.groups.name,negate:!!t.groups.negate})}return e===`-`?pb(e):e===`&&`?mb(e):db(qy(e),e)}function sb(e,{inCharClass:t}){let n=e[1];if(n===`c`||n===`C`)return Eb(e);if(`dDhHsSwW`.includes(n))return Ab(e);if(e.startsWith(Xy`\o{`))throw Error(`Incomplete, invalid, or unsupported octal code point "${e}"`);if(/^\\[pP]\{/.test(e)){if(e.length===3)throw Error(`Incomplete or invalid Unicode property "${e}"`);return jb(e)}if(/^\\x[89A-Fa-f]\p{AHex}/u.test(e))try{let t=e.split(/\\x/).slice(1).map(e=>parseInt(e,16)),n=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}).decode(new Uint8Array(t)),r=new TextEncoder;return[...n].map(e=>{let t=[...r.encode(e)].map(e=>`\\x${e.toString(16)}`).join(``);return db(qy(e),t)})}catch{throw Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`)}if(n===`u`||n===`x`)return db(Pb(e),e);if(Tb.has(n))return db(Tb.get(n),e);if(/\d/.test(n))return vb(t,e);if(e===`\\`)throw Error(Xy`Incomplete escape "\"`);if(n===`M`)throw Error(`Unsupported meta "${e}"`);if([...e].length===2)return db(e.codePointAt(1),e);throw Error(`Unexpected escape "${e}"`)}function cb(e){return{type:`Alternator`,raw:e}}function lb(e,t){return{type:`Assertion`,kind:e,raw:t}}function ub(e){return{type:`Backreference`,raw:e}}function db(e,t){return{type:`Character`,value:e,raw:t}}function fb(e){return{type:`CharacterClassClose`,raw:e}}function pb(e){return{type:`CharacterClassHyphen`,raw:e}}function mb(e){return{type:`CharacterClassIntersector`,raw:e}}function hb(e,t){return{type:`CharacterClassOpen`,negate:e,raw:t}}function gb(e,t,n={}){return{type:`CharacterSet`,kind:e,...n,raw:t}}function _b(e,t,n={}){return e===`keep`?{type:`Directive`,kind:e,raw:t}:{type:`Directive`,kind:e,flags:Zy(n.flags),raw:t}}function vb(e,t){return{type:`EscapedNumber`,inCharClass:e,raw:t}}function yb(e){return{type:`GroupClose`,raw:e}}function bb(e,t,n={}){return{type:`GroupOpen`,kind:e,...n,raw:t}}function xb(e,t,n,r){return{type:`NamedCallout`,kind:e,tag:t,arguments:n,raw:r}}function Sb(e,t,n,r){return{type:`Quantifier`,kind:e,min:t,max:n,raw:r}}function Cb(e){return{type:`Subroutine`,raw:e}}var wb=new Set([`COUNT`,`CMP`,`ERROR`,`FAIL`,`MAX`,`MISMATCH`,`SKIP`,`TOTAL_COUNT`]),Tb=new Map([[`a`,7],[`b`,8],[`e`,27],[`f`,12],[`n`,10],[`r`,13],[`t`,9],[`v`,11]]);function Eb(e){let t=e[1]===`c`?e[2]:e[3];if(!t||!/[A-Za-z]/.test(t))throw Error(`Unsupported control character "${e}"`);return db(qy(t.toUpperCase())-64,e)}function Db(e,t){let{on:n,off:r}=/^\(\?(?<on>[imx]*)(?:-(?<off>[-imx]*))?/.exec(e).groups;r??=``;let i=(t.getCurrentModX()||n.includes(`x`))&&!r.includes(`x`),a=Mb(n),o=Mb(r),s={};if(a&&(s.enable=a),o&&(s.disable=o),e.endsWith(`)`))return t.replaceCurrentModX(i),_b(`flags`,e,{flags:s});if(e.endsWith(`:`))return t.pushModX(i),t.numOpenGroups++,bb(`group`,e,{...(a||o)&&{flags:s}});throw Error(`Unexpected flag modifier "${e}"`)}function Ob(e){let t=/\(\*(?<name>[A-Za-z_]\w*)?(?:\[(?<tag>(?:[A-Za-z_]\w*)?)\])?(?:\{(?<args>[^}]*)\})?\)/.exec(e);if(!t)throw Error(`Incomplete or invalid named callout "${e}"`);let{name:n,tag:r,args:i}=t.groups;if(!n)throw Error(`Invalid named callout "${e}"`);if(r===``)throw Error(`Named callout tag with empty value not allowed "${e}"`);let a=i?i.split(`,`).filter(e=>e!==``).map(e=>/^[+-]?\d+$/.test(e)?+e:e):[],[o,s,c]=a,l=wb.has(n)?n.toLowerCase():`custom`;switch(l){case`fail`:case`mismatch`:case`skip`:if(a.length>0)throw Error(`Named callout arguments not allowed "${a}"`);break;case`error`:if(a.length>1)throw Error(`Named callout allows only one argument "${a}"`);if(typeof o==`string`)throw Error(`Named callout argument must be a number "${o}"`);break;case`max`:if(!a.length||a.length>2)throw Error(`Named callout must have one or two arguments "${a}"`);if(typeof o==`string`&&!/^[A-Za-z_]\w*$/.test(o))throw Error(`Named callout argument one must be a tag or number "${o}"`);if(a.length===2&&(typeof s==`number`||!/^[<>X]$/.test(s)))throw Error(`Named callout optional argument two must be '<', '>', or 'X' "${s}"`);break;case`count`:case`total_count`:if(a.length>1)throw Error(`Named callout allows only one argument "${a}"`) Line truncated
`.replace(/\s+/g,``),`gsu`);function av(e,t={}){let n={flags:``,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}};if(typeof e!=`string`)throw Error(`String expected as pattern`);let r=Fv(n.flags),i=[r.extended],a={captureGroup:n.rules.captureGroup,getCurrentModX(){return i.at(-1)},numOpenGroups:0,popModX(){i.pop()},pushModX(e){i.push(e)},replaceCurrentModX(e){i[i.length-1]=e},singleline:n.rules.singleline},o=[],s;for(rv.lastIndex=0;s=rv.exec(e);){let t=ov(a,e,s[0],rv.lastIndex);t.tokens?o.push(...t.tokens):t.token&&o.push(t.token),t.lastIndex!==void 0&&(rv.lastIndex=t.lastIndex)}let c=[],l=0;o.filter(e=>e.type===`GroupOpen`).forEach(e=>{e.kind===`capturing`?e.number=++l:e.raw===`(`&&c.push(e)}),l||c.forEach((e,t)=>{e.kind=`capturing`,e.number=t+1});let u=l||c.length;return{tokens:o.map(e=>e.type===`EscapedNumber`?Lv(e,u):e).flat(),flags:r}}function ov(e,t,n,r){let[i,a]=n;if(n===`[`||n===`[^`){let e=sv(t,n,r);return{tokens:e.tokens,lastIndex:e.lastIndex}}if(i===`\\`){if(`AbBGyYzZ`.includes(a))return{token:dv(n,n)};if(/^\\g[<']/.test(n)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(n))throw Error(`Invalid group name "${n}"`);return{token:Tv(n)}}if(/^\\k[<']/.test(n)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(n))throw Error(`Invalid group name "${n}"`);return{token:fv(n)}}if(a===`K`)return{token:yv(`keep`,n)};if(a===`N`||a===`R`)return{token:vv(`newline`,n,{negate:a===`N`})};if(a===`O`)return{token:vv(`any`,n)};if(a===`X`)return{token:vv(`text_segment`,n)};let e=lv(n,{inCharClass:!1});return Array.isArray(e)?{tokens:e}:{token:e}}if(i===`(`){if(a===`*`)return{token:Av(n)};if(n===`(?{`)throw Error(`Unsupported callout "${n}"`);if(n.startsWith(`(?#`)){if(t[r]!==`)`)throw Error(`Unclosed comment group "(?#"`);return{lastIndex:r+1}}if(/^\(\?[-imx]+[:)]$/.test(n))return{token:kv(n,e)};if(e.pushModX(e.getCurrentModX()),e.numOpenGroups++,n===`(`&&!e.captureGroup||n===`(?:`)return{token:Sv(`group`,n)};if(n===`(?>`)return{token:Sv(`atomic`,n)};if(n===`(?=`||n===`(?!`||n===`(?<=`||n===`(?<!`)return{token:Sv(n[2]===`<`?`lookbehind`:`lookahead`,n,{negate:n.endsWith(`!`)})};if(n===`(`&&e.captureGroup||n.startsWith(`(?<`)&&n.endsWith(`>`)||n.startsWith(`(?'`)&&n.endsWith(`'`))return{token:Sv(`capturing`,n,{...n!==`(`&&{name:n.slice(3,-1)}})};if(n.startsWith(`(?~`)){if(n===`(?~|`)throw Error(`Unsupported absence function kind "${n}"`);return{token:Sv(`absence_repeater`,n)}}throw Error(n===`(?(`?`Unsupported conditional "${n}"`:`Invalid or unsupported group option "${n}"`)}if(n===`)`){if(e.popModX(),e.numOpenGroups--,e.numOpenGroups<0)throw Error(`Unmatched ")"`);return{token:xv(n)}}if(e.getCurrentModX()){if(n===`#`){let e=t.indexOf(`
`,r);return{lastIndex:e===-1?t.length:e}}if(/^\s$/.test(n)){let e=/\s+/y;return e.lastIndex=r,{lastIndex:e.exec(t)?e.lastIndex:r}}}return n===`.`?{token:vv(`dot`,n)}:n===`^`||n===`$`?{token:dv(e.singleline?{"^":Q_`\A`,$:Q_`\Z`}[n]:n,n)}:n===`|`?{token:uv(n)}:nv.test(n)?{tokens:Rv(n)}:{token:pv(Y_(n),n)}}function sv(e,t,n){let r=[_v(t[1]===`^`,t)],i=1,a;for(iv.lastIndex=n;a=iv.exec(e);){let e=a[0];if(e[0]===`[`&&e[1]!==`:`)i++,r.push(_v(e[1]===`^`,e));else if(e===`]`){if(r.at(-1).type===`CharacterClassOpen`)r.push(pv(93,e));else if(i--,r.push(mv(e)),!i)break}else{let t=cv(e);Array.isArray(t)?r.push(...t):r.push(t)}}return{tokens:r,lastIndex:iv.lastIndex||e.length}}function cv(e){if(e[0]===`\\`)return lv(e,{inCharClass:!0});if(e[0]===`[`){let t=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);if(!t||!Z_.has(t.groups.name))throw Error(`Invalid POSIX class "${e}"`);return vv(`posix`,e,{value:t.groups.name,negate:!!t.groups.negate})}return e===`-`?hv(e):e===`&&`?gv(e):pv(Y_(e),e)}function lv(e,{inCharClass:t}){let n=e[1];if(n===`c`||n===`C`)return Ov(e);if(`dDhHsSwW`.includes(n))return Mv(e);if(e.startsWith(Q_`\o{`))throw Error(`Incomplete, invalid, or unsupported octal code point "${e}"`);if(/^\\[pP]\{/.test(e)){if(e.length===3)throw Error(`Incomplete or invalid Unicode property "${e}"`);return Nv(e)}if(/^\\x[89A-Fa-f]\p{AHex}/u.test(e))try{let t=e.split(/\\x/).slice(1).map(e=>parseInt(e,16)),n=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}).decode(new Uint8Array(t)),r=new TextEncoder;return[...n].map(e=>{let t=[...r.encode(e)].map(e=>`\\x${e.toString(16)}`).join(``);return pv(Y_(e),t)})}catch{throw Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`)}if(n===`u`||n===`x`)return pv(Iv(e),e);if(Dv.has(n))return pv(Dv.get(n),e);if(/\d/.test(n))return bv(t,e);if(e===`\\`)throw Error(Q_`Incomplete escape "\"`);if(n===`M`)throw Error(`Unsupported meta "${e}"`);if([...e].length===2)return pv(e.codePointAt(1),e);throw Error(`Unexpected escape "${e}"`)}function uv(e){return{type:`Alternator`,raw:e}}function dv(e,t){return{type:`Assertion`,kind:e,raw:t}}function fv(e){return{type:`Backreference`,raw:e}}function pv(e,t){return{type:`Character`,value:e,raw:t}}function mv(e){return{type:`CharacterClassClose`,raw:e}}function hv(e){return{type:`CharacterClassHyphen`,raw:e}}function gv(e){return{type:`CharacterClassIntersector`,raw:e}}function _v(e,t){return{type:`CharacterClassOpen`,negate:e,raw:t}}function vv(e,t,n={}){return{type:`CharacterSet`,kind:e,...n,raw:t}}function yv(e,t,n={}){return e===`keep`?{type:`Directive`,kind:e,raw:t}:{type:`Directive`,kind:e,flags:$_(n.flags),raw:t}}function bv(e,t){return{type:`EscapedNumber`,inCharClass:e,raw:t}}function xv(e){return{type:`GroupClose`,raw:e}}function Sv(e,t,n={}){return{type:`GroupOpen`,kind:e,...n,raw:t}}function Cv(e,t,n,r){return{type:`NamedCallout`,kind:e,tag:t,arguments:n,raw:r}}function wv(e,t,n,r){return{type:`Quantifier`,kind:e,min:t,max:n,raw:r}}function Tv(e){return{type:`Subroutine`,raw:e}}var Ev=new Set([`COUNT`,`CMP`,`ERROR`,`FAIL`,`MAX`,`MISMATCH`,`SKIP`,`TOTAL_COUNT`]),Dv=new Map([[`a`,7],[`b`,8],[`e`,27],[`f`,12],[`n`,10],[`r`,13],[`t`,9],[`v`,11]]);function Ov(e){let t=e[1]===`c`?e[2]:e[3];if(!t||!/[A-Za-z]/.test(t))throw Error(`Unsupported control character "${e}"`);return pv(Y_(t.toUpperCase())-64,e)}function kv(e,t){let{on:n,off:r}=/^\(\?(?<on>[imx]*)(?:-(?<off>[-imx]*))?/.exec(e).groups;r??=``;let i=(t.getCurrentModX()||n.includes(`x`))&&!r.includes(`x`),a=Pv(n),o=Pv(r),s={};if(a&&(s.enable=a),o&&(s.disable=o),e.endsWith(`)`))return t.replaceCurrentModX(i),yv(`flags`,e,{flags:s});if(e.endsWith(`:`))return t.pushModX(i),t.numOpenGroups++,Sv(`group`,e,{...(a||o)&&{flags:s}});throw Error(`Unexpected flag modifier "${e}"`)}function Av(e){let t=/\(\*(?<name>[A-Za-z_]\w*)?(?:\[(?<tag>(?:[A-Za-z_]\w*)?)\])?(?:\{(?<args>[^}]*)\})?\)/.exec(e);if(!t)throw Error(`Incomplete or invalid named callout "${e}"`);let{name:n,tag:r,args:i}=t.groups;if(!n)throw Error(`Invalid named callout "${e}"`);if(r===``)throw Error(`Named callout tag with empty value not allowed "${e}"`);let a=i?i.split(`,`).filter(e=>e!==``).map(e=>/^[+-]?\d+$/.test(e)?+e:e):[],[o,s,c]=a,l=Ev.has(n)?n.toLowerCase():`custom`;switch(l){case`fail`:case`mismatch`:case`skip`:if(a.length>0)throw Error(`Named callout arguments not allowed "${a}"`);break;case`error`:if(a.length>1)throw Error(`Named callout allows only one argument "${a}"`);if(typeof o==`string`)throw Error(`Named callout argument must be a number "${o}"`);break;case`max`:if(!a.length||a.length>2)throw Error(`Named callout must have one or two arguments "${a}"`);if(typeof o==`string`&&!/^[A-Za-z_]\w*$/.test(o))throw Error(`Named callout argument one must be a tag or number "${o}"`);if(a.length===2&&(typeof s==`number`||!/^[<>X]$/.test(s)))throw Error(`Named callout optional argument two must be '<', '>', or 'X' "${s}"`);break;case`count`:case`total_count`:if(a.length>1)throw Error(`Named callout allows only one argument "${a}"`) Line truncated
\\(?: \d+
| c[A-Za-z]
| [gk]<[^>]+>
@@ -60,9 +60,9 @@ import{A as e,B as t,C as n,D as r,E as i,F as a,H as o,I as s,L as c,M as l,N a
| [A-Za-z\-]+:
| \(DEFINE\)
))?
| (?<qBase>${Rx})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
| (?<qBase>${By})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
| \\?.
`.replace(/\s+/g,``),`gsu`);function Bx(e){if(!RegExp(`${Rx}\\+`).test(e))return{pattern:e};let t=[],n=null,r=null,i=``,a=0,o;for(zx.lastIndex=0;o=zx.exec(e);){let{0:s,index:c,groups:{qBase:l,qMod:u,invalidQ:d}}=o;if(s===`[`)a||(r=c),a++;else if(s===`]`)a?a--:r=null;else if(!a){if(u===`+`&&i&&!i.startsWith(`(`)){if(d)throw Error(`Invalid quantifier "${s}"`);let t=-1;if(/^\{\d+\}$/.test(l))e=kx(e,c+l.length,u,``);else{if(i===`)`||i===`]`){let t=i===`)`?n:r;if(t===null)throw Error(`Invalid unmatched "${i}"`);e=`${e.slice(0,t)}(?>${e.slice(t,c)}${l})${e.slice(c+s.length)}`}else e=`${e.slice(0,c-i.length)}(?>${i}${l})${e.slice(c+s.length)}`;t+=4}zx.lastIndex+=t}else s[0]===`(`?t.push(c):s===`)`&&(n=t.length?t.pop():null)}i=s}return{pattern:e}}var Vx=String.raw,Hx=Vx`\(\?R=(?<rDepth>[^\)]+)\)|${Vx`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`}`,Ux=Vx`\(\?<(?![=!])(?<captureName>[^>]+)>`,Wx=Vx`${Ux}|(?<unnamed>\()(?!\?)`,Gx=new RegExp(Vx`${Ux}|${Hx}|\(\?|\\?.`,`gsu`),Kx=`Cannot use multiple overlapping recursions`;function qx(e,t){let{hiddenCaptures:n,mode:r}={hiddenCaptures:[],mode:`plugin`,...t},i=t?.captureTransfers??new Map;if(!new RegExp(Hx,`su`).test(e))return{pattern:e,captureTransfers:i,hiddenCaptures:n};if(r===`plugin`&&Px(e,Vx`\(\?\(DEFINE\)`,Ax.DEFAULT))throw Error(`DEFINE groups cannot be used with recursion`);let a=[],o=Px(e,Vx`\\[1-9]`,Ax.DEFAULT),s=new Map,c=[],l=!1,u=0,d=0,f;for(Gx.lastIndex=0;f=Gx.exec(e);){let{0:t,groups:{captureName:p,rDepth:m,gRNameOrNum:h,gRDepth:g}}=f;if(t===`[`)u++;else if(u)t===`]`&&u--;else{if(m){if(Jx(m),l)throw Error(Kx);if(o)throw Error(`${r===`external`?`Backrefs`:`Numbered backrefs`} cannot be used with global recursion`);let t=e.slice(0,f.index),s=e.slice(Gx.lastIndex);if(Px(s,Hx,Ax.DEFAULT))throw Error(Kx);let c=m-1;e=Yx(t,s,c,!1,n,a,d),i=Qx(i,t,c,a.length,0,d);break}if(h){Jx(g);let u=!1;for(let e of c)if(e.name===h||e.num===+h){if(u=!0,e.hasRecursedWithin)throw Error(Kx);break}if(!u)throw Error(Vx`Recursive \g cannot be used outside the referenced group "${r===`external`?h:Vx`\g<${h}&R=${g}>`}"`);let p=s.get(h),m=Fx(e,p);if(o&&Px(m,Vx`${Ux}|\((?!\?)`,Ax.DEFAULT))throw Error(`${r===`external`?`Backrefs`:`Numbered backrefs`} cannot be used with recursion of capturing groups`);let _=e.slice(p,f.index),v=m.slice(_.length+t.length),y=a.length,b=g-1,x=Yx(_,v,b,!0,n,a,d);i=Qx(i,_,b,a.length-y,y,d),e=`${e.slice(0,p)}${x}${e.slice(p+m.length)}`,Gx.lastIndex+=x.length-t.length-_.length-v.length,c.forEach(e=>e.hasRecursedWithin=!0),l=!0}else if(p)d++,s.set(String(d),Gx.lastIndex),s.set(p,Gx.lastIndex),c.push({num:d,name:p});else if(t[0]===`(`){let e=t===`(`;e&&(d++,s.set(String(d),Gx.lastIndex)),c.push(e?{num:d}:{})}else t===`)`&&c.pop()}}return n.push(...a),{pattern:e,captureTransfers:i,hiddenCaptures:n}}function Jx(e){let t=`Max depth must be integer between 2 and 100; used ${e}`;if(!/^[1-9]\d*$/.test(e)||(e=+e,e<2||e>100))throw Error(t)}function Yx(e,t,n,r,i,a,o){let s=new Set;r&&Mx(e+t,Ux,({groups:{captureName:e}})=>{s.add(e)},Ax.DEFAULT);let c=[n,r?s:null,i,a,o];return`${e}${Xx(`(?:${e}`,`forward`,...c)}(?:)${Xx(`${t})`,`backward`,...c)}${t}`}function Xx(e,t,n,r,i,a,o){let s=e=>t===`forward`?e+2:n-e+2-1,c=``;for(let t=0;t<n;t++){let n=s(t);c+=jx(e,Vx`${Wx}|\\k<(?<backref>[^>]+)>`,({0:e,groups:{captureName:t,unnamed:s,backref:c}})=>{if(c&&r&&!r.has(c))return e;let l=`_$${n}`;if(s||t){let n=o+a.length+1;return a.push(n),Zx(i,n),s?e:`(?<${t}${l}>`}return Vx`\k<${c}${l}>`},Ax.DEFAULT)}return c}function Zx(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function Qx(e,t,n,r,i,a){if(e.size&&r){let o=0;Mx(t,Wx,()=>o++,Ax.DEFAULT);let s=a-o+i,c=new Map;return e.forEach((e,t)=>{let i=(r-o*n)/n,a=o*n,l=t>s+o?t+r:t,u=[];for(let t of e)if(t<=s)u.push(t);else if(t>s+o+i)u.push(t+r);else if(t<=s+o)for(let e=0;e<=n;e++)u.push(t+o*e);else for(let e=0;e<=n;e++)u.push(t+a+i*e);c.set(l,u)}),c}return e}var $x=String.fromCodePoint,eS=String.raw,tS={},nS=globalThis.RegExp;tS.flagGroups=(()=>{try{new nS(`(?i:)`)}catch{return!1}return!0})(),tS.unicodeSets=(()=>{try{new nS(`[[]]`,`v`)}catch{return!1}return!0})(),tS.bugFlagVLiteralHyphenIsRange=tS.unicodeSets?(()=>{try{new nS(eS`[\d\-a]`,`v`)}catch{return!0}return!1})():!1,tS.bugNestedClassIgnoresNegation=tS.unicodeSets&&new nS(`[[^a]]`,`v`).test(`a`);function rS(e,{enable:t,disable:n}){return{dotAll:!n?.dotAll&&!!(t?.dotAll||e.dotAll),ignoreCase:!n?.ignoreCase&&!!(t?.ignoreCase||e.ignoreCase)}}function iS(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}function aS(e,t){return sS[e]>=sS[t]}function oS(e,t){if(e==null)throw Error(t??`Value expected`);return e}var sS={ES2025:2025,ES2024:2024,ES2018:2018},cS={auto:`auto`,ES2025:`ES2025`,ES2024:`ES2024`,ES2018:`ES2018`};function lS(e={}){if({}.toString.call(e)!==`[object Object]`)throw Error(`Unexpected options`);if(e.target!==void 0&&!cS[e.target])throw Error(`Unexpected target "${e.target}"`);let t={accuracy:`default`,avoidSubclass:!1,flags:``,global:!1,hasIndices:!1,lazyCompileLength:1/0,target:`aLine truncated
`.replace(/\s+/g,``),`gsu`);function Hy(e){if(!RegExp(`${By}\\+`).test(e))return{pattern:e};let t=[],n=null,r=null,i=``,a=0,o;for(Vy.lastIndex=0;o=Vy.exec(e);){let{0:s,index:c,groups:{qBase:l,qMod:u,invalidQ:d}}=o;if(s===`[`)a||(r=c),a++;else if(s===`]`)a?a--:r=null;else if(!a){if(u===`+`&&i&&!i.startsWith(`(`)){if(d)throw Error(`Invalid quantifier "${s}"`);let t=-1;if(/^\{\d+\}$/.test(l))e=jy(e,c+l.length,u,``);else{if(i===`)`||i===`]`){let t=i===`)`?n:r;if(t===null)throw Error(`Invalid unmatched "${i}"`);e=`${e.slice(0,t)}(?>${e.slice(t,c)}${l})${e.slice(c+s.length)}`}else e=`${e.slice(0,c-i.length)}(?>${i}${l})${e.slice(c+s.length)}`;t+=4}Vy.lastIndex+=t}else s[0]===`(`?t.push(c):s===`)`&&(n=t.length?t.pop():null)}i=s}return{pattern:e}}var Uy=String.raw,Wy=Uy`\(\?R=(?<rDepth>[^\)]+)\)|${Uy`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`}`,Gy=Uy`\(\?<(?![=!])(?<captureName>[^>]+)>`,Ky=Uy`${Gy}|(?<unnamed>\()(?!\?)`,qy=new RegExp(Uy`${Gy}|${Wy}|\(\?|\\?.`,`gsu`),Jy=`Cannot use multiple overlapping recursions`;function Yy(e,t){let{hiddenCaptures:n,mode:r}={hiddenCaptures:[],mode:`plugin`,...t},i=t?.captureTransfers??new Map;if(!new RegExp(Wy,`su`).test(e))return{pattern:e,captureTransfers:i,hiddenCaptures:n};if(r===`plugin`&&Iy(e,Uy`\(\?\(DEFINE\)`,My.DEFAULT))throw Error(`DEFINE groups cannot be used with recursion`);let a=[],o=Iy(e,Uy`\\[1-9]`,My.DEFAULT),s=new Map,c=[],l=!1,u=0,d=0,f;for(qy.lastIndex=0;f=qy.exec(e);){let{0:t,groups:{captureName:p,rDepth:m,gRNameOrNum:h,gRDepth:g}}=f;if(t===`[`)u++;else if(u)t===`]`&&u--;else{if(m){if(Xy(m),l)throw Error(Jy);if(o)throw Error(`${r===`external`?`Backrefs`:`Numbered backrefs`} cannot be used with global recursion`);let t=e.slice(0,f.index),s=e.slice(qy.lastIndex);if(Iy(s,Wy,My.DEFAULT))throw Error(Jy);let c=m-1;e=Zy(t,s,c,!1,n,a,d),i=eb(i,t,c,a.length,0,d);break}if(h){Xy(g);let u=!1;for(let e of c)if(e.name===h||e.num===+h){if(u=!0,e.hasRecursedWithin)throw Error(Jy);break}if(!u)throw Error(Uy`Recursive \g cannot be used outside the referenced group "${r===`external`?h:Uy`\g<${h}&R=${g}>`}"`);let p=s.get(h),m=Ly(e,p);if(o&&Iy(m,Uy`${Gy}|\((?!\?)`,My.DEFAULT))throw Error(`${r===`external`?`Backrefs`:`Numbered backrefs`} cannot be used with recursion of capturing groups`);let _=e.slice(p,f.index),v=m.slice(_.length+t.length),y=a.length,b=g-1,x=Zy(_,v,b,!0,n,a,d);i=eb(i,_,b,a.length-y,y,d),e=`${e.slice(0,p)}${x}${e.slice(p+m.length)}`,qy.lastIndex+=x.length-t.length-_.length-v.length,c.forEach(e=>e.hasRecursedWithin=!0),l=!0}else if(p)d++,s.set(String(d),qy.lastIndex),s.set(p,qy.lastIndex),c.push({num:d,name:p});else if(t[0]===`(`){let e=t===`(`;e&&(d++,s.set(String(d),qy.lastIndex)),c.push(e?{num:d}:{})}else t===`)`&&c.pop()}}return n.push(...a),{pattern:e,captureTransfers:i,hiddenCaptures:n}}function Xy(e){let t=`Max depth must be integer between 2 and 100; used ${e}`;if(!/^[1-9]\d*$/.test(e)||(e=+e,e<2||e>100))throw Error(t)}function Zy(e,t,n,r,i,a,o){let s=new Set;r&&Py(e+t,Gy,({groups:{captureName:e}})=>{s.add(e)},My.DEFAULT);let c=[n,r?s:null,i,a,o];return`${e}${Qy(`(?:${e}`,`forward`,...c)}(?:)${Qy(`${t})`,`backward`,...c)}${t}`}function Qy(e,t,n,r,i,a,o){let s=e=>t===`forward`?e+2:n-e+2-1,c=``;for(let t=0;t<n;t++){let n=s(t);c+=Ny(e,Uy`${Ky}|\\k<(?<backref>[^>]+)>`,({0:e,groups:{captureName:t,unnamed:s,backref:c}})=>{if(c&&r&&!r.has(c))return e;let l=`_$${n}`;if(s||t){let n=o+a.length+1;return a.push(n),$y(i,n),s?e:`(?<${t}${l}>`}return Uy`\k<${c}${l}>`},My.DEFAULT)}return c}function $y(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function eb(e,t,n,r,i,a){if(e.size&&r){let o=0;Py(t,Ky,()=>o++,My.DEFAULT);let s=a-o+i,c=new Map;return e.forEach((e,t)=>{let i=(r-o*n)/n,a=o*n,l=t>s+o?t+r:t,u=[];for(let t of e)if(t<=s)u.push(t);else if(t>s+o+i)u.push(t+r);else if(t<=s+o)for(let e=0;e<=n;e++)u.push(t+o*e);else for(let e=0;e<=n;e++)u.push(t+a+i*e);c.set(l,u)}),c}return e}var tb=String.fromCodePoint,nb=String.raw,rb={},ib=globalThis.RegExp;rb.flagGroups=(()=>{try{new ib(`(?i:)`)}catch{return!1}return!0})(),rb.unicodeSets=(()=>{try{new ib(`[[]]`,`v`)}catch{return!1}return!0})(),rb.bugFlagVLiteralHyphenIsRange=rb.unicodeSets?(()=>{try{new ib(nb`[\d\-a]`,`v`)}catch{return!0}return!1})():!1,rb.bugNestedClassIgnoresNegation=rb.unicodeSets&&new ib(`[[^a]]`,`v`).test(`a`);function ab(e,{enable:t,disable:n}){return{dotAll:!n?.dotAll&&!!(t?.dotAll||e.dotAll),ignoreCase:!n?.ignoreCase&&!!(t?.ignoreCase||e.ignoreCase)}}function ob(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}function sb(e,t){return lb[e]>=lb[t]}function cb(e,t){if(e==null)throw Error(t??`Value expected`);return e}var lb={ES2025:2025,ES2024:2024,ES2018:2018},ub={auto:`auto`,ES2025:`ES2025`,ES2024:`ES2024`,ES2018:`ES2018`};function db(e={}){if({}.toString.call(e)!==`[object Object]`)throw Error(`Unexpected options`);if(e.target!==void 0&&!ub[e.target])throw Error(`Unexpected target "${e.target}"`);let t={accuracy:`default`,avoidSubclass:!1,flags:``,global:!1,hasIndices:!1,lazyCompileLength:1/0,target:`aLine truncated
Cc Control cntrl
Cf Format
Cn Unassigned
@@ -152,89 +152,89 @@ Uppercase Upper
Variation_Selector VS
White_Space space
XID_Continue XIDC
XID_Start XIDS`.split(/\s/).map(e=>[xx(e),e])),hS=new Map([[`s`,$x(383)],[$x(383),`s`]]),gS=new Map([[$x(223),$x(7838)],[$x(107),$x(8490)],[$x(229),$x(8491)],[$x(969),$x(8486)]]),_S=new Map([bS(453),bS(456),bS(459),bS(498),...xS(8072,8079),...xS(8088,8095),...xS(8104,8111),bS(8124),bS(8140),bS(8188)]),vS=new Map([[`alnum`,eS`[\p{Alpha}\p{Nd}]`],[`alpha`,eS`\p{Alpha}`],[`ascii`,eS`\p{ASCII}`],[`blank`,eS`[\p{Zs}\t]`],[`cntrl`,eS`\p{Cc}`],[`digit`,eS`\p{Nd}`],[`graph`,eS`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],[`lower`,eS`\p{Lower}`],[`print`,eS`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],[`punct`,eS`[\p{P}\p{S}]`],[`space`,eS`\p{space}`],[`upper`,eS`\p{Upper}`],[`word`,eS`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],[`xdigit`,eS`\p{AHex}`]]);function yS(e,t){let n=[];for(let r=e;r<=t;r++)n.push(r);return n}function bS(e){let t=$x(e);return[t.toLowerCase(),t]}function xS(e,t){return yS(e,t).map(e=>bS(e))}var SS=new Set([`Lower`,`Lowercase`,`Upper`,`Uppercase`,`Ll`,`Lowercase_Letter`,`Lt`,`Titlecase_Letter`,`Lu`,`Uppercase_Letter`]);function CS(e,t){let n={accuracy:`default`,asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:`ES2025`,...t};DS(e);let r={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:aS(n.bestEffortTarget,`ES2024`),passedLookbehind:!1,strategy:null,subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:e.flags.digitIsAscii,spaceIsAscii:e.flags.spaceIsAscii,wordIsAscii:e.flags.wordIsAscii};wx(e,wS,r);let i={dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},a={currentFlags:i,prevFlags:null,globalFlags:i,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:r.subroutineRefMap};return wx(e,TS,a),wx(e,ES,{groupsByName:a.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:a.reffedNodesByReferencer}),e._originMap=a.groupOriginByCopy,e._strategy=r.strategy,e}var wS={AbsenceFunction({node:e,parent:t,replaceWith:n}){let{body:r,kind:i}=e;if(i===`repeater`){let e=ox();e.body[0].body.push(sx({negate:!0,body:r}),px(`Any`));let i=ox();i.body[0].body.push(ux(`greedy`,0,1/0,e)),n(KS(i,t),{traverse:!0})}else throw Error(`Unsupported absence function "(?~|"`)},Alternative:{enter({node:e,parent:t,key:n},{flagDirectivesByAlt:r}){let i=e.body.filter(e=>e.kind===`flags`);for(let e=n+1;e<t.body.length;e++){let n=t.body[e];iS(r,n,[]).push(...i)}},exit({node:e},{flagDirectivesByAlt:t}){if(t.get(e)?.length){let n=PS(t.get(e));if(n){let t=ox({flags:n});t.body[0].body=e.body,e.body=[KS(t,e)]}}}},Assertion({node:e,parent:t,key:n,container:r,root:i,remove:a,replaceWith:o},s){let{kind:c,negate:l}=e,{asciiWordBoundaries:u,avoidSubclass:d,supportedGNodes:f,wordIsAscii:p}=s;if(c===`text_segment_boundary`)throw Error(`Unsupported text segment boundary "\\${l?`Y`:`y`}"`);if(c===`line_end`)o(KS(sx({body:[Xb({body:[Zb(`string_end`)]}),Xb({body:[ex(10)]})]}),t));else if(c===`line_start`)o(KS(US(eS`(?<=\A|\n(?!\z))`,{skipLookbehindValidation:!0}),t));else if(c===`search_start`){if(f.has(e))i.flags.sticky=!0,a();else{let e=r[n-1];if(e&&BS(e))o(KS(sx({negate:!0}),t));else if(d)throw Error(eS`Uses "\G" in a way that requires a subclass`);else o(GS(Zb(`string_start`),t)),s.strategy=`clip_search`}}else if(c!==`string_end`&&c!==`string_start`){if(c===`string_end_newline`)o(KS(US(eS`(?=\n?\z)`),t));else if(c===`word_boundary`){if(!p&&!u){let e=`(?:(?<=${fS})(?!${fS})|(?<!${fS})(?=${fS}))`,n=`(?:(?<=${fS})(?=${fS})|(?<!${fS})(?!${fS}))`;o(KS(US(l?n:e),t))}}else throw Error(`Unexpected assertion kind "${c}"`)}},Backreference({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n==`string`&&!HS(n)&&(n=NS(n,t),e.ref=n)},CapturingGroup({node:e},{jsGroupNameMap:t,subroutineRefMap:n}){let{name:r}=e;r&&!HS(r)&&(r=NS(r,t),e.name=r),n.set(e.number,e),r&&n.set(r,e)},CharacterClassRange({node:e,parent:t,replaceWith:n}){t.kind===`intersection`&&n(KS(tx({body:[e]}),t),{traverse:!0})},CharacterSet({node:e,parent:t,replaceWith:n},{accuracy:r,minTargetEs2024:i,digitIsAscii:a,spaceIsAscii:o,wordIsAscii:s}){let{kind:c,negate:l,value:u}=e;if(a&&(c===`digit`||u===`digit`))n(GS(rx(`digit`,{negate:l}),t));else if(o&&(c===`space`||u===`space`))n(KS(WS(US(uS),l),t));else if(s&&(c===`word`||u===`word`))n(GS(rx(`word`,{negate:l}),t));else if(c===`any`)n(GS(px(`Any`),t));else if(c===`digit`)n(GS(px(`Nd`,{negate:l}),t));else if(c!==`dot`){if(c===`text_segment`){if(r===`strict`)throw Error(eS`Use of "\X" requires non-strict accuracy`);let e=`\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?`,a=eS`\p{RI}{2}|${e}(?:\u200D${e})*`;n(KS(US(eS`(?>\r\n|${i?eS`\p{RGI_Emoji}`:a}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),t))}else if(c===`hex`)n(GS(px(`AHex`,{negate:l}),t));else if(c===`newline`)n(KS(US(l?`[^
XID_Start XIDS`.split(/\s/).map(e=>[Cy(e),e])),_b=new Map([[`s`,tb(383)],[tb(383),`s`]]),vb=new Map([[tb(223),tb(7838)],[tb(107),tb(8490)],[tb(229),tb(8491)],[tb(969),tb(8486)]]),yb=new Map([Sb(453),Sb(456),Sb(459),Sb(498),...Cb(8072,8079),...Cb(8088,8095),...Cb(8104,8111),Sb(8124),Sb(8140),Sb(8188)]),bb=new Map([[`alnum`,nb`[\p{Alpha}\p{Nd}]`],[`alpha`,nb`\p{Alpha}`],[`ascii`,nb`\p{ASCII}`],[`blank`,nb`[\p{Zs}\t]`],[`cntrl`,nb`\p{Cc}`],[`digit`,nb`\p{Nd}`],[`graph`,nb`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],[`lower`,nb`\p{Lower}`],[`print`,nb`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],[`punct`,nb`[\p{P}\p{S}]`],[`space`,nb`\p{space}`],[`upper`,nb`\p{Upper}`],[`word`,nb`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],[`xdigit`,nb`\p{AHex}`]]);function xb(e,t){let n=[];for(let r=e;r<=t;r++)n.push(r);return n}function Sb(e){let t=tb(e);return[t.toLowerCase(),t]}function Cb(e,t){return xb(e,t).map(e=>Sb(e))}var wb=new Set([`Lower`,`Lowercase`,`Upper`,`Uppercase`,`Ll`,`Lowercase_Letter`,`Lt`,`Titlecase_Letter`,`Lu`,`Uppercase_Letter`]);function Tb(e,t){let n={accuracy:`default`,asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:`ES2025`,...t};kb(e);let r={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:sb(n.bestEffortTarget,`ES2024`),passedLookbehind:!1,strategy:null,subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:e.flags.digitIsAscii,spaceIsAscii:e.flags.spaceIsAscii,wordIsAscii:e.flags.wordIsAscii};Ey(e,Eb,r);let i={dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},a={currentFlags:i,prevFlags:null,globalFlags:i,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:r.subroutineRefMap};return Ey(e,Db,a),Ey(e,Ob,{groupsByName:a.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:a.reffedNodesByReferencer}),e._originMap=a.groupOriginByCopy,e._strategy=r.strategy,e}var Eb={AbsenceFunction({node:e,parent:t,replaceWith:n}){let{body:r,kind:i}=e;if(i===`repeater`){let e=cy();e.body[0].body.push(ly({negate:!0,body:r}),hy(`Any`));let i=cy();i.body[0].body.push(fy(`greedy`,0,1/0,e)),n(Jb(i,t),{traverse:!0})}else throw Error(`Unsupported absence function "(?~|"`)},Alternative:{enter({node:e,parent:t,key:n},{flagDirectivesByAlt:r}){let i=e.body.filter(e=>e.kind===`flags`);for(let e=n+1;e<t.body.length;e++){let n=t.body[e];ob(r,n,[]).push(...i)}},exit({node:e},{flagDirectivesByAlt:t}){if(t.get(e)?.length){let n=Ib(t.get(e));if(n){let t=cy({flags:n});t.body[0].body=e.body,e.body=[Jb(t,e)]}}}},Assertion({node:e,parent:t,key:n,container:r,root:i,remove:a,replaceWith:o},s){let{kind:c,negate:l}=e,{asciiWordBoundaries:u,avoidSubclass:d,supportedGNodes:f,wordIsAscii:p}=s;if(c===`text_segment_boundary`)throw Error(`Unsupported text segment boundary "\\${l?`Y`:`y`}"`);if(c===`line_end`)o(Jb(ly({body:[Qv({body:[$v(`string_end`)]}),Qv({body:[ny(10)]})]}),t));else if(c===`line_start`)o(Jb(Gb(nb`(?<=\A|\n(?!\z))`,{skipLookbehindValidation:!0}),t));else if(c===`search_start`){if(f.has(e))i.flags.sticky=!0,a();else{let e=r[n-1];if(e&&Hb(e))o(Jb(ly({negate:!0}),t));else if(d)throw Error(nb`Uses "\G" in a way that requires a subclass`);else o(qb($v(`string_start`),t)),s.strategy=`clip_search`}}else if(c!==`string_end`&&c!==`string_start`){if(c===`string_end_newline`)o(Jb(Gb(nb`(?=\n?\z)`),t));else if(c===`word_boundary`){if(!p&&!u){let e=`(?:(?<=${mb})(?!${mb})|(?<!${mb})(?=${mb}))`,n=`(?:(?<=${mb})(?=${mb})|(?<!${mb})(?!${mb}))`;o(Jb(Gb(l?n:e),t))}}else throw Error(`Unexpected assertion kind "${c}"`)}},Backreference({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n==`string`&&!Wb(n)&&(n=Fb(n,t),e.ref=n)},CapturingGroup({node:e},{jsGroupNameMap:t,subroutineRefMap:n}){let{name:r}=e;r&&!Wb(r)&&(r=Fb(r,t),e.name=r),n.set(e.number,e),r&&n.set(r,e)},CharacterClassRange({node:e,parent:t,replaceWith:n}){t.kind===`intersection`&&n(Jb(ry({body:[e]}),t),{traverse:!0})},CharacterSet({node:e,parent:t,replaceWith:n},{accuracy:r,minTargetEs2024:i,digitIsAscii:a,spaceIsAscii:o,wordIsAscii:s}){let{kind:c,negate:l,value:u}=e;if(a&&(c===`digit`||u===`digit`))n(qb(ay(`digit`,{negate:l}),t));else if(o&&(c===`space`||u===`space`))n(Jb(Kb(Gb(fb),l),t));else if(s&&(c===`word`||u===`word`))n(qb(ay(`word`,{negate:l}),t));else if(c===`any`)n(qb(hy(`Any`),t));else if(c===`digit`)n(qb(hy(`Nd`,{negate:l}),t));else if(c!==`dot`){if(c===`text_segment`){if(r===`strict`)throw Error(nb`Use of "\X" requires non-strict accuracy`);let e=`\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?`,a=nb`\p{RI}{2}|${e}(?:\u200D${e})*`;n(Jb(Gb(nb`(?>\r\n|${i?nb`\p{RGI_Emoji}`:a}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),t))}else if(c===`hex`)n(qb(hy(`AHex`,{negate:l}),t));else if(c===`newline`)n(Jb(Gb(l?`[^
]`:`(?>\r
?|[
\v\f…\u2028\u2029])`),t));else if(c===`posix`){if(!i&&(u===`graph`||u===`print`)){if(r===`strict`)throw Error(`POSIX class "${u}" requires min target ES2024 or non-strict accuracy`);let e={graph:`!-~`,print:` -~`}[u];l&&(e=`\0-${$x(e.codePointAt(0)-1)}${$x(e.codePointAt(2)+1)}-\u{10FFFF}`),n(KS(US(`[${e}]`),t))}else n(KS(WS(US(vS.get(u)),l),t))}else if(c===`property`)mS.has(xx(u))||(e.key=`sc`);else if(c===`space`)n(GS(px(`space`,{negate:l}),t));else if(c===`word`)n(KS(WS(US(fS),l),t));else throw Error(`Unexpected character set kind "${c}"`)}},Directive({node:e,parent:t,root:n,remove:r,replaceWith:i,removeAllPrevSiblings:a,removeAllNextSiblings:o}){let{kind:s,flags:c}=e;if(s===`flags`){if(!c.enable&&!c.disable)r();else{let e=ox({flags:c});e.body[0].body=o(),i(KS(e,t),{traverse:!0})}}else if(s===`keep`){let e=n.body[0],r=n.body.length===1&&Lb(e,{type:`Group`})&&e.body[0].body.length===1?e.body[0]:n;if(t.parent!==r||r.body.length>1)throw Error(eS`Uses "\K" in a way that's unsupported`);let o=sx({behind:!0});o.body[0].body=a(),i(KS(o,t))}else throw Error(`Unexpected directive kind "${s}"`)},Flags({node:e,parent:t}){if(e.posixIsAscii)throw Error(`Unsupported flag "P"`);if(e.textSegmentMode===`word`)throw Error(`Unsupported flag "y{w}"`);[`digitIsAscii`,`extended`,`posixIsAscii`,`spaceIsAscii`,`wordIsAscii`,`textSegmentMode`].forEach(t=>delete e[t]),Object.assign(e,{global:!1,hasIndices:!1,multiline:!1,sticky:e.sticky??!1}),t.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:e}){if(!e.flags)return;let{enable:t,disable:n}=e.flags;t?.extended&&delete t.extended,n?.extended&&delete n.extended,t?.dotAll&&n?.dotAll&&delete t.dotAll,t?.ignoreCase&&n?.ignoreCase&&delete t.ignoreCase,t&&!Object.keys(t).length&&delete e.flags.enable,n&&!Object.keys(n).length&&delete e.flags.disable,!e.flags.enable&&!e.flags.disable&&delete e.flags},LookaroundAssertion({node:e},t){let{kind:n}=e;n===`lookbehind`&&(t.passedLookbehind=!0)},NamedCallout({node:e,parent:t,replaceWith:n}){let{kind:r}=e;if(r===`fail`)n(KS(sx({negate:!0}),t));else throw Error(`Unsupported named callout "(*${r.toUpperCase()}"`)},Quantifier({node:e}){if(e.body.type===`Quantifier`){let t=ox();t.body[0].body.push(e.body),e.body=KS(t,e)}},Regex:{enter({node:e},{supportedGNodes:t}){let n=[],r=!1,i=!1;for(let t of e.body)if(t.body.length===1&&t.body[0].kind===`search_start`)t.body.pop();else{let e=LS(t.body);e?(r=!0,Array.isArray(e)?n.push(...e):n.push(e)):i=!0}r&&!i&&n.forEach(e=>t.add(e))},exit(e,{accuracy:t,passedLookbehind:n,strategy:r}){if(t===`strict`&&n&&r)throw Error(eS`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n==`string`&&!HS(n)&&(n=NS(n,t),e.ref=n)}},TS={Backreference({node:e},{multiplexCapturesToLeftByRef:t,reffedNodesByReferencer:n}){let{orphan:r,ref:i}=e;r||n.set(e,[...t.get(i).map(({node:e})=>e)])},CapturingGroup:{enter({node:e,parent:t,replaceWith:n,skip:r},{groupOriginByCopy:i,groupsByName:a,multiplexCapturesToLeftByRef:o,openRefs:s,reffedNodesByReferencer:c}){let l=i.get(e);if(l&&s.has(e.number)){let r=GS(jS(e.number),t);c.set(r,s.get(e.number)),n(r);return}s.set(e.number,e),o.set(e.number,[]),e.name&&iS(o,e.name,[]);let u=o.get(e.name??e.number);for(let t=0;t<u.length;t++){let n=u[t];if(l===n.node||l&&l===n.origin||e===n.origin){u.splice(t,1);break}}if(o.get(e.number).push({node:e,origin:l}),e.name&&o.get(e.name).push({node:e,origin:l}),e.name){let t=iS(a,e.name,new Map),n=!1;if(l)n=!0;else for(let e of t.values())if(!e.hasDuplicateNameToRemove){n=!0;break}a.get(e.name).set(e,{node:e,hasDuplicateNameToRemove:n})}},exit({node:e},{openRefs:t}){t.get(e.number)===e&&t.delete(e.number)}},Group:{enter({node:e},t){t.prevFlags=t.currentFlags,e.flags&&(t.currentFlags=rS(t.currentFlags,e.flags))},exit(e,t){t.currentFlags=t.prevFlags}},Subroutine({node:e,parent:t,replaceWith:n},r){let{isRecursive:i,ref:a}=e;if(i){let n=t;for(;(n=n.parent)&&(n.type!==`CapturingGroup`||n.name!==a&&n.number!==a););r.reffedNodesByReferencer.set(e,n);return}let o=r.subroutineRefMap.get(a),s=a===0,c=s?jS(0):AS(o,r.groupOriginByCopy,null),l=c;if(!s){let e=PS(MS(o,e=>e.type===`Group`&&!!e.flags)),t=e?rS(r.globalFlags,e):r.globalFlags;OS(t,r.currentFlags)||(l=ox({flags:FS(t)}),l.body[0].body.push(c))}n(KS(l,t),{traverse:!s})}},ES={Backreference({node:e,parent:t,replaceWith:n},r){if(e.orphan){r.highestOrphanBackref=Math.max(r.highestOrphanBackref,e.ref);return}let i=r.reffedNodesByReferencer.get(e).filter(t=>kS(t,e));i.length?i.length>1?n(KS(ox({atomic:!0,body:i.reverse().map(e=>Xb({body:[Qb(e.number)]}))}),t)):e.ref=i[0].number:n(KS(sx({negate:!0}),t))},CapturingGroup({node:e},t){e.number=++t.numCapturesToLeft,e.name&&t.groupsByName.get(e.name).get(e).hasDuplicateNameToRemove&&delete e.name},Regex:{exit({node:e},t){let n=Math.max(t.highestOrphanBackref-t.numCapturesToLeft,0);for(let t=0;t<n;t++){let t=$b();e.body.at(-1).body.push(t)}}},Subroutine({node:e},t){e.isRecursive&&e.ref!==0&&(e.ref=t.reffedNodesByR Line truncated
`).flatMap(e=>i(e)):i(e);return{lines:a.map(e=>e.map(e=>({content:e.content,htmlStyle:e.htmlStyle}))),state:n.getLastGrammarState(a)}}}}function AC(e,t){let n=at(null);N(()=>Ge(t),(e,t,r)=>{if(typeof window>`u`)return;let i=!1;r(()=>i=!0),n.value=null,kC(e).then(e=>{i||(n.value=e)}).catch(()=>{})},{immediate:!0});let r={highlighter:null,text:``,lines:[]};return Y(()=>{let t=Ge(e),i=t.endsWith(`
\v\f…\u2028\u2029])`),t));else if(c===`posix`){if(!i&&(u===`graph`||u===`print`)){if(r===`strict`)throw Error(`POSIX class "${u}" requires min target ES2024 or non-strict accuracy`);let e={graph:`!-~`,print:` -~`}[u];l&&(e=`\0-${tb(e.codePointAt(0)-1)}${tb(e.codePointAt(2)+1)}-\u{10FFFF}`),n(Jb(Gb(`[${e}]`),t))}else n(Jb(Kb(Gb(bb.get(u)),l),t))}else if(c===`property`)gb.has(Cy(u))||(e.key=`sc`);else if(c===`space`)n(qb(hy(`space`,{negate:l}),t));else if(c===`word`)n(Jb(Kb(Gb(mb),l),t));else throw Error(`Unexpected character set kind "${c}"`)}},Directive({node:e,parent:t,root:n,remove:r,replaceWith:i,removeAllPrevSiblings:a,removeAllNextSiblings:o}){let{kind:s,flags:c}=e;if(s===`flags`){if(!c.enable&&!c.disable)r();else{let e=cy({flags:c});e.body[0].body=o(),i(Jb(e,t),{traverse:!0})}}else if(s===`keep`){let e=n.body[0],r=n.body.length===1&&zv(e,{type:`Group`})&&e.body[0].body.length===1?e.body[0]:n;if(t.parent!==r||r.body.length>1)throw Error(nb`Uses "\K" in a way that's unsupported`);let o=ly({behind:!0});o.body[0].body=a(),i(Jb(o,t))}else throw Error(`Unexpected directive kind "${s}"`)},Flags({node:e,parent:t}){if(e.posixIsAscii)throw Error(`Unsupported flag "P"`);if(e.textSegmentMode===`word`)throw Error(`Unsupported flag "y{w}"`);[`digitIsAscii`,`extended`,`posixIsAscii`,`spaceIsAscii`,`wordIsAscii`,`textSegmentMode`].forEach(t=>delete e[t]),Object.assign(e,{global:!1,hasIndices:!1,multiline:!1,sticky:e.sticky??!1}),t.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:e}){if(!e.flags)return;let{enable:t,disable:n}=e.flags;t?.extended&&delete t.extended,n?.extended&&delete n.extended,t?.dotAll&&n?.dotAll&&delete t.dotAll,t?.ignoreCase&&n?.ignoreCase&&delete t.ignoreCase,t&&!Object.keys(t).length&&delete e.flags.enable,n&&!Object.keys(n).length&&delete e.flags.disable,!e.flags.enable&&!e.flags.disable&&delete e.flags},LookaroundAssertion({node:e},t){let{kind:n}=e;n===`lookbehind`&&(t.passedLookbehind=!0)},NamedCallout({node:e,parent:t,replaceWith:n}){let{kind:r}=e;if(r===`fail`)n(Jb(ly({negate:!0}),t));else throw Error(`Unsupported named callout "(*${r.toUpperCase()}"`)},Quantifier({node:e}){if(e.body.type===`Quantifier`){let t=cy();t.body[0].body.push(e.body),e.body=Jb(t,e)}},Regex:{enter({node:e},{supportedGNodes:t}){let n=[],r=!1,i=!1;for(let t of e.body)if(t.body.length===1&&t.body[0].kind===`search_start`)t.body.pop();else{let e=zb(t.body);e?(r=!0,Array.isArray(e)?n.push(...e):n.push(e)):i=!0}r&&!i&&n.forEach(e=>t.add(e))},exit(e,{accuracy:t,passedLookbehind:n,strategy:r}){if(t===`strict`&&n&&r)throw Error(nb`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n==`string`&&!Wb(n)&&(n=Fb(n,t),e.ref=n)}},Db={Backreference({node:e},{multiplexCapturesToLeftByRef:t,reffedNodesByReferencer:n}){let{orphan:r,ref:i}=e;r||n.set(e,[...t.get(i).map(({node:e})=>e)])},CapturingGroup:{enter({node:e,parent:t,replaceWith:n,skip:r},{groupOriginByCopy:i,groupsByName:a,multiplexCapturesToLeftByRef:o,openRefs:s,reffedNodesByReferencer:c}){let l=i.get(e);if(l&&s.has(e.number)){let r=qb(Nb(e.number),t);c.set(r,s.get(e.number)),n(r);return}s.set(e.number,e),o.set(e.number,[]),e.name&&ob(o,e.name,[]);let u=o.get(e.name??e.number);for(let t=0;t<u.length;t++){let n=u[t];if(l===n.node||l&&l===n.origin||e===n.origin){u.splice(t,1);break}}if(o.get(e.number).push({node:e,origin:l}),e.name&&o.get(e.name).push({node:e,origin:l}),e.name){let t=ob(a,e.name,new Map),n=!1;if(l)n=!0;else for(let e of t.values())if(!e.hasDuplicateNameToRemove){n=!0;break}a.get(e.name).set(e,{node:e,hasDuplicateNameToRemove:n})}},exit({node:e},{openRefs:t}){t.get(e.number)===e&&t.delete(e.number)}},Group:{enter({node:e},t){t.prevFlags=t.currentFlags,e.flags&&(t.currentFlags=ab(t.currentFlags,e.flags))},exit(e,t){t.currentFlags=t.prevFlags}},Subroutine({node:e,parent:t,replaceWith:n},r){let{isRecursive:i,ref:a}=e;if(i){let n=t;for(;(n=n.parent)&&(n.type!==`CapturingGroup`||n.name!==a&&n.number!==a););r.reffedNodesByReferencer.set(e,n);return}let o=r.subroutineRefMap.get(a),s=a===0,c=s?Nb(0):Mb(o,r.groupOriginByCopy,null),l=c;if(!s){let e=Ib(Pb(o,e=>e.type===`Group`&&!!e.flags)),t=e?ab(r.globalFlags,e):r.globalFlags;Ab(t,r.currentFlags)||(l=cy({flags:Lb(t)}),l.body[0].body.push(c))}n(Jb(l,t),{traverse:!s})}},Ob={Backreference({node:e,parent:t,replaceWith:n},r){if(e.orphan){r.highestOrphanBackref=Math.max(r.highestOrphanBackref,e.ref);return}let i=r.reffedNodesByReferencer.get(e).filter(t=>jb(t,e));i.length?i.length>1?n(Jb(cy({atomic:!0,body:i.reverse().map(e=>Qv({body:[ey(e.number)]}))}),t)):e.ref=i[0].number:n(Jb(ly({negate:!0}),t))},CapturingGroup({node:e},t){e.number=++t.numCapturesToLeft,e.name&&t.groupsByName.get(e.name).get(e).hasDuplicateNameToRemove&&delete e.name},Regex:{exit({node:e},t){let n=Math.max(t.highestOrphanBackref-t.numCapturesToLeft,0);for(let t=0;t<n;t++){let t=ty();e.body.at(-1).body.push(t)}}},Subroutine({node:e},t){e.isRecursive&&e.ref!==0&&(e.ref=t.reffedNodesByR Line truncated
`).flatMap(e=>i(e)):i(e);return{lines:a.map(e=>e.map(e=>({content:e.content,htmlStyle:e.htmlStyle}))),state:n.getLastGrammarState(a)}}}}function jx(e,t){let n=Je(null);M(()=>Fe(t),(e,t,r)=>{if(typeof window>`u`)return;let i=!1;r(()=>i=!0),n.value=null,Ax(e).then(e=>{i||(n.value=e)}).catch(()=>{})},{immediate:!0});let r={highlighter:null,text:``,lines:[]};return J(()=>{let t=Fe(e),i=t.endsWith(`
`)?t.slice(0,-1):t,a=n.value;if(!a)return i.split(`
`).map(e=>e?[{content:e}]:[]);(r.highlighter!==a||!i.startsWith(r.text))&&(r={highlighter:a,text:``,lines:[]});let o=i.lastIndexOf(`
`)+1;if(o>r.text.length){let e=a.highlight(i.slice(r.text.length,o-1),r.state);r={highlighter:a,text:i.slice(0,o),lines:[...r.lines,...e.lines],state:e.state}}let s=a.highlight(i.slice(o),r.state).lines[0]??[];return[...r.lines,s]})}var jC=qe(`rounded-lg text-sm data-[size=sm]:text-xs has-[>[data-slot=code-block-content]:focus-visible]:ring-3 has-[>[data-slot=code-block-content]:focus-visible]:ring-ring/50 group/code-block relative flex w-full min-w-0 flex-col overflow-hidden`,{variants:{variant:{default:`border border-input text-foreground dark:bg-input/30 has-[>[data-slot=code-block-content]:focus-visible]:border-ring`,destructive:`border border-destructive/30 text-destructive dark:border-destructive/40`}},defaultVariants:{variant:`default`}}),MC=qe(`-mx-3 px-3 in-data-numbered:gap-x-3 before:min-w-6 before:text-end before:text-muted-foreground after:start-1 after:text-muted-foreground group-data-[size=sm]/code-block:-mx-2.5 group-data-[size=sm]/code-block:px-2.5 relative block min-h-lh after:absolute after:top-0 after:select-none in-data-numbered:col-span-2 in-data-numbered:grid in-data-numbered:grid-cols-subgrid in-data-numbered:[counter-increment:line] in-data-numbered:before:content-[counter(line)] in-data-numbered:before:select-none in-data-numbered:supports-[content:counter(line)_/_'']:before:content-[counter(line)_/_'']`,{variants:{variant:{default:``,added:`bg-muted after:content-['+']`,removed:`bg-destructive/10 after:text-destructive after:content-['−']`,highlighted:`bg-muted`}},defaultVariants:{variant:`default`}}),NC=P({__name:`Message`,props:{class:{type:[Boolean,null,String,Object,Array]},align:{default:`start`},asChild:{type:Boolean},as:{default:`div`}},setup(e){let t=e;return(n,r)=>(L(),q(V(dt),{"data-slot":`message`,"data-align":e.align,as:e.as,"as-child":e.asChild,class:z(V(W)(`text-sm gap-2 group/message relative flex w-full min-w-0 data-[align=end]:flex-row-reverse`,t.class))},{default:I(()=>[K(n.$slots,`default`)]),_:3},8,[`data-align`,`as`,`as-child`,`class`]))}}),PC=P({__name:`MessageContent`,props:{class:{type:[Boolean,null,String,Object,Array]},asChild:{type:Boolean},as:{default:`div`}},setup(e){let t=e;return(n,r)=>(L(),q(V(dt),{"data-slot":`message-content`,as:e.as,"as-child":e.asChild,class:z(V(W)(`gap-2.5 group-data-[align=end]/message:*:data-slot:self-end flex w-full min-w-0 flex-col wrap-break-word`,t.class))},{default:I(()=>[K(n.$slots,`default`)]),_:3},8,[`as`,`as-child`,`class`]))}}),FC=P({__name:`MessageFooter`,props:{class:{type:[Boolean,null,String,Object,Array]},asChild:{type:Boolean},as:{default:`div`}},setup(e){let t=e;return(n,r)=>(L(),q(V(dt),{"data-slot":`message-footer`,as:e.as,"as-child":e.asChild,class:z(V(W)(`text-xs font-medium text-muted-foreground px-3 group-has-data-[variant=ghost]/message:px-0 flex max-w-full min-w-0 items-center group-data-[align=end]/message:justify-end`,t.class))},{default:I(()=>[K(n.$slots,`default`)]),_:3},8,[`as`,`as-child`,`class`]))}});function IC(e){switch(e.type){case`image`:return`[photo]`;case`video`:return`[video]`;case`audio`:return`[audio]`;case`document`:return e.file_name?`[document: ${e.file_name}]`:`[document]`;default:return`[${e.type||`attachment`}]`}}function LC(e){let t=[];return e.mime_type&&t.push(e.mime_type),e.file_name&&t.push(e.file_name),e.file_size!==void 0&&t.push(`${e.file_size} bytes`),e.width&&e.height&&t.push(`${e.width}×${e.height}`),e.duration!==void 0&&t.push(`${e.duration} s`),t.join(` · `)}var RC={class:`truncate`},zC=P({__name:`ChatAttachment`,props:{attachment:{}},setup(e){return(t,n)=>(L(),q(_e(e.attachment.url?`a`:`span`),{href:e.attachment.url,target:e.attachment.url?`_blank`:void 0,rel:e.attachment.url?`noopener noreferrer`:void 0,title:V(LC)(e.attachment),class:`inline-flex max-w-full items-center gap-1.5 rounded-md border border-border bg-muted px-2.5 py-1 text-xs font-medium text-fg-muted`},{default:I(()=>[A(V(pte),{"aria-hidden":`true`,class:`size-3.5 shrink-0`}),R(`span`,RC,B(V(IC)(e.attachment)),1)]),_:1},8,[`href`,`target`,`rel`,`title`]))}}),BC=P({__name:`CodeView`,props:{code:{},lang:{},class:{}},setup(e){let t=e,n=AC(()=>t.code,()=>t.lang||`text`);return(r,i)=>(L(),q(V(mm),{class:z(V(W)(`bg-muted`,t.class))},{default:I(()=>[A(V(hm),null,{default:I(()=>[A(V(xm),{value:e.code},null,8,[`value`])]),_:1}),A(V(ym),{wrap:``,class:`max-h-[60vh] pe-10 text-xs`},{default:I(()=>[(L(!0),j(U,null,M(V(n),(e,t)=>(L(),q(V(vm),{key:t},{default:I(()=>[(L(!0),j(U,null,M(e,(e,t)=>(L(),q(V(Sm),{key:t,token:e},null,8,[`token`]))),128))]),_:2},1024))),128))]),_:1})]),_:1},8,[`class`]))}}),VC=[`src`,`alt`],HC={key:1},UC={key:2},WC={key:3,class:`rounded bg-foreground/10 px-1 py-0.5 font-mono text-[0.9em]`},GC=[`href`],KC={key:5},qC=P({__name:`ChatInline`,props:{inline:{}},setup(e){return(t,n)=>(L(!0),j(U,null,M(e.inline,(e,t)=>(L(),j(U,{key:t},[e.kind===`image`?(L(),j(`img`,{key:0,src:e.src,alt:e.alt,loading:`lazy`,class:`my-1 block max-h-96 max-w-full cursor-pointer rounded-md border border-border bgLine truncated
`),r=[],i=null,a=null,o=``,s=()=>{r.length&&(t.push({kind:`p`,inline:YC(r.join(` `))}),r=[])},c=()=>{i&&=(t.push({kind:i.tag,items:i.items.map(e=>YC(e))}),null)};for(let e=0;e<n.length;e++){let l=n[e];if(l.startsWith("```")){s(),c(),a?(t.push({kind:`pre`,code:a.join(`
`),lang:o}),a=null):(a=[],o=l.slice(3).trim().split(/\s/)[0]);continue}if(a){a.push(l);continue}let u=ZC(l),d=e+1<n.length?ZC(n[e+1]):null;if(u&&d&&QC(d)&&u.length===d.length){s(),c();let r=[];for(e+=2;e<n.length;e++){let t=ZC(n[e]);if(!t||t.length!==u.length){e--;break}r.push(t)}t.push({kind:`table`,head:u.map(e=>YC(e)),rows:r.map(e=>e.map(e=>YC(e)))});continue}if(!l.trim()){s(),c();continue}let f=l.match(/^(#{1,3})\s+(.+)$/);if(f){s(),c(),t.push({kind:`h${f[1].length}`,inline:YC(f[2])});continue}let p=l.match(/^\s*[-*]\s+(.+)$/),m=l.match(/^\s*\d+[.)]\s+(.+)$/);if(p||m){s();let e=m?`ol`:`ul`;(!i||i.tag!==e)&&(c(),i={tag:e,items:[]}),i.items.push((p||m)[1])}else l.startsWith(`>`)?(s(),c(),t.push({kind:`blockquote`,inline:YC(l.replace(/^>\s?/,``))})):r.push(l)}return s(),c(),a&&t.push({kind:`pre`,code:a.join(`
`),lang:o}),t}function ZC(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 QC(e){return e.every(e=>/^:?-{3,}:?$/.test(e))}var $C={class:`[overflow-wrap:anywhere]`},ew={key:1,class:`my-3 w-full border-collapse text-[0.92em]`},tw={key:2,class:`my-2 border-l-[3px] border-primary pl-3 text-fg-muted`},nw={key:3,class:`mt-1 mb-2 text-xl leading-tight font-semibold tracking-[-0.02em]`},rw={key:4,class:`mt-1 mb-2 text-lg leading-tight font-semibold tracking-[-0.02em]`},iw={key:5,class:`mt-1 mb-2 text-base leading-tight font-semibold tracking-[-0.02em]`},aw={key:6,class:`my-2.5 flex list-disc flex-col gap-1 pl-5`},ow={key:7,class:`my-2.5 flex list-decimal flex-col gap-1 pl-5`},Jte={key:8,class:`mb-2.5 last:mb-0`},sw=P({__name:`ChatMarkdown`,props:{text:{}},setup(e){let t=e,n=Y(()=>XC(t.text));return(e,t)=>(L(),j(`div`,$C,[(L(!0),j(U,null,M(n.value,(e,t)=>(L(),j(U,{key:t},[e.kind===`pre`?(L(),q(BC,{key:0,code:e.code,lang:e.lang,class:`my-2`},null,8,[`code`,`lang`])):e.kind===`table`?(L(),j(`table`,ew,[R(`thead`,null,[R(`tr`,null,[(L(!0),j(U,null,M(e.head,(e,t)=>(L(),j(`th`,{key:t,class:`border border-border bg-muted px-2 py-1.5 text-left font-semibold`},[A(qC,{inline:e},null,8,[`inline`])]))),128))])]),R(`tbody`,null,[(L(!0),j(U,null,M(e.rows,(e,t)=>(L(),j(`tr`,{key:t},[(L(!0),j(U,null,M(e,(e,t)=>(L(),j(`td`,{key:t,class:`border border-border px-2 py-1.5 text-left`},[A(qC,{inline:e},null,8,[`inline`])]))),128))]))),128))])])):e.kind===`blockquote`?(L(),j(`blockquote`,tw,[A(qC,{inline:e.inline},null,8,[`inline`])])):e.kind===`h1`?(L(),j(`h1`,nw,[A(qC,{inline:e.inline},null,8,[`inline`])])):e.kind===`h2`?(L(),j(`h2`,rw,[A(qC,{inline:e.inline},null,8,[`inline`])])):e.kind===`h3`?(L(),j(`h3`,iw,[A(qC,{inline:e.inline},null,8,[`inline`])])):e.kind===`ul`?(L(),j(`ul`,aw,[(L(!0),j(U,null,M(e.items,(e,t)=>(L(),j(`li`,{key:t},[A(qC,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`ol`?(L(),j(`ol`,ow,[(L(!0),j(U,null,M(e.items,(e,t)=>(L(),j(`li`,{key:t},[A(qC,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`p`?(L(),j(`p`,Jte,[A(qC,{inline:e.inline},null,8,[`inline`])])):F(``,!0)],64))),128))]))}}),Yte={class:`truncate`},Xte=P({__name:`ChatNavChip`,props:{path:{},label:{}},setup(e){return(t,n)=>{let r=Me(`RouterLink`);return L(),q(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:I(()=>[A(V(jl),{"aria-hidden":`true`,class:`size-3.5 shrink-0`}),R(`span`,Yte,B(e.label||e.path),1)]),_:1},8,[`to`,`title`])}}}),Zte={class:`font-mono text-foreground`},Qte={key:0,class:`shrink-0 text-xs tabular-nums`},$te={class:`font-mono text-foreground`},ene={key:0,class:`shrink-0 text-xs tabular-nums`},cw=P({__name:`ChatToolCall`,props:{tool:{},streaming:{type:Boolean}},setup(e){let t=e,n=Y(()=>t.tool.name||t.tool.Name||t.tool.tool||`tool`),r=Y(()=>t.tool.parameters||t.tool.Parameters||``),i=Y(()=>!!(t.tool.err||t.tool.Err||t.tool.failed)),a=Y(()=>t.tool.summary||t.tool.Summary||t.tool.text||t.tool.err||t.tool.Err||``),o=Y(()=>!a.value&&!i.value&&!!t.streaming),s=Y(()=>{let e=t.tool.duration_ms;return e?e<1e3?`${e}ms`:`${(e/1e3).toFixed(+(e<1e4))}s`:``}),c=Y(()=>{try{let e=JSON.parse(r.value);if(e&&typeof e==`object`&&!Array.isArray(e)){let t=Object.values(e).find(e=>typeof e==`string`&&e);return typeof t==`string`?t.split(`
`)+1;if(o>r.text.length){let e=a.highlight(i.slice(r.text.length,o-1),r.state);r={highlighter:a,text:i.slice(0,o),lines:[...r.lines,...e.lines],state:e.state}}let s=a.highlight(i.slice(o),r.state).lines[0]??[];return[...r.lines,s]})}var Mx=Le(`rounded-lg text-sm data-[size=sm]:text-xs has-[>[data-slot=code-block-content]:focus-visible]:ring-3 has-[>[data-slot=code-block-content]:focus-visible]:ring-ring/50 group/code-block relative flex w-full min-w-0 flex-col overflow-hidden`,{variants:{variant:{default:`border border-input text-foreground dark:bg-input/30 has-[>[data-slot=code-block-content]:focus-visible]:border-ring`,destructive:`border border-destructive/30 text-destructive dark:border-destructive/40`}},defaultVariants:{variant:`default`}}),Nx=Le(`-mx-3 px-3 in-data-numbered:gap-x-3 before:min-w-6 before:text-end before:text-muted-foreground after:start-1 after:text-muted-foreground group-data-[size=sm]/code-block:-mx-2.5 group-data-[size=sm]/code-block:px-2.5 relative block min-h-lh after:absolute after:top-0 after:select-none in-data-numbered:col-span-2 in-data-numbered:grid in-data-numbered:grid-cols-subgrid in-data-numbered:[counter-increment:line] in-data-numbered:before:content-[counter(line)] in-data-numbered:before:select-none in-data-numbered:supports-[content:counter(line)_/_'']:before:content-[counter(line)_/_'']`,{variants:{variant:{default:``,added:`bg-muted after:content-['+']`,removed:`bg-destructive/10 after:text-destructive after:content-['−']`,highlighted:`bg-muted`}},defaultVariants:{variant:`default`}}),Px=N({__name:`Message`,props:{class:{type:[Boolean,null,String,Object,Array]},align:{default:`start`},asChild:{type:Boolean},as:{default:`div`}},setup(e){let t=e;return(n,r)=>(I(),K(B(et),{"data-slot":`message`,"data-align":e.align,as:e.as,"as-child":e.asChild,class:R(B(U)(`text-sm gap-2 group/message relative flex w-full min-w-0 data-[align=end]:flex-row-reverse`,t.class))},{default:F(()=>[G(n.$slots,`default`)]),_:3},8,[`data-align`,`as`,`as-child`,`class`]))}}),Fx=N({__name:`MessageContent`,props:{class:{type:[Boolean,null,String,Object,Array]},asChild:{type:Boolean},as:{default:`div`}},setup(e){let t=e;return(n,r)=>(I(),K(B(et),{"data-slot":`message-content`,as:e.as,"as-child":e.asChild,class:R(B(U)(`gap-2.5 group-data-[align=end]/message:*:data-slot:self-end flex w-full min-w-0 flex-col wrap-break-word`,t.class))},{default:F(()=>[G(n.$slots,`default`)]),_:3},8,[`as`,`as-child`,`class`]))}}),Ix=N({__name:`MessageFooter`,props:{class:{type:[Boolean,null,String,Object,Array]},asChild:{type:Boolean},as:{default:`div`}},setup(e){let t=e;return(n,r)=>(I(),K(B(et),{"data-slot":`message-footer`,as:e.as,"as-child":e.asChild,class:R(B(U)(`text-xs font-medium text-muted-foreground px-3 group-has-data-[variant=ghost]/message:px-0 flex max-w-full min-w-0 items-center group-data-[align=end]/message:justify-end`,t.class))},{default:F(()=>[G(n.$slots,`default`)]),_:3},8,[`as`,`as-child`,`class`]))}});function Lx(e){switch(e.type){case`image`:return`[photo]`;case`video`:return`[video]`;case`audio`:return`[audio]`;case`document`:return e.file_name?`[document: ${e.file_name}]`:`[document]`;default:return`[${e.type||`attachment`}]`}}function Rx(e){let t=[];return e.mime_type&&t.push(e.mime_type),e.file_name&&t.push(e.file_name),e.file_size!==void 0&&t.push(`${e.file_size} bytes`),e.width&&e.height&&t.push(`${e.width}×${e.height}`),e.duration!==void 0&&t.push(`${e.duration} s`),t.join(` · `)}var zx={class:`truncate`},Bx=N({__name:`ChatAttachment`,props:{attachment:{}},setup(e){return(t,n)=>(I(),K(j(e.attachment.url?`a`:`span`),{href:e.attachment.url,target:e.attachment.url?`_blank`:void 0,rel:e.attachment.url?`noopener noreferrer`:void 0,title:B(Rx)(e.attachment),class:`inline-flex max-w-full items-center gap-1.5 rounded-md border border-border bg-muted px-2.5 py-1 text-xs font-medium text-fg-muted`},{default:F(()=>[O(B(sl),{"aria-hidden":`true`,class:`size-3.5 shrink-0`}),L(`span`,zx,z(B(Lx)(e.attachment)),1)]),_:1},8,[`href`,`target`,`rel`,`title`]))}}),Vx=N({__name:`CodeView`,props:{code:{},lang:{},class:{}},setup(e){let t=e,n=jx(()=>t.code,()=>t.lang||`text`);return(r,i)=>(I(),K(B(_f),{class:R(B(U)(`bg-muted`,t.class))},{default:F(()=>[O(B(vf),null,{default:F(()=>[O(B(wf),{value:e.code},null,8,[`value`])]),_:1}),O(B(Sf),{wrap:``,class:`max-h-[60vh] pe-10 text-xs`},{default:F(()=>[(I(!0),k(H,null,A(B(n),(e,t)=>(I(),K(B(xf),{key:t},{default:F(()=>[(I(!0),k(H,null,A(e,(e,t)=>(I(),K(B(Tf),{key:t,token:e},null,8,[`token`]))),128))]),_:2},1024))),128))]),_:1})]),_:1},8,[`class`]))}}),Hx=[`src`,`alt`],Ux={key:1},Wx={key:2},Gx={key:3,class:`rounded bg-foreground/10 px-1 py-0.5 font-mono text-[0.9em]`},Kx=[`href`],qx={key:5},Jx=N({__name:`ChatInline`,props:{inline:{}},setup(e){return(t,n)=>(I(!0),k(H,null,A(e.inline,(e,t)=>(I(),k(H,{key:t},[e.kind===`image`?(I(),k(`img`,{key:0,src:e.src,alt:e.alt,loading:`lazy`,class:`my-1 block max-h-96 max-w-full cursor-pointer rounded-md border border-border bg-cLine truncated
`),r=[],i=null,a=null,o=``,s=()=>{r.length&&(t.push({kind:`p`,inline:Xx(r.join(` `))}),r=[])},c=()=>{i&&=(t.push({kind:i.tag,items:i.items.map(e=>Xx(e))}),null)};for(let e=0;e<n.length;e++){let l=n[e];if(l.startsWith("```")){s(),c(),a?(t.push({kind:`pre`,code:a.join(`
`),lang:o}),a=null):(a=[],o=l.slice(3).trim().split(/\s/)[0]);continue}if(a){a.push(l);continue}let u=Qx(l),d=e+1<n.length?Qx(n[e+1]):null;if(u&&d&&$x(d)&&u.length===d.length){s(),c();let r=[];for(e+=2;e<n.length;e++){let t=Qx(n[e]);if(!t||t.length!==u.length){e--;break}r.push(t)}t.push({kind:`table`,head:u.map(e=>Xx(e)),rows:r.map(e=>e.map(e=>Xx(e)))});continue}if(!l.trim()){s(),c();continue}let f=l.match(/^(#{1,3})\s+(.+)$/);if(f){s(),c(),t.push({kind:`h${f[1].length}`,inline:Xx(f[2])});continue}let p=l.match(/^\s*[-*]\s+(.+)$/),m=l.match(/^\s*\d+[.)]\s+(.+)$/);if(p||m){s();let e=m?`ol`:`ul`;(!i||i.tag!==e)&&(c(),i={tag:e,items:[]}),i.items.push((p||m)[1])}else l.startsWith(`>`)?(s(),c(),t.push({kind:`blockquote`,inline:Xx(l.replace(/^>\s?/,``))})):r.push(l)}return s(),c(),a&&t.push({kind:`pre`,code:a.join(`
`),lang:o}),t}function Qx(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 $x(e){return e.every(e=>/^:?-{3,}:?$/.test(e))}var eS={class:`[overflow-wrap:anywhere]`},tS={key:1,class:`my-3 w-full border-collapse text-[0.92em]`},nS={key:2,class:`my-2 border-l-[3px] border-primary pl-3 text-fg-muted`},rS={key:3,class:`mt-1 mb-2 text-xl leading-tight font-semibold tracking-[-0.02em]`},iS={key:4,class:`mt-1 mb-2 text-lg leading-tight font-semibold tracking-[-0.02em]`},aS={key:5,class:`mt-1 mb-2 text-base leading-tight font-semibold tracking-[-0.02em]`},oS={key:6,class:`my-2.5 flex list-disc flex-col gap-1 pl-5`},sS={key:7,class:`my-2.5 flex list-decimal flex-col gap-1 pl-5`},cS={key:8,class:`mb-2.5 last:mb-0`},lS=N({__name:`ChatMarkdown`,props:{text:{}},setup(e){let t=e,n=J(()=>Zx(t.text));return(e,t)=>(I(),k(`div`,eS,[(I(!0),k(H,null,A(n.value,(e,t)=>(I(),k(H,{key:t},[e.kind===`pre`?(I(),K(Vx,{key:0,code:e.code,lang:e.lang,class:`my-2`},null,8,[`code`,`lang`])):e.kind===`table`?(I(),k(`table`,tS,[L(`thead`,null,[L(`tr`,null,[(I(!0),k(H,null,A(e.head,(e,t)=>(I(),k(`th`,{key:t,class:`border border-border bg-muted px-2 py-1.5 text-left font-semibold`},[O(Jx,{inline:e},null,8,[`inline`])]))),128))])]),L(`tbody`,null,[(I(!0),k(H,null,A(e.rows,(e,t)=>(I(),k(`tr`,{key:t},[(I(!0),k(H,null,A(e,(e,t)=>(I(),k(`td`,{key:t,class:`border border-border px-2 py-1.5 text-left`},[O(Jx,{inline:e},null,8,[`inline`])]))),128))]))),128))])])):e.kind===`blockquote`?(I(),k(`blockquote`,nS,[O(Jx,{inline:e.inline},null,8,[`inline`])])):e.kind===`h1`?(I(),k(`h1`,rS,[O(Jx,{inline:e.inline},null,8,[`inline`])])):e.kind===`h2`?(I(),k(`h2`,iS,[O(Jx,{inline:e.inline},null,8,[`inline`])])):e.kind===`h3`?(I(),k(`h3`,aS,[O(Jx,{inline:e.inline},null,8,[`inline`])])):e.kind===`ul`?(I(),k(`ul`,oS,[(I(!0),k(H,null,A(e.items,(e,t)=>(I(),k(`li`,{key:t},[O(Jx,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`ol`?(I(),k(`ol`,sS,[(I(!0),k(H,null,A(e.items,(e,t)=>(I(),k(`li`,{key:t},[O(Jx,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`p`?(I(),k(`p`,cS,[O(Jx,{inline:e.inline},null,8,[`inline`])])):P(``,!0)],64))),128))]))}}),uS={class:`truncate`},dS=N({__name:`ChatNavChip`,props:{path:{},label:{}},setup(e){return(t,n)=>{let r=Ce(`RouterLink`);return I(),K(r,{to:e.path,title:`Go to ${e.label||e.path}`,class:`inline-flex max-w-full items-center gap-1.5 rounded-md border border-primary/45 bg-primary-soft px-2.5 py-1 text-xs font-semibold text-link transition-colors hover:border-primary hover:bg-primary/15 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary`},{default:F(()=>[O(B(gc),{"aria-hidden":`true`,class:`size-3.5 shrink-0`}),L(`span`,uS,z(e.label||e.path),1)]),_:1},8,[`to`,`title`])}}}),fS={class:`font-mono text-foreground`},pS={key:0,class:`shrink-0 text-xs tabular-nums`},mS={class:`font-mono text-foreground`},hS={key:0,class:`shrink-0 text-xs tabular-nums`},gS=N({__name:`ChatToolCall`,props:{tool:{},streaming:{type:Boolean}},setup(e){let t=e,n=J(()=>t.tool.name||t.tool.Name||t.tool.tool||`tool`),r=J(()=>t.tool.parameters||t.tool.Parameters||``),i=J(()=>!!(t.tool.err||t.tool.Err||t.tool.failed)),a=J(()=>t.tool.summary||t.tool.Summary||t.tool.text||t.tool.err||t.tool.Err||``),o=J(()=>!a.value&&!i.value&&!!t.streaming),s=J(()=>{let e=t.tool.duration_ms;return e?e<1e3?`${e}ms`:`${(e/1e3).toFixed(+(e<1e4))}s`:``}),c=J(()=>{try{let e=JSON.parse(r.value);if(e&&typeof e==`object`&&!Array.isArray(e)){let t=Object.values(e).find(e=>typeof e==`string`&&e);return typeof t==`string`?t.split(`
`,1)[0]:Object.entries(e).map(([e,t])=>`${e}: ${typeof t==`object`?JSON.stringify(t):t}`).join(`, `)}}catch{}return r.value.split(`
`,1)[0]}),l=Y(()=>[r.value&&`> ${r.value}`,a.value].filter(Boolean).join(`
`,1)[0]}),l=J(()=>[r.value&&`> ${r.value}`,a.value].filter(Boolean).join(`
`));return(t,r)=>e.tool.path?(L(),q(Xte,{key:0,path:e.tool.path,label:e.tool.label},null,8,[`path`,`label`])):l.value?(L(),q(V(om),{key:1,"default-open":i.value},{default:I(()=>[A(V(lm),null,{default:I(()=>[A(V(dm),{status:i.value?`error`:o.value?`running`:void 0},{default:I(()=>[A(V(cm),null,{default:I(()=>[i.value?(L(),q(V(Kl),{key:0})):o.value?(L(),q(V(mu),{key:1,class:`animate-spin`})):(L(),q(V(Hl),{key:2,class:`text-success`}))]),_:1}),R(`span`,Zte,B(n.value),1),A(V(fm),{class:`font-mono text-xs`},{default:I(()=>[H(B(c.value),1)]),_:1}),s.value?(L(),j(`span`,Qte,B(s.value),1)):F(``,!0)]),_:1},8,[`status`])]),_:1}),A(V(sm),null,{default:I(()=>[A(V(mm),{size:`sm`},{default:I(()=>[A(V(ym),{wrap:``,class:`max-h-64`},{default:I(()=>[H(B(l.value),1)]),_:1})]),_:1})]),_:1})]),_:1},8,[`default-open`])):(L(),q(V(dm),{key:2,status:i.value?`error`:o.value?`running`:void 0},{default:I(()=>[A(V(cm),null,{default:I(()=>[i.value?(L(),q(V(Kl),{key:0})):o.value?(L(),q(V(mu),{key:1,class:`animate-spin`})):(L(),q(V(Hl),{key:2,class:`text-success`}))]),_:1}),R(`span`,$te,B(n.value),1),A(V(fm),{class:`font-mono text-xs`},{default:I(()=>[H(B(c.value),1)]),_:1}),s.value?(L(),j(`span`,ene,B(s.value),1)):F(``,!0)]),_:1},8,[`status`]))}}),tne={class:`flex flex-col gap-1.5`},nne=P({__name:`ChatToolGroup`,props:{tools:{},streaming:{type:Boolean}},setup(e){let t=e,n=e=>!!(e.err||e.Err||e.failed),r=Y(()=>t.tools.some(n)),i=Y(()=>`${t.tools.length} tool call${t.tools.length===1?``:`s`}`);return(t,n)=>(L(),q(V(om),{"default-open":r.value},{default:I(()=>[A(V(lm),null,{default:I(()=>[A(V(dm),{status:r.value?`error`:void 0},{default:I(()=>[A(V(cm),null,{default:I(()=>[A(V(Dte))]),_:1}),A(V(fm),{class:`truncate`},{default:I(()=>[H(B(i.value),1)]),_:1})]),_:1},8,[`status`])]),_:1}),A(V(sm),null,{default:I(()=>[R(`div`,tne,[(L(!0),j(U,null,M(e.tools,(t,n)=>(L(),q(cw,{key:n,tool:t,streaming:e.streaming&&n===e.tools.length-1},null,8,[`tool`,`streaming`]))),128))])]),_:1})]),_:1},8,[`default-open`]))}}),rne={key:0,class:`mb-2 flex flex-wrap gap-1.5`},ine={key:2,class:`whitespace-pre-wrap`},ane=P({__name:`ChatBubble`,props:{text:{},tools:{default:()=>[]},media:{default:()=>[]},assistant:{type:Boolean,default:!1},streaming:{type:Boolean,default:!1}},setup(e){let t=e,n=Y(()=>{let e=Array.from(t.text),n=[],r=0,i=!1;for(let a of t.tools){let t=Math.min(Math.max(a.text_offset??0,r),e.length);t>r&&(n.push({text:e.slice(r,t).join(``)}),r=t,i=!1);let o=n[n.length-1];!a.path&&i&&o&&`tools`in o?o.tools.push(a):(n.push({tools:[a]}),i=!a.path)}return r<e.length&&n.push({text:e.slice(r).join(``)}),n});return(t,r)=>(L(),q(V(NC),{align:e.assistant?`start`:`end`},{default:I(()=>[A(V(PC),null,{default:I(()=>[A(V($p),{variant:e.assistant?`muted`:`tinted`,class:`max-w-[min(78ch,92%)]`},{default:I(()=>[A(V(em),{class:`[overflow-wrap:anywhere]`},{default:I(()=>[e.media.length?(L(),j(`div`,rne,[(L(!0),j(U,null,M(e.media,(e,t)=>(L(),q(zC,{key:t,attachment:e},null,8,[`attachment`]))),128))])):F(``,!0),e.assistant?(L(!0),j(U,{key:1},M(n.value,(t,r)=>(L(),j(U,{key:r},[`text`in t?(L(),q(sw,{key:0,text:t.text},null,8,[`text`])):(L(),q(V(nm),{key:1,class:`my-2`},{default:I(()=>[t.tools.length>1?(L(),q(nne,{key:0,tools:t.tools,streaming:e.streaming&&r===n.value.length-1},null,8,[`tools`,`streaming`])):(L(),q(cw,{key:1,tool:t.tools[0],streaming:e.streaming&&r===n.value.length-1},null,8,[`tool`,`streaming`]))]),_:2},1024))],64))),128)):(L(),j(`div`,ine,B(e.text),1)),K(t.$slots,`default`)]),_:3})]),_:3},8,[`variant`]),e.assistant&&!e.streaming&&e.text?(L(),q(V(FC),{key:0,class:`px-0 transition-opacity focus-within:opacity-100 [@media(hover:hover)]:opacity-0 [@media(hover:hover)]:group-hover/message:opacity-100`},{default:I(()=>[A(V(xm),{value:e.text},null,8,[`value`])]),_:1})):F(``,!0)]),_:3})]),_:3},8,[`align`]))}}),one={class:`text-sm`},sne={key:0,class:`mt-1 text-fg-muted`},cne={key:1,class:`mt-2 flex flex-wrap gap-2`},lne=P({__name:`ChatChooseCard`,props:{choose:{}},setup(e){let t=Y(()=>id.value.models??[]);return(e,n)=>(L(),j(`div`,one,[n[0]||=R(`p`,{class:`font-medium`},`Choose a model`,-1),t.value.length?(L(),j(`div`,cne,[(L(!0),j(U,null,M(t.value,e=>(L(),q(V(X),{key:e,size:`sm`,variant:e===V(id).active_model?`default`:`outline`,class:`font-mono`,onClick:t=>void V(vd)(e)},{default:I(()=>[H(B(e),1)]),_:2},1032,[`variant`,`onClick`]))),128))])):(L(),j(`p`,sne,`None configured.`))]))}}),une={class:`text-sm`},dne={key:0},fne={class:`mt-1 space-y-0.5`},pne={class:`font-mono`},mne=[`href`],hne={key:0,class:`mt-3 flex gap-2`},gne={key:1,class:`mt-2 text-fg-muted`},_ne={key:2,class:`mt-2 text-fg-muted`},vne={key:3,class:`mt-2 text-ok`},yne={key:4,class:`mt-2 text-danger`},bne={key:5,class:`mt-2 text-xs text-fg-muted`},xne=P({__name:`ChatUpdateCard`,props:{update:{}},setup(e){let t=e,n=Y(()=>t.update.available??[]),r=J(`idle`),i=J(``);async function a(){r.value=`installing`;try{let e=(await Z.updateInstall(t.update.snapshot)).result?.installed;i.value=e?Object.entries(e).map( Line truncated
`).map(e=>e.trim()).find(Boolean)||``,i=r.length>FT?`${r.slice(0,FT).trimEnd()}…`:r;return{text:i,full:n,truncated:i!==n}}function gie(e){return String(e||`event`).replaceAll(`_`,` `).replace(/\b\w/g,e=>e.toUpperCase())}function LT(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 RT(e){let t=Number(e);return!Number.isFinite(t)||t<=0?``:t.toLocaleString(`en-US`)}function zT(e){return typeof e==`string`?e:``}function BT(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=[r,LT(t.duration_ms)].filter(Boolean).join(` · `);return{title:t.interrupted?`Stage interrupted: ${n}`:t.skipped?`Skipped stage: ${n}`:t.error?`Stage failed: ${n}`:`Finished stage: ${n}`,detail:[e,zT(t.error),zT(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:[zT(t.previous_stage)&&`after ${zT(t.previous_stage)}`,zT(t.previous_reason)].filter(Boolean).join(`: `)||e.detail||``}}if(e.kind===`agent_finish`){let r=RT(t.iterations),i=RT(t.tokens),a=Number(t.cached_tokens)||0,o=RT((Number(t.prompt_tokens)||0)-a),s=RT(t.completion_tokens),c=RT(t.cached_tokens),l=[r&&`${r} iterations`,i&&`${i} tokens`,o&&`${o} fresh prompt`,s&&`${s} completion`,c&&`${c} cached`,zT(t.model)].filter(Boolean);return{title:`Agent ${zT(t.status)||`finished`}: ${n}`,detail:l.join(` · `)||e.detail||``}}if(e.kind===`remediation_round`){let e=Number(t.of),n=zT(t.author);return{title:`Remediation ${zT(t.round)}${e>0?` of ${e}`:``}`,detail:[n&&`answers ${n}'s review`,t.review_id?`#${zT(t.review_id)}`:``].filter(Boolean).join(` `)}}if(e.kind===`review_approved`){let e=zT(t.pr_number);return{title:`Pull request approved`,detail:[zT(t.author),e&&`#${e}`].filter(Boolean).join(` · `)}}if(e.kind===`step_retried`)return{title:`Attempt ${zT(t.attempt)} of ${zT(t.of)} failed: ${e.stage||`step`}`,detail:zT(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=zT(t.source),n=zT(t.capture_id),r=[{label:`binding ${zT(t.binding_name)||zT(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 ${zT(t.captured_after)}`:``].filter(Boolean).join(` · `)}}return{title:gie(e.kind||e.type),detail:e.detail||``}}var _ie=[`title`],VT=P({__name:`ActivityRow`,props:{event:{}},emits:[`open`],setup(e,{emit:t}){let n=PT();n.watchIdentities();let r=e,i=t,a=ST(),o=Y(()=>a.taskIDFor(r.event)),s=Y(()=>IT(r.event,n.identityName));function c(){o.value>0&&i(`open`,o.value)}return(t,n)=>(L(),q(V(AT),{class:z(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:[gt(pt(c,[`prevent`]),[`enter`]),gt(pt(c,[`prevent`]),[`space`])]},{default:I(()=>[A(V(kT),{class:`font-medium`},{default:I(()=>[H(B(V(BT)({...r.event,at:void 0,detail:void 0}).title),1)]),_:1}),A(V(kT),{class:`font-mono`},{default:I(()=>[H(B(o.value>0?`#${o.value}`:`–`),1)]),_:1}),A(V(kT),{class:`w-[55%] max-w-0`},{default:I(()=>[R(`span`,{class:`block truncate`,title:s.value.truncated?s.value.full:void 0},B(s.value.text),9,_ie)]),_:1}),A(V(kT),null,{default:I(()=>[A(V(fw),{at:e.event.at},null,8,[`at`])]),_:1})]),_:1},8,[`class`,`role`,`tabindex`,`title`,`onKeydown`]))}}),vie=[{value:`all`,label:`All`},{value:`tasks`,label:`Tasks`},{value:`system`,label:`System`}];function HT(e){return(Number(e?.task_id)||0)>0}function yie(e,t){return t===`tasks`?HT(e):t!==`system`||!HT(e)}function bie(e,t){return e.filter(e=>yie(e,t))}function xie(e,t){return e>0?``:t===`all`?`Waiting for activity`:t===`tasks`?`No task events yet`:`No system events yet`}function Sie(e,t){return`${e}:${t??0}`}function Cie(e){let t=[];for(let n of e){let e=n.kind||n.type||`event`,r=Number(n.task_id)||0,i=Sie(IT(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 wie={role:`region`,"aria-label":`Activity`,"aria-live":`polite`},Tie={class:`max-h-[28rem] overflow-y-auto`},Eie={clas Line truncated
`,1)[0]??``;return t.length>80?`${t.slice(0,79)}…`:t}function JE(e){return(e?.merged||0)+(e?.completed||0)}function YE(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 XE(e,t){return e.filter(e=>e.required&&!(t[e.name]??``).trim()).map(e=>e.name)}function ZE(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 QE(e,t){let n={};for(let r of e){let e=t[r.name];e!==void 0&&e!==``&&(n[r.name]=ZE(e,r.type))}return n}var $E=[`onKeydown`],eD={key:0,class:`text-sm text-danger`,role:`alert`},tD={key:1,class:`grid gap-1.5`},nD=[`for`],rD={key:0,class:`font-normal text-fg-subtle`},iD=[`id`],aD=[`value`],oD={key:0,class:`text-xs text-fg-subtle`},sD={key:2,class:`grid gap-1.5`},cD=[`id`],lD={class:`block truncate text-label font-medium`},uD={class:`block text-xs text-fg-subtle`},dD={key:0,class:`text-xs text-fg-subtle`},fD={key:3,class:`grid gap-3`},pD=[`for`],mD={class:`font-mono`},hD={key:0,class:`text-fg-subtle`},gD={class:`grid gap-1.5`},_D=[`for`],vD={class:`grid gap-1.5`},yD=[`for`],bD={key:4,class:`text-sm text-danger`,role:`alert`},xD={class:`flex items-center gap-2 border-t border-border pt-4`},SD={class:`mr-auto text-xs text-fg-subtle`},CD=P({__name:`NewTaskForm`,props:{workflow:{},draft:{},initialWorkflow:{},initialInstructions:{}},emits:[`started`,`cancel`],setup(e,{emit:t}){let n=e,r=t,i=we(),a=J([]),o=J([]),s=J([]),c=J(``);Be(async()=>{try{let[e,t]=await Promise.all([Z.workflows(),Z.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=J(``),u=J(n.workflow??n.initialWorkflow??``),d=J(n.initialInstructions??``),f=J(qE(d.value)),p=J({});Ce(()=>{!u.value&&a.value[0]&&(u.value=a.value[0].id)});let m=Y(()=>a.value.find(e=>e.id===u.value)),h=Y(()=>YE(m.value)),g=Y(()=>XE(h.value,p.value)),_=Y(()=>m.value?.repository??`required`),v=Y(()=>_.value!==`optional`&&_.value!==`none`),y=e=>o.value.find(t=>t.workflow===e),b=J(!1),x=J(``),S=Y(()=>!(!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 Z.workRequest({repository:_.value===`none`?``:l.value.trim(),workflow:u.value,title:f.value.trim(),instructions:d.value,inputs:QE(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)=>(L(),j(`form`,{class:`grid gap-5`,onSubmit:pt(C,[`prevent`]),onKeydown:[gt(pt(C,[`meta`,`prevent`]),[`enter`]),gt(pt(C,[`ctrl`,`prevent`]),[`enter`])]},[c.value?(L(),j(`p`,eD,B(c.value),1)):F(``,!0),_.value===`none`?F(``,!0):(L(),j(`div`,tD,[R(`label`,{for:`${V(i)}-repo`,class:`text-label font-medium`},[t[5]||=H(`Repository`,-1),v.value?F(``,!0):(L(),j(`span`,rD,` (optional)`))],8,nD),A(V(Q),{id:`${V(i)}-repo`,modelValue:l.value,"onUpdate:modelValue":t[0]||=e=>l.value=e,class:`font-mono`,placeholder:`owner/repository`,list:`${V(i)}-repos`,required:v.value},null,8,[`id`,`modelValue`,`list`,`required`]),R(`datalist`,{id:`${V(i)}-repos`},[(L(!0),j(U,null,M(s.value,e=>(L(),j(`option`,{key:e,value:e},null,8,aD))),128))],8,iD),s.value.length?(L(),j(`p`,oD,[t[6]||=H(`Configured: `,-1),(L(!0),j(U,null,M(s.value,e=>(L(),q(V(X),{key:e,type:`button`,variant:`link`,size:`xs`,class:`h-auto px-1 font-mono text-fg-subtle`,onClick:t=>l.value=e},{default:I(()=>[H(B(e),1)]),_:2},1032,[`onClick`]))),128))])):F(``,!0)])),n.workflow?F(``,!0):(L(),j(`div`,sD,[R(`span`,{id:`${V(i)}-wf`,class:`text-label font-medium`},`Workflow`,8,cD),A(V(Ps),{modelValue:u.value,"onUpdate:modelValue":t[1]||=e=>u.value=e,"aria-labelledby":`${V(i)}-wf`,class:`grid grid-cols-1 gap-2 sm:grid-cols-3`,loop:``},{default:I(()=>[(L(!0),j(U,null,M(a.value,e=>(L(),q(V(Is),{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:I(()=>[R(`span`,lD,B(e.name||e.id),1),R(`span`,uD,[H(B(y(e.id)?.runs||0)+` runs`,1),y(e.id)?.runs?(L(),j(U,{key:0},[H(` · `+B(Math.round(V(JE)(y(e.id))/(y(e.id)?.runs||1)*100))+`% delivered`,1)],64)):F(``,!0)])]),_:2},1032,[`value`]))),128))]),_:1},8,[`modelValue`,`aria-labelledby`]),!a.value.length&&!c.value?(L(),j(`p`,dD,`No enabled workflows.`)):F(``,!0)])),h.value.length?(L(),j(`div`,fD,[(L(!0),j(U,null,M(h.value,e=>(L(),j(`div`,{key:e.name,class:`grid gap-1.5`},[R(`label`,{for:`${V(i)}-input-${e.name}`,class:`text-label font-medium`},[R(`span`,mD,B(e.name),1),e.required?(L(),j(`span`,hD,` · required`)):F(``,!0)],8,pD),A(V(Q),{id:`${V(i)}-input-${e.name}`,"model-value":p.value[e.name 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 zD(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 BD(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 VD(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 HD(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 UD=J([]),WD=J([]),GD=J(!0),KD=J(null),qD=J(!0),JD=J(null),YD=J(!1),XD=J(null);async function ZD(){try{let e=await Z.eventTypes(LD().workspace);GD.value=e.enabled!==!1,UD.value=e.event_types||[],WD.value=e.proposals||[],KD.value=null}catch(e){KD.value=e.message||String(e)}finally{qD.value=!1}}function QD(e){return{headers:(e.headers||[]).map(e=>({...e})),payload:(e.payload||[]).map(e=>({...e}))}}function $D(e){XD.value=null,JD.value=e}function eO(e){let t=cO.value.find(t=>String(t.id)===e.sample_id);$D({mode:`proposal`,id:null,source:e.source,name:``,rule:QD(e.rule),headersText:``,body:t?.body||``,exampleHeaders:e.headers||{}})}function tO(e=``){$D({mode:`paste`,id:null,source:e,name:``,rule:{headers:[],payload:[]},headersText:``,body:``,exampleHeaders:{}})}function nO(e){$D({mode:`edit`,id:e.id,source:e.source,name:e.name,rule:QD(e.rule),headersText:``,body:``,exampleHeaders:{}})}function rO(){JD.value=null}async function iO(){let e=JD.value;if(e){YD.value=!0;try{if(e.mode===`edit`&&e.id)await Z.eventTypeUpdate(e.id,{name:e.name,rule:HD(e.rule)});else{let t=e.mode===`paste`?RD(e.headersText):e.exampleHeaders;await Z.eventTypeCreate({source:e.source,name:e.name,rule:e.mode===`paste`?void 0:HD(e.rule),example:{headers:t,body:e.body}})}JD.value=null,await ZD()}catch(e){XD.value=e.message||String(e)}finally{YD.value=!1}}}var aO=J(null);async function oO(){let e=aO.value;if(aO.value=null,e)try{await Z.eventTypeDelete(e.id),await ZD()}catch(e){KD.value=e.message||String(e)}}var sO=100,cO=J([]),lO=J(!0),uO=J(null),dO=J(!0),fO=J(null);async function pO(){try{let e=await Z.captures(sO);lO.value=e.enabled!==!1,cO.value=e.captures||[],uO.value=null}catch(e){uO.value=e.message||String(e)}finally{dO.value=!1}}function mO(e){let t=cO.value.find(t=>t.id===e);return t&&(fO.value=t),!!t}function hO(){cO.value.length&&(fO.value=cO.value[0])}function gO(){Yf(`captures`,()=>{pO(),ZD()})}var _O=P({__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=ct(n,`class`),a=w(i,r);return(e,t)=>(L(),q(V(kc),G({"data-slot":`tabs`,"data-orientation":V(a).orientation||`horizontal`},V(a),{class:V(W)(`gap-2 group/tabs flex data-horizontal:flex-col`,n.class)}),{default:I(t=>[K(e.$slots,`default`,Je(be(t)))]),_:3},16,[`data-orientation`,`class`]))}}),vO=P({__name:`TabsContent`,props:{value:{},forceMount:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e,n=ct(t,`class`);return(e,r)=>(L(),q(V(Mc),G({"data-slot":`tabs-content`,class:V(W)(`text-sm flex-1 outline-none`,t.class)},V(n)),{default:I(()=>[K(e.$slots,`default`)]),_:3},16,[`class`]))}}),yO=P({__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=ct(t,`class`,`variant`);return(r,i)=>(L(),q(V(Nc),G({"data-slot":`tabs-list`,"data-variant":e.variant},V(n),{class:V(W)(V(xO)({variant:e.variant}),t.class)}),{default:I(()=>[K(r.$slots,`default`)]),_:3},16,[`data-variant`,`class`]))}}),bO=P({__name:`TabsTrigger`,props:{value:{},disabled:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e,n=ct(t,`class`),r=C(n);return(e,n)=>(L(),q(V(Pc),G({"data-slot":`tabs-trigger`,class:V(W)(`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:oLine truncated
`));return(t,r)=>e.tool.path?(I(),K(dS,{key:0,path:e.tool.path,label:e.tool.label},null,8,[`path`,`label`])):l.value?(I(),K(B(lf),{key:1,"default-open":i.value},{default:F(()=>[O(B(ff),null,{default:F(()=>[O(B(mf),{status:i.value?`error`:o.value?`running`:void 0},{default:F(()=>[O(B(df),null,{default:F(()=>[i.value?(I(),K(B(Ac),{key:0})):o.value?(I(),K(B(Zc),{key:1,class:`animate-spin`})):(I(),K(B(Ec),{key:2,class:`text-success`}))]),_:1}),L(`span`,fS,z(n.value),1),O(B(hf),{class:`font-mono text-xs`},{default:F(()=>[V(z(c.value),1)]),_:1}),s.value?(I(),k(`span`,pS,z(s.value),1)):P(``,!0)]),_:1},8,[`status`])]),_:1}),O(B(uf),null,{default:F(()=>[O(B(_f),{size:`sm`},{default:F(()=>[O(B(Sf),{wrap:``,class:`max-h-64`},{default:F(()=>[V(z(l.value),1)]),_:1})]),_:1})]),_:1})]),_:1},8,[`default-open`])):(I(),K(B(mf),{key:2,status:i.value?`error`:o.value?`running`:void 0},{default:F(()=>[O(B(df),null,{default:F(()=>[i.value?(I(),K(B(Ac),{key:0})):o.value?(I(),K(B(Zc),{key:1,class:`animate-spin`})):(I(),K(B(Ec),{key:2,class:`text-success`}))]),_:1}),L(`span`,mS,z(n.value),1),O(B(hf),{class:`font-mono text-xs`},{default:F(()=>[V(z(c.value),1)]),_:1}),s.value?(I(),k(`span`,hS,z(s.value),1)):P(``,!0)]),_:1},8,[`status`]))}}),_S={class:`flex flex-col gap-1.5`},vS=N({__name:`ChatToolGroup`,props:{tools:{},streaming:{type:Boolean}},setup(e){let t=e,n=e=>!!(e.err||e.Err||e.failed),r=J(()=>t.tools.some(n)),i=J(()=>`${t.tools.length} tool call${t.tools.length===1?``:`s`}`);return(t,n)=>(I(),K(B(lf),{"default-open":r.value},{default:F(()=>[O(B(ff),null,{default:F(()=>[O(B(mf),{status:r.value?`error`:void 0},{default:F(()=>[O(B(df),null,{default:F(()=>[O(B(Nl))]),_:1}),O(B(hf),{class:`truncate`},{default:F(()=>[V(z(i.value),1)]),_:1})]),_:1},8,[`status`])]),_:1}),O(B(uf),null,{default:F(()=>[L(`div`,_S,[(I(!0),k(H,null,A(e.tools,(t,n)=>(I(),K(gS,{key:n,tool:t,streaming:e.streaming&&n===e.tools.length-1},null,8,[`tool`,`streaming`]))),128))])]),_:1})]),_:1},8,[`default-open`]))}}),yS={key:0,class:`mb-2 flex flex-wrap gap-1.5`},bS={key:2,class:`whitespace-pre-wrap`},xS=N({__name:`ChatBubble`,props:{text:{},tools:{default:()=>[]},media:{default:()=>[]},assistant:{type:Boolean,default:!1},streaming:{type:Boolean,default:!1}},setup(e){let t=e,n=J(()=>{let e=Array.from(t.text),n=[],r=0,i=!1;for(let a of t.tools){let t=Math.min(Math.max(a.text_offset??0,r),e.length);t>r&&(n.push({text:e.slice(r,t).join(``)}),r=t,i=!1);let o=n[n.length-1];!a.path&&i&&o&&`tools`in o?o.tools.push(a):(n.push({tools:[a]}),i=!a.path)}return r<e.length&&n.push({text:e.slice(r).join(``)}),n});return(t,r)=>(I(),K(B(Px),{align:e.assistant?`start`:`end`},{default:F(()=>[O(B(Fx),null,{default:F(()=>[O(B(tf),{variant:e.assistant?`muted`:`tinted`,class:`max-w-[min(78ch,92%)]`},{default:F(()=>[O(B(nf),{class:`[overflow-wrap:anywhere]`},{default:F(()=>[e.media.length?(I(),k(`div`,yS,[(I(!0),k(H,null,A(e.media,(e,t)=>(I(),K(Bx,{key:t,attachment:e},null,8,[`attachment`]))),128))])):P(``,!0),e.assistant?(I(!0),k(H,{key:1},A(n.value,(t,r)=>(I(),k(H,{key:r},[`text`in t?(I(),K(lS,{key:0,text:t.text},null,8,[`text`])):(I(),K(B(af),{key:1,class:`my-2`},{default:F(()=>[t.tools.length>1?(I(),K(vS,{key:0,tools:t.tools,streaming:e.streaming&&r===n.value.length-1},null,8,[`tools`,`streaming`])):(I(),K(gS,{key:1,tool:t.tools[0],streaming:e.streaming&&r===n.value.length-1},null,8,[`tool`,`streaming`]))]),_:2},1024))],64))),128)):(I(),k(`div`,bS,z(e.text),1)),G(t.$slots,`default`)]),_:3})]),_:3},8,[`variant`]),e.assistant&&!e.streaming&&e.text?(I(),K(B(Ix),{key:0,class:`px-0 transition-opacity focus-within:opacity-100 [@media(hover:hover)]:opacity-0 [@media(hover:hover)]:group-hover/message:opacity-100`},{default:F(()=>[O(B(wf),{value:e.text},null,8,[`value`])]),_:1})):P(``,!0)]),_:3})]),_:3},8,[`align`]))}}),SS={class:`text-sm`},CS={key:0,class:`mt-1 text-fg-muted`},wS={key:1,class:`mt-2 flex flex-wrap gap-2`},TS=N({__name:`ChatChooseCard`,props:{choose:{}},setup(e){let t=J(()=>au.value.models??[]);return(e,n)=>(I(),k(`div`,SS,[n[0]||=L(`p`,{class:`font-medium`},`Choose a model`,-1),t.value.length?(I(),k(`div`,wS,[(I(!0),k(H,null,A(t.value,e=>(I(),K(B(Y),{key:e,size:`sm`,variant:e===B(au).active_model?`default`:`outline`,class:`font-mono`,onClick:t=>void B(Cu)(e)},{default:F(()=>[V(z(e),1)]),_:2},1032,[`variant`,`onClick`]))),128))])):(I(),k(`p`,CS,`None configured.`))]))}}),ES={class:`text-sm`},DS={key:0},OS={class:`mt-1 space-y-0.5`},kS={class:`font-mono`},AS=[`href`],jS={key:0,class:`mt-3 flex gap-2`},MS={key:1,class:`mt-2 text-fg-muted`},NS={key:2,class:`mt-2 text-fg-muted`},PS={key:3,class:`mt-2 text-ok`},FS={key:4,class:`mt-2 text-danger`},IS={key:5,class:`mt-2 text-xs text-fg-muted`},LS=N({__name:`ChatUpdateCard`,props:{update:{}},setup(e){let t=e,n=J(()=>t.update.available??[]),r=q(`idle`),i=q(``);async function a(){r.value=`installing`;try{let e=(await X.updateInstall(t.update.snapshot)).result?.installed;i.value=e?Object.entries(e).map(([e,t])=>`${e} → ${t}`).join(`, Line truncated
`).map(e=>e.trim()).find(Boolean)||``,i=r.length>Qw?`${r.slice(0,Qw).trimEnd()}…`:r;return{text:i,full:n,truncated:i!==n}}function Pte(e){return String(e||`event`).replaceAll(`_`,` `).replace(/\b\w/g,e=>e.toUpperCase())}function eT(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 tT(e){let t=Number(e);return!Number.isFinite(t)||t<=0?``:t.toLocaleString(`en-US`)}function nT(e){return typeof e==`string`?e:``}function rT(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=[r,eT(t.duration_ms)].filter(Boolean).join(` · `);return{title:t.interrupted?`Stage interrupted: ${n}`:t.skipped?`Skipped stage: ${n}`:t.error?`Stage failed: ${n}`:`Finished stage: ${n}`,detail:[e,nT(t.error),nT(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:[nT(t.previous_stage)&&`after ${nT(t.previous_stage)}`,nT(t.previous_reason)].filter(Boolean).join(`: `)||e.detail||``}}if(e.kind===`agent_finish`){let r=tT(t.iterations),i=tT(t.tokens),a=Number(t.cached_tokens)||0,o=tT((Number(t.prompt_tokens)||0)-a),s=tT(t.completion_tokens),c=tT(t.cached_tokens),l=[r&&`${r} iterations`,i&&`${i} tokens`,o&&`${o} fresh prompt`,s&&`${s} completion`,c&&`${c} cached`,nT(t.model)].filter(Boolean);return{title:`Agent ${nT(t.status)||`finished`}: ${n}`,detail:l.join(` · `)||e.detail||``}}if(e.kind===`remediation_round`){let e=Number(t.of),n=nT(t.author);return{title:`Remediation ${nT(t.round)}${e>0?` of ${e}`:``}`,detail:[n&&`answers ${n}'s review`,t.review_id?`#${nT(t.review_id)}`:``].filter(Boolean).join(` `)}}if(e.kind===`review_approved`){let e=nT(t.pr_number);return{title:`Pull request approved`,detail:[nT(t.author),e&&`#${e}`].filter(Boolean).join(` · `)}}if(e.kind===`step_retried`)return{title:`Attempt ${nT(t.attempt)} of ${nT(t.of)} failed: ${e.stage||`step`}`,detail:nT(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=nT(t.source),n=nT(t.capture_id),r=[{label:`binding ${nT(t.binding_name)||nT(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 ${nT(t.captured_after)}`:``].filter(Boolean).join(` · `)}}return{title:Pte(e.kind||e.type),detail:e.detail||``}}var Fte=[`title`],iT=N({__name:`ActivityRow`,props:{event:{}},emits:[`open`],setup(e,{emit:t}){let n=Zw();n.watchIdentities();let r=e,i=t,a=Gw(),o=J(()=>a.taskIDFor(r.event)),s=J(()=>$w(r.event,n.identityName));function c(){o.value>0&&i(`open`,o.value)}return(t,n)=>(I(),K(B(ar),{class:R(o.value>0?`cursor-pointer`:``),role:o.value>0?`link`:void 0,tabindex:o.value>0?0:void 0,title:o.value>0?`Open task details`:void 0,onClick:c,onKeydown:[rt(tt(c,[`prevent`]),[`enter`]),rt(tt(c,[`prevent`]),[`space`])]},{default:F(()=>[O(B(nr),{class:`font-medium`},{default:F(()=>[V(z(B(rT)({...r.event,at:void 0,detail:void 0}).title),1)]),_:1}),O(B(nr),{class:`font-mono`},{default:F(()=>[V(z(o.value>0?`#${o.value}`:`–`),1)]),_:1}),O(B(nr),{class:`w-[55%] max-w-0`},{default:F(()=>[L(`span`,{class:`block truncate`,title:s.value.truncated?s.value.full:void 0},z(s.value.text),9,Fte)]),_:1}),O(B(nr),null,{default:F(()=>[O(B(lC),{at:e.event.at},null,8,[`at`])]),_:1})]),_:1},8,[`class`,`role`,`tabindex`,`title`,`onKeydown`]))}}),Ite=[{value:`all`,label:`All`},{value:`tasks`,label:`Tasks`},{value:`system`,label:`System`}];function aT(e){return(Number(e?.task_id)||0)>0}function Lte(e,t){return t===`tasks`?aT(e):t!==`system`||!aT(e)}function Rte(e,t){return e.filter(e=>Lte(e,t))}function zte(e,t){return e>0?``:t===`all`?`Waiting for activity`:t===`tasks`?`No task events yet`:`No system events yet`}function Bte(e,t){return`${e}:${t??0}`}function Vte(e){let t=[];for(let n of e){let e=n.kind||n.type||`event`,r=Number(n.task_id)||0,i=Bte($w(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 Hte={role:`region`,"aria-label":`Activity`,"aria-live":`polite`},Ute={class:`max-h-[28rem] overflow-y-auto`},Wte={clas Line truncated
`,1)[0]??``;return t.length>80?`${t.slice(0,79)}…`:t}function PT(e){return(e?.merged||0)+(e?.completed||0)}function FT(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 Sne(e,t){return e.filter(e=>e.required&&!(t[e.name]??``).trim()).map(e=>e.name)}function IT(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 Cne(e,t){let n={};for(let r of e){let e=t[r.name];e!==void 0&&e!==``&&(n[r.name]=IT(e,r.type))}return n}var wne=[`onKeydown`],Tne={key:0,class:`text-sm text-danger`,role:`alert`},Ene={key:1,class:`grid gap-1.5`},Dne=[`for`],One={key:0,class:`font-normal text-fg-subtle`},kne=[`id`],Ane=[`value`],jne={key:0,class:`text-xs text-fg-subtle`},Mne={key:2,class:`grid gap-1.5`},Nne=[`id`],Pne={class:`block truncate text-label font-medium`},Fne={class:`block text-xs text-fg-subtle`},Ine={key:0,class:`text-xs text-fg-subtle`},Lne={key:3,class:`grid gap-3`},Rne=[`for`],zne={class:`font-mono`},Bne={key:0,class:`text-fg-subtle`},Vne={class:`grid gap-1.5`},Hne=[`for`],Une={class:`grid gap-1.5`},Wne=[`for`],Gne={key:4,class:`text-sm text-danger`,role:`alert`},Kne={class:`flex items-center gap-2 border-t border-border pt-4`},qne={class:`mr-auto text-xs text-fg-subtle`},LT=N({__name:`NewTaskForm`,props:{workflow:{},draft:{},initialWorkflow:{},initialInstructions:{}},emits:[`started`,`cancel`],setup(e,{emit:t}){let n=e,r=t,i=he(),a=q([]),o=q([]),s=q([]),c=q(``);Ae(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(NT(d.value)),p=q({});me(()=>{!u.value&&a.value[0]&&(u.value=a.value[0].id)});let m=J(()=>a.value.find(e=>e.id===u.value)),h=J(()=>FT(m.value)),g=J(()=>Sne(h.value,p.value)),_=J(()=>m.value?.repository??`required`),v=J(()=>_.value!==`optional`&&_.value!==`none`),y=e=>o.value.find(t=>t.workflow===e),b=q(!1),x=q(``),S=J(()=>!(!l.value.trim()&&v.value||!u.value||!f.value.trim())&&g.value.length===0);async function ee(){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:Cne(h.value,p.value),...n.draft?{draft:n.draft}:{}});r(`started`,e.task_id)}catch(e){x.value=String(e.message||e)}finally{b.value=!1}}}return(e,t)=>(I(),k(`form`,{class:`grid gap-5`,onSubmit:tt(ee,[`prevent`]),onKeydown:[rt(tt(ee,[`meta`,`prevent`]),[`enter`]),rt(tt(ee,[`ctrl`,`prevent`]),[`enter`])]},[c.value?(I(),k(`p`,Tne,z(c.value),1)):P(``,!0),_.value===`none`?P(``,!0):(I(),k(`div`,Ene,[L(`label`,{for:`${B(i)}-repo`,class:`text-label font-medium`},[t[5]||=V(`Repository`,-1),v.value?P(``,!0):(I(),k(`span`,One,` (optional)`))],8,Dne),O(B(Z),{id:`${B(i)}-repo`,modelValue:l.value,"onUpdate:modelValue":t[0]||=e=>l.value=e,class:`font-mono`,placeholder:`owner/repository`,list:`${B(i)}-repos`,required:v.value},null,8,[`id`,`modelValue`,`list`,`required`]),L(`datalist`,{id:`${B(i)}-repos`},[(I(!0),k(H,null,A(s.value,e=>(I(),k(`option`,{key:e,value:e},null,8,Ane))),128))],8,kne),s.value.length?(I(),k(`p`,jne,[t[6]||=V(`Configured: `,-1),(I(!0),k(H,null,A(s.value,e=>(I(),K(B(Y),{key:e,type:`button`,variant:`link`,size:`xs`,class:`h-auto px-1 font-mono text-fg-subtle`,onClick:t=>l.value=e},{default:F(()=>[V(z(e),1)]),_:2},1032,[`onClick`]))),128))])):P(``,!0)])),n.workflow?P(``,!0):(I(),k(`div`,Mne,[L(`span`,{id:`${B(i)}-wf`,class:`text-label font-medium`},`Workflow`,8,Nne),O(B(as),{modelValue:u.value,"onUpdate:modelValue":t[1]||=e=>u.value=e,"aria-labelledby":`${B(i)}-wf`,class:`grid grid-cols-1 gap-2 sm:grid-cols-3`,loop:``},{default:F(()=>[(I(!0),k(H,null,A(a.value,e=>(I(),K(B(ss),{key:e.id,value:e.id,class:`rounded-md border border-border bg-card px-3 py-2.5 text-left transition-colors hover:bg-secondary focus-visible:outline-2 focus-visible:outline-ring data-[state=checked]:border-primary data-[state=checked]:bg-secondary`},{default:F(()=>[L(`span`,Pne,z(e.name||e.id),1),L(`span`,Fne,[V(z(y(e.id)?.runs||0)+` runs`,1),y(e.id)?.runs?(I(),k(H,{key:0},[V(` · `+z(Math.round(B(PT)(y(e.id))/(y(e.id)?.runs||1)*100))+`% delivered`,1)],64)):P(``,!0)])]),_:2},1032,[`value`]))),128))]),_:1},8,[`modelValue`,`aria-labelledby`]),!a.value.length&&!c.value?(I(),k(`p`,Ine,`No enabled workflows.`)):P(``,!0)])),h.value.length?(I(),k(`div`,Lne,[(I(!0),k(H,null,A(h.value,e=>(I(),k(`div`,{key:e.name,class:`grid gap-1.5`},[L(`label`,{for:`${B(i)}-input-${e.name}`,class:`text-label font-medium`},[L(`span`,zne,z(e.name),1),e.required?(I(),k(`span`,Bne,` · required`)):P(``,!0)],8,Rne),O(B(Z),{id:`${B(iLine 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 ore(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 VT(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 HT(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 UT(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 WT=q([]),GT=q([]),KT=q(!0),qT=q(null),JT=q(!0),YT=q(null),XT=q(!1),ZT=q(null);async function QT(){try{let e=await X.eventTypes(BT().workspace);KT.value=e.enabled!==!1,WT.value=e.event_types||[],GT.value=e.proposals||[],qT.value=null}catch(e){qT.value=e.message||String(e)}finally{JT.value=!1}}function $T(e){return{headers:(e.headers||[]).map(e=>({...e})),payload:(e.payload||[]).map(e=>({...e}))}}function eE(e){ZT.value=null,YT.value=e}function sre(e){let t=rE.value.find(t=>String(t.id)===e.sample_id);eE({mode:`proposal`,id:null,source:e.source,name:``,rule:$T(e.rule),headersText:``,body:t?.body||``,exampleHeaders:e.headers||{}})}function cre(e=``){eE({mode:`paste`,id:null,source:e,name:``,rule:{headers:[],payload:[]},headersText:``,body:``,exampleHeaders:{}})}function lre(e){eE({mode:`edit`,id:e.id,source:e.source,name:e.name,rule:$T(e.rule),headersText:``,body:``,exampleHeaders:{}})}function tE(){YT.value=null}async function ure(){let e=YT.value;if(e){XT.value=!0;try{if(e.mode===`edit`&&e.id)await X.eventTypeUpdate(e.id,{name:e.name,rule:UT(e.rule)});else{let t=e.mode===`paste`?are(e.headersText):e.exampleHeaders;await X.eventTypeCreate({source:e.source,name:e.name,rule:e.mode===`paste`?void 0:UT(e.rule),example:{headers:t,body:e.body}})}YT.value=null,await QT()}catch(e){ZT.value=e.message||String(e)}finally{XT.value=!1}}}var nE=q(null);async function dre(){let e=nE.value;if(nE.value=null,e)try{await X.eventTypeDelete(e.id),await QT()}catch(e){qT.value=e.message||String(e)}}var fre=100,rE=q([]),iE=q(!0),aE=q(null),oE=q(!0),sE=q(null);async function cE(){try{let e=await X.captures(fre);iE.value=e.enabled!==!1,rE.value=e.captures||[],aE.value=null}catch(e){aE.value=e.message||String(e)}finally{oE.value=!1}}function lE(e){let t=rE.value.find(t=>t.id===e);return t&&(sE.value=t),!!t}function uE(){rE.value.length&&(sE.value=rE.value[0])}function dE(){Tn(`captures`,()=>{cE(),QT()})}var fE=N({__name:`Tabs`,props:{defaultValue:{},orientation:{},dir:{},activationMode:{},modelValue:{},unmountOnHide:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,i=Ze(n,`class`),a=C(i,r);return(e,t)=>(I(),K(B(gs),W({"data-slot":`tabs`,"data-orientation":B(a).orientation||`horizontal`},B(a),{class:B(U)(`gap-2 group/tabs flex data-horizontal:flex-col`,n.class)}),{default:F(t=>[G(e.$slots,`default`,Re(de(t)))]),_:3},16,[`data-orientation`,`class`]))}}),pE=N({__name:`TabsContent`,props:{value:{},forceMount:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e,n=Ze(t,`class`);return(e,r)=>(I(),K(B(ys),W({"data-slot":`tabs-content`,class:B(U)(`text-sm flex-1 outline-none`,t.class)},B(n)),{default:F(()=>[G(e.$slots,`default`)]),_:3},16,[`class`]))}}),mE=N({__name:`TabsList`,props:{loop:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]},variant:{default:`default`}},setup(e){let t=e,n=Ze(t,`class`,`variant`);return(r,i)=>(I(),K(B(bs),W({"data-slot":`tabs-list`,"data-variant":e.variant},B(n),{class:B(U)(B(gE)({variant:e.variant}),t.class)}),{default:F(()=>[G(r.$slots,`default`)]),_:3},16,[`data-variant`,`class`]))}}),hE=N({__name:`TabsTrigger`,props:{value:{},disabled:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e,n=Ze(t,`class`),r=S(n);return(e,n)=>(I(),K(B(xs),W({"data-slot":`tabs-trigger`,class:B(U)(`gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg:not([class*=size-])]:size-4 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-1 focus-Line truncated
WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var pH=$V(`CharSizeService`),mH=$V(`CoreBrowserService`),hH=$V(`MouseService`),gH=$V(`RenderService`),_H=$V(`SelectionService`),vH=$V(`CharacterJoinerService`),yH=$V(`ThemeService`),bH=$V(`LinkProviderService`),xH=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?DH.isErrorNoTelemetry(e)?new DH(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 Zz=Lz(`CharSizeService`),Qz=Lz(`CoreBrowserService`),$z=Lz(`MouseService`),eB=Lz(`RenderService`),tB=Lz(`SelectionService`),nB=Lz(`CharacterJoinerService`),rB=Lz(`ThemeService`),iB=Lz(`LinkProviderService`),aB=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?dB.isErrorNoTelemetry(e)?new dB(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 SH(e){wH(e)||xH.onUnexpectedError(e)}var CH=`Canceled`;function wH(e){return e instanceof TH||e instanceof Error&&e.name===CH&&e.message===CH}var TH=class extends Error{constructor(){super(CH),this.name=this.message}};function EH(e){return Error(e?`Illegal argument: ${e}`:`Illegal argument`)}var DH=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`}},OH=class e extends Error{constructor(t){super(t||`An unexpected bug occurred.`),Object.setPrototypeOf(this,e.prototype)}};function kH(e,t=0){return e[e.length-(1+t)]}var AH;(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})(AH||={});var jH=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||AH.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};jH.empty=new jH(e=>{});function MH(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 NH;(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})(NH||={});var PH=null;function FH(e){return PH?.trackDisposable(e),e}function IH(e){PH?.markAsDisposed(e)}function LH(e,t){PH?.setParent(e,t)}function RH(e){return PH?.markAsSingleton(e),e}function zH(e){if(NH.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 BH(...e){return VH(()=>zH(e))}function VH(e){let t=FH({dispose:MH(()=>{IH(t),e()})});return t}var HH=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,FH(this)}dispose(){this._isDisposed||(IH(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{zH(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return LH(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),LH(e,null))}};HH.DISABLE_DISPOSED_WARNING=!1;var UH=HH,WH=class{constructor(){this._store=new UH,FH(this),LH(this._store,this)}dispose(){IH(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 oB(e){cB(e)||aB.onUnexpectedError(e)}var sB=`Canceled`;function cB(e){return e instanceof lB||e instanceof Error&&e.name===sB&&e.message===sB}var lB=class extends Error{constructor(){super(sB),this.name=this.message}};function uB(e){return Error(e?`Illegal argument: ${e}`:`Illegal argument`)}var dB=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`}},fB=class e extends Error{constructor(t){super(t||`An unexpected bug occurred.`),Object.setPrototypeOf(this,e.prototype)}};function pB(e,t=0){return e[e.length-(1+t)]}var mB;(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})(mB||={});var hB=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||mB.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};hB.empty=new hB(e=>{});function gB(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 _B;(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})(_B||={});var vB=null;function yB(e){return vB?.trackDisposable(e),e}function bB(e){vB?.markAsDisposed(e)}function xB(e,t){vB?.setParent(e,t)}function SB(e){return vB?.markAsSingleton(e),e}function CB(e){if(_B.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 wB(...e){return TB(()=>CB(e))}function TB(e){let t=yB({dispose:gB(()=>{bB(t),e()})});return t}var EB=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,yB(this)}dispose(){this._isDisposed||(bB(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{CB(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return xB(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),xB(e,null))}};EB.DISABLE_DISPOSED_WARNING=!1;var DB=EB,OB=class{constructor(){this._store=new DB,yB(this),xB(this._store,this)}dispose(){bB(thi Line truncated
`).slice(2).join(`
`))}},aU=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},oU=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},sU=0,cU=class{constructor(e){this.value=e,this.id=sU++}},lU=2,uU=class{constructor(e){this._size=0,this._options=e,this._leakageMon=tU>0||this._options?.leakWarningThreshold?new rU(e?.onListenerError??SH,this._options?.leakWarningThreshold??tU):void 0,this._perfMon=this._options?._profName?new eU(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 oU(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||SH)(n),WH.None}if(this._disposed)return WH.None;t&&(e=e.bind(t));let r=new cU(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=iU.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof cU?(this._deliveryQueue??=new dU,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=VH(()=>{i?.(),this._removeListener(r)});return n instanceof UH?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*lU<=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||SH;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 cU)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}},dU=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}},fU=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new uU,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new uU,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}};fU.INSTANCE=new fU;var pU=fU;function mU(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}pU.INSTANCE.onDidChangeZoomLevel;function hU(e){return pU.INSTANCE.getZoomFactor(e)}pU.INSTANCE.onDidChangeFullscreen;var gU=typeof navigator==`object`?navigator.userAgent:``,_U=gU.indexOf(`Firefox`)>=0,vU=gU.indexOf(`AppleWebKit`)>=0,yU=gU.indexOf(`Chrome`)>=0,bU=!yU&&gU.indexOf(`Safari`)>=0;gU.indexOf(`Electron/`),gU.indexOf(`Android`);var xU=!1;if(typeof KH.matchMedia==`function`){let e=KH.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=KH.matchMedia(`(display-mode: fullscreen)`);xU=e.matches,mU(KH,e,({matches:e})=>{xU&&t.matches||(xU=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}};_G=DV([OV(2,tH),OV(3,mH),OV(4,nH),OV(5,yH),OV(6,sH),OV(7,gH)],_G);var vG=class extends WH{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(VH(()=>{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 wG;(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=`Ÿ`))(wG||={});var TG;(e=>e.ST=`${$.ESC}\\`)(TG||={});var EG=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)}}};EG=DV([OV(2,tH),OV(3,sH),OV(4,rH),OV(5,gH)],EG);var DG=0,OG=0,kG=0,AG=0,jG={css:`#00000000`,rgba:0},MG;(e=>{function t(e,t,n,r){return r===void 0?`#${LG(e)}${LG(t)}${LG(n)}`:`#${LG(e)}${LG(t)}${LG(n)}${LG(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})(MG||={});var NG;(e=>{function t(e,t){if(AG=(t.rgba&255)/255,AG===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 DG=a+Math.round((n-a)*AG),OG=o+Math.round((r-o)*AG),kG=s+Math.round((i-s)*AG),{css:MG.toCss(DG,OG,kG),rgba:MG.toRgba(DG,OG,kG)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=IG.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return MG.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[DG,OG,kG]=IG.toChannels(t),{css:MG.toCss(DG,OG,kG),rgba:t}}e.opaque=i;function a(e,t){return AG=Math.round(t*255),[DG,OG,kG]=IG.toChannels(e.rgba),{css:MG.toCss(DG,OG,kG,AG),rgba:MG.toRgba(DG,OG,kG,AG)}}e.opacity=a;function o(e,t){return AG=e.rgba&255,a(e,AG*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.r Line truncated
`))}},UB=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},WB=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},GB=0,KB=class{constructor(e){this.value=e,this.id=GB++}},qB=2,JB=class{constructor(e){this._size=0,this._options=e,this._leakageMon=zB>0||this._options?.leakWarningThreshold?new VB(e?.onListenerError??oB,this._options?.leakWarningThreshold??zB):void 0,this._perfMon=this._options?._profName?new RB(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 WB(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||oB)(n),OB.None}if(this._disposed)return OB.None;t&&(e=e.bind(t));let r=new KB(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=HB.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof KB?(this._deliveryQueue??=new YB,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=TB(()=>{i?.(),this._removeListener(r)});return n instanceof DB?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*qB<=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||oB;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 KB)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}},YB=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}},XB=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new JB,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new JB,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}};XB.INSTANCE=new XB;var ZB=XB;function QB(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}ZB.INSTANCE.onDidChangeZoomLevel;function $B(e){return ZB.INSTANCE.getZoomFactor(e)}ZB.INSTANCE.onDidChangeFullscreen;var eV=typeof navigator==`object`?navigator.userAgent:``,tV=eV.indexOf(`Firefox`)>=0,nV=eV.indexOf(`AppleWebKit`)>=0,rV=eV.indexOf(`Chrome`)>=0,iV=!rV&&eV.indexOf(`Safari`)>=0;eV.indexOf(`Electron/`),eV.indexOf(`Android`);var aV=!1;if(typeof AB.matchMedia==`function`){let e=AB.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=AB.matchMedia(`(display-mode: fullscreen)`);aV=e.matches,QB(AB,e,({matches:e})=>{aV&&t.matches||(aV=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}};tU=dz([fz(2,zz),fz(3,Qz),fz(4,Bz),fz(5,rB),fz(6,Gz),fz(7,eB)],tU);var nU=class extends OB{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(TB(()=>{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 cU;(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=`Ÿ`))(cU||={});var lU;(e=>e.ST=`${$.ESC}\\`)(lU||={});var uU=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)}}};uU=dz([fz(2,zz),fz(3,Gz),fz(4,Vz),fz(5,eB)],uU);var dU=0,fU=0,pU=0,mU=0,hU={css:`#00000000`,rgba:0},gU;(e=>{function t(e,t,n,r){return r===void 0?`#${xU(e)}${xU(t)}${xU(n)}`:`#${xU(e)}${xU(t)}${xU(n)}${xU(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})(gU||={});var _U;(e=>{function t(e,t){if(mU=(t.rgba&255)/255,mU===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 dU=a+Math.round((n-a)*mU),fU=o+Math.round((r-o)*mU),pU=s+Math.round((i-s)*mU),{css:gU.toCss(dU,fU,pU),rgba:gU.toRgba(dU,fU,pU)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=bU.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return gU.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[dU,fU,pU]=bU.toChannels(t),{css:gU.toCss(dU,fU,pU),rgba:t}}e.opaque=i;function a(e,t){return mU=Math.round(t*255),[dU,fU,pU]=bU.toChannels(e.rgba),{css:gU.toCss(dU,fU,pU,mU),rgba:gU.toRgba(dU,fU,pU,mU)}}e.opacity=a;function o(e,t){return mU=e.rgba&255,a(e,mU*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()),OK&&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=ZK(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=fK(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,-QK),QK),t/=QK,t/Math.abs(t)+Math.round(t*($K-1)))}shouldForceSelection(e){return wK?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(),eq)}_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&&!(wK&&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(DW(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(VH(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<eY+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===eY+1&&(this._liveRegion.textContent+=MV.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 AV.get()},set promptLabel(e){AV.set(e)},get tooMuchOutput(){return MV.get()},set tooMuchOutput(e){MV.set(e)}}}_verifyIntegers(...e){for(pY of e)if(pY===1/0||isNaN(pY)||pY%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(pY of e)if(pY&&(pY===1/0||isNaN(pY)||pY%1!=0||pY<0))throw Error(`This API only accepts positive integers`)}},hY=2,gY=1,_Y=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(hY,Math.floor(u/e.css.cell.width)),rows:Math.max(gY,Math.floor(l/e.css.cell.height))}}},vY={class:`flex h-[32rem] min-h-0 flex-col gap-2`},yY={key:0,class:`text-sm text-fg-muted`,role:`status`},bY=P({__name:`SandboxView`,props:{taskId:{},attempt:{}},setup(e){let t=e,n=J(null),r=J(`connecting`),i=null,a=null,o=null,s=null;function c(){try{o?.fit()}catch{}}return Be(()=>{let e=n.value;if(!e)return;i=new mY({convertEol:!0,disableStdin:!0,cursorBlink:!1,fontFamily:`'IBM Plex Mono', ui-monospace, monospace`,fontSize:13,theme:{background:`#0b0f14`,foreground:`#e6edf3`}}),o=new _Y,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)}),nt(()=>{s?.disconnect(),s=null,a?.close(),a=null,i?.dispose(),i=null,o=null}),(e,t)=>(L(),j(`div`,vY,[r.value===`open`?F(``,!0):(L(),j(`p`,yY,[r.value===`connecting`?(L(),j(U,{key:0},[H(`Connecting…`)],64)):r.value===`closed`?(L(),j(U,{key:1},[H(`The sandbox ended.`)],64)):(L(),j(U,{key:2},[H(`Sandbox unavailable.`)],64))])),R(`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)]))}}),xY={class:`flex flex-wrap items-center gap-3 border-b border-border pb-3`},SY={class:`inline-flex items-center gap-2`},CY={class:`inline-flex items-center gap-2`},wY=`__all__`,TY=P({__name:`TaskLogFilters`,props:{filters:{},stages:{}},emits:[`filter`],setup(e,{emit:t}){let n=e,r=t,i=Y(()=>yM.map(e=>({value:e.value||wY,label:e.label}))),a=Y(()=>n.filters.level||wY),o=Y(()=>n.filters.stage||wY);function s(e){r(`filter`,{...n.filters,...e})}function c(e){s({level:String(e)===wY?``:String(e)})}function l(e){s({stage:String(e)===wY?``:String(e)})}return(t,n)=>(L(),j(`div`,xY,[R(`div`,SY,[A(V(zu),{"model-value":a.value,"onUpdate:modelValue":c},{default:I(()=>[A(V(Uu),{size:`sm`,"aria-label":`Filter log entries by level`},{default:I(()=>[A(V(Wu))]),_:1}),A(V(Bu),null,{default:I(()=>[A(V(Vu),null,{default:I(()=>[(L(!0),j(U,null,M(i.value,e=>(L(),q(V(Hu),{key:e.value,value:e.value},{default:I(()=>[H(B(e.label),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`model-value`])]),R(`div`,CY,[A(V(zu),{"model-value":o.value,"onUpdate:modelValue":l},{default:I(()=>[A(V(Uu),{size:`sm`,"aria-label":`Filter log entries by stage`},{default:I(()=>[A(V(Wu))]),_:1}),A(V(Bu),null,{default:I(()=>[A(V(Vu),null,{default:I(()=>[A(V(Hu),{value:wY},{default:I(()=>[...n[0]||=[H(`All stages`,-1)]]),_:1}),(L(!0),j(U,null,M(e.stages,e=>(L(),q(V(Hu),{key:e,value:e},{default:I(()=>[H(B(e),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`model-value`])])]))}}),EY={class:`sr-only`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`},DY={key:2,class:`flex flex-col items-start gap-2 py-3`},OY={key:0,class:`mt-2 flex flex-wrap items-cent Line truncated
`)}};VZ.defaultYaml={explicit:!1,version:`1.2`},VZ.defaultTags={"!!":`tag:yaml.org,2002:`};function HZ(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 UZ(e){let t=new Set;return PZ(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function WZ(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function GZ(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=UZ(e);let a=WZ(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(EZ(t.node)||OZ(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 KZ(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=KZ(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=KZ(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=KZ(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=KZ(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function qZ(e,t,n){if(Array.isArray(e))return e.map((e,t)=>qZ(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!AZ(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 JZ=class{constructor(e){Object.defineProperty(this,xZ,{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(!CZ(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=qZ(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?KZ(i,{"":o},``,o):o}},YZ=class extends JZ{constructor(e){super(hZ),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=[],PZ(e,{Node:(e,t)=>{(SZ(t)||AZ(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||=(qZ(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=XZ(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(HZ(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 XZ(e,t,n){if(SZ(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(OZ(t)){let r=0;for(let i of t.items){let t=XZ(e,i,n);t>r&&(r=t)}return r}if(TZ(t)){let r=XZ(e,t.key,n),i=XZ(e,t.value,n);return Math.max(r,i)}return 1}var ZZ=e=>!e||typeof e!=`function`&&typeof e!=`object`,QZ=class extends JZ{constructor(e){super(yZ),this.value=e}toJSON(e,t){return t?.keep?this.value:qZ(this.value,e,t)}toString(){return String(this.value)}};QZ.BLOCK_FOLDED=`BLOCK_FOLDED`,QZ.BLOCK_LITERAL=`BLOCK_LITERAL`,QZ.PLAIN=`PLAIN`,QZ.QUOTE_DOUBLE=`QUOTE_DOUBLE`,QZ.QUOTE_SINGLE=`QUOTE_SINGLE`;var $Z=`tag:yaml.org,2002:`;function eQ(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 tQ(e,t,n){if(CZ(e)&&(e=e.contents),kZ(e))return e;if(TZ(e)){let t=n.schema[_Z].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 YZ(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=$Z+t.slice(2));let l=eQ(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new QZ(e);return c&&(c.node=t),t Line truncated
`)?oQ(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()),fW&&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=FW(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=XU(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,-IW),IW),t/=IW,t/Math.abs(t)+Math.round(t*(LW-1)))}shouldForceSelection(e){return cW?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(),RW)}_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&&!(cW&&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(dH(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(TB(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<RK+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===RK+1&&(this._liveRegion.textContent+=gz.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 mz.get()},set promptLabel(e){mz.set(e)},get tooMuchOutput(){return gz.get()},set tooMuchOutput(e){gz.set(e)}}}_verifyIntegers(...e){for(ZK of e)if(ZK===1/0||isNaN(ZK)||ZK%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(ZK of e)if(ZK&&(ZK===1/0||isNaN(ZK)||ZK%1!=0||ZK<0))throw Error(`This API only accepts positive integers`)}},$K=2,eq=1,tq=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($K,Math.floor(u/e.css.cell.width)),rows:Math.max(eq,Math.floor(l/e.css.cell.height))}}},nq={class:`flex h-[32rem] min-h-0 flex-col gap-2`},rq={key:0,class:`text-sm text-fg-muted`,role:`status`},iq=N({__name:`SandboxView`,props:{taskId:{},attempt:{}},setup(e){let t=e,n=q(null),r=q(`connecting`),i=null,a=null,o=null,s=null;function c(){try{o?.fit()}catch{}}return Ae(()=>{let e=n.value;if(!e)return;i=new QK({convertEol:!0,disableStdin:!0,cursorBlink:!1,fontFamily:`'IBM Plex Mono', ui-monospace, monospace`,fontSize:13,theme:{background:`#0b0f14`,foreground:`#e6edf3`}}),o=new tq,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)}),Ke(()=>{s?.disconnect(),s=null,a?.close(),a=null,i?.dispose(),i=null,o=null}),(e,t)=>(I(),k(`div`,nq,[r.value===`open`?P(``,!0):(I(),k(`p`,rq,[r.value===`connecting`?(I(),k(H,{key:0},[V(`Connecting…`)],64)):r.value===`closed`?(I(),k(H,{key:1},[V(`The sandbox ended.`)],64)):(I(),k(H,{key:2},[V(`Sandbox unavailable.`)],64))])),L(`div`,{ref_key:`host`,ref:n,class:`min-h-0 flex-1 overflow-hidden rounded-md border border-border bg-[#0b0f14] p-2`},null,512)]))}}),aq={class:`flex flex-wrap items-center gap-3 border-b border-border pb-3`},oq={class:`inline-flex items-center gap-2`},sq={class:`inline-flex items-center gap-2`},cq=`__all__`,lq=N({__name:`TaskLogFilters`,props:{filters:{},stages:{}},emits:[`filter`],setup(e,{emit:t}){let n=e,r=t,i=J(()=>rA.map(e=>({value:e.value||cq,label:e.label}))),a=J(()=>n.filters.level||cq),o=J(()=>n.filters.stage||cq);function s(e){r(`filter`,{...n.filters,...e})}function c(e){s({level:String(e)===cq?``:String(e)})}function l(e){s({stage:String(e)===cq?``:String(e)})}return(t,n)=>(I(),k(`div`,aq,[L(`div`,oq,[O(B(zn),{"model-value":a.value,"onUpdate:modelValue":c},{default:F(()=>[O(B(In),{size:`sm`,"aria-label":`Filter log entries by level`},{default:F(()=>[O(B(Bn))]),_:1}),O(B(Ln),null,{default:F(()=>[O(B(Nn),null,{default:F(()=>[(I(!0),k(H,null,A(i.value,e=>(I(),K(B(Fn),{key:e.value,value:e.value},{default:F(()=>[V(z(e.label),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`model-value`])]),L(`div`,sq,[O(B(zn),{"model-value":o.value,"onUpdate:modelValue":l},{default:F(()=>[O(B(In),{size:`sm`,"aria-label":`Filter log entries by stage`},{default:F(()=>[O(B(Bn))]),_:1}),O(B(Ln),null,{default:F(()=>[O(B(Nn),null,{default:F(()=>[O(B(Fn),{value:cq},{default:F(()=>[...n[0]||=[V(`All stages`,-1)]]),_:1}),(I(!0),k(H,null,A(e.stages,e=>(I(),K(B(Fn),{key:e,value:e},{default:F(()=>[V(z(e),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`model-value`])])]))}}),uq={class:`sr-only`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`},dq={key:2,class:`flex flex-col items-start gap-2 py-3`},fq={key:0,class:`mt-2 flex flex-wrap items-cent Line truncated
`)}};TY.defaultYaml={explicit:!1,version:`1.2`},TY.defaultTags={"!!":`tag:yaml.org,2002:`};function EY(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 DY(e){let t=new Set;return vY(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function OY(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function kY(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=DY(e);let a=OY(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(uY(t.node)||fY(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 AY(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=AY(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=AY(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=AY(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=AY(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function jY(e,t,n){if(Array.isArray(e))return e.map((e,t)=>jY(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!mY(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 MY=class{constructor(e){Object.defineProperty(this,aY,{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(!sY(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=jY(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?AY(i,{"":o},``,o):o}},NY=class extends MY{constructor(e){super($J),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=[],vY(e,{Node:(e,t)=>{(oY(t)||mY(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||=(jY(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=PY(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(EY(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 PY(e,t,n){if(oY(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(fY(t)){let r=0;for(let i of t.items){let t=PY(e,i,n);t>r&&(r=t)}return r}if(lY(t)){let r=PY(e,t.key,n),i=PY(e,t.value,n);return Math.max(r,i)}return 1}var FY=e=>!e||typeof e!=`function`&&typeof e!=`object`,IY=class extends MY{constructor(e){super(rY),this.value=e}toJSON(e,t){return t?.keep?this.value:jY(this.value,e,t)}toString(){return String(this.value)}};IY.BLOCK_FOLDED=`BLOCK_FOLDED`,IY.BLOCK_LITERAL=`BLOCK_LITERAL`,IY.PLAIN=`PLAIN`,IY.QUOTE_DOUBLE=`QUOTE_DOUBLE`,IY.QUOTE_SINGLE=`QUOTE_SINGLE`;var LY=`tag:yaml.org,2002:`;function RY(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 zY(e,t,n){if(sY(e)&&(e=e.contents),pY(e))return e;if(lY(e)){let t=n.schema[tY].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 NY(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=LY+t.slice(2));let l=RY(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new IY(e);return c&&(c.node=t),t Line truncated
`)?WY(n,t):n.includes(`
`)?`
`+oQ(n,t):(e.endsWith(` `)?``:` `)+n,cQ=`flow`,lQ=`block`,Gie=`quoted`;function uQ(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=dQ(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=dQ(e,h,t.length)),d=h+t.length+c,f=void 0;else{if(r===` `&&p&&p!==` `&&p!==`
`+WY(n,t):(e.endsWith(` `)?``:` `)+n,KY=`flow`,qY=`block`,JY=`quoted`;function YY(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=XY(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=XY(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 dQ(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 fQ=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),pQ=e=>/^(%|---|\.\.\.)/m.test(e);function mQ(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 hQ(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(pQ(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 XY(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 ZY=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),QY=e=>/^(%|---|\.\.\.)/m.test(e);function $Y(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 eX(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(QY(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:uQ(o,a,Gie,fQ(t,!1))}function gQ(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
`)||/[ \t]\n|\n[ \t]/.test(e))return hQ(e,t);let n=t.indent||(pQ(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:uQ(r,n,cQ,fQ(t,!1))}function _Q(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=hQ;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?gQ:i&&!t?hQ:n?gQ:hQ}return r(e,t)}var vQ;try{vQ=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:YY(o,a,JY,ZY(t,!1))}function tX(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
`)||/[ \t]\n|\n[ \t]/.test(e))return eX(e,t);let n=t.indent||(QY(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:YY(r,n,KY,ZY(t,!1))}function nX(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=eX;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?tX:i&&!t?eX:n?tX:eX}return r(e,t)}var rX;try{rX=RegExp(`(^|(?<!
))
+(?!
|$)`,`g`)}catch{vQ=/\n+(?!\n|$)/g}function yQ({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 _Q(n,r);let l=r.indent||(r.forceBlockIndent||pQ(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===QZ.BLOCK_FOLDED?!1:t===QZ.BLOCK_LITERAL||!mQ(n,c,l.length);if(!n)return u?`|
|$)`,`g`)}catch{rX=/\n+(?!\n|$)/g}function iX({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 nX(n,r);let l=r.indent||(r.forceBlockIndent||QY(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===IY.BLOCK_FOLDED?!1:t===IY.BLOCK_LITERAL||!$Y(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(vQ,`$&${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(rX,`$&${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=fQ(r,!0);o!==`folded`&&t!==QZ.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=uQ(`${v}${e}${p}`,l,lQ,a);if(!i)return`>${y}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${y}\n${l}${v}${n}${p}`}function bQ(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 _Q(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
`)?_Q(a,t):yQ(e,t,n,r);if(!s&&!u&&i!==QZ.PLAIN&&a.includes(`
`))return yQ(e,t,n,r);if(pQ(a)){if(c===``)return t.forceBlockIndent=!0,yQ(e,t,n,r);if(s&&c===l)return _Q(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 _Q(a,t)}return s?d:uQ(d,c,cQ,fQ(t,!1))}function xQ(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!==QZ.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=QZ.QUOTE_DOUBLE);let c=e=>{switch(e){case QZ.BLOCK_FOLDED:case QZ.BLOCK_LITERAL:return i||a?_Q(o.value,t):yQ(o,t,n,r);case QZ.QUOTE_DOUBLE:return hQ(o.value,t);case QZ.QUOTE_SINGLE:return gQ(o.value,t);case QZ.PLAIN:return bQ(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 SQ(e,t){let n=Object.assign({blockQuote:!0,commentString:aQ,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 CQ(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(EZ(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 wQ(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(EZ(e)||OZ(e))&&e.anchor;a&&HZ(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 TQ(e,t,n,r){if(TZ(e))return e.toString(t,n,r);if(SZ(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=kZ(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=CQ(t.doc.schema.tags,a);let o=wQ(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):EZ(a)?xQ(a,t,n,r):a.toString(t,n,r);return o?EZ(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function EQ({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=kZ(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(OZ(e)||!kZ(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||OZ(e)||(EZ(e)?e.type===QZ.BLOCK_FOLDED||e.type===QZ.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=TQ(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+=sQ(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=sQ(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=sQ(g,n.indent,l(f))));let _,v,y;kZ(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&&EZ(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&DZ(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let b=!1,x=TQ(t,n,()=>b=!0,()=>h=!0),S=` `;if(f||_||v){if(S=_?`
`:``,v){let e=l(v);S+=`\n${oQ(e,n.indent)}`}x===``&&!n.inFlow?S===`
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\n+/g,`$&${l}`),i=!1,a=ZY(r,!0);o!==`folded`&&t!==IY.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=YY(`${v}${e}${p}`,l,qY,a);if(!i)return`>${y}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${y}\n${l}${v}${n}${p}`}function aX(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 nX(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
`)?nX(a,t):iX(e,t,n,r);if(!s&&!u&&i!==IY.PLAIN&&a.includes(`
`))return iX(e,t,n,r);if(QY(a)){if(c===``)return t.forceBlockIndent=!0,iX(e,t,n,r);if(s&&c===l)return nX(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 nX(a,t)}return s?d:YY(d,c,KY,ZY(t,!1))}function oX(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!==IY.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=IY.QUOTE_DOUBLE);let c=e=>{switch(e){case IY.BLOCK_FOLDED:case IY.BLOCK_LITERAL:return i||a?nX(o.value,t):iX(o,t,n,r);case IY.QUOTE_DOUBLE:return eX(o.value,t);case IY.QUOTE_SINGLE:return tX(o.value,t);case IY.PLAIN:return aX(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 sX(e,t){let n=Object.assign({blockQuote:!0,commentString:UY,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 cX(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(uY(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 lX(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(uY(e)||fY(e))&&e.anchor;a&&EY(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 uX(e,t,n,r){if(lY(e))return e.toString(t,n,r);if(oY(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=pY(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=cX(t.doc.schema.tags,a);let o=lX(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):uY(a)?oX(a,t,n,r):a.toString(t,n,r);return o?uY(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function dX({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=pY(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(fY(e)||!pY(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||fY(e)||(uY(e)?e.type===IY.BLOCK_FOLDED||e.type===IY.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=uX(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+=GY(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=GY(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=GY(g,n.indent,l(f))));let _,v,y;pY(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&&uY(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&dY(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let b=!1,x=uX(t,n,()=>b=!0,()=>h=!0),S=` `;if(f||_||v){if(S=_?`
`:``,v){let e=l(v);S+=`\n${WY(e,n.indent)}`}x===``&&!n.inFlow?S===`
`&&y&&(S=`
`):S+=`\n${n.indent}`}else if(!p&&OZ(t)){let e=x[0],r=x.indexOf(`
`):S+=`\n${n.indent}`}else if(!p&&fY(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+=sQ(g,n.indent,l(y)):h&&i&&i(),g}function DQ(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}var OQ=`<<`,kQ={identify:e=>e===OQ||typeof e==`symbol`&&e.description===OQ,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new QZ(Symbol(OQ)),{addToJSMap:jQ}),stringify:()=>OQ},AQ=(e,t)=>(kQ.identify(t)||EZ(t)&&(!t.type||t.type===QZ.PLAIN)&&kQ.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===kQ.tag&&e.default);function jQ(e,t,n){let r=NQ(e,n);if(DZ(r))for(let n of r.items)MQ(e,t,n);else if(Array.isArray(r))for(let n of r)MQ(e,t,n);else MQ(e,t,r)}function MQ(e,t,n){let r=NQ(e,n);if(!wZ(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 NQ(e,t){return e&&SZ(t)?t.resolve(e.doc,e):t}function PQ(e,t,{key:n,value:r}){if(kZ(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(AQ(e,n))jQ(e,t,r);else{let i=qZ(n,``,e);if(t instanceof Map)t.set(i,qZ(r,i,e));else if(t instanceof Set)t.add(i);else{let a=FQ(n,i,e),o=qZ(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function FQ(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(kZ(e)&&n?.doc){let t=SQ(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)+`..."`),DQ(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${e}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(t)}function IQ(e,t,n){return new LQ(tQ(e,void 0,n),tQ(t,void 0,n))}var LQ=class e{constructor(e,t=null){Object.defineProperty(this,xZ,{value:vZ}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return kZ(n)&&(n=n.clone(t)),kZ(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return PQ(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?EQ(this,e,t,n):JSON.stringify(this)}};function RQ(e,t,n){return(t.inFlow??e.flow?BQ:zQ)(e,t,n)}function zQ({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(kZ(i))!d&&i.spaceBefore&&f.push(``),VQ(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(TZ(i)){let e=kZ(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),VQ(n,f,e.commentBefore,d))}d=!1;let s=TQ(i,u,()=>o=null,()=>d=!0);o&&(s+=sQ(s,a,l(o))),d&&o&&(d=!1),f.push(r+s)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let e=1;e<f.length;++e){let t=f[e];p+=t?`\n${c}${t}`:`
`)&&(S=``);return g+=S+x,n.inFlow?b&&r&&r():y&&!b?g+=GY(g,n.indent,l(y)):h&&i&&i(),g}function fX(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}var pX=`<<`,mX={identify:e=>e===pX||typeof e==`symbol`&&e.description===pX,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new IY(Symbol(pX)),{addToJSMap:gX}),stringify:()=>pX},hX=(e,t)=>(mX.identify(t)||uY(t)&&(!t.type||t.type===IY.PLAIN)&&mX.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===mX.tag&&e.default);function gX(e,t,n){let r=vX(e,n);if(dY(r))for(let n of r.items)_X(e,t,n);else if(Array.isArray(r))for(let n of r)_X(e,t,n);else _X(e,t,r)}function _X(e,t,n){let r=vX(e,n);if(!cY(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 vX(e,t){return e&&oY(t)?t.resolve(e.doc,e):t}function yX(e,t,{key:n,value:r}){if(pY(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(hX(e,n))gX(e,t,r);else{let i=jY(n,``,e);if(t instanceof Map)t.set(i,jY(r,i,e));else if(t instanceof Set)t.add(i);else{let a=bX(n,i,e),o=jY(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function bX(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(pY(e)&&n?.doc){let t=sX(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)+`..."`),fX(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 xX(e,t,n){return new SX(zY(e,void 0,n),zY(t,void 0,n))}var SX=class e{constructor(e,t=null){Object.defineProperty(this,aY,{value:nY}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return pY(n)&&(n=n.clone(t)),pY(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return yX(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?dX(this,e,t,n):JSON.stringify(this)}};function CX(e,t,n){return(t.inFlow??e.flow?TX:wX)(e,t,n)}function wX({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(pY(i))!d&&i.spaceBefore&&f.push(``),EX(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(lY(i)){let e=pY(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),EX(n,f,e.commentBefore,d))}d=!1;let s=uX(i,u,()=>o=null,()=>d=!0);o&&(s+=GY(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+=`
`+oQ(l(e),c),s&&s()):d&&o&&o(),p}function BQ({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(kZ(i))i.spaceBefore&&d.push(``),VQ(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(TZ(i)){let e=kZ(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),VQ(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=kZ(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=TQ(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+=sQ(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 VQ({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=oQ(t(r),e);n.push(i.trimStart())}}function HQ(e,t){let n=EZ(t)?t.value:t;for(let r of e)if(TZ(r)&&(r.key===t||r.key===n||EZ(r.key)&&r.key.value===n))return r}var UQ=class extends iQ{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(_Z,e),this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:i}=n,a=new this(e),o=(e,o)=>{if(typeof i==`function`)o=i.call(t,e,o);else if(Array.isArray(i)&&!i.includes(e))return;(o!==void 0||r)&&a.items.push(IQ(e,o,n))};if(t instanceof Map)for(let[e,n]of t)o(e,n);else if(t&&typeof t==`object`)for(let e of Object.keys(t))o(e,t[e]);return typeof e.sortMapEntries==`function`&&a.items.sort(e.sortMapEntries),a}add(e,t){let n;n=TZ(e)?e:!e||typeof e!=`object`||!(`key`in e)?new LQ(e,e?.value):new LQ(e.key,e.value);let r=HQ(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);EZ(r.value)&&ZZ(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=HQ(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=HQ(this.items,e)?.value;return(!t&&EZ(n)?n.value:n)??void 0}has(e){return!!HQ(this.items,e)}set(e,t){this.add(new LQ(e,t),!0)}toJSON(e,t,n){let r=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(r);for(let e of this.items)PQ(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!TZ(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})),RQ(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},WQ={collection:`map`,default:!0,nodeClass:UQ,tag:`tag:yaml.org,2002:map`,resolve(e,t){return wZ(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>UQ.from(e,t,n)},GQ=class extends iQ{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(bZ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=KQ(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=KQ(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&EZ(r)?r.value:r}has(e){let t=KQ(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=KQ(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];EZ(r)&&ZZ(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(qZ(e,String(r++),t));return n}toString(e,t,n){return e?RQ(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(tQ(a,void 0,n))}}return i}};function KQ(e){let t=EZ(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var qQ={collection:`seq`,default:!0,nodeClass:GQ,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return DZ(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>GQ.from(e,t,n)},JQ={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),xQ(e,t,n,r)}},YQ={identify:e=>e==null,createNode:()=>new QZ(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new QZ(null),stringify:({source:e},t)=>typeof e==`string`&&YQ.test.test(e)?e:t.options.nullStr},XQ={identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new QZ(e[0]===`t`||e[0]===`T`),stringify({source:e,value:t},n){return e&&XQ.test.test(e)&&t===(e[0]===`t`||e[0]===`T`)?e:t?n.options.trueStr:n.options.falseStr}};function ZQ({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 QQ={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:ZQ},$Q={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 xQ({comment:e,type:t,value:s},r,i,a)}};function p$(e,t){if(DZ(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!TZ(r)){if(wZ(r)){r.items.length>1&&t(`Each pair must have its own sequence indicator`);let e=r.items[0]||new LQ(new QZ(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]=TZ(r)?r:new LQ(r)}}else t(`Expected a sequence for this tag`);return e}function m$(e,t,n){let{replacer:r}=n,i=new GQ(e);i.tag=`tag:yaml.org,2002:pairs`;let a=0;if(t&&Symbol.iterator in Object(t))for(let e of t){typeof r==`function`&&(e=r.call(t,String(a++),e));let o,s;if(Array.isArray(e)){if(e.length===2)o=e[0],s=e[1];else throw TypeError(`Expected [key, value] tuple: ${e}`)}else if(e&&e instanceof Object){let t=Object.keys(e);if(t.length===1)o=t[0],s=e[o];else throw TypeError(`Expected tuple with one key, not ${t.length} keys`)}else o=e;i.items.push(IQ(o,s,n))}return i}var h$={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:p$,createNode:m$},g$=class e extends GQ{constructor(){super(),this.add=UQ.prototype.add.bind(this),this.delete=UQ.prototype.delete.bind(this),this.get=UQ.prototype.get.bind(this),this.has=UQ.prototype.has.bind(this),this.set=UQ.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(TZ(e)?(r=qZ(e.key,``,t),i=qZ(e.value,r,t)):r=qZ(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=m$(e,t,n),i=new this;return i.items=r.items,i}};g$.tag=`tag:yaml.org,2002:omap`;var _$={collection:`seq`,identify:e=>e instanceof Map,nodeClass:g$,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,t){let n=p$(e,t),r=[];for(let{key:e}of n.items)EZ(e)&&(r.includes(e.value)?t(`Ordered maps must not include duplicate keys: ${e.value}`):r.push(e.value));return Object.assign(new g$,n)},createNode:(e,t,n)=>g$.from(e,t,n)};function v$({value:e,source:t},n){return t&&(e?y$:b$).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var y$={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 QZ(!0),stringify:v$},b$={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 QZ(!1),stringify:v$},x$={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:ZQ},S$={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():ZQ(e)}},C$={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 QZ(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:ZQ},w$=e=>typeof e==`bigint`||Number.isInteger(e);function T$(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 E$(e,t,n){let{value:r}=e;if(w$(r)){let e=r.toString(t);return r<0?`-`+n+e.substr(1):n+e}return ZQ(e)}var D$={identify:w$,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>T$(e,2,2,n),stringify:e=>E$(e,2,`0b`)},O$={identify:w$,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>T$(e,1,8,n),stringify:e=>E$(e,8,`0`)},k$={identify:w$,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>T$(e,0,10,n),stringify:ZQ},A$={identify:w$,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>T$(e,2,16,n),stringify:e=>E$(e,16,`0x`)},j$=class e extends UQ{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=TZ(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new LQ(e.key,null):new LQ(e,null),HQ(this.items,t.key)||this.items.push(t)}get(e,t){let n=HQ(this.items,e);return!t&&TZ(n)?EZ(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=HQ(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new LQ(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return s Line truncated
`)?(n.push(`...`),n.push(oQ(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(oQ(a(t),``)))}return n.join(`
`+WY(l(e),c),s&&s()):d&&o&&o(),p}function TX({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(pY(i))i.spaceBefore&&d.push(``),EX(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(lY(i)){let e=pY(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),EX(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=pY(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=uX(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+=GY(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 EX({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=WY(t(r),e);n.push(i.trimStart())}}function DX(e,t){let n=uY(t)?t.value:t;for(let r of e)if(lY(r)&&(r.key===t||r.key===n||uY(r.key)&&r.key.value===n))return r}var OX=class extends HY{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(tY,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(xX(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=lY(e)?e:!e||typeof e!=`object`||!(`key`in e)?new SX(e,e?.value):new SX(e.key,e.value);let r=DX(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);uY(r.value)&&FY(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=DX(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=DX(this.items,e)?.value;return(!t&&uY(n)?n.value:n)??void 0}has(e){return!!DX(this.items,e)}set(e,t){this.add(new SX(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)yX(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!lY(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})),CX(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},kX={collection:`map`,default:!0,nodeClass:OX,tag:`tag:yaml.org,2002:map`,resolve(e,t){return cY(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>OX.from(e,t,n)},AX=class extends HY{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(iY,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=jX(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=jX(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&uY(r)?r.value:r}has(e){let t=jX(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=jX(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];uY(r)&&FY(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(jY(e,String(r++),t));return n}toString(e,t,n){return e?CX(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(zY(a,void 0,n))}}return i}};function jX(e){let t=uY(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var MX={collection:`seq`,default:!0,nodeClass:AX,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return dY(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>AX.from(e,t,n)},NX={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),oX(e,t,n,r)}},PX={identify:e=>e==null,createNode:()=>new IY(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new IY(null),stringify:({source:e},t)=>typeof e==`string`&&PX.test.test(e)?e:t.options.nullStr},FX={identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new IY(e[0]===`t`||e[0]===`T`),stringify({source:e,value:t},n){return e&&FX.test.test(e)&&t===(e[0]===`t`||e[0]===`T`)?e:t?n.options.trueStr:n.options.falseStr}};function IX({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 LX={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:IX},RX={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 oX({comment:e,type:t,value:s},r,i,a)}};function QX(e,t){if(dY(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!lY(r)){if(cY(r)){r.items.length>1&&t(`Each pair must have its own sequence indicator`);let e=r.items[0]||new SX(new IY(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]=lY(r)?r:new SX(r)}}else t(`Expected a sequence for this tag`);return e}function $X(e,t,n){let{replacer:r}=n,i=new AX(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(xX(o,s,n))}return i}var eZ={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:QX,createNode:$X},tZ=class e extends AX{constructor(){super(),this.add=OX.prototype.add.bind(this),this.delete=OX.prototype.delete.bind(this),this.get=OX.prototype.get.bind(this),this.has=OX.prototype.has.bind(this),this.set=OX.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(lY(e)?(r=jY(e.key,``,t),i=jY(e.value,r,t)):r=jY(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=$X(e,t,n),i=new this;return i.items=r.items,i}};tZ.tag=`tag:yaml.org,2002:omap`;var nZ={collection:`seq`,identify:e=>e instanceof Map,nodeClass:tZ,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,t){let n=QX(e,t),r=[];for(let{key:e}of n.items)uY(e)&&(r.includes(e.value)?t(`Ordered maps must not include duplicate keys: ${e.value}`):r.push(e.value));return Object.assign(new tZ,n)},createNode:(e,t,n)=>tZ.from(e,t,n)};function rZ({value:e,source:t},n){return t&&(e?iZ:aZ).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var iZ={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 IY(!0),stringify:rZ},aZ={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 IY(!1),stringify:rZ},oZ={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:IX},sZ={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():IX(e)}},cZ={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 IY(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:IX},lZ=e=>typeof e==`bigint`||Number.isInteger(e);function uZ(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 dZ(e,t,n){let{value:r}=e;if(lZ(r)){let e=r.toString(t);return r<0?`-`+n+e.substr(1):n+e}return IX(e)}var fZ={identify:lZ,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>uZ(e,2,2,n),stringify:e=>dZ(e,2,`0b`)},pZ={identify:lZ,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>uZ(e,1,8,n),stringify:e=>dZ(e,8,`0`)},mZ={identify:lZ,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>uZ(e,0,10,n),stringify:IX},hZ={identify:lZ,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>uZ(e,2,16,n),stringify:e=>dZ(e,16,`0x`)},gZ=class e extends OX{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=lY(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new SX(e.key,null):new SX(e,null),DX(this.items,t.key)||this.items.push(t)}get(e,t){let n=DX(this.items,e);return!t&&lY(n)?uY(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=DX(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new SX(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(WY(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(WY(a(t),``)))}return n.join(`
`)+`
`}var K$=class e{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,xZ,{value:gZ});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 VZ({version:a}),this.setSchema(a,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){let t=Object.create(e.prototype,{[xZ]:{value:gZ}});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=kZ(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(e){q$(this.contents)&&this.contents.add(e)}addIn(e,t){q$(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=UZ(this);e.anchor=!t||n.has(t)?WZ(t||`a`,n):t}return new YZ(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}=GZ(this,a||`a`),p={aliasDuplicateObjects:i??!0,keepUndefined:s??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:f},m=tQ(e,l,p);return o&&OZ(m)&&(m.flow=!0),d(),m}createPair(e,t,n={}){return new LQ(this.createNode(e,null,n),this.createNode(t,null,n))}delete(e){return q$(this.contents)?this.contents.delete(e):!1}deleteIn(e){return rQ(e)?this.contents!=null&&(this.contents=null,!0):q$(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return OZ(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return rQ(e)?!t&&EZ(this.contents)?this.contents.value:this.contents:OZ(this.contents)?this.contents.getIn(e,t):void 0}has(e){return OZ(this.contents)?this.contents.has(e):!1}hasIn(e){return rQ(e)?this.contents!==void 0:OZ(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=nQ(this.schema,[e],t):q$(this.contents)&&this.contents.set(e,t)}setIn(e,t){rQ(e)?this.contents=t:this.contents==null?this.contents=nQ(this.schema,Array.from(e),t):q$(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 VZ({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 VZ({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 W$(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=qZ(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`?KZ(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 G$(this,e)}};function q$(e){if(OZ(e))return!0;throw Error(`Expected a YAML collection as document contents`)}var J$=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},Y$=class extends J${constructor(e,t,n){super(`YAMLParseError`,e,t,n)}},X$=class extends J${constructor(e,t,n){super(`YAMLWarning`,e,t,n)}},Z$=(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 Q$(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 $$(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($$(t.key)||$$(t.value))return!0}return!1;default:return!0}}function e1(e,t,n){if(t?.type===`flow-collection`){let r=t.end[0];r.indent===e&&(r.source===`]`||r.source===`}`)&&$$(t)&&n(r,`BAD_INDENT`,`Flow end indicator should be more indented than parent`,!0)}}function t1(e,t,n){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let i=typeof r==`function`?r:(e,t)=>e===t||EZ(e)&&EZ(t)&&e.value===t.value;return t.some(e=>i(e.key,n))}var n1=`All mapping items must start at the same column`;function r1({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??UQ)(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=Q$(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`,n1)),!p.anchor&&!p.tag&&!d){c=p.end,p.comment&&(o.comment?o.comment+=`
`+p.comment:o.comment=p.comment);continue}(p.newlineAfterProp||$$(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`,n1);n.atKey=!0;let h=p.end,g=u?e(n,u,p,i):t(n,h,l,null,p,i);n.schema.compat&&e1(r.indent,u,i),n.atKey=!1,t1(n,o.items,g)&&i(h,`DUPLICATE_KEY`,`Map keys must be unique`);let _=Q$(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&&e1(r.indent,f,i),s=c.range[2];let l=new LQ(g,c);n.options.keepSourceTokens&&(l.srcToken=a),o.items.push(l)}else{m&&i(g.range,`MISSING_CHAR`,`Implicit map keys need to be followed by map values`),_.comment&&(g.comment?g.comment+=`
`+_.comment:g.comment=_.comment);let e=new LQ(g);n.options.keepSourceTokens&&(e.srcToken=a),o.items.push(e)}}return c&&c<s&&i(c,`IMPOSSIBLE`,`Map comment with trailing content`),o.range=[r.offset,s,c??s],o}function i1({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??GQ)(n.schema);n.atRoot&&=!1,n.atKey&&=!1;let s=r.offset,c=null;for(let{start:a,value:l}of r.items){let u=Q$(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&&e1(r.indent,l,i),s=d.range[2],o.items.push(d)}return o.range=[r.offset,s,c??s],o}function a1(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 o1=`Block collections are not allowed within flow collections`,s1=e=>e&&(e.type===`block-map`||e.type===`block-seq`);function c1({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=r.start.source===`{`,s=o?`flow map`:`flow sequence`,c=new((a?.nodeClass)??(o?UQ:GQ))(n.schema);c.flow=!0;let l=n.atRoot;l&&(n.atRoot=!1),n.atKey&&=!1;let u=r.offset+r.start.source.length;for(let a=0;a<r.items.length;++a){let l=r.items[a],{start:d,key:f,sep:p,value:m}=l,h=Q$(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&&$$(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];TZ(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],s1(m)&&i(r.range,`BLOCK_IN_FLOW`,o1)}else{n.atKey=!0;let a=h.end,g=f?e(n,f,h,i):t(n,a,d,null,h,i);s1(f)&&i(g.range,`BLOCK_IN_FLOW`,o1),n.atKey=!1;let _=Q$(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?s1(m)&&i(v.range,`BLOCK_IN_FLOW`,o1):_.comment&&(g.comment?g.comment+=`
`+_.comment:g.comment=_.comment);let y=new LQ(g,v);if(n.options.keepSourceTokens&&(y.srcToken=l),o){let e=c;t1(n,e.items,g)&&i(a,`DUPLICATE_KEY`,`Map keys must be unique`),e.items.push(y)}else{let e=new UQ(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=a1(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 l1(e,t,n,r,i,a){let o=n.type===`block-map`?r1(e,t,n,r,a):n.type===`block-seq`?i1(e,t,n,r,a):c1(e,t,n,r,a),s=o.constructor;return i===`!`||i===s.tagName?(o.tag=s.tagName,o):(i&&(o.tag=i),o)}function u1(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===UQ.tagName&&s===`map`||o===GQ.tagName&&s===`seq`)return l1(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),l1(e,t,n,i,o)}let l=l1(e,t,n,i,o,c),u=c.resolve?.(l,e=>i(a,`TAG_RESOLVE_FAILED`,e),t.options)??l,d=kZ(u)?u:new QZ(u);return d.range=l.range,d.tag=o,c?.format&&(d.format=c.format),d}function d1(e,t,n){let r=t.offset,i=f1(t,e.options.strict,n);if(!i)return{value:``,type:null,comment:``,range:[r,r,r]};let a=i.mode===`>`?QZ.BLOCK_FOLDED:QZ.BLOCK_LITERAL,o=t.source?p1(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 jZ=class e{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,aY,{value:eY});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 TY({version:a}),this.setSchema(a,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){let t=Object.create(e.prototype,{[aY]:{value:eY}});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=pY(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(e){MZ(this.contents)&&this.contents.add(e)}addIn(e,t){MZ(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=DY(this);e.anchor=!t||n.has(t)?OY(t||`a`,n):t}return new NY(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}=kY(this,a||`a`),p={aliasDuplicateObjects:i??!0,keepUndefined:s??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:f},m=zY(e,l,p);return o&&fY(m)&&(m.flow=!0),d(),m}createPair(e,t,n={}){return new SX(this.createNode(e,null,n),this.createNode(t,null,n))}delete(e){return MZ(this.contents)?this.contents.delete(e):!1}deleteIn(e){return VY(e)?this.contents!=null&&(this.contents=null,!0):MZ(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return fY(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return VY(e)?!t&&uY(this.contents)?this.contents.value:this.contents:fY(this.contents)?this.contents.getIn(e,t):void 0}has(e){return fY(this.contents)?this.contents.has(e):!1}hasIn(e){return VY(e)?this.contents!==void 0:fY(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=BY(this.schema,[e],t):MZ(this.contents)&&this.contents.set(e,t)}setIn(e,t){VY(e)?this.contents=t:this.contents==null?this.contents=BY(this.schema,Array.from(e),t):MZ(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 TY({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 TY({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 kZ(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=jY(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`?AY(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 AZ(this,e)}};function MZ(e){if(fY(e))return!0;throw Error(`Expected a YAML collection as document contents`)}var NZ=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},PZ=class extends NZ{constructor(e,t,n){super(`YAMLParseError`,e,t,n)}},FZ=class extends NZ{constructor(e,t,n){super(`YAMLWarning`,e,t,n)}},IZ=(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 LZ(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],ee=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:ee,start:x??ee}}function RZ(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(RZ(t.key)||RZ(t.value))return!0}return!1;default:return!0}}function zZ(e,t,n){if(t?.type===`flow-collection`){let r=t.end[0];r.indent===e&&(r.source===`]`||r.source===`}`)&&RZ(t)&&n(r,`BAD_INDENT`,`Flow end indicator should be more indented than parent`,!0)}}function BZ(e,t,n){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let i=typeof r==`function`?r:(e,t)=>e===t||uY(e)&&uY(t)&&e.value===t.value;return t.some(e=>i(e.key,n))}var VZ=`All mapping items must start at the same column`;function HZ({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??OX)(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=LZ(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`,VZ)),!p.anchor&&!p.tag&&!d){c=p.end,p.comment&&(o.comment?o.comment+=`
`+p.comment:o.comment=p.comment);continue}(p.newlineAfterProp||RZ(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`,VZ);n.atKey=!0;let h=p.end,g=u?e(n,u,p,i):t(n,h,l,null,p,i);n.schema.compat&&zZ(r.indent,u,i),n.atKey=!1,BZ(n,o.items,g)&&i(h,`DUPLICATE_KEY`,`Map keys must be unique`);let _=LZ(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&&zZ(r.indent,f,i),s=c.range[2];let l=new SX(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 SX(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 UZ({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??AX)(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=LZ(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&&zZ(r.indent,l,i),s=d.range[2],o.items.push(d)}return o.range=[r.offset,s,c??s],o}function WZ(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 GZ=`Block collections are not allowed within flow collections`,KZ=e=>e&&(e.type===`block-map`||e.type===`block-seq`);function qZ({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=r.start.source===`{`,s=o?`flow map`:`flow sequence`,c=new((a?.nodeClass)??(o?OX:AX))(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=LZ(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&&RZ(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];lY(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],KZ(m)&&i(r.range,`BLOCK_IN_FLOW`,GZ)}else{n.atKey=!0;let a=h.end,g=f?e(n,f,h,i):t(n,a,d,null,h,i);KZ(f)&&i(g.range,`BLOCK_IN_FLOW`,GZ),n.atKey=!1;let _=LZ(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?KZ(m)&&i(v.range,`BLOCK_IN_FLOW`,GZ):_.comment&&(g.comment?g.comment+=`
`+_.comment:g.comment=_.comment);let y=new SX(g,v);if(n.options.keepSourceTokens&&(y.srcToken=l),o){let e=c;BZ(n,e.items,g)&&i(a,`DUPLICATE_KEY`,`Map keys must be unique`),e.items.push(y)}else{let e=new OX(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=WZ(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 JZ(e,t,n,r,i,a){let o=n.type===`block-map`?HZ(e,t,n,r,a):n.type===`block-seq`?UZ(e,t,n,r,a):qZ(e,t,n,r,a),s=o.constructor;return i===`!`||i===s.tagName?(o.tag=s.tagName,o):(i&&(o.tag=i),o)}function YZ(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===OX.tagName&&s===`map`||o===AX.tagName&&s===`seq`)return JZ(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),JZ(e,t,n,i,o)}let l=JZ(e,t,n,i,o,c),u=c.resolve?.(l,e=>i(a,`TAG_RESOLVE_FAILED`,e),t.options)??l,d=pY(u)?u:new IY(u);return d.range=l.range,d.tag=o,c?.format&&(d.format=c.format),d}function XZ(e,t,n){let r=t.offset,i=ZZ(t,e.options.strict,n);if(!i)return{value:``,type:null,comment:``,range:[r,r,r]};let a=i.mode===`>`?IY.BLOCK_FOLDED:IY.BLOCK_LITERAL,o=t.source?QZ(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===QZ.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===IY.BLOCK_LITERAL?(d+=f+t.slice(c)+r,f=`
`):t.length>c||r[0]===` `?(f===` `?f=`
`:!p&&f===`
`&&(f=`
@@ -247,59 +247,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 f1({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 p1(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 m1(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=QZ.PLAIN,c=h1(a,l);break;case`single-quoted-scalar`:s=QZ.QUOTE_SINGLE,c=g1(a,l);break;case`double-quoted-scalar`:s=QZ.QUOTE_DOUBLE,c=v1(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=a1(o,u,t,n);return{value:c,type:s,comment:d.comment,range:[r,u,d.offset]}}function h1(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}`),_1(e)}function g1(e,t){return(e[e.length-1]!==`'`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing 'quote`),_1(e.slice(1,-1)).replace(/''/g,`'`)}function _1(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 ZZ({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 QZ(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 $Z(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=IY.PLAIN,c=eQ(a,l);break;case`single-quoted-scalar`:s=IY.QUOTE_SINGLE,c=tQ(a,l);break;case`double-quoted-scalar`:s=IY.QUOTE_DOUBLE,c=rQ(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=WZ(o,u,t,n);return{value:c,type:s,comment:d.comment,range:[r,u,d.offset]}}function eQ(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}`),nQ(e)}function tQ(e,t){return(e[e.length-1]!==`'`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing 'quote`),nQ(e.slice(1,-1)).replace(/''/g,`'`)}function nQ(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 v1(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 rQ(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}=y1(e,r);n+=t,r=i}else if(i===`\\`){let i=e[++r],a=b1[i];if(a)n+=a;else if(i===`
`){let{fold:t,offset:i}=iQ(e,r);n+=t,r=i}else if(i===`\\`){let i=e[++r],a=aQ[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+=x1(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+=oQ(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 y1(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 iQ(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 b1={0:`\0`,a:`\x07`,b:`\b`,e:`\x1B`,f:`\f`,n:`
`,r:`\r`,t:` `,v:`\v`,N:`…`,_:`\xA0`,L:`\u2028`,P:`\u2029`," ":` `,'"':`"`,"/":`/`,"\\":`\\`," ":` `};function x1(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 S1(e,t,n,r){let{value:i,type:a,comment:o,range:s}=t.type===`block-scalar`?d1(e,t,r):m1(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[yZ]:c?C1(e.schema,i,c,n,r):t.type===`scalar`?w1(e,i,t,r):e.schema[yZ];let u;try{let a=l.resolve(i,e=>r(n??t,`TAG_RESOLVE_FAILED`,e),e.options);u=EZ(a)?a:new QZ(a)}catch(e){let a=e instanceof Error?e.message:String(e);r(n??t,`TAG_RESOLVE_FAILED`,a),u=new QZ(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 C1(e,t,n,r,i){if(n===`!`)return e[yZ];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[yZ])}function w1({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[yZ];if(n.compat){let e=n.compat.find(e=>e.default&&e.test?.test(r))??n[yZ];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 T1(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 E1={composeNode:D1,composeEmptyNode:O1};function D1(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=k1(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=S1(e,t,c,r),s&&(l.anchor=s.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:try{l=u1(E1,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??=O1(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&&(!EZ(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 O1(e,t,n,r,{spaceBefore:i,comment:a,anchor:o,tag:s,end:c},l){let u=S1(e,{type:`scalar`,offset:T1(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 k1({options:e},{offset:t,source:n,end:r},i){let a=new YZ(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=a1(r,o,e.strict,i);return a.range=[t,o,s.offset],s.comment&&(a.comment=s.comment),a}function A1(e,t,{offset:n,start:r,value:i,end:a},o){let s=new K$(void 0,Object.assign({_directives:t},e)),c={atKey:!1,atRoot:!0,directives:s.directives,options:s.options,schema:s.schema},l=Q$(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?D1(c,i,l,o):O1(c,l.end,r,null,l,o);let u=s.contents.range[2],d=a1(a,u,!1,o);return d.comment&&(s.comment=d.comment),s.range=[n,u,d.offset],s}function j1(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 M1(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 aQ={0:`\0`,a:`\x07`,b:`\b`,e:`\x1B`,f:`\f`,n:`
`,r:`\r`,t:` `,v:`\v`,N:`…`,_:`\xA0`,L:`\u2028`,P:`\u2029`," ":` `,'"':`"`,"/":`/`,"\\":`\\`," ":` `};function oQ(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 sQ(e,t,n,r){let{value:i,type:a,comment:o,range:s}=t.type===`block-scalar`?XZ(e,t,r):$Z(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[rY]:c?cQ(e.schema,i,c,n,r):t.type===`scalar`?lQ(e,i,t,r):e.schema[rY];let u;try{let a=l.resolve(i,e=>r(n??t,`TAG_RESOLVE_FAILED`,e),e.options);u=uY(a)?a:new IY(a)}catch(e){let a=e instanceof Error?e.message:String(e);r(n??t,`TAG_RESOLVE_FAILED`,a),u=new IY(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 cQ(e,t,n,r,i){if(n===`!`)return e[rY];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[rY])}function lQ({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[rY];if(n.compat){let e=n.compat.find(e=>e.default&&e.test?.test(r))??n[rY];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 uQ(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 dQ={composeNode:fQ,composeEmptyNode:pQ};function fQ(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=mQ(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=sQ(e,t,c,r),s&&(l.anchor=s.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:try{l=YZ(dQ,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??=pQ(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&&(!uY(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 pQ(e,t,n,r,{spaceBefore:i,comment:a,anchor:o,tag:s,end:c},l){let u=sQ(e,{type:`scalar`,offset:uQ(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 mQ({options:e},{offset:t,source:n,end:r},i){let a=new NY(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=WZ(r,o,e.strict,i);return a.range=[t,o,s.offset],s.comment&&(a.comment=s.comment),a}function hQ(e,t,{offset:n,start:r,value:i,end:a},o){let s=new jZ(void 0,Object.assign({_directives:t},e)),c={atKey:!1,atRoot:!0,directives:s.directives,options:s.options,schema:s.schema},l=LZ(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?fQ(c,i,l,o):pQ(c,l.end,r,null,l,o);let u=s.contents.range[2],d=WZ(a,u,!1,o);return d.comment&&(s.comment=d.comment),s.range=[n,u,d.offset],s}function gQ(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 _Q(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 N1=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,n,r)=>{let i=j1(e);r?this.warnings.push(new X$(i,t,n)):this.errors.push(new Y$(i,t,n))},this.directives=new VZ({version:e.version||`1.2`}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=M1(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(OZ(i)&&!i.flow&&i.items.length>0){let e=i.items[0];TZ(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:M1(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=j1(e);i[0]+=t,this.onError(i,`BAD_DIRECTIVE`,n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case`document`:{let t=A1(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 Y$(j1(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 Y$(j1(e),`UNEXPECTED_TOKEN`,`Unexpected doc-end without preceding document`));break}this.doc.directives.docEnd=!0;let t=a1(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 Y$(j1(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 K$(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}}},P1=Symbol(`break visit`),F1=Symbol(`skip children`),I1=Symbol(`remove item`);function L1(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),R1(Object.freeze([]),e,t)}L1.BREAK=P1,L1.SKIP=F1,L1.REMOVE=I1,L1.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},L1.parentCollection=(e,t)=>{let n=L1.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 R1(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=R1(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===P1)return P1;else r===I1&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}function z1(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 vQ=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,n,r)=>{let i=gQ(e);r?this.warnings.push(new FZ(i,t,n)):this.errors.push(new PZ(i,t,n))},this.directives=new TY({version:e.version||`1.2`}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=_Q(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(fY(i)&&!i.flow&&i.items.length>0){let e=i.items[0];lY(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:_Q(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=gQ(e);i[0]+=t,this.onError(i,`BAD_DIRECTIVE`,n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case`document`:{let t=hQ(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 PZ(gQ(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 PZ(gQ(e),`UNEXPECTED_TOKEN`,`Unexpected doc-end without preceding document`));break}this.doc.directives.docEnd=!0;let t=WZ(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 PZ(gQ(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 jZ(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}}},yQ=Symbol(`break visit`),bQ=Symbol(`skip children`),xQ=Symbol(`remove item`);function SQ(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),CQ(Object.freeze([]),e,t)}SQ.BREAK=yQ,SQ.SKIP=bQ,SQ.REMOVE=xQ,SQ.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},SQ.parentCollection=(e,t)=>{let n=SQ.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 CQ(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=CQ(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===yQ)return yQ;else r===xQ&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}function wQ(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 B1(e){switch(e){case void 0:case` `:case`
`:case`\r`:case` `:return!0;default:return!1}}var V1=new Set(`0123456789ABCDEFabcdef`),H1=new Set(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()`),U1=new Set(`,[]{}`),W1=new Set(` ,[]{}
\r `),G1=e=>!e||W1.has(e),K1=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 TQ(e){switch(e){case void 0:case` `:case`
`:case`\r`:case` `:return!0;default:return!1}}var EQ=new Set(`0123456789ABCDEFabcdef`),DQ=new Set(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()`),OQ=new Set(`,[]{}`),kQ=new Set(` ,[]{}
\r `),AQ=e=>!e||kQ.has(e),jQ=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===`...`)&&B1(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===`...`)&&B1(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&&!B1(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===`:`)&&B1(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(G1),`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(`...`))&&B1(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(G1),`flow`;case`"`:case`'`:return this.flowKey=!0,yield*this.parseQuotedScalar();case`:`:{let e=this.charAt(1);if(this.flowKey||B1(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===`...`)&&TQ(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===`...`)&&TQ(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&&!TQ(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===`:`)&&TQ(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(AQ),`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(`...`))&&TQ(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(AQ),`flow`;case`"`:case`'`:return this.flowKey=!0,yield*this.parseQuotedScalar();case`:`:{let e=this.charAt(1);if(this.flowKey||TQ(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=>B1(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=>TQ(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(B1(r)||e&&U1.has(r))break;t=n}else if(B1(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(TQ(r)||e&&OQ.has(r))break;t=n}else if(TQ(r)){let i=this.buffer[n+1];if(r===`\r`&&(i===`
`?(n+=1,r=`
`,i=this.buffer[n+1]):t=n),i===`#`||e&&U1.has(i))break;if(r===`
`){let e=this.continueScalar(n+1);if(e===-1)break;n=Math.max(n,e-2)}}else{if(e&&U1.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(G1),e+=yield*this.pushSpaces(!0);continue loop;case`-`:case`?`:case`:`:{let t=this.flowLevel>0,n=this.charAt(1);if(B1(n)||t&&U1.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(;!B1(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(H1.has(t))t=this.buffer[++e];else if(t===`%`&&V1.has(this.buffer[e+1])&&V1.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&&OQ.has(i))break;if(r===`
`){let e=this.continueScalar(n+1);if(e===-1)break;n=Math.max(n,e-2)}}else{if(e&&OQ.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(AQ),e+=yield*this.pushSpaces(!0);continue loop;case`-`:case`?`:case`:`:{let t=this.flowLevel>0,n=this.charAt(1);if(TQ(n)||t&&OQ.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(;!TQ(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(DQ.has(t))t=this.buffer[++e];else if(t===`%`&&EQ.has(this.buffer[e+1])&&EQ.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)}},q1=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 J1(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function Y1(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 X1(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 Z1(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 Q1(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 $1(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 e0(e){if(e.start.type===`flow-seq-start`)for(let t of e.items)t.sep&&!t.value&&!J1(t.start,`explicit-key-ind`)&&!J1(t.sep,`map-value-ind`)&&(t.key&&(t.value=t.key),delete t.key,X1(t.value)?t.value.end?$1(t.value.end,t.sep):t.value.end=t.sep:$1(t.start,t.sep),delete t.sep)}var t0=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 K1,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=z1(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`&&e0(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&&Y1(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)}},MQ=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 NQ(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function PQ(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 FQ(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 IQ(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 LQ(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 RQ(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 zQ(e){if(e.start.type===`flow-seq-start`)for(let t of e.items)t.sep&&!t.value&&!NQ(t.start,`explicit-key-ind`)&&!NQ(t.sep,`map-value-ind`)&&(t.key&&(t.value=t.key),delete t.key,FQ(t.value)?t.value.end?RQ(t.value.end,t.sep):t.value.end=t.sep:RQ(t.start,t.sep),delete t.sep)}var BQ=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 jQ,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=wQ(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`&&zQ(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&&PQ(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)){$1(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(J1(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=Q1(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(J1(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(X1(t.key)&&!J1(t.sep,`newline`)){let e=Q1(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]}):J1(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&&!J1(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)){$1(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||J1(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)){RQ(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(NQ(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=LQ(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(NQ(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(FQ(t.key)&&!NQ(t.sep,`newline`)){let e=LQ(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]}):NQ(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&&!NQ(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)){RQ(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||NQ(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=Q1(Z1(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=Q1(Z1(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 n0(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new q1||null,prettyErrors:t}}function r0(e,t={}){let{lineCounter:n,prettyErrors:r}=n0(t),i=new t0(n?.addNewLine),a=new N1(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 Y$(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(Z$(e,n)),o.warnings.forEach(Z$(e,n))),o}function i0(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let i=r0(e,n);if(!i)return null;if(i.warnings.forEach(e=>DQ(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 a0(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 CZ(e)&&!r?e.toString(n):new K$(e,r,n).toString(n)}var o0=e=>typeof e==`object`&&!!e&&!Array.isArray(e),s0=e=>o0(e)?Object.entries(e).map(([e,t])=>[e,Array.isArray(t)?t:[]]):[];function c0(e){if(o0(e)){if(o0(e.parallel))return{kind:`parallel`,base:[`parallel`],branches:s0(e.parallel)};if(o0(e.switch))return{kind:`switch`,base:[`switch`,`cases`],on:typeof e.switch.on==`string`?e.switch.on:``,branches:s0(e.switch.cases)}}}function l0(e){return e.slice(2).includes(`parallel`)}function u0(e,t){let n=r0(e).getIn(t,!0);if(wZ(n))return n.toJSON()}function d0(e,t,n){let r=r0(e);return r.setIn(t,r.createNode(C0(n))),r.toString()}function f0(e,t,n){let r=r0(e),i=t.slice(0,-1),a=l0(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(DZ(o)||(r.setIn(i,r.createNode([])),o=r.getIn(i,!0)),!DZ(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 p0(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 m0(e,t){let n=e.getIn(t,!0),r=c0(wZ(n)?n.toJSON():void 0),i=r?e.getIn([...t,...r.base],!0):void 0;if(!r||!wZ(i))throw Error(`This step has no branches.`);return{kind:r.kind,branches:i}}function h0(e,t,n){let r=r0(e),{kind:i,branches:a}=m0(r,t);if(p0(n,i),a.has(n))throw Error(`Branch ${n} already exists.`);return a.set(n,r.createNode([])),r.toString()}function g0(e,t,n,r){let i=r0(e),{kind:a,branches:o}=m0(i,t);if(p0(r,a),n!==r&&o.has(r))throw Error(`Branch ${r} already exists.`);let s=o.items.find(e=>EZ(e.key)&&e.key.value===n);if(!s||!EZ(s.key))throw Error(`Branch ${n} does not exist.`);return s.key.value=r,i.toString()}function _0(e,t,n){let r=r0(e),{kind:i,branches:a}=m0(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 R0(e,t){let n=JSON.stringify(e??{})+` `+(typeof t==`string`?`{{ ${t.replace(/^!/,``)} }}`:``);return[...new Set([...n.matchAll(P0)].map(e=>e[1]))]}function z0(e){let t=r0(e).toJS(),n=F0(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=F0(e)?e:{},p=c0(d),m=p?.kind??(typeof d.type==`string`?d.type:``),h=F0(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||N0(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\./,``)}`:I0(m,h),summary:L0(h),when:typeof d.when==`string`?d.when:void 0,retry:F0(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 R0([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=c0(t);if(n){let{kind:i,base:a,branches:o}=n,c=p(t,String(e+1),0,u*A0,void 0,void 0,[`steps`,e]);m(l,c,[`steps`,e-1]),u++;let d=F0(t)&&typeof t.id==`string`?t.id:i,f=i===`switch`&&!o.some(([e])=>e==="default"),h=o.length+ +!!f,g=[],_=Math.max(1,...o.map(([,e])=>e.length)),v=e=>(e-(h-1)/2)*j0,y=(e,t,n)=>r.push({id:e,type:`lane`,position:{x:t-12,y:u*A0-40},style:{width:`264px`,height:`${(_+1)*A0-24}px`},zIndex:-1,data:{kind:`step`,key:n,title:n,type:``,detail:``,lane:i}}),b=(u+_)*A0;if(o.forEach(([t,n],o)=>{let s=v(o),l=[c],f=[`steps`,e,...a,t];n.forEach((n,r)=>{let a=p(n,`${e+1}-${t}-${r+1}`,s,(u+r)*A0,t,d,[...f,r],i);m(l,a,[...f,r-1]),l=[a]});let h=`add-${e}-${t}`;r.push({id:h,type:`add`,position:{x:s+104,y:b},data:{kind:`step`,key:h,title:``,type:``,detail:``,branch:t,lane:i,insertAfter:[...f,n.length-1]}}),m(l,h),g.push(h),y(`lane-${e}-${t}`,s,t)}),f){let t=v(h-1),n=`pass-${e}`;r.push({id:n,type:`add`,position:{x:t+104,y:b},data:{kind:`step`,key:n,title:``,type:``,detail:``,lane:i}}),s.add(c),m([c],n),s.delete(c),g.push(n),y(`pass-lane-${e}`,t,`default`)}l=g,u+=_+1;continue}let i=p(t,String(e+1),0,u*A0,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*A0-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 B0={class:`truncate`},V0=`\0`,H0=P({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)=>(L(),q(V(zu),{"model-value":e.modelValue===``&&e.options.some(e=>e.value===``)?V0:e.modelValue||void 0,disabled:e.disabled,"onUpdate:modelValue":r[0]||=e=>n(`update:modelValue`,e===V0?``:String(e))},{default:I(()=>[A(V(Uu),G({size:e.size??`sm`,class:t.$props.class},t.$attrs),{default:I(()=>[A(V(Wu),{placeholder:e.placeholder},null,8,[`placeholder`])]),_:1},16,[`size`,`class`]),A(V(Bu),{position:`popper`,class:`max-w-[min(var(--reka-select-content-available-width),20rem)]`},{default:I(()=>[(L(!0),j(U,null,M(e.options,e=>(L(),q(V(Hu),{key:e.value,value:e.value===``?V0:e.value,disabled:e.disabled,title:e.label,class:`*:[span]:last:min-w-0`},{default:I(()=>[R(`span`,B0,B(e.label),1)]),_:2},1032,[`value`,`disabled`,`title`]))),128))]),_:1})]),_:1},8,[`model-value`,`disabled`]))}}),U0=[`id`],W0=[`value`],G0=P({__name:`WorkflowPicker`,props:{value:{},workflows:{},label:{},class:{},editable:{type:Boolean}},emits:[`pick`],setup(e,{emit:t}){let n=we(),r=t;return(t,i)=>e.editable?(L(),j(U,{key:0},[A(V(Q),{"model-value":e.value,list:V(n),"aria-label":e.label,class:z(t.$props.class),placeholder:`Workflow id or {{ reference }}`,"onUpdate:modelValue":i[0]||=e=>r(`pick`,String(e))},null,8,[`model-value`,`list`,`aria-label`,`class`]),R(`datalist`,{id:V(n)},[(L(!0),j(U,null,M(e.workflows,e=>(L(),j(`option`,{key:e.id,value:e.id},null,8,W0))),128))],8,U0)],64)):(L(),q(V(zu),{key:1,"model-value":e.value||void 0,"onUpdate:modelValue":i[1]||=e=>r(`pick`,String(e))},{default:I(()=>[A(V(Uu),{"aria-label":e.label,class:z(t.$props.class)},{default:I(()=>[A(V(Wu),{placeholder:`Choose workflow`})]),_:1},8,[`aria-label`,`class`]),A(V(Bu),null,{default:I(()=>[e.value& Line truncated
`).map((e,t)=>({number:t+1,text:e,tokens:a2(e)}))}var r2=/^(\s*)(-\s+)?/,i2=/^([^:#\s][^:#]*?)(:)(\s*)(.*)$/;function a2(e){let{code:t,comment:n}=o2(e),r=s2(t);return n&&r.push({text:n,kind:`comment`}),r}function o2(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 s2(e){if(!e)return[];let t=[],n=r2.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=i2.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,...c2(i[4]??``)]):[...t,...c2(r)]}function c2(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 l2(e){return e.split(`
`)[0]?.trim()||`invalid YAML`}function u2(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function d2(e){return typeof e==`string`&&e.trim()!==``}var f2={class:`space-y-4 px-3 py-3`},p2={key:0,class:`rounded-md bg-danger/10 px-2.5 py-1.5 text-xs text-danger`,role:`alert`},m2={key:1,class:`space-y-3`},h2={key:0,class:`block space-y-1.5`},g2=[`id`],_2=[`value`],v2={class:`text-xs font-medium text-fg-muted`},y2={class:`flex items-center gap-2`},b2={key:1,role:`alert`,class:`text-xs text-danger`},x2={key:2,class:`space-y-1.5`},S2=[`title`],C2={key:4,class:`flex flex-wrap items-center gap-1 pt-0.5`},w2={key:0,class:`divide-y divide-border rounded-md border border-border`},T2=[`title`],E2={key:0,class:`space-y-3`},D2={class:`text-label`},O2={key:0,class:`text-danger`},k2={class:`ml-2 text-xs text-fg-subtle`},A2={key:1,class:`space-y-3`},j2={class:`text-label`},M2={class:`ml-2 text-xs text-fg-subtle`},N2=[`title`],P2={key:0,class:`text-xs text-danger`},F2={class:`space-y-1.5`},I2={key:0,role:`alert`,class:`text-xs text-danger`},L2={class:`divide-y divide-border rounded-md border border-border`},R2={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},z2={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},B2={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},V2={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},H2=[`for`],U2=P({__name:`StepEditor`,props:{yaml:{},path:{},vocabulary:{},workflows:{},modelAliases:{}},emits:[`update:yaml`],setup(e,{emit:t}){let n=we(),r=e,i=t,a=Y(()=>u0(r.yaml,r.path)??{}),o=Y(()=>c0(a.value)),s=Y(()=>o.value?.kind??(typeof a.value.type==`string`?a.value.type:``)),c=Y(()=>o.value?.branches.map(([e])=>e)??[]),l=Y(()=>s.value===`parallel`?2:1);function u(e){i(`update:yaml`,d0(r.yaml,r.path,{...a.value,switch:{...a.value.switch,on:e}}))}let d=J(``),f=J(``);function p(e,t,n=``){try{let a=e===`add`?h0(r.yaml,r.path,t):e===`rename`?g0(r.yaml,r.path,t,n):_0(r.yaml,r.path,t);i(`update:yaml`,a),d.value=``,f.value=``}catch(e){f.value=String(e.message)}}let m=Y(()=>r.vocabulary.find(e=>e.name===s.value)),h=Y(()=>typeof a.value.settings==`object`&&a.value.settings!==null?a.value.settings:{}),g=Y(()=>S0(r.yaml,r.path)),_=Y(()=>Q0(a.value)),v=Y(()=>m.value?.settings&&a.value.settings?e2(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===`workflow.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=Y(()=>{let e=Object.entries(m.value?.settings?.properties??{}).filter(([e])=>s.value!==`workflow.call`||![`inputs`,`outputs`].includes(e)).map(([e,t])=>({key:e,schema:t,kind:x(e,t),options:s.value===`agent.run`&&e===`model`?r.modelAliases:t.enum??[]})),t=e.filter(e=>y.includes(e.key)&&e.kind!==`boolean`).sort((e,t)=>y.indexOf(e.key)-y.indexOf(t.key))[0],n=e.filter(e=>e!==t);return{lead:t,compact:n.filter(e=>[`workflow`,`select`,`line`,`number`,`boolean`].includes(e.kind)),long:n.filter(e=>[`text`,`lines`,`yaml`].includes(e.kind))}}),C=J(!S.value.lead&&!o.value),w=e=>[{value:``,label:`Default`},...e.map(e=>({value:e,label:e}))];function T(e){let{id:t,type:n,...a}=e;i(`update:yaml`,d0(r.yaml,r.path,{id:t,type:n,...a}))}function ee(e,t){T({...a.value,[e]:t})}function te(e){let t={...a.value.retry,...e};ee(`retry`,t.attempts===void 0&&!t.backoff?void 0:{...t,attempts:t.attempts??1})}function E(e,t){let n={...h.value,[e]:t};s.value===`workflow.call`&&e===`wait`&&t!==!0&&delete n.outputs,T({...a.value,settings:n})}function ne(e,t){let n={...h.value,[e]:t};s.value===`workflow.call`&&t!==h.value[e]&&(delete n.inputs,delete n.outputs),T({...a.value,settings:n})}let D=Y(()=>r.workflows.find(e=>e.id===h.value.workflow)),re=Y(()=>Object.entries(w0(D.value?.yaml??``,`inputs`)??{})),ie=Y(()=>Object.entries(w0(D.value?.yaml??``,`outputs`)??{})),ae=Y(()=>Object.entries(w0(r.yaml,`inputs`)??{})),k=Y(()=>Object.entries(w0(r.yaml,`outputs`)??{})),oe=Y(()=>h.value.inputs??{}),se=Y(()=>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){E(`inputs`,{...oe.value,[e]:t===``?void 0:ce(t)?t:ZE(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=J(null);function me(e){let t=pe.value??S.value.lead?.key;if(!t)return;let n=typeof h.value[t]==`string`?h.value[t]:``,r=`{{ steps.${e}.summary }}`;E(t,n?`${n.trimEnd()} ${r}`:r)}let he=J({});function ge(e,t){try{E(e,t.trim()?i0(t):void 0),he.value={...he.value,[e]:``}}catch(t){he.value={...he.value,[e]:String(t.me Line truncated
`)[0]}}}let _e=e=>e===void 0?``:a0(e).trimEnd(),ve=(e,t)=>t.title??e.replaceAll(`_`,` `).replace(/^./,e=>e.toUpperCase()),ye=e=>typeof h.value[e]==`string`?h.value[e]:``,N=[{value:``,label:`Park the task`},{value:`continue`,label:`Continue`}];return(t,r)=>(L(),j(`div`,f2,[v.value?(L(),j(`p`,p2,B(v.value),1)):F(``,!0),o.value?(L(),j(`section`,m2,[s.value===`switch`?(L(),j(`label`,h2,[r[15]||=R(`span`,{class:`text-xs font-medium text-fg-muted`,title:`The value whose case runs; a case named default runs when none matches`},`Switch on`,-1),A(V(Q),{"model-value":o.value.on,class:`font-mono`,placeholder:`steps.assess.result.fit`,list:`${V(n)}-switch-on`,onChange:r[0]||=e=>u(e.target.value.trim())},null,8,[`model-value`,`list`]),R(`datalist`,{id:`${V(n)}-switch-on`},[(L(!0),j(U,null,M(g.value,e=>(L(),j(`option`,{key:e,value:`steps.${e}.result.`},null,8,_2))),128))],8,g2)])):F(``,!0),R(`div`,v2,B(s.value===`switch`?`Cases`:`Branches`),1),(L(!0),j(U,null,M(c.value,e=>(L(),j(`div`,{key:e,class:`flex items-center gap-2`},[A(V(Q),{"model-value":e,class:z(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`]),A(V(X),{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Remove ${e}`,disabled:c.value.length<=l.value,onClick:t=>p(`delete`,e)},{default:I(()=>[A(V(Au))]),_:1},8,[`aria-label`,`disabled`,`onClick`])]))),128)),R(`div`,y2,[A(V(Q),{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]||=gt(pt(e=>p(`add`,d.value.trim()),[`prevent`]),[`enter`])},null,8,[`modelValue`,`aria-label`,`placeholder`]),A(V(X),{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:I(()=>[A(V(wu))]),_:1},8,[`aria-label`,`disabled`])]),f.value?(L(),j(`p`,b2,B(f.value),1)):F(``,!0)])):F(``,!0),S.value.lead?(L(),j(`section`,x2,[R(`div`,{class:`flex items-center gap-1 text-xs font-medium text-fg-muted`,title:S.value.lead.schema.description},[H(B(ve(S.value.lead.key,S.value.lead.schema))+` `,1),S.value.lead.schema.description?(L(),q(V(Wl),{key:0,class:`size-3 text-fg-subtle`})):F(``,!0)],8,S2),S.value.lead.kind===`workflow`?(L(),q(G0,{key:0,editable:s.value!==`workflow.call`,value:ye(S.value.lead.key),workflows:e.workflows,label:ve(S.value.lead.key,S.value.lead.schema),onPick:r[4]||=e=>ne(S.value.lead.key,e)},null,8,[`editable`,`value`,`workflows`,`label`])):S.value.lead.kind===`select`?(L(),q(H0,{key:1,class:`w-full`,"model-value":ye(S.value.lead.key),options:w(S.value.lead.options),"aria-label":ve(S.value.lead.key,S.value.lead.schema),"onUpdate:modelValue":r[5]||=e=>E(S.value.lead.key,e||void 0)},null,8,[`model-value`,`options`,`aria-label`])):S.value.lead.kind===`text`?(L(),q(V(Hd),{key:2,"model-value":ye(S.value.lead.key),class:`min-h-32 text-label leading-relaxed`,onFocus:r[6]||=e=>pe.value=S.value.lead.key,"onUpdate:modelValue":r[7]||=e=>E(S.value.lead.key,String(e))},null,8,[`model-value`])):(L(),q(V(Q),{key:3,"model-value":ye(S.value.lead.key),onFocus:r[8]||=e=>pe.value=S.value.lead.key,"onUpdate:modelValue":r[9]||=e=>E(S.value.lead.key,String(e))},null,8,[`model-value`])),g.value.length&&S.value.lead.kind!==`select`?(L(),j(`div`,C2,[r[16]||=R(`span`,{class:`text-caption text-fg-subtle`},`Insert`,-1),(L(!0),j(U,null,M(g.value,e=>(L(),q(V(X),{key:e,type:`button`,variant:`outline`,size:`xs`,class:`font-mono`,title:`{{ steps.${e}.summary }}`,onClick:t=>me(e)},{default:I(()=>[H(B(e),1)]),_:2},1032,[`title`,`onClick`]))),128))])):F(``,!0)])):F(``,!0),A(V(X),{type:`button`,variant:`ghost`,size:`xs`,class:`-ml-2 text-fg-muted aria-expanded:bg-transparent`,"aria-expanded":C.value,onClick:r[10]||=e=>C.value=!C.value},{default:I(()=>[A(V(O),{"data-icon":`inline-start`,class:z([`transition-transform`,!C.value&&`-rotate-90`])},null,8,[`class`]),r[17]||=H(`More `,-1)]),_:1},8,[`aria-expanded`]),C.value?(L(),j(U,{key:3},[S.value.compact.length?(L(),j(`section`,w2,[(L(!0),j(U,null,M(S.value.compact,t=>(L(),j(`div`,{key:t.key,class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},[R(`span`,{class:`flex flex-1 items-center gap-1 text-label`,title:t.schema.description},[H(B(ve(t.key,t.schema))+` `,1),t.schema.description?(L(),q(V(Wl),{key:0,class:`size-3 text-fg-subtle`})):F(``,!0)],8,T2),t.kind===`workflow`?(L(),q(G0,{key:0,editable:s.value!==`workflow.call`,class:`max-w-48`,value:ye(t.key),workflows:e.workflows,label:ve(t.key,t.schema),onPick:e=>ne(t.key,e)},null,8,[`editable`,`value`,`workflows`,`label`,`onPick`])):t.kind===`boolean`?(L(),q(V(aT),{key:1,"model-value":h.value[t.key]===!0,"onUpdate:modelValue":e=>E(t.key,e||void 0)},null,8,[`model-value`,`onUpdate:modelValue`])):t.kind===`select`?(L(),q(H0,{key:2,class:`w-40`,"model-val Line truncated
`):``,class:`min-h-16 font-mono text-xs`,placeholder:`One per line`,"onUpdate:modelValue":t=>E(e.key,String(t).split(`
`).filter(Boolean))},null,8,[`model-value`,`onUpdate:modelValue`])):(L(),j(U,{key:2},[A(V(Hd),{"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]?(L(),j(`span`,P2,B(he.value[e.key]),1)):F(``,!0)],64))]))),128)),R(`section`,F2,[_.value?(L(),j(`p`,I2,B(_.value),1)):F(``,!0),R(`div`,L2,[R(`label`,R2,[r[20]||=R(`span`,{class:`flex-1 text-label`,title:`Empty always runs. A field such as inputs.enabled, !inputs.skip, or steps.plan.result.ready == true`},`Run only when`,-1),A(V(Q),{class:`h-8 w-48 font-mono text-xs`,placeholder:`inputs.enabled`,"aria-invalid":_.value&&_.value.startsWith(`when`)?!0:void 0,"model-value":a.value.when??``,"onUpdate:modelValue":r[11]||=e=>ee(`when`,String(e))},null,8,[`aria-invalid`,`model-value`])]),R(`label`,z2,[r[21]||=R(`span`,{class:`flex-1 text-label`},`If it fails`,-1),A(H0,{class:`w-36`,"aria-label":`If it fails`,"model-value":a.value.on_failure??``,options:N,"onUpdate:modelValue":r[12]||=e=>ee(`on_failure`,e||void 0)},null,8,[`model-value`])]),R(`label`,B2,[r[22]||=R(`span`,{class:`flex-1 text-label`},`Attempts`,-1),A(V(Q),{type:`number`,min:`1`,max:`10`,placeholder:`1`,class:`h-8 w-20 text-right text-label`,"model-value":a.value.retry?.attempts??``,"onUpdate:modelValue":r[13]||=e=>te({attempts:String(e)===``?void 0:Number(String(e))})},null,8,[`model-value`])]),R(`div`,V2,[R(`label`,{for:`${V(n)}-backoff`,class:`flex-1 text-label`},`Retry backoff`,8,H2),A(V(Qw),{id:`${V(n)}-backoff`,"model-value":a.value.retry?.backoff??``,units:[`s`,`m`,`h`],"onUpdate:modelValue":r[14]||=e=>te({backoff:e||void 0})},null,8,[`id`,`model-value`])])])])],64)):F(``,!0)]))}}),W2={class:`space-y-1.5`},G2={class:`flex items-center text-xs font-medium text-fg-muted`},K2={key:0,class:`divide-y divide-border rounded-md border border-border`},q2=P({__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=Y(()=>Object.entries(w0(n.yaml,n.field)??{}));function o(e){r(`update:yaml`,T0(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)=>(L(),j(`section`,W2,[R(`div`,G2,[H(B(e.field===`inputs`?`Inputs`:`Outputs`)+` `,1),A(V(X),{type:`button`,variant:`ghost`,size:`xs`,class:`ml-auto`,onClick:c},{default:I(()=>[A(V(wu),{"data-icon":`inline-start`}),n[0]||=H(`Add`,-1)]),_:1})]),a.value.length?(L(),j(`div`,K2,[(L(!0),j(U,null,M(a.value,([t,n],r)=>(L(),j(`div`,{key:r,class:`flex items-center gap-2 px-2 py-1.5`},[A(V(Q),{"model-value":t,class:`h-8 min-w-0 flex-1 font-mono text-xs`,"aria-label":`${e.field} name`,onChange:e=>s(r,e.target.value.trim(),n)},null,8,[`model-value`,`aria-label`,`onChange`]),A(H0,{"model-value":n.type??`string`,options:V(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`]),A(V(aT),{"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`]),A(V(X),{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":`Remove ${t}`,onClick:e=>o(a.value.filter((e,t)=>t!==r))},{default:I(()=>[A(V(Au))]),_:1},8,[`aria-label`,`onClick`])]))),128))])):F(``,!0)]))}}),J2={class:`space-y-4 px-3 py-3`},Y2={class:`divide-y divide-border rounded-md border border-border`},X2={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},Z2={key:0,role:`alert`,class:`px-3 py-2 text-xs text-danger`},Q2={key:1,class:`px-3 py-2 text-xs text-fg-subtle`},$2={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},e4={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},t4={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},n4={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},r4={class:`space-y-1.5`},i4=`6f129e29-0e26-5246-99bd-74cb4496203b`,a4=P({__name:`WorkflowSettings`,props:{yaml:{}},emits:[`update:yaml`],setup(e,{emit:t}){let n=e,r=t,i=e=>{let t=w0(n.yaml,e);return typeof t==`string`?t:``};function a(e,t){r(`update:yaml`,T0(n.yaml,e,t))}let o=PT(),s=J([]),c=J(!0),l=J(``);async function u(){c.value=!0,l.value=``,s.value=[];try{await o.loadOrg();let e=await Z.orgAgents(o.homeOrg);s.value=e.agents.filter(e=>e.lifecycle===`active`),!i(`identity`)&&s.value.some(e=>e.id===i4)&&a(`identity`,i4)}catch(e){l.value=String(e.message||e)}finally{c.value=!1}}Be(u);let d=Y(()=>{let e=i(`identity`),t=s.value.map(e=>({value:e.id,label:e.display_name}));return e&&!c.value&&!s.value.some(t=>t.id===e)?[{value:e,label:`${e} (unknown)`,disabled:!0},...t]:t}),f=Jw(),p=Y(()=>{let e=Object.keys(f.stateFor(`agent-profilLine 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=LQ(IQ(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=LQ(IQ(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 VQ(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new MQ||null,prettyErrors:t}}function HQ(e,t={}){let{lineCounter:n,prettyErrors:r}=VQ(t),i=new BQ(n?.addNewLine),a=new vQ(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 PZ(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(IZ(e,n)),o.warnings.forEach(IZ(e,n))),o}function UQ(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let i=HQ(e,n);if(!i)return null;if(i.warnings.forEach(e=>fX(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 WQ(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 sY(e)&&!r?e.toString(n):new jZ(e,r,n).toString(n)}var GQ=e=>typeof e==`object`&&!!e&&!Array.isArray(e),KQ=e=>GQ(e)?Object.entries(e).map(([e,t])=>[e,Array.isArray(t)?t:[]]):[];function qQ(e){if(GQ(e)){if(GQ(e.parallel))return{kind:`parallel`,base:[`parallel`],branches:KQ(e.parallel)};if(GQ(e.switch))return{kind:`switch`,base:[`switch`,`cases`],on:typeof e.switch.on==`string`?e.switch.on:``,branches:KQ(e.switch.cases)}}}function JQ(e){return e.slice(2).includes(`parallel`)}function YQ(e,t){let n=HQ(e).getIn(t,!0);if(cY(n))return n.toJSON()}function XQ(e,t,n){let r=HQ(e);return r.setIn(t,r.createNode(c$(n))),r.toString()}function ZQ(e,t,n){let r=HQ(e),i=t.slice(0,-1),a=JQ(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(dY(o)||(r.setIn(i,r.createNode([])),o=r.getIn(i,!0)),!dY(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 QQ(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 $Q(e,t){let n=e.getIn(t,!0),r=qQ(cY(n)?n.toJSON():void 0),i=r?e.getIn([...t,...r.base],!0):void 0;if(!r||!cY(i))throw Error(`This step has no branches.`);return{kind:r.kind,branches:i}}function e$(e,t,n){let r=HQ(e),{kind:i,branches:a}=$Q(r,t);if(QQ(n,i),a.has(n))throw Error(`Branch ${n} already exists.`);return a.set(n,r.createNode([])),r.toString()}function t$(e,t,n,r){let i=HQ(e),{kind:a,branches:o}=$Q(i,t);if(QQ(r,a),n!==r&&o.has(r))throw Error(`Branch ${r} already exists.`);let s=o.items.find(e=>uY(e.key)&&e.key.value===n);if(!s||!uY(s.key))throw Error(`Branch ${n} does not exist.`);return s.key.value=r,i.toString()}function n$(e,t,n){let r=HQ(e),{kind:i,branches:a}=$Q(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 C$(e,t){let n=JSON.stringify(e??{})+` `+(typeof t==`string`?`{{ ${t.replace(/^!/,``)} }}`:``);return[...new Set([...n.matchAll(y$)].map(e=>e[1]))]}function w$(e){let t=HQ(e).toJS(),n=b$(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=b$(e)?e:{},p=qQ(d),m=p?.kind??(typeof d.type==`string`?d.type:``),h=b$(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||v$(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\./,``)}`:x$(m,h),summary:S$(h),when:typeof d.when==`string`?d.when:void 0,retry:b$(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 C$([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=qQ(t);if(n){let{kind:i,base:a,branches:o}=n,c=p(t,String(e+1),0,u*h$,void 0,void 0,[`steps`,e]);m(l,c,[`steps`,e-1]),u++;let d=b$(t)&&typeof t.id==`string`?t.id:i,f=i===`switch`&&!o.some(([e])=>e==="default"),h=o.length+ +!!f,g=[],_=Math.max(1,...o.map(([,e])=>e.length)),v=e=>(e-(h-1)/2)*g$,y=(e,t,n)=>r.push({id:e,type:`lane`,position:{x:t-12,y:u*h$-40},style:{width:`264px`,height:`${(_+1)*h$-24}px`},zIndex:-1,data:{kind:`step`,key:n,title:n,type:``,detail:``,lane:i}}),b=(u+_)*h$;if(o.forEach(([t,n],o)=>{let s=v(o),l=[c],f=[`steps`,e,...a,t];n.forEach((n,r)=>{let a=p(n,`${e+1}-${t}-${r+1}`,s,(u+r)*h$,t,d,[...f,r],i);m(l,a,[...f,r-1]),l=[a]});let h=`add-${e}-${t}`;r.push({id:h,type:`add`,position:{x:s+104,y:b},data:{kind:`step`,key:h,title:``,type:``,detail:``,branch:t,lane:i,insertAfter:[...f,n.length-1]}}),m(l,h),g.push(h),y(`lane-${e}-${t}`,s,t)}),f){let t=v(h-1),n=`pass-${e}`;r.push({id:n,type:`add`,position:{x:t+104,y:b},data:{kind:`step`,key:n,title:``,type:``,detail:``,lane:i}}),s.add(c),m([c],n),s.delete(c),g.push(n),y(`pass-lane-${e}`,t,`default`)}l=g,u+=_+1;continue}let i=p(t,String(e+1),0,u*h$,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*h$-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 T$={class:`truncate`},E$=`\0`,D$=N({inheritAttrs:!1,__name:`OptionSelect`,props:{modelValue:{},options:{},placeholder:{},disabled:{type:Boolean},size:{},class:{}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=t;return(t,r)=>(I(),K(B(zn),{"model-value":e.modelValue===``&&e.options.some(e=>e.value===``)?E$:e.modelValue||void 0,disabled:e.disabled,"onUpdate:modelValue":r[0]||=e=>n(`update:modelValue`,e===E$?``:String(e))},{default:F(()=>[O(B(In),W({size:e.size??`sm`,class:t.$props.class},t.$attrs),{default:F(()=>[O(B(Bn),{placeholder:e.placeholder},null,8,[`placeholder`])]),_:1},16,[`size`,`class`]),O(B(Ln),{position:`popper`,class:`max-w-[min(var(--reka-select-content-available-width),20rem)]`},{default:F(()=>[(I(!0),k(H,null,A(e.options,e=>(I(),K(B(Fn),{key:e.value,value:e.value===``?E$:e.value,disabled:e.disabled,title:e.label,class:`*:[span]:last:min-w-0`},{default:F(()=>[L(`span`,T$,z(e.label),1)]),_:2},1032,[`value`,`disabled`,`title`]))),128))]),_:1})]),_:1},8,[`model-value`,`disabled`]))}}),O$=[`id`],k$=[`value`],A$=N({__name:`WorkflowPicker`,props:{value:{},workflows:{},label:{},class:{},editable:{type:Boolean}},emits:[`pick`],setup(e,{emit:t}){let n=he(),r=t;return(t,i)=>e.editable?(I(),k(H,{key:0},[O(B(Z),{"model-value":e.value,list:B(n),"aria-label":e.label,class:R(t.$props.class),placeholder:`Workflow id or {{ reference }}`,"onUpdate:modelValue":i[0]||=e=>r(`pick`,String(e))},null,8,[`model-value`,`list`,`aria-label`,`class`]),L(`datalist`,{id:B(n)},[(I(!0),k(H,null,A(e.workflows,e=>(I(),k(`option`,{key:e.id,value:e.id},null,8,k$))),128))],8,O$)],64)):(I(),K(B(zn),{key:1,"model-value":e.value||void 0,"onUpdate:modelValue":i[1]||=e=>r(`pick`,String(e))},{default:F(()=>[O(B(In),{"aria-label":e.label,class:R(t.$props.class)},{default:F(()=>[O(B(Bn),{placeholder:`Choose workflow`})]),_:1},8,[`aria-label`,`class`]),O(B(Ln),null,{default:F(()=>[e.value& Line truncated
`).map((e,t)=>({number:t+1,text:e,tokens:W$(e)}))}var H$=/^(\s*)(-\s+)?/,U$=/^([^:#\s][^:#]*?)(:)(\s*)(.*)$/;function W$(e){let{code:t,comment:n}=G$(e),r=K$(t);return n&&r.push({text:n,kind:`comment`}),r}function G$(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 K$(e){if(!e)return[];let t=[],n=H$.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=U$.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,...q$(i[4]??``)]):[...t,...q$(r)]}function q$(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 J$(e){return e.split(`
`)[0]?.trim()||`invalid YAML`}function Y$(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function X$(e){return typeof e==`string`&&e.trim()!==``}var Z$={class:`space-y-4 px-3 py-3`},Q$={key:0,class:`rounded-md bg-danger/10 px-2.5 py-1.5 text-xs text-danger`,role:`alert`},$$={key:1,class:`space-y-3`},e1={key:0,class:`block space-y-1.5`},t1=[`id`],n1=[`value`],r1={class:`text-xs font-medium text-fg-muted`},i1={class:`flex items-center gap-2`},a1={key:1,role:`alert`,class:`text-xs text-danger`},o1={key:2,class:`space-y-1.5`},s1=[`title`],c1={key:4,class:`flex flex-wrap items-center gap-1 pt-0.5`},l1={key:0,class:`divide-y divide-border rounded-md border border-border`},u1=[`title`],d1={key:0,class:`space-y-3`},f1={class:`text-label`},p1={key:0,class:`text-danger`},m1={class:`ml-2 text-xs text-fg-subtle`},h1={key:1,class:`space-y-3`},g1={class:`text-label`},_1={class:`ml-2 text-xs text-fg-subtle`},v1=[`title`],y1={key:0,class:`text-xs text-danger`},b1={class:`space-y-1.5`},x1={key:0,role:`alert`,class:`text-xs text-danger`},S1={class:`divide-y divide-border rounded-md border border-border`},C1={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},w1={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},T1={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},E1={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},D1=[`for`],O1=N({__name:`StepEditor`,props:{yaml:{},path:{},vocabulary:{},workflows:{},modelAliases:{}},emits:[`update:yaml`],setup(e,{emit:t}){let n=he(),r=e,i=t,a=J(()=>YQ(r.yaml,r.path)??{}),o=J(()=>qQ(a.value)),s=J(()=>o.value?.kind??(typeof a.value.type==`string`?a.value.type:``)),c=J(()=>o.value?.branches.map(([e])=>e)??[]),l=J(()=>s.value===`parallel`?2:1);function u(e){i(`update:yaml`,XQ(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`?e$(r.yaml,r.path,t):e===`rename`?t$(r.yaml,r.path,t,n):n$(r.yaml,r.path,t);i(`update:yaml`,a),d.value=``,f.value=``}catch(e){f.value=String(e.message)}}let m=J(()=>r.vocabulary.find(e=>e.name===s.value)),h=J(()=>typeof a.value.settings==`object`&&a.value.settings!==null?a.value.settings:{}),g=J(()=>s$(r.yaml,r.path)),_=J(()=>L$(a.value)),v=J(()=>m.value?.settings&&a.value.settings?z$(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===`workflow.approve`&&e===`then`?`workflow`:s.value===`agent.run`&&e===`model`?`select`:t.type===`string`?t.enum?`select`:b.test(e)?`text`:`line`:t.type===`boolean`?`boolean`:t.type===`integer`||t.type===`number`?`number`:t.type===`array`&&t.items?.type===`string`?`lines`:`yaml`}let S=J(()=>{let e=Object.entries(m.value?.settings?.properties??{}).filter(([e])=>s.value!==`workflow.call`||![`inputs`,`outputs`].includes(e)).map(([e,t])=>({key:e,schema:t,kind:x(e,t),options:s.value===`agent.run`&&e===`model`?r.modelAliases:t.enum??[]})),t=e.filter(e=>y.includes(e.key)&&e.kind!==`boolean`).sort((e,t)=>y.indexOf(e.key)-y.indexOf(t.key))[0],n=e.filter(e=>e!==t);return{lead:t,compact:n.filter(e=>[`workflow`,`select`,`line`,`number`,`boolean`].includes(e.kind)),long:n.filter(e=>[`text`,`lines`,`yaml`].includes(e.kind))}}),ee=q(!S.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`,XQ(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=J(()=>r.workflows.find(e=>e.id===h.value.workflow)),ie=J(()=>Object.entries(l$(E.value?.yaml??``,`inputs`)??{})),ae=J(()=>Object.entries(l$(E.value?.yaml??``,`outputs`)??{})),D=J(()=>Object.entries(l$(r.yaml,`inputs`)??{})),oe=J(()=>Object.entries(l$(r.yaml,`outputs`)??{})),se=J(()=>h.value.inputs??{}),ce=J(()=>h.value.outputs??{}),le=e=>typeof e==`string`&&e.startsWith(`inputs.`),j=e=>[`object`,`array`].includes(e.type??``),ue=e=>se.value[e]===void 0?``:String(se.value[e]);function M(e,t,n){T(`inputs`,{...se.value,[e]:t===``?void 0:le(t)?t:IT(t,n??`string`)})}let de=(e,t,n)=>e.filter(([,e])=>e.type===t.type||e.type===`any`||t.type===`any`).map(([e])=>({value:`${n}.${e}`,label:e})),fe=q(null);function pe(e){let t=fe.value??S.value.lead?.key;if(!t)return;let n=typeof h.value[t]==`string`?h.value[t]:``,r=`{{ steps.${e}.summary }}`;T(t,n?`${n.trimEnd()} ${r}`:r)}let me=q({});function N(e,t){try{T(e,t.trim()?UQ(t):void 0),me.value={...me.value,[e]:``}}catch(t){me.value={...me.value,[e]:String(t.m Line truncated
`)[0]}}}let ge=e=>e===void 0?``:WQ(e).trimEnd(),_e=(e,t)=>t.title??e.replaceAll(`_`,` `).replace(/^./,e=>e.toUpperCase()),ve=e=>typeof h.value[e]==`string`?h.value[e]:``,ye=[{value:``,label:`Park the task`},{value:`continue`,label:`Continue`}];return(t,r)=>(I(),k(`div`,Z$,[v.value?(I(),k(`p`,Q$,z(v.value),1)):P(``,!0),o.value?(I(),k(`section`,$$,[s.value===`switch`?(I(),k(`label`,e1,[r[15]||=L(`span`,{class:`text-xs font-medium text-fg-muted`,title:`The value whose case runs; a case named default runs when none matches`},`Switch on`,-1),O(B(Z),{"model-value":o.value.on,class:`font-mono`,placeholder:`steps.assess.result.fit`,list:`${B(n)}-switch-on`,onChange:r[0]||=e=>u(e.target.value.trim())},null,8,[`model-value`,`list`]),L(`datalist`,{id:`${B(n)}-switch-on`},[(I(!0),k(H,null,A(g.value,e=>(I(),k(`option`,{key:e,value:`steps.${e}.result.`},null,8,n1))),128))],8,t1)])):P(``,!0),L(`div`,r1,z(s.value===`switch`?`Cases`:`Branches`),1),(I(!0),k(H,null,A(c.value,e=>(I(),k(`div`,{key:e,class:`flex items-center gap-2`},[O(B(Z),{"model-value":e,class:R(s.value===`switch`&&`font-mono`),"aria-label":`${s.value===`switch`?`Case`:`Branch`} ${e}`,onChange:t=>p(`rename`,e,t.target.value.trim())},null,8,[`model-value`,`class`,`aria-label`,`onChange`]),O(B(Y),{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Remove ${e}`,disabled:c.value.length<=l.value,onClick:t=>p(`delete`,e)},{default:F(()=>[O(B(El))]),_:1},8,[`aria-label`,`disabled`,`onClick`])]))),128)),L(`div`,i1,[O(B(Z),{modelValue:d.value,"onUpdate:modelValue":r[1]||=e=>d.value=e,"aria-label":s.value===`switch`?`New case value`:`New branch name`,placeholder:s.value===`switch`?`Value, or default`:`Branch name`,onKeydown:r[2]||=rt(tt(e=>p(`add`,d.value.trim()),[`prevent`]),[`enter`])},null,8,[`modelValue`,`aria-label`,`placeholder`]),O(B(Y),{type:`button`,size:`icon-sm`,variant:`outline`,"aria-label":s.value===`switch`?`Add case`:`Add branch`,disabled:!d.value.trim(),onClick:r[3]||=e=>p(`add`,d.value.trim())},{default:F(()=>[O(B(dl))]),_:1},8,[`aria-label`,`disabled`])]),f.value?(I(),k(`p`,a1,z(f.value),1)):P(``,!0)])):P(``,!0),S.value.lead?(I(),k(`section`,o1,[L(`div`,{class:`flex items-center gap-1 text-xs font-medium text-fg-muted`,title:S.value.lead.schema.description},[V(z(_e(S.value.lead.key,S.value.lead.schema))+` `,1),S.value.lead.schema.description?(I(),K(B(Oc),{key:0,class:`size-3 text-fg-subtle`})):P(``,!0)],8,s1),S.value.lead.kind===`workflow`?(I(),K(A$,{key:0,editable:s.value!==`workflow.call`,value:ve(S.value.lead.key),workflows:e.workflows,label:_e(S.value.lead.key,S.value.lead.schema),onPick:r[4]||=e=>re(S.value.lead.key,e)},null,8,[`editable`,`value`,`workflows`,`label`])):S.value.lead.kind===`select`?(I(),K(D$,{key:1,class:`w-full`,"model-value":ve(S.value.lead.key),options:C(S.value.lead.options),"aria-label":_e(S.value.lead.key,S.value.lead.schema),"onUpdate:modelValue":r[5]||=e=>T(S.value.lead.key,e||void 0)},null,8,[`model-value`,`options`,`aria-label`])):S.value.lead.kind===`text`?(I(),K(B(er),{key:2,"model-value":ve(S.value.lead.key),class:`min-h-32 text-label leading-relaxed`,onFocus:r[6]||=e=>fe.value=S.value.lead.key,"onUpdate:modelValue":r[7]||=e=>T(S.value.lead.key,String(e))},null,8,[`model-value`])):(I(),K(B(Z),{key:3,"model-value":ve(S.value.lead.key),onFocus:r[8]||=e=>fe.value=S.value.lead.key,"onUpdate:modelValue":r[9]||=e=>T(S.value.lead.key,String(e))},null,8,[`model-value`])),g.value.length&&S.value.lead.kind!==`select`?(I(),k(`div`,c1,[r[16]||=L(`span`,{class:`text-caption text-fg-subtle`},`Insert`,-1),(I(!0),k(H,null,A(g.value,e=>(I(),K(B(Y),{key:e,type:`button`,variant:`outline`,size:`xs`,class:`font-mono`,title:`{{ steps.${e}.summary }}`,onClick:t=>pe(e)},{default:F(()=>[V(z(e),1)]),_:2},1032,[`title`,`onClick`]))),128))])):P(``,!0)])):P(``,!0),O(B(Y),{type:`button`,variant:`ghost`,size:`xs`,class:`-ml-2 text-fg-muted aria-expanded:bg-transparent`,"aria-expanded":ee.value,onClick:r[10]||=e=>ee.value=!ee.value},{default:F(()=>[O(B(Qn),{"data-icon":`inline-start`,class:R([`transition-transform`,!ee.value&&`-rotate-90`])},null,8,[`class`]),r[17]||=V(`More `,-1)]),_:1},8,[`aria-expanded`]),ee.value?(I(),k(H,{key:3},[S.value.compact.length?(I(),k(`section`,l1,[(I(!0),k(H,null,A(S.value.compact,t=>(I(),k(`div`,{key:t.key,class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},[L(`span`,{class:`flex flex-1 items-center gap-1 text-label`,title:t.schema.description},[V(z(_e(t.key,t.schema))+` `,1),t.schema.description?(I(),K(B(Oc),{key:0,class:`size-3 text-fg-subtle`})):P(``,!0)],8,u1),t.kind===`workflow`?(I(),K(A$,{key:0,editable:s.value!==`workflow.call`,class:`max-w-48`,value:ve(t.key),workflows:e.workflows,label:_e(t.key,t.schema),onPick:e=>re(t.key,e)},null,8,[`editable`,`value`,`workflows`,`label`,`onPick`])):t.kind===`boolean`?(I(),K(B(ew),{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===`select`?(I(),K(D$,{key:2,class:`w-40`,"mo Line 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`])):(I(),k(H,{key:2},[O(B(er),{"model-value":ge(h.value[e.key]),class:`min-h-24 font-mono text-xs`,placeholder:`YAML`,onChange:t=>N(e.key,t.target.value)},null,8,[`model-value`,`onChange`]),me.value[e.key]?(I(),k(`span`,y1,z(me.value[e.key]),1)):P(``,!0)],64))]))),128)),L(`section`,b1,[_.value?(I(),k(`p`,x1,z(_.value),1)):P(``,!0),L(`div`,S1,[L(`label`,C1,[r[20]||=L(`span`,{class:`flex-1 text-label`,title:`Empty always runs. A field such as inputs.enabled, !inputs.skip, or steps.plan.result.ready == true`},`Run only when`,-1),O(B(Z),{class:`h-8 w-48 font-mono text-xs`,placeholder:`inputs.enabled`,"aria-invalid":_.value&&_.value.startsWith(`when`)?!0:void 0,"model-value":a.value.when??``,"onUpdate:modelValue":r[11]||=e=>ne(`when`,String(e))},null,8,[`aria-invalid`,`model-value`])]),L(`label`,w1,[r[21]||=L(`span`,{class:`flex-1 text-label`},`If it fails`,-1),O(D$,{class:`w-36`,"aria-label":`If it fails`,"model-value":a.value.on_failure??``,options:ye,"onUpdate:modelValue":r[12]||=e=>ne(`on_failure`,e||void 0)},null,8,[`model-value`])]),L(`label`,T1,[r[22]||=L(`span`,{class:`flex-1 text-label`},`Attempts`,-1),O(B(Z),{type:`number`,min:`1`,max:`10`,placeholder:`1`,class:`h-8 w-20 text-right text-label`,"model-value":a.value.retry?.attempts??``,"onUpdate:modelValue":r[13]||=e=>w({attempts:String(e)===``?void 0:Number(String(e))})},null,8,[`model-value`])]),L(`div`,E1,[L(`label`,{for:`${B(n)}-backoff`,class:`flex-1 text-label`},`Retry backoff`,8,D1),O(B(zt),{id:`${B(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)):P(``,!0)]))}}),k1={class:`space-y-1.5`},A1={class:`flex items-center text-xs font-medium text-fg-muted`},j1={key:0,class:`divide-y divide-border rounded-md border border-border`},M1=N({__name:`SpecList`,props:{yaml:{},field:{}},emits:[`update:yaml`],setup(e,{emit:t}){let n=e,r=t,i=[`string`,`number`,`bool`,`object`,`array`,`any`].map(e=>({value:e,label:e})),a=J(()=>Object.entries(l$(n.yaml,n.field)??{}));function o(e){r(`update:yaml`,u$(n.yaml,n.field,Object.fromEntries(e.filter(([e])=>e))))}function s(e,t,n){o(a.value.map((r,i)=>i===e?[t,n]:r))}function c(){let e=n.field.slice(0,-1),t=a.value.length+1;for(;a.value.some(([n])=>n===`${e}_${t}`);)t++;o([...a.value,[`${e}_${t}`,{type:`string`}]])}return(t,n)=>(I(),k(`section`,k1,[L(`div`,A1,[V(z(e.field===`inputs`?`Inputs`:`Outputs`)+` `,1),O(B(Y),{type:`button`,variant:`ghost`,size:`xs`,class:`ml-auto`,onClick:c},{default:F(()=>[O(B(dl),{"data-icon":`inline-start`}),n[0]||=V(`Add`,-1)]),_:1})]),a.value.length?(I(),k(`div`,j1,[(I(!0),k(H,null,A(a.value,([t,n],r)=>(I(),k(`div`,{key:r,class:`flex items-center gap-2 px-2 py-1.5`},[O(B(Z),{"model-value":t,class:`h-8 min-w-0 flex-1 font-mono text-xs`,"aria-label":`${e.field} name`,onChange:e=>s(r,e.target.value.trim(),n)},null,8,[`model-value`,`aria-label`,`onChange`]),O(D$,{"model-value":n.type??`string`,options:B(i),class:`w-24`,"aria-label":`${t} type`,"onUpdate:modelValue":e=>s(r,t,{...n,type:e})},null,8,[`model-value`,`options`,`aria-label`,`onUpdate:modelValue`]),O(B(ew),{"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`]),O(B(Y),{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":`Remove ${t}`,onClick:e=>o(a.value.filter((e,t)=>t!==r))},{default:F(()=>[O(B(El))]),_:1},8,[`aria-label`,`onClick`])]))),128))])):P(``,!0)]))}}),N1={class:`space-y-4 px-3 py-3`},P1={class:`divide-y divide-border rounded-md border border-border`},F1={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},I1={key:0,role:`alert`,class:`px-3 py-2 text-xs text-danger`},L1={key:1,class:`px-3 py-2 text-xs text-fg-subtle`},R1={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},z1={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},B1={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},V1={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},H1={class:`space-y-1.5`},U1=`6f129e29-0e26-5246-99bd-74cb4496203b`,W1=N({__name:`WorkflowSettings`,props:{yaml:{}},emits:[`update:yaml`],setup(e,{emit:t}){let n=e,r=t,i=e=>{let t=l$(n.yaml,e);return typeof t==`string`?t:``};function a(e,t){r(`update:yaml`,u$(n.yaml,e,t))}let o=Zw(),s=q([]),c=q(!0),l=q(``);async function u(){c.value=!0,l.value=``,s.value=[];try{await o.loadOrg();let e=await X.orgAgents(o.homeOrg);s.value=e.agents.filter(e=>e.lifecycle===`active`),!i(`identity`)&&s.value.some(e=>e.id===U1)&&a(`identity`,U1)}catch(e){l.value=String(e.message||e)}finally{c.value=!1}}Ae(u);let d=J(()=>{let e=i(`identity`),t=s.value.map(e=>({value:e.id,label:e.display_name}));return e&&!c.value&&!s.value.some(t=>t.id===e)?[{value:e,label:`${e} (unknown)`,disabled:!0},...t]:t}),f=bn(),p=J(()=>{let e=Object.keys(f.stateFor(`agent-profilesLine 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 qse(e,t){return n=>{if(!n.code&&!n.key)return!1;let r=Jse(n.code,e);return Array.isArray(e)?e.some(e=>T5(n[r],e,t,n.type===`keyup`)):T5(n[r],e,t,n.type===`keyup`)}}function Jse(e,t){return t.includes(e)?`code`:`key`}function E5(e,t){let n=Y(()=>Ge(t?.target)??Gse),r=at(Ge(e)===!0),i=!1,a=new Set,o=c(Ge(e));N(()=>Ge(e),(e,t)=>{typeof t==`boolean`&&typeof e!=`boolean`&&s(),o=c(e)},{immediate:!0}),S3([`blur`,`contextmenu`],s),w3((...e)=>o(...e),e=>{let n=Ge(t?.actInsideInputWithModifier)??!0,a=Ge(t?.preventDefault)??!1;if(i=Kse(e),(!i||i&&!n)&&w5(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}),w3((...e)=>o(...e),e=>{let n=Ge(t?.actInsideInputWithModifier)??!0;if(r.value){if((!i||i&&!n)&&w5(e))return;i=!1,r.value=!1}},{eventName:`keyup`,target:n});function s(){i=!1,a.clear(),r.value=Ge(e)===!0}function c(e){return e===null?(s(),()=>!1):typeof e==`boolean`?(s(),r.value=e,()=>!1):Array.isArray(e)||typeof e==`string`?qse(e,a):e}return r}var D5=`vue-flow__node-desc`,O5=`vue-flow__edge-desc`,Yse=`vue-flow__aria-live`,k5=[`Enter`,` `,`Escape`],A5={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function j5(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function M5(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 N5(e){return{width:e.offsetWidth,height:e.offsetHeight}}function P5(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function F5(e,t){return{x:P5(e.x,t[0][0],t[1][0]),y:P5(e.y,t[0][1],t[1][1])}}function I5(e){let t=e.getRootNode();return`elementFromPoint`in t?t:window.document}function L5(e){return e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e}function R5(e){return e&&typeof e==`object`&&`id`in e&&`position`in e&&!L5(e)}function z5(e){return R5(e)&&`computedPosition`in e}function B5(e){return!Number.isNaN(e)&&Number.isFinite(e)}function Xse(e){return B5(e.width)&&B5(e.height)&&B5(e.x)&&B5(e.y)}function Zse(e,t,n){let r={id:e.id.toString(),type:e.type??`default`,dimensions:He({width:0,height:0}),computedPosition:He({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:P7(e.data)?e.data:{},events:He(P7(e.events)?e.events:{})};return Object.assign(t??r,e,{id:e.id.toString(),parentNode:n})}function V5(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:P7(e.data)?e.data:{},events:He(P7(e.events)?e.events:{}),label:e.label??``,interactionWidth:e.interactionWidth??n?.interactionWidth,...n??{}};return Object.assign(t??r,e,{id:e.id.toString()})}function H5(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 Qse(...e){if(e.length===3){let[t,n,r]=e;return H5(t,n,r,`target`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>L5(e)&&e.source===r).map(e=>n.find(t=>R5(t)&&t.id===e.target))}function $se(...e){if(e.length===3){let[t,n,r]=e;return H5(t,n,r,`source`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>L5(e)&&e.target===r).map(e=>n.find(t=>R5(t)&&t.id===e.source))}function U5({source:e,sourceHandle:t,target:n,targetHandle:r}){return`vueflow__edge-${e}${t??``}-${n}${r??``}`}function ece(e,t){return t.some(t=>L5(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 W5({x:e,y:t},{x:n,y:r,zoom:i}){return{x:e*i+n,y:t*i+r}}function G5({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?w7(s,o):s}function tce(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 K5({x:e,y:t,width:n,height:r}){return{x:e,y:t,x2:e+n,y2:t+r}}function nce({x:e,y:t,x2:n,y2:r}){return{x:e,y:t,width:n-e,height:r-t}}function q5(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=tce(t,K5({...r.computedPosition,...r.dimensions}))}return nce(t)}function J5(e,t,n={x:0,y:0,zoom:1},r=!1,i=!1){let a={...G5(t,n),width:t.width/n.zoom,height:t.height/n.zoom},o=[];for(let t of e){let{dimensions:e,selectabl 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 Hie(e,t){return n=>{if(!n.code&&!n.key)return!1;let r=Uie(n.code,e);return Array.isArray(e)?e.some(e=>E5(n[r],e,t,n.type===`keyup`)):E5(n[r],e,t,n.type===`keyup`)}}function Uie(e,t){return t.includes(e)?`code`:`key`}function D5(e,t){let n=J(()=>Fe(t?.target)??Bie),r=Je(Fe(e)===!0),i=!1,a=new Set,o=c(Fe(e));M(()=>Fe(e),(e,t)=>{typeof t==`boolean`&&typeof e!=`boolean`&&s(),o=c(e)},{immediate:!0}),U2([`blur`,`contextmenu`],s),G2((...e)=>o(...e),e=>{let n=Fe(t?.actInsideInputWithModifier)??!0,a=Fe(t?.preventDefault)??!1;if(i=Vie(e),(!i||i&&!n)&&T5(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}),G2((...e)=>o(...e),e=>{let n=Fe(t?.actInsideInputWithModifier)??!0;if(r.value){if((!i||i&&!n)&&T5(e))return;i=!1,r.value=!1}},{eventName:`keyup`,target:n});function s(){i=!1,a.clear(),r.value=Fe(e)===!0}function c(e){return e===null?(s(),()=>!1):typeof e==`boolean`?(s(),r.value=e,()=>!1):Array.isArray(e)||typeof e==`string`?Hie(e,a):e}return r}var O5=`vue-flow__node-desc`,k5=`vue-flow__edge-desc`,Wie=`vue-flow__aria-live`,A5=[`Enter`,` `,`Escape`],j5={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function M5(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function N5(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 P5(e){return{width:e.offsetWidth,height:e.offsetHeight}}function F5(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function I5(e,t){return{x:F5(e.x,t[0][0],t[1][0]),y:F5(e.y,t[0][1],t[1][1])}}function L5(e){let t=e.getRootNode();return`elementFromPoint`in t?t:window.document}function R5(e){return e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e}function z5(e){return e&&typeof e==`object`&&`id`in e&&`position`in e&&!R5(e)}function B5(e){return z5(e)&&`computedPosition`in e}function V5(e){return!Number.isNaN(e)&&Number.isFinite(e)}function Gie(e){return V5(e.width)&&V5(e.height)&&V5(e.x)&&V5(e.y)}function Kie(e,t,n){let r={id:e.id.toString(),type:e.type??`default`,dimensions:Me({width:0,height:0}),computedPosition:Me({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:F7(e.data)?e.data:{},events:Me(F7(e.events)?e.events:{})};return Object.assign(t??r,e,{id:e.id.toString(),parentNode:n})}function H5(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:F7(e.data)?e.data:{},events:Me(F7(e.events)?e.events:{}),label:e.label??``,interactionWidth:e.interactionWidth??n?.interactionWidth,...n??{}};return Object.assign(t??r,e,{id:e.id.toString()})}function U5(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 qie(...e){if(e.length===3){let[t,n,r]=e;return U5(t,n,r,`target`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>R5(e)&&e.source===r).map(e=>n.find(t=>z5(t)&&t.id===e.target))}function Jie(...e){if(e.length===3){let[t,n,r]=e;return U5(t,n,r,`source`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>R5(e)&&e.target===r).map(e=>n.find(t=>z5(t)&&t.id===e.source))}function W5({source:e,sourceHandle:t,target:n,targetHandle:r}){return`vueflow__edge-${e}${t??``}-${n}${r??``}`}function Yie(e,t){return t.some(t=>R5(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 G5({x:e,y:t},{x:n,y:r,zoom:i}){return{x:e*i+n,y:t*i+r}}function K5({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?T7(s,o):s}function Xie(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 q5({x:e,y:t,width:n,height:r}){return{x:e,y:t,x2:e+n,y2:t+r}}function Zie({x:e,y:t,x2:n,y2:r}){return{x:e,y:t,width:n-e,height:r-t}}function J5(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=Xie(t,q5({...r.computedPosition,...r.dimensions}))}return Zie(t)}function Y5(e,t,n={x:0,y:0,zoom:1},r=!1,i=!1){let a={...K5(t,n),width:t.width/n.zoom,height:t.height/n.zoom},o=[];for(let t of e){let{dimensions:e,selectabl 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}
@@ -319,7 +319,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`},b7=class extends Error{constructor(e,...t){super(y7[e]?.call(y7,...t)),this.name=`VueFlowError`,this.code=e,this.args=t}};function x7(e){return`clientX`in e}function fce(e){return`sourceEvent`in e}function S7(e,t){let n=x7(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 C7=()=>typeof navigator<`u`&&(navigator==null?void 0:navigator.userAgent)?.indexOf(`Mac`)>=0;function pce(e){return{width:e.dimensions?.width??e.width??0,height:e.dimensions?.height??e.height??0}}function w7(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}var mce=()=>!0;function T7(e){e?.classList.remove(`valid`,`connecting`,`vue-flow__handle-valid`,`vue-flow__handle-connecting`)}function hce(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())M5(i,j5(e))>0&&r.push(e);return r}var gce=250;function _ce(e,t,n,r){let i=[],a=1/0,o=hce(e,n,t+gce);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}=g7(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 E7(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=mce},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:_}=S7(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=D7(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===x5.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=O7(t,e,a,p,n,!0)}return b}function D7(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function vce(e,t){let n=null;return t?n=`valid`:e&&!t&&(n=`invalid`),n}function yce(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}function O7(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===x5.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,...g7(o,c,c.position,!0)}:c}var k7={[v5.Left]:v5.Right,[v5.Right]:v5.Left,[v5.Top]:v5.Bottom,[v5.Bottom]:v5.Top},bce=[`production`,`prod`];function A7(e,...t){j7()&&console.warn(`[Vue Flow]: ${e}`,...t)}function j7(){return!bce.includes(`production`)}function M7(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,...N5(t)}}):null}function N7(e,t,n,r,i,a=!1,o){i.value=!1,e.selected?(a||e.selected&&t)&&(r([e]),We(()=>{o.blur()})):n([e])}function P7(e){return V(e)!==void 0}function xce(e,t,n,r){if(!e||!e.source||!e.target)return n(new b7(v7.EDGE_INVALID,e?.id??`[ID UNKNOWN]`)),!1;let i;return i=L5(e)?e:{...e,id:U5(e)},i=V5(i,void 0,r),!ece(i,t)&&i}function Sce(e,t,n,r,i){if(!t.source||!t.target)return i(new b7(v7.EDGE_INVALID,e.id)),!1;if(!n)return i(new b7(v7.EDGE_NOT_FOUND,e.id)),!1;let{id:a,...o}=e;return{...o,id:r?U5(t):a,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function F7(e,t,n){let r={},i=[];for(let a=0;a<e.length;++a){let o=e[a];if(!R5(o)){n(new b7(v7.NODE_INVALID,o?.id));continue}let s=Zse(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 b7(v7.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 I7(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 L7(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}`;I7(`sourcLine truncated
`)},B(e.data.summary||e.data.detail),9,uue)):F(``,!0),e.data.when||e.data.retry||e.data.continues?(L(),j(`div`,due,[e.data.when?(L(),j(`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}`},[A(V(au),{class:`size-3 shrink-0`,"aria-hidden":`true`}),R(`span`,pue,B(e.data.when),1)],8,fue)):F(``,!0),e.data.retry?(L(),j(`span`,{key:1,class:`flex items-center gap-0.5 rounded bg-secondary px-1`,title:`Up to ${e.data.retry} attempts`},[A(V(hte),{class:`size-3`,"aria-hidden":`true`}),H(`×`+B(e.data.retry),1)],8,mue)):F(``,!0),e.data.continues?(L(),j(`span`,hue,[A(V(Ste),{class:`size-3`,"aria-hidden":`true`}),r[10]||=H(`continues`,-1)])):F(``,!0)])):F(``,!0),e.data.run?.error?(L(),j(`p`,{key:4,class:`mt-1 line-clamp-2 text-caption text-danger`,title:e.data.run.error},B(e.data.run.error),9,gue)):F(``,!0)],64))]),A(ut,{"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:I(()=>[e.data.expanded?(L(),j(`div`,{key:0,class:`nodrag nopan nowheel cursor-auto border-t border-border`,onClick:r[6]||=pt(()=>{},[`stop`])},[K(t.$slots,`default`)])):F(``,!0)]),_:3}),A(V($7),{type:`source`,position:V(v5).Bottom},null,8,[`position`]),A(V($7),{id:`data-out`,type:`source`,position:V(v5).Right,class:`!opacity-0`},null,8,[`position`]),e.data.type===`switch`?(L(),q(V($7),{key:1,id:`otherwise`,type:`source`,position:V(v5).Right,class:`!opacity-0`},null,8,[`position`])):F(``,!0)],2))}}),vue={class:`pointer-events-none size-full rounded-xl border border-dashed border-border bg-muted/30`},yue={class:`flex items-center gap-1 px-2.5 pt-1.5 text-caption text-fg-subtle`},bue={key:0},xue={key:1,class:`font-mono`},Sue=P({__name:`LaneNode`,props:{data:{}},setup(e){return(t,n)=>(L(),j(`div`,vue,[R(`div`,yue,[e.data.lane===`switch`?(L(),j(U,{key:0},[A(V(Ou),{class:`size-3`,"aria-hidden":`true`}),e.data.title==="default"?(L(),j(`span`,bue,`otherwise`)):(L(),j(`span`,xue,`= `+B(e.data.title),1))],64)):(L(),j(U,{key:1},[A(V(su),{class:`size-3`,"aria-hidden":`true`}),H(B(e.data.title),1)],64))])]))}}),Cue={class:`flex shrink-0 items-center justify-center gap-1 border-t border-border bg-card p-1`},C9=240,wue=416,w9=-140,Tue=72,Eue=.9,T9=P({__name:`WorkflowCanvas`,props:{yaml:{},stages:{},open:{},triggers:{},types:{},readonly:{type:Boolean},restartable:{type:Boolean},marks:{},problems:{},title:{},summary:{}},emits:[`toggle`,`insert`,`duplicate`,`move`,`remove`,`rename`,`restart`],setup(e,{emit:t}){let n=e,r=t,i=Y(()=>!!n.types?.length&&!n.readonly),a=Y(()=>[...n.types??[],`parallel`,`switch`]),o=Y(()=>a.value.filter(e=>[`agent.run`,`workflow.call`].includes(e))),s=e=>e&&l0(e)?o.value:a.value,c=e=>e.kind===`step`?JSON.stringify(e.path??null):e.kind,l=J(null),u=J(null),d=lee(`(max-width: 767px)`),f=Y(()=>{let e=O0(z0(n.yaml),n.stages??[]);return n.types?.length?{nodes:[{id:`workflow`,type:`step`,position:{x:0,y:w9},data:{kind:`workflow`,key:`workflow`,title:n.title||`Workflow`,type:``,detail:n.summary??``}},...e.nodes],edges:[{id:`flow-workflow-start`,source:`workflow`,target:`start`,kind:`flow`},...e.edges]}:e}),p=Y(()=>f.value.nodes.filter(e=>e.data.path?.length===2).length),m=J({}),h=J({}),g=Y(()=>f.value.nodes.find(e=>e.type===`step`&&c(e.data)===n.open));function _(e,t){m.value={...m.value,[e]:t},g.value?.id!==e&&(h.value={...h.value,[e]:t})}let v=Y(()=>{let e=d.value?void 0:g.value?.id;return e&&m.value[e]?Math.max(0,m.value[e]-(h.value[e]??m.value[e])):0}),y=Ot(),b=see(v,{duration:Y(()=>y.value===`reduce`?0:200)}),x=Y(()=>{let e=new Map;for(let t of f.value.nodes){if(t.type!==`step`)continue;let n=(t.id===g.value?.id?h.value[t.id]:void 0)??m.value[t.id];n!==void 0&&e.set(t.position.y,Math.max(e.get(t.position.y)??-72,n-Tue))}return[...e]}),S=e=>x.value.reduce((t,[n,r])=>n<e?t+r:t,0);function C(e){let t=e.data,a=c(t),o=t.path,s={triggers:t.kind===`start`?n.triggers??[]:t.triggers,expanded:!d.value&&a===n.open,editable:i.value,problem:o?n.problems?.[a]:void 0,onResize:t=>_(e.id,t)};return n.types?.length&&(s.onToggle=()=>r(`toggle`,a)),i.value&&o&&(s.onRename=e=>r(`rename`,o,e),s.onDuplicate=()=>r(`duplicate`,o),s.onRemove=()=>r(`remove`,o)),{...e,data:{...t,...s}}}let w=e=>{let t=g.value;return d.value||!t||!e.style?.width?!1:e.position.x<=t.position.x&&e.position.x+parseFloat(String(e.style.width))>=t.position.x+C9};function T(e){let t=g.value;if(d.value||!t)return 0;if(e.id===t.id||w(e))return-88;let n=t.position.x+C9/2,r=e.style?.width?parseFloat(String(e.style.width)):e.type===`step`?C9:32,i=e.position.x+r/2;return Math.abs(i-n)<C9/2?0:i<n?-88:88}let ee=Y(()=>{let e=g.value;return f.value.nodes.map(t=>{let a=t;t.type===`add`?t={...t,data:{...t.data,types:s(t.data.insertAfter),editable:i.value,onInsert:e=>r(`insert`,t.data.insertAfter,e)}}:t.type===`step`&&(t=C(t));let o=n.marks?.[t.id];o&&(t={...t,data:{...t.data,mark:o}});let c=t.position 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`},x7=class extends Error{constructor(e,...t){super(b7[e]?.call(b7,...t)),this.name=`VueFlowError`,this.code=e,this.args=t}};function S7(e){return`clientX`in e}function sae(e){return`sourceEvent`in e}function C7(e,t){let n=S7(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 w7=()=>typeof navigator<`u`&&(navigator==null?void 0:navigator.userAgent)?.indexOf(`Mac`)>=0;function cae(e){return{width:e.dimensions?.width??e.width??0,height:e.dimensions?.height??e.height??0}}function T7(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}var lae=()=>!0;function E7(e){e?.classList.remove(`valid`,`connecting`,`vue-flow__handle-valid`,`vue-flow__handle-connecting`)}function uae(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())N5(i,M5(e))>0&&r.push(e);return r}var dae=250;function fae(e,t,n,r){let i=[],a=1/0,o=uae(e,n,t+dae);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}=_7(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 D7(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=lae},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:_}=C7(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=O7(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===S5.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=k7(t,e,a,p,n,!0)}return b}function O7(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function pae(e,t){let n=null;return t?n=`valid`:e&&!t&&(n=`invalid`),n}function mae(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}function k7(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===S5.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,..._7(o,c,c.position,!0)}:c}var A7={[y5.Left]:y5.Right,[y5.Right]:y5.Left,[y5.Top]:y5.Bottom,[y5.Bottom]:y5.Top},hae=[`production`,`prod`];function j7(e,...t){M7()&&console.warn(`[Vue Flow]: ${e}`,...t)}function M7(){return!hae.includes(`production`)}function N7(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,...P5(t)}}):null}function P7(e,t,n,r,i,a=!1,o){i.value=!1,e.selected?(a||e.selected&&t)&&(r([e]),Pe(()=>{o.blur()})):n([e])}function F7(e){return B(e)!==void 0}function gae(e,t,n,r){if(!e||!e.source||!e.target)return n(new x7(y7.EDGE_INVALID,e?.id??`[ID UNKNOWN]`)),!1;let i;return i=R5(e)?e:{...e,id:W5(e)},i=H5(i,void 0,r),!Yie(i,t)&&i}function _ae(e,t,n,r,i){if(!t.source||!t.target)return i(new x7(y7.EDGE_INVALID,e.id)),!1;if(!n)return i(new x7(y7.EDGE_NOT_FOUND,e.id)),!1;let{id:a,...o}=e;return{...o,id:r?W5(t):a,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function I7(e,t,n){let r={},i=[];for(let a=0;a<e.length;++a){let o=e[a];if(!z5(o)){n(new x7(y7.NODE_INVALID,o?.id));continue}let s=Kie(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 x7(y7.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 L7(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 R7(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}`;L7(`sourcLine truncated
`)},z(e.data.summary||e.data.detail),9,ise)):P(``,!0),e.data.when||e.data.retry||e.data.continues?(I(),k(`div`,ase,[e.data.when?(I(),k(`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}`},[O(B(Hc),{class:`size-3 shrink-0`,"aria-hidden":`true`}),L(`span`,sse,z(e.data.when),1)],8,ose)):P(``,!0),e.data.retry?(I(),k(`span`,{key:1,class:`flex items-center gap-0.5 rounded bg-secondary px-1`,title:`Up to ${e.data.retry} attempts`},[O(B(pl),{class:`size-3`,"aria-hidden":`true`}),V(`×`+z(e.data.retry),1)],8,cse)):P(``,!0),e.data.continues?(I(),k(`span`,lse,[O(B(Sl),{class:`size-3`,"aria-hidden":`true`}),r[10]||=V(`continues`,-1)])):P(``,!0)])):P(``,!0),e.data.run?.error?(I(),k(`p`,{key:4,class:`mt-1 line-clamp-2 text-caption text-danger`,title:e.data.run.error},z(e.data.run.error),9,use)):P(``,!0)],64))]),O($e,{"enter-from-class":`opacity-0 -translate-y-1`,"enter-active-class":`transition duration-200`,"leave-to-class":`opacity-0`,"leave-active-class":`transition duration-100`},{default:F(()=>[e.data.expanded?(I(),k(`div`,{key:0,class:`nodrag nopan nowheel cursor-auto border-t border-border`,onClick:r[6]||=tt(()=>{},[`stop`])},[G(t.$slots,`default`)])):P(``,!0)]),_:3}),O(B(e9),{type:`source`,position:B(y5).Bottom},null,8,[`position`]),O(B(e9),{id:`data-out`,type:`source`,position:B(y5).Right,class:`!opacity-0`},null,8,[`position`]),e.data.type===`switch`?(I(),K(B(e9),{key:1,id:`otherwise`,type:`source`,position:B(y5).Right,class:`!opacity-0`},null,8,[`position`])):P(``,!0)],2))}}),fse={class:`pointer-events-none size-full rounded-xl border border-dashed border-border bg-muted/30`},pse={class:`flex items-center gap-1 px-2.5 pt-1.5 text-caption text-fg-subtle`},mse={key:0},hse={key:1,class:`font-mono`},gse=N({__name:`LaneNode`,props:{data:{}},setup(e){return(t,n)=>(I(),k(`div`,fse,[L(`div`,pse,[e.data.lane===`switch`?(I(),k(H,{key:0},[O(B(Cl),{class:`size-3`,"aria-hidden":`true`}),e.data.title==="default"?(I(),k(`span`,mse,`otherwise`)):(I(),k(`span`,hse,`= `+z(e.data.title),1))],64)):(I(),k(H,{key:1},[O(B(Wc),{class:`size-3`,"aria-hidden":`true`}),V(z(e.data.title),1)],64))])]))}}),_se={class:`flex shrink-0 items-center justify-center gap-1 border-t border-border bg-card p-1`},T9=240,vse=416,E9=-140,yse=72,bse=.9,D9=N({__name:`WorkflowCanvas`,props:{yaml:{},stages:{},open:{},triggers:{},types:{},readonly:{type:Boolean},restartable:{type:Boolean},marks:{},problems:{},title:{},summary:{}},emits:[`toggle`,`insert`,`duplicate`,`move`,`remove`,`rename`,`restart`],setup(e,{emit:t}){let n=e,r=t,i=J(()=>!!n.types?.length&&!n.readonly),a=J(()=>[...n.types??[],`parallel`,`switch`]),o=J(()=>a.value.filter(e=>[`agent.run`,`workflow.call`].includes(e))),s=e=>e&&JQ(e)?o.value:a.value,c=e=>e.kind===`step`?JSON.stringify(e.path??null):e.kind,l=q(null),u=q(null),d=Gn(`(max-width: 767px)`),f=J(()=>{let e=p$(w$(n.yaml),n.stages??[]);return n.types?.length?{nodes:[{id:`workflow`,type:`step`,position:{x:0,y:E9},data:{kind:`workflow`,key:`workflow`,title:n.title||`Workflow`,type:``,detail:n.summary??``}},...e.nodes],edges:[{id:`flow-workflow-start`,source:`workflow`,target:`start`,kind:`flow`},...e.edges]}:e}),p=J(()=>f.value.nodes.filter(e=>e.data.path?.length===2).length),m=q({}),h=q({}),g=J(()=>f.value.nodes.find(e=>e.type===`step`&&c(e.data)===n.open));function _(e,t){m.value={...m.value,[e]:t},g.value?.id!==e&&(h.value={...h.value,[e]:t})}let v=J(()=>{let e=d.value?void 0:g.value?.id;return e&&m.value[e]?Math.max(0,m.value[e]-(h.value[e]??m.value[e])):0}),y=Xn(),b=Un(v,{duration:J(()=>y.value===`reduce`?0:200)}),x=J(()=>{let e=new Map;for(let t of f.value.nodes){if(t.type!==`step`)continue;let n=(t.id===g.value?.id?h.value[t.id]:void 0)??m.value[t.id];n!==void 0&&e.set(t.position.y,Math.max(e.get(t.position.y)??-72,n-yse))}return[...e]}),S=e=>x.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:!d.value&&a===n.open,editable:i.value,problem:o?n.problems?.[a]:void 0,onResize:t=>_(e.id,t)};return n.types?.length&&(s.onToggle=()=>r(`toggle`,a)),i.value&&o&&(s.onRename=e=>r(`rename`,o,e),s.onDuplicate=()=>r(`duplicate`,o),s.onRemove=()=>r(`remove`,o)),{...e,data:{...t,...s}}}let C=e=>{let t=g.value;return d.value||!t||!e.style?.width?!1:e.position.x<=t.position.x&&e.position.x+parseFloat(String(e.style.width))>=t.position.x+T9};function te(e){let t=g.value;if(d.value||!t)return 0;if(e.id===t.id||C(e))return-88;let n=t.position.x+T9/2,r=e.style?.width?parseFloat(String(e.style.width)):e.type===`step`?T9:32,i=e.position.x+r/2;return Math.abs(i-n)<T9/2?0:i<n?-88:88}let ne=J(()=>{let e=g.value;return f.value.nodes.map(t=>{let a=t;t.type===`add`?t={...t,data:{...t.data,types:s(t.data.insertAfter),editable:i.value,onInsert:e=>r(`insert`,t.data.insertAfter,e)}}:t.type===`step`&&(t=ee(t));let o=n.marks?.[t.id];o&&(t={...t,data:{...t.data,mark:o}});let c=t.position. Line truncated
`),r=t.split(`
`),i=Array.from({length:n.length+1},()=>Array(r.length+1).fill(0));for(let e=n.length-1;e>=0;e--)for(let t=r.length-1;t>=0;t--)i[e][t]=n[e]===r[t]?i[e+1][t+1]+1:Math.max(i[e+1][t],i[e][t+1]);let a=[],o=0,s=0;for(;o<n.length&&s<r.length;)n[o]===r[s]?(a.push({kind:`same`,text:n[o++]}),s++):i[o+1][s]>=i[o][s+1]?a.push({kind:`del`,text:n[o++]}):a.push({kind:`add`,text:r[s++]});for(;o<n.length;)a.push({kind:`del`,text:n[o++]});for(;s<r.length;)a.push({kind:`add`,text:r[s++]});return a}function E9(e){let t=r0(e).toJS(),n=new Map;for(let r of z0(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 D9(e,t,n){let r=E9(e),i=E9(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 jue={class:`flex flex-col gap-3 md:grid md:h-[calc(100dvh-17rem)] md:min-h-[26rem] md:grid-cols-[18rem_1fr]`},Mue=[`aria-current`,`onClick`],Nue={class:`flex items-center gap-2 text-sm`},Pue={class:`font-mono text-xs text-fg-subtle`},Fue=[`title`],Iue={key:0,class:`px-3 py-2 text-sm text-fg-muted`},Lue={key:1,class:`flex min-h-0 flex-col gap-2`},Rue={class:`flex items-center gap-2 max-md:flex-wrap`},zue={key:0,class:`rounded-lg border border-border p-4 text-sm text-fg-muted`},Bue={key:1,class:`min-h-0 flex-1 overflow-auto rounded-lg border border-border pt-2 pb-[calc(0.5rem+var(--code-overscroll))] font-mono text-label leading-6`},Vue={class:`inline-block w-4 select-none text-fg-subtle`},Hue={key:2,class:`grid min-h-0 flex-1 gap-3 max-md:flex-none md:grid-cols-2`},Uue={class:`flex min-h-0 flex-col gap-1`},Wue={class:`text-caption font-medium uppercase text-fg-muted`},Gue={class:`min-h-0 flex-1 max-md:h-72 max-md:flex-none`},Kue={class:`flex min-h-0 flex-col gap-1`},que={class:`min-h-0 flex-1 max-md:h-72 max-md:flex-none`},Jue=P({__name:`WorkflowHistory`,props:Ye({revisions:{},current:{},error:{}},{selected:{default:0},selectedModifiers:{},mode:{default:`yaml`},modeModifiers:{}}),emits:Ye([`restore`],[`update:selected`,`update:mode`]),setup(e,{emit:t}){let n=e,r=t,i=ke(e,`selected`),a=ke(e,`mode`);N(()=>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=Y(()=>n.revisions.find(e=>e.version===i.value)),s=Y(()=>o.value?.yaml??null),c=Y(()=>s.value===null?[]:Aue(s.value,n.current)),l=Y(()=>s.value!==null&&s.value===n.current),u=Y(()=>s.value===null?{}:D9(s.value,n.current,`removed`)),d=Y(()=>s.value===null?{}:D9(n.current,s.value,`added`)),f={added:`default`,edited:`secondary`,removed:`destructive`};return(t,n)=>(L(),j(`div`,jue,[R(`ol`,{class:z(V(W)(`min-h-0 divide-y divide-border overflow-y-auto rounded-lg border border-border`,e.revisions.length&&`max-md:hidden`)),"aria-label":`Revisions`},[(L(!0),j(U,null,M(e.revisions,e=>(L(),j(`li`,{key:e.version},[R(`button`,{type:`button`,class:z([`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},[R(`span`,Nue,[R(`span`,Pue,`v`+B(e.version),1),A(V(k),{variant:f[e.change]},{default:I(()=>[H(B(e.change),1)]),_:2},1032,[`variant`])]),R(`span`,{class:`mt-0.5 block truncate text-xs text-fg-muted`,title:e.at},[H(B(e.actor||`unknown`)+` · `+B(e.source||`unknown`)+` · `,1),A(V(fw),{at:e.at},null,8,[`at`])],8,Fue)],10,Mue)]))),128)),e.revisions.length?F(``,!0):(L(),j(`li`,Iue,B(e.error||`No recorded changes`),1))],2),e.revisions.length?(L(),q(V(zu),{key:0,"model-value":String(i.value),"onUpdate:modelValue":n[0]||=e=>i.value=Number(e)},{default:I(()=>[A(V(Uu),{class:`w-full md:hidden`,"aria-label":`Revision`},{default:I(()=>[A(V(Wu))]),_:1}),A(V(Bu),null,{default:I(()=>[(L(!0),j(U,null,M(e.revisions,e=>(L(),q(V(Hu),{key:e.version,value:String(e.version)},{default:I(()=>[H(`v`+B(e.version)+` · `+B(e.change)+` · `+B(e.actor||`unknown`)+` · `+B(V(uw)(e.at)),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1},8,[`model-value`])):F(``,!0),o.value?(L(),j(`div`,Lue,[R(`div`,Rue,[A(V(_O),{modelValue:a.value,"onUpdate:modelValue":n[1]||=e=>a.value=e},{default:I(()=>[A(V(yO),null,{default:I(()=>[A(V(bO),{value:`yaml`},{default:I(()=>[...n[3]||=[H(`YAML`,-1)]]),_:1}),A(V(bO),{value:`canvas`},{default:I(()=>[...n[4]||=[H(`Canvas`,-1)]]),_:1})]),_:1})]),_:1},8,[`modelValue`]),A(V(X),{type:`button`,size:`sm`,variant:`outline`,class:`ml-auto`,disabled:s.value===null||l.value,title:s.value===null?`Workflow removed`:void 0,onClick:n[2]||=e=>r(`restore`,s.value)},{default:I(()=>[A(V(Tu),{"data-icon":`inline-start`}),n[5]||=H(` Restore this version`,-1)]),_:1},8,[`disabled`,`title`])]),s.value===null?(L(),j(`p`,zue,`Workflow removed in this revision.`)):a.value===`yaml`?(L(),j(`pre`,Bue,[R(`code`,null,[(L(!0),j(U,null,M(c.value,(e,t)=>(L(),j(`span`,{key:t,class:z([`block min-h-6 px-3 whitespace-pre-wrap`,{"bg-o 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 O9(e){let t=HQ(e).toJS(),n=new Map;for(let r of w$(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 k9(e,t,n){let r=O9(e),i=O9(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 Tse={class:`flex flex-col gap-3 md:grid md:h-[calc(100dvh-17rem)] md:min-h-[26rem] md:grid-cols-[18rem_1fr]`},Ese=[`aria-current`,`onClick`],Dse={class:`flex items-center gap-2 text-sm`},Ose={class:`font-mono text-xs text-fg-subtle`},kse=[`title`],Ase={key:0,class:`px-3 py-2 text-sm text-fg-muted`},jse={key:1,class:`flex min-h-0 flex-col gap-2`},Mse={class:`flex items-center gap-2 max-md:flex-wrap`},Nse={key:0,class:`rounded-lg border border-border p-4 text-sm text-fg-muted`},Pse={key:1,class:`min-h-0 flex-1 overflow-auto rounded-lg border border-border pt-2 pb-[calc(0.5rem+var(--code-overscroll))] font-mono text-label leading-6`},Fse={class:`inline-block w-4 select-none text-fg-subtle`},Ise={key:2,class:`grid min-h-0 flex-1 gap-3 max-md:flex-none md:grid-cols-2`},Lse={class:`flex min-h-0 flex-col gap-1`},Rse={class:`text-caption font-medium uppercase text-fg-muted`},zse={class:`min-h-0 flex-1 max-md:h-72 max-md:flex-none`},Bse={class:`flex min-h-0 flex-col gap-1`},Vse={class:`min-h-0 flex-1 max-md:h-72 max-md:flex-none`},Hse=N({__name:`WorkflowHistory`,props:ze({revisions:{},current:{},error:{}},{selected:{default:0},selectedModifiers:{},mode:{default:`yaml`},modeModifiers:{}}),emits:ze([`restore`],[`update:selected`,`update:mode`]),setup(e,{emit:t}){let n=e,r=t,i=be(e,`selected`),a=be(e,`mode`);M(()=>n.revisions,e=>{e.some(e=>e.version===i.value)||(i.value=(e.find(e=>e.yaml!==n.current)??e[0])?.version??0)},{immediate:!0});let o=J(()=>n.revisions.find(e=>e.version===i.value)),s=J(()=>o.value?.yaml??null),c=J(()=>s.value===null?[]:wse(s.value,n.current)),l=J(()=>s.value!==null&&s.value===n.current),u=J(()=>s.value===null?{}:k9(s.value,n.current,`removed`)),d=J(()=>s.value===null?{}:k9(n.current,s.value,`added`)),f={added:`default`,edited:`secondary`,removed:`destructive`};return(t,n)=>(I(),k(`div`,Tse,[L(`ol`,{class:R(B(U)(`min-h-0 divide-y divide-border overflow-y-auto rounded-lg border border-border`,e.revisions.length&&`max-md:hidden`)),"aria-label":`Revisions`},[(I(!0),k(H,null,A(e.revisions,e=>(I(),k(`li`,{key:e.version},[L(`button`,{type:`button`,class:R([`block w-full px-3 py-2 text-left hover:bg-secondary`,e.version===i.value&&`bg-secondary`]),"aria-current":e.version===i.value,onClick:t=>i.value=e.version},[L(`span`,Dse,[L(`span`,Ose,`v`+z(e.version),1),O(B(w),{variant:f[e.change]},{default:F(()=>[V(z(e.change),1)]),_:2},1032,[`variant`])]),L(`span`,{class:`mt-0.5 block truncate text-xs text-fg-muted`,title:e.at},[V(z(e.actor||`unknown`)+` · `+z(e.source||`unknown`)+` · `,1),O(B(lC),{at:e.at},null,8,[`at`])],8,kse)],10,Ese)]))),128)),e.revisions.length?P(``,!0):(I(),k(`li`,Ase,z(e.error||`No recorded changes`),1))],2),e.revisions.length?(I(),K(B(zn),{key:0,"model-value":String(i.value),"onUpdate:modelValue":n[0]||=e=>i.value=Number(e)},{default:F(()=>[O(B(In),{class:`w-full md:hidden`,"aria-label":`Revision`},{default:F(()=>[O(B(Bn))]),_:1}),O(B(Ln),null,{default:F(()=>[(I(!0),k(H,null,A(e.revisions,e=>(I(),K(B(Fn),{key:e.version,value:String(e.version)},{default:F(()=>[V(`v`+z(e.version)+` · `+z(e.change)+` · `+z(e.actor||`unknown`)+` · `+z(B(GS)(e.at)),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1},8,[`model-value`])):P(``,!0),o.value?(I(),k(`div`,jse,[L(`div`,Mse,[O(B(fE),{modelValue:a.value,"onUpdate:modelValue":n[1]||=e=>a.value=e},{default:F(()=>[O(B(mE),null,{default:F(()=>[O(B(hE),{value:`yaml`},{default:F(()=>[...n[3]||=[V(`YAML`,-1)]]),_:1}),O(B(hE),{value:`canvas`},{default:F(()=>[...n[4]||=[V(`Canvas`,-1)]]),_:1})]),_:1})]),_:1},8,[`modelValue`]),O(B(Y),{type:`button`,size:`sm`,variant:`outline`,class:`ml-auto`,disabled:s.value===null||l.value,title:s.value===null?`Workflow removed`:void 0,onClick:n[2]||=e=>r(`restore`,s.value)},{default:F(()=>[O(B(ml),{"data-icon":`inline-start`}),n[5]||=V(` Restore this version`,-1)]),_:1},8,[`disabled`,`title`])]),s.value===null?(I(),k(`p`,Nse,`Workflow removed in this revision.`)):a.value===`yaml`?(I(),k(`pre`,Pse,[L(`code`,null,[(I(!0),k(H,null,A(c.value,(e,t)=>(I(),k(`span`,{key:t,class:R([`block min-h-6 px-3 whitespace-pre-wrap`,{"bg-o Line truncated
+1
View File
@@ -0,0 +1 @@
function e(e){return typeof e==`string`?`'${e}'`:new r().serialize(e)}var t=(function(){let e=new Uint8Array(128);for(let t=0;t<69;t++)e[` _-,;:!?.'"()[]{}@*/\\&#%\`^+<=>|~$0123456789abcdefghijklmnopqrstuvwxyz`.charCodeAt(t)]=t+1;for(let t=65;t<=90;t++)e[t]=e[t+32];return e})();function n(e,n){if(e===n)return 0;let r=Math.min(e.length,n.length),i=0;for(let a=0;a<r;a++){let r=e.charCodeAt(a),o=n.charCodeAt(a);if(r===o)continue;let s=r<128&&t[r]?t[r]:r+128,c=o<128&&t[o]?t[o]:o+128;if(s!==c)return s<c?-1:1;i===0&&(i=r>o?-1:1)}return e.length===n.length?i:e.length<n.length?-1:1}var r=(function(){class e{#e=new Map;compare(e,t){let r=typeof e,i=typeof t;return r===`string`&&i===`string`?n(e,t):r===`number`&&i===`number`?e-t:n(this.serialize(e,!0),this.serialize(t,!0))}serialize(e,t){if(e===null)return`null`;switch(typeof e){case`string`:return t?e:`'${e}'`;case`bigint`:return`${e}n`;case`object`:return this.$object(e);case`function`:return this.$function(e)}return String(e)}serializeObject(e){let t=Object.prototype.toString.call(e);if(t!==`[object Object]`)return this.serializeBuiltInType(t.length<10?`unknown:${t}`:t.slice(8,-1),e);let r=e.constructor,i=r===Object||r===void 0?``:r.name;if(i!==``&&globalThis[i]===r)return this.serializeBuiltInType(i,e);if(`toJSON`in e&&typeof e.toJSON==`function`){let t=e.toJSON();return i+(typeof t==`object`&&t?this.$object(t):`(${this.serialize(t)})`)}let a=Object.keys(e).sort(n),o=`${i}{`;for(let t=0;t<a.length;t++){let n=a[t];o+=`${n}:${this.serialize(e[n])}`,t<a.length-1&&(o+=`,`)}return o+`}`}serializeBuiltInType(e,t){let n=this[`$`+e];if(n)return n.call(this,t);if(typeof t.entries==`function`)return this.serializeObjectEntries(e,t.entries());throw Error(`Cannot serialize ${e}`)}serializeObjectEntries(e,t){let n=Array.from(t).sort((e,t)=>this.compare(e[0],t[0])),r=`${e}{`;for(let e=0;e<n.length;e++){let[t,i]=n[e];r+=`${this.serialize(t,!0)}:${this.serialize(i)}`,e<n.length-1&&(r+=`,`)}return r+`}`}$object(e){let t=this.#e.get(e);return t===void 0&&(this.#e.set(e,`#${this.#e.size}`),t=this.serializeObject(e),this.#e.set(e,t)),t}$function(e){let t=Function.prototype.toString.call(e);return t.slice(-15)===`[native code] }`?`${e.name||``}()[native]`:`${e.name}(${e.length})${t.replace(/\s*\n\s*/g,``)}`}$Array(e){let t=`[`;for(let n=0;n<e.length;n++)t+=this.serialize(e[n]),n<e.length-1&&(t+=`,`);return t+`]`}$Date(e){try{return`Date(${e.toISOString()})`}catch{return`Date(null)`}}$ArrayBuffer(e){return`ArrayBuffer[${new Uint8Array(e).join(`,`)}]`}$Set(e){return`Set${this.$Array(Array.from(e).sort((e,t)=>this.compare(e,t)))}`}$Map(e){return this.serializeObjectEntries(`Map`,e.entries())}}for(let t of[`Error`,`RegExp`,`URL`])e.prototype[`$`+t]=function(e){return`${t}(${e})`};for(let t of[`Int8Array`,`Uint8Array`,`Uint8ClampedArray`,`Int16Array`,`Uint16Array`,`Int32Array`,`Uint32Array`,`Float32Array`,`Float64Array`])e.prototype[`$`+t]=function(e){return`${t}[${e.join(`,`)}]`};for(let t of[`BigInt64Array`,`BigUint64Array`])e.prototype[`$`+t]=function(e){return`${t}[${e.join(`n,`)}${e.length>0?`n`:``}]`};return e})();function i(t,n){return t===n||e(t)===e(n)}function a(e){return e==null}export{i as n,a as t};
+1
View File
@@ -0,0 +1 @@
import{Dn as e,En as t,G as n,Gt as r,On as i,Z as a,cn as o,dn as s,gn as c,hn as l,it as u,pn as d,sn as f,xn as p,y as m,yn as h}from"./PageHeader.js";var g=typeof window<`u`,_,v=e=>_=e,y=Symbol();function b(e){return e&&typeof e==`object`&&Object.prototype.toString.call(e)===`[object Object]`&&typeof e.toJSON!=`function`}var x=typeof window==`object`&&window.window===window?window:typeof self==`object`&&self.self===self?self:typeof global==`object`&&global.global===global?global:typeof globalThis==`object`?globalThis:{HTMLElement:null};function S(e,{autoBom:t=!1}={}){return t&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([``,e],{type:e.type}):e}function C(e,t,n){let r=new XMLHttpRequest;r.open(`GET`,e),r.responseType=`blob`,r.onload=function(){O(r.response,t,n)},r.onerror=function(){console.error(`could not download file`)},r.send()}function w(e){let t=new XMLHttpRequest;t.open(`HEAD`,e,!1);try{t.send()}catch{}return t.status>=200&&t.status<=299}function T(e){try{e.dispatchEvent(new MouseEvent(`click`))}catch{let t=new MouseEvent(`click`,{bubbles:!0,cancelable:!0,view:window,detail:0,screenX:80,screenY:20,clientX:80,clientY:20,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,button:0,relatedTarget:null});e.dispatchEvent(t)}}var E=typeof navigator==`object`?navigator:{userAgent:``},D=/Macintosh/.test(E.userAgent)&&/AppleWebKit/.test(E.userAgent)&&!/Safari/.test(E.userAgent),O=g?typeof HTMLAnchorElement<`u`&&`download`in HTMLAnchorElement.prototype&&!D?k:`msSaveOrOpenBlob`in E?A:j:()=>{};function k(e,t=`download`,n){let r=document.createElement(`a`);r.download=t,r.rel=`noopener`,typeof e==`string`?(r.href=e,r.origin===location.origin?T(r):w(r.href)?C(e,t,n):(r.target=`_blank`,T(r))):(r.href=URL.createObjectURL(e),setTimeout(function(){URL.revokeObjectURL(r.href)},4e4),setTimeout(function(){T(r)},0))}function A(e,t=`download`,n){if(typeof e==`string`){if(w(e))C(e,t,n);else{let t=document.createElement(`a`);t.href=e,t.target=`_blank`,setTimeout(function(){T(t)})}}else navigator.msSaveOrOpenBlob(S(e,n),t)}function j(e,t,n,r){if(r||=open(``,`_blank`),r&&(r.document.title=r.document.body.innerText=`downloading...`),typeof e==`string`)return C(e,t,n);let i=e.type===`application/octet-stream`,a=/constructor/i.test(String(x.HTMLElement))||`safari`in x,o=/CriOS\/[\d]+/.test(navigator.userAgent);if((o||i&&a||D)&&typeof FileReader<`u`){let t=new FileReader;t.onloadend=function(){let e=t.result;if(typeof e!=`string`)throw r=null,Error(`Wrong reader.result type`);e=o?e:e.replace(/^data:[^;]*;/,`data:attachment/file;`),r?r.location.href=e:location.assign(e),r=null},t.readAsDataURL(e)}else{let t=URL.createObjectURL(e);r?r.location.assign(t):location.href=t,r=null,setTimeout(function(){URL.revokeObjectURL(t)},4e4)}}var{assign:M}=Object;function N(){let e=f(!0),t=e.run(()=>p({})),n=[],r=[],i=l({install(e){v(i),i._a=e,e.provide(y,i),e.config.globalProperties.$pinia=i,r.forEach(e=>n.push(e)),r=[]},use(e){return this._a?n.push(e):r.push(e),this},_p:n,_a:null,_e:e,_s:new Map,state:t});return i}var P=()=>{};function F(e,t,n,r=P){e.add(t);let i=()=>{e.delete(t)&&r()};return!n&&o()&&c(i),i}function I(e,...t){e.forEach(e=>{e(...t)})}var L=e=>e(),R=Symbol(),z=Symbol();function B(e,t){e instanceof Map&&t instanceof Map?t.forEach((t,n)=>e.set(n,t)):e instanceof Set&&t instanceof Set&&t.forEach(e.add,e);for(let n in t){if(!Object.hasOwn(t,n))continue;let r=t[n],i=e[n];e[n]=b(i)&&b(r)&&Object.hasOwn(e,n)&&!d(r)&&!s(r)?B(i,r):r}return e}var V=Symbol();function H(e){return!e||typeof e!=`object`||!Object.hasOwn(e,V)}var{assign:U}=Object;function W(e){return!!(d(e)&&e.effect)}function G(e,t,n,r){let{state:a,actions:o,getters:s}=t,c=n.state.value[e],u;function d(){return c||(n.state.value[e]=a?a():{}),U(i(n.state.value[e]),o,Object.keys(s||{}).reduce((t,r)=>(t[r]=l(m(()=>{v(n);let t=n._s.get(e);return s[r].call(t,t)})),t),{}))}return u=K(e,d,t,n,r,!0),u}function K(e,n,i={},a,o,c){let l,p=U({actions:{}},i),m={deep:!0},g,_,y=new Set,b=new Set,x,S=a.state.value[e];!c&&!S&&(a.state.value[e]={});let C;function w(t){let n;g=_=!1,typeof t==`function`?(t(a.state.value[e]),n={type:`patch function`,storeId:e,events:x}):(B(a.state.value[e],t),n={type:`patch object`,payload:t,storeId:e,events:x});let r=C=Symbol();u().then(()=>{C===r&&(g=!0)}),_=!0,I(y,n,a.state.value[e])}let T=c?function(){let{state:e}=i,t=e?e():{};this.$patch(e=>{U(e,t)})}:P;function E(){l.stop(),y.clear(),b.clear(),a._s.delete(e)}let D=(t,n=``)=>{if(R in t)return t[z]=n,t;let r=function(){v(a);let n=Array.from(arguments),i=new Set,o=new Set;function s(e){i.add(e)}function c(e){o.add(e)}I(b,{args:n,name:r[z],store:k,after:s,onError:c});let l;try{l=t.apply(this&&this.$id===e?this:k,n)}catch(e){throw I(o,e),e}return l instanceof Promise?l.then(e=>(I(i,e),e)).catch(e=>(I(o,e),Promise.reject(e))):(I(i,l),l)};return r[R]=!0,r[z]=n,r},O={_p:a,$id:e,$onAction:F.bind(null,b),$patch:w,$reset:T,$subscribe(t,n={}){if(y.has(t))return P;let i=FLine truncated
+1
View File
@@ -0,0 +1 @@
import{C as e,E as t,I as n,L as r,O as i,_ as a,a as o,c as s,d as c,f as l,g as u,h as d,j as f,l as p,m,n as h,o as g,p as _,r as ee,s as te,u as v,v as y,y as ne}from"./badge.js";import{A as b,Bt as re,C as x,Ct as S,Dt as ie,Gt as ae,H as C,Kt as oe,M as w,On as T,Qt as E,Rt as D,S as O,Xt as k,Z as se,_t as A,b as ce,dt as le,er as j,ht as ue,ir as M,it as N,jn as P,k as de,l as F,n as fe,nr as I,nt as pe,pn as me,r as L,rt as R,tt as he,wt as z,x as B,xn as V,y as H}from"./PageHeader.js";import{C as U,M as ge,N as W,at as G,it as _e,t as K,tt as ve}from"./createLucideIcon.js";import{a as ye,i as be,n as xe,o as Se,r as Ce,t as we}from"./duration.js";import{a as Te,c as Ee,d as De,f as q,g as Oe,i as ke,l as Ae,m as je,n as Me,o as Ne,p as Pe,r as Fe,s as Ie,t as Le,u as Re}from"./Collection.js";import{c as ze,t as Be}from"./input.js";import{t as Ve}from"./check.js";import"./textarea.js";import{a as He,i as J,n as Ue,o as We,r as Y,t as Ge}from"./table.js";var Ke=e=>e.startsWith(`/`);function qe(e){return typeof e==`object`||`displayName`in e||`props`in e||`__vccOpts`in e}function Je(e){return e.__esModule||e[Symbol.toStringTag]===`Module`||e.default&&qe(e.default)}var Ye=Object.assign;function Xe(e,t){let n={};for(let r in t){let i=t[r];n[r]=Qe(i)?i.map(e):e(i)}return n}var Ze=()=>{},Qe=Array.isArray;function $e(e,t){let n={};for(let r in e)n[r]=r in t?t[r]:e[r];return n}var et=Symbol(``);function tt(e,t){return Ye(Error(),{type:e,[et]:!0},t)}function nt(e,t){return e instanceof Error&&et in e&&(t==null||!!(e.type&t))}var rt=Symbol(``),it=Symbol(``),at=Symbol(``),ot=Symbol(``),st=Symbol(``),ct=Symbol(``);function lt(){return se(at)}function ut(e){return se(ot)}var dt=`rovingFocusGroup.onEntryFocus`,ft={bubbles:!1,cancelable:!0},pt={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function mt(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function ht(e,t,n){let r=mt(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return pt[r]}function gt(e,t=!1){let r=n();for(let i of e)if(i===r||(i.focus({preventScroll:t}),n()!==r))return}function _t(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var[vt,yt]=r(`RovingFocusGroup`),bt=w({__name:`RovingFocusGroup`,props:{orientation:{type:String,required:!1,default:void 0},dir:{type:String,required:!1},loop:{type:Boolean,required:!1,default:!1},currentTabStopId:{type:[String,null],required:!1},defaultCurrentTabStopId:{type:String,required:!1},preventScrollOnEntryFocus:{type:Boolean,required:!1,default:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`entryFocus`,`update:currentTabStopId`],setup(e,{expose:n,emit:r}){let i=e,a=r,{loop:o,orientation:s,dir:c}=T(i),l=y(c),u=t(i,`currentTabStopId`,a,{defaultValue:i.defaultCurrentTabStopId,passive:i.currentTabStopId===void 0}),d=V(!1),f=V(!1),p=V(0),{getItems:m,CollectionSlot:h}=Le({isProvider:!0});function g(e){let t=!f.value;if(e.currentTarget&&e.target===e.currentTarget&&t&&!d.value){let t=new CustomEvent(dt,ft);if(e.currentTarget.dispatchEvent(t),a(`entryFocus`,t),!t.defaultPrevented){let e=m().map(e=>e.ref).filter(e=>e.dataset.disabled!==``);gt([e.find(e=>e.getAttribute(`data-active`)===``),e.find(e=>e.getAttribute(`data-highlighted`)===``),e.find(e=>e.id===u.value),...e].filter(Boolean),i.preventScrollOnEntryFocus)}}f.value=!1}function _(){setTimeout(()=>{f.value=!1},1)}return n({getItems:m}),yt({loop:o,dir:l,orientation:s,currentTabStopId:u,onItemFocus:e=>{u.value=e},onItemShiftTab:()=>{d.value=!0},onFocusableItemAdd:()=>{p.value++},onFocusableItemRemove:()=>{p.value--}}),(t,n)=>(A(),B(P(h),null,{default:k(()=>[b(P(W),{tabindex:d.value||p.value===0?-1:0,"data-orientation":P(s),as:e.as,"as-child":e.asChild,dir:P(l),style:{outline:`none`},onMousedown:n[0]||=e=>f.value=!0,onMouseup:_,onFocus:g,onBlur:n[1]||=e=>d.value=!1},{default:k(()=>[z(t.$slots,`default`)]),_:3},8,[`tabindex`,`data-orientation`,`as`,`as-child`,`dir`])]),_:3}))}}),xt=w({__name:`MenuAnchor`,props:{reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let t=e;return(e,n)=>(A(),B(P(o),I(C(t)),{default:k(()=>[z(e.$slots,`default`)]),_:3},16))}});function St(){let t=V(!1);return le(()=>{e(`keydown`,()=>{t.value=!0},{capture:!0,passive:!0}),e([`pointerdown`,`pointermove`],()=>{t.value=!1},{capture:!0,passive:!0})}),t}var Ct=i(St),[X,wt]=r([`MenuRoot`,`MenuSub`],`MenuContext`),[Z,Tt]=r(`MenuRoot`),Et=w({__name:`MenuRoot`,props:{open:{type:Boolean,required:!1,default:!1},dir:{type:String,required:!1},modal:{type:Boolean,required:!1,default:!0}},emits:[`update:open`],setup(e,{emit:n}){let r=e,i=n,{modal:a,dir:o}=T(r),s=y(o),c=t(r,`open`,i),l=V(),u=Ct();return wt({open:c,onOpenChange:e=>{c.value=e},content:l,onContentChange:e=>{l.value=e}}),Tt({onClose:()=>{c.value=!1},isUsingKeyboardRef:u,dir:s,modal:aLine truncated
+1
View File
@@ -0,0 +1 @@
import{E as e,F as t,I as n,L as r,S as i,T as a,a as o,c as s,d as c,f as l,g as u,h as d,j as f,l as p,m,o as h,p as g,r as _,s as v,u as y,v as b,x,y as S}from"./badge.js";import{A as C,C as w,Ct as T,Dt as E,Gt as D,H as O,It as k,Kt as A,M as j,On as M,S as N,Xt as P,_t as F,b as I,dt as L,er as ee,ht as te,ir as ne,it as R,jn as z,k as re,l as ie,nr as B,p as ae,r as V,rr as oe,rt as H,st as se,wt as U,x as W,xn as G,y as K}from"./PageHeader.js";import{C as q,N as J,at as Y}from"./createLucideIcon.js";import{n as ce,t as le}from"./nullish.js";import{n as ue,r as de,t as fe}from"./VisuallyHidden.js";import{_ as pe,c as me,g as he,t as X}from"./Collection.js";import{t as ge}from"./check.js";import{n as _e,t as ve}from"./chevron-up.js";function ye(e){let t=x({nonce:G()});return K(()=>e?.value||t.nonce?.value)}var[be,xe]=r(`FieldRoot`),Se=[` `,`Enter`,`ArrowUp`,`ArrowDown`],Ce=[` `,`Enter`];function Z(e,t,n){return e===void 0?!1:Array.isArray(e)?e.some(e=>we(e,t,n)):we(e,t,n)}function we(e,t,n){return e===void 0||t===void 0?!1:typeof e==`string`?e===t:typeof n==`function`?n(e,t):typeof n==`string`?e?.[n]===t?.[n]:ce(e,t)}function Te(e){return e==null||e===``||Array.isArray(e)&&e.length===0}var Ee=[`value`],[Q,De]=r(`SelectRoot`),Oe=j({inheritAttrs:!1,__name:`SelectRoot`,props:{open:{type:Boolean,required:!1,default:void 0},defaultOpen:{type:Boolean,required:!1},defaultValue:{type:null,required:!1},modelValue:{type:null,required:!1,default:void 0},nullableValue:{type:String,required:!1,default:``},by:{type:[String,Function],required:!1},dir:{type:String,required:!1},multiple:{type:Boolean,required:!1},autocomplete:{type:String,required:!1},disabled:{type:Boolean,required:!1},name:{type:String,required:!1},required:{type:Boolean,required:!1}},emits:[`update:modelValue`,`update:open`],setup(t,{emit:n}){let r=t,i=n,{multiple:a,dir:o}=M(r),s=be(null),c=K(()=>r.name??s?.name.value),l=K(()=>s?r.required||s.required.value:r.required),u=K(()=>!!(r.disabled||s?.disabled.value)),d=e(r,`modelValue`,i,{defaultValue:r.defaultValue??(a.value?[]:void 0),passive:r.modelValue===void 0,deep:!0}),f=e(r,`open`,i,{defaultValue:r.defaultOpen,passive:r.open===void 0}),p=G(),m=G(),g=G({x:0,y:0}),_=K(()=>a.value&&Array.isArray(d.value)?d.value?.length===0:le(d.value));D(d,()=>{s?.reportControlState({filled:!_.value})}),X({isProvider:!0});let v=b(o),y=ue(p),x=G(new Set),S=K(()=>Array.from(x.value).map(e=>e.value).join(`;`));function C(e){let t;if(a.value){let n=Array.isArray(d.value)?[...d.value]:[],i=n.findIndex(t=>we(t,e,r.by));i===-1?n.push(e):n.splice(i,1),t=[...n]}else t=e;d.value=t,s?.handleControlInput({value:t})}function E(e){return Array.from(x.value).find(t=>Z(e,t.value,r.by))}return De({triggerElement:p,onTriggerChange:e=>{p.value=e},valueElement:m,onValueElementChange:e=>{m.value=e},contentId:``,modelValue:d,onValueChange:C,by:r.by,open:f,multiple:a,required:l,onOpenChange:e=>{f.value=e},dir:v,triggerPointerDownPosRef:g,disabled:u,isEmptyModelValue:_,optionsSet:x,onOptionAdd:e=>{let t=E(e.value);t&&x.value.delete(t),x.value.add(e)},onOptionRemove:e=>{let t=E(e.value);t&&x.value.delete(t)}}),(e,n)=>(F(),W(z(h),null,{default:P(()=>[U(e.$slots,`default`,{modelValue:z(d),open:z(f)}),z(y)&&c.value?(F(),W(ke,{key:S.value,"aria-hidden":`true`,tabindex:`-1`,multiple:z(a),required:l.value,name:c.value,autocomplete:t.autocomplete,disabled:u.value,value:z(d)},{default:P(()=>[z(le)(z(d))?(F(),w(`option`,{key:0,value:t.nullableValue},null,8,Ee)):N(`v-if`,!0),(F(!0),w(ie,null,T(Array.from(x.value),e=>(F(),w(`option`,H({key:e.value??``},{ref_for:!0},e),null,16))),128))]),_:1},8,[`multiple`,`required`,`name`,`autocomplete`,`disabled`,`value`])):N(`v-if`,!0)]),_:3}))}}),ke=j({__name:`BubbleSelect`,props:{autocomplete:{type:String,required:!1},autofocus:{type:Boolean,required:!1},disabled:{type:Boolean,required:!1},form:{type:String,required:!1},multiple:{type:Boolean,required:!1},name:{type:String,required:!1},required:{type:Boolean,required:!1},size:{type:Number,required:!1},value:{type:null,required:!1}},setup(e){let t=e,n=G(),r=Q();D(()=>t.value,(e,t)=>{let r=window.HTMLSelectElement.prototype,i=Object.getOwnPropertyDescriptor(r,`value`).set;if(e!==t&&i&&n.value){let t=new Event(`change`,{bubbles:!0});i.call(n.value,e),n.value.dispatchEvent(t)}});function i(e){r.onValueChange(e.target.value)}return(e,r)=>(F(),W(z(fe),{"as-child":``},{default:P(()=>[I(`select`,H({ref_key:`selectElement`,ref:n},t,{onInput:i}),[U(e.$slots,`default`)],16)]),_:3}))}}),Ae=j({__name:`SelectPopperPosition`,props:{memoDependencies:{type:Array,required:!1},side:{type:null,required:!1},sideOffset:{type:Number,required:!1},sideFlip:{type:Boolean,required:!1},align:{type:null,required:!1,default:`start`},alignOffset:{type:Number,required:!1},alignFlip:{type:Boolean,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1,default:10},arrowPadding:{type:Number,required:!1},Line truncated
+1
View File
@@ -0,0 +1 @@
import{C as e,M as t,_t as n,b as r,er as i,jn as a,r as o,wt as s}from"./PageHeader.js";var c=t({__name:`Skeleton`,props:{class:{type:[Boolean,null,String,Object,Array]}},setup(t){let r=t;return(t,s)=>(n(),e(`div`,{"data-slot":`skeleton`,class:i(a(o)(`bg-muted rounded-md animate-pulse`,r.class))},null,2))}}),l=t({__name:`Table`,props:{class:{type:[Boolean,null,String,Object,Array]},containerClass:{type:[Boolean,null,String,Object,Array]}},setup(t){let c=t;return(t,l)=>(n(),e(`div`,{"data-slot":`table-container`,class:i(a(o)(`relative w-full overflow-x-auto`,c.containerClass))},[r(`table`,{"data-slot":`table`,class:i(a(o)(`w-full caption-bottom text-sm`,c.class))},[s(t.$slots,`default`)],2)],2))}}),u=t({__name:`TableBody`,props:{class:{type:[Boolean,null,String,Object,Array]}},setup(t){let r=t;return(t,c)=>(n(),e(`tbody`,{"data-slot":`table-body`,class:i(a(o)(`[&_tr:last-child]:border-0`,r.class))},[s(t.$slots,`default`)],2))}}),d=t({__name:`TableCell`,props:{class:{type:[Boolean,null,String,Object,Array]}},setup(t){let r=t;return(t,c)=>(n(),e(`td`,{"data-slot":`table-cell`,class:i(a(o)(`p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0`,r.class))},[s(t.$slots,`default`)],2))}}),f=t({__name:`TableRow`,props:{class:{type:[Boolean,null,String,Object,Array]}},setup(t){let r=t;return(t,c)=>(n(),e(`tr`,{"data-slot":`table-row`,class:i(a(o)(`hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors has-aria-expanded:bg-muted/50`,r.class))},[s(t.$slots,`default`)],2))}}),p=t({__name:`TableHead`,props:{class:{type:[Boolean,null,String,Object,Array]}},setup(t){let r=t;return(t,c)=>(n(),e(`th`,{"data-slot":`table-head`,class:i(a(o)(`text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0`,r.class))},[s(t.$slots,`default`)],2))}}),m=t({__name:`TableHeader`,props:{class:{type:[Boolean,null,String,Object,Array]}},setup(t){let r=t;return(t,c)=>(n(),e(`thead`,{"data-slot":`table-header`,class:i(a(o)(`[&_tr]:border-b`,r.class))},[s(t.$slots,`default`)],2))}});export{u as a,d as i,p as n,l as o,f as r,c as s,m as t};
+1
View File
@@ -0,0 +1 @@
import{C as e,M as t,Qt as n,_t as r,er as i,jn as a,pn as o,r as s}from"./PageHeader.js";import{nt as c}from"./createLucideIcon.js";import{p as l}from"./input.js";var u=t({__name:`Textarea`,props:{class:{type:[Boolean,null,String,Object,Array]},defaultValue:{},modelValue:{}},emits:[`update:modelValue`],setup(t,{emit:u}){let d=t,f=l(d,`modelValue`,u,{passive:!0,defaultValue:d.defaultValue});return(t,l)=>n((r(),e(`textarea`,{"onUpdate:modelValue":l[0]||=e=>o(f)?f.value=e:null,"data-slot":`textarea`,class:i(a(s)(`border-input dark:bg-input/30 focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 disabled:bg-input/50 dark:disabled:bg-input/80 rounded-lg border bg-card px-2.5 py-2 text-sm transition-colors pointer-coarse:text-base focus-visible:ring-3 aria-invalid:ring-3 flex field-sizing-content min-h-16 w-full outline-none placeholder:text-fg-muted disabled:cursor-not-allowed disabled:opacity-50`,d.class))},null,2)),[[c,a(f)]])}});export{u as t};
+13
View File
@@ -36,7 +36,20 @@
<link rel="modulepreload" crossorigin href="/assets/PageHeader.js">
<link rel="modulepreload" crossorigin href="/assets/createLucideIcon.js">
<link rel="modulepreload" crossorigin href="/assets/badge.js">
<link rel="modulepreload" crossorigin href="/assets/pinia.js">
<link rel="modulepreload" crossorigin href="/assets/duration.js">
<link rel="modulepreload" crossorigin href="/assets/Collection.js">
<link rel="modulepreload" crossorigin href="/assets/input.js">
<link rel="modulepreload" crossorigin href="/assets/check.js">
<link rel="modulepreload" crossorigin href="/assets/textarea.js">
<link rel="modulepreload" crossorigin href="/assets/table.js">
<link rel="modulepreload" crossorigin href="/assets/schedule.js">
<link rel="modulepreload" crossorigin href="/assets/nullish.js">
<link rel="modulepreload" crossorigin href="/assets/VisuallyHidden.js">
<link rel="modulepreload" crossorigin href="/assets/alert.js">
<link rel="modulepreload" crossorigin href="/assets/HistoryLink.js">
<link rel="modulepreload" crossorigin href="/assets/chevron-up.js">
<link rel="modulepreload" crossorigin href="/assets/select.js">
<link rel="stylesheet" crossorigin href="/assets/index.css">
</head>
<body>
+9 -5
View File
@@ -1,23 +1,27 @@
<script setup lang="ts">
import { computed } from "vue";
import { ago } from "@/lib/format";
import { ago, exactTime } from "@/lib/format";
import { useAppearanceStore } from "@/stores/appearance";
/**
* A point in time, shown relative ("5 mins ago") with the exact local date and
* time on hover. `absolute` shows the exact time instead, for logs.
* A point in time, shown relative ("5 mins ago") with the exact date and time
* on hover, in the zone chosen under Appearance. `absolute` shows the exact
* time instead, for logs.
*/
const props = defineProps<{ at: string | number | Date | null | undefined; absolute?: boolean }>();
const appearance = useAppearanceStore();
const date = computed(() => {
if (!props.at) return undefined;
const value = props.at instanceof Date ? props.at : new Date(props.at);
return Number.isNaN(value.getTime()) || value.getFullYear() <= 1 ? undefined : value;
});
const exact = computed(() => (date.value ? exactTime(date.value, appearance.timeZone) : ""));
</script>
<template>
<time v-if="date" :datetime="date.toISOString()" :title="date.toLocaleString()" class="tabular-nums">{{
absolute ? date.toLocaleString() : ago(date)
<time v-if="date" :datetime="date.toISOString()" :title="exact" class="tabular-nums">{{
absolute ? exact : ago(date)
}}</time>
<span v-else aria-label="Unknown">–</span>
</template>
@@ -0,0 +1,47 @@
<script setup lang="ts">
import { computed, ref } from "vue";
import { ChevronsUpDown } from "@lucide/vue";
import { Button } from "@/components/ui/button";
import { Command, CommandEmpty, CommandInput, CommandItem, CommandList } from "@/components/ui/command";
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
/**
* A searchable IANA time zone picker. With `emptyLabel`, the empty value is
* offered first under that label.
*/
const props = defineProps<{ id?: string; emptyLabel?: string; ariaLabel?: string }>();
const model = defineModel<string>({ required: true });
const open = ref(false);
const zones = computed(() => {
const listed = Intl.supportedValuesOf("timeZone");
return listed.includes("UTC") ? listed : ["UTC", ...listed];
});
const label = computed(() => model.value || props.emptyLabel || "UTC");
function choose(value: string): void {
model.value = value;
open.value = false;
}
</script>
<template>
<Popover v-model:open="open">
<PopoverTrigger as-child>
<Button :id="id" type="button" variant="outline" class="w-64 justify-between font-normal" :aria-label="ariaLabel" role="combobox" :aria-expanded="open">
<span class="truncate">{{ label }}</span><ChevronsUpDown data-icon="inline-end" />
</Button>
</PopoverTrigger>
<PopoverContent align="start" class="w-64 p-0">
<Command>
<CommandInput placeholder="Search zones" />
<CommandList>
<CommandEmpty>No zone matches.</CommandEmpty>
<CommandItem v-if="emptyLabel" value="" @select="choose('')">{{ emptyLabel }}</CommandItem>
<CommandItem v-for="zone in zones" :key="zone" :value="zone" @select="choose(zone)">{{ zone }}</CommandItem>
</CommandList>
</Command>
</PopoverContent>
</Popover>
</template>
@@ -0,0 +1 @@
export { default as ZoneSelect } from "./ZoneSelect.vue";
+10
View File
@@ -179,6 +179,16 @@ export const api = {
request<{ version: number }>("/api/access/policies", { method: "PUT", body: policy }),
deletePolicy: (policy: unknown) =>
request<void>("/api/access/policies", { method: "DELETE", body: policy, parse: false }),
schedules: <T = unknown>() => request<T>("/api/schedules"),
// scheduleSave creates or replaces the schedule with this id.
scheduleSave: <T = unknown>(id: string, schedule: unknown) =>
request<T>(`/api/schedules/${encodeURIComponent(id)}`, { method: "PUT", body: schedule }),
scheduleDelete: (id: string) =>
request<void>(`/api/schedules/${encodeURIComponent(id)}`, { method: "DELETE", parse: false }),
scheduleRunNow: <T = unknown>(id: string) =>
request<T>(`/api/schedules/${encodeURIComponent(id)}/runs`, { method: "POST", body: {} }),
scheduleRuns: <T = unknown>(id: string) =>
request<T>(`/api/schedules/${encodeURIComponent(id)}/runs`),
orgs: <T = unknown>() => request<T>("/api/orgs"),
// orgCreate makes an org with its default workspace and first owner; only
// an instance admin may.
+5
View File
@@ -33,3 +33,8 @@ export function compact(n: number | null | undefined): string {
maximumFractionDigits: 1,
}).format(n);
}
/** An exact date and time in zone, or in the browser's zone when zone is empty. */
export function exactTime(value: Date, zone: string): string {
return value.toLocaleString(undefined, zone ? { timeZone: zone, timeZoneName: "short" } : undefined);
}
+1 -1
View File
@@ -41,7 +41,7 @@ const orgSpecs: NavSpec[] = [
},
{
label: "Automation",
paths: ["/org/playbooks"],
paths: ["/org/schedules", "/org/playbooks"],
},
],
},
+1 -1
View File
@@ -16,7 +16,7 @@ const areas = [
{ title: "Execution identities", to: "/org/agents" },
{ title: "Connections", to: "/org/connections" },
{ title: "Models", to: "/org/models" },
{ title: "Playbooks", to: "/org/playbooks" },
{ title: "Schedules and playbooks", to: "/org/schedules" },
{ title: "Members and access", to: "/org/members" },
];
</script>
+13
View File
@@ -251,6 +251,18 @@ const routes = [
component: InstructionsPage,
meta: { label: "Instructions", navPath: "/org" },
},
{
path: "schedules",
name: "org-schedules",
component: () => import("@/schedules/SchedulesPage.vue"),
meta: { label: "Schedules", navPath: "/org" },
},
{
path: "schedules/:id/runs",
name: "org-schedule-runs",
component: () => import("@/schedules/ScheduleRunsPage.vue"),
meta: { label: "Schedule runs", navPath: "/org/schedules", nav: false },
},
{
path: "playbooks",
name: "org-playbooks",
@@ -276,6 +288,7 @@ const routes = [
"/settings/credential-bindings": "/org/credential-bindings",
"/settings/soul": "/org/instructions",
"/org/soul": "/org/instructions",
"/settings/schedules": "/org/schedules",
"/settings/playbooks": "/org/playbooks",
}).map(([path, redirect]) => ({ path, redirect, meta: { nav: false } })),
{
+109
View File
@@ -0,0 +1,109 @@
<script setup lang="ts">
import { computed, ref, watch } from "vue";
import { Button } from "@/components/ui/button";
import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
import { DurationInput } from "@/components/ui/duration-input";
import { Input } from "@/components/ui/input";
import { SettingRow } from "@/components/ui/setting-row";
import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group";
import { api } from "@/lib/api";
import { useAppearanceStore } from "@/stores/appearance";
import { cronWords, fromWallTime, toWallTime, type Schedule, type ScheduleTiming } from "./schedule";
/**
* Creates or edits one schedule. A built-in schedule keeps its name; only its
* timing changes here.
*/
const props = defineProps<{ schedule: Schedule | null; title: string }>();
const open = defineModel<boolean>("open", { required: true });
const emit = defineEmits<{ saved: [Schedule] }>();
const appearance = useAppearanceStore();
const name = ref("");
const timing = ref<ScheduleTiming>({ kind: "interval", interval: "24h0m0s" });
const saving = ref(false);
const error = ref("");
watch(
() => [open.value, props.schedule] as const,
([isOpen, schedule]) => {
if (!isOpen || !schedule) return;
name.value = schedule.name;
timing.value = { ...schedule.timing };
error.value = "";
},
{ immediate: true },
);
const kinds = [
{ value: "interval", label: "Every" },
{ value: "cron", label: "Cron" },
{ value: "once", label: "Once" },
] as const;
function chooseKind(value: unknown): void {
if (value === "interval") timing.value = { kind: "interval", interval: "24h0m0s" };
else if (value === "cron") timing.value = { kind: "cron", cron: "0 9 * * 1-5" };
else if (value === "once") timing.value = { kind: "once" };
}
const wallTime = computed({
get: () => toWallTime(timing.value.at, appearance.timeZone),
set: (value: string) => (timing.value.at = fromWallTime(value, appearance.timeZone)),
});
const cronPreview = computed(() => {
const words = cronWords(timing.value.cron);
return words === timing.value.cron ? "" : words;
});
async function save(): Promise<void> {
if (!props.schedule) return;
saving.value = true;
error.value = "";
try {
const saved = await api.scheduleSave<Schedule>(props.schedule.id, {
...props.schedule,
name: name.value.trim(),
timing: timing.value,
});
emit("saved", saved);
open.value = false;
} catch (err) {
error.value = err instanceof Error ? err.message : String(err);
} finally {
saving.value = false;
}
}
</script>
<template>
<Dialog v-model:open="open">
<DialogContent class="sm:max-w-xl">
<DialogHeader><DialogTitle>{{ title }}</DialogTitle></DialogHeader>
<form v-if="schedule" class="space-y-1" @submit.prevent="save">
<SettingRow label="Name" for="schedule-name">
<Input id="schedule-name" v-model="name" :disabled="schedule.built_in" required />
</SettingRow>
<SettingRow label="When">
<div class="flex flex-col gap-3">
<ToggleGroup type="single" variant="outline" size="sm" :model-value="timing.kind" aria-label="When" @update:model-value="chooseKind">
<ToggleGroupItem v-for="option in kinds" :key="option.value" :value="option.value">{{ option.label }}</ToggleGroupItem>
</ToggleGroup>
<DurationInput v-if="timing.kind === 'interval'" v-model="timing.interval!" :units="['m', 'h']" />
<div v-else-if="timing.kind === 'cron'" class="space-y-1">
<Input v-model="timing.cron" class="w-48 font-mono" placeholder="0 9 * * 1-5" aria-label="Cron expression" />
<p v-if="cronPreview" class="text-caption text-fg-muted">{{ cronPreview }}</p>
</div>
<Input v-else v-model="wallTime" type="datetime-local" class="w-60 font-mono" aria-label="Run at" required />
</div>
</SettingRow>
<p v-if="error" class="text-sm text-danger" role="alert">{{ error }}</p>
<DialogFooter>
<Button type="button" variant="ghost" @click="open = false">Cancel</Button>
<Button type="submit" :disabled="saving || !name.trim()">Save</Button>
</DialogFooter>
</form>
</DialogContent>
</Dialog>
</template>
+96
View File
@@ -0,0 +1,96 @@
<script setup lang="ts">
import { computed, onUnmounted, ref, watch } from "vue";
import { useRoute } from "vue-router";
import { ArrowLeft, Play } from "@lucide/vue";
import PageHeader from "@/base/PageHeader.vue";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import { DataTable, type DataTableColumn } from "@/components/ui/data-table";
import { Section } from "@/components/ui/section";
import { Skeleton } from "@/components/ui/skeleton";
import { Timestamp } from "@/components/ui/timestamp";
import { api } from "@/lib/api";
import { RESULT_TONE, runDuration, type Schedule, type ScheduleRun } from "./schedule";
const route = useRoute();
const id = computed(() => String(route.params.id ?? ""));
const schedule = ref<Schedule | null>(null);
const runs = ref<ScheduleRun[] | null>(null);
const error = ref("");
async function load(): Promise<void> {
const target = id.value;
try {
const [listed, history] = await Promise.all([
api.schedules<{ schedules?: Schedule[] }>(),
api.scheduleRuns<{ runs?: ScheduleRun[] }>(target),
]);
if (target !== id.value) return;
schedule.value = listed.schedules?.find((s) => s.id === target) ?? null;
runs.value = history.runs ?? [];
error.value = "";
} catch (err) {
if (target === id.value) error.value = err instanceof Error ? err.message : String(err);
}
}
watch(id, () => {
runs.value = null;
void load();
}, { immediate: true });
const timer = setInterval(() => void load(), 15_000);
onUnmounted(() => clearInterval(timer));
async function runNow(): Promise<void> {
error.value = "";
try {
await api.scheduleRunNow(id.value);
await load();
} catch (err) {
error.value = err instanceof Error ? err.message : String(err);
}
}
const columns: DataTableColumn<ScheduleRun>[] = [
{ id: "scheduled", label: "Scheduled", fixed: true, sort: (r) => r.scheduled_for },
{ id: "started", label: "Started" },
{ id: "duration", label: "Duration" },
{ id: "result", label: "Result", sort: (r) => r.result },
{ id: "error", label: "Error" },
{ id: "tasks", label: "Tasks" },
];
</script>
<template>
<div>
<PageHeader :title="schedule?.name || 'Schedule runs'">
<Button variant="ghost" size="sm" as-child><RouterLink to="/org/schedules"><ArrowLeft data-icon="inline-start" />Schedules</RouterLink></Button>
<Button size="sm" :disabled="!schedule" @click="runNow"><Play data-icon="inline-start" />Run now</Button>
</PageHeader>
<p v-if="error" class="mb-4 text-sm text-danger" role="alert">{{ error }}</p>
<Section>
<div v-if="!runs && !error" class="space-y-2"><Skeleton class="h-8 w-full" /><Skeleton class="h-8 w-full" /></div>
<DataTable
v-else-if="runs"
:columns="columns"
:rows="runs"
:row-key="(r) => String(r.id)"
storage-key="schedule-runs"
:initial-sort="{ id: 'scheduled', desc: true }"
>
<template #empty><p class="py-4 text-center text-sm text-fg-subtle">No runs yet.</p></template>
<template #cell-scheduled="{ row }"><Timestamp :at="row.scheduled_for" absolute /></template>
<template #cell-started="{ row }"><Timestamp :at="row.started" absolute /></template>
<template #cell-duration="{ row }"><span class="tabular-nums text-fg-muted">{{ runDuration(row) || "–" }}</span></template>
<template #cell-result="{ row }"><Badge :variant="RESULT_TONE[row.result] ?? 'idle'">{{ row.result }}</Badge></template>
<template #cell-error="{ row }"><span class="block max-w-md break-words whitespace-normal text-danger">{{ row.error }}</span></template>
<template #cell-tasks="{ row }">
<span class="flex flex-wrap gap-2">
<RouterLink v-for="task in row.task_ids ?? []" :key="task" :to="`/tasks/${task}`" class="font-mono hover:underline">#{{ task }}</RouterLink>
</span>
</template>
</DataTable>
</Section>
</div>
</template>
+251
View File
@@ -0,0 +1,251 @@
<script setup lang="ts">
import { computed, onMounted, onUnmounted, ref } from "vue";
import { storeToRefs } from "pinia";
import { CalendarClock, Plus } from "@lucide/vue";
import PageHeader from "@/base/PageHeader.vue";
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
} from "@/components/ui/alert-dialog";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import { DataTable, type DataTableColumn } from "@/components/ui/data-table";
import { DropdownMenuItem, DropdownMenuSeparator } from "@/components/ui/dropdown-menu";
import { DurationInput } from "@/components/ui/duration-input";
import { Empty, EmptyContent, EmptyHeader, EmptyMedia, EmptyTitle } from "@/components/ui/empty";
import { MoreMenu } from "@/components/ui/more-menu";
import {
NumberField,
NumberFieldContent,
NumberFieldDecrement,
NumberFieldIncrement,
NumberFieldInput,
} from "@/components/ui/number-field";
import { Section } from "@/components/ui/section";
import { SettingRow } from "@/components/ui/setting-row";
import { Skeleton } from "@/components/ui/skeleton";
import { Switch } from "@/components/ui/switch";
import { Timestamp } from "@/components/ui/timestamp";
import { ZoneSelect } from "@/components/ui/zone-select";
import { api } from "@/lib/api";
import { exactTime } from "@/lib/format";
import { useAppearanceStore } from "@/stores/appearance";
import { resourcesForPage, useSettingsStore } from "@/stores/settings";
import ApplyStatusRows from "@/settings/ApplyStatusRows.vue";
import DraftHint from "@/settings/DraftHint.vue";
import HistoryLink from "@/settings/HistoryLink.vue";
import ScheduleEditor from "./ScheduleEditor.vue";
import { runDuration, timingWords, type Schedule, type ScheduleSettings } from "./schedule";
const SETTINGS = "schedule-settings";
const schedules = ref<Schedule[] | null>(null);
const loadError = ref("");
const actionError = ref("");
let timer: ReturnType<typeof setInterval> | undefined;
async function load(): Promise<void> {
try {
const response = await api.schedules<{ schedules?: Schedule[] }>();
schedules.value = response.schedules ?? [];
loadError.value = "";
} catch (err) {
loadError.value = err instanceof Error ? err.message : String(err);
}
}
onMounted(() => {
void load();
timer = setInterval(() => void load(), 30_000);
});
onUnmounted(() => clearInterval(timer));
const store = useSettingsStore();
const { catalog } = storeToRefs(store);
onMounted(store.load);
const resources = computed(() => resourcesForPage(catalog.value, "schedules"));
const settings = computed(() => store.drafts[SETTINGS]?.value as ScheduleSettings | undefined);
const settingsError = computed(() => store.pageErrorFor(SETTINGS));
const zone = computed(() => settings.value?.time_zone || "UTC");
const appearance = useAppearanceStore();
const instant = (at: string) => exactTime(new Date(at), appearance.timeZone);
const when = (schedule: Schedule) => timingWords(schedule.timing, zone.value, instant);
const owner = (schedule: Schedule) => schedule.owner.name || schedule.owner.id || schedule.owner.kind;
const columns: DataTableColumn<Schedule>[] = [
{ id: "enabled", label: "Enabled", fixed: true, class: "w-0" },
{ id: "name", label: "Name", fixed: true, sort: (s) => s.name.toLowerCase() },
{ id: "owner", label: "Owner", sort: owner },
{ id: "interval", label: "Interval" },
{ id: "last", label: "Last Run", sort: (s) => s.last_run?.scheduled_for ?? "" },
{ id: "duration", label: "Last Duration" },
{ id: "next", label: "Next Run", sort: (s) => s.next_run ?? "" },
];
function replace(saved: Schedule): void {
if (!schedules.value) return;
const index = schedules.value.findIndex((s) => s.id === saved.id);
if (index < 0) schedules.value.push(saved);
else schedules.value[index] = saved;
}
async function act(action: () => Promise<void>): Promise<void> {
actionError.value = "";
try {
await action();
} catch (err) {
actionError.value = err instanceof Error ? err.message : String(err);
}
}
const setEnabled = (schedule: Schedule, enabled: boolean) =>
act(async () => replace(await api.scheduleSave<Schedule>(schedule.id, { ...schedule, enabled })));
const runNow = (schedule: Schedule) =>
act(async () => {
await api.scheduleRunNow(schedule.id);
await load();
});
const editing = ref<Schedule | null>(null);
const editorTitle = ref("");
const editorOpen = ref(false);
function edit(schedule: Schedule, title: string): void {
editing.value = schedule;
editorTitle.value = title;
editorOpen.value = true;
}
function blank(): Schedule {
return {
id: crypto.randomUUID(),
name: "",
owner: { kind: "instance" },
enabled: true,
built_in: false,
timing: { kind: "interval", interval: "24h0m0s" },
};
}
const create = () => edit(blank(), "New schedule");
const duplicate = (schedule: Schedule) =>
edit({ ...blank(), name: `${schedule.name} copy`, timing: { ...schedule.timing }, enabled: false }, "Duplicate schedule");
const removing = ref<Schedule | null>(null);
const remove = () =>
act(async () => {
const target = removing.value;
removing.value = null;
if (!target) return;
await api.scheduleDelete(target.id);
schedules.value = schedules.value?.filter((s) => s.id !== target.id) ?? null;
});
</script>
<template>
<div>
<PageHeader title="Schedules">
<HistoryLink :kinds="resources.map((r) => r.kind)" />
<Button size="sm" :disabled="!schedules" @click="create"><Plus data-icon="inline-start" />Add schedule</Button>
</PageHeader>
<ApplyStatusRows v-for="resource in resources" :key="resource.kind" :kind="resource.kind" class="mb-4" />
<p v-if="actionError" class="mb-4 text-sm text-danger" role="alert">{{ actionError }}</p>
<Section>
<p v-if="loadError" class="text-sm text-danger" role="alert">{{ loadError }}</p>
<div v-else-if="!schedules" class="space-y-2"><Skeleton class="h-8 w-full" /><Skeleton class="h-8 w-full" /></div>
<DataTable
v-else
:columns="columns"
:rows="schedules"
:row-key="(s) => s.id"
storage-key="schedules"
:initial-sort="{ id: 'name', desc: false }"
>
<template #empty>
<Empty>
<EmptyMedia variant="icon"><CalendarClock /></EmptyMedia>
<EmptyHeader><EmptyTitle>No schedules yet</EmptyTitle></EmptyHeader>
<EmptyContent><Button size="sm" @click="create"><Plus data-icon="inline-start" />Add schedule</Button></EmptyContent>
</Empty>
</template>
<template #cell-enabled="{ row }">
<Switch :model-value="row.enabled" :aria-label="`${row.name} enabled`" @update:model-value="setEnabled(row, $event)" />
</template>
<template #cell-name="{ row }">
<span class="flex items-center gap-2">
<span class="truncate">{{ row.name }}</span>
<Badge v-if="row.built_in" variant="outline">Built-in</Badge>
</span>
</template>
<template #cell-owner="{ row }"><span class="text-fg-muted">{{ owner(row) }}</span></template>
<template #cell-interval="{ row }">
<span :title="row.timing.kind === 'cron' ? row.timing.cron : undefined">{{ when(row) }}</span>
</template>
<template #cell-last="{ row }">
<RouterLink v-if="row.last_run" :to="`/org/schedules/${encodeURIComponent(row.id)}/runs`" class="inline-flex items-center gap-2 hover:underline">
<Timestamp :at="row.last_run.started || row.last_run.scheduled_for" />
<Badge v-if="row.last_run.result === 'failed'" variant="danger" :title="row.last_run.error">failed</Badge>
<Badge v-else-if="row.last_run.result === 'running'" variant="idle">running</Badge>
</RouterLink>
<span v-else class="text-fg-subtle">–</span>
</template>
<template #cell-duration="{ row }"><span class="tabular-nums text-fg-muted">{{ runDuration(row.last_run) || "–" }}</span></template>
<template #cell-next="{ row }">
<Timestamp v-if="row.enabled && row.next_run" :at="row.next_run" absolute />
<span v-else class="text-fg-subtle">–</span>
</template>
<template #actions="{ row }">
<MoreMenu :label="`${row.name} actions`">
<DropdownMenuItem @select="runNow(row)">Run now</DropdownMenuItem>
<DropdownMenuItem @select="edit(row, row.built_in ? 'Retime schedule' : 'Edit schedule')">{{ row.built_in ? "Retime" : "Edit" }}</DropdownMenuItem>
<DropdownMenuItem v-if="!row.built_in" @select="duplicate(row)">Duplicate</DropdownMenuItem>
<DropdownMenuItem as-child><RouterLink :to="`/org/schedules/${encodeURIComponent(row.id)}/runs`">View runs</RouterLink></DropdownMenuItem>
<template v-if="!row.built_in">
<DropdownMenuSeparator />
<DropdownMenuItem variant="destructive" @select="removing = row">Delete</DropdownMenuItem>
</template>
</MoreMenu>
</template>
</DataTable>
</Section>
<Section v-if="settings" title="Settings" class="mt-6">
<p v-if="settingsError" class="text-sm text-danger" role="alert">{{ settingsError }}</p>
<SettingRow label="Cron time zone" for="schedule-zone">
<ZoneSelect id="schedule-zone" v-model="settings.time_zone" aria-label="Cron time zone" />
<DraftHint :kind="SETTINGS" path="time_zone" />
</SettingRow>
<SettingRow label="Keep runs for">
<DurationInput v-model="settings.run_retention" :units="['h']" />
<DraftHint :kind="SETTINGS" path="run_retention" />
</SettingRow>
<SettingRow label="Runs kept per schedule" for="schedule-keep">
<NumberField id="schedule-keep" v-model="settings.run_retention_count" :min="1" class="w-32">
<NumberFieldContent><NumberFieldDecrement /><NumberFieldInput /><NumberFieldIncrement /></NumberFieldContent>
</NumberField>
<DraftHint :kind="SETTINGS" path="run_retention_count" />
</SettingRow>
</Section>
<ScheduleEditor v-model:open="editorOpen" :schedule="editing" :title="editorTitle" @saved="replace" />
<AlertDialog :open="removing !== null" @update:open="(value) => { if (!value) removing = null; }">
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Delete {{ removing?.name }}?</AlertDialogTitle>
<AlertDialogDescription>Its run history goes with it. Workflow triggers on it stop firing.</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Cancel</AlertDialogCancel>
<AlertDialogAction @click="remove">Delete</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
</div>
</template>
+171
View File
@@ -0,0 +1,171 @@
/**
* The schedules vocabulary: the wire shapes /api/schedules serves and the
* words a schedule's timing reads as. Pure, no fetches.
*/
import { parseGoDuration } from "@/components/ui/duration-input";
/** What a schedule belongs to; name is resolved by the server. */
export interface ScheduleOwner {
kind: "instance" | "org";
id?: string;
name?: string;
}
export interface ScheduleTiming {
kind: "interval" | "cron" | "once";
/** A Go duration string, for interval. */
interval?: string;
cron?: string;
/** RFC 3339 UTC instant, for once. */
at?: string;
}
export type RunResult = "pending" | "running" | "succeeded" | "failed" | "skipped";
export interface ScheduleRun {
id: number;
schedule_id: string;
scheduled_for: string;
started?: string;
finished?: string;
result: RunResult;
error?: string;
/** Tasks the run's firing started through schedule triggers. */
task_ids?: number[];
}
export interface Schedule {
id: string;
name: string;
owner: ScheduleOwner;
enabled: boolean;
built_in: boolean;
timing: ScheduleTiming;
next_run?: string;
last_run?: ScheduleRun | null;
}
/** The instance's schedule-settings document. */
export interface ScheduleSettings {
time_zone: string;
run_retention: string;
run_retention_count: number;
}
const DAYS = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
function plural(n: number, unit: string): string {
return `${n} ${unit}${n === 1 ? "" : "s"}`;
}
/** "Every 6 hours", from a Go duration string. */
export function intervalWords(interval: string | undefined): string {
const ms = parseGoDuration(interval ?? "");
if (!ms) return "Every interval";
const minutes = Math.round(ms / 60_000);
if (minutes % 10080 === 0) return minutes === 10080 ? "Every week" : `Every ${plural(minutes / 10080, "week")}`;
if (minutes % 1440 === 0) return minutes === 1440 ? "Every day" : `Every ${plural(minutes / 1440, "day")}`;
if (minutes % 60 === 0) return minutes === 60 ? "Every hour" : `Every ${plural(minutes / 60, "hour")}`;
return minutes === 1 ? "Every minute" : `Every ${plural(minutes, "minute")}`;
}
const NUMBER = /^\d+$/;
function dayWords(field: string): string | null {
if (field === "*") return "Every day";
if (field === "1-5") return "Weekdays";
if (field === "0,6" || field === "6,0") return "Weekends";
const days = field.split(",");
if (!days.every((d) => NUMBER.test(d) && Number(d) <= 7)) return null;
return days.map((d) => DAYS[Number(d) % 7]).join(", ");
}
/**
* A cron expression in words for the common shapes: a fixed time on some
* days, every N minutes, or hourly. Anything else reads as the expression.
*/
export function cronWords(expression: string | undefined): string {
const fields = (expression ?? "").trim().split(/\s+/);
if (fields.length !== 5) return expression ?? "";
const [minute, hour, dom, month, dow] = fields as [string, string, string, string, string];
if (month !== "*") return expression!;
const step = /^\*\/(\d+)$/.exec(minute);
if (step && hour === "*" && dom === "*" && dow === "*") return `Every ${plural(Number(step[1]), "minute")}`;
if (NUMBER.test(minute) && hour === "*" && dom === "*" && dow === "*") return `Hourly at :${minute.padStart(2, "0")}`;
if (!NUMBER.test(minute) || !NUMBER.test(hour)) return expression!;
const at = `${hour.padStart(2, "0")}:${minute.padStart(2, "0")}`;
if (dom !== "*") {
if (dow !== "*" || !NUMBER.test(dom)) return expression!;
return `Monthly on day ${dom} at ${at}`;
}
const days = dayWords(dow);
return days ? `${days} at ${at}` : expression!;
}
/** The schedule's timing in words, with the zone a cron is read in. */
export function timingWords(timing: ScheduleTiming, zone: string, format: (at: string) => string): string {
switch (timing.kind) {
case "interval":
return intervalWords(timing.interval);
case "cron":
return `${cronWords(timing.cron)} (${zone})`;
case "once":
return timing.at ? `Once, ${format(timing.at)}` : "Once";
}
}
/** A run's duration as "1m 4s", or "" while it has not finished. */
export function runDuration(run: ScheduleRun | null | undefined): string {
if (!run?.started || !run.finished) return "";
const ms = Date.parse(run.finished) - Date.parse(run.started);
if (!Number.isFinite(ms) || ms < 0) return "";
if (ms < 1000) return `${ms}ms`;
const secs = Math.round(ms / 1000);
if (secs < 60) return `${secs}s`;
const mins = Math.floor(secs / 60);
if (mins < 60) return `${mins}m ${secs % 60}s`;
return `${Math.floor(mins / 60)}h ${mins % 60}m`;
}
// The zone's offset from UTC at instant, in ms. Empty zone is the browser's.
function zoneOffset(instant: number, zone: string): number {
const parts = new Intl.DateTimeFormat("en-US", {
timeZone: zone || undefined,
hourCycle: "h23",
year: "numeric",
month: "2-digit",
day: "2-digit",
hour: "2-digit",
minute: "2-digit",
second: "2-digit",
}).formatToParts(new Date(instant));
const get = (type: string) => Number(parts.find((p) => p.type === type)?.value);
const wall = Date.UTC(get("year"), get("month") - 1, get("day"), get("hour"), get("minute"), get("second"));
return wall - Math.floor(instant / 1000) * 1000;
}
/** A datetime-local value ("2026-10-26T09:00") for an instant, in zone. */
export function toWallTime(iso: string | undefined, zone: string): string {
if (!iso) return "";
const instant = Date.parse(iso);
if (!Number.isFinite(instant)) return "";
return new Date(instant + zoneOffset(instant, zone)).toISOString().slice(0, 16);
}
/** The UTC instant a datetime-local value names in zone. */
export function fromWallTime(wall: string, zone: string): string | undefined {
if (!wall) return undefined;
const guess = Date.parse(`${wall}:00Z`);
if (!Number.isFinite(guess)) return undefined;
const first = guess - zoneOffset(guess, zone);
return new Date(guess - zoneOffset(first, zone)).toISOString();
}
export const RESULT_TONE: Record<RunResult, "ok" | "warn" | "danger" | "idle"> = {
pending: "idle",
running: "idle",
succeeded: "ok",
failed: "danger",
skipped: "warn",
};
+6 -2
View File
@@ -14,10 +14,11 @@ import {
useAppearanceStore,
} from "@/stores/appearance";
import { Section } from "@/components/ui/section";
import { ZoneSelect } from "@/components/ui/zone-select";
const appearance = useAppearanceStore();
const { density, motion, overscroll, printWidth, theme, tooltipsEnabled } = storeToRefs(appearance);
const { setDensity, setMotion, setOverscroll, setPrintWidth, setTheme, setTooltips } = appearance;
const { density, motion, overscroll, printWidth, theme, timeZone, tooltipsEnabled } = storeToRefs(appearance);
const { setDensity, setMotion, setOverscroll, setPrintWidth, setTheme, setTimeZone, setTooltips } = appearance;
/**
* Appearance: how the dashboard looks, on this browser. These preferences are
@@ -66,6 +67,9 @@ function chooseMotion(value: unknown): void {
<ToggleGroupItem value="reduced">Reduced</ToggleGroupItem>
</ToggleGroup>
</SettingRow>
<SettingRow label="Time zone" for="appearance-zone">
<ZoneSelect id="appearance-zone" :model-value="timeZone" empty-label="Browser" aria-label="Time zone" @update:model-value="setTimeZone" />
</SettingRow>
<SettingRow label="Tooltips">
<Switch :model-value="tooltipsEnabled" aria-label="Tooltips" @update:model-value="setTooltips" />
</SettingRow>
+20
View File
@@ -7,6 +7,7 @@ export const MOTION_KEY = "archie.motion";
export const TOOLTIPS_KEY = "archie.tooltips";
export const OVERSCROLL_KEY = "archie.overscroll";
export const PRINT_WIDTH_KEY = "archie.printWidth";
export const TIME_ZONE_KEY = "archie.timeZone";
export type Theme = "system" | "dark" | "light";
export type Density = "comfortable" | "compact";
@@ -39,6 +40,16 @@ function persist(key: string, value: string): void {
}
}
function storedZone(): string {
try {
const value = localStorage.getItem(TIME_ZONE_KEY) ?? "";
if (value) new Intl.DateTimeFormat(undefined, { timeZone: value });
return value;
} catch {
return "";
}
}
function resolveTheme(preference: Theme): ResolvedTheme {
if (preference !== "system") return preference;
try {
@@ -69,6 +80,8 @@ export const useAppearanceStore = defineStore("appearance", () => {
const printWidth = ref<PrintWidth>(
storedChoice(PRINT_WIDTH_KEY, PRINT_WIDTHS, "window"),
);
// An IANA zone times are shown in; empty follows the browser.
const timeZone = ref(storedZone());
let initialized = false;
function applyTheme(): void {
@@ -121,6 +134,11 @@ export const useAppearanceStore = defineStore("appearance", () => {
persist(PRINT_WIDTH_KEY, value);
}
function setTimeZone(value: string): void {
timeZone.value = value;
persist(TIME_ZONE_KEY, value);
}
function initialize(): void {
if (initialized) return;
initialized = true;
@@ -148,6 +166,7 @@ export const useAppearanceStore = defineStore("appearance", () => {
tooltipsEnabled,
overscroll,
printWidth,
timeZone,
initialize,
setTheme,
setDensity,
@@ -155,5 +174,6 @@ export const useAppearanceStore = defineStore("appearance", () => {
setTooltips,
setOverscroll,
setPrintWidth,
setTimeZone,
};
});
+2
View File
@@ -171,6 +171,7 @@ export type ControlPlanePage =
| "scheduling"
| "tools"
| "soul"
| "schedules"
| "plugins"
| "containers"
| "review";
@@ -184,6 +185,7 @@ const PAGE_RESOURCES: Record<ControlPlanePage, string[]> = {
scheduling: ["scheduling-policy"],
tools: ["tool-settings"],
soul: ["soul"],
schedules: ["schedule-settings"],
plugins: ["plugin-settings"],
containers: ["container-runtime-policies"],
review: ["review-settings"],
+228
View File
@@ -0,0 +1,228 @@
<script setup lang="ts">
import { computed, onMounted, ref } from "vue";
import { ArrowLeft } from "@lucide/vue";
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
} from "@/components/ui/alert-dialog";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Spinner } from "@/components/ui/spinner";
import { api } from "@/lib/api";
import { constantValue, statusKind, statusLabel, type Binding, type InputSource } from "@/bindings/binding-draft";
import ScheduleEditor from "@/schedules/ScheduleEditor.vue";
import { type Schedule } from "@/schedules/schedule";
import type { InputSpec } from "./bind-event";
import OptionSelect from "./OptionSelect.vue";
import { workflowField } from "./workflow-edit";
import { SCHEDULE_FIELDS, SCHEDULE_MAPPING, SCHEDULE_SOURCE, scheduleFilter, scheduleOfBinding } from "./workflow-triggers";
/**
* A schedule trigger: a binding on the schedule source filtered to one
* schedule, each workflow input read from the firing or given a fixed value.
*/
const props = defineProps<{ yaml: string; binding: Binding | null }>();
const emit = defineEmits<{ back: []; saved: [] }>();
const NEW = "__new__";
const FIXED = "__fixed__";
const workflow = computed(() => String(workflowField(props.yaml, "id") ?? ""));
const inputs = computed(() =>
Object.entries((workflowField(props.yaml, "inputs") as Record<string, InputSpec> | undefined) ?? {}),
);
const schedules = ref<Schedule[]>([]);
const loading = ref(true);
const loadError = ref("");
const scheduleId = ref(props.binding ? scheduleOfBinding(props.binding) : "");
const rows = ref<Record<string, { from: string; value: string }>>({});
const status = ref(props.binding?.status ?? "");
const saving = ref(false);
const error = ref("");
const confirmRemove = ref(false);
onMounted(async () => {
try {
schedules.value = (await api.schedules<{ schedules?: Schedule[] }>()).schedules ?? [];
} catch (err) {
loadError.value = err instanceof Error ? err.message : String(err);
}
for (const [name] of inputs.value) {
const src = props.binding?.inputs?.[name];
rows.value[name] = src?.param
? { from: src.param, value: "" }
: src && src.value !== undefined
? { from: FIXED, value: typeof src.value === "string" ? src.value : JSON.stringify(src.value) }
: { from: FIXED, value: "" };
}
loading.value = false;
});
const scheduleOptions = computed(() => [
{ value: "", label: "Pick a schedule", disabled: true },
...schedules.value.map((s) => ({ value: s.id, label: s.name })),
{ value: NEW, label: "New schedule…" },
]);
const fieldOptions = [
...SCHEDULE_FIELDS.map((field) => ({ value: field, label: field })),
{ value: FIXED, label: "Fixed value" },
];
// Creating a schedule here writes the same record the Schedules page lists.
const editorOpen = ref(false);
const draft = ref<Schedule | null>(null);
function pickSchedule(value: string): void {
if (value !== NEW) {
scheduleId.value = value;
return;
}
draft.value = {
id: crypto.randomUUID(),
name: workflow.value,
owner: { kind: "instance" },
enabled: true,
built_in: false,
timing: { kind: "interval", interval: "24h0m0s" },
};
editorOpen.value = true;
}
function created(schedule: Schedule): void {
schedules.value.push(schedule);
scheduleId.value = schedule.id;
}
const schedule = computed(() => schedules.value.find((s) => s.id === scheduleId.value));
const blockers = computed(() => {
if (!scheduleId.value) return ["pick a schedule"];
return inputs.value
.filter(([name, spec]) => spec.required && rows.value[name]?.from === FIXED && rows.value[name]?.value === "")
.map(([name]) => `${name} is required`);
});
function bindingInputs(): Record<string, InputSource> {
const out: Record<string, InputSource> = {};
for (const [name, spec] of inputs.value) {
const row = rows.value[name];
if (!row) continue;
if (row.from !== FIXED) out[name] = { param: row.from };
else if (row.value !== "") out[name] = { value: constantValue(row.value, spec.type ?? "string") };
}
return out;
}
async function save(): Promise<void> {
if (blockers.value.length) return;
saving.value = true;
error.value = "";
try {
const body = {
name: `${schedule.value?.name ?? scheduleId.value} → ${workflow.value}`,
matcher: { source: SCHEDULE_SOURCE },
mapping_id: SCHEDULE_MAPPING,
filter: scheduleFilter(scheduleId.value),
workflow: workflow.value,
repo_param: "",
owner: props.binding?.owner ?? "",
repo: props.binding?.repo ?? "",
inputs: bindingInputs(),
};
if (props.binding) await api.bindingUpdate(props.binding.id, body);
else await api.bindingCreate(body);
emit("saved");
} catch (err) {
error.value = err instanceof Error ? err.message : String(err);
} finally {
saving.value = false;
}
}
async function transition(command: (id: string) => Promise<unknown>, next: string): Promise<void> {
if (!props.binding) return;
error.value = "";
try {
await command(props.binding.id);
status.value = next;
emit("saved");
} catch (err) {
error.value = err instanceof Error ? err.message : String(err);
}
}
async function remove(): Promise<void> {
if (!props.binding) return;
try {
await api.bindingDelete(props.binding.id);
emit("saved");
} catch (err) {
error.value = err instanceof Error ? err.message : String(err);
}
}
</script>
<template>
<div class="flex h-full flex-col">
<AlertDialog v-model:open="confirmRemove">
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Remove schedule trigger?</AlertDialogTitle>
<AlertDialogDescription>The schedule keeps running; it stops starting this workflow.</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Cancel</AlertDialogCancel>
<AlertDialogAction @click="remove">Remove trigger</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
<header class="flex items-center gap-2 border-b border-border px-4 py-3">
<Button type="button" variant="ghost" size="icon-sm" aria-label="Back to settings" @click="emit('back')"><ArrowLeft /></Button>
<div class="min-w-0 flex-1 truncate text-sm font-medium">{{ schedule?.name ?? "Add a schedule" }}</div>
<Badge v-if="status" :variant="statusKind(status)">{{ statusLabel(status) }}</Badge>
</header>
<div v-if="loading" class="flex flex-1 items-center justify-center"><Spinner /></div>
<form v-else class="flex-1 space-y-5 overflow-y-auto px-4 py-4" @submit.prevent="save">
<section class="space-y-1.5">
<label for="schedule-trigger" class="text-xs font-medium text-fg-muted">Schedule</label>
<p v-if="loadError" class="text-xs text-danger" role="alert">{{ loadError }}</p>
<OptionSelect v-else id="schedule-trigger" aria-label="Schedule" :model-value="scheduleId" :options="scheduleOptions" class="w-full" @update:model-value="pickSchedule" />
</section>
<section class="space-y-1.5">
<div class="text-xs font-medium text-fg-muted">Inputs</div>
<div class="divide-y divide-border rounded-md border border-border">
<div v-for="[name, spec] in inputs" :key="name" class="space-y-1 px-3 py-2">
<div class="flex items-center gap-1.5 text-xs">
<span class="font-mono">{{ name }}</span>
<span class="text-fg-subtle">{{ spec.type ?? "string" }}</span>
<span v-if="spec.required" class="text-danger" title="Required">*</span>
</div>
<OptionSelect :aria-label="`${name} source`" :model-value="rows[name]!.from" :options="fieldOptions" class="w-full" @update:model-value="rows[name]!.from = $event" />
<Input v-if="rows[name]!.from === FIXED" v-model="rows[name]!.value" :aria-label="`${name} fixed value`" placeholder="fixed value" class="h-8 w-full font-mono text-xs" />
</div>
<p v-if="!inputs.length" class="px-3 py-2 text-xs text-fg-subtle">No inputs.</p>
</div>
</section>
<div class="space-y-2">
<p v-if="error" role="alert" class="text-xs text-danger">{{ error }}</p>
<p v-else-if="blockers.length" class="text-xs text-fg-subtle">Cannot save: {{ blockers[0] }}</p>
<div class="flex flex-wrap gap-2">
<Button type="submit" size="sm" :disabled="saving || !!blockers.length"><Spinner v-if="saving" />Save trigger</Button>
<Button v-if="binding && status === 'pending_approval'" type="button" size="sm" variant="outline" @click="transition(api.bindingApprove, 'armed')">Approve</Button>
<Button v-if="binding && status === 'armed'" type="button" size="sm" variant="outline" @click="transition(api.bindingPause, 'paused')">Pause</Button>
<Button v-if="binding && status === 'paused'" type="button" size="sm" variant="outline" @click="transition(api.bindingResume, 'pending_approval')">Resume</Button>
<Button v-if="binding" type="button" size="sm" variant="destructive" @click="confirmRemove = true">Remove trigger</Button>
</div>
</div>
</form>
<ScheduleEditor v-model:open="editorOpen" :schedule="draft" title="New schedule" @saved="created" />
</div>
</template>
+2 -1
View File
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { computed, nextTick, onBeforeUnmount, onMounted, ref } from "vue";
import { Handle, Position } from "@vue-flow/core";
import { CircleAlert, CircleCheck, CircleMinus, CircleX, Copy, EllipsisVertical, Flag, LoaderCircle, Pencil, Play, Repeat, Settings2, SkipForward, Tag, Trash2, Workflow, Zap, BookOpen } from "@lucide/vue";
import { CircleAlert, CircleCheck, CircleMinus, CircleX, Copy, EllipsisVertical, Flag, LoaderCircle, Pencil, Play, Repeat, Settings2, SkipForward, Tag, Trash2, Workflow, Zap, BookOpen, CalendarClock } from "@lucide/vue";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
@@ -26,6 +26,7 @@ const props = defineProps<{ data: StepCardData }>();
const TRIGGER_KINDS = {
issue: { icon: Tag, label: "Issue route" },
event: { icon: Zap, label: "Event binding" },
schedule: { icon: CalendarClock, label: "Schedule" },
playbook: { icon: BookOpen, label: "Playbook" },
workflow: { icon: Workflow, label: "Workflow" },
} as const;
+11 -2
View File
@@ -1,11 +1,12 @@
<script setup lang="ts">
import { ref } from "vue";
import { Plus } from "@lucide/vue";
import { CalendarClock, 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 ScheduleTrigger from "./ScheduleTrigger.vue";
import SpecList from "./SpecList.vue";
import type { WorkflowTrigger } from "./workflow-triggers";
@@ -14,22 +15,30 @@ 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>();
const scheduled = ref<Binding | null | undefined>();
function bound(): void {
binding.value = undefined;
scheduled.value = undefined;
emit("bound");
}
function open(trigger: WorkflowTrigger): void {
if (trigger.kind === "schedule") scheduled.value = trigger.binding;
else binding.value = trigger.binding;
}
</script>
<template>
<BindEvent v-if="binding !== undefined" :yaml="yaml" :binding="binding" @back="binding = undefined" @saved="bound" />
<ScheduleTrigger v-else-if="scheduled !== undefined" :yaml="yaml" :binding="scheduled" @back="scheduled = 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="scheduled = null"><CalendarClock data-icon="inline-start" />Add a schedule</Button>
<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-label">
<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">
<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="open(trigger)">
<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>
+38 -2
View File
@@ -9,7 +9,7 @@ import type { Binding } from "@/bindings/binding-draft";
/** One way a workflow gets started. */
export interface WorkflowTrigger {
kind: "issue" | "event" | "playbook" | "workflow";
kind: "issue" | "event" | "schedule" | "playbook" | "workflow";
label: string;
detail?: string;
/** The event binding this trigger is, for editing it. */
@@ -22,6 +22,30 @@ export interface TriggerSources {
bindings: Binding[];
playbooks: { id: string; yaml: string }[];
definitions: { id: string; yaml: string }[];
/** Schedules by id, to name schedule triggers. */
schedules: { id: string; name: string }[];
}
/** The reserved source a schedule's firings are captured on, and the
* built-in mapping that hands a binding the firing's fields. */
export const SCHEDULE_SOURCE = "schedule";
export const SCHEDULE_MAPPING = "schedule-fired";
export const SCHEDULE_FIELDS = ["schedule_id", "name", "scheduled_for", "fired_at"] as const;
/** The binding filter that admits only the firings of one schedule. */
export function scheduleFilter(id: string): string {
return `schedule_id == ${JSON.stringify(id)}`;
}
/** The schedule a schedule trigger's filter names, or "". */
export function scheduleOfBinding(binding: Binding): string {
const match = /^schedule_id == ("(?:[^"\\]|\\.)*")$/.exec(binding.filter?.trim() ?? "");
if (!match) return "";
try {
return JSON.parse(match[1]!) as string;
} catch {
return "";
}
}
type Mapping = Record<string, unknown>;
@@ -51,6 +75,12 @@ export function triggersFor(id: string, sources: TriggerSources): WorkflowTrigge
}
for (const binding of sources.bindings) {
if (binding.workflow !== id) continue;
if (binding.matcher?.source === SCHEDULE_SOURCE) {
const scheduleId = scheduleOfBinding(binding);
const schedule = sources.schedules.find((s) => s.id === scheduleId);
triggers.push({ kind: "schedule", label: schedule?.name ?? (scheduleId || "Schedule"), binding });
continue;
}
triggers.push({ kind: "event", label: binding.name || "Event binding", detail: binding.matcher?.source, binding });
}
for (const playbook of sources.playbooks) {
@@ -111,9 +141,14 @@ export function useWorkflowTriggers(id: Ref<string>) {
const store = useSettingsStore();
const workflows = useWorkflowsStore();
const bindings = ref<TriggerSources["bindings"]>([]);
const schedules = ref<TriggerSources["schedules"]>([]);
async function reload(): Promise<void> {
const response = await api.bindings<{ bindings?: Binding[] }>().catch(() => null);
const [response, listed] = await Promise.all([
api.bindings<{ bindings?: Binding[] }>().catch(() => null),
api.schedules<{ schedules?: TriggerSources["schedules"] }>().catch(() => null),
]);
bindings.value = response?.bindings ?? [];
schedules.value = listed?.schedules ?? [];
}
onMounted(reload);
const triggers = computed(() =>
@@ -122,6 +157,7 @@ export function useWorkflowTriggers(id: Ref<string>) {
bindings: bindings.value,
playbooks: (store.stateFor("eda-playbooks").resource?.value as { playbooks?: TriggerSources["playbooks"] } | undefined)?.playbooks ?? [],
definitions: workflows.collection.definitions,
schedules: schedules.value,
}),
);
return { triggers, reload };