feat(access): denial retention knob, State Store sweep and dashboard denials page (#1842)

Add [access].denial_retention (default 90 days, matching the audit-retention
seed) wired through config defaults and validation; the State Store sweeps
denial records older than the configured age hourly via the new
access.DenialPruner / PruneDenials store query. The dashboard gains
GET /api/access/denials (read_audit-gated, so org admins/owners see their
org's records; the store scopes by the credential's org) and an
/org/denials page backed by a Pinia store.
This commit is contained in:
sam committed 2026-10-31 14:23:31 +11:00
1 parent f7926cde15
commit 003771ca48
28 files changed
+625 -116

No files matched your search

+5
View File
@@ -80,3 +80,8 @@ target = "127.0.0.1:9090"
# [bindings]
# encryption_key = { engine = "env", key = "ARCHIE_BINDING_KEY" }
# Access records: how long a recorded access denial is kept before the State
# Store's sweep deletes it. Zero means 90 days.
# [access]
# denial_retention = "2160h"
+12 -3
View File
@@ -93,9 +93,7 @@ func compose(ctx context.Context, d deps) *webui.Server {
// client already carries them: withholding them would degrade two pages
// that have an owner, which is a different thing from the intake surfaces
// below.
if policies, ok := d.Store.(access.PolicyStore); ok {
srv.Policies = policies
}
wireAccessSurfaces(srv, d.Store)
wireAudit(srv, d.Store)
wireOrgSurface(srv, d.Store)
wireAlerts(srv, d.Store)
@@ -134,6 +132,17 @@ func compose(ctx context.Context, d deps) *webui.Server {
return srv
}
// wireAccessSurfaces attaches the stored policy chain and the denial-record
// list when the state client carries them.
func wireAccessSurfaces(srv *webui.Server, store storecontract.TaskStore) {
if policies, ok := store.(access.PolicyStore); ok {
srv.Policies = policies
}
if denials, ok := store.(access.DenialStore); ok {
srv.DenialLister = denials
}
}
// wireAudit attaches the State Store's org-scoped audit feed. A store that
// cannot serve it leaves the audit routes answering 503 rather than showing an
// empty timeline.
+3 -1
View File
@@ -74,10 +74,12 @@ func serviceAlert(name string) alert.Input {
}
// startSweeps starts the store's periodic work: auto-updating packages,
// checking service health and pruning alerts, and applying audit retention.
// checking service health and pruning alerts, and applying audit and denial
// retention.
func (b *server) startSweeps(ctx context.Context, deps staterpc.Deps) {
go b.autoUpdatePackages(ctx, deps.Packages)
go b.sweepAuditRetention(ctx)
go b.sweepDenials(ctx)
go b.sweepScheduleRuns(ctx, deps)
if deps.Alerts != nil {
go b.sweepAlerts(ctx, deps.Alerts)
@@ -0,0 +1,44 @@
package statestore
import (
"context"
"time"
"github.com/samcharles93/archie-core/internal/domain/access"
)
// denialSweepInterval is how often the configured denial retention is applied.
const denialSweepInterval = time.Hour
// sweepDenials deletes denial records older than the configured
// access.denial_retention until ctx ends. A non-positive retention keeps the
// records forever, so the sweep does not run at all in that case.
func (b *server) sweepDenials(ctx context.Context) {
pruner, ok := b.st.(access.DenialPruner)
if !ok {
return
}
retention := b.cfg.Access.DenialRetention.Std()
if retention <= 0 {
return
}
ticker := time.NewTicker(denialSweepInterval)
defer ticker.Stop()
for {
cutoff := time.Now().Add(-retention)
rows, err := pruner.PruneDenials(ctx, cutoff)
switch {
case err != nil:
if ctx.Err() == nil {
b.log.WarnContext(ctx, "prune access denials", "err", err)
}
case rows > 0:
b.log.InfoContext(ctx, "pruned access denials", "rows", rows, "cutoff", cutoff.UTC())
}
select {
case <-ctx.Done():
return
case <-ticker.C:
}
}
}
+9
View File
@@ -414,6 +414,7 @@ type Config struct {
Containers ContainerConfig `toml:"containers" yaml:"containers"`
Chat ChatConfig `toml:"chat" yaml:"chat"`
Capture CaptureConfig `toml:"capture" yaml:"capture"`
Access AccessConfig `toml:"access" yaml:"access"`
Bindings BindingsConfig `toml:"bindings" yaml:"bindings"`
// Memory holds memory provider configuration (from config.memory.yaml).
@@ -662,6 +663,14 @@ type CaptureConfig struct {
RateBurst int `toml:"rate_burst" yaml:"rate_burst"`
}
// AccessConfig configures the access surfaces: the stored policy chain and
// the denial records the State Store keeps.
type AccessConfig struct {
// DenialRetention is how long a recorded access denial is kept before
// the State Store's sweep deletes it. Zero means the 90-day default.
DenialRetention Duration `toml:"denial_retention" yaml:"denial_retention"`
}
// BindingsConfig configures the playbook-binding store (t2db). When
// EncryptionKey is unset, binding secrets are persisted as plaintext
// (legacy behaviour); when set, they are AES-256-GCM encrypted at rest
+10
View File
@@ -5,6 +5,7 @@ package access
import (
"context"
"time"
"github.com/samcharles93/archie-core/internal/domain/org"
)
@@ -61,3 +62,12 @@ type DenialStore interface {
// ListDenials returns an org's most recent denials, newest first.
ListDenials(ctx context.Context, orgID org.OrgID, limit int) ([]Denial, error)
}
// DenialPruner deletes denial records older than a cutoff. The State Store's
// retention sweep is its only caller: the configured retention decides the
// cutoff, and this deletes nothing else.
type DenialPruner interface {
// PruneDenials deletes every denial record created before cutoff and
// returns how many rows it removed.
PruneDenials(ctx context.Context, cutoff time.Time) (int64, error)
}
+1
View File
@@ -52,6 +52,7 @@ var dashboardPages = []DashboardPage{
{Path: "/org/scheduling-policy", Label: "Scheduling policy", Description: "Work discovery and forge labels."},
{Path: "/settings/tools", Label: "Tools & MCP", Description: "Agent tools and MCP servers."},
{Path: "/org/audit", Label: "Audit", Description: "Settings, access, identity and runtime events."},
{Path: "/org/denials", Label: "Denials", Description: "Access requests the policy chain refused, newest first."},
{Path: "/settings/plugins", Label: "Plugins", Description: "Extension directories loaded at startup."},
{Path: "/settings/secret-engines", Label: "Secret engines"},
{Path: "/settings/container-runtime", Label: "Container runtime"},
@@ -42,6 +42,11 @@ const (
defaultCaptureRatePerSecond = 1.0
defaultCaptureRateBurst = 5
// defaultDenialRetention keeps denial records for 90 days, the same
// horizon the audit-retention seed gives the audit trail
// (docs/prds/orgs-and-access.md, "Audit retention").
defaultDenialRetention = 90 * 24 * time.Hour
// defaultHealthListen is the daemon's own liveness address.
defaultHealthListen = "127.0.0.1:8485"
@@ -70,6 +75,7 @@ func (l *Loader) applyDefaults(cfg *config.Config) {
applyContainerDefaults(cfg)
applyToolPolicyDefaults(cfg)
applyCaptureDefaults(cfg)
applyAccessDefaults(cfg)
applyNATSDefaults(cfg)
applyMemoryDefaults(cfg)
applyCuratorDefaults(cfg)
@@ -249,6 +255,14 @@ func applyForgeDefaults(cfg *config.Config) {
}
}
// applyAccessDefaults fills the access surfaces' settings. See
// [config.AccessConfig].
func applyAccessDefaults(cfg *config.Config) {
if cfg.Access.DenialRetention == 0 {
cfg.Access.DenialRetention = config.Duration(defaultDenialRetention)
}
}
// applyNATSDefaults resolves the nats mode from URL when the operator left it
// unset. URL set implies external; URL empty implies embedded.
func applyNATSDefaults(cfg *config.Config) {
@@ -17,6 +17,7 @@ var DeniedKeys = map[string]string{
"org": "Pins the deployment's org at startup.",
"memory.engine": "Constructs the memory engine at startup.",
"capture.*": "Constructs the dashboard capture receiver at startup.",
"access.*": "Read by the State Store's denial sweep at startup; a change needs a restart.",
"log.level": "Constructs each service's logging handlers at startup.",
"log.*": "Constructs each service's logging handlers at startup.",
"tools.mcp_servers[].headers": "Process credentials supplied at startup; values are never published.",
@@ -75,7 +75,10 @@ func validateBootstrap(cfg *config.Config) error {
if err := validateCurators(cfg); err != nil {
return err
}
return validateCapture(cfg)
if err := validateCapture(cfg); err != nil {
return err
}
return validateAccess(cfg)
}
// validateDatabaseOwned checks the settings the control plane owns:
@@ -96,6 +99,14 @@ func validateDatabaseOwned(cfg *config.Config) error {
return validateRepositoryContents(cfg)
}
// validateAccess rejects a negative denial retention.
func validateAccess(cfg *config.Config) error {
if cfg.Access.DenialRetention < 0 {
return fmt.Errorf("%w: access.denial_retention must not be negative", ErrInvalidInput)
}
return nil
}
// validateCurators rejects a curator definition with no interval. The
// interval is a live-path value: a definition missing it is refused with a
// clear error rather than defaulted at registration or pass time, so a
+28 -3
View File
@@ -11,6 +11,7 @@ import (
"errors"
"fmt"
"strings"
"time"
"github.com/jackc/pgx/v5"
@@ -22,9 +23,10 @@ import (
)
var (
_ access.PolicyStore = (*Store)(nil)
_ access.Resetter = (*Store)(nil)
_ access.DenialStore = (*Store)(nil)
_ access.PolicyStore = (*Store)(nil)
_ access.Resetter = (*Store)(nil)
_ access.DenialStore = (*Store)(nil)
_ access.DenialPruner = (*Store)(nil)
)
// shippedOrgPolicyIDs lists an org's shipped role policy IDs: the seed's
@@ -403,3 +405,26 @@ func (s *Store) ListDenials(ctx context.Context, orgID org.OrgID, limit int) ([]
}
return out, nil
}
// denialPruneBatch is one delete's bound, so a single sweep does not own the
// table for an unbounded time.
const denialPruneBatch = 10_000
// PruneDenials deletes the denial records created before cutoff in bounded
// batches and returns how many rows it removed. The State Store's retention
// sweep is the only caller: the configured retention sets the cutoff.
func (s *Store) PruneDenials(ctx context.Context, cutoff time.Time) (int64, error) {
var total int64
for {
removed, err := s.queries().PruneDenials(ctx, postgresdb.PruneDenialsParams{
Cutoff: cutoff.UTC(), Batch: denialPruneBatch,
})
if err != nil {
return total, err
}
total += removed
if removed < denialPruneBatch {
return total, nil
}
}
}
@@ -7,6 +7,7 @@ package postgresdb
import (
"context"
"time"
"github.com/jackc/pgx/v5/pgtype"
)
@@ -329,6 +330,32 @@ func (q *Queries) LockPolicyWrite(ctx context.Context, key string) error {
return err
}
const pruneDenials = `-- name: PruneDenials :execrows
DELETE FROM access_denials
WHERE id IN (
SELECT id FROM access_denials
WHERE created_at < $1::timestamptz
ORDER BY created_at
LIMIT $2::bigint
)
`
type PruneDenialsParams struct {
Cutoff time.Time
Batch int64
}
// The retention sweep's delete: every denial record created before the
// cutoff, oldest first in bounded batches so one sweep does not own the
// table for an unbounded time.
func (q *Queries) PruneDenials(ctx context.Context, arg PruneDenialsParams) (int64, error) {
result, err := q.db.Exec(ctx, pruneDenials, arg.Cutoff, arg.Batch)
if err != nil {
return 0, err
}
return result.RowsAffected(), nil
}
const recordDenial = `-- name: RecordDenial :exec
INSERT INTO access_denials (org_id, principal, action, resource_kind, resource_id, level, policies)
VALUES ($1, $2, $3, $4, $5, $6, $7)
@@ -74,6 +74,18 @@ DO UPDATE SET count = access_denials.count + 1, updated_at = now();
SELECT id, org_id, principal, action, resource_kind, resource_id, level, policies, minute_at, count, created_at, updated_at
FROM access_denials WHERE org_id = $1 ORDER BY id DESC LIMIT $2;
-- name: PruneDenials :execrows
-- The retention sweep's delete: every denial record created before the
-- cutoff, oldest first in bounded batches so one sweep does not own the
-- table for an unbounded time.
DELETE FROM access_denials
WHERE id IN (
SELECT id FROM access_denials
WHERE created_at < sqlc.arg(cutoff)::timestamptz
ORDER BY created_at
LIMIT sqlc.arg(batch)::bigint
);
-- name: InsertAccessResetAudit :exec
INSERT INTO sys_audit (at, table_name, record_key, field, record_version, actor, source, request_id, org_id)
VALUES (now(), 'access_policies', $1, 'reset', 1, 'archie-state-store access reset', 'archie-state-store', '', $2);
@@ -15,7 +15,7 @@ import (
// The Client satisfies the access contracts the two callers depend on.
var (
_ access.PolicyStore = (*Client)(nil)
_ access.DenialRecorder = (*Client)(nil)
_ access.DenialStore = (*Client)(nil)
_ access.PrincipalSource = (*Client)(nil)
)
@@ -82,3 +82,17 @@ func (c *Client) RecordDenial(ctx context.Context, d access.Denial) error {
_, err := c.access.RecordDenial(ctx, &pb.RecordDenialRequest{Denial: accessDenialProto(d)})
return unmapError(err)
}
// ListDenials returns the denials the credential's org holds, newest first.
// The org is the one the State Store derives from the caller's credential, so
// the contract's orgID is not sent: no request field sets scope.
func (c *Client) ListDenials(ctx context.Context, _ org.OrgID, limit int) ([]access.Denial, error) {
if limit <= 0 || limit > 1000 {
limit = 100
}
r, err := c.access.ListDenials(ctx, &pb.ListDenialsRequest{Limit: int32(limit)})
if err != nil {
return nil, unmapError(err)
}
return mapValues(r.GetDenials(), accessDenialValue), nil
}
+34
View File
@@ -0,0 +1,34 @@
package webui
import (
"net/http"
"strconv"
"github.com/samcharles93/archie-core/internal/domain/access"
)
const defaultDenialsListLimit = 100
// handleListDenials lists the caller's org's recorded access denials, newest
// first. The route's read_audit grant limits it to the org's admins and
// owners, and the store scopes the list by the credential's org, so no
// request field chooses the org an operator reads.
func (s *Server) handleListDenials(w http.ResponseWriter, r *http.Request) {
if s.DenialLister == nil {
http.Error(w, "denial records unavailable", http.StatusServiceUnavailable)
return
}
limit, err := strconv.ParseInt(r.URL.Query().Get("limit"), 10, 32)
if err != nil || limit <= 0 || limit > 1000 {
limit = defaultDenialsListLimit
}
denials, err := s.DenialLister.ListDenials(r.Context(), policyOrg(r), int(limit))
if err != nil {
writeControlPlaneError(w, err)
return
}
if denials == nil {
denials = []access.Denial{}
}
writeJSON(w, map[string]any{"denials": denials})
}
+136
View File
@@ -0,0 +1,136 @@
package webui
import (
"context"
"encoding/json"
"net/http"
"net/http/httptest"
"testing"
"github.com/samcharles93/archie-core/internal/domain/access"
"github.com/samcharles93/archie-core/internal/domain/org"
infraaccess "github.com/samcharles93/archie-core/internal/infrastructure/access"
)
// fakeDenialStore records the scope it was asked for and serves fixed rows.
type fakeDenialStore struct {
orgID org.OrgID
limit int
denials []access.Denial
}
func (f *fakeDenialStore) RecordDenial(context.Context, access.Denial) error { return nil }
func (f *fakeDenialStore) ListDenials(_ context.Context, orgID org.OrgID, limit int) ([]access.Denial, error) {
f.orgID, f.limit = orgID, limit
out := make([]access.Denial, 0, len(f.denials))
for _, d := range f.denials {
if d.Org == orgID {
out = append(out, d)
}
}
return out, nil
}
// TestDenialsRouteRequiresAdmin pins the denials route's grant: reading the
// org's denial records needs the same read_audit grant as the audit feed, so a
// viewer and a developer are refused and an admin reaches the handler.
func TestDenialsRouteRequiresAdmin(t *testing.T) {
const path = "/api/access/denials"
tests := []struct {
role org.Role
want int
}{
{org.RoleViewer, http.StatusForbidden},
{org.RoleDeveloper, http.StatusForbidden},
{org.RoleAdmin, http.StatusOK},
{org.RoleOwner, http.StatusOK},
}
for _, tt := range tests {
t.Run(string(tt.role), func(t *testing.T) {
principal := memberOf("alice", "acme", tt.role)
srv := &Server{
Accounts: accountBoundaryStore{},
Access: infraaccess.New(access.ShippedOrgPolicies("acme")),
Principals: principalOf(principal),
DenialLister: &fakeDenialStore{},
}
req := httptest.NewRequestWithContext(t.Context(), http.MethodGet, "https://archie.example"+path, nil)
req.Header.Set("X-Archie-CSRF", "1")
req.AddCookie(&http.Cookie{Name: "archie_session", Value: "valid"})
rec := httptest.NewRecorder()
srv.Handler().ServeHTTP(rec, req)
if rec.Code != tt.want {
t.Fatalf("status = %d, want %d body=%s", rec.Code, tt.want, rec.Body.String())
}
})
}
}
// TestHandleListDenialsScopesToCallersOrg pins the handler's scoping: the list
// is asked for the caller's org only, so another org's records are never
// fetched, and the limit comes from the query, clamped to the default.
func TestHandleListDenialsScopesToCallersOrg(t *testing.T) {
store := &fakeDenialStore{denials: []access.Denial{
{Org: "acme", Principal: "alice", Action: access.ActionRead, Kind: access.KindTask, ResourceID: "7", Level: access.LevelOrg},
{Org: "other", Principal: "bob", Action: access.ActionRead, Kind: access.KindTask, ResourceID: "9", Level: access.LevelOrg},
}}
srv := &Server{DenialLister: store}
tests := []struct {
name string
caller org.OrgID
query string
wantOrg org.OrgID
wantRows int
wantCap int
}{
{"the caller's org is the scope, with the query's limit", "acme", "?limit=5", "acme", 1, 5},
{"another org's caller gets that org, not acme's rows", "other", "", "other", 1, defaultDenialsListLimit},
{"an oversized limit falls back to the default", "acme", "?limit=5000", "acme", 1, defaultDenialsListLimit},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
principal := memberOf("alice", tt.caller, org.RoleAdmin)
ctx := org.WithOrg(access.WithPrincipal(t.Context(), principal), tt.caller)
req := httptest.NewRequestWithContext(ctx, http.MethodGet, "/api/access/denials"+tt.query, nil)
rec := httptest.NewRecorder()
srv.handleListDenials(rec, req)
if rec.Code != http.StatusOK {
t.Fatalf("status = %d, want 200 body=%s", rec.Code, rec.Body.String())
}
if store.orgID != tt.wantOrg {
t.Fatalf("listed org = %q, want %q", store.orgID, tt.wantOrg)
}
if store.limit != tt.wantCap {
t.Fatalf("limit = %d, want %d", store.limit, tt.wantCap)
}
var body struct {
Denials []access.Denial `json:"denials"`
}
if err := json.Unmarshal(rec.Body.Bytes(), &body); err != nil {
t.Fatalf("decode body: %v", err)
}
if len(body.Denials) != tt.wantRows {
t.Fatalf("rows = %d, want %d", len(body.Denials), tt.wantRows)
}
for _, d := range body.Denials {
if d.Org != tt.wantOrg {
t.Fatalf("row from org %q in a %q list", d.Org, tt.wantOrg)
}
}
})
}
}
// TestHandleListDenialsUnwired pins the unwired answer: a dashboard without
// the denial list answers 503 rather than an empty list.
func TestHandleListDenialsUnwired(t *testing.T) {
srv := &Server{}
req := httptest.NewRequestWithContext(t.Context(), http.MethodGet, "/api/access/denials", nil)
rec := httptest.NewRecorder()
srv.handleListDenials(rec, req)
if rec.Code != http.StatusServiceUnavailable {
t.Fatalf("status = %d, want 503", rec.Code)
}
}
+1
View File
@@ -45,6 +45,7 @@ func pageProbes() []pageProbe {
{"org_members", http.MethodPost, "/api/orgs/_/members"},
{"org_agents", http.MethodPut, "/api/orgs/_/agents/_"},
{"org_policies", http.MethodPut, "/api/access/policies"},
{"org_denials", http.MethodGet, "/api/access/denials"},
{"org_audit", http.MethodGet, "/api/audit"},
{"org_config", http.MethodPost, "/api/control-plane/resources/_/commands/replace"},
}
+15 -4
View File
@@ -305,8 +305,8 @@ func routeOverride(action access.Action, path string) (access.Action, access.Res
switch {
case matchSegment(path, "/api/tasks/", "/logs"), matchSegment(path, "/api/tasks/", "/sandbox"):
return access.ActionReadLogs, access.KindTask, segmentValue(path, 2), true
case matchPrefix(path, "/api/access/policies"):
return policyAction(action), access.KindPolicy, "", true
case matchPrefix(path, "/api/access"):
return accessRoute(action, path)
case matchPrefix(path, "/api/identities"):
return actionManage(action), access.KindIdentity, segmentValue(path, 2), true
case matchPrefix(path, "/api/orgs"):
@@ -406,8 +406,17 @@ func kindOf(path string) access.ResourceKind {
return access.KindDashboard
}
// actionManage lifts a create or update on a managed surface to the manage
// action the role vocabulary carries.
// accessRoute maps the access routes: policy management on the policies
// routes, and on the denials route the same read_audit grant the audit feed
// carries, which the shipped role policies give an org's admins and owners
// only -- denial records are the access trail's operator surface.
func accessRoute(action access.Action, path string) (access.Action, access.ResourceKind, string, bool) {
if matchPrefix(path, "/api/access/policies") {
return policyAction(action), access.KindPolicy, "", true
}
return access.ActionReadAudit, access.KindAudit, "", true
}
// policyAction lifts every write on the policy routes to manage_policies.
func policyAction(action access.Action) access.Action {
if action == access.ActionRead {
@@ -416,6 +425,8 @@ func policyAction(action access.Action) access.Action {
return access.ActionManagePolicies
}
// actionManage lifts a create or update on a managed surface to the manage
// action the role vocabulary carries.
func actionManage(action access.Action) access.Action {
switch action {
case access.ActionCreate, access.ActionUpdate:
+4
View File
@@ -117,6 +117,9 @@ type Server struct {
// Policies is the stored access policy chain, behind the policies page.
// Nil answers 503.
Policies access.PolicyStore
// DenialLister lists the caller's org's recorded denials, behind the
// denials page. Nil answers 503.
DenialLister access.DenialStore
// Audit is the org-scoped audit feed, behind the audit page and the live
// tail. Nil answers 503 on every audit route.
Audit audit.Store
@@ -379,6 +382,7 @@ func (s *Server) registerConfigAndLogRoutes(mux *http.ServeMux) {
mux.HandleFunc("GET /api/access/policies", s.handleListPolicies)
mux.HandleFunc("PUT /api/access/policies", s.handlePutPolicy)
mux.HandleFunc("DELETE /api/access/policies", s.handleDeletePolicy)
mux.HandleFunc("GET /api/access/denials", s.handleListDenials)
mux.HandleFunc("GET /api/control-plane/resources/{kind}", s.handleControlPlaneQuery)
mux.HandleFunc("GET /api/control-plane/resources/{kind}/history", s.handleControlPlaneHistory)
mux.HandleFunc("POST /api/control-plane/resources/{kind}/commands/{command}", s.handleControlPlaneCommand)
+1 -1
View File
@@ -1,3 +1,3 @@
import{$n as e,A as t,B as n,Bn as r,C as i,Cn as a,Dn as o,E as s,En as c,Fn as l,G as u,Gn as d,Gt as f,Hn as p,Ht as m,In as h,Jn as g,Kn as ee,Ln as _,M as v,Mn as y,Nn as te,On as ne,Ot as b,Pn as x,Qn as S,Rn as C,U as w,Un as re,V as ie,Vn as T,Wn as ae,Xn as oe,Xt as se,Yn as E,Z as ce,Zn as D,_t as O,a as le,an as ue,bn as de,cn as fe,ct as pe,d as me,dt as he,er as k,g as ge,gn as _e,gt as ve,ht as ye,i as be,it as xe,jn as A,jt as Se,kn as Ce,l as we,n as Te,o as Ee,or as De,pn as Oe,qn as j,r as ke,rt as Ae,tr as je,v as Me,w as Ne,wn as Pe,wt as Fe,x as Ie,xn as Le,xt as Re,y as ze,yn as Be,zn as Ve}from"./PageHeader.js";var He=void 0,Ue=typeof window<`u`&&window.trustedTypes;if(Ue)try{He=Ue.createPolicy(`vue`,{createHTML:e=>e})}catch{}var We=He?e=>He.createHTML(e):e=>e,Ge=`http://www.w3.org/2000/svg`,Ke=`http://www.w3.org/1998/Math/MathML`,M=typeof document<`u`?document:null,qe=M&&M.createElement(`template`),Je={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(Ge,e):t===`mathml`?M.createElementNS(Ke,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{qe.innerHTML=We(r===`svg`?`<svg>${e}</svg>`:r===`mathml`?`<math>${e}</math>`:e);let i=qe.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`),Ye={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},Xe=h({},le,Ye),Ze=(e=>(e.displayName=`Transition`,e.props=Xe,e))((e,{slots:t})=>w(be,$e(e),t)),I=(e,t=[])=>{T(e)?e.forEach(e=>e(...t)):e&&e(...t)},Qe=e=>e?T(e)?e.some(e=>e.length>1):e.length>1:!1;function $e(e){let t={};for(let n in e)n in Ye||(t[n]=e[n]);if(e.css===!1)return t;let{name:n=`v`,type:r,duration:i,enterFromClass:a=`${n}-enter-from`,enterActiveClass:o=`${n}-enter-active`,enterToClass:s=`${n}-enter-to`,appearFromClass:c=a,appearActiveClass:l=o,appearToClass:u=s,leaveFromClass:d=`${n}-leave-from`,leaveActiveClass:f=`${n}-leave-active`,leaveToClass:p=`${n}-leave-to`}=e,m=et(i),g=m&&m[0],ee=m&&m[1],{onBeforeEnter:_,onEnter:v,onEnterCancelled:y,onLeave:te,onLeaveCancelled:ne,onBeforeAppear:b=_,onAppear:x=v,onAppearCancelled:S=y}=t,C=(e,t,n,r)=>{e._enterCancelled=r,R(e,t?u:s),R(e,t?l:o),n&&n()},w=(e,t)=>{e._isLeaving=!1,R(e,d),R(e,p),R(e,f),t&&t()},re=e=>(t,n)=>{let i=e?x:v,o=()=>C(t,e,n);I(i,[t,o]),nt(()=>{R(t,e?c:a),L(t,e?u:s),Qe(i)||it(t,r,g,o)})};return h(t,{onBeforeEnter(e){I(_,[e]),L(e,a),L(e,o)},onBeforeAppear(e){I(b,[e]),L(e,c),L(e,l)},onEnter:re(!1),onAppear:re(!0),onLeave(e,t){e._isLeaving=!0;let n=()=>w(e,t);L(e,d),e._enterCancelled?(L(e,f),ct(e)):(ct(e),L(e,f)),nt(()=>{e._isLeaving&&(R(e,d),L(e,p),Qe(te)||it(e,r,ee,n))}),I(te,[e,n])},onEnterCancelled(e){C(e,!1,void 0,!0),I(y,[e])},onAppearCancelled(e){C(e,!0,void 0,!0),I(S,[e])},onLeaveCancelled(e){w(e),I(ne,[e])}})}function et(e){if(e==null)return null;if(ae(e))return[tt(e.enter),tt(e.leave)];{let t=tt(e);return[t,t]}}function tt(e){return De(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 nt(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}var rt=0;function it(e,t,n,r){let i=e._endId=++rt,a=()=>{i===e._endId&&r()};if(n!=null)return setTimeout(a,n);let{type:o,timeout:s,propCount:c}=at(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 at(e,t){let n=window.getComputedStyle(e),r=e=>(n[e]||``).split(`, `),i=r(`${N}Delay`),a=r(`${N}Duration`),o=ot(i,a),s=r(`${P}Delay`),c=r(`${P}Duration`),l=ot(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 ot(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.maLine truncated
`))),e[J]=q(i);let a=r||i.props&&i.props.type===`number`;W(e,t?`change`:`input`,t=>{t.target.composing||e[J](un(e.value,n,a))}),(n||a)&&W(e,`change`,()=>{e.value=un(e.value,n,a)}),t||(W(e,`compositionstart`,sn),W(e,`compositionend`,cn),W(e,`change`,cn))},mounted(e,{value:t,modifiers:{trim:n,number:r}}){let i=t??``,a=e[ln];delete e[ln],a!==void 0&&(e.type===`text`||e.type===`textarea`)&&e.value!==a?e[J](un(e.value,n,r)):e.value=i},beforeUpdate(t,{value:n,oldValue:r,modifiers:{lazy:i,trim:a,number:o}},s){if(t[J]=q(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)}},fn={deep:!0,created(e,t,n){e[J]=q(n),W(e,`change`,()=>{let t=e._modelValue,n=Y(e),r=e.checked,i=e[J];if(T(t)){let e=S(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(vn(e,r))})},mounted:pn,beforeUpdate(e,t,n){e[J]=q(n),pn(e,t,n)}};function pn(e,{value:t,oldValue:n},r){e._modelValue=t;let i;if(T(t))i=S(t,r.props.value)>-1;else if(j(t))i=t.has(r.props.value);else{if(t===n)return;i=D(t,vn(e,!0))}e.checked!==i&&(e.checked=i)}var mn={created(e,{value:t},n){e.checked=D(t,n.props.value),e[J]=q(n),W(e,`change`,()=>{e[J](Y(e))})},beforeUpdate(e,{value:t,oldValue:n},r){e[J]=q(r),t!==n&&(e.checked=D(t,r.props.value))}},hn={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?T(a)?n.slice():n:a];try{t[J](a)}finally{xe(()=>{t._pendingValue===o&&(t._pendingValue=void 0)})}}),t[J]=q(i)},mounted(e,{value:t}){_n(e,t)},beforeUpdate(e,{value:t},n){e._modelValue=t,e[J]=q(n)},updated(e,{value:t}){let n=e._pendingValue;e._pendingValue=void 0,n&&n[0]===e.multiple&&gn(t,n[1],n[0])||_n(e,t)}};function gn(e,t,n){if(!n||T(e))return D(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 _n(e,t){let n=e.multiple,r=T(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)):S(t,o)>-1}else a.selected=t.has(o)}else if(D(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 vn(e,t){let n=t?`_trueValue`:`_falseValue`;return n in e?e[n]:t}var yn={created(e,t,n){xn(e,t,n,null,`created`)},mounted(e,t,n){xn(e,t,n,null,`mounted`)},beforeUpdate(e,t,n,r){xn(e,t,n,r,`beforeUpdate`)},updated(e,t,n,r){xn(e,t,n,r,`updated`)}};function bn(e,t){switch(e){case`SELECT`:return hn;case`TEXTAREA`:return dn;default:switch(t){case`checkbox`:return fn;case`radio`:return mn;default:return dn}}}function xn(e,t,n,r,i){let a=bn(e.tagName,n.props&&n.props.type)[i];a&&a(e,t,n,r)}function Sn(){dn.getSSRProps=({value:e})=>({value:e}),mn.getSSRProps=({value:e},t)=>{if(t.props&&D(t.props.value,e))return{checked:!0}},fn.getSSRProps=({value:e},t)=>{if(T(e)){if(t.props&&S(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}},yn.getSSRProps=(e,t)=>{if(typeof t.type!=`string`)return;let n=bn(t.type.toUpperCase(),t.props&&t.props.type);if(n.getSSRProps)return n.getSSRProps(e,t)}}var Cn=[`ctrl`,`shift`,`alt`,`meta`],wn={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)=>Cn.some(n=>e[`${n}Key`]&&!t.includes(n))},Tn=(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=wn[t[e]];if(r&&r(n,t))return}return e(n,...r)}))},En={esc:`escape`,space:` `,up:`arrow-up`,left:`arrow-left`,right:`arrow-right`,down:`arrow-down`,delete:`backspace`},Dn=(e,t)=>{let n=e._withKeys||={},r=t.join(`.`);return n[r]||(n[r]=(n=>{if(!(`key`in n))return;let r=C(n.key);if(t.some(e=>e===r||En[e]===r))return e(n)}))},On=h({patchProp:It},Je),kn,An=!1;function jn(){return kn||=s(On)}function Mn(){return kn=An?kn:Ne(On),An=!0,kn}var Nn=((...e)=>{jn().render(...e)}),Pn=((...e)=>{Mn().hydrate(...e)}),Fn=((...e)=>{let t=jn().createApp(...e),{mount:n}=t;return t.mount=e=>{let r=Rn(e);if(!r)return;let i=t._component;p(i)||i.render||i.template||(i.template=r.innerHTML),r.nodeType===1&&(r.textContent=``);let a=n(r,!1,Ln(r));return r instanceof Element&&(r.removeAttribute(`v-cloak`),r.setAttribute(`data-v-app`,``)),a},t}),In=((...e)=>{let t=Mn().createApp(...e),{mount:n}=t;return t.m Line truncated
`)[0].slice(0,200)}catch{}return`${e.status} ${e.statusText}`}var Fr;function Ir(e){Fr=e}var Lr=class extends Error{status;constructor(e,t){super(e),this.name=`ApiError`,this.status=t}};function Rr(e){let t=e instanceof Lr?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 zr(e,t){let n=await fetch(e,t);if(Fr?.(n.status===401),!n.ok)throw new Lr(await Pr(n),n.status);return n}async function Q(e,t={}){let{method:n=`GET`,body:r,timeoutMs:i=Nr,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 zr(e,s);return a?await c.json():void 0}var Br={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:(e,t)=>Q(`/api/tokens`,{method:`POST`,body:{name:e,days:t}}),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`),orgSelect:e=>Q(`/api/orgs/current`,{method:`PUT`,body:{id:e},parse:!1}),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 zr(`/api/tasks`+Z(e),{headers:{Accept:`application/json`},signal:AbortSignal.timeout(Nr)});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}),ch Line truncated
`)[0].slice(0,200)}catch{}return`${e.status} ${e.statusText}`}var Fr;function Ir(e){Fr=e}var Lr=class extends Error{status;constructor(e,t){super(e),this.name=`ApiError`,this.status=t}};function Rr(e){let t=e instanceof Lr?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 zr(e,t){let n=await fetch(e,t);if(Fr?.(n.status===401),!n.ok)throw new Lr(await Pr(n),n.status);return n}async function Q(e,t={}){let{method:n=`GET`,body:r,timeoutMs:i=Nr,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 zr(e,s);return a?await c.json():void 0}var Br={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:(e,t)=>Q(`/api/tokens`,{method:`POST`,body:{name:e,days:t}}),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`),denials:e=>Q(`/api/access/denials${e?`?limit=${e}`:``}`),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`),orgSelect:e=>Q(`/api/orgs/current`,{method:`PUT`,body:{id:e},parse:!1}),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 zr(`/api/tasks`+Z(e),{headers:{Accept:`application/json`},signal:AbortSignal.timeout(Nr)});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(Line truncated
+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
+100 -100
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/SchedulesPage.js","assets/badge.js","assets/pinia.js","assets/ScheduleRunsPage.js","assets/OrgAlertsPage.js","assets/PlaybooksPage.js","assets/AgentProfilesPage.js","assets/HarnessPage.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,O as l,P as u,R as d,S as f,T as p,_ as m,a as h,b as g,c as _,d as v,f as y,g as b,h as x,i as S,j as C,k as w,l as ee,m as T,n as te,o as E,p as D,r as ne,s as re,t as O,u as k,v as ie,w as ae,x as oe,y as se}from"./badge.js";import{$t as ce,A,B as le,Bt as ue,C as j,Ct as M,D as de,Dn as fe,Dt as pe,En as me,Gt as N,H as he,It as ge,Jt as _e,Kt as ve,Lt as ye,M as P,O as be,On as xe,Pt as Se,Q as Ce,Qt as we,Rt as Te,S as F,Sn as Ee,T as De,Tt as Oe,U as ke,Vt as Ae,Xt as I,Z as je,_t as L,an as Me,b as R,bn as Ne,cn as Pe,dt as Fe,er as z,gn as Ie,hn as Le,ht as Re,ir as B,it as ze,jn as V,k as H,kn as Be,l as U,m as Ve,n as W,nr as He,nt as Ue,o as We,ot as Ge,p as Ke,pn as qe,r as Je,rr as Ye,rt as G,sn as Xe,st as Ze,t as Qe,tt as $e,wn as et,wt as K,x as q,xn as J,y as Y,yn as tt,yt as nt}from"./PageHeader.js";import{B as rt,L as it,M as at,N as X,O as ot,P as st,a as ct,at as lt,c as eee,d as ut,i as dt,it as ft,l as pt,n as mt,nt as ht,o as gt,ot as _t,r as Z,rt as vt,s as yt,t as bt,u as xt,w as St}from"./createLucideIcon.js";import{n as Ct,r as wt,t as tee}from"./pinia.js";import{n as Tt,t as Et}from"./nullish.js";import{i as Dt,n as Ot,r as kt,t as At}from"./VisuallyHidden.js";import{_ as jt,a as Mt,c as Nt,d as Pt,f as Ft,g as It,h as Lt,i as Rt,l as zt,m as Bt,n as Vt,o as Ht,p as Ut,r as Wt,s as Gt,t as Kt,u as qt}from"./Collection.js";import{a as Jt,c as Yt,d as nee,f as ree,i as iee,l as aee,n as oee,o as see,p as cee,r as Xt,s as lee,t as Q,u as uee}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)}})();function dee(e,t,n){let r=e.findIndex(e=>Tt(e,t)),i=e.findIndex(e=>Tt(e,n));if(r===-1||i===-1)return[];let[a,o]=[r,i].sort((e,t)=>e-t);return e.slice(a,o+1)}function Zt(e,t){return Et(e)?!1:Array.isArray(e)?e.some(e=>Tt(e,t)):Tt(e,t)}var Qt=[`INPUT`,`TEXTAREA`];function $t(e,t,n,r={}){if(!t||r.enableIgnoredElement&&Qt.includes(t.nodeName))return null;let{arrowKeyOptions:i=`both`,attributeName:a=`[data-reka-collection-item]`,itemsArray:o=[],loop:s=!0,dir:c=`ltr`,preventScroll:l=!0,focus:u=!1}=r,[d,f,p,m,h,g]=[e.key===`ArrowRight`,e.key===`ArrowLeft`,e.key===`ArrowUp`,e.key===`ArrowDown`,e.key===`Home`,e.key===`End`],_=p||m,v=d||f;if(!h&&!g&&(!_&&!v||i===`vertical`&&v||i===`horizontal`&&_))return null;let y=n?Array.from(n.querySelectorAll(a)):o;if(!y.length)return null;l&&e.preventDefault();let b=null;return v||_?b=en(y,t,{goForward:_?m:c===`ltr`?d:f,loop:s}):h?b=y.at(0)||null:g&&(b=y.at(-1)||null),u&&b?.focus(),b}function en(e,t,n,r=e.includes(t)?e.length:e.length+1){if(--r===0)return null;let i=e.indexOf(t),a;if(a=i===-1?n.goForward?0:e.length-1:n.goForward?i+1:i-1,!n.loop&&(a<0||a>=e.length))return null;let o=e[(a+e.length)%e.length];return o?o.hasAttribute(`disabled`)&&o.getAttribute(`disabled`)!==`false`?en(e,o,n,r):o:null}var tn=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Bopomofo}]/u,nn=/android/i;function rn(){return typeof navigator<`u`&&nn.test(navigator.userAgent)}function an(e){let t=J(!1),n=J(!0),r=J(!1),i=Y(()=>t.value&&n.value);function a(){t.value=!0,n.value=!0,r.value=!1}function o(e){e.data&&(tn.test(e.data)?(n.value=!0,r.value=!0):rn()&&!r.value&&(n.value=!1))}function s(n){ze(()=>{t.value=!1,e?.(n)})}return{isComposing:t,shouldDeferInput:i,handleCompositionStart:a,handleCompositionUpdate:o,handleCompositionEnd:s}}function on(e){let t=Y(()=>V(e)),n=Y(()=>new Intl.Collator(`en`,{usage:`search`,...t.value}));return{startsWith:(e,t)=>t.length===0||(e=e.normalize(`NFC`),t=t.normalize(`NFC`),n.value.compare(e.slice(0,t.length),t)===0),endsWith:(e,t)=>t.length===0||(e=e.normalize(`NFC`),t=t.normalize(`NFC`),n.value.compare(e.slice(-t.length),t)===0),contains:(e,t)=>{if(t.length===0)return!0;if(e=e.normalize(`NFC`),t=t.normalize(`NFC`),t.length>e.length)return!1;let r=n.value.compare;if(e.includes(t))return!0;let i=t.length;for(let n=0;n+i<=e.length;n++)if(r(t,e.slice(n,n+i))===0)return!0;return!1}}}function sn(){let e=le()?.vnode?.scopeId;return e?{[e]:``}:{}}function cn(e,t){let r=s(!1,300);c(()=>{r.value=!1});let i=J(null),a=n();function o(){i.value=null,r.value=!1}function l(e,t){if(!t)return;let n=e.currentTarget,a={x:e.clientX,y:e.clientY},o=un(a,ln(a,n.getBoundingClientRect()),1),s=dn(t.getBoundingClientRect()),c=pn([...o,...s]);i.value=c,r.value=Line truncated
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,O as l,P as u,R as d,S as f,T as p,_ as m,a as h,b as g,c as _,d as v,f as y,g as b,h as x,i as S,j as ee,k as C,l as te,m as w,n as T,o as E,p as D,r as ne,s as re,t as O,u as k,v as ie,w as ae,x as oe,y as se}from"./badge.js";import{$t as ce,A,B as le,Bt as ue,C as j,Ct as M,D as de,Dn as fe,Dt as pe,En as me,Gt as N,H as he,It as ge,Jt as _e,Kt as ve,Lt as ye,M as P,O as be,On as xe,Pt as Se,Q as Ce,Qt as we,Rt as Te,S as F,Sn as Ee,T as De,Tt as Oe,U as ke,Vt as Ae,Xt as I,Z as je,_t as L,an as Me,b as R,bn as Ne,cn as Pe,dt as Fe,er as z,gn as Ie,hn as Le,ht as Re,ir as B,it as ze,jn as V,k as H,kn as Be,l as U,m as Ve,n as W,nr as He,nt as Ue,o as We,ot as Ge,p as Ke,pn as qe,r as Je,rr as Ye,rt as G,sn as Xe,st as Ze,t as Qe,tt as $e,wn as et,wt as K,x as q,xn as J,y as Y,yn as tt,yt as nt}from"./PageHeader.js";import{B as rt,L as it,M as at,N as X,O as ot,P as st,a as ct,at as lt,c as eee,d as ut,i as dt,it as ft,l as pt,n as mt,nt as ht,o as gt,ot as _t,r as Z,rt as vt,s as yt,t as bt,u as xt,w as St}from"./createLucideIcon.js";import{n as Ct,r as wt,t as tee}from"./pinia.js";import{n as Tt,t as Et}from"./nullish.js";import{i as Dt,n as Ot,r as kt,t as At}from"./VisuallyHidden.js";import{_ as jt,a as Mt,c as Nt,d as Pt,f as Ft,g as It,h as Lt,i as Rt,l as zt,m as Bt,n as Vt,o as Ht,p as Ut,r as Wt,s as Gt,t as Kt,u as qt}from"./Collection.js";import{a as Jt,c as Yt,d as nee,f as ree,i as iee,l as aee,n as oee,o as see,p as cee,r as Xt,s as lee,t as Q,u as uee}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)}})();function dee(e,t,n){let r=e.findIndex(e=>Tt(e,t)),i=e.findIndex(e=>Tt(e,n));if(r===-1||i===-1)return[];let[a,o]=[r,i].sort((e,t)=>e-t);return e.slice(a,o+1)}function Zt(e,t){return Et(e)?!1:Array.isArray(e)?e.some(e=>Tt(e,t)):Tt(e,t)}var Qt=[`INPUT`,`TEXTAREA`];function $t(e,t,n,r={}){if(!t||r.enableIgnoredElement&&Qt.includes(t.nodeName))return null;let{arrowKeyOptions:i=`both`,attributeName:a=`[data-reka-collection-item]`,itemsArray:o=[],loop:s=!0,dir:c=`ltr`,preventScroll:l=!0,focus:u=!1}=r,[d,f,p,m,h,g]=[e.key===`ArrowRight`,e.key===`ArrowLeft`,e.key===`ArrowUp`,e.key===`ArrowDown`,e.key===`Home`,e.key===`End`],_=p||m,v=d||f;if(!h&&!g&&(!_&&!v||i===`vertical`&&v||i===`horizontal`&&_))return null;let y=n?Array.from(n.querySelectorAll(a)):o;if(!y.length)return null;l&&e.preventDefault();let b=null;return v||_?b=en(y,t,{goForward:_?m:c===`ltr`?d:f,loop:s}):h?b=y.at(0)||null:g&&(b=y.at(-1)||null),u&&b?.focus(),b}function en(e,t,n,r=e.includes(t)?e.length:e.length+1){if(--r===0)return null;let i=e.indexOf(t),a;if(a=i===-1?n.goForward?0:e.length-1:n.goForward?i+1:i-1,!n.loop&&(a<0||a>=e.length))return null;let o=e[(a+e.length)%e.length];return o?o.hasAttribute(`disabled`)&&o.getAttribute(`disabled`)!==`false`?en(e,o,n,r):o:null}var tn=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Bopomofo}]/u,nn=/android/i;function rn(){return typeof navigator<`u`&&nn.test(navigator.userAgent)}function an(e){let t=J(!1),n=J(!0),r=J(!1),i=Y(()=>t.value&&n.value);function a(){t.value=!0,n.value=!0,r.value=!1}function o(e){e.data&&(tn.test(e.data)?(n.value=!0,r.value=!0):rn()&&!r.value&&(n.value=!1))}function s(n){ze(()=>{t.value=!1,e?.(n)})}return{isComposing:t,shouldDeferInput:i,handleCompositionStart:a,handleCompositionUpdate:o,handleCompositionEnd:s}}function on(e){let t=Y(()=>V(e)),n=Y(()=>new Intl.Collator(`en`,{usage:`search`,...t.value}));return{startsWith:(e,t)=>t.length===0||(e=e.normalize(`NFC`),t=t.normalize(`NFC`),n.value.compare(e.slice(0,t.length),t)===0),endsWith:(e,t)=>t.length===0||(e=e.normalize(`NFC`),t=t.normalize(`NFC`),n.value.compare(e.slice(-t.length),t)===0),contains:(e,t)=>{if(t.length===0)return!0;if(e=e.normalize(`NFC`),t=t.normalize(`NFC`),t.length>e.length)return!1;let r=n.value.compare;if(e.includes(t))return!0;let i=t.length;for(let n=0;n+i<=e.length;n++)if(r(t,e.slice(n,n+i))===0)return!0;return!1}}}function sn(){let e=le()?.vnode?.scopeId;return e?{[e]:``}:{}}function cn(e,t){let r=s(!1,300);c(()=>{r.value=!1});let i=J(null),a=n();function o(){i.value=null,r.value=!1}function l(e,t){if(!t)return;let n=e.currentTarget,a={x:e.clientX,y:e.clientY},o=un(a,ln(a,n.getBoundingClientRect()),1),s=dn(t.getBoundingClientRect()),c=pn([...o,...s]);i.value=c,r.value=Line 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&&(nd.value=n.session_id),n.type===`delta`&&(o+=n.text,cd.value=cd.value?{...cd.value,text:o}:null),(n.type===`tool`||n.type===`navigate`)&&(a=[...a,n],cd.value=cd.value?{...cd.value,tools:a}:null),n.type===`ask`&&n.ask&&(clearTimeout(l),cd.value=cd.value?{...cd.value,ask:n.ask}:null),n.type===`done`&&(s=!0,o||=n.text||``),n.type===`error`)throw Error(n.text)}if(t)break}if(!s)throw Error(`chat stream ended before completion`);rd.value=!i&&n.trim()===`/new`?[]:[...rd.value,{from:`assistant`,text:o,tool_calls:a}],cd.value=null,ad.value=`Ready`,await vd()}catch(e){let t=e;o&&(rd.value=[...rd.value,{from:`assistant`,text:o,tool_calls:a}],a=[]),t.name===`AbortError`&&!c?(cd.value={text:`Turn stopped.`,tools:a,isError:!1,turn:r,isRetry:i},ad.value=`Stopped`):(cd.value={text:`Unable to complete that turn: ${t.message||t}`,tools:a,isError:!0,turn:r?Qu(r):void 0,isRetry:i},ad.value=`Error. Retry available.`)}finally{clearTimeout(l),$u=null,gd=null,od.value=!1,wd.after?.()}}function Hte(){ad.value=`Stopping…`,nd.value&&Z.chatCancel(nd.value).catch(()=>{}),_d()}function Ute(){Fe(()=>{vd().catch(e=>{ad.value=e.message||`Chat unavailable`})}),Re(()=>{_d()})}async function Wte(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 Ad({textOverride:`🎤 Voice message`,voice:{data:btoa(n),mime_type:e.type||`audio/webm`}})}var Gte={class:`grid gap-1 p-1`},Kte={key:0,class:`text-xs text-fg-subtle`},jd=`__default__`,qte=P({__name:`ChatSettings`,setup(e){let t=Y(()=>ud.value||jd),n=Y(()=>{let e=ld.value.models_by_provider||{},t=Object.entries(e).filter(([,e])=>e.length);return t.length?t:[[``,ld.value.models||[]]]});return(e,r)=>(L(),j(`div`,Gte,[V(ad)===`Ready`?F(``,!0):(L(),j(`span`,Kte,B(V(ad)),1)),A(V(Wu),{"model-value":t.value,"onUpdate:modelValue":r[0]||=e=>V(Cd)(e===jd?``:String(e??``))},{default:I(()=>[A(V(Ju),{size:`sm`,class:`w-full`,"aria-label":`Model`},{default:I(()=>[A(V(Yu))]),_:1}),A(V(Gu),null,{default:I(()=>[A(V(qu),{value:jd},{default:I(()=>[...r[1]||=[H(`Default`,-1)]]),_:1}),(L(!0),j(U,null,M(n.value,([e,t])=>(L(),q(V(Ku),{key:e},{default:I(()=>[e?(L(),q(V(Ste),{key:0},{default:I(()=>[H(B(e),1)]),_:2},1024)):F(``,!0),(L(!0),j(U,null,M(t,e=>(L(),q(V(qu),{key:e,value:e},{default:I(()=>[H(B(e),1)]),_:2},1032,[`value`]))),128))]),_:2},1024))),128))]),_:1})]),_:1},8,[`model-value`])]))}}),Jte=P({__name:`ChatSessionActions`,setup(e){let t=J(!1);Pte(t);function n(e){t.value=!1,Sd(e)}function r(e,n){t.value=!1,Lte(e,n)}return(e,i)=>(L(),q(V(Vu),{open:t.value,"onUpdate:open":i[5]||=e=>t.value=e},{default:I(()=>[A(V(Uu),{"as-child":``},{default:I(()=>[A(V(ul),null,{default:I(()=>[A(V(pl),{"as-child":``},{default:I(()=>[A(V(X),{variant:`ghost`,size:`icon-sm`,class:`flex-none`,"aria-label":`More`},{default:I(()=>[A(V(Wl))]),_:1})]),_:1}),A(V(dl),null,{default:I(()=>[...i[6]||=[H(`More`,-1)]]),_:1})]),_:1})]),_:1}),A(V(Hu),{align:`end`,class:`grid w-64 gap-0.5 p-1`},{default:I(()=>[V(nd)?(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(wu),{"data-icon":`inline-start`}),i[7]||=H(`Retry`,-1)]),_:1}),A(V(X),{variant:`ghost`,size:`sm`,class:`justify-start`,onClick:i[1]||=e=>n(`/undo`)},{default:I(()=>[A(V(Iu),{"data-icon":`inline-start`}),i[8]||=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(_u),{"data-icon":`inline-start`}),i[9]||=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(Ql),{"data-icon":`inline-start`}),i[10]||=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(Au),{"data-icon":`inline-start`}),i[11]||=H(`Preview compression`,-1)]),_:1}),A(V(Bu),{class:`my-1`})],64)):F(``,!0),A(qte)]),_:1})]),_:1},8,[`open`]))}}),Yte=new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`});function Xte(e){return e.title||e.branch_name||(e.created_at?Yte.format(new Date(e.created_at)):`New chat`)}var Zte={class:`min-w-0 flex-1`},Qte=P({__name:`ChatSessionList`,setup(e){return(e,t)=>(L(),j(`div`,Zte,[A(V(Wu),{"model-value":V(nd),disabled:!V(td).length,"onUpdate:modelValue":t[0]||=e=>V(yd)(String(e))},{default:I(()=>[A(V(Ju),{size:`sm`,class:`w-full`,"aria-label":`Conversation`},{default:I(()=>[A(V(Yu),{placeholder:`No conversations yet`})]),_:1}),A(V(Gu),null,{default:I(()=>[A(V(Ku),null,{default:I(()=>[(L(!0),j(U,null,M(V(td),e=>(L(),q(V(qu),{key:e.session_id,value:e.session_id},{default:I(()=>[H(B(V(Xte)(e)),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`model-value`,`disabled`])]))}}),$te={class:`flex items-center gap-1 border-b px-3 pLine truncated
`))],64)):K(n.$slots,`default`,{},void 0,void 0,1)])],10,Fp))}}),Rp=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=ue();function r(e){let t=``;for(let n of e)if(n.type!==We){if(n.type===Ve)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(st),{as:`pre`,"data-slot":`code-block-content`,"data-wrap":e.wrap||void 0,"data-numbered":e.lineNumbers||void 0,dir:`ltr`,tabindex:`0`,style:Ye({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(st),{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(Lp,{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`]))}}),zp={"aria-live":`polite`,class:`sr-only`},Bp=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}=see({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(Dl),{key:0})):(L(),q(V(Vl),{key:1}))]),_:1},16,[`data-copied`,`as`,`as-child`,`variant`,`size`,`aria-label`,`class`]),R(`span`,zp,B(V(r)?`Copied`:``),1)],64))}}),Vp=P({__name:`CodeBlockToken`,props:{token:{}},setup(e){return(t,n)=>(L(),j(`span`,{style:Ye(e.token.htmlStyle),class:`text-(--shiki-light) dark:text-(--shiki-dark)`},B(e.token.content),5))}}),Hp=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function Up(e){return Wp(e)}function Wp(e){return Array.isArray(e)?Gp(e):e instanceof RegExp?e:typeof e==`object`?Kp(e):e}function Gp(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=Wp(e[n]);return t}function Kp(e){let t={};for(let n in e)t[n]=Wp(e[n]);return t}function qp(e,...t){return t.forEach(t=>{for(let n in t)e[n]=t[n]}),e}function Jp(e){let t=~e.lastIndexOf(`/`)||~e.lastIndexOf(`\\`);return t===0?e:~t===e.length-1?Jp(e.substring(0,e.length-1)):e.substr(~t+1)}var Yp=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,Xp=class{static hasCaptures(e){return e!==null&&(Yp.lastIndex=0,Yp.test(e))}static replaceCaptures(e,t,n){return e.replace(Yp,(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 Zp(e,t){return e<t?-1:+(e>t)}function Qp(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=Zp(e[r],t[r]);if(n!==0)return n}return 0}return n-r}function $p(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 em(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,`\\$&`)}var tm=class{constructor(e){this.fn=e}fn;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}},nm=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}_colorMap;_defaults;_root;static createFromRawTheme(e,t){return this.createFromParsedTheme(sm(e),t)}static createFromParsedTheme(e,t){return um(e,t)}_cachedMatchRoot=new tm(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=>im(e.parent,t.parentScopes));return n?new om(n.fontStyle,n.foreground,n.background):null}},rm=class e{constructor(e,t){this.parent=e,this.scopeName=t}parent;scopeName;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 im(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&&!am(e.scopeName,r);){if(i)return!1;e=e.parent} 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}},Qm=class{constructor(e,t){this.languageId=e,this.tokenType=t}languageId;tokenType},$m=class e{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,t){this._defaultAttributes=new Qm(e,8),this._embeddedLanguagesMatcher=new eh(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 Qm(0,0);_getBasicScopeAttributes=new tm(e=>new Qm(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/},eh=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])=>em(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 th=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}stack;stoppedEarly};function nh(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 th(i,!0);f()}return new th(i,!1);function f(){let o=ih(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===Rm){let o=i.getRule(e);a.produce(i,s[0].start),i=i.withContentNameScopesList(i.nameScopesList),lh(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 Km){let r=o;lh(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 qm){let r=o;lh(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(lh(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 qm&&s.push({rule:n,stack:t})}for(let c=s.pop();c;c=s.pop()){let{ruleScanner:s,findOptions:l}=ch(c.rule,e,c.stack.endRule,n,r===o),u=s.findNextMatchSync(t,r,l);if(u){if(u.ruleId!==zm){i=c.stack.pop();break}u.captureIndices&&u.captureIndices.length&&(a.produce(c.stack,u.captureIndices[0].start),lh(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 ih(e,t,n,r,i,a){let o=ah(e,t,n,r,i,a),s=e.getInjections();if(s.length===0)return o;let c=oh(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 ah(e,t,n,r,i,a){let{ruleScanner:o,findOptions:s}=sh(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 oh(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}=sh(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 sh(e,t,n,r,i){return{ruleScanner:e.compileAG(t,n,r,i),findOptions:0}}function ch(e,t,n,r,i){return{ruleScanner:e.compileWhileAG(t,n,r,i),findOptions:0}}function lh(e,t,n,r,i,a,o){if(a.length=== Line truncated
`;let a=this.createOnigString(e),o=a.content.length,s=new bh(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=nh(this,a,i,0,t,s,!0,r);return xm(a),{lineLength:o,lineTokens:s,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function gh(e,t){return e=Up(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 _h=class e{constructor(e,t,n){this.parent=e,this.scopePath=t,this.tokenAttributes=n}parent;scopePath;tokenAttributes;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),hm.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}},vh=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}parent;ruleId;beginRuleCapturedEOL;endRule;nameScopesList;contentNameScopesList;_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)?_h.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:Vm(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=_h.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new e(t,Bm(n.ruleId),n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,_h.fromExtension(r,n.contentNameScopesList))}},yh=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(e=>e===`*`?(this.allowAny=!0,[]):vm(e,ph).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>vm(e,ph).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}},bh=class Line truncated
`).find(e=>e.startsWith(`data: `));if(!t)continue;let n=JSON.parse(t.slice(6));if(n.session_id&&(ed.value=n.session_id),n.type===`delta`&&(o+=n.text,od.value=od.value?{...od.value,text:o}:null),(n.type===`tool`||n.type===`navigate`)&&(a=[...a,n],od.value=od.value?{...od.value,tools:a}:null),n.type===`ask`&&n.ask&&(clearTimeout(l),od.value=od.value?{...od.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`);td.value=!i&&n.trim()===`/new`?[]:[...td.value,{from:`assistant`,text:o,tool_calls:a}],od.value=null,rd.value=`Ready`,await gd()}catch(e){let t=e;o&&(td.value=[...td.value,{from:`assistant`,text:o,tool_calls:a}],a=[]),t.name===`AbortError`&&!c?(od.value={text:`Turn stopped.`,tools:a,isError:!1,turn:r,isRetry:i},rd.value=`Stopped`):(od.value={text:`Unable to complete that turn: ${t.message||t}`,tools:a,isError:!0,turn:r?Xu(r):void 0,isRetry:i},rd.value=`Error. Retry available.`)}finally{clearTimeout(l),Zu=null,md=null,id.value=!1,Sd.after?.()}}function Wte(){rd.value=`Stopping…`,ed.value&&Z.chatCancel(ed.value).catch(()=>{}),hd()}function Gte(){Fe(()=>{gd().catch(e=>{rd.value=e.message||`Chat unavailable`})}),Re(()=>{hd()})}async function Kte(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 Od({textOverride:`🎤 Voice message`,voice:{data:btoa(n),mime_type:e.type||`audio/webm`}})}var qte={class:`grid gap-1 p-1`},Jte={key:0,class:`text-xs text-fg-subtle`},kd=`__default__`,Yte=P({__name:`ChatSettings`,setup(e){let t=Y(()=>cd.value||kd),n=Y(()=>{let e=sd.value.models_by_provider||{},t=Object.entries(e).filter(([,e])=>e.length);return t.length?t:[[``,sd.value.models||[]]]});return(e,r)=>(L(),j(`div`,qte,[V(rd)===`Ready`?F(``,!0):(L(),j(`span`,Jte,B(V(rd)),1)),A(V(Hu),{"model-value":t.value,"onUpdate:modelValue":r[0]||=e=>V(xd)(e===kd?``:String(e??``))},{default:I(()=>[A(V(Ku),{size:`sm`,class:`w-full`,"aria-label":`Model`},{default:I(()=>[A(V(qu))]),_:1}),A(V(Uu),null,{default:I(()=>[A(V(Gu),{value:kd},{default:I(()=>[...r[1]||=[H(`Default`,-1)]]),_:1}),(L(!0),j(U,null,M(n.value,([e,t])=>(L(),q(V(Wu),{key:e},{default:I(()=>[e?(L(),q(V(wte),{key:0},{default:I(()=>[H(B(e),1)]),_:2},1024)):F(``,!0),(L(!0),j(U,null,M(t,e=>(L(),q(V(Gu),{key:e,value:e},{default:I(()=>[H(B(e),1)]),_:2},1032,[`value`]))),128))]),_:2},1024))),128))]),_:1})]),_:1},8,[`model-value`])]))}}),Xte=P({__name:`ChatSessionActions`,setup(e){let t=J(!1);Ite(t);function n(e){t.value=!1,bd(e)}function r(e,n){t.value=!1,zte(e,n)}return(e,i)=>(L(),q(V(zu),{open:t.value,"onUpdate:open":i[5]||=e=>t.value=e},{default:I(()=>[A(V(Vu),{"as-child":``},{default:I(()=>[A(V(ll),null,{default:I(()=>[A(V(fl),{"as-child":``},{default:I(()=>[A(V(X),{variant:`ghost`,size:`icon-sm`,class:`flex-none`,"aria-label":`More`},{default:I(()=>[A(V(Ul))]),_:1})]),_:1}),A(V(ul),null,{default:I(()=>[...i[6]||=[H(`More`,-1)]]),_:1})]),_:1})]),_:1}),A(V(Bu),{align:`end`,class:`grid w-64 gap-0.5 p-1`},{default:I(()=>[V(ed)?(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(Cu),{"data-icon":`inline-start`}),i[7]||=H(`Retry`,-1)]),_:1}),A(V(X),{variant:`ghost`,size:`sm`,class:`justify-start`,onClick:i[1]||=e=>n(`/undo`)},{default:I(()=>[A(V(Pu),{"data-icon":`inline-start`}),i[8]||=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(gu),{"data-icon":`inline-start`}),i[9]||=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(Zl),{"data-icon":`inline-start`}),i[10]||=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(ku),{"data-icon":`inline-start`}),i[11]||=H(`Preview compression`,-1)]),_:1}),A(V(Ru),{class:`my-1`})],64)):F(``,!0),A(Yte)]),_:1})]),_:1},8,[`open`]))}}),Zte=new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`});function Qte(e){return e.title||e.branch_name||(e.created_at?Zte.format(new Date(e.created_at)):`New chat`)}var $te={class:`min-w-0 flex-1`},ene=P({__name:`ChatSessionList`,setup(e){return(e,t)=>(L(),j(`div`,$te,[A(V(Hu),{"model-value":V(ed),disabled:!V($u).length,"onUpdate:modelValue":t[0]||=e=>V(_d)(String(e))},{default:I(()=>[A(V(Ku),{size:`sm`,class:`w-full`,"aria-label":`Conversation`},{default:I(()=>[A(V(qu),{placeholder:`No conversations yet`})]),_:1}),A(V(Uu),null,{default:I(()=>[A(V(Wu),null,{default:I(()=>[(L(!0),j(U,null,M(V($u),e=>(L(),q(V(Gu),{key:e.session_id,value:e.session_id},{default:I(()=>[H(B(V(Qte)(e)),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`model-value`,`disabled`])]))}}),tne={class:`flex items-center gap-1 border-b px-3 pLine truncated
`))],64)):K(n.$slots,`default`,{},void 0,void 0,1)])],10,Np))}}),Ip=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=ue();function r(e){let t=``;for(let n of e)if(n.type!==We){if(n.type===Ve)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(st),{as:`pre`,"data-slot":`code-block-content`,"data-wrap":e.wrap||void 0,"data-numbered":e.lineNumbers||void 0,dir:`ltr`,tabindex:`0`,style:Ye({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(st),{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(Fp,{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`]))}}),Lp={"aria-live":`polite`,class:`sr-only`},Rp=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}=see({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(El),{key:0})):(L(),q(V(Bl),{key:1}))]),_:1},16,[`data-copied`,`as`,`as-child`,`variant`,`size`,`aria-label`,`class`]),R(`span`,Lp,B(V(r)?`Copied`:``),1)],64))}}),zp=P({__name:`CodeBlockToken`,props:{token:{}},setup(e){return(t,n)=>(L(),j(`span`,{style:Ye(e.token.htmlStyle),class:`text-(--shiki-light) dark:text-(--shiki-dark)`},B(e.token.content),5))}}),Bp=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function Vp(e){return Hp(e)}function Hp(e){return Array.isArray(e)?Up(e):e instanceof RegExp?e:typeof e==`object`?Wp(e):e}function Up(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=Hp(e[n]);return t}function Wp(e){let t={};for(let n in e)t[n]=Hp(e[n]);return t}function Gp(e,...t){return t.forEach(t=>{for(let n in t)e[n]=t[n]}),e}function Kp(e){let t=~e.lastIndexOf(`/`)||~e.lastIndexOf(`\\`);return t===0?e:~t===e.length-1?Kp(e.substring(0,e.length-1)):e.substr(~t+1)}var qp=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,Jp=class{static hasCaptures(e){return e!==null&&(qp.lastIndex=0,qp.test(e))}static replaceCaptures(e,t,n){return e.replace(qp,(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 Yp(e,t){return e<t?-1:+(e>t)}function Xp(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=Yp(e[r],t[r]);if(n!==0)return n}return 0}return n-r}function Zp(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 Qp(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,`\\$&`)}var $p=class{constructor(e){this.fn=e}fn;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}},em=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}_colorMap;_defaults;_root;static createFromRawTheme(e,t){return this.createFromParsedTheme(am(e),t)}static createFromParsedTheme(e,t){return cm(e,t)}_cachedMatchRoot=new $p(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=>nm(e.parent,t.parentScopes));return n?new im(n.fontStyle,n.foreground,n.background):null}},tm=class e{constructor(e,t){this.parent=e,this.scopeName=t}parent;scopeName;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 nm(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&&!rm(e.scopeName,r);){if(i)return!1;e=e.parent} 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}},Xm=class{constructor(e,t){this.languageId=e,this.tokenType=t}languageId;tokenType},Zm=class e{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,t){this._defaultAttributes=new Xm(e,8),this._embeddedLanguagesMatcher=new Qm(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 Xm(0,0);_getBasicScopeAttributes=new $p(e=>new Xm(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/},Qm=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])=>Qp(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 $m=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}stack;stoppedEarly};function eh(e,t,n,r,i,a,o,s){let c=t.content.length,l=!1,u=-1;if(o){let o=th(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 $m(i,!0);f()}return new $m(i,!1);function f(){let o=nh(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===Im){let o=i.getRule(e);a.produce(i,s[0].start),i=i.withContentNameScopesList(i.nameScopesList),sh(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 Wm){let r=o;sh(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 Gm){let r=o;sh(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(sh(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 th(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 Gm&&s.push({rule:n,stack:t})}for(let c=s.pop();c;c=s.pop()){let{ruleScanner:s,findOptions:l}=oh(c.rule,e,c.stack.endRule,n,r===o),u=s.findNextMatchSync(t,r,l);if(u){if(u.ruleId!==Lm){i=c.stack.pop();break}u.captureIndices&&u.captureIndices.length&&(a.produce(c.stack,u.captureIndices[0].start),sh(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 nh(e,t,n,r,i,a){let o=rh(e,t,n,r,i,a),s=e.getInjections();if(s.length===0)return o;let c=ih(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 rh(e,t,n,r,i,a){let{ruleScanner:o,findOptions:s}=ah(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 ih(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}=ah(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 ah(e,t,n,r,i){return{ruleScanner:e.compileAG(t,n,r,i),findOptions:0}}function oh(e,t,n,r,i){return{ruleScanner:e.compileWhileAG(t,n,r,i),findOptions:0}}function sh(e,t,n,r,i,a,o){if(a.length=== Line truncated
`;let a=this.createOnigString(e),o=a.content.length,s=new vh(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=eh(this,a,i,0,t,s,!0,r);return ym(a),{lineLength:o,lineTokens:s,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function mh(e,t){return e=Vp(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 hh=class e{constructor(e,t,n){this.parent=e,this.scopePath=t,this.tokenAttributes=n}parent;scopePath;tokenAttributes;static fromExtension(t,n){let r=t,i=t?.scopePath??null;for(let t of n)i=tm.push(i,t.scopeNames),r=new e(r,i,t.encodedTokenAttributes);return r}static createRoot(t,n){return new e(null,new tm(null,t),n)}static createRootAndLookUpScopeName(t,n,r){let i=r.getMetadataForScope(t),a=new tm(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),pm.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}},gh=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}parent;ruleId;beginRuleCapturedEOL;endRule;nameScopesList;contentNameScopesList;_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)?hh.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:zm(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=hh.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new e(t,Rm(n.ruleId),n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,hh.fromExtension(r,n.contentNameScopesList))}},_h=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(e=>e===`*`?(this.allowAny=!0,[]):gm(e,dh).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>gm(e,dh).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}},vh=class Line truncated
\f\r &/=>`.split(``),`
\f\r "&'/=>\``.split(``)],[`\0
\f\r "&'/<=>`.split(``),`\0
@@ -14,10 +14,10 @@ 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,O as l,P 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 nv(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=Gg);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&&Y_(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&&N_(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=iv(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 iv(e,t,n){let r=Vg(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=h_(r.attribute,Object.assign({},e.settings.characterReferences,{subset:tv.name[i][a]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?S_:C_)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?c:(e.settings.preferUnquoted&&(s=h_(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:tv.unquoted[i][a]}))),s!==n&&(e.settings.quoteSmart&&x_(n,o)>x_(n,e.alternative)&&(o=e.alternative),s=o+h_(n,Object.assign({},e.settings.characterReferences,{subset:(o===`'`?tv.single:tv.double)[i][a],attribute:!0}))+o),c+(s&&`=`+s))}var av=[`<`,`&`];function ov(e,t,n,r){return n&&n.type===`element`&&(n.tagName===`script`||n.tagName===`style`)?e.value:h_(e.value,Object.assign({},r.settings.characterReferences,{subset:av}))}function sv(e,t,n,r){return r.settings.allowDangerousHtml?e.value:ov(e,t,n,r)}function cv(e,t,n,r){return r.all(e)}var lv=qg(`type`,{invalid:uv,unknown:dv,handlers:{comment:y_,doctype:b_,element:nv,raw:sv,root:cv,text:ov}});function uv(e){throw Error("Expected node, not `"+e+"`")}function dv(e){throw Error("Cannot compile unknown node `"+e.type+"`")}var fv={},pv={},mv=[];function hv(e,t){let n=t||fv,r=n.quote||`"`,i=r===`"`?`'`:`"`;if(r!==`"`&&r!==`'`)throw Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:gv,all:_v,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||dg,characterReferences:n.characterReferences||pv,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space===`svg`?Gg:Wg,quote:r,alternative:i}.one(Array.isArray(e)?{type:`root`,children:e}:e,void 0,void 0)}function gv(e,t,n){return lv(e,t,n,this)}function _v(e){let t=[],n=e&&e.children||mv,r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join(``)}var vv=/\s+/g;function yv(e,t){if(!t)return e;e.properties||={},e.properties.class||=[],typeof e.properties.class==`string`&&(e.properties.class=e.properties.class.split(vv)),Array.isArray(e.properties.class)||(e.properties.class=[]);let n=Array.isArray(t)?t:t.split(vv);for(let t of n)t&&!e.properties.class.includes(t)&&e.properties.class.push(t);return e}function bv(e){let t=Nh(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 xv=[`color`,`background-color`];function Sv(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 Cv(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 wv(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=Cv(n,e.offset),i=r;for(;i<n.length&&n[i]<t;)i++;if(r===i)return e;let a=n.slice(r,i);for(Line 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=Dv(a.htmlStyle||Ev(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&&qh(m,r),m}function ey(e){return e.map(e=>{let t=[],n=``,r;return e.forEach((i,a)=>{let o=!(i.fontStyle&&(i.fontStyle&lm.Underline||i.fontStyle&lm.Strikethrough));o&&Xv.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 ty(e){return e.map(e=>e.flatMap(e=>{if(Xv.test(e.content))return e;let t=e.content.match(Zv);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 ny(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=Dv(e.htmlStyle||Ev(e)),i=Dv(n.htmlStyle||Ev(n)),a=e.fontStyle&&(e.fontStyle&lm.Underline||e.fontStyle&lm.Strikethrough),o=n.fontStyle&&(n.fontStyle&lm.Underline||n.fontStyle&lm.Strikethrough);!a&&!o&&r===i?e.content+=n.content:t.push({...n})}return t})}var ry=hv;function iy(e,t,n){let r={meta:{},options:n,codeToHast:(t,n)=>Qv(e,t,n),codeToTokens:(t,n)=>Jv(e,t,n)},i=ry(Qv(e,t,n,r));for(let e of Mv(n))i=e.postprocess?.call(r,i,n)||i;return i}async function ay(e){let t=await Gh(e);return{getLastGrammarState:(...e)=>tg(t,...e),codeToTokensBase:(e,n)=>qv(t,e,n),codeToTokensWithThemes:(e,n)=>lg(t,e,n),codeToTokens:(e,n)=>Jv(t,e,n),codeToHast:(e,n)=>Qv(t,e,n),codeToHtml:(e,n)=>iy(t,e,n),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}var oy=4294967295;function sy(e){return!e.sticky&&!e.rawOptions?.strategy}function cy(e,t){return{index:e,captureIndices:t.map(e=>e==null?{start:oy,end:oy,length:0}:{start:e[0],end:e[1],length:e[1]-e[0]})}}var ly=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&&sy(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 cy(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:cy(a,s)}},uy=0;function dy(e){return{content:e,id:++uy}}function fy(e){if([...e].length!==1)throw Error(`Expected "${e}" to be a single code point`);return e.codePointAt(0)}function py(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}var my=new Set([`alnum`,`alpha`,`ascii`,`blank`,`cntrl`,`digit`,`graph`,`lower`,`print`,`punct`,`space`,`upper`,`word`,`xdigit`]),hy=String.raw;function gy(e,t){if(e==null)throw Error(t??`Value expected`);return e}var _y=hy`\[\^?`,vy=`c.? | C(?:-.?)?|${hy`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${hy`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${hy`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${hy`o\{[^\}]*\}?`}|${hy`\d{1,3}`}`,yy=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,by=new RegExp(hy`
\f\r "&'<=>\``.split(``)]],single:[[`&'`.split(``),`"&'\``.split(``)],[`\0&'`.split(``),`\0"&'\``.split(``)]],double:[[`"&`.split(``),`"&'\``.split(``)],[`\0"&`.split(``),`\0"&'\``.split(``)]]};function ev(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=Ug);let l=tv(r,e.properties),u=r.all(i.space===`html`&&e.tagName===`template`?e.content:e);return r.schema=i,u&&(o=!1),!l&&a&&q_(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&&j_(e,t,n)||s.push(`</`+e.tagName+`>`),s.join(``)}function tv(e,t){let n=[],r=-1,i;if(t){for(i in t)if(t[i]!==null&&t[i]!==void 0){let r=nv(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 nv(e,t,n){let r=zg(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=p_(r.attribute,Object.assign({},e.settings.characterReferences,{subset:$_.name[i][a]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?b_:x_)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?c:(e.settings.preferUnquoted&&(s=p_(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:$_.unquoted[i][a]}))),s!==n&&(e.settings.quoteSmart&&y_(n,o)>y_(n,e.alternative)&&(o=e.alternative),s=o+p_(n,Object.assign({},e.settings.characterReferences,{subset:(o===`'`?$_.single:$_.double)[i][a],attribute:!0}))+o),c+(s&&`=`+s))}var rv=[`<`,`&`];function iv(e,t,n,r){return n&&n.type===`element`&&(n.tagName===`script`||n.tagName===`style`)?e.value:p_(e.value,Object.assign({},r.settings.characterReferences,{subset:rv}))}function av(e,t,n,r){return r.settings.allowDangerousHtml?e.value:iv(e,t,n,r)}function ov(e,t,n,r){return r.all(e)}var sv=Gg(`type`,{invalid:cv,unknown:lv,handlers:{comment:__,doctype:v_,element:ev,raw:av,root:ov,text:iv}});function cv(e){throw Error("Expected node, not `"+e+"`")}function lv(e){throw Error("Cannot compile unknown node `"+e.type+"`")}var uv={},dv={},fv=[];function pv(e,t){let n=t||uv,r=n.quote||`"`,i=r===`"`?`'`:`"`;if(r!==`"`&&r!==`'`)throw Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:mv,all:hv,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||lg,characterReferences:n.characterReferences||dv,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space===`svg`?Ug:Hg,quote:r,alternative:i}.one(Array.isArray(e)?{type:`root`,children:e}:e,void 0,void 0)}function mv(e,t,n){return sv(e,t,n,this)}function hv(e){let t=[],n=e&&e.children||fv,r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join(``)}var gv=/\s+/g;function _v(e,t){if(!t)return e;e.properties||={},e.properties.class||=[],typeof e.properties.class==`string`&&(e.properties.class=e.properties.class.split(gv)),Array.isArray(e.properties.class)||(e.properties.class=[]);let n=Array.isArray(t)?t:t.split(gv);for(let t of n)t&&!e.properties.class.includes(t)&&e.properties.class.push(t);return e}function vv(e){let t=jh(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 yv=[`color`,`background-color`];function bv(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 xv(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 Sv(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=xv(n,e.offset),i=r;for(;i<n.length&&n[i]<t;)i++;if(r===i)return e;let a=n.slice(r,i);for(Line 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=Tv(a.htmlStyle||wv(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&&Gh(m,r),m}function Qv(e){return e.map(e=>{let t=[],n=``,r;return e.forEach((i,a)=>{let o=!(i.fontStyle&&(i.fontStyle&sm.Underline||i.fontStyle&sm.Strikethrough));o&&Jv.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 $v(e){return e.map(e=>e.flatMap(e=>{if(Jv.test(e.content))return e;let t=e.content.match(Yv);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 ey(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=Tv(e.htmlStyle||wv(e)),i=Tv(n.htmlStyle||wv(n)),a=e.fontStyle&&(e.fontStyle&sm.Underline||e.fontStyle&sm.Strikethrough),o=n.fontStyle&&(n.fontStyle&sm.Underline||n.fontStyle&sm.Strikethrough);!a&&!o&&r===i?e.content+=n.content:t.push({...n})}return t})}var ty=pv;function ny(e,t,n){let r={meta:{},options:n,codeToHast:(t,n)=>Xv(e,t,n),codeToTokens:(t,n)=>Kv(e,t,n)},i=ty(Xv(e,t,n,r));for(let e of Av(n))i=e.postprocess?.call(r,i,n)||i;return i}async function ry(e){let t=await Uh(e);return{getLastGrammarState:(...e)=>$h(t,...e),codeToTokensBase:(e,n)=>Gv(t,e,n),codeToTokensWithThemes:(e,n)=>sg(t,e,n),codeToTokens:(e,n)=>Kv(t,e,n),codeToHast:(e,n)=>Xv(t,e,n),codeToHtml:(e,n)=>ny(t,e,n),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}var iy=4294967295;function ay(e){return!e.sticky&&!e.rawOptions?.strategy}function oy(e,t){return{index:e,captureIndices:t.map(e=>e==null?{start:iy,end:iy,length:0}:{start:e[0],end:e[1],length:e[1]-e[0]})}}var sy=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&&ay(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 oy(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:oy(a,s)}},cy=0;function ly(e){return{content:e,id:++cy}}function uy(e){if([...e].length!==1)throw Error(`Expected "${e}" to be a single code point`);return e.codePointAt(0)}function dy(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}var fy=new Set([`alnum`,`alpha`,`ascii`,`blank`,`cntrl`,`digit`,`graph`,`lower`,`print`,`punct`,`space`,`upper`,`word`,`xdigit`]),py=String.raw;function my(e,t){if(e==null)throw Error(t??`Value expected`);return e}var hy=py`\[\^?`,gy=`c.? | C(?:-.?)?|${py`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${py`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${py`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${py`o\{[^\}]*\}?`}|${py`\d{1,3}`}`,_y=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,vy=new RegExp(py`
\\ (?:
${vy}
${gy}
| [gk]<[^>]*>?
| [gk]'[^']*'?
| .
@@ -34,20 +34,20 @@ 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,O as l,P a
)?
| \*[^\)]*\)?
)?
| (?:${yy.source})+
| ${_y}
| (?:${_y.source})+
| ${hy}
| .
`.replace(/\s+/g,``),`gsu`),xy=new RegExp(hy`
`.replace(/\s+/g,``),`gsu`),yy=new RegExp(py`
\\ (?:
${vy}
${gy}
| .
)
| \[:(?:\^?\p{Alpha}+|\^):\]
| ${_y}
| ${hy}
| &&
| .
`.replace(/\s+/g,``),`gsu`);function Sy(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=Qy(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(by.lastIndex=0;s=by.exec(e);){let t=Cy(a,e,s[0],by.lastIndex);t.tokens?o.push(...t.tokens):t.token&&o.push(t.token),t.lastIndex!==void 0&&(by.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`?eb(e,u):e).flat(),flags:r}}function Cy(e,t,n,r){let[i,a]=n;if(n===`[`||n===`[^`){let e=wy(t,n,r);return{tokens:e.tokens,lastIndex:e.lastIndex}}if(i===`\\`){if(`AbBGyYzZ`.includes(a))return{token:Oy(n,n)};if(/^\\g[<']/.test(n)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(n))throw Error(`Invalid group name "${n}"`);return{token:Hy(n)}}if(/^\\k[<']/.test(n)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(n))throw Error(`Invalid group name "${n}"`);return{token:ky(n)}}if(a===`K`)return{token:Iy(`keep`,n)};if(a===`N`||a===`R`)return{token:Fy(`newline`,n,{negate:a===`N`})};if(a===`O`)return{token:Fy(`any`,n)};if(a===`X`)return{token:Fy(`text_segment`,n)};let e=Ey(n,{inCharClass:!1});return Array.isArray(e)?{tokens:e}:{token:e}}if(i===`(`){if(a===`*`)return{token:qy(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:Ky(n,e)};if(e.pushModX(e.getCurrentModX()),e.numOpenGroups++,n===`(`&&!e.captureGroup||n===`(?:`)return{token:zy(`group`,n)};if(n===`(?>`)return{token:zy(`atomic`,n)};if(n===`(?=`||n===`(?!`||n===`(?<=`||n===`(?<!`)return{token:zy(n[2]===`<`?`lookbehind`:`lookahead`,n,{negate:n.endsWith(`!`)})};if(n===`(`&&e.captureGroup||n.startsWith(`(?<`)&&n.endsWith(`>`)||n.startsWith(`(?'`)&&n.endsWith(`'`))return{token:zy(`capturing`,n,{...n!==`(`&&{name:n.slice(3,-1)}})};if(n.startsWith(`(?~`)){if(n===`(?~|`)throw Error(`Unsupported absence function kind "${n}"`);return{token:zy(`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:Ry(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:Fy(`dot`,n)}:n===`^`||n===`$`?{token:Oy(e.singleline?{"^":hy`\A`,$:hy`\Z`}[n]:n,n)}:n===`|`?{token:Dy(n)}:yy.test(n)?{tokens:tb(n)}:{token:Ay(fy(n),n)}}function wy(e,t,n){let r=[Py(t[1]===`^`,t)],i=1,a;for(xy.lastIndex=n;a=xy.exec(e);){let e=a[0];if(e[0]===`[`&&e[1]!==`:`)i++,r.push(Py(e[1]===`^`,e));else if(e===`]`){if(r.at(-1).type===`CharacterClassOpen`)r.push(Ay(93,e));else if(i--,r.push(jy(e)),!i)break}else{let t=Ty(e);Array.isArray(t)?r.push(...t):r.push(t)}}return{tokens:r,lastIndex:xy.lastIndex||e.length}}function Ty(e){if(e[0]===`\\`)return Ey(e,{inCharClass:!0});if(e[0]===`[`){let t=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);if(!t||!my.has(t.groups.name))throw Error(`Invalid POSIX class "${e}"`);return Fy(`posix`,e,{value:t.groups.name,negate:!!t.groups.negate})}return e===`-`?My(e):e===`&&`?Ny(e):Ay(fy(e),e)}function Ey(e,{inCharClass:t}){let n=e[1];if(n===`c`||n===`C`)return Gy(e);if(`dDhHsSwW`.includes(n))return Yy(e);if(e.startsWith(hy`\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 Xy(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 Ay(fy(e),t)})}catch{throw Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`)}if(n===`u`||n===`x`)return Ay($y(e),e);if(Wy.has(n))return Ay(Wy.get(n),e);if(/\d/.test(n))return Ly(t,e);if(e===`\\`)throw Error(hy`Incomplete escape "\"`);if(n===`M`)throw Error(`Unsupported meta "${e}"`);if([...e].length===2)return Ay(e.codePointAt(1),e);throw Error(`Unexpected escape "${e}"`)}function Dy(e){return{type:`Alternator`,raw:e}}function Oy(e,t){return{type:`Assertion`,kind:e,raw:t}}function ky(e){return{type:`Backreference`,raw:e}}function Ay(e,t){return{type:`Character`,value:e,raw:t}}function jy(e){return{type:`CharacterClassClose`,raw:e}}function My(e){return{type:`CharacterClassHyphen`,raw:e}}function Ny(e){return{type:`CharacterClassIntersector`,raw:e}}function Py(e,t){return{type:`CharacterClassOpen`,negate:e,raw:t}}function Fy(e,t,n={}){return{type:`CharacterSet`,kind:e,...n,raw:t}}function Iy(e,t,n={}){return e===`keep`?{type:`Directive`,kind:e,raw:t}:{type:`Directive`,kind:e,flags:gy(n.flags),raw:t}}function Ly(e,t){return{type:`EscapedNumber`,inCharClass:e,raw:t}}function Ry(e){return{type:`GroupClose`,raw:e}}function zy(e,t,n={}){return{type:`GroupOpen`,kind:e,...n,raw:t}}function By(e,t,n,r){return{type:`NamedCallout`,kind:e,tag:t,arguments:n,raw:r}}function Vy(e,t,n,r){return{type:`Quantifier`,kind:e,min:t,max:n,raw:r}}function Hy(e){return{type:`Subroutine`,raw:e}}var Uy=new Set([`COUNT`,`CMP`,`ERROR`,`FAIL`,`MAX`,`MISMATCH`,`SKIP`,`TOTAL_COUNT`]),Wy=new Map([[`a`,7],[`b`,8],[`e`,27],[`f`,12],[`n`,10],[`r`,13],[`t`,9],[`v`,11]]);function Gy(e){let t=e[1]===`c`?e[2]:e[3];if(!t||!/[A-Za-z]/.test(t))throw Error(`Unsupported control character "${e}"`);return Ay(fy(t.toUpperCase())-64,e)}function Ky(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=Zy(n),o=Zy(r),s={};if(a&&(s.enable=a),o&&(s.disable=o),e.endsWith(`)`))return t.replaceCurrentModX(i),Iy(`flags`,e,{flags:s});if(e.endsWith(`:`))return t.pushModX(i),t.numOpenGroups++,zy(`group`,e,{...(a||o)&&{flags:s}});throw Error(`Unexpected flag modifier "${e}"`)}function qy(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=Uy.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 by(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=Xy(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(vy.lastIndex=0;s=vy.exec(e);){let t=xy(a,e,s[0],vy.lastIndex);t.tokens?o.push(...t.tokens):t.token&&o.push(t.token),t.lastIndex!==void 0&&(vy.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`?Qy(e,u):e).flat(),flags:r}}function xy(e,t,n,r){let[i,a]=n;if(n===`[`||n===`[^`){let e=Sy(t,n,r);return{tokens:e.tokens,lastIndex:e.lastIndex}}if(i===`\\`){if(`AbBGyYzZ`.includes(a))return{token:Ey(n,n)};if(/^\\g[<']/.test(n)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(n))throw Error(`Invalid group name "${n}"`);return{token:By(n)}}if(/^\\k[<']/.test(n)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(n))throw Error(`Invalid group name "${n}"`);return{token:Dy(n)}}if(a===`K`)return{token:Py(`keep`,n)};if(a===`N`||a===`R`)return{token:Ny(`newline`,n,{negate:a===`N`})};if(a===`O`)return{token:Ny(`any`,n)};if(a===`X`)return{token:Ny(`text_segment`,n)};let e=wy(n,{inCharClass:!1});return Array.isArray(e)?{tokens:e}:{token:e}}if(i===`(`){if(a===`*`)return{token:Gy(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:Wy(n,e)};if(e.pushModX(e.getCurrentModX()),e.numOpenGroups++,n===`(`&&!e.captureGroup||n===`(?:`)return{token:Ly(`group`,n)};if(n===`(?>`)return{token:Ly(`atomic`,n)};if(n===`(?=`||n===`(?!`||n===`(?<=`||n===`(?<!`)return{token:Ly(n[2]===`<`?`lookbehind`:`lookahead`,n,{negate:n.endsWith(`!`)})};if(n===`(`&&e.captureGroup||n.startsWith(`(?<`)&&n.endsWith(`>`)||n.startsWith(`(?'`)&&n.endsWith(`'`))return{token:Ly(`capturing`,n,{...n!==`(`&&{name:n.slice(3,-1)}})};if(n.startsWith(`(?~`)){if(n===`(?~|`)throw Error(`Unsupported absence function kind "${n}"`);return{token:Ly(`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:Iy(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:Ny(`dot`,n)}:n===`^`||n===`$`?{token:Ey(e.singleline?{"^":py`\A`,$:py`\Z`}[n]:n,n)}:n===`|`?{token:Ty(n)}:_y.test(n)?{tokens:$y(n)}:{token:Oy(uy(n),n)}}function Sy(e,t,n){let r=[My(t[1]===`^`,t)],i=1,a;for(yy.lastIndex=n;a=yy.exec(e);){let e=a[0];if(e[0]===`[`&&e[1]!==`:`)i++,r.push(My(e[1]===`^`,e));else if(e===`]`){if(r.at(-1).type===`CharacterClassOpen`)r.push(Oy(93,e));else if(i--,r.push(ky(e)),!i)break}else{let t=Cy(e);Array.isArray(t)?r.push(...t):r.push(t)}}return{tokens:r,lastIndex:yy.lastIndex||e.length}}function Cy(e){if(e[0]===`\\`)return wy(e,{inCharClass:!0});if(e[0]===`[`){let t=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);if(!t||!fy.has(t.groups.name))throw Error(`Invalid POSIX class "${e}"`);return Ny(`posix`,e,{value:t.groups.name,negate:!!t.groups.negate})}return e===`-`?Ay(e):e===`&&`?jy(e):Oy(uy(e),e)}function wy(e,{inCharClass:t}){let n=e[1];if(n===`c`||n===`C`)return Uy(e);if(`dDhHsSwW`.includes(n))return qy(e);if(e.startsWith(py`\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 Jy(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 Oy(uy(e),t)})}catch{throw Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`)}if(n===`u`||n===`x`)return Oy(Zy(e),e);if(Hy.has(n))return Oy(Hy.get(n),e);if(/\d/.test(n))return Fy(t,e);if(e===`\\`)throw Error(py`Incomplete escape "\"`);if(n===`M`)throw Error(`Unsupported meta "${e}"`);if([...e].length===2)return Oy(e.codePointAt(1),e);throw Error(`Unexpected escape "${e}"`)}function Ty(e){return{type:`Alternator`,raw:e}}function Ey(e,t){return{type:`Assertion`,kind:e,raw:t}}function Dy(e){return{type:`Backreference`,raw:e}}function Oy(e,t){return{type:`Character`,value:e,raw:t}}function ky(e){return{type:`CharacterClassClose`,raw:e}}function Ay(e){return{type:`CharacterClassHyphen`,raw:e}}function jy(e){return{type:`CharacterClassIntersector`,raw:e}}function My(e,t){return{type:`CharacterClassOpen`,negate:e,raw:t}}function Ny(e,t,n={}){return{type:`CharacterSet`,kind:e,...n,raw:t}}function Py(e,t,n={}){return e===`keep`?{type:`Directive`,kind:e,raw:t}:{type:`Directive`,kind:e,flags:my(n.flags),raw:t}}function Fy(e,t){return{type:`EscapedNumber`,inCharClass:e,raw:t}}function Iy(e){return{type:`GroupClose`,raw:e}}function Ly(e,t,n={}){return{type:`GroupOpen`,kind:e,...n,raw:t}}function Ry(e,t,n,r){return{type:`NamedCallout`,kind:e,tag:t,arguments:n,raw:r}}function zy(e,t,n,r){return{type:`Quantifier`,kind:e,min:t,max:n,raw:r}}function By(e){return{type:`Subroutine`,raw:e}}var Vy=new Set([`COUNT`,`CMP`,`ERROR`,`FAIL`,`MAX`,`MISMATCH`,`SKIP`,`TOTAL_COUNT`]),Hy=new Map([[`a`,7],[`b`,8],[`e`,27],[`f`,12],[`n`,10],[`r`,13],[`t`,9],[`v`,11]]);function Uy(e){let t=e[1]===`c`?e[2]:e[3];if(!t||!/[A-Za-z]/.test(t))throw Error(`Unsupported control character "${e}"`);return Oy(uy(t.toUpperCase())-64,e)}function Wy(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=Yy(n),o=Yy(r),s={};if(a&&(s.enable=a),o&&(s.disable=o),e.endsWith(`)`))return t.replaceCurrentModX(i),Py(`flags`,e,{flags:s});if(e.endsWith(`:`))return t.pushModX(i),t.numOpenGroups++,Ly(`group`,e,{...(a||o)&&{flags:s}});throw Error(`Unexpected flag modifier "${e}"`)}function Gy(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=Vy.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,C as t,D as n,E as r,F as i,I as a,L as o,M as s,N as c,O as l,P a
| [A-Za-z\-]+:
| \(DEFINE\)
))?
| (?<qBase>${rx})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
| (?<qBase>${tx})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
| \\?.
`.replace(/\s+/g,``),`gsu`);function ax(e){if(!RegExp(`${rx}\\+`).test(e))return{pattern:e};let t=[],n=null,r=null,i=``,a=0,o;for(ix.lastIndex=0;o=ix.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=Jb(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}ix.lastIndex+=t}else s[0]===`(`?t.push(c):s===`)`&&(n=t.length?t.pop():null)}i=s}return{pattern:e}}var ox=String.raw,sx=ox`\(\?R=(?<rDepth>[^\)]+)\)|${ox`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`}`,cx=ox`\(\?<(?![=!])(?<captureName>[^>]+)>`,lx=ox`${cx}|(?<unnamed>\()(?!\?)`,ux=new RegExp(ox`${cx}|${sx}|\(\?|\\?.`,`gsu`),dx=`Cannot use multiple overlapping recursions`;function fx(e,t){let{hiddenCaptures:n,mode:r}={hiddenCaptures:[],mode:`plugin`,...t},i=t?.captureTransfers??new Map;if(!new RegExp(sx,`su`).test(e))return{pattern:e,captureTransfers:i,hiddenCaptures:n};if(r===`plugin`&&$b(e,ox`\(\?\(DEFINE\)`,Yb.DEFAULT))throw Error(`DEFINE groups cannot be used with recursion`);let a=[],o=$b(e,ox`\\[1-9]`,Yb.DEFAULT),s=new Map,c=[],l=!1,u=0,d=0,f;for(ux.lastIndex=0;f=ux.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(px(m),l)throw Error(dx);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(ux.lastIndex);if($b(s,sx,Yb.DEFAULT))throw Error(dx);let c=m-1;e=mx(t,s,c,!1,n,a,d),i=_x(i,t,c,a.length,0,d);break}if(h){px(g);let u=!1;for(let e of c)if(e.name===h||e.num===+h){if(u=!0,e.hasRecursedWithin)throw Error(dx);break}if(!u)throw Error(ox`Recursive \g cannot be used outside the referenced group "${r===`external`?h:ox`\g<${h}&R=${g}>`}"`);let p=s.get(h),m=ex(e,p);if(o&&$b(m,ox`${cx}|\((?!\?)`,Yb.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=mx(_,v,b,!0,n,a,d);i=_x(i,_,b,a.length-y,y,d),e=`${e.slice(0,p)}${x}${e.slice(p+m.length)}`,ux.lastIndex+=x.length-t.length-_.length-v.length,c.forEach(e=>e.hasRecursedWithin=!0),l=!0}else if(p)d++,s.set(String(d),ux.lastIndex),s.set(p,ux.lastIndex),c.push({num:d,name:p});else if(t[0]===`(`){let e=t===`(`;e&&(d++,s.set(String(d),ux.lastIndex)),c.push(e?{num:d}:{})}else t===`)`&&c.pop()}}return n.push(...a),{pattern:e,captureTransfers:i,hiddenCaptures:n}}function px(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 mx(e,t,n,r,i,a,o){let s=new Set;r&&Zb(e+t,cx,({groups:{captureName:e}})=>{s.add(e)},Yb.DEFAULT);let c=[n,r?s:null,i,a,o];return`${e}${hx(`(?:${e}`,`forward`,...c)}(?:)${hx(`${t})`,`backward`,...c)}${t}`}function hx(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+=Xb(e,ox`${lx}|\\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),gx(i,n),s?e:`(?<${t}${l}>`}return ox`\k<${c}${l}>`},Yb.DEFAULT)}return c}function gx(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function _x(e,t,n,r,i,a){if(e.size&&r){let o=0;Zb(t,lx,()=>o++,Yb.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 vx=String.fromCodePoint,yx=String.raw,bx={},xx=globalThis.RegExp;bx.flagGroups=(()=>{try{new xx(`(?i:)`)}catch{return!1}return!0})(),bx.unicodeSets=(()=>{try{new xx(`[[]]`,`v`)}catch{return!1}return!0})(),bx.bugFlagVLiteralHyphenIsRange=bx.unicodeSets?(()=>{try{new xx(yx`[\d\-a]`,`v`)}catch{return!0}return!1})():!1,bx.bugNestedClassIgnoresNegation=bx.unicodeSets&&new xx(`[[^a]]`,`v`).test(`a`);function Sx(e,{enable:t,disable:n}){return{dotAll:!n?.dotAll&&!!(t?.dotAll||e.dotAll),ignoreCase:!n?.ignoreCase&&!!(t?.ignoreCase||e.ignoreCase)}}function Cx(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}function wx(e,t){return Ex[e]>=Ex[t]}function Tx(e,t){if(e==null)throw Error(t??`Value expected`);return e}var Ex={ES2025:2025,ES2024:2024,ES2018:2018},Dx={auto:`auto`,ES2025:`ES2025`,ES2024:`ES2024`,ES2018:`ES2018`};function Ox(e={}){if({}.toString.call(e)!==`[object Object]`)throw Error(`Unexpected options`);if(e.target!==void 0&&!Dx[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 rx(e){if(!RegExp(`${tx}\\+`).test(e))return{pattern:e};let t=[],n=null,r=null,i=``,a=0,o;for(nx.lastIndex=0;o=nx.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=Kb(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}nx.lastIndex+=t}else s[0]===`(`?t.push(c):s===`)`&&(n=t.length?t.pop():null)}i=s}return{pattern:e}}var ix=String.raw,ax=ix`\(\?R=(?<rDepth>[^\)]+)\)|${ix`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`}`,ox=ix`\(\?<(?![=!])(?<captureName>[^>]+)>`,sx=ix`${ox}|(?<unnamed>\()(?!\?)`,cx=new RegExp(ix`${ox}|${ax}|\(\?|\\?.`,`gsu`),lx=`Cannot use multiple overlapping recursions`;function ux(e,t){let{hiddenCaptures:n,mode:r}={hiddenCaptures:[],mode:`plugin`,...t},i=t?.captureTransfers??new Map;if(!new RegExp(ax,`su`).test(e))return{pattern:e,captureTransfers:i,hiddenCaptures:n};if(r===`plugin`&&Zb(e,ix`\(\?\(DEFINE\)`,qb.DEFAULT))throw Error(`DEFINE groups cannot be used with recursion`);let a=[],o=Zb(e,ix`\\[1-9]`,qb.DEFAULT),s=new Map,c=[],l=!1,u=0,d=0,f;for(cx.lastIndex=0;f=cx.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(dx(m),l)throw Error(lx);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(cx.lastIndex);if(Zb(s,ax,qb.DEFAULT))throw Error(lx);let c=m-1;e=fx(t,s,c,!1,n,a,d),i=hx(i,t,c,a.length,0,d);break}if(h){dx(g);let u=!1;for(let e of c)if(e.name===h||e.num===+h){if(u=!0,e.hasRecursedWithin)throw Error(lx);break}if(!u)throw Error(ix`Recursive \g cannot be used outside the referenced group "${r===`external`?h:ix`\g<${h}&R=${g}>`}"`);let p=s.get(h),m=Qb(e,p);if(o&&Zb(m,ix`${ox}|\((?!\?)`,qb.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=fx(_,v,b,!0,n,a,d);i=hx(i,_,b,a.length-y,y,d),e=`${e.slice(0,p)}${x}${e.slice(p+m.length)}`,cx.lastIndex+=x.length-t.length-_.length-v.length,c.forEach(e=>e.hasRecursedWithin=!0),l=!0}else if(p)d++,s.set(String(d),cx.lastIndex),s.set(p,cx.lastIndex),c.push({num:d,name:p});else if(t[0]===`(`){let e=t===`(`;e&&(d++,s.set(String(d),cx.lastIndex)),c.push(e?{num:d}:{})}else t===`)`&&c.pop()}}return n.push(...a),{pattern:e,captureTransfers:i,hiddenCaptures:n}}function dx(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 fx(e,t,n,r,i,a,o){let s=new Set;r&&Yb(e+t,ox,({groups:{captureName:e}})=>{s.add(e)},qb.DEFAULT);let c=[n,r?s:null,i,a,o];return`${e}${px(`(?:${e}`,`forward`,...c)}(?:)${px(`${t})`,`backward`,...c)}${t}`}function px(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+=Jb(e,ix`${sx}|\\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),mx(i,n),s?e:`(?<${t}${l}>`}return ix`\k<${c}${l}>`},qb.DEFAULT)}return c}function mx(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function hx(e,t,n,r,i,a){if(e.size&&r){let o=0;Yb(t,sx,()=>o++,qb.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 gx=String.fromCodePoint,_x=String.raw,vx={},yx=globalThis.RegExp;vx.flagGroups=(()=>{try{new yx(`(?i:)`)}catch{return!1}return!0})(),vx.unicodeSets=(()=>{try{new yx(`[[]]`,`v`)}catch{return!1}return!0})(),vx.bugFlagVLiteralHyphenIsRange=vx.unicodeSets?(()=>{try{new yx(_x`[\d\-a]`,`v`)}catch{return!0}return!1})():!1,vx.bugNestedClassIgnoresNegation=vx.unicodeSets&&new yx(`[[^a]]`,`v`).test(`a`);function bx(e,{enable:t,disable:n}){return{dotAll:!n?.dotAll&&!!(t?.dotAll||e.dotAll),ignoreCase:!n?.ignoreCase&&!!(t?.ignoreCase||e.ignoreCase)}}function xx(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}function Sx(e,t){return wx[e]>=wx[t]}function Cx(e,t){if(e==null)throw Error(t??`Value expected`);return e}var wx={ES2025:2025,ES2024:2024,ES2018:2018},Tx={auto:`auto`,ES2025:`ES2025`,ES2024:`ES2024`,ES2018:`ES2018`};function Ex(e={}){if({}.toString.call(e)!==`[object Object]`)throw Error(`Unexpected options`);if(e.target!==void 0&&!Tx[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=>[Bb(e),e])),Px=new Map([[`s`,vx(383)],[vx(383),`s`]]),Fx=new Map([[vx(223),vx(7838)],[vx(107),vx(8490)],[vx(229),vx(8491)],[vx(969),vx(8486)]]),Ix=new Map([zx(453),zx(456),zx(459),zx(498),...Bx(8072,8079),...Bx(8088,8095),...Bx(8104,8111),zx(8124),zx(8140),zx(8188)]),Lx=new Map([[`alnum`,yx`[\p{Alpha}\p{Nd}]`],[`alpha`,yx`\p{Alpha}`],[`ascii`,yx`\p{ASCII}`],[`blank`,yx`[\p{Zs}\t]`],[`cntrl`,yx`\p{Cc}`],[`digit`,yx`\p{Nd}`],[`graph`,yx`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],[`lower`,yx`\p{Lower}`],[`print`,yx`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],[`punct`,yx`[\p{P}\p{S}]`],[`space`,yx`\p{space}`],[`upper`,yx`\p{Upper}`],[`word`,yx`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],[`xdigit`,yx`\p{AHex}`]]);function Rx(e,t){let n=[];for(let r=e;r<=t;r++)n.push(r);return n}function zx(e){let t=vx(e);return[t.toLowerCase(),t]}function Bx(e,t){return Rx(e,t).map(e=>zx(e))}var Vx=new Set([`Lower`,`Lowercase`,`Upper`,`Uppercase`,`Ll`,`Lowercase_Letter`,`Lt`,`Titlecase_Letter`,`Lu`,`Uppercase_Letter`]);function Hx(e,t){let n={accuracy:`default`,asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:`ES2025`,...t};Kx(e);let r={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:wx(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};Ub(e,Ux,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 Ub(e,Wx,a),Ub(e,Gx,{groupsByName:a.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:a.reffedNodesByReferencer}),e._originMap=a.groupOriginByCopy,e._strategy=r.strategy,e}var Ux={AbsenceFunction({node:e,parent:t,replaceWith:n}){let{body:r,kind:i}=e;if(i===`repeater`){let e=Tb();e.body[0].body.push(Eb({negate:!0,body:r}),Mb(`Any`));let i=Tb();i.body[0].body.push(kb(`greedy`,0,1/0,e)),n(dS(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];Cx(r,n,[]).push(...i)}},exit({node:e},{flagDirectivesByAlt:t}){if(t.get(e)?.length){let n=$x(t.get(e));if(n){let t=Tb({flags:n});t.body[0].body=e.body,e.body=[dS(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(dS(Eb({body:[hb({body:[gb(`string_end`)]}),hb({body:[yb(10)]})]}),t));else if(c===`line_start`)o(dS(cS(yx`(?<=\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&&aS(e))o(dS(Eb({negate:!0}),t));else if(d)throw Error(yx`Uses "\G" in a way that requires a subclass`);else o(uS(gb(`string_start`),t)),s.strategy=`clip_search`}}else if(c!==`string_end`&&c!==`string_start`){if(c===`string_end_newline`)o(dS(cS(yx`(?=\n?\z)`),t));else if(c===`word_boundary`){if(!p&&!u){let e=`(?:(?<=${jx})(?!${jx})|(?<!${jx})(?=${jx}))`,n=`(?:(?<=${jx})(?=${jx})|(?<!${jx})(?!${jx}))`;o(dS(cS(l?n:e),t))}}else throw Error(`Unexpected assertion kind "${c}"`)}},Backreference({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n==`string`&&!sS(n)&&(n=Qx(n,t),e.ref=n)},CapturingGroup({node:e},{jsGroupNameMap:t,subroutineRefMap:n}){let{name:r}=e;r&&!sS(r)&&(r=Qx(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(dS(bb({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(uS(Sb(`digit`,{negate:l}),t));else if(o&&(c===`space`||u===`space`))n(dS(lS(cS(kx),l),t));else if(s&&(c===`word`||u===`word`))n(uS(Sb(`word`,{negate:l}),t));else if(c===`any`)n(uS(Mb(`Any`),t));else if(c===`digit`)n(uS(Mb(`Nd`,{negate:l}),t));else if(c!==`dot`){if(c===`text_segment`){if(r===`strict`)throw Error(yx`Use of "\X" requires non-strict accuracy`);let e=`\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?`,a=yx`\p{RI}{2}|${e}(?:\u200D${e})*`;n(dS(cS(yx`(?>\r\n|${i?yx`\p{RGI_Emoji}`:a}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),t))}else if(c===`hex`)n(uS(Mb(`AHex`,{negate:l}),t));else if(c===`newline`)n(dS(cS(l?`[^
XID_Start XIDS`.split(/\s/).map(e=>[Rb(e),e])),Mx=new Map([[`s`,gx(383)],[gx(383),`s`]]),Nx=new Map([[gx(223),gx(7838)],[gx(107),gx(8490)],[gx(229),gx(8491)],[gx(969),gx(8486)]]),Px=new Map([Lx(453),Lx(456),Lx(459),Lx(498),...Rx(8072,8079),...Rx(8088,8095),...Rx(8104,8111),Lx(8124),Lx(8140),Lx(8188)]),Fx=new Map([[`alnum`,_x`[\p{Alpha}\p{Nd}]`],[`alpha`,_x`\p{Alpha}`],[`ascii`,_x`\p{ASCII}`],[`blank`,_x`[\p{Zs}\t]`],[`cntrl`,_x`\p{Cc}`],[`digit`,_x`\p{Nd}`],[`graph`,_x`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],[`lower`,_x`\p{Lower}`],[`print`,_x`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],[`punct`,_x`[\p{P}\p{S}]`],[`space`,_x`\p{space}`],[`upper`,_x`\p{Upper}`],[`word`,_x`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],[`xdigit`,_x`\p{AHex}`]]);function Ix(e,t){let n=[];for(let r=e;r<=t;r++)n.push(r);return n}function Lx(e){let t=gx(e);return[t.toLowerCase(),t]}function Rx(e,t){return Ix(e,t).map(e=>Lx(e))}var zx=new Set([`Lower`,`Lowercase`,`Upper`,`Uppercase`,`Ll`,`Lowercase_Letter`,`Lt`,`Titlecase_Letter`,`Lu`,`Uppercase_Letter`]);function Bx(e,t){let n={accuracy:`default`,asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:`ES2025`,...t};Wx(e);let r={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:Sx(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};Vb(e,Vx,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 Vb(e,Hx,a),Vb(e,Ux,{groupsByName:a.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:a.reffedNodesByReferencer}),e._originMap=a.groupOriginByCopy,e._strategy=r.strategy,e}var Vx={AbsenceFunction({node:e,parent:t,replaceWith:n}){let{body:r,kind:i}=e;if(i===`repeater`){let e=Cb();e.body[0].body.push(wb({negate:!0,body:r}),Ab(`Any`));let i=Cb();i.body[0].body.push(Db(`greedy`,0,1/0,e)),n(lS(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];xx(r,n,[]).push(...i)}},exit({node:e},{flagDirectivesByAlt:t}){if(t.get(e)?.length){let n=Zx(t.get(e));if(n){let t=Cb({flags:n});t.body[0].body=e.body,e.body=[lS(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(lS(wb({body:[pb({body:[mb(`string_end`)]}),pb({body:[_b(10)]})]}),t));else if(c===`line_start`)o(lS(oS(_x`(?<=\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&&rS(e))o(lS(wb({negate:!0}),t));else if(d)throw Error(_x`Uses "\G" in a way that requires a subclass`);else o(cS(mb(`string_start`),t)),s.strategy=`clip_search`}}else if(c!==`string_end`&&c!==`string_start`){if(c===`string_end_newline`)o(lS(oS(_x`(?=\n?\z)`),t));else if(c===`word_boundary`){if(!p&&!u){let e=`(?:(?<=${kx})(?!${kx})|(?<!${kx})(?=${kx}))`,n=`(?:(?<=${kx})(?=${kx})|(?<!${kx})(?!${kx}))`;o(lS(oS(l?n:e),t))}}else throw Error(`Unexpected assertion kind "${c}"`)}},Backreference({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n==`string`&&!aS(n)&&(n=Xx(n,t),e.ref=n)},CapturingGroup({node:e},{jsGroupNameMap:t,subroutineRefMap:n}){let{name:r}=e;r&&!aS(r)&&(r=Xx(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(lS(vb({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(cS(bb(`digit`,{negate:l}),t));else if(o&&(c===`space`||u===`space`))n(lS(sS(oS(Dx),l),t));else if(s&&(c===`word`||u===`word`))n(cS(bb(`word`,{negate:l}),t));else if(c===`any`)n(cS(Ab(`Any`),t));else if(c===`digit`)n(cS(Ab(`Nd`,{negate:l}),t));else if(c!==`dot`){if(c===`text_segment`){if(r===`strict`)throw Error(_x`Use of "\X" requires non-strict accuracy`);let e=`\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?`,a=_x`\p{RI}{2}|${e}(?:\u200D${e})*`;n(lS(oS(_x`(?>\r\n|${i?_x`\p{RGI_Emoji}`:a}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),t))}else if(c===`hex`)n(cS(Ab(`AHex`,{negate:l}),t));else if(c===`newline`)n(lS(oS(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-${vx(e.codePointAt(0)-1)}${vx(e.codePointAt(2)+1)}-\u{10FFFF}`),n(dS(cS(`[${e}]`),t))}else n(dS(lS(cS(Lx.get(u)),l),t))}else if(c===`property`)Nx.has(Bb(u))||(e.key=`sc`);else if(c===`space`)n(uS(Mb(`space`,{negate:l}),t));else if(c===`word`)n(dS(lS(cS(jx),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=Tb({flags:c});e.body[0].body=o(),i(dS(e,t),{traverse:!0})}}else if(s===`keep`){let e=n.body[0],r=n.body.length===1&&nb(e,{type:`Group`})&&e.body[0].body.length===1?e.body[0]:n;if(t.parent!==r||r.body.length>1)throw Error(yx`Uses "\K" in a way that's unsupported`);let o=Eb({behind:!0});o.body[0].body=a(),i(dS(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(dS(Eb({negate:!0}),t));else throw Error(`Unsupported named callout "(*${r.toUpperCase()}"`)},Quantifier({node:e}){if(e.body.type===`Quantifier`){let t=Tb();t.body[0].body.push(e.body),e.body=dS(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=nS(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(yx`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n==`string`&&!sS(n)&&(n=Qx(n,t),e.ref=n)}},Wx={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=uS(Xx(e.number),t);c.set(r,s.get(e.number)),n(r);return}s.set(e.number,e),o.set(e.number,[]),e.name&&Cx(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=Cx(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=Sx(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?Xx(0):Yx(o,r.groupOriginByCopy,null),l=c;if(!s){let e=$x(Zx(o,e=>e.type===`Group`&&!!e.flags)),t=e?Sx(r.globalFlags,e):r.globalFlags;qx(t,r.currentFlags)||(l=Tb({flags:eS(t)}),l.body[0].body.push(c))}n(dS(l,t),{traverse:!s})}},Gx={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=>Jx(t,e));i.length?i.length>1?n(dS(Tb({atomic:!0,body:i.reverse().map(e=>hb({body:[_b(e.number)]}))}),t)):e.ref=i[0].number:n(dS(Eb({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=vb();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 YS(e,t){let n=et(null);N(()=>Be(t),(e,t,r)=>{if(typeof window>`u`)return;let i=!1;r(()=>i=!0),n.value=null,JS(e).then(e=>{i||(n.value=e)}).catch(()=>{})},{immediate:!0});let r={highlighter:null,text:``,lines:[]};return Y(()=>{let t=Be(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-${gx(e.codePointAt(0)-1)}${gx(e.codePointAt(2)+1)}-\u{10FFFF}`),n(lS(oS(`[${e}]`),t))}else n(lS(sS(oS(Fx.get(u)),l),t))}else if(c===`property`)jx.has(Rb(u))||(e.key=`sc`);else if(c===`space`)n(cS(Ab(`space`,{negate:l}),t));else if(c===`word`)n(lS(sS(oS(kx),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=Cb({flags:c});e.body[0].body=o(),i(lS(e,t),{traverse:!0})}}else if(s===`keep`){let e=n.body[0],r=n.body.length===1&&eb(e,{type:`Group`})&&e.body[0].body.length===1?e.body[0]:n;if(t.parent!==r||r.body.length>1)throw Error(_x`Uses "\K" in a way that's unsupported`);let o=wb({behind:!0});o.body[0].body=a(),i(lS(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(lS(wb({negate:!0}),t));else throw Error(`Unsupported named callout "(*${r.toUpperCase()}"`)},Quantifier({node:e}){if(e.body.type===`Quantifier`){let t=Cb();t.body[0].body.push(e.body),e.body=lS(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=eS(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(_x`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n==`string`&&!aS(n)&&(n=Xx(n,t),e.ref=n)}},Hx={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=cS(Jx(e.number),t);c.set(r,s.get(e.number)),n(r);return}s.set(e.number,e),o.set(e.number,[]),e.name&&xx(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=xx(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=bx(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?Jx(0):qx(o,r.groupOriginByCopy,null),l=c;if(!s){let e=Zx(Yx(o,e=>e.type===`Group`&&!!e.flags)),t=e?bx(r.globalFlags,e):r.globalFlags;Gx(t,r.currentFlags)||(l=Cb({flags:Qx(t)}),l.body[0].body.push(c))}n(lS(l,t),{traverse:!s})}},Ux={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=>Kx(t,e));i.length?i.length>1?n(lS(Cb({atomic:!0,body:i.reverse().map(e=>pb({body:[hb(e.number)]}))}),t)):e.ref=i[0].number:n(lS(wb({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=gb();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 qS(e,t){let n=et(null);N(()=>Be(t),(e,t,r)=>{if(typeof window>`u`)return;let i=!1;r(()=>i=!0),n.value=null,KS(e).then(e=>{i||(n.value=e)}).catch(()=>{})},{immediate:!0});let r={highlighter:null,text:``,lines:[]};return Y(()=>{let t=Be(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 XS=Je(`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`}}),ZS=Je(`-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`}}),QS=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(st),{"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`]))}}),$S=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(st),{"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`]))}}),eC=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(st),{"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 tC(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 nC(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`},iC=P({__name:`ChatAttachment`,props:{attachment:{}},setup(e){return(t,n)=>(L(),q(pe(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(nC)(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(hu),{"aria-hidden":`true`,class:`size-3.5 shrink-0`}),R(`span`,rC,B(V(tC)(e.attachment)),1)]),_:1},8,[`href`,`target`,`rel`,`title`]))}}),aC=P({__name:`CodeView`,props:{code:{},lang:{},class:{}},setup(e){let t=e,n=YS(()=>t.code,()=>t.lang||`text`);return(r,i)=>(L(),q(V(Np),{class:z(V(W)(`bg-muted`,t.class))},{default:I(()=>[A(V(Pp),null,{default:I(()=>[A(V(Bp),{value:e.code},null,8,[`value`])]),_:1}),A(V(Rp),{wrap:``,class:`max-h-[60vh] pe-10 text-xs`},{default:I(()=>[(L(!0),j(U,null,M(V(n),(e,t)=>(L(),q(V(Lp),{key:t},{default:I(()=>[(L(!0),j(U,null,M(e,(e,t)=>(L(),q(V(Vp),{key:t,token:e},null,8,[`token`]))),128))]),_:2},1024))),128))]),_:1})]),_:1},8,[`class`]))}}),oC=[`src`,`alt`],sC={key:1},cC={key:2},lC={key:3,class:`rounded bg-foreground/10 px-1 py-0.5 font-mono text-[0.9em]`},uC=[`href`],dC={key:5},fC=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 bg-Line truncated
`),r=[],i=null,a=null,o=``,s=()=>{r.length&&(t.push({kind:`p`,inline:mC(r.join(` `))}),r=[])},c=()=>{i&&=(t.push({kind:i.tag,items:i.items.map(e=>mC(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=gC(l),d=e+1<n.length?gC(n[e+1]):null;if(u&&d&&_C(d)&&u.length===d.length){s(),c();let r=[];for(e+=2;e<n.length;e++){let t=gC(n[e]);if(!t||t.length!==u.length){e--;break}r.push(t)}t.push({kind:`table`,head:u.map(e=>mC(e)),rows:r.map(e=>e.map(e=>mC(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:mC(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:mC(l.replace(/^>\s?/,``))})):r.push(l)}return s(),c(),a&&t.push({kind:`pre`,code:a.join(`
`),lang:o}),t}function gC(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 _C(e){return e.every(e=>/^:?-{3,}:?$/.test(e))}var vC={class:`[overflow-wrap:anywhere]`},yC={key:1,class:`my-3 w-full border-collapse text-[0.92em]`},bC={key:2,class:`my-2 border-l-[3px] border-primary pl-3 text-fg-muted`},xC={key:3,class:`mt-1 mb-2 text-xl leading-tight font-semibold tracking-[-0.02em]`},SC={key:4,class:`mt-1 mb-2 text-lg leading-tight font-semibold tracking-[-0.02em]`},CC={key:5,class:`mt-1 mb-2 text-base leading-tight font-semibold tracking-[-0.02em]`},wC={key:6,class:`my-2.5 flex list-disc flex-col gap-1 pl-5`},TC={key:7,class:`my-2.5 flex list-decimal flex-col gap-1 pl-5`},EC={key:8,class:`mb-2.5 last:mb-0`},DC=P({__name:`ChatMarkdown`,props:{text:{}},setup(e){let t=e,n=Y(()=>hC(t.text));return(e,t)=>(L(),j(`div`,vC,[(L(!0),j(U,null,M(n.value,(e,t)=>(L(),j(U,{key:t},[e.kind===`pre`?(L(),q(aC,{key:0,code:e.code,lang:e.lang,class:`my-2`},null,8,[`code`,`lang`])):e.kind===`table`?(L(),j(`table`,yC,[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(fC,{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(fC,{inline:e},null,8,[`inline`])]))),128))]))),128))])])):e.kind===`blockquote`?(L(),j(`blockquote`,bC,[A(fC,{inline:e.inline},null,8,[`inline`])])):e.kind===`h1`?(L(),j(`h1`,xC,[A(fC,{inline:e.inline},null,8,[`inline`])])):e.kind===`h2`?(L(),j(`h2`,SC,[A(fC,{inline:e.inline},null,8,[`inline`])])):e.kind===`h3`?(L(),j(`h3`,CC,[A(fC,{inline:e.inline},null,8,[`inline`])])):e.kind===`ul`?(L(),j(`ul`,wC,[(L(!0),j(U,null,M(e.items,(e,t)=>(L(),j(`li`,{key:t},[A(fC,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`ol`?(L(),j(`ol`,TC,[(L(!0),j(U,null,M(e.items,(e,t)=>(L(),j(`li`,{key:t},[A(fC,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`p`?(L(),j(`p`,EC,[A(fC,{inline:e.inline},null,8,[`inline`])])):F(``,!0)],64))),128))]))}}),OC=P({__name:`Spinner`,props:{class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e;return(e,n)=>(L(),q(V(au),{role:`status`,"aria-label":`Loading`,class:z(V(W)(`size-4 animate-spin`,t.class))},null,8,[`class`]))}}),kC={class:`truncate`},AC=P({__name:`ChatNavChip`,props:{path:{},label:{}},setup(e){return(t,n)=>{let r=Oe(`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(vl),{"aria-hidden":`true`,class:`size-3.5 shrink-0`}),R(`span`,kC,B(e.label||e.path),1)]),_:1},8,[`to`,`title`])}}}),jC={class:`font-mono text-foreground`},MC={key:0,class:`shrink-0 text-xs tabular-nums`},NC={class:`font-mono text-foreground`},PC={key:0,class:`shrink-0 text-xs tabular-nums`},FC=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 JS=Je(`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`}}),YS=Je(`-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`}}),XS=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(st),{"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`]))}}),ZS=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(st),{"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`]))}}),QS=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(st),{"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 $S(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 eC(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 tC={class:`truncate`},nC=P({__name:`ChatAttachment`,props:{attachment:{}},setup(e){return(t,n)=>(L(),q(pe(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(eC)(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(mu),{"aria-hidden":`true`,class:`size-3.5 shrink-0`}),R(`span`,tC,B(V($S)(e.attachment)),1)]),_:1},8,[`href`,`target`,`rel`,`title`]))}}),rC=P({__name:`CodeView`,props:{code:{},lang:{},class:{}},setup(e){let t=e,n=qS(()=>t.code,()=>t.lang||`text`);return(r,i)=>(L(),q(V(jp),{class:z(V(W)(`bg-muted`,t.class))},{default:I(()=>[A(V(Mp),null,{default:I(()=>[A(V(Rp),{value:e.code},null,8,[`value`])]),_:1}),A(V(Ip),{wrap:``,class:`max-h-[60vh] pe-10 text-xs`},{default:I(()=>[(L(!0),j(U,null,M(V(n),(e,t)=>(L(),q(V(Fp),{key:t},{default:I(()=>[(L(!0),j(U,null,M(e,(e,t)=>(L(),q(V(zp),{key:t,token:e},null,8,[`token`]))),128))]),_:2},1024))),128))]),_:1})]),_:1},8,[`class`]))}}),iC=[`src`,`alt`],aC={key:1},oC={key:2},sC={key:3,class:`rounded bg-foreground/10 px-1 py-0.5 font-mono text-[0.9em]`},cC=[`href`],lC={key:5},uC=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 bg-Line truncated
`),r=[],i=null,a=null,o=``,s=()=>{r.length&&(t.push({kind:`p`,inline:fC(r.join(` `))}),r=[])},c=()=>{i&&=(t.push({kind:i.tag,items:i.items.map(e=>fC(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=mC(l),d=e+1<n.length?mC(n[e+1]):null;if(u&&d&&hC(d)&&u.length===d.length){s(),c();let r=[];for(e+=2;e<n.length;e++){let t=mC(n[e]);if(!t||t.length!==u.length){e--;break}r.push(t)}t.push({kind:`table`,head:u.map(e=>fC(e)),rows:r.map(e=>e.map(e=>fC(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:fC(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:fC(l.replace(/^>\s?/,``))})):r.push(l)}return s(),c(),a&&t.push({kind:`pre`,code:a.join(`
`),lang:o}),t}function mC(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 hC(e){return e.every(e=>/^:?-{3,}:?$/.test(e))}var gC={class:`[overflow-wrap:anywhere]`},_C={key:1,class:`my-3 w-full border-collapse text-[0.92em]`},vC={key:2,class:`my-2 border-l-[3px] border-primary pl-3 text-fg-muted`},yC={key:3,class:`mt-1 mb-2 text-xl leading-tight font-semibold tracking-[-0.02em]`},bC={key:4,class:`mt-1 mb-2 text-lg leading-tight font-semibold tracking-[-0.02em]`},xC={key:5,class:`mt-1 mb-2 text-base leading-tight font-semibold tracking-[-0.02em]`},SC={key:6,class:`my-2.5 flex list-disc flex-col gap-1 pl-5`},CC={key:7,class:`my-2.5 flex list-decimal flex-col gap-1 pl-5`},wC={key:8,class:`mb-2.5 last:mb-0`},TC=P({__name:`ChatMarkdown`,props:{text:{}},setup(e){let t=e,n=Y(()=>pC(t.text));return(e,t)=>(L(),j(`div`,gC,[(L(!0),j(U,null,M(n.value,(e,t)=>(L(),j(U,{key:t},[e.kind===`pre`?(L(),q(rC,{key:0,code:e.code,lang:e.lang,class:`my-2`},null,8,[`code`,`lang`])):e.kind===`table`?(L(),j(`table`,_C,[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(uC,{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(uC,{inline:e},null,8,[`inline`])]))),128))]))),128))])])):e.kind===`blockquote`?(L(),j(`blockquote`,vC,[A(uC,{inline:e.inline},null,8,[`inline`])])):e.kind===`h1`?(L(),j(`h1`,yC,[A(uC,{inline:e.inline},null,8,[`inline`])])):e.kind===`h2`?(L(),j(`h2`,bC,[A(uC,{inline:e.inline},null,8,[`inline`])])):e.kind===`h3`?(L(),j(`h3`,xC,[A(uC,{inline:e.inline},null,8,[`inline`])])):e.kind===`ul`?(L(),j(`ul`,SC,[(L(!0),j(U,null,M(e.items,(e,t)=>(L(),j(`li`,{key:t},[A(uC,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`ol`?(L(),j(`ol`,CC,[(L(!0),j(U,null,M(e.items,(e,t)=>(L(),j(`li`,{key:t},[A(uC,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`p`?(L(),j(`p`,wC,[A(uC,{inline:e.inline},null,8,[`inline`])])):F(``,!0)],64))),128))]))}}),EC=P({__name:`Spinner`,props:{class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e;return(e,n)=>(L(),q(V(iu),{role:`status`,"aria-label":`Loading`,class:z(V(W)(`size-4 animate-spin`,t.class))},null,8,[`class`]))}}),DC={class:`truncate`},OC=P({__name:`ChatNavChip`,props:{path:{},label:{}},setup(e){return(t,n)=>{let r=Oe(`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(_l),{"aria-hidden":`true`,class:`size-3.5 shrink-0`}),R(`span`,DC,B(e.label||e.path),1)]),_:1},8,[`to`,`title`])}}}),kC={class:`font-mono text-foreground`},AC={key:0,class:`shrink-0 text-xs tabular-nums`},jC={class:`font-mono text-foreground`},MC={key:0,class:`shrink-0 text-xs tabular-nums`},NC=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)[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(`
`));return(t,r)=>e.tool.path?(L(),q(AC,{key:0,path:e.tool.path,label:e.tool.label},null,8,[`path`,`label`])):l.value?(L(),q(V(Tp),{key:1,"default-open":i.value},{default:I(()=>[A(V(Op),null,{default:I(()=>[A(V(Ap),{status:i.value?`error`:o.value?`running`:void 0},{default:I(()=>[A(V(Dp),null,{default:I(()=>[i.value?(L(),q(V(Il),{key:0})):o.value?(L(),q(V(OC),{key:1})):(L(),q(V(Nl),{key:2,class:`text-success`}))]),_:1}),R(`span`,jC,B(n.value),1),A(V(jp),{class:`font-mono text-xs`},{default:I(()=>[H(B(c.value),1)]),_:1}),s.value?(L(),j(`span`,MC,B(s.value),1)):F(``,!0)]),_:1},8,[`status`])]),_:1}),A(V(Ep),null,{default:I(()=>[A(V(Np),{size:`sm`},{default:I(()=>[A(V(Rp),{wrap:``,class:`max-h-64`},{default:I(()=>[H(B(l.value),1)]),_:1})]),_:1})]),_:1})]),_:1},8,[`default-open`])):(L(),q(V(Ap),{key:2,status:i.value?`error`:o.value?`running`:void 0},{default:I(()=>[A(V(Dp),null,{default:I(()=>[i.value?(L(),q(V(Il),{key:0})):o.value?(L(),q(V(OC),{key:1})):(L(),q(V(Nl),{key:2,class:`text-success`}))]),_:1}),R(`span`,NC,B(n.value),1),A(V(jp),{class:`font-mono text-xs`},{default:I(()=>[H(B(c.value),1)]),_:1}),s.value?(L(),j(`span`,PC,B(s.value),1)):F(``,!0)]),_:1},8,[`status`]))}}),IC={class:`flex flex-col gap-1.5`},LC=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(Tp),{"default-open":r.value},{default:I(()=>[A(V(Op),null,{default:I(()=>[A(V(Ap),{status:r.value?`error`:void 0},{default:I(()=>[A(V(Dp),null,{default:I(()=>[A(V(bte))]),_:1}),A(V(jp),{class:`truncate`},{default:I(()=>[H(B(i.value),1)]),_:1})]),_:1},8,[`status`])]),_:1}),A(V(Ep),null,{default:I(()=>[R(`div`,IC,[(L(!0),j(U,null,M(e.tools,(t,n)=>(L(),q(FC,{key:n,tool:t,streaming:e.streaming&&n===e.tools.length-1},null,8,[`tool`,`streaming`]))),128))])]),_:1})]),_:1},8,[`default-open`]))}}),RC={key:0,class:`mb-2 flex flex-wrap gap-1.5`},zC={key:2,class:`whitespace-pre-wrap`},BC=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(QS),{align:e.assistant?`start`:`end`},{default:I(()=>[A(V($S),null,{default:I(()=>[A(V(vp),{variant:e.assistant?`muted`:`tinted`,class:`max-w-[min(78ch,92%)]`},{default:I(()=>[A(V(yp),{class:`[overflow-wrap:anywhere]`},{default:I(()=>[e.media.length?(L(),j(`div`,RC,[(L(!0),j(U,null,M(e.media,(e,t)=>(L(),q(iC,{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(DC,{key:0,text:t.text},null,8,[`text`])):(L(),q(V(xp),{key:1,class:`my-2`},{default:I(()=>[t.tools.length>1?(L(),q(LC,{key:0,tools:t.tools,streaming:e.streaming&&r===n.value.length-1},null,8,[`tools`,`streaming`])):(L(),q(FC,{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`,zC,B(e.text),1)),K(t.$slots,`default`)]),_:3})]),_:3},8,[`variant`]),e.assistant&&!e.streaming&&e.text?(L(),q(V(eC),{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(Bp),{value:e.text},null,8,[`value`])]),_:1})):F(``,!0)]),_:3})]),_:3},8,[`align`]))}}),VC={class:`text-sm`},HC={key:0,class:`mt-1 text-fg-muted`},UC={key:1,class:`mt-2 flex flex-wrap gap-2`},WC=P({__name:`ChatChooseCard`,props:{choose:{}},setup(e){let t=Y(()=>ld.value.models??[]);return(e,n)=>(L(),j(`div`,VC,[n[0]||=R(`p`,{class:`font-medium`},`Choose a model`,-1),t.value.length?(L(),j(`div`,UC,[(L(!0),j(U,null,M(t.value,e=>(L(),q(V(X),{key:e,size:`sm`,variant:e===V(ld).active_model?`default`:`outline`,class:`font-mono`,onClick:t=>void V(Cd)(e)},{default:I(()=>[H(B(e),1)]),_:2},1032,[`variant`,`onClick`]))),128))])):(L(),j(`p`,HC,`None configured.`))]))}}),GC={class:`text-sm`},KC={key:0},qC={class:`mt-1 space-y-0.5`},JC={class:`font-mono`},YC=[`href`],XC={key:0,class:`mt-3 flex gap-2`},ZC={key:1,class:`mt-2 text-fg-muted`},QC={key:2,class:`mt-2 text-fg-muted`},$C={key:3,class:`mt-2 text-ok`},ew={key:4,class:`mt-2 text-danger`},tw={key:5,class:`mt-2 text-xs text-fg-muted`},nw=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(([e,t])=>`${e} → ${t}`).join(`, `)+`. Archie restarts to apply it.`:`UpdaLine truncated
`).map(e=>e.trim()).find(Boolean)||``,i=r.length>KE?`${r.slice(0,KE).trimEnd()}…`:r;return{text:i,full:n,truncated:i!==n}}function JE(e){return String(e||`event`).replaceAll(`_`,` `).replace(/\b\w/g,e=>e.toUpperCase())}function YE(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 XE(e){let t=Number(e);return!Number.isFinite(t)||t<=0?``:t.toLocaleString(`en-US`)}function ZE(e){return typeof e==`string`?e:``}function QE(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,YE(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,ZE(t.error),ZE(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:[ZE(t.previous_stage)&&`after ${ZE(t.previous_stage)}`,ZE(t.previous_reason)].filter(Boolean).join(`: `)||e.detail||``}}if(e.kind===`agent_finish`){let r=XE(t.iterations),i=XE(t.tokens),a=Number(t.cached_tokens)||0,o=XE((Number(t.prompt_tokens)||0)-a),s=XE(t.completion_tokens),c=XE(t.cached_tokens),l=[r&&`${r} iterations`,i&&`${i} tokens`,o&&`${o} fresh prompt`,s&&`${s} completion`,c&&`${c} cached`,ZE(t.model)].filter(Boolean);return{title:`Agent ${ZE(t.status)||`finished`}: ${n}`,detail:l.join(` · `)||e.detail||``}}if(e.kind===`remediation_round`){let e=Number(t.of),n=ZE(t.author);return{title:`Remediation ${ZE(t.round)}${e>0?` of ${e}`:``}`,detail:[n&&`answers ${n}'s review`,t.review_id?`#${ZE(t.review_id)}`:``].filter(Boolean).join(` `)}}if(e.kind===`review_approved`){let e=ZE(t.pr_number);return{title:`Pull request approved`,detail:[ZE(t.author),e&&`#${e}`].filter(Boolean).join(` · `)}}if(e.kind===`step_retried`)return{title:`Attempt ${ZE(t.attempt)} of ${ZE(t.of)} failed: ${e.stage||`step`}`,detail:ZE(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=ZE(t.source),n=ZE(t.capture_id),r=[{label:`binding ${ZE(t.binding_name)||ZE(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 ${ZE(t.captured_after)}`:``].filter(Boolean).join(` · `)}}return{title:JE(e.kind||e.type),detail:e.detail||``}}var $E=[`title`],eD=P({__name:`ActivityRow`,props:{event:{}},emits:[`open`],setup(e,{emit:t}){let n=kE();n.watchIdentities();let r=e,i=t,a=FE(),o=Y(()=>a.taskIDFor(r.event)),s=Y(()=>qE(r.event,n.identityName));function c(){o.value>0&&i(`open`,o.value)}return(t,n)=>(L(),q(V(UE),{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:[lt(_t(c,[`prevent`]),[`enter`]),lt(_t(c,[`prevent`]),[`space`])]},{default:I(()=>[A(V(HE),{class:`font-medium`},{default:I(()=>[H(B(V(QE)({...r.event,at:void 0,detail:void 0}).title),1)]),_:1}),A(V(HE),{class:`font-mono`},{default:I(()=>[H(B(o.value>0?`#${o.value}`:`–`),1)]),_:1}),A(V(HE),{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,$E)]),_:1}),A(V(HE),null,{default:I(()=>[A(V(Tw),{at:e.event.at},null,8,[`at`])]),_:1})]),_:1},8,[`class`,`role`,`tabindex`,`title`,`onKeydown`]))}}),tD=[{value:`all`,label:`All`},{value:`tasks`,label:`Tasks`},{value:`system`,label:`System`}];function nD(e){return(Number(e?.task_id)||0)>0}function rD(e,t){return t===`tasks`?nD(e):t!==`system`||!nD(e)}function iD(e,t){return e.filter(e=>rD(e,t))}function aD(e,t){return e>0?``:t===`all`?`Waiting for activity`:t===`tasks`?`No task events yet`:`No system events yet`}function oD(e,t){return`${e}:${t??0}`}function sD(e){let t=[];for(let n of e){let e=n.kind||n.type||`event`,r=Number(n.task_id)||0,i=oD(qE(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 cD={role:`region`,"aria-label":`Activity`,"aria-live":`polite`},lD={class:`max-h-[28rem] overflow-y-auto`},uD={class:`inline-flex Line truncated
`,1)[0]??``;return t.length>80?`${t.slice(0,79)}…`:t}var TO=P({inheritAttrs:!1,__name:`SuggestInput`,props:Ue({options:{},class:{}},{modelValue:{default:``},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=e,n=Te(e,`modelValue`),r=J(!1),i=Y(()=>{let e=r.value?n.value.toLowerCase():``;return t.options.filter(t=>t.toLowerCase().includes(e)).slice(0,50)});function a(e,t){let n=e.target,r=t?n.value.length:0;n.setSelectionRange(r,r),n.scrollLeft=t?n.scrollWidth:0}function o(e){r.value=!0,n.value=e}return(e,s)=>(L(),q(V(kr),{modelValue:n.value,"onUpdate:modelValue":s[2]||=e=>n.value=e,"ignore-filter":``,"open-on-focus":``,"display-value":e=>e,"onUpdate:open":s[3]||=e=>r.value=!1},{default:I(()=>[A(V(Ar),{"as-child":``},{default:I(()=>[A(V(Fr),{"as-child":``,"model-value":n.value,"onUpdate:modelValue":o},{default:I(()=>[R(`input`,G(e.$attrs,{"data-slot":`input`,autocomplete:`off`,onKeydown:[s[0]||=lt(e=>a(e,!1),[`home`]),s[1]||=lt(e=>a(e,!0),[`end`])],class:V(W)(V(oee),t.class)}),null,16)]),_:1},8,[`model-value`])]),_:1}),A(V(Lr),null,{default:I(()=>[i.value.length?(L(),q(V(Nr),{key:0,position:`popper`,"side-offset":4,class:`z-50 max-h-60 w-(--reka-combobox-trigger-width) overflow-hidden rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10`},{default:I(()=>[A(V(zr),{class:`max-h-60 overflow-y-auto p-1`},{default:I(()=>[(L(!0),j(U,null,M(i.value,e=>(L(),q(V(Ir),{key:e,value:e,class:`relative flex w-full cursor-default items-center rounded-md px-1.5 py-1 font-mono text-sm outline-hidden select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground`},{default:I(()=>[H(B(e),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})):F(``,!0)]),_:1})]),_:1},8,[`modelValue`,`display-value`]))}});function EO(e){return(e?.merged||0)+(e?.completed||0)}function DO(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 OO(e,t){return e.filter(e=>e.required&&!(t[e.name]??``).trim()).map(e=>e.name)}function kO(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 AO(e,t){let n={};for(let r of e){let e=t[r.name];e!==void 0&&e!==``&&(n[r.name]=kO(e,r.type))}return n}var jO=[`onKeydown`],MO={key:1,class:`grid gap-1.5`},NO={key:0,class:`font-normal text-fg-subtle`},PO={key:2,class:`grid gap-1.5`},FO=[`id`],IO={class:`min-w-0`},LO={class:`block truncate text-label font-medium`},RO={class:`block text-xs text-fg-subtle`},zO={key:0,class:`text-xs text-fg-subtle`},BO={key:3,class:`grid gap-3`},VO={class:`font-mono`},HO={key:0,class:`text-fg-subtle`},UO={class:`grid gap-1.5`},WO={class:`grid gap-1.5`},GO={class:`flex items-center gap-2 border-t border-border pt-4`},KO={class:`mr-auto text-xs text-fg-subtle`},qO=P({__name:`NewTaskForm`,props:{workflow:{},draft:{},initialWorkflow:{},initialInstructions:{}},emits:[`started`,`cancel`],setup(e,{emit:t}){let n=e,r=t,i=ye(),a=J([]),o=J([]),s=J([]),c=J(``);Fe(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(wO(d.value)),p=J({});ve(()=>{!u.value&&a.value[0]&&(u.value=a.value[0].id)});let m=Y(()=>a.value.find(e=>e.id===u.value)),h=Y(()=>DO(m.value)),g=Y(()=>OO(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:AO(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:_t(C,[`prevent`]),onKeydown:[lt(_t(C,[`meta`,`prevent`]),[`enter`]),lt(_t(C,[`ctrl`,`prevent`]),[`enter`])]},[c.value?(L(),q(V(ut),{key:0,variant:`destructive`},{default:I(()=>[A(V(xt),null,{default:I(()=>[H(B(c.value),1)]),_:1})]),_:1})):F(``,!0),_.value===`none`?F(``,!0):(L(),j(`div`,MO,[A(V(kc),{for:`${V(i)}-repo`,class:`text-label font-medium`},{default:I(()=>[t[5]||=H(`Repository`,-1),v.value?F(``,!0):(L(),j(`span`,NO,` (optional)`))]),_:1},8,[`for`]),A(V(TO),{id:`${V(i)}-repo`,modelValue:l.value,"onUpdate:modelValue":t[0]||=e=>l.value=e,class:`font-mono`,placeholder:`owner/repository`,options:s.value,required:v.value},null,8,[`id`,`modelValue`,`options`,`required`])])),n.workflow?F(``,!0):(L(),j(`div`,PO,[R(`span`,{id:`${V(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 sk(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 ck(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 lk(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 uk(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 dk=J([]),fk=J([]),pk=J(!0),mk=J(null),hk=J(!0),gk=J(null),_k=J(!1),vk=J(null);async function yk(){try{let e=await Z.eventTypes(ak().workspace);pk.value=e.enabled!==!1,dk.value=e.event_types||[],fk.value=e.proposals||[],mk.value=null}catch(e){mk.value=e.message||String(e)}finally{hk.value=!1}}function bk(e){return{headers:(e.headers||[]).map(e=>({...e})),payload:(e.payload||[]).map(e=>({...e}))}}function xk(e){vk.value=null,gk.value=e}function Sk(e){let t=Ak.value.find(t=>String(t.id)===e.sample_id);xk({mode:`proposal`,id:null,source:e.source,name:``,rule:bk(e.rule),headersText:``,body:t?.body||``,exampleHeaders:e.headers||{}})}function Ck(e=``){xk({mode:`paste`,id:null,source:e,name:``,rule:{headers:[],payload:[]},headersText:``,body:``,exampleHeaders:{}})}function wk(e){xk({mode:`edit`,id:e.id,source:e.source,name:e.name,rule:bk(e.rule),headersText:``,body:``,exampleHeaders:{}})}function Tk(){gk.value=null}async function Ek(){let e=gk.value;if(e){_k.value=!0;try{if(e.mode===`edit`&&e.id)await Z.eventTypeUpdate(e.id,{name:e.name,rule:uk(e.rule)});else{let t=e.mode===`paste`?ok(e.headersText):e.exampleHeaders;await Z.eventTypeCreate({source:e.source,name:e.name,rule:e.mode===`paste`?void 0:uk(e.rule),example:{headers:t,body:e.body}})}gk.value=null,await yk()}catch(e){vk.value=e.message||String(e)}finally{_k.value=!1}}}var Dk=J(null);async function Ok(){let e=Dk.value;if(Dk.value=null,e)try{await Z.eventTypeDelete(e.id),await yk()}catch(e){mk.value=e.message||String(e)}}var kk=100,Ak=J([]),jk=J(!0),Mk=J(null),Nk=J(!0),Pk=J(null);async function Fk(){try{let e=await Z.captures(kk);jk.value=e.enabled!==!1,Ak.value=e.captures||[],Mk.value=null}catch(e){Mk.value=e.message||String(e)}finally{Nk.value=!1}}function Ik(e){let t=Ak.value.find(t=>t.id===e);return t&&(Pk.value=t),!!t}function Lk(){Ak.value.length&&(Pk.value=Ak.value[0])}function Rk(){pf(`captures`,()=>{Fk(),yk()})}var zk=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=St(n,`class`),a=D(i,r);return(e,t)=>(L(),q(V(Ka),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`,He(he(t)))]),_:3},16,[`data-orientation`,`class`]))}}),Bk=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=St(t,`class`);return(e,r)=>(L(),q(V(Ya),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`]))}}),Vk=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=St(t,`class`,`variant`);return(r,i)=>(L(),q(V(Xa),G({"data-slot":`tabs-list`,"data-variant":e.variant},V(n),{class:V(W)(V(Uk)({variant:e.variant}),t.class)}),{default:I(()=>[K(r.$slots,`default`)]),_:3},16,[`data-variant`,`class`]))}}),Hk=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=St(t,`class`),r=T(n);return(e,n)=>(L(),q(V(Za),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?(L(),q(OC,{key:0,path:e.tool.path,label:e.tool.label},null,8,[`path`,`label`])):l.value?(L(),q(V(Cp),{key:1,"default-open":i.value},{default:I(()=>[A(V(Ep),null,{default:I(()=>[A(V(Op),{status:i.value?`error`:o.value?`running`:void 0},{default:I(()=>[A(V(Tp),null,{default:I(()=>[i.value?(L(),q(V(Fl),{key:0})):o.value?(L(),q(V(EC),{key:1})):(L(),q(V(Ml),{key:2,class:`text-success`}))]),_:1}),R(`span`,kC,B(n.value),1),A(V(kp),{class:`font-mono text-xs`},{default:I(()=>[H(B(c.value),1)]),_:1}),s.value?(L(),j(`span`,AC,B(s.value),1)):F(``,!0)]),_:1},8,[`status`])]),_:1}),A(V(wp),null,{default:I(()=>[A(V(jp),{size:`sm`},{default:I(()=>[A(V(Ip),{wrap:``,class:`max-h-64`},{default:I(()=>[H(B(l.value),1)]),_:1})]),_:1})]),_:1})]),_:1},8,[`default-open`])):(L(),q(V(Op),{key:2,status:i.value?`error`:o.value?`running`:void 0},{default:I(()=>[A(V(Tp),null,{default:I(()=>[i.value?(L(),q(V(Fl),{key:0})):o.value?(L(),q(V(EC),{key:1})):(L(),q(V(Ml),{key:2,class:`text-success`}))]),_:1}),R(`span`,jC,B(n.value),1),A(V(kp),{class:`font-mono text-xs`},{default:I(()=>[H(B(c.value),1)]),_:1}),s.value?(L(),j(`span`,MC,B(s.value),1)):F(``,!0)]),_:1},8,[`status`]))}}),PC={class:`flex flex-col gap-1.5`},FC=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(Cp),{"default-open":r.value},{default:I(()=>[A(V(Ep),null,{default:I(()=>[A(V(Op),{status:r.value?`error`:void 0},{default:I(()=>[A(V(Tp),null,{default:I(()=>[A(V(Ste))]),_:1}),A(V(kp),{class:`truncate`},{default:I(()=>[H(B(i.value),1)]),_:1})]),_:1},8,[`status`])]),_:1}),A(V(wp),null,{default:I(()=>[R(`div`,PC,[(L(!0),j(U,null,M(e.tools,(t,n)=>(L(),q(NC,{key:n,tool:t,streaming:e.streaming&&n===e.tools.length-1},null,8,[`tool`,`streaming`]))),128))])]),_:1})]),_:1},8,[`default-open`]))}}),IC={key:0,class:`mb-2 flex flex-wrap gap-1.5`},LC={key:2,class:`whitespace-pre-wrap`},RC=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(XS),{align:e.assistant?`start`:`end`},{default:I(()=>[A(V(ZS),null,{default:I(()=>[A(V(gp),{variant:e.assistant?`muted`:`tinted`,class:`max-w-[min(78ch,92%)]`},{default:I(()=>[A(V(_p),{class:`[overflow-wrap:anywhere]`},{default:I(()=>[e.media.length?(L(),j(`div`,IC,[(L(!0),j(U,null,M(e.media,(e,t)=>(L(),q(nC,{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(TC,{key:0,text:t.text},null,8,[`text`])):(L(),q(V(yp),{key:1,class:`my-2`},{default:I(()=>[t.tools.length>1?(L(),q(FC,{key:0,tools:t.tools,streaming:e.streaming&&r===n.value.length-1},null,8,[`tools`,`streaming`])):(L(),q(NC,{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`,LC,B(e.text),1)),K(t.$slots,`default`)]),_:3})]),_:3},8,[`variant`]),e.assistant&&!e.streaming&&e.text?(L(),q(V(QS),{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(Rp),{value:e.text},null,8,[`value`])]),_:1})):F(``,!0)]),_:3})]),_:3},8,[`align`]))}}),zC={class:`text-sm`},BC={key:0,class:`mt-1 text-fg-muted`},VC={key:1,class:`mt-2 flex flex-wrap gap-2`},HC=P({__name:`ChatChooseCard`,props:{choose:{}},setup(e){let t=Y(()=>sd.value.models??[]);return(e,n)=>(L(),j(`div`,zC,[n[0]||=R(`p`,{class:`font-medium`},`Choose a model`,-1),t.value.length?(L(),j(`div`,VC,[(L(!0),j(U,null,M(t.value,e=>(L(),q(V(X),{key:e,size:`sm`,variant:e===V(sd).active_model?`default`:`outline`,class:`font-mono`,onClick:t=>void V(xd)(e)},{default:I(()=>[H(B(e),1)]),_:2},1032,[`variant`,`onClick`]))),128))])):(L(),j(`p`,BC,`None configured.`))]))}}),UC={class:`text-sm`},WC={key:0},GC={class:`mt-1 space-y-0.5`},KC={class:`font-mono`},qC=[`href`],JC={key:0,class:`mt-3 flex gap-2`},YC={key:1,class:`mt-2 text-fg-muted`},XC={key:2,class:`mt-2 text-fg-muted`},ZC={key:3,class:`mt-2 text-ok`},QC={key:4,class:`mt-2 text-danger`},$C={key:5,class:`mt-2 text-xs text-fg-muted`},ew=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(([e,t])=>`${e} → ${t}`).join(`, `)+`. Archie restarts to apply it.`:`UpdaLine truncated
`).map(e=>e.trim()).find(Boolean)||``,i=r.length>VE?`${r.slice(0,VE).trimEnd()}…`:r;return{text:i,full:n,truncated:i!==n}}function UE(e){return String(e||`event`).replaceAll(`_`,` `).replace(/\b\w/g,e=>e.toUpperCase())}function WE(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 GE(e){let t=Number(e);return!Number.isFinite(t)||t<=0?``:t.toLocaleString(`en-US`)}function KE(e){return typeof e==`string`?e:``}function qE(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,WE(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,KE(t.error),KE(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:[KE(t.previous_stage)&&`after ${KE(t.previous_stage)}`,KE(t.previous_reason)].filter(Boolean).join(`: `)||e.detail||``}}if(e.kind===`agent_finish`){let r=GE(t.iterations),i=GE(t.tokens),a=Number(t.cached_tokens)||0,o=GE((Number(t.prompt_tokens)||0)-a),s=GE(t.completion_tokens),c=GE(t.cached_tokens),l=[r&&`${r} iterations`,i&&`${i} tokens`,o&&`${o} fresh prompt`,s&&`${s} completion`,c&&`${c} cached`,KE(t.model)].filter(Boolean);return{title:`Agent ${KE(t.status)||`finished`}: ${n}`,detail:l.join(` · `)||e.detail||``}}if(e.kind===`remediation_round`){let e=Number(t.of),n=KE(t.author);return{title:`Remediation ${KE(t.round)}${e>0?` of ${e}`:``}`,detail:[n&&`answers ${n}'s review`,t.review_id?`#${KE(t.review_id)}`:``].filter(Boolean).join(` `)}}if(e.kind===`review_approved`){let e=KE(t.pr_number);return{title:`Pull request approved`,detail:[KE(t.author),e&&`#${e}`].filter(Boolean).join(` · `)}}if(e.kind===`step_retried`)return{title:`Attempt ${KE(t.attempt)} of ${KE(t.of)} failed: ${e.stage||`step`}`,detail:KE(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=KE(t.source),n=KE(t.capture_id),r=[{label:`binding ${KE(t.binding_name)||KE(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 ${KE(t.captured_after)}`:``].filter(Boolean).join(` · `)}}return{title:UE(e.kind||e.type),detail:e.detail||``}}var JE=[`title`],YE=P({__name:`ActivityRow`,props:{event:{}},emits:[`open`],setup(e,{emit:t}){let n=wE();n.watchIdentities();let r=e,i=t,a=AE(),o=Y(()=>a.taskIDFor(r.event)),s=Y(()=>HE(r.event,n.identityName));function c(){o.value>0&&i(`open`,o.value)}return(t,n)=>(L(),q(V(RE),{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:[lt(_t(c,[`prevent`]),[`enter`]),lt(_t(c,[`prevent`]),[`space`])]},{default:I(()=>[A(V(LE),{class:`font-medium`},{default:I(()=>[H(B(V(qE)({...r.event,at:void 0,detail:void 0}).title),1)]),_:1}),A(V(LE),{class:`font-mono`},{default:I(()=>[H(B(o.value>0?`#${o.value}`:`–`),1)]),_:1}),A(V(LE),{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,JE)]),_:1}),A(V(LE),null,{default:I(()=>[A(V(xw),{at:e.event.at},null,8,[`at`])]),_:1})]),_:1},8,[`class`,`role`,`tabindex`,`title`,`onKeydown`]))}}),XE=[{value:`all`,label:`All`},{value:`tasks`,label:`Tasks`},{value:`system`,label:`System`}];function ZE(e){return(Number(e?.task_id)||0)>0}function QE(e,t){return t===`tasks`?ZE(e):t!==`system`||!ZE(e)}function $E(e,t){return e.filter(e=>QE(e,t))}function eD(e,t){return e>0?``:t===`all`?`Waiting for activity`:t===`tasks`?`No task events yet`:`No system events yet`}function tD(e,t){return`${e}:${t??0}`}function nD(e){let t=[];for(let n of e){let e=n.kind||n.type||`event`,r=Number(n.task_id)||0,i=tD(HE(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 rD={role:`region`,"aria-label":`Activity`,"aria-live":`polite`},iD={class:`max-h-[28rem] overflow-y-auto`},aD={class:`inline-flex Line truncated
`,1)[0]??``;return t.length>80?`${t.slice(0,79)}…`:t}var bO=P({inheritAttrs:!1,__name:`SuggestInput`,props:Ue({options:{},class:{}},{modelValue:{default:``},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=e,n=Te(e,`modelValue`),r=J(!1),i=Y(()=>{let e=r.value?n.value.toLowerCase():``;return t.options.filter(t=>t.toLowerCase().includes(e)).slice(0,50)});function a(e,t){let n=e.target,r=t?n.value.length:0;n.setSelectionRange(r,r),n.scrollLeft=t?n.scrollWidth:0}function o(e){r.value=!0,n.value=e}return(e,s)=>(L(),q(V(kr),{modelValue:n.value,"onUpdate:modelValue":s[2]||=e=>n.value=e,"ignore-filter":``,"open-on-focus":``,"display-value":e=>e,"onUpdate:open":s[3]||=e=>r.value=!1},{default:I(()=>[A(V(Ar),{"as-child":``},{default:I(()=>[A(V(Fr),{"as-child":``,"model-value":n.value,"onUpdate:modelValue":o},{default:I(()=>[R(`input`,G(e.$attrs,{"data-slot":`input`,autocomplete:`off`,onKeydown:[s[0]||=lt(e=>a(e,!1),[`home`]),s[1]||=lt(e=>a(e,!0),[`end`])],class:V(W)(V(oee),t.class)}),null,16)]),_:1},8,[`model-value`])]),_:1}),A(V(Lr),null,{default:I(()=>[i.value.length?(L(),q(V(Nr),{key:0,position:`popper`,"side-offset":4,class:`z-50 max-h-60 w-(--reka-combobox-trigger-width) overflow-hidden rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10`},{default:I(()=>[A(V(zr),{class:`max-h-60 overflow-y-auto p-1`},{default:I(()=>[(L(!0),j(U,null,M(i.value,e=>(L(),q(V(Ir),{key:e,value:e,class:`relative flex w-full cursor-default items-center rounded-md px-1.5 py-1 font-mono text-sm outline-hidden select-none data-highlighted:bg-accent data-highlighted:text-accent-foreground`},{default:I(()=>[H(B(e),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})):F(``,!0)]),_:1})]),_:1},8,[`modelValue`,`display-value`]))}});function xO(e){return(e?.merged||0)+(e?.completed||0)}function SO(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 CO(e,t){return e.filter(e=>e.required&&!(t[e.name]??``).trim()).map(e=>e.name)}function wO(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 TO(e,t){let n={};for(let r of e){let e=t[r.name];e!==void 0&&e!==``&&(n[r.name]=wO(e,r.type))}return n}var EO=[`onKeydown`],DO={key:1,class:`grid gap-1.5`},OO={key:0,class:`font-normal text-fg-subtle`},kO={key:2,class:`grid gap-1.5`},AO=[`id`],jO={class:`min-w-0`},MO={class:`block truncate text-label font-medium`},NO={class:`block text-xs text-fg-subtle`},PO={key:0,class:`text-xs text-fg-subtle`},FO={key:3,class:`grid gap-3`},IO={class:`font-mono`},LO={key:0,class:`text-fg-subtle`},RO={class:`grid gap-1.5`},zO={class:`grid gap-1.5`},BO={class:`flex items-center gap-2 border-t border-border pt-4`},VO={class:`mr-auto text-xs text-fg-subtle`},HO=P({__name:`NewTaskForm`,props:{workflow:{},draft:{},initialWorkflow:{},initialInstructions:{}},emits:[`started`,`cancel`],setup(e,{emit:t}){let n=e,r=t,i=ye(),a=J([]),o=J([]),s=J([]),c=J(``);Fe(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(yO(d.value)),p=J({});ve(()=>{!u.value&&a.value[0]&&(u.value=a.value[0].id)});let m=Y(()=>a.value.find(e=>e.id===u.value)),h=Y(()=>SO(m.value)),g=Y(()=>CO(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 ee(){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:TO(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:_t(ee,[`prevent`]),onKeydown:[lt(_t(ee,[`meta`,`prevent`]),[`enter`]),lt(_t(ee,[`ctrl`,`prevent`]),[`enter`])]},[c.value?(L(),q(V(ut),{key:0,variant:`destructive`},{default:I(()=>[A(V(xt),null,{default:I(()=>[H(B(c.value),1)]),_:1})]),_:1})):F(``,!0),_.value===`none`?F(``,!0):(L(),j(`div`,DO,[A(V(Oc),{for:`${V(i)}-repo`,class:`text-label font-medium`},{default:I(()=>[t[5]||=H(`Repository`,-1),v.value?F(``,!0):(L(),j(`span`,OO,` (optional)`))]),_:1},8,[`for`]),A(V(bO),{id:`${V(i)}-repo`,modelValue:l.value,"onUpdate:modelValue":t[0]||=e=>l.value=e,class:`font-mono`,placeholder:`owner/repository`,options:s.value,required:v.value},null,8,[`id`,`modelValue`,`options`,`required`])])),n.workflow?F(``,!0):(L(),j(`div`,kO,[R(`span`,{id:`Line truncated
`)){let e=n.indexOf(`:`);if(e<=0)continue;let r=n.slice(0,e).trim();r&&(t[r]=n.slice(e+1).trim())}return t}function nk(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 rk(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 ik(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 ak(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 ok=J([]),sk=J([]),ck=J(!0),lk=J(null),uk=J(!0),dk=J(null),fk=J(!1),pk=J(null);async function mk(){try{let e=await Z.eventTypes(ek().workspace);ck.value=e.enabled!==!1,ok.value=e.event_types||[],sk.value=e.proposals||[],lk.value=null}catch(e){lk.value=e.message||String(e)}finally{uk.value=!1}}function hk(e){return{headers:(e.headers||[]).map(e=>({...e})),payload:(e.payload||[]).map(e=>({...e}))}}function gk(e){pk.value=null,dk.value=e}function _k(e){let t=Tk.value.find(t=>String(t.id)===e.sample_id);gk({mode:`proposal`,id:null,source:e.source,name:``,rule:hk(e.rule),headersText:``,body:t?.body||``,exampleHeaders:e.headers||{}})}function vk(e=``){gk({mode:`paste`,id:null,source:e,name:``,rule:{headers:[],payload:[]},headersText:``,body:``,exampleHeaders:{}})}function yk(e){gk({mode:`edit`,id:e.id,source:e.source,name:e.name,rule:hk(e.rule),headersText:``,body:``,exampleHeaders:{}})}function bk(){dk.value=null}async function xk(){let e=dk.value;if(e){fk.value=!0;try{if(e.mode===`edit`&&e.id)await Z.eventTypeUpdate(e.id,{name:e.name,rule:ak(e.rule)});else{let t=e.mode===`paste`?tk(e.headersText):e.exampleHeaders;await Z.eventTypeCreate({source:e.source,name:e.name,rule:e.mode===`paste`?void 0:ak(e.rule),example:{headers:t,body:e.body}})}dk.value=null,await mk()}catch(e){pk.value=e.message||String(e)}finally{fk.value=!1}}}var Sk=J(null);async function Ck(){let e=Sk.value;if(Sk.value=null,e)try{await Z.eventTypeDelete(e.id),await mk()}catch(e){lk.value=e.message||String(e)}}var wk=100,Tk=J([]),Ek=J(!0),Dk=J(null),Ok=J(!0),kk=J(null);async function Ak(){try{let e=await Z.captures(wk);Ek.value=e.enabled!==!1,Tk.value=e.captures||[],Dk.value=null}catch(e){Dk.value=e.message||String(e)}finally{Ok.value=!1}}function jk(e){let t=Tk.value.find(t=>t.id===e);return t&&(kk.value=t),!!t}function Mk(){Tk.value.length&&(kk.value=Tk.value[0])}function Nk(){df(`captures`,()=>{Ak(),mk()})}var Pk=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=St(n,`class`),a=D(i,r);return(e,t)=>(L(),q(V(Ga),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`,He(he(t)))]),_:3},16,[`data-orientation`,`class`]))}}),Fk=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=St(t,`class`);return(e,r)=>(L(),q(V(Ja),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`]))}}),Ik=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=St(t,`class`,`variant`);return(r,i)=>(L(),q(V(Ya),G({"data-slot":`tabs-list`,"data-variant":e.variant},V(n),{class:V(W)(V(Rk)({variant:e.variant}),t.class)}),{default:I(()=>[K(r.$slots,`default`)]),_:3},16,[`data-variant`,`class`]))}}),Lk=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=St(t,`class`),r=w(n);return(e,n)=>(L(),q(V(Xa),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
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 jH=_H(`CharSizeService`),MH=_H(`CoreBrowserService`),NH=_H(`MouseService`),PH=_H(`RenderService`),FH=_H(`SelectionService`),IH=_H(`CharacterJoinerService`),LH=_H(`ThemeService`),RH=_H(`LinkProviderService`),zH=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?GH.isErrorNoTelemetry(e)?new GH(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 IH=SH(`CharSizeService`),LH=SH(`CoreBrowserService`),RH=SH(`MouseService`),zH=SH(`RenderService`),BH=SH(`SelectionService`),VH=SH(`CharacterJoinerService`),HH=SH(`ThemeService`),UH=SH(`LinkProviderService`),WH=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?XH.isErrorNoTelemetry(e)?new XH(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 BH(e){HH(e)||zH.onUnexpectedError(e)}var VH=`Canceled`;function HH(e){return e instanceof UH||e instanceof Error&&e.name===VH&&e.message===VH}var UH=class extends Error{constructor(){super(VH),this.name=this.message}};function WH(e){return Error(e?`Illegal argument: ${e}`:`Illegal argument`)}var GH=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`}},KH=class e extends Error{constructor(t){super(t||`An unexpected bug occurred.`),Object.setPrototypeOf(this,e.prototype)}};function qH(e,t=0){return e[e.length-(1+t)]}var JH;(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})(JH||={});var YH=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||JH.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};YH.empty=new YH(e=>{});function XH(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 ZH;(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})(ZH||={});var QH=null;function $H(e){return QH?.trackDisposable(e),e}function eU(e){QH?.markAsDisposed(e)}function tU(e,t){QH?.setParent(e,t)}function nU(e){return QH?.markAsSingleton(e),e}function rU(e){if(ZH.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 iU(...e){return aU(()=>rU(e))}function aU(e){let t=$H({dispose:XH(()=>{eU(t),e()})});return t}var oU=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,$H(this)}dispose(){this._isDisposed||(eU(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{rU(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return tU(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),tU(e,null))}};oU.DISABLE_DISPOSED_WARNING=!1;var sU=oU,cU=class{constructor(){this._store=new sU,$H(this),tU(this._store,this)}dispose(){eU(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 GH(e){qH(e)||WH.onUnexpectedError(e)}var KH=`Canceled`;function qH(e){return e instanceof JH||e instanceof Error&&e.name===KH&&e.message===KH}var JH=class extends Error{constructor(){super(KH),this.name=this.message}};function YH(e){return Error(e?`Illegal argument: ${e}`:`Illegal argument`)}var XH=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`}},ZH=class e extends Error{constructor(t){super(t||`An unexpected bug occurred.`),Object.setPrototypeOf(this,e.prototype)}};function QH(e,t=0){return e[e.length-(1+t)]}var $H;(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})($H||={});var eU=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||$H.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};eU.empty=new eU(e=>{});function tU(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 nU;(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})(nU||={});var rU=null;function iU(e){return rU?.trackDisposable(e),e}function aU(e){rU?.markAsDisposed(e)}function oU(e,t){rU?.setParent(e,t)}function sU(e){return rU?.markAsSingleton(e),e}function cU(e){if(nU.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 lU(...e){return uU(()=>cU(e))}function uU(e){let t=iU({dispose:tU(()=>{aU(t),e()})});return t}var dU=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,iU(this)}dispose(){this._isDisposed||(aU(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{cU(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return oU(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),oU(e,null))}};dU.DISABLE_DISPOSED_WARNING=!1;var fU=dU,pU=class{constructor(){this._store=new fU,iU(this),oU(this._store,this)}dispose(){aU(thi Line truncated
`).slice(2).join(`
`))}},CU=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},wU=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},TU=0,EU=class{constructor(e){this.value=e,this.id=TU++}},DU=2,OU=class{constructor(e){this._size=0,this._options=e,this._leakageMon=yU>0||this._options?.leakWarningThreshold?new xU(e?.onListenerError??BH,this._options?.leakWarningThreshold??yU):void 0,this._perfMon=this._options?._profName?new vU(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 wU(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||BH)(n),cU.None}if(this._disposed)return cU.None;t&&(e=e.bind(t));let r=new EU(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=SU.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof EU?(this._deliveryQueue??=new kU,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=aU(()=>{i?.(),this._removeListener(r)});return n instanceof sU?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*DU<=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||BH;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 EU)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}},kU=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}},AU=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new OU,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new OU,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}};AU.INSTANCE=new AU;var jU=AU;function MU(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}jU.INSTANCE.onDidChangeZoomLevel;function NU(e){return jU.INSTANCE.getZoomFactor(e)}jU.INSTANCE.onDidChangeFullscreen;var PU=typeof navigator==`object`?navigator.userAgent:``,FU=PU.indexOf(`Firefox`)>=0,IU=PU.indexOf(`AppleWebKit`)>=0,LU=PU.indexOf(`Chrome`)>=0,RU=!LU&&PU.indexOf(`Safari`)>=0;PU.indexOf(`Electron/`),PU.indexOf(`Android`);var zU=!1;if(typeof uU.matchMedia==`function`){let e=uU.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=uU.matchMedia(`(display-mode: fullscreen)`);zU=e.matches,MU(uU,e,({matches:e})=>{zU&&t.matches||(zU=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}};FG=GV([KV(2,yH),KV(3,MH),KV(4,bH),KV(5,LH),KV(6,TH),KV(7,PH)],FG);var IG=class extends cU{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(aU(()=>{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 HG;(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=`Ÿ`))(HG||={});var UG;(e=>e.ST=`${$.ESC}\\`)(UG||={});var WG=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)}}};WG=GV([KV(2,yH),KV(3,TH),KV(4,xH),KV(5,PH)],WG);var GG=0,KG=0,qG=0,JG=0,YG={css:`#00000000`,rgba:0},XG;(e=>{function t(e,t,n,r){return r===void 0?`#${tK(e)}${tK(t)}${tK(n)}`:`#${tK(e)}${tK(t)}${tK(n)}${tK(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})(XG||={});var ZG;(e=>{function t(e,t){if(JG=(t.rgba&255)/255,JG===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 GG=a+Math.round((n-a)*JG),KG=o+Math.round((r-o)*JG),qG=s+Math.round((i-s)*JG),{css:XG.toCss(GG,KG,qG),rgba:XG.toRgba(GG,KG,qG)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=eK.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return XG.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[GG,KG,qG]=eK.toChannels(t),{css:XG.toCss(GG,KG,qG),rgba:t}}e.opaque=i;function a(e,t){return JG=Math.round(t*255),[GG,KG,qG]=eK.toChannels(e.rgba),{css:XG.toCss(GG,KG,qG,JG),rgba:XG.toRgba(GG,KG,qG,JG)}}e.opacity=a;function o(e,t){return JG=e.rgba&255,a(e,JG*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.r Line truncated
`))}},OU=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},kU=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},AU=0,jU=class{constructor(e){this.value=e,this.id=AU++}},MU=2,NU=class{constructor(e){this._size=0,this._options=e,this._leakageMon=wU>0||this._options?.leakWarningThreshold?new EU(e?.onListenerError??GH,this._options?.leakWarningThreshold??wU):void 0,this._perfMon=this._options?._profName?new CU(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 kU(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||GH)(n),pU.None}if(this._disposed)return pU.None;t&&(e=e.bind(t));let r=new jU(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=DU.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof jU?(this._deliveryQueue??=new PU,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=uU(()=>{i?.(),this._removeListener(r)});return n instanceof fU?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*MU<=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||GH;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 jU)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}},PU=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 NU,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new NU,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 IU=FU;function LU(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}IU.INSTANCE.onDidChangeZoomLevel;function RU(e){return IU.INSTANCE.getZoomFactor(e)}IU.INSTANCE.onDidChangeFullscreen;var zU=typeof navigator==`object`?navigator.userAgent:``,BU=zU.indexOf(`Firefox`)>=0,VU=zU.indexOf(`AppleWebKit`)>=0,HU=zU.indexOf(`Chrome`)>=0,UU=!HU&&zU.indexOf(`Safari`)>=0;zU.indexOf(`Electron/`),zU.indexOf(`Android`);var WU=!1;if(typeof hU.matchMedia==`function`){let e=hU.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=hU.matchMedia(`(display-mode: fullscreen)`);WU=e.matches,LU(hU,e,({matches:e})=>{WU&&t.matches||(WU=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}};BG=XV([ZV(2,wH),ZV(3,LH),ZV(4,TH),ZV(5,HH),ZV(6,AH),ZV(7,zH)],BG);var VG=class extends pU{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(uU(()=>{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 qG;(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=`Ÿ`))(qG||={});var JG;(e=>e.ST=`${$.ESC}\\`)(JG||={});var YG=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)}}};YG=XV([ZV(2,wH),ZV(3,AH),ZV(4,EH),ZV(5,zH)],YG);var XG=0,ZG=0,QG=0,$G=0,eK={css:`#00000000`,rgba:0},tK;(e=>{function t(e,t,n,r){return r===void 0?`#${oK(e)}${oK(t)}${oK(n)}`:`#${oK(e)}${oK(t)}${oK(n)}${oK(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})(tK||={});var nK;(e=>{function t(e,t){if($G=(t.rgba&255)/255,$G===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 XG=a+Math.round((n-a)*$G),ZG=o+Math.round((r-o)*$G),QG=s+Math.round((i-s)*$G),{css:tK.toCss(XG,ZG,QG),rgba:tK.toRgba(XG,ZG,QG)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=aK.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return tK.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[XG,ZG,QG]=aK.toChannels(t),{css:tK.toCss(XG,ZG,QG),rgba:t}}e.opaque=i;function a(e,t){return $G=Math.round(t*255),[XG,ZG,QG]=aK.toChannels(e.rgba),{css:tK.toCss(XG,ZG,QG,$G),rgba:tK.toRgba(XG,ZG,QG,$G)}}e.opacity=a;function o(e,t){return $G=e.rgba&255,a(e,$G*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()),KK&&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=hq(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=AK(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,-gq),gq),t/=gq,t/Math.abs(t)+Math.round(t*(_q-1)))}shouldForceSelection(e){return HK?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(),vq)}_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&&!(HK&&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(GW(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(aU(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<vY+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===vY+1&&(this._liveRegion.textContent+=XV.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 JV.get()},set promptLabel(e){JV.set(e)},get tooMuchOutput(){return XV.get()},set tooMuchOutput(e){XV.set(e)}}}_verifyIntegers(...e){for(jY of e)if(jY===1/0||isNaN(jY)||jY%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(jY of e)if(jY&&(jY===1/0||isNaN(jY)||jY%1!=0||jY<0))throw Error(`This API only accepts positive integers`)}},NY=2,PY=1,FY=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(NY,Math.floor(u/e.css.cell.width)),rows:Math.max(PY,Math.floor(l/e.css.cell.height))}}},IY={class:`flex h-[32rem] min-h-0 flex-col gap-2`},LY={key:0,class:`text-sm text-fg-muted`,role:`status`},RY=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 Fe(()=>{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 FY,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)}),Ze(()=>{s?.disconnect(),s=null,a?.close(),a=null,i?.dispose(),i=null,o=null}),(e,t)=>(L(),j(`div`,IY,[r.value===`open`?F(``,!0):(L(),j(`p`,LY,[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)]))}}),zY={class:`flex flex-wrap items-center gap-3 border-b border-border pb-3`},BY={class:`inline-flex items-center gap-2`},VY={class:`inline-flex items-center gap-2`},HY=`__all__`,UY=P({__name:`TaskLogFilters`,props:{filters:{},stages:{}},emits:[`filter`],setup(e,{emit:t}){let n=e,r=t,i=Y(()=>yN.map(e=>({value:e.value||HY,label:e.label}))),a=Y(()=>n.filters.level||HY),o=Y(()=>n.filters.stage||HY);function s(e){r(`filter`,{...n.filters,...e})}function c(e){s({level:String(e)===HY?``:String(e)})}function l(e){s({stage:String(e)===HY?``:String(e)})}return(t,n)=>(L(),j(`div`,zY,[R(`div`,BY,[A(V(Wu),{"model-value":a.value,"onUpdate:modelValue":c},{default:I(()=>[A(V(Ju),{size:`sm`,"aria-label":`Filter log entries by level`},{default:I(()=>[A(V(Yu))]),_:1}),A(V(Gu),null,{default:I(()=>[A(V(Ku),null,{default:I(()=>[(L(!0),j(U,null,M(i.value,e=>(L(),q(V(qu),{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`,VY,[A(V(Wu),{"model-value":o.value,"onUpdate:modelValue":l},{default:I(()=>[A(V(Ju),{size:`sm`,"aria-label":`Filter log entries by stage`},{default:I(()=>[A(V(Yu))]),_:1}),A(V(Gu),null,{default:I(()=>[A(V(Ku),null,{default:I(()=>[A(V(qu),{value:HY},{default:I(()=>[...n[0]||=[H(`All stages`,-1)]]),_:1}),(L(!0),j(U,null,M(e.stages,e=>(L(),q(V(qu),{key:e,value:e},{default:I(()=>[H(B(e),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`model-value`])])]))}}),WY={class:`sr-only`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`},GY={key:2,class:`flex flex-col items-start gap-2 py-3`},KY={key:0,class:`mt-2 flex flex-wrap items-cent Line truncated
`)}};rQ.defaultYaml={explicit:!1,version:`1.2`},rQ.defaultTags={"!!":`tag:yaml.org,2002:`};function iQ(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 aQ(e){let t=new Set;return XZ(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function oQ(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function sQ(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=aQ(e);let a=oQ(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(HZ(t.node)||WZ(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 cQ(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=cQ(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=cQ(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=cQ(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=cQ(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function lQ(e,t,n){if(Array.isArray(e))return e.map((e,t)=>lQ(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!KZ(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 uQ=class{constructor(e){Object.defineProperty(this,LZ,{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(!zZ(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=lQ(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?cQ(i,{"":o},``,o):o}},dQ=class extends uQ{constructor(e){super(jZ),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=[],XZ(e,{Node:(e,t)=>{(RZ(t)||KZ(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||=(lQ(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=fQ(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(iQ(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 fQ(e,t,n){if(RZ(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(WZ(t)){let r=0;for(let i of t.items){let t=fQ(e,i,n);t>r&&(r=t)}return r}if(VZ(t)){let r=fQ(e,t.key,n),i=fQ(e,t.value,n);return Math.max(r,i)}return 1}var pQ=e=>!e||typeof e!=`function`&&typeof e!=`object`,mQ=class extends uQ{constructor(e){super(FZ),this.value=e}toJSON(e,t){return t?.keep?this.value:lQ(this.value,e,t)}toString(){return String(this.value)}};mQ.BLOCK_FOLDED=`BLOCK_FOLDED`,mQ.BLOCK_LITERAL=`BLOCK_LITERAL`,mQ.PLAIN=`PLAIN`,mQ.QUOTE_DOUBLE=`QUOTE_DOUBLE`,mQ.QUOTE_SINGLE=`QUOTE_SINGLE`;var hQ=`tag:yaml.org,2002:`;function gQ(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 _Q(e,t,n){if(zZ(e)&&(e=e.contents),GZ(e))return e;if(VZ(e)){let t=n.schema[NZ].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 dQ(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=hQ+t.slice(2));let l=gQ(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new mQ(e);return c&&(c.node=t),t Line truncated
`)?SQ(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()),ZK&&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=bq(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,-xq),xq),t/=xq,t/Math.abs(t)+Math.round(t*(Sq-1)))}shouldForceSelection(e){return qK?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(),Cq)}_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&&!(qK&&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(XW(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(uU(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<CY+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===CY+1&&(this._liveRegion.textContent+=tH.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 $V.get()},set promptLabel(e){$V.set(e)},get tooMuchOutput(){return tH.get()},set tooMuchOutput(e){tH.set(e)}}}_verifyIntegers(...e){for(IY of e)if(IY===1/0||isNaN(IY)||IY%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(IY of e)if(IY&&(IY===1/0||isNaN(IY)||IY%1!=0||IY<0))throw Error(`This API only accepts positive integers`)}},RY=2,zY=1,BY=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(RY,Math.floor(u/e.css.cell.width)),rows:Math.max(zY,Math.floor(l/e.css.cell.height))}}},VY={class:`flex h-[32rem] min-h-0 flex-col gap-2`},HY={key:0,class:`text-sm text-fg-muted`,role:`status`},UY=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 Fe(()=>{let e=n.value;if(!e)return;i=new LY({convertEol:!0,disableStdin:!0,cursorBlink:!1,fontFamily:`'IBM Plex Mono', ui-monospace, monospace`,fontSize:13,theme:{background:`#0b0f14`,foreground:`#e6edf3`}}),o=new BY,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)}),Ze(()=>{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`,HY,[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)]))}}),WY={class:`flex flex-wrap items-center gap-3 border-b border-border pb-3`},GY={class:`inline-flex items-center gap-2`},KY={class:`inline-flex items-center gap-2`},qY=`__all__`,JY=P({__name:`TaskLogFilters`,props:{filters:{},stages:{}},emits:[`filter`],setup(e,{emit:t}){let n=e,r=t,i=Y(()=>mN.map(e=>({value:e.value||qY,label:e.label}))),a=Y(()=>n.filters.level||qY),o=Y(()=>n.filters.stage||qY);function s(e){r(`filter`,{...n.filters,...e})}function c(e){s({level:String(e)===qY?``:String(e)})}function l(e){s({stage:String(e)===qY?``:String(e)})}return(t,n)=>(L(),j(`div`,WY,[R(`div`,GY,[A(V(Hu),{"model-value":a.value,"onUpdate:modelValue":c},{default:I(()=>[A(V(Ku),{size:`sm`,"aria-label":`Filter log entries by level`},{default:I(()=>[A(V(qu))]),_:1}),A(V(Uu),null,{default:I(()=>[A(V(Wu),null,{default:I(()=>[(L(!0),j(U,null,M(i.value,e=>(L(),q(V(Gu),{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`,KY,[A(V(Hu),{"model-value":o.value,"onUpdate:modelValue":l},{default:I(()=>[A(V(Ku),{size:`sm`,"aria-label":`Filter log entries by stage`},{default:I(()=>[A(V(qu))]),_:1}),A(V(Uu),null,{default:I(()=>[A(V(Wu),null,{default:I(()=>[A(V(Gu),{value:qY},{default:I(()=>[...n[0]||=[H(`All stages`,-1)]]),_:1}),(L(!0),j(U,null,M(e.stages,e=>(L(),q(V(Gu),{key:e,value:e},{default:I(()=>[H(B(e),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`model-value`])])]))}}),YY={class:`sr-only`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`},XY={key:2,class:`flex flex-col items-start gap-2 py-3`},ZY={key:0,class:`mt-2 flex flex-wrap items-cent Line truncated
`)}};cQ.defaultYaml={explicit:!1,version:`1.2`},cQ.defaultTags={"!!":`tag:yaml.org,2002:`};function lQ(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 uQ(e){let t=new Set;return tQ(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function dQ(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function fQ(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=uQ(e);let a=dQ(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(qZ(t.node)||YZ(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 pQ(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=pQ(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=pQ(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=pQ(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=pQ(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function mQ(e,t,n){if(Array.isArray(e))return e.map((e,t)=>mQ(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!ZZ(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 hQ=class{constructor(e){Object.defineProperty(this,HZ,{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(!WZ(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=mQ(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?pQ(i,{"":o},``,o):o}},gQ=class extends hQ{constructor(e){super(IZ),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=[],tQ(e,{Node:(e,t)=>{(UZ(t)||ZZ(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||=(mQ(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=_Q(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(lQ(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 _Q(e,t,n){if(UZ(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(YZ(t)){let r=0;for(let i of t.items){let t=_Q(e,i,n);t>r&&(r=t)}return r}if(KZ(t)){let r=_Q(e,t.key,n),i=_Q(e,t.value,n);return Math.max(r,i)}return 1}var vQ=e=>!e||typeof e!=`function`&&typeof e!=`object`,yQ=class extends hQ{constructor(e){super(BZ),this.value=e}toJSON(e,t){return t?.keep?this.value:mQ(this.value,e,t)}toString(){return String(this.value)}};yQ.BLOCK_FOLDED=`BLOCK_FOLDED`,yQ.BLOCK_LITERAL=`BLOCK_LITERAL`,yQ.PLAIN=`PLAIN`,yQ.QUOTE_DOUBLE=`QUOTE_DOUBLE`,yQ.QUOTE_SINGLE=`QUOTE_SINGLE`;var bQ=`tag:yaml.org,2002:`;function xQ(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 SQ(e,t,n){if(WZ(e)&&(e=e.contents),XZ(e))return e;if(KZ(e)){let t=n.schema[RZ].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 gQ(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=bQ+t.slice(2));let l=xQ(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new yQ(e);return c&&(c.node=t),t Line truncated
`)?DQ(n,t):n.includes(`
`)?`
`+SQ(n,t):(e.endsWith(` `)?``:` `)+n,wQ=`flow`,TQ=`block`,EQ=`quoted`;function DQ(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=OQ(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=OQ(e,h,t.length)),d=h+t.length+c,f=void 0;else{if(r===` `&&p&&p!==` `&&p!==`
`+DQ(n,t):(e.endsWith(` `)?``:` `)+n,kQ=`flow`,AQ=`block`,jQ=`quoted`;function MQ(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=NQ(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=NQ(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 OQ(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 kQ=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),AQ=e=>/^(%|---|\.\.\.)/m.test(e);function jQ(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 MQ(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(AQ(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 NQ(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 PQ=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),FQ=e=>/^(%|---|\.\.\.)/m.test(e);function IQ(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 LQ(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(FQ(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:DQ(o,a,EQ,kQ(t,!1))}function NQ(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
`)||/[ \t]\n|\n[ \t]/.test(e))return MQ(e,t);let n=t.indent||(AQ(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:DQ(r,n,wQ,kQ(t,!1))}function PQ(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=MQ;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?NQ:i&&!t?MQ:n?NQ:MQ}return r(e,t)}var FQ;try{FQ=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:MQ(o,a,jQ,PQ(t,!1))}function RQ(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
`)||/[ \t]\n|\n[ \t]/.test(e))return LQ(e,t);let n=t.indent||(FQ(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:MQ(r,n,kQ,PQ(t,!1))}function zQ(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=LQ;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?RQ:i&&!t?LQ:n?RQ:LQ}return r(e,t)}var BQ;try{BQ=RegExp(`(^|(?<!
))
+(?!
|$)`,`g`)}catch{FQ=/\n+(?!\n|$)/g}function IQ({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 PQ(n,r);let l=r.indent||(r.forceBlockIndent||AQ(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===mQ.BLOCK_FOLDED?!1:t===mQ.BLOCK_LITERAL||!jQ(n,c,l.length);if(!n)return u?`|
|$)`,`g`)}catch{BQ=/\n+(?!\n|$)/g}function VQ({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 zQ(n,r);let l=r.indent||(r.forceBlockIndent||FQ(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===yQ.BLOCK_FOLDED?!1:t===yQ.BLOCK_LITERAL||!IQ(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(FQ,`$&${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(BQ,`$&${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=kQ(r,!0);o!==`folded`&&t!==mQ.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=DQ(`${v}${e}${p}`,l,TQ,a);if(!i)return`>${y}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${y}\n${l}${v}${n}${p}`}function LQ(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 PQ(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
`)?PQ(a,t):IQ(e,t,n,r);if(!s&&!u&&i!==mQ.PLAIN&&a.includes(`
`))return IQ(e,t,n,r);if(AQ(a)){if(c===``)return t.forceBlockIndent=!0,IQ(e,t,n,r);if(s&&c===l)return PQ(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 PQ(a,t)}return s?d:DQ(d,c,wQ,kQ(t,!1))}function RQ(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!==mQ.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=mQ.QUOTE_DOUBLE);let c=e=>{switch(e){case mQ.BLOCK_FOLDED:case mQ.BLOCK_LITERAL:return i||a?PQ(o.value,t):IQ(o,t,n,r);case mQ.QUOTE_DOUBLE:return MQ(o.value,t);case mQ.QUOTE_SINGLE:return NQ(o.value,t);case mQ.PLAIN:return LQ(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 zQ(e,t){let n=Object.assign({blockQuote:!0,commentString:xQ,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 BQ(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(HZ(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 VQ(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(HZ(e)||WZ(e))&&e.anchor;a&&iQ(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 HQ(e,t,n,r){if(VZ(e))return e.toString(t,n,r);if(RZ(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=GZ(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=BQ(t.doc.schema.tags,a);let o=VQ(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):HZ(a)?RQ(a,t,n,r):a.toString(t,n,r);return o?HZ(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function Kie({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=GZ(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(WZ(e)||!GZ(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||WZ(e)||(HZ(e)?e.type===mQ.BLOCK_FOLDED||e.type===mQ.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=HQ(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+=CQ(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=CQ(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=CQ(g,n.indent,l(f))));let _,v,y;GZ(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&&HZ(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&UZ(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let b=!1,x=HQ(t,n,()=>b=!0,()=>h=!0),S=` `;if(f||_||v){if(S=_?`
`:``,v){let e=l(v);S+=`\n${SQ(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=PQ(r,!0);o!==`folded`&&t!==yQ.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=MQ(`${v}${e}${p}`,l,AQ,a);if(!i)return`>${y}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${y}\n${l}${v}${n}${p}`}function Zie(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 zQ(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
`)?zQ(a,t):VQ(e,t,n,r);if(!s&&!u&&i!==yQ.PLAIN&&a.includes(`
`))return VQ(e,t,n,r);if(FQ(a)){if(c===``)return t.forceBlockIndent=!0,VQ(e,t,n,r);if(s&&c===l)return zQ(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 zQ(a,t)}return s?d:MQ(d,c,kQ,PQ(t,!1))}function HQ(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!==yQ.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=yQ.QUOTE_DOUBLE);let c=e=>{switch(e){case yQ.BLOCK_FOLDED:case yQ.BLOCK_LITERAL:return i||a?zQ(o.value,t):VQ(o,t,n,r);case yQ.QUOTE_DOUBLE:return LQ(o.value,t);case yQ.QUOTE_SINGLE:return RQ(o.value,t);case yQ.PLAIN:return Zie(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 UQ(e,t){let n=Object.assign({blockQuote:!0,commentString:EQ,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 WQ(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(qZ(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 GQ(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(qZ(e)||YZ(e))&&e.anchor;a&&lQ(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 KQ(e,t,n,r){if(KZ(e))return e.toString(t,n,r);if(UZ(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=XZ(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=WQ(t.doc.schema.tags,a);let o=GQ(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):qZ(a)?HQ(a,t,n,r):a.toString(t,n,r);return o?qZ(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function qQ({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=XZ(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(YZ(e)||!XZ(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||YZ(e)||(qZ(e)?e.type===yQ.BLOCK_FOLDED||e.type===yQ.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=KQ(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+=OQ(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=OQ(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=OQ(g,n.indent,l(f))));let _,v,y;XZ(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&&qZ(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&JZ(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let b=!1,x=KQ(t,n,()=>b=!0,()=>h=!0),S=` `;if(f||_||v){if(S=_?`
`:``,v){let e=l(v);S+=`\n${DQ(e,n.indent)}`}x===``&&!n.inFlow?S===`
`&&y&&(S=`
`):S+=`\n${n.indent}`}else if(!p&&WZ(t)){let e=x[0],r=x.indexOf(`
`):S+=`\n${n.indent}`}else if(!p&&YZ(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+=CQ(g,n.indent,l(y)):h&&i&&i(),g}function UQ(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}var WQ=`<<`,GQ={identify:e=>e===WQ||typeof e==`symbol`&&e.description===WQ,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new mQ(Symbol(WQ)),{addToJSMap:qQ}),stringify:()=>WQ},KQ=(e,t)=>(GQ.identify(t)||HZ(t)&&(!t.type||t.type===mQ.PLAIN)&&GQ.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===GQ.tag&&e.default);function qQ(e,t,n){let r=YQ(e,n);if(UZ(r))for(let n of r.items)JQ(e,t,n);else if(Array.isArray(r))for(let n of r)JQ(e,t,n);else JQ(e,t,r)}function JQ(e,t,n){let r=YQ(e,n);if(!BZ(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 YQ(e,t){return e&&RZ(t)?t.resolve(e.doc,e):t}function XQ(e,t,{key:n,value:r}){if(GZ(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(KQ(e,n))qQ(e,t,r);else{let i=lQ(n,``,e);if(t instanceof Map)t.set(i,lQ(r,i,e));else if(t instanceof Set)t.add(i);else{let a=ZQ(n,i,e),o=lQ(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function ZQ(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(GZ(e)&&n?.doc){let t=zQ(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)+`..."`),UQ(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 QQ(e,t,n){return new $Q(_Q(e,void 0,n),_Q(t,void 0,n))}var $Q=class e{constructor(e,t=null){Object.defineProperty(this,LZ,{value:PZ}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return GZ(n)&&(n=n.clone(t)),GZ(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return XQ(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?Kie(this,e,t,n):JSON.stringify(this)}};function e$(e,t,n){return(t.inFlow??e.flow?n$:t$)(e,t,n)}function t$({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(GZ(i))!d&&i.spaceBefore&&f.push(``),r$(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(VZ(i)){let e=GZ(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),r$(n,f,e.commentBefore,d))}d=!1;let s=HQ(i,u,()=>o=null,()=>d=!0);o&&(s+=CQ(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+=OQ(g,n.indent,l(y)):h&&i&&i(),g}function JQ(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}var YQ=`<<`,XQ={identify:e=>e===YQ||typeof e==`symbol`&&e.description===YQ,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new yQ(Symbol(YQ)),{addToJSMap:QQ}),stringify:()=>YQ},ZQ=(e,t)=>(XQ.identify(t)||qZ(t)&&(!t.type||t.type===yQ.PLAIN)&&XQ.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===XQ.tag&&e.default);function QQ(e,t,n){let r=e$(e,n);if(JZ(r))for(let n of r.items)$Q(e,t,n);else if(Array.isArray(r))for(let n of r)$Q(e,t,n);else $Q(e,t,r)}function $Q(e,t,n){let r=e$(e,n);if(!GZ(r))throw Error(`Merge sources must be maps or map aliases`);let i=r.toJSON(null,e,Map);for(let[e,n]of i)t instanceof Map?t.has(e)||t.set(e,n):t instanceof Set?t.add(e):Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0});return t}function e$(e,t){return e&&UZ(t)?t.resolve(e.doc,e):t}function t$(e,t,{key:n,value:r}){if(XZ(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(ZQ(e,n))QQ(e,t,r);else{let i=mQ(n,``,e);if(t instanceof Map)t.set(i,mQ(r,i,e));else if(t instanceof Set)t.add(i);else{let a=n$(n,i,e),o=mQ(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function n$(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(XZ(e)&&n?.doc){let t=UQ(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)+`..."`),JQ(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 r$(e,t,n){return new i$(SQ(e,void 0,n),SQ(t,void 0,n))}var i$=class e{constructor(e,t=null){Object.defineProperty(this,HZ,{value:zZ}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return XZ(n)&&(n=n.clone(t)),XZ(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return t$(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?qQ(this,e,t,n):JSON.stringify(this)}};function a$(e,t,n){return(t.inFlow??e.flow?s$:o$)(e,t,n)}function o$({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(XZ(i))!d&&i.spaceBefore&&f.push(``),c$(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(KZ(i)){let e=XZ(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),c$(n,f,e.commentBefore,d))}d=!1;let s=KQ(i,u,()=>o=null,()=>d=!0);o&&(s+=OQ(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+=`
`+SQ(l(e),c),s&&s()):d&&o&&o(),p}function n$({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(GZ(i))i.spaceBefore&&d.push(``),r$(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(VZ(i)){let e=GZ(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),r$(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=GZ(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=HQ(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+=CQ(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 r$({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=SQ(t(r),e);n.push(i.trimStart())}}function i$(e,t){let n=HZ(t)?t.value:t;for(let r of e)if(VZ(r)&&(r.key===t||r.key===n||HZ(r.key)&&r.key.value===n))return r}var a$=class extends bQ{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(NZ,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(QQ(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=VZ(e)?e:!e||typeof e!=`object`||!(`key`in e)?new $Q(e,e?.value):new $Q(e.key,e.value);let r=i$(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);HZ(r.value)&&pQ(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=i$(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=i$(this.items,e)?.value;return(!t&&HZ(n)?n.value:n)??void 0}has(e){return!!i$(this.items,e)}set(e,t){this.add(new $Q(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)XQ(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!VZ(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})),e$(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},o$={collection:`map`,default:!0,nodeClass:a$,tag:`tag:yaml.org,2002:map`,resolve(e,t){return BZ(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>a$.from(e,t,n)},s$=class extends bQ{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(IZ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=c$(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=c$(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&HZ(r)?r.value:r}has(e){let t=c$(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=c$(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];HZ(r)&&pQ(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(lQ(e,String(r++),t));return n}toString(e,t,n){return e?e$(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(_Q(a,void 0,n))}}return i}};function c$(e){let t=HZ(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var l$={collection:`seq`,default:!0,nodeClass:s$,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return UZ(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>s$.from(e,t,n)},u$={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),RQ(e,t,n,r)}},d$={identify:e=>e==null,createNode:()=>new mQ(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new mQ(null),stringify:({source:e},t)=>typeof e==`string`&&d$.test.test(e)?e:t.options.nullStr},f$={identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new mQ(e[0]===`t`||e[0]===`T`),stringify({source:e,value:t},n){return e&&f$.test.test(e)&&t===(e[0]===`t`||e[0]===`T`)?e:t?n.options.trueStr:n.options.falseStr}};function p$({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 m$={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:p$},h$={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 RQ({comment:e,type:t,value:s},r,i,a)}};function k$(e,t){if(UZ(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!VZ(r)){if(BZ(r)){r.items.length>1&&t(`Each pair must have its own sequence indicator`);let e=r.items[0]||new $Q(new mQ(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]=VZ(r)?r:new $Q(r)}}else t(`Expected a sequence for this tag`);return e}function A$(e,t,n){let{replacer:r}=n,i=new s$(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(QQ(o,s,n))}return i}var j$={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:k$,createNode:A$},M$=class e extends s${constructor(){super(),this.add=a$.prototype.add.bind(this),this.delete=a$.prototype.delete.bind(this),this.get=a$.prototype.get.bind(this),this.has=a$.prototype.has.bind(this),this.set=a$.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(VZ(e)?(r=lQ(e.key,``,t),i=lQ(e.value,r,t)):r=lQ(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=A$(e,t,n),i=new this;return i.items=r.items,i}};M$.tag=`tag:yaml.org,2002:omap`;var N$={collection:`seq`,identify:e=>e instanceof Map,nodeClass:M$,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,t){let n=k$(e,t),r=[];for(let{key:e}of n.items)HZ(e)&&(r.includes(e.value)?t(`Ordered maps must not include duplicate keys: ${e.value}`):r.push(e.value));return Object.assign(new M$,n)},createNode:(e,t,n)=>M$.from(e,t,n)};function P$({value:e,source:t},n){return t&&(e?F$:I$).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var F$={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 mQ(!0),stringify:P$},I$={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 mQ(!1),stringify:P$},L$={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:p$},R$={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():p$(e)}},z$={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 mQ(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:p$},B$=e=>typeof e==`bigint`||Number.isInteger(e);function V$(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 H$(e,t,n){let{value:r}=e;if(B$(r)){let e=r.toString(t);return r<0?`-`+n+e.substr(1):n+e}return p$(e)}var U$={identify:B$,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>V$(e,2,2,n),stringify:e=>H$(e,2,`0b`)},W$={identify:B$,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>V$(e,1,8,n),stringify:e=>H$(e,8,`0`)},G$={identify:B$,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>V$(e,0,10,n),stringify:p$},K$={identify:B$,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>V$(e,2,16,n),stringify:e=>H$(e,16,`0x`)},q$=class e extends a${constructor(t){super(t),this.tag=e.tag}add(e){let t;t=VZ(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new $Q(e.key,null):new $Q(e,null),i$(this.items,t.key)||this.items.push(t)}get(e,t){let n=i$(this.items,e);return!t&&VZ(n)?HZ(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=i$(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new $Q(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(SQ(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(SQ(a(t),``)))}return n.join(`
`+DQ(l(e),c),s&&s()):d&&o&&o(),p}function s$({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(XZ(i))i.spaceBefore&&d.push(``),c$(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(KZ(i)){let e=XZ(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),c$(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=XZ(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=KQ(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+=OQ(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 c$({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=DQ(t(r),e);n.push(i.trimStart())}}function l$(e,t){let n=qZ(t)?t.value:t;for(let r of e)if(KZ(r)&&(r.key===t||r.key===n||qZ(r.key)&&r.key.value===n))return r}var u$=class extends TQ{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(RZ,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(r$(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=KZ(e)?e:!e||typeof e!=`object`||!(`key`in e)?new i$(e,e?.value):new i$(e.key,e.value);let r=l$(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);qZ(r.value)&&vQ(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=l$(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=l$(this.items,e)?.value;return(!t&&qZ(n)?n.value:n)??void 0}has(e){return!!l$(this.items,e)}set(e,t){this.add(new i$(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)t$(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!KZ(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})),a$(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},d$={collection:`map`,default:!0,nodeClass:u$,tag:`tag:yaml.org,2002:map`,resolve(e,t){return GZ(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>u$.from(e,t,n)},f$=class extends TQ{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(VZ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=p$(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=p$(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&qZ(r)?r.value:r}has(e){let t=p$(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=p$(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];qZ(r)&&vQ(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(mQ(e,String(r++),t));return n}toString(e,t,n){return e?a$(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(SQ(a,void 0,n))}}return i}};function p$(e){let t=qZ(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var m$={collection:`seq`,default:!0,nodeClass:f$,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return JZ(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>f$.from(e,t,n)},h$={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),HQ(e,t,n,r)}},g$={identify:e=>e==null,createNode:()=>new yQ(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new yQ(null),stringify:({source:e},t)=>typeof e==`string`&&g$.test.test(e)?e:t.options.nullStr},_$={identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new yQ(e[0]===`t`||e[0]===`T`),stringify({source:e,value:t},n){return e&&_$.test.test(e)&&t===(e[0]===`t`||e[0]===`T`)?e:t?n.options.trueStr:n.options.falseStr}};function v$({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 y$={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:v$},b$={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 HQ({comment:e,type:t,value:s},r,i,a)}};function P$(e,t){if(JZ(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!KZ(r)){if(GZ(r)){r.items.length>1&&t(`Each pair must have its own sequence indicator`);let e=r.items[0]||new i$(new yQ(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]=KZ(r)?r:new i$(r)}}else t(`Expected a sequence for this tag`);return e}function F$(e,t,n){let{replacer:r}=n,i=new f$(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(r$(o,s,n))}return i}var I$={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:P$,createNode:F$},L$=class e extends f${constructor(){super(),this.add=u$.prototype.add.bind(this),this.delete=u$.prototype.delete.bind(this),this.get=u$.prototype.get.bind(this),this.has=u$.prototype.has.bind(this),this.set=u$.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(KZ(e)?(r=mQ(e.key,``,t),i=mQ(e.value,r,t)):r=mQ(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=F$(e,t,n),i=new this;return i.items=r.items,i}};L$.tag=`tag:yaml.org,2002:omap`;var R$={collection:`seq`,identify:e=>e instanceof Map,nodeClass:L$,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,t){let n=P$(e,t),r=[];for(let{key:e}of n.items)qZ(e)&&(r.includes(e.value)?t(`Ordered maps must not include duplicate keys: ${e.value}`):r.push(e.value));return Object.assign(new L$,n)},createNode:(e,t,n)=>L$.from(e,t,n)};function z$({value:e,source:t},n){return t&&(e?B$:V$).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var B$={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 yQ(!0),stringify:z$},V$={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 yQ(!1),stringify:z$},H$={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:v$},U$={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():v$(e)}},W$={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 yQ(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:v$},G$=e=>typeof e==`bigint`||Number.isInteger(e);function K$(e,t,n,{intAsBigInt:r}){let i=e[0];if((i===`-`||i===`+`)&&(t+=1),e=e.substring(t).replace(/_/g,``),r){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`}let t=BigInt(e);return i===`-`?BigInt(-1)*t:t}let a=parseInt(e,n);return i===`-`?-1*a:a}function q$(e,t,n){let{value:r}=e;if(G$(r)){let e=r.toString(t);return r<0?`-`+n+e.substr(1):n+e}return v$(e)}var J$={identify:G$,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>K$(e,2,2,n),stringify:e=>q$(e,2,`0b`)},Y$={identify:G$,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>K$(e,1,8,n),stringify:e=>q$(e,8,`0`)},X$={identify:G$,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>K$(e,0,10,n),stringify:v$},Z$={identify:G$,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>K$(e,2,16,n),stringify:e=>q$(e,16,`0x`)},Q$=class e extends u${constructor(t){super(t),this.tag=e.tag}add(e){let t;t=KZ(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new i$(e.key,null):new i$(e,null),l$(this.items,t.key)||this.items.push(t)}get(e,t){let n=l$(this.items,e);return!t&&KZ(n)?qZ(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=l$(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new i$(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(DQ(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(DQ(a(t),``)))}return n.join(`
`)+`
`}var c1=class e{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,LZ,{value:MZ});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 rQ({version:a}),this.setSchema(a,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){let t=Object.create(e.prototype,{[LZ]:{value:MZ}});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=GZ(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(e){l1(this.contents)&&this.contents.add(e)}addIn(e,t){l1(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=aQ(this);e.anchor=!t||n.has(t)?oQ(t||`a`,n):t}return new dQ(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}=sQ(this,a||`a`),p={aliasDuplicateObjects:i??!0,keepUndefined:s??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:f},m=_Q(e,l,p);return o&&WZ(m)&&(m.flow=!0),d(),m}createPair(e,t,n={}){return new $Q(this.createNode(e,null,n),this.createNode(t,null,n))}delete(e){return l1(this.contents)?this.contents.delete(e):!1}deleteIn(e){return yQ(e)?this.contents!=null&&(this.contents=null,!0):l1(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return WZ(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return yQ(e)?!t&&HZ(this.contents)?this.contents.value:this.contents:WZ(this.contents)?this.contents.getIn(e,t):void 0}has(e){return WZ(this.contents)?this.contents.has(e):!1}hasIn(e){return yQ(e)?this.contents!==void 0:WZ(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=vQ(this.schema,[e],t):l1(this.contents)&&this.contents.set(e,t)}setIn(e,t){yQ(e)?this.contents=t:this.contents==null?this.contents=vQ(this.schema,Array.from(e),t):l1(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 rQ({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 rQ({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 o1(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=lQ(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`?cQ(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 s1(this,e)}};function l1(e){if(WZ(e))return!0;throw Error(`Expected a YAML collection as document contents`)}var u1=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},d1=class extends u1{constructor(e,t,n){super(`YAMLParseError`,e,t,n)}},f1=class extends u1{constructor(e,t,n){super(`YAMLWarning`,e,t,n)}},p1=(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 m1(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 h1(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(h1(t.key)||h1(t.value))return!0}return!1;default:return!0}}function g1(e,t,n){if(t?.type===`flow-collection`){let r=t.end[0];r.indent===e&&(r.source===`]`||r.source===`}`)&&h1(t)&&n(r,`BAD_INDENT`,`Flow end indicator should be more indented than parent`,!0)}}function _1(e,t,n){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let i=typeof r==`function`?r:(e,t)=>e===t||HZ(e)&&HZ(t)&&e.value===t.value;return t.some(e=>i(e.key,n))}var v1=`All mapping items must start at the same column`;function y1({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??a$)(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=m1(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`,v1)),!p.anchor&&!p.tag&&!d){c=p.end,p.comment&&(o.comment?o.comment+=`
`+p.comment:o.comment=p.comment);continue}(p.newlineAfterProp||h1(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`,v1);n.atKey=!0;let h=p.end,g=u?e(n,u,p,i):t(n,h,l,null,p,i);n.schema.compat&&g1(r.indent,u,i),n.atKey=!1,_1(n,o.items,g)&&i(h,`DUPLICATE_KEY`,`Map keys must be unique`);let _=m1(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&&g1(r.indent,f,i),s=c.range[2];let l=new $Q(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 $Q(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 b1({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??s$)(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=m1(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&&g1(r.indent,l,i),s=d.range[2],o.items.push(d)}return o.range=[r.offset,s,c??s],o}function x1(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 S1=`Block collections are not allowed within flow collections`,C1=e=>e&&(e.type===`block-map`||e.type===`block-seq`);function w1({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=r.start.source===`{`,s=o?`flow map`:`flow sequence`,c=new((a?.nodeClass)??(o?a$:s$))(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=m1(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&&h1(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];VZ(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],C1(m)&&i(r.range,`BLOCK_IN_FLOW`,S1)}else{n.atKey=!0;let a=h.end,g=f?e(n,f,h,i):t(n,a,d,null,h,i);C1(f)&&i(g.range,`BLOCK_IN_FLOW`,S1),n.atKey=!1;let _=m1(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?C1(m)&&i(v.range,`BLOCK_IN_FLOW`,S1):_.comment&&(g.comment?g.comment+=`
`+_.comment:g.comment=_.comment);let y=new $Q(g,v);if(n.options.keepSourceTokens&&(y.srcToken=l),o){let e=c;_1(n,e.items,g)&&i(a,`DUPLICATE_KEY`,`Map keys must be unique`),e.items.push(y)}else{let e=new a$(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=x1(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 T1(e,t,n,r,i,a){let o=n.type===`block-map`?y1(e,t,n,r,a):n.type===`block-seq`?b1(e,t,n,r,a):w1(e,t,n,r,a),s=o.constructor;return i===`!`||i===s.tagName?(o.tag=s.tagName,o):(i&&(o.tag=i),o)}function E1(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===a$.tagName&&s===`map`||o===s$.tagName&&s===`seq`)return T1(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),T1(e,t,n,i,o)}let l=T1(e,t,n,i,o,c),u=c.resolve?.(l,e=>i(a,`TAG_RESOLVE_FAILED`,e),t.options)??l,d=GZ(u)?u:new mQ(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=O1(t,e.options.strict,n);if(!i)return{value:``,type:null,comment:``,range:[r,r,r]};let a=i.mode===`>`?mQ.BLOCK_FOLDED:mQ.BLOCK_LITERAL,o=t.source?k1(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 p1=class e{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,HZ,{value:LZ});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 cQ({version:a}),this.setSchema(a,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){let t=Object.create(e.prototype,{[HZ]:{value:LZ}});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=XZ(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(e){m1(this.contents)&&this.contents.add(e)}addIn(e,t){m1(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=uQ(this);e.anchor=!t||n.has(t)?dQ(t||`a`,n):t}return new gQ(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}=fQ(this,a||`a`),p={aliasDuplicateObjects:i??!0,keepUndefined:s??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:f},m=SQ(e,l,p);return o&&YZ(m)&&(m.flow=!0),d(),m}createPair(e,t,n={}){return new i$(this.createNode(e,null,n),this.createNode(t,null,n))}delete(e){return m1(this.contents)?this.contents.delete(e):!1}deleteIn(e){return wQ(e)?this.contents!=null&&(this.contents=null,!0):m1(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return YZ(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return wQ(e)?!t&&qZ(this.contents)?this.contents.value:this.contents:YZ(this.contents)?this.contents.getIn(e,t):void 0}has(e){return YZ(this.contents)?this.contents.has(e):!1}hasIn(e){return wQ(e)?this.contents!==void 0:YZ(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=CQ(this.schema,[e],t):m1(this.contents)&&this.contents.set(e,t)}setIn(e,t){wQ(e)?this.contents=t:this.contents==null?this.contents=CQ(this.schema,Array.from(e),t):m1(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 cQ({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 cQ({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 d1(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=mQ(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`?pQ(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 f1(this,e)}};function m1(e){if(YZ(e))return!0;throw Error(`Expected a YAML collection as document contents`)}var h1=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},g1=class extends h1{constructor(e,t,n){super(`YAMLParseError`,e,t,n)}},_1=class extends h1{constructor(e,t,n){super(`YAMLWarning`,e,t,n)}},v1=(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 y1(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 b1(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(b1(t.key)||b1(t.value))return!0}return!1;default:return!0}}function x1(e,t,n){if(t?.type===`flow-collection`){let r=t.end[0];r.indent===e&&(r.source===`]`||r.source===`}`)&&b1(t)&&n(r,`BAD_INDENT`,`Flow end indicator should be more indented than parent`,!0)}}function S1(e,t,n){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let i=typeof r==`function`?r:(e,t)=>e===t||qZ(e)&&qZ(t)&&e.value===t.value;return t.some(e=>i(e.key,n))}var C1=`All mapping items must start at the same column`;function w1({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??u$)(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=y1(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`,C1)),!p.anchor&&!p.tag&&!d){c=p.end,p.comment&&(o.comment?o.comment+=`
`+p.comment:o.comment=p.comment);continue}(p.newlineAfterProp||b1(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`,C1);n.atKey=!0;let h=p.end,g=u?e(n,u,p,i):t(n,h,l,null,p,i);n.schema.compat&&x1(r.indent,u,i),n.atKey=!1,S1(n,o.items,g)&&i(h,`DUPLICATE_KEY`,`Map keys must be unique`);let _=y1(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&&x1(r.indent,f,i),s=c.range[2];let l=new i$(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 i$(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 T1({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??f$)(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=y1(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&&x1(r.indent,l,i),s=d.range[2],o.items.push(d)}return o.range=[r.offset,s,c??s],o}function E1(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 D1=`Block collections are not allowed within flow collections`,O1=e=>e&&(e.type===`block-map`||e.type===`block-seq`);function k1({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=r.start.source===`{`,s=o?`flow map`:`flow sequence`,c=new((a?.nodeClass)??(o?u$:f$))(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=y1(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&&b1(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];KZ(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],O1(m)&&i(r.range,`BLOCK_IN_FLOW`,D1)}else{n.atKey=!0;let a=h.end,g=f?e(n,f,h,i):t(n,a,d,null,h,i);O1(f)&&i(g.range,`BLOCK_IN_FLOW`,D1),n.atKey=!1;let _=y1(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?O1(m)&&i(v.range,`BLOCK_IN_FLOW`,D1):_.comment&&(g.comment?g.comment+=`
`+_.comment:g.comment=_.comment);let y=new i$(g,v);if(n.options.keepSourceTokens&&(y.srcToken=l),o){let e=c;S1(n,e.items,g)&&i(a,`DUPLICATE_KEY`,`Map keys must be unique`),e.items.push(y)}else{let e=new u$(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=E1(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 A1(e,t,n,r,i,a){let o=n.type===`block-map`?w1(e,t,n,r,a):n.type===`block-seq`?T1(e,t,n,r,a):k1(e,t,n,r,a),s=o.constructor;return i===`!`||i===s.tagName?(o.tag=s.tagName,o):(i&&(o.tag=i),o)}function j1(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===u$.tagName&&s===`map`||o===f$.tagName&&s===`seq`)return A1(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),A1(e,t,n,i,o)}let l=A1(e,t,n,i,o,c),u=c.resolve?.(l,e=>i(a,`TAG_RESOLVE_FAILED`,e),t.options)??l,d=XZ(u)?u:new yQ(u);return d.range=l.range,d.tag=o,c?.format&&(d.format=c.format),d}function M1(e,t,n){let r=t.offset,i=N1(t,e.options.strict,n);if(!i)return{value:``,type:null,comment:``,range:[r,r,r]};let a=i.mode===`>`?yQ.BLOCK_FOLDED:yQ.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?`
`.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===mQ.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===yQ.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 O1({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 k1(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 A1(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=mQ.PLAIN,c=j1(a,l);break;case`single-quoted-scalar`:s=mQ.QUOTE_SINGLE,c=M1(a,l);break;case`double-quoted-scalar`:s=mQ.QUOTE_DOUBLE,c=P1(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=x1(o,u,t,n);return{value:c,type:s,comment:d.comment,range:[r,u,d.offset]}}function j1(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}`),N1(e)}function M1(e,t){return(e[e.length-1]!==`'`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing 'quote`),N1(e.slice(1,-1)).replace(/''/g,`'`)}function N1(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 N1({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 F1(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=yQ.PLAIN,c=I1(a,l);break;case`single-quoted-scalar`:s=yQ.QUOTE_SINGLE,c=L1(a,l);break;case`double-quoted-scalar`:s=yQ.QUOTE_DOUBLE,c=z1(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=E1(o,u,t,n);return{value:c,type:s,comment:d.comment,range:[r,u,d.offset]}}function I1(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}`),R1(e)}function L1(e,t){return(e[e.length-1]!==`'`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing 'quote`),R1(e.slice(1,-1)).replace(/''/g,`'`)}function R1(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 P1(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 z1(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}=F1(e,r);n+=t,r=i}else if(i===`\\`){let i=e[++r],a=I1[i];if(a)n+=a;else if(i===`
`){let{fold:t,offset:i}=B1(e,r);n+=t,r=i}else if(i===`\\`){let i=e[++r],a=V1[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+=L1(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+=H1(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 F1(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 B1(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 I1={0:`\0`,a:`\x07`,b:`\b`,e:`\x1B`,f:`\f`,n:`
`,r:`\r`,t:` `,v:`\v`,N:`…`,_:`\xA0`,L:`\u2028`,P:`\u2029`," ":` `,'"':`"`,"/":`/`,"\\":`\\`," ":` `};function L1(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 R1(e,t,n,r){let{value:i,type:a,comment:o,range:s}=t.type===`block-scalar`?D1(e,t,r):A1(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[FZ]:c?z1(e.schema,i,c,n,r):t.type===`scalar`?B1(e,i,t,r):e.schema[FZ];let u;try{let a=l.resolve(i,e=>r(n??t,`TAG_RESOLVE_FAILED`,e),e.options);u=HZ(a)?a:new mQ(a)}catch(e){let a=e instanceof Error?e.message:String(e);r(n??t,`TAG_RESOLVE_FAILED`,a),u=new mQ(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 z1(e,t,n,r,i){if(n===`!`)return e[FZ];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[FZ])}function B1({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[FZ];if(n.compat){let e=n.compat.find(e=>e.default&&e.test?.test(r))??n[FZ];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 V1(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 H1={composeNode:U1,composeEmptyNode:W1};function U1(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=G1(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=R1(e,t,c,r),s&&(l.anchor=s.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:try{l=E1(H1,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??=W1(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&&(!HZ(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 W1(e,t,n,r,{spaceBefore:i,comment:a,anchor:o,tag:s,end:c},l){let u=R1(e,{type:`scalar`,offset:V1(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 G1({options:e},{offset:t,source:n,end:r},i){let a=new dQ(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=x1(r,o,e.strict,i);return a.range=[t,o,s.offset],s.comment&&(a.comment=s.comment),a}function K1(e,t,{offset:n,start:r,value:i,end:a},o){let s=new c1(void 0,Object.assign({_directives:t},e)),c={atKey:!1,atRoot:!0,directives:s.directives,options:s.options,schema:s.schema},l=m1(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?U1(c,i,l,o):W1(c,l.end,r,null,l,o);let u=s.contents.range[2],d=x1(a,u,!1,o);return d.comment&&(s.comment=d.comment),s.range=[n,u,d.offset],s}function q1(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 J1(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 V1={0:`\0`,a:`\x07`,b:`\b`,e:`\x1B`,f:`\f`,n:`
`,r:`\r`,t:` `,v:`\v`,N:`…`,_:`\xA0`,L:`\u2028`,P:`\u2029`," ":` `,'"':`"`,"/":`/`,"\\":`\\`," ":` `};function H1(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 U1(e,t,n,r){let{value:i,type:a,comment:o,range:s}=t.type===`block-scalar`?M1(e,t,r):F1(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[BZ]:c?W1(e.schema,i,c,n,r):t.type===`scalar`?G1(e,i,t,r):e.schema[BZ];let u;try{let a=l.resolve(i,e=>r(n??t,`TAG_RESOLVE_FAILED`,e),e.options);u=qZ(a)?a:new yQ(a)}catch(e){let a=e instanceof Error?e.message:String(e);r(n??t,`TAG_RESOLVE_FAILED`,a),u=new yQ(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 W1(e,t,n,r,i){if(n===`!`)return e[BZ];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[BZ])}function G1({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[BZ];if(n.compat){let e=n.compat.find(e=>e.default&&e.test?.test(r))??n[BZ];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 K1(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 q1={composeNode:J1,composeEmptyNode:Y1};function J1(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=X1(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=U1(e,t,c,r),s&&(l.anchor=s.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:try{l=j1(q1,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??=Y1(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&&(!qZ(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 Y1(e,t,n,r,{spaceBefore:i,comment:a,anchor:o,tag:s,end:c},l){let u=U1(e,{type:`scalar`,offset:K1(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 X1({options:e},{offset:t,source:n,end:r},i){let a=new gQ(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=E1(r,o,e.strict,i);return a.range=[t,o,s.offset],s.comment&&(a.comment=s.comment),a}function Z1(e,t,{offset:n,start:r,value:i,end:a},o){let s=new p1(void 0,Object.assign({_directives:t},e)),c={atKey:!1,atRoot:!0,directives:s.directives,options:s.options,schema:s.schema},l=y1(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?J1(c,i,l,o):Y1(c,l.end,r,null,l,o);let u=s.contents.range[2],d=E1(a,u,!1,o);return d.comment&&(s.comment=d.comment),s.range=[n,u,d.offset],s}function Q1(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 $1(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 Y1=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,n,r)=>{let i=q1(e);r?this.warnings.push(new f1(i,t,n)):this.errors.push(new d1(i,t,n))},this.directives=new rQ({version:e.version||`1.2`}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=J1(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(WZ(i)&&!i.flow&&i.items.length>0){let e=i.items[0];VZ(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:J1(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=q1(e);i[0]+=t,this.onError(i,`BAD_DIRECTIVE`,n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case`document`:{let t=K1(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 d1(q1(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 d1(q1(e),`UNEXPECTED_TOKEN`,`Unexpected doc-end without preceding document`));break}this.doc.directives.docEnd=!0;let t=x1(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 d1(q1(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 c1(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}}},X1=Symbol(`break visit`),Z1=Symbol(`skip children`),Q1=Symbol(`remove item`);function $1(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),e0(Object.freeze([]),e,t)}$1.BREAK=X1,$1.SKIP=Z1,$1.REMOVE=Q1,$1.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},$1.parentCollection=(e,t)=>{let n=$1.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 e0(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=e0(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===X1)return X1;else r===Q1&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}function t0(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 e0=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,n,r)=>{let i=Q1(e);r?this.warnings.push(new _1(i,t,n)):this.errors.push(new g1(i,t,n))},this.directives=new cQ({version:e.version||`1.2`}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=$1(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(YZ(i)&&!i.flow&&i.items.length>0){let e=i.items[0];KZ(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:$1(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=Q1(e);i[0]+=t,this.onError(i,`BAD_DIRECTIVE`,n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case`document`:{let t=Z1(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 g1(Q1(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 g1(Q1(e),`UNEXPECTED_TOKEN`,`Unexpected doc-end without preceding document`));break}this.doc.directives.docEnd=!0;let t=E1(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 g1(Q1(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 p1(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}}},t0=Symbol(`break visit`),n0=Symbol(`skip children`),r0=Symbol(`remove item`);function i0(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),a0(Object.freeze([]),e,t)}i0.BREAK=t0,i0.SKIP=n0,i0.REMOVE=r0,i0.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},i0.parentCollection=(e,t)=>{let n=i0.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 a0(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=a0(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===t0)return t0;else r===r0&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}function o0(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 n0(e){switch(e){case void 0:case` `:case`
`:case`\r`:case` `:return!0;default:return!1}}var r0=new Set(`0123456789ABCDEFabcdef`),i0=new Set(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()`),a0=new Set(`,[]{}`),o0=new Set(` ,[]{}
\r `),s0=e=>!e||o0.has(e),c0=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 s0(e){switch(e){case void 0:case` `:case`
`:case`\r`:case` `:return!0;default:return!1}}var c0=new Set(`0123456789ABCDEFabcdef`),l0=new Set(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()`),u0=new Set(`,[]{}`),d0=new Set(` ,[]{}
\r `),f0=e=>!e||d0.has(e),p0=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===`...`)&&n0(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===`...`)&&n0(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&&!n0(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===`:`)&&n0(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(s0),`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(`...`))&&n0(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(s0),`flow`;case`"`:case`'`:return this.flowKey=!0,yield*this.parseQuotedScalar();case`:`:{let e=this.charAt(1);if(this.flowKey||n0(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===`...`)&&s0(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===`...`)&&s0(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&&!s0(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===`:`)&&s0(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(f0),`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(`...`))&&s0(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(f0),`flow`;case`"`:case`'`:return this.flowKey=!0,yield*this.parseQuotedScalar();case`:`:{let e=this.charAt(1);if(this.flowKey||s0(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=>n0(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=>s0(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(n0(r)||e&&a0.has(r))break;t=n}else if(n0(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(s0(r)||e&&u0.has(r))break;t=n}else if(s0(r)){let i=this.buffer[n+1];if(r===`\r`&&(i===`
`?(n+=1,r=`
`,i=this.buffer[n+1]):t=n),i===`#`||e&&a0.has(i))break;if(r===`
`){let e=this.continueScalar(n+1);if(e===-1)break;n=Math.max(n,e-2)}}else{if(e&&a0.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(s0),e+=yield*this.pushSpaces(!0);continue loop;case`-`:case`?`:case`:`:{let t=this.flowLevel>0,n=this.charAt(1);if(n0(n)||t&&a0.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(;!n0(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(i0.has(t))t=this.buffer[++e];else if(t===`%`&&r0.has(this.buffer[e+1])&&r0.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&&u0.has(i))break;if(r===`
`){let e=this.continueScalar(n+1);if(e===-1)break;n=Math.max(n,e-2)}}else{if(e&&u0.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(f0),e+=yield*this.pushSpaces(!0);continue loop;case`-`:case`?`:case`:`:{let t=this.flowLevel>0,n=this.charAt(1);if(s0(n)||t&&u0.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(;!s0(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(l0.has(t))t=this.buffer[++e];else if(t===`%`&&c0.has(this.buffer[e+1])&&c0.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)}},l0=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 u0(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function d0(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 f0(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 p0(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 m0(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 h0(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 g0(e){if(e.start.type===`flow-seq-start`)for(let t of e.items)t.sep&&!t.value&&!u0(t.start,`explicit-key-ind`)&&!u0(t.sep,`map-value-ind`)&&(t.key&&(t.value=t.key),delete t.key,f0(t.value)?t.value.end?h0(t.value.end,t.sep):t.value.end=t.sep:h0(t.start,t.sep),delete t.sep)}var _0=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 c0,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=t0(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`&&g0(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&&d0(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)}},m0=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 h0(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function g0(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 _0(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 v0(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 y0(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 b0(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 x0(e){if(e.start.type===`flow-seq-start`)for(let t of e.items)t.sep&&!t.value&&!h0(t.start,`explicit-key-ind`)&&!h0(t.sep,`map-value-ind`)&&(t.key&&(t.value=t.key),delete t.key,_0(t.value)?t.value.end?b0(t.value.end,t.sep):t.value.end=t.sep:b0(t.start,t.sep),delete t.sep)}var S0=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 p0,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=o0(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`&&x0(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&&g0(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)){h0(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(u0(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=m0(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(u0(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(f0(t.key)&&!u0(t.sep,`newline`)){let e=m0(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]}):u0(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&&!u0(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)){h0(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||u0(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)){b0(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(h0(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=y0(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(h0(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(_0(t.key)&&!h0(t.sep,`newline`)){let e=y0(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]}):h0(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&&!h0(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)){b0(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||h0(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=m0(p0(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=m0(p0(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 v0(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new l0||null,prettyErrors:t}}function y0(e,t={}){let{lineCounter:n,prettyErrors:r}=v0(t),i=new _0(n?.addNewLine),a=new Y1(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 d1(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(p1(e,n)),o.warnings.forEach(p1(e,n))),o}function b0(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let i=y0(e,n);if(!i)return null;if(i.warnings.forEach(e=>UQ(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 x0(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 zZ(e)&&!r?e.toString(n):new c1(e,r,n).toString(n)}var S0=e=>typeof e==`object`&&!!e&&!Array.isArray(e),C0=e=>S0(e)?Object.entries(e).map(([e,t])=>[e,Array.isArray(t)?t:[]]):[];function w0(e){if(S0(e)){if(S0(e.parallel))return{kind:`parallel`,base:[`parallel`],branches:C0(e.parallel)};if(S0(e.switch))return{kind:`switch`,base:[`switch`,`cases`],on:typeof e.switch.on==`string`?e.switch.on:``,branches:C0(e.switch.cases)}}}function T0(e){return e.slice(2).includes(`parallel`)}function E0(e,t){let n=y0(e).getIn(t,!0);if(BZ(n))return n.toJSON()}function D0(e,t,n){let r=y0(e);return r.setIn(t,r.createNode(z0(n))),r.toString()}function O0(e,t,n){let r=y0(e),i=t.slice(0,-1),a=T0(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(UZ(o)||(r.setIn(i,r.createNode([])),o=r.getIn(i,!0)),!UZ(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 k0(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 A0(e,t){let n=e.getIn(t,!0),r=w0(BZ(n)?n.toJSON():void 0),i=r?e.getIn([...t,...r.base],!0):void 0;if(!r||!BZ(i))throw Error(`This step has no branches.`);return{kind:r.kind,branches:i}}function j0(e,t,n){let r=y0(e),{kind:i,branches:a}=A0(r,t);if(k0(n,i),a.has(n))throw Error(`Branch ${n} already exists.`);return a.set(n,r.createNode([])),r.toString()}function M0(e,t,n,r){let i=y0(e),{kind:a,branches:o}=A0(i,t);if(k0(r,a),n!==r&&o.has(r))throw Error(`Branch ${r} already exists.`);let s=o.items.find(e=>HZ(e.key)&&e.key.value===n);if(!s||!HZ(s.key))throw Error(`Branch ${n} does not exist.`);return s.key.value=r,i.toString()}function N0(e,t,n){let r=y0(e),{kind:i,branches:a}=A0(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 e2(e,t){let n=JSON.stringify(e??{})+` `+(typeof t==`string`?`{{ ${t.replace(/^!/,``)} }}`:``);return[...new Set([...n.matchAll(X0)].map(e=>e[1]))]}function t2(e){let t=y0(e).toJS(),n=Z0(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=Z0(e)?e:{},p=w0(d),m=p?.kind??(typeof d.type==`string`?d.type:``),h=Z0(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||Y0(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\./,``)}`:Q0(m,h),summary:$0(h),when:typeof d.when==`string`?d.when:void 0,retry:Z0(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 e2([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=w0(t);if(n){let{kind:i,base:a,branches:o}=n,c=p(t,String(e+1),0,u*K0,void 0,void 0,[`steps`,e]);m(l,c,[`steps`,e-1]),u++;let d=Z0(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)*q0,y=(e,t,n)=>r.push({id:e,type:`lane`,position:{x:t-12,y:u*K0-40},style:{width:`264px`,height:`${(_+1)*K0-24}px`},zIndex:-1,data:{kind:`step`,key:n,title:n,type:``,detail:``,lane:i}}),b=(u+_)*K0;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)*K0,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*K0,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*K0-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 n2=P({__name:`WorkflowPicker`,props:{value:{},workflows:{},label:{},class:{},editable:{type:Boolean}},emits:[`pick`],setup(e,{emit:t}){let n=t;return(t,r)=>e.editable?(L(),q(V(TO),{key:0,"model-value":e.value,options:e.workflows.map(e=>e.id),"aria-label":e.label,class:z(t.$props.class),placeholder:`Workflow id or {{ reference }}`,"onUpdate:modelValue":r[0]||=e=>n(`pick`,e)},null,8,[`model-value`,`options`,`aria-label`,`class`])):(L(),q(V(Wu),{key:1,"model-value":e.value||void 0,"onUpdate:modelValue":r[1]||=e=>n(`pick`,String(e))},{default:I(()=>[A(V(Ju),{"aria-label":e.label,class:z(t.$props.class)},{default:I(()=>[A(V(Yu),{placeholder:`Choose workflow`})]),_:1},8,[`aria-label`,`class`]),A(V(Gu),null,{default:I(()=>[e.value&&!e.workflows.some(t=>t.id===e.value)?(L(),q(V(qu),{key:0,value:e.value,disabled:``},{default:I(()=>[H(B(e.value)+` (unavailable)`,1)]),_:1},8,[`value`])):F(``,!0),(L(!0),j(U,null,M(e.workflows,e=>(L(),q(V(qu),{key:e.id,value:e.id},{default:I(()=>[H(B(e.id),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1},8,[`model-value`]))}});function r2(e){return e.ok?`Valid`:e.line?`Line ${e.line}: ${e.message}`:e.message}function i2(e,t=[]){let n=y0(e),r=n.errors[0];if(r)return{ok:!1,message:b2(r.message),line:r.linePos?.[0]?.line};let i=n.toJS();if(!x2(i))return{ok:!1,message:`A workflow is a mapping with an id and steps.`};let a=typeof i.id==`string`?i.id.trim():``;if(!a)return{ok:!1,message:`workflow id is required`};let o=i.steps;if(o==null||o===``)return{ok:!1,message:`workflow ${a} has no steps`};if(!Array.isArray(o))return{ok:!1,message:`workflow ${a}: steps must be a list`};if(!o.length)return{ok:!1,message:`workflow ${a} has no steps`};let s=new Map(t.map(e=>[e.name,e])),c=typeof i.repository==`string`&&i.repository.trim()?i.repository.trim():`required`,l=[],u=new Set;for(let[e,t]of o.entries()){let n=[`steps`,e],r=l2(t);if(r)return{ok:!1,message Line truncated
`).map((e,t)=>({number:t+1,text:e,tokens:g2(e)}))}var m2=/^(\s*)(-\s+)?/,h2=/^([^:#\s][^:#]*?)(:)(\s*)(.*)$/;function g2(e){let{code:t,comment:n}=_2(e),r=v2(t);return n&&r.push({text:n,kind:`comment`}),r}function _2(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 v2(e){if(!e)return[];let t=[],n=m2.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=h2.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,...y2(i[4]??``)]):[...t,...y2(r)]}function y2(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 b2(e){return e.split(`
`)[0]?.trim()||`invalid YAML`}function x2(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function S2(e){return typeof e==`string`&&e.trim()!==``}var C2={class:`space-y-4 px-3 py-3`},w2={key:0,class:`rounded-md bg-danger/10 px-2.5 py-1.5 text-xs text-danger`,role:`alert`},T2={key:1,class:`space-y-3`},E2={class:`text-xs font-medium text-fg-muted`},D2={class:`flex items-center gap-2`},O2={key:2,class:`space-y-1.5`},k2=[`title`],A2={key:4,class:`flex flex-wrap items-center gap-1 pt-0.5`},j2={key:0,class:`divide-y divide-border rounded-md border border-border`},M2=[`title`],N2={key:0,class:`space-y-3`},P2={class:`text-label`},F2={key:0,class:`text-danger`},I2={class:`ml-2 text-xs text-fg-subtle`},L2={key:1,class:`space-y-3`},R2={class:`text-label`},z2={class:`ml-2 text-xs text-fg-subtle`},B2=[`title`],V2={key:0,class:`text-xs text-danger`},H2={class:`space-y-1.5`},U2={class:`divide-y divide-border rounded-md border border-border`},W2={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},G2=P({__name:`StepEditor`,props:{yaml:{},path:{},vocabulary:{},workflows:{},modelAliases:{}},emits:[`update:yaml`],setup(e,{emit:t}){let n=ye(),r=e,i=t,a=Y(()=>E0(r.yaml,r.path)??{}),o=Y(()=>w0(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`?j0(r.yaml,r.path,t):e===`rename`?M0(r.yaml,r.path,t,n):N0(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(()=>R0(r.yaml,r.path)),_=Y(()=>l2(a.value)),v=Y(()=>m.value?.settings&&a.value.settings?d2(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 ee(e){let{id:t,type:n,...a}=e;i(`update:yaml`,D0(r.yaml,r.path,{id:t,type:n,...a}))}function T(e,t){ee({...a.value,[e]:t})}function te(e){let t={...a.value.retry,...e};T(`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,ee({...a.value,settings:n})}function D(e,t){let n={...h.value,[e]:t};s.value===`workflow.call`&&t!==h.value[e]&&(delete n.inputs,delete n.outputs),ee({...a.value,settings:n})}let ne=Y(()=>r.workflows.find(e=>e.id===h.value.workflow)),re=Y(()=>Object.entries(B0(ne.value?.yaml??``,`inputs`)??{})),O=Y(()=>Object.entries(B0(ne.value?.yaml??``,`outputs`)??{})),k=Y(()=>Object.entries(B0(r.yaml,`inputs`)??{})),ie=Y(()=>Object.entries(B0(r.yaml,`outputs`)??{})),ae=Y(()=>h.value.inputs??{}),oe=Y(()=>h.value.outputs??{}),se=e=>typeof e==`string`&&e.startsWith(`inputs.`),ce=e=>[`object`,`array`].includes(e.type??``),le=e=>ae.value[e]===void 0?``:String(ae.value[e]);function ue(e,t,n){E(`inputs`,{...ae.value,[e]:t===``?void 0:se(t)?t:kO(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=J(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 }}`;E(t,n?`${n.trimEnd()} ${r}`:r)}let me=J({});function N(e,t){try{E(e,t.trim()?b0(t):void 0),me.value={...me.value,[e]:``}}catch(t){me.value={...me.value,[e]:String(t.message).split(`
`)[0]}}}let he=e=>e===void 0?``:x0(e).trimEnd(),ge=(e,t)=>t.title??e.replaceAll(`_`,` `).replace(/^./,e=>e.toUpperCase()),_e=e=>typeof h.value[e]==`string`?h.value[e]:``,ve=[{value:``,label:`Park the task`},{value:`continue`,label:`Continue`}];return(t,r)=>(L(),j(`div`,C2,[v.value?(L(),j(`p`,w2,B(v.value),1)):F(``,!0),o.value?(L(),j(`section`,T2,[s.value===`switch`?(L(),q(V(kc),{key:0,class:`block space-y-1.5`},{default:I(()=>[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(TO),{"model-value":o.value.on,class:`font-mono`,placeholder:`steps.assess.result.fit`,options:g.value.map(e=>`steps.${e}.result.`),onChange:r[0]||=e=>u(e.target.value.trim())},null,8,[`model-value`,`options`])]),_:1})):F(``,!0),R(`div`,E2,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(Pu))]),_:1},8,[`aria-label`,`disabled`,`onClick`])]))),128)),R(`div`,D2,[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]||=lt(_t(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(yu))]),_:1},8,[`aria-label`,`disabled`])]),f.value?(L(),q(V(ut),{key:1,variant:`destructive`},{default:I(()=>[A(V(xt),null,{default:I(()=>[H(B(f.value),1)]),_:1})]),_:1})):F(``,!0)])):F(``,!0),S.value.lead?(L(),j(`section`,O2,[R(`div`,{class:`flex items-center gap-1 text-xs font-medium text-fg-muted`,title:S.value.lead.schema.description},[H(B(ge(S.value.lead.key,S.value.lead.schema))+` `,1),S.value.lead.schema.description?(L(),q(V(Fl),{key:0,class:`size-3 text-fg-subtle`})):F(``,!0)],8,k2),S.value.lead.kind===`workflow`?(L(),q(n2,{key:0,editable:s.value!==`workflow.call`,value:_e(S.value.lead.key),workflows:e.workflows,label:ge(S.value.lead.key,S.value.lead.schema),onPick:r[4]||=e=>D(S.value.lead.key,e)},null,8,[`editable`,`value`,`workflows`,`label`])):S.value.lead.kind===`select`?(L(),q(DE,{key:1,class:`w-full`,"model-value":_e(S.value.lead.key),options:w(S.value.lead.options),"aria-label":ge(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(Md),{key:2,"model-value":_e(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=>E(S.value.lead.key,String(e))},null,8,[`model-value`])):(L(),q(V(Q),{key:3,"model-value":_e(S.value.lead.key),onFocus:r[8]||=e=>fe.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`,A2,[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=>pe(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(Ol),{"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`,j2,[(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(ge(t.key,t.schema))+` `,1),t.schema.description?(L(),q(V(Fl),{key:0,class:`size-3 text-fg-subtle`})):F(``,!0)],8,M2),t.kind===`workflow`?(L(),q(n2,{key:0,editable:s.value!==`workflow.call`,class:`max-w-48`,value:_e(t.key),workflows:e.workflows,label:ge(t.key,t.schema),onPick:e=>D(t.key,e)},null,8,[`editable`,`value`,`workflows`,`label`,`onPick`])):t.kind===`boolean`?(L(),q(V(bE),{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(DE,{key:2,cl Line truncated
`,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=y0(v0(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=y0(v0(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 C0(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new m0||null,prettyErrors:t}}function w0(e,t={}){let{lineCounter:n,prettyErrors:r}=C0(t),i=new S0(n?.addNewLine),a=new e0(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 g1(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(v1(e,n)),o.warnings.forEach(v1(e,n))),o}function T0(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let i=w0(e,n);if(!i)return null;if(i.warnings.forEach(e=>JQ(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 E0(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 WZ(e)&&!r?e.toString(n):new p1(e,r,n).toString(n)}var D0=e=>typeof e==`object`&&!!e&&!Array.isArray(e),O0=e=>D0(e)?Object.entries(e).map(([e,t])=>[e,Array.isArray(t)?t:[]]):[];function k0(e){if(D0(e)){if(D0(e.parallel))return{kind:`parallel`,base:[`parallel`],branches:O0(e.parallel)};if(D0(e.switch))return{kind:`switch`,base:[`switch`,`cases`],on:typeof e.switch.on==`string`?e.switch.on:``,branches:O0(e.switch.cases)}}}function A0(e){return e.slice(2).includes(`parallel`)}function j0(e,t){let n=w0(e).getIn(t,!0);if(GZ(n))return n.toJSON()}function M0(e,t,n){let r=w0(e);return r.setIn(t,r.createNode(W0(n))),r.toString()}function N0(e,t,n){let r=w0(e),i=t.slice(0,-1),a=A0(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(JZ(o)||(r.setIn(i,r.createNode([])),o=r.getIn(i,!0)),!JZ(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 F0(e,t){let n=e.getIn(t,!0),r=k0(GZ(n)?n.toJSON():void 0),i=r?e.getIn([...t,...r.base],!0):void 0;if(!r||!GZ(i))throw Error(`This step has no branches.`);return{kind:r.kind,branches:i}}function I0(e,t,n){let r=w0(e),{kind:i,branches:a}=F0(r,t);if(P0(n,i),a.has(n))throw Error(`Branch ${n} already exists.`);return a.set(n,r.createNode([])),r.toString()}function L0(e,t,n,r){let i=w0(e),{kind:a,branches:o}=F0(i,t);if(P0(r,a),n!==r&&o.has(r))throw Error(`Branch ${r} already exists.`);let s=o.items.find(e=>qZ(e.key)&&e.key.value===n);if(!s||!qZ(s.key))throw Error(`Branch ${n} does not exist.`);return s.key.value=r,i.toString()}function R0(e,t,n){let r=w0(e),{kind:i,branches:a}=F0(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 a2(e,t){let n=JSON.stringify(e??{})+` `+(typeof t==`string`?`{{ ${t.replace(/^!/,``)} }}`:``);return[...new Set([...n.matchAll(t2)].map(e=>e[1]))]}function o2(e){let t=w0(e).toJS(),n=n2(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=n2(e)?e:{},p=k0(d),m=p?.kind??(typeof d.type==`string`?d.type:``),h=n2(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||e2(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\./,``)}`:r2(m,h),summary:i2(h),when:typeof d.when==`string`?d.when:void 0,retry:n2(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 a2([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=k0(t);if(n){let{kind:i,base:a,branches:o}=n,c=p(t,String(e+1),0,u*Z0,void 0,void 0,[`steps`,e]);m(l,c,[`steps`,e-1]),u++;let d=n2(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)*Q0,y=(e,t,n)=>r.push({id:e,type:`lane`,position:{x:t-12,y:u*Z0-40},style:{width:`264px`,height:`${(_+1)*Z0-24}px`},zIndex:-1,data:{kind:`step`,key:n,title:n,type:``,detail:``,lane:i}}),b=(u+_)*Z0;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)*Z0,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*Z0,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*Z0-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 s2=P({__name:`WorkflowPicker`,props:{value:{},workflows:{},label:{},class:{},editable:{type:Boolean}},emits:[`pick`],setup(e,{emit:t}){let n=t;return(t,r)=>e.editable?(L(),q(V(bO),{key:0,"model-value":e.value,options:e.workflows.map(e=>e.id),"aria-label":e.label,class:z(t.$props.class),placeholder:`Workflow id or {{ reference }}`,"onUpdate:modelValue":r[0]||=e=>n(`pick`,e)},null,8,[`model-value`,`options`,`aria-label`,`class`])):(L(),q(V(Hu),{key:1,"model-value":e.value||void 0,"onUpdate:modelValue":r[1]||=e=>n(`pick`,String(e))},{default:I(()=>[A(V(Ku),{"aria-label":e.label,class:z(t.$props.class)},{default:I(()=>[A(V(qu),{placeholder:`Choose workflow`})]),_:1},8,[`aria-label`,`class`]),A(V(Uu),null,{default:I(()=>[e.value&&!e.workflows.some(t=>t.id===e.value)?(L(),q(V(Gu),{key:0,value:e.value,disabled:``},{default:I(()=>[H(B(e.value)+` (unavailable)`,1)]),_:1},8,[`value`])):F(``,!0),(L(!0),j(U,null,M(e.workflows,e=>(L(),q(V(Gu),{key:e.id,value:e.id},{default:I(()=>[H(B(e.id),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1},8,[`model-value`]))}});function c2(e){return e.ok?`Valid`:e.line?`Line ${e.line}: ${e.message}`:e.message}function l2(e,t=[]){let n=w0(e),r=n.errors[0];if(r)return{ok:!1,message:T2(r.message),line:r.linePos?.[0]?.line};let i=n.toJS();if(!E2(i))return{ok:!1,message:`A workflow is a mapping with an id and steps.`};let a=typeof i.id==`string`?i.id.trim():``;if(!a)return{ok:!1,message:`workflow id is required`};let o=i.steps;if(o==null||o===``)return{ok:!1,message:`workflow ${a} has no steps`};if(!Array.isArray(o))return{ok:!1,message:`workflow ${a}: steps must be a list`};if(!o.length)return{ok:!1,message:`workflow ${a} has no steps`};let s=new Map(t.map(e=>[e.name,e])),c=typeof i.repository==`string`&&i.repository.trim()?i.repository.trim():`required`,l=[],u=new Set;for(let[e,t]of o.entries()){let n=[`steps`,e],r=m2(t);if(r)return{ok:!1,message Line truncated
`).map((e,t)=>({number:t+1,text:e,tokens:x2(e)}))}var y2=/^(\s*)(-\s+)?/,b2=/^([^:#\s][^:#]*?)(:)(\s*)(.*)$/;function x2(e){let{code:t,comment:n}=S2(e),r=C2(t);return n&&r.push({text:n,kind:`comment`}),r}function S2(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 C2(e){if(!e)return[];let t=[],n=y2.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=b2.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,...w2(i[4]??``)]):[...t,...w2(r)]}function w2(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 T2(e){return e.split(`
`)[0]?.trim()||`invalid YAML`}function E2(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function D2(e){return typeof e==`string`&&e.trim()!==``}var O2={class:`space-y-4 px-3 py-3`},k2={key:0,class:`rounded-md bg-danger/10 px-2.5 py-1.5 text-xs text-danger`,role:`alert`},A2={key:1,class:`space-y-3`},j2={class:`text-xs font-medium text-fg-muted`},M2={class:`flex items-center gap-2`},N2={key:2,class:`space-y-1.5`},P2=[`title`],F2={key:4,class:`flex flex-wrap items-center gap-1 pt-0.5`},I2={key:0,class:`divide-y divide-border rounded-md border border-border`},L2=[`title`],R2={key:0,class:`space-y-3`},z2={class:`text-label`},B2={key:0,class:`text-danger`},V2={class:`ml-2 text-xs text-fg-subtle`},H2={key:1,class:`space-y-3`},U2={class:`text-label`},W2={class:`ml-2 text-xs text-fg-subtle`},G2=[`title`],K2={key:0,class:`text-xs text-danger`},q2={class:`space-y-1.5`},J2={class:`divide-y divide-border rounded-md border border-border`},Y2={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},X2=P({__name:`StepEditor`,props:{yaml:{},path:{},vocabulary:{},workflows:{},modelAliases:{}},emits:[`update:yaml`],setup(e,{emit:t}){let n=ye(),r=e,i=t,a=Y(()=>j0(r.yaml,r.path)??{}),o=Y(()=>k0(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`,M0(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`?I0(r.yaml,r.path,t):e===`rename`?L0(r.yaml,r.path,t,n):R0(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(()=>U0(r.yaml,r.path)),_=Y(()=>m2(a.value)),v=Y(()=>m.value?.settings&&a.value.settings?g2(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))}}),ee=J(!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`,M0(r.yaml,r.path,{id:t,type:n,...a}))}function w(e,t){te({...a.value,[e]:t})}function T(e){let t={...a.value.retry,...e};w(`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,te({...a.value,settings:n})}function D(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 ne=Y(()=>r.workflows.find(e=>e.id===h.value.workflow)),re=Y(()=>Object.entries(G0(ne.value?.yaml??``,`inputs`)??{})),O=Y(()=>Object.entries(G0(ne.value?.yaml??``,`outputs`)??{})),k=Y(()=>Object.entries(G0(r.yaml,`inputs`)??{})),ie=Y(()=>Object.entries(G0(r.yaml,`outputs`)??{})),ae=Y(()=>h.value.inputs??{}),oe=Y(()=>h.value.outputs??{}),se=e=>typeof e==`string`&&e.startsWith(`inputs.`),ce=e=>[`object`,`array`].includes(e.type??``),le=e=>ae.value[e]===void 0?``:String(ae.value[e]);function ue(e,t,n){E(`inputs`,{...ae.value,[e]:t===``?void 0:se(t)?t:wO(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=J(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 }}`;E(t,n?`${n.trimEnd()} ${r}`:r)}let me=J({});function N(e,t){try{E(e,t.trim()?T0(t):void 0),me.value={...me.value,[e]:``}}catch(t){me.value={...me.value,[e]:String(t.message).split(`
`)[0]}}}let he=e=>e===void 0?``:E0(e).trimEnd(),ge=(e,t)=>t.title??e.replaceAll(`_`,` `).replace(/^./,e=>e.toUpperCase()),_e=e=>typeof h.value[e]==`string`?h.value[e]:``,ve=[{value:``,label:`Park the task`},{value:`continue`,label:`Continue`}];return(t,r)=>(L(),j(`div`,O2,[v.value?(L(),j(`p`,k2,B(v.value),1)):F(``,!0),o.value?(L(),j(`section`,A2,[s.value===`switch`?(L(),q(V(Oc),{key:0,class:`block space-y-1.5`},{default:I(()=>[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(bO),{"model-value":o.value.on,class:`font-mono`,placeholder:`steps.assess.result.fit`,options:g.value.map(e=>`steps.${e}.result.`),onChange:r[0]||=e=>u(e.target.value.trim())},null,8,[`model-value`,`options`])]),_:1})):F(``,!0),R(`div`,j2,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(Mu))]),_:1},8,[`aria-label`,`disabled`,`onClick`])]))),128)),R(`div`,M2,[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]||=lt(_t(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(vu))]),_:1},8,[`aria-label`,`disabled`])]),f.value?(L(),q(V(ut),{key:1,variant:`destructive`},{default:I(()=>[A(V(xt),null,{default:I(()=>[H(B(f.value),1)]),_:1})]),_:1})):F(``,!0)])):F(``,!0),S.value.lead?(L(),j(`section`,N2,[R(`div`,{class:`flex items-center gap-1 text-xs font-medium text-fg-muted`,title:S.value.lead.schema.description},[H(B(ge(S.value.lead.key,S.value.lead.schema))+` `,1),S.value.lead.schema.description?(L(),q(V(Pl),{key:0,class:`size-3 text-fg-subtle`})):F(``,!0)],8,P2),S.value.lead.kind===`workflow`?(L(),q(s2,{key:0,editable:s.value!==`workflow.call`,value:_e(S.value.lead.key),workflows:e.workflows,label:ge(S.value.lead.key,S.value.lead.schema),onPick:r[4]||=e=>D(S.value.lead.key,e)},null,8,[`editable`,`value`,`workflows`,`label`])):S.value.lead.kind===`select`?(L(),q(SE,{key:1,class:`w-full`,"model-value":_e(S.value.lead.key),options:C(S.value.lead.options),"aria-label":ge(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(Ad),{key:2,"model-value":_e(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=>E(S.value.lead.key,String(e))},null,8,[`model-value`])):(L(),q(V(Q),{key:3,"model-value":_e(S.value.lead.key),onFocus:r[8]||=e=>fe.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`,F2,[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=>pe(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":ee.value,onClick:r[10]||=e=>ee.value=!ee.value},{default:I(()=>[A(V(Dl),{"data-icon":`inline-start`,class:z([`transition-transform`,!ee.value&&`-rotate-90`])},null,8,[`class`]),r[17]||=H(`More `,-1)]),_:1},8,[`aria-expanded`]),ee.value?(L(),j(U,{key:3},[S.value.compact.length?(L(),j(`section`,I2,[(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(ge(t.key,t.schema))+` `,1),t.schema.description?(L(),q(V(Pl),{key:0,class:`size-3 text-fg-subtle`})):F(``,!0)],8,L2),t.kind===`workflow`?(L(),q(s2,{key:0,editable:s.value!==`workflow.call`,class:`max-w-48`,value:_e(t.key),workflows:e.workflows,label:ge(t.key,t.schema),onPick:e=>D(t.key,e)},null,8,[`editable`,`value`,`workflows`,`label`,`onPick`])):t.kind===`boolean`?(L(),q(V(hE),{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(SE,{key 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(Md),{"model-value":he(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]?(L(),j(`span`,V2,B(me.value[e.key]),1)):F(``,!0)],64))]))),128)),R(`section`,H2,[_.value?(L(),q(V(ut),{key:0,variant:`destructive`},{default:I(()=>[A(V(xt),null,{default:I(()=>[H(B(_.value),1)]),_:1})]),_:1})):F(``,!0),R(`div`,U2,[A(V(kc),{class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},{default:I(()=>[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=>T(`when`,String(e))},null,8,[`aria-invalid`,`model-value`])]),_:1}),A(V(kc),{class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},{default:I(()=>[r[21]||=R(`span`,{class:`flex-1 text-label`},`If it fails`,-1),A(DE,{class:`w-36`,"aria-label":`If it fails`,"model-value":a.value.on_failure??``,options:ve,"onUpdate:modelValue":r[12]||=e=>T(`on_failure`,e||void 0)},null,8,[`model-value`])]),_:1}),A(V(kc),{class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},{default:I(()=>[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`])]),_:1}),R(`div`,W2,[A(V(kc),{for:`${V(n)}-backoff`,class:`flex-1 text-label`},{default:I(()=>[...r[23]||=[H(`Retry backoff`,-1)]]),_:1},8,[`for`]),A(V(cE),{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)]))}}),K2={class:`space-y-1.5`},q2={class:`flex items-center text-xs font-medium text-fg-muted`},J2={key:0,class:`divide-y divide-border rounded-md border border-border`},Y2=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(B0(n.yaml,n.field)??{}));function o(e){r(`update:yaml`,V0(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`,K2,[R(`div`,q2,[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(yu),{"data-icon":`inline-start`}),n[0]||=H(`Add`,-1)]),_:1})]),a.value.length?(L(),j(`div`,J2,[(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(DE,{"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(bE),{"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(Pu))]),_:1},8,[`aria-label`,`onClick`])]))),128))])):F(``,!0)]))}}),X2={class:`space-y-4 px-3 py-3`},Z2={class:`divide-y divide-border rounded-md border border-border`},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:`space-y-1.5`},t4=`6f129e29-0e26-5246-99bd-74cb4496203b`,n4=P({__name:`WorkflowSettings`,props:{yaml:{}},emits:[`update:yaml`],setup(e,{emit:t}){let n=e,r=t,i=e=>{let t=B0(n.yaml,e);return typeof t==`string`?t:``};function a(e,t){r(`update:yaml`,V0(n.yaml,e,t))}let o=kE(),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===t4)&&a(`identity`,t4)}catch(e){l.value=String(e.message||e)}finally{c.value=!1}}Fe(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=iE Line truncated
`).filter(Boolean))},null,8,[`model-value`,`onUpdate:modelValue`])):(L(),j(U,{key:2},[A(V(Ad),{"model-value":he(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]?(L(),j(`span`,K2,B(me.value[e.key]),1)):F(``,!0)],64))]))),128)),R(`section`,q2,[_.value?(L(),q(V(ut),{key:0,variant:`destructive`},{default:I(()=>[A(V(xt),null,{default:I(()=>[H(B(_.value),1)]),_:1})]),_:1})):F(``,!0),R(`div`,J2,[A(V(Oc),{class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},{default:I(()=>[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=>w(`when`,String(e))},null,8,[`aria-invalid`,`model-value`])]),_:1}),A(V(Oc),{class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},{default:I(()=>[r[21]||=R(`span`,{class:`flex-1 text-label`},`If it fails`,-1),A(SE,{class:`w-36`,"aria-label":`If it fails`,"model-value":a.value.on_failure??``,options:ve,"onUpdate:modelValue":r[12]||=e=>w(`on_failure`,e||void 0)},null,8,[`model-value`])]),_:1}),A(V(Oc),{class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},{default:I(()=>[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=>T({attempts:String(e)===``?void 0:Number(String(e))})},null,8,[`model-value`])]),_:1}),R(`div`,Y2,[A(V(Oc),{for:`${V(n)}-backoff`,class:`flex-1 text-label`},{default:I(()=>[...r[23]||=[H(`Retry backoff`,-1)]]),_:1},8,[`for`]),A(V(rE),{id:`${V(n)}-backoff`,"model-value":a.value.retry?.backoff??``,units:[`s`,`m`,`h`],"onUpdate:modelValue":r[14]||=e=>T({backoff:e||void 0})},null,8,[`id`,`model-value`])])])])],64)):F(``,!0)]))}}),Z2={class:`space-y-1.5`},Q2={class:`flex items-center text-xs font-medium text-fg-muted`},$2={key:0,class:`divide-y divide-border rounded-md border border-border`},e4=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(G0(n.yaml,n.field)??{}));function o(e){r(`update:yaml`,K0(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`,Z2,[R(`div`,Q2,[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(vu),{"data-icon":`inline-start`}),n[0]||=H(`Add`,-1)]),_:1})]),a.value.length?(L(),j(`div`,$2,[(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(SE,{"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(hE),{"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(Mu))]),_:1},8,[`aria-label`,`onClick`])]))),128))])):F(``,!0)]))}}),t4={class:`space-y-4 px-3 py-3`},n4={class:`divide-y divide-border rounded-md border border-border`},r4={key:1,class:`px-3 py-2 text-xs text-fg-subtle`},i4={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},a4={class:`space-y-1.5`},o4=`6f129e29-0e26-5246-99bd-74cb4496203b`,s4=P({__name:`WorkflowSettings`,props:{yaml:{}},emits:[`update:yaml`],setup(e,{emit:t}){let n=e,r=t,i=e=>{let t=G0(n.yaml,e);return typeof t==`string`?t:``};function a(e,t){r(`update:yaml`,K0(n.yaml,e,t))}let o=wE(),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===o4)&&a(`identity`,o4)}catch(e){l.value=String(e.message||e)}finally{c.value=!1}}Fe(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=$T() Line 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 Tce(e,t){return n=>{if(!n.code&&!n.key)return!1;let r=Ece(n.code,e);return Array.isArray(e)?e.some(e=>A5(n[r],e,t,n.type===`keyup`)):A5(n[r],e,t,n.type===`keyup`)}}function Ece(e,t){return t.includes(e)?`code`:`key`}function j5(e,t){let n=Y(()=>Be(t?.target)??Cce),r=et(Be(e)===!0),i=!1,a=new Set,o=c(Be(e));N(()=>Be(e),(e,t)=>{typeof t==`boolean`&&typeof e!=`boolean`&&s(),o=c(e)},{immediate:!0}),i6([`blur`,`contextmenu`],s),o6((...e)=>o(...e),e=>{let n=Be(t?.actInsideInputWithModifier)??!0,a=Be(t?.preventDefault)??!1;if(i=wce(e),(!i||i&&!n)&&k5(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}),o6((...e)=>o(...e),e=>{let n=Be(t?.actInsideInputWithModifier)??!0;if(r.value){if((!i||i&&!n)&&k5(e))return;i=!1,r.value=!1}},{eventName:`keyup`,target:n});function s(){i=!1,a.clear(),r.value=Be(e)===!0}function c(e){return e===null?(s(),()=>!1):typeof e==`boolean`?(s(),r.value=e,()=>!1):Array.isArray(e)||typeof e==`string`?Tce(e,a):e}return r}var M5=`vue-flow__node-desc`,N5=`vue-flow__edge-desc`,Dce=`vue-flow__aria-live`,P5=[`Enter`,` `,`Escape`],F5={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function I5(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function L5(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 R5(e){return{width:e.offsetWidth,height:e.offsetHeight}}function z5(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function B5(e,t){return{x:z5(e.x,t[0][0],t[1][0]),y:z5(e.y,t[0][1],t[1][1])}}function V5(e){let t=e.getRootNode();return`elementFromPoint`in t?t:window.document}function H5(e){return e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e}function U5(e){return e&&typeof e==`object`&&`id`in e&&`position`in e&&!H5(e)}function W5(e){return U5(e)&&`computedPosition`in e}function G5(e){return!Number.isNaN(e)&&Number.isFinite(e)}function Oce(e){return G5(e.width)&&G5(e.height)&&G5(e.x)&&G5(e.y)}function kce(e,t,n){let r={id:e.id.toString(),type:e.type??`default`,dimensions:Le({width:0,height:0}),computedPosition:Le({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:z7(e.data)?e.data:{},events:Le(z7(e.events)?e.events:{})};return Object.assign(t??r,e,{id:e.id.toString(),parentNode:n})}function K5(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:z7(e.data)?e.data:{},events:Le(z7(e.events)?e.events:{}),label:e.label??``,interactionWidth:e.interactionWidth??n?.interactionWidth,...n??{}};return Object.assign(t??r,e,{id:e.id.toString()})}function q5(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 Ace(...e){if(e.length===3){let[t,n,r]=e;return q5(t,n,r,`target`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>H5(e)&&e.source===r).map(e=>n.find(t=>U5(t)&&t.id===e.target))}function jce(...e){if(e.length===3){let[t,n,r]=e;return q5(t,n,r,`source`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>H5(e)&&e.target===r).map(e=>n.find(t=>U5(t)&&t.id===e.source))}function J5({source:e,sourceHandle:t,target:n,targetHandle:r}){return`vueflow__edge-${e}${t??``}-${n}${r??``}`}function Mce(e,t){return t.some(t=>H5(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 Y5({x:e,y:t},{x:n,y:r,zoom:i}){return{x:e*i+n,y:t*i+r}}function X5({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?k7(s,o):s}function Nce(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 Z5({x:e,y:t,width:n,height:r}){return{x:e,y:t,x2:e+n,y2:t+r}}function Pce({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=Nce(t,Z5({...r.computedPosition,...r.dimensions}))}return Pce(t)}function $5(e,t,n={x:0,y:0,zoom:1},r=!1,i=!1){let a={...X5(t,n),width:t.width/n.zoom,height:t.height/n.zoom},o=[];for(let t of e){let{dimensions:e,selectable:n 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 Fce(e,t){return n=>{if(!n.code&&!n.key)return!1;let r=Ice(n.code,e);return Array.isArray(e)?e.some(e=>A5(n[r],e,t,n.type===`keyup`)):A5(n[r],e,t,n.type===`keyup`)}}function Ice(e,t){return t.includes(e)?`code`:`key`}function j5(e,t){let n=Y(()=>Be(t?.target)??Nce),r=et(Be(e)===!0),i=!1,a=new Set,o=c(Be(e));N(()=>Be(e),(e,t)=>{typeof t==`boolean`&&typeof e!=`boolean`&&s(),o=c(e)},{immediate:!0}),l6([`blur`,`contextmenu`],s),d6((...e)=>o(...e),e=>{let n=Be(t?.actInsideInputWithModifier)??!0,a=Be(t?.preventDefault)??!1;if(i=Pce(e),(!i||i&&!n)&&k5(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}),d6((...e)=>o(...e),e=>{let n=Be(t?.actInsideInputWithModifier)??!0;if(r.value){if((!i||i&&!n)&&k5(e))return;i=!1,r.value=!1}},{eventName:`keyup`,target:n});function s(){i=!1,a.clear(),r.value=Be(e)===!0}function c(e){return e===null?(s(),()=>!1):typeof e==`boolean`?(s(),r.value=e,()=>!1):Array.isArray(e)||typeof e==`string`?Fce(e,a):e}return r}var M5=`vue-flow__node-desc`,N5=`vue-flow__edge-desc`,Lce=`vue-flow__aria-live`,P5=[`Enter`,` `,`Escape`],F5={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function I5(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function L5(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 R5(e){return{width:e.offsetWidth,height:e.offsetHeight}}function z5(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function B5(e,t){return{x:z5(e.x,t[0][0],t[1][0]),y:z5(e.y,t[0][1],t[1][1])}}function V5(e){let t=e.getRootNode();return`elementFromPoint`in t?t:window.document}function H5(e){return e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e}function U5(e){return e&&typeof e==`object`&&`id`in e&&`position`in e&&!H5(e)}function W5(e){return U5(e)&&`computedPosition`in e}function G5(e){return!Number.isNaN(e)&&Number.isFinite(e)}function Rce(e){return G5(e.width)&&G5(e.height)&&G5(e.x)&&G5(e.y)}function zce(e,t,n){let r={id:e.id.toString(),type:e.type??`default`,dimensions:Le({width:0,height:0}),computedPosition:Le({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:z7(e.data)?e.data:{},events:Le(z7(e.events)?e.events:{})};return Object.assign(t??r,e,{id:e.id.toString(),parentNode:n})}function K5(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:z7(e.data)?e.data:{},events:Le(z7(e.events)?e.events:{}),label:e.label??``,interactionWidth:e.interactionWidth??n?.interactionWidth,...n??{}};return Object.assign(t??r,e,{id:e.id.toString()})}function q5(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 Bce(...e){if(e.length===3){let[t,n,r]=e;return q5(t,n,r,`target`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>H5(e)&&e.source===r).map(e=>n.find(t=>U5(t)&&t.id===e.target))}function Vce(...e){if(e.length===3){let[t,n,r]=e;return q5(t,n,r,`source`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>H5(e)&&e.target===r).map(e=>n.find(t=>U5(t)&&t.id===e.source))}function J5({source:e,sourceHandle:t,target:n,targetHandle:r}){return`vueflow__edge-${e}${t??``}-${n}${r??``}`}function Hce(e,t){return t.some(t=>H5(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 Y5({x:e,y:t},{x:n,y:r,zoom:i}){return{x:e*i+n,y:t*i+r}}function X5({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?k7(s,o):s}function Uce(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 Z5({x:e,y:t,width:n,height:r}){return{x:e,y:t,x2:e+n,y2:t+r}}function Wce({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=Uce(t,Z5({...r.computedPosition,...r.dimensions}))}return Wce(t)}function $5(e,t,n={x:0,y:0,zoom:1},r=!1,i=!1){let a={...X5(t,n),width:t.width/n.zoom,height:t.height/n.zoom},o=[];for(let t of e){let{dimensions:e,selectable:n 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`},T7=class extends Error{constructor(e,...t){super(w7[e]?.call(w7,...t)),this.name=`VueFlowError`,this.code=e,this.args=t}};function E7(e){return`clientX`in e}function Wce(e){return`sourceEvent`in e}function D7(e,t){let n=E7(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 O7=()=>typeof navigator<`u`&&(navigator==null?void 0:navigator.userAgent)?.indexOf(`Mac`)>=0;function Gce(e){return{width:e.dimensions?.width??e.width??0,height:e.dimensions?.height??e.height??0}}function k7(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}var Kce=()=>!0;function A7(e){e?.classList.remove(`valid`,`connecting`,`vue-flow__handle-valid`,`vue-flow__handle-connecting`)}function qce(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())L5(i,I5(e))>0&&r.push(e);return r}var Jce=250;function Yce(e,t,n,r){let i=[],a=1/0,o=qce(e,n,t+Jce);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}=x7(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 j7(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=Kce},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:_}=D7(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=M7(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===E5.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=N7(t,e,a,p,n,!0)}return b}function M7(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function Xce(e,t){let n=null;return t?n=`valid`:e&&!t&&(n=`invalid`),n}function Zce(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}function N7(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===E5.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,...x7(o,c,c.position,!0)}:c}var P7={[C5.Left]:C5.Right,[C5.Right]:C5.Left,[C5.Top]:C5.Bottom,[C5.Bottom]:C5.Top},Qce=[`production`,`prod`];function F7(e,...t){I7()&&console.warn(`[Vue Flow]: ${e}`,...t)}function I7(){return!Qce.includes(`production`)}function L7(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,...R5(t)}}):null}function R7(e,t,n,r,i,a=!1,o){i.value=!1,e.selected?(a||e.selected&&t)&&(r([e]),ze(()=>{o.blur()})):n([e])}function z7(e){return V(e)!==void 0}function $ce(e,t,n,r){if(!e||!e.source||!e.target)return n(new T7(C7.EDGE_INVALID,e?.id??`[ID UNKNOWN]`)),!1;let i;return i=H5(e)?e:{...e,id:J5(e)},i=K5(i,void 0,r),!Mce(i,t)&&i}function ele(e,t,n,r,i){if(!t.source||!t.target)return i(new T7(C7.EDGE_INVALID,e.id)),!1;if(!n)return i(new T7(C7.EDGE_NOT_FOUND,e.id)),!1;let{id:a,...o}=e;return{...o,id:r?J5(t):a,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function B7(e,t,n){let r={},i=[];for(let a=0;a<e.length;++a){let o=e[a];if(!U5(o)){n(new T7(C7.NODE_INVALID,o?.id));continue}let s=kce(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 T7(C7.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 V7(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 H7(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}`;V7(`sourcLine truncated
`)},B(e.data.summary||e.data.detail),9,Hue)):F(``,!0),e.data.when||e.data.retry||e.data.continues?(L(),j(`div`,Uue,[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(Xl),{class:`size-3 shrink-0`,"aria-hidden":`true`}),R(`span`,Gue,B(e.data.when),1)],8,Wue)):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(xu),{class:`size-3`,"aria-hidden":`true`}),H(`×`+B(e.data.retry),1)],8,Kue)):F(``,!0),e.data.continues?(L(),j(`span`,que,[A(V(ju),{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,Jue)):F(``,!0)],64))]),A(it,{"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]||=_t(()=>{},[`stop`])},[K(t.$slots,`default`)])):F(``,!0)]),_:3}),A(V(i9),{type:`source`,position:V(C5).Bottom},null,8,[`position`]),A(V(i9),{id:`data-out`,type:`source`,position:V(C5).Right,class:`!opacity-0`},null,8,[`position`]),e.data.type===`switch`?(L(),q(V(i9),{key:1,id:`otherwise`,type:`source`,position:V(C5).Right,class:`!opacity-0`},null,8,[`position`])):F(``,!0)],2))}}),Xue={class:`pointer-events-none size-full rounded-xl border border-dashed border-border bg-muted/30`},Zue={class:`flex items-center gap-1 px-2.5 pt-1.5 text-caption text-fg-subtle`},Que={key:0},$ue={key:1,class:`font-mono`},ede=P({__name:`LaneNode`,props:{data:{}},setup(e){return(t,n)=>(L(),j(`div`,Xue,[R(`div`,Zue,[e.data.lane===`switch`?(L(),j(U,{key:0},[A(V(Mu),{class:`size-3`,"aria-hidden":`true`}),e.data.title==="default"?(L(),j(`span`,Que,`otherwise`)):(L(),j(`span`,$ue,`= `+B(e.data.title),1))],64)):(L(),j(U,{key:1},[A(V(Ql),{class:`size-3`,"aria-hidden":`true`}),H(B(e.data.title),1)],64))])]))}}),tde={class:`flex shrink-0 items-center justify-center gap-1 border-t border-border bg-card p-1`},O9=240,nde=416,k9=-140,rde=72,ide=.9,A9=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&&T0(e)?o.value:a.value,c=e=>e.kind===`step`?JSON.stringify(e.path??null):e.kind,l=J(null),u=J(null),d=aee(`(max-width: 767px)`),f=Y(()=>{let e=W0(t2(n.yaml),n.stages??[]);return n.types?.length?{nodes:[{id:`workflow`,type:`step`,position:{x:0,y:k9},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=uee(),b=ree(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-rde))}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+O9};function ee(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+O9/2,r=e.style?.width?parseFloat(String(e.style.width)):e.type===`step`?O9:32,i=e.position.x+r/2;return Math.abs(i-n)<O9/2?0:i<n?-88:88}let T=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`},T7=class extends Error{constructor(e,...t){super(w7[e]?.call(w7,...t)),this.name=`VueFlowError`,this.code=e,this.args=t}};function E7(e){return`clientX`in e}function ele(e){return`sourceEvent`in e}function D7(e,t){let n=E7(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 O7=()=>typeof navigator<`u`&&(navigator==null?void 0:navigator.userAgent)?.indexOf(`Mac`)>=0;function tle(e){return{width:e.dimensions?.width??e.width??0,height:e.dimensions?.height??e.height??0}}function k7(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}var nle=()=>!0;function A7(e){e?.classList.remove(`valid`,`connecting`,`vue-flow__handle-valid`,`vue-flow__handle-connecting`)}function rle(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())L5(i,I5(e))>0&&r.push(e);return r}var ile=250;function ale(e,t,n,r){let i=[],a=1/0,o=rle(e,n,t+ile);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}=x7(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 j7(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=nle},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:_}=D7(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=M7(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===E5.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=N7(t,e,a,p,n,!0)}return b}function M7(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function ole(e,t){let n=null;return t?n=`valid`:e&&!t&&(n=`invalid`),n}function sle(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}function N7(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===E5.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,...x7(o,c,c.position,!0)}:c}var P7={[C5.Left]:C5.Right,[C5.Right]:C5.Left,[C5.Top]:C5.Bottom,[C5.Bottom]:C5.Top},cle=[`production`,`prod`];function F7(e,...t){I7()&&console.warn(`[Vue Flow]: ${e}`,...t)}function I7(){return!cle.includes(`production`)}function L7(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,...R5(t)}}):null}function R7(e,t,n,r,i,a=!1,o){i.value=!1,e.selected?(a||e.selected&&t)&&(r([e]),ze(()=>{o.blur()})):n([e])}function z7(e){return V(e)!==void 0}function lle(e,t,n,r){if(!e||!e.source||!e.target)return n(new T7(C7.EDGE_INVALID,e?.id??`[ID UNKNOWN]`)),!1;let i;return i=H5(e)?e:{...e,id:J5(e)},i=K5(i,void 0,r),!Hce(i,t)&&i}function ule(e,t,n,r,i){if(!t.source||!t.target)return i(new T7(C7.EDGE_INVALID,e.id)),!1;if(!n)return i(new T7(C7.EDGE_NOT_FOUND,e.id)),!1;let{id:a,...o}=e;return{...o,id:r?J5(t):a,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function B7(e,t,n){let r={},i=[];for(let a=0;a<e.length;++a){let o=e[a];if(!U5(o)){n(new T7(C7.NODE_INVALID,o?.id));continue}let s=zce(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 T7(C7.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 V7(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 H7(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}`;V7(`sourcLine truncated
`)},B(e.data.summary||e.data.detail),9,Que)):F(``,!0),e.data.when||e.data.retry||e.data.continues?(L(),j(`div`,$ue,[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(Yl),{class:`size-3 shrink-0`,"aria-hidden":`true`}),R(`span`,tde,B(e.data.when),1)],8,ede)):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(bu),{class:`size-3`,"aria-hidden":`true`}),H(`×`+B(e.data.retry),1)],8,nde)):F(``,!0),e.data.continues?(L(),j(`span`,rde,[A(V(_te),{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,ide)):F(``,!0)],64))]),A(it,{"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]||=_t(()=>{},[`stop`])},[K(t.$slots,`default`)])):F(``,!0)]),_:3}),A(V(i9),{type:`source`,position:V(C5).Bottom},null,8,[`position`]),A(V(i9),{id:`data-out`,type:`source`,position:V(C5).Right,class:`!opacity-0`},null,8,[`position`]),e.data.type===`switch`?(L(),q(V(i9),{key:1,id:`otherwise`,type:`source`,position:V(C5).Right,class:`!opacity-0`},null,8,[`position`])):F(``,!0)],2))}}),ode={class:`pointer-events-none size-full rounded-xl border border-dashed border-border bg-muted/30`},sde={class:`flex items-center gap-1 px-2.5 pt-1.5 text-caption text-fg-subtle`},cde={key:0},lde={key:1,class:`font-mono`},ude=P({__name:`LaneNode`,props:{data:{}},setup(e){return(t,n)=>(L(),j(`div`,ode,[R(`div`,sde,[e.data.lane===`switch`?(L(),j(U,{key:0},[A(V(Au),{class:`size-3`,"aria-hidden":`true`}),e.data.title==="default"?(L(),j(`span`,cde,`otherwise`)):(L(),j(`span`,lde,`= `+B(e.data.title),1))],64)):(L(),j(U,{key:1},[A(V(Zl),{class:`size-3`,"aria-hidden":`true`}),H(B(e.data.title),1)],64))])]))}}),dde={class:`flex shrink-0 items-center justify-center gap-1 border-t border-border bg-card p-1`},O9=240,fde=416,k9=-140,pde=72,mde=.9,A9=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&&A0(e)?o.value:a.value,c=e=>e.kind===`step`?JSON.stringify(e.path??null):e.kind,l=J(null),u=J(null),d=aee(`(max-width: 767px)`),f=Y(()=>{let e=Y0(o2(n.yaml),n.stages??[]);return n.types?.length?{nodes:[{id:`workflow`,type:`step`,position:{x:0,y:k9},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=uee(),b=ree(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-pde))}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+O9};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+O9/2,r=e.style?.width?parseFloat(String(e.style.width)):e.type===`step`?O9:32,i=e.position.x+r/2;return Math.abs(i-n)<O9/2?0:i<n?-88:88}let w=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=ee(t));let o=n.marks?.[t.id];o&&(t={...t,data:{...t.data,mark:o}});let c=t.positi 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 j9(e){let t=y0(e).toJS(),n=new Map;for(let r of t2(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 M9(e,t,n){let r=j9(e),i=j9(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 lde={class:`flex flex-col gap-3 md:grid md:h-[calc(100dvh-17rem)] md:min-h-[26rem] md:grid-cols-[18rem_1fr]`},ude=[`aria-current`,`onClick`],dde={class:`flex items-center gap-2 text-sm`},fde={class:`font-mono text-xs text-fg-subtle`},pde=[`title`],mde={key:0,class:`px-3 py-2 text-sm text-fg-muted`},hde={key:1,class:`flex min-h-0 flex-col gap-2`},gde={class:`flex items-center gap-2 max-md:flex-wrap`},_de={key:0,class:`rounded-lg border border-border p-4 text-sm text-fg-muted`},vde={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`},yde={class:`inline-block w-4 select-none text-fg-subtle`},bde={key:2,class:`grid min-h-0 flex-1 gap-3 max-md:flex-none md:grid-cols-2`},xde={class:`flex min-h-0 flex-col gap-1`},Sde={class:`text-caption font-medium uppercase text-fg-muted`},Cde={class:`min-h-0 flex-1 max-md:h-72 max-md:flex-none`},wde={class:`flex min-h-0 flex-col gap-1`},Tde={class:`min-h-0 flex-1 max-md:h-72 max-md:flex-none`},Ede=P({__name:`WorkflowHistory`,props:Ue({revisions:{},current:{},error:{}},{selected:{default:0},selectedModifiers:{},mode:{default:`yaml`},modeModifiers:{}}),emits:Ue([`restore`],[`update:selected`,`update:mode`]),setup(e,{emit:t}){let n=e,r=t,i=Te(e,`selected`),a=Te(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?[]:cde(s.value,n.current)),l=Y(()=>s.value!==null&&s.value===n.current),u=Y(()=>s.value===null?{}:M9(s.value,n.current,`removed`)),d=Y(()=>s.value===null?{}:M9(n.current,s.value,`added`)),f={added:`default`,edited:`secondary`,removed:`destructive`};return(t,n)=>(L(),j(`div`,lde,[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`,dde,[R(`span`,fde,`v`+B(e.version),1),A(V(O),{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(Tw),{at:e.at},null,8,[`at`])],8,pde)],10,ude)]))),128)),e.revisions.length?F(``,!0):(L(),j(`li`,mde,B(e.error||`No recorded changes`),1))],2),e.revisions.length?(L(),q(V(Wu),{key:0,"model-value":String(i.value),"onUpdate:modelValue":n[0]||=e=>i.value=Number(e)},{default:I(()=>[A(V(Ju),{class:`w-full md:hidden`,"aria-label":`Revision`},{default:I(()=>[A(V(Yu))]),_:1}),A(V(Gu),null,{default:I(()=>[(L(!0),j(U,null,M(e.revisions,e=>(L(),q(V(qu),{key:e.version,value:String(e.version)},{default:I(()=>[H(`v`+B(e.version)+` · `+B(e.change)+` · `+B(e.actor||`unknown`)+` · `+B(V(bw)(e.at)),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1},8,[`model-value`])):F(``,!0),o.value?(L(),j(`div`,hde,[R(`div`,gde,[A(V(zk),{modelValue:a.value,"onUpdate:modelValue":n[1]||=e=>a.value=e},{default:I(()=>[A(V(Vk),null,{default:I(()=>[A(V(Hk),{value:`yaml`},{default:I(()=>[...n[3]||=[H(`YAML`,-1)]]),_:1}),A(V(Hk),{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(Cu),{"data-icon":`inline-start`}),n[5]||=H(` Restore this version`,-1)]),_:1},8,[`disabled`,`title`])]),s.value===null?(L(),j(`p`,_de,`Workflow removed in this revision.`)):a.value===`yaml`?(L(),j(`pre`,vde,[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 j9(e){let t=w0(e).toJS(),n=new Map;for(let r of o2(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 M9(e,t,n){let r=j9(e),i=j9(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 yde={class:`flex flex-col gap-3 md:grid md:h-[calc(100dvh-17rem)] md:min-h-[26rem] md:grid-cols-[18rem_1fr]`},bde=[`aria-current`,`onClick`],xde={class:`flex items-center gap-2 text-sm`},Sde={class:`font-mono text-xs text-fg-subtle`},Cde=[`title`],wde={key:0,class:`px-3 py-2 text-sm text-fg-muted`},Tde={key:1,class:`flex min-h-0 flex-col gap-2`},Ede={class:`flex items-center gap-2 max-md:flex-wrap`},Dde={key:0,class:`rounded-lg border border-border p-4 text-sm text-fg-muted`},Ode={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`},kde={class:`inline-block w-4 select-none text-fg-subtle`},Ade={key:2,class:`grid min-h-0 flex-1 gap-3 max-md:flex-none md:grid-cols-2`},jde={class:`flex min-h-0 flex-col gap-1`},Mde={class:`text-caption font-medium uppercase text-fg-muted`},Nde={class:`min-h-0 flex-1 max-md:h-72 max-md:flex-none`},Pde={class:`flex min-h-0 flex-col gap-1`},Fde={class:`min-h-0 flex-1 max-md:h-72 max-md:flex-none`},Ide=P({__name:`WorkflowHistory`,props:Ue({revisions:{},current:{},error:{}},{selected:{default:0},selectedModifiers:{},mode:{default:`yaml`},modeModifiers:{}}),emits:Ue([`restore`],[`update:selected`,`update:mode`]),setup(e,{emit:t}){let n=e,r=t,i=Te(e,`selected`),a=Te(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?[]:vde(s.value,n.current)),l=Y(()=>s.value!==null&&s.value===n.current),u=Y(()=>s.value===null?{}:M9(s.value,n.current,`removed`)),d=Y(()=>s.value===null?{}:M9(n.current,s.value,`added`)),f={added:`default`,edited:`secondary`,removed:`destructive`};return(t,n)=>(L(),j(`div`,yde,[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`,xde,[R(`span`,Sde,`v`+B(e.version),1),A(V(O),{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(xw),{at:e.at},null,8,[`at`])],8,Cde)],10,bde)]))),128)),e.revisions.length?F(``,!0):(L(),j(`li`,wde,B(e.error||`No recorded changes`),1))],2),e.revisions.length?(L(),q(V(Hu),{key:0,"model-value":String(i.value),"onUpdate:modelValue":n[0]||=e=>i.value=Number(e)},{default:I(()=>[A(V(Ku),{class:`w-full md:hidden`,"aria-label":`Revision`},{default:I(()=>[A(V(qu))]),_:1}),A(V(Uu),null,{default:I(()=>[(L(!0),j(U,null,M(e.revisions,e=>(L(),q(V(Gu),{key:e.version,value:String(e.version)},{default:I(()=>[H(`v`+B(e.version)+` · `+B(e.change)+` · `+B(e.actor||`unknown`)+` · `+B(V(vw)(e.at)),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1},8,[`model-value`])):F(``,!0),o.value?(L(),j(`div`,Tde,[R(`div`,Ede,[A(V(Pk),{modelValue:a.value,"onUpdate:modelValue":n[1]||=e=>a.value=e},{default:I(()=>[A(V(Ik),null,{default:I(()=>[A(V(Lk),{value:`yaml`},{default:I(()=>[...n[3]||=[H(`YAML`,-1)]]),_:1}),A(V(Lk),{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(Su),{"data-icon":`inline-start`}),n[5]||=H(` Restore this version`,-1)]),_:1},8,[`disabled`,`title`])]),s.value===null?(L(),j(`p`,Dde,`Workflow removed in this revision.`)):a.value===`yaml`?(L(),j(`pre`,Ode,[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
+73
View File
@@ -0,0 +1,73 @@
<script setup lang="ts">
import { storeToRefs } from "pinia";
import { onMounted } from "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 { Empty, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
import { Section } from "@/components/ui/section";
import { Spinner } from "@/components/ui/spinner";
import { Timestamp } from "@/components/ui/timestamp";
import { useDenialsStore } from "@/stores/denials";
import { denialResource, type Denial } from "./denials";
const store = useDenialsStore();
const { denials, loading, error } = storeToRefs(store);
const columns: DataTableColumn<Denial>[] = [
{ id: "at", label: "When", fixed: true, sort: (d) => d.at },
{ id: "principal", label: "Principal", fixed: true, class: "whitespace-normal" },
{ id: "action", label: "Action" },
{ id: "resource", label: "Resource", class: "whitespace-normal" },
{ id: "level", label: "Level" },
{ id: "policies", label: "Deciding policies", class: "hidden md:table-cell whitespace-normal" },
{ id: "count", label: "Count", sort: (d) => d.count },
];
onMounted(() => void store.load());
</script>
<template>
<div>
<PageHeader title="Denials">
<Button variant="outline" size="sm" :disabled="loading" @click="store.load()">Refresh</Button>
</PageHeader>
<div v-if="error" role="alert" class="mb-4 text-sm text-danger">
<p>{{ error }}</p>
<Button variant="outline" size="sm" @click="store.load()">Retry</Button>
</div>
<Section>
<div class="flex flex-col gap-3">
<p v-if="loading && !denials.length" class="flex items-center gap-2 text-sm text-fg-muted">
<Spinner />Loading denials…
</p>
<Empty v-else-if="!error && !denials.length">
<EmptyHeader><EmptyTitle>No denials recorded</EmptyTitle></EmptyHeader>
</Empty>
<DataTable
v-else
:columns="columns"
:rows="denials"
:row-key="(d) => `${d.at}:${d.principal}:${d.action}:${d.kind}:${d.resource}`"
storage-key="denials"
>
<template #empty>
<Empty><EmptyHeader><EmptyTitle>No denials recorded</EmptyTitle></EmptyHeader></Empty>
</template>
<template #cell-at="{ row }"><Timestamp :at="row.at" /></template>
<template #cell-principal="{ row }"><span class="font-mono text-xs">{{ row.principal }}</span></template>
<template #cell-resource="{ row }"><span class="font-mono text-xs">{{ denialResource(row) }}</span></template>
<template #cell-level="{ row }"><Badge variant="idle">{{ row.level }}</Badge></template>
<template #cell-policies="{ row }">
<span class="font-mono text-xs text-fg-muted">{{ row.policies.join(", ") || "–" }}</span>
</template>
<template #cell-count="{ row }"><span class="tabular-nums">{{ row.count }}</span></template>
</DataTable>
</div>
</Section>
</div>
</template>
+22
View File
@@ -0,0 +1,22 @@
/** Access denials as the dashboard reads them from /api/access/denials:
* one recorded refusal, coalesced per minute into a count. */
export interface Denial {
principal: string;
org: string;
action: string;
kind: string;
resource: string;
level: string;
policies: string[];
at: string;
count: number;
}
export interface DenialsResponse {
denials: Denial[];
}
/** The resource column: the kind and id together, or just the kind. */
export function denialResource(d: Denial): string {
return d.resource ? `${d.kind}/${d.resource}` : d.kind;
}
+2
View File
@@ -175,6 +175,8 @@ export const api = {
health: <T = unknown>() => request<T>("/health/detailed"),
services: <T = unknown>() => request<T>("/api/services"),
policies: <T = unknown>() => request<T>("/api/access/policies"),
denials: <T = unknown>(limit?: number) =>
request<T>(`/api/access/denials${limit ? `?limit=${limit}` : ""}`),
putPolicy: (policy: unknown) =>
request<{ version: number }>("/api/access/policies", { method: "PUT", body: policy }),
deletePolicy: (policy: unknown) =>
+1 -1
View File
@@ -33,7 +33,7 @@ const orgSpecs: NavSpec[] = [
sections: [
{
label: "People & access",
paths: ["/org/members", "/org/agents", "/org/workspaces", "/org/policies", "/org/audit"],
paths: ["/org/members", "/org/agents", "/org/workspaces", "/org/policies", "/org/denials", "/org/audit"],
},
{
label: "Connections & models",
+12
View File
@@ -6,6 +6,7 @@ import DashboardPage from "@/dashboard/DashboardPage.vue";
import EventsPage from "@/events/EventsPage.vue";
import LogsPage from "@/logs/LogsPage.vue";
import AuditPage from "@/audit/AuditPage.vue";
import DenialsPage from "@/audit/DenialsPage.vue";
import OrgShell from "@/org/OrgShell.vue";
import OrgOverviewPage from "@/org/OrgOverviewPage.vue";
import OrgMembersPage from "@/org/OrgMembersPage.vue";
@@ -216,6 +217,17 @@ const routes = [
description: "Settings, access, identity and runtime events.",
},
},
{
path: "denials",
name: "org-denials",
component: DenialsPage,
meta: {
section: "org_denials",
label: "Denials",
navPath: "/org",
description: "Access requests the policy chain refused, newest first.",
},
},
{
path: "workspaces",
name: "org-workspaces",
+30
View File
@@ -0,0 +1,30 @@
import { defineStore } from "pinia";
import { ref } from "vue";
import type { Denial, DenialsResponse } from "@/audit/denials";
import { ApiError, api } from "@/lib/api";
/** The caller's org's recorded access denials, newest first. */
export const useDenialsStore = defineStore("denials", () => {
const denials = ref<Denial[]>([]);
const loading = ref(false);
const error = ref("");
async function load(): Promise<void> {
loading.value = true;
try {
denials.value = (await api.denials<DenialsResponse>()).denials ?? [];
error.value = "";
} catch (err) {
if (err instanceof ApiError && err.status === 503) {
error.value = "Denial records are unavailable.";
} else {
error.value = err instanceof Error && err.message ? err.message : String(err);
}
} finally {
loading.value = false;
}
}
return { denials, loading, error, load };
});