feat(workflow): render a PRD's generated view on the plan approval card

agent.run gains views: the agent may return an OpenUI Lang view of its
answer through an optional view tool, read as steps.<id>.view. human.approve
stores it as the task's plan_view, and the approval card renders it with
the dashboard's own components, falling back to the plan text when there
is no view or it does not parse. The feasibility prd step uses it.
This commit is contained in:
sam committed 2026-10-25 16:33:04 +11:00
1 parent 92726f0bcf
commit 181915313e
34 files changed
+1035 -153

No files matched your search

+11
View File
@@ -91,6 +91,8 @@ tasks:
# Parallel UI checks must share one dependency install.
run: once
dir: ui
env:
OPENUI_TELEMETRY_DISABLED: "1"
cmds:
- npm ci --no-audit --no-fund
@@ -99,8 +101,17 @@ tasks:
dir: ui
deps: [ui:deps]
cmds:
- task: ui:prompt
- npm run build
ui:prompt:
desc: Generate the agent prompt for the dashboard's view components (committed; the Go build embeds it)
deps: [ui:deps]
env:
OPENUI_TELEMETRY_DISABLED: "1"
cmds:
- node --experimental-strip-types ui/scripts/genui-prompt.ts internal/domain/genui/prompt.md
ui:check:
desc: Rebuild the dashboard into a temporary directory and reject a stale ui/dist
deps: [ui:deps]
+13 -3
View File
@@ -1882,7 +1882,9 @@ type Task struct {
BindingAddr string `protobuf:"bytes,47,opt,name=binding_addr,json=bindingAddr,proto3" json:"binding_addr,omitempty"`
// park_blocker names what a parked task is missing (taskstate.Blocker),
// recorded at the park site; empty when the park has no known fix.
ParkBlocker string `protobuf:"bytes,48,opt,name=park_blocker,json=parkBlocker,proto3" json:"park_blocker,omitempty"`
ParkBlocker string `protobuf:"bytes,48,opt,name=park_blocker,json=parkBlocker,proto3" json:"park_blocker,omitempty"`
// plan_view is an OpenUI Lang view of plan for the dashboard.
PlanView string `protobuf:"bytes,49,opt,name=plan_view,json=planView,proto3" json:"plan_view,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
@@ -2254,6 +2256,13 @@ func (x *Task) GetParkBlocker() string {
return ""
}
func (x *Task) GetPlanView() string {
if x != nil {
return x.PlanView
}
return ""
}
// Event mirrors internal/events.Event. Data is carried as a JSON object
// string (matching the store's own on-disk representation) rather than
// google.protobuf.Struct, to stay a direct mirror of the existing column.
@@ -19733,7 +19742,7 @@ const file_state_v1_state_proto_rawDesc = "" +
"\x06tokens\x18\x01 \x03(\v2\x17.state.v1.PersonalTokenR\x06tokens\",\n" +
"\x1aRevokePersonalTokenRequest\x12\x0e\n" +
"\x02id\x18\x01 \x01(\tR\x02id\"\x1d\n" +
"\x1bRevokePersonalTokenResponse\"\xdb\f\n" +
"\x1bRevokePersonalTokenResponse\"\xf8\f\n" +
"\x04Task\x12\x0e\n" +
"\x02id\x18\x01 \x01(\x03R\x02id\x12\x14\n" +
"\x05owner\x18\x02 \x01(\tR\x05owner\x12\x12\n" +
@@ -19797,7 +19806,8 @@ const file_state_v1_state_proto_rawDesc = "" +
"\tworkspace\x18- \x01(\tR\tworkspace\x12+\n" +
"\x11binding_signature\x18. \x01(\tR\x10bindingSignature\x12!\n" +
"\fbinding_addr\x18/ \x01(\tR\vbindingAddr\x12!\n" +
"\fpark_blocker\x180 \x01(\tR\vparkBlocker\"\xf8\x02\n" +
"\fpark_blocker\x180 \x01(\tR\vparkBlocker\x12\x1b\n" +
"\tplan_view\x181 \x01(\tR\bplanView\"\xf8\x02\n" +
"\x05Event\x12\x0e\n" +
"\x02id\x18\x01 \x01(\x03R\x02id\x12*\n" +
"\x02at\x18\x02 \x01(\v2\x1a.google.protobuf.TimestampR\x02at\x12\x12\n" +
+12
View File
@@ -0,0 +1,12 @@
// Package genui holds the agent prompt for the dashboard's generated views.
// prompt.md is generated from the renderer's component schemas by
// ui/scripts/genui-prompt.ts (task ui:prompt); never edit it by hand.
package genui
import _ "embed"
//go:embed prompt.md
var prompt string
// Prompt teaches an agent the view language and the components it may use.
func Prompt() string { return prompt }
+80
View File
@@ -0,0 +1,80 @@
Besides your text answer, return a view of it with the `view` tool: an OpenUI Lang program the dashboard renders for the human reading your work. It presents the same content as the text, laid out for a quick decision; it never says anything the text does not.
## Syntax Rules
1. Each statement is on its own line: `identifier = Expression`
2. `root` is the entry point — every program must define `root = Stack(...)`
3. Expressions are: strings ("..."), numbers, booleans (true/false), null, arrays ([...]), objects ({...}), or component calls TypeName(arg1, arg2, ...)
4. Use references for readability: define `name = ...` on one line, then use `name` later
5. EVERY variable (except root) MUST be referenced by at least one other variable. Unreferenced variables are silently dropped and will NOT render. Always include defined variables in their parent's children/items array.
6. Arguments are POSITIONAL (order matters, not names). Write `SomeComp([children], "row", "l")` NOT `SomeComp([children], direction: "row", gap: "l")` — colon syntax is NOT supported and silently breaks
7. Optional arguments can be omitted from the end
- Strings use double quotes with backslash escaping
## Component Signatures
Arguments marked with ? are optional. Sub-components can be inline or referenced; prefer references for better streaming.
### Layout
Stack(children: (Section | Columns | Heading | Text | Callout | Facts | Files | Checklist | Table | Code)[]) — The view: its parts from top to bottom.
Section(title: string, children: (Heading | Text | Callout | Facts | Files | Checklist | Table | Code)[]) — A titled part of the view, e.g. Problem or Proposed solution.
Columns(children: Section[]) — Two or three sections side by side, for content read in contrast, e.g. goals and non-goals.
### Content
Heading(text: string) — A short title for what follows.
Text(markdown: string) — Prose in Markdown: paragraphs, lists, inline code, links. Use for explanation the other components cannot carry.
Callout(tone: "info" | "warning" | "risk" | "success", title: string, body?: string) — One point the reader must not miss: a risk, an open question, a caveat or a confirmation.
Facts(items: Fact[]) — Short label/value pairs read at a glance, e.g. estimated diff size, risk, scope.
Fact(label: string, value: string) — One label and its short value.
Files(items: File[]) — The files a change adds, modifies or deletes.
File(path: string, change: "added" | "modified" | "deleted", note?: string) — One file and how the change touches it.
Checklist(items: string[]) — Criteria or steps, each independently checkable.
Table(columns: string[], rows: string[][]) — Rows that compare along the same columns.
Code(code: string, language?: string) — A code excerpt or proposed signature.
- Prefer Facts, Files, Checklist and Table to prose; use Text only for explanation.
- Define each Section and each list item as its own line so the view streams.
## Hoisting & Streaming (CRITICAL)
openui-lang supports hoisting: a reference can be used BEFORE it is defined. The parser resolves all references after the full input is parsed.
During streaming, the output is re-parsed on every chunk. Undefined references are temporarily unresolved and appear once their definitions stream in. This creates a progressive top-down reveal — structure first, then data fills in.
**Recommended statement order for optimal streaming:**
1. `root = Stack(...)` — UI shell appears immediately
2. Component definitions — fill in as they stream
3. Data values — leaf content last
Always write the root = Stack(...) statement first so the UI shell appears immediately, even before child data has streamed in.
## Examples
root = Stack([facts, problem, solution, scope, risk])
facts = Facts([f1, f2])
f1 = Fact("Estimated diff", "~40 lines")
f2 = Fact("Risk", "Low")
problem = Section("Problem", [problemText])
problemText = Text("Callers compute percentages by hand; `calc` has no helper.")
solution = Section("Proposed solution", [solutionText, sig, files])
solutionText = Text("Add one exported function to `calc/calc.go`.")
sig = Code("func Percent(part, whole int) (int, error)", "go")
files = Files([file1, file2])
file1 = File("calc/calc.go", "modified", "adds Percent")
file2 = File("calc/calc_test.go", "modified")
scope = Columns([accept, nongoals])
accept = Section("Acceptance criteria", [acceptList])
acceptList = Checklist(["Percent(1, 4) returns 25", "A zero whole returns an error"])
nongoals = Section("Non-goals", [nongoalList])
nongoalList = Checklist(["Floating-point percentages"])
risk = Callout("info", "No existing callers change")
## Important Rules
- Choose components that best represent the content (tables for comparisons, charts for trends, forms for input, etc.)
## Final Verification
Before finishing, walk your output and verify:
1. root = Stack(...) is the FIRST line (for optimal streaming).
2. Every referenced name is defined. Every defined name (other than root) is reachable from root.
- The view holds only OpenUI Lang: no Markdown fences, no commentary.
- Lead with what the reader decides on; put supporting detail after it.
+38 -3
View File
@@ -12,6 +12,7 @@ import (
"gopkg.in/yaml.v3"
"github.com/samcharles93/archie-core/internal/domain/agentrun"
"github.com/samcharles93/archie-core/internal/domain/genui"
)
// AgentRunStepName is the step type that runs one agent mission. It needs no
@@ -23,6 +24,10 @@ const AgentRunStepName = "agent.run"
// result schema returns its structured result.
const resultToolName = "result"
// viewToolName is the capture tool through which an agent.run step with views
// returns its view. Optional: without one the dashboard shows the text.
const viewToolName = "view"
// agentRunSettings are the agent.run step's settings.
type agentRunSettings struct {
// Mission is what the agent is asked to do. The workflow's inputs are
@@ -43,6 +48,8 @@ type agentRunSettings struct {
// Result is a JSON Schema object. When set, the agent must return a value
// matching it, which later steps read as steps.<id>.result.
Result map[string]any `yaml:"result" doc:"A JSON Schema object the agent must return; later steps read it as steps.<id>.result."`
// Views lets the agent return a view of its answer for the dashboard.
Views bool `yaml:"views" doc:"Let the agent return an interactive view of its answer; later steps read it as steps.<id>.view."`
}
// AgentRunStepType contributes the agent.run step type.
@@ -65,14 +72,31 @@ func newAgentRunStage(settings yaml.Node) (Stage, error) {
if err != nil {
return Stage{}, fmt.Errorf("%s: settings.result: %w", AgentRunStepName, err)
}
var captures []agentrun.CaptureTool
if resultTool != nil {
captures = append(captures, *resultTool)
}
extraRules := s.ExtraRules
if s.Views {
captures = append(captures, viewTool())
extraRules = strings.TrimSpace(extraRules + "\n\n" + genui.Prompt())
}
agent := AgentStage{
Name: AgentRunStepName,
Model: s.Model,
ReadOnly: s.ReadOnly,
Mission: func(*TaskContext) string { return s.Mission },
ExtraRules: s.ExtraRules,
ExtraRules: extraRules,
OnResult: func(tc *TaskContext, res agentrun.Result) error {
tc.stepResult.Summary = res.Summary
if views := res.Captures[viewToolName]; len(views) == 1 {
var v struct {
Source string `json:"source"`
}
if json.Unmarshal(views[0], &v) == nil {
tc.stepResult.View = v.Source
}
}
if resultTool == nil {
return nil
}
@@ -84,8 +108,8 @@ func newAgentRunStage(settings yaml.Node) (Stage, error) {
},
}
applyRepositoryControls(&agent, s)
if resultTool != nil {
agent.CaptureTools = func(*TaskContext) []agentrun.CaptureTool { return []agentrun.CaptureTool{*resultTool} }
if len(captures) > 0 {
agent.CaptureTools = func(*TaskContext) []agentrun.CaptureTool { return captures }
}
stage := agent.Stage()
return Stage{Name: AgentRunStepName, Run: func(ctx context.Context, tc *TaskContext) error {
@@ -128,6 +152,17 @@ func applyRepositoryControls(agent *AgentStage, s agentRunSettings) {
}
}
// viewTool is the optional capture tool for an agent.run step's view.
func viewTool() agentrun.CaptureTool {
return agentrun.CaptureTool{
Name: viewToolName,
Description: "Return the OpenUI Lang view of your answer. Call at most once, before finish.",
Parameters: json.RawMessage(`{"type":"object","properties":{"source":{"type":"string",` +
`"description":"The OpenUI Lang program."}},"required":["source"]}`),
RequiredFields: []string{"source"}, NonEmptyStrings: []string{"source"}, MaxCalls: 1,
}
}
// agentResultTool is the capture tool for a result schema, or nil for none.
func agentResultTool(schema map[string]any) (*agentrun.CaptureTool, error) {
if schema == nil {
@@ -57,6 +57,9 @@ type approveSettings struct {
// Plan is what the human decides on. It is kept on the task, and the
// workflow named by Then reads it as task.plan.
Plan string `yaml:"plan" doc:"What the human decides on; the next workflow reads it as task.plan."`
// View is an OpenUI Lang view of the plan for the dashboard; the plan
// stays the text every other surface reads.
View string `yaml:"view" doc:"An interactive view of the plan for the dashboard, e.g. {{ steps.prd.view }}. The plan text is shown when it is empty or does not render."`
// Then is the workflow the task is requeued under once approved.
Then string `yaml:"then" doc:"The workflow the task runs once approved."`
}
@@ -73,6 +76,7 @@ func newApproveStage(settings yaml.Node) (Stage, error) {
}
return Stage{Name: ApproveStepName, Run: func(ctx context.Context, tc *TaskContext) error {
tc.Task.Plan = s.Plan
tc.Task.PlanView = s.View
notify(ctx, tc, "approval")
tc.Task.Workflow = s.Then
tc.Outcome = Outcome{Status: StatusWaitingApproval, Detail: "plan delivered, awaiting go/no-go"}
@@ -36,6 +36,7 @@ steps:
type: agent.run
settings:
read_only: true
views: true
mission: |
Write a PRD for this accepted feature request on {{ task.repository }}.
@@ -49,4 +50,5 @@ steps:
- type: human.approve
settings:
plan: "{{ steps.prd.summary }}"
view: "{{ steps.prd.view }}"
then: implement
+6 -4
View File
@@ -14,10 +14,12 @@ import (
)
// StepResult is what a finished step leaves for later steps to reference as
// steps.<id>.summary and steps.<id>.result.<field>.
// steps.<id>.summary, steps.<id>.result.<field> and steps.<id>.view.
type StepResult struct {
Summary string `json:"summary"`
Result map[string]any `json:"result,omitempty"`
// View is the OpenUI Lang view an agent.run step with views returned.
View string `json:"view,omitempty"`
}
// referencePattern matches {{ path }} in a step's string settings.
@@ -115,8 +117,8 @@ func checkStepReference(path string, parts []string, earlier *refScope) error {
if !earlier.has(parts[1]) {
return fmt.Errorf("reference {{ %s }}: no earlier step has id %q", path, parts[1])
}
if parts[2] != "summary" && parts[2] != "result" {
return fmt.Errorf("reference {{ %s }}: a step exposes summary and result", path)
if parts[2] != "summary" && parts[2] != "result" && parts[2] != "view" {
return fmt.Errorf("reference {{ %s }}: a step exposes summary, result and view", path)
}
if fields := earlier.steps[parts[1]]; parts[2] == "result" && len(parts) > 3 && fields != nil && !fields[parts[3]] {
return fmt.Errorf("reference {{ %s }}: step %q's result schema has no field %q", path, parts[1], parts[3])
@@ -226,7 +228,7 @@ func referenceScope(tc *TaskContext) map[string]any {
t := tc.Task
steps := make(map[string]any, len(tc.stepResults))
for id, result := range tc.stepResults {
steps[id] = map[string]any{"summary": result.Summary, "result": result.Result}
steps[id] = map[string]any{"summary": result.Summary, "result": result.Result, "view": result.View}
}
inputs := map[string]any{}
maps.Copy(inputs, t.Inputs)
+5 -5
View File
@@ -15,11 +15,11 @@ func TestStepReferences(t *testing.T) {
yaml string
wantErr string
// rendered is the second step's mission after the first step left
// summary "the plan" and result {verdict: go}.
// summary "the plan", result {verdict: go} and view "root = Stack([])".
rendered string
}{
{
name: "earlier step summary and result resolve",
name: "earlier step summary, result and view resolve",
yaml: `id: w
repository: none
steps:
@@ -27,9 +27,9 @@ steps:
type: agent.run
settings: {mission: "plan {{ task.title }}"}
- type: agent.run
settings: {mission: "build {{ steps.plan.summary }} / {{ steps.plan.result.verdict }} / {{ steps.plan.result.missing }}"}
settings: {mission: "build {{ steps.plan.summary }} / {{ steps.plan.result.verdict }} / {{ steps.plan.result.missing }} / {{ steps.plan.view }}"}
`,
rendered: "build the plan / go / ",
rendered: "build the plan / go / / root = Stack([])",
},
{
name: "a later step cannot be referenced",
@@ -186,7 +186,7 @@ steps:
t.Fatal(err)
}
tc := &TaskContext{Task: &Task{Title: "t"}, stepResults: map[string]StepResult{
"plan": {Summary: "the plan", Result: map[string]any{"verdict": "go"}},
"plan": {Summary: "the plan", Result: map[string]any{"verdict": "go"}, View: "root = Stack([])"},
}}
rendered := renderSettings(definition.Steps[1].Settings, tc)
var settings agentRunSettings
+1
View File
@@ -52,6 +52,7 @@ type Task struct {
WorkflowDefinitionYAML string `json:"workflow_definition_yaml"`
Branch string `json:"branch"`
Plan string `json:"plan"`
PlanView string `json:"plan_view,omitempty"`
Notes string `json:"notes"`
PRNumber int `json:"pr_number"`
TokensUsed int `json:"tokens_used"`
@@ -0,0 +1,7 @@
-- An OpenUI Lang view of a task's plan, rendered on the approval card.
-- +goose Up
ALTER TABLE tasks ADD COLUMN plan_view text NOT NULL DEFAULT '';
-- +goose Down
ALTER TABLE tasks DROP COLUMN plan_view;
@@ -24,7 +24,7 @@ func (q *Queries) CallStatusDetail(ctx context.Context, taskID int64) (string, e
const enqueueCallTask = `-- name: EnqueueCallTask :one
WITH caller AS (
SELECT t.id, t.owner, t.repo, t.issue_number, t.title, t.body, t.labels, t.status, t.workflow, t.branch, t.plan, t.notes, t.pr_number, t.tokens_used, t.iterations, t.attempt, t.park_reason, t.watch_comment_id, t.park_class, t.remediation_rounds, t.retry_count, t.source, t.identity, t.binding_id, t.binding_version, t.review_payload, t.workflow_definition_version, t.workflow_definition_digest, t.workflow_definition_yaml, t.created_at, t.updated_at, t.review_cursor, t.inputs, t.org_id, t.workspace_id, t.call_parent_task_id, t.call_depth, t.outputs, t.review_gate, t.rereview_rounds, t.retry_mode, t.resume_from, t.resume_results, t.pending_reviews, t.origin, t.call_key, t.binding_signature, t.binding_addr, t.park_blocker, t.outcome_posted_status FROM tasks t WHERE t.id = $1 FOR UPDATE
SELECT t.id, t.owner, t.repo, t.issue_number, t.title, t.body, t.labels, t.status, t.workflow, t.branch, t.plan, t.notes, t.pr_number, t.tokens_used, t.iterations, t.attempt, t.park_reason, t.watch_comment_id, t.park_class, t.remediation_rounds, t.retry_count, t.source, t.identity, t.binding_id, t.binding_version, t.review_payload, t.workflow_definition_version, t.workflow_definition_digest, t.workflow_definition_yaml, t.created_at, t.updated_at, t.review_cursor, t.inputs, t.org_id, t.workspace_id, t.call_parent_task_id, t.call_depth, t.outputs, t.review_gate, t.rereview_rounds, t.retry_mode, t.resume_from, t.resume_results, t.pending_reviews, t.origin, t.call_key, t.binding_signature, t.binding_addr, t.park_blocker, t.outcome_posted_status, t.plan_view FROM tasks t WHERE t.id = $1 FOR UPDATE
), number AS (
INSERT INTO chat_issue_numbers (owner, repo, last_number)
SELECT caller.owner, caller.repo, $9::bigint + 1 FROM caller
@@ -43,7 +43,7 @@ SELECT
FROM caller, number
WHERE caller.status = 'running' AND caller.call_depth + 1 <= $8::int
ON CONFLICT (call_parent_task_id, call_key) WHERE call_key <> '' AND status NOT IN ('dead', 'closed_wont_do') DO UPDATE SET call_key = EXCLUDED.call_key
RETURNING id, owner, repo, issue_number, title, body, labels, status, workflow, branch, plan, notes, pr_number, tokens_used, iterations, attempt, park_reason, watch_comment_id, park_class, remediation_rounds, retry_count, source, identity, binding_id, binding_version, review_payload, workflow_definition_version, workflow_definition_digest, workflow_definition_yaml, created_at, updated_at, review_cursor, inputs, org_id, workspace_id, call_parent_task_id, call_depth, outputs, review_gate, rereview_rounds, retry_mode, resume_from, resume_results, pending_reviews, origin, call_key, binding_signature, binding_addr, park_blocker, outcome_posted_status
RETURNING id, owner, repo, issue_number, title, body, labels, status, workflow, branch, plan, notes, pr_number, tokens_used, iterations, attempt, park_reason, watch_comment_id, park_class, remediation_rounds, retry_count, source, identity, binding_id, binding_version, review_payload, workflow_definition_version, workflow_definition_digest, workflow_definition_yaml, created_at, updated_at, review_cursor, inputs, org_id, workspace_id, call_parent_task_id, call_depth, outputs, review_gate, rereview_rounds, retry_mode, resume_from, resume_results, pending_reviews, origin, call_key, binding_signature, binding_addr, park_blocker, outcome_posted_status, plan_view
`
type EnqueueCallTaskParams struct {
@@ -136,6 +136,7 @@ func (q *Queries) EnqueueCallTask(ctx context.Context, arg EnqueueCallTaskParams
&i.BindingAddr,
&i.ParkBlocker,
&i.OutcomePostedStatus,
&i.PlanView,
)
return i, err
}
@@ -548,6 +548,7 @@ type Task struct {
BindingAddr string
ParkBlocker string
OutcomePostedStatus string
PlanView string
}
type ToolCall struct {
@@ -13,7 +13,7 @@ import (
)
const activeTasksByOrigin = `-- name: ActiveTasksByOrigin :many
SELECT id, owner, repo, issue_number, title, body, labels, status, workflow, branch, plan, notes, pr_number, tokens_used, iterations, attempt, park_reason, watch_comment_id, park_class, remediation_rounds, retry_count, source, identity, binding_id, binding_version, review_payload, workflow_definition_version, workflow_definition_digest, workflow_definition_yaml, created_at, updated_at, review_cursor, inputs, org_id, workspace_id, call_parent_task_id, call_depth, outputs, review_gate, rereview_rounds, retry_mode, resume_from, resume_results, pending_reviews, origin, call_key, binding_signature, binding_addr, park_blocker, outcome_posted_status FROM tasks
SELECT id, owner, repo, issue_number, title, body, labels, status, workflow, branch, plan, notes, pr_number, tokens_used, iterations, attempt, park_reason, watch_comment_id, park_class, remediation_rounds, retry_count, source, identity, binding_id, binding_version, review_payload, workflow_definition_version, workflow_definition_digest, workflow_definition_yaml, created_at, updated_at, review_cursor, inputs, org_id, workspace_id, call_parent_task_id, call_depth, outputs, review_gate, rereview_rounds, retry_mode, resume_from, resume_results, pending_reviews, origin, call_key, binding_signature, binding_addr, park_blocker, outcome_posted_status, plan_view FROM tasks
WHERE origin = $1 AND origin <> '' AND status IN ('queued', 'running') AND ($2::text IS NULL OR org_id = $2)
ORDER BY id
`
@@ -84,6 +84,7 @@ func (q *Queries) ActiveTasksByOrigin(ctx context.Context, arg ActiveTasksByOrig
&i.BindingAddr,
&i.ParkBlocker,
&i.OutcomePostedStatus,
&i.PlanView,
); err != nil {
return nil, err
}
@@ -163,7 +164,7 @@ func (q *Queries) BeginRemediationTask(ctx context.Context, arg BeginRemediation
const claimByIssue = `-- name: ClaimByIssue :one
UPDATE tasks SET status = 'running', attempt = attempt + 1, outputs = '', updated_at = now()
WHERE owner = $1 AND repo = $2 AND issue_number = $3 AND status = 'queued'
RETURNING id, owner, repo, issue_number, title, body, labels, status, workflow, branch, plan, notes, pr_number, tokens_used, iterations, attempt, park_reason, watch_comment_id, park_class, remediation_rounds, retry_count, source, identity, binding_id, binding_version, review_payload, workflow_definition_version, workflow_definition_digest, workflow_definition_yaml, created_at, updated_at, review_cursor, inputs, org_id, workspace_id, call_parent_task_id, call_depth, outputs, review_gate, rereview_rounds, retry_mode, resume_from, resume_results, pending_reviews, origin, call_key, binding_signature, binding_addr, park_blocker, outcome_posted_status
RETURNING id, owner, repo, issue_number, title, body, labels, status, workflow, branch, plan, notes, pr_number, tokens_used, iterations, attempt, park_reason, watch_comment_id, park_class, remediation_rounds, retry_count, source, identity, binding_id, binding_version, review_payload, workflow_definition_version, workflow_definition_digest, workflow_definition_yaml, created_at, updated_at, review_cursor, inputs, org_id, workspace_id, call_parent_task_id, call_depth, outputs, review_gate, rereview_rounds, retry_mode, resume_from, resume_results, pending_reviews, origin, call_key, binding_signature, binding_addr, park_blocker, outcome_posted_status, plan_view
`
type ClaimByIssueParams struct {
@@ -228,6 +229,7 @@ func (q *Queries) ClaimByIssue(ctx context.Context, arg ClaimByIssueParams) (Tas
&i.BindingAddr,
&i.ParkBlocker,
&i.OutcomePostedStatus,
&i.PlanView,
)
return i, err
}
@@ -242,7 +244,7 @@ WHERE id = (
FOR UPDATE SKIP LOCKED
LIMIT 1
)
RETURNING id, owner, repo, issue_number, title, body, labels, status, workflow, branch, plan, notes, pr_number, tokens_used, iterations, attempt, park_reason, watch_comment_id, park_class, remediation_rounds, retry_count, source, identity, binding_id, binding_version, review_payload, workflow_definition_version, workflow_definition_digest, workflow_definition_yaml, created_at, updated_at, review_cursor, inputs, org_id, workspace_id, call_parent_task_id, call_depth, outputs, review_gate, rereview_rounds, retry_mode, resume_from, resume_results, pending_reviews, origin, call_key, binding_signature, binding_addr, park_blocker, outcome_posted_status
RETURNING id, owner, repo, issue_number, title, body, labels, status, workflow, branch, plan, notes, pr_number, tokens_used, iterations, attempt, park_reason, watch_comment_id, park_class, remediation_rounds, retry_count, source, identity, binding_id, binding_version, review_payload, workflow_definition_version, workflow_definition_digest, workflow_definition_yaml, created_at, updated_at, review_cursor, inputs, org_id, workspace_id, call_parent_task_id, call_depth, outputs, review_gate, rereview_rounds, retry_mode, resume_from, resume_results, pending_reviews, origin, call_key, binding_signature, binding_addr, park_blocker, outcome_posted_status, plan_view
`
// FOR UPDATE SKIP LOCKED replaces the SQLite single-writer assumption: two
@@ -305,6 +307,7 @@ func (q *Queries) ClaimNextTask(ctx context.Context) (Task, error) {
&i.BindingAddr,
&i.ParkBlocker,
&i.OutcomePostedStatus,
&i.PlanView,
)
return i, err
}
@@ -422,7 +425,7 @@ FROM number, (SELECT COALESCE(
'org-sys'
) AS id) AS owner_org
WHERE $11::text IS NULL OR owner_org.id = $11
RETURNING id, owner, repo, issue_number, title, body, labels, status, workflow, branch, plan, notes, pr_number, tokens_used, iterations, attempt, park_reason, watch_comment_id, park_class, remediation_rounds, retry_count, source, identity, binding_id, binding_version, review_payload, workflow_definition_version, workflow_definition_digest, workflow_definition_yaml, created_at, updated_at, review_cursor, inputs, org_id, workspace_id, call_parent_task_id, call_depth, outputs, review_gate, rereview_rounds, retry_mode, resume_from, resume_results, pending_reviews, origin, call_key, binding_signature, binding_addr, park_blocker, outcome_posted_status
RETURNING id, owner, repo, issue_number, title, body, labels, status, workflow, branch, plan, notes, pr_number, tokens_used, iterations, attempt, park_reason, watch_comment_id, park_class, remediation_rounds, retry_count, source, identity, binding_id, binding_version, review_payload, workflow_definition_version, workflow_definition_digest, workflow_definition_yaml, created_at, updated_at, review_cursor, inputs, org_id, workspace_id, call_parent_task_id, call_depth, outputs, review_gate, rereview_rounds, retry_mode, resume_from, resume_results, pending_reviews, origin, call_key, binding_signature, binding_addr, park_blocker, outcome_posted_status, plan_view
`
type InsertChatTaskParams struct {
@@ -519,6 +522,7 @@ func (q *Queries) InsertChatTask(ctx context.Context, arg InsertChatTaskParams)
&i.BindingAddr,
&i.ParkBlocker,
&i.OutcomePostedStatus,
&i.PlanView,
)
return i, err
}
@@ -602,7 +606,7 @@ func (q *Queries) ListOpenPRs(ctx context.Context, scopeOrg pgtype.Text) ([]List
const listTaskSummaries = `-- name: ListTaskSummaries :many
SELECT id, owner, repo, issue_number, title, status, workflow,
pr_number, tokens_used, iterations, attempt, park_reason, retry_count,
created_at, updated_at, plan, source, identity, binding_id, binding_version,
created_at, updated_at, plan, plan_view, source, identity, binding_id, binding_version,
outputs, review_gate, rereview_rounds
FROM tasks
WHERE ($1::text IS NULL OR org_id = $1)
@@ -640,6 +644,7 @@ type ListTaskSummariesRow struct {
CreatedAt time.Time
UpdatedAt time.Time
Plan string
PlanView string
Source string
Identity string
BindingID string
@@ -691,6 +696,7 @@ func (q *Queries) ListTaskSummaries(ctx context.Context, arg ListTaskSummariesPa
&i.CreatedAt,
&i.UpdatedAt,
&i.Plan,
&i.PlanView,
&i.Source,
&i.Identity,
&i.BindingID,
@@ -1000,7 +1006,7 @@ func (q *Queries) StampTaskBinding(ctx context.Context, arg StampTaskBindingPara
}
const taskByID = `-- name: TaskByID :one
SELECT id, owner, repo, issue_number, title, body, labels, status, workflow, branch, plan, notes, pr_number, tokens_used, iterations, attempt, park_reason, watch_comment_id, park_class, remediation_rounds, retry_count, source, identity, binding_id, binding_version, review_payload, workflow_definition_version, workflow_definition_digest, workflow_definition_yaml, created_at, updated_at, review_cursor, inputs, org_id, workspace_id, call_parent_task_id, call_depth, outputs, review_gate, rereview_rounds, retry_mode, resume_from, resume_results, pending_reviews, origin, call_key, binding_signature, binding_addr, park_blocker, outcome_posted_status FROM tasks WHERE id = $1 AND ($2::text IS NULL OR org_id = $2)
SELECT id, owner, repo, issue_number, title, body, labels, status, workflow, branch, plan, notes, pr_number, tokens_used, iterations, attempt, park_reason, watch_comment_id, park_class, remediation_rounds, retry_count, source, identity, binding_id, binding_version, review_payload, workflow_definition_version, workflow_definition_digest, workflow_definition_yaml, created_at, updated_at, review_cursor, inputs, org_id, workspace_id, call_parent_task_id, call_depth, outputs, review_gate, rereview_rounds, retry_mode, resume_from, resume_results, pending_reviews, origin, call_key, binding_signature, binding_addr, park_blocker, outcome_posted_status, plan_view FROM tasks WHERE id = $1 AND ($2::text IS NULL OR org_id = $2)
`
type TaskByIDParams struct {
@@ -1062,12 +1068,13 @@ func (q *Queries) TaskByID(ctx context.Context, arg TaskByIDParams) (Task, error
&i.BindingAddr,
&i.ParkBlocker,
&i.OutcomePostedStatus,
&i.PlanView,
)
return i, err
}
const taskByIssue = `-- name: TaskByIssue :one
SELECT id, owner, repo, issue_number, title, body, labels, status, workflow, branch, plan, notes, pr_number, tokens_used, iterations, attempt, park_reason, watch_comment_id, park_class, remediation_rounds, retry_count, source, identity, binding_id, binding_version, review_payload, workflow_definition_version, workflow_definition_digest, workflow_definition_yaml, created_at, updated_at, review_cursor, inputs, org_id, workspace_id, call_parent_task_id, call_depth, outputs, review_gate, rereview_rounds, retry_mode, resume_from, resume_results, pending_reviews, origin, call_key, binding_signature, binding_addr, park_blocker, outcome_posted_status FROM tasks WHERE owner = $1 AND repo = $2 AND issue_number = $3
SELECT id, owner, repo, issue_number, title, body, labels, status, workflow, branch, plan, notes, pr_number, tokens_used, iterations, attempt, park_reason, watch_comment_id, park_class, remediation_rounds, retry_count, source, identity, binding_id, binding_version, review_payload, workflow_definition_version, workflow_definition_digest, workflow_definition_yaml, created_at, updated_at, review_cursor, inputs, org_id, workspace_id, call_parent_task_id, call_depth, outputs, review_gate, rereview_rounds, retry_mode, resume_from, resume_results, pending_reviews, origin, call_key, binding_signature, binding_addr, park_blocker, outcome_posted_status, plan_view FROM tasks WHERE owner = $1 AND repo = $2 AND issue_number = $3
AND ($4::text IS NULL OR org_id = $4)
`
@@ -1137,12 +1144,13 @@ func (q *Queries) TaskByIssue(ctx context.Context, arg TaskByIssueParams) (Task,
&i.BindingAddr,
&i.ParkBlocker,
&i.OutcomePostedStatus,
&i.PlanView,
)
return i, err
}
const taskByPR = `-- name: TaskByPR :one
SELECT id, owner, repo, issue_number, title, body, labels, status, workflow, branch, plan, notes, pr_number, tokens_used, iterations, attempt, park_reason, watch_comment_id, park_class, remediation_rounds, retry_count, source, identity, binding_id, binding_version, review_payload, workflow_definition_version, workflow_definition_digest, workflow_definition_yaml, created_at, updated_at, review_cursor, inputs, org_id, workspace_id, call_parent_task_id, call_depth, outputs, review_gate, rereview_rounds, retry_mode, resume_from, resume_results, pending_reviews, origin, call_key, binding_signature, binding_addr, park_blocker, outcome_posted_status FROM tasks WHERE owner = $1 AND repo = $2 AND pr_number = $3 AND status = $4
SELECT id, owner, repo, issue_number, title, body, labels, status, workflow, branch, plan, notes, pr_number, tokens_used, iterations, attempt, park_reason, watch_comment_id, park_class, remediation_rounds, retry_count, source, identity, binding_id, binding_version, review_payload, workflow_definition_version, workflow_definition_digest, workflow_definition_yaml, created_at, updated_at, review_cursor, inputs, org_id, workspace_id, call_parent_task_id, call_depth, outputs, review_gate, rereview_rounds, retry_mode, resume_from, resume_results, pending_reviews, origin, call_key, binding_signature, binding_addr, park_blocker, outcome_posted_status, plan_view FROM tasks WHERE owner = $1 AND repo = $2 AND pr_number = $3 AND status = $4
AND ($5::text IS NULL OR org_id = $5)
`
@@ -1217,6 +1225,7 @@ func (q *Queries) TaskByPR(ctx context.Context, arg TaskByPRParams) (Task, error
&i.BindingAddr,
&i.ParkBlocker,
&i.OutcomePostedStatus,
&i.PlanView,
)
return i, err
}
@@ -1256,7 +1265,7 @@ func (q *Queries) TransitionTask(ctx context.Context, arg TransitionTaskParams)
}
const unpostedOutcomes = `-- name: UnpostedOutcomes :many
SELECT id, owner, repo, issue_number, title, body, labels, status, workflow, branch, plan, notes, pr_number, tokens_used, iterations, attempt, park_reason, watch_comment_id, park_class, remediation_rounds, retry_count, source, identity, binding_id, binding_version, review_payload, workflow_definition_version, workflow_definition_digest, workflow_definition_yaml, created_at, updated_at, review_cursor, inputs, org_id, workspace_id, call_parent_task_id, call_depth, outputs, review_gate, rereview_rounds, retry_mode, resume_from, resume_results, pending_reviews, origin, call_key, binding_signature, binding_addr, park_blocker, outcome_posted_status FROM tasks
SELECT id, owner, repo, issue_number, title, body, labels, status, workflow, branch, plan, notes, pr_number, tokens_used, iterations, attempt, park_reason, watch_comment_id, park_class, remediation_rounds, retry_count, source, identity, binding_id, binding_version, review_payload, workflow_definition_version, workflow_definition_digest, workflow_definition_yaml, created_at, updated_at, review_cursor, inputs, org_id, workspace_id, call_parent_task_id, call_depth, outputs, review_gate, rereview_rounds, retry_mode, resume_from, resume_results, pending_reviews, origin, call_key, binding_signature, binding_addr, park_blocker, outcome_posted_status, plan_view FROM tasks
WHERE origin <> '' AND outcome_posted_status <> status
AND status IN ('merged', 'rejected', 'dead', 'closed_wont_do', 'completed', 'waiting_approval', 'pr_open')
AND ($1::text IS NULL OR org_id = $1)
@@ -1326,6 +1335,7 @@ func (q *Queries) UnpostedOutcomes(ctx context.Context, scopeOrg pgtype.Text) ([
&i.BindingAddr,
&i.ParkBlocker,
&i.OutcomePostedStatus,
&i.PlanView,
); err != nil {
return nil, err
}
@@ -1338,22 +1348,23 @@ func (q *Queries) UnpostedOutcomes(ctx context.Context, scopeOrg pgtype.Text) ([
}
const updateTask = `-- name: UpdateTask :exec
UPDATE tasks SET workflow = $1, branch = $2, plan = $3, notes = $4,
pr_number = $5, tokens_used = $6, iterations = $7, park_reason = $8,
watch_comment_id = $9, retry_count = $10, remediation_rounds = $11,
review_payload = $12,
workflow_definition_version = CASE WHEN $13::text = '' THEN workflow_definition_version ELSE $14 END,
workflow_definition_digest = CASE WHEN $13::text = '' THEN workflow_definition_digest ELSE $15 END,
workflow_definition_yaml = CASE WHEN $13::text = '' THEN workflow_definition_yaml ELSE $13::text END,
outputs = $16, review_gate = $17, rereview_rounds = $18,
retry_mode = $19, updated_at = now()
WHERE id = $20
UPDATE tasks SET workflow = $1, branch = $2, plan = $3, plan_view = $4, notes = $5,
pr_number = $6, tokens_used = $7, iterations = $8, park_reason = $9,
watch_comment_id = $10, retry_count = $11, remediation_rounds = $12,
review_payload = $13,
workflow_definition_version = CASE WHEN $14::text = '' THEN workflow_definition_version ELSE $15 END,
workflow_definition_digest = CASE WHEN $14::text = '' THEN workflow_definition_digest ELSE $16 END,
workflow_definition_yaml = CASE WHEN $14::text = '' THEN workflow_definition_yaml ELSE $14::text END,
outputs = $17, review_gate = $18, rereview_rounds = $19,
retry_mode = $20, updated_at = now()
WHERE id = $21
`
type UpdateTaskParams struct {
Workflow string
Branch string
Plan string
PlanView string
Notes string
PrNumber int64
TokensUsed int64
@@ -1380,6 +1391,7 @@ func (q *Queries) UpdateTask(ctx context.Context, arg UpdateTaskParams) error {
arg.Workflow,
arg.Branch,
arg.Plan,
arg.PlanView,
arg.Notes,
arg.PrNumber,
arg.TokensUsed,
@@ -42,7 +42,7 @@ SELECT * FROM tasks WHERE owner = sqlc.arg(owner) AND repo = sqlc.arg(repo) AND
-- answers"), and the round count is the cap's visible half.
SELECT id, owner, repo, issue_number, title, status, workflow,
pr_number, tokens_used, iterations, attempt, park_reason, retry_count,
created_at, updated_at, plan, source, identity, binding_id, binding_version,
created_at, updated_at, plan, plan_view, source, identity, binding_id, binding_version,
outputs, review_gate, rereview_rounds
FROM tasks
WHERE (sqlc.narg(scope_org)::text IS NULL OR org_id = sqlc.narg(scope_org))
@@ -129,7 +129,7 @@ WHERE tasks.id = @id;
-- name: UpdateTask :exec
-- An update without a definition keeps the stored pin: a task's own
-- credential sends none, so it cannot replace the definition it runs.
UPDATE tasks SET workflow = @workflow, branch = @branch, plan = @plan, notes = @notes,
UPDATE tasks SET workflow = @workflow, branch = @branch, plan = @plan, plan_view = @plan_view, notes = @notes,
pr_number = @pr_number, tokens_used = @tokens_used, iterations = @iterations, park_reason = @park_reason,
watch_comment_id = @watch_comment_id, retry_count = @retry_count, remediation_rounds = @remediation_rounds,
review_payload = @review_payload,
+3 -1
View File
@@ -94,6 +94,7 @@ func taskFromRow(t postgresdb.Task) *workflow.Task {
WorkflowDefinitionYAML: t.WorkflowDefinitionYaml,
Branch: t.Branch,
Plan: t.Plan,
PlanView: t.PlanView,
Notes: t.Notes,
PRNumber: int(t.PrNumber),
TokensUsed: int(t.TokensUsed),
@@ -363,6 +364,7 @@ func (s *Store) Update(ctx context.Context, t *workflow.Task) error {
Workflow: t.Workflow,
Branch: t.Branch,
Plan: t.Plan,
PlanView: t.PlanView,
Notes: t.Notes,
PrNumber: int64(t.PRNumber),
TokensUsed: int64(t.TokensUsed),
@@ -772,7 +774,7 @@ func (s *Store) TasksPage(ctx context.Context, page storecontract.TaskPage) ([]w
Title: r.Title, Status: r.Status, Workflow: r.Workflow,
PRNumber: int(r.PrNumber), TokensUsed: int(r.TokensUsed), Iterations: int(r.Iterations),
Attempt: int(r.Attempt), ParkReason: r.ParkReason, RetryCount: int(r.RetryCount),
CreatedAt: r.CreatedAt, UpdatedAt: r.UpdatedAt, Plan: r.Plan, Source: r.Source,
CreatedAt: r.CreatedAt, UpdatedAt: r.UpdatedAt, Plan: r.Plan, PlanView: r.PlanView, Source: r.Source,
Identity: r.Identity, BindingID: r.BindingID, BindingVersion: int(r.BindingVersion),
Outputs: outputs,
ReviewGate: r.ReviewGate, RereviewRounds: int(r.RereviewRounds),
+2 -2
View File
@@ -62,7 +62,7 @@ func taskProto(t *task.Task) *pb.Task { // mirror-image field-by-field proto<->d
return &pb.Task{
Id: t.ID, Owner: t.Owner, Repo: t.Repo, IssueNumber: int64(t.IssueNumber),
Title: t.Title, Body: t.Body, Labels: t.Labels, Status: t.Status,
Workflow: t.Workflow, Branch: t.Branch, Plan: t.Plan, Notes: t.Notes,
Workflow: t.Workflow, Branch: t.Branch, Plan: t.Plan, PlanView: t.PlanView, Notes: t.Notes,
PrNumber: int64(t.PRNumber), TokensUsed: int64(t.TokensUsed), Iterations: int64(t.Iterations),
Attempt: int64(t.Attempt), ParkReason: t.ParkReason, RetryCount: int64(t.RetryCount),
RetryMode: t.RetryMode,
@@ -99,7 +99,7 @@ func taskValue(t *pb.Task) *task.Task { // see taskProto above
return &task.Task{
ID: t.Id, Owner: t.Owner, Repo: t.Repo, IssueNumber: int(t.IssueNumber),
Title: t.Title, Body: t.Body, Labels: t.Labels, Status: t.Status,
Workflow: t.Workflow, Branch: t.Branch, Plan: t.Plan, Notes: t.Notes,
Workflow: t.Workflow, Branch: t.Branch, Plan: t.Plan, PlanView: t.PlanView, Notes: t.Notes,
PRNumber: int(t.PrNumber), TokensUsed: int(t.TokensUsed), Iterations: int(t.Iterations),
Attempt: int(t.Attempt), ParkReason: t.ParkReason, RetryCount: int(t.RetryCount),
RetryMode: t.RetryMode,
+2
View File
@@ -520,6 +520,8 @@ message Task {
// park_blocker names what a parked task is missing (taskstate.Blocker),
// recorded at the park site; empty when the park has no known fix.
string park_blocker = 48;
// plan_view is an OpenUI Lang view of plan for the dashboard.
string plan_view = 49;
}
// Event mirrors internal/events.Event. Data is carried as a JSON object
+1 -1
View File
@@ -1 +1 @@
import{t as e}from"./badge.js";import{A as t,C as n,Ct as r,M as i,S as a,Xt as o,_t as s,b as c,dt as l,ir as u,jn as d,k as f,l as p,st as m,t as h,x as g,xn as _}from"./PageHeader.js";import{M as v,n as y,r as b}from"./createLucideIcon.js";import{A as x,C as S,D as C,M as w,O as T,S as E,T as D,a as O,c as k,d as A,f as j,g as M,i as N,j as ee,k as P,l as F,m as I,n as L,o as R,s as z,t as B,u as V,w as H,x as U}from"./index.js";function W(e,t=Date.now()){if(!e.captured)return`unconfigured`;if(!e.expires_at)return`ready`;let n=Date.parse(e.expires_at);return Number.isNaN(n)?`ready`:n<=t?`expired`:n-t<=18e5?`expiring`:`ready`}function G(e,t,n=80,r=24){let i=t.protocol===`https:`?`wss:`:`ws:`,a=new URLSearchParams({profile:e,cols:String(n),rows:String(r)}).toString();return`${i}//${t.host}/api/harness/terminal?${a}`}var K={class:`flex h-full min-h-0 flex-col gap-2`},q={key:0,class:`text-sm text-fg-muted`,role:`status`},J=i({__name:`SetupTerminal`,props:{profile:{}},setup(e){let t=e,r=_(null),i=_(`connecting`),o=null,u=null,d=null,h=null;function g(){try{d?.fit()}catch{}}return l(()=>{let e=r.value;if(!e)return;o=new L({convertEol:!0,cursorBlink:!0,fontFamily:`'IBM Plex Mono', ui-monospace, monospace`,fontSize:13,theme:{background:`#0b0f14`,foreground:`#e6edf3`,cursor:`#e6edf3`,selectionBackground:`#264f78`}}),d=new B,o.loadAddon(d),o.open(e),g(),o.focus();let n=new WebSocket(G(t.profile,window.location,o?.cols??80,o?.rows??24));u=n,n.binaryType=`arraybuffer`,n.onopen=()=>{i.value=`open`},n.onmessage=e=>{o&&(typeof e.data==`string`?o.write(e.data):o.write(new Uint8Array(e.data)))},n.onerror=()=>{i.value=`failed`},n.onclose=()=>{i.value=`closed`},o.onData(e=>{n.readyState===WebSocket.OPEN&&n.send(e)}),h=new ResizeObserver(g),h.observe(e)}),m(()=>{h?.disconnect(),h=null,u?.close(),u=null,o?.dispose(),o=null,d=null}),(e,t)=>(s(),n(`div`,K,[i.value===`open`?a(``,!0):(s(),n(`p`,q,[i.value===`connecting`?(s(),n(p,{key:0},[f(`Connecting…`)],64)):i.value===`closed`?(s(),n(p,{key:1},[f(`The terminal session ended.`)],64)):(s(),n(p,{key:2},[f(`Could not open the setup terminal.`)],64))])),c(`div`,{ref_key:`host`,ref:r,class:`min-h-0 flex-1 overflow-hidden rounded-md border border-border bg-[#0b0f14] p-2`},null,512)]))}}),Y={key:1,class:`flex flex-col gap-2`},X={class:`flex flex-wrap items-end gap-3`},Z={class:`flex flex-col gap-1 text-sm`},Q={class:`h-96`},$=i({__name:`HarnessPage`,setup(i){let m=_(null),L=_(!0),B=_(null),G=_(!1),K=_(``),q=_(!1),$={ready:{label:`Ready`,variant:`ok`},expiring:{label:`Expiring soon`,variant:`warn`},expired:{label:`Expired`,variant:`danger`},unconfigured:{label:`Not set up`,variant:`idle`}};l(te);async function te(){L.value=!0,B.value=null,G.value=!1;try{let e=await b.harnessBindings();m.value={terminal:e.terminal,bindings:e.bindings??[],profiles:e.profiles??[]},K.value=m.value.profiles[0]??``}catch(e){let t=e instanceof y?e.status:void 0;t===501||t===503?G.value=!0:B.value=e instanceof Error?e.message:String(e),m.value=null}finally{L.value=!1}}function ne(){m.value?.terminal&&K.value&&(q.value=!0)}function re(e){return e.scopes?.length?e.scopes.join(`, `):`–`}return(i,l)=>(s(),n(`div`,null,[t(h,{title:`Harness`}),B.value?(s(),g(d(S),{key:0,variant:`destructive`,class:`mb-4`},{default:o(()=>[t(d(U),null,{default:o(()=>[...l[1]||=[f(`Could not load the harness`,-1)]]),_:1}),t(d(E),null,{default:o(()=>[f(u(B.value),1)]),_:1})]),_:1})):a(``,!0),L.value?(s(),n(`div`,Y,[t(d(D),{class:`h-24 w-full`}),t(d(D),{class:`h-40 w-full`})])):G.value?(s(),g(d(I),{key:2},{default:o(()=>[t(d(j),null,{default:o(()=>[t(d(A),null,{default:o(()=>[...l[2]||=[f(`Harness bindings are not configured`,-1)]]),_:1})]),_:1})]),_:1})):m.value?(s(),n(p,{key:3},[m.value.terminal?(s(),g(d(M),{key:1},{default:o(()=>[c(`div`,X,[c(`div`,Z,[t(d(N),{for:`harness-profile`,class:`text-fg-muted`},{default:o(()=>[...l[5]||=[f(`Profile`,-1)]]),_:1}),t(d(w),{modelValue:K.value,"onUpdate:modelValue":l[0]||=e=>K.value=e,disabled:!m.value.profiles.length},{default:o(()=>[t(d(T),{id:`harness-profile`,size:`sm`,class:`min-w-48`},{default:o(()=>[t(d(C),{placeholder:`No profiles configured`})]),_:1}),t(d(ee),null,{default:o(()=>[t(d(x),null,{default:o(()=>[(s(!0),n(p,null,r(m.value.profiles,e=>(s(),g(d(P),{key:e,value:e},{default:o(()=>[f(u(e),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`modelValue`,`disabled`])]),t(d(v),{disabled:!K.value,onClick:ne},{default:o(()=>[...l[6]||=[f(`Open setup terminal`,-1)]]),_:1},8,[`disabled`])])]),_:1})):(s(),g(d(S),{key:0,class:`mb-4`},{default:o(()=>[t(d(U),null,{default:o(()=>[...l[3]||=[f(`Setup terminal unavailable`,-1)]]),_:1}),t(d(E),null,{default:o(()=>[...l[4]||=[f(`Start the daemon with a container runtime and a harness token to log in to a CLI from here.`,-1)]]),_:1})]),_:1})),q.value&&K.value?(s(),g(d(M),{key:2},{default:o(()=>[c(`div`,Q,[t(J,{profile:K.value},null,8,[`profile`])])]),_:1})):a(``,!0),t(d(M),null,{default:o(()=>[t(d(V),null,{default:o(()=>[t(d(O),null,{deLine truncated
import{A as e,C as t,Ct as n,M as r,S as i,Xt as a,_t as o,b as s,dt as c,ir as l,jn as u,k as d,l as f,st as p,t as m,x as h,xn as g}from"./PageHeader.js";import{M as _,n as v,r as y}from"./createLucideIcon.js";import{t as b}from"./badge.js";import{A as x,C as S,D as C,M as w,O as T,S as E,T as D,a as O,c as k,d as A,f as j,g as M,i as N,j as ee,k as P,l as F,m as I,n as L,o as R,s as z,t as B,u as V,w as H,x as U}from"./index.js";function W(e,t=Date.now()){if(!e.captured)return`unconfigured`;if(!e.expires_at)return`ready`;let n=Date.parse(e.expires_at);return Number.isNaN(n)?`ready`:n<=t?`expired`:n-t<=18e5?`expiring`:`ready`}function G(e,t,n=80,r=24){let i=t.protocol===`https:`?`wss:`:`ws:`,a=new URLSearchParams({profile:e,cols:String(n),rows:String(r)}).toString();return`${i}//${t.host}/api/harness/terminal?${a}`}var K={class:`flex h-full min-h-0 flex-col gap-2`},q={key:0,class:`text-sm text-fg-muted`,role:`status`},J=r({__name:`SetupTerminal`,props:{profile:{}},setup(e){let n=e,r=g(null),a=g(`connecting`),l=null,u=null,m=null,h=null;function _(){try{m?.fit()}catch{}}return c(()=>{let e=r.value;if(!e)return;l=new L({convertEol:!0,cursorBlink:!0,fontFamily:`'IBM Plex Mono', ui-monospace, monospace`,fontSize:13,theme:{background:`#0b0f14`,foreground:`#e6edf3`,cursor:`#e6edf3`,selectionBackground:`#264f78`}}),m=new B,l.loadAddon(m),l.open(e),_(),l.focus();let t=new WebSocket(G(n.profile,window.location,l?.cols??80,l?.rows??24));u=t,t.binaryType=`arraybuffer`,t.onopen=()=>{a.value=`open`},t.onmessage=e=>{l&&(typeof e.data==`string`?l.write(e.data):l.write(new Uint8Array(e.data)))},t.onerror=()=>{a.value=`failed`},t.onclose=()=>{a.value=`closed`},l.onData(e=>{t.readyState===WebSocket.OPEN&&t.send(e)}),h=new ResizeObserver(_),h.observe(e)}),p(()=>{h?.disconnect(),h=null,u?.close(),u=null,l?.dispose(),l=null,m=null}),(e,n)=>(o(),t(`div`,K,[a.value===`open`?i(``,!0):(o(),t(`p`,q,[a.value===`connecting`?(o(),t(f,{key:0},[d(`Connecting…`)],64)):a.value===`closed`?(o(),t(f,{key:1},[d(`The terminal session ended.`)],64)):(o(),t(f,{key:2},[d(`Could not open the setup terminal.`)],64))])),s(`div`,{ref_key:`host`,ref:r,class:`min-h-0 flex-1 overflow-hidden rounded-md border border-border bg-[#0b0f14] p-2`},null,512)]))}}),Y={key:1,class:`flex flex-col gap-2`},X={class:`flex flex-wrap items-end gap-3`},Z={class:`flex flex-col gap-1 text-sm`},Q={class:`h-96`},$=r({__name:`HarnessPage`,setup(r){let p=g(null),L=g(!0),B=g(null),G=g(!1),K=g(``),q=g(!1),$={ready:{label:`Ready`,variant:`ok`},expiring:{label:`Expiring soon`,variant:`warn`},expired:{label:`Expired`,variant:`danger`},unconfigured:{label:`Not set up`,variant:`idle`}};c(te);async function te(){L.value=!0,B.value=null,G.value=!1;try{let e=await y.harnessBindings();p.value={terminal:e.terminal,bindings:e.bindings??[],profiles:e.profiles??[]},K.value=p.value.profiles[0]??``}catch(e){let t=e instanceof v?e.status:void 0;t===501||t===503?G.value=!0:B.value=e instanceof Error?e.message:String(e),p.value=null}finally{L.value=!1}}function ne(){p.value?.terminal&&K.value&&(q.value=!0)}function re(e){return e.scopes?.length?e.scopes.join(`, `):`–`}return(r,c)=>(o(),t(`div`,null,[e(m,{title:`Harness`}),B.value?(o(),h(u(S),{key:0,variant:`destructive`,class:`mb-4`},{default:a(()=>[e(u(U),null,{default:a(()=>[...c[1]||=[d(`Could not load the harness`,-1)]]),_:1}),e(u(E),null,{default:a(()=>[d(l(B.value),1)]),_:1})]),_:1})):i(``,!0),L.value?(o(),t(`div`,Y,[e(u(D),{class:`h-24 w-full`}),e(u(D),{class:`h-40 w-full`})])):G.value?(o(),h(u(I),{key:2},{default:a(()=>[e(u(j),null,{default:a(()=>[e(u(A),null,{default:a(()=>[...c[2]||=[d(`Harness bindings are not configured`,-1)]]),_:1})]),_:1})]),_:1})):p.value?(o(),t(f,{key:3},[p.value.terminal?(o(),h(u(M),{key:1},{default:a(()=>[s(`div`,X,[s(`div`,Z,[e(u(N),{for:`harness-profile`,class:`text-fg-muted`},{default:a(()=>[...c[5]||=[d(`Profile`,-1)]]),_:1}),e(u(w),{modelValue:K.value,"onUpdate:modelValue":c[0]||=e=>K.value=e,disabled:!p.value.profiles.length},{default:a(()=>[e(u(T),{id:`harness-profile`,size:`sm`,class:`min-w-48`},{default:a(()=>[e(u(C),{placeholder:`No profiles configured`})]),_:1}),e(u(ee),null,{default:a(()=>[e(u(x),null,{default:a(()=>[(o(!0),t(f,null,n(p.value.profiles,e=>(o(),h(u(P),{key:e,value:e},{default:a(()=>[d(l(e),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`modelValue`,`disabled`])]),e(u(_),{disabled:!K.value,onClick:ne},{default:a(()=>[...c[6]||=[d(`Open setup terminal`,-1)]]),_:1},8,[`disabled`])])]),_:1})):(o(),h(u(S),{key:0,class:`mb-4`},{default:a(()=>[e(u(U),null,{default:a(()=>[...c[3]||=[d(`Setup terminal unavailable`,-1)]]),_:1}),e(u(E),null,{default:a(()=>[...c[4]||=[d(`Start the daemon with a container runtime and a harness token to log in to a CLI from here.`,-1)]]),_:1})]),_:1})),q.value&&K.value?(o(),h(u(M),{key:2},{default:a(()=>[s(`div`,Q,[e(J,{profile:K.value},null,8,[`profile`])])]),_:1})):i(``,!0),e(u(M),null,{default:a(()=>[e(u(V),null,{default:a(()=>[e(u(O),null,{deLine truncated
+2 -2
View File
@@ -1,3 +1,3 @@
import{$ as e,$t as t,A as n,An as r,At as i,B as a,Bt as o,C as s,Cn as c,Ct as l,D as u,Dn as d,Dt as f,E as p,En as m,Et as h,F as g,Fn as _,Ft as v,G as y,Gt as b,H as x,Ht as S,I as C,It as w,J as T,Jt as E,K as ee,Kt as D,L as O,Lt as te,M as k,Mt as ne,N as re,Nt as ie,O as ae,On as oe,Ot as se,P as ce,Pn as le,Pt as ue,Q as de,Qt as fe,R as pe,Rt as me,S as he,Sn as ge,St as _e,T as ve,Tn as ye,Tt as be,U as xe,Ut as Se,V as Ce,Vt as we,W as Te,Wt as Ee,X as De,Xt as Oe,Y as ke,Yt as Ae,Z as je,Zt as Me,_ as Ne,_n as Pe,_t as A,a as Fe,an as Ie,ar as Le,at as Re,b as ze,bn as Be,bt as Ve,c as He,cn as Ue,ct as We,d as Ge,dn as Ke,dt as qe,en as Je,er as Ye,et as Xe,f as Ze,fn as Qe,ft as $e,g as et,gn as tt,gt as nt,h as rt,hn as it,ht as at,i as ot,in as st,ir as ct,it as j,j as lt,jn as M,jt as ut,k as dt,kn as N,kt as ft,l as pt,ln as mt,lt as ht,m as gt,mn as _t,mt as vt,n as yt,nn as bt,nr as xt,nt as St,o as Ct,on as wt,ot as Tt,p as Et,pn as Dt,pt as Ot,q as kt,qt as At,r as jt,rn as Mt,rr as Nt,rt as Pt,s as Ft,sn as It,st as Lt,tn as Rt,tt as zt,u as Bt,un as Vt,ut as Ht,v as Ut,vn as Wt,vt as Gt,w as Kt,wn as qt,wt as P,x as F,xn as I,xt as Jt,y as L,yn as Yt,yt as Xt,z as Zt,zt as Qt}from"./PageHeader.js";import{$ as $t,B as en,C as tn,F as nn,G as rn,H as an,I as on,J as sn,K as cn,L as ln,N as un,Q as dn,R as fn,U as pn,V as mn,W as hn,X as gn,Y as _n,Z as vn,at as yn,et as bn,it as xn,nt as Sn,q as Cn,rt as wn,t as Tn,tt as En,z as Dn}from"./createLucideIcon.js";var On=Object.defineProperty,kn=(e,t)=>{let n={};for(var r in e)On(n,r,{get:e[r],enumerable:!0});return t||On(n,Symbol.toStringTag,{value:`Module`}),n},An=kn({BaseTransition:()=>ot,BaseTransitionPropsValidators:()=>Fe,Comment:()=>Ct,DeprecationTypes:()=>null,EffectScope:()=>Rt,ErrorCodes:()=>Ft,ErrorTypeStrings:()=>He,Fragment:()=>pt,KeepAlive:()=>Bt,ReactiveEffect:()=>bt,Static:()=>Ge,Suspense:()=>Ze,Teleport:()=>Et,Text:()=>gt,TrackOpTypes:()=>Mt,Transition:()=>on,TransitionGroup:()=>ln,TriggerOpTypes:()=>st,VueElement:()=>fn,assertNumber:()=>rt,callWithAsyncErrorHandling:()=>et,callWithErrorHandling:()=>Ne,camelize:()=>le,capitalize:()=>_,cloneVNode:()=>Ut,compatUtils:()=>null,compile:()=>jn,computed:()=>L,createApp:()=>Dn,createBlock:()=>F,createCommentVNode:()=>he,createElementBlock:()=>s,createElementVNode:()=>ze,createHydrationRenderer:()=>Kt,createPropsRestProxy:()=>ve,createRenderer:()=>p,createSSRApp:()=>en,createSlots:()=>u,createStaticVNode:()=>ae,createTextVNode:()=>dt,createVNode:()=>n,customRef:()=>Ie,defineAsyncComponent:()=>lt,defineComponent:()=>k,defineCustomElement:()=>mn,defineEmits:()=>re,defineExpose:()=>ce,defineModel:()=>g,defineOptions:()=>C,defineProps:()=>O,defineSSRCustomElement:()=>an,defineSlots:()=>pe,devtools:()=>Zt,effect:()=>wt,effectScope:()=>It,getCurrentInstance:()=>a,getCurrentScope:()=>Ue,getCurrentWatcher:()=>mt,getTransitionRawChildren:()=>Ce,guardReactiveProps:()=>x,h:()=>xe,handleError:()=>Te,hasInjectionContext:()=>y,hydrate:()=>pn,hydrateOnIdle:()=>ee,hydrateOnInteraction:()=>kt,hydrateOnMediaQuery:()=>T,hydrateOnVisible:()=>ke,initCustomFormatter:()=>De,initDirectivesForSSR:()=>hn,inject:()=>je,isMemoSame:()=>de,isProxy:()=>Vt,isReactive:()=>Ke,isReadonly:()=>Qe,isRef:()=>Dt,isRuntimeOnly:()=>e,isShallow:()=>_t,isVNode:()=>Xe,markRaw:()=>it,mergeDefaults:()=>zt,mergeModels:()=>St,mergeProps:()=>Pt,nextTick:()=>j,nodeOps:()=>rn,normalizeClass:()=>Ye,normalizeProps:()=>xt,normalizeStyle:()=>Nt,onActivated:()=>Re,onBeforeMount:()=>Tt,onBeforeUnmount:()=>Lt,onBeforeUpdate:()=>We,onDeactivated:()=>ht,onErrorCaptured:()=>Ht,onMounted:()=>qe,onRenderTracked:()=>$e,onRenderTriggered:()=>Ot,onScopeDispose:()=>tt,onServerPrefetch:()=>vt,onUnmounted:()=>at,onUpdated:()=>nt,onWatcherCleanup:()=>Pe,openBlock:()=>A,patchProp:()=>cn,popScopeId:()=>Gt,provide:()=>Xt,proxyRefs:()=>Wt,pushScopeId:()=>Ve,queuePostFlushCb:()=>Jt,reactive:()=>Yt,readonly:()=>Be,ref:()=>I,registerRuntimeCompiler:()=>_e,render:()=>Cn,renderList:()=>l,renderSlot:()=>P,resolveComponent:()=>be,resolveDirective:()=>h,resolveDynamicComponent:()=>f,resolveFilter:()=>null,resolveTransitionHooks:()=>se,setBlockTracking:()=>ft,setDevtoolsHook:()=>i,setTransitionHooks:()=>ut,shallowReactive:()=>ge,shallowReadonly:()=>c,shallowRef:()=>qt,ssrContextKey:()=>ne,ssrUtils:()=>ie,stop:()=>ye,toDisplayString:()=>ct,toHandlerKey:()=>Le,toHandlers:()=>ue,toRaw:()=>m,toRef:()=>d,toRefs:()=>oe,toValue:()=>N,transformVNodeArgs:()=>v,triggerRef:()=>r,unref:()=>M,useAttrs:()=>w,useCssModule:()=>sn,useCssVars:()=>_n,useHost:()=>gn,useId:()=>te,useModel:()=>me,useSSRContext:()=>Qt,useShadowRoot:()=>vn,useSlots:()=>o,useTemplateRef:()=>we,useTransitionState:()=>S,vModelCheckbox:()=>dn,vModelDynamic:()=>$t,vModelRadio:()=>bn,vModelSelect:()=>En,vModelText:()=>Sn,vShow:()=>wn,version:()=>Se,warn:()=>Ee,watch:()=>b,watchEffect:()=>D,watchPostEffect:()=>At,watchSyncEffect:()=>E,withAsyncContext:()=>Ae,withCtx:()=>Oe,withDefaults:()=>Me,withDirectives:Line truncated
import{r as e}from"./rolldown-runtime.js";import{$ as t,$t as n,A as r,An as i,At as a,B as o,Bt as s,C as c,Cn as l,Ct as u,D as d,Dn as f,Dt as p,E as m,En as h,Et as g,F as _,Fn as v,Ft as y,G as b,Gt as x,H as S,Ht as C,I as w,It as T,J as E,Jt as ee,K as te,Kt as D,L as ne,Lt as re,M as O,Mt as ie,N as ae,Nt as oe,O as se,On as ce,Ot as le,P as ue,Pn as de,Pt as fe,Q as pe,Qt as me,R as he,Rt as ge,S as _e,Sn as ve,St as ye,T as be,Tn as xe,Tt as Se,U as Ce,Ut as we,V as Te,Vt as Ee,W as De,Wt as Oe,X as ke,Xt as Ae,Y as je,Yt as Me,Z as Ne,Zt as Pe,_ as Fe,_n as Ie,_t as k,a as Le,an as Re,ar as ze,at as Be,b as Ve,bn as He,bt as Ue,c as We,cn as Ge,ct as Ke,d as qe,dn as Je,dt as Ye,en as Xe,er as Ze,et as Qe,f as $e,fn as et,ft as tt,g as nt,gn as rt,gt as it,h as at,hn as ot,ht as st,i as ct,in as lt,ir as ut,it as A,j as dt,jn as j,jt as ft,k as pt,kn as M,kt as mt,l as ht,ln as gt,lt as _t,m as vt,mn as yt,mt as bt,n as xt,nn as St,nr as Ct,nt as wt,o as Tt,on as Et,ot as Dt,p as Ot,pn as kt,pt as At,q as jt,qt as Mt,r as Nt,rn as Pt,rr as Ft,rt as It,s as Lt,sn as Rt,st as zt,tn as Bt,tt as Vt,u as Ht,un as Ut,ut as Wt,v as Gt,vn as Kt,vt as qt,w as Jt,wn as Yt,wt as N,x as P,xn as F,xt as Xt,y as I,yn as Zt,yt as Qt,z as $t,zt as en}from"./PageHeader.js";import{$ as tn,B as nn,C as rn,F as an,G as on,H as sn,I as cn,J as ln,K as un,L as dn,N as fn,Q as pn,R as mn,U as hn,V as gn,W as _n,X as vn,Y as yn,Z as bn,at as xn,et as Sn,it as Cn,nt as wn,q as Tn,rt as En,t as Dn,tt as On,z as kn}from"./createLucideIcon.js";var An=e({BaseTransition:()=>ct,BaseTransitionPropsValidators:()=>Le,Comment:()=>Tt,DeprecationTypes:()=>null,EffectScope:()=>Bt,ErrorCodes:()=>Lt,ErrorTypeStrings:()=>We,Fragment:()=>ht,KeepAlive:()=>Ht,ReactiveEffect:()=>St,Static:()=>qe,Suspense:()=>$e,Teleport:()=>Ot,Text:()=>vt,TrackOpTypes:()=>Pt,Transition:()=>cn,TransitionGroup:()=>dn,TriggerOpTypes:()=>lt,VueElement:()=>mn,assertNumber:()=>at,callWithAsyncErrorHandling:()=>nt,callWithErrorHandling:()=>Fe,camelize:()=>de,capitalize:()=>v,cloneVNode:()=>Gt,compatUtils:()=>null,compile:()=>jn,computed:()=>I,createApp:()=>kn,createBlock:()=>P,createCommentVNode:()=>_e,createElementBlock:()=>c,createElementVNode:()=>Ve,createHydrationRenderer:()=>Jt,createPropsRestProxy:()=>be,createRenderer:()=>m,createSSRApp:()=>nn,createSlots:()=>d,createStaticVNode:()=>se,createTextVNode:()=>pt,createVNode:()=>r,customRef:()=>Re,defineAsyncComponent:()=>dt,defineComponent:()=>O,defineCustomElement:()=>gn,defineEmits:()=>ae,defineExpose:()=>ue,defineModel:()=>_,defineOptions:()=>w,defineProps:()=>ne,defineSSRCustomElement:()=>sn,defineSlots:()=>he,devtools:()=>$t,effect:()=>Et,effectScope:()=>Rt,getCurrentInstance:()=>o,getCurrentScope:()=>Ge,getCurrentWatcher:()=>gt,getTransitionRawChildren:()=>Te,guardReactiveProps:()=>S,h:()=>Ce,handleError:()=>De,hasInjectionContext:()=>b,hydrate:()=>hn,hydrateOnIdle:()=>te,hydrateOnInteraction:()=>jt,hydrateOnMediaQuery:()=>E,hydrateOnVisible:()=>je,initCustomFormatter:()=>ke,initDirectivesForSSR:()=>_n,inject:()=>Ne,isMemoSame:()=>pe,isProxy:()=>Ut,isReactive:()=>Je,isReadonly:()=>et,isRef:()=>kt,isRuntimeOnly:()=>t,isShallow:()=>yt,isVNode:()=>Qe,markRaw:()=>ot,mergeDefaults:()=>Vt,mergeModels:()=>wt,mergeProps:()=>It,nextTick:()=>A,nodeOps:()=>on,normalizeClass:()=>Ze,normalizeProps:()=>Ct,normalizeStyle:()=>Ft,onActivated:()=>Be,onBeforeMount:()=>Dt,onBeforeUnmount:()=>zt,onBeforeUpdate:()=>Ke,onDeactivated:()=>_t,onErrorCaptured:()=>Wt,onMounted:()=>Ye,onRenderTracked:()=>tt,onRenderTriggered:()=>At,onScopeDispose:()=>rt,onServerPrefetch:()=>bt,onUnmounted:()=>st,onUpdated:()=>it,onWatcherCleanup:()=>Ie,openBlock:()=>k,patchProp:()=>un,popScopeId:()=>qt,provide:()=>Qt,proxyRefs:()=>Kt,pushScopeId:()=>Ue,queuePostFlushCb:()=>Xt,reactive:()=>Zt,readonly:()=>He,ref:()=>F,registerRuntimeCompiler:()=>ye,render:()=>Tn,renderList:()=>u,renderSlot:()=>N,resolveComponent:()=>Se,resolveDirective:()=>g,resolveDynamicComponent:()=>p,resolveFilter:()=>null,resolveTransitionHooks:()=>le,setBlockTracking:()=>mt,setDevtoolsHook:()=>a,setTransitionHooks:()=>ft,shallowReactive:()=>ve,shallowReadonly:()=>l,shallowRef:()=>Yt,ssrContextKey:()=>ie,ssrUtils:()=>oe,stop:()=>xe,toDisplayString:()=>ut,toHandlerKey:()=>ze,toHandlers:()=>fe,toRaw:()=>h,toRef:()=>f,toRefs:()=>ce,toValue:()=>M,transformVNodeArgs:()=>y,triggerRef:()=>i,unref:()=>j,useAttrs:()=>T,useCssModule:()=>ln,useCssVars:()=>yn,useHost:()=>vn,useId:()=>re,useModel:()=>ge,useSSRContext:()=>en,useShadowRoot:()=>bn,useSlots:()=>s,useTemplateRef:()=>Ee,useTransitionState:()=>C,vModelCheckbox:()=>pn,vModelDynamic:()=>tn,vModelRadio:()=>Sn,vModelSelect:()=>On,vModelText:()=>wn,vShow:()=>En,version:()=>we,warn:()=>Oe,watch:()=>x,watchEffect:()=>D,watchPostEffect:()=>Mt,watchSyncEffect:()=>ee,withAsyncContext:()=>Me,withCtx:()=>Ae,withDefaults:()=>Pe,withDirectives:()=>me,withKeys:()=>Cn,withMemo:()=>n,withModifiers:()=>xn,withScopeId:()=>Xe}),jn=()=>{};function Mn(eLine truncated
`)].join(`
`))}return()=>i.value||r.value||s.value?xe(t.default({present:s.value})[0],{ref:e=>{let t=H(e);return t?.hasAttribute===void 0||(t?.hasAttribute(`data-reka-popper-content-wrapper`)?o.value=t.firstElementChild:o.value=t),t}}):null}}),oi=`dismissableLayer.pointerDownOutside`,si=`dismissableLayer.focusOutside`;function ci(e){if(typeof e!=`object`||!e)return!1;let t=e.ownerDocument?.defaultView;return typeof Element<`u`&&e instanceof Element||!!t&&e instanceof t.Element}function li(e,t){if(!ci(t))return!1;if(e.contains(t))return!0;let n=t.closest(`[data-dismissable-layer]`),r=e.dataset.dismissableLayer===``?e:e.querySelector(`[data-dismissable-layer]`),i=Array.from(e.ownerDocument.querySelectorAll(`[data-dismissable-layer]`));return!!(n&&(r===n||i.indexOf(r)<i.indexOf(n)))}function ui(e,t,n=!0){let r=I(!1),i=I(()=>{});return D(a=>{if(!B||!N(n))return;let o=t?.value?.ownerDocument??globalThis.document,s=async n=>{let a=n.target;if(t?.value&&a){if(li(t.value,a))o.removeEventListener(`click`,i.value),r.value=!1;else{if(n.target&&!r.value){let t={originalEvent:n};function r(){zn(oi,e,t)}n.pointerType===`touch`?(o.removeEventListener(`click`,i.value),i.value=r,o.addEventListener(`click`,i.value,{once:!0})):r()}else o.removeEventListener(`click`,i.value);r.value=!1}}},c=window.setTimeout(()=>{o.addEventListener(`pointerdown`,s)},0);a(()=>{window.clearTimeout(c),o.removeEventListener(`pointerdown`,s),o.removeEventListener(`click`,i.value)})}),{onPointerDownCapture:()=>{N(n)&&(r.value=!0)}}}function di(e,t,n=!0){let r=I(!1);return D(i=>{if(!B||!N(n))return;let a=t?.value?.ownerDocument??globalThis.document,o=async n=>{if(!t?.value)return;await j(),await j();let i=n.target;t.value&&i&&!li(t.value,i)&&n.target&&!r.value&&zn(si,e,{originalEvent:n})};a.addEventListener(`focusin`,o),i(()=>a.removeEventListener(`focusin`,o))}),{onFocusCapture:()=>{N(n)&&(r.value=!0)},onBlurCapture:()=>{N(n)&&(r.value=!1)}}}var U=Yt({layersRoot:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),fi=k({__name:`DismissableLayer`,props:{disableOutsidePointerEvents:{type:Boolean,required:!1,default:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},present:{type:Boolean,required:!1,default:!0}},emits:[`escapeKeyDown`,`pointerDownOutside`,`focusOutside`,`interactOutside`,`dismiss`],setup(e,{emit:t}){let n=e,r=t,{forwardRef:i,currentElement:a}=Br(),o=L(()=>a.value?.ownerDocument??globalThis.document),s=L(()=>U.layersRoot),c=L(()=>a.value?Array.from(s.value).indexOf(a.value):-1),l=L(()=>U.layersWithOutsidePointerEventsDisabled.size>0),u=L(()=>{let e=Array.from(s.value),[t]=[...U.layersWithOutsidePointerEventsDisabled].slice(-1),n=e.indexOf(t);return c.value>=n}),d=ui(async e=>{let t=[...U.branches].some(t=>t?.contains(e.target));n.present&&u.value&&!t&&(r(`pointerDownOutside`,e),r(`interactOutside`,e),await j(),e.defaultPrevented||r(`dismiss`))},a,()=>n.present),f=di(e=>{let t=[...U.branches].some(t=>t?.contains(e.target));n.present&&!t&&(r(`focusOutside`,e),r(`interactOutside`,e),e.defaultPrevented||r(`dismiss`))},a);return fr(`Escape`,e=>{n.present&&c.value===s.value.size-1&&(r(`escapeKeyDown`,e),e.defaultPrevented||r(`dismiss`))},{target:()=>o.value?.defaultView??globalThis.window}),b([a,()=>n.disableOutsidePointerEvents,()=>n.present],([e,t,n],r,i)=>{if(e&&n&&t){let t=e.ownerDocument;wr(t,e),U.layersWithOutsidePointerEventsDisabled.add(e),i(()=>{U.layersWithOutsidePointerEventsDisabled.delete(e),Tr(t,e)})}},{immediate:!0}),b([a,()=>n.present],([e,t],n,r)=>{e&&t&&(s.value.add(e),r(()=>{s.value.delete(e)}))},{immediate:!0}),D(e=>{e(()=>{a.value&&(s.value.delete(a.value),U.layersWithOutsidePointerEventsDisabled.delete(a.value))})}),(t,n)=>(A(),F(M(un),{ref:M(i),"as-child":e.asChild,as:e.as,"data-dismissable-layer":``,style:Nt({pointerEvents:l.value?u.value?`auto`:`none`:void 0}),onFocusCapture:M(f).onFocusCapture,onBlurCapture:M(f).onBlurCapture,onPointerdownCapture:M(d).onPointerDownCapture},{default:Oe(()=>[P(t.$slots,`default`)]),_:3},8,[`as-child`,`as`,`style`,`onFocusCapture`,`onBlurCapture`,`onPointerdownCapture`]))}}),pi=Hn(()=>I([]));function mi(){let e=pi();return{add(t){let n=e.value[0];t!==n&&n?.pause(),e.value=hi(e.value,t),e.value.unshift(t)},remove(t){e.value=hi(e.value,t),e.value[0]?.resume()}}}function hi(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}var gi=`focusScope.autoFocusOnMount`,_i=`focusScope.autoFocusOnUnmount`,vi={bubbles:!1,cancelable:!0};function yi(e,t){let n=t;for(;n;){if(e.contains(n))return!0;n=n.getRootNode().host??null}return!1}function bi(e,{select:t=!1}={}){let n=R();for(let r of e)if(W(r,{select:t}),R()!==n)return!0}function xi(e){let t=Si(e);return[Ci(t,e),Ci(t.reverse(),e)]}function Si(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n Line truncated
`))}return()=>i.value||r.value||s.value?Ce(t.default({present:s.value})[0],{ref:e=>{let t=V(e);return t?.hasAttribute===void 0||(t?.hasAttribute(`data-reka-popper-content-wrapper`)?a.value=t.firstElementChild:a.value=t),t}}):null}}),oi=`dismissableLayer.pointerDownOutside`,si=`dismissableLayer.focusOutside`;function ci(e){if(typeof e!=`object`||!e)return!1;let t=e.ownerDocument?.defaultView;return typeof Element<`u`&&e instanceof Element||!!t&&e instanceof t.Element}function li(e,t){if(!ci(t))return!1;if(e.contains(t))return!0;let n=t.closest(`[data-dismissable-layer]`),r=e.dataset.dismissableLayer===``?e:e.querySelector(`[data-dismissable-layer]`),i=Array.from(e.ownerDocument.querySelectorAll(`[data-dismissable-layer]`));return!!(n&&(r===n||i.indexOf(r)<i.indexOf(n)))}function ui(e,t,n=!0){let r=F(!1),i=F(()=>{});return D(a=>{if(!z||!M(n))return;let o=t?.value?.ownerDocument??globalThis.document,s=async n=>{let a=n.target;if(t?.value&&a){if(li(t.value,a))o.removeEventListener(`click`,i.value),r.value=!1;else{if(n.target&&!r.value){let t={originalEvent:n};function r(){zn(oi,e,t)}n.pointerType===`touch`?(o.removeEventListener(`click`,i.value),i.value=r,o.addEventListener(`click`,i.value,{once:!0})):r()}else o.removeEventListener(`click`,i.value);r.value=!1}}},c=window.setTimeout(()=>{o.addEventListener(`pointerdown`,s)},0);a(()=>{window.clearTimeout(c),o.removeEventListener(`pointerdown`,s),o.removeEventListener(`click`,i.value)})}),{onPointerDownCapture:()=>{M(n)&&(r.value=!0)}}}function di(e,t,n=!0){let r=F(!1);return D(i=>{if(!z||!M(n))return;let a=t?.value?.ownerDocument??globalThis.document,o=async n=>{if(!t?.value)return;await A(),await A();let i=n.target;t.value&&i&&!li(t.value,i)&&n.target&&!r.value&&zn(si,e,{originalEvent:n})};a.addEventListener(`focusin`,o),i(()=>a.removeEventListener(`focusin`,o))}),{onFocusCapture:()=>{M(n)&&(r.value=!0)},onBlurCapture:()=>{M(n)&&(r.value=!1)}}}var H=Zt({layersRoot:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),fi=O({__name:`DismissableLayer`,props:{disableOutsidePointerEvents:{type:Boolean,required:!1,default:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},present:{type:Boolean,required:!1,default:!0}},emits:[`escapeKeyDown`,`pointerDownOutside`,`focusOutside`,`interactOutside`,`dismiss`],setup(e,{emit:t}){let n=e,r=t,{forwardRef:i,currentElement:a}=Br(),o=I(()=>a.value?.ownerDocument??globalThis.document),s=I(()=>H.layersRoot),c=I(()=>a.value?Array.from(s.value).indexOf(a.value):-1),l=I(()=>H.layersWithOutsidePointerEventsDisabled.size>0),u=I(()=>{let e=Array.from(s.value),[t]=[...H.layersWithOutsidePointerEventsDisabled].slice(-1),n=e.indexOf(t);return c.value>=n}),d=ui(async e=>{let t=[...H.branches].some(t=>t?.contains(e.target));n.present&&u.value&&!t&&(r(`pointerDownOutside`,e),r(`interactOutside`,e),await A(),e.defaultPrevented||r(`dismiss`))},a,()=>n.present),f=di(e=>{let t=[...H.branches].some(t=>t?.contains(e.target));n.present&&!t&&(r(`focusOutside`,e),r(`interactOutside`,e),e.defaultPrevented||r(`dismiss`))},a);return fr(`Escape`,e=>{n.present&&c.value===s.value.size-1&&(r(`escapeKeyDown`,e),e.defaultPrevented||r(`dismiss`))},{target:()=>o.value?.defaultView??globalThis.window}),x([a,()=>n.disableOutsidePointerEvents,()=>n.present],([e,t,n],r,i)=>{if(e&&n&&t){let t=e.ownerDocument;wr(t,e),H.layersWithOutsidePointerEventsDisabled.add(e),i(()=>{H.layersWithOutsidePointerEventsDisabled.delete(e),Tr(t,e)})}},{immediate:!0}),x([a,()=>n.present],([e,t],n,r)=>{e&&t&&(s.value.add(e),r(()=>{s.value.delete(e)}))},{immediate:!0}),D(e=>{e(()=>{a.value&&(s.value.delete(a.value),H.layersWithOutsidePointerEventsDisabled.delete(a.value))})}),(t,n)=>(k(),P(j(fn),{ref:j(i),"as-child":e.asChild,as:e.as,"data-dismissable-layer":``,style:Ft({pointerEvents:l.value?u.value?`auto`:`none`:void 0}),onFocusCapture:j(f).onFocusCapture,onBlurCapture:j(f).onBlurCapture,onPointerdownCapture:j(d).onPointerDownCapture},{default:Ae(()=>[N(t.$slots,`default`)]),_:3},8,[`as-child`,`as`,`style`,`onFocusCapture`,`onBlurCapture`,`onPointerdownCapture`]))}}),pi=Hn(()=>F([]));function mi(){let e=pi();return{add(t){let n=e.value[0];t!==n&&n?.pause(),e.value=hi(e.value,t),e.value.unshift(t)},remove(t){e.value=hi(e.value,t),e.value[0]?.resume()}}}function hi(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}var gi=`focusScope.autoFocusOnMount`,_i=`focusScope.autoFocusOnUnmount`,vi={bubbles:!1,cancelable:!0};function yi(e,t){let n=t;for(;n;){if(e.contains(n))return!0;n=n.getRootNode().host??null}return!1}function bi(e,{select:t=!1}={}){let n=L();for(let r of e)if(U(r,{select:t}),L()!==n)return!0}function xi(e){let t=Si(e);return[Ci(t,e),Ci(t.reverse(),e)]}function Si(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n Line truncated
+1
View File
@@ -0,0 +1 @@
import{i as e,n as t,r as n,t as r}from"./rolldown-runtime.js";var i=n({default:()=>a}),a,o=t((()=>{a=[{name:`Agola CI`,constant:`AGOLA`,env:`AGOLA_GIT_REF`,pr:`AGOLA_PULL_REQUEST_ID`},{name:`Alpic`,constant:`ALPIC`,env:`ALPIC_HOST`},{name:`Appcircle`,constant:`APPCIRCLE`,env:`AC_APPCIRCLE`,pr:{env:`AC_GIT_PR`,ne:`false`}},{name:`AppVeyor`,constant:`APPVEYOR`,env:`APPVEYOR`,pr:`APPVEYOR_PULL_REQUEST_NUMBER`},{name:`AWS CodeBuild`,constant:`CODEBUILD`,env:`CODEBUILD_BUILD_ARN`,pr:{env:`CODEBUILD_WEBHOOK_EVENT`,any:[`PULL_REQUEST_CREATED`,`PULL_REQUEST_UPDATED`,`PULL_REQUEST_REOPENED`]}},{name:`Azure Pipelines`,constant:`AZURE_PIPELINES`,env:`TF_BUILD`,pr:{BUILD_REASON:`PullRequest`}},{name:`Bamboo`,constant:`BAMBOO`,env:`bamboo_planKey`},{name:`Bitbucket Pipelines`,constant:`BITBUCKET`,env:`BITBUCKET_COMMIT`,pr:`BITBUCKET_PR_ID`},{name:`Bitrise`,constant:`BITRISE`,env:`BITRISE_IO`,pr:`BITRISE_PULL_REQUEST`},{name:`Buddy`,constant:`BUDDY`,env:`BUDDY_WORKSPACE_ID`,pr:`BUDDY_EXECUTION_PULL_REQUEST_ID`},{name:`Buildkite`,constant:`BUILDKITE`,env:`BUILDKITE`,pr:{env:`BUILDKITE_PULL_REQUEST`,ne:`false`}},{name:`CircleCI`,constant:`CIRCLE`,env:`CIRCLECI`,pr:`CIRCLE_PULL_REQUEST`},{name:`Cirrus CI`,constant:`CIRRUS`,env:`CIRRUS_CI`,pr:`CIRRUS_PR`},{name:`Cloudflare Pages`,constant:`CLOUDFLARE_PAGES`,env:`CF_PAGES`},{name:`Cloudflare Workers`,constant:`CLOUDFLARE_WORKERS`,env:`WORKERS_CI`},{name:`Codefresh`,constant:`CODEFRESH`,env:`CF_BUILD_ID`,pr:{any:[`CF_PULL_REQUEST_NUMBER`,`CF_PULL_REQUEST_ID`]}},{name:`Codemagic`,constant:`CODEMAGIC`,env:`CM_BUILD_ID`,pr:`CM_PULL_REQUEST`},{name:`Codeship`,constant:`CODESHIP`,env:{CI_NAME:`codeship`}},{name:`Drone`,constant:`DRONE`,env:`DRONE`,pr:{DRONE_BUILD_EVENT:`pull_request`}},{name:`dsari`,constant:`DSARI`,env:`DSARI`},{name:`Earthly`,constant:`EARTHLY`,env:`EARTHLY_CI`},{name:`Expo Application Services`,constant:`EAS`,env:`EAS_BUILD`},{name:`Gerrit`,constant:`GERRIT`,env:`GERRIT_PROJECT`},{name:`Gitea Actions`,constant:`GITEA_ACTIONS`,env:`GITEA_ACTIONS`},{name:`GitHub Actions`,constant:`GITHUB_ACTIONS`,env:`GITHUB_ACTIONS`,pr:{GITHUB_EVENT_NAME:`pull_request`}},{name:`GitLab CI`,constant:`GITLAB`,env:`GITLAB_CI`,pr:`CI_MERGE_REQUEST_ID`},{name:`GoCD`,constant:`GOCD`,env:`GO_PIPELINE_LABEL`},{name:`Google Cloud Build`,constant:`GOOGLE_CLOUD_BUILD`,env:`BUILDER_OUTPUT`},{name:`Harness CI`,constant:`HARNESS`,env:`HARNESS_BUILD_ID`},{name:`Heroku`,constant:`HEROKU`,env:{env:`NODE`,includes:`/app/.heroku/node/bin/node`}},{name:`Hudson`,constant:`HUDSON`,env:`HUDSON_URL`},{name:`Jenkins`,constant:`JENKINS`,env:[`JENKINS_URL`,`BUILD_ID`],pr:{any:[`ghprbPullId`,`CHANGE_ID`]}},{name:`LayerCI`,constant:`LAYERCI`,env:`LAYERCI`,pr:`LAYERCI_PULL_REQUEST`},{name:`Magnum CI`,constant:`MAGNUM`,env:`MAGNUM`},{name:`Netlify CI`,constant:`NETLIFY`,env:`NETLIFY`,pr:{env:`PULL_REQUEST`,ne:`false`}},{name:`Nevercode`,constant:`NEVERCODE`,env:`NEVERCODE`,pr:{env:`NEVERCODE_PULL_REQUEST`,ne:`false`}},{name:`Prow`,constant:`PROW`,env:`PROW_JOB_ID`},{name:`ReleaseHub`,constant:`RELEASEHUB`,env:`RELEASE_BUILD_ID`},{name:`Render`,constant:`RENDER`,env:`RENDER`,pr:{IS_PULL_REQUEST:`true`}},{name:`Sail CI`,constant:`SAIL`,env:`SAILCI`,pr:`SAIL_PULL_REQUEST_NUMBER`},{name:`Screwdriver`,constant:`SCREWDRIVER`,env:`SCREWDRIVER`,pr:{env:`SD_PULL_REQUEST`,ne:`false`}},{name:`Semaphore`,constant:`SEMAPHORE`,env:`SEMAPHORE`,pr:`PULL_REQUEST_NUMBER`},{name:`Sourcehut`,constant:`SOURCEHUT`,env:{CI_NAME:`sourcehut`}},{name:`Strider CD`,constant:`STRIDER`,env:`STRIDER`},{name:`TaskCluster`,constant:`TASKCLUSTER`,env:[`TASK_ID`,`RUN_ID`]},{name:`TeamCity`,constant:`TEAMCITY`,env:`TEAMCITY_VERSION`},{name:`Travis CI`,constant:`TRAVIS`,env:`TRAVIS`,pr:{env:`TRAVIS_PULL_REQUEST`,ne:`false`}},{name:`Vela`,constant:`VELA`,env:`VELA`,pr:{VELA_PULL_REQUEST:`1`}},{name:`Vercel`,constant:`VERCEL`,env:{any:[`NOW_BUILDER`,`VERCEL`]},pr:`VERCEL_GIT_PULL_REQUEST_ID`},{name:`Visual Studio App Center`,constant:`APPCENTER`,env:`APPCENTER_BUILD_ID`},{name:`Woodpecker`,constant:`WOODPECKER`,env:{CI:`woodpecker`},pr:{CI_BUILD_EVENT:`pull_request`}},{name:`Xcode Cloud`,constant:`XCODE_CLOUD`,env:`CI_XCODE_PROJECT`,pr:`CI_PULL_REQUEST_NUMBER`},{name:`Xcode Server`,constant:`XCODE_SERVER`,env:`XCS`}]})),s=r((t=>{var n=(o(),e(i).default),r={};Object.defineProperty(t,"_vendors",{value:n.map(function(e){return e.constant})}),t.name=null,t.isPR=null,t.id=null,r.CI!==`false`&&n.forEach(function(e){let n=(Array.isArray(e.env)?e.env:[e.env]).every(function(e){return a(e)});t[e.constant]=n,n&&(t.name=e.name,t.isPR=s(e),t.id=e.constant)}),t.isCI=!!(r.CI!==`false`&&(r.BUILD_ID||r.BUILD_NUMBER||r.CI||r.CI_APP_ID||r.CI_BUILD_ID||r.CI_BUILD_NUMBER||r.CI_NAME||r.CONTINUOUS_INTEGRATION||r.RUN_ID||t.name));function a(e){return typeof e==`string`?!!r[e]:`env`in e?r[e.env]&&r[e.env].includes(e.includes):`any`in e?e.any.some(function(e){return!!r[e]}):Object.keys(e).every(function(t){return r[t]===e[t]})}function s(e){switch(typeof e.pr){case`string 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
+362 -104
View File
@@ -1,12 +1,12 @@
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/css2.js","assets/css.js","assets/html.js","assets/javascript.js","assets/javascript2.js","assets/AccountPage.js","assets/PageHeader.js","assets/createLucideIcon.js","assets/input.js","assets/AuthenticationPage.js","assets/CredentialBindingsPage.js","assets/PlaybooksPage.js","assets/AgentProfilesPage.js","assets/HarnessPage.js","assets/badge.js","assets/NotFoundPage.js"])))=>i.map(i=>d[i]);
import{A as e,B as t,C as n,D as r,E as i,F as a,H as o,I as s,L as c,M as l,N as u,O as d,P as f,R as p,S as m,T as h,V as g,_,a as v,b as y,c as b,d as x,f as S,g as C,h as w,i as T,j as ee,k as E,l as D,m as te,n as O,o as ne,p as re,r as ie,s as ae,t as k,u as oe,v as se,w as ce,x as le,y as ue,z as de}from"./badge.js";import{$t as fe,A,B as pe,Bt as me,C as j,Ct as M,D as he,Dn as ge,Dt as _e,En as ve,G as ye,Gt as N,H as be,It as xe,Jt as Se,Kt as Ce,Lt as we,M as P,On as Te,Pt as Ee,Q as De,Qt as Oe,Rt as ke,S as F,Sn as Ae,T as je,Tt as Me,U as Ne,Vt as Pe,Xt as I,Z as Fe,_t as L,an as Ie,b as R,bn as Le,cn as Re,dn as ze,dt as Be,er as z,gn as Ve,hn as He,ht as Ue,ir as B,it as We,jn as V,k as H,kn as Ge,l as U,m as Ke,n as qe,nr as Je,nt as Ye,o as Xe,ot as Ze,p as Qe,pn as $e,r as W,rr as et,rt as G,sn as tt,st as nt,t as rt,tt as it,wn as at,wt as K,x as q,xn as J,y as Y,yn as ot,yt as st}from"./PageHeader.js";import{C as ct,D as lt,I as ut,M as X,N as dt,P as ft,a as eee,at as pt,c as mt,i as ht,it as gt,j as _t,n as vt,nt as tee,o as nee,r as Z,rt as yt,s as bt,t as xt,tt as ree,z as iee}from"./createLucideIcon.js";import{a as St,c as aee,d as Ct,f as wt,i as Tt,l as Et,n as Dt,o as Ot,p as kt,r as At,s as jt,t as Q,u as Mt}from"./input.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var oee=typeof window<`u`,Nt,Pt=e=>Nt=e,Ft=Symbol();function It(e){return e&&typeof e==`object`&&Object.prototype.toString.call(e)===`[object Object]`&&typeof e.toJSON!=`function`}var Lt=typeof window==`object`&&window.window===window?window:typeof self==`object`&&self.self===self?self:typeof global==`object`&&global.global===global?global:typeof globalThis==`object`?globalThis:{HTMLElement:null};function see(e,{autoBom:t=!1}={}){return t&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([``,e],{type:e.type}):e}function Rt(e,t,n){let r=new XMLHttpRequest;r.open(`GET`,e),r.responseType=`blob`,r.onload=function(){Ut(r.response,t,n)},r.onerror=function(){console.error(`could not download file`)},r.send()}function zt(e){let t=new XMLHttpRequest;t.open(`HEAD`,e,!1);try{t.send()}catch{}return t.status>=200&&t.status<=299}function Bt(e){try{e.dispatchEvent(new MouseEvent(`click`))}catch{let t=new MouseEvent(`click`,{bubbles:!0,cancelable:!0,view:window,detail:0,screenX:80,screenY:20,clientX:80,clientY:20,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,button:0,relatedTarget:null});e.dispatchEvent(t)}}var Vt=typeof navigator==`object`?navigator:{userAgent:``},Ht=/Macintosh/.test(Vt.userAgent)&&/AppleWebKit/.test(Vt.userAgent)&&!/Safari/.test(Vt.userAgent),Ut=oee?typeof HTMLAnchorElement<`u`&&`download`in HTMLAnchorElement.prototype&&!Ht?Wt:`msSaveOrOpenBlob`in Vt?Gt:Kt:()=>{};function Wt(e,t=`download`,n){let r=document.createElement(`a`);r.download=t,r.rel=`noopener`,typeof e==`string`?(r.href=e,r.origin===location.origin?Bt(r):zt(r.href)?Rt(e,t,n):(r.target=`_blank`,Bt(r))):(r.href=URL.createObjectURL(e),setTimeout(function(){URL.revokeObjectURL(r.href)},4e4),setTimeout(function(){Bt(r)},0))}function Gt(e,t=`download`,n){if(typeof e==`string`){if(zt(e))Rt(e,t,n);else{let t=document.createElement(`a`);t.href=e,t.target=`_blank`,setTimeout(function(){Bt(t)})}}else navigator.msSaveOrOpenBlob(see(e,n),t)}function Kt(e,t,n,r){if(r||=open(``,`_blank`),r&&(r.document.title=r.document.body.innerText=`downloading...`),typeof e==`string`)return Rt(e,t,n);let i=e.type===`application/octet-stream`,a=/constructor/i.test(String(Lt.HTMLElement))||`safari`in Lt,o=/CriOS\/[\d]+/.test(navigator.userAgent);if((o||i&&a||Ht)&&typeof FileReader<`u`){let t=new FileReader;t.onloadend=function(){let e=t.result;if(typeof e!=`string`)throw r=null,Error(`Wrong reader.result type`);e=o?e:e.replace(/^data:[^;]*;/,`data:attachment/file;`),r?r.location.href=e:location.assign(e),r=null},t.readAsDataURL(e)}else{let t=URL.createObjectURL(e);r?r.location.assign(t):location.href=t,r=null,setTimeout(function(){URL.revokeObjectURL(t)},4e4)}}var{assign:cee}=Object;function qt(){let e=tt(!0),t=e.run(()=>J({})),n=[],r=[],i=He({install(e){Pt(i),i._a=e,e.provide(Ft,i),e.config.globalProperties.$pinia=i,r.forEach(e=>n.push(e)),r=[]},use(e){return this._a?n.push(e):r.push(e),this},_p:n,_a:null,_e:e,_s:new Map,state:t});return i}var Jt=()=>{};function Yt(e,t,n,r=Jt){e.add(t);let i=()=>{e.delete(t)&&r()}Line truncated
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/css2.js","assets/css.js","assets/html.js","assets/javascript.js","assets/javascript2.js","assets/ci-info.js","assets/rolldown-runtime.js","assets/AccountPage.js","assets/PageHeader.js","assets/createLucideIcon.js","assets/input.js","assets/AuthenticationPage.js","assets/CredentialBindingsPage.js","assets/PlaybooksPage.js","assets/AgentProfilesPage.js","assets/HarnessPage.js","assets/badge.js","assets/NotFoundPage.js"])))=>i.map(i=>d[i]);
import{a as e,r as t}from"./rolldown-runtime.js";import{$t as n,A as r,B as i,Bt as a,C as o,Ct as s,D as c,Dn as l,Dt as u,En as d,G as f,Gt as p,H as m,It as h,Jt as g,Kt as _,Lt as v,M as y,On as b,Pt as x,Q as S,Qt as C,Rt as w,S as T,Sn as E,T as D,Tt as O,U as k,Vt as ee,Xt as A,Z as te,_t as j,an as M,b as N,bn as ne,cn as re,dn as ie,dt as P,er as F,gn as ae,hn as oe,ht as se,ir as I,it as ce,jn as L,k as R,kn as le,l as z,m as ue,n as de,nr as fe,nt as pe,o as me,ot as he,p as ge,pn as _e,r as B,rr as ve,rt as V,sn as ye,st as be,t as xe,tt as Se,ut as Ce,wn as we,wt as H,x as U,xn as W,y as G,yn as Te,yt as Ee}from"./PageHeader.js";import{C as De,D as Oe,I as ke,M as K,N as q,P as Ae,a as je,at as Me,c as Ne,i as Pe,it as Fe,j as Ie,n as Le,nt as Re,o as ze,r as J,rt as Be,s as Ve,t as He,tt as Ue,z as We}from"./createLucideIcon.js";import{A as Ge,B as Ke,C as qe,D as Je,E as Ye,F as Xe,I as Ze,L as Qe,M as $e,N as et,O as tt,P as nt,R as rt,S as it,T as at,V as ot,_ as st,a as ct,b as lt,c as ut,d as dt,f as ft,g as pt,h as mt,i as eee,j as ht,k as gt,l as _t,m as vt,n as yt,o as tee,p as bt,r as xt,s as St,t as Ct,u as wt,v as Tt,w as Et,x as Dt,y as Ot,z as kt}from"./badge.js";import{a as At,c as jt,d as Mt,f as Nt,i as Pt,l as Ft,n as It,o as nee,p as ree,r as iee,s as aee,t as Y,u as oee}from"./input.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var see=typeof window<`u`,Lt,Rt=e=>Lt=e,zt=Symbol();function Bt(e){return e&&typeof e==`object`&&Object.prototype.toString.call(e)===`[object Object]`&&typeof e.toJSON!=`function`}var Vt=typeof window==`object`&&window.window===window?window:typeof self==`object`&&self.self===self?self:typeof global==`object`&&global.global===global?global:typeof globalThis==`object`?globalThis:{HTMLElement:null};function cee(e,{autoBom:t=!1}={}){return t&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([``,e],{type:e.type}):e}function Ht(e,t,n){let r=new XMLHttpRequest;r.open(`GET`,e),r.responseType=`blob`,r.onload=function(){qt(r.response,t,n)},r.onerror=function(){console.error(`could not download file`)},r.send()}function Ut(e){let t=new XMLHttpRequest;t.open(`HEAD`,e,!1);try{t.send()}catch{}return t.status>=200&&t.status<=299}function Wt(e){try{e.dispatchEvent(new MouseEvent(`click`))}catch{let t=new MouseEvent(`click`,{bubbles:!0,cancelable:!0,view:window,detail:0,screenX:80,screenY:20,clientX:80,clientY:20,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,button:0,relatedTarget:null});e.dispatchEvent(t)}}var Gt=typeof navigator==`object`?navigator:{userAgent:``},Kt=/Macintosh/.test(Gt.userAgent)&&/AppleWebKit/.test(Gt.userAgent)&&!/Safari/.test(Gt.userAgent),qt=see?typeof HTMLAnchorElement<`u`&&`download`in HTMLAnchorElement.prototype&&!Kt?Jt:`msSaveOrOpenBlob`in Gt?Yt:Xt:()=>{};function Jt(e,t=`download`,n){let r=document.createElement(`a`);r.download=t,r.rel=`noopener`,typeof e==`string`?(r.href=e,r.origin===location.origin?Wt(r):Ut(r.href)?Ht(e,t,n):(r.target=`_blank`,Wt(r))):(r.href=URL.createObjectURL(e),setTimeout(function(){URL.revokeObjectURL(r.href)},4e4),setTimeout(function(){Wt(r)},0))}function Yt(e,t=`download`,n){if(typeof e==`string`){if(Ut(e))Ht(e,t,n);else{let t=document.createElement(`a`);t.href=e,t.target=`_blank`,setTimeout(function(){Wt(t)})}}else navigator.msSaveOrOpenBlob(cee(e,n),t)}function Xt(e,t,n,r){if(r||=open(``,`_blank`),r&&(r.document.title=r.document.body.innerText=`downloading...`),typeof e==`string`)return Ht(e,t,n);let i=e.type===`application/octet-stream`,a=/constructor/i.test(String(Vt.HTMLElement))||`safari`in Vt,o=/CriOS\/[\d]+/.test(navigator.userAgent);if((o||i&&a||Kt)&&typeof FileReader<`u`){let t=new FileReader;t.onloadend=function(){let e=t.result;if(typeof e!=`string`)throw r=null,Error(`Wrong reader.result type`);e=o?e:e.replace(/^data:[^;]*;/,`data:attachment/file;`),r?r.location.href=e:location.assign(e),r=null},t.readAsDataURL(e)}else{let t=URL.createObjectURL(e);r?r.location.assign(t):location.href=t,r=null,setTimeout(function(){URL.revokeObjectURL(t)},4e4)}}var{assign:lee}=Object;function Zt(){let e=ye(!0),t=e.run(()=>W({})),n=[],r=[],i=oe({install(e){Rt(i),i._a=e,e.provide(zt,i),e.config.globalProperties.$pinia=i,r.forEach(e=>n.push(e)),r=[]},use(e){return this._a?n.push(e):r.push(e),this},_p:n,_a:null,_e:e,_s:new Map,state:t});return i}var Qt=()Line truncated
`);p=n.pop()||``;for(let e of n){let t=e.split(`
`).find(e=>e.startsWith(`data: `));if(!t)continue;let n=JSON.parse(t.slice(6));if(n.session_id&&($u.value=n.session_id),n.type===`delta`&&(o+=n.text,ad.value=ad.value?{...ad.value,text:o}:null),(n.type===`tool`||n.type===`navigate`)&&(a=[...a,n],ad.value=ad.value?{...ad.value,tools:a}:null),n.type===`ask`&&n.ask&&(clearTimeout(l),ad.value=ad.value?{...ad.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`);ed.value=!i&&n.trim()===`/new`?[]:[...ed.value,{from:`assistant`,text:o,tool_calls:a}],ad.value=null,nd.value=`Ready`,await hd()}catch(e){let t=e;o&&(ed.value=[...ed.value,{from:`assistant`,text:o,tool_calls:a}],a=[]),t.name===`AbortError`&&!c?(ad.value={text:`Turn stopped.`,tools:a,isError:!1,turn:r,isRetry:i},nd.value=`Stopped`):(ad.value={text:`Unable to complete that turn: ${t.message||t}`,tools:a,isError:!0,turn:r?Yu(r):void 0,isRetry:i},nd.value=`Error. Retry available.`)}finally{clearTimeout(l),Xu=null,pd=null,rd.value=!1,Cd.after?.()}}function Pd(){nd.value=`Stopping…`,$u.value&&Z.chatCancel($u.value).catch(()=>{}),md()}function Fd(){Be(()=>{hd().catch(e=>{nd.value=e.message||`Chat unavailable`})}),Ue(()=>{md()})}async function Id(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 Nd({textOverride:`🎤 Voice message`,voice:{data:btoa(n),mime_type:e.type||`audio/webm`}})}var Ld={class:`grid gap-1 p-1`},Rd={key:0,class:`text-xs text-fg-subtle`},zd=`__default__`,Bd=P({__name:`ChatSettings`,setup(e){let t=Y(()=>sd.value||zd),n=Y(()=>{let e=od.value.models_by_provider||{},t=Object.entries(e).filter(([,e])=>e.length);return t.length?t:[[``,od.value.models||[]]]});return(e,r)=>(L(),j(`div`,Ld,[V(nd)===`Ready`?F(``,!0):(L(),j(`span`,Rd,B(V(nd)),1)),A(V(Vu),{"model-value":t.value,"onUpdate:modelValue":r[0]||=e=>V(Sd)(e===zd?``:String(e??``))},{default:I(()=>[A(V(Gu),{size:`sm`,class:`w-full`,"aria-label":`Model`},{default:I(()=>[A(V(Ku))]),_:1}),A(V(Hu),null,{default:I(()=>[A(V(Wu),{value:zd},{default:I(()=>[...r[1]||=[H(`Default`,-1)]]),_:1}),(L(!0),j(U,null,M(n.value,([e,t])=>(L(),q(V(Uu),{key:e},{default:I(()=>[e?(L(),q(V(Tte),{key:0},{default:I(()=>[H(B(e),1)]),_:2},1024)):F(``,!0),(L(!0),j(U,null,M(t,e=>(L(),q(V(Wu),{key:e,value:e},{default:I(()=>[H(B(e),1)]),_:2},1032,[`value`]))),128))]),_:2},1024))),128))]),_:1})]),_:1},8,[`model-value`])]))}}),Vd=P({__name:`ChatSessionActions`,setup(e){let t=J(!1);Lte(t);function n(e){t.value=!1,bd(e)}function r(e,n){t.value=!1,xd(e,n)}return(e,i)=>(L(),q(V(Ru),{open:t.value,"onUpdate:open":i[5]||=e=>t.value=e},{default:I(()=>[A(V(Bu),{"as-child":``},{default:I(()=>[A(V(X),{variant:`ghost`,size:`icon-sm`,class:`flex-none`,"aria-label":`More`,title:`More`},{default:I(()=>[A(V(lu))]),_:1})]),_:1}),A(V(zu),{align:`end`,class:`grid w-64 gap-0.5 p-1`},{default:I(()=>[V($u)?(L(),j(U,{key:0},[A(V(X),{variant:`ghost`,size:`sm`,class:`justify-start`,onClick:i[0]||=e=>n(`/retry`)},{default:I(()=>[A(V(fte),{"data-icon":`inline-start`}),i[6]||=H(`Retry`,-1)]),_:1}),A(V(X),{variant:`ghost`,size:`sm`,class:`justify-start`,onClick:i[1]||=e=>n(`/undo`)},{default:I(()=>[A(V(Pu),{"data-icon":`inline-start`}),i[7]||=H(`Undo`,-1)]),_:1}),A(V(X),{variant:`ghost`,size:`sm`,class:`justify-start`,onClick:i[2]||=e=>r(`/title`,`Session title`)},{default:I(()=>[A(V(wu),{"data-icon":`inline-start`}),i[8]||=H(`Rename`,-1)]),_:1}),A(V(X),{variant:`ghost`,size:`sm`,class:`justify-start`,onClick:i[3]||=e=>r(`/branch`,`Branch name (optional)`)},{default:I(()=>[A(V(_u),{"data-icon":`inline-start`}),i[9]||=H(`Branch`,-1)]),_:1}),A(V(X),{variant:`ghost`,size:`sm`,class:`justify-start`,onClick:i[4]||=e=>n(`/compress --preview`)},{default:I(()=>[A(V(gte),{"data-icon":`inline-start`}),i[10]||=H(`Preview compression`,-1)]),_:1}),A(V(Cte),{class:`my-1`})],64)):F(``,!0),A(Bd)]),_:1})]),_:1},8,[`open`]))}}),Hd=new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`});function Ud(e){return e.title||e.branch_name||(e.created_at?Hd.format(new Date(e.created_at)):`New chat`)}var Wd={class:`min-w-0 flex-1`},Gd=P({__name:`ChatSessionList`,setup(e){return(e,t)=>(L(),j(`div`,Wd,[A(V(Vu),{"model-value":V($u),disabled:!V(Qu).length,"onUpdate:modelValue":t[0]||=e=>V(gd)(String(e))},{default:I(()=>[A(V(Gu),{size:`sm`,class:`w-full`,"aria-label":`Conversation`},{default:I(()=>[A(V(Ku),{placeholder:`No conversations yet`})]),_:1}),A(V(Hu),null,{default:I(()=>[A(V(Uu),null,{default:I(()=>[(L(!0),j(U,null,M(V(Qu),e=>(L(),q(V(Wu),{key:e.session_id,value:e.session_id},{default:I(()=>[H(B(V(Ud)(e)),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`model-value`,`disabled`])]))}}),Kd={class:`flex items-center gap-1 border-b px-3 py-2`},qd=P({__name:`ChatBar`,setup(e){return(e,t)=>(L(),j(`div`,Kd,[A(Gd),A(V(X),{variant:`ghost`,size:`icon-sm`,class:`flex-none`,title:`New chat`,"ar Line truncated
`))],64)):K(n.$slots,`default`,{},void 0,void 0,1)])],10,Sm))}}),Tm=P({__name:`CodeBlockContent`,props:{wrap:{type:Boolean,default:!1},lineNumbers:{type:Boolean,default:!1},startLine:{default:1},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e,n=me();function r(e){let t=``;for(let n of e)if(n.type!==Xe){if(n.type===Ke)t+=n.children;else if(n.type===U&&Array.isArray(n.children)){let e=r(n.children);if(e===null)return null;t+=e}else return null}return t}function i(){if(!t.lineNumbers)return null;let e=r(n.default?.()??[]);return e===null?null:e.replace(/\n$/,``).split(`
`)}return(n,r)=>(L(),q(V(dt),{as:`pre`,"data-slot":`code-block-content`,"data-wrap":e.wrap||void 0,"data-numbered":e.lineNumbers||void 0,dir:`ltr`,tabindex:`0`,style:et({counterReset:`line ${e.startLine-1}`}),class:z(V(W)(`px-3 py-3 leading-relaxed group-has-data-[slot=code-block-header]/code-block:pt-2 group-has-data-[slot=code-block-footer]/code-block:pb-2 group-data-[size=sm]/code-block:px-2.5 group-data-[size=sm]/code-block:py-2.5 group-data-[size=sm]/code-block:group-has-data-[slot=code-block-header]/code-block:pt-1.5 min-h-0 min-w-0 scroll-fade-x scrollbar-thin overflow-auto text-start font-mono outline-none data-wrap:scroll-fade-y data-wrap:wrap-break-word data-wrap:whitespace-pre-wrap`,t.class))},{default:I(()=>[A(V(dt),{as:`code`,"data-slot":`code-block-code`,class:`grid min-h-lh min-w-max content-start in-data-numbered:grid-cols-[auto_1fr] in-data-wrap:min-w-0`},{default:I(()=>[(L(!0),j(U,null,M([i()],(e,t)=>(L(),j(U,{key:t},[e?(L(!0),j(U,{key:0},M(e,(e,t)=>(L(),q(wm,{key:t},{default:I(()=>[H(B(e),1)]),_:2},1024))),128)):K(n.$slots,`default`,{},void 0,void 0,1)],64))),128))]),_:3})]),_:3},8,[`data-wrap`,`data-numbered`,`style`,`class`]))}}),Em={"aria-live":`polite`,class:`sr-only`},Dm=P({inheritAttrs:!1,__name:`CodeBlockCopyButton`,props:{asChild:{type:Boolean},as:{default:`button`},value:{},variant:{default:`ghost`},size:{default:`icon-xs`},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e,{copy:n,copied:r}=Ot({copiedDuring:2e3,legacy:!0});return(i,a)=>(L(),j(U,null,[A(V(X),G(i.$attrs,{"data-slot":`code-block-copy-button`,"data-copied":V(r)||void 0,as:e.as,"as-child":e.asChild,variant:e.variant,size:e.size,"aria-label":V(r)?`Copied`:`Copy`,class:V(W)(``,t.class),onClick:a[0]||=e=>V(n)(t.value)}),{default:I(()=>[V(r)?(L(),q(V(Xl),{key:0})):(L(),q(V(su),{key:1}))]),_:1},16,[`data-copied`,`as`,`as-child`,`variant`,`size`,`aria-label`,`class`]),R(`span`,Em,B(V(r)?`Copied`:``),1)],64))}}),Om=P({__name:`CodeBlockToken`,props:{token:{}},setup(e){return(t,n)=>(L(),j(`span`,{style:et(e.token.htmlStyle),class:`text-(--shiki-light) dark:text-(--shiki-dark)`},B(e.token.content),5))}}),km=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function Am(e){return jm(e)}function jm(e){return Array.isArray(e)?Mm(e):e instanceof RegExp?e:typeof e==`object`?Nm(e):e}function Mm(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=jm(e[n]);return t}function Nm(e){let t={};for(let n in e)t[n]=jm(e[n]);return t}function Pm(e,...t){return t.forEach(t=>{for(let n in t)e[n]=t[n]}),e}function Fm(e){let t=~e.lastIndexOf(`/`)||~e.lastIndexOf(`\\`);return t===0?e:~t===e.length-1?Fm(e.substring(0,e.length-1)):e.substr(~t+1)}var Im=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,Lm=class{static hasCaptures(e){return e!==null&&(Im.lastIndex=0,Im.test(e))}static replaceCaptures(e,t,n){return e.replace(Im,(e,r,i,a)=>{let o=n[parseInt(r||i,10)];if(o){let e=t.substring(o.start,o.end);for(;e[0]===`.`;)e=e.substring(1);switch(a){case`downcase`:return e.toLowerCase();case`upcase`:return e.toUpperCase();default:return e}}else return e})}};function Rm(e,t){return e<t?-1:+(e>t)}function zm(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let r=0;r<n;r++){let n=Rm(e[r],t[r]);if(n!==0)return n}return 0}return n-r}function Bm(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function Vm(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,`\\$&`)}var Hm=class{constructor(e){this.fn=e}cache=new Map;get(e){if(this.cache.has(e))return this.cache.get(e);let t=this.fn(e);return this.cache.set(e,t),t}},Um=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(Jm(e),t)}static createFromParsedTheme(e,t){return Zm(e,t)}_cachedMatchRoot=new Hm(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;let t=e.scopeName,n=this._cachedMatchRoot.get(t).find(t=>Gm(e.parent,t.parentScopes));return n?new qm(n.fontStyle,n.foreground,n.background):null}},Wm=class e{constructor(e,t){this.parent=e,this.scopeName=t}static push(t,n){for(let r of n)t=new e(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new e(n,t[r]);return n}push(t){return new e(this,t)}getSegments(){let e=this,t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(` `)}extends(e){return this===e||this.parent!==null&&this.parent.extends(e)}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push(n.scopeName),n=n.parent;return n===e?t.reverse():void 0}};function Gm(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let r=t[n],i=!1;if(r===`>`){if(n===t.length-1)return!1;r=t[++n],i=!0}for(;e&&!Km(e.scopeName,r);){if(i)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function Km( Line truncated
`)}findNextMatchSync(e,t,n){let r=this.scanner.findNextMatchSync(e,t,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},zh=class{constructor(e,t){this.languageId=e,this.tokenType=t}},Bh=class e{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,t){this._defaultAttributes=new zh(e,8),this._embeddedLanguagesMatcher=new Vh(Object.entries(t||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?e._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}static _NULL_SCOPE_METADATA=new zh(0,0);_getBasicScopeAttributes=new Hm(e=>new zh(this._scopeToLanguage(e),this._toStandardTokenType(e)));_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(t){let n=t.match(e.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case`comment`:return 1;case`string`:return 2;case`regex`:return 3;case`meta.embedded`:return 0}throw Error(`Unexpected match for standard token type!`)}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},Vh=class{values;scopesRegExp;constructor(e){if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);let t=e.map(([e,t])=>Vm(e));t.sort(),t.reverse(),this.scopesRegExp=RegExp(`^((${t.join(`)|(`)}))($|\\.)`,``)}}match(e){if(!this.scopesRegExp)return;let t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}};typeof process<`u`&&{}.VSCODE_TEXTMATE_DEBUG;var Hh=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function Uh(e,t,n,r,i,a,o,s){let c=t.content.length,l=!1,u=-1;if(o){let o=Wh(e,t,n,r,i,a);i=o.stack,r=o.linePos,n=o.isFirstLine,u=o.anchorPosition}let d=Date.now();for(;!l;){if(s!==0&&Date.now()-d>s)return new Hh(i,!0);f()}return new Hh(i,!1);function f(){let o=Gh(e,t,n,r,i,u);if(!o){a.produce(i,c),l=!0;return}let s=o.captureIndices,d=o.matchedRuleId,f=s&&s.length>0?s[0].end>r:!1;if(d===Th){let o=i.getRule(e);a.produce(i,s[0].start),i=i.withContentNameScopesList(i.nameScopesList),Xh(e,t,n,i,a,o.endCaptures,s),a.produce(i,s[0].end);let d=i;if(i=i.parent,u=d.getAnchorPos(),!f&&d.getEnterPos()===r){i=d,a.produce(i,c),l=!0;return}}else{let o=e.getRule(d);a.produce(i,s[0].start);let p=i,m=o.getName(t.content,s),h=i.contentNameScopesList.pushAttributed(m,e);if(i=i.push(d,r,u,s[0].end===c,null,h,h),o instanceof Nh){let r=o;Xh(e,t,n,i,a,r.beginCaptures,s),a.produce(i,s[0].end),u=s[0].end;let d=r.getContentName(t.content,s),m=h.pushAttributed(d,e);if(i=i.withContentNameScopesList(m),r.endHasBackReferences&&(i=i.withEndRule(r.getEndWithResolvedBackReferences(t.content,s))),!f&&p.hasSameRuleAs(i)){i=i.pop(),a.produce(i,c),l=!0;return}}else if(o instanceof Ph){let r=o;Xh(e,t,n,i,a,r.beginCaptures,s),a.produce(i,s[0].end),u=s[0].end;let d=r.getContentName(t.content,s),m=h.pushAttributed(d,e);if(i=i.withContentNameScopesList(m),r.whileHasBackReferences&&(i=i.withEndRule(r.getWhileWithResolvedBackReferences(t.content,s))),!f&&p.hasSameRuleAs(i)){i=i.pop(),a.produce(i,c),l=!0;return}}else if(Xh(e,t,n,i,a,o.captures,s),a.produce(i,s[0].end),i=i.pop(),!f){i=i.safePop(),a.produce(i,c),l=!0;return}}s[0].end>r&&(r=s[0].end,n=!1)}}function Wh(e,t,n,r,i,a){let o=i.beginRuleCapturedEOL?0:-1,s=[];for(let t=i;t;t=t.pop()){let n=t.getRule(e);n instanceof Ph&&s.push({rule:n,stack:t})}for(let c=s.pop();c;c=s.pop()){let{ruleScanner:s,findOptions:l}=Yh(c.rule,e,c.stack.endRule,n,r===o),u=s.findNextMatchSync(t,r,l);if(u){if(u.ruleId!==Eh){i=c.stack.pop();break}u.captureIndices&&u.captureIndices.length&&(a.produce(c.stack,u.captureIndices[0].start),Xh(e,t,n,c.stack,a,c.rule.whileCaptures,u.captureIndices),a.produce(c.stack,u.captureIndices[0].end),o=u.captureIndices[0].end,u.captureIndices[0].end>r&&(r=u.captureIndices[0].end,n=!1))}else{i=c.stack.pop();break}}return{stack:i,linePos:r,anchorPosition:o,isFirstLine:n}}function Gh(e,t,n,r,i,a){let o=Kh(e,t,n,r,i,a),s=e.getInjections();if(s.length===0)return o;let c=qh(s,e,t,n,r,i,a);if(!c)return o;if(!o)return c;let l=o.captureIndices[0].start,u=c.captureIndices[0].start;return u<l||c.priorityMatch&&u===l?c:o}function Kh(e,t,n,r,i,a){let{ruleScanner:o,findOptions:s}=Jh(i.getRule(e),e,i.endRule,n,r===a),c=o.findNextMatchSync(t,r,s);return c?{captureIndices:c.captureIndices,matchedRuleId:c.ruleId}:null}function qh(e,t,n,r,i,a,o){let s=Number.MAX_VALUE,c=null,l,u=0,d=a.contentNameScopesList.getScopeNames();for(let a=0,f=e.length;a<f;a++){let f=e[a];if(!f.matcher(d))continue;let{ruleScanner:p,findOptions:m}=Jh(t.getRule(f.ruleId),t,null,r,i===o),h=p.findNextMatchSync(n,i,m);if(!h)continue;let g=h.captureIndices[0].start;if(!(g>=s)&&(s=g,c=h.captureIndices,l=h.ruleId,u=f.priority,s===i))break}return c?{priorityMatch:u===-1,captureIndices:c,matchedRuleId:l}:null}function Jh(e,t,n,r,i){return{ruleScanner:e.compileAG(t,n,r,i),findOptions:0}}function Yh(e,t,n,r,i){return{ruleScanner:e.compileWhileAG(t,n,r,i),findOptions:0}}function Xh(e,t,n,r,i,a,o){if(a.length===0)return;let s=t.content,c=Math.min(a. Line truncated
`;let a=this.createOnigString(e),o=a.content.length,s=new sg(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=Uh(this,a,i,0,t,s,!0,r);return ch(a),{lineLength:o,lineTokens:s,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function rg(e,t){return e=Am(e),e.repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var ig=class e{constructor(e,t,n){this.parent=e,this.scopePath=t,this.tokenAttributes=n}static fromExtension(t,n){let r=t,i=t?.scopePath??null;for(let t of n)i=Wm.push(i,t.scopeNames),r=new e(r,i,t.encodedTokenAttributes);return r}static createRoot(t,n){return new e(null,new Wm(null,t),n)}static createRootAndLookUpScopeName(t,n,r){let i=r.getMetadataForScope(t),a=new Wm(null,t),o=r.themeProvider.themeMatch(a),s=e.mergeAttributes(n,i,o);return new e(null,a,s)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(` `)}equals(t){return e.equals(this,t)}static equals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.scopeName!==t.scopeName||e.tokenAttributes!==t.tokenAttributes)return!1;e=e.parent,t=t.parent}while(1)}static mergeAttributes(e,t,n){let r=-1,i=0,a=0;return n!==null&&(r=n.fontStyle,i=n.foregroundId,a=n.backgroundId),nh.set(e,t.languageId,t.tokenType,null,r,i,a)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(` `)===-1)return e._pushAttributed(this,t,n);let r=t.split(/ /g),i=this;for(let t of r)i=e._pushAttributed(i,t,n);return i}static _pushAttributed(t,n,r){let i=r.getMetadataForScope(n),a=t.scopePath.push(n),o=r.themeProvider.themeMatch(a),s=e.mergeAttributes(t.tokenAttributes,i,o);return new e(t,a,s)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push({encodedTokenAttributes:n.tokenAttributes,scopeNames:n.scopePath.getExtensionIfDefined(n.parent?.scopePath??null)}),n=n.parent;return n===e?t.reverse():void 0}},ag=class e{constructor(e,t,n,r,i,a,o,s){this.parent=e,this.ruleId=t,this.beginRuleCapturedEOL=i,this.endRule=a,this.nameScopesList=o,this.contentNameScopesList=s,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=n,this._anchorPos=r}_stackElementBrand=void 0;static NULL=new e(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return t!==null&&e._equals(this,t)}static _equals(e,t){return e===t?!0:this._structuralEquals(e,t)?ig.equals(e.contentNameScopesList,t.contentNameScopesList):!1}static _structuralEquals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.depth!==t.depth||e.ruleId!==t.ruleId||e.endRule!==t.endRule)return!1;e=e.parent,t=t.parent}while(1)}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){e._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,i,a,o,s){return new e(this,t,n,r,i,a,o,s)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){let e=[];return this._writeString(e,0),`[`+e.join(`,`)+`]`}_writeString(e,t){return this.parent&&(t=this.parent._writeString(e,t)),e[t++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,t}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(t){return this.endRule===t?this:new e(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let t=this;for(;t&&t._enterPos===e._enterPos;){if(t.ruleId===e.ruleId)return!0;t=t.parent}return!1}toStateStackFrame(){return{ruleId:Oh(this.ruleId),beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(t,n){let r=ig.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new e(t,Dh(n.ruleId),n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,ig.fromExtension(r,n.contentNameScopesList))}},og=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(e=>e===`*`?(this.allowAny=!0,[]):ah(e,eg).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>ah(e,eg).map(e=>e.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(let t of this.unbalancedBracketScopes)if(t(e))return!1;for(let t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},sg=class{constructor(e,t,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._l Line truncated
`).find(e=>e.startsWith(`data: `));if(!t)continue;let n=JSON.parse(t.slice(6));if(n.session_id&&(vu.value=n.session_id),n.type===`delta`&&(o+=n.text,wu.value=wu.value?{...wu.value,text:o}:null),(n.type===`tool`||n.type===`navigate`)&&(a=[...a,n],wu.value=wu.value?{...wu.value,tools:a}:null),n.type===`ask`&&n.ask&&(clearTimeout(l),wu.value=wu.value?{...wu.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`);yu.value=!i&&n.trim()===`/new`?[]:[...yu.value,{from:`assistant`,text:o,tool_calls:a}],wu.value=null,xu.value=`Ready`,await Iu()}catch(e){let t=e;o&&(yu.value=[...yu.value,{from:`assistant`,text:o,tool_calls:a}],a=[]),t.name===`AbortError`&&!c?(wu.value={text:`Turn stopped.`,tools:a,isError:!1,turn:r,isRetry:i},xu.value=`Stopped`):(wu.value={text:`Unable to complete that turn: ${t.message||t}`,tools:a,isError:!0,turn:r?fu(r):void 0,isRetry:i},xu.value=`Error. Retry available.`)}finally{clearTimeout(l),hu=null,Pu=null,Su.value=!1,Wu.after?.()}}function td(){xu.value=`Stopping…`,vu.value&&J.chatCancel(vu.value).catch(()=>{}),Fu()}function nd(){P(()=>{Iu().catch(e=>{xu.value=e.message||`Chat unavailable`})}),se(()=>{Fu()})}async function rd(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 ed({textOverride:`🎤 Voice message`,voice:{data:btoa(n),mime_type:e.type||`audio/webm`}})}var id={class:`grid gap-1 p-1`},ad={key:0,class:`text-xs text-fg-subtle`},od=`__default__`,sd=y({__name:`ChatSettings`,setup(e){let t=G(()=>Eu.value||od),n=G(()=>{let e=Tu.value.models_by_provider||{},t=Object.entries(e).filter(([,e])=>e.length);return t.length?t:[[``,Tu.value.models||[]]]});return(e,i)=>(j(),o(`div`,id,[L(xu)===`Ready`?T(``,!0):(j(),o(`span`,ad,I(L(xu)),1)),r(L(ql),{"model-value":t.value,"onUpdate:modelValue":i[0]||=e=>L(Uu)(e===od?``:String(e??``))},{default:A(()=>[r(L(tu),{size:`sm`,class:`w-full`,"aria-label":`Model`},{default:A(()=>[r(L(nu))]),_:1}),r(L(Jl),null,{default:A(()=>[r(L(Zl),{value:od},{default:A(()=>[...i[1]||=[R(`Default`,-1)]]),_:1}),(j(!0),o(z,null,s(n.value,([e,t])=>(j(),U(L(Yl),{key:e},{default:A(()=>[e?(j(),U(L(Ql),{key:0},{default:A(()=>[R(I(e),1)]),_:2},1024)):T(``,!0),(j(!0),o(z,null,s(t,e=>(j(),U(L(Zl),{key:e,value:e},{default:A(()=>[R(I(e),1)]),_:2},1032,[`value`]))),128))]),_:2},1024))),128))]),_:1})]),_:1},8,[`model-value`])]))}}),cd=y({__name:`ChatSessionActions`,setup(e){let t=W(!1);Mu(t);function n(e){t.value=!1,Vu(e)}function i(e,n){t.value=!1,Hu(e,n)}return(e,a)=>(j(),U(L(Wl),{open:t.value,"onUpdate:open":a[5]||=e=>t.value=e},{default:A(()=>[r(L(Kl),{"as-child":``},{default:A(()=>[r(L(K),{variant:`ghost`,size:`icon-sm`,class:`flex-none`,"aria-label":`More`,title:`More`},{default:A(()=>[r(L(Gc))]),_:1})]),_:1}),r(L(Gl),{align:`end`,class:`grid w-64 gap-0.5 p-1`},{default:A(()=>[L(vu)?(j(),o(z,{key:0},[r(L(K),{variant:`ghost`,size:`sm`,class:`justify-start`,onClick:a[0]||=e=>n(`/retry`)},{default:A(()=>[r(L(Sl),{"data-icon":`inline-start`}),a[6]||=R(`Retry`,-1)]),_:1}),r(L(K),{variant:`ghost`,size:`sm`,class:`justify-start`,onClick:a[1]||=e=>n(`/undo`)},{default:A(()=>[r(L(Il),{"data-icon":`inline-start`}),a[7]||=R(`Undo`,-1)]),_:1}),r(L(K),{variant:`ghost`,size:`sm`,class:`justify-start`,onClick:a[2]||=e=>i(`/title`,`Session title`)},{default:A(()=>[r(L(hl),{"data-icon":`inline-start`}),a[8]||=R(`Rename`,-1)]),_:1}),r(L(K),{variant:`ghost`,size:`sm`,class:`justify-start`,onClick:a[3]||=e=>i(`/branch`,`Branch name (optional)`)},{default:A(()=>[r(L($c),{"data-icon":`inline-start`}),a[9]||=R(`Branch`,-1)]),_:1}),r(L(K),{variant:`ghost`,size:`sm`,class:`justify-start`,onClick:a[4]||=e=>n(`/compress --preview`)},{default:A(()=>[r(L(Ol),{"data-icon":`inline-start`}),a[10]||=R(`Preview compression`,-1)]),_:1}),r(L(Ul),{class:`my-1`})],64)):T(``,!0),r(sd)]),_:1})]),_:1},8,[`open`]))}}),ld=new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`});function ud(e){return e.title||e.branch_name||(e.created_at?ld.format(new Date(e.created_at)):`New chat`)}var dd={class:`min-w-0 flex-1`},fd=y({__name:`ChatSessionList`,setup(e){return(e,t)=>(j(),o(`div`,dd,[r(L(ql),{"model-value":L(vu),disabled:!L(_u).length,"onUpdate:modelValue":t[0]||=e=>L(Lu)(String(e))},{default:A(()=>[r(L(tu),{size:`sm`,class:`w-full`,"aria-label":`Conversation`},{default:A(()=>[r(L(nu),{placeholder:`No conversations yet`})]),_:1}),r(L(Jl),null,{default:A(()=>[r(L(Yl),null,{default:A(()=>[(j(!0),o(z,null,s(L(_u),e=>(j(),U(L(Zl),{key:e.session_id,value:e.session_id},{default:A(()=>[R(I(L(ud)(e)),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`model-value`,`disabled`])]))}}),pd={class:`flex items-center gap-1 border-b px-3 py-2`},md=y({__name:`ChatBar`,setup(e){return(e,t)=>(j(),o(`div`,pd,[r(fd),r(L(K),{variant:`ghost`,size:`icon-sm`,class:`flex-none`,title:`New chat`,"aria-lab Line truncated
`))],64)):H(n.$slots,`default`,{},void 0,void 0,1)])],10,Up))}}),Kp=y({__name:`CodeBlockContent`,props:{wrap:{type:Boolean,default:!1},lineNumbers:{type:Boolean,default:!1},startLine:{default:1},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e,n=a();function i(e){let t=``;for(let n of e)if(n.type!==me){if(n.type===ue)t+=n.children;else if(n.type===z&&Array.isArray(n.children)){let e=i(n.children);if(e===null)return null;t+=e}else return null}return t}function c(){if(!t.lineNumbers)return null;let e=i(n.default?.()??[]);return e===null?null:e.replace(/\n$/,``).split(`
`)}return(n,i)=>(j(),U(L(q),{as:`pre`,"data-slot":`code-block-content`,"data-wrap":e.wrap||void 0,"data-numbered":e.lineNumbers||void 0,dir:`ltr`,tabindex:`0`,style:ve({counterReset:`line ${e.startLine-1}`}),class:F(L(B)(`px-3 py-3 leading-relaxed group-has-data-[slot=code-block-header]/code-block:pt-2 group-has-data-[slot=code-block-footer]/code-block:pb-2 group-data-[size=sm]/code-block:px-2.5 group-data-[size=sm]/code-block:py-2.5 group-data-[size=sm]/code-block:group-has-data-[slot=code-block-header]/code-block:pt-1.5 min-h-0 min-w-0 scroll-fade-x scrollbar-thin overflow-auto text-start font-mono outline-none data-wrap:scroll-fade-y data-wrap:wrap-break-word data-wrap:whitespace-pre-wrap`,t.class))},{default:A(()=>[r(L(q),{as:`code`,"data-slot":`code-block-code`,class:`grid min-h-lh min-w-max content-start in-data-numbered:grid-cols-[auto_1fr] in-data-wrap:min-w-0`},{default:A(()=>[(j(!0),o(z,null,s([c()],(e,t)=>(j(),o(z,{key:t},[e?(j(!0),o(z,{key:0},s(e,(e,t)=>(j(),U(Gp,{key:t},{default:A(()=>[R(I(e),1)]),_:2},1024))),128)):H(n.$slots,`default`,{},void 0,void 0,1)],64))),128))]),_:3})]),_:3},8,[`data-wrap`,`data-numbered`,`style`,`class`]))}}),qp={"aria-live":`polite`,class:`sr-only`},Jp=y({inheritAttrs:!1,__name:`CodeBlockCopyButton`,props:{asChild:{type:Boolean},as:{default:`button`},value:{},variant:{default:`ghost`},size:{default:`icon-xs`},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e,{copy:n,copied:i}=nee({copiedDuring:2e3,legacy:!0});return(a,s)=>(j(),o(z,null,[r(L(K),V(a.$attrs,{"data-slot":`code-block-copy-button`,"data-copied":L(i)||void 0,as:e.as,"as-child":e.asChild,variant:e.variant,size:e.size,"aria-label":L(i)?`Copied`:`Copy`,class:L(B)(``,t.class),onClick:s[0]||=e=>L(n)(t.value)}),{default:A(()=>[L(i)?(j(),U(L(Mc),{key:0})):(j(),U(L(Uc),{key:1}))]),_:1},16,[`data-copied`,`as`,`as-child`,`variant`,`size`,`aria-label`,`class`]),N(`span`,qp,I(L(i)?`Copied`:``),1)],64))}}),Yp=y({__name:`CodeBlockToken`,props:{token:{}},setup(e){return(t,n)=>(j(),o(`span`,{style:ve(e.token.htmlStyle),class:`text-(--shiki-light) dark:text-(--shiki-dark)`},I(e.token.content),5))}}),Xp=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function Zp(e){return Qp(e)}function Qp(e){return Array.isArray(e)?$p(e):e instanceof RegExp?e:typeof e==`object`?em(e):e}function $p(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=Qp(e[n]);return t}function em(e){let t={};for(let n in e)t[n]=Qp(e[n]);return t}function tm(e,...t){return t.forEach(t=>{for(let n in t)e[n]=t[n]}),e}function nm(e){let t=~e.lastIndexOf(`/`)||~e.lastIndexOf(`\\`);return t===0?e:~t===e.length-1?nm(e.substring(0,e.length-1)):e.substr(~t+1)}var rm=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,im=class{static hasCaptures(e){return e!==null&&(rm.lastIndex=0,rm.test(e))}static replaceCaptures(e,t,n){return e.replace(rm,(e,r,i,a)=>{let o=n[parseInt(r||i,10)];if(o){let e=t.substring(o.start,o.end);for(;e[0]===`.`;)e=e.substring(1);switch(a){case`downcase`:return e.toLowerCase();case`upcase`:return e.toUpperCase();default:return e}}else return e})}};function am(e,t){return e<t?-1:+(e>t)}function om(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let r=0;r<n;r++){let n=am(e[r],t[r]);if(n!==0)return n}return 0}return n-r}function sm(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function cm(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,`\\$&`)}var lm=class{constructor(e){this.fn=e}cache=new Map;get(e){if(this.cache.has(e))return this.cache.get(e);let t=this.fn(e);return this.cache.set(e,t),t}},um=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(Tne(e),t)}static createFromParsedTheme(e,t){return Dne(e,t)}_cachedMatchRoot=new lm(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;let t=e.scopeName,n=this._cachedMatchRoot.get(t).find(t=>Cne(e.parent,t.parentScopes));return n?new fm(n.fontStyle,n.foreground,n.background):null}},dm=class e{constructor(e,t){this.parent=e,this.scopeName=t}static push(t,n){for(let r of n)t=new e(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new e(n,t[r]);return n}push(t){return new e(this,t)}getSegments(){let e=this,t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(` `)}extends(e){return this===e||this.parent!==null&&this.parent.extends(e)}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push(n.scopeName),n=n.parent;return n===e?t.reverse():void 0}};function Cne(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let r=t[n],i=!1;if(r===`>`){if(n===t.length-1)return!1;r=t[++n],i=!0}for(;e&&!wne(e.scopeName,r);){if(i)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function Line truncated
`)}findNextMatchSync(e,t,n){let r=this.scanner.findNextMatchSync(e,t,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},Im=class{constructor(e,t){this.languageId=e,this.tokenType=t}},qne=class e{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,t){this._defaultAttributes=new Im(e,8),this._embeddedLanguagesMatcher=new Jne(Object.entries(t||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?e._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}static _NULL_SCOPE_METADATA=new Im(0,0);_getBasicScopeAttributes=new lm(e=>new Im(this._scopeToLanguage(e),this._toStandardTokenType(e)));_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(t){let n=t.match(e.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case`comment`:return 1;case`string`:return 2;case`regex`:return 3;case`meta.embedded`:return 0}throw Error(`Unexpected match for standard token type!`)}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},Jne=class{values;scopesRegExp;constructor(e){if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);let t=e.map(([e,t])=>cm(e));t.sort(),t.reverse(),this.scopesRegExp=RegExp(`^((${t.join(`)|(`)}))($|\\.)`,``)}}match(e){if(!this.scopesRegExp)return;let t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}};typeof process<`u`&&{}.VSCODE_TEXTMATE_DEBUG;var Lm=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function Rm(e,t,n,r,i,a,o,s){let c=t.content.length,l=!1,u=-1;if(o){let o=Yne(e,t,n,r,i,a);i=o.stack,r=o.linePos,n=o.isFirstLine,u=o.anchorPosition}let d=Date.now();for(;!l;){if(s!==0&&Date.now()-d>s)return new Lm(i,!0);f()}return new Lm(i,!1);function f(){let o=Xne(e,t,n,r,i,u);if(!o){a.produce(i,c),l=!0;return}let s=o.captureIndices,d=o.matchedRuleId,f=s&&s.length>0?s[0].end>r:!1;if(d===Wne){let o=i.getRule(e);a.produce(i,s[0].start),i=i.withContentNameScopesList(i.nameScopesList),Bm(e,t,n,i,a,o.endCaptures,s),a.produce(i,s[0].end);let d=i;if(i=i.parent,u=d.getAnchorPos(),!f&&d.getEnterPos()===r){i=d,a.produce(i,c),l=!0;return}}else{let o=e.getRule(d);a.produce(i,s[0].start);let p=i,m=o.getName(t.content,s),h=i.contentNameScopesList.pushAttributed(m,e);if(i=i.push(d,r,u,s[0].end===c,null,h,h),o instanceof Am){let r=o;Bm(e,t,n,i,a,r.beginCaptures,s),a.produce(i,s[0].end),u=s[0].end;let d=r.getContentName(t.content,s),m=h.pushAttributed(d,e);if(i=i.withContentNameScopesList(m),r.endHasBackReferences&&(i=i.withEndRule(r.getEndWithResolvedBackReferences(t.content,s))),!f&&p.hasSameRuleAs(i)){i=i.pop(),a.produce(i,c),l=!0;return}}else if(o instanceof jm){let r=o;Bm(e,t,n,i,a,r.beginCaptures,s),a.produce(i,s[0].end),u=s[0].end;let d=r.getContentName(t.content,s),m=h.pushAttributed(d,e);if(i=i.withContentNameScopesList(m),r.whileHasBackReferences&&(i=i.withEndRule(r.getWhileWithResolvedBackReferences(t.content,s))),!f&&p.hasSameRuleAs(i)){i=i.pop(),a.produce(i,c),l=!0;return}}else if(Bm(e,t,n,i,a,o.captures,s),a.produce(i,s[0].end),i=i.pop(),!f){i=i.safePop(),a.produce(i,c),l=!0;return}}s[0].end>r&&(r=s[0].end,n=!1)}}function Yne(e,t,n,r,i,a){let o=i.beginRuleCapturedEOL?0:-1,s=[];for(let t=i;t;t=t.pop()){let n=t.getRule(e);n instanceof jm&&s.push({rule:n,stack:t})}for(let c=s.pop();c;c=s.pop()){let{ruleScanner:s,findOptions:l}=$ne(c.rule,e,c.stack.endRule,n,r===o),u=s.findNextMatchSync(t,r,l);if(u){if(u.ruleId!==Tm){i=c.stack.pop();break}u.captureIndices&&u.captureIndices.length&&(a.produce(c.stack,u.captureIndices[0].start),Bm(e,t,n,c.stack,a,c.rule.whileCaptures,u.captureIndices),a.produce(c.stack,u.captureIndices[0].end),o=u.captureIndices[0].end,u.captureIndices[0].end>r&&(r=u.captureIndices[0].end,n=!1))}else{i=c.stack.pop();break}}return{stack:i,linePos:r,anchorPosition:o,isFirstLine:n}}function Xne(e,t,n,r,i,a){let o=Zne(e,t,n,r,i,a),s=e.getInjections();if(s.length===0)return o;let c=Qne(s,e,t,n,r,i,a);if(!c)return o;if(!o)return c;let l=o.captureIndices[0].start,u=c.captureIndices[0].start;return u<l||c.priorityMatch&&u===l?c:o}function Zne(e,t,n,r,i,a){let{ruleScanner:o,findOptions:s}=zm(i.getRule(e),e,i.endRule,n,r===a),c=o.findNextMatchSync(t,r,s);return c?{captureIndices:c.captureIndices,matchedRuleId:c.ruleId}:null}function Qne(e,t,n,r,i,a,o){let s=Number.MAX_VALUE,c=null,l,u=0,d=a.contentNameScopesList.getScopeNames();for(let a=0,f=e.length;a<f;a++){let f=e[a];if(!f.matcher(d))continue;let{ruleScanner:p,findOptions:m}=zm(t.getRule(f.ruleId),t,null,r,i===o),h=p.findNextMatchSync(n,i,m);if(!h)continue;let g=h.captureIndices[0].start;if(!(g>=s)&&(s=g,c=h.captureIndices,l=h.ruleId,u=f.priority,s===i))break}return c?{priorityMatch:u===-1,captureIndices:c,matchedRuleId:l}:null}function zm(e,t,n,r,i){return{ruleScanner:e.compileAG(t,n,r,i),findOptions:0}}function $ne(e,t,n,r,i){return{ruleScanner:e.compileWhileAG(t,n,r,i),findOptions:0}}function Bm(e,t,n,r,i,a,o){if(a.length===0)return;let s=t.content Line truncated
`;let a=this.createOnigString(e),o=a.content.length,s=new are(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=Rm(this,a,i,0,t,s,!0,r);return vm(a),{lineLength:o,lineTokens:s,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function Um(e,t){return e=Zp(e),e.repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var Wm=class e{constructor(e,t,n){this.parent=e,this.scopePath=t,this.tokenAttributes=n}static fromExtension(t,n){let r=t,i=t?.scopePath??null;for(let t of n)i=dm.push(i,t.scopeNames),r=new e(r,i,t.encodedTokenAttributes);return r}static createRoot(t,n){return new e(null,new dm(null,t),n)}static createRootAndLookUpScopeName(t,n,r){let i=r.getMetadataForScope(t),a=new dm(null,t),o=r.themeProvider.themeMatch(a),s=e.mergeAttributes(n,i,o);return new e(null,a,s)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(` `)}equals(t){return e.equals(this,t)}static equals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.scopeName!==t.scopeName||e.tokenAttributes!==t.tokenAttributes)return!1;e=e.parent,t=t.parent}while(1)}static mergeAttributes(e,t,n){let r=-1,i=0,a=0;return n!==null&&(r=n.fontStyle,i=n.foregroundId,a=n.backgroundId),hm.set(e,t.languageId,t.tokenType,null,r,i,a)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(` `)===-1)return e._pushAttributed(this,t,n);let r=t.split(/ /g),i=this;for(let t of r)i=e._pushAttributed(i,t,n);return i}static _pushAttributed(t,n,r){let i=r.getMetadataForScope(n),a=t.scopePath.push(n),o=r.themeProvider.themeMatch(a),s=e.mergeAttributes(t.tokenAttributes,i,o);return new e(t,a,s)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push({encodedTokenAttributes:n.tokenAttributes,scopeNames:n.scopePath.getExtensionIfDefined(n.parent?.scopePath??null)}),n=n.parent;return n===e?t.reverse():void 0}},Gm=class e{constructor(e,t,n,r,i,a,o,s){this.parent=e,this.ruleId=t,this.beginRuleCapturedEOL=i,this.endRule=a,this.nameScopesList=o,this.contentNameScopesList=s,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=n,this._anchorPos=r}_stackElementBrand=void 0;static NULL=new e(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return t!==null&&e._equals(this,t)}static _equals(e,t){return e===t?!0:this._structuralEquals(e,t)?Wm.equals(e.contentNameScopesList,t.contentNameScopesList):!1}static _structuralEquals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.depth!==t.depth||e.ruleId!==t.ruleId||e.endRule!==t.endRule)return!1;e=e.parent,t=t.parent}while(1)}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){e._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,i,a,o,s){return new e(this,t,n,r,i,a,o,s)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){let e=[];return this._writeString(e,0),`[`+e.join(`,`)+`]`}_writeString(e,t){return this.parent&&(t=this.parent._writeString(e,t)),e[t++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,t}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(t){return this.endRule===t?this:new e(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let t=this;for(;t&&t._enterPos===e._enterPos;){if(t.ruleId===e.ruleId)return!0;t=t.parent}return!1}toStateStackFrame(){return{ruleId:Dm(this.ruleId),beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(t,n){let r=Wm.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new e(t,Em(n.ruleId),n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,Wm.fromExtension(r,n.contentNameScopesList))}},ire=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(e=>e===`*`?(this.allowAny=!0,[]):gm(e,Hm).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>gm(e,Hm).map(e=>e.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(let t of this.unbalancedBracketScopes)if(t(e))return!1;for(let t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},are=class{constructor(e,t,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this Line truncated
\f\r &/=>`.split(``),`
\f\r "&'/=>\``.split(``)],[`\0
\f\r "&'/<=>`.split(``),`\0
@@ -14,10 +14,10 @@ import{A as e,B as t,C as n,D as r,E as i,F as a,H as o,I as s,L as c,M as l,N a
\f\r &>`.split(``),`\0
\f\r "&'<=>\``.split(``)],[`\0
\f\r "&'<=>\``.split(``),`\0
\f\r "&'<=>\``.split(``)]],single:[[`&'`.split(``),`"&'\``.split(``)],[`\0&'`.split(``),`\0"&'\``.split(``)]],double:[[`"&`.split(``),`"&'\``.split(``)],[`\0"&`.split(``),`\0"&'\``.split(``)]]};function Uv(e,t,n,r){let i=r.schema,a=i.space!==`svg`&&r.settings.omitOptionalTags,o=i.space===`svg`?r.settings.closeEmptyElements:r.settings.voids.includes(e.tagName.toLowerCase()),s=[],c;i.space===`html`&&e.tagName===`svg`&&(r.schema=M_);let l=Wv(r,e.properties),u=r.all(i.space===`html`&&e.tagName===`template`?e.content:e);return r.schema=i,u&&(o=!1),(l||!a||!Iv(e,t,n))&&(s.push(`<`,e.tagName,l?` `+l:``),o&&(i.space===`svg`||r.settings.closeSelfClosing)&&(c=l.charAt(l.length-1),(!r.settings.tightSelfClosing||c===`/`||c&&c!==`"`&&c!==`'`)&&s.push(` `),s.push(`/`)),s.push(`>`)),s.push(u),!o&&(!a||!bv(e,t,n))&&s.push(`</`+e.tagName+`>`),s.join(``)}function Wv(e,t){let n=[],r=-1,i;if(t){for(i in t)if(t[i]!==null&&t[i]!==void 0){let r=Gv(e,i,t[i]);r&&n.push(r)}}for(;++r<n.length;){let t=e.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&t!==`"`&&t!==`'`&&(n[r]+=` `)}return n.join(``)}function Gv(e,t,n){let r=O_(e.schema,t),i=e.settings.allowParseErrors&&e.schema.space===`html`?0:1,a=+!e.settings.allowDangerousCharacters,o=e.quote,s;if(r.overloadedBoolean&&(n===r.attribute||n===``)?n=!0:(r.boolean||r.overloadedBoolean)&&(typeof n!=`string`||n===r.attribute||n===``)&&(n=!!n),n==null||n===!1||typeof n==`number`&&Number.isNaN(n))return``;let c=nv(r.attribute,Object.assign({},e.settings.characterReferences,{subset:Hv.name[i][a]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?lv:uv)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?c:(e.settings.preferUnquoted&&(s=nv(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:Hv.unquoted[i][a]}))),s!==n&&(e.settings.quoteSmart&&cv(n,o)>cv(n,e.alternative)&&(o=e.alternative),s=o+nv(n,Object.assign({},e.settings.characterReferences,{subset:(o===`'`?Hv.single:Hv.double)[i][a],attribute:!0}))+o),c+(s&&`=`+s))}var Kv=[`<`,`&`];function qv(e,t,n,r){return n&&n.type===`element`&&(n.tagName===`script`||n.tagName===`style`)?e.value:nv(e.value,Object.assign({},r.settings.characterReferences,{subset:Kv}))}function Jv(e,t,n,r){return r.settings.allowDangerousHtml?e.value:qv(e,t,n,r)}function Yv(e,t,n,r){return r.all(e)}var Xv=P_(`type`,{invalid:Zv,unknown:Qv,handlers:{comment:ov,doctype:sv,element:Uv,raw:Jv,root:Yv,text:qv}});function Zv(e){throw Error("Expected node, not `"+e+"`")}function Qv(e){throw Error("Cannot compile unknown node `"+e.type+"`")}var $v={},ey={},ty=[];function ny(e,t){let n=t||$v,r=n.quote||`"`,i=r===`"`?`'`:`"`;if(r!==`"`&&r!==`'`)throw Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:ry,all:iy,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||Qg,characterReferences:n.characterReferences||ey,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space===`svg`?M_:j_,quote:r,alternative:i}.one(Array.isArray(e)?{type:`root`,children:e}:e,void 0,void 0)}function ry(e,t,n){return Xv(e,t,n,this)}function iy(e){let t=[],n=e&&e.children||ty,r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join(``)}var ay=/\s+/g;function oy(e,t){if(!t)return e;e.properties||={},e.properties.class||=[],typeof e.properties.class==`string`&&(e.properties.class=e.properties.class.split(ay)),Array.isArray(e.properties.class)||(e.properties.class=[]);let n=Array.isArray(t)?t:t.split(ay);for(let t of n)t&&!e.properties.class.includes(t)&&e.properties.class.push(t);return e}function sy(e){let t=bg(e,!0).map(([e])=>e);function n(n){if(n===e.length)return{line:t.length-1,character:t.at(-1).length};let r=n,i=0;for(let e of t){if(r<e.length)break;r-=e.length,i++}return{line:i,character:r}}function r(e,n){let r=0;for(let n=0;n<e;n++)r+=t[n].length;return r+=n,r}return{lines:t,indexToPos:n,posToIndex:r}}var cy=[`color`,`background-color`];function ly(e,t){let n=0,r=[];for(let i of t)i>n&&r.push({...e,content:e.content.slice(n,i),offset:e.offset+n}),n=i;return n<e.content.length&&r.push({...e,content:e.content.slice(n),offset:e.offset+n}),r}function uy(e,t){let n=0,r=e.length;for(;n<r;){let i=n+(r-n>>1);e[i]<=t?n=i+1:r=i}return n}function dy(e,t){let n=[...t instanceof Set?t:new Set(t)].sort((e,t)=>e-t);return n.length?e.map(e=>e.flatMap(e=>{let t=e.offset+e.content.length,r=uy(n,e.offset),i=r;for(;i<n.length&&n[i]<t;)i++;if(r===i)return e;let a=n.slice(rLine truncated
`}));let n={type:`element`,tagName:`span`,properties:{class:`line`},children:[]},r=0;for(let a of e){let e={type:`element`,tagName:`span`,properties:{...a.htmlAttrs},children:[{type:`text`,value:a.content}]},c=my(a.htmlStyle||py(a));c&&(e.properties.style=c);for(let o of i)e=o?.span?.call(p,e,t+1,r,n,a)||e;s===`inline`?o.children.push(e):s===`classic`&&n.children.push(e),r+=a.content.length}if(s===`classic`){for(let e of i)n=e?.line?.call(p,n,t+1)||n;f.push(n),a.push(n)}else s===`inline`&&f.push(n)}),s===`classic`){for(let e of i)d=e?.code?.call(p,d)||d;u.children.push(d);for(let e of i)u=e?.pre?.call(p,u)||u;o.children.push(u)}else if(s===`inline`){let e=[],t={type:`element`,tagName:`span`,properties:{class:`line`},children:[]};for(let n of o.children)n.type===`element`&&n.tagName===`br`?(e.push(t),t={type:`element`,tagName:`span`,properties:{class:`line`},children:[]}):(n.type===`element`||n.type===`text`)&&t.children.push(n);e.push(t);let n={type:`element`,tagName:`code`,properties:{},children:e};for(let e of i)n=e?.code?.call(p,n)||n;o.children=[];for(let e=0;e<n.children.length;e++){e>0&&o.children.push({type:`element`,tagName:`br`,properties:{},children:[]});let t=n.children[e];t.type===`element`&&o.children.push(...t.children)}}let m=o;for(let e of i)m=e?.root?.call(p,m)||m;return r&&Pg(m,r),m}function Vy(e){return e.map(e=>{let t=[],n=``,r;return e.forEach((i,a)=>{let o=!(i.fontStyle&&(i.fontStyle&Xm.Underline||i.fontStyle&Xm.Strikethrough));o&&Ly.test(i.content)&&e[a+1]?(r===void 0&&(r=i.offset),n+=i.content):n?(o?t.push({...i,offset:r,content:n+i.content}):t.push({content:n,offset:r},i),r=void 0,n=``):t.push(i)}),t})}function Hy(e){return e.map(e=>e.flatMap(e=>{if(Ly.test(e.content))return e;let t=e.content.match(Ry);if(!t)return e;let[,n,r,i]=t;if(!n&&!i)return e;let a=[{...e,offset:e.offset+n.length,content:r}];return n&&a.unshift({content:n,offset:e.offset}),i&&a.push({content:i,offset:e.offset+n.length+r.length}),a}))}function Uy(e){return e.map(e=>{let t=[];for(let n of e){if(t.length===0){t.push({...n});continue}let e=t.at(-1),r=my(e.htmlStyle||py(e)),i=my(n.htmlStyle||py(n)),a=e.fontStyle&&(e.fontStyle&Xm.Underline||e.fontStyle&Xm.Strikethrough),o=n.fontStyle&&(n.fontStyle&Xm.Underline||n.fontStyle&Xm.Strikethrough);!a&&!o&&r===i?e.content+=n.content:t.push({...n})}return t})}var Wy=ny;function Gy(e,t,n){let r={meta:{},options:n,codeToHast:(t,n)=>zy(e,t,n),codeToTokens:(t,n)=>Fy(e,t,n)},i=Wy(zy(e,t,n,r));for(let e of yy(n))i=e.postprocess?.call(r,i,n)||i;return i}async function Ky(e){let t=await Mg(e);return{getLastGrammarState:(...e)=>Hg(t,...e),codeToTokensBase:(e,n)=>Py(t,e,n),codeToTokensWithThemes:(e,n)=>Xg(t,e,n),codeToTokens:(e,n)=>Fy(t,e,n),codeToHast:(e,n)=>zy(t,e,n),codeToHtml:(e,n)=>Gy(t,e,n),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}var qy=4294967295;function Jy(e){return!e.sticky&&!e.rawOptions?.strategy}function Yy(e,t){return{index:e,captureIndices:t.map(e=>e==null?{start:qy,end:qy,length:0}:{start:e[0],end:e[1],length:e[1]-e[0]})}}var Xy=class{patterns;options;regexps;lastSearches;constructor(e,t={}){this.patterns=e,this.options=t;let{forgiving:n=!1,cache:r,regexConstructor:i}=t;if(!i)throw Error("Option `regexConstructor` is not provided");this.regexps=e.map(e=>{if(typeof e!=`string`)return e;let t=r?.get(e);if(t){if(t instanceof RegExp)return t;if(n)return null;throw t}try{let t=i(e);return r?.set(e,t),t}catch(t){if(r?.set(e,t),n)return null;throw t}}),this.lastSearches=this.regexps.map(e=>e&&Jy(e)?{strId:0,searchedFrom:0,matchIndex:-1,indices:null}:null)}findNextMatchSync(e,t,n){let r=typeof e==`string`?e:e.content,i=typeof e==`string`?0:e.id||0,a=-1,o=0,s=null;for(let e=0;e<this.regexps.length;e++){let n=this.regexps[e];if(n)try{let c=i?this.lastSearches[e]:null,l,u;if(c&&c.strId===i&&c.searchedFrom<=t&&(c.matchIndex===-1||c.matchIndex>=t))l=c.matchIndex,u=c.indices;else{n.lastIndex=t;let e=n.exec(r);l=e?e.index:-1,u=e?e.indices:null,c&&(c.strId=i,c.searchedFrom=t,c.matchIndex=l,c.indices=u)}if(l===-1)continue;if(l===t)return Yy(e,u);(a===-1||l<o)&&(a=e,o=l,s=u)}catch(e){if(this.options.forgiving)continue;throw e}}return a===-1?null:Yy(a,s)}},Zy=0;function Qy(e){return{content:e,id:++Zy}}function $y(e){if([...e].length!==1)throw Error(`Expected "${e}" to be a single code point`);return e.codePointAt(0)}function eb(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}var tb=new Set([`alnum`,`alpha`,`ascii`,`blank`,`cntrl`,`digit`,`graph`,`lower`,`print`,`punct`,`space`,`upper`,`word`,`xdigit`]),nb=String.raw;function rb(e,t){if(e==null)throw Error(t??`Value expected`);return e}var ib=nb`\[\^?`,ab=`c.? | C(?:-.?)?|${nb`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${nb`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${nb`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${nb`o\{[^\}]*\}?`}|${nb`\d{1,3}`}`,ob=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,sb=new RegExp(nb`
\f\r "&'<=>\``.split(``)]],single:[[`&'`.split(``),`"&'\``.split(``)],[`\0&'`.split(``),`\0"&'\``.split(``)]],double:[[`"&`.split(``),`"&'\``.split(``)],[`\0"&`.split(``),`\0"&'\``.split(``)]]};function Oie(e,t,n,r){let i=r.schema,a=i.space!==`svg`&&r.settings.omitOptionalTags,o=i.space===`svg`?r.settings.closeEmptyElements:r.settings.voids.includes(e.tagName.toLowerCase()),s=[],c;i.space===`html`&&e.tagName===`svg`&&(r.schema=Rh);let l=kie(r,e.properties),u=r.all(i.space===`html`&&e.tagName===`template`?e.content:e);return r.schema=i,u&&(o=!1),(l||!a||!Sie(e,t,n))&&(s.push(`<`,e.tagName,l?` `+l:``),o&&(i.space===`svg`||r.settings.closeSelfClosing)&&(c=l.charAt(l.length-1),(!r.settings.tightSelfClosing||c===`/`||c&&c!==`"`&&c!==`'`)&&s.push(` `),s.push(`/`)),s.push(`>`)),s.push(u),!o&&(!a||!$h(e,t,n))&&s.push(`</`+e.tagName+`>`),s.join(``)}function kie(e,t){let n=[],r=-1,i;if(t){for(i in t)if(t[i]!==null&&t[i]!==void 0){let r=Aie(e,i,t[i]);r&&n.push(r)}}for(;++r<n.length;){let t=e.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&t!==`"`&&t!==`'`&&(n[r]+=` `)}return n.join(``)}function Aie(e,t,n){let r=Nre(e.schema,t),i=e.settings.allowParseErrors&&e.schema.space===`html`?0:1,a=+!e.settings.allowDangerousCharacters,o=e.quote,s;if(r.overloadedBoolean&&(n===r.attribute||n===``)?n=!0:(r.boolean||r.overloadedBoolean)&&(typeof n!=`string`||n===r.attribute||n===``)&&(n=!!n),n==null||n===!1||typeof n==`number`&&Number.isNaN(n))return``;let c=Gh(r.attribute,Object.assign({},e.settings.characterReferences,{subset:rg.name[i][a]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?aie:oie)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?c:(e.settings.preferUnquoted&&(s=Gh(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:rg.unquoted[i][a]}))),s!==n&&(e.settings.quoteSmart&&Kh(n,o)>Kh(n,e.alternative)&&(o=e.alternative),s=o+Gh(n,Object.assign({},e.settings.characterReferences,{subset:(o===`'`?rg.single:rg.double)[i][a],attribute:!0}))+o),c+(s&&`=`+s))}var jie=[`<`,`&`];function ig(e,t,n,r){return n&&n.type===`element`&&(n.tagName===`script`||n.tagName===`style`)?e.value:Gh(e.value,Object.assign({},r.settings.characterReferences,{subset:jie}))}function Mie(e,t,n,r){return r.settings.allowDangerousHtml?e.value:ig(e,t,n,r)}function Nie(e,t,n,r){return r.all(e)}var Pie=Lre(`type`,{invalid:Fie,unknown:Iie,handlers:{comment:rie,doctype:iie,element:Oie,raw:Mie,root:Nie,text:ig}});function Fie(e){throw Error("Expected node, not `"+e+"`")}function Iie(e){throw Error("Cannot compile unknown node `"+e.type+"`")}var Lie={},Rie={},zie=[];function Bie(e,t){let n=t||Lie,r=n.quote||`"`,i=r===`"`?`'`:`"`;if(r!==`"`&&r!==`'`)throw Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:Vie,all:Hie,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||Dre,characterReferences:n.characterReferences||Rie,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space===`svg`?Rh:Ire,quote:r,alternative:i}.one(Array.isArray(e)?{type:`root`,children:e}:e,void 0,void 0)}function Vie(e,t,n){return Pie(e,t,n,this)}function Hie(e){let t=[],n=e&&e.children||zie,r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join(``)}var ag=/\s+/g;function og(e,t){if(!t)return e;e.properties||={},e.properties.class||=[],typeof e.properties.class==`string`&&(e.properties.class=e.properties.class.split(ag)),Array.isArray(e.properties.class)||(e.properties.class=[]);let n=Array.isArray(t)?t:t.split(ag);for(let t of n)t&&!e.properties.class.includes(t)&&e.properties.class.push(t);return e}function Uie(e){let t=Qm(e,!0).map(([e])=>e);function n(n){if(n===e.length)return{line:t.length-1,character:t.at(-1).length};let r=n,i=0;for(let e of t){if(r<e.length)break;r-=e.length,i++}return{line:i,character:r}}function r(e,n){let r=0;for(let n=0;n<e;n++)r+=t[n].length;return r+=n,r}return{lines:t,indexToPos:n,posToIndex:r}}var Wie=[`color`,`background-color`];function Gie(e,t){let n=0,r=[];for(let i of t)i>n&&r.push({...e,content:e.content.slice(n,i),offset:e.offset+n}),n=i;return n<e.content.length&&r.push({...e,content:e.content.slice(n),offset:e.offset+n}),r}function Kie(e,t){let n=0,r=e.length;for(;n<r;){let i=n+(r-n>>1);e[i]<=t?n=i+1:r=i}return n}function qie(e,t){let n=[...t instanceof Set?t:new Set(t)].sort((e,t)=>e-t);return n.length?e.map(e=>e.flatMap(e=>{let t=e.offset+e.content.length,r=Kie(n,e.offset),i=r;for(;i<n.length&&nLine truncated
`}));let n={type:`element`,tagName:`span`,properties:{class:`line`},children:[]},r=0;for(let a of e){let e={type:`element`,tagName:`span`,properties:{...a.htmlAttrs},children:[{type:`text`,value:a.content}]},c=cg(a.htmlStyle||sg(a));c&&(e.properties.style=c);for(let o of i)e=o?.span?.call(p,e,t+1,r,n,a)||e;s===`inline`?o.children.push(e):s===`classic`&&n.children.push(e),r+=a.content.length}if(s===`classic`){for(let e of i)n=e?.line?.call(p,n,t+1)||n;f.push(n),a.push(n)}else s===`inline`&&f.push(n)}),s===`classic`){for(let e of i)d=e?.code?.call(p,d)||d;u.children.push(d);for(let e of i)u=e?.pre?.call(p,u)||u;o.children.push(u)}else if(s===`inline`){let e=[],t={type:`element`,tagName:`span`,properties:{class:`line`},children:[]};for(let n of o.children)n.type===`element`&&n.tagName===`br`?(e.push(t),t={type:`element`,tagName:`span`,properties:{class:`line`},children:[]}):(n.type===`element`||n.type===`text`)&&t.children.push(n);e.push(t);let n={type:`element`,tagName:`code`,properties:{},children:e};for(let e of i)n=e?.code?.call(p,n)||n;o.children=[];for(let e=0;e<n.children.length;e++){e>0&&o.children.push({type:`element`,tagName:`br`,properties:{},children:[]});let t=n.children[e];t.type===`element`&&o.children.push(...t.children)}}let m=o;for(let e of i)m=e?.root?.call(p,m)||m;return r&&ch(m,r),m}function Sg(e){return e.map(e=>{let t=[],n=``,r;return e.forEach((i,a)=>{let o=!(i.fontStyle&&(i.fontStyle&pm.Underline||i.fontStyle&pm.Strikethrough));o&&yg.test(i.content)&&e[a+1]?(r===void 0&&(r=i.offset),n+=i.content):n?(o?t.push({...i,offset:r,content:n+i.content}):t.push({content:n,offset:r},i),r=void 0,n=``):t.push(i)}),t})}function Cg(e){return e.map(e=>e.flatMap(e=>{if(yg.test(e.content))return e;let t=e.content.match(sae);if(!t)return e;let[,n,r,i]=t;if(!n&&!i)return e;let a=[{...e,offset:e.offset+n.length,content:r}];return n&&a.unshift({content:n,offset:e.offset}),i&&a.push({content:i,offset:e.offset+n.length+r.length}),a}))}function wg(e){return e.map(e=>{let t=[];for(let n of e){if(t.length===0){t.push({...n});continue}let e=t.at(-1),r=cg(e.htmlStyle||sg(e)),i=cg(n.htmlStyle||sg(n)),a=e.fontStyle&&(e.fontStyle&pm.Underline||e.fontStyle&pm.Strikethrough),o=n.fontStyle&&(n.fontStyle&pm.Underline||n.fontStyle&pm.Strikethrough);!a&&!o&&r===i?e.content+=n.content:t.push({...n})}return t})}var Tg=Bie;function Eg(e,t,n){let r={meta:{},options:n,codeToHast:(t,n)=>bg(e,t,n),codeToTokens:(t,n)=>_g(e,t,n)},i=Tg(bg(e,t,n,r));for(let e of ug(n))i=e.postprocess?.call(r,i,n)||i;return i}async function Dg(e){let t=await hre(e);return{getLastGrammarState:(...e)=>bre(t,...e),codeToTokensBase:(e,n)=>gg(t,e,n),codeToTokensWithThemes:(e,n)=>mh(t,e,n),codeToTokens:(e,n)=>_g(t,e,n),codeToHast:(e,n)=>bg(t,e,n),codeToHtml:(e,n)=>Eg(t,e,n),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}var Og=4294967295;function kg(e){return!e.sticky&&!e.rawOptions?.strategy}function Ag(e,t){return{index:e,captureIndices:t.map(e=>e==null?{start:Og,end:Og,length:0}:{start:e[0],end:e[1],length:e[1]-e[0]})}}var cae=class{patterns;options;regexps;lastSearches;constructor(e,t={}){this.patterns=e,this.options=t;let{forgiving:n=!1,cache:r,regexConstructor:i}=t;if(!i)throw Error("Option `regexConstructor` is not provided");this.regexps=e.map(e=>{if(typeof e!=`string`)return e;let t=r?.get(e);if(t){if(t instanceof RegExp)return t;if(n)return null;throw t}try{let t=i(e);return r?.set(e,t),t}catch(t){if(r?.set(e,t),n)return null;throw t}}),this.lastSearches=this.regexps.map(e=>e&&kg(e)?{strId:0,searchedFrom:0,matchIndex:-1,indices:null}:null)}findNextMatchSync(e,t,n){let r=typeof e==`string`?e:e.content,i=typeof e==`string`?0:e.id||0,a=-1,o=0,s=null;for(let e=0;e<this.regexps.length;e++){let n=this.regexps[e];if(n)try{let c=i?this.lastSearches[e]:null,l,u;if(c&&c.strId===i&&c.searchedFrom<=t&&(c.matchIndex===-1||c.matchIndex>=t))l=c.matchIndex,u=c.indices;else{n.lastIndex=t;let e=n.exec(r);l=e?e.index:-1,u=e?e.indices:null,c&&(c.strId=i,c.searchedFrom=t,c.matchIndex=l,c.indices=u)}if(l===-1)continue;if(l===t)return Ag(e,u);(a===-1||l<o)&&(a=e,o=l,s=u)}catch(e){if(this.options.forgiving)continue;throw e}}return a===-1?null:Ag(a,s)}},lae=0;function uae(e){return{content:e,id:++lae}}function jg(e){if([...e].length!==1)throw Error(`Expected "${e}" to be a single code point`);return e.codePointAt(0)}function dae(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}var Mg=new Set([`alnum`,`alpha`,`ascii`,`blank`,`cntrl`,`digit`,`graph`,`lower`,`print`,`punct`,`space`,`upper`,`word`,`xdigit`]),Ng=String.raw;function Pg(e,t){if(e==null)throw Error(t??`Value expected`);return e}var Fg=Ng`\[\^?`,Ig=`c.? | C(?:-.?)?|${Ng`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${Ng`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${Ng`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${Ng`o\{[^\}]*\}?`}|${Ng`\d{1,3}`}`,Lg=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,Rg=new RegExp(Ng`
\\ (?:
${ab}
${Ig}
| [gk]<[^>]*>?
| [gk]'[^']*'?
| .
@@ -34,20 +34,20 @@ import{A as e,B as t,C as n,D as r,E as i,F as a,H as o,I as s,L as c,M as l,N a
)?
| \*[^\)]*\)?
)?
| (?:${ob.source})+
| ${ib}
| (?:${Lg.source})+
| ${Fg}
| .
`.replace(/\s+/g,``),`gsu`),cb=new RegExp(nb`
`.replace(/\s+/g,``),`gsu`),zg=new RegExp(Ng`
\\ (?:
${ab}
${Ig}
| .
)
| \[:(?:\^?\p{Alpha}+|\^):\]
| ${ib}
| ${Fg}
| &&
| .
`.replace(/\s+/g,``),`gsu`);function lb(e,t={}){let n={flags:``,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}};if(typeof e!=`string`)throw Error(`String expected as pattern`);let r=zb(n.flags),i=[r.extended],a={captureGroup:n.rules.captureGroup,getCurrentModX(){return i.at(-1)},numOpenGroups:0,popModX(){i.pop()},pushModX(e){i.push(e)},replaceCurrentModX(e){i[i.length-1]=e},singleline:n.rules.singleline},o=[],s;for(sb.lastIndex=0;s=sb.exec(e);){let t=ub(a,e,s[0],sb.lastIndex);t.tokens?o.push(...t.tokens):t.token&&o.push(t.token),t.lastIndex!==void 0&&(sb.lastIndex=t.lastIndex)}let c=[],l=0;o.filter(e=>e.type===`GroupOpen`).forEach(e=>{e.kind===`capturing`?e.number=++l:e.raw===`(`&&c.push(e)}),l||c.forEach((e,t)=>{e.kind=`capturing`,e.number=t+1});let u=l||c.length;return{tokens:o.map(e=>e.type===`EscapedNumber`?Vb(e,u):e).flat(),flags:r}}function ub(e,t,n,r){let[i,a]=n;if(n===`[`||n===`[^`){let e=db(t,n,r);return{tokens:e.tokens,lastIndex:e.lastIndex}}if(i===`\\`){if(`AbBGyYzZ`.includes(a))return{token:hb(n,n)};if(/^\\g[<']/.test(n)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(n))throw Error(`Invalid group name "${n}"`);return{token:kb(n)}}if(/^\\k[<']/.test(n)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(n))throw Error(`Invalid group name "${n}"`);return{token:gb(n)}}if(a===`K`)return{token:Cb(`keep`,n)};if(a===`N`||a===`R`)return{token:Sb(`newline`,n,{negate:a===`N`})};if(a===`O`)return{token:Sb(`any`,n)};if(a===`X`)return{token:Sb(`text_segment`,n)};let e=pb(n,{inCharClass:!1});return Array.isArray(e)?{tokens:e}:{token:e}}if(i===`(`){if(a===`*`)return{token:Pb(n)};if(n===`(?{`)throw Error(`Unsupported callout "${n}"`);if(n.startsWith(`(?#`)){if(t[r]!==`)`)throw Error(`Unclosed comment group "(?#"`);return{lastIndex:r+1}}if(/^\(\?[-imx]+[:)]$/.test(n))return{token:Nb(n,e)};if(e.pushModX(e.getCurrentModX()),e.numOpenGroups++,n===`(`&&!e.captureGroup||n===`(?:`)return{token:Eb(`group`,n)};if(n===`(?>`)return{token:Eb(`atomic`,n)};if(n===`(?=`||n===`(?!`||n===`(?<=`||n===`(?<!`)return{token:Eb(n[2]===`<`?`lookbehind`:`lookahead`,n,{negate:n.endsWith(`!`)})};if(n===`(`&&e.captureGroup||n.startsWith(`(?<`)&&n.endsWith(`>`)||n.startsWith(`(?'`)&&n.endsWith(`'`))return{token:Eb(`capturing`,n,{...n!==`(`&&{name:n.slice(3,-1)}})};if(n.startsWith(`(?~`)){if(n===`(?~|`)throw Error(`Unsupported absence function kind "${n}"`);return{token:Eb(`absence_repeater`,n)}}throw Error(n===`(?(`?`Unsupported conditional "${n}"`:`Invalid or unsupported group option "${n}"`)}if(n===`)`){if(e.popModX(),e.numOpenGroups--,e.numOpenGroups<0)throw Error(`Unmatched ")"`);return{token:Tb(n)}}if(e.getCurrentModX()){if(n===`#`){let e=t.indexOf(`
`,r);return{lastIndex:e===-1?t.length:e}}if(/^\s$/.test(n)){let e=/\s+/y;return e.lastIndex=r,{lastIndex:e.exec(t)?e.lastIndex:r}}}return n===`.`?{token:Sb(`dot`,n)}:n===`^`||n===`$`?{token:hb(e.singleline?{"^":nb`\A`,$:nb`\Z`}[n]:n,n)}:n===`|`?{token:mb(n)}:ob.test(n)?{tokens:Hb(n)}:{token:_b($y(n),n)}}function db(e,t,n){let r=[xb(t[1]===`^`,t)],i=1,a;for(cb.lastIndex=n;a=cb.exec(e);){let e=a[0];if(e[0]===`[`&&e[1]!==`:`)i++,r.push(xb(e[1]===`^`,e));else if(e===`]`){if(r.at(-1).type===`CharacterClassOpen`)r.push(_b(93,e));else if(i--,r.push(vb(e)),!i)break}else{let t=fb(e);Array.isArray(t)?r.push(...t):r.push(t)}}return{tokens:r,lastIndex:cb.lastIndex||e.length}}function fb(e){if(e[0]===`\\`)return pb(e,{inCharClass:!0});if(e[0]===`[`){let t=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);if(!t||!tb.has(t.groups.name))throw Error(`Invalid POSIX class "${e}"`);return Sb(`posix`,e,{value:t.groups.name,negate:!!t.groups.negate})}return e===`-`?yb(e):e===`&&`?bb(e):_b($y(e),e)}function pb(e,{inCharClass:t}){let n=e[1];if(n===`c`||n===`C`)return Mb(e);if(`dDhHsSwW`.includes(n))return Ib(e);if(e.startsWith(nb`\o{`))throw Error(`Incomplete, invalid, or unsupported octal code point "${e}"`);if(/^\\[pP]\{/.test(e)){if(e.length===3)throw Error(`Incomplete or invalid Unicode property "${e}"`);return Lb(e)}if(/^\\x[89A-Fa-f]\p{AHex}/u.test(e))try{let t=e.split(/\\x/).slice(1).map(e=>parseInt(e,16)),n=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}).decode(new Uint8Array(t)),r=new TextEncoder;return[...n].map(e=>{let t=[...r.encode(e)].map(e=>`\\x${e.toString(16)}`).join(``);return _b($y(e),t)})}catch{throw Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`)}if(n===`u`||n===`x`)return _b(Bb(e),e);if(jb.has(n))return _b(jb.get(n),e);if(/\d/.test(n))return wb(t,e);if(e===`\\`)throw Error(nb`Incomplete escape "\"`);if(n===`M`)throw Error(`Unsupported meta "${e}"`);if([...e].length===2)return _b(e.codePointAt(1),e);throw Error(`Unexpected escape "${e}"`)}function mb(e){return{type:`Alternator`,raw:e}}function hb(e,t){return{type:`Assertion`,kind:e,raw:t}}function gb(e){return{type:`Backreference`,raw:e}}function _b(e,t){return{type:`Character`,value:e,raw:t}}function vb(e){return{type:`CharacterClassClose`,raw:e}}function yb(e){return{type:`CharacterClassHyphen`,raw:e}}function bb(e){return{type:`CharacterClassIntersector`,raw:e}}function xb(e,t){return{type:`CharacterClassOpen`,negate:e,raw:t}}function Sb(e,t,n={}){return{type:`CharacterSet`,kind:e,...n,raw:t}}function Cb(e,t,n={}){return e===`keep`?{type:`Directive`,kind:e,raw:t}:{type:`Directive`,kind:e,flags:rb(n.flags),raw:t}}function wb(e,t){return{type:`EscapedNumber`,inCharClass:e,raw:t}}function Tb(e){return{type:`GroupClose`,raw:e}}function Eb(e,t,n={}){return{type:`GroupOpen`,kind:e,...n,raw:t}}function Db(e,t,n,r){return{type:`NamedCallout`,kind:e,tag:t,arguments:n,raw:r}}function Ob(e,t,n,r){return{type:`Quantifier`,kind:e,min:t,max:n,raw:r}}function kb(e){return{type:`Subroutine`,raw:e}}var Ab=new Set([`COUNT`,`CMP`,`ERROR`,`FAIL`,`MAX`,`MISMATCH`,`SKIP`,`TOTAL_COUNT`]),jb=new Map([[`a`,7],[`b`,8],[`e`,27],[`f`,12],[`n`,10],[`r`,13],[`t`,9],[`v`,11]]);function Mb(e){let t=e[1]===`c`?e[2]:e[3];if(!t||!/[A-Za-z]/.test(t))throw Error(`Unsupported control character "${e}"`);return _b($y(t.toUpperCase())-64,e)}function Nb(e,t){let{on:n,off:r}=/^\(\?(?<on>[imx]*)(?:-(?<off>[-imx]*))?/.exec(e).groups;r??=``;let i=(t.getCurrentModX()||n.includes(`x`))&&!r.includes(`x`),a=Rb(n),o=Rb(r),s={};if(a&&(s.enable=a),o&&(s.disable=o),e.endsWith(`)`))return t.replaceCurrentModX(i),Cb(`flags`,e,{flags:s});if(e.endsWith(`:`))return t.pushModX(i),t.numOpenGroups++,Eb(`group`,e,{...(a||o)&&{flags:s}});throw Error(`Unexpected flag modifier "${e}"`)}function Pb(e){let t=/\(\*(?<name>[A-Za-z_]\w*)?(?:\[(?<tag>(?:[A-Za-z_]\w*)?)\])?(?:\{(?<args>[^}]*)\})?\)/.exec(e);if(!t)throw Error(`Incomplete or invalid named callout "${e}"`);let{name:n,tag:r,args:i}=t.groups;if(!n)throw Error(`Invalid named callout "${e}"`);if(r===``)throw Error(`Named callout tag with empty value not allowed "${e}"`);let a=i?i.split(`,`).filter(e=>e!==``).map(e=>/^[+-]?\d+$/.test(e)?+e:e):[],[o,s,c]=a,l=Ab.has(n)?n.toLowerCase():`custom`;switch(l){case`fail`:case`mismatch`:case`skip`:if(a.length>0)throw Error(`Named callout arguments not allowed "${a}"`);break;case`error`:if(a.length>1)throw Error(`Named callout allows only one argument "${a}"`);if(typeof o==`string`)throw Error(`Named callout argument must be a number "${o}"`);break;case`max`:if(!a.length||a.length>2)throw Error(`Named callout must have one or two arguments "${a}"`);if(typeof o==`string`&&!/^[A-Za-z_]\w*$/.test(o))throw Error(`Named callout argument one must be a tag or number "${o}"`);if(a.length===2&&(typeof s==`number`||!/^[<>X]$/.test(s)))throw Error(`Named callout optional argument two must be '<', '>', or 'X' "${s}"`);break;case`count`:case`total_count`:if(a.length>1)throw Error(`Named callout allows only one argument "${a}"`) Line truncated
`.replace(/\s+/g,``),`gsu`);function fae(e,t={}){let n={flags:``,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}};if(typeof e!=`string`)throw Error(`String expected as pattern`);let r=d_(n.flags),i=[r.extended],a={captureGroup:n.rules.captureGroup,getCurrentModX(){return i.at(-1)},numOpenGroups:0,popModX(){i.pop()},pushModX(e){i.push(e)},replaceCurrentModX(e){i[i.length-1]=e},singleline:n.rules.singleline},o=[],s;for(Rg.lastIndex=0;s=Rg.exec(e);){let t=pae(a,e,s[0],Rg.lastIndex);t.tokens?o.push(...t.tokens):t.token&&o.push(t.token),t.lastIndex!==void 0&&(Rg.lastIndex=t.lastIndex)}let c=[],l=0;o.filter(e=>e.type===`GroupOpen`).forEach(e=>{e.kind===`capturing`?e.number=++l:e.raw===`(`&&c.push(e)}),l||c.forEach((e,t)=>{e.kind=`capturing`,e.number=t+1});let u=l||c.length;return{tokens:o.map(e=>e.type===`EscapedNumber`?p_(e,u):e).flat(),flags:r}}function pae(e,t,n,r){let[i,a]=n;if(n===`[`||n===`[^`){let e=mae(t,n,r);return{tokens:e.tokens,lastIndex:e.lastIndex}}if(i===`\\`){if(`AbBGyYzZ`.includes(a))return{token:Vg(n,n)};if(/^\\g[<']/.test(n)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(n))throw Error(`Invalid group name "${n}"`);return{token:t_(n)}}if(/^\\k[<']/.test(n)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(n))throw Error(`Invalid group name "${n}"`);return{token:Hg(n)}}if(a===`K`)return{token:Yg(`keep`,n)};if(a===`N`||a===`R`)return{token:Jg(`newline`,n,{negate:a===`N`})};if(a===`O`)return{token:Jg(`any`,n)};if(a===`X`)return{token:Jg(`text_segment`,n)};let e=Bg(n,{inCharClass:!1});return Array.isArray(e)?{tokens:e}:{token:e}}if(i===`(`){if(a===`*`)return{token:o_(n)};if(n===`(?{`)throw Error(`Unsupported callout "${n}"`);if(n.startsWith(`(?#`)){if(t[r]!==`)`)throw Error(`Unclosed comment group "(?#"`);return{lastIndex:r+1}}if(/^\(\?[-imx]+[:)]$/.test(n))return{token:a_(n,e)};if(e.pushModX(e.getCurrentModX()),e.numOpenGroups++,n===`(`&&!e.captureGroup||n===`(?:`)return{token:Qg(`group`,n)};if(n===`(?>`)return{token:Qg(`atomic`,n)};if(n===`(?=`||n===`(?!`||n===`(?<=`||n===`(?<!`)return{token:Qg(n[2]===`<`?`lookbehind`:`lookahead`,n,{negate:n.endsWith(`!`)})};if(n===`(`&&e.captureGroup||n.startsWith(`(?<`)&&n.endsWith(`>`)||n.startsWith(`(?'`)&&n.endsWith(`'`))return{token:Qg(`capturing`,n,{...n!==`(`&&{name:n.slice(3,-1)}})};if(n.startsWith(`(?~`)){if(n===`(?~|`)throw Error(`Unsupported absence function kind "${n}"`);return{token:Qg(`absence_repeater`,n)}}throw Error(n===`(?(`?`Unsupported conditional "${n}"`:`Invalid or unsupported group option "${n}"`)}if(n===`)`){if(e.popModX(),e.numOpenGroups--,e.numOpenGroups<0)throw Error(`Unmatched ")"`);return{token:Zg(n)}}if(e.getCurrentModX()){if(n===`#`){let e=t.indexOf(`
`,r);return{lastIndex:e===-1?t.length:e}}if(/^\s$/.test(n)){let e=/\s+/y;return e.lastIndex=r,{lastIndex:e.exec(t)?e.lastIndex:r}}}return n===`.`?{token:Jg(`dot`,n)}:n===`^`||n===`$`?{token:Vg(e.singleline?{"^":Ng`\A`,$:Ng`\Z`}[n]:n,n)}:n===`|`?{token:gae(n)}:Lg.test(n)?{tokens:m_(n)}:{token:Ug(jg(n),n)}}function mae(e,t,n){let r=[qg(t[1]===`^`,t)],i=1,a;for(zg.lastIndex=n;a=zg.exec(e);){let e=a[0];if(e[0]===`[`&&e[1]!==`:`)i++,r.push(qg(e[1]===`^`,e));else if(e===`]`){if(r.at(-1).type===`CharacterClassOpen`)r.push(Ug(93,e));else if(i--,r.push(Wg(e)),!i)break}else{let t=hae(e);Array.isArray(t)?r.push(...t):r.push(t)}}return{tokens:r,lastIndex:zg.lastIndex||e.length}}function hae(e){if(e[0]===`\\`)return Bg(e,{inCharClass:!0});if(e[0]===`[`){let t=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);if(!t||!Mg.has(t.groups.name))throw Error(`Invalid POSIX class "${e}"`);return Jg(`posix`,e,{value:t.groups.name,negate:!!t.groups.negate})}return e===`-`?Gg(e):e===`&&`?Kg(e):Ug(jg(e),e)}function Bg(e,{inCharClass:t}){let n=e[1];if(n===`c`||n===`C`)return i_(e);if(`dDhHsSwW`.includes(n))return c_(e);if(e.startsWith(Ng`\o{`))throw Error(`Incomplete, invalid, or unsupported octal code point "${e}"`);if(/^\\[pP]\{/.test(e)){if(e.length===3)throw Error(`Incomplete or invalid Unicode property "${e}"`);return l_(e)}if(/^\\x[89A-Fa-f]\p{AHex}/u.test(e))try{let t=e.split(/\\x/).slice(1).map(e=>parseInt(e,16)),n=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}).decode(new Uint8Array(t)),r=new TextEncoder;return[...n].map(e=>{let t=[...r.encode(e)].map(e=>`\\x${e.toString(16)}`).join(``);return Ug(jg(e),t)})}catch{throw Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`)}if(n===`u`||n===`x`)return Ug(f_(e),e);if(r_.has(n))return Ug(r_.get(n),e);if(/\d/.test(n))return Xg(t,e);if(e===`\\`)throw Error(Ng`Incomplete escape "\"`);if(n===`M`)throw Error(`Unsupported meta "${e}"`);if([...e].length===2)return Ug(e.codePointAt(1),e);throw Error(`Unexpected escape "${e}"`)}function gae(e){return{type:`Alternator`,raw:e}}function Vg(e,t){return{type:`Assertion`,kind:e,raw:t}}function Hg(e){return{type:`Backreference`,raw:e}}function Ug(e,t){return{type:`Character`,value:e,raw:t}}function Wg(e){return{type:`CharacterClassClose`,raw:e}}function Gg(e){return{type:`CharacterClassHyphen`,raw:e}}function Kg(e){return{type:`CharacterClassIntersector`,raw:e}}function qg(e,t){return{type:`CharacterClassOpen`,negate:e,raw:t}}function Jg(e,t,n={}){return{type:`CharacterSet`,kind:e,...n,raw:t}}function Yg(e,t,n={}){return e===`keep`?{type:`Directive`,kind:e,raw:t}:{type:`Directive`,kind:e,flags:Pg(n.flags),raw:t}}function Xg(e,t){return{type:`EscapedNumber`,inCharClass:e,raw:t}}function Zg(e){return{type:`GroupClose`,raw:e}}function Qg(e,t,n={}){return{type:`GroupOpen`,kind:e,...n,raw:t}}function $g(e,t,n,r){return{type:`NamedCallout`,kind:e,tag:t,arguments:n,raw:r}}function e_(e,t,n,r){return{type:`Quantifier`,kind:e,min:t,max:n,raw:r}}function t_(e){return{type:`Subroutine`,raw:e}}var n_=new Set([`COUNT`,`CMP`,`ERROR`,`FAIL`,`MAX`,`MISMATCH`,`SKIP`,`TOTAL_COUNT`]),r_=new Map([[`a`,7],[`b`,8],[`e`,27],[`f`,12],[`n`,10],[`r`,13],[`t`,9],[`v`,11]]);function i_(e){let t=e[1]===`c`?e[2]:e[3];if(!t||!/[A-Za-z]/.test(t))throw Error(`Unsupported control character "${e}"`);return Ug(jg(t.toUpperCase())-64,e)}function a_(e,t){let{on:n,off:r}=/^\(\?(?<on>[imx]*)(?:-(?<off>[-imx]*))?/.exec(e).groups;r??=``;let i=(t.getCurrentModX()||n.includes(`x`))&&!r.includes(`x`),a=u_(n),o=u_(r),s={};if(a&&(s.enable=a),o&&(s.disable=o),e.endsWith(`)`))return t.replaceCurrentModX(i),Yg(`flags`,e,{flags:s});if(e.endsWith(`:`))return t.pushModX(i),t.numOpenGroups++,Qg(`group`,e,{...(a||o)&&{flags:s}});throw Error(`Unexpected flag modifier "${e}"`)}function o_(e){let t=/\(\*(?<name>[A-Za-z_]\w*)?(?:\[(?<tag>(?:[A-Za-z_]\w*)?)\])?(?:\{(?<args>[^}]*)\})?\)/.exec(e);if(!t)throw Error(`Incomplete or invalid named callout "${e}"`);let{name:n,tag:r,args:i}=t.groups;if(!n)throw Error(`Invalid named callout "${e}"`);if(r===``)throw Error(`Named callout tag with empty value not allowed "${e}"`);let a=i?i.split(`,`).filter(e=>e!==``).map(e=>/^[+-]?\d+$/.test(e)?+e:e):[],[o,s,c]=a,l=n_.has(n)?n.toLowerCase():`custom`;switch(l){case`fail`:case`mismatch`:case`skip`:if(a.length>0)throw Error(`Named callout arguments not allowed "${a}"`);break;case`error`:if(a.length>1)throw Error(`Named callout allows only one argument "${a}"`);if(typeof o==`string`)throw Error(`Named callout argument must be a number "${o}"`);break;case`max`:if(!a.length||a.length>2)throw Error(`Named callout must have one or two arguments "${a}"`);if(typeof o==`string`&&!/^[A-Za-z_]\w*$/.test(o))throw Error(`Named callout argument one must be a tag or number "${o}"`);if(a.length===2&&(typeof s==`number`||!/^[<>X]$/.test(s)))throw Error(`Named callout optional argument two must be '<', '>', or 'X' "${s}"`);break;case`count`:case`total_count`:if(a.length>1)throw Error(`Named callout allows only one argument "${Line truncated
\\(?: \d+
| c[A-Za-z]
| [gk]<[^>]+>
@@ -60,9 +60,9 @@ import{A as e,B as t,C as n,D as r,E as i,F as a,H as o,I as s,L as c,M as l,N a
| [A-Za-z\-]+:
| \(DEFINE\)
))?
| (?<qBase>${Wx})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
| (?<qBase>${tv})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
| \\?.
`.replace(/\s+/g,``),`gsu`);function Kx(e){if(!RegExp(`${Wx}\\+`).test(e))return{pattern:e};let t=[],n=null,r=null,i=``,a=0,o;for(Gx.lastIndex=0;o=Gx.exec(e);){let{0:s,index:c,groups:{qBase:l,qMod:u,invalidQ:d}}=o;if(s===`[`)a||(r=c),a++;else if(s===`]`)a?a--:r=null;else if(!a){if(u===`+`&&i&&!i.startsWith(`(`)){if(d)throw Error(`Invalid quantifier "${s}"`);let t=-1;if(/^\{\d+\}$/.test(l))e=Fx(e,c+l.length,u,``);else{if(i===`)`||i===`]`){let t=i===`)`?n:r;if(t===null)throw Error(`Invalid unmatched "${i}"`);e=`${e.slice(0,t)}(?>${e.slice(t,c)}${l})${e.slice(c+s.length)}`}else e=`${e.slice(0,c-i.length)}(?>${i}${l})${e.slice(c+s.length)}`;t+=4}Gx.lastIndex+=t}else s[0]===`(`?t.push(c):s===`)`&&(n=t.length?t.pop():null)}i=s}return{pattern:e}}var qx=String.raw,Jx=qx`\(\?R=(?<rDepth>[^\)]+)\)|${qx`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`}`,Yx=qx`\(\?<(?![=!])(?<captureName>[^>]+)>`,Xx=qx`${Yx}|(?<unnamed>\()(?!\?)`,Zx=new RegExp(qx`${Yx}|${Jx}|\(\?|\\?.`,`gsu`),Qx=`Cannot use multiple overlapping recursions`;function $x(e,t){let{hiddenCaptures:n,mode:r}={hiddenCaptures:[],mode:`plugin`,...t},i=t?.captureTransfers??new Map;if(!new RegExp(Jx,`su`).test(e))return{pattern:e,captureTransfers:i,hiddenCaptures:n};if(r===`plugin`&&Bx(e,qx`\(\?\(DEFINE\)`,Ix.DEFAULT))throw Error(`DEFINE groups cannot be used with recursion`);let a=[],o=Bx(e,qx`\\[1-9]`,Ix.DEFAULT),s=new Map,c=[],l=!1,u=0,d=0,f;for(Zx.lastIndex=0;f=Zx.exec(e);){let{0:t,groups:{captureName:p,rDepth:m,gRNameOrNum:h,gRDepth:g}}=f;if(t===`[`)u++;else if(u)t===`]`&&u--;else{if(m){if(eS(m),l)throw Error(Qx);if(o)throw Error(`${r===`external`?`Backrefs`:`Numbered backrefs`} cannot be used with global recursion`);let t=e.slice(0,f.index),s=e.slice(Zx.lastIndex);if(Bx(s,Jx,Ix.DEFAULT))throw Error(Qx);let c=m-1;e=tS(t,s,c,!1,n,a,d),i=iS(i,t,c,a.length,0,d);break}if(h){eS(g);let u=!1;for(let e of c)if(e.name===h||e.num===+h){if(u=!0,e.hasRecursedWithin)throw Error(Qx);break}if(!u)throw Error(qx`Recursive \g cannot be used outside the referenced group "${r===`external`?h:qx`\g<${h}&R=${g}>`}"`);let p=s.get(h),m=Vx(e,p);if(o&&Bx(m,qx`${Yx}|\((?!\?)`,Ix.DEFAULT))throw Error(`${r===`external`?`Backrefs`:`Numbered backrefs`} cannot be used with recursion of capturing groups`);let _=e.slice(p,f.index),v=m.slice(_.length+t.length),y=a.length,b=g-1,x=tS(_,v,b,!0,n,a,d);i=iS(i,_,b,a.length-y,y,d),e=`${e.slice(0,p)}${x}${e.slice(p+m.length)}`,Zx.lastIndex+=x.length-t.length-_.length-v.length,c.forEach(e=>e.hasRecursedWithin=!0),l=!0}else if(p)d++,s.set(String(d),Zx.lastIndex),s.set(p,Zx.lastIndex),c.push({num:d,name:p});else if(t[0]===`(`){let e=t===`(`;e&&(d++,s.set(String(d),Zx.lastIndex)),c.push(e?{num:d}:{})}else t===`)`&&c.pop()}}return n.push(...a),{pattern:e,captureTransfers:i,hiddenCaptures:n}}function eS(e){let t=`Max depth must be integer between 2 and 100; used ${e}`;if(!/^[1-9]\d*$/.test(e)||(e=+e,e<2||e>100))throw Error(t)}function tS(e,t,n,r,i,a,o){let s=new Set;r&&Rx(e+t,Yx,({groups:{captureName:e}})=>{s.add(e)},Ix.DEFAULT);let c=[n,r?s:null,i,a,o];return`${e}${nS(`(?:${e}`,`forward`,...c)}(?:)${nS(`${t})`,`backward`,...c)}${t}`}function nS(e,t,n,r,i,a,o){let s=e=>t===`forward`?e+2:n-e+2-1,c=``;for(let t=0;t<n;t++){let n=s(t);c+=Lx(e,qx`${Xx}|\\k<(?<backref>[^>]+)>`,({0:e,groups:{captureName:t,unnamed:s,backref:c}})=>{if(c&&r&&!r.has(c))return e;let l=`_$${n}`;if(s||t){let n=o+a.length+1;return a.push(n),rS(i,n),s?e:`(?<${t}${l}>`}return qx`\k<${c}${l}>`},Ix.DEFAULT)}return c}function rS(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function iS(e,t,n,r,i,a){if(e.size&&r){let o=0;Rx(t,Xx,()=>o++,Ix.DEFAULT);let s=a-o+i,c=new Map;return e.forEach((e,t)=>{let i=(r-o*n)/n,a=o*n,l=t>s+o?t+r:t,u=[];for(let t of e)if(t<=s)u.push(t);else if(t>s+o+i)u.push(t+r);else if(t<=s+o)for(let e=0;e<=n;e++)u.push(t+o*e);else for(let e=0;e<=n;e++)u.push(t+a+i*e);c.set(l,u)}),c}return e}var aS=String.fromCodePoint,oS=String.raw,sS={},cS=globalThis.RegExp;sS.flagGroups=(()=>{try{new cS(`(?i:)`)}catch{return!1}return!0})(),sS.unicodeSets=(()=>{try{new cS(`[[]]`,`v`)}catch{return!1}return!0})(),sS.bugFlagVLiteralHyphenIsRange=sS.unicodeSets?(()=>{try{new cS(oS`[\d\-a]`,`v`)}catch{return!0}return!1})():!1,sS.bugNestedClassIgnoresNegation=sS.unicodeSets&&new cS(`[[^a]]`,`v`).test(`a`);function lS(e,{enable:t,disable:n}){return{dotAll:!n?.dotAll&&!!(t?.dotAll||e.dotAll),ignoreCase:!n?.ignoreCase&&!!(t?.ignoreCase||e.ignoreCase)}}function uS(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}function dS(e,t){return pS[e]>=pS[t]}function fS(e,t){if(e==null)throw Error(t??`Value expected`);return e}var pS={ES2025:2025,ES2024:2024,ES2018:2018},mS={auto:`auto`,ES2025:`ES2025`,ES2024:`ES2024`,ES2018:`ES2018`};function hS(e={}){if({}.toString.call(e)!==`[object Object]`)throw Error(`Unexpected options`);if(e.target!==void 0&&!mS[e.target])throw Error(`Unexpected target "${e.target}"`);let t={accuracy:`default`,avoidSubclass:!1,flags:``,global:!1,hasIndices:!1,lazyCompileLength:1/0,target:`aLine truncated
`.replace(/\s+/g,``),`gsu`);function Mae(e){if(!RegExp(`${tv}\\+`).test(e))return{pattern:e};let t=[],n=null,r=null,i=``,a=0,o;for(nv.lastIndex=0;o=nv.exec(e);){let{0:s,index:c,groups:{qBase:l,qMod:u,invalidQ:d}}=o;if(s===`[`)a||(r=c),a++;else if(s===`]`)a?a--:r=null;else if(!a){if(u===`+`&&i&&!i.startsWith(`(`)){if(d)throw Error(`Invalid quantifier "${s}"`);let t=-1;if(/^\{\d+\}$/.test(l))e=Oae(e,c+l.length,u,``);else{if(i===`)`||i===`]`){let t=i===`)`?n:r;if(t===null)throw Error(`Invalid unmatched "${i}"`);e=`${e.slice(0,t)}(?>${e.slice(t,c)}${l})${e.slice(c+s.length)}`}else e=`${e.slice(0,c-i.length)}(?>${i}${l})${e.slice(c+s.length)}`;t+=4}nv.lastIndex+=t}else s[0]===`(`?t.push(c):s===`)`&&(n=t.length?t.pop():null)}i=s}return{pattern:e}}var rv=String.raw,iv=rv`\(\?R=(?<rDepth>[^\)]+)\)|${rv`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`}`,av=rv`\(\?<(?![=!])(?<captureName>[^>]+)>`,ov=rv`${av}|(?<unnamed>\()(?!\?)`,sv=new RegExp(rv`${av}|${iv}|\(\?|\\?.`,`gsu`),cv=`Cannot use multiple overlapping recursions`;function Nae(e,t){let{hiddenCaptures:n,mode:r}={hiddenCaptures:[],mode:`plugin`,...t},i=t?.captureTransfers??new Map;if(!new RegExp(iv,`su`).test(e))return{pattern:e,captureTransfers:i,hiddenCaptures:n};if(r===`plugin`&&$_(e,rv`\(\?\(DEFINE\)`,X_.DEFAULT))throw Error(`DEFINE groups cannot be used with recursion`);let a=[],o=$_(e,rv`\\[1-9]`,X_.DEFAULT),s=new Map,c=[],l=!1,u=0,d=0,f;for(sv.lastIndex=0;f=sv.exec(e);){let{0:t,groups:{captureName:p,rDepth:m,gRNameOrNum:h,gRDepth:g}}=f;if(t===`[`)u++;else if(u)t===`]`&&u--;else{if(m){if(lv(m),l)throw Error(cv);if(o)throw Error(`${r===`external`?`Backrefs`:`Numbered backrefs`} cannot be used with global recursion`);let t=e.slice(0,f.index),s=e.slice(sv.lastIndex);if($_(s,iv,X_.DEFAULT))throw Error(cv);let c=m-1;e=uv(t,s,c,!1,n,a,d),i=pv(i,t,c,a.length,0,d);break}if(h){lv(g);let u=!1;for(let e of c)if(e.name===h||e.num===+h){if(u=!0,e.hasRecursedWithin)throw Error(cv);break}if(!u)throw Error(rv`Recursive \g cannot be used outside the referenced group "${r===`external`?h:rv`\g<${h}&R=${g}>`}"`);let p=s.get(h),m=Aae(e,p);if(o&&$_(m,rv`${av}|\((?!\?)`,X_.DEFAULT))throw Error(`${r===`external`?`Backrefs`:`Numbered backrefs`} cannot be used with recursion of capturing groups`);let _=e.slice(p,f.index),v=m.slice(_.length+t.length),y=a.length,b=g-1,x=uv(_,v,b,!0,n,a,d);i=pv(i,_,b,a.length-y,y,d),e=`${e.slice(0,p)}${x}${e.slice(p+m.length)}`,sv.lastIndex+=x.length-t.length-_.length-v.length,c.forEach(e=>e.hasRecursedWithin=!0),l=!0}else if(p)d++,s.set(String(d),sv.lastIndex),s.set(p,sv.lastIndex),c.push({num:d,name:p});else if(t[0]===`(`){let e=t===`(`;e&&(d++,s.set(String(d),sv.lastIndex)),c.push(e?{num:d}:{})}else t===`)`&&c.pop()}}return n.push(...a),{pattern:e,captureTransfers:i,hiddenCaptures:n}}function lv(e){let t=`Max depth must be integer between 2 and 100; used ${e}`;if(!/^[1-9]\d*$/.test(e)||(e=+e,e<2||e>100))throw Error(t)}function uv(e,t,n,r,i,a,o){let s=new Set;r&&Q_(e+t,av,({groups:{captureName:e}})=>{s.add(e)},X_.DEFAULT);let c=[n,r?s:null,i,a,o];return`${e}${dv(`(?:${e}`,`forward`,...c)}(?:)${dv(`${t})`,`backward`,...c)}${t}`}function dv(e,t,n,r,i,a,o){let s=e=>t===`forward`?e+2:n-e+2-1,c=``;for(let t=0;t<n;t++){let n=s(t);c+=Z_(e,rv`${ov}|\\k<(?<backref>[^>]+)>`,({0:e,groups:{captureName:t,unnamed:s,backref:c}})=>{if(c&&r&&!r.has(c))return e;let l=`_$${n}`;if(s||t){let n=o+a.length+1;return a.push(n),fv(i,n),s?e:`(?<${t}${l}>`}return rv`\k<${c}${l}>`},X_.DEFAULT)}return c}function fv(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function pv(e,t,n,r,i,a){if(e.size&&r){let o=0;Q_(t,ov,()=>o++,X_.DEFAULT);let s=a-o+i,c=new Map;return e.forEach((e,t)=>{let i=(r-o*n)/n,a=o*n,l=t>s+o?t+r:t,u=[];for(let t of e)if(t<=s)u.push(t);else if(t>s+o+i)u.push(t+r);else if(t<=s+o)for(let e=0;e<=n;e++)u.push(t+o*e);else for(let e=0;e<=n;e++)u.push(t+a+i*e);c.set(l,u)}),c}return e}var mv=String.fromCodePoint,hv=String.raw,gv={},_v=globalThis.RegExp;gv.flagGroups=(()=>{try{new _v(`(?i:)`)}catch{return!1}return!0})(),gv.unicodeSets=(()=>{try{new _v(`[[]]`,`v`)}catch{return!1}return!0})(),gv.bugFlagVLiteralHyphenIsRange=gv.unicodeSets?(()=>{try{new _v(hv`[\d\-a]`,`v`)}catch{return!0}return!1})():!1,gv.bugNestedClassIgnoresNegation=gv.unicodeSets&&new _v(`[[^a]]`,`v`).test(`a`);function vv(e,{enable:t,disable:n}){return{dotAll:!n?.dotAll&&!!(t?.dotAll||e.dotAll),ignoreCase:!n?.ignoreCase&&!!(t?.ignoreCase||e.ignoreCase)}}function yv(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}function bv(e,t){return Sv[e]>=Sv[t]}function xv(e,t){if(e==null)throw Error(t??`Value expected`);return e}var Sv={ES2025:2025,ES2024:2024,ES2018:2018},Cv={auto:`auto`,ES2025:`ES2025`,ES2024:`ES2024`,ES2018:`ES2018`};function wv(e={}){if({}.toString.call(e)!==`[object Object]`)throw Error(`Unexpected options`);if(e.target!==void 0&&!Cv[e.target])throw Error(`Unexpected target "${e.target}"`);let t={accuracy:`default`,avoidSubclass:!1,flags:``,global:!1,hasIndices:!1,lazyCompileLength:1/0,targe Line truncated
Cc Control cntrl
Cf Format
Cn Unassigned
@@ -152,89 +152,347 @@ Uppercase Upper
Variation_Selector VS
White_Space space
XID_Continue XIDC
XID_Start XIDS`.split(/\s/).map(e=>[Dx(e),e])),xS=new Map([[`s`,aS(383)],[aS(383),`s`]]),SS=new Map([[aS(223),aS(7838)],[aS(107),aS(8490)],[aS(229),aS(8491)],[aS(969),aS(8486)]]),CS=new Map([ES(453),ES(456),ES(459),ES(498),...DS(8072,8079),...DS(8088,8095),...DS(8104,8111),ES(8124),ES(8140),ES(8188)]),wS=new Map([[`alnum`,oS`[\p{Alpha}\p{Nd}]`],[`alpha`,oS`\p{Alpha}`],[`ascii`,oS`\p{ASCII}`],[`blank`,oS`[\p{Zs}\t]`],[`cntrl`,oS`\p{Cc}`],[`digit`,oS`\p{Nd}`],[`graph`,oS`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],[`lower`,oS`\p{Lower}`],[`print`,oS`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],[`punct`,oS`[\p{P}\p{S}]`],[`space`,oS`\p{space}`],[`upper`,oS`\p{Upper}`],[`word`,oS`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],[`xdigit`,oS`\p{AHex}`]]);function TS(e,t){let n=[];for(let r=e;r<=t;r++)n.push(r);return n}function ES(e){let t=aS(e);return[t.toLowerCase(),t]}function DS(e,t){return TS(e,t).map(e=>ES(e))}var OS=new Set([`Lower`,`Lowercase`,`Upper`,`Uppercase`,`Ll`,`Lowercase_Letter`,`Lt`,`Titlecase_Letter`,`Lu`,`Uppercase_Letter`]);function kS(e,t){let n={accuracy:`default`,asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:`ES2025`,...t};NS(e);let r={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:dS(n.bestEffortTarget,`ES2024`),passedLookbehind:!1,strategy:null,subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:e.flags.digitIsAscii,spaceIsAscii:e.flags.spaceIsAscii,wordIsAscii:e.flags.wordIsAscii};Ax(e,AS,r);let i={dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},a={currentFlags:i,prevFlags:null,globalFlags:i,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:r.subroutineRefMap};return Ax(e,jS,a),Ax(e,MS,{groupsByName:a.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:a.reffedNodesByReferencer}),e._originMap=a.groupOriginByCopy,e._strategy=r.strategy,e}var AS={AbsenceFunction({node:e,parent:t,replaceWith:n}){let{body:r,kind:i}=e;if(i===`repeater`){let e=fx();e.body[0].body.push(px({negate:!0,body:r}),yx(`Any`));let i=fx();i.body[0].body.push(gx(`greedy`,0,1/0,e)),n(QS(i,t),{traverse:!0})}else throw Error(`Unsupported absence function "(?~|"`)},Alternative:{enter({node:e,parent:t,key:n},{flagDirectivesByAlt:r}){let i=e.body.filter(e=>e.kind===`flags`);for(let e=n+1;e<t.body.length;e++){let n=t.body[e];uS(r,n,[]).push(...i)}},exit({node:e},{flagDirectivesByAlt:t}){if(t.get(e)?.length){let n=BS(t.get(e));if(n){let t=fx({flags:n});t.body[0].body=e.body,e.body=[QS(t,e)]}}}},Assertion({node:e,parent:t,key:n,container:r,root:i,remove:a,replaceWith:o},s){let{kind:c,negate:l}=e,{asciiWordBoundaries:u,avoidSubclass:d,supportedGNodes:f,wordIsAscii:p}=s;if(c===`text_segment_boundary`)throw Error(`Unsupported text segment boundary "\\${l?`Y`:`y`}"`);if(c===`line_end`)o(QS(px({body:[nx({body:[rx(`string_end`)]}),nx({body:[ox(10)]})]}),t));else if(c===`line_start`)o(QS(YS(oS`(?<=\A|\n(?!\z))`,{skipLookbehindValidation:!0}),t));else if(c===`search_start`){if(f.has(e))i.flags.sticky=!0,a();else{let e=r[n-1];if(e&&KS(e))o(QS(px({negate:!0}),t));else if(d)throw Error(oS`Uses "\G" in a way that requires a subclass`);else o(ZS(rx(`string_start`),t)),s.strategy=`clip_search`}}else if(c!==`string_end`&&c!==`string_start`){if(c===`string_end_newline`)o(QS(YS(oS`(?=\n?\z)`),t));else if(c===`word_boundary`){if(!p&&!u){let e=`(?:(?<=${vS})(?!${vS})|(?<!${vS})(?=${vS}))`,n=`(?:(?<=${vS})(?=${vS})|(?<!${vS})(?!${vS}))`;o(QS(YS(l?n:e),t))}}else throw Error(`Unexpected assertion kind "${c}"`)}},Backreference({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n==`string`&&!JS(n)&&(n=zS(n,t),e.ref=n)},CapturingGroup({node:e},{jsGroupNameMap:t,subroutineRefMap:n}){let{name:r}=e;r&&!JS(r)&&(r=zS(r,t),e.name=r),n.set(e.number,e),r&&n.set(r,e)},CharacterClassRange({node:e,parent:t,replaceWith:n}){t.kind===`intersection`&&n(QS(sx({body:[e]}),t),{traverse:!0})},CharacterSet({node:e,parent:t,replaceWith:n},{accuracy:r,minTargetEs2024:i,digitIsAscii:a,spaceIsAscii:o,wordIsAscii:s}){let{kind:c,negate:l,value:u}=e;if(a&&(c===`digit`||u===`digit`))n(ZS(lx(`digit`,{negate:l}),t));else if(o&&(c===`space`||u===`space`))n(QS(XS(YS(gS),l),t));else if(s&&(c===`word`||u===`word`))n(ZS(lx(`word`,{negate:l}),t));else if(c===`any`)n(ZS(yx(`Any`),t));else if(c===`digit`)n(ZS(yx(`Nd`,{negate:l}),t));else if(c!==`dot`){if(c===`text_segment`){if(r===`strict`)throw Error(oS`Use of "\X" requires non-strict accuracy`);let e=`\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?`,a=oS`\p{RI}{2}|${e}(?:\u200D${e})*`;n(QS(YS(oS`(?>\r\n|${i?oS`\p{RGI_Emoji}`:a}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),t))}else if(c===`hex`)n(ZS(yx(`AHex`,{negate:l}),t));else if(c===`newline`)n(QS(YS(l?`[^
XID_Start XIDS`.split(/\s/).map(e=>[W_(e),e])),Av=new Map([[`s`,mv(383)],[mv(383),`s`]]),jv=new Map([[mv(223),mv(7838)],[mv(107),mv(8490)],[mv(229),mv(8491)],[mv(969),mv(8486)]]),Mv=new Map([Fv(453),Fv(456),Fv(459),Fv(498),...Iv(8072,8079),...Iv(8088,8095),...Iv(8104,8111),Fv(8124),Fv(8140),Fv(8188)]),Nv=new Map([[`alnum`,hv`[\p{Alpha}\p{Nd}]`],[`alpha`,hv`\p{Alpha}`],[`ascii`,hv`\p{ASCII}`],[`blank`,hv`[\p{Zs}\t]`],[`cntrl`,hv`\p{Cc}`],[`digit`,hv`\p{Nd}`],[`graph`,hv`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],[`lower`,hv`\p{Lower}`],[`print`,hv`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],[`punct`,hv`[\p{P}\p{S}]`],[`space`,hv`\p{space}`],[`upper`,hv`\p{Upper}`],[`word`,hv`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],[`xdigit`,hv`\p{AHex}`]]);function Pv(e,t){let n=[];for(let r=e;r<=t;r++)n.push(r);return n}function Fv(e){let t=mv(e);return[t.toLowerCase(),t]}function Iv(e,t){return Pv(e,t).map(e=>Fv(e))}var Lv=new Set([`Lower`,`Lowercase`,`Upper`,`Uppercase`,`Ll`,`Lowercase_Letter`,`Lt`,`Titlecase_Letter`,`Lu`,`Uppercase_Letter`]);function Rv(e,t){let n={accuracy:`default`,asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:`ES2025`,...t};Hv(e);let r={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:bv(n.bestEffortTarget,`ES2024`),passedLookbehind:!1,strategy:null,subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:e.flags.digitIsAscii,spaceIsAscii:e.flags.spaceIsAscii,wordIsAscii:e.flags.wordIsAscii};q_(e,zv,r);let i={dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},a={currentFlags:i,prevFlags:null,globalFlags:i,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:r.subroutineRefMap};return q_(e,Bv,a),q_(e,Vv,{groupsByName:a.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:a.reffedNodesByReferencer}),e._originMap=a.groupOriginByCopy,e._strategy=r.strategy,e}var zv={AbsenceFunction({node:e,parent:t,replaceWith:n}){let{body:r,kind:i}=e;if(i===`repeater`){let e=F_();e.body[0].body.push(I_({negate:!0,body:r}),z_(`Any`));let i=F_();i.body[0].body.push(L_(`greedy`,0,1/0,e)),n(sy(i,t),{traverse:!0})}else throw Error(`Unsupported absence function "(?~|"`)},Alternative:{enter({node:e,parent:t,key:n},{flagDirectivesByAlt:r}){let i=e.body.filter(e=>e.kind===`flags`);for(let e=n+1;e<t.body.length;e++){let n=t.body[e];yv(r,n,[]).push(...i)}},exit({node:e},{flagDirectivesByAlt:t}){if(t.get(e)?.length){let n=Yv(t.get(e));if(n){let t=F_({flags:n});t.body[0].body=e.body,e.body=[sy(t,e)]}}}},Assertion({node:e,parent:t,key:n,container:r,root:i,remove:a,replaceWith:o},s){let{kind:c,negate:l}=e,{asciiWordBoundaries:u,avoidSubclass:d,supportedGNodes:f,wordIsAscii:p}=s;if(c===`text_segment_boundary`)throw Error(`Unsupported text segment boundary "\\${l?`Y`:`y`}"`);if(c===`line_end`)o(sy(I_({body:[O_({body:[k_(`string_end`)]}),O_({body:[M_(10)]})]}),t));else if(c===`line_start`)o(sy(iy(hv`(?<=\A|\n(?!\z))`,{skipLookbehindValidation:!0}),t));else if(c===`search_start`){if(f.has(e))i.flags.sticky=!0,a();else{let e=r[n-1];if(e&&ty(e))o(sy(I_({negate:!0}),t));else if(d)throw Error(hv`Uses "\G" in a way that requires a subclass`);else o(oy(k_(`string_start`),t)),s.strategy=`clip_search`}}else if(c!==`string_end`&&c!==`string_start`){if(c===`string_end_newline`)o(sy(iy(hv`(?=\n?\z)`),t));else if(c===`word_boundary`){if(!p&&!u){let e=`(?:(?<=${Dv})(?!${Dv})|(?<!${Dv})(?=${Dv}))`,n=`(?:(?<=${Dv})(?=${Dv})|(?<!${Dv})(?!${Dv}))`;o(sy(iy(l?n:e),t))}}else throw Error(`Unexpected assertion kind "${c}"`)}},Backreference({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n==`string`&&!ry(n)&&(n=Jv(n,t),e.ref=n)},CapturingGroup({node:e},{jsGroupNameMap:t,subroutineRefMap:n}){let{name:r}=e;r&&!ry(r)&&(r=Jv(r,t),e.name=r),n.set(e.number,e),r&&n.set(r,e)},CharacterClassRange({node:e,parent:t,replaceWith:n}){t.kind===`intersection`&&n(sy(N_({body:[e]}),t),{traverse:!0})},CharacterSet({node:e,parent:t,replaceWith:n},{accuracy:r,minTargetEs2024:i,digitIsAscii:a,spaceIsAscii:o,wordIsAscii:s}){let{kind:c,negate:l,value:u}=e;if(a&&(c===`digit`||u===`digit`))n(oy(P_(`digit`,{negate:l}),t));else if(o&&(c===`space`||u===`space`))n(sy(ay(iy(Tv),l),t));else if(s&&(c===`word`||u===`word`))n(oy(P_(`word`,{negate:l}),t));else if(c===`any`)n(oy(z_(`Any`),t));else if(c===`digit`)n(oy(z_(`Nd`,{negate:l}),t));else if(c!==`dot`){if(c===`text_segment`){if(r===`strict`)throw Error(hv`Use of "\X" requires non-strict accuracy`);let e=`\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?`,a=hv`\p{RI}{2}|${e}(?:\u200D${e})*`;n(sy(iy(hv`(?>\r\n|${i?hv`\p{RGI_Emoji}`:a}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),t))}else if(c===`hex`)n(oy(z_(`AHex`,{negate:l}),t));else if(c===`newline`)n(sy(iy(l?`[^
]`:`(?>\r
?|[
\v\f…\u2028\u2029])`),t));else if(c===`posix`){if(!i&&(u===`graph`||u===`print`)){if(r===`strict`)throw Error(`POSIX class "${u}" requires min target ES2024 or non-strict accuracy`);let e={graph:`!-~`,print:` -~`}[u];l&&(e=`\0-${aS(e.codePointAt(0)-1)}${aS(e.codePointAt(2)+1)}-\u{10FFFF}`),n(QS(YS(`[${e}]`),t))}else n(QS(XS(YS(wS.get(u)),l),t))}else if(c===`property`)bS.has(Dx(u))||(e.key=`sc`);else if(c===`space`)n(ZS(yx(`space`,{negate:l}),t));else if(c===`word`)n(QS(XS(YS(vS),l),t));else throw Error(`Unexpected character set kind "${c}"`)}},Directive({node:e,parent:t,root:n,remove:r,replaceWith:i,removeAllPrevSiblings:a,removeAllNextSiblings:o}){let{kind:s,flags:c}=e;if(s===`flags`){if(!c.enable&&!c.disable)r();else{let e=fx({flags:c});e.body[0].body=o(),i(QS(e,t),{traverse:!0})}}else if(s===`keep`){let e=n.body[0],r=n.body.length===1&&Ub(e,{type:`Group`})&&e.body[0].body.length===1?e.body[0]:n;if(t.parent!==r||r.body.length>1)throw Error(oS`Uses "\K" in a way that's unsupported`);let o=px({behind:!0});o.body[0].body=a(),i(QS(o,t))}else throw Error(`Unexpected directive kind "${s}"`)},Flags({node:e,parent:t}){if(e.posixIsAscii)throw Error(`Unsupported flag "P"`);if(e.textSegmentMode===`word`)throw Error(`Unsupported flag "y{w}"`);[`digitIsAscii`,`extended`,`posixIsAscii`,`spaceIsAscii`,`wordIsAscii`,`textSegmentMode`].forEach(t=>delete e[t]),Object.assign(e,{global:!1,hasIndices:!1,multiline:!1,sticky:e.sticky??!1}),t.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:e}){if(!e.flags)return;let{enable:t,disable:n}=e.flags;t?.extended&&delete t.extended,n?.extended&&delete n.extended,t?.dotAll&&n?.dotAll&&delete t.dotAll,t?.ignoreCase&&n?.ignoreCase&&delete t.ignoreCase,t&&!Object.keys(t).length&&delete e.flags.enable,n&&!Object.keys(n).length&&delete e.flags.disable,!e.flags.enable&&!e.flags.disable&&delete e.flags},LookaroundAssertion({node:e},t){let{kind:n}=e;n===`lookbehind`&&(t.passedLookbehind=!0)},NamedCallout({node:e,parent:t,replaceWith:n}){let{kind:r}=e;if(r===`fail`)n(QS(px({negate:!0}),t));else throw Error(`Unsupported named callout "(*${r.toUpperCase()}"`)},Quantifier({node:e}){if(e.body.type===`Quantifier`){let t=fx();t.body[0].body.push(e.body),e.body=QS(t,e)}},Regex:{enter({node:e},{supportedGNodes:t}){let n=[],r=!1,i=!1;for(let t of e.body)if(t.body.length===1&&t.body[0].kind===`search_start`)t.body.pop();else{let e=US(t.body);e?(r=!0,Array.isArray(e)?n.push(...e):n.push(e)):i=!0}r&&!i&&n.forEach(e=>t.add(e))},exit(e,{accuracy:t,passedLookbehind:n,strategy:r}){if(t===`strict`&&n&&r)throw Error(oS`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n==`string`&&!JS(n)&&(n=zS(n,t),e.ref=n)}},jS={Backreference({node:e},{multiplexCapturesToLeftByRef:t,reffedNodesByReferencer:n}){let{orphan:r,ref:i}=e;r||n.set(e,[...t.get(i).map(({node:e})=>e)])},CapturingGroup:{enter({node:e,parent:t,replaceWith:n,skip:r},{groupOriginByCopy:i,groupsByName:a,multiplexCapturesToLeftByRef:o,openRefs:s,reffedNodesByReferencer:c}){let l=i.get(e);if(l&&s.has(e.number)){let r=ZS(LS(e.number),t);c.set(r,s.get(e.number)),n(r);return}s.set(e.number,e),o.set(e.number,[]),e.name&&uS(o,e.name,[]);let u=o.get(e.name??e.number);for(let t=0;t<u.length;t++){let n=u[t];if(l===n.node||l&&l===n.origin||e===n.origin){u.splice(t,1);break}}if(o.get(e.number).push({node:e,origin:l}),e.name&&o.get(e.name).push({node:e,origin:l}),e.name){let t=uS(a,e.name,new Map),n=!1;if(l)n=!0;else for(let e of t.values())if(!e.hasDuplicateNameToRemove){n=!0;break}a.get(e.name).set(e,{node:e,hasDuplicateNameToRemove:n})}},exit({node:e},{openRefs:t}){t.get(e.number)===e&&t.delete(e.number)}},Group:{enter({node:e},t){t.prevFlags=t.currentFlags,e.flags&&(t.currentFlags=lS(t.currentFlags,e.flags))},exit(e,t){t.currentFlags=t.prevFlags}},Subroutine({node:e,parent:t,replaceWith:n},r){let{isRecursive:i,ref:a}=e;if(i){let n=t;for(;(n=n.parent)&&(n.type!==`CapturingGroup`||n.name!==a&&n.number!==a););r.reffedNodesByReferencer.set(e,n);return}let o=r.subroutineRefMap.get(a),s=a===0,c=s?LS(0):IS(o,r.groupOriginByCopy,null),l=c;if(!s){let e=BS(RS(o,e=>e.type===`Group`&&!!e.flags)),t=e?lS(r.globalFlags,e):r.globalFlags;PS(t,r.currentFlags)||(l=fx({flags:VS(t)}),l.body[0].body.push(c))}n(QS(l,t),{traverse:!s})}},MS={Backreference({node:e,parent:t,replaceWith:n},r){if(e.orphan){r.highestOrphanBackref=Math.max(r.highestOrphanBackref,e.ref);return}let i=r.reffedNodesByReferencer.get(e).filter(t=>FS(t,e));i.length?i.length>1?n(QS(fx({atomic:!0,body:i.reverse().map(e=>nx({body:[ix(e.number)]}))}),t)):e.ref=i[0].number:n(QS(px({negate:!0}),t))},CapturingGroup({node:e},t){e.number=++t.numCapturesToLeft,e.name&&t.groupsByName.get(e.name).get(e).hasDuplicateNameToRemove&&delete e.name},Regex:{exit({node:e},t){let n=Math.max(t.highestOrphanBackref-t.numCapturesToLeft,0);for(let t=0;t<n;t++){let t=ax();e.body.at(-1).body.push(t)}}},Subroutine({node:e},t){e.isRecursive&&e.ref!==0&&(e.ref=t.reffedNodesByR Line truncated
`).flatMap(e=>i(e)):i(e);return{lines:a.map(e=>e.map(e=>({content:e.content,htmlStyle:e.htmlStyle}))),state:n.getLastGrammarState(a)}}}}function IC(e,t){let n=at(null);N(()=>Ge(t),(e,t,r)=>{if(typeof window>`u`)return;let i=!1;r(()=>i=!0),n.value=null,FC(e).then(e=>{i||(n.value=e)}).catch(()=>{})},{immediate:!0});let r={highlighter:null,text:``,lines:[]};return Y(()=>{let t=Ge(e),i=t.endsWith(`
\v\f…\u2028\u2029])`),t));else if(c===`posix`){if(!i&&(u===`graph`||u===`print`)){if(r===`strict`)throw Error(`POSIX class "${u}" requires min target ES2024 or non-strict accuracy`);let e={graph:`!-~`,print:` -~`}[u];l&&(e=`\0-${mv(e.codePointAt(0)-1)}${mv(e.codePointAt(2)+1)}-\u{10FFFF}`),n(sy(iy(`[${e}]`),t))}else n(sy(ay(iy(Nv.get(u)),l),t))}else if(c===`property`)kv.has(W_(u))||(e.key=`sc`);else if(c===`space`)n(oy(z_(`space`,{negate:l}),t));else if(c===`word`)n(sy(ay(iy(Dv),l),t));else throw Error(`Unexpected character set kind "${c}"`)}},Directive({node:e,parent:t,root:n,remove:r,replaceWith:i,removeAllPrevSiblings:a,removeAllNextSiblings:o}){let{kind:s,flags:c}=e;if(s===`flags`){if(!c.enable&&!c.disable)r();else{let e=F_({flags:c});e.body[0].body=o(),i(sy(e,t),{traverse:!0})}}else if(s===`keep`){let e=n.body[0],r=n.body.length===1&&h_(e,{type:`Group`})&&e.body[0].body.length===1?e.body[0]:n;if(t.parent!==r||r.body.length>1)throw Error(hv`Uses "\K" in a way that's unsupported`);let o=I_({behind:!0});o.body[0].body=a(),i(sy(o,t))}else throw Error(`Unexpected directive kind "${s}"`)},Flags({node:e,parent:t}){if(e.posixIsAscii)throw Error(`Unsupported flag "P"`);if(e.textSegmentMode===`word`)throw Error(`Unsupported flag "y{w}"`);[`digitIsAscii`,`extended`,`posixIsAscii`,`spaceIsAscii`,`wordIsAscii`,`textSegmentMode`].forEach(t=>delete e[t]),Object.assign(e,{global:!1,hasIndices:!1,multiline:!1,sticky:e.sticky??!1}),t.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:e}){if(!e.flags)return;let{enable:t,disable:n}=e.flags;t?.extended&&delete t.extended,n?.extended&&delete n.extended,t?.dotAll&&n?.dotAll&&delete t.dotAll,t?.ignoreCase&&n?.ignoreCase&&delete t.ignoreCase,t&&!Object.keys(t).length&&delete e.flags.enable,n&&!Object.keys(n).length&&delete e.flags.disable,!e.flags.enable&&!e.flags.disable&&delete e.flags},LookaroundAssertion({node:e},t){let{kind:n}=e;n===`lookbehind`&&(t.passedLookbehind=!0)},NamedCallout({node:e,parent:t,replaceWith:n}){let{kind:r}=e;if(r===`fail`)n(sy(I_({negate:!0}),t));else throw Error(`Unsupported named callout "(*${r.toUpperCase()}"`)},Quantifier({node:e}){if(e.body.type===`Quantifier`){let t=F_();t.body[0].body.push(e.body),e.body=sy(t,e)}},Regex:{enter({node:e},{supportedGNodes:t}){let n=[],r=!1,i=!1;for(let t of e.body)if(t.body.length===1&&t.body[0].kind===`search_start`)t.body.pop();else{let e=Qv(t.body);e?(r=!0,Array.isArray(e)?n.push(...e):n.push(e)):i=!0}r&&!i&&n.forEach(e=>t.add(e))},exit(e,{accuracy:t,passedLookbehind:n,strategy:r}){if(t===`strict`&&n&&r)throw Error(hv`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n==`string`&&!ry(n)&&(n=Jv(n,t),e.ref=n)}},Bv={Backreference({node:e},{multiplexCapturesToLeftByRef:t,reffedNodesByReferencer:n}){let{orphan:r,ref:i}=e;r||n.set(e,[...t.get(i).map(({node:e})=>e)])},CapturingGroup:{enter({node:e,parent:t,replaceWith:n,skip:r},{groupOriginByCopy:i,groupsByName:a,multiplexCapturesToLeftByRef:o,openRefs:s,reffedNodesByReferencer:c}){let l=i.get(e);if(l&&s.has(e.number)){let r=oy(Kv(e.number),t);c.set(r,s.get(e.number)),n(r);return}s.set(e.number,e),o.set(e.number,[]),e.name&&yv(o,e.name,[]);let u=o.get(e.name??e.number);for(let t=0;t<u.length;t++){let n=u[t];if(l===n.node||l&&l===n.origin||e===n.origin){u.splice(t,1);break}}if(o.get(e.number).push({node:e,origin:l}),e.name&&o.get(e.name).push({node:e,origin:l}),e.name){let t=yv(a,e.name,new Map),n=!1;if(l)n=!0;else for(let e of t.values())if(!e.hasDuplicateNameToRemove){n=!0;break}a.get(e.name).set(e,{node:e,hasDuplicateNameToRemove:n})}},exit({node:e},{openRefs:t}){t.get(e.number)===e&&t.delete(e.number)}},Group:{enter({node:e},t){t.prevFlags=t.currentFlags,e.flags&&(t.currentFlags=vv(t.currentFlags,e.flags))},exit(e,t){t.currentFlags=t.prevFlags}},Subroutine({node:e,parent:t,replaceWith:n},r){let{isRecursive:i,ref:a}=e;if(i){let n=t;for(;(n=n.parent)&&(n.type!==`CapturingGroup`||n.name!==a&&n.number!==a););r.reffedNodesByReferencer.set(e,n);return}let o=r.subroutineRefMap.get(a),s=a===0,c=s?Kv(0):Gv(o,r.groupOriginByCopy,null),l=c;if(!s){let e=Yv(qv(o,e=>e.type===`Group`&&!!e.flags)),t=e?vv(r.globalFlags,e):r.globalFlags;Uv(t,r.currentFlags)||(l=F_({flags:Xv(t)}),l.body[0].body.push(c))}n(sy(l,t),{traverse:!s})}},Vv={Backreference({node:e,parent:t,replaceWith:n},r){if(e.orphan){r.highestOrphanBackref=Math.max(r.highestOrphanBackref,e.ref);return}let i=r.reffedNodesByReferencer.get(e).filter(t=>Wv(t,e));i.length?i.length>1?n(sy(F_({atomic:!0,body:i.reverse().map(e=>O_({body:[A_(e.number)]}))}),t)):e.ref=i[0].number:n(sy(I_({negate:!0}),t))},CapturingGroup({node:e},t){e.number=++t.numCapturesToLeft,e.name&&t.groupsByName.get(e.name).get(e).hasDuplicateNameToRemove&&delete e.name},Regex:{exit({node:e},t){let n=Math.max(t.highestOrphanBackref-t.numCapturesToLeft,0);for(let t=0;t<n;t++){let t=j_();e.body.at(-1).body.push(t)}}},Subroutine({node:e},t){e.isRecursive&&e.ref!==0&&(e.ref=t.reffedNodesByR Line truncated
`).flatMap(e=>i(e)):i(e);return{lines:a.map(e=>e.map(e=>({content:e.content,htmlStyle:e.htmlStyle}))),state:n.getLastGrammarState(a)}}}}function Gy(e,t){let n=we(null);p(()=>le(t),(e,t,r)=>{if(typeof window>`u`)return;let i=!1;r(()=>i=!0),n.value=null,Wy(e).then(e=>{i||(n.value=e)}).catch(()=>{})},{immediate:!0});let r={highlighter:null,text:``,lines:[]};return G(()=>{let t=le(e),i=t.endsWith(`
`)?t.slice(0,-1):t,a=n.value;if(!a)return i.split(`
`).map(e=>e?[{content:e}]:[]);(r.highlighter!==a||!i.startsWith(r.text))&&(r={highlighter:a,text:``,lines:[]});let o=i.lastIndexOf(`
`)+1;if(o>r.text.length){let e=a.highlight(i.slice(r.text.length,o-1),r.state);r={highlighter:a,text:i.slice(0,o),lines:[...r.lines,...e.lines],state:e.state}}let s=a.highlight(i.slice(o),r.state).lines[0]??[];return[...r.lines,s]})}var LC=qe(`rounded-lg text-sm data-[size=sm]:text-xs has-[>[data-slot=code-block-content]:focus-visible]:ring-3 has-[>[data-slot=code-block-content]:focus-visible]:ring-ring/50 group/code-block relative flex w-full min-w-0 flex-col overflow-hidden`,{variants:{variant:{default:`border border-input text-foreground dark:bg-input/30 has-[>[data-slot=code-block-content]:focus-visible]:border-ring`,destructive:`border border-destructive/30 text-destructive dark:border-destructive/40`}},defaultVariants:{variant:`default`}}),RC=qe(`-mx-3 px-3 in-data-numbered:gap-x-3 before:min-w-6 before:text-end before:text-muted-foreground after:start-1 after:text-muted-foreground group-data-[size=sm]/code-block:-mx-2.5 group-data-[size=sm]/code-block:px-2.5 relative block min-h-lh after:absolute after:top-0 after:select-none in-data-numbered:col-span-2 in-data-numbered:grid in-data-numbered:grid-cols-subgrid in-data-numbered:[counter-increment:line] in-data-numbered:before:content-[counter(line)] in-data-numbered:before:select-none in-data-numbered:supports-[content:counter(line)_/_'']:before:content-[counter(line)_/_'']`,{variants:{variant:{default:``,added:`bg-muted after:content-['+']`,removed:`bg-destructive/10 after:text-destructive after:content-['−']`,highlighted:`bg-muted`}},defaultVariants:{variant:`default`}}),zC=P({__name:`Message`,props:{class:{type:[Boolean,null,String,Object,Array]},align:{default:`start`},asChild:{type:Boolean},as:{default:`div`}},setup(e){let t=e;return(n,r)=>(L(),q(V(dt),{"data-slot":`message`,"data-align":e.align,as:e.as,"as-child":e.asChild,class:z(V(W)(`text-sm gap-2 group/message relative flex w-full min-w-0 data-[align=end]:flex-row-reverse`,t.class))},{default:I(()=>[K(n.$slots,`default`)]),_:3},8,[`data-align`,`as`,`as-child`,`class`]))}}),BC=P({__name:`MessageContent`,props:{class:{type:[Boolean,null,String,Object,Array]},asChild:{type:Boolean},as:{default:`div`}},setup(e){let t=e;return(n,r)=>(L(),q(V(dt),{"data-slot":`message-content`,as:e.as,"as-child":e.asChild,class:z(V(W)(`gap-2.5 group-data-[align=end]/message:*:data-slot:self-end flex w-full min-w-0 flex-col wrap-break-word`,t.class))},{default:I(()=>[K(n.$slots,`default`)]),_:3},8,[`as`,`as-child`,`class`]))}}),VC=P({__name:`MessageFooter`,props:{class:{type:[Boolean,null,String,Object,Array]},asChild:{type:Boolean},as:{default:`div`}},setup(e){let t=e;return(n,r)=>(L(),q(V(dt),{"data-slot":`message-footer`,as:e.as,"as-child":e.asChild,class:z(V(W)(`text-xs font-medium text-muted-foreground px-3 group-has-data-[variant=ghost]/message:px-0 flex max-w-full min-w-0 items-center group-data-[align=end]/message:justify-end`,t.class))},{default:I(()=>[K(n.$slots,`default`)]),_:3},8,[`as`,`as-child`,`class`]))}});function HC(e){switch(e.type){case`image`:return`[photo]`;case`video`:return`[video]`;case`audio`:return`[audio]`;case`document`:return e.file_name?`[document: ${e.file_name}]`:`[document]`;default:return`[${e.type||`attachment`}]`}}function UC(e){let t=[];return e.mime_type&&t.push(e.mime_type),e.file_name&&t.push(e.file_name),e.file_size!==void 0&&t.push(`${e.file_size} bytes`),e.width&&e.height&&t.push(`${e.width}×${e.height}`),e.duration!==void 0&&t.push(`${e.duration} s`),t.join(` · `)}var WC={class:`truncate`},GC=P({__name:`ChatAttachment`,props:{attachment:{}},setup(e){return(t,n)=>(L(),q(_e(e.attachment.url?`a`:`span`),{href:e.attachment.url,target:e.attachment.url?`_blank`:void 0,rel:e.attachment.url?`noopener noreferrer`:void 0,title:V(UC)(e.attachment),class:`inline-flex max-w-full items-center gap-1.5 rounded-md border border-border bg-muted px-2.5 py-1 text-xs font-medium text-fg-muted`},{default:I(()=>[A(V(cte),{"aria-hidden":`true`,class:`size-3.5 shrink-0`}),R(`span`,WC,B(V(HC)(e.attachment)),1)]),_:1},8,[`href`,`target`,`rel`,`title`]))}}),KC=P({__name:`CodeView`,props:{code:{},lang:{},class:{}},setup(e){let t=e,n=IC(()=>t.code,()=>t.lang||`text`);return(r,i)=>(L(),q(V(bm),{class:z(V(W)(`bg-muted`,t.class))},{default:I(()=>[A(V(xm),null,{default:I(()=>[A(V(Dm),{value:e.code},null,8,[`value`])]),_:1}),A(V(Tm),{wrap:``,class:`max-h-[60vh] pe-10 text-xs`},{default:I(()=>[(L(!0),j(U,null,M(V(n),(e,t)=>(L(),q(V(wm),{key:t},{default:I(()=>[(L(!0),j(U,null,M(e,(e,t)=>(L(),q(V(Om),{key:t,token:e},null,8,[`token`]))),128))]),_:2},1024))),128))]),_:1})]),_:1},8,[`class`]))}}),qC=[`src`,`alt`],JC={key:1},YC={key:2},XC={key:3,class:`rounded bg-foreground/10 px-1 py-0.5 font-mono text-[0.9em]`},ZC=[`href`],QC={key:5},$C=P({__name:`ChatInline`,props:{inline:{}},setup(e){return(t,n)=>(L(!0),j(U,null,M(e.inline,(e,t)=>(L(),j(U,{key:t},[e.kind===`image`?(L(),j(`img`,{key:0,src:e.src,alt:e.alt,loading:`lazy`,class:`my-1 block max-h-96 max-w-full cursor-pointer rounded-md border border-border bgLine truncated
`),r=[],i=null,a=null,o=``,s=()=>{r.length&&(t.push({kind:`p`,inline:tw(r.join(` `))}),r=[])},c=()=>{i&&=(t.push({kind:i.tag,items:i.items.map(e=>tw(e))}),null)};for(let e=0;e<n.length;e++){let l=n[e];if(l.startsWith("```")){s(),c(),a?(t.push({kind:`pre`,code:a.join(`
`),lang:o}),a=null):(a=[],o=l.slice(3).trim().split(/\s/)[0]);continue}if(a){a.push(l);continue}let u=rw(l),d=e+1<n.length?rw(n[e+1]):null;if(u&&d&&iw(d)&&u.length===d.length){s(),c();let r=[];for(e+=2;e<n.length;e++){let t=rw(n[e]);if(!t||t.length!==u.length){e--;break}r.push(t)}t.push({kind:`table`,head:u.map(e=>tw(e)),rows:r.map(e=>e.map(e=>tw(e)))});continue}if(!l.trim()){s(),c();continue}let f=l.match(/^(#{1,3})\s+(.+)$/);if(f){s(),c(),t.push({kind:`h${f[1].length}`,inline:tw(f[2])});continue}let p=l.match(/^\s*[-*]\s+(.+)$/),m=l.match(/^\s*\d+[.)]\s+(.+)$/);if(p||m){s();let e=m?`ol`:`ul`;(!i||i.tag!==e)&&(c(),i={tag:e,items:[]}),i.items.push((p||m)[1])}else l.startsWith(`>`)?(s(),c(),t.push({kind:`blockquote`,inline:tw(l.replace(/^>\s?/,``))})):r.push(l)}return s(),c(),a&&t.push({kind:`pre`,code:a.join(`
`),lang:o}),t}function rw(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 iw(e){return e.every(e=>/^:?-{3,}:?$/.test(e))}var aw={class:`[overflow-wrap:anywhere]`},zte={key:1,class:`my-3 w-full border-collapse text-[0.92em]`},Bte={key:2,class:`my-2 border-l-[3px] border-primary pl-3 text-fg-muted`},Vte={key:3,class:`mt-1 mb-2 text-xl leading-tight font-semibold tracking-[-0.02em]`},Hte={key:4,class:`mt-1 mb-2 text-lg leading-tight font-semibold tracking-[-0.02em]`},Ute={key:5,class:`mt-1 mb-2 text-base leading-tight font-semibold tracking-[-0.02em]`},Wte={key:6,class:`my-2.5 flex list-disc flex-col gap-1 pl-5`},Gte={key:7,class:`my-2.5 flex list-decimal flex-col gap-1 pl-5`},Kte={key:8,class:`mb-2.5 last:mb-0`},ow=P({__name:`ChatMarkdown`,props:{text:{}},setup(e){let t=e,n=Y(()=>nw(t.text));return(e,t)=>(L(),j(`div`,aw,[(L(!0),j(U,null,M(n.value,(e,t)=>(L(),j(U,{key:t},[e.kind===`pre`?(L(),q(KC,{key:0,code:e.code,lang:e.lang,class:`my-2`},null,8,[`code`,`lang`])):e.kind===`table`?(L(),j(`table`,zte,[R(`thead`,null,[R(`tr`,null,[(L(!0),j(U,null,M(e.head,(e,t)=>(L(),j(`th`,{key:t,class:`border border-border bg-muted px-2 py-1.5 text-left font-semibold`},[A($C,{inline:e},null,8,[`inline`])]))),128))])]),R(`tbody`,null,[(L(!0),j(U,null,M(e.rows,(e,t)=>(L(),j(`tr`,{key:t},[(L(!0),j(U,null,M(e,(e,t)=>(L(),j(`td`,{key:t,class:`border border-border px-2 py-1.5 text-left`},[A($C,{inline:e},null,8,[`inline`])]))),128))]))),128))])])):e.kind===`blockquote`?(L(),j(`blockquote`,Bte,[A($C,{inline:e.inline},null,8,[`inline`])])):e.kind===`h1`?(L(),j(`h1`,Vte,[A($C,{inline:e.inline},null,8,[`inline`])])):e.kind===`h2`?(L(),j(`h2`,Hte,[A($C,{inline:e.inline},null,8,[`inline`])])):e.kind===`h3`?(L(),j(`h3`,Ute,[A($C,{inline:e.inline},null,8,[`inline`])])):e.kind===`ul`?(L(),j(`ul`,Wte,[(L(!0),j(U,null,M(e.items,(e,t)=>(L(),j(`li`,{key:t},[A($C,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`ol`?(L(),j(`ol`,Gte,[(L(!0),j(U,null,M(e.items,(e,t)=>(L(),j(`li`,{key:t},[A($C,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`p`?(L(),j(`p`,Kte,[A($C,{inline:e.inline},null,8,[`inline`])])):F(``,!0)],64))),128))]))}}),qte={class:`truncate`},Jte=P({__name:`ChatNavChip`,props:{path:{},label:{}},setup(e){return(t,n)=>{let r=Me(`RouterLink`);return L(),q(r,{to:e.path,title:`Go to ${e.label||e.path}`,class:`inline-flex max-w-full items-center gap-1.5 rounded-md border border-primary/45 bg-primary-soft px-2.5 py-1 text-xs font-semibold text-link transition-colors hover:border-primary hover:bg-primary/15 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary`},{default:I(()=>[A(V(Vl),{"aria-hidden":`true`,class:`size-3.5 shrink-0`}),R(`span`,qte,B(e.label||e.path),1)]),_:1},8,[`to`,`title`])}}}),Yte={class:`font-mono text-foreground`},Xte={key:0,class:`shrink-0 text-xs tabular-nums`},Zte={class:`font-mono text-foreground`},Qte={key:0,class:`shrink-0 text-xs tabular-nums`},sw=P({__name:`ChatToolCall`,props:{tool:{},streaming:{type:Boolean}},setup(e){let t=e,n=Y(()=>t.tool.name||t.tool.Name||t.tool.tool||`tool`),r=Y(()=>t.tool.parameters||t.tool.Parameters||``),i=Y(()=>!!(t.tool.err||t.tool.Err||t.tool.failed)),a=Y(()=>t.tool.summary||t.tool.Summary||t.tool.text||t.tool.err||t.tool.Err||``),o=Y(()=>!a.value&&!i.value&&!!t.streaming),s=Y(()=>{let e=t.tool.duration_ms;return e?e<1e3?`${e}ms`:`${(e/1e3).toFixed(+(e<1e4))}s`:``}),c=Y(()=>{try{let e=JSON.parse(r.value);if(e&&typeof e==`object`&&!Array.isArray(e)){let t=Object.values(e).find(e=>typeof e==`string`&&e);return typeof t==`string`?t.split(`
`,1)[0]:Object.entries(e).map(([e,t])=>`${e}: ${typeof t==`object`?JSON.stringify(t):t}`).join(`, `)}}catch{}return r.value.split(`
`,1)[0]}),l=Y(()=>[r.value&&`> ${r.value}`,a.value].filter(Boolean).join(`
`)+1;if(o>r.text.length){let e=a.highlight(i.slice(r.text.length,o-1),r.state);r={highlighter:a,text:i.slice(0,o),lines:[...r.lines,...e.lines],state:e.state}}let s=a.highlight(i.slice(o),r.state).lines[0]??[];return[...r.lines,s]})}var Ky=de(`rounded-lg text-sm data-[size=sm]:text-xs has-[>[data-slot=code-block-content]:focus-visible]:ring-3 has-[>[data-slot=code-block-content]:focus-visible]:ring-ring/50 group/code-block relative flex w-full min-w-0 flex-col overflow-hidden`,{variants:{variant:{default:`border border-input text-foreground dark:bg-input/30 has-[>[data-slot=code-block-content]:focus-visible]:border-ring`,destructive:`border border-destructive/30 text-destructive dark:border-destructive/40`}},defaultVariants:{variant:`default`}}),qy=de(`-mx-3 px-3 in-data-numbered:gap-x-3 before:min-w-6 before:text-end before:text-muted-foreground after:start-1 after:text-muted-foreground group-data-[size=sm]/code-block:-mx-2.5 group-data-[size=sm]/code-block:px-2.5 relative block min-h-lh after:absolute after:top-0 after:select-none in-data-numbered:col-span-2 in-data-numbered:grid in-data-numbered:grid-cols-subgrid in-data-numbered:[counter-increment:line] in-data-numbered:before:content-[counter(line)] in-data-numbered:before:select-none in-data-numbered:supports-[content:counter(line)_/_'']:before:content-[counter(line)_/_'']`,{variants:{variant:{default:``,added:`bg-muted after:content-['+']`,removed:`bg-destructive/10 after:text-destructive after:content-['−']`,highlighted:`bg-muted`}},defaultVariants:{variant:`default`}}),Jy=y({__name:`Message`,props:{class:{type:[Boolean,null,String,Object,Array]},align:{default:`start`},asChild:{type:Boolean},as:{default:`div`}},setup(e){let t=e;return(n,r)=>(j(),U(L(q),{"data-slot":`message`,"data-align":e.align,as:e.as,"as-child":e.asChild,class:F(L(B)(`text-sm gap-2 group/message relative flex w-full min-w-0 data-[align=end]:flex-row-reverse`,t.class))},{default:A(()=>[H(n.$slots,`default`)]),_:3},8,[`data-align`,`as`,`as-child`,`class`]))}}),Yy=y({__name:`MessageContent`,props:{class:{type:[Boolean,null,String,Object,Array]},asChild:{type:Boolean},as:{default:`div`}},setup(e){let t=e;return(n,r)=>(j(),U(L(q),{"data-slot":`message-content`,as:e.as,"as-child":e.asChild,class:F(L(B)(`gap-2.5 group-data-[align=end]/message:*:data-slot:self-end flex w-full min-w-0 flex-col wrap-break-word`,t.class))},{default:A(()=>[H(n.$slots,`default`)]),_:3},8,[`as`,`as-child`,`class`]))}}),Xy=y({__name:`MessageFooter`,props:{class:{type:[Boolean,null,String,Object,Array]},asChild:{type:Boolean},as:{default:`div`}},setup(e){let t=e;return(n,r)=>(j(),U(L(q),{"data-slot":`message-footer`,as:e.as,"as-child":e.asChild,class:F(L(B)(`text-xs font-medium text-muted-foreground px-3 group-has-data-[variant=ghost]/message:px-0 flex max-w-full min-w-0 items-center group-data-[align=end]/message:justify-end`,t.class))},{default:A(()=>[H(n.$slots,`default`)]),_:3},8,[`as`,`as-child`,`class`]))}});function Zy(e){switch(e.type){case`image`:return`[photo]`;case`video`:return`[video]`;case`audio`:return`[audio]`;case`document`:return e.file_name?`[document: ${e.file_name}]`:`[document]`;default:return`[${e.type||`attachment`}]`}}function Qy(e){let t=[];return e.mime_type&&t.push(e.mime_type),e.file_name&&t.push(e.file_name),e.file_size!==void 0&&t.push(`${e.file_size} bytes`),e.width&&e.height&&t.push(`${e.width}×${e.height}`),e.duration!==void 0&&t.push(`${e.duration} s`),t.join(` · `)}var $y={class:`truncate`},eb=y({__name:`ChatAttachment`,props:{attachment:{}},setup(e){return(t,n)=>(j(),U(u(e.attachment.url?`a`:`span`),{href:e.attachment.url,target:e.attachment.url?`_blank`:void 0,rel:e.attachment.url?`noopener noreferrer`:void 0,title:L(Qy)(e.attachment),class:`inline-flex max-w-full items-center gap-1.5 rounded-md border border-border bg-muted px-2.5 py-1 text-xs font-medium text-fg-muted`},{default:A(()=>[r(L(pl),{"aria-hidden":`true`,class:`size-3.5 shrink-0`}),N(`span`,$y,I(L(Zy)(e.attachment)),1)]),_:1},8,[`href`,`target`,`rel`,`title`]))}}),tb=y({__name:`CodeView`,props:{code:{},lang:{},class:{}},setup(e){let t=e,n=Gy(()=>t.code,()=>t.lang||`text`);return(i,a)=>(j(),U(L(Vp),{class:F(L(B)(`bg-muted`,t.class))},{default:A(()=>[r(L(Hp),null,{default:A(()=>[r(L(Jp),{value:e.code},null,8,[`value`])]),_:1}),r(L(Kp),{wrap:``,class:`max-h-[60vh] pe-10 text-xs`},{default:A(()=>[(j(!0),o(z,null,s(L(n),(e,t)=>(j(),U(L(Gp),{key:t},{default:A(()=>[(j(!0),o(z,null,s(e,(e,t)=>(j(),U(L(Yp),{key:t,token:e},null,8,[`token`]))),128))]),_:2},1024))),128))]),_:1})]),_:1},8,[`class`]))}}),nb=[`src`,`alt`],rb={key:1},ib={key:2},ab={key:3,class:`rounded bg-foreground/10 px-1 py-0.5 font-mono text-[0.9em]`},ob=[`href`],sb={key:5},cb=y({__name:`ChatInline`,props:{inline:{}},setup(e){return(t,n)=>(j(!0),o(z,null,s(e.inline,(e,t)=>(j(),o(z,{key:t},[e.kind===`image`?(j(),o(`img`,{key:0,src:e.src,alt:e.alt,loading:`lazy`,class:`my-1 block max-h-96 max-w-full cursor-pointer rounded-md border border-border bg-cardLine truncated
`),r=[],i=null,a=null,o=``,s=()=>{r.length&&(t.push({kind:`p`,inline:ub(r.join(` `))}),r=[])},c=()=>{i&&=(t.push({kind:i.tag,items:i.items.map(e=>ub(e))}),null)};for(let e=0;e<n.length;e++){let l=n[e];if(l.startsWith("```")){s(),c(),a?(t.push({kind:`pre`,code:a.join(`
`),lang:o}),a=null):(a=[],o=l.slice(3).trim().split(/\s/)[0]);continue}if(a){a.push(l);continue}let u=fb(l),d=e+1<n.length?fb(n[e+1]):null;if(u&&d&&pb(d)&&u.length===d.length){s(),c();let r=[];for(e+=2;e<n.length;e++){let t=fb(n[e]);if(!t||t.length!==u.length){e--;break}r.push(t)}t.push({kind:`table`,head:u.map(e=>ub(e)),rows:r.map(e=>e.map(e=>ub(e)))});continue}if(!l.trim()){s(),c();continue}let f=l.match(/^(#{1,3})\s+(.+)$/);if(f){s(),c(),t.push({kind:`h${f[1].length}`,inline:ub(f[2])});continue}let p=l.match(/^\s*[-*]\s+(.+)$/),m=l.match(/^\s*\d+[.)]\s+(.+)$/);if(p||m){s();let e=m?`ol`:`ul`;(!i||i.tag!==e)&&(c(),i={tag:e,items:[]}),i.items.push((p||m)[1])}else l.startsWith(`>`)?(s(),c(),t.push({kind:`blockquote`,inline:ub(l.replace(/^>\s?/,``))})):r.push(l)}return s(),c(),a&&t.push({kind:`pre`,code:a.join(`
`),lang:o}),t}function fb(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 pb(e){return e.every(e=>/^:?-{3,}:?$/.test(e))}var mb={class:`[overflow-wrap:anywhere]`},hb={key:1,class:`my-3 w-full border-collapse text-[0.92em]`},gb={key:2,class:`my-2 border-l-[3px] border-primary pl-3 text-fg-muted`},_b={key:3,class:`mt-1 mb-2 text-xl leading-tight font-semibold tracking-[-0.02em]`},vb={key:4,class:`mt-1 mb-2 text-lg leading-tight font-semibold tracking-[-0.02em]`},yb={key:5,class:`mt-1 mb-2 text-base leading-tight font-semibold tracking-[-0.02em]`},bb={key:6,class:`my-2.5 flex list-disc flex-col gap-1 pl-5`},xb={key:7,class:`my-2.5 flex list-decimal flex-col gap-1 pl-5`},Sb={key:8,class:`mb-2.5 last:mb-0`},Cb=y({__name:`ChatMarkdown`,props:{text:{}},setup(e){let t=e,n=G(()=>db(t.text));return(e,t)=>(j(),o(`div`,mb,[(j(!0),o(z,null,s(n.value,(e,t)=>(j(),o(z,{key:t},[e.kind===`pre`?(j(),U(tb,{key:0,code:e.code,lang:e.lang,class:`my-2`},null,8,[`code`,`lang`])):e.kind===`table`?(j(),o(`table`,hb,[N(`thead`,null,[N(`tr`,null,[(j(!0),o(z,null,s(e.head,(e,t)=>(j(),o(`th`,{key:t,class:`border border-border bg-muted px-2 py-1.5 text-left font-semibold`},[r(cb,{inline:e},null,8,[`inline`])]))),128))])]),N(`tbody`,null,[(j(!0),o(z,null,s(e.rows,(e,t)=>(j(),o(`tr`,{key:t},[(j(!0),o(z,null,s(e,(e,t)=>(j(),o(`td`,{key:t,class:`border border-border px-2 py-1.5 text-left`},[r(cb,{inline:e},null,8,[`inline`])]))),128))]))),128))])])):e.kind===`blockquote`?(j(),o(`blockquote`,gb,[r(cb,{inline:e.inline},null,8,[`inline`])])):e.kind===`h1`?(j(),o(`h1`,_b,[r(cb,{inline:e.inline},null,8,[`inline`])])):e.kind===`h2`?(j(),o(`h2`,vb,[r(cb,{inline:e.inline},null,8,[`inline`])])):e.kind===`h3`?(j(),o(`h3`,yb,[r(cb,{inline:e.inline},null,8,[`inline`])])):e.kind===`ul`?(j(),o(`ul`,bb,[(j(!0),o(z,null,s(e.items,(e,t)=>(j(),o(`li`,{key:t},[r(cb,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`ol`?(j(),o(`ol`,xb,[(j(!0),o(z,null,s(e.items,(e,t)=>(j(),o(`li`,{key:t},[r(cb,{inline:e},null,8,[`inline`])]))),128))])):e.kind===`p`?(j(),o(`p`,Sb,[r(cb,{inline:e.inline},null,8,[`inline`])])):T(``,!0)],64))),128))]))}}),wb={class:`truncate`},Tb=y({__name:`ChatNavChip`,props:{path:{},label:{}},setup(e){return(t,n)=>{let i=O(`RouterLink`);return j(),U(i,{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:A(()=>[r(L(Cc),{"aria-hidden":`true`,class:`size-3.5 shrink-0`}),N(`span`,wb,I(e.label||e.path),1)]),_:1},8,[`to`,`title`])}}}),Eb={class:`font-mono text-foreground`},Db={key:0,class:`shrink-0 text-xs tabular-nums`},Ob={class:`font-mono text-foreground`},kb={key:0,class:`shrink-0 text-xs tabular-nums`},Ab=y({__name:`ChatToolCall`,props:{tool:{},streaming:{type:Boolean}},setup(e){let t=e,n=G(()=>t.tool.name||t.tool.Name||t.tool.tool||`tool`),i=G(()=>t.tool.parameters||t.tool.Parameters||``),a=G(()=>!!(t.tool.err||t.tool.Err||t.tool.failed)),s=G(()=>t.tool.summary||t.tool.Summary||t.tool.text||t.tool.err||t.tool.Err||``),c=G(()=>!s.value&&!a.value&&!!t.streaming),l=G(()=>{let e=t.tool.duration_ms;return e?e<1e3?`${e}ms`:`${(e/1e3).toFixed(+(e<1e4))}s`:``}),u=G(()=>{try{let e=JSON.parse(i.value);if(e&&typeof e==`object`&&!Array.isArray(e)){let t=Object.values(e).find(e=>typeof e==`string`&&e);return typeof t==`string`?t.split(`
`,1)[0]:Object.entries(e).map(([e,t])=>`${e}: ${typeof t==`object`?JSON.stringify(t):t}`).join(`, `)}}catch{}return i.value.split(`
`,1)[0]}),d=G(()=>[i.value&&`> ${i.value}`,s.value].filter(Boolean).join(`
`));return(t,r)=>e.tool.path?(L(),q(Jte,{key:0,path:e.tool.path,label:e.tool.label},null,8,[`path`,`label`])):l.value?(L(),q(V(fm),{key:1,"default-open":i.value},{default:I(()=>[A(V(hm),null,{default:I(()=>[A(V(_m),{status:i.value?`error`:o.value?`running`:void 0},{default:I(()=>[A(V(mm),null,{default:I(()=>[i.value?(L(),q(V(ru),{key:0})):o.value?(L(),q(V(bu),{key:1,class:`animate-spin`})):(L(),q(V($l),{key:2,class:`text-success`}))]),_:1}),R(`span`,Yte,B(n.value),1),A(V(vm),{class:`font-mono text-xs`},{default:I(()=>[H(B(c.value),1)]),_:1}),s.value?(L(),j(`span`,Xte,B(s.value),1)):F(``,!0)]),_:1},8,[`status`])]),_:1}),A(V(pm),null,{default:I(()=>[A(V(bm),{size:`sm`},{default:I(()=>[A(V(Tm),{wrap:``,class:`max-h-64`},{default:I(()=>[H(B(l.value),1)]),_:1})]),_:1})]),_:1})]),_:1},8,[`default-open`])):(L(),q(V(_m),{key:2,status:i.value?`error`:o.value?`running`:void 0},{default:I(()=>[A(V(mm),null,{default:I(()=>[i.value?(L(),q(V(ru),{key:0})):o.value?(L(),q(V(bu),{key:1,class:`animate-spin`})):(L(),q(V($l),{key:2,class:`text-success`}))]),_:1}),R(`span`,Zte,B(n.value),1),A(V(vm),{class:`font-mono text-xs`},{default:I(()=>[H(B(c.value),1)]),_:1}),s.value?(L(),j(`span`,Qte,B(s.value),1)):F(``,!0)]),_:1},8,[`status`]))}}),$te={class:`flex flex-col gap-1.5`},ene=P({__name:`ChatToolGroup`,props:{tools:{},streaming:{type:Boolean}},setup(e){let t=e,n=e=>!!(e.err||e.Err||e.failed),r=Y(()=>t.tools.some(n)),i=Y(()=>`${t.tools.length} tool call${t.tools.length===1?``:`s`}`);return(t,n)=>(L(),q(V(fm),{"default-open":r.value},{default:I(()=>[A(V(hm),null,{default:I(()=>[A(V(_m),{status:r.value?`error`:void 0},{default:I(()=>[A(V(mm),null,{default:I(()=>[A(V(Ste))]),_:1}),A(V(vm),{class:`truncate`},{default:I(()=>[H(B(i.value),1)]),_:1})]),_:1},8,[`status`])]),_:1}),A(V(pm),null,{default:I(()=>[R(`div`,$te,[(L(!0),j(U,null,M(e.tools,(t,n)=>(L(),q(sw,{key:n,tool:t,streaming:e.streaming&&n===e.tools.length-1},null,8,[`tool`,`streaming`]))),128))])]),_:1})]),_:1},8,[`default-open`]))}}),tne={key:0,class:`mb-2 flex flex-wrap gap-1.5`},nne={key:2,class:`whitespace-pre-wrap`},rne=P({__name:`ChatBubble`,props:{text:{},tools:{default:()=>[]},media:{default:()=>[]},assistant:{type:Boolean,default:!1},streaming:{type:Boolean,default:!1}},setup(e){let t=e,n=Y(()=>{let e=Array.from(t.text),n=[],r=0,i=!1;for(let a of t.tools){let t=Math.min(Math.max(a.text_offset??0,r),e.length);t>r&&(n.push({text:e.slice(r,t).join(``)}),r=t,i=!1);let o=n[n.length-1];!a.path&&i&&o&&`tools`in o?o.tools.push(a):(n.push({tools:[a]}),i=!a.path)}return r<e.length&&n.push({text:e.slice(r).join(``)}),n});return(t,r)=>(L(),q(V(zC),{align:e.assistant?`start`:`end`},{default:I(()=>[A(V(BC),null,{default:I(()=>[A(V(am),{variant:e.assistant?`muted`:`tinted`,class:`max-w-[min(78ch,92%)]`},{default:I(()=>[A(V(om),{class:`[overflow-wrap:anywhere]`},{default:I(()=>[e.media.length?(L(),j(`div`,tne,[(L(!0),j(U,null,M(e.media,(e,t)=>(L(),q(GC,{key:t,attachment:e},null,8,[`attachment`]))),128))])):F(``,!0),e.assistant?(L(!0),j(U,{key:1},M(n.value,(t,r)=>(L(),j(U,{key:r},[`text`in t?(L(),q(ow,{key:0,text:t.text},null,8,[`text`])):(L(),q(V(cm),{key:1,class:`my-2`},{default:I(()=>[t.tools.length>1?(L(),q(ene,{key:0,tools:t.tools,streaming:e.streaming&&r===n.value.length-1},null,8,[`tools`,`streaming`])):(L(),q(sw,{key:1,tool:t.tools[0],streaming:e.streaming&&r===n.value.length-1},null,8,[`tool`,`streaming`]))]),_:2},1024))],64))),128)):(L(),j(`div`,nne,B(e.text),1)),K(t.$slots,`default`)]),_:3})]),_:3},8,[`variant`]),e.assistant&&!e.streaming&&e.text?(L(),q(V(VC),{key:0,class:`px-0 transition-opacity focus-within:opacity-100 [@media(hover:hover)]:opacity-0 [@media(hover:hover)]:group-hover/message:opacity-100`},{default:I(()=>[A(V(Dm),{value:e.text},null,8,[`value`])]),_:1})):F(``,!0)]),_:3})]),_:3},8,[`align`]))}}),ine={class:`text-sm`},ane={key:0,class:`mt-1 text-fg-muted`},one={key:1,class:`mt-2 flex flex-wrap gap-2`},sne=P({__name:`ChatChooseCard`,props:{choose:{}},setup(e){let t=Y(()=>od.value.models??[]);return(e,n)=>(L(),j(`div`,ine,[n[0]||=R(`p`,{class:`font-medium`},`Choose a model`,-1),t.value.length?(L(),j(`div`,one,[(L(!0),j(U,null,M(t.value,e=>(L(),q(V(X),{key:e,size:`sm`,variant:e===V(od).active_model?`default`:`outline`,class:`font-mono`,onClick:t=>void V(Sd)(e)},{default:I(()=>[H(B(e),1)]),_:2},1032,[`variant`,`onClick`]))),128))])):(L(),j(`p`,ane,`None configured.`))]))}}),cne={class:`text-sm`},lne={key:0},une={class:`mt-1 space-y-0.5`},dne={class:`font-mono`},fne=[`href`],pne={key:0,class:`mt-3 flex gap-2`},mne={key:1,class:`mt-2 text-fg-muted`},hne={key:2,class:`mt-2 text-fg-muted`},gne={key:3,class:`mt-2 text-ok`},_ne={key:4,class:`mt-2 text-danger`},vne={key:5,class:`mt-2 text-xs text-fg-muted`},yne=P({__name:`ChatUpdateCard`,props:{update:{}},setup(e){let t=e,n=Y(()=>t.update.available??[]),r=J(`idle`),i=J(``);async function a(){r.value=`installing`;try{let e=(await Z.updateInstall(t.update.snapshot)).result?.installed;i.value=e?Object.entries(e).map( Line truncated
`).map(e=>e.trim()).find(Boolean)||``,i=r.length>NT?`${r.slice(0,NT).trimEnd()}…`:r;return{text:i,full:n,truncated:i!==n}}function hie(e){return String(e||`event`).replaceAll(`_`,` `).replace(/\b\w/g,e=>e.toUpperCase())}function FT(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 IT(e){let t=Number(e);return!Number.isFinite(t)||t<=0?``:t.toLocaleString(`en-US`)}function LT(e){return typeof e==`string`?e:``}function RT(e={}){let t=e.data||{},n=e.stage||`unknown stage`,r=e.workflow?`${e.workflow} workflow`:``;if(e.kind===`stage_start`)return{title:`Started stage: ${n}`,detail:r};if(e.kind===`stage_finish`){let e=[r,FT(t.duration_ms)].filter(Boolean).join(` · `);return{title:t.interrupted?`Stage interrupted: ${n}`:t.skipped?`Skipped stage: ${n}`:t.error?`Stage failed: ${n}`:`Finished stage: ${n}`,detail:[e,LT(t.error),LT(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:[LT(t.previous_stage)&&`after ${LT(t.previous_stage)}`,LT(t.previous_reason)].filter(Boolean).join(`: `)||e.detail||``}}if(e.kind===`agent_finish`){let r=IT(t.iterations),i=IT(t.tokens),a=Number(t.cached_tokens)||0,o=IT((Number(t.prompt_tokens)||0)-a),s=IT(t.completion_tokens),c=IT(t.cached_tokens),l=[r&&`${r} iterations`,i&&`${i} tokens`,o&&`${o} fresh prompt`,s&&`${s} completion`,c&&`${c} cached`,LT(t.model)].filter(Boolean);return{title:`Agent ${LT(t.status)||`finished`}: ${n}`,detail:l.join(` · `)||e.detail||``}}if(e.kind===`remediation_round`){let e=Number(t.of),n=LT(t.author);return{title:`Remediation ${LT(t.round)}${e>0?` of ${e}`:``}`,detail:[n&&`answers ${n}'s review`,t.review_id?`#${LT(t.review_id)}`:``].filter(Boolean).join(` `)}}if(e.kind===`review_approved`){let e=LT(t.pr_number);return{title:`Pull request approved`,detail:[LT(t.author),e&&`#${e}`].filter(Boolean).join(` · `)}}if(e.kind===`step_retried`)return{title:`Attempt ${LT(t.attempt)} of ${LT(t.of)} failed: ${e.stage||`step`}`,detail:LT(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=LT(t.source),n=LT(t.capture_id),r=[{label:`binding ${LT(t.binding_name)||LT(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 ${LT(t.captured_after)}`:``].filter(Boolean).join(` · `)}}return{title:hie(e.kind||e.type),detail:e.detail||``}}var zT=[`title`],BT=P({__name:`ActivityRow`,props:{event:{}},emits:[`open`],setup(e,{emit:t}){let n=MT();n.watchIdentities();let r=e,i=t,a=xT(),o=Y(()=>a.taskIDFor(r.event)),s=Y(()=>PT(r.event,n.identityName));function c(){o.value>0&&i(`open`,o.value)}return(t,n)=>(L(),q(V(OT),{class:z(o.value>0?`cursor-pointer`:``),role:o.value>0?`link`:void 0,tabindex:o.value>0?0:void 0,title:o.value>0?`Open task details`:void 0,onClick:c,onKeydown:[gt(pt(c,[`prevent`]),[`enter`]),gt(pt(c,[`prevent`]),[`space`])]},{default:I(()=>[A(V(DT),{class:`font-medium`},{default:I(()=>[H(B(V(RT)({...r.event,at:void 0,detail:void 0}).title),1)]),_:1}),A(V(DT),{class:`font-mono`},{default:I(()=>[H(B(o.value>0?`#${o.value}`:`–`),1)]),_:1}),A(V(DT),{class:`w-[55%] max-w-0`},{default:I(()=>[R(`span`,{class:`block truncate`,title:s.value.truncated?s.value.full:void 0},B(s.value.text),9,zT)]),_:1}),A(V(DT),null,{default:I(()=>[A(V(dw),{at:e.event.at},null,8,[`at`])]),_:1})]),_:1},8,[`class`,`role`,`tabindex`,`title`,`onKeydown`]))}}),VT=[{value:`all`,label:`All`},{value:`tasks`,label:`Tasks`},{value:`system`,label:`System`}];function HT(e){return(Number(e?.task_id)||0)>0}function UT(e,t){return t===`tasks`?HT(e):t!==`system`||!HT(e)}function WT(e,t){return e.filter(e=>UT(e,t))}function GT(e,t){return e>0?``:t===`all`?`Waiting for activity`:t===`tasks`?`No task events yet`:`No system events yet`}function KT(e,t){return`${e}:${t??0}`}function qT(e){let t=[];for(let n of e){let e=n.kind||n.type||`event`,r=Number(n.task_id)||0,i=KT(PT(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 JT={role:`region`,"aria-label":`Activity`,"aria-live":`polite`},YT={class:`max-h-[28rem] overflow-y-auto`},XT={class:`inline-fleLine truncated
`,1)[0]??``;return t.length>80?`${t.slice(0,79)}…`:t}function fD(e){return(e?.merged||0)+(e?.completed||0)}function pD(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 mD(e,t){return e.filter(e=>e.required&&!(t[e.name]??``).trim()).map(e=>e.name)}function hD(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 gD(e,t){let n={};for(let r of e){let e=t[r.name];e!==void 0&&e!==``&&(n[r.name]=hD(e,r.type))}return n}var _D=[`onKeydown`],vD={key:0,class:`text-sm text-danger`,role:`alert`},yD={key:1,class:`grid gap-1.5`},bD=[`for`],xD={key:0,class:`font-normal text-fg-subtle`},SD=[`id`],CD=[`value`],wD={key:0,class:`text-xs text-fg-subtle`},TD={key:2,class:`grid gap-1.5`},ED=[`id`],DD={class:`block truncate text-label font-medium`},OD={class:`block text-xs text-fg-subtle`},kD={key:0,class:`text-xs text-fg-subtle`},AD={key:3,class:`grid gap-3`},jD=[`for`],MD={class:`font-mono`},ND={key:0,class:`text-fg-subtle`},PD={class:`grid gap-1.5`},FD=[`for`],ID={class:`grid gap-1.5`},LD=[`for`],RD={key:4,class:`text-sm text-danger`,role:`alert`},zD={class:`flex items-center gap-2 border-t border-border pt-4`},BD={class:`mr-auto text-xs text-fg-subtle`},VD=P({__name:`NewTaskForm`,props:{workflow:{},draft:{},initialWorkflow:{},initialInstructions:{}},emits:[`started`,`cancel`],setup(e,{emit:t}){let n=e,r=t,i=we(),a=J([]),o=J([]),s=J([]),c=J(``);Be(async()=>{try{let[e,t]=await Promise.all([Z.workflows(),Z.repositories()]);a.value=(e?.definitions??[]).filter(e=>e.enabled),o.value=e?.workflows??[],s.value=(t??[]).map(e=>`${e.owner}/${e.name}`)}catch(e){c.value=String(e.message||e)}});let l=J(``),u=J(n.workflow??n.initialWorkflow??``),d=J(n.initialInstructions??``),f=J(dD(d.value)),p=J({});Ce(()=>{!u.value&&a.value[0]&&(u.value=a.value[0].id)});let m=Y(()=>a.value.find(e=>e.id===u.value)),h=Y(()=>pD(m.value)),g=Y(()=>mD(h.value,p.value)),_=Y(()=>m.value?.repository??`required`),v=Y(()=>_.value!==`optional`&&_.value!==`none`),y=e=>o.value.find(t=>t.workflow===e),b=J(!1),x=J(``),S=Y(()=>!(!l.value.trim()&&v.value||!u.value||!f.value.trim())&&g.value.length===0);async function C(){if(S.value&&!b.value){b.value=!0,x.value=``;try{let e=await Z.workRequest({repository:_.value===`none`?``:l.value.trim(),workflow:u.value,title:f.value.trim(),instructions:d.value,inputs:gD(h.value,p.value),...n.draft?{draft:n.draft}:{}});r(`started`,e.task_id)}catch(e){x.value=String(e.message||e)}finally{b.value=!1}}}return(e,t)=>(L(),j(`form`,{class:`grid gap-5`,onSubmit:pt(C,[`prevent`]),onKeydown:[gt(pt(C,[`meta`,`prevent`]),[`enter`]),gt(pt(C,[`ctrl`,`prevent`]),[`enter`])]},[c.value?(L(),j(`p`,vD,B(c.value),1)):F(``,!0),_.value===`none`?F(``,!0):(L(),j(`div`,yD,[R(`label`,{for:`${V(i)}-repo`,class:`text-label font-medium`},[t[5]||=H(`Repository`,-1),v.value?F(``,!0):(L(),j(`span`,xD,` (optional)`))],8,bD),A(V(Q),{id:`${V(i)}-repo`,modelValue:l.value,"onUpdate:modelValue":t[0]||=e=>l.value=e,class:`font-mono`,placeholder:`owner/repository`,list:`${V(i)}-repos`,required:v.value},null,8,[`id`,`modelValue`,`list`,`required`]),R(`datalist`,{id:`${V(i)}-repos`},[(L(!0),j(U,null,M(s.value,e=>(L(),j(`option`,{key:e,value:e},null,8,CD))),128))],8,SD),s.value.length?(L(),j(`p`,wD,[t[6]||=H(`Configured: `,-1),(L(!0),j(U,null,M(s.value,e=>(L(),q(V(X),{key:e,type:`button`,variant:`link`,size:`xs`,class:`h-auto px-1 font-mono text-fg-subtle`,onClick:t=>l.value=e},{default:I(()=>[H(B(e),1)]),_:2},1032,[`onClick`]))),128))])):F(``,!0)])),n.workflow?F(``,!0):(L(),j(`div`,TD,[R(`span`,{id:`${V(i)}-wf`,class:`text-label font-medium`},`Workflow`,8,ED),A(V(Ws),{modelValue:u.value,"onUpdate:modelValue":t[1]||=e=>u.value=e,"aria-labelledby":`${V(i)}-wf`,class:`grid grid-cols-1 gap-2 sm:grid-cols-3`,loop:``},{default:I(()=>[(L(!0),j(U,null,M(a.value,e=>(L(),q(V(Ks),{key:e.id,value:e.id,class:`rounded-md border border-border bg-card px-3 py-2.5 text-left transition-colors hover:bg-secondary focus-visible:outline-2 focus-visible:outline-ring data-[state=checked]:border-primary data-[state=checked]:bg-secondary`},{default:I(()=>[R(`span`,DD,B(e.name||e.id),1),R(`span`,OD,[H(B(y(e.id)?.runs||0)+` runs`,1),y(e.id)?.runs?(L(),j(U,{key:0},[H(` · `+B(Math.round(V(fD)(y(e.id))/(y(e.id)?.runs||1)*100))+`% delivered`,1)],64)):F(``,!0)])]),_:2},1032,[`value`]))),128))]),_:1},8,[`modelValue`,`aria-labelledby`]),!a.value.length&&!c.value?(L(),j(`p`,kD,`No enabled workflows.`)):F(``,!0)])),h.value.length?(L(),j(`div`,AD,[(L(!0),j(U,null,M(h.value,e=>(L(),j(`div`,{key:e.name,class:`grid gap-1.5`},[R(`label`,{for:`${V(i)}-input-${e.name}`,class:`text-label font-medium`},[R(`span`,MD,B(e.name),1),e.required?(L(),j(`span`,ND,` · required`)):F(``,!0)],8,jD),A(V(Q),{id:`${V(i)}-input-${e.name}`,"model-value":p.value[e.name Line truncated
`)){let e=n.indexOf(`:`);if(e<=0)continue;let r=n.slice(0,e).trim();r&&(t[r]=n.slice(e+1).trim())}return t}function rO(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 iO(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 aO(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 oO(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 sO=J([]),cO=J([]),lO=J(!0),uO=J(null),dO=J(!0),fO=J(null),pO=J(!1),mO=J(null);async function hO(){try{let e=await Z.eventTypes(tO().workspace);lO.value=e.enabled!==!1,sO.value=e.event_types||[],cO.value=e.proposals||[],uO.value=null}catch(e){uO.value=e.message||String(e)}finally{dO.value=!1}}function gO(e){return{headers:(e.headers||[]).map(e=>({...e})),payload:(e.payload||[]).map(e=>({...e}))}}function _O(e){mO.value=null,fO.value=e}function vO(e){let t=EO.value.find(t=>String(t.id)===e.sample_id);_O({mode:`proposal`,id:null,source:e.source,name:``,rule:gO(e.rule),headersText:``,body:t?.body||``,exampleHeaders:e.headers||{}})}function yO(e=``){_O({mode:`paste`,id:null,source:e,name:``,rule:{headers:[],payload:[]},headersText:``,body:``,exampleHeaders:{}})}function bO(e){_O({mode:`edit`,id:e.id,source:e.source,name:e.name,rule:gO(e.rule),headersText:``,body:``,exampleHeaders:{}})}function xO(){fO.value=null}async function SO(){let e=fO.value;if(e){pO.value=!0;try{if(e.mode===`edit`&&e.id)await Z.eventTypeUpdate(e.id,{name:e.name,rule:oO(e.rule)});else{let t=e.mode===`paste`?nO(e.headersText):e.exampleHeaders;await Z.eventTypeCreate({source:e.source,name:e.name,rule:e.mode===`paste`?void 0:oO(e.rule),example:{headers:t,body:e.body}})}fO.value=null,await hO()}catch(e){mO.value=e.message||String(e)}finally{pO.value=!1}}}var CO=J(null);async function wO(){let e=CO.value;if(CO.value=null,e)try{await Z.eventTypeDelete(e.id),await hO()}catch(e){uO.value=e.message||String(e)}}var TO=100,EO=J([]),DO=J(!0),OO=J(null),kO=J(!0),AO=J(null);async function jO(){try{let e=await Z.captures(TO);DO.value=e.enabled!==!1,EO.value=e.captures||[],OO.value=null}catch(e){OO.value=e.message||String(e)}finally{kO.value=!1}}function MO(e){let t=EO.value.find(t=>t.id===e);return t&&(AO.value=t),!!t}function NO(){EO.value.length&&(AO.value=EO.value[0])}function PO(){tp(`captures`,()=>{jO(),hO()})}var FO=P({__name:`Tabs`,props:{defaultValue:{},orientation:{},dir:{},activationMode:{},modelValue:{},unmountOnHide:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,i=ct(n,`class`),a=w(i,r);return(e,t)=>(L(),q(V(zc),G({"data-slot":`tabs`,"data-orientation":V(a).orientation||`horizontal`},V(a),{class:V(W)(`gap-2 group/tabs flex data-horizontal:flex-col`,n.class)}),{default:I(t=>[K(e.$slots,`default`,Je(be(t)))]),_:3},16,[`data-orientation`,`class`]))}}),IO=P({__name:`TabsContent`,props:{value:{},forceMount:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e,n=ct(t,`class`);return(e,r)=>(L(),q(V(Hc),G({"data-slot":`tabs-content`,class:V(W)(`text-sm flex-1 outline-none`,t.class)},V(n)),{default:I(()=>[K(e.$slots,`default`)]),_:3},16,[`class`]))}}),LO=P({__name:`TabsList`,props:{loop:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]},variant:{default:`default`}},setup(e){let t=e,n=ct(t,`class`,`variant`);return(r,i)=>(L(),q(V(Uc),G({"data-slot":`tabs-list`,"data-variant":e.variant},V(n),{class:V(W)(V(zO)({variant:e.variant}),t.class)}),{default:I(()=>[K(r.$slots,`default`)]),_:3},16,[`data-variant`,`class`]))}}),RO=P({__name:`TabsTrigger`,props:{value:{},disabled:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e,n=ct(t,`class`),r=C(n);return(e,n)=>(L(),q(V(Wc),G({"data-slot":`tabs-trigger`,class:V(W)(`gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg:not([class*=size-])]:size-4 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:oLine truncated
`));return(t,i)=>e.tool.path?(j(),U(Tb,{key:0,path:e.tool.path,label:e.tool.label},null,8,[`path`,`label`])):d.value?(j(),U(L(Np),{key:1,"default-open":a.value},{default:A(()=>[r(L(Ip),null,{default:A(()=>[r(L(Rp),{status:a.value?`error`:c.value?`running`:void 0},{default:A(()=>[r(L(Fp),null,{default:A(()=>[a.value?(j(),U(L(zc),{key:0})):c.value?(j(),U(L(il),{key:1,class:`animate-spin`})):(j(),U(L(Fc),{key:2,class:`text-success`}))]),_:1}),N(`span`,Eb,I(n.value),1),r(L(zp),{class:`font-mono text-xs`},{default:A(()=>[R(I(u.value),1)]),_:1}),l.value?(j(),o(`span`,Db,I(l.value),1)):T(``,!0)]),_:1},8,[`status`])]),_:1}),r(L(Pp),null,{default:A(()=>[r(L(Vp),{size:`sm`},{default:A(()=>[r(L(Kp),{wrap:``,class:`max-h-64`},{default:A(()=>[R(I(d.value),1)]),_:1})]),_:1})]),_:1})]),_:1},8,[`default-open`])):(j(),U(L(Rp),{key:2,status:a.value?`error`:c.value?`running`:void 0},{default:A(()=>[r(L(Fp),null,{default:A(()=>[a.value?(j(),U(L(zc),{key:0})):c.value?(j(),U(L(il),{key:1,class:`animate-spin`})):(j(),U(L(Fc),{key:2,class:`text-success`}))]),_:1}),N(`span`,Ob,I(n.value),1),r(L(zp),{class:`font-mono text-xs`},{default:A(()=>[R(I(u.value),1)]),_:1}),l.value?(j(),o(`span`,kb,I(l.value),1)):T(``,!0)]),_:1},8,[`status`]))}}),jb={class:`flex flex-col gap-1.5`},Mb=y({__name:`ChatToolGroup`,props:{tools:{},streaming:{type:Boolean}},setup(e){let t=e,n=e=>!!(e.err||e.Err||e.failed),i=G(()=>t.tools.some(n)),a=G(()=>`${t.tools.length} tool call${t.tools.length===1?``:`s`}`);return(t,n)=>(j(),U(L(Np),{"default-open":i.value},{default:A(()=>[r(L(Ip),null,{default:A(()=>[r(L(Rp),{status:i.value?`error`:void 0},{default:A(()=>[r(L(Fp),null,{default:A(()=>[r(L(Bl))]),_:1}),r(L(zp),{class:`truncate`},{default:A(()=>[R(I(a.value),1)]),_:1})]),_:1},8,[`status`])]),_:1}),r(L(Pp),null,{default:A(()=>[N(`div`,jb,[(j(!0),o(z,null,s(e.tools,(t,n)=>(j(),U(Ab,{key:n,tool:t,streaming:e.streaming&&n===e.tools.length-1},null,8,[`tool`,`streaming`]))),128))])]),_:1})]),_:1},8,[`default-open`]))}}),Nb={key:0,class:`mb-2 flex flex-wrap gap-1.5`},Pb={key:2,class:`whitespace-pre-wrap`},Fb=y({__name:`ChatBubble`,props:{text:{},tools:{default:()=>[]},media:{default:()=>[]},assistant:{type:Boolean,default:!1},streaming:{type:Boolean,default:!1}},setup(e){let t=e,n=G(()=>{let e=Array.from(t.text),n=[],r=0,i=!1;for(let a of t.tools){let t=Math.min(Math.max(a.text_offset??0,r),e.length);t>r&&(n.push({text:e.slice(r,t).join(``)}),r=t,i=!1);let o=n[n.length-1];!a.path&&i&&o&&`tools`in o?o.tools.push(a):(n.push({tools:[a]}),i=!a.path)}return r<e.length&&n.push({text:e.slice(r).join(``)}),n});return(t,i)=>(j(),U(L(Jy),{align:e.assistant?`start`:`end`},{default:A(()=>[r(L(Yy),null,{default:A(()=>[r(L(Ep),{variant:e.assistant?`muted`:`tinted`,class:`max-w-[min(78ch,92%)]`},{default:A(()=>[r(L(Dp),{class:`[overflow-wrap:anywhere]`},{default:A(()=>[e.media.length?(j(),o(`div`,Nb,[(j(!0),o(z,null,s(e.media,(e,t)=>(j(),U(eb,{key:t,attachment:e},null,8,[`attachment`]))),128))])):T(``,!0),e.assistant?(j(!0),o(z,{key:1},s(n.value,(t,r)=>(j(),o(z,{key:r},[`text`in t?(j(),U(Cb,{key:0,text:t.text},null,8,[`text`])):(j(),U(L(kp),{key:1,class:`my-2`},{default:A(()=>[t.tools.length>1?(j(),U(Mb,{key:0,tools:t.tools,streaming:e.streaming&&r===n.value.length-1},null,8,[`tools`,`streaming`])):(j(),U(Ab,{key:1,tool:t.tools[0],streaming:e.streaming&&r===n.value.length-1},null,8,[`tool`,`streaming`]))]),_:2},1024))],64))),128)):(j(),o(`div`,Pb,I(e.text),1)),H(t.$slots,`default`)]),_:3})]),_:3},8,[`variant`]),e.assistant&&!e.streaming&&e.text?(j(),U(L(Xy),{key:0,class:`px-0 transition-opacity focus-within:opacity-100 [@media(hover:hover)]:opacity-0 [@media(hover:hover)]:group-hover/message:opacity-100`},{default:A(()=>[r(L(Jp),{value:e.text},null,8,[`value`])]),_:1})):T(``,!0)]),_:3})]),_:3},8,[`align`]))}}),Ib={class:`text-sm`},Lb={key:0,class:`mt-1 text-fg-muted`},Rb={key:1,class:`mt-2 flex flex-wrap gap-2`},zb=y({__name:`ChatChooseCard`,props:{choose:{}},setup(e){let t=G(()=>Tu.value.models??[]);return(e,n)=>(j(),o(`div`,Ib,[n[0]||=N(`p`,{class:`font-medium`},`Choose a model`,-1),t.value.length?(j(),o(`div`,Rb,[(j(!0),o(z,null,s(t.value,e=>(j(),U(L(K),{key:e,size:`sm`,variant:e===L(Tu).active_model?`default`:`outline`,class:`font-mono`,onClick:t=>void L(Uu)(e)},{default:A(()=>[R(I(e),1)]),_:2},1032,[`variant`,`onClick`]))),128))])):(j(),o(`p`,Lb,`None configured.`))]))}}),Bb={class:`text-sm`},Vb={key:0},Hb={class:`mt-1 space-y-0.5`},Ub={class:`font-mono`},Wb=[`href`],Gb={key:0,class:`mt-3 flex gap-2`},Kb={key:1,class:`mt-2 text-fg-muted`},qb={key:2,class:`mt-2 text-fg-muted`},Jb={key:3,class:`mt-2 text-ok`},Yb={key:4,class:`mt-2 text-danger`},Xb={key:5,class:`mt-2 text-xs text-fg-muted`},Zb=y({__name:`ChatUpdateCard`,props:{update:{}},setup(e){let t=e,n=G(()=>t.update.available??[]),i=W(`idle`),a=W(``);async function c(){i.value=`installing`;try{let e=(await J.updateInstall(t.update.snapshot)).result?.installed;a.value=e?Object.entries(e).map(([e,t])=>`${e} → ${t}`).join(`, Line truncated
`).map(e=>e.trim()).find(Boolean)||``,i=r.length>_w?`${r.slice(0,_w).trimEnd()}…`:r;return{text:i,full:n,truncated:i!==n}}function Pae(e){return String(e||`event`).replaceAll(`_`,` `).replace(/\b\w/g,e=>e.toUpperCase())}function yw(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 bw(e){let t=Number(e);return!Number.isFinite(t)||t<=0?``:t.toLocaleString(`en-US`)}function xw(e){return typeof e==`string`?e:``}function Sw(e={}){let t=e.data||{},n=e.stage||`unknown stage`,r=e.workflow?`${e.workflow} workflow`:``;if(e.kind===`stage_start`)return{title:`Started stage: ${n}`,detail:r};if(e.kind===`stage_finish`){let e=[r,yw(t.duration_ms)].filter(Boolean).join(` · `);return{title:t.interrupted?`Stage interrupted: ${n}`:t.skipped?`Skipped stage: ${n}`:t.error?`Stage failed: ${n}`:`Finished stage: ${n}`,detail:[e,xw(t.error),xw(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:[xw(t.previous_stage)&&`after ${xw(t.previous_stage)}`,xw(t.previous_reason)].filter(Boolean).join(`: `)||e.detail||``}}if(e.kind===`agent_finish`){let r=bw(t.iterations),i=bw(t.tokens),a=Number(t.cached_tokens)||0,o=bw((Number(t.prompt_tokens)||0)-a),s=bw(t.completion_tokens),c=bw(t.cached_tokens),l=[r&&`${r} iterations`,i&&`${i} tokens`,o&&`${o} fresh prompt`,s&&`${s} completion`,c&&`${c} cached`,xw(t.model)].filter(Boolean);return{title:`Agent ${xw(t.status)||`finished`}: ${n}`,detail:l.join(` · `)||e.detail||``}}if(e.kind===`remediation_round`){let e=Number(t.of),n=xw(t.author);return{title:`Remediation ${xw(t.round)}${e>0?` of ${e}`:``}`,detail:[n&&`answers ${n}'s review`,t.review_id?`#${xw(t.review_id)}`:``].filter(Boolean).join(` `)}}if(e.kind===`review_approved`){let e=xw(t.pr_number);return{title:`Pull request approved`,detail:[xw(t.author),e&&`#${e}`].filter(Boolean).join(` · `)}}if(e.kind===`step_retried`)return{title:`Attempt ${xw(t.attempt)} of ${xw(t.of)} failed: ${e.stage||`step`}`,detail:xw(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=xw(t.source),n=xw(t.capture_id),r=[{label:`binding ${xw(t.binding_name)||xw(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 ${xw(t.captured_after)}`:``].filter(Boolean).join(` · `)}}return{title:Pae(e.kind||e.type),detail:e.detail||``}}var Fae=[`title`],Cw=y({__name:`ActivityRow`,props:{event:{}},emits:[`open`],setup(e,{emit:t}){let n=gw();n.watchIdentities();let i=e,a=t,o=aw(),s=G(()=>o.taskIDFor(i.event)),c=G(()=>vw(i.event,n.identityName));function l(){s.value>0&&a(`open`,s.value)}return(t,n)=>(j(),U(L(fw),{class:F(s.value>0?`cursor-pointer`:``),role:s.value>0?`link`:void 0,tabindex:s.value>0?0:void 0,title:s.value>0?`Open task details`:void 0,onClick:l,onKeydown:[Fe(Me(l,[`prevent`]),[`enter`]),Fe(Me(l,[`prevent`]),[`space`])]},{default:A(()=>[r(L(Z),{class:`font-medium`},{default:A(()=>[R(I(L(Sw)({...i.event,at:void 0,detail:void 0}).title),1)]),_:1}),r(L(Z),{class:`font-mono`},{default:A(()=>[R(I(s.value>0?`#${s.value}`:`–`),1)]),_:1}),r(L(Z),{class:`w-[55%] max-w-0`},{default:A(()=>[N(`span`,{class:`block truncate`,title:c.value.truncated?c.value.full:void 0},I(c.value.text),9,Fae)]),_:1}),r(L(Z),null,{default:A(()=>[r(L(ux),{at:e.event.at},null,8,[`at`])]),_:1})]),_:1},8,[`class`,`role`,`tabindex`,`title`,`onKeydown`]))}}),Iae=[{value:`all`,label:`All`},{value:`tasks`,label:`Tasks`},{value:`system`,label:`System`}];function ww(e){return(Number(e?.task_id)||0)>0}function Lae(e,t){return t===`tasks`?ww(e):t!==`system`||!ww(e)}function Rae(e,t){return e.filter(e=>Lae(e,t))}function zae(e,t){return e>0?``:t===`all`?`Waiting for activity`:t===`tasks`?`No task events yet`:`No system events yet`}function Bae(e,t){return`${e}:${t??0}`}function Vae(e){let t=[];for(let n of e){let e=n.kind||n.type||`event`,r=Number(n.task_id)||0,i=Bae(vw(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 Hae={role:`region`,"aria-label":`Activity`,"aria-live":`polite`},Uae={class:`max-h-[28rem] overflow-y-auto`},Wae={class:`iLine truncated
`,1)[0]??``;return t.length>80?`${t.slice(0,79)}…`:t}function sT(e){return(e?.merged||0)+(e?.completed||0)}function cT(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 woe(e,t){return e.filter(e=>e.required&&!(t[e.name]??``).trim()).map(e=>e.name)}function lT(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 Toe(e,t){let n={};for(let r of e){let e=t[r.name];e!==void 0&&e!==``&&(n[r.name]=lT(e,r.type))}return n}var Eoe=[`onKeydown`],Doe={key:0,class:`text-sm text-danger`,role:`alert`},Ooe={key:1,class:`grid gap-1.5`},koe=[`for`],Aoe={key:0,class:`font-normal text-fg-subtle`},joe=[`id`],Moe=[`value`],Noe={key:0,class:`text-xs text-fg-subtle`},Poe={key:2,class:`grid gap-1.5`},Foe=[`id`],Ioe={class:`block truncate text-label font-medium`},Loe={class:`block text-xs text-fg-subtle`},Roe={key:0,class:`text-xs text-fg-subtle`},zoe={key:3,class:`grid gap-3`},Boe=[`for`],Voe={class:`font-mono`},Hoe={key:0,class:`text-fg-subtle`},Uoe={class:`grid gap-1.5`},Woe=[`for`],Goe={class:`grid gap-1.5`},Koe=[`for`],qoe={key:4,class:`text-sm text-danger`,role:`alert`},Joe={class:`flex items-center gap-2 border-t border-border pt-4`},Yoe={class:`mr-auto text-xs text-fg-subtle`},uT=y({__name:`NewTaskForm`,props:{workflow:{},draft:{},initialWorkflow:{},initialInstructions:{}},emits:[`started`,`cancel`],setup(e,{emit:t}){let n=e,i=t,a=v(),c=W([]),l=W([]),u=W([]),d=W(``);P(async()=>{try{let[e,t]=await Promise.all([J.workflows(),J.repositories()]);c.value=(e?.definitions??[]).filter(e=>e.enabled),l.value=e?.workflows??[],u.value=(t??[]).map(e=>`${e.owner}/${e.name}`)}catch(e){d.value=String(e.message||e)}});let f=W(``),p=W(n.workflow??n.initialWorkflow??``),m=W(n.initialInstructions??``),h=W(oT(m.value)),g=W({});_(()=>{!p.value&&c.value[0]&&(p.value=c.value[0].id)});let y=G(()=>c.value.find(e=>e.id===p.value)),b=G(()=>cT(y.value)),x=G(()=>woe(b.value,g.value)),S=G(()=>y.value?.repository??`required`),C=G(()=>S.value!==`optional`&&S.value!==`none`),w=e=>l.value.find(t=>t.workflow===e),E=W(!1),D=W(``),O=G(()=>!(!f.value.trim()&&C.value||!p.value||!h.value.trim())&&x.value.length===0);async function k(){if(O.value&&!E.value){E.value=!0,D.value=``;try{let e=await J.workRequest({repository:S.value===`none`?``:f.value.trim(),workflow:p.value,title:h.value.trim(),instructions:m.value,inputs:Toe(b.value,g.value),...n.draft?{draft:n.draft}:{}});i(`started`,e.task_id)}catch(e){D.value=String(e.message||e)}finally{E.value=!1}}}return(e,t)=>(j(),o(`form`,{class:`grid gap-5`,onSubmit:Me(k,[`prevent`]),onKeydown:[Fe(Me(k,[`meta`,`prevent`]),[`enter`]),Fe(Me(k,[`ctrl`,`prevent`]),[`enter`])]},[d.value?(j(),o(`p`,Doe,I(d.value),1)):T(``,!0),S.value===`none`?T(``,!0):(j(),o(`div`,Ooe,[N(`label`,{for:`${L(a)}-repo`,class:`text-label font-medium`},[t[5]||=R(`Repository`,-1),C.value?T(``,!0):(j(),o(`span`,Aoe,` (optional)`))],8,koe),r(L(Y),{id:`${L(a)}-repo`,modelValue:f.value,"onUpdate:modelValue":t[0]||=e=>f.value=e,class:`font-mono`,placeholder:`owner/repository`,list:`${L(a)}-repos`,required:C.value},null,8,[`id`,`modelValue`,`list`,`required`]),N(`datalist`,{id:`${L(a)}-repos`},[(j(!0),o(z,null,s(u.value,e=>(j(),o(`option`,{key:e,value:e},null,8,Moe))),128))],8,joe),u.value.length?(j(),o(`p`,Noe,[t[6]||=R(`Configured: `,-1),(j(!0),o(z,null,s(u.value,e=>(j(),U(L(K),{key:e,type:`button`,variant:`link`,size:`xs`,class:`h-auto px-1 font-mono text-fg-subtle`,onClick:t=>f.value=e},{default:A(()=>[R(I(e),1)]),_:2},1032,[`onClick`]))),128))])):T(``,!0)])),n.workflow?T(``,!0):(j(),o(`div`,Poe,[N(`span`,{id:`${L(a)}-wf`,class:`text-label font-medium`},`Workflow`,8,Foe),r(L(os),{modelValue:p.value,"onUpdate:modelValue":t[1]||=e=>p.value=e,"aria-labelledby":`${L(a)}-wf`,class:`grid grid-cols-1 gap-2 sm:grid-cols-3`,loop:``},{default:A(()=>[(j(!0),o(z,null,s(c.value,e=>(j(),U(L(ss),{key:e.id,value:e.id,class:`rounded-md border border-border bg-card px-3 py-2.5 text-left transition-colors hover:bg-secondary focus-visible:outline-2 focus-visible:outline-ring data-[state=checked]:border-primary data-[state=checked]:bg-secondary`},{default:A(()=>[N(`span`,Ioe,I(e.name||e.id),1),N(`span`,Loe,[R(I(w(e.id)?.runs||0)+` runs`,1),w(e.id)?.runs?(j(),o(z,{key:0},[R(` · `+I(Math.round(L(sT)(w(e.id))/(w(e.id)?.runs||1)*100))+`% delivered`,1)],64)):T(``,!0)])]),_:2},1032,[`value`]))),128))]),_:1},8,[`modelValue`,`aria-labelledby`]),!c.value.length&&!d.value?(j(),o(`p`,Roe,`No enabled workflows.`)):T(``,!0)])),b.value.length?(j(),o(`div`,zoe,[(j(!0),o(z,null,s(b.value,e=>(j(),o(`div`,{key:e.name,class:`grid gap-1.5`},[N(`label`,{for:`${L(a)}-input-${e.name}`,class:`text-label font-medium`},[N(`span`,Voe,I(e.name),1),e.required?(j(),o(`span`,Hoe,` · required`)):T(``,!0)],8,Boe),r(L(Y),{id:`${L(a)}-inpuLine 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 cse(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 mT(e,t){if(!e)return`No event type`;let n=t.find(t=>t.id===e);return n?`${n.source} / ${n.name}`:`Deleted type`}function hT(e){let t=[...(e.headers||[]).map(e=>`${e.name} = ${e.value}`),...(e.payload||[]).map(e=>e.op===`present`?`${e.path} present`:`${e.path} = ${e.value??``}`)];return t.length?t.join(` · `):`any event`}function gT(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 _T=W([]),vT=W([]),yT=W(!0),bT=W(null),xT=W(!0),ST=W(null),CT=W(!1),wT=W(null);async function TT(){try{let e=await J.eventTypes(pT().workspace);yT.value=e.enabled!==!1,_T.value=e.event_types||[],vT.value=e.proposals||[],bT.value=null}catch(e){bT.value=e.message||String(e)}finally{xT.value=!1}}function ET(e){return{headers:(e.headers||[]).map(e=>({...e})),payload:(e.payload||[]).map(e=>({...e}))}}function DT(e){wT.value=null,ST.value=e}function lse(e){let t=AT.value.find(t=>String(t.id)===e.sample_id);DT({mode:`proposal`,id:null,source:e.source,name:``,rule:ET(e.rule),headersText:``,body:t?.body||``,exampleHeaders:e.headers||{}})}function use(e=``){DT({mode:`paste`,id:null,source:e,name:``,rule:{headers:[],payload:[]},headersText:``,body:``,exampleHeaders:{}})}function dse(e){DT({mode:`edit`,id:e.id,source:e.source,name:e.name,rule:ET(e.rule),headersText:``,body:``,exampleHeaders:{}})}function OT(){ST.value=null}async function fse(){let e=ST.value;if(e){CT.value=!0;try{if(e.mode===`edit`&&e.id)await J.eventTypeUpdate(e.id,{name:e.name,rule:gT(e.rule)});else{let t=e.mode===`paste`?sse(e.headersText):e.exampleHeaders;await J.eventTypeCreate({source:e.source,name:e.name,rule:e.mode===`paste`?void 0:gT(e.rule),example:{headers:t,body:e.body}})}ST.value=null,await TT()}catch(e){wT.value=e.message||String(e)}finally{CT.value=!1}}}var kT=W(null);async function pse(){let e=kT.value;if(kT.value=null,e)try{await J.eventTypeDelete(e.id),await TT()}catch(e){bT.value=e.message||String(e)}}var mse=100,AT=W([]),jT=W(!0),MT=W(null),NT=W(!0),PT=W(null);async function FT(){try{let e=await J.captures(mse);jT.value=e.enabled!==!1,AT.value=e.captures||[],MT.value=null}catch(e){MT.value=e.message||String(e)}finally{NT.value=!1}}function hse(e){let t=AT.value.find(t=>t.id===e);return t&&(PT.value=t),!!t}function gse(){AT.value.length&&(PT.value=AT.value[0])}function _se(){Sf(`captures`,()=>{FT(),TT()})}var IT=y({__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=De(n,`class`),a=mt(i,r);return(e,t)=>(j(),U(L(xs),V({"data-slot":`tabs`,"data-orientation":L(a).orientation||`horizontal`},L(a),{class:L(B)(`gap-2 group/tabs flex data-horizontal:flex-col`,n.class)}),{default:A(t=>[H(e.$slots,`default`,fe(m(t)))]),_:3},16,[`data-orientation`,`class`]))}}),LT=y({__name:`TabsContent`,props:{value:{},forceMount:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e,n=De(t,`class`);return(e,r)=>(j(),U(L(ws),V({"data-slot":`tabs-content`,class:L(B)(`text-sm flex-1 outline-none`,t.class)},L(n)),{default:A(()=>[H(e.$slots,`default`)]),_:3},16,[`class`]))}}),RT=y({__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=De(t,`class`,`variant`);return(r,i)=>(j(),U(L(Ts),V({"data-slot":`tabs-list`,"data-variant":e.variant},L(n),{class:L(B)(L(vse)({variant:e.variant}),t.class)}),{default:A(()=>[H(r.$slots,`default`)]),_:3},16,[`data-variant`,`class`]))}}),zT=y({__name:`TabsTrigger`,props:{value:{},disabled:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let t=e,n=De(t,`class`),r=pt(n);return(e,n)=>(j(),U(L(Es),V({"data-slot":`tabs-trigger`,class:L(B)(`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 fLine truncated
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(`
`)}\n};`)(...Object.values(this.closed))}},fL={major:4,minor:6,patch:7},pL=Q(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=fL;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=fF(t),a;for(let o of n){if(o._zod.def.when){if(pF(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new VF;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(_F(t.issues,n,e),i||=fF(t,n))});else{if(t.issues.length===n)continue;_F(t.issues,n,e),i||=fF(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(fF(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new VF;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new VF;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return EF(this,`~standard`,gL(this))},set"~standard"(e){TF(this,`~standard`,e)}}),mL=(e,t)=>e.issues.length?{issues:e.issues.map(e=>vF(e,t,WF()))}:{value:e.value};async function hL(e,t){let n={async:!0};return mL(await e._zod.run({value:t,issues:[]},n),n)}function gL(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return mL(r,n)}catch{}return hL(e,t)},vendor:`zod`,version:1}}var _L=Q(`$ZodString`,(e,t)=>{pL.init(e,t),e._zod.pattern=t.pattern??qI,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),vL=Q(`$ZodStringFormat`,(e,t)=>{rL.init(e,t),_L.init(e,t)}),yL=Q(`$ZodGUID`,(e,t)=>{t.pattern??=OI,vL.init(e,t)}),bL=Q(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=kI(e)}else t.pattern??=kI();vL.init(e,t)}),xL=Q(`$ZodEmail`,(e,t)=>{t.pattern??=AI,vL.init(e,t)});function SL(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function CL(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?SL(e)||2:wL(e,t)}function wL(e,t){if(!t.normalize&&t.protocol?.source===zI.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}var TL=/[\t\n\r]/g;function EL(e){return e.replace(TL,``)}function DL(e,t){return t.lastIndex=0,t.test(e.hostname)}function OL(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var kL=Q(`$ZodURL`,(e,t)=>{vL.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=CL(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=EL(r);return}t.hostname&&!DL(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!OL(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:EL(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),AL=Q(`$ZodEmoji`,(e,t)=>{t.pattern??=MI(),vL.init(e,t)}),jL=Q(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?TI:EI(t.length),vL.init(e,t)}),ML=Q(`$ZodCUID`,(e,t)=>{t.pattern??=bI,vL.init(e,t)}),NL=Q(`$ZodCUID2`,(e,t)=>{t.pattern??=xI,vL.init(e,t)}),PL=Q(`$ZodULID`,(e,t)=>{t.pattern??=SI,vL.init(e,t)}),FL=Q(`$ZodXID`,(e,t)=>{t.pattern??=CI,vL.init(e,t)}),IL=Q(`$ZodKSUID`,(e,t)=>{t.pattern??=wI,vL.init(e,t)}),LL=Q(`$ZodISODateTime`,(e,t)=>{t.pattern??=KI(t),vL.init(e,t)}),RL=Q(`$ZodISODate`,(e,t)=>{t.pattern??=UI,vL.init(e,t)}),zL=Q(`$ZodISOTime`,(e,t)=>{t.pattern??=GI(t),vL.init(e,t)}),BL=Q(`$ZodISODuration`,(e,t)=>{t.pattern??=DI,vL.init(e,t)}),VL=Q(`$ZodIPv4`,(e,t)=>{t.pattern??=NI,vL.init(e,t)}),HL=/^[0-9a-fA-F:.]+$/;function UL(e){return HL.test(e)?SL(`http://[${e}]`):!1}var WL=Q(`$ZodIPv6`,(e,t)=>{t.pattern??=PI,vL.init(e,t),e._zod.check=n=>{UL(n.value)||n.issues.push({codLine truncated
let ${e}_ab = false;
for (let i = 0; i < ${e}.issues.length; i++) {
const iss = ${e}.issues[i];
iss.path = iss.path ? [${t}, ...iss.path] : [${t}];
payload.issues.push(iss);
if (iss.continue !== true) ${e}_ab = true;
}
if (${e}_ab && ctx && ctx.abortEarly) {
payload.value = newResult;
return payload;
}`;o.write(`const input = payload.value;`);let l=Object.create(null),u=0;for(let e of n.allKeys)l[e]=`key_${u++}`;o.write(i?`const newResult = memo.alloc(inst, payload, {}, ctx);`:`const newResult = {};`);for(let e of n.allKeys){if(e===`__proto__`)continue;let n=l[e],r=typeof e==`symbol`?`syms[${a.indexOf(e)}]`:HP(e),i=`${r} in input`,u=t[e],d=u?._zod?.optin,f=d!==void 0,p=u?._zod?.optout===`optional`;if(o.write(`const ${n} = ${s(r)};`),f&&p){let e=d===`optional`?`${n}_present`:`${n}.value !== undefined || ${n}_present`;o.write(`
const ${n}_present = ${i};
if (!${n}.issues.length || ${n}_present) {
if (${n}.issues.length) {${c(n,r)}
}
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 sV=qB(`CharSizeService`),cV=qB(`CoreBrowserService`),lV=qB(`MouseService`),uV=qB(`RenderService`),dV=qB(`SelectionService`),fV=qB(`CharacterJoinerService`),pV=qB(`ThemeService`),mV=qB(`LinkProviderService`),hV=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?xV.isErrorNoTelemetry(e)?new xV(e.message+`
if (${e}) {
newResult[${r}] = ${n}.value;
}
}
`)}else f?(o.write(`
if (${n}.issues.length) {${c(n,r)}
}
`),d===`defaulted`?o.write(`newResult[${r}] = ${n}.value;`):o.write(`
if (${n}.value !== undefined || ${i}) {
newResult[${r}] = ${n}.value;
}
`)):o.write(`
const ${n}_present = ${i};
if (${n}.issues.length) {${c(n,r)}
}
if (!${n}_present && !${n}.issues.length) {
payload.issues.push({
code: "invalid_type",
expected: "nonoptional",
input: undefined,
path: [${r}]
});
if (ctx && ctx.abortEarly) {
payload.value = newResult;
return payload;
}
}
if (${n}_present) {
newResult[${r}] = ${n}.value;
}
`)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=GP,c=!UF.jitless,l=c&&KP.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?fR([],p,i,f,d,e,f?.abortEarly===!0):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function hR(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!fF(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>vF(e,r,WF())))}),t)}var gR=Q(`$ZodUnion`,(e,t)=>{pL.init(e,t),NF(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),NF(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),NF(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),NF(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>NP(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>hR(t,r,e,i)):hR(o,r,e,i)}}),_R=Q(`$ZodIntersection`,(e,t)=>{pL.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>yR(e,t,n)):yR(e,i,a)}});function vR(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(qP(e)&&qP(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=vR(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=vR(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function yR(e,t,n){let r=new Map,i,a=new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=vR(t.value,n.value);if(!c.valid){if(fF(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var bR=Q(`$ZodEnum`,(e,t)=>{pL.init(e,t);let n=DP(t.entries),r=new Set(n);e._zod.values=r,NF(e,`pattern`,e=>{let t=DP(e.def.entries).filter(e=>YP.has(typeof e));return RegExp(t.length?`^(${t.map(e=>XP(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),xR=Q(`$ZodTransform`,(e,t)=>{pL.init(e,t),e._zod.optin=`optional`,UF.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new HF(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new VF;return n.value=i,n}});function SR(e,t){return e.value=t.issues.length?void 0:t.value,e}var CR=Q(`$ZodOptional`,(e,t)=>{pL.init(e,t),NF(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,NF(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),NF(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${NP(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>SR(e,t)):SR(e,r)}return t.innerType._zod.run(e,n)}}),wR=Q(`$ZodExactOptional`,(e,t)=>{CR.init(e,t),NF(e,`values`,e=>e.def.innerType._zod.values),NF(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),TR=Q(`$ZodNullable`,(e,t)=>{pL.init(e,t),NF(e,`optin`,e=>e.def.innerType._zod.optin),NF(e,`optoutLine truncated
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0])a(n);else{if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}(e.metadataRegistry.get(n[0])?.id||r.cycle||r.count>1&&e.reused===`ref`)&&a(n)}}e.external&&(e.sharedDefsExtractedFor=e.external)}function lB(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;lB(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var uB=new Set([`type`,`properties`,`required`,`additionalProperties`]),dB=[`oneOf`,`anyOf`];function fB(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function pB(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!uB.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??fB(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}PP(n,r,e.length===1?e[0]:pB(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=fB(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function mB(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of uB)if(t in e)return;let n=t.filter(e=>dB.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=pB(t);else{let e=n[0],i=dB.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>pB([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,rB(e,r))}function hB(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):rB(i,s),rB(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())lB(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])mB(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}rB(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,PP(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:vB(t,`input`,e.processors),output:vB(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function gB(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return gB(r.element,n);if(r.type===`set`)return gB(r.valueType,n);if(r.type===`lazy`)return gB(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return gB(r.innLine truncated
`)}function RU(){let e=Object.values(TU).map(e=>`@${e.signature} — ${e.description}`),t=Object.values(DU).map(e=>`@${e.signature} — ${e.description}`);return`## Built-in Functions
Data functions prefixed with \`@\` to distinguish from components. These are the ONLY functions available — do NOT invent new ones.
Use @-prefixed built-in functions (@Count, @Sum, @Avg, @Min, @Max, @Round) on Query results — do NOT hardcode computed values.
${[...e,...t].join(`
`)}
Builtins compose — output of one is input to the next:
\`@Count(@Filter(data.rows, "field", "==", "val"))\` for KPIs/chart values, \`@Round(@Avg(data.rows.score), 1)\`, \`@Each(data.rows, "item", Comp(item.field))\` for per-item rendering.
Array pluck: \`data.rows.field\` extracts a field from every row → use with @Sum, @Avg, charts, tables.
IMPORTANT @Each rule: The loop variable (e.g. "item") is ONLY available inside the @Each template expression. Always inline the template — do NOT extract it to a separate statement.
CORRECT: \`Col("Actions", @Each(rows, "t", Button("Edit", Action([@Set($id, t.id)]))))\`
WRONG: \`myBtn = Button("Edit", Action([@Set($id, t.id)]))\` then \`Col("Actions", @Each(rows, "t", myBtn))\` — t is undefined in myBtn.`}function zU(){return`## Query — Live Data Fetching
Fetch data from available tools. Returns defaults instantly, swaps in real data when it arrives.
\`\`\`
metrics = Query("tool_name", {arg1: value, arg2: $binding}, {defaultField: 0, defaultData: []}, refreshInterval?)
\`\`\`
- First arg: tool name (string)
- Second arg: arguments object (may reference $bindings — re-fetches automatically on change)
- Third arg: default data (rendered immediately before fetch resolves)
- Fourth arg (optional): refresh interval in seconds (e.g. 30 for auto-refresh every 30s)
- Use dot access on results: metrics.totalEvents, metrics.data.day (array pluck)
- Query results must use regular identifiers: \`metrics = Query(...)\`, NOT \`$metrics = Query(...)\`
- Manual refresh: \`Button("Refresh", Action([@Run(query1), @Run(query2)]), "secondary")\` — re-fetches the listed queries
- Refresh all queries: create Action with @Run for each query`}function BU(){return`## Mutation — Write Operations
Execute state-changing tool calls (create, update, delete). Unlike Query (auto-fetches on render), Mutation fires only on button click via Action.
\`\`\`
result = Mutation("tool_name", {arg1: $binding, arg2: "value"})
\`\`\`
- First arg: tool name (string)
- Second arg: arguments object (evaluated with current $binding values at click time)
- result.status: "idle" | "loading" | "success" | "error"
- result.data: tool response on success
- result.error: error message on failure
- Mutation results use regular identifiers: \`result = Mutation(...)\`, NOT \`$result\`
- Show loading state: \`result.status == "loading" ? TextContent("Saving...") : null\``}function VU(e){let t=[`- @ToAssistant("message") — Send a message to the assistant (for conversational buttons like "Tell me more", "Explain this")`,`- @OpenUrl("https://...") — Navigate to a URL`];e.bindings&&t.push(`- @Set($variable, value) — Set a $variable to a specific value`,`- @Reset($var1, $var2, ...) — Reset $variables to their declared defaults (e.g. @Reset($title, $priority) restores $title="" and $priority="medium")`),e.toolCalls&&t.unshift(`- @Run(queryOrMutationRef) — Execute a Mutation or re-fetch a Query (ref must be a declared Query/Mutation)`);let n=[];e.toolCalls&&n.push(`Example — mutation + refresh + reset (PREFERRED pattern):
\`\`\`
$binding = "default"
result = Mutation("tool_name", {field: $binding})
data = Query("tool_name", {}, {rows: []})
onSubmit = Action([@Run(result), @Run(data), @Reset($binding)])
\`\`\``),n.push('Example — simple nav:\n```\nviewBtn = Button("View", Action([@OpenUrl("https://example.com")]))\n```');let r=[`- Action can be assigned to a variable or inlined: Button("Go", onSubmit) and Button("Go", Action([...])) both work`];return e.toolCalls&&r.push(`- If a @Run(mutation) step fails, remaining steps are skipped (halt on failure)`,`- @Run(queryRef) re-fetches the query (fire-and-forget, cannot fail)`),`## Action — Button Behavior
Action([@steps...]) wires button clicks to operations. Steps are @-prefixed built-in actions. Steps execute in order.
Buttons without an explicit Action prop automatically send their label to the assistant (equivalent to Action([@ToAssistant(label)])).
Available steps:
${t.join(`
`)}
${n.join(`
`)}
${r.join(`
`)}`}function HU(){return`## Interactive Filters
To let the user filter data with a dropdown:
1. Declare a $variable with a default: \`$dateRange = "14"\`
2. Create a Select with name, items, and binding: \`Select("dateRange", [SelectItem("7", "Last 7 days"), ...], null, null, $dateRange)\`
3. Wrap in FormControl for a label: \`FormControl("Date Range", Select(...))\`
4. Pass $dateRange in Query args: \`Query("tool", {dateRange: $dateRange}, {defaults})\`
5. When the user changes the Select, $dateRange updates and the Query automatically re-fetches
FILTER WIRING RULE: If a $binding filter is visible in the UI, EVERY relevant Query MUST reference that $binding in its args. Never show a filter dropdown while hardcoding the query args.
Rules for $variables:
- $variables hold simple values (strings or numbers), NOT arrays or objects
- $variables must be bound to a Select/Input component via the value argument (last positional arg) to be interactive
- Queries must use regular identifiers (NOT $variables): \`metrics = Query(...)\` not \`$metrics = Query(...)\`
- **Auto-declare**: You do NOT need to explicitly declare $variables. If you use \`$foo\` without declaring it, the parser auto-creates \`$foo = null\`. You can still declare explicitly to set a default: \`$days = "14"\`
## Forms
Simple form — no $bindings needed. Field values are managed internally by the Form via the name prop:
\`\`\`
contactForm = Form("contact", submitBtn, [nameField, emailField])
nameField = FormControl("Name", Input("name", "Your name", "text", {required: true}))
emailField = FormControl("Email", Input("email", "your@email.com", "email", {required: true, email: true}))
submitBtn = Button("Submit")
\`\`\`
Use $bindings when you need to read field values elsewhere (in Action context, Query args, or conditionals). They are auto-declared:
\`\`\`
$role = "engineer"
contactForm = Form("contact", submitBtn, [nameField, emailField, roleField])
nameField = FormControl("Name", Input("name", "Enter your name", "text", {required: true}, $name))
emailField = FormControl("Email", Input("email", "Enter your email", "email", {required: true, email: true}, $email))
roleField = FormControl("Role", Select("role", [SelectItem("engineer", "Engineer"), SelectItem("designer", "Designer"), SelectItem("pm", "PM")], null, {required: true}, $role))
submitBtn = Button("Submit")
\`\`\`
For form + mutation patterns (create, refresh, reset), see the Action section example above.
IMPORTANT: Always add validation rules to form fields used with Mutations. Use OBJECT syntax: {required: true, email: true, minLength: 8}. The renderer shows error messages automatically and blocks submit when validation fails.`}function UU(){return`## Edit Mode
The runtime merges by statement name: same name = replace, new name = append.
Output ONLY statements that changed or are new. Everything else is kept automatically.
### Delete
To remove a component, re-declare its parent without that component in the parent's children array. The removed component and any statements only it referenced are automatically garbage-collected.
### Patch size guide
- Changing a title or label: 1 statement
- Adding a component: 2-3 statements (the new component + parent update)
- Removing a component: 1 statement (re-declare parent without the removed child)
- Adding a filter + wiring to query: 3-5 statements
- Restructuring into tabs: 5-10 statements
### Rules
- Reuse existing statement names exactly — do not rename
- Do NOT re-emit unchanged statements — the runtime keeps them
- A typical edit patch is 1-10 statements, not 20+
- If the existing code already satisfies the request, output only the root statement
- NEVER output the entire program as a patch. Only output what actually changes
- If you are about to output more than 10 statements, reconsider — most edits need fewer`}function WU(e,t){let n=[`1. \`root = ${e}(...)\` — UI shell appears immediately`];return t.supportsExpressions?(n.push(`2. $variable declarations — state ready for bindings`),n.push(`3. Query statements — defaults resolve immediately so components render with data`),n.push(`4. Component definitions — fill in with data already available`),n.push(`5. Data values — leaf content last`)):(n.push(`2. Component definitions — fill in as they stream`),n.push(`3. Data values — leaf content last`)),`## Hoisting & Streaming (CRITICAL)
openui-lang supports hoisting: a reference can be used BEFORE it is defined. The parser resolves all references after the full input is parsed.
During streaming, the output is re-parsed on every chunk. Undefined references are temporarily unresolved and appear once their definitions stream in. This creates a progressive top-down reveal — structure first, then data fills in.
**Recommended statement order for optimal streaming:**
${n.join(`
`)}
Always write the root = ${e}(...) statement first so the UI shell appears immediately, even before child data has streamed in.`}function GU(){return`## Inline Mode
You are in inline mode. You can respond in two ways:
### 1. Code response (when the user wants to CREATE or CHANGE the UI)
Wrap openui-lang code in triple-backtick fences. You can include explanatory text before/after:
Here's your dashboard:
\`\`\`openui-lang
root = RootComp([header, content])
header = SomeHeader("Title")
content = SomeContent("Hello world")
\`\`\`
I created a simple layout with a header.
### 2. Text-only response (when the user asks a QUESTION)
If the user asks "what is this?", "explain the chart", "how does this work", etc. — respond with plain text. Do NOT output any openui-lang code. The existing dashboard stays unchanged.
### Rules
- When the user asks for changes, output ONLY the changed/new statements in a fenced block
- When the user asks a question, respond with text only — NO code. The dashboard stays unchanged.
- The parser extracts code from fences automatically. Text outside fences is shown as chat.`}function KU(){return`## Data Workflow
When tools are available, follow this workflow:
1. FIRST: Call the most relevant tool to inspect the real data shape before generating code
2. Use Query() for READ operations (data that should stay live) — NEVER hardcode tool results as literal arrays or objects
3. Use Mutation() for WRITE operations (create, update, delete) — triggered by button clicks via Action([@Run(mutationRef)])
4. Use the real data from step 1 as condensed Query defaults (3-5 rows) so the UI renders immediately
5. Use @-prefixed builtins (@Count, @Filter, @Sort, @Sum) on Query results for KPIs and aggregations — the runtime evaluates these live on every refresh
6. Hardcoded arrays are ONLY for static display data (labels, options) where no tool exists
WRONG — you called a tool and got data back, but you inlined the results:
\`\`\`
openCount = 2
item1 = SomeComp("first item title")
item2 = SomeComp("second item title")
list = SomeList([item1, item2])
chart = SomeChart(["A", "B"], [12, 8])
\`\`\`
This is static — it shows stale data and won't update. Creating item1, item2, item3... manually is ALWAYS wrong when a tool exists.
RIGHT — use Query() for live data, Mutation() for writes, @builtins to derive values:
\`\`\`
data = Query("tool_name", {}, {rows: []})
openCount = @Count(@Filter(data.rows, "field", "==", "value"))
list = @Each(data.rows, "item", SomeComp(item.title, item.field))
createResult = Mutation("create_tool", {title: $title})
submitBtn = Button("Create", Action([@Run(createResult), @Run(data), @Reset($title)]))
\`\`\`
Everything derives from the Query — when data refreshes, the entire dashboard updates automatically.`}function qU(e,t){let n=[`1. root = ${e}(...) is the FIRST line (for optimal streaming).`,`2. Every referenced name is defined. Every defined name (other than root) is reachable from root.`];return t.toolCalls&&n.push(`3. Every Query result is referenced by at least one component.`),t.bindings&&n.push(`${t.toolCalls?`4`:`3`}. Every $binding appears in at least one component or expression.`),t.toolCalls&&t.bindings&&n.push(`5. Every visible filter $binding appears in at least one Query args object.`),`## Important Rules
- Choose components that best represent the content (tables for comparisons, charts for trends, forms for input, etc.)
## Final Verification
Before finishing, walk your output and verify:
${n.join(`
`)}`}function JU(e){let t=``;if(e.inputSchema){let n=e.inputSchema.properties,r=e.inputSchema.required??[];n&&Object.keys(n).length>0&&(t=Object.entries(n).map(([e,t])=>`${e}${r.includes(e)?``:`?`}: ${PU(t)}`).join(`, `))}let n=``;e.outputSchema&&(n=` → ${PU(e.outputSchema)}`);let r=`- ${e.name}(${t})${n}`;return e.description&&(r+=`\n ${e.description}`),r}function YU(e){let t=[],n=[],r=[];for(let t of e)typeof t==`string`?n.push(t):r.push(t);t.push(`## Available Tools`),t.push(``),t.push(`Use these with Query() for read operations or Mutation() for write operations. The LLM decides which is appropriate based on the tool's purpose.`),t.push(``);for(let e of n)t.push(`- ${e}`);for(let e of r)t.push(JU(e));let i=r.filter(e=>e.outputSchema);if(i.length>0){t.push(``),t.push(`### Default values for Query results`),t.push(``),t.push(`Use these shapes as minimal Query defaults:`);for(let e of i){let n=FU(e.outputSchema);t.push(`- ${e.name}: \`${JSON.stringify(n)}\``)}}return t.push(``),t.push(`CRITICAL: Use ONLY the tools listed above in Query() and Mutation() calls. Do NOT invent or guess tool names. If the user asks for functionality that doesn't match any available tool, use realistic mock data instead of fabricating a tool call.`),t.join(`
`)}function XU(e,t){let n=[`## Component Signatures`,``,`Arguments marked with ? are optional. Sub-components can be inline or referenced; prefer references for better streaming.`];if(t.usesActionExpression){let e=[t.toolCalls?`@Run`:``,`@ToAssistant`,`@OpenUrl`,t.bindings?`@Set`:``,t.bindings?`@Reset`:``].filter(Boolean);n.push(`Props typed \`ActionExpression\` accept an Action([@steps...]) expression. See the Action section for available steps (${e.join(`, `)}).`)}(t.bindings||Object.values(e.components).some(e=>e.signature?.includes(`$binding`)))&&n.push("Props marked `$binding<type>` accept a `$variable` reference for two-way binding.");let r=e=>e.description?`${e.signature} — ${e.description}`:e.signature;if(e.componentGroups?.length){let t=new Set;for(let i of e.componentGroups){n.push(``,`### ${i.name}`);for(let a of i.components){if(t.has(a))continue;let i=e.components[a];i&&(t.add(a),n.push(r(i)))}if(i.notes?.length)for(let e of i.notes)n.push(e)}let i=Object.keys(e.components).filter(e=>!t.has(e));if(i.length){n.push(``,`### Other`);for(let t of i){let i=e.components[t];n.push(r(i))}}}else{n.push(``);for(let[,t]of Object.entries(e.components))n.push(r(t))}return n.join(`
`)}function ZU(e){let t=e.root??`Root`,n=!!e.tools?.length,r=e.toolCalls??n,i=e.bindings??r,a=r||i,o=Object.values(e.components).some(e=>e.signature?.includes(`ActionExpression`)),s=[];s.push(e.preamble??IU),s.push(``),s.push(LU(t,{supportsExpressions:a,bindings:i})),s.push(``),s.push(XU(e,{toolCalls:r,bindings:i,usesActionExpression:o})),a&&(s.push(``),s.push(RU())),r&&(s.push(``),s.push(zU()),s.push(``),s.push(BU())),o&&(s.push(``),s.push(VU({toolCalls:r,bindings:i}))),r&&i&&(s.push(``),s.push(HU())),r&&(s.push(``),s.push(KU())),e.tools?.length&&(s.push(``),s.push(YU(e.tools))),s.push(``),s.push(WU(t,{supportsExpressions:a}));let c=[...e.examples??[],...e.toolExamples??[]];if(c.length){s.push(``),s.push(`## Examples`),s.push(``);for(let e of c)s.push(e),s.push(``)}if(e.editMode&&(s.push(``),s.push(UU())),e.inlineMode&&(s.push(``),s.push(GU())),s.push(qU(t,{toolCalls:r,bindings:i})),e.additionalRules?.length){s.push(``);for(let t of e.additionalRules)s.push(`- ${t}`)}return s.join(`
`)}var QU=new WeakSet;function $U(e){return typeof e==`object`&&!!e&&QU.has(e)}var eW=new WeakMap;function tW(e,t){if(typeof e==`object`&&e&&`_def`in e&&!(`_zod`in e))throw Error(`[OpenUI] Component "${t}" was defined with a Zod 3 schema. OpenUI requires Zod 4 schemas. If you're on zod@3.25+, import from "zod/v4" instead of "zod". See: https://zod.dev/v4/versioning`)}function nW(e){return tW(e.props,e.name),eW.set(e.props,e.name),{...e,ref:e.props}}function rW(e){return e?._zod?.def}function iW(e){return rW(e)?.type}function aW(e){let t=iW(e);return t===`optional`||t==="default"||t===`nullable`}function oW(e){let t=e,n=rW(t);for(;n?.type===`optional`||n?.type==="default"||n?.type===`nullable`;)t=n.innerType,n=rW(t);return t}function sW(e){return iW(oW(e))===`array`}function cW(e){let t=rW(oW(e));if(t?.type===`array`)return t.element??t.innerType}function lW(e){let t=rW(oW(e));if(t?.type===`enum`){if(Array.isArray(t.values))return t.values;if(t.entries&&typeof t.entries==`object`)return Object.keys(t.entries)}}function uW(e,t){try{let n=t.get(e);if(n?.id)return n.id}catch{}if(typeof e==`object`&&e)return eW.get(e)}function dW(e){let t=rW(e);if(t?.type===`union`&&Array.isArray(t.options))return t.options}function fW(e){let t=rW(e);if(t?.type===`object`&&t.shape&&typeof t.shape==`object`)return t.shape}function pW(e,t){let n=$U(e),r=mW(oW(e),t);if(r)return n?`$binding<${r}>`:r}function mW(e,t){let n=uW(e,t);if(n)return n;let r=dW(e);if(r){let e=r.map(e=>pW(e,t)).filter(Boolean);if(e.length>0)return e.join(` | `)}if(sW(e)){let n=cW(e);if(!n)return;let r=pW(n,t);return r?dW(oW(n))===void 0?`${r}[]`:`(${r})[]`:void 0}let i=iW(e);if(i===`string`)return`string`;if(i===`number`)return`number`;if(i===`boolean`)return`boolean`;if(i===`any`)return`any`;if(i===`record`){let n=rW(e);return`Record<${pW(n?.keyType,t)??`string`}, ${pW(n?.valueType,t)??`any`}>`}let a=lW(e);if(a)return a.map(e=>`"${e}"`).join(` | `);if(i===`literal`){let t=rW(e)?.values;if(Array.isArray(t)&&t.length===1){let e=t[0];return typeof e==`string`?`"${e}"`:String(e)}}let o=fW(e);return o?`{${Object.entries(o).map(([e,n])=>{let r=aW(n)?`?`:``,i=pW(n,t);return i?`${e}${r}: ${i}`:`${e}${r}`}).join(`, `)}}`:`any`}function hW(e,t){return Object.entries(e).map(([e,n])=>({name:e,isOptional:aW(n),isArray:sW(n),typeAnnotation:pW(n,t)}))}function gW(e,t){return`${e}(${t.map(e=>e.typeAnnotation?e.isOptional?`${e.name}?: ${e.typeAnnotation}`:`${e.name}: ${e.typeAnnotation}`:e.isArray?e.isOptional?`[${e.name}]?`:`[${e.name}]`:e.isOptional?`${e.name}?`:e.name).join(`, `)})`}function _W(e,t){let n={};for(let[r,i]of Object.entries(e))n[r]={signature:gW(r,hW(i.props.shape,t)),description:i.description};return n}var vW=0;function yW(){return typeof globalThis.crypto?.randomUUID==`function`?globalThis.crypto.randomUUID():(vW+=1,`openui-lib-${Date.now().toString(36)}-${vW.toString(36)}`)}function bW(e){let t={},n=oz(),r=yW();for(let r of e.components)n.add(r.props,{id:r.name}),t[r.name]=r;if(e.root&&!t[e.root]){let n=Object.keys(t).join(`, `);throw Error(`[createLibrary] Root component "${e.root}" was not found in components. Available components: ${n}`)}let i={components:t,componentGroups:e.componentGroups,root:e.root,id:e.id,__libraryId:r,prompt(r){return ZU({root:e.root,components:_W(t,n),componentGroups:e.componentGroups,...r})},toSpec(){return{root:e.root,components:_W(t,n),componentGroups:e.componentGroups,schema:a(),...e.id===void 0?{}:{id:e.id}}},toJSONSchema(){return a()}};function a(){let e=TV(wH(Object.fromEntries(Object.entries(t).map(([e,t])=>[e,t.props]))),{metadata:n});for(let[n,r]of Object.entries(t)){let t=e.$defs?.[n];t&&r.description&&(t.description=r.description)}return e}return i}function xW(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return t.type===`element`&&typeof t.typeName==`string`&&typeof t.props==`object`&&t.props!==null&&typeof t.partial==`boolean`}var SW=function(e){return e.ContinueConversation=`continue_conversation`,e.OpenUrl=`open_url`,e}({});function CW(e){switch(e.k){case`StateRef`:case`RuntimeRef`:case`BinOp`:case`UnaryOp`:case`Ternary`:case`Member`:case`Index`:case`Assign`:return!0;default:return!1}}var wW=new Set([`Comp`,`Ref`,`StateRef`,`RuntimeRef`,`BinOp`,`UnaryOp`,`Ternary`,`Member`,`Index`,`Assign`,`Str`,`Num`,`Bool`,`Null`,`Arr`,`Obj`,`Ph`]);function TW(e){return!e||typeof e!=`object`||Array.isArray(e)?!1:wW.has(e.k)}function EW(e,t){let n=e=>{switch(t(e),e.k){case`Comp`:e.args.forEach(n),Object.values(e.mappedProps??{}).forEach(n);break;case`Arr`:e.els.forEach(n);break;case`Obj`:e.entries.forEach(([,e])=>n(e));break;case`BinOp`:n(e.left),n(e.right);break;case`UnaryOp`:n(e.operand);break;case`Ternary`:n(e.cond),n(e.then),n(e.else);break;case`Member`:n(e.obj);break;case`Index`:n(e.obj),n(e.index);break;case`Assign`:n(e.value)}};n(e)}var DW=1,OW=2,kW=3,AW=4,jW=5,MW=6,NW=7,PW=8,FW=9;function IW(e){let t=0,n=()=>e[t]??{t:13},r=()=>{let e=n();return t++,e},i=e=>{n().t===e&&t++};function a(e){switch(e.t){cas Line truncated
`){t.push({t:0}),n++;continue}if(i===`(`){t.push({t:1}),n++;continue}if(i===`)`){t.push({t:2}),n++;continue}if(i===`[`){t.push({t:3}),n++;continue}if(i===`]`){t.push({t:4}),n++;continue}if(i===`{`){t.push({t:5}),n++;continue}if(i===`}`){t.push({t:6}),n++;continue}if(i===`,`){t.push({t:7}),n++;continue}if(i===`:`){t.push({t:8}),n++;continue}if(i===`=`){n+1<r&&e[n+1]===`=`?(t.push({t:25}),n+=2):(t.push({t:9}),n++);continue}if(i===`!`){n+1<r&&e[n+1]===`=`?(t.push({t:26}),n+=2):(t.push({t:33}),n++);continue}if(i===`>`){n+1<r&&e[n+1]===`=`?(t.push({t:29}),n+=2):(t.push({t:27}),n++);continue}if(i===`<`){n+1<r&&e[n+1]===`=`?(t.push({t:30}),n+=2):(t.push({t:28}),n++);continue}if(i===`&`){n+1<r&&e[n+1]===`&`?(t.push({t:31}),n+=2):(t.push({t:31}),n++);continue}if(i===`|`){n+1<r&&e[n+1]===`|`?(t.push({t:32}),n+=2):(t.push({t:32}),n++);continue}if(i===`.`){t.push({t:19}),n++;continue}if(i===`?`){t.push({t:34}),n++;continue}if(i===`+`){t.push({t:20}),n++;continue}if(i===`*`){t.push({t:22}),n++;continue}if(i===`/`){t.push({t:23}),n++;continue}if(i===`%`){t.push({t:24}),n++;continue}if(i===`"`){let i=n;n++;let a=!1;for(;n<r;)if(e[n]===`\\`)n+=2;else if(e[n]===`"`){n++,a=!0;break}else n++;let o=e.slice(i,n);try{let e=a?o:o+`"`;t.push({t:14,v:JSON.parse(e)})}catch{let e=o.replace(/^"|"$/g,``);t.push({t:14,v:e})}continue}if(i===`'`){n++;let i=``;for(;n<r;)if(e[n]===`\\`){if(n++,n<r){let t=e[n];i+=t===`'`?`'`:t===`\\`?`\\`:t===`n`?`
`:t===`t`?` `:t,n++}}else if(e[n]===`'`){n++;break}else i+=e[n],n++;t.push({t:14,v:i});continue}if(i===`-`){let i=t.length>0?t[t.length-1]:null;if(!((i==null||i.t!==15&&i.t!==14&&i.t!==16&&i.t!==17&&i.t!==2&&i.t!==4&&i.t!==10&&i.t!==11&&i.t!==12&&i.t!==18&&i.t!==35)&&n+1<r&&e[n+1]>=`0`&&e[n+1]<=`9`)){t.push({t:21}),n++;continue}}let a=i>=`0`&&i<=`9`,o=i===`-`&&n+1<r&&e[n+1]>=`0`&&e[n+1]<=`9`;if(a||o){let i=n;for(e[n]===`-`&&n++;n<r&&e[n]>=`0`&&e[n]<=`9`;)n++;if(n<r&&e[n]===`.`&&n+1<r&&e[n+1]>=`0`&&e[n+1]<=`9`)for(n++;n<r&&e[n]>=`0`&&e[n]<=`9`;)n++;if(n<r&&(e[n]===`e`||e[n]===`E`))for(n++,n<r&&(e[n]===`+`||e[n]===`-`)&&n++;n<r&&e[n]>=`0`&&e[n]<=`9`;)n++;t.push({t:15,v:+e.slice(i,n)})}else if(i===`$`&&n+1<r&&(e[n+1]>=`a`&&e[n+1]<=`z`||e[n+1]>=`A`&&e[n+1]<=`Z`||e[n+1]===`_`)){let i=n;for(n++;n<r&&(e[n]>=`a`&&e[n]<=`z`||e[n]>=`A`&&e[n]<=`Z`||e[n]>=`0`&&e[n]<=`9`||e[n]===`_`);)n++;t.push({t:18,v:e.slice(i,n)})}else if(i>=`a`&&i<=`z`||i>=`A`&&i<=`Z`||i===`_`){let a=n;for(;n<r&&(e[n]>=`a`&&e[n]<=`z`||e[n]>=`A`&&e[n]<=`Z`||e[n]>=`0`&&e[n]<=`9`||e[n]===`_`);)n++;let o=e.slice(a,n);if(o===`true`){t.push({t:10});continue}if(o===`false`){t.push({t:11});continue}if(o===`null`){t.push({t:12});continue}let s=i>=`A`&&i<=`Z`?17:16;t.push({t:s,v:o})}else if(i===`@`&&n+1<r&&(e[n+1]>=`a`&&e[n+1]<=`z`||e[n+1]>=`A`&&e[n+1]<=`Z`||e[n+1]===`_`)){n++;let i=n;for(;n<r&&(e[n]>=`a`&&e[n]<=`z`||e[n]>=`A`&&e[n]<=`Z`||e[n]>=`0`&&e[n]<=`9`||e[n]===`_`);)n++;t.push({t:35,v:e.slice(i,n)})}else n++}return t.push({t:13}),t}var RW=[`string`,`number`,`boolean`],zW={},BW=[];function VW(e){return Array.isArray(e)?`array`:typeof e}function HW(e){return typeof e.$ref==`string`?e.$ref.split(`/`).pop():void 0}function UW(e){return`$ref`in e||`anyOf`in e||`oneOf`in e||`allOf`in e}function WW(e){if(Array.isArray(e.enum))return{enumValues:e.enum};if(`const`in e)return{enumValues:[e.const]};switch(e.type){case`string`:return{expectedType:`string`};case`number`:case`integer`:return{expectedType:`number`};case`boolean`:return{expectedType:`boolean`};default:return{}}}function GW(e){if(e&&typeof e==`object`&&!Array.isArray(e))return e.default}function KW(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e,n=HW(t);if(n)return n;let r=WW(t);return r.enumValues?r.enumValues.map(e=>JSON.stringify(e)).join(`|`):r.expectedType?r.expectedType:typeof t.type==`string`?t.type:void 0}function qW(e,t){return`${e}(${t.map(e=>{let t=KW(e.schema),n=e.required?`${e.name}*`:e.name;return t?`${n}: ${t}`:n}).join(`, `)})`}function JW(e,t){let n=typeof e;return t.enumValues?!RW.includes(n)||t.enumValues.includes(e)?null:{expected:`one of [${t.enumValues.map(e=>JSON.stringify(e)).join(`, `)}]`,actual:JSON.stringify(e)}:t.expectedType&&t.expectedType!==n?{expected:t.expectedType,actual:VW(e)}:null}function YW(e,t,n){switch(n.code){case`type-mismatch`:return`field "${t}" expects ${n.expected} but got ${n.actual}`;case`missing-required`:return`missing required field "${t}"${n.signature?` — signature: ${n.signature}`:``}`;case`null-required`:return`required field "${t}" cannot be null${n.signature?` — signature: ${n.signature}`:``}`;case`unknown-component`:return`Unknown component "${e}" — not found in catalog or builtins${n.available?.length?`. Available components: ${n.available.join(`, `)}`:``}`;case`inline-reserved`:return`${e}() must be declared as a top-level statement, not used inline as a value`;case`excess-args`:return`${e} takes ${n.declared} arg(s), got ${n.got} (${n.got-n.declared} excess dropped)`}}function XW(e,t,n,r){e.errors.push({code:r.code,component:t,path:n,message:YW(t,n,r),statementId:e.currentStatementId})}function ZW(e,t,n,r){return r===void 0?n?!0:(delete e[t],!1):(e[t]=r,!1)}function QW(e,t,n,r,i){return UW(t)?!1:typeof t.type==`string`||Array.isArray(t.enum)||`const`in t?(XW(i,n,r,{code:`type-mismatch`,expected:typeof t.type==`string`?t.type:`a literal value`,actual:`component "${e.typeName}"`}),!0):!1}function $W(e){return(e.anyOf??e.oneOf??[e]).map(HW)}function eG(e,t){let n=$W(e);return n.length>0&&n.every(e=>e!==void 0&&t.cat?.has(e))}function tG(e,t,n,r,i){if(typeof e!=`object`||Array.isArray(e))return XW(i,n,r,{code:`type-mismatch`,expected:`object`,actual:VW(e)}),!0;let a=e,o=t.properties&&typeof t.properties==`object`?t.properties:zW,s=Array.isArray(t.required)?t.required:BW,c=!1;if(!i.partial)for(let e of s){let t=e in a;if(!t||a[e]==null){let s=GW(o[e]);if(s!==void 0){a[e]=s;continue}XW(i,n,`${r}/${e}`,{code:t?`null-required`:`missing-required`}),c=!0}}for(let e of Object.keys(o))if(e in a){let t=o[e];iG(a[e],t,n,`${r}/${e}`,i)&&ZW(a,e,s.includes(e),GW(t))&&(c=!0)}return c}function nG(e,t,n,r,i){if(!Array.isArray(e))return XW(i,n,r,{code:`type-mismatch`,expected:`array`,actual:VW(e)}),!0;let a=t.items;if(!a||typeof a!=`object`||Array.isArray(a))return!1;let o;for(let t=0;t<e.length;t++)iG(e[t],a,n,`${r}/${t}`,i)&&(o??=[]).push(t);if(o)for(let t=o.length-1;t>=0;t--)e.splice(o[t],1);return!1}function rG(e,t,n,r,i){let a=WW(t);if(a Line truncated
`;)i++;if(i>=e.length){t.push(e.slice(r+3).replace(/^[^\n]*\n?/,``)),n=e.length;break}i++;let a=-1,o=i;for(;o<e.length;){let t=xG(e,o);if(t>o)o=t;else{if(e[o]==="`"&&o+1<e.length&&e[o+1]==="`"&&o+2<e.length&&e[o+2]==="`"){a=o;break}o++}}a===-1?(t.push(e.slice(i)),n=e.length):(t.push(e.slice(i,a)),n=a+3)}if(t.length>0)return t.join(`
`);if(e.startsWith("```")){let t=3;for(;t<e.length&&e[t]!==`
`;)t++;let n=t<e.length?t+1:3,r=e.slice(n),i=r.lastIndexOf("```");return i===-1?r:r.slice(0,i)}return e}function CG(e){let t=!1;return e.split(`
`).map(e=>{for(let n=0;n<e.length;n++){let r=e[n];if(t){if(r===`\\`&&n+1<e.length){n++;continue}r===t&&(t=!1)}else if(r===`"`||r===`'`)t=r;else if(r===`/`&&e[n+1]===`/`||r===`#`)return e.substring(0,n).trimEnd()}return e}).join(`
`)}function wG(e){return CG(SG(e.trim())).trim()}function TG(e,t,n){let r=wG(e);if(!r)return pG();let{text:i,wasIncomplete:a}=dG(r),o=fG(LW(i));if(!o.length)return pG(a);let s=new Map,c=``;for(let e of o){let t=hG(e,IW(e.tokens));s.set(e.id,t),c||=e.id}return bG(s,[...s.values()],c,a,s.size,t,n)}function EG(e,t){let n=``,r=``,i=0,a=new Map,o=0,s=``;function c(e){let t=e.trim();if(t)for(let e of fG(LW(t))){let t=hG(e,IW(e.tokens));a.set(e.id,t),o++,s||=e.id}}function l(){let e=wG(n);e.startsWith(r.slice(0,i))||(i=0,a.clear(),o=0,s=``),r=e}function u(){let e=0,t=0,n=!1,a=!1,o=i;for(let s=i;s<r.length;s++){let l=r[s];if(a)a=!1;else if(l===`\\`&&n)a=!0;else if(n)l===n&&(n=!1);else if(l===`"`||l===`'`)n=l;else if(l===`(`||l===`[`||l===`{`)e++;else if(l===`)`||l===`]`||l===`}`)e=Math.max(0,e-1);else if(l===`?`&&e===0)t++;else if(l===`:`&&e===0&&t>0)t--;else if(l===`
`&&e<=0&&t<=0){let e=s+1;for(;e<r.length&&(r[e]===` `||r[e]===` `||r[e]===`\r`||r[e]===`
`);)e++;if(e<r.length&&(r[e]===`?`||r[e]===`:`&&t>0))continue;let n=r.slice(o,s).trim();n&&c(n),o=s+1,i=s+1}}return o}function d(){l();let n=u(),i=r.slice(n).trim();if(!i)return o===0?pG():bG(a,[...a.values()],s,!1,o,e,t);let{text:c,wasIncomplete:d}=dG(i),f=fG(LW(c));if(!f.length)return o===0?pG(d):bG(a,[...a.values()],s,d,o,e,t);let p=new Map(a);for(let e of f){if(a.has(e.id)&&d)continue;let t=hG(e,IW(e.tokens));p.set(e.id,t)}return bG(p,[...p.values()],s||f[0].id,d,o+f.length,e,t)}function f(){n=``,r=``,i=0,a.clear(),o=0,s=``}return{push(e){return n+=e,d()},set(e){(e.length<n.length||!e.startsWith(n))&&f();let t=e.slice(n.length);return t&&(n+=t),d()},getResult:d}}function DG(e){let t=new Map,n=e.$defs??{},r=e.properties&&new Set(Object.keys(e.properties));for(let[e,i]of Object.entries(n)){if(r&&!r.has(e))continue;let n=i.properties??{},a=i.required??[],o=Object.keys(n).map(e=>({name:e,required:a.includes(e),defaultValue:GW(n[e]),schema:n[e]}));t.set(e,{params:o})}return t}function OG(e,t){let n=DG(e);return{parse(e){let r=bU();try{let i=TG(e,n,t);return xU(r,i),i}catch(e){throw SU(r),e}}}}function kG(e,t){return EG(DG(e),t)}function AG(e){return typeof e==`object`&&!!e&&e.__reactive===`assign`}function jG(e,t,n){switch(e.k){case`Str`:return e.v;case`Num`:return e.v;case`Bool`:return e.v;case`Null`:return null;case`Ph`:return null;case`StateRef`:return t.extraScope?.[e.n]??t.getState(e.n);case`Ref`:case`RuntimeRef`:return t.resolveRef(e.n);case`Arr`:return e.els.map(e=>jG(e,t));case`Obj`:return Object.fromEntries(e.entries.map(([e,n])=>[e,jG(n,t)]));case`Comp`:{if(EU.has(e.name))return LG(e.name,e.args,t,n);let r=TU[e.name];if(r){let n=e.args.map(e=>jG(e,t));return r.fn(...n)}if(kU.has(e.name))return FG(e.name,e.args,t);if(e.mappedProps){let r=n?.library.components[e.name],i={};for(let[a,o]of Object.entries(e.mappedProps)){let e=r?.props?.shape?.[a];i[a]=o.k===`StateRef`&&e&&$U(e)?{__reactive:`assign`,target:o.n,expr:{k:`StateRef`,n:`$value`}}:o.k===`StateRef`?n?t.getState(o.n):o:jG(o,t,n)}let a={type:`element`,typeName:e.name,props:i,partial:!1,hasDynamicProps:!0};if(n)for(let[e,r]of Object.entries(i))xW(r)?i[e]=MG(r,t,n):Array.isArray(r)&&(i[e]=r.map(e=>xW(e)?MG(e,t,n):e));return a}return console.warn(`[openui] Unexpected unmapped Comp node: ${e.name}`),null}case`BinOp`:{if(e.op===`&&`)return jG(e.left,t)&&jG(e.right,t);if(e.op===`||`)return jG(e.left,t)||jG(e.right,t);let n=jG(e.left,t),r=jG(e.right,t);switch(e.op){case`+`:return typeof n==`string`||typeof r==`string`?String(n??``)+String(r??``):wU(n)+wU(r);case`-`:return wU(n)-wU(r);case`*`:return wU(n)*wU(r);case`/`:return wU(r)===0?0:wU(n)/wU(r);case`%`:return wU(r)===0?0:wU(n)%wU(r);case`==`:return n==r;case`!=`:return n!=r;case`>`:return wU(n)>wU(r);case`<`:return wU(n)<wU(r);case`>=`:return wU(n)>=wU(r);case`<=`:return wU(n)<=wU(r);default:return null}}case`UnaryOp`:return e.op===`!`?!jG(e.operand,t):e.op===`-`?-wU(jG(e.operand,t)):null;case`Ternary`:return jG(e.cond,t)?jG(e.then,t):jG(e.else,t);case`Member`:{let n=jG(e.obj,t);return n==null?null:Array.isArray(n)?e.field===`length`?n.length:n.map(t=>t?.[e.field]??null):n[e.field]}case`Index`:{let n=jG(e.obj,t),r=jG(e.index,t);return n==null||r==null?null:Array.isArray(n)?n[wU(r)]:n[String(r)]}case`Assign`:return{__reactive:`assign`,target:e.target,expr:e.value}}}function MG(e,t,n){if(e.hasDynamicProps===!1)return e;let r=n.library.components[e.typeName],i={};for(let[a,o]of Object.entries(e.props)){let e=r?.props?.shape?.[a];i[a]=NG(o,t,n,e)}return{...e,props:i}}function NG(e,t,n,r){return RG(e,t,n,r,{recurseElement:e=>MG(e,t,n),recurse:(e,r)=>NG(e,t,n,r)})}function PG(e){return e==null?{k:`Null`}:typeof e==`string`?{k:`Str`,v:e}:typeof e==`number`?{k:`Num`,v:e}:typeof e==`boolean`?{k:`Bool`,v:e}:Array.isArray(e)?{k:`Arr`,els:e.map(PG)}:typeof e==`object`?{k:`Obj`,entries:Object.entries(e).map(([e,t])=>[e,PG(t)])}:{k:`Null`}}function FG(e,t,n){switch(e){case`Action`:{let e=t.length>0?jG(t[0],n):[];return{steps:(Array.isArray(e)?e:[]).filter(e=>typeof e==`object`&&!!e&&`type`in e)}}case`Run`:{if(t.length===0)return null;let e=t[0];return e.k===`RuntimeRef`?{type:OU.Run,statementId:e.n,refType:e.refType}:null}case`ToAssistant`:{let e=t.length>0?String(jG(t[0],n)??``):``,r=t.length>1?String(jG(t[1],n)??``):void 0;return{type:OU.ToAssistant,message:e,context:r}}case`OpenUrl`:{let e=t.length>0?String(jG(t[0],n)??``):``;return{type:OU.OpenUrl,url:e}}case`Set`:{if(t.length<2)return null;let e=t[0];return e.k===`StateRef`?{type:OU.Set,target:e.n,valueAST:t[1]}:null}case`Reset`:{let e=t.filter(e=>e.k===`StateRef`).map(e=>e.n);return e.length===0?null:{type:OU.Reset,targets:e}}default:return null}}function IG(e,t,n){switch(e.k){case`Ref`:return e.n===t?PG(n):e;case`Member`:if(TW(e.obj)){let r=IG(e.obj,t,n);if(r.k===`Obj`){let t=r.entries.find(([t])=>t===e.field);if(t)return t[1]}return{...e,obj:r}}return e;case`Index`:return{...e,obj:TW(e.obj)?IG(e.obj,t,n):e.obj,index:TW(e.index)?IG(e.index,t,n):e.index}; Line truncated
`);throw new VG(t||`Unknown error`)}if(e.structuredContent!=null)return e.structuredContent;let t=e.content?.filter(e=>e.type===`text`).map(e=>e.text??``);if(t?.length){let e=t.join(``);try{return JSON.parse(e)}catch{return e}}return null}var UG=class extends Error{toolName;availableTools;constructor(e,t=[]){super(`[openui] No handler for tool "${e}". Available: ${t.join(`, `)||`(none)`}`),this.name=`ToolNotFoundError`,this.toolName=e,this.availableTools=t}};function WG(e){return JSON.stringify(e,(e,t)=>{if(t&&typeof t==`object`&&!Array.isArray(t)){let e={};for(let n of Object.keys(t).sort())e[n]=t[n];return e}if(t===void 0)return`__undefined__`;if(typeof t==`number`){if(Number.isNaN(t))return`__NaN__`;if(t===1/0)return`__Inf__`;if(t===-1/0)return`__-Inf__`}return t})}function GG(e,t,n){let r=n==null?``:`::`+WG(n);return e+`::`+WG(t)+r}function KG(e){let t=new Map,n=new Map,r=new Map,i=new Set,a={__openui_loading:[],__openui_refetching:[],__openui_errors:[]},o=JSON.stringify(a),s=!1,c=0;function l(){let e={__openui_loading:[],__openui_refetching:[],__openui_errors:[]};for(let[n,i]of t){let t=r.get(i.cacheKey);if(t&&t.data!==void 0)e[n]=t.data;else if(i.prevCacheKey){let t=r.get(i.prevCacheKey);e[n]=t&&t.data!==void 0?t.data:i.defaults}else e[n]=i.defaults;i.loading&&(e.__openui_loading.push(n),i.everFetched&&e.__openui_refetching.push(n)),i.error&&e.__openui_errors.push(i.error)}for(let[t,r]of n)e[t]=r.result,r.error&&e.__openui_errors.push(r.error);try{let t=JSON.stringify(e);if(t===o)return!1;a=e,o=t}catch{a=e,o=``}return!0}function u(){for(let e of[...i])e()}async function d(n,i){if(!e)return;let a=t.get(i);if(!a)return;let o=n,c=a.toolName,p=a.args,m=r.get(o);m?m.inFlight=!0:(m={data:void 0,inFlight:!0},r.set(o,m)),a.loading=!0,l(),u();try{let n=await e.callTool(c,p??{});if(s)return;let r=t.get(i);if(!r||r.cacheKey!==o){m.inFlight=!1;return}if(m.data=n??null,r.everFetched=!0,r.error=void 0,r.prevCacheKey&&r.prevCacheKey!==o){let e=r.prevCacheKey;r.prevCacheKey=void 0,f(e)}}catch(e){let n=t.get(i);n&&n.cacheKey===o&&(n.error=e instanceof UG?{source:`query`,code:`tool-not-found`,message:`Query tool "${c}" not found`,statementId:i,component:`Query`,toolName:c,hint:e.availableTools.length?`Available tools: ${e.availableTools.join(`, `)}`:void 0}:e instanceof VG?{source:`query`,code:`mcp-error`,message:`Query "${c}" returned an error: ${e.toolErrorText}`,statementId:i,component:`Query`,toolName:c}:{source:`query`,code:`tool-error`,message:`Query "${c}" failed: ${e instanceof Error?e.message:String(e)}`,statementId:i,component:`Query`,toolName:c}),console.error(`Query "${c}" failed:`,e)}finally{m.inFlight=!1;let e=t.get(i);e&&e.cacheKey===o?(e.loading=!1,l()&&u(),e.needsRefetch&&(e.needsRefetch=!1,d(e.cacheKey,i))):l()&&u()}}function f(e){for(let n of t.values())if(n.cacheKey===e||n.prevCacheKey===e)return;r.delete(e)}function p(n){if(s)return;let i=new Set(n.map(e=>e.statementId));for(let[e,n]of t)i.has(e)||(n.timer&&clearInterval(n.timer),t.delete(e),f(n.cacheKey),n.prevCacheKey&&f(n.prevCacheKey));for(let i of n){if(!i.complete)continue;let n=GG(i.toolName,i.args,i.deps),a=t.get(i.statementId);a?(a.cacheKey!==n&&(a.prevCacheKey=a.cacheKey),a.toolName=i.toolName,a.args=i.args,a.defaults=i.defaults,a.cacheKey=n):t.set(i.statementId,{toolName:i.toolName,args:i.args,defaults:i.defaults,cacheKey:n,loading:!1,everFetched:!1,refreshInterval:0,needsRefetch:!1});let o=t.get(i.statementId),c=r.get(n),l=c&&c.data!==void 0&&!c.inFlight;e&&!l&&!c?.inFlight&&d(n,i.statementId);let u=i.refreshInterval??0;u!==o.refreshInterval&&(o.timer&&=(clearInterval(o.timer),void 0),u>0&&(o.timer=setInterval(()=>{!s&&e&&(r.get(o.cacheKey)?.inFlight||d(o.cacheKey,i.statementId))},u*1e3)),o.refreshInterval=u)}l()&&u()}function m(e){let n=t.get(e);if(!n)return null;let i=r.get(n.cacheKey);if(i&&i.data!==void 0)return i.data;if(n.prevCacheKey){let e=r.get(n.prevCacheKey);if(e&&e.data!==void 0)return e.data}return n.defaults}function h(e){return t.get(e)?.loading??!1}function g(){for(let e of t.values())if(e.loading)return!0;return!1}function _(n){if(s||!e)return;let i=n?.length?n.filter(e=>t.has(e)):[...t.keys()];for(let e of i){let n=t.get(e);n&&(r.get(n.cacheKey)?.inFlight?n.needsRefetch=!0:d(n.cacheKey,e))}}function v(e){let t=new Set(e.map(e=>e.statementId));for(let e of n.keys())t.has(e)||n.delete(e);for(let t of e){let e=n.get(t.statementId);e?e.toolName!==t.toolName&&(e.toolName=t.toolName,e.result={status:`idle`,data:null,error:null},e.error=void 0):n.set(t.statementId,{toolName:t.toolName,result:{status:`idle`}})}l()&&u()}async function y(t,r,i){if(s||!e)return!1;let a=n.get(t);if(!a||a.result.status===`loading`)return!1;let o=c;a.result={status:`loading`},l(),u();let d=!1;try{let t=await e.callTool(a.toolName,r);if(s||o!==c)return!1;a.result={status:`success`,data:t},a.error=void 0,d=!0}catch(e){if(s||o!==c)return!1;let n=e instanceof Error?e.message:String(e);a.result={status:`error`,error:n},a.error=e instanceof UG?{source:`mLine 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 FJ=xJ(`CharSizeService`),IJ=xJ(`CoreBrowserService`),LJ=xJ(`MouseService`),RJ=xJ(`RenderService`),zJ=xJ(`SelectionService`),BJ=xJ(`CharacterJoinerService`),VJ=xJ(`ThemeService`),HJ=xJ(`LinkProviderService`),UJ=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?YJ.isErrorNoTelemetry(e)?new YJ(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 gV(e){vV(e)||hV.onUnexpectedError(e)}var _V=`Canceled`;function vV(e){return e instanceof yV||e instanceof Error&&e.name===_V&&e.message===_V}var yV=class extends Error{constructor(){super(_V),this.name=this.message}};function bV(e){return Error(e?`Illegal argument: ${e}`:`Illegal argument`)}var xV=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`}},SV=class e extends Error{constructor(t){super(t||`An unexpected bug occurred.`),Object.setPrototypeOf(this,e.prototype)}};function CV(e,t=0){return e[e.length-(1+t)]}var wV;(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})(wV||={});var TV=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||wV.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};TV.empty=new TV(e=>{});function EV(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 DV;(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})(DV||={});var OV=null;function kV(e){return OV?.trackDisposable(e),e}function AV(e){OV?.markAsDisposed(e)}function jV(e,t){OV?.setParent(e,t)}function MV(e){return OV?.markAsSingleton(e),e}function NV(e){if(DV.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 PV(...e){return FV(()=>NV(e))}function FV(e){let t=kV({dispose:EV(()=>{AV(t),e()})});return t}var IV=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,kV(this)}dispose(){this._isDisposed||(AV(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{NV(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return jV(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),jV(e,null))}};IV.DISABLE_DISPOSED_WARNING=!1;var LV=IV,RV=class{constructor(){this._store=new LV,kV(this),jV(this._store,this)}dispose(){AV(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 WJ(e){KJ(e)||UJ.onUnexpectedError(e)}var GJ=`Canceled`;function KJ(e){return e instanceof qJ||e instanceof Error&&e.name===GJ&&e.message===GJ}var qJ=class extends Error{constructor(){super(GJ),this.name=this.message}};function JJ(e){return Error(e?`Illegal argument: ${e}`:`Illegal argument`)}var YJ=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`}},XJ=class e extends Error{constructor(t){super(t||`An unexpected bug occurred.`),Object.setPrototypeOf(this,e.prototype)}};function ZJ(e,t=0){return e[e.length-(1+t)]}var QJ;(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})(QJ||={});var $J=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||QJ.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}};$J.empty=new $J(e=>{});function eY(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 tY;(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})(tY||={});var nY=null;function rY(e){return nY?.trackDisposable(e),e}function iY(e){nY?.markAsDisposed(e)}function aY(e,t){nY?.setParent(e,t)}function oY(e){return nY?.markAsSingleton(e),e}function sY(e){if(tY.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 cY(...e){return lY(()=>sY(e))}function lY(e){let t=rY({dispose:eY(()=>{iY(t),e()})});return t}var uY=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,rY(this)}dispose(){this._isDisposed||(iY(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{sY(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error(`Cannot register a disposable on itself!`);return aY(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),aY(e,null))}};uY.DISABLE_DISPOSED_WARNING=!1;var dY=uY,fY=class{constructor(){this._store=new dY,rY(this),aY(this._store,this)}dispose(){iY(thi Line truncated
`).slice(2).join(`
`))}},$V=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},eH=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},tH=0,nH=class{constructor(e){this.value=e,this.id=tH++}},rH=2,iH=class{constructor(e){this._size=0,this._options=e,this._leakageMon=YV>0||this._options?.leakWarningThreshold?new ZV(e?.onListenerError??gV,this._options?.leakWarningThreshold??YV):void 0,this._perfMon=this._options?._profName?new JV(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 eH(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||gV)(n),RV.None}if(this._disposed)return RV.None;t&&(e=e.bind(t));let r=new nH(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=QV.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof nH?(this._deliveryQueue??=new aH,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=FV(()=>{i?.(),this._removeListener(r)});return n instanceof LV?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*rH<=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||gV;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 nH)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}},aH=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}},oH=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new iH,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new iH,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}};oH.INSTANCE=new oH;var sH=oH;function cH(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}sH.INSTANCE.onDidChangeZoomLevel;function lH(e){return sH.INSTANCE.getZoomFactor(e)}sH.INSTANCE.onDidChangeFullscreen;var uH=typeof navigator==`object`?navigator.userAgent:``,dH=uH.indexOf(`Firefox`)>=0,fH=uH.indexOf(`AppleWebKit`)>=0,pH=uH.indexOf(`Chrome`)>=0,mH=!pH&&uH.indexOf(`Safari`)>=0;uH.indexOf(`Electron/`),uH.indexOf(`Android`);var hH=!1;if(typeof BV.matchMedia==`function`){let e=BV.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=BV.matchMedia(`(display-mode: fullscreen)`);hH=e.matches,cH(BV,e,({matches:e})=>{hH&&t.matches||(hH=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}};dW=xB([SB(2,YB),SB(3,cV),SB(4,XB),SB(5,pV),SB(6,tV),SB(7,uV)],dW);var fW=class extends RV{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(FV(()=>{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 vW;(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=`Ÿ`))(vW||={});var yW;(e=>e.ST=`${$.ESC}\\`)(yW||={});var bW=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)}}};bW=xB([SB(2,YB),SB(3,tV),SB(4,ZB),SB(5,uV)],bW);var xW=0,SW=0,CW=0,wW=0,TW={css:`#00000000`,rgba:0},EW;(e=>{function t(e,t,n,r){return r===void 0?`#${jW(e)}${jW(t)}${jW(n)}`:`#${jW(e)}${jW(t)}${jW(n)}${jW(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})(EW||={});var DW;(e=>{function t(e,t){if(wW=(t.rgba&255)/255,wW===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 xW=a+Math.round((n-a)*wW),SW=o+Math.round((r-o)*wW),CW=s+Math.round((i-s)*wW),{css:EW.toCss(xW,SW,CW),rgba:EW.toRgba(xW,SW,CW)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=AW.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return EW.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[xW,SW,CW]=AW.toChannels(t),{css:EW.toCss(xW,SW,CW),rgba:t}}e.opaque=i;function a(e,t){return wW=Math.round(t*255),[xW,SW,CW]=AW.toChannels(e.rgba),{css:EW.toCss(xW,SW,CW,wW),rgba:EW.toRgba(xW,SW,CW,wW)}}e.opacity=a;function o(e,t){return wW=e.rgba&255,a(e,wW*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.r Line truncated
`))}},DY=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},OY=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},kY=0,AY=class{constructor(e){this.value=e,this.id=kY++}},jY=2,MY=class{constructor(e){this._size=0,this._options=e,this._leakageMon=CY>0||this._options?.leakWarningThreshold?new TY(e?.onListenerError??WJ,this._options?.leakWarningThreshold??CY):void 0,this._perfMon=this._options?._profName?new SY(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 OY(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||WJ)(n),fY.None}if(this._disposed)return fY.None;t&&(e=e.bind(t));let r=new AY(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=EY.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof AY?(this._deliveryQueue??=new NY,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=lY(()=>{i?.(),this._removeListener(r)});return n instanceof dY?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*jY<=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||WJ;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 AY)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}},NY=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}},PY=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new MY,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new MY,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}};PY.INSTANCE=new PY;var FY=PY;function IY(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}FY.INSTANCE.onDidChangeZoomLevel;function LY(e){return FY.INSTANCE.getZoomFactor(e)}FY.INSTANCE.onDidChangeFullscreen;var RY=typeof navigator==`object`?navigator.userAgent:``,zY=RY.indexOf(`Firefox`)>=0,BY=RY.indexOf(`AppleWebKit`)>=0,VY=RY.indexOf(`Chrome`)>=0,HY=!VY&&RY.indexOf(`Safari`)>=0;RY.indexOf(`Electron/`),RY.indexOf(`Android`);var UY=!1;if(typeof mY.matchMedia==`function`){let e=mY.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=mY.matchMedia(`(display-mode: fullscreen)`);UY=e.matches,IY(mY,e,({matches:e})=>{UY&&t.matches||(UY=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}};zZ=Yq([Xq(2,CJ),Xq(3,IJ),Xq(4,wJ),Xq(5,VJ),Xq(6,kJ),Xq(7,RJ)],zZ);var BZ=class extends fY{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(lY(()=>{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 KZ;(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=`Ÿ`))(KZ||={});var qZ;(e=>e.ST=`${$.ESC}\\`)(qZ||={});var JZ=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)}}};JZ=Yq([Xq(2,CJ),Xq(3,kJ),Xq(4,TJ),Xq(5,RJ)],JZ);var YZ=0,XZ=0,ZZ=0,QZ=0,$Z={css:`#00000000`,rgba:0},eQ;(e=>{function t(e,t,n,r){return r===void 0?`#${aQ(e)}${aQ(t)}${aQ(n)}`:`#${aQ(e)}${aQ(t)}${aQ(n)}${aQ(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})(eQ||={});var tQ;(e=>{function t(e,t){if(QZ=(t.rgba&255)/255,QZ===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 YZ=a+Math.round((n-a)*QZ),XZ=o+Math.round((r-o)*QZ),ZZ=s+Math.round((i-s)*QZ),{css:eQ.toCss(YZ,XZ,ZZ),rgba:eQ.toRgba(YZ,XZ,ZZ)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=iQ.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return eQ.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[YZ,XZ,ZZ]=iQ.toChannels(t),{css:eQ.toCss(YZ,XZ,ZZ),rgba:t}}e.opaque=i;function a(e,t){return QZ=Math.round(t*255),[YZ,XZ,ZZ]=iQ.toChannels(e.rgba),{css:eQ.toCss(YZ,XZ,ZZ,QZ),rgba:eQ.toRgba(YZ,XZ,ZZ,QZ)}}e.opacity=a;function o(e,t){return QZ=e.rgba&255,a(e,QZ*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()),SG&&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=GG(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=oG(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,-KG),KG),t/=KG,t/Math.abs(t)+Math.round(t*(qG-1)))}shouldForceSelection(e){return vG?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(),JG)}_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&&!(vG&&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(xU(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(FV(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<Jq+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===Jq+1&&(this._liveRegion.textContent+=EB.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 wB.get()},set promptLabel(e){wB.set(e)},get tooMuchOutput(){return EB.get()},set tooMuchOutput(e){EB.set(e)}}}_verifyIntegers(...e){for(sJ of e)if(sJ===1/0||isNaN(sJ)||sJ%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(sJ of e)if(sJ&&(sJ===1/0||isNaN(sJ)||sJ%1!=0||sJ<0))throw Error(`This API only accepts positive integers`)}},lJ=2,uJ=1,dJ=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(lJ,Math.floor(u/e.css.cell.width)),rows:Math.max(uJ,Math.floor(l/e.css.cell.height))}}},fJ={class:`flex h-[32rem] min-h-0 flex-col gap-2`},pJ={key:0,class:`text-sm text-fg-muted`,role:`status`},mJ=P({__name:`SandboxView`,props:{taskId:{},attempt:{}},setup(e){let t=e,n=J(null),r=J(`connecting`),i=null,a=null,o=null,s=null;function c(){try{o?.fit()}catch{}}return Be(()=>{let e=n.value;if(!e)return;i=new cJ({convertEol:!0,disableStdin:!0,cursorBlink:!1,fontFamily:`'IBM Plex Mono', ui-monospace, monospace`,fontSize:13,theme:{background:`#0b0f14`,foreground:`#e6edf3`}}),o=new dJ,i.loadAddon(o),i.open(e),c();let l=window.location.protocol===`https:`?`wss:`:`ws:`,u=new URLSearchParams({attempt:String(t.attempt)}),d=new WebSocket(`${l}//${window.location.host}/api/tasks/${encodeURIComponent(t.taskId)}/sandbox?${u}`);a=d,d.binaryType=`arraybuffer`,d.onopen=()=>{r.value=`open`},d.onmessage=e=>{i&&(typeof e.data==`string`&&(r.value=`failed`),i.write(typeof e.data==`string`?e.data:new Uint8Array(e.data)))},d.onerror=()=>{r.value=`failed`},d.onclose=()=>{r.value!==`failed`&&(r.value=`closed`)},s=new ResizeObserver(c),s.observe(e)}),nt(()=>{s?.disconnect(),s=null,a?.close(),a=null,i?.dispose(),i=null,o=null}),(e,t)=>(L(),j(`div`,fJ,[r.value===`open`?F(``,!0):(L(),j(`p`,pJ,[r.value===`connecting`?(L(),j(U,{key:0},[H(`Connecting…`)],64)):r.value===`closed`?(L(),j(U,{key:1},[H(`The sandbox ended.`)],64)):(L(),j(U,{key:2},[H(`Sandbox unavailable.`)],64))])),R(`div`,{ref_key:`host`,ref:n,class:`min-h-0 flex-1 overflow-hidden rounded-md border border-border bg-[#0b0f14] p-2`},null,512)]))}}),hJ={class:`flex flex-wrap items-center gap-3 border-b border-border pb-3`},gJ={class:`inline-flex items-center gap-2`},_J={class:`inline-flex items-center gap-2`},vJ=`__all__`,yJ=P({__name:`TaskLogFilters`,props:{filters:{},stages:{}},emits:[`filter`],setup(e,{emit:t}){let n=e,r=t,i=Y(()=>LM.map(e=>({value:e.value||vJ,label:e.label}))),a=Y(()=>n.filters.level||vJ),o=Y(()=>n.filters.stage||vJ);function s(e){r(`filter`,{...n.filters,...e})}function c(e){s({level:String(e)===vJ?``:String(e)})}function l(e){s({stage:String(e)===vJ?``:String(e)})}return(t,n)=>(L(),j(`div`,hJ,[R(`div`,gJ,[A(V(Vu),{"model-value":a.value,"onUpdate:modelValue":c},{default:I(()=>[A(V(Gu),{size:`sm`,"aria-label":`Filter log entries by level`},{default:I(()=>[A(V(Ku))]),_:1}),A(V(Hu),null,{default:I(()=>[A(V(Uu),null,{default:I(()=>[(L(!0),j(U,null,M(i.value,e=>(L(),q(V(Wu),{key:e.value,value:e.value},{default:I(()=>[H(B(e.label),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`model-value`])]),R(`div`,_J,[A(V(Vu),{"model-value":o.value,"onUpdate:modelValue":l},{default:I(()=>[A(V(Gu),{size:`sm`,"aria-label":`Filter log entries by stage`},{default:I(()=>[A(V(Ku))]),_:1}),A(V(Hu),null,{default:I(()=>[A(V(Uu),null,{default:I(()=>[A(V(Wu),{value:vJ},{default:I(()=>[...n[0]||=[H(`All stages`,-1)]]),_:1}),(L(!0),j(U,null,M(e.stages,e=>(L(),q(V(Wu),{key:e,value:e},{default:I(()=>[H(B(e),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`model-value`])])]))}}),bJ={class:`sr-only`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`},xJ={key:2,class:`flex flex-col items-start gap-2 py-3`},SJ={key:0,class:`mt-2 flex flex-wrap items-cent Line truncated
`)}};FX.defaultYaml={explicit:!1,version:`1.2`},FX.defaultTags={"!!":`tag:yaml.org,2002:`};function IX(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 LX(e){let t=new Set;return OX(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function RX(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function zX(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=LX(e);let a=RX(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(bX(t.node)||SX(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 BX(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=BX(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=BX(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=BX(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=BX(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function VX(e,t,n){if(Array.isArray(e))return e.map((e,t)=>VX(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!wX(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 HX=class{constructor(e){Object.defineProperty(this,hX,{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(!_X(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=VX(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?BX(i,{"":o},``,o):o}},UX=class extends HX{constructor(e){super(lX),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=[],OX(e,{Node:(e,t)=>{(gX(t)||wX(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||=(VX(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=WX(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(IX(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 WX(e,t,n){if(gX(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(SX(t)){let r=0;for(let i of t.items){let t=WX(e,i,n);t>r&&(r=t)}return r}if(yX(t)){let r=WX(e,t.key,n),i=WX(e,t.value,n);return Math.max(r,i)}return 1}var GX=e=>!e||typeof e!=`function`&&typeof e!=`object`,KX=class extends HX{constructor(e){super(pX),this.value=e}toJSON(e,t){return t?.keep?this.value:VX(this.value,e,t)}toString(){return String(this.value)}};KX.BLOCK_FOLDED=`BLOCK_FOLDED`,KX.BLOCK_LITERAL=`BLOCK_LITERAL`,KX.PLAIN=`PLAIN`,KX.QUOTE_DOUBLE=`QUOTE_DOUBLE`,KX.QUOTE_SINGLE=`QUOTE_SINGLE`;var qX=`tag:yaml.org,2002:`;function JX(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 YX(e,t,n){if(_X(e)&&(e=e.contents),CX(e))return e;if(yX(e)){let t=n.schema[dX].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 UX(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=qX+t.slice(2));let l=JX(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new KX(e);return c&&(c.node=t),t Line truncated
`)?eZ(n,t):n.includes(`
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh()),XQ&&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=y$(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=PQ(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,-b$),b$),t/=b$,t/Math.abs(t)+Math.round(t*(x$-1)))}shouldForceSelection(e){return KQ?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(),S$)}_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&&!(KQ&&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(YX(i,`selectionchange`,()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(lY(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(` `)}_handleChar(e){this._liveRegionLineCount<x0+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===x0+1&&(this._liveRegion.textContent+=eJ.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 Qq.get()},set promptLabel(e){Qq.set(e)},get tooMuchOutput(){return eJ.get()},set tooMuchOutput(e){eJ.set(e)}}}_verifyIntegers(...e){for(T0 of e)if(T0===1/0||isNaN(T0)||T0%1!=0)throw Error(`This API only accepts integers`)}_verifyPositiveIntegers(...e){for(T0 of e)if(T0&&(T0===1/0||isNaN(T0)||T0%1!=0||T0<0))throw Error(`This API only accepts positive integers`)}},rle=2,ile=1,D0=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(rle,Math.floor(u/e.css.cell.width)),rows:Math.max(ile,Math.floor(l/e.css.cell.height))}}},ale={class:`flex h-[32rem] min-h-0 flex-col gap-2`},ole={key:0,class:`text-sm text-fg-muted`,role:`status`},sle=y({__name:`SandboxView`,props:{taskId:{},attempt:{}},setup(e){let t=e,n=W(null),r=W(`connecting`),i=null,a=null,s=null,c=null;function l(){try{s?.fit()}catch{}}return P(()=>{let e=n.value;if(!e)return;i=new E0({convertEol:!0,disableStdin:!0,cursorBlink:!1,fontFamily:`'IBM Plex Mono', ui-monospace, monospace`,fontSize:13,theme:{background:`#0b0f14`,foreground:`#e6edf3`}}),s=new D0,i.loadAddon(s),i.open(e),l();let o=window.location.protocol===`https:`?`wss:`:`ws:`,u=new URLSearchParams({attempt:String(t.attempt)}),d=new WebSocket(`${o}//${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`)},c=new ResizeObserver(l),c.observe(e)}),be(()=>{c?.disconnect(),c=null,a?.close(),a=null,i?.dispose(),i=null,s=null}),(e,t)=>(j(),o(`div`,ale,[r.value===`open`?T(``,!0):(j(),o(`p`,ole,[r.value===`connecting`?(j(),o(z,{key:0},[R(`Connecting…`)],64)):r.value===`closed`?(j(),o(z,{key:1},[R(`The sandbox ended.`)],64)):(j(),o(z,{key:2},[R(`Sandbox unavailable.`)],64))])),N(`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)]))}}),cle={class:`flex flex-wrap items-center gap-3 border-b border-border pb-3`},lle={class:`inline-flex items-center gap-2`},ule={class:`inline-flex items-center gap-2`},O0=`__all__`,dle=y({__name:`TaskLogFilters`,props:{filters:{},stages:{}},emits:[`filter`],setup(e,{emit:t}){let n=e,i=t,a=G(()=>_O.map(e=>({value:e.value||O0,label:e.label}))),c=G(()=>n.filters.level||O0),l=G(()=>n.filters.stage||O0);function u(e){i(`filter`,{...n.filters,...e})}function d(e){u({level:String(e)===O0?``:String(e)})}function f(e){u({stage:String(e)===O0?``:String(e)})}return(t,n)=>(j(),o(`div`,cle,[N(`div`,lle,[r(L(ql),{"model-value":c.value,"onUpdate:modelValue":d},{default:A(()=>[r(L(tu),{size:`sm`,"aria-label":`Filter log entries by level`},{default:A(()=>[r(L(nu))]),_:1}),r(L(Jl),null,{default:A(()=>[r(L(Yl),null,{default:A(()=>[(j(!0),o(z,null,s(a.value,e=>(j(),U(L(Zl),{key:e.value,value:e.value},{default:A(()=>[R(I(e.label),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`model-value`])]),N(`div`,ule,[r(L(ql),{"model-value":l.value,"onUpdate:modelValue":f},{default:A(()=>[r(L(tu),{size:`sm`,"aria-label":`Filter log entries by stage`},{default:A(()=>[r(L(nu))]),_:1}),r(L(Jl),null,{default:A(()=>[r(L(Yl),null,{default:A(()=>[r(L(Zl),{value:O0},{default:A(()=>[...n[0]||=[R(`All stages`,-1)]]),_:1}),(j(!0),o(z,null,s(e.stages,e=>(j(),U(L(Zl),{key:e,value:e},{default:A(()=>[R(I(e),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1})]),_:1},8,[`model-value`])])]))}}),fle={class:`sr-only`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`},ple={key:2,class:`flex flex-col items-start gap-2 py-3`},mle={key:0,class:`mt-2 flex fl Line truncated
`)}};i2.defaultYaml={explicit:!1,version:`1.2`},i2.defaultTags={"!!":`tag:yaml.org,2002:`};function a2(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 o2(e){let t=new Set;return n2(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function s2(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function Que(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=o2(e);let a=s2(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(Y0(t.node)||Z0(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 c2(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=c2(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=c2(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=c2(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=c2(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function l2(e,t,n){if(Array.isArray(e))return e.map((e,t)=>l2(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!$0(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 u2=class{constructor(e){Object.defineProperty(this,W0,{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(!K0(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=l2(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?c2(i,{"":o},``,o):o}},d2=class extends u2{constructor(e){super(R0),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=[],n2(e,{Node:(e,t)=>{(G0(t)||$0(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||=(l2(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=f2(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(a2(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 f2(e,t,n){if(G0(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(Z0(t)){let r=0;for(let i of t.items){let t=f2(e,i,n);t>r&&(r=t)}return r}if(J0(t)){let r=f2(e,t.key,n),i=f2(e,t.value,n);return Math.max(r,i)}return 1}var p2=e=>!e||typeof e!=`function`&&typeof e!=`object`,m2=class extends u2{constructor(e){super(H0),this.value=e}toJSON(e,t){return t?.keep?this.value:l2(this.value,e,t)}toString(){return String(this.value)}};m2.BLOCK_FOLDED=`BLOCK_FOLDED`,m2.BLOCK_LITERAL=`BLOCK_LITERAL`,m2.PLAIN=`PLAIN`,m2.QUOTE_DOUBLE=`QUOTE_DOUBLE`,m2.QUOTE_SINGLE=`QUOTE_SINGLE`;var $ue=`tag:yaml.org,2002:`;function ede(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 h2(e,t,n){if(K0(e)&&(e=e.contents),Q0(e))return e;if(J0(e)){let t=n.schema[B0].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 d2(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=$ue+t.slice(2));let l=ede(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new m2(e);return c&&(c.node Line truncated
`)?y2(n,t):n.includes(`
`)?`
`+eZ(n,t):(e.endsWith(` `)?``:` `)+n,nZ=`flow`,rZ=`block`,iZ=`quoted`;function aZ(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=oZ(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=oZ(e,h,t.length)),d=h+t.length+c,f=void 0;else{if(r===` `&&p&&p!==` `&&p!==`
`+y2(n,t):(e.endsWith(` `)?``:` `)+n,x2=`flow`,nde=`block`,rde=`quoted`;function S2(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=C2(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=C2(e,h,t.length)),d=h+t.length+c,f=void 0;else{if(r===` `&&p&&p!==` `&&p!==`
`&&p!==` `){let t=e[h+1];t&&t!==` `&&t!==`
`&&t!==` `&&(f=h)}if(h>=d){if(f)l.push(f),d=f+c,f=void 0;else if(n===`quoted`){for(;p===` `||p===` `;)p=r,r=e[h+=1],m=!0;let t=h>_+1?h-2:g-1;if(u[t])return e;l.push(t),u[t]=!0,d=t+c,f=void 0}else m=!0}}p=r}if(m&&s&&s(),l.length===0)return e;o&&o();let v=e.slice(0,l[0]);for(let r=0;r<l.length;++r){let i=l[r],a=l[r+1]||e.length;i===0?v=`\n${t}${e.slice(0,a)}`:(n===`quoted`&&u[i]&&(v+=`${e[i]}\\`),v+=`\n${t}${e.slice(i+1,a)}`)}return v}function oZ(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 sZ=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),cZ=e=>/^(%|---|\.\.\.)/m.test(e);function lZ(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 uZ(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(cZ(e)?` `:``),o=``,s=0;for(let e=0,t=n[e];t;t=n[++e])if(t===` `&&n[e+1]===`\\`&&n[e+2]===`n`&&(o+=n.slice(s,e)+`\\ `,e+=1,s=e,t=`\\`),t===`\\`)switch(n[e+1]){case`u`:{o+=n.slice(s,e);let t=n.substr(e+2,4);switch(t){case`0000`:o+=`\\0`;break;case`0007`:o+=`\\a`;break;case`000b`:o+=`\\v`;break;case`001b`:o+=`\\e`;break;case`0085`:o+=`\\N`;break;case`00a0`:o+=`\\_`;break;case`2028`:o+=`\\L`;break;case`2029`:o+=`\\P`;break;default:t.substr(0,2)===`00`?o+=`\\x`+t.substr(2):o+=n.substr(e,6)}e+=5,s=e+1}break;case`n`:if(r||n[e+2]===`"`||n.length<i)e+=1;else{for(o+=n.slice(s,e)+`
`&&t!==` `&&(f=h)}if(h>=d){if(f)l.push(f),d=f+c,f=void 0;else if(n===`quoted`){for(;p===` `||p===` `;)p=r,r=e[h+=1],m=!0;let t=h>_+1?h-2:g-1;if(u[t])return e;l.push(t),u[t]=!0,d=t+c,f=void 0}else m=!0}}p=r}if(m&&s&&s(),l.length===0)return e;o&&o();let v=e.slice(0,l[0]);for(let r=0;r<l.length;++r){let i=l[r],a=l[r+1]||e.length;i===0?v=`\n${t}${e.slice(0,a)}`:(n===`quoted`&&u[i]&&(v+=`${e[i]}\\`),v+=`\n${t}${e.slice(i+1,a)}`)}return v}function C2(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 w2=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),T2=e=>/^(%|---|\.\.\.)/m.test(e);function ide(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 E2(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(T2(e)?` `:``),o=``,s=0;for(let e=0,t=n[e];t;t=n[++e])if(t===` `&&n[e+1]===`\\`&&n[e+2]===`n`&&(o+=n.slice(s,e)+`\\ `,e+=1,s=e,t=`\\`),t===`\\`)switch(n[e+1]){case`u`:{o+=n.slice(s,e);let t=n.substr(e+2,4);switch(t){case`0000`:o+=`\\0`;break;case`0007`:o+=`\\a`;break;case`000b`:o+=`\\v`;break;case`001b`:o+=`\\e`;break;case`0085`:o+=`\\N`;break;case`00a0`:o+=`\\_`;break;case`2028`:o+=`\\L`;break;case`2029`:o+=`\\P`;break;default:t.substr(0,2)===`00`?o+=`\\x`+t.substr(2):o+=n.substr(e,6)}e+=5,s=e+1}break;case`n`:if(r||n[e+2]===`"`||n.length<i)e+=1;else{for(o+=n.slice(s,e)+`
`;n[e+2]===`\\`&&n[e+3]===`n`&&n[e+4]!==`"`;)o+=`
`,e+=2;o+=a,n[e+2]===` `&&(o+=`\\`),e+=1,s=e+1}break;default:e+=1}return o=s?o+n.slice(s):n,r?o:aZ(o,a,iZ,sZ(t,!1))}function dZ(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
`)||/[ \t]\n|\n[ \t]/.test(e))return uZ(e,t);let n=t.indent||(cZ(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:aZ(r,n,nZ,sZ(t,!1))}function fZ(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=uZ;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?dZ:i&&!t?uZ:n?dZ:uZ}return r(e,t)}var pZ;try{pZ=RegExp(`(^|(?<!
`,e+=2;o+=a,n[e+2]===` `&&(o+=`\\`),e+=1,s=e+1}break;default:e+=1}return o=s?o+n.slice(s):n,r?o:S2(o,a,rde,w2(t,!1))}function D2(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
`)||/[ \t]\n|\n[ \t]/.test(e))return E2(e,t);let n=t.indent||(T2(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:S2(r,n,x2,w2(t,!1))}function O2(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=E2;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?D2:i&&!t?E2:n?D2:E2}return r(e,t)}var k2;try{k2=RegExp(`(^|(?<!
))
+(?!
|$)`,`g`)}catch{pZ=/\n+(?!\n|$)/g}function mZ({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 fZ(n,r);let l=r.indent||(r.forceBlockIndent||cZ(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===KX.BLOCK_FOLDED?!1:t===KX.BLOCK_LITERAL||!lZ(n,c,l.length);if(!n)return u?`|
|$)`,`g`)}catch{k2=/\n+(?!\n|$)/g}function A2({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 O2(n,r);let l=r.indent||(r.forceBlockIndent||T2(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===m2.BLOCK_FOLDED?!1:t===m2.BLOCK_LITERAL||!ide(n,c,l.length);if(!n)return u?`|
`:`>
`;let d,f;for(f=n.length;f>0;--f){let e=n[f-1];if(e!==`
`&&e!==` `&&e!==` `)break}let p=n.substring(f),m=p.indexOf(`
`);m===-1?d=`-`:n===p||m!==p.length-1?(d=`+`,a&&a()):d=``,p&&=(n=n.slice(0,-p.length),p[p.length-1]===`
`&&(p=p.slice(0,-1)),p.replace(pZ,`$&${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(k2,`$&${l}`));let h=!1,g,_=-1;for(g=0;g<n.length;++g){let e=n[g];if(e===` `)h=!0;else if(e===`
`)_=g;else break}let v=n.substring(0,_<g?_+1:g);v&&=(n=n.substring(v.length),v.replace(/\n+/g,`$&${l}`));let y=(h?l?`2`:`1`:``)+d;if(e&&(y+=` `+s(e.replace(/ ?[\r\n]+/g,` `)),i&&i()),!u){let e=n.replace(/\n+/g,`
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\n+/g,`$&${l}`),i=!1,a=sZ(r,!0);o!==`folded`&&t!==KX.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=aZ(`${v}${e}${p}`,l,rZ,a);if(!i)return`>${y}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${y}\n${l}${v}${n}${p}`}function hZ(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 fZ(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
`)?fZ(a,t):mZ(e,t,n,r);if(!s&&!u&&i!==KX.PLAIN&&a.includes(`
`))return mZ(e,t,n,r);if(cZ(a)){if(c===``)return t.forceBlockIndent=!0,mZ(e,t,n,r);if(s&&c===l)return fZ(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 fZ(a,t)}return s?d:aZ(d,c,nZ,sZ(t,!1))}function gZ(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!==KX.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=KX.QUOTE_DOUBLE);let c=e=>{switch(e){case KX.BLOCK_FOLDED:case KX.BLOCK_LITERAL:return i||a?fZ(o.value,t):mZ(o,t,n,r);case KX.QUOTE_DOUBLE:return uZ(o.value,t);case KX.QUOTE_SINGLE:return dZ(o.value,t);case KX.PLAIN:return hZ(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 _Z(e,t){let n=Object.assign({blockQuote:!0,commentString:$X,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 vZ(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(bX(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 yZ(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(bX(e)||SX(e))&&e.anchor;a&&IX(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 bZ(e,t,n,r){if(yX(e))return e.toString(t,n,r);if(gX(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=CX(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=vZ(t.doc.schema.tags,a);let o=yZ(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):bX(a)?gZ(a,t,n,r):a.toString(t,n,r);return o?bX(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function xZ({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=CX(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(SX(e)||!CX(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||SX(e)||(bX(e)?e.type===KX.BLOCK_FOLDED||e.type===KX.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=bZ(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+=tZ(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=tZ(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=tZ(g,n.indent,l(f))));let _,v,y;CX(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&&bX(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&xX(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let b=!1,x=bZ(t,n,()=>b=!0,()=>h=!0),S=` `;if(f||_||v){if(S=_?`
`:``,v){let e=l(v);S+=`\n${eZ(e,n.indent)}`}x===``&&!n.inFlow?S===`
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\n+/g,`$&${l}`),i=!1,a=w2(r,!0);o!==`folded`&&t!==m2.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=S2(`${v}${e}${p}`,l,nde,a);if(!i)return`>${y}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${y}\n${l}${v}${n}${p}`}function ade(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 O2(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
`)?O2(a,t):A2(e,t,n,r);if(!s&&!u&&i!==m2.PLAIN&&a.includes(`
`))return A2(e,t,n,r);if(T2(a)){if(c===``)return t.forceBlockIndent=!0,A2(e,t,n,r);if(s&&c===l)return O2(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 O2(a,t)}return s?d:S2(d,c,x2,w2(t,!1))}function j2(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!==m2.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=m2.QUOTE_DOUBLE);let c=e=>{switch(e){case m2.BLOCK_FOLDED:case m2.BLOCK_LITERAL:return i||a?O2(o.value,t):A2(o,t,n,r);case m2.QUOTE_DOUBLE:return E2(o.value,t);case m2.QUOTE_SINGLE:return D2(o.value,t);case m2.PLAIN:return ade(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 M2(e,t){let n=Object.assign({blockQuote:!0,commentString:tde,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 ode(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(Y0(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 sde(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(Y0(e)||Z0(e))&&e.anchor;a&&a2(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 N2(e,t,n,r){if(J0(e))return e.toString(t,n,r);if(G0(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=Q0(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=ode(t.doc.schema.tags,a);let o=sde(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):Y0(a)?j2(a,t,n,r):a.toString(t,n,r);return o?Y0(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function cde({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=Q0(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(Z0(e)||!Q0(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||Z0(e)||(Y0(e)?e.type===m2.BLOCK_FOLDED||e.type===m2.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=N2(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+=b2(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=b2(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=b2(g,n.indent,l(f))));let _,v,y;Q0(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&&Y0(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&X0(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let b=!1,x=N2(t,n,()=>b=!0,()=>h=!0),S=` `;if(f||_||v){if(S=_?`
`:``,v){let e=l(v);S+=`\n${y2(e,n.indent)}`}x===``&&!n.inFlow?S===`
`&&y&&(S=`
`):S+=`\n${n.indent}`}else if(!p&&SX(t)){let e=x[0],r=x.indexOf(`
`):S+=`\n${n.indent}`}else if(!p&&Z0(t)){let e=x[0],r=x.indexOf(`
`),i=r!==-1,a=n.inFlow??t.flow??t.items.length===0;if(i||!a){let t=!1;if(i&&(e===`&`||e===`!`)){let n=x.indexOf(` `);e===`&`&&n!==-1&&n<r&&x[n+1]===`!`&&(n=x.indexOf(` `,n+1)),(n===-1||r<n)&&(t=!0)}t||(S=`\n${n.indent}`)}}else(x===``||x[0]===`
`)&&(S=``);return g+=S+x,n.inFlow?b&&r&&r():y&&!b?g+=tZ(g,n.indent,l(y)):h&&i&&i(),g}function SZ(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}var CZ=`<<`,wZ={identify:e=>e===CZ||typeof e==`symbol`&&e.description===CZ,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new KX(Symbol(CZ)),{addToJSMap:EZ}),stringify:()=>CZ},TZ=(e,t)=>(wZ.identify(t)||bX(t)&&(!t.type||t.type===KX.PLAIN)&&wZ.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===wZ.tag&&e.default);function EZ(e,t,n){let r=OZ(e,n);if(xX(r))for(let n of r.items)DZ(e,t,n);else if(Array.isArray(r))for(let n of r)DZ(e,t,n);else DZ(e,t,r)}function DZ(e,t,n){let r=OZ(e,n);if(!vX(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 OZ(e,t){return e&&gX(t)?t.resolve(e.doc,e):t}function kZ(e,t,{key:n,value:r}){if(CX(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(TZ(e,n))EZ(e,t,r);else{let i=VX(n,``,e);if(t instanceof Map)t.set(i,VX(r,i,e));else if(t instanceof Set)t.add(i);else{let a=wie(n,i,e),o=VX(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function wie(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(CX(e)&&n?.doc){let t=_Z(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)+`..."`),SZ(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 AZ(e,t,n){return new jZ(YX(e,void 0,n),YX(t,void 0,n))}var jZ=class e{constructor(e,t=null){Object.defineProperty(this,hX,{value:fX}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return CX(n)&&(n=n.clone(t)),CX(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return kZ(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?xZ(this,e,t,n):JSON.stringify(this)}};function MZ(e,t,n){return(t.inFlow??e.flow?PZ:NZ)(e,t,n)}function NZ({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(CX(i))!d&&i.spaceBefore&&f.push(``),FZ(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(yX(i)){let e=CX(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),FZ(n,f,e.commentBefore,d))}d=!1;let s=bZ(i,u,()=>o=null,()=>d=!0);o&&(s+=tZ(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+=b2(g,n.indent,l(y)):h&&i&&i(),g}function P2(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}var F2=`<<`,I2={identify:e=>e===F2||typeof e==`symbol`&&e.description===F2,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new m2(Symbol(F2)),{addToJSMap:L2}),stringify:()=>F2},lde=(e,t)=>(I2.identify(t)||Y0(t)&&(!t.type||t.type===m2.PLAIN)&&I2.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===I2.tag&&e.default);function L2(e,t,n){let r=z2(e,n);if(X0(r))for(let n of r.items)R2(e,t,n);else if(Array.isArray(r))for(let n of r)R2(e,t,n);else R2(e,t,r)}function R2(e,t,n){let r=z2(e,n);if(!q0(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 z2(e,t){return e&&G0(t)?t.resolve(e.doc,e):t}function B2(e,t,{key:n,value:r}){if(Q0(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(lde(e,n))L2(e,t,r);else{let i=l2(n,``,e);if(t instanceof Map)t.set(i,l2(r,i,e));else if(t instanceof Set)t.add(i);else{let a=ude(n,i,e),o=l2(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function ude(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(Q0(e)&&n?.doc){let t=M2(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)+`..."`),P2(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 V2(e,t,n){return new H2(h2(e,void 0,n),h2(t,void 0,n))}var H2=class e{constructor(e,t=null){Object.defineProperty(this,W0,{value:V0}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return Q0(n)&&(n=n.clone(t)),Q0(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return B2(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?cde(this,e,t,n):JSON.stringify(this)}};function U2(e,t,n){return(t.inFlow??e.flow?fde:dde)(e,t,n)}function dde({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(Q0(i))!d&&i.spaceBefore&&f.push(``),W2(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(J0(i)){let e=Q0(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),W2(n,f,e.commentBefore,d))}d=!1;let s=N2(i,u,()=>o=null,()=>d=!0);o&&(s+=b2(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+=`
`+eZ(l(e),c),s&&s()):d&&o&&o(),p}function PZ({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(CX(i))i.spaceBefore&&d.push(``),FZ(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(yX(i)){let e=CX(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),FZ(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=CX(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=bZ(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+=tZ(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 FZ({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=eZ(t(r),e);n.push(i.trimStart())}}function IZ(e,t){let n=bX(t)?t.value:t;for(let r of e)if(yX(r)&&(r.key===t||r.key===n||bX(r.key)&&r.key.value===n))return r}var LZ=class extends QX{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(dX,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(AZ(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=yX(e)?e:!e||typeof e!=`object`||!(`key`in e)?new jZ(e,e?.value):new jZ(e.key,e.value);let r=IZ(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);bX(r.value)&&GX(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=IZ(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=IZ(this.items,e)?.value;return(!t&&bX(n)?n.value:n)??void 0}has(e){return!!IZ(this.items,e)}set(e,t){this.add(new jZ(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)kZ(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!yX(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})),MZ(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},RZ={collection:`map`,default:!0,nodeClass:LZ,tag:`tag:yaml.org,2002:map`,resolve(e,t){return vX(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>LZ.from(e,t,n)},zZ=class extends QX{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(mX,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=BZ(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=BZ(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&bX(r)?r.value:r}has(e){let t=BZ(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=BZ(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];bX(r)&&GX(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(VX(e,String(r++),t));return n}toString(e,t,n){return e?MZ(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(YX(a,void 0,n))}}return i}};function BZ(e){let t=bX(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var VZ={collection:`seq`,default:!0,nodeClass:zZ,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return xX(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>zZ.from(e,t,n)},HZ={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),gZ(e,t,n,r)}},UZ={identify:e=>e==null,createNode:()=>new KX(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new KX(null),stringify:({source:e},t)=>typeof e==`string`&&UZ.test.test(e)?e:t.options.nullStr},WZ={identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new KX(e[0]===`t`||e[0]===`T`),stringify({source:e,value:t},n){return e&&WZ.test.test(e)&&t===(e[0]===`t`||e[0]===`T`)?e:t?n.options.trueStr:n.options.falseStr}};function GZ({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 KZ={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:GZ},qZ={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 gZ({comment:e,type:t,value:s},r,i,a)}};function sQ(e,t){if(xX(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!yX(r)){if(vX(r)){r.items.length>1&&t(`Each pair must have its own sequence indicator`);let e=r.items[0]||new jZ(new KX(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]=yX(r)?r:new jZ(r)}}else t(`Expected a sequence for this tag`);return e}function cQ(e,t,n){let{replacer:r}=n,i=new zZ(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(AZ(o,s,n))}return i}var lQ={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:sQ,createNode:cQ},uQ=class e extends zZ{constructor(){super(),this.add=LZ.prototype.add.bind(this),this.delete=LZ.prototype.delete.bind(this),this.get=LZ.prototype.get.bind(this),this.has=LZ.prototype.has.bind(this),this.set=LZ.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(yX(e)?(r=VX(e.key,``,t),i=VX(e.value,r,t)):r=VX(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=cQ(e,t,n),i=new this;return i.items=r.items,i}};uQ.tag=`tag:yaml.org,2002:omap`;var dQ={collection:`seq`,identify:e=>e instanceof Map,nodeClass:uQ,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,t){let n=sQ(e,t),r=[];for(let{key:e}of n.items)bX(e)&&(r.includes(e.value)?t(`Ordered maps must not include duplicate keys: ${e.value}`):r.push(e.value));return Object.assign(new uQ,n)},createNode:(e,t,n)=>uQ.from(e,t,n)};function fQ({value:e,source:t},n){return t&&(e?pQ:mQ).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var pQ={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 KX(!0),stringify:fQ},mQ={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 KX(!1),stringify:fQ},hQ={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:GZ},gQ={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():GZ(e)}},_Q={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 KX(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:GZ},vQ=e=>typeof e==`bigint`||Number.isInteger(e);function yQ(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 bQ(e,t,n){let{value:r}=e;if(vQ(r)){let e=r.toString(t);return r<0?`-`+n+e.substr(1):n+e}return GZ(e)}var xQ={identify:vQ,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>yQ(e,2,2,n),stringify:e=>bQ(e,2,`0b`)},SQ={identify:vQ,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>yQ(e,1,8,n),stringify:e=>bQ(e,8,`0`)},CQ={identify:vQ,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>yQ(e,0,10,n),stringify:GZ},wQ={identify:vQ,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>yQ(e,2,16,n),stringify:e=>bQ(e,16,`0x`)},TQ=class e extends LZ{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=yX(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new jZ(e.key,null):new jZ(e,null),IZ(this.items,t.key)||this.items.push(t)}get(e,t){let n=IZ(this.items,e);return!t&&yX(n)?bX(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=IZ(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new jZ(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(eZ(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(eZ(a(t),``)))}return n.join(`
`+y2(l(e),c),s&&s()):d&&o&&o(),p}function fde({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(Q0(i))i.spaceBefore&&d.push(``),W2(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(J0(i)){let e=Q0(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),W2(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=Q0(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=N2(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+=b2(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 W2({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=y2(t(r),e);n.push(i.trimStart())}}function G2(e,t){let n=Y0(t)?t.value:t;for(let r of e)if(J0(r)&&(r.key===t||r.key===n||Y0(r.key)&&r.key.value===n))return r}var K2=class extends v2{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(B0,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(V2(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=J0(e)?e:!e||typeof e!=`object`||!(`key`in e)?new H2(e,e?.value):new H2(e.key,e.value);let r=G2(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);Y0(r.value)&&p2(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=G2(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=G2(this.items,e)?.value;return(!t&&Y0(n)?n.value:n)??void 0}has(e){return!!G2(this.items,e)}set(e,t){this.add(new H2(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)B2(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!J0(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})),U2(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},q2={collection:`map`,default:!0,nodeClass:K2,tag:`tag:yaml.org,2002:map`,resolve(e,t){return q0(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>K2.from(e,t,n)},J2=class extends v2{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(U0,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=Y2(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=Y2(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&Y0(r)?r.value:r}has(e){let t=Y2(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=Y2(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];Y0(r)&&p2(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(l2(e,String(r++),t));return n}toString(e,t,n){return e?U2(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(h2(a,void 0,n))}}return i}};function Y2(e){let t=Y0(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var X2={collection:`seq`,default:!0,nodeClass:J2,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return X0(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>J2.from(e,t,n)},Z2={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),j2(e,t,n,r)}},Q2={identify:e=>e==null,createNode:()=>new m2(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new m2(null),stringify:({source:e},t)=>typeof e==`string`&&Q2.test.test(e)?e:t.options.nullStr},$2={identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new m2(e[0]===`t`||e[0]===`T`),stringify({source:e,value:t},n){return e&&$2.test.test(e)&&t===(e[0]===`t`||e[0]===`T`)?e:t?n.options.trueStr:n.options.falseStr}};function e4({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 t4={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:e4},n4={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 j2({comment:e,type:t,value:s},r,i,a)}};function p4(e,t){if(X0(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!J0(r)){if(q0(r)){r.items.length>1&&t(`Each pair must have its own sequence indicator`);let e=r.items[0]||new H2(new m2(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]=J0(r)?r:new H2(r)}}else t(`Expected a sequence for this tag`);return e}function m4(e,t,n){let{replacer:r}=n,i=new J2(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(V2(o,s,n))}return i}var h4={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:p4,createNode:m4},g4=class e extends J2{constructor(){super(),this.add=K2.prototype.add.bind(this),this.delete=K2.prototype.delete.bind(this),this.get=K2.prototype.get.bind(this),this.has=K2.prototype.has.bind(this),this.set=K2.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(J0(e)?(r=l2(e.key,``,t),i=l2(e.value,r,t)):r=l2(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=m4(e,t,n),i=new this;return i.items=r.items,i}};g4.tag=`tag:yaml.org,2002:omap`;var _4={collection:`seq`,identify:e=>e instanceof Map,nodeClass:g4,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,t){let n=p4(e,t),r=[];for(let{key:e}of n.items)Y0(e)&&(r.includes(e.value)?t(`Ordered maps must not include duplicate keys: ${e.value}`):r.push(e.value));return Object.assign(new g4,n)},createNode:(e,t,n)=>g4.from(e,t,n)};function v4({value:e,source:t},n){return t&&(e?y4:b4).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var y4={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 m2(!0),stringify:v4},b4={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 m2(!1),stringify:v4},gde={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:e4},_de={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():e4(e)}},vde={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 m2(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:e4},x4=e=>typeof e==`bigint`||Number.isInteger(e);function S4(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 C4(e,t,n){let{value:r}=e;if(x4(r)){let e=r.toString(t);return r<0?`-`+n+e.substr(1):n+e}return e4(e)}var yde={identify:x4,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>S4(e,2,2,n),stringify:e=>C4(e,2,`0b`)},bde={identify:x4,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>S4(e,1,8,n),stringify:e=>C4(e,8,`0`)},xde={identify:x4,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>S4(e,0,10,n),stringify:e4},Sde={identify:x4,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>S4(e,2,16,n),stringify:e=>C4(e,16,`0x`)},w4=class e extends K2{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=J0(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new H2(e.key,null):new H2(e,null),G2(this.items,t.key)||this.items.push(t)}get(e,t){let n=G2(this.items,e);return!t&&J0(n)?Y0(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=G2(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new H2(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))r Line truncated
`)?(n.push(`...`),n.push(y2(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(y2(a(t),``)))}return n.join(`
`)+`
`}var BQ=class e{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,hX,{value:uX});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 FX({version:a}),this.setSchema(a,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){let t=Object.create(e.prototype,{[hX]:{value:uX}});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=CX(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(e){VQ(this.contents)&&this.contents.add(e)}addIn(e,t){VQ(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=LX(this);e.anchor=!t||n.has(t)?RX(t||`a`,n):t}return new UX(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}=zX(this,a||`a`),p={aliasDuplicateObjects:i??!0,keepUndefined:s??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:f},m=YX(e,l,p);return o&&SX(m)&&(m.flow=!0),d(),m}createPair(e,t,n={}){return new jZ(this.createNode(e,null,n),this.createNode(t,null,n))}delete(e){return VQ(this.contents)?this.contents.delete(e):!1}deleteIn(e){return ZX(e)?this.contents!=null&&(this.contents=null,!0):VQ(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return SX(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return ZX(e)?!t&&bX(this.contents)?this.contents.value:this.contents:SX(this.contents)?this.contents.getIn(e,t):void 0}has(e){return SX(this.contents)?this.contents.has(e):!1}hasIn(e){return ZX(e)?this.contents!==void 0:SX(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=XX(this.schema,[e],t):VQ(this.contents)&&this.contents.set(e,t)}setIn(e,t){ZX(e)?this.contents=t:this.contents==null?this.contents=XX(this.schema,Array.from(e),t):VQ(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 FX({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 FX({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 RQ(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=VX(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`?BX(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 zQ(this,e)}};function VQ(e){if(SX(e))return!0;throw Error(`Expected a YAML collection as document contents`)}var HQ=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},UQ=class extends HQ{constructor(e,t,n){super(`YAMLParseError`,e,t,n)}},WQ=class extends HQ{constructor(e,t,n){super(`YAMLWarning`,e,t,n)}},GQ=(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 KQ(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 qQ(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(qQ(t.key)||qQ(t.value))return!0}return!1;default:return!0}}function JQ(e,t,n){if(t?.type===`flow-collection`){let r=t.end[0];r.indent===e&&(r.source===`]`||r.source===`}`)&&qQ(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||bX(e)&&bX(t)&&e.value===t.value;return t.some(e=>i(e.key,n))}var XQ=`All mapping items must start at the same column`;function ZQ({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??LZ)(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=KQ(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`,XQ)),!p.anchor&&!p.tag&&!d){c=p.end,p.comment&&(o.comment?o.comment+=`
`+p.comment:o.comment=p.comment);continue}(p.newlineAfterProp||qQ(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`,XQ);n.atKey=!0;let h=p.end,g=u?e(n,u,p,i):t(n,h,l,null,p,i);n.schema.compat&&JQ(r.indent,u,i),n.atKey=!1,YQ(n,o.items,g)&&i(h,`DUPLICATE_KEY`,`Map keys must be unique`);let _=KQ(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&&JQ(r.indent,f,i),s=c.range[2];let l=new jZ(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 jZ(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 QQ({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??zZ)(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=KQ(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&&JQ(r.indent,l,i),s=d.range[2],o.items.push(d)}return o.range=[r.offset,s,c??s],o}function $Q(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 e$=`Block collections are not allowed within flow collections`,t$=e=>e&&(e.type===`block-map`||e.type===`block-seq`);function n$({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=r.start.source===`{`,s=o?`flow map`:`flow sequence`,c=new((a?.nodeClass)??(o?LZ:zZ))(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=KQ(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&&qQ(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];yX(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],t$(m)&&i(r.range,`BLOCK_IN_FLOW`,e$)}else{n.atKey=!0;let a=h.end,g=f?e(n,f,h,i):t(n,a,d,null,h,i);t$(f)&&i(g.range,`BLOCK_IN_FLOW`,e$),n.atKey=!1;let _=KQ(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?t$(m)&&i(v.range,`BLOCK_IN_FLOW`,e$):_.comment&&(g.comment?g.comment+=`
`+_.comment:g.comment=_.comment);let y=new jZ(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 LZ(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=$Q(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 r$(e,t,n,r,i,a){let o=n.type===`block-map`?ZQ(e,t,n,r,a):n.type===`block-seq`?QQ(e,t,n,r,a):n$(e,t,n,r,a),s=o.constructor;return i===`!`||i===s.tagName?(o.tag=s.tagName,o):(i&&(o.tag=i),o)}function i$(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===LZ.tagName&&s===`map`||o===zZ.tagName&&s===`seq`)return r$(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),r$(e,t,n,i,o)}let l=r$(e,t,n,i,o,c),u=c.resolve?.(l,e=>i(a,`TAG_RESOLVE_FAILED`,e),t.options)??l,d=CX(u)?u:new KX(u);return d.range=l.range,d.tag=o,c?.format&&(d.format=c.format),d}function a$(e,t,n){let r=t.offset,i=o$(t,e.options.strict,n);if(!i)return{value:``,type:null,comment:``,range:[r,r,r]};let a=i.mode===`>`?KX.BLOCK_FOLDED:KX.BLOCK_LITERAL,o=t.source?s$(t.source):[],s=o.length;for(let e=o.length-1;e>=0;--e){let t=o[e][1];if(t===``||t===`\r`)s=e;else break}if(s===0){let e=i.chomp===`+`&&o.length>0?`
`}var F4=class e{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,W0,{value:z0});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 i2({version:a}),this.setSchema(a,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){let t=Object.create(e.prototype,{[W0]:{value:z0}});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=Q0(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(e){I4(this.contents)&&this.contents.add(e)}addIn(e,t){I4(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=o2(this);e.anchor=!t||n.has(t)?s2(t||`a`,n):t}return new d2(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}=Que(this,a||`a`),p={aliasDuplicateObjects:i??!0,keepUndefined:s??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:f},m=h2(e,l,p);return o&&Z0(m)&&(m.flow=!0),d(),m}createPair(e,t,n={}){return new H2(this.createNode(e,null,n),this.createNode(t,null,n))}delete(e){return I4(this.contents)?this.contents.delete(e):!1}deleteIn(e){return _2(e)?this.contents!=null&&(this.contents=null,!0):I4(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return Z0(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return _2(e)?!t&&Y0(this.contents)?this.contents.value:this.contents:Z0(this.contents)?this.contents.getIn(e,t):void 0}has(e){return Z0(this.contents)?this.contents.has(e):!1}hasIn(e){return _2(e)?this.contents!==void 0:Z0(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=g2(this.schema,[e],t):I4(this.contents)&&this.contents.set(e,t)}setIn(e,t){_2(e)?this.contents=t:this.contents==null?this.contents=g2(this.schema,Array.from(e),t):I4(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 i2({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 i2({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 Tde(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=l2(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`?c2(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 Ede(this,e)}};function I4(e){if(Z0(e))return!0;throw Error(`Expected a YAML collection as document contents`)}var L4=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},R4=class extends L4{constructor(e,t,n){super(`YAMLParseError`,e,t,n)}},Dde=class extends L4{constructor(e,t,n){super(`YAMLWarning`,e,t,n)}},z4=(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 B4(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 V4(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(V4(t.key)||V4(t.value))return!0}return!1;default:return!0}}function H4(e,t,n){if(t?.type===`flow-collection`){let r=t.end[0];r.indent===e&&(r.source===`]`||r.source===`}`)&&V4(t)&&n(r,`BAD_INDENT`,`Flow end indicator should be more indented than parent`,!0)}}function U4(e,t,n){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let i=typeof r==`function`?r:(e,t)=>e===t||Y0(e)&&Y0(t)&&e.value===t.value;return t.some(e=>i(e.key,n))}var W4=`All mapping items must start at the same column`;function Ode({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??K2)(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=B4(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`,W4)),!p.anchor&&!p.tag&&!d){c=p.end,p.comment&&(o.comment?o.comment+=`
`+p.comment:o.comment=p.comment);continue}(p.newlineAfterProp||V4(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`,W4);n.atKey=!0;let h=p.end,g=u?e(n,u,p,i):t(n,h,l,null,p,i);n.schema.compat&&H4(r.indent,u,i),n.atKey=!1,U4(n,o.items,g)&&i(h,`DUPLICATE_KEY`,`Map keys must be unique`);let _=B4(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&&H4(r.indent,f,i),s=c.range[2];let l=new H2(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 H2(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 kde({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??J2)(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=B4(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&&H4(r.indent,l,i),s=d.range[2],o.items.push(d)}return o.range=[r.offset,s,c??s],o}function G4(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 K4=`Block collections are not allowed within flow collections`,q4=e=>e&&(e.type===`block-map`||e.type===`block-seq`);function Ade({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=r.start.source===`{`,s=o?`flow map`:`flow sequence`,c=new((a?.nodeClass)??(o?K2:J2))(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=B4(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&&V4(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];J0(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],q4(m)&&i(r.range,`BLOCK_IN_FLOW`,K4)}else{n.atKey=!0;let a=h.end,g=f?e(n,f,h,i):t(n,a,d,null,h,i);q4(f)&&i(g.range,`BLOCK_IN_FLOW`,K4),n.atKey=!1;let _=B4(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?q4(m)&&i(v.range,`BLOCK_IN_FLOW`,K4):_.comment&&(g.comment?g.comment+=`
`+_.comment:g.comment=_.comment);let y=new H2(g,v);if(n.options.keepSourceTokens&&(y.srcToken=l),o){let e=c;U4(n,e.items,g)&&i(a,`DUPLICATE_KEY`,`Map keys must be unique`),e.items.push(y)}else{let e=new K2(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=G4(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 J4(e,t,n,r,i,a){let o=n.type===`block-map`?Ode(e,t,n,r,a):n.type===`block-seq`?kde(e,t,n,r,a):Ade(e,t,n,r,a),s=o.constructor;return i===`!`||i===s.tagName?(o.tag=s.tagName,o):(i&&(o.tag=i),o)}function jde(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===K2.tagName&&s===`map`||o===J2.tagName&&s===`seq`)return J4(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),J4(e,t,n,i,o)}let l=J4(e,t,n,i,o,c),u=c.resolve?.(l,e=>i(a,`TAG_RESOLVE_FAILED`,e),t.options)??l,d=Q0(u)?u:new m2(u);return d.range=l.range,d.tag=o,c?.format&&(d.format=c.format),d}function Mde(e,t,n){let r=t.offset,i=Nde(t,e.options.strict,n);if(!i)return{value:``,type:null,comment:``,range:[r,r,r]};let a=i.mode===`>`?m2.BLOCK_FOLDED:m2.BLOCK_LITERAL,o=t.source?Pde(t.source):[],s=o.length;for(let e=o.length-1;e>=0;--e){let t=o[e][1];if(t===``||t===`\r`)s=e;else break}if(s===0){let e=i.chomp===`+`&&o.length>0?`
`.repeat(Math.max(1,o.length-1)):``,n=r+i.length;return t.source&&(n+=t.source.length),{value:e,type:a,comment:i.comment,range:[r,n,n]}}let c=t.indent+i.indent,l=t.offset+i.length,u=0;for(let t=0;t<s;++t){let[r,a]=o[t];if(a===``||a===`\r`)i.indent===0&&r.length>c&&(c=r.length);else{r.length<c&&n(l+r.length,`MISSING_CHAR`,`Block scalars with more-indented leading empty lines must use an explicit indentation indicator`),i.indent===0&&(c=r.length),u=t,c===0&&!e.atRoot&&n(l,`BAD_INDENT`,`Block scalar values in collections must be indented`);break}l+=r.length+a.length+1}for(let e=o.length-1;e>=s;--e)o[e][0].length>c&&(s=e+1);let d=``,f=``,p=!1;for(let e=0;e<u;++e)d+=o[e][0].slice(c)+`
`;for(let e=u;e<s;++e){let[t,r]=o[e];l+=t.length+r.length+1;let s=r[r.length-1]===`\r`;if(s&&(r=r.slice(0,-1)),r&&t.length<c){let e=`Block scalar lines must not be less indented than their ${i.indent?`explicit indentation indicator`:`first line`}`;n(l-r.length-(s?2:1),`BAD_INDENT`,e),t=``}a===KX.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===m2.BLOCK_LITERAL?(d+=f+t.slice(c)+r,f=`
`):t.length>c||r[0]===` `?(f===` `?f=`
`:!p&&f===`
`&&(f=`
@@ -247,59 +505,59 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
`+o[e][0].slice(c);d[d.length-1]!==`
`&&(d+=`
`);break;default:d+=`
`}let m=r+i.length+t.source.length;return{value:d,type:a,comment:i.comment,range:[r,m,m]}}function o$({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 s$(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 c$(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=KX.PLAIN,c=l$(a,l);break;case`single-quoted-scalar`:s=KX.QUOTE_SINGLE,c=u$(a,l);break;case`double-quoted-scalar`:s=KX.QUOTE_DOUBLE,c=f$(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=$Q(o,u,t,n);return{value:c,type:s,comment:d.comment,range:[r,u,d.offset]}}function l$(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}`),d$(e)}function u$(e,t){return(e[e.length-1]!==`'`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing 'quote`),d$(e.slice(1,-1)).replace(/''/g,`'`)}function d$(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 Nde({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 Pde(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 Fde(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=m2.PLAIN,c=Ide(a,l);break;case`single-quoted-scalar`:s=m2.QUOTE_SINGLE,c=Lde(a,l);break;case`double-quoted-scalar`:s=m2.QUOTE_DOUBLE,c=Rde(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=G4(o,u,t,n);return{value:c,type:s,comment:d.comment,range:[r,u,d.offset]}}function Ide(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}`),Y4(e)}function Lde(e,t){return(e[e.length-1]!==`'`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing 'quote`),Y4(e.slice(1,-1)).replace(/''/g,`'`)}function Y4(e){let t=/(.*?)\r?\n/sy,n=t.exec(e);if(!n)return e;let r,i;try{r=RegExp(`(?<![ ])[ ]+$`),i=RegExp(`^[ ]+|(?<![ ])[ ]+$`,`g`)}catch{r=/[ \t]+$/,i=/^[ \t]+|[ \t]+$/g}let a=n[1].replace(r,``),o=` `,s=t.lastIndex;for(;n=t.exec(e);){let e=n[1].replace(i,``);e===``?o===`
`?a+=o:o=`
`:(a+=o+e,o=` `),s=t.lastIndex}let c=/[ \t]*(.*)/sy;return c.lastIndex=s,n=c.exec(e),a+o+(n?.[1]??``)}function f$(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 Rde(e,t){let n=``;for(let r=1;r<e.length-1;++r){let i=e[r];if(i!==`\r`||e[r+1]!==`
`){if(i===`
`){let{fold:t,offset:i}=p$(e,r);n+=t,r=i}else if(i===`\\`){let i=e[++r],a=m$[i];if(a)n+=a;else if(i===`
`){let{fold:t,offset:i}=zde(e,r);n+=t,r=i}else if(i===`\\`){let i=e[++r],a=Bde[i];if(a)n+=a;else if(i===`
`)for(i=e[r+1];i===` `||i===` `;)i=e[++r+1];else if(i===`\r`&&e[r+1]===`
`)for(i=e[++r+1];i===` `||i===` `;)i=e[++r+1];else if(i===`x`||i===`u`||i===`U`){let a=i===`x`?2:i===`u`?4:8;n+=h$(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+=Vde(e,r+1,a,t),r+=a}else{let i=e.substr(r-1,2);t(r-1,`BAD_DQ_ESCAPE`,`Invalid escape sequence ${i}`),n+=i}}else if(i===` `||i===` `){let t=r,a=e[r+1];for(;a===` `||a===` `;)a=e[++r+1];a!==`
`&&(a!==`\r`||e[r+2]!==`
`)&&(n+=r>t?e.slice(t,r+1):i)}else n+=i}}return(e[e.length-1]!==`"`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing "quote`),n}function p$(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 zde(e,t){let n=``,r=e[t+1];for(;(r===` `||r===` `||r===`
`||r===`\r`)&&(r!==`\r`||e[t+2]===`
`);)r===`
`&&(n+=`
`),t+=1,r=e[t+1];return n||=` `,{fold:n,offset:t}}var m$={0:`\0`,a:`\x07`,b:`\b`,e:`\x1B`,f:`\f`,n:`
`,r:`\r`,t:` `,v:`\v`,N:`…`,_:`\xA0`,L:`\u2028`,P:`\u2029`," ":` `,'"':`"`,"/":`/`,"\\":`\\`," ":` `};function h$(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 g$(e,t,n,r){let{value:i,type:a,comment:o,range:s}=t.type===`block-scalar`?a$(e,t,r):c$(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[pX]:c?_$(e.schema,i,c,n,r):t.type===`scalar`?v$(e,i,t,r):e.schema[pX];let u;try{let a=l.resolve(i,e=>r(n??t,`TAG_RESOLVE_FAILED`,e),e.options);u=bX(a)?a:new KX(a)}catch(e){let a=e instanceof Error?e.message:String(e);r(n??t,`TAG_RESOLVE_FAILED`,a),u=new KX(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 _$(e,t,n,r,i){if(n===`!`)return e[pX];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[pX])}function v$({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[pX];if(n.compat){let e=n.compat.find(e=>e.default&&e.test?.test(r))??n[pX];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 y$(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 b$={composeNode:x$,composeEmptyNode:S$};function x$(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=C$(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=g$(e,t,c,r),s&&(l.anchor=s.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:try{l=i$(b$,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??=S$(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&&(!bX(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 S$(e,t,n,r,{spaceBefore:i,comment:a,anchor:o,tag:s,end:c},l){let u=g$(e,{type:`scalar`,offset:y$(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 C$({options:e},{offset:t,source:n,end:r},i){let a=new UX(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=$Q(r,o,e.strict,i);return a.range=[t,o,s.offset],s.comment&&(a.comment=s.comment),a}function w$(e,t,{offset:n,start:r,value:i,end:a},o){let s=new BQ(void 0,Object.assign({_directives:t},e)),c={atKey:!1,atRoot:!0,directives:s.directives,options:s.options,schema:s.schema},l=KQ(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?x$(c,i,l,o):S$(c,l.end,r,null,l,o);let u=s.contents.range[2],d=$Q(a,u,!1,o);return d.comment&&(s.comment=d.comment),s.range=[n,u,d.offset],s}function T$(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 E$(e){let t=``,n=!1,r=!1;for(let i=0;i<e.length;++i){let a=e[i];switch(a[0]){case`#`:t+=(t===``?``:r?`
`),t+=1,r=e[t+1];return n||=` `,{fold:n,offset:t}}var Bde={0:`\0`,a:`\x07`,b:`\b`,e:`\x1B`,f:`\f`,n:`
`,r:`\r`,t:` `,v:`\v`,N:`…`,_:`\xA0`,L:`\u2028`,P:`\u2029`," ":` `,'"':`"`,"/":`/`,"\\":`\\`," ":` `};function Vde(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 X4(e,t,n,r){let{value:i,type:a,comment:o,range:s}=t.type===`block-scalar`?Mde(e,t,r):Fde(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[H0]:c?Hde(e.schema,i,c,n,r):t.type===`scalar`?Ude(e,i,t,r):e.schema[H0];let u;try{let a=l.resolve(i,e=>r(n??t,`TAG_RESOLVE_FAILED`,e),e.options);u=Y0(a)?a:new m2(a)}catch(e){let a=e instanceof Error?e.message:String(e);r(n??t,`TAG_RESOLVE_FAILED`,a),u=new m2(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 Hde(e,t,n,r,i){if(n===`!`)return e[H0];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[H0])}function Ude({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[H0];if(n.compat){let e=n.compat.find(e=>e.default&&e.test?.test(r))??n[H0];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 Wde(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 Gde={composeNode:Z4,composeEmptyNode:Q4};function Z4(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=Kde(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=X4(e,t,c,r),s&&(l.anchor=s.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:try{l=jde(Gde,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??=Q4(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&&(!Y0(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 Q4(e,t,n,r,{spaceBefore:i,comment:a,anchor:o,tag:s,end:c},l){let u=X4(e,{type:`scalar`,offset:Wde(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 Kde({options:e},{offset:t,source:n,end:r},i){let a=new d2(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=G4(r,o,e.strict,i);return a.range=[t,o,s.offset],s.comment&&(a.comment=s.comment),a}function qde(e,t,{offset:n,start:r,value:i,end:a},o){let s=new F4(void 0,Object.assign({_directives:t},e)),c={atKey:!1,atRoot:!0,directives:s.directives,options:s.options,schema:s.schema},l=B4(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?Z4(c,i,l,o):Q4(c,l.end,r,null,l,o);let u=s.contents.range[2],d=G4(a,u,!1,o);return d.comment&&(s.comment=d.comment),s.range=[n,u,d.offset],s}function $4(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 e3(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 D$=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,n,r)=>{let i=T$(e);r?this.warnings.push(new WQ(i,t,n)):this.errors.push(new UQ(i,t,n))},this.directives=new FX({version:e.version||`1.2`}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=E$(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(SX(i)&&!i.flow&&i.items.length>0){let e=i.items[0];yX(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:E$(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=T$(e);i[0]+=t,this.onError(i,`BAD_DIRECTIVE`,n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case`document`:{let t=w$(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 UQ(T$(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 UQ(T$(e),`UNEXPECTED_TOKEN`,`Unexpected doc-end without preceding document`));break}this.doc.directives.docEnd=!0;let t=$Q(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 UQ(T$(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 BQ(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}}},O$=Symbol(`break visit`),k$=Symbol(`skip children`),A$=Symbol(`remove item`);function j$(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),M$(Object.freeze([]),e,t)}j$.BREAK=O$,j$.SKIP=k$,j$.REMOVE=A$,j$.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},j$.parentCollection=(e,t)=>{let n=j$.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 M$(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=M$(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===O$)return O$;else r===A$&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}function N$(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 Jde=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,n,r)=>{let i=$4(e);r?this.warnings.push(new Dde(i,t,n)):this.errors.push(new R4(i,t,n))},this.directives=new i2({version:e.version||`1.2`}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=e3(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(Z0(i)&&!i.flow&&i.items.length>0){let e=i.items[0];J0(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:e3(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=$4(e);i[0]+=t,this.onError(i,`BAD_DIRECTIVE`,n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case`document`:{let t=qde(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 R4($4(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 R4($4(e),`UNEXPECTED_TOKEN`,`Unexpected doc-end without preceding document`));break}this.doc.directives.docEnd=!0;let t=G4(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 R4($4(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 F4(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}}},t3=Symbol(`break visit`),Yde=Symbol(`skip children`),n3=Symbol(`remove item`);function r3(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),i3(Object.freeze([]),e,t)}r3.BREAK=t3,r3.SKIP=Yde,r3.REMOVE=n3,r3.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},r3.parentCollection=(e,t)=>{let n=r3.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 i3(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=i3(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===t3)return t3;else r===n3&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}function Xde(e){switch(e){case``:return`byte-order-mark`;case``:return`doc-mode`;case``:return`flow-error-end`;case``:return`scalar`;case`---`:return`doc-start`;case`...`:return`doc-end`;case``:case`
`:case`\r
`:return`newline`;case`-`:return`seq-item-ind`;case`?`:return`explicit-key-ind`;case`:`:return`map-value-ind`;case`{`:return`flow-map-start`;case`}`:return`flow-map-end`;case`[`:return`flow-seq-start`;case`]`:return`flow-seq-end`;case`,`:return`comma`}switch(e[0]){case` `:case` `:return`space`;case`#`:return`comment`;case`%`:return`directive-line`;case`*`:return`alias`;case`&`:return`anchor`;case`!`:return`tag`;case`'`:return`single-quoted-scalar`;case`"`:return`double-quoted-scalar`;case`|`:case`>`:return`block-scalar-header`}return null}function P$(e){switch(e){case void 0:case` `:case`
`:case`\r`:case` `:return!0;default:return!1}}var F$=new Set(`0123456789ABCDEFabcdef`),I$=new Set(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()`),L$=new Set(`,[]{}`),R$=new Set(` ,[]{}
\r `),z$=e=>!e||R$.has(e),B$=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer=``,this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){if(e){if(typeof e!=`string`)throw TypeError(`source is not a string`);this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let n=this.next??`stream`;for(;n&&(t||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===` `||t===` `;)t=this.buffer[++e];return!t||t===`#`||t===`
`:return`newline`;case`-`:return`seq-item-ind`;case`?`:return`explicit-key-ind`;case`:`:return`map-value-ind`;case`{`:return`flow-map-start`;case`}`:return`flow-map-end`;case`[`:return`flow-seq-start`;case`]`:return`flow-seq-end`;case`,`:return`comma`}switch(e[0]){case` `:case` `:return`space`;case`#`:return`comment`;case`%`:return`directive-line`;case`*`:return`alias`;case`&`:return`anchor`;case`!`:return`tag`;case`'`:return`single-quoted-scalar`;case`"`:return`double-quoted-scalar`;case`|`:case`>`:return`block-scalar-header`}return null}function a3(e){switch(e){case void 0:case` `:case`
`:case`\r`:case` `:return!0;default:return!1}}var o3=new Set(`0123456789ABCDEFabcdef`),Zde=new Set(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()`),s3=new Set(`,[]{}`),Qde=new Set(` ,[]{}
\r `),c3=e=>!e||Qde.has(e),$de=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer=``,this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){if(e){if(typeof e!=`string`)throw TypeError(`source is not a string`);this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let n=this.next??`stream`;for(;n&&(t||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===` `||t===` `;)t=this.buffer[++e];return!t||t===`#`||t===`
`||t===`\r`&&this.buffer[e+1]===`
`}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let n=0;for(;t===` `;)t=this.buffer[++n+e];if(t===`\r`){let t=this.buffer[n+e+1];if(t===`
`||!t&&!this.atEnd)return e+n+1}return t===`
`||n>=this.indentNext||!t&&!this.atEnd?e+n:-1}if(t===`-`||t===`.`){let t=this.buffer.substr(e,3);if((t===`---`||t===`...`)&&P$(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===`...`)&&P$(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&&!P$(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===`:`)&&P$(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(z$),`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(`...`))&&P$(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(z$),`flow`;case`"`:case`'`:return this.flowKey=!0,yield*this.parseQuotedScalar();case`:`:{let e=this.charAt(1);if(this.flowKey||P$(e)||e===`,`)return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),`flow`}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),t=this.buffer.indexOf(e,this.pos+1);if(e===`'`)for(;t!==-1&&this.buffer[t+1]===`'`;)t=this.buffer.indexOf(`'`,t+2);else for(;t!==-1;){let e=0;for(;this.buffer[t-1-e]===`\\`;)e+=1;if(e%2==0)break;t=this.buffer.indexOf(`"`,t+1)}let n=this.buffer.substring(0,t),r=n.indexOf(`
`||n>=this.indentNext||!t&&!this.atEnd?e+n:-1}if(t===`-`||t===`.`){let t=this.buffer.substr(e,3);if((t===`---`||t===`...`)&&a3(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===`...`)&&a3(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&&!a3(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===`:`)&&a3(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(c3),`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(`...`))&&a3(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(c3),`flow`;case`"`:case`'`:return this.flowKey=!0,yield*this.parseQuotedScalar();case`:`:{let e=this.charAt(1);if(this.flowKey||a3(e)||e===`,`)return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),`flow`}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),t=this.buffer.indexOf(e,this.pos+1);if(e===`'`)for(;t!==-1&&this.buffer[t+1]===`'`;)t=this.buffer.indexOf(`'`,t+2);else for(;t!==-1;){let e=0;for(;this.buffer[t-1-e]===`\\`;)e+=1;if(e%2==0)break;t=this.buffer.indexOf(`"`,t+1)}let n=this.buffer.substring(0,t),r=n.indexOf(`
`,this.pos);if(r!==-1){for(;r!==-1;){let e=this.continueScalar(r+1);if(e===-1)break;r=n.indexOf(`
`,e)}r!==-1&&(t=r-(n[r-1]===`\r`?2:1))}if(t===-1){if(!this.atEnd)return this.setNext(`quoted-scalar`);t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?`flow`:`doc`}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let t=this.buffer[++e];if(t===`+`)this.blockScalarKeep=!0;else if(t>`0`&&t<=`9`)this.blockScalarIndent=Number(t)-1;else if(t!==`-`)break}return yield*this.pushUntil(e=>P$(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=>a3(e)||e===`#`)}*parseBlockScalar(){let e=this.pos-1,t=0,n;loop:for(let r=this.pos;n=this.buffer[r];++r)switch(n){case` `:t+=1;break;case`
`:e=r,t=0;break;case`\r`:{let e=this.buffer[r+1];if(!e&&!this.atEnd)return this.setNext(`block-scalar`);if(e===`
`)break}default:break loop}if(!n&&!this.atEnd)return this.setNext(`block-scalar`);if(t>=this.indentNext){this.indentNext=this.blockScalarIndent===-1?t:this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let t=this.continueScalar(e+1);if(t===-1)break;e=this.buffer.indexOf(`
`,t)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext(`block-scalar`);e=this.buffer.length}}let r=e+1;for(n=this.buffer[r];n===` `;)n=this.buffer[++r];if(n===` `){for(;n===` `||n===` `||n===`\r`||n===`
`;)n=this.buffer[++r];e=r-1}else if(!this.blockScalarKeep)do{let n=e-1,r=this.buffer[n];r===`\r`&&(r=this.buffer[--n]);let i=n;for(;r===` `;)r=this.buffer[--n];if(r===`
`&&n>=this.pos&&n+1+t>i)e=n;else break}while(1);return yield``,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,n=this.pos-1,r;for(;r=this.buffer[++n];)if(r===`:`){let r=this.buffer[n+1];if(P$(r)||e&&L$.has(r))break;t=n}else if(P$(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(a3(r)||e&&s3.has(r))break;t=n}else if(a3(r)){let i=this.buffer[n+1];if(r===`\r`&&(i===`
`?(n+=1,r=`
`,i=this.buffer[n+1]):t=n),i===`#`||e&&L$.has(i))break;if(r===`
`){let e=this.continueScalar(n+1);if(e===-1)break;n=Math.max(n,e-2)}}else{if(e&&L$.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(z$),e+=yield*this.pushSpaces(!0);continue loop;case`-`:case`?`:case`:`:{let t=this.flowLevel>0,n=this.charAt(1);if(P$(n)||t&&L$.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(;!P$(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(I$.has(t))t=this.buffer[++e];else if(t===`%`&&F$.has(this.buffer[e+1])&&F$.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
`,i=this.buffer[n+1]):t=n),i===`#`||e&&s3.has(i))break;if(r===`
`){let e=this.continueScalar(n+1);if(e===-1)break;n=Math.max(n,e-2)}}else{if(e&&s3.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(c3),e+=yield*this.pushSpaces(!0);continue loop;case`-`:case`?`:case`:`:{let t=this.flowLevel>0,n=this.charAt(1);if(a3(n)||t&&s3.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(;!a3(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(Zde.has(t))t=this.buffer[++e];else if(t===`%`&&o3.has(this.buffer[e+1])&&o3.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
`?yield*this.pushCount(1):e===`\r`&&this.charAt(1)===`
`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,n;do n=this.buffer[++t];while(n===` `||e&&n===` `);let r=t-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=t),r}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}},V$=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 H$(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function U$(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 W$(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 G$(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 K$(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 q$(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&&!H$(t.start,`explicit-key-ind`)&&!H$(t.sep,`map-value-ind`)&&(t.key&&(t.value=t.key),delete t.key,W$(t.value)?t.value.end?q$(t.value.end,t.sep):t.value.end=t.sep:q$(t.start,t.sep),delete t.sep)}var Y$=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 B$,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=N$(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&&U$(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)}},efe=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 l3(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function u3(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 d3(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 f3(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 p3(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 m3(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 h3(e){if(e.start.type===`flow-seq-start`)for(let t of e.items)t.sep&&!t.value&&!l3(t.start,`explicit-key-ind`)&&!l3(t.sep,`map-value-ind`)&&(t.key&&(t.value=t.key),delete t.key,d3(t.value)?t.value.end?m3(t.value.end,t.sep):t.value.end=t.sep:m3(t.start,t.sep),delete t.sep)}var tfe=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 $de,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=Xde(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`&&h3(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&&u3(n.start)===-1&&(t.indent===0||n.start.every(e=>e.type!==`comment`|| Line truncated
`)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
`,e)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(this.onKeyLine=!1,t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){q$(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(H$(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=K$(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(H$(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(W$(t.key)&&!H$(t.sep,`newline`)){let e=K$(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]}):H$(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&&!H$(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)){q$(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||H$(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)){m3(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(l3(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=p3(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(l3(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(d3(t.key)&&!l3(t.sep,`newline`)){let e=p3(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]}):l3(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&&!l3(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)){m3(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||l3(t.start,`seq-item-ind`)?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let t=this.startBlockValue(e);if(t){this.stack.push(t);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type===`flow-error-end`){let e;do yield*this.pop(),e=this.peek(1);while(e?.type===`flow-collection`)}else if(e.end.length===0){switch(this.type){case`comma`:case`explicit-key-ind`:!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case`map-value-ind`:!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case`space`:case`comment`:case`newline`:case`anchor`:case`tag`:!t||t.value?e.ite Line truncated
`)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
`,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=K$(G$(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=K$(G$(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 X$(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new V$||null,prettyErrors:t}}function Z$(e,t={}){let{lineCounter:n,prettyErrors:r}=X$(t),i=new Y$(n?.addNewLine),a=new D$(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 UQ(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(GQ(e,n)),o.warnings.forEach(GQ(e,n))),o}function Q$(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let i=Z$(e,n);if(!i)return null;if(i.warnings.forEach(e=>SZ(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 $$(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 _X(e)&&!r?e.toString(n):new BQ(e,r,n).toString(n)}var e1=e=>typeof e==`object`&&!!e&&!Array.isArray(e),t1=e=>e1(e)?Object.entries(e).map(([e,t])=>[e,Array.isArray(t)?t:[]]):[];function n1(e){if(e1(e)){if(e1(e.parallel))return{kind:`parallel`,base:[`parallel`],branches:t1(e.parallel)};if(e1(e.switch))return{kind:`switch`,base:[`switch`,`cases`],on:typeof e.switch.on==`string`?e.switch.on:``,branches:t1(e.switch.cases)}}}function r1(e){return e.slice(2).includes(`parallel`)}function i1(e,t){let n=Z$(e).getIn(t,!0);if(vX(n))return n.toJSON()}function a1(e,t,n){let r=Z$(e);return r.setIn(t,r.createNode(_1(n))),r.toString()}function o1(e,t,n){let r=Z$(e),i=t.slice(0,-1),a=r1(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(xX(o)||(r.setIn(i,r.createNode([])),o=r.getIn(i,!0)),!xX(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 s1(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 c1(e,t){let n=e.getIn(t,!0),r=n1(vX(n)?n.toJSON():void 0),i=r?e.getIn([...t,...r.base],!0):void 0;if(!r||!vX(i))throw Error(`This step has no branches.`);return{kind:r.kind,branches:i}}function l1(e,t,n){let r=Z$(e),{kind:i,branches:a}=c1(r,t);if(s1(n,i),a.has(n))throw Error(`Branch ${n} already exists.`);return a.set(n,r.createNode([])),r.toString()}function u1(e,t,n,r){let i=Z$(e),{kind:a,branches:o}=c1(i,t);if(s1(r,a),n!==r&&o.has(r))throw Error(`Branch ${r} already exists.`);let s=o.items.find(e=>bX(e.key)&&e.key.value===n);if(!s||!bX(s.key))throw Error(`Branch ${n} does not exist.`);return s.key.value=r,i.toString()}function d1(e,t,n){let r=Z$(e),{kind:i,branches:a}=c1(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 M1(e,t){let n=JSON.stringify(e??{})+` `+(typeof t==`string`?`{{ ${t.replace(/^!/,``)} }}`:``);return[...new Set([...n.matchAll(O1)].map(e=>e[1]))]}function N1(e){let t=Z$(e).toJS(),n=k1(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=k1(e)?e:{},p=n1(d),m=p?.kind??(typeof d.type==`string`?d.type:``),h=k1(d.settings)?d.settings:{},g=typeof d.id==`string`?d.id:``,_=`step-${t}`,v=s?`${s}/${g||m}`:g||m;r.push({id:_,type:`step`,position:{x:n,y:i},data:{kind:`step`,key:g||t,name:g||void 0,title:g||D1(m),type:m,step:l?.length===2?String(Number(l[1])+1).padStart(2,`0`):void 0,detail:p?.on?`on ${p.on.replace(/^steps\./,``)}`:A1(m,h),summary:j1(h),when:typeof d.when==`string`?d.when:void 0,retry:k1(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 M1([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=n1(t);if(n){let{kind:i,base:a,branches:o}=n,c=p(t,String(e+1),0,u*w1,void 0,void 0,[`steps`,e]);m(l,c,[`steps`,e-1]),u++;let d=k1(t)&&typeof t.id==`string`?t.id:i,f=i===`switch`&&!o.some(([e])=>e==="default"),h=o.length+ +!!f,g=[],_=Math.max(1,...o.map(([,e])=>e.length)),v=e=>(e-(h-1)/2)*T1,y=(e,t,n)=>r.push({id:e,type:`lane`,position:{x:t-12,y:u*w1-40},style:{width:`264px`,height:`${(_+1)*w1-24}px`},zIndex:-1,data:{kind:`step`,key:n,title:n,type:``,detail:``,lane:i}}),b=(u+_)*w1;if(o.forEach(([t,n],o)=>{let s=v(o),l=[c],f=[`steps`,e,...a,t];n.forEach((n,r)=>{let a=p(n,`${e+1}-${t}-${r+1}`,s,(u+r)*w1,t,d,[...f,r],i);m(l,a,[...f,r-1]),l=[a]});let h=`add-${e}-${t}`;r.push({id:h,type:`add`,position:{x:s+104,y:b},data:{kind:`step`,key:h,title:``,type:``,detail:``,branch:t,lane:i,insertAfter:[...f,n.length-1]}}),m(l,h),g.push(h),y(`lane-${e}-${t}`,s,t)}),f){let t=v(h-1),n=`pass-${e}`;r.push({id:n,type:`add`,position:{x:t+104,y:b},data:{kind:`step`,key:n,title:``,type:``,detail:``,lane:i}}),s.add(c),m([c],n),s.delete(c),g.push(n),y(`pass-lane-${e}`,t,`default`)}l=g,u+=_+1;continue}let i=p(t,String(e+1),0,u*w1,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*w1-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 P1={class:`truncate`},F1=`\0`,I1=P({inheritAttrs:!1,__name:`OptionSelect`,props:{modelValue:{},options:{},placeholder:{},disabled:{type:Boolean},size:{},class:{}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=t;return(t,r)=>(L(),q(V(Vu),{"model-value":e.modelValue===``&&e.options.some(e=>e.value===``)?F1:e.modelValue||void 0,disabled:e.disabled,"onUpdate:modelValue":r[0]||=e=>n(`update:modelValue`,e===F1?``:String(e))},{default:I(()=>[A(V(Gu),G({size:e.size??`sm`,class:t.$props.class},t.$attrs),{default:I(()=>[A(V(Ku),{placeholder:e.placeholder},null,8,[`placeholder`])]),_:1},16,[`size`,`class`]),A(V(Hu),{position:`popper`,class:`max-w-[min(var(--reka-select-content-available-width),20rem)]`},{default:I(()=>[(L(!0),j(U,null,M(e.options,e=>(L(),q(V(Wu),{key:e.value,value:e.value===``?F1:e.value,disabled:e.disabled,title:e.label,class:`*:[span]:last:min-w-0`},{default:I(()=>[R(`span`,P1,B(e.label),1)]),_:2},1032,[`value`,`disabled`,`title`]))),128))]),_:1})]),_:1},8,[`model-value`,`disabled`]))}}),L1=[`id`],R1=[`value`],z1=P({__name:`WorkflowPicker`,props:{value:{},workflows:{},label:{},class:{},editable:{type:Boolean}},emits:[`pick`],setup(e,{emit:t}){let n=we(),r=t;return(t,i)=>e.editable?(L(),j(U,{key:0},[A(V(Q),{"model-value":e.value,list:V(n),"aria-label":e.label,class:z(t.$props.class),placeholder:`Workflow id or {{ reference }}`,"onUpdate:modelValue":i[0]||=e=>r(`pick`,String(e))},null,8,[`model-value`,`list`,`aria-label`,`class`]),R(`datalist`,{id:V(n)},[(L(!0),j(U,null,M(e.workflows,e=>(L(),j(`option`,{key:e.id,value:e.id},null,8,R1))),128))],8,L1)],64)):(L(),q(V(Vu),{key:1,"model-value":e.value||void 0,"onUpdate:modelValue":i[1]||=e=>r(`pick`,String(e))},{default:I(()=>[A(V(Gu),{"aria-label":e.label,class:z(t.$props.class)},{default:I(()=>[A(V(Ku),{placeholder:`Choose workflow`})]),_:1},8,[`aria-label`,`class`]),A(V(Hu),null,{default:I(()=>[e.value& Line truncated
`).map((e,t)=>({number:t+1,text:e,tokens:$1(e)}))}var Z1=/^(\s*)(-\s+)?/,Q1=/^([^:#\s][^:#]*?)(:)(\s*)(.*)$/;function $1(e){let{code:t,comment:n}=e0(e),r=t0(t);return n&&r.push({text:n,kind:`comment`}),r}function e0(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 t0(e){if(!e)return[];let t=[],n=Z1.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=Q1.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,...n0(i[4]??``)]):[...t,...n0(r)]}function n0(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 r0(e){return e.split(`
`)[0]?.trim()||`invalid YAML`}function i0(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function a0(e){return typeof e==`string`&&e.trim()!==``}var o0={class:`space-y-4 px-3 py-3`},s0={key:0,class:`rounded-md bg-danger/10 px-2.5 py-1.5 text-xs text-danger`,role:`alert`},c0={key:1,class:`space-y-3`},l0={key:0,class:`block space-y-1.5`},u0=[`id`],d0=[`value`],f0={class:`text-xs font-medium text-fg-muted`},p0={class:`flex items-center gap-2`},m0={key:1,role:`alert`,class:`text-xs text-danger`},h0={key:2,class:`space-y-1.5`},g0=[`title`],_0={key:4,class:`flex flex-wrap items-center gap-1 pt-0.5`},v0={key:0,class:`divide-y divide-border rounded-md border border-border`},y0=[`title`],b0={key:0,class:`space-y-3`},x0={class:`text-label`},S0={key:0,class:`text-danger`},C0={class:`ml-2 text-xs text-fg-subtle`},w0={key:1,class:`space-y-3`},T0={class:`text-label`},E0={class:`ml-2 text-xs text-fg-subtle`},D0=[`title`],O0={key:0,class:`text-xs text-danger`},k0={class:`space-y-1.5`},A0={key:0,role:`alert`,class:`text-xs text-danger`},j0={class:`divide-y divide-border rounded-md border border-border`},M0={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},N0={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},P0={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},F0={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},I0=[`for`],L0=P({__name:`StepEditor`,props:{yaml:{},path:{},vocabulary:{},workflows:{},modelAliases:{}},emits:[`update:yaml`],setup(e,{emit:t}){let n=we(),r=e,i=t,a=Y(()=>i1(r.yaml,r.path)??{}),o=Y(()=>n1(a.value)),s=Y(()=>o.value?.kind??(typeof a.value.type==`string`?a.value.type:``)),c=Y(()=>o.value?.branches.map(([e])=>e)??[]),l=Y(()=>s.value===`parallel`?2:1);function u(e){i(`update:yaml`,a1(r.yaml,r.path,{...a.value,switch:{...a.value.switch,on:e}}))}let d=J(``),f=J(``);function p(e,t,n=``){try{let a=e===`add`?l1(r.yaml,r.path,t):e===`rename`?u1(r.yaml,r.path,t,n):d1(r.yaml,r.path,t);i(`update:yaml`,a),d.value=``,f.value=``}catch(e){f.value=String(e.message)}}let m=Y(()=>r.vocabulary.find(e=>e.name===s.value)),h=Y(()=>typeof a.value.settings==`object`&&a.value.settings!==null?a.value.settings:{}),g=Y(()=>g1(r.yaml,r.path)),_=Y(()=>K1(a.value)),v=Y(()=>m.value?.settings&&a.value.settings?J1(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=Y(()=>{let e=Object.entries(m.value?.settings?.properties??{}).filter(([e])=>s.value!==`workflow.call`||![`inputs`,`outputs`].includes(e)).map(([e,t])=>({key:e,schema:t,kind:x(e,t),options:s.value===`agent.run`&&e===`model`?r.modelAliases:t.enum??[]})),t=e.filter(e=>y.includes(e.key)&&e.kind!==`boolean`).sort((e,t)=>y.indexOf(e.key)-y.indexOf(t.key))[0],n=e.filter(e=>e!==t);return{lead:t,compact:n.filter(e=>[`workflow`,`select`,`line`,`number`,`boolean`].includes(e.kind)),long:n.filter(e=>[`text`,`lines`,`yaml`].includes(e.kind))}}),C=J(!S.value.lead&&!o.value),w=e=>[{value:``,label:`Default`},...e.map(e=>({value:e,label:e}))];function T(e){let{id:t,type:n,...a}=e;i(`update:yaml`,a1(r.yaml,r.path,{id:t,type:n,...a}))}function ee(e,t){T({...a.value,[e]:t})}function E(e){let t={...a.value.retry,...e};ee(`retry`,t.attempts===void 0&&!t.backoff?void 0:{...t,attempts:t.attempts??1})}function D(e,t){let n={...h.value,[e]:t};s.value===`workflow.call`&&e===`wait`&&t!==!0&&delete n.outputs,T({...a.value,settings:n})}function te(e,t){let n={...h.value,[e]:t};s.value===`workflow.call`&&t!==h.value[e]&&(delete n.inputs,delete n.outputs),T({...a.value,settings:n})}let O=Y(()=>r.workflows.find(e=>e.id===h.value.workflow)),ne=Y(()=>Object.entries(v1(O.value?.yaml??``,`inputs`)??{})),re=Y(()=>Object.entries(v1(O.value?.yaml??``,`outputs`)??{})),ae=Y(()=>Object.entries(v1(r.yaml,`inputs`)??{})),k=Y(()=>Object.entries(v1(r.yaml,`outputs`)??{})),oe=Y(()=>h.value.inputs??{}),se=Y(()=>h.value.outputs??{}),ce=e=>typeof e==`string`&&e.startsWith(`inputs.`),le=e=>[`object`,`array`].includes(e.type??``),ue=e=>oe.value[e]===void 0?``:String(oe.value[e]);function de(e,t,n){D(`inputs`,{...oe.value,[e]:t===``?void 0:ce(t)?t:hD(t,n??`string`)})}let fe=(e,t,n)=>e.filter(([,e])=>e.type===t.type||e.type===`any`||t.type===`any`).map(([e])=>({value:`${n}.${e}`,label:e})),pe=J(null);function me(e){let t=pe.value??S.value.lead?.key;if(!t)return;let n=typeof h.value[t]==`string`?h.value[t]:``,r=`{{ steps.${e}.summary }}`;D(t,n?`${n.trimEnd()} ${r}`:r)}let he=J({});function ge(e,t){try{D(e,t.trim()?Q$(t):void 0),he.value={...he.value,[e]:``}}catch(t){he.value={...he.value,[e]:String(t.messag Line truncated
`)[0]}}}let _e=e=>e===void 0?``:$$(e).trimEnd(),ve=(e,t)=>t.title??e.replaceAll(`_`,` `).replace(/^./,e=>e.toUpperCase()),ye=e=>typeof h.value[e]==`string`?h.value[e]:``,N=[{value:``,label:`Park the task`},{value:`continue`,label:`Continue`}];return(t,r)=>(L(),j(`div`,o0,[v.value?(L(),j(`p`,s0,B(v.value),1)):F(``,!0),o.value?(L(),j(`section`,c0,[s.value===`switch`?(L(),j(`label`,l0,[r[15]||=R(`span`,{class:`text-xs font-medium text-fg-muted`,title:`The value whose case runs; a case named default runs when none matches`},`Switch on`,-1),A(V(Q),{"model-value":o.value.on,class:`font-mono`,placeholder:`steps.assess.result.fit`,list:`${V(n)}-switch-on`,onChange:r[0]||=e=>u(e.target.value.trim())},null,8,[`model-value`,`list`]),R(`datalist`,{id:`${V(n)}-switch-on`},[(L(!0),j(U,null,M(g.value,e=>(L(),j(`option`,{key:e,value:`steps.${e}.result.`},null,8,d0))),128))],8,u0)])):F(``,!0),R(`div`,f0,B(s.value===`switch`?`Cases`:`Branches`),1),(L(!0),j(U,null,M(c.value,e=>(L(),j(`div`,{key:e,class:`flex items-center gap-2`},[A(V(Q),{"model-value":e,class:z(s.value===`switch`&&`font-mono`),"aria-label":`${s.value===`switch`?`Case`:`Branch`} ${e}`,onChange:t=>p(`rename`,e,t.target.value.trim())},null,8,[`model-value`,`class`,`aria-label`,`onChange`]),A(V(X),{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Remove ${e}`,disabled:c.value.length<=l.value,onClick:t=>p(`delete`,e)},{default:I(()=>[A(V(Mu))]),_:1},8,[`aria-label`,`disabled`,`onClick`])]))),128)),R(`div`,p0,[A(V(Q),{modelValue:d.value,"onUpdate:modelValue":r[1]||=e=>d.value=e,"aria-label":s.value===`switch`?`New case value`:`New branch name`,placeholder:s.value===`switch`?`Value, or default`:`Branch name`,onKeydown:r[2]||=gt(pt(e=>p(`add`,d.value.trim()),[`prevent`]),[`enter`])},null,8,[`modelValue`,`aria-label`,`placeholder`]),A(V(X),{type:`button`,size:`icon-sm`,variant:`outline`,"aria-label":s.value===`switch`?`Add case`:`Add branch`,disabled:!d.value.trim(),onClick:r[3]||=e=>p(`add`,d.value.trim())},{default:I(()=>[A(V(Eu))]),_:1},8,[`aria-label`,`disabled`])]),f.value?(L(),j(`p`,m0,B(f.value),1)):F(``,!0)])):F(``,!0),S.value.lead?(L(),j(`section`,h0,[R(`div`,{class:`flex items-center gap-1 text-xs font-medium text-fg-muted`,title:S.value.lead.schema.description},[H(B(ve(S.value.lead.key,S.value.lead.schema))+` `,1),S.value.lead.schema.description?(L(),q(V(tu),{key:0,class:`size-3 text-fg-subtle`})):F(``,!0)],8,g0),S.value.lead.kind===`workflow`?(L(),q(z1,{key:0,editable:s.value!==`workflow.call`,value:ye(S.value.lead.key),workflows:e.workflows,label:ve(S.value.lead.key,S.value.lead.schema),onPick:r[4]||=e=>te(S.value.lead.key,e)},null,8,[`editable`,`value`,`workflows`,`label`])):S.value.lead.kind===`select`?(L(),q(I1,{key:1,class:`w-full`,"model-value":ye(S.value.lead.key),options:w(S.value.lead.options),"aria-label":ve(S.value.lead.key,S.value.lead.schema),"onUpdate:modelValue":r[5]||=e=>D(S.value.lead.key,e||void 0)},null,8,[`model-value`,`options`,`aria-label`])):S.value.lead.kind===`text`?(L(),q(V(Jd),{key:2,"model-value":ye(S.value.lead.key),class:`min-h-32 text-label leading-relaxed`,onFocus:r[6]||=e=>pe.value=S.value.lead.key,"onUpdate:modelValue":r[7]||=e=>D(S.value.lead.key,String(e))},null,8,[`model-value`])):(L(),q(V(Q),{key:3,"model-value":ye(S.value.lead.key),onFocus:r[8]||=e=>pe.value=S.value.lead.key,"onUpdate:modelValue":r[9]||=e=>D(S.value.lead.key,String(e))},null,8,[`model-value`])),g.value.length&&S.value.lead.kind!==`select`?(L(),j(`div`,_0,[r[16]||=R(`span`,{class:`text-caption text-fg-subtle`},`Insert`,-1),(L(!0),j(U,null,M(g.value,e=>(L(),q(V(X),{key:e,type:`button`,variant:`outline`,size:`xs`,class:`font-mono`,title:`{{ steps.${e}.summary }}`,onClick:t=>me(e)},{default:I(()=>[H(B(e),1)]),_:2},1032,[`title`,`onClick`]))),128))])):F(``,!0)])):F(``,!0),A(V(X),{type:`button`,variant:`ghost`,size:`xs`,class:`-ml-2 text-fg-muted aria-expanded:bg-transparent`,"aria-expanded":C.value,onClick:r[10]||=e=>C.value=!C.value},{default:I(()=>[A(V(ie),{"data-icon":`inline-start`,class:z([`transition-transform`,!C.value&&`-rotate-90`])},null,8,[`class`]),r[17]||=H(`More `,-1)]),_:1},8,[`aria-expanded`]),C.value?(L(),j(U,{key:3},[S.value.compact.length?(L(),j(`section`,v0,[(L(!0),j(U,null,M(S.value.compact,t=>(L(),j(`div`,{key:t.key,class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},[R(`span`,{class:`flex flex-1 items-center gap-1 text-label`,title:t.schema.description},[H(B(ve(t.key,t.schema))+` `,1),t.schema.description?(L(),q(V(tu),{key:0,class:`size-3 text-fg-subtle`})):F(``,!0)],8,y0),t.kind===`workflow`?(L(),q(z1,{key:0,editable:s.value!==`workflow.call`,class:`max-w-48`,value:ye(t.key),workflows:e.workflows,label:ve(t.key,t.schema),onPick:e=>te(t.key,e)},null,8,[`editable`,`value`,`workflows`,`label`,`onPick`])):t.kind===`boolean`?(L(),q(V(iT),{key:1,"model-value":h.value[t.key]===!0,"onUpdate:modelValue":e=>D(t.key,e||void 0)},null,8,[`model-value`,`onUpdate:modelValue`])):t.kind===`select`?(L(),q(I1,{key:2,class:`w-40`,"model-va Line truncated
`):``,class:`min-h-16 font-mono text-xs`,placeholder:`One per line`,"onUpdate:modelValue":t=>D(e.key,String(t).split(`
`).filter(Boolean))},null,8,[`model-value`,`onUpdate:modelValue`])):(L(),j(U,{key:2},[A(V(Jd),{"model-value":_e(h.value[e.key]),class:`min-h-24 font-mono text-xs`,placeholder:`YAML`,onChange:t=>ge(e.key,t.target.value)},null,8,[`model-value`,`onChange`]),he.value[e.key]?(L(),j(`span`,O0,B(he.value[e.key]),1)):F(``,!0)],64))]))),128)),R(`section`,k0,[_.value?(L(),j(`p`,A0,B(_.value),1)):F(``,!0),R(`div`,j0,[R(`label`,M0,[r[20]||=R(`span`,{class:`flex-1 text-label`,title:`Empty always runs. A field such as inputs.enabled, !inputs.skip, or steps.plan.result.ready == true`},`Run only when`,-1),A(V(Q),{class:`h-8 w-48 font-mono text-xs`,placeholder:`inputs.enabled`,"aria-invalid":_.value&&_.value.startsWith(`when`)?!0:void 0,"model-value":a.value.when??``,"onUpdate:modelValue":r[11]||=e=>ee(`when`,String(e))},null,8,[`aria-invalid`,`model-value`])]),R(`label`,N0,[r[21]||=R(`span`,{class:`flex-1 text-label`},`If it fails`,-1),A(I1,{class:`w-36`,"aria-label":`If it fails`,"model-value":a.value.on_failure??``,options:N,"onUpdate:modelValue":r[12]||=e=>ee(`on_failure`,e||void 0)},null,8,[`model-value`])]),R(`label`,P0,[r[22]||=R(`span`,{class:`flex-1 text-label`},`Attempts`,-1),A(V(Q),{type:`number`,min:`1`,max:`10`,placeholder:`1`,class:`h-8 w-20 text-right text-label`,"model-value":a.value.retry?.attempts??``,"onUpdate:modelValue":r[13]||=e=>E({attempts:String(e)===``?void 0:Number(String(e))})},null,8,[`model-value`])]),R(`div`,F0,[R(`label`,{for:`${V(n)}-backoff`,class:`flex-1 text-label`},`Retry backoff`,8,I0),A(V(Zw),{id:`${V(n)}-backoff`,"model-value":a.value.retry?.backoff??``,units:[`s`,`m`,`h`],"onUpdate:modelValue":r[14]||=e=>E({backoff:e||void 0})},null,8,[`id`,`model-value`])])])])],64)):F(``,!0)]))}}),R0={class:`space-y-1.5`},z0={class:`flex items-center text-xs font-medium text-fg-muted`},B0={key:0,class:`divide-y divide-border rounded-md border border-border`},V0=P({__name:`SpecList`,props:{yaml:{},field:{}},emits:[`update:yaml`],setup(e,{emit:t}){let n=e,r=t,i=[`string`,`number`,`bool`,`object`,`array`,`any`].map(e=>({value:e,label:e})),a=Y(()=>Object.entries(v1(n.yaml,n.field)??{}));function o(e){r(`update:yaml`,y1(n.yaml,n.field,Object.fromEntries(e.filter(([e])=>e))))}function s(e,t,n){o(a.value.map((r,i)=>i===e?[t,n]:r))}function c(){let e=n.field.slice(0,-1),t=a.value.length+1;for(;a.value.some(([n])=>n===`${e}_${t}`);)t++;o([...a.value,[`${e}_${t}`,{type:`string`}]])}return(t,n)=>(L(),j(`section`,R0,[R(`div`,z0,[H(B(e.field===`inputs`?`Inputs`:`Outputs`)+` `,1),A(V(X),{type:`button`,variant:`ghost`,size:`xs`,class:`ml-auto`,onClick:c},{default:I(()=>[A(V(Eu),{"data-icon":`inline-start`}),n[0]||=H(`Add`,-1)]),_:1})]),a.value.length?(L(),j(`div`,B0,[(L(!0),j(U,null,M(a.value,([t,n],r)=>(L(),j(`div`,{key:r,class:`flex items-center gap-2 px-2 py-1.5`},[A(V(Q),{"model-value":t,class:`h-8 min-w-0 flex-1 font-mono text-xs`,"aria-label":`${e.field} name`,onChange:e=>s(r,e.target.value.trim(),n)},null,8,[`model-value`,`aria-label`,`onChange`]),A(I1,{"model-value":n.type??`string`,options:V(i),class:`w-24`,"aria-label":`${t} type`,"onUpdate:modelValue":e=>s(r,t,{...n,type:e})},null,8,[`model-value`,`options`,`aria-label`,`onUpdate:modelValue`]),A(V(iT),{"model-value":n.required===!0,title:n.required?`Required`:`Optional`,"aria-label":`${t} required`,"onUpdate:modelValue":e=>s(r,t,{...n,required:e||void 0})},null,8,[`model-value`,`title`,`aria-label`,`onUpdate:modelValue`]),A(V(X),{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":`Remove ${t}`,onClick:e=>o(a.value.filter((e,t)=>t!==r))},{default:I(()=>[A(V(Mu))]),_:1},8,[`aria-label`,`onClick`])]))),128))])):F(``,!0)]))}}),H0={class:`space-y-4 px-3 py-3`},U0={class:`divide-y divide-border rounded-md border border-border`},W0={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},G0={key:0,role:`alert`,class:`px-3 py-2 text-xs text-danger`},K0={key:1,class:`px-3 py-2 text-xs text-fg-subtle`},q0={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},J0={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},Y0={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},X0={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},Z0={class:`space-y-1.5`},Q0=`6f129e29-0e26-5246-99bd-74cb4496203b`,$0=P({__name:`WorkflowSettings`,props:{yaml:{}},emits:[`update:yaml`],setup(e,{emit:t}){let n=e,r=t,i=e=>{let t=v1(n.yaml,e);return typeof t==`string`?t:``};function a(e,t){r(`update:yaml`,y1(n.yaml,e,t))}let o=MT(),s=J([]),c=J(!0),l=J(``);async function u(){c.value=!0,l.value=``,s.value=[];try{await o.loadOrg();let e=await Z.orgAgents(o.homeOrg);s.value=e.agents.filter(e=>e.lifecycle===`active`),!i(`identity`)&&s.value.some(e=>e.id===Q0)&&a(`identity`,Q0)}catch(e){l.value=String(e.message||e)}finally{c.value=!1}}Be(u);let d=Y(()=>{let e=i(`identity`),t=s.value.map(e=>({value:e.id,label:e.display_name}));return e&&!c.value&&!s.value.some(t=>t.id===e)?[{value:e,label:`${e} (unknown)`,disabled:!0},...t]:t}),f=qw(),p=Y(()=>{let e=Object.keys(f.stateFor(`agent-profilesLine 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=p3(f3(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=p3(f3(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 nfe(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new efe||null,prettyErrors:t}}function g3(e,t={}){let{lineCounter:n,prettyErrors:r}=nfe(t),i=new tfe(n?.addNewLine),a=new Jde(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 R4(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(z4(e,n)),o.warnings.forEach(z4(e,n))),o}function _3(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let i=g3(e,n);if(!i)return null;if(i.warnings.forEach(e=>P2(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 rfe(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 K0(e)&&!r?e.toString(n):new F4(e,r,n).toString(n)}var v3=e=>typeof e==`object`&&!!e&&!Array.isArray(e),y3=e=>v3(e)?Object.entries(e).map(([e,t])=>[e,Array.isArray(t)?t:[]]):[];function b3(e){if(v3(e)){if(v3(e.parallel))return{kind:`parallel`,base:[`parallel`],branches:y3(e.parallel)};if(v3(e.switch))return{kind:`switch`,base:[`switch`,`cases`],on:typeof e.switch.on==`string`?e.switch.on:``,branches:y3(e.switch.cases)}}}function x3(e){return e.slice(2).includes(`parallel`)}function S3(e,t){let n=g3(e).getIn(t,!0);if(q0(n))return n.toJSON()}function C3(e,t,n){let r=g3(e);return r.setIn(t,r.createNode(E3(n))),r.toString()}function ife(e,t,n){let r=g3(e),i=t.slice(0,-1),a=x3(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(X0(o)||(r.setIn(i,r.createNode([])),o=r.getIn(i,!0)),!X0(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 w3(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 T3(e,t){let n=e.getIn(t,!0),r=b3(q0(n)?n.toJSON():void 0),i=r?e.getIn([...t,...r.base],!0):void 0;if(!r||!q0(i))throw Error(`This step has no branches.`);return{kind:r.kind,branches:i}}function afe(e,t,n){let r=g3(e),{kind:i,branches:a}=T3(r,t);if(w3(n,i),a.has(n))throw Error(`Branch ${n} already exists.`);return a.set(n,r.createNode([])),r.toString()}function ofe(e,t,n,r){let i=g3(e),{kind:a,branches:o}=T3(i,t);if(w3(r,a),n!==r&&o.has(r))throw Error(`Branch ${r} already exists.`);let s=o.items.find(e=>Y0(e.key)&&e.key.value===n);if(!s||!Y0(s.key))throw Error(`Branch ${n} does not exist.`);return s.key.value=r,i.toString()}function sfe(e,t,n){let r=g3(e),{kind:i,branches:a}=T3(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 caseLine truncated
`).find(e=>e.trim())?.trim()}}function bfe(e,t){let n=JSON.stringify(e??{})+` `+(typeof t==`string`?`{{ ${t.replace(/^!/,``)} }}`:``);return[...new Set([...n.matchAll(_fe)].map(e=>e[1]))]}function P3(e){let t=g3(e).toJS(),n=N3(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=N3(e)?e:{},p=b3(d),m=p?.kind??(typeof d.type==`string`?d.type:``),h=N3(d.settings)?d.settings:{},g=typeof d.id==`string`?d.id:``,_=`step-${t}`,v=s?`${s}/${g||m}`:g||m;r.push({id:_,type:`step`,position:{x:n,y:i},data:{kind:`step`,key:g||t,name:g||void 0,title:g||M3(m),type:m,step:l?.length===2?String(Number(l[1])+1).padStart(2,`0`):void 0,detail:p?.on?`on ${p.on.replace(/^steps\./,``)}`:vfe(m,h),summary:yfe(h),when:typeof d.when==`string`?d.when:void 0,retry:N3(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 bfe([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=b3(t);if(n){let{kind:i,base:a,branches:o}=n,c=p(t,String(e+1),0,u*j3,void 0,void 0,[`steps`,e]);m(l,c,[`steps`,e-1]),u++;let d=N3(t)&&typeof t.id==`string`?t.id:i,f=i===`switch`&&!o.some(([e])=>e==="default"),h=o.length+ +!!f,g=[],_=Math.max(1,...o.map(([,e])=>e.length)),v=e=>(e-(h-1)/2)*hfe,y=(e,t,n)=>r.push({id:e,type:`lane`,position:{x:t-12,y:u*j3-40},style:{width:`264px`,height:`${(_+1)*j3-24}px`},zIndex:-1,data:{kind:`step`,key:n,title:n,type:``,detail:``,lane:i}}),b=(u+_)*j3;if(o.forEach(([t,n],o)=>{let s=v(o),l=[c],f=[`steps`,e,...a,t];n.forEach((n,r)=>{let a=p(n,`${e+1}-${t}-${r+1}`,s,(u+r)*j3,t,d,[...f,r],i);m(l,a,[...f,r-1]),l=[a]});let h=`add-${e}-${t}`;r.push({id:h,type:`add`,position:{x:s+104,y:b},data:{kind:`step`,key:h,title:``,type:``,detail:``,branch:t,lane:i,insertAfter:[...f,n.length-1]}}),m(l,h),g.push(h),y(`lane-${e}-${t}`,s,t)}),f){let t=v(h-1),n=`pass-${e}`;r.push({id:n,type:`add`,position:{x:t+104,y:b},data:{kind:`step`,key:n,title:``,type:``,detail:``,lane:i}}),s.add(c),m([c],n),s.delete(c),g.push(n),y(`pass-lane-${e}`,t,`default`)}l=g,u+=_+1;continue}let i=p(t,String(e+1),0,u*j3,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*j3-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 xfe={class:`truncate`},F3=`\0`,I3=y({inheritAttrs:!1,__name:`OptionSelect`,props:{modelValue:{},options:{},placeholder:{},disabled:{type:Boolean},size:{},class:{}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=t;return(t,i)=>(j(),U(L(ql),{"model-value":e.modelValue===``&&e.options.some(e=>e.value===``)?F3:e.modelValue||void 0,disabled:e.disabled,"onUpdate:modelValue":i[0]||=e=>n(`update:modelValue`,e===F3?``:String(e))},{default:A(()=>[r(L(tu),V({size:e.size??`sm`,class:t.$props.class},t.$attrs),{default:A(()=>[r(L(nu),{placeholder:e.placeholder},null,8,[`placeholder`])]),_:1},16,[`size`,`class`]),r(L(Jl),{position:`popper`,class:`max-w-[min(var(--reka-select-content-available-width),20rem)]`},{default:A(()=>[(j(!0),o(z,null,s(e.options,e=>(j(),U(L(Zl),{key:e.value,value:e.value===``?F3:e.value,disabled:e.disabled,title:e.label,class:`*:[span]:last:min-w-0`},{default:A(()=>[N(`span`,xfe,I(e.label),1)]),_:2},1032,[`value`,`disabled`,`title`]))),128))]),_:1})]),_:1},8,[`model-value`,`disabled`]))}}),Sfe=[`id`],Cfe=[`value`],L3=y({__name:`WorkflowPicker`,props:{value:{},workflows:{},label:{},class:{},editable:{type:Boolean}},emits:[`pick`],setup(e,{emit:t}){let n=v(),i=t;return(t,a)=>e.editable?(j(),o(z,{key:0},[r(L(Y),{"model-value":e.value,list:L(n),"aria-label":e.label,class:F(t.$props.class),placeholder:`Workflow id or {{ reference }}`,"onUpdate:modelValue":a[0]||=e=>i(`pick`,String(e))},null,8,[`model-value`,`list`,`aria-label`,`class`]),N(`datalist`,{id:L(n)},[(j(!0),o(z,null,s(e.workflows,e=>(j(),o(`option`,{key:e.id,value:e.id},null,8,Cfe))),128))],8,Sfe)],64)):(j(),U(L(ql),{key:1,"model-value":e.value||void 0,"onUpdate:modelValue":a[1]||=e=>i(`pick`,String(e))},{default:A(()=>[r(L(tu),{"aria-label":e.label,class:F(t.$props.class)},{default:A(()=>[r(L(nu),{placeholder:`Choose workflow`})]),_:1},8,[`aria-label`,`class`]),r(L(Jl),null,{default:A(() Line truncated
`).map((e,t)=>({number:t+1,text:e,tokens:Afe(e)}))}var Ofe=/^(\s*)(-\s+)?/,kfe=/^([^:#\s][^:#]*?)(:)(\s*)(.*)$/;function Afe(e){let{code:t,comment:n}=jfe(e),r=Mfe(t);return n&&r.push({text:n,kind:`comment`}),r}function jfe(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 Mfe(e){if(!e)return[];let t=[],n=Ofe.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=kfe.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,...G3(i[4]??``)]):[...t,...G3(r)]}function G3(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 Nfe(e){return e.split(`
`)[0]?.trim()||`invalid YAML`}function K3(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Pfe(e){return typeof e==`string`&&e.trim()!==``}var Ffe={class:`space-y-4 px-3 py-3`},Ife={key:0,class:`rounded-md bg-danger/10 px-2.5 py-1.5 text-xs text-danger`,role:`alert`},Lfe={key:1,class:`space-y-3`},Rfe={key:0,class:`block space-y-1.5`},zfe=[`id`],Bfe=[`value`],Vfe={class:`text-xs font-medium text-fg-muted`},Hfe={class:`flex items-center gap-2`},Ufe={key:1,role:`alert`,class:`text-xs text-danger`},Wfe={key:2,class:`space-y-1.5`},Gfe=[`title`],Kfe={key:4,class:`flex flex-wrap items-center gap-1 pt-0.5`},qfe={key:0,class:`divide-y divide-border rounded-md border border-border`},Jfe=[`title`],Yfe={key:0,class:`space-y-3`},Xfe={class:`text-label`},Zfe={key:0,class:`text-danger`},Qfe={class:`ml-2 text-xs text-fg-subtle`},$fe={key:1,class:`space-y-3`},epe={class:`text-label`},tpe={class:`ml-2 text-xs text-fg-subtle`},npe=[`title`],rpe={key:0,class:`text-xs text-danger`},ipe={class:`space-y-1.5`},ape={key:0,role:`alert`,class:`text-xs text-danger`},ope={class:`divide-y divide-border rounded-md border border-border`},spe={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},cpe={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},lpe={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},upe={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},dpe=[`for`],fpe=y({__name:`StepEditor`,props:{yaml:{},path:{},vocabulary:{},workflows:{},modelAliases:{}},emits:[`update:yaml`],setup(e,{emit:t}){let n=v(),i=e,a=t,c=G(()=>S3(i.yaml,i.path)??{}),l=G(()=>b3(c.value)),u=G(()=>l.value?.kind??(typeof c.value.type==`string`?c.value.type:``)),d=G(()=>l.value?.branches.map(([e])=>e)??[]),f=G(()=>u.value===`parallel`?2:1);function p(e){a(`update:yaml`,C3(i.yaml,i.path,{...c.value,switch:{...c.value.switch,on:e}}))}let m=W(``),h=W(``);function g(e,t,n=``){try{let r=e===`add`?afe(i.yaml,i.path,t):e===`rename`?ofe(i.yaml,i.path,t,n):sfe(i.yaml,i.path,t);a(`update:yaml`,r),m.value=``,h.value=``}catch(e){h.value=String(e.message)}}let _=G(()=>i.vocabulary.find(e=>e.name===u.value)),y=G(()=>typeof c.value.settings==`object`&&c.value.settings!==null?c.value.settings:{}),b=G(()=>ffe(i.yaml,i.path)),x=G(()=>H3(c.value)),S=G(()=>_.value?.settings&&c.value.settings?W3(c.value.settings,_.value.settings,`settings`):``),C=[`mission`,`workflow`,`message`,`body`,`plan`,`then`,`status`,`detail`,`run`,`rules`],w=/mission|body|detail|plan|rules/;function E(e,t){return[`workflow.call`,`workflow.handoff`].includes(u.value)&&e===`workflow`||u.value===`human.approve`&&e===`then`?`workflow`:u.value===`agent.run`&&e===`model`?`select`:t.type===`string`?t.enum?`select`:w.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 D=G(()=>{let e=Object.entries(_.value?.settings?.properties??{}).filter(([e])=>u.value!==`workflow.call`||![`inputs`,`outputs`].includes(e)).map(([e,t])=>({key:e,schema:t,kind:E(e,t),options:u.value===`agent.run`&&e===`model`?i.modelAliases:t.enum??[]})),t=e.filter(e=>C.includes(e.key)&&e.kind!==`boolean`).sort((e,t)=>C.indexOf(e.key)-C.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))}}),O=W(!D.value.lead&&!l.value),k=e=>[{value:``,label:`Default`},...e.map(e=>({value:e,label:e}))];function ee(e){let{id:t,type:n,...r}=e;a(`update:yaml`,C3(i.yaml,i.path,{id:t,type:n,...r}))}function te(e,t){ee({...c.value,[e]:t})}function M(e){let t={...c.value.retry,...e};te(`retry`,t.attempts===void 0&&!t.backoff?void 0:{...t,attempts:t.attempts??1})}function ne(e,t){let n={...y.value,[e]:t};u.value===`workflow.call`&&e===`wait`&&t!==!0&&delete n.outputs,ee({...c.value,settings:n})}function re(e,t){let n={...y.value,[e]:t};u.value===`workflow.call`&&t!==y.value[e]&&(delete n.inputs,delete n.outputs),ee({...c.value,settings:n})}let ie=G(()=>i.workflows.find(e=>e.id===y.value.workflow)),P=G(()=>Object.entries(D3(ie.value?.yaml??``,`inputs`)??{})),ae=G(()=>Object.entries(D3(ie.value?.yaml??``,`outputs`)??{})),oe=G(()=>Object.entries(D3(i.yaml,`inputs`)??{})),se=G(()=>Object.entries(D3(i.yaml,`outputs`)??{})),ce=G(()=>y.value.inputs??{}),le=G(()=>y.value.outputs??{}),ue=e=>typeof e==`string`&&e.startsWith(`inputs.`),de=e=>[`object`,`array`].includes(e.type??``),fe=e=>ce.value[e]===void 0?``:String(ce.value[e]);function pe(e,t,n){ne(`inputs`,{...ce.value,[e]:t===``?void 0:ue(t)?t:lT(t,n??`string`)})}let me=(e,t,n)=>e.filter(([,e])=>e.type===t.type||e.type===`any`||t.type===`any`).map(([e])=>({value:`${n}.${e}`,label:e})),he=W(null);function ge(e){let t=he.value??D.value.lead?.key;if(!t)return;let n=typeof y.value[t]==`string`?y.value[t]:``,r=`{{ steps.${e}.summary }}`;ne(t,n?`${n.trimEnd()} ${r}`:r)}let _e=W({});function B(e,t){try{ne(e,t.trim()?_3(t):void 0),_e.value={..._e.value,[e]:``}}catc Line truncated
`)[0]}}}let ve=e=>e===void 0?``:rfe(e).trimEnd(),V=(e,t)=>t.title??e.replaceAll(`_`,` `).replace(/^./,e=>e.toUpperCase()),ye=e=>typeof y.value[e]==`string`?y.value[e]:``,be=[{value:``,label:`Park the task`},{value:`continue`,label:`Continue`}];return(t,i)=>(j(),o(`div`,Ffe,[S.value?(j(),o(`p`,Ife,I(S.value),1)):T(``,!0),l.value?(j(),o(`section`,Lfe,[u.value===`switch`?(j(),o(`label`,Rfe,[i[15]||=N(`span`,{class:`text-xs font-medium text-fg-muted`,title:`The value whose case runs; a case named default runs when none matches`},`Switch on`,-1),r(L(Y),{"model-value":l.value.on,class:`font-mono`,placeholder:`steps.assess.result.fit`,list:`${L(n)}-switch-on`,onChange:i[0]||=e=>p(e.target.value.trim())},null,8,[`model-value`,`list`]),N(`datalist`,{id:`${L(n)}-switch-on`},[(j(!0),o(z,null,s(b.value,e=>(j(),o(`option`,{key:e,value:`steps.${e}.result.`},null,8,Bfe))),128))],8,zfe)])):T(``,!0),N(`div`,Vfe,I(u.value===`switch`?`Cases`:`Branches`),1),(j(!0),o(z,null,s(d.value,e=>(j(),o(`div`,{key:e,class:`flex items-center gap-2`},[r(L(Y),{"model-value":e,class:F(u.value===`switch`&&`font-mono`),"aria-label":`${u.value===`switch`?`Case`:`Branch`} ${e}`,onChange:t=>g(`rename`,e,t.target.value.trim())},null,8,[`model-value`,`class`,`aria-label`,`onChange`]),r(L(K),{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Remove ${e}`,disabled:d.value.length<=f.value,onClick:t=>g(`delete`,e)},{default:A(()=>[r(L(Nl))]),_:1},8,[`aria-label`,`disabled`,`onClick`])]))),128)),N(`div`,Hfe,[r(L(Y),{modelValue:m.value,"onUpdate:modelValue":i[1]||=e=>m.value=e,"aria-label":u.value===`switch`?`New case value`:`New branch name`,placeholder:u.value===`switch`?`Value, or default`:`Branch name`,onKeydown:i[2]||=Fe(Me(e=>g(`add`,m.value.trim()),[`prevent`]),[`enter`])},null,8,[`modelValue`,`aria-label`,`placeholder`]),r(L(K),{type:`button`,size:`icon-sm`,variant:`outline`,"aria-label":u.value===`switch`?`Add case`:`Add branch`,disabled:!m.value.trim(),onClick:i[3]||=e=>g(`add`,m.value.trim())},{default:A(()=>[r(L(_l))]),_:1},8,[`aria-label`,`disabled`])]),h.value?(j(),o(`p`,Ufe,I(h.value),1)):T(``,!0)])):T(``,!0),D.value.lead?(j(),o(`section`,Wfe,[N(`div`,{class:`flex items-center gap-1 text-xs font-medium text-fg-muted`,title:D.value.lead.schema.description},[R(I(V(D.value.lead.key,D.value.lead.schema))+` `,1),D.value.lead.schema.description?(j(),U(L(Lc),{key:0,class:`size-3 text-fg-subtle`})):T(``,!0)],8,Gfe),D.value.lead.kind===`workflow`?(j(),U(L3,{key:0,editable:u.value!==`workflow.call`,value:ye(D.value.lead.key),workflows:e.workflows,label:V(D.value.lead.key,D.value.lead.schema),onPick:i[4]||=e=>re(D.value.lead.key,e)},null,8,[`editable`,`value`,`workflows`,`label`])):D.value.lead.kind===`select`?(j(),U(I3,{key:1,class:`w-full`,"model-value":ye(D.value.lead.key),options:k(D.value.lead.options),"aria-label":V(D.value.lead.key,D.value.lead.schema),"onUpdate:modelValue":i[5]||=e=>ne(D.value.lead.key,e||void 0)},null,8,[`model-value`,`options`,`aria-label`])):D.value.lead.kind===`text`?(j(),U(L(hd),{key:2,"model-value":ye(D.value.lead.key),class:`min-h-32 text-label leading-relaxed`,onFocus:i[6]||=e=>he.value=D.value.lead.key,"onUpdate:modelValue":i[7]||=e=>ne(D.value.lead.key,String(e))},null,8,[`model-value`])):(j(),U(L(Y),{key:3,"model-value":ye(D.value.lead.key),onFocus:i[8]||=e=>he.value=D.value.lead.key,"onUpdate:modelValue":i[9]||=e=>ne(D.value.lead.key,String(e))},null,8,[`model-value`])),b.value.length&&D.value.lead.kind!==`select`?(j(),o(`div`,Kfe,[i[16]||=N(`span`,{class:`text-caption text-fg-subtle`},`Insert`,-1),(j(!0),o(z,null,s(b.value,e=>(j(),U(L(K),{key:e,type:`button`,variant:`outline`,size:`xs`,class:`font-mono`,title:`{{ steps.${e}.summary }}`,onClick:t=>ge(e)},{default:A(()=>[R(I(e),1)]),_:2},1032,[`title`,`onClick`]))),128))])):T(``,!0)])):T(``,!0),r(L(K),{type:`button`,variant:`ghost`,size:`xs`,class:`-ml-2 text-fg-muted aria-expanded:bg-transparent`,"aria-expanded":O.value,onClick:i[10]||=e=>O.value=!O.value},{default:A(()=>[r(L(xt),{"data-icon":`inline-start`,class:F([`transition-transform`,!O.value&&`-rotate-90`])},null,8,[`class`]),i[17]||=R(`More `,-1)]),_:1},8,[`aria-expanded`]),O.value?(j(),o(z,{key:3},[D.value.compact.length?(j(),o(`section`,qfe,[(j(!0),o(z,null,s(D.value.compact,t=>(j(),o(`div`,{key:t.key,class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},[N(`span`,{class:`flex flex-1 items-center gap-1 text-label`,title:t.schema.description},[R(I(V(t.key,t.schema))+` `,1),t.schema.description?(j(),U(L(Lc),{key:0,class:`size-3 text-fg-subtle`})):T(``,!0)],8,Jfe),t.kind===`workflow`?(j(),U(L3,{key:0,editable:u.value!==`workflow.call`,class:`max-w-48`,value:ye(t.key),workflows:e.workflows,label:V(t.key,t.schema),onPick:e=>re(t.key,e)},null,8,[`editable`,`value`,`workflows`,`label`,`onPick`])):t.kind===`boolean`?(j(),U(L(nC),{key:1,"model-value":y.value[t.key]===!0,"onUpdate:modelValue":e=>ne(t.key,e||void 0)},null,8,[`model-value`,`onUpdate:modelValue`])):t.kind===`select`?(j(),U(I3,{key:2,class:`wLine truncated
`):``,class:`min-h-16 font-mono text-xs`,placeholder:`One per line`,"onUpdate:modelValue":t=>ne(e.key,String(t).split(`
`).filter(Boolean))},null,8,[`model-value`,`onUpdate:modelValue`])):(j(),o(z,{key:2},[r(L(hd),{"model-value":ve(y.value[e.key]),class:`min-h-24 font-mono text-xs`,placeholder:`YAML`,onChange:t=>B(e.key,t.target.value)},null,8,[`model-value`,`onChange`]),_e.value[e.key]?(j(),o(`span`,rpe,I(_e.value[e.key]),1)):T(``,!0)],64))]))),128)),N(`section`,ipe,[x.value?(j(),o(`p`,ape,I(x.value),1)):T(``,!0),N(`div`,ope,[N(`label`,spe,[i[20]||=N(`span`,{class:`flex-1 text-label`,title:`Empty always runs. A field such as inputs.enabled, !inputs.skip, or steps.plan.result.ready == true`},`Run only when`,-1),r(L(Y),{class:`h-8 w-48 font-mono text-xs`,placeholder:`inputs.enabled`,"aria-invalid":x.value&&x.value.startsWith(`when`)?!0:void 0,"model-value":c.value.when??``,"onUpdate:modelValue":i[11]||=e=>te(`when`,String(e))},null,8,[`aria-invalid`,`model-value`])]),N(`label`,cpe,[i[21]||=N(`span`,{class:`flex-1 text-label`},`If it fails`,-1),r(I3,{class:`w-36`,"aria-label":`If it fails`,"model-value":c.value.on_failure??``,options:be,"onUpdate:modelValue":i[12]||=e=>te(`on_failure`,e||void 0)},null,8,[`model-value`])]),N(`label`,lpe,[i[22]||=N(`span`,{class:`flex-1 text-label`},`Attempts`,-1),r(L(Y),{type:`number`,min:`1`,max:`10`,placeholder:`1`,class:`h-8 w-20 text-right text-label`,"model-value":c.value.retry?.attempts??``,"onUpdate:modelValue":i[13]||=e=>M({attempts:String(e)===``?void 0:Number(String(e))})},null,8,[`model-value`])]),N(`div`,upe,[N(`label`,{for:`${L(n)}-backoff`,class:`flex-1 text-label`},`Retry backoff`,8,dpe),r(L(GS),{id:`${L(n)}-backoff`,"model-value":c.value.retry?.backoff??``,units:[`s`,`m`,`h`],"onUpdate:modelValue":i[14]||=e=>M({backoff:e||void 0})},null,8,[`id`,`model-value`])])])])],64)):T(``,!0)]))}}),ppe={class:`space-y-1.5`},mpe={class:`flex items-center text-xs font-medium text-fg-muted`},hpe={key:0,class:`divide-y divide-border rounded-md border border-border`},q3=y({__name:`SpecList`,props:{yaml:{},field:{}},emits:[`update:yaml`],setup(e,{emit:t}){let n=e,i=t,a=[`string`,`number`,`bool`,`object`,`array`,`any`].map(e=>({value:e,label:e})),c=G(()=>Object.entries(D3(n.yaml,n.field)??{}));function l(e){i(`update:yaml`,O3(n.yaml,n.field,Object.fromEntries(e.filter(([e])=>e))))}function u(e,t,n){l(c.value.map((r,i)=>i===e?[t,n]:r))}function d(){let e=n.field.slice(0,-1),t=c.value.length+1;for(;c.value.some(([n])=>n===`${e}_${t}`);)t++;l([...c.value,[`${e}_${t}`,{type:`string`}]])}return(t,n)=>(j(),o(`section`,ppe,[N(`div`,mpe,[R(I(e.field===`inputs`?`Inputs`:`Outputs`)+` `,1),r(L(K),{type:`button`,variant:`ghost`,size:`xs`,class:`ml-auto`,onClick:d},{default:A(()=>[r(L(_l),{"data-icon":`inline-start`}),n[0]||=R(`Add`,-1)]),_:1})]),c.value.length?(j(),o(`div`,hpe,[(j(!0),o(z,null,s(c.value,([t,n],i)=>(j(),o(`div`,{key:i,class:`flex items-center gap-2 px-2 py-1.5`},[r(L(Y),{"model-value":t,class:`h-8 min-w-0 flex-1 font-mono text-xs`,"aria-label":`${e.field} name`,onChange:e=>u(i,e.target.value.trim(),n)},null,8,[`model-value`,`aria-label`,`onChange`]),r(I3,{"model-value":n.type??`string`,options:L(a),class:`w-24`,"aria-label":`${t} type`,"onUpdate:modelValue":e=>u(i,t,{...n,type:e})},null,8,[`model-value`,`options`,`aria-label`,`onUpdate:modelValue`]),r(L(nC),{"model-value":n.required===!0,title:n.required?`Required`:`Optional`,"aria-label":`${t} required`,"onUpdate:modelValue":e=>u(i,t,{...n,required:e||void 0})},null,8,[`model-value`,`title`,`aria-label`,`onUpdate:modelValue`]),r(L(K),{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":`Remove ${t}`,onClick:e=>l(c.value.filter((e,t)=>t!==i))},{default:A(()=>[r(L(Nl))]),_:1},8,[`aria-label`,`onClick`])]))),128))])):T(``,!0)]))}}),gpe={class:`space-y-4 px-3 py-3`},_pe={class:`divide-y divide-border rounded-md border border-border`},vpe={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},ype={key:0,role:`alert`,class:`px-3 py-2 text-xs text-danger`},bpe={key:1,class:`px-3 py-2 text-xs text-fg-subtle`},xpe={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},Spe={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},Cpe={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},wpe={class:`flex min-h-10 items-center gap-3 px-3 py-1.5`},Tpe={class:`space-y-1.5`},J3=`6f129e29-0e26-5246-99bd-74cb4496203b`,Epe=y({__name:`WorkflowSettings`,props:{yaml:{}},emits:[`update:yaml`],setup(e,{emit:t}){let n=e,i=t,a=e=>{let t=D3(n.yaml,e);return typeof t==`string`?t:``};function c(e,t){i(`update:yaml`,O3(n.yaml,e,t))}let l=gw(),u=W([]),d=W(!0),f=W(``);async function p(){d.value=!0,f.value=``,u.value=[];try{await l.loadOrg();let e=await J.orgAgents(l.homeOrg);u.value=e.agents.filter(e=>e.lifecycle===`active`),!a(`identity`)&&u.value.some(e=>e.id===J3)&&c(`identity`,J3)}catch(e){f.value=String(e.message||e)}finally{d.value=!1}}P(p);let m=G(()=>{let e=a(`identity`),t=u.value.map(e=>({value:e.id,label:e.display_name}));return e&&!d.value&&!u.value.some(t=>t.id===e)?[{value:e,label:`${e} (unknown)`,disabled:!0},...t]:t}),h=AS(),g=G(()=>{let e=Object.keys(h Line truncated
`).replace(`
`,`
+`).split(`
`).map(e=>e.trim().toLowerCase());if(i.length===1)return e.toLowerCase()===t.toLowerCase();r||n.add(e.toLowerCase());let a=i.every((e,t)=>n.has(e)&&Array.from(n.values())[t]===i[t]);return r&&n.delete(e.toLowerCase()),a}function xoe(e,t){return n=>{if(!n.code&&!n.key)return!1;let r=Soe(n.code,e);return Array.isArray(e)?e.some(e=>w5(n[r],e,t,n.type===`keyup`)):w5(n[r],e,t,n.type===`keyup`)}}function Soe(e,t){return t.includes(e)?`code`:`key`}function T5(e,t){let n=Y(()=>Ge(t?.target)??yoe),r=at(Ge(e)===!0),i=!1,a=new Set,o=c(Ge(e));N(()=>Ge(e),(e,t)=>{typeof t==`boolean`&&typeof e!=`boolean`&&s(),o=c(e)},{immediate:!0}),g4([`blur`,`contextmenu`],s),v4((...e)=>o(...e),e=>{let n=Ge(t?.actInsideInputWithModifier)??!0,a=Ge(t?.preventDefault)??!1;if(i=boe(e),(!i||i&&!n)&&C5(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}),v4((...e)=>o(...e),e=>{let n=Ge(t?.actInsideInputWithModifier)??!0;if(r.value){if((!i||i&&!n)&&C5(e))return;i=!1,r.value=!1}},{eventName:`keyup`,target:n});function s(){i=!1,a.clear(),r.value=Ge(e)===!0}function c(e){return e===null?(s(),()=>!1):typeof e==`boolean`?(s(),r.value=e,()=>!1):Array.isArray(e)||typeof e==`string`?xoe(e,a):e}return r}var E5=`vue-flow__node-desc`,D5=`vue-flow__edge-desc`,Coe=`vue-flow__aria-live`,O5=[`Enter`,` `,`Escape`],k5={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function A5(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function j5(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 M5(e){return{width:e.offsetWidth,height:e.offsetHeight}}function N5(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function P5(e,t){return{x:N5(e.x,t[0][0],t[1][0]),y:N5(e.y,t[0][1],t[1][1])}}function F5(e){let t=e.getRootNode();return`elementFromPoint`in t?t:window.document}function I5(e){return e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e}function L5(e){return e&&typeof e==`object`&&`id`in e&&`position`in e&&!I5(e)}function R5(e){return L5(e)&&`computedPosition`in e}function z5(e){return!Number.isNaN(e)&&Number.isFinite(e)}function woe(e){return z5(e.width)&&z5(e.height)&&z5(e.x)&&z5(e.y)}function Toe(e,t,n){let r={id:e.id.toString(),type:e.type??`default`,dimensions:He({width:0,height:0}),computedPosition:He({z:0,...e.position}),handleBounds:{source:[],target:[]},draggable:void 0,selectable:void 0,connectable:void 0,focusable:void 0,selected:!1,dragging:!1,resizing:!1,initialized:!1,isParent:!1,position:{x:0,y:0},data:N7(e.data)?e.data:{},events:He(N7(e.events)?e.events:{})};return Object.assign(t??r,e,{id:e.id.toString(),parentNode:n})}function B5(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:N7(e.data)?e.data:{},events:He(N7(e.events)?e.events:{}),label:e.label??``,interactionWidth:e.interactionWidth??n?.interactionWidth,...n??{}};return Object.assign(t??r,e,{id:e.id.toString()})}function V5(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 Eoe(...e){if(e.length===3){let[t,n,r]=e;return V5(t,n,r,`target`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>I5(e)&&e.source===r).map(e=>n.find(t=>L5(t)&&t.id===e.target))}function Doe(...e){if(e.length===3){let[t,n,r]=e;return V5(t,n,r,`source`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>I5(e)&&e.target===r).map(e=>n.find(t=>L5(t)&&t.id===e.source))}function H5({source:e,sourceHandle:t,target:n,targetHandle:r}){return`vueflow__edge-${e}${t??``}-${n}${r??``}`}function Ooe(e,t){return t.some(t=>I5(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 U5({x:e,y:t},{x:n,y:r,zoom:i}){return{x:e*i+n,y:t*i+r}}function W5({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?C7(s,o):s}function koe(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 G5({x:e,y:t,width:n,height:r}){return{x:e,y:t,x2:e+n,y2:t+r}}function Aoe({x:e,y:t,x2:n,y2:r}){return{x:e,y:t,width:n-e,height:r-t}}function K5(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=koe(t,G5({...r.computedPosition,...r.dimensions}))}return Aoe(t)}function q5(e,t,n={x:0,y:0,zoom:1},r=!1,i=!1){let a={...W5(t,n),width:t.width/n.zoom,height:t.height/n.zoom},o=[];for(let t of e){let{dimensions:e,selectabl Line truncated
`).map(e=>e.trim().toLowerCase());if(i.length===1)return e.toLowerCase()===t.toLowerCase();r||n.add(e.toLowerCase());let a=i.every((e,t)=>n.has(e)&&Array.from(n.values())[t]===i[t]);return r&&n.delete(e.toLowerCase()),a}function vve(e,t){return n=>{if(!n.code&&!n.key)return!1;let r=yve(n.code,e);return Array.isArray(e)?e.some(e=>w5(n[r],e,t,n.type===`keyup`)):w5(n[r],e,t,n.type===`keyup`)}}function yve(e,t){return t.includes(e)?`code`:`key`}function T5(e,t){let n=G(()=>le(t?.target)??gve),r=we(le(e)===!0),i=!1,a=new Set,o=c(le(e));p(()=>le(e),(e,t)=>{typeof t==`boolean`&&typeof e!=`boolean`&&s(),o=c(e)},{immediate:!0}),o6([`blur`,`contextmenu`],s),s6((...e)=>o(...e),e=>{let n=le(t?.actInsideInputWithModifier)??!0,a=le(t?.preventDefault)??!1;if(i=_ve(e),(!i||i&&!n)&&C5(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}),s6((...e)=>o(...e),e=>{let n=le(t?.actInsideInputWithModifier)??!0;if(r.value){if((!i||i&&!n)&&C5(e))return;i=!1,r.value=!1}},{eventName:`keyup`,target:n});function s(){i=!1,a.clear(),r.value=le(e)===!0}function c(e){return e===null?(s(),()=>!1):typeof e==`boolean`?(s(),r.value=e,()=>!1):Array.isArray(e)||typeof e==`string`?vve(e,a):e}return r}var E5=`vue-flow__node-desc`,D5=`vue-flow__edge-desc`,bve=`vue-flow__aria-live`,O5=[`Enter`,` `,`Escape`],k5={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function A5(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function j5(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 M5(e){return{width:e.offsetWidth,height:e.offsetHeight}}function N5(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function P5(e,t){return{x:N5(e.x,t[0][0],t[1][0]),y:N5(e.y,t[0][1],t[1][1])}}function F5(e){let t=e.getRootNode();return`elementFromPoint`in t?t:window.document}function I5(e){return e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e}function L5(e){return e&&typeof e==`object`&&`id`in e&&`position`in e&&!I5(e)}function R5(e){return L5(e)&&`computedPosition`in e}function z5(e){return!Number.isNaN(e)&&Number.isFinite(e)}function xve(e){return z5(e.width)&&z5(e.height)&&z5(e.x)&&z5(e.y)}function Sve(e,t,n){let r={id:e.id.toString(),type:e.type??`default`,dimensions:oe({width:0,height:0}),computedPosition:oe({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:N7(e.data)?e.data:{},events:oe(N7(e.events)?e.events:{})};return Object.assign(t??r,e,{id:e.id.toString(),parentNode:n})}function B5(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:N7(e.data)?e.data:{},events:oe(N7(e.events)?e.events:{}),label:e.label??``,interactionWidth:e.interactionWidth??n?.interactionWidth,...n??{}};return Object.assign(t??r,e,{id:e.id.toString()})}function V5(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 Cve(...e){if(e.length===3){let[t,n,r]=e;return V5(t,n,r,`target`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>I5(e)&&e.source===r).map(e=>n.find(t=>L5(t)&&t.id===e.target))}function wve(...e){if(e.length===3){let[t,n,r]=e;return V5(t,n,r,`source`)}let[t,n]=e,r=typeof t==`string`?t:t.id;return n.filter(e=>I5(e)&&e.target===r).map(e=>n.find(t=>L5(t)&&t.id===e.source))}function H5({source:e,sourceHandle:t,target:n,targetHandle:r}){return`vueflow__edge-${e}${t??``}-${n}${r??``}`}function Tve(e,t){return t.some(t=>I5(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 U5({x:e,y:t},{x:n,y:r,zoom:i}){return{x:e*i+n,y:t*i+r}}function W5({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?C7(s,o):s}function Eve(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 G5({x:e,y:t,width:n,height:r}){return{x:e,y:t,x2:e+n,y2:t+r}}function Dve({x:e,y:t,x2:n,y2:r}){return{x:e,y:t,width:n-e,height:r-t}}function K5(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=Eve(t,G5({...r.computedPosition,...r.dimensions}))}return Dve(t)}function q5(e,t,n={x:0,y:0,zoom:1},r=!1,i=!1){let a={...W5(t,n),width:t.width/n.zoom,height:t.height/n.zoom},o=[];for(let t of e){let{dimensions:e,selectabl Line truncated
Node: ${e}`,NODE_NOT_FOUND:e=>`Node not found
Node: ${e}`,NODE_MISSING_PARENT:(e,t)=>`Node is missing a parent
Node: ${e}
@@ -319,7 +577,7 @@ Edge: ${e}
Source: ${t}
Target: ${n}`,EDGE_ORPHANED:e=>`Edge was orphaned (suddenly missing source or target) and has been removed
Edge: ${e}`,EDGE_NOT_FOUND:e=>`Edge not found
Edge: ${e}`,USEVUEFLOW_OPTIONS:()=>`The options parameter is deprecated and will be removed in the next major version. Please use the id parameter instead`},y7=class extends Error{constructor(e,...t){super(v7[e]?.call(v7,...t)),this.name=`VueFlowError`,this.code=e,this.args=t}};function b7(e){return`clientX`in e}function Boe(e){return`sourceEvent`in e}function x7(e,t){let n=b7(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 S7=()=>typeof navigator<`u`&&(navigator==null?void 0:navigator.userAgent)?.indexOf(`Mac`)>=0;function Voe(e){return{width:e.dimensions?.width??e.width??0,height:e.dimensions?.height??e.height??0}}function C7(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}var Hoe=()=>!0;function w7(e){e?.classList.remove(`valid`,`connecting`,`vue-flow__handle-valid`,`vue-flow__handle-connecting`)}function Uoe(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())j5(i,A5(e))>0&&r.push(e);return r}var Woe=250;function Goe(e,t,n,r){let i=[],a=1/0,o=Uoe(e,n,t+Woe);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}=h7(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 T7(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=Hoe},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:_}=x7(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=E7(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===b5.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=D7(t,e,a,p,n,!0)}return b}function E7(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function Koe(e,t){let n=null;return t?n=`valid`:e&&!t&&(n=`invalid`),n}function qoe(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}function D7(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===b5.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,...h7(o,c,c.position,!0)}:c}var O7={[_5.Left]:_5.Right,[_5.Right]:_5.Left,[_5.Top]:_5.Bottom,[_5.Bottom]:_5.Top},Joe=[`production`,`prod`];function k7(e,...t){A7()&&console.warn(`[Vue Flow]: ${e}`,...t)}function A7(){return!Joe.includes(`production`)}function j7(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,...M5(t)}}):null}function M7(e,t,n,r,i,a=!1,o){i.value=!1,e.selected?(a||e.selected&&t)&&(r([e]),We(()=>{o.blur()})):n([e])}function N7(e){return V(e)!==void 0}function Yoe(e,t,n,r){if(!e||!e.source||!e.target)return n(new y7(_7.EDGE_INVALID,e?.id??`[ID UNKNOWN]`)),!1;let i;return i=I5(e)?e:{...e,id:H5(e)},i=B5(i,void 0,r),!Ooe(i,t)&&i}function Xoe(e,t,n,r,i){if(!t.source||!t.target)return i(new y7(_7.EDGE_INVALID,e.id)),!1;if(!n)return i(new y7(_7.EDGE_NOT_FOUND,e.id)),!1;let{id:a,...o}=e;return{...o,id:r?H5(t):a,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function P7(e,t,n){let r={},i=[];for(let a=0;a<e.length;++a){let o=e[a];if(!L5(o)){n(new y7(_7.NODE_INVALID,o?.id));continue}let s=Toe(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 y7(_7.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 F7(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 I7(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}`;F7(`sourcLine truncated
`)},B(e.data.summary||e.data.detail),9,Rce)):F(``,!0),e.data.when||e.data.retry||e.data.continues?(L(),j(`div`,zce,[e.data.when?(L(),j(`span`,{key:0,class:`flex max-w-full min-w-0 items-center gap-0.5 rounded bg-secondary px-1 font-mono`,title:`Runs only when ${e.data.when}`},[A(V(hu),{class:`size-3 shrink-0`,"aria-hidden":`true`}),R(`span`,Vce,B(e.data.when),1)],8,Bce)):F(``,!0),e.data.retry?(L(),j(`span`,{key:1,class:`flex items-center gap-0.5 rounded bg-secondary px-1`,title:`Up to ${e.data.retry} attempts`},[A(V(ute),{class:`size-3`,"aria-hidden":`true`}),H(`×`+B(e.data.retry),1)],8,Hce)):F(``,!0),e.data.continues?(L(),j(`span`,Uce,[A(V(_te),{class:`size-3`,"aria-hidden":`true`}),r[10]||=H(`continues`,-1)])):F(``,!0)])):F(``,!0),e.data.run?.error?(L(),j(`p`,{key:4,class:`mt-1 line-clamp-2 text-caption text-danger`,title:e.data.run.error},B(e.data.run.error),9,Wce)):F(``,!0)],64))]),A(ut,{"enter-from-class":`opacity-0 -translate-y-1`,"enter-active-class":`transition duration-200`,"leave-to-class":`opacity-0`,"leave-active-class":`transition duration-100`},{default:I(()=>[e.data.expanded?(L(),j(`div`,{key:0,class:`nodrag nopan nowheel cursor-auto border-t border-border`,onClick:r[6]||=pt(()=>{},[`stop`])},[K(t.$slots,`default`)])):F(``,!0)]),_:3}),A(V(Q7),{type:`source`,position:V(_5).Bottom},null,8,[`position`]),A(V(Q7),{id:`data-out`,type:`source`,position:V(_5).Right,class:`!opacity-0`},null,8,[`position`]),e.data.type===`switch`?(L(),q(V(Q7),{key:1,id:`otherwise`,type:`source`,position:V(_5).Right,class:`!opacity-0`},null,8,[`position`])):F(``,!0)],2))}}),Kce={class:`pointer-events-none size-full rounded-xl border border-dashed border-border bg-muted/30`},qce={class:`flex items-center gap-1 px-2.5 pt-1.5 text-caption text-fg-subtle`},Jce={key:0},Yce={key:1,class:`font-mono`},Xce=P({__name:`LaneNode`,props:{data:{}},setup(e){return(t,n)=>(L(),j(`div`,Kce,[R(`div`,qce,[e.data.lane===`switch`?(L(),j(U,{key:0},[A(V(Au),{class:`size-3`,"aria-hidden":`true`}),e.data.title==="default"?(L(),j(`span`,Jce,`otherwise`)):(L(),j(`span`,Yce,`= `+B(e.data.title),1))],64)):(L(),j(U,{key:1},[A(V(_u),{class:`size-3`,"aria-hidden":`true`}),H(B(e.data.title),1)],64))])]))}}),Zce={class:`flex shrink-0 items-center justify-center gap-1 border-t border-border bg-card p-1`},S9=240,Qce=416,C9=-140,$ce=72,ele=.9,w9=P({__name:`WorkflowCanvas`,props:{yaml:{},stages:{},open:{},triggers:{},types:{},readonly:{type:Boolean},restartable:{type:Boolean},marks:{},problems:{},title:{},summary:{}},emits:[`toggle`,`insert`,`duplicate`,`move`,`remove`,`rename`,`restart`],setup(e,{emit:t}){let n=e,r=t,i=Y(()=>!!n.types?.length&&!n.readonly),a=Y(()=>[...n.types??[],`parallel`,`switch`]),o=Y(()=>a.value.filter(e=>[`agent.run`,`workflow.call`].includes(e))),s=e=>e&&r1(e)?o.value:a.value,c=e=>e.kind===`step`?JSON.stringify(e.path??null):e.kind,l=J(null),u=J(null),d=Et(`(max-width: 767px)`),f=Y(()=>{let e=S1(N1(n.yaml),n.stages??[]);return n.types?.length?{nodes:[{id:`workflow`,type:`step`,position:{x:0,y:C9},data:{kind:`workflow`,key:`workflow`,title:n.title||`Workflow`,type:``,detail:n.summary??``}},...e.nodes],edges:[{id:`flow-workflow-start`,source:`workflow`,target:`start`,kind:`flow`},...e.edges]}:e}),p=Y(()=>f.value.nodes.filter(e=>e.data.path?.length===2).length),m=J({}),h=J({}),g=Y(()=>f.value.nodes.find(e=>e.type===`step`&&c(e.data)===n.open));function _(e,t){m.value={...m.value,[e]:t},g.value?.id!==e&&(h.value={...h.value,[e]:t})}let v=Y(()=>{let e=d.value?void 0:g.value?.id;return e&&m.value[e]?Math.max(0,m.value[e]-(h.value[e]??m.value[e])):0}),y=Mt(),b=wt(v,{duration:Y(()=>y.value===`reduce`?0:200)}),x=Y(()=>{let e=new Map;for(let t of f.value.nodes){if(t.type!==`step`)continue;let n=(t.id===g.value?.id?h.value[t.id]:void 0)??m.value[t.id];n!==void 0&&e.set(t.position.y,Math.max(e.get(t.position.y)??-72,n-$ce))}return[...e]}),S=e=>x.value.reduce((t,[n,r])=>n<e?t+r:t,0);function C(e){let t=e.data,a=c(t),o=t.path,s={triggers:t.kind===`start`?n.triggers??[]:t.triggers,expanded:!d.value&&a===n.open,editable:i.value,problem:o?n.problems?.[a]:void 0,onResize:t=>_(e.id,t)};return n.types?.length&&(s.onToggle=()=>r(`toggle`,a)),i.value&&o&&(s.onRename=e=>r(`rename`,o,e),s.onDuplicate=()=>r(`duplicate`,o),s.onRemove=()=>r(`remove`,o)),{...e,data:{...t,...s}}}let w=e=>{let t=g.value;return d.value||!t||!e.style?.width?!1:e.position.x<=t.position.x&&e.position.x+parseFloat(String(e.style.width))>=t.position.x+S9};function T(e){let t=g.value;if(d.value||!t)return 0;if(e.id===t.id||w(e))return-88;let n=t.position.x+S9/2,r=e.style?.width?parseFloat(String(e.style.width)):e.type===`step`?S9:32,i=e.position.x+r/2;return Math.abs(i-n)<S9/2?0:i<n?-88:88}let ee=Y(()=>{let e=g.value;return f.value.nodes.map(t=>{let a=t;t.type===`add`?t={...t,data:{...t.data,types:s(t.data.insertAfter),editable:i.value,onInsert:e=>r(`insert`,t.data.insertAfter,e)}}:t.type===`step`&&(t=C(t));let o=n.marks?.[t.id];o&&(t={...t,data:{...t.data,mark:o}});let c=t.position.x 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`},y7=class extends Error{constructor(e,...t){super(v7[e]?.call(v7,...t)),this.name=`VueFlowError`,this.code=e,this.args=t}};function b7(e){return`clientX`in e}function Lve(e){return`sourceEvent`in e}function x7(e,t){let n=b7(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 S7=()=>typeof navigator<`u`&&(navigator==null?void 0:navigator.userAgent)?.indexOf(`Mac`)>=0;function Rve(e){return{width:e.dimensions?.width??e.width??0,height:e.dimensions?.height??e.height??0}}function C7(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}var zve=()=>!0;function w7(e){e?.classList.remove(`valid`,`connecting`,`vue-flow__handle-valid`,`vue-flow__handle-connecting`)}function Bve(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())j5(i,A5(e))>0&&r.push(e);return r}var Vve=250;function Hve(e,t,n,r){let i=[],a=1/0,o=Bve(e,n,t+Vve);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}=h7(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 T7(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=zve},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:_}=x7(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=E7(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===b5.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=D7(t,e,a,p,n,!0)}return b}function E7(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function Uve(e,t){let n=null;return t?n=`valid`:e&&!t&&(n=`invalid`),n}function Wve(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}function D7(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===b5.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,...h7(o,c,c.position,!0)}:c}var O7={[_5.Left]:_5.Right,[_5.Right]:_5.Left,[_5.Top]:_5.Bottom,[_5.Bottom]:_5.Top},Gve=[`production`,`prod`];function k7(e,...t){A7()&&console.warn(`[Vue Flow]: ${e}`,...t)}function A7(){return!Gve.includes(`production`)}function j7(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,...M5(t)}}):null}function M7(e,t,n,r,i,a=!1,o){i.value=!1,e.selected?(a||e.selected&&t)&&(r([e]),ce(()=>{o.blur()})):n([e])}function N7(e){return L(e)!==void 0}function Kve(e,t,n,r){if(!e||!e.source||!e.target)return n(new y7(_7.EDGE_INVALID,e?.id??`[ID UNKNOWN]`)),!1;let i;return i=I5(e)?e:{...e,id:H5(e)},i=B5(i,void 0,r),!Tve(i,t)&&i}function qve(e,t,n,r,i){if(!t.source||!t.target)return i(new y7(_7.EDGE_INVALID,e.id)),!1;if(!n)return i(new y7(_7.EDGE_NOT_FOUND,e.id)),!1;let{id:a,...o}=e;return{...o,id:r?H5(t):a,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function P7(e,t,n){let r={},i=[];for(let a=0;a<e.length;++a){let o=e[a];if(!L5(o)){n(new y7(_7.NODE_INVALID,o?.id));continue}let s=Sve(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 y7(_7.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 F7(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 I7(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}`;F7(`sourcLine truncated
`)},I(e.data.summary||e.data.detail),9,Fbe)):T(``,!0),e.data.when||e.data.retry||e.data.continues?(j(),o(`div`,Ibe,[e.data.when?(j(),o(`span`,{key:0,class:`flex max-w-full min-w-0 items-center gap-0.5 rounded bg-secondary px-1 font-mono`,title:`Runs only when ${e.data.when}`},[r(L(Zc),{class:`size-3 shrink-0`,"aria-hidden":`true`}),N(`span`,Rbe,I(e.data.when),1)],8,Lbe)):T(``,!0),e.data.retry?(j(),o(`span`,{key:1,class:`flex items-center gap-0.5 rounded bg-secondary px-1`,title:`Up to ${e.data.retry} attempts`},[r(L(yl),{class:`size-3`,"aria-hidden":`true`}),R(`×`+I(e.data.retry),1)],8,zbe)):T(``,!0),e.data.continues?(j(),o(`span`,Bbe,[r(L(kl),{class:`size-3`,"aria-hidden":`true`}),i[10]||=R(`continues`,-1)])):T(``,!0)])):T(``,!0),e.data.run?.error?(j(),o(`p`,{key:4,class:`mt-1 line-clamp-2 text-caption text-danger`,title:e.data.run.error},I(e.data.run.error),9,Vbe)):T(``,!0)],64))]),r(ke,{"enter-from-class":`opacity-0 -translate-y-1`,"enter-active-class":`transition duration-200`,"leave-to-class":`opacity-0`,"leave-active-class":`transition duration-100`},{default:A(()=>[e.data.expanded?(j(),o(`div`,{key:0,class:`nodrag nopan nowheel cursor-auto border-t border-border`,onClick:i[6]||=Me(()=>{},[`stop`])},[H(t.$slots,`default`)])):T(``,!0)]),_:3}),r(L(Q7),{type:`source`,position:L(_5).Bottom},null,8,[`position`]),r(L(Q7),{id:`data-out`,type:`source`,position:L(_5).Right,class:`!opacity-0`},null,8,[`position`]),e.data.type===`switch`?(j(),U(L(Q7),{key:1,id:`otherwise`,type:`source`,position:L(_5).Right,class:`!opacity-0`},null,8,[`position`])):T(``,!0)],2))}}),Ube={class:`pointer-events-none size-full rounded-xl border border-dashed border-border bg-muted/30`},Wbe={class:`flex items-center gap-1 px-2.5 pt-1.5 text-caption text-fg-subtle`},Gbe={key:0},Kbe={key:1,class:`font-mono`},qbe=y({__name:`LaneNode`,props:{data:{}},setup(e){return(t,n)=>(j(),o(`div`,Ube,[N(`div`,Wbe,[e.data.lane===`switch`?(j(),o(z,{key:0},[r(L(Al),{class:`size-3`,"aria-hidden":`true`}),e.data.title==="default"?(j(),o(`span`,Gbe,`otherwise`)):(j(),o(`span`,Kbe,`= `+I(e.data.title),1))],64)):(j(),o(z,{key:1},[r(L($c),{class:`size-3`,"aria-hidden":`true`}),R(I(e.data.title),1)],64))])]))}}),Jbe={class:`flex shrink-0 items-center justify-center gap-1 border-t border-border bg-card p-1`},S9=240,Ybe=416,C9=-140,Xbe=72,Zbe=.9,w9=y({__name:`WorkflowCanvas`,props:{yaml:{},stages:{},open:{},triggers:{},types:{},readonly:{type:Boolean},restartable:{type:Boolean},marks:{},problems:{},title:{},summary:{}},emits:[`toggle`,`insert`,`duplicate`,`move`,`remove`,`rename`,`restart`],setup(e,{emit:t}){let n=e,i=t,a=G(()=>!!n.types?.length&&!n.readonly),s=G(()=>[...n.types??[],`parallel`,`switch`]),c=G(()=>s.value.filter(e=>[`agent.run`,`workflow.call`].includes(e))),l=e=>e&&x3(e)?c.value:s.value,u=e=>e.kind===`step`?JSON.stringify(e.path??null):e.kind,d=W(null),f=W(null),h=Ft(`(max-width: 767px)`),g=G(()=>{let e=k3(P3(n.yaml),n.stages??[]);return n.types?.length?{nodes:[{id:`workflow`,type:`step`,position:{x:0,y:C9},data:{kind:`workflow`,key:`workflow`,title:n.title||`Workflow`,type:``,detail:n.summary??``}},...e.nodes],edges:[{id:`flow-workflow-start`,source:`workflow`,target:`start`,kind:`flow`},...e.edges]}:e}),_=G(()=>g.value.nodes.filter(e=>e.data.path?.length===2).length),v=W({}),y=W({}),b=G(()=>g.value.nodes.find(e=>e.type===`step`&&u(e.data)===n.open));function x(e,t){v.value={...v.value,[e]:t},b.value?.id!==e&&(y.value={...y.value,[e]:t})}let S=G(()=>{let e=h.value?void 0:b.value?.id;return e&&v.value[e]?Math.max(0,v.value[e]-(y.value[e]??v.value[e])):0}),C=oee(),w=Nt(S,{duration:G(()=>C.value===`reduce`?0:200)}),E=G(()=>{let e=new Map;for(let t of g.value.nodes){if(t.type!==`step`)continue;let n=(t.id===b.value?.id?y.value[t.id]:void 0)??v.value[t.id];n!==void 0&&e.set(t.position.y,Math.max(e.get(t.position.y)??-72,n-Xbe))}return[...e]}),D=e=>E.value.reduce((t,[n,r])=>n<e?t+r:t,0);function O(e){let t=e.data,r=u(t),o=t.path,s={triggers:t.kind===`start`?n.triggers??[]:t.triggers,expanded:!h.value&&r===n.open,editable:a.value,problem:o?n.problems?.[r]:void 0,onResize:t=>x(e.id,t)};return n.types?.length&&(s.onToggle=()=>i(`toggle`,r)),a.value&&o&&(s.onRename=e=>i(`rename`,o,e),s.onDuplicate=()=>i(`duplicate`,o),s.onRemove=()=>i(`remove`,o)),{...e,data:{...t,...s}}}let k=e=>{let t=b.value;return h.value||!t||!e.style?.width?!1:e.position.x<=t.position.x&&e.position.x+parseFloat(String(e.style.width))>=t.position.x+S9};function ee(e){let t=b.value;if(h.value||!t)return 0;if(e.id===t.id||k(e))return-88;let n=t.position.x+S9/2,r=e.style?.width?parseFloat(String(e.style.width)):e.type===`step`?S9:32,i=e.position.x+r/2;return Math.abs(i-n)<S9/2?0:i<n?-88:88}let te=G(()=>{let e=b.value;return g.value.nodes.map(t=>{let r=t;t.type===`add`?t={...t,data:{...t.data,types:l(t.data.insertAfter),editable:a.value,onInsert:e=>i(`insert`,t.data.insertAfter,e)}}:t.type===`step`&&(t=O(t));let o=n.marks?.[t.id];o&&(t={...t,data:{...t.data,mark:o}});let s=t.position.x Line truncated
`),r=t.split(`
`),i=Array.from({length:n.length+1},()=>Array(r.length+1).fill(0));for(let e=n.length-1;e>=0;e--)for(let t=r.length-1;t>=0;t--)i[e][t]=n[e]===r[t]?i[e+1][t+1]+1:Math.max(i[e+1][t],i[e][t+1]);let a=[],o=0,s=0;for(;o<n.length&&s<r.length;)n[o]===r[s]?(a.push({kind:`same`,text:n[o++]}),s++):i[o+1][s]>=i[o][s+1]?a.push({kind:`del`,text:n[o++]}):a.push({kind:`add`,text:r[s++]});for(;o<n.length;)a.push({kind:`del`,text:n[o++]});for(;s<r.length;)a.push({kind:`add`,text:r[s++]});return a}function T9(e){let t=Z$(e).toJS(),n=new Map;for(let r of N1(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 E9(e,t,n){let r=T9(e),i=T9(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 ale={class:`flex flex-col gap-3 md:grid md:h-[calc(100dvh-17rem)] md:min-h-[26rem] md:grid-cols-[18rem_1fr]`},ole=[`aria-current`,`onClick`],sle={class:`flex items-center gap-2 text-sm`},cle={class:`font-mono text-xs text-fg-subtle`},lle=[`title`],ule={key:0,class:`px-3 py-2 text-sm text-fg-muted`},dle={key:1,class:`flex min-h-0 flex-col gap-2`},fle={class:`flex items-center gap-2 max-md:flex-wrap`},ple={key:0,class:`rounded-lg border border-border p-4 text-sm text-fg-muted`},mle={key:1,class:`min-h-0 flex-1 overflow-auto rounded-lg border border-border pt-2 pb-[calc(0.5rem+var(--code-overscroll))] font-mono text-label leading-6`},hle={class:`inline-block w-4 select-none text-fg-subtle`},gle={key:2,class:`grid min-h-0 flex-1 gap-3 max-md:flex-none md:grid-cols-2`},_le={class:`flex min-h-0 flex-col gap-1`},vle={class:`text-caption font-medium uppercase text-fg-muted`},yle={class:`min-h-0 flex-1 max-md:h-72 max-md:flex-none`},ble={class:`flex min-h-0 flex-col gap-1`},xle={class:`min-h-0 flex-1 max-md:h-72 max-md:flex-none`},Sle=P({__name:`WorkflowHistory`,props:Ye({revisions:{},current:{},error:{}},{selected:{default:0},selectedModifiers:{},mode:{default:`yaml`},modeModifiers:{}}),emits:Ye([`restore`],[`update:selected`,`update:mode`]),setup(e,{emit:t}){let n=e,r=t,i=ke(e,`selected`),a=ke(e,`mode`);N(()=>n.revisions,e=>{e.some(e=>e.version===i.value)||(i.value=(e.find(e=>e.yaml!==n.current)??e[0])?.version??0)},{immediate:!0});let o=Y(()=>n.revisions.find(e=>e.version===i.value)),s=Y(()=>o.value?.yaml??null),c=Y(()=>s.value===null?[]:ile(s.value,n.current)),l=Y(()=>s.value!==null&&s.value===n.current),u=Y(()=>s.value===null?{}:E9(s.value,n.current,`removed`)),d=Y(()=>s.value===null?{}:E9(n.current,s.value,`added`)),f={added:`default`,edited:`secondary`,removed:`destructive`};return(t,n)=>(L(),j(`div`,ale,[R(`ol`,{class:z(V(W)(`min-h-0 divide-y divide-border overflow-y-auto rounded-lg border border-border`,e.revisions.length&&`max-md:hidden`)),"aria-label":`Revisions`},[(L(!0),j(U,null,M(e.revisions,e=>(L(),j(`li`,{key:e.version},[R(`button`,{type:`button`,class:z([`block w-full px-3 py-2 text-left hover:bg-secondary`,e.version===i.value&&`bg-secondary`]),"aria-current":e.version===i.value,onClick:t=>i.value=e.version},[R(`span`,sle,[R(`span`,cle,`v`+B(e.version),1),A(V(k),{variant:f[e.change]},{default:I(()=>[H(B(e.change),1)]),_:2},1032,[`variant`])]),R(`span`,{class:`mt-0.5 block truncate text-xs text-fg-muted`,title:e.at},[H(B(e.actor||`unknown`)+` · `+B(e.source||`unknown`)+` · `,1),A(V(dw),{at:e.at},null,8,[`at`])],8,lle)],10,ole)]))),128)),e.revisions.length?F(``,!0):(L(),j(`li`,ule,B(e.error||`No recorded changes`),1))],2),e.revisions.length?(L(),q(V(Vu),{key:0,"model-value":String(i.value),"onUpdate:modelValue":n[0]||=e=>i.value=Number(e)},{default:I(()=>[A(V(Gu),{class:`w-full md:hidden`,"aria-label":`Revision`},{default:I(()=>[A(V(Ku))]),_:1}),A(V(Hu),null,{default:I(()=>[(L(!0),j(U,null,M(e.revisions,e=>(L(),q(V(Wu),{key:e.version,value:String(e.version)},{default:I(()=>[H(`v`+B(e.version)+` · `+B(e.change)+` · `+B(e.actor||`unknown`)+` · `+B(V(lw)(e.at)),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1},8,[`model-value`])):F(``,!0),o.value?(L(),j(`div`,dle,[R(`div`,fle,[A(V(FO),{modelValue:a.value,"onUpdate:modelValue":n[1]||=e=>a.value=e},{default:I(()=>[A(V(LO),null,{default:I(()=>[A(V(RO),{value:`yaml`},{default:I(()=>[...n[3]||=[H(`YAML`,-1)]]),_:1}),A(V(RO),{value:`canvas`},{default:I(()=>[...n[4]||=[H(`Canvas`,-1)]]),_:1})]),_:1})]),_:1},8,[`modelValue`]),A(V(X),{type:`button`,size:`sm`,variant:`outline`,class:`ml-auto`,disabled:s.value===null||l.value,title:s.value===null?`Workflow removed`:void 0,onClick:n[2]||=e=>r(`restore`,s.value)},{default:I(()=>[A(V(Du),{"data-icon":`inline-start`}),n[5]||=H(` Restore this version`,-1)]),_:1},8,[`disabled`,`title`])]),s.value===null?(L(),j(`p`,ple,`Workflow removed in this revision.`)):a.value===`yaml`?(L(),j(`pre`,mle,[R(`code`,null,[(L(!0),j(U,null,M(c.value,(e,t)=>(L(),j(`span`,{key:t,class:z([`block min-h-6 px-3 whitespace-pre-wrap`,{"bg-o Line truncated
`),i=Array.from({length:n.length+1},()=>Array(r.length+1).fill(0));for(let e=n.length-1;e>=0;e--)for(let t=r.length-1;t>=0;t--)i[e][t]=n[e]===r[t]?i[e+1][t+1]+1:Math.max(i[e+1][t],i[e][t+1]);let a=[],o=0,s=0;for(;o<n.length&&s<r.length;)n[o]===r[s]?(a.push({kind:`same`,text:n[o++]}),s++):i[o+1][s]>=i[o][s+1]?a.push({kind:`del`,text:n[o++]}):a.push({kind:`add`,text:r[s++]});for(;o<n.length;)a.push({kind:`del`,text:n[o++]});for(;s<r.length;)a.push({kind:`add`,text:r[s++]});return a}function T9(e){let t=g3(e).toJS(),n=new Map;for(let r of P3(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 E9(e,t,n){let r=T9(e),i=T9(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 nxe={class:`flex flex-col gap-3 md:grid md:h-[calc(100dvh-17rem)] md:min-h-[26rem] md:grid-cols-[18rem_1fr]`},rxe=[`aria-current`,`onClick`],ixe={class:`flex items-center gap-2 text-sm`},axe={class:`font-mono text-xs text-fg-subtle`},oxe=[`title`],sxe={key:0,class:`px-3 py-2 text-sm text-fg-muted`},cxe={key:1,class:`flex min-h-0 flex-col gap-2`},lxe={class:`flex items-center gap-2 max-md:flex-wrap`},uxe={key:0,class:`rounded-lg border border-border p-4 text-sm text-fg-muted`},dxe={key:1,class:`min-h-0 flex-1 overflow-auto rounded-lg border border-border pt-2 pb-[calc(0.5rem+var(--code-overscroll))] font-mono text-label leading-6`},fxe={class:`inline-block w-4 select-none text-fg-subtle`},pxe={key:2,class:`grid min-h-0 flex-1 gap-3 max-md:flex-none md:grid-cols-2`},mxe={class:`flex min-h-0 flex-col gap-1`},hxe={class:`text-caption font-medium uppercase text-fg-muted`},gxe={class:`min-h-0 flex-1 max-md:h-72 max-md:flex-none`},_xe={class:`flex min-h-0 flex-col gap-1`},vxe={class:`min-h-0 flex-1 max-md:h-72 max-md:flex-none`},yxe=y({__name:`WorkflowHistory`,props:pe({revisions:{},current:{},error:{}},{selected:{default:0},selectedModifiers:{},mode:{default:`yaml`},modeModifiers:{}}),emits:pe([`restore`],[`update:selected`,`update:mode`]),setup(e,{emit:t}){let n=e,i=t,a=w(e,`selected`),c=w(e,`mode`);p(()=>n.revisions,e=>{e.some(e=>e.version===a.value)||(a.value=(e.find(e=>e.yaml!==n.current)??e[0])?.version??0)},{immediate:!0});let l=G(()=>n.revisions.find(e=>e.version===a.value)),u=G(()=>l.value?.yaml??null),d=G(()=>u.value===null?[]:txe(u.value,n.current)),f=G(()=>u.value!==null&&u.value===n.current),m=G(()=>u.value===null?{}:E9(u.value,n.current,`removed`)),h=G(()=>u.value===null?{}:E9(n.current,u.value,`added`)),g={added:`default`,edited:`secondary`,removed:`destructive`};return(t,n)=>(j(),o(`div`,nxe,[N(`ol`,{class:F(L(B)(`min-h-0 divide-y divide-border overflow-y-auto rounded-lg border border-border`,e.revisions.length&&`max-md:hidden`)),"aria-label":`Revisions`},[(j(!0),o(z,null,s(e.revisions,e=>(j(),o(`li`,{key:e.version},[N(`button`,{type:`button`,class:F([`block w-full px-3 py-2 text-left hover:bg-secondary`,e.version===a.value&&`bg-secondary`]),"aria-current":e.version===a.value,onClick:t=>a.value=e.version},[N(`span`,ixe,[N(`span`,axe,`v`+I(e.version),1),r(L(Ct),{variant:g[e.change]},{default:A(()=>[R(I(e.change),1)]),_:2},1032,[`variant`])]),N(`span`,{class:`mt-0.5 block truncate text-xs text-fg-muted`,title:e.at},[R(I(e.actor||`unknown`)+` · `+I(e.source||`unknown`)+` · `,1),r(L(ux),{at:e.at},null,8,[`at`])],8,oxe)],10,rxe)]))),128)),e.revisions.length?T(``,!0):(j(),o(`li`,sxe,I(e.error||`No recorded changes`),1))],2),e.revisions.length?(j(),U(L(ql),{key:0,"model-value":String(a.value),"onUpdate:modelValue":n[0]||=e=>a.value=Number(e)},{default:A(()=>[r(L(tu),{class:`w-full md:hidden`,"aria-label":`Revision`},{default:A(()=>[r(L(nu))]),_:1}),r(L(Jl),null,{default:A(()=>[(j(!0),o(z,null,s(e.revisions,e=>(j(),U(L(Zl),{key:e.version,value:String(e.version)},{default:A(()=>[R(`v`+I(e.version)+` · `+I(e.change)+` · `+I(e.actor||`unknown`)+` · `+I(L(ox)(e.at)),1)]),_:2},1032,[`value`]))),128))]),_:1})]),_:1},8,[`model-value`])):T(``,!0),l.value?(j(),o(`div`,cxe,[N(`div`,lxe,[r(L(IT),{modelValue:c.value,"onUpdate:modelValue":n[1]||=e=>c.value=e},{default:A(()=>[r(L(RT),null,{default:A(()=>[r(L(zT),{value:`yaml`},{default:A(()=>[...n[3]||=[R(`YAML`,-1)]]),_:1}),r(L(zT),{value:`canvas`},{default:A(()=>[...n[4]||=[R(`Canvas`,-1)]]),_:1})]),_:1})]),_:1},8,[`modelValue`]),r(L(K),{type:`button`,size:`sm`,variant:`outline`,class:`ml-auto`,disabled:u.value===null||f.value,title:u.value===null?`Workflow removed`:void 0,onClick:n[2]||=e=>i(`restore`,u.value)},{default:A(()=>[r(L(xl),{"data-icon":`inline-start`}),n[5]||=R(` Restore this version`,-1)]),_:1},8,[`disabled`,`title`])]),u.value===null?(j(),o(`p`,uxe,`Workflow removed in this revision.`)):c.value===`yaml`?(j(),o(`pre`,dxe,[N(`code`,null,[(j(!0),o(z,null,s(d.value,(e,t)=>(j(),o(`span`,{key:t,class:F([`block min-h-6 px-3 whitespace-pre-wrap`,{"bg-ok Line truncated
+1
View File
@@ -0,0 +1 @@
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},s=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),c=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},l=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},u=(n,r,o)=>(o=n==null?{}:e(i(n)),l(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n)),d=e=>a.call(e,`module.exports`)?e[`module.exports`]:l(t({},`__esModule`,{value:!0}),e);export{u as a,d as i,o as n,c as r,s as t};
+1
View File
@@ -33,6 +33,7 @@
})();
</script>
<script type="module" crossorigin src="/assets/index.js"></script>
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime.js">
<link rel="modulepreload" crossorigin href="/assets/PageHeader.js">
<link rel="modulepreload" crossorigin href="/assets/createLucideIcon.js">
<link rel="modulepreload" crossorigin href="/assets/badge.js">
+60 -1
View File
@@ -11,6 +11,8 @@
"@fontsource-variable/ibm-plex-sans": "^5.3.0",
"@fontsource/ibm-plex-mono": "^5.3.0",
"@lucide/vue": "^1.48.0",
"@openuidev/lang-core": "^0.4.1",
"@openuidev/vue-lang": "^0.4.2",
"@tailwindcss/vite": "^4.3.3",
"@vue-flow/background": "^1.3.2",
"@vue-flow/controls": "^1.1.3",
@@ -28,7 +30,8 @@
"tw-animate-css": "^1.4.0",
"vue": "^3.5.42",
"vue-router": "^5.3.1",
"yaml": "^2.9.1"
"yaml": "^2.9.1",
"zod": "^4.6.7"
},
"devDependencies": {
"@types/node": "^26.6.4",
@@ -213,6 +216,38 @@
"vue": ">=3.0.1"
}
},
"node_modules/@openuidev/lang-core": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/@openuidev/lang-core/-/lang-core-0.4.1.tgz",
"integrity": "sha512-t9XSiORKTgyn6pWv8qqBkgD45PBhORdGWpQAHo3APvj9SYy7YprKURQgmXNu3z6E/Ds8tsLAI+AZjX3errH+jQ==",
"hasInstallScript": true,
"license": "MIT",
"dependencies": {
"ci-info": "^4.4.0"
},
"peerDependencies": {
"@modelcontextprotocol/sdk": ">=1.0.0",
"zod": "^3.25.0 || ^4.0.0"
},
"peerDependenciesMeta": {
"@modelcontextprotocol/sdk": {
"optional": true
}
}
},
"node_modules/@openuidev/vue-lang": {
"version": "0.4.2",
"resolved": "https://registry.npmjs.org/@openuidev/vue-lang/-/vue-lang-0.4.2.tgz",
"integrity": "sha512-jkBA09Y//tktcIW3I32ovtMqL/pp2pX5lgZhaOzmHAEi9t7jMSLkcZayUvE7S6pqyAIKYuRJ30Hb35d3MYMLOQ==",
"license": "MIT",
"dependencies": {
"@openuidev/lang-core": "^0.4.1"
},
"peerDependencies": {
"vue": ">=3.5.0",
"zod": "^3.25.0 || ^4.0.0"
}
},
"node_modules/@oxc-project/types": {
"version": "0.153.0",
"resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.153.0.tgz",
@@ -1570,6 +1605,21 @@
"url": "https://paulmillr.com/funding/"
}
},
"node_modules/ci-info": {
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/ci-info/-/ci-info-4.4.0.tgz",
"integrity": "sha512-77PSwercCZU2Fc4sX94eF8k8Pxte6JAwL4/ICZLFjJLqegs7kCuAsqqj/70NQF6TvDpgFjkubQB2FW2ZZddvQg==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/sibiraj-s"
}
],
"license": "MIT",
"engines": {
"node": ">=8"
}
},
"node_modules/class-variance-authority": {
"version": "0.7.1",
"resolved": "https://registry.npmjs.org/class-variance-authority/-/class-variance-authority-0.7.1.tgz",
@@ -3483,6 +3533,15 @@
"url": "https://github.com/sponsors/eemeli"
}
},
"node_modules/zod": {
"version": "4.6.7",
"resolved": "https://registry.npmjs.org/zod/-/zod-4.6.7.tgz",
"integrity": "sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg==",
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/colinhacks"
}
},
"node_modules/zwitch": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz",
+4 -1
View File
@@ -14,6 +14,8 @@
"@fontsource-variable/ibm-plex-sans": "^5.3.0",
"@fontsource/ibm-plex-mono": "^5.3.0",
"@lucide/vue": "^1.48.0",
"@openuidev/lang-core": "^0.4.1",
"@openuidev/vue-lang": "^0.4.2",
"@tailwindcss/vite": "^4.3.3",
"@vue-flow/background": "^1.3.2",
"@vue-flow/controls": "^1.1.3",
@@ -31,7 +33,8 @@
"tw-animate-css": "^1.4.0",
"vue": "^3.5.42",
"vue-router": "^5.3.1",
"yaml": "^2.9.1"
"yaml": "^2.9.1",
"zod": "^4.6.7"
},
"devDependencies": {
"@types/node": "^26.6.4",
+14
View File
@@ -0,0 +1,14 @@
// Writes the agent prompt for the dashboard's view components to the path
// given, from the same schemas the renderer uses.
import { writeFileSync } from "node:fs";
import { viewLibrary, viewPromptOptions } from "../src/genui/view-library.ts";
const out = process.argv[2];
if (!out) throw new Error("usage: genui-prompt.ts <output path>");
const r = null;
const library = viewLibrary({
Stack: r, Section: r, Columns: r, Heading: r, Text: r, Callout: r, Facts: r,
Fact: r, Files: r, File: r, Checklist: r, Table: r, Code: r,
});
writeFileSync(out, library.prompt(viewPromptOptions).trim() + "\n");
+42
View File
@@ -0,0 +1,42 @@
<script setup lang="ts">
import { computed, ref, watch } from "vue";
import { createParser, Renderer, type OpenUIError } from "@openuidev/vue-lang";
import ChatMarkdown from "@/chat/ChatMarkdown.vue";
import { viewLibrary } from "./library";
/**
* An agent's generated view, or its text when there is no view or the view
* does not hold up: a parse that drops components or leaves references
* dangling would show a partial answer as if it were whole.
*/
const props = defineProps<{ view?: string; text: string }>();
const parser = createParser(viewLibrary.toJSONSchema());
const failed = ref(false);
watch(
() => props.view,
() => (failed.value = false),
);
const usable = computed(() => {
const source = props.view?.trim();
if (!source || failed.value) return false;
const { root, meta } = parser.parse(source);
return !!root && meta.errors.length === 0 && meta.unresolved.length === 0;
});
function onError(errors: OpenUIError[]) {
if (errors.length > 0) failed.value = true;
}
</script>
<template>
<Renderer
v-if="usable"
:response="view ?? null"
:library="viewLibrary"
:on-error="onError"
/>
<ChatMarkdown v-else :text="text" />
</template>
+6
View File
@@ -0,0 +1,6 @@
import type { Library } from "@openuidev/vue-lang";
import { viewRenderers } from "./renderers";
import { viewLibrary as defineViewLibrary } from "./view-library";
export const viewLibrary = defineViewLibrary(viewRenderers) as Library;
+106
View File
@@ -0,0 +1,106 @@
import { defineComponent, h, type Component, type PropType } from "vue";
import type { ElementNode, RenderNodeResult } from "@openuidev/vue-lang";
import CodeView from "@/base/CodeView.vue";
import ChatMarkdown from "@/chat/ChatMarkdown.vue";
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
import { Badge } from "@/components/ui/badge";
import { MetadataList } from "@/components/ui/metadata-list";
import {
Table,
TableBody,
TableCell,
TableHead,
TableHeader,
TableRow,
} from "@/components/ui/table";
import type { ViewRenderers } from "./view-library";
type Props = Record<string, any>;
// Every renderer receives the parsed props and renderNode. Props may be
// partial while a view streams, so each reads them defensively.
function renderer(
name: string,
render: (p: Props, renderNode: (v: unknown) => RenderNodeResult) => ReturnType<typeof h>,
): Component {
return defineComponent({
name,
props: {
props: { type: Object as PropType<Props>, required: true },
renderNode: { type: Function as PropType<(v: unknown) => RenderNodeResult>, required: true },
},
setup: (p) => () => render(p.props, p.renderNode),
});
}
// A list item's own props, read by the parent that lays the list out.
function itemProps(items: unknown): Props[] {
return Array.isArray(items)
? items.filter((i): i is ElementNode => i?.type === "element").map((i) => i.props)
: [];
}
const strings = (v: unknown): string[] => (Array.isArray(v) ? v.map(String) : []);
const changeVariant = { added: "ok", modified: "info", deleted: "danger" } as const;
export const viewRenderers: ViewRenderers<Component> = {
Stack: renderer("ViewStack", (p, r) =>
h("div", { class: "flex min-w-0 flex-col gap-5" }, [r(p.children ?? [])]),
),
Section: renderer("ViewSection", (p, r) =>
h("section", { class: "flex min-w-0 flex-col gap-2" }, [
h("h3", { class: "text-title font-semibold" }, p.title),
r(p.children ?? []),
]),
),
Columns: renderer("ViewColumns", (p, r) =>
h("div", { class: "grid gap-5 sm:grid-cols-[repeat(auto-fit,minmax(14rem,1fr))]" }, [r(p.children ?? [])]),
),
Heading: renderer("ViewHeading", (p) => h("h4", { class: "text-label font-semibold" }, p.text)),
Text: renderer("ViewText", (p) =>
h("div", { class: "text-sm leading-relaxed" }, h(ChatMarkdown, { text: p.markdown ?? "" })),
),
Callout: renderer("ViewCallout", (p) =>
h(Alert, { variant: p.tone === "risk" ? "destructive" : p.tone === "warning" ? "warn" : "default" }, () => [
h(AlertTitle, () => p.title),
p.body ? h(AlertDescription, () => p.body) : null,
]),
),
Facts: renderer("ViewFacts", (p) =>
h(MetadataList, {
rows: itemProps(p.items).map((f) => ({ label: String(f.label ?? ""), value: String(f.value ?? "") })),
}),
),
Fact: renderer("ViewFact", (p) =>
h(MetadataList, { rows: [{ label: String(p.label ?? ""), value: String(p.value ?? "") }] }),
),
Files: renderer("ViewFiles", (p) =>
h("ul", { class: "flex flex-col gap-1.5 text-sm" }, itemProps(p.items).map((f) => fileRow(f))),
),
File: renderer("ViewFile", (p) => h("ul", { class: "text-sm" }, [fileRow(p)])),
Checklist: renderer("ViewChecklist", (p) =>
h("ul", { class: "list-disc space-y-1 pl-5 text-sm" }, strings(p.items).map((item) => h("li", item))),
),
Table: renderer("ViewTable", (p) =>
h(Table, () => [
h(TableHeader, () => h(TableRow, () => strings(p.columns).map((c) => h(TableHead, () => c)))),
h(TableBody, () =>
(Array.isArray(p.rows) ? p.rows : []).map((row: unknown) =>
h(TableRow, () => strings(row).map((cell) => h(TableCell, () => cell))),
),
),
]),
),
Code: renderer("ViewCode", (p) => h(CodeView, { code: p.code ?? "", lang: p.language })),
};
function fileRow(f: Props) {
const change = String(f.change ?? "") as keyof typeof changeVariant;
return h("li", { class: "flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5" }, [
h(Badge, { variant: changeVariant[change] ?? "idle" }, () => change),
h("code", { class: "font-mono text-xs [overflow-wrap:anywhere]" }, f.path),
f.note ? h("span", { class: "text-fg-muted" }, f.note) : null,
]);
}
+207
View File
@@ -0,0 +1,207 @@
import {
createLibrary,
defineComponent,
type Library,
type PromptOptions,
} from "@openuidev/lang-core";
import { z } from "zod/v4";
/**
* The components an agent may compose a view from. The schemas live here,
* apart from the Vue renderers, so the agent prompt (generated in Node) and the
* dashboard renderer are built from the same definitions.
*/
export interface ViewRenderers<C> {
Stack: C;
Section: C;
Columns: C;
Heading: C;
Text: C;
Callout: C;
Facts: C;
Fact: C;
Files: C;
File: C;
Checklist: C;
Table: C;
Code: C;
}
export function viewLibrary<C>(r: ViewRenderers<C>): Library<C> {
const Heading = defineComponent({
name: "Heading",
description: "A short title for what follows.",
props: z.object({ text: z.string() }),
component: r.Heading,
});
const Text = defineComponent({
name: "Text",
description:
"Prose in Markdown: paragraphs, lists, inline code, links. Use for explanation the other components cannot carry.",
props: z.object({ markdown: z.string() }),
component: r.Text,
});
const Callout = defineComponent({
name: "Callout",
description:
"One point the reader must not miss: a risk, an open question, a caveat or a confirmation.",
props: z.object({
tone: z.enum(["info", "warning", "risk", "success"]),
title: z.string(),
body: z.string().optional(),
}),
component: r.Callout,
});
const Fact = defineComponent({
name: "Fact",
description: "One label and its short value.",
props: z.object({ label: z.string(), value: z.string() }),
component: r.Fact,
});
const Facts = defineComponent({
name: "Facts",
description:
"Short label/value pairs read at a glance, e.g. estimated diff size, risk, scope.",
props: z.object({ items: z.array(Fact.ref) }),
component: r.Facts,
});
const File = defineComponent({
name: "File",
description: "One file and how the change touches it.",
props: z.object({
path: z.string(),
change: z.enum(["added", "modified", "deleted"]),
note: z.string().optional(),
}),
component: r.File,
});
const Files = defineComponent({
name: "Files",
description: "The files a change adds, modifies or deletes.",
props: z.object({ items: z.array(File.ref) }),
component: r.Files,
});
const Checklist = defineComponent({
name: "Checklist",
description: "Criteria or steps, each independently checkable.",
props: z.object({ items: z.array(z.string()) }),
component: r.Checklist,
});
const Table = defineComponent({
name: "Table",
description: "Rows that compare along the same columns.",
props: z.object({
columns: z.array(z.string()),
rows: z.array(z.array(z.string())),
}),
component: r.Table,
});
const Code = defineComponent({
name: "Code",
description: "A code excerpt or proposed signature.",
props: z.object({ code: z.string(), language: z.string().optional() }),
component: r.Code,
});
const block = z.union([
Heading.ref,
Text.ref,
Callout.ref,
Facts.ref,
Files.ref,
Checklist.ref,
Table.ref,
Code.ref,
]);
const Section = defineComponent({
name: "Section",
description: "A titled part of the view, e.g. Problem or Proposed solution.",
props: z.object({ title: z.string(), children: z.array(block) }),
component: r.Section,
});
const Columns = defineComponent({
name: "Columns",
description:
"Two or three sections side by side, for content read in contrast, e.g. goals and non-goals.",
props: z.object({ children: z.array(Section.ref) }),
component: r.Columns,
});
const Stack = defineComponent({
name: "Stack",
description: "The view: its parts from top to bottom.",
props: z.object({
children: z.array(z.union([Section.ref, Columns.ref, block])),
}),
component: r.Stack,
});
return createLibrary({
root: "Stack",
components: [
Stack,
Section,
Columns,
Heading,
Text,
Callout,
Facts,
Fact,
Files,
File,
Checklist,
Table,
Code,
],
componentGroups: [
{ name: "Layout", components: ["Stack", "Section", "Columns"] },
{
name: "Content",
components: [
"Heading",
"Text",
"Callout",
"Facts",
"Fact",
"Files",
"File",
"Checklist",
"Table",
"Code",
],
notes: [
"- Prefer Facts, Files, Checklist and Table to prose; use Text only for explanation.",
"- Define each Section and each list item as its own line so the view streams.",
],
},
],
});
}
export const viewPromptOptions: PromptOptions = {
preamble:
"Besides your text answer, return a view of it with the `view` tool: an OpenUI Lang program the dashboard renders for the human reading your work. It presents the same content as the text, laid out for a quick decision; it never says anything the text does not.",
additionalRules: [
"The view holds only OpenUI Lang: no Markdown fences, no commentary.",
"Lead with what the reader decides on; put supporting detail after it.",
],
examples: [
`root = Stack([facts, problem, solution, scope, risk])
facts = Facts([f1, f2])
f1 = Fact("Estimated diff", "~40 lines")
f2 = Fact("Risk", "Low")
problem = Section("Problem", [problemText])
problemText = Text("Callers compute percentages by hand; \`calc\` has no helper.")
solution = Section("Proposed solution", [solutionText, sig, files])
solutionText = Text("Add one exported function to \`calc/calc.go\`.")
sig = Code("func Percent(part, whole int) (int, error)", "go")
files = Files([file1, file2])
file1 = File("calc/calc.go", "modified", "adds Percent")
file2 = File("calc/calc_test.go", "modified")
scope = Columns([accept, nongoals])
accept = Section("Acceptance criteria", [acceptList])
acceptList = Checklist(["Percent(1, 4) returns 25", "A zero whole returns an error"])
nongoals = Section("Non-goals", [nongoalList])
nongoalList = Checklist(["Floating-point percentages"])
risk = Callout("info", "No existing callers change")`,
],
};
+2 -2
View File
@@ -4,7 +4,7 @@ import { ChevronDown } from "@lucide/vue";
import { Button } from "@/components/ui/button";
import { Section } from "@/components/ui/section";
import ChatMarkdown from "@/chat/ChatMarkdown.vue";
import GeneratedView from "@/genui/GeneratedView.vue";
import type { TaskRecord } from "./task-run";
import type { Task } from "./task";
import TaskRowActions from "./TaskRowActions.vue";
@@ -62,7 +62,7 @@ const long = computed(() => body.value.length > 1200);
long && !open && 'max-h-96',
]"
>
<ChatMarkdown :text="body" />
<GeneratedView :view="task.plan_view" :text="body" />
</div>
<div
v-if="long && !open"
+2
View File
@@ -57,6 +57,8 @@ export interface TaskRecord {
actions?: string[];
review_gate?: string;
plan?: string;
/** An OpenUI Lang view of the plan; the plan text stands in when it does not render. */
plan_view?: string;
/** What a task waiting for approval asks: "plan" or "review". */
approval?: string;
rereview_rounds?: number;