fix(ui): repair settings editing and workflow diagnostics

This commit is contained in:
sam committed 2026-10-16 23:55:58 +11:00
1 parent 2ec8c1c684
commit 57456b3e9e
46 files changed
+708 -240

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
const assert=require('node:assert/strict');
module.exports=async({page,go})=>{
await page.route('**/api/access/policies',async route=>{await new Promise(r=>setTimeout(r,2200));await route.continue()});
await go('/access/policies');
assert.equal(await page.getByText('No policies yet.',{exact:true}).count(),0);
await page.getByText('Loading policies…',{exact:true}).waitFor({state:'hidden'});
await page.route('**/api/tasks?**',async route=>{
if(new URL(route.request().url()).searchParams.has('workflow')) await route.fulfill({status:200,contentType:'application/json',body:'unreadable response'});
else await route.continue();
});
await go('/workflows');
await page.getByRole('alert').filter({hasText:'Could not load recent runs'}).waitFor();
await page.getByRole('tab',{name:/^Runs/}).click();
assert.equal(await page.getByText('No runs yet',{exact:true}).count(),0);
await page.unroute('**/api/tasks?**');
await page.getByRole('button',{name:'Retry runs',exact:true}).click();
await page.getByRole('alert').filter({hasText:'Could not load recent runs'}).waitFor({state:'hidden'});
};
+17
View File
@@ -0,0 +1,17 @@
// The save response is mocked; this checks the page's save path without changing models.
const assert=require('node:assert/strict');
module.exports=async({page,go})=>{
let submitted;
await page.route('**/api/control-plane/resources/model-aliases/commands/replace',async route=>{
submitted=route.request().postDataJSON();
await route.fulfill({json:{resource:{kind:'model-aliases',version:submitted.expected_version+1,value:submitted.value}}});
});
await go('/access/models');
await page.getByLabel('New alias',{exact:true}).fill('e2e-test');
await page.getByRole('button',{name:'Add alias',exact:true}).click();
await page.getByLabel('e2e-test',{exact:true}).fill('test/model');
await page.getByRole('button',{name:'Review and save',exact:true}).click();
await page.getByRole('button',{name:'Save',exact:true}).click();
await page.getByRole('heading',{name:/^Review \d/}).waitFor({state:'hidden'});
assert.equal(submitted?.value['e2e-test'],'test/model');
};
+34
View File
@@ -0,0 +1,34 @@
// Draft edits only: no saved configuration is changed.
const assert = require('node:assert/strict');
module.exports = async ({ page, go, shot }) => {
await go('/settings/schedules');
await page.getByRole('button', { name: 'Add schedule', exact: true }).click();
await page.getByLabel('Schedule name', { exact: true }).fill('Daily repository check');
await page.getByLabel('Instructions', { exact: true }).fill('Check the repository and report actionable failures.\n'.repeat(20));
assert.equal(await page.getByLabel('ID', { exact: true }).count(), 0);
await page.getByRole('link', { name: 'Dashboard', exact: true }).click();
await page.getByRole('link', { name: 'Settings', exact: true }).click();
await page.getByRole('link', { name: 'Channels', exact: true }).click();
await page.getByText('Chat session defaults', { exact: true }).waitFor();
const form = await page.getByText('Chat session defaults', { exact: true }).evaluate(el => el.closest('section').getBoundingClientRect().width);
assert.ok(form <= 850, `settings form stretched to ${form}px`);
const review = page.getByRole('button', { name: 'Review and save', exact: true });
await review.scrollIntoViewIfNeeded();
const unobscured = await review.evaluate(el => { const r=el.getBoundingClientRect(); const hit=document.elementFromPoint(r.x+r.width/2,r.y+r.height/2); return hit && el.contains(hit); });
assert.ok(unobscured, 'Review and save is covered');
await review.click();
await page.getByRole('heading', { name: /^Review \d/ }).waitFor();
await page.getByText('Daily repository check', { exact: false }).last().waitFor();
assert.equal(await page.locator('li p').filter({ hasText: /^After:.*\{"id":/ }).count(), 0, 'review contains a raw schedule object');
await shot('review');
await page.getByRole('button', { name: 'Discard all', exact: true }).click();
assert.equal(await page.getByRole('region', { name: 'Unsaved changes' }).count(), 0);
await page.setViewportSize({width:390,height:844});
await page.getByRole('link',{name:'Schedules',exact:true}).click();
await page.getByRole('button',{name:'Add schedule',exact:true}).click();
const mobileReview=page.getByRole('button',{name:'Review and save',exact:true});
await mobileReview.scrollIntoViewIfNeeded();
assert.ok(await mobileReview.evaluate(el=>{const r=el.getBoundingClientRect();return el.contains(document.elementFromPoint(r.x+r.width/2,r.y+r.height/2))}), 'mobile save action covered');
await shot('mobile');
await page.getByRole('button',{name:'Discard',exact:true}).click();
};
+21
View File
@@ -0,0 +1,21 @@
const assert=require('node:assert/strict');
module.exports=async({page,go,shot})=>{
await go('/tasks');
const base=new URL(page.url()).origin;
const tasks=await (await page.request.get(base+'/api/tasks')).json();
const task=tasks.find(t=>t.status==='parked' && t.attempt>0);
assert.ok(task,'seeded stack has no parked attempt to inspect');
const state=await (await page.request.get(`${base}/api/tasks/${task.id}/attempts`)).json();
assert.ok(state.attempts.some(a=>a.attempt===state.current_attempt),'claimed current attempt missing');
await go(`/tasks/${task.id}`);
assert.equal(await page.getByText(`Attempt ${state.current_attempt} is not recorded`,{exact:true}).count(),0);
const logs=await (await page.request.get(`${base}/api/tasks/${task.id}/logs?attempt=${state.current_attempt}&level=ERROR&limit=1`)).json();
await page.getByRole('button',{name:'Jump to log line',exact:true}).click();
if(logs.entries?.[0]?.id){
await page.locator(`[data-log-id="${logs.entries[0].id}"]`).waitFor();
await page.waitForFunction(id=>document.activeElement?.getAttribute('data-log-id')===String(id),logs.entries[0].id);
}else{
await page.getByText('No error log line was recorded for this attempt.',{exact:true}).waitFor();
}
await shot('attempt');
};
+14
View File
@@ -0,0 +1,14 @@
const assert = require('node:assert/strict');
module.exports = async ({ page, go, shot }) => {
await page.route('**/api/control-plane/resources/workflow-definitions', async route => {
await new Promise(resolve => setTimeout(resolve, 2200));
await route.continue();
});
await go('/workflows');
assert.equal(await page.getByText('No workflows', { exact: true }).count(), 0, 'loading presented as empty');
await page.getByText('Loading workflows…', { exact: true }).waitFor({ state: 'hidden' });
await page.getByRole('button', { name: /^implement/ }).click();
assert.equal(await page.getByText(/workflow implement has no steps/).count(), 0, 'late definition left an empty canvas');
await page.locator('.vue-flow__node').filter({ hasText: 'Repository gate' }).first().waitFor();
await shot('loaded');
};
+23
View File
@@ -0,0 +1,23 @@
const assert = require('node:assert/strict');
module.exports = async ({ page, go, shot }) => {
await go('/workflows');
await page.getByRole('button', {name:/^implement/}).click();
await page.locator('.vue-flow__node').filter({hasText:'Prepare worktree'}).first().click();
const condition=page.getByLabel('Run only when', {exact:true});
await condition.fill('what');
await page.getByRole('alert').filter({hasText:'when must name'}).first().waitFor();
assert.equal(await page.getByRole('button',{name:'Save',exact:true}).isDisabled(),true);
await condition.fill('task.title');
const backoff=page.getByLabel('Retry backoff',{exact:true});
await backoff.fill('yes');
await page.getByText('Enter a number zero or greater.',{exact:true}).waitFor();
assert.equal(await page.getByRole('button',{name:'Save',exact:true}).isDisabled(),true);
await backoff.fill('0.5');
await page.getByLabel('Run only when',{exact:true}).focus();
await page.getByText('Enter a number zero or greater.',{exact:true}).waitFor({state:'hidden'});
assert.equal(await page.getByRole('button',{name:'Save',exact:true}).isEnabled(),true);
await page.getByRole('combobox',{name:'Unit',exact:true}).selectOption('m');
await page.getByRole('tab',{name:'YAML',exact:true}).click();
assert.match(await page.getByLabel('Workflow YAML',{exact:true}).inputValue(), /backoff: 30s/);
await shot('validated');
};
+26 -30
View File
@@ -1585,11 +1585,11 @@ func (d *Daemon) process(ctx context.Context, task *workflow.Task, hold *taskHol
trees := d.treesFor(task) trees := d.treesFor(task)
repo, ok := d.repoFor(task) repo, ok := d.repoFor(task)
if !ok && task.HasRepository() { if !ok && task.HasRepository() {
d.parkRunningTask(ctx, task.ID, "repo no longer in config", taskstate.ParkTerminal) d.parkRunningTask(ctx, task, "repo no longer in config", taskstate.ParkTerminal)
return return
} }
if d.ContainerPool == nil || d.Tasks == nil { if d.ContainerPool == nil || d.Tasks == nil {
d.parkCapabilityUnavailable(ctx, task, repo) d.parkCapabilityUnavailable(ctx, task)
return return
} }
@@ -1663,7 +1663,7 @@ func (d *Daemon) prepareWorkspace(ctx context.Context, task *workflow.Task, tree
dir, err := trees.PrepareScratch(task.ID) dir, err := trees.PrepareScratch(task.ID)
if err != nil { if err != nil {
d.Log.Error("scratch workspace prepare failed", "err", err) d.Log.Error("scratch workspace prepare failed", "err", err)
d.parkRunningTask(ctx, task.ID, "scratch workspace prepare failed: "+err.Error(), taskstate.ParkTransient) d.parkRunningTask(ctx, task, "scratch workspace prepare failed: "+err.Error(), taskstate.ParkTransient)
return "", false return "", false
} }
return dir, true return dir, true
@@ -1676,7 +1676,7 @@ func (d *Daemon) prepareWorkspace(ctx context.Context, task *workflow.Task, tree
// The action refuses this combination, so an empty branch here is a // The action refuses this combination, so an empty branch here is a
// dispatch bug upstream and no retry can fix it. // dispatch bug upstream and no retry can fix it.
d.Log.Error("task has no persisted branch to continue", "task", task.ID) d.Log.Error("task has no persisted branch to continue", "task", task.ID)
d.parkRunningTask(ctx, task.ID, "worktree resume failed: task has no branch to continue", taskstate.ParkNeedsHuman) d.parkRunningTask(ctx, task, "worktree resume failed: task has no branch to continue", taskstate.ParkNeedsHuman)
return "", false return "", false
} }
target = worktree.Target(task.Branch) target = worktree.Target(task.Branch)
@@ -1695,7 +1695,7 @@ func (d *Daemon) prepareWorkspace(ctx context.Context, task *workflow.Task, tree
reason = "worktree resume failed: " + err.Error() reason = "worktree resume failed: " + err.Error()
} }
d.Log.Error("worktree prepare failed", "task", task.ID, "err", err) d.Log.Error("worktree prepare failed", "task", task.ID, "err", err)
d.parkRunningTask(ctx, task.ID, reason, taskstate.ParkTransient) d.parkRunningTask(ctx, task, reason, taskstate.ParkTransient)
return "", false return "", false
} }
task.Branch = branch task.Branch = branch
@@ -1787,7 +1787,7 @@ func (d *Daemon) acquireTaskContainer(
) (*container.Container, string, func(), bool) { ) (*container.Container, string, func(), bool) {
park := func(reason string, err error) { park := func(reason string, err error) {
d.Log.Error(reason, "err", err) d.Log.Error(reason, "err", err)
d.parkRunningTask(ctx, task.ID, reason+": "+err.Error(), taskstate.ParkTransient) d.parkRunningTask(ctx, task, reason+": "+err.Error(), taskstate.ParkTransient)
} }
// Resolve the PR number from inputs before the brief is written. // Resolve the PR number from inputs before the brief is written.
@@ -1813,7 +1813,7 @@ func (d *Daemon) acquireTaskContainer(
// normal operation, Storage is always set when ContainerPool is set. // normal operation, Storage is always set when ContainerPool is set.
if d.Storage == nil { if d.Storage == nil {
d.Log.Error("storage backend is nil -- cannot acquire container") d.Log.Error("storage backend is nil -- cannot acquire container")
d.parkRunningTask(ctx, task.ID, "storage backend not configured", taskstate.ParkTransient) d.parkRunningTask(ctx, task, "storage backend not configured", taskstate.ParkTransient)
return nil, "", nil, false return nil, "", nil, false
} }
@@ -1875,7 +1875,7 @@ func writeTaskBrief(workDir string, task *workflow.Task) error {
// missing (container pool or task transport): both are environmental, so // missing (container pool or task transport): both are environmental, so
// the park class is transient and the KindParked event carries the class // the park class is transient and the KindParked event carries the class
// for the dashboard. The reason distinguishes the two in logs and events. // for the dashboard. The reason distinguishes the two in logs and events.
func (d *Daemon) parkCapabilityUnavailable(ctx context.Context, task *workflow.Task, repo config.Repo) { func (d *Daemon) parkCapabilityUnavailable(ctx context.Context, task *workflow.Task) {
var reason string var reason string
if d.ContainerPool == nil { if d.ContainerPool == nil {
reason = "managed agent container pool is unavailable; refusing to run this task on the host" reason = "managed agent container pool is unavailable; refusing to run this task on the host"
@@ -1885,38 +1885,34 @@ func (d *Daemon) parkCapabilityUnavailable(ctx context.Context, task *workflow.T
reason = "agent task transport is unavailable; refusing to run this task on the host" reason = "agent task transport is unavailable; refusing to run this task on the host"
d.Log.Error("task parked: agent task transport unavailable", "task", task.ID) d.Log.Error("task parked: agent task transport unavailable", "task", task.ID)
} }
if err := d.Store.ParkTask(ctx, task.ID, workflow.StatusRunning, reason, taskstate.ParkTransient); err != nil { d.parkRunningTask(ctx, task, reason, taskstate.ParkTransient)
d.Log.Warn("capability park transition failed", "task", task.ID, "err", err)
return
}
d.recordPark(ctx, task.ID, reason)
d.emit(events.Event{
Kind: events.KindParked, TaskID: task.ID, Attempt: task.Attempt,
Repo: repo.FullName(), Issue: task.IssueNumber, Detail: reason,
Data: map[string]any{"park_class": taskstate.ParkTransient},
})
} }
// parkRunningTask moves a running task to parked with class, using a // parkRunningTask moves a running task to parked with class, using a
// bounded context that ignores cancellation. ErrStaleTransition is ignored; // bounded context that ignores cancellation. ErrStaleTransition is ignored;
// other errors are logged. // other errors are logged.
func (d *Daemon) parkRunningTask(ctx context.Context, taskID int64, reason string, class taskstate.ParkClass) { func (d *Daemon) parkRunningTask(ctx context.Context, task *workflow.Task, reason string, class taskstate.ParkClass) {
if d.Store == nil { if d.Store == nil {
return return
} }
writeCtx, cancel := context.WithTimeout(context.WithoutCancel(ctx), 10*time.Second) writeCtx, cancel := context.WithTimeout(context.WithoutCancel(ctx), 10*time.Second)
defer cancel() defer cancel()
if err := d.Store.ParkTask(writeCtx, taskID, workflow.StatusRunning, reason, class); err != nil { if err := d.Store.ParkTask(writeCtx, task.ID, workflow.StatusRunning, reason, class); err != nil {
if !errors.Is(err, storecontract.ErrStaleTransition) { if !errors.Is(err, storecontract.ErrStaleTransition) {
d.Log.Warn("terminal park transition failed", "task", taskID, "reason", reason, "err", err) d.Log.Warn("terminal park transition failed", "task", task.ID, "reason", reason, "err", err)
} }
return return
} }
// Recorded only once the transition landed. An entry claiming the task // Recorded only once the transition landed. An entry claiming the task
// parked would be a lie when another actor moved it out of running first // parked would be a lie when another actor moved it out of running first
// -- the same race the parked event is withheld for. // -- the same race the parked event is withheld for.
d.recordPark(ctx, taskID, reason) d.recordPark(ctx, task.ID, reason)
d.emit(events.Event{
Kind: events.KindParked, TaskID: task.ID, Attempt: task.Attempt,
Repo: strings.Trim(task.Owner+"/"+task.Repo, "/"), Issue: task.IssueNumber, Workflow: task.Workflow,
Detail: reason, Data: map[string]any{"park_class": class},
})
} }
// recordPark writes a park reason to the attempt's log. Dropped when no sink // recordPark writes a park reason to the attempt's log. Dropped when no sink
@@ -1939,7 +1935,7 @@ func (d *Daemon) recordPark(ctx context.Context, taskID int64, reason string) {
func (d *Daemon) runViaAgent(ctx context.Context, task *workflow.Task, repo config.Repo, profile config.AgentProfile, harness *agentrun.HarnessSpec, credential string) { func (d *Daemon) runViaAgent(ctx context.Context, task *workflow.Task, repo config.Repo, profile config.AgentProfile, harness *agentrun.HarnessSpec, credential string) {
cfg, err := d.taskConfig(ctx, task) cfg, err := d.taskConfig(ctx, task)
if err != nil { if err != nil {
d.parkRunningTask(ctx, task.ID, err.Error(), taskstate.ParkTransient) d.parkRunningTask(ctx, task, err.Error(), taskstate.ParkTransient)
return return
} }
taskCfg := cfg.ForTask() taskCfg := cfg.ForTask()
@@ -1958,7 +1954,7 @@ func (d *Daemon) runViaAgent(ctx context.Context, task *workflow.Task, repo conf
data, err := json.Marshal(req) data, err := json.Marshal(req)
if err != nil { if err != nil {
d.Log.Error("taskrun encode failed", "task", task.ID, "err", err) d.Log.Error("taskrun encode failed", "task", task.ID, "err", err)
d.parkRunningTask(ctx, task.ID, "taskrun encode failed: "+err.Error(), taskstate.ParkTransient) d.parkRunningTask(ctx, task, "taskrun encode failed: "+err.Error(), taskstate.ParkTransient)
return return
} }
@@ -1968,19 +1964,19 @@ func (d *Daemon) runViaAgent(ctx context.Context, task *workflow.Task, repo conf
} }
if err != nil { if err != nil {
d.Log.Error("taskrun request failed", "task", task.ID, "err", err) d.Log.Error("taskrun request failed", "task", task.ID, "err", err)
d.parkRunningTask(ctx, task.ID, "taskrun request failed: "+err.Error(), taskstate.ParkTransient) d.parkRunningTask(ctx, task, "taskrun request failed: "+err.Error(), taskstate.ParkTransient)
return return
} }
var resp taskrun.Response var resp taskrun.Response
if err := json.Unmarshal(reply, &resp); err != nil { if err := json.Unmarshal(reply, &resp); err != nil {
d.Log.Error("taskrun decode response failed", "task", task.ID, "err", err) d.Log.Error("taskrun decode response failed", "task", task.ID, "err", err)
d.parkRunningTask(ctx, task.ID, "taskrun decode response failed: "+err.Error(), taskstate.ParkTransient) d.parkRunningTask(ctx, task, "taskrun decode response failed: "+err.Error(), taskstate.ParkTransient)
return return
} }
if resp.Error != "" { if resp.Error != "" {
d.Log.Error("taskrun run failed", "task", task.ID, "err", resp.Error) d.Log.Error("taskrun run failed", "task", task.ID, "err", resp.Error)
d.parkRunningTask(ctx, task.ID, "taskrun run failed: "+resp.Error, taskstate.ParkTransient) d.parkRunningTask(ctx, task, "taskrun run failed: "+resp.Error, taskstate.ParkTransient)
return return
} }
@@ -2000,7 +1996,7 @@ func (d *Daemon) runViaAgent(ctx context.Context, task *workflow.Task, repo conf
func (d *Daemon) pinTaskProfile(ctx context.Context, task *workflow.Task) (config.AgentProfile, bool) { func (d *Daemon) pinTaskProfile(ctx context.Context, task *workflow.Task) (config.AgentProfile, bool) {
if err := d.pinWorkflowDefinition(ctx, task); err != nil { if err := d.pinWorkflowDefinition(ctx, task); err != nil {
d.Log.Error("pin workflow definition failed", "task", task.ID, "err", err) d.Log.Error("pin workflow definition failed", "task", task.ID, "err", err)
d.parkRunningTask(ctx, task.ID, "pin workflow definition: "+err.Error(), pinParkClass(err)) d.parkRunningTask(ctx, task, "pin workflow definition: "+err.Error(), pinParkClass(err))
return config.AgentProfile{}, false return config.AgentProfile{}, false
} }
iface, err := workflowtask.ParseWorkflowInterface(task.WorkflowDefinitionYAML) iface, err := workflowtask.ParseWorkflowInterface(task.WorkflowDefinitionYAML)
@@ -2019,7 +2015,7 @@ func (d *Daemon) pinTaskProfile(ctx context.Context, task *workflow.Task) (confi
} }
} }
d.Log.Error("agent profile unavailable", "task", task.ID, "err", err) d.Log.Error("agent profile unavailable", "task", task.ID, "err", err)
d.parkRunningTask(ctx, task.ID, "workflow "+task.Workflow+": "+err.Error(), taskstate.ParkNeedsHuman) d.parkRunningTask(ctx, task, "workflow "+task.Workflow+": "+err.Error(), taskstate.ParkNeedsHuman)
return config.AgentProfile{}, false return config.AgentProfile{}, false
} }
@@ -2382,7 +2378,7 @@ func (d *Daemon) parkIfIdentityUnresolvable(ctx context.Context, task *workflow.
if ok { if ok {
return false return false
} }
d.parkRunningTask(ctx, task.ID, reason, class) d.parkRunningTask(ctx, task, reason, class)
return true return true
} }
+1 -1
View File
@@ -29,7 +29,7 @@ type KitLauncher interface {
func (d *Daemon) runKitTask(ctx context.Context, task *workflow.Task, repo config.Repo, workDir string, profile config.AgentProfile) { func (d *Daemon) runKitTask(ctx context.Context, task *workflow.Task, repo config.Repo, workDir string, profile config.AgentProfile) {
park := func(reason string, err error) { park := func(reason string, err error) {
d.Log.Error(reason, "task", task.ID, "err", err) d.Log.Error(reason, "task", task.ID, "err", err)
d.parkRunningTask(ctx, task.ID, reason+": "+err.Error(), taskstate.ParkTransient) d.parkRunningTask(ctx, task, reason+": "+err.Error(), taskstate.ParkTransient)
} }
if d.KitLauncher == nil { if d.KitLauncher == nil {
park("kit profile", fmt.Errorf("kit harness runs are unavailable on this daemon")) park("kit profile", fmt.Errorf("kit harness runs are unavailable on this daemon"))
+52
View File
@@ -0,0 +1,52 @@
package daemon
import (
"context"
"log/slog"
"testing"
"github.com/samcharles93/archie-core/internal/domain/storecontract"
"github.com/samcharles93/archie-core/internal/domain/workflow"
"github.com/samcharles93/archie-core/internal/events"
"github.com/samcharles93/archie-core/internal/taskstate"
)
type parkStore struct {
storecontract.TaskStore
err error
}
func (s parkStore) ParkTask(context.Context, int64, string, string, taskstate.ParkClass) error {
return s.err
}
func TestEarlyParkRecordsAttempt(t *testing.T) {
for _, stale := range []bool{false, true} {
t.Run(map[bool]string{false: "parked", true: "stale"}[stale], func(t *testing.T) {
var err error
if stale {
err = storecontract.ErrStaleTransition
}
bus := events.NewBus()
defer bus.Close()
sub := bus.Subscribe(1)
defer sub.Close()
d := &Daemon{Store: parkStore{err: err}, Bus: bus, Log: slog.New(slog.DiscardHandler)}
task := &workflow.Task{ID: 7, Attempt: 3, Owner: "owner", Repo: "repo", Workflow: "implement"}
d.parkRunningTask(t.Context(), task, "clone authentication failed", taskstate.ParkNeedsHuman)
select {
case event := <-sub.C:
if stale {
t.Fatal("stale park emitted an event")
}
if event.Attempt != 3 || event.Kind != events.KindParked || event.Detail != "clone authentication failed" {
t.Fatalf("park event = %+v", event)
}
default:
if !stale {
t.Fatal("early park did not record the attempt")
}
}
})
}
}
+6 -6
View File
@@ -22,29 +22,29 @@ import (
func (d *Daemon) adoptWorkflowIdentity(ctx context.Context, task *workflow.Task) bool { func (d *Daemon) adoptWorkflowIdentity(ctx context.Context, task *workflow.Task) bool {
if err := d.pinWorkflowDefinition(ctx, task); err != nil { if err := d.pinWorkflowDefinition(ctx, task); err != nil {
d.Log.Error("pin workflow definition failed", "task", task.ID, "err", err) d.Log.Error("pin workflow definition failed", "task", task.ID, "err", err)
d.parkRunningTask(ctx, task.ID, "pin workflow definition: "+err.Error(), pinParkClass(err)) d.parkRunningTask(ctx, task, "pin workflow definition: "+err.Error(), pinParkClass(err))
return false return false
} }
iface, err := workflowtask.ParseWorkflowInterface(task.WorkflowDefinitionYAML) iface, err := workflowtask.ParseWorkflowInterface(task.WorkflowDefinitionYAML)
if err != nil { if err != nil {
d.parkRunningTask(ctx, task.ID, "workflow "+task.Workflow+": "+err.Error(), taskstate.ParkNeedsHuman) d.parkRunningTask(ctx, task, "workflow "+task.Workflow+": "+err.Error(), taskstate.ParkNeedsHuman)
return false return false
} }
if iface.Identity == "" { if iface.Identity == "" {
d.parkRunningTask(ctx, task.ID, "workflow "+task.Workflow+" declares no identity to run as; set one in its settings", taskstate.ParkNeedsHuman) d.parkRunningTask(ctx, task, "workflow "+task.Workflow+" declares no identity to run as; set one in its settings", taskstate.ParkNeedsHuman)
return false return false
} }
runsAs, runnerName, ok := d.declaredIdentity(iface.Identity) runsAs, runnerName, ok := d.declaredIdentity(iface.Identity)
if !ok { if !ok {
d.parkRunningTask(ctx, task.ID, "workflow "+task.Workflow+" runs as identity "+iface.Identity+", which is not configured", taskstate.ParkNeedsHuman) d.parkRunningTask(ctx, task, "workflow "+task.Workflow+" runs as identity "+iface.Identity+", which is not configured", taskstate.ParkNeedsHuman)
return false return false
} }
if !d.mayRunWorkflow(ctx, task, d.publisherIdentity(task.Identity)) { if !d.mayRunWorkflow(ctx, task, d.publisherIdentity(task.Identity)) {
d.parkRunningTask(ctx, task.ID, "the identity that started it may not run workflow "+task.Workflow, taskstate.ParkNeedsHuman) d.parkRunningTask(ctx, task, "the identity that started it may not run workflow "+task.Workflow, taskstate.ParkNeedsHuman)
return false return false
} }
if !d.mayRunWorkflow(ctx, task, runsAs) { if !d.mayRunWorkflow(ctx, task, runsAs) {
d.parkRunningTask(ctx, task.ID, "identity "+iface.Identity+" may not run workflow "+task.Workflow, taskstate.ParkNeedsHuman) d.parkRunningTask(ctx, task, "identity "+iface.Identity+" may not run workflow "+task.Workflow, taskstate.ParkNeedsHuman)
return false return false
} }
// In memory only: the stored identity stays the starter's, so every // In memory only: the stored identity stays the starter's, so every
+1 -1
View File
@@ -34,7 +34,7 @@ type JobSpec struct {
Pool string `json:"pool,omitempty"` Pool string `json:"pool,omitempty"`
// Detail is a human-readable label rendered on events. // Detail is a human-readable label rendered on events.
Detail string `json:"detail,omitempty"` Detail string `json:"detail,omitempty" title:"Schedule name"`
// Kind selects the delivery runner. Empty means KindChat. // Kind selects the delivery runner. Empty means KindChat.
Kind string `json:"kind,omitempty"` Kind string `json:"kind,omitempty"`
+29
View File
@@ -0,0 +1,29 @@
package webui
import (
"context"
"strings"
"github.com/samcharles93/archie-core/internal/domain/identity"
)
// actorNames resolves each actor once per response; stable IDs stay in the wire record.
func (s *Server) actorNames(ctx context.Context) func(string) string {
names := map[string]string{}
return func(id string) string {
if label, ok := names[id]; ok {
return label
}
label := id
if strings.Count(id, "-") == 4 {
label = "Unavailable identity"
}
if s.Identities != nil {
if actor, err := s.Identities.Get(ctx, identity.IdentityID(id)); err == nil && actor.DisplayName != "" {
label = actor.DisplayName
}
}
names[id] = label
return label
}
}
+31
View File
@@ -0,0 +1,31 @@
package webui
import (
"context"
"testing"
"github.com/samcharles93/archie-core/internal/domain/identity"
)
type namedActors struct{ identity.Repository }
func (namedActors) Get(_ context.Context, id identity.IdentityID) (identity.Identity, error) {
if id == "11111111-1111-4111-8111-111111111111" || id == "d898c8c8-47f4-57d6c-945a-2e7dc98ca1c1" {
return identity.Identity{ID: id, DisplayName: "Sam"}, nil
}
return identity.Identity{}, identity.ErrNotFound
}
func TestAuditActorNames(t *testing.T) {
name := (&Server{Identities: namedActors{}}).actorNames(t.Context())
for _, tc := range []struct{ id, want string }{
{"11111111-1111-4111-8111-111111111111", "Sam"},
{"d898c8c8-47f4-57d6c-945a-2e7dc98ca1c1", "Sam"},
{"22222222-2222-4222-8222-222222222222", "Unavailable identity"},
{"system:migration", "system:migration"},
} {
if got := name(tc.id); got != tc.want {
t.Errorf("actor %s = %s, want %s", tc.id, got, tc.want)
}
}
}
+3 -1
View File
@@ -19,6 +19,7 @@ type auditEntryView struct {
NewValue json.RawMessage `json:"new_value"` NewValue json.RawMessage `json:"new_value"`
Version int64 `json:"version"` Version int64 `json:"version"`
Actor string `json:"actor"` Actor string `json:"actor"`
ActorName string `json:"actor_name"`
Source string `json:"source"` Source string `json:"source"`
At *time.Time `json:"at,omitempty"` At *time.Time `json:"at,omitempty"`
} }
@@ -39,11 +40,12 @@ func (s *Server) handleAudit(w http.ResponseWriter, r *http.Request) {
return return
} }
entries := make([]auditEntryView, 0, len(response.Entries)) entries := make([]auditEntryView, 0, len(response.Entries))
actorName := s.actorNames(r.Context())
for _, entry := range response.Entries { for _, entry := range response.Entries {
view := auditEntryView{ view := auditEntryView{
ID: entry.Id, Table: entry.Table, RecordKey: entry.RecordKey, Field: entry.Field, ID: entry.Id, Table: entry.Table, RecordKey: entry.RecordKey, Field: entry.Field,
OldValue: jsonOrNull(entry.OldValueJson), NewValue: jsonOrNull(entry.NewValueJson), OldValue: jsonOrNull(entry.OldValueJson), NewValue: jsonOrNull(entry.NewValueJson),
Version: entry.Version, Actor: entry.Actor, Source: entry.Source, Version: entry.Version, Actor: entry.Actor, ActorName: actorName(entry.Actor), Source: entry.Source,
} }
if entry.At != nil { if entry.At != nil {
at := entry.At.AsTime() at := entry.At.AsTime()
+3 -1
View File
@@ -36,6 +36,7 @@ type controlPlaneRevision struct {
Version int64 `json:"version"` Version int64 `json:"version"`
Value json.RawMessage `json:"value"` Value json.RawMessage `json:"value"`
Actor string `json:"actor"` Actor string `json:"actor"`
ActorName string `json:"actor_name"`
Source string `json:"source"` Source string `json:"source"`
RequestID string `json:"request_id"` RequestID string `json:"request_id"`
At *time.Time `json:"at,omitempty"` At *time.Time `json:"at,omitempty"`
@@ -82,9 +83,10 @@ func (s *Server) handleControlPlaneHistory(w http.ResponseWriter, r *http.Reques
return return
} }
revisions := make([]controlPlaneRevision, 0, len(response.Revisions)) revisions := make([]controlPlaneRevision, 0, len(response.Revisions))
actorName := s.actorNames(r.Context())
for _, revision := range response.Revisions { for _, revision := range response.Revisions {
view := controlPlaneRevision{ view := controlPlaneRevision{
Version: revision.Version, Value: revision.ValueJson, Actor: revision.Actor, Version: revision.Version, Value: revision.ValueJson, Actor: revision.Actor, ActorName: actorName(revision.Actor),
Source: revision.Source, RequestID: revision.RequestId, Source: revision.Source, RequestID: revision.RequestId,
} }
if revision.At != nil { if revision.At != nil {
+44
View File
@@ -50,6 +50,7 @@ type taskAttemptView struct {
FinishedAt *time.Time `json:"finished_at,omitempty"` FinishedAt *time.Time `json:"finished_at,omitempty"`
DurationMS *int64 `json:"duration_ms,omitempty"` DurationMS *int64 `json:"duration_ms,omitempty"`
EventCount int `json:"event_count"` EventCount int `json:"event_count"`
Error string `json:"error,omitempty"`
Stages []taskStageView `json:"stages"` Stages []taskStageView `json:"stages"`
} }
@@ -101,6 +102,11 @@ func (s *Server) handleTaskAttempts(w http.ResponseWriter, r *http.Request) {
} }
} }
attempts := attemptsFromEvents(evs, steps, t.Status, t.Attempt) attempts := attemptsFromEvents(evs, steps, t.Status, t.Attempt)
for i := range attempts {
if attempts[i].Attempt == t.Attempt && t.Status == task.StatusParked {
attempts[i].Error = t.ParkReason
}
}
writeJSON(w, taskAttemptsView{ writeJSON(w, taskAttemptsView{
TaskID: t.ID, TaskID: t.ID,
CurrentAttempt: t.Attempt, CurrentAttempt: t.Attempt,
@@ -170,6 +176,19 @@ func attemptsFromEvents(evs []events.Event, steps []task.StepExecution, taskStat
} }
grouped[e.Attempt] = append(grouped[e.Attempt], e) grouped[e.Attempt] = append(grouped[e.Attempt], e)
} }
// A claimed attempt exists even if preparation failed before its first step.
if currentAttempt > 0 {
if _, seen := grouped[currentAttempt]; !seen {
grouped[currentAttempt] = nil
numbers = append(numbers, currentAttempt)
}
}
for _, step := range steps {
if _, seen := grouped[step.Attempt]; !seen && step.Attempt > 0 {
grouped[step.Attempt] = nil
numbers = append(numbers, step.Attempt)
}
}
sort.Ints(numbers) sort.Ints(numbers)
attempts := make([]taskAttemptView, 0, len(numbers)) attempts := make([]taskAttemptView, 0, len(numbers))
@@ -208,6 +227,9 @@ func attemptRail(number int, evs []events.Event, steps []task.StepExecution, tas
EventCount: len(evs), EventCount: len(evs),
Stages: stages, Stages: stages,
} }
if attempt.Status == attemptStatusUnknown {
attempt.Status, attempt.Error = earlyAttemptOutcome(evs, number, taskStatus, currentAttempt)
}
if !first.IsZero() { if !first.IsZero() {
attempt.StartedAt = &first attempt.StartedAt = &first
} }
@@ -223,6 +245,28 @@ func attemptRail(number int, evs []events.Event, steps []task.StepExecution, tas
return attempt return attempt
} }
// earlyAttemptOutcome uses explicit park evidence when no stage ran.
func earlyAttemptOutcome(evs []events.Event, number int, taskStatus string, currentAttempt int) (string, string) {
status, detail := attemptStatusUnknown, ""
for _, event := range evs {
switch event.Kind {
case events.KindParked:
status, detail = task.StatusParked, event.Detail
case events.KindTaskRetried:
if reason, ok := event.Data["previous_reason"].(string); ok && reason != "" {
status, detail = task.StatusParked, reason
}
}
}
if number == currentAttempt {
switch taskStatus {
case task.StatusParked, task.StatusDead, task.StatusWaitingHuman:
status = taskStatus
}
}
return status, detail
}
// attemptBounds is the span of an attempt's own recorded events: the earliest // attemptBounds is the span of an attempt's own recorded events: the earliest
// and latest timestamp any of them carries. A zero time contributes nothing -- a // and latest timestamp any of them carries. A zero time contributes nothing -- a
// record whose timestamp did not parse is not evidence of when it happened. // record whose timestamp did not parse is not evidence of when it happened.
+36
View File
@@ -0,0 +1,36 @@
package webui
import (
"testing"
"github.com/samcharles93/archie-core/internal/domain/workflow/task"
"github.com/samcharles93/archie-core/internal/events"
"github.com/samcharles93/archie-core/internal/taskstate"
)
func TestEarlyAttemptHistory(t *testing.T) {
for _, tc := range []struct {
name string
events []events.Event
steps []task.StepExecution
status string
current int
want string
}{
{name: "current parked attempt without stage events", status: task.StatusParked, current: 3, want: "parked"},
{name: "retry preserves the previous park reason", events: []events.Event{{Attempt: 1, Kind: events.KindTaskRetried, Data: map[string]any{"previous_reason": "clone authentication failed"}}}, status: task.StatusRunning, current: 2, want: "parked"},
{name: "historical early failure", events: []events.Event{{Attempt: 1, Kind: events.KindParked, Detail: "clone failed"}}, status: task.StatusRunning, current: 2, want: "parked"},
{name: "step execution without events", steps: []task.StepExecution{{Attempt: 1, Kind: task.StepKindStage, Name: "prepare", Status: taskstate.StepFailed}}, status: task.StatusParked, current: 2, want: "failed"},
{name: "historical state has no recorded outcome", events: []events.Event{{Attempt: 1, Kind: events.KindTaskRetried}}, status: task.StatusRunning, current: 2, want: "unknown"},
} {
t.Run(tc.name, func(t *testing.T) {
attempts := attemptsFromEvents(tc.events, tc.steps, tc.status, tc.current)
if len(attempts) == 0 {
t.Fatal("current attempt missing")
}
if attempts[0].Status != tc.want {
t.Fatalf("status = %s, want %s", attempts[0].Status, tc.want)
}
})
}
}
+2 -2
View File
@@ -1,3 +1,3 @@
import{$ as e,$t as t,A as n,At as r,B as i,Bt as a,C as o,Cn as s,Ct as c,D as l,Dn as u,Dt as d,E as f,En as p,Et as m,F as h,Ft as g,G as _,Gt as v,H as y,Ht as b,I as x,It as S,J as C,Jt as w,K as T,Kt as E,L as ee,Lt as te,M as D,Mn as ne,Mt as re,N as ie,Nn as ae,Nt as oe,O,On as se,Ot as ce,P as le,Pt as ue,Q as de,Qn as fe,Qt as pe,R as me,Rt as he,S as ge,Sn as _e,St as k,T as ve,Tn as ye,Tt as be,U as xe,Ut as A,V as Se,Vt as Ce,W as we,Wt as j,X as Te,Xt as Ee,Y as De,Yt as Oe,Z as ke,Zt as Ae,_ as M,_n as je,_t as Me,a as Ne,an as Pe,at as Fe,b as Ie,bn as Le,bt as Re,c as ze,cn as Be,ct as Ve,d as He,dn as Ue,dt as We,en as Ge,er as Ke,et as qe,f as Je,fn as Ye,ft as Xe,g as Ze,gn as Qe,gt as $e,h as et,hn as tt,ht as N,i as nt,in as rt,it,j as at,jt as ot,k as st,kn as P,kt as ct,l as lt,ln as ut,lt as dt,m as ft,mn as pt,mt,n as ht,nn as gt,nr as _t,nt as F,o as vt,on as yt,ot as bt,p as xt,pn as St,pt as Ct,q as wt,qt as Tt,r as Et,rn as Dt,rr as Ot,rt as kt,s as At,sn as jt,st as Mt,tn as Nt,tr as Pt,tt as I,u as Ft,un as It,ut as Lt,v as Rt,vn as zt,vt as Bt,w as Vt,wn as Ht,wt as Ut,x as Wt,xn as Gt,xt as Kt,y as L,yn as R,yt as qt,z as Jt,zt as Yt}from"./PageHeader.js";import{A as Xt,B as Zt,C as Qt,D as $t,E as en,F as tn,H as nn,I as rn,L as an,M as on,N as sn,O as cn,P as ln,R as un,S as dn,T as fn,U as pn,V as mn,W as hn,_ as z,a as gn,f as _n,g as vn,h as yn,i as bn,j as xn,k as Sn,n as Cn,s as wn,w as Tn,x as En,y as Dn,z as On}from"./api.js";import{n as kn}from"./pinia.js";import{a as An,i as jn,n as Mn,o as Nn,r as Pn,t as Fn}from"./alert.js";var In=Object.defineProperty,Ln=((e,t)=>{let n={};for(var r in e)In(n,r,{get:e[r],enumerable:!0});return t||In(n,Symbol.toStringTag,{value:`Module`}),n})({BaseTransition:()=>ht,BaseTransitionPropsValidators:()=>Et,Comment:()=>nt,DeprecationTypes:()=>null,EffectScope:()=>t,ErrorCodes:()=>Ne,ErrorTypeStrings:()=>vt,Fragment:()=>At,KeepAlive:()=>ze,ReactiveEffect:()=>Ge,Static:()=>lt,Suspense:()=>Ft,Teleport:()=>He,Text:()=>Je,TrackOpTypes:()=>Nt,Transition:()=>En,TransitionGroup:()=>dn,TriggerOpTypes:()=>gt,VueElement:()=>Qt,assertNumber:()=>xt,callWithAsyncErrorHandling:()=>ft,callWithErrorHandling:()=>et,camelize:()=>ne,capitalize:()=>ae,cloneVNode:()=>Ze,compatUtils:()=>null,compile:()=>Rn,computed:()=>M,createApp:()=>Tn,createBlock:()=>L,createCommentVNode:()=>Ie,createElementBlock:()=>Wt,createElementVNode:()=>Rt,createHydrationRenderer:()=>ge,createPropsRestProxy:()=>o,createRenderer:()=>Vt,createSSRApp:()=>fn,createSlots:()=>ve,createStaticVNode:()=>f,createTextVNode:()=>l,createVNode:()=>O,customRef:()=>Dt,defineAsyncComponent:()=>st,defineComponent:()=>n,defineCustomElement:()=>en,defineEmits:()=>at,defineExpose:()=>D,defineModel:()=>ie,defineOptions:()=>le,defineProps:()=>h,defineSSRCustomElement:()=>$t,defineSlots:()=>x,devtools:()=>ee,effect:()=>rt,effectScope:()=>Pe,getCurrentInstance:()=>me,getCurrentScope:()=>yt,getCurrentWatcher:()=>jt,getTransitionRawChildren:()=>Jt,guardReactiveProps:()=>i,h:()=>Se,handleError:()=>y,hasInjectionContext:()=>xe,hydrate:()=>cn,hydrateOnIdle:()=>we,hydrateOnInteraction:()=>_,hydrateOnMediaQuery:()=>T,hydrateOnVisible:()=>wt,initCustomFormatter:()=>C,initDirectivesForSSR:()=>Sn,inject:()=>De,isMemoSame:()=>Te,isProxy:()=>Be,isReactive:()=>ut,isReadonly:()=>It,isRef:()=>Ue,isRuntimeOnly:()=>ke,isShallow:()=>Ye,isVNode:()=>de,markRaw:()=>St,mergeDefaults:()=>e,mergeModels:()=>qe,mergeProps:()=>I,nextTick:()=>F,nodeOps:()=>Xt,normalizeClass:()=>fe,normalizeProps:()=>Ke,normalizeStyle:()=>Pt,onActivated:()=>kt,onBeforeMount:()=>it,onBeforeUnmount:()=>Fe,onBeforeUpdate:()=>bt,onDeactivated:()=>Mt,onErrorCaptured:()=>Ve,onMounted:()=>dt,onRenderTracked:()=>Lt,onRenderTriggered:()=>We,onScopeDispose:()=>pt,onServerPrefetch:()=>Xe,onUnmounted:()=>Ct,onUpdated:()=>mt,onWatcherCleanup:()=>tt,openBlock:()=>N,patchProp:()=>xn,popScopeId:()=>$e,provide:()=>Me,proxyRefs:()=>Qe,pushScopeId:()=>Bt,queuePostFlushCb:()=>qt,reactive:()=>je,readonly:()=>zt,ref:()=>R,registerRuntimeCompiler:()=>Re,render:()=>on,renderList:()=>Kt,renderSlot:()=>k,resolveComponent:()=>c,resolveDirective:()=>Ut,resolveDynamicComponent:()=>be,resolveFilter:()=>null,resolveTransitionHooks:()=>m,setBlockTracking:()=>d,setDevtoolsHook:()=>ce,setTransitionHooks:()=>ct,shallowReactive:()=>Le,shallowReadonly:()=>Gt,shallowRef:()=>_e,ssrContextKey:()=>r,ssrUtils:()=>ot,stop:()=>s,toDisplayString:()=>_t,toHandlerKey:()=>Ot,toHandlers:()=>re,toRaw:()=>Ht,toRef:()=>ye,toRefs:()=>p,toValue:()=>u,transformVNodeArgs:()=>oe,triggerRef:()=>se,unref:()=>P,useAttrs:()=>ue,useCssModule:()=>sn,useCssVars:()=>ln,useHost:()=>tn,useId:()=>g,useModel:()=>S,useSSRContext:()=>te,useShadowRoot:()=>rn,useSlots:()=>he,useTemplateRef:()=>Yt,useTransitionState:()=>a,vModelCheckbox:()=>an,vModelDynamic:()=>un,vModelRadio:()=>On,vModelSelect:()=>Zt,vModelText:()=>mn,vShow:()=>nn,version:()=>Ce,warn:()=>b,watch:()=>A,watchEffect:()=>j,watchPostEffect:()=>v,watchSyncEffeLine truncated import{$ as e,$t as t,A as n,At as r,B as i,Bt as a,C as o,Cn as s,Ct as c,D as l,Dn as u,Dt as d,E as f,En as p,Et as m,F as h,Ft as g,G as _,Gt as v,H as y,Ht as b,I as x,It as S,J as C,Jt as w,K as T,Kt as E,L as ee,Lt as te,M as D,Mn as ne,Mt as re,N as ie,Nn as ae,Nt as oe,O,On as se,Ot as ce,P as le,Pt as ue,Q as de,Qn as fe,Qt as pe,R as me,Rt as he,S as ge,Sn as _e,St as k,T as ve,Tn as ye,Tt as be,U as xe,Ut as A,V as Se,Vt as Ce,W as we,Wt as j,X as Te,Xt as Ee,Y as De,Yt as Oe,Z as ke,Zt as Ae,_ as M,_n as je,_t as Me,a as Ne,an as Pe,at as Fe,b as Ie,bn as Le,bt as Re,c as ze,cn as Be,ct as Ve,d as He,dn as Ue,dt as We,en as Ge,er as Ke,et as qe,f as Je,fn as Ye,ft as Xe,g as Ze,gn as Qe,gt as $e,h as et,hn as tt,ht as N,i as nt,in as rt,it,j as at,jt as ot,k as st,kn as P,kt as ct,l as lt,ln as ut,lt as dt,m as ft,mn as pt,mt,n as ht,nn as gt,nr as _t,nt as F,o as vt,on as yt,ot as bt,p as xt,pn as St,pt as Ct,q as wt,qt as Tt,r as Et,rn as Dt,rr as Ot,rt as kt,s as At,sn as jt,st as Mt,tn as Nt,tr as Pt,tt as I,u as Ft,un as It,ut as Lt,v as Rt,vn as zt,vt as Bt,w as Vt,wn as Ht,wt as Ut,x as Wt,xn as Gt,xt as Kt,y as L,yn as R,yt as qt,z as Jt,zt as Yt}from"./PageHeader.js";import{A as Xt,B as Zt,C as Qt,D as $t,E as en,F as tn,H as nn,I as rn,L as an,M as on,N as sn,O as cn,P as ln,R as un,S as dn,T as fn,U as pn,V as mn,W as hn,_ as z,a as gn,f as _n,g as vn,h as yn,i as bn,j as xn,k as Sn,n as Cn,s as wn,w as Tn,x as En,y as Dn,z as On}from"./api.js";import{n as kn}from"./pinia.js";import{a as An,i as jn,n as Mn,o as Nn,r as Pn,t as Fn}from"./alert.js";var In=Object.defineProperty,Ln=((e,t)=>{let n={};for(var r in e)In(n,r,{get:e[r],enumerable:!0});return t||In(n,Symbol.toStringTag,{value:`Module`}),n})({BaseTransition:()=>ht,BaseTransitionPropsValidators:()=>Et,Comment:()=>nt,DeprecationTypes:()=>null,EffectScope:()=>t,ErrorCodes:()=>Ne,ErrorTypeStrings:()=>vt,Fragment:()=>At,KeepAlive:()=>ze,ReactiveEffect:()=>Ge,Static:()=>lt,Suspense:()=>Ft,Teleport:()=>He,Text:()=>Je,TrackOpTypes:()=>Nt,Transition:()=>En,TransitionGroup:()=>dn,TriggerOpTypes:()=>gt,VueElement:()=>Qt,assertNumber:()=>xt,callWithAsyncErrorHandling:()=>ft,callWithErrorHandling:()=>et,camelize:()=>ne,capitalize:()=>ae,cloneVNode:()=>Ze,compatUtils:()=>null,compile:()=>Rn,computed:()=>M,createApp:()=>Tn,createBlock:()=>L,createCommentVNode:()=>Ie,createElementBlock:()=>Wt,createElementVNode:()=>Rt,createHydrationRenderer:()=>ge,createPropsRestProxy:()=>o,createRenderer:()=>Vt,createSSRApp:()=>fn,createSlots:()=>ve,createStaticVNode:()=>f,createTextVNode:()=>l,createVNode:()=>O,customRef:()=>Dt,defineAsyncComponent:()=>st,defineComponent:()=>n,defineCustomElement:()=>en,defineEmits:()=>at,defineExpose:()=>D,defineModel:()=>ie,defineOptions:()=>le,defineProps:()=>h,defineSSRCustomElement:()=>$t,defineSlots:()=>x,devtools:()=>ee,effect:()=>rt,effectScope:()=>Pe,getCurrentInstance:()=>me,getCurrentScope:()=>yt,getCurrentWatcher:()=>jt,getTransitionRawChildren:()=>Jt,guardReactiveProps:()=>i,h:()=>Se,handleError:()=>y,hasInjectionContext:()=>xe,hydrate:()=>cn,hydrateOnIdle:()=>we,hydrateOnInteraction:()=>_,hydrateOnMediaQuery:()=>T,hydrateOnVisible:()=>wt,initCustomFormatter:()=>C,initDirectivesForSSR:()=>Sn,inject:()=>De,isMemoSame:()=>Te,isProxy:()=>Be,isReactive:()=>ut,isReadonly:()=>It,isRef:()=>Ue,isRuntimeOnly:()=>ke,isShallow:()=>Ye,isVNode:()=>de,markRaw:()=>St,mergeDefaults:()=>e,mergeModels:()=>qe,mergeProps:()=>I,nextTick:()=>F,nodeOps:()=>Xt,normalizeClass:()=>fe,normalizeProps:()=>Ke,normalizeStyle:()=>Pt,onActivated:()=>kt,onBeforeMount:()=>it,onBeforeUnmount:()=>Fe,onBeforeUpdate:()=>bt,onDeactivated:()=>Mt,onErrorCaptured:()=>Ve,onMounted:()=>dt,onRenderTracked:()=>Lt,onRenderTriggered:()=>We,onScopeDispose:()=>pt,onServerPrefetch:()=>Xe,onUnmounted:()=>Ct,onUpdated:()=>mt,onWatcherCleanup:()=>tt,openBlock:()=>N,patchProp:()=>xn,popScopeId:()=>$e,provide:()=>Me,proxyRefs:()=>Qe,pushScopeId:()=>Bt,queuePostFlushCb:()=>qt,reactive:()=>je,readonly:()=>zt,ref:()=>R,registerRuntimeCompiler:()=>Re,render:()=>on,renderList:()=>Kt,renderSlot:()=>k,resolveComponent:()=>c,resolveDirective:()=>Ut,resolveDynamicComponent:()=>be,resolveFilter:()=>null,resolveTransitionHooks:()=>m,setBlockTracking:()=>d,setDevtoolsHook:()=>ce,setTransitionHooks:()=>ct,shallowReactive:()=>Le,shallowReadonly:()=>Gt,shallowRef:()=>_e,ssrContextKey:()=>r,ssrUtils:()=>ot,stop:()=>s,toDisplayString:()=>_t,toHandlerKey:()=>Ot,toHandlers:()=>re,toRaw:()=>Ht,toRef:()=>ye,toRefs:()=>p,toValue:()=>u,transformVNodeArgs:()=>oe,triggerRef:()=>se,unref:()=>P,useAttrs:()=>ue,useCssModule:()=>sn,useCssVars:()=>ln,useHost:()=>tn,useId:()=>g,useModel:()=>S,useSSRContext:()=>te,useShadowRoot:()=>rn,useSlots:()=>he,useTemplateRef:()=>Yt,useTransitionState:()=>a,vModelCheckbox:()=>an,vModelDynamic:()=>un,vModelRadio:()=>On,vModelSelect:()=>Zt,vModelText:()=>mn,vShow:()=>nn,version:()=>Ce,warn:()=>b,watch:()=>A,watchEffect:()=>j,watchPostEffect:()=>v,watchSyncEffeLine truncated
`)].join(` `)].join(`
`))}return()=>i.value||r.value||o.value?Se(t.default({present:o.value})[0],{ref:e=>{let t=H(e);return t?.hasAttribute===void 0||(t?.hasAttribute(`data-reka-popper-content-wrapper`)?a.value=t.firstElementChild:a.value=t),t}}):null}}),[_i,vi]=Gn(`CollapsibleRoot`),yi=n({__name:`CollapsibleRoot`,props:{defaultOpen:{type:Boolean,required:!1,default:!1},open:{type:Boolean,required:!1,default:void 0},disabled:{type:Boolean,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`update:open`],setup(e,{expose:t,emit:n}){let r=e,i=kr(r,`open`,n,{defaultValue:r.defaultOpen,passive:r.open===void 0}),{disabled:a,unmountOnHide:o}=p(r);return vi({contentId:``,disabled:a,open:i,unmountOnHide:o,onOpenToggle:()=>{a.value||(i.value=!i.value)}}),t({open:i}),W(),(t,n)=>(N(),L(P(z),{as:e.as,"as-child":r.asChild,"data-state":P(i)?`open`:`closed`,"data-disabled":P(a)?``:void 0},{default:w(()=>[k(t.$slots,`default`,{open:P(i)})]),_:3},8,[`as`,`as-child`,`data-state`,`data-disabled`]))}}),bi=n({inheritAttrs:!1,__name:`CollapsibleContent`,props:{forceMount:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`contentFound`],setup(e,{emit:t}){let n=e,r=t,i=_i();i.contentId||=di(void 0,`reka-collapsible-content`);let a=R(),{forwardRef:o,currentElement:s}=W(),c=R(0),l=R(0),u=M(()=>i.open.value),d=R(u.value),f=R();A(()=>[u.value,a.value?.present],async()=>{await F();let e=s.value;if(!e)return;f.value=f.value||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();l.value=t.height,c.value=t.width,d.value||(e.style.transitionDuration=f.value.transitionDuration,e.style.animationName=f.value.animationName)},{immediate:!0});let p=M(()=>d.value&&i.open.value);return dt(()=>{requestAnimationFrame(()=>{d.value=!1})}),U(s,`beforematch`,e=>{requestAnimationFrame(()=>{i.onOpenToggle(),r(`contentFound`)})}),(t,r)=>(N(),L(P(gi),{ref_key:`presentRef`,ref:a,present:e.forceMount||P(i).open.value,"force-mount":!0},{default:w(({present:r})=>[O(P(z),I(t.$attrs,{id:P(i).contentId,ref:P(o),"as-child":n.asChild,as:e.as,hidden:r?void 0:P(i).unmountOnHide.value?``:`until-found`,"data-state":p.value?void 0:P(i).open.value?`open`:`closed`,"data-disabled":P(i).disabled?.value?``:void 0,style:{"--reka-collapsible-content-height":`${l.value}px`,"--reka-collapsible-content-width":`${c.value}px`}}),{default:w(()=>[!P(i).unmountOnHide.value||r?k(t.$slots,`default`,{},void 0,void 0,0):Ie(`v-if`,!0)]),_:2},1040,[`id`,`as-child`,`as`,`hidden`,`data-state`,`data-disabled`,`style`])]),_:3},8,[`present`]))}}),xi=n({__name:`CollapsibleTrigger`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e;W();let n=_i();return(r,i)=>(N(),L(P(z),{type:e.as===`button`?`button`:void 0,as:e.as,"as-child":t.asChild,"aria-controls":P(n).contentId,"aria-expanded":P(n).open.value,"data-state":P(n).open.value?`open`:`closed`,"data-disabled":P(n).disabled?.value?``:void 0,disabled:P(n).disabled?.value,onClick:P(n).onOpenToggle},{default:w(()=>[k(r.$slots,`default`)]),_:3},8,[`type`,`as`,`as-child`,`aria-controls`,`aria-expanded`,`data-state`,`data-disabled`,`disabled`,`onClick`]))}});function Si({type:e,defaultValue:t,modelValue:n}){let r=n||t;return n!==void 0||t!==void 0?Array.isArray(r)?`multiple`:`single`:e??`single`}function Ci({type:e,defaultValue:t,modelValue:n}){return e||Si({type:e,defaultValue:t,modelValue:n})}function wi({type:e,defaultValue:t}){return t===void 0?e===`single`?void 0:[]:t}function Ti(e,t){let n=M(()=>Ci(e)),r=kr(e,`modelValue`,t,{defaultValue:wi(e),passive:e.modelValue===void 0,deep:!0});function i(e){if(n.value===`single`)r.value=Wn(e,r.value)?void 0:e;else{let t=Array.isArray(r.value)?[...r.value||[]]:[r.value].filter(Boolean);if(Jn(t,e)){let n=t.findIndex(t=>Wn(t,e));t.splice(n,1)}else t.push(e);r.value=t}}return{modelValue:r,changeModelValue:i,isSingle:M(()=>n.value===`single`)}}var[Ei,Di]=Gn(`AccordionRoot`),Oi=n({__name:`AccordionRoot`,props:{collapsible:{type:Boolean,required:!1,default:!1},disabled:{type:Boolean,required:!1,default:!1},dir:{type:String,required:!1},orientation:{type:String,required:!1,default:`vertical`},unmountOnHide:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},type:{type:String,required:!1},modelValue:{type:null,required:!1},defaultValue:{type:null,required:!1}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,{dir:i,disabled:a,unmountOnHide:o}=p(n),s=qr(i),{modelValue:c,changeModelValue:l,isSingle:u}=Ti(n,r),{forwardRef:d,currentElement:f}=W();return Di({disabled:a,direction:s,orientation:n.orientation,parentElement:f,isSingle:u,collapsible:n.collapsible,modelValue:c,changeModelValue:l,unmountOnHide:o}),(t,n)=>(N(),L(P(z),{ref:P(d),"as-child":e.asChild,as:e.as},{default:w(()=>[k(t.$slo Line truncated `))}return()=>i.value||r.value||o.value?Se(t.default({present:o.value})[0],{ref:e=>{let t=H(e);return t?.hasAttribute===void 0||(t?.hasAttribute(`data-reka-popper-content-wrapper`)?a.value=t.firstElementChild:a.value=t),t}}):null}}),[vi,yi]=Gn(`CollapsibleRoot`),bi=n({__name:`CollapsibleRoot`,props:{defaultOpen:{type:Boolean,required:!1,default:!1},open:{type:Boolean,required:!1,default:void 0},disabled:{type:Boolean,required:!1},unmountOnHide:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`update:open`],setup(e,{expose:t,emit:n}){let r=e,i=Ar(r,`open`,n,{defaultValue:r.defaultOpen,passive:r.open===void 0}),{disabled:a,unmountOnHide:o}=p(r);return yi({contentId:``,disabled:a,open:i,unmountOnHide:o,onOpenToggle:()=>{a.value||(i.value=!i.value)}}),t({open:i}),U(),(t,n)=>(N(),L(P(z),{as:e.as,"as-child":r.asChild,"data-state":P(i)?`open`:`closed`,"data-disabled":P(a)?``:void 0},{default:w(()=>[k(t.$slots,`default`,{open:P(i)})]),_:3},8,[`as`,`as-child`,`data-state`,`data-disabled`]))}}),xi=n({inheritAttrs:!1,__name:`CollapsibleContent`,props:{forceMount:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`contentFound`],setup(e,{emit:t}){let n=e,r=t,i=vi();i.contentId||=fi(void 0,`reka-collapsible-content`);let a=R(),{forwardRef:o,currentElement:s}=U(),c=R(0),l=R(0),u=M(()=>i.open.value),d=R(u.value),f=R();A(()=>[u.value,a.value?.present],async()=>{await F();let e=s.value;if(!e)return;f.value=f.value||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();l.value=t.height,c.value=t.width,d.value||(e.style.transitionDuration=f.value.transitionDuration,e.style.animationName=f.value.animationName)},{immediate:!0});let p=M(()=>d.value&&i.open.value);return dt(()=>{requestAnimationFrame(()=>{d.value=!1})}),gr(s,`beforematch`,e=>{requestAnimationFrame(()=>{i.onOpenToggle(),r(`contentFound`)})}),(t,r)=>(N(),L(P(_i),{ref_key:`presentRef`,ref:a,present:e.forceMount||P(i).open.value,"force-mount":!0},{default:w(({present:r})=>[O(P(z),I(t.$attrs,{id:P(i).contentId,ref:P(o),"as-child":n.asChild,as:e.as,hidden:r?void 0:P(i).unmountOnHide.value?``:`until-found`,"data-state":p.value?void 0:P(i).open.value?`open`:`closed`,"data-disabled":P(i).disabled?.value?``:void 0,style:{"--reka-collapsible-content-height":`${l.value}px`,"--reka-collapsible-content-width":`${c.value}px`}}),{default:w(()=>[!P(i).unmountOnHide.value||r?k(t.$slots,`default`,{},void 0,void 0,0):Ie(`v-if`,!0)]),_:2},1040,[`id`,`as-child`,`as`,`hidden`,`data-state`,`data-disabled`,`style`])]),_:3},8,[`present`]))}}),Si=n({__name:`CollapsibleTrigger`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let t=e;U();let n=vi();return(r,i)=>(N(),L(P(z),{type:e.as===`button`?`button`:void 0,as:e.as,"as-child":t.asChild,"aria-controls":P(n).contentId,"aria-expanded":P(n).open.value,"data-state":P(n).open.value?`open`:`closed`,"data-disabled":P(n).disabled?.value?``:void 0,disabled:P(n).disabled?.value,onClick:P(n).onOpenToggle},{default:w(()=>[k(r.$slots,`default`)]),_:3},8,[`type`,`as`,`as-child`,`aria-controls`,`aria-expanded`,`data-state`,`data-disabled`,`disabled`,`onClick`]))}});function Ci({type:e,defaultValue:t,modelValue:n}){let r=n||t;return n!==void 0||t!==void 0?Array.isArray(r)?`multiple`:`single`:e??`single`}function wi({type:e,defaultValue:t,modelValue:n}){return e||Ci({type:e,defaultValue:t,modelValue:n})}function Ti({type:e,defaultValue:t}){return t===void 0?e===`single`?void 0:[]:t}function Ei(e,t){let n=M(()=>wi(e)),r=Ar(e,`modelValue`,t,{defaultValue:Ti(e),passive:e.modelValue===void 0,deep:!0});function i(e){if(n.value===`single`)r.value=Wn(e,r.value)?void 0:e;else{let t=Array.isArray(r.value)?[...r.value||[]]:[r.value].filter(Boolean);if(Jn(t,e)){let n=t.findIndex(t=>Wn(t,e));t.splice(n,1)}else t.push(e);r.value=t}}return{modelValue:r,changeModelValue:i,isSingle:M(()=>n.value===`single`)}}var[Di,Oi]=Gn(`AccordionRoot`),ki=n({__name:`AccordionRoot`,props:{collapsible:{type:Boolean,required:!1,default:!1},disabled:{type:Boolean,required:!1,default:!1},dir:{type:String,required:!1},orientation:{type:String,required:!1,default:`vertical`},unmountOnHide:{type:Boolean,required:!1,default:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},type:{type:String,required:!1},modelValue:{type:null,required:!1},defaultValue:{type:null,required:!1}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,{dir:i,disabled:a,unmountOnHide:o}=p(n),s=Jr(i),{modelValue:c,changeModelValue:l,isSingle:u}=Ei(n,r),{forwardRef:d,currentElement:f}=U();return Oi({disabled:a,direction:s,orientation:n.orientation,parentElement:f,isSingle:u,collapsible:n.collapsible,modelValue:c,changeModelValue:l,unmountOnHide:o}),(t,n)=>(N(),L(P(z),{ref:P(d),"as-child":e.asChild,as:e.as},{default:w(()=>[k(t.$sl Line truncated
+1 -1
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
+79 -79
View File
@@ -1,79 +1,79 @@
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/AccountPage.js","assets/PageHeader.js","assets/api.js","assets/AuthenticationPage.js","assets/AgentProfilesPage.js","assets/CardAccordion.js","assets/pinia.js","assets/alert.js","assets/CredentialBindingsPage.js","assets/PlaybooksPage.js","assets/HarnessPage.js","assets/NotFoundPage.js"])))=>i.map(i=>d[i]); const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/AccountPage.js","assets/PageHeader.js","assets/api.js","assets/AuthenticationPage.js","assets/AgentProfilesPage.js","assets/CardAccordion.js","assets/pinia.js","assets/alert.js","assets/CredentialBindingsPage.js","assets/PlaybooksPage.js","assets/HarnessPage.js","assets/NotFoundPage.js"])))=>i.map(i=>d[i]);
import{$ as e,A as t,B as n,C as r,D as i,E as a,F as o,G as s,H as c,I as l,J as u,K as d,L as f,M as p,N as m,O as h,P as g,Q as _,R as v,S as y,T as b,U as x,V as S,W as C,X as w,Y as T,Z as ee,_ as E,a as D,at as te,b as ne,c as re,ct as ie,d as O,dt as ae,et as oe,f as se,ft as ce,g as le,h as ue,i as de,it as fe,j as pe,k as me,l as he,lt as ge,m as _e,mt as ve,n as ye,nt as be,o as xe,ot as Se,p as Ce,pt as we,q as Te,r as Ee,rt as De,s as Oe,st as ke,t as Ae,tt as je,u as Me,ut as Ne,v as Pe,w as Fe,x as Ie,y as Le,z as Re}from"./CardAccordion.js";import{$ as ze,A as k,B as Be,C as Ve,Ct as He,D as A,Dn as Ue,En as We,Ft as Ge,It as Ke,Jt as j,Kt as qe,Mt as Je,O as M,Pt as Ye,Qn as N,R as Xe,Rt as Ze,Sn as Qe,St as P,Tn as $e,Tt as et,Ut as F,V as tt,Wt as nt,X as rt,Xt as it,Y as at,Zt as ot,_ as I,_n as st,_t as ct,an as lt,at as ut,b as L,bn as dt,d as ft,dn as pt,er as mt,et as ht,ht as R,it as gt,kn as z,lt as _t,mn as vt,nr as B,nt as yt,on as bt,pn as xt,pt as St,rn as Ct,s as V,t as wt,tr as Tt,tt as H,v as U,vn as Et,wn as Dt,x as W,xt as G,y as K,yn as q,zt as Ot}from"./PageHeader.js";import{B as kt,H as At,U as jt,V as Mt,W as Nt,_ as Pt,b as Ft,c as It,d as Lt,f as Rt,g as J,h as Y,l as zt,m as Bt,n as X,o as Vt,p as Ht,r as Ut,t as Wt,u as Gt,v as Kt,w as qt,x as Jt}from"./api.js";import{n as Yt,r as Xt,t as Zt}from"./pinia.js";import{a as Qt,i as $t,n as en,o as tn,r as nn,t as rn}from"./alert.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function an(e,t,n){let r=e.findIndex(e=>ve(e,t)),i=e.findIndex(e=>ve(e,n));if(r===-1||i===-1)return[];let[a,o]=[r,i].sort((e,t)=>e-t);return e.slice(a,o+1)}function on(e,t=-1/0,n=1/0){return Math.min(n,Math.max(t,e))}function sn(e,t){let n=e,r=t.toString(),i=r.indexOf(`.`),a=i>=0?r.length-i:0;if(a>0){let e=10**a;n=Math.round(n*e)/e}return n}function cn(e,t,n,r){t=Number(t),n=Number(n);let i=(e-(Number.isNaN(t)?0:t))%r,a=sn(Math.abs(i)*2>=r?e+Math.sign(i)*(r-Math.abs(i)):e-i,r);return Number.isNaN(t)?!Number.isNaN(n)&&a>n&&(a=Math.floor(sn(n/r,r))*r):a<t?a=t:!Number.isNaN(n)&&a>n&&(a=t+Math.floor(sn((n-t)/r,r))*r),a=sn(a,r),a}var ln=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Bopomofo}]/u,un=/android/i;function dn(){return typeof navigator<`u`&&un.test(navigator.userAgent)}function fn(e){let t=q(!1),n=q(!0),r=q(!1),i=I(()=>t.value&&n.value);function a(){t.value=!0,n.value=!0,r.value=!1}function o(e){e.data&&(ln.test(e.data)?(n.value=!0,r.value=!0):dn()&&!r.value&&(n.value=!1))}function s(n){yt(()=>{t.value=!1,e?.(n)})}return{isComposing:t,shouldDeferInput:i,handleCompositionStart:a,handleCompositionUpdate:o,handleCompositionEnd:s}}function pn(e){let t=I(()=>z(e)),n=I(()=>new Intl.Collator(`en`,{usage:`search`,...t.value}));return{startsWith:(e,t)=>t.length===0||(e=e.normalize(`NFC`),t=t.normalize(`NFC`),n.value.compare(e.slice(0,t.length),t)===0),endsWith:(e,t)=>t.length===0||(e=e.normalize(`NFC`),t=t.normalize(`NFC`),n.value.compare(e.slice(-t.length),t)===0),contains:(e,t)=>{if(t.length===0)return!0;if(e=e.normalize(`NFC`),t=t.normalize(`NFC`),t.length>e.length)return!1;let r=n.value.compare;if(e.includes(t))return!0;let i=t.length;for(let n=0;n+i<=e.length;n++)if(r(t,e.slice(n,n+i))===0)return!0;return!1}}}function mn(e){return I(()=>!Ue(e)||!!w(e)?.closest(`form`))}function hn(){let e=Xe()?.vnode?.scopeId;return e?{[e]:``}:{}}function gn(e,t){let n=Se(!1,300);ke(()=>{n.value=!1});let r=q(null),i=je();function a(){r.value=null,n.value=!1}function o(e,t){if(!t)return;let i=e.currentTarget,a={x:e.clientX,y:e.clientY},o=vn(a,_n(a,i.getBoundingClientRect()),1),s=yn(t.getBoundingClientRect()),c=xn([...o,...s]);r.value=c,n.value=!0}return nt(n=>{if(e.value&&t.value){let r=e.value,i=t.value,a=e=>o(e,i),s=e=>o(e,r);r.addEventListener(`pointerleave`,a),i.addEventListener(`pointerleave`,s),n(()=>{r.removeEventListener(`pointerleave`,a),i.removeEventListener(`pointerleave`,s)})}}),nt(n=>{if(r.value){let o=n=>{if(!r.value||!(n.target instanceof Element))return;let o=n.target,s={x:n.clientX,y:n.clientY},c=e.value?.contains(o)||t.value?.contains(o),l=!bn(s,r.value),u=!!o.closest(`[data-grace-area-trigger]`);c?a():(l||u)&&(a(),i.trigger())},s=e.value?.ownerDocument;s?.addEventListener(`pointermove`,o),n(()=>s?.removeEventListener(`pointermove`,o))}}),{isPointerInTransit:n,onPointerExit:i.on}}function _n(e,t){lLine truncated import{$ as e,A as t,B as n,C as r,D as i,E as a,F as o,G as s,H as c,I as l,J as u,K as d,L as f,M as p,N as m,O as h,P as g,Q as _,R as v,S as y,T as b,U as x,V as S,W as C,X as w,Y as T,Z as ee,_ as E,a as D,at as te,b as ne,c as re,ct as ie,d as O,dt as ae,et as oe,f as se,ft as ce,g as le,h as ue,ht as de,i as fe,it as pe,j as me,k as he,l as ge,lt as _e,m as ve,mt as ye,n as be,nt as xe,o as Se,ot as Ce,p as we,pt as Te,q as Ee,r as De,rt as Oe,s as ke,st as Ae,t as je,tt as Me,u as Ne,ut as Pe,v as Fe,w as Ie,x as Le,y as Re,z as ze}from"./CardAccordion.js";import{$ as Be,A as k,B as Ve,C as He,Ct as Ue,D as A,Dn as We,En as Ge,Ft as Ke,It as qe,Jt as j,Kt as Je,Mt as Ye,O as M,Pt as Xe,Qn as N,R as Ze,Rt as Qe,Sn as $e,St as P,Tn as et,Tt as tt,Ut as F,V as nt,Wt as rt,X as it,Xt as at,Y as ot,Zt as st,_ as I,_n as ct,_t as lt,an as ut,at as dt,b as L,bn as ft,d as pt,dn as mt,er as ht,et as gt,ht as R,it as _t,kn as z,lt as vt,mn as yt,nr as B,nt as bt,on as xt,pn as St,pt as Ct,rn as wt,s as V,t as Tt,tr as Et,tt as H,v as U,vn as Dt,wn as Ot,x as W,xt as G,y as K,yn as q,zt as kt}from"./PageHeader.js";import{B as At,H as jt,U as Mt,V as Nt,W as Pt,_ as Ft,b as It,c as Lt,d as Rt,f as zt,g as J,h as Y,l as Bt,m as Vt,n as X,o as Ht,p as Ut,r as Wt,t as Gt,u as Kt,v as qt,w as Jt,x as Yt}from"./api.js";import{n as Xt,r as Zt,t as Qt}from"./pinia.js";import{a as $t,i as en,n as tn,o as nn,r as rn,t as an}from"./alert.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function on(e,t,n){let r=e.findIndex(e=>de(e,t)),i=e.findIndex(e=>de(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 sn(e,t=-1/0,n=1/0){return Math.min(n,Math.max(t,e))}function cn(e,t){let n=e,r=t.toString(),i=r.indexOf(`.`),a=i>=0?r.length-i:0;if(a>0){let e=10**a;n=Math.round(n*e)/e}return n}function ln(e,t,n,r){t=Number(t),n=Number(n);let i=(e-(Number.isNaN(t)?0:t))%r,a=cn(Math.abs(i)*2>=r?e+Math.sign(i)*(r-Math.abs(i)):e-i,r);return Number.isNaN(t)?!Number.isNaN(n)&&a>n&&(a=Math.floor(cn(n/r,r))*r):a<t?a=t:!Number.isNaN(n)&&a>n&&(a=t+Math.floor(cn((n-t)/r,r))*r),a=cn(a,r),a}var un=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Bopomofo}]/u,dn=/android/i;function fn(){return typeof navigator<`u`&&dn.test(navigator.userAgent)}function pn(e){let t=q(!1),n=q(!0),r=q(!1),i=I(()=>t.value&&n.value);function a(){t.value=!0,n.value=!0,r.value=!1}function o(e){e.data&&(un.test(e.data)?(n.value=!0,r.value=!0):fn()&&!r.value&&(n.value=!1))}function s(n){bt(()=>{t.value=!1,e?.(n)})}return{isComposing:t,shouldDeferInput:i,handleCompositionStart:a,handleCompositionUpdate:o,handleCompositionEnd:s}}function mn(e){let t=I(()=>z(e)),n=I(()=>new Intl.Collator(`en`,{usage:`search`,...t.value}));return{startsWith:(e,t)=>t.length===0||(e=e.normalize(`NFC`),t=t.normalize(`NFC`),n.value.compare(e.slice(0,t.length),t)===0),endsWith:(e,t)=>t.length===0||(e=e.normalize(`NFC`),t=t.normalize(`NFC`),n.value.compare(e.slice(-t.length),t)===0),contains:(e,t)=>{if(t.length===0)return!0;if(e=e.normalize(`NFC`),t=t.normalize(`NFC`),t.length>e.length)return!1;let r=n.value.compare;if(e.includes(t))return!0;let i=t.length;for(let n=0;n+i<=e.length;n++)if(r(t,e.slice(n,n+i))===0)return!0;return!1}}}function hn(e){return I(()=>!We(e)||!!ee(e)?.closest(`form`))}function gn(){let e=Ze()?.vnode?.scopeId;return e?{[e]:``}:{}}function _n(e,t){let n=Ae(!1,300);ie(()=>{n.value=!1});let r=q(null),i=xe();function a(){r.value=null,n.value=!1}function o(e,t){if(!t)return;let i=e.currentTarget,a={x:e.clientX,y:e.clientY},o=yn(a,vn(a,i.getBoundingClientRect()),1),s=bn(t.getBoundingClientRect()),c=Sn([...o,...s]);r.value=c,n.value=!0}return rt(n=>{if(e.value&&t.value){let r=e.value,i=t.value,a=e=>o(e,i),s=e=>o(e,r);r.addEventListener(`pointerleave`,a),i.addEventListener(`pointerleave`,s),n(()=>{r.removeEventListener(`pointerleave`,a),i.removeEventListener(`pointerleave`,s)})}}),rt(n=>{if(r.value){let o=n=>{if(!r.value||!(n.target instanceof Element))return;let o=n.target,s={x:n.clientX,y:n.clientY},c=e.value?.contains(o)||t.value?.contains(o),l=!xn(s,r.value),u=!!o.closest(`[data-grace-area-trigger]`);c?a():(l||u)&&(a(),i.trigger())},s=e.value?.ownerDocument;s?.addEventListener(`pointermove`,o),n(()=>s?.removeEventListener(`pointermove`,o))}}),{isPointerInTransit:n,onPointerExit:i.on}}functionLine truncated
`);d=n.pop()||``;for(let e of n){let t=e.split(` `);d=n.pop()||``;for(let e of n){let t=e.split(`
`).find(e=>e.startsWith(`data: `));if(!t)continue;let n=JSON.parse(t.slice(6));if(n.session_id&&(zc.value=n.session_id),n.type===`delta`&&(o+=n.text,Wc.value=Wc.value?{...Wc.value,text:o}:null),(n.type===`tool`||n.type===`navigate`)&&(a=[...a,n],Wc.value=Wc.value?{...Wc.value,tools:a}:null),n.type===`ask`&&n.ask&&(clearTimeout(l),Wc.value=Wc.value?{...Wc.value,ask:n.ask}:null),n.type===`done`&&(s=!0,o||=n.text||``),n.type===`error`)throw Error(n.text)}if(t)break}if(!s)throw Error(`chat stream ended before completion`);Bc.value=[...Bc.value,{from:`assistant`,text:o,tool_calls:a}],Wc.value=null,Hc.value=`Ready`,await il()}catch(e){let t=e;t.name===`AbortError`&&!c?(Wc.value={text:`Turn stopped.`,tools:a,isError:!1,turn:r,isRetry:i},Hc.value=`Stopped`):(Wc.value={text:`Unable to complete that turn: ${t.message||t}`,tools:a,isError:!0,turn:r?Mc(r):void 0,isRetry:i},Hc.value=`Error. Retry available.`)}finally{clearTimeout(l),Ic=null,nl=null,Uc.value=!1}}function gl(){Hc.value=`Stopping…`,zc.value&&X.chatCancel(zc.value).catch(()=>{}),rl()}function _l(){_t(()=>{il().catch(e=>{Hc.value=e.message||`Chat unavailable`})}),St(()=>{rl()})}async function vl(e){let t=new Uint8Array(await e.arrayBuffer()),n=``;for(let e=0;e<t.length;e+=32768)n+=String.fromCharCode(...t.subarray(e,e+32768));await hl({textOverride:`🎤 Voice message`,voice:{data:btoa(n),mime_type:e.type||`audio/webm`}})}var yl=[`aria-label`,`title`,`aria-expanded`,`aria-controls`],bl=k({__name:`ChatFab`,props:{open:{type:Boolean}},emits:[`toggle`],setup(e,{emit:t}){let n=t;function r(e){return J(`col-start-1 row-start-1 grid place-items-center transition-[opacity,transform] duration-[140ms]`,e?`opacity-100`:`-rotate-45 scale-[0.7] opacity-0`)}return(t,i)=>(R(),W(`button`,{type:`button`,class:`relative z-10 grid size-14 cursor-pointer place-items-center rounded-full border border-border-strong bg-secondary text-primary shadow-[var(--shadow-md)] transition-transform duration-[140ms] hover:-translate-y-px focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary active:translate-y-0`,"aria-label":e.open?`Close chat`:`Chat with Archie`,title:e.open?`Close chat`:`Chat with Archie`,"aria-expanded":e.open,"aria-controls":z(Pc),onClick:i[0]||=e=>n(`toggle`)},[U(`span`,{"aria-hidden":`true`,class:N(r(!e.open))},[M(z(Ys),{size:22})],2),U(`span`,{"aria-hidden":`true`,class:N(r(e.open))},[M(z(Sc),{size:22})],2)],8,yl))}}),xl=k({__name:`Select`,props:{open:{type:Boolean},defaultOpen:{type:Boolean},defaultValue:{},modelValue:{},nullableValue:{},by:{type:[String,Function]},dir:{},multiple:{type:Boolean},autocomplete:{},disabled:{type:Boolean},name:{},required:{type:Boolean}},emits:[`update:modelValue`,`update:open`],setup(e,{emit:t}){let r=n(e,t);return(e,t)=>(R(),K(z(Ra),H({"data-slot":`select`},z(r)),{default:j(t=>[P(e.$slots,`default`,mt(Be(t)))]),_:3},16))}}),Sl=k({inheritAttrs:!1,__name:`SelectContent`,props:{forceMount:{type:Boolean},position:{default:`item-aligned`},bodyLock:{type:Boolean},loop:{type:Boolean},memoDependencies:{},side:{},sideOffset:{},sideFlip:{type:Boolean},align:{default:`center`},alignOffset:{},alignFlip:{type:Boolean},avoidCollisions:{type:Boolean},collisionBoundary:{},collisionPadding:{},arrowPadding:{},hideShiftedArrow:{type:Boolean},sticky:{},hideWhenDetached:{type:Boolean},positionStrategy:{},updatePositionStrategy:{},disableUpdateOnLayoutShift:{type:Boolean},prioritizePosition:{type:Boolean},reference:{},dir:{},asChild:{type:Boolean},as:{},disableOutsidePointerEvents:{type:Boolean},class:{type:[Boolean,null,String,Object,Array]}},emits:[`closeAutoFocus`,`escapeKeyDown`,`pointerDownOutside`],setup(e,{emit:t}){let r=e,i=t,a=Rt(r,`class`),o=n(a,i);return(t,n)=>(R(),K(z(ao),null,{default:j(()=>[M(z(Xa),H({"data-slot":`select-content`,"data-align-trigger":e.position===`item-aligned`},{...t.$attrs,...z(o)},{class:z(J)(`bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 min-w-36 rounded-lg shadow-md ring-1 duration-100 data-[side=inline-start]:slide-in-from-right-2 data-[side=inline-end]:slide-in-from-left-2 cn-menu-translucent relative z-50 max-h-(--reka-select-content-available-height) origin-(--reka-select-content-transform-origin) overflow-x-hidden overflow-y-auto data-[align-trigger=true]:animate-none`,e.position===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,r.class)}),{default:j(()=>[M(z(Dl)),M(z(fo),{"data-position":e.position,class:N(z(J)(`data-[position=popper]:h-(--reka-select-trigger-height) data-[position=popper]:w-full data-[position=popper]:min-w-(--reka-select-trigger-width)`))},{default:j(()=>[P(t.$slots,`default`)]),_:3 Line truncated `).find(e=>e.startsWith(`data: `));if(!t)continue;let n=JSON.parse(t.slice(6));if(n.session_id&&(Bc.value=n.session_id),n.type===`delta`&&(o+=n.text,Gc.value=Gc.value?{...Gc.value,text:o}:null),(n.type===`tool`||n.type===`navigate`)&&(a=[...a,n],Gc.value=Gc.value?{...Gc.value,tools:a}:null),n.type===`ask`&&n.ask&&(clearTimeout(l),Gc.value=Gc.value?{...Gc.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`);Vc.value=[...Vc.value,{from:`assistant`,text:o,tool_calls:a}],Gc.value=null,Uc.value=`Ready`,await al()}catch(e){let t=e;t.name===`AbortError`&&!c?(Gc.value={text:`Turn stopped.`,tools:a,isError:!1,turn:r,isRetry:i},Uc.value=`Stopped`):(Gc.value={text:`Unable to complete that turn: ${t.message||t}`,tools:a,isError:!0,turn:r?Nc(r):void 0,isRetry:i},Uc.value=`Error. Retry available.`)}finally{clearTimeout(l),Lc=null,rl=null,Wc.value=!1}}function _l(){Uc.value=`Stopping…`,Bc.value&&X.chatCancel(Bc.value).catch(()=>{}),il()}function vl(){vt(()=>{al().catch(e=>{Uc.value=e.message||`Chat unavailable`})}),Ct(()=>{il()})}async function yl(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 gl({textOverride:`🎤 Voice message`,voice:{data:btoa(n),mime_type:e.type||`audio/webm`}})}var bl=[`aria-label`,`title`,`aria-expanded`,`aria-controls`],xl=k({__name:`ChatFab`,props:{open:{type:Boolean}},emits:[`toggle`],setup(e,{emit:t}){let n=t;function r(e){return J(`col-start-1 row-start-1 grid place-items-center transition-[opacity,transform] duration-[140ms]`,e?`opacity-100`:`-rotate-45 scale-[0.7] opacity-0`)}return(t,i)=>(R(),W(`button`,{type:`button`,class:`relative z-10 grid size-14 cursor-pointer place-items-center rounded-full border border-border-strong bg-secondary text-primary shadow-[var(--shadow-md)] transition-transform duration-[140ms] hover:-translate-y-px focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary active:translate-y-0`,"aria-label":e.open?`Close chat`:`Chat with Archie`,title:e.open?`Close chat`:`Chat with Archie`,"aria-expanded":e.open,"aria-controls":z(Fc),onClick:i[0]||=e=>n(`toggle`)},[U(`span`,{"aria-hidden":`true`,class:N(r(!e.open))},[M(z(Xs),{size:22})],2),U(`span`,{"aria-hidden":`true`,class:N(r(e.open))},[M(z(Cc),{size:22})],2)],8,bl))}}),Sl=k({__name:`Select`,props:{open:{type:Boolean},defaultOpen:{type:Boolean},defaultValue:{},modelValue:{},nullableValue:{},by:{type:[String,Function]},dir:{},multiple:{type:Boolean},autocomplete:{},disabled:{type:Boolean},name:{},required:{type:Boolean}},emits:[`update:modelValue`,`update:open`],setup(e,{emit:t}){let n=S(e,t);return(e,t)=>(R(),K(z(za),H({"data-slot":`select`},z(n)),{default:j(t=>[P(e.$slots,`default`,ht(Ve(t)))]),_:3},16))}}),Cl=k({inheritAttrs:!1,__name:`SelectContent`,props:{forceMount:{type:Boolean},position:{default:`item-aligned`},bodyLock:{type:Boolean},loop:{type:Boolean},memoDependencies:{},side:{},sideOffset:{},sideFlip:{type:Boolean},align:{default:`center`},alignOffset:{},alignFlip:{type:Boolean},avoidCollisions:{type:Boolean},collisionBoundary:{},collisionPadding:{},arrowPadding:{},hideShiftedArrow:{type:Boolean},sticky:{},hideWhenDetached:{type:Boolean},positionStrategy:{},updatePositionStrategy:{},disableUpdateOnLayoutShift:{type:Boolean},prioritizePosition:{type:Boolean},reference:{},dir:{},asChild:{type:Boolean},as:{},disableOutsidePointerEvents:{type:Boolean},class:{type:[Boolean,null,String,Object,Array]}},emits:[`closeAutoFocus`,`escapeKeyDown`,`pointerDownOutside`],setup(e,{emit:t}){let n=e,r=t,i=zt(n,`class`),a=S(i,r);return(t,r)=>(R(),K(z(oo),null,{default:j(()=>[M(z(Za),H({"data-slot":`select-content`,"data-align-trigger":e.position===`item-aligned`},{...t.$attrs,...z(a)},{class:z(J)(`bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 min-w-36 rounded-lg shadow-md ring-1 duration-100 data-[side=inline-start]:slide-in-from-right-2 data-[side=inline-end]:slide-in-from-left-2 cn-menu-translucent relative z-50 max-h-(--reka-select-content-available-height) origin-(--reka-select-content-transform-origin) overflow-x-hidden overflow-y-auto data-[align-trigger=true]:animate-none`,e.position===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,n.class)}),{default:j(()=>[M(z(Ol)),M(z(po),{"data-position":e.position,class:N(z(J)(`data-[position=popper]:h-(--reka-select-trigger-height) data-[position=popper]:w-full data-[position=popper]:min-w-(--reka-select-trigger-width)`))},{default:j(()=>[P(t.$slots,`default`)]),_:3 Line truncated
`),r=[],i=null,a=null,o=()=>{r.length&&(t.push({kind:`p`,inline:yd(r.join(` `))}),r=[])},s=()=>{i&&=(t.push({kind:i.tag,items:i.items.map(e=>yd(e))}),null)};for(let e=0;e<n.length;e++){let c=n[e];if(c.startsWith("```")){o(),s(),a?(t.push({kind:`pre`,code:a.join(` `),r=[],i=null,a=null,o=()=>{r.length&&(t.push({kind:`p`,inline:bd(r.join(` `))}),r=[])},s=()=>{i&&=(t.push({kind:i.tag,items:i.items.map(e=>bd(e))}),null)};for(let e=0;e<n.length;e++){let c=n[e];if(c.startsWith("```")){o(),s(),a?(t.push({kind:`pre`,code:a.join(`
`)}),a=null):a=[];continue}if(a){a.push(c);continue}let l=xd(c),u=e+1<n.length?xd(n[e+1]):null;if(l&&u&&Sd(u)&&l.length===u.length){o(),s();let r=[];for(e+=2;e<n.length;e++){let t=xd(n[e]);if(!t||t.length!==l.length){e--;break}r.push(t)}t.push({kind:`table`,head:l.map(e=>yd(e)),rows:r.map(e=>e.map(e=>yd(e)))});continue}if(!c.trim()){o(),s();continue}let d=c.match(/^(#{1,3})\s+(.+)$/);if(d){o(),s(),t.push({kind:`h${d[1].length}`,inline:yd(d[2])});continue}let f=c.match(/^\s*[-*]\s+(.+)$/),p=c.match(/^\s*\d+[.)]\s+(.+)$/);if(f||p){o();let e=p?`ol`:`ul`;(!i||i.tag!==e)&&(s(),i={tag:e,items:[]}),i.items.push((f||p)[1])}else c.startsWith(`>`)?(o(),s(),t.push({kind:`blockquote`,inline:yd(c.replace(/^>\s?/,``))})):r.push(c)}return o(),s(),a&&t.push({kind:`pre`,code:a.join(` `)}),a=null):a=[];continue}if(a){a.push(c);continue}let l=Sd(c),u=e+1<n.length?Sd(n[e+1]):null;if(l&&u&&Cd(u)&&l.length===u.length){o(),s();let r=[];for(e+=2;e<n.length;e++){let t=Sd(n[e]);if(!t||t.length!==l.length){e--;break}r.push(t)}t.push({kind:`table`,head:l.map(e=>bd(e)),rows:r.map(e=>e.map(e=>bd(e)))});continue}if(!c.trim()){o(),s();continue}let d=c.match(/^(#{1,3})\s+(.+)$/);if(d){o(),s(),t.push({kind:`h${d[1].length}`,inline:bd(d[2])});continue}let f=c.match(/^\s*[-*]\s+(.+)$/),p=c.match(/^\s*\d+[.)]\s+(.+)$/);if(f||p){o();let e=p?`ol`:`ul`;(!i||i.tag!==e)&&(s(),i={tag:e,items:[]}),i.items.push((f||p)[1])}else c.startsWith(`>`)?(o(),s(),t.push({kind:`blockquote`,inline:bd(c.replace(/^>\s?/,``))})):r.push(c)}return o(),s(),a&&t.push({kind:`pre`,code:a.join(`
`)}),t}function xd(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 Sd(e){return e.every(e=>/^:?-{3,}:?$/.test(e))}var Cd={class:`[overflow-wrap:anywhere]`},wd={key:0,class:`my-2 overflow-auto rounded-md border border-border bg-background/60 p-3`},Td={class:`font-mono text-[0.85em]`},Ed={key:1,class:`my-3 w-full border-collapse text-[0.92em]`},Dd={key:2,class:`my-2 border-l-[3px] border-primary pl-3 text-fg-muted`},Od={key:3,class:`mt-1 mb-2 text-xl leading-tight font-semibold tracking-[-0.02em]`},kd={key:4,class:`mt-1 mb-2 text-lg leading-tight font-semibold tracking-[-0.02em]`},Ad={key:5,class:`mt-1 mb-2 text-base leading-tight font-semibold tracking-[-0.02em]`},jd={key:6,class:`my-2.5 flex list-disc flex-col gap-1 pl-5`},Md={key:7,class:`my-2.5 flex list-decimal flex-col gap-1 pl-5`},Nd={key:8,class:`mb-2.5 last:mb-0`},Pd=k({__name:`ChatMarkdown`,props:{text:{}},setup(e){let t=e,n=I(()=>bd(t.text));return(e,t)=>(R(),W(`div`,Cd,[(R(!0),W(V,null,G(n.value,(e,t)=>(R(),W(V,{key:t},[e.kind===`pre`?(R(),W(`pre`,wd,[U(`code`,Td,B(e.code),1)])):e.kind===`table`?(R(),W(`table`,Ed,[U(`thead`,null,[U(`tr`,null,[(R(!0),W(V,null,G(e.head,(e,t)=>(R(),W(`th`,{key:t,class:`border border-border bg-muted px-2 py-1.5 text-left font-semibold`},[M(_d,{inline:e},null,8,[`inline`])]))),128))])]),U(`tbody`,null,[(R(!0),W(V,null,G(e.rows,(e,t)=>(R(),W(`tr`,{key:t},[(R(!0),W(V,null,G(e,(e,t)=>(R(),W(`td`,{key:t,class:`border border-border px-2 py-1.5 text-left`},[M(_d,{inline:e},null,8,[`inline`])]))),128))]))),128))])])):e.kind===`blockquote`?(R(),W(`blockquote`,Dd,[M(_d,{inline:e.inline},null,8,[`inline`])])):e.kind===`h1`?(R(),W(`h1`,Od,[M(_d,{inline:e.inline},null,8,[`inline`])])):e.kind===`h2`?(R(),W(`h2`,kd,[M(_d,{inline:e.inline},null,8,[`inline`])])):e.kind===`h3`?(R(),W(`h3`,Ad,[M(_d,{inline:e.inline},null,8,[`inline`])])):e.kind===`ul`?(R(),W(`ul`,jd,[(R(!0),W(V,null,G(e.items,(e,t)=>(R(),W(`li`,{key:t},[M(_d,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`ol`?(R(),W(`ol`,Md,[(R(!0),W(V,null,G(e.items,(e,t)=>(R(),W(`li`,{key:t},[M(_d,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`p`?(R(),W(`p`,Nd,[M(_d,{inline:e.inline},null,8,[`inline`])])):L(``,!0)],64))),128))]))}}),Fd={class:`truncate`},Id=k({__name:`ChatNavChip`,props:{path:{},label:{}},setup(e){return(t,n)=>{let r=He(`RouterLink`);return R(),K(r,{to:e.path,title:`Go to ${e.label||e.path}`,class:`inline-flex max-w-full items-center gap-1.5 rounded-md border border-primary/45 bg-primary-soft px-2.5 py-1 text-xs font-semibold text-link transition-colors hover:border-primary hover:bg-primary/15 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary`},{default:j(()=>[M(z(Ss),{"aria-hidden":`true`,class:`size-3.5 shrink-0`}),U(`span`,Fd,B(e.label||e.path),1)]),_:1},8,[`to`,`title`])}}}),Ld={key:1,class:`flex items-baseline gap-1.5 [overflow-wrap:anywhere]`},Rd={class:`font-semibold text-foreground`},zd={key:0,class:`font-mono text-[0.95em] text-fg-subtle`},Bd=k({__name:`ChatToolCall`,props:{tool:{},streaming:{type:Boolean}},setup(e){let t=e,n=I(()=>t.tool.name||t.tool.Name||t.tool.tool||`tool`),r=I(()=>t.tool.parameters||t.tool.Parameters||``),i=I(()=>!!(t.tool.err||t.tool.Err||t.tool.failed)),a=I(()=>t.tool.summary||t.tool.Summary||t.tool.text||t.tool.err||t.tool.Err||(t.streaming?i.value?`failed`:`running…`:`done`));return(t,o)=>e.tool.path?(R(),K(Id,{key:0,path:e.tool.path,label:e.tool.label},null,8,[`path`,`label`])):(R(),W(`div`,Ld,[M(z(xc),{"aria-hidden":`true`,class:`size-3.5 shrink-0 self-center text-fg-subtle`}),U(`span`,Rd,B(n.value),1),r.value?(R(),W(`code`,zd,B(r.value),1)):L(``,!0),U(`span`,{class:N(z(J)(`text-fg-muted`,i.value&&`text-danger`))},B(a.value),3)]))}}),Vd={key:0,class:`mb-2 grid gap-0.5 text-xs`},Hd={key:1,class:`mb-2 flex flex-wrap gap-1.5`},Ud={key:3,class:`whitespace-pre-wrap`},Wd=k({__name:`ChatBubble`,props:{text:{},tools:{default:()=>[]},media:{default:()=>[]},assistant:{type:Boolean,default:!1},streaming:{type:Boolean,default:!1}},setup(e){return(t,n)=>(R(),W(`div`,{class:N([`flex`,e.assistant?`justify-start`:`justify-end`])},[U(`div`,{class:N(z(J)(`max-w-[min(78ch,86%)] rounded-[0.85rem] px-4 py-3 leading-normal [overflow-wrap:anywhere]`,e.assistant?`bg-muted`:`bg-primary/15`))},[e.assistant&&e.tools.length?(R(),W(`div`,Vd,[(R(!0),W(V,null,G(e.tools,(t,n)=>(R(),K(Bd,{key:n,tool:t,streaming:e.streaming},null,8,[`tool`,`streaming`]))),128))])):L(``,!0),e.media.length?(R(),W(`div`,Hd,[(R(!0),W(V,null,G(e.media,(e,t)=>(R(),K(ud,{key:t,attachment:e},null,8,[`attachment`]))),128))])):L(``,!0),e.assistant?(R(),K(Pd,{key:2,text:e.text},null,8,[`text`])):(R(),W(`div`,Ud,B(e.text),1)),P(t.$slots,`default`)],2)],2))}}),Gd={class:`text-sm`},Kd={key:0,class:`mt-1 text-fg-muted`},qd={key:1,class:`mt-2 flex flex-wrap gap-2`},Jd=k({__name:`ChatChooseCard`,props:{choose:{}} Line truncated `)}),t}function Sd(e){let t=String(e||``).trim();if(!t.includes(`|`))return null;let n=t.replace(/^\|/,``).replace(/\|$/,``).split(`|`).map(e=>e.trim());return n.length>1&&n.every(e=>e!==``)?n:null}function Cd(e){return e.every(e=>/^:?-{3,}:?$/.test(e))}var wd={class:`[overflow-wrap:anywhere]`},Td={key:0,class:`my-2 overflow-auto rounded-md border border-border bg-background/60 p-3`},Ed={class:`font-mono text-[0.85em]`},Dd={key:1,class:`my-3 w-full border-collapse text-[0.92em]`},Od={key:2,class:`my-2 border-l-[3px] border-primary pl-3 text-fg-muted`},kd={key:3,class:`mt-1 mb-2 text-xl leading-tight font-semibold tracking-[-0.02em]`},Ad={key:4,class:`mt-1 mb-2 text-lg leading-tight font-semibold tracking-[-0.02em]`},jd={key:5,class:`mt-1 mb-2 text-base leading-tight font-semibold tracking-[-0.02em]`},Md={key:6,class:`my-2.5 flex list-disc flex-col gap-1 pl-5`},Nd={key:7,class:`my-2.5 flex list-decimal flex-col gap-1 pl-5`},Pd={key:8,class:`mb-2.5 last:mb-0`},Fd=k({__name:`ChatMarkdown`,props:{text:{}},setup(e){let t=e,n=I(()=>xd(t.text));return(e,t)=>(R(),W(`div`,wd,[(R(!0),W(V,null,G(n.value,(e,t)=>(R(),W(V,{key:t},[e.kind===`pre`?(R(),W(`pre`,Td,[U(`code`,Ed,B(e.code),1)])):e.kind===`table`?(R(),W(`table`,Dd,[U(`thead`,null,[U(`tr`,null,[(R(!0),W(V,null,G(e.head,(e,t)=>(R(),W(`th`,{key:t,class:`border border-border bg-muted px-2 py-1.5 text-left font-semibold`},[M(vd,{inline:e},null,8,[`inline`])]))),128))])]),U(`tbody`,null,[(R(!0),W(V,null,G(e.rows,(e,t)=>(R(),W(`tr`,{key:t},[(R(!0),W(V,null,G(e,(e,t)=>(R(),W(`td`,{key:t,class:`border border-border px-2 py-1.5 text-left`},[M(vd,{inline:e},null,8,[`inline`])]))),128))]))),128))])])):e.kind===`blockquote`?(R(),W(`blockquote`,Od,[M(vd,{inline:e.inline},null,8,[`inline`])])):e.kind===`h1`?(R(),W(`h1`,kd,[M(vd,{inline:e.inline},null,8,[`inline`])])):e.kind===`h2`?(R(),W(`h2`,Ad,[M(vd,{inline:e.inline},null,8,[`inline`])])):e.kind===`h3`?(R(),W(`h3`,jd,[M(vd,{inline:e.inline},null,8,[`inline`])])):e.kind===`ul`?(R(),W(`ul`,Md,[(R(!0),W(V,null,G(e.items,(e,t)=>(R(),W(`li`,{key:t},[M(vd,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`ol`?(R(),W(`ol`,Nd,[(R(!0),W(V,null,G(e.items,(e,t)=>(R(),W(`li`,{key:t},[M(vd,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`p`?(R(),W(`p`,Pd,[M(vd,{inline:e.inline},null,8,[`inline`])])):L(``,!0)],64))),128))]))}}),Id={class:`truncate`},Ld=k({__name:`ChatNavChip`,props:{path:{},label:{}},setup(e){return(t,n)=>{let r=Ue(`RouterLink`);return R(),K(r,{to:e.path,title:`Go to ${e.label||e.path}`,class:`inline-flex max-w-full items-center gap-1.5 rounded-md border border-primary/45 bg-primary-soft px-2.5 py-1 text-xs font-semibold text-link transition-colors hover:border-primary hover:bg-primary/15 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary`},{default:j(()=>[M(z(Cs),{"aria-hidden":`true`,class:`size-3.5 shrink-0`}),U(`span`,Id,B(e.label||e.path),1)]),_:1},8,[`to`,`title`])}}}),Rd={key:1,class:`flex items-baseline gap-1.5 [overflow-wrap:anywhere]`},zd={class:`font-semibold text-foreground`},Bd={key:0,class:`font-mono text-[0.95em] text-fg-subtle`},Vd=k({__name:`ChatToolCall`,props:{tool:{},streaming:{type:Boolean}},setup(e){let t=e,n=I(()=>t.tool.name||t.tool.Name||t.tool.tool||`tool`),r=I(()=>t.tool.parameters||t.tool.Parameters||``),i=I(()=>!!(t.tool.err||t.tool.Err||t.tool.failed)),a=I(()=>t.tool.summary||t.tool.Summary||t.tool.text||t.tool.err||t.tool.Err||(t.streaming?i.value?`failed`:`running…`:`done`));return(t,o)=>e.tool.path?(R(),K(Ld,{key:0,path:e.tool.path,label:e.tool.label},null,8,[`path`,`label`])):(R(),W(`div`,Rd,[M(z(Sc),{"aria-hidden":`true`,class:`size-3.5 shrink-0 self-center text-fg-subtle`}),U(`span`,zd,B(n.value),1),r.value?(R(),W(`code`,Bd,B(r.value),1)):L(``,!0),U(`span`,{class:N(z(J)(`text-fg-muted`,i.value&&`text-danger`))},B(a.value),3)]))}}),Hd={key:0,class:`mb-2 grid gap-0.5 text-xs`},Ud={key:1,class:`mb-2 flex flex-wrap gap-1.5`},Wd={key:3,class:`whitespace-pre-wrap`},Gd=k({__name:`ChatBubble`,props:{text:{},tools:{default:()=>[]},media:{default:()=>[]},assistant:{type:Boolean,default:!1},streaming:{type:Boolean,default:!1}},setup(e){return(t,n)=>(R(),W(`div`,{class:N([`flex`,e.assistant?`justify-start`:`justify-end`])},[U(`div`,{class:N(z(J)(`max-w-[min(78ch,86%)] rounded-[0.85rem] px-4 py-3 leading-normal [overflow-wrap:anywhere]`,e.assistant?`bg-muted`:`bg-primary/15`))},[e.assistant&&e.tools.length?(R(),W(`div`,Hd,[(R(!0),W(V,null,G(e.tools,(t,n)=>(R(),K(Vd,{key:n,tool:t,streaming:e.streaming},null,8,[`tool`,`streaming`]))),128))])):L(``,!0),e.media.length?(R(),W(`div`,Ud,[(R(!0),W(V,null,G(e.media,(e,t)=>(R(),K(dd,{key:t,attachment:e},null,8,[`attachment`]))),128))])):L(``,!0),e.assistant?(R(),K(Fd,{key:2,text:e.text},null,8,[`text`])):(R(),W(`div`,Wd,B(e.text),1)),P(t.$slots,`default`)],2)],2))}}),Kd={class:`text-sm`},qd={key:0,class:`mt-1 text-fg-muted`},Jd={key:1,class:`mt-2 flex flex-wrap gap-2`},Yd=k({__name:`ChatChooseCard`,props:{choose:{}} Line truncated
`).map(e=>e.trim()).find(Boolean)||``,r=n.length>Xg?`${n.slice(0,Xg).trimEnd()}…`:n;return{text:r,full:t,truncated:r!==t}}function Qg(e){return String(e||`event`).replaceAll(`_`,` `).replace(/\b\w/g,e=>e.toUpperCase())}function $g(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 e_(e){let t=Number(e);return!Number.isFinite(t)||t<=0?``:t.toLocaleString(`en-US`)}function t_(e){return typeof e==`string`?e:``}function n_(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=$g(t.duration_ms),i=[r,e&&`ran for ${e}`].filter(Boolean).join(` · `);return{title:t.interrupted?`Stage interrupted: ${n}`:t.skipped?`Skipped stage: ${n}`:t.error?`Stage failed: ${n}`:`Finished stage: ${n}`,detail:[i,t_(t.error),t_(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:[t_(t.previous_stage)&&`after ${t_(t.previous_stage)}`,t_(t.previous_reason)].filter(Boolean).join(`: `)||e.detail||``}}if(e.kind===`agent_finish`){let r=e_(t.iterations),i=e_(t.tokens),a=Number(t.cached_tokens)||0,o=e_((Number(t.prompt_tokens)||0)-a),s=e_(t.completion_tokens),c=e_(t.cached_tokens),l=[r&&`${r} iterations`,i&&`${i} tokens`,o&&`${o} fresh prompt`,s&&`${s} completion`,c&&`${c} cached`,t_(t.model)].filter(Boolean);return{title:`Agent ${t_(t.status)||`finished`}: ${n}`,detail:l.join(` · `)||e.detail||``}}if(e.kind===`remediation_round`){let e=Number(t.of),n=t_(t.author);return{title:`Remediation ${t_(t.round)}${e>0?` of ${e}`:``}`,detail:[n&&`answers ${n}'s review`,t.review_id?`#${t_(t.review_id)}`:``].filter(Boolean).join(` `)}}if(e.kind===`review_approved`){let e=t_(t.pr_number);return{title:`Pull request approved`,detail:[t_(t.author),e&&`#${e}`].filter(Boolean).join(` · `)}}if(e.kind===`step_retried`)return{title:`Attempt ${t_(t.attempt)} of ${t_(t.of)} failed: ${e.stage||`step`}`,detail:t_(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=t_(t.source),n=t_(t.capture_id),r=[{label:`binding ${t_(t.binding_name)||t_(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 ${t_(t.captured_after)}`:``].filter(Boolean).join(` · `)}}return{title:Qg(e.kind||e.type),detail:e.detail||``}}var r_=[`title`],i_=k({__name:`ActivityRow`,props:{event:{}},emits:[`open`],setup(e,{emit:t}){let n=e,r=t,i=Bg(),a=I(()=>i.taskIDFor(n.event)),o=I(()=>Zg(n.event));function s(){a.value>0&&r(`open`,a.value)}let c=I(()=>n.event.at?yg(n.event.at):`—`);return(e,t)=>(R(),K(z(qg),{class:N(a.value>0?`cursor-pointer`:``),role:a.value>0?`link`:void 0,tabindex:a.value>0?0:void 0,title:a.value>0?`Open task details`:void 0,onClick:s,onKeydown:[jt(Nt(s,[`prevent`]),[`enter`]),jt(Nt(s,[`prevent`]),[`space`])]},{default:j(()=>[M(z(Q),{class:`font-medium`},{default:j(()=>[A(B(z(n_)({...n.event,at:void 0,detail:void 0}).title),1)]),_:1}),M(z(Q),{class:`font-mono`},{default:j(()=>[A(B(a.value>0?`#${a.value}`:`—`),1)]),_:1}),M(z(Q),{class:`w-[55%] max-w-0`},{default:j(()=>[U(`span`,{class:`block truncate`,title:o.value.truncated?o.value.full:void 0},B(o.value.text),9,r_)]),_:1}),M(z(Q),null,{default:j(()=>[A(B(c.value),1)]),_:1})]),_:1},8,[`class`,`role`,`tabindex`,`title`,`onKeydown`]))}}),a_=[{value:`all`,label:`All`},{value:`tasks`,label:`Tasks`},{value:`system`,label:`System`}];function o_(e){return(Number(e?.task_id)||0)>0}function s_(e,t){return t===`tasks`?o_(e):t!==`system`||!o_(e)}function c_(e,t){return e.filter(e=>s_(e,t))}function l_(e,t){return e>0?``:t===`all`?`Waiting for activity`:t===`tasks`?`No task events yet`:`No system events yet`}function u_(e,t){return`${e}:${t??0}`}function d_(e){let t=[];for(let n of e){let e=n.kind||n.type||`event`,r=Number(n.task_id)||0,i=u_(Zg(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 f_={key:0,class:`font-normal text-fg-subtle`},p_={role:`region`,"aria-label":`Activity`,"aria-live":`polite`},m_={class:`max-h-[28rem] oveLine truncated `).map(e=>e.trim()).find(Boolean)||``,i=r.length>t_?`${r.slice(0,t_).trimEnd()}…`:r;return{text:i,full:n,truncated:i!==n}}function r_(e){return String(e||`event`).replaceAll(`_`,` `).replace(/\b\w/g,e=>e.toUpperCase())}function i_(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 a_(e){let t=Number(e);return!Number.isFinite(t)||t<=0?``:t.toLocaleString(`en-US`)}function o_(e){return typeof e==`string`?e:``}function s_(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=i_(t.duration_ms),i=[r,e&&`ran for ${e}`].filter(Boolean).join(` · `);return{title:t.interrupted?`Stage interrupted: ${n}`:t.skipped?`Skipped stage: ${n}`:t.error?`Stage failed: ${n}`:`Finished stage: ${n}`,detail:[i,o_(t.error),o_(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:[o_(t.previous_stage)&&`after ${o_(t.previous_stage)}`,o_(t.previous_reason)].filter(Boolean).join(`: `)||e.detail||``}}if(e.kind===`agent_finish`){let r=a_(t.iterations),i=a_(t.tokens),a=Number(t.cached_tokens)||0,o=a_((Number(t.prompt_tokens)||0)-a),s=a_(t.completion_tokens),c=a_(t.cached_tokens),l=[r&&`${r} iterations`,i&&`${i} tokens`,o&&`${o} fresh prompt`,s&&`${s} completion`,c&&`${c} cached`,o_(t.model)].filter(Boolean);return{title:`Agent ${o_(t.status)||`finished`}: ${n}`,detail:l.join(` · `)||e.detail||``}}if(e.kind===`remediation_round`){let e=Number(t.of),n=o_(t.author);return{title:`Remediation ${o_(t.round)}${e>0?` of ${e}`:``}`,detail:[n&&`answers ${n}'s review`,t.review_id?`#${o_(t.review_id)}`:``].filter(Boolean).join(` `)}}if(e.kind===`review_approved`){let e=o_(t.pr_number);return{title:`Pull request approved`,detail:[o_(t.author),e&&`#${e}`].filter(Boolean).join(` · `)}}if(e.kind===`step_retried`)return{title:`Attempt ${o_(t.attempt)} of ${o_(t.of)} failed: ${e.stage||`step`}`,detail:o_(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=o_(t.source),n=o_(t.capture_id),r=[{label:`binding ${o_(t.binding_name)||o_(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 ${o_(t.captured_after)}`:``].filter(Boolean).join(` · `)}}return{title:r_(e.kind||e.type),detail:e.detail||``}}var c_=[`title`],l_=k({__name:`ActivityRow`,props:{event:{}},emits:[`open`],setup(e,{emit:t}){let n=e_();n.watchIdentities();let r=e,i=t,a=Ug(),o=I(()=>a.taskIDFor(r.event)),s=I(()=>n_(r.event,n.identityName));function c(){o.value>0&&i(`open`,o.value)}let l=I(()=>r.event.at?Sg(r.event.at):`—`);return(e,t)=>(R(),K(z(Xg),{class:N(o.value>0?`cursor-pointer`:``),role:o.value>0?`link`:void 0,tabindex:o.value>0?0:void 0,title:o.value>0?`Open task details`:void 0,onClick:c,onKeydown:[Mt(Pt(c,[`prevent`]),[`enter`]),Mt(Pt(c,[`prevent`]),[`space`])]},{default:j(()=>[M(z(Q),{class:`font-medium`},{default:j(()=>[A(B(z(s_)({...r.event,at:void 0,detail:void 0}).title),1)]),_:1}),M(z(Q),{class:`font-mono`},{default:j(()=>[A(B(o.value>0?`#${o.value}`:`—`),1)]),_:1}),M(z(Q),{class:`w-[55%] max-w-0`},{default:j(()=>[U(`span`,{class:`block truncate`,title:s.value.truncated?s.value.full:void 0},B(s.value.text),9,c_)]),_:1}),M(z(Q),null,{default:j(()=>[A(B(l.value),1)]),_:1})]),_:1},8,[`class`,`role`,`tabindex`,`title`,`onKeydown`]))}}),u_=[{value:`all`,label:`All`},{value:`tasks`,label:`Tasks`},{value:`system`,label:`System`}];function d_(e){return(Number(e?.task_id)||0)>0}function f_(e,t){return t===`tasks`?d_(e):t!==`system`||!d_(e)}function p_(e,t){return e.filter(e=>f_(e,t))}function m_(e,t){return e>0?``:t===`all`?`Waiting for activity`:t===`tasks`?`No task events yet`:`No system events yet`}function h_(e,t){return`${e}:${t??0}`}function g_(e){let t=[];for(let n of e){let e=n.kind||n.type||`event`,r=Number(n.task_id)||0,i=h_(n_(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 __={key:0,class:`font-normal text-fg-subtle`},v_={role:`region`,"aria-label":`Activity`,"ari Line truncated
`,1)[0]??``;return t.length>80?`${t.slice(0,79)}…`:t}var Mv=k({__name:`Collapsible`,props:{defaultOpen:{type:Boolean},open:{type:Boolean},disabled:{type:Boolean},unmountOnHide:{type:Boolean},asChild:{type:Boolean},as:{}},emits:[`update:open`],setup(e,{emit:t}){let r=n(e,t);return(e,t)=>(R(),K(z(l),H({"data-slot":`collapsible`},z(r)),{default:j(t=>[P(e.$slots,`default`,mt(Be(t)))]),_:3},16))}}),Nv=k({__name:`CollapsibleContent`,props:{forceMount:{type:Boolean},asChild:{type:Boolean},as:{}},setup(e){let t=e;return(e,n)=>(R(),K(z(o),H({"data-slot":`collapsible-content`},t),{default:j(()=>[P(e.$slots,`default`)]),_:3},16))}}),Pv=k({__name:`CollapsibleTrigger`,props:{asChild:{type:Boolean},as:{}},setup(e){let t=e;return(e,n)=>(R(),K(z(g),H({"data-slot":`collapsible-trigger`},t),{default:j(()=>[P(e.$slots,`default`)]),_:3},16))}});function Fv(e){return(e?.merged||0)+(e?.completed||0)}function Iv(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 Lv(e,t){return e.filter(e=>e.required&&!(t[e.name]??``).trim()).map(e=>e.name)}function Rv(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 cee(e,t){let n={};for(let r of e){let e=t[r.name];e!==void 0&&e!==``&&(n[r.name]=Rv(e,r.type))}return n}var zv=[`onKeydown`],Bv={key:0,class:`text-sm text-danger`,role:`alert`},Vv={key:1,class:`grid gap-1.5`},Hv=[`for`],Uv={key:0,class:`font-normal text-fg-subtle`},Wv=[`id`],Gv=[`value`],Kv={key:0,class:`text-xs text-fg-subtle`},qv={key:2,class:`grid gap-1.5`},Jv=[`id`],Yv={class:`block truncate font-mono text-[13px] font-medium`},Xv={class:`block text-xs text-fg-subtle`},Zv={key:0,class:`text-xs text-fg-subtle`},Qv={key:3,class:`grid gap-3`},$v=[`for`],ey={class:`font-mono`},ty={key:0,class:`text-fg-subtle`},ny={class:`text-xs text-fg-subtle`},ry={class:`grid gap-1.5`},iy=[`for`],ay={class:`grid gap-1.5`},oy=[`for`],sy={class:`font-mono`},cy={key:4,class:`text-sm text-danger`,role:`alert`},ly={class:`flex items-center gap-2 border-t border-border pt-4`},uy={class:`mr-auto text-xs text-fg-subtle`},dy=k({__name:`NewTaskForm`,props:{workflow:{},draft:{},initialWorkflow:{},initialInstructions:{}},emits:[`started`,`cancel`],setup(e,{emit:t}){let n=e,r=t,i=Ge(),a=q([]),o=q([]),s=q([]),c=q(``);_t(async()=>{try{let[e,t]=await Promise.all([X.workflows(),X.tasks()]);a.value=(e?.definitions??[]).filter(e=>e.enabled),o.value=e?.workflows??[],s.value=[...new Set((t??[]).filter(e=>e.owner&&e.repo).map(e=>`${e.owner}/${e.repo}`))].slice(0,5)}catch(e){c.value=String(e.message||e)}});let l=Av();l.watchIdentities();let u=I(()=>l.identities.filter(e=>e.kind!==`system`&&e.lifecycle===`active`)),d=q(``),f=q(n.workflow??n.initialWorkflow??``),p=q(n.initialInstructions??``),m=q(jv(p.value)),h=q(``),g=q({});nt(()=>{!f.value&&a.value[0]&&(f.value=a.value[0].id),!h.value&&u.value[0]&&(h.value=u.value[0].id)});let _=I(()=>a.value.find(e=>e.id===f.value)),v=I(()=>Iv(_.value)),y=I(()=>Lv(v.value,g.value)),b=I(()=>_.value?.repository??`required`),x=I(()=>b.value!==`optional`&&b.value!==`none`),S=e=>o.value.find(t=>t.workflow===e),C=I(()=>u.value.find(e=>e.id===h.value)?.display_name??`nobody`),w=q(!1),T=q(``),ee=I(()=>!!((d.value.trim()||!x.value)&&f.value&&m.value.trim()&&p.value.trim()&&h.value)&&y.value.length===0);async function E(){if(ee.value&&!w.value){w.value=!0,T.value=``;try{let e=await X.workRequest({identity:h.value,repository:b.value===`none`?``:d.value.trim(),workflow:f.value,title:m.value.trim(),instructions:p.value,inputs:cee(v.value,g.value),...n.draft?{draft:n.draft}:{}});r(`started`,e.task_id)}catch(e){T.value=String(e.message||e)}finally{w.value=!1}}}return(e,t)=>(R(),W(`form`,{class:`grid gap-5`,onSubmit:Nt(E,[`prevent`]),onKeydown:[jt(Nt(E,[`meta`,`prevent`]),[`enter`]),jt(Nt(E,[`ctrl`,`prevent`]),[`enter`])]},[c.value?(R(),W(`p`,Bv,B(c.value),1)):L(``,!0),b.value===`none`?L(``,!0):(R(),W(`div`,Vv,[U(`label`,{for:`${z(i)}-repo`,class:`text-[13px] font-medium`},[t[6]||=A(`Repository`,-1),x.value?L(``,!0):(R(),W(`span`,Uv,` (optional)`))],8,Hv),M(z(Z),{id:`${z(i)}-repo`,modelValue:d.value,"onUpdate:modelValue":t[0]||=e=>d.value=e,class:`font-mono`,placeholder:`owner/repository`,list:`${z(i)}-repos`,required:x.value},null,8,[`id`,`modelValue`,`list`,`required`]),U(`datalist`,{id:`${z(i)}-repos`},[(R(!0),W(V,null,G(s.value,e=>(R(),W(`option`,{key:e,value:e},null,8,Gv))),128))],8,Wv),s.value.length?(R(),W(`p`,Kv,[t[7]||=A(`Recent: `,-1),(R(!0),W(V,null,G(s.value,e=>(R(),K(z(Y),{key:e,type:`button`,variant:`link`,size:`xs`,class:`h-auto px-1 font-mono text-fg-subtle`,onClick:t=>d.value=e},{default:j(()=>[A(B(e),1)]),_:2},1032,[`onClick`]))),128))])):L(``,!0)])),n.workflow?L(``,!0):(R(),W(`div`,qv,[U(`span`,{id:`${z(i)}-wf`,class:`text-[13px] font-medium`},`Workflow`,8,Jv),M( Line truncated `,1)[0]??``;return t.length>80?`${t.slice(0,79)}…`:t}var Fv=k({__name:`Collapsible`,props:{defaultOpen:{type:Boolean},open:{type:Boolean},disabled:{type:Boolean},unmountOnHide:{type:Boolean},asChild:{type:Boolean},as:{}},emits:[`update:open`],setup(e,{emit:t}){let n=S(e,t);return(e,t)=>(R(),K(z(f),H({"data-slot":`collapsible`},z(n)),{default:j(t=>[P(e.$slots,`default`,ht(Ve(t)))]),_:3},16))}}),Iv=k({__name:`CollapsibleContent`,props:{forceMount:{type:Boolean},asChild:{type:Boolean},as:{}},setup(e){let t=e;return(e,n)=>(R(),K(z(l),H({"data-slot":`collapsible-content`},t),{default:j(()=>[P(e.$slots,`default`)]),_:3},16))}}),Lv=k({__name:`CollapsibleTrigger`,props:{asChild:{type:Boolean},as:{}},setup(e){let t=e;return(e,n)=>(R(),K(z(o),H({"data-slot":`collapsible-trigger`},t),{default:j(()=>[P(e.$slots,`default`)]),_:3},16))}});function Rv(e){return(e?.merged||0)+(e?.completed||0)}function zv(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 Bv(e,t){return e.filter(e=>e.required&&!(t[e.name]??``).trim()).map(e=>e.name)}function Vv(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 Hv(e,t){let n={};for(let r of e){let e=t[r.name];e!==void 0&&e!==``&&(n[r.name]=Vv(e,r.type))}return n}var Uv=[`onKeydown`],Wv={key:0,class:`text-sm text-danger`,role:`alert`},Gv={key:1,class:`grid gap-1.5`},Kv=[`for`],qv={key:0,class:`font-normal text-fg-subtle`},Jv=[`id`],Yv=[`value`],Xv={key:0,class:`text-xs text-fg-subtle`},Zv={key:2,class:`grid gap-1.5`},Qv=[`id`],$v={class:`block truncate font-mono text-[13px] font-medium`},ey={class:`block text-xs text-fg-subtle`},ty={key:0,class:`text-xs text-fg-subtle`},ny={key:3,class:`grid gap-3`},ry=[`for`],iy={class:`font-mono`},ay={key:0,class:`text-fg-subtle`},oy={class:`text-xs text-fg-subtle`},sy={class:`grid gap-1.5`},cy=[`for`],ly={class:`grid gap-1.5`},uy=[`for`],dy={class:`font-mono`},fy={key:4,class:`text-sm text-danger`,role:`alert`},py={class:`flex items-center gap-2 border-t border-border pt-4`},my={class:`mr-auto text-xs text-fg-subtle`},hy=k({__name:`NewTaskForm`,props:{workflow:{},draft:{},initialWorkflow:{},initialInstructions:{}},emits:[`started`,`cancel`],setup(e,{emit:t}){let n=e,r=t,i=Ke(),a=q([]),o=q([]),s=q([]),c=q(``);vt(async()=>{try{let[e,t]=await Promise.all([X.workflows(),X.tasks()]);a.value=(e?.definitions??[]).filter(e=>e.enabled),o.value=e?.workflows??[],s.value=[...new Set((t??[]).filter(e=>e.owner&&e.repo).map(e=>`${e.owner}/${e.repo}`))].slice(0,5)}catch(e){c.value=String(e.message||e)}});let l=e_();l.watchIdentities();let u=I(()=>l.identities.filter(e=>e.kind!==`system`&&e.lifecycle===`active`)),d=q(``),f=q(n.workflow??n.initialWorkflow??``),p=q(n.initialInstructions??``),m=q(Pv(p.value)),h=q(``),g=q({});rt(()=>{!f.value&&a.value[0]&&(f.value=a.value[0].id),!h.value&&u.value[0]&&(h.value=u.value[0].id)});let _=I(()=>a.value.find(e=>e.id===f.value)),v=I(()=>zv(_.value)),y=I(()=>Bv(v.value,g.value)),b=I(()=>_.value?.repository??`required`),x=I(()=>b.value!==`optional`&&b.value!==`none`),S=e=>o.value.find(t=>t.workflow===e),C=I(()=>u.value.find(e=>e.id===h.value)?.display_name??`nobody`),w=q(!1),T=q(``),ee=I(()=>!!((d.value.trim()||!x.value)&&f.value&&m.value.trim()&&p.value.trim()&&h.value)&&y.value.length===0);async function E(){if(ee.value&&!w.value){w.value=!0,T.value=``;try{let e=await X.workRequest({identity:h.value,repository:b.value===`none`?``:d.value.trim(),workflow:f.value,title:m.value.trim(),instructions:p.value,inputs:Hv(v.value,g.value),...n.draft?{draft:n.draft}:{}});r(`started`,e.task_id)}catch(e){T.value=String(e.message||e)}finally{w.value=!1}}}return(e,t)=>(R(),W(`form`,{class:`grid gap-5`,onSubmit:Pt(E,[`prevent`]),onKeydown:[Mt(Pt(E,[`meta`,`prevent`]),[`enter`]),Mt(Pt(E,[`ctrl`,`prevent`]),[`enter`])]},[c.value?(R(),W(`p`,Wv,B(c.value),1)):L(``,!0),b.value===`none`?L(``,!0):(R(),W(`div`,Gv,[U(`label`,{for:`${z(i)}-repo`,class:`text-[13px] font-medium`},[t[6]||=A(`Repository`,-1),x.value?L(``,!0):(R(),W(`span`,qv,` (optional)`))],8,Kv),M(z(Z),{id:`${z(i)}-repo`,modelValue:d.value,"onUpdate:modelValue":t[0]||=e=>d.value=e,class:`font-mono`,placeholder:`owner/repository`,list:`${z(i)}-repos`,required:x.value},null,8,[`id`,`modelValue`,`list`,`required`]),U(`datalist`,{id:`${z(i)}-repos`},[(R(!0),W(V,null,G(s.value,e=>(R(),W(`option`,{key:e,value:e},null,8,Yv))),128))],8,Jv),s.value.length?(R(),W(`p`,Xv,[t[7]||=A(`Recent: `,-1),(R(!0),W(V,null,G(s.value,e=>(R(),K(z(Y),{key:e,type:`button`,variant:`link`,size:`xs`,class:`h-auto px-1 font-mono text-fg-subtle`,onClick:t=>d.value=e},{default:j(()=>[A(B(e),1)]),_:2},1032,[`onClick`]))),128))])):L(``,!0)])),n.workflow?L(``,!0):(R(),W(`div`,Zv,[U(`span`,{id:`${z(i)}-wf`,class:`text-[13px] font-medium`},`Workflow`,8,Qv),M(z( Line truncated
`)){let e=n.indexOf(`:`);if(e<=0)continue;let r=n.slice(0,e).trim();r&&(t[r]=n.slice(e+1).trim())}return t}function ky(e,t){if(!e.event_type)return{label:`Unidentified`,identified:!1};let n=t.find(t=>t.id===e.event_type);return{label:n?n.name:`Deleted type`,identified:!0}}function Ay(e,t){if(!e)return`No event type`;let n=t.find(t=>t.id===e);return n?`${n.source} / ${n.name}`:`Deleted type`}function jy(e){let t=[...(e.headers||[]).map(e=>`${e.name} = ${e.value}`),...(e.payload||[]).map(e=>e.op===`present`?`${e.path} present`:`${e.path} = ${e.value??``}`)];return t.length?t.join(` · `):`any event`}function My(e){return{headers:(e.headers||[]).filter(e=>e.name.trim()!==``).map(e=>({name:e.name.trim(),value:e.value})),payload:(e.payload||[]).filter(e=>e.path.trim()!==``).map(e=>e.op===`present`?{path:e.path.trim(),op:e.op}:{path:e.path.trim(),op:e.op,value:e.value??``})}}var Ny=q([]),Py=q([]),Fy=q(!0),Iy=q(null),Ly=q(null),Ry=q(!1),zy=q(null);async function By(){try{let e=await X.eventTypes(Dy().workspace);Fy.value=e.enabled!==!1,Ny.value=e.event_types||[],Py.value=e.proposals||[],Iy.value=null}catch(e){Iy.value=e.message||String(e)}}function Vy(e){return{headers:(e.headers||[]).map(e=>({...e})),payload:(e.payload||[]).map(e=>({...e}))}}function Hy(e){zy.value=null,Ly.value=e}function Uy(e){let t=Zy.value.find(t=>String(t.id)===e.sample_id);Hy({mode:`proposal`,id:null,source:e.source,name:``,rule:Vy(e.rule),headersText:``,body:t?.body||``,exampleHeaders:e.headers||{}})}function Wy(e=``){Hy({mode:`paste`,id:null,source:e,name:``,rule:{headers:[],payload:[]},headersText:``,body:``,exampleHeaders:{}})}function Gy(e){Hy({mode:`edit`,id:e.id,source:e.source,name:e.name,rule:Vy(e.rule),headersText:``,body:``,exampleHeaders:{}})}function Ky(){Ly.value=null}async function qy(){let e=Ly.value;if(e){Ry.value=!0;try{if(e.mode===`edit`&&e.id)await X.eventTypeUpdate(e.id,{name:e.name,rule:My(e.rule)});else{let t=e.mode===`paste`?Oy(e.headersText):e.exampleHeaders;await X.eventTypeCreate({source:e.source,name:e.name,rule:e.mode===`paste`?void 0:My(e.rule),example:{headers:t,body:e.body}})}Ly.value=null,await By()}catch(e){zy.value=e.message||String(e)}finally{Ry.value=!1}}}var Jy=q(null);async function Yy(){let e=Jy.value;if(Jy.value=null,e)try{await X.eventTypeDelete(e.id),await By()}catch(e){Iy.value=e.message||String(e)}}var Xy=100,Zy=q([]),Qy=q(!0),$y=q(null),eb=q(!0),tb=q(null);async function nb(){try{let e=await X.captures(Xy);Qy.value=e.enabled!==!1,Zy.value=e.captures||[],$y.value=null}catch(e){$y.value=e.message||String(e)}finally{eb.value=!1}}function rb(e){let t=Zy.value.find(t=>t.id===e);return t&&(tb.value=t),!!t}function ib(){Zy.value.length&&(tb.value=Zy.value[0])}function ab(){Pe(`captures`,()=>{nb(),By()})}var ob=k({__name:`Tabs`,props:{defaultValue:{},orientation:{},dir:{},activationMode:{},modelValue:{},unmountOnHide:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},emits:[`update:modelValue`],setup(e,{emit:t}){let r=e,i=t,a=Rt(r,`class`),o=n(a,i);return(e,t)=>(R(),K(z(yo),H({"data-slot":`tabs`,"data-orientation":z(o).orientation||`horizontal`},z(o),{class:z(J)(`gap-2 group/tabs flex data-horizontal:flex-col`,r.class)}),{default:j(t=>[P(e.$slots,`default`,mt(Be(t)))]),_:3},16,[`data-orientation`,`class`]))}}),sb=k({__name:`TabsContent`,props:{value:{},forceMount:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e,n=Rt(t,`class`);return(e,r)=>(R(),K(z(So),H({"data-slot":`tabs-content`,class:z(J)(`text-sm flex-1 outline-none`,t.class)},z(n)),{default:j(()=>[P(e.$slots,`default`)]),_:3},16,[`class`]))}}),cb=k({__name:`TabsList`,props:{loop:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]},variant:{default:`default`}},setup(e){let t=e,n=Rt(t,`class`,`variant`);return(r,i)=>(R(),K(z(Co),H({"data-slot":`tabs-list`,"data-variant":e.variant},z(n),{class:z(J)(z(ub)({variant:e.variant}),t.class)}),{default:j(()=>[P(r.$slots,`default`)]),_:3},16,[`data-variant`,`class`]))}}),lb=k({__name:`TabsTrigger`,props:{value:{},disabled:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e,n=Rt(t,`class`),r=S(n);return(e,n)=>(R(),K(z(wo),H({"data-slot":`tabs-trigger`,class:z(J)(`gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg:not([class*=size-])]:size-4 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-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 Ny(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 Py(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 Fy(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 Iy(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 Ly=q([]),Ry=q([]),zy=q(!0),By=q(null),Vy=q(null),Hy=q(!1),Uy=q(null);async function Wy(){try{let e=await X.eventTypes(jy().workspace);zy.value=e.enabled!==!1,Ly.value=e.event_types||[],Ry.value=e.proposals||[],By.value=null}catch(e){By.value=e.message||String(e)}}function Gy(e){return{headers:(e.headers||[]).map(e=>({...e})),payload:(e.payload||[]).map(e=>({...e}))}}function Ky(e){Uy.value=null,Vy.value=e}function qy(e){let t=tb.value.find(t=>String(t.id)===e.sample_id);Ky({mode:`proposal`,id:null,source:e.source,name:``,rule:Gy(e.rule),headersText:``,body:t?.body||``,exampleHeaders:e.headers||{}})}function Jy(e=``){Ky({mode:`paste`,id:null,source:e,name:``,rule:{headers:[],payload:[]},headersText:``,body:``,exampleHeaders:{}})}function Yy(e){Ky({mode:`edit`,id:e.id,source:e.source,name:e.name,rule:Gy(e.rule),headersText:``,body:``,exampleHeaders:{}})}function Xy(){Vy.value=null}async function Zy(){let e=Vy.value;if(e){Hy.value=!0;try{if(e.mode===`edit`&&e.id)await X.eventTypeUpdate(e.id,{name:e.name,rule:Iy(e.rule)});else{let t=e.mode===`paste`?My(e.headersText):e.exampleHeaders;await X.eventTypeCreate({source:e.source,name:e.name,rule:e.mode===`paste`?void 0:Iy(e.rule),example:{headers:t,body:e.body}})}Vy.value=null,await Wy()}catch(e){Uy.value=e.message||String(e)}finally{Hy.value=!1}}}var Qy=q(null);async function $y(){let e=Qy.value;if(Qy.value=null,e)try{await X.eventTypeDelete(e.id),await Wy()}catch(e){By.value=e.message||String(e)}}var eb=100,tb=q([]),nb=q(!0),rb=q(null),ib=q(!0),ab=q(null);async function ob(){try{let e=await X.captures(eb);nb.value=e.enabled!==!1,tb.value=e.captures||[],rb.value=null}catch(e){rb.value=e.message||String(e)}finally{ib.value=!1}}function sb(e){let t=tb.value.find(t=>t.id===e);return t&&(ab.value=t),!!t}function cb(){tb.value.length&&(ab.value=tb.value[0])}function lb(){Re(`captures`,()=>{ob(),Wy()})}var ub=k({__name:`Tabs`,props:{defaultValue:{},orientation:{},dir:{},activationMode:{},modelValue:{},unmountOnHide:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,i=zt(n,`class`),a=S(i,r);return(e,t)=>(R(),K(z(bo),H({"data-slot":`tabs`,"data-orientation":z(a).orientation||`horizontal`},z(a),{class:z(J)(`gap-2 group/tabs flex data-horizontal:flex-col`,n.class)}),{default:j(t=>[P(e.$slots,`default`,ht(Ve(t)))]),_:3},16,[`data-orientation`,`class`]))}}),db=k({__name:`TabsContent`,props:{value:{},forceMount:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e,n=zt(t,`class`);return(e,r)=>(R(),K(z(Co),H({"data-slot":`tabs-content`,class:z(J)(`text-sm flex-1 outline-none`,t.class)},z(n)),{default:j(()=>[P(e.$slots,`default`)]),_:3},16,[`class`]))}}),fb=k({__name:`TabsList`,props:{loop:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]},variant:{default:`default`}},setup(e){let t=e,n=zt(t,`class`,`variant`);return(r,i)=>(R(),K(z(wo),H({"data-slot":`tabs-list`,"data-variant":e.variant},z(n),{class:z(J)(z(mb)({variant:e.variant}),t.class)}),{default:j(()=>[P(r.$slots,`default`)]),_:3},16,[`data-variant`,`class`]))}}),pb=k({__name:`TabsTrigger`,props:{value:{},disabled:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e,n=zt(t,`class`),r=c(n);return(e,n)=>(R(),K(z(To),H({"data-slot":`tabs-trigger`,class:z(J)(`gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg:not([class*=size-])]:size-4 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-Line truncated
WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var SM=cM(`CharSizeService`),CM=cM(`CoreBrowserService`),wM=cM(`MouseService`),TM=cM(`RenderService`),EM=cM(`SelectionService`),DM=cM(`CharacterJoinerService`),OM=cM(`ThemeService`),kM=cM(`LinkProviderService`),AM=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?IM.isErrorNoTelemetry(e)?new IM(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 TM=dM(`CharSizeService`),EM=dM(`CoreBrowserService`),DM=dM(`MouseService`),OM=dM(`RenderService`),kM=dM(`SelectionService`),AM=dM(`CharacterJoinerService`),jM=dM(`ThemeService`),MM=dM(`LinkProviderService`),NM=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?zM.isErrorNoTelemetry(e)?new zM(e.message+`
`+e.stack):Error(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 jM(e){NM(e)||AM.onUnexpectedError(e)}var MM=`Canceled`;function NM(e){return e instanceof PM||e instanceof Error&&e.name===MM&&e.message===MM}var PM=class extends Error{constructor(){super(MM),this.name=this.message}};function FM(e){return Error(e?`Illegal argument: ${e}`:`Illegal argument`)}var IM=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`}},LM=class e extends Error{constructor(t){super(t||`An unexpected bug occurred.`),Object.setPrototypeOf(this,e.prototype)}};function RM(e,t=0){return e[e.length-(1+t)]}var zM;(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})(zM||={});var BM=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||zM.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};BM.empty=new BM(e=>{});function VM(e,t){let n=this,r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}var HM;(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})(HM||={});var UM=null;function WM(e){return UM?.trackDisposable(e),e}function GM(e){UM?.markAsDisposed(e)}function KM(e,t){UM?.setParent(e,t)}function qM(e){return UM?.markAsSingleton(e),e}function JM(e){if(HM.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 YM(...e){return XM(()=>JM(e))}function XM(e){let t=WM({dispose:VM(()=>{GM(t),e()})});return t}var ZM=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,WM(this)}dispose(){this._isDisposed||(GM(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{JM(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return KM(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),KM(e,null))}};ZM.DISABLE_DISPOSED_WARNING=!1;var QM=ZM,$M=class{constructor(){this._store=new QM,WM(this),KM(this._store,this)}dispose(){GM(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 PM(e){IM(e)||NM.onUnexpectedError(e)}var FM=`Canceled`;function IM(e){return e instanceof LM||e instanceof Error&&e.name===FM&&e.message===FM}var LM=class extends Error{constructor(){super(FM),this.name=this.message}};function RM(e){return Error(e?`Illegal argument: ${e}`:`Illegal argument`)}var zM=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`}},BM=class e extends Error{constructor(t){super(t||`An unexpected bug occurred.`),Object.setPrototypeOf(this,e.prototype)}};function VM(e,t=0){return e[e.length-(1+t)]}var HM;(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})(HM||={});var UM=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||HM.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};UM.empty=new UM(e=>{});function WM(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 GM;(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})(GM||={});var KM=null;function qM(e){return KM?.trackDisposable(e),e}function JM(e){KM?.markAsDisposed(e)}function YM(e,t){KM?.setParent(e,t)}function XM(e){return KM?.markAsSingleton(e),e}function ZM(e){if(GM.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 QM(...e){return $M(()=>ZM(e))}function $M(e){let t=qM({dispose:WM(()=>{JM(t),e()})});return t}var eN=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,qM(this)}dispose(){this._isDisposed||(JM(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{ZM(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return YM(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),YM(e,null))}};eN.DISABLE_DISPOSED_WARNING=!1;var tN=eN,nN=class{constructor(){this._store=new tN,qM(this),YM(this._store,this)}dispose(){JM(thi Line truncated
`).slice(2).join(` `).slice(2).join(`
`))}},mN=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},hN=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},gN=0,_N=class{constructor(e){this.value=e,this.id=gN++}},vN=2,yN=class{constructor(e){this._size=0,this._options=e,this._leakageMon=uN>0||this._options?.leakWarningThreshold?new fN(e?.onListenerError??jM,this._options?.leakWarningThreshold??uN):void 0,this._perfMon=this._options?._profName?new lN(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 hN(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||jM)(n),$M.None}if(this._disposed)return $M.None;t&&(e=e.bind(t));let r=new _N(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=pN.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof _N?(this._deliveryQueue??=new bN,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=XM(()=>{i?.(),this._removeListener(r)});return n instanceof QM?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*vN<=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||jM;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 _N)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}},bN=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}},xN=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new yN,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new yN,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}};xN.INSTANCE=new xN;var SN=xN;function CN(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}SN.INSTANCE.onDidChangeZoomLevel;function wN(e){return SN.INSTANCE.getZoomFactor(e)}SN.INSTANCE.onDidChangeFullscreen;var TN=typeof navigator==`object`?navigator.userAgent:``,EN=TN.indexOf(`Firefox`)>=0,DN=TN.indexOf(`AppleWebKit`)>=0,ON=TN.indexOf(`Chrome`)>=0,kN=!ON&&TN.indexOf(`Safari`)>=0;TN.indexOf(`Electron/`),TN.indexOf(`Android`);var AN=!1;if(typeof tN.matchMedia==`function`){let e=tN.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=tN.matchMedia(`(display-mode: fullscreen)`);AN=e.matches,CN(tN,e,({matches:e})=>{AN&&t.matches||(AN=e)} Line truncated `))}},_N=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},vN=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},yN=0,bN=class{constructor(e){this.value=e,this.id=yN++}},xN=2,SN=class{constructor(e){this._size=0,this._options=e,this._leakageMon=pN>0||this._options?.leakWarningThreshold?new hN(e?.onListenerError??PM,this._options?.leakWarningThreshold??pN):void 0,this._perfMon=this._options?._profName?new fN(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 vN(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||PM)(n),nN.None}if(this._disposed)return nN.None;t&&(e=e.bind(t));let r=new bN(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=gN.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof bN?(this._deliveryQueue??=new CN,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=$M(()=>{i?.(),this._removeListener(r)});return n instanceof tN?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*xN<=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||PM;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 bN)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}},CN=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}},wN=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new SN,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new SN,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}};wN.INSTANCE=new wN;var TN=wN;function EN(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}TN.INSTANCE.onDidChangeZoomLevel;function DN(e){return TN.INSTANCE.getZoomFactor(e)}TN.INSTANCE.onDidChangeFullscreen;var ON=typeof navigator==`object`?navigator.userAgent:``,kN=ON.indexOf(`Firefox`)>=0,AN=ON.indexOf(`AppleWebKit`)>=0,jN=ON.indexOf(`Chrome`)>=0,MN=!jN&&ON.indexOf(`Safari`)>=0;ON.indexOf(`Electron/`),ON.indexOf(`Android`);var NN=!1;if(typeof iN.matchMedia==`function`){let e=iN.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=iN.matchMedia(`(display-mode: fullscreen)`);NN=e.matches,EN(iN,e,({matches:e})=>{NN&&t.matches||(NN=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}};EF=Ij([Lj(2,uM),Lj(3,CM),Lj(4,dM),Lj(5,OM),Lj(6,gM),Lj(7,TM)],EF);var DF=class extends $M{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(XM(()=>{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 `)})),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}};kF=zj([Bj(2,pM),Bj(3,EM),Bj(4,mM),Bj(5,jM),Bj(6,yM),Bj(7,OM)],kF);var AF=class extends nN{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($M(()=>{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 NF;(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=`Ÿ`))(NF||={});var PF;(e=>e.ST=`${$.ESC}\\`)(PF||={});var FF=class{constructor(e,t,n,r,i,a){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=``}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent=``,this._dataAlreadySent=``,this._compositionView.classList.add(`active`)}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove(`active`),this._isComposing=!1,e){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let t;e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,this._compositionPosition.start):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}},0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,``);this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${$.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+`px`,this._compositionView.style.top=n+`px`,this._compositionView.style.height=t+`px`,this._compositionView.style.lineHeight=t+`px`,this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+`px`;let i=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+`px`,this._textarea.style.top=n+`px`,this._textarea.style.width=Math.max(i.width,1)+`px`,this._textarea.style.height=Math.max(i.height,1)+`px`,this._textarea.style.lineHeight=i.height+`px`}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};FF=Ij([Lj(2,uM),Lj(3,gM),Lj(4,fM),Lj(5,TM)],FF);var IF=0,LF=0,RF=0,zF=0,BF={css:`#00000000`,rgba:0},VF;(e=>{function t(e,t,n,r){return r===void 0?`#${KF(e)}${KF(t)}${KF(n)}`:`#${KF(e)}${KF(t)}${KF(n)}${KF(r)}`}e.toCss=t;function n(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0}e.toRgba=n;function r(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}e.toColor=r})(VF||={});var HF;(e=>{function t(e,t){if(zF=(t.rgba&255)/255,zF===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 IF=a+Math.round((n-a)*zF),LF=o+Math.round((r-o)*zF),RF=s+Math.round((i-s)*zF),{css:VF.toCss(IF,LF,RF),rgba:VF.toRgba(IF,LF,RF)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=GF.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return VF.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[IF,LF,RF]=GF.toChannels(t),{css:VF.toCss(IF,LF,RF),rgba:t}}e.opaque=i;function a(e,t){return zF=Math.round(t*255),[IF,LF,RF]=GF.toChannels(e.rgba),{css:VF.toCss(IF,LF,RF,zF),rgba:VF.toRgba(IF,LF,RF,zF)}}e.opacity=a;function o(e,t){return zF=e.rgba&255,a(e,zF*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.r Line 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 IF;(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=`Ÿ`))(IF||={});var LF;(e=>e.ST=`${$.ESC}\\`)(LF||={});var RF=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)}}};RF=zj([Bj(2,pM),Bj(3,yM),Bj(4,hM),Bj(5,OM)],RF);var zF=0,BF=0,VF=0,HF=0,UF={css:`#00000000`,rgba:0},WF;(e=>{function t(e,t,n,r){return r===void 0?`#${YF(e)}${YF(t)}${YF(n)}`:`#${YF(e)}${YF(t)}${YF(n)}${YF(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})(WF||={});var GF;(e=>{function t(e,t){if(HF=(t.rgba&255)/255,HF===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 zF=a+Math.round((n-a)*HF),BF=o+Math.round((r-o)*HF),VF=s+Math.round((i-s)*HF),{css:WF.toCss(zF,BF,VF),rgba:WF.toRgba(zF,BF,VF)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=JF.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return WF.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[zF,BF,VF]=JF.toChannels(t),{css:WF.toCss(zF,BF,VF),rgba:t}}e.opaque=i;function a(e,t){return HF=Math.round(t*255),[zF,BF,VF]=JF.toChannels(e.rgba),{css:WF.toCss(zF,BF,VF,HF),rgba:WF.toRgba(zF,BF,VF,HF)}}e.opacity=a;function o(e,t){return HF=e.rgba&255,a(e,HF*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()),LI&&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=oL(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=xI(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,-sL),sL),t/=sL,t/Math.abs(t)+Math.round(t*(cL-1)))}shouldForceSelection(e){return NI?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(),lL)}_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&&!(NI&&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 `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh()),BI&&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=lL(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=wI(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,-uL),uL),t/=uL,t/Math.abs(t)+Math.round(t*(dL-1)))}shouldForceSelection(e){return II?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(),fL)}_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&&!(II&&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(IP(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(XM(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<lz+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===` `))),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(zP(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register($M(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<fz+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===lz+1&&(this._liveRegion.textContent+=Vj.get())))}_clearLiveRegion(){this._liveRegion.textContent=``,this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),/\p{Control}/u.test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let e=n.lines.get(n.ydisp+i),t=[],a=e?.translateToString(!0,void 0,void 0,t)||``,o=(n.ydisp+i+1).toString(),s=this._rowElements[i];s&&(a.length===0?(s.textContent=`\xA0`,this._rowColumns.set(s,[0,1])):(s.textContent=a,this._rowColumns.set(s,t)),s.setAttribute(`aria-posinset`,o),s.setAttribute(`aria-setsize`,r),this._alignRowWidth(s))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce=``)}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2];if(n.getAttribute(`aria-posinset`)===(t===0?`1`:`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==r)return;let i,a;if(t===0?(i=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(i=this._rowElements.shift(),a=n,this._rowContainer.removeChild(i)),i.removeEventListener(`focus`,this._topBoundaryFocusListener),a.removeEventListener(`focus`,this._bottomBoundaryFocusListener),t===0){let e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement(`afterbegin`,e)}else{let e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener(`focus`,this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error(`anchorNode and/or focusNode are null`);return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:r.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let i=({node:e,offset:t})=>{let n=e instanceof Text?e.parentNode:e,r=parseInt(n?.getAttribute(`aria-posinset`),10)-1;if(isNaN(r))return console.warn(`row is invalid. Race condition?`),null;let i=this._rowColumns.get(n);if(!i)return console.warn(`columns is null. Race condition?`),null;let a=t<i.length?i[t]:i.slice(-1)[0]+1;return a>=this._terminal.cols&&(++r,a=0),{row:r,column:a}},a=i(t),o=i(n);if(a&&o){if(a.row>o.row||a.row===o.row&&a.column>=o.column)throw Error(`invalid range`);this._terminal.select(a.column,a.row,(o.row-a.row)*this._terminal.cols-a.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener(`focus`,this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener(`focus`,this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement(`div`);return e.setAttribute(`role`,`listitem`),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){e.style.transform=``;let t=e.getBoundingClientRect().width,n=this._rowColumns.get(e)?.slice(-1)?.[0];if(!n)return;let Line truncated `&&(this._liveRegionLineCount++,this._liveRegionLineCount===fz+1&&(this._liveRegion.textContent+=Wj.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 zj.get()},set promptLabel(e){zj.set(e)},get tooMuchOutput(){return Vj.get()},set tooMuchOutput(e){Vj.set(e)}}}_verifyIntegers(...e){for(Sz of e)if(Sz===1/0||isNaN(Sz)||Sz%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(Sz of e)if(Sz&&(Sz===1/0||isNaN(Sz)||Sz%1!=0||Sz<0))throw Error(`This API only accepts positive integers`)}},wz=2,Tz=1,Ez=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(wz,Math.floor(u/e.css.cell.width)),rows:Math.max(Tz,Math.floor(l/e.css.cell.height))}}},Dz={class:`flex h-[32rem] min-h-0 flex-col gap-2`},Oz={key:0,class:`text-sm text-muted-foreground`,role:`status`},kz=k({__name:`SandboxView`,props:{taskId:{},attempt:{}},setup(e){let t=e,n=q(null),r=q(`connecting`),i=null,a=null,o=null,s=null;function c(){try{o?.fit()}catch{}}return _t(()=>{let e=n.value;if(!e)return;i=new Cz({convertEol:!0,disableStdin:!0,cursorBlink:!1,fontFamily:`'IBM Plex Mono', ui-monospace, monospace`,fontSize:13,theme:{background:`#0b0f14`,foreground:`#e6edf3`}}),o=new Ez,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)}),ut(()=>{s?.disconnect(),s=null,a?.close(),a=null,i?.dispose(),i=null,o=null}),(e,t)=>(R(),W(`div`,Dz,[r.value===`open`?L(``,!0):(R(),W(`p`,Oz,[r.value===`connecting`?(R(),W(V,{key:0},[A(`Connecting…`)],64)):r.value===`closed`?(R(),W(V,{key:1},[A(`The sandbox view ended.`)],64)):(R(),W(V,{key:2},[A(`The sandbox view is unavailable.`)],64))])),U(`div`,{ref_key:`host`,ref:n,class:`min-h-0 flex-1 overflow-hidden rounded-md border border-border bg-[#0b0f14] p-2`},null,512)]))}}),Az={class:`flex flex-wrap items-center gap-3 border-b border-border pb-3`},jz={class:`inline-flex items-center gap-2`},Mz={class:`inline-flex items-center gap-2`},Nz=`__all__`,Pz=k({__name:`TaskLogFilters`,props:{filters:{},stages:{}},emits:[`filter`],setup(e,{emit:t}){let n=e,r=t,i=I(()=>nw.map(e=>({value:e.value||Nz,label:e.label}))),a=I(()=>n.filters.level||Nz),o=I(()=>n.filters.stage||Nz);function s(e){r(`filter`,{...n.filters,...e})}function c(e){s({level:String(e)===Nz?``:String(e)})}function l(e){s({stage:String(e)===Nz?``:String(e)})}return(t,n)=>(R(),W(`div`,Az,[U(`div`,jz,[M(z(xl),{"model-value":a.value,"aria-label":`Filter log entries by level`,"onUpdate:modelValue":c},{default:j(()=>[M(z(Ol),{size:`sm`},{default:j(()=>[M(z(kl))]),_:1}),M(z(Sl),null,{default:j(()=>[M(z(Cl),null,{default:j(()=>[(R(!0),W(V,null,G(i.value,e=>(R(),K(z(Tl),{key:e.value,value:e.value},{default:j(()=>[A(B(e.label),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`model-value`])]),U(`div`,Mz,[M(z(xl),{"model-value":o.value,"aria-label":`Filter log entries by stage`,"onUpdate:modelValue":l},{default:j(()=>[M(z(Ol),{size:`sm`},{default:j(()=>[M(z(kl))]),_:1}),M(z(Sl),null,{default:j(()=>[M(z(Cl),null,{default:j(()=>[M(z(Tl),{value:Nz},{default:j(()=>[...n[0]||=[A(`All stages`,-1)]]),_:1}),(R(!0),W(V,null,G(e.stages,e=>(R(),K(z(Tl),{key:e,value:e},{default:j(()=>[A(B(e),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`model-value`])])]))}}),Fz={class:`sr-only`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`},Iz={key:2,class:`flex flex-col items-start gap-2 py-3`},Lz={key:0,class:`mt-2 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 Hj.get()},set promptLabel(e){Hj.set(e)},get tooMuchOutput(){return Wj.get()},set tooMuchOutput(e){Wj.set(e)}}}_verifyIntegers(...e){for(Tz of e)if(Tz===1/0||isNaN(Tz)||Tz%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(Tz of e)if(Tz&&(Tz===1/0||isNaN(Tz)||Tz%1!=0||Tz<0))throw Error(`This API only accepts positive integers`)}},Dz=2,Oz=1,kz=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(Dz,Math.floor(u/e.css.cell.width)),rows:Math.max(Oz,Math.floor(l/e.css.cell.height))}}},Az={class:`flex h-[32rem] min-h-0 flex-col gap-2`},jz={key:0,class:`text-sm text-muted-foreground`,role:`status`},Mz=k({__name:`SandboxView`,props:{taskId:{},attempt:{}},setup(e){let t=e,n=q(null),r=q(`connecting`),i=null,a=null,o=null,s=null;function c(){try{o?.fit()}catch{}}return vt(()=>{let e=n.value;if(!e)return;i=new Ez({convertEol:!0,disableStdin:!0,cursorBlink:!1,fontFamily:`'IBM Plex Mono', ui-monospace, monospace`,fontSize:13,theme:{background:`#0b0f14`,foreground:`#e6edf3`}}),o=new kz,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)}),dt(()=>{s?.disconnect(),s=null,a?.close(),a=null,i?.dispose(),i=null,o=null}),(e,t)=>(R(),W(`div`,Az,[r.value===`open`?L(``,!0):(R(),W(`p`,jz,[r.value===`connecting`?(R(),W(V,{key:0},[A(`Connecting…`)],64)):r.value===`closed`?(R(),W(V,{key:1},[A(`The sandbox view ended.`)],64)):(R(),W(V,{key:2},[A(`The sandbox view is unavailable.`)],64))])),U(`div`,{ref_key:`host`,ref:n,class:`min-h-0 flex-1 overflow-hidden rounded-md border border-border bg-[#0b0f14] p-2`},null,512)]))}}),Nz={class:`flex flex-wrap items-center gap-3 border-b border-border pb-3`},Pz={class:`inline-flex items-center gap-2`},Fz={class:`inline-flex items-center gap-2`},Iz=`__all__`,Lz=k({__name:`TaskLogFilters`,props:{filters:{},stages:{}},emits:[`filter`],setup(e,{emit:t}){let n=e,r=t,i=I(()=>ow.map(e=>({value:e.value||Iz,label:e.label}))),a=I(()=>n.filters.level||Iz),o=I(()=>n.filters.stage||Iz);function s(e){r(`filter`,{...n.filters,...e})}function c(e){s({level:String(e)===Iz?``:String(e)})}function l(e){s({stage:String(e)===Iz?``:String(e)})}return(t,n)=>(R(),W(`div`,Nz,[U(`div`,Pz,[M(z(Sl),{"model-value":a.value,"aria-label":`Filter log entries by level`,"onUpdate:modelValue":c},{default:j(()=>[M(z(kl),{size:`sm`},{default:j(()=>[M(z(Al))]),_:1}),M(z(Cl),null,{default:j(()=>[M(z(wl),null,{default:j(()=>[(R(!0),W(V,null,G(i.value,e=>(R(),K(z(El),{key:e.value,value:e.value},{default:j(()=>[A(B(e.label),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`model-value`])]),U(`div`,Fz,[M(z(Sl),{"model-value":o.value,"aria-label":`Filter log entries by stage`,"onUpdate:modelValue":l},{default:j(()=>[M(z(kl),{size:`sm`},{default:j(()=>[M(z(Al))]),_:1}),M(z(Cl),null,{default:j(()=>[M(z(wl),null,{default:j(()=>[M(z(El),{value:Iz},{default:j(()=>[...n[0]||=[A(`All stages`,-1)]]),_:1}),(R(!0),W(V,null,G(e.stages,e=>(R(),K(z(El),{key:e,value:e},{default:j(()=>[A(B(e),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`model-value`])])]))}}),Rz={class:`sr-only`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`},zz={key:2,class:`flex flex-col items-start gap-2 py-3`},Bz={key:0,class:`mt-2 Line truncated
`)}};eG.defaultYaml={explicit:!1,version:`1.2`},eG.defaultTags={"!!":`tag:yaml.org,2002:`};function tG(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 nG(e){let t=new Set;return qW(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function rG(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function iG(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=nG(e);let a=rG(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(zW(t.node)||VW(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 aG(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=aG(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=aG(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=aG(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=aG(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function oG(e,t,n){if(Array.isArray(e))return e.map((e,t)=>oG(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!UW(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 sG=class{constructor(e){Object.defineProperty(this,PW,{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(!IW(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=oG(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?aG(i,{"":o},``,o):o}},cG=class extends sG{constructor(e){super(OW),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],qW(e,{Node:(e,t)=>{(FW(t)||UW(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||=(oG(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=lG(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(tG(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 lG(e,t,n){if(FW(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(VW(t)){let r=0;for(let i of t.items){let t=lG(e,i,n);t>r&&(r=t)}return r}if(RW(t)){let r=lG(e,t.key,n),i=lG(e,t.value,n);return Math.max(r,i)}return 1}var uG=e=>!e||typeof e!=`function`&&typeof e!=`object`,dG=class extends sG{constructor(e){super(MW),this.value=e}toJSON(e,t){return t?.keep?this.value:oG(this.value,e,t)}toString(){return String(this.value)}};dG.BLOCK_FOLDED=`BLOCK_FOLDED`,dG.BLOCK_LITERAL=`BLOCK_LITERAL`,dG.PLAIN=`PLAIN`,dG.QUOTE_DOUBLE=`QUOTE_DOUBLE`,dG.QUOTE_SINGLE=`QUOTE_SINGLE`;var fG=`tag:yaml.org,2002:`;function pG(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 mG(e,t,n){if(IW(e)&&(e=e.contents),HW(e))return e;if(RW(e)){let t=n.schema[AW].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 cG(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=fG+t.slice(2));let l=pG(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new dG(e);return c&&(c.node=t),t Line truncated `)}};iG.defaultYaml={explicit:!1,version:`1.2`},iG.defaultTags={"!!":`tag:yaml.org,2002:`};function aG(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 oG(e){let t=new Set;return ZW(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function sG(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function cG(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=oG(e);let a=sG(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(UW(t.node)||GW(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 lG(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=lG(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=lG(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=lG(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=lG(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function uG(e,t,n){if(Array.isArray(e))return e.map((e,t)=>uG(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!qW(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 dG=class{constructor(e){Object.defineProperty(this,RW,{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(!BW(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=uG(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?lG(i,{"":o},``,o):o}},fG=class extends dG{constructor(e){super(MW),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=[],ZW(e,{Node:(e,t)=>{(zW(t)||qW(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||=(uG(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=pG(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(aG(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 pG(e,t,n){if(zW(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(GW(t)){let r=0;for(let i of t.items){let t=pG(e,i,n);t>r&&(r=t)}return r}if(HW(t)){let r=pG(e,t.key,n),i=pG(e,t.value,n);return Math.max(r,i)}return 1}var mG=e=>!e||typeof e!=`function`&&typeof e!=`object`,hG=class extends dG{constructor(e){super(IW),this.value=e}toJSON(e,t){return t?.keep?this.value:uG(this.value,e,t)}toString(){return String(this.value)}};hG.BLOCK_FOLDED=`BLOCK_FOLDED`,hG.BLOCK_LITERAL=`BLOCK_LITERAL`,hG.PLAIN=`PLAIN`,hG.QUOTE_DOUBLE=`QUOTE_DOUBLE`,hG.QUOTE_SINGLE=`QUOTE_SINGLE`;var gG=`tag:yaml.org,2002:`;function _G(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 vG(e,t,n){if(BW(e)&&(e=e.contents),KW(e))return e;if(HW(e)){let t=n.schema[PW].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 fG(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=gG+t.slice(2));let l=_G(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new hG(e);return c&&(c.node=t),t Line truncated
`)?yG(n,t):n.includes(` `)?CG(n,t):n.includes(`
`)?` `)?`
`+yG(n,t):(e.endsWith(` `)?``:` `)+n,xG=`flow`,SG=`block`,CG=`quoted`;function wG(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=TG(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===` `+CG(n,t):(e.endsWith(` `)?``:` `)+n,TG=`flow`,EG=`block`,DG=`quoted`;function OG(e,t,n=`flow`,{indentAtStart:r,lineWidth:i=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!i||i<0)return e;i<a&&(a=0);let c=Math.max(1+a,1+i-t.length);if(e.length<=c)return e;let l=[],u={},d=i-t.length;typeof r==`number`&&(r>i-Math.max(2,a)?l.push(0):d=i-r);let f,p,m=!1,h=-1,g=-1,_=-1;n===`block`&&(h=kG(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=TG(e,h,t.length)),d=h+t.length+c,f=void 0;else{if(r===` `&&p&&p!==` `&&p!==` `)n===`block`&&(h=kG(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!==` `&&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 TG(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!==` `&&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 kG(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 EG=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),DG=e=>/^(%|---|\.\.\.)/m.test(e);function OG(e,t,n){if(!t||t<0)return!1;let r=t-n,i=e.length;if(i<=r)return!1;for(let t=0,n=0;t<i;++t)if(e[t]===` `);r=t,i=t+1,a=e[i]}return r}var AG=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),jG=e=>/^(%|---|\.\.\.)/m.test(e);function MG(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 kG(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(DG(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)+` `){if(t-n>r)return!0;if(n=t+1,i-n<=r)return!1}return!0}function NG(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(jG(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+=` `;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:wG(o,a,CG,EG(t,!1))}function AG(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(` `,e+=2;o+=a,n[e+2]===` `&&(o+=`\\`),e+=1,s=e+1}break;default:e+=1}return o=s?o+n.slice(s):n,r?o:OG(o,a,DG,AG(t,!1))}function PG(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
`)||/[ \t]\n|\n[ \t]/.test(e))return kG(e,t);let n=t.indent||(DG(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:wG(r,n,xG,EG(t,!1))}function jG(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=kG;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?AG:i&&!t?kG:n?AG:kG}return r(e,t)}var MG;try{MG=RegExp(`(^|(?<! `)||/[ \t]\n|\n[ \t]/.test(e))return NG(e,t);let n=t.indent||(jG(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:OG(r,n,TG,AG(t,!1))}function FG(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=NG;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?PG:i&&!t?NG:n?PG:NG}return r(e,t)}var IG;try{IG=RegExp(`(^|(?<!
)) ))
+(?! +(?!
|$)`,`g`)}catch{MG=/\n+(?!\n|$)/g}function NG({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 jG(n,r);let l=r.indent||(r.forceBlockIndent||DG(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===dG.BLOCK_FOLDED?!1:t===dG.BLOCK_LITERAL||!OG(n,c,l.length);if(!n)return u?`| |$)`,`g`)}catch{IG=/\n+(?!\n|$)/g}function LG({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 FG(n,r);let l=r.indent||(r.forceBlockIndent||jG(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===hG.BLOCK_FOLDED?!1:t===hG.BLOCK_LITERAL||!MG(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!==` `;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(` `&&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]===` `);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(MG,`$&${l}`));let h=!1,g,_=-1;for(g=0;g<n.length;++g){let e=n[g];if(e===` `)h=!0;else if(e===` `&&(p=p.slice(0,-1)),p.replace(IG,`$&${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,` `)_=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=EG(r,!0);o!==`folded`&&t!==dG.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=wG(`${v}${e}${p}`,l,SG,a);if(!i)return`>${y}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${y}\n${l}${v}${n}${p}`}function PG(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(` $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\n+/g,`$&${l}`),i=!1,a=AG(r,!0);o!==`folded`&&t!==hG.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=OG(`${v}${e}${p}`,l,EG,a);if(!i)return`>${y}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${y}\n${l}${v}${n}${p}`}function RG(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 jG(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(` `)||u&&/[[\]{},]/.test(a))return FG(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
`)?jG(a,t):NG(e,t,n,r);if(!s&&!u&&i!==dG.PLAIN&&a.includes(` `)?FG(a,t):LG(e,t,n,r);if(!s&&!u&&i!==hG.PLAIN&&a.includes(`
`))return NG(e,t,n,r);if(DG(a)){if(c===``)return t.forceBlockIndent=!0,NG(e,t,n,r);if(s&&c===l)return jG(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 jG(a,t)}return s?d:wG(d,c,xG,EG(t,!1))}function FG(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!==dG.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=dG.QUOTE_DOUBLE);let c=e=>{switch(e){case dG.BLOCK_FOLDED:case dG.BLOCK_LITERAL:return i||a?jG(o.value,t):NG(o,t,n,r);case dG.QUOTE_DOUBLE:return kG(o.value,t);case dG.QUOTE_SINGLE:return AG(o.value,t);case dG.PLAIN:return PG(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 IG(e,t){let n=Object.assign({blockQuote:!0,commentString:vG,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 LG(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(zW(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 RG(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(zW(e)||VW(e))&&e.anchor;a&&tG(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 zG(e,t,n,r){if(RW(e))return e.toString(t,n,r);if(FW(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=HW(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=LG(t.doc.schema.tags,a);let o=RG(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):zW(a)?FG(a,t,n,r):a.toString(t,n,r);return o?zW(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function BG({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=HW(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(VW(e)||!HW(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||VW(e)||(zW(e)?e.type===dG.BLOCK_FOLDED||e.type===dG.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=zG(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+=bG(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=bG(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=bG(g,n.indent,l(f))));let _,v,y;HW(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&&zW(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&BW(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let b=!1,x=zG(t,n,()=>b=!0,()=>h=!0),S=` `;if(f||_||v){if(S=_?` `))return LG(e,t,n,r);if(jG(a)){if(c===``)return t.forceBlockIndent=!0,LG(e,t,n,r);if(s&&c===l)return FG(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 FG(a,t)}return s?d:OG(d,c,TG,AG(t,!1))}function zG(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!==hG.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=hG.QUOTE_DOUBLE);let c=e=>{switch(e){case hG.BLOCK_FOLDED:case hG.BLOCK_LITERAL:return i||a?FG(o.value,t):LG(o,t,n,r);case hG.QUOTE_DOUBLE:return NG(o.value,t);case hG.QUOTE_SINGLE:return PG(o.value,t);case hG.PLAIN:return RG(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 BG(e,t){let n=Object.assign({blockQuote:!0,commentString:SG,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 VG(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(UW(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 HG(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(UW(e)||GW(e))&&e.anchor;a&&aG(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 UG(e,t,n,r){if(HW(e))return e.toString(t,n,r);if(zW(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=KW(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=VG(t.doc.schema.tags,a);let o=HG(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):UW(a)?zG(a,t,n,r):a.toString(t,n,r);return o?UW(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function WG({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=KW(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(GW(e)||!KW(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||GW(e)||(UW(e)?e.type===hG.BLOCK_FOLDED||e.type===hG.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=UG(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+=wG(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=wG(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=wG(g,n.indent,l(f))));let _,v,y;KW(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&&UW(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&WW(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let b=!1,x=UG(t,n,()=>b=!0,()=>h=!0),S=` `;if(f||_||v){if(S=_?`
`:``,v){let e=l(v);S+=`\n${yG(e,n.indent)}`}x===``&&!n.inFlow?S===` `:``,v){let e=l(v);S+=`\n${CG(e,n.indent)}`}x===``&&!n.inFlow?S===`
`&&y&&(S=` `&&y&&(S=`
`):S+=`\n${n.indent}`}else if(!p&&VW(t)){let e=x[0],r=x.indexOf(` `):S+=`\n${n.indent}`}else if(!p&&GW(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]===` `),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+=bG(g,n.indent,l(y)):h&&i&&i(),g}function VG(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}var HG=`<<`,UG={identify:e=>e===HG||typeof e==`symbol`&&e.description===HG,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new dG(Symbol(HG)),{addToJSMap:GG}),stringify:()=>HG},WG=(e,t)=>(UG.identify(t)||zW(t)&&(!t.type||t.type===dG.PLAIN)&&UG.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===UG.tag&&e.default);function GG(e,t,n){let r=qG(e,n);if(BW(r))for(let n of r.items)KG(e,t,n);else if(Array.isArray(r))for(let n of r)KG(e,t,n);else KG(e,t,r)}function KG(e,t,n){let r=qG(e,n);if(!LW(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 qG(e,t){return e&&FW(t)?t.resolve(e.doc,e):t}function JG(e,t,{key:n,value:r}){if(HW(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(WG(e,n))GG(e,t,r);else{let i=oG(n,``,e);if(t instanceof Map)t.set(i,oG(r,i,e));else if(t instanceof Set)t.add(i);else{let a=YG(n,i,e),o=oG(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function YG(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(HW(e)&&n?.doc){let t=IG(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)+`..."`),VG(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 XG(e,t,n){return new ZG(mG(e,void 0,n),mG(t,void 0,n))}var ZG=class e{constructor(e,t=null){Object.defineProperty(this,PW,{value:jW}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return HW(n)&&(n=n.clone(t)),HW(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return JG(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?BG(this,e,t,n):JSON.stringify(this)}};function QG(e,t,n){return(t.inFlow??e.flow?eK:$G)(e,t,n)}function $G({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(HW(i))!d&&i.spaceBefore&&f.push(``),tK(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(RW(i)){let e=HW(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),tK(n,f,e.commentBefore,d))}d=!1;let s=zG(i,u,()=>o=null,()=>d=!0);o&&(s+=bG(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+=wG(g,n.indent,l(y)):h&&i&&i(),g}function GG(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}var KG=`<<`,qG={identify:e=>e===KG||typeof e==`symbol`&&e.description===KG,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new hG(Symbol(KG)),{addToJSMap:YG}),stringify:()=>KG},JG=(e,t)=>(qG.identify(t)||UW(t)&&(!t.type||t.type===hG.PLAIN)&&qG.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===qG.tag&&e.default);function YG(e,t,n){let r=ZG(e,n);if(WW(r))for(let n of r.items)XG(e,t,n);else if(Array.isArray(r))for(let n of r)XG(e,t,n);else XG(e,t,r)}function XG(e,t,n){let r=ZG(e,n);if(!VW(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 ZG(e,t){return e&&zW(t)?t.resolve(e.doc,e):t}function QG(e,t,{key:n,value:r}){if(KW(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(JG(e,n))YG(e,t,r);else{let i=uG(n,``,e);if(t instanceof Map)t.set(i,uG(r,i,e));else if(t instanceof Set)t.add(i);else{let a=$G(n,i,e),o=uG(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function $G(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(KW(e)&&n?.doc){let t=BG(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)+`..."`),GG(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 eK(e,t,n){return new tK(vG(e,void 0,n),vG(t,void 0,n))}var tK=class e{constructor(e,t=null){Object.defineProperty(this,RW,{value:FW}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return KW(n)&&(n=n.clone(t)),KW(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return QG(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?WG(this,e,t,n):JSON.stringify(this)}};function nK(e,t,n){return(t.inFlow??e.flow?iK:rK)(e,t,n)}function rK({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(KW(i))!d&&i.spaceBefore&&f.push(``),aK(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(HW(i)){let e=KW(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),aK(n,f,e.commentBefore,d))}d=!1;let s=UG(i,u,()=>o=null,()=>d=!0);o&&(s+=wG(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+=` `}}return e?(p+=`
`+yG(l(e),c),s&&s()):d&&o&&o(),p}function eK({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(HW(i))i.spaceBefore&&d.push(``),tK(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(RW(i)){let e=HW(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),tK(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=HW(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=zG(i,c,()=>a=null);l||=d.length>u||o.includes(` `+CG(l(e),c),s&&s()):d&&o&&o(),p}function iK({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(KW(i))i.spaceBefore&&d.push(``),aK(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(HW(i)){let e=KW(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),aK(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=KW(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=UG(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+=bG(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}`:` `),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+=wG(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 tK({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=yG(t(r),e);n.push(i.trimStart())}}function nK(e,t){let n=zW(t)?t.value:t;for(let r of e)if(RW(r)&&(r.key===t||r.key===n||zW(r.key)&&r.key.value===n))return r}var rK=class extends _G{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(AW,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(XG(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=RW(e)?e:!e||typeof e!=`object`||!(`key`in e)?new ZG(e,e?.value):new ZG(e.key,e.value);let r=nK(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);zW(r.value)&&uG(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=nK(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=nK(this.items,e)?.value;return(!t&&zW(n)?n.value:n)??void 0}has(e){return!!nK(this.items,e)}set(e,t){this.add(new ZG(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)JG(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!RW(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})),QG(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},iK={collection:`map`,default:!0,nodeClass:rK,tag:`tag:yaml.org,2002:map`,resolve(e,t){return LW(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>rK.from(e,t,n)},aK=class extends _G{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(NW,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=oK(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=oK(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&zW(r)?r.value:r}has(e){let t=oK(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=oK(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];zW(r)&&uG(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(oG(e,String(r++),t));return n}toString(e,t,n){return e?QG(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(mG(a,void 0,n))}}return i}};function oK(e){let t=zW(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var sK={collection:`seq`,default:!0,nodeClass:aK,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return BW(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>aK.from(e,t,n)},cK={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),FG(e,t,n,r)}},lK={identify:e=>e==null,createNode:()=>new dG(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new dG(null),stringify:({source:e},t)=>typeof e==`string`&&lK.test.test(e)?e:t.options.nullStr},uK={identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new dG(e[0]===`t`||e[0]===`T`),stringify({source:e,value:t},n){return e&&uK.test.test(e)&&t===(e[0]===`t`||e[0]===`T`)?e:t?n.options.trueStr:n.options.falseStr}};function dK({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 fK={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:dK},pK={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`${e}\n${i}${p}`}return`${f}${o}${d.join(` `)}${o}${p}`}function aK({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=CG(t(r),e);n.push(i.trimStart())}}function oK(e,t){let n=UW(t)?t.value:t;for(let r of e)if(HW(r)&&(r.key===t||r.key===n||UW(r.key)&&r.key.value===n))return r}var sK=class extends xG{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(PW,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(eK(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=HW(e)?e:!e||typeof e!=`object`||!(`key`in e)?new tK(e,e?.value):new tK(e.key,e.value);let r=oK(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);UW(r.value)&&mG(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=oK(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=oK(this.items,e)?.value;return(!t&&UW(n)?n.value:n)??void 0}has(e){return!!oK(this.items,e)}set(e,t){this.add(new tK(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)QG(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!HW(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})),nK(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},cK={collection:`map`,default:!0,nodeClass:sK,tag:`tag:yaml.org,2002:map`,resolve(e,t){return VW(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>sK.from(e,t,n)},lK=class extends xG{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(LW,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=uK(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=uK(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&UW(r)?r.value:r}has(e){let t=uK(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=uK(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];UW(r)&&mG(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(uG(e,String(r++),t));return n}toString(e,t,n){return e?nK(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(vG(a,void 0,n))}}return i}};function uK(e){let t=UW(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var dK={collection:`seq`,default:!0,nodeClass:lK,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return WW(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>lK.from(e,t,n)},fK={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),zG(e,t,n,r)}},pK={identify:e=>e==null,createNode:()=>new hG(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new hG(null),stringify:({source:e},t)=>typeof e==`string`&&pK.test.test(e)?e:t.options.nullStr},mK={identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new hG(e[0]===`t`||e[0]===`T`),stringify({source:e,value:t},n){return e&&mK.test.test(e)&&t===(e[0]===`t`||e[0]===`T`)?e:t?n.options.trueStr:n.options.falseStr}};function hK({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 gK={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:hK},_K={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 FG({comment:e,type:t,value:s},r,i,a)}};function DK(e,t){if(BW(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!RW(r)){if(LW(r)){r.items.length>1&&t(`Each pair must have its own sequence indicator`);let e=r.items[0]||new ZG(new dG(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]=RW(r)?r:new ZG(r)}}else t(`Expected a sequence for this tag`);return e}function OK(e,t,n){let{replacer:r}=n,i=new aK(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(XG(o,s,n))}return i}var kK={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:DK,createNode:OK},AK=class e extends aK{constructor(){super(),this.add=rK.prototype.add.bind(this),this.delete=rK.prototype.delete.bind(this),this.get=rK.prototype.get.bind(this),this.has=rK.prototype.has.bind(this),this.set=rK.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(RW(e)?(r=oG(e.key,``,t),i=oG(e.value,r,t)):r=oG(e,``,t),n.has(r))throw Error(`Ordered maps must not include duplicate keys`);n.set(r,i)}return n}static from(e,t,n){let r=OK(e,t,n),i=new this;return i.items=r.items,i}};AK.tag=`tag:yaml.org,2002:omap`;var jK={collection:`seq`,identify:e=>e instanceof Map,nodeClass:AK,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,t){let n=DK(e,t),r=[];for(let{key:e}of n.items)zW(e)&&(r.includes(e.value)?t(`Ordered maps must not include duplicate keys: ${e.value}`):r.push(e.value));return Object.assign(new AK,n)},createNode:(e,t,n)=>AK.from(e,t,n)};function MK({value:e,source:t},n){return t&&(e?NK:PK).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var NK={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 dG(!0),stringify:MK},PK={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 dG(!1),stringify:MK},FK={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:dK},IK={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():dK(e)}},LK={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 dG(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:dK},RK=e=>typeof e==`bigint`||Number.isInteger(e);function zK(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 BK(e,t,n){let{value:r}=e;if(RK(r)){let e=r.toString(t);return r<0?`-`+n+e.substr(1):n+e}return dK(e)}var VK={identify:RK,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>zK(e,2,2,n),stringify:e=>BK(e,2,`0b`)},HK={identify:RK,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>zK(e,1,8,n),stringify:e=>BK(e,8,`0`)},UK={identify:RK,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>zK(e,0,10,n),stringify:dK},WK={identify:RK,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>zK(e,2,16,n),stringify:e=>BK(e,16,`0x`)},GK=class e extends rK{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=RW(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new ZG(e.key,null):new ZG(e,null),nK(this.items,t.key)||this.items.push(t)}get(e,t){let n=nK(this.items,e);return!t&&RW(n)?zW(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=nK(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new ZG(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 `:` `)}return zG({comment:e,type:t,value:s},r,i,a)}};function jK(e,t){if(WW(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!HW(r)){if(VW(r)){r.items.length>1&&t(`Each pair must have its own sequence indicator`);let e=r.items[0]||new tK(new hG(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]=HW(r)?r:new tK(r)}}else t(`Expected a sequence for this tag`);return e}function MK(e,t,n){let{replacer:r}=n,i=new lK(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(eK(o,s,n))}return i}var NK={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:jK,createNode:MK},PK=class e extends lK{constructor(){super(),this.add=sK.prototype.add.bind(this),this.delete=sK.prototype.delete.bind(this),this.get=sK.prototype.get.bind(this),this.has=sK.prototype.has.bind(this),this.set=sK.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(HW(e)?(r=uG(e.key,``,t),i=uG(e.value,r,t)):r=uG(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=MK(e,t,n),i=new this;return i.items=r.items,i}};PK.tag=`tag:yaml.org,2002:omap`;var FK={collection:`seq`,identify:e=>e instanceof Map,nodeClass:PK,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,t){let n=jK(e,t),r=[];for(let{key:e}of n.items)UW(e)&&(r.includes(e.value)?t(`Ordered maps must not include duplicate keys: ${e.value}`):r.push(e.value));return Object.assign(new PK,n)},createNode:(e,t,n)=>PK.from(e,t,n)};function IK({value:e,source:t},n){return t&&(e?LK:RK).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var LK={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 hG(!0),stringify:IK},RK={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 hG(!1),stringify:IK},zK={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:hK},BK={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():hK(e)}},VK={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 hG(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:hK},HK=e=>typeof e==`bigint`||Number.isInteger(e);function UK(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 WK(e,t,n){let{value:r}=e;if(HK(r)){let e=r.toString(t);return r<0?`-`+n+e.substr(1):n+e}return hK(e)}var GK={identify:HK,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>UK(e,2,2,n),stringify:e=>WK(e,2,`0b`)},KK={identify:HK,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>UK(e,1,8,n),stringify:e=>WK(e,8,`0`)},qK={identify:HK,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>UK(e,0,10,n),stringify:hK},JK={identify:HK,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>UK(e,2,16,n),stringify:e=>WK(e,16,`0x`)},YK=class e extends sK{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=HW(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new tK(e.key,null):new tK(e,null),oK(this.items,t.key)||this.items.push(t)}get(e,t){let n=oK(this.items,e);return!t&&HW(n)?UW(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=oK(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new tK(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(yG(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(yG(a(t),``)))}return n.join(` `)?(n.push(`...`),n.push(CG(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(CG(a(t),``)))}return n.join(`
`)+` `)+`
`}var oq=class e{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,PW,{value:kW});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 eG({version:a}),this.setSchema(a,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){let t=Object.create(e.prototype,{[PW]:{value:kW}});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=HW(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(e){sq(this.contents)&&this.contents.add(e)}addIn(e,t){sq(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=nG(this);e.anchor=!t||n.has(t)?rG(t||`a`,n):t}return new cG(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}=iG(this,a||`a`),p={aliasDuplicateObjects:i??!0,keepUndefined:s??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:f},m=mG(e,l,p);return o&&VW(m)&&(m.flow=!0),d(),m}createPair(e,t,n={}){return new ZG(this.createNode(e,null,n),this.createNode(t,null,n))}delete(e){return sq(this.contents)?this.contents.delete(e):!1}deleteIn(e){return gG(e)?this.contents!=null&&(this.contents=null,!0):sq(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return VW(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return gG(e)?!t&&zW(this.contents)?this.contents.value:this.contents:VW(this.contents)?this.contents.getIn(e,t):void 0}has(e){return VW(this.contents)?this.contents.has(e):!1}hasIn(e){return gG(e)?this.contents!==void 0:VW(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=hG(this.schema,[e],t):sq(this.contents)&&this.contents.set(e,t)}setIn(e,t){gG(e)?this.contents=t:this.contents==null?this.contents=hG(this.schema,Array.from(e),t):sq(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 eG({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 eG({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 iq(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=oG(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`?aG(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 aq(this,e)}};function sq(e){if(VW(e))return!0;throw Error(`Expected a YAML collection as document contents`)}var cq=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},lq=class extends cq{constructor(e,t,n){super(`YAMLParseError`,e,t,n)}},uq=class extends cq{constructor(e,t,n){super(`YAMLWarning`,e,t,n)}},dq=(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)+`… `}var uq=class e{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,RW,{value:NW});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 iG({version:a}),this.setSchema(a,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){let t=Object.create(e.prototype,{[RW]:{value:NW}});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=KW(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(e){dq(this.contents)&&this.contents.add(e)}addIn(e,t){dq(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=oG(this);e.anchor=!t||n.has(t)?sG(t||`a`,n):t}return new fG(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}=cG(this,a||`a`),p={aliasDuplicateObjects:i??!0,keepUndefined:s??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:f},m=vG(e,l,p);return o&&GW(m)&&(m.flow=!0),d(),m}createPair(e,t,n={}){return new tK(this.createNode(e,null,n),this.createNode(t,null,n))}delete(e){return dq(this.contents)?this.contents.delete(e):!1}deleteIn(e){return bG(e)?this.contents!=null&&(this.contents=null,!0):dq(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return GW(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return bG(e)?!t&&UW(this.contents)?this.contents.value:this.contents:GW(this.contents)?this.contents.getIn(e,t):void 0}has(e){return GW(this.contents)?this.contents.has(e):!1}hasIn(e){return bG(e)?this.contents!==void 0:GW(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=yG(this.schema,[e],t):dq(this.contents)&&this.contents.set(e,t)}setIn(e,t){bG(e)?this.contents=t:this.contents==null?this.contents=yG(this.schema,Array.from(e),t):dq(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 iG({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 iG({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 cq(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=uG(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`?lG(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 lq(this,e)}};function dq(e){if(GW(e))return!0;throw Error(`Expected a YAML collection as document contents`)}var fq=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},pq=class extends fq{constructor(e,t,n){super(`YAMLParseError`,e,t,n)}},mq=class extends fq{constructor(e,t,n){super(`YAMLWarning`,e,t,n)}},hq=(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 fq(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 pq(e){if(!e)return null;switch(e.type){case`alias`:case`scalar`:case`double-quoted-scalar`:case`single-quoted-scalar`:if(e.source.includes(` `),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 gq(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 _q(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(pq(t.key)||pq(t.value))return!0}return!1;default:return!0}}function mq(e,t,n){if(t?.type===`flow-collection`){let r=t.end[0];r.indent===e&&(r.source===`]`||r.source===`}`)&&pq(t)&&n(r,`BAD_INDENT`,`Flow end indicator should be more indented than parent`,!0)}}function hq(e,t,n){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let i=typeof r==`function`?r:(e,t)=>e===t||zW(e)&&zW(t)&&e.value===t.value;return t.some(e=>i(e.key,n))}var gq=`All mapping items must start at the same column`;function _q({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??rK)(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=fq(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`,gq)),!p.anchor&&!p.tag&&!d){c=p.end,p.comment&&(o.comment?o.comment+=` `))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(_q(t.key)||_q(t.value))return!0}return!1;default:return!0}}function vq(e,t,n){if(t?.type===`flow-collection`){let r=t.end[0];r.indent===e&&(r.source===`]`||r.source===`}`)&&_q(t)&&n(r,`BAD_INDENT`,`Flow end indicator should be more indented than parent`,!0)}}function yq(e,t,n){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let i=typeof r==`function`?r:(e,t)=>e===t||UW(e)&&UW(t)&&e.value===t.value;return t.some(e=>i(e.key,n))}var bq=`All mapping items must start at the same column`;function xq({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??sK)(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=gq(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`,bq)),!p.anchor&&!p.tag&&!d){c=p.end,p.comment&&(o.comment?o.comment+=`
`+p.comment:o.comment=p.comment);continue}(p.newlineAfterProp||pq(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`,gq);n.atKey=!0;let h=p.end,g=u?e(n,u,p,i):t(n,h,l,null,p,i);n.schema.compat&&mq(r.indent,u,i),n.atKey=!1,hq(n,o.items,g)&&i(h,`DUPLICATE_KEY`,`Map keys must be unique`);let _=fq(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&&mq(r.indent,f,i),s=c.range[2];let l=new ZG(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+=` `+p.comment:o.comment=p.comment);continue}(p.newlineAfterProp||_q(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`,bq);n.atKey=!0;let h=p.end,g=u?e(n,u,p,i):t(n,h,l,null,p,i);n.schema.compat&&vq(r.indent,u,i),n.atKey=!1,yq(n,o.items,g)&&i(h,`DUPLICATE_KEY`,`Map keys must be unique`);let _=gq(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&&vq(r.indent,f,i),s=c.range[2];let l=new tK(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 ZG(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 vq({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??aK)(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=fq(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&&mq(r.indent,l,i),s=d.range[2],o.items.push(d)}return o.range=[r.offset,s,c??s],o}function yq(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 bq=`Block collections are not allowed within flow collections`,xq=e=>e&&(e.type===`block-map`||e.type===`block-seq`);function Sq({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=r.start.source===`{`,s=o?`flow map`:`flow sequence`,c=new((a?.nodeClass)??(o?rK:aK))(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=fq(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+=` `+_.comment:g.comment=_.comment);let e=new tK(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 Sq({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??lK)(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=gq(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&&vq(r.indent,l,i),s=d.range[2],o.items.push(d)}return o.range=[r.offset,s,c??s],o}function Cq(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 wq=`Block collections are not allowed within flow collections`,Tq=e=>e&&(e.type===`block-map`||e.type===`block-seq`);function Eq({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=r.start.source===`{`,s=o?`flow map`:`flow sequence`,c=new((a?.nodeClass)??(o?sK:lK))(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=gq(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&&pq(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];RW(t)&&(t=t.value??t.key),t.comment?t.comment+=` `+h.comment:c.comment=h.comment),u=h.end;continue}!o&&n.options.strict&&_q(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];HW(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],xq(m)&&i(r.range,`BLOCK_IN_FLOW`,bq)}else{n.atKey=!0;let a=h.end,g=f?e(n,f,h,i):t(n,a,d,null,h,i);xq(f)&&i(g.range,`BLOCK_IN_FLOW`,bq),n.atKey=!1;let _=fq(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?xq(m)&&i(v.range,`BLOCK_IN_FLOW`,bq):_.comment&&(g.comment?g.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],Tq(m)&&i(r.range,`BLOCK_IN_FLOW`,wq)}else{n.atKey=!0;let a=h.end,g=f?e(n,f,h,i):t(n,a,d,null,h,i);Tq(f)&&i(g.range,`BLOCK_IN_FLOW`,wq),n.atKey=!1;let _=gq(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?Tq(m)&&i(v.range,`BLOCK_IN_FLOW`,wq):_.comment&&(g.comment?g.comment+=`
`+_.comment:g.comment=_.comment);let y=new ZG(g,v);if(n.options.keepSourceTokens&&(y.srcToken=l),o){let e=c;hq(n,e.items,g)&&i(a,`DUPLICATE_KEY`,`Map keys must be unique`),e.items.push(y)}else{let e=new rK(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=yq(p,m,n.options.strict,i);e.comment&&(c.comment?c.comment+=` `+_.comment:g.comment=_.comment);let y=new tK(g,v);if(n.options.keepSourceTokens&&(y.srcToken=l),o){let e=c;yq(n,e.items,g)&&i(a,`DUPLICATE_KEY`,`Map keys must be unique`),e.items.push(y)}else{let e=new sK(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=Cq(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 Cq(e,t,n,r,i,a){let o=n.type===`block-map`?_q(e,t,n,r,a):n.type===`block-seq`?vq(e,t,n,r,a):Sq(e,t,n,r,a),s=o.constructor;return i===`!`||i===s.tagName?(o.tag=s.tagName,o):(i&&(o.tag=i),o)}function wq(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===rK.tagName&&s===`map`||o===aK.tagName&&s===`seq`)return Cq(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),Cq(e,t,n,i,o)}let l=Cq(e,t,n,i,o,c),u=c.resolve?.(l,e=>i(a,`TAG_RESOLVE_FAILED`,e),t.options)??l,d=HW(u)?u:new dG(u);return d.range=l.range,d.tag=o,c?.format&&(d.format=c.format),d}function Tq(e,t,n){let r=t.offset,i=Eq(t,e.options.strict,n);if(!i)return{value:``,type:null,comment:``,range:[r,r,r]};let a=i.mode===`>`?dG.BLOCK_FOLDED:dG.BLOCK_LITERAL,o=t.source?Dq(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?` `+e.comment:c.comment=e.comment),c.range=[r.offset,m,e.offset]}else c.range=[r.offset,m,m];return c}function Dq(e,t,n,r,i,a){let o=n.type===`block-map`?xq(e,t,n,r,a):n.type===`block-seq`?Sq(e,t,n,r,a):Eq(e,t,n,r,a),s=o.constructor;return i===`!`||i===s.tagName?(o.tag=s.tagName,o):(i&&(o.tag=i),o)}function Oq(e,t,n,r,i){let a=r.tag,o=a?t.directives.tagName(a.source,e=>i(a,`TAG_RESOLVE_FAILED`,e)):null;if(n.type===`block-seq`){let{anchor:e,newlineAfterProp:t}=r,n=e&&a?e.offset>a.offset?e:a:e??a;n&&(!t||t.offset<n.offset)&&i(n,`MISSING_CHAR`,`Missing newline after block sequence props`)}let s=n.type===`block-map`?`map`:n.type===`block-seq`?`seq`:n.start.source===`{`?`map`:`seq`;if(!a||!o||o===`!`||o===sK.tagName&&s===`map`||o===lK.tagName&&s===`seq`)return Dq(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),Dq(e,t,n,i,o)}let l=Dq(e,t,n,i,o,c),u=c.resolve?.(l,e=>i(a,`TAG_RESOLVE_FAILED`,e),t.options)??l,d=KW(u)?u:new hG(u);return d.range=l.range,d.tag=o,c?.format&&(d.format=c.format),d}function kq(e,t,n){let r=t.offset,i=Aq(t,e.options.strict,n);if(!i)return{value:``,type:null,comment:``,range:[r,r,r]};let a=i.mode===`>`?hG.BLOCK_FOLDED:hG.BLOCK_LITERAL,o=t.source?jq(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)+` `.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===dG.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===hG.BLOCK_LITERAL?(d+=f+t.slice(c)+r,f=`
`):t.length>c||r[0]===` `?(f===` `?f=` `):t.length>c||r[0]===` `?(f===` `?f=`
`:!p&&f===` `:!p&&f===`
`&&(f=` `&&(f=`
@@ -86,59 +86,59 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
`+o[e][0].slice(c);d[d.length-1]!==` `+o[e][0].slice(c);d[d.length-1]!==`
`&&(d+=` `&&(d+=`
`);break;default: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 Eq({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 Dq(e){let t=e.split(/\n( *)/),n=t[0],r=n.match(/^( *)/),i=[r?.[1]?[r[1],n.slice(r[1].length)]:[``,n]];for(let e=1;e<t.length;e+=2)i.push([t[e],t[e+1]]);return i}function Oq(e,t,n){let{offset:r,type:i,source:a,end:o}=e,s,c,l=(e,t,i)=>n(r+e,t,i);switch(i){case`scalar`:s=dG.PLAIN,c=kq(a,l);break;case`single-quoted-scalar`:s=dG.QUOTE_SINGLE,c=Aq(a,l);break;case`double-quoted-scalar`:s=dG.QUOTE_DOUBLE,c=Mq(a,l);break;default:return n(e,`UNEXPECTED_TOKEN`,`Expected a flow scalar value, but found: ${i}`),{value:``,type:null,comment:``,range:[r,r+a.length,r+a.length]}}let u=r+a.length,d=yq(o,u,t,n);return{value:c,type:s,comment:d.comment,range:[r,u,d.offset]}}function kq(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}`),jq(e)}function Aq(e,t){return(e[e.length-1]!==`'`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing 'quote`),jq(e.slice(1,-1)).replace(/''/g,`'`)}function jq(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 Aq({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 jq(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 Mq(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=hG.PLAIN,c=Nq(a,l);break;case`single-quoted-scalar`:s=hG.QUOTE_SINGLE,c=Pq(a,l);break;case`double-quoted-scalar`:s=hG.QUOTE_DOUBLE,c=Iq(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=Cq(o,u,t,n);return{value:c,type:s,comment:d.comment,range:[r,u,d.offset]}}function Nq(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}`),Fq(e)}function Pq(e,t){return(e[e.length-1]!==`'`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing 'quote`),Fq(e.slice(1,-1)).replace(/''/g,`'`)}function Fq(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: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 Mq(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 Iq(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===` `){if(i===`
`){let{fold:t,offset:i}=Nq(e,r);n+=t,r=i}else if(i===`\\`){let i=e[++r],a=Pq[i];if(a)n+=a;else if(i===` `){let{fold:t,offset:i}=Lq(e,r);n+=t,r=i}else if(i===`\\`){let i=e[++r],a=Dee[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===`\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+=Fq(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+=Rq(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]!==` `&&(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 Nq(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 Lq(e,t){let n=``,r=e[t+1];for(;(r===` `||r===` `||r===`
`||r===`\r`)&&(r!==`\r`||e[t+2]===` `||r===`\r`)&&(r!==`\r`||e[t+2]===`
`);)r===` `);)r===`
`&&(n+=` `&&(n+=`
`),t+=1,r=e[t+1];return n||=` `,{fold:n,offset:t}}var Pq={0:`\0`,a:`\x07`,b:`\b`,e:`\x1B`,f:`\f`,n:` `),t+=1,r=e[t+1];return n||=` `,{fold:n,offset:t}}var Dee={0:`\0`,a:`\x07`,b:`\b`,e:`\x1B`,f:`\f`,n:`
`,r:`\r`,t:` `,v:`\v`,N:`…`,_:`\xA0`,L:`\u2028`,P:`\u2029`," ":` `,'"':`"`,"/":`/`,"\\":`\\`," ":` `};function Fq(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 Iq(e,t,n,r){let{value:i,type:a,comment:o,range:s}=t.type===`block-scalar`?Tq(e,t,r):Oq(t,e.options.strict,r),c=n?e.directives.tagName(n.source,e=>r(n,`TAG_RESOLVE_FAILED`,e)):null,l;l=e.options.stringKeys&&e.atKey?e.schema[MW]:c?Lq(e.schema,i,c,n,r):t.type===`scalar`?Rq(e,i,t,r):e.schema[MW];let u;try{let a=l.resolve(i,e=>r(n??t,`TAG_RESOLVE_FAILED`,e),e.options);u=zW(a)?a:new dG(a)}catch(e){let a=e instanceof Error?e.message:String(e);r(n??t,`TAG_RESOLVE_FAILED`,a),u=new dG(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 Lq(e,t,n,r,i){if(n===`!`)return e[MW];let a=[];for(let t of e.tags)if(!t.collection&&t.tag===n){if(t.default&&t.test)a.push(t);else return t}for(let e of a)if(e.test?.test(t))return e;let o=e.knownTags[n];return o&&!o.collection?(e.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(i(r,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${n}`,n!==`tag:yaml.org,2002:str`),e[MW])}function Rq({atKey:e,directives:t,schema:n},r,i,a){let o=n.tags.find(t=>(t.default===!0||e&&t.default===`key`)&&t.test?.test(r))||n[MW];if(n.compat){let e=n.compat.find(e=>e.default&&e.test?.test(r))??n[MW];o.tag!==e.tag&&a(i,`TAG_RESOLVE_FAILED`,`Value may be parsed as either ${t.tagString(o.tag)} or ${t.tagString(e.tag)}`,!0)}return o}function zq(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 Bq={composeNode:Vq,composeEmptyNode:Hq};function Vq(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=Uq(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=Iq(e,t,c,r),s&&(l.anchor=s.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:try{l=wq(Bq,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??=Hq(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&&(!zW(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 Hq(e,t,n,r,{spaceBefore:i,comment:a,anchor:o,tag:s,end:c},l){let u=Iq(e,{type:`scalar`,offset:zq(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 Uq({options:e},{offset:t,source:n,end:r},i){let a=new cG(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=yq(r,o,e.strict,i);return a.range=[t,o,s.offset],s.comment&&(a.comment=s.comment),a}function Wq(e,t,{offset:n,start:r,value:i,end:a},o){let s=new oq(void 0,Object.assign({_directives:t},e)),c={atKey:!1,atRoot:!0,directives:s.directives,options:s.options,schema:s.schema},l=fq(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?Vq(c,i,l,o):Hq(c,l.end,r,null,l,o);let u=s.contents.range[2],d=yq(a,u,!1,o);return d.comment&&(s.comment=d.comment),s.range=[n,u,d.offset],s}function Gq(e){if(typeof e==`number`)return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:n}=e;return[t,t+(typeof n==`string`?n.length:1)]}function Kq(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?` `,r:`\r`,t:` `,v:`\v`,N:`…`,_:`\xA0`,L:`\u2028`,P:`\u2029`," ":` `,'"':`"`,"/":`/`,"\\":`\\`," ":` `};function Rq(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 zq(e,t,n,r){let{value:i,type:a,comment:o,range:s}=t.type===`block-scalar`?kq(e,t,r):Mq(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[IW]:c?Bq(e.schema,i,c,n,r):t.type===`scalar`?Vq(e,i,t,r):e.schema[IW];let u;try{let a=l.resolve(i,e=>r(n??t,`TAG_RESOLVE_FAILED`,e),e.options);u=UW(a)?a:new hG(a)}catch(e){let a=e instanceof Error?e.message:String(e);r(n??t,`TAG_RESOLVE_FAILED`,a),u=new hG(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 Bq(e,t,n,r,i){if(n===`!`)return e[IW];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[IW])}function Vq({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[IW];if(n.compat){let e=n.compat.find(e=>e.default&&e.test?.test(r))??n[IW];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 Hq(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 Uq={composeNode:Wq,composeEmptyNode:Gq};function Wq(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=Kq(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=zq(e,t,c,r),s&&(l.anchor=s.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:try{l=Oq(Uq,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??=Gq(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&&(!UW(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 Gq(e,t,n,r,{spaceBefore:i,comment:a,anchor:o,tag:s,end:c},l){let u=zq(e,{type:`scalar`,offset:Hq(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 Kq({options:e},{offset:t,source:n,end:r},i){let a=new fG(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=Cq(r,o,e.strict,i);return a.range=[t,o,s.offset],s.comment&&(a.comment=s.comment),a}function qq(e,t,{offset:n,start:r,value:i,end:a},o){let s=new uq(void 0,Object.assign({_directives:t},e)),c={atKey:!1,atRoot:!0,directives:s.directives,options:s.options,schema:s.schema},l=gq(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?Wq(c,i,l,o):Gq(c,l.end,r,null,l,o);let u=s.contents.range[2],d=Cq(a,u,!1,o);return d.comment&&(s.comment=d.comment),s.range=[n,u,d.offset],s}function Jq(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 Yq(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 qq=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,n,r)=>{let i=Gq(e);r?this.warnings.push(new uq(i,t,n)):this.errors.push(new lq(i,t,n))},this.directives=new eG({version:e.version||`1.2`}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=Kq(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(VW(i)&&!i.flow&&i.items.length>0){let e=i.items[0];RW(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:Kq(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,n=-1){for(let t of e)yield*this.next(t);yield*this.end(t,n)}*next(e){switch(e.type){case`directive`:this.directives.add(e.source,(t,n,r)=>{let i=Gq(e);i[0]+=t,this.onError(i,`BAD_DIRECTIVE`,n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case`document`:{let t=Wq(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 lq(Gq(e),`UNEXPECTED_TOKEN`,t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case`doc-end`:{if(!this.doc){this.errors.push(new lq(Gq(e),`UNEXPECTED_TOKEN`,`Unexpected doc-end without preceding document`));break}this.doc.directives.docEnd=!0;let t=yq(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 lq(Gq(e),`UNEXPECTED_TOKEN`,`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let e=new oq(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}}},Jq=Symbol(`break visit`),Yq=Symbol(`skip children`),Xq=Symbol(`remove item`);function Zq(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),Qq(Object.freeze([]),e,t)}Zq.BREAK=Jq,Zq.SKIP=Yq,Zq.REMOVE=Xq,Zq.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},Zq.parentCollection=(e,t)=>{let n=Zq.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 Qq(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=Qq(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===Jq)return Jq;else r===Xq&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}function $q(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 Xq=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,n,r)=>{let i=Jq(e);r?this.warnings.push(new mq(i,t,n)):this.errors.push(new pq(i,t,n))},this.directives=new iG({version:e.version||`1.2`}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=Yq(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(GW(i)&&!i.flow&&i.items.length>0){let e=i.items[0];HW(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:Yq(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=Jq(e);i[0]+=t,this.onError(i,`BAD_DIRECTIVE`,n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case`document`:{let t=qq(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 pq(Jq(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 pq(Jq(e),`UNEXPECTED_TOKEN`,`Unexpected doc-end without preceding document`));break}this.doc.directives.docEnd=!0;let t=Cq(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 pq(Jq(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 uq(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}}},Zq=Symbol(`break visit`),Qq=Symbol(`skip children`),$q=Symbol(`remove item`);function eJ(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),tJ(Object.freeze([]),e,t)}eJ.BREAK=Zq,eJ.SKIP=Qq,eJ.REMOVE=$q,eJ.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},eJ.parentCollection=(e,t)=>{let n=eJ.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 tJ(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=tJ(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===Zq)return Zq;else r===$q&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}function nJ(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 `: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 eJ(e){switch(e){case void 0:case` `:case` `: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 rJ(e){switch(e){case void 0:case` `:case`
`:case`\r`:case` `:return!0;default:return!1}}var tJ=new Set(`0123456789ABCDEFabcdef`),nJ=new Set(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()`),rJ=new Set(`,[]{}`),iJ=new Set(` ,[]{} `:case`\r`:case` `:return!0;default:return!1}}var iJ=new Set(`0123456789ABCDEFabcdef`),aJ=new Set(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()`),oJ=new Set(`,[]{}`),sJ=new Set(` ,[]{}
\r `),aJ=e=>!e||iJ.has(e),oJ=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===` \r `),cJ=e=>!e||sJ.has(e),lJ=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]===` `||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===` `}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===` `||!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===`...`)&&eJ(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(` `||n>=this.indentNext||!t&&!this.atEnd?e+n:-1}if(t===`-`||t===`.`){let t=this.buffer.substr(e,3);if((t===`---`||t===`...`)&&rJ(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===`...`)&&eJ(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&&!eJ(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===`:`)&&eJ(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(aJ),`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(`...`))&&eJ(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(aJ),`flow`;case`"`:case`'`:return this.flowKey=!0,yield*this.parseQuotedScalar();case`:`:{let e=this.charAt(1);if(this.flowKey||eJ(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),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===`...`)&&rJ(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&&!rJ(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===`:`)&&rJ(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(cJ),`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(`...`))&&rJ(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(cJ),`flow`;case`"`:case`'`:return this.flowKey=!0,yield*this.parseQuotedScalar();case`:`:{let e=this.charAt(1);if(this.flowKey||rJ(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(` `,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=>eJ(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=>rJ(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===` `: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(` `)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===` `,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.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(eJ(r)||e&&rJ.has(r))break;t=n}else if(eJ(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(rJ(r)||e&&oJ.has(r))break;t=n}else if(rJ(r)){let i=this.buffer[n+1];if(r===`\r`&&(i===`
`?(n+=1,r=` `?(n+=1,r=`
`,i=this.buffer[n+1]):t=n),i===`#`||e&&rJ.has(i))break;if(r===` `,i=this.buffer[n+1]):t=n),i===`#`||e&&oJ.has(i))break;if(r===`
`){let e=this.continueScalar(n+1);if(e===-1)break;n=Math.max(n,e-2)}}else{if(e&&rJ.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(aJ),e+=yield*this.pushSpaces(!0);continue loop;case`-`:case`?`:case`:`:{let t=this.flowLevel>0,n=this.charAt(1);if(eJ(n)||t&&rJ.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(;!eJ(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(nJ.has(t))t=this.buffer[++e];else if(t===`%`&&tJ.has(this.buffer[e+1])&&tJ.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===` `){let e=this.continueScalar(n+1);if(e===-1)break;n=Math.max(n,e-2)}}else{if(e&&oJ.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(cJ),e+=yield*this.pushSpaces(!0);continue loop;case`-`:case`?`:case`:`:{let t=this.flowLevel>0,n=this.charAt(1);if(rJ(n)||t&&oJ.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(;!rJ(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(aJ.has(t))t=this.buffer[++e];else if(t===`%`&&iJ.has(this.buffer[e+1])&&iJ.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(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)}},sJ=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 cJ(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function lJ(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 uJ(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 dJ(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 fJ(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 pJ(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 mJ(e){if(e.start.type===`flow-seq-start`)for(let t of e.items)t.sep&&!t.value&&!cJ(t.start,`explicit-key-ind`)&&!cJ(t.sep,`map-value-ind`)&&(t.key&&(t.value=t.key),delete t.key,uJ(t.value)?t.value.end?pJ(t.value.end,t.sep):t.value.end=t.sep:pJ(t.start,t.sep),delete t.sep)}var hJ=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 oJ,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=$q(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`&&mJ(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&&lJ(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)}},uJ=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 dJ(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function fJ(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 pJ(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 mJ(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 hJ(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 gJ(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 _J(e){if(e.start.type===`flow-seq-start`)for(let t of e.items)t.sep&&!t.value&&!dJ(t.start,`explicit-key-ind`)&&!dJ(t.sep,`map-value-ind`)&&(t.key&&(t.value=t.key),delete t.key,pJ(t.value)?t.value.end?gJ(t.value.end,t.sep):t.value.end=t.sep:gJ(t.start,t.sep),delete t.sep)}var vJ=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 lJ,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=nJ(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`&&_J(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&&fJ(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(` `)+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)){pJ(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(cJ(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=fJ(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(cJ(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(uJ(t.key)&&!cJ(t.sep,`newline`)){let e=fJ(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]}):cJ(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&&!cJ(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)){pJ(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||cJ(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)){gJ(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(dJ(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=hJ(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(dJ(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(pJ(t.key)&&!dJ(t.sep,`newline`)){let e=hJ(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]}):dJ(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&&!dJ(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)){gJ(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||dJ(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(` `)+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=fJ(dJ(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=fJ(dJ(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 gJ(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new sJ||null,prettyErrors:t}}function _J(e,t={}){let{lineCounter:n,prettyErrors:r}=gJ(t),i=new hJ(n?.addNewLine),a=new qq(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 lq(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(dq(e,n)),o.warnings.forEach(dq(e,n))),o}function vJ(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let i=_J(e,n);if(!i)return null;if(i.warnings.forEach(e=>VG(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 yJ(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 IW(e)&&!r?e.toString(n):new oq(e,r,n).toString(n)}var bJ=e=>typeof e==`object`&&!!e&&!Array.isArray(e),xJ=e=>bJ(e)?Object.entries(e).map(([e,t])=>[e,Array.isArray(t)?t:[]]):[];function SJ(e){if(bJ(e)){if(bJ(e.parallel))return{kind:`parallel`,base:[`parallel`],branches:xJ(e.parallel)};if(bJ(e.switch))return{kind:`switch`,base:[`switch`,`cases`],on:typeof e.switch.on==`string`?e.switch.on:``,branches:xJ(e.switch.cases)}}}function CJ(e){return e.slice(2).includes(`parallel`)}function wJ(e,t){let n=_J(e).getIn(t,!0);if(LW(n))return n.toJSON()}function TJ(e,t,n){let r=_J(e);return r.setIn(t,r.createNode(IJ(n))),r.toString()}function EJ(e,t,n){let r=_J(e),i=t.slice(0,-1),a=CJ(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(BW(o)||(r.setIn(i,r.createNode([])),o=r.getIn(i,!0)),!BW(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 DJ(e,t){if(t===`switch`){if(!e||e.includes(`/`))throw Error(`A case is the value it matches, without a slash.`)}else if(!/^[a-z][a-z0-9]*(?:[.-][a-z0-9]+)*$/.test(e))throw Error(`Use a lowercase branch name with letters, digits, dots or dashes.`)}function OJ(e,t){let n=e.getIn(t,!0),r=SJ(LW(n)?n.toJSON():void 0),i=r?e.getIn([...t,...r.base],!0):void 0;if(!r||!LW(i))throw Error(`This step has no branches.`);return{kind:r.kind,branches:i}}function kJ(e,t,n){let r=_J(e),{kind:i,branches:a}=OJ(r,t);if(DJ(n,i),a.has(n))throw Error(`Branch ${n} already exists.`);return a.set(n,r.createNode([])),r.toString()}function AJ(e,t,n,r){let i=_J(e),{kind:a,branches:o}=OJ(i,t);if(DJ(r,a),n!==r&&o.has(r))throw Error(`Branch ${r} already exists.`);let s=o.items.find(e=>zW(e.key)&&e.key.value===n);if(!s||!zW(s.key))throw Error(`Branch ${n} does not exist.`);return s.key.value=r,i.toString()}function jJ(e,t,n){let r=_J(e),{kind:i,branches:a}=OJ(r,t);if(i===`parallel`&&a.items.length<=2)throw Error(`Parallel needs at least two branches.`);if(a.items.length<=1)throw Error(`A switch needs at least one case.`);return Line truncated `,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=hJ(mJ(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=hJ(mJ(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 yJ(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new uJ||null,prettyErrors:t}}function bJ(e,t={}){let{lineCounter:n,prettyErrors:r}=yJ(t),i=new vJ(n?.addNewLine),a=new Xq(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 pq(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(hq(e,n)),o.warnings.forEach(hq(e,n))),o}function xJ(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let i=bJ(e,n);if(!i)return null;if(i.warnings.forEach(e=>GG(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 SJ(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 BW(e)&&!r?e.toString(n):new uq(e,r,n).toString(n)}var CJ=e=>typeof e==`object`&&!!e&&!Array.isArray(e),wJ=e=>CJ(e)?Object.entries(e).map(([e,t])=>[e,Array.isArray(t)?t:[]]):[];function TJ(e){if(CJ(e)){if(CJ(e.parallel))return{kind:`parallel`,base:[`parallel`],branches:wJ(e.parallel)};if(CJ(e.switch))return{kind:`switch`,base:[`switch`,`cases`],on:typeof e.switch.on==`string`?e.switch.on:``,branches:wJ(e.switch.cases)}}}function EJ(e){return e.slice(2).includes(`parallel`)}function DJ(e,t){let n=bJ(e).getIn(t,!0);if(VW(n))return n.toJSON()}function OJ(e,t,n){let r=bJ(e);return r.setIn(t,r.createNode(zJ(n))),r.toString()}function kJ(e,t,n){let r=bJ(e),i=t.slice(0,-1),a=EJ(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(WW(o)||(r.setIn(i,r.createNode([])),o=r.getIn(i,!0)),!WW(o))return{source:e,path:[]};let s=Math.min(Math.max(Number(t.at(-1))+1,0),o.items.length),c=n===`parallel`?{parallel:{"branch-1":[],"branch-2":[]}}:n===`switch`?{switch:{on:``,cases:{true:[],default:[]}}}:{type:n,...a&&n===`agent.run`?{settings:{read_only:!0}}:{}};return o.items.splice(s,0,r.createNode(c)),{source:r.toString(),path:[...i,s]}}function AJ(e,t){if(t===`switch`){if(!e||e.includes(`/`))throw Error(`A case is the value it matches, without a slash.`)}else if(!/^[a-z][a-z0-9]*(?:[.-][a-z0-9]+)*$/.test(e))throw Error(`Use a lowercase branch name with letters, digits, dots or dashes.`)}function jJ(e,t){let n=e.getIn(t,!0),r=TJ(VW(n)?n.toJSON():void 0),i=r?e.getIn([...t,...r.base],!0):void 0;if(!r||!VW(i))throw Error(`This step has no branches.`);return{kind:r.kind,branches:i}}function MJ(e,t,n){let r=bJ(e),{kind:i,branches:a}=jJ(r,t);if(AJ(n,i),a.has(n))throw Error(`Branch ${n} already exists.`);return a.set(n,r.createNode([])),r.toString()}function NJ(e,t,n,r){let i=bJ(e),{kind:a,branches:o}=jJ(i,t);if(AJ(r,a),n!==r&&o.has(r))throw Error(`Branch ${r} already exists.`);let s=o.items.find(e=>UW(e.key)&&e.key.value===n);if(!s||!UW(s.key))throw Error(`Branch ${n} does not exist.`);return s.key.value=r,i.toString()}function PJ(e,t,n){let r=bJ(e),{kind:i,branches:a}=jJ(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 XJ(e,t){let n=JSON.stringify(e??{})+` `+(typeof t==`string`?`{{ ${t.replace(/^!/,``)} }}`:``);return[...new Set([...n.matchAll(KJ)].map(e=>e[1]))]}function ZJ(e){let t=_J(e).toJS(),n=qJ(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=qJ(e)?e:{},p=SJ(d),m=p?.kind??(typeof d.type==`string`?d.type:``),h=qJ(d.settings)?d.settings:{},g=typeof d.id==`string`?d.id:``,_=`step-${t}`,v=s?`${s}/${g||m}`:g||m;r.push({id:_,type:`step`,position:{x:n,y:i},data:{kind:`step`,key:g||t,title:g||GJ(m),type:m,role:zJ(m),step:l?.length===2?String(Number(l[1])+1).padStart(2,`0`):void 0,detail:p?.on?`on ${p.on.replace(/^steps\./,``)}`:JJ(m,h),summary:YJ(h),when:typeof d.when==`string`?d.when:void 0,retry:qJ(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 XJ([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=SJ(t);if(n){let{kind:i,base:a,branches:o}=n,c=p(t,String(e+1),0,u*HJ,void 0,void 0,[`steps`,e]);m(l,c,[`steps`,e-1]),u++;let d=qJ(t)&&typeof t.id==`string`?t.id:i,f=i===`switch`&&!o.some(([e])=>e==="default"),h=o.length+ +!!f,g=[],_=0;o.forEach(([t,n],o)=>{let s=(o-(h-1)/2)*UJ,l=[c],f=[`steps`,e,...a,t];n.forEach((n,r)=>{let a=p(n,`${e+1}-${t}-${r+1}`,s,(u+r)*HJ,t,d,[...f,r],i);m(l,a,[...f,r-1]),l=[a]}),_=Math.max(_,n.length);let v=`add-${e}-${t}`;r.push({id:v,type:`add`,position:{x:s+104,y:(u+n.length)*HJ},data:{kind:`step`,key:v,title:``,type:``,detail:``,branch:t,lane:i,insertAfter:[...f,n.length-1]}}),m(l,v),g.push(v)});let v=(Math.max(_,1)+1)*HJ-24;o.forEach(([t],n)=>{let a=(n-(h-1)/2)*UJ;r.push({id:`lane-${e}-${t}`,type:`lane`,position:{x:a-12,y:u*HJ-40},style:{width:`264px`,height:`${v}px`},zIndex:-1,data:{kind:`step`,key:t,title:t,type:``,detail:``,lane:i}})}),f&&(g.push(c),s.add(c)),l=g,u+=Math.max(_,1)+1;continue}let i=p(t,String(e+1),0,u*HJ,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*HJ-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 QJ={agent:Es,command:mc,repo:Hs,gate:uc,forge:Xs,human:_c,review:zs,workflow:bc},$J={agent:`Agents`,command:`Commands`,repo:`Repository`,gate:`Checks`,forge:`Issues and PRs`,human:`People`,review:`Review`,workflow:`Flow`};function eY(e){return e===`parallel`?Hs:e===`switch`?fc:QJ[e.split(`.`)[0]]??bc}function tY(e){return Object.keys($J).map(t=>({title:$J[t],icon:QJ[t],types:e.filter(e=>e.split(`.`)[0]===t)})).filter(e=>e.types.length)}var nY=k({__name:`WorkflowPicker`,props:{value:{},workflows:{},label:{}},emits:[`pick`],setup(e,{emit:t}){let n=t;return(t,r)=>(R(),K(z(xl),{"model-value":e.value||void 0,"onUpdate:modelValue":r[0]||=e=>n(`pick`,String(e))},{default:j(()=>[M(z(Ol),{"aria-label":e.label},{default:j(()=>[M(z(kl),{placeholder:`Choose workflow`})]),_:1},8,[`aria-label`]),M(z(Sl),null,{default:j(()=>[e.value&&!e.workflows.some(t=>t.id===e.value)?(R(),K(z(Tl),{key:0,value:e.value,disabled:``},{default:j(()=>[A(B(e.value)+` (unavailable)`,1)]),_:1},8,[`value`])):L(``,!0),(R(!0),W(V,null,G(e.workflows,e=>(R(),K(z(Tl),{key:e.id,value:e.id},{default:j(()=>[A(B(e.id),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1},8,[`model-value`]))}});function rY(e){return e.ok?`Valid`:e.line?`Line ${e.line}: ${e.message}`:e.message}function iY(e,t=[]){let n=_J(e),r=n.errors[0];if(r)return{ok:!1,message:vY(r.message),line:r.linePos?.[0]?.line};let i=n.toJS();if(!yY(i))return{ok:!1,message:`A workflow is a mapping with an id and steps.`};let a=typeof i.id==`string`?i.id.trim():``;if(!a)return{ok:!1,message:`workflow id is required`};let o=i.steps;if(o==null||o===``)return{ok:!1,message:`workflow ${a} has no steps`};if(!Array.isArray(o))return{ok:!1,message:`workflow ${a}: steps must be a list`};if(!o.length)return{ok:!1,message:`workflow ${a} has no steps`};let s=new Map(t.map(e=>[e.name,e])),c=typeof i.repository==`string`&&i.repository.trim()?i.repository.trim():`required`,l=[],u=new Set;for(let[e,t]of o.entries()){let n=`workflow ${a} step ${e+1}`,r=SJ(t);if(r){if(r.kind===`switch`&&!r.on)return{ok:!1,message:`${n}: switch.on Line truncated `).find(e=>e.trim())?.trim()}}function $J(e,t){let n=JSON.stringify(e??{})+` `+(typeof t==`string`?`{{ ${t.replace(/^!/,``)} }}`:``);return[...new Set([...n.matchAll(YJ)].map(e=>e[1]))]}function eY(e){let t=bJ(e).toJS(),n=XJ(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=XJ(e)?e:{},p=TJ(d),m=p?.kind??(typeof d.type==`string`?d.type:``),h=XJ(d.settings)?d.settings:{},g=typeof d.id==`string`?d.id:``,_=`step-${t}`,v=s?`${s}/${g||m}`:g||m;r.push({id:_,type:`step`,position:{x:n,y:i},data:{kind:`step`,key:g||t,title:g||JJ(m),type:m,role:HJ(m),step:l?.length===2?String(Number(l[1])+1).padStart(2,`0`):void 0,detail:p?.on?`on ${p.on.replace(/^steps\./,``)}`:ZJ(m,h),summary:QJ(h),when:typeof d.when==`string`?d.when:void 0,retry:XJ(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 $J([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=TJ(t);if(n){let{kind:i,base:a,branches:o}=n,c=p(t,String(e+1),0,u*GJ,void 0,void 0,[`steps`,e]);m(l,c,[`steps`,e-1]),u++;let d=XJ(t)&&typeof t.id==`string`?t.id:i,f=i===`switch`&&!o.some(([e])=>e==="default"),h=o.length+ +!!f,g=[],_=0;o.forEach(([t,n],o)=>{let s=(o-(h-1)/2)*KJ,l=[c],f=[`steps`,e,...a,t];n.forEach((n,r)=>{let a=p(n,`${e+1}-${t}-${r+1}`,s,(u+r)*GJ,t,d,[...f,r],i);m(l,a,[...f,r-1]),l=[a]}),_=Math.max(_,n.length);let v=`add-${e}-${t}`;r.push({id:v,type:`add`,position:{x:s+104,y:(u+n.length)*GJ},data:{kind:`step`,key:v,title:``,type:``,detail:``,branch:t,lane:i,insertAfter:[...f,n.length-1]}}),m(l,v),g.push(v)});let v=(Math.max(_,1)+1)*GJ-24;o.forEach(([t],n)=>{let a=(n-(h-1)/2)*KJ;r.push({id:`lane-${e}-${t}`,type:`lane`,position:{x:a-12,y:u*GJ-40},style:{width:`264px`,height:`${v}px`},zIndex:-1,data:{kind:`step`,key:t,title:t,type:``,detail:``,lane:i}})}),f&&(g.push(c),s.add(c)),l=g,u+=Math.max(_,1)+1;continue}let i=p(t,String(e+1),0,u*GJ,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*GJ-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 tY={agent:Ds,command:hc,repo:Us,gate:dc,forge:Zs,human:vc,review:Bs,workflow:xc},nY={agent:`Agents`,command:`Commands`,repo:`Repository`,gate:`Checks`,forge:`Issues and PRs`,human:`People`,review:`Review`,workflow:`Flow`};function rY(e){return e===`parallel`?Us:e===`switch`?pc:tY[e.split(`.`)[0]]??xc}function iY(e){return Object.keys(nY).map(t=>({title:nY[t],icon:tY[t],types:e.filter(e=>e.split(`.`)[0]===t)})).filter(e=>e.types.length)}var aY=k({__name:`WorkflowPicker`,props:{value:{},workflows:{},label:{}},emits:[`pick`],setup(e,{emit:t}){let n=t;return(t,r)=>(R(),K(z(Sl),{"model-value":e.value||void 0,"onUpdate:modelValue":r[0]||=e=>n(`pick`,String(e))},{default:j(()=>[M(z(kl),{"aria-label":e.label},{default:j(()=>[M(z(Al),{placeholder:`Choose workflow`})]),_:1},8,[`aria-label`]),M(z(Cl),null,{default:j(()=>[e.value&&!e.workflows.some(t=>t.id===e.value)?(R(),K(z(El),{key:0,value:e.value,disabled:``},{default:j(()=>[A(B(e.value)+` (unavailable)`,1)]),_:1},8,[`value`])):L(``,!0),(R(!0),W(V,null,G(e.workflows,e=>(R(),K(z(El),{key:e.id,value:e.id},{default:j(()=>[A(B(e.id),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1},8,[`model-value`]))}});function oY(e){return e.ok?`Valid`:e.line?`Line ${e.line}: ${e.message}`:e.message}function sY(e,t=[]){let n=bJ(e),r=n.errors[0];if(r)return{ok:!1,message:SY(r.message),line:r.linePos?.[0]?.line};let i=n.toJS();if(!CY(i))return{ok:!1,message:`A workflow is a mapping with an id and steps.`};let a=typeof i.id==`string`?i.id.trim():``;if(!a)return{ok:!1,message:`workflow id is required`};let o=i.steps;if(o==null||o===``)return{ok:!1,message:`workflow ${a} has no steps`};if(!Array.isArray(o))return{ok:!1,message:`workflow ${a}: steps must be a list`};if(!o.length)return{ok:!1,message:`workflow ${a} has no steps`};let s=new Map(t.map(e=>[e.name,e])),c=typeof i.repository==`string`&&i.repository.trim()?i.repository.trim():`required`,l=[],u=new Set;for(let[e,t]of o.entries()){let n=`workflow ${a} step ${e+1}`,r=dY(t);if(r)return{ok:!1,message:`${n}: ${r}`};let i=TJ(t);if(i){if(i.kind===`sLine truncated
`).map((e,t)=>({number:t+1,text:e,tokens:mY(e)}))}var fY=/^(\s*)(-\s+)?/,pY=/^([^:#\s][^:#]*?)(:)(\s*)(.*)$/;function mY(e){let{code:t,comment:n}=hY(e),r=gY(t);return n&&r.push({text:n,kind:`comment`}),r}function hY(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 gY(e){if(!e)return[];let t=[],n=fY.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=pY.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,..._Y(i[4]??``)]):[...t,..._Y(r)]}function _Y(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 vY(e){return e.split(` `).map((e,t)=>({number:t+1,text:e,tokens:vY(e)}))}var gY=/^(\s*)(-\s+)?/,_Y=/^([^:#\s][^:#]*?)(:)(\s*)(.*)$/;function vY(e){let{code:t,comment:n}=yY(e),r=bY(t);return n&&r.push({text:n,kind:`comment`}),r}function yY(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 bY(e){if(!e)return[];let t=[],n=gY.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=_Y.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,...xY(i[4]??``)]):[...t,...xY(r)]}function xY(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 SY(e){return e.split(`
`)[0]?.trim()||`invalid YAML`}function yY(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function bY(e){return typeof e==`string`&&e.trim()!==``}var xY={class:`flex h-full w-[24rem] flex-col border-l border-border bg-card shadow-xl`},SY={class:`flex items-center gap-2.5 border-b border-border px-4 py-3`},CY={class:`flex size-8 shrink-0 items-center justify-center rounded-md bg-secondary text-primary`},wY={class:`min-w-0 flex-1`},TY={class:`truncate font-mono text-[11px] text-fg-subtle`},EY={class:`flex-1 space-y-5 overflow-y-auto px-4 py-4`},DY={key:0,class:`rounded-md bg-danger/10 px-2.5 py-1.5 text-xs text-danger`,role:`alert`},OY={key:1,class:`space-y-3`},kY={key:0,class:`block space-y-1.5`},AY={id:`switch-on`},jY=[`value`],MY={class:`text-xs font-medium text-muted-foreground`},NY={class:`flex items-center gap-2`},PY={key:1,role:`alert`,class:`text-xs text-danger`},FY={key:2,class:`space-y-1.5`},IY=[`title`],LY={key:4,class:`flex flex-wrap items-center gap-1 pt-0.5`},RY={key:3,class:`divide-y divide-border rounded-md border border-border`},zY=[`title`],BY={key:0,class:`space-y-3`},VY={class:`text-[13px]`},HY={key:0,class:`text-danger`},UY={class:`ml-2 text-xs text-fg-subtle`},WY={key:1,class:`space-y-3`},GY={class:`text-[13px]`},KY={class:`ml-2 text-xs text-fg-subtle`},qY=[`title`],JY={key:0,class:`text-xs text-danger`},YY={class:`space-y-2`},XY={class:`divide-y divide-border rounded-md border border-border`},ZY={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},QY={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},$Y={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},eX={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},tX={class:`flex items-center border-t border-border px-4 py-2.5`},nX=k({__name:`StepEditor`,props:{yaml:{},path:{},vocabulary:{},workflows:{},modelAliases:{}},emits:[`update:yaml`,`close`,`remove`],setup(e,{emit:t}){let n=e,i=t,a=I(()=>wJ(n.yaml,n.path)??{}),o=I(()=>SJ(a.value)),s=I(()=>o.value?.kind??(typeof a.value.type==`string`?a.value.type:``)),c=I(()=>o.value?.branches.map(([e])=>e)??[]),l=I(()=>s.value===`parallel`?2:1);function u(e){i(`update:yaml`,TJ(n.yaml,n.path,{...a.value,switch:{...a.value.switch,on:e}}))}let d=q(``),f=q(``);function p(e,t,r=``){try{let a=e===`add`?kJ(n.yaml,n.path,t):e===`rename`?AJ(n.yaml,n.path,t,r):jJ(n.yaml,n.path,t);i(`update:yaml`,a),d.value=``,f.value=``}catch(e){f.value=String(e.message)}}let m=I(()=>n.vocabulary.find(e=>e.name===s.value)),h=I(()=>typeof a.value.settings==`object`&&a.value.settings!==null?a.value.settings:{}),g=I(()=>FJ(n.yaml,n.path)),_=I(()=>m.value?.settings&&a.value.settings?lY(a.value.settings,m.value.settings,`settings`):``),v=[`mission`,`workflow`,`message`,`body`,`plan`,`then`,`status`,`detail`,`run`,`rules`],y=/mission|body|detail|plan|rules/;function b(e,t){return[`workflow.call`,`workflow.handoff`].includes(s.value)&&e===`workflow`||s.value===`human.approve`&&e===`then`?`workflow`:s.value===`agent.run`&&e===`model`?`select`:t.type===`string`?t.enum?`select`:y.test(e)?`text`:`line`:t.type===`boolean`?`boolean`:t.type===`integer`||t.type===`number`?`number`:t.type===`array`&&t.items?.type===`string`?`lines`:`yaml`}let x=I(()=>{let e=Object.entries(m.value?.settings?.properties??{}).filter(([e])=>s.value!==`workflow.call`||![`inputs`,`outputs`].includes(e)).map(([e,t])=>({key:e,schema:t,kind:b(e,t),options:s.value===`agent.run`&&e===`model`?n.modelAliases:t.enum??[]})),t=e.filter(e=>v.includes(e.key)&&e.kind!==`boolean`).sort((e,t)=>v.indexOf(e.key)-v.indexOf(t.key))[0],r=e.filter(e=>e!==t);return{lead:t,compact:r.filter(e=>[`workflow`,`select`,`line`,`number`,`boolean`].includes(e.kind)),long:r.filter(e=>[`text`,`lines`,`yaml`].includes(e.kind))}});function S(e){let{id:t,type:r,...a}=e;i(`update:yaml`,TJ(n.yaml,n.path,{id:t,type:r,...a}))}function C(e,t){S({...a.value,[e]:t})}function w(e){C(`retry`,{...a.value.retry,...e})}function T(e,t){let n={...h.value,[e]:t};s.value===`workflow.call`&&e===`wait`&&t!==!0&&delete n.outputs,S({...a.value,settings:n})}function ee(e,t){let n={...h.value,[e]:t};s.value===`workflow.call`&&t!==h.value[e]&&(delete n.inputs,delete n.outputs),S({...a.value,settings:n})}let E=I(()=>n.workflows.find(e=>e.id===h.value.workflow)),D=I(()=>Object.entries(LJ(E.value?.yaml??``,`inputs`)??{})),te=I(()=>Object.entries(LJ(E.value?.yaml??``,`outputs`)??{})),ne=I(()=>Object.entries(LJ(n.yaml,`inputs`)??{})),re=I(()=>Object.entries(LJ(n.yaml,`outputs`)??{})),ie=I(()=>h.value.inputs??{}),O=I(()=>h.value.outputs??{}),ae=e=>typeof e==`string`&&e.startsWith(`inputs.`),oe=e=>ie.value[e]===void 0?``:String(ie.value[e]);function se(e,t,n){T(`inputs`,{...ie.value,[e]:t===``?void 0:ae(t)?t:Rv(t,n??`string`)})}let ce=q(null);function le(e,t){let n=ce.value??x.value.lead?.key;if(!n)return;let r=typeof h.value[n]==`string`?h.value[n]:``,i=`{{ steps.${e}.${t} }}`;T(n,r?`${r.trimEnd()} ${i}`:i)}let ue=q({});function de(e,t){try{T(e,t.trim()?vJ(t):void 0),ue.value={...ue.value,[e]:``}}catch(t){ue.val Line truncated `)[0]?.trim()||`invalid YAML`}function CY(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function wY(e){return typeof e==`string`&&e.trim()!==``}var TY={class:`flex h-full w-[24rem] flex-col border-l border-border bg-card shadow-xl`},EY={class:`flex items-center gap-2.5 border-b border-border px-4 py-3`},DY={class:`flex size-8 shrink-0 items-center justify-center rounded-md bg-secondary text-primary`},OY={class:`min-w-0 flex-1`},kY={class:`truncate font-mono text-[11px] text-fg-subtle`},AY={class:`flex-1 space-y-5 overflow-y-auto px-4 py-4`},jY={key:0,class:`rounded-md bg-danger/10 px-2.5 py-1.5 text-xs text-danger`,role:`alert`},MY={key:1,class:`space-y-3`},NY={key:0,class:`block space-y-1.5`},PY={id:`switch-on`},FY=[`value`],IY={class:`text-xs font-medium text-muted-foreground`},LY={class:`flex items-center gap-2`},RY={key:1,role:`alert`,class:`text-xs text-danger`},zY={key:2,class:`space-y-1.5`},BY=[`title`],VY={key:4,class:`flex flex-wrap items-center gap-1 pt-0.5`},HY={key:3,class:`divide-y divide-border rounded-md border border-border`},UY=[`title`],WY={key:0,class:`space-y-3`},GY={class:`text-[13px]`},KY={key:0,class:`text-danger`},qY={class:`ml-2 text-xs text-fg-subtle`},JY={key:1,class:`space-y-3`},YY={class:`text-[13px]`},XY={class:`ml-2 text-xs text-fg-subtle`},ZY=[`title`],QY={key:0,class:`text-xs text-danger`},$Y={class:`space-y-2`},eX={key:0,role:`alert`,class:`text-xs text-danger`},tX={class:`divide-y divide-border rounded-md border border-border`},nX={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},rX={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},iX={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},aX={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},oX=[`for`],sX={class:`flex items-center border-t border-border px-4 py-2.5`},cX=k({__name:`StepEditor`,props:{yaml:{},path:{},vocabulary:{},workflows:{},modelAliases:{}},emits:[`update:yaml`,`close`,`remove`],setup(e,{emit:t}){let n=Ke(),r=e,i=t,a=I(()=>DJ(r.yaml,r.path)??{}),o=I(()=>TJ(a.value)),s=I(()=>o.value?.kind??(typeof a.value.type==`string`?a.value.type:``)),c=I(()=>o.value?.branches.map(([e])=>e)??[]),l=I(()=>s.value===`parallel`?2:1);function u(e){i(`update:yaml`,OJ(r.yaml,r.path,{...a.value,switch:{...a.value.switch,on:e}}))}let d=q(``),f=q(``);function p(e,t,n=``){try{let a=e===`add`?MJ(r.yaml,r.path,t):e===`rename`?NJ(r.yaml,r.path,t,n):PJ(r.yaml,r.path,t);i(`update:yaml`,a),d.value=``,f.value=``}catch(e){f.value=String(e.message)}}let m=I(()=>r.vocabulary.find(e=>e.name===s.value)),h=I(()=>typeof a.value.settings==`object`&&a.value.settings!==null?a.value.settings:{}),g=I(()=>RJ(r.yaml,r.path)),_=I(()=>dY(a.value)),v=I(()=>m.value?.settings&&a.value.settings?pY(a.value.settings,m.value.settings,`settings`):``),y=[`mission`,`workflow`,`message`,`body`,`plan`,`then`,`status`,`detail`,`run`,`rules`],b=/mission|body|detail|plan|rules/;function x(e,t){return[`workflow.call`,`workflow.handoff`].includes(s.value)&&e===`workflow`||s.value===`human.approve`&&e===`then`?`workflow`:s.value===`agent.run`&&e===`model`?`select`:t.type===`string`?t.enum?`select`:b.test(e)?`text`:`line`:t.type===`boolean`?`boolean`:t.type===`integer`||t.type===`number`?`number`:t.type===`array`&&t.items?.type===`string`?`lines`:`yaml`}let S=I(()=>{let e=Object.entries(m.value?.settings?.properties??{}).filter(([e])=>s.value!==`workflow.call`||![`inputs`,`outputs`].includes(e)).map(([e,t])=>({key:e,schema:t,kind:x(e,t),options:s.value===`agent.run`&&e===`model`?r.modelAliases:t.enum??[]})),t=e.filter(e=>y.includes(e.key)&&e.kind!==`boolean`).sort((e,t)=>y.indexOf(e.key)-y.indexOf(t.key))[0],n=e.filter(e=>e!==t);return{lead:t,compact:n.filter(e=>[`workflow`,`select`,`line`,`number`,`boolean`].includes(e.kind)),long:n.filter(e=>[`text`,`lines`,`yaml`].includes(e.kind))}});function C(e){let{id:t,type:n,...a}=e;i(`update:yaml`,OJ(r.yaml,r.path,{id:t,type:n,...a}))}function w(e,t){C({...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 ee(e,t){let n={...h.value,[e]:t};s.value===`workflow.call`&&e===`wait`&&t!==!0&&delete n.outputs,C({...a.value,settings:n})}function E(e,t){let n={...h.value,[e]:t};s.value===`workflow.call`&&t!==h.value[e]&&(delete n.inputs,delete n.outputs),C({...a.value,settings:n})}let D=I(()=>r.workflows.find(e=>e.id===h.value.workflow)),te=I(()=>Object.entries(BJ(D.value?.yaml??``,`inputs`)??{})),ne=I(()=>Object.entries(BJ(D.value?.yaml??``,`outputs`)??{})),re=I(()=>Object.entries(BJ(r.yaml,`inputs`)??{})),ie=I(()=>Object.entries(BJ(r.yaml,`outputs`)??{})),O=I(()=>h.value.inputs??{}),ae=I(()=>h.value.outputs??{}),oe=e=>typeof e==`string`&&e.startsWith(`inputs.`),se=e=>O.value[e]===void 0?``:String(O.value[e]);function ce(e,t,n){ee(`inputs`,{...O.value,[e]:t===``?void 0:oe(t)?t:Vv(t,n??`string`)})}let le=q(null);function ue(e,t){let n=le.value??S.value.lead?.key;if(!n)return;let r=typeof h.value[n]==`string`?h.value[n]:`Line truncated
`)[0]}}}let fe=e=>e===void 0?``:yJ(e).trimEnd(),pe=(e,t)=>t.title??e.replaceAll(`_`,` `).replace(/^./,e=>e.toUpperCase()),me=e=>typeof h.value[e]==`string`?h.value[e]:``;return(t,n)=>(R(),W(`aside`,xY,[U(`header`,SY,[U(`span`,CY,[(R(),K(et(z(eY)(s.value)),{class:`size-4`}))]),U(`div`,wY,[M(z(Z),{"model-value":a.value.id??``,class:`h-7 truncate border-transparent px-1 font-medium shadow-none hover:border-input dark:bg-transparent`,placeholder:z(GJ)(s.value),"aria-label":`Step id`,"onUpdate:modelValue":n[0]||=e=>C(`id`,String(e))},null,8,[`model-value`,`placeholder`]),U(`div`,TY,B(s.value),1)]),M(z(Y),{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Close`,onClick:n[1]||=e=>i(`close`)},{default:j(()=>[M(z(Sc))]),_:1})]),U(`div`,EY,[_.value?(R(),W(`p`,DY,B(_.value),1)):L(``,!0),o.value?(R(),W(`section`,OY,[s.value===`switch`?(R(),W(`label`,kY,[n[18]||=U(`span`,{class:`text-xs font-medium text-muted-foreground`,title:`The value whose case runs; a case named default runs when none matches`},`Switch on`,-1),M(z(Z),{"model-value":o.value.on,class:`font-mono`,placeholder:`steps.assess.result.fit`,list:`switch-on`,onChange:n[2]||=e=>u(e.target.value.trim())},null,8,[`model-value`]),U(`datalist`,AY,[(R(!0),W(V,null,G(g.value,e=>(R(),W(`option`,{key:e,value:`steps.${e}.result.`},null,8,jY))),128))])])):L(``,!0),U(`div`,MY,B(s.value===`switch`?`Cases`:`Branches`),1),(R(!0),W(V,null,G(c.value,e=>(R(),W(`div`,{key:e,class:`flex items-center gap-2`},[M(z(Z),{"model-value":e,class:N(s.value===`switch`&&`font-mono`),"aria-label":`${s.value===`switch`?`Case`:`Branch`} ${e}`,onChange:t=>p(`rename`,e,t.target.value.trim())},null,8,[`model-value`,`class`,`aria-label`,`onChange`]),M(z(Y),{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Remove ${e}`,disabled:c.value.length<=l.value,onClick:t=>p(`delete`,e)},{default:j(()=>[M(z(r))]),_:1},8,[`aria-label`,`disabled`,`onClick`])]))),128)),U(`div`,NY,[M(z(Z),{modelValue:d.value,"onUpdate:modelValue":n[3]||=e=>d.value=e,"aria-label":s.value===`switch`?`New case value`:`New branch name`,placeholder:s.value===`switch`?`Value, or default`:`Branch name`,onKeydown:n[4]||=jt(Nt(e=>p(`add`,d.value.trim()),[`prevent`]),[`enter`])},null,8,[`modelValue`,`aria-label`,`placeholder`]),M(z(Y),{type:`button`,size:`icon-sm`,variant:`outline`,"aria-label":s.value===`switch`?`Add case`:`Add branch`,disabled:!d.value.trim(),onClick:n[5]||=e=>p(`add`,d.value.trim())},{default:j(()=>[M(z(rc))]),_:1},8,[`aria-label`,`disabled`])]),f.value?(R(),W(`p`,PY,B(f.value),1)):L(``,!0)])):L(``,!0),x.value.lead?(R(),W(`section`,FY,[U(`div`,{class:`flex items-center gap-1 text-xs font-medium text-muted-foreground`,title:x.value.lead.schema.description},[A(B(pe(x.value.lead.key,x.value.lead.schema))+` `,1),x.value.lead.schema.description?(R(),K(z(Ps),{key:0,class:`size-3 text-fg-subtle`})):L(``,!0)],8,IY),x.value.lead.kind===`workflow`?(R(),K(nY,{key:0,value:me(x.value.lead.key),workflows:e.workflows,label:pe(x.value.lead.key,x.value.lead.schema),onPick:n[6]||=e=>ee(x.value.lead.key,e)},null,8,[`value`,`workflows`,`label`])):x.value.lead.kind===`select`?(R(),K(z(Ev),{key:1,size:`sm`,class:`w-full`,"model-value":me(x.value.lead.key),"onUpdate:modelValue":n[7]||=e=>T(x.value.lead.key,String(e)||void 0)},{default:j(()=>[M(z(Dv),{value:``},{default:j(()=>[...n[19]||=[A(`Default`,-1)]]),_:1}),(R(!0),W(V,null,G(x.value.lead.options,e=>(R(),K(z(Dv),{key:e,value:e},{default:j(()=>[A(B(e),1)]),_:2},1032,[`value`]))),128))]),_:1},8,[`model-value`])):x.value.lead.kind===`text`?(R(),K(z(Kl),{key:2,"model-value":me(x.value.lead.key),class:`min-h-40 text-[13px] leading-relaxed`,onFocus:n[8]||=e=>ce.value=x.value.lead.key,"onUpdate:modelValue":n[9]||=e=>T(x.value.lead.key,String(e))},null,8,[`model-value`])):(R(),K(z(Z),{key:3,"model-value":me(x.value.lead.key),onFocus:n[10]||=e=>ce.value=x.value.lead.key,"onUpdate:modelValue":n[11]||=e=>T(x.value.lead.key,String(e))},null,8,[`model-value`])),g.value.length&&x.value.lead.kind!==`select`?(R(),W(`div`,LY,[n[20]||=U(`span`,{class:`text-[11px] text-fg-subtle`},`Insert`,-1),(R(!0),W(V,null,G(g.value,e=>(R(),W(V,{key:e},[M(z(Y),{type:`button`,variant:`outline`,size:`xs`,class:`font-mono`,onClick:t=>le(e,`summary`)},{default:j(()=>[A(B(e),1)]),_:2},1032,[`onClick`]),M(z(Y),{type:`button`,variant:`outline`,size:`xs`,class:`font-mono`,onClick:t=>le(e,`result`)},{default:j(()=>[A(B(e)+`.result`,1)]),_:2},1032,[`onClick`])],64))),128))])):L(``,!0)])):L(``,!0),x.value.compact.length?(R(),W(`section`,RY,[(R(!0),W(V,null,G(x.value.compact,t=>(R(),W(`div`,{key:t.key,class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},[U(`span`,{class:`flex flex-1 items-center gap-1 text-[13px]`,title:t.schema.description},[A(B(pe(t.key,t.schema))+` `,1),t.schema.description?(R(),K(z(Ps),{key:0,class:`size-3 text-fg-subtle`})):L(``,!0)],8,zY),t.kind===`workflow`?(R(),K(nY,{key:0,class:`max-w-48`,value:me(t.key),workflows:e.workflows,label:pe(t.key,t.schema),onPick:e=>ee(t.key,e)},null,8,[`vaLine truncated `)[0]}}}let pe=e=>e===void 0?``:SJ(e).trimEnd(),me=(e,t)=>t.title??e.replaceAll(`_`,` `).replace(/^./,e=>e.toUpperCase()),he=e=>typeof h.value[e]==`string`?h.value[e]:``;return(t,r)=>(R(),W(`aside`,TY,[U(`header`,EY,[U(`span`,DY,[(R(),K(tt(z(rY)(s.value)),{class:`size-4`}))]),U(`div`,OY,[M(z(Z),{"model-value":a.value.id??``,class:`h-7 truncate border-transparent px-1 font-medium shadow-none hover:border-input dark:bg-transparent`,placeholder:z(JJ)(s.value),"aria-label":`Step id`,"onUpdate:modelValue":r[0]||=e=>w(`id`,String(e))},null,8,[`model-value`,`placeholder`]),U(`div`,kY,B(s.value),1)]),M(z(Y),{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Close`,onClick:r[1]||=e=>i(`close`)},{default:j(()=>[M(z(Cc))]),_:1})]),U(`div`,AY,[v.value?(R(),W(`p`,jY,B(v.value),1)):L(``,!0),o.value?(R(),W(`section`,MY,[s.value===`switch`?(R(),W(`label`,NY,[r[18]||=U(`span`,{class:`text-xs font-medium text-muted-foreground`,title:`The value whose case runs; a case named default runs when none matches`},`Switch on`,-1),M(z(Z),{"model-value":o.value.on,class:`font-mono`,placeholder:`steps.assess.result.fit`,list:`switch-on`,onChange:r[2]||=e=>u(e.target.value.trim())},null,8,[`model-value`]),U(`datalist`,PY,[(R(!0),W(V,null,G(g.value,e=>(R(),W(`option`,{key:e,value:`steps.${e}.result.`},null,8,FY))),128))])])):L(``,!0),U(`div`,IY,B(s.value===`switch`?`Cases`:`Branches`),1),(R(!0),W(V,null,G(c.value,e=>(R(),W(`div`,{key:e,class:`flex items-center gap-2`},[M(z(Z),{"model-value":e,class:N(s.value===`switch`&&`font-mono`),"aria-label":`${s.value===`switch`?`Case`:`Branch`} ${e}`,onChange:t=>p(`rename`,e,t.target.value.trim())},null,8,[`model-value`,`class`,`aria-label`,`onChange`]),M(z(Y),{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Remove ${e}`,disabled:c.value.length<=l.value,onClick:t=>p(`delete`,e)},{default:j(()=>[M(z(Ie))]),_:1},8,[`aria-label`,`disabled`,`onClick`])]))),128)),U(`div`,LY,[M(z(Z),{modelValue:d.value,"onUpdate:modelValue":r[3]||=e=>d.value=e,"aria-label":s.value===`switch`?`New case value`:`New branch name`,placeholder:s.value===`switch`?`Value, or default`:`Branch name`,onKeydown:r[4]||=Mt(Pt(e=>p(`add`,d.value.trim()),[`prevent`]),[`enter`])},null,8,[`modelValue`,`aria-label`,`placeholder`]),M(z(Y),{type:`button`,size:`icon-sm`,variant:`outline`,"aria-label":s.value===`switch`?`Add case`:`Add branch`,disabled:!d.value.trim(),onClick:r[5]||=e=>p(`add`,d.value.trim())},{default:j(()=>[M(z(ic))]),_:1},8,[`aria-label`,`disabled`])]),f.value?(R(),W(`p`,RY,B(f.value),1)):L(``,!0)])):L(``,!0),S.value.lead?(R(),W(`section`,zY,[U(`div`,{class:`flex items-center gap-1 text-xs font-medium text-muted-foreground`,title:S.value.lead.schema.description},[A(B(me(S.value.lead.key,S.value.lead.schema))+` `,1),S.value.lead.schema.description?(R(),K(z(Fs),{key:0,class:`size-3 text-fg-subtle`})):L(``,!0)],8,BY),S.value.lead.kind===`workflow`?(R(),K(aY,{key:0,value:he(S.value.lead.key),workflows:e.workflows,label:me(S.value.lead.key,S.value.lead.schema),onPick:r[6]||=e=>E(S.value.lead.key,e)},null,8,[`value`,`workflows`,`label`])):S.value.lead.kind===`select`?(R(),K(z(jv),{key:1,size:`sm`,class:`w-full`,"model-value":he(S.value.lead.key),"onUpdate:modelValue":r[7]||=e=>ee(S.value.lead.key,String(e)||void 0)},{default:j(()=>[M(z(Mv),{value:``},{default:j(()=>[...r[19]||=[A(`Default`,-1)]]),_:1}),(R(!0),W(V,null,G(S.value.lead.options,e=>(R(),K(z(Mv),{key:e,value:e},{default:j(()=>[A(B(e),1)]),_:2},1032,[`value`]))),128))]),_:1},8,[`model-value`])):S.value.lead.kind===`text`?(R(),K(z(ql),{key:2,"model-value":he(S.value.lead.key),class:`min-h-40 text-[13px] leading-relaxed`,onFocus:r[8]||=e=>le.value=S.value.lead.key,"onUpdate:modelValue":r[9]||=e=>ee(S.value.lead.key,String(e))},null,8,[`model-value`])):(R(),K(z(Z),{key:3,"model-value":he(S.value.lead.key),onFocus:r[10]||=e=>le.value=S.value.lead.key,"onUpdate:modelValue":r[11]||=e=>ee(S.value.lead.key,String(e))},null,8,[`model-value`])),g.value.length&&S.value.lead.kind!==`select`?(R(),W(`div`,VY,[r[20]||=U(`span`,{class:`text-[11px] text-fg-subtle`},`Insert`,-1),(R(!0),W(V,null,G(g.value,e=>(R(),W(V,{key:e},[M(z(Y),{type:`button`,variant:`outline`,size:`xs`,class:`font-mono`,onClick:t=>ue(e,`summary`)},{default:j(()=>[A(B(e),1)]),_:2},1032,[`onClick`]),M(z(Y),{type:`button`,variant:`outline`,size:`xs`,class:`font-mono`,onClick:t=>ue(e,`result`)},{default:j(()=>[A(B(e)+`.result`,1)]),_:2},1032,[`onClick`])],64))),128))])):L(``,!0)])):L(``,!0),S.value.compact.length?(R(),W(`section`,HY,[(R(!0),W(V,null,G(S.value.compact,t=>(R(),W(`div`,{key:t.key,class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},[U(`span`,{class:`flex flex-1 items-center gap-1 text-[13px]`,title:t.schema.description},[A(B(me(t.key,t.schema))+` `,1),t.schema.description?(R(),K(z(Fs),{key:0,class:`size-3 text-fg-subtle`})):L(``,!0)],8,UY),t.kind===`workflow`?(R(),K(aY,{key:0,class:`max-w-48`,value:he(t.key),workflows:e.workflows,label:me(t.key,t.schema),onPick:e=>E(t.key,e)},null,8,[`Line truncated
`):``,class:`min-h-16 font-mono text-xs`,placeholder:`One per line`,"onUpdate:modelValue":t=>T(e.key,String(t).split(` `):``,class:`min-h-16 font-mono text-xs`,placeholder:`One per line`,"onUpdate:modelValue":t=>ee(e.key,String(t).split(`
`).filter(Boolean))},null,8,[`model-value`,`onUpdate:modelValue`])):(R(),W(V,{key:2},[M(z(Kl),{"model-value":fe(h.value[e.key]),class:`min-h-24 font-mono text-xs`,placeholder:`YAML`,onChange:t=>de(e.key,t.target.value)},null,8,[`model-value`,`onChange`]),ue.value[e.key]?(R(),W(`span`,JY,B(ue.value[e.key]),1)):L(``,!0)],64))]))),128)),U(`section`,YY,[n[37]||=U(`div`,{class:`text-xs font-medium text-muted-foreground`},`Flow`,-1),U(`div`,XY,[U(`label`,ZY,[n[31]||=U(`span`,{class:`flex-1 text-[13px]`},`Run only when`,-1),M(z(Z),{class:`h-7 w-48 font-mono text-xs`,placeholder:`always`,"model-value":a.value.when??``,"onUpdate:modelValue":n[12]||=e=>C(`when`,String(e))},null,8,[`model-value`])]),U(`label`,QY,[n[34]||=U(`span`,{class:`flex-1 text-[13px]`},`If it fails`,-1),M(z(Ev),{size:`sm`,"model-value":a.value.on_failure??``,"onUpdate:modelValue":n[13]||=e=>C(`on_failure`,String(e)||void 0)},{default:j(()=>[M(z(Dv),{value:``},{default:j(()=>[...n[32]||=[A(`Park the task`,-1)]]),_:1}),M(z(Dv),{value:`continue`},{default:j(()=>[...n[33]||=[A(`Continue`,-1)]]),_:1})]),_:1},8,[`model-value`])]),U(`label`,$Y,[n[35]||=U(`span`,{class:`flex-1 text-[13px]`},`Attempts`,-1),M(z(Z),{type:`number`,min:`1`,max:`10`,placeholder:`1`,class:`h-7 w-20 text-right text-[13px]`,"model-value":a.value.retry?.attempts??``,"onUpdate:modelValue":n[14]||=e=>w({attempts:String(e)===``?void 0:Number(String(e))})},null,8,[`model-value`])]),U(`label`,eX,[n[36]||=U(`span`,{class:`flex-1 text-[13px]`},`Retry backoff`,-1),M(z(uh),{"model-value":a.value.retry?.backoff??``,units:[`s`,`m`,`h`],"onUpdate:modelValue":n[15]||=e=>w({backoff:e||void 0})},null,8,[`model-value`])])])])]),U(`footer`,tX,[M(z(Y),{type:`button`,variant:`ghost`,size:`sm`,class:`text-danger`,onClick:n[16]||=e=>i(`remove`)},{default:j(()=>[M(z(r)),n[38]||=A(`Delete step`,-1)]),_:1}),M(z(Y),{type:`button`,size:`sm`,class:`ml-auto`,onClick:n[17]||=e=>i(`close`)},{default:j(()=>[...n[39]||=[A(`Done`,-1)]]),_:1})])]))}}),rX=`repository_path`;function iX(e,t,n){let r=[];for(let[n,i]of e){let e=t[n];e?.from===`path`&&e.path.trim()&&r.push({name:n,path:e.path.trim(),type:i.type??`string`,required:i.required===!0})}return n.trim()&&r.push({name:rX,path:n.trim(),type:`string`,required:!0}),r}function aX(e){return Array.isArray(e)?`array`:e===null?`null`:typeof e==`boolean`?`bool`:typeof e==`object`?`object`:typeof e}function oX(e,t,n){let r=[];for(let[i,a]of e){let e=t[i],o=a.type??`string`;if(!(e&&(e.from===`path`?e.path.trim():e.value!==``))){a.required&&r.push(`${i} is required`);continue}if(e.from===`path`){let e=n?.failures?.find(e=>e.field_name===i);e&&r.push(`${i}: ${e.reason}`);continue}let s=aX(yb(e.value,o));o!==`any`&&s!==o&&r.push(`${i} is ${o}, but ${JSON.stringify(e.value)} is not`)}return n?.failures?.some(e=>e.field_name===`repository_path`)&&r.push(`the repository path does not resolve`),r}function sX(e,t){let n={};for(let[r,i]of e){let e=t[r];e?.from===`path`&&e.path.trim()?n[r]={param:r}:e?.from===`value`&&e.value!==``&&(n[r]={value:yb(e.value,i.type??`string`)})}return n}function cX(e,t){let n=e=>t.find(t=>t.name===e)?.path??``,r={};for(let[t,i]of Object.entries(e.inputs??{}))r[t]=i.param?{from:`path`,path:n(i.param),value:``}:{from:`value`,path:``,value:typeof i.value==`string`?i.value:JSON.stringify(i.value)};return{rows:r,repositoryPath:n(e.repo_param)}}function lX(e,t=``){return Array.isArray(e)?e.slice(0,3).flatMap((e,n)=>{let r=`${t}[${n}]`;return[r,...lX(e,r)]}):e&&typeof e==`object`?Object.entries(e).flatMap(([e,n])=>{let r=t?`${t}.${e}`:e;return[r,...lX(n,r)]}):[]}function uX(e){try{return e?.body?JSON.parse(e.body):null}catch{return null}}function dX(e){try{let t=JSON.parse(e.headers??`{}`);return Object.fromEntries(Object.entries(t).map(([e,t])=>[e,Array.isArray(t)?t.join(`, `):String(t)]))}catch{return{}}}function fX(e){let t=typeof e==`string`?e:JSON.stringify(e);return t.length>80?`${t.slice(0,80)}…`:t}var pX={class:`flex h-full flex-col`},mX={class:`flex items-center gap-2 border-b border-border px-4 py-3`},hX={class:`min-w-0 flex-1 truncate text-sm font-medium`},gX={key:0,class:`flex flex-1 items-center justify-center`},_X={class:`space-y-1.5`},vX={key:1,class:`space-y-1.5`},yX=[`title`],bX={class:`space-y-1.5`},xX={id:`bind-paths`},SX=[`value`],CX={class:`divide-y divide-border rounded-md border border-border`},wX={class:`flex items-center gap-1.5 text-xs`},TX={class:`font-mono`},EX={class:`text-fg-subtle`},DX={key:0,class:`text-danger`,title:`Required`},OX={key:2,class:`text-xs text-danger`},kX=[`title`],AX={key:0,class:`space-y-1 px-3 py-2`},jX={key:0,class:`text-xs text-danger`},MX={key:1,class:`truncate font-mono text-xs text-success`},NX={key:1,class:`px-3 py-2 text-xs text-fg-subtle`},PX={class:`space-y-2`},FX={key:0,role:`alert`,class:`text-xs text-danger`},IX={key:1,class:`text-xs text-fg-subtle`},LX={class:`flex flex-wrap gap-2`},RX=`__new__`,zX=k({__name:`BindEvent`,props:{yaml:{},binding:{}},emits:[`back`,`saved`],setup(e,{emit:t}){let n Line truncated `).filter(Boolean))},null,8,[`model-value`,`onUpdate:modelValue`])):(R(),W(V,{key:2},[M(z(ql),{"model-value":pe(h.value[e.key]),class:`min-h-24 font-mono text-xs`,placeholder:`YAML`,onChange:t=>fe(e.key,t.target.value)},null,8,[`model-value`,`onChange`]),de.value[e.key]?(R(),W(`span`,QY,B(de.value[e.key]),1)):L(``,!0)],64))]))),128)),U(`section`,$Y,[r[36]||=U(`div`,{class:`text-xs font-medium text-muted-foreground`},`Flow`,-1),r[37]||=U(`p`,{class:`text-xs text-fg-muted`},`Leave the condition empty to always run. Use a field such as inputs.enabled, !inputs.skip, or steps.plan.result.ready == true.`,-1),_.value?(R(),W(`p`,eX,B(_.value),1)):L(``,!0),U(`div`,tX,[U(`label`,nX,[r[31]||=U(`span`,{class:`flex-1 text-[13px]`},`Run only when`,-1),M(z(Z),{class:`h-7 w-48 font-mono text-xs`,placeholder:`inputs.enabled`,"aria-invalid":_.value&&_.value.startsWith(`when`)?!0:void 0,"model-value":a.value.when??``,"onUpdate:modelValue":r[12]||=e=>w(`when`,String(e))},null,8,[`aria-invalid`,`model-value`])]),U(`label`,rX,[r[34]||=U(`span`,{class:`flex-1 text-[13px]`},`If it fails`,-1),M(z(jv),{size:`sm`,"model-value":a.value.on_failure??``,"onUpdate:modelValue":r[13]||=e=>w(`on_failure`,String(e)||void 0)},{default:j(()=>[M(z(Mv),{value:``},{default:j(()=>[...r[32]||=[A(`Park the task`,-1)]]),_:1}),M(z(Mv),{value:`continue`},{default:j(()=>[...r[33]||=[A(`Continue`,-1)]]),_:1})]),_:1},8,[`model-value`])]),U(`label`,iX,[r[35]||=U(`span`,{class:`flex-1 text-[13px]`},`Attempts`,-1),M(z(Z),{type:`number`,min:`1`,max:`10`,placeholder:`1`,class:`h-7 w-20 text-right text-[13px]`,"model-value":a.value.retry?.attempts??``,"onUpdate:modelValue":r[14]||=e=>T({attempts:String(e)===``?void 0:Number(String(e))})},null,8,[`model-value`])]),U(`div`,aX,[U(`label`,{for:`${z(n)}-backoff`,class:`flex-1 text-[13px]`},`Retry backoff`,8,oX),M(z(ph),{id:`${z(n)}-backoff`,"model-value":a.value.retry?.backoff??``,units:[`s`,`m`,`h`],"onUpdate:modelValue":r[15]||=e=>T({backoff:e||void 0})},null,8,[`id`,`model-value`])])])])]),U(`footer`,sX,[M(z(Y),{type:`button`,variant:`ghost`,size:`sm`,class:`text-danger`,onClick:r[16]||=e=>i(`remove`)},{default:j(()=>[M(z(Ie)),r[38]||=A(`Delete step`,-1)]),_:1}),M(z(Y),{type:`button`,size:`sm`,class:`ml-auto`,onClick:r[17]||=e=>i(`close`)},{default:j(()=>[...r[39]||=[A(`Done`,-1)]]),_:1})])]))}}),lX=`repository_path`;function uX(e,t,n){let r=[];for(let[n,i]of e){let e=t[n];e?.from===`path`&&e.path.trim()&&r.push({name:n,path:e.path.trim(),type:i.type??`string`,required:i.required===!0})}return n.trim()&&r.push({name:lX,path:n.trim(),type:`string`,required:!0}),r}function dX(e){return Array.isArray(e)?`array`:e===null?`null`:typeof e==`boolean`?`bool`:typeof e==`object`?`object`:typeof e}function fX(e,t,n){let r=[];for(let[i,a]of e){let e=t[i],o=a.type??`string`;if(!(e&&(e.from===`path`?e.path.trim():e.value!==``))){a.required&&r.push(`${i} is required`);continue}if(e.from===`path`){let e=n?.failures?.find(e=>e.field_name===i);e&&r.push(`${i}: ${e.reason}`);continue}let s=dX(Cb(e.value,o));o!==`any`&&s!==o&&r.push(`${i} is ${o}, but ${JSON.stringify(e.value)} is not`)}return n?.failures?.some(e=>e.field_name===`repository_path`)&&r.push(`the repository path does not resolve`),r}function pX(e,t){let n={};for(let[r,i]of e){let e=t[r];e?.from===`path`&&e.path.trim()?n[r]={param:r}:e?.from===`value`&&e.value!==``&&(n[r]={value:Cb(e.value,i.type??`string`)})}return n}function mX(e,t){let n=e=>t.find(t=>t.name===e)?.path??``,r={};for(let[t,i]of Object.entries(e.inputs??{}))r[t]=i.param?{from:`path`,path:n(i.param),value:``}:{from:`value`,path:``,value:typeof i.value==`string`?i.value:JSON.stringify(i.value)};return{rows:r,repositoryPath:n(e.repo_param)}}function hX(e,t=``){return Array.isArray(e)?e.slice(0,3).flatMap((e,n)=>{let r=`${t}[${n}]`;return[r,...hX(e,r)]}):e&&typeof e==`object`?Object.entries(e).flatMap(([e,n])=>{let r=t?`${t}.${e}`:e;return[r,...hX(n,r)]}):[]}function gX(e){try{return e?.body?JSON.parse(e.body):null}catch{return null}}function _X(e){try{let t=JSON.parse(e.headers??`{}`);return Object.fromEntries(Object.entries(t).map(([e,t])=>[e,Array.isArray(t)?t.join(`, `):String(t)]))}catch{return{}}}function vX(e){let t=typeof e==`string`?e:JSON.stringify(e);return t.length>80?`${t.slice(0,80)}…`:t}var yX={class:`flex h-full flex-col`},bX={class:`flex items-center gap-2 border-b border-border px-4 py-3`},xX={class:`min-w-0 flex-1 truncate text-sm font-medium`},SX={key:0,class:`flex flex-1 items-center justify-center`},CX={class:`space-y-1.5`},wX={key:1,class:`space-y-1.5`},TX=[`title`],EX={class:`space-y-1.5`},DX={id:`bind-paths`},OX=[`value`],kX={class:`divide-y divide-border rounded-md border border-border`},AX={class:`flex items-center gap-1.5 text-xs`},jX={class:`font-mono`},MX={class:`text-fg-subtle`},NX={key:0,class:`text-danger`,title:`Required`},PX={key:2,class:`text-xs text-danger`},FX=[`title`],IX={key:0,class:`space-y-1 px-3 py-2`},LX={key:0,class:`text-xs text-danger`},RX={key:1,class:`truncLine truncated
`).replace(` `).replace(`
`,` `,`
+`).split(` +`).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 V4(e,t){return n=>{if(!n.code&&!n.key)return!1;let r=H4(n.code,e);return Array.isArray(e)?e.some(e=>B4(n[r],e,t,n.type===`keyup`)):B4(n[r],e,t,n.type===`keyup`)}}function H4(e,t){return t.includes(e)?`code`:`key`}function U4(e,t){let n=I(()=>Ue(t?.target)??L4),r=Qe(Ue(e)===!0),i=!1,a=new Set,o=c(Ue(e));F(()=>Ue(e),(e,t)=>{typeof t==`boolean`&&typeof e!=`boolean`&&s(),o=c(e)},{immediate:!0}),FZ([`blur`,`contextmenu`],s),LZ((...e)=>o(...e),e=>{let n=Ue(t?.actInsideInputWithModifier)??!0,a=Ue(t?.preventDefault)??!1;if(i=z4(e),(!i||i&&!n)&&R4(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}),LZ((...e)=>o(...e),e=>{let n=Ue(t?.actInsideInputWithModifier)??!0;if(r.value){if((!i||i&&!n)&&R4(e))return;i=!1,r.value=!1}},{eventName:`keyup`,target:n});function s(){i=!1,a.clear(),r.value=Ue(e)===!0}function c(e){return e===null?(s(),()=>!1):typeof e==`boolean`?(s(),r.value=e,()=>!1):Array.isArray(e)||typeof e==`string`?V4(e,a):e}return r}var W4=`vue-flow__node-desc`,G4=`vue-flow__edge-desc`,K4=`vue-flow__aria-live`,q4=[`Enter`,` `,`Escape`],J4={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function Y4(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function X4(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 Z4(e){return{width:e.offsetWidth,height:e.offsetHeight}}function Q4(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function $4(e,t){return{x:Q4(e.x,t[0][0],t[1][0]),y:Q4(e.y,t[0][1],t[1][1])}}function e3(e){let t=e.getRootNode();return`elementFromPoint`in t?t:window.document}function t3(e){return e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e}function n3(e){return e&&typeof e==`object`&&`id`in e&&`position`in e&&!t3(e)}function r3(e){return n3(e)&&`computedPosition`in e}function i3(e){return!Number.isNaN(e)&&Number.isFinite(e)}function a3(e){return i3(e.width)&&i3(e.height)&&i3(e.x)&&i3(e.y)}function o3(e,t,n){let r={id:e.id.toString(),type:e.type??`default`,dimensions:xt({width:0,height:0}),computedPosition:xt({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:C6(e.data)?e.data:{},events:xt(C6(e.events)?e.events:{})};return Object.assign(t??r,e,{id:e.id.toString(),parentNode:n})}function s3(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:C6(e.data)?e.data:{},events:xt(C6(e.events)?e.events:{}),label:e.label??``,interactionWidth:e.interactionWidth??n?.interactionWidth,...n??{}};return Object.assign(t??r,e,{id:e.id.toString()})}function c3(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 l3(...e){if(e.length===3){let[t,n,r]=e;return c3(t,n,r,`target`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>t3(e)&&e.source===r).map(e=>n.find(t=>n3(t)&&t.id===e.target))}function u3(...e){if(e.length===3){let[t,n,r]=e;return c3(t,n,r,`source`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>t3(e)&&e.target===r).map(e=>n.find(t=>n3(t)&&t.id===e.source))}function d3({source:e,sourceHandle:t,target:n,targetHandle:r}){return`vueflow__edge-${e}${t??``}-${n}${r??``}`}function f3(e,t){return t.some(t=>t3(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 p3({x:e,y:t},{x:n,y:r,zoom:i}){return{x:e*i+n,y:t*i+r}}function m3({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?o6(s,o):s}function h3(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 g3({x:e,y:t,width:n,height:r}){return{x:e,y:t,x2:e+n,y2:t+r}}function _3({x:e,y:t,x2:n,y2:r}){return{x:e,y:t,width:n-e,height:r-t}}function v3(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=h3(t,g3({...r.computedPosition,...r.dimensions}))}return _3(t)}function y3(e,t,n={x:0,y:0,zoom:1},r=!1,i=!1){let a={...m3(t,n),width:t.width/n.zoom,height:t.height/n.zoom},o=[];for(let t of e){let{dimensions:e,selectable:n=!0,hidden:s= Line truncated `).map(e=>e.trim().toLowerCase());if(i.length===1)return e.toLowerCase()===t.toLowerCase();r||n.add(e.toLowerCase());let a=i.every((e,t)=>n.has(e)&&Array.from(n.values())[t]===i[t]);return r&&n.delete(e.toLowerCase()),a}function q4(e,t){return n=>{if(!n.code&&!n.key)return!1;let r=J4(n.code,e);return Array.isArray(e)?e.some(e=>K4(n[r],e,t,n.type===`keyup`)):K4(n[r],e,t,n.type===`keyup`)}}function J4(e,t){return t.includes(e)?`code`:`key`}function Y4(e,t){let n=I(()=>We(t?.target)??U4),r=$e(We(e)===!0),i=!1,a=new Set,o=c(We(e));F(()=>We(e),(e,t)=>{typeof t==`boolean`&&typeof e!=`boolean`&&s(),o=c(e)},{immediate:!0}),VZ([`blur`,`contextmenu`],s),UZ((...e)=>o(...e),e=>{let n=We(t?.actInsideInputWithModifier)??!0,a=We(t?.preventDefault)??!1;if(i=G4(e),(!i||i&&!n)&&W4(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}),UZ((...e)=>o(...e),e=>{let n=We(t?.actInsideInputWithModifier)??!0;if(r.value){if((!i||i&&!n)&&W4(e))return;i=!1,r.value=!1}},{eventName:`keyup`,target:n});function s(){i=!1,a.clear(),r.value=We(e)===!0}function c(e){return e===null?(s(),()=>!1):typeof e==`boolean`?(s(),r.value=e,()=>!1):Array.isArray(e)||typeof e==`string`?q4(e,a):e}return r}var X4=`vue-flow__node-desc`,Z4=`vue-flow__edge-desc`,Q4=`vue-flow__aria-live`,$4=[`Enter`,` `,`Escape`],e3={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function t3(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function n3(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 r3(e){return{width:e.offsetWidth,height:e.offsetHeight}}function i3(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function a3(e,t){return{x:i3(e.x,t[0][0],t[1][0]),y:i3(e.y,t[0][1],t[1][1])}}function o3(e){let t=e.getRootNode();return`elementFromPoint`in t?t:window.document}function s3(e){return e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e}function c3(e){return e&&typeof e==`object`&&`id`in e&&`position`in e&&!s3(e)}function l3(e){return c3(e)&&`computedPosition`in e}function u3(e){return!Number.isNaN(e)&&Number.isFinite(e)}function d3(e){return u3(e.width)&&u3(e.height)&&u3(e.x)&&u3(e.y)}function f3(e,t,n){let r={id:e.id.toString(),type:e.type??`default`,dimensions:St({width:0,height:0}),computedPosition:St({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:k6(e.data)?e.data:{},events:St(k6(e.events)?e.events:{})};return Object.assign(t??r,e,{id:e.id.toString(),parentNode:n})}function p3(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:k6(e.data)?e.data:{},events:St(k6(e.events)?e.events:{}),label:e.label??``,interactionWidth:e.interactionWidth??n?.interactionWidth,...n??{}};return Object.assign(t??r,e,{id:e.id.toString()})}function m3(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 h3(...e){if(e.length===3){let[t,n,r]=e;return m3(t,n,r,`target`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>s3(e)&&e.source===r).map(e=>n.find(t=>c3(t)&&t.id===e.target))}function g3(...e){if(e.length===3){let[t,n,r]=e;return m3(t,n,r,`source`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>s3(e)&&e.target===r).map(e=>n.find(t=>c3(t)&&t.id===e.source))}function _3({source:e,sourceHandle:t,target:n,targetHandle:r}){return`vueflow__edge-${e}${t??``}-${n}${r??``}`}function v3(e,t){return t.some(t=>s3(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 y3({x:e,y:t},{x:n,y:r,zoom:i}){return{x:e*i+n,y:t*i+r}}function b3({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?f6(s,o):s}function x3(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 S3({x:e,y:t,width:n,height:r}){return{x:e,y:t,x2:e+n,y2:t+r}}function C3({x:e,y:t,x2:n,y2:r}){return{x:e,y:t,width:n-e,height:r-t}}function w3(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=x3(t,S3({...r.computedPosition,...r.dimensions}))}return C3(t)}function T3(e,t,n={x:0,y:0,zoom:1},r=!1,i=!1){let a={...b3(t,n),width:t.width/n.zoom,height:t.height/n.zoom},o=[];for(let t of e){let{dimensions:e,selectable:n=!0,hidden:s= Line truncated
Node: ${e}`,NODE_NOT_FOUND:e=>`Node not found Node: ${e}`,NODE_NOT_FOUND:e=>`Node not found
Node: ${e}`,NODE_MISSING_PARENT:(e,t)=>`Node is missing a parent Node: ${e}`,NODE_MISSING_PARENT:(e,t)=>`Node is missing a parent
Node: ${e} Node: ${e}
@@ -158,6 +158,6 @@ Edge: ${e}
Source: ${t} Source: ${t}
Target: ${n}`,EDGE_ORPHANED:e=>`Edge was orphaned (suddenly missing source or target) and has been removed 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}`,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`},e6=class extends Error{constructor(e,...t){super($3[e]?.call($3,...t)),this.name=`VueFlowError`,this.code=e,this.args=t}};function t6(e){return`clientX`in e}function n6(e){return`sourceEvent`in e}function r6(e,t){let n=t6(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 i6=()=>typeof navigator<`u`&&(navigator==null?void 0:navigator.userAgent)?.indexOf(`Mac`)>=0;function a6(e){return{width:e.dimensions?.width??e.width??0,height:e.dimensions?.height??e.height??0}}function o6(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}var s6=()=>!0;function c6(e){e?.classList.remove(`valid`,`connecting`,`vue-flow__handle-valid`,`vue-flow__handle-connecting`)}function l6(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())X4(i,Y4(e))>0&&r.push(e);return r}var u6=250;function d6(e,t,n,r){let i=[],a=1/0,o=l6(e,n,t+u6);for(let n of o){let o=[...n.handleBounds?.source??[],...n.handleBounds?.target??[]];for(let s of o){if(r.nodeId===s.nodeId&&r.type===s.type&&r.id===s.id)continue;let{x:o,y:c}=J3(n,s,s.position,!0),l=Math.sqrt((o-e.x)**2+(c-e.y)**2);l>t||(l<a?(i=[{...s,x:o,y:c}],a=l):l===a&&i.push({...s,x:o,y:c}))}}if(!i.length)return null;if(i.length>1){let e=r.type===`source`?`target`:`source`;return i.find(t=>t.type===e)??i[0]}return i[0]}function f6(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=s6},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:_}=r6(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=p6(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===M4.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=g6(t,e,a,p,n,!0)}return b}function p6(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function m6(e,t){let n=null;return t?n=`valid`:e&&!t&&(n=`invalid`),n}function h6(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}function g6(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===M4.Strict?o.handleBounds?.[t]:[...o.handleBounds?.source??[],...o.handleBounds?.target??[]],c=(n?s?.find(e=>e.id===n):s?.[0])??null;return c&&a?{...c,...J3(o,c,c.position,!0)}:c}var _6={[k4.Left]:k4.Right,[k4.Right]:k4.Left,[k4.Top]:k4.Bottom,[k4.Bottom]:k4.Top},v6=[`production`,`prod`];function y6(e,...t){b6()&&console.warn(`[Vue Flow]: ${e}`,...t)}function b6(){return!v6.includes(`production`)}function x6(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,...Z4(t)}}):null}function S6(e,t,n,r,i,a=!1,o){i.value=!1,e.selected?(a||e.selected&&t)&&(r([e]),yt(()=>{o.blur()})):n([e])}function C6(e){return z(e)!==void 0}function w6(e,t,n,r){if(!e||!e.source||!e.target)return n(new e6(Q3.EDGE_INVALID,e?.id??`[ID UNKNOWN]`)),!1;let i;return i=t3(e)?e:{...e,id:d3(e)},i=s3(i,void 0,r),!f3(i,t)&&i}function T6(e,t,n,r,i){if(!t.source||!t.target)return i(new e6(Q3.EDGE_INVALID,e.id)),!1;if(!n)return i(new e6(Q3.EDGE_NOT_FOUND,e.id)),!1;let{id:a,...o}=e;return{...o,id:r?d3(t):a,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function E6(e,t,n){let r={},i=[];for(let a=0;a<e.length;++a){let o=e[a];if(!n3(o)){n(new e6(Q3.NODE_INVALID,o?.id));continue}let s=o3(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 e6(Q3.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 D6(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 O6(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}`;D6(`source`,o,`${r}-${a}--Line truncated Edge: ${e}`,USEVUEFLOW_OPTIONS:()=>`The options parameter is deprecated and will be removed in the next major version. Please use the id parameter instead`},o6=class extends Error{constructor(e,...t){super(a6[e]?.call(a6,...t)),this.name=`VueFlowError`,this.code=e,this.args=t}};function s6(e){return`clientX`in e}function c6(e){return`sourceEvent`in e}function l6(e,t){let n=s6(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 u6=()=>typeof navigator<`u`&&(navigator==null?void 0:navigator.userAgent)?.indexOf(`Mac`)>=0;function d6(e){return{width:e.dimensions?.width??e.width??0,height:e.dimensions?.height??e.height??0}}function f6(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}var p6=()=>!0;function m6(e){e?.classList.remove(`valid`,`connecting`,`vue-flow__handle-valid`,`vue-flow__handle-connecting`)}function h6(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())n3(i,t3(e))>0&&r.push(e);return r}var g6=250;function _6(e,t,n,r){let i=[],a=1/0,o=h6(e,n,t+g6);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}=e6(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 v6(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=p6},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:_}=l6(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=y6(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===R4.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=S6(t,e,a,p,n,!0)}return b}function y6(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function b6(e,t){let n=null;return t?n=`valid`:e&&!t&&(n=`invalid`),n}function x6(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}function S6(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===R4.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,...e6(o,c,c.position,!0)}:c}var C6={[F4.Left]:F4.Right,[F4.Right]:F4.Left,[F4.Top]:F4.Bottom,[F4.Bottom]:F4.Top},w6=[`production`,`prod`];function T6(e,...t){E6()&&console.warn(`[Vue Flow]: ${e}`,...t)}function E6(){return!w6.includes(`production`)}function D6(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,...r3(t)}}):null}function O6(e,t,n,r,i,a=!1,o){i.value=!1,e.selected?(a||e.selected&&t)&&(r([e]),bt(()=>{o.blur()})):n([e])}function k6(e){return z(e)!==void 0}function A6(e,t,n,r){if(!e||!e.source||!e.target)return n(new o6(i6.EDGE_INVALID,e?.id??`[ID UNKNOWN]`)),!1;let i;return i=s3(e)?e:{...e,id:_3(e)},i=p3(i,void 0,r),!v3(i,t)&&i}function j6(e,t,n,r,i){if(!t.source||!t.target)return i(new o6(i6.EDGE_INVALID,e.id)),!1;if(!n)return i(new o6(i6.EDGE_NOT_FOUND,e.id)),!1;let{id:a,...o}=e;return{...o,id:r?_3(t):a,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function M6(e,t,n){let r={},i=[];for(let a=0;a<e.length;++a){let o=e[a];if(!c3(o)){n(new o6(i6.NODE_INVALID,o?.id));continue}let s=f3(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 o6(i6.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 N6(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 P6(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}`;N6(`source`,o,`${r}-${a}--Line truncated
`),r=t.split(` `),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 G7(e){let t=_J(e).toJS(),n=new Map;for(let r of ZJ(e).nodes){let{kind:e,path:i,stage:a,occurrence:o}=r.data;if(r.type!==`step`||e!==`step`||!i||a===void 0)continue;let s=t;for(let e of i)s=s?.[e];n.set(`${a}#${o??0}`,{node:r.id,signature:JSON.stringify(s??null)})}return n}function K7(e,t,n){let r=G7(e),i=G7(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 q7={class:`grid h-[calc(100dvh-17rem)] min-h-[26rem] grid-cols-[18rem_1fr] gap-3`},J7={class:`min-h-0 divide-y divide-border overflow-y-auto rounded-lg border border-border`,"aria-label":`Revisions`},Y7=[`aria-current`,`onClick`],X7={class:`flex items-center gap-2 text-sm`},Z7={class:`font-mono text-xs text-fg-subtle`},Q7=[`title`],$7={key:0,class:`px-3 py-2 text-sm text-muted-foreground`},e9={key:0,class:`flex min-h-0 flex-col gap-2`},t9={class:`flex items-center gap-2`},n9={class:`text-xs text-muted-foreground`},r9={key:0,class:`rounded-lg border border-border p-4 text-sm text-muted-foreground`},i9={key:1,class:`min-h-0 flex-1 overflow-auto rounded-lg border border-border py-2 font-mono text-[13px] leading-6`},a9={class:`inline-block w-4 select-none text-fg-subtle`},o9={key:2,class:`grid min-h-0 flex-1 grid-cols-2 gap-3`},s9={class:`flex min-h-0 flex-col gap-1`},c9={class:`text-xs font-medium text-muted-foreground`},l9={class:`min-h-0 flex-1`},u9={class:`flex min-h-0 flex-col gap-1`},d9={class:`min-h-0 flex-1`},f9=k({__name:`WorkflowHistory`,props:ht({revisions:{},current:{},error:{}},{selected:{default:0},selectedModifiers:{},mode:{default:`yaml`},modeModifiers:{}}),emits:ht([`restore`],[`update:selected`,`update:mode`]),setup(e,{emit:t}){let n=e,r=t,i=Ke(e,`selected`),a=Ke(e,`mode`);F(()=>n.revisions,e=>{e.some(e=>e.version===i.value)||(i.value=(e.find(e=>e.yaml!==n.current)??e[0])?.version??0)},{immediate:!0});let o=I(()=>n.revisions.find(e=>e.version===i.value)),s=I(()=>o.value?.yaml??null),c=I(()=>s.value===null?[]:W7(s.value,n.current)),l=I(()=>s.value!==null&&s.value===n.current),u=I(()=>s.value===null?{}:K7(s.value,n.current,`removed`)),d=I(()=>s.value===null?{}:K7(n.current,s.value,`added`)),f={added:`default`,edited:`secondary`,removed:`destructive`};return(t,n)=>(R(),W(`div`,q7,[U(`ol`,J7,[(R(!0),W(V,null,G(e.revisions,e=>(R(),W(`li`,{key:e.version},[U(`button`,{type:`button`,class:N([`block w-full px-3 py-2 text-left hover:bg-secondary`,e.version===i.value&&`bg-secondary`]),"aria-current":e.version===i.value,onClick:t=>i.value=e.version},[U(`span`,X7,[U(`span`,Z7,`v`+B(e.version),1),M(z($t),{variant:f[e.change]},{default:j(()=>[A(B(e.change),1)]),_:2},1032,[`variant`])]),U(`span`,{class:`mt-0.5 block truncate text-xs text-muted-foreground`,title:e.at},B(e.actor||`unknown`)+` · `+B(e.source||`unknown`)+` · `+B(z(yg)(e.at)),9,Q7)],10,Y7)]))),128)),e.revisions.length?L(``,!0):(R(),W(`li`,$7,B(e.error||`No recorded changes`),1))]),o.value?(R(),W(`div`,e9,[U(`div`,t9,[M(z(ob),{modelValue:a.value,"onUpdate:modelValue":n[0]||=e=>a.value=e},{default:j(()=>[M(z(cb),null,{default:j(()=>[M(z(lb),{value:`yaml`},{default:j(()=>[...n[2]||=[A(`YAML`,-1)]]),_:1}),M(z(lb),{value:`canvas`},{default:j(()=>[...n[3]||=[A(`Canvas`,-1)]]),_:1})]),_:1})]),_:1},8,[`modelValue`]),U(`span`,n9,B(l.value?`Same as the current definition`:`Compared with the current definition`),1),M(z(Y),{type:`button`,size:`sm`,variant:`outline`,class:`ml-auto`,disabled:s.value===null||l.value,title:s.value===null?`Workflow removed`:void 0,onClick:n[1]||=e=>r(`restore`,s.value)},{default:j(()=>[M(z(oc),{"data-icon":`inline-start`}),n[4]||=A(` Restore this version`,-1)]),_:1},8,[`disabled`,`title`])]),s.value===null?(R(),W(`p`,r9,`Workflow removed in this revision.`)):a.value===`yaml`?(R(),W(`pre`,i9,[U(`code`,null,[(R(!0),W(V,null,G(c.value,(e,t)=>(R(),W(`span`,{key:t,class:N([`block min-h-6 px-3 whitespace-pre-wrap`,{"bg-ok/10":e.kind===`add`,"bg-danger/10 text-danger":e.kind===`del`}])},[U(`span`,a9,B(e.kind===`add`?`+`:e.kind===`del`?`-`:``),1),A(B(e.text),1)],2))),128))])])):(R(),W(`div`,o9,[U(`div`,s9,[U(`span`,c9,`v`+B(o.value.version),1),U(`div`,l9,[M(B7,{yaml:s.value,marks:u.value},null,8,[`yaml`,`marks`])])]),U(`div`,u9,[n[5]||=U(`span`,{class:`text-xs font-medium text-muted-foreground`},`Current`,-1),U(`div`,d9,[M(B7,{yaml:e.current,marks:d.value},null,8,[`yaml`,`marks`])])])]))])):L(``,!0)]))}}),p9=`workflow-definitions`;function m9(e){let t=O(),n=q([]),r=q(``);async function i(){try{n.value=await t.history(p9),r.value=``}c Line truncated `),i=Array.from({length:n.length+1},()=>Array(r.length+1).fill(0));for(let e=n.length-1;e>=0;e--)for(let t=r.length-1;t>=0;t--)i[e][t]=n[e]===r[t]?i[e+1][t+1]+1:Math.max(i[e+1][t],i[e][t+1]);let a=[],o=0,s=0;for(;o<n.length&&s<r.length;)n[o]===r[s]?(a.push({kind:`same`,text:n[o++]}),s++):i[o+1][s]>=i[o][s+1]?a.push({kind:`del`,text:n[o++]}):a.push({kind:`add`,text:r[s++]});for(;o<n.length;)a.push({kind:`del`,text:n[o++]});for(;s<r.length;)a.push({kind:`add`,text:r[s++]});return a}function Z7(e){let t=bJ(e).toJS(),n=new Map;for(let r of eY(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 Q7(e,t,n){let r=Z7(e),i=Z7(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 $7={class:`grid h-[calc(100dvh-17rem)] min-h-[26rem] grid-cols-[18rem_1fr] gap-3`},e9={class:`min-h-0 divide-y divide-border overflow-y-auto rounded-lg border border-border`,"aria-label":`Revisions`},t9=[`aria-current`,`onClick`],n9={class:`flex items-center gap-2 text-sm`},r9={class:`font-mono text-xs text-fg-subtle`},i9=[`title`],a9={key:0,class:`px-3 py-2 text-sm text-muted-foreground`},o9={key:0,class:`flex min-h-0 flex-col gap-2`},s9={class:`flex items-center gap-2`},c9={class:`text-xs text-muted-foreground`},l9={key:0,class:`rounded-lg border border-border p-4 text-sm text-muted-foreground`},u9={key:1,class:`min-h-0 flex-1 overflow-auto rounded-lg border border-border py-2 font-mono text-[13px] leading-6`},d9={class:`inline-block w-4 select-none text-fg-subtle`},f9={key:2,class:`grid min-h-0 flex-1 grid-cols-2 gap-3`},p9={class:`flex min-h-0 flex-col gap-1`},m9={class:`text-xs font-medium text-muted-foreground`},h9={class:`min-h-0 flex-1`},g9={class:`flex min-h-0 flex-col gap-1`},_9={class:`min-h-0 flex-1`},v9=k({__name:`WorkflowHistory`,props:gt({revisions:{},current:{},error:{}},{selected:{default:0},selectedModifiers:{},mode:{default:`yaml`},modeModifiers:{}}),emits:gt([`restore`],[`update:selected`,`update:mode`]),setup(e,{emit:t}){let n=e,r=t,i=qe(e,`selected`),a=qe(e,`mode`);F(()=>n.revisions,e=>{e.some(e=>e.version===i.value)||(i.value=(e.find(e=>e.yaml!==n.current)??e[0])?.version??0)},{immediate:!0});let o=I(()=>n.revisions.find(e=>e.version===i.value)),s=I(()=>o.value?.yaml??null),c=I(()=>s.value===null?[]:X7(s.value,n.current)),l=I(()=>s.value!==null&&s.value===n.current),u=I(()=>s.value===null?{}:Q7(s.value,n.current,`removed`)),d=I(()=>s.value===null?{}:Q7(n.current,s.value,`added`)),f={added:`default`,edited:`secondary`,removed:`destructive`};return(t,n)=>(R(),W(`div`,$7,[U(`ol`,e9,[(R(!0),W(V,null,G(e.revisions,e=>(R(),W(`li`,{key:e.version},[U(`button`,{type:`button`,class:N([`block w-full px-3 py-2 text-left hover:bg-secondary`,e.version===i.value&&`bg-secondary`]),"aria-current":e.version===i.value,onClick:t=>i.value=e.version},[U(`span`,n9,[U(`span`,r9,`v`+B(e.version),1),M(z(en),{variant:f[e.change]},{default:j(()=>[A(B(e.change),1)]),_:2},1032,[`variant`])]),U(`span`,{class:`mt-0.5 block truncate text-xs text-muted-foreground`,title:e.at},B(e.actor||`unknown`)+` · `+B(e.source||`unknown`)+` · `+B(z(Sg)(e.at)),9,i9)],10,t9)]))),128)),e.revisions.length?L(``,!0):(R(),W(`li`,a9,B(e.error||`No recorded changes`),1))]),o.value?(R(),W(`div`,o9,[U(`div`,s9,[M(z(ub),{modelValue:a.value,"onUpdate:modelValue":n[0]||=e=>a.value=e},{default:j(()=>[M(z(fb),null,{default:j(()=>[M(z(pb),{value:`yaml`},{default:j(()=>[...n[2]||=[A(`YAML`,-1)]]),_:1}),M(z(pb),{value:`canvas`},{default:j(()=>[...n[3]||=[A(`Canvas`,-1)]]),_:1})]),_:1})]),_:1},8,[`modelValue`]),U(`span`,c9,B(l.value?`Same as the current definition`:`Compared with the current definition`),1),M(z(Y),{type:`button`,size:`sm`,variant:`outline`,class:`ml-auto`,disabled:s.value===null||l.value,title:s.value===null?`Workflow removed`:void 0,onClick:n[1]||=e=>r(`restore`,s.value)},{default:j(()=>[M(z(sc),{"data-icon":`inline-start`}),n[4]||=A(` Restore this version`,-1)]),_:1},8,[`disabled`,`title`])]),s.value===null?(R(),W(`p`,l9,`Workflow removed in this revision.`)):a.value===`yaml`?(R(),W(`pre`,u9,[U(`code`,null,[(R(!0),W(V,null,G(c.value,(e,t)=>(R(),W(`span`,{key:t,class:N([`block min-h-6 px-3 whitespace-pre-wrap`,{"bg-ok/10":e.kind===`add`,"bg-danger/10 text-danger":e.kind===`del`}])},[U(`span`,d9,B(e.kind===`add`?`+`:e.kind===`del`?`-`:``),1),A(B(e.text),1)],2))),128))])])):(R(),W(`div`,f9,[U(`div`,p9,[U(`span`,m9,`v`+B(o.value.version),1),U(`div`,h9,[M(K7,{yaml:s.value,marks:u.value},null,8,[`yaml`,`marks`])])]),U(`div`,g9,[n[5]||=U(`span`,{class:`text-xs font-medium text-muted-foreground`},`Current`,-1),U(`div`,_9,[M(K7,{yaml:e.current,marks:d.value},null,8,[`yaml`,`marks`])])])]))])):L(``,!0)]))}}),y9=`workflow-definitions`;function b9(e){let t=O(),n=q([]),r=q(``);async function i(){try{n.value=await t.history(y9),r.value=``}c Line truncated
@@ -14,50 +14,57 @@ const props = defineProps<{ id?: string; disabled?: boolean; units?: DurationUni
const model = defineModel<string>({ required: true }); const model = defineModel<string>({ required: true });
const units = computed(() => props.units ?? DURATION_UNITS); const units = computed(() => props.units ?? DURATION_UNITS);
const amount = ref(0); const amount = ref<string | number>(0);
const invalid = computed(() => amount.value !== "" && (!Number.isFinite(Number(amount.value)) || Number(amount.value) < 0));
const unit = ref<DurationUnit>("s"); const unit = ref<DurationUnit>("s");
watch( watch(
model, model,
(text) => { (text) => {
const ms = parseGoDuration(text ?? ""); const ms = parseGoDuration(text ?? "");
if (ms === null) return; if (ms === null) { amount.value = text ?? ""; return; }
if (joinDuration(amount.value, unit.value) === ms) return; if (amount.value !== "" && !invalid.value && joinDuration(Number(amount.value), unit.value) === ms) return;
const split = splitDuration(ms); const split = splitDuration(ms);
amount.value = split.value; unit.value = units.value.includes(split.unit) ? split.unit : (units.value[0] ?? "s");
unit.value = units.value.includes(split.unit) ? split.unit : "ms"; amount.value = ms / joinDuration(1, unit.value);
}, },
{ immediate: true }, { immediate: true },
); );
function emitChange() { function emitChange() {
if (!Number.isFinite(amount.value) || amount.value < 0) return; if (amount.value === "" || invalid.value) {
model.value = formatGoDuration(joinDuration(amount.value, unit.value)); model.value = String(amount.value);
return;
}
model.value = formatGoDuration(joinDuration(Number(amount.value), unit.value));
} }
</script> </script>
<template> <template>
<InputGroup class="w-48"> <div class="w-48">
<InputGroupInput <InputGroup>
:id="id" <InputGroupInput
v-model.number="amount" :id="id"
type="number" :model-value="amount"
min="0" type="text"
inputmode="decimal" :aria-invalid="invalid ? true : undefined"
class="font-mono" @update:model-value="(value: string | number) => { amount = value; emitChange(); }"
:disabled="disabled" inputmode="decimal"
@change="emitChange" class="font-mono"
/>
<InputGroupAddon align="inline-end">
<select
v-model="unit"
aria-label="Unit"
class="bg-transparent font-mono text-xs text-muted-foreground outline-none"
:disabled="disabled" :disabled="disabled"
@change="emitChange" />
> <InputGroupAddon align="inline-end">
<option v-for="u in units" :key="u" :value="u">{{ u }}</option> <select
</select> v-model="unit"
</InputGroupAddon> aria-label="Unit"
</InputGroup> class="bg-transparent font-mono text-xs text-muted-foreground outline-none"
:disabled="disabled"
@change="emitChange"
>
<option v-for="u in units" :key="u" :value="u">{{ u }}</option>
</select>
</InputGroupAddon>
</InputGroup>
<p v-if="invalid" role="alert" class="mt-1 text-xs text-danger">Enter a number zero or greater.</p>
</div>
</template> </template>
+5 -1
View File
@@ -3,10 +3,14 @@ import { computed } from "vue";
import { TableCell, TableRow } from "@/components/ui/table"; import { TableCell, TableRow } from "@/components/ui/table";
import { ago } from "@/lib/format"; import { ago } from "@/lib/format";
import { useOrgStore } from "@/stores/org";
import { activityDetail } from "./activity-detail"; import { activityDetail } from "./activity-detail";
import { describeTimelineEvent } from "@/tasks/timeline-event"; import { describeTimelineEvent } from "@/tasks/timeline-event";
import { useTasksStore, type ActivityEvent } from "@/stores/tasks"; import { useTasksStore, type ActivityEvent } from "@/stores/tasks";
const identities = useOrgStore();
identities.watchIdentities();
/** /**
* One row of the live activity table. A row whose event resolves to a task is * One row of the live activity table. A row whose event resolves to a task is
* a link to it, and has to behave like one for a keyboard: Enter and Space both * a link to it, and has to behave like one for a keyboard: Enter and Space both
@@ -20,7 +24,7 @@ const taskID = computed(() => tasks.taskIDFor(props.event));
// The detail is cut to one line by activityDetail and clamped again in the // The detail is cut to one line by activityDetail and clamped again in the
// cell so a long unbroken token (a path, a URL, a hash) cannot widen the column // cell so a long unbroken token (a path, a URL, a hash) cannot widen the column
// past the table. Unclamped, this made the dashboard 7,481px tall. // past the table. Unclamped, this made the dashboard 7,481px tall.
const detail = computed(() => activityDetail(props.event)); const detail = computed(() => activityDetail(props.event, identities.identityName));
function open() { function open() {
if (taskID.value > 0) emit("open", taskID.value); if (taskID.value > 0) emit("open", taskID.value);
+5 -1
View File
@@ -27,6 +27,7 @@ import { useSessionStore } from "@/stores/session";
import { useTasksStore } from "@/stores/tasks"; import { useTasksStore } from "@/stores/tasks";
import { useAlerts } from "@/alerts/use-alerts"; import { useAlerts } from "@/alerts/use-alerts";
import ActivityRow from "./ActivityRow.vue"; import ActivityRow from "./ActivityRow.vue";
import { useOrgStore } from "@/stores/org";
import { activityDetail } from "./activity-detail"; import { activityDetail } from "./activity-detail";
import { import {
ACTIVITY_FILTERS, ACTIVITY_FILTERS,
@@ -37,6 +38,9 @@ import {
import { groupActivity, type ActivityGroup } from "./activity-group"; import { groupActivity, type ActivityGroup } from "./activity-group";
import { describeTimelineEvent } from "@/tasks/timeline-event"; import { describeTimelineEvent } from "@/tasks/timeline-event";
const identities = useOrgStore();
identities.watchIdentities();
/** /**
* The last 50 events, newest first, with the stream's own state on the card and * The last 50 events, newest first, with the stream's own state on the card and
* the All / Tasks / System filter over it. The filter and the grouping rules * the All / Tasks / System filter over it. The filter and the grouping rules
@@ -82,7 +86,7 @@ function isOpen(group: ActivityGroup): boolean {
// The collapsed group row shows what its newest event would have shown, so // The collapsed group row shows what its newest event would have shown, so
// expanding and collapsing moves no information. // expanding and collapsing moves no information.
function groupDetail(group: ActivityGroup) { function groupDetail(group: ActivityGroup) {
return activityDetail(group.representative); return activityDetail(group.representative, identities.identityName);
} }
function groupWhen(group: ActivityGroup) { function groupWhen(group: ActivityGroup) {
+8 -1
View File
@@ -19,6 +19,8 @@ const CELL_LIMIT = 160;
export interface ActivityDetailInput { export interface ActivityDetailInput {
detail?: unknown; detail?: unknown;
message?: unknown; message?: unknown;
actor_id?: string;
principal_id?: string;
} }
/** The cell's content: the rendered line, the payload, and whether they differ. */ /** The cell's content: the rendered line, the payload, and whether they differ. */
@@ -35,8 +37,13 @@ export interface ActivityDetail {
*/ */
export function activityDetail( export function activityDetail(
event: ActivityDetailInput | undefined, event: ActivityDetailInput | undefined,
identityName?: (id: string) => string,
): ActivityDetail { ): ActivityDetail {
const full = String(event?.detail || event?.message || ""); let full = String(event?.detail || event?.message || "");
if (identityName) {
for (const id of [event?.actor_id, event?.principal_id])
if (id) full = full.replaceAll(id, identityName(id));
}
if (!full) return { text: "", full: "", truncated: false }; if (!full) return { text: "", full: "", truncated: false };
// The first line that says something: agent output often opens with blanks. // The first line that says something: agent output often opens with blanks.
+7 -2
View File
@@ -31,6 +31,7 @@ const policies = ref<Policy[]>([]);
const shipped = ref<string[]>([]); const shipped = ref<string[]>([]);
const error = ref<string | null>(null); const error = ref<string | null>(null);
const saving = ref(false); const saving = ref(false);
const loading = ref(true);
const blank = (): Policy => ({ id: "", level: "org", text: "" }); const blank = (): Policy => ({ id: "", level: "org", text: "" });
const draft = ref<Policy>(blank()); const draft = ref<Policy>(blank());
@@ -53,6 +54,7 @@ const canSave = computed(
); );
async function load(): Promise<void> { async function load(): Promise<void> {
loading.value = true;
try { try {
const response = await api.policies<{ policies: Policy[]; shipped: string[] }>(); const response = await api.policies<{ policies: Policy[]; shipped: string[] }>();
policies.value = response.policies; policies.value = response.policies;
@@ -60,6 +62,8 @@ async function load(): Promise<void> {
error.value = null; error.value = null;
} catch (err) { } catch (err) {
error.value = (err as Error).message; error.value = (err as Error).message;
} finally {
loading.value = false;
} }
} }
@@ -97,7 +101,7 @@ onMounted(load);
<template> <template>
<div> <div>
<p v-if="error" role="alert" class="mb-4 text-sm text-danger">{{ error }}</p> <div v-if="error" role="alert" class="mb-4 text-sm text-danger"><p>{{ error }}</p><Button variant="outline" size="sm" @click="load">Retry</Button></div>
<Card class="mb-4"> <Card class="mb-4">
<CardHeader> <CardHeader>
@@ -107,7 +111,8 @@ onMounted(load);
</CardAction> </CardAction>
</CardHeader> </CardHeader>
<CardContent class="flex flex-col gap-3"> <CardContent class="flex flex-col gap-3">
<p v-if="!policies.length" class="text-sm text-fg-subtle">No policies yet.</p> <p v-if="loading" role="status" class="text-sm text-fg-muted">Loading policies…</p>
<p v-else-if="!error && !policies.length" class="text-sm text-fg-subtle">No policies yet.</p>
<div <div
v-for="p in policies" v-for="p in policies"
:key="`${p.level}/${scope(p)}/${p.id}`" :key="`${p.level}/${scope(p)}/${p.id}`"
+2
View File
@@ -5,6 +5,7 @@ import { Plus, Trash2 } from "@lucide/vue";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input"; import { Input } from "@/components/ui/input";
import { useSettingsStore } from "@/stores/settings"; import { useSettingsStore } from "@/stores/settings";
import SettingsSaveBar from "@/settings/SettingsSaveBar.vue";
import DraftHint from "@/settings/DraftHint.vue"; import DraftHint from "@/settings/DraftHint.vue";
/** /**
@@ -92,5 +93,6 @@ const eyebrow = "mb-2 text-[11px] font-medium tracking-[0.06em] text-fg-subtle u
</form> </form>
</div> </div>
</template> </template>
<SettingsSaveBar />
</div> </div>
</template> </template>
+3 -2
View File
@@ -73,6 +73,7 @@ function setQuery(patch: Record<string, string | undefined>) {
} }
const windows: Record<string, number> = { "24h": 86_400_000, "7d": 604_800_000, "30d": 2_592_000_000 }; const windows: Record<string, number> = { "24h": 86_400_000, "7d": 604_800_000, "30d": 2_592_000_000 };
const actorName = (id: string) => entries.value.find((entry) => entry.actor === id)?.actor_name || id;
const actors = computed(() => [...new Set(entries.value.map((e) => e.actor))].sort()); const actors = computed(() => [...new Set(entries.value.map((e) => e.actor))].sort());
const sectionOptions = computed(() => { const sectionOptions = computed(() => {
const options = catalog.value.map((r) => ({ value: r.kind, label: r.title })); const options = catalog.value.map((r) => ({ value: r.kind, label: r.title }));
@@ -130,7 +131,7 @@ const restorable = (entry: AuditEntry) =>
<SelectTrigger class="w-48" aria-label="Changed by"><SelectValue /></SelectTrigger> <SelectTrigger class="w-48" aria-label="Changed by"><SelectValue /></SelectTrigger>
<SelectContent> <SelectContent>
<SelectItem :value="ALL">Anyone</SelectItem> <SelectItem :value="ALL">Anyone</SelectItem>
<SelectItem v-for="a in actors" :key="a" :value="a">{{ a }}</SelectItem> <SelectItem v-for="a in actors" :key="a" :value="a">{{ actorName(a) }}</SelectItem>
</SelectContent> </SelectContent>
</Select> </Select>
<Select v-model="since"> <Select v-model="since">
@@ -178,7 +179,7 @@ const restorable = (entry: AuditEntry) =>
</TableCell> </TableCell>
<TableCell class="font-mono text-xs">{{ entry.version }}</TableCell> <TableCell class="font-mono text-xs">{{ entry.version }}</TableCell>
<TableCell class="truncate" :title="`${entry.actor} · ${entry.source}`"> <TableCell class="truncate" :title="`${entry.actor} · ${entry.source}`">
{{ entry.actor }}<span class="text-fg-subtle"> · {{ entry.source }}</span> {{ entry.actor_name || entry.actor }}<span class="text-fg-subtle"> · {{ entry.source }}</span>
</TableCell> </TableCell>
<TableCell class="py-1 text-right"> <TableCell class="py-1 text-right">
<Button <Button
+7 -15
View File
@@ -45,7 +45,7 @@ const resources = computed(() => resourcesForPage(catalog.value, "schedules"));
const jobs = computed(() => store.drafts[KIND]?.value as Job[] | undefined); const jobs = computed(() => store.drafts[KIND]?.value as Job[] | undefined);
const error = computed(() => store.pageErrorFor(KIND)); const error = computed(() => store.pageErrorFor(KIND));
const issues = computed(() => store.issuesFor(KIND)); const issues = computed(() => store.issuesFor(KIND));
const jobIssue = (i: number) => issues.value.find((entry) => entry.path === `${i}.id`); const jobIssue = (i: number) => issues.value.find((entry) => entry.path.startsWith(`${i}.`));
const whenKinds = [ const whenKinds = [
{ value: "interval", label: "Every" }, { value: "interval", label: "Every" },
@@ -67,9 +67,9 @@ const unsaved = computed(() => store.changesFor(KIND).length > 0);
function add() { function add() {
if (unsaved.value || !jobs.value) return; if (unsaved.value || !jobs.value) return;
jobs.value.push({ jobs.value.push({
id: "", id: crypto.randomUUID(),
kind: "workflow", kind: "workflow",
detail: "", detail: "Scheduled task",
pool: "", pool: "",
schedule: { kind: "interval", interval: "24h0m0s" }, schedule: { kind: "interval", interval: "24h0m0s" },
target: {}, target: {},
@@ -122,12 +122,10 @@ const whenKind = (job: Job) => job.schedule.kind || "interval";
<span v-if="job.next_run" class="text-xs text-fg-subtle">Next run {{ new Date(job.next_run).toLocaleString() }}</span> <span v-if="job.next_run" class="text-xs text-fg-subtle">Next run {{ new Date(job.next_run).toLocaleString() }}</span>
</template> </template>
<template #default="{ item: job, index: i }"> <template #default="{ item: job, index: i }">
<SettingRow label="ID" :for="`job-${i}-id`"> <SettingRow label="Schedule name" :for="`job-${i}-name`" hint="Used as the task title for scheduled workflows.">
<div class="flex flex-wrap items-center gap-3"> <Input :id="`job-${i}-name`" v-model="job.detail" class="max-w-md" />
<Input :id="`job-${i}-id`" v-model="job.id" class="max-w-sm font-mono" :aria-invalid="jobIssue(i) ? true : undefined" /> <DraftHint :kind="KIND" :path="`${i}.detail`" />
<DraftHint :kind="KIND" :path="`${i}.id`" /> <p v-if="jobIssue(i)" class="mt-1.5 text-xs text-danger" role="alert">{{ jobIssue(i)?.message }}</p>
</div>
<p v-if="jobIssue(i)" class="mt-1.5 text-xs text-danger">{{ jobIssue(i)?.message }}</p>
</SettingRow> </SettingRow>
<SettingRow label="Does"> <SettingRow label="Does">
<div class="flex flex-wrap items-center gap-3"> <div class="flex flex-wrap items-center gap-3">
@@ -144,12 +142,6 @@ const whenKind = (job: Job) => job.schedule.kind || "interval";
<DraftHint :kind="KIND" :path="`${i}.target.chat_id`" /> <DraftHint :kind="KIND" :path="`${i}.target.chat_id`" />
</div> </div>
</SettingRow> </SettingRow>
<SettingRow v-else label="Task title" :for="`job-${i}-title`" hint="Empty: the ID.">
<div class="flex flex-wrap items-center gap-3">
<Input :id="`job-${i}-title`" v-model="job.detail" class="max-w-md" />
<DraftHint :kind="KIND" :path="`${i}.detail`" />
</div>
</SettingRow>
<SettingRow :label="job.kind === 'chat' ? 'Message' : 'Instructions'" :for="`job-${i}-text`"> <SettingRow :label="job.kind === 'chat' ? 'Message' : 'Instructions'" :for="`job-${i}-text`">
<Textarea :id="`job-${i}-text`" v-model="job.payload.text" :rows="3" /> <Textarea :id="`job-${i}-text`" v-model="job.payload.text" :rows="3" />
<DraftHint :kind="KIND" :path="`${i}.payload.text`" /> <DraftHint :kind="KIND" :path="`${i}.payload.text`" />
+24 -10
View File
@@ -14,7 +14,8 @@ import {
import { Spinner } from "@/components/ui/spinner"; import { Spinner } from "@/components/ui/spinner";
import { Badge } from "@/components/ui/badge"; import { Badge } from "@/components/ui/badge";
import { useSettingsStore } from "@/stores/settings"; import { useSettingsStore } from "@/stores/settings";
import { formatValue } from "./changes"; import { diffValues, formatValue } from "./changes";
import type { SettingsSchema } from "@/workflows/workflow-yaml";
const store = useSettingsStore(); const store = useSettingsStore();
const { reviewing } = storeToRefs(store); const { reviewing } = storeToRefs(store);
@@ -23,11 +24,24 @@ const saving = ref(false);
const titleOf = (kind: string) => const titleOf = (kind: string) =>
store.catalog.find((item) => item.kind === kind)?.title ?? kind; store.catalog.find((item) => item.kind === kind)?.title ?? kind;
function fieldLabel(kind: string, path: string): string {
let schema: SettingsSchema;
try { schema = JSON.parse(store.catalog.find((item) => item.kind === kind)?.schema_json || "{}"); }
catch { schema = {}; }
return path.split(".").map((part) => {
if (/^\d+$/.test(part)) {
schema = schema.items ?? {};
return `Item ${Number(part) + 1}`;
}
schema = schema.properties?.[part] ?? schema.additionalProperties ?? {};
return schema.title || part.replaceAll("_", " ");
}).join(" · ");
}
const sections = computed(() => const sections = computed(() =>
store.dirtyKinds.map((kind) => ({ store.dirtyKinds.map((kind) => ({
kind, kind,
title: titleOf(kind), title: titleOf(kind),
changes: store.changesFor(kind), changes: store.changesFor(kind).flatMap((change) => diffValues(change.before, change.after, change.path, true)),
issues: store.issuesFor(kind), issues: store.issuesFor(kind),
error: store.stateFor(kind).error, error: store.stateFor(kind).error,
restart: restart:
@@ -36,7 +50,7 @@ const sections = computed(() =>
})), })),
); );
const count = computed(() => const count = computed(() =>
sections.value.reduce((n, s) => n + s.changes.length, 0), store.dirtyKinds.reduce((n, kind) => n + store.changesFor(kind).length, 0),
); );
// Invalid fields block Save, and are listed in the bar so the operator knows // Invalid fields block Save, and are listed in the bar so the operator knows
// before opening the review. Both read the store's one draft diff. // before opening the review. Both read the store's one draft diff.
@@ -63,18 +77,18 @@ async function save() {
<template> <template>
<div <div
v-if="count > 0" v-if="count > 0"
class="sticky bottom-4 z-30 mt-auto rounded-lg border border-border bg-popover shadow-[var(--shadow-md)]" class="sticky bottom-24 z-30 mt-auto rounded-lg border border-border bg-popover shadow-[var(--shadow-md)]"
role="region" role="region"
aria-label="Unsaved changes" aria-label="Unsaved changes"
> >
<div class="flex items-center gap-3 px-4 py-3"> <div class="flex flex-wrap items-center gap-3 px-4 py-3">
<span <span
class="size-2 shrink-0 rounded-full" class="size-2 shrink-0 rounded-full"
:class="invalid.length ? 'bg-danger' : 'bg-primary'" :class="invalid.length ? 'bg-danger' : 'bg-primary'"
aria-hidden="true" aria-hidden="true"
/> />
<p class="min-w-0 flex-1 truncate text-sm"> <p class="min-w-40 flex-1 text-sm">
<span class="font-medium">{{ count }} unsaved {{ count === 1 ? "change" : "changes" }}</span> <span class="font-medium">{{ count }} unsaved settings {{ count === 1 ? "change" : "changes" }}</span>
<span class="text-fg-subtle"> · {{ sections.map((s) => s.title).join(", ") }}</span> <span class="text-fg-subtle"> · {{ sections.map((s) => s.title).join(", ") }}</span>
</p> </p>
<Button variant="ghost" size="sm" @click="discardAll">Discard</Button> <Button variant="ghost" size="sm" @click="discardAll">Discard</Button>
@@ -123,9 +137,9 @@ async function save() {
</header> </header>
<ul class="divide-y divide-border font-mono text-xs"> <ul class="divide-y divide-border font-mono text-xs">
<li v-for="change in section.changes" :key="change.path" class="px-3 py-2"> <li v-for="change in section.changes" :key="change.path" class="px-3 py-2">
<p class="mb-1 text-fg-subtle">{{ change.path }}</p> <p class="mb-1 font-sans font-medium">{{ fieldLabel(section.kind, change.path) }}</p>
<p class="truncate text-danger">− {{ formatValue(change.before) }}</p> <p class="whitespace-pre-wrap break-words text-danger"><span class="font-sans">Before: </span>{{ formatValue(change.before) }}</p>
<p class="truncate text-ok">+ {{ formatValue(change.after) }}</p> <p class="whitespace-pre-wrap break-words text-ok"><span class="font-sans">After: </span>{{ formatValue(change.after) }}</p>
</li> </li>
</ul> </ul>
<ul <ul
+3 -20
View File
@@ -1,11 +1,10 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, onBeforeUnmount, onMounted } from "vue"; import { computed } from "vue";
import { useRoute, useRouter } from "vue-router"; import { useRoute } from "vue-router";
import { hiddenPaths, settingsNav } from "@/lib/nav"; import { hiddenPaths, settingsNav } from "@/lib/nav";
import { cn } from "@/lib/utils"; import { cn } from "@/lib/utils";
import { useSessionStore } from "@/stores/session"; import { useSessionStore } from "@/stores/session";
import { useSettingsStore } from "@/stores/settings";
import RestartPendingBanner from "./RestartPendingBanner.vue"; import RestartPendingBanner from "./RestartPendingBanner.vue";
import SettingsSaveBar from "./SettingsSaveBar.vue"; import SettingsSaveBar from "./SettingsSaveBar.vue";
@@ -13,22 +12,6 @@ const route = useRoute();
const session = useSessionStore(); const session = useSessionStore();
const items = computed(() => settingsNav(hiddenPaths(session.sections))); const items = computed(() => settingsNav(hiddenPaths(session.sections)));
// Drafts live in the store, so moving between Settings pages keeps them;
// leaving Settings, or the page, with edits unsaved asks first.
const store = useSettingsStore();
const dirty = () => store.dirtyKinds.length > 0;
const removeGuard = useRouter().beforeEach((to) => {
if (to.meta.settings || !dirty()) return true;
return window.confirm("Leave Settings with unsaved changes?");
});
const warnUnload = (event: BeforeUnloadEvent) => {
if (dirty()) event.preventDefault();
};
onMounted(() => window.addEventListener("beforeunload", warnUnload));
onBeforeUnmount(() => {
removeGuard();
window.removeEventListener("beforeunload", warnUnload);
});
</script> </script>
<template> <template>
@@ -65,7 +48,7 @@ onBeforeUnmount(() => {
</nav> </nav>
<!-- At least a screen tall, so the sticky save bar always rests at the <!-- At least a screen tall, so the sticky save bar always rests at the
viewport's bottom edge rather than under the last setting. --> viewport's bottom edge rather than under the last setting. -->
<div class="flex min-h-screen min-w-0 flex-1 flex-col"> <div class="mx-auto flex min-h-screen w-full min-w-0 max-w-[80ch] flex-1 flex-col">
<RestartPendingBanner /> <RestartPendingBanner />
<!-- Room below the last setting, so it can be scrolled up to eye level. --> <!-- Room below the last setting, so it can be scrolled up to eye level. -->
<div class="pb-[40vh]"> <div class="pb-[40vh]">
+7 -5
View File
@@ -23,18 +23,20 @@ const same = (a: unknown, b: unknown) =>
* array of plain values is one leaf, because its entries have no identity of * array of plain values is one leaf, because its entries have no identity of
* their own. A row added or removed is a single change. * their own. A row added or removed is a single change.
*/ */
export function diffValues(before: unknown, after: unknown, path = ""): Change[] { export function diffValues(before: unknown, after: unknown, path = "", expandRows = false): Change[] {
if (same(before, after)) return []; if (same(before, after)) return [];
const at = (key: string | number) => (path ? `${path}.${key}` : String(key)); const at = (key: string | number) => (path ? `${path}.${key}` : String(key));
if (isRecord(before) && isRecord(after)) { if ((isRecord(before) && isRecord(after)) || (expandRows && (isRecord(before) || isRecord(after)))) {
const keys = [...new Set([...Object.keys(before), ...Object.keys(after)])]; const left = isRecord(before) ? before : {};
return keys.flatMap((key) => diffValues(before[key], after[key], at(key))); const right = isRecord(after) ? after : {};
const keys = [...new Set([...Object.keys(left), ...Object.keys(right)])];
return keys.flatMap((key) => diffValues(left[key], right[key], at(key), expandRows));
} }
const rows = (v: unknown) => Array.isArray(v) && v.some(isRecord); const rows = (v: unknown) => Array.isArray(v) && v.some(isRecord);
if (Array.isArray(before) && Array.isArray(after) && (rows(before) || rows(after))) { if (Array.isArray(before) && Array.isArray(after) && (rows(before) || rows(after))) {
const length = Math.max(before.length, after.length); const length = Math.max(before.length, after.length);
return Array.from({ length }, (_, i) => diffValues(before[i], after[i], at(i))).flat(); return Array.from({ length }, (_, i) => diffValues(before[i], after[i], at(i), expandRows)).flat();
} }
return [{ path, before, after }]; return [{ path, before, after }];
} }
+5
View File
@@ -63,6 +63,10 @@ export const useOrgStore = defineStore("org", () => {
const session = useSessionStore(); const session = useSessionStore();
let stop: (() => void) | undefined; let stop: (() => void) | undefined;
function identityName(id: string): string {
return identities.value.find((actor) => actor.id === id)?.display_name || (/^[0-9a-f]+(?:-[0-9a-f]+){4}$/i.test(id) ? "Unavailable identity" : id);
}
async function loadIdentities(): Promise<void> { async function loadIdentities(): Promise<void> {
try { try {
identities.value = (await api.identities<{ identities: Identity[] }>()).identities; identities.value = (await api.identities<{ identities: Identity[] }>()).identities;
@@ -111,6 +115,7 @@ export const useOrgStore = defineStore("org", () => {
loadOrg, loadOrg,
viewOrg, viewOrg,
identities, identities,
identityName,
identityError, identityError,
identityBusy, identityBusy,
watchIdentities, watchIdentities,
+13 -1
View File
@@ -1,5 +1,5 @@
import { defineStore } from "pinia"; import { defineStore } from "pinia";
import { computed, onScopeDispose, reactive, ref } from "vue"; import { computed, onScopeDispose, reactive, ref, watch } from "vue";
import { useSessionStore } from "./session.ts"; import { useSessionStore } from "./session.ts";
import { api } from "../lib/api.ts"; import { api } from "../lib/api.ts";
import type { ConfigView } from "../settings/types.ts"; import type { ConfigView } from "../settings/types.ts";
@@ -114,6 +114,7 @@ export interface ResourceRevision {
version: number; version: number;
value: unknown; value: unknown;
actor: string; actor: string;
actor_name?: string;
source: string; source: string;
request_id: string; request_id: string;
at?: string; at?: string;
@@ -129,6 +130,7 @@ export interface AuditEntry {
new_value: unknown; new_value: unknown;
version: number; version: number;
actor: string; actor: string;
actor_name?: string;
source: string; source: string;
at?: string; at?: string;
} }
@@ -322,6 +324,16 @@ export const useSettingsStore = defineStore("settings", () => {
.filter((kind) => changesFor(kind).length > 0), .filter((kind) => changesFor(kind).length > 0),
); );
// Drafts survive in-app navigation; only unloading the document can lose them.
const warnUnload = (event: BeforeUnloadEvent) => event.preventDefault();
if (typeof window !== "undefined") {
watch(dirtyKinds, (kinds) => {
window.removeEventListener("beforeunload", warnUnload);
if (kinds.length) window.addEventListener("beforeunload", warnUnload);
});
onScopeDispose(() => window.removeEventListener("beforeunload", warnUnload));
}
/** Invalid fields across every dirty section. Derived from dirtyKinds, so a /** Invalid fields across every dirty section. Derived from dirtyKinds, so a
* save can only be blocked by a section that has something to save. */ * save can only be blocked by a section that has something to save. */
const invalidFields = computed<BlockingField[]>(() => const invalidFields = computed<BlockingField[]>(() =>
+1
View File
@@ -82,6 +82,7 @@ export const useWorkflowsStore = defineStore("workflows", () => {
return { return {
state, state,
error: computed(() => settings.catalogError || state.value.error),
collection, collection,
shipped, shipped,
stepTypes, stepTypes,
+3 -1
View File
@@ -127,6 +127,7 @@ const startedAt = computed(() => {
timeLimit timeLimit
}}</span> }}</span>
</div> </div>
<p v-if="attempt.error" role="alert" class="mb-3 whitespace-pre-wrap break-words text-sm text-danger">{{ attempt.error }}</p>
<ol <ol
v-if="stages.length" v-if="stages.length"
:aria-label="`Stages recorded in attempt ${attempt.attempt}`" :aria-label="`Stages recorded in attempt ${attempt.attempt}`"
@@ -143,7 +144,8 @@ const startedAt = computed(() => {
</ol> </ol>
<Empty v-else> <Empty v-else>
<EmptyHeader> <EmptyHeader>
<EmptyTitle>No stages</EmptyTitle> <EmptyTitle>No workflow steps recorded</EmptyTitle>
<EmptyDescription>This attempt has no recorded workflow step execution.</EmptyDescription>
</EmptyHeader> </EmptyHeader>
</Empty> </Empty>
</div> </div>
+3 -3
View File
@@ -4,7 +4,7 @@ import { ArrowUpRight } from "@lucide/vue";
import { ago, compact } from "@/lib/format"; import { ago, compact } from "@/lib/format";
import { cn } from "@/lib/utils"; import { cn } from "@/lib/utils";
import { statusKind, statusLabel } from "@/lib/task-meta"; import { stageStatusMeta } from "./stage-rail";
import StageRail from "./StageRail.vue"; import StageRail from "./StageRail.vue";
import { STATUS_FILL } from "@/lib/status"; import { STATUS_FILL } from "@/lib/status";
import { useTaskRun } from "./use-task-run"; import { useTaskRun } from "./use-task-run";
@@ -15,7 +15,7 @@ import { duration } from "./timeline-event";
const run = useTaskRun(); const run = useTaskRun();
const attempts = computed(() => [...(run.attempts?.attempts ?? [])].reverse()); const attempts = computed(() => [...(run.attempts?.attempts ?? [])].reverse());
const dot = (status?: string) => STATUS_FILL[statusKind(status ?? "")]; const dot = (status?: string) => STATUS_FILL[stageStatusMeta(status).kind];
const heading = "mb-2 text-[11px] font-medium tracking-[0.06em] text-fg-subtle uppercase"; const heading = "mb-2 text-[11px] font-medium tracking-[0.06em] text-fg-subtle uppercase";
</script> </script>
@@ -38,7 +38,7 @@ const heading = "mb-2 text-[11px] font-medium tracking-[0.06em] text-fg-subtle u
> >
<span class="size-2 shrink-0 rounded-full" :class="dot(a.status)" aria-hidden="true" /> <span class="size-2 shrink-0 rounded-full" :class="dot(a.status)" aria-hidden="true" />
<span class="flex-1">Attempt {{ a.attempt }}</span> <span class="flex-1">Attempt {{ a.attempt }}</span>
<span class="text-xs text-fg-subtle">{{ a.status ? statusLabel(a.status) : "" }}</span> <span class="text-xs text-fg-subtle">{{ a.status ? stageStatusMeta(a.status).label : "" }}</span>
</button> </button>
<p v-if="a.started_at" class="px-3 pb-1 pl-7 text-xs text-fg-subtle"> <p v-if="a.started_at" class="px-3 pb-1 pl-7 text-xs text-fg-subtle">
{{ ago(a.started_at) }}<template v-if="a.duration_ms"> · {{ duration(a.duration_ms) }}</template> {{ ago(a.started_at) }}<template v-if="a.duration_ms"> · {{ duration(a.duration_ms) }}</template>
+3 -2
View File
@@ -10,6 +10,7 @@
* the agent's report rather than as archie's verdict. * the agent's report rather than as archie's verdict.
*/ */
import type { StatusKind } from "@/lib/status"; import type { StatusKind } from "@/lib/status";
import { statusKind, statusLabel } from "@/lib/task-meta";
import { describeTimelineEvent, type TimelineLine } from "./timeline-event"; import { describeTimelineEvent, type TimelineLine } from "./timeline-event";
import type { TaskEvent } from "./task-run"; import type { TaskEvent } from "./task-run";
@@ -25,12 +26,12 @@ const STAGE_STATUS: Record<string, StageStatusMeta> = {
interrupted: { label: "interrupted", kind: "warn" }, interrupted: { label: "interrupted", kind: "warn" },
running: { label: "running", kind: "info" }, running: { label: "running", kind: "info" },
skipped: { label: "skipped", kind: "idle" }, skipped: { label: "skipped", kind: "idle" },
unknown: { label: "unknown", kind: "idle" }, unknown: { label: "Outcome not recorded", kind: "idle" },
}; };
export function stageStatusMeta(status?: string | null): StageStatusMeta { export function stageStatusMeta(status?: string | null): StageStatusMeta {
return ( return (
STAGE_STATUS[status ?? ""] || { label: status || "unknown", kind: "idle" } STAGE_STATUS[status ?? ""] || { label: statusLabel(status || "unknown"), kind: statusKind(status || "unknown") }
); );
} }
+1
View File
@@ -73,6 +73,7 @@ export interface Stage {
export interface Attempt { export interface Attempt {
attempt: number; attempt: number;
error?: string;
status?: string; status?: string;
started_at?: string; started_at?: string;
duration_ms?: number; duration_ms?: number;
+14 -7
View File
@@ -1,6 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { NativeSelect, NativeSelectOption } from "@/components/ui/native-select"; import { NativeSelect, NativeSelectOption } from "@/components/ui/native-select";
import { computed, ref } from "vue"; import { computed, ref, useId } from "vue";
import { CircleHelp, Plus, Trash2, X } from "@lucide/vue"; import { CircleHelp, Plus, Trash2, X } from "@lucide/vue";
import { parse, stringify } from "yaml"; import { parse, stringify } from "yaml";
@@ -16,8 +16,9 @@ import type { InputSpec } from "./bind-event";
import { inputValue } from "./work-request"; import { inputValue } from "./work-request";
import WorkflowPicker from "./WorkflowPicker.vue"; import WorkflowPicker from "./WorkflowPicker.vue";
import { stepTitle } from "./workflow-graph"; import { stepTitle } from "./workflow-graph";
import { settingsProblem, type SettingsSchema, type StepTypeInfo } from "./workflow-yaml"; import { stepControlsProblem, settingsProblem, type SettingsSchema, type StepTypeInfo } from "./workflow-yaml";
const uid = useId();
const props = defineProps<{ yaml: string; path: StepPath; vocabulary: StepTypeInfo[]; workflows: WorkflowDefinitionEntry[]; modelAliases: string[] }>(); const props = defineProps<{ yaml: string; path: StepPath; vocabulary: StepTypeInfo[]; workflows: WorkflowDefinitionEntry[]; modelAliases: string[] }>();
const emit = defineEmits<{ "update:yaml": [string]; close: []; remove: [] }>(); const emit = defineEmits<{ "update:yaml": [string]; close: []; remove: [] }>();
@@ -46,6 +47,7 @@ const settings = computed<Record<string, unknown>>(() =>
typeof step.value.settings === "object" && step.value.settings !== null ? (step.value.settings as Record<string, unknown>) : {}, typeof step.value.settings === "object" && step.value.settings !== null ? (step.value.settings as Record<string, unknown>) : {},
); );
const earlier = computed(() => earlierStepIDs(props.yaml, props.path)); const earlier = computed(() => earlierStepIDs(props.yaml, props.path));
const flowProblem = computed(() => stepControlsProblem(step.value));
const problem = computed(() => const problem = computed(() =>
info.value?.settings && step.value.settings ? settingsProblem(step.value.settings, info.value.settings, "settings") : "", info.value?.settings && step.value.settings ? settingsProblem(step.value.settings, info.value.settings, "settings") : "",
); );
@@ -90,7 +92,8 @@ function setField(key: string, value: unknown): void {
// Retry is one object: a field edit merges into it so attempts and backoff do // Retry is one object: a field edit merges into it so attempts and backoff do
// not clobber each other, and clearing both drops the key. // not clobber each other, and clearing both drops the key.
function setRetry(next: { attempts?: number; backoff?: string }): void { function setRetry(next: { attempts?: number; backoff?: string }): void {
setField("retry", { ...(step.value.retry as object), ...next }); const policy = { ...(step.value.retry as { attempts?: number; backoff?: string }), ...next };
setField("retry", policy.attempts === undefined && !policy.backoff ? undefined : { ...policy, attempts: policy.attempts ?? 1 });
} }
function setSetting(key: string, value: unknown): void { function setSetting(key: string, value: unknown): void {
const next = { ...settings.value, [key]: value }; const next = { ...settings.value, [key]: value };
@@ -325,12 +328,15 @@ const text = (key: string) => (typeof settings.value[key] === "string" ? (settin
<section class="space-y-2"> <section class="space-y-2">
<div class="text-xs font-medium text-muted-foreground">Flow</div> <div class="text-xs font-medium text-muted-foreground">Flow</div>
<p class="text-xs text-fg-muted">Leave the condition empty to always run. Use a field such as inputs.enabled, !inputs.skip, or steps.plan.result.ready == true.</p>
<p v-if="flowProblem" role="alert" class="text-xs text-danger">{{ flowProblem }}</p>
<div class="divide-y divide-border rounded-md border border-border"> <div class="divide-y divide-border rounded-md border border-border">
<label class="flex min-h-10 items-center gap-3 px-3 py-1.5"> <label class="flex min-h-10 items-center gap-3 px-3 py-1.5">
<span class="flex-1 text-[13px]">Run only when</span> <span class="flex-1 text-[13px]">Run only when</span>
<Input <Input
class="h-7 w-48 font-mono text-xs" class="h-7 w-48 font-mono text-xs"
placeholder="always" placeholder="inputs.enabled"
:aria-invalid="flowProblem && flowProblem.startsWith('when') ? true : undefined"
:model-value="(step.when as string) ?? ''" :model-value="(step.when as string) ?? ''"
@update:model-value="(value) => setField('when', String(value))" @update:model-value="(value) => setField('when', String(value))"
/> />
@@ -358,14 +364,15 @@ const text = (key: string) => (typeof settings.value[key] === "string" ? (settin
@update:model-value="(value) => setRetry({ attempts: String(value) === '' ? undefined : Number(String(value)) })" @update:model-value="(value) => setRetry({ attempts: String(value) === '' ? undefined : Number(String(value)) })"
/> />
</label> </label>
<label class="flex min-h-10 items-center gap-3 px-3 py-1.5"> <div class="flex min-h-10 items-center gap-3 px-3 py-1.5">
<span class="flex-1 text-[13px]">Retry backoff</span> <label :for="`${uid}-backoff`" class="flex-1 text-[13px]">Retry backoff</label>
<DurationInput <DurationInput
:id="`${uid}-backoff`"
:model-value="(step.retry as { backoff?: string } | undefined)?.backoff ?? ''" :model-value="(step.retry as { backoff?: string } | undefined)?.backoff ?? ''"
:units="['s', 'm', 'h']" :units="['s', 'm', 'h']"
@update:model-value="setRetry({ backoff: $event || undefined })" @update:model-value="setRetry({ backoff: $event || undefined })"
/> />
</label> </div>
</div> </div>
</section> </section>
</div> </div>
+15 -4
View File
@@ -67,6 +67,7 @@ const selected = defineModel<string>("selected", { required: true });
defineProps<{ runsCount?: number }>(); defineProps<{ runsCount?: number }>();
const id = ref(""); const id = ref("");
const yaml = ref(""); const yaml = ref("");
const loadedYaml = ref("");
const selectedStep = ref<StepPath | null>(null); const selectedStep = ref<StepPath | null>(null);
// The slide-in panel shows one thing: a step's editor, or the workflow's settings. // The slide-in panel shows one thing: a step's editor, or the workflow's settings.
const settingsOpen = ref(false); const settingsOpen = ref(false);
@@ -75,7 +76,7 @@ watch(selectedStep, (path) => {
}); });
const localError = ref(""); const localError = ref("");
const { runs, watched, watchedRun, stages, attempt, pick, follow, refresh } = useWorkflowRuns(selected); const { runs, error: runsError, loading: runsLoading, watched, watchedRun, stages, attempt, pick, follow, refresh } = useWorkflowRuns(selected);
const stepTab = ref("definition"); const stepTab = ref("definition");
const selectedNode = computed(() => withRuns(workflowGraph(yaml.value), stages.value).nodes.find((node) => JSON.stringify(node.data.path) === JSON.stringify(selectedStep.value))?.data); const selectedNode = computed(() => withRuns(workflowGraph(yaml.value), stages.value).nodes.find((node) => JSON.stringify(node.data.path) === JSON.stringify(selectedStep.value))?.data);
function openStep(path: StepPath): void { function openStep(path: StepPath): void {
@@ -157,15 +158,17 @@ function load(value: string): void {
); );
id.value = entry?.id ?? value; id.value = entry?.id ?? value;
yaml.value = entry?.yaml ?? `id: ${value}\nsteps: []\n`; yaml.value = entry?.yaml ?? `id: ${value}\nsteps: []\n`;
loadedYaml.value = yaml.value;
selectedStep.value = null; selectedStep.value = null;
localError.value = ""; localError.value = "";
} }
watch(selected, load, { immediate: true }); watch(selected, load, { immediate: true });
// The collection arrives after the first render; a later live update must not // The collection arrives after the first render; a later live update must not
// overwrite what is being typed, so it only fills an editor still empty. // overwrite what is being typed, so it only refreshes an editor with no local edits.
watch(collection, () => { watch(collection, () => {
if (!yaml.value) load(selected.value); const incoming = collection.value.definitions.find((entry) => entry.id === selected.value);
if (incoming && yaml.value === loadedYaml.value && incoming.yaml !== loadedYaml.value) load(selected.value);
}); });
async function save(next: WorkflowDefinitionCollection): Promise<boolean> { async function save(next: WorkflowDefinitionCollection): Promise<boolean> {
@@ -189,8 +192,10 @@ async function saveDraft(): Promise<void> {
next = removeWorkflowDefinition(next, previous); next = removeWorkflowDefinition(next, previous);
if ( if (
await save(upsertWorkflowDefinition(next, { id: nextID, yaml: yaml.value })) await save(upsertWorkflowDefinition(next, { id: nextID, yaml: yaml.value }))
) ) {
selected.value = nextID; selected.value = nextID;
loadedYaml.value = yaml.value;
}
} }
const confirmDelete = ref(false); const confirmDelete = ref(false);
@@ -292,6 +297,12 @@ function syncScroll(event: Event): void {
<Spinner v-if="state.saving" data-icon="inline-start" />Save</Button> <Spinner v-if="state.saving" data-icon="inline-start" />Save</Button>
</template> </template>
</div> </div>
<p v-if="runsLoading" class="text-xs text-fg-muted" role="status">Loading recent runs…</p>
<div v-else-if="runsError" class="text-sm text-danger" role="alert">
<p>Could not load recent runs: {{ runsError }}</p>
<Button type="button" variant="outline" size="sm" @click="refresh">Retry runs</Button>
</div>
<p v-if="watchedRun && !watchedRun.workflow_definition_yaml" class="text-xs text-fg-muted" role="status">No workflow snapshot was recorded for this run. Showing the current definition.</p>
<TabsContent value="canvas" class="space-y-2"> <TabsContent value="canvas" class="space-y-2">
<!-- The canvas takes the height the viewport has left, so the page <!-- The canvas takes the height the viewport has left, so the page
itself does not scroll; the canvas pans. --> itself does not scroll; the canvas pans. -->
+32 -6
View File
@@ -58,6 +58,7 @@ const store = useWorkflowsStore();
const data = ref<WorkflowsResponse>({}); const data = ref<WorkflowsResponse>({});
const runs = ref<RunTask[]>([]); const runs = ref<RunTask[]>([]);
const error = ref<string | null>(null); const error = ref<string | null>(null);
const loading = ref(true);
async function load() { async function load() {
try { try {
@@ -68,6 +69,8 @@ async function load() {
void loadWorkflowRuns(); void loadWorkflowRuns();
} catch (err) { } catch (err) {
error.value = String((err as Error).message || err); error.value = String((err as Error).message || err);
} finally {
loading.value = false;
} }
} }
useLiveResource("tasks", () => void load(), 500); useLiveResource("tasks", () => void load(), 500);
@@ -138,11 +141,25 @@ const stages = computed(() => (data.value.stages ?? []).filter((s) => s.workflow
// The selected workflow's runs come from a workflow-filtered page: the global // The selected workflow's runs come from a workflow-filtered page: the global
// list above holds only the newest tasks of every workflow. // list above holds only the newest tasks of every workflow.
const workflowRuns = ref<RunTask[]>([]); const workflowRuns = ref<RunTask[]>([]);
const runsLoading = ref(false);
const runsError = ref("");
let runsRequest = 0;
async function loadWorkflowRuns() { async function loadWorkflowRuns() {
const request = ++runsRequest;
const requested = selected.value; const requested = selected.value;
const page = requested ? await api.taskPage<RunTask>({ workflow: requested }).catch(() => null) : null; runsLoading.value = true;
if (selected.value === requested) workflowRuns.value = page?.tasks ?? []; runsError.value = "";
workflowRuns.value = [];
try {
const page = requested ? await api.taskPage<RunTask>({ workflow: requested }) : null;
if (request === runsRequest) workflowRuns.value = page?.tasks ?? [];
} catch (err) {
if (request === runsRequest) runsError.value = String((err as Error).message || err);
} finally {
if (request === runsRequest) runsLoading.value = false;
}
} }
watch(selected, () => void loadWorkflowRuns(), { immediate: true }); watch(selected, () => void loadWorkflowRuns(), { immediate: true });
function create() { function create() {
@@ -190,7 +207,11 @@ const rate = (deliveredRuns = 0, total = 0) => (total ? deliveredRuns / total :
</AlertDialogContent> </AlertDialogContent>
</AlertDialog> </AlertDialog>
<p v-if="error" class="mb-4 text-sm text-danger" role="alert">Cannot reach archied: {{ error }}</p> <div v-if="error || store.error" class="mb-4 text-sm text-danger" role="alert">
<p>{{ error || store.error }}</p>
<Button variant="outline" size="sm" @click="load(); store.load()">Retry</Button>
</div>
<p v-if="loading || (!store.state.resource && !store.error)" class="text-sm text-fg-muted" role="status">Loading workflows…</p>
<div class="grid items-start gap-6 lg:grid-cols-[24rem_minmax(0,1fr)]"> <div class="grid items-start gap-6 lg:grid-cols-[24rem_minmax(0,1fr)]">
<ul class="flex gap-1 overflow-x-auto pb-2 lg:flex-col lg:gap-0.5 lg:overflow-visible lg:pb-0" aria-label="Workflows"> <ul class="flex gap-1 overflow-x-auto pb-2 lg:flex-col lg:gap-0.5 lg:overflow-visible lg:pb-0" aria-label="Workflows">
@@ -220,14 +241,14 @@ const rate = (deliveredRuns = 0, total = 0) => (total ? deliveredRuns / total :
</li> </li>
</ul> </ul>
<section v-if="!selected" class="min-w-0 rounded-lg border border-border bg-card" aria-label="Workflow"> <section v-if="!selected && !loading && store.state.resource && !error" class="min-w-0 rounded-lg border border-border bg-card" aria-label="Workflow">
<Empty> <Empty>
<EmptyHeader> <EmptyHeader>
<EmptyTitle>No workflows</EmptyTitle> <EmptyTitle>No workflows</EmptyTitle>
</EmptyHeader> </EmptyHeader>
</Empty> </Empty>
</section> </section>
<section v-else class="min-w-0 rounded-lg border border-border bg-card px-3 py-4 sm:px-5" aria-label="Workflow"> <section v-else-if="selected && store.state.resource" class="min-w-0 rounded-lg border border-border bg-card px-3 py-4 sm:px-5" aria-label="Workflow">
<header class="mb-2 flex flex-wrap items-center gap-2"> <header class="mb-2 flex flex-wrap items-center gap-2">
<h2 class="font-mono text-[15px] font-medium">{{ selected }}</h2> <h2 class="font-mono text-[15px] font-medium">{{ selected }}</h2>
<Badge v-if="provenance" variant="outline">{{ provenance }}</Badge> <Badge v-if="provenance" variant="outline">{{ provenance }}</Badge>
@@ -251,7 +272,12 @@ const rate = (deliveredRuns = 0, total = 0) => (total ? deliveredRuns / total :
</template> </template>
</template> </template>
<template #runs> <template #runs>
<Empty v-if="!workflowRuns.length"> <p v-if="runsLoading" role="status" class="text-sm text-fg-muted">Loading runs…</p>
<div v-else-if="runsError" role="alert" class="text-sm text-danger">
<p>{{ runsError }}</p>
<Button variant="outline" size="sm" @click="loadWorkflowRuns">Retry</Button>
</div>
<Empty v-else-if="!workflowRuns.length">
<EmptyHeader> <EmptyHeader>
<EmptyTitle>No runs yet</EmptyTitle> <EmptyTitle>No runs yet</EmptyTitle>
</EmptyHeader> </EmptyHeader>
+21 -8
View File
@@ -25,18 +25,28 @@ export function useWorkflowRuns(workflow: Ref<string>) {
const stages = ref<StageRun[]>([]); const stages = ref<StageRun[]>([]);
const attempt = ref(0); const attempt = ref(0);
let picked = false; let picked = false;
const error = ref("");
const loading = ref(false);
let requestNumber = 0;
async function loadRuns(): Promise<void> { async function loadRuns(): Promise<void> {
// The server filters by workflow: filtering a global page here would miss // The server filters by workflow: filtering a global page here would miss
// every run older than that page. // every run older than that page.
const requested = workflow.value; const requested = workflow.value;
const page = requested const request = ++requestNumber;
? await api.taskPage<WorkflowRun>({ workflow: requested, limit: RECENT_RUNS }).catch(() => null) loading.value = true;
: null; try {
if (workflow.value !== requested) return; const page = requested ? await api.taskPage<WorkflowRun>({ workflow: requested, limit: RECENT_RUNS }) : null;
runs.value = (page?.tasks ?? []).sort((a, b) => Number(b.id) - Number(a.id)); if (workflow.value !== requested || request !== requestNumber) return;
if (!picked || (watched.value && !runs.value.some((run) => String(run.id) === watched.value))) runs.value = (page?.tasks ?? []).sort((a, b) => Number(b.id) - Number(a.id));
watched.value = runs.value[0] ? String(runs.value[0].id) : ""; error.value = "";
if (!picked || (watched.value && !runs.value.some((run) => String(run.id) === watched.value)))
watched.value = runs.value[0] ? String(runs.value[0].id) : "";
} catch (cause) {
if (workflow.value === requested && request === requestNumber) error.value = String((cause as Error).message || cause);
} finally {
if (request === requestNumber) loading.value = false;
}
} }
async function loadStages(): Promise<void> { async function loadStages(): Promise<void> {
@@ -66,6 +76,9 @@ export function useWorkflowRuns(workflow: Ref<string>) {
watch(workflow, () => { watch(workflow, () => {
picked = false; picked = false;
runs.value = [];
watched.value = "";
error.value = "";
void refresh(); void refresh();
}, { immediate: true }); }, { immediate: true });
watch(watched, () => { watch(watched, () => {
@@ -84,5 +97,5 @@ export function useWorkflowRuns(workflow: Ref<string>) {
await refresh(); await refresh();
} }
return { runs, watched, watchedRun, stages, attempt, pick, follow, refresh }; return { runs, error, loading, watched, watchedRun, stages, attempt, pick, follow, refresh };
} }
+28
View File
@@ -1,4 +1,5 @@
import { parseDocument } from "yaml"; import { parseDocument } from "yaml";
import { parseGoDuration } from "../components/ui/duration-input/duration.ts";
import { branchingOf } from "./workflow-edit.ts"; import { branchingOf } from "./workflow-edit.ts";
/** /**
@@ -87,6 +88,8 @@ export function parseWorkflowYaml(
const declared = new Set<string>(); const declared = new Set<string>();
for (const [i, step] of steps.entries()) { for (const [i, step] of steps.entries()) {
const where = `workflow ${id} step ${i + 1}`; const where = `workflow ${id} step ${i + 1}`;
const controls = stepControlsProblem(step);
if (controls) return { ok: false, message: `${where}: ${controls}` };
const branching = branchingOf(step); const branching = branchingOf(step);
if (branching) { if (branching) {
if (branching.kind === "switch" && !branching.on) if (branching.kind === "switch" && !branching.on)
@@ -100,6 +103,7 @@ export function parseWorkflowYaml(
for (const [j, branchStep] of branchSteps.entries()) { for (const [j, branchStep] of branchSteps.entries()) {
const branchWhere = `${where} branch ${branch} step ${j + 1}`; const branchWhere = `${where} branch ${branch} step ${j + 1}`;
const problem = const problem =
stepControlsProblem(branchStep) ||
checkStepType(branchStep, branchWhere, known, repository) || checkStepType(branchStep, branchWhere, known, repository) ||
laterReference(branchStep, branchWhere, visible); laterReference(branchStep, branchWhere, visible);
if (problem) return { ok: false, message: problem }; if (problem) return { ok: false, message: problem };
@@ -135,6 +139,30 @@ function declareID(step: unknown, declared: Set<string>): void {
if (isMapping(step) && typeof step.id === "string") declared.add(step.id); if (isMapping(step) && typeof step.id === "string") declared.add(step.id);
} }
/** The shared flow controls, checked in both the step panel and YAML editor. */
export function stepControlsProblem(step: unknown): string {
if (!isMapping(step)) return "";
if (step.when !== undefined && step.when !== "") {
if (typeof step.when !== "string") return "when must be a reference";
const operator = step.when.includes("==") ? "==" : step.when.includes("!=") ? "!=" : "";
const path = operator ? step.when.split(operator, 1)[0]!.trim() : step.when.trim().replace(/^!\s*/, "");
if (!/^(task|inputs|steps)\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)*$/.test(path))
return "when must name a task, inputs or steps field, optionally prefixed with ! or compared using == or !=";
}
if (step.retry !== undefined) {
if (!isMapping(step.retry)) return "retry must be a mapping";
const { attempts, backoff } = step.retry;
if (typeof attempts !== "number" || !Number.isInteger(attempts) || attempts < 1 || attempts > 10)
return "retry.attempts must be a whole number from 1 to 10";
if (backoff !== undefined && backoff !== "") {
const duration = typeof backoff === "string" ? parseGoDuration(backoff) : null;
if (duration === null || duration < 0 || !Number.isFinite(duration))
return "retry.backoff must be a non-negative duration, such as 5s or 1m";
}
}
return "";
}
/** What is wrong with one typed step, or "" when nothing the page can see. */ /** What is wrong with one typed step, or "" when nothing the page can see. */
function checkStepType( function checkStepType(
step: unknown, step: unknown,
+10
View File
@@ -0,0 +1,10 @@
import assert from 'node:assert/strict';
import test from 'node:test';
import { activityDetail } from '../src/dashboard/activity-detail.ts';
test('activity names recorded actors without rewriting unrelated payloads', () => {
const id = '11111111-1111-4111-8111-111111111111';
const name = (actor: string) => actor === id ? 'Sam' : 'Unavailable identity';
assert.equal(activityDetail({ detail: `retried by ${id}`, actor_id: id }, name).text, 'retried by Sam');
assert.equal(activityDetail({ detail: `Result ID: ${id}` }, name).text, `Result ID: ${id}`);
});
+8
View File
@@ -59,3 +59,11 @@ test("saveInOrder reports every kind saved when none fails", async () => {
{ saved: ["a", "b"], failed: undefined, untouched: [] }, { saved: ["a", "b"], failed: undefined, untouched: [] },
); );
}); });
test("review expands an added schedule into inspectable field changes", () => {
assert.deepEqual(diffValues([], [{ id: "daily", detail: "Daily check", schedule: { interval: "24h" } }], "", true), [
{ path: "0.id", before: undefined, after: "daily" },
{ path: "0.detail", before: undefined, after: "Daily check" },
{ path: "0.schedule.interval", before: undefined, after: "24h" },
]);
});
+3
View File
@@ -52,6 +52,9 @@ test("invalid workflow structures identify the field that prevents saving", () =
["- a\n- b\n", /mapping/], ["- a\n- b\n", /mapping/],
['"just a string"\n', /mapping/], ['"just a string"\n', /mapping/],
["id: x\nsteps: 3\n", /steps/], ["id: x\nsteps: 3\n", /steps/],
["id: x\nsteps:\n - type: a\n when: what\n", /when/],
["id: x\nsteps:\n - type: a\n retry: {attempts: 2, backoff: yes}\n", /backoff/],
["id: x\nsteps:\n - type: a\n retry: {attempts: 2, backoff: -1s}\n", /backoff/],
] as const) { ] as const) {
const parsed = parseWorkflowYaml(source); const parsed = parseWorkflowYaml(source);
assert.equal(parsed.ok, false, source); assert.equal(parsed.ok, false, source);