diff --git a/internal/agent/runtime.go b/internal/agent/runtime.go index 676ae1e4a..19fe324bc 100644 --- a/internal/agent/runtime.go +++ b/internal/agent/runtime.go @@ -25,7 +25,7 @@ import ( "github.com/labstack/fanout/internal/toolerror" ) -const systemPrompt = `You are Fanout's observability assistant. When a view is attached to your reply it is the picture: never draw diagrams, trees, or charts in text, never use code fences to draw boxes, arrows, or trees, and never add a table or list that restates what an attached view already shows; your prose adds only what the view omits. Use get_observability_overview first for broad health questions, get_intelligence_snapshot for the latest precomputed anomalies and recurring log patterns, get_service_topology for direct dependency edges, get_service_dependencies for bounded upstream or downstream reachability from a service, get_service_performance for activity/latency/operations/comparisons, inspect_trace for trace or root-cause inspection, and search_logs for log questions. Treat structured outputs as authoritative. You build and change the user's dashboards. Build one whenever the user asks for an overview, asks why something is slow, failing or changing, asks to compare, break down or track telemetry, or asks for anything they would want to look at again; answer a single factual question with a view instead. To build one, read get_telemetry_schema, draft a complete spec of panels that answer the request, run preview_panels, fix every invalid panel, replace or explain every empty one, and only then call create_dashboard. Cover every part of the request: when a part has no data, keep its panel and say why in the panel description instead of dropping it. Title each panel with exactly what it measures. Prefer a few precise panels over many vague ones: headline stats first, then the time series that explain them, then a table of the worst offenders. After saving, reply in two or three sentences with what the dashboard shows and what stands out. Use filter values exactly as the schema lists them. To change a dashboard, get_dashboard first and use edit_dashboard so unrelated panels stay as they are; replace only when the user asks for a redesign. State the time window you used, distinguish missing data from healthy behavior, and never invent services, metrics, or causal claims. Keep answers concise because attached views provide interactive details. Never expose implementation details to the user: do not mention protocol names, tool names, schemas, query IDs, data-source names, storage engines, providers, or internal execution steps. Refer to attached interactive content simply as a view.` + dashboardAnalysisGuidance +const systemPrompt = `You are Fanout's observability assistant. When a view is attached to your reply it is the picture: never draw diagrams, trees, or charts in text, never use code fences to draw boxes, arrows, or trees, and never add a table or list that restates what an attached view already shows; your prose adds only what the view omits. Use get_observability_overview first for broad health questions, get_intelligence_snapshot for the latest precomputed anomalies and recurring log patterns, get_service_topology for direct dependency edges, get_service_dependencies for bounded upstream or downstream reachability from a service, get_service_performance for activity/latency/operations/comparisons, inspect_trace for trace or root-cause inspection, and search_logs for log questions. Treat structured outputs as authoritative. You build and change the user's dashboards. Build one whenever the user asks for an overview, asks why something is slow, failing or changing, asks to compare, break down or track telemetry, or asks for anything they would want to look at again; answer a single factual question with a view instead. To build one, read get_telemetry_schema, draft a complete spec of panels that answer the request, run preview_panels, fix every invalid panel, replace or drop every empty one, and only then call create_dashboard. Cover every part of the request: when a part has no data, state that finding in the answer and use the signals the service actually has. Title each panel with exactly what it measures. Prefer a few precise panels over many vague ones: headline stats first, then the time series that explain them, then a table of the worst offenders. After saving, reply in two or three sentences with what the dashboard shows and what stands out. Use filter values exactly as the schema lists them. To change a dashboard, get_dashboard first and use edit_dashboard so unrelated panels stay as they are; replace only when the user asks for a redesign. State the time window you used, distinguish missing data from healthy behavior, and never invent services, metrics, or causal claims. Do not present empty results. Dashboards contain only panels that return data; text panels are exempt. Keep answers concise because attached views provide interactive details. Never expose implementation details to the user: do not mention protocol names, tool names, schemas, query IDs, data-source names, storage engines, providers, or internal execution steps. Refer to attached interactive content simply as a view.` + dashboardAnalysisGuidance const dashboardAnalysisGuidance = ` For analysis dashboards, use only the types the question needs; do not fill a dashboard with all of them. Use heatmap for latency changes, histogram for distributions, scatter for relationships, state_timeline for threshold states, logs for events, log_patterns for repeated messages, traces for slow or erroring traces, service_map for dependencies, and health for service health. Use drill for span or log evidence; keep checked filters. Include annotations for change investigations; deploys and detector findings do not prove causes. Use a deploy split for scoped before/since comparisons; retain missing-deploy explanations. A definition, explanation, or single fact is an answer intent; do not create or replace a dashboard for it. Preserve every requested facet and explain absent telemetry without inventing it. Saved panels must keep working as new telemetry arrives: never filter on trace, span or request IDs or other values copied from one result; show recent evidence with a traces panel and drill to its logs. In replies, never name schema fields to the user. Explain in chat is answer intent: use the observed absolute panel window and resolved variables, explain errors and suggest corrections without creating, editing, replacing or restoring dashboards.` diff --git a/internal/agent/runtime_test.go b/internal/agent/runtime_test.go index 20c54f24b..41e763559 100644 --- a/internal/agent/runtime_test.go +++ b/internal/agent/runtime_test.go @@ -315,7 +315,7 @@ func TestSystemPromptForbidsTextDiagrams(t *testing.T) { func TestSystemPromptBuildsDashboardsForDashboardShapedRequests(t *testing.T) { for _, want := range []string{ "Build one whenever the user asks for an overview, asks why something is slow, failing or changing", - "when a part has no data, keep its panel and say why", + "when a part has no data, state that finding in the answer", "Title each panel with exactly what it measures", } { if !strings.Contains(systemPrompt, want) { diff --git a/internal/agent/service_input_test.go b/internal/agent/service_input_test.go index 49df9bfcf..78bcb9cf4 100644 --- a/internal/agent/service_input_test.go +++ b/internal/agent/service_input_test.go @@ -9,10 +9,12 @@ import ( "unicode/utf8" "github.com/labstack/fanout/internal/config" + "github.com/labstack/fanout/internal/dashboard" fanoutmcp "github.com/labstack/fanout/internal/mcp" "github.com/labstack/fanout/internal/observability" "github.com/labstack/fanout/internal/panel" "github.com/labstack/fanout/internal/query" + controlstore "github.com/labstack/fanout/internal/store" "github.com/labstack/fanout/internal/telemetry" telemetrystore "github.com/labstack/fanout/internal/telemetry/store" "github.com/labstack/fanout/internal/toolerror" @@ -71,3 +73,53 @@ func TestToolRegistryUnknownServiceBoundsOversizedAliases(t *testing.T) { } } } + +func TestToolRegistryNoDataAndDashboardPanelErrors(t *testing.T) { + cfg := config.Config{DataDir: t.TempDir(), DuckDBMemory: "256MB", DuckDBThreads: 2, DuckDBMaxConns: 4, RollupInterval: time.Hour} + repo, err := telemetrystore.Open(cfg.TelemetryDir()) + if err != nil { + t.Fatal(err) + } + defer repo.Close() + duck, err := query.NewDuck(t.Context(), cfg, repo) + if err != nil { + t.Fatal(err) + } + defer duck.Close() + to := time.Now().UTC() + from := to.Add(-time.Hour) + if err := repo.Commit(t.Context(), telemetrystore.Batch{ID: "signals", Metrics: []telemetry.Metric{{ServiceName: "collector", Name: "load", Type: "gauge", Value: 1, TimeUnixNanos: from.Add(time.Minute).UnixNano()}}, Logs: []telemetry.Log{{ServiceName: "logger", Severity: "INFO", Body: "hello", TimeUnixNanos: from.Add(time.Minute).UnixNano()}}}); err != nil { + t.Fatal(err) + } + db, err := controlstore.NewSQLite(":memory:") + if err != nil { + t.Fatal(err) + } + defer db.Close() + if _, err := db.DB.Exec(`INSERT INTO users(id,email) VALUES ('owner','owner@example.test')`); err != nil { + t.Fatal(err) + } + executor := panel.NewExecutor(duck, 7) + server := fanoutmcp.NewWithIntelligence(observability.New(duck, duck, 7), dashboard.New(db.DB, executor), executor, nil, "test") + registry, err := NewToolRegistry(t.Context(), server.MCP()) + if err != nil { + t.Fatal(err) + } + defer registry.Close() + spec := panel.Dashboard{Name: "Empty", Time: panel.Time{From: &from, To: &to}, Panels: []panel.Panel{{ID: "p", Title: "Collector requests", Viz: "stat", Query: &panel.Query{From: "spans", Where: []string{"service = 'collector'"}, Measures: []string{"count()"}}}}} + for _, tc := range []struct { + name, code, want string + args any + }{ + {"get_service_performance", "no_data", "spans=0, logs=0, metrics=1", map[string]any{"service": "collector", "from": from, "to": to}}, + {"search_logs", "no_data", "INFO (1)", map[string]any{"service": "logger", "severity": "ERROR", "from": from, "to": to}}, + {"create_dashboard", "tool_failed", "panels[0]: Collector requests", map[string]any{"dashboard": spec}}, + } { + input, _ := json.Marshal(tc.args) + result, err := registry.Execute(dashboard.WithOwner(t.Context(), "owner"), ToolCall{Name: tc.name, Input: string(input)}) + var failure toolerror.Result + if err != nil || !result.IsError || result.Structured != nil || json.Unmarshal([]byte(result.Content), &failure) != nil || failure.Error == nil || failure.Error.Code != tc.code || !strings.Contains(failure.Error.Message, tc.want) { + t.Fatalf("%s: %+v %v", tc.name, result, err) + } + } +} diff --git a/internal/dashboard/service.go b/internal/dashboard/service.go index a29fe3a24..6875fcf32 100644 --- a/internal/dashboard/service.go +++ b/internal/dashboard/service.go @@ -191,6 +191,14 @@ func decodeRecord(row generated.Dashboard) (Record, error) { return record, nil } +type saveCheckKey struct{} + +// WithSaveCheck adds a transport-specific check of the exact spec before each +// write attempt, including edits retried against a concurrent version. +func WithSaveCheck(ctx context.Context, check func(context.Context, panel.Dashboard) error) context.Context { + return context.WithValue(ctx, saveCheckKey{}, check) +} + // prepare normalizes, validates and packs a spec for storage. func (s *Service) prepare(ctx context.Context, spec *panel.Dashboard, repack bool) error { panel.Normalize(spec) @@ -199,6 +207,11 @@ func (s *Service) prepare(ctx context.Context, spec *panel.Dashboard, repack boo if err := s.validator.Validate(validationCtx, spec); err != nil { return err } + if check, ok := ctx.Value(saveCheckKey{}).(func(context.Context, panel.Dashboard) error); ok { + if err := check(validationCtx, *spec); err != nil { + return err + } + } if repack { for i := range spec.Panels { spec.Panels[i].Grid = nil diff --git a/internal/mcp/dashboards.go b/internal/mcp/dashboards.go index 1902802ae..670314de1 100644 --- a/internal/mcp/dashboards.go +++ b/internal/mcp/dashboards.go @@ -120,17 +120,17 @@ var dashboardTools = [...]mcp.Tool{ }, { Name: "create_dashboard", Title: "Create dashboard", - Description: "Create a dashboard for the authenticated user from a complete spec. Read get_telemetry_schema first and preview_panels until every panel is ok or deliberately empty. The result lists any panel that is still empty or failing. " + saveReceiptGuide + specGuide, + Description: "Create a dashboard for the authenticated user from a complete spec. Read get_telemetry_schema first and preview_panels until every non-text panel returns data. Empty or failing panels are rejected with their path, title and diagnosis. " + saveReceiptGuide + specGuide, Annotations: &mcp.ToolAnnotations{DestructiveHint: boolPtr(false), OpenWorldHint: boolPtr(false)}, }, { Name: "replace_dashboard", Title: "Replace dashboard", - Description: "Replace a dashboard's whole spec; omitted panels are removed. Use only for a redesign the user asked for; use edit_dashboard to change a few panels. " + saveReceiptGuide + "See create_dashboard for the spec guide.", + Description: "Every non-text panel must return data in the preview or the save is rejected. Replace a dashboard's whole spec; omitted panels are removed. Use only for a redesign the user asked for; use edit_dashboard to change a few panels. " + saveReceiptGuide + "See create_dashboard for the spec guide.", Annotations: &mcp.ToolAnnotations{DestructiveHint: boolPtr(true), OpenWorldHint: boolPtr(false)}, }, { Name: "edit_dashboard", Title: "Edit dashboard", - Description: "Change a dashboard with typed operations, applied in order and saved as one version: add_panel, update_panel (set replaces the named fields), remove_panel, move_panel, set_variable, remove_variable, set_time, rename. Panels not named are left unchanged. Only edit when the user asks to change that dashboard. " + saveReceiptGuide + "See create_dashboard for the spec guide.", + Description: "Every non-text panel must return data in the preview or the save is rejected. Change a dashboard with typed operations, applied in order and saved as one version: add_panel, update_panel (set replaces the named fields), remove_panel, move_panel, set_variable, remove_variable, set_time, rename. Panels not named are left unchanged. Only edit when the user asks to change that dashboard. " + saveReceiptGuide + "See create_dashboard for the spec guide.", Annotations: &mcp.ToolAnnotations{DestructiveHint: boolPtr(true), OpenWorldHint: boolPtr(false)}, }, { @@ -222,7 +222,7 @@ func (s *Server) dashboardCreate(ctx context.Context, req *mcp.CallToolRequest, ctx = dashboard.WithBuildOrigin(ctx, origin) } } - record, err := s.dashboards.CreateWithChanges(ctx, owner, input.Dashboard, agentAuthor(owner)) + record, err := s.dashboards.CreateWithChanges(dashboard.WithSaveCheck(ctx, s.checkDashboardPanels), owner, input.Dashboard, agentAuthor(owner)) if err != nil { return nil, dashboardOutput{}, dashboardToolError(err) } @@ -234,7 +234,7 @@ func (s *Server) dashboardReplace(ctx context.Context, req *mcp.CallToolRequest, if err != nil { return nil, dashboardOutput{}, err } - record, err := s.dashboards.ReplaceWithChanges(ctx, owner, strings.TrimSpace(input.ID), input.Dashboard, input.BaseVersion, agentAuthor(owner), input.Message) + record, err := s.dashboards.ReplaceWithChanges(dashboard.WithSaveCheck(ctx, s.checkDashboardPanels), owner, strings.TrimSpace(input.ID), input.Dashboard, input.BaseVersion, agentAuthor(owner), input.Message) if err != nil { return nil, dashboardOutput{}, dashboardToolError(err) } @@ -246,13 +246,58 @@ func (s *Server) dashboardEdit(ctx context.Context, req *mcp.CallToolRequest, in if err != nil { return nil, dashboardOutput{}, err } - record, err := s.dashboards.EditWithChanges(ctx, owner, strings.TrimSpace(input.ID), input.Operations, input.BaseVersion, agentAuthor(owner), input.Message) + record, err := s.dashboards.EditWithChanges(dashboard.WithSaveCheck(ctx, s.checkDashboardPanels), owner, strings.TrimSpace(input.ID), input.Operations, input.BaseVersion, agentAuthor(owner), input.Message) if err != nil { return nil, dashboardOutput{}, dashboardToolError(err) } return s.saved(ctx, "Updated", record) } +func (s *Server) checkDashboardPanels(ctx context.Context, spec panel.Dashboard) error { + telemetry := false + for _, p := range spec.Panels { + telemetry = telemetry || p.Viz != "text" + } + if !telemetry { + return nil + } + if s.panels == nil { + return errors.New("panels are unavailable") + } + results, err := s.panels.Run(ctx, panel.RunRequest{Dashboard: spec}) + if err != nil { + return err + } + byID := make(map[string]panel.Result, len(results)) + for _, r := range results { + byID[r.ID] = r + } + var problems panel.Problems + for i, p := range spec.Panels { + if p.Viz == "text" { + continue + } + r, exists := byID[p.ID] + // Execution status records data presence before the shared batch budget + // truncates frames, which can remove every row from a populated panel. + if exists && r.Status == panel.StatusOK { + continue + } + diagnosis := r.Diagnosis + if diagnosis == "" { + diagnosis = r.Error + } + if diagnosis == "" { + diagnosis = "Preview returned no rows." + } + problems = append(problems, panel.Problem{Path: fmt.Sprintf("panels[%d]", i), Message: fmt.Sprintf("%s: %s", p.Title, panel.RedactPaths(diagnosis)), Hint: "Replace or drop this panel; dashboards contain only panels that return data."}) + } + if len(problems) > 0 { + return problems + } + return nil +} + func (s *Server) dashboardVersions(ctx context.Context, req *mcp.CallToolRequest, input DashboardIDInput) (*mcp.CallToolResult, dashboardVersionsOutput, error) { owner, err := dashboardOwner(req) if err != nil { diff --git a/internal/mcp/dashboards_tools_test.go b/internal/mcp/dashboards_tools_test.go index aebc81c87..2b21cc8b6 100644 --- a/internal/mcp/dashboards_tools_test.go +++ b/internal/mcp/dashboards_tools_test.go @@ -44,7 +44,7 @@ func textDashboard(name string) panel.Dashboard { } func TestCreateDashboardAcceptsTheDocumentedShape(t *testing.T) { - s := newPanelServer(t) + s := panelServerFixture(t, true) session := connectTestClient(t, s, nil) // Metadata carries the in-process owner, as the agent runtime does. call := func(args string) *mcp.CallToolResult { @@ -162,21 +162,13 @@ func TestOtherOwnersDashboardIsNotFound(t *testing.T) { } } -func TestSaveReportsPanelsItCouldNotCheck(t *testing.T) { - // The structural validator accepts a filter the executor then rejects, so - // the post-save run fails after the dashboard is already stored. +func TestSaveRejectsPanelsItCannotPreview(t *testing.T) { panels := newPanelServer(t).panels s := newToolServer(t, structural{}, panels) spec := panel.Dashboard{Name: "Unchecked", Panels: []panel.Panel{{ID: "requests", Title: "Requests", Viz: "stat", Query: &panel.Query{From: "spans", Where: []string{"service = = 'x'"}, Measures: []string{"count()"}}}}} - result, out, err := s.dashboardCreate(t.Context(), requestFor("owner"), DashboardCreateInput{Dashboard: spec}) - if err != nil { - t.Fatal(err) - } - if out.Dashboard.Version != 1 { - t.Fatalf("dashboard not saved: %+v", out.Dashboard) - } - if text := result.Content[0].(*mcp.TextContent).Text; !strings.Contains(text, "Panels were not checked:") { - t.Fatalf("summary hides the failed check: %q", text) + _, out, err := s.dashboardCreate(t.Context(), requestFor("owner"), DashboardCreateInput{Dashboard: spec}) + if err == nil || out.Dashboard != nil || out.Receipt != nil { + t.Fatalf("save=%+v err=%v", out, err) } } diff --git a/internal/mcp/fragment_budget_test.go b/internal/mcp/fragment_budget_test.go index 27f147fe1..6b1894d4f 100644 --- a/internal/mcp/fragment_budget_test.go +++ b/internal/mcp/fragment_budget_test.go @@ -107,7 +107,7 @@ func TestLargeTraceKeepsRootErrorsAndSlowest(t *testing.T) { } } func TestNullArgumentsRawJSONRPC(t *testing.T) { - s := newPanelServer(t) + s := panelServerFixture(t, true) h := s.HTTPHandler() for _, name := range []string{"get_telemetry_schema", "list_dashboards", "get_observability_overview"} { t.Run(name, func(t *testing.T) { @@ -127,7 +127,7 @@ func TestNullArgumentsRawJSONRPC(t *testing.T) { } } func TestViewMetadataOnWire(t *testing.T) { - s := newPanelServer(t) + s := panelServerFixture(t, true) client := connectTestClient(t, s, nil) for _, name := range []string{"query_telemetry", "get_service_topology"} { args := map[string]any{} diff --git a/internal/mcp/fragments.go b/internal/mcp/fragments.go index 6af917db4..e537a1446 100644 --- a/internal/mcp/fragments.go +++ b/internal/mcp/fragments.go @@ -64,6 +64,9 @@ func fragmentTool[In, Out any](server *Server, tool *mcp.Tool, handler mcp.ToolH if err != nil { panic(err) } + if reflect.TypeFor[Out]() == reflect.TypeFor[PanelFragment]() { + tool.Description += " All-empty results return no_data guidance instead of a view. State no matching data findings in the answer and prefer signals the service actually has." + } tool.InputSchema = input tool.OutputSchema = output server.limitTools[tool.Name] = input.Properties["limit"] != nil @@ -75,6 +78,14 @@ func (s *Server) runFragment(ctx context.Context, req panel.RunRequest, kinds .. if err != nil { return nil, PanelFragment{}, err } + if allResultsEmpty(out.Results) { + return nil, PanelFragment{}, s.noDataError(ctx, out) + } + return finishFragment(ctx, out, kinds...) +} + +func finishFragment(ctx context.Context, out PanelFragment, kinds ...string) (*mcp.CallToolResult, PanelFragment, error) { + var err error kind := "query" if len(kinds) > 0 { kind = kinds[0] @@ -87,6 +98,25 @@ func (s *Server) runFragment(ctx context.Context, req panel.RunRequest, kinds .. return summary(fragmentSummary(out)), out, nil } +func (s *Server) noDataError(ctx context.Context, out PanelFragment) error { + code, guidance, err := s.panels.EmptyGuidance(ctx, panel.RunRequest{Dashboard: out.Dashboard, Vars: out.Vars}) + if err != nil { + return safePanelToolError(err) + } + if code == "unknown_service" { + return guidanceError(code, guidance) + } + notes := []string{"No matching data.", guidance} + for i, r := range out.Results { + title := r.ID + if i < len(out.Dashboard.Panels) { + title = out.Dashboard.Panels[i].Title + } + notes = append(notes, fmt.Sprintf("%s: %s", title, r.Diagnosis)) + } + return guidanceError("no_data", strings.Join(notes, " ")) +} + func (s *Server) executeFragment(ctx context.Context, req panel.RunRequest) (PanelFragment, error) { if s.panels == nil { return PanelFragment{}, errors.New("panels are unavailable") diff --git a/internal/mcp/fragments_test.go b/internal/mcp/fragments_test.go index c9242feea..5db7a5cb2 100644 --- a/internal/mcp/fragments_test.go +++ b/internal/mcp/fragments_test.go @@ -14,9 +14,9 @@ import ( ) func TestQueryTelemetryReturnsExecutableFragment(t *testing.T) { - s := newPanelServer(t) + s, _, _, from, to := serviceInputFixture(t) p := panel.Panel{ID: "latency", Title: "Latency", Viz: "timeseries", Query: &panel.Query{From: "spans", Measures: []string{"p95(duration_ms)"}, Bucket: "auto"}} - _, got, err := s.queryTelemetry(t.Context(), nil, QueryTelemetryInput{Panel: p}) + _, got, err := s.queryTelemetry(t.Context(), nil, QueryTelemetryInput{Panel: p, Time: &panel.Time{From: &from, To: &to}}) if err != nil { t.Fatal(err) } @@ -400,7 +400,7 @@ func TestFragmentNamedToolsMCPSeededContract(t *testing.T) { } func TestQueryTelemetryDoesNotMutateAuthoredInput(t *testing.T) { - s := newPanelServer(t) + s := panelServerFixture(t, true) input := QueryTelemetryInput{Panel: panel.Panel{ID: "latency", Title: "Latency", Viz: "timeseries", Query: &panel.Query{From: "spans", Measures: []string{"p95(duration_ms)"}}}} before, _ := json.Marshal(input) _, _, err := s.queryTelemetry(t.Context(), nil, input) diff --git a/internal/mcp/no_data_test.go b/internal/mcp/no_data_test.go new file mode 100644 index 000000000..1e01a4428 --- /dev/null +++ b/internal/mcp/no_data_test.go @@ -0,0 +1,202 @@ +package mcp + +import ( + "encoding/json" + "fmt" + "strings" + "testing" + + "github.com/labstack/fanout/internal/dashboard" + "github.com/labstack/fanout/internal/panel" + "github.com/labstack/fanout/internal/toolerror" + "github.com/modelcontextprotocol/go-sdk/mcp" +) + +func TestAllEmptyFragmentsReturnGuidanceWithoutViews(t *testing.T) { + s, _, _, from, to := serviceInputFixture(t) + client := connectTestClient(t, s, nil) + for _, tc := range []struct { + name string + args map[string]any + want []string + }{ + {"get_service_performance", map[string]any{"service": "collector"}, []string{"collector", "spans=0, logs=0, metrics=1"}}, + {"search_logs", map[string]any{"service": "logger", "severity": "ERROR"}, []string{"INFO (1)", "spans=0, logs=1, metrics=0"}}, + {"query_telemetry", map[string]any{"panel": panel.Panel{ID: "p", Title: "Collector latency", Viz: "stat", Query: &panel.Query{From: "spans", Where: []string{"namespace = 'shop' AND service = 'collector'"}, Measures: []string{"p95(duration_ms)"}}}}, []string{"Collector latency", "metrics=1"}}, + } { + t.Run(tc.name, func(t *testing.T) { + if tc.name == "query_telemetry" { + tc.args["time"] = panel.Time{From: &from, To: &to} + } else { + tc.args["from"], tc.args["to"], tc.args["namespace"] = from, to, "shop" + } + result, err := client.CallTool(t.Context(), &mcp.CallToolParams{Name: tc.name, Arguments: tc.args}) + if err != nil || !result.IsError || result.StructuredContent != nil { + t.Fatalf("result=%+v err=%v", result, err) + } + var failure toolerror.Result + if err := json.Unmarshal([]byte(result.Content[0].(*mcp.TextContent).Text), &failure); err != nil || failure.Error == nil || failure.Error.Code != "no_data" { + t.Fatalf("failure=%+v err=%v", failure, err) + } + for _, want := range tc.want { + if !strings.Contains(failure.Error.Message, want) { + t.Errorf("missing %q in %s", want, failure.Error.Message) + } + } + }) + } + // A mixed fragment remains a view, retaining its empty panel's diagnosis. + d := fragmentPreset("performance", "checkout", "shop", "", "", 0) + d.Time = panel.Time{From: &from, To: &to} + d.Panels[3].Query.Where = append(d.Panels[3].Query.Where, "operation = 'absent'") + result, out, err := s.runFragment(t.Context(), panel.RunRequest{Dashboard: d}) + if err != nil || result.IsError || len(out.Results) != 4 || out.Results[0].Status != "ok" || out.Results[3].Status != "empty" { + t.Fatalf("partial=%+v err=%v", out, err) + } +} + +func TestEmptyStorePresetsReturnNoData(t *testing.T) { + s := newPanelServer(t) + client := connectTestClient(t, s, nil) + for _, name := range []string{"get_observability_overview", "get_service_topology", "get_service_performance", "inspect_trace", "search_logs"} { + result, err := client.CallTool(t.Context(), &mcp.CallToolParams{Name: name, Arguments: map[string]any{}}) + if err != nil || !result.IsError || result.StructuredContent != nil { + t.Fatalf("%s: result=%+v err=%v", name, result, err) + } + var failure toolerror.Result + if err := json.Unmarshal([]byte(result.Content[0].(*mcp.TextContent).Text), &failure); err != nil || failure.Error == nil || failure.Error.Code != "no_data" { + t.Fatalf("%s: failure=%+v err=%v", name, failure, err) + } + } +} + +func TestDashboardMutationsRejectEmptyPanelsBeforeWriting(t *testing.T) { + s, _, _, from, to := serviceInputFixture(t) + s = newToolServer(t, structural{}, s.panels) + spec := panel.Dashboard{Name: "Checked", Time: panel.Time{From: &from, To: &to}, Panels: []panel.Panel{ + {ID: "note", Title: "Notes", Viz: "text", Content: "Context"}, + {ID: "requests", Title: "Collector requests", Viz: "stat", Query: &panel.Query{From: "spans", Where: []string{"service = 'collector'"}, Measures: []string{"count()"}}}, + }} + _, out, err := s.dashboardCreate(t.Context(), ownerRequest(), DashboardCreateInput{Dashboard: spec}) + if err == nil || out.Dashboard != nil || !strings.Contains(err.Error(), "panels[1]") || !strings.Contains(err.Error(), "Collector requests") || !strings.Contains(err.Error(), "Values seen") { + t.Fatalf("rejected=%+v err=%v", out, err) + } + good := spec + good.Panels = spec.Panels[:1] + _, created, err := s.dashboardCreate(t.Context(), ownerRequest(), DashboardCreateInput{Dashboard: good}) + if err != nil { + t.Fatal(err) + } + id := created.Dashboard.ID + _, _, err = s.dashboardReplace(t.Context(), ownerRequest(), DashboardReplaceInput{ID: id, Dashboard: spec, BaseVersion: 1}) + if err == nil || !strings.Contains(err.Error(), "Collector requests") { + t.Fatalf("replace: %v", err) + } + _, _, err = s.dashboardEdit(t.Context(), ownerRequest(), DashboardEditInput{ID: id, BaseVersion: 1, Operations: []dashboard.Operation{{Op: "add_panel", Panel: &spec.Panels[1]}}}) + if err == nil || !strings.Contains(err.Error(), "Collector requests") { + t.Fatalf("edit: %v", err) + } + versions, err := s.dashboards.Versions(t.Context(), "owner", id) + if err != nil || len(versions) != 1 { + t.Fatalf("versions=%+v err=%v", versions, err) + } + // Browser/service saves retain the human-editable empty state. + if _, err := s.dashboards.Create(t.Context(), "owner", withName(spec, "Human"), dashboard.Author{Kind: "user", ID: "owner"}); err != nil { + t.Fatal(err) + } +} + +func TestInspectTraceKeepsDetailsWithEmptyPanels(t *testing.T) { + s, _, _, from, to := serviceInputFixture(t) + for _, tc := range []struct { + id string + spans, logs int + }{ + {id: "checkout", spans: 6}, + {id: "logs-only", logs: 1}, + } { + t.Run(tc.id, func(t *testing.T) { + result, out, err := s.trace(t.Context(), nil, TraceInput{TraceID: tc.id, Service: "missing", Namespace: "shop", From: &from, To: &to}) + if err != nil || result == nil || result.IsError || out.Trace == nil { + t.Fatalf("trace details discarded: result=%+v out=%+v err=%v", result, out, err) + } + if !allResultsEmpty(out.Results) || len(out.Trace.Data.Spans) != tc.spans || len(out.Trace.Data.Logs) != tc.logs { + t.Fatalf("trace=%+v panels=%+v", out.Trace, out.Results) + } + }) + } + _, _, err := s.trace(t.Context(), nil, TraceInput{TraceID: "absent", Namespace: "shop", From: &from, To: &to}) + if err == nil || !strings.Contains(err.Error(), `"no_data"`) { + t.Fatalf("empty trace error=%v", err) + } +} + +func TestEmptyGuidanceOmitsUnrepresentableNamespaceScopes(t *testing.T) { + s, _, _, from, to := serviceInputFixture(t) + for _, predicate := range []string{ + "namespace IN ('shop', 'staging')", + "namespace = 'shop' OR namespace = 'staging'", + "namespace LIKE 'sho%'", + "namespace != 'other'", + "namespace IS NULL", + "lower(namespace) = 'shop'", + "CAST(namespace AS VARCHAR) = 'shop'", + "namespace = ''", + "namespace = 'shop' AND namespace = 'other'", + "namespace = 'shop' AND namespace IN ('staging')", + } { + for _, service := range []string{"missing", "elsewhere", "checkout"} { + t.Run(predicate+"/"+service, func(t *testing.T) { + // The namespace restriction and service may be separate filters or + // part of a conjunction; neither may widen guidance's lookup scope. + for _, where := range [][]string{ + {predicate, "service = '" + service + "'"}, + {"(" + predicate + ") AND service = '" + service + "'"}, + } { + d := panel.Dashboard{Name: "Scoped", Time: panel.Time{From: &from, To: &to}, Panels: []panel.Panel{{ID: "logs", Title: "Logs", Viz: "logs", Query: &panel.Query{From: "logs", Where: where}}}} + code, note, err := s.panels.EmptyGuidance(t.Context(), panel.RunRequest{Dashboard: d}) + if err != nil || code != "no_data" || note != "" { + t.Fatalf("unsafe scope produced service guidance: code=%q note=%q err=%v", code, note, err) + } + } + }) + } + } +} + +func TestDashboardSaveAcceptsBatchCellBudgetTruncation(t *testing.T) { + s := panelServerFixture(t, true) + d := panel.Dashboard{Name: "Budget"} + // TestBatchCellBudget's forty six-column tables exhaust the shared + // 200,000-cell budget. A third span input brings this fixture to the + // same 1,000-row per-frame cap before batch truncation. + for i := range 40 { + d.Panels = append(d.Panels, panel.Panel{ID: fmt.Sprintf("p%d", i), Title: "wide", Viz: "table", SQL: "SELECT a.span_id, a.service, a.operation, a.http_route, a.status, a.duration_ms FROM spans a, spans b, spans c WHERE $__window(a.start_time)"}) + } + results, err := s.panels.Run(t.Context(), panel.RunRequest{Dashboard: d}) + if err != nil { + t.Fatal(err) + } + truncatedToZero := false + for _, r := range results { + if r.Status != panel.StatusOK || r.Frame == nil { + t.Fatalf("populated fixture failed: %+v", r) + } + truncatedToZero = truncatedToZero || (r.Frame.Truncated && r.Frame.Rows == 0) + } + if !truncatedToZero || results[0].Frame.Rows != 1000 { + t.Fatal("fixture must produce 1,000 rows per panel before exhausting the batch budget") + } + _, created, err := s.dashboardCreate(t.Context(), ownerRequest(), DashboardCreateInput{Dashboard: d}) + if err != nil { + t.Fatalf("create rejected populated budget-truncated panels: %v", err) + } + _, replaced, err := s.dashboardReplace(t.Context(), ownerRequest(), DashboardReplaceInput{ID: created.Dashboard.ID, BaseVersion: 1, Dashboard: d}) + if err != nil { + t.Fatalf("replace rejected populated budget-truncated panels: %v", err) + } + _, edited, err := s.dashboardEdit(t.Context(), ownerRequest(), DashboardEditInput{ID: created.Dashboard.ID, BaseVersion: replaced.Dashboard.Version, Operations: []dashboard.Operation{{Op: "rename", Name: "Budget edited"}}}) + if err != nil || edited.Dashboard == nil || edited.Dashboard.Version != 3 { + t.Fatalf("edit rejected populated budget-truncated panels: %+v %v", edited, err) + } +} diff --git a/internal/mcp/panels.go b/internal/mcp/panels.go index bfe52b459..6a9ed1184 100644 --- a/internal/mcp/panels.go +++ b/internal/mcp/panels.go @@ -62,7 +62,7 @@ func (s *Server) registerPanelTools() { }, s.telemetrySchema) mcp.AddTool(s.mcp, &mcp.Tool{ Name: "preview_panels", Title: "Preview panels", - Description: "Check and run panels without saving them. Each panel reports ok with rows and a sample, empty with the reason, error, or invalid with the exact field and a suggestion. The result includes total elapsed_ms and executed per-panel elapsed_ms; invalid and not_run panels omit elapsed_ms because they were not executed. Fix every invalid panel and replace or explain every empty one before saving. Spec guide: see create_dashboard.", + Description: "Check and run panels without saving them. Each panel reports ok with rows and a sample, empty with the reason, error, or invalid with the exact field and a suggestion. The result includes total elapsed_ms and executed per-panel elapsed_ms; invalid and not_run panels omit elapsed_ms because they were not executed. Fix every invalid panel and replace or drop every empty one before saving. Spec guide: see create_dashboard.", Annotations: readOnly, }, s.previewPanels) } diff --git a/internal/mcp/panels_test.go b/internal/mcp/panels_test.go index 68244be9f..04cff0a20 100644 --- a/internal/mcp/panels_test.go +++ b/internal/mcp/panels_test.go @@ -118,7 +118,7 @@ func TestPreviewPanelsReportsEachPanel(t *testing.T) { } func TestCreateAndEditDashboardTools(t *testing.T) { - s := newPanelServer(t) + s := panelServerFixture(t, true) spec := panel.Dashboard{Name: "Checkout", Panels: []panel.Panel{ {ID: "notes", Title: "Notes", Viz: "text", Content: "Money path."}, {ID: "requests", Title: "Requests", Viz: "stat", Query: &panel.Query{From: "spans", Measures: []string{"count()"}}}, @@ -128,10 +128,10 @@ func TestCreateAndEditDashboardTools(t *testing.T) { t.Fatal(err) } text := result.Content[0].(*mcp.TextContent).Text - if out.Dashboard.Version != 1 || !strings.Contains(text, "requests") || !strings.Contains(text, "No spans") { + if out.Dashboard.Version != 1 || !out.Receipt.SaveCheck.Checked || out.Receipt.SaveCheck.Panels[1].Rows == 0 { t.Fatalf("create summary %q record %+v", text, out.Dashboard) } - _, edited, err := s.dashboardEdit(t.Context(), ownerRequest(), DashboardEditInput{ID: out.Dashboard.ID, Operations: []dashboard.Operation{{Op: "remove_panel", ID: "requests"}}, Message: "Drop the empty panel"}) + _, edited, err := s.dashboardEdit(t.Context(), ownerRequest(), DashboardEditInput{ID: out.Dashboard.ID, Operations: []dashboard.Operation{{Op: "remove_panel", ID: "requests"}}, Message: "Drop the requests panel"}) if err != nil || edited.Dashboard.Version != 2 || len(edited.Dashboard.Spec.Panels) != 1 { t.Fatalf("edit = %+v %v", edited, err) } diff --git a/internal/mcp/receipts_test.go b/internal/mcp/receipts_test.go index a185ca172..3edc5304f 100644 --- a/internal/mcp/receipts_test.go +++ b/internal/mcp/receipts_test.go @@ -94,7 +94,11 @@ func TestSaveCheckMatchesEverySavedIDRatherThanResultOrder(t *testing.T) { }} spec := textDashboard("IDs") spec.Panels = append(spec.Panels, panel.Panel{ID: "b", Title: "B", Viz: "stat", Query: &panel.Query{From: "spans", Measures: []string{"count()"}}}) - _, out, err := s.dashboardCreate(t.Context(), ownerRequest(), DashboardCreateInput{Dashboard: spec}) + mutation, err := s.dashboards.CreateWithChanges(t.Context(), "owner", spec, agentAuthor("owner")) + if err != nil { + t.Fatal(err) + } + _, out, err := s.saved(t.Context(), "Created", mutation) if err != nil { t.Fatal(err) } @@ -222,15 +226,20 @@ func TestRemoveReceiptPacksNeighborsWithoutAuthoredChips(t *testing.T) { func TestSaveReceiptsCheckCommittedPanelsAndAuthoredChanges(t *testing.T) { s := newPanelServer(t) spec := panel.Dashboard{Name: "Receipt", Panels: []panel.Panel{ - {ID: "notes", Title: "Notes", Viz: "text", Content: "Deliberately empty spans below."}, - {ID: "requests", Title: "Requests", Description: "Deliberately empty on this source.", Viz: "stat", Query: &panel.Query{From: "spans", Measures: []string{"count()"}}}, + {ID: "notes", Title: "Notes", Viz: "text", Content: "Notes."}, + {ID: "requests", Title: "Requests", Viz: "stat", Query: &panel.Query{From: "spans", Measures: []string{"count()"}}}, }} + _, rejected, err := s.dashboardCreate(t.Context(), ownerRequest(), DashboardCreateInput{Dashboard: spec}) + if err == nil || rejected.Dashboard != nil || !strings.Contains(err.Error(), "panels[1]") || !strings.Contains(err.Error(), "Requests") || !strings.Contains(err.Error(), "No spans") { + t.Fatalf("save=%+v err=%v", rejected, err) + } + spec.Panels = spec.Panels[:1] _, out, err := s.dashboardCreate(t.Context(), ownerRequest(), DashboardCreateInput{Dashboard: spec}) if err != nil { t.Fatal(err) } r := out.Receipt - if r == nil || r.BaseVersion != 0 || r.Version != out.Dashboard.Version || !r.SaveCheck.Checked || r.SaveCheck.ElapsedMS < 0 || len(r.SaveCheck.Panels) != 2 { + if r == nil || r.BaseVersion != 0 || r.Version != out.Dashboard.Version || !r.SaveCheck.Checked || r.SaveCheck.ElapsedMS < 0 || len(r.SaveCheck.Panels) != 1 { t.Fatalf("receipt=%+v", r) } for i, p := range r.SaveCheck.Panels { @@ -238,7 +247,7 @@ func TestSaveReceiptsCheckCommittedPanelsAndAuthoredChanges(t *testing.T) { t.Fatal(p) } } - if r.SaveCheck.Panels[0].Rows != 1 || r.SaveCheck.Panels[0].Status != "ok" || r.SaveCheck.Panels[1].Status != "empty" || r.SaveCheck.Panels[1].Diagnosis == "" { + if r.SaveCheck.Panels[0].Rows != 1 || r.SaveCheck.Panels[0].Status != "ok" { t.Fatal(r) } _, edited, err := s.dashboardEdit(t.Context(), ownerRequest(), DashboardEditInput{ID: out.Dashboard.ID, BaseVersion: 1, Operations: []dashboard.Operation{{Op: "update_panel", ID: "notes", Set: map[string]any{"content": "Changed note."}}}}) @@ -254,7 +263,7 @@ func TestSaveReceiptsCheckCommittedPanelsAndAuthoredChanges(t *testing.T) { t.Fatalf("read=%+v err=%v", read, err) } _, preview, err := s.previewPanels(t.Context(), nil, PreviewInput{Panels: spec.Panels}) - if err != nil || preview.ElapsedMS < 0 || len(preview.Panels) != 2 || *preview.Panels[0].ElapsedMS < 0 { + if err != nil || preview.ElapsedMS < 0 || len(preview.Panels) != 1 || *preview.Panels[0].ElapsedMS < 0 { t.Fatalf("preview=%+v err=%v", preview, err) } } diff --git a/internal/mcp/server.go b/internal/mcp/server.go index 028c32249..3504016ab 100644 --- a/internal/mcp/server.go +++ b/internal/mcp/server.go @@ -28,7 +28,7 @@ const ProtocolVersion = "2026-07-28" const staticCatalogTTLMs = 5 * 60 * 1000 -const serverInstructions = "Start with get_observability_overview for system health, use get_intelligence_snapshot for the latest precomputed anomalies and log patterns, get_service_topology for direct dependency edges (use this preset once for a service map; do not repeat the same map with query_telemetry), get_service_dependencies for bounded upstream or downstream reachability from a service, get_service_performance for latency, errors and slow operations across HTTP, gRPC and consumers, inspect_trace for one trace, and search_logs for application events. Treat schema, timestamps, provenance, and bounded time windows as authoritative. Dashboard tools are scoped to the authenticated user. For a custom chart in chat, use query_telemetry with one v1 panel; every chart view returns a dashboard fragment rendered by the shared panel renderer. To build a dashboard, read get_telemetry_schema, draft panels, run preview_panels until every panel is ok or deliberately empty, then create_dashboard. To change one, get_dashboard first and use edit_dashboard; replace only for a redesign the user asked for." +const serverInstructions = "Start with get_observability_overview for system health, use get_intelligence_snapshot for the latest precomputed anomalies and log patterns, get_service_topology for direct dependency edges (use this preset once for a service map; do not repeat the same map with query_telemetry), get_service_dependencies for bounded upstream or downstream reachability from a service, get_service_performance for latency, errors and slow operations across HTTP, gRPC and consumers, inspect_trace for one trace, and search_logs for application events. Treat schema, timestamps, provenance, and bounded time windows as authoritative. Dashboard tools are scoped to the authenticated user. For a custom chart in chat, use query_telemetry with one v1 panel; every chart view returns a dashboard fragment rendered by the shared panel renderer. Do not present empty results; state no matching data findings in the answer and prefer the signal a service actually has. Dashboards contain only panels that return data; text panels are exempt. To build a dashboard, read get_telemetry_schema, draft panels, run preview_panels until every non-text panel returns data, then create_dashboard. To change one, get_dashboard first and use edit_dashboard; replace only for a redesign the user asked for." type Observability interface { Dependencies(context.Context, observability.Scope, observability.DependencyOptions) (observability.Result[observability.Dependencies], error) @@ -95,6 +95,7 @@ type panelExecutor interface { ResolveVariables(context.Context, panel.ResolveRequest) (map[string][]panel.Option, error) ResolveWindow(time.Time, time.Time) (time.Time, time.Time, error) ServiceGuidance(context.Context, time.Time, time.Time, string, string) (string, error) + EmptyGuidance(context.Context, panel.RunRequest) (string, string, error) } type Server struct { @@ -411,16 +412,14 @@ func (s *Server) presetFragment(ctx context.Context, input QueryInput, kind, ser } d := fragmentPreset(kind, service, input.Namespace, severity, search, input.Limit) d.Time = panel.Time{From: &scope.Start, To: &scope.End, Refresh: "off"} - result, out, err := s.runFragment(ctx, panel.RunRequest{Dashboard: d}, "preset") + out, err := s.executeFragment(ctx, panel.RunRequest{Dashboard: d}) if err != nil { return nil, PanelFragment{}, err } if allResultsEmpty(out.Results) { - if err := s.checkService(ctx, scope, service); err != nil { - return nil, PanelFragment{}, err - } + return nil, PanelFragment{}, s.noDataError(ctx, out) } - return result, out, nil + return finishFragment(ctx, out, "preset") } func (s *Server) overview(ctx context.Context, _ *mcp.CallToolRequest, input QueryInput) (*mcp.CallToolResult, PanelFragment, error) { return s.presetFragment(ctx, input, "overview", "", "", "") @@ -457,9 +456,7 @@ func (s *Server) trace(ctx context.Context, _ *mcp.CallToolRequest, input TraceI return nil, PanelFragment{}, err } if allResultsEmpty(out.Results) && len(detail.Data.Spans) == 0 && len(detail.Data.Logs) == 0 { - if err := s.checkService(ctx, scope, strings.TrimSpace(input.Service)); err != nil { - return nil, PanelFragment{}, err - } + return nil, PanelFragment{}, s.noDataError(ctx, out) } if detail.Data.Spans == nil { detail.Data.Spans = []observability.TraceSpan{} @@ -504,6 +501,10 @@ func (s *Server) checkService(ctx context.Context, scope observability.Scope, se if message == "" { return nil } + return guidanceError("unknown_service", message) +} + +func guidanceError(code, message string) error { // JSON escaping expands a byte by at most six bytes. Reserve the envelope // and bound before encoding so the agent's 16 KiB app cap cannot cut JSON. const maxMessageBytes = (16*1024 - 128) / 6 @@ -514,7 +515,7 @@ func (s *Server) checkService(ctx context.Context, scope observability.Scope, se } message += "…" } - return errors.New(toolerror.JSON("unknown_service", message)) + return errors.New(toolerror.JSON(code, message)) } func (s *Server) scope(input QueryInput) (observability.Scope, error) { diff --git a/internal/mcp/server_test.go b/internal/mcp/server_test.go index ea8ded49f..f24a14629 100644 --- a/internal/mcp/server_test.go +++ b/internal/mcp/server_test.go @@ -139,8 +139,9 @@ func TestOverviewReturnsSummaryAndStructuredOutput(t *testing.T) { want time.Duration }{{"15m", 15 * time.Minute}, {"720h", 30 * 24 * time.Hour}} { t.Run(tt.window, func(t *testing.T) { - s := newPanelServer(t) - result, output, err := s.overview(t.Context(), nil, QueryInput{Window: tt.window, Namespace: "prod"}) + s := panelServerFixture(t, true) + s.now = func() time.Time { return time.Now().UTC().Add(-20 * time.Minute) } + result, output, err := s.overview(t.Context(), nil, QueryInput{Window: tt.window, Namespace: "shop"}) if err != nil { t.Fatal(err) } @@ -310,7 +311,7 @@ func TestToolsAdvertiseReadableMCPApps(t *testing.T) { } func TestServerAdvertisesInstructionsAndStaticCacheHints(t *testing.T) { - server := newPanelServer(t) + server := panelServerFixture(t, true) session := connectTestClient(t, server, nil) if instructions := session.InitializeResult().Instructions; !strings.Contains(instructions, "get_observability_overview") || !strings.Contains(instructions, "authenticated user") { t.Fatalf("server instructions = %q", instructions) @@ -331,7 +332,7 @@ func TestServerAdvertisesInstructionsAndStaticCacheHints(t *testing.T) { called, err := session.CallTool(context.Background(), &mcp.CallToolParams{ Name: "get_observability_overview", Arguments: map[string]any{ - "window": "15m", + "window": "1h", }, }) if err != nil { diff --git a/internal/mcp/service_input_test.go b/internal/mcp/service_input_test.go index ed0cc566f..c925a1e13 100644 --- a/internal/mcp/service_input_test.go +++ b/internal/mcp/service_input_test.go @@ -42,7 +42,7 @@ func serviceInputFixture(t testing.TB) (*Server, *query.Duck, *telemetrystore.Re batch.Spans = append(batch.Spans, telemetry.Span{Namespace: "shop", ServiceName: service, TraceID: service, SpanID: fmt.Sprint(j), Name: "orders process", Kind: "SPAN_KIND_CONSUMER", StartUnixNanos: n, EndUnixNanos: n + 1000000, DurationMS: 1, IngestedAt: n, DBSystem: "postgresql", PeerService: "broker", Attributes: map[string]any{"messaging.system": "kafka"}}) } } - batch.Logs = []telemetry.Log{{Namespace: "shop", ServiceName: "logger", TimeUnixNanos: from.Add(time.Minute).UnixNano(), Severity: "INFO", Body: "log only"}} + batch.Logs = []telemetry.Log{{Namespace: "shop", ServiceName: "logger", TraceID: "logs-only", TimeUnixNanos: from.Add(time.Minute).UnixNano(), Severity: "INFO", Body: "log only"}} batch.Metrics = []telemetry.Metric{{Namespace: "shop", ServiceName: "collector", Name: "load", Type: "gauge", TimeUnixNanos: from.Add(time.Minute).UnixNano(), Value: 1}} // These names are valid, but have no traffic in the requested window. batch.Spans = append(batch.Spans, telemetry.Span{Namespace: "shop", ServiceName: "idle", TraceID: "idle", SpanID: "idle", StartUnixNanos: from.Add(-time.Hour).UnixNano(), EndUnixNanos: from.Add(-time.Hour).UnixNano() + 1}, telemetry.Span{Namespace: "other", ServiceName: "elsewhere", TraceID: "elsewhere", SpanID: "elsewhere", StartUnixNanos: from.Add(time.Minute).UnixNano(), EndUnixNanos: from.Add(time.Minute).UnixNano() + 1}) @@ -100,18 +100,18 @@ func TestServiceInputsKeepKnownAndIdleServices(t *testing.T) { } for _, service := range []string{"checkout", "idle", "logger", "collector"} { result, out, err := s.performance(t.Context(), nil, PerformanceInput{Service: service, Namespace: "shop", From: &from, To: &to}) - if err != nil || result.IsError || len(out.Results) != 4 { - t.Fatalf("cached=%v %s: result=%+v output=%+v err=%v", cached, service, result, out, err) - } - want := panel.StatusEmpty - if service == "checkout" { - want = panel.StatusOK - } - if out.Results[3].Status != want { - t.Fatalf("%s operations=%+v want %s", service, out.Results[3], want) + if service != "checkout" { + if err == nil || !strings.Contains(err.Error(), `"no_data"`) || result != nil || len(out.Results) != 0 { + t.Fatalf("%s: %+v %v", service, out, err) + } + volume := map[string]string{"idle": "spans=0, logs=0, metrics=0", "logger": "spans=0, logs=1, metrics=0", "collector": "spans=0, logs=0, metrics=1"}[service] + if !strings.Contains(err.Error(), volume) { + t.Fatalf("missing volumes: %v", err) + } + continue } - if service != "checkout" && !allResultsEmpty(out.Results) { - t.Fatalf("known empty service changed response: %s %+v", service, out.Results) + if err != nil || result.IsError || len(out.Results) != 4 || out.Results[3].Status != panel.StatusOK { + t.Fatalf("cached=%v %s: %+v %v", cached, service, out, err) } } } @@ -135,6 +135,20 @@ func (e *serviceGuidanceSpy) ServiceGuidance(ctx context.Context, start, end tim return e.panelExecutor.ServiceGuidance(ctx, start, end, namespace, service) } +func (e *serviceGuidanceSpy) EmptyGuidance(ctx context.Context, req panel.RunRequest) (string, string, error) { + for _, p := range req.Dashboard.Panels { + if p.Query != nil { + for _, f := range p.Query.Where { + if strings.HasPrefix(f, "service = ") { + e.calls++ + return e.panelExecutor.EmptyGuidance(ctx, req) + } + } + } + } + return e.panelExecutor.EmptyGuidance(ctx, req) +} + func TestServiceInputsWithResultsSkipMembership(t *testing.T) { s, duck, _, from, to := serviceInputFixture(t) if _, err := duck.DB.Exec(`INSERT INTO edge_rollup VALUES ('shop',?,'checkout','broker',6,1,0,'call')`, from.Add(time.Minute)); err != nil { @@ -153,8 +167,7 @@ func TestServiceInputsWithResultsSkipMembership(t *testing.T) { {"get_service_dependencies", map[string]any{"service": "broker", "namespace": "shop", "window": "1h"}}, {"search_logs", map[string]any{"service": "logger", "namespace": "shop", "from": from, "to": to}}, {"inspect_trace", map[string]any{"service": "checkout", "namespace": "shop", "from": from, "to": to}}, - // An exact trace ID still returns its detail when the service filter has - // no list rows; that is not an entirely empty result. + // Exact trace details survive an optional service filter with no list rows. {"inspect_trace", map[string]any{"service": "missing", "trace_id": "checkout", "namespace": "shop", "from": from, "to": to}}, } { t.Run(tc.name+"/"+tc.args["service"].(string), func(t *testing.T) { @@ -179,10 +192,11 @@ func TestServiceInputsValidateOnlyAfterAllResultsEmpty(t *testing.T) { runErr error lookups int unknown bool + empty bool }{ - {name: "unknown", service: "missing", statuses: []string{panel.StatusEmpty, panel.StatusEmpty}, lookups: 1, unknown: true}, - {name: "known empty", service: "idle", statuses: []string{panel.StatusEmpty, panel.StatusEmpty}, lookups: 1}, - {name: "no service", statuses: []string{panel.StatusEmpty, panel.StatusEmpty}}, + {name: "unknown", service: "missing", statuses: []string{panel.StatusEmpty, panel.StatusEmpty}, lookups: 1, unknown: true, empty: true}, + {name: "known empty", service: "idle", statuses: []string{panel.StatusEmpty, panel.StatusEmpty}, lookups: 1, empty: true}, + {name: "no service", statuses: []string{panel.StatusEmpty, panel.StatusEmpty}, empty: true}, {name: "one populated", service: "missing", statuses: []string{panel.StatusEmpty, panel.StatusOK}}, {name: "panel error", service: "missing", statuses: []string{panel.StatusEmpty, panel.StatusError}}, {name: "execution error", service: "missing", runErr: errors.New("execution failed")}, @@ -209,6 +223,10 @@ func TestServiceInputsValidateOnlyAfterAllResultsEmpty(t *testing.T) { if err == nil || !strings.Contains(err.Error(), `"unknown_service"`) || result != nil || len(out.Results) != 0 { t.Fatalf("unknown result=%+v out=%+v err=%v", result, out, err) } + } else if tc.empty { + if err == nil || !strings.Contains(err.Error(), `"no_data"`) || result != nil || len(out.Results) != 0 { + t.Fatalf("empty result=%+v out=%+v err=%v", result, out, err) + } } else if (err != nil) != (tc.runErr != nil) || tc.runErr == nil && (result == nil || len(out.Results) != len(tc.statuses)) { t.Fatalf("result=%+v out=%+v err=%v", result, out, err) } @@ -241,7 +259,7 @@ func TestServiceInputsClampWindowBeforeValidation(t *testing.T) { wantWindow := to.Add(-7*24*time.Hour).Format(time.RFC3339Nano) + "/" + to.Format(time.RFC3339Nano) for _, name := range []string{"get_service_performance", "get_service_dependencies", "search_logs", "inspect_trace"} { t.Run(name, func(t *testing.T) { - result, err := client.CallTool(t.Context(), &mcp.CallToolParams{Name: name, Arguments: map[string]any{"service": "checkout", "namespace": "shop", "window": "720h"}}) + result, err := client.CallTool(t.Context(), &mcp.CallToolParams{Name: name, Arguments: map[string]any{"service": map[bool]string{true: "logger", false: "checkout"}[name == "search_logs"], "namespace": "shop", "window": "720h"}}) if err != nil || result.IsError { t.Fatalf("clamped known service: %+v %v", result, err) } @@ -310,8 +328,8 @@ func TestServiceInputsKeepRetainedEventTimes(t *testing.T) { } } result, out, err := s.performance(t.Context(), nil, PerformanceInput{Service: service, Namespace: "shop", From: &from, To: &to}) - if err != nil || result.IsError || !allResultsEmpty(out.Results) { - t.Fatalf("retained service lost its empty response: cached=%v service=%s out=%+v err=%v", cached, service, out, err) + if err == nil || !strings.Contains(err.Error(), `"no_data"`) || result != nil || len(out.Results) != 0 { + t.Fatalf("retained service lost its no_data response: cached=%v service=%s out=%+v err=%v", cached, service, out, err) } } message, err := s.panels.ServiceGuidance(t.Context(), from, to, "shop", "missing") diff --git a/internal/panel/rollup_panels.go b/internal/panel/rollup_panels.go index 0b38f1776..c0d24928c 100644 --- a/internal/panel/rollup_panels.go +++ b/internal/panel/rollup_panels.go @@ -26,7 +26,10 @@ func rollupFilterValue(ctx context.Context, parser Parser, f Filter, scope Scope } // Parse the author's source, not the canonical filter with its injected // parameter casts. Explicit casts cannot be represented by a string scope. - node := rollupFilterNode(tree["where_clause"]) + return rollupNodeValue(rollupFilterNode(tree["where_clause"]), scope) +} + +func rollupNodeValue(node map[string]any, scope Scope) (string, string, error) { if node == nil || node["class"] != "COMPARISON" || node["type"] != "COMPARE_EQUAL" { return "", "", fmt.Errorf("rollup panels support equality filters on namespace or service") } diff --git a/internal/panel/service_input.go b/internal/panel/service_input.go index 1cac606c2..9b1478e22 100644 --- a/internal/panel/service_input.go +++ b/internal/panel/service_input.go @@ -141,3 +141,128 @@ SELECT * FROM known UNION ALL SELECT kind,namespace,service,n FROM alias_users WHERE rank<=10 ORDER BY kind,n DESC,namespace,service` + +// EmptyGuidance is used only after a complete fragment returned no matching +// data. Reuse checked filters and resolved variables to find exact service scopes. +func (e *Executor) EmptyGuidance(ctx context.Context, req RunRequest) (string, string, error) { + ctx, cancel := context.WithTimeout(ctx, e.timeout) + defer cancel() + d := req.Dashboard + Normalize(&d) + checked, err := e.check(ctx, &d) + if err != nil { + return "", "", err + } + t := d.Time + if req.Time != nil { + t = *req.Time + } + start, end, err := resolveWindow(t, nil, e.now(), e.maxWindow) + if err != nil { + return "", "", err + } + vars, err := e.values(ctx, &d, checked, start, end, req.Vars) + if err != nil { + return "", "", err + } + scope := Scope{Start: start, End: end, Vars: vars} + seen := map[[2]string]bool{} + var notes []string + for _, p := range d.Panels { + var namespace, service string + unsafeScope := false + for _, f := range checked.Filters[p.ID] { + if scope.dropped(f) { + continue + } + tree, err := e.engine.ParseSQL(ctx, "SELECT 1 FROM spans WHERE ("+f.Source+")") + if err != nil { + return "", "", err + } + var visit func(map[string]any) + visit = func(node map[string]any) { + if node["class"] == "CONJUNCTION" && node["type"] == "CONJUNCTION_AND" { + children, _ := node["children"].([]any) + for _, child := range children { + visit(rollupFilterNode(child)) + } + return + } + field, value, err := rollupNodeValue(node, scope) + if err != nil { + // A string scope cannot represent every checked predicate. + // Never drop a namespace restriction to obtain guidance. + unsafeScope = unsafeScope || guidanceReferencesNamespace(node) + return + } + if field == "service" { + unsafeScope = unsafeScope || (service != "" && service != value) + service = value + } + if field == "namespace" { + unsafeScope = unsafeScope || (namespace != "" && namespace != value) + namespace = value + } + } + visit(rollupFilterNode(tree["where_clause"])) + } + key := [2]string{namespace, service} + if unsafeScope || service == "" || seen[key] { + continue + } + seen[key] = true + message, err := e.ServiceGuidance(ctx, start, end, namespace, service) + if err != nil { + return "", "", err + } + if message != "" { + return "unknown_service", message, nil + } + ctx := queryrows.WithWindow(ctx, queryrows.Window{Start: start, End: end, Namespace: namespace, Service: service}) + rows, err := e.engine.QueryContext(ctx, ` +SELECT + (SELECT count(*) FROM spans WHERE start_time >= $1::TIMESTAMP_NS::TIMESTAMPTZ_NS AND start_time < $2::TIMESTAMP_NS::TIMESTAMPTZ_NS AND ($3='' OR namespace=$3) AND service=$4), + (SELECT count(*) FROM logs WHERE time >= $1::TIMESTAMP_NS::TIMESTAMPTZ_NS AND time < $2::TIMESTAMP_NS::TIMESTAMPTZ_NS AND ($3='' OR namespace=$3) AND service=$4), + (SELECT count(*) FROM metrics WHERE time >= $1::TIMESTAMP_NS::TIMESTAMPTZ_NS AND time < $2::TIMESTAMP_NS::TIMESTAMPTZ_NS AND ($3='' OR namespace=$3) AND service=$4)`, start, end, namespace, service) + if err != nil { + return "", "", err + } + var spans, logs, metrics int64 + if rows.Next() { + err = rows.Scan(&spans, &logs, &metrics) + } + if err == nil { + err = rows.Err() + } + rows.Close() + if err != nil { + return "", "", err + } + notes = append(notes, fmt.Sprintf("Service %q in the requested window: spans=%d, logs=%d, metrics=%d.", service, spans, logs, metrics)) + if len(seen) == 10 { + break + } + } + return "no_data", strings.Join(notes, " "), nil +} + +func guidanceReferencesNamespace(node any) bool { + switch v := node.(type) { + case map[string]any: + if v["class"] == "COLUMN_REF" && fieldText(v) == "namespace" { + return true + } + for _, child := range v { + if guidanceReferencesNamespace(child) { + return true + } + } + case []any: + for _, child := range v { + if guidanceReferencesNamespace(child) { + return true + } + } + } + return false +} diff --git a/internal/ui/dist/assets/WarningCircle.es-1A8yYViJ.js b/internal/ui/dist/assets/WarningCircle.es-wTz6NA9-.js similarity index 98% rename from internal/ui/dist/assets/WarningCircle.es-1A8yYViJ.js rename to internal/ui/dist/assets/WarningCircle.es-wTz6NA9-.js index f6cb521bd..f99de1604 100644 --- a/internal/ui/dist/assets/WarningCircle.es-1A8yYViJ.js +++ b/internal/ui/dist/assets/WarningCircle.es-wTz6NA9-.js @@ -1 +1 @@ -import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{M as r,Y as i,a,f as o,w as s}from"./brand-DUaZkIz1.js";import{G as c,J as l,K as u,Q as d,X as f,Y as p,Z as m,q as h}from"./index-_VmsjY84.js";var g={root:`m_849cf0da`},_=t(),v={underline:`hover`},y=s(e=>{let{underline:t,className:n,unstyled:a,mod:s,...c}=r(`Anchor`,v,e);return(0,_.jsx)(o,{component:`a`,className:i({[g.root]:!a},n),...c,mod:[{underline:t},s],__staticSelector:`Anchor`,unstyled:a})});y.classes=g,y.displayName=`@mantine/core/Anchor`;var b=class extends h{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),f(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&l(t.mutationKey)!==l(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#i())}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??c();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){u.batch(()=>{let t=this.#r;if(t&&this.hasListeners()){let n=this.#t.variables,r=this.#t.context,i={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{t.onSuccess?.(e.data,n,r,i)}catch(e){Promise.reject(e)}try{t.onSettled?.(e.data,null,n,r,i)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{t.onError?.(e.error,n,r,i)}catch(e){Promise.reject(e)}try{t.onSettled?.(void 0,e.error,n,r,i)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},x=n(e(),1);function S(e,t){let n=d(t),[r]=x.useState(()=>new b(n,e));x.useEffect(()=>{r.setOptions(e)},[r,e]);let i=x.useSyncExternalStore(x.useCallback(e=>r.subscribe(u.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=x.useCallback((...e)=>{r.mutate(e[0],e[1]).catch(p)},[r]);if(i.error&&m(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var C=new Map([[`bold`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm0,192a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,212Zm-12-80V80a12,12,0,0,1,24,0v52a12,12,0,0,1-24,0Zm28,40a16,16,0,1,1-16-16A16,16,0,0,1,144,172Z`}))],[`duotone`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),x.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm-8-80V80a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,172Z`}))],[`fill`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm-8,56a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm8,104a12,12,0,1,1,12-12A12,12,0,0,1,128,184Z`}))],[`light`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm0,192a90,90,0,1,1,90-90A90.1,90.1,0,0,1,128,218Zm-6-82V80a6,6,0,0,1,12,0v56a6,6,0,0,1-12,0Zm16,36a10,10,0,1,1-10-10A10,10,0,0,1,138,172Z`}))],[`regular`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm-8-80V80a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,172Z`}))],[`thin`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28Zm0,192a92,92,0,1,1,92-92A92.1,92.1,0,0,1,128,220Zm-4-84V80a4,4,0,0,1,8,0v56a4,4,0,0,1-8,0Zm12,36a8,8,0,1,1-8-8A8,8,0,0,1,136,172Z`}))]]),w=x.forwardRef((e,t)=>x.createElement(a,{ref:t,...e,weights:C}));w.displayName=`WarningCircleIcon`;var T=w;export{S as n,y as r,T as t}; \ No newline at end of file +import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{M as r,Y as i,a,f as o,w as s}from"./brand-DUaZkIz1.js";import{G as c,J as l,K as u,Q as d,X as f,Y as p,Z as m,q as h}from"./index-Du7sNMda.js";var g={root:`m_849cf0da`},_=t(),v={underline:`hover`},y=s(e=>{let{underline:t,className:n,unstyled:a,mod:s,...c}=r(`Anchor`,v,e);return(0,_.jsx)(o,{component:`a`,className:i({[g.root]:!a},n),...c,mod:[{underline:t},s],__staticSelector:`Anchor`,unstyled:a})});y.classes=g,y.displayName=`@mantine/core/Anchor`;var b=class extends h{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),f(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&l(t.mutationKey)!==l(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#i())}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??c();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){u.batch(()=>{let t=this.#r;if(t&&this.hasListeners()){let n=this.#t.variables,r=this.#t.context,i={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{t.onSuccess?.(e.data,n,r,i)}catch(e){Promise.reject(e)}try{t.onSettled?.(e.data,null,n,r,i)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{t.onError?.(e.error,n,r,i)}catch(e){Promise.reject(e)}try{t.onSettled?.(void 0,e.error,n,r,i)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},x=n(e(),1);function S(e,t){let n=d(t),[r]=x.useState(()=>new b(n,e));x.useEffect(()=>{r.setOptions(e)},[r,e]);let i=x.useSyncExternalStore(x.useCallback(e=>r.subscribe(u.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=x.useCallback((...e)=>{r.mutate(e[0],e[1]).catch(p)},[r]);if(i.error&&m(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var C=new Map([[`bold`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm0,192a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,212Zm-12-80V80a12,12,0,0,1,24,0v52a12,12,0,0,1-24,0Zm28,40a16,16,0,1,1-16-16A16,16,0,0,1,144,172Z`}))],[`duotone`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),x.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm-8-80V80a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,172Z`}))],[`fill`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm-8,56a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm8,104a12,12,0,1,1,12-12A12,12,0,0,1,128,184Z`}))],[`light`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm0,192a90,90,0,1,1,90-90A90.1,90.1,0,0,1,128,218Zm-6-82V80a6,6,0,0,1,12,0v56a6,6,0,0,1-12,0Zm16,36a10,10,0,1,1-10-10A10,10,0,0,1,138,172Z`}))],[`regular`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm-8-80V80a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,172Z`}))],[`thin`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28Zm0,192a92,92,0,1,1,92-92A92.1,92.1,0,0,1,128,220Zm-4-84V80a4,4,0,0,1,8,0v56a4,4,0,0,1-8,0Zm12,36a8,8,0,1,1-8-8A8,8,0,0,1,136,172Z`}))]]),w=x.forwardRef((e,t)=>x.createElement(a,{ref:t,...e,weights:C}));w.displayName=`WarningCircleIcon`;var T=w;export{S as n,y as r,T as t}; \ No newline at end of file diff --git a/internal/ui/dist/assets/chat-CDsGWYjG.js b/internal/ui/dist/assets/chat-CXc2E7RV.js similarity index 61% rename from internal/ui/dist/assets/chat-CDsGWYjG.js rename to internal/ui/dist/assets/chat-CXc2E7RV.js index 74395012a..95697812a 100644 --- a/internal/ui/dist/assets/chat-CDsGWYjG.js +++ b/internal/ui/dist/assets/chat-CXc2E7RV.js @@ -1,2 +1,2 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mcp-app-frame-C1H_Yon7.js","assets/useRouter-ByJ6_rwb.js","assets/brand-DUaZkIz1.js","assets/index-_VmsjY84.js","assets/useNavigate-B1zgPEUp.js","assets/preload-helper-CButVOn1.js","assets/Tooltip-B3r3s_B9.js","assets/index-C3uJb_UT.css"])))=>i.map(i=>d[i]); -import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{A as r,C as i,M as a,S as o,T as s,_ as c,a as l,c as u,d,f,i as p,l as m,m as h,n as g,o as _,p as v,r as y,tt as b,u as x,x as S,y as C}from"./brand-DUaZkIz1.js";import{c as w,d as T,f as E,l as D,m as O,o as ee,p as k,s as A,t as j}from"./preload-helper-CButVOn1.js";import{t as M}from"./Tooltip-B3r3s_B9.js";import{a as N,c as P,d as F,l as I,n as L,r as R,t as z,u as B}from"./dashboard-change-chips-DDCZ8miS.js";import{zt as V}from"./index-_VmsjY84.js";var H=n(e(),1),U=t(),W=[`borderBottomWidth`,`borderLeftWidth`,`borderRightWidth`,`borderTopWidth`,`boxSizing`,`fontFamily`,`fontSize`,`fontStyle`,`fontWeight`,`letterSpacing`,`lineHeight`,`paddingBottom`,`paddingLeft`,`paddingRight`,`paddingTop`,`tabSize`,`textIndent`,`textRendering`,`textTransform`,`width`,`wordBreak`,`wordSpacing`,`scrollbarGutter`],G={"min-height":`0`,"max-height":`none`,height:`0`,visibility:`hidden`,overflow:`hidden`,position:`absolute`,"z-index":`-1000`,top:`0`,right:`0`,display:`block`};function K(e){Object.keys(G).forEach(t=>{e.style.setProperty(t,G[t],`important`)})}function te(e){let t=window.getComputedStyle(e);if(t===null)return null;let n={};for(let e of W)n[e]=t[e];return n.boxSizing===``?null:{sizingStyle:n,paddingSize:parseFloat(n.paddingBottom)+parseFloat(n.paddingTop),borderSize:parseFloat(n.borderBottomWidth)+parseFloat(n.borderTopWidth)}}var q=null;function ne(e,t,n=1,r=1/0){q||(q=document.createElement(`textarea`),q.setAttribute(`tabindex`,`-1`),q.setAttribute(`aria-hidden`,`true`),q.setAttribute(`aria-label`,`autosize measurement`),K(q)),q.parentNode===null&&document.body.appendChild(q);let{paddingSize:i,borderSize:a,sizingStyle:o}=e,{boxSizing:s}=o;Object.keys(o).forEach(e=>{q.style[e]=o[e]}),K(q),q.value=t;let c=s===`border-box`?q.scrollHeight+a:q.scrollHeight-i;q.value=t,c=s===`border-box`?q.scrollHeight+a:q.scrollHeight-i,q.value=`x`;let l=q.scrollHeight-i,u=l*n;s===`border-box`&&(u=u+i+a),c=Math.max(u,c);let d=l*r;return s===`border-box`&&(d=d+i+a),c=Math.min(d,c),[c,l]}function re({maxRows:e,minRows:t,onChange:n,ref:r,...i}){let a=i.value!==void 0,o=(0,H.useRef)(null),s=b(o,r),c=(0,H.useRef)(0),l=(0,H.useRef)(0),u=()=>{let n=o.current;if(!n)return;let r=te(n);if(!r)return;let[i]=ne(r,n.value||n.placeholder||`x`,t,e);c.current!==i&&(c.current=i,n.style.setProperty(`height`,`${i}px`,`important`))},d=(0,H.useEffectEvent)(u),f=e=>{a||u(),n?.(e)};return(0,H.useLayoutEffect)(u),(0,H.useEffect)(()=>{let e=()=>u();return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),(0,H.useEffect)(()=>{let e=o.current;if(!e||typeof ResizeObserver>`u`)return;l.current=e.offsetWidth;let t=0,n=new ResizeObserver(()=>{o.current&&o.current.offsetWidth!==l.current&&(l.current=o.current.offsetWidth,cancelAnimationFrame(t),t=requestAnimationFrame(d))});return n.observe(e),()=>{cancelAnimationFrame(t),n.disconnect()}},[]),(0,H.useEffect)(()=>{let e=()=>u();return document.fonts.addEventListener(`loadingdone`,e),()=>document.fonts.removeEventListener(`loadingdone`,e)},[]),(0,H.useEffect)(()=>{let e=e=>{if(o.current?.form===e.target&&!a){let e=o.current.value;requestAnimationFrame(()=>{o.current&&e!==o.current.value&&u()})}};return document.body.addEventListener(`reset`,e),()=>document.body.removeEventListener(`reset`,e)},[a]),(0,U.jsx)(`textarea`,{rows:t,...i,onChange:f,ref:s})}var J=s(e=>{let{autosize:t,maxRows:n,minRows:r,__staticSelector:i,resize:o,bottomSection:s,bottomSectionProps:c,...l}=a([`Input`,`InputWrapper`,`Textarea`],null,e),u=t&&F()!==`test`,d=u?{maxRows:n,minRows:r}:{};return(0,U.jsx)(h,{component:u?re:`textarea`,...l,__staticSelector:i||`Textarea`,__bottomSection:s,__bottomSectionProps:c,multiline:!0,"data-no-overflow":t&&n===void 0||void 0,__vars:{"--input-resize":o},...d})});J.classes=h.classes,J.displayName=`@mantine/core/Textarea`;var Y={root:`m_d08caa0`},X=s(e=>{let t=a(`Typography`,null,e),{classNames:n,className:o,style:s,styles:c,unstyled:l,attributes:u,...d}=t,f=r({name:`Typography`,classes:Y,props:t,className:o,style:s,classNames:n,styles:c,unstyled:l,attributes:u});return(0,U.jsx)(i,{...f(`root`),...d})});X.classes=Y,X.displayName=`@mantine/core/Typography`;var ie=new Map([[`bold`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M208.49,152.49l-72,72a12,12,0,0,1-17,0l-72-72a12,12,0,0,1,17-17L116,187V40a12,12,0,0,1,24,0V187l51.51-51.52a12,12,0,0,1,17,17Z`}))],[`duotone`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M200,144l-72,72L56,144Z`,opacity:`0.2`}),H.createElement(`path`,{d:`M207.39,140.94A8,8,0,0,0,200,136H136V40a8,8,0,0,0-16,0v96H56a8,8,0,0,0-5.66,13.66l72,72a8,8,0,0,0,11.32,0l72-72A8,8,0,0,0,207.39,140.94ZM128,204.69,75.31,152H180.69Z`}))],[`fill`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M205.66,149.66l-72,72a8,8,0,0,1-11.32,0l-72-72A8,8,0,0,1,56,136h64V40a8,8,0,0,1,16,0v96h64a8,8,0,0,1,5.66,13.66Z`}))],[`light`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M204.24,148.24l-72,72a6,6,0,0,1-8.48,0l-72-72a6,6,0,0,1,8.48-8.48L122,201.51V40a6,6,0,0,1,12,0V201.51l61.76-61.75a6,6,0,0,1,8.48,8.48Z`}))],[`regular`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M205.66,149.66l-72,72a8,8,0,0,1-11.32,0l-72-72a8,8,0,0,1,11.32-11.32L120,196.69V40a8,8,0,0,1,16,0V196.69l58.34-58.35a8,8,0,0,1,11.32,11.32Z`}))],[`thin`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M202.83,146.83l-72,72a4,4,0,0,1-5.66,0l-72-72a4,4,0,0,1,5.66-5.66L124,206.34V40a4,4,0,0,1,8,0V206.34l65.17-65.17a4,4,0,0,1,5.66,5.66Z`}))]]),ae=new Map([[`bold`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M184.49,136.49l-80,80a12,12,0,0,1-17-17L159,128,87.51,56.49a12,12,0,1,1,17-17l80,80A12,12,0,0,1,184.49,136.49Z`}))],[`duotone`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M176,128,96,208V48Z`,opacity:`0.2`}),H.createElement(`path`,{d:`M181.66,122.34l-80-80A8,8,0,0,0,88,48V208a8,8,0,0,0,13.66,5.66l80-80A8,8,0,0,0,181.66,122.34ZM104,188.69V67.31L164.69,128Z`}))],[`fill`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M181.66,133.66l-80,80A8,8,0,0,1,88,208V48a8,8,0,0,1,13.66-5.66l80,80A8,8,0,0,1,181.66,133.66Z`}))],[`light`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M180.24,132.24l-80,80a6,6,0,0,1-8.48-8.48L167.51,128,91.76,52.24a6,6,0,0,1,8.48-8.48l80,80A6,6,0,0,1,180.24,132.24Z`}))],[`regular`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z`}))],[`thin`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M178.83,130.83l-80,80a4,4,0,0,1-5.66-5.66L170.34,128,93.17,50.83a4,4,0,0,1,5.66-5.66l80,80A4,4,0,0,1,178.83,130.83Z`}))]]),oe=new Map([[`bold`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M230.14,25.86a20,20,0,0,0-19.57-5.11l-.22.07L18.44,79a20,20,0,0,0-3.06,37.25L99,157l40.71,83.65a19.81,19.81,0,0,0,18,11.38c.57,0,1.15,0,1.73-.07A19.82,19.82,0,0,0,177,237.56L235.18,45.65a1.42,1.42,0,0,0,.07-.22A20,20,0,0,0,230.14,25.86ZM156.91,221.07l-34.37-70.64,46-45.95a12,12,0,0,0-17-17l-46,46L34.93,99.09,210,46Z`}))],[`duotone`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M223.69,42.18l-58.22,192a8,8,0,0,1-14.92,1.25L108,148,20.58,105.45a8,8,0,0,1,1.25-14.92l192-58.22A8,8,0,0,1,223.69,42.18Z`,opacity:`0.2`}),H.createElement(`path`,{d:`M227.32,28.68a16,16,0,0,0-15.66-4.08l-.15,0L19.57,82.84a16,16,0,0,0-2.49,29.8L102,154l41.3,84.87A15.86,15.86,0,0,0,157.74,248q.69,0,1.38-.06a15.88,15.88,0,0,0,14-11.51l58.2-191.94c0-.05,0-.1,0-.15A16,16,0,0,0,227.32,28.68ZM157.83,231.85l-.05.14,0-.07-40.06-82.3,48-48a8,8,0,0,0-11.31-11.31l-48,48L24.08,98.25l-.07,0,.14,0L216,40Z`}))],[`fill`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M231.4,44.34s0,.1,0,.15l-58.2,191.94a15.88,15.88,0,0,1-14,11.51q-.69.06-1.38.06a15.86,15.86,0,0,1-14.42-9.15L107,164.15a4,4,0,0,1,.77-4.58l57.92-57.92a8,8,0,0,0-11.31-11.31L96.43,148.26a4,4,0,0,1-4.58.77L17.08,112.64a16,16,0,0,1,2.49-29.8l191.94-58.2.15,0A16,16,0,0,1,231.4,44.34Z`}))],[`light`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M225.88,30.12a13.83,13.83,0,0,0-13.7-3.58l-.11,0L20.14,84.77A14,14,0,0,0,18,110.85l85.56,41.64L145.12,238a13.87,13.87,0,0,0,12.61,8c.4,0,.81,0,1.21-.05a13.9,13.9,0,0,0,12.29-10.09l58.2-191.93,0-.11A13.83,13.83,0,0,0,225.88,30.12Zm-8,10.4L159.73,232.43l0,.11a2,2,0,0,1-3.76.26l-40.68-83.58,49-49a6,6,0,1,0-8.49-8.49l-49,49L23.15,100a2,2,0,0,1,.31-3.74l.11,0L215.48,38.08a1.94,1.94,0,0,1,1.92.52A2,2,0,0,1,217.92,40.52Z`}))],[`regular`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M227.32,28.68a16,16,0,0,0-15.66-4.08l-.15,0L19.57,82.84a16,16,0,0,0-2.49,29.8L102,154l41.3,84.87A15.86,15.86,0,0,0,157.74,248q.69,0,1.38-.06a15.88,15.88,0,0,0,14-11.51l58.2-191.94c0-.05,0-.1,0-.15A16,16,0,0,0,227.32,28.68ZM157.83,231.85l-.05.14,0-.07-40.06-82.3,48-48a8,8,0,0,0-11.31-11.31l-48,48L24.08,98.25l-.07,0,.14,0L216,40Z`}))],[`thin`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M224.47,31.52a11.87,11.87,0,0,0-11.82-3L20.74,86.67a12,12,0,0,0-1.91,22.38L105,151l41.92,86.15A11.88,11.88,0,0,0,157.74,244c.34,0,.69,0,1,0a11.89,11.89,0,0,0,10.52-8.63l58.21-192,0-.08A11.85,11.85,0,0,0,224.47,31.52Zm-4.62,9.54-58.23,192a4,4,0,0,1-7.48.59l-41.3-84.86,50-50a4,4,0,1,0-5.66-5.66l-50,50-84.9-41.31a3.88,3.88,0,0,1-2.27-4,3.93,3.93,0,0,1,3-3.54L214.9,36.16A3.93,3.93,0,0,1,216,36a4,4,0,0,1,2.79,1.19A3.93,3.93,0,0,1,219.85,41.06Z`}))]]),se=new Map([[`bold`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M200,36H56A20,20,0,0,0,36,56V200a20,20,0,0,0,20,20H200a20,20,0,0,0,20-20V56A20,20,0,0,0,200,36Zm-4,160H60V60H196Z`}))],[`duotone`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M208,56V200a8,8,0,0,1-8,8H56a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8H200A8,8,0,0,1,208,56Z`,opacity:`0.2`}),H.createElement(`path`,{d:`M200,40H56A16,16,0,0,0,40,56V200a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,160H56V56H200V200Z`}))],[`fill`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z`}))],[`light`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M200,42H56A14,14,0,0,0,42,56V200a14,14,0,0,0,14,14H200a14,14,0,0,0,14-14V56A14,14,0,0,0,200,42Zm2,158a2,2,0,0,1-2,2H56a2,2,0,0,1-2-2V56a2,2,0,0,1,2-2H200a2,2,0,0,1,2,2Z`}))],[`regular`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M200,40H56A16,16,0,0,0,40,56V200a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,160H56V56H200V200Z`}))],[`thin`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M200,44H56A12,12,0,0,0,44,56V200a12,12,0,0,0,12,12H200a12,12,0,0,0,12-12V56A12,12,0,0,0,200,44Zm4,156a4,4,0,0,1-4,4H56a4,4,0,0,1-4-4V56a4,4,0,0,1,4-4H200a4,4,0,0,1,4,4Z`}))]]),Z=H.forwardRef((e,t)=>H.createElement(l,{ref:t,...e,weights:ie}));Z.displayName=`ArrowDownIcon`;var ce=Z,le=H.forwardRef((e,t)=>H.createElement(l,{ref:t,...e,weights:ae}));le.displayName=`CaretRightIcon`;var ue=le,de=H.forwardRef((e,t)=>H.createElement(l,{ref:t,...e,weights:oe}));de.displayName=`PaperPlaneTiltIcon`;var fe=de,pe=H.forwardRef((e,t)=>H.createElement(l,{ref:t,...e,weights:se}));pe.displayName=`StopIcon`;var me=pe;function he(e){return e.dashboard.panels.length===1?e.dashboard.panels[0].title:e.dashboard.name}function ge(e){if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`Missing panel view`);let t=e;if(!t.view||![`preset`,`query`].includes(t.view.kind)||!/^[a-f0-9]{64}$/.test(t.view.key))throw Error(`Invalid panel view identity`);if(t.dashboard?.version!==1||!Array.isArray(t.dashboard.panels)||!t.dashboard.panels.length||t.dashboard.panels.length>40||!Array.isArray(t.results)||t.dashboard.panels.some(e=>!e||typeof e.id!=`string`||!e.id)||t.results.some(e=>!e||typeof e.id!=`string`))throw Error(`Invalid panel view`);let n=new Set(t.dashboard.panels.map(e=>e.id));if(n.size!==t.dashboard.panels.length||t.results.length!==n.size||new Set(t.results.map(e=>e.id)).size!==n.size||t.results.some(e=>!n.has(e.id)||![`ok`,`empty`,`error`].includes(e.status)))throw Error(`Panel results do not match the view`);if(t.vars!==void 0&&(!t.vars||typeof t.vars!=`object`||Array.isArray(t.vars)||Object.values(t.vars).some(e=>typeof e!=`string`&&!(Array.isArray(e)&&e.every(e=>typeof e==`string`)))))throw Error(`Invalid panel variables`);if(t.trace!==void 0&&(!t.trace?.data||!Array.isArray(t.trace.data.spans)||!Array.isArray(t.trace.data.logs)||!Array.isArray(t.trace.data.services)))throw Error(`Invalid trace detail`);return t}var _e=new WeakSet;function ve(e){if(!e||typeof e!=`object`||Array.isArray(e))return;if(_e.has(e))return e;let t=e;if(Object.keys(t).sort().join(`,`)===`is_error,resource_uri,tool_input,tool_name,tool_result`&&t.resource_uri===`ui://fanout/panels.html`&&typeof t.tool_name==`string`&&t.tool_name&&typeof t.is_error==`boolean`&&t.tool_input&&typeof t.tool_input==`object`&&!Array.isArray(t.tool_input)){try{ge(t.tool_result)}catch{return}return _e.add(t),t}}var ye=16,be=new Set([`ArrowUp`,`ArrowDown`,`PageUp`,`PageDown`,`Home`,`End`,` `]);function xe(e){let t=(0,H.useRef)(null),n=(0,H.useRef)(null),r=(0,H.useRef)(null),i=(0,H.useRef)(!0),a=(0,H.useRef)(e),o=(0,H.useRef)(()=>{}),s=(0,H.useRef)(null),c=(0,H.useRef)(new Set),l=(0,H.useRef)(null),u=(0,H.useRef)(null),[d,f]=(0,H.useState)(!1),p=(0,H.useCallback)(()=>{let e=t.current,n=r.current?.lastElementChild,i=!e||!n||n.getBoundingClientRect().bottom>e.getBoundingClientRect().top+e.clientTop+e.clientHeight+1;f(!!e&&i&&e.scrollHeight-e.clientHeight-e.scrollTop>1)},[]),m=(0,H.useCallback)(()=>{let e=t.current;if(!e)return;let n=e.getBoundingClientRect().top+e.clientTop,r=[...e.querySelectorAll(`[data-chat-anchor]`)].find(e=>e.getBoundingClientRect().bottom>n);l.current=r?{node:r,top:r.getBoundingClientRect().top}:null},[]),h=(0,H.useCallback)((e,t)=>{e.scrollTop=t,u.current=e.scrollTop},[]),g=(0,H.useCallback)(()=>{let e=t.current;if(e){if(r.current){let t=n.current&&parseFloat(getComputedStyle(n.current).paddingBottom)||0;r.current.style.minHeight=`${Math.max(0,e.clientHeight-ye-t)}px`,i.current&&h(e,e.scrollTop+r.current.getBoundingClientRect().top-e.getBoundingClientRect().top-e.clientTop-ye)}if(!i.current){let t=l.current;t?.node.isConnected&&h(e,e.scrollTop+t.node.getBoundingClientRect().top-t.top),m()}p()}},[m,h,p]),_=(0,H.useCallback)(()=>{let e=t.current,i=n.current;if(!e||!i){s.current?.disconnect(),s.current=null,c.current.clear();return}s.current??=new ResizeObserver(g);let a=new Set([e,i,...i.querySelectorAll(`[data-chat-anchor]`)]);r.current&&a.add(r.current);for(let e of c.current)a.has(e)||s.current.unobserve(e);for(let e of a)c.current.has(e)||s.current.observe(e);c.current=a},[g]),v=(0,H.useCallback)(e=>{if(o.current(),t.current=e,u.current=null,l.current=null,i.current=!0,_(),!e)return;let n=!1,r=()=>{i.current=!1,m()},a=e=>{let t=e.target;!e.defaultPrevented&&be.has(e.key)&&(t instanceof HTMLElement&&(t.closest(`input, textarea, select, [contenteditable]`)||(e.key===` `?t.closest(`button`):t.closest(`[role=slider]`)))||r())},s=()=>{n=!0},c=()=>{n=!1},d=()=>{n&&e.scrollTop!==u.current&&r(),i.current||m(),p()};e.addEventListener(`scroll`,d,{passive:!0}),e.addEventListener(`wheel`,r,{passive:!0}),e.addEventListener(`touchmove`,r,{passive:!0}),e.addEventListener(`keydown`,a),e.addEventListener(`pointerdown`,s),window.addEventListener(`pointerup`,c),window.addEventListener(`pointercancel`,c),o.current=()=>{e.removeEventListener(`scroll`,d),e.removeEventListener(`wheel`,r),e.removeEventListener(`touchmove`,r),e.removeEventListener(`keydown`,a),e.removeEventListener(`pointerdown`,s),window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c),o.current=()=>{}},g()},[g,m,_,p]),y=(0,H.useCallback)(e=>{n.current=e,_()},[_]),b=(0,H.useCallback)(e=>{r.current?.style.removeProperty(`min-height`),r.current=e,_()},[_]);return(0,H.useLayoutEffect)(()=>{a.current!==e&&(a.current=e,i.current=!0,l.current=null),_(),g()}),{scrollRef:v,contentRef:y,turnRef:b,showJump:d,jumpToLatest:(0,H.useCallback)(()=>{let e=t.current;e&&(e.focus({preventScroll:!0}),i.current=!1,h(e,e.scrollHeight),m(),p())},[m,h,p])}}function Se(e=1500){let[t,n]=(0,H.useState)(`idle`),r=(0,H.useRef)(null);(0,H.useEffect)(()=>()=>{r.current&&clearTimeout(r.current)},[]);function i(t){r.current&&clearTimeout(r.current),n(`idle`),(navigator.clipboard?navigator.clipboard.writeText(t):Promise.reject(Error(`clipboard unavailable`))).then(()=>n(`copied`),()=>n(`failed`)).finally(()=>{r.current=setTimeout(()=>n(`idle`),e)})}return{state:t,copy:i}}var Ce={schema:`Telemetry`,context:`Context`,draft:`Draft`,validation:`Validation`,preview:`Preview`,save:`Save`},Q=e=>`${(e/1e3).toFixed(1)} s`;function we({receipt:e,running:t=!1,activity:n=``,awaitingAnswer:r=!1}){let[i,a]=(0,H.useState)(!1),o=(0,H.useId)(),s=e.saved,l=s?.receipt.save_check,p=Object.values(e.stages).filter(e=>e.state===`complete`).length,m=[e.stages.schema.state===`complete`?`Read telemetry`:void 0,e.panel_count===void 0?void 0:`${e.panel_count} ${e.panel_count===1?`panel`:`panels`}`,l?.checked?`Checked in ${Q(l.elapsed_ms)}`:void 0,s?`Saved v${s.version}`:void 0].filter(Boolean).join(` · `)||`Building dashboard`,h=[...s?w(s.receipt):[],...e.corrections.map(e=>`Fixed ${e.panel_id}.${e.path.replace(/^panels\[\d+\]\./,``)}`)];return(0,U.jsx)(S,{"data-build-receipt":e.turn_id,"data-dashboard-result":s?.id,"data-chat-anchor":!0,withBorder:!0,radius:`md`,p:`sm`,children:(0,U.jsxs)(u,{gap:6,children:[(0,U.jsxs)(c,{gap:`xs`,justify:`space-between`,children:[(0,U.jsxs)(f,{size:`sm`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,children:[m,(0,U.jsxs)(f,{span:!0,c:`dimmed`,size:`xs`,children:[` · `,p,` stages complete`]})]}),(0,U.jsxs)(d,{component:`button`,variant:`subtle`,color:`gray`,size:`compact-xs`,"aria-expanded":i,"aria-controls":o,onClick:()=>a(e=>!e),children:[`Details`,h.length>4?` (+${h.length-4})`:``]})]}),t&&r&&(0,U.jsxs)(c,{gap:`xs`,"data-build-running":!0,children:[(0,U.jsx)(C,{type:`dots`,size:`sm`}),(0,U.jsx)(f,{c:`dimmed`,size:`sm`,children:n||`Analyzing your system`})]}),(0,U.jsx)(z,{labels:h.slice(0,4)}),e.explanations.map(e=>t?e.split(` · `).filter(e=>!e.endsWith(`: incomplete`)).join(` · `):e).filter(Boolean).map((e,t)=>(0,U.jsx)(f,{size:`xs`,c:`dimmed`,"data-receipt-attention":!0,children:e},t)),s&&(0,U.jsx)(d,{renderRoot:e=>(0,U.jsx)(O,{...e,to:`/dashboards/$dashboardId`,params:{dashboardId:s.id},search:{}}),variant:`subtle`,size:`compact-sm`,color:`gray`,style:{alignSelf:`flex-start`},children:`Open dashboard`}),(0,U.jsx)(B,{expanded:i,id:o,children:(0,U.jsxs)(u,{gap:4,children:[s&&(0,U.jsxs)(f,{size:`xs`,children:[s.label,` `,s.name,` · opens the current dashboard`]}),Object.entries(e.stages).map(([e,n])=>(0,U.jsxs)(f,{size:`xs`,c:`dimmed`,children:[Ce[e],`: `,t&&n.state===`incomplete`?`in progress`:n.state,n.elapsed_ms===void 0?``:` · ${Q(n.elapsed_ms)}`]},e)),e.save_attempts.map((e,t)=>e.state===`retried`&&(0,U.jsxs)(f,{size:`xs`,c:`dimmed`,children:[`Save attempt `,t+1,`: retried`]},e.call_id)),!!e.context_counts.deploys&&(0,U.jsxs)(f,{size:`xs`,children:[e.context_counts.deploys,` deploys observed`]}),!!e.context_counts.anomalies&&(0,U.jsxs)(f,{size:`xs`,children:[e.context_counts.anomalies,` anomalies observed`]}),e.panels.map(e=>(0,U.jsxs)(f,{size:`xs`,children:[`Preview · `,e.id,`: `,e.status,e.elapsed_ms===void 0?``:` · ${Q(e.elapsed_ms)}`]},e.id)),l&&(0,U.jsxs)(f,{size:`xs`,children:[`Save check: `,l.checked?`checked`:`incomplete`,` · `,Q(l.elapsed_ms)]}),l?.panels.map(e=>(0,U.jsxs)(f,{size:`xs`,children:[`Save · `,e.id,`: `,e.status,` · `,e.rows??0,` rows`,e.elapsed_ms===void 0?``:` · ${Q(e.elapsed_ms)}`]},e.id)),h.slice(4).map((e,t)=>(0,U.jsx)(f,{size:`xs`,children:e},t)),e.corrections.map((e,t)=>(0,U.jsxs)(f,{size:`xs`,children:[`Fixed `,e.panel_id,`.`,e.path,`: `,e.message]},t))]})})]})})}var Te=(0,H.lazy)(()=>j(()=>import(`./mcp-app-frame-C1H_Yon7.js`),__vite__mapDeps([0,1,2,3,4,5,6,7]))),Ee=e=>e.tool_result.view.kind===`preset`,De=e=>e.tool_result.results.length>0&&e.tool_result.results.every(e=>e.status===`empty`);function Oe(e){let t=new Map,n=new Set,r=[],i=()=>{let e=new Map;for(let t of r){let n=t.content.tool_result.view.key;e.set(n,t)}let i=new Set([...e.values()].map(e=>e.id)),a=[...e.values()].some(e=>Ee(e.content)),o=r.filter(e=>i.has(e.id)&&!De(e.content)).at(-1)?.id;for(let e of r)i.has(e.id)?t.set(e.id,{content:e.content,expanded:!De(e.content)&&(Ee(e.content)||!a&&e.id===o)}):n.add(e.id);r=[]};for(let t of e)if(t.role===`user`&&i(),t.role===`activity`&&t.activityType===`mcp-app`){let e=ve(t.content);e&&r.push({id:t.id,content:e})}return i(),{views:t,duplicates:n}}function ke(e){let t=new Map,n=new Map,r=new Map,i=`unattributed`;for(let a of e){if(a.role===`user`&&(n.clear(),r.clear(),i=a.id),a.role===`assistant`){i=a.id;for(let e of a.toolCalls??[])n.set(e.id,{assistant:i,name:e.function.name})}if(a.role===`tool`){let e=T(a.content);if(!a.error&&!e?.error&&e?.isError!==!0)continue;let o=n.get(a.toolCallId);if(o&&E.has(o.name)&&D(a))continue;let s=o?.assistant??i,c=r.get(s)??a.id;r.set(s,c);let l=t.get(c)??[],u=k(e?.error)?e?.error:void 0,d=typeof u?.message==`string`?u.message:typeof a.error==`string`&&a.error?a.error:`Tool execution failed`;l.push({name:o?.name??`Tool`,message:d,readOnly:u?.code===`answer_only`}),t.set(c,l)}}return t}function Ae({failures:e}){let[t,n]=(0,H.useState)(!1),r=e.filter(e=>!e.readOnly);return(0,U.jsxs)(i,{"data-chat-anchor":!0,children:[e.some(e=>e.readOnly)&&(0,U.jsx)(f,{size:`sm`,c:`dimmed`,children:`Not saved: Explain is read-only`}),r.length>0&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(o,{className:`chat-app-toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),style:{color:`var(--mantine-color-dimmed)`},children:[(0,U.jsx)(`span`,{className:`chat-app-chevron`,"aria-hidden":`true`,children:t?(0,U.jsx)(P,{size:14}):(0,U.jsx)(ue,{size:14})}),(0,U.jsxs)(`span`,{className:`chat-app-summary`,children:[r.length,` tool `,r.length===1?`call`:`calls`,` failed`]})]}),t&&(0,U.jsx)(u,{gap:`xs`,pl:`md`,children:r.map((e,t)=>(0,U.jsxs)(f,{size:`sm`,c:`dimmed`,style:{whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},children:[e.name,`: `,e.message]},t))})]})]})}function je({view:e}){let[t,n]=(0,H.useState)(e.expanded);(0,H.useEffect)(()=>n(e.expanded),[e.expanded]);let r=e.content.tool_result,i=he(r),a=[...new Set(r.dashboard.panels.map(e=>e.viz===`timeseries`?`time series`:e.viz.replaceAll(`_`,` `)))].join(`, `),s=r.results.reduce((e,t)=>e+(t.frame?.rows??0),0),c=new Map;for(let e of r.results)e.status!==`ok`&&c.set(e.status,(c.get(e.status)??0)+1);let l=r.dashboard.panels.length>1?[`${r.dashboard.panels.length} panels`,...Array.from(c,([e,t])=>`${t} ${e}`)].join(` · `):c.size?[...c.keys()].join(`, `):`${s} ${s===1?`row`:`rows`}`;return(0,U.jsxs)(S,{"data-chat-app":!0,"data-chat-anchor":!0,withBorder:!0,radius:`lg`,style:{overflow:`hidden`},children:[(0,U.jsxs)(o,{className:`chat-app-toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[(0,U.jsx)(`span`,{className:`chat-app-chevron`,"aria-hidden":`true`,children:t?(0,U.jsx)(P,{size:14}):(0,U.jsx)(ue,{size:14})}),(0,U.jsxs)(`span`,{className:`chat-app-summary`,children:[i,` · `,a,` · `,l]})]}),t&&(0,U.jsx)(H.Suspense,{fallback:(0,U.jsx)(x,{mih:180,children:(0,U.jsx)(C,{size:`sm`})}),children:(0,U.jsx)(Te,{content:e.content})})]})}var Me=[`Summarize system health for the last hour`,`Find the source of elevated errors`,`Map the current service dependencies`,`Show the slowest endpoints`];function Ne(){let{agentAvailable:e,messages:t,messageTimes:n,ready:r,running:a,activity:o,provisional:s,stopped:l,error:p,threadMissing:h,send:g,retry:y,reloadThread:b,newThread:w}=A(),T=ee(t),E=t.filter(e=>e.role===`user`).at(-1)?.id,{scrollRef:D,contentRef:O,turnRef:k,showJump:j,jumpToLatest:N}=xe(E);if(!e)return(0,U.jsx)(m,{size:`sm`,py:96,children:(0,U.jsx)(S,{withBorder:!0,radius:`lg`,p:{base:`xl`,sm:40},children:(0,U.jsxs)(u,{gap:`md`,children:[(0,U.jsx)(f,{c:`brand`,fw:700,size:`xs`,tt:`uppercase`,lts:`0.12em`,children:`Optional capability`}),(0,U.jsx)(_,{order:1,fz:28,children:`Chat is not configured`}),(0,U.jsx)(f,{c:`dimmed`,children:`Add an AI provider key to enable chat. Telemetry ingest, dashboards, traces, logs, and metrics remain available without it.`}),(0,U.jsx)(d,{component:`a`,href:`/dashboards`,variant:`light`,mt:`sm`,children:`Open dashboards`})]})})});let P=Oe(t),F=ke(t),I=t.filter(e=>P.duplicates.has(e.id)?!1:e.role===`tool`?F.has(e.id):e.role===`assistant`?!e.toolCalls?.length&&typeof e.content==`string`&&e.content.trim().length>0:e.role===`activity`?e.activityType===`mcp-app`||e.activityType===`agent-outcome`:e.role===`user`),L=t.findIndex(e=>e.id===E),R=t.slice(L+1).some(e=>e.role===`assistant`&&!e.toolCalls?.length&&typeof e.content==`string`&&e.content.length>0),z=t.slice(L+1).filter(e=>e.role===`assistant`&&!e.toolCalls?.length&&typeof e.content==`string`&&e.content.trim().length>0).at(-1),B=a&&s&&!s.collapsed&&s.text&&!R,H=[];for(let e of I)(e.role===`user`||H.length===0)&&H.push({id:e.id,messages:[]}),H.at(-1).messages.push(e);H.length===0&&H.push({id:`draft`,messages:[]});let W=e=>F.has(e.id)?(0,U.jsx)(Ae,{failures:F.get(e.id)},e.id):(0,U.jsxs)(i,{children:[(0,U.jsx)(Le,{message:e,time:n[e.id],appView:P.views.get(e.id)}),T.has(e.id)&&(0,U.jsx)(i,{mt:`sm`,children:(0,U.jsx)(we,{receipt:T.get(e.id),running:a&&e.id===E,awaitingAnswer:!R&&!B,activity:o})})]},e.id);return(0,U.jsxs)(i,{className:`chat-pane`,children:[(0,U.jsxs)(i,{className:`chat-viewport`,children:[(0,U.jsx)(i,{className:`chat-scroll`,ref:D,tabIndex:0,role:`log`,"aria-label":`Conversation`,children:(0,U.jsxs)(m,{size:880,px:{base:`md`,sm:`xl`},py:`lg`,ref:O,children:[h&&(0,U.jsx)(v,{color:`warn`,radius:`lg`,title:`This chat no longer exists`,children:(0,U.jsxs)(c,{justify:`space-between`,children:[(0,U.jsx)(f,{size:`sm`,children:`It was deleted, or the link is wrong.`}),(0,U.jsx)(d,{size:`compact-sm`,variant:`light`,onClick:w,children:`New chat`})]})}),!h&&!r&&p&&(0,U.jsx)(Pe,{message:p,onRetry:b,onNewThread:w}),!h&&!r&&!p&&(0,U.jsxs)(x,{mih:`40vh`,children:[(0,U.jsx)(C,{size:`sm`}),(0,U.jsx)(f,{c:`dimmed`,size:`sm`,ml:`sm`,children:`Loading chat`})]}),!h&&r&&(0,U.jsxs)(U.Fragment,{children:[I.length===0&&(0,U.jsx)(Ie,{onSelect:g}),(0,U.jsx)(u,{gap:`lg`,children:H.map((e,t)=>(0,U.jsxs)(u,{gap:`lg`,ref:e.id===E?k:void 0,"data-chat-turn":e.id===E?E:void 0,children:[e.messages.filter(e=>e.id!==z?.id).map(W),t===H.length-1&&(0,U.jsxs)(U.Fragment,{children:[(z||B)&&(0,U.jsx)(i,{"data-answer-position":!0,children:(0,U.jsx)(Le,{message:B?{id:s.id,role:`assistant`,content:s.text}:z,provisional:!!B,time:B?void 0:n[z.id]})},`answer-${E??`draft`}`),a&&!R&&!B&&!T.has(E??``)&&(0,U.jsxs)(c,{gap:`xs`,role:`status`,children:[(0,U.jsx)(C,{type:`dots`,size:`sm`}),(0,U.jsx)(f,{c:`dimmed`,size:`sm`,children:o||`Analyzing your system`})]}),l&&(0,U.jsx)(f,{c:`dimmed`,size:`sm`,children:`Stopped`}),p&&(0,U.jsx)(Pe,{message:p,onRetry:y})]})]},e.id))})]})]})}),j&&(0,U.jsx)(M,{label:`Jump to latest`,children:(0,U.jsx)(V,{className:`chat-jump`,variant:`default`,size:36,radius:`xl`,"aria-label":`Jump to latest`,onClick:N,children:(0,U.jsx)(ce,{size:18,"aria-hidden":`true`})})})]}),!h&&(0,U.jsx)(Fe,{})]})}function Pe({message:e,onRetry:t,onNewThread:n}){return(0,U.jsx)(v,{color:`bad`,radius:`lg`,title:`Something went wrong`,children:(0,U.jsxs)(c,{justify:`space-between`,gap:`sm`,wrap:`nowrap`,children:[(0,U.jsx)(f,{size:`sm`,children:e}),(0,U.jsxs)(c,{gap:`xs`,wrap:`nowrap`,children:[n&&(0,U.jsx)(d,{size:`compact-sm`,variant:`subtle`,color:`bad`,onClick:n,children:`New chat`}),(0,U.jsx)(d,{size:`compact-sm`,variant:`light`,color:`bad`,onClick:t,children:`Retry`})]})]})})}function Fe(){let{input:e,setInput:t,inputRef:n,submit:r,send:a,stop:o,ready:s,running:l}=A();return(0,U.jsx)(i,{className:`chat-composer`,children:(0,U.jsxs)(m,{size:880,px:{base:`md`,sm:`xl`},children:[(0,U.jsx)(S,{component:`form`,onSubmit:r,className:`chat-composer-field`,withBorder:!0,radius:24,py:6,pl:`lg`,pr:6,children:(0,U.jsxs)(c,{align:`flex-end`,gap:`xs`,wrap:`nowrap`,children:[(0,U.jsx)(J,{ref:n,"aria-label":`Message Fanout`,value:e,onChange:e=>t(e.currentTarget.value),onKeyDown:t=>{t.key===`Enter`&&!t.shiftKey&&(t.preventDefault(),a(e))},placeholder:l?`Fanout is working…`:`Ask about health, errors, or latency…`,disabled:!s,autosize:!0,minRows:1,maxRows:8,variant:`unstyled`,flex:1}),l?(0,U.jsx)(M,{label:`Stop`,children:(0,U.jsx)(V,{type:`button`,variant:`default`,size:40,radius:`xl`,"aria-label":`Stop`,onClick:o,children:(0,U.jsx)(me,{size:16,weight:`fill`})})}):(0,U.jsx)(V,{type:`submit`,variant:`filled`,size:40,radius:`xl`,disabled:!e.trim()||!s,"aria-label":`Send message`,children:(0,U.jsx)(fe,{size:17,weight:`fill`})})]})}),(0,U.jsx)(f,{c:`dimmed`,size:`xs`,ta:`center`,mt:6,children:`Enter to send, Shift+Enter for a new line`})]})})}function Ie({onSelect:e}){return(0,U.jsxs)(u,{align:`center`,gap:`md`,pt:{base:32,sm:88},pb:`xl`,ta:`center`,children:[(0,U.jsx)(g,{size:`large`}),(0,U.jsx)(_,{order:1,fz:24,fw:500,lh:1.25,maw:560,children:`What do you want to know about your system?`}),(0,U.jsx)(c,{justify:`center`,gap:`xs`,mt:`xs`,maw:720,children:Me.map(t=>(0,U.jsx)(d,{variant:`default`,size:`sm`,radius:`xl`,onClick:()=>void e(t),children:t},t))})]})}function Le({message:e,time:t,appView:n,provisional:r=!1}){if(e.role===`activity`)return e.activityType===`agent-outcome`&&e.content&&typeof e.content==`object`&&`message`in e.content&&typeof e.content.message==`string`?`status`in e.content&&e.content.status===`stopped`?(0,U.jsx)(f,{c:`dimmed`,size:`sm`,"data-chat-anchor":!0,children:e.content.message}):(0,U.jsx)(v,{color:`bad`,title:`Something went wrong`,"data-chat-anchor":!0,children:e.content.message}):e.activityType===`mcp-app`?n?(0,U.jsx)(je,{view:n}):(0,U.jsx)(v,{color:`bad`,"data-chat-anchor":!0,children:`This view could not be loaded. Please try again.`}):null;if(e.role===`assistant`&&e.toolCalls?.length)return null;let a=typeof e.content==`string`?e.content:JSON.stringify(e.content);if(!a&&e.role===`assistant`)return null;let o=e.role===`user`,s=t?new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(new Date(t)):``;return(0,U.jsxs)(i,{className:`chat-message${r?` chat-message--provisional`:``}`,"data-chat-anchor":!0,"data-role":o?`user`:`assistant`,children:[o?(0,U.jsx)(S,{radius:`lg`,px:`md`,py:`sm`,bg:`var(--mantine-color-brand-light)`,maw:`70%`,ml:`auto`,w:`fit-content`,children:(0,U.jsx)(f,{style:{whiteSpace:`pre-wrap`},children:a})}):(0,U.jsx)(X,{className:`chat-markdown${r?` chat-markdown--provisional`:``}`,"data-provisional":r||void 0,children:(0,U.jsx)(R,{remarkPlugins:[L],components:ze,children:a})}),(r||s||!o)&&(0,U.jsx)(c,{className:`chat-message-meta`,gap:6,justify:o?`flex-end`:`flex-start`,mt:4,h:24,children:r?(0,U.jsx)(C,{type:`dots`,size:20}):(0,U.jsxs)(U.Fragment,{children:[s&&t&&(0,U.jsx)(f,{c:`dimmed`,size:`xs`,title:N(t),children:s}),!o&&(0,U.jsx)(Re,{text:a,label:`Copy message`})]})})]})}function Re({text:e,label:t}){let{state:n,copy:r}=Se();return(0,U.jsx)(M,{label:n===`failed`?`Could not copy`:n===`copied`?`Copied`:t,children:(0,U.jsx)(V,{variant:`subtle`,color:`gray`,size:`sm`,"aria-label":t,"data-state":n===`idle`?void 0:n,onClick:()=>r(e),children:n===`copied`?(0,U.jsx)(p,{size:13,weight:`bold`}):(0,U.jsx)(y,{size:13})})})}var ze={table:({children:e})=>(0,U.jsx)(i,{className:`chat-table`,children:(0,U.jsx)(I,{striped:!0,highlightOnHover:!0,withTableBorder:!0,verticalSpacing:`xs`,fz:`sm`,children:e})}),thead:({children:e})=>(0,U.jsx)(I.Thead,{children:e}),tbody:({children:e})=>(0,U.jsx)(I.Tbody,{children:e}),tr:({children:e})=>(0,U.jsx)(I.Tr,{children:e}),th:({children:e})=>(0,U.jsx)(I.Th,{children:e}),td:({children:e})=>(0,U.jsx)(I.Td,{children:e}),pre:({children:e})=>(0,U.jsx)(Be,{children:e}),a:({href:e,children:t})=>(0,U.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,children:t})};function Be({children:e}){let t=$(e);return(0,U.jsxs)(i,{className:`chat-code`,pos:`relative`,children:[(0,U.jsx)(i,{className:`chat-code-actions`,pos:`absolute`,top:6,right:6,children:(0,U.jsx)(Re,{text:t,label:`Copy code`})}),(0,U.jsx)(`pre`,{children:e})]})}function $(e){return typeof e==`string`?e:Array.isArray(e)?e.map($).join(``):e&&typeof e==`object`&&`props`in e?$(e.props.children):``}export{ve as n,Ne as t}; \ No newline at end of file +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mcp-app-frame-BhdSvyC_.js","assets/useRouter-ByJ6_rwb.js","assets/brand-DUaZkIz1.js","assets/index-Du7sNMda.js","assets/useNavigate-B1zgPEUp.js","assets/preload-helper-CButVOn1.js","assets/Tooltip-B3r3s_B9.js","assets/index-C3uJb_UT.css"])))=>i.map(i=>d[i]); +import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{A as r,C as i,M as a,S as o,T as s,_ as c,a as l,c as u,d,f,i as p,l as m,m as h,n as g,o as _,p as v,r as y,tt as b,u as x,x as S,y as C}from"./brand-DUaZkIz1.js";import{c as w,d as T,f as E,l as D,m as O,o as ee,p as k,s as A,t as j}from"./preload-helper-CButVOn1.js";import{t as M}from"./Tooltip-B3r3s_B9.js";import{a as N,c as P,d as F,l as I,n as L,r as R,t as z,u as B}from"./dashboard-change-chips-myL7tsV1.js";import{zt as V}from"./index-Du7sNMda.js";var H=n(e(),1),U=t(),W=[`borderBottomWidth`,`borderLeftWidth`,`borderRightWidth`,`borderTopWidth`,`boxSizing`,`fontFamily`,`fontSize`,`fontStyle`,`fontWeight`,`letterSpacing`,`lineHeight`,`paddingBottom`,`paddingLeft`,`paddingRight`,`paddingTop`,`tabSize`,`textIndent`,`textRendering`,`textTransform`,`width`,`wordBreak`,`wordSpacing`,`scrollbarGutter`],G={"min-height":`0`,"max-height":`none`,height:`0`,visibility:`hidden`,overflow:`hidden`,position:`absolute`,"z-index":`-1000`,top:`0`,right:`0`,display:`block`};function K(e){Object.keys(G).forEach(t=>{e.style.setProperty(t,G[t],`important`)})}function te(e){let t=window.getComputedStyle(e);if(t===null)return null;let n={};for(let e of W)n[e]=t[e];return n.boxSizing===``?null:{sizingStyle:n,paddingSize:parseFloat(n.paddingBottom)+parseFloat(n.paddingTop),borderSize:parseFloat(n.borderBottomWidth)+parseFloat(n.borderTopWidth)}}var q=null;function ne(e,t,n=1,r=1/0){q||(q=document.createElement(`textarea`),q.setAttribute(`tabindex`,`-1`),q.setAttribute(`aria-hidden`,`true`),q.setAttribute(`aria-label`,`autosize measurement`),K(q)),q.parentNode===null&&document.body.appendChild(q);let{paddingSize:i,borderSize:a,sizingStyle:o}=e,{boxSizing:s}=o;Object.keys(o).forEach(e=>{q.style[e]=o[e]}),K(q),q.value=t;let c=s===`border-box`?q.scrollHeight+a:q.scrollHeight-i;q.value=t,c=s===`border-box`?q.scrollHeight+a:q.scrollHeight-i,q.value=`x`;let l=q.scrollHeight-i,u=l*n;s===`border-box`&&(u=u+i+a),c=Math.max(u,c);let d=l*r;return s===`border-box`&&(d=d+i+a),c=Math.min(d,c),[c,l]}function re({maxRows:e,minRows:t,onChange:n,ref:r,...i}){let a=i.value!==void 0,o=(0,H.useRef)(null),s=b(o,r),c=(0,H.useRef)(0),l=(0,H.useRef)(0),u=()=>{let n=o.current;if(!n)return;let r=te(n);if(!r)return;let[i]=ne(r,n.value||n.placeholder||`x`,t,e);c.current!==i&&(c.current=i,n.style.setProperty(`height`,`${i}px`,`important`))},d=(0,H.useEffectEvent)(u),f=e=>{a||u(),n?.(e)};return(0,H.useLayoutEffect)(u),(0,H.useEffect)(()=>{let e=()=>u();return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),(0,H.useEffect)(()=>{let e=o.current;if(!e||typeof ResizeObserver>`u`)return;l.current=e.offsetWidth;let t=0,n=new ResizeObserver(()=>{o.current&&o.current.offsetWidth!==l.current&&(l.current=o.current.offsetWidth,cancelAnimationFrame(t),t=requestAnimationFrame(d))});return n.observe(e),()=>{cancelAnimationFrame(t),n.disconnect()}},[]),(0,H.useEffect)(()=>{let e=()=>u();return document.fonts.addEventListener(`loadingdone`,e),()=>document.fonts.removeEventListener(`loadingdone`,e)},[]),(0,H.useEffect)(()=>{let e=e=>{if(o.current?.form===e.target&&!a){let e=o.current.value;requestAnimationFrame(()=>{o.current&&e!==o.current.value&&u()})}};return document.body.addEventListener(`reset`,e),()=>document.body.removeEventListener(`reset`,e)},[a]),(0,U.jsx)(`textarea`,{rows:t,...i,onChange:f,ref:s})}var J=s(e=>{let{autosize:t,maxRows:n,minRows:r,__staticSelector:i,resize:o,bottomSection:s,bottomSectionProps:c,...l}=a([`Input`,`InputWrapper`,`Textarea`],null,e),u=t&&F()!==`test`,d=u?{maxRows:n,minRows:r}:{};return(0,U.jsx)(h,{component:u?re:`textarea`,...l,__staticSelector:i||`Textarea`,__bottomSection:s,__bottomSectionProps:c,multiline:!0,"data-no-overflow":t&&n===void 0||void 0,__vars:{"--input-resize":o},...d})});J.classes=h.classes,J.displayName=`@mantine/core/Textarea`;var Y={root:`m_d08caa0`},X=s(e=>{let t=a(`Typography`,null,e),{classNames:n,className:o,style:s,styles:c,unstyled:l,attributes:u,...d}=t,f=r({name:`Typography`,classes:Y,props:t,className:o,style:s,classNames:n,styles:c,unstyled:l,attributes:u});return(0,U.jsx)(i,{...f(`root`),...d})});X.classes=Y,X.displayName=`@mantine/core/Typography`;var ie=new Map([[`bold`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M208.49,152.49l-72,72a12,12,0,0,1-17,0l-72-72a12,12,0,0,1,17-17L116,187V40a12,12,0,0,1,24,0V187l51.51-51.52a12,12,0,0,1,17,17Z`}))],[`duotone`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M200,144l-72,72L56,144Z`,opacity:`0.2`}),H.createElement(`path`,{d:`M207.39,140.94A8,8,0,0,0,200,136H136V40a8,8,0,0,0-16,0v96H56a8,8,0,0,0-5.66,13.66l72,72a8,8,0,0,0,11.32,0l72-72A8,8,0,0,0,207.39,140.94ZM128,204.69,75.31,152H180.69Z`}))],[`fill`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M205.66,149.66l-72,72a8,8,0,0,1-11.32,0l-72-72A8,8,0,0,1,56,136h64V40a8,8,0,0,1,16,0v96h64a8,8,0,0,1,5.66,13.66Z`}))],[`light`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M204.24,148.24l-72,72a6,6,0,0,1-8.48,0l-72-72a6,6,0,0,1,8.48-8.48L122,201.51V40a6,6,0,0,1,12,0V201.51l61.76-61.75a6,6,0,0,1,8.48,8.48Z`}))],[`regular`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M205.66,149.66l-72,72a8,8,0,0,1-11.32,0l-72-72a8,8,0,0,1,11.32-11.32L120,196.69V40a8,8,0,0,1,16,0V196.69l58.34-58.35a8,8,0,0,1,11.32,11.32Z`}))],[`thin`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M202.83,146.83l-72,72a4,4,0,0,1-5.66,0l-72-72a4,4,0,0,1,5.66-5.66L124,206.34V40a4,4,0,0,1,8,0V206.34l65.17-65.17a4,4,0,0,1,5.66,5.66Z`}))]]),ae=new Map([[`bold`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M184.49,136.49l-80,80a12,12,0,0,1-17-17L159,128,87.51,56.49a12,12,0,1,1,17-17l80,80A12,12,0,0,1,184.49,136.49Z`}))],[`duotone`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M176,128,96,208V48Z`,opacity:`0.2`}),H.createElement(`path`,{d:`M181.66,122.34l-80-80A8,8,0,0,0,88,48V208a8,8,0,0,0,13.66,5.66l80-80A8,8,0,0,0,181.66,122.34ZM104,188.69V67.31L164.69,128Z`}))],[`fill`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M181.66,133.66l-80,80A8,8,0,0,1,88,208V48a8,8,0,0,1,13.66-5.66l80,80A8,8,0,0,1,181.66,133.66Z`}))],[`light`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M180.24,132.24l-80,80a6,6,0,0,1-8.48-8.48L167.51,128,91.76,52.24a6,6,0,0,1,8.48-8.48l80,80A6,6,0,0,1,180.24,132.24Z`}))],[`regular`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z`}))],[`thin`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M178.83,130.83l-80,80a4,4,0,0,1-5.66-5.66L170.34,128,93.17,50.83a4,4,0,0,1,5.66-5.66l80,80A4,4,0,0,1,178.83,130.83Z`}))]]),oe=new Map([[`bold`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M230.14,25.86a20,20,0,0,0-19.57-5.11l-.22.07L18.44,79a20,20,0,0,0-3.06,37.25L99,157l40.71,83.65a19.81,19.81,0,0,0,18,11.38c.57,0,1.15,0,1.73-.07A19.82,19.82,0,0,0,177,237.56L235.18,45.65a1.42,1.42,0,0,0,.07-.22A20,20,0,0,0,230.14,25.86ZM156.91,221.07l-34.37-70.64,46-45.95a12,12,0,0,0-17-17l-46,46L34.93,99.09,210,46Z`}))],[`duotone`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M223.69,42.18l-58.22,192a8,8,0,0,1-14.92,1.25L108,148,20.58,105.45a8,8,0,0,1,1.25-14.92l192-58.22A8,8,0,0,1,223.69,42.18Z`,opacity:`0.2`}),H.createElement(`path`,{d:`M227.32,28.68a16,16,0,0,0-15.66-4.08l-.15,0L19.57,82.84a16,16,0,0,0-2.49,29.8L102,154l41.3,84.87A15.86,15.86,0,0,0,157.74,248q.69,0,1.38-.06a15.88,15.88,0,0,0,14-11.51l58.2-191.94c0-.05,0-.1,0-.15A16,16,0,0,0,227.32,28.68ZM157.83,231.85l-.05.14,0-.07-40.06-82.3,48-48a8,8,0,0,0-11.31-11.31l-48,48L24.08,98.25l-.07,0,.14,0L216,40Z`}))],[`fill`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M231.4,44.34s0,.1,0,.15l-58.2,191.94a15.88,15.88,0,0,1-14,11.51q-.69.06-1.38.06a15.86,15.86,0,0,1-14.42-9.15L107,164.15a4,4,0,0,1,.77-4.58l57.92-57.92a8,8,0,0,0-11.31-11.31L96.43,148.26a4,4,0,0,1-4.58.77L17.08,112.64a16,16,0,0,1,2.49-29.8l191.94-58.2.15,0A16,16,0,0,1,231.4,44.34Z`}))],[`light`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M225.88,30.12a13.83,13.83,0,0,0-13.7-3.58l-.11,0L20.14,84.77A14,14,0,0,0,18,110.85l85.56,41.64L145.12,238a13.87,13.87,0,0,0,12.61,8c.4,0,.81,0,1.21-.05a13.9,13.9,0,0,0,12.29-10.09l58.2-191.93,0-.11A13.83,13.83,0,0,0,225.88,30.12Zm-8,10.4L159.73,232.43l0,.11a2,2,0,0,1-3.76.26l-40.68-83.58,49-49a6,6,0,1,0-8.49-8.49l-49,49L23.15,100a2,2,0,0,1,.31-3.74l.11,0L215.48,38.08a1.94,1.94,0,0,1,1.92.52A2,2,0,0,1,217.92,40.52Z`}))],[`regular`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M227.32,28.68a16,16,0,0,0-15.66-4.08l-.15,0L19.57,82.84a16,16,0,0,0-2.49,29.8L102,154l41.3,84.87A15.86,15.86,0,0,0,157.74,248q.69,0,1.38-.06a15.88,15.88,0,0,0,14-11.51l58.2-191.94c0-.05,0-.1,0-.15A16,16,0,0,0,227.32,28.68ZM157.83,231.85l-.05.14,0-.07-40.06-82.3,48-48a8,8,0,0,0-11.31-11.31l-48,48L24.08,98.25l-.07,0,.14,0L216,40Z`}))],[`thin`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M224.47,31.52a11.87,11.87,0,0,0-11.82-3L20.74,86.67a12,12,0,0,0-1.91,22.38L105,151l41.92,86.15A11.88,11.88,0,0,0,157.74,244c.34,0,.69,0,1,0a11.89,11.89,0,0,0,10.52-8.63l58.21-192,0-.08A11.85,11.85,0,0,0,224.47,31.52Zm-4.62,9.54-58.23,192a4,4,0,0,1-7.48.59l-41.3-84.86,50-50a4,4,0,1,0-5.66-5.66l-50,50-84.9-41.31a3.88,3.88,0,0,1-2.27-4,3.93,3.93,0,0,1,3-3.54L214.9,36.16A3.93,3.93,0,0,1,216,36a4,4,0,0,1,2.79,1.19A3.93,3.93,0,0,1,219.85,41.06Z`}))]]),se=new Map([[`bold`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M200,36H56A20,20,0,0,0,36,56V200a20,20,0,0,0,20,20H200a20,20,0,0,0,20-20V56A20,20,0,0,0,200,36Zm-4,160H60V60H196Z`}))],[`duotone`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M208,56V200a8,8,0,0,1-8,8H56a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8H200A8,8,0,0,1,208,56Z`,opacity:`0.2`}),H.createElement(`path`,{d:`M200,40H56A16,16,0,0,0,40,56V200a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,160H56V56H200V200Z`}))],[`fill`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z`}))],[`light`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M200,42H56A14,14,0,0,0,42,56V200a14,14,0,0,0,14,14H200a14,14,0,0,0,14-14V56A14,14,0,0,0,200,42Zm2,158a2,2,0,0,1-2,2H56a2,2,0,0,1-2-2V56a2,2,0,0,1,2-2H200a2,2,0,0,1,2,2Z`}))],[`regular`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M200,40H56A16,16,0,0,0,40,56V200a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,160H56V56H200V200Z`}))],[`thin`,H.createElement(H.Fragment,null,H.createElement(`path`,{d:`M200,44H56A12,12,0,0,0,44,56V200a12,12,0,0,0,12,12H200a12,12,0,0,0,12-12V56A12,12,0,0,0,200,44Zm4,156a4,4,0,0,1-4,4H56a4,4,0,0,1-4-4V56a4,4,0,0,1,4-4H200a4,4,0,0,1,4,4Z`}))]]),Z=H.forwardRef((e,t)=>H.createElement(l,{ref:t,...e,weights:ie}));Z.displayName=`ArrowDownIcon`;var ce=Z,le=H.forwardRef((e,t)=>H.createElement(l,{ref:t,...e,weights:ae}));le.displayName=`CaretRightIcon`;var ue=le,de=H.forwardRef((e,t)=>H.createElement(l,{ref:t,...e,weights:oe}));de.displayName=`PaperPlaneTiltIcon`;var fe=de,pe=H.forwardRef((e,t)=>H.createElement(l,{ref:t,...e,weights:se}));pe.displayName=`StopIcon`;var me=pe;function he(e){return e.dashboard.panels.length===1?e.dashboard.panels[0].title:e.dashboard.name}function ge(e){if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`Missing panel view`);let t=e;if(!t.view||![`preset`,`query`].includes(t.view.kind)||!/^[a-f0-9]{64}$/.test(t.view.key))throw Error(`Invalid panel view identity`);if(t.dashboard?.version!==1||!Array.isArray(t.dashboard.panels)||!t.dashboard.panels.length||t.dashboard.panels.length>40||!Array.isArray(t.results)||t.dashboard.panels.some(e=>!e||typeof e.id!=`string`||!e.id)||t.results.some(e=>!e||typeof e.id!=`string`))throw Error(`Invalid panel view`);let n=new Set(t.dashboard.panels.map(e=>e.id));if(n.size!==t.dashboard.panels.length||t.results.length!==n.size||new Set(t.results.map(e=>e.id)).size!==n.size||t.results.some(e=>!n.has(e.id)||![`ok`,`empty`,`error`].includes(e.status)))throw Error(`Panel results do not match the view`);if(t.vars!==void 0&&(!t.vars||typeof t.vars!=`object`||Array.isArray(t.vars)||Object.values(t.vars).some(e=>typeof e!=`string`&&!(Array.isArray(e)&&e.every(e=>typeof e==`string`)))))throw Error(`Invalid panel variables`);if(t.trace!==void 0&&(!t.trace?.data||!Array.isArray(t.trace.data.spans)||!Array.isArray(t.trace.data.logs)||!Array.isArray(t.trace.data.services)))throw Error(`Invalid trace detail`);return t}var _e=new WeakSet;function ve(e){if(!e||typeof e!=`object`||Array.isArray(e))return;if(_e.has(e))return e;let t=e;if(Object.keys(t).sort().join(`,`)===`is_error,resource_uri,tool_input,tool_name,tool_result`&&t.resource_uri===`ui://fanout/panels.html`&&typeof t.tool_name==`string`&&t.tool_name&&typeof t.is_error==`boolean`&&t.tool_input&&typeof t.tool_input==`object`&&!Array.isArray(t.tool_input)){try{ge(t.tool_result)}catch{return}return _e.add(t),t}}var ye=16,be=new Set([`ArrowUp`,`ArrowDown`,`PageUp`,`PageDown`,`Home`,`End`,` `]);function xe(e){let t=(0,H.useRef)(null),n=(0,H.useRef)(null),r=(0,H.useRef)(null),i=(0,H.useRef)(!0),a=(0,H.useRef)(e),o=(0,H.useRef)(()=>{}),s=(0,H.useRef)(null),c=(0,H.useRef)(new Set),l=(0,H.useRef)(null),u=(0,H.useRef)(null),[d,f]=(0,H.useState)(!1),p=(0,H.useCallback)(()=>{let e=t.current,n=r.current?.lastElementChild,i=!e||!n||n.getBoundingClientRect().bottom>e.getBoundingClientRect().top+e.clientTop+e.clientHeight+1;f(!!e&&i&&e.scrollHeight-e.clientHeight-e.scrollTop>1)},[]),m=(0,H.useCallback)(()=>{let e=t.current;if(!e)return;let n=e.getBoundingClientRect().top+e.clientTop,r=[...e.querySelectorAll(`[data-chat-anchor]`)].find(e=>e.getBoundingClientRect().bottom>n);l.current=r?{node:r,top:r.getBoundingClientRect().top}:null},[]),h=(0,H.useCallback)((e,t)=>{e.scrollTop=t,u.current=e.scrollTop},[]),g=(0,H.useCallback)(()=>{let e=t.current;if(e){if(r.current){let t=n.current&&parseFloat(getComputedStyle(n.current).paddingBottom)||0;r.current.style.minHeight=`${Math.max(0,e.clientHeight-ye-t)}px`,i.current&&h(e,e.scrollTop+r.current.getBoundingClientRect().top-e.getBoundingClientRect().top-e.clientTop-ye)}if(!i.current){let t=l.current;t?.node.isConnected&&h(e,e.scrollTop+t.node.getBoundingClientRect().top-t.top),m()}p()}},[m,h,p]),_=(0,H.useCallback)(()=>{let e=t.current,i=n.current;if(!e||!i){s.current?.disconnect(),s.current=null,c.current.clear();return}s.current??=new ResizeObserver(g);let a=new Set([e,i,...i.querySelectorAll(`[data-chat-anchor]`)]);r.current&&a.add(r.current);for(let e of c.current)a.has(e)||s.current.unobserve(e);for(let e of a)c.current.has(e)||s.current.observe(e);c.current=a},[g]),v=(0,H.useCallback)(e=>{if(o.current(),t.current=e,u.current=null,l.current=null,i.current=!0,_(),!e)return;let n=!1,r=()=>{i.current=!1,m()},a=e=>{let t=e.target;!e.defaultPrevented&&be.has(e.key)&&(t instanceof HTMLElement&&(t.closest(`input, textarea, select, [contenteditable]`)||(e.key===` `?t.closest(`button`):t.closest(`[role=slider]`)))||r())},s=()=>{n=!0},c=()=>{n=!1},d=()=>{n&&e.scrollTop!==u.current&&r(),i.current||m(),p()};e.addEventListener(`scroll`,d,{passive:!0}),e.addEventListener(`wheel`,r,{passive:!0}),e.addEventListener(`touchmove`,r,{passive:!0}),e.addEventListener(`keydown`,a),e.addEventListener(`pointerdown`,s),window.addEventListener(`pointerup`,c),window.addEventListener(`pointercancel`,c),o.current=()=>{e.removeEventListener(`scroll`,d),e.removeEventListener(`wheel`,r),e.removeEventListener(`touchmove`,r),e.removeEventListener(`keydown`,a),e.removeEventListener(`pointerdown`,s),window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c),o.current=()=>{}},g()},[g,m,_,p]),y=(0,H.useCallback)(e=>{n.current=e,_()},[_]),b=(0,H.useCallback)(e=>{r.current?.style.removeProperty(`min-height`),r.current=e,_()},[_]);return(0,H.useLayoutEffect)(()=>{a.current!==e&&(a.current=e,i.current=!0,l.current=null),_(),g()}),{scrollRef:v,contentRef:y,turnRef:b,showJump:d,jumpToLatest:(0,H.useCallback)(()=>{let e=t.current;e&&(e.focus({preventScroll:!0}),i.current=!1,h(e,e.scrollHeight),m(),p())},[m,h,p])}}function Se(e=1500){let[t,n]=(0,H.useState)(`idle`),r=(0,H.useRef)(null);(0,H.useEffect)(()=>()=>{r.current&&clearTimeout(r.current)},[]);function i(t){r.current&&clearTimeout(r.current),n(`idle`),(navigator.clipboard?navigator.clipboard.writeText(t):Promise.reject(Error(`clipboard unavailable`))).then(()=>n(`copied`),()=>n(`failed`)).finally(()=>{r.current=setTimeout(()=>n(`idle`),e)})}return{state:t,copy:i}}var Ce={schema:`Telemetry`,context:`Context`,draft:`Draft`,validation:`Validation`,preview:`Preview`,save:`Save`},Q=e=>`${(e/1e3).toFixed(1)} s`;function we({receipt:e,running:t=!1,activity:n=``,awaitingAnswer:r=!1}){let[i,a]=(0,H.useState)(!1),o=(0,H.useId)(),s=e.saved,l=s?.receipt.save_check,p=Object.values(e.stages).filter(e=>e.state===`complete`).length,m=[e.stages.schema.state===`complete`?`Read telemetry`:void 0,e.panel_count===void 0?void 0:`${e.panel_count} ${e.panel_count===1?`panel`:`panels`}`,l?.checked?`Checked in ${Q(l.elapsed_ms)}`:void 0,s?`Saved v${s.version}`:void 0].filter(Boolean).join(` · `)||`Building dashboard`,h=[...s?w(s.receipt):[],...e.corrections.map(e=>`Fixed ${e.panel_id}.${e.path.replace(/^panels\[\d+\]\./,``)}`)];return(0,U.jsx)(S,{"data-build-receipt":e.turn_id,"data-dashboard-result":s?.id,"data-chat-anchor":!0,withBorder:!0,radius:`md`,p:`sm`,children:(0,U.jsxs)(u,{gap:6,children:[(0,U.jsxs)(c,{gap:`xs`,justify:`space-between`,children:[(0,U.jsxs)(f,{size:`sm`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,children:[m,(0,U.jsxs)(f,{span:!0,c:`dimmed`,size:`xs`,children:[` · `,p,` stages complete`]})]}),(0,U.jsxs)(d,{component:`button`,variant:`subtle`,color:`gray`,size:`compact-xs`,"aria-expanded":i,"aria-controls":o,onClick:()=>a(e=>!e),children:[`Details`,h.length>4?` (+${h.length-4})`:``]})]}),t&&r&&(0,U.jsxs)(c,{gap:`xs`,"data-build-running":!0,children:[(0,U.jsx)(C,{type:`dots`,size:`sm`}),(0,U.jsx)(f,{c:`dimmed`,size:`sm`,children:n||`Analyzing your system`})]}),(0,U.jsx)(z,{labels:h.slice(0,4)}),e.explanations.map(e=>t?e.split(` · `).filter(e=>!e.endsWith(`: incomplete`)).join(` · `):e).filter(Boolean).map((e,t)=>(0,U.jsx)(f,{size:`xs`,c:`dimmed`,"data-receipt-attention":!0,children:e},t)),s&&(0,U.jsx)(d,{renderRoot:e=>(0,U.jsx)(O,{...e,to:`/dashboards/$dashboardId`,params:{dashboardId:s.id},search:{}}),variant:`subtle`,size:`compact-sm`,color:`gray`,style:{alignSelf:`flex-start`},children:`Open dashboard`}),(0,U.jsx)(B,{expanded:i,id:o,children:(0,U.jsxs)(u,{gap:4,children:[s&&(0,U.jsxs)(f,{size:`xs`,children:[s.label,` `,s.name,` · opens the current dashboard`]}),Object.entries(e.stages).map(([e,n])=>(0,U.jsxs)(f,{size:`xs`,c:`dimmed`,children:[Ce[e],`: `,t&&n.state===`incomplete`?`in progress`:n.state,n.elapsed_ms===void 0?``:` · ${Q(n.elapsed_ms)}`]},e)),e.save_attempts.map((e,t)=>e.state===`retried`&&(0,U.jsxs)(f,{size:`xs`,c:`dimmed`,children:[`Save attempt `,t+1,`: retried`]},e.call_id)),!!e.context_counts.deploys&&(0,U.jsxs)(f,{size:`xs`,children:[e.context_counts.deploys,` deploys observed`]}),!!e.context_counts.anomalies&&(0,U.jsxs)(f,{size:`xs`,children:[e.context_counts.anomalies,` anomalies observed`]}),e.panels.map(e=>(0,U.jsxs)(f,{size:`xs`,children:[`Preview · `,e.id,`: `,e.status,e.elapsed_ms===void 0?``:` · ${Q(e.elapsed_ms)}`]},e.id)),l&&(0,U.jsxs)(f,{size:`xs`,children:[`Save check: `,l.checked?`checked`:`incomplete`,` · `,Q(l.elapsed_ms)]}),l?.panels.map(e=>(0,U.jsxs)(f,{size:`xs`,children:[`Save · `,e.id,`: `,e.status,` · `,e.rows??0,` rows`,e.elapsed_ms===void 0?``:` · ${Q(e.elapsed_ms)}`]},e.id)),h.slice(4).map((e,t)=>(0,U.jsx)(f,{size:`xs`,children:e},t)),e.corrections.map((e,t)=>(0,U.jsxs)(f,{size:`xs`,children:[`Fixed `,e.panel_id,`.`,e.path,`: `,e.message]},t))]})})]})})}var Te=(0,H.lazy)(()=>j(()=>import(`./mcp-app-frame-BhdSvyC_.js`),__vite__mapDeps([0,1,2,3,4,5,6,7]))),Ee=e=>e.tool_result.view.kind===`preset`;function De(e){let t=new Map,n=new Set,r=[],i=()=>{let e=new Map;for(let t of r){let n=t.content.tool_result.view.key;e.set(n,t)}let i=new Set([...e.values()].map(e=>e.id)),a=[...e.values()].some(e=>Ee(e.content)),o=r.filter(e=>i.has(e.id)).at(-1)?.id;for(let e of r)i.has(e.id)?t.set(e.id,{content:e.content,expanded:Ee(e.content)||!a&&e.id===o}):n.add(e.id);r=[]};for(let t of e)if(t.role===`user`&&i(),t.role===`activity`&&t.activityType===`mcp-app`){let e=ve(t.content);e&&r.push({id:t.id,content:e})}return i(),{views:t,duplicates:n}}function Oe(e){let t=new Map,n=new Map,r=new Map,i=`unattributed`;for(let a of e){if(a.role===`user`&&(n.clear(),r.clear(),i=a.id),a.role===`assistant`){i=a.id;for(let e of a.toolCalls??[])n.set(e.id,{assistant:i,name:e.function.name})}if(a.role===`tool`){let e=T(a.content);if(!a.error&&!e?.error&&e?.isError!==!0)continue;let o=n.get(a.toolCallId);if(o&&E.has(o.name)&&D(a))continue;let s=o?.assistant??i,c=r.get(s)??a.id;r.set(s,c);let l=t.get(c)??[],u=k(e?.error)?e?.error:void 0,d=typeof u?.message==`string`?u.message:typeof a.error==`string`&&a.error?a.error:`Tool execution failed`;l.push({name:o?.name??`Tool`,message:d,readOnly:u?.code===`answer_only`}),t.set(c,l)}}return t}function ke({failures:e}){let[t,n]=(0,H.useState)(!1),r=e.filter(e=>!e.readOnly);return(0,U.jsxs)(i,{"data-chat-anchor":!0,children:[e.some(e=>e.readOnly)&&(0,U.jsx)(f,{size:`sm`,c:`dimmed`,children:`Not saved: Explain is read-only`}),r.length>0&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(o,{className:`chat-app-toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),style:{color:`var(--mantine-color-dimmed)`},children:[(0,U.jsx)(`span`,{className:`chat-app-chevron`,"aria-hidden":`true`,children:t?(0,U.jsx)(P,{size:14}):(0,U.jsx)(ue,{size:14})}),(0,U.jsxs)(`span`,{className:`chat-app-summary`,children:[r.length,` tool `,r.length===1?`call`:`calls`,` failed`]})]}),t&&(0,U.jsx)(u,{gap:`xs`,pl:`md`,children:r.map((e,t)=>(0,U.jsxs)(f,{size:`sm`,c:`dimmed`,style:{whiteSpace:`pre-wrap`,overflowWrap:`anywhere`},children:[e.name,`: `,e.message]},t))})]})]})}function Ae({view:e}){let[t,n]=(0,H.useState)(e.expanded);(0,H.useEffect)(()=>n(e.expanded),[e.expanded]);let r=e.content.tool_result,i=he(r),a=[...new Set(r.dashboard.panels.map(e=>e.viz===`timeseries`?`time series`:e.viz.replaceAll(`_`,` `)))].join(`, `),s=r.results.reduce((e,t)=>e+(t.frame?.rows??0),0),c=new Map;for(let e of r.results)e.status!==`ok`&&c.set(e.status,(c.get(e.status)??0)+1);let l=r.dashboard.panels.length>1?[`${r.dashboard.panels.length} panels`,...Array.from(c,([e,t])=>`${t} ${e}`)].join(` · `):c.size?[...c.keys()].join(`, `):`${s} ${s===1?`row`:`rows`}`;return(0,U.jsxs)(S,{"data-chat-app":!0,"data-chat-anchor":!0,withBorder:!0,radius:`lg`,style:{overflow:`hidden`},children:[(0,U.jsxs)(o,{className:`chat-app-toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[(0,U.jsx)(`span`,{className:`chat-app-chevron`,"aria-hidden":`true`,children:t?(0,U.jsx)(P,{size:14}):(0,U.jsx)(ue,{size:14})}),(0,U.jsxs)(`span`,{className:`chat-app-summary`,children:[i,` · `,a,` · `,l]})]}),t&&(0,U.jsx)(H.Suspense,{fallback:(0,U.jsx)(x,{mih:180,children:(0,U.jsx)(C,{size:`sm`})}),children:(0,U.jsx)(Te,{content:e.content})})]})}var je=[`Summarize system health for the last hour`,`Find the source of elevated errors`,`Map the current service dependencies`,`Show the slowest endpoints`];function Me(){let{agentAvailable:e,messages:t,messageTimes:n,ready:r,running:a,activity:o,provisional:s,stopped:l,error:p,threadMissing:h,send:g,retry:y,reloadThread:b,newThread:w}=A(),T=ee(t),E=t.filter(e=>e.role===`user`).at(-1)?.id,{scrollRef:D,contentRef:O,turnRef:k,showJump:j,jumpToLatest:N}=xe(E);if(!e)return(0,U.jsx)(m,{size:`sm`,py:96,children:(0,U.jsx)(S,{withBorder:!0,radius:`lg`,p:{base:`xl`,sm:40},children:(0,U.jsxs)(u,{gap:`md`,children:[(0,U.jsx)(f,{c:`brand`,fw:700,size:`xs`,tt:`uppercase`,lts:`0.12em`,children:`Optional capability`}),(0,U.jsx)(_,{order:1,fz:28,children:`Chat is not configured`}),(0,U.jsx)(f,{c:`dimmed`,children:`Add an AI provider key to enable chat. Telemetry ingest, dashboards, traces, logs, and metrics remain available without it.`}),(0,U.jsx)(d,{component:`a`,href:`/dashboards`,variant:`light`,mt:`sm`,children:`Open dashboards`})]})})});let P=De(t),F=Oe(t),I=t.filter(e=>P.duplicates.has(e.id)?!1:e.role===`tool`?F.has(e.id):e.role===`assistant`?!e.toolCalls?.length&&typeof e.content==`string`&&e.content.trim().length>0:e.role===`activity`?e.activityType===`mcp-app`||e.activityType===`agent-outcome`:e.role===`user`),L=t.findIndex(e=>e.id===E),R=t.slice(L+1).some(e=>e.role===`assistant`&&!e.toolCalls?.length&&typeof e.content==`string`&&e.content.length>0),z=t.slice(L+1).filter(e=>e.role===`assistant`&&!e.toolCalls?.length&&typeof e.content==`string`&&e.content.trim().length>0).at(-1),B=a&&s&&!s.collapsed&&s.text&&!R,H=[];for(let e of I)(e.role===`user`||H.length===0)&&H.push({id:e.id,messages:[]}),H.at(-1).messages.push(e);H.length===0&&H.push({id:`draft`,messages:[]});let W=e=>F.has(e.id)?(0,U.jsx)(ke,{failures:F.get(e.id)},e.id):(0,U.jsxs)(i,{children:[(0,U.jsx)(Ie,{message:e,time:n[e.id],appView:P.views.get(e.id)}),T.has(e.id)&&(0,U.jsx)(i,{mt:`sm`,children:(0,U.jsx)(we,{receipt:T.get(e.id),running:a&&e.id===E,awaitingAnswer:!R&&!B,activity:o})})]},e.id);return(0,U.jsxs)(i,{className:`chat-pane`,children:[(0,U.jsxs)(i,{className:`chat-viewport`,children:[(0,U.jsx)(i,{className:`chat-scroll`,ref:D,tabIndex:0,role:`log`,"aria-label":`Conversation`,children:(0,U.jsxs)(m,{size:880,px:{base:`md`,sm:`xl`},py:`lg`,ref:O,children:[h&&(0,U.jsx)(v,{color:`warn`,radius:`lg`,title:`This chat no longer exists`,children:(0,U.jsxs)(c,{justify:`space-between`,children:[(0,U.jsx)(f,{size:`sm`,children:`It was deleted, or the link is wrong.`}),(0,U.jsx)(d,{size:`compact-sm`,variant:`light`,onClick:w,children:`New chat`})]})}),!h&&!r&&p&&(0,U.jsx)(Ne,{message:p,onRetry:b,onNewThread:w}),!h&&!r&&!p&&(0,U.jsxs)(x,{mih:`40vh`,children:[(0,U.jsx)(C,{size:`sm`}),(0,U.jsx)(f,{c:`dimmed`,size:`sm`,ml:`sm`,children:`Loading chat`})]}),!h&&r&&(0,U.jsxs)(U.Fragment,{children:[I.length===0&&(0,U.jsx)(Fe,{onSelect:g}),(0,U.jsx)(u,{gap:`lg`,children:H.map((e,t)=>(0,U.jsxs)(u,{gap:`lg`,ref:e.id===E?k:void 0,"data-chat-turn":e.id===E?E:void 0,children:[e.messages.filter(e=>e.id!==z?.id).map(W),t===H.length-1&&(0,U.jsxs)(U.Fragment,{children:[(z||B)&&(0,U.jsx)(i,{"data-answer-position":!0,children:(0,U.jsx)(Ie,{message:B?{id:s.id,role:`assistant`,content:s.text}:z,provisional:!!B,time:B?void 0:n[z.id]})},`answer-${E??`draft`}`),a&&!R&&!B&&!T.has(E??``)&&(0,U.jsxs)(c,{gap:`xs`,role:`status`,children:[(0,U.jsx)(C,{type:`dots`,size:`sm`}),(0,U.jsx)(f,{c:`dimmed`,size:`sm`,children:o||`Analyzing your system`})]}),l&&(0,U.jsx)(f,{c:`dimmed`,size:`sm`,children:`Stopped`}),p&&(0,U.jsx)(Ne,{message:p,onRetry:y})]})]},e.id))})]})]})}),j&&(0,U.jsx)(M,{label:`Jump to latest`,children:(0,U.jsx)(V,{className:`chat-jump`,variant:`default`,size:36,radius:`xl`,"aria-label":`Jump to latest`,onClick:N,children:(0,U.jsx)(ce,{size:18,"aria-hidden":`true`})})})]}),!h&&(0,U.jsx)(Pe,{})]})}function Ne({message:e,onRetry:t,onNewThread:n}){return(0,U.jsx)(v,{color:`bad`,radius:`lg`,title:`Something went wrong`,children:(0,U.jsxs)(c,{justify:`space-between`,gap:`sm`,wrap:`nowrap`,children:[(0,U.jsx)(f,{size:`sm`,children:e}),(0,U.jsxs)(c,{gap:`xs`,wrap:`nowrap`,children:[n&&(0,U.jsx)(d,{size:`compact-sm`,variant:`subtle`,color:`bad`,onClick:n,children:`New chat`}),(0,U.jsx)(d,{size:`compact-sm`,variant:`light`,color:`bad`,onClick:t,children:`Retry`})]})]})})}function Pe(){let{input:e,setInput:t,inputRef:n,submit:r,send:a,stop:o,ready:s,running:l}=A();return(0,U.jsx)(i,{className:`chat-composer`,children:(0,U.jsxs)(m,{size:880,px:{base:`md`,sm:`xl`},children:[(0,U.jsx)(S,{component:`form`,onSubmit:r,className:`chat-composer-field`,withBorder:!0,radius:24,py:6,pl:`lg`,pr:6,children:(0,U.jsxs)(c,{align:`flex-end`,gap:`xs`,wrap:`nowrap`,children:[(0,U.jsx)(J,{ref:n,"aria-label":`Message Fanout`,value:e,onChange:e=>t(e.currentTarget.value),onKeyDown:t=>{t.key===`Enter`&&!t.shiftKey&&(t.preventDefault(),a(e))},placeholder:l?`Fanout is working…`:`Ask about health, errors, or latency…`,disabled:!s,autosize:!0,minRows:1,maxRows:8,variant:`unstyled`,flex:1}),l?(0,U.jsx)(M,{label:`Stop`,children:(0,U.jsx)(V,{type:`button`,variant:`default`,size:40,radius:`xl`,"aria-label":`Stop`,onClick:o,children:(0,U.jsx)(me,{size:16,weight:`fill`})})}):(0,U.jsx)(V,{type:`submit`,variant:`filled`,size:40,radius:`xl`,disabled:!e.trim()||!s,"aria-label":`Send message`,children:(0,U.jsx)(fe,{size:17,weight:`fill`})})]})}),(0,U.jsx)(f,{c:`dimmed`,size:`xs`,ta:`center`,mt:6,children:`Enter to send, Shift+Enter for a new line`})]})})}function Fe({onSelect:e}){return(0,U.jsxs)(u,{align:`center`,gap:`md`,pt:{base:32,sm:88},pb:`xl`,ta:`center`,children:[(0,U.jsx)(g,{size:`large`}),(0,U.jsx)(_,{order:1,fz:24,fw:500,lh:1.25,maw:560,children:`What do you want to know about your system?`}),(0,U.jsx)(c,{justify:`center`,gap:`xs`,mt:`xs`,maw:720,children:je.map(t=>(0,U.jsx)(d,{variant:`default`,size:`sm`,radius:`xl`,onClick:()=>void e(t),children:t},t))})]})}function Ie({message:e,time:t,appView:n,provisional:r=!1}){if(e.role===`activity`)return e.activityType===`agent-outcome`&&e.content&&typeof e.content==`object`&&`message`in e.content&&typeof e.content.message==`string`?`status`in e.content&&e.content.status===`stopped`?(0,U.jsx)(f,{c:`dimmed`,size:`sm`,"data-chat-anchor":!0,children:e.content.message}):(0,U.jsx)(v,{color:`bad`,title:`Something went wrong`,"data-chat-anchor":!0,children:e.content.message}):e.activityType===`mcp-app`?n?(0,U.jsx)(Ae,{view:n}):(0,U.jsx)(v,{color:`bad`,"data-chat-anchor":!0,children:`This view could not be loaded. Please try again.`}):null;if(e.role===`assistant`&&e.toolCalls?.length)return null;let a=typeof e.content==`string`?e.content:JSON.stringify(e.content);if(!a&&e.role===`assistant`)return null;let o=e.role===`user`,s=t?new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(new Date(t)):``;return(0,U.jsxs)(i,{className:`chat-message${r?` chat-message--provisional`:``}`,"data-chat-anchor":!0,"data-role":o?`user`:`assistant`,children:[o?(0,U.jsx)(S,{radius:`lg`,px:`md`,py:`sm`,bg:`var(--mantine-color-brand-light)`,maw:`70%`,ml:`auto`,w:`fit-content`,children:(0,U.jsx)(f,{style:{whiteSpace:`pre-wrap`},children:a})}):(0,U.jsx)(X,{className:`chat-markdown${r?` chat-markdown--provisional`:``}`,"data-provisional":r||void 0,children:(0,U.jsx)(R,{remarkPlugins:[L],components:Re,children:a})}),(r||s||!o)&&(0,U.jsx)(c,{className:`chat-message-meta`,gap:6,justify:o?`flex-end`:`flex-start`,mt:4,h:24,children:r?(0,U.jsx)(C,{type:`dots`,size:20}):(0,U.jsxs)(U.Fragment,{children:[s&&t&&(0,U.jsx)(f,{c:`dimmed`,size:`xs`,title:N(t),children:s}),!o&&(0,U.jsx)(Le,{text:a,label:`Copy message`})]})})]})}function Le({text:e,label:t}){let{state:n,copy:r}=Se();return(0,U.jsx)(M,{label:n===`failed`?`Could not copy`:n===`copied`?`Copied`:t,children:(0,U.jsx)(V,{variant:`subtle`,color:`gray`,size:`sm`,"aria-label":t,"data-state":n===`idle`?void 0:n,onClick:()=>r(e),children:n===`copied`?(0,U.jsx)(p,{size:13,weight:`bold`}):(0,U.jsx)(y,{size:13})})})}var Re={table:({children:e})=>(0,U.jsx)(i,{className:`chat-table`,children:(0,U.jsx)(I,{striped:!0,highlightOnHover:!0,withTableBorder:!0,verticalSpacing:`xs`,fz:`sm`,children:e})}),thead:({children:e})=>(0,U.jsx)(I.Thead,{children:e}),tbody:({children:e})=>(0,U.jsx)(I.Tbody,{children:e}),tr:({children:e})=>(0,U.jsx)(I.Tr,{children:e}),th:({children:e})=>(0,U.jsx)(I.Th,{children:e}),td:({children:e})=>(0,U.jsx)(I.Td,{children:e}),pre:({children:e})=>(0,U.jsx)(ze,{children:e}),a:({href:e,children:t})=>(0,U.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,children:t})};function ze({children:e}){let t=$(e);return(0,U.jsxs)(i,{className:`chat-code`,pos:`relative`,children:[(0,U.jsx)(i,{className:`chat-code-actions`,pos:`absolute`,top:6,right:6,children:(0,U.jsx)(Le,{text:t,label:`Copy code`})}),(0,U.jsx)(`pre`,{children:e})]})}function $(e){return typeof e==`string`?e:Array.isArray(e)?e.map($).join(``):e&&typeof e==`object`&&`props`in e?$(e.props.children):``}export{ve as n,Me as t}; \ No newline at end of file diff --git a/internal/ui/dist/assets/chat._threadId-Bgm22VZM.js b/internal/ui/dist/assets/chat._threadId-Bgm22VZM.js deleted file mode 100644 index 586d216a9..000000000 --- a/internal/ui/dist/assets/chat._threadId-Bgm22VZM.js +++ /dev/null @@ -1 +0,0 @@ -import{t as e}from"./chat-CDsGWYjG.js";var t=e;export{t as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/chat._threadId-Cjkl3RJK.js b/internal/ui/dist/assets/chat._threadId-Cjkl3RJK.js new file mode 100644 index 000000000..25d16d66d --- /dev/null +++ b/internal/ui/dist/assets/chat._threadId-Cjkl3RJK.js @@ -0,0 +1 @@ +import{t as e}from"./chat-CXc2E7RV.js";var t=e;export{t as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/chat.index-Bgm22VZM.js b/internal/ui/dist/assets/chat.index-Bgm22VZM.js deleted file mode 100644 index 586d216a9..000000000 --- a/internal/ui/dist/assets/chat.index-Bgm22VZM.js +++ /dev/null @@ -1 +0,0 @@ -import{t as e}from"./chat-CDsGWYjG.js";var t=e;export{t as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/chat.index-Cjkl3RJK.js b/internal/ui/dist/assets/chat.index-Cjkl3RJK.js new file mode 100644 index 000000000..25d16d66d --- /dev/null +++ b/internal/ui/dist/assets/chat.index-Cjkl3RJK.js @@ -0,0 +1 @@ +import{t as e}from"./chat-CXc2E7RV.js";var t=e;export{t as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/dashboard-change-chips-DDCZ8miS.js b/internal/ui/dist/assets/dashboard-change-chips-myL7tsV1.js similarity index 99% rename from internal/ui/dist/assets/dashboard-change-chips-DDCZ8miS.js rename to internal/ui/dist/assets/dashboard-change-chips-myL7tsV1.js index 4a058a993..67166d238 100644 --- a/internal/ui/dist/assets/dashboard-change-chips-DDCZ8miS.js +++ b/internal/ui/dist/assets/dashboard-change-chips-myL7tsV1.js @@ -1,4 +1,4 @@ -import{a as e,i as t,o as n,r,s as i}from"./useRouter-ByJ6_rwb.js";import{A as a,C as o,K as s,M as c,P as l,Q as u,T as d,X as f,_ as p,_t as m,a as h,et as g,mt as _,rt as v,ut as y,z as b}from"./brand-DUaZkIz1.js";import{E as x,S,o as C}from"./Tooltip-B3r3s_B9.js";import{It as w}from"./index-_VmsjY84.js";var T=i(t(),1),E=i(m(),1);function D(e){if(!e||typeof e==`string`)return 0;let t=e/36;return Math.round((4+15*t**.25+t/5)*10)}function O(e){return e.current?e.current.scrollHeight:`auto`}function k(e){return typeof e==`number`&&e>0}function ee({transitionDuration:e,transitionTimingFunction:t=`ease`,onTransitionEnd:n,onTransitionStart:r,expanded:i,keepMounted:a}){let o={height:0,overflow:`hidden`,...a?{}:{display:`none`}},s=(0,T.useEffectEvent)(()=>r?.()),c=(0,T.useEffectEvent)(()=>n?.()),l=(0,T.useRef)(null),[u,d]=(0,T.useState)(i?{}:o),[f,p]=(0,T.useState)(i?`entered`:`exited`),m=e=>{(0,E.flushSync)(()=>d(e))},h=e=>{m(t=>({...t,...e}))},_=n=>{let r=e??D(n);return{transition:`height ${r}ms ${t}, opacity ${r}ms ${t}`}},y=(0,T.useRef)(0);v(()=>{y.current+=1;let t=y.current,n=()=>y.current===t;e!==0&&s(),i?window.requestAnimationFrame(()=>{n()&&l.current&&((0,E.flushSync)(()=>p(`entering`)),h({willChange:`height`,display:`block`,overflow:`hidden`}),window.requestAnimationFrame(()=>{if(!n()||!l.current)return;let e=O(l);if(!k(e)){m({}),p(`entered`),c();return}h({..._(e),height:e})}))}):window.requestAnimationFrame(()=>{if(!n()||!l.current)return;(0,E.flushSync)(()=>p(`exiting`));let e=O(l);if(!k(e)){m(o),p(`exited`),c();return}h({..._(e),willChange:`height`,height:e}),window.requestAnimationFrame(()=>{n()&&l.current&&h({height:0,overflow:`hidden`})})})},[i]);let b=e=>{if(e.target===l.current&&e.propertyName===`height`){if(i){let e=O(l);e===u.height?m({}):h({height:e}),p(`entered`),c()}else u.height===0&&(m(o),p(`exited`),c())}};return{state:f,getCollapseProps:e=>({"aria-hidden":!i,inert:!i,ref:g(l,e?.ref),onTransitionEnd:b,style:{boxSizing:`border-box`,...e?.style,...u}})}}function te(e){if(!e||typeof e==`string`)return 0;let t=e/36;return Math.round((4+15*t**.25+t/5)*10)}function A(e){return e.current?e.current.scrollWidth:`auto`}function j({transitionDuration:e,transitionTimingFunction:t=`ease`,onTransitionEnd:n,onTransitionStart:r,expanded:i,keepMounted:a}){let o={width:0,overflow:`hidden`,...a?{}:{display:`none`}},s=(0,T.useEffectEvent)(()=>r?.()),c=(0,T.useEffectEvent)(()=>n?.()),l=(0,T.useRef)(null),[u,d]=(0,T.useState)(i?{}:o),[f,p]=(0,T.useState)(i?`entered`:`exited`),m=e=>{(0,E.flushSync)(()=>d(e))},h=e=>{m(t=>({...t,...e}))},_=n=>{let r=e??te(n);return{transition:`width ${r}ms ${t}, opacity ${r}ms ${t}`}},y=(0,T.useRef)(0);v(()=>{y.current+=1;let t=y.current,n=()=>y.current===t;e!==0&&s(),i?window.requestAnimationFrame(()=>{n()&&l.current&&((0,E.flushSync)(()=>p(`entering`)),h({willChange:`width`,display:`block`,overflow:`hidden`}),window.requestAnimationFrame(()=>{if(!n()||!l.current)return;let e=A(l);if(!k(e)){m({}),p(`entered`),c();return}h({..._(e),width:e})}))}):window.requestAnimationFrame(()=>{if(!n()||!l.current)return;(0,E.flushSync)(()=>p(`exiting`));let e=A(l);if(!k(e)){m(o),p(`exited`),c();return}h({..._(e),willChange:`width`,width:e}),window.requestAnimationFrame(()=>{n()&&l.current&&h({width:0,overflow:`hidden`})})})},[i]);let b=e=>{if(e.target===l.current&&e.propertyName===`width`){if(i){let e=A(l);e===u.width?m({}):h({width:e}),p(`entered`),c()}else u.width===0&&(m(o),p(`exited`),c())}};return{state:f,getCollapseProps:e=>({"aria-hidden":!i,inert:!i,ref:g(l,e?.ref),onTransitionEnd:b,style:{boxSizing:`border-box`,...e?.style,...u}})}}function ne(){return`development`}var M=r(),N={transitionDuration:200,transitionTimingFunction:`ease`,animateOpacity:!0,orientation:`vertical`,keepMounted:!0,keepMountedMode:`activity`},re=d(e=>{let{children:t,expanded:n,transitionDuration:r,transitionTimingFunction:i,style:a,onTransitionEnd:s,onTransitionStart:d,animateOpacity:f,keepMounted:p,keepMountedMode:m,ref:h,orientation:g,..._}=c(`Collapse`,N,e),v=b(),y=l(),x=u(),C=y.respectReducedMotion&&x?0:r,w=(g===`horizontal`?j:ee)({expanded:n,transitionDuration:C,transitionTimingFunction:i,onTransitionEnd:s,onTransitionStart:d,keepMounted:!1});if(C===0)return p===!0&&(m===`display-none`||v!==`test`)?m===`display-none`?(0,M.jsx)(o,{..._,style:{...S(a,y),...n?{}:{display:`none`}},ref:h,children:t}):(0,M.jsx)(T.Activity,{mode:n?`visible`:`hidden`,children:(0,M.jsx)(o,{..._,style:a,ref:h,children:t})}):n?(0,M.jsx)(o,{..._,style:a,ref:h,children:t}):null;let E=w.state===`exited`,D;return D=p===!1?E?null:t:p===!0?m===`display-none`?t:(0,M.jsx)(T.Activity,{mode:E?`hidden`:`visible`,children:t}):t,(0,M.jsx)(o,{..._,...w.getCollapseProps({style:{opacity:n||!f?1:0,transition:f?`opacity ${C}ms ${i}`:`none`,...S(a,y),...p&&m===`display-none`&&E?{display:`none`}:{}},ref:h}),children:D})});re.displayName=`@mantine/core/Collapse`;var[ie,ae]=x(`Table component was not found in the tree`),oe={table:`m_b23fa0ef`,th:`m_4e7aa4f3`,tr:`m_4e7aa4fd`,td:`m_4e7aa4ef`,tbody:`m_b2404537`,thead:`m_b242d975`,caption:`m_9e5a3ac7`,scrollContainer:`m_a100c15`,scrollContainerInner:`m_62259741`};function se(e,t){if(!t)return;let n={};return t.columnBorder&&e.withColumnBorders&&(n[`data-with-column-border`]=!0),t.rowBorder&&e.withRowBorders&&(n[`data-with-row-border`]=!0),t.striped&&e.striped&&(n[`data-striped`]=e.striped),t.highlightOnHover&&e.highlightOnHover&&(n[`data-hover`]=!0),t.captionSide&&e.captionSide&&(n[`data-side`]=e.captionSide),t.stickyHeader&&e.stickyHeader&&(n[`data-sticky`]=!0),n}function ce(e,t){let n=`Table${e.charAt(0).toUpperCase()}${e.slice(1)}`,r=d(r=>{let i=c(n,{},r),{classNames:a,className:s,style:l,styles:u,...d}=i,f=ae();return(0,M.jsx)(o,{component:e,...se(f,t),...f.getStyles(e,{className:s,classNames:a,style:l,styles:u,props:i}),...d})});return r.displayName=`@mantine/core/${n}`,r.classes=oe,r}var le=ce(`th`,{columnBorder:!0}),ue=ce(`td`,{columnBorder:!0}),de=ce(`tr`,{rowBorder:!0,striped:!0,highlightOnHover:!0}),fe=ce(`thead`,{stickyHeader:!0}),pe=ce(`tbody`),me=ce(`tfoot`),he=ce(`caption`,{captionSide:!0}),ge={type:`scrollarea`},_e=f((e,{minWidth:t,maxHeight:n,type:r})=>({scrollContainer:{"--table-min-width":_(t),"--table-max-height":_(n),"--table-overflow":r===`native`?`auto`:void 0}})),ve=d(e=>{let t=c(`TableScrollContainer`,ge,e),{classNames:n,className:r,style:i,styles:s,unstyled:l,vars:u,children:d,minWidth:f,maxHeight:p,type:m,scrollAreaProps:h,attributes:g,..._}=t,v=a({name:`TableScrollContainer`,classes:oe,props:t,className:r,style:i,classNames:n,styles:s,unstyled:l,attributes:g,vars:u,varsResolver:_e,rootSelector:`scrollContainer`});return(0,M.jsx)(o,{component:m===`scrollarea`?C:`div`,...m===`scrollarea`?p?{offsetScrollbars:`xy`,...h}:{offsetScrollbars:`x`,...h}:{},...v(`scrollContainer`),..._,children:(0,M.jsx)(`div`,{...v(`scrollContainerInner`),children:d})})});ve.classes=oe,ve.varsResolver=_e,ve.displayName=`@mantine/core/TableScrollContainer`;function ye({data:e}){return(0,M.jsxs)(M.Fragment,{children:[e.caption&&(0,M.jsx)(he,{children:e.caption}),e.head&&(0,M.jsx)(fe,{children:(0,M.jsx)(de,{children:e.head.map((e,t)=>(0,M.jsx)(le,{children:e},t))})}),e.body&&(0,M.jsx)(pe,{children:e.body.map((e,t)=>(0,M.jsx)(de,{children:e.map((e,t)=>(0,M.jsx)(ue,{children:e},t))},t))}),e.foot&&(0,M.jsx)(me,{children:(0,M.jsx)(de,{children:e.foot.map((e,t)=>(0,M.jsx)(le,{children:e},t))})})]})}ye.displayName=`@mantine/core/TableDataRenderer`;var be={withRowBorders:!0,verticalSpacing:7},xe=f((e,{layout:t,captionSide:n,horizontalSpacing:r,verticalSpacing:i,borderColor:a,stripedColor:o,highlightOnHoverColor:c,striped:l,highlightOnHover:u,stickyHeaderOffset:d,stickyHeader:f})=>({table:{"--table-layout":t,"--table-caption-side":n,"--table-horizontal-spacing":y(r),"--table-vertical-spacing":y(i),"--table-border-color":a?s(a,e):void 0,"--table-striped-color":l&&o?s(o,e):void 0,"--table-highlight-on-hover-color":u&&c?s(c,e):void 0,"--table-sticky-header-offset":f?_(d):void 0}})),P=d(e=>{let t=c(`Table`,be,e),{classNames:n,className:r,style:i,styles:s,unstyled:l,vars:u,horizontalSpacing:d,verticalSpacing:f,captionSide:p,stripedColor:m,highlightOnHoverColor:h,striped:g,highlightOnHover:_,withColumnBorders:v,withRowBorders:y,withTableBorder:b,borderColor:x,layout:S,data:C,children:w,stickyHeader:E,stickyHeaderOffset:D,mod:O,tabularNums:k,attributes:ee,...te}=t,A=a({name:`Table`,props:t,className:r,style:i,classes:oe,classNames:n,styles:s,unstyled:l,attributes:ee,rootSelector:`table`,vars:u,varsResolver:xe,stable:!0}),j=g===!0?`odd`:g||void 0,ne=p||`bottom`,N=(0,T.useMemo)(()=>({getStyles:A,stickyHeader:E,striped:j,highlightOnHover:_,withColumnBorders:v,withRowBorders:y,captionSide:ne}),[A,E,j,_,v,y,ne]);return(0,M.jsx)(ie,{value:N,children:(0,M.jsx)(o,{component:`table`,mod:[{withTableBorder:b,tabularNums:k},O],...A(`table`),...te,children:w||!!C&&(0,M.jsx)(ye,{data:C})})})});P.classes=oe,P.varsResolver=xe,P.displayName=`@mantine/core/Table`,P.Td=ue,P.Th=le,P.Tr=de,P.Thead=fe,P.Tbody=pe,P.Tfoot=me,P.Caption=he,P.ScrollContainer=ve,P.DataRenderer=ye;var Se=new Map([[`bold`,T.createElement(T.Fragment,null,T.createElement(`path`,{d:`M216.49,104.49l-80,80a12,12,0,0,1-17,0l-80-80a12,12,0,0,1,17-17L128,159l71.51-71.52a12,12,0,0,1,17,17Z`}))],[`duotone`,T.createElement(T.Fragment,null,T.createElement(`path`,{d:`M208,96l-80,80L48,96Z`,opacity:`0.2`}),T.createElement(`path`,{d:`M215.39,92.94A8,8,0,0,0,208,88H48a8,8,0,0,0-5.66,13.66l80,80a8,8,0,0,0,11.32,0l80-80A8,8,0,0,0,215.39,92.94ZM128,164.69,67.31,104H188.69Z`}))],[`fill`,T.createElement(T.Fragment,null,T.createElement(`path`,{d:`M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,48,88H208a8,8,0,0,1,5.66,13.66Z`}))],[`light`,T.createElement(T.Fragment,null,T.createElement(`path`,{d:`M212.24,100.24l-80,80a6,6,0,0,1-8.48,0l-80-80a6,6,0,0,1,8.48-8.48L128,167.51l75.76-75.75a6,6,0,0,1,8.48,8.48Z`}))],[`regular`,T.createElement(T.Fragment,null,T.createElement(`path`,{d:`M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z`}))],[`thin`,T.createElement(T.Fragment,null,T.createElement(`path`,{d:`M210.83,98.83l-80,80a4,4,0,0,1-5.66,0l-80-80a4,4,0,0,1,5.66-5.66L128,170.34l77.17-77.17a4,4,0,1,1,5.66,5.66Z`}))]]),Ce=T.forwardRef((e,t)=>T.createElement(h,{ref:t,...e,weights:Se}));Ce.displayName=`CaretDownIcon`;var we=Ce,Te=new Intl.NumberFormat(void 0,{maximumFractionDigits:0});function Ee(e){return Number.isFinite(e)?e>0&&e<1e-4?`<0.01%`:`${(e*100).toFixed(e>=.1?1:2)}%`:`—`}function De(e){if(!Number.isFinite(e))return`—`;if(e<0)return`-${De(-e)}`;if(e===0)return`0ms`;if(e<.01)return`<0.01ms`;if(e<1)return`${e.toFixed(2)}ms`;if(Math.round(e*10)/10<100)return`${e.toFixed(1)}ms`;if(Math.round(e)<1e3)return`${Math.round(e)}ms`;let t=Math.round(e/100)/10;if(t<10)return`${(e/1e3).toFixed(2)}s`;if(t<60)return`${t.toFixed(1)}s`;let n=Math.round(e/1e3),r=Math.floor(n/60),i=n%60;if(r<60)return i===0?`${r}m`:`${r}m ${i}s`;let a=Math.floor(r/60),o=r%60;return o===0?`${a}h`:`${a}h ${o}m`}function Oe(e){let t=e instanceof Date?e:new Date(e);return Number.isNaN(t.valueOf())?String(e):t.toLocaleString([],{year:`numeric`,month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`,second:`2-digit`,timeZoneName:`short`})}function ke(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var Ae=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,je=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Me={};function Ne(e,t){return((t||Me).jsx?je:Ae).test(e)}var Pe=/[ \t\n\f\r]/g;function Fe(e){return typeof e==`object`?e.type===`text`&&Ie(e.value):Ie(e)}function Ie(e){return e.replace(Pe,``)===``}var Le=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};Le.prototype.normal={},Le.prototype.property={},Le.prototype.space=void 0;function Re(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new Le(n,r,t)}function ze(e){return e.toLowerCase()}var F=class{constructor(e,t){this.attribute=t,this.property=e}};F.prototype.attribute=``,F.prototype.booleanish=!1,F.prototype.boolean=!1,F.prototype.commaOrSpaceSeparated=!1,F.prototype.commaSeparated=!1,F.prototype.defined=!1,F.prototype.mustUseProperty=!1,F.prototype.number=!1,F.prototype.overloadedBoolean=!1,F.prototype.property=``,F.prototype.spaceSeparated=!1,F.prototype.space=void 0;var Be=n({boolean:()=>I,booleanish:()=>L,commaOrSpaceSeparated:()=>B,commaSeparated:()=>Ue,number:()=>R,overloadedBoolean:()=>He,spaceSeparated:()=>z}),Ve=0,I=We(),L=We(),He=We(),R=We(),z=We(),Ue=We(),B=We();function We(){return 2**++Ve}var Ge=Object.keys(Be),Ke=class extends F{constructor(e,t,n,r){let i=-1;if(super(e,t),qe(this,`space`,r),typeof n==`number`)for(;++i4&&n.slice(0,4)===`data`&&ot.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(at,lt);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!at.test(e)){let n=e.replace(it,ct);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=Ke}return new i(r,t)}function ct(e){return`-`+e.toLowerCase()}function lt(e){return e.charAt(1).toUpperCase()}var ut=Re([Ye,Qe,et,tt,nt],`html`),dt=Re([Ye,$e,et,tt,nt],`svg`);function ft(e){return e.join(` `).trim()}var pt=e(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(` +import{a as e,i as t,o as n,r,s as i}from"./useRouter-ByJ6_rwb.js";import{A as a,C as o,K as s,M as c,P as l,Q as u,T as d,X as f,_ as p,_t as m,a as h,et as g,mt as _,rt as v,ut as y,z as b}from"./brand-DUaZkIz1.js";import{E as x,S,o as C}from"./Tooltip-B3r3s_B9.js";import{It as w}from"./index-Du7sNMda.js";var T=i(t(),1),E=i(m(),1);function D(e){if(!e||typeof e==`string`)return 0;let t=e/36;return Math.round((4+15*t**.25+t/5)*10)}function O(e){return e.current?e.current.scrollHeight:`auto`}function k(e){return typeof e==`number`&&e>0}function ee({transitionDuration:e,transitionTimingFunction:t=`ease`,onTransitionEnd:n,onTransitionStart:r,expanded:i,keepMounted:a}){let o={height:0,overflow:`hidden`,...a?{}:{display:`none`}},s=(0,T.useEffectEvent)(()=>r?.()),c=(0,T.useEffectEvent)(()=>n?.()),l=(0,T.useRef)(null),[u,d]=(0,T.useState)(i?{}:o),[f,p]=(0,T.useState)(i?`entered`:`exited`),m=e=>{(0,E.flushSync)(()=>d(e))},h=e=>{m(t=>({...t,...e}))},_=n=>{let r=e??D(n);return{transition:`height ${r}ms ${t}, opacity ${r}ms ${t}`}},y=(0,T.useRef)(0);v(()=>{y.current+=1;let t=y.current,n=()=>y.current===t;e!==0&&s(),i?window.requestAnimationFrame(()=>{n()&&l.current&&((0,E.flushSync)(()=>p(`entering`)),h({willChange:`height`,display:`block`,overflow:`hidden`}),window.requestAnimationFrame(()=>{if(!n()||!l.current)return;let e=O(l);if(!k(e)){m({}),p(`entered`),c();return}h({..._(e),height:e})}))}):window.requestAnimationFrame(()=>{if(!n()||!l.current)return;(0,E.flushSync)(()=>p(`exiting`));let e=O(l);if(!k(e)){m(o),p(`exited`),c();return}h({..._(e),willChange:`height`,height:e}),window.requestAnimationFrame(()=>{n()&&l.current&&h({height:0,overflow:`hidden`})})})},[i]);let b=e=>{if(e.target===l.current&&e.propertyName===`height`){if(i){let e=O(l);e===u.height?m({}):h({height:e}),p(`entered`),c()}else u.height===0&&(m(o),p(`exited`),c())}};return{state:f,getCollapseProps:e=>({"aria-hidden":!i,inert:!i,ref:g(l,e?.ref),onTransitionEnd:b,style:{boxSizing:`border-box`,...e?.style,...u}})}}function te(e){if(!e||typeof e==`string`)return 0;let t=e/36;return Math.round((4+15*t**.25+t/5)*10)}function A(e){return e.current?e.current.scrollWidth:`auto`}function j({transitionDuration:e,transitionTimingFunction:t=`ease`,onTransitionEnd:n,onTransitionStart:r,expanded:i,keepMounted:a}){let o={width:0,overflow:`hidden`,...a?{}:{display:`none`}},s=(0,T.useEffectEvent)(()=>r?.()),c=(0,T.useEffectEvent)(()=>n?.()),l=(0,T.useRef)(null),[u,d]=(0,T.useState)(i?{}:o),[f,p]=(0,T.useState)(i?`entered`:`exited`),m=e=>{(0,E.flushSync)(()=>d(e))},h=e=>{m(t=>({...t,...e}))},_=n=>{let r=e??te(n);return{transition:`width ${r}ms ${t}, opacity ${r}ms ${t}`}},y=(0,T.useRef)(0);v(()=>{y.current+=1;let t=y.current,n=()=>y.current===t;e!==0&&s(),i?window.requestAnimationFrame(()=>{n()&&l.current&&((0,E.flushSync)(()=>p(`entering`)),h({willChange:`width`,display:`block`,overflow:`hidden`}),window.requestAnimationFrame(()=>{if(!n()||!l.current)return;let e=A(l);if(!k(e)){m({}),p(`entered`),c();return}h({..._(e),width:e})}))}):window.requestAnimationFrame(()=>{if(!n()||!l.current)return;(0,E.flushSync)(()=>p(`exiting`));let e=A(l);if(!k(e)){m(o),p(`exited`),c();return}h({..._(e),willChange:`width`,width:e}),window.requestAnimationFrame(()=>{n()&&l.current&&h({width:0,overflow:`hidden`})})})},[i]);let b=e=>{if(e.target===l.current&&e.propertyName===`width`){if(i){let e=A(l);e===u.width?m({}):h({width:e}),p(`entered`),c()}else u.width===0&&(m(o),p(`exited`),c())}};return{state:f,getCollapseProps:e=>({"aria-hidden":!i,inert:!i,ref:g(l,e?.ref),onTransitionEnd:b,style:{boxSizing:`border-box`,...e?.style,...u}})}}function ne(){return`development`}var M=r(),N={transitionDuration:200,transitionTimingFunction:`ease`,animateOpacity:!0,orientation:`vertical`,keepMounted:!0,keepMountedMode:`activity`},re=d(e=>{let{children:t,expanded:n,transitionDuration:r,transitionTimingFunction:i,style:a,onTransitionEnd:s,onTransitionStart:d,animateOpacity:f,keepMounted:p,keepMountedMode:m,ref:h,orientation:g,..._}=c(`Collapse`,N,e),v=b(),y=l(),x=u(),C=y.respectReducedMotion&&x?0:r,w=(g===`horizontal`?j:ee)({expanded:n,transitionDuration:C,transitionTimingFunction:i,onTransitionEnd:s,onTransitionStart:d,keepMounted:!1});if(C===0)return p===!0&&(m===`display-none`||v!==`test`)?m===`display-none`?(0,M.jsx)(o,{..._,style:{...S(a,y),...n?{}:{display:`none`}},ref:h,children:t}):(0,M.jsx)(T.Activity,{mode:n?`visible`:`hidden`,children:(0,M.jsx)(o,{..._,style:a,ref:h,children:t})}):n?(0,M.jsx)(o,{..._,style:a,ref:h,children:t}):null;let E=w.state===`exited`,D;return D=p===!1?E?null:t:p===!0?m===`display-none`?t:(0,M.jsx)(T.Activity,{mode:E?`hidden`:`visible`,children:t}):t,(0,M.jsx)(o,{..._,...w.getCollapseProps({style:{opacity:n||!f?1:0,transition:f?`opacity ${C}ms ${i}`:`none`,...S(a,y),...p&&m===`display-none`&&E?{display:`none`}:{}},ref:h}),children:D})});re.displayName=`@mantine/core/Collapse`;var[ie,ae]=x(`Table component was not found in the tree`),oe={table:`m_b23fa0ef`,th:`m_4e7aa4f3`,tr:`m_4e7aa4fd`,td:`m_4e7aa4ef`,tbody:`m_b2404537`,thead:`m_b242d975`,caption:`m_9e5a3ac7`,scrollContainer:`m_a100c15`,scrollContainerInner:`m_62259741`};function se(e,t){if(!t)return;let n={};return t.columnBorder&&e.withColumnBorders&&(n[`data-with-column-border`]=!0),t.rowBorder&&e.withRowBorders&&(n[`data-with-row-border`]=!0),t.striped&&e.striped&&(n[`data-striped`]=e.striped),t.highlightOnHover&&e.highlightOnHover&&(n[`data-hover`]=!0),t.captionSide&&e.captionSide&&(n[`data-side`]=e.captionSide),t.stickyHeader&&e.stickyHeader&&(n[`data-sticky`]=!0),n}function ce(e,t){let n=`Table${e.charAt(0).toUpperCase()}${e.slice(1)}`,r=d(r=>{let i=c(n,{},r),{classNames:a,className:s,style:l,styles:u,...d}=i,f=ae();return(0,M.jsx)(o,{component:e,...se(f,t),...f.getStyles(e,{className:s,classNames:a,style:l,styles:u,props:i}),...d})});return r.displayName=`@mantine/core/${n}`,r.classes=oe,r}var le=ce(`th`,{columnBorder:!0}),ue=ce(`td`,{columnBorder:!0}),de=ce(`tr`,{rowBorder:!0,striped:!0,highlightOnHover:!0}),fe=ce(`thead`,{stickyHeader:!0}),pe=ce(`tbody`),me=ce(`tfoot`),he=ce(`caption`,{captionSide:!0}),ge={type:`scrollarea`},_e=f((e,{minWidth:t,maxHeight:n,type:r})=>({scrollContainer:{"--table-min-width":_(t),"--table-max-height":_(n),"--table-overflow":r===`native`?`auto`:void 0}})),ve=d(e=>{let t=c(`TableScrollContainer`,ge,e),{classNames:n,className:r,style:i,styles:s,unstyled:l,vars:u,children:d,minWidth:f,maxHeight:p,type:m,scrollAreaProps:h,attributes:g,..._}=t,v=a({name:`TableScrollContainer`,classes:oe,props:t,className:r,style:i,classNames:n,styles:s,unstyled:l,attributes:g,vars:u,varsResolver:_e,rootSelector:`scrollContainer`});return(0,M.jsx)(o,{component:m===`scrollarea`?C:`div`,...m===`scrollarea`?p?{offsetScrollbars:`xy`,...h}:{offsetScrollbars:`x`,...h}:{},...v(`scrollContainer`),..._,children:(0,M.jsx)(`div`,{...v(`scrollContainerInner`),children:d})})});ve.classes=oe,ve.varsResolver=_e,ve.displayName=`@mantine/core/TableScrollContainer`;function ye({data:e}){return(0,M.jsxs)(M.Fragment,{children:[e.caption&&(0,M.jsx)(he,{children:e.caption}),e.head&&(0,M.jsx)(fe,{children:(0,M.jsx)(de,{children:e.head.map((e,t)=>(0,M.jsx)(le,{children:e},t))})}),e.body&&(0,M.jsx)(pe,{children:e.body.map((e,t)=>(0,M.jsx)(de,{children:e.map((e,t)=>(0,M.jsx)(ue,{children:e},t))},t))}),e.foot&&(0,M.jsx)(me,{children:(0,M.jsx)(de,{children:e.foot.map((e,t)=>(0,M.jsx)(le,{children:e},t))})})]})}ye.displayName=`@mantine/core/TableDataRenderer`;var be={withRowBorders:!0,verticalSpacing:7},xe=f((e,{layout:t,captionSide:n,horizontalSpacing:r,verticalSpacing:i,borderColor:a,stripedColor:o,highlightOnHoverColor:c,striped:l,highlightOnHover:u,stickyHeaderOffset:d,stickyHeader:f})=>({table:{"--table-layout":t,"--table-caption-side":n,"--table-horizontal-spacing":y(r),"--table-vertical-spacing":y(i),"--table-border-color":a?s(a,e):void 0,"--table-striped-color":l&&o?s(o,e):void 0,"--table-highlight-on-hover-color":u&&c?s(c,e):void 0,"--table-sticky-header-offset":f?_(d):void 0}})),P=d(e=>{let t=c(`Table`,be,e),{classNames:n,className:r,style:i,styles:s,unstyled:l,vars:u,horizontalSpacing:d,verticalSpacing:f,captionSide:p,stripedColor:m,highlightOnHoverColor:h,striped:g,highlightOnHover:_,withColumnBorders:v,withRowBorders:y,withTableBorder:b,borderColor:x,layout:S,data:C,children:w,stickyHeader:E,stickyHeaderOffset:D,mod:O,tabularNums:k,attributes:ee,...te}=t,A=a({name:`Table`,props:t,className:r,style:i,classes:oe,classNames:n,styles:s,unstyled:l,attributes:ee,rootSelector:`table`,vars:u,varsResolver:xe,stable:!0}),j=g===!0?`odd`:g||void 0,ne=p||`bottom`,N=(0,T.useMemo)(()=>({getStyles:A,stickyHeader:E,striped:j,highlightOnHover:_,withColumnBorders:v,withRowBorders:y,captionSide:ne}),[A,E,j,_,v,y,ne]);return(0,M.jsx)(ie,{value:N,children:(0,M.jsx)(o,{component:`table`,mod:[{withTableBorder:b,tabularNums:k},O],...A(`table`),...te,children:w||!!C&&(0,M.jsx)(ye,{data:C})})})});P.classes=oe,P.varsResolver=xe,P.displayName=`@mantine/core/Table`,P.Td=ue,P.Th=le,P.Tr=de,P.Thead=fe,P.Tbody=pe,P.Tfoot=me,P.Caption=he,P.ScrollContainer=ve,P.DataRenderer=ye;var Se=new Map([[`bold`,T.createElement(T.Fragment,null,T.createElement(`path`,{d:`M216.49,104.49l-80,80a12,12,0,0,1-17,0l-80-80a12,12,0,0,1,17-17L128,159l71.51-71.52a12,12,0,0,1,17,17Z`}))],[`duotone`,T.createElement(T.Fragment,null,T.createElement(`path`,{d:`M208,96l-80,80L48,96Z`,opacity:`0.2`}),T.createElement(`path`,{d:`M215.39,92.94A8,8,0,0,0,208,88H48a8,8,0,0,0-5.66,13.66l80,80a8,8,0,0,0,11.32,0l80-80A8,8,0,0,0,215.39,92.94ZM128,164.69,67.31,104H188.69Z`}))],[`fill`,T.createElement(T.Fragment,null,T.createElement(`path`,{d:`M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,48,88H208a8,8,0,0,1,5.66,13.66Z`}))],[`light`,T.createElement(T.Fragment,null,T.createElement(`path`,{d:`M212.24,100.24l-80,80a6,6,0,0,1-8.48,0l-80-80a6,6,0,0,1,8.48-8.48L128,167.51l75.76-75.75a6,6,0,0,1,8.48,8.48Z`}))],[`regular`,T.createElement(T.Fragment,null,T.createElement(`path`,{d:`M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z`}))],[`thin`,T.createElement(T.Fragment,null,T.createElement(`path`,{d:`M210.83,98.83l-80,80a4,4,0,0,1-5.66,0l-80-80a4,4,0,0,1,5.66-5.66L128,170.34l77.17-77.17a4,4,0,1,1,5.66,5.66Z`}))]]),Ce=T.forwardRef((e,t)=>T.createElement(h,{ref:t,...e,weights:Se}));Ce.displayName=`CaretDownIcon`;var we=Ce,Te=new Intl.NumberFormat(void 0,{maximumFractionDigits:0});function Ee(e){return Number.isFinite(e)?e>0&&e<1e-4?`<0.01%`:`${(e*100).toFixed(e>=.1?1:2)}%`:`—`}function De(e){if(!Number.isFinite(e))return`—`;if(e<0)return`-${De(-e)}`;if(e===0)return`0ms`;if(e<.01)return`<0.01ms`;if(e<1)return`${e.toFixed(2)}ms`;if(Math.round(e*10)/10<100)return`${e.toFixed(1)}ms`;if(Math.round(e)<1e3)return`${Math.round(e)}ms`;let t=Math.round(e/100)/10;if(t<10)return`${(e/1e3).toFixed(2)}s`;if(t<60)return`${t.toFixed(1)}s`;let n=Math.round(e/1e3),r=Math.floor(n/60),i=n%60;if(r<60)return i===0?`${r}m`:`${r}m ${i}s`;let a=Math.floor(r/60),o=r%60;return o===0?`${a}h`:`${a}h ${o}m`}function Oe(e){let t=e instanceof Date?e:new Date(e);return Number.isNaN(t.valueOf())?String(e):t.toLocaleString([],{year:`numeric`,month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`,second:`2-digit`,timeZoneName:`short`})}function ke(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var Ae=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,je=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Me={};function Ne(e,t){return((t||Me).jsx?je:Ae).test(e)}var Pe=/[ \t\n\f\r]/g;function Fe(e){return typeof e==`object`?e.type===`text`&&Ie(e.value):Ie(e)}function Ie(e){return e.replace(Pe,``)===``}var Le=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};Le.prototype.normal={},Le.prototype.property={},Le.prototype.space=void 0;function Re(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new Le(n,r,t)}function ze(e){return e.toLowerCase()}var F=class{constructor(e,t){this.attribute=t,this.property=e}};F.prototype.attribute=``,F.prototype.booleanish=!1,F.prototype.boolean=!1,F.prototype.commaOrSpaceSeparated=!1,F.prototype.commaSeparated=!1,F.prototype.defined=!1,F.prototype.mustUseProperty=!1,F.prototype.number=!1,F.prototype.overloadedBoolean=!1,F.prototype.property=``,F.prototype.spaceSeparated=!1,F.prototype.space=void 0;var Be=n({boolean:()=>I,booleanish:()=>L,commaOrSpaceSeparated:()=>B,commaSeparated:()=>Ue,number:()=>R,overloadedBoolean:()=>He,spaceSeparated:()=>z}),Ve=0,I=We(),L=We(),He=We(),R=We(),z=We(),Ue=We(),B=We();function We(){return 2**++Ve}var Ge=Object.keys(Be),Ke=class extends F{constructor(e,t,n,r){let i=-1;if(super(e,t),qe(this,`space`,r),typeof n==`number`)for(;++i4&&n.slice(0,4)===`data`&&ot.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(at,lt);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!at.test(e)){let n=e.replace(it,ct);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=Ke}return new i(r,t)}function ct(e){return`-`+e.toLowerCase()}function lt(e){return e.charAt(1).toUpperCase()}var ut=Re([Ye,Qe,et,tt,nt],`html`),dt=Re([Ye,$e,et,tt,nt],`svg`);function ft(e){return e.join(` `).trim()}var pt=e(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(` `);u=~n?e.length-n:u+e.length}function p(){var e={line:l,column:u};return function(t){return t.position=new m(e),_(),t}}function m(e){this.start=e,this.end={line:l,column:u},this.source=t.source}m.prototype.content=e;function h(n){var r=Error(t.source+`:`+l+`:`+u+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=u,r.source=e,!t.silent)throw r}function g(t){var n=t.exec(e);if(n){var r=n[0];return f(r),e=e.slice(r.length),n}}function _(){g(i)}function v(e){var t;for(e||=[];t=y();)t!==!1&&e.push(t);return e}function y(){var t=p();if(e.charAt(0)==`/`&&e.charAt(1)==`*`){for(var n=2;e.charAt(n)!=``&&(e.charAt(n)!=`*`||e.charAt(n+1)!=`/`);)++n;if(n+=2,e.charAt(n-1)===``)return h(`End of comment missing`);var r=e.slice(2,n-2);return u+=2,f(r),e=e.slice(n),u+=2,t({type:`comment`,comment:r})}}function b(){var e=p(),t=g(a);if(t){if(y(),!g(o))return h(`property missing ':'`);var r=g(s),i=e({type:`declaration`,property:d(t[0].replace(n,``)),value:r?d(r[0].replace(n,``)):``});return g(c),i}}function x(){var e=[];v(e);for(var t;t=b();)t!==!1&&(e.push(t),v(e));return e}return _(),x()}function d(e){return e?e.replace(l,``):``}t.exports=u})),mt=e((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=r;var n=t(pt());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),ht=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),gt=e(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(mt()),r=ht();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),_t=yt(`end`),vt=yt(`start`);function yt(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function bt(e){let t=vt(e),n=_t(e);if(t&&n)return{start:t,end:n}}function xt(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?Ct(e.position):`start`in e||`end`in e?Ct(e):`line`in e||`column`in e?St(e):``}function St(e){return wt(e&&e.line)+`:`+wt(e&&e.column)}function Ct(e){return St(e&&e.start)+`-`+St(e&&e.end)}function wt(e){return e&&typeof e==`number`?e:1}var V=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=xt(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};V.prototype.file=``,V.prototype.name=``,V.prototype.reason=``,V.prototype.message=``,V.prototype.stack=``,V.prototype.column=void 0,V.prototype.line=void 0,V.prototype.ancestors=void 0,V.prototype.cause=void 0,V.prototype.fatal=void 0,V.prototype.place=void 0,V.prototype.ruleId=void 0,V.prototype.source=void 0;var Tt=i(gt(),1),Et={}.hasOwnProperty,Dt=new Map,Ot=/[A-Z]/g,kt=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),At=new Set([`td`,`th`]),jt=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function Mt(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=Ut(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=Ht(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?dt:ut,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Nt(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Nt(e,t,n){if(t.type===`element`)return Pt(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return Ft(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return Lt(e,t,n);if(t.type===`mdxjsEsm`)return It(e,t);if(t.type===`root`)return Rt(e,t,n);if(t.type===`text`)return zt(e,t)}function Pt(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=dt,e.schema=i),e.ancestors.push(t);let a=Yt(e,t.tagName,!1),o=Wt(e,t),s=Kt(e,t);return kt.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!Fe(e)})),Bt(e,o,a,t),Vt(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Ft(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}Xt(e,t.position)}function It(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Xt(e,t.position)}function Lt(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=dt,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:Yt(e,t.name,!0),o=Gt(e,t),s=Kt(e,t);return Bt(e,o,a,t),Vt(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Rt(e,t,n){let r={};return Vt(r,Kt(e,t)),e.create(t,e.Fragment,r,n)}function zt(e,t){return t.value}function Bt(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Vt(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function Ht(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function Ut(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=vt(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function Wt(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&Et.call(t.properties,i)){let a=qt(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&At.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function Gt(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`){if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else Xt(e,t.position)}else{let i=r.name,a;if(r.value&&typeof r.value==`object`){if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else Xt(e,t.position)}else a=r.value===null||r.value;n[i]=a}return n}function Kt(e,t){let n=[],r=-1,i=e.passKeys?new Map:Dt;for(;++ri?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a0?(H(e,e.length,0,t),e):t}var ln={}.hasOwnProperty;function un(e){let t={},n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function W(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var G=xn(/[A-Za-z]/),K=xn(/[\dA-Za-z]/),mn=xn(/[#-'*+\--9=?A-Z^-~]/);function hn(e){return e!==null&&(e<32||e===127)}var gn=xn(/\d/),_n=xn(/[\dA-Fa-f]/),vn=xn(/[!-/:-@[-`{-~]/);function q(e){return e!==null&&e<-2}function J(e){return e!==null&&(e<0||e===32)}function Y(e){return e===-2||e===-1||e===32}var yn=xn(/\p{P}|\p{S}/u),bn=xn(/\s/);function xn(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function Sn(e){let t=[],n=-1,r=0,i=0;for(;++n55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function X(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return Y(r)?(e.enter(n),s(r)):t(r)}function s(r){return Y(r)&&a++0&&Y(t)?(e.enter(r),c(t)):l(t)}function c(t){return Y(t)&&o=i?t(e):n(e)}}var wn={tokenize:Tn};function Tn(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),X(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return q(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var En=class{constructor(){this.index=new Map,this.map=[]}add(e,t,n){Dn(this,e,t,n,!1)}addBefore(e,t,n){Dn(this,e,t,n,!0)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0,this.index.clear()}};function Dn(e,t,n,r,i){if(n===0&&r.length===0)return;let a=e.index.get(t);if(a){a[1]+=n,i?(r.push(...a[2]),a[2]=r):a[2].push(...r);return}let o=[t,n,r];e.map.push(o),e.index.set(t,o)}var On={tokenize:An},kn={tokenize:jn};function An(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(ro))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;er;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function jn(e,t,n){return X(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function Mn(e){if(e===null||J(e)||bn(e))return 1;if(yn(e))return 2}function Nn(e,t,n){let r=[],i=-1;for(;++i1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1,o={...e[i][1].end},s={...e[n][1].start};Ln(o,-a),Ln(s,a);let c={type:a>1?`strongSequence`:`emphasisSequence`,start:o,end:{...e[i][1].end}},l={type:a>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:s},u={type:a>1?`strongText`:`emphasisText`,start:{...e[i][1].end},end:{...e[n][1].start}},d={type:a>1?`strong`:`emphasis`,start:{...c.start},end:{...l.end}};e[i][1].end={...c.start},e[n][1].start={...l.end},r=[],e[i][1].end.offset-e[i][1].start.offset&&(r=U(r,[[`enter`,e[i][1],t],[`exit`,e[i][1],t]])),r=U(r,[[`enter`,d,t],[`enter`,c,t],[`exit`,c,t],[`enter`,u,t]]),r=U(r,Nn(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),r=U(r,[[`exit`,u,t],[`enter`,l,t],[`exit`,l,t],[`exit`,d,t]]);let f=0;e[n][1].end.offset-e[n][1].start.offset&&(f=2,r=U(r,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])),H(e,i-1,n-i+3,r),n=i+r.length-f-2;break}}for(n=-1;++n0&&Y(t)?X(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||q(t)?e.check(Xn,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||q(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),Y(t)?X(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),Y(t)?X(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||q(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}var er={name:`codeIndented`,tokenize:nr},tr={partial:!0,tokenize:rr};function nr(e,t,n){return r;function r(t){return e.enter(`codeIndented`),Cn(e,i,n,`linePrefix`,4,4)(t)}function i(t){return t===null?o(t):q(t)?e.attempt(tr,i,o)(t):(e.enter(`codeFlowValue`),a(t))}function a(t){return t===null||q(t)?(e.exit(`codeFlowValue`),i(t)):(e.consume(t),a)}function o(n){return e.exit(`codeIndented`),t(n)}}function rr(e,t,n){let r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):q(o)?(e.enter(`lineEnding`),e.consume(o),e.exit(`lineEnding`),i):Cn(e,t,a,`linePrefix`,4,4)(o)}function a(e){return q(e)?i(e):n(e)}}var ir={name:`codeText`,previous:or,resolve:ar,tokenize:sr};function ar(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return ethis.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&lr(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),lr(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),lr(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0)){if(e=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function _r(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||hn(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||q(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||J(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):q(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||q(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!Y(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function yr(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):q(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),X(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||q(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function br(e,t){let n;return r;function r(i){return q(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):Y(i)?X(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var xr={name:`definition`,tokenize:Cr},Sr={partial:!0,tokenize:wr};function Cr(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return vr.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=W(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return J(t)?br(e,l)(t):l(t)}function l(t){return _r(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(Sr,d,d)(t)}function d(t){return Y(t)?X(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||q(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function wr(e,t,n){return r;function r(t){return J(t)?br(e,i)(t):n(t)}function i(t){return yr(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return Y(t)?X(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||q(e)?t(e):n(e)}}var Tr={name:`hardBreakEscape`,tokenize:Er};function Er(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return q(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var Dr={name:`headingAtx`,resolve:Or,tokenize:kr};function Or(e,t){let n=e.length-2,r=3;if(e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r){let i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`};H(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])}return e}function kr(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||J(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||q(n)?(e.exit(`atxHeading`),t(n)):Y(n)?X(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||J(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var Ar=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),jr=[`pre`,`script`,`style`,`textarea`],Mr={concrete:!0,name:`htmlFlow`,resolveTo:Pr,tokenize:Fr},Nr={partial:!0,tokenize:Ir};function Pr(e){let t=e.length;for(;t--&&(e[t][0]!==`enter`||e[t][1].type!==`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Fr(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:N):G(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):G(a)?(e.consume(a),i=4,r.interrupt?t:N):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:N):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return G(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||J(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&jr.includes(l)?(i=1,r.interrupt?t(s):O(s)):Ar.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||K(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return Y(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||G(t)?(e.consume(t),b):Y(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||K(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):Y(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):Y(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||q(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||J(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||Y(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||q(t)?O(t):Y(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),A):t===60&&i===1?(e.consume(t),j):t===62&&i===4?(e.consume(t),re):t===63&&i===3?(e.consume(t),N):t===93&&i===5?(e.consume(t),M):q(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(Nr,ie,k)(t)):t===null||q(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(Xn,ee,ie)(t)}function ee(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),te}function te(t){return t===null||q(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function A(t){return t===45?(e.consume(t),N):O(t)}function j(t){return t===47?(e.consume(t),o=``,ne):O(t)}function ne(t){if(t===62){let n=o.toLowerCase();return jr.includes(n)?(e.consume(t),re):O(t)}return G(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),ne):O(t)}function M(t){return t===93?(e.consume(t),N):O(t)}function N(t){return t===62?(e.consume(t),re):t===45&&i===2?(e.consume(t),N):O(t)}function re(t){return t===null||q(t)?(e.exit(`htmlFlowData`),ie(t)):(e.consume(t),re)}function ie(n){return e.exit(`htmlFlow`),t(n)}}function Ir(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(Bn,t,n)}}var Lr={name:`htmlText`,tokenize:Rr};function Rr(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):G(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):G(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):q(t)?(o=d,j(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?A(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):q(t)?(o=h,j(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?A(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?A(t):q(t)?(o=v,j(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):q(t)?(o=y,j(t)):(e.consume(t),y)}function b(e){return e===62?A(e):y(e)}function x(t){return G(t)?(e.consume(t),S):n(t)}function S(t){return t===45||K(t)?(e.consume(t),S):C(t)}function C(t){return q(t)?(o=C,j(t)):Y(t)?(e.consume(t),C):A(t)}function w(t){return t===45||K(t)?(e.consume(t),w):t===47||t===62||J(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),A):t===58||t===95||G(t)?(e.consume(t),E):q(t)?(o=T,j(t)):Y(t)?(e.consume(t),T):A(t)}function E(t){return t===45||t===46||t===58||t===95||K(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):q(t)?(o=D,j(t)):Y(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):q(t)?(o=O,j(t)):Y(t)?(e.consume(t),O):(e.consume(t),ee)}function k(t){return t===i?(e.consume(t),i=void 0,te):t===null?n(t):q(t)?(o=k,j(t)):(e.consume(t),k)}function ee(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||J(t)?T(t):(e.consume(t),ee)}function te(e){return e===47||e===62||J(e)?T(e):n(e)}function A(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function j(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),ne}function ne(t){return Y(t)?X(e,M,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):M(t)}function M(t){return e.enter(`htmlTextData`),o(t)}}var zr={name:`labelEnd`,resolveAll:Ur,resolveTo:Wr,tokenize:Gr},Br={tokenize:Kr},Vr={tokenize:qr},Hr={tokenize:Jr};function Ur(e){let t=-1,n=[];for(;++t0&&i[i.length-1]._balanced;)i.pop();a=i[i.length-1]}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(W(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(Br,u,o?u:d)(t):t===91?e.attempt(Vr,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(Hr,u,d)(t)}function u(e){return i.pop(),t(e)}function d(e){return a._balanced=!0,n(e)}}function Kr(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return J(t)?br(e,a)(t):a(t)}function a(t){return t===41?u(t):_r(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return J(t)?br(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?yr(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return J(t)?br(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function qr(e,t,n){let r=this;return i;function i(t){return vr.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(W(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function Jr(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var Yr={name:`labelStartImage`,resolveAll:zr.resolveAll,tokenize:Xr};function Xr(e,t,n){let r=this,i;return a;function a(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),o}function o(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),i=e.exit(`labelImage`),s):n(t)}function s(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(i),t(e))}}var Zr={name:`labelStartLink`,resolveAll:zr.resolveAll,tokenize:Qr};function Qr(e,t,n){let r=this,i;return a;function a(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),i=e.exit(`labelLink`),o}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):(r._labelStarts=r._labelStarts||[],r._labelStarts.push(i),t(e))}}var $r={name:`lineEnding`,tokenize:ei};function ei(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),X(e,t,`linePrefix`)}}var ti={name:`thematicBreak`,tokenize:ni};function ni(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||q(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),Y(t)?X(e,s,`whitespace`)(t):s(t))}}var Z={continuation:{tokenize:oi},exit:ci,name:`list`,tokenize:ai},ri={partial:!0,tokenize:li},ii={partial:!0,tokenize:si};function ai(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:gn(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(ti,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return gn(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(Bn,r.interrupt?n:u,e.attempt(ri,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return Y(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function oi(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(Bn,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,X(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!Y(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(ii,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,X(e,e.attempt(Z,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function si(e,t,n){let r=this;return X(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function ci(e){e.exit(this.containerState.type)}function li(e,t,n){let r=this;return X(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!Y(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var ui={name:`setextUnderline`,resolveTo:di,tokenize:fi};function di(e,t){let n=new En,r=e.length,i,a,o;for(;r--;)if(e[r][0]===`enter`){if(e[r][1].type===`content`){i=r;break}e[r][1].type===`paragraph`&&(a=r)}else e[r][1].type===`content`&&n.add(r,1,[]),!o&&e[r][1].type===`definition`&&(o=r);let s={type:`setextHeading`,start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type=`setextHeadingText`,o?(n.add(a,0,[[`enter`,s,t]]),n.add(o+1,0,[[`exit`,e[i][1],t]]),e[i][1].end={...e[o][1].end}):e[i][1]=s,n.add(e.length,0,[[`exit`,s,t]]),n.consume(e),e}function fi(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),Y(t)?X(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||q(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var pi={tokenize:mi};function mi(e){let t=this,n=e.attempt(Bn,r,e.attempt(this.parser.constructs.flowInitial,i,X(e,e.attempt(this.parser.constructs.flow,i,e.attempt(fr,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var hi={resolveAll:yi()},gi=vi(`string`),_i=vi(`text`);function vi(e){return{resolveAll:yi(e===`text`?bi:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++iki,contentInitial:()=>Ci,disable:()=>Ai,document:()=>Si,flow:()=>Ti,flowInitial:()=>wi,insideSpan:()=>Oi,string:()=>Ei,text:()=>Di}),Si={42:Z,43:Z,45:Z,48:Z,49:Z,50:Z,51:Z,52:Z,53:Z,54:Z,55:Z,56:Z,57:Z,62:Hn},Ci={91:xr},wi={[-2]:er,[-1]:er,32:er},Ti={35:Dr,42:ti,45:[ui,ti],60:Mr,61:ui,95:ti,96:Qn,126:Qn},Ei={38:Jn,92:Kn},Di={[-5]:$r,[-4]:$r,[-3]:$r,33:Yr,38:Jn,42:Pn,60:[Rn,Lr],91:Zr,92:[Tr,Kn],93:zr,95:Pn,96:ir},Oi={null:[Pn,hi]},ki={null:[42,95]},Ai={null:[]};function ji(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=U(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=Nn(a,l.events,l),l.events):[]}function f(e,t){return Ni(p(e),t)}function p(e){return Mi(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){for(;r._index-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function Ni(e,t){let n=-1,r=[],i;for(;++n0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||qi).call(a,void 0,e[0])}for(r.position={start:Wi(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:Wi(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++dvoid c({to:`/dashboards/$dashboardId`,params:{dashboardId:t},search:a(n),replace:r,resetScroll:t!==e});return(0,o.jsx)(n,{dashboardId:e,search:s,onSearch:(t,n)=>l(e,t,n),onOpen:(e,t)=>l(e,{},t)})}export{s as component}; \ No newline at end of file +import{r as e}from"./useRouter-ByJ6_rwb.js";import{n as t}from"./useNavigate-B1zgPEUp.js";import{t as n}from"./page-DGkiHXHP.js";import{f as r,g as i,y as a}from"./index-Du7sNMda.js";var o=e();function s(){let{dashboardId:e}=r.useParams(),s=i(r.useSearch()),c=t(),l=(t,n,r)=>void c({to:`/dashboards/$dashboardId`,params:{dashboardId:t},search:a(n),replace:r,resetScroll:t!==e});return(0,o.jsx)(n,{dashboardId:e,search:s,onSearch:(t,n)=>l(e,t,n),onOpen:(e,t)=>l(e,{},t)})}export{s as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/dashboards.index-BgQqFg8m.js b/internal/ui/dist/assets/dashboards.index-CDzeQ7JH.js similarity index 68% rename from internal/ui/dist/assets/dashboards.index-BgQqFg8m.js rename to internal/ui/dist/assets/dashboards.index-CDzeQ7JH.js index 1c7edb192..f83c8f119 100644 --- a/internal/ui/dist/assets/dashboards.index-BgQqFg8m.js +++ b/internal/ui/dist/assets/dashboards.index-CDzeQ7JH.js @@ -1 +1 @@ -import{r as e}from"./useRouter-ByJ6_rwb.js";import{n as t}from"./useNavigate-B1zgPEUp.js";import{t as n}from"./page-BEAiBOTm.js";import{g as r,p as i,y as a}from"./index-_VmsjY84.js";var o=e();function s(){let e=r(i.useSearch()),s=t();return(0,o.jsx)(n,{search:e,onSearch:()=>void 0,onOpen:(t,n)=>void s({to:`/dashboards/$dashboardId`,params:{dashboardId:t},search:a(e),replace:n})})}export{s as component}; \ No newline at end of file +import{r as e}from"./useRouter-ByJ6_rwb.js";import{n as t}from"./useNavigate-B1zgPEUp.js";import{t as n}from"./page-DGkiHXHP.js";import{g as r,p as i,y as a}from"./index-Du7sNMda.js";var o=e();function s(){let e=r(i.useSearch()),s=t();return(0,o.jsx)(n,{search:e,onSearch:()=>void 0,onOpen:(t,n)=>void s({to:`/dashboards/$dashboardId`,params:{dashboardId:t},search:a(e),replace:n})})}export{s as component}; \ No newline at end of file diff --git a/internal/ui/dist/assets/index-_VmsjY84.js b/internal/ui/dist/assets/index-Du7sNMda.js similarity index 99% rename from internal/ui/dist/assets/index-_VmsjY84.js rename to internal/ui/dist/assets/index-Du7sNMda.js index 5a3049cbe..90eb4fa73 100644 --- a/internal/ui/dist/assets/index-_VmsjY84.js +++ b/internal/ui/dist/assets/index-Du7sNMda.js @@ -1,4 +1,4 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/routes-D2AdaqvY.js","assets/useRouter-ByJ6_rwb.js","assets/useNavigate-B1zgPEUp.js","assets/settings-KSF6knOe.js","assets/brand-DUaZkIz1.js","assets/Tooltip-B3r3s_B9.js","assets/WarningCircle.es-1A8yYViJ.js","assets/chat.index-Bgm22VZM.js","assets/chat-CDsGWYjG.js","assets/preload-helper-CButVOn1.js","assets/dashboard-change-chips-DDCZ8miS.js","assets/chat._threadId-Bgm22VZM.js","assets/dashboards.index-BgQqFg8m.js","assets/page-BEAiBOTm.js","assets/dashboards._dashboardId-BQWwl4ep.js"])))=>i.map(i=>d[i]); +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/routes-D2AdaqvY.js","assets/useRouter-ByJ6_rwb.js","assets/useNavigate-B1zgPEUp.js","assets/settings-674SZUVT.js","assets/brand-DUaZkIz1.js","assets/Tooltip-B3r3s_B9.js","assets/WarningCircle.es-wTz6NA9-.js","assets/chat.index-Cjkl3RJK.js","assets/chat-CXc2E7RV.js","assets/preload-helper-CButVOn1.js","assets/dashboard-change-chips-myL7tsV1.js","assets/chat._threadId-Cjkl3RJK.js","assets/dashboards.index-CDzeQ7JH.js","assets/page-DGkiHXHP.js","assets/dashboards._dashboardId-D9aKAAwQ.js"])))=>i.map(i=>d[i]); import{a as e,i as t,n,o as r,r as i,s as a,t as o}from"./useRouter-ByJ6_rwb.js";import{$ as s,A as c,B as l,C as u,F as d,G as f,H as p,I as m,J as h,K as g,L as _,M as v,N as y,P as b,Q as x,R as S,S as C,T as w,U as T,V as ee,W as E,X as D,Y as O,Z as te,_ as ne,_t as re,a as k,at as ie,b as ae,c as A,ct as oe,d as se,dt as ce,f as le,gt as ue,h as de,ht as fe,i as pe,it as me,j as he,k as ge,l as _e,lt as ve,m as j,mt as M,nt as ye,o as be,ot as xe,p as Se,pt as Ce,q as we,r as Te,rt as Ee,st as De,t as Oe,tt as ke,u as Ae,ut as je,v as Me,w as Ne,x as Pe,y as Fe,z as Ie}from"./brand-DUaZkIz1.js";import{i as Le,n as Re,r as ze,t as Be}from"./useNavigate-B1zgPEUp.js";import{A as Ve,C as He,D as Ue,E as We,O as Ge,S as Ke,T as qe,_ as Je,a as Ye,g as Xe,h as Ze,i as Qe,k as $e,m as et,n as tt,r as nt,s as rt,t as it,u as at,v as ot,w as st,x as ct}from"./preload-helper-CButVOn1.js";import{C as lt,E as ut,T as dt,_ as ft,a as pt,c as mt,d as ht,f as gt,g as _t,h as vt,i as yt,l as bt,m as xt,n as St,o as Ct,p as wt,r as Tt,s as Et,t as Dt,u as Ot,v as kt,x as At,y as jt}from"./Tooltip-B3r3s_B9.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 Mt=e((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,D());else{var t=n(l);t!==null&&ne(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function ee(){return g?!0:!(e.unstable_now()-Tt&&ee());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&ne(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?D():S=!1}}}var D;if(typeof y==`function`)D=function(){y(E)};else if(typeof MessageChannel<`u`){var O=new MessageChannel,te=O.port2;O.port1.onmessage=E,D=function(){te.postMessage(null)}}else D=function(){_(E,0)};function ne(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,ne(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,D()))),r},e.unstable_shouldYield=ee,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Nt=e(((e,t)=>{t.exports=Mt()})),Pt=e((e=>{var n=Nt(),r=t(),i=re();function a(e){var t=`https://react.dev/errors/`+e;if(1xe||(e.current=be[xe],be[xe]=null,xe--)}function we(e,t){xe++,be[xe]=e.current,e.current=t}var Te=Se(null),Ee=Se(null),De=Se(null),Oe=Se(null);function ke(e,t){switch(we(De,t),we(Ee,e),we(Te,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?xp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=xp(t),e=Sp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}Ce(Te),we(Te,e)}function Ae(){Ce(Te),Ce(Ee),Ce(De)}function je(e){var t=e.memoizedState;t!==null&&(vh._currentValue=t.memoizedState,we(Oe,e)),t=Te.current;var n=Sp(t,e.type);t!==n&&(we(Ee,e),we(Te,n))}function Me(e){Ee.current===e&&(Ce(Te),Ce(Ee)),Oe.current===e&&(Ce(Oe),vh._currentValue=ye)}var Ne,Pe;function Fe(e){if(Ne===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Ne=t&&t[1]||``,Pe=-1)`:-1s(e,t,n)},i,a=sE,o=!XT.jitless,s=o&&cE.value,c=t.catchall,l;e._zod.parse=(u,d)=>{l??=n.value;let f=u.value;if(!a(f))return u.issues.push({expected:`object`,code:`invalid_type`,input:f,inst:e}),u;let p=[];if(o&&s&&d?.async===!1&&d.jitless!==!0)i||=r(t.shape),u=i(u,d);else{u.value={};let e=l.shape;for(let t of l.keys){let n=e[t],r=n._zod.run({value:f[t],issues:[]},d),i=n._zod.optin===`optional`&&n._zod.optout===`optional`;r instanceof Promise?p.push(r.then(e=>i?ZE(e,u,t,f):XE(e,u,t))):i?ZE(r,u,t,f):XE(r,u,t)}}if(!c)return p.length?Promise.all(p).then(()=>u):u;let m=[],h=l.keySet,g=c._zod,_=g.def.type;for(let e of Object.keys(f)){if(h.has(e))continue;if(_===`never`){m.push(e);continue}let t=g.run({value:f[e],issues:[]},d);t instanceof Promise?p.push(t.then(t=>XE(t,u,e))):XE(t,u,e)}return m.length&&u.issues.push({code:`unrecognized_keys`,keys:m,input:f,inst:e}),p.length?Promise.all(p).then(()=>u):u}});function $E(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;return t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>wE(e,r,ZT())))}),t}var eD=$(`$ZodUnion`,(e,t)=>{GE.init(e,t),rE(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),rE(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),rE(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),rE(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>nE(e.source)).join(`|`)})$`)}}),e._zod.parse=(n,r)=>{let i=!1,a=[];for(let e of t.options){let t=e._zod.run({value:n.value,issues:[]},r);if(t instanceof Promise)a.push(t),i=!0;else{if(t.issues.length===0)return t;a.push(t)}}return i?Promise.all(a).then(t=>$E(t,n,e,r)):$E(a,n,e,r)}}),tD=$(`$ZodIntersection`,(e,t)=>{GE.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])=>rD(e,t,n)):rD(e,i,a)}});function nD(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(lE(e)&&lE(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=nD(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{GE.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!lE(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[];if(t.keyType._zod.values){let o=t.keyType._zod.values;n.value={};for(let e of o)if(typeof e==`string`||typeof e==`number`||typeof e==`symbol`){let o=t.valueType._zod.run({value:i[e],issues:[]},r);o instanceof Promise?a.push(o.then(t=>{t.issues.length&&n.issues.push(...SE(e,t.issues)),n.value[e]=t.value})):(o.issues.length&&n.issues.push(...SE(e,o.issues)),n.value[e]=o.value)}let s;for(let e in i)o.has(e)||(s??=[],s.push(e));s&&s.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:s})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`)continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){n.issues.push({origin:`record`,code:`invalid_key`,issues:s.issues.map(e=>wE(e,r,ZT())),input:o,path:[o],inst:e}),n.value[s.value]=s.value;continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...SE(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...SE(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),aD=$(`$ZodEnum`,(e,t)=>{GE.init(e,t);let n=QT(t.entries);e._zod.values=new Set(n),e._zod.pattern=RegExp(`^(${n.filter(e=>uE.has(typeof e)).map(e=>typeof e==`string`?dE(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,r)=>{let i=t.value;return e._zod.values.has(i)||t.issues.push({code:`invalid_value`,values:n,input:i,inst:e}),t}}),oD=$(`$ZodLiteral`,(e,t)=>{GE.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?dE(e):e?e.toString():String(e)).join(`|`)})$`),e._zod.parse=(n,r)=>{let i=n.value;return e._zod.values.has(i)||n.issues.push({code:`invalid_value`,values:t.values,input:i,inst:e}),n}}),sD=$(`$ZodTransform`,(e,t)=>{GE.init(e,t),e._zod.parse=(e,n)=>{let r=t.transform(e.value,e);if(n.async)return(r instanceof Promise?r:Promise.resolve(r)).then(t=>(e.value=t,e));if(r instanceof Promise)throw new YT;return e.value=r,e}}),cD=$(`$ZodOptional`,(e,t)=>{GE.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,rE(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),rE(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${nE(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>t.innerType._zod.optin===`optional`?t.innerType._zod.run(e,n):e.value===void 0?e:t.innerType._zod.run(e,n)}),lD=$(`$ZodNullable`,(e,t)=>{GE.init(e,t),rE(e._zod,`optin`,()=>t.innerType._zod.optin),rE(e._zod,`optout`,()=>t.innerType._zod.optout),rE(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${nE(e.source)}|null)$`):void 0}),rE(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),uD=$(`$ZodDefault`,(e,t)=>{GE.init(e,t),e._zod.optin=`optional`,rE(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>dD(e,t)):dD(r,t)}});function dD(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var fD=$(`$ZodPrefault`,(e,t)=>{GE.init(e,t),e._zod.optin=`optional`,rE(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),pD=$(`$ZodNonOptional`,(e,t)=>{GE.init(e,t),rE(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>mD(t,e)):mD(i,e)}});function mD(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var hD=$(`$ZodCatch`,(e,t)=>{GE.init(e,t),e._zod.optin=`optional`,rE(e._zod,`optout`,()=>t.innerType._zod.optout),rE(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>wE(e,n,ZT()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>wE(e,n,ZT()))},input:e.value}),e.issues=[]),e)}}),gD=$(`$ZodPipe`,(e,t)=>{GE.init(e,t),rE(e._zod,`values`,()=>t.in._zod.values),rE(e._zod,`optin`,()=>t.in._zod.optin),rE(e._zod,`optout`,()=>t.out._zod.optout),e._zod.parse=(e,n)=>{let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>_D(e,t,n)):_D(r,t,n)}});function _D(e,t,n){return xE(e)?e:t.out._zod.run({value:e.value,issues:e.issues},n)}var vD=$(`$ZodReadonly`,(e,t)=>{GE.init(e,t),rE(e._zod,`propValues`,()=>t.innerType._zod.propValues),rE(e._zod,`values`,()=>t.innerType._zod.values),rE(e._zod,`optin`,()=>t.innerType._zod.optin),rE(e._zod,`optout`,()=>t.innerType._zod.optout),e._zod.parse=(e,n)=>{let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(yD):yD(r)}});function yD(e){return e.value=Object.freeze(e.value),e}var bD=$(`$ZodLazy`,(e,t)=>{GE.init(e,t),rE(e._zod,`innerType`,()=>t.getter()),rE(e._zod,`pattern`,()=>e._zod.innerType._zod.pattern),rE(e._zod,`propValues`,()=>e._zod.innerType._zod.propValues),rE(e._zod,`optin`,()=>e._zod.innerType._zod.optin),rE(e._zod,`optout`,()=>e._zod.innerType._zod.optout),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),xD=$(`$ZodCustom`,(e,t)=>{RE.init(e,t),GE.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>SD(t,n,r,e));SD(i,n,r,e)}});function SD(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(EE(e))}}var CD=class{constructor(){this._map=new Map,this._idmap=new Map}add(e,...t){let n=t[0];if(this._map.set(e,n),n&&typeof n==`object`&&`id`in n){if(this._idmap.has(n.id))throw Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};return delete n.id,{...n,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}};function wD(){return new CD}var TD=wD();function ED(e){return new e({type:`unknown`})}function DD(e,t){return new e({type:`never`,...pE(t)})}function OD(e,t){return new zE({check:`max_length`,...pE(t),maximum:e})}function kD(e,t){return new BE({check:`min_length`,...pE(t),minimum:e})}function AD(e,t){return new VE({check:`length_equals`,...pE(t),length:e})}function jD(e){return new HE({check:`overwrite`,tx:e})}function MD(e,t,n){return new e({type:`array`,element:t,...pE(n)})}function ND(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...pE(n)})}var PD=(e,t)=>{OE.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>jE(e,t)},flatten:{value:t=>AE(e,t)},addIssue:{value:t=>e.issues.push(t)},addIssues:{value:t=>e.issues.push(...t)},isEmpty:{get(){return e.issues.length===0}}})};$(`ZodError`,PD);var FD=$(`ZodError`,PD,{Parent:Error}),ID=ME(FD),LD=NE(FD),RD=PE(FD),zD=IE(FD),BD=$(`ZodType`,(e,t)=>(GE.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),e.clone=(t,n)=>fE(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>ID(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>RD(e,t,n),e.parseAsync=async(t,n)=>LD(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>zD(e,t,n),e.spa=e.safeParseAsync,e.refine=(t,n)=>e.check(CO(t,n)),e.superRefine=t=>e.check(wO(t)),e.overwrite=t=>e.check(jD(t)),e.optional=()=>aO(e),e.nullable=()=>sO(e),e.nullish=()=>aO(sO(e)),e.nonoptional=t=>pO(e,t),e.array=()=>KD(e),e.or=t=>YD([e,t]),e.and=t=>ZD(e,t),e.transform=t=>_O(e,rO(t)),e.default=t=>lO(e,t),e.prefault=t=>dO(e,t),e.catch=t=>hO(e,t),e.pipe=t=>_O(e,t),e.readonly=()=>yO(e),e.describe=t=>{let n=e.clone();return TD.add(n,{description:t}),n},Object.defineProperty(e,"description",{get(){return TD.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return TD.get(e);let n=e.clone();return TD.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),VD=$(`ZodUnknown`,(e,t)=>{KE.init(e,t),BD.init(e,t)});function HD(){return ED(VD)}var UD=$(`ZodNever`,(e,t)=>{qE.init(e,t),BD.init(e,t)});function WD(e){return DD(UD,e)}var GD=$(`ZodArray`,(e,t)=>{YE.init(e,t),BD.init(e,t),e.element=t.element,e.min=(t,n)=>e.check(kD(t,n)),e.nonempty=t=>e.check(kD(1,t)),e.max=(t,n)=>e.check(OD(t,n)),e.length=(t,n)=>e.check(AD(t,n)),e.unwrap=()=>e.element});function KD(e,t){return MD(GD,e,t)}var qD=$(`ZodObject`,(e,t)=>{QE.init(e,t),BD.init(e,t),rE(e,`shape`,()=>t.shape),e.keyof=()=>eO(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:HD()}),e.loose=()=>e.clone({...e._zod.def,catchall:HD()}),e.strict=()=>e.clone({...e._zod.def,catchall:WD()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>_E(e,t),e.merge=t=>vE(e,t),e.pick=t=>hE(e,t),e.omit=t=>gE(e,t),e.partial=(...t)=>yE(iO,e,t[0]),e.required=(...t)=>bE(fO,e,t[0])}),JD=$(`ZodUnion`,(e,t)=>{eD.init(e,t),BD.init(e,t),e.options=t.options});function YD(e,t){return new JD({type:`union`,options:e,...pE(t)})}var XD=$(`ZodIntersection`,(e,t)=>{tD.init(e,t),BD.init(e,t)});function ZD(e,t){return new XD({type:`intersection`,left:e,right:t})}var QD=$(`ZodRecord`,(e,t)=>{iD.init(e,t),BD.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType}),$D=$(`ZodEnum`,(e,t)=>{aD.init(e,t),BD.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new $D({...t,checks:[],...pE(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new $D({...t,checks:[],...pE(r),entries:i})}});function eO(e,t){return new $D({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...pE(t)})}var tO=$(`ZodLiteral`,(e,t)=>{oD.init(e,t),BD.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})}),nO=$(`ZodTransform`,(e,t)=>{sD.init(e,t),BD.init(e,t),e._zod.parse=(n,r)=>{n.addIssue=r=>{if(typeof r==`string`)n.issues.push(EE(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,t.continue??=!0,n.issues.push(EE(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function rO(e){return new nO({type:`transform`,transform:e})}var iO=$(`ZodOptional`,(e,t)=>{cD.init(e,t),BD.init(e,t),e.unwrap=()=>e._zod.def.innerType});function aO(e){return new iO({type:`optional`,innerType:e})}var oO=$(`ZodNullable`,(e,t)=>{lD.init(e,t),BD.init(e,t),e.unwrap=()=>e._zod.def.innerType});function sO(e){return new oO({type:`nullable`,innerType:e})}var cO=$(`ZodDefault`,(e,t)=>{uD.init(e,t),BD.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function lO(e,t){return new cO({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():t}})}var uO=$(`ZodPrefault`,(e,t)=>{fD.init(e,t),BD.init(e,t),e.unwrap=()=>e._zod.def.innerType});function dO(e,t){return new uO({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():t}})}var fO=$(`ZodNonOptional`,(e,t)=>{pD.init(e,t),BD.init(e,t),e.unwrap=()=>e._zod.def.innerType});function pO(e,t){return new fO({type:`nonoptional`,innerType:e,...pE(t)})}var mO=$(`ZodCatch`,(e,t)=>{hD.init(e,t),BD.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function hO(e,t){return new mO({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var gO=$(`ZodPipe`,(e,t)=>{gD.init(e,t),BD.init(e,t),e.in=t.in,e.out=t.out});function _O(e,t){return new gO({type:`pipe`,in:e,out:t})}var vO=$(`ZodReadonly`,(e,t)=>{vD.init(e,t),BD.init(e,t)});function yO(e){return new vO({type:`readonly`,innerType:e})}var bO=$(`ZodLazy`,(e,t)=>{bD.init(e,t),BD.init(e,t),e.unwrap=()=>e._zod.def.getter()}),xO=$(`ZodCustom`,(e,t)=>{xD.init(e,t),BD.init(e,t)});function SO(e){let t=new RE({check:`custom`});return t._zod.check=e,t}function CO(e,t={}){return ND(xO,e,t)}function wO(e){let t=SO(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(EE(e,n.value,t._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=n.value,r.inst??=t,r.continue??=!t._zod.def.abort,n.issues.push(EE(r))}},e(n.value,n)));return t}var TO=`@ag-ui/client`;function EO(e){if(!e.metadata||!Object.prototype.hasOwnProperty.call(e.metadata,TO))return;let t=e.metadata?.[TO];if(!t||typeof t!=`object`||Array.isArray(t))return[];if(!Object.prototype.hasOwnProperty.call(t,`authoritativeActivityTypes`))return;let n=t.authoritativeActivityTypes;return n===null?null:Array.isArray(n)&&n.every(e=>typeof e==`string`)?n:[]}var DO=e=>{if(typeof structuredClone==`function`)return structuredClone(e);try{return JSON.parse(JSON.stringify(e))}catch{return Array.isArray(e)?[...e]:{...e}}};function OO(){return Zc()}function kO(e){return e instanceof TypeError&&/read[- ]?only|not extensible|cannot add property|cannot delete property|can't be deleted|unable to delete property|object is frozen|is not writable/i.test(e.message)}function AO(e){if(Object.freeze(e),typeof e==`object`&&e)for(let t of Object.values(e))typeof t==`object`&&t&&!Object.isFrozen(t)&&AO(t);return e}var jO=524288;function MO(e,t,n){let r=0,i=[e,t],a=new WeakSet;for(;i.length>0;){let e=i.pop();if(typeof e==`string`){if(r+=e.length,r>n)return!0}else if(typeof e==`object`&&e){if(a.has(e))continue;if(a.add(e),Array.isArray(e))for(let t=0;tn)return!0;i.push(e[o])}}}}return!1}async function NO(e,t,n,r){let i=typeof process<`u`&&!0,a=i&&!!{}.VITEST_WORKER_ID,o=i&&!!{}.VITEST_WORKER_ID,s=o&&!MO(t,n,jO),c=s?DO(t):t,l=s?DO(n):n,u=!1,d=!1,f;for(let t of e)try{s&&(AO(c),AO(l));let e=await r(t,c,l);if(e===void 0)continue;let n=!1;if(e.messages!==void 0&&e.messages!==c&&(c=DO(e.messages),u=!0,n=!0),e.state!==void 0&&e.state!==l&&(l=DO(e.state),d=!0,n=!0),s&&n&&MO(c,l,jO)&&(s=!1),f=e.stopPropagation,f===!0)break}catch(e){if(a&&e instanceof TypeError)throw e;s&&o&&kO(e)?console.error(`AG-UI: Subscriber attempted to mutate frozen inputs in-place. Return mutations via AgentStateMutation instead of mutating directly.`,e):console.error(`Subscriber error:`,e);continue}return{...u?{messages:Object.isFrozen(c)?DO(c):c}:{},...d?{state:Object.isFrozen(l)?DO(l):l}:{},...f===void 0?{}:{stopPropagation:f}}}function PO(e){if(!e)return{enabled:!1,events:!1,lifecycle:!1,verbose:!1};if(e===!0)return{enabled:!0,events:!0,lifecycle:!0,verbose:!0};let t=e.events??!0,n=e.lifecycle??!0,r=e.verbose??!1;return{enabled:t||n,events:t,lifecycle:n,verbose:r}}function FO(e){if(e instanceof IO)return e;if(e===!0)return new IO(PO(!0))}var IO=class{constructor(e){this.config=e}event(e,t,n,r){this.config.events&&(this.config.verbose?console.debug(`[${e}] ${t}`,typeof n==`string`?n:JSON.stringify(n)):console.debug(`[${e}] ${t}`,r??n))}lifecycle(e,t,n){this.config.lifecycle&&(n?console.debug(`[${e}] ${t}`,n):console.debug(`[${e}] ${t}`))}get eventsEnabled(){return this.config.events}get lifecycleEnabled(){return this.config.lifecycle}get enabled(){return this.config.enabled}};function LO(e){return e.enabled?new IO(e):void 0}function RO(e,t,n){if(t){let r=e.find(e=>e.id===t);if(r?.role===`assistant`)return r;r&&console.warn(`TOOL_CALL_START: parentMessageId '${t}' matches a '${r.role}' message, not assistant — falling back to toolCallId`);let i={id:r?n:t,role:`assistant`,toolCalls:[]};return e.push(i),i}let r={id:n,role:`assistant`,toolCalls:[]};return e.push(r),r}function zO(e,t){return!e||t.metadata===void 0?!1:(e.metadata=rl(e.metadata,DO(t.metadata)),!0)}var BO=(e,t,n,r,i)=>{let a=FO(i),o=DO(n.messages),s=DO(e.state),c={},l=[],u=new Set,d=e=>{let t=e.outcome?.type===`success`?e.outcome.pendingToolCallIds:void 0;return t!==void 0&&t.length>0?[...t]:l.filter(e=>!u.has(e))},f=e=>{e.messages!==void 0&&(o=e.messages,c.messages=e.messages),e.state!==void 0&&(s=e.state,c.state=e.state)},p=()=>{let e=DO(c);return c={},e.messages!==void 0||e.state!==void 0?xd(e):Uu};return t.pipe(Md(async t=>{let i=await NO(r,o,s,(r,i,a)=>r.onEvent?.({event:t,agent:n,input:e,messages:i,state:a}));if(f(i),i.stopPropagation===!0?a?.event(`APPLY`,`Event dropped:`,t,{type:t.type,reason:`stopPropagation by subscriber`}):a?.event(`APPLY`,`Event applied:`,t,{type:t.type,subscribers:r.length}),i.stopPropagation===!0)return p();switch(t.type){case L.TEXT_MESSAGE_START:{let i=await NO(r,o,s,(r,i,a)=>r.onTextMessageStartEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(f(i),i.stopPropagation!==!0){let{messageId:e,role:n=`assistant`,name:r,subagentRunId:i}=t,a=o.find(t=>t.id===e);if(a?.role===`activity`)return console.warn(`TEXT_MESSAGE_START: Message '${e}' is an activity message — message ids must be unique across activity and text messages`),p();let s=a;if(!s){let t={id:e,role:n,content:``,...r!==void 0&&{name:r},...i!=null&&{subagentRunId:i}};o.push(t),s=t}let c=zO(s,t);(!a||c)&&f({messages:o})}return p()}case L.TEXT_MESSAGE_CONTENT:{let{messageId:i,delta:a}=t,c=o.find(e=>e.id===i);if(!c)return console.warn(`TEXT_MESSAGE_CONTENT: No message found with ID '${i}'`),p();if(c.role===`activity`)return console.warn(`TEXT_MESSAGE_CONTENT: Message '${i}' is an activity message — message ids must be unique across activity and text messages`),p();let l=await NO(r,o,s,(r,i,a)=>r.onTextMessageContentEvent?.({event:t,messages:i,state:a,agent:n,input:e,textMessageBuffer:typeof c.content==`string`?c.content:``}));return f(l),l.stopPropagation!==!0&&(c.content=`${typeof c.content==`string`?c.content:``}${a}`,zO(c,t),f({messages:o})),p()}case L.TEXT_MESSAGE_END:{let{messageId:i}=t,a=o.find(e=>e.id===i);if(!a)return console.warn(`TEXT_MESSAGE_END: No message found with ID '${i}'`),p();if(a.role===`activity`)return console.warn(`TEXT_MESSAGE_END: Message '${i}' is an activity message — message ids must be unique across activity and text messages`),p();let c=await NO(r,o,s,(r,i,o)=>r.onTextMessageEndEvent?.({event:t,messages:i,state:o,agent:n,input:e,textMessageBuffer:typeof a.content==`string`?a.content:``}));return f(c),c.stopPropagation!==!0&&zO(a,t)&&f({messages:o}),await Promise.all(r.map(t=>{t.onNewMessage?.({message:a,messages:o,state:s,agent:n,input:e})})),p()}case L.TOOL_CALL_START:{let i=await NO(r,o,s,(r,i,a)=>r.onToolCallStartEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(f(i),i.stopPropagation!==!0){let{toolCallId:e,toolCallName:n,parentMessageId:r,subagentRunId:i}=t;l.includes(e)||l.push(e);let a=o.find(t=>t.toolCalls?.some(t=>t.id===e))?.toolCalls?.find(t=>t.id===e);if(a){let r=a.function.name!==n;return r&&(console.warn(`TOOL_CALL_START: tool call '${e}' already exists with name '${a.function.name}' — updating it to '${n}'`),a.function.name=n),(zO(a,t)||r)&&f({messages:o}),p()}let s=new Set(o.map(e=>e.id)),c=RO(o,r,e);!s.has(c.id)&&i!=null&&c.subagentRunId===void 0&&(c.subagentRunId=i),c.toolCalls??=[];let u={id:e,type:`function`,function:{name:n,arguments:``}};c.toolCalls.push(u),zO(u,t),f({messages:o})}return p()}case L.TOOL_CALL_ARGS:{let{toolCallId:i,delta:a}=t,c=o.find(e=>e.toolCalls?.some(e=>e.id===i));if(!c)return console.warn(`TOOL_CALL_ARGS: No message found containing tool call with ID '${i}'`),p();let l=c.toolCalls?.find(e=>e.id===i);if(!l)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${i}'`),p();let u=await NO(r,o,s,(r,i,a)=>{let o=l.function.arguments,s=l.function.name,c={};try{c=Vd(o)}catch{}return r.onToolCallArgsEvent?.({event:t,messages:i,state:a,agent:n,input:e,toolCallBuffer:o,toolCallName:s,partialToolCallArgs:c})});return f(u),u.stopPropagation!==!0&&(l.function.arguments+=a,zO(l,t),f({messages:o})),p()}case L.TOOL_CALL_END:{let{toolCallId:i}=t,a=o.find(e=>e.toolCalls?.some(e=>e.id===i));if(!a)return console.warn(`TOOL_CALL_END: No message found containing tool call with ID '${i}'`),p();let c=a.toolCalls?.find(e=>e.id===i);if(!c)return console.warn(`TOOL_CALL_END: No tool call found with ID '${i}'`),p();let l=await NO(r,o,s,(r,i,a)=>{let o=c.function.arguments,s=c.function.name,l={};try{l=JSON.parse(o)}catch{}return r.onToolCallEndEvent?.({event:t,messages:i,state:a,agent:n,input:e,toolCallName:s,toolCallArgs:l})});return f(l),l.stopPropagation!==!0&&zO(c,t)&&f({messages:o}),await Promise.all(r.map(t=>{t.onNewToolCall?.({toolCall:c,messages:o,state:s,agent:n,input:e})})),p()}case L.TOOL_CALL_RESULT:{let i=await NO(r,o,s,(r,i,a)=>r.onToolCallResultEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(f(i),i.stopPropagation!==!0){let{messageId:i,toolCallId:a,content:c,role:l,subagentRunId:d}=t;u.add(a);let p={id:i,toolCallId:a,role:l||`tool`,content:c,...d!=null&&{subagentRunId:d}};zO(p,t);let m=o.findIndex(e=>e.role===`assistant`&&e.toolCalls?.some(e=>e.id===a));if(m===-1)o.push(p);else{let e=m+1;for(;e{t.onNewMessage?.({message:p,messages:o,state:s,agent:n,input:e})})),f({messages:o})}return p()}case L.STATE_SNAPSHOT:{let i=await NO(r,o,s,(r,i,a)=>r.onStateSnapshotEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(f(i),i.stopPropagation!==!0){let{snapshot:e}=t;s=e,f({state:s})}return p()}case L.STATE_DELTA:{let i=await NO(r,o,s,(r,i,a)=>r.onStateDeltaEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(f(i),i.stopPropagation!==!0){let{delta:e}=t;try{s=Vl.applyPatch(s,e,!0,!1).newDocument,f({state:s})}catch(t){let n=t instanceof Error?t.message:String(t);console.warn(`Failed to apply state patch:\nCurrent state: ${JSON.stringify(s,null,2)}\nPatch operations: ${JSON.stringify(e,null,2)}\nError: ${n}`)}}return p()}case L.MESSAGES_SNAPSHOT:{let i=await NO(r,o,s,(r,i,a)=>r.onMessagesSnapshotEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(f(i),i.stopPropagation!==!0){let{messages:e}=t,n=e.map(e=>{if(e.subagentRunId!==null)return e;let t={...e};return delete t.subagentRunId,t}),r=new Map(n.map(e=>[e.id,e])),i=EO(t),a=n.some(e=>e.role===`activity`),s=n.some(e=>e.role===`reasoning`),c=e=>e.role===`activity`&&(i?!i.includes(e.activityType):i!==null&&!a)||e.role===`reasoning`&&!s;o=o.filter(e=>r.has(e.id)||c(e)).map(e=>r.get(e.id)??e);let l=new Set(o.map(e=>e.id));for(let e of n)l.has(e.id)||o.push(e);f({messages:o})}return p()}case L.ACTIVITY_SNAPSHOT:{let i=t,a=o.findIndex(e=>e.id===i.messageId),c=a>=0?o[a]:void 0,l=c?.role===`activity`?c:void 0,u=i.replace??!0,d=await NO(r,o,s,(t,r,a)=>t.onActivitySnapshotEvent?.({event:i,messages:r,state:a,agent:n,input:e,activityMessage:l,existingMessage:c}));if(f(d),d.stopPropagation!==!0){let t={id:i.messageId,role:`activity`,activityType:i.activityType,content:DO(i.content),...i.subagentRunId!=null&&{subagentRunId:i.subagentRunId}},c,d;a===-1?(o.push(t),c=t,d=t):l?(u&&(o[a]={...l,activityType:i.activityType,content:DO(i.content),subagentRunId:i.subagentRunId},i.subagentRunId??delete o[a].subagentRunId),d=o[a]):u&&(o[a]=t,c=t,d=t),zO(d,i),f({messages:o}),c&&await Promise.all(r.map(t=>t.onNewMessage?.({message:c,messages:o,state:s,agent:n,input:e})))}return p()}case L.ACTIVITY_DELTA:{let i=t,a=o.findIndex(e=>e.id===i.messageId);if(a===-1)return p();let c=o[a];if(c.role!==`activity`)return console.warn(`ACTIVITY_DELTA: Message '${i.messageId}' is not an activity message`),p();let l=c,u=await NO(r,o,s,(t,r,a)=>t.onActivityDeltaEvent?.({event:i,messages:r,state:a,agent:n,input:e,activityMessage:l}));if(f(u),u.stopPropagation!==!0)try{zO(l,i)&&f({messages:o});let e=DO(l.content??{}),t=Vl.applyPatch(e,i.patch??[],!0,!1).newDocument;o[a]={...l,content:DO(t),activityType:i.activityType},f({messages:o})}catch(e){let t=e instanceof Error?e.message:String(e);console.warn(`Failed to apply activity patch for '${i.messageId}': ${t}`)}return p()}case L.RAW:return f(await NO(r,o,s,(r,i,a)=>r.onRawEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),p();case L.CUSTOM:return f(await NO(r,o,s,(r,i,a)=>r.onCustomEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),p();case L.RUN_STARTED:{let i=await NO(r,o,s,(r,i,a)=>r.onRunStartedEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(f(i),l=[],u=new Set,i.stopPropagation!==!0){let e=t;if(e.input?.messages){for(let t of e.input.messages){let e=t;if(t.subagentRunId===null){let n={...t};delete n.subagentRunId,e=n}o.find(t=>t.id===e.id)||o.push(e)}f({messages:o})}}return p()}case L.RUN_FINISHED:{let i=t,a=i.outcome?.type===`interrupt`?{event:i,outcome:`interrupt`,interrupts:i.outcome.interrupts}:i.outcome?.type===`cancelled`?{event:i,outcome:`cancelled`}:{event:i,outcome:`success`,result:i.result,pendingToolCallIds:d(i)},c=await NO(r,o,s,(t,r,i)=>t.onRunFinishedEvent?.({...a,messages:r,state:i,agent:n,input:e}));return f(c),c.stopPropagation!==!0&&(n.pendingInterrupts=a.outcome===`interrupt`?a.interrupts.map(e=>{if(e.subagentRunId!==null)return e;let t={...e};return delete t.subagentRunId,t}):[]),p()}case L.RUN_ERROR:return f(await NO(r,o,s,(r,i,a)=>r.onRunErrorEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),p();case L.STEP_STARTED:return f(await NO(r,o,s,(r,i,a)=>r.onStepStartedEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),p();case L.STEP_FINISHED:return f(await NO(r,o,s,(r,i,a)=>r.onStepFinishedEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),p();case L.TEXT_MESSAGE_CHUNK:throw Error(`TEXT_MESSAGE_CHUNK must be transformed before being applied`);case L.TOOL_CALL_CHUNK:throw Error(`TOOL_CALL_CHUNK must be transformed before being applied`);case L.REASONING_START:return f(await NO(r,o,s,(r,i,a)=>r.onReasoningStartEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),p();case L.REASONING_MESSAGE_START:{let i=await NO(r,o,s,(r,i,a)=>r.onReasoningMessageStartEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(f(i),i.stopPropagation!==!0){let{messageId:e,subagentRunId:n}=t,r=o.find(t=>t.id===e);if(r?.role===`activity`)return console.warn(`REASONING_MESSAGE_START: Message '${e}' is an activity message — message ids must be unique across activity and reasoning messages`),p();let i=r;if(!i){let t={id:e,role:`reasoning`,content:``,...n!=null&&{subagentRunId:n}};o.push(t),i=t}let a=zO(i,t);(!r||a)&&f({messages:o})}return p()}case L.REASONING_MESSAGE_CONTENT:{let{messageId:i,delta:a}=t,c=o.find(e=>e.id===i);if(!c)return console.warn(`REASONING_MESSAGE_CONTENT: No message found with ID '${i}'`),p();if(c.role===`activity`)return console.warn(`REASONING_MESSAGE_CONTENT: Message '${i}' is an activity message — message ids must be unique across activity and reasoning messages`),p();let l=await NO(r,o,s,(r,i,a)=>r.onReasoningMessageContentEvent?.({event:t,messages:i,state:a,agent:n,input:e,reasoningMessageBuffer:typeof c.content==`string`?c.content:``}));return f(l),l.stopPropagation!==!0&&(c.content=`${typeof c.content==`string`?c.content:``}${a}`,zO(c,t),f({messages:o})),p()}case L.REASONING_MESSAGE_END:{let{messageId:i}=t,a=o.find(e=>e.id===i);if(!a)return console.warn(`REASONING_MESSAGE_END: No message found with ID '${i}'`),p();if(a.role===`activity`)return console.warn(`REASONING_MESSAGE_END: Message '${i}' is an activity message — message ids must be unique across activity and reasoning messages`),p();let c=await NO(r,o,s,(r,i,o)=>r.onReasoningMessageEndEvent?.({event:t,messages:i,state:o,agent:n,input:e,reasoningMessageBuffer:typeof a.content==`string`?a.content:``}));return f(c),c.stopPropagation!==!0&&zO(a,t)&&f({messages:o}),await Promise.all(r.map(t=>{t.onNewMessage?.({message:a,messages:o,state:s,agent:n,input:e})})),p()}case L.REASONING_MESSAGE_CHUNK:throw Error(`REASONING_MESSAGE_CHUNK must be transformed before being applied`);case L.REASONING_END:return f(await NO(r,o,s,(r,i,a)=>r.onReasoningEndEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),p();case L.REASONING_ENCRYPTED_VALUE:{let{subtype:i,entityId:a,encryptedValue:l}=t,u=await NO(r,o,s,(r,i,a)=>r.onReasoningEncryptedValueEvent?.({event:t,messages:i,state:a,agent:n,input:e}));if(f(u),u.stopPropagation!==!0){let e=!1;if(i===`tool-call`){for(let t of o)if(t.role===`assistant`&&t.toolCalls){let n=t.toolCalls.find(e=>e.id===a);if(n){n.encryptedValue=l,e=!0;break}}}else{let t=o.find(e=>e.id===a);t?.role!==`activity`&&t&&(t.encryptedValue=l,e=!0)}e&&(c.messages=o)}return p()}case L.SUBAGENT_STARTED:return f(await NO(r,o,s,(r,i,a)=>r.onSubagentStartedEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),p();case L.SUBAGENT_FINISHED:return f(await NO(r,o,s,(r,i,a)=>r.onSubagentFinishedEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),p();case L.SUBAGENT_ERROR:return f(await NO(r,o,s,(r,i,a)=>r.onSubagentErrorEvent?.({event:t,messages:i,state:a,agent:n,input:e}))),p()}return t.type,p()}),Dd(),r.length>0?Fd({}):e=>e)};function VO(e,t){typeof process<`u`&&{}.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`[ag-ui][compat] Converting deprecated ${e} to ${t}. The old shape leaves the protocol after its shim window — see the repo-root DEPRECATIONS.md. Set SUPPRESS_TRANSFORMATION_WARNINGS=true to silence.`)}var HO=e=>t=>{let n=FO(e),r=new Set,i=new Set,a=new Set,o=new Set,s={message:new Map,toolCall:new Map,activity:new Map,reasoning:new Map},c=!1,l=!1,u=!1,d=new Map,f=e=>{let t=d.get(e);return t||(t=new Map,d.set(e,t)),t},p=()=>{for(let e of d.values())if(e.size>0)return!0;return!1},m=new Map,h=new Set,g=!1,_=!1,v=()=>{_=!1,r.clear(),i.clear(),a.clear(),o.clear(),s.message.clear(),s.toolCall.clear(),s.activity.clear(),s.reasoning.clear(),d.clear(),m.clear(),h.clear(),c=!1,l=!1,g=!0},y=(e,t)=>{let n=e??[];if(Array.isArray(n))for(let e of n){if(!e||typeof e.id!=`string`)continue;if(e.subagentRunId===null)return new R(`Cannot send a message (id '${e.id}') with 'subagentRunId: null'. The field is optional — omit it entirely.`);let n=e.role===`reasoning`?s.reasoning:e.role===`activity`?s.activity:s.message;(t||!n.has(e.id))&&n.set(e.id,{subagentRunId:e.subagentRunId});for(let n of e.toolCalls??[])n&&typeof n.id==`string`&&(t||!s.toolCall.has(n.id))&&s.toolCall.set(n.id,{subagentRunId:e.subagentRunId??void 0})}},b=(e,t,n,r,i)=>{if(t!==void 0&&n&&n.subagentRunId!==t)return new R(`Cannot send '${e}': subagentRunId '${t}' does not match the ${r} '${i}' opener's subagent '${n.subagentRunId??`(the parent agent)`}'.`)};return t.pipe(Ed(e=>{let t=e.type;if(n?.event(`VERIFY`,`Event:`,e,{type:e.type}),l&&t!==L.RUN_STARTED)return B(()=>new R(`Cannot send event type '${t}': The run has already errored with 'RUN_ERROR'. No further events can be sent.`));if(c&&t!==L.RUN_ERROR&&t!==L.RUN_STARTED)return B(()=>new R(`Cannot send event type '${t}': The run has already finished with 'RUN_FINISHED'. Start a new run with 'RUN_STARTED'.`));if(!u){if(u=!0,t!==L.RUN_STARTED&&t!==L.RUN_ERROR)return B(()=>new R(`First event must be 'RUN_STARTED'`))}else if(t===L.RUN_STARTED){if(g&&!c&&!l)return B(()=>new R(`Cannot send 'RUN_STARTED' while a run is still active. The previous run must be finished with 'RUN_FINISHED' before starting a new run.`));(c||l)&&v()}if(e.subagentRunId===null){_||(_=!0,VO(`subagentRunId: null`,`an absent field`));let{subagentRunId:t,...n}=e;e=n}if(t===L.SUBAGENT_STARTED||t===L.SUBAGENT_FINISHED||t===L.SUBAGENT_ERROR){let n=t===L.SUBAGENT_STARTED?[`description`,`parentSubagentRunId`,`parentToolCallId`,`parentMessageId`]:t===L.SUBAGENT_FINISHED?[`outcome`]:[`code`];for(let r of n)if(e[r]===null)return B(()=>new R(`Cannot send '${t}' with '${r}: null'. The field is optional — omit it entirely.`));let r=e.outcome;if(r!=null&&r.type!==`success`&&r.type!==`suspended`)return B(()=>new R(`Cannot send '${t}' with outcome type '${String(r.type)}'. The outcome is either { type: "success" } or { type: "suspended" }.`));if(r&&r.interruptIds===null)return B(()=>new R(`Cannot send '${t}' with 'outcome.interruptIds: null'. The field is optional — omit it entirely.`));if(r&&Array.isArray(r.interruptIds)&&r.interruptIds.some(e=>typeof e!=`string`))return B(()=>new R(`Cannot send '${t}' with a non-string entry in 'outcome.interruptIds'. Interrupt ids are strings.`))}if(t===L.RUN_FINISHED){let t=e.outcome;if(t?.type===`interrupt`&&Array.isArray(t.interrupts)){for(let e of t.interrupts)if(e&&e.subagentRunId===null)return B(()=>new R(`Cannot send 'RUN_FINISHED' with an interrupt (id '${e.id}') carrying 'subagentRunId: null'. The field is optional — omit it entirely.`))}}switch(t){case L.TEXT_MESSAGE_START:{let n=e.messageId;if(r.has(n))return B(()=>new R(`Cannot send 'TEXT_MESSAGE_START' event: A text message with ID '${n}' is already in progress. Complete it with 'TEXT_MESSAGE_END' first.`));let i=s.message.get(n);if(i){let r=b(t,e.subagentRunId,i,`message`,n);if(r)return B(()=>r)}return r.add(n),i||s.message.set(n,{subagentRunId:e.subagentRunId}),xd(e)}case L.TEXT_MESSAGE_CONTENT:{let n=e.messageId;if(!r.has(n))return B(()=>new R(`Cannot send 'TEXT_MESSAGE_CONTENT' event: No active text message found with ID '${n}'. Start a text message with 'TEXT_MESSAGE_START' first.`));let i=b(t,e.subagentRunId,s.message.get(n),`message`,n);return i?B(()=>i):xd(e)}case L.TEXT_MESSAGE_END:{let n=e.messageId;if(!r.has(n))return B(()=>new R(`Cannot send 'TEXT_MESSAGE_END' event: No active text message found with ID '${n}'. A 'TEXT_MESSAGE_START' event must be sent first.`));let i=b(t,e.subagentRunId,s.message.get(n),`message`,n);return i?B(()=>i):(r.delete(n),xd(e))}case L.TOOL_CALL_START:{let n=e.toolCallId;if(i.has(n))return B(()=>new R(`Cannot send 'TOOL_CALL_START' event: A tool call with ID '${n}' is already in progress. Complete it with 'TOOL_CALL_END' first.`));let r=e.parentMessageId,a=e.subagentRunId,o;if(r!==void 0){let e=s.message.get(r);if(e){if(a!==void 0&&a!==e.subagentRunId)return B(()=>new R(`Cannot send 'TOOL_CALL_START': subagentRunId '${a}' does not match its parent message '${r}' owner '${e.subagentRunId??`(the parent agent)`}'. A tool call belongs to the message that carries it.`));o=e}}let c=s.toolCall.get(n);if(c){let e=b(t,a,c,`tool call`,n);if(e)return B(()=>e);if(a===void 0&&o&&o.subagentRunId!==c.subagentRunId)return B(()=>new R(`Cannot send 'TOOL_CALL_START': tool call '${n}' is owned by '${c.subagentRunId??`(the parent agent)`}' but its parent message '${r}' is owned by '${o.subagentRunId??`(the parent agent)`}'. A tool call belongs to the message that carries it.`))}return i.add(n),c||s.toolCall.set(n,a===void 0?o??{subagentRunId:void 0}:{subagentRunId:a}),xd(e)}case L.TOOL_CALL_ARGS:{let n=e.toolCallId;if(!i.has(n))return B(()=>new R(`Cannot send 'TOOL_CALL_ARGS' event: No active tool call found with ID '${n}'. Start a tool call with 'TOOL_CALL_START' first.`));let r=b(t,e.subagentRunId,s.toolCall.get(n),`tool call`,n);return r?B(()=>r):xd(e)}case L.TOOL_CALL_END:{let n=e.toolCallId;if(!i.has(n))return B(()=>new R(`Cannot send 'TOOL_CALL_END' event: No active tool call found with ID '${n}'. A 'TOOL_CALL_START' event must be sent first.`));let r=b(t,e.subagentRunId,s.toolCall.get(n),`tool call`,n);return r?B(()=>r):(i.delete(n),xd(e))}case L.STEP_STARTED:{let t=e.stepName,n=e.subagentRunId;return f(n).has(t)?B(()=>new R(`Step "${t}" is already active for 'STEP_STARTED'${n===void 0?``:` in subagent '${n}'`}`)):(f(n).set(t,!0),xd(e))}case L.STEP_FINISHED:{let t=e.stepName,n=e.subagentRunId;if(!f(n).has(t)){let e,r=!1;for(let[i,a]of d)if(i!==n&&a.has(t)){e=i,r=!0;break}return B(r?()=>new R(`Cannot send 'STEP_FINISHED' for step "${t}" attributed to ${n===void 0?`the parent agent`:`subagent '${n}'`}: that step is open under ${e===void 0?`the parent agent`:`subagent '${e}'`}. A step must be finished by whoever started it.`):()=>new R(`Cannot send 'STEP_FINISHED' for step "${t}" that was not started`))}return f(n).delete(t),xd(e)}case L.ACTIVITY_SNAPSHOT:{let t=e.messageId;return(!s.activity.has(t)||e.replace!==!1)&&s.activity.set(t,{subagentRunId:e.subagentRunId}),xd(e)}case L.TOOL_CALL_RESULT:{let t=e.messageId;return typeof t==`string`&&s.message.set(t,{subagentRunId:e.subagentRunId}),xd(e)}case L.REASONING_START:case L.REASONING_MESSAGE_START:{let n=e.messageId,r=t===L.REASONING_START,i=r?a:o;if(i.has(n))return B(()=>new R(r?`Cannot send 'REASONING_START' event: A reasoning span with ID '${n}' is already in progress. Complete it with 'REASONING_END' first.`:`Cannot send 'REASONING_MESSAGE_START' event: A reasoning message with ID '${n}' is already in progress. Complete it with 'REASONING_MESSAGE_END' first.`));let c=s.reasoning.get(n);if(c){let r=b(t,e.subagentRunId,c,`reasoning message`,n);if(r)return B(()=>r)}return i.add(n),c||s.reasoning.set(n,{subagentRunId:e.subagentRunId}),xd(e)}case L.REASONING_MESSAGE_CONTENT:case L.REASONING_MESSAGE_END:case L.REASONING_END:{let n=e.messageId,r=t===L.REASONING_END,i=r?a:o;if(!i.has(n))return B(()=>new R(r?`Cannot send 'REASONING_END' event: No active reasoning span found with ID '${n}'. A 'REASONING_START' event must be sent first.`:`Cannot send '${t}' event: No active reasoning message found with ID '${n}'. Start a reasoning message with 'REASONING_MESSAGE_START' first.`));let c=b(t,e.subagentRunId,s.reasoning.get(n),`reasoning message`,n);return c?B(()=>c):((t===L.REASONING_END||t===L.REASONING_MESSAGE_END)&&i.delete(n),xd(e))}case L.REASONING_ENCRYPTED_VALUE:{let n=e.entityId,r=e.subtype,i=r===`tool-call`?s.toolCall.get(n):r===`message`?s.message.get(n)??s.reasoning.get(n):s.reasoning.get(n),a=r===`tool-call`?`tool call`:r===`message`?`message`:`reasoning message`,o=b(t,e.subagentRunId,i,a,n);return o?B(()=>o):xd(e)}case L.ACTIVITY_DELTA:{let n=e.messageId,r=b(t,e.subagentRunId,s.activity.get(n),`activity`,n);return r?B(()=>r):xd(e)}case L.SUBAGENT_STARTED:{if(typeof e.subagentRunId!=`string`)return B(()=>new R(`Cannot send 'SUBAGENT_STARTED' without a 'subagentRunId'.`));if(typeof e.name!=`string`)return B(()=>new R(`Cannot send 'SUBAGENT_STARTED' without a 'name'.`));let t=e.subagentRunId,n=e.parentSubagentRunId;return m.has(t)?B(()=>new R(`Cannot send 'SUBAGENT_STARTED': subagent '${t}' is already active. Finish it with 'SUBAGENT_FINISHED' first.`)):h.has(t)?B(()=>new R(`Cannot send 'SUBAGENT_STARTED': subagent '${t}' has already finished in this run. Subagent IDs are per-invocation and cannot be reused.`)):n!==void 0&&!m.has(n)&&!h.has(n)?B(()=>new R(`Cannot send 'SUBAGENT_STARTED': parentSubagentRunId '${n}' has not been started in this run.`)):(m.set(t,!0),xd(e))}case L.SUBAGENT_FINISHED:case L.SUBAGENT_ERROR:{if(typeof e.subagentRunId!=`string`)return B(()=>new R(`Cannot send '${t}' without a 'subagentRunId'.`));if(t===L.SUBAGENT_ERROR&&typeof e.message!=`string`)return B(()=>new R(`Cannot send 'SUBAGENT_ERROR' without a 'message'.`));let n=e.subagentRunId;return m.has(n)?(m.delete(n),h.add(n),xd(e)):B(()=>new R(`Cannot send '${t}': no active subagent found with ID '${n}'. A 'SUBAGENT_STARTED' event must be sent first.`))}case L.MESSAGES_SNAPSHOT:{let t=y(e.messages,!0);if(t)return B(()=>t)}return xd(e);case L.RUN_STARTED:g=!0;{let t=y((e.input??{}).messages,!1);if(t)return B(()=>t)}return xd(e);case L.RUN_FINISHED:if(p()){let e=[];for(let[t,n]of d)for(let r of n.keys())e.push(t===void 0?r:`${r} (subagent '${t}')`);let t=e.join(`, `);return B(()=>new R(`Cannot send 'RUN_FINISHED' while steps are still active: ${t}`))}if(r.size>0){let e=Array.from(r.keys()).join(`, `);return B(()=>new R(`Cannot send 'RUN_FINISHED' while text messages are still active: ${e}`))}if(o.size>0){let e=Array.from(o.keys()).join(`, `);return B(()=>new R(`Cannot send 'RUN_FINISHED' while reasoning messages are still active: ${e}`))}if(a.size>0){let e=Array.from(a.keys()).join(`, `);return B(()=>new R(`Cannot send 'RUN_FINISHED' while reasoning spans are still active: ${e}`))}if(i.size>0){let e=Array.from(i.keys()).join(`, `);return B(()=>new R(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${e}`))}if(m.size>0){let e=Array.from(m.keys()).join(`, `);return B(()=>new R(`Cannot send 'RUN_FINISHED' while subagents are still active: ${e}`))}return c=!0,xd(e);case L.RUN_ERROR:return l=!0,xd(e);case L.CUSTOM:return xd(e);default:return xd(e)}}))},UO=function(e){return e.HEADERS=`headers`,e.DATA=`data`,e}({}),WO=e=>kd(()=>bd(e())).pipe(Ld(e=>{if(!e.ok){let t=e.headers.get(`content-type`)||``;return bd(e.text()).pipe(Ed(n=>{let r=n;if(t.includes(`application/json`))try{r=JSON.parse(n)}catch{}let i=Error(`HTTP ${e.status}: ${typeof r==`string`?r:JSON.stringify(r)}`);return i.status=e.status,i.payload=r,B(()=>i)}))}let t={type:UO.HEADERS,status:e.status,headers:e.headers},n=e.body?.getReader();return n?new Au(e=>{let r=!1;return e.next(t),(async()=>{try{for(;!e.closed;){let{done:t,value:i}=await n.read();if(t){r=!0;break}let a={type:UO.DATA,data:i};e.next(a)}e.complete()}catch(t){r=!0,e.error(t)}})(),()=>{r||n.cancel().catch(e=>{e?.name!==`AbortError`&&console.warn(`Failed to cancel HTTP response stream:`,e)})}}):B(()=>Error(`Failed to getReader() from response`))})),GO=10485760,KO=(e,t)=>{let n=FO(t),r=new zu,i=new TextDecoder(`utf-8`,{fatal:!1}),a=``;e.subscribe({next:e=>{if(e.type!==UO.HEADERS&&e.type===UO.DATA&&e.data){let t=i.decode(e.data,{stream:!0});a+=t;let n=a.split(/\n\n/);a=n.pop()||``;for(let e of n)o(e);if(a.length>GO){r.error(Error(`SSE buffer size exceeded maximum limit of ${GO/1048576} MB`));return}}},error:e=>r.error(e),complete:()=>{a&&(a+=i.decode(),o(a)),r.complete()}});function o(e){let t=e.split(` `),i=[];for(let e of t)e.startsWith(`data:`)&&i.push(e.slice(5).replace(/^ /,``));if(i.length>0)try{let e=i.join(` `),t=JSON.parse(e);n?.event(`SSE`,`Event received:`,t,{type:t?.type}),r.next(t)}catch(e){r.error(e)}}return r.asObservable()},qO=10485760,JO=()=>typeof process<`u`&&!!{}.SUPPRESS_TRANSFORMATION_WARNINGS,YO=(e,t)=>{let n=FO(t),r=new zu,i=new Uint8Array,a=!1;e.subscribe({next:e=>{if(e.type!==UO.HEADERS&&e.type===UO.DATA&&e.data){let t=new Uint8Array(i.length+e.data.length);t.set(i,0),t.set(e.data,i.length),i=t,o()}},error:e=>r.error(e),complete:()=>{if(o(),!a){if(i.length>0){r.error(Error(`The binary stream ended mid-frame: ${i.length} trailing bytes could not be read as a complete message.`));return}r.complete()}}});function o(){if(!a)for(;i.length>=4;){let e=4+new DataView(i.buffer,i.byteOffset,4).getUint32(0,!1);if(e>qO){r.error(Error(`Protobuf message size exceeded maximum limit of ${qO/1048576} MB`));return}if(i.length{let n=FO(t),r=new zu,i=new Hu(1),a=!1,o,s=!1,c=()=>{s=!0,o?.unsubscribe()},l=e=>{c(),r.error(e)},u=()=>{c(),r.complete()};return o=e.subscribe({next:e=>{if(i.next(e),e.type===UO.HEADERS&&!a){a=!0;let t=e.headers.get(`content-type`);n?.lifecycle(`HTTP`,`Stream format detected:`,{contentType:t,parser:t===`application/vnd.ag-ui.event+proto`?`protobuf`:`sse`}),t===`application/vnd.ag-ui.event+proto`?YO(i,n).subscribe({next:e=>r.next(e),error:e=>l(e),complete:()=>u()}):KO(i,n).subscribe({next:e=>{if(typeof e!=`object`||!e||Array.isArray(e)){let t=Error(`Invalid event: the frame is not a JSON object.`);n?.event(`HTTP`,`Event invalid:`,{json:e,error:String(t)}),l(t);return}let t=e;if(typeof t.type!=`string`||t.type.length===0){let t=Error(`Invalid event: the frame carries no event type.`);n?.event(`HTTP`,`Event invalid:`,{json:e,error:String(t)}),l(t);return}n?.event(`HTTP`,`Event received:`,e,{type:t.type}),r.next(e)},error:e=>{if(e?.name===`AbortError`){r.next({type:L.RUN_ERROR,message:e.message||`Request aborted`,code:`abort`,rawEvent:e}),u();return}return l(e)},complete:()=>u()})}else a||l(Error(`No headers event received before data events`))},error:e=>{i.error(e),l(e)},complete:()=>{i.complete()}}),s&&o.unsubscribe(),r.asObservable()},ZO={TextMessageStart:`TextMessageStart`,TextMessageContent:`TextMessageContent`,TextMessageEnd:`TextMessageEnd`,ActionExecutionStart:`ActionExecutionStart`,ActionExecutionArgs:`ActionExecutionArgs`,ActionExecutionEnd:`ActionExecutionEnd`,ActionExecutionResult:`ActionExecutionResult`,AgentStateMessage:`AgentStateMessage`,MetaEvent:`MetaEvent`,RunStarted:`RunStarted`,RunFinished:`RunFinished`,RunError:`RunError`,NodeStarted:`NodeStarted`,NodeFinished:`NodeFinished`},QO=e=>{if(typeof e==`string`)return e;if(!Array.isArray(e))return;let t=e.filter(e=>e.type===`text`).map(e=>e.text).filter(e=>e.length>0);if(t.length!==0)return t.join(` -`)};function $O(e,t){return al(t)&&ek(`[ag-ui][legacy] The result of tool call '${e}' carries content parts the legacy protocol cannot represent; only its text parts are bridged and the rest is dropped.`),il(t)}var ek=e=>{typeof process<`u`&&{}.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(e)},tk=(e,t,n)=>r=>{let i={},a=!0,o=!0,s=``,c=null,l=null,u=[],d={},f=!1,p=e=>{typeof e==`object`&&e&&(`messages`in e&&delete e.messages,i=e)};return r.pipe(Ed(r=>{switch(r.type){case L.TEXT_MESSAGE_START:{let e=r;return[{type:ZO.TextMessageStart,messageId:e.messageId,role:e.role}]}case L.TEXT_MESSAGE_CONTENT:{let e=r;return[{type:ZO.TextMessageContent,messageId:e.messageId,content:e.delta}]}case L.TEXT_MESSAGE_END:{let e=r;return[{type:ZO.TextMessageEnd,messageId:e.messageId}]}case L.TOOL_CALL_START:{let e=r;return u.push({id:e.toolCallId,type:`function`,function:{name:e.toolCallName,arguments:``}}),o=!0,d[e.toolCallId]=e.toolCallName,[{type:ZO.ActionExecutionStart,actionExecutionId:e.toolCallId,actionName:e.toolCallName,parentMessageId:e.parentMessageId}]}case L.TOOL_CALL_ARGS:{let c=r,d=u.find(e=>e.id===c.toolCallId);if(!d)return ek(`[ag-ui][legacy] TOOL_CALL_ARGS: No tool call found with ID '${c.toolCallId}'`),[];d.function.arguments+=c.delta;let f=!1;if(l){let e=l.find(e=>e.tool==d.function.name);if(e)try{let t=JSON.parse(Vd(d.function.arguments));e.tool_argument&&e.tool_argument in t?(p({...i,[e.state_key]:t[e.tool_argument]}),f=!0):e.tool_argument||(p({...i,[e.state_key]:t}),f=!0)}catch{}}return[{type:ZO.ActionExecutionArgs,actionExecutionId:c.toolCallId,args:c.delta},...f?[{type:ZO.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}]:[]]}case L.TOOL_CALL_END:{let e=r;return[{type:ZO.ActionExecutionEnd,actionExecutionId:e.toolCallId}]}case L.TOOL_CALL_RESULT:{let e=r,t=d[e.toolCallId];return(t===void 0||t===``)&&ek(`[ag-ui][legacy] No usable tool name was seen for tool call '${e.toolCallId}' (${t===void 0?`no TOOL_CALL_START reached this bridge`:`its TOOL_CALL_START carried an empty toolCallName`}), so its result is being bridged with the fabricated action name "unknown". Downstream consumers route on that name.`),[{type:ZO.ActionExecutionResult,actionExecutionId:e.toolCallId,result:$O(e.toolCallId,e.content),actionName:t||`unknown`}]}case L.RAW:return f||(f=!0,ek(`[ag-ui][legacy] Dropping RAW events: the legacy runtime protocol has no equivalent, so the provider payloads they carry do not reach the legacy stream. Reported once per stream.`)),[];case L.CUSTOM:{let e=r;switch(e.name){case`Exit`:a=!1;break;case`PredictState`:l=e.value}return[{type:ZO.MetaEvent,name:e.name,value:e.value}]}case L.STATE_SNAPSHOT:return p(r.snapshot),[{type:ZO.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}];case L.STATE_DELTA:{let c=r,l;try{l=Vl.applyPatch(i,c.delta,!0,!1).newDocument}catch(e){let t=e instanceof Error?e.message:String(e);return ek(`[ag-ui][legacy] Failed to apply state patch:\nCurrent state: ${JSON.stringify(i,null,2)}\nPatch operations: ${JSON.stringify(c.delta,null,2)}\nError: ${t}`),[]}return p(l),[{type:ZO.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}]}case L.MESSAGES_SNAPSHOT:return c=r.messages,[{type:ZO.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify({...i,...c?{messages:c}:{}}),active:!0}];case L.RUN_STARTED:return[];case L.RUN_FINISHED:{if(c&&(i.messages=c),Object.keys(i).length===0)return[];let r=null;if(c)try{r=nk(c)}catch(e){return[{type:ZO.RunError,message:e.message}]}return[{type:ZO.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify({...i,...r?{messages:r}:{}}),active:!1}]}case L.RUN_ERROR:{let e=r;return[{type:ZO.RunError,message:e.message,code:e.code}]}case L.STEP_STARTED:return s=r.stepName,u=[],l=null,[{type:ZO.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:!0}];case L.STEP_FINISHED:return u=[],l=null,[{type:ZO.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:!1}];default:return[]}}))};function nk(e){let t=[];for(let n of e)if(n.role===`assistant`||n.role===`user`||n.role===`system`){let e=QO(n.content);if(e){let r={id:n.id,role:n.role,content:e};t.push(r)}if(n.role===`assistant`&&n.toolCalls&&n.toolCalls.length>0)for(let e of n.toolCalls){let r;try{r=JSON.parse(e.function.arguments)}catch(t){throw Error(`Failed to parse arguments for tool call '${e.id}' (${e.function.name}): ${t.message}`)}let i={id:e.id,name:e.function.name,arguments:r,parentMessageId:n.id};t.push(i)}}else if(n.role===`tool`){let r=`unknown`;for(let t of e)if(t.role===`assistant`&&t.toolCalls?.length){for(let e of t.toolCalls)if(e.id===n.toolCallId){r=e.function.name;break}}let i={id:n.id,result:$O(n.toolCallId,n.content),actionExecutionId:n.toolCallId,actionName:r};t.push(i)}return t}var rk=e=>e.kind===`tool`?e.fields.toolCallId:e.fields.messageId,ik=e=>e===`tool`?`toolCallId`:`messageId`,ak=(e,t,n,r,i)=>{if(r!==void 0&&r!==i)throw Error(`Cannot continue ${e} '${t}': chunk ${n} '${r}' does not match the open stream's ${n} ${i===void 0?`(absent)`:`'${i}'`}.`)},ok=(e,t)=>t.metadata===void 0?e:{...e,metadata:t.metadata},sk=(e,t)=>{let n=ok(e,t);return t.rawEvent===void 0?n:{...n,rawEvent:t.rawEvent}},ck=e=>new Set(Object.keys(e.shape)),lk=ck(Cx),uk=ck(Dx),dk=ck(uS),fk=(e,t)=>{let n;for(let r of Object.keys(e))t.has(r)||((n??={})[r]=e[r]);return n},pk=e=>{typeof process<`u`&&{}.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`[ag-ui][transform] ${e} Set SUPPRESS_TRANSFORMATION_WARNINGS=true to silence.`)},mk=(e,t,n,r)=>{if(t===void 0||n||e.length===0)return;let i=e[e.length-1],a=Object.keys(t).filter(e=>Object.prototype.hasOwnProperty.call(i,e));a.length>0&&pk(`A ${r} carried ${a.map(e=>`'${e}'`).join(`, `)}, which the synthesized ${String(i.type)} already describes. The synthesized value is kept and the chunk's is dropped — this stage does not judge a described field, so the producer's value cannot be substituted for its own.`),e[e.length-1]={...t,...i}},hk=e=>t=>{let n=FO(e),r=new Map,i=e=>{let t=r.get(e);if(!t)return[];switch(r.delete(e),t.kind){case`text`:{let e={type:L.TEXT_MESSAGE_END,messageId:t.fields.messageId,...t.fields.subagentRunId!==void 0&&{subagentRunId:t.fields.subagentRunId}};return n?.event(`TRANSFORM`,`TEXT_MESSAGE_END`,e,{messageId:e.messageId}),[e]}case`tool`:{let e={type:L.TOOL_CALL_END,toolCallId:t.fields.toolCallId,...t.fields.subagentRunId!==void 0&&{subagentRunId:t.fields.subagentRunId}};return n?.event(`TRANSFORM`,`TOOL_CALL_END`,e,{toolCallId:e.toolCallId}),[e]}case`reasoning`:{let e={type:L.REASONING_MESSAGE_END,messageId:t.fields.messageId,...t.fields.subagentRunId!==void 0&&{subagentRunId:t.fields.subagentRunId}};return n?.event(`TRANSFORM`,`REASONING_MESSAGE_END`,e,{messageId:e.messageId}),[e]}}},a=()=>[...r.keys()].flatMap(e=>i(e)),o=(e,t)=>{for(let[n,i]of r)if(i.kind===e&&rk(i)===t)return{owner:n}},s=(e,t,n,i,a)=>{if(t!==void 0){let r=o(e,t);if(r){if(n!==void 0&&n!==r.owner)throw Error(`Cannot continue ${a} '${t}': chunk subagentRunId '${n}' does not match the open stream's subagent '${r.owner??`(the parent agent)`}'.`);return r.owner}return n}if(n!==void 0)return n;if(r.get(void 0)?.kind===e)return;let s=[...r.entries()].filter(([,t])=>t.kind===e);if(s.length===1)return s[0][0];if(s.length>1)throw Error(`Ambiguous ${i}: it carries neither a ${ik(e)} nor a subagentRunId, but ${s.length} lanes have an open ${a}. Attribute the chunk to the subagent it belongs to.`)};return t.pipe(Ed(e=>{switch(e.type){case L.TEXT_MESSAGE_START:case L.TEXT_MESSAGE_CONTENT:case L.TEXT_MESSAGE_END:case L.TOOL_CALL_START:case L.TOOL_CALL_ARGS:case L.TOOL_CALL_END:case L.TOOL_CALL_RESULT:case L.STATE_SNAPSHOT:case L.STATE_DELTA:case L.CUSTOM:case L.STEP_STARTED:case L.STEP_FINISHED:case L.REASONING_START:case L.REASONING_MESSAGE_START:case L.REASONING_MESSAGE_CONTENT:case L.REASONING_MESSAGE_END:case L.REASONING_END:return[...i(e.subagentRunId??void 0),e];case L.RUN_STARTED:case L.RUN_FINISHED:case L.RUN_ERROR:case L.MESSAGES_SNAPSHOT:return[...a(),e];case L.RAW:case L.ACTIVITY_SNAPSHOT:case L.ACTIVITY_DELTA:case L.REASONING_ENCRYPTED_VALUE:case L.SUBAGENT_STARTED:return[e];case L.SUBAGENT_FINISHED:case L.SUBAGENT_ERROR:{let t=e.subagentRunId;return t==null?[e]:[...i(t),e]}case L.TEXT_MESSAGE_CHUNK:{let t=e,a=fk(e,lk),o=s(`text`,t.messageId,t.subagentRunId??void 0,`TEXT_MESSAGE_CHUNK`,`text message`),c=r.get(o),l=[],u=!1,d;if(c?.kind===`text`&&(t.messageId===void 0||t.messageId===c.fields.messageId))ak(`text message`,c.fields.messageId,`role`,t.role,c.fields.role),ak(`text message`,c.fields.messageId,`name`,t.name,c.fields.name),d=c.fields;else{if(l.push(...i(o)),t.messageId===void 0)throw Error(`First TEXT_MESSAGE_CHUNK must have a messageId`);d={messageId:t.messageId,role:t.role===void 0?`assistant`:t.role,name:t.name,subagentRunId:t.subagentRunId},r.set(o,{kind:`text`,fields:d});let e=ok({type:L.TEXT_MESSAGE_START,messageId:t.messageId,role:d.role,...t.name!==void 0&&{name:t.name},...t.subagentRunId!==void 0&&{subagentRunId:t.subagentRunId}},t);l.push(e),n?.event(`TRANSFORM`,`TEXT_MESSAGE_START`,e,{messageId:t.messageId})}if(t.delta!==void 0||t.rawEvent!==void 0){let e=t.subagentRunId===void 0?d.subagentRunId:t.subagentRunId,r=sk({...a,type:L.TEXT_MESSAGE_CONTENT,messageId:d.messageId,delta:t.delta===void 0?``:t.delta,...e!==void 0&&{subagentRunId:e}},t);l.push(r),u=!0,n?.event(`TRANSFORM`,`TEXT_MESSAGE_CONTENT`,r,{messageId:d.messageId})}if(l.length===0&&(t.metadata!==void 0||t.rawEvent!==void 0||t.subagentRunId===null||a!==void 0)){let e=t.subagentRunId===void 0?d.subagentRunId:t.subagentRunId;l.push({...a,type:L.TEXT_MESSAGE_CONTENT,messageId:d.messageId,delta:``,...t.metadata!==void 0&&{metadata:t.metadata},...t.rawEvent!==void 0&&{rawEvent:t.rawEvent},...e!==void 0&&{subagentRunId:e}}),u=!0}return mk(l,a,u,`TEXT_MESSAGE_CHUNK`),l}case L.TOOL_CALL_CHUNK:{let t=e,a=fk(e,uk),o=s(`tool`,t.toolCallId,t.subagentRunId??void 0,`TOOL_CALL_CHUNK`,`tool call`),c=r.get(o),l=[],u=!1,d;if(c?.kind===`tool`&&(t.toolCallId===void 0||t.toolCallId===c.fields.toolCallId))ak(`tool call`,c.fields.toolCallId,`toolCallName`,t.toolCallName,c.fields.toolCallName),ak(`tool call`,c.fields.toolCallId,`parentMessageId`,t.parentMessageId,c.fields.parentMessageId),d=c.fields;else{if(l.push(...i(o)),t.toolCallId===void 0)throw Error(`First TOOL_CALL_CHUNK must have a toolCallId`);if(t.toolCallName===void 0)throw Error(`First TOOL_CALL_CHUNK must have a toolCallName`);d={toolCallId:t.toolCallId,toolCallName:t.toolCallName,parentMessageId:t.parentMessageId,subagentRunId:t.subagentRunId},r.set(o,{kind:`tool`,fields:d});let e=ok({type:L.TOOL_CALL_START,toolCallId:t.toolCallId,toolCallName:t.toolCallName,...t.parentMessageId!==void 0&&{parentMessageId:t.parentMessageId},...t.subagentRunId!==void 0&&{subagentRunId:t.subagentRunId}},t);l.push(e),n?.event(`TRANSFORM`,`TOOL_CALL_START`,e,{toolCallId:t.toolCallId,toolCallName:t.toolCallName})}if(t.delta!==void 0||t.rawEvent!==void 0){let e=t.subagentRunId===void 0?d.subagentRunId:t.subagentRunId,r=sk({...a,type:L.TOOL_CALL_ARGS,toolCallId:d.toolCallId,delta:t.delta===void 0?``:t.delta,...e!==void 0&&{subagentRunId:e}},t);l.push(r),u=!0,n?.event(`TRANSFORM`,`TOOL_CALL_ARGS`,r,{toolCallId:d.toolCallId})}if(l.length===0&&(t.metadata!==void 0||t.rawEvent!==void 0||t.subagentRunId===null||a!==void 0)){let e=t.subagentRunId===void 0?d.subagentRunId:t.subagentRunId;l.push({...a,type:L.TOOL_CALL_ARGS,toolCallId:d.toolCallId,delta:``,...t.metadata!==void 0&&{metadata:t.metadata},...t.rawEvent!==void 0&&{rawEvent:t.rawEvent},...e!==void 0&&{subagentRunId:e}}),u=!0}return mk(l,a,u,`TOOL_CALL_CHUNK`),l}case L.REASONING_MESSAGE_CHUNK:{let t=e,a=fk(e,dk),o=s(`reasoning`,t.messageId,t.subagentRunId??void 0,`REASONING_MESSAGE_CHUNK`,`reasoning message`),c=r.get(o),l=[],u=!1,d;if(c?.kind===`reasoning`&&(t.messageId===void 0||t.messageId===c.fields.messageId))d=c.fields;else{if(l.push(...i(o)),t.messageId===void 0)throw Error(`First REASONING_MESSAGE_CHUNK must have a messageId`);d={messageId:t.messageId,subagentRunId:t.subagentRunId},r.set(o,{kind:`reasoning`,fields:d});let e=ok({type:L.REASONING_MESSAGE_START,messageId:t.messageId,role:`reasoning`,...t.subagentRunId!==void 0&&{subagentRunId:t.subagentRunId}},t);l.push(e),n?.event(`TRANSFORM`,`REASONING_MESSAGE_START`,e,{messageId:t.messageId})}if(t.delta!==void 0||t.rawEvent!==void 0){let e=t.subagentRunId===void 0?d.subagentRunId:t.subagentRunId,r=sk({...a,type:L.REASONING_MESSAGE_CONTENT,messageId:d.messageId,delta:t.delta===void 0?``:t.delta,...e!==void 0&&{subagentRunId:e}},t);l.push(r),u=!0,n?.event(`TRANSFORM`,`REASONING_MESSAGE_CONTENT`,r,{messageId:d.messageId})}if(l.length===0&&(t.metadata!==void 0||t.rawEvent!==void 0||t.subagentRunId===null||a!==void 0)){let e=t.subagentRunId===void 0?d.subagentRunId:t.subagentRunId;l.push({...a,type:L.REASONING_MESSAGE_CONTENT,messageId:d.messageId,delta:``,...t.metadata!==void 0&&{metadata:t.metadata},...t.rawEvent!==void 0&&{rawEvent:t.rawEvent},...e!==void 0&&{subagentRunId:e}}),u=!0}return mk(l,a,u,`REASONING_MESSAGE_CHUNK`),l}}return e.type,[e]}),Id(()=>{a()}))},gk=Symbol(`agui.strip.drop`);function _k(e){let t=e;for(;;){if(t instanceof iO||t instanceof oO||t instanceof cO||t instanceof vO||t instanceof mO){t=t.unwrap();continue}if(t instanceof gO){t=t.def.in;continue}if(t instanceof bO){t=t.def.getter();continue}return t}}function vk(e){let t=e.def;return typeof t?.discriminator==`string`?t.discriminator:void 0}function yk(e){let t=e,n=Array.isArray(t.def?.values)?t.def.values:t.values?Array.from(t.values):void 0;return n&&n.length===1?n[0]:t.value}function bk(e){let t=_k(e);return t instanceof tO?yk(t):void 0}function xk(e,t,n,r){let i=_k(t);if(i instanceof qD){if(typeof e!=`object`||!e||Array.isArray(e))return e;let t=i.shape,a=e,o={},s=i.meta()?.specOpen===!0;for(let e of Object.keys(a)){let i=Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0;if(i===void 0){if(s){o[e]=a[e];continue}r.push(`${n}/${e}`);continue}let c=r.length,l=xk(a[e],i,`${n}/${e}`,r);if(l===gk){if(r.length=c,i.safeParse(void 0).success){r.push(`${n}/${e}`);continue}return gk}o[e]=l}return o}if(i instanceof GD){if(!Array.isArray(e))return e;let t=i.element,a=[];return e.forEach((e,i)=>{let o=r.length,s=xk(e,t,`${n}/${i}`,r);if(s===gk){r.length=o,r.push(`${n}/${i}`);return}a.push(s)}),a}if(i instanceof QD){if(typeof e!=`object`||!e||Array.isArray(e))return e;let t=i.def.valueType,a=e,o={};for(let e of Object.keys(a)){let i=r.length,s=xk(a[e],t,`${n}/${e}`,r);if(s===gk){r.length=i,r.push(`${n}/${e}`);continue}o[e]=s}return o}if(i instanceof JD){let t=i.options,a=vk(i);if(a!==void 0){if(typeof e!=`object`||!e||Array.isArray(e))return e;let i=e[a];for(let o of t){let t=_k(o);if(!(t instanceof qD))continue;let s=t.shape;if(bk(s[a])===i)return xk(e,o,n,r)}return gk}let o=t.filter(e=>_k(e)instanceof qD),s=typeof e==`object`&&!!e&&!Array.isArray(e);if(o.length>1&&s)return e;for(let i of t){let t=_k(i);if(t instanceof GD&&Array.isArray(e)||t instanceof qD&&s)return xk(e,i,n,r)}return e}return e}function Sk(e,t){let n=[],r=xk(e,t,``,n);if(r===gk)throw Error(`Internal error: the stripper found the whole value unrecognisable, which the schemas are not supposed to allow — schema/stripper mismatch.`);return{value:r,stripped:n}}var Ck=new Set(Object.values(L));function wk(e){return Ck.has(e.type)}var Tk=new Map(gS.options.map(e=>{let t=e.shape;return[String(yk(t.type)),e]})),Ek=()=>typeof process<`u`&&!!{}.SUPPRESS_TRANSFORMATION_WARNINGS;function Dk(e){Ek()||console.warn(`[ag-ui][enforce] ${e}`)}var Ok=e=>t=>{let n=FO(e);return t.pipe(Ed(e=>{if(!wk(e))return Dk(`Dropping unrecognised event '${String(e.type)}': no middleware translated it and the protocol does not describe it.`),n?.event(`ENFORCE`,`Unrecognised event dropped:`,e,{type:e.type}),Uu;let t=Tk.get(e.type);if(t===void 0)throw Error(`No validator for recognised event type '${String(e.type)}'`);let{value:r,stripped:i}=Sk(e,t);for(let t of i)Dk(`Removed unrecognised material at '${t}' on ${String(e.type)}. Nothing handled it; see the repo-root DEPRECATIONS.md if it is a retired shape.`);return xd(t.parse(r))}))};function kk(e){let{value:t,stripped:n}=Sk(tl(e,`RunAgentInput`),Xx);for(let e of n)Dk(`Removed unrecognised material at '${e}' from the outgoing input.`);return Xx.parse(t)}var Ak=class{runNext(e,t){return t.run(e).pipe(hk(!1))}runNextWithState(e,t){let n=DO(e.messages||[]),r=DO(e.state===void 0?{}:e.state),i=new Hu;return BO(e,i,t,[]).subscribe({next:e=>{e.messages!==void 0&&(n=e.messages),e.state!==void 0&&(r=e.state)},error:()=>{}}),this.runNext(e,t).pipe(Md(async e=>(i.next(e),await new Promise(e=>setTimeout(e,0)),{event:e,messages:DO(n),state:DO(r)})))}},jk=class extends Ak{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function Mk(e){return e.startsWith(`image/`)?`image`:e.startsWith(`audio/`)?`audio`:e.startsWith(`video/`)?`video`:`document`}function Nk(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`binary`&&`mimeType`in e&&typeof e.mimeType==`string`}function Pk(e){let t=Mk(e.mimeType);return e.data?{type:t,source:{type:`data`,value:e.data,mimeType:e.mimeType},...e.filename?{metadata:{filename:e.filename}}:{}}:e.url?{type:t,source:{type:`url`,value:e.url,mimeType:e.mimeType},...e.filename?{metadata:{filename:e.filename}}:{}}:((typeof process>`u`||!{}.SUPPRESS_TRANSFORMATION_WARNINGS)&&console.warn(`[ag-ui][compat] A binary content part carries only an id ('${e.id??``}') and cannot be converted to a modern media part; a 1.0 peer will not accept it. Provide data or a url. See the repo-root DEPRECATIONS.md.`),e)}function Fk(e,t,n){if(typeof e!=`object`||!e||!(`type`in e)||e.type!==t.type||!(`source`in e))return!1;let r=e.source;return typeof r!=`object`||!r||!(`type`in r)||r.type!==t.source.type||!(`value`in r)||r.value!==t.source.value||!(`mimeType`in r)||r.mimeType!==t.source.mimeType?!1:!n||`metadata`in e&&typeof e.metadata==`object`&&e.metadata!==null&&`filename`in e.metadata&&e.metadata.filename===n}function Ik(e){let t=e.content;if(!Array.isArray(t))return e;let n=t.flatMap(e=>{if(Nk(e)){let n=Pk(e);return n.type!==`binary`&&t.some(t=>Fk(t,n,e.filename))?[]:[n]}return[e]});return{...e,content:n}}var Lk=`THINKING_START`,Rk=`THINKING_END`,zk=`THINKING_TEXT_MESSAGE_START`,Bk=`THINKING_TEXT_MESSAGE_CONTENT`,Vk=`THINKING_TEXT_MESSAGE_END`;function Hk(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Uk={event:[`rawEvent`,`subagentRunId`],[L.RUN_STARTED]:[`parentRunId`,`input`],[L.RUN_FINISHED]:[`result`,`outcome`],[L.RUN_ERROR]:[`usage`],[L.SUBAGENT_FINISHED]:[`result`],[L.TOOL_CALL_START]:[`parentMessageId`],[L.TOOL_CALL_CHUNK]:[`parentMessageId`],[L.TOOL_CALL_RESULT]:[`role`],"RUN_FINISHED.outcome":[`pendingToolCallIds`],"RUN_FINISHED.usage[]":[`provider`,`reasoningTokens`,`cachedInputTokens`,`cacheWriteInputTokens`],RunAgentInput:[`forwardedProps`],Tool:[`parameters`],ResumeEntry:[`payload`],"input content":[`metadata`]},Wk=new Map(Object.entries(Uk).filter(([e])=>Object.values(L).includes(e))),Gk=e=>VO(e,`an absent field`);function Kk(e,t,n,r){if(!Hk(e))return e;let i;for(let a of t)e[a]===null&&(r(n===void 0?`${a}: null`:`${n}.${a}: null`),i??={...e},delete i[a]);return i??e}function qk(e,t,n){if(!Hk(e)||!Array.isArray(e[t]))return e;let r=e[t],i=r.map(n);return i.some((e,t)=>e!==r[t])?{...e,[t]:i}:e}function Jk(e,t){return qk(e,`content`,e=>{if(!Hk(e))return e;switch(e.type){case`image`:case`audio`:case`video`:case`document`:return Kk(e,Uk[`input content`],`${e.type} input content`,t);default:return e}})}function Yk(e,t=Gk){let n=Kk(e,Uk.RunAgentInput,`RunAgentInput`,t);return n=qk(n,`tools`,e=>Kk(e,Uk.Tool,`Tool`,t)),n=qk(n,`resume`,e=>Kk(e,Uk.ResumeEntry,`ResumeEntry`,t)),qk(n,`messages`,e=>Jk(e,t))}var Xk=class extends Ak{constructor(...e){super(...e),this.currentReasoningId=null,this.currentMessageId=null,this.nullsNoticedThisRun=new Set,this.noticeNullOncePerRun=e=>{this.nullsNoticedThisRun.has(e)||(this.nullsNoticedThisRun.add(e),VO(e,`an absent field`))}}warn(e,t){VO(e,t)}mintedContinuationId(e,t){if(t!==null)return t;let n=OO();return this.warnAside(`Minting a messageId ('${n}') for ${e}: no THINKING opener preceded it, so there was no id to continue. The id is this client's invention, not the producer's, and verification will reject the translated event for naming something nothing opened.`),n}warnAside(e){typeof process<`u`&&{}.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`[ag-ui][compat] ${e} Set SUPPRESS_TRANSFORMATION_WARNINGS=true to silence.`)}run(e,t){return this.currentReasoningId=null,this.currentMessageId=null,this.nullsNoticedThisRun.clear(),e.messages=e.messages.map(Ik),t.run(e).pipe(wd(e=>this.transformEvent(e)))}transformEvent(e){let t=this.noticeNullOncePerRun;e.type===L.RUN_STARTED&&this.nullsNoticedThisRun.clear(),e=Kk(e,Uk.event,void 0,t);let n=Wk.get(e.type);switch(n&&(e=Kk(e,n,e.type,t)),e.type){case Lk:{this.currentReasoningId=OO();let{title:t,...n}=e;return this.warn(Lk,L.REASONING_START),t!==void 0&&this.warnAside(`Dropping ${Lk}.title ${JSON.stringify(t)}: ${L.REASONING_START} has no title field, so the span's label cannot be carried and nothing downstream can recover it.`),{...n,type:L.REASONING_START,messageId:this.currentReasoningId}}case zk:return this.currentMessageId=OO(),this.warn(zk,L.REASONING_MESSAGE_START),{...e,type:L.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:`reasoning`};case Bk:{let{delta:t,...n}=e;return this.warn(Bk,L.REASONING_MESSAGE_CONTENT),{...n,type:L.REASONING_MESSAGE_CONTENT,messageId:this.mintedContinuationId(Bk,this.currentMessageId),delta:t}}case Vk:{let t=this.mintedContinuationId(Vk,this.currentMessageId);return this.currentMessageId=null,this.warn(Vk,L.REASONING_MESSAGE_END),{...e,type:L.REASONING_MESSAGE_END,messageId:t}}case Rk:{let t=this.mintedContinuationId(Rk,this.currentReasoningId);return this.currentReasoningId=null,this.warn(Rk,L.REASONING_END),{...e,type:L.REASONING_END,messageId:t}}case L.RUN_FINISHED:{let n=e,r=Kk(n.outcome,Uk[`RUN_FINISHED.outcome`],`RUN_FINISHED.outcome`,t);return qk(r===n.outcome?n:{...n,outcome:r},`usage`,e=>Kk(e,Uk[`RUN_FINISHED.usage[]`],`RUN_FINISHED.usage[]`,t))}case L.MESSAGES_SNAPSHOT:{let t=e;return Array.isArray(t.messages)?{...t,messages:t.messages.map(e=>this.upgradeInboundMessage(e))}:e}case L.RUN_STARTED:{let n=Yk(e.input,t),r=n===e.input?e:{...e,input:n},i=r;return!i.input||!Array.isArray(i.input.messages)?r:{...i,input:{...i.input,messages:i.input.messages.map(e=>this.upgradeInboundMessage(e))}}}default:return e}}upgradeInboundMessage(e){e=Jk(e,this.noticeNullOncePerRun);let t=e.content;return!Array.isArray(t)||!t.some(e=>typeof e==`object`&&!!e&&e.type===`binary`)?e:(this.warn(`binary input content`,`the modern media content parts`),Ik(e))}},Zk=()=>e=>kd(()=>{let t=new Xk;return e.pipe(wd(e=>t.transformEvent(e)))});function Qk(e,t=new Date){return e.expiresAt!==void 0&&new Date(e.expiresAt)<=t}function $k(){return typeof process<`u`&&!!{}.SUPPRESS_TRANSFORMATION_WARNINGS}function eA(e){$k()||console.warn(`[ag-ui][compat] Flattening message content for a <=0.0.39 peer DROPS non-text parts (${e.join(`, `)}). The peer cannot receive them; upgrade it to keep media content. See the repo-root DEPRECATIONS.md.`)}function tA(e){$k()||console.warn(`[ag-ui][compat] Not flattening message content for a <=0.0.39 peer: ${e} content part(s) claim type "text" but carry a malformed 'text' value. That is a defect in the message, not media the peer cannot represent, and a downgrade must not repair it — the content is passed on unchanged so the outgoing enforcement boundary reports it. See the repo-root DEPRECATIONS.md.`)}function nA(e){let t=e.content;if(Array.isArray(t)){let n=e=>typeof e==`object`&&!!e&&`type`in e&&e.type===`text`,r=e=>n(e)&&typeof e.text==`string`,i=t.filter(e=>n(e)&&!r(e));if(i.length>0)return tA(i.length),e;let a=t.filter(e=>!r(e)).map(e=>typeof e==`object`&&e&&`type`in e?String(e.type):typeof e);a.length>0&&eA(a);let o=t.filter(r).map(e=>e.text).join(``);return{...e,content:o}}return typeof t==`string`?e:t===void 0?{...e,content:``}:e}var rA=class extends Ak{run(e,t){let{parentRunId:n,...r}=e,i={...r,messages:r.messages.map(nA)};return this.runNext(i,t)}},iA=`THINKING_START`,aA=`THINKING_END`,oA=`THINKING_TEXT_MESSAGE_START`,sA=`THINKING_TEXT_MESSAGE_CONTENT`,cA=`THINKING_TEXT_MESSAGE_END`,lA=class extends Ak{constructor(...e){super(...e),this.currentReasoningId=null,this.currentMessageId=null}warnAboutTransformation(e,t){typeof process<`u`&&{}.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`AG-UI is converting ${e} to ${t}. To remove this warning, upgrade your AG-UI integration package (e.g. @ag-ui/langgraph). To surpress it, set SUPPRESS_TRANSFORMATION_WARNINGS=true in your .env file.`)}run(e,t){return this.currentReasoningId=null,this.currentMessageId=null,this.runNext(e,t).pipe(wd(e=>this.transformEvent(e)))}transformEvent(e){switch(e.type){case iA:{this.currentReasoningId=OO();let{title:t,...n}=e;return this.warnAboutTransformation(iA,L.REASONING_START),{...n,type:L.REASONING_START,messageId:this.currentReasoningId}}case oA:return this.currentMessageId=OO(),this.warnAboutTransformation(oA,L.REASONING_MESSAGE_START),{...e,type:L.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:`reasoning`};case sA:{let{delta:t,...n}=e;return this.warnAboutTransformation(sA,L.REASONING_MESSAGE_CONTENT),{...n,type:L.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??OO(),delta:t}}case cA:{let t=this.currentMessageId??OO();return this.warnAboutTransformation(cA,L.REASONING_MESSAGE_END),{...e,type:L.REASONING_MESSAGE_END,messageId:t}}case aA:{let t=this.currentReasoningId??OO();return this.warnAboutTransformation(aA,L.REASONING_END),{...e,type:L.REASONING_END,messageId:t}}default:return e}}},uA=`SUBAGENT_STARTED`,dA=`SUBAGENT_FINISHED`,fA=`SUBAGENT_ERROR`;function pA(e){if(e&&typeof e==`object`&&`subagentRunId`in e){let{subagentRunId:t,...n}=e;return n}return e}function mA(e){return e.map(e=>pA(e))}var hA=class extends Ak{warnDroppedLifecycleEvent(e){typeof process<`u`&&{}.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`AG-UI is dropping ${e} because the target agent predates subagent support. To remove this warning, upgrade your AG-UI integration package. To suppress it, set SUPPRESS_TRANSFORMATION_WARNINGS=true in your .env file.`)}run(e,t){let n={...e,messages:(e.messages??[]).map(e=>pA(e))};return this.runNext(n,t).pipe(zd(e=>{let t=e.type;(t===uA||t===dA||t===fA)&&this.warnDroppedLifecycleEvent(t)}),Ad(e=>{let t=e.type;return t!==uA&&t!==dA&&t!==fA}),wd(e=>{let t=pA(e);if(t.type===L.MESSAGES_SNAPSHOT){let e=t;if(Array.isArray(e.messages))return{...e,messages:mA(e.messages)}}if(t.type===L.RUN_FINISHED){let e=t;if(e.outcome&&Array.isArray(e.outcome.interrupts))return{...e,outcome:{...e.outcome,interrupts:e.outcome.interrupts.map(e=>pA(e))}}}if(t.type===L.RUN_STARTED){let e=t;if(e.input&&Array.isArray(e.input.messages))return{...e,input:{...e.input,messages:mA(e.input.messages)}}}return t}))}},gA=`1.0.2`,_A=!1,vA=new WeakSet,yA=(e,t)=>/^\d+\.\d+$/.test(e)?qT(e,t)>0?`newer`:`not-newer`:`uninterpretable`,bA=e=>{let t=e.protocolVersion;if(t!==void 0&&t!==`1.0`)switch(yA(t,`1.0`)){case`uninterpretable`:console.warn(`[ag-ui] The producer declared protocol version '${t}', which this client cannot interpret.`);return;case`newer`:console.warn(`[ag-ui] The producer speaks protocol ${t}; this client speaks 1.0. Unrecognised material will be stripped with warnings.`);return;case`not-newer`:return}},xA=class e{resolvePeerCeiling(t){if(this.resolvingPeerCeiling)return gA;let n=Object.getOwnPropertyDescriptor(this,`maxVersion`),r=Object.getOwnPropertyDescriptor(this,`maxProtocolVersion`),i=Object.getPrototypeOf(this);for(;i&&i!==e.prototype;)n??=Object.getOwnPropertyDescriptor(i,`maxVersion`),r??=Object.getOwnPropertyDescriptor(i,`maxProtocolVersion`),i=Object.getPrototypeOf(i);if(t===`maxVersion`&&n)return gA;let a=t===`maxProtocolVersion`?n:r;if(!a)return gA;this.resolvingPeerCeiling=!0;try{return a.get?a.get.call(this):a.value}finally{this.resolvingPeerCeiling=!1}}get maxProtocolVersion(){return this.resolvePeerCeiling(`maxProtocolVersion`)}get maxVersion(){return!this.resolvingPeerCeiling&&!_A&&(_A=!0,console.warn(`[ag-ui] AbstractAgent.maxVersion is deprecated — use maxProtocolVersion. Same value; the new name says whose version it is and that it is a ceiling.`)),this.resolvePeerCeiling(`maxVersion`)}get debug(){return this._debug}set debug(e){this._debug=PO(e),this._debugLogger=LO(this._debug)}get debugLogger(){return this._debugLogger}set debugLogger(e){this._debugLogger=typeof e==`boolean`?e?LO(PO(!0)):void 0:e}resolvedCeilingDuringConstruction(){let e=this.maxProtocolVersion;if(typeof e!=`string`||!JT(e))throw new R(`maxProtocolVersion resolved to ${JSON.stringify(e)} during construction, which is not a version this client can compare. A ceiling read from an instance field is not available yet — return a literal from the getter.`);return e}constructor({agentId:e,description:t,threadId:n,initialMessages:r,initialState:i,debug:a}={}){this.subscribers=[],this.isRunning=!1,this.pendingInterrupts=[],this.middlewares=[],this.resolvingPeerCeiling=!1,this.agentId=e,this.description=t??``,this.threadId=n??Zc(),this.messages=DO(r??[]),this.state=DO(i??{}),this._debug=PO(a),this._debugLogger=LO(this._debug);let o=this.resolvedCeilingDuringConstruction();qT(o,`0.0.39`)<=0&&this.middlewares.unshift(new rA),qT(o,`0.0.45`)<=0&&this.middlewares.unshift(new lA),qT(o,`0.0.57`)<=0&&this.middlewares.unshift(new hA)}subscribe(e){return this.subscribers.push(e),{unsubscribe:()=>{this.subscribers=this.subscribers.filter(t=>t!==e)}}}use(...e){let t=e.map(e=>typeof e==`function`?new jk(e):e);return this.middlewares.push(...t),this}async runAgent(e,t){try{this.isRunning=!0,this.agentId=this.agentId??Zc();let n=this.prepareRunAgentInput(e);this.debugLogger?.lifecycle(`LIFECYCLE`,`Run started:`,{agentId:this.agentId,threadId:this.threadId});let r,i=new Set(this.messages.map(e=>e.id)),a=[{onRunStartedEvent:({event:e})=>bA(e),onRunFinishedEvent:e=>{e.outcome===`success`&&(r=e.result)}},...this.subscribers,t??{}];vA.add(n),await this.onInitialize(n,a),this.activeRunDetach$=new zu;let o;this.activeRunCompletionPromise=new Promise(e=>{o=e}),await Cd(Ou(()=>[...this.middlewares,new Xk].reduceRight((e,t)=>({run:n=>t.run(n,e),get messages(){return e.messages},get state(){return e.state}}),this).run(n),Ok(this.debugLogger),hk(this.debugLogger),HO(this.debugLogger),e=>e.pipe(Rd(this.activeRunDetach$)),e=>this.applyBeforeSourceError(n,e,a),jd(e=>(this.debugLogger?.lifecycle(`LIFECYCLE`,`Run errored:`,{agentId:this.agentId,error:e instanceof Error?e.message:String(e)}),this.isRunning=!1,this.onError(n,e,a))),Id(()=>{this.debugLogger?.lifecycle(`LIFECYCLE`,`Run finished:`,{agentId:this.agentId,threadId:this.threadId}),this.isRunning=!1,this.onFinalize(n,a),o?.(),o=void 0,this.activeRunCompletionPromise=void 0,this.activeRunDetach$=void 0}))(xd(null)));let s=DO(this.messages).filter(e=>!i.has(e.id));return{result:r,newMessages:s}}finally{this.isRunning=!1}}connect(e){throw new nl}async connectAgent(e,t){try{this.isRunning=!0,this.agentId=this.agentId??Zc();let n=this.prepareRunAgentInput(e),r,i=new Set(this.messages.map(e=>e.id)),a=[{onRunStartedEvent:({event:e})=>bA(e),onRunFinishedEvent:e=>{e.outcome===`success`&&(r=e.result)}},...this.subscribers,t??{}];await this.onInitialize(n,a),this.activeRunDetach$=new zu;let o;this.activeRunCompletionPromise=new Promise(e=>{o=e}),await Cd(Ou(()=>kd(()=>this.connect(n)),e=>Ok(this.debugLogger)(Zk()(e)),hk(this.debugLogger),HO(this.debugLogger),e=>e.pipe(Rd(this.activeRunDetach$)),e=>this.applyBeforeSourceError(n,e,a),jd(e=>(this.isRunning=!1,e instanceof nl?Uu:this.onError(n,e,a))),Id(()=>{this.isRunning=!1,this.onFinalize(n,a),o?.(),o=void 0,this.activeRunCompletionPromise=void 0,this.activeRunDetach$=void 0}))(xd(null)),{defaultValue:void 0});let s=DO(this.messages).filter(e=>!i.has(e.id));return{result:r,newMessages:s}}finally{this.isRunning=!1}}abortRun(){}async detachActiveRun(){if(!this.activeRunDetach$)return;let e=this.activeRunCompletionPromise??Promise.resolve();this.activeRunDetach$.next(),this.activeRunDetach$?.complete(),await e}applyBeforeSourceError(e,t,n){return kd(()=>{let r,i=t.pipe(jd(e=>(r={error:e},Uu)));return this.processApplyEvents(e,this.apply(e,i,n),n).pipe(Pd(kd(()=>{let e=r;return e?B(()=>e.error):Uu})))})}apply(e,t,n){return BO(e,t,this,n,this.debugLogger)}processApplyEvents(e,t,n){return t.pipe(zd(t=>{t.messages&&(this.messages=t.messages,n.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),t.state!==void 0&&(this.state=t.state,n.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))}))}prepareRunAgentInput(e){let t=DO(this.messages);for(let e of t)e.subagentRunId===null&&delete e.subagentRunId;let n=t.filter(e=>e.role!==`activity`);return{threadId:this.threadId,runId:e?.runId||Zc(),...qT(this.maxProtocolVersion,gA)>=0&&{protocolVersion:`1.0`},tools:DO(e?.tools??[]),context:DO(e?.context??[]),forwardedProps:DO(e?.forwardedProps??{}),state:DO(this.state),messages:n,...e?.resume===void 0?{}:{resume:DO(e.resume)}}}async onInitialize(e,t){if(vA.has(e)&&this.pendingInterrupts.length>0){let t=new Set((e.resume??[]).map(e=>e.interruptId)),n=this.pendingInterrupts.map(e=>e.id).filter(e=>!t.has(e));if(n.length>0)throw new R(`Thread has ${n.length} pending interrupt(s) not addressed by resume: ${n.join(`, `)}`);for(let t of this.pendingInterrupts)if(Qk(t)&&(e.resume??[]).find(e=>e.interruptId===t.id)?.status!==`cancelled`)throw new R(`Interrupt ${t.id} expired at ${t.expiresAt} and can no longer be answered. Cancel it to continue the thread.`)}let n=await NO(t,this.messages,this.state,(t,n,r)=>t.onRunInitialized?.({messages:n,state:r,agent:this,input:e}));if(n.messages!==void 0||n.state!==void 0){if(n.messages){this.messages=n.messages;for(let e of n.messages)e.subagentRunId===null&&delete e.subagentRunId;e.messages=n.messages.filter(e=>e.role!==`activity`),t.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})}n.state!==void 0&&(this.state=n.state,e.state=n.state,t.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))}}onError(e,t,n){return bd(NO(n,this.messages,this.state,(n,r,i)=>n.onRunFailed?.({error:t,messages:r,state:i,agent:this,input:e}))).pipe(wd(r=>{let i=r;if((i.messages!==void 0||i.state!==void 0)&&(i.messages!==void 0&&(this.messages=i.messages,n.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),i.state!==void 0&&(this.state=i.state,n.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))),i.stopPropagation!==!0){let e=String(t);if(t.name!==`AbortError`&&t.message!==`Fetch is aborted`&&t.message!==`signal is aborted without reason`&&t.message!==`component unmounted`&&e!==`component unmounted`)throw console.error(`Agent execution failed:`,t),t}return{}}))}async onFinalize(e,t){let n=await NO(t,this.messages,this.state,(t,n,r)=>t.onRunFinalized?.({messages:n,state:r,agent:this,input:e}));(n.messages!==void 0||n.state!==void 0)&&(n.messages!==void 0&&(this.messages=n.messages,t.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),n.state!==void 0&&(this.state=n.state,t.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})})))}clone(){let e=Object.create(Object.getPrototypeOf(this));return e.agentId=this.agentId,e.description=this.description,e.threadId=this.threadId,e.messages=DO(this.messages),e.state=DO(this.state),e._debug=this._debug,e._debugLogger=this._debugLogger,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],e.pendingInterrupts=DO(this.pendingInterrupts),e}addMessage(e){this.messages.push(e),(async()=>{for(let t of this.subscribers)await t.onNewMessage?.({message:e,messages:this.messages,state:this.state,agent:this});if(e.role===`assistant`&&e.toolCalls)for(let t of e.toolCalls)for(let e of this.subscribers)await e.onNewToolCall?.({toolCall:t,messages:this.messages,state:this.state,agent:this});for(let e of this.subscribers)await e.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this})})()}addMessages(e){this.messages.push(...e),(async()=>{for(let t of e){for(let e of this.subscribers)await e.onNewMessage?.({message:t,messages:this.messages,state:this.state,agent:this});if(t.role===`assistant`&&t.toolCalls)for(let e of t.toolCalls)for(let t of this.subscribers)await t.onNewToolCall?.({toolCall:e,messages:this.messages,state:this.state,agent:this})}for(let e of this.subscribers)await e.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this})})()}setMessages(e){this.messages=DO(e),(async()=>{for(let e of this.subscribers)await e.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this})})()}setState(e){this.state=DO(e),(async()=>{for(let e of this.subscribers)await e.onStateChanged?.({messages:this.messages,state:this.state,agent:this})})()}legacy_to_be_removed_runAgentBridged(e){this.agentId=this.agentId??Zc();let t=this.prepareRunAgentInput(e);return[...this.middlewares,new Xk].reduceRight((e,t)=>({run:n=>t.run(n,e),get messages(){return e.messages},get state(){return e.state}}),this).run(t).pipe(Ok(this.debugLogger),hk(this.debugLogger),HO(this.debugLogger),tk(this.threadId,t.runId,this.agentId),e=>e.pipe(wd(e=>(this.debugLogger?.event(`LEGACY`,`Event:`,e,{type:e.type}),e))))}};function SA(e){if(!Array.isArray(e.messages))return e;let t=!1,n=e.messages.map(e=>{if(e.subagentRunId===null){t=!0;let n={...e};return delete n.subagentRunId,n}return e});return t?{...e,messages:n}:e}var CA=class extends xA{requestInit(e){return{method:`POST`,headers:{...this.headers,"Content-Type":`application/json`,Accept:`text/event-stream`},body:JSON.stringify(SA(e)),signal:this.abortController.signal}}runAgent(e,t){return this.abortController=e?.abortController??new AbortController,super.runAgent(e,t)}abortRun(){this.abortController.abort(),super.abortRun()}constructor(e){super(e),this.abortController=new AbortController,this.url=e.url,this.headers=DO(e.headers??{}),this.fetch=e.fetch??((e,t)=>fetch(e,t))}run(e){return XO(WO(()=>this.fetch(this.url,this.requestInit(kk(e)))),this.debugLogger)}clone(){let e=super.clone();e.url=this.url,e.headers=DO(this.headers??{}),e.fetch=this.fetch;let t=new AbortController,n=this.abortController.signal;return n.aborted&&t.abort(n.reason),e.abortController=t,e}},wA=N.createContext(void 0),TA=e=>{let t=N.useContext(wA);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},EA=({client:e,children:t})=>(N.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,P.jsx)(wA.Provider,{value:e,children:t})),DA={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},OA=new class{#e=DA;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function kA(e){setTimeout(e,0)}var AA=typeof window>`u`||`Deno`in globalThis;function jA(){}function MA(e,t){return typeof e==`function`?e(t):e}function NA(e){return typeof e==`number`&&e>=0&&e!==1/0}function PA(e,t){return Math.max(e+(t||0)-Date.now(),0)}function FA(e,t){return typeof e==`function`?e(t):e}function IA(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==RA(o,t.options))return!1}else if(!BA(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function LA(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(zA(t.options.mutationKey)!==zA(a))return!1}else if(!BA(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function RA(e,t){return(t?.queryKeyHashFn||zA)(e)}function zA(e){return JSON.stringify(e,(e,t)=>GA(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function BA(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){if(t.length>e.length)return!1;for(let n=0;n500)return t;let r=WA(e)&&WA(t);if(!r&&!(GA(e)&&GA(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l{OA.setTimeout(t,e)})}function JA(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:HA(e,t)}function YA(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function XA(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var ZA=Symbol();function QA(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===ZA?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function $A(e,t){return typeof e==`function`?e(...t):!!e}function ej(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var tj=()=>AA,nj=()=>tj(),rj=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},ij=new class extends rj{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},aj=kA;function oj(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=aj,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var sj=oj(),cj=new class extends rj{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function lj(e){return Math.min(1e3*2**e,3e4)}function uj(e){return(e??`online`)!==`online`||cj.isOnline()}var dj=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function fj(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(jA);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new dj(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>ij.isFocused()&&(e.networkMode===`always`||cj.isOnline())&&e.canRun(),p=()=>uj(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=t=>new Promise(n=>{r=e=>{(c()||t())&&n(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),_=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??(nj()?0:3),a=e.retryDelay??lj,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&nf()?void 0:g(f)).then(()=>{t?h(r):_()})})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g(p).then(_),s)}}var pj=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),NA(this.gcTime)&&(this.#e=OA.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(nj()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(OA.clearTimeout(this.#e),this.#e=void 0)}};function mj(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{ej(e,()=>t.signal,()=>n=!0)},u=QA(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?XA:YA;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?gj:hj,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:hj(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(ct.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function hj(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function gj(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function _j(e,t){return t?hj(e,t)!=null:!1}function vj(e,t){return!t||!e.getPreviousPageParam?!1:gj(e,t)!=null}var yj=class extends pj{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Sj(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Sj(this.options);e.data!==void 0&&(this.setState(xj(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=JA(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(jA).catch(jA):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>FA(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ZA||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>FA(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!PA(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=QA(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?mj(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=fj({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof dj&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof dj){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...bj(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...xj(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),sj.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function bj(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:uj(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function xj(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Sj(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var Cj=class extends rj{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Tj(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Ej(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ej(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof FA(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!UA(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Dj(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||FA(this.options.enabled,this.#t)!==FA(t.enabled,this.#t)||FA(this.options.staleTime,this.#t)!==FA(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||FA(this.options.enabled,this.#t)!==FA(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return UA(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(jA)),t}#h(e){return!nj()&&FA(this.options.enabled,this.#t)!==!1&&NA(e)}#g(){this.#b();let e=FA(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=PA(this.#r.dataUpdatedAt,e)+1;this.#u=OA.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return FA(this.options.refetchInterval,this.#t)??!1}#v(e){this.#x(),this.#f=e,this.#f!==0&&this.#h(this.#f)&&(this.#d=OA.setInterval(()=>{(this.options.refetchIntervalInBackground||ij.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(OA.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(OA.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Tj(e,t),o=i&&Dj(e,n,t,r);(a||o)&&(l={...l,...bj(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=JA(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=JA(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Oj(e,t),refetch:this.refetch,isEnabled:FA(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),UA(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();sj.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function wj(e,t){return FA(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||FA(t.retryOnMount,e)!==!1)}function Tj(e,t){return wj(e,t)||e.state.data!==void 0&&Ej(e,t,t.refetchOnMount)}function Ej(e,t,n){if(FA(t.enabled,e)!==!1&&FA(t.staleTime,e)!==`static`){let r=FA(n,e);return r===`always`||r!==!1&&Oj(e,t)}return!1}function Dj(e,t,n,r){return(e!==t||FA(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Oj(e,n)}function Oj(e,t){return FA(t.enabled,e)!==!1&&e.isStaleByTime(FA(t.staleTime,e))}var kj=class extends Cj{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:_j(t,n.data),hasPreviousPage:vj(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},Aj=class extends pj{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||jj(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=fj({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),sj.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function jj(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Mj=class extends rj{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new Aj({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Nj(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Nj(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Nj(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=Nj(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){sj.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>LA(t,e))}findAll(e={}){return this.getAll().filter(t=>LA(e,t))}notify(e){sj.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return sj.batch(()=>Promise.all(e.map(e=>e.continue().catch(jA))))}};function Nj(e){return e.options.scope?.id}var Pj=class extends rj{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??RA(r,t),a=this.get(i);return a||(a=new yj({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){this.#e.get(e.queryHash)===e&&(e.destroy(),this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){sj.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>IA(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>IA(e,t)):t}notify(e){sj.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){sj.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){sj.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Fj=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Pj,this.#t=e.mutationCache||new Mj,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=ij.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=cj.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(FA(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=MA(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return sj.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;sj.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return sj.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=sj.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(jA).catch(jA)}invalidateQueries(e,t={}){return sj.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=sj.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(jA)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(jA)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(FA(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(FA(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(jA).catch(jA)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(jA).catch(jA)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return cj.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(zA(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{BA(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(zA(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{BA(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=RA(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===ZA&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Ij=N.createContext(!1),Lj=()=>N.useContext(Ij);Ij.Provider;function Rj(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var zj=N.createContext(Rj()),Bj=()=>N.useContext(zj),Vj=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?$A(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},Hj=e=>{N.useEffect(()=>{e.clearReset()},[e])},Uj=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||$A(n,[e.error,r])),Wj=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},Gj=(e,t)=>e?.suspense&&t.isPending,Kj=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function qj(e,t,n){let r=Lj(),i=Bj(),a=TA(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,Wj(o),Vj(o,i,s),Hj(i);let[l]=N.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(N.useSyncExternalStore(N.useCallback(e=>{let t=d?l.subscribe(sj.batchCalls(e)):jA;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),N.useEffect(()=>{l.setOptions(o)},[o,l]),Gj(o,u))throw Kj(o,l,i);if(Uj({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function Jj(e,t){return qj(e,Cj,t)}function Yj(e,t){return qj(e,kj,t)}var Xj=new Map([[`bold`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M228,128a12,12,0,0,1-12,12H69l51.52,51.51a12,12,0,0,1-17,17l-72-72a12,12,0,0,1,0-17l72-72a12,12,0,0,1,17,17L69,116H216A12,12,0,0,1,228,128Z`}))],[`duotone`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M112,56V200L40,128Z`,opacity:`0.2`}),N.createElement(`path`,{d:`M216,120H120V56a8,8,0,0,0-13.66-5.66l-72,72a8,8,0,0,0,0,11.32l72,72A8,8,0,0,0,120,200V136h96a8,8,0,0,0,0-16ZM104,180.69,51.31,128,104,75.31Z`}))],[`fill`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H120v64a8,8,0,0,1-13.66,5.66l-72-72a8,8,0,0,1,0-11.32l72-72A8,8,0,0,1,120,56v64h96A8,8,0,0,1,224,128Z`}))],[`light`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M222,128a6,6,0,0,1-6,6H54.49l61.75,61.76a6,6,0,1,1-8.48,8.48l-72-72a6,6,0,0,1,0-8.48l72-72a6,6,0,0,1,8.48,8.48L54.49,122H216A6,6,0,0,1,222,128Z`}))],[`regular`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H59.31l58.35,58.34a8,8,0,0,1-11.32,11.32l-72-72a8,8,0,0,1,0-11.32l72-72a8,8,0,0,1,11.32,11.32L59.31,120H216A8,8,0,0,1,224,128Z`}))],[`thin`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M220,128a4,4,0,0,1-4,4H49.66l65.17,65.17a4,4,0,0,1-5.66,5.66l-72-72a4,4,0,0,1,0-5.66l72-72a4,4,0,0,1,5.66,5.66L49.66,124H216A4,4,0,0,1,220,128Z`}))]]),Zj=new Map([[`bold`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M224.49,136.49l-72,72a12,12,0,0,1-17-17L187,140H40a12,12,0,0,1,0-24H187L135.51,64.48a12,12,0,0,1,17-17l72,72A12,12,0,0,1,224.49,136.49Z`}))],[`duotone`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M216,128l-72,72V56Z`,opacity:`0.2`}),N.createElement(`path`,{d:`M221.66,122.34l-72-72A8,8,0,0,0,136,56v64H40a8,8,0,0,0,0,16h96v64a8,8,0,0,0,13.66,5.66l72-72A8,8,0,0,0,221.66,122.34ZM152,180.69V75.31L204.69,128Z`}))],[`fill`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M221.66,133.66l-72,72A8,8,0,0,1,136,200V136H40a8,8,0,0,1,0-16h96V56a8,8,0,0,1,13.66-5.66l72,72A8,8,0,0,1,221.66,133.66Z`}))],[`light`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M220.24,132.24l-72,72a6,6,0,0,1-8.48-8.48L201.51,134H40a6,6,0,0,1,0-12H201.51L139.76,60.24a6,6,0,0,1,8.48-8.48l72,72A6,6,0,0,1,220.24,132.24Z`}))],[`regular`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z`}))],[`thin`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M218.83,130.83l-72,72a4,4,0,0,1-5.66-5.66L206.34,132H40a4,4,0,0,1,0-8H206.34L141.17,58.83a4,4,0,0,1,5.66-5.66l72,72A4,4,0,0,1,218.83,130.83Z`}))]]),Qj=new Map([[`bold`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M232,44H160a43.86,43.86,0,0,0-32,13.85A43.86,43.86,0,0,0,96,44H24A12,12,0,0,0,12,56V200a12,12,0,0,0,12,12H96a20,20,0,0,1,20,20,12,12,0,0,0,24,0,20,20,0,0,1,20-20h72a12,12,0,0,0,12-12V56A12,12,0,0,0,232,44ZM96,188H36V68H96a20,20,0,0,1,20,20V192.81A43.79,43.79,0,0,0,96,188Zm124,0H160a43.71,43.71,0,0,0-20,4.83V88a20,20,0,0,1,20-20h60Z`}))],[`duotone`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M232,56V200H160a32,32,0,0,0-32,32,32,32,0,0,0-32-32H24V56H96a32,32,0,0,1,32,32,32,32,0,0,1,32-32Z`,opacity:`0.2`}),N.createElement(`path`,{d:`M232,48H160a40,40,0,0,0-32,16A40,40,0,0,0,96,48H24a8,8,0,0,0-8,8V200a8,8,0,0,0,8,8H96a24,24,0,0,1,24,24,8,8,0,0,0,16,0,24,24,0,0,1,24-24h72a8,8,0,0,0,8-8V56A8,8,0,0,0,232,48ZM96,192H32V64H96a24,24,0,0,1,24,24V200A39.81,39.81,0,0,0,96,192Zm128,0H160a39.81,39.81,0,0,0-24,8V88a24,24,0,0,1,24-24h64Z`}))],[`fill`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M240,56V200a8,8,0,0,1-8,8H160a24,24,0,0,0-24,23.94,7.9,7.9,0,0,1-5.12,7.55A8,8,0,0,1,120,232a24,24,0,0,0-24-24H24a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8H88a32,32,0,0,1,32,32v87.73a8.17,8.17,0,0,0,7.47,8.25,8,8,0,0,0,8.53-8V80a32,32,0,0,1,32-32h64A8,8,0,0,1,240,56Z`}))],[`light`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M232,50H160a38,38,0,0,0-32,17.55A38,38,0,0,0,96,50H24a6,6,0,0,0-6,6V200a6,6,0,0,0,6,6H96a26,26,0,0,1,26,26,6,6,0,0,0,12,0,26,26,0,0,1,26-26h72a6,6,0,0,0,6-6V56A6,6,0,0,0,232,50ZM96,194H30V62H96a26,26,0,0,1,26,26V204.31A37.86,37.86,0,0,0,96,194Zm130,0H160a37.87,37.87,0,0,0-26,10.32V88a26,26,0,0,1,26-26h66Z`}))],[`regular`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M232,48H160a40,40,0,0,0-32,16A40,40,0,0,0,96,48H24a8,8,0,0,0-8,8V200a8,8,0,0,0,8,8H96a24,24,0,0,1,24,24,8,8,0,0,0,16,0,24,24,0,0,1,24-24h72a8,8,0,0,0,8-8V56A8,8,0,0,0,232,48ZM96,192H32V64H96a24,24,0,0,1,24,24V200A39.81,39.81,0,0,0,96,192Zm128,0H160a39.81,39.81,0,0,0-24,8V88a24,24,0,0,1,24-24h64Z`}))],[`thin`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M232,52H160a36,36,0,0,0-32,19.54A36,36,0,0,0,96,52H24a4,4,0,0,0-4,4V200a4,4,0,0,0,4,4H96a28,28,0,0,1,28,28,4,4,0,0,0,8,0,28,28,0,0,1,28-28h72a4,4,0,0,0,4-4V56A4,4,0,0,0,232,52ZM96,196H28V60H96a28,28,0,0,1,28,28V209.4A35.93,35.93,0,0,0,96,196Zm132,0H160a35.94,35.94,0,0,0-28,13.41V88a28,28,0,0,1,28-28h68Z`}))]]),$j=new Map([[`bold`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M144,128a16,16,0,1,1-16-16A16,16,0,0,1,144,128ZM60,112a16,16,0,1,0,16,16A16,16,0,0,0,60,112Zm136,0a16,16,0,1,0,16,16A16,16,0,0,0,196,112Z`}))],[`duotone`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M240,96v64a16,16,0,0,1-16,16H32a16,16,0,0,1-16-16V96A16,16,0,0,1,32,80H224A16,16,0,0,1,240,96Z`,opacity:`0.2`}),N.createElement(`path`,{d:`M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128Zm56-12a12,12,0,1,0,12,12A12,12,0,0,0,196,116ZM60,116a12,12,0,1,0,12,12A12,12,0,0,0,60,116Z`}))],[`fill`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M224,80H32A16,16,0,0,0,16,96v64a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V96A16,16,0,0,0,224,80ZM60,140a12,12,0,1,1,12-12A12,12,0,0,1,60,140Zm68,0a12,12,0,1,1,12-12A12,12,0,0,1,128,140Zm68,0a12,12,0,1,1,12-12A12,12,0,0,1,196,140Z`}))],[`light`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M138,128a10,10,0,1,1-10-10A10,10,0,0,1,138,128ZM60,118a10,10,0,1,0,10,10A10,10,0,0,0,60,118Zm136,0a10,10,0,1,0,10,10A10,10,0,0,0,196,118Z`}))],[`regular`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128Zm56-12a12,12,0,1,0,12,12A12,12,0,0,0,196,116ZM60,116a12,12,0,1,0,12,12A12,12,0,0,0,60,116Z`}))],[`thin`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M136,128a8,8,0,1,1-8-8A8,8,0,0,1,136,128Zm-76-8a8,8,0,1,0,8,8A8,8,0,0,0,60,120Zm136,0a8,8,0,1,0,8,8A8,8,0,0,0,196,120Z`}))]]),eM=new Map([[`bold`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M232.49,215.51,185,168a92.12,92.12,0,1,0-17,17l47.53,47.54a12,12,0,0,0,17-17ZM44,112a68,68,0,1,1,68,68A68.07,68.07,0,0,1,44,112Z`}))],[`duotone`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M192,112a80,80,0,1,1-80-80A80,80,0,0,1,192,112Z`,opacity:`0.2`}),N.createElement(`path`,{d:`M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z`}))],[`fill`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M168,112a56,56,0,1,1-56-56A56,56,0,0,1,168,112Zm61.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88,88,0,1,1,11.32-11.31l50.06,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z`}))],[`light`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M228.24,219.76l-51.38-51.38a86.15,86.15,0,1,0-8.48,8.48l51.38,51.38a6,6,0,0,0,8.48-8.48ZM38,112a74,74,0,1,1,74,74A74.09,74.09,0,0,1,38,112Z`}))],[`regular`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M229.66,218.34l-50.07-50.06a88.11,88.11,0,1,0-11.31,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z`}))],[`thin`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M226.83,221.17l-52.7-52.7a84.1,84.1,0,1,0-5.66,5.66l52.7,52.7a4,4,0,0,0,5.66-5.66ZM36,112a76,76,0,1,1,76,76A76.08,76.08,0,0,1,36,112Z`}))]]),tM=new Map([[`bold`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M236.37,139.4a12,12,0,0,0-12-3A84.07,84.07,0,0,1,119.6,31.59a12,12,0,0,0-15-15A108.86,108.86,0,0,0,49.69,55.07,108,108,0,0,0,136,228a107.09,107.09,0,0,0,64.93-21.69,108.86,108.86,0,0,0,38.44-54.94A12,12,0,0,0,236.37,139.4Zm-49.88,47.74A84,84,0,0,1,68.86,69.51,84.93,84.93,0,0,1,92.27,48.29Q92,52.13,92,56A108.12,108.12,0,0,0,200,164q3.87,0,7.71-.27A84.79,84.79,0,0,1,186.49,187.14Z`}))],[`duotone`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M227.89,147.89A96,96,0,1,1,108.11,28.11,96.09,96.09,0,0,0,227.89,147.89Z`,opacity:`0.2`}),N.createElement(`path`,{d:`M233.54,142.23a8,8,0,0,0-8-2,88.08,88.08,0,0,1-109.8-109.8,8,8,0,0,0-10-10,104.84,104.84,0,0,0-52.91,37A104,104,0,0,0,136,224a103.09,103.09,0,0,0,62.52-20.88,104.84,104.84,0,0,0,37-52.91A8,8,0,0,0,233.54,142.23ZM188.9,190.34A88,88,0,0,1,65.66,67.11a89,89,0,0,1,31.4-26A106,106,0,0,0,96,56,104.11,104.11,0,0,0,200,160a106,106,0,0,0,14.92-1.06A89,89,0,0,1,188.9,190.34Z`}))],[`fill`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M235.54,150.21a104.84,104.84,0,0,1-37,52.91A104,104,0,0,1,32,120,103.09,103.09,0,0,1,52.88,57.48a104.84,104.84,0,0,1,52.91-37,8,8,0,0,1,10,10,88.08,88.08,0,0,0,109.8,109.8,8,8,0,0,1,10,10Z`}))],[`light`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M232.13,143.64a6,6,0,0,0-6-1.49A90.07,90.07,0,0,1,113.86,29.85a6,6,0,0,0-7.49-7.48A102.88,102.88,0,0,0,54.48,58.68,102,102,0,0,0,197.32,201.52a102.88,102.88,0,0,0,36.31-51.89A6,6,0,0,0,232.13,143.64Zm-42,48.29a90,90,0,0,1-126-126A90.9,90.9,0,0,1,99.65,37.66,102.06,102.06,0,0,0,218.34,156.35,90.9,90.9,0,0,1,190.1,191.93Z`}))],[`regular`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M233.54,142.23a8,8,0,0,0-8-2,88.08,88.08,0,0,1-109.8-109.8,8,8,0,0,0-10-10,104.84,104.84,0,0,0-52.91,37A104,104,0,0,0,136,224a103.09,103.09,0,0,0,62.52-20.88,104.84,104.84,0,0,0,37-52.91A8,8,0,0,0,233.54,142.23ZM188.9,190.34A88,88,0,0,1,65.66,67.11a89,89,0,0,1,31.4-26A106,106,0,0,0,96,56,104.11,104.11,0,0,0,200,160a106,106,0,0,0,14.92-1.06A89,89,0,0,1,188.9,190.34Z`}))],[`thin`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M230.72,145.06a4,4,0,0,0-4-1A92.08,92.08,0,0,1,111.94,29.27a4,4,0,0,0-5-5A100.78,100.78,0,0,0,56.08,59.88a100,100,0,0,0,140,140,100.78,100.78,0,0,0,35.59-50.87A4,4,0,0,0,230.72,145.06ZM191.3,193.53A92,92,0,0,1,62.47,64.7a93,93,0,0,1,39.88-30.35,100.09,100.09,0,0,0,119.3,119.3A93,93,0,0,1,191.3,193.53Z`}))]]),nM=new Map([[`bold`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M230.14,70.54,185.46,25.85a20,20,0,0,0-28.29,0L33.86,149.17A19.85,19.85,0,0,0,28,163.31V208a20,20,0,0,0,20,20H92.69a19.86,19.86,0,0,0,14.14-5.86L230.14,98.82a20,20,0,0,0,0-28.28ZM91,204H52V165l84-84,39,39ZM192,103,153,64l18.34-18.34,39,39Z`}))],[`duotone`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M221.66,90.34,192,120,136,64l29.66-29.66a8,8,0,0,1,11.31,0L221.66,79A8,8,0,0,1,221.66,90.34Z`,opacity:`0.2`}),N.createElement(`path`,{d:`M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z`}))],[`fill`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM192,108.68,147.31,64l24-24L216,84.68Z`}))],[`light`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M225.9,74.78,181.21,30.09a14,14,0,0,0-19.8,0L38.1,153.41a13.94,13.94,0,0,0-4.1,9.9V208a14,14,0,0,0,14,14H92.69a13.94,13.94,0,0,0,9.9-4.1L225.9,94.58a14,14,0,0,0,0-19.8ZM94.1,209.41a2,2,0,0,1-1.41.59H48a2,2,0,0,1-2-2V163.31a2,2,0,0,1,.59-1.41L136,72.48,183.51,120ZM217.41,86.1,192,111.51,144.49,64,169.9,38.58a2,2,0,0,1,2.83,0l44.68,44.69a2,2,0,0,1,0,2.83Z`}))],[`regular`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z`}))],[`thin`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M224.49,76.2,179.8,31.51a12,12,0,0,0-17,0L133.17,61.17h0L39.52,154.83A11.9,11.9,0,0,0,36,163.31V208a12,12,0,0,0,12,12H92.69a12,12,0,0,0,8.48-3.51L224.48,93.17a12,12,0,0,0,0-17Zm-129,134.63A4,4,0,0,1,92.69,212H48a4,4,0,0,1-4-4V163.31a4,4,0,0,1,1.17-2.83L136,69.65,186.34,120ZM218.83,87.51,192,114.34,141.66,64l26.82-26.83a4,4,0,0,1,5.66,0l44.69,44.68a4,4,0,0,1,0,5.66Z`}))]]),rM=new Map([[`bold`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M240.49,15.51a12,12,0,0,0-17,0L173.94,65.09l-2.54-2.55a36.05,36.05,0,0,0-50.91,0L100,83l-3.51-3.52a12,12,0,0,0-17,17L83,100,62.54,120.49a36,36,0,0,0,0,50.91l2.55,2.54L15.51,223.51a12,12,0,0,0,17,17l49.57-49.58,2.54,2.55a36.06,36.06,0,0,0,50.91,0L156,173l3.51,3.52a12,12,0,0,0,17-17L173,156l20.49-20.49a36,36,0,0,0,0-50.91l-2.55-2.54,49.58-49.57A12,12,0,0,0,240.49,15.51Zm-121.95,161a12,12,0,0,1-17,0L79.51,154.43a12,12,0,0,1,0-17L100,117l39,39Zm58-57.95h0L156,139l-39-39,20.49-20.49a12,12,0,0,1,17,0l22.06,22.06a12,12,0,0,1,0,17ZM85.27,33.37a12,12,0,0,1,21.46-10.74l8,16A12,12,0,1,1,93.27,49.37Zm-68,57.26a12,12,0,0,1,16.1-5.36l16,8a12,12,0,1,1-10.74,21.46l-16-8A12,12,0,0,1,17.27,90.63Zm221.46,74.74a12,12,0,0,1-16.1,5.36l-16-8a12,12,0,0,1,10.74-21.46l16,8A12,12,0,0,1,238.73,165.37Zm-68,57.26a12,12,0,1,1-21.46,10.74l-8-16a12,12,0,0,1,21.46-10.74Z`}))],[`duotone`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M185,127,127,185a24,24,0,0,1-33.94,0L71,162.91A24,24,0,0,1,71,129L129,71a24,24,0,0,1,33.94,0L185,93.09A24,24,0,0,1,185,127Z`,opacity:`0.2`}),N.createElement(`path`,{d:`M237.66,18.34a8,8,0,0,0-11.32,0l-52.4,52.41-5.37-5.38a32.05,32.05,0,0,0-45.26,0L100,88.69l-6.34-6.35A8,8,0,0,0,82.34,93.66L88.69,100,65.37,123.31a32,32,0,0,0,0,45.26l5.38,5.37-52.41,52.4a8,8,0,0,0,11.32,11.32l52.4-52.41,5.37,5.38a32.06,32.06,0,0,0,45.26,0L156,167.31l6.34,6.35a8,8,0,0,0,11.32-11.32L167.31,156l23.32-23.31a32,32,0,0,0,0-45.26l-5.38-5.37,52.41-52.4A8,8,0,0,0,237.66,18.34Zm-116.29,161a16,16,0,0,1-22.62,0L76.69,157.25a16,16,0,0,1,0-22.62L100,111.31,144.69,156Zm57.94-57.94h0L156,144.69,111.31,100l23.32-23.31a16,16,0,0,1,22.62,0l22.06,22a16,16,0,0,1,0,22.63ZM88.57,35A8,8,0,0,1,103.43,29l8,20A8,8,0,0,1,96.57,55ZM24.57,93A8,8,0,0,1,35,88.57l20,8A8,8,0,0,1,49,111.43l-20-8A8,8,0,0,1,24.57,93ZM231.43,163a8,8,0,0,1-10.4,4.46l-20-8A8,8,0,1,1,207,144.57l20,8A8,8,0,0,1,231.43,163Zm-64,58.06A8,8,0,0,1,152.57,227l-8-20A8,8,0,0,1,159.43,201Z`}))],[`fill`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M88.57,35A8,8,0,0,1,103.43,29l8,20A8,8,0,0,1,96.57,55ZM29,103.43l20,8A8,8,0,1,0,55,96.57l-20-8A8,8,0,0,0,29,103.43ZM227,152.57l-20-8A8,8,0,1,0,201,159.43l20,8A8,8,0,0,0,227,152.57ZM159.43,201A8,8,0,0,0,144.57,207l8,20A8,8,0,1,0,167.43,221ZM237.91,18.52a8,8,0,0,0-11.5-.18L174,70.75l-5.38-5.38a32,32,0,0,0-45.28,0L106.14,82.54a4,4,0,0,0,0,5.66l61.7,61.66a4,4,0,0,0,5.66,0l16.74-16.74a32.76,32.76,0,0,0,9.81-22.52,31.82,31.82,0,0,0-9.37-23.17l-5.38-5.37,52.2-52.17A8.22,8.22,0,0,0,237.91,18.52ZM85.64,90.34a8,8,0,0,0-11.49.18,8.22,8.22,0,0,0,.41,11.37L80.67,108,65.34,123.31A31.82,31.82,0,0,0,56,146.47,32.75,32.75,0,0,0,65.77,169l5,4.94L18.49,226.13a8.21,8.21,0,0,0-.61,11.1,8,8,0,0,0,11.72.43L82,185.25l5.37,5.38a32.1,32.1,0,0,0,45.29,0L148,175.31l6.34,6.35a8,8,0,0,0,11.32-11.32Z`}))],[`light`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M236.24,19.76a6,6,0,0,0-8.48,0L173.94,73.57l-6.79-6.78a30,30,0,0,0-42.42,0L100,91.51l-7.76-7.75a6,6,0,0,0-8.48,8.48L91.51,100,66.79,124.73a30,30,0,0,0,0,42.42l6.78,6.79L19.76,227.76a6,6,0,1,0,8.48,8.48l53.82-53.81,6.79,6.78a30,30,0,0,0,42.42,0L156,164.49l7.76,7.75a6,6,0,0,0,8.48-8.48L164.49,156l24.72-24.73a30,30,0,0,0,0-42.42l-6.78-6.79,53.81-53.82A6,6,0,0,0,236.24,19.76Zm-113.45,161a18,18,0,0,1-25.46,0L75.27,158.67a18,18,0,0,1,0-25.46L100,108.49,147.51,156Zm57.94-57.94L156,147.51,108.49,100l24.72-24.73a18,18,0,0,1,25.46,0l22.06,22.06a18,18,0,0,1,0,25.46ZM90.43,34.23a6,6,0,0,1,11.14-4.46l8,20a6,6,0,1,1-11.14,4.46Zm-64,59.54a6,6,0,0,1,7.8-3.34l20,8a6,6,0,1,1-4.46,11.14l-20-8A6,6,0,0,1,26.43,93.77Zm203.14,68.46a6,6,0,0,1-7.8,3.34l-20-8a6,6,0,0,1,4.46-11.14l20,8A6,6,0,0,1,229.57,162.23Zm-64,59.54a6,6,0,1,1-11.14,4.46l-8-20a6,6,0,0,1,11.14-4.46Z`}))],[`regular`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M237.66,18.34a8,8,0,0,0-11.32,0l-52.4,52.41-5.37-5.38a32.05,32.05,0,0,0-45.26,0L100,88.69l-6.34-6.35A8,8,0,0,0,82.34,93.66L88.69,100,65.37,123.31a32,32,0,0,0,0,45.26l5.38,5.37-52.41,52.4a8,8,0,0,0,11.32,11.32l52.4-52.41,5.37,5.38a32,32,0,0,0,45.26,0L156,167.31l6.34,6.35a8,8,0,0,0,11.32-11.32L167.31,156l23.32-23.31a32,32,0,0,0,0-45.26l-5.38-5.37,52.41-52.4A8,8,0,0,0,237.66,18.34Zm-116.29,161a16,16,0,0,1-22.62,0L76.69,157.25a16,16,0,0,1,0-22.62L100,111.31,144.69,156Zm57.94-57.94L156,144.69,111.31,100l23.32-23.31a16,16,0,0,1,22.62,0l22.06,22A16,16,0,0,1,179.31,121.37ZM88.57,35A8,8,0,0,1,103.43,29l8,20A8,8,0,0,1,96.57,55ZM24.57,93A8,8,0,0,1,35,88.57l20,8A8,8,0,0,1,49,111.43l-20-8A8,8,0,0,1,24.57,93ZM231.43,163a8,8,0,0,1-10.4,4.46l-20-8A8,8,0,1,1,207,144.57l20,8A8,8,0,0,1,231.43,163Zm-64,58.06A8,8,0,0,1,152.57,227l-8-20A8,8,0,0,1,159.43,201Z`}))],[`thin`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M234.83,21.17a4,4,0,0,0-5.66,0L173.94,76.4l-8.2-8.2a28,28,0,0,0-39.6,0L100,94.34l-9.17-9.17a4,4,0,0,0-5.66,5.66L94.34,100,68.2,126.14a28,28,0,0,0,0,39.6l8.2,8.2L21.17,229.17a4,4,0,0,0,5.66,5.66L82.06,179.6l8.2,8.2a28,28,0,0,0,39.6,0L156,161.66l9.17,9.17a4,4,0,0,0,5.66-5.66L161.66,156l26.14-26.14a28,28,0,0,0,0-39.6l-8.2-8.2,55.23-55.23A4,4,0,0,0,234.83,21.17Zm-110.63,161a20,20,0,0,1-28.28,0L73.86,160.08a20,20,0,0,1,0-28.28L100,105.66,150.34,156Zm57.94-57.94L156,150.34,105.66,100,131.8,73.86a20,20,0,0,1,28.28,0l22.06,22.06A20,20,0,0,1,182.14,124.2ZM92.29,33.49a4,4,0,1,1,7.42-3l8,20a4,4,0,0,1-2.22,5.2A3.91,3.91,0,0,1,104,56a4,4,0,0,1-3.71-2.51Zm-64,61a4,4,0,0,1,5.2-2.22l20,8A4,4,0,0,1,52,108a3.91,3.91,0,0,1-1.49-.29l-20-8A4,4,0,0,1,28.29,94.51Zm199.42,67A4,4,0,0,1,224,164a3.91,3.91,0,0,1-1.49-.29l-20-8a4,4,0,1,1,3-7.42l20,8A4,4,0,0,1,227.71,161.49Zm-64,61a4,4,0,0,1-2.22,5.2A3.91,3.91,0,0,1,160,228a4,4,0,0,1-3.71-2.51l-8-20a4,4,0,0,1,7.42-3Z`}))]]),iM=new Map([[`bold`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M228,128a12,12,0,0,1-12,12H140v76a12,12,0,0,1-24,0V140H40a12,12,0,0,1,0-24h76V40a12,12,0,0,1,24,0v76h76A12,12,0,0,1,228,128Z`}))],[`duotone`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z`,opacity:`0.2`}),N.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z`}))],[`fill`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM184,136H136v48a8,8,0,0,1-16,0V136H72a8,8,0,0,1,0-16h48V72a8,8,0,0,1,16,0v48h48a8,8,0,0,1,0,16Z`}))],[`light`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M222,128a6,6,0,0,1-6,6H134v82a6,6,0,0,1-12,0V134H40a6,6,0,0,1,0-12h82V40a6,6,0,0,1,12,0v82h82A6,6,0,0,1,222,128Z`}))],[`regular`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z`}))],[`thin`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M220,128a4,4,0,0,1-4,4H132v84a4,4,0,0,1-8,0V132H40a4,4,0,0,1,0-8h84V40a4,4,0,0,1,8,0v84h84A4,4,0,0,1,220,128Z`}))]]),aM=new Map([[`bold`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M124,216a12,12,0,0,1-12,12H48a12,12,0,0,1-12-12V40A12,12,0,0,1,48,28h64a12,12,0,0,1,0,24H60V204h52A12,12,0,0,1,124,216Zm108.49-96.49-40-40a12,12,0,0,0-17,17L195,116H112a12,12,0,0,0,0,24h83l-19.52,19.51a12,12,0,0,0,17,17l40-40A12,12,0,0,0,232.49,119.51Z`}))],[`duotone`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M224,56V200a16,16,0,0,1-16,16H48V40H208A16,16,0,0,1,224,56Z`,opacity:`0.2`}),N.createElement(`path`,{d:`M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40a8,8,0,0,0-11.32,11.32L204.69,120H112a8,8,0,0,0,0,16h92.69l-26.35,26.34a8,8,0,0,0,11.32,11.32l40-40A8,8,0,0,0,229.66,122.34Z`}))],[`fill`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40A8,8,0,0,0,176,88v32H112a8,8,0,0,0,0,16h64v32a8,8,0,0,0,13.66,5.66l40-40A8,8,0,0,0,229.66,122.34Z`}))],[`light`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M118,216a6,6,0,0,1-6,6H48a6,6,0,0,1-6-6V40a6,6,0,0,1,6-6h64a6,6,0,0,1,0,12H54V210h58A6,6,0,0,1,118,216Zm110.24-92.24-40-40a6,6,0,0,0-8.48,8.48L209.51,122H112a6,6,0,0,0,0,12h97.51l-29.75,29.76a6,6,0,1,0,8.48,8.48l40-40A6,6,0,0,0,228.24,123.76Z`}))],[`regular`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40a8,8,0,0,0-11.32,11.32L204.69,120H112a8,8,0,0,0,0,16h92.69l-26.35,26.34a8,8,0,0,0,11.32,11.32l40-40A8,8,0,0,0,229.66,122.34Z`}))],[`thin`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M116,216a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V40a4,4,0,0,1,4-4h64a4,4,0,0,1,0,8H52V212h60A4,4,0,0,1,116,216Zm110.83-90.83-40-40a4,4,0,0,0-5.66,5.66L214.34,124H112a4,4,0,0,0,0,8H214.34l-33.17,33.17a4,4,0,0,0,5.66,5.66l40-40A4,4,0,0,0,226.83,125.17Z`}))]]),oM=new Map([[`bold`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M199,125.31l-49.88-18.39L130.69,57a19.92,19.92,0,0,0-37.38,0L74.92,106.92,25,125.31a19.92,19.92,0,0,0,0,37.38l49.88,18.39L93.31,231a19.92,19.92,0,0,0,37.38,0l18.39-49.88L199,162.69a19.92,19.92,0,0,0,0-37.38Zm-63.38,35.16a12,12,0,0,0-7.11,7.11L112,212.28l-16.47-44.7a12,12,0,0,0-7.11-7.11L43.72,144l44.7-16.47a12,12,0,0,0,7.11-7.11L112,75.72l16.47,44.7a12,12,0,0,0,7.11,7.11L180.28,144ZM140,40a12,12,0,0,1,12-12h12V16a12,12,0,0,1,24,0V28h12a12,12,0,0,1,0,24H188V64a12,12,0,0,1-24,0V52H152A12,12,0,0,1,140,40ZM252,88a12,12,0,0,1-12,12h-4v4a12,12,0,0,1-24,0v-4h-4a12,12,0,0,1,0-24h4V72a12,12,0,0,1,24,0v4h4A12,12,0,0,1,252,88Z`}))],[`duotone`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M194.82,151.43l-55.09,20.3-20.3,55.09a7.92,7.92,0,0,1-14.86,0l-20.3-55.09-55.09-20.3a7.92,7.92,0,0,1,0-14.86l55.09-20.3,20.3-55.09a7.92,7.92,0,0,1,14.86,0l20.3,55.09,55.09,20.3A7.92,7.92,0,0,1,194.82,151.43Z`,opacity:`0.2`}),N.createElement(`path`,{d:`M197.58,129.06,146,110l-19-51.62a15.92,15.92,0,0,0-29.88,0L78,110l-51.62,19a15.92,15.92,0,0,0,0,29.88L78,178l19,51.62a15.92,15.92,0,0,0,29.88,0L146,178l51.62-19a15.92,15.92,0,0,0,0-29.88ZM137,164.22a8,8,0,0,0-4.74,4.74L112,223.85,91.78,169A8,8,0,0,0,87,164.22L32.15,144,87,123.78A8,8,0,0,0,91.78,119L112,64.15,132.22,119a8,8,0,0,0,4.74,4.74L191.85,144ZM144,40a8,8,0,0,1,8-8h16V16a8,8,0,0,1,16,0V32h16a8,8,0,0,1,0,16H184V64a8,8,0,0,1-16,0V48H152A8,8,0,0,1,144,40ZM248,88a8,8,0,0,1-8,8h-8v8a8,8,0,0,1-16,0V96h-8a8,8,0,0,1,0-16h8V72a8,8,0,0,1,16,0v8h8A8,8,0,0,1,248,88Z`}))],[`fill`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M208,144a15.78,15.78,0,0,1-10.42,14.94L146,178l-19,51.62a15.92,15.92,0,0,1-29.88,0L78,178l-51.62-19a15.92,15.92,0,0,1,0-29.88L78,110l19-51.62a15.92,15.92,0,0,1,29.88,0L146,110l51.62,19A15.78,15.78,0,0,1,208,144ZM152,48h16V64a8,8,0,0,0,16,0V48h16a8,8,0,0,0,0-16H184V16a8,8,0,0,0-16,0V32H152a8,8,0,0,0,0,16Zm88,32h-8V72a8,8,0,0,0-16,0v8h-8a8,8,0,0,0,0,16h8v8a8,8,0,0,0,16,0V96h8a8,8,0,0,0,0-16Z`}))],[`light`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M196.89,130.94,144.4,111.6,125.06,59.11a13.92,13.92,0,0,0-26.12,0L79.6,111.6,27.11,130.94a13.92,13.92,0,0,0,0,26.12L79.6,176.4l19.34,52.49a13.92,13.92,0,0,0,26.12,0L144.4,176.4l52.49-19.34a13.92,13.92,0,0,0,0-26.12Zm-4.15,14.86-55.08,20.3a6,6,0,0,0-3.56,3.56l-20.3,55.08a1.92,1.92,0,0,1-3.6,0L89.9,169.66a6,6,0,0,0-3.56-3.56L31.26,145.8a1.92,1.92,0,0,1,0-3.6l55.08-20.3a6,6,0,0,0,3.56-3.56l20.3-55.08a1.92,1.92,0,0,1,3.6,0l20.3,55.08a6,6,0,0,0,3.56,3.56l55.08,20.3a1.92,1.92,0,0,1,0,3.6ZM146,40a6,6,0,0,1,6-6h18V16a6,6,0,0,1,12,0V34h18a6,6,0,0,1,0,12H182V64a6,6,0,0,1-12,0V46H152A6,6,0,0,1,146,40ZM246,88a6,6,0,0,1-6,6H230v10a6,6,0,0,1-12,0V94H208a6,6,0,0,1,0-12h10V72a6,6,0,0,1,12,0V82h10A6,6,0,0,1,246,88Z`}))],[`regular`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M197.58,129.06,146,110l-19-51.62a15.92,15.92,0,0,0-29.88,0L78,110l-51.62,19a15.92,15.92,0,0,0,0,29.88L78,178l19,51.62a15.92,15.92,0,0,0,29.88,0L146,178l51.62-19a15.92,15.92,0,0,0,0-29.88ZM137,164.22a8,8,0,0,0-4.74,4.74L112,223.85,91.78,169A8,8,0,0,0,87,164.22L32.15,144,87,123.78A8,8,0,0,0,91.78,119L112,64.15,132.22,119a8,8,0,0,0,4.74,4.74L191.85,144ZM144,40a8,8,0,0,1,8-8h16V16a8,8,0,0,1,16,0V32h16a8,8,0,0,1,0,16H184V64a8,8,0,0,1-16,0V48H152A8,8,0,0,1,144,40ZM248,88a8,8,0,0,1-8,8h-8v8a8,8,0,0,1-16,0V96h-8a8,8,0,0,1,0-16h8V72a8,8,0,0,1,16,0v8h8A8,8,0,0,1,248,88Z`}))],[`thin`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M196.2,132.81l-53.36-19.65L123.19,59.8a11.93,11.93,0,0,0-22.38,0L81.16,113.16,27.8,132.81a11.93,11.93,0,0,0,0,22.38l53.36,19.65,19.65,53.36a11.93,11.93,0,0,0,22.38,0l19.65-53.36,53.36-19.65a11.93,11.93,0,0,0,0-22.38Zm-2.77,14.87L138.35,168a4,4,0,0,0-2.37,2.37l-20.3,55.08a3.92,3.92,0,0,1-7.36,0L88,170.35A4,4,0,0,0,85.65,168l-55.08-20.3a3.92,3.92,0,0,1,0-7.36L85.65,120A4,4,0,0,0,88,117.65l20.3-55.08a3.92,3.92,0,0,1,7.36,0L136,117.65a4,4,0,0,0,2.37,2.37l55.08,20.3a3.92,3.92,0,0,1,0,7.36ZM148,40a4,4,0,0,1,4-4h20V16a4,4,0,0,1,8,0V36h20a4,4,0,0,1,0,8H180V64a4,4,0,0,1-8,0V44H152A4,4,0,0,1,148,40Zm96,48a4,4,0,0,1-4,4H228v12a4,4,0,0,1-8,0V92H208a4,4,0,0,1,0-8h12V72a4,4,0,0,1,8,0V84h12A4,4,0,0,1,244,88Z`}))]]),sM=new Map([[`bold`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M116,36V20a12,12,0,0,1,24,0V36a12,12,0,0,1-24,0Zm80,92a68,68,0,1,1-68-68A68.07,68.07,0,0,1,196,128Zm-24,0a44,44,0,1,0-44,44A44.05,44.05,0,0,0,172,128ZM51.51,68.49a12,12,0,1,0,17-17l-12-12a12,12,0,0,0-17,17Zm0,119-12,12a12,12,0,0,0,17,17l12-12a12,12,0,1,0-17-17ZM196,72a12,12,0,0,0,8.49-3.51l12-12a12,12,0,0,0-17-17l-12,12A12,12,0,0,0,196,72Zm8.49,115.51a12,12,0,0,0-17,17l12,12a12,12,0,0,0,17-17ZM48,128a12,12,0,0,0-12-12H20a12,12,0,0,0,0,24H36A12,12,0,0,0,48,128Zm80,80a12,12,0,0,0-12,12v16a12,12,0,0,0,24,0V220A12,12,0,0,0,128,208Zm108-92H220a12,12,0,0,0,0,24h16a12,12,0,0,0,0-24Z`}))],[`duotone`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M184,128a56,56,0,1,1-56-56A56,56,0,0,1,184,128Z`,opacity:`0.2`}),N.createElement(`path`,{d:`M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm72,88a64,64,0,1,1-64-64A64.07,64.07,0,0,1,192,128Zm-16,0a48,48,0,1,0-48,48A48.05,48.05,0,0,0,176,128ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z`}))],[`fill`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm8,24a64,64,0,1,0,64,64A64.07,64.07,0,0,0,128,64ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z`}))],[`light`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M122,40V16a6,6,0,0,1,12,0V40a6,6,0,0,1-12,0Zm68,88a62,62,0,1,1-62-62A62.07,62.07,0,0,1,190,128Zm-12,0a50,50,0,1,0-50,50A50.06,50.06,0,0,0,178,128ZM59.76,68.24a6,6,0,1,0,8.48-8.48l-16-16a6,6,0,0,0-8.48,8.48Zm0,119.52-16,16a6,6,0,1,0,8.48,8.48l16-16a6,6,0,1,0-8.48-8.48ZM192,70a6,6,0,0,0,4.24-1.76l16-16a6,6,0,0,0-8.48-8.48l-16,16A6,6,0,0,0,192,70Zm4.24,117.76a6,6,0,0,0-8.48,8.48l16,16a6,6,0,0,0,8.48-8.48ZM46,128a6,6,0,0,0-6-6H16a6,6,0,0,0,0,12H40A6,6,0,0,0,46,128Zm82,82a6,6,0,0,0-6,6v24a6,6,0,0,0,12,0V216A6,6,0,0,0,128,210Zm112-88H216a6,6,0,0,0,0,12h24a6,6,0,0,0,0-12Z`}))],[`regular`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm72,88a64,64,0,1,1-64-64A64.07,64.07,0,0,1,192,128Zm-16,0a48,48,0,1,0-48,48A48.05,48.05,0,0,0,176,128ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z`}))],[`thin`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M124,40V16a4,4,0,0,1,8,0V40a4,4,0,0,1-8,0Zm64,88a60,60,0,1,1-60-60A60.07,60.07,0,0,1,188,128Zm-8,0a52,52,0,1,0-52,52A52.06,52.06,0,0,0,180,128ZM61.17,66.83a4,4,0,0,0,5.66-5.66l-16-16a4,4,0,0,0-5.66,5.66Zm0,122.34-16,16a4,4,0,0,0,5.66,5.66l16-16a4,4,0,0,0-5.66-5.66ZM192,68a4,4,0,0,0,2.83-1.17l16-16a4,4,0,1,0-5.66-5.66l-16,16A4,4,0,0,0,192,68Zm2.83,121.17a4,4,0,0,0-5.66,5.66l16,16a4,4,0,0,0,5.66-5.66ZM40,124H16a4,4,0,0,0,0,8H40a4,4,0,0,0,0-8Zm88,88a4,4,0,0,0-4,4v24a4,4,0,0,0,8,0V216A4,4,0,0,0,128,212Zm112-88H216a4,4,0,0,0,0,8h24a4,4,0,0,0,0-8Z`}))]]),cM=new Map([[`bold`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M216,48H180V36A28,28,0,0,0,152,8H104A28,28,0,0,0,76,36V48H40a12,12,0,0,0,0,24h4V208a20,20,0,0,0,20,20H192a20,20,0,0,0,20-20V72h4a12,12,0,0,0,0-24ZM100,36a4,4,0,0,1,4-4h48a4,4,0,0,1,4,4V48H100Zm88,168H68V72H188ZM116,104v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Zm48,0v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Z`}))],[`duotone`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M200,56V208a8,8,0,0,1-8,8H64a8,8,0,0,1-8-8V56Z`,opacity:`0.2`}),N.createElement(`path`,{d:`M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z`}))],[`fill`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM112,168a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm0-120H96V40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8Z`}))],[`light`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M216,50H174V40a22,22,0,0,0-22-22H104A22,22,0,0,0,82,40V50H40a6,6,0,0,0,0,12H50V208a14,14,0,0,0,14,14H192a14,14,0,0,0,14-14V62h10a6,6,0,0,0,0-12ZM94,40a10,10,0,0,1,10-10h48a10,10,0,0,1,10,10V50H94ZM194,208a2,2,0,0,1-2,2H64a2,2,0,0,1-2-2V62H194ZM110,104v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Zm48,0v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Z`}))],[`regular`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z`}))],[`thin`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M216,52H172V40a20,20,0,0,0-20-20H104A20,20,0,0,0,84,40V52H40a4,4,0,0,0,0,8H52V208a12,12,0,0,0,12,12H192a12,12,0,0,0,12-12V60h12a4,4,0,0,0,0-8ZM92,40a12,12,0,0,1,12-12h48a12,12,0,0,1,12,12V52H92ZM196,208a4,4,0,0,1-4,4H64a4,4,0,0,1-4-4V60H196ZM108,104v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Zm48,0v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Z`}))]]),lM=new Map([[`bold`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M256,136a12,12,0,0,1-12,12h-8v8a12,12,0,0,1-24,0v-8h-8a12,12,0,0,1,0-24h8v-8a12,12,0,0,1,24,0v8h8A12,12,0,0,1,256,136Zm-54.81,56.28a12,12,0,1,1-18.38,15.44C169.12,191.42,145,172,108,172c-28.89,0-55.46,12.68-74.81,35.72a12,12,0,0,1-18.38-15.44A124.08,124.08,0,0,1,63.5,156.53a72,72,0,1,1,89,0A124,124,0,0,1,201.19,192.28ZM108,148a48,48,0,1,0-48-48A48.05,48.05,0,0,0,108,148Z`}))],[`duotone`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M168,100a60,60,0,1,1-60-60A60,60,0,0,1,168,100Z`,opacity:`0.2`}),N.createElement(`path`,{d:`M256,136a8,8,0,0,1-8,8H232v16a8,8,0,0,1-16,0V144H200a8,8,0,0,1,0-16h16V112a8,8,0,0,1,16,0v16h16A8,8,0,0,1,256,136Zm-57.87,58.85a8,8,0,0,1-12.26,10.3C165.75,181.19,138.09,168,108,168s-57.75,13.19-77.87,37.15a8,8,0,0,1-12.25-10.3c14.94-17.78,33.52-30.41,54.17-37.17a68,68,0,1,1,71.9,0C164.6,164.44,183.18,177.07,198.13,194.85ZM108,152a52,52,0,1,0-52-52A52.06,52.06,0,0,0,108,152Z`}))],[`fill`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M256,136a8,8,0,0,1-8,8H232v16a8,8,0,0,1-16,0V144H200a8,8,0,0,1,0-16h16V112a8,8,0,0,1,16,0v16h16A8,8,0,0,1,256,136ZM144,157.68a68,68,0,1,0-71.9,0c-20.65,6.76-39.23,19.39-54.17,37.17A8,8,0,0,0,24,208H192a8,8,0,0,0,6.13-13.15C183.18,177.07,164.6,164.44,144,157.68Z`}))],[`light`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M254,136a6,6,0,0,1-6,6H230v18a6,6,0,0,1-12,0V142H200a6,6,0,0,1,0-12h18V112a6,6,0,0,1,12,0v18h18A6,6,0,0,1,254,136Zm-57.41,60.14a6,6,0,1,1-9.18,7.72C166.9,179.45,138.69,166,108,166s-58.89,13.45-79.41,37.86a6,6,0,0,1-9.18-7.72C35.14,177.41,55,164.48,77,158.25a66,66,0,1,1,62,0C161,164.48,180.86,177.41,196.59,196.14ZM108,154a54,54,0,1,0-54-54A54.06,54.06,0,0,0,108,154Z`}))],[`regular`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M256,136a8,8,0,0,1-8,8H232v16a8,8,0,0,1-16,0V144H200a8,8,0,0,1,0-16h16V112a8,8,0,0,1,16,0v16h16A8,8,0,0,1,256,136Zm-57.87,58.85a8,8,0,0,1-12.26,10.3C165.75,181.19,138.09,168,108,168s-57.75,13.19-77.87,37.15a8,8,0,0,1-12.25-10.3c14.94-17.78,33.52-30.41,54.17-37.17a68,68,0,1,1,71.9,0C164.6,164.44,183.18,177.07,198.13,194.85ZM108,152a52,52,0,1,0-52-52A52.06,52.06,0,0,0,108,152Z`}))],[`thin`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M252,136a4,4,0,0,1-4,4H228v20a4,4,0,0,1-8,0V140H200a4,4,0,0,1,0-8h20V112a4,4,0,0,1,8,0v20h20A4,4,0,0,1,252,136Zm-56.94,61.43a4,4,0,0,1-6.12,5.14C168,177.7,139.3,164,108,164s-60,13.7-80.94,38.57a4,4,0,1,1-6.12-5.14c16.71-19.9,38.13-33.13,61.89-38.59a64,64,0,1,1,50.34,0C156.93,164.3,178.35,177.53,195.06,197.43ZM108,156a56,56,0,1,0-56-56A56.06,56.06,0,0,0,108,156Z`}))]]),uM=N.forwardRef((e,t)=>N.createElement(k,{ref:t,...e,weights:Xj}));uM.displayName=`ArrowLeftIcon`;var dM=uM,fM=N.forwardRef((e,t)=>N.createElement(k,{ref:t,...e,weights:Zj}));fM.displayName=`ArrowRightIcon`;var pM=fM,mM=N.forwardRef((e,t)=>N.createElement(k,{ref:t,...e,weights:Qj}));mM.displayName=`BookOpenIcon`;var hM=mM,gM=N.forwardRef((e,t)=>N.createElement(k,{ref:t,...e,weights:$j}));gM.displayName=`DotsThreeIcon`;var _M=gM,vM=N.forwardRef((e,t)=>N.createElement(k,{ref:t,...e,weights:eM}));vM.displayName=`MagnifyingGlassIcon`;var yM=vM,bM=N.forwardRef((e,t)=>N.createElement(k,{ref:t,...e,weights:tM}));bM.displayName=`MoonIcon`;var xM=bM,SM=N.forwardRef((e,t)=>N.createElement(k,{ref:t,...e,weights:nM}));SM.displayName=`PencilSimpleIcon`;var CM=SM,wM=N.forwardRef((e,t)=>N.createElement(k,{ref:t,...e,weights:rM}));wM.displayName=`PlugsConnectedIcon`;var TM=wM,EM=N.forwardRef((e,t)=>N.createElement(k,{ref:t,...e,weights:iM}));EM.displayName=`PlusIcon`;var DM=EM,OM=N.forwardRef((e,t)=>N.createElement(k,{ref:t,...e,weights:aM}));OM.displayName=`SignOutIcon`;var kM=OM,AM=N.forwardRef((e,t)=>N.createElement(k,{ref:t,...e,weights:oM}));AM.displayName=`SparkleIcon`;var jM=AM,MM=N.forwardRef((e,t)=>N.createElement(k,{ref:t,...e,weights:sM}));MM.displayName=`SunIcon`;var NM=MM,PM=N.forwardRef((e,t)=>N.createElement(k,{ref:t,...e,weights:cM}));PM.displayName=`TrashIcon`;var FM=PM,IM=N.forwardRef((e,t)=>N.createElement(k,{ref:t,...e,weights:lM}));IM.displayName=`UserPlusIcon`;var LM=IM,RM=class extends Error{status;problems;code;constructor(e,t,n=[],r=``){super(e),this.status=t,this.problems=n,this.code=r}},zM=`fanout:unauthorized`;function BM(){let e=new URLSearchParams(window.location.search).get(`return_to`);if(!e)return``;let t=new URL(e,window.location.origin);return t.origin!==window.location.origin||t.pathname!==`/api/auth/oauth/authorize`?``:`${t.pathname}${t.search}`}function VM(e){return!e||typeof e!=`object`||!(`id`in e)||typeof e.id!=`string`||e.id===``?`none`:`user`}function HM(){window.dispatchEvent(new Event(zM))}async function UM(e,t={}){let n=new Headers(t.headers);n.set(`Fanout-Request`,`1`);let r=await fetch(e,{...t,headers:n,credentials:`same-origin`});if(r.status===401&&HM(),r.status===403){let e=await r.clone().json().catch(()=>({}));throw new RM(e.message??`You do not have permission to perform this action.`,r.status,[],e.code??``)}return r}async function WM(){let e=await UM(`/api/auth/logout`,{method:`POST`});if(!e.ok&&e.status!==401)throw Error(`Sign-out failed — your session is still active.`);e.status!==401&&HM(),window.location.assign(`/`)}var GM=(0,N.createContext)(null);function KM(){let e=(0,N.useContext)(GM);if(!e)throw Error(`Fanout runtime status is unavailable`);return e}var qM=(0,N.createContext)(null);function JM(){let e=(0,N.useContext)(qM);if(!e)throw Error(`Fanout viewer is unavailable`);return e}function YM(e){if(!e||typeof e!=`object`)return null;let t=e;return typeof t.id!=`string`||t.id===``||t.status!==`active`&&t.status!==`suspended`?null:{id:t.id,email:typeof t.email==`string`?t.email:``,display_name:typeof t.display_name==`string`?t.display_name:``,status:t.status,role:typeof t.role==`string`?t.role:``}}async function XM(e,t){let n=await fetch(e,{method:t===void 0?`GET`:`POST`,headers:t===void 0?void 0:{"Content-Type":`application/json`},body:t===void 0?void 0:JSON.stringify(t),credentials:`same-origin`}),r=await n.json().catch(()=>({}));if(!n.ok)throw Error(r.message??`Request failed (${n.status})`);return r}function ZM({children:e,wide:t=!1}){return(0,P.jsx)(u,{mih:`100dvh`,style:{background:`radial-gradient(circle at 50% -12%, var(--mantine-color-brand-light), transparent 38%), linear-gradient(180deg, var(--mantine-color-default-hover), var(--mantine-color-body) 62%)`},children:(0,P.jsx)(Ae,{mih:`100dvh`,px:`md`,py:48,children:(0,P.jsx)(_e,{size:t?680:480,w:`100%`,children:(0,P.jsx)(Pe,{radius:28,p:{base:24,sm:40},style:{background:`var(--mantine-color-body)`,border:`1px solid var(--mantine-color-default-border)`,boxShadow:`var(--mantine-shadow-xl)`},children:e})})})})}function QM(){return typeof window>`u`?``:new URLSearchParams(window.location.search).get(`setup_token`)??``}function $M(){return typeof window>`u`?``:new URLSearchParams(window.location.search).get(`login_token`)??``}function eN({children:e}){let t=Re(),[n,r]=(0,N.useState)(null),[i,a]=(0,N.useState)(!1),[o,s]=(0,N.useState)(`none`),[c,l]=(0,N.useState)(null),[d,f]=(0,N.useState)(!1),[p,m]=(0,N.useState)(``),[h,g]=(0,N.useState)(``),[_,v]=(0,N.useState)(QM),[y,b]=(0,N.useState)($M),[x,S]=(0,N.useState)(``),[C,w]=(0,N.useState)(!1),[T,ee]=(0,N.useState)(0),[E,D]=(0,N.useState)(()=>Date.now()),[O,te]=(0,N.useState)(!1),[re,k]=(0,N.useState)(``),[ie,ae]=(0,N.useState)(null),[oe,ce]=(0,N.useState)(!1),ue=(0,N.useRef)(null),de=BM(),fe=o===`user`;async function me(){let e=await fetch(`/api/auth/me`,{credentials:`same-origin`});if(!e.ok){s(`none`),l(null);return}let t=await e.json().catch(()=>null);s(VM(t)),l(YM(t))}async function he(){try{let e=await fetch(`/api/auth/me`,{credentials:`same-origin`});if(!e.ok)return;l(YM(await e.json().catch(()=>null)))}catch{}}(0,N.useEffect)(()=>{let e=new URL(window.location.href);(e.searchParams.has(`setup_token`)||e.searchParams.has(`login_token`))&&(e.searchParams.delete(`setup_token`),e.searchParams.delete(`login_token`),t({href:e.pathname+e.search+e.hash,replace:!0}))},[t]),(0,N.useEffect)(()=>{XM(`/api/auth/status`).then(r).catch(e=>k(String(e))).finally(()=>a(!0)),me().catch(()=>s(`none`)).finally(()=>f(!0));let e=()=>{s(`none`),l(null)};return window.addEventListener(zM,e),()=>window.removeEventListener(zM,e)},[]),(0,N.useEffect)(()=>{d&&o===`none`&&y&&(te(!0),k(``),XM(`/api/auth/link/verify`,{token:y}).then(()=>{s(`user`),he()}).catch(e=>k(e instanceof Error?e.message:String(e))).finally(()=>{b(``),te(!1)}))},[y,d,o]),(0,N.useEffect)(()=>{fe&&d&&de&&window.location.replace(de)},[fe,de,d]),(0,N.useEffect)(()=>{if(T<=Date.now())return;let e=setInterval(()=>{D(Date.now()),Date.now()>=T&&clearInterval(e)},1e3);return()=>clearInterval(e)},[T]);let ge=Math.max(0,Math.ceil((T-E)/1e3));(0,N.useEffect)(()=>{C&&!O&&re&&ue.current?.querySelector(`input`)?.focus()},[O,C,re]);async function _e(e){try{await navigator.clipboard.writeText(e),ce(!0)}catch{k(`Clipboard access failed. Select and copy the token manually.`)}}if(ie?.ingest_token)return(0,P.jsx)(ZM,{wide:!0,children:(0,P.jsxs)(A,{gap:`lg`,children:[(0,P.jsx)(Oe,{}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(le,{c:`brand`,fw:700,size:`xs`,tt:`uppercase`,lts:`0.12em`,children:`Setup complete`}),(0,P.jsx)(be,{order:1,mt:`xs`,fz:{base:28,sm:32},lh:1.08,children:`Save your ingest token`})]}),(0,P.jsx)(le,{c:`dimmed`,children:`Fanout shows this token once. Store it with your collector secrets before continuing.`}),(0,P.jsxs)(A,{gap:`xs`,children:[(0,P.jsx)(le,{size:`sm`,fw:600,children:`OTLP endpoint`}),(0,P.jsx)(ps,{block:!0,children:ie.suggested_endpoint??window.location.origin})]}),(0,P.jsxs)(A,{gap:`xs`,children:[(0,P.jsx)(le,{size:`sm`,fw:600,children:`Header`}),(0,P.jsxs)(ps,{block:!0,children:[ie.ingest_header_name??`Authorization`,`: Bearer `,ie.ingest_token]})]}),re&&(0,P.jsx)(Se,{color:`bad`,radius:`md`,children:re}),(0,P.jsxs)(ne,{grow:!0,align:`stretch`,children:[(0,P.jsx)(se,{variant:`light`,radius:`md`,leftSection:oe?(0,P.jsx)(pe,{size:16,weight:`bold`}):(0,P.jsx)(Te,{size:16}),onClick:()=>void _e(`${ie.ingest_header_name??`Authorization`}: Bearer ${ie.ingest_token}`),children:oe?`Copied`:`Copy header`}),(0,P.jsx)(se,{radius:`md`,rightSection:(0,P.jsx)(pM,{size:16,weight:`bold`}),onClick:()=>{s(`user`),ae(null),he()},children:`Continue to Fanout`})]}),(0,P.jsx)(se,{variant:`subtle`,size:`compact-xs`,onClick:()=>void _e(ie.ingest_token??``),children:`Copy token only`})]})});if(!d||!i||y)return(0,P.jsx)(Ae,{mih:`100dvh`,children:(0,P.jsx)(Fe,{size:`sm`})});if(!n)return(0,P.jsx)(ZM,{children:(0,P.jsxs)(A,{gap:`lg`,children:[(0,P.jsx)(Oe,{}),(0,P.jsx)(be,{order:1,children:`Fanout is unavailable`}),(0,P.jsx)(Se,{color:`bad`,radius:`md`,children:re||`Authentication status could not be loaded.`})]})});if(fe&&de)return null;if(fe)return(0,P.jsx)(GM.Provider,{value:n,children:(0,P.jsx)(qM.Provider,{value:c??{id:``,email:p,display_name:h,status:`active`,role:``},children:e})});if(n&&!n.setup_required&&n.auth_mode===`oidc`){let e=de?`/api/auth/oidc/start?return_to=${encodeURIComponent(de)}`:`/api/auth/oidc/start`;return(0,P.jsx)(ZM,{children:(0,P.jsxs)(A,{gap:28,children:[(0,P.jsx)(Oe,{}),(0,P.jsxs)(A,{gap:10,children:[(0,P.jsx)(le,{c:`brand`,fw:700,size:`xs`,tt:`uppercase`,lts:`0.12em`,children:`Secure workspace`}),(0,P.jsx)(be,{order:1,fz:{base:28,sm:32},lh:1.08,children:`Sign in`}),(0,P.jsx)(le,{c:`dimmed`,size:`md`,lh:1.6,children:`Use your organization's identity provider to continue.`})]}),re&&(0,P.jsx)(Se,{color:`bad`,radius:`md`,children:re}),(0,P.jsx)(se,{component:`a`,href:e,size:`md`,radius:`md`,rightSection:(0,P.jsx)(pM,{size:17,weight:`bold`}),children:`Continue with SSO`})]})})}async function ve(){te(!0),k(``);try{await XM(`/api/auth/code/send`,{email:p}),w(!0),S(``),ee(Date.now()+3e4),D(Date.now())}catch(e){k(e instanceof Error?e.message:String(e))}finally{te(!1)}}async function j(e){te(!0),k(``);try{await XM(`/api/auth/code/verify`,{email:p,code:e}),s(`user`),w(!1),S(``),ee(0),he()}catch(e){S(``),k(e instanceof Error?e.message:String(e))}finally{te(!1)}}function M(){w(!1),S(``),k(``)}async function ye(e){e.preventDefault(),te(!0),k(``);try{if(n?.setup_required){let e=await XM(`/api/auth/setup`,{email:p,display_name:h,setup_token:_});e.ingest_token?ae(e):(s(`user`),he())}else if(C){await j(x);return}else{await ve();return}}catch(e){k(e instanceof Error?e.message:String(e))}finally{te(!1)}}let xe=C&&!n?.setup_required,Ce=n?.setup_required?`Create the first admin`:xe?`Check your email`:n?.self_signup?`Sign in or create an account`:`Sign in`,we=n?.setup_required?`Use the one-time token printed by the Fanout process.`:n?.smtp_configured?xe?`We sent a code to ${p}.`:n?.self_signup?`Enter your email to sign in or create a viewer account. No password needed.`:`Enter your email and we’ll send a short verification code. No password needed.`:`Email delivery is not configured. Ask the operator to run fanout login-link with your email address.`;return(0,P.jsx)(ZM,{children:(0,P.jsxs)(A,{gap:28,children:[(0,P.jsx)(Oe,{}),(0,P.jsxs)(A,{gap:10,children:[(0,P.jsx)(le,{c:`brand`,fw:700,size:`xs`,tt:`uppercase`,lts:`0.12em`,children:n?.setup_required?`One-time setup`:`Secure workspace`}),(0,P.jsx)(be,{order:1,fz:{base:28,sm:32},lh:1.08,children:Ce}),we&&(0,P.jsx)(le,{c:`dimmed`,size:`md`,lh:1.6,maw:390,children:we})]}),(0,P.jsx)(`form`,{onSubmit:ye,children:(0,P.jsxs)(A,{gap:`md`,children:[(0,P.jsx)(Wc,{label:`Email`,placeholder:`you@company.com`,type:`email`,required:!0,value:p,onChange:e=>m(e.currentTarget.value),disabled:C,variant:`filled`,radius:`md`,size:`md`,autoFocus:!C}),n?.setup_required&&(0,P.jsx)(Wc,{label:`Display name`,placeholder:`Your display name`,value:h,onChange:e=>g(e.currentTarget.value),variant:`filled`,radius:`md`,size:`md`}),n?.setup_required&&(0,P.jsx)(Wc,{label:`Setup token`,placeholder:`from the setup URL printed at startup`,required:!0,value:_,onChange:e=>v(e.currentTarget.value),autoComplete:`one-time-code`,variant:`filled`,radius:`md`,size:`md`}),xe&&(0,P.jsxs)(A,{gap:`xs`,children:[(0,P.jsx)(le,{size:`sm`,fw:600,children:`Verification code`}),(0,P.jsx)(u,{ref:ue,children:(0,P.jsx)(Uc,{length:6,type:`number`,oneTimeCode:!0,autoFocus:!0,value:x,onChange:S,onComplete:e=>void j(e),disabled:O,error:!!re,size:`md`,radius:`md`,"aria-label":`Verification code`,getInputProps:e=>({"aria-label":`Digit ${e+1}`})})}),(0,P.jsxs)(ne,{justify:`space-between`,gap:`xs`,children:[(0,P.jsxs)(le,{c:`dimmed`,size:`xs`,children:[`Sent to `,p]}),(0,P.jsx)(se,{variant:`subtle`,size:`compact-xs`,leftSection:(0,P.jsx)(dM,{size:12,weight:`bold`}),onClick:M,disabled:O,children:`Change email`})]}),(0,P.jsxs)(ne,{justify:`space-between`,gap:`xs`,children:[(0,P.jsx)(le,{c:`dimmed`,size:`xs`,children:`Codes expire in 5 minutes`}),(0,P.jsx)(se,{variant:`subtle`,size:`compact-xs`,onClick:()=>void ve(),disabled:O||ge>0,children:ge>0?`Resend in ${ge}s`:`Resend code`})]})]}),re&&(0,P.jsx)(Se,{color:`bad`,radius:`md`,children:re}),xe?(0,P.jsx)(se,{type:`submit`,size:`md`,radius:`md`,mt:4,loading:O,disabled:O||x.length<6,rightSection:(0,P.jsx)(pM,{size:17,weight:`bold`}),children:`Verify code`}):(0,P.jsx)(se,{type:`submit`,size:`md`,radius:`md`,mt:4,loading:O,disabled:!n||!n.setup_required&&!n.smtp_configured,leftSection:n?.setup_required?(0,P.jsx)(LM,{size:17,weight:`bold`}):void 0,rightSection:n?.setup_required?void 0:(0,P.jsx)(pM,{size:17,weight:`bold`}),children:n?.setup_required?`Create admin`:`Send code`})]})})]})})}var tN=[`agent-threads`];async function nN(e){let t=await UM(e);if(!t.ok)throw Error(`Request failed (${t.status})`);return t.json()}var rN=[];for(let e=0;e<256;++e)rN.push((e+256).toString(16).slice(1));function iN(e,t=0){return(rN[e[t+0]]+rN[e[t+1]]+rN[e[t+2]]+rN[e[t+3]]+`-`+rN[e[t+4]]+rN[e[t+5]]+`-`+rN[e[t+6]]+rN[e[t+7]]+`-`+rN[e[t+8]]+rN[e[t+9]]+`-`+rN[e[t+10]]+rN[e[t+11]]+rN[e[t+12]]+rN[e[t+13]]+rN[e[t+14]]+rN[e[t+15]]).toLowerCase()}var aN=new Uint8Array(16);function oN(){return crypto.getRandomValues(aN)}var sN={};function cN(e,t,n){let r;if(e)r=uN(e.random??e.rng?.()??oN(),e.msecs,e.seq,t,n);else{let e=Date.now(),i=oN();lN(sN,e,i),r=uN(i,sN.msecs,sN.seq,t,n)}return t??iN(r)}function lN(e,t,n){return e.msecs??=-1/0,e.seq??=0,t>e.msecs?(e.seq=dN(n),e.msecs=t):(e.seq=e.seq+1|0,e.seq===0&&e.msecs++),e}function uN(e,t,n,r,i=0){if(e.length<16)throw Error(`Random bytes length must be >= 16`);if(!r)r=new Uint8Array(16),i=0;else if(i<0||i+16>r.length)throw RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);return t??=Date.now(),n??=dN(e),r[i++]=t/1099511627776&255,r[i++]=t/4294967296&255,r[i++]=t/16777216&255,r[i++]=t/65536&255,r[i++]=t/256&255,r[i++]=t&255,r[i++]=112|n>>>28&15,r[i++]=n>>>20&255,r[i++]=128|n>>>14&63,r[i++]=n>>>6&255,r[i++]=n<<2&255|e[10]&3,r[i++]=e[11],r[i++]=e[12],r[i++]=e[13],r[i++]=e[14],r[i++]=e[15],r}function dN(e){return(e[6]&127)<<24|e[7]<<16|e[8]<<8|e[9]}function fN(){return cN()}var pN=[`dashboards`],mN=3e4;async function hN(e,t){let{json:n,...r}=t??{},i=new Headers(r.headers),a=r.body;n!==void 0&&(i.set(`content-type`,`application/json`),a=JSON.stringify(n));let o=await UM(e,{...r,headers:i,body:a}),s=await o.json().catch(()=>({}));if(!o.ok)throw new RM(s.message??`Request failed (${o.status})`,o.status,s.problems??[],s.code??``);return s}var gN=e=>`/api/dashboards/${encodeURIComponent(e)}`,_N=()=>hN(`/api/dashboards`).then(e=>e.dashboards),vN=(e,t)=>hN(gN(e),{signal:t}),yN=(e,t)=>hN(`${gN(e)}/versions`,{signal:t}).then(e=>e.versions),bN=(e,t,n)=>hN(`${gN(e)}/versions/${t}`,{signal:n}),xN=(e,t)=>hN(`${gN(e)}/versions/${t}/restore`,{method:`POST`}),SN=(e,t,n,r)=>hN(gN(e),{method:`PUT`,json:{spec:t,base_version:n,message:r}}),CN=(e,t,n,r)=>hN(gN(e),{method:`PATCH`,json:{operations:t,base_version:n,message:r}}),wN=(e,t)=>hN(`/api/panels/query`,{method:`POST`,json:e,signal:t}).then(e=>e.results),TN=e=>hN(`/api/telemetry/schema`,{signal:e}),EN=(e,t)=>hN(`/api/annotations`,{method:`POST`,json:e,signal:t}),DN=(e,t)=>hN(`/api/panels/variables/resolve`,{method:`POST`,json:e,signal:t}).then(e=>e.options),ON=(e,t)=>hN(`/api/panels/exemplars`,{method:`POST`,json:e,signal:t});function kN(e,t){let n=new URLSearchParams({namespace:e.namespace??``,from:e.window_from,to:e.window_to,limit:`200`});return hN(`/api/traces/${encodeURIComponent(e.trace_id??``)}?${n}`,{signal:t})}function AN(){let{setColorScheme:e}=zr(),t=Hr(`light`,{getInitialValueInEffect:!0}),n=t===`dark`?`light`:`dark`,[r,i]=(0,N.useState)(!1);return(0,P.jsx)(Dt,{label:`Switch to ${n} theme`,opened:r,children:(0,P.jsx)(Ni,{variant:`subtle`,color:`gray`,"aria-label":`Switch to ${n} theme`,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),onFocus:()=>i(!0),onBlur:()=>i(!1),onClick:()=>{i(!1),e(n)},children:t===`dark`?(0,P.jsx)(NM,{size:17,weight:`bold`}):(0,P.jsx)(xM,{size:17,weight:`bold`})})})}var jN={home:`https://fanout.run/start/what-fanout-is`,ingest:`https://fanout.run/start/send-telemetry`};async function MN(e,t){let n=new URLSearchParams({page_size:`30`});e&&n.set(`q`,e),t&&n.set(`cursor`,t);let r=await UM(`/api/agent/threads?${n}`);if(!r.ok)throw Error(`Unable to load chats (${r.status})`);return r.json()}function NN({agentAvailable:e,activeThreadID:t,activeDashboardID:n,autoFocusSearch:r=!1,onNewChat:i,onSelectThread:a,onDeletedThread:o,onSelectDashboard:s,onCreateDashboard:c,onInvestigateService:l,ref:u}){let d=TA(),[f,p]=(0,N.useState)(``),[m]=fr(f.trim(),250),[h,g]=(0,N.useState)(null),[_,v]=(0,N.useState)(null),[y,b]=(0,N.useState)(``),[x,S]=(0,N.useState)(``),[w,T]=(0,N.useState)(!1),ee=(0,N.useRef)(null);(0,N.useImperativeHandle)(u,()=>({focusSearch:()=>ee.current?.focus()}),[]),(0,N.useEffect)(()=>{r&&requestAnimationFrame(()=>ee.current?.focus())},[r]);let E=Yj({queryKey:[...tN,m],queryFn:({pageParam:e})=>MN(m,e),initialPageParam:``,getNextPageParam:e=>e.next_cursor??void 0,enabled:e}),D=Jj({queryKey:pN,queryFn:_N,refetchInterval:3e4,staleTime:mN}),O=(0,N.useMemo)(()=>E.data?.pages.flatMap(e=>e.items)??[],[E.data]),te=(0,N.useMemo)(()=>zN(O),[O]),re=Jj({queryKey:[`telemetry-schema`,`1h`],queryFn:()=>nN(`/api/telemetry/schema?window=1h`),enabled:!!m&&!!l,staleTime:6e4}),k=(0,N.useMemo)(()=>{if(!m)return[];let e=m.toLowerCase();return(re.data?.services??[]).map(e=>e.value).filter(t=>t.toLowerCase().includes(e)).slice(0,6)},[re.data,m]),ie=(0,N.useMemo)(()=>{let e=D.data??[],t=m.toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)):e},[D.data,m]);function ae(e){S(``),b(e.title),g(e)}async function oe(){if(h&&y.trim()){T(!0),S(``);try{let e=await UM(`/api/agent/threads/${encodeURIComponent(h.id)}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({title:y.trim()})});if(!e.ok)throw Error(`Unable to rename chat (${e.status})`);await d.invalidateQueries({queryKey:tN}),g(null)}catch(e){S(e instanceof Error?e.message:`Unable to rename this chat.`)}finally{T(!1)}}}async function ce(){if(_){T(!0),S(``);try{let e=await UM(`/api/agent/threads/${encodeURIComponent(_.id)}`,{method:`DELETE`});if(!e.ok)throw Error(`Unable to delete chat (${e.status})`);let t=_.id;v(null),await d.invalidateQueries({queryKey:tN}),await d.invalidateQueries({queryKey:pN}),o(t)}catch(e){S(e instanceof Error?e.message:`Unable to delete this chat.`)}finally{T(!1)}}}return(0,P.jsxs)(A,{gap:`sm`,h:`100%`,component:`nav`,"aria-label":`Navigation`,children:[e&&(0,P.jsx)(se,{leftSection:(0,P.jsx)(DM,{size:16,weight:`bold`}),onClick:i,children:`New chat`}),(0,P.jsx)(Ct,{type:`auto`,offsetScrollbars:!0,flex:1,mx:-4,px:4,children:(0,P.jsxs)(A,{gap:`lg`,pb:`sm`,children:[e&&(0,P.jsxs)(A,{gap:4,children:[(0,P.jsx)(PN,{children:`Chats`}),E.isLoading&&(0,P.jsx)(Ae,{py:`md`,children:(0,P.jsx)(Fe,{size:`xs`})}),E.isError&&(0,P.jsx)(Se,{color:`bad`,radius:`md`,p:`xs`,children:`Chats could not be loaded.`}),!E.isLoading&&!E.isError&&O.length===0&&(0,P.jsx)(le,{c:`dimmed`,size:`sm`,px:`sm`,py:`xs`,children:m?`No matching chats`:`No chats yet`}),te.map(e=>(0,P.jsxs)(A,{gap:2,children:[te.length>1&&(0,P.jsx)(le,{c:`dimmed`,size:`xs`,px:`sm`,pt:4,children:e.label}),e.threads.map(e=>(0,P.jsx)(FN,{thread:e,active:e.id===t,onSelect:()=>a(e.id),onRename:()=>ae(e),onDelete:()=>{S(``),v(e)}},e.id))]},e.label)),E.hasNextPage&&(0,P.jsx)(se,{variant:`subtle`,color:`gray`,size:`compact-sm`,loading:E.isFetchingNextPage,onClick:()=>void E.fetchNextPage(),children:`See all`})]}),m&&l&&re.isLoading&&(0,P.jsx)(Ae,{py:`md`,children:(0,P.jsx)(Fe,{size:`xs`})}),m&&l&&(re.isSuccess||re.isError)&&(0,P.jsxs)(A,{gap:4,children:[(0,P.jsx)(PN,{children:`Services`}),re.isError&&(0,P.jsx)(le,{c:`dimmed`,size:`sm`,px:`sm`,children:`Services could not be searched`}),re.isSuccess&&k.length===0&&(0,P.jsx)(le,{c:`dimmed`,size:`sm`,px:`sm`,children:`No matching services`}),k.map(e=>(0,P.jsx)(C,{className:`rail-row`,p:`sm`,onClick:()=>l(e),children:(0,P.jsx)(le,{size:`sm`,fw:500,truncate:!0,children:e})},e))]}),(0,P.jsxs)(A,{gap:4,children:[(0,P.jsx)(PN,{children:`Dashboards`}),D.isLoading&&(0,P.jsx)(Ae,{py:`md`,children:(0,P.jsx)(Fe,{size:`xs`})}),D.isError&&(0,P.jsx)(Se,{color:`bad`,radius:`md`,p:`xs`,children:`Dashboards could not be loaded.`}),!D.isLoading&&!D.isError&&m&&ie.length===0&&(0,P.jsx)(le,{c:`dimmed`,size:`sm`,px:`sm`,py:`xs`,children:`No matching dashboards`}),ie.map(e=>{let t=e.id===n;return(0,P.jsxs)(A,{gap:0,children:[(0,P.jsx)(C,{component:`a`,href:`/dashboards/${encodeURIComponent(e.id)}`,className:`rail-row`,"data-active":t||void 0,"aria-current":t?`page`:void 0,p:`sm`,onClick:t=>{t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||(t.preventDefault(),s(e.id))},children:(0,P.jsxs)(ne,{justify:`space-between`,gap:`sm`,wrap:`nowrap`,children:[(0,P.jsx)(le,{size:`sm`,fw:t?600:500,truncate:!0,children:e.name}),e.is_default&&(0,P.jsx)(ss,{size:`xs`,variant:`light`,color:`gray`,children:`Default`})]})}),e.origin&&(0,P.jsx)(C,{component:`a`,href:`/chat/${encodeURIComponent(e.origin.thread_id)}`,"data-request-provenance":!0,px:`sm`,pb:`xs`,onClick:t=>{t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||(t.preventDefault(),a(e.origin.thread_id))},children:(0,P.jsxs)(le,{size:`xs`,c:`dimmed`,lineClamp:2,children:[`Built from: `,e.origin.request_excerpt]})})]},e.id)}),e&&(0,P.jsx)(se,{variant:`subtle`,color:`gray`,size:`compact-sm`,justify:`flex-start`,leftSection:(0,P.jsx)(jM,{size:14,weight:`fill`}),onClick:c,children:D.data?.length===0?`New dashboard`:`Create with AI`})]})]})}),(0,P.jsx)(Wc,{ref:ee,value:f,onChange:e=>p(e.currentTarget.value),leftSection:(0,P.jsx)(yM,{size:15}),rightSection:(0,P.jsx)(Is,{size:`xs`,children:`⌘K`}),rightSectionWidth:44,placeholder:`Search`,"aria-label":`Search chats, dashboards and services`,size:`sm`}),(0,P.jsx)(Lc,{opened:h!==null,onClose:()=>!w&&g(null),title:`Rename chat`,centered:!0,children:(0,P.jsx)(`form`,{onSubmit:e=>{e.preventDefault(),oe()},children:(0,P.jsxs)(A,{children:[(0,P.jsx)(Wc,{label:`Name`,value:y,onChange:e=>b(e.currentTarget.value),maxLength:120,autoFocus:!0}),x&&(0,P.jsx)(Se,{color:`bad`,children:x}),(0,P.jsxs)(ne,{justify:`flex-end`,children:[(0,P.jsx)(se,{variant:`default`,onClick:()=>g(null),disabled:w,children:`Cancel`}),(0,P.jsx)(se,{type:`submit`,loading:w,disabled:!y.trim(),children:`Save`})]})]})})}),(0,P.jsx)(Lc,{opened:_!==null,onClose:()=>!w&&v(null),title:`Delete chat?`,centered:!0,children:(0,P.jsxs)(A,{children:[(0,P.jsxs)(le,{size:`sm`,children:[`This permanently removes `,(0,P.jsx)(le,{span:!0,fw:650,children:_?.title}),` and its saved messages.`]}),x&&(0,P.jsx)(Se,{color:`bad`,children:x}),(0,P.jsxs)(ne,{justify:`flex-end`,children:[(0,P.jsx)(se,{variant:`default`,onClick:()=>v(null),disabled:w,children:`Cancel`}),(0,P.jsx)(se,{color:`bad`,loading:w,onClick:()=>void ce(),children:`Delete`})]})]})})]})}function PN({children:e}){return(0,P.jsx)(le,{c:`dimmed`,size:`xs`,fw:700,tt:`uppercase`,lts:`0.08em`,px:`sm`,children:e})}function FN({thread:e,active:t,onSelect:n,onRename:r,onDelete:i}){return(0,P.jsx)(u,{"data-active":t||void 0,className:`rail-row`,children:(0,P.jsxs)(ne,{gap:2,wrap:`nowrap`,children:[(0,P.jsx)(C,{onClick:n,"aria-current":t?`page`:void 0,p:`sm`,flex:1,style:{minWidth:0},children:(0,P.jsxs)(A,{gap:0,children:[(0,P.jsx)(le,{size:`sm`,fw:t?600:500,truncate:!0,children:e.title}),(0,P.jsx)(le,{c:`dimmed`,size:`xs`,children:BN(e.updated_at)})]})}),(0,P.jsxs)(xc,{position:`bottom-end`,withinPortal:!0,children:[(0,P.jsx)(xc.Target,{children:(0,P.jsx)(Ni,{className:`rail-row-actions`,variant:`subtle`,color:`gray`,size:`sm`,mr:4,"aria-label":`Actions for ${e.title}`,children:(0,P.jsx)(_M,{size:18,weight:`bold`})})}),(0,P.jsxs)(xc.Dropdown,{children:[(0,P.jsx)(xc.Item,{leftSection:(0,P.jsx)(CM,{size:15}),onClick:r,children:`Rename`}),(0,P.jsx)(xc.Item,{color:`bad`,leftSection:(0,P.jsx)(FM,{size:15}),onClick:i,children:`Delete`})]})]})]})})}function IN(e){return e.includes(`T`)?new Date(e):new Date(`${e.replace(` `,`T`)}Z`)}function LN(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}var RN=[`Today`,`Yesterday`,`Previous 7 days`,`Older`];function zN(e){let t=LN(new Date),n=new Map;for(let r of e){let e=Math.floor((t-LN(IN(r.updated_at)))/864e5),i=e<=0?`Today`:e===1?`Yesterday`:e<=7?`Previous 7 days`:`Older`,a=n.get(i)??[];a.push(r),n.set(i,a)}return RN.filter(e=>n.has(e)).map(e=>({label:e,threads:n.get(e)}))}function BN(e){let t=IN(e),n=LN(new Date);return Math.floor((n-LN(t))/864e5)<=1?new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(t):new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`}).format(t)}function VN({children:e}){let{agentAvailable:t,threadID:n,threadMissing:r,newThread:i,selectThread:a,openChat:o}=rt(),s=Re(),c=Yn({select:e=>e.location.pathname}),{dashboardId:l}=xn({strict:!1}),u=c===`/chat`||c.startsWith(`/chat/`),[d,f]=Er(!1),[p,m]=(0,N.useState)(!1),[h,g]=(0,N.useState)(``),_=(0,N.useRef)(null),v=ie(`(max-width: 62em)`),y=(0,N.useRef)(v);y.current=v,(0,N.useEffect)(()=>{f.close()},[c]),(0,N.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),y.current?(m(!0),f.open()):_.current?.focusSearch())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let b={agentAvailable:t,activeThreadID:u&&!r&&c!==`/chat`?n:void 0,activeDashboardID:l,onNewChat:i,onSelectThread:a,onDeletedThread:e=>{e===n&&i()},onSelectDashboard:e=>void s({to:`/dashboards/$dashboardId`,params:{dashboardId:e},search:{}}),onCreateDashboard:()=>o(Qe),onInvestigateService:e=>o(`Investigate the ${e} service. Explain its errors and latency.`)};return(0,P.jsxs)(qo,{header:{height:52},navbar:{width:256,breakpoint:`md`,collapsed:{mobile:!0}},padding:0,children:[(0,P.jsx)(qo.Header,{children:(0,P.jsxs)(ne,{h:`100%`,px:{base:`sm`,sm:`md`},justify:`space-between`,wrap:`nowrap`,children:[(0,P.jsxs)(ne,{gap:`sm`,wrap:`nowrap`,children:[(0,P.jsx)(us,{hiddenFrom:`md`,opened:d,onClick:()=>{m(!1),f.toggle()},size:`sm`,"aria-label":d?`Close navigation`:`Open navigation`}),(0,P.jsx)(Oe,{size:`small`})]}),(0,P.jsxs)(ne,{gap:`xs`,wrap:`nowrap`,children:[(0,P.jsx)(Dt,{label:`Documentation`,children:(0,P.jsx)(Ni,{component:`a`,href:jN.home,target:`_blank`,rel:`noopener noreferrer`,variant:`subtle`,color:`gray`,"aria-label":`Documentation`,children:(0,P.jsx)(hM,{size:17,weight:`bold`})})}),(0,P.jsx)(AN,{}),(0,P.jsx)(HN,{onError:g})]})]})}),(0,P.jsx)(qo.Navbar,{p:`sm`,children:(0,P.jsx)(NN,{ref:_,...b})}),(0,P.jsx)(Ns,{opened:d,onClose:f.close,hiddenFrom:`md`,size:288,padding:`sm`,title:(0,P.jsx)(Oe,{size:`small`}),overlayProps:{backgroundOpacity:.24,blur:1},children:(0,P.jsx)(NN,{...b,autoFocusSearch:d&&p})}),(0,P.jsxs)(qo.Main,{children:[h&&(0,P.jsx)(Se,{color:`bad`,m:`md`,withCloseButton:!0,onClose:()=>g(``),children:h}),e]})]})}function HN({onError:e}){let t=Re(),n=JM(),r=(n.display_name.trim()||n.email.trim()||`?`).charAt(0).toUpperCase();return(0,P.jsxs)(xc,{position:`bottom-end`,withinPortal:!0,shadow:`md`,children:[(0,P.jsx)(xc.Target,{children:(0,P.jsx)(Ni,{variant:`subtle`,color:`gray`,size:`lg`,radius:`xl`,"aria-label":`${r} account menu`,children:(0,P.jsx)(is,{size:26,radius:`xl`,color:`brand`,children:r})})}),(0,P.jsxs)(xc.Dropdown,{children:[(0,P.jsx)(xc.Label,{children:n.email||`Signed in`}),(0,P.jsx)(xc.Item,{leftSection:(0,P.jsx)(TM,{size:15}),onClick:()=>void t({to:`/settings`}),children:`Connect telemetry`}),(0,P.jsx)(xc.Divider,{}),(0,P.jsx)(xc.Item,{leftSection:(0,P.jsx)(kM,{size:15}),onClick:()=>void WM().catch(t=>e(t instanceof Error?t.message:`Sign-out failed — your session is still active.`)),children:`Sign out`})]})]})}function UN(){let{agent_available:e}=KM(),t=Re(),n=TA(),{threadId:r}=xn({strict:!1}),[i,a]=(0,N.useState)(fN),o=(0,N.useRef)(new Set),s=r??i,[c,l]=(0,N.useState)([]),[u,d]=(0,N.useState)({}),[f,p]=(0,N.useState)(``),[m,h]=(0,N.useState)(!1),[g,_]=(0,N.useState)(!1),[v,y]=(0,N.useState)(``),[b,x]=(0,N.useState)(null),S=(0,N.useRef)(null),[C,w]=(0,N.useState)(!1),T=(0,N.useRef)(!1),[ee,E]=(0,N.useState)(``),[D,O]=(0,N.useState)(``),[te,ne]=(0,N.useState)(0),re=(0,N.useRef)(null),k=(0,N.useRef)({}),ie=(0,N.useRef)(null),ae=(0,N.useRef)(new Map),A=(0,N.useMemo)(()=>new CA({url:`/api/agent/runs`,threadId:s,fetch:(e,t)=>UM(e,t)}),[s]),oe=!e||f===s;function se(){ae.current.clear(),y(``),S.current=null,x(null)}let ce=e=>e.filter(e=>e.role!==`reasoning`);function le(){let e=S.current?.text.split(/(?<=[.!?])\s/)[0]?.trim().replace(/[.!?]+$/,``);return e?e+`…`:``}function ue(e){return T.current||e instanceof Error&&e.name===`AbortError`}(0,N.useEffect)(()=>{let t=!0;if(l([]),k.current={},d({}),p(``),h(!1),_(!1),T.current=!1,w(!1),se(),O(``),!e){p(s);return}!r||o.current.has(s)?(A.setMessages([]),p(s)):UM(`/api/agent/threads/${encodeURIComponent(s)}`).then(async e=>{if(e.status===404)return null;if(!e.ok)throw Error(`Unable to load thread (${e.status})`);return e.json()}).then(e=>{if(t){if(e===null){h(!0),p(s);return}A.setMessages(ce(e.messages??[])),l(ce(e.messages??[])),p(s)}}).catch(()=>{t&&(re.current=null,O(`This chat could not be restored. Start a new chat or try again.`))});let i=A.subscribe({onEvent:({event:e,messages:t})=>{switch(e.type){case`REASONING_MESSAGE_START`:return S.current={id:e.messageId,text:``,collapsed:!1},x(S.current),y(``),{stopPropagation:!0};case`REASONING_MESSAGE_CONTENT`:{let t=e,n={id:t.messageId,text:(S.current?.text??``)+t.delta,collapsed:!1};return S.current=n,x(n),{stopPropagation:!0}}case`REASONING_START`:case`REASONING_MESSAGE_END`:case`REASONING_END`:return{stopPropagation:!0};default:l(ce(t))}},onMessagesChanged:({messages:e})=>l(ce(e)),onRunInitialized:()=>{T.current=!1,w(!1),_(!0),O(``)},onTextMessageContentEvent:({event:e})=>{e.delta&&(S.current=null,x(null),y(``))},onToolCallStartEvent:({event:e})=>{ae.current.set(e.toolCallId,nt(e.toolCallName)),y(nt(e.toolCallName)),S.current&&(S.current={...S.current,collapsed:!0},x(S.current))},onToolCallResultEvent:({event:e,messages:t})=>{ae.current.delete(e.toolCallId),y([...ae.current.values()].at(-1)??le());let r=at(e.toolCallId,e.content,t);r&&(n.invalidateQueries({queryKey:pN}),n.invalidateQueries({queryKey:[`dashboard`,r.id]}),n.invalidateQueries({queryKey:[`dashboard-versions`,r.id]}))},onRunErrorEvent:({event:e})=>{e.code===`abort`||T.current?(O(``),w(!0)):(console.warn(`Agent run error`,e.code),O(Ye(e.code))),_(!1),se()},onRunFinalized:({messages:e})=>{let t=ce(e);l(t),d(e=>{let n={...e};for(let e of t)e.role===`assistant`&&!n[e.id]&&(n[e.id]=Date.now());return n}),_(!1),se(),o.current.delete(s),n.invalidateQueries({queryKey:tN})},onRunFailed:e=>{ue(e.error)?(O(``),w(!0)):(console.error(`Agent run failed`,e),O(Ye())),_(!1),se(),o.current.delete(s),n.invalidateQueries({queryKey:tN})}});return()=>{t=!1,i.unsubscribe(),A.abortRun()}},[A,e,n,te,s]),(0,N.useEffect)(()=>{if(!e)return;let n=e=>{let n=e.target,i=n?.matches(`input, textarea, [contenteditable='true']`);e.key===`/`&&!i&&(e.preventDefault(),r?requestAnimationFrame(()=>ie.current?.focus()):t({to:`/chat`}).then(()=>requestAnimationFrame(()=>ie.current?.focus()))),e.key===`Escape`&&n===ie.current&&(E(``),ie.current?.blur())};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t,r]);async function de(){_(!0),O(``);try{await A.runAgent({forwardedProps:{...k.current}})}catch(e){ue(e)?(O(``),w(!0)):(console.error(`Agent run failed`,e),O(Ye())),_(!1),se(),o.current.delete(s)}}async function fe(n,i){let a=n.trim();if(!e||!a||g||!oe||m)return;k.current={...i},r||(o.current.add(s),t({to:`/chat/$threadId`,params:{threadId:s},replace:!0}));let c={id:fN(),role:`user`,content:a};A.addMessage(c),l([...A.messages]),d(e=>({...e,[c.id]:Date.now()})),E(``),await de()}(0,N.useEffect)(()=>{let e=re.current;oe&&r&&e&&(re.current=null,fe(e.text,e.options))},[oe,r,s]);function pe(e){e.preventDefault(),fe(ee)}function me(){T.current=!0,O(``),w(!0),A.abortRun(),_(!1),se(),o.current.delete(s)}function he(){!g&&A.messages.some(e=>e.role===`user`)&&de()}function ge(n,r){if(!e)return;let i=fN();o.current.add(i),re.current=n?{text:n,options:{...r}}:null,t({to:`/chat/$threadId`,params:{threadId:i}})}function _e(){A.abortRun(),re.current=null,k.current={},a(fN()),t({to:`/chat`})}function ve(e){re.current=null,k.current={},t({to:`/chat/$threadId`,params:{threadId:e}})}function j(){ne(e=>e+1)}return(0,P.jsx)(tt.Provider,{value:{agentAvailable:e,threadID:s,threadMissing:m,messages:c,messageTimes:u,ready:oe,running:g,activity:v,provisional:b,stopped:C,input:ee,setInput:E,error:D,inputRef:ie,send:fe,submit:pe,stop:me,retry:he,reloadThread:j,openChat:ge,newThread:_e,selectThread:ve},children:(0,P.jsx)(VN,{children:(0,P.jsx)(zn,{})})})}function WN(){let e=(0,N.useMemo)(()=>new Fj,[]);return(0,P.jsx)(EA,{client:e,children:(0,P.jsx)(eN,{children:(0,P.jsx)(UN,{})})})}var GN=Dn({component:WN,notFoundComponent:()=>(0,P.jsx)(Be,{to:`/`,replace:!0})}),KN=On(`/`)({component:kn(()=>it(()=>import(`./routes-D2AdaqvY.js`),__vite__mapDeps([0,1,2])),`component`)}),qN=On(`/settings`)({component:kn(()=>it(()=>import(`./settings-KSF6knOe.js`),__vite__mapDeps([3,1,4,5,6])),`component`)}),JN=On(`/chat/`)({component:kn(()=>it(()=>import(`./chat.index-Bgm22VZM.js`),__vite__mapDeps([7,8,1,4,9,5,10])),`component`)}),YN=On(`/chat/$threadId`)({component:kn(()=>it(()=>import(`./chat._threadId-Bgm22VZM.js`),__vite__mapDeps([11,8,1,4,9,5,10])),`component`)});function XN(e){try{let t=typeof e==`string`?e:JSON.stringify(e);if(!t||t.length>4096)return;let n=typeof e==`string`?JSON.parse(e):e;if(!n||typeof n!=`object`)return;let r=n;return typeof r.panel_id!=`string`||!/^([a-z][a-z0-9_]{0,39})$/.test(r.panel_id)||r.kind!==`traces`&&r.kind!==`logs`||typeof r.from!=`string`||typeof r.to!=`string`||!Number.isFinite(Date.parse(r.from))||!Number.isFinite(Date.parse(r.to))||Date.parse(r.from)>=Date.parse(r.to)||Date.parse(r.to)-Date.parse(r.from)>2592e6||typeof r.window_from!=`string`||typeof r.window_to!=`string`||!Number.isFinite(Date.parse(r.window_from))||!Number.isFinite(Date.parse(r.window_to))||Date.parse(r.window_from)>=Date.parse(r.window_to)||Date.parse(r.window_to)-Date.parse(r.window_from)>2592e6||Date.parse(r.from)Date.parse(r.window_to)||!r.dimensions||Array.isArray(r.dimensions)||typeof r.dimensions!=`object`||Object.keys(r.dimensions).length>3||Object.values(r.dimensions).some(e=>typeof e!=`string`||e.length>500)||r.trace_id!==void 0&&(typeof r.trace_id!=`string`||r.trace_id.length>128)||r.namespace!==void 0&&(typeof r.namespace!=`string`||r.namespace.length>200)||r.bucket&&(!Number.isFinite(r.bucket.lower)||r.bucket.lower<0||r.bucket.upper!==void 0&&(!Number.isFinite(r.bucket.upper)||r.bucket.upper<=r.bucket.lower))?void 0:{panel_id:r.panel_id,kind:r.kind,from:r.from,to:r.to,window_from:r.window_from,window_to:r.window_to,dimensions:r.dimensions,trace_id:r.trace_id,namespace:r.namespace,bucket:r.bucket}}catch{return}}function ZN(e,t,n){if(!e.drill&&e.viz!==`service_map`&&!n.trace_id||t.from_ms===void 0||t.to_ms===void 0)return;let r=t.from_ms,i=t.to_ms;if(n.from!==void 0&&n.to!==void 0&&(r=Math.max(r,Date.parse(n.from)),i=Math.min(i,Date.parse(n.to))),n.time!==void 0&&!n.trace_id){let e=/^(\d+)(s|m|h|d)$/.exec(t.interval??``),a=e?Number(e[1])*{s:1e3,m:6e4,h:36e5,d:864e5}[e[2]]:6e4;r=Math.max(r,n.time),i=Math.min(i,n.time+a)}return XN(JSON.stringify({panel_id:e.id,kind:n.trace_id||e.viz===`service_map`?`traces`:e.drill,from:n.from&&Date.parse(n.from)===r?n.from:new Date(r).toISOString(),to:n.to&&Date.parse(n.to)===i?n.to:new Date(i).toISOString(),window_from:new Date(t.from_ms).toISOString(),window_to:new Date(t.to_ms).toISOString(),dimensions:n.dimensions,trace_id:n.trace_id,namespace:n.namespace,bucket:n.bucket}))}function QN(e){let t=new URLSearchParams;for(let[n,r]of Object.entries(e))for(let e of Array.isArray(r)?r:[r]){if(e===void 0)continue;let r=typeof e==`string`&&/^[{"]/.test(e);t.append(n,r||typeof e==`object`&&e?JSON.stringify(e):String(e))}let n=t.toString();return n?`?${n}`:``}function $N(e){let t=Object.create(null),n=e=>{if(e.startsWith(`{`)||e.startsWith(`"`))try{let t=JSON.parse(e);if(typeof t==`string`)return/^[{"]/.test(t)?t:e;if(typeof t==`object`&&t&&!Array.isArray(t))return t}catch{}return e},r=new URLSearchParams(e);for(let e of new Set(r.keys())){let i=r.getAll(e).map(n);t[e]=i.length===1?i[0]:i}return t}var eP=[`5m`,`15m`,`1h`,`3h`,`6h`,`12h`,`24h`,`2d`,`7d`,`30d`],tP=[`off`,`10s`,`30s`,`1m`,`5m`],nP=e=>{if(typeof e!=`string`||!/^\d{4}-\d{2}-\d{2}[Tt](?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:[Zz]|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/.test(e)||Number.isNaN(Date.parse(e)))return!1;let[t,n,r]=e.slice(0,10).split(`-`).map(Number),i=new Date(0);return i.setUTCFullYear(t,n-1,r),i.setUTCHours(0,0,0,0),i.getUTCFullYear()===t&&i.getUTCMonth()===n-1&&i.getUTCDate()===r},rP=e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`?String(e):void 0;function iP(e){let t={};typeof e.range==`string`&&eP.includes(e.range)?t.range=e.range:nP(e.from)&&nP(e.to)&&Date.parse(e.from)typeof e==`string`)&&(i[e]=t)}}else{let t=rP(n);t!==void 0&&(i[e]=t)}}}Object.keys(i).length>0&&(t.vars=i);let a=XN(e.drill);return a&&(t.drill=JSON.stringify(a)),t}function aP(e){let t={};e.drill&&(t.drill=JSON.parse(e.drill)),e.range&&(t.range=e.range),e.from&&e.to&&(t.from=e.from,t.to=e.to),e.compare&&(t.compare=e.compare),e.view&&(t.view=e.view),e.edit&&(t.edit=e.edit);for(let[n,r]of Object.entries(e.vars??{}))t[`var-${n}`]=Array.isArray(r)?{values:r}:r;return t}function oP(e,t){let n=new URL(e);return n.search=QN(aP({...iP($N(n.search)),drill:JSON.stringify(t)})),n.href}function sP(e,t){let n=e.time.refresh??`30s`;return t.from&&t.to?{from:t.from,to:t.to,refresh:n}:t.range?{range:t.range,refresh:n}:{...e.time,refresh:n}}var cP=On(`/dashboards/`)({component:kn(()=>it(()=>import(`./dashboards.index-BgQqFg8m.js`),__vite__mapDeps([12,1,2,13,4,9,5,10,6])),`component`),validateSearch:e=>aP(iP(e))}),lP=On(`/dashboards/$dashboardId`)({component:kn(()=>it(()=>import(`./dashboards._dashboardId-BQWwl4ep.js`),__vite__mapDeps([14,1,2,13,4,9,5,10,6])),`component`),validateSearch:e=>aP(iP(e))}),uP=KN.update({id:`/`,path:`/`,getParentRoute:()=>GN}),dP=qN.update({id:`/settings`,path:`/settings`,getParentRoute:()=>GN}),fP=JN.update({id:`/chat/`,path:`/chat/`,getParentRoute:()=>GN}),pP=YN.update({id:`/chat/$threadId`,path:`/chat/$threadId`,getParentRoute:()=>GN}),mP=cP.update({id:`/dashboards/`,path:`/dashboards/`,getParentRoute:()=>GN}),hP={IndexRoute:uP,SettingsRoute:dP,ChatThreadIdRoute:pP,DashboardsDashboardIdRoute:lP.update({id:`/dashboards/$dashboardId`,path:`/dashboards/$dashboardId`,getParentRoute:()=>GN}),ChatIndexRoute:fP,DashboardsIndexRoute:mP},gP=Gn({routeTree:GN._addFileChildren(hP)._addFileTypes(),parseSearch:$N,stringifySearch:QN,defaultPreload:`intent`,scrollRestoration:!0}),_P=[`#fafafa`,`#e6e4de`,`#bfbdb6`,`#8b8e99`,`#565b69`,`#1d2433`,`#131721`,`#0b0e14`,`#080a10`,`#05070b`],vP=[`#f3ecfd`,`#ece3fb`,`#dcc9f7`,`#d2a6ff`,`#bf94ec`,`#a97ce0`,`#9163d6`,`#7c4dcc`,`#5b32a3`,`#40236f`],yP=[`#eefbe6`,`#dcf7cc`,`#c2f0a6`,`#a5e880`,`#8fe06c`,`#7fd962`,`#66c04b`,`#4f9c3a`,`#3b7a2c`,`#2a5a1f`],bP=[`#fff5e6`,`#ffe9c9`,`#ffd79b`,`#ffc571`,`#ffbc62`,`#ffb454`,`#ef9c33`,`#c87d21`,`#9c5f16`,`#74460f`],xP=[`#fdecee`,`#fbd9dc`,`#f8b6bc`,`#f59099`,`#f37d87`,`#f26d78`,`#e04d5a`,`#c03642`,`#96262f`,`#6f1a21`],SP=[`#e8f6ff`,`#ccebff`,`#a3daff`,`#7dcbff`,`#66c5ff`,`#59c2ff`,`#33a7e6`,`#1e86bd`,`#146694`,`#0d4a6d`],CP={dark:{text:`#bfbdb6`,muted:`#8b8e99`,grid:`#1d2433`,surface:`#131721`,border:`#626777`},light:{text:`#4a5058`,muted:`#6b7280`,grid:`#eceef0`,surface:`#fcfcfc`,border:`#8c939d`}},wP={dark:[`#3987e5`,`#d95926`,`#199e70`,`#9085e9`,`#c98500`,`#d55181`],light:[`#2a78d6`,`#eb6834`,`#1baf7a`,`#4a3aa7`,`#eda100`,`#e87ba4`]},TP={micro:11,small:12,body:14,title:16,section:22,page:32},EP={display:`"Geist Mono Variable", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace`,body:`"Geist Variable", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif`},DP={brand:vP,ok:yP,warn:bP,bad:xP,info:SP},OP={light:7,dark:5};function kP(e){let t=e.replace(`#`,``),n=t.length===3?[...t].map(e=>e+e).join(``):t,r=e=>{let t=parseInt(n.slice(e,e+2),16)/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4};return .2126*r(0)+.7152*r(2)+.0722*r(4)}function AP(e){let t=kP(e),n=1.05/(t+.05);return(t+.05)/.05>n?`var(--mantine-color-black)`:`var(--mantine-color-white)`}function jP(e){return Object.fromEntries(Object.entries(DP).map(([t,n])=>[`--fanout-color-${t}-contrast`,AP(n[OP[e]])]))}function MP(e){return t=>{let n=t.color??FP.primaryColor,r=e({...t,color:n}),i=t.variant===`filled`||t.variant===void 0;return t.autoContrast===!1||!i||!Object.hasOwn(DP,n)?r:{...r,color:`var(--fanout-color-${n}-contrast)`}}}var NP=.25,PP={xs:9,sm:10,md:11,lg:13,xl:16},FP={primaryColor:`brand`,primaryShade:OP,autoContrast:!0,luminanceThreshold:NP,colors:{dark:_P,brand:vP,ok:yP,warn:bP,bad:xP,info:SP},defaultRadius:`md`,fontFamily:EP.body,fontFamilyMonospace:EP.display,headings:{fontFamily:EP.body,fontWeight:`600`},cursorType:`pointer`,components:{Tabs:{styles:(e,t)=>({tab:RP(t.color,`--tabs-text-color`)})},Pagination:{styles:(e,t)=>({control:RP(t.color,`--pagination-active-color`)})},Badge:{vars:(e,t)=>({root:LP(t.size)})},Menu:{defaultProps:{withInitialFocusPlaceholder:!1}},Drawer:{defaultProps:{closeButtonProps:{"aria-label":`Close`}}},Modal:{defaultProps:{closeButtonProps:{"aria-label":`Close`}}}}},IP=()=>({variables:{"--mantine-color-error":`var(--mantine-color-bad-filled)`},light:{"--mantine-color-dimmed":CP.light.muted,...jP(`light`)},dark:jP(`dark`)});function LP(e){let t=PP[e??`md`];return t===void 0||t>=TP.micro?{}:{"--badge-fz":`${TP.micro/16}rem`}}function RP(e,t){return!e||e===FP.primaryColor?{[t]:`var(--fanout-color-${FP.primaryColor}-contrast)`}:{}}var zP=MP(ee),BP=ni({...FP,variantColorResolver:zP});(0,Qc.createRoot)(document.getElementById(`root`)).render((0,P.jsx)(N.StrictMode,{children:(0,P.jsx)(ti,{theme:BP,defaultColorScheme:`auto`,cssVariablesResolver:IP,children:(0,P.jsx)(Jn,{router:gP})})}));export{Wy as $,CN as A,Wc as At,RM as B,Ti as Bt,pN as C,Qy as Ct,bN as D,h_ as Dt,kN as E,y_ as Et,DN as F,ps as Ft,jj as G,Tr as Gt,CM as H,ii as Ht,xN as I,ss as It,zA as J,Zn as Jt,sj as K,sr as Kt,nN as L,I as Lt,ON as M,xc as Mt,wN as N,Is as Nt,_N as O,m_ as Ot,SN as P,Ns as Pt,TA as Q,JM as R,oo as Rt,jN as S,Tb as St,TN as T,xy as Tt,_M as U,Hr as Ut,FM as V,mi as Vt,Jj as W,Fr as Wt,UA as X,an as Xt,jA as Y,hn as Yt,$A as Z,cn as Zt,eP as _,Kb as _t,CP as a,G as at,ZN as b,U as bt,yP as c,Fb as ct,bP as d,dx as dt,Uy as et,lP as f,q as ft,iP as g,jb as gt,sP as h,hb as ht,vP as i,bb as it,EN as j,Lc as jt,yN as k,tp as kt,wP as l,Jy as lt,oP as m,Db as mt,kP as n,Vb as nt,EP as o,kb as ot,cP as p,K as pt,rj as q,nr as qt,xP as r,Sb as rt,SP as s,vb as st,AP as t,mb as tt,TP as u,Lb as ut,tP as v,gx as vt,vN as w,Dy as wt,XN as x,Nb as xt,aP as y,zb as yt,UM as z,Ni as zt}; \ No newline at end of file +`)};function $O(e,t){return al(t)&&ek(`[ag-ui][legacy] The result of tool call '${e}' carries content parts the legacy protocol cannot represent; only its text parts are bridged and the rest is dropped.`),il(t)}var ek=e=>{typeof process<`u`&&{}.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(e)},tk=(e,t,n)=>r=>{let i={},a=!0,o=!0,s=``,c=null,l=null,u=[],d={},f=!1,p=e=>{typeof e==`object`&&e&&(`messages`in e&&delete e.messages,i=e)};return r.pipe(Ed(r=>{switch(r.type){case L.TEXT_MESSAGE_START:{let e=r;return[{type:ZO.TextMessageStart,messageId:e.messageId,role:e.role}]}case L.TEXT_MESSAGE_CONTENT:{let e=r;return[{type:ZO.TextMessageContent,messageId:e.messageId,content:e.delta}]}case L.TEXT_MESSAGE_END:{let e=r;return[{type:ZO.TextMessageEnd,messageId:e.messageId}]}case L.TOOL_CALL_START:{let e=r;return u.push({id:e.toolCallId,type:`function`,function:{name:e.toolCallName,arguments:``}}),o=!0,d[e.toolCallId]=e.toolCallName,[{type:ZO.ActionExecutionStart,actionExecutionId:e.toolCallId,actionName:e.toolCallName,parentMessageId:e.parentMessageId}]}case L.TOOL_CALL_ARGS:{let c=r,d=u.find(e=>e.id===c.toolCallId);if(!d)return ek(`[ag-ui][legacy] TOOL_CALL_ARGS: No tool call found with ID '${c.toolCallId}'`),[];d.function.arguments+=c.delta;let f=!1;if(l){let e=l.find(e=>e.tool==d.function.name);if(e)try{let t=JSON.parse(Vd(d.function.arguments));e.tool_argument&&e.tool_argument in t?(p({...i,[e.state_key]:t[e.tool_argument]}),f=!0):e.tool_argument||(p({...i,[e.state_key]:t}),f=!0)}catch{}}return[{type:ZO.ActionExecutionArgs,actionExecutionId:c.toolCallId,args:c.delta},...f?[{type:ZO.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}]:[]]}case L.TOOL_CALL_END:{let e=r;return[{type:ZO.ActionExecutionEnd,actionExecutionId:e.toolCallId}]}case L.TOOL_CALL_RESULT:{let e=r,t=d[e.toolCallId];return(t===void 0||t===``)&&ek(`[ag-ui][legacy] No usable tool name was seen for tool call '${e.toolCallId}' (${t===void 0?`no TOOL_CALL_START reached this bridge`:`its TOOL_CALL_START carried an empty toolCallName`}), so its result is being bridged with the fabricated action name "unknown". Downstream consumers route on that name.`),[{type:ZO.ActionExecutionResult,actionExecutionId:e.toolCallId,result:$O(e.toolCallId,e.content),actionName:t||`unknown`}]}case L.RAW:return f||(f=!0,ek(`[ag-ui][legacy] Dropping RAW events: the legacy runtime protocol has no equivalent, so the provider payloads they carry do not reach the legacy stream. Reported once per stream.`)),[];case L.CUSTOM:{let e=r;switch(e.name){case`Exit`:a=!1;break;case`PredictState`:l=e.value}return[{type:ZO.MetaEvent,name:e.name,value:e.value}]}case L.STATE_SNAPSHOT:return p(r.snapshot),[{type:ZO.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}];case L.STATE_DELTA:{let c=r,l;try{l=Vl.applyPatch(i,c.delta,!0,!1).newDocument}catch(e){let t=e instanceof Error?e.message:String(e);return ek(`[ag-ui][legacy] Failed to apply state patch:\nCurrent state: ${JSON.stringify(i,null,2)}\nPatch operations: ${JSON.stringify(c.delta,null,2)}\nError: ${t}`),[]}return p(l),[{type:ZO.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:o}]}case L.MESSAGES_SNAPSHOT:return c=r.messages,[{type:ZO.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify({...i,...c?{messages:c}:{}}),active:!0}];case L.RUN_STARTED:return[];case L.RUN_FINISHED:{if(c&&(i.messages=c),Object.keys(i).length===0)return[];let r=null;if(c)try{r=nk(c)}catch(e){return[{type:ZO.RunError,message:e.message}]}return[{type:ZO.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify({...i,...r?{messages:r}:{}}),active:!1}]}case L.RUN_ERROR:{let e=r;return[{type:ZO.RunError,message:e.message,code:e.code}]}case L.STEP_STARTED:return s=r.stepName,u=[],l=null,[{type:ZO.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:!0}];case L.STEP_FINISHED:return u=[],l=null,[{type:ZO.AgentStateMessage,threadId:e,agentName:n,nodeName:s,runId:t,running:a,role:`assistant`,state:JSON.stringify(i),active:!1}];default:return[]}}))};function nk(e){let t=[];for(let n of e)if(n.role===`assistant`||n.role===`user`||n.role===`system`){let e=QO(n.content);if(e){let r={id:n.id,role:n.role,content:e};t.push(r)}if(n.role===`assistant`&&n.toolCalls&&n.toolCalls.length>0)for(let e of n.toolCalls){let r;try{r=JSON.parse(e.function.arguments)}catch(t){throw Error(`Failed to parse arguments for tool call '${e.id}' (${e.function.name}): ${t.message}`)}let i={id:e.id,name:e.function.name,arguments:r,parentMessageId:n.id};t.push(i)}}else if(n.role===`tool`){let r=`unknown`;for(let t of e)if(t.role===`assistant`&&t.toolCalls?.length){for(let e of t.toolCalls)if(e.id===n.toolCallId){r=e.function.name;break}}let i={id:n.id,result:$O(n.toolCallId,n.content),actionExecutionId:n.toolCallId,actionName:r};t.push(i)}return t}var rk=e=>e.kind===`tool`?e.fields.toolCallId:e.fields.messageId,ik=e=>e===`tool`?`toolCallId`:`messageId`,ak=(e,t,n,r,i)=>{if(r!==void 0&&r!==i)throw Error(`Cannot continue ${e} '${t}': chunk ${n} '${r}' does not match the open stream's ${n} ${i===void 0?`(absent)`:`'${i}'`}.`)},ok=(e,t)=>t.metadata===void 0?e:{...e,metadata:t.metadata},sk=(e,t)=>{let n=ok(e,t);return t.rawEvent===void 0?n:{...n,rawEvent:t.rawEvent}},ck=e=>new Set(Object.keys(e.shape)),lk=ck(Cx),uk=ck(Dx),dk=ck(uS),fk=(e,t)=>{let n;for(let r of Object.keys(e))t.has(r)||((n??={})[r]=e[r]);return n},pk=e=>{typeof process<`u`&&{}.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`[ag-ui][transform] ${e} Set SUPPRESS_TRANSFORMATION_WARNINGS=true to silence.`)},mk=(e,t,n,r)=>{if(t===void 0||n||e.length===0)return;let i=e[e.length-1],a=Object.keys(t).filter(e=>Object.prototype.hasOwnProperty.call(i,e));a.length>0&&pk(`A ${r} carried ${a.map(e=>`'${e}'`).join(`, `)}, which the synthesized ${String(i.type)} already describes. The synthesized value is kept and the chunk's is dropped — this stage does not judge a described field, so the producer's value cannot be substituted for its own.`),e[e.length-1]={...t,...i}},hk=e=>t=>{let n=FO(e),r=new Map,i=e=>{let t=r.get(e);if(!t)return[];switch(r.delete(e),t.kind){case`text`:{let e={type:L.TEXT_MESSAGE_END,messageId:t.fields.messageId,...t.fields.subagentRunId!==void 0&&{subagentRunId:t.fields.subagentRunId}};return n?.event(`TRANSFORM`,`TEXT_MESSAGE_END`,e,{messageId:e.messageId}),[e]}case`tool`:{let e={type:L.TOOL_CALL_END,toolCallId:t.fields.toolCallId,...t.fields.subagentRunId!==void 0&&{subagentRunId:t.fields.subagentRunId}};return n?.event(`TRANSFORM`,`TOOL_CALL_END`,e,{toolCallId:e.toolCallId}),[e]}case`reasoning`:{let e={type:L.REASONING_MESSAGE_END,messageId:t.fields.messageId,...t.fields.subagentRunId!==void 0&&{subagentRunId:t.fields.subagentRunId}};return n?.event(`TRANSFORM`,`REASONING_MESSAGE_END`,e,{messageId:e.messageId}),[e]}}},a=()=>[...r.keys()].flatMap(e=>i(e)),o=(e,t)=>{for(let[n,i]of r)if(i.kind===e&&rk(i)===t)return{owner:n}},s=(e,t,n,i,a)=>{if(t!==void 0){let r=o(e,t);if(r){if(n!==void 0&&n!==r.owner)throw Error(`Cannot continue ${a} '${t}': chunk subagentRunId '${n}' does not match the open stream's subagent '${r.owner??`(the parent agent)`}'.`);return r.owner}return n}if(n!==void 0)return n;if(r.get(void 0)?.kind===e)return;let s=[...r.entries()].filter(([,t])=>t.kind===e);if(s.length===1)return s[0][0];if(s.length>1)throw Error(`Ambiguous ${i}: it carries neither a ${ik(e)} nor a subagentRunId, but ${s.length} lanes have an open ${a}. Attribute the chunk to the subagent it belongs to.`)};return t.pipe(Ed(e=>{switch(e.type){case L.TEXT_MESSAGE_START:case L.TEXT_MESSAGE_CONTENT:case L.TEXT_MESSAGE_END:case L.TOOL_CALL_START:case L.TOOL_CALL_ARGS:case L.TOOL_CALL_END:case L.TOOL_CALL_RESULT:case L.STATE_SNAPSHOT:case L.STATE_DELTA:case L.CUSTOM:case L.STEP_STARTED:case L.STEP_FINISHED:case L.REASONING_START:case L.REASONING_MESSAGE_START:case L.REASONING_MESSAGE_CONTENT:case L.REASONING_MESSAGE_END:case L.REASONING_END:return[...i(e.subagentRunId??void 0),e];case L.RUN_STARTED:case L.RUN_FINISHED:case L.RUN_ERROR:case L.MESSAGES_SNAPSHOT:return[...a(),e];case L.RAW:case L.ACTIVITY_SNAPSHOT:case L.ACTIVITY_DELTA:case L.REASONING_ENCRYPTED_VALUE:case L.SUBAGENT_STARTED:return[e];case L.SUBAGENT_FINISHED:case L.SUBAGENT_ERROR:{let t=e.subagentRunId;return t==null?[e]:[...i(t),e]}case L.TEXT_MESSAGE_CHUNK:{let t=e,a=fk(e,lk),o=s(`text`,t.messageId,t.subagentRunId??void 0,`TEXT_MESSAGE_CHUNK`,`text message`),c=r.get(o),l=[],u=!1,d;if(c?.kind===`text`&&(t.messageId===void 0||t.messageId===c.fields.messageId))ak(`text message`,c.fields.messageId,`role`,t.role,c.fields.role),ak(`text message`,c.fields.messageId,`name`,t.name,c.fields.name),d=c.fields;else{if(l.push(...i(o)),t.messageId===void 0)throw Error(`First TEXT_MESSAGE_CHUNK must have a messageId`);d={messageId:t.messageId,role:t.role===void 0?`assistant`:t.role,name:t.name,subagentRunId:t.subagentRunId},r.set(o,{kind:`text`,fields:d});let e=ok({type:L.TEXT_MESSAGE_START,messageId:t.messageId,role:d.role,...t.name!==void 0&&{name:t.name},...t.subagentRunId!==void 0&&{subagentRunId:t.subagentRunId}},t);l.push(e),n?.event(`TRANSFORM`,`TEXT_MESSAGE_START`,e,{messageId:t.messageId})}if(t.delta!==void 0||t.rawEvent!==void 0){let e=t.subagentRunId===void 0?d.subagentRunId:t.subagentRunId,r=sk({...a,type:L.TEXT_MESSAGE_CONTENT,messageId:d.messageId,delta:t.delta===void 0?``:t.delta,...e!==void 0&&{subagentRunId:e}},t);l.push(r),u=!0,n?.event(`TRANSFORM`,`TEXT_MESSAGE_CONTENT`,r,{messageId:d.messageId})}if(l.length===0&&(t.metadata!==void 0||t.rawEvent!==void 0||t.subagentRunId===null||a!==void 0)){let e=t.subagentRunId===void 0?d.subagentRunId:t.subagentRunId;l.push({...a,type:L.TEXT_MESSAGE_CONTENT,messageId:d.messageId,delta:``,...t.metadata!==void 0&&{metadata:t.metadata},...t.rawEvent!==void 0&&{rawEvent:t.rawEvent},...e!==void 0&&{subagentRunId:e}}),u=!0}return mk(l,a,u,`TEXT_MESSAGE_CHUNK`),l}case L.TOOL_CALL_CHUNK:{let t=e,a=fk(e,uk),o=s(`tool`,t.toolCallId,t.subagentRunId??void 0,`TOOL_CALL_CHUNK`,`tool call`),c=r.get(o),l=[],u=!1,d;if(c?.kind===`tool`&&(t.toolCallId===void 0||t.toolCallId===c.fields.toolCallId))ak(`tool call`,c.fields.toolCallId,`toolCallName`,t.toolCallName,c.fields.toolCallName),ak(`tool call`,c.fields.toolCallId,`parentMessageId`,t.parentMessageId,c.fields.parentMessageId),d=c.fields;else{if(l.push(...i(o)),t.toolCallId===void 0)throw Error(`First TOOL_CALL_CHUNK must have a toolCallId`);if(t.toolCallName===void 0)throw Error(`First TOOL_CALL_CHUNK must have a toolCallName`);d={toolCallId:t.toolCallId,toolCallName:t.toolCallName,parentMessageId:t.parentMessageId,subagentRunId:t.subagentRunId},r.set(o,{kind:`tool`,fields:d});let e=ok({type:L.TOOL_CALL_START,toolCallId:t.toolCallId,toolCallName:t.toolCallName,...t.parentMessageId!==void 0&&{parentMessageId:t.parentMessageId},...t.subagentRunId!==void 0&&{subagentRunId:t.subagentRunId}},t);l.push(e),n?.event(`TRANSFORM`,`TOOL_CALL_START`,e,{toolCallId:t.toolCallId,toolCallName:t.toolCallName})}if(t.delta!==void 0||t.rawEvent!==void 0){let e=t.subagentRunId===void 0?d.subagentRunId:t.subagentRunId,r=sk({...a,type:L.TOOL_CALL_ARGS,toolCallId:d.toolCallId,delta:t.delta===void 0?``:t.delta,...e!==void 0&&{subagentRunId:e}},t);l.push(r),u=!0,n?.event(`TRANSFORM`,`TOOL_CALL_ARGS`,r,{toolCallId:d.toolCallId})}if(l.length===0&&(t.metadata!==void 0||t.rawEvent!==void 0||t.subagentRunId===null||a!==void 0)){let e=t.subagentRunId===void 0?d.subagentRunId:t.subagentRunId;l.push({...a,type:L.TOOL_CALL_ARGS,toolCallId:d.toolCallId,delta:``,...t.metadata!==void 0&&{metadata:t.metadata},...t.rawEvent!==void 0&&{rawEvent:t.rawEvent},...e!==void 0&&{subagentRunId:e}}),u=!0}return mk(l,a,u,`TOOL_CALL_CHUNK`),l}case L.REASONING_MESSAGE_CHUNK:{let t=e,a=fk(e,dk),o=s(`reasoning`,t.messageId,t.subagentRunId??void 0,`REASONING_MESSAGE_CHUNK`,`reasoning message`),c=r.get(o),l=[],u=!1,d;if(c?.kind===`reasoning`&&(t.messageId===void 0||t.messageId===c.fields.messageId))d=c.fields;else{if(l.push(...i(o)),t.messageId===void 0)throw Error(`First REASONING_MESSAGE_CHUNK must have a messageId`);d={messageId:t.messageId,subagentRunId:t.subagentRunId},r.set(o,{kind:`reasoning`,fields:d});let e=ok({type:L.REASONING_MESSAGE_START,messageId:t.messageId,role:`reasoning`,...t.subagentRunId!==void 0&&{subagentRunId:t.subagentRunId}},t);l.push(e),n?.event(`TRANSFORM`,`REASONING_MESSAGE_START`,e,{messageId:t.messageId})}if(t.delta!==void 0||t.rawEvent!==void 0){let e=t.subagentRunId===void 0?d.subagentRunId:t.subagentRunId,r=sk({...a,type:L.REASONING_MESSAGE_CONTENT,messageId:d.messageId,delta:t.delta===void 0?``:t.delta,...e!==void 0&&{subagentRunId:e}},t);l.push(r),u=!0,n?.event(`TRANSFORM`,`REASONING_MESSAGE_CONTENT`,r,{messageId:d.messageId})}if(l.length===0&&(t.metadata!==void 0||t.rawEvent!==void 0||t.subagentRunId===null||a!==void 0)){let e=t.subagentRunId===void 0?d.subagentRunId:t.subagentRunId;l.push({...a,type:L.REASONING_MESSAGE_CONTENT,messageId:d.messageId,delta:``,...t.metadata!==void 0&&{metadata:t.metadata},...t.rawEvent!==void 0&&{rawEvent:t.rawEvent},...e!==void 0&&{subagentRunId:e}}),u=!0}return mk(l,a,u,`REASONING_MESSAGE_CHUNK`),l}}return e.type,[e]}),Id(()=>{a()}))},gk=Symbol(`agui.strip.drop`);function _k(e){let t=e;for(;;){if(t instanceof iO||t instanceof oO||t instanceof cO||t instanceof vO||t instanceof mO){t=t.unwrap();continue}if(t instanceof gO){t=t.def.in;continue}if(t instanceof bO){t=t.def.getter();continue}return t}}function vk(e){let t=e.def;return typeof t?.discriminator==`string`?t.discriminator:void 0}function yk(e){let t=e,n=Array.isArray(t.def?.values)?t.def.values:t.values?Array.from(t.values):void 0;return n&&n.length===1?n[0]:t.value}function bk(e){let t=_k(e);return t instanceof tO?yk(t):void 0}function xk(e,t,n,r){let i=_k(t);if(i instanceof qD){if(typeof e!=`object`||!e||Array.isArray(e))return e;let t=i.shape,a=e,o={},s=i.meta()?.specOpen===!0;for(let e of Object.keys(a)){let i=Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0;if(i===void 0){if(s){o[e]=a[e];continue}r.push(`${n}/${e}`);continue}let c=r.length,l=xk(a[e],i,`${n}/${e}`,r);if(l===gk){if(r.length=c,i.safeParse(void 0).success){r.push(`${n}/${e}`);continue}return gk}o[e]=l}return o}if(i instanceof GD){if(!Array.isArray(e))return e;let t=i.element,a=[];return e.forEach((e,i)=>{let o=r.length,s=xk(e,t,`${n}/${i}`,r);if(s===gk){r.length=o,r.push(`${n}/${i}`);return}a.push(s)}),a}if(i instanceof QD){if(typeof e!=`object`||!e||Array.isArray(e))return e;let t=i.def.valueType,a=e,o={};for(let e of Object.keys(a)){let i=r.length,s=xk(a[e],t,`${n}/${e}`,r);if(s===gk){r.length=i,r.push(`${n}/${e}`);continue}o[e]=s}return o}if(i instanceof JD){let t=i.options,a=vk(i);if(a!==void 0){if(typeof e!=`object`||!e||Array.isArray(e))return e;let i=e[a];for(let o of t){let t=_k(o);if(!(t instanceof qD))continue;let s=t.shape;if(bk(s[a])===i)return xk(e,o,n,r)}return gk}let o=t.filter(e=>_k(e)instanceof qD),s=typeof e==`object`&&!!e&&!Array.isArray(e);if(o.length>1&&s)return e;for(let i of t){let t=_k(i);if(t instanceof GD&&Array.isArray(e)||t instanceof qD&&s)return xk(e,i,n,r)}return e}return e}function Sk(e,t){let n=[],r=xk(e,t,``,n);if(r===gk)throw Error(`Internal error: the stripper found the whole value unrecognisable, which the schemas are not supposed to allow — schema/stripper mismatch.`);return{value:r,stripped:n}}var Ck=new Set(Object.values(L));function wk(e){return Ck.has(e.type)}var Tk=new Map(gS.options.map(e=>{let t=e.shape;return[String(yk(t.type)),e]})),Ek=()=>typeof process<`u`&&!!{}.SUPPRESS_TRANSFORMATION_WARNINGS;function Dk(e){Ek()||console.warn(`[ag-ui][enforce] ${e}`)}var Ok=e=>t=>{let n=FO(e);return t.pipe(Ed(e=>{if(!wk(e))return Dk(`Dropping unrecognised event '${String(e.type)}': no middleware translated it and the protocol does not describe it.`),n?.event(`ENFORCE`,`Unrecognised event dropped:`,e,{type:e.type}),Uu;let t=Tk.get(e.type);if(t===void 0)throw Error(`No validator for recognised event type '${String(e.type)}'`);let{value:r,stripped:i}=Sk(e,t);for(let t of i)Dk(`Removed unrecognised material at '${t}' on ${String(e.type)}. Nothing handled it; see the repo-root DEPRECATIONS.md if it is a retired shape.`);return xd(t.parse(r))}))};function kk(e){let{value:t,stripped:n}=Sk(tl(e,`RunAgentInput`),Xx);for(let e of n)Dk(`Removed unrecognised material at '${e}' from the outgoing input.`);return Xx.parse(t)}var Ak=class{runNext(e,t){return t.run(e).pipe(hk(!1))}runNextWithState(e,t){let n=DO(e.messages||[]),r=DO(e.state===void 0?{}:e.state),i=new Hu;return BO(e,i,t,[]).subscribe({next:e=>{e.messages!==void 0&&(n=e.messages),e.state!==void 0&&(r=e.state)},error:()=>{}}),this.runNext(e,t).pipe(Md(async e=>(i.next(e),await new Promise(e=>setTimeout(e,0)),{event:e,messages:DO(n),state:DO(r)})))}},jk=class extends Ak{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function Mk(e){return e.startsWith(`image/`)?`image`:e.startsWith(`audio/`)?`audio`:e.startsWith(`video/`)?`video`:`document`}function Nk(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`binary`&&`mimeType`in e&&typeof e.mimeType==`string`}function Pk(e){let t=Mk(e.mimeType);return e.data?{type:t,source:{type:`data`,value:e.data,mimeType:e.mimeType},...e.filename?{metadata:{filename:e.filename}}:{}}:e.url?{type:t,source:{type:`url`,value:e.url,mimeType:e.mimeType},...e.filename?{metadata:{filename:e.filename}}:{}}:((typeof process>`u`||!{}.SUPPRESS_TRANSFORMATION_WARNINGS)&&console.warn(`[ag-ui][compat] A binary content part carries only an id ('${e.id??``}') and cannot be converted to a modern media part; a 1.0 peer will not accept it. Provide data or a url. See the repo-root DEPRECATIONS.md.`),e)}function Fk(e,t,n){if(typeof e!=`object`||!e||!(`type`in e)||e.type!==t.type||!(`source`in e))return!1;let r=e.source;return typeof r!=`object`||!r||!(`type`in r)||r.type!==t.source.type||!(`value`in r)||r.value!==t.source.value||!(`mimeType`in r)||r.mimeType!==t.source.mimeType?!1:!n||`metadata`in e&&typeof e.metadata==`object`&&e.metadata!==null&&`filename`in e.metadata&&e.metadata.filename===n}function Ik(e){let t=e.content;if(!Array.isArray(t))return e;let n=t.flatMap(e=>{if(Nk(e)){let n=Pk(e);return n.type!==`binary`&&t.some(t=>Fk(t,n,e.filename))?[]:[n]}return[e]});return{...e,content:n}}var Lk=`THINKING_START`,Rk=`THINKING_END`,zk=`THINKING_TEXT_MESSAGE_START`,Bk=`THINKING_TEXT_MESSAGE_CONTENT`,Vk=`THINKING_TEXT_MESSAGE_END`;function Hk(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Uk={event:[`rawEvent`,`subagentRunId`],[L.RUN_STARTED]:[`parentRunId`,`input`],[L.RUN_FINISHED]:[`result`,`outcome`],[L.RUN_ERROR]:[`usage`],[L.SUBAGENT_FINISHED]:[`result`],[L.TOOL_CALL_START]:[`parentMessageId`],[L.TOOL_CALL_CHUNK]:[`parentMessageId`],[L.TOOL_CALL_RESULT]:[`role`],"RUN_FINISHED.outcome":[`pendingToolCallIds`],"RUN_FINISHED.usage[]":[`provider`,`reasoningTokens`,`cachedInputTokens`,`cacheWriteInputTokens`],RunAgentInput:[`forwardedProps`],Tool:[`parameters`],ResumeEntry:[`payload`],"input content":[`metadata`]},Wk=new Map(Object.entries(Uk).filter(([e])=>Object.values(L).includes(e))),Gk=e=>VO(e,`an absent field`);function Kk(e,t,n,r){if(!Hk(e))return e;let i;for(let a of t)e[a]===null&&(r(n===void 0?`${a}: null`:`${n}.${a}: null`),i??={...e},delete i[a]);return i??e}function qk(e,t,n){if(!Hk(e)||!Array.isArray(e[t]))return e;let r=e[t],i=r.map(n);return i.some((e,t)=>e!==r[t])?{...e,[t]:i}:e}function Jk(e,t){return qk(e,`content`,e=>{if(!Hk(e))return e;switch(e.type){case`image`:case`audio`:case`video`:case`document`:return Kk(e,Uk[`input content`],`${e.type} input content`,t);default:return e}})}function Yk(e,t=Gk){let n=Kk(e,Uk.RunAgentInput,`RunAgentInput`,t);return n=qk(n,`tools`,e=>Kk(e,Uk.Tool,`Tool`,t)),n=qk(n,`resume`,e=>Kk(e,Uk.ResumeEntry,`ResumeEntry`,t)),qk(n,`messages`,e=>Jk(e,t))}var Xk=class extends Ak{constructor(...e){super(...e),this.currentReasoningId=null,this.currentMessageId=null,this.nullsNoticedThisRun=new Set,this.noticeNullOncePerRun=e=>{this.nullsNoticedThisRun.has(e)||(this.nullsNoticedThisRun.add(e),VO(e,`an absent field`))}}warn(e,t){VO(e,t)}mintedContinuationId(e,t){if(t!==null)return t;let n=OO();return this.warnAside(`Minting a messageId ('${n}') for ${e}: no THINKING opener preceded it, so there was no id to continue. The id is this client's invention, not the producer's, and verification will reject the translated event for naming something nothing opened.`),n}warnAside(e){typeof process<`u`&&{}.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`[ag-ui][compat] ${e} Set SUPPRESS_TRANSFORMATION_WARNINGS=true to silence.`)}run(e,t){return this.currentReasoningId=null,this.currentMessageId=null,this.nullsNoticedThisRun.clear(),e.messages=e.messages.map(Ik),t.run(e).pipe(wd(e=>this.transformEvent(e)))}transformEvent(e){let t=this.noticeNullOncePerRun;e.type===L.RUN_STARTED&&this.nullsNoticedThisRun.clear(),e=Kk(e,Uk.event,void 0,t);let n=Wk.get(e.type);switch(n&&(e=Kk(e,n,e.type,t)),e.type){case Lk:{this.currentReasoningId=OO();let{title:t,...n}=e;return this.warn(Lk,L.REASONING_START),t!==void 0&&this.warnAside(`Dropping ${Lk}.title ${JSON.stringify(t)}: ${L.REASONING_START} has no title field, so the span's label cannot be carried and nothing downstream can recover it.`),{...n,type:L.REASONING_START,messageId:this.currentReasoningId}}case zk:return this.currentMessageId=OO(),this.warn(zk,L.REASONING_MESSAGE_START),{...e,type:L.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:`reasoning`};case Bk:{let{delta:t,...n}=e;return this.warn(Bk,L.REASONING_MESSAGE_CONTENT),{...n,type:L.REASONING_MESSAGE_CONTENT,messageId:this.mintedContinuationId(Bk,this.currentMessageId),delta:t}}case Vk:{let t=this.mintedContinuationId(Vk,this.currentMessageId);return this.currentMessageId=null,this.warn(Vk,L.REASONING_MESSAGE_END),{...e,type:L.REASONING_MESSAGE_END,messageId:t}}case Rk:{let t=this.mintedContinuationId(Rk,this.currentReasoningId);return this.currentReasoningId=null,this.warn(Rk,L.REASONING_END),{...e,type:L.REASONING_END,messageId:t}}case L.RUN_FINISHED:{let n=e,r=Kk(n.outcome,Uk[`RUN_FINISHED.outcome`],`RUN_FINISHED.outcome`,t);return qk(r===n.outcome?n:{...n,outcome:r},`usage`,e=>Kk(e,Uk[`RUN_FINISHED.usage[]`],`RUN_FINISHED.usage[]`,t))}case L.MESSAGES_SNAPSHOT:{let t=e;return Array.isArray(t.messages)?{...t,messages:t.messages.map(e=>this.upgradeInboundMessage(e))}:e}case L.RUN_STARTED:{let n=Yk(e.input,t),r=n===e.input?e:{...e,input:n},i=r;return!i.input||!Array.isArray(i.input.messages)?r:{...i,input:{...i.input,messages:i.input.messages.map(e=>this.upgradeInboundMessage(e))}}}default:return e}}upgradeInboundMessage(e){e=Jk(e,this.noticeNullOncePerRun);let t=e.content;return!Array.isArray(t)||!t.some(e=>typeof e==`object`&&!!e&&e.type===`binary`)?e:(this.warn(`binary input content`,`the modern media content parts`),Ik(e))}},Zk=()=>e=>kd(()=>{let t=new Xk;return e.pipe(wd(e=>t.transformEvent(e)))});function Qk(e,t=new Date){return e.expiresAt!==void 0&&new Date(e.expiresAt)<=t}function $k(){return typeof process<`u`&&!!{}.SUPPRESS_TRANSFORMATION_WARNINGS}function eA(e){$k()||console.warn(`[ag-ui][compat] Flattening message content for a <=0.0.39 peer DROPS non-text parts (${e.join(`, `)}). The peer cannot receive them; upgrade it to keep media content. See the repo-root DEPRECATIONS.md.`)}function tA(e){$k()||console.warn(`[ag-ui][compat] Not flattening message content for a <=0.0.39 peer: ${e} content part(s) claim type "text" but carry a malformed 'text' value. That is a defect in the message, not media the peer cannot represent, and a downgrade must not repair it — the content is passed on unchanged so the outgoing enforcement boundary reports it. See the repo-root DEPRECATIONS.md.`)}function nA(e){let t=e.content;if(Array.isArray(t)){let n=e=>typeof e==`object`&&!!e&&`type`in e&&e.type===`text`,r=e=>n(e)&&typeof e.text==`string`,i=t.filter(e=>n(e)&&!r(e));if(i.length>0)return tA(i.length),e;let a=t.filter(e=>!r(e)).map(e=>typeof e==`object`&&e&&`type`in e?String(e.type):typeof e);a.length>0&&eA(a);let o=t.filter(r).map(e=>e.text).join(``);return{...e,content:o}}return typeof t==`string`?e:t===void 0?{...e,content:``}:e}var rA=class extends Ak{run(e,t){let{parentRunId:n,...r}=e,i={...r,messages:r.messages.map(nA)};return this.runNext(i,t)}},iA=`THINKING_START`,aA=`THINKING_END`,oA=`THINKING_TEXT_MESSAGE_START`,sA=`THINKING_TEXT_MESSAGE_CONTENT`,cA=`THINKING_TEXT_MESSAGE_END`,lA=class extends Ak{constructor(...e){super(...e),this.currentReasoningId=null,this.currentMessageId=null}warnAboutTransformation(e,t){typeof process<`u`&&{}.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`AG-UI is converting ${e} to ${t}. To remove this warning, upgrade your AG-UI integration package (e.g. @ag-ui/langgraph). To surpress it, set SUPPRESS_TRANSFORMATION_WARNINGS=true in your .env file.`)}run(e,t){return this.currentReasoningId=null,this.currentMessageId=null,this.runNext(e,t).pipe(wd(e=>this.transformEvent(e)))}transformEvent(e){switch(e.type){case iA:{this.currentReasoningId=OO();let{title:t,...n}=e;return this.warnAboutTransformation(iA,L.REASONING_START),{...n,type:L.REASONING_START,messageId:this.currentReasoningId}}case oA:return this.currentMessageId=OO(),this.warnAboutTransformation(oA,L.REASONING_MESSAGE_START),{...e,type:L.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:`reasoning`};case sA:{let{delta:t,...n}=e;return this.warnAboutTransformation(sA,L.REASONING_MESSAGE_CONTENT),{...n,type:L.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??OO(),delta:t}}case cA:{let t=this.currentMessageId??OO();return this.warnAboutTransformation(cA,L.REASONING_MESSAGE_END),{...e,type:L.REASONING_MESSAGE_END,messageId:t}}case aA:{let t=this.currentReasoningId??OO();return this.warnAboutTransformation(aA,L.REASONING_END),{...e,type:L.REASONING_END,messageId:t}}default:return e}}},uA=`SUBAGENT_STARTED`,dA=`SUBAGENT_FINISHED`,fA=`SUBAGENT_ERROR`;function pA(e){if(e&&typeof e==`object`&&`subagentRunId`in e){let{subagentRunId:t,...n}=e;return n}return e}function mA(e){return e.map(e=>pA(e))}var hA=class extends Ak{warnDroppedLifecycleEvent(e){typeof process<`u`&&{}.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`AG-UI is dropping ${e} because the target agent predates subagent support. To remove this warning, upgrade your AG-UI integration package. To suppress it, set SUPPRESS_TRANSFORMATION_WARNINGS=true in your .env file.`)}run(e,t){let n={...e,messages:(e.messages??[]).map(e=>pA(e))};return this.runNext(n,t).pipe(zd(e=>{let t=e.type;(t===uA||t===dA||t===fA)&&this.warnDroppedLifecycleEvent(t)}),Ad(e=>{let t=e.type;return t!==uA&&t!==dA&&t!==fA}),wd(e=>{let t=pA(e);if(t.type===L.MESSAGES_SNAPSHOT){let e=t;if(Array.isArray(e.messages))return{...e,messages:mA(e.messages)}}if(t.type===L.RUN_FINISHED){let e=t;if(e.outcome&&Array.isArray(e.outcome.interrupts))return{...e,outcome:{...e.outcome,interrupts:e.outcome.interrupts.map(e=>pA(e))}}}if(t.type===L.RUN_STARTED){let e=t;if(e.input&&Array.isArray(e.input.messages))return{...e,input:{...e.input,messages:mA(e.input.messages)}}}return t}))}},gA=`1.0.2`,_A=!1,vA=new WeakSet,yA=(e,t)=>/^\d+\.\d+$/.test(e)?qT(e,t)>0?`newer`:`not-newer`:`uninterpretable`,bA=e=>{let t=e.protocolVersion;if(t!==void 0&&t!==`1.0`)switch(yA(t,`1.0`)){case`uninterpretable`:console.warn(`[ag-ui] The producer declared protocol version '${t}', which this client cannot interpret.`);return;case`newer`:console.warn(`[ag-ui] The producer speaks protocol ${t}; this client speaks 1.0. Unrecognised material will be stripped with warnings.`);return;case`not-newer`:return}},xA=class e{resolvePeerCeiling(t){if(this.resolvingPeerCeiling)return gA;let n=Object.getOwnPropertyDescriptor(this,`maxVersion`),r=Object.getOwnPropertyDescriptor(this,`maxProtocolVersion`),i=Object.getPrototypeOf(this);for(;i&&i!==e.prototype;)n??=Object.getOwnPropertyDescriptor(i,`maxVersion`),r??=Object.getOwnPropertyDescriptor(i,`maxProtocolVersion`),i=Object.getPrototypeOf(i);if(t===`maxVersion`&&n)return gA;let a=t===`maxProtocolVersion`?n:r;if(!a)return gA;this.resolvingPeerCeiling=!0;try{return a.get?a.get.call(this):a.value}finally{this.resolvingPeerCeiling=!1}}get maxProtocolVersion(){return this.resolvePeerCeiling(`maxProtocolVersion`)}get maxVersion(){return!this.resolvingPeerCeiling&&!_A&&(_A=!0,console.warn(`[ag-ui] AbstractAgent.maxVersion is deprecated — use maxProtocolVersion. Same value; the new name says whose version it is and that it is a ceiling.`)),this.resolvePeerCeiling(`maxVersion`)}get debug(){return this._debug}set debug(e){this._debug=PO(e),this._debugLogger=LO(this._debug)}get debugLogger(){return this._debugLogger}set debugLogger(e){this._debugLogger=typeof e==`boolean`?e?LO(PO(!0)):void 0:e}resolvedCeilingDuringConstruction(){let e=this.maxProtocolVersion;if(typeof e!=`string`||!JT(e))throw new R(`maxProtocolVersion resolved to ${JSON.stringify(e)} during construction, which is not a version this client can compare. A ceiling read from an instance field is not available yet — return a literal from the getter.`);return e}constructor({agentId:e,description:t,threadId:n,initialMessages:r,initialState:i,debug:a}={}){this.subscribers=[],this.isRunning=!1,this.pendingInterrupts=[],this.middlewares=[],this.resolvingPeerCeiling=!1,this.agentId=e,this.description=t??``,this.threadId=n??Zc(),this.messages=DO(r??[]),this.state=DO(i??{}),this._debug=PO(a),this._debugLogger=LO(this._debug);let o=this.resolvedCeilingDuringConstruction();qT(o,`0.0.39`)<=0&&this.middlewares.unshift(new rA),qT(o,`0.0.45`)<=0&&this.middlewares.unshift(new lA),qT(o,`0.0.57`)<=0&&this.middlewares.unshift(new hA)}subscribe(e){return this.subscribers.push(e),{unsubscribe:()=>{this.subscribers=this.subscribers.filter(t=>t!==e)}}}use(...e){let t=e.map(e=>typeof e==`function`?new jk(e):e);return this.middlewares.push(...t),this}async runAgent(e,t){try{this.isRunning=!0,this.agentId=this.agentId??Zc();let n=this.prepareRunAgentInput(e);this.debugLogger?.lifecycle(`LIFECYCLE`,`Run started:`,{agentId:this.agentId,threadId:this.threadId});let r,i=new Set(this.messages.map(e=>e.id)),a=[{onRunStartedEvent:({event:e})=>bA(e),onRunFinishedEvent:e=>{e.outcome===`success`&&(r=e.result)}},...this.subscribers,t??{}];vA.add(n),await this.onInitialize(n,a),this.activeRunDetach$=new zu;let o;this.activeRunCompletionPromise=new Promise(e=>{o=e}),await Cd(Ou(()=>[...this.middlewares,new Xk].reduceRight((e,t)=>({run:n=>t.run(n,e),get messages(){return e.messages},get state(){return e.state}}),this).run(n),Ok(this.debugLogger),hk(this.debugLogger),HO(this.debugLogger),e=>e.pipe(Rd(this.activeRunDetach$)),e=>this.applyBeforeSourceError(n,e,a),jd(e=>(this.debugLogger?.lifecycle(`LIFECYCLE`,`Run errored:`,{agentId:this.agentId,error:e instanceof Error?e.message:String(e)}),this.isRunning=!1,this.onError(n,e,a))),Id(()=>{this.debugLogger?.lifecycle(`LIFECYCLE`,`Run finished:`,{agentId:this.agentId,threadId:this.threadId}),this.isRunning=!1,this.onFinalize(n,a),o?.(),o=void 0,this.activeRunCompletionPromise=void 0,this.activeRunDetach$=void 0}))(xd(null)));let s=DO(this.messages).filter(e=>!i.has(e.id));return{result:r,newMessages:s}}finally{this.isRunning=!1}}connect(e){throw new nl}async connectAgent(e,t){try{this.isRunning=!0,this.agentId=this.agentId??Zc();let n=this.prepareRunAgentInput(e),r,i=new Set(this.messages.map(e=>e.id)),a=[{onRunStartedEvent:({event:e})=>bA(e),onRunFinishedEvent:e=>{e.outcome===`success`&&(r=e.result)}},...this.subscribers,t??{}];await this.onInitialize(n,a),this.activeRunDetach$=new zu;let o;this.activeRunCompletionPromise=new Promise(e=>{o=e}),await Cd(Ou(()=>kd(()=>this.connect(n)),e=>Ok(this.debugLogger)(Zk()(e)),hk(this.debugLogger),HO(this.debugLogger),e=>e.pipe(Rd(this.activeRunDetach$)),e=>this.applyBeforeSourceError(n,e,a),jd(e=>(this.isRunning=!1,e instanceof nl?Uu:this.onError(n,e,a))),Id(()=>{this.isRunning=!1,this.onFinalize(n,a),o?.(),o=void 0,this.activeRunCompletionPromise=void 0,this.activeRunDetach$=void 0}))(xd(null)),{defaultValue:void 0});let s=DO(this.messages).filter(e=>!i.has(e.id));return{result:r,newMessages:s}}finally{this.isRunning=!1}}abortRun(){}async detachActiveRun(){if(!this.activeRunDetach$)return;let e=this.activeRunCompletionPromise??Promise.resolve();this.activeRunDetach$.next(),this.activeRunDetach$?.complete(),await e}applyBeforeSourceError(e,t,n){return kd(()=>{let r,i=t.pipe(jd(e=>(r={error:e},Uu)));return this.processApplyEvents(e,this.apply(e,i,n),n).pipe(Pd(kd(()=>{let e=r;return e?B(()=>e.error):Uu})))})}apply(e,t,n){return BO(e,t,this,n,this.debugLogger)}processApplyEvents(e,t,n){return t.pipe(zd(t=>{t.messages&&(this.messages=t.messages,n.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),t.state!==void 0&&(this.state=t.state,n.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))}))}prepareRunAgentInput(e){let t=DO(this.messages);for(let e of t)e.subagentRunId===null&&delete e.subagentRunId;let n=t.filter(e=>e.role!==`activity`);return{threadId:this.threadId,runId:e?.runId||Zc(),...qT(this.maxProtocolVersion,gA)>=0&&{protocolVersion:`1.0`},tools:DO(e?.tools??[]),context:DO(e?.context??[]),forwardedProps:DO(e?.forwardedProps??{}),state:DO(this.state),messages:n,...e?.resume===void 0?{}:{resume:DO(e.resume)}}}async onInitialize(e,t){if(vA.has(e)&&this.pendingInterrupts.length>0){let t=new Set((e.resume??[]).map(e=>e.interruptId)),n=this.pendingInterrupts.map(e=>e.id).filter(e=>!t.has(e));if(n.length>0)throw new R(`Thread has ${n.length} pending interrupt(s) not addressed by resume: ${n.join(`, `)}`);for(let t of this.pendingInterrupts)if(Qk(t)&&(e.resume??[]).find(e=>e.interruptId===t.id)?.status!==`cancelled`)throw new R(`Interrupt ${t.id} expired at ${t.expiresAt} and can no longer be answered. Cancel it to continue the thread.`)}let n=await NO(t,this.messages,this.state,(t,n,r)=>t.onRunInitialized?.({messages:n,state:r,agent:this,input:e}));if(n.messages!==void 0||n.state!==void 0){if(n.messages){this.messages=n.messages;for(let e of n.messages)e.subagentRunId===null&&delete e.subagentRunId;e.messages=n.messages.filter(e=>e.role!==`activity`),t.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})}n.state!==void 0&&(this.state=n.state,e.state=n.state,t.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))}}onError(e,t,n){return bd(NO(n,this.messages,this.state,(n,r,i)=>n.onRunFailed?.({error:t,messages:r,state:i,agent:this,input:e}))).pipe(wd(r=>{let i=r;if((i.messages!==void 0||i.state!==void 0)&&(i.messages!==void 0&&(this.messages=i.messages,n.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),i.state!==void 0&&(this.state=i.state,n.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))),i.stopPropagation!==!0){let e=String(t);if(t.name!==`AbortError`&&t.message!==`Fetch is aborted`&&t.message!==`signal is aborted without reason`&&t.message!==`component unmounted`&&e!==`component unmounted`)throw console.error(`Agent execution failed:`,t),t}return{}}))}async onFinalize(e,t){let n=await NO(t,this.messages,this.state,(t,n,r)=>t.onRunFinalized?.({messages:n,state:r,agent:this,input:e}));(n.messages!==void 0||n.state!==void 0)&&(n.messages!==void 0&&(this.messages=n.messages,t.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),n.state!==void 0&&(this.state=n.state,t.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})})))}clone(){let e=Object.create(Object.getPrototypeOf(this));return e.agentId=this.agentId,e.description=this.description,e.threadId=this.threadId,e.messages=DO(this.messages),e.state=DO(this.state),e._debug=this._debug,e._debugLogger=this._debugLogger,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],e.pendingInterrupts=DO(this.pendingInterrupts),e}addMessage(e){this.messages.push(e),(async()=>{for(let t of this.subscribers)await t.onNewMessage?.({message:e,messages:this.messages,state:this.state,agent:this});if(e.role===`assistant`&&e.toolCalls)for(let t of e.toolCalls)for(let e of this.subscribers)await e.onNewToolCall?.({toolCall:t,messages:this.messages,state:this.state,agent:this});for(let e of this.subscribers)await e.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this})})()}addMessages(e){this.messages.push(...e),(async()=>{for(let t of e){for(let e of this.subscribers)await e.onNewMessage?.({message:t,messages:this.messages,state:this.state,agent:this});if(t.role===`assistant`&&t.toolCalls)for(let e of t.toolCalls)for(let t of this.subscribers)await t.onNewToolCall?.({toolCall:e,messages:this.messages,state:this.state,agent:this})}for(let e of this.subscribers)await e.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this})})()}setMessages(e){this.messages=DO(e),(async()=>{for(let e of this.subscribers)await e.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this})})()}setState(e){this.state=DO(e),(async()=>{for(let e of this.subscribers)await e.onStateChanged?.({messages:this.messages,state:this.state,agent:this})})()}legacy_to_be_removed_runAgentBridged(e){this.agentId=this.agentId??Zc();let t=this.prepareRunAgentInput(e);return[...this.middlewares,new Xk].reduceRight((e,t)=>({run:n=>t.run(n,e),get messages(){return e.messages},get state(){return e.state}}),this).run(t).pipe(Ok(this.debugLogger),hk(this.debugLogger),HO(this.debugLogger),tk(this.threadId,t.runId,this.agentId),e=>e.pipe(wd(e=>(this.debugLogger?.event(`LEGACY`,`Event:`,e,{type:e.type}),e))))}};function SA(e){if(!Array.isArray(e.messages))return e;let t=!1,n=e.messages.map(e=>{if(e.subagentRunId===null){t=!0;let n={...e};return delete n.subagentRunId,n}return e});return t?{...e,messages:n}:e}var CA=class extends xA{requestInit(e){return{method:`POST`,headers:{...this.headers,"Content-Type":`application/json`,Accept:`text/event-stream`},body:JSON.stringify(SA(e)),signal:this.abortController.signal}}runAgent(e,t){return this.abortController=e?.abortController??new AbortController,super.runAgent(e,t)}abortRun(){this.abortController.abort(),super.abortRun()}constructor(e){super(e),this.abortController=new AbortController,this.url=e.url,this.headers=DO(e.headers??{}),this.fetch=e.fetch??((e,t)=>fetch(e,t))}run(e){return XO(WO(()=>this.fetch(this.url,this.requestInit(kk(e)))),this.debugLogger)}clone(){let e=super.clone();e.url=this.url,e.headers=DO(this.headers??{}),e.fetch=this.fetch;let t=new AbortController,n=this.abortController.signal;return n.aborted&&t.abort(n.reason),e.abortController=t,e}},wA=N.createContext(void 0),TA=e=>{let t=N.useContext(wA);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},EA=({client:e,children:t})=>(N.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,P.jsx)(wA.Provider,{value:e,children:t})),DA={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},OA=new class{#e=DA;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function kA(e){setTimeout(e,0)}var AA=typeof window>`u`||`Deno`in globalThis;function jA(){}function MA(e,t){return typeof e==`function`?e(t):e}function NA(e){return typeof e==`number`&&e>=0&&e!==1/0}function PA(e,t){return Math.max(e+(t||0)-Date.now(),0)}function FA(e,t){return typeof e==`function`?e(t):e}function IA(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==RA(o,t.options))return!1}else if(!BA(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function LA(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(zA(t.options.mutationKey)!==zA(a))return!1}else if(!BA(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function RA(e,t){return(t?.queryKeyHashFn||zA)(e)}function zA(e){return JSON.stringify(e,(e,t)=>GA(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function BA(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){if(t.length>e.length)return!1;for(let n=0;n500)return t;let r=WA(e)&&WA(t);if(!r&&!(GA(e)&&GA(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l{OA.setTimeout(t,e)})}function JA(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:HA(e,t)}function YA(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function XA(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var ZA=Symbol();function QA(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===ZA?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function $A(e,t){return typeof e==`function`?e(...t):!!e}function ej(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var tj=()=>AA,nj=()=>tj(),rj=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},ij=new class extends rj{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},aj=kA;function oj(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=aj,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var sj=oj(),cj=new class extends rj{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function lj(e){return Math.min(1e3*2**e,3e4)}function uj(e){return(e??`online`)!==`online`||cj.isOnline()}var dj=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function fj(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(jA);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new dj(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>ij.isFocused()&&(e.networkMode===`always`||cj.isOnline())&&e.canRun(),p=()=>uj(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},g=t=>new Promise(n=>{r=e=>{(c()||t())&&n(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),_=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??(nj()?0:3),a=e.retryDelay??lj,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&nf()?void 0:g(f)).then(()=>{t?h(r):_()})})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?_():g(p).then(_),s)}}var pj=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),NA(this.gcTime)&&(this.#e=OA.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(nj()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(OA.clearTimeout(this.#e),this.#e=void 0)}};function mj(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{ej(e,()=>t.signal,()=>n=!0)},u=QA(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?XA:YA;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?gj:hj,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:hj(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(ct.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function hj(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function gj(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function _j(e,t){return t?hj(e,t)!=null:!1}function vj(e,t){return!t||!e.getPreviousPageParam?!1:gj(e,t)!=null}var yj=class extends pj{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Sj(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Sj(this.options);e.data!==void 0&&(this.setState(xj(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=JA(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(jA).catch(jA):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>FA(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ZA||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>FA(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!PA(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=QA(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?mj(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=fj({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof dj&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof dj){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...bj(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...xj(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),sj.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function bj(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:uj(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function xj(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Sj(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var Cj=class extends rj{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Tj(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Ej(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ej(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof FA(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!UA(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Dj(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||FA(this.options.enabled,this.#t)!==FA(t.enabled,this.#t)||FA(this.options.staleTime,this.#t)!==FA(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||FA(this.options.enabled,this.#t)!==FA(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return UA(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(jA)),t}#h(e){return!nj()&&FA(this.options.enabled,this.#t)!==!1&&NA(e)}#g(){this.#b();let e=FA(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=PA(this.#r.dataUpdatedAt,e)+1;this.#u=OA.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return FA(this.options.refetchInterval,this.#t)??!1}#v(e){this.#x(),this.#f=e,this.#f!==0&&this.#h(this.#f)&&(this.#d=OA.setInterval(()=>{(this.options.refetchIntervalInBackground||ij.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(OA.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(OA.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&Tj(e,t),o=i&&Dj(e,n,t,r);(a||o)&&(l={...l,...bj(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=JA(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=JA(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let g=l.fetchStatus===`fetching`,_=m===`pending`,v=m===`error`,y=_&&g,b=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:_,isSuccess:m===`success`,isError:v,isInitialLoading:y,isLoading:y,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:g,isRefetching:g&&!_,isLoadingError:v&&!b,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:v&&b,isStale:Oj(e,t),refetch:this.refetch,isEnabled:FA(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),UA(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();sj.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function wj(e,t){return FA(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||FA(t.retryOnMount,e)!==!1)}function Tj(e,t){return wj(e,t)||e.state.data!==void 0&&Ej(e,t,t.refetchOnMount)}function Ej(e,t,n){if(FA(t.enabled,e)!==!1&&FA(t.staleTime,e)!==`static`){let r=FA(n,e);return r===`always`||r!==!1&&Oj(e,t)}return!1}function Dj(e,t,n,r){return(e!==t||FA(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&Oj(e,n)}function Oj(e,t){return FA(t.enabled,e)!==!1&&e.isStaleByTime(FA(t.staleTime,e))}var kj=class extends Cj{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:_j(t,n.data),hasPreviousPage:vj(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}},Aj=class extends pj{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||jj(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=fj({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),sj.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function jj(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Mj=class extends rj{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new Aj({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Nj(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Nj(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Nj(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=Nj(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){sj.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>LA(t,e))}findAll(e={}){return this.getAll().filter(t=>LA(e,t))}notify(e){sj.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return sj.batch(()=>Promise.all(e.map(e=>e.continue().catch(jA))))}};function Nj(e){return e.options.scope?.id}var Pj=class extends rj{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??RA(r,t),a=this.get(i);return a||(a=new yj({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){this.#e.get(e.queryHash)===e&&(e.destroy(),this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){sj.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>IA(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>IA(e,t)):t}notify(e){sj.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){sj.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){sj.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Fj=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Pj,this.#t=e.mutationCache||new Mj,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=ij.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=cj.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(FA(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=MA(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return sj.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;sj.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return sj.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=sj.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(jA).catch(jA)}invalidateQueries(e,t={}){return sj.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=sj.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(jA)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(jA)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(FA(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(FA(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(jA).catch(jA)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(jA).catch(jA)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return cj.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(zA(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{BA(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(zA(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{BA(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=RA(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===ZA&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Ij=N.createContext(!1),Lj=()=>N.useContext(Ij);Ij.Provider;function Rj(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var zj=N.createContext(Rj()),Bj=()=>N.useContext(zj),Vj=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?$A(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},Hj=e=>{N.useEffect(()=>{e.clearReset()},[e])},Uj=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||$A(n,[e.error,r])),Wj=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},Gj=(e,t)=>e?.suspense&&t.isPending,Kj=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function qj(e,t,n){let r=Lj(),i=Bj(),a=TA(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,Wj(o),Vj(o,i,s),Hj(i);let[l]=N.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(N.useSyncExternalStore(N.useCallback(e=>{let t=d?l.subscribe(sj.batchCalls(e)):jA;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),N.useEffect(()=>{l.setOptions(o)},[o,l]),Gj(o,u))throw Kj(o,l,i);if(Uj({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function Jj(e,t){return qj(e,Cj,t)}function Yj(e,t){return qj(e,kj,t)}var Xj=new Map([[`bold`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M228,128a12,12,0,0,1-12,12H69l51.52,51.51a12,12,0,0,1-17,17l-72-72a12,12,0,0,1,0-17l72-72a12,12,0,0,1,17,17L69,116H216A12,12,0,0,1,228,128Z`}))],[`duotone`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M112,56V200L40,128Z`,opacity:`0.2`}),N.createElement(`path`,{d:`M216,120H120V56a8,8,0,0,0-13.66-5.66l-72,72a8,8,0,0,0,0,11.32l72,72A8,8,0,0,0,120,200V136h96a8,8,0,0,0,0-16ZM104,180.69,51.31,128,104,75.31Z`}))],[`fill`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H120v64a8,8,0,0,1-13.66,5.66l-72-72a8,8,0,0,1,0-11.32l72-72A8,8,0,0,1,120,56v64h96A8,8,0,0,1,224,128Z`}))],[`light`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M222,128a6,6,0,0,1-6,6H54.49l61.75,61.76a6,6,0,1,1-8.48,8.48l-72-72a6,6,0,0,1,0-8.48l72-72a6,6,0,0,1,8.48,8.48L54.49,122H216A6,6,0,0,1,222,128Z`}))],[`regular`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H59.31l58.35,58.34a8,8,0,0,1-11.32,11.32l-72-72a8,8,0,0,1,0-11.32l72-72a8,8,0,0,1,11.32,11.32L59.31,120H216A8,8,0,0,1,224,128Z`}))],[`thin`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M220,128a4,4,0,0,1-4,4H49.66l65.17,65.17a4,4,0,0,1-5.66,5.66l-72-72a4,4,0,0,1,0-5.66l72-72a4,4,0,0,1,5.66,5.66L49.66,124H216A4,4,0,0,1,220,128Z`}))]]),Zj=new Map([[`bold`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M224.49,136.49l-72,72a12,12,0,0,1-17-17L187,140H40a12,12,0,0,1,0-24H187L135.51,64.48a12,12,0,0,1,17-17l72,72A12,12,0,0,1,224.49,136.49Z`}))],[`duotone`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M216,128l-72,72V56Z`,opacity:`0.2`}),N.createElement(`path`,{d:`M221.66,122.34l-72-72A8,8,0,0,0,136,56v64H40a8,8,0,0,0,0,16h96v64a8,8,0,0,0,13.66,5.66l72-72A8,8,0,0,0,221.66,122.34ZM152,180.69V75.31L204.69,128Z`}))],[`fill`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M221.66,133.66l-72,72A8,8,0,0,1,136,200V136H40a8,8,0,0,1,0-16h96V56a8,8,0,0,1,13.66-5.66l72,72A8,8,0,0,1,221.66,133.66Z`}))],[`light`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M220.24,132.24l-72,72a6,6,0,0,1-8.48-8.48L201.51,134H40a6,6,0,0,1,0-12H201.51L139.76,60.24a6,6,0,0,1,8.48-8.48l72,72A6,6,0,0,1,220.24,132.24Z`}))],[`regular`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z`}))],[`thin`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M218.83,130.83l-72,72a4,4,0,0,1-5.66-5.66L206.34,132H40a4,4,0,0,1,0-8H206.34L141.17,58.83a4,4,0,0,1,5.66-5.66l72,72A4,4,0,0,1,218.83,130.83Z`}))]]),Qj=new Map([[`bold`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M232,44H160a43.86,43.86,0,0,0-32,13.85A43.86,43.86,0,0,0,96,44H24A12,12,0,0,0,12,56V200a12,12,0,0,0,12,12H96a20,20,0,0,1,20,20,12,12,0,0,0,24,0,20,20,0,0,1,20-20h72a12,12,0,0,0,12-12V56A12,12,0,0,0,232,44ZM96,188H36V68H96a20,20,0,0,1,20,20V192.81A43.79,43.79,0,0,0,96,188Zm124,0H160a43.71,43.71,0,0,0-20,4.83V88a20,20,0,0,1,20-20h60Z`}))],[`duotone`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M232,56V200H160a32,32,0,0,0-32,32,32,32,0,0,0-32-32H24V56H96a32,32,0,0,1,32,32,32,32,0,0,1,32-32Z`,opacity:`0.2`}),N.createElement(`path`,{d:`M232,48H160a40,40,0,0,0-32,16A40,40,0,0,0,96,48H24a8,8,0,0,0-8,8V200a8,8,0,0,0,8,8H96a24,24,0,0,1,24,24,8,8,0,0,0,16,0,24,24,0,0,1,24-24h72a8,8,0,0,0,8-8V56A8,8,0,0,0,232,48ZM96,192H32V64H96a24,24,0,0,1,24,24V200A39.81,39.81,0,0,0,96,192Zm128,0H160a39.81,39.81,0,0,0-24,8V88a24,24,0,0,1,24-24h64Z`}))],[`fill`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M240,56V200a8,8,0,0,1-8,8H160a24,24,0,0,0-24,23.94,7.9,7.9,0,0,1-5.12,7.55A8,8,0,0,1,120,232a24,24,0,0,0-24-24H24a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8H88a32,32,0,0,1,32,32v87.73a8.17,8.17,0,0,0,7.47,8.25,8,8,0,0,0,8.53-8V80a32,32,0,0,1,32-32h64A8,8,0,0,1,240,56Z`}))],[`light`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M232,50H160a38,38,0,0,0-32,17.55A38,38,0,0,0,96,50H24a6,6,0,0,0-6,6V200a6,6,0,0,0,6,6H96a26,26,0,0,1,26,26,6,6,0,0,0,12,0,26,26,0,0,1,26-26h72a6,6,0,0,0,6-6V56A6,6,0,0,0,232,50ZM96,194H30V62H96a26,26,0,0,1,26,26V204.31A37.86,37.86,0,0,0,96,194Zm130,0H160a37.87,37.87,0,0,0-26,10.32V88a26,26,0,0,1,26-26h66Z`}))],[`regular`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M232,48H160a40,40,0,0,0-32,16A40,40,0,0,0,96,48H24a8,8,0,0,0-8,8V200a8,8,0,0,0,8,8H96a24,24,0,0,1,24,24,8,8,0,0,0,16,0,24,24,0,0,1,24-24h72a8,8,0,0,0,8-8V56A8,8,0,0,0,232,48ZM96,192H32V64H96a24,24,0,0,1,24,24V200A39.81,39.81,0,0,0,96,192Zm128,0H160a39.81,39.81,0,0,0-24,8V88a24,24,0,0,1,24-24h64Z`}))],[`thin`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M232,52H160a36,36,0,0,0-32,19.54A36,36,0,0,0,96,52H24a4,4,0,0,0-4,4V200a4,4,0,0,0,4,4H96a28,28,0,0,1,28,28,4,4,0,0,0,8,0,28,28,0,0,1,28-28h72a4,4,0,0,0,4-4V56A4,4,0,0,0,232,52ZM96,196H28V60H96a28,28,0,0,1,28,28V209.4A35.93,35.93,0,0,0,96,196Zm132,0H160a35.94,35.94,0,0,0-28,13.41V88a28,28,0,0,1,28-28h68Z`}))]]),$j=new Map([[`bold`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M144,128a16,16,0,1,1-16-16A16,16,0,0,1,144,128ZM60,112a16,16,0,1,0,16,16A16,16,0,0,0,60,112Zm136,0a16,16,0,1,0,16,16A16,16,0,0,0,196,112Z`}))],[`duotone`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M240,96v64a16,16,0,0,1-16,16H32a16,16,0,0,1-16-16V96A16,16,0,0,1,32,80H224A16,16,0,0,1,240,96Z`,opacity:`0.2`}),N.createElement(`path`,{d:`M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128Zm56-12a12,12,0,1,0,12,12A12,12,0,0,0,196,116ZM60,116a12,12,0,1,0,12,12A12,12,0,0,0,60,116Z`}))],[`fill`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M224,80H32A16,16,0,0,0,16,96v64a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V96A16,16,0,0,0,224,80ZM60,140a12,12,0,1,1,12-12A12,12,0,0,1,60,140Zm68,0a12,12,0,1,1,12-12A12,12,0,0,1,128,140Zm68,0a12,12,0,1,1,12-12A12,12,0,0,1,196,140Z`}))],[`light`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M138,128a10,10,0,1,1-10-10A10,10,0,0,1,138,128ZM60,118a10,10,0,1,0,10,10A10,10,0,0,0,60,118Zm136,0a10,10,0,1,0,10,10A10,10,0,0,0,196,118Z`}))],[`regular`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M140,128a12,12,0,1,1-12-12A12,12,0,0,1,140,128Zm56-12a12,12,0,1,0,12,12A12,12,0,0,0,196,116ZM60,116a12,12,0,1,0,12,12A12,12,0,0,0,60,116Z`}))],[`thin`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M136,128a8,8,0,1,1-8-8A8,8,0,0,1,136,128Zm-76-8a8,8,0,1,0,8,8A8,8,0,0,0,60,120Zm136,0a8,8,0,1,0,8,8A8,8,0,0,0,196,120Z`}))]]),eM=new Map([[`bold`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M232.49,215.51,185,168a92.12,92.12,0,1,0-17,17l47.53,47.54a12,12,0,0,0,17-17ZM44,112a68,68,0,1,1,68,68A68.07,68.07,0,0,1,44,112Z`}))],[`duotone`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M192,112a80,80,0,1,1-80-80A80,80,0,0,1,192,112Z`,opacity:`0.2`}),N.createElement(`path`,{d:`M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z`}))],[`fill`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M168,112a56,56,0,1,1-56-56A56,56,0,0,1,168,112Zm61.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88,88,0,1,1,11.32-11.31l50.06,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z`}))],[`light`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M228.24,219.76l-51.38-51.38a86.15,86.15,0,1,0-8.48,8.48l51.38,51.38a6,6,0,0,0,8.48-8.48ZM38,112a74,74,0,1,1,74,74A74.09,74.09,0,0,1,38,112Z`}))],[`regular`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M229.66,218.34l-50.07-50.06a88.11,88.11,0,1,0-11.31,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z`}))],[`thin`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M226.83,221.17l-52.7-52.7a84.1,84.1,0,1,0-5.66,5.66l52.7,52.7a4,4,0,0,0,5.66-5.66ZM36,112a76,76,0,1,1,76,76A76.08,76.08,0,0,1,36,112Z`}))]]),tM=new Map([[`bold`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M236.37,139.4a12,12,0,0,0-12-3A84.07,84.07,0,0,1,119.6,31.59a12,12,0,0,0-15-15A108.86,108.86,0,0,0,49.69,55.07,108,108,0,0,0,136,228a107.09,107.09,0,0,0,64.93-21.69,108.86,108.86,0,0,0,38.44-54.94A12,12,0,0,0,236.37,139.4Zm-49.88,47.74A84,84,0,0,1,68.86,69.51,84.93,84.93,0,0,1,92.27,48.29Q92,52.13,92,56A108.12,108.12,0,0,0,200,164q3.87,0,7.71-.27A84.79,84.79,0,0,1,186.49,187.14Z`}))],[`duotone`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M227.89,147.89A96,96,0,1,1,108.11,28.11,96.09,96.09,0,0,0,227.89,147.89Z`,opacity:`0.2`}),N.createElement(`path`,{d:`M233.54,142.23a8,8,0,0,0-8-2,88.08,88.08,0,0,1-109.8-109.8,8,8,0,0,0-10-10,104.84,104.84,0,0,0-52.91,37A104,104,0,0,0,136,224a103.09,103.09,0,0,0,62.52-20.88,104.84,104.84,0,0,0,37-52.91A8,8,0,0,0,233.54,142.23ZM188.9,190.34A88,88,0,0,1,65.66,67.11a89,89,0,0,1,31.4-26A106,106,0,0,0,96,56,104.11,104.11,0,0,0,200,160a106,106,0,0,0,14.92-1.06A89,89,0,0,1,188.9,190.34Z`}))],[`fill`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M235.54,150.21a104.84,104.84,0,0,1-37,52.91A104,104,0,0,1,32,120,103.09,103.09,0,0,1,52.88,57.48a104.84,104.84,0,0,1,52.91-37,8,8,0,0,1,10,10,88.08,88.08,0,0,0,109.8,109.8,8,8,0,0,1,10,10Z`}))],[`light`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M232.13,143.64a6,6,0,0,0-6-1.49A90.07,90.07,0,0,1,113.86,29.85a6,6,0,0,0-7.49-7.48A102.88,102.88,0,0,0,54.48,58.68,102,102,0,0,0,197.32,201.52a102.88,102.88,0,0,0,36.31-51.89A6,6,0,0,0,232.13,143.64Zm-42,48.29a90,90,0,0,1-126-126A90.9,90.9,0,0,1,99.65,37.66,102.06,102.06,0,0,0,218.34,156.35,90.9,90.9,0,0,1,190.1,191.93Z`}))],[`regular`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M233.54,142.23a8,8,0,0,0-8-2,88.08,88.08,0,0,1-109.8-109.8,8,8,0,0,0-10-10,104.84,104.84,0,0,0-52.91,37A104,104,0,0,0,136,224a103.09,103.09,0,0,0,62.52-20.88,104.84,104.84,0,0,0,37-52.91A8,8,0,0,0,233.54,142.23ZM188.9,190.34A88,88,0,0,1,65.66,67.11a89,89,0,0,1,31.4-26A106,106,0,0,0,96,56,104.11,104.11,0,0,0,200,160a106,106,0,0,0,14.92-1.06A89,89,0,0,1,188.9,190.34Z`}))],[`thin`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M230.72,145.06a4,4,0,0,0-4-1A92.08,92.08,0,0,1,111.94,29.27a4,4,0,0,0-5-5A100.78,100.78,0,0,0,56.08,59.88a100,100,0,0,0,140,140,100.78,100.78,0,0,0,35.59-50.87A4,4,0,0,0,230.72,145.06ZM191.3,193.53A92,92,0,0,1,62.47,64.7a93,93,0,0,1,39.88-30.35,100.09,100.09,0,0,0,119.3,119.3A93,93,0,0,1,191.3,193.53Z`}))]]),nM=new Map([[`bold`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M230.14,70.54,185.46,25.85a20,20,0,0,0-28.29,0L33.86,149.17A19.85,19.85,0,0,0,28,163.31V208a20,20,0,0,0,20,20H92.69a19.86,19.86,0,0,0,14.14-5.86L230.14,98.82a20,20,0,0,0,0-28.28ZM91,204H52V165l84-84,39,39ZM192,103,153,64l18.34-18.34,39,39Z`}))],[`duotone`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M221.66,90.34,192,120,136,64l29.66-29.66a8,8,0,0,1,11.31,0L221.66,79A8,8,0,0,1,221.66,90.34Z`,opacity:`0.2`}),N.createElement(`path`,{d:`M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z`}))],[`fill`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM192,108.68,147.31,64l24-24L216,84.68Z`}))],[`light`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M225.9,74.78,181.21,30.09a14,14,0,0,0-19.8,0L38.1,153.41a13.94,13.94,0,0,0-4.1,9.9V208a14,14,0,0,0,14,14H92.69a13.94,13.94,0,0,0,9.9-4.1L225.9,94.58a14,14,0,0,0,0-19.8ZM94.1,209.41a2,2,0,0,1-1.41.59H48a2,2,0,0,1-2-2V163.31a2,2,0,0,1,.59-1.41L136,72.48,183.51,120ZM217.41,86.1,192,111.51,144.49,64,169.9,38.58a2,2,0,0,1,2.83,0l44.68,44.69a2,2,0,0,1,0,2.83Z`}))],[`regular`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z`}))],[`thin`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M224.49,76.2,179.8,31.51a12,12,0,0,0-17,0L133.17,61.17h0L39.52,154.83A11.9,11.9,0,0,0,36,163.31V208a12,12,0,0,0,12,12H92.69a12,12,0,0,0,8.48-3.51L224.48,93.17a12,12,0,0,0,0-17Zm-129,134.63A4,4,0,0,1,92.69,212H48a4,4,0,0,1-4-4V163.31a4,4,0,0,1,1.17-2.83L136,69.65,186.34,120ZM218.83,87.51,192,114.34,141.66,64l26.82-26.83a4,4,0,0,1,5.66,0l44.69,44.68a4,4,0,0,1,0,5.66Z`}))]]),rM=new Map([[`bold`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M240.49,15.51a12,12,0,0,0-17,0L173.94,65.09l-2.54-2.55a36.05,36.05,0,0,0-50.91,0L100,83l-3.51-3.52a12,12,0,0,0-17,17L83,100,62.54,120.49a36,36,0,0,0,0,50.91l2.55,2.54L15.51,223.51a12,12,0,0,0,17,17l49.57-49.58,2.54,2.55a36.06,36.06,0,0,0,50.91,0L156,173l3.51,3.52a12,12,0,0,0,17-17L173,156l20.49-20.49a36,36,0,0,0,0-50.91l-2.55-2.54,49.58-49.57A12,12,0,0,0,240.49,15.51Zm-121.95,161a12,12,0,0,1-17,0L79.51,154.43a12,12,0,0,1,0-17L100,117l39,39Zm58-57.95h0L156,139l-39-39,20.49-20.49a12,12,0,0,1,17,0l22.06,22.06a12,12,0,0,1,0,17ZM85.27,33.37a12,12,0,0,1,21.46-10.74l8,16A12,12,0,1,1,93.27,49.37Zm-68,57.26a12,12,0,0,1,16.1-5.36l16,8a12,12,0,1,1-10.74,21.46l-16-8A12,12,0,0,1,17.27,90.63Zm221.46,74.74a12,12,0,0,1-16.1,5.36l-16-8a12,12,0,0,1,10.74-21.46l16,8A12,12,0,0,1,238.73,165.37Zm-68,57.26a12,12,0,1,1-21.46,10.74l-8-16a12,12,0,0,1,21.46-10.74Z`}))],[`duotone`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M185,127,127,185a24,24,0,0,1-33.94,0L71,162.91A24,24,0,0,1,71,129L129,71a24,24,0,0,1,33.94,0L185,93.09A24,24,0,0,1,185,127Z`,opacity:`0.2`}),N.createElement(`path`,{d:`M237.66,18.34a8,8,0,0,0-11.32,0l-52.4,52.41-5.37-5.38a32.05,32.05,0,0,0-45.26,0L100,88.69l-6.34-6.35A8,8,0,0,0,82.34,93.66L88.69,100,65.37,123.31a32,32,0,0,0,0,45.26l5.38,5.37-52.41,52.4a8,8,0,0,0,11.32,11.32l52.4-52.41,5.37,5.38a32.06,32.06,0,0,0,45.26,0L156,167.31l6.34,6.35a8,8,0,0,0,11.32-11.32L167.31,156l23.32-23.31a32,32,0,0,0,0-45.26l-5.38-5.37,52.41-52.4A8,8,0,0,0,237.66,18.34Zm-116.29,161a16,16,0,0,1-22.62,0L76.69,157.25a16,16,0,0,1,0-22.62L100,111.31,144.69,156Zm57.94-57.94h0L156,144.69,111.31,100l23.32-23.31a16,16,0,0,1,22.62,0l22.06,22a16,16,0,0,1,0,22.63ZM88.57,35A8,8,0,0,1,103.43,29l8,20A8,8,0,0,1,96.57,55ZM24.57,93A8,8,0,0,1,35,88.57l20,8A8,8,0,0,1,49,111.43l-20-8A8,8,0,0,1,24.57,93ZM231.43,163a8,8,0,0,1-10.4,4.46l-20-8A8,8,0,1,1,207,144.57l20,8A8,8,0,0,1,231.43,163Zm-64,58.06A8,8,0,0,1,152.57,227l-8-20A8,8,0,0,1,159.43,201Z`}))],[`fill`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M88.57,35A8,8,0,0,1,103.43,29l8,20A8,8,0,0,1,96.57,55ZM29,103.43l20,8A8,8,0,1,0,55,96.57l-20-8A8,8,0,0,0,29,103.43ZM227,152.57l-20-8A8,8,0,1,0,201,159.43l20,8A8,8,0,0,0,227,152.57ZM159.43,201A8,8,0,0,0,144.57,207l8,20A8,8,0,1,0,167.43,221ZM237.91,18.52a8,8,0,0,0-11.5-.18L174,70.75l-5.38-5.38a32,32,0,0,0-45.28,0L106.14,82.54a4,4,0,0,0,0,5.66l61.7,61.66a4,4,0,0,0,5.66,0l16.74-16.74a32.76,32.76,0,0,0,9.81-22.52,31.82,31.82,0,0,0-9.37-23.17l-5.38-5.37,52.2-52.17A8.22,8.22,0,0,0,237.91,18.52ZM85.64,90.34a8,8,0,0,0-11.49.18,8.22,8.22,0,0,0,.41,11.37L80.67,108,65.34,123.31A31.82,31.82,0,0,0,56,146.47,32.75,32.75,0,0,0,65.77,169l5,4.94L18.49,226.13a8.21,8.21,0,0,0-.61,11.1,8,8,0,0,0,11.72.43L82,185.25l5.37,5.38a32.1,32.1,0,0,0,45.29,0L148,175.31l6.34,6.35a8,8,0,0,0,11.32-11.32Z`}))],[`light`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M236.24,19.76a6,6,0,0,0-8.48,0L173.94,73.57l-6.79-6.78a30,30,0,0,0-42.42,0L100,91.51l-7.76-7.75a6,6,0,0,0-8.48,8.48L91.51,100,66.79,124.73a30,30,0,0,0,0,42.42l6.78,6.79L19.76,227.76a6,6,0,1,0,8.48,8.48l53.82-53.81,6.79,6.78a30,30,0,0,0,42.42,0L156,164.49l7.76,7.75a6,6,0,0,0,8.48-8.48L164.49,156l24.72-24.73a30,30,0,0,0,0-42.42l-6.78-6.79,53.81-53.82A6,6,0,0,0,236.24,19.76Zm-113.45,161a18,18,0,0,1-25.46,0L75.27,158.67a18,18,0,0,1,0-25.46L100,108.49,147.51,156Zm57.94-57.94L156,147.51,108.49,100l24.72-24.73a18,18,0,0,1,25.46,0l22.06,22.06a18,18,0,0,1,0,25.46ZM90.43,34.23a6,6,0,0,1,11.14-4.46l8,20a6,6,0,1,1-11.14,4.46Zm-64,59.54a6,6,0,0,1,7.8-3.34l20,8a6,6,0,1,1-4.46,11.14l-20-8A6,6,0,0,1,26.43,93.77Zm203.14,68.46a6,6,0,0,1-7.8,3.34l-20-8a6,6,0,0,1,4.46-11.14l20,8A6,6,0,0,1,229.57,162.23Zm-64,59.54a6,6,0,1,1-11.14,4.46l-8-20a6,6,0,0,1,11.14-4.46Z`}))],[`regular`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M237.66,18.34a8,8,0,0,0-11.32,0l-52.4,52.41-5.37-5.38a32.05,32.05,0,0,0-45.26,0L100,88.69l-6.34-6.35A8,8,0,0,0,82.34,93.66L88.69,100,65.37,123.31a32,32,0,0,0,0,45.26l5.38,5.37-52.41,52.4a8,8,0,0,0,11.32,11.32l52.4-52.41,5.37,5.38a32,32,0,0,0,45.26,0L156,167.31l6.34,6.35a8,8,0,0,0,11.32-11.32L167.31,156l23.32-23.31a32,32,0,0,0,0-45.26l-5.38-5.37,52.41-52.4A8,8,0,0,0,237.66,18.34Zm-116.29,161a16,16,0,0,1-22.62,0L76.69,157.25a16,16,0,0,1,0-22.62L100,111.31,144.69,156Zm57.94-57.94L156,144.69,111.31,100l23.32-23.31a16,16,0,0,1,22.62,0l22.06,22A16,16,0,0,1,179.31,121.37ZM88.57,35A8,8,0,0,1,103.43,29l8,20A8,8,0,0,1,96.57,55ZM24.57,93A8,8,0,0,1,35,88.57l20,8A8,8,0,0,1,49,111.43l-20-8A8,8,0,0,1,24.57,93ZM231.43,163a8,8,0,0,1-10.4,4.46l-20-8A8,8,0,1,1,207,144.57l20,8A8,8,0,0,1,231.43,163Zm-64,58.06A8,8,0,0,1,152.57,227l-8-20A8,8,0,0,1,159.43,201Z`}))],[`thin`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M234.83,21.17a4,4,0,0,0-5.66,0L173.94,76.4l-8.2-8.2a28,28,0,0,0-39.6,0L100,94.34l-9.17-9.17a4,4,0,0,0-5.66,5.66L94.34,100,68.2,126.14a28,28,0,0,0,0,39.6l8.2,8.2L21.17,229.17a4,4,0,0,0,5.66,5.66L82.06,179.6l8.2,8.2a28,28,0,0,0,39.6,0L156,161.66l9.17,9.17a4,4,0,0,0,5.66-5.66L161.66,156l26.14-26.14a28,28,0,0,0,0-39.6l-8.2-8.2,55.23-55.23A4,4,0,0,0,234.83,21.17Zm-110.63,161a20,20,0,0,1-28.28,0L73.86,160.08a20,20,0,0,1,0-28.28L100,105.66,150.34,156Zm57.94-57.94L156,150.34,105.66,100,131.8,73.86a20,20,0,0,1,28.28,0l22.06,22.06A20,20,0,0,1,182.14,124.2ZM92.29,33.49a4,4,0,1,1,7.42-3l8,20a4,4,0,0,1-2.22,5.2A3.91,3.91,0,0,1,104,56a4,4,0,0,1-3.71-2.51Zm-64,61a4,4,0,0,1,5.2-2.22l20,8A4,4,0,0,1,52,108a3.91,3.91,0,0,1-1.49-.29l-20-8A4,4,0,0,1,28.29,94.51Zm199.42,67A4,4,0,0,1,224,164a3.91,3.91,0,0,1-1.49-.29l-20-8a4,4,0,1,1,3-7.42l20,8A4,4,0,0,1,227.71,161.49Zm-64,61a4,4,0,0,1-2.22,5.2A3.91,3.91,0,0,1,160,228a4,4,0,0,1-3.71-2.51l-8-20a4,4,0,0,1,7.42-3Z`}))]]),iM=new Map([[`bold`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M228,128a12,12,0,0,1-12,12H140v76a12,12,0,0,1-24,0V140H40a12,12,0,0,1,0-24h76V40a12,12,0,0,1,24,0v76h76A12,12,0,0,1,228,128Z`}))],[`duotone`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z`,opacity:`0.2`}),N.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z`}))],[`fill`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM184,136H136v48a8,8,0,0,1-16,0V136H72a8,8,0,0,1,0-16h48V72a8,8,0,0,1,16,0v48h48a8,8,0,0,1,0,16Z`}))],[`light`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M222,128a6,6,0,0,1-6,6H134v82a6,6,0,0,1-12,0V134H40a6,6,0,0,1,0-12h82V40a6,6,0,0,1,12,0v82h82A6,6,0,0,1,222,128Z`}))],[`regular`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z`}))],[`thin`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M220,128a4,4,0,0,1-4,4H132v84a4,4,0,0,1-8,0V132H40a4,4,0,0,1,0-8h84V40a4,4,0,0,1,8,0v84h84A4,4,0,0,1,220,128Z`}))]]),aM=new Map([[`bold`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M124,216a12,12,0,0,1-12,12H48a12,12,0,0,1-12-12V40A12,12,0,0,1,48,28h64a12,12,0,0,1,0,24H60V204h52A12,12,0,0,1,124,216Zm108.49-96.49-40-40a12,12,0,0,0-17,17L195,116H112a12,12,0,0,0,0,24h83l-19.52,19.51a12,12,0,0,0,17,17l40-40A12,12,0,0,0,232.49,119.51Z`}))],[`duotone`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M224,56V200a16,16,0,0,1-16,16H48V40H208A16,16,0,0,1,224,56Z`,opacity:`0.2`}),N.createElement(`path`,{d:`M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40a8,8,0,0,0-11.32,11.32L204.69,120H112a8,8,0,0,0,0,16h92.69l-26.35,26.34a8,8,0,0,0,11.32,11.32l40-40A8,8,0,0,0,229.66,122.34Z`}))],[`fill`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40A8,8,0,0,0,176,88v32H112a8,8,0,0,0,0,16h64v32a8,8,0,0,0,13.66,5.66l40-40A8,8,0,0,0,229.66,122.34Z`}))],[`light`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M118,216a6,6,0,0,1-6,6H48a6,6,0,0,1-6-6V40a6,6,0,0,1,6-6h64a6,6,0,0,1,0,12H54V210h58A6,6,0,0,1,118,216Zm110.24-92.24-40-40a6,6,0,0,0-8.48,8.48L209.51,122H112a6,6,0,0,0,0,12h97.51l-29.75,29.76a6,6,0,1,0,8.48,8.48l40-40A6,6,0,0,0,228.24,123.76Z`}))],[`regular`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40a8,8,0,0,0-11.32,11.32L204.69,120H112a8,8,0,0,0,0,16h92.69l-26.35,26.34a8,8,0,0,0,11.32,11.32l40-40A8,8,0,0,0,229.66,122.34Z`}))],[`thin`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M116,216a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V40a4,4,0,0,1,4-4h64a4,4,0,0,1,0,8H52V212h60A4,4,0,0,1,116,216Zm110.83-90.83-40-40a4,4,0,0,0-5.66,5.66L214.34,124H112a4,4,0,0,0,0,8H214.34l-33.17,33.17a4,4,0,0,0,5.66,5.66l40-40A4,4,0,0,0,226.83,125.17Z`}))]]),oM=new Map([[`bold`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M199,125.31l-49.88-18.39L130.69,57a19.92,19.92,0,0,0-37.38,0L74.92,106.92,25,125.31a19.92,19.92,0,0,0,0,37.38l49.88,18.39L93.31,231a19.92,19.92,0,0,0,37.38,0l18.39-49.88L199,162.69a19.92,19.92,0,0,0,0-37.38Zm-63.38,35.16a12,12,0,0,0-7.11,7.11L112,212.28l-16.47-44.7a12,12,0,0,0-7.11-7.11L43.72,144l44.7-16.47a12,12,0,0,0,7.11-7.11L112,75.72l16.47,44.7a12,12,0,0,0,7.11,7.11L180.28,144ZM140,40a12,12,0,0,1,12-12h12V16a12,12,0,0,1,24,0V28h12a12,12,0,0,1,0,24H188V64a12,12,0,0,1-24,0V52H152A12,12,0,0,1,140,40ZM252,88a12,12,0,0,1-12,12h-4v4a12,12,0,0,1-24,0v-4h-4a12,12,0,0,1,0-24h4V72a12,12,0,0,1,24,0v4h4A12,12,0,0,1,252,88Z`}))],[`duotone`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M194.82,151.43l-55.09,20.3-20.3,55.09a7.92,7.92,0,0,1-14.86,0l-20.3-55.09-55.09-20.3a7.92,7.92,0,0,1,0-14.86l55.09-20.3,20.3-55.09a7.92,7.92,0,0,1,14.86,0l20.3,55.09,55.09,20.3A7.92,7.92,0,0,1,194.82,151.43Z`,opacity:`0.2`}),N.createElement(`path`,{d:`M197.58,129.06,146,110l-19-51.62a15.92,15.92,0,0,0-29.88,0L78,110l-51.62,19a15.92,15.92,0,0,0,0,29.88L78,178l19,51.62a15.92,15.92,0,0,0,29.88,0L146,178l51.62-19a15.92,15.92,0,0,0,0-29.88ZM137,164.22a8,8,0,0,0-4.74,4.74L112,223.85,91.78,169A8,8,0,0,0,87,164.22L32.15,144,87,123.78A8,8,0,0,0,91.78,119L112,64.15,132.22,119a8,8,0,0,0,4.74,4.74L191.85,144ZM144,40a8,8,0,0,1,8-8h16V16a8,8,0,0,1,16,0V32h16a8,8,0,0,1,0,16H184V64a8,8,0,0,1-16,0V48H152A8,8,0,0,1,144,40ZM248,88a8,8,0,0,1-8,8h-8v8a8,8,0,0,1-16,0V96h-8a8,8,0,0,1,0-16h8V72a8,8,0,0,1,16,0v8h8A8,8,0,0,1,248,88Z`}))],[`fill`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M208,144a15.78,15.78,0,0,1-10.42,14.94L146,178l-19,51.62a15.92,15.92,0,0,1-29.88,0L78,178l-51.62-19a15.92,15.92,0,0,1,0-29.88L78,110l19-51.62a15.92,15.92,0,0,1,29.88,0L146,110l51.62,19A15.78,15.78,0,0,1,208,144ZM152,48h16V64a8,8,0,0,0,16,0V48h16a8,8,0,0,0,0-16H184V16a8,8,0,0,0-16,0V32H152a8,8,0,0,0,0,16Zm88,32h-8V72a8,8,0,0,0-16,0v8h-8a8,8,0,0,0,0,16h8v8a8,8,0,0,0,16,0V96h8a8,8,0,0,0,0-16Z`}))],[`light`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M196.89,130.94,144.4,111.6,125.06,59.11a13.92,13.92,0,0,0-26.12,0L79.6,111.6,27.11,130.94a13.92,13.92,0,0,0,0,26.12L79.6,176.4l19.34,52.49a13.92,13.92,0,0,0,26.12,0L144.4,176.4l52.49-19.34a13.92,13.92,0,0,0,0-26.12Zm-4.15,14.86-55.08,20.3a6,6,0,0,0-3.56,3.56l-20.3,55.08a1.92,1.92,0,0,1-3.6,0L89.9,169.66a6,6,0,0,0-3.56-3.56L31.26,145.8a1.92,1.92,0,0,1,0-3.6l55.08-20.3a6,6,0,0,0,3.56-3.56l20.3-55.08a1.92,1.92,0,0,1,3.6,0l20.3,55.08a6,6,0,0,0,3.56,3.56l55.08,20.3a1.92,1.92,0,0,1,0,3.6ZM146,40a6,6,0,0,1,6-6h18V16a6,6,0,0,1,12,0V34h18a6,6,0,0,1,0,12H182V64a6,6,0,0,1-12,0V46H152A6,6,0,0,1,146,40ZM246,88a6,6,0,0,1-6,6H230v10a6,6,0,0,1-12,0V94H208a6,6,0,0,1,0-12h10V72a6,6,0,0,1,12,0V82h10A6,6,0,0,1,246,88Z`}))],[`regular`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M197.58,129.06,146,110l-19-51.62a15.92,15.92,0,0,0-29.88,0L78,110l-51.62,19a15.92,15.92,0,0,0,0,29.88L78,178l19,51.62a15.92,15.92,0,0,0,29.88,0L146,178l51.62-19a15.92,15.92,0,0,0,0-29.88ZM137,164.22a8,8,0,0,0-4.74,4.74L112,223.85,91.78,169A8,8,0,0,0,87,164.22L32.15,144,87,123.78A8,8,0,0,0,91.78,119L112,64.15,132.22,119a8,8,0,0,0,4.74,4.74L191.85,144ZM144,40a8,8,0,0,1,8-8h16V16a8,8,0,0,1,16,0V32h16a8,8,0,0,1,0,16H184V64a8,8,0,0,1-16,0V48H152A8,8,0,0,1,144,40ZM248,88a8,8,0,0,1-8,8h-8v8a8,8,0,0,1-16,0V96h-8a8,8,0,0,1,0-16h8V72a8,8,0,0,1,16,0v8h8A8,8,0,0,1,248,88Z`}))],[`thin`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M196.2,132.81l-53.36-19.65L123.19,59.8a11.93,11.93,0,0,0-22.38,0L81.16,113.16,27.8,132.81a11.93,11.93,0,0,0,0,22.38l53.36,19.65,19.65,53.36a11.93,11.93,0,0,0,22.38,0l19.65-53.36,53.36-19.65a11.93,11.93,0,0,0,0-22.38Zm-2.77,14.87L138.35,168a4,4,0,0,0-2.37,2.37l-20.3,55.08a3.92,3.92,0,0,1-7.36,0L88,170.35A4,4,0,0,0,85.65,168l-55.08-20.3a3.92,3.92,0,0,1,0-7.36L85.65,120A4,4,0,0,0,88,117.65l20.3-55.08a3.92,3.92,0,0,1,7.36,0L136,117.65a4,4,0,0,0,2.37,2.37l55.08,20.3a3.92,3.92,0,0,1,0,7.36ZM148,40a4,4,0,0,1,4-4h20V16a4,4,0,0,1,8,0V36h20a4,4,0,0,1,0,8H180V64a4,4,0,0,1-8,0V44H152A4,4,0,0,1,148,40Zm96,48a4,4,0,0,1-4,4H228v12a4,4,0,0,1-8,0V92H208a4,4,0,0,1,0-8h12V72a4,4,0,0,1,8,0V84h12A4,4,0,0,1,244,88Z`}))]]),sM=new Map([[`bold`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M116,36V20a12,12,0,0,1,24,0V36a12,12,0,0,1-24,0Zm80,92a68,68,0,1,1-68-68A68.07,68.07,0,0,1,196,128Zm-24,0a44,44,0,1,0-44,44A44.05,44.05,0,0,0,172,128ZM51.51,68.49a12,12,0,1,0,17-17l-12-12a12,12,0,0,0-17,17Zm0,119-12,12a12,12,0,0,0,17,17l12-12a12,12,0,1,0-17-17ZM196,72a12,12,0,0,0,8.49-3.51l12-12a12,12,0,0,0-17-17l-12,12A12,12,0,0,0,196,72Zm8.49,115.51a12,12,0,0,0-17,17l12,12a12,12,0,0,0,17-17ZM48,128a12,12,0,0,0-12-12H20a12,12,0,0,0,0,24H36A12,12,0,0,0,48,128Zm80,80a12,12,0,0,0-12,12v16a12,12,0,0,0,24,0V220A12,12,0,0,0,128,208Zm108-92H220a12,12,0,0,0,0,24h16a12,12,0,0,0,0-24Z`}))],[`duotone`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M184,128a56,56,0,1,1-56-56A56,56,0,0,1,184,128Z`,opacity:`0.2`}),N.createElement(`path`,{d:`M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm72,88a64,64,0,1,1-64-64A64.07,64.07,0,0,1,192,128Zm-16,0a48,48,0,1,0-48,48A48.05,48.05,0,0,0,176,128ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z`}))],[`fill`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm8,24a64,64,0,1,0,64,64A64.07,64.07,0,0,0,128,64ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z`}))],[`light`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M122,40V16a6,6,0,0,1,12,0V40a6,6,0,0,1-12,0Zm68,88a62,62,0,1,1-62-62A62.07,62.07,0,0,1,190,128Zm-12,0a50,50,0,1,0-50,50A50.06,50.06,0,0,0,178,128ZM59.76,68.24a6,6,0,1,0,8.48-8.48l-16-16a6,6,0,0,0-8.48,8.48Zm0,119.52-16,16a6,6,0,1,0,8.48,8.48l16-16a6,6,0,1,0-8.48-8.48ZM192,70a6,6,0,0,0,4.24-1.76l16-16a6,6,0,0,0-8.48-8.48l-16,16A6,6,0,0,0,192,70Zm4.24,117.76a6,6,0,0,0-8.48,8.48l16,16a6,6,0,0,0,8.48-8.48ZM46,128a6,6,0,0,0-6-6H16a6,6,0,0,0,0,12H40A6,6,0,0,0,46,128Zm82,82a6,6,0,0,0-6,6v24a6,6,0,0,0,12,0V216A6,6,0,0,0,128,210Zm112-88H216a6,6,0,0,0,0,12h24a6,6,0,0,0,0-12Z`}))],[`regular`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M120,40V16a8,8,0,0,1,16,0V40a8,8,0,0,1-16,0Zm72,88a64,64,0,1,1-64-64A64.07,64.07,0,0,1,192,128Zm-16,0a48,48,0,1,0-48,48A48.05,48.05,0,0,0,176,128ZM58.34,69.66A8,8,0,0,0,69.66,58.34l-16-16A8,8,0,0,0,42.34,53.66Zm0,116.68-16,16a8,8,0,0,0,11.32,11.32l16-16a8,8,0,0,0-11.32-11.32ZM192,72a8,8,0,0,0,5.66-2.34l16-16a8,8,0,0,0-11.32-11.32l-16,16A8,8,0,0,0,192,72Zm5.66,114.34a8,8,0,0,0-11.32,11.32l16,16a8,8,0,0,0,11.32-11.32ZM48,128a8,8,0,0,0-8-8H16a8,8,0,0,0,0,16H40A8,8,0,0,0,48,128Zm80,80a8,8,0,0,0-8,8v24a8,8,0,0,0,16,0V216A8,8,0,0,0,128,208Zm112-88H216a8,8,0,0,0,0,16h24a8,8,0,0,0,0-16Z`}))],[`thin`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M124,40V16a4,4,0,0,1,8,0V40a4,4,0,0,1-8,0Zm64,88a60,60,0,1,1-60-60A60.07,60.07,0,0,1,188,128Zm-8,0a52,52,0,1,0-52,52A52.06,52.06,0,0,0,180,128ZM61.17,66.83a4,4,0,0,0,5.66-5.66l-16-16a4,4,0,0,0-5.66,5.66Zm0,122.34-16,16a4,4,0,0,0,5.66,5.66l16-16a4,4,0,0,0-5.66-5.66ZM192,68a4,4,0,0,0,2.83-1.17l16-16a4,4,0,1,0-5.66-5.66l-16,16A4,4,0,0,0,192,68Zm2.83,121.17a4,4,0,0,0-5.66,5.66l16,16a4,4,0,0,0,5.66-5.66ZM40,124H16a4,4,0,0,0,0,8H40a4,4,0,0,0,0-8Zm88,88a4,4,0,0,0-4,4v24a4,4,0,0,0,8,0V216A4,4,0,0,0,128,212Zm112-88H216a4,4,0,0,0,0,8h24a4,4,0,0,0,0-8Z`}))]]),cM=new Map([[`bold`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M216,48H180V36A28,28,0,0,0,152,8H104A28,28,0,0,0,76,36V48H40a12,12,0,0,0,0,24h4V208a20,20,0,0,0,20,20H192a20,20,0,0,0,20-20V72h4a12,12,0,0,0,0-24ZM100,36a4,4,0,0,1,4-4h48a4,4,0,0,1,4,4V48H100Zm88,168H68V72H188ZM116,104v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Zm48,0v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Z`}))],[`duotone`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M200,56V208a8,8,0,0,1-8,8H64a8,8,0,0,1-8-8V56Z`,opacity:`0.2`}),N.createElement(`path`,{d:`M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z`}))],[`fill`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM112,168a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm0-120H96V40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8Z`}))],[`light`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M216,50H174V40a22,22,0,0,0-22-22H104A22,22,0,0,0,82,40V50H40a6,6,0,0,0,0,12H50V208a14,14,0,0,0,14,14H192a14,14,0,0,0,14-14V62h10a6,6,0,0,0,0-12ZM94,40a10,10,0,0,1,10-10h48a10,10,0,0,1,10,10V50H94ZM194,208a2,2,0,0,1-2,2H64a2,2,0,0,1-2-2V62H194ZM110,104v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Zm48,0v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Z`}))],[`regular`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z`}))],[`thin`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M216,52H172V40a20,20,0,0,0-20-20H104A20,20,0,0,0,84,40V52H40a4,4,0,0,0,0,8H52V208a12,12,0,0,0,12,12H192a12,12,0,0,0,12-12V60h12a4,4,0,0,0,0-8ZM92,40a12,12,0,0,1,12-12h48a12,12,0,0,1,12,12V52H92ZM196,208a4,4,0,0,1-4,4H64a4,4,0,0,1-4-4V60H196ZM108,104v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Zm48,0v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Z`}))]]),lM=new Map([[`bold`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M256,136a12,12,0,0,1-12,12h-8v8a12,12,0,0,1-24,0v-8h-8a12,12,0,0,1,0-24h8v-8a12,12,0,0,1,24,0v8h8A12,12,0,0,1,256,136Zm-54.81,56.28a12,12,0,1,1-18.38,15.44C169.12,191.42,145,172,108,172c-28.89,0-55.46,12.68-74.81,35.72a12,12,0,0,1-18.38-15.44A124.08,124.08,0,0,1,63.5,156.53a72,72,0,1,1,89,0A124,124,0,0,1,201.19,192.28ZM108,148a48,48,0,1,0-48-48A48.05,48.05,0,0,0,108,148Z`}))],[`duotone`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M168,100a60,60,0,1,1-60-60A60,60,0,0,1,168,100Z`,opacity:`0.2`}),N.createElement(`path`,{d:`M256,136a8,8,0,0,1-8,8H232v16a8,8,0,0,1-16,0V144H200a8,8,0,0,1,0-16h16V112a8,8,0,0,1,16,0v16h16A8,8,0,0,1,256,136Zm-57.87,58.85a8,8,0,0,1-12.26,10.3C165.75,181.19,138.09,168,108,168s-57.75,13.19-77.87,37.15a8,8,0,0,1-12.25-10.3c14.94-17.78,33.52-30.41,54.17-37.17a68,68,0,1,1,71.9,0C164.6,164.44,183.18,177.07,198.13,194.85ZM108,152a52,52,0,1,0-52-52A52.06,52.06,0,0,0,108,152Z`}))],[`fill`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M256,136a8,8,0,0,1-8,8H232v16a8,8,0,0,1-16,0V144H200a8,8,0,0,1,0-16h16V112a8,8,0,0,1,16,0v16h16A8,8,0,0,1,256,136ZM144,157.68a68,68,0,1,0-71.9,0c-20.65,6.76-39.23,19.39-54.17,37.17A8,8,0,0,0,24,208H192a8,8,0,0,0,6.13-13.15C183.18,177.07,164.6,164.44,144,157.68Z`}))],[`light`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M254,136a6,6,0,0,1-6,6H230v18a6,6,0,0,1-12,0V142H200a6,6,0,0,1,0-12h18V112a6,6,0,0,1,12,0v18h18A6,6,0,0,1,254,136Zm-57.41,60.14a6,6,0,1,1-9.18,7.72C166.9,179.45,138.69,166,108,166s-58.89,13.45-79.41,37.86a6,6,0,0,1-9.18-7.72C35.14,177.41,55,164.48,77,158.25a66,66,0,1,1,62,0C161,164.48,180.86,177.41,196.59,196.14ZM108,154a54,54,0,1,0-54-54A54.06,54.06,0,0,0,108,154Z`}))],[`regular`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M256,136a8,8,0,0,1-8,8H232v16a8,8,0,0,1-16,0V144H200a8,8,0,0,1,0-16h16V112a8,8,0,0,1,16,0v16h16A8,8,0,0,1,256,136Zm-57.87,58.85a8,8,0,0,1-12.26,10.3C165.75,181.19,138.09,168,108,168s-57.75,13.19-77.87,37.15a8,8,0,0,1-12.25-10.3c14.94-17.78,33.52-30.41,54.17-37.17a68,68,0,1,1,71.9,0C164.6,164.44,183.18,177.07,198.13,194.85ZM108,152a52,52,0,1,0-52-52A52.06,52.06,0,0,0,108,152Z`}))],[`thin`,N.createElement(N.Fragment,null,N.createElement(`path`,{d:`M252,136a4,4,0,0,1-4,4H228v20a4,4,0,0,1-8,0V140H200a4,4,0,0,1,0-8h20V112a4,4,0,0,1,8,0v20h20A4,4,0,0,1,252,136Zm-56.94,61.43a4,4,0,0,1-6.12,5.14C168,177.7,139.3,164,108,164s-60,13.7-80.94,38.57a4,4,0,1,1-6.12-5.14c16.71-19.9,38.13-33.13,61.89-38.59a64,64,0,1,1,50.34,0C156.93,164.3,178.35,177.53,195.06,197.43ZM108,156a56,56,0,1,0-56-56A56.06,56.06,0,0,0,108,156Z`}))]]),uM=N.forwardRef((e,t)=>N.createElement(k,{ref:t,...e,weights:Xj}));uM.displayName=`ArrowLeftIcon`;var dM=uM,fM=N.forwardRef((e,t)=>N.createElement(k,{ref:t,...e,weights:Zj}));fM.displayName=`ArrowRightIcon`;var pM=fM,mM=N.forwardRef((e,t)=>N.createElement(k,{ref:t,...e,weights:Qj}));mM.displayName=`BookOpenIcon`;var hM=mM,gM=N.forwardRef((e,t)=>N.createElement(k,{ref:t,...e,weights:$j}));gM.displayName=`DotsThreeIcon`;var _M=gM,vM=N.forwardRef((e,t)=>N.createElement(k,{ref:t,...e,weights:eM}));vM.displayName=`MagnifyingGlassIcon`;var yM=vM,bM=N.forwardRef((e,t)=>N.createElement(k,{ref:t,...e,weights:tM}));bM.displayName=`MoonIcon`;var xM=bM,SM=N.forwardRef((e,t)=>N.createElement(k,{ref:t,...e,weights:nM}));SM.displayName=`PencilSimpleIcon`;var CM=SM,wM=N.forwardRef((e,t)=>N.createElement(k,{ref:t,...e,weights:rM}));wM.displayName=`PlugsConnectedIcon`;var TM=wM,EM=N.forwardRef((e,t)=>N.createElement(k,{ref:t,...e,weights:iM}));EM.displayName=`PlusIcon`;var DM=EM,OM=N.forwardRef((e,t)=>N.createElement(k,{ref:t,...e,weights:aM}));OM.displayName=`SignOutIcon`;var kM=OM,AM=N.forwardRef((e,t)=>N.createElement(k,{ref:t,...e,weights:oM}));AM.displayName=`SparkleIcon`;var jM=AM,MM=N.forwardRef((e,t)=>N.createElement(k,{ref:t,...e,weights:sM}));MM.displayName=`SunIcon`;var NM=MM,PM=N.forwardRef((e,t)=>N.createElement(k,{ref:t,...e,weights:cM}));PM.displayName=`TrashIcon`;var FM=PM,IM=N.forwardRef((e,t)=>N.createElement(k,{ref:t,...e,weights:lM}));IM.displayName=`UserPlusIcon`;var LM=IM,RM=class extends Error{status;problems;code;constructor(e,t,n=[],r=``){super(e),this.status=t,this.problems=n,this.code=r}},zM=`fanout:unauthorized`;function BM(){let e=new URLSearchParams(window.location.search).get(`return_to`);if(!e)return``;let t=new URL(e,window.location.origin);return t.origin!==window.location.origin||t.pathname!==`/api/auth/oauth/authorize`?``:`${t.pathname}${t.search}`}function VM(e){return!e||typeof e!=`object`||!(`id`in e)||typeof e.id!=`string`||e.id===``?`none`:`user`}function HM(){window.dispatchEvent(new Event(zM))}async function UM(e,t={}){let n=new Headers(t.headers);n.set(`Fanout-Request`,`1`);let r=await fetch(e,{...t,headers:n,credentials:`same-origin`});if(r.status===401&&HM(),r.status===403){let e=await r.clone().json().catch(()=>({}));throw new RM(e.message??`You do not have permission to perform this action.`,r.status,[],e.code??``)}return r}async function WM(){let e=await UM(`/api/auth/logout`,{method:`POST`});if(!e.ok&&e.status!==401)throw Error(`Sign-out failed — your session is still active.`);e.status!==401&&HM(),window.location.assign(`/`)}var GM=(0,N.createContext)(null);function KM(){let e=(0,N.useContext)(GM);if(!e)throw Error(`Fanout runtime status is unavailable`);return e}var qM=(0,N.createContext)(null);function JM(){let e=(0,N.useContext)(qM);if(!e)throw Error(`Fanout viewer is unavailable`);return e}function YM(e){if(!e||typeof e!=`object`)return null;let t=e;return typeof t.id!=`string`||t.id===``||t.status!==`active`&&t.status!==`suspended`?null:{id:t.id,email:typeof t.email==`string`?t.email:``,display_name:typeof t.display_name==`string`?t.display_name:``,status:t.status,role:typeof t.role==`string`?t.role:``}}async function XM(e,t){let n=await fetch(e,{method:t===void 0?`GET`:`POST`,headers:t===void 0?void 0:{"Content-Type":`application/json`},body:t===void 0?void 0:JSON.stringify(t),credentials:`same-origin`}),r=await n.json().catch(()=>({}));if(!n.ok)throw Error(r.message??`Request failed (${n.status})`);return r}function ZM({children:e,wide:t=!1}){return(0,P.jsx)(u,{mih:`100dvh`,style:{background:`radial-gradient(circle at 50% -12%, var(--mantine-color-brand-light), transparent 38%), linear-gradient(180deg, var(--mantine-color-default-hover), var(--mantine-color-body) 62%)`},children:(0,P.jsx)(Ae,{mih:`100dvh`,px:`md`,py:48,children:(0,P.jsx)(_e,{size:t?680:480,w:`100%`,children:(0,P.jsx)(Pe,{radius:28,p:{base:24,sm:40},style:{background:`var(--mantine-color-body)`,border:`1px solid var(--mantine-color-default-border)`,boxShadow:`var(--mantine-shadow-xl)`},children:e})})})})}function QM(){return typeof window>`u`?``:new URLSearchParams(window.location.search).get(`setup_token`)??``}function $M(){return typeof window>`u`?``:new URLSearchParams(window.location.search).get(`login_token`)??``}function eN({children:e}){let t=Re(),[n,r]=(0,N.useState)(null),[i,a]=(0,N.useState)(!1),[o,s]=(0,N.useState)(`none`),[c,l]=(0,N.useState)(null),[d,f]=(0,N.useState)(!1),[p,m]=(0,N.useState)(``),[h,g]=(0,N.useState)(``),[_,v]=(0,N.useState)(QM),[y,b]=(0,N.useState)($M),[x,S]=(0,N.useState)(``),[C,w]=(0,N.useState)(!1),[T,ee]=(0,N.useState)(0),[E,D]=(0,N.useState)(()=>Date.now()),[O,te]=(0,N.useState)(!1),[re,k]=(0,N.useState)(``),[ie,ae]=(0,N.useState)(null),[oe,ce]=(0,N.useState)(!1),ue=(0,N.useRef)(null),de=BM(),fe=o===`user`;async function me(){let e=await fetch(`/api/auth/me`,{credentials:`same-origin`});if(!e.ok){s(`none`),l(null);return}let t=await e.json().catch(()=>null);s(VM(t)),l(YM(t))}async function he(){try{let e=await fetch(`/api/auth/me`,{credentials:`same-origin`});if(!e.ok)return;l(YM(await e.json().catch(()=>null)))}catch{}}(0,N.useEffect)(()=>{let e=new URL(window.location.href);(e.searchParams.has(`setup_token`)||e.searchParams.has(`login_token`))&&(e.searchParams.delete(`setup_token`),e.searchParams.delete(`login_token`),t({href:e.pathname+e.search+e.hash,replace:!0}))},[t]),(0,N.useEffect)(()=>{XM(`/api/auth/status`).then(r).catch(e=>k(String(e))).finally(()=>a(!0)),me().catch(()=>s(`none`)).finally(()=>f(!0));let e=()=>{s(`none`),l(null)};return window.addEventListener(zM,e),()=>window.removeEventListener(zM,e)},[]),(0,N.useEffect)(()=>{d&&o===`none`&&y&&(te(!0),k(``),XM(`/api/auth/link/verify`,{token:y}).then(()=>{s(`user`),he()}).catch(e=>k(e instanceof Error?e.message:String(e))).finally(()=>{b(``),te(!1)}))},[y,d,o]),(0,N.useEffect)(()=>{fe&&d&&de&&window.location.replace(de)},[fe,de,d]),(0,N.useEffect)(()=>{if(T<=Date.now())return;let e=setInterval(()=>{D(Date.now()),Date.now()>=T&&clearInterval(e)},1e3);return()=>clearInterval(e)},[T]);let ge=Math.max(0,Math.ceil((T-E)/1e3));(0,N.useEffect)(()=>{C&&!O&&re&&ue.current?.querySelector(`input`)?.focus()},[O,C,re]);async function _e(e){try{await navigator.clipboard.writeText(e),ce(!0)}catch{k(`Clipboard access failed. Select and copy the token manually.`)}}if(ie?.ingest_token)return(0,P.jsx)(ZM,{wide:!0,children:(0,P.jsxs)(A,{gap:`lg`,children:[(0,P.jsx)(Oe,{}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(le,{c:`brand`,fw:700,size:`xs`,tt:`uppercase`,lts:`0.12em`,children:`Setup complete`}),(0,P.jsx)(be,{order:1,mt:`xs`,fz:{base:28,sm:32},lh:1.08,children:`Save your ingest token`})]}),(0,P.jsx)(le,{c:`dimmed`,children:`Fanout shows this token once. Store it with your collector secrets before continuing.`}),(0,P.jsxs)(A,{gap:`xs`,children:[(0,P.jsx)(le,{size:`sm`,fw:600,children:`OTLP endpoint`}),(0,P.jsx)(ps,{block:!0,children:ie.suggested_endpoint??window.location.origin})]}),(0,P.jsxs)(A,{gap:`xs`,children:[(0,P.jsx)(le,{size:`sm`,fw:600,children:`Header`}),(0,P.jsxs)(ps,{block:!0,children:[ie.ingest_header_name??`Authorization`,`: Bearer `,ie.ingest_token]})]}),re&&(0,P.jsx)(Se,{color:`bad`,radius:`md`,children:re}),(0,P.jsxs)(ne,{grow:!0,align:`stretch`,children:[(0,P.jsx)(se,{variant:`light`,radius:`md`,leftSection:oe?(0,P.jsx)(pe,{size:16,weight:`bold`}):(0,P.jsx)(Te,{size:16}),onClick:()=>void _e(`${ie.ingest_header_name??`Authorization`}: Bearer ${ie.ingest_token}`),children:oe?`Copied`:`Copy header`}),(0,P.jsx)(se,{radius:`md`,rightSection:(0,P.jsx)(pM,{size:16,weight:`bold`}),onClick:()=>{s(`user`),ae(null),he()},children:`Continue to Fanout`})]}),(0,P.jsx)(se,{variant:`subtle`,size:`compact-xs`,onClick:()=>void _e(ie.ingest_token??``),children:`Copy token only`})]})});if(!d||!i||y)return(0,P.jsx)(Ae,{mih:`100dvh`,children:(0,P.jsx)(Fe,{size:`sm`})});if(!n)return(0,P.jsx)(ZM,{children:(0,P.jsxs)(A,{gap:`lg`,children:[(0,P.jsx)(Oe,{}),(0,P.jsx)(be,{order:1,children:`Fanout is unavailable`}),(0,P.jsx)(Se,{color:`bad`,radius:`md`,children:re||`Authentication status could not be loaded.`})]})});if(fe&&de)return null;if(fe)return(0,P.jsx)(GM.Provider,{value:n,children:(0,P.jsx)(qM.Provider,{value:c??{id:``,email:p,display_name:h,status:`active`,role:``},children:e})});if(n&&!n.setup_required&&n.auth_mode===`oidc`){let e=de?`/api/auth/oidc/start?return_to=${encodeURIComponent(de)}`:`/api/auth/oidc/start`;return(0,P.jsx)(ZM,{children:(0,P.jsxs)(A,{gap:28,children:[(0,P.jsx)(Oe,{}),(0,P.jsxs)(A,{gap:10,children:[(0,P.jsx)(le,{c:`brand`,fw:700,size:`xs`,tt:`uppercase`,lts:`0.12em`,children:`Secure workspace`}),(0,P.jsx)(be,{order:1,fz:{base:28,sm:32},lh:1.08,children:`Sign in`}),(0,P.jsx)(le,{c:`dimmed`,size:`md`,lh:1.6,children:`Use your organization's identity provider to continue.`})]}),re&&(0,P.jsx)(Se,{color:`bad`,radius:`md`,children:re}),(0,P.jsx)(se,{component:`a`,href:e,size:`md`,radius:`md`,rightSection:(0,P.jsx)(pM,{size:17,weight:`bold`}),children:`Continue with SSO`})]})})}async function ve(){te(!0),k(``);try{await XM(`/api/auth/code/send`,{email:p}),w(!0),S(``),ee(Date.now()+3e4),D(Date.now())}catch(e){k(e instanceof Error?e.message:String(e))}finally{te(!1)}}async function j(e){te(!0),k(``);try{await XM(`/api/auth/code/verify`,{email:p,code:e}),s(`user`),w(!1),S(``),ee(0),he()}catch(e){S(``),k(e instanceof Error?e.message:String(e))}finally{te(!1)}}function M(){w(!1),S(``),k(``)}async function ye(e){e.preventDefault(),te(!0),k(``);try{if(n?.setup_required){let e=await XM(`/api/auth/setup`,{email:p,display_name:h,setup_token:_});e.ingest_token?ae(e):(s(`user`),he())}else if(C){await j(x);return}else{await ve();return}}catch(e){k(e instanceof Error?e.message:String(e))}finally{te(!1)}}let xe=C&&!n?.setup_required,Ce=n?.setup_required?`Create the first admin`:xe?`Check your email`:n?.self_signup?`Sign in or create an account`:`Sign in`,we=n?.setup_required?`Use the one-time token printed by the Fanout process.`:n?.smtp_configured?xe?`We sent a code to ${p}.`:n?.self_signup?`Enter your email to sign in or create a viewer account. No password needed.`:`Enter your email and we’ll send a short verification code. No password needed.`:`Email delivery is not configured. Ask the operator to run fanout login-link with your email address.`;return(0,P.jsx)(ZM,{children:(0,P.jsxs)(A,{gap:28,children:[(0,P.jsx)(Oe,{}),(0,P.jsxs)(A,{gap:10,children:[(0,P.jsx)(le,{c:`brand`,fw:700,size:`xs`,tt:`uppercase`,lts:`0.12em`,children:n?.setup_required?`One-time setup`:`Secure workspace`}),(0,P.jsx)(be,{order:1,fz:{base:28,sm:32},lh:1.08,children:Ce}),we&&(0,P.jsx)(le,{c:`dimmed`,size:`md`,lh:1.6,maw:390,children:we})]}),(0,P.jsx)(`form`,{onSubmit:ye,children:(0,P.jsxs)(A,{gap:`md`,children:[(0,P.jsx)(Wc,{label:`Email`,placeholder:`you@company.com`,type:`email`,required:!0,value:p,onChange:e=>m(e.currentTarget.value),disabled:C,variant:`filled`,radius:`md`,size:`md`,autoFocus:!C}),n?.setup_required&&(0,P.jsx)(Wc,{label:`Display name`,placeholder:`Your display name`,value:h,onChange:e=>g(e.currentTarget.value),variant:`filled`,radius:`md`,size:`md`}),n?.setup_required&&(0,P.jsx)(Wc,{label:`Setup token`,placeholder:`from the setup URL printed at startup`,required:!0,value:_,onChange:e=>v(e.currentTarget.value),autoComplete:`one-time-code`,variant:`filled`,radius:`md`,size:`md`}),xe&&(0,P.jsxs)(A,{gap:`xs`,children:[(0,P.jsx)(le,{size:`sm`,fw:600,children:`Verification code`}),(0,P.jsx)(u,{ref:ue,children:(0,P.jsx)(Uc,{length:6,type:`number`,oneTimeCode:!0,autoFocus:!0,value:x,onChange:S,onComplete:e=>void j(e),disabled:O,error:!!re,size:`md`,radius:`md`,"aria-label":`Verification code`,getInputProps:e=>({"aria-label":`Digit ${e+1}`})})}),(0,P.jsxs)(ne,{justify:`space-between`,gap:`xs`,children:[(0,P.jsxs)(le,{c:`dimmed`,size:`xs`,children:[`Sent to `,p]}),(0,P.jsx)(se,{variant:`subtle`,size:`compact-xs`,leftSection:(0,P.jsx)(dM,{size:12,weight:`bold`}),onClick:M,disabled:O,children:`Change email`})]}),(0,P.jsxs)(ne,{justify:`space-between`,gap:`xs`,children:[(0,P.jsx)(le,{c:`dimmed`,size:`xs`,children:`Codes expire in 5 minutes`}),(0,P.jsx)(se,{variant:`subtle`,size:`compact-xs`,onClick:()=>void ve(),disabled:O||ge>0,children:ge>0?`Resend in ${ge}s`:`Resend code`})]})]}),re&&(0,P.jsx)(Se,{color:`bad`,radius:`md`,children:re}),xe?(0,P.jsx)(se,{type:`submit`,size:`md`,radius:`md`,mt:4,loading:O,disabled:O||x.length<6,rightSection:(0,P.jsx)(pM,{size:17,weight:`bold`}),children:`Verify code`}):(0,P.jsx)(se,{type:`submit`,size:`md`,radius:`md`,mt:4,loading:O,disabled:!n||!n.setup_required&&!n.smtp_configured,leftSection:n?.setup_required?(0,P.jsx)(LM,{size:17,weight:`bold`}):void 0,rightSection:n?.setup_required?void 0:(0,P.jsx)(pM,{size:17,weight:`bold`}),children:n?.setup_required?`Create admin`:`Send code`})]})})]})})}var tN=[`agent-threads`];async function nN(e){let t=await UM(e);if(!t.ok)throw Error(`Request failed (${t.status})`);return t.json()}var rN=[];for(let e=0;e<256;++e)rN.push((e+256).toString(16).slice(1));function iN(e,t=0){return(rN[e[t+0]]+rN[e[t+1]]+rN[e[t+2]]+rN[e[t+3]]+`-`+rN[e[t+4]]+rN[e[t+5]]+`-`+rN[e[t+6]]+rN[e[t+7]]+`-`+rN[e[t+8]]+rN[e[t+9]]+`-`+rN[e[t+10]]+rN[e[t+11]]+rN[e[t+12]]+rN[e[t+13]]+rN[e[t+14]]+rN[e[t+15]]).toLowerCase()}var aN=new Uint8Array(16);function oN(){return crypto.getRandomValues(aN)}var sN={};function cN(e,t,n){let r;if(e)r=uN(e.random??e.rng?.()??oN(),e.msecs,e.seq,t,n);else{let e=Date.now(),i=oN();lN(sN,e,i),r=uN(i,sN.msecs,sN.seq,t,n)}return t??iN(r)}function lN(e,t,n){return e.msecs??=-1/0,e.seq??=0,t>e.msecs?(e.seq=dN(n),e.msecs=t):(e.seq=e.seq+1|0,e.seq===0&&e.msecs++),e}function uN(e,t,n,r,i=0){if(e.length<16)throw Error(`Random bytes length must be >= 16`);if(!r)r=new Uint8Array(16),i=0;else if(i<0||i+16>r.length)throw RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);return t??=Date.now(),n??=dN(e),r[i++]=t/1099511627776&255,r[i++]=t/4294967296&255,r[i++]=t/16777216&255,r[i++]=t/65536&255,r[i++]=t/256&255,r[i++]=t&255,r[i++]=112|n>>>28&15,r[i++]=n>>>20&255,r[i++]=128|n>>>14&63,r[i++]=n>>>6&255,r[i++]=n<<2&255|e[10]&3,r[i++]=e[11],r[i++]=e[12],r[i++]=e[13],r[i++]=e[14],r[i++]=e[15],r}function dN(e){return(e[6]&127)<<24|e[7]<<16|e[8]<<8|e[9]}function fN(){return cN()}var pN=[`dashboards`],mN=3e4;async function hN(e,t){let{json:n,...r}=t??{},i=new Headers(r.headers),a=r.body;n!==void 0&&(i.set(`content-type`,`application/json`),a=JSON.stringify(n));let o=await UM(e,{...r,headers:i,body:a}),s=await o.json().catch(()=>({}));if(!o.ok)throw new RM(s.message??`Request failed (${o.status})`,o.status,s.problems??[],s.code??``);return s}var gN=e=>`/api/dashboards/${encodeURIComponent(e)}`,_N=()=>hN(`/api/dashboards`).then(e=>e.dashboards),vN=(e,t)=>hN(gN(e),{signal:t}),yN=(e,t)=>hN(`${gN(e)}/versions`,{signal:t}).then(e=>e.versions),bN=(e,t,n)=>hN(`${gN(e)}/versions/${t}`,{signal:n}),xN=(e,t)=>hN(`${gN(e)}/versions/${t}/restore`,{method:`POST`}),SN=(e,t,n,r)=>hN(gN(e),{method:`PUT`,json:{spec:t,base_version:n,message:r}}),CN=(e,t,n,r)=>hN(gN(e),{method:`PATCH`,json:{operations:t,base_version:n,message:r}}),wN=(e,t)=>hN(`/api/panels/query`,{method:`POST`,json:e,signal:t}).then(e=>e.results),TN=e=>hN(`/api/telemetry/schema`,{signal:e}),EN=(e,t)=>hN(`/api/annotations`,{method:`POST`,json:e,signal:t}),DN=(e,t)=>hN(`/api/panels/variables/resolve`,{method:`POST`,json:e,signal:t}).then(e=>e.options),ON=(e,t)=>hN(`/api/panels/exemplars`,{method:`POST`,json:e,signal:t});function kN(e,t){let n=new URLSearchParams({namespace:e.namespace??``,from:e.window_from,to:e.window_to,limit:`200`});return hN(`/api/traces/${encodeURIComponent(e.trace_id??``)}?${n}`,{signal:t})}function AN(){let{setColorScheme:e}=zr(),t=Hr(`light`,{getInitialValueInEffect:!0}),n=t===`dark`?`light`:`dark`,[r,i]=(0,N.useState)(!1);return(0,P.jsx)(Dt,{label:`Switch to ${n} theme`,opened:r,children:(0,P.jsx)(Ni,{variant:`subtle`,color:`gray`,"aria-label":`Switch to ${n} theme`,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),onFocus:()=>i(!0),onBlur:()=>i(!1),onClick:()=>{i(!1),e(n)},children:t===`dark`?(0,P.jsx)(NM,{size:17,weight:`bold`}):(0,P.jsx)(xM,{size:17,weight:`bold`})})})}var jN={home:`https://fanout.run/start/what-fanout-is`,ingest:`https://fanout.run/start/send-telemetry`};async function MN(e,t){let n=new URLSearchParams({page_size:`30`});e&&n.set(`q`,e),t&&n.set(`cursor`,t);let r=await UM(`/api/agent/threads?${n}`);if(!r.ok)throw Error(`Unable to load chats (${r.status})`);return r.json()}function NN({agentAvailable:e,activeThreadID:t,activeDashboardID:n,autoFocusSearch:r=!1,onNewChat:i,onSelectThread:a,onDeletedThread:o,onSelectDashboard:s,onCreateDashboard:c,onInvestigateService:l,ref:u}){let d=TA(),[f,p]=(0,N.useState)(``),[m]=fr(f.trim(),250),[h,g]=(0,N.useState)(null),[_,v]=(0,N.useState)(null),[y,b]=(0,N.useState)(``),[x,S]=(0,N.useState)(``),[w,T]=(0,N.useState)(!1),ee=(0,N.useRef)(null);(0,N.useImperativeHandle)(u,()=>({focusSearch:()=>ee.current?.focus()}),[]),(0,N.useEffect)(()=>{r&&requestAnimationFrame(()=>ee.current?.focus())},[r]);let E=Yj({queryKey:[...tN,m],queryFn:({pageParam:e})=>MN(m,e),initialPageParam:``,getNextPageParam:e=>e.next_cursor??void 0,enabled:e}),D=Jj({queryKey:pN,queryFn:_N,refetchInterval:3e4,staleTime:mN}),O=(0,N.useMemo)(()=>E.data?.pages.flatMap(e=>e.items)??[],[E.data]),te=(0,N.useMemo)(()=>zN(O),[O]),re=Jj({queryKey:[`telemetry-schema`,`1h`],queryFn:()=>nN(`/api/telemetry/schema?window=1h`),enabled:!!m&&!!l,staleTime:6e4}),k=(0,N.useMemo)(()=>{if(!m)return[];let e=m.toLowerCase();return(re.data?.services??[]).map(e=>e.value).filter(t=>t.toLowerCase().includes(e)).slice(0,6)},[re.data,m]),ie=(0,N.useMemo)(()=>{let e=D.data??[],t=m.toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)):e},[D.data,m]);function ae(e){S(``),b(e.title),g(e)}async function oe(){if(h&&y.trim()){T(!0),S(``);try{let e=await UM(`/api/agent/threads/${encodeURIComponent(h.id)}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({title:y.trim()})});if(!e.ok)throw Error(`Unable to rename chat (${e.status})`);await d.invalidateQueries({queryKey:tN}),g(null)}catch(e){S(e instanceof Error?e.message:`Unable to rename this chat.`)}finally{T(!1)}}}async function ce(){if(_){T(!0),S(``);try{let e=await UM(`/api/agent/threads/${encodeURIComponent(_.id)}`,{method:`DELETE`});if(!e.ok)throw Error(`Unable to delete chat (${e.status})`);let t=_.id;v(null),await d.invalidateQueries({queryKey:tN}),await d.invalidateQueries({queryKey:pN}),o(t)}catch(e){S(e instanceof Error?e.message:`Unable to delete this chat.`)}finally{T(!1)}}}return(0,P.jsxs)(A,{gap:`sm`,h:`100%`,component:`nav`,"aria-label":`Navigation`,children:[e&&(0,P.jsx)(se,{leftSection:(0,P.jsx)(DM,{size:16,weight:`bold`}),onClick:i,children:`New chat`}),(0,P.jsx)(Ct,{type:`auto`,offsetScrollbars:!0,flex:1,mx:-4,px:4,children:(0,P.jsxs)(A,{gap:`lg`,pb:`sm`,children:[e&&(0,P.jsxs)(A,{gap:4,children:[(0,P.jsx)(PN,{children:`Chats`}),E.isLoading&&(0,P.jsx)(Ae,{py:`md`,children:(0,P.jsx)(Fe,{size:`xs`})}),E.isError&&(0,P.jsx)(Se,{color:`bad`,radius:`md`,p:`xs`,children:`Chats could not be loaded.`}),!E.isLoading&&!E.isError&&O.length===0&&(0,P.jsx)(le,{c:`dimmed`,size:`sm`,px:`sm`,py:`xs`,children:m?`No matching chats`:`No chats yet`}),te.map(e=>(0,P.jsxs)(A,{gap:2,children:[te.length>1&&(0,P.jsx)(le,{c:`dimmed`,size:`xs`,px:`sm`,pt:4,children:e.label}),e.threads.map(e=>(0,P.jsx)(FN,{thread:e,active:e.id===t,onSelect:()=>a(e.id),onRename:()=>ae(e),onDelete:()=>{S(``),v(e)}},e.id))]},e.label)),E.hasNextPage&&(0,P.jsx)(se,{variant:`subtle`,color:`gray`,size:`compact-sm`,loading:E.isFetchingNextPage,onClick:()=>void E.fetchNextPage(),children:`See all`})]}),m&&l&&re.isLoading&&(0,P.jsx)(Ae,{py:`md`,children:(0,P.jsx)(Fe,{size:`xs`})}),m&&l&&(re.isSuccess||re.isError)&&(0,P.jsxs)(A,{gap:4,children:[(0,P.jsx)(PN,{children:`Services`}),re.isError&&(0,P.jsx)(le,{c:`dimmed`,size:`sm`,px:`sm`,children:`Services could not be searched`}),re.isSuccess&&k.length===0&&(0,P.jsx)(le,{c:`dimmed`,size:`sm`,px:`sm`,children:`No matching services`}),k.map(e=>(0,P.jsx)(C,{className:`rail-row`,p:`sm`,onClick:()=>l(e),children:(0,P.jsx)(le,{size:`sm`,fw:500,truncate:!0,children:e})},e))]}),(0,P.jsxs)(A,{gap:4,children:[(0,P.jsx)(PN,{children:`Dashboards`}),D.isLoading&&(0,P.jsx)(Ae,{py:`md`,children:(0,P.jsx)(Fe,{size:`xs`})}),D.isError&&(0,P.jsx)(Se,{color:`bad`,radius:`md`,p:`xs`,children:`Dashboards could not be loaded.`}),!D.isLoading&&!D.isError&&m&&ie.length===0&&(0,P.jsx)(le,{c:`dimmed`,size:`sm`,px:`sm`,py:`xs`,children:`No matching dashboards`}),ie.map(e=>{let t=e.id===n;return(0,P.jsxs)(A,{gap:0,children:[(0,P.jsx)(C,{component:`a`,href:`/dashboards/${encodeURIComponent(e.id)}`,className:`rail-row`,"data-active":t||void 0,"aria-current":t?`page`:void 0,p:`sm`,onClick:t=>{t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||(t.preventDefault(),s(e.id))},children:(0,P.jsxs)(ne,{justify:`space-between`,gap:`sm`,wrap:`nowrap`,children:[(0,P.jsx)(le,{size:`sm`,fw:t?600:500,truncate:!0,children:e.name}),e.is_default&&(0,P.jsx)(ss,{size:`xs`,variant:`light`,color:`gray`,children:`Default`})]})}),e.origin&&(0,P.jsx)(C,{component:`a`,href:`/chat/${encodeURIComponent(e.origin.thread_id)}`,"data-request-provenance":!0,px:`sm`,pb:`xs`,onClick:t=>{t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||(t.preventDefault(),a(e.origin.thread_id))},children:(0,P.jsxs)(le,{size:`xs`,c:`dimmed`,lineClamp:2,children:[`Built from: `,e.origin.request_excerpt]})})]},e.id)}),e&&(0,P.jsx)(se,{variant:`subtle`,color:`gray`,size:`compact-sm`,justify:`flex-start`,leftSection:(0,P.jsx)(jM,{size:14,weight:`fill`}),onClick:c,children:D.data?.length===0?`New dashboard`:`Create with AI`})]})]})}),(0,P.jsx)(Wc,{ref:ee,value:f,onChange:e=>p(e.currentTarget.value),leftSection:(0,P.jsx)(yM,{size:15}),rightSection:(0,P.jsx)(Is,{size:`xs`,children:`⌘K`}),rightSectionWidth:44,placeholder:`Search`,"aria-label":`Search chats, dashboards and services`,size:`sm`}),(0,P.jsx)(Lc,{opened:h!==null,onClose:()=>!w&&g(null),title:`Rename chat`,centered:!0,children:(0,P.jsx)(`form`,{onSubmit:e=>{e.preventDefault(),oe()},children:(0,P.jsxs)(A,{children:[(0,P.jsx)(Wc,{label:`Name`,value:y,onChange:e=>b(e.currentTarget.value),maxLength:120,autoFocus:!0}),x&&(0,P.jsx)(Se,{color:`bad`,children:x}),(0,P.jsxs)(ne,{justify:`flex-end`,children:[(0,P.jsx)(se,{variant:`default`,onClick:()=>g(null),disabled:w,children:`Cancel`}),(0,P.jsx)(se,{type:`submit`,loading:w,disabled:!y.trim(),children:`Save`})]})]})})}),(0,P.jsx)(Lc,{opened:_!==null,onClose:()=>!w&&v(null),title:`Delete chat?`,centered:!0,children:(0,P.jsxs)(A,{children:[(0,P.jsxs)(le,{size:`sm`,children:[`This permanently removes `,(0,P.jsx)(le,{span:!0,fw:650,children:_?.title}),` and its saved messages.`]}),x&&(0,P.jsx)(Se,{color:`bad`,children:x}),(0,P.jsxs)(ne,{justify:`flex-end`,children:[(0,P.jsx)(se,{variant:`default`,onClick:()=>v(null),disabled:w,children:`Cancel`}),(0,P.jsx)(se,{color:`bad`,loading:w,onClick:()=>void ce(),children:`Delete`})]})]})})]})}function PN({children:e}){return(0,P.jsx)(le,{c:`dimmed`,size:`xs`,fw:700,tt:`uppercase`,lts:`0.08em`,px:`sm`,children:e})}function FN({thread:e,active:t,onSelect:n,onRename:r,onDelete:i}){return(0,P.jsx)(u,{"data-active":t||void 0,className:`rail-row`,children:(0,P.jsxs)(ne,{gap:2,wrap:`nowrap`,children:[(0,P.jsx)(C,{onClick:n,"aria-current":t?`page`:void 0,p:`sm`,flex:1,style:{minWidth:0},children:(0,P.jsxs)(A,{gap:0,children:[(0,P.jsx)(le,{size:`sm`,fw:t?600:500,truncate:!0,children:e.title}),(0,P.jsx)(le,{c:`dimmed`,size:`xs`,children:BN(e.updated_at)})]})}),(0,P.jsxs)(xc,{position:`bottom-end`,withinPortal:!0,children:[(0,P.jsx)(xc.Target,{children:(0,P.jsx)(Ni,{className:`rail-row-actions`,variant:`subtle`,color:`gray`,size:`sm`,mr:4,"aria-label":`Actions for ${e.title}`,children:(0,P.jsx)(_M,{size:18,weight:`bold`})})}),(0,P.jsxs)(xc.Dropdown,{children:[(0,P.jsx)(xc.Item,{leftSection:(0,P.jsx)(CM,{size:15}),onClick:r,children:`Rename`}),(0,P.jsx)(xc.Item,{color:`bad`,leftSection:(0,P.jsx)(FM,{size:15}),onClick:i,children:`Delete`})]})]})]})})}function IN(e){return e.includes(`T`)?new Date(e):new Date(`${e.replace(` `,`T`)}Z`)}function LN(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}var RN=[`Today`,`Yesterday`,`Previous 7 days`,`Older`];function zN(e){let t=LN(new Date),n=new Map;for(let r of e){let e=Math.floor((t-LN(IN(r.updated_at)))/864e5),i=e<=0?`Today`:e===1?`Yesterday`:e<=7?`Previous 7 days`:`Older`,a=n.get(i)??[];a.push(r),n.set(i,a)}return RN.filter(e=>n.has(e)).map(e=>({label:e,threads:n.get(e)}))}function BN(e){let t=IN(e),n=LN(new Date);return Math.floor((n-LN(t))/864e5)<=1?new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(t):new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`}).format(t)}function VN({children:e}){let{agentAvailable:t,threadID:n,threadMissing:r,newThread:i,selectThread:a,openChat:o}=rt(),s=Re(),c=Yn({select:e=>e.location.pathname}),{dashboardId:l}=xn({strict:!1}),u=c===`/chat`||c.startsWith(`/chat/`),[d,f]=Er(!1),[p,m]=(0,N.useState)(!1),[h,g]=(0,N.useState)(``),_=(0,N.useRef)(null),v=ie(`(max-width: 62em)`),y=(0,N.useRef)(v);y.current=v,(0,N.useEffect)(()=>{f.close()},[c]),(0,N.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),y.current?(m(!0),f.open()):_.current?.focusSearch())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let b={agentAvailable:t,activeThreadID:u&&!r&&c!==`/chat`?n:void 0,activeDashboardID:l,onNewChat:i,onSelectThread:a,onDeletedThread:e=>{e===n&&i()},onSelectDashboard:e=>void s({to:`/dashboards/$dashboardId`,params:{dashboardId:e},search:{}}),onCreateDashboard:()=>o(Qe),onInvestigateService:e=>o(`Investigate the ${e} service. Explain its errors and latency.`)};return(0,P.jsxs)(qo,{header:{height:52},navbar:{width:256,breakpoint:`md`,collapsed:{mobile:!0}},padding:0,children:[(0,P.jsx)(qo.Header,{children:(0,P.jsxs)(ne,{h:`100%`,px:{base:`sm`,sm:`md`},justify:`space-between`,wrap:`nowrap`,children:[(0,P.jsxs)(ne,{gap:`sm`,wrap:`nowrap`,children:[(0,P.jsx)(us,{hiddenFrom:`md`,opened:d,onClick:()=>{m(!1),f.toggle()},size:`sm`,"aria-label":d?`Close navigation`:`Open navigation`}),(0,P.jsx)(Oe,{size:`small`})]}),(0,P.jsxs)(ne,{gap:`xs`,wrap:`nowrap`,children:[(0,P.jsx)(Dt,{label:`Documentation`,children:(0,P.jsx)(Ni,{component:`a`,href:jN.home,target:`_blank`,rel:`noopener noreferrer`,variant:`subtle`,color:`gray`,"aria-label":`Documentation`,children:(0,P.jsx)(hM,{size:17,weight:`bold`})})}),(0,P.jsx)(AN,{}),(0,P.jsx)(HN,{onError:g})]})]})}),(0,P.jsx)(qo.Navbar,{p:`sm`,children:(0,P.jsx)(NN,{ref:_,...b})}),(0,P.jsx)(Ns,{opened:d,onClose:f.close,hiddenFrom:`md`,size:288,padding:`sm`,title:(0,P.jsx)(Oe,{size:`small`}),overlayProps:{backgroundOpacity:.24,blur:1},children:(0,P.jsx)(NN,{...b,autoFocusSearch:d&&p})}),(0,P.jsxs)(qo.Main,{children:[h&&(0,P.jsx)(Se,{color:`bad`,m:`md`,withCloseButton:!0,onClose:()=>g(``),children:h}),e]})]})}function HN({onError:e}){let t=Re(),n=JM(),r=(n.display_name.trim()||n.email.trim()||`?`).charAt(0).toUpperCase();return(0,P.jsxs)(xc,{position:`bottom-end`,withinPortal:!0,shadow:`md`,children:[(0,P.jsx)(xc.Target,{children:(0,P.jsx)(Ni,{variant:`subtle`,color:`gray`,size:`lg`,radius:`xl`,"aria-label":`${r} account menu`,children:(0,P.jsx)(is,{size:26,radius:`xl`,color:`brand`,children:r})})}),(0,P.jsxs)(xc.Dropdown,{children:[(0,P.jsx)(xc.Label,{children:n.email||`Signed in`}),(0,P.jsx)(xc.Item,{leftSection:(0,P.jsx)(TM,{size:15}),onClick:()=>void t({to:`/settings`}),children:`Connect telemetry`}),(0,P.jsx)(xc.Divider,{}),(0,P.jsx)(xc.Item,{leftSection:(0,P.jsx)(kM,{size:15}),onClick:()=>void WM().catch(t=>e(t instanceof Error?t.message:`Sign-out failed — your session is still active.`)),children:`Sign out`})]})]})}function UN(){let{agent_available:e}=KM(),t=Re(),n=TA(),{threadId:r}=xn({strict:!1}),[i,a]=(0,N.useState)(fN),o=(0,N.useRef)(new Set),s=r??i,[c,l]=(0,N.useState)([]),[u,d]=(0,N.useState)({}),[f,p]=(0,N.useState)(``),[m,h]=(0,N.useState)(!1),[g,_]=(0,N.useState)(!1),[v,y]=(0,N.useState)(``),[b,x]=(0,N.useState)(null),S=(0,N.useRef)(null),[C,w]=(0,N.useState)(!1),T=(0,N.useRef)(!1),[ee,E]=(0,N.useState)(``),[D,O]=(0,N.useState)(``),[te,ne]=(0,N.useState)(0),re=(0,N.useRef)(null),k=(0,N.useRef)({}),ie=(0,N.useRef)(null),ae=(0,N.useRef)(new Map),A=(0,N.useMemo)(()=>new CA({url:`/api/agent/runs`,threadId:s,fetch:(e,t)=>UM(e,t)}),[s]),oe=!e||f===s;function se(){ae.current.clear(),y(``),S.current=null,x(null)}let ce=e=>e.filter(e=>e.role!==`reasoning`);function le(){let e=S.current?.text.split(/(?<=[.!?])\s/)[0]?.trim().replace(/[.!?]+$/,``);return e?e+`…`:``}function ue(e){return T.current||e instanceof Error&&e.name===`AbortError`}(0,N.useEffect)(()=>{let t=!0;if(l([]),k.current={},d({}),p(``),h(!1),_(!1),T.current=!1,w(!1),se(),O(``),!e){p(s);return}!r||o.current.has(s)?(A.setMessages([]),p(s)):UM(`/api/agent/threads/${encodeURIComponent(s)}`).then(async e=>{if(e.status===404)return null;if(!e.ok)throw Error(`Unable to load thread (${e.status})`);return e.json()}).then(e=>{if(t){if(e===null){h(!0),p(s);return}A.setMessages(ce(e.messages??[])),l(ce(e.messages??[])),p(s)}}).catch(()=>{t&&(re.current=null,O(`This chat could not be restored. Start a new chat or try again.`))});let i=A.subscribe({onEvent:({event:e,messages:t})=>{switch(e.type){case`REASONING_MESSAGE_START`:return S.current={id:e.messageId,text:``,collapsed:!1},x(S.current),y(``),{stopPropagation:!0};case`REASONING_MESSAGE_CONTENT`:{let t=e,n={id:t.messageId,text:(S.current?.text??``)+t.delta,collapsed:!1};return S.current=n,x(n),{stopPropagation:!0}}case`REASONING_START`:case`REASONING_MESSAGE_END`:case`REASONING_END`:return{stopPropagation:!0};default:l(ce(t))}},onMessagesChanged:({messages:e})=>l(ce(e)),onRunInitialized:()=>{T.current=!1,w(!1),_(!0),O(``)},onTextMessageContentEvent:({event:e})=>{e.delta&&(S.current=null,x(null),y(``))},onToolCallStartEvent:({event:e})=>{ae.current.set(e.toolCallId,nt(e.toolCallName)),y(nt(e.toolCallName)),S.current&&(S.current={...S.current,collapsed:!0},x(S.current))},onToolCallResultEvent:({event:e,messages:t})=>{ae.current.delete(e.toolCallId),y([...ae.current.values()].at(-1)??le());let r=at(e.toolCallId,e.content,t);r&&(n.invalidateQueries({queryKey:pN}),n.invalidateQueries({queryKey:[`dashboard`,r.id]}),n.invalidateQueries({queryKey:[`dashboard-versions`,r.id]}))},onRunErrorEvent:({event:e})=>{e.code===`abort`||T.current?(O(``),w(!0)):(console.warn(`Agent run error`,e.code),O(Ye(e.code))),_(!1),se()},onRunFinalized:({messages:e})=>{let t=ce(e);l(t),d(e=>{let n={...e};for(let e of t)e.role===`assistant`&&!n[e.id]&&(n[e.id]=Date.now());return n}),_(!1),se(),o.current.delete(s),n.invalidateQueries({queryKey:tN})},onRunFailed:e=>{ue(e.error)?(O(``),w(!0)):(console.error(`Agent run failed`,e),O(Ye())),_(!1),se(),o.current.delete(s),n.invalidateQueries({queryKey:tN})}});return()=>{t=!1,i.unsubscribe(),A.abortRun()}},[A,e,n,te,s]),(0,N.useEffect)(()=>{if(!e)return;let n=e=>{let n=e.target,i=n?.matches(`input, textarea, [contenteditable='true']`);e.key===`/`&&!i&&(e.preventDefault(),r?requestAnimationFrame(()=>ie.current?.focus()):t({to:`/chat`}).then(()=>requestAnimationFrame(()=>ie.current?.focus()))),e.key===`Escape`&&n===ie.current&&(E(``),ie.current?.blur())};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t,r]);async function de(){_(!0),O(``);try{await A.runAgent({forwardedProps:{...k.current}})}catch(e){ue(e)?(O(``),w(!0)):(console.error(`Agent run failed`,e),O(Ye())),_(!1),se(),o.current.delete(s)}}async function fe(n,i){let a=n.trim();if(!e||!a||g||!oe||m)return;k.current={...i},r||(o.current.add(s),t({to:`/chat/$threadId`,params:{threadId:s},replace:!0}));let c={id:fN(),role:`user`,content:a};A.addMessage(c),l([...A.messages]),d(e=>({...e,[c.id]:Date.now()})),E(``),await de()}(0,N.useEffect)(()=>{let e=re.current;oe&&r&&e&&(re.current=null,fe(e.text,e.options))},[oe,r,s]);function pe(e){e.preventDefault(),fe(ee)}function me(){T.current=!0,O(``),w(!0),A.abortRun(),_(!1),se(),o.current.delete(s)}function he(){!g&&A.messages.some(e=>e.role===`user`)&&de()}function ge(n,r){if(!e)return;let i=fN();o.current.add(i),re.current=n?{text:n,options:{...r}}:null,t({to:`/chat/$threadId`,params:{threadId:i}})}function _e(){A.abortRun(),re.current=null,k.current={},a(fN()),t({to:`/chat`})}function ve(e){re.current=null,k.current={},t({to:`/chat/$threadId`,params:{threadId:e}})}function j(){ne(e=>e+1)}return(0,P.jsx)(tt.Provider,{value:{agentAvailable:e,threadID:s,threadMissing:m,messages:c,messageTimes:u,ready:oe,running:g,activity:v,provisional:b,stopped:C,input:ee,setInput:E,error:D,inputRef:ie,send:fe,submit:pe,stop:me,retry:he,reloadThread:j,openChat:ge,newThread:_e,selectThread:ve},children:(0,P.jsx)(VN,{children:(0,P.jsx)(zn,{})})})}function WN(){let e=(0,N.useMemo)(()=>new Fj,[]);return(0,P.jsx)(EA,{client:e,children:(0,P.jsx)(eN,{children:(0,P.jsx)(UN,{})})})}var GN=Dn({component:WN,notFoundComponent:()=>(0,P.jsx)(Be,{to:`/`,replace:!0})}),KN=On(`/`)({component:kn(()=>it(()=>import(`./routes-D2AdaqvY.js`),__vite__mapDeps([0,1,2])),`component`)}),qN=On(`/settings`)({component:kn(()=>it(()=>import(`./settings-674SZUVT.js`),__vite__mapDeps([3,1,4,5,6])),`component`)}),JN=On(`/chat/`)({component:kn(()=>it(()=>import(`./chat.index-Cjkl3RJK.js`),__vite__mapDeps([7,8,1,4,9,5,10])),`component`)}),YN=On(`/chat/$threadId`)({component:kn(()=>it(()=>import(`./chat._threadId-Cjkl3RJK.js`),__vite__mapDeps([11,8,1,4,9,5,10])),`component`)});function XN(e){try{let t=typeof e==`string`?e:JSON.stringify(e);if(!t||t.length>4096)return;let n=typeof e==`string`?JSON.parse(e):e;if(!n||typeof n!=`object`)return;let r=n;return typeof r.panel_id!=`string`||!/^([a-z][a-z0-9_]{0,39})$/.test(r.panel_id)||r.kind!==`traces`&&r.kind!==`logs`||typeof r.from!=`string`||typeof r.to!=`string`||!Number.isFinite(Date.parse(r.from))||!Number.isFinite(Date.parse(r.to))||Date.parse(r.from)>=Date.parse(r.to)||Date.parse(r.to)-Date.parse(r.from)>2592e6||typeof r.window_from!=`string`||typeof r.window_to!=`string`||!Number.isFinite(Date.parse(r.window_from))||!Number.isFinite(Date.parse(r.window_to))||Date.parse(r.window_from)>=Date.parse(r.window_to)||Date.parse(r.window_to)-Date.parse(r.window_from)>2592e6||Date.parse(r.from)Date.parse(r.window_to)||!r.dimensions||Array.isArray(r.dimensions)||typeof r.dimensions!=`object`||Object.keys(r.dimensions).length>3||Object.values(r.dimensions).some(e=>typeof e!=`string`||e.length>500)||r.trace_id!==void 0&&(typeof r.trace_id!=`string`||r.trace_id.length>128)||r.namespace!==void 0&&(typeof r.namespace!=`string`||r.namespace.length>200)||r.bucket&&(!Number.isFinite(r.bucket.lower)||r.bucket.lower<0||r.bucket.upper!==void 0&&(!Number.isFinite(r.bucket.upper)||r.bucket.upper<=r.bucket.lower))?void 0:{panel_id:r.panel_id,kind:r.kind,from:r.from,to:r.to,window_from:r.window_from,window_to:r.window_to,dimensions:r.dimensions,trace_id:r.trace_id,namespace:r.namespace,bucket:r.bucket}}catch{return}}function ZN(e,t,n){if(!e.drill&&e.viz!==`service_map`&&!n.trace_id||t.from_ms===void 0||t.to_ms===void 0)return;let r=t.from_ms,i=t.to_ms;if(n.from!==void 0&&n.to!==void 0&&(r=Math.max(r,Date.parse(n.from)),i=Math.min(i,Date.parse(n.to))),n.time!==void 0&&!n.trace_id){let e=/^(\d+)(s|m|h|d)$/.exec(t.interval??``),a=e?Number(e[1])*{s:1e3,m:6e4,h:36e5,d:864e5}[e[2]]:6e4;r=Math.max(r,n.time),i=Math.min(i,n.time+a)}return XN(JSON.stringify({panel_id:e.id,kind:n.trace_id||e.viz===`service_map`?`traces`:e.drill,from:n.from&&Date.parse(n.from)===r?n.from:new Date(r).toISOString(),to:n.to&&Date.parse(n.to)===i?n.to:new Date(i).toISOString(),window_from:new Date(t.from_ms).toISOString(),window_to:new Date(t.to_ms).toISOString(),dimensions:n.dimensions,trace_id:n.trace_id,namespace:n.namespace,bucket:n.bucket}))}function QN(e){let t=new URLSearchParams;for(let[n,r]of Object.entries(e))for(let e of Array.isArray(r)?r:[r]){if(e===void 0)continue;let r=typeof e==`string`&&/^[{"]/.test(e);t.append(n,r||typeof e==`object`&&e?JSON.stringify(e):String(e))}let n=t.toString();return n?`?${n}`:``}function $N(e){let t=Object.create(null),n=e=>{if(e.startsWith(`{`)||e.startsWith(`"`))try{let t=JSON.parse(e);if(typeof t==`string`)return/^[{"]/.test(t)?t:e;if(typeof t==`object`&&t&&!Array.isArray(t))return t}catch{}return e},r=new URLSearchParams(e);for(let e of new Set(r.keys())){let i=r.getAll(e).map(n);t[e]=i.length===1?i[0]:i}return t}var eP=[`5m`,`15m`,`1h`,`3h`,`6h`,`12h`,`24h`,`2d`,`7d`,`30d`],tP=[`off`,`10s`,`30s`,`1m`,`5m`],nP=e=>{if(typeof e!=`string`||!/^\d{4}-\d{2}-\d{2}[Tt](?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:[Zz]|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/.test(e)||Number.isNaN(Date.parse(e)))return!1;let[t,n,r]=e.slice(0,10).split(`-`).map(Number),i=new Date(0);return i.setUTCFullYear(t,n-1,r),i.setUTCHours(0,0,0,0),i.getUTCFullYear()===t&&i.getUTCMonth()===n-1&&i.getUTCDate()===r},rP=e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`?String(e):void 0;function iP(e){let t={};typeof e.range==`string`&&eP.includes(e.range)?t.range=e.range:nP(e.from)&&nP(e.to)&&Date.parse(e.from)typeof e==`string`)&&(i[e]=t)}}else{let t=rP(n);t!==void 0&&(i[e]=t)}}}Object.keys(i).length>0&&(t.vars=i);let a=XN(e.drill);return a&&(t.drill=JSON.stringify(a)),t}function aP(e){let t={};e.drill&&(t.drill=JSON.parse(e.drill)),e.range&&(t.range=e.range),e.from&&e.to&&(t.from=e.from,t.to=e.to),e.compare&&(t.compare=e.compare),e.view&&(t.view=e.view),e.edit&&(t.edit=e.edit);for(let[n,r]of Object.entries(e.vars??{}))t[`var-${n}`]=Array.isArray(r)?{values:r}:r;return t}function oP(e,t){let n=new URL(e);return n.search=QN(aP({...iP($N(n.search)),drill:JSON.stringify(t)})),n.href}function sP(e,t){let n=e.time.refresh??`30s`;return t.from&&t.to?{from:t.from,to:t.to,refresh:n}:t.range?{range:t.range,refresh:n}:{...e.time,refresh:n}}var cP=On(`/dashboards/`)({component:kn(()=>it(()=>import(`./dashboards.index-CDzeQ7JH.js`),__vite__mapDeps([12,1,2,13,4,9,5,10,6])),`component`),validateSearch:e=>aP(iP(e))}),lP=On(`/dashboards/$dashboardId`)({component:kn(()=>it(()=>import(`./dashboards._dashboardId-D9aKAAwQ.js`),__vite__mapDeps([14,1,2,13,4,9,5,10,6])),`component`),validateSearch:e=>aP(iP(e))}),uP=KN.update({id:`/`,path:`/`,getParentRoute:()=>GN}),dP=qN.update({id:`/settings`,path:`/settings`,getParentRoute:()=>GN}),fP=JN.update({id:`/chat/`,path:`/chat/`,getParentRoute:()=>GN}),pP=YN.update({id:`/chat/$threadId`,path:`/chat/$threadId`,getParentRoute:()=>GN}),mP=cP.update({id:`/dashboards/`,path:`/dashboards/`,getParentRoute:()=>GN}),hP={IndexRoute:uP,SettingsRoute:dP,ChatThreadIdRoute:pP,DashboardsDashboardIdRoute:lP.update({id:`/dashboards/$dashboardId`,path:`/dashboards/$dashboardId`,getParentRoute:()=>GN}),ChatIndexRoute:fP,DashboardsIndexRoute:mP},gP=Gn({routeTree:GN._addFileChildren(hP)._addFileTypes(),parseSearch:$N,stringifySearch:QN,defaultPreload:`intent`,scrollRestoration:!0}),_P=[`#fafafa`,`#e6e4de`,`#bfbdb6`,`#8b8e99`,`#565b69`,`#1d2433`,`#131721`,`#0b0e14`,`#080a10`,`#05070b`],vP=[`#f3ecfd`,`#ece3fb`,`#dcc9f7`,`#d2a6ff`,`#bf94ec`,`#a97ce0`,`#9163d6`,`#7c4dcc`,`#5b32a3`,`#40236f`],yP=[`#eefbe6`,`#dcf7cc`,`#c2f0a6`,`#a5e880`,`#8fe06c`,`#7fd962`,`#66c04b`,`#4f9c3a`,`#3b7a2c`,`#2a5a1f`],bP=[`#fff5e6`,`#ffe9c9`,`#ffd79b`,`#ffc571`,`#ffbc62`,`#ffb454`,`#ef9c33`,`#c87d21`,`#9c5f16`,`#74460f`],xP=[`#fdecee`,`#fbd9dc`,`#f8b6bc`,`#f59099`,`#f37d87`,`#f26d78`,`#e04d5a`,`#c03642`,`#96262f`,`#6f1a21`],SP=[`#e8f6ff`,`#ccebff`,`#a3daff`,`#7dcbff`,`#66c5ff`,`#59c2ff`,`#33a7e6`,`#1e86bd`,`#146694`,`#0d4a6d`],CP={dark:{text:`#bfbdb6`,muted:`#8b8e99`,grid:`#1d2433`,surface:`#131721`,border:`#626777`},light:{text:`#4a5058`,muted:`#6b7280`,grid:`#eceef0`,surface:`#fcfcfc`,border:`#8c939d`}},wP={dark:[`#3987e5`,`#d95926`,`#199e70`,`#9085e9`,`#c98500`,`#d55181`],light:[`#2a78d6`,`#eb6834`,`#1baf7a`,`#4a3aa7`,`#eda100`,`#e87ba4`]},TP={micro:11,small:12,body:14,title:16,section:22,page:32},EP={display:`"Geist Mono Variable", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace`,body:`"Geist Variable", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif`},DP={brand:vP,ok:yP,warn:bP,bad:xP,info:SP},OP={light:7,dark:5};function kP(e){let t=e.replace(`#`,``),n=t.length===3?[...t].map(e=>e+e).join(``):t,r=e=>{let t=parseInt(n.slice(e,e+2),16)/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4};return .2126*r(0)+.7152*r(2)+.0722*r(4)}function AP(e){let t=kP(e),n=1.05/(t+.05);return(t+.05)/.05>n?`var(--mantine-color-black)`:`var(--mantine-color-white)`}function jP(e){return Object.fromEntries(Object.entries(DP).map(([t,n])=>[`--fanout-color-${t}-contrast`,AP(n[OP[e]])]))}function MP(e){return t=>{let n=t.color??FP.primaryColor,r=e({...t,color:n}),i=t.variant===`filled`||t.variant===void 0;return t.autoContrast===!1||!i||!Object.hasOwn(DP,n)?r:{...r,color:`var(--fanout-color-${n}-contrast)`}}}var NP=.25,PP={xs:9,sm:10,md:11,lg:13,xl:16},FP={primaryColor:`brand`,primaryShade:OP,autoContrast:!0,luminanceThreshold:NP,colors:{dark:_P,brand:vP,ok:yP,warn:bP,bad:xP,info:SP},defaultRadius:`md`,fontFamily:EP.body,fontFamilyMonospace:EP.display,headings:{fontFamily:EP.body,fontWeight:`600`},cursorType:`pointer`,components:{Tabs:{styles:(e,t)=>({tab:RP(t.color,`--tabs-text-color`)})},Pagination:{styles:(e,t)=>({control:RP(t.color,`--pagination-active-color`)})},Badge:{vars:(e,t)=>({root:LP(t.size)})},Menu:{defaultProps:{withInitialFocusPlaceholder:!1}},Drawer:{defaultProps:{closeButtonProps:{"aria-label":`Close`}}},Modal:{defaultProps:{closeButtonProps:{"aria-label":`Close`}}}}},IP=()=>({variables:{"--mantine-color-error":`var(--mantine-color-bad-filled)`},light:{"--mantine-color-dimmed":CP.light.muted,...jP(`light`)},dark:jP(`dark`)});function LP(e){let t=PP[e??`md`];return t===void 0||t>=TP.micro?{}:{"--badge-fz":`${TP.micro/16}rem`}}function RP(e,t){return!e||e===FP.primaryColor?{[t]:`var(--fanout-color-${FP.primaryColor}-contrast)`}:{}}var zP=MP(ee),BP=ni({...FP,variantColorResolver:zP});(0,Qc.createRoot)(document.getElementById(`root`)).render((0,P.jsx)(N.StrictMode,{children:(0,P.jsx)(ti,{theme:BP,defaultColorScheme:`auto`,cssVariablesResolver:IP,children:(0,P.jsx)(Jn,{router:gP})})}));export{Wy as $,CN as A,Wc as At,RM as B,Ti as Bt,pN as C,Qy as Ct,bN as D,h_ as Dt,kN as E,y_ as Et,DN as F,ps as Ft,jj as G,Tr as Gt,CM as H,ii as Ht,xN as I,ss as It,zA as J,Zn as Jt,sj as K,sr as Kt,nN as L,I as Lt,ON as M,xc as Mt,wN as N,Is as Nt,_N as O,m_ as Ot,SN as P,Ns as Pt,TA as Q,JM as R,oo as Rt,jN as S,Tb as St,TN as T,xy as Tt,_M as U,Hr as Ut,FM as V,mi as Vt,Jj as W,Fr as Wt,UA as X,an as Xt,jA as Y,hn as Yt,$A as Z,cn as Zt,eP as _,Kb as _t,CP as a,G as at,ZN as b,U as bt,yP as c,Fb as ct,bP as d,dx as dt,Uy as et,lP as f,q as ft,iP as g,jb as gt,sP as h,hb as ht,vP as i,bb as it,EN as j,Lc as jt,yN as k,tp as kt,wP as l,Jy as lt,oP as m,Db as mt,kP as n,Vb as nt,EP as o,kb as ot,cP as p,K as pt,rj as q,nr as qt,xP as r,Sb as rt,SP as s,vb as st,AP as t,mb as tt,TP as u,Lb as ut,tP as v,gx as vt,vN as w,Dy as wt,XN as x,Nb as xt,aP as y,zb as yt,UM as z,Ni as zt}; \ No newline at end of file diff --git a/internal/ui/dist/assets/mcp-app-frame-C1H_Yon7.js b/internal/ui/dist/assets/mcp-app-frame-BhdSvyC_.js similarity index 99% rename from internal/ui/dist/assets/mcp-app-frame-C1H_Yon7.js rename to internal/ui/dist/assets/mcp-app-frame-BhdSvyC_.js index fdc8a1032..ffd966537 100644 --- a/internal/ui/dist/assets/mcp-app-frame-C1H_Yon7.js +++ b/internal/ui/dist/assets/mcp-app-frame-BhdSvyC_.js @@ -1,4 +1,4 @@ -import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{C as r,d as i,f as a,p as o,u as s,y as c}from"./brand-DUaZkIz1.js";import{n as l}from"./chat-CDsGWYjG.js";import{$ as u,Ct as d,Dt as f,Et as p,Ot as m,St as h,Tt as g,Ut as _,Vt as v,_t as y,at as b,bt as x,ct as S,dt as ee,et as C,ft as w,gt as T,ht as E,it as te,kt as ne,lt as re,mt as ie,nt as D,ot as O,pt as k,rt as ae,st as A,tt as oe,ut as se,vt as ce,wt as le,xt as j,yt as M,z as ue}from"./index-_VmsjY84.js";var de={invalid_type:`invalid_type`,too_big:`too_big`,too_small:`too_small`,invalid_format:`invalid_format`,not_multiple_of:`not_multiple_of`,unrecognized_keys:`unrecognized_keys`,invalid_union:`invalid_union`,invalid_key:`invalid_key`,invalid_element:`invalid_element`,invalid_value:`invalid_value`,custom:`custom`},fe;fe||={};function pe(e){return m(C,e)}function me(e){return f(u,e)}function he(e){return p(oe,e)}function N(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function P(e,t){if(!Array.isArray(e))return[];let n=new Set(t);return e.filter(e=>{if(typeof e!=`string`||/[\s;'\"]/.test(e))return!1;let t=e.match(/^([a-z]+):\/\/([^/]+)$/i);return!!(t&&n.has(t[1].toLowerCase()))})}function ge(e){let t=N(N(N(e)?.ui)?.csp),n=P(t?.connectDomains,[`http`,`https`,`ws`,`wss`]),r=P(t?.resourceDomains,[`http`,`https`]),i=P(t?.frameDomains,[`http`,`https`]),a=P(t?.baseUriDomains,[`http`,`https`]),o=r.length?` ${r.join(` `)}`:``,s=[`default-src 'none'`,`worker-src blob:`,`script-src 'self' 'unsafe-inline'${o}`,`style-src 'self' 'unsafe-inline'${o}`,`img-src 'self' data:${o}`,`media-src 'self' data:${o}`,`font-src 'self' data:${o}`,`connect-src ${n.length?n.join(` `):`'none'`}`];return i.length&&s.push(`frame-src ${i.join(` `)}`),a.length&&s.push(`base-uri ${a.join(` `)}`),`${s.join(`; `)};`}var _e=Object.create,ve=Object.defineProperty,ye=Object.getOwnPropertyDescriptor,be=Object.getOwnPropertyNames,F=Object.getPrototypeOf,xe=Object.prototype.hasOwnProperty,Se=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ce=(e,t)=>{let n={};for(var r in e)ve(n,r,{get:e[r],enumerable:!0});return t&&ve(n,Symbol.toStringTag,{value:`Module`}),n},we=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=be(t),a=0,o=i.length,s;at[e]).bind(null,s),enumerable:!(r=ye(t,s))||r.enumerable});return e},Te=(e,t,n)=>(n=e==null?{}:_e(F(e)),we(t||!e||!e.__esModule?ve(n,`default`,{value:e,enumerable:!0}):n,e)),Ee=new Set([`https://json-schema.org/draft/2020-12/schema`,`http://json-schema.org/draft/2020-12/schema`]),De=new Set([`https://json-schema.org/draft/2019-09/schema`,`http://json-schema.org/draft/2019-09/schema`]),Oe=new Set([`https://json-schema.org/draft-07/schema`,`http://json-schema.org/draft-07/schema`]),ke=new Set([`https://json-schema.org/draft-06/schema`,`http://json-schema.org/draft-06/schema`]);function Ae(e){return typeof e==`string`&&De.has(e.replace(/#$/,``))}function je(e,t){if(!(`$schema`in e)||typeof e.$schema!=`string`)return`2020-12`;let n=e.$schema.replace(/#$/,``);if(Ee.has(n))return`2020-12`;if(De.has(n))return`2019-09`;if(Oe.has(n)||ke.has(n))return`draft-7`;throw Error(`JSON Schema declares an unsupported dialect ("$schema": "${e.$schema.slice(0,200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${t}`)}var Me=`2025-11-25`,Ne=[Me,`2025-06-18`,`2025-03-26`,`2024-11-05`,`2024-10-07`],Pe=`io.modelcontextprotocol/related-task`,Fe=`io.modelcontextprotocol/protocolVersion`,Ie=`io.modelcontextprotocol/clientInfo`,Le=`io.modelcontextprotocol/serverInfo`,Re=`io.modelcontextprotocol/clientCapabilities`,ze=`io.modelcontextprotocol/subscriptionId`,Be=`io.modelcontextprotocol/logLevel`,Ve=ee(()=>j([x(),E(),A(),ae(),M(x(),Ve),O(Ve)])),I=M(x(),Ve),He=O(Ve),Ue=j([x(),E().int()]),We=x(),Ge=T({ttl:E().optional()}),Ke=T({taskId:x()}),qe=k({progressToken:Ue.optional(),[Pe]:Ke.optional()}),L=T({_meta:qe.optional()}),Je=L.extend({task:Ge.optional()}),R=T({method:x(),params:L.loose().optional()}),z=T({_meta:qe.optional()}),B=T({method:x(),params:z.loose().optional()}),Ye=k({get[Le](){return H.optional().catch(void 0)}}),V=k({_meta:Ye.optional()}),Xe=j([x(),E().int()]),Ze=T({jsonrpc:w(`2.0`),id:Xe,...R.shape}).strict(),Qe=T({jsonrpc:w(`2.0`),...B.shape}).strict(),$e=T({jsonrpc:w(`2.0`),id:Xe,result:V}).strict(),et=T({jsonrpc:w(`2.0`),id:Xe.optional(),error:T({code:E().int(),message:x(),data:h().optional()})}).strict(),tt=j([Ze,Qe,$e,et]),nt=j([$e,et]),rt=V.strict(),it=z.extend({requestId:Xe.optional(),reason:x().optional()}),at=B.extend({method:w(`notifications/cancelled`),params:it}),ot=T({src:x(),mimeType:x().optional(),sizes:O(x()).optional(),theme:D([`light`,`dark`]).optional()}),st=T({icons:O(ot).optional()}),ct=T({name:x(),title:x().optional()}),H=ct.extend({...ct.shape,...st.shape,version:x(),websiteUrl:x().optional(),description:x().optional()}),lt=se(T({applyDefaults:A().optional()}),I),ut=ce(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,se(T({form:lt.optional(),url:I.optional()}),I.optional())),dt=k({list:I.optional(),cancel:I.optional(),requests:k({sampling:k({createMessage:I.optional()}).optional(),elicitation:k({create:I.optional()}).optional()}).optional()}),ft=k({list:I.optional(),cancel:I.optional(),requests:k({tools:k({call:I.optional()}).optional()}).optional()}),pt=T({experimental:M(x(),I).optional(),sampling:T({context:I.optional(),tools:I.optional()}).optional(),elicitation:ut.optional(),roots:T({listChanged:A().optional()}).optional(),tasks:dt.optional(),extensions:M(x(),I).optional()}),mt=L.extend({protocolVersion:x(),capabilities:pt,clientInfo:H}),ht=R.extend({method:w(`initialize`),params:mt}),gt=T({experimental:M(x(),I).optional(),logging:I.optional(),completions:I.optional(),prompts:T({listChanged:A().optional()}).optional(),resources:T({subscribe:A().optional(),listChanged:A().optional()}).optional(),tools:T({listChanged:A().optional()}).optional(),tasks:ft.optional(),extensions:M(x(),I).optional()}),_t=V.extend({protocolVersion:x(),capabilities:gt,serverInfo:H,instructions:x().optional()}),vt=B.extend({method:w(`notifications/initialized`),params:z.optional()}),yt=R.extend({method:w(`server/discover`),params:L.optional()}),bt=V.extend({supportedVersions:O(x()),capabilities:gt,instructions:x().optional()}),xt=R.extend({method:w(`ping`),params:L.optional()}),St=T({progress:E(),total:y(E()),message:y(x())}),Ct=T({...z.shape,...St.shape,progressToken:Ue}),wt=B.extend({method:w(`notifications/progress`),params:Ct}),Tt=L.extend({cursor:We.optional()}),Et=R.extend({params:Tt.optional()}),Dt=V.extend({nextCursor:We.optional()}),Ot=T({uri:x(),mimeType:y(x()),_meta:M(x(),h()).optional()}),kt=Ot.extend({text:x()}),At=x().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),jt=Ot.extend({blob:At}),Mt=D([`user`,`assistant`]),Nt=T({audience:O(Mt).optional(),priority:E().min(0).max(1).optional(),lastModified:pe({offset:!0}).optional()}),Pt=T({...ct.shape,...st.shape,uri:x(),description:y(x()),mimeType:y(x()),size:y(E()),annotations:Nt.optional(),_meta:y(k({}))}),Ft=T({...ct.shape,...st.shape,uriTemplate:x(),description:y(x()),mimeType:y(x()),annotations:Nt.optional(),_meta:y(k({}))}),It=Et.extend({method:w(`resources/list`)}),Lt=Dt.extend({resources:O(Pt)}),U=Et.extend({method:w(`resources/templates/list`)}),W=Dt.extend({resourceTemplates:O(Ft)}),Rt=L.extend({uri:x()}),zt=Rt,Bt=R.extend({method:w(`resources/read`),params:zt}),Vt=V.extend({contents:O(j([kt,jt]))}),Ht=B.extend({method:w(`notifications/resources/list_changed`),params:z.optional()}),Ut=Rt,Wt=R.extend({method:w(`resources/subscribe`),params:Ut}),Gt=Rt,Kt=R.extend({method:w(`resources/unsubscribe`),params:Gt}),qt=T({toolsListChanged:A().optional(),promptsListChanged:A().optional(),resourcesListChanged:A().optional(),resourceSubscriptions:O(x()).optional()}),Jt=L.extend({notifications:qt}),Yt=R.extend({method:w(`subscriptions/listen`),params:Jt}),Xt=z.extend({notifications:qt}),Zt=B.extend({method:w(`notifications/subscriptions/acknowledged`),params:Xt}),Qt=Ye.extend({[ze]:Xe}),$t=V.extend({_meta:Qt}),en=z.extend({uri:x()}),tn=B.extend({method:w(`notifications/resources/updated`),params:en}),G=T({name:x(),description:y(x()),required:y(A())}),nn=T({...ct.shape,...st.shape,description:y(x()),arguments:y(O(G)),_meta:y(k({}))}),rn=Et.extend({method:w(`prompts/list`)}),an=Dt.extend({prompts:O(nn)}),on=L.extend({name:x(),arguments:M(x(),x()).optional()}),sn=R.extend({method:w(`prompts/get`),params:on}),cn=T({type:w(`text`),text:x(),annotations:Nt.optional(),_meta:M(x(),h()).optional()}),K=T({type:w(`image`),data:At,mimeType:x(),annotations:Nt.optional(),_meta:M(x(),h()).optional()}),ln=T({type:w(`audio`),data:At,mimeType:x(),annotations:Nt.optional(),_meta:M(x(),h()).optional()}),un=T({type:w(`tool_use`),name:x(),id:x(),input:M(x(),h()),_meta:M(x(),h()).optional()}),dn=T({type:w(`resource`),resource:j([kt,jt]),annotations:Nt.optional(),_meta:M(x(),h()).optional()}),fn=Pt.extend({type:w(`resource_link`)}),pn=j([cn,K,ln,fn,dn]),mn=T({role:Mt,content:pn}),hn=V.extend({description:x().optional(),messages:O(mn)}),gn=B.extend({method:w(`notifications/prompts/list_changed`),params:z.optional()}),_n=T({title:x().optional(),readOnlyHint:A().optional(),destructiveHint:A().optional(),idempotentHint:A().optional(),openWorldHint:A().optional()}),vn=T({taskSupport:D([`required`,`optional`,`forbidden`]).optional()}),yn=T({...ct.shape,...st.shape,description:x().optional(),inputSchema:T({type:w(`object`),properties:M(x(),Ve).optional(),required:O(x()).optional()}).catchall(h()),outputSchema:k({$schema:x().optional()}).optional(),annotations:_n.optional(),execution:vn.optional(),_meta:M(x(),h()).optional()}),bn=Et.extend({method:w(`tools/list`)}),xn=Dt.extend({tools:O(yn)}),Sn=V.extend({content:O(pn).default([]),structuredContent:h().optional(),isError:A().optional()}),Cn=Sn.or(V.extend({toolResult:h()})),wn=Je.extend({name:x(),arguments:M(x(),h()).optional()}),Tn=R.extend({method:w(`tools/call`),params:wn}),En=B.extend({method:w(`notifications/tools/list_changed`),params:z.optional()}),Dn=T({autoRefresh:A().default(!0),debounceMs:E().int().nonnegative().default(300)}),On=D([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),kn=L.extend({level:On}),An=R.extend({method:w(`logging/setLevel`),params:kn}),jn=z.extend({level:On,logger:x().optional(),data:h()}),Mn=B.extend({method:w(`notifications/message`),params:jn}),Nn=T({name:x().optional()}),Pn=T({hints:O(Nn).optional(),costPriority:E().min(0).max(1).optional(),speedPriority:E().min(0).max(1).optional(),intelligencePriority:E().min(0).max(1).optional()}),Fn=T({mode:D([`auto`,`required`,`none`]).optional()}),In=T({type:w(`tool_result`),toolUseId:x().describe(`The unique identifier for the corresponding tool call.`),content:O(pn),structuredContent:h().optional(),isError:A().optional(),_meta:M(x(),h()).optional()}),Ln=S(`type`,[cn,K,ln]),Rn=S(`type`,[cn,K,ln,un,In]),zn=T({role:Mt,content:j([Rn,O(Rn)]),_meta:M(x(),h()).optional()}),Bn=Je.extend({messages:O(zn),modelPreferences:Pn.optional(),systemPrompt:x().optional(),includeContext:D([`none`,`thisServer`,`allServers`]).optional(),temperature:E().optional(),maxTokens:E().int(),stopSequences:O(x()).optional(),metadata:I.optional(),tools:O(yn).optional(),toolChoice:Fn.optional()}),Vn=R.extend({method:w(`sampling/createMessage`),params:Bn}),Hn=V.extend({model:x(),stopReason:y(D([`endTurn`,`stopSequence`,`maxTokens`]).or(x())),role:Mt,content:Ln}),Un=V.extend({model:x(),stopReason:y(D([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(x())),role:Mt,content:j([Rn,O(Rn)])}),Wn=T({type:w(`boolean`),title:x().optional(),description:x().optional(),default:A().optional()}),Gn=T({type:w(`string`),title:x().optional(),description:x().optional(),minLength:E().optional(),maxLength:E().optional(),format:D([`email`,`uri`,`date`,`date-time`]).optional(),default:x().optional()}),Kn=T({type:D([`number`,`integer`]),title:x().optional(),description:x().optional(),minimum:E().optional(),maximum:E().optional(),default:E().optional()}),qn=T({type:w(`string`),title:x().optional(),description:x().optional(),enum:O(x()),default:x().optional()}),Jn=T({type:w(`string`),title:x().optional(),description:x().optional(),oneOf:O(T({const:x(),title:x()})),default:x().optional()}),Yn=T({type:w(`string`),title:x().optional(),description:x().optional(),enum:O(x()),enumNames:O(x()).optional(),default:x().optional()}),Xn=j([qn,Jn]),Zn=T({type:w(`array`),title:x().optional(),description:x().optional(),minItems:E().optional(),maxItems:E().optional(),items:T({type:w(`string`),enum:O(x())}),default:O(x()).optional()}),Qn=T({type:w(`array`),title:x().optional(),description:x().optional(),minItems:E().optional(),maxItems:E().optional(),items:T({anyOf:O(T({const:x(),title:x()}))}),default:O(x()).optional()}),$n=j([Zn,Qn]),er=j([Yn,Xn,$n]),tr=j([er,Wn,Gn,Kn]),nr=Je.extend({mode:w(`form`).optional(),message:x(),requestedSchema:T({type:w(`object`),properties:M(x(),tr),required:O(x()).optional()}).catchall(h())}),rr=Je.extend({mode:w(`url`),message:x(),elicitationId:x(),url:x().url()}),ir=j([nr,rr]),ar=R.extend({method:w(`elicitation/create`),params:ir}),or=z.extend({elicitationId:x()}),sr=B.extend({method:w(`notifications/elicitation/complete`),params:or}),cr=V.extend({action:D([`accept`,`decline`,`cancel`]),content:ce(e=>e===null?void 0:e,M(x(),j([x(),E(),A(),O(x())])).optional())}),lr=T({type:w(`ref/resource`),uri:x()}),ur=T({type:w(`ref/prompt`),name:x()}),dr=L.extend({ref:j([ur,lr]),argument:T({name:x(),value:x()}),context:T({arguments:M(x(),x()).optional()}).optional()}),fr=R.extend({method:w(`completion/complete`),params:dr}),pr=V.extend({completion:k({values:O(x()).max(100),total:y(E().int()),hasMore:y(A())})}),mr=T({uri:x().startsWith(`file://`),name:x().optional(),_meta:M(x(),h()).optional()}),hr=R.extend({method:w(`roots/list`),params:L.optional()}),gr=V.extend({roots:O(mr)}),_r=B.extend({method:w(`notifications/roots/list_changed`),params:z.optional()}),vr=k({ttl:E().optional(),pollInterval:E().optional()}),yr=D([`working`,`input_required`,`completed`,`failed`,`cancelled`]),br=T({taskId:x(),status:yr,ttl:j([E(),ae()]),createdAt:x(),lastUpdatedAt:x(),pollInterval:y(E()),statusMessage:y(x())}),xr=V.extend({task:br}),Sr=z.merge(br),Cr=B.extend({method:w(`notifications/tasks/status`),params:Sr}),wr=R.extend({method:w(`tasks/get`),params:L.extend({taskId:x()})}),Tr=V.merge(br),Er=R.extend({method:w(`tasks/result`),params:L.extend({taskId:x()})}),Dr=V.loose(),Or=Et.extend({method:w(`tasks/list`)}),kr=Dt.extend({tasks:O(br)}),Ar=R.extend({method:w(`tasks/cancel`),params:L.extend({taskId:x()})}),jr=V.merge(br),Mr=j([xt,ht,yt,fr,An,sn,rn,It,U,Bt,Wt,Kt,Yt,Tn,bn]),Nr=j([at,wt,vt,_r]),Pr=j([rt,Hn,Un,cr,gr]),Fr=j([xt,Vn,ar,hr]),Ir=j([at,wt,Mn,tn,Ht,En,gn,Zt,sr]),Lr=j([rt,_t,bt,pr,hn,an,Lt,W,Vt,Sn,xn,$t]),q=d().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:de.custom,message:`URL must be parseable`,fatal:!0}),ne}).refine(e=>{let t=new URL(e);return t.protocol!==`javascript:`&&t.protocol!==`data:`&&t.protocol!==`vbscript:`},{message:`URL cannot use javascript:, data:, or vbscript: scheme`}),Rr=k({resource:x().url(),authorization_servers:O(q).optional(),jwks_uri:x().url().optional(),scopes_supported:O(x()).optional(),bearer_methods_supported:O(x()).optional(),resource_signing_alg_values_supported:O(x()).optional(),resource_name:x().optional(),resource_documentation:x().optional(),resource_policy_uri:x().url().optional(),resource_tos_uri:x().url().optional(),tls_client_certificate_bound_access_tokens:A().optional(),authorization_details_types_supported:O(x()).optional(),dpop_signing_alg_values_supported:O(x()).optional(),dpop_bound_access_tokens_required:A().optional()}),zr=k({issuer:x(),authorization_endpoint:q,token_endpoint:q,registration_endpoint:q.optional(),scopes_supported:O(x()).optional(),response_types_supported:O(x()),response_modes_supported:O(x()).optional(),grant_types_supported:O(x()).optional(),token_endpoint_auth_methods_supported:O(x()).optional(),token_endpoint_auth_signing_alg_values_supported:O(x()).optional(),service_documentation:q.optional(),revocation_endpoint:q.optional(),revocation_endpoint_auth_methods_supported:O(x()).optional(),revocation_endpoint_auth_signing_alg_values_supported:O(x()).optional(),introspection_endpoint:x().optional(),introspection_endpoint_auth_methods_supported:O(x()).optional(),introspection_endpoint_auth_signing_alg_values_supported:O(x()).optional(),code_challenge_methods_supported:O(x()).optional(),client_id_metadata_document_supported:A().optional(),authorization_response_iss_parameter_supported:A().optional().catch(void 0),dpop_signing_alg_values_supported:O(x()).optional()}),Br=k({issuer:x(),authorization_endpoint:q,token_endpoint:q,userinfo_endpoint:q.optional(),jwks_uri:q,registration_endpoint:q.optional(),scopes_supported:O(x()).optional(),response_types_supported:O(x()),response_modes_supported:O(x()).optional(),grant_types_supported:O(x()).optional(),acr_values_supported:O(x()).optional(),subject_types_supported:O(x()),id_token_signing_alg_values_supported:O(x()),id_token_encryption_alg_values_supported:O(x()).optional(),id_token_encryption_enc_values_supported:O(x()).optional(),userinfo_signing_alg_values_supported:O(x()).optional(),userinfo_encryption_alg_values_supported:O(x()).optional(),userinfo_encryption_enc_values_supported:O(x()).optional(),request_object_signing_alg_values_supported:O(x()).optional(),request_object_encryption_alg_values_supported:O(x()).optional(),request_object_encryption_enc_values_supported:O(x()).optional(),token_endpoint_auth_methods_supported:O(x()).optional(),token_endpoint_auth_signing_alg_values_supported:O(x()).optional(),display_values_supported:O(x()).optional(),claim_types_supported:O(x()).optional(),claims_supported:O(x()).optional(),service_documentation:x().optional(),claims_locales_supported:O(x()).optional(),ui_locales_supported:O(x()).optional(),claims_parameter_supported:A().optional(),request_parameter_supported:A().optional(),request_uri_parameter_supported:A().optional(),require_request_uri_registration:A().optional(),op_policy_uri:q.optional(),op_tos_uri:q.optional(),client_id_metadata_document_supported:A().optional(),authorization_response_iss_parameter_supported:A().optional().catch(void 0)}),Vr=T({...Br.shape,...zr.pick({code_challenge_methods_supported:!0}).shape}),Hr=T({access_token:x(),id_token:x().optional(),token_type:x(),expires_in:he().optional(),scope:x().optional(),refresh_token:x().optional(),issuer:x().optional().catch(void 0)}).strip(),Ur=T({issued_token_type:w(`urn:ietf:params:oauth:token-type:id-jag`),access_token:x(),token_type:x().optional(),expires_in:E().optional(),scope:x().optional()}).strip(),Wr=T({error:x(),error_description:x().optional(),error_uri:x().optional()}),Gr=q.optional().or(w(``).transform(()=>void 0)),Kr=T({redirect_uris:O(q),token_endpoint_auth_method:x().optional(),grant_types:O(x()).optional(),response_types:O(x()).optional(),application_type:x().optional(),client_name:x().optional(),client_uri:q.optional(),logo_uri:Gr,scope:x().optional(),contacts:O(x()).optional(),tos_uri:Gr,policy_uri:x().optional(),jwks_uri:q.optional(),jwks:b().optional(),software_id:x().optional(),software_version:x().optional(),software_statement:x().optional()}).strip(),qr=T({client_id:x(),client_secret:x().optional(),client_id_issued_at:E().optional(),client_secret_expires_at:E().optional(),issuer:x().optional().catch(void 0)}).strip(),Jr=Kr.merge(qr),Yr=T({error:x(),error_description:x().optional()}).strip(),Xr=T({token:x(),token_type_hint:x().optional()}).strip(),Zr=Symbol.for(`mcp.sdk.errorBrands`);function Qr(e,t){let n=new Set,r=t;for(;typeof r==`function`;){let e=r.mcpBrand;Object.prototype.hasOwnProperty.call(r,`mcpBrand`)&&typeof e==`string`&&n.add(e),r=Object.getPrototypeOf(r)}n.size!==0&&Object.defineProperty(e,Zr,{value:n,enumerable:!1,configurable:!0})}function $r(e,t){try{if(typeof t==`object`&&t&&Object.prototype.hasOwnProperty.call(e,`mcpBrand`)&&typeof e.mcpBrand==`string`&&Object.prototype.hasOwnProperty.call(t,Zr)){let n=t[Zr];if(n&&typeof n.has==`function`&&n.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}var ei=function(e){return e.InvalidRequest=`invalid_request`,e.InvalidClient=`invalid_client`,e.InvalidGrant=`invalid_grant`,e.UnauthorizedClient=`unauthorized_client`,e.UnsupportedGrantType=`unsupported_grant_type`,e.InvalidScope=`invalid_scope`,e.AccessDenied=`access_denied`,e.ServerError=`server_error`,e.TemporarilyUnavailable=`temporarily_unavailable`,e.UnsupportedResponseType=`unsupported_response_type`,e.UnsupportedTokenType=`unsupported_token_type`,e.InvalidToken=`invalid_token`,e.MethodNotAllowed=`method_not_allowed`,e.TooManyRequests=`too_many_requests`,e.InvalidClientMetadata=`invalid_client_metadata`,e.InvalidRedirectUri=`invalid_redirect_uri`,e.InsufficientScope=`insufficient_scope`,e.InvalidTarget=`invalid_target`,e.InvalidDpopProof=`invalid_dpop_proof`,e.UseDpopNonce=`use_dpop_nonce`,e}({}),ti=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.OAuthError`})}static[Symbol.hasInstance](e){return $r(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return $r(this,e)}constructor(e,t,n){super(t),this.code=e,this.errorUri=n,this.name=`OAuthError`,Qr(this,new.target)}toResponseObject(){let e={error:this.code,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}static fromResponse(t){return new e(t.error,t.error_description??t.error,t.error_uri)}},J=function(e){return e.NotConnected=`NOT_CONNECTED`,e.AlreadyConnected=`ALREADY_CONNECTED`,e.NotInitialized=`NOT_INITIALIZED`,e.CapabilityNotSupported=`CAPABILITY_NOT_SUPPORTED`,e.RequestTimeout=`REQUEST_TIMEOUT`,e.ConnectionClosed=`CONNECTION_CLOSED`,e.SendFailed=`SEND_FAILED`,e.InvalidResult=`INVALID_RESULT`,e.UnsupportedResultType=`UNSUPPORTED_RESULT_TYPE`,e.InputRequiredRoundsExceeded=`INPUT_REQUIRED_ROUNDS_EXCEEDED`,e.ListPaginationExceeded=`LIST_PAGINATION_EXCEEDED`,e.MethodNotSupportedByProtocolVersion=`METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION`,e.EraNegotiationFailed=`ERA_NEGOTIATION_FAILED`,e.ClientHttpNotImplemented=`CLIENT_HTTP_NOT_IMPLEMENTED`,e.ClientHttpAuthentication=`CLIENT_HTTP_AUTHENTICATION`,e.ClientHttpForbidden=`CLIENT_HTTP_FORBIDDEN`,e.ClientHttpUnexpectedContent=`CLIENT_HTTP_UNEXPECTED_CONTENT`,e.ClientHttpFailedToOpenStream=`CLIENT_HTTP_FAILED_TO_OPEN_STREAM`,e.ClientHttpFailedToTerminateSession=`CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION`,e}({}),Y=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SdkError`})}static[Symbol.hasInstance](e){return $r(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return $r(this,e)}constructor(e,t,n,r){super(t,r),this.code=e,this.data=n,this.name=`SdkError`,Qr(this,new.target)}},ni=class extends Y{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SdkHttpError`})}constructor(e,t,n,r){super(e,t,n,r),this.name=`SdkHttpError`}get status(){return this.data.status}get statusText(){return this.data.statusText}};function ri(e){let t=typeof e==`string`?new URL(e):new URL(e.href);return t.hash=``,t}function ii(e){if(typeof e!=`object`||!e||Array.isArray(e))return e;let t={...e};return delete t.issuer,t}function ai({requestedResource:e,configuredResource:t}){let n=typeof e==`string`?new URL(e):new URL(e.href),r=typeof t==`string`?new URL(t):new URL(t.href);if(n.origin!==r.origin||n.pathname.length=oi}function li(e){return e.filter(e=>!ci(e))}function ui(e){return e.filter(e=>ci(e))}function di(e){let t=e.structuredContent;return t===void 0||typeof t==`object`&&t&&!Array.isArray(t)||(e.content?.some(e=>e.type===`text`)??!1)?e:{...e,content:[...e.content??[],{type:`text`,text:JSON.stringify(t)}]}}var fi=[`task`,`inputRequests`,`requestState`];function pi(e){return typeof e!=`object`||!e||Array.isArray(e)||e.content!==void 0||fi.some(t=>t in e)?e:{...e,content:[]}}function mi(){let e=ee(()=>j([x(),E(),A(),ae(),M(x(),e),O(e)])),t=M(x(),e),n=j([x(),E().int()]),r=x(),i=T({ttl:E().optional()}),a=T({taskId:x()}),o=k({progressToken:n.optional(),"io.modelcontextprotocol/related-task":a.optional()}),s=T({_meta:o.optional()}),c=s.extend({task:i.optional()}),l=T({method:x(),params:s.loose().optional()}),u=T({_meta:o.optional()}),d=T({method:x(),params:u.loose().optional()}),f=k({_meta:o.optional()}),p=j([x(),E().int()]),m=f.strict(),g=u.extend({requestId:p.optional(),reason:x().optional()}),_=d.extend({method:w(`notifications/cancelled`),params:g}),v=T({src:x(),mimeType:x().optional(),sizes:O(x()).optional(),theme:D([`light`,`dark`]).optional()}),b=T({icons:O(v).optional()}),C=T({name:x(),title:x().optional()}),te=C.extend({...C.shape,...b.shape,version:x(),websiteUrl:x().optional(),description:x().optional()}),ne=se(T({applyDefaults:A().optional()}),t),re=ce(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,se(T({form:ne.optional(),url:t.optional()}),t.optional())),ie=k({list:t.optional(),cancel:t.optional(),requests:k({sampling:k({createMessage:t.optional()}).optional(),elicitation:k({create:t.optional()}).optional()}).optional()}),oe=k({list:t.optional(),cancel:t.optional(),requests:k({tools:k({call:t.optional()}).optional()}).optional()}),le=T({experimental:M(x(),t).optional(),sampling:T({context:t.optional(),tools:t.optional()}).optional(),elicitation:re.optional(),roots:T({listChanged:A().optional()}).optional(),tasks:ie.optional(),extensions:M(x(),t).optional()}),ue=s.extend({protocolVersion:x(),capabilities:le,clientInfo:te}),de=l.extend({method:w(`initialize`),params:ue}),fe=T({experimental:M(x(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:T({listChanged:A().optional()}).optional(),resources:T({subscribe:A().optional(),listChanged:A().optional()}).optional(),tools:T({listChanged:A().optional()}).optional(),tasks:oe.optional(),extensions:M(x(),t).optional()}),me=f.extend({protocolVersion:x(),capabilities:fe,serverInfo:te,instructions:x().optional()}),he=d.extend({method:w(`notifications/initialized`),params:u.optional()}),N=l.extend({method:w(`ping`),params:s.optional()}),P=T({progress:E(),total:y(E()),message:y(x())}),ge=T({...u.shape,...P.shape,progressToken:n}),_e=d.extend({method:w(`notifications/progress`),params:ge}),ve=s.extend({cursor:r.optional()}),ye=l.extend({params:ve.optional()}),be=f.extend({nextCursor:r.optional()}),F=T({uri:x(),mimeType:y(x()),_meta:M(x(),h()).optional()}),xe=F.extend({text:x()}),Se=x().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),Ce=F.extend({blob:Se}),we=D([`user`,`assistant`]),Te=T({audience:O(we).optional(),priority:E().min(0).max(1).optional(),lastModified:pe({offset:!0}).optional()}),Ee=T({...C.shape,...b.shape,uri:x(),description:y(x()),mimeType:y(x()),size:y(E()),annotations:Te.optional(),_meta:y(k({}))}),De=T({...C.shape,...b.shape,uriTemplate:x(),description:y(x()),mimeType:y(x()),annotations:Te.optional(),_meta:y(k({}))}),Oe=ye.extend({method:w(`resources/list`)}),ke=be.extend({resources:O(Ee)}),Ae=ye.extend({method:w(`resources/templates/list`)}),je=be.extend({resourceTemplates:O(De)}),Me=s.extend({uri:x()}),Ne=Me,Pe=l.extend({method:w(`resources/read`),params:Ne}),Fe=f.extend({contents:O(j([xe,Ce]))}),Ie=d.extend({method:w(`notifications/resources/list_changed`),params:u.optional()}),Le=Me,Re=l.extend({method:w(`resources/subscribe`),params:Le}),ze=Me,Be=l.extend({method:w(`resources/unsubscribe`),params:ze}),Ve=u.extend({uri:x()}),I=d.extend({method:w(`notifications/resources/updated`),params:Ve}),He=T({name:x(),description:y(x()),required:y(A())}),Ue=T({...C.shape,...b.shape,description:y(x()),arguments:y(O(He)),_meta:y(k({}))}),We=ye.extend({method:w(`prompts/list`)}),Ge=be.extend({prompts:O(Ue)}),Ke=s.extend({name:x(),arguments:M(x(),x()).optional()}),qe=l.extend({method:w(`prompts/get`),params:Ke}),L=T({type:w(`text`),text:x(),annotations:Te.optional(),_meta:M(x(),h()).optional()}),Je=T({type:w(`image`),data:Se,mimeType:x(),annotations:Te.optional(),_meta:M(x(),h()).optional()}),R=T({type:w(`audio`),data:Se,mimeType:x(),annotations:Te.optional(),_meta:M(x(),h()).optional()}),z=T({type:w(`tool_use`),name:x(),id:x(),input:M(x(),h()),_meta:M(x(),h()).optional()}),B=T({type:w(`resource`),resource:j([xe,Ce]),annotations:Te.optional(),_meta:M(x(),h()).optional()}),Ye=Ee.extend({type:w(`resource_link`)}),V=j([L,Je,R,Ye,B]),Xe=T({role:we,content:V}),Ze=f.extend({description:x().optional(),messages:O(Xe)}),Qe=d.extend({method:w(`notifications/prompts/list_changed`),params:u.optional()}),$e=T({title:x().optional(),readOnlyHint:A().optional(),destructiveHint:A().optional(),idempotentHint:A().optional(),openWorldHint:A().optional()}),et=T({taskSupport:D([`required`,`optional`,`forbidden`]).optional()}),tt=T({...C.shape,...b.shape,description:x().optional(),inputSchema:T({type:w(`object`),properties:M(x(),e).optional(),required:O(x()).optional()}).catchall(h()),outputSchema:T({type:w(`object`),properties:M(x(),e).optional(),required:O(x()).optional()}).catchall(h()).optional(),annotations:$e.optional(),execution:et.optional(),_meta:M(x(),h()).optional()}),nt=ye.extend({method:w(`tools/list`)}),rt=be.extend({tools:O(tt)}),it=f.extend({content:O(V),structuredContent:M(x(),h()).optional(),isError:A().optional()}),at=c.extend({name:x(),arguments:M(x(),h()).optional()}),ot=l.extend({method:w(`tools/call`),params:at}),st=d.extend({method:w(`notifications/tools/list_changed`),params:u.optional()}),ct=D([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),H=s.extend({level:ct}),lt=l.extend({method:w(`logging/setLevel`),params:H}),ut=u.extend({level:ct,logger:x().optional(),data:h()}),dt=d.extend({method:w(`notifications/message`),params:ut}),ft=T({name:x().optional()}),pt=T({hints:O(ft).optional(),costPriority:E().min(0).max(1).optional(),speedPriority:E().min(0).max(1).optional(),intelligencePriority:E().min(0).max(1).optional()}),mt=T({mode:D([`auto`,`required`,`none`]).optional()}),ht=T({type:w(`tool_result`),toolUseId:x().describe(`The unique identifier for the corresponding tool call.`),content:O(V),structuredContent:T({}).loose().optional(),isError:A().optional(),_meta:M(x(),h()).optional()}),gt=S(`type`,[L,Je,R]),_t=S(`type`,[L,Je,R,z,ht]),vt=T({role:we,content:j([_t,O(_t)]),_meta:M(x(),h()).optional()}),yt=c.extend({messages:O(vt),modelPreferences:pt.optional(),systemPrompt:x().optional(),includeContext:D([`none`,`thisServer`,`allServers`]).optional(),temperature:E().optional(),maxTokens:E().int(),stopSequences:O(x()).optional(),metadata:t.optional(),tools:O(tt).optional(),toolChoice:mt.optional()}),bt=l.extend({method:w(`sampling/createMessage`),params:yt}),xt=f.extend({model:x(),stopReason:y(D([`endTurn`,`stopSequence`,`maxTokens`]).or(x())),role:we,content:gt}),St=f.extend({model:x(),stopReason:y(D([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(x())),role:we,content:j([_t,O(_t)])}),Ct=T({type:w(`boolean`),title:x().optional(),description:x().optional(),default:A().optional()}),wt=T({type:w(`string`),title:x().optional(),description:x().optional(),minLength:E().optional(),maxLength:E().optional(),format:D([`email`,`uri`,`date`,`date-time`]).optional(),default:x().optional()}),Tt=T({type:D([`number`,`integer`]),title:x().optional(),description:x().optional(),minimum:E().optional(),maximum:E().optional(),default:E().optional()}),Et=T({type:w(`string`),title:x().optional(),description:x().optional(),enum:O(x()),default:x().optional()}),Dt=T({type:w(`string`),title:x().optional(),description:x().optional(),oneOf:O(T({const:x(),title:x()})),default:x().optional()}),Ot=T({type:w(`string`),title:x().optional(),description:x().optional(),enum:O(x()),enumNames:O(x()).optional(),default:x().optional()}),kt=j([Et,Dt]),At=T({type:w(`array`),title:x().optional(),description:x().optional(),minItems:E().optional(),maxItems:E().optional(),items:T({type:w(`string`),enum:O(x())}),default:O(x()).optional()}),jt=T({type:w(`array`),title:x().optional(),description:x().optional(),minItems:E().optional(),maxItems:E().optional(),items:T({anyOf:O(T({const:x(),title:x()}))}),default:O(x()).optional()}),Mt=j([At,jt]),Nt=j([Ot,kt,Mt]),Pt=j([Nt,Ct,wt,Tt]),Ft=c.extend({mode:w(`form`).optional(),message:x(),requestedSchema:T({type:w(`object`),properties:M(x(),Pt),required:O(x()).optional()}).catchall(h())}),It=c.extend({mode:w(`url`),message:x(),elicitationId:x(),url:x().url()}),Lt=j([Ft,It]),U=l.extend({method:w(`elicitation/create`),params:Lt}),W=u.extend({elicitationId:x()}),Rt=d.extend({method:w(`notifications/elicitation/complete`),params:W}),zt=f.extend({action:D([`accept`,`decline`,`cancel`]),content:ce(e=>e===null?void 0:e,M(x(),j([x(),E(),A(),O(x())])).optional())}),Bt=T({type:w(`ref/resource`),uri:x()}),Vt=T({type:w(`ref/prompt`),name:x()}),Ht=s.extend({ref:j([Vt,Bt]),argument:T({name:x(),value:x()}),context:T({arguments:M(x(),x()).optional()}).optional()}),Ut=l.extend({method:w(`completion/complete`),params:Ht}),Wt=f.extend({completion:k({values:O(x()).max(100),total:y(E().int()),hasMore:y(A())})}),Gt=T({uri:x().startsWith(`file://`),name:x().optional(),_meta:M(x(),h()).optional()}),Kt=l.extend({method:w(`roots/list`),params:s.optional()}),qt=f.extend({roots:O(Gt)}),Jt=d.extend({method:w(`notifications/roots/list_changed`),params:u.optional()}),Yt=k({ttl:E().optional(),pollInterval:E().optional()}),Xt=D([`working`,`input_required`,`completed`,`failed`,`cancelled`]),Zt=T({taskId:x(),status:Xt,ttl:j([E(),ae()]),createdAt:x(),lastUpdatedAt:x(),pollInterval:y(E()),statusMessage:y(x())}),Qt=f.extend({task:Zt}),$t=u.merge(Zt),en=d.extend({method:w(`notifications/tasks/status`),params:$t}),tn=l.extend({method:w(`tasks/get`),params:s.extend({taskId:x()})}),G=f.merge(Zt),nn=l.extend({method:w(`tasks/result`),params:s.extend({taskId:x()})}),rn=f.loose(),an=ye.extend({method:w(`tasks/list`)}),on=be.extend({tasks:O(Zt)}),sn=l.extend({method:w(`tasks/cancel`),params:s.extend({taskId:x()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:n,CursorSchema:r,TaskMetadataSchema:i,RelatedTaskMetadataSchema:a,RequestMetaSchema:o,BaseRequestParamsSchema:s,TaskAugmentedRequestParamsSchema:c,RequestSchema:l,NotificationsParamsSchema:u,NotificationSchema:d,ResultSchema:f,RequestIdSchema:p,EmptyResultSchema:m,CancelledNotificationParamsSchema:g,CancelledNotificationSchema:_,IconSchema:v,IconsSchema:b,BaseMetadataSchema:C,ImplementationSchema:te,ClientTasksCapabilitySchema:ie,ServerTasksCapabilitySchema:oe,ClientCapabilitiesSchema:le,InitializeRequestParamsSchema:ue,InitializeRequestSchema:de,ServerCapabilitiesSchema:fe,InitializeResultSchema:me,InitializedNotificationSchema:he,PingRequestSchema:N,ProgressSchema:P,ProgressNotificationParamsSchema:ge,ProgressNotificationSchema:_e,PaginatedRequestParamsSchema:ve,PaginatedRequestSchema:ye,PaginatedResultSchema:be,ResourceContentsSchema:F,TextResourceContentsSchema:xe,BlobResourceContentsSchema:Ce,RoleSchema:we,AnnotationsSchema:Te,ResourceSchema:Ee,ResourceTemplateSchema:De,ListResourcesRequestSchema:Oe,ListResourcesResultSchema:ke,ListResourceTemplatesRequestSchema:Ae,ListResourceTemplatesResultSchema:je,ResourceRequestParamsSchema:Me,ReadResourceRequestParamsSchema:Ne,ReadResourceRequestSchema:Pe,ReadResourceResultSchema:Fe,ResourceListChangedNotificationSchema:Ie,SubscribeRequestParamsSchema:Le,SubscribeRequestSchema:Re,UnsubscribeRequestParamsSchema:ze,UnsubscribeRequestSchema:Be,ResourceUpdatedNotificationParamsSchema:Ve,ResourceUpdatedNotificationSchema:I,PromptArgumentSchema:He,PromptSchema:Ue,ListPromptsRequestSchema:We,ListPromptsResultSchema:Ge,GetPromptRequestParamsSchema:Ke,GetPromptRequestSchema:qe,TextContentSchema:L,ImageContentSchema:Je,AudioContentSchema:R,ToolUseContentSchema:z,EmbeddedResourceSchema:B,ResourceLinkSchema:Ye,ContentBlockSchema:V,PromptMessageSchema:Xe,GetPromptResultSchema:Ze,PromptListChangedNotificationSchema:Qe,ToolAnnotationsSchema:$e,ToolExecutionSchema:et,ToolSchema:tt,ListToolsRequestSchema:nt,ListToolsResultSchema:rt,CallToolResultSchema:it,CallToolRequestParamsSchema:at,CallToolRequestSchema:ot,ToolListChangedNotificationSchema:st,LoggingLevelSchema:ct,SetLevelRequestParamsSchema:H,SetLevelRequestSchema:lt,LoggingMessageNotificationParamsSchema:ut,LoggingMessageNotificationSchema:dt,ModelHintSchema:ft,ModelPreferencesSchema:pt,ToolChoiceSchema:mt,ToolResultContentSchema:ht,SamplingContentSchema:gt,SamplingMessageContentBlockSchema:_t,SamplingMessageSchema:vt,CreateMessageRequestParamsSchema:yt,CreateMessageRequestSchema:bt,CreateMessageResultSchema:xt,CreateMessageResultWithToolsSchema:St,BooleanSchemaSchema:Ct,StringSchemaSchema:wt,NumberSchemaSchema:Tt,UntitledSingleSelectEnumSchemaSchema:Et,TitledSingleSelectEnumSchemaSchema:Dt,LegacyTitledEnumSchemaSchema:Ot,SingleSelectEnumSchemaSchema:kt,UntitledMultiSelectEnumSchemaSchema:At,TitledMultiSelectEnumSchemaSchema:jt,MultiSelectEnumSchemaSchema:Mt,EnumSchemaSchema:Nt,PrimitiveSchemaDefinitionSchema:Pt,ElicitRequestFormParamsSchema:Ft,ElicitRequestURLParamsSchema:It,ElicitRequestParamsSchema:Lt,ElicitRequestSchema:U,ElicitationCompleteNotificationParamsSchema:W,ElicitationCompleteNotificationSchema:Rt,ElicitResultSchema:zt,ResourceTemplateReferenceSchema:Bt,PromptReferenceSchema:Vt,CompleteRequestParamsSchema:Ht,CompleteRequestSchema:Ut,CompleteResultSchema:Wt,RootSchema:Gt,ListRootsRequestSchema:Kt,ListRootsResultSchema:qt,RootsListChangedNotificationSchema:Jt,TaskCreationParamsSchema:Yt,TaskStatusSchema:Xt,TaskSchema:Zt,CreateTaskResultSchema:Qt,TaskStatusNotificationParamsSchema:$t,TaskStatusNotificationSchema:en,GetTaskRequestSchema:tn,GetTaskResultSchema:G,GetTaskPayloadRequestSchema:nn,GetTaskPayloadResultSchema:rn,ListTasksRequestSchema:an,ListTasksResultSchema:on,CancelTaskRequestSchema:sn,CancelTaskResultSchema:f.merge(Zt),ClientRequestSchema:j([N,de,Ut,lt,qe,We,Oe,Ae,Pe,Re,Be,ot,nt,tn,nn,an,sn]),ClientNotificationSchema:j([_,_e,he,Jt,en]),ClientResultSchema:j([m,xt,St,zt,qt,G,on,Qt]),ServerRequestSchema:j([N,bt,U,Kt,tn,nn,an,sn]),ServerNotificationSchema:j([_,_e,dt,I,Ie,st,Qe,en,Rt]),ServerResultSchema:j([m,me,Wt,Ze,Ge,ke,je,Fe,it,rt,G,on,Qt]),CallToolResultWireSchema:h().superRefine((e,t)=>{if(typeof e==`object`&&e&&!Array.isArray(e)&&e.content===void 0){for(let n of fi)if(n in e){t.addIssue({code:`custom`,message:`content is required when the body carries '${n}' — another result family cannot default into an empty tools/call success`});return}}}).transform(pi).pipe(it)}}var hi;function gi(){return hi??=mi()}function _i(e){return e.type!==`object`}var vi=new Set([`const`,`enum`,`default`,`examples`]),yi=new Set([`properties`,`patternProperties`,`$defs`,`definitions`,`dependentSchemas`,`dependencies`]);function bi(e){return e!==void 0&&!(typeof e==`string`&&e.startsWith(`#`))}function xi(e){let t=typeof e.$schema==`string`?e.$schema:void 0;if(bi(e.$id))return{...t!==void 0&&{$schema:t},type:`object`,properties:{result:e},required:[`result`]};let n=Ae(e.$schema)&&e.$recursiveAnchor!==!0,r=(e,t)=>{if(Array.isArray(e))return e.map(e=>r(e,!1));if(typeof e!=`object`||!e||!t&&bi(e.$id))return e;let i={},a=!1;for(let[o,s]of Object.entries(e))t?i[o]=r(s,!1):(o===`$ref`||o===`$dynamicRef`)&&typeof s==`string`?i[o]=s===`#`?`#/properties/result`:s.startsWith(`#/`)?`#/properties/result${s.slice(1)}`:s:o===`$recursiveRef`&&s===`#`&&n?a=!0:i[o]=vi.has(o)?s:yi.has(o)?r(s,!0):r(s,!1);return a&&(`$ref`in i?i.allOf=[...Array.isArray(i.allOf)?i.allOf:[],{$ref:`#/properties/result`}]:i.$ref=`#/properties/result`),i};return{...t!==void 0&&{$schema:t},type:`object`,properties:{result:r(e,!1)},required:[`result`]}}var Si={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},Ci={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},wi={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},Ti;function Ei(){if(Ti)return Ti;let e=gi();return Ti={requestSchemas:{ping:e.PingRequestSchema,initialize:e.InitializeRequestSchema,"completion/complete":e.CompleteRequestSchema,"logging/setLevel":e.SetLevelRequestSchema,"prompts/get":e.GetPromptRequestSchema,"prompts/list":e.ListPromptsRequestSchema,"resources/list":e.ListResourcesRequestSchema,"resources/templates/list":e.ListResourceTemplatesRequestSchema,"resources/read":e.ReadResourceRequestSchema,"resources/subscribe":e.SubscribeRequestSchema,"resources/unsubscribe":e.UnsubscribeRequestSchema,"tools/call":e.CallToolRequestSchema,"tools/list":e.ListToolsRequestSchema,"tasks/get":e.GetTaskRequestSchema,"tasks/result":e.GetTaskPayloadRequestSchema,"tasks/list":e.ListTasksRequestSchema,"tasks/cancel":e.CancelTaskRequestSchema,"sampling/createMessage":e.CreateMessageRequestSchema,"elicitation/create":e.ElicitRequestSchema,"roots/list":e.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":e.CancelledNotificationSchema,"notifications/progress":e.ProgressNotificationSchema,"notifications/initialized":e.InitializedNotificationSchema,"notifications/roots/list_changed":e.RootsListChangedNotificationSchema,"notifications/tasks/status":e.TaskStatusNotificationSchema,"notifications/message":e.LoggingMessageNotificationSchema,"notifications/resources/updated":e.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":e.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":e.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":e.PromptListChangedNotificationSchema,"notifications/elicitation/complete":e.ElicitationCompleteNotificationSchema},resultSchemas:{ping:e.EmptyResultSchema,initialize:e.InitializeResultSchema,"completion/complete":e.CompleteResultSchema,"logging/setLevel":e.EmptyResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"resources/subscribe":e.EmptyResultSchema,"resources/unsubscribe":e.EmptyResultSchema,"tools/call":e.CallToolResultWireSchema,"tools/list":e.ListToolsResultSchema,"sampling/createMessage":e.CreateMessageResultWithToolsSchema,"elicitation/create":e.ElicitResultSchema,"roots/list":e.ListRootsResultSchema}},Ti}function Di(e){return Object.prototype.hasOwnProperty.call(Si,e)}function Oi(e){return Object.prototype.hasOwnProperty.call(Ci,e)}function ki(e){return Object.prototype.hasOwnProperty.call(wi,e)}function Ai(e){return ki(e)?Ei().resultSchemas[e]:void 0}function ji(e){return Di(e)?Ei().requestSchemas[e]:void 0}function Mi(e){return Oi(e)?Ei().notificationSchemas[e]:void 0}Object.keys(Si),Object.keys(Ci);function Ni(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Pi(e,t){if(e===void 0)return{ok:!1,reason:`not-in-era`};let n=e.safeParse(t);return n.success?{ok:!0,value:n.data}:{ok:!1,reason:`invalid`,message:String(n.error)}}var Fi={ok:!1,reason:`not-in-era`};function Ii(e){return Ni(e)&&Ni(e.outputSchema)&&_i(e.outputSchema)}function Li(e){return e}var Ri={era:`2025-11-25`,hasRequestMethod:Di,hasNotificationMethod:Oi,validateRequest:(e,t)=>Pi(ji(e),t),validateResult:(e,t)=>Pi(Ai(e),t),validateNotification:(e,t)=>Pi(Mi(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>Fi,validateInputResponse:()=>Fi,samplingResultVariant:((e,t)=>{let n=gi();return Pi(e?n.CreateMessageResultWithToolsSchema:n.CreateMessageResultSchema,t)}),outboundEnvelope:e=>void 0,validateEnvelopeMeta:e=>[],projectCallToolResult(e,t){let n=di(e),r=n.structuredContent;if(r===void 0)return n;let i=typeof r!=`object`||!r||Array.isArray(r),a=t!==void 0&&_i(t);return!i&&!a?n:{...n,structuredContent:{result:r}}},decodeResult(e,t){if(Ni(t)&&`resultType`in t){let e={...t};return delete e.resultType,{kind:`complete`,result:Li(e)}}return{kind:`complete`,result:Li(t)}},encodeResult(e,t){if(e!==`tools/list`)return t;let n=t.tools;return!Array.isArray(n)||!n.some(e=>Ii(e))?t:{...t,tools:n.map(e=>Ii(e)?{...e,outputSchema:xi(e.outputSchema)}:e)}},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope:e=>void 0};function zi(){let e=ee(()=>j([x(),E(),A(),ae(),M(x(),e),O(e)])),t=M(x(),e),n=j([x(),E().int()]),r=x(),i=j([x(),E().int()]),a=D([`user`,`assistant`]),o=D([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),s=x().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),c=T({ttl:E().optional()}),l=T({taskId:x()}),u=k({progressToken:n.optional(),"io.modelcontextprotocol/related-task":l.optional()}),d=T({_meta:u.optional()}),f=d.extend({task:c.optional()}),p=T({_meta:u.optional()}),m=T({method:x(),params:p.loose().optional()}),g=T({src:x(),mimeType:x().optional(),sizes:O(x()).optional(),theme:D([`light`,`dark`]).optional()}),_=T({icons:O(g).optional()}),v=T({name:x(),title:x().optional()}),b=v.extend({...v.shape,..._.shape,version:x(),websiteUrl:x().optional(),description:x().optional()}),S=se(T({applyDefaults:A().optional()}),t),C=ce(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,se(T({form:S.optional(),url:t.optional()}),t.optional())),te=k({list:t.optional(),cancel:t.optional(),requests:k({sampling:k({createMessage:t.optional()}).optional(),elicitation:k({create:t.optional()}).optional()}).optional()}),ne=k({list:t.optional(),cancel:t.optional(),requests:k({tools:k({call:t.optional()}).optional()}).optional()}),re=T({experimental:M(x(),t).optional(),sampling:T({context:t.optional(),tools:t.optional()}).optional(),elicitation:C.optional(),roots:T({listChanged:A().optional()}).optional(),tasks:te.optional(),extensions:M(x(),t).optional()}),ie=T({experimental:M(x(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:T({listChanged:A().optional()}).optional(),resources:T({subscribe:A().optional(),listChanged:A().optional()}).optional(),tools:T({listChanged:A().optional()}).optional(),tasks:ne.optional(),extensions:M(x(),t).optional()}),oe=T({progress:E(),total:y(E()),message:y(x())}),le=T({...p.shape,...oe.shape,progressToken:n}),ue=m.extend({method:w(`notifications/progress`),params:le}),de=p.extend({level:o,logger:x().optional(),data:h()}),fe=m.extend({method:w(`notifications/message`),params:de}),me=T({uri:x(),mimeType:y(x()),_meta:M(x(),h()).optional()}),he=me.extend({text:x()}),N=me.extend({blob:s}),P=T({audience:O(a).optional(),priority:E().min(0).max(1).optional(),lastModified:pe({offset:!0}).optional()}),ge=T({...v.shape,..._.shape,uri:x(),description:y(x()),mimeType:y(x()),size:y(E()),annotations:P.optional(),_meta:y(k({}))}),_e=T({...v.shape,..._.shape,uriTemplate:x(),description:y(x()),mimeType:y(x()),annotations:P.optional(),_meta:y(k({}))}),ve=m.extend({method:w(`notifications/resources/list_changed`),params:p.optional()}),ye=p.extend({uri:x()}),be=m.extend({method:w(`notifications/resources/updated`),params:ye}),F=T({name:x(),description:y(x()),required:y(A())}),xe=T({...v.shape,..._.shape,description:y(x()),arguments:y(O(F)),_meta:y(k({}))}),Se=m.extend({method:w(`notifications/prompts/list_changed`),params:p.optional()}),Ce=T({type:w(`text`),text:x(),annotations:P.optional(),_meta:M(x(),h()).optional()}),we=T({type:w(`image`),data:s,mimeType:x(),annotations:P.optional(),_meta:M(x(),h()).optional()}),Te=T({type:w(`audio`),data:s,mimeType:x(),annotations:P.optional(),_meta:M(x(),h()).optional()}),Ee=T({type:w(`tool_use`),name:x(),id:x(),input:M(x(),h()),_meta:M(x(),h()).optional()}),De=T({type:w(`resource`),resource:j([he,N]),annotations:P.optional(),_meta:M(x(),h()).optional()}),Oe=ge.extend({type:w(`resource_link`)}),ke=j([Ce,we,Te,Oe,De]),Ae=T({role:a,content:ke}),je=T({title:x().optional(),readOnlyHint:A().optional(),destructiveHint:A().optional(),idempotentHint:A().optional(),openWorldHint:A().optional()}),Me=m.extend({method:w(`notifications/tools/list_changed`),params:p.optional()}),Ne=T({name:x().optional()}),Pe=T({hints:O(Ne).optional(),costPriority:E().min(0).max(1).optional(),speedPriority:E().min(0).max(1).optional(),intelligencePriority:E().min(0).max(1).optional()}),ze=T({mode:D([`auto`,`required`,`none`]).optional()}),Ve=T({type:w(`boolean`),title:x().optional(),description:x().optional(),default:A().optional()}),I=T({type:w(`string`),title:x().optional(),description:x().optional(),minLength:E().optional(),maxLength:E().optional(),format:D([`email`,`uri`,`date`,`date-time`]).optional(),default:x().optional()}),He=T({type:D([`number`,`integer`]),title:x().optional(),description:x().optional(),minimum:E().optional(),maximum:E().optional(),default:E().optional()}),Ue=T({type:w(`string`),title:x().optional(),description:x().optional(),enum:O(x()),default:x().optional()}),We=T({type:w(`string`),title:x().optional(),description:x().optional(),oneOf:O(T({const:x(),title:x()})),default:x().optional()}),Ge=T({type:w(`string`),title:x().optional(),description:x().optional(),enum:O(x()),enumNames:O(x()).optional(),default:x().optional()}),Ke=j([Ue,We]),qe=T({type:w(`array`),title:x().optional(),description:x().optional(),minItems:E().optional(),maxItems:E().optional(),items:T({type:w(`string`),enum:O(x())}),default:O(x()).optional()}),L=T({type:w(`array`),title:x().optional(),description:x().optional(),minItems:E().optional(),maxItems:E().optional(),items:T({anyOf:O(T({const:x(),title:x()}))}),default:O(x()).optional()}),Je=j([qe,L]),R=j([Ge,Ke,Je]),z=j([R,Ve,I,He]),B=f.extend({mode:w(`form`).optional(),message:x(),requestedSchema:T({type:w(`object`),properties:M(x(),z),required:O(x()).optional()}).catchall(h())}),Ye=T({type:w(`ref/resource`),uri:x()}),V=T({type:w(`ref/prompt`),name:x()}),Xe=T({uri:x().startsWith(`file://`),name:x().optional(),_meta:M(x(),h()).optional()}),Ze=re.shape,Qe=T({experimental:Ze.experimental,sampling:Ze.sampling,elicitation:Ze.elicitation,roots:Ze.roots,extensions:Ze.extensions}),$e=ie.shape,et=T({experimental:$e.experimental,logging:$e.logging,completions:$e.completions,prompts:$e.prompts,resources:$e.resources,tools:$e.tools,extensions:$e.extensions}),tt=k({progressToken:n.optional(),[Fe]:x(),[Ie]:b.optional(),[Re]:Qe,[Be]:o.optional()}),nt=T({...v.shape,..._.shape,description:x().optional(),inputSchema:k({$schema:x().optional(),type:w(`object`)}),outputSchema:k({$schema:x().optional()}).optional(),annotations:je.optional(),_meta:M(x(),h()).optional()}),rt=T({type:w(`tool_result`),toolUseId:x(),content:O(ke),structuredContent:h().optional(),isError:A().optional(),_meta:M(x(),h()).optional()}),it=j([Ce,we,Te,Ee,rt]),at=T({role:a,content:j([it,O(it)]),_meta:M(x(),h()).optional()}),ot=x(),st=k({[Le]:b.optional().catch(void 0)}),ct=st.optional();function H(e){return k({_meta:ct,resultType:ot.default(`complete`),...e})}let lt=H({}),ut=H({nextCursor:r.optional()}),dt=H({content:O(ke),structuredContent:h().optional(),isError:A().optional()}),ft=H({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),tools:O(nt),nextCursor:r.optional()}),pt=H({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),prompts:O(xe),nextCursor:r.optional()}),mt=H({description:x().optional(),messages:O(Ae)}),ht=H({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),resources:O(ge),nextCursor:r.optional()}),gt=H({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),resourceTemplates:O(_e),nextCursor:r.optional()}),_t=H({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),contents:O(j([he,N]))}),vt=H({completion:T({values:O(x()).max(100),total:E().int().optional(),hasMore:A().optional()}).loose()}),yt=H({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`])}),bt=H({ttlMs:E().int().min(0).catch(0),cacheScope:D([`public`,`private`]).catch(`private`),supportedVersions:O(x()),capabilities:et,instructions:x().optional()}),xt=T({messages:O(at),modelPreferences:Pe.optional(),systemPrompt:x().optional(),includeContext:D([`none`,`thisServer`,`allServers`]).optional(),temperature:E().optional(),maxTokens:E().int(),stopSequences:O(x()).optional(),metadata:t.optional(),tools:O(nt).optional(),toolChoice:ze.optional()}),St=T({method:w(`sampling/createMessage`),params:xt}),Ct=T({method:w(`roots/list`),params:T({_meta:M(x(),h()).optional()}).optional()}),wt=T({...at.shape,model:x(),stopReason:x().optional()}),Tt=T({roots:O(Xe)}),Et=T({action:D([`accept`,`decline`,`cancel`]),content:M(x(),j([x(),E(),A(),O(x())])).optional()}),Dt=T({mode:w(`url`),message:x(),url:x().url()}),Ot=j([B,Dt]),kt=T({method:w(`elicitation/create`),params:Ot}),At=j([St,Ct,kt]),jt=j([wt,Tt,Et]),Mt=M(x(),At),Nt=M(x(),jt),Pt=H({inputRequests:Mt.optional(),requestState:x().optional()}),Ft={inputResponses:Nt.optional(),requestState:x().optional()},It=T({_meta:tt,...Ft}),Lt=k({progressToken:n.optional()});function U(e,t){return T({method:w(e),params:T({_meta:tt,...t})})}function W(e,t){return T({method:w(e),params:T({_meta:Lt.optional(),...t}).optional()})}let Rt={name:x(),arguments:M(x(),h()).optional(),...Ft},zt={cursor:r.optional()},Bt=U(`tools/call`,Rt),Vt=U(`tools/list`,zt),Ht=U(`prompts/list`,zt),Ut=U(`prompts/get`,{name:x(),arguments:M(x(),x()).optional(),...Ft}),Wt=U(`resources/list`,zt),Gt=U(`resources/templates/list`,zt),Kt=U(`resources/read`,{uri:x(),...Ft}),qt={ref:j([V,Ye]),argument:T({name:x(),value:x()}),context:T({arguments:M(x(),x()).optional()}).optional()},Jt=U(`completion/complete`,qt),Yt=U(`server/discover`,{}),Xt=T({toolsListChanged:A().optional(),promptsListChanged:A().optional(),resourcesListChanged:A().optional(),resourceSubscriptions:O(x()).optional()}),Zt={notifications:Xt},Qt=U(`subscriptions/listen`,Zt),$t=st.extend({"io.modelcontextprotocol/subscriptionId":i}),en=k({_meta:$t,resultType:ot.default(`complete`)}),tn={"tools/call":W(`tools/call`,Rt),"tools/list":W(`tools/list`,zt),"prompts/get":W(`prompts/get`,{name:x(),arguments:M(x(),x()).optional()}),"prompts/list":W(`prompts/list`,zt),"resources/list":W(`resources/list`,zt),"resources/templates/list":W(`resources/templates/list`,zt),"resources/read":W(`resources/read`,{uri:x()}),"completion/complete":W(`completion/complete`,qt),"server/discover":W(`server/discover`,{}),"subscriptions/listen":W(`subscriptions/listen`,Zt)};function G(e){return k({_meta:ct,...e})}let nn={"tools/call":G({content:O(ke),structuredContent:h().optional(),isError:A().optional()}),"tools/list":G({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),tools:O(nt),nextCursor:r.optional()}),"prompts/get":G({description:x().optional(),messages:O(Ae)}),"prompts/list":G({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),prompts:O(xe),nextCursor:r.optional()}),"resources/list":G({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),resources:O(ge),nextCursor:r.optional()}),"resources/templates/list":G({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),resourceTemplates:O(_e),nextCursor:r.optional()}),"resources/read":G({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),contents:O(j([he,N]))}),"completion/complete":G({completion:T({values:O(x()).max(100),total:E().int().optional(),hasMore:A().optional()}).loose()}),"server/discover":G({ttlMs:E().int().min(0).catch(0),cacheScope:D([`public`,`private`]).catch(`private`),supportedVersions:O(x()),capabilities:et,instructions:x().optional()}),"subscriptions/listen":G({})},rn=k({"io.modelcontextprotocol/subscriptionId":i.optional()}),an=T({method:w(`notifications/subscriptions/acknowledged`),params:T({_meta:rn.optional(),notifications:Xt})}),on=T({_meta:rn.optional(),requestId:i,reason:x().optional()}),sn=T({method:w(`notifications/cancelled`),params:on}),cn={"notifications/cancelled":sn,"notifications/progress":ue,"notifications/message":fe,"notifications/resources/updated":be,"notifications/resources/list_changed":ve,"notifications/tools/list_changed":Me,"notifications/prompts/list_changed":Se,"notifications/subscriptions/acknowledged":an},K=e=>T({jsonrpc:w(`2.0`),id:j([x(),E().int()]),result:e}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:n,CursorSchema:r,RequestIdSchema:i,RoleSchema:a,LoggingLevelSchema:o,TaskMetadataSchema:c,RelatedTaskMetadataSchema:l,RequestMetaSchema:u,BaseRequestParamsSchema:d,TaskAugmentedRequestParamsSchema:f,NotificationsParamsSchema:p,NotificationSchema:m,IconSchema:g,IconsSchema:_,BaseMetadataSchema:v,ImplementationSchema:b,ClientTasksCapabilitySchema:te,ServerTasksCapabilitySchema:ne,ClientCapabilitiesSchema:re,ServerCapabilitiesSchema:ie,ProgressSchema:oe,ProgressNotificationParamsSchema:le,ProgressNotificationSchema:ue,LoggingMessageNotificationParamsSchema:de,LoggingMessageNotificationSchema:fe,ResourceContentsSchema:me,TextResourceContentsSchema:he,BlobResourceContentsSchema:N,AnnotationsSchema:P,ResourceSchema:ge,ResourceTemplateSchema:_e,ResourceListChangedNotificationSchema:ve,ResourceUpdatedNotificationParamsSchema:ye,ResourceUpdatedNotificationSchema:be,PromptArgumentSchema:F,PromptSchema:xe,PromptListChangedNotificationSchema:Se,TextContentSchema:Ce,ImageContentSchema:we,AudioContentSchema:Te,ToolUseContentSchema:Ee,EmbeddedResourceSchema:De,ResourceLinkSchema:Oe,ContentBlockSchema:ke,PromptMessageSchema:Ae,ToolAnnotationsSchema:je,ToolListChangedNotificationSchema:Me,ModelHintSchema:Ne,ModelPreferencesSchema:Pe,ToolChoiceSchema:ze,BooleanSchemaSchema:Ve,StringSchemaSchema:I,NumberSchemaSchema:He,UntitledSingleSelectEnumSchemaSchema:Ue,TitledSingleSelectEnumSchemaSchema:We,LegacyTitledEnumSchemaSchema:Ge,SingleSelectEnumSchemaSchema:Ke,UntitledMultiSelectEnumSchemaSchema:qe,TitledMultiSelectEnumSchemaSchema:L,MultiSelectEnumSchemaSchema:Je,EnumSchemaSchema:R,PrimitiveSchemaDefinitionSchema:z,ElicitRequestFormParamsSchema:B,ResourceTemplateReferenceSchema:Ye,PromptReferenceSchema:V,RootSchema:Xe,ClientCapabilities2026Schema:Qe,ServerCapabilities2026Schema:et,RequestMetaEnvelopeSchema:tt,ToolSchema:nt,ToolResultContentSchema:rt,SamplingMessageContentBlockSchema:it,SamplingMessageSchema:at,ResultTypeSchema:ot,ResultMetaSchema:st,ResultSchema:lt,PaginatedResultSchema:ut,CallToolResultSchema:dt,ListToolsResultSchema:ft,ListPromptsResultSchema:pt,GetPromptResultSchema:mt,ListResourcesResultSchema:ht,ListResourceTemplatesResultSchema:gt,ReadResourceResultSchema:_t,CompleteResultSchema:vt,CacheableResultSchema:yt,DiscoverResultSchema:bt,CreateMessageRequestParamsSchema:xt,CreateMessageRequestSchema:St,ListRootsRequestSchema:Ct,CreateMessageResultSchema:wt,ListRootsResultSchema:Tt,ElicitResultSchema:Et,ElicitRequestURLParamsSchema:Dt,ElicitRequestParamsSchema:Ot,ElicitRequestSchema:kt,InputRequestSchema:At,InputResponseSchema:jt,InputRequestsSchema:Mt,InputResponsesSchema:Nt,InputRequiredResultSchema:Pt,InputResponseRequestParamsSchema:It,CallToolRequestSchema:Bt,ListToolsRequestSchema:Vt,ListPromptsRequestSchema:Ht,GetPromptRequestSchema:Ut,ListResourcesRequestSchema:Wt,ListResourceTemplatesRequestSchema:Gt,ReadResourceRequestSchema:Kt,CompleteRequestSchema:Jt,DiscoverRequestSchema:Yt,SubscriptionFilterSchema:Xt,SubscriptionsListenRequestSchema:Qt,SubscriptionsListenResultMetaSchema:$t,SubscriptionsListenResultSchema:en,dispatchRequestSchemas:tn,dispatchResultSchemas:nn,NotificationMetaSchema:rn,SubscriptionsAcknowledgedNotificationSchema:an,CancelledNotificationParamsSchema:on,CancelledNotificationSchema:sn,notificationSchemas2026:cn,JSONRPCResultResponseSchema:K(lt),CallToolResultResponseSchema:K(j([dt,Pt])),ListToolsResultResponseSchema:K(ft),ListPromptsResultResponseSchema:K(pt),GetPromptResultResponseSchema:K(j([mt,Pt])),ListResourcesResultResponseSchema:K(ht),ListResourceTemplatesResultResponseSchema:K(gt),ReadResourceResultResponseSchema:K(j([_t,Pt])),CompleteResultResponseSchema:K(vt),DiscoverResultResponseSchema:K(bt),SubscriptionsListenResultResponseSchema:K(en)}}var Bi;function Vi(){return Bi??=zi()}var Hi=[`tools/list`,`prompts/list`,`resources/list`,`resources/templates/list`,`resources/read`,`server/discover`];function Ui(e){return Hi.includes(e)}var Wi=Symbol(`modelcontextprotocol.resultCacheHintFallback`);function Gi(e){return e[Wi]}function Ki(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function qi(e){return e===`public`||e===`private`}var X=function(e){return e[e.ParseError=-32700]=`ParseError`,e[e.InvalidRequest=-32600]=`InvalidRequest`,e[e.MethodNotFound=-32601]=`MethodNotFound`,e[e.InvalidParams=-32602]=`InvalidParams`,e[e.InternalError=-32603]=`InternalError`,e[e.ResourceNotFound=-32002]=`ResourceNotFound`,e[e.MissingRequiredClientCapability=-32021]=`MissingRequiredClientCapability`,e[e.UnsupportedProtocolVersion=-32022]=`UnsupportedProtocolVersion`,e[e.UrlElicitationRequired=-32042]=`UrlElicitationRequired`,e}({}),Z=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.ProtocolError`})}static[Symbol.hasInstance](e){return $r(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return $r(this,e)}constructor(e,t,n){super(t),this.code=e,this.data=n,this.name=`ProtocolError`,Qr(this,new.target)}static fromError(t,n,r){if(t===X.UrlElicitationRequired&&r){let e=r;if(e.elicitations)return new Yi(e.elicitations,n)}if(t===X.UnsupportedProtocolVersion&&r){let e=r;if(Array.isArray(e.supported)&&typeof e.requested==`string`)return new Xi({supported:e.supported,requested:e.requested},n)}if(t===X.InvalidParams||t===X.ResourceNotFound){let e=r;if(typeof e?.uri==`string`&&(t===X.ResourceNotFound||Object.keys(e).length===1))return new Ji(e.uri,n)}if(t===X.MissingRequiredClientCapability&&r){let e=r;if(e.requiredCapabilities!==null&&typeof e.requiredCapabilities==`object`&&!Array.isArray(e.requiredCapabilities))return new Zi({requiredCapabilities:e.requiredCapabilities},n)}return new e(t,n,r)}},Ji=class extends Z{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.ResourceNotFoundError`})}constructor(e,t=`Resource not found: ${e}`){super(X.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},Yi=class extends Z{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UrlElicitationRequiredError`})}constructor(e,t=`URL elicitation${e.length>1?`s`:``} required`){super(X.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},Xi=class extends Z{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UnsupportedProtocolVersionError`})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(X.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},Zi=class extends Z{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.MissingRequiredClientCapabilityError`})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(`, `)}`){super(X.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},Qi=0,$i=`private`,ea=[`tools/call`,`prompts/get`,`resources/read`];function ta(e,t){let n=t.resultType;if(n===void 0)return{...t,resultType:`complete`};if(n===`complete`||ea.includes(e))return t;throw new Z(X.InternalError,`Handler for ${e} returned resultType '${String(n)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function na(e,t){let n=Gi(t);if(t.resultType!==`complete`||!Ui(e))return n===void 0?t:sa(t);let r=t,i=Ki(r.ttlMs)?r.ttlMs:aa(n),a=qi(r.cacheScope)?r.cacheScope:oa(n),o={...r,ttlMs:i,cacheScope:a};return delete o[Wi],o}function ra(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ia(e,t){if(t===void 0)return e;let n=e._meta;return n===void 0?{...e,_meta:{[Le]:t}}:!ra(n)||n[`io.modelcontextprotocol/serverInfo`]!==void 0?e:{...e,_meta:{...n,[Le]:t}}}function aa(e){return e!==void 0&&Ki(e.ttlMs)?e.ttlMs:Qi}function oa(e){return e!==void 0&&qi(e.cacheScope)?e.cacheScope:$i}function sa(e){let t={...e};return delete t[Wi],t}var ca=[`elicitation/create`,`sampling/createMessage`,`roots/list`],la;function ua(){if(la)return la;let e=Vi();return la={request:{"elicitation/create":T({method:w(`elicitation/create`),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":T({method:w(`sampling/createMessage`),params:e.CreateMessageRequestParamsSchema}),"roots/list":T({method:w(`roots/list`),params:k({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},la}function da(e){return ca.includes(e)}function fa(e){return da(e)?ua().request[e]:void 0}function pa(e){return da(e)?ua().response[e]:void 0}var ma={"tools/call":null,"tools/list":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"completion/complete":null,"server/discover":null,"subscriptions/listen":null},ha={"notifications/cancelled":null,"notifications/progress":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/subscriptions/acknowledged":null};function ga(e){return Object.prototype.hasOwnProperty.call(ma,e)}function _a(e){return Object.prototype.hasOwnProperty.call(ha,e)}function va(e){return Object.prototype.hasOwnProperty.call(ma,e)}function ya(e){return ga(e)?Vi().dispatchRequestSchemas[e]:void 0}function ba(e){return va(e)?Vi().dispatchResultSchemas[e]:void 0}function xa(e){return _a(e)?Vi().notificationSchemas2026[e]:void 0}Object.keys(ma),Object.keys(ha);function Sa(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ca(e,t){if(e===void 0)return{ok:!1,reason:`not-in-era`};let n=e.safeParse(t);return n.success?{ok:!0,value:n.data}:{ok:!1,reason:`invalid`,message:String(n.error)}}var wa={ok:!1,reason:`not-in-era`},Ta=[Fe,Re];function Ea(e,t){let n=t,r=!1,i=()=>(r||=(n={...n},!0),n),a=t.tools;e===`tools/list`&&Array.isArray(a)&&a.some(e=>Sa(e)&&`execution`in e)&&(i().tools=a.map(e=>{if(!Sa(e)||!(`execution`in e))return e;let t={...e};return delete t.execution,t}));let o=t.capabilities;if(Sa(o)&&`tasks`in o){let e={...o};delete e.tasks,i().capabilities=e}return n}var Da={era:`2026-07-28`,hasRequestMethod:ga,hasNotificationMethod:_a,hasInputRequestMethod:e=>fa(e)!==void 0,validateRequest:(e,t)=>Ca(ya(e),t),validateResult:(e,t)=>Ca(ba(e),t),validateNotification:(e,t)=>Ca(xa(e),t),validateInputRequest:(e,t)=>Ca(fa(e),t),validateInputResponse:(e,t)=>Ca(pa(e),t),samplingResultVariant:()=>wa,outboundEnvelope(e){return{[Fe]:e.protocolVersion,[Ie]:e.clientInfo,[Re]:e.clientCapabilities,...e.logLevel!==void 0&&{"io.modelcontextprotocol/logLevel":e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let n of Ta)n in e||t.push({key:n,problem:`missing`});let n=Vi().RequestMetaEnvelopeSchema.safeParse(e);if(!n.success)for(let e of n.error.issues){let n=e.path.map(String),r=n.length>0?n.join(`.`):`_meta`;n.length===1&&t.some(e=>e.key===r&&e.problem===`missing`)||t.push({key:r,problem:e.message})}return t},projectCallToolResult:e=>di(e),inputRequestSchema:fa,decodeResult(e,t){if(!Sa(t))return{kind:`invalid`,error:new Y(J.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let n=t.resultType;if(n===void 0)return{kind:`invalid`,error:new Y(J.InvalidResult,`Invalid result for ${e}: missing required resultType — servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:e,violation:`missing-resultType`})};if(typeof n!=`string`)return{kind:`invalid`,error:new Y(J.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:n})};if(n===`input_required`){let n=t.inputRequests,r=Sa(n)?n:{},i=t.requestState,a=t._meta===void 0?void 0:Vi().ResultMetaSchema.safeParse(t._meta),o=a?.success?a.data:void 0;return Object.keys(r).length===0&&typeof i!=`string`?{kind:`invalid`,error:new Y(J.InvalidResult,`Invalid result for ${e}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:e,violation:`input-required-missing-both`})}:{kind:`input_required`,inputRequests:r,...typeof i==`string`&&{requestState:i},...o!==void 0&&{_meta:o}}}if(n!==`complete`)return{kind:`invalid`,error:new Y(J.UnsupportedResultType,`Unsupported result type '${n}' for ${e}`,{resultType:n,method:e})};let r=ka(),i=Object.hasOwn(r,e)?r[e]:void 0;if(i!==void 0){let n=i.safeParse(t);if(!n.success)return{kind:`invalid`,error:new Y(J.InvalidResult,`Invalid result for ${e}: ${n.error}`,{method:e})}}let a={...t};return delete a.resultType,{kind:`complete`,result:a}},encodeResult(e,t,n){return ia(na(e,ta(e,Ea(e,t))),n)},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope(e){if(e.envelope===void 0)return`Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)`;let t=Vi().RequestMetaEnvelopeSchema.safeParse(e.envelope);if(!t.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${t.error.issues.map(e=>e.message).join(`; `)}`}},Oa;function ka(){if(Oa)return Oa;let e=Vi();return Oa={"tools/call":e.CallToolResultSchema,"tools/list":e.ListToolsResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"completion/complete":e.CompleteResultSchema,"server/discover":e.DiscoverResultSchema},Oa}var Aa=`2026-07-28`;function ja(e){return e!==void 0&&ci(e)?Da:Ri}function Ma(e){return e.revision===void 0?e.era===`modern`?Da.era:Ri.era:ja(e.revision).era}function Na(e){return Ia.some(t=>t.hasRequestMethod(e))}function Pa(e){return Ia.some(t=>t.hasNotificationMethod(e))}function Fa(e){return e===`tasks/get`||e===`tasks/cancel`}var Ia=[Ri,Da],La=Ce({AnnotationsSchema:()=>Nt,AudioContentSchema:()=>ln,BaseMetadataSchema:()=>ct,BaseRequestParamsSchema:()=>L,BlobResourceContentsSchema:()=>jt,BooleanSchemaSchema:()=>Wn,CallToolRequestParamsSchema:()=>wn,CallToolRequestSchema:()=>Tn,CallToolResultSchema:()=>Sn,CancelTaskRequestSchema:()=>Ar,CancelTaskResultSchema:()=>jr,CancelledNotificationParamsSchema:()=>it,CancelledNotificationSchema:()=>at,ClientCapabilitiesSchema:()=>pt,ClientNotificationSchema:()=>Nr,ClientRequestSchema:()=>Mr,ClientResultSchema:()=>Pr,ClientTasksCapabilitySchema:()=>dt,CompatibilityCallToolResultSchema:()=>Cn,CompleteRequestParamsSchema:()=>dr,CompleteRequestSchema:()=>fr,CompleteResultSchema:()=>pr,ContentBlockSchema:()=>pn,CreateMessageRequestParamsSchema:()=>Bn,CreateMessageRequestSchema:()=>Vn,CreateMessageResultSchema:()=>Hn,CreateMessageResultWithToolsSchema:()=>Un,CreateTaskResultSchema:()=>xr,CursorSchema:()=>We,DiscoverRequestSchema:()=>yt,DiscoverResultSchema:()=>bt,ElicitRequestFormParamsSchema:()=>nr,ElicitRequestParamsSchema:()=>ir,ElicitRequestSchema:()=>ar,ElicitRequestURLParamsSchema:()=>rr,ElicitResultSchema:()=>cr,ElicitationCompleteNotificationParamsSchema:()=>or,ElicitationCompleteNotificationSchema:()=>sr,EmbeddedResourceSchema:()=>dn,EmptyResultSchema:()=>rt,EnumSchemaSchema:()=>er,GetPromptRequestParamsSchema:()=>on,GetPromptRequestSchema:()=>sn,GetPromptResultSchema:()=>hn,GetTaskPayloadRequestSchema:()=>Er,GetTaskPayloadResultSchema:()=>Dr,GetTaskRequestSchema:()=>wr,GetTaskResultSchema:()=>Tr,IconSchema:()=>ot,IconsSchema:()=>st,ImageContentSchema:()=>K,ImplementationSchema:()=>H,InitializeRequestParamsSchema:()=>mt,InitializeRequestSchema:()=>ht,InitializeResultSchema:()=>_t,InitializedNotificationSchema:()=>vt,JSONArraySchema:()=>He,JSONObjectSchema:()=>I,JSONRPCErrorResponseSchema:()=>et,JSONRPCMessageSchema:()=>tt,JSONRPCNotificationSchema:()=>Qe,JSONRPCRequestSchema:()=>Ze,JSONRPCResponseSchema:()=>nt,JSONRPCResultResponseSchema:()=>$e,JSONValueSchema:()=>Ve,LegacyTitledEnumSchemaSchema:()=>Yn,ListChangedOptionsBaseSchema:()=>Dn,ListPromptsRequestSchema:()=>rn,ListPromptsResultSchema:()=>an,ListResourceTemplatesRequestSchema:()=>U,ListResourceTemplatesResultSchema:()=>W,ListResourcesRequestSchema:()=>It,ListResourcesResultSchema:()=>Lt,ListRootsRequestSchema:()=>hr,ListRootsResultSchema:()=>gr,ListTasksRequestSchema:()=>Or,ListTasksResultSchema:()=>kr,ListToolsRequestSchema:()=>bn,ListToolsResultSchema:()=>xn,LoggingLevelSchema:()=>On,LoggingMessageNotificationParamsSchema:()=>jn,LoggingMessageNotificationSchema:()=>Mn,ModelHintSchema:()=>Nn,ModelPreferencesSchema:()=>Pn,MultiSelectEnumSchemaSchema:()=>$n,NotificationSchema:()=>B,NotificationsParamsSchema:()=>z,NumberSchemaSchema:()=>Kn,PaginatedRequestParamsSchema:()=>Tt,PaginatedRequestSchema:()=>Et,PaginatedResultSchema:()=>Dt,PingRequestSchema:()=>xt,PrimitiveSchemaDefinitionSchema:()=>tr,ProgressNotificationParamsSchema:()=>Ct,ProgressNotificationSchema:()=>wt,ProgressSchema:()=>St,ProgressTokenSchema:()=>Ue,PromptArgumentSchema:()=>G,PromptListChangedNotificationSchema:()=>gn,PromptMessageSchema:()=>mn,PromptReferenceSchema:()=>ur,PromptSchema:()=>nn,ReadResourceRequestParamsSchema:()=>zt,ReadResourceRequestSchema:()=>Bt,ReadResourceResultSchema:()=>Vt,RelatedTaskMetadataSchema:()=>Ke,RequestIdSchema:()=>Xe,RequestMetaSchema:()=>qe,RequestSchema:()=>R,ResourceContentsSchema:()=>Ot,ResourceLinkSchema:()=>fn,ResourceListChangedNotificationSchema:()=>Ht,ResourceRequestParamsSchema:()=>Rt,ResourceSchema:()=>Pt,ResourceTemplateReferenceSchema:()=>lr,ResourceTemplateSchema:()=>Ft,ResourceUpdatedNotificationParamsSchema:()=>en,ResourceUpdatedNotificationSchema:()=>tn,ResultMetaObjectSchema:()=>Ye,ResultSchema:()=>V,RoleSchema:()=>Mt,RootSchema:()=>mr,RootsListChangedNotificationSchema:()=>_r,SamplingContentSchema:()=>Ln,SamplingMessageContentBlockSchema:()=>Rn,SamplingMessageSchema:()=>zn,ServerCapabilitiesSchema:()=>gt,ServerNotificationSchema:()=>Ir,ServerRequestSchema:()=>Fr,ServerResultSchema:()=>Lr,ServerTasksCapabilitySchema:()=>ft,SetLevelRequestParamsSchema:()=>kn,SetLevelRequestSchema:()=>An,SingleSelectEnumSchemaSchema:()=>Xn,StringSchemaSchema:()=>Gn,SubscribeRequestParamsSchema:()=>Ut,SubscribeRequestSchema:()=>Wt,SubscriptionFilterSchema:()=>qt,SubscriptionsAcknowledgedNotificationParamsSchema:()=>Xt,SubscriptionsAcknowledgedNotificationSchema:()=>Zt,SubscriptionsListenRequestParamsSchema:()=>Jt,SubscriptionsListenRequestSchema:()=>Yt,SubscriptionsListenResultMetaSchema:()=>Qt,SubscriptionsListenResultSchema:()=>$t,TaskAugmentedRequestParamsSchema:()=>Je,TaskCreationParamsSchema:()=>vr,TaskMetadataSchema:()=>Ge,TaskSchema:()=>br,TaskStatusNotificationParamsSchema:()=>Sr,TaskStatusNotificationSchema:()=>Cr,TaskStatusSchema:()=>yr,TextContentSchema:()=>cn,TextResourceContentsSchema:()=>kt,TitledMultiSelectEnumSchemaSchema:()=>Qn,TitledSingleSelectEnumSchemaSchema:()=>Jn,ToolAnnotationsSchema:()=>_n,ToolChoiceSchema:()=>Fn,ToolExecutionSchema:()=>vn,ToolListChangedNotificationSchema:()=>En,ToolResultContentSchema:()=>In,ToolSchema:()=>yn,ToolUseContentSchema:()=>un,UnsubscribeRequestParamsSchema:()=>Gt,UnsubscribeRequestSchema:()=>Kt,UntitledMultiSelectEnumSchemaSchema:()=>Zn,UntitledSingleSelectEnumSchemaSchema:()=>qn}),Ra=e=>Ze.safeParse(e).success,za=e=>Qe.safeParse(e).success,Ba=e=>$e.safeParse(e).success,Va=e=>et.safeParse(e).success,Ha=e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&e.resultType===`input_required`,Ua=e=>ht.safeParse(e).success,Wa=e=>vt.safeParse(e).success,Ga=`Mcp-Param-`,Ka=`x-mcp-header`,qa=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,Ja=new Set([`string`,`integer`,`boolean`,`number`]);function Ya(e){let t=[],n=new Map,r=(e,i,a)=>{if(typeof e!=`object`||!e)return;let o=e;if(Ka in o){if(!a||i.length===0)return`${Qa(i)}: x-mcp-header is only permitted on properties statically reachable via a chain of 'properties' keys (not under items, additionalProperties, oneOf/anyOf/allOf/not, if/then/else, or $ref)`;let e=o[Ka];if(typeof e!=`string`||e.length===0)return`${Qa(i)}: x-mcp-header MUST be a non-empty string`;if(!qa.test(e))return`${Qa(i)}: x-mcp-header '${e}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let r=typeof o.type==`string`?o.type:void 0;if(r===void 0||!Ja.has(r))return`${Qa(i)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${r??``}`;let s=e.toLowerCase(),c=n.get(s);if(c!==void 0)return`x-mcp-header '${e}' is not case-insensitively unique (also declared as '${c}')`;n.set(s,e),t.push({path:i,headerName:e,type:r})}let s=o.properties;if(typeof s==`object`&&s)for(let[e,t]of Object.entries(s)){let n=r(t,[...i,e],a);if(n!==void 0)return n}for(let e of Xa){let t=o[e];if(t===void 0)continue;let n=Array.isArray(t)?t:typeof t==`object`&&t&&Za.has(e)?Object.values(t):[t];for(let t of n){let n=r(t,[...i,`<${e}>`],!1);if(n!==void 0)return n}}},i=r(e,[],!0);return i===void 0?{valid:!0,declarations:t}:{valid:!1,reason:i}}var Xa=[`items`,`prefixItems`,`contains`,`additionalProperties`,`unevaluatedProperties`,`unevaluatedItems`,`propertyNames`,`patternProperties`,`dependentSchemas`,`oneOf`,`anyOf`,`allOf`,`not`,`if`,`then`,`else`,`$defs`,`definitions`],Za=new Set([`patternProperties`,`dependentSchemas`,`$defs`,`definitions`]);function Qa(e){return e.length===0?``:e.join(`.`)}var $a=`=?base64?`,eo=`?=`;function to(e){if(typeof e==`string`)return e;if(typeof e==`boolean`)return e?`true`:`false`;if(typeof e==`number`)return!Number.isFinite(e)||Number.isInteger(e)&&!Number.isSafeInteger(e)?void 0:String(e)}function no(e){if(e.length===0||e.startsWith($a)&&e.endsWith(eo)||e!==e.trim())return!0;for(let t=0;t=32&&n<=126))return!0}return!1}function ro(e){let t=new TextEncoder().encode(e),n=``;for(let e of t)n+=String.fromCodePoint(e);return btoa(n)}function io(e){return no(e)?`${$a}${ro(e)}${eo}`:e}function ao(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n)return;n=n[e]}return n}function oo(e,t){let n={};for(let r of e){let e=ao(t,r.path);if(e==null)continue;let i=to(e);i!==void 0&&(n[`${Ga}${r.headerName}`]=io(i))}return n}X.InvalidRequest,X.UnsupportedProtocolVersion,X.InvalidParams,X.MethodNotFound,X.InvalidParams,X.MissingRequiredClientCapability,X.ParseError,X.InvalidRequest,X.MethodNotFound,X.UnsupportedProtocolVersion,X.MissingRequiredClientCapability;var so={"tools/call":`name`,"prompts/get":`name`,"resources/read":`uri`,"tasks/get":`taskId`,"tasks/update":`taskId`,"tasks/cancel":`taskId`};function co(e,t){let n=Object.hasOwn(so,e)?so[e]:void 0;if(n===void 0)return;let r=lo(t)?t[n]:void 0;return{field:n,value:typeof r==`string`?r:void 0}}function lo(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function uo(e,t){return le(e,t)}function fo(e){return new Set(e.flatMap(e=>Object.keys(e.shape)))}function po(e){if(e==null)return!1;let t=typeof e;return t!==`object`&&t!==`function`||!(`~standard`in e)?!1:typeof e[`~standard`]?.validate==`function`}var mo=!1,ho=`draft-2020-12`;function go(e,t=`input`){let n=e[`~standard`],r;if(n.jsonSchema)r=n.jsonSchema[t]({target:ho});else if(n.vendor===`zod`){if(!(`_zod`in e))throw Error(`Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().`);mo||(mo=!0,console.warn("[mcp-sdk] Your zod version does not implement `~standard.jsonSchema` (added in zod 4.2.0). Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.")),r=g(e,{target:ho,io:t})}else throw Error(`Schema library "${n.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(t===`output`)return r.type===void 0&&_o(r)?{type:`object`,...r}:r;if(r.type!==void 0&&r.type!==`object`)throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(r.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:`object`,...r}}function _o(e){if(`properties`in e||`patternProperties`in e||`additionalProperties`in e||`required`in e)return!0;for(let t of[`oneOf`,`anyOf`,`allOf`]){let n=e[t];if(Array.isArray(n)&&n.length>0)return n.every(e=>typeof e==`object`&&!!e&&(e.type===`object`||_o(e)))}return!1}function vo(e){return e.path?.length?`${e.path.map(e=>String(typeof e==`object`?e.key:e)).join(`.`)}: ${e.message}`:e.message}async function yo(e,t){let n=await e[`~standard`].validate(t);return n.issues&&n.issues.length>0?{success:!1,error:n.issues.map(e=>vo(e)).join(`, `)}:{success:!0,data:n.value}}function bo(e){let t=g(e,{target:ho,io:`input`});return typeof t.pattern==`string`?t.pattern:void 0}var xo=/\\\.\\d\{(\d+)\}/;function So(e){let t=xo.exec(e),n=[void 0,-1,0];return t&&n.push(Number(t[1])),[!1,!0].flatMap(e=>[!1,!0].flatMap(t=>n.map(n=>pe({local:e,offset:t,precision:n}))))}function Co(e,t){let n;switch(e){case`email`:n=[re()];break;case`uri`:n=[d()];break;case`date`:n=[me()];break;case`date-time`:n=So(t)}return new Set(n.map(e=>bo(e)).filter(e=>e!==void 0))}function wo(e,t,n){return n!==`zod`||Co(e,t).has(t)}function To(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Eo(e){try{return go(e,`input`)}catch(e){let t=e instanceof Error?e.message:String(e);throw new Z(X.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${t}`)}}var Do=new Set([`$comment`,`deprecated`,`description`,`examples`,`readOnly`,`title`,`writeOnly`]);function Oo(e){return Do.has(e)||e.startsWith(`x-`)}var ko=new Set([`$schema`,...Object.keys(nr.shape.requestedSchema.shape)]),Ao={string:fo([Gn,qn,Jn,Yn]),number:fo([Kn]),integer:fo([Kn]),boolean:fo([Wn]),array:fo([Zn,Qn])},jo=new Set(Gn.shape.format.unwrap().options);function Mo(e,t,n,r){if(!To(e))return e;let i=typeof e.type==`string`&&Object.hasOwn(Ao,e.type)?Ao[e.type]:void 0;if(i===void 0)return e;let a={};for(let[o,s]of Object.entries(e))i.has(o)||Oo(o)?a[o]=s:o===`pattern`&&e.type===`string`&&typeof e.format==`string`?jo.has(e.format)?(typeof s!=`string`||!wo(e.format,s,n))&&r.push(`${t}.${o}`):a[o]=s:r.push(`${t}.${o}`);return a}function No(e,t){let n={},r=[];for(let[i,a]of Object.entries(e))i===`properties`&&To(a)?n[i]=Object.fromEntries(Object.entries(a).map(([e,n])=>[e,Mo(n,`properties.${e}`,t,r)])):ko.has(i)?n[i]=a:Oo(i)||r.push(i);if(r.length>0)throw new Z(X.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${r.join(`, `)}`);return n}function Po(e,t){if(!To(e.properties))return t;let n=Object.entries(e.properties).filter(([,e])=>!uo(tr,e).success).map(([e])=>`properties.${e}`);return n.length>0?n.join(`, `):t}function Fo(e,t,n=``){return Array.isArray(e)&&Array.isArray(t)?e.flatMap((e,r)=>Fo(e,t[r],`${n}[${r}]`)):!To(e)||!To(t)?[]:Object.entries(e).flatMap(([e,r])=>{let i=n?`${n}.${e}`:e;return Object.prototype.hasOwnProperty.call(t,e)?Fo(r,t[e],i):Oo(e)?[]:[i]})}function Io(e){if(!po(e.requestedSchema))return{...e,mode:`form`,requestedSchema:e.requestedSchema};let t=e.requestedSchema[`~standard`].vendor,n=No(Eo(e.requestedSchema),t),r=uo(nr.shape.requestedSchema,n);if(!r.success)throw new Z(X.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${Po(n,r.error.message)}`);let i=Fo(n,r.data);if(i.length>0)throw new Z(X.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${i.join(`, `)}`);let a=(r.data.required??[]).filter(e=>!Object.prototype.hasOwnProperty.call(r.data.properties,e));if(a.length>0)throw new Z(X.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${a.join(`, `)}`);return{...e,mode:`form`,requestedSchema:r.data}}function Lo(e){let t=e.inputRequests!==void 0&&Object.keys(e.inputRequests).length>0,n=typeof e.requestState==`string`;if(!t&&!n)throw TypeError(`inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)`);return{resultType:`input_required`,...e.inputRequests!==void 0&&{inputRequests:e.inputRequests},...e.requestState!==void 0&&{requestState:e.requestState}}}Object.assign(Lo,{elicit(e){try{return{method:`elicitation/create`,params:Io(e)}}catch(e){throw e instanceof Z?TypeError(e.message,{cause:e}):e}},elicitUrl(e){return{method:`elicitation/create`,params:{...e,mode:`url`}}},createMessage(e){return{method:`sampling/createMessage`,params:e}},listRoots(){return{method:`roots/list`}}});var Ro=!0,zo=10,Bo=250;function Vo(e){return{autoFulfill:e?.autoFulfill??Ro,maxRounds:e?.maxRounds??zo}}function Ho(e,t,n){let r=t!==void 0&&Object.keys(t).length>0;return!r&&n===void 0?e:{...e,...r&&{inputResponses:t},...n!==void 0&&{requestState:n}}}function Uo(e,t){return`Multi-round-trip request '${e}' still required input after ${t} rounds (inputRequired.maxRounds)`}function Wo(e,t){return new Promise((n,r)=>{if(t?.aborted){r(t.reason instanceof Y?t.reason:new Y(J.RequestTimeout,String(t.reason)));return}let i=setTimeout(()=>{t?.removeEventListener(`abort`,a),n()},e),a=()=>{clearTimeout(i),r(t?.reason instanceof Y?t.reason:new Y(J.RequestTimeout,String(t?.reason)))};t?.addEventListener(`abort`,a,{once:!0})})}function Go(e){let t=new AbortController,n=()=>t.abort(e?.reason);return e?.addEventListener(`abort`,n,{once:!0}),e?.aborted&&t.abort(e.reason),{signal:t.signal,abort:e=>t.abort(e),dispose:()=>e?.removeEventListener(`abort`,n)}}async function Ko(e){let{config:t,method:n,originalParams:r,requestOptions:i,hooks:a,signal:o}=e,s=e.flowStartedAt??Date.now(),c=e.firstPayload,l=0;for(;;){if(l+=1,l>t.maxRounds)throw new Y(J.InputRequiredRoundsExceeded,Uo(n,t.maxRounds),{rounds:t.maxRounds,lastResult:{inputRequests:c.inputRequests,...c.requestState!==void 0&&{requestState:c.requestState}}});i.onprogress?.({progress:l,message:`Fulfilling input required by '${n}' (round ${l})`});let e=Object.entries(c.inputRequests??{}),u;if(e.length>0){let t=Go(o);try{let n=await Promise.all(e.map(async([e,n])=>{try{return[e,await a.dispatchInputRequest(e,n,t.signal)]}catch(e){throw t.abort(e),e}}));u=Object.fromEntries(n)}finally{t.dispose()}}else await Wo(Bo,o);let d={...i.timeout!==void 0&&{timeout:i.timeout}};if(i.maxTotalTimeout!==void 0){let e=Date.now()-s,t=i.maxTotalTimeout-e;if(t<=0)throw new Y(J.RequestTimeout,`Maximum total timeout exceeded`,{maxTotalTimeout:i.maxTotalTimeout,totalElapsed:e});d.maxTotalTimeout=t}let f=await a.retry(Ho(r,u,c.requestState),d);if(Ha(f)){c={inputRequests:f.inputRequests??{},...f.requestState!==void 0&&{requestState:f.requestState}};continue}return f}}var qo=`AnnotationsSchema.AudioContentSchema.BaseMetadataSchema.BlobResourceContentsSchema.BooleanSchemaSchema.CallToolRequestSchema.CallToolRequestParamsSchema.CallToolResultSchema.CancelledNotificationSchema.CancelledNotificationParamsSchema.CancelTaskRequestSchema.CancelTaskResultSchema.ClientCapabilitiesSchema.ClientNotificationSchema.ClientRequestSchema.ClientResultSchema.CompatibilityCallToolResultSchema.CompleteRequestSchema.CompleteRequestParamsSchema.CompleteResultSchema.ContentBlockSchema.CreateMessageRequestSchema.CreateMessageRequestParamsSchema.CreateMessageResultSchema.CreateMessageResultWithToolsSchema.CreateTaskResultSchema.CursorSchema.DiscoverRequestSchema.DiscoverResultSchema.ElicitationCompleteNotificationSchema.ElicitationCompleteNotificationParamsSchema.ElicitRequestSchema.ElicitRequestFormParamsSchema.ElicitRequestParamsSchema.ElicitRequestURLParamsSchema.ElicitResultSchema.EmbeddedResourceSchema.EmptyResultSchema.EnumSchemaSchema.GetPromptRequestSchema.GetPromptRequestParamsSchema.GetPromptResultSchema.GetTaskPayloadRequestSchema.GetTaskPayloadResultSchema.GetTaskRequestSchema.GetTaskResultSchema.IconSchema.IconsSchema.ImageContentSchema.ImplementationSchema.InitializedNotificationSchema.InitializeRequestSchema.InitializeRequestParamsSchema.InitializeResultSchema.JSONArraySchema.JSONObjectSchema.JSONRPCErrorResponseSchema.JSONRPCMessageSchema.JSONRPCNotificationSchema.JSONRPCRequestSchema.JSONRPCResponseSchema.JSONRPCResultResponseSchema.JSONValueSchema.LegacyTitledEnumSchemaSchema.ListPromptsRequestSchema.ListPromptsResultSchema.ListResourcesRequestSchema.ListResourcesResultSchema.ListResourceTemplatesRequestSchema.ListResourceTemplatesResultSchema.ListRootsRequestSchema.ListRootsResultSchema.ListTasksRequestSchema.ListTasksResultSchema.ListToolsRequestSchema.ListToolsResultSchema.LoggingLevelSchema.LoggingMessageNotificationSchema.LoggingMessageNotificationParamsSchema.ModelHintSchema.ModelPreferencesSchema.MultiSelectEnumSchemaSchema.NotificationSchema.NumberSchemaSchema.PaginatedRequestSchema.PaginatedRequestParamsSchema.PaginatedResultSchema.PingRequestSchema.PrimitiveSchemaDefinitionSchema.ProgressSchema.ProgressNotificationSchema.ProgressNotificationParamsSchema.ProgressTokenSchema.PromptSchema.PromptArgumentSchema.PromptListChangedNotificationSchema.PromptMessageSchema.PromptReferenceSchema.ReadResourceRequestSchema.ReadResourceRequestParamsSchema.ReadResourceResultSchema.RelatedTaskMetadataSchema.RequestSchema.RequestIdSchema.RequestMetaSchema.ResourceSchema.ResourceContentsSchema.ResourceLinkSchema.ResourceListChangedNotificationSchema.ResourceRequestParamsSchema.ResourceTemplateSchema.ResourceTemplateReferenceSchema.ResourceUpdatedNotificationSchema.ResourceUpdatedNotificationParamsSchema.ResultMetaObjectSchema.ResultSchema.RoleSchema.RootSchema.RootsListChangedNotificationSchema.SamplingContentSchema.SamplingMessageSchema.SamplingMessageContentBlockSchema.ServerCapabilitiesSchema.ServerNotificationSchema.ServerRequestSchema.ServerResultSchema.SetLevelRequestSchema.SetLevelRequestParamsSchema.SingleSelectEnumSchemaSchema.StringSchemaSchema.SubscribeRequestSchema.SubscribeRequestParamsSchema.SubscriptionFilterSchema.SubscriptionsAcknowledgedNotificationSchema.SubscriptionsAcknowledgedNotificationParamsSchema.SubscriptionsListenRequestSchema.SubscriptionsListenRequestParamsSchema.SubscriptionsListenResultSchema.SubscriptionsListenResultMetaSchema.TaskAugmentedRequestParamsSchema.TaskCreationParamsSchema.TaskMetadataSchema.TaskSchema.TaskStatusSchema.TaskStatusNotificationSchema.TaskStatusNotificationParamsSchema.TextContentSchema.TextResourceContentsSchema.TitledMultiSelectEnumSchemaSchema.TitledSingleSelectEnumSchemaSchema.ToolSchema.ToolAnnotationsSchema.ToolChoiceSchema.ToolExecutionSchema.ToolListChangedNotificationSchema.ToolResultContentSchema.ToolUseContentSchema.UnsubscribeRequestSchema.UnsubscribeRequestParamsSchema.UntitledMultiSelectEnumSchemaSchema.UntitledSingleSelectEnumSchemaSchema`.split(`.`),Jo={IdJagTokenExchangeResponseSchema:Ur,OAuthClientInformationFullSchema:Jr,OAuthClientInformationSchema:qr,OAuthClientMetadataSchema:Kr,OAuthClientRegistrationErrorSchema:Yr,OAuthErrorResponseSchema:Wr,OAuthMetadataSchema:zr,OAuthProtectedResourceMetadataSchema:Rr,OAuthTokenRevocationRequestSchema:Xr,OAuthTokensSchema:Hr,OpenIdProviderDiscoveryMetadataSchema:Vr,OpenIdProviderMetadataSchema:Br},Yo={},Xo={};function Zo(e,t){let n=e.slice(0,-6);Yo[n]=t,Xo[n]=e=>t.safeParse(e).success}for(let e of qo)Zo(e,La[e]);for(let[e,t]of Object.entries(Jo))Zo(e,t);Object.freeze(Yo);var Qo=Object.freeze(Xo);function $o(e){switch(e){case`initialize`:case`notifications/initialized`:return ja(void 0);case`server/discover`:return ja(Aa);default:return}}var es=[Fe,Ie,Re,Be],ts=[`inputResponses`,`requestState`];function ns(e,t){let n=e.params;if(!ss(n))return{message:e,lifted:{}};let r=n._meta,i=ss(r)?es.filter(e=>e in r):[],a=t===`request`?ts.filter(e=>e in n):[];if(i.length===0&&a.length===0)return{message:e,lifted:{}};let o={},s={...n};if(i.length>0&&ss(r)){let e={},t={...r};for(let n of i)e[n]=r[n],delete t[n];o.envelope=e,Object.keys(t).length>0?s._meta=t:delete s._meta}for(let e of a)e===`inputResponses`&&(o.inputResponses=s[e]),e===`requestState`&&(o.requestState=s[e]),delete s[e];return{message:{...e,params:s},lifted:o}}function rs(e,t){let n=e.validateResult(t,void 0);if(n.ok||n.reason!==`not-in-era`)return{"~standard":{version:1,vendor:`mcp-wire-codec`,validate(n){let r=e.validateResult(t,n);return r.ok?{value:r.value}:{issues:[{message:r.reason===`invalid`?r.message:`not-in-era: ${t}`}]}}}}}function is(e){return()=>e}var as=is(void 0),os=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_customSchemaRequestMethods=new Set;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??Ne,this.setNotificationHandler(`notifications/cancelled`,e=>{this._oncancel(e)}),this.setNotificationHandler(`notifications/progress`,e=>{this._onprogress(e)}),this.setRequestHandler(`ping`,e=>({}))}_shouldDropInbound(e){}_outboundMetaEnvelope(){}_envelopeOutbound(e){let t=this._outboundMetaEnvelope();if(t===void 0)return e;let n=e.params??{};return{...e,params:{...n,_meta:{...t,...n._meta}}}}_resolveNonCompleteResult(e,t){return Promise.reject(new Y(J.UnsupportedResultType,`Unsupported result type '${e.kind}' for ${t.request.method}`,{resultType:e.kind,method:t.request.method}))}_getRequestHandler(e){return this._requestHandlers.get(e)}async _oncancel(e){e.params.requestId!==void 0&&this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,n,r,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:r})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let n=Date.now()-t.startTime;if(t.maxTotalTimeout&&n>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new Y(J.RequestTimeout,`Maximum total timeout exceeded`,{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:n});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{try{t?.()}finally{this._onclose()}};let n=this.transport?.onerror;this._transport.onerror=e=>{n?.(e),this._onerror(e)};let r=this._transport?.onmessage;this._transport.onmessage=(e,t)=>{r?.(e,t),Ba(e)||Va(e)?this._onresponse(e):Ra(e)?this._onrequest(e,t):za(e)?this._onnotification(e,t):this._onerror(Error(`Unknown message type: ${JSON.stringify(e)}`))},e.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(let e of this._timeoutInfo.values())clearTimeout(e.timeoutId);this._timeoutInfo.clear();let t=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let n=new Y(J.ConnectionClosed,`Connection closed`);this._transport=void 0;try{this.onclose?.()}finally{for(let t of e.values())t(n);for(let e of t.values())e.abort(n)}}_onerror(e){this.onerror?.(e)}_onnotification(e,t){let{message:n}=ns(e,`notification`),r=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)===`drop`)return;if(t?.classification!==void 0){let e=Ma(t.classification);if(e!==r.era){this._onerror(Error(`Era mismatch on inbound notification '${n.method}': classified as ${e} but this instance serves ${r.era}`));return}}if(Pa(n.method)&&!r.hasNotificationMethod(n.method))return;let i=this._notificationHandlers.get(n.method),a=this.fallbackNotificationHandler;(i!==void 0||a!==void 0)&&Promise.resolve().then(()=>i===void 0?a(n):i(n,r)).catch(e=>this._onerror(Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){let{message:n,lifted:r}=ns(e,`request`),i=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)===`drop`){this._onerror(Error(`Dropped inbound request '${e.method}': not servable on this connection's protocol era`));return}let a=this._transport,o=(e,t,r)=>{let i={jsonrpc:`2.0`,id:n.id,error:{code:e,message:t,...r!==void 0&&{data:r}}};a?.send(i).catch(e=>this._onerror(Error(`Failed to send an error response: ${e}`)))};if(t?.classification!==void 0){let e=Ma(t.classification);if(e!==i.era){this._onerror(Error(`Era mismatch on inbound request '${n.method}': classified as ${e} but this instance serves ${i.era}`));let r=t.classification.revision??e;o(X.UnsupportedProtocolVersion,`Unsupported protocol version: ${r}`,{supported:this._supportedProtocolVersions,requested:r});return}}if(Na(n.method)&&!i.hasRequestMethod(n.method)&&!(Fa(n.method)&&this._customSchemaRequestMethods.has(n.method))){o(X.MethodNotFound,`Method not found`);return}let s=this._requestHandlers.get(n.method)??this.fallbackRequestHandler;if(s===void 0){o(X.MethodNotFound,`Method not found`);return}let c=i.checkInboundEnvelope(r);if(c!==void 0){o(X.InvalidParams,c);return}let l=(e,t)=>this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,{...t,relatedRequestId:n.id}),u=(e,t,r)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(e.method),e,t,{...r,relatedRequestId:n.id}),d=new AbortController;this._requestHandlerAbortControllers.set(n.id,d);let f=r.inputResponses===void 0?void 0:us(r.inputResponses),p={sessionId:a?.sessionId,mcpReq:{id:n.id,method:n.method,_meta:n.params?._meta,...r.envelope!==void 0&&{envelope:r.envelope},...f!==void 0&&{inputResponses:f.accepted},...f!==void 0&&f.droppedKeys.length>0&&{droppedInputResponseKeys:f.droppedKeys},requestState:r.requestState===void 0?as:is(r.requestState),signal:d.signal,send:((e,t,n)=>{let r=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(r,e.method),po(t))return u(e,t,n);let i=rs(r,e.method);if(i===void 0)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return u(e,i,t)}),notify:l},http:t?.authInfo?{authInfo:t.authInfo}:void 0},m=this.buildContext(p,t);Promise.resolve().then(()=>s(n,m)).then(async e=>{if(d.signal.aborted)return;let t;try{t=i.encodeResult(n.method,e,this._outboundServerInfo())}catch(e){this._onerror(Error(`Failed to encode result for ${n.method}: ${e}`)),o(X.InternalError,`Internal error`);return}let r={result:t,jsonrpc:`2.0`,id:n.id};await a?.send(r)},async e=>{if(d.signal.aborted)return;let t=Number.isSafeInteger(e.code)?e.code:X.InternalError,r={jsonrpc:`2.0`,id:n.id,error:{code:i.encodeErrorCode(t),message:e.message??`Internal error`,...e.data!==void 0&&{data:e.data}}};await a?.send(r)}).catch(e=>this._onerror(Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.get(n.id)===d&&this._requestHandlerAbortControllers.delete(n.id)})}_onprogress(e){let{progressToken:t,...n}=e.params,r=Number(t),i=this._progressHandlers.get(r);if(!i){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let a=this._responseHandlers.get(r),o=this._timeoutInfo.get(r);if(o&&a&&o.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(e){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),a(e);return}i(n)}_onresponse(e){let t=Number(e.id),n=this._responseHandlers.get(t);if(n===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),Ba(e)?n(e):n(Z.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(e,t,n){let r=this._resolveOutboundCodec(e.method);if(po(t))return Fa(e.method)||this._assertOutboundRequestInEra(r,e.method),this._requestWithSchemaViaCodec(r,e,t,n);this._assertOutboundRequestInEra(r,e.method);let i=rs(r,e.method);if(i===void 0)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(r,e,i,t)}_negotiatedWireCodec(){return ja(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=$o(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(Na(t)&&!e.hasRequestMethod(t))throw new Y(J.MethodNotSupportedByProtocolVersion,`Method '${t}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t,era:e.era})}_requestWithSchema(e,t,n){let r=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(r,e.method),this._requestWithSchemaViaCodec(r,e,t,n)}_requestWithSchemaViaCodec(e,t,n,r){let{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o,headers:s}=r??{},c=Date.now(),l,u;return new Promise((d,f)=>{let p=e=>{f(e)};if(!this._transport){p(Error(`Not connected`));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(e){p(e);return}if(r?.signal?.aborted){let e=r.signal.reason;throw e instanceof Y?e:new Y(J.RequestTimeout,String(e))}let m=e.era===`2026-07-28`&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,h=this._requestMessageId++;u=h;let g={...t,jsonrpc:`2.0`,id:h};r?.onprogress&&(this._progressHandlers.set(h,r.onprogress),g.params={...t.params,_meta:{...t.params?._meta,progressToken:h}});let _=this._envelopeOutbound(g),v=!1,y=e=>{v||(this._progressHandlers.delete(h),m===void 0?t.method!==`initialize`&&this._transport?.send(this._envelopeOutbound({jsonrpc:`2.0`,method:`notifications/cancelled`,params:{requestId:h,reason:String(e)}}),{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o}).catch(e=>this._onerror(Error(`Failed to send cancellation: ${e}`))):m.abort(),f(e instanceof Y?e:new Y(J.RequestTimeout,String(e))))};this._responseHandlers.set(h,i=>{if(r?.signal?.aborted)return;if(v=!0,i instanceof Error)return f(i);let a;try{a=e.decodeResult(t.method,i.result)}catch(e){return f(e instanceof Error?e:Error(String(e)))}if(a.kind===`invalid`)return f(a.error);if(a.kind===`input_required`){if(r?.allowInputRequired===!0)return d(gs(a));let i={codec:e,request:t,resultSchema:n,options:r,flowStartedAt:c,retry:(r,i)=>this._requestWithSchemaViaCodec(e,r===void 0?{method:t.method}:{method:t.method,params:r},n,i)};return d(this._resolveNonCompleteResult(a,i))}let o=a.result;yo(n,o).then(e=>{e.success?d(e.data):f(new Y(J.InvalidResult,`Invalid result for ${t.method}: ${e.error}`))},f)}),l=()=>y(r?.signal?.reason),r?.signal?.addEventListener(`abort`,l,{once:!0});let b=r?.timeout??6e4;this._setupTimeout(h,b,r?.maxTotalTimeout,()=>y(new Y(J.RequestTimeout,`Request timed out`,{timeout:b})),r?.resetTimeoutOnProgress??!1),this._transport.send(_,{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o,headers:s,requestSignal:m?.signal}).catch(e=>{this._progressHandlers.delete(h),f(e)})}).finally(()=>{l&&r?.signal?.removeEventListener(`abort`,l),u!==void 0&&(this._responseHandlers.delete(u),this._cleanupTimeout(u))})}async notification(e,t){return await this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,n){if(!this._transport)throw new Y(J.NotConnected,`Not connected`);if(Pa(t.method)&&!e.hasNotificationMethod(t.method))throw new Y(J.MethodNotSupportedByProtocolVersion,`Notification '${t.method}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t.method,era:e.era});this.assertNotificationCapability(t.method);let r=this._envelopeOutbound({jsonrpc:`2.0`,...t});if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&n?.relatedRequestId===void 0){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{this._pendingDebouncedNotifications.delete(t.method),this._transport&&this._transport?.send(r,n).catch(e=>this._onerror(e))});return}await this._transport.send(r,n)}setRequestHandler(e,t,n){this.assertRequestHandlerCapability(e);let r;if(typeof t==`function`){if(!Na(e))throw TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);r=(n,r)=>{let i=this._negotiatedWireCodec(),a=i.validateRequest(e,n);if(!a.ok&&a.reason===`not-in-era`&&(a=i.validateInputRequest(e,n)),!a.ok)throw a.reason===`not-in-era`?new Z(X.InternalError,`No wire schema for ${e} in the resolved era`):Error(a.message);return Promise.resolve(t(a.value,r))}}else if(n)r=async(r,i)=>{let a=await yo(t.params,{...r.params});if(!a.success)throw new Z(X.InvalidParams,`Invalid params for ${e}: ${a.error}`);return n(a.data,i)};else throw TypeError(`setRequestHandler: handler is required`);typeof t==`function`?this._customSchemaRequestMethods.delete(e):this._customSchemaRequestMethods.add(e),this._requestHandlers.set(e,this._wrapHandler(e,r))}_wrapHandler(e,t){return t}_outboundServerInfo(){}removeRequestHandler(e){this._requestHandlers.delete(e),this._customSchemaRequestMethods.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t,n){if(typeof t==`function`){if(!Pa(e))throw TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(n,r)=>{let i=r.validateNotification(e,n);if(!i.ok)throw i.reason===`not-in-era`?new Z(X.InternalError,`No wire schema for ${e} in the resolved era`):Error(i.message);return Promise.resolve(t(i.value))});return}if(!n)throw TypeError(`setNotificationHandler: handler is required`);this._notificationHandlers.set(e,async r=>{let i=await yo(t.params,{...r.params});if(!i.success)throw new Z(X.InvalidParams,`Invalid params for notification ${e}: ${i.error}`);await n(i.data,r)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function ss(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function cs(e,t){let n={...e};for(let e in t){let r=e,i=t[r];if(i===void 0)continue;let a=n[r];n[r]=ss(a)&&ss(i)?{...a,...i}:i}return n}function ls(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function us(e){let t={},n=[];if(!ls(e))return{accepted:t,droppedKeys:n};for(let[r,i]of Object.entries(e)){if(!ls(i)||`method`in i||`result`in i){n.push(r);continue}t[r]=i}return{accepted:t,droppedKeys:n}}function ds(e){throw new Y(J.SendFailed,`ctx.mcpReq.${e} is not available while fulfilling an embedded input request: the request is fulfilled locally and has no related peer request`)}function fs(e,t,n,r,i){return{sessionId:i,mcpReq:{id:e,method:t,_meta:n?._meta,requestState:is(void 0),signal:r,send:(()=>ds(`send`)),notify:()=>ds(`notify`)}}}async function ps(e,t,n,r,i){if(!ls(r)||typeof r.method!=`string`)throw new Y(J.InvalidResult,`Invalid input request '${n}': each inputRequests entry must be an embedded request object with a method`,{key:n});let a=r.method;if(!t.hasInputRequestMethod(a))throw new Y(J.InvalidResult,`Invalid input request '${n}': '${a}' is not an embedded request the ${t.era} revision defines (expected elicitation/create, sampling/createMessage, or roots/list)`,{key:n,method:a});let o=e.getRequestHandler(a);if(o===void 0)throw new Y(J.CapabilityNotSupported,`Cannot fulfil input request '${n}': no handler is registered for '${a}' on this client. Declare the corresponding capability and register a handler, or handle input_required results manually.`,{key:n,method:a});let s=ls(r.params)?r.params:void 0;return await o({jsonrpc:`2.0`,id:n,method:a,...s!==void 0&&{params:s}},e.buildContext(fs(n,a,s,i,e.sessionId)))}function ms(e,t){return{...e?.signal!==void 0&&{signal:e.signal},...e?.onprogress!==void 0&&{onprogress:e.onprogress},...e?.resetTimeoutOnProgress!==void 0&&{resetTimeoutOnProgress:e.resetTimeoutOnProgress},...e?.headers!==void 0&&{headers:e.headers},...t.timeout!==void 0&&{timeout:t.timeout},...t.maxTotalTimeout!==void 0&&{maxTotalTimeout:t.maxTotalTimeout},allowInputRequired:!0}}function hs(e,t,n,r){let{codec:i,request:a,options:o,flowStartedAt:s}=r,c={inputRequests:n.inputRequests,...n.requestState!==void 0&&{requestState:n.requestState}},l={dispatchInputRequest:(t,n,r)=>ps(e,i,t,n,r),retry:(e,t)=>r.retry(e,ms(o,t))};return Ko({config:t,method:a.method,originalParams:a.params,firstPayload:c,flowStartedAt:s,signal:o?.signal,requestOptions:{...o?.timeout!==void 0&&{timeout:o.timeout},...o?.maxTotalTimeout!==void 0&&{maxTotalTimeout:o.maxTotalTimeout},...o?.onprogress!==void 0&&{onprogress:o.onprogress}},hooks:l})}function gs(e){return{resultType:`input_required`,inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState},...e._meta!==void 0&&{_meta:e._meta}}}var _s=Te(Se((e=>{var t=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,n=/\\([\u000b\u0020-\u00ff])/g,r=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;e.parse=i;function i(e){if(!e)throw TypeError(`argument string is required`);var i=typeof e==`object`?a(e):e;if(typeof i!=`string`)throw TypeError(`argument string is required to be a string`);var s=i.indexOf(`;`),c=s===-1?i.trim():i.slice(0,s).trim();if(!r.test(c))throw TypeError(`invalid media type`);var l=new o(c.toLowerCase());if(s!==-1){var u,d,f;for(t.lastIndex=s;d=t.exec(i);){if(d.index!==s)throw TypeError(`invalid parameter format`);s+=d[0].length,u=d[1].toLowerCase(),f=d[2],f.charCodeAt(0)===34&&(f=f.slice(1,-1),f.indexOf(`\\`)!==-1&&(f=f.replace(n,`$1`))),l.parameters[u]=f}if(s!==i.length)throw TypeError(`invalid parameter format`)}return l}function a(e){var t;if(typeof e.getHeader==`function`?t=e.getHeader(`content-type`):typeof e.headers==`object`&&(t=e.headers&&e.headers[`content-type`]),typeof t!=`string`)throw TypeError(`content-type header is missing from object`);return t}function o(e){this.parameters=Object.create(null),this.type=e}}))(),1);function vs(e){if(e)try{return _s.parse(e).type}catch{let t=(e.split(`;`,1)[0]??``).trim().toLowerCase();return t===``||e.slice(t.length).includes(`,`)?void 0:t}}function ys(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}function bs(e=fetch,t){return t?async(n,r)=>e(n,{...t,...r,headers:r?.headers?{...ys(t.headers),...ys(r.headers)}:t.headers}):e}var xs=new Set([301,302,303,307,308]),Ss=5;function Cs(e,t){return e.protocol===t.protocol&&e.host===t.host||e.protocol===`http:`&&t.protocol===`https:`&&e.hostname===t.hostname&&!e.port&&!t.port}function ws(e,t){let n=xs.has(t.status)?t.headers?.get(`location`):void 0;if(n)try{return new URL(n,e)}catch{return}}var Ts=new WeakSet;function Es(e){let t=(t,n)=>e(t,n);return Ts.add(t),t}function Ds(e){return Ts.has(e)?e:async(t,n)=>{if(n?.redirect===`error`||n?.redirect===`manual`)return e(t,n);let r=(n?.method??`GET`).toUpperCase(),i=t;for(let t=0;;t++){let a=await e(i,{...n,redirect:`manual`}),o=ws(i,a);if(!o||t===Ss)return a;let s=new URL(i),c=r===`GET`||a.status===307||a.status===308,l=!(o.username||o.password)||o.username===s.username&&o.password===s.password;if(!c||!l||!Cs(s,o))return a;await a.text?.().catch(()=>{}),i=o}}}function Os(e,t){if(t.type===`opaqueredirect`)return`Redirect not followed: this runtime does not expose where it points`;let n=ws(t.url||e,t);if(n)return n.username=n.password=n.search=n.hash=``,n.protocol===`http:`&&new URL(t.url||e).protocol===`https:`?(n.protocol=`https:`,`Redirect from https to plain http not followed; try ${n.href} as the endpoint`):`Redirect to ${n.href} not followed; use that URL as the endpoint if it is the intended server`}function ks(e,t){let n=typeof e;if(n!==typeof t)return!1;if(Array.isArray(e)){if(!Array.isArray(t))return!1;let n=e.length;if(n!==t.length)return!1;for(let r=0;r1?t[a.href]=e:(a.hash=``,r===``?n=a:Is(e,t,n))}}else if(e!==!0&&e!==!1)return t;let i=n.href+(r?`#`+r:``);if(t[i]!==void 0)throw Error(`Duplicate schema URI "${i}".`);if(t[i]=e,e===!0||e===!1)return t;if(e.__absolute_uri__===void 0&&Object.defineProperty(e,"__absolute_uri__",{enumerable:!1,value:i}),e.$ref&&e.__absolute_ref__===void 0){let t=new URL(e.$ref,n.href);t.hash=t.hash,Object.defineProperty(e,"__absolute_ref__",{enumerable:!1,value:t.href})}if(e.$recursiveRef&&e.__absolute_recursive_ref__===void 0){let t=new URL(e.$recursiveRef,n.href);t.hash=t.hash,Object.defineProperty(e,"__absolute_recursive_ref__",{enumerable:!1,value:t.href})}if(e.$anchor){let r=new URL(`#`+e.$anchor,n.href);t[r.href]=e}for(let i in e){if(Ps[i])continue;let a=`${r}/${As(i)}`,o=e[i];if(Array.isArray(o)){if(Ms[i]){let e=o.length;for(let r=0;r%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,Us=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,Ws=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Gs=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Ks=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,qs=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,Js=e=>{if(e[0]===`"`)return!1;let[t,n,...r]=e.split(`@`);return!t||!n||r.length!==0||t.length>64||n.length>253||t[0]===`.`||t.endsWith(`.`)||t.includes(`..`)||!/^[a-z0-9.-]+$/i.test(n)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(t)?!1:n.split(`.`).every(e=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(e))},Ys=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,Xs=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,Zs=e=>e.length>1&&e.length<80&&(/^P\d+([.,]\d+)?W$/.test(e)||/^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(e)&&/^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(e));function Qs(e){return e.test.bind(e)}var $s={date:tc,time:nc.bind(void 0,!1),"date-time":ic,duration:Zs,uri:sc,"uri-reference":Qs(Vs),"uri-template":Qs(Hs),url:Qs(Us),email:Js,hostname:Qs(Bs),ipv4:Qs(Ys),ipv6:Qs(Xs),regex:lc,uuid:Qs(Ws),"json-pointer":Qs(Gs),"json-pointer-uri-fragment":Qs(Ks),"relative-json-pointer":Qs(qs)};function ec(e){return e%4==0&&(e%100!=0||e%400==0)}function tc(e){let t=e.match(Ls);if(!t)return!1;let n=+t[1],r=+t[2],i=+t[3];return r>=1&&r<=12&&i>=1&&i<=(r==2&&ec(n)?29:Rs[r])}function nc(e,t){let n=t.match(zs);if(!n)return!1;let r=+n[1],i=+n[2],a=+n[3],o=!!n[5];return(r<=23&&i<=59&&a<=59||r==23&&i==59&&a==60)&&(!e||o)}var rc=/t|\s/i;function ic(e){let t=e.split(rc);return t.length==2&&tc(t[0])&&nc(!0,t[1])}var ac=/\/|:/,oc=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function sc(e){return ac.test(e)&&oc.test(e)}var cc=/[^\\]\\Z/;function lc(e){if(cc.test(e))return!1;try{return new RegExp(e,`u`),!0}catch{return!1}}function uc(e){let t=0,n=e.length,r=0,i;for(;r=55296&&i<=56319&&r{if(typeof e!=`string`||/[\s;'\"]/.test(e))return!1;let t=e.match(/^([a-z]+):\/\/([^/]+)$/i);return!!(t&&n.has(t[1].toLowerCase()))})}function ge(e){let t=N(N(N(e)?.ui)?.csp),n=P(t?.connectDomains,[`http`,`https`,`ws`,`wss`]),r=P(t?.resourceDomains,[`http`,`https`]),i=P(t?.frameDomains,[`http`,`https`]),a=P(t?.baseUriDomains,[`http`,`https`]),o=r.length?` ${r.join(` `)}`:``,s=[`default-src 'none'`,`worker-src blob:`,`script-src 'self' 'unsafe-inline'${o}`,`style-src 'self' 'unsafe-inline'${o}`,`img-src 'self' data:${o}`,`media-src 'self' data:${o}`,`font-src 'self' data:${o}`,`connect-src ${n.length?n.join(` `):`'none'`}`];return i.length&&s.push(`frame-src ${i.join(` `)}`),a.length&&s.push(`base-uri ${a.join(` `)}`),`${s.join(`; `)};`}var _e=Object.create,ve=Object.defineProperty,ye=Object.getOwnPropertyDescriptor,be=Object.getOwnPropertyNames,F=Object.getPrototypeOf,xe=Object.prototype.hasOwnProperty,Se=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ce=(e,t)=>{let n={};for(var r in e)ve(n,r,{get:e[r],enumerable:!0});return t&&ve(n,Symbol.toStringTag,{value:`Module`}),n},we=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=be(t),a=0,o=i.length,s;at[e]).bind(null,s),enumerable:!(r=ye(t,s))||r.enumerable});return e},Te=(e,t,n)=>(n=e==null?{}:_e(F(e)),we(t||!e||!e.__esModule?ve(n,`default`,{value:e,enumerable:!0}):n,e)),Ee=new Set([`https://json-schema.org/draft/2020-12/schema`,`http://json-schema.org/draft/2020-12/schema`]),De=new Set([`https://json-schema.org/draft/2019-09/schema`,`http://json-schema.org/draft/2019-09/schema`]),Oe=new Set([`https://json-schema.org/draft-07/schema`,`http://json-schema.org/draft-07/schema`]),ke=new Set([`https://json-schema.org/draft-06/schema`,`http://json-schema.org/draft-06/schema`]);function Ae(e){return typeof e==`string`&&De.has(e.replace(/#$/,``))}function je(e,t){if(!(`$schema`in e)||typeof e.$schema!=`string`)return`2020-12`;let n=e.$schema.replace(/#$/,``);if(Ee.has(n))return`2020-12`;if(De.has(n))return`2019-09`;if(Oe.has(n)||ke.has(n))return`draft-7`;throw Error(`JSON Schema declares an unsupported dialect ("$schema": "${e.$schema.slice(0,200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${t}`)}var Me=`2025-11-25`,Ne=[Me,`2025-06-18`,`2025-03-26`,`2024-11-05`,`2024-10-07`],Pe=`io.modelcontextprotocol/related-task`,Fe=`io.modelcontextprotocol/protocolVersion`,Ie=`io.modelcontextprotocol/clientInfo`,Le=`io.modelcontextprotocol/serverInfo`,Re=`io.modelcontextprotocol/clientCapabilities`,ze=`io.modelcontextprotocol/subscriptionId`,Be=`io.modelcontextprotocol/logLevel`,Ve=ee(()=>j([x(),E(),A(),ae(),M(x(),Ve),O(Ve)])),I=M(x(),Ve),He=O(Ve),Ue=j([x(),E().int()]),We=x(),Ge=T({ttl:E().optional()}),Ke=T({taskId:x()}),qe=k({progressToken:Ue.optional(),[Pe]:Ke.optional()}),L=T({_meta:qe.optional()}),Je=L.extend({task:Ge.optional()}),R=T({method:x(),params:L.loose().optional()}),z=T({_meta:qe.optional()}),B=T({method:x(),params:z.loose().optional()}),Ye=k({get[Le](){return H.optional().catch(void 0)}}),V=k({_meta:Ye.optional()}),Xe=j([x(),E().int()]),Ze=T({jsonrpc:w(`2.0`),id:Xe,...R.shape}).strict(),Qe=T({jsonrpc:w(`2.0`),...B.shape}).strict(),$e=T({jsonrpc:w(`2.0`),id:Xe,result:V}).strict(),et=T({jsonrpc:w(`2.0`),id:Xe.optional(),error:T({code:E().int(),message:x(),data:h().optional()})}).strict(),tt=j([Ze,Qe,$e,et]),nt=j([$e,et]),rt=V.strict(),it=z.extend({requestId:Xe.optional(),reason:x().optional()}),at=B.extend({method:w(`notifications/cancelled`),params:it}),ot=T({src:x(),mimeType:x().optional(),sizes:O(x()).optional(),theme:D([`light`,`dark`]).optional()}),st=T({icons:O(ot).optional()}),ct=T({name:x(),title:x().optional()}),H=ct.extend({...ct.shape,...st.shape,version:x(),websiteUrl:x().optional(),description:x().optional()}),lt=se(T({applyDefaults:A().optional()}),I),ut=ce(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,se(T({form:lt.optional(),url:I.optional()}),I.optional())),dt=k({list:I.optional(),cancel:I.optional(),requests:k({sampling:k({createMessage:I.optional()}).optional(),elicitation:k({create:I.optional()}).optional()}).optional()}),ft=k({list:I.optional(),cancel:I.optional(),requests:k({tools:k({call:I.optional()}).optional()}).optional()}),pt=T({experimental:M(x(),I).optional(),sampling:T({context:I.optional(),tools:I.optional()}).optional(),elicitation:ut.optional(),roots:T({listChanged:A().optional()}).optional(),tasks:dt.optional(),extensions:M(x(),I).optional()}),mt=L.extend({protocolVersion:x(),capabilities:pt,clientInfo:H}),ht=R.extend({method:w(`initialize`),params:mt}),gt=T({experimental:M(x(),I).optional(),logging:I.optional(),completions:I.optional(),prompts:T({listChanged:A().optional()}).optional(),resources:T({subscribe:A().optional(),listChanged:A().optional()}).optional(),tools:T({listChanged:A().optional()}).optional(),tasks:ft.optional(),extensions:M(x(),I).optional()}),_t=V.extend({protocolVersion:x(),capabilities:gt,serverInfo:H,instructions:x().optional()}),vt=B.extend({method:w(`notifications/initialized`),params:z.optional()}),yt=R.extend({method:w(`server/discover`),params:L.optional()}),bt=V.extend({supportedVersions:O(x()),capabilities:gt,instructions:x().optional()}),xt=R.extend({method:w(`ping`),params:L.optional()}),St=T({progress:E(),total:y(E()),message:y(x())}),Ct=T({...z.shape,...St.shape,progressToken:Ue}),wt=B.extend({method:w(`notifications/progress`),params:Ct}),Tt=L.extend({cursor:We.optional()}),Et=R.extend({params:Tt.optional()}),Dt=V.extend({nextCursor:We.optional()}),Ot=T({uri:x(),mimeType:y(x()),_meta:M(x(),h()).optional()}),kt=Ot.extend({text:x()}),At=x().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),jt=Ot.extend({blob:At}),Mt=D([`user`,`assistant`]),Nt=T({audience:O(Mt).optional(),priority:E().min(0).max(1).optional(),lastModified:pe({offset:!0}).optional()}),Pt=T({...ct.shape,...st.shape,uri:x(),description:y(x()),mimeType:y(x()),size:y(E()),annotations:Nt.optional(),_meta:y(k({}))}),Ft=T({...ct.shape,...st.shape,uriTemplate:x(),description:y(x()),mimeType:y(x()),annotations:Nt.optional(),_meta:y(k({}))}),It=Et.extend({method:w(`resources/list`)}),Lt=Dt.extend({resources:O(Pt)}),U=Et.extend({method:w(`resources/templates/list`)}),W=Dt.extend({resourceTemplates:O(Ft)}),Rt=L.extend({uri:x()}),zt=Rt,Bt=R.extend({method:w(`resources/read`),params:zt}),Vt=V.extend({contents:O(j([kt,jt]))}),Ht=B.extend({method:w(`notifications/resources/list_changed`),params:z.optional()}),Ut=Rt,Wt=R.extend({method:w(`resources/subscribe`),params:Ut}),Gt=Rt,Kt=R.extend({method:w(`resources/unsubscribe`),params:Gt}),qt=T({toolsListChanged:A().optional(),promptsListChanged:A().optional(),resourcesListChanged:A().optional(),resourceSubscriptions:O(x()).optional()}),Jt=L.extend({notifications:qt}),Yt=R.extend({method:w(`subscriptions/listen`),params:Jt}),Xt=z.extend({notifications:qt}),Zt=B.extend({method:w(`notifications/subscriptions/acknowledged`),params:Xt}),Qt=Ye.extend({[ze]:Xe}),$t=V.extend({_meta:Qt}),en=z.extend({uri:x()}),tn=B.extend({method:w(`notifications/resources/updated`),params:en}),G=T({name:x(),description:y(x()),required:y(A())}),nn=T({...ct.shape,...st.shape,description:y(x()),arguments:y(O(G)),_meta:y(k({}))}),rn=Et.extend({method:w(`prompts/list`)}),an=Dt.extend({prompts:O(nn)}),on=L.extend({name:x(),arguments:M(x(),x()).optional()}),sn=R.extend({method:w(`prompts/get`),params:on}),cn=T({type:w(`text`),text:x(),annotations:Nt.optional(),_meta:M(x(),h()).optional()}),K=T({type:w(`image`),data:At,mimeType:x(),annotations:Nt.optional(),_meta:M(x(),h()).optional()}),ln=T({type:w(`audio`),data:At,mimeType:x(),annotations:Nt.optional(),_meta:M(x(),h()).optional()}),un=T({type:w(`tool_use`),name:x(),id:x(),input:M(x(),h()),_meta:M(x(),h()).optional()}),dn=T({type:w(`resource`),resource:j([kt,jt]),annotations:Nt.optional(),_meta:M(x(),h()).optional()}),fn=Pt.extend({type:w(`resource_link`)}),pn=j([cn,K,ln,fn,dn]),mn=T({role:Mt,content:pn}),hn=V.extend({description:x().optional(),messages:O(mn)}),gn=B.extend({method:w(`notifications/prompts/list_changed`),params:z.optional()}),_n=T({title:x().optional(),readOnlyHint:A().optional(),destructiveHint:A().optional(),idempotentHint:A().optional(),openWorldHint:A().optional()}),vn=T({taskSupport:D([`required`,`optional`,`forbidden`]).optional()}),yn=T({...ct.shape,...st.shape,description:x().optional(),inputSchema:T({type:w(`object`),properties:M(x(),Ve).optional(),required:O(x()).optional()}).catchall(h()),outputSchema:k({$schema:x().optional()}).optional(),annotations:_n.optional(),execution:vn.optional(),_meta:M(x(),h()).optional()}),bn=Et.extend({method:w(`tools/list`)}),xn=Dt.extend({tools:O(yn)}),Sn=V.extend({content:O(pn).default([]),structuredContent:h().optional(),isError:A().optional()}),Cn=Sn.or(V.extend({toolResult:h()})),wn=Je.extend({name:x(),arguments:M(x(),h()).optional()}),Tn=R.extend({method:w(`tools/call`),params:wn}),En=B.extend({method:w(`notifications/tools/list_changed`),params:z.optional()}),Dn=T({autoRefresh:A().default(!0),debounceMs:E().int().nonnegative().default(300)}),On=D([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),kn=L.extend({level:On}),An=R.extend({method:w(`logging/setLevel`),params:kn}),jn=z.extend({level:On,logger:x().optional(),data:h()}),Mn=B.extend({method:w(`notifications/message`),params:jn}),Nn=T({name:x().optional()}),Pn=T({hints:O(Nn).optional(),costPriority:E().min(0).max(1).optional(),speedPriority:E().min(0).max(1).optional(),intelligencePriority:E().min(0).max(1).optional()}),Fn=T({mode:D([`auto`,`required`,`none`]).optional()}),In=T({type:w(`tool_result`),toolUseId:x().describe(`The unique identifier for the corresponding tool call.`),content:O(pn),structuredContent:h().optional(),isError:A().optional(),_meta:M(x(),h()).optional()}),Ln=S(`type`,[cn,K,ln]),Rn=S(`type`,[cn,K,ln,un,In]),zn=T({role:Mt,content:j([Rn,O(Rn)]),_meta:M(x(),h()).optional()}),Bn=Je.extend({messages:O(zn),modelPreferences:Pn.optional(),systemPrompt:x().optional(),includeContext:D([`none`,`thisServer`,`allServers`]).optional(),temperature:E().optional(),maxTokens:E().int(),stopSequences:O(x()).optional(),metadata:I.optional(),tools:O(yn).optional(),toolChoice:Fn.optional()}),Vn=R.extend({method:w(`sampling/createMessage`),params:Bn}),Hn=V.extend({model:x(),stopReason:y(D([`endTurn`,`stopSequence`,`maxTokens`]).or(x())),role:Mt,content:Ln}),Un=V.extend({model:x(),stopReason:y(D([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(x())),role:Mt,content:j([Rn,O(Rn)])}),Wn=T({type:w(`boolean`),title:x().optional(),description:x().optional(),default:A().optional()}),Gn=T({type:w(`string`),title:x().optional(),description:x().optional(),minLength:E().optional(),maxLength:E().optional(),format:D([`email`,`uri`,`date`,`date-time`]).optional(),default:x().optional()}),Kn=T({type:D([`number`,`integer`]),title:x().optional(),description:x().optional(),minimum:E().optional(),maximum:E().optional(),default:E().optional()}),qn=T({type:w(`string`),title:x().optional(),description:x().optional(),enum:O(x()),default:x().optional()}),Jn=T({type:w(`string`),title:x().optional(),description:x().optional(),oneOf:O(T({const:x(),title:x()})),default:x().optional()}),Yn=T({type:w(`string`),title:x().optional(),description:x().optional(),enum:O(x()),enumNames:O(x()).optional(),default:x().optional()}),Xn=j([qn,Jn]),Zn=T({type:w(`array`),title:x().optional(),description:x().optional(),minItems:E().optional(),maxItems:E().optional(),items:T({type:w(`string`),enum:O(x())}),default:O(x()).optional()}),Qn=T({type:w(`array`),title:x().optional(),description:x().optional(),minItems:E().optional(),maxItems:E().optional(),items:T({anyOf:O(T({const:x(),title:x()}))}),default:O(x()).optional()}),$n=j([Zn,Qn]),er=j([Yn,Xn,$n]),tr=j([er,Wn,Gn,Kn]),nr=Je.extend({mode:w(`form`).optional(),message:x(),requestedSchema:T({type:w(`object`),properties:M(x(),tr),required:O(x()).optional()}).catchall(h())}),rr=Je.extend({mode:w(`url`),message:x(),elicitationId:x(),url:x().url()}),ir=j([nr,rr]),ar=R.extend({method:w(`elicitation/create`),params:ir}),or=z.extend({elicitationId:x()}),sr=B.extend({method:w(`notifications/elicitation/complete`),params:or}),cr=V.extend({action:D([`accept`,`decline`,`cancel`]),content:ce(e=>e===null?void 0:e,M(x(),j([x(),E(),A(),O(x())])).optional())}),lr=T({type:w(`ref/resource`),uri:x()}),ur=T({type:w(`ref/prompt`),name:x()}),dr=L.extend({ref:j([ur,lr]),argument:T({name:x(),value:x()}),context:T({arguments:M(x(),x()).optional()}).optional()}),fr=R.extend({method:w(`completion/complete`),params:dr}),pr=V.extend({completion:k({values:O(x()).max(100),total:y(E().int()),hasMore:y(A())})}),mr=T({uri:x().startsWith(`file://`),name:x().optional(),_meta:M(x(),h()).optional()}),hr=R.extend({method:w(`roots/list`),params:L.optional()}),gr=V.extend({roots:O(mr)}),_r=B.extend({method:w(`notifications/roots/list_changed`),params:z.optional()}),vr=k({ttl:E().optional(),pollInterval:E().optional()}),yr=D([`working`,`input_required`,`completed`,`failed`,`cancelled`]),br=T({taskId:x(),status:yr,ttl:j([E(),ae()]),createdAt:x(),lastUpdatedAt:x(),pollInterval:y(E()),statusMessage:y(x())}),xr=V.extend({task:br}),Sr=z.merge(br),Cr=B.extend({method:w(`notifications/tasks/status`),params:Sr}),wr=R.extend({method:w(`tasks/get`),params:L.extend({taskId:x()})}),Tr=V.merge(br),Er=R.extend({method:w(`tasks/result`),params:L.extend({taskId:x()})}),Dr=V.loose(),Or=Et.extend({method:w(`tasks/list`)}),kr=Dt.extend({tasks:O(br)}),Ar=R.extend({method:w(`tasks/cancel`),params:L.extend({taskId:x()})}),jr=V.merge(br),Mr=j([xt,ht,yt,fr,An,sn,rn,It,U,Bt,Wt,Kt,Yt,Tn,bn]),Nr=j([at,wt,vt,_r]),Pr=j([rt,Hn,Un,cr,gr]),Fr=j([xt,Vn,ar,hr]),Ir=j([at,wt,Mn,tn,Ht,En,gn,Zt,sr]),Lr=j([rt,_t,bt,pr,hn,an,Lt,W,Vt,Sn,xn,$t]),q=d().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:de.custom,message:`URL must be parseable`,fatal:!0}),ne}).refine(e=>{let t=new URL(e);return t.protocol!==`javascript:`&&t.protocol!==`data:`&&t.protocol!==`vbscript:`},{message:`URL cannot use javascript:, data:, or vbscript: scheme`}),Rr=k({resource:x().url(),authorization_servers:O(q).optional(),jwks_uri:x().url().optional(),scopes_supported:O(x()).optional(),bearer_methods_supported:O(x()).optional(),resource_signing_alg_values_supported:O(x()).optional(),resource_name:x().optional(),resource_documentation:x().optional(),resource_policy_uri:x().url().optional(),resource_tos_uri:x().url().optional(),tls_client_certificate_bound_access_tokens:A().optional(),authorization_details_types_supported:O(x()).optional(),dpop_signing_alg_values_supported:O(x()).optional(),dpop_bound_access_tokens_required:A().optional()}),zr=k({issuer:x(),authorization_endpoint:q,token_endpoint:q,registration_endpoint:q.optional(),scopes_supported:O(x()).optional(),response_types_supported:O(x()),response_modes_supported:O(x()).optional(),grant_types_supported:O(x()).optional(),token_endpoint_auth_methods_supported:O(x()).optional(),token_endpoint_auth_signing_alg_values_supported:O(x()).optional(),service_documentation:q.optional(),revocation_endpoint:q.optional(),revocation_endpoint_auth_methods_supported:O(x()).optional(),revocation_endpoint_auth_signing_alg_values_supported:O(x()).optional(),introspection_endpoint:x().optional(),introspection_endpoint_auth_methods_supported:O(x()).optional(),introspection_endpoint_auth_signing_alg_values_supported:O(x()).optional(),code_challenge_methods_supported:O(x()).optional(),client_id_metadata_document_supported:A().optional(),authorization_response_iss_parameter_supported:A().optional().catch(void 0),dpop_signing_alg_values_supported:O(x()).optional()}),Br=k({issuer:x(),authorization_endpoint:q,token_endpoint:q,userinfo_endpoint:q.optional(),jwks_uri:q,registration_endpoint:q.optional(),scopes_supported:O(x()).optional(),response_types_supported:O(x()),response_modes_supported:O(x()).optional(),grant_types_supported:O(x()).optional(),acr_values_supported:O(x()).optional(),subject_types_supported:O(x()),id_token_signing_alg_values_supported:O(x()),id_token_encryption_alg_values_supported:O(x()).optional(),id_token_encryption_enc_values_supported:O(x()).optional(),userinfo_signing_alg_values_supported:O(x()).optional(),userinfo_encryption_alg_values_supported:O(x()).optional(),userinfo_encryption_enc_values_supported:O(x()).optional(),request_object_signing_alg_values_supported:O(x()).optional(),request_object_encryption_alg_values_supported:O(x()).optional(),request_object_encryption_enc_values_supported:O(x()).optional(),token_endpoint_auth_methods_supported:O(x()).optional(),token_endpoint_auth_signing_alg_values_supported:O(x()).optional(),display_values_supported:O(x()).optional(),claim_types_supported:O(x()).optional(),claims_supported:O(x()).optional(),service_documentation:x().optional(),claims_locales_supported:O(x()).optional(),ui_locales_supported:O(x()).optional(),claims_parameter_supported:A().optional(),request_parameter_supported:A().optional(),request_uri_parameter_supported:A().optional(),require_request_uri_registration:A().optional(),op_policy_uri:q.optional(),op_tos_uri:q.optional(),client_id_metadata_document_supported:A().optional(),authorization_response_iss_parameter_supported:A().optional().catch(void 0)}),Vr=T({...Br.shape,...zr.pick({code_challenge_methods_supported:!0}).shape}),Hr=T({access_token:x(),id_token:x().optional(),token_type:x(),expires_in:he().optional(),scope:x().optional(),refresh_token:x().optional(),issuer:x().optional().catch(void 0)}).strip(),Ur=T({issued_token_type:w(`urn:ietf:params:oauth:token-type:id-jag`),access_token:x(),token_type:x().optional(),expires_in:E().optional(),scope:x().optional()}).strip(),Wr=T({error:x(),error_description:x().optional(),error_uri:x().optional()}),Gr=q.optional().or(w(``).transform(()=>void 0)),Kr=T({redirect_uris:O(q),token_endpoint_auth_method:x().optional(),grant_types:O(x()).optional(),response_types:O(x()).optional(),application_type:x().optional(),client_name:x().optional(),client_uri:q.optional(),logo_uri:Gr,scope:x().optional(),contacts:O(x()).optional(),tos_uri:Gr,policy_uri:x().optional(),jwks_uri:q.optional(),jwks:b().optional(),software_id:x().optional(),software_version:x().optional(),software_statement:x().optional()}).strip(),qr=T({client_id:x(),client_secret:x().optional(),client_id_issued_at:E().optional(),client_secret_expires_at:E().optional(),issuer:x().optional().catch(void 0)}).strip(),Jr=Kr.merge(qr),Yr=T({error:x(),error_description:x().optional()}).strip(),Xr=T({token:x(),token_type_hint:x().optional()}).strip(),Zr=Symbol.for(`mcp.sdk.errorBrands`);function Qr(e,t){let n=new Set,r=t;for(;typeof r==`function`;){let e=r.mcpBrand;Object.prototype.hasOwnProperty.call(r,`mcpBrand`)&&typeof e==`string`&&n.add(e),r=Object.getPrototypeOf(r)}n.size!==0&&Object.defineProperty(e,Zr,{value:n,enumerable:!1,configurable:!0})}function $r(e,t){try{if(typeof t==`object`&&t&&Object.prototype.hasOwnProperty.call(e,`mcpBrand`)&&typeof e.mcpBrand==`string`&&Object.prototype.hasOwnProperty.call(t,Zr)){let n=t[Zr];if(n&&typeof n.has==`function`&&n.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}var ei=function(e){return e.InvalidRequest=`invalid_request`,e.InvalidClient=`invalid_client`,e.InvalidGrant=`invalid_grant`,e.UnauthorizedClient=`unauthorized_client`,e.UnsupportedGrantType=`unsupported_grant_type`,e.InvalidScope=`invalid_scope`,e.AccessDenied=`access_denied`,e.ServerError=`server_error`,e.TemporarilyUnavailable=`temporarily_unavailable`,e.UnsupportedResponseType=`unsupported_response_type`,e.UnsupportedTokenType=`unsupported_token_type`,e.InvalidToken=`invalid_token`,e.MethodNotAllowed=`method_not_allowed`,e.TooManyRequests=`too_many_requests`,e.InvalidClientMetadata=`invalid_client_metadata`,e.InvalidRedirectUri=`invalid_redirect_uri`,e.InsufficientScope=`insufficient_scope`,e.InvalidTarget=`invalid_target`,e.InvalidDpopProof=`invalid_dpop_proof`,e.UseDpopNonce=`use_dpop_nonce`,e}({}),ti=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.OAuthError`})}static[Symbol.hasInstance](e){return $r(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return $r(this,e)}constructor(e,t,n){super(t),this.code=e,this.errorUri=n,this.name=`OAuthError`,Qr(this,new.target)}toResponseObject(){let e={error:this.code,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}static fromResponse(t){return new e(t.error,t.error_description??t.error,t.error_uri)}},J=function(e){return e.NotConnected=`NOT_CONNECTED`,e.AlreadyConnected=`ALREADY_CONNECTED`,e.NotInitialized=`NOT_INITIALIZED`,e.CapabilityNotSupported=`CAPABILITY_NOT_SUPPORTED`,e.RequestTimeout=`REQUEST_TIMEOUT`,e.ConnectionClosed=`CONNECTION_CLOSED`,e.SendFailed=`SEND_FAILED`,e.InvalidResult=`INVALID_RESULT`,e.UnsupportedResultType=`UNSUPPORTED_RESULT_TYPE`,e.InputRequiredRoundsExceeded=`INPUT_REQUIRED_ROUNDS_EXCEEDED`,e.ListPaginationExceeded=`LIST_PAGINATION_EXCEEDED`,e.MethodNotSupportedByProtocolVersion=`METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION`,e.EraNegotiationFailed=`ERA_NEGOTIATION_FAILED`,e.ClientHttpNotImplemented=`CLIENT_HTTP_NOT_IMPLEMENTED`,e.ClientHttpAuthentication=`CLIENT_HTTP_AUTHENTICATION`,e.ClientHttpForbidden=`CLIENT_HTTP_FORBIDDEN`,e.ClientHttpUnexpectedContent=`CLIENT_HTTP_UNEXPECTED_CONTENT`,e.ClientHttpFailedToOpenStream=`CLIENT_HTTP_FAILED_TO_OPEN_STREAM`,e.ClientHttpFailedToTerminateSession=`CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION`,e}({}),Y=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SdkError`})}static[Symbol.hasInstance](e){return $r(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return $r(this,e)}constructor(e,t,n,r){super(t,r),this.code=e,this.data=n,this.name=`SdkError`,Qr(this,new.target)}},ni=class extends Y{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SdkHttpError`})}constructor(e,t,n,r){super(e,t,n,r),this.name=`SdkHttpError`}get status(){return this.data.status}get statusText(){return this.data.statusText}};function ri(e){let t=typeof e==`string`?new URL(e):new URL(e.href);return t.hash=``,t}function ii(e){if(typeof e!=`object`||!e||Array.isArray(e))return e;let t={...e};return delete t.issuer,t}function ai({requestedResource:e,configuredResource:t}){let n=typeof e==`string`?new URL(e):new URL(e.href),r=typeof t==`string`?new URL(t):new URL(t.href);if(n.origin!==r.origin||n.pathname.length=oi}function li(e){return e.filter(e=>!ci(e))}function ui(e){return e.filter(e=>ci(e))}function di(e){let t=e.structuredContent;return t===void 0||typeof t==`object`&&t&&!Array.isArray(t)||(e.content?.some(e=>e.type===`text`)??!1)?e:{...e,content:[...e.content??[],{type:`text`,text:JSON.stringify(t)}]}}var fi=[`task`,`inputRequests`,`requestState`];function pi(e){return typeof e!=`object`||!e||Array.isArray(e)||e.content!==void 0||fi.some(t=>t in e)?e:{...e,content:[]}}function mi(){let e=ee(()=>j([x(),E(),A(),ae(),M(x(),e),O(e)])),t=M(x(),e),n=j([x(),E().int()]),r=x(),i=T({ttl:E().optional()}),a=T({taskId:x()}),o=k({progressToken:n.optional(),"io.modelcontextprotocol/related-task":a.optional()}),s=T({_meta:o.optional()}),c=s.extend({task:i.optional()}),l=T({method:x(),params:s.loose().optional()}),u=T({_meta:o.optional()}),d=T({method:x(),params:u.loose().optional()}),f=k({_meta:o.optional()}),p=j([x(),E().int()]),m=f.strict(),g=u.extend({requestId:p.optional(),reason:x().optional()}),_=d.extend({method:w(`notifications/cancelled`),params:g}),v=T({src:x(),mimeType:x().optional(),sizes:O(x()).optional(),theme:D([`light`,`dark`]).optional()}),b=T({icons:O(v).optional()}),C=T({name:x(),title:x().optional()}),te=C.extend({...C.shape,...b.shape,version:x(),websiteUrl:x().optional(),description:x().optional()}),ne=se(T({applyDefaults:A().optional()}),t),re=ce(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,se(T({form:ne.optional(),url:t.optional()}),t.optional())),ie=k({list:t.optional(),cancel:t.optional(),requests:k({sampling:k({createMessage:t.optional()}).optional(),elicitation:k({create:t.optional()}).optional()}).optional()}),oe=k({list:t.optional(),cancel:t.optional(),requests:k({tools:k({call:t.optional()}).optional()}).optional()}),le=T({experimental:M(x(),t).optional(),sampling:T({context:t.optional(),tools:t.optional()}).optional(),elicitation:re.optional(),roots:T({listChanged:A().optional()}).optional(),tasks:ie.optional(),extensions:M(x(),t).optional()}),ue=s.extend({protocolVersion:x(),capabilities:le,clientInfo:te}),de=l.extend({method:w(`initialize`),params:ue}),fe=T({experimental:M(x(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:T({listChanged:A().optional()}).optional(),resources:T({subscribe:A().optional(),listChanged:A().optional()}).optional(),tools:T({listChanged:A().optional()}).optional(),tasks:oe.optional(),extensions:M(x(),t).optional()}),me=f.extend({protocolVersion:x(),capabilities:fe,serverInfo:te,instructions:x().optional()}),he=d.extend({method:w(`notifications/initialized`),params:u.optional()}),N=l.extend({method:w(`ping`),params:s.optional()}),P=T({progress:E(),total:y(E()),message:y(x())}),ge=T({...u.shape,...P.shape,progressToken:n}),_e=d.extend({method:w(`notifications/progress`),params:ge}),ve=s.extend({cursor:r.optional()}),ye=l.extend({params:ve.optional()}),be=f.extend({nextCursor:r.optional()}),F=T({uri:x(),mimeType:y(x()),_meta:M(x(),h()).optional()}),xe=F.extend({text:x()}),Se=x().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),Ce=F.extend({blob:Se}),we=D([`user`,`assistant`]),Te=T({audience:O(we).optional(),priority:E().min(0).max(1).optional(),lastModified:pe({offset:!0}).optional()}),Ee=T({...C.shape,...b.shape,uri:x(),description:y(x()),mimeType:y(x()),size:y(E()),annotations:Te.optional(),_meta:y(k({}))}),De=T({...C.shape,...b.shape,uriTemplate:x(),description:y(x()),mimeType:y(x()),annotations:Te.optional(),_meta:y(k({}))}),Oe=ye.extend({method:w(`resources/list`)}),ke=be.extend({resources:O(Ee)}),Ae=ye.extend({method:w(`resources/templates/list`)}),je=be.extend({resourceTemplates:O(De)}),Me=s.extend({uri:x()}),Ne=Me,Pe=l.extend({method:w(`resources/read`),params:Ne}),Fe=f.extend({contents:O(j([xe,Ce]))}),Ie=d.extend({method:w(`notifications/resources/list_changed`),params:u.optional()}),Le=Me,Re=l.extend({method:w(`resources/subscribe`),params:Le}),ze=Me,Be=l.extend({method:w(`resources/unsubscribe`),params:ze}),Ve=u.extend({uri:x()}),I=d.extend({method:w(`notifications/resources/updated`),params:Ve}),He=T({name:x(),description:y(x()),required:y(A())}),Ue=T({...C.shape,...b.shape,description:y(x()),arguments:y(O(He)),_meta:y(k({}))}),We=ye.extend({method:w(`prompts/list`)}),Ge=be.extend({prompts:O(Ue)}),Ke=s.extend({name:x(),arguments:M(x(),x()).optional()}),qe=l.extend({method:w(`prompts/get`),params:Ke}),L=T({type:w(`text`),text:x(),annotations:Te.optional(),_meta:M(x(),h()).optional()}),Je=T({type:w(`image`),data:Se,mimeType:x(),annotations:Te.optional(),_meta:M(x(),h()).optional()}),R=T({type:w(`audio`),data:Se,mimeType:x(),annotations:Te.optional(),_meta:M(x(),h()).optional()}),z=T({type:w(`tool_use`),name:x(),id:x(),input:M(x(),h()),_meta:M(x(),h()).optional()}),B=T({type:w(`resource`),resource:j([xe,Ce]),annotations:Te.optional(),_meta:M(x(),h()).optional()}),Ye=Ee.extend({type:w(`resource_link`)}),V=j([L,Je,R,Ye,B]),Xe=T({role:we,content:V}),Ze=f.extend({description:x().optional(),messages:O(Xe)}),Qe=d.extend({method:w(`notifications/prompts/list_changed`),params:u.optional()}),$e=T({title:x().optional(),readOnlyHint:A().optional(),destructiveHint:A().optional(),idempotentHint:A().optional(),openWorldHint:A().optional()}),et=T({taskSupport:D([`required`,`optional`,`forbidden`]).optional()}),tt=T({...C.shape,...b.shape,description:x().optional(),inputSchema:T({type:w(`object`),properties:M(x(),e).optional(),required:O(x()).optional()}).catchall(h()),outputSchema:T({type:w(`object`),properties:M(x(),e).optional(),required:O(x()).optional()}).catchall(h()).optional(),annotations:$e.optional(),execution:et.optional(),_meta:M(x(),h()).optional()}),nt=ye.extend({method:w(`tools/list`)}),rt=be.extend({tools:O(tt)}),it=f.extend({content:O(V),structuredContent:M(x(),h()).optional(),isError:A().optional()}),at=c.extend({name:x(),arguments:M(x(),h()).optional()}),ot=l.extend({method:w(`tools/call`),params:at}),st=d.extend({method:w(`notifications/tools/list_changed`),params:u.optional()}),ct=D([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),H=s.extend({level:ct}),lt=l.extend({method:w(`logging/setLevel`),params:H}),ut=u.extend({level:ct,logger:x().optional(),data:h()}),dt=d.extend({method:w(`notifications/message`),params:ut}),ft=T({name:x().optional()}),pt=T({hints:O(ft).optional(),costPriority:E().min(0).max(1).optional(),speedPriority:E().min(0).max(1).optional(),intelligencePriority:E().min(0).max(1).optional()}),mt=T({mode:D([`auto`,`required`,`none`]).optional()}),ht=T({type:w(`tool_result`),toolUseId:x().describe(`The unique identifier for the corresponding tool call.`),content:O(V),structuredContent:T({}).loose().optional(),isError:A().optional(),_meta:M(x(),h()).optional()}),gt=S(`type`,[L,Je,R]),_t=S(`type`,[L,Je,R,z,ht]),vt=T({role:we,content:j([_t,O(_t)]),_meta:M(x(),h()).optional()}),yt=c.extend({messages:O(vt),modelPreferences:pt.optional(),systemPrompt:x().optional(),includeContext:D([`none`,`thisServer`,`allServers`]).optional(),temperature:E().optional(),maxTokens:E().int(),stopSequences:O(x()).optional(),metadata:t.optional(),tools:O(tt).optional(),toolChoice:mt.optional()}),bt=l.extend({method:w(`sampling/createMessage`),params:yt}),xt=f.extend({model:x(),stopReason:y(D([`endTurn`,`stopSequence`,`maxTokens`]).or(x())),role:we,content:gt}),St=f.extend({model:x(),stopReason:y(D([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(x())),role:we,content:j([_t,O(_t)])}),Ct=T({type:w(`boolean`),title:x().optional(),description:x().optional(),default:A().optional()}),wt=T({type:w(`string`),title:x().optional(),description:x().optional(),minLength:E().optional(),maxLength:E().optional(),format:D([`email`,`uri`,`date`,`date-time`]).optional(),default:x().optional()}),Tt=T({type:D([`number`,`integer`]),title:x().optional(),description:x().optional(),minimum:E().optional(),maximum:E().optional(),default:E().optional()}),Et=T({type:w(`string`),title:x().optional(),description:x().optional(),enum:O(x()),default:x().optional()}),Dt=T({type:w(`string`),title:x().optional(),description:x().optional(),oneOf:O(T({const:x(),title:x()})),default:x().optional()}),Ot=T({type:w(`string`),title:x().optional(),description:x().optional(),enum:O(x()),enumNames:O(x()).optional(),default:x().optional()}),kt=j([Et,Dt]),At=T({type:w(`array`),title:x().optional(),description:x().optional(),minItems:E().optional(),maxItems:E().optional(),items:T({type:w(`string`),enum:O(x())}),default:O(x()).optional()}),jt=T({type:w(`array`),title:x().optional(),description:x().optional(),minItems:E().optional(),maxItems:E().optional(),items:T({anyOf:O(T({const:x(),title:x()}))}),default:O(x()).optional()}),Mt=j([At,jt]),Nt=j([Ot,kt,Mt]),Pt=j([Nt,Ct,wt,Tt]),Ft=c.extend({mode:w(`form`).optional(),message:x(),requestedSchema:T({type:w(`object`),properties:M(x(),Pt),required:O(x()).optional()}).catchall(h())}),It=c.extend({mode:w(`url`),message:x(),elicitationId:x(),url:x().url()}),Lt=j([Ft,It]),U=l.extend({method:w(`elicitation/create`),params:Lt}),W=u.extend({elicitationId:x()}),Rt=d.extend({method:w(`notifications/elicitation/complete`),params:W}),zt=f.extend({action:D([`accept`,`decline`,`cancel`]),content:ce(e=>e===null?void 0:e,M(x(),j([x(),E(),A(),O(x())])).optional())}),Bt=T({type:w(`ref/resource`),uri:x()}),Vt=T({type:w(`ref/prompt`),name:x()}),Ht=s.extend({ref:j([Vt,Bt]),argument:T({name:x(),value:x()}),context:T({arguments:M(x(),x()).optional()}).optional()}),Ut=l.extend({method:w(`completion/complete`),params:Ht}),Wt=f.extend({completion:k({values:O(x()).max(100),total:y(E().int()),hasMore:y(A())})}),Gt=T({uri:x().startsWith(`file://`),name:x().optional(),_meta:M(x(),h()).optional()}),Kt=l.extend({method:w(`roots/list`),params:s.optional()}),qt=f.extend({roots:O(Gt)}),Jt=d.extend({method:w(`notifications/roots/list_changed`),params:u.optional()}),Yt=k({ttl:E().optional(),pollInterval:E().optional()}),Xt=D([`working`,`input_required`,`completed`,`failed`,`cancelled`]),Zt=T({taskId:x(),status:Xt,ttl:j([E(),ae()]),createdAt:x(),lastUpdatedAt:x(),pollInterval:y(E()),statusMessage:y(x())}),Qt=f.extend({task:Zt}),$t=u.merge(Zt),en=d.extend({method:w(`notifications/tasks/status`),params:$t}),tn=l.extend({method:w(`tasks/get`),params:s.extend({taskId:x()})}),G=f.merge(Zt),nn=l.extend({method:w(`tasks/result`),params:s.extend({taskId:x()})}),rn=f.loose(),an=ye.extend({method:w(`tasks/list`)}),on=be.extend({tasks:O(Zt)}),sn=l.extend({method:w(`tasks/cancel`),params:s.extend({taskId:x()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:n,CursorSchema:r,TaskMetadataSchema:i,RelatedTaskMetadataSchema:a,RequestMetaSchema:o,BaseRequestParamsSchema:s,TaskAugmentedRequestParamsSchema:c,RequestSchema:l,NotificationsParamsSchema:u,NotificationSchema:d,ResultSchema:f,RequestIdSchema:p,EmptyResultSchema:m,CancelledNotificationParamsSchema:g,CancelledNotificationSchema:_,IconSchema:v,IconsSchema:b,BaseMetadataSchema:C,ImplementationSchema:te,ClientTasksCapabilitySchema:ie,ServerTasksCapabilitySchema:oe,ClientCapabilitiesSchema:le,InitializeRequestParamsSchema:ue,InitializeRequestSchema:de,ServerCapabilitiesSchema:fe,InitializeResultSchema:me,InitializedNotificationSchema:he,PingRequestSchema:N,ProgressSchema:P,ProgressNotificationParamsSchema:ge,ProgressNotificationSchema:_e,PaginatedRequestParamsSchema:ve,PaginatedRequestSchema:ye,PaginatedResultSchema:be,ResourceContentsSchema:F,TextResourceContentsSchema:xe,BlobResourceContentsSchema:Ce,RoleSchema:we,AnnotationsSchema:Te,ResourceSchema:Ee,ResourceTemplateSchema:De,ListResourcesRequestSchema:Oe,ListResourcesResultSchema:ke,ListResourceTemplatesRequestSchema:Ae,ListResourceTemplatesResultSchema:je,ResourceRequestParamsSchema:Me,ReadResourceRequestParamsSchema:Ne,ReadResourceRequestSchema:Pe,ReadResourceResultSchema:Fe,ResourceListChangedNotificationSchema:Ie,SubscribeRequestParamsSchema:Le,SubscribeRequestSchema:Re,UnsubscribeRequestParamsSchema:ze,UnsubscribeRequestSchema:Be,ResourceUpdatedNotificationParamsSchema:Ve,ResourceUpdatedNotificationSchema:I,PromptArgumentSchema:He,PromptSchema:Ue,ListPromptsRequestSchema:We,ListPromptsResultSchema:Ge,GetPromptRequestParamsSchema:Ke,GetPromptRequestSchema:qe,TextContentSchema:L,ImageContentSchema:Je,AudioContentSchema:R,ToolUseContentSchema:z,EmbeddedResourceSchema:B,ResourceLinkSchema:Ye,ContentBlockSchema:V,PromptMessageSchema:Xe,GetPromptResultSchema:Ze,PromptListChangedNotificationSchema:Qe,ToolAnnotationsSchema:$e,ToolExecutionSchema:et,ToolSchema:tt,ListToolsRequestSchema:nt,ListToolsResultSchema:rt,CallToolResultSchema:it,CallToolRequestParamsSchema:at,CallToolRequestSchema:ot,ToolListChangedNotificationSchema:st,LoggingLevelSchema:ct,SetLevelRequestParamsSchema:H,SetLevelRequestSchema:lt,LoggingMessageNotificationParamsSchema:ut,LoggingMessageNotificationSchema:dt,ModelHintSchema:ft,ModelPreferencesSchema:pt,ToolChoiceSchema:mt,ToolResultContentSchema:ht,SamplingContentSchema:gt,SamplingMessageContentBlockSchema:_t,SamplingMessageSchema:vt,CreateMessageRequestParamsSchema:yt,CreateMessageRequestSchema:bt,CreateMessageResultSchema:xt,CreateMessageResultWithToolsSchema:St,BooleanSchemaSchema:Ct,StringSchemaSchema:wt,NumberSchemaSchema:Tt,UntitledSingleSelectEnumSchemaSchema:Et,TitledSingleSelectEnumSchemaSchema:Dt,LegacyTitledEnumSchemaSchema:Ot,SingleSelectEnumSchemaSchema:kt,UntitledMultiSelectEnumSchemaSchema:At,TitledMultiSelectEnumSchemaSchema:jt,MultiSelectEnumSchemaSchema:Mt,EnumSchemaSchema:Nt,PrimitiveSchemaDefinitionSchema:Pt,ElicitRequestFormParamsSchema:Ft,ElicitRequestURLParamsSchema:It,ElicitRequestParamsSchema:Lt,ElicitRequestSchema:U,ElicitationCompleteNotificationParamsSchema:W,ElicitationCompleteNotificationSchema:Rt,ElicitResultSchema:zt,ResourceTemplateReferenceSchema:Bt,PromptReferenceSchema:Vt,CompleteRequestParamsSchema:Ht,CompleteRequestSchema:Ut,CompleteResultSchema:Wt,RootSchema:Gt,ListRootsRequestSchema:Kt,ListRootsResultSchema:qt,RootsListChangedNotificationSchema:Jt,TaskCreationParamsSchema:Yt,TaskStatusSchema:Xt,TaskSchema:Zt,CreateTaskResultSchema:Qt,TaskStatusNotificationParamsSchema:$t,TaskStatusNotificationSchema:en,GetTaskRequestSchema:tn,GetTaskResultSchema:G,GetTaskPayloadRequestSchema:nn,GetTaskPayloadResultSchema:rn,ListTasksRequestSchema:an,ListTasksResultSchema:on,CancelTaskRequestSchema:sn,CancelTaskResultSchema:f.merge(Zt),ClientRequestSchema:j([N,de,Ut,lt,qe,We,Oe,Ae,Pe,Re,Be,ot,nt,tn,nn,an,sn]),ClientNotificationSchema:j([_,_e,he,Jt,en]),ClientResultSchema:j([m,xt,St,zt,qt,G,on,Qt]),ServerRequestSchema:j([N,bt,U,Kt,tn,nn,an,sn]),ServerNotificationSchema:j([_,_e,dt,I,Ie,st,Qe,en,Rt]),ServerResultSchema:j([m,me,Wt,Ze,Ge,ke,je,Fe,it,rt,G,on,Qt]),CallToolResultWireSchema:h().superRefine((e,t)=>{if(typeof e==`object`&&e&&!Array.isArray(e)&&e.content===void 0){for(let n of fi)if(n in e){t.addIssue({code:`custom`,message:`content is required when the body carries '${n}' — another result family cannot default into an empty tools/call success`});return}}}).transform(pi).pipe(it)}}var hi;function gi(){return hi??=mi()}function _i(e){return e.type!==`object`}var vi=new Set([`const`,`enum`,`default`,`examples`]),yi=new Set([`properties`,`patternProperties`,`$defs`,`definitions`,`dependentSchemas`,`dependencies`]);function bi(e){return e!==void 0&&!(typeof e==`string`&&e.startsWith(`#`))}function xi(e){let t=typeof e.$schema==`string`?e.$schema:void 0;if(bi(e.$id))return{...t!==void 0&&{$schema:t},type:`object`,properties:{result:e},required:[`result`]};let n=Ae(e.$schema)&&e.$recursiveAnchor!==!0,r=(e,t)=>{if(Array.isArray(e))return e.map(e=>r(e,!1));if(typeof e!=`object`||!e||!t&&bi(e.$id))return e;let i={},a=!1;for(let[o,s]of Object.entries(e))t?i[o]=r(s,!1):(o===`$ref`||o===`$dynamicRef`)&&typeof s==`string`?i[o]=s===`#`?`#/properties/result`:s.startsWith(`#/`)?`#/properties/result${s.slice(1)}`:s:o===`$recursiveRef`&&s===`#`&&n?a=!0:i[o]=vi.has(o)?s:yi.has(o)?r(s,!0):r(s,!1);return a&&(`$ref`in i?i.allOf=[...Array.isArray(i.allOf)?i.allOf:[],{$ref:`#/properties/result`}]:i.$ref=`#/properties/result`),i};return{...t!==void 0&&{$schema:t},type:`object`,properties:{result:r(e,!1)},required:[`result`]}}var Si={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},Ci={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},wi={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},Ti;function Ei(){if(Ti)return Ti;let e=gi();return Ti={requestSchemas:{ping:e.PingRequestSchema,initialize:e.InitializeRequestSchema,"completion/complete":e.CompleteRequestSchema,"logging/setLevel":e.SetLevelRequestSchema,"prompts/get":e.GetPromptRequestSchema,"prompts/list":e.ListPromptsRequestSchema,"resources/list":e.ListResourcesRequestSchema,"resources/templates/list":e.ListResourceTemplatesRequestSchema,"resources/read":e.ReadResourceRequestSchema,"resources/subscribe":e.SubscribeRequestSchema,"resources/unsubscribe":e.UnsubscribeRequestSchema,"tools/call":e.CallToolRequestSchema,"tools/list":e.ListToolsRequestSchema,"tasks/get":e.GetTaskRequestSchema,"tasks/result":e.GetTaskPayloadRequestSchema,"tasks/list":e.ListTasksRequestSchema,"tasks/cancel":e.CancelTaskRequestSchema,"sampling/createMessage":e.CreateMessageRequestSchema,"elicitation/create":e.ElicitRequestSchema,"roots/list":e.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":e.CancelledNotificationSchema,"notifications/progress":e.ProgressNotificationSchema,"notifications/initialized":e.InitializedNotificationSchema,"notifications/roots/list_changed":e.RootsListChangedNotificationSchema,"notifications/tasks/status":e.TaskStatusNotificationSchema,"notifications/message":e.LoggingMessageNotificationSchema,"notifications/resources/updated":e.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":e.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":e.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":e.PromptListChangedNotificationSchema,"notifications/elicitation/complete":e.ElicitationCompleteNotificationSchema},resultSchemas:{ping:e.EmptyResultSchema,initialize:e.InitializeResultSchema,"completion/complete":e.CompleteResultSchema,"logging/setLevel":e.EmptyResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"resources/subscribe":e.EmptyResultSchema,"resources/unsubscribe":e.EmptyResultSchema,"tools/call":e.CallToolResultWireSchema,"tools/list":e.ListToolsResultSchema,"sampling/createMessage":e.CreateMessageResultWithToolsSchema,"elicitation/create":e.ElicitResultSchema,"roots/list":e.ListRootsResultSchema}},Ti}function Di(e){return Object.prototype.hasOwnProperty.call(Si,e)}function Oi(e){return Object.prototype.hasOwnProperty.call(Ci,e)}function ki(e){return Object.prototype.hasOwnProperty.call(wi,e)}function Ai(e){return ki(e)?Ei().resultSchemas[e]:void 0}function ji(e){return Di(e)?Ei().requestSchemas[e]:void 0}function Mi(e){return Oi(e)?Ei().notificationSchemas[e]:void 0}Object.keys(Si),Object.keys(Ci);function Ni(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Pi(e,t){if(e===void 0)return{ok:!1,reason:`not-in-era`};let n=e.safeParse(t);return n.success?{ok:!0,value:n.data}:{ok:!1,reason:`invalid`,message:String(n.error)}}var Fi={ok:!1,reason:`not-in-era`};function Ii(e){return Ni(e)&&Ni(e.outputSchema)&&_i(e.outputSchema)}function Li(e){return e}var Ri={era:`2025-11-25`,hasRequestMethod:Di,hasNotificationMethod:Oi,validateRequest:(e,t)=>Pi(ji(e),t),validateResult:(e,t)=>Pi(Ai(e),t),validateNotification:(e,t)=>Pi(Mi(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>Fi,validateInputResponse:()=>Fi,samplingResultVariant:((e,t)=>{let n=gi();return Pi(e?n.CreateMessageResultWithToolsSchema:n.CreateMessageResultSchema,t)}),outboundEnvelope:e=>void 0,validateEnvelopeMeta:e=>[],projectCallToolResult(e,t){let n=di(e),r=n.structuredContent;if(r===void 0)return n;let i=typeof r!=`object`||!r||Array.isArray(r),a=t!==void 0&&_i(t);return!i&&!a?n:{...n,structuredContent:{result:r}}},decodeResult(e,t){if(Ni(t)&&`resultType`in t){let e={...t};return delete e.resultType,{kind:`complete`,result:Li(e)}}return{kind:`complete`,result:Li(t)}},encodeResult(e,t){if(e!==`tools/list`)return t;let n=t.tools;return!Array.isArray(n)||!n.some(e=>Ii(e))?t:{...t,tools:n.map(e=>Ii(e)?{...e,outputSchema:xi(e.outputSchema)}:e)}},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope:e=>void 0};function zi(){let e=ee(()=>j([x(),E(),A(),ae(),M(x(),e),O(e)])),t=M(x(),e),n=j([x(),E().int()]),r=x(),i=j([x(),E().int()]),a=D([`user`,`assistant`]),o=D([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),s=x().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),c=T({ttl:E().optional()}),l=T({taskId:x()}),u=k({progressToken:n.optional(),"io.modelcontextprotocol/related-task":l.optional()}),d=T({_meta:u.optional()}),f=d.extend({task:c.optional()}),p=T({_meta:u.optional()}),m=T({method:x(),params:p.loose().optional()}),g=T({src:x(),mimeType:x().optional(),sizes:O(x()).optional(),theme:D([`light`,`dark`]).optional()}),_=T({icons:O(g).optional()}),v=T({name:x(),title:x().optional()}),b=v.extend({...v.shape,..._.shape,version:x(),websiteUrl:x().optional(),description:x().optional()}),S=se(T({applyDefaults:A().optional()}),t),C=ce(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,se(T({form:S.optional(),url:t.optional()}),t.optional())),te=k({list:t.optional(),cancel:t.optional(),requests:k({sampling:k({createMessage:t.optional()}).optional(),elicitation:k({create:t.optional()}).optional()}).optional()}),ne=k({list:t.optional(),cancel:t.optional(),requests:k({tools:k({call:t.optional()}).optional()}).optional()}),re=T({experimental:M(x(),t).optional(),sampling:T({context:t.optional(),tools:t.optional()}).optional(),elicitation:C.optional(),roots:T({listChanged:A().optional()}).optional(),tasks:te.optional(),extensions:M(x(),t).optional()}),ie=T({experimental:M(x(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:T({listChanged:A().optional()}).optional(),resources:T({subscribe:A().optional(),listChanged:A().optional()}).optional(),tools:T({listChanged:A().optional()}).optional(),tasks:ne.optional(),extensions:M(x(),t).optional()}),oe=T({progress:E(),total:y(E()),message:y(x())}),le=T({...p.shape,...oe.shape,progressToken:n}),ue=m.extend({method:w(`notifications/progress`),params:le}),de=p.extend({level:o,logger:x().optional(),data:h()}),fe=m.extend({method:w(`notifications/message`),params:de}),me=T({uri:x(),mimeType:y(x()),_meta:M(x(),h()).optional()}),he=me.extend({text:x()}),N=me.extend({blob:s}),P=T({audience:O(a).optional(),priority:E().min(0).max(1).optional(),lastModified:pe({offset:!0}).optional()}),ge=T({...v.shape,..._.shape,uri:x(),description:y(x()),mimeType:y(x()),size:y(E()),annotations:P.optional(),_meta:y(k({}))}),_e=T({...v.shape,..._.shape,uriTemplate:x(),description:y(x()),mimeType:y(x()),annotations:P.optional(),_meta:y(k({}))}),ve=m.extend({method:w(`notifications/resources/list_changed`),params:p.optional()}),ye=p.extend({uri:x()}),be=m.extend({method:w(`notifications/resources/updated`),params:ye}),F=T({name:x(),description:y(x()),required:y(A())}),xe=T({...v.shape,..._.shape,description:y(x()),arguments:y(O(F)),_meta:y(k({}))}),Se=m.extend({method:w(`notifications/prompts/list_changed`),params:p.optional()}),Ce=T({type:w(`text`),text:x(),annotations:P.optional(),_meta:M(x(),h()).optional()}),we=T({type:w(`image`),data:s,mimeType:x(),annotations:P.optional(),_meta:M(x(),h()).optional()}),Te=T({type:w(`audio`),data:s,mimeType:x(),annotations:P.optional(),_meta:M(x(),h()).optional()}),Ee=T({type:w(`tool_use`),name:x(),id:x(),input:M(x(),h()),_meta:M(x(),h()).optional()}),De=T({type:w(`resource`),resource:j([he,N]),annotations:P.optional(),_meta:M(x(),h()).optional()}),Oe=ge.extend({type:w(`resource_link`)}),ke=j([Ce,we,Te,Oe,De]),Ae=T({role:a,content:ke}),je=T({title:x().optional(),readOnlyHint:A().optional(),destructiveHint:A().optional(),idempotentHint:A().optional(),openWorldHint:A().optional()}),Me=m.extend({method:w(`notifications/tools/list_changed`),params:p.optional()}),Ne=T({name:x().optional()}),Pe=T({hints:O(Ne).optional(),costPriority:E().min(0).max(1).optional(),speedPriority:E().min(0).max(1).optional(),intelligencePriority:E().min(0).max(1).optional()}),ze=T({mode:D([`auto`,`required`,`none`]).optional()}),Ve=T({type:w(`boolean`),title:x().optional(),description:x().optional(),default:A().optional()}),I=T({type:w(`string`),title:x().optional(),description:x().optional(),minLength:E().optional(),maxLength:E().optional(),format:D([`email`,`uri`,`date`,`date-time`]).optional(),default:x().optional()}),He=T({type:D([`number`,`integer`]),title:x().optional(),description:x().optional(),minimum:E().optional(),maximum:E().optional(),default:E().optional()}),Ue=T({type:w(`string`),title:x().optional(),description:x().optional(),enum:O(x()),default:x().optional()}),We=T({type:w(`string`),title:x().optional(),description:x().optional(),oneOf:O(T({const:x(),title:x()})),default:x().optional()}),Ge=T({type:w(`string`),title:x().optional(),description:x().optional(),enum:O(x()),enumNames:O(x()).optional(),default:x().optional()}),Ke=j([Ue,We]),qe=T({type:w(`array`),title:x().optional(),description:x().optional(),minItems:E().optional(),maxItems:E().optional(),items:T({type:w(`string`),enum:O(x())}),default:O(x()).optional()}),L=T({type:w(`array`),title:x().optional(),description:x().optional(),minItems:E().optional(),maxItems:E().optional(),items:T({anyOf:O(T({const:x(),title:x()}))}),default:O(x()).optional()}),Je=j([qe,L]),R=j([Ge,Ke,Je]),z=j([R,Ve,I,He]),B=f.extend({mode:w(`form`).optional(),message:x(),requestedSchema:T({type:w(`object`),properties:M(x(),z),required:O(x()).optional()}).catchall(h())}),Ye=T({type:w(`ref/resource`),uri:x()}),V=T({type:w(`ref/prompt`),name:x()}),Xe=T({uri:x().startsWith(`file://`),name:x().optional(),_meta:M(x(),h()).optional()}),Ze=re.shape,Qe=T({experimental:Ze.experimental,sampling:Ze.sampling,elicitation:Ze.elicitation,roots:Ze.roots,extensions:Ze.extensions}),$e=ie.shape,et=T({experimental:$e.experimental,logging:$e.logging,completions:$e.completions,prompts:$e.prompts,resources:$e.resources,tools:$e.tools,extensions:$e.extensions}),tt=k({progressToken:n.optional(),[Fe]:x(),[Ie]:b.optional(),[Re]:Qe,[Be]:o.optional()}),nt=T({...v.shape,..._.shape,description:x().optional(),inputSchema:k({$schema:x().optional(),type:w(`object`)}),outputSchema:k({$schema:x().optional()}).optional(),annotations:je.optional(),_meta:M(x(),h()).optional()}),rt=T({type:w(`tool_result`),toolUseId:x(),content:O(ke),structuredContent:h().optional(),isError:A().optional(),_meta:M(x(),h()).optional()}),it=j([Ce,we,Te,Ee,rt]),at=T({role:a,content:j([it,O(it)]),_meta:M(x(),h()).optional()}),ot=x(),st=k({[Le]:b.optional().catch(void 0)}),ct=st.optional();function H(e){return k({_meta:ct,resultType:ot.default(`complete`),...e})}let lt=H({}),ut=H({nextCursor:r.optional()}),dt=H({content:O(ke),structuredContent:h().optional(),isError:A().optional()}),ft=H({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),tools:O(nt),nextCursor:r.optional()}),pt=H({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),prompts:O(xe),nextCursor:r.optional()}),mt=H({description:x().optional(),messages:O(Ae)}),ht=H({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),resources:O(ge),nextCursor:r.optional()}),gt=H({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),resourceTemplates:O(_e),nextCursor:r.optional()}),_t=H({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),contents:O(j([he,N]))}),vt=H({completion:T({values:O(x()).max(100),total:E().int().optional(),hasMore:A().optional()}).loose()}),yt=H({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`])}),bt=H({ttlMs:E().int().min(0).catch(0),cacheScope:D([`public`,`private`]).catch(`private`),supportedVersions:O(x()),capabilities:et,instructions:x().optional()}),xt=T({messages:O(at),modelPreferences:Pe.optional(),systemPrompt:x().optional(),includeContext:D([`none`,`thisServer`,`allServers`]).optional(),temperature:E().optional(),maxTokens:E().int(),stopSequences:O(x()).optional(),metadata:t.optional(),tools:O(nt).optional(),toolChoice:ze.optional()}),St=T({method:w(`sampling/createMessage`),params:xt}),Ct=T({method:w(`roots/list`),params:T({_meta:M(x(),h()).optional()}).optional()}),wt=T({...at.shape,model:x(),stopReason:x().optional()}),Tt=T({roots:O(Xe)}),Et=T({action:D([`accept`,`decline`,`cancel`]),content:M(x(),j([x(),E(),A(),O(x())])).optional()}),Dt=T({mode:w(`url`),message:x(),url:x().url()}),Ot=j([B,Dt]),kt=T({method:w(`elicitation/create`),params:Ot}),At=j([St,Ct,kt]),jt=j([wt,Tt,Et]),Mt=M(x(),At),Nt=M(x(),jt),Pt=H({inputRequests:Mt.optional(),requestState:x().optional()}),Ft={inputResponses:Nt.optional(),requestState:x().optional()},It=T({_meta:tt,...Ft}),Lt=k({progressToken:n.optional()});function U(e,t){return T({method:w(e),params:T({_meta:tt,...t})})}function W(e,t){return T({method:w(e),params:T({_meta:Lt.optional(),...t}).optional()})}let Rt={name:x(),arguments:M(x(),h()).optional(),...Ft},zt={cursor:r.optional()},Bt=U(`tools/call`,Rt),Vt=U(`tools/list`,zt),Ht=U(`prompts/list`,zt),Ut=U(`prompts/get`,{name:x(),arguments:M(x(),x()).optional(),...Ft}),Wt=U(`resources/list`,zt),Gt=U(`resources/templates/list`,zt),Kt=U(`resources/read`,{uri:x(),...Ft}),qt={ref:j([V,Ye]),argument:T({name:x(),value:x()}),context:T({arguments:M(x(),x()).optional()}).optional()},Jt=U(`completion/complete`,qt),Yt=U(`server/discover`,{}),Xt=T({toolsListChanged:A().optional(),promptsListChanged:A().optional(),resourcesListChanged:A().optional(),resourceSubscriptions:O(x()).optional()}),Zt={notifications:Xt},Qt=U(`subscriptions/listen`,Zt),$t=st.extend({"io.modelcontextprotocol/subscriptionId":i}),en=k({_meta:$t,resultType:ot.default(`complete`)}),tn={"tools/call":W(`tools/call`,Rt),"tools/list":W(`tools/list`,zt),"prompts/get":W(`prompts/get`,{name:x(),arguments:M(x(),x()).optional()}),"prompts/list":W(`prompts/list`,zt),"resources/list":W(`resources/list`,zt),"resources/templates/list":W(`resources/templates/list`,zt),"resources/read":W(`resources/read`,{uri:x()}),"completion/complete":W(`completion/complete`,qt),"server/discover":W(`server/discover`,{}),"subscriptions/listen":W(`subscriptions/listen`,Zt)};function G(e){return k({_meta:ct,...e})}let nn={"tools/call":G({content:O(ke),structuredContent:h().optional(),isError:A().optional()}),"tools/list":G({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),tools:O(nt),nextCursor:r.optional()}),"prompts/get":G({description:x().optional(),messages:O(Ae)}),"prompts/list":G({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),prompts:O(xe),nextCursor:r.optional()}),"resources/list":G({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),resources:O(ge),nextCursor:r.optional()}),"resources/templates/list":G({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),resourceTemplates:O(_e),nextCursor:r.optional()}),"resources/read":G({ttlMs:E().int().min(0),cacheScope:D([`public`,`private`]),contents:O(j([he,N]))}),"completion/complete":G({completion:T({values:O(x()).max(100),total:E().int().optional(),hasMore:A().optional()}).loose()}),"server/discover":G({ttlMs:E().int().min(0).catch(0),cacheScope:D([`public`,`private`]).catch(`private`),supportedVersions:O(x()),capabilities:et,instructions:x().optional()}),"subscriptions/listen":G({})},rn=k({"io.modelcontextprotocol/subscriptionId":i.optional()}),an=T({method:w(`notifications/subscriptions/acknowledged`),params:T({_meta:rn.optional(),notifications:Xt})}),on=T({_meta:rn.optional(),requestId:i,reason:x().optional()}),sn=T({method:w(`notifications/cancelled`),params:on}),cn={"notifications/cancelled":sn,"notifications/progress":ue,"notifications/message":fe,"notifications/resources/updated":be,"notifications/resources/list_changed":ve,"notifications/tools/list_changed":Me,"notifications/prompts/list_changed":Se,"notifications/subscriptions/acknowledged":an},K=e=>T({jsonrpc:w(`2.0`),id:j([x(),E().int()]),result:e}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:n,CursorSchema:r,RequestIdSchema:i,RoleSchema:a,LoggingLevelSchema:o,TaskMetadataSchema:c,RelatedTaskMetadataSchema:l,RequestMetaSchema:u,BaseRequestParamsSchema:d,TaskAugmentedRequestParamsSchema:f,NotificationsParamsSchema:p,NotificationSchema:m,IconSchema:g,IconsSchema:_,BaseMetadataSchema:v,ImplementationSchema:b,ClientTasksCapabilitySchema:te,ServerTasksCapabilitySchema:ne,ClientCapabilitiesSchema:re,ServerCapabilitiesSchema:ie,ProgressSchema:oe,ProgressNotificationParamsSchema:le,ProgressNotificationSchema:ue,LoggingMessageNotificationParamsSchema:de,LoggingMessageNotificationSchema:fe,ResourceContentsSchema:me,TextResourceContentsSchema:he,BlobResourceContentsSchema:N,AnnotationsSchema:P,ResourceSchema:ge,ResourceTemplateSchema:_e,ResourceListChangedNotificationSchema:ve,ResourceUpdatedNotificationParamsSchema:ye,ResourceUpdatedNotificationSchema:be,PromptArgumentSchema:F,PromptSchema:xe,PromptListChangedNotificationSchema:Se,TextContentSchema:Ce,ImageContentSchema:we,AudioContentSchema:Te,ToolUseContentSchema:Ee,EmbeddedResourceSchema:De,ResourceLinkSchema:Oe,ContentBlockSchema:ke,PromptMessageSchema:Ae,ToolAnnotationsSchema:je,ToolListChangedNotificationSchema:Me,ModelHintSchema:Ne,ModelPreferencesSchema:Pe,ToolChoiceSchema:ze,BooleanSchemaSchema:Ve,StringSchemaSchema:I,NumberSchemaSchema:He,UntitledSingleSelectEnumSchemaSchema:Ue,TitledSingleSelectEnumSchemaSchema:We,LegacyTitledEnumSchemaSchema:Ge,SingleSelectEnumSchemaSchema:Ke,UntitledMultiSelectEnumSchemaSchema:qe,TitledMultiSelectEnumSchemaSchema:L,MultiSelectEnumSchemaSchema:Je,EnumSchemaSchema:R,PrimitiveSchemaDefinitionSchema:z,ElicitRequestFormParamsSchema:B,ResourceTemplateReferenceSchema:Ye,PromptReferenceSchema:V,RootSchema:Xe,ClientCapabilities2026Schema:Qe,ServerCapabilities2026Schema:et,RequestMetaEnvelopeSchema:tt,ToolSchema:nt,ToolResultContentSchema:rt,SamplingMessageContentBlockSchema:it,SamplingMessageSchema:at,ResultTypeSchema:ot,ResultMetaSchema:st,ResultSchema:lt,PaginatedResultSchema:ut,CallToolResultSchema:dt,ListToolsResultSchema:ft,ListPromptsResultSchema:pt,GetPromptResultSchema:mt,ListResourcesResultSchema:ht,ListResourceTemplatesResultSchema:gt,ReadResourceResultSchema:_t,CompleteResultSchema:vt,CacheableResultSchema:yt,DiscoverResultSchema:bt,CreateMessageRequestParamsSchema:xt,CreateMessageRequestSchema:St,ListRootsRequestSchema:Ct,CreateMessageResultSchema:wt,ListRootsResultSchema:Tt,ElicitResultSchema:Et,ElicitRequestURLParamsSchema:Dt,ElicitRequestParamsSchema:Ot,ElicitRequestSchema:kt,InputRequestSchema:At,InputResponseSchema:jt,InputRequestsSchema:Mt,InputResponsesSchema:Nt,InputRequiredResultSchema:Pt,InputResponseRequestParamsSchema:It,CallToolRequestSchema:Bt,ListToolsRequestSchema:Vt,ListPromptsRequestSchema:Ht,GetPromptRequestSchema:Ut,ListResourcesRequestSchema:Wt,ListResourceTemplatesRequestSchema:Gt,ReadResourceRequestSchema:Kt,CompleteRequestSchema:Jt,DiscoverRequestSchema:Yt,SubscriptionFilterSchema:Xt,SubscriptionsListenRequestSchema:Qt,SubscriptionsListenResultMetaSchema:$t,SubscriptionsListenResultSchema:en,dispatchRequestSchemas:tn,dispatchResultSchemas:nn,NotificationMetaSchema:rn,SubscriptionsAcknowledgedNotificationSchema:an,CancelledNotificationParamsSchema:on,CancelledNotificationSchema:sn,notificationSchemas2026:cn,JSONRPCResultResponseSchema:K(lt),CallToolResultResponseSchema:K(j([dt,Pt])),ListToolsResultResponseSchema:K(ft),ListPromptsResultResponseSchema:K(pt),GetPromptResultResponseSchema:K(j([mt,Pt])),ListResourcesResultResponseSchema:K(ht),ListResourceTemplatesResultResponseSchema:K(gt),ReadResourceResultResponseSchema:K(j([_t,Pt])),CompleteResultResponseSchema:K(vt),DiscoverResultResponseSchema:K(bt),SubscriptionsListenResultResponseSchema:K(en)}}var Bi;function Vi(){return Bi??=zi()}var Hi=[`tools/list`,`prompts/list`,`resources/list`,`resources/templates/list`,`resources/read`,`server/discover`];function Ui(e){return Hi.includes(e)}var Wi=Symbol(`modelcontextprotocol.resultCacheHintFallback`);function Gi(e){return e[Wi]}function Ki(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function qi(e){return e===`public`||e===`private`}var X=function(e){return e[e.ParseError=-32700]=`ParseError`,e[e.InvalidRequest=-32600]=`InvalidRequest`,e[e.MethodNotFound=-32601]=`MethodNotFound`,e[e.InvalidParams=-32602]=`InvalidParams`,e[e.InternalError=-32603]=`InternalError`,e[e.ResourceNotFound=-32002]=`ResourceNotFound`,e[e.MissingRequiredClientCapability=-32021]=`MissingRequiredClientCapability`,e[e.UnsupportedProtocolVersion=-32022]=`UnsupportedProtocolVersion`,e[e.UrlElicitationRequired=-32042]=`UrlElicitationRequired`,e}({}),Z=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.ProtocolError`})}static[Symbol.hasInstance](e){return $r(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return $r(this,e)}constructor(e,t,n){super(t),this.code=e,this.data=n,this.name=`ProtocolError`,Qr(this,new.target)}static fromError(t,n,r){if(t===X.UrlElicitationRequired&&r){let e=r;if(e.elicitations)return new Yi(e.elicitations,n)}if(t===X.UnsupportedProtocolVersion&&r){let e=r;if(Array.isArray(e.supported)&&typeof e.requested==`string`)return new Xi({supported:e.supported,requested:e.requested},n)}if(t===X.InvalidParams||t===X.ResourceNotFound){let e=r;if(typeof e?.uri==`string`&&(t===X.ResourceNotFound||Object.keys(e).length===1))return new Ji(e.uri,n)}if(t===X.MissingRequiredClientCapability&&r){let e=r;if(e.requiredCapabilities!==null&&typeof e.requiredCapabilities==`object`&&!Array.isArray(e.requiredCapabilities))return new Zi({requiredCapabilities:e.requiredCapabilities},n)}return new e(t,n,r)}},Ji=class extends Z{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.ResourceNotFoundError`})}constructor(e,t=`Resource not found: ${e}`){super(X.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},Yi=class extends Z{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UrlElicitationRequiredError`})}constructor(e,t=`URL elicitation${e.length>1?`s`:``} required`){super(X.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},Xi=class extends Z{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UnsupportedProtocolVersionError`})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(X.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},Zi=class extends Z{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.MissingRequiredClientCapabilityError`})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(`, `)}`){super(X.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},Qi=0,$i=`private`,ea=[`tools/call`,`prompts/get`,`resources/read`];function ta(e,t){let n=t.resultType;if(n===void 0)return{...t,resultType:`complete`};if(n===`complete`||ea.includes(e))return t;throw new Z(X.InternalError,`Handler for ${e} returned resultType '${String(n)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function na(e,t){let n=Gi(t);if(t.resultType!==`complete`||!Ui(e))return n===void 0?t:sa(t);let r=t,i=Ki(r.ttlMs)?r.ttlMs:aa(n),a=qi(r.cacheScope)?r.cacheScope:oa(n),o={...r,ttlMs:i,cacheScope:a};return delete o[Wi],o}function ra(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function ia(e,t){if(t===void 0)return e;let n=e._meta;return n===void 0?{...e,_meta:{[Le]:t}}:!ra(n)||n[`io.modelcontextprotocol/serverInfo`]!==void 0?e:{...e,_meta:{...n,[Le]:t}}}function aa(e){return e!==void 0&&Ki(e.ttlMs)?e.ttlMs:Qi}function oa(e){return e!==void 0&&qi(e.cacheScope)?e.cacheScope:$i}function sa(e){let t={...e};return delete t[Wi],t}var ca=[`elicitation/create`,`sampling/createMessage`,`roots/list`],la;function ua(){if(la)return la;let e=Vi();return la={request:{"elicitation/create":T({method:w(`elicitation/create`),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":T({method:w(`sampling/createMessage`),params:e.CreateMessageRequestParamsSchema}),"roots/list":T({method:w(`roots/list`),params:k({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},la}function da(e){return ca.includes(e)}function fa(e){return da(e)?ua().request[e]:void 0}function pa(e){return da(e)?ua().response[e]:void 0}var ma={"tools/call":null,"tools/list":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"completion/complete":null,"server/discover":null,"subscriptions/listen":null},ha={"notifications/cancelled":null,"notifications/progress":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/subscriptions/acknowledged":null};function ga(e){return Object.prototype.hasOwnProperty.call(ma,e)}function _a(e){return Object.prototype.hasOwnProperty.call(ha,e)}function va(e){return Object.prototype.hasOwnProperty.call(ma,e)}function ya(e){return ga(e)?Vi().dispatchRequestSchemas[e]:void 0}function ba(e){return va(e)?Vi().dispatchResultSchemas[e]:void 0}function xa(e){return _a(e)?Vi().notificationSchemas2026[e]:void 0}Object.keys(ma),Object.keys(ha);function Sa(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ca(e,t){if(e===void 0)return{ok:!1,reason:`not-in-era`};let n=e.safeParse(t);return n.success?{ok:!0,value:n.data}:{ok:!1,reason:`invalid`,message:String(n.error)}}var wa={ok:!1,reason:`not-in-era`},Ta=[Fe,Re];function Ea(e,t){let n=t,r=!1,i=()=>(r||=(n={...n},!0),n),a=t.tools;e===`tools/list`&&Array.isArray(a)&&a.some(e=>Sa(e)&&`execution`in e)&&(i().tools=a.map(e=>{if(!Sa(e)||!(`execution`in e))return e;let t={...e};return delete t.execution,t}));let o=t.capabilities;if(Sa(o)&&`tasks`in o){let e={...o};delete e.tasks,i().capabilities=e}return n}var Da={era:`2026-07-28`,hasRequestMethod:ga,hasNotificationMethod:_a,hasInputRequestMethod:e=>fa(e)!==void 0,validateRequest:(e,t)=>Ca(ya(e),t),validateResult:(e,t)=>Ca(ba(e),t),validateNotification:(e,t)=>Ca(xa(e),t),validateInputRequest:(e,t)=>Ca(fa(e),t),validateInputResponse:(e,t)=>Ca(pa(e),t),samplingResultVariant:()=>wa,outboundEnvelope(e){return{[Fe]:e.protocolVersion,[Ie]:e.clientInfo,[Re]:e.clientCapabilities,...e.logLevel!==void 0&&{"io.modelcontextprotocol/logLevel":e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let n of Ta)n in e||t.push({key:n,problem:`missing`});let n=Vi().RequestMetaEnvelopeSchema.safeParse(e);if(!n.success)for(let e of n.error.issues){let n=e.path.map(String),r=n.length>0?n.join(`.`):`_meta`;n.length===1&&t.some(e=>e.key===r&&e.problem===`missing`)||t.push({key:r,problem:e.message})}return t},projectCallToolResult:e=>di(e),inputRequestSchema:fa,decodeResult(e,t){if(!Sa(t))return{kind:`invalid`,error:new Y(J.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let n=t.resultType;if(n===void 0)return{kind:`invalid`,error:new Y(J.InvalidResult,`Invalid result for ${e}: missing required resultType — servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:e,violation:`missing-resultType`})};if(typeof n!=`string`)return{kind:`invalid`,error:new Y(J.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:n})};if(n===`input_required`){let n=t.inputRequests,r=Sa(n)?n:{},i=t.requestState,a=t._meta===void 0?void 0:Vi().ResultMetaSchema.safeParse(t._meta),o=a?.success?a.data:void 0;return Object.keys(r).length===0&&typeof i!=`string`?{kind:`invalid`,error:new Y(J.InvalidResult,`Invalid result for ${e}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:e,violation:`input-required-missing-both`})}:{kind:`input_required`,inputRequests:r,...typeof i==`string`&&{requestState:i},...o!==void 0&&{_meta:o}}}if(n!==`complete`)return{kind:`invalid`,error:new Y(J.UnsupportedResultType,`Unsupported result type '${n}' for ${e}`,{resultType:n,method:e})};let r=ka(),i=Object.hasOwn(r,e)?r[e]:void 0;if(i!==void 0){let n=i.safeParse(t);if(!n.success)return{kind:`invalid`,error:new Y(J.InvalidResult,`Invalid result for ${e}: ${n.error}`,{method:e})}}let a={...t};return delete a.resultType,{kind:`complete`,result:a}},encodeResult(e,t,n){return ia(na(e,ta(e,Ea(e,t))),n)},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope(e){if(e.envelope===void 0)return`Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)`;let t=Vi().RequestMetaEnvelopeSchema.safeParse(e.envelope);if(!t.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${t.error.issues.map(e=>e.message).join(`; `)}`}},Oa;function ka(){if(Oa)return Oa;let e=Vi();return Oa={"tools/call":e.CallToolResultSchema,"tools/list":e.ListToolsResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"completion/complete":e.CompleteResultSchema,"server/discover":e.DiscoverResultSchema},Oa}var Aa=`2026-07-28`;function ja(e){return e!==void 0&&ci(e)?Da:Ri}function Ma(e){return e.revision===void 0?e.era===`modern`?Da.era:Ri.era:ja(e.revision).era}function Na(e){return Ia.some(t=>t.hasRequestMethod(e))}function Pa(e){return Ia.some(t=>t.hasNotificationMethod(e))}function Fa(e){return e===`tasks/get`||e===`tasks/cancel`}var Ia=[Ri,Da],La=Ce({AnnotationsSchema:()=>Nt,AudioContentSchema:()=>ln,BaseMetadataSchema:()=>ct,BaseRequestParamsSchema:()=>L,BlobResourceContentsSchema:()=>jt,BooleanSchemaSchema:()=>Wn,CallToolRequestParamsSchema:()=>wn,CallToolRequestSchema:()=>Tn,CallToolResultSchema:()=>Sn,CancelTaskRequestSchema:()=>Ar,CancelTaskResultSchema:()=>jr,CancelledNotificationParamsSchema:()=>it,CancelledNotificationSchema:()=>at,ClientCapabilitiesSchema:()=>pt,ClientNotificationSchema:()=>Nr,ClientRequestSchema:()=>Mr,ClientResultSchema:()=>Pr,ClientTasksCapabilitySchema:()=>dt,CompatibilityCallToolResultSchema:()=>Cn,CompleteRequestParamsSchema:()=>dr,CompleteRequestSchema:()=>fr,CompleteResultSchema:()=>pr,ContentBlockSchema:()=>pn,CreateMessageRequestParamsSchema:()=>Bn,CreateMessageRequestSchema:()=>Vn,CreateMessageResultSchema:()=>Hn,CreateMessageResultWithToolsSchema:()=>Un,CreateTaskResultSchema:()=>xr,CursorSchema:()=>We,DiscoverRequestSchema:()=>yt,DiscoverResultSchema:()=>bt,ElicitRequestFormParamsSchema:()=>nr,ElicitRequestParamsSchema:()=>ir,ElicitRequestSchema:()=>ar,ElicitRequestURLParamsSchema:()=>rr,ElicitResultSchema:()=>cr,ElicitationCompleteNotificationParamsSchema:()=>or,ElicitationCompleteNotificationSchema:()=>sr,EmbeddedResourceSchema:()=>dn,EmptyResultSchema:()=>rt,EnumSchemaSchema:()=>er,GetPromptRequestParamsSchema:()=>on,GetPromptRequestSchema:()=>sn,GetPromptResultSchema:()=>hn,GetTaskPayloadRequestSchema:()=>Er,GetTaskPayloadResultSchema:()=>Dr,GetTaskRequestSchema:()=>wr,GetTaskResultSchema:()=>Tr,IconSchema:()=>ot,IconsSchema:()=>st,ImageContentSchema:()=>K,ImplementationSchema:()=>H,InitializeRequestParamsSchema:()=>mt,InitializeRequestSchema:()=>ht,InitializeResultSchema:()=>_t,InitializedNotificationSchema:()=>vt,JSONArraySchema:()=>He,JSONObjectSchema:()=>I,JSONRPCErrorResponseSchema:()=>et,JSONRPCMessageSchema:()=>tt,JSONRPCNotificationSchema:()=>Qe,JSONRPCRequestSchema:()=>Ze,JSONRPCResponseSchema:()=>nt,JSONRPCResultResponseSchema:()=>$e,JSONValueSchema:()=>Ve,LegacyTitledEnumSchemaSchema:()=>Yn,ListChangedOptionsBaseSchema:()=>Dn,ListPromptsRequestSchema:()=>rn,ListPromptsResultSchema:()=>an,ListResourceTemplatesRequestSchema:()=>U,ListResourceTemplatesResultSchema:()=>W,ListResourcesRequestSchema:()=>It,ListResourcesResultSchema:()=>Lt,ListRootsRequestSchema:()=>hr,ListRootsResultSchema:()=>gr,ListTasksRequestSchema:()=>Or,ListTasksResultSchema:()=>kr,ListToolsRequestSchema:()=>bn,ListToolsResultSchema:()=>xn,LoggingLevelSchema:()=>On,LoggingMessageNotificationParamsSchema:()=>jn,LoggingMessageNotificationSchema:()=>Mn,ModelHintSchema:()=>Nn,ModelPreferencesSchema:()=>Pn,MultiSelectEnumSchemaSchema:()=>$n,NotificationSchema:()=>B,NotificationsParamsSchema:()=>z,NumberSchemaSchema:()=>Kn,PaginatedRequestParamsSchema:()=>Tt,PaginatedRequestSchema:()=>Et,PaginatedResultSchema:()=>Dt,PingRequestSchema:()=>xt,PrimitiveSchemaDefinitionSchema:()=>tr,ProgressNotificationParamsSchema:()=>Ct,ProgressNotificationSchema:()=>wt,ProgressSchema:()=>St,ProgressTokenSchema:()=>Ue,PromptArgumentSchema:()=>G,PromptListChangedNotificationSchema:()=>gn,PromptMessageSchema:()=>mn,PromptReferenceSchema:()=>ur,PromptSchema:()=>nn,ReadResourceRequestParamsSchema:()=>zt,ReadResourceRequestSchema:()=>Bt,ReadResourceResultSchema:()=>Vt,RelatedTaskMetadataSchema:()=>Ke,RequestIdSchema:()=>Xe,RequestMetaSchema:()=>qe,RequestSchema:()=>R,ResourceContentsSchema:()=>Ot,ResourceLinkSchema:()=>fn,ResourceListChangedNotificationSchema:()=>Ht,ResourceRequestParamsSchema:()=>Rt,ResourceSchema:()=>Pt,ResourceTemplateReferenceSchema:()=>lr,ResourceTemplateSchema:()=>Ft,ResourceUpdatedNotificationParamsSchema:()=>en,ResourceUpdatedNotificationSchema:()=>tn,ResultMetaObjectSchema:()=>Ye,ResultSchema:()=>V,RoleSchema:()=>Mt,RootSchema:()=>mr,RootsListChangedNotificationSchema:()=>_r,SamplingContentSchema:()=>Ln,SamplingMessageContentBlockSchema:()=>Rn,SamplingMessageSchema:()=>zn,ServerCapabilitiesSchema:()=>gt,ServerNotificationSchema:()=>Ir,ServerRequestSchema:()=>Fr,ServerResultSchema:()=>Lr,ServerTasksCapabilitySchema:()=>ft,SetLevelRequestParamsSchema:()=>kn,SetLevelRequestSchema:()=>An,SingleSelectEnumSchemaSchema:()=>Xn,StringSchemaSchema:()=>Gn,SubscribeRequestParamsSchema:()=>Ut,SubscribeRequestSchema:()=>Wt,SubscriptionFilterSchema:()=>qt,SubscriptionsAcknowledgedNotificationParamsSchema:()=>Xt,SubscriptionsAcknowledgedNotificationSchema:()=>Zt,SubscriptionsListenRequestParamsSchema:()=>Jt,SubscriptionsListenRequestSchema:()=>Yt,SubscriptionsListenResultMetaSchema:()=>Qt,SubscriptionsListenResultSchema:()=>$t,TaskAugmentedRequestParamsSchema:()=>Je,TaskCreationParamsSchema:()=>vr,TaskMetadataSchema:()=>Ge,TaskSchema:()=>br,TaskStatusNotificationParamsSchema:()=>Sr,TaskStatusNotificationSchema:()=>Cr,TaskStatusSchema:()=>yr,TextContentSchema:()=>cn,TextResourceContentsSchema:()=>kt,TitledMultiSelectEnumSchemaSchema:()=>Qn,TitledSingleSelectEnumSchemaSchema:()=>Jn,ToolAnnotationsSchema:()=>_n,ToolChoiceSchema:()=>Fn,ToolExecutionSchema:()=>vn,ToolListChangedNotificationSchema:()=>En,ToolResultContentSchema:()=>In,ToolSchema:()=>yn,ToolUseContentSchema:()=>un,UnsubscribeRequestParamsSchema:()=>Gt,UnsubscribeRequestSchema:()=>Kt,UntitledMultiSelectEnumSchemaSchema:()=>Zn,UntitledSingleSelectEnumSchemaSchema:()=>qn}),Ra=e=>Ze.safeParse(e).success,za=e=>Qe.safeParse(e).success,Ba=e=>$e.safeParse(e).success,Va=e=>et.safeParse(e).success,Ha=e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&e.resultType===`input_required`,Ua=e=>ht.safeParse(e).success,Wa=e=>vt.safeParse(e).success,Ga=`Mcp-Param-`,Ka=`x-mcp-header`,qa=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,Ja=new Set([`string`,`integer`,`boolean`,`number`]);function Ya(e){let t=[],n=new Map,r=(e,i,a)=>{if(typeof e!=`object`||!e)return;let o=e;if(Ka in o){if(!a||i.length===0)return`${Qa(i)}: x-mcp-header is only permitted on properties statically reachable via a chain of 'properties' keys (not under items, additionalProperties, oneOf/anyOf/allOf/not, if/then/else, or $ref)`;let e=o[Ka];if(typeof e!=`string`||e.length===0)return`${Qa(i)}: x-mcp-header MUST be a non-empty string`;if(!qa.test(e))return`${Qa(i)}: x-mcp-header '${e}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;let r=typeof o.type==`string`?o.type:void 0;if(r===void 0||!Ja.has(r))return`${Qa(i)}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${r??``}`;let s=e.toLowerCase(),c=n.get(s);if(c!==void 0)return`x-mcp-header '${e}' is not case-insensitively unique (also declared as '${c}')`;n.set(s,e),t.push({path:i,headerName:e,type:r})}let s=o.properties;if(typeof s==`object`&&s)for(let[e,t]of Object.entries(s)){let n=r(t,[...i,e],a);if(n!==void 0)return n}for(let e of Xa){let t=o[e];if(t===void 0)continue;let n=Array.isArray(t)?t:typeof t==`object`&&t&&Za.has(e)?Object.values(t):[t];for(let t of n){let n=r(t,[...i,`<${e}>`],!1);if(n!==void 0)return n}}},i=r(e,[],!0);return i===void 0?{valid:!0,declarations:t}:{valid:!1,reason:i}}var Xa=[`items`,`prefixItems`,`contains`,`additionalProperties`,`unevaluatedProperties`,`unevaluatedItems`,`propertyNames`,`patternProperties`,`dependentSchemas`,`oneOf`,`anyOf`,`allOf`,`not`,`if`,`then`,`else`,`$defs`,`definitions`],Za=new Set([`patternProperties`,`dependentSchemas`,`$defs`,`definitions`]);function Qa(e){return e.length===0?``:e.join(`.`)}var $a=`=?base64?`,eo=`?=`;function to(e){if(typeof e==`string`)return e;if(typeof e==`boolean`)return e?`true`:`false`;if(typeof e==`number`)return!Number.isFinite(e)||Number.isInteger(e)&&!Number.isSafeInteger(e)?void 0:String(e)}function no(e){if(e.length===0||e.startsWith($a)&&e.endsWith(eo)||e!==e.trim())return!0;for(let t=0;t=32&&n<=126))return!0}return!1}function ro(e){let t=new TextEncoder().encode(e),n=``;for(let e of t)n+=String.fromCodePoint(e);return btoa(n)}function io(e){return no(e)?`${$a}${ro(e)}${eo}`:e}function ao(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n)return;n=n[e]}return n}function oo(e,t){let n={};for(let r of e){let e=ao(t,r.path);if(e==null)continue;let i=to(e);i!==void 0&&(n[`${Ga}${r.headerName}`]=io(i))}return n}X.InvalidRequest,X.UnsupportedProtocolVersion,X.InvalidParams,X.MethodNotFound,X.InvalidParams,X.MissingRequiredClientCapability,X.ParseError,X.InvalidRequest,X.MethodNotFound,X.UnsupportedProtocolVersion,X.MissingRequiredClientCapability;var so={"tools/call":`name`,"prompts/get":`name`,"resources/read":`uri`,"tasks/get":`taskId`,"tasks/update":`taskId`,"tasks/cancel":`taskId`};function co(e,t){let n=Object.hasOwn(so,e)?so[e]:void 0;if(n===void 0)return;let r=lo(t)?t[n]:void 0;return{field:n,value:typeof r==`string`?r:void 0}}function lo(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function uo(e,t){return le(e,t)}function fo(e){return new Set(e.flatMap(e=>Object.keys(e.shape)))}function po(e){if(e==null)return!1;let t=typeof e;return t!==`object`&&t!==`function`||!(`~standard`in e)?!1:typeof e[`~standard`]?.validate==`function`}var mo=!1,ho=`draft-2020-12`;function go(e,t=`input`){let n=e[`~standard`],r;if(n.jsonSchema)r=n.jsonSchema[t]({target:ho});else if(n.vendor===`zod`){if(!(`_zod`in e))throw Error(`Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().`);mo||(mo=!0,console.warn("[mcp-sdk] Your zod version does not implement `~standard.jsonSchema` (added in zod 4.2.0). Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.")),r=g(e,{target:ho,io:t})}else throw Error(`Schema library "${n.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(t===`output`)return r.type===void 0&&_o(r)?{type:`object`,...r}:r;if(r.type!==void 0&&r.type!==`object`)throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(r.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:`object`,...r}}function _o(e){if(`properties`in e||`patternProperties`in e||`additionalProperties`in e||`required`in e)return!0;for(let t of[`oneOf`,`anyOf`,`allOf`]){let n=e[t];if(Array.isArray(n)&&n.length>0)return n.every(e=>typeof e==`object`&&!!e&&(e.type===`object`||_o(e)))}return!1}function vo(e){return e.path?.length?`${e.path.map(e=>String(typeof e==`object`?e.key:e)).join(`.`)}: ${e.message}`:e.message}async function yo(e,t){let n=await e[`~standard`].validate(t);return n.issues&&n.issues.length>0?{success:!1,error:n.issues.map(e=>vo(e)).join(`, `)}:{success:!0,data:n.value}}function bo(e){let t=g(e,{target:ho,io:`input`});return typeof t.pattern==`string`?t.pattern:void 0}var xo=/\\\.\\d\{(\d+)\}/;function So(e){let t=xo.exec(e),n=[void 0,-1,0];return t&&n.push(Number(t[1])),[!1,!0].flatMap(e=>[!1,!0].flatMap(t=>n.map(n=>pe({local:e,offset:t,precision:n}))))}function Co(e,t){let n;switch(e){case`email`:n=[re()];break;case`uri`:n=[d()];break;case`date`:n=[me()];break;case`date-time`:n=So(t)}return new Set(n.map(e=>bo(e)).filter(e=>e!==void 0))}function wo(e,t,n){return n!==`zod`||Co(e,t).has(t)}function To(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Eo(e){try{return go(e,`input`)}catch(e){let t=e instanceof Error?e.message:String(e);throw new Z(X.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${t}`)}}var Do=new Set([`$comment`,`deprecated`,`description`,`examples`,`readOnly`,`title`,`writeOnly`]);function Oo(e){return Do.has(e)||e.startsWith(`x-`)}var ko=new Set([`$schema`,...Object.keys(nr.shape.requestedSchema.shape)]),Ao={string:fo([Gn,qn,Jn,Yn]),number:fo([Kn]),integer:fo([Kn]),boolean:fo([Wn]),array:fo([Zn,Qn])},jo=new Set(Gn.shape.format.unwrap().options);function Mo(e,t,n,r){if(!To(e))return e;let i=typeof e.type==`string`&&Object.hasOwn(Ao,e.type)?Ao[e.type]:void 0;if(i===void 0)return e;let a={};for(let[o,s]of Object.entries(e))i.has(o)||Oo(o)?a[o]=s:o===`pattern`&&e.type===`string`&&typeof e.format==`string`?jo.has(e.format)?(typeof s!=`string`||!wo(e.format,s,n))&&r.push(`${t}.${o}`):a[o]=s:r.push(`${t}.${o}`);return a}function No(e,t){let n={},r=[];for(let[i,a]of Object.entries(e))i===`properties`&&To(a)?n[i]=Object.fromEntries(Object.entries(a).map(([e,n])=>[e,Mo(n,`properties.${e}`,t,r)])):ko.has(i)?n[i]=a:Oo(i)||r.push(i);if(r.length>0)throw new Z(X.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${r.join(`, `)}`);return n}function Po(e,t){if(!To(e.properties))return t;let n=Object.entries(e.properties).filter(([,e])=>!uo(tr,e).success).map(([e])=>`properties.${e}`);return n.length>0?n.join(`, `):t}function Fo(e,t,n=``){return Array.isArray(e)&&Array.isArray(t)?e.flatMap((e,r)=>Fo(e,t[r],`${n}[${r}]`)):!To(e)||!To(t)?[]:Object.entries(e).flatMap(([e,r])=>{let i=n?`${n}.${e}`:e;return Object.prototype.hasOwnProperty.call(t,e)?Fo(r,t[e],i):Oo(e)?[]:[i]})}function Io(e){if(!po(e.requestedSchema))return{...e,mode:`form`,requestedSchema:e.requestedSchema};let t=e.requestedSchema[`~standard`].vendor,n=No(Eo(e.requestedSchema),t),r=uo(nr.shape.requestedSchema,n);if(!r.success)throw new Z(X.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${Po(n,r.error.message)}`);let i=Fo(n,r.data);if(i.length>0)throw new Z(X.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${i.join(`, `)}`);let a=(r.data.required??[]).filter(e=>!Object.prototype.hasOwnProperty.call(r.data.properties,e));if(a.length>0)throw new Z(X.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${a.join(`, `)}`);return{...e,mode:`form`,requestedSchema:r.data}}function Lo(e){let t=e.inputRequests!==void 0&&Object.keys(e.inputRequests).length>0,n=typeof e.requestState==`string`;if(!t&&!n)throw TypeError(`inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)`);return{resultType:`input_required`,...e.inputRequests!==void 0&&{inputRequests:e.inputRequests},...e.requestState!==void 0&&{requestState:e.requestState}}}Object.assign(Lo,{elicit(e){try{return{method:`elicitation/create`,params:Io(e)}}catch(e){throw e instanceof Z?TypeError(e.message,{cause:e}):e}},elicitUrl(e){return{method:`elicitation/create`,params:{...e,mode:`url`}}},createMessage(e){return{method:`sampling/createMessage`,params:e}},listRoots(){return{method:`roots/list`}}});var Ro=!0,zo=10,Bo=250;function Vo(e){return{autoFulfill:e?.autoFulfill??Ro,maxRounds:e?.maxRounds??zo}}function Ho(e,t,n){let r=t!==void 0&&Object.keys(t).length>0;return!r&&n===void 0?e:{...e,...r&&{inputResponses:t},...n!==void 0&&{requestState:n}}}function Uo(e,t){return`Multi-round-trip request '${e}' still required input after ${t} rounds (inputRequired.maxRounds)`}function Wo(e,t){return new Promise((n,r)=>{if(t?.aborted){r(t.reason instanceof Y?t.reason:new Y(J.RequestTimeout,String(t.reason)));return}let i=setTimeout(()=>{t?.removeEventListener(`abort`,a),n()},e),a=()=>{clearTimeout(i),r(t?.reason instanceof Y?t.reason:new Y(J.RequestTimeout,String(t?.reason)))};t?.addEventListener(`abort`,a,{once:!0})})}function Go(e){let t=new AbortController,n=()=>t.abort(e?.reason);return e?.addEventListener(`abort`,n,{once:!0}),e?.aborted&&t.abort(e.reason),{signal:t.signal,abort:e=>t.abort(e),dispose:()=>e?.removeEventListener(`abort`,n)}}async function Ko(e){let{config:t,method:n,originalParams:r,requestOptions:i,hooks:a,signal:o}=e,s=e.flowStartedAt??Date.now(),c=e.firstPayload,l=0;for(;;){if(l+=1,l>t.maxRounds)throw new Y(J.InputRequiredRoundsExceeded,Uo(n,t.maxRounds),{rounds:t.maxRounds,lastResult:{inputRequests:c.inputRequests,...c.requestState!==void 0&&{requestState:c.requestState}}});i.onprogress?.({progress:l,message:`Fulfilling input required by '${n}' (round ${l})`});let e=Object.entries(c.inputRequests??{}),u;if(e.length>0){let t=Go(o);try{let n=await Promise.all(e.map(async([e,n])=>{try{return[e,await a.dispatchInputRequest(e,n,t.signal)]}catch(e){throw t.abort(e),e}}));u=Object.fromEntries(n)}finally{t.dispose()}}else await Wo(Bo,o);let d={...i.timeout!==void 0&&{timeout:i.timeout}};if(i.maxTotalTimeout!==void 0){let e=Date.now()-s,t=i.maxTotalTimeout-e;if(t<=0)throw new Y(J.RequestTimeout,`Maximum total timeout exceeded`,{maxTotalTimeout:i.maxTotalTimeout,totalElapsed:e});d.maxTotalTimeout=t}let f=await a.retry(Ho(r,u,c.requestState),d);if(Ha(f)){c={inputRequests:f.inputRequests??{},...f.requestState!==void 0&&{requestState:f.requestState}};continue}return f}}var qo=`AnnotationsSchema.AudioContentSchema.BaseMetadataSchema.BlobResourceContentsSchema.BooleanSchemaSchema.CallToolRequestSchema.CallToolRequestParamsSchema.CallToolResultSchema.CancelledNotificationSchema.CancelledNotificationParamsSchema.CancelTaskRequestSchema.CancelTaskResultSchema.ClientCapabilitiesSchema.ClientNotificationSchema.ClientRequestSchema.ClientResultSchema.CompatibilityCallToolResultSchema.CompleteRequestSchema.CompleteRequestParamsSchema.CompleteResultSchema.ContentBlockSchema.CreateMessageRequestSchema.CreateMessageRequestParamsSchema.CreateMessageResultSchema.CreateMessageResultWithToolsSchema.CreateTaskResultSchema.CursorSchema.DiscoverRequestSchema.DiscoverResultSchema.ElicitationCompleteNotificationSchema.ElicitationCompleteNotificationParamsSchema.ElicitRequestSchema.ElicitRequestFormParamsSchema.ElicitRequestParamsSchema.ElicitRequestURLParamsSchema.ElicitResultSchema.EmbeddedResourceSchema.EmptyResultSchema.EnumSchemaSchema.GetPromptRequestSchema.GetPromptRequestParamsSchema.GetPromptResultSchema.GetTaskPayloadRequestSchema.GetTaskPayloadResultSchema.GetTaskRequestSchema.GetTaskResultSchema.IconSchema.IconsSchema.ImageContentSchema.ImplementationSchema.InitializedNotificationSchema.InitializeRequestSchema.InitializeRequestParamsSchema.InitializeResultSchema.JSONArraySchema.JSONObjectSchema.JSONRPCErrorResponseSchema.JSONRPCMessageSchema.JSONRPCNotificationSchema.JSONRPCRequestSchema.JSONRPCResponseSchema.JSONRPCResultResponseSchema.JSONValueSchema.LegacyTitledEnumSchemaSchema.ListPromptsRequestSchema.ListPromptsResultSchema.ListResourcesRequestSchema.ListResourcesResultSchema.ListResourceTemplatesRequestSchema.ListResourceTemplatesResultSchema.ListRootsRequestSchema.ListRootsResultSchema.ListTasksRequestSchema.ListTasksResultSchema.ListToolsRequestSchema.ListToolsResultSchema.LoggingLevelSchema.LoggingMessageNotificationSchema.LoggingMessageNotificationParamsSchema.ModelHintSchema.ModelPreferencesSchema.MultiSelectEnumSchemaSchema.NotificationSchema.NumberSchemaSchema.PaginatedRequestSchema.PaginatedRequestParamsSchema.PaginatedResultSchema.PingRequestSchema.PrimitiveSchemaDefinitionSchema.ProgressSchema.ProgressNotificationSchema.ProgressNotificationParamsSchema.ProgressTokenSchema.PromptSchema.PromptArgumentSchema.PromptListChangedNotificationSchema.PromptMessageSchema.PromptReferenceSchema.ReadResourceRequestSchema.ReadResourceRequestParamsSchema.ReadResourceResultSchema.RelatedTaskMetadataSchema.RequestSchema.RequestIdSchema.RequestMetaSchema.ResourceSchema.ResourceContentsSchema.ResourceLinkSchema.ResourceListChangedNotificationSchema.ResourceRequestParamsSchema.ResourceTemplateSchema.ResourceTemplateReferenceSchema.ResourceUpdatedNotificationSchema.ResourceUpdatedNotificationParamsSchema.ResultMetaObjectSchema.ResultSchema.RoleSchema.RootSchema.RootsListChangedNotificationSchema.SamplingContentSchema.SamplingMessageSchema.SamplingMessageContentBlockSchema.ServerCapabilitiesSchema.ServerNotificationSchema.ServerRequestSchema.ServerResultSchema.SetLevelRequestSchema.SetLevelRequestParamsSchema.SingleSelectEnumSchemaSchema.StringSchemaSchema.SubscribeRequestSchema.SubscribeRequestParamsSchema.SubscriptionFilterSchema.SubscriptionsAcknowledgedNotificationSchema.SubscriptionsAcknowledgedNotificationParamsSchema.SubscriptionsListenRequestSchema.SubscriptionsListenRequestParamsSchema.SubscriptionsListenResultSchema.SubscriptionsListenResultMetaSchema.TaskAugmentedRequestParamsSchema.TaskCreationParamsSchema.TaskMetadataSchema.TaskSchema.TaskStatusSchema.TaskStatusNotificationSchema.TaskStatusNotificationParamsSchema.TextContentSchema.TextResourceContentsSchema.TitledMultiSelectEnumSchemaSchema.TitledSingleSelectEnumSchemaSchema.ToolSchema.ToolAnnotationsSchema.ToolChoiceSchema.ToolExecutionSchema.ToolListChangedNotificationSchema.ToolResultContentSchema.ToolUseContentSchema.UnsubscribeRequestSchema.UnsubscribeRequestParamsSchema.UntitledMultiSelectEnumSchemaSchema.UntitledSingleSelectEnumSchemaSchema`.split(`.`),Jo={IdJagTokenExchangeResponseSchema:Ur,OAuthClientInformationFullSchema:Jr,OAuthClientInformationSchema:qr,OAuthClientMetadataSchema:Kr,OAuthClientRegistrationErrorSchema:Yr,OAuthErrorResponseSchema:Wr,OAuthMetadataSchema:zr,OAuthProtectedResourceMetadataSchema:Rr,OAuthTokenRevocationRequestSchema:Xr,OAuthTokensSchema:Hr,OpenIdProviderDiscoveryMetadataSchema:Vr,OpenIdProviderMetadataSchema:Br},Yo={},Xo={};function Zo(e,t){let n=e.slice(0,-6);Yo[n]=t,Xo[n]=e=>t.safeParse(e).success}for(let e of qo)Zo(e,La[e]);for(let[e,t]of Object.entries(Jo))Zo(e,t);Object.freeze(Yo);var Qo=Object.freeze(Xo);function $o(e){switch(e){case`initialize`:case`notifications/initialized`:return ja(void 0);case`server/discover`:return ja(Aa);default:return}}var es=[Fe,Ie,Re,Be],ts=[`inputResponses`,`requestState`];function ns(e,t){let n=e.params;if(!ss(n))return{message:e,lifted:{}};let r=n._meta,i=ss(r)?es.filter(e=>e in r):[],a=t===`request`?ts.filter(e=>e in n):[];if(i.length===0&&a.length===0)return{message:e,lifted:{}};let o={},s={...n};if(i.length>0&&ss(r)){let e={},t={...r};for(let n of i)e[n]=r[n],delete t[n];o.envelope=e,Object.keys(t).length>0?s._meta=t:delete s._meta}for(let e of a)e===`inputResponses`&&(o.inputResponses=s[e]),e===`requestState`&&(o.requestState=s[e]),delete s[e];return{message:{...e,params:s},lifted:o}}function rs(e,t){let n=e.validateResult(t,void 0);if(n.ok||n.reason!==`not-in-era`)return{"~standard":{version:1,vendor:`mcp-wire-codec`,validate(n){let r=e.validateResult(t,n);return r.ok?{value:r.value}:{issues:[{message:r.reason===`invalid`?r.message:`not-in-era: ${t}`}]}}}}}function is(e){return()=>e}var as=is(void 0),os=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_customSchemaRequestMethods=new Set;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??Ne,this.setNotificationHandler(`notifications/cancelled`,e=>{this._oncancel(e)}),this.setNotificationHandler(`notifications/progress`,e=>{this._onprogress(e)}),this.setRequestHandler(`ping`,e=>({}))}_shouldDropInbound(e){}_outboundMetaEnvelope(){}_envelopeOutbound(e){let t=this._outboundMetaEnvelope();if(t===void 0)return e;let n=e.params??{};return{...e,params:{...n,_meta:{...t,...n._meta}}}}_resolveNonCompleteResult(e,t){return Promise.reject(new Y(J.UnsupportedResultType,`Unsupported result type '${e.kind}' for ${t.request.method}`,{resultType:e.kind,method:t.request.method}))}_getRequestHandler(e){return this._requestHandlers.get(e)}async _oncancel(e){e.params.requestId!==void 0&&this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,n,r,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:r})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let n=Date.now()-t.startTime;if(t.maxTotalTimeout&&n>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new Y(J.RequestTimeout,`Maximum total timeout exceeded`,{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:n});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{try{t?.()}finally{this._onclose()}};let n=this.transport?.onerror;this._transport.onerror=e=>{n?.(e),this._onerror(e)};let r=this._transport?.onmessage;this._transport.onmessage=(e,t)=>{r?.(e,t),Ba(e)||Va(e)?this._onresponse(e):Ra(e)?this._onrequest(e,t):za(e)?this._onnotification(e,t):this._onerror(Error(`Unknown message type: ${JSON.stringify(e)}`))},e.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(let e of this._timeoutInfo.values())clearTimeout(e.timeoutId);this._timeoutInfo.clear();let t=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let n=new Y(J.ConnectionClosed,`Connection closed`);this._transport=void 0;try{this.onclose?.()}finally{for(let t of e.values())t(n);for(let e of t.values())e.abort(n)}}_onerror(e){this.onerror?.(e)}_onnotification(e,t){let{message:n}=ns(e,`notification`),r=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)===`drop`)return;if(t?.classification!==void 0){let e=Ma(t.classification);if(e!==r.era){this._onerror(Error(`Era mismatch on inbound notification '${n.method}': classified as ${e} but this instance serves ${r.era}`));return}}if(Pa(n.method)&&!r.hasNotificationMethod(n.method))return;let i=this._notificationHandlers.get(n.method),a=this.fallbackNotificationHandler;(i!==void 0||a!==void 0)&&Promise.resolve().then(()=>i===void 0?a(n):i(n,r)).catch(e=>this._onerror(Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){let{message:n,lifted:r}=ns(e,`request`),i=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)===`drop`){this._onerror(Error(`Dropped inbound request '${e.method}': not servable on this connection's protocol era`));return}let a=this._transport,o=(e,t,r)=>{let i={jsonrpc:`2.0`,id:n.id,error:{code:e,message:t,...r!==void 0&&{data:r}}};a?.send(i).catch(e=>this._onerror(Error(`Failed to send an error response: ${e}`)))};if(t?.classification!==void 0){let e=Ma(t.classification);if(e!==i.era){this._onerror(Error(`Era mismatch on inbound request '${n.method}': classified as ${e} but this instance serves ${i.era}`));let r=t.classification.revision??e;o(X.UnsupportedProtocolVersion,`Unsupported protocol version: ${r}`,{supported:this._supportedProtocolVersions,requested:r});return}}if(Na(n.method)&&!i.hasRequestMethod(n.method)&&!(Fa(n.method)&&this._customSchemaRequestMethods.has(n.method))){o(X.MethodNotFound,`Method not found`);return}let s=this._requestHandlers.get(n.method)??this.fallbackRequestHandler;if(s===void 0){o(X.MethodNotFound,`Method not found`);return}let c=i.checkInboundEnvelope(r);if(c!==void 0){o(X.InvalidParams,c);return}let l=(e,t)=>this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,{...t,relatedRequestId:n.id}),u=(e,t,r)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(e.method),e,t,{...r,relatedRequestId:n.id}),d=new AbortController;this._requestHandlerAbortControllers.set(n.id,d);let f=r.inputResponses===void 0?void 0:us(r.inputResponses),p={sessionId:a?.sessionId,mcpReq:{id:n.id,method:n.method,_meta:n.params?._meta,...r.envelope!==void 0&&{envelope:r.envelope},...f!==void 0&&{inputResponses:f.accepted},...f!==void 0&&f.droppedKeys.length>0&&{droppedInputResponseKeys:f.droppedKeys},requestState:r.requestState===void 0?as:is(r.requestState),signal:d.signal,send:((e,t,n)=>{let r=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(r,e.method),po(t))return u(e,t,n);let i=rs(r,e.method);if(i===void 0)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return u(e,i,t)}),notify:l},http:t?.authInfo?{authInfo:t.authInfo}:void 0},m=this.buildContext(p,t);Promise.resolve().then(()=>s(n,m)).then(async e=>{if(d.signal.aborted)return;let t;try{t=i.encodeResult(n.method,e,this._outboundServerInfo())}catch(e){this._onerror(Error(`Failed to encode result for ${n.method}: ${e}`)),o(X.InternalError,`Internal error`);return}let r={result:t,jsonrpc:`2.0`,id:n.id};await a?.send(r)},async e=>{if(d.signal.aborted)return;let t=Number.isSafeInteger(e.code)?e.code:X.InternalError,r={jsonrpc:`2.0`,id:n.id,error:{code:i.encodeErrorCode(t),message:e.message??`Internal error`,...e.data!==void 0&&{data:e.data}}};await a?.send(r)}).catch(e=>this._onerror(Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.get(n.id)===d&&this._requestHandlerAbortControllers.delete(n.id)})}_onprogress(e){let{progressToken:t,...n}=e.params,r=Number(t),i=this._progressHandlers.get(r);if(!i){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let a=this._responseHandlers.get(r),o=this._timeoutInfo.get(r);if(o&&a&&o.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(e){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),a(e);return}i(n)}_onresponse(e){let t=Number(e.id),n=this._responseHandlers.get(t);if(n===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),Ba(e)?n(e):n(Z.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(e,t,n){let r=this._resolveOutboundCodec(e.method);if(po(t))return Fa(e.method)||this._assertOutboundRequestInEra(r,e.method),this._requestWithSchemaViaCodec(r,e,t,n);this._assertOutboundRequestInEra(r,e.method);let i=rs(r,e.method);if(i===void 0)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(r,e,i,t)}_negotiatedWireCodec(){return ja(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=$o(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(Na(t)&&!e.hasRequestMethod(t))throw new Y(J.MethodNotSupportedByProtocolVersion,`Method '${t}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t,era:e.era})}_requestWithSchema(e,t,n){let r=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(r,e.method),this._requestWithSchemaViaCodec(r,e,t,n)}_requestWithSchemaViaCodec(e,t,n,r){let{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o,headers:s}=r??{},c=Date.now(),l,u;return new Promise((d,f)=>{let p=e=>{f(e)};if(!this._transport){p(Error(`Not connected`));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(e){p(e);return}if(r?.signal?.aborted){let e=r.signal.reason;throw e instanceof Y?e:new Y(J.RequestTimeout,String(e))}let m=e.era===`2026-07-28`&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,h=this._requestMessageId++;u=h;let g={...t,jsonrpc:`2.0`,id:h};r?.onprogress&&(this._progressHandlers.set(h,r.onprogress),g.params={...t.params,_meta:{...t.params?._meta,progressToken:h}});let _=this._envelopeOutbound(g),v=!1,y=e=>{v||(this._progressHandlers.delete(h),m===void 0?t.method!==`initialize`&&this._transport?.send(this._envelopeOutbound({jsonrpc:`2.0`,method:`notifications/cancelled`,params:{requestId:h,reason:String(e)}}),{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o}).catch(e=>this._onerror(Error(`Failed to send cancellation: ${e}`))):m.abort(),f(e instanceof Y?e:new Y(J.RequestTimeout,String(e))))};this._responseHandlers.set(h,i=>{if(r?.signal?.aborted)return;if(v=!0,i instanceof Error)return f(i);let a;try{a=e.decodeResult(t.method,i.result)}catch(e){return f(e instanceof Error?e:Error(String(e)))}if(a.kind===`invalid`)return f(a.error);if(a.kind===`input_required`){if(r?.allowInputRequired===!0)return d(gs(a));let i={codec:e,request:t,resultSchema:n,options:r,flowStartedAt:c,retry:(r,i)=>this._requestWithSchemaViaCodec(e,r===void 0?{method:t.method}:{method:t.method,params:r},n,i)};return d(this._resolveNonCompleteResult(a,i))}let o=a.result;yo(n,o).then(e=>{e.success?d(e.data):f(new Y(J.InvalidResult,`Invalid result for ${t.method}: ${e.error}`))},f)}),l=()=>y(r?.signal?.reason),r?.signal?.addEventListener(`abort`,l,{once:!0});let b=r?.timeout??6e4;this._setupTimeout(h,b,r?.maxTotalTimeout,()=>y(new Y(J.RequestTimeout,`Request timed out`,{timeout:b})),r?.resetTimeoutOnProgress??!1),this._transport.send(_,{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o,headers:s,requestSignal:m?.signal}).catch(e=>{this._progressHandlers.delete(h),f(e)})}).finally(()=>{l&&r?.signal?.removeEventListener(`abort`,l),u!==void 0&&(this._responseHandlers.delete(u),this._cleanupTimeout(u))})}async notification(e,t){return await this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,n){if(!this._transport)throw new Y(J.NotConnected,`Not connected`);if(Pa(t.method)&&!e.hasNotificationMethod(t.method))throw new Y(J.MethodNotSupportedByProtocolVersion,`Notification '${t.method}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t.method,era:e.era});this.assertNotificationCapability(t.method);let r=this._envelopeOutbound({jsonrpc:`2.0`,...t});if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&n?.relatedRequestId===void 0){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{this._pendingDebouncedNotifications.delete(t.method),this._transport&&this._transport?.send(r,n).catch(e=>this._onerror(e))});return}await this._transport.send(r,n)}setRequestHandler(e,t,n){this.assertRequestHandlerCapability(e);let r;if(typeof t==`function`){if(!Na(e))throw TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);r=(n,r)=>{let i=this._negotiatedWireCodec(),a=i.validateRequest(e,n);if(!a.ok&&a.reason===`not-in-era`&&(a=i.validateInputRequest(e,n)),!a.ok)throw a.reason===`not-in-era`?new Z(X.InternalError,`No wire schema for ${e} in the resolved era`):Error(a.message);return Promise.resolve(t(a.value,r))}}else if(n)r=async(r,i)=>{let a=await yo(t.params,{...r.params});if(!a.success)throw new Z(X.InvalidParams,`Invalid params for ${e}: ${a.error}`);return n(a.data,i)};else throw TypeError(`setRequestHandler: handler is required`);typeof t==`function`?this._customSchemaRequestMethods.delete(e):this._customSchemaRequestMethods.add(e),this._requestHandlers.set(e,this._wrapHandler(e,r))}_wrapHandler(e,t){return t}_outboundServerInfo(){}removeRequestHandler(e){this._requestHandlers.delete(e),this._customSchemaRequestMethods.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t,n){if(typeof t==`function`){if(!Pa(e))throw TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(n,r)=>{let i=r.validateNotification(e,n);if(!i.ok)throw i.reason===`not-in-era`?new Z(X.InternalError,`No wire schema for ${e} in the resolved era`):Error(i.message);return Promise.resolve(t(i.value))});return}if(!n)throw TypeError(`setNotificationHandler: handler is required`);this._notificationHandlers.set(e,async r=>{let i=await yo(t.params,{...r.params});if(!i.success)throw new Z(X.InvalidParams,`Invalid params for notification ${e}: ${i.error}`);await n(i.data,r)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function ss(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function cs(e,t){let n={...e};for(let e in t){let r=e,i=t[r];if(i===void 0)continue;let a=n[r];n[r]=ss(a)&&ss(i)?{...a,...i}:i}return n}function ls(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function us(e){let t={},n=[];if(!ls(e))return{accepted:t,droppedKeys:n};for(let[r,i]of Object.entries(e)){if(!ls(i)||`method`in i||`result`in i){n.push(r);continue}t[r]=i}return{accepted:t,droppedKeys:n}}function ds(e){throw new Y(J.SendFailed,`ctx.mcpReq.${e} is not available while fulfilling an embedded input request: the request is fulfilled locally and has no related peer request`)}function fs(e,t,n,r,i){return{sessionId:i,mcpReq:{id:e,method:t,_meta:n?._meta,requestState:is(void 0),signal:r,send:(()=>ds(`send`)),notify:()=>ds(`notify`)}}}async function ps(e,t,n,r,i){if(!ls(r)||typeof r.method!=`string`)throw new Y(J.InvalidResult,`Invalid input request '${n}': each inputRequests entry must be an embedded request object with a method`,{key:n});let a=r.method;if(!t.hasInputRequestMethod(a))throw new Y(J.InvalidResult,`Invalid input request '${n}': '${a}' is not an embedded request the ${t.era} revision defines (expected elicitation/create, sampling/createMessage, or roots/list)`,{key:n,method:a});let o=e.getRequestHandler(a);if(o===void 0)throw new Y(J.CapabilityNotSupported,`Cannot fulfil input request '${n}': no handler is registered for '${a}' on this client. Declare the corresponding capability and register a handler, or handle input_required results manually.`,{key:n,method:a});let s=ls(r.params)?r.params:void 0;return await o({jsonrpc:`2.0`,id:n,method:a,...s!==void 0&&{params:s}},e.buildContext(fs(n,a,s,i,e.sessionId)))}function ms(e,t){return{...e?.signal!==void 0&&{signal:e.signal},...e?.onprogress!==void 0&&{onprogress:e.onprogress},...e?.resetTimeoutOnProgress!==void 0&&{resetTimeoutOnProgress:e.resetTimeoutOnProgress},...e?.headers!==void 0&&{headers:e.headers},...t.timeout!==void 0&&{timeout:t.timeout},...t.maxTotalTimeout!==void 0&&{maxTotalTimeout:t.maxTotalTimeout},allowInputRequired:!0}}function hs(e,t,n,r){let{codec:i,request:a,options:o,flowStartedAt:s}=r,c={inputRequests:n.inputRequests,...n.requestState!==void 0&&{requestState:n.requestState}},l={dispatchInputRequest:(t,n,r)=>ps(e,i,t,n,r),retry:(e,t)=>r.retry(e,ms(o,t))};return Ko({config:t,method:a.method,originalParams:a.params,firstPayload:c,flowStartedAt:s,signal:o?.signal,requestOptions:{...o?.timeout!==void 0&&{timeout:o.timeout},...o?.maxTotalTimeout!==void 0&&{maxTotalTimeout:o.maxTotalTimeout},...o?.onprogress!==void 0&&{onprogress:o.onprogress}},hooks:l})}function gs(e){return{resultType:`input_required`,inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState},...e._meta!==void 0&&{_meta:e._meta}}}var _s=Te(Se((e=>{var t=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,n=/\\([\u000b\u0020-\u00ff])/g,r=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;e.parse=i;function i(e){if(!e)throw TypeError(`argument string is required`);var i=typeof e==`object`?a(e):e;if(typeof i!=`string`)throw TypeError(`argument string is required to be a string`);var s=i.indexOf(`;`),c=s===-1?i.trim():i.slice(0,s).trim();if(!r.test(c))throw TypeError(`invalid media type`);var l=new o(c.toLowerCase());if(s!==-1){var u,d,f;for(t.lastIndex=s;d=t.exec(i);){if(d.index!==s)throw TypeError(`invalid parameter format`);s+=d[0].length,u=d[1].toLowerCase(),f=d[2],f.charCodeAt(0)===34&&(f=f.slice(1,-1),f.indexOf(`\\`)!==-1&&(f=f.replace(n,`$1`))),l.parameters[u]=f}if(s!==i.length)throw TypeError(`invalid parameter format`)}return l}function a(e){var t;if(typeof e.getHeader==`function`?t=e.getHeader(`content-type`):typeof e.headers==`object`&&(t=e.headers&&e.headers[`content-type`]),typeof t!=`string`)throw TypeError(`content-type header is missing from object`);return t}function o(e){this.parameters=Object.create(null),this.type=e}}))(),1);function vs(e){if(e)try{return _s.parse(e).type}catch{let t=(e.split(`;`,1)[0]??``).trim().toLowerCase();return t===``||e.slice(t.length).includes(`,`)?void 0:t}}function ys(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}function bs(e=fetch,t){return t?async(n,r)=>e(n,{...t,...r,headers:r?.headers?{...ys(t.headers),...ys(r.headers)}:t.headers}):e}var xs=new Set([301,302,303,307,308]),Ss=5;function Cs(e,t){return e.protocol===t.protocol&&e.host===t.host||e.protocol===`http:`&&t.protocol===`https:`&&e.hostname===t.hostname&&!e.port&&!t.port}function ws(e,t){let n=xs.has(t.status)?t.headers?.get(`location`):void 0;if(n)try{return new URL(n,e)}catch{return}}var Ts=new WeakSet;function Es(e){let t=(t,n)=>e(t,n);return Ts.add(t),t}function Ds(e){return Ts.has(e)?e:async(t,n)=>{if(n?.redirect===`error`||n?.redirect===`manual`)return e(t,n);let r=(n?.method??`GET`).toUpperCase(),i=t;for(let t=0;;t++){let a=await e(i,{...n,redirect:`manual`}),o=ws(i,a);if(!o||t===Ss)return a;let s=new URL(i),c=r===`GET`||a.status===307||a.status===308,l=!(o.username||o.password)||o.username===s.username&&o.password===s.password;if(!c||!l||!Cs(s,o))return a;await a.text?.().catch(()=>{}),i=o}}}function Os(e,t){if(t.type===`opaqueredirect`)return`Redirect not followed: this runtime does not expose where it points`;let n=ws(t.url||e,t);if(n)return n.username=n.password=n.search=n.hash=``,n.protocol===`http:`&&new URL(t.url||e).protocol===`https:`?(n.protocol=`https:`,`Redirect from https to plain http not followed; try ${n.href} as the endpoint`):`Redirect to ${n.href} not followed; use that URL as the endpoint if it is the intended server`}function ks(e,t){let n=typeof e;if(n!==typeof t)return!1;if(Array.isArray(e)){if(!Array.isArray(t))return!1;let n=e.length;if(n!==t.length)return!1;for(let r=0;r1?t[a.href]=e:(a.hash=``,r===``?n=a:Is(e,t,n))}}else if(e!==!0&&e!==!1)return t;let i=n.href+(r?`#`+r:``);if(t[i]!==void 0)throw Error(`Duplicate schema URI "${i}".`);if(t[i]=e,e===!0||e===!1)return t;if(e.__absolute_uri__===void 0&&Object.defineProperty(e,"__absolute_uri__",{enumerable:!1,value:i}),e.$ref&&e.__absolute_ref__===void 0){let t=new URL(e.$ref,n.href);t.hash=t.hash,Object.defineProperty(e,"__absolute_ref__",{enumerable:!1,value:t.href})}if(e.$recursiveRef&&e.__absolute_recursive_ref__===void 0){let t=new URL(e.$recursiveRef,n.href);t.hash=t.hash,Object.defineProperty(e,"__absolute_recursive_ref__",{enumerable:!1,value:t.href})}if(e.$anchor){let r=new URL(`#`+e.$anchor,n.href);t[r.href]=e}for(let i in e){if(Ps[i])continue;let a=`${r}/${As(i)}`,o=e[i];if(Array.isArray(o)){if(Ms[i]){let e=o.length;for(let r=0;r%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,Us=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,Ws=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Gs=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Ks=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,qs=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,Js=e=>{if(e[0]===`"`)return!1;let[t,n,...r]=e.split(`@`);return!t||!n||r.length!==0||t.length>64||n.length>253||t[0]===`.`||t.endsWith(`.`)||t.includes(`..`)||!/^[a-z0-9.-]+$/i.test(n)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(t)?!1:n.split(`.`).every(e=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(e))},Ys=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,Xs=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,Zs=e=>e.length>1&&e.length<80&&(/^P\d+([.,]\d+)?W$/.test(e)||/^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(e)&&/^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(e));function Qs(e){return e.test.bind(e)}var $s={date:tc,time:nc.bind(void 0,!1),"date-time":ic,duration:Zs,uri:sc,"uri-reference":Qs(Vs),"uri-template":Qs(Hs),url:Qs(Us),email:Js,hostname:Qs(Bs),ipv4:Qs(Ys),ipv6:Qs(Xs),regex:lc,uuid:Qs(Ws),"json-pointer":Qs(Gs),"json-pointer-uri-fragment":Qs(Ks),"relative-json-pointer":Qs(qs)};function ec(e){return e%4==0&&(e%100!=0||e%400==0)}function tc(e){let t=e.match(Ls);if(!t)return!1;let n=+t[1],r=+t[2],i=+t[3];return r>=1&&r<=12&&i>=1&&i<=(r==2&&ec(n)?29:Rs[r])}function nc(e,t){let n=t.match(zs);if(!n)return!1;let r=+n[1],i=+n[2],a=+n[3],o=!!n[5];return(r<=23&&i<=59&&a<=59||r==23&&i==59&&a==60)&&(!e||o)}var rc=/t|\s/i;function ic(e){let t=e.split(rc);return t.length==2&&tc(t[0])&&nc(!0,t[1])}var ac=/\/|:/,oc=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function sc(e){return ac.test(e)&&oc.test(e)}var cc=/[^\\]\\Z/;function lc(e){if(cc.test(e))return!1;try{return new RegExp(e,`u`),!0}catch{return!1}}function uc(e){let t=0,n=e.length,r=0,i;for(;r=55296&&i<=56319&&rks(e,t))||F.push({instanceLocation:o,keyword:`enum`,keywordLocation:`${s}/enum`,error:`Instance does not match any of ${JSON.stringify(g)}.`}):g.some(t=>e===t)||F.push({instanceLocation:o,keyword:`enum`,keywordLocation:`${s}/enum`,error:`Instance does not match any of ${JSON.stringify(g)}.`})),v!==void 0){let t=`${s}/not`;Q(e,v,n,r,i,a,o,t).valid&&F.push({instanceLocation:o,keyword:`not`,keywordLocation:t,error:`Instance matched "not" schema.`})}let xe=[];if(y!==void 0){let t=`${s}/anyOf`,l=F.length,u=!1;for(let s=0;s{let u=Object.create(c),d=Q(e,s,n,r,i,p===!0?a:null,o,`${t}/${l}`,u);return F.push(...d.errors),d.valid&&xe.push(u),d.valid}).length;u===1?F.length=l:F.splice(l,0,{instanceLocation:o,keyword:`oneOf`,keywordLocation:t,error:`Instance does not match exactly one subschema (${u} matches).`})}if((u===`object`||u===`array`)&&Object.assign(c,...xe),S!==void 0){let t=`${s}/if`;if(Q(e,S,n,r,i,a,o,t,c).valid){if(ee!==void 0){let l=Q(e,ee,n,r,i,a,o,`${s}/then`,c);l.valid||F.push({instanceLocation:o,keyword:`if`,keywordLocation:t,error:`Instance does not match "then" schema.`},...l.errors)}}else if(C!==void 0){let l=Q(e,C,n,r,i,a,o,`${s}/else`,c);l.valid||F.push({instanceLocation:o,keyword:`if`,keywordLocation:t,error:`Instance does not match "else" schema.`},...l.errors)}}if(u===`object`){if(_!==void 0)for(let t of _)t in e||F.push({instanceLocation:o,keyword:`required`,keywordLocation:`${s}/required`,error:`Instance does not have required property "${t}".`});let t=Object.keys(e);if(re!==void 0&&t.lengthie&&F.push({instanceLocation:o,keyword:`maxProperties`,keywordLocation:`${s}/maxProperties`,error:`Instance does not have at least ${ie} properties.`}),D!==void 0){let t=`${s}/propertyNames`;for(let s in e){let e=`${o}/${As(s)}`,c=Q(s,D,n,r,i,a,e,t);c.valid||F.push({instanceLocation:o,keyword:`propertyNames`,keywordLocation:t,error:`Property name "${s}" does not match schema.`},...c.errors)}}if(O!==void 0){let t=`${s}/dependantRequired`;for(let n in O)if(n in e){let r=O[n];for(let i of r)i in e||F.push({instanceLocation:o,keyword:`dependentRequired`,keywordLocation:t,error:`Instance has "${n}" but does not have "${i}".`})}}if(k!==void 0)for(let t in k){let l=`${s}/dependentSchemas`;if(t in e){let s=Q(e,k[t],n,r,i,a,o,`${l}/${As(t)}`,c);s.valid||F.push({instanceLocation:o,keyword:`dependentSchemas`,keywordLocation:l,error:`Instance has "${t}" but does not match dependant schema.`},...s.errors)}}if(ae!==void 0){let t=`${s}/dependencies`;for(let s in ae)if(s in e){let c=ae[s];if(Array.isArray(c))for(let n of c)n in e||F.push({instanceLocation:o,keyword:`dependencies`,keywordLocation:t,error:`Instance has "${s}" but does not have "${n}".`});else{let l=Q(e,c,n,r,i,a,o,`${t}/${As(s)}`);l.valid||F.push({instanceLocation:o,keyword:`dependencies`,keywordLocation:t,error:`Instance has "${s}" but does not match dependant schema.`},...l.errors)}}}let l=Object.create(null),u=!1;if(T!==void 0){let t=`${s}/properties`;for(let s in T){if(!(s in e))continue;let d=`${o}/${As(s)}`,f=Q(e[s],T[s],n,r,i,a,d,`${t}/${As(s)}`);if(f.valid)c[s]=l[s]=!0;else if(u=i,F.push({instanceLocation:o,keyword:`properties`,keywordLocation:t,error:`Property "${s}" does not match schema.`},...f.errors),u)break}}if(!u&&E!==void 0){let t=`${s}/patternProperties`;for(let s in E){let d=new RegExp(s,`u`),f=E[s];for(let p in e){if(!d.test(p))continue;let m=`${o}/${As(p)}`,h=Q(e[p],f,n,r,i,a,m,`${t}/${As(s)}`);h.valid?c[p]=l[p]=!0:(u=i,F.push({instanceLocation:o,keyword:`patternProperties`,keywordLocation:t,error:`Property "${p}" matches pattern "${s}" but does not match associated schema.`},...h.errors))}}}if(!u&&te!==void 0){let t=`${s}/additionalProperties`;for(let s in e){if(l[s])continue;let d=`${o}/${As(s)}`,f=Q(e[s],te,n,r,i,a,d,t);f.valid?c[s]=!0:(u=i,F.push({instanceLocation:o,keyword:`additionalProperties`,keywordLocation:t,error:`Property "${s}" does not match additional properties schema.`},...f.errors))}}else if(!u&&ne!==void 0){let t=`${s}/unevaluatedProperties`;for(let s in e)if(!c[s]){let l=`${o}/${As(s)}`,u=Q(e[s],ne,n,r,i,a,l,t);u.valid?c[s]=!0:F.push({instanceLocation:o,keyword:`unevaluatedProperties`,keywordLocation:t,error:`Property "${s}" does not match unevaluated properties schema.`},...u.errors)}}}else if(u===`array`){de!==void 0&&e.length>de&&F.push({instanceLocation:o,keyword:`maxItems`,keywordLocation:`${s}/maxItems`,error:`Array has too many items (${e.length} > ${de}).`}),ue!==void 0&&e.length=(j||0)&&(F.length=u),j===void 0&&M===void 0&&d===0?F.splice(u,0,{instanceLocation:o,keyword:`contains`,keywordLocation:l,error:`Array does not contain item matching schema.`}):j!==void 0&&dM&&F.push({instanceLocation:o,keyword:`maxContains`,keywordLocation:`${s}/maxContains`,error:`Array may contain at most ${M} items matching schema. ${d} items were found.`})}}if(!u&&ce!==void 0){let u=`${s}/unevaluatedItems`;for(;l=me||e>me)&&F.push({instanceLocation:o,keyword:`maximum`,keywordLocation:`${s}/maximum`,error:`${e} is greater than ${N?`or equal to `:``} ${me}.`})):(pe!==void 0&&eme&&F.push({instanceLocation:o,keyword:`maximum`,keywordLocation:`${s}/maximum`,error:`${e} is greater than ${me}.`}),he!==void 0&&e<=he&&F.push({instanceLocation:o,keyword:`exclusiveMinimum`,keywordLocation:`${s}/exclusiveMinimum`,error:`${e} is less than ${he}.`}),N!==void 0&&e>=N&&F.push({instanceLocation:o,keyword:`exclusiveMaximum`,keywordLocation:`${s}/exclusiveMaximum`,error:`${e} is greater than or equal to ${N}.`})),P!==void 0){let t=e%P;Math.abs(0-t)>=1.1920929e-7&&Math.abs(P-t)>=1.1920929e-7&&F.push({instanceLocation:o,keyword:`multipleOf`,keywordLocation:`${s}/multipleOf`,error:`${e} is not a multiple of ${P}.`})}}else if(u===`string`){let t=ge===void 0&&_e===void 0?0:uc(e);ge!==void 0&&t_e&&F.push({instanceLocation:o,keyword:`maxLength`,keywordLocation:`${s}/maxLength`,error:`String is too long (${t} > ${_e}).`}),ve!==void 0&&!new RegExp(ve,`u`).test(e)&&F.push({instanceLocation:o,keyword:`pattern`,keywordLocation:`${s}/pattern`,error:`String does not match pattern.`}),w!==void 0&&$s[w]&&!$s[w](e)&&F.push({instanceLocation:o,keyword:`format`,keywordLocation:`${s}/format`,error:`String does not match format "${w}".`})}return{valid:F.length===0,errors:F}}var dc=class{schema;draft;shortCircuit;lookup;constructor(e,t=`2019-09`,n=!0){this.schema=e,this.draft=t,this.shortCircuit=n,this.lookup=Is(e)}validate(e){return Q(e,this.schema,this.draft,this.lookup,this.shortCircuit)}addSchema(e,t){t&&(e={...e,$id:t}),Is(e,this.lookup)}},fc=class{shortcircuit;draft;constructor(e){this.shortcircuit=e?.shortcircuit??!0,this.draft=e?.draft}_draftFor(e){let t=je(e,`pass an explicit { draft } to CfWorkerJsonSchemaValidator to validate other dialects.`);return t===`draft-7`?`7`:t}getValidator(e){let t=new dc(e,this.draft??this._draftFor(e),this.shortcircuit);return e=>{let n=t.validate(e);return n.valid?{valid:!0,data:e,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:n.errors.map(e=>`${e.instanceLocation}: ${e.error}`).join(`; `)}}}},pc=globalThis.crypto;async function mc(e){return(await pc).getRandomValues(new Uint8Array(e))}async function hc(e){let t=``;for(;t.length128)throw`Expected a length between 43 and 128. Received ${e}.`;let t=await gc(e);return{code_verifier:t,code_challenge:await _c(t)}}var yc=class extends Error{constructor(e,t){super(e),this.name=`ParseError`,this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}},bc=10,xc=13,Sc=32;function Cc(e){}function wc(e){if(typeof e==`function`)throw TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");let{onEvent:t=Cc,onError:n=Cc,onRetry:r=Cc,onComment:i,maxBufferSize:a}=e,o=[],s=0,c=!0,l,u=``,d=0,f,p=!1;function m(e){if(p)throw Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(c&&(c=!1,e.charCodeAt(0)===239&&e.charCodeAt(1)===187&&e.charCodeAt(2)===191&&(e=e.slice(3))),o.length===0){let t=g(e);t!==``&&(o.push(t),s=t.length),h();return}if(e.indexOf(` `)===-1&&e.indexOf(`\r`)===-1){o.push(e),s+=e.length,h();return}o.push(e);let t=o.join(``);o.length=0,s=0;let n=g(t);n!==``&&(o.push(n),s=n.length),h()}function h(){a!==void 0&&(s+u.length<=a||(p=!0,o.length=0,s=0,l=void 0,u=``,d=0,f=void 0,n(new yc(`Buffered data exceeded max buffer size of ${a} characters`,{type:`max-buffer-size-exceeded`}))))}function g(e){let n=0;if(e.indexOf(`\r`)===-1){let r=e.indexOf(` `,n);for(;r!==-1;){if(n===r){d>0&&t({id:l,event:f,data:u}),l=void 0,u=``,d=0,f=void 0,n=r+1,r=e.indexOf(` diff --git a/internal/ui/dist/assets/page-BEAiBOTm.js b/internal/ui/dist/assets/page-DGkiHXHP.js similarity index 99% rename from internal/ui/dist/assets/page-BEAiBOTm.js rename to internal/ui/dist/assets/page-DGkiHXHP.js index 61148a2a9..f86f1c752 100644 --- a/internal/ui/dist/assets/page-BEAiBOTm.js +++ b/internal/ui/dist/assets/page-DGkiHXHP.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/panel-sql-editor-DZsqGx1F.js","assets/useRouter-ByJ6_rwb.js","assets/brand-DUaZkIz1.js","assets/index-_VmsjY84.js","assets/useNavigate-B1zgPEUp.js","assets/preload-helper-CButVOn1.js","assets/Tooltip-B3r3s_B9.js","assets/index-C3uJb_UT.css"])))=>i.map(i=>d[i]); -import{a as e,i as t,o as n,r,s as i}from"./useRouter-ByJ6_rwb.js";import{A as a,C as o,D as s,E as c,K as l,M as u,O as d,P as f,Q as p,S as m,T as h,X as g,Y as _,Z as v,_ as y,_t as b,a as x,c as S,d as C,dt as w,f as T,ft as E,g as D,gt as O,h as k,j as A,k as j,lt as M,m as N,mt as P,nt as F,o as I,ot as L,p as ee,r as te,s as ne,st as re,tt as ie,u as ae,ut as R,v as oe,x as z,y as se}from"./brand-DUaZkIz1.js";import{c as ce,s as le,t as ue}from"./preload-helper-CButVOn1.js";import{C as de,E as fe,b as pe,o as me,t as he,w as ge}from"./Tooltip-B3r3s_B9.js";import{a as _e,c as ve,d as ye,i as be,l as xe,n as Se,o as Ce,r as we,s as Te,t as Ee,u as De}from"./dashboard-change-chips-DDCZ8miS.js";import{n as Oe,r as ke,t as Ae}from"./WarningCircle.es-1A8yYViJ.js";import{A as je,At as Me,B as Ne,Bt as Pe,C as Fe,D as Ie,E as Le,F as Re,Ft as ze,Gt as Be,H as Ve,Ht as He,I as Ue,It as We,Jt as Ge,Kt as Ke,Lt as qe,M as Je,Mt as Ye,N as Xe,Nt as Ze,O as Qe,P as $e,Pt as et,Q as tt,R as nt,Rt as rt,U as it,Ut as at,V as ot,W as st,Wt as ct,Xt as lt,Yt as ut,Zt as dt,_ as ft,a as pt,b as mt,c as ht,d as gt,h as _t,i as vt,j as yt,jt as bt,k as xt,l as St,m as Ct,n as wt,o as Tt,qt as Et,r as Dt,s as Ot,t as kt,u as At,v as jt,w as Mt,x as Nt,zt as Pt}from"./index-_VmsjY84.js";function Ft(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!t.has(n)||!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();let n=It(e);if(n.length!==It(t).length)return!1;for(let r=0;r{if(typeof n!=`string`||n.trim().length===0)throw Error(t);return`${e}-${n}`}}var V=r();function Rt(e){return typeof e==`object`&&e?`base`in e?e.base:void 0:e}function zt(e,t){if(e===t||Number.isNaN(e)&&Number.isNaN(t))return!0;if(!(e instanceof Object)||!(t instanceof Object))return!1;let n=Object.keys(e),{length:r}=n;if(r!==Object.keys(t).length)return!1;for(let i=0;i{r.current||=window.setTimeout(()=>{i(...e),r.current=null},t)},[t]),o=(0,B.useCallback)(()=>{r.current&&=(window.clearTimeout(r.current),null)},[]);return(0,B.useEffect)(()=>(n.autoInvoke&&a(),o),[o,a]),{start:a,clear:o}}function Wt(e){let t=(0,B.useRef)(void 0);return(0,B.useEffect)(()=>{t.current=e},[e]),t.current}function Gt(e,t,n){let r=(0,B.useRef)(null);(0,B.useEffect)(()=>{r.current&&=(r.current.disconnect(),null);let i=typeof n==`function`?n():n;return i&&(r.current=new MutationObserver(e),r.current.observe(i,t)),()=>{r.current&&=(r.current.disconnect(),null)}},[e,t,n])}function Kt(){let[e,t]=(0,B.useState)(!1);return(0,B.useEffect)(()=>t(!0),[]),e}function qt(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`}function Jt(e,t=document){let n=t.querySelector(e);if(n)return n;let r=t.querySelectorAll(`*`);for(let t=0;t{if(!e||!t||!n.current)return;let r=e.getBoundingClientRect(),i=t.getBoundingClientRect(),a=t.offsetWidth===0?1:i.width/t.offsetWidth,o=t.offsetHeight===0?1:i.height/t.offsetHeight,s=window.getComputedStyle(e),c=window.getComputedStyle(t),l=pe(s.borderTopWidth)+pe(c.borderTopWidth),u=pe(s.borderLeftWidth)+pe(c.borderLeftWidth),d={top:(r.top-i.top)/o-l,left:(r.left-i.left)/a-u,width:r.width/a,height:r.height/o};n.current.style.transform=`translateY(${d.top}px) translateX(${d.left}px)`,n.current.style.width=`${d.width}px`,n.current.style.height=`${d.height}px`},p=()=>{window.clearTimeout(o.current),n.current&&(n.current.style.transitionDuration=`0ms`),f(),o.current=window.setTimeout(()=>{n.current&&(n.current.style.transitionDuration=``)},30)},m=(0,B.useRef)(null),h=(0,B.useRef)(null);return(0,B.useEffect)(()=>{if(c&&s.current!==e&&i&&i(),s.current=e,f(),e)return m.current=new ResizeObserver(p),m.current.observe(e),t&&(h.current=new ResizeObserver(p),h.current.observe(t)),()=>{m.current?.disconnect(),h.current?.disconnect()}},[t,e]),(0,B.useEffect)(()=>{if(t){let e=e=>{Qt(e.target,t)&&(p(),d(!1))};return t.addEventListener(`transitionend`,e),()=>{t.removeEventListener(`transitionend`,e)}}},[t]),(0,B.useEffect)(()=>{if(n.current&&a){let e=e=>{e.propertyName===`transform`&&a()};return n.current.addEventListener(`transitionend`,e),()=>{n.current?.removeEventListener(`transitionend`,e)}}},[a]),Ut(()=>{ye()!==`test`&&l(!0)},20,{autoInvoke:!0}),Gt(e=>{e.forEach(e=>{e.type===`attributes`&&e.attributeName===`dir`&&p()})},{attributes:!0,attributeFilter:[`dir`]},()=>document.documentElement),{initialized:c,hidden:u}}var en={root:`m_96b553a6`},tn=g((e,{transitionDuration:t},{shouldReduceMotion:n})=>({root:{"--transition-duration":e.respectReducedMotion&&n?`0ms`:typeof t==`number`?`${t}ms`:t||`150ms`}})),nn=h(e=>{let t=u(`FloatingIndicator`,null,e),{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:l,target:d,parent:f,transitionDuration:m,mod:h,displayAfterTransitionEnd:g,onTransitionStart:_,onTransitionEnd:v,attributes:y,ref:b,...x}=t,S=p(),C=a({name:`FloatingIndicator`,classes:en,props:t,className:r,style:i,classNames:n,styles:s,unstyled:c,attributes:y,vars:l,varsResolver:tn,stylesCtx:{shouldReduceMotion:S}}),w=(0,B.useRef)(null),{initialized:T,hidden:E}=$t({target:d,parent:f,ref:w,displayAfterTransitionEnd:g,onTransitionStart:_,onTransitionEnd:v}),D=ie(b,w);return!d||!f?null:(0,V.jsx)(o,{ref:D,mod:[{initialized:T,hidden:E},h],...C(`root`),...x})});nn.displayName=`@mantine/core/FloatingIndicator`,nn.classes=en,nn.varsResolver=tn;var[rn,an]=fe(`Accordion component was not found in the tree`),[on,sn]=fe(`Accordion.Item component was not found in the tree`),cn={root:`m_9bdbb667`,panel:`m_df78851f`,content:`m_4ba554d4`,itemTitle:`m_8fa820a0`,control:`m_4ba585b8`,"control--default":`m_6939a5e9`,"control--contained":`m_4271d21b`,label:`m_df3ffa0f`,chevron:`m_3f35ae96`,icon:`m_9bd771fe`,item:`m_9bd7b098`,"item--default":`m_fe19b709`,"item--contained":`m_1f921b3b`,"item--filled":`m_2cdf939a`,"item--separated":`m_9f59b069`},ln=h(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,chevron:s,icon:c,onClick:l,onKeyDown:d,children:f,disabled:p,mod:h,...g}=u(`AccordionControl`,null,e),{value:_}=sn(),v=an(),y=v.isItemActive(_),b=typeof v.order==`number`,x=`h${v.order}`,S=(0,V.jsxs)(m,{...v.getStyles(`control`,{className:n,classNames:t,style:r,styles:i,variant:v.variant}),unstyled:v.unstyled,mod:[`accordion-control`,{active:y,"chevron-position":v.chevronPosition,disabled:p},h],onClick:e=>{l?.(e),v.onChange(_)},type:`button`,disabled:p,"aria-expanded":y,"aria-controls":v.getRegionId(_),id:v.getControlId(_),onKeyDown:Et({siblingSelector:`[data-accordion-control]`,parentSelector:`[data-accordion]`,activateOnFocus:!1,loop:v.loop,orientation:`vertical`,onKeyDown:d}),...g,children:[(0,V.jsx)(o,{component:`span`,mod:{rotate:!v.disableChevronRotation&&y,position:v.chevronPosition},...v.getStyles(`chevron`,{classNames:t,styles:i}),children:s||v.chevron}),(0,V.jsx)(`span`,{...v.getStyles(`label`,{classNames:t,styles:i}),children:f}),c&&(0,V.jsx)(o,{component:`span`,mod:{"chevron-position":v.chevronPosition},...v.getStyles(`icon`,{classNames:t,styles:i}),children:c})]});return b?(0,V.jsx)(x,{...v.getStyles(`itemTitle`,{classNames:t,styles:i}),children:S}):S});ln.displayName=`@mantine/core/AccordionControl`,ln.classes=cn;var un=h(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,value:s,mod:c,...l}=u(`AccordionItem`,null,e),d=an();return(0,V.jsx)(on,{value:{value:s},children:(0,V.jsx)(o,{mod:[{active:d.isItemActive(s)},c],...d.getStyles(`item`,{className:n,classNames:t,styles:i,style:r,variant:d.variant}),...l})})});un.displayName=`@mantine/core/AccordionItem`,un.classes=cn;var dn=h(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,children:o,keepMounted:s,keepMountedMode:c,...l}=u(`AccordionPanel`,null,e),{value:d}=sn(),f=an();return(0,V.jsx)(De,{...f.getStyles(`panel`,{className:n,classNames:t,style:r,styles:i}),expanded:f.isItemActive(d),transitionDuration:f.transitionDuration??200,role:`region`,id:f.getRegionId(d),"aria-labelledby":f.getControlId(d),keepMounted:s??f.keepMounted,keepMountedMode:c??f.keepMountedMode,...l,children:(0,V.jsx)(`div`,{...f.getStyles(`content`,{classNames:t,styles:i}),children:o})})});dn.displayName=`@mantine/core/AccordionPanel`,dn.classes=cn;var fn={multiple:!1,loop:!0,disableChevronRotation:!1,disableCollapse:!1,chevronPosition:`right`,variant:`default`,chevronSize:`auto`,chevronIconSize:16,keepMountedMode:`activity`},pn=g((e,{transitionDuration:t,chevronSize:n,radius:r})=>({root:{"--accordion-transition-duration":t===void 0?void 0:`${t}ms`,"--accordion-chevron-size":n===void 0?void 0:P(n),"--accordion-radius":r===void 0?void 0:re(r)}})),mn=c(e=>{let t=u(`Accordion`,fn,e),{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:l,children:d,multiple:f,value:p,defaultValue:m,onChange:h,id:g,loop:_,transitionDuration:v,disableChevronRotation:y,disableCollapse:b,chevronPosition:x,chevronSize:S,order:C,chevron:w,variant:T,radius:E,chevronIconSize:D,attributes:O,keepMounted:k,keepMountedMode:A,...j}=t,M=F(g),[N,P]=Be({value:p,defaultValue:m,finalValue:f?[]:null,onChange:h}),I=e=>Array.isArray(N)?N.includes(e):e===N,L=e=>{if(!Array.isArray(N)&&b&&e===N)return;let t=Array.isArray(N)?N.includes(e)?N.filter(t=>t!==e):[...N,e]:e===N?null:e;P(t)},ee=a({name:`Accordion`,classes:cn,props:t,className:r,style:i,classNames:n,styles:s,unstyled:c,attributes:O,vars:l,varsResolver:pn});return(0,V.jsx)(rn,{value:{isItemActive:I,onChange:L,getControlId:Lt(`${M}-control`,`Accordion.Item component was rendered with invalid value or without value`),getRegionId:Lt(`${M}-panel`,`Accordion.Item component was rendered with invalid value or without value`),chevron:w===null?null:w||(0,V.jsx)(rt,{size:D}),transitionDuration:v,disableChevronRotation:y,chevronPosition:x,order:C,loop:_,getStyles:ee,variant:T,unstyled:c,keepMounted:k,keepMountedMode:A},children:(0,V.jsx)(o,{...ee(`root`),id:M,...j,variant:T,"data-accordion":!0,children:d})})});mn.classes=cn,mn.varsResolver=pn,mn.displayName=`@mantine/core/Accordion`,mn.Item=un,mn.Panel=dn,mn.Control=ln,mn.Chevron=rt;function hn(e){return typeof e==`string`?{value:e,label:e}:typeof e==`object`&&`value`in e&&!(`label`in e)?{value:e.value,label:`${e.value}`,disabled:e.disabled}:typeof e==`object`&&`group`in e?{group:e.group,items:e.items.map(e=>hn(e))}:typeof e==`number`||typeof e==`bigint`||typeof e==`boolean`?{value:e,label:`${e}`}:e}function gn(e){return e?e.map(e=>hn(e)):[]}function _n(e){return e.reduce((e,t)=>`group`in t?{...e,..._n(t.items)}:(e[`${t.value}`]=t,e),{})}var vn={dropdown:`m_88b62a41`,search:`m_985517d8`,options:`m_b2821a6e`,option:`m_92253aa5`,empty:`m_2530cd1d`,header:`m_858f94bd`,footer:`m_82b967cb`,group:`m_254f3e4f`,groupLabel:`m_2bb2e9e5`,chevron:`m_2943220b`,optionsDropdownOption:`m_390b5f4`,optionsDropdownCheckIcon:`m_8ee53fc2`,optionsDropdownCheckPlaceholder:`m_a530ee0a`},yn={error:null},bn=g((e,{size:t,color:n})=>({chevron:{"--combobox-chevron-size":M(t,`combobox-chevron-size`),"--combobox-chevron-color":n?l(n,e):void 0}})),xn=h(e=>{let t=u(`ComboboxChevron`,yn,e),{size:n,error:r,style:i,className:s,classNames:c,styles:l,unstyled:d,vars:f,attributes:p,mod:m,...h}=t,g=a({name:`ComboboxChevron`,classes:vn,props:t,style:i,className:s,classNames:c,styles:l,unstyled:d,vars:f,varsResolver:bn,attributes:p,rootSelector:`chevron`});return(0,V.jsx)(o,{component:`svg`,...h,...g(`chevron`),size:n,viewBox:`0 0 15 15`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,mod:[`combobox-chevron`,{error:r},m],children:(0,V.jsx)(`path`,{d:`M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z`,fill:`currentColor`,fillRule:`evenodd`,clipRule:`evenodd`})})});xn.classes=vn,xn.varsResolver=bn,xn.displayName=`@mantine/core/ComboboxChevron`;var[Sn,Cn]=fe(`Combobox component was not found in tree`);function wn({onMouseDown:e,onClick:t,onClear:n,...r}){return(0,V.jsx)(k.ClearButton,{tabIndex:-1,"aria-hidden":!0,...r,onMouseDown:t=>{t.preventDefault(),e?.(t)},onClick:e=>{n(),t?.(e)}})}wn.displayName=`@mantine/core/ComboboxClearButton`;var Tn=h(e=>{let{classNames:t,styles:n,className:r,style:i,hidden:a,...o}=u(`ComboboxDropdown`,null,e),s=Cn();return(0,V.jsx)(Pe.Dropdown,{...o,role:`presentation`,"data-hidden":a||void 0,"data-floating-height":s.floatingHeight||void 0,...s.getStyles(`dropdown`,{className:r,style:i,classNames:t,styles:n})})});Tn.classes=vn,Tn.displayName=`@mantine/core/ComboboxDropdown`;var En={refProp:`ref`},Dn=h(e=>{let{children:t,refProp:n,ref:r}=u(`ComboboxDropdownTarget`,En,e);if(Cn(),!w(t))throw Error(`Combobox.DropdownTarget component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);return(0,V.jsx)(Pe.Target,{ref:r,refProp:n,children:t})});Dn.displayName=`@mantine/core/ComboboxDropdownTarget`;var On=h(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...s}=u(`ComboboxEmpty`,null,e),c=Cn();return(0,V.jsx)(o,{...c.getStyles(`empty`,{className:n,classNames:t,styles:i,style:r}),...s})});On.classes=vn,On.displayName=`@mantine/core/ComboboxEmpty`;function kn({onKeyDown:e,onClick:t,withKeyboardNavigation:n,withAriaAttributes:r,withExpandedAttribute:i,targetType:a,autoComplete:o}){let s=Cn(),[c,l]=(0,B.useState)(null),u=t=>{if(e?.(t),!s.readOnly&&n){if(t.nativeEvent.isComposing)return;if(t.nativeEvent.code===`ArrowDown`&&(t.preventDefault(),s.store.dropdownOpened?l(s.store.selectNextOption()):(s.store.openDropdown(`keyboard`),l(s.store.selectActiveOption()),s.store.updateSelectedOptionIndex(`selected`,{scrollIntoView:!0}))),t.nativeEvent.code===`ArrowUp`&&(t.preventDefault(),s.store.dropdownOpened?l(s.store.selectPreviousOption()):(s.store.openDropdown(`keyboard`),l(s.store.selectActiveOption()),s.store.updateSelectedOptionIndex(`selected`,{scrollIntoView:!0}))),t.nativeEvent.code===`Enter`||t.nativeEvent.code===`NumpadEnter`){if(t.nativeEvent.keyCode===229)return;let e=s.store.getSelectedOptionIndex();s.store.dropdownOpened&&e!==-1?(t.preventDefault(),s.store.clickSelectedOption()):a===`button`&&(t.preventDefault(),s.store.openDropdown(`keyboard`))}t.key===`Escape`&&s.store.closeDropdown(`keyboard`),t.nativeEvent.code===`Space`&&a===`button`&&(t.preventDefault(),s.store.toggleDropdown(`keyboard`))}},d=r?{...i?{role:`combobox`}:{},"aria-haspopup":`listbox`,"aria-expanded":i?!!(s.store.listId&&s.store.dropdownOpened):void 0,"aria-controls":s.store.dropdownOpened&&s.store.listId?s.store.listId:void 0,"aria-activedescendant":s.store.dropdownOpened&&c||void 0,autoComplete:o,"data-expanded":s.store.dropdownOpened||void 0,"data-mantine-stop-propagation":s.store.dropdownOpened||void 0}:{},f=e=>{a===`button`&&e.currentTarget.focus(),t?.(e)};return{...d,onKeyDown:u,onClick:f}}var An={refProp:`ref`,targetType:`input`,withKeyboardNavigation:!0,withAriaAttributes:!0,withExpandedAttribute:!1,autoComplete:`off`},jn=h(e=>{let{children:t,refProp:n,withKeyboardNavigation:r,withAriaAttributes:i,withExpandedAttribute:a,targetType:o,autoComplete:s,ref:c,...l}=u(`ComboboxEventsTarget`,An,e),d=v(t);if(!d)throw Error(`Combobox.EventsTarget component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);let f=Cn(),p=kn({targetType:o,withAriaAttributes:i,withKeyboardNavigation:r,withExpandedAttribute:a,onKeyDown:d.props.onKeyDown,onClick:d.props.onClick,autoComplete:s});return(0,B.cloneElement)(d,{...p,...l,[n]:ie(c,f.store.targetRef,de(d))})});jn.displayName=`@mantine/core/ComboboxEventsTarget`;var Mn=h(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...s}=u(`ComboboxFooter`,null,e),c=Cn();return(0,V.jsx)(o,{...c.getStyles(`footer`,{className:n,classNames:t,style:r,styles:i}),...s,onMouseDown:e=>{e.preventDefault()}})});Mn.classes=vn,Mn.displayName=`@mantine/core/ComboboxFooter`;var Nn=h(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,children:s,label:c,id:l,...d}=u(`ComboboxGroup`,null,e),f=Cn(),p=F(l),m=c!=null&&c!==!1&&c!==``;return(0,V.jsxs)(o,{role:`group`,"aria-labelledby":m?p:void 0,...f.getStyles(`group`,{className:n,classNames:t,style:r,styles:i}),...d,children:[m&&(0,V.jsx)(`div`,{id:p,...f.getStyles(`groupLabel`,{classNames:t,styles:i}),children:c}),s]})});Nn.classes=vn,Nn.displayName=`@mantine/core/ComboboxGroup`;var Pn=h(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...s}=u(`ComboboxHeader`,null,e),c=Cn();return(0,V.jsx)(o,{...c.getStyles(`header`,{className:n,classNames:t,style:r,styles:i}),...s,onMouseDown:e=>{e.preventDefault()}})});Pn.classes=vn,Pn.displayName=`@mantine/core/ComboboxHeader`;function Fn({value:e,valuesDivider:t=`,`,...n}){return(0,V.jsx)(`input`,{type:`hidden`,value:Array.isArray(e)?e.join(t):e?`${e}`:``,...n})}Fn.displayName=`@mantine/core/ComboboxHiddenInput`;var In=h(e=>{let t=u(`ComboboxOption`,null,e),{classNames:n,className:r,style:i,styles:a,vars:s,onClick:c,id:l,active:d,onMouseDown:f,onMouseOver:p,disabled:m,selected:h,mod:g,..._}=t,v=Cn(),y=(0,B.useId)(),b=l||y;return(0,V.jsx)(o,{...v.getStyles(`option`,{className:r,classNames:n,styles:a,style:i}),"aria-disabled":m||void 0,..._,id:b,mod:[`combobox-option`,{"combobox-active":d,"combobox-disabled":m,"combobox-selected":h},g],role:`option`,onClick:e=>{m?e.preventDefault():(v.onOptionSubmit?.(t.value,t),c?.(e))},onMouseDown:e=>{e.preventDefault(),f?.(e)},onMouseOver:e=>{v.resetSelectionOnOptionHover&&v.store.resetSelectedOption(),p?.(e)}})});In.classes=vn,In.displayName=`@mantine/core/ComboboxOption`;var Ln=h(e=>{let{classNames:t,className:n,style:r,styles:i,id:a,onMouseDown:s,labelledBy:c,...l}=u(`ComboboxOptions`,null,e),d=Cn(),f=F(a);return(0,B.useEffect)(()=>{d.store.setListId(f)},[f]),(0,V.jsx)(o,{...d.getStyles(`options`,{className:n,style:r,classNames:t,styles:i}),...l,id:f,role:`listbox`,"aria-labelledby":c,onMouseDown:e=>{e.preventDefault(),s?.(e)}})});Ln.classes=vn,Ln.displayName=`@mantine/core/ComboboxOptions`;var Rn={withAriaAttributes:!0,withKeyboardNavigation:!0},zn=h(e=>{let{classNames:t,styles:n,unstyled:r,vars:i,withAriaAttributes:a,onKeyDown:o,onClick:s,withKeyboardNavigation:c,size:l,ref:d,...f}=u(`ComboboxSearch`,Rn,e),p=Cn(),m=p.getStyles(`search`),h=kn({targetType:`input`,withAriaAttributes:a,withKeyboardNavigation:c,withExpandedAttribute:!1,onKeyDown:o,onClick:s,autoComplete:`off`});return(0,V.jsx)(k,{ref:ie(d,p.store.searchRef),classNames:[{input:m.className},t],styles:[{input:m.style},n],size:l||p.size,...h,...f,__staticSelector:`Combobox`})});zn.classes=vn,zn.displayName=`@mantine/core/ComboboxSearch`;var Bn={refProp:`ref`,targetType:`input`,withKeyboardNavigation:!0,withAriaAttributes:!0,withExpandedAttribute:!1,autoComplete:`off`},Vn=h(e=>{let{children:t,refProp:n,withKeyboardNavigation:r,withAriaAttributes:i,withExpandedAttribute:a,targetType:o,autoComplete:s,ref:c,...l}=u(`ComboboxTarget`,Bn,e),d=v(t);if(!d)throw Error(`Combobox.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);let f=Cn(),p=kn({targetType:o,withAriaAttributes:i,withKeyboardNavigation:r,withExpandedAttribute:a,onKeyDown:d.props.onKeyDown,onClick:d.props.onClick,autoComplete:s}),m=(0,B.cloneElement)(d,{...p,...l});return(0,V.jsx)(Pe.Target,{refProp:n,ref:ie(c,f.store.targetRef),children:m})});Vn.displayName=`@mantine/core/ComboboxTarget`;function Hn(e,t,n){for(let n=e-1;n>=0;--n)if(!t[n].hasAttribute(`data-combobox-disabled`))return n;if(n){for(let e=t.length-1;e>-1;--e)if(!t[e].hasAttribute(`data-combobox-disabled`))return e}return e}function Un(e,t,n){for(let n=e+1;n{s||(c(!0),i?.(e))},[c,i,s]),_=(0,B.useCallback)((e=`unknown`)=>{s&&(c(!1),r?.(e))},[c,r,s]),v=(0,B.useCallback)((e=`unknown`)=>{s?_(e):g(e)},[_,g,s]),y=(0,B.useCallback)(()=>{let e=Xt(f.current);Jt(`#${l.current} [data-combobox-selected]`,e)?.removeAttribute(`data-combobox-selected`)},[]),b=(0,B.useCallback)(e=>{let t=Xt(f.current),n=Jt(`#${l.current}`,t),r=n?Yt(`[data-combobox-option]`,n):null;if(!r)return null;let i=e>=r.length?0:e<0?r.length-1:e;return u.current=i,r?.[i]&&!r[i].hasAttribute(`data-combobox-disabled`)?(y(),r[i].setAttribute(`data-combobox-selected`,`true`),r[i].scrollIntoView({block:`nearest`,behavior:o}),r[i].id):null},[o,y]),x=(0,B.useCallback)(()=>{let e=Xt(f.current),t=Jt(`#${l.current} [data-combobox-active]`,e);if(t){let n=Yt(`#${l.current} [data-combobox-option]`,e).findIndex(e=>e===t);return b(n)}return b(0)},[b]),S=(0,B.useCallback)(()=>{let e=Xt(f.current),t=Yt(`#${l.current} [data-combobox-option]`,e);return b(Un(u.current,t,a))},[b,a]),C=(0,B.useCallback)(()=>{let e=Xt(f.current),t=Yt(`#${l.current} [data-combobox-option]`,e);return b(Hn(u.current,t,a))},[b,a]),w=(0,B.useCallback)(()=>{let e=Xt(f.current),t=Yt(`#${l.current} [data-combobox-option]`,e);return b(Wn(t))},[b]),T=(0,B.useCallback)((e=`selected`,t)=>{if(typeof e==`number`){u.current=e;let n=Xt(f.current),r=Yt(`#${l.current} [data-combobox-option]`,n);t?.scrollIntoView&&r[e]?.scrollIntoView({block:`nearest`,behavior:o});return}h.current=window.setTimeout(()=>{let n=Xt(f.current),r=Yt(`#${l.current} [data-combobox-option]`,n),i=r.findIndex(t=>t.hasAttribute(`data-combobox-${e}`));u.current=i,t?.scrollIntoView&&r[i]?.scrollIntoView({block:`nearest`,behavior:o})},0)},[]),E=(0,B.useCallback)(()=>{u.current=-1,y()},[y]),D=(0,B.useCallback)(()=>{let e=Xt(f.current);(Yt(`#${l.current} [data-combobox-option]`,e)?.[u.current])?.click()},[]),O=(0,B.useCallback)(e=>{l.current=e},[]),k=(0,B.useCallback)(()=>{p.current=window.setTimeout(()=>d.current?.focus(),0)},[]),A=(0,B.useCallback)(()=>{m.current=window.setTimeout(()=>f.current?.focus(),0)},[]),j=(0,B.useCallback)(()=>u.current,[]);return(0,B.useEffect)(()=>()=>{window.clearTimeout(p.current),window.clearTimeout(m.current),window.clearTimeout(h.current)},[]),{dropdownOpened:s,openDropdown:g,closeDropdown:_,toggleDropdown:v,selectedOptionIndex:u.current,getSelectedOptionIndex:j,selectOption:b,selectFirstOption:w,selectActiveOption:x,selectNextOption:S,selectPreviousOption:C,resetSelectedOption:E,updateSelectedOptionIndex:T,listId:l.current,setListId:O,clickSelectedOption:D,searchRef:d,focusSearchInput:k,targetRef:f,focusTarget:A}}var Kn={keepMounted:!0,keepMountedMode:`display-none`,withinPortal:!0,resetSelectionOnOptionHover:!1,width:`target`,transitionProps:{transition:`fade`,duration:0},size:`sm`},qn=g((e,{size:t,dropdownPadding:n})=>({options:{"--combobox-option-fz":L(t),"--combobox-option-padding":M(t,`combobox-option-padding`)},dropdown:{"--combobox-padding":n===void 0?void 0:P(n),"--combobox-option-fz":L(t),"--combobox-option-padding":M(t,`combobox-option-padding`)}})),Jn=e=>{let t=u(`Combobox`,Kn,e),{classNames:n,styles:r,unstyled:i,children:o,store:s,vars:c,onOptionSubmit:l,onClose:d,size:f,dropdownPadding:p,resetSelectionOnOptionHover:m,__staticSelector:h,readOnly:g,attributes:_,floatingHeight:v,middlewares:y,...b}=t,x=v===`viewport`?{...y,flip:!1,size:{...typeof y?.size==`object`?y.size:{},padding:typeof y?.size==`object`&&y.size.padding!==void 0?y.size.padding:10,apply:({availableHeight:e,availableWidth:t,elements:n,...r})=>{n.floating.style.setProperty(`--combobox-floating-max-height`,`${e}px`);let i=y?.size;typeof i==`object`&&i.apply?i.apply({availableHeight:e,availableWidth:t,elements:n,...r}):i&&Object.assign(n.floating.style,{maxWidth:`${t}px`,maxHeight:`${e}px`})}}}:y,S=Gn(),C=s||S,w=a({name:h||`Combobox`,classes:vn,props:t,classNames:n,styles:r,unstyled:i,attributes:_,vars:c,varsResolver:qn}),T=()=>{d?.(),C.closeDropdown()};return(0,V.jsx)(Sn,{value:{getStyles:w,store:C,onOptionSubmit:l,size:f,resetSelectionOnOptionHover:m,readOnly:g,floatingHeight:v},children:(0,V.jsx)(Pe,{opened:C.dropdownOpened,...b,middlewares:x,onChange:e=>!e&&T(),withRoles:!1,unstyled:i,children:o})})};Jn.extend=e=>e,Jn.classes=vn,Jn.varsResolver=qn,Jn.displayName=`@mantine/core/Combobox`,Jn.Target=Vn,Jn.Dropdown=Tn,Jn.Options=Ln,Jn.Option=In,Jn.Search=zn,Jn.Empty=On,Jn.Chevron=xn,Jn.Footer=Mn,Jn.Header=Pn,Jn.EventsTarget=jn,Jn.DropdownTarget=Dn,Jn.Group=Nn,Jn.ClearButton=wn,Jn.HiddenInput=Fn;function Yn({children:e,role:t}){let n=(0,B.use)(D);return n?(0,V.jsx)(`div`,{role:t,"aria-labelledby":n.labelId,"aria-describedby":n.describedBy,children:e}):(0,V.jsx)(V.Fragment,{children:e})}var Xn={root:`m_5f75b09e`,body:`m_5f6e695e`,labelWrapper:`m_d3ea56bb`,label:`m_8ee546b8`,description:`m_328f68c0`,error:`m_8e8a99cc`},Zn=Xn;function Qn({__staticSelector:e,__stylesApiProps:t,className:n,classNames:r,styles:i,unstyled:s,children:c,label:l,description:u,id:d,disabled:f,error:p,size:m,labelPosition:h=`left`,bodyElement:g=`div`,labelElement:_=`label`,variant:v,style:y,vars:b,mod:x,attributes:S,...C}){let w=a({name:e,props:t,className:n,style:y,classes:Xn,classNames:r,styles:i,unstyled:s,attributes:S}),T=u?`${d}-description`:void 0,E=p&&typeof p!=`boolean`?`${d}-error`:void 0;return(0,V.jsx)(o,{...w(`root`),__vars:{"--label-fz":L(m),"--label-lh":M(m,`label-lh`)},mod:[{"label-position":h},x],variant:v,size:m,...C,children:(0,V.jsxs)(o,{component:g,htmlFor:g===`label`?d:void 0,...w(`body`),children:[c,(0,V.jsxs)(`div`,{...w(`labelWrapper`),"data-disabled":f||void 0,children:[l&&(0,V.jsx)(o,{component:_,htmlFor:_===`label`?d:void 0,...w(`label`),"data-disabled":f||void 0,children:l}),u&&(0,V.jsx)(k.Description,{id:T,size:m,__inheritStyles:!1,...w(`description`),children:u}),p&&typeof p!=`boolean`&&(0,V.jsx)(k.Error,{id:E,size:m,__inheritStyles:!1,...w(`error`),children:p})]})]})})}Qn.displayName=`@mantine/core/InlineInput`;function $n(e){return`group`in e}function er({options:e,search:t,limit:n}){let r=t.trim().toLowerCase(),i=[];for(let a=0;a0)return!1;return!0}function nr(e,t=new Set){if(Array.isArray(e))for(let n of e)if($n(n))nr(n.items,t);else{if(n.value===void 0)throw Error(`[@mantine/core] Each option must have value property`);if(t.has(n.value))throw Error(`[@mantine/core] Duplicate options are not supported. Option with value "${n.value}" was provided more than once`);t.add(n.value)}}function rr(e,t){return Array.isArray(e)?e.includes(t):e===t}function ir({data:e,withCheckIcon:t,withAlignedLabels:n,value:r,checkIconPosition:i,unstyled:a,renderOption:o}){if(!$n(e)){let s=rr(r,e.value),c=t&&(s?(0,V.jsx)(qe,{className:vn.optionsDropdownCheckIcon}):n?(0,V.jsx)(`div`,{className:vn.optionsDropdownCheckPlaceholder}):null),l=(0,V.jsxs)(V.Fragment,{children:[i===`left`&&c,(0,V.jsx)(`span`,{children:e.label}),i===`right`&&c]});return(0,V.jsx)(Jn.Option,{value:e.value,disabled:e.disabled,className:_({[vn.optionsDropdownOption]:!a}),"data-reverse":i===`right`||void 0,"data-checked":s||void 0,"aria-selected":s,active:s,children:typeof o==`function`?o({option:e,checked:s}):l})}let s=e.items.map(e=>(0,V.jsx)(ir,{data:e,value:r,unstyled:a,withCheckIcon:t,withAlignedLabels:n,checkIconPosition:i,renderOption:o},`${e.value}`));return(0,V.jsx)(Jn.Group,{label:e.group,children:s})}function ar({data:e,hidden:t,hiddenWhenEmpty:n,filter:r,search:i,limit:a,maxDropdownHeight:o,floatingHeight:s,withScrollArea:c=!0,filterOptions:l=!0,withCheckIcon:u=!1,withAlignedLabels:d=!1,value:f,checkIconPosition:p,nothingFoundMessage:m,unstyled:h,labelId:g,renderOption:_,scrollAreaProps:v,"aria-label":y}){let b=Cn();nr(e);let x=typeof i==`string`?(r||er)({options:e,search:l?i:``,limit:a??1/0}):e,S=tr(x),C=x.map((e,t)=>(0,V.jsx)(ir,{data:e,withCheckIcon:u,withAlignedLabels:d,value:f,checkIconPosition:p,unstyled:h,renderOption:_},$n(e)?`group-${typeof e.group==`string`?e.group:t}`:`${e.value}`));return(0,V.jsx)(Jn.Dropdown,{hidden:t||n&&S,"data-composed":!0,children:(0,V.jsxs)(Jn.Options,{labelledBy:g,"aria-label":y,children:[c?(0,V.jsx)(me.Autosize,{mah:(s??b.floatingHeight)===`viewport`?`var(--combobox-floating-options-max-height)`:o??220,type:`scroll`,scrollbarSize:`var(--combobox-padding)`,offsetScrollbars:`y`,...v,children:C}):C,S&&m&&(0,V.jsx)(Jn.Empty,{children:m})]})})}function or(e,t,n,r){if(t===n||r===`before`&&n===t+1||r===`after`&&n===t-1)return e;let i=e.slice(),[a]=i.splice(t,1),o=t{let t=e.lastElementChild;return t?t instanceof HTMLInputElement?t:t.querySelector(`input`):null},cr=(e,t)=>{if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n{let e=i.current;e&&(i.current=null,cr(o.current,e.expectedValue)&&e.container?.querySelector(`[data-mantine-pill-index="${e.index}"]`)?.focus())});let s=(0,B.useCallback)(e=>{a.current=e},[]);return{getPillProps:e=>{if(n)return{draggable:!0,tabIndex:-1,"data-mantine-pill-index":e,"aria-keyshortcuts":`Alt+ArrowLeft Alt+ArrowRight`,onMouseDown:e=>{e.button===0&&e.stopPropagation()},onDragStart:t=>{t.stopPropagation(),t.dataTransfer.effectAllowed=`move`,t.dataTransfer.setData(`text/plain`,String(e)),r.current.draggedIndex=e;let n=t.currentTarget,i=n.getBoundingClientRect(),a=n.cloneNode(!0);a.removeAttribute(`data-dragging`),a.removeAttribute(`data-drag-over`),a.style.position=`fixed`,a.style.top=`-9999px`,a.style.left=`-9999px`,a.style.width=`${i.width}px`,a.style.height=`${i.height}px`,a.style.pointerEvents=`none`,document.body.appendChild(a),t.dataTransfer.setDragImage(a,t.clientX-i.left,t.clientY-i.top),setTimeout(()=>a.parentNode?.removeChild(a),0),requestAnimationFrame(()=>{n.setAttribute(`data-dragging`,`true`)})},onDragOver:t=>{let{draggedIndex:n}=r.current;if(n===null||n===e)return;let i=t.currentTarget,a=i.getBoundingClientRect(),o=t.clientX-a.left,s=(getComputedStyle(i).direction===`rtl`?o>a.width/2:o{let t=e.currentTarget,n=e.relatedTarget;n&&t.contains(n)||(t.removeAttribute(`data-drag-over`),r.current.currentDropTarget===t&&(r.current.currentDropTarget=null))},onDrop:n=>{n.preventDefault(),n.stopPropagation();let i=n.currentTarget,a=i.getAttribute(`data-drag-over`);i.removeAttribute(`data-drag-over`);let{draggedIndex:s}=r.current;if(s!==null&&a&&s!==e){let n=or(o.current,s,e,a);n!==o.current&&t(n)}r.current.draggedIndex=null,r.current.currentDropTarget=null},onDragEnd:e=>{e.currentTarget.removeAttribute(`data-dragging`);let t=r.current.currentDropTarget;t&&t.removeAttribute(`data-drag-over`),r.current.draggedIndex=null,r.current.currentDropTarget=null},onKeyDown:n=>{if(n.key!==`ArrowLeft`&&n.key!==`ArrowRight`)return;let r=n.currentTarget,a=getComputedStyle(r).direction===`rtl`?n.key===`ArrowLeft`:n.key===`ArrowRight`,s=a?e+1:e-1;if(n.altKey){if(s<0||s>=o.current.length)return;n.preventDefault(),n.stopPropagation();let c=a?`after`:`before`,l=or(o.current,e,s,c);if(l===o.current)return;i.current={container:r.parentElement,index:s,expectedValue:l},t(l);return}if(s<0)return;let c=r.parentElement;if(c){if(n.preventDefault(),n.stopPropagation(),s>=o.current.length){sr(c)?.focus();return}c.querySelector(`[data-mantine-pill-index="${s}"]`)?.focus()}}}},getListProps:()=>n?{ref:s}:{},handleInputKeyDown:e=>{if(!n||e.key!==`ArrowLeft`)return;let t=e.currentTarget;if(!(t.value.length===0||t.selectionStart===0&&t.selectionEnd===0))return;let r=a.current;if(!r)return;let i=r.querySelectorAll(`[data-mantine-pill-index]`);i.length!==0&&(e.preventDefault(),i[i.length-1].focus())}}}function ur({id:e,label:t,labelProps:n,inputWrapperOrder:r}){if(t&&(!r||r.includes(`label`)))return n?.id||`${e}-label`}function dr(e){let t=e.currentTarget;return Xt(t).activeElement!==t}var fr=(0,B.createContext)(null),pr={root:`m_7cda1cd6`,"root--default":`m_44da308b`,"root--contrast":`m_e3a01f8`,label:`m_1e0e6180`,remove:`m_ae386778`,group:`m_1dcfd90b`},mr=(0,B.createContext)(null),hr=g((e,{gap:t},{size:n})=>({group:{"--pg-gap":t===void 0?M(n,`pg-gap`):M(t)}})),gr=h(e=>{let t=u(`PillGroup`,null,e),{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:l,size:d,disabled:f,attributes:p,...m}=t,h=(0,B.use)(fr)?.size||d||void 0,g=a({name:`PillGroup`,classes:pr,props:t,className:r,style:i,classNames:n,styles:s,unstyled:c,attributes:p,vars:l,varsResolver:hr,stylesCtx:{size:h},rootSelector:`group`});return(0,V.jsx)(mr,{value:{size:h,disabled:f},children:(0,V.jsx)(o,{size:h,...g(`group`),...m})})});gr.classes=pr,gr.varsResolver=hr,gr.displayName=`@mantine/core/PillGroup`;var _r={variant:`default`},vr=g((e,{radius:t},{size:n})=>({root:{"--pill-fz":M(n,`pill-fz`),"--pill-height":M(n,`pill-height`),"--pill-radius":t===void 0?void 0:re(t)}})),yr=h(e=>{let t=u(`Pill`,_r,e),{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:l,variant:d,children:f,withRemoveButton:p,onRemove:m,removeButtonProps:h,radius:g,size:_,disabled:v,mod:y,attributes:b,...x}=t,S=(0,B.use)(mr),C=(0,B.use)(fr),w=_||S?.size||void 0,T=C?.variant===`filled`?`contrast`:d||`default`,E=a({name:`Pill`,classes:pr,props:t,className:r,style:i,classNames:n,styles:s,unstyled:c,attributes:b,vars:l,varsResolver:vr,stylesCtx:{size:w}});return(0,V.jsxs)(o,{component:`span`,variant:T,size:w,...E(`root`,{variant:T}),mod:[{"with-remove":p&&!v,disabled:v||S?.disabled},y],...x,children:[(0,V.jsx)(`span`,{...E(`label`),children:f}),p&&(0,V.jsx)(oe,{variant:`transparent`,radius:g,tabIndex:-1,"aria-hidden":!0,unstyled:c,...h,...E(`remove`,{className:h?.className,style:h?.style}),onMouseDown:e=>{e.preventDefault(),e.stopPropagation(),h?.onMouseDown?.(e)},onClick:e=>{e.stopPropagation(),m?.(),h?.onClick?.(e)}})]})});yr.classes=pr,yr.varsResolver=vr,yr.displayName=`@mantine/core/Pill`,yr.Group=gr;var br={field:`m_45c4369d`},xr={type:`visible`},Sr=h(e=>{let t=u(`PillsInputField`,xr,e),{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:l,type:d,disabled:f,id:p,pointer:m,mod:h,attributes:g,ref:_,...v}=t,y=(0,B.use)(fr),b=(0,B.use)(D),x=a({name:`PillsInputField`,classes:br,props:t,className:r,style:i,classNames:n,styles:s,unstyled:c,attributes:g,rootSelector:`field`}),S=f||y?.disabled;return(0,V.jsx)(o,{component:`input`,ref:ie(_,y?.fieldRef),"data-type":d,disabled:S,mod:[{disabled:S,pointer:m},h],...x(`field`),...v,id:b?.inputId||p,"aria-invalid":y?.hasError,"aria-describedby":b?.describedBy,type:`text`,onMouseDown:e=>!m&&e.stopPropagation()})});Sr.classes=br,Sr.displayName=`@mantine/core/PillsInputField`;var Cr={size:`sm`},wr=h(e=>{let{children:t,onMouseDown:n,onClick:r,size:i,disabled:a,__staticSelector:o,error:s,variant:c,...l}=u([`Input`,`InputWrapper`,`PillsInput`],Cr,e),d=(0,B.useRef)(null);return(0,V.jsx)(fr,{value:{fieldRef:d,size:i,disabled:a,hasError:!!s,variant:c},children:(0,V.jsx)(N,{size:i,error:s,variant:c,component:`div`,"data-no-overflow":!0,onMouseDown:e=>{e.preventDefault(),n?.(e),d.current?.focus()},onClick:e=>{e.preventDefault(),e.currentTarget.closest(`fieldset`)?.disabled||(d.current?.focus(),r?.(e))},...l,multiline:!0,disabled:a,__staticSelector:o||`PillsInput`,withAria:!1,children:t})})});wr.displayName=`@mantine/core/PillsInput`,wr.classes=N.classes,wr.Field=Sr;function Tr(e,t){let n=t.trim().toLowerCase();if(n===``)return;let r=Object.values(e).filter(e=>!e.disabled&&e.label.trim().toLowerCase()===n);return r.length===1?r[0]:void 0}function Er(e){return typeof e==`string`?e.trim().toLowerCase():e}function Dr({data:e,value:t}){let n=t.map(Er);return e.reduce((e,t)=>($n(t)?e.push({group:t.group,items:t.items.filter(e=>n.indexOf(Er(e.value))===-1)}):n.indexOf(Er(t.value))===-1&&e.push(t),e),[])}var Or={xs:41,sm:50,md:60,lg:72,xl:89},kr={maxValues:1/0,withCheckIcon:!0,checkIconPosition:`left`,hiddenInputValuesDivider:`,`,clearSearchOnChange:!0,openOnFocus:!0,size:`sm`},Ar=c(e=>{let t=u([`Input`,`InputWrapper`,`MultiSelect`],kr,e),{classNames:n,className:r,style:i,styles:o,unstyled:s,vars:c,size:l,value:f,defaultValue:p,onChange:m,onKeyDown:h,variant:g,data:_,dropdownOpened:v,defaultDropdownOpened:y,onDropdownOpen:b,onDropdownClose:x,selectFirstOptionOnChange:S,selectFirstOptionOnDropdownOpen:C,onOptionSubmit:w,comboboxProps:T,filter:E,limit:D,withScrollArea:O,maxDropdownHeight:k,floatingHeight:j,searchValue:M,defaultSearchValue:N,onSearchChange:P,readOnly:I,disabled:L,onFocus:ee,onBlur:te,radius:ne,rightSection:re,rightSectionWidth:ie,rightSectionPointerEvents:ae,rightSectionProps:R,leftSection:oe,leftSectionWidth:z,leftSectionPointerEvents:se,leftSectionProps:ce,inputContainer:le,inputWrapperOrder:ue,withAsterisk:de,labelProps:fe,descriptionProps:pe,errorProps:me,successProps:he,wrapperProps:ge,description:_e,label:ve,error:ye,success:be,maxValues:xe,searchable:Se,nothingFoundMessage:Ce,withCheckIcon:we,withAlignedLabels:Te,checkIconPosition:Ee,hidePickedOptions:De,withErrorStyles:Oe,withSuccessStyles:ke,name:Ae,form:je,id:Me,clearable:Ne,clearSectionMode:Pe,clearButtonProps:Fe,hiddenInputProps:Ie,placeholder:Le,hiddenInputValuesDivider:Re,required:ze,mod:Ve,renderOption:He,renderPill:Ue,onRemove:We,onClear:Ge,onMaxValues:Ke,scrollAreaProps:qe,chevronColor:Je,attributes:Ye,clearSearchOnChange:Xe,openOnFocus:Ze,loading:Qe,loadingPosition:$e,withPillsReorder:et,...tt}=t,nt=F(Me),rt=ur({id:nt,label:ve,labelProps:fe,inputWrapperOrder:ue}),it=gn(_),at=_n(it),ot=(0,B.useRef)({}),st=Gn({opened:v,defaultOpened:y,onDropdownOpen:()=>{b?.(),C&&st.selectFirstOption()},onDropdownClose:()=>{x?.(),st.resetSelectedOption()}}),{styleProps:ct,rest:{type:lt,autoComplete:ut,...dt}}=d(tt),[ft,pt]=Be({value:f,defaultValue:p,finalValue:[],onChange:m}),{getPillProps:mt,getListProps:ht,handleInputKeyDown:gt}=lr({value:ft,onChange:pt,enabled:et&&!L&&!I}),[_t,vt]=Be({value:M,defaultValue:N,finalValue:``,onChange:P}),yt=e=>{vt(e),st.resetSelectedOption()},bt=a({name:`MultiSelect`,classes:{},props:t,classNames:n,styles:o,unstyled:s,attributes:Ye}),{resolvedClassNames:xt,resolvedStyles:St}=A({props:t,styles:o,classNames:n}),Ct=e=>{h?.(e),!e.defaultPrevented&&(e.key===` `&&!Se&&(e.preventDefault(),st.toggleDropdown()),e.key===`Backspace`&&_t.length===0&&ft.length>0&&!I&&(We?.(ft[ft.length-1]),pt(ft.slice(0,ft.length-1))),gt(e))},wt=ft.map((e,t)=>{let n=at[`${e}`]||ot.current[`${e}`],r=mt(t);return Ue?(0,V.jsx)(B.Fragment,{children:Ue({option:n,value:e,onRemove:()=>{pt(ft.filter(t=>e!==t)),We?.(e)},disabled:L,reorderProps:r})},`${e}-${t}`):(0,V.jsx)(yr,{withRemoveButton:!I&&!at[`${e}`]?.disabled,onRemove:()=>{pt(ft.filter(t=>e!==t)),We?.(e)},unstyled:s,disabled:L,...bt(`pill`),...r,children:n?.label||e},`${e}-${t}`)});(0,B.useEffect)(()=>{S&&st.selectFirstOption()},[S,_t]),(0,B.useEffect)(()=>{ft.forEach(e=>{`${e}`in at&&(ot.current[`${e}`]=at[`${e}`])})},[at,ft]);let Tt=(0,V.jsx)(Jn.ClearButton,{...Fe,onClear:()=>{Ge?.(),pt([]),yt(``)}}),Et=Dr({data:it,value:ft}),Dt=Ne&&ft.length>0&&!L&&!I,Ot=Dt?{paddingInlineEnd:Or[l]??Or.sm}:void 0;return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(Jn,{store:st,classNames:xt,styles:St,unstyled:s,size:l,readOnly:I,__staticSelector:`MultiSelect`,attributes:Ye,floatingHeight:j,onOptionSubmit:e=>{w?.(e),Xe&&yt(``),st.updateSelectedOptionIndex(`selected`),ft.includes(at[`${e}`].value)?(pt(ft.filter(t=>t!==at[`${e}`].value)),We?.(at[`${e}`].value)):ft.lengthSe?st.openDropdown():st.toggleDropdown(),"data-expanded":st.dropdownOpened||void 0,id:nt,required:ze,mod:Ve,attributes:Ye,children:(0,V.jsxs)(yr.Group,{attributes:Ye,disabled:L,unstyled:s,...bt(`pillsList`,{style:Ot}),...ht(),children:[wt,(0,V.jsx)(Jn.EventsTarget,{autoComplete:ut,withExpandedAttribute:!0,children:(0,V.jsx)(wr.Field,{...dt,id:nt,placeholder:Le,type:!Se&&!Le?`hidden`:`visible`,...bt(`inputField`),unstyled:s,onFocus:e=>{ee?.(e),Ze&&Se&&st.openDropdown()},onBlur:e=>{te?.(e),st.closeDropdown(),yt(``)},onKeyDown:Ct,value:_t,onChange:e=>{if(dr(e)){if(!I){let t=Tr(at,e.currentTarget.value);t&&!ft.includes(t.value)&&ft.length{let{classNames:t,className:n,style:r,styles:i,vars:a,...s}=u(`ProgressLabel`,null,e),c=Mr();return(0,V.jsx)(o,{...c.getStyles(`label`,{className:n,style:r,classNames:t,styles:i}),...s})});Pr.classes=Nr,Pr.displayName=`@mantine/core/ProgressLabel`;var Fr=g((e,{size:t,radius:n,transitionDuration:r})=>({root:{"--progress-size":M(t,`progress-size`),"--progress-radius":n===void 0?void 0:re(n),"--progress-transition-duration":typeof r==`number`?`${r}ms`:void 0}})),Ir=h(e=>{let t=u(`ProgressRoot`,null,e),{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:l,autoContrast:d,transitionDuration:f,orientation:p,attributes:m,mod:h,...g}=t,_=a({name:`Progress`,classes:Nr,props:t,className:r,style:i,classNames:n,styles:s,unstyled:c,attributes:m,vars:l,varsResolver:Fr});return(0,V.jsx)(jr,{value:{getStyles:_,autoContrast:d},children:(0,V.jsx)(o,{mod:[{orientation:p},h],..._(`root`),...g})})});Ir.classes=Nr,Ir.varsResolver=Fr,Ir.displayName=`@mantine/core/ProgressRoot`;var Lr={withAria:!0},Rr=h(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,value:s,withAria:c,color:d,striped:p,animated:m,mod:h,...g}=u(`ProgressSection`,Lr,e),_=Mr(),v=f(),y=c?{role:`progressbar`,"aria-valuemax":100,"aria-valuemin":0,"aria-valuenow":s,"aria-valuetext":`${s}%`}:{};return(0,V.jsx)(o,{..._.getStyles(`section`,{className:n,classNames:t,styles:i,style:r}),...g,...y,mod:[{striped:p||m,animated:m},h],__vars:{"--progress-section-size":`${s}%`,"--progress-section-color":l(d,v),"--progress-label-color":Zt(_.autoContrast,v)?ct({color:d,theme:v,autoContrast:_.autoContrast}):void 0}})});Rr.classes=Nr,Rr.displayName=`@mantine/core/ProgressSection`;var zr=h(e=>{let t=u(`Progress`,null,e),{value:n,classNames:r,styles:i,vars:a,color:o,striped:s,animated:c,"aria-label":l,...d}=t,{resolvedClassNames:f,resolvedStyles:p}=A({classNames:r,styles:i,props:t});return(0,V.jsx)(Ir,{classNames:f,styles:p,vars:a,...d,children:(0,V.jsx)(Rr,{value:n,color:o,striped:s,animated:c,"aria-label":l})})});zr.classes=Nr,zr.displayName=`@mantine/core/Progress`,zr.Section=Rr,zr.Root=Ir,zr.Label=Pr;var Br={root:`m_cf365364`,indicator:`m_9e182ccd`,label:`m_1738fcb2`,input:`m_1714d588`,control:`m_69686b9b`,innerLabel:`m_78882f40`},Vr={withItemsBorders:!0},Hr=g((e,{radius:t,color:n,transitionDuration:r,size:i,transitionTimingFunction:a})=>({root:{"--sc-radius":t===void 0?void 0:re(t),"--sc-color":n?l(n,e):void 0,"--sc-shadow":n?void 0:`var(--mantine-shadow-xs)`,"--sc-transition-duration":r===void 0?void 0:`${r}ms`,"--sc-transition-timing-function":a,"--sc-padding":M(i,`sc-padding`),"--sc-font-size":L(i)}})),Ur=c(e=>{let t=u(`SegmentedControl`,Vr,e),{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:l,data:d,value:p,defaultValue:m,onChange:h,size:g,name:_,disabled:v,readOnly:y,fullWidth:b,orientation:x,radius:S,color:C,transitionDuration:w,transitionTimingFunction:T,variant:E,autoContrast:D,withItemsBorders:O,mod:k,attributes:A,ref:j,...M}=t,N=a({name:`SegmentedControl`,props:t,classes:Br,className:r,style:i,classNames:n,styles:s,unstyled:c,attributes:A,vars:l,varsResolver:Hr}),P=f(),I=d.map(e=>qt(e)?{label:`${e}`,value:e}:e),L=Kt(),[ee,te]=(0,B.useState)(0),[ne,re]=(0,B.useState)(null),[ae,R]=(0,B.useState)({}),oe=(e,t)=>{e!==null&&ae[t]!==e&&(ae[t]=e,R({...ae}))},[z,se]=Be({value:p,defaultValue:m,finalValue:Array.isArray(d)?I.find(e=>!e.disabled)?.value??d[0]?.value??null:null,onChange:h}),ce=F(_),le=I.map(e=>`${e.value}`),ue=I.map(e=>(0,B.createElement)(o,{...N(`control`),mod:{active:z===e.value,orientation:x},key:`${e.value}`},(0,B.createElement)(`input`,{...N(`input`),disabled:v||e.disabled,type:`radio`,name:ce,value:`${e.value}`,id:`${ce}-${e.value}`,checked:z===e.value,onChange:()=>!y&&se(e.value),"data-focus-ring":P.focusRing,key:`${e.value}-input`}),(0,B.createElement)(o,{component:`label`,...N(`label`),mod:{active:z===e.value&&!(v||e.disabled),disabled:v||e.disabled,"read-only":y},htmlFor:`${ce}-${e.value}`,ref:t=>oe(t,`${e.value}`),__vars:{"--sc-label-color":C===void 0?void 0:ct({color:C,theme:P,autoContrast:D})},key:`${e.value}-label`},(0,V.jsx)(`span`,{...N(`innerLabel`),children:e.label})))),de=ie(j,re);return Ht(()=>{te(e=>e+1)},[d.length]),Ht(()=>{R(e=>{let t={};return le.forEach(n=>{n in e&&(t[n]=e[n])}),Object.keys(t).length===Object.keys(e).length?e:t})},[le]),d.length===0?null:(0,V.jsxs)(o,{...N(`root`),variant:E,size:g,ref:de,mod:[{"full-width":b,orientation:x,initialized:L,"with-items-borders":O},k],...M,role:`radiogroup`,"data-disabled":v,children:[z!==void 0&&(0,V.jsx)(nn,{target:ae[`${z}`],parent:ne,component:`span`,transitionDuration:`var(--sc-transition-duration)`,...N(`indicator`)},ee),ue]})});Ur.classes=Br,Ur.varsResolver=Hr,Ur.displayName=`@mantine/core/SegmentedControl`;var Wr={size:`sm`,withCheckIcon:!0,allowDeselect:!0,checkIconPosition:`left`,openOnFocus:!0},Gr=c(e=>{let t=u([`Input`,`InputWrapper`,`Select`],Wr,e),{classNames:n,styles:r,unstyled:i,vars:a,dropdownOpened:o,defaultDropdownOpened:s,onDropdownClose:c,onDropdownOpen:l,onFocus:d,onBlur:f,onClick:p,onChange:m,data:h,value:g,defaultValue:_,selectFirstOptionOnChange:v,selectFirstOptionOnDropdownOpen:y,onOptionSubmit:b,comboboxProps:x,readOnly:S,disabled:C,filter:w,limit:T,withScrollArea:E,maxDropdownHeight:D,floatingHeight:O,size:k,searchable:j,rightSection:M,checkIconPosition:P,withCheckIcon:I,withAlignedLabels:L,nothingFoundMessage:ee,name:te,form:ne,searchValue:re,defaultSearchValue:ie,onSearchChange:ae,allowDeselect:R,error:oe,rightSectionPointerEvents:z,id:se,clearable:ce,clearSectionMode:le,clearButtonProps:ue,hiddenInputProps:de,renderOption:fe,onClear:pe,autoComplete:me,scrollAreaProps:he,__defaultRightSection:ge,__clearSection:_e,__clearable:ve,chevronColor:ye,autoSelectOnBlur:be,openOnFocus:xe,attributes:Se,...Ce}=t,we=(0,B.useMemo)(()=>gn(h),[h]),Te=(0,B.useRef)({}),Ee=(0,B.useMemo)(()=>_n(we),[we]),De=F(se),Oe=ur({id:De,label:Ce.label,labelProps:Ce.labelProps,inputWrapperOrder:Ce.inputWrapperOrder}),[ke,Ae,je]=Be({value:g,defaultValue:_,finalValue:null,onChange:m}),Me=ke==null?void 0:`${ke}`in Ee?Ee[`${ke}`]:Te.current[`${ke}`],Ne=Wt(Me),[Pe,Fe,Ie]=Be({value:re,defaultValue:ie,finalValue:Me?Me.label:``,onChange:ae}),Le=Gn({opened:o,defaultOpened:s,onDropdownOpen:()=>{l?.(),y?Le.selectFirstOption():Le.updateSelectedOptionIndex(`active`,{scrollIntoView:!0})},onDropdownClose:()=>{c?.(),setTimeout(Le.resetSelectedOption,0)}}),Re=e=>{Fe(e),Le.resetSelectedOption()},{resolvedClassNames:ze,resolvedStyles:Ve}=A({props:t,styles:r,classNames:n});(0,B.useEffect)(()=>{v&&Le.selectFirstOption()},[v,Pe]),(0,B.useEffect)(()=>{g===null&&Re(``),g!=null&&Me&&(Ne?.value!==Me.value||Ne?.label!==Me.label)&&Re(Me.label)},[g,Me]),(0,B.useEffect)(()=>{!je&&!Ie&&Re(ke==null?``:`${ke}`in Ee?Ee[`${ke}`]?.label:Te.current[`${ke}`]?.label||``)},[Ee,ke]),(0,B.useEffect)(()=>{ke&&`${ke}`in Ee&&(Te.current[`${ke}`]=Ee[`${ke}`])},[Ee,ke]);let He=(0,V.jsx)(Jn.ClearButton,{...ue,onClear:()=>{Ae(null,null),Re(``),pe?.()}}),Ue=ce&&ke!=null&&!C&&!S;return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(Jn,{store:Le,__staticSelector:`Select`,classNames:ze,styles:Ve,unstyled:i,readOnly:S,size:k,attributes:Se,floatingHeight:O,keepMounted:be,onOptionSubmit:e=>{b?.(e);let t=R&&`${Ee[e].value}`==`${ke}`?null:Ee[e],n=t?t.value:null;n!==ke&&Ae(n,t),!je&&Re(n==null?``:t?.label||``),Le.closeDropdown()},...x,children:[(0,V.jsx)(Jn.Target,{targetType:j?`input`:`button`,autoComplete:me,withExpandedAttribute:!0,children:(0,V.jsx)(N,{id:De,__defaultRightSection:(0,V.jsx)(Jn.Chevron,{size:k,error:oe,unstyled:i,color:ye}),__clearSection:He,__clearable:Ue,__clearSectionMode:le,rightSection:M,rightSectionPointerEvents:z||`none`,...Ce,size:k,__staticSelector:`Select`,disabled:C,readOnly:S||!j,value:Pe,onChange:e=>{if(dr(e)){if(!S){let t=Tr(Ee,e.currentTarget.value);t&&`${t.value}`!=`${ke}`&&(Ae(t.value,t),!je&&Re(t.label))}return}Re(e.currentTarget.value),Le.openDropdown(),v&&Le.selectFirstOption()},onFocus:e=>{xe&&j&&Le.openDropdown(),d?.(e)},onBlur:e=>{be&&Le.clickSelectedOption(),Le.closeDropdown();let t=ke!=null&&(`${ke}`in Ee?Ee[`${ke}`]:Te.current[`${ke}`]);Re(t&&t.label||``),f?.(e)},onClick:e=>{j?Le.openDropdown():Le.toggleDropdown(),p?.(e)},classNames:ze,styles:Ve,unstyled:i,pointer:!j,error:oe,attributes:Se})}),(0,V.jsx)(ar,{data:we,hidden:S||C,filter:w,search:Pe,limit:T,hiddenWhenEmpty:!ee,withScrollArea:E,maxDropdownHeight:D,filterOptions:!!j&&Me?.label!==Pe,value:ke,checkIconPosition:P,withCheckIcon:I,withAlignedLabels:L,nothingFoundMessage:ee,unstyled:i,labelId:Oe,"aria-label":Oe?void 0:Ce[`aria-label`],renderOption:fe,scrollAreaProps:he})]}),(0,V.jsx)(Jn.HiddenInput,{value:ke,name:te,form:ne,disabled:C,...de})]})});Gr.classes={...N.classes,...Jn.classes},Gr.displayName=`@mantine/core/Select`;function Kr(e){if(e!==void 0)return typeof e==`number`?P(e):e}function qr({spacing:e,verticalSpacing:t,cols:n,minColWidth:r,autoRows:i,selector:a}){let o=f(),s=t===void 0?e:t,c=r!==void 0,l=E({"--sg-spacing-x":R(Rt(e)),"--sg-spacing-y":R(Rt(s)),"--sg-auto-rows":i,...c?{"--sg-min-col-width":Kr(r)}:{"--sg-cols":Rt(n)?.toString()}}),u=O(o.breakpoints).reduce((t,r)=>(t[r]||(t[r]={}),typeof e==`object`&&e[r]!==void 0&&(t[r][`--sg-spacing-x`]=R(e[r])),typeof s==`object`&&s[r]!==void 0&&(t[r][`--sg-spacing-y`]=R(s[r])),!c&&typeof n==`object`&&n[r]!==void 0&&(t[r][`--sg-cols`]=n[r]),t),{}),d=Ke(O(u),o.breakpoints).filter(e=>O(u[e.value]).length>0).map(e=>({query:`(min-width: ${o.breakpoints[e.value]})`,styles:u[e.value]}));return(0,V.jsx)(j,{styles:l,media:d,selector:a})}function Jr(e){return typeof e==`object`&&e?O(e):[]}function Yr(e){return e.sort((e,t)=>Ge(e)-Ge(t))}function Xr({spacing:e,verticalSpacing:t,cols:n,minColWidth:r}){return Yr(Array.from(new Set([...Jr(e),...Jr(t),...r===void 0?Jr(n):[]])))}function Zr({spacing:e,verticalSpacing:t,cols:n,minColWidth:r,autoRows:i,selector:a}){let o=t===void 0?e:t,s=r!==void 0,c=E({"--sg-spacing-x":R(Rt(e)),"--sg-spacing-y":R(Rt(o)),"--sg-auto-rows":i,...s?{"--sg-min-col-width":Kr(r)}:{"--sg-cols":Rt(n)?.toString()}}),l=Xr({spacing:e,verticalSpacing:t,cols:n,minColWidth:r}),u=l.reduce((t,r)=>(t[r]||(t[r]={}),typeof e==`object`&&e[r]!==void 0&&(t[r][`--sg-spacing-x`]=R(e[r])),typeof o==`object`&&o[r]!==void 0&&(t[r][`--sg-spacing-y`]=R(o[r])),!s&&typeof n==`object`&&n[r]!==void 0&&(t[r][`--sg-cols`]=n[r]),t),{}),d=l.map(e=>({query:`simple-grid (min-width: ${e})`,styles:u[e]}));return(0,V.jsx)(j,{styles:c,container:d,selector:a})}var Qr={container:`m_925c2d2c`,root:`m_2415a157`},$r={cols:1,spacing:`md`,type:`media`},ei=h(e=>{let t=u(`SimpleGrid`,$r,e),{classNames:n,className:r,style:i,styles:c,unstyled:l,vars:d,cols:f,verticalSpacing:p,spacing:m,type:h,minColWidth:g,autoFlow:_,autoRows:v,attributes:y,...b}=t,x=a({name:`SimpleGrid`,classes:Qr,props:t,className:r,style:i,classNames:n,styles:c,unstyled:l,attributes:y,vars:d}),S=s(),C=g===void 0?void 0:_||`auto-fill`;return h===`container`?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Zr,{...t,selector:`.${S}`}),(0,V.jsx)(`div`,{...x(`container`),children:(0,V.jsx)(o,{...x(`root`,{className:S}),...b,"data-auto-cols":C})})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(qr,{...t,selector:`.${S}`}),(0,V.jsx)(o,{...x(`root`,{className:S}),...b,"data-auto-cols":C})]})});ei.classes=Qr,ei.displayName=`@mantine/core/SimpleGrid`;var ti=(0,B.createContext)(null),ni={hiddenInputValuesSeparator:`,`},ri=c((e=>{let{value:t,defaultValue:n,onChange:r,size:i,wrapperProps:a,children:o,readOnly:s,name:c,hiddenInputValuesSeparator:l,hiddenInputProps:d,maxSelectedValues:f,disabled:p,...m}=u(`SwitchGroup`,ni,e),[h,g]=Be({value:t,defaultValue:n,finalValue:[],onChange:r}),_=e=>{let t=e.currentTarget.value;if(s)return;let n=h.includes(t);!n&&f&&h.length>=f||g(n?h.filter(e=>e!==t):[...h,t])},v=e=>{if(p)return!0;if(!f)return!1;let t=h.includes(e),n=h.length>=f;return!t&&n},y=h.join(l);return(0,V.jsx)(ti,{value:{value:h,onChange:_,size:i,isDisabled:v},children:(0,V.jsxs)(k.Wrapper,{size:i,...a,...m,labelElement:`div`,__staticSelector:`SwitchGroup`,children:[(0,V.jsx)(Yn,{role:`group`,children:o}),(0,V.jsx)(`input`,{type:`hidden`,name:c,value:y,...d})]})})}));ri.classes=k.Wrapper.classes,ri.displayName=`@mantine/core/SwitchGroup`;var ii={root:`m_5f93f3bb`,input:`m_926b4011`,track:`m_9307d992`,thumb:`m_93039a1d`,trackLabel:`m_8277e082`},ai={labelPosition:`right`,withThumbIndicator:!0},oi=g((e,{radius:t,color:n,size:r})=>({root:{"--switch-radius":t===void 0?void 0:re(t),"--switch-height":M(r,`switch-height`),"--switch-width":M(r,`switch-width`),"--switch-thumb-size":M(r,`switch-thumb-size`),"--switch-label-font-size":M(r,`switch-label-font-size`),"--switch-track-label-padding":M(r,`switch-track-label-padding`),"--switch-color":n?l(n,e):void 0}})),si=h(e=>{let t=u(`Switch`,ai,e),{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:l,color:f,label:p,offLabel:m,onLabel:h,id:g,size:_,radius:v,wrapperProps:y,thumbIcon:b,checked:x,defaultChecked:S,onChange:C,labelPosition:w,description:T,error:E,disabled:D,variant:O,rootRef:k,mod:A,withThumbIndicator:j,attributes:M,...N}=t,P=(0,B.use)(ti),I=_||P?.size,L=a({name:`Switch`,props:t,classes:ii,className:r,style:i,classNames:n,styles:s,unstyled:c,attributes:M,vars:l,varsResolver:oi}),{styleProps:ee,rest:te}=d(N),ne=F(g),re=[T?`${ne}-description`:void 0,E&&typeof E!=`boolean`?`${ne}-error`:void 0,te[`aria-describedby`]].filter(Boolean).join(` `)||void 0,ie={checked:P?.value.includes(te.value)??x,onChange:e=>{P?.onChange(e),C?.(e)}},ae=D||P?.isDisabled?.(te.value),[R,oe]=Be({value:ie.checked??x,defaultValue:S,finalValue:!1});return(0,V.jsxs)(Qn,{...L(`root`),__staticSelector:`Switch`,__stylesApiProps:t,id:ne,size:I,labelPosition:w,label:p,description:T,error:E,disabled:ae,bodyElement:`label`,labelElement:`span`,classNames:n,styles:s,unstyled:c,"data-checked":ie.checked,variant:O,ref:k,mod:A,attributes:M,inert:te.inert,...ee,...y,children:[(0,V.jsx)(`input`,{...te,...ie,disabled:ae,checked:R,"data-checked":ie.checked,onChange:e=>{ie.onChange?.(e),oe(e.currentTarget.checked)},id:ne,type:`checkbox`,role:`switch`,inert:te.inert,"aria-describedby":re,...L(`input`)}),(0,V.jsxs)(o,{"aria-hidden":`true`,component:`span`,mod:{error:E,"label-position":w,"without-labels":!h&&!m},...L(`track`),children:[(0,V.jsx)(o,{component:`span`,mod:{"reduce-motion":!0,"with-thumb-indicator":j&&!b},...L(`thumb`),children:b}),(0,V.jsx)(`span`,{...L(`trackLabel`),children:R?h:m})]})]})});si.classes={...ii,...Zn},si.varsResolver=oi,si.displayName=`@mantine/core/Switch`,si.Group=ri;var ci=new Map([[`bold`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M244,56v48a12,12,0,0,1-12,12H184a12,12,0,1,1,0-24H201.1l-19-17.38c-.13-.12-.26-.24-.38-.37A76,76,0,1,0,127,204h1a75.53,75.53,0,0,0,52.15-20.72,12,12,0,0,1,16.49,17.45A99.45,99.45,0,0,1,128,228h-1.37A100,100,0,1,1,198.51,57.06L220,76.72V56a12,12,0,0,1,24,0Z`}))],[`duotone`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z`,opacity:`0.2`}),B.createElement(`path`,{d:`M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1,0-16H211.4L184.81,71.64l-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,0,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60L224,85.8V56a8,8,0,1,1,16,0Z`}))],[`fill`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1-5.66-13.66l17-17-10.55-9.65-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,1,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60l10.93,10L226.34,50.3A8,8,0,0,1,240,56Z`}))],[`light`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M238,56v48a6,6,0,0,1-6,6H184a6,6,0,0,1,0-12h32.55l-30.38-27.8c-.06-.06-.12-.13-.19-.19a82,82,0,1,0-1.7,117.65,6,6,0,0,1,8.24,8.73A93.46,93.46,0,0,1,128,222h-1.28A94,94,0,1,1,194.37,61.4L226,90.35V56a6,6,0,1,1,12,0Z`}))],[`regular`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1,0-16H211.4L184.81,71.64l-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,0,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60L224,85.8V56a8,8,0,1,1,16,0Z`}))],[`thin`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M236,56v48a4,4,0,0,1-4,4H184a4,4,0,0,1,0-8h37.7L187.53,68.69l-.13-.12a84,84,0,1,0-1.75,120.51,4,4,0,0,1,5.5,5.82A91.43,91.43,0,0,1,128,220h-1.26A92,92,0,1,1,193,62.84l35,32.05V56a4,4,0,1,1,8,0Z`}))]]),li=new Map([[`bold`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M228,128a100,100,0,0,1-98.66,100H128a99.39,99.39,0,0,1-68.62-27.29,12,12,0,0,1,16.48-17.45,76,76,0,1,0-1.57-109c-.13.13-.25.25-.39.37L54.89,92H72a12,12,0,0,1,0,24H24a12,12,0,0,1-12-12V56a12,12,0,0,1,24,0V76.72L57.48,57.06A100,100,0,0,1,228,128Z`}))],[`duotone`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z`,opacity:`0.2`}),B.createElement(`path`,{d:`M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L44.59,96H72a8,8,0,0,1,0,16H24a8,8,0,0,1-8-8V56a8,8,0,0,1,16,0V85.8L60.25,60A96,96,0,0,1,224,128Z`}))],[`fill`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L60.63,81.29l17,17A8,8,0,0,1,72,112H24a8,8,0,0,1-8-8V56A8,8,0,0,1,29.66,50.3L49.31,70,60.25,60A96,96,0,0,1,224,128Z`}))],[`light`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M222,128a94,94,0,0,1-92.74,94H128a93.43,93.43,0,0,1-64.5-25.65,6,6,0,1,1,8.24-8.72A82,82,0,1,0,70,70l-.19.19L39.44,98H72a6,6,0,0,1,0,12H24a6,6,0,0,1-6-6V56a6,6,0,0,1,12,0V90.34L61.63,61.4A94,94,0,0,1,222,128Z`}))],[`regular`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L44.59,96H72a8,8,0,0,1,0,16H24a8,8,0,0,1-8-8V56a8,8,0,0,1,16,0V85.8L60.25,60A96,96,0,0,1,224,128Z`}))],[`thin`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M220,128a92,92,0,0,1-90.77,92H128a91.47,91.47,0,0,1-63.13-25.1,4,4,0,1,1,5.5-5.82A84,84,0,1,0,68.6,68.57l-.13.12L34.3,100H72a4,4,0,0,1,0,8H24a4,4,0,0,1-4-4V56a4,4,0,0,1,8,0V94.89l35-32A92,92,0,0,1,220,128Z`}))]]),ui=new Map([[`bold`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M220,48V96a12,12,0,0,1-24,0V77l-35.51,35.52a12,12,0,0,1-17-17L179,60H160a12,12,0,0,1,0-24h48A12,12,0,0,1,220,48ZM95.51,143.51,60,179V160a12,12,0,0,0-24,0v48a12,12,0,0,0,12,12H96a12,12,0,0,0,0-24H77l35.52-35.51a12,12,0,0,0-17-17ZM208,148a12,12,0,0,0-12,12v19l-35.51-35.52a12,12,0,0,0-17,17L179,196H160a12,12,0,0,0,0,24h48a12,12,0,0,0,12-12V160A12,12,0,0,0,208,148ZM77,60H96a12,12,0,0,0,0-24H48A12,12,0,0,0,36,48V96a12,12,0,0,0,24,0V77l35.51,35.52a12,12,0,0,0,17-17Z`}))],[`duotone`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M208,48V208H48V48Z`,opacity:`0.2`}),B.createElement(`path`,{d:`M216,48V96a8,8,0,0,1-16,0V67.31l-42.34,42.35a8,8,0,0,1-11.32-11.32L188.69,56H160a8,8,0,0,1,0-16h48A8,8,0,0,1,216,48ZM98.34,146.34,56,188.69V160a8,8,0,0,0-16,0v48a8,8,0,0,0,8,8H96a8,8,0,0,0,0-16H67.31l42.35-42.34a8,8,0,0,0-11.32-11.32ZM208,152a8,8,0,0,0-8,8v28.69l-42.34-42.35a8,8,0,0,0-11.32,11.32L188.69,200H160a8,8,0,0,0,0,16h48a8,8,0,0,0,8-8V160A8,8,0,0,0,208,152ZM67.31,56H96a8,8,0,0,0,0-16H48a8,8,0,0,0-8,8V96a8,8,0,0,0,16,0V67.31l42.34,42.35a8,8,0,0,0,11.32-11.32Z`}))],[`fill`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M109.66,146.34a8,8,0,0,1,0,11.32L83.31,184l18.35,18.34A8,8,0,0,1,96,216H48a8,8,0,0,1-8-8V160a8,8,0,0,1,13.66-5.66L72,172.69l26.34-26.35A8,8,0,0,1,109.66,146.34ZM83.31,72l18.35-18.34A8,8,0,0,0,96,40H48a8,8,0,0,0-8,8V96a8,8,0,0,0,13.66,5.66L72,83.31l26.34,26.35a8,8,0,0,0,11.32-11.32ZM208,40H160a8,8,0,0,0-5.66,13.66L172.69,72,146.34,98.34a8,8,0,0,0,11.32,11.32L184,83.31l18.34,18.35A8,8,0,0,0,216,96V48A8,8,0,0,0,208,40Zm3.06,112.61a8,8,0,0,0-8.72,1.73L184,172.69l-26.34-26.35a8,8,0,0,0-11.32,11.32L172.69,184l-18.35,18.34A8,8,0,0,0,160,216h48a8,8,0,0,0,8-8V160A8,8,0,0,0,211.06,152.61Z`}))],[`light`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M214,48V96a6,6,0,0,1-12,0V62.48l-45.76,45.76a6,6,0,0,1-8.48-8.48L193.52,54H160a6,6,0,0,1,0-12h48A6,6,0,0,1,214,48ZM99.76,147.76,54,193.52V160a6,6,0,0,0-12,0v48a6,6,0,0,0,6,6H96a6,6,0,0,0,0-12H62.48l45.76-45.76a6,6,0,0,0-8.48-8.48ZM208,154a6,6,0,0,0-6,6v33.52l-45.76-45.76a6,6,0,0,0-8.48,8.48L193.52,202H160a6,6,0,0,0,0,12h48a6,6,0,0,0,6-6V160A6,6,0,0,0,208,154ZM62.48,54H96a6,6,0,0,0,0-12H48a6,6,0,0,0-6,6V96a6,6,0,0,0,12,0V62.48l45.76,45.76a6,6,0,0,0,8.48-8.48Z`}))],[`regular`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M216,48V96a8,8,0,0,1-16,0V67.31l-42.34,42.35a8,8,0,0,1-11.32-11.32L188.69,56H160a8,8,0,0,1,0-16h48A8,8,0,0,1,216,48ZM98.34,146.34,56,188.69V160a8,8,0,0,0-16,0v48a8,8,0,0,0,8,8H96a8,8,0,0,0,0-16H67.31l42.35-42.34a8,8,0,0,0-11.32-11.32ZM208,152a8,8,0,0,0-8,8v28.69l-42.34-42.35a8,8,0,0,0-11.32,11.32L188.69,200H160a8,8,0,0,0,0,16h48a8,8,0,0,0,8-8V160A8,8,0,0,0,208,152ZM67.31,56H96a8,8,0,0,0,0-16H48a8,8,0,0,0-8,8V96a8,8,0,0,0,16,0V67.31l42.34,42.35a8,8,0,0,0,11.32-11.32Z`}))],[`thin`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M212,48V96a4,4,0,0,1-8,0V57.66l-49.17,49.17a4,4,0,0,1-5.66-5.66L198.34,52H160a4,4,0,0,1,0-8h48A4,4,0,0,1,212,48ZM101.17,149.17,52,198.34V160a4,4,0,0,0-8,0v48a4,4,0,0,0,4,4H96a4,4,0,0,0,0-8H57.66l49.17-49.17a4,4,0,0,0-5.66-5.66ZM208,156a4,4,0,0,0-4,4v38.34l-49.17-49.17a4,4,0,0,0-5.66,5.66L198.34,204H160a4,4,0,0,0,0,8h48a4,4,0,0,0,4-4V160A4,4,0,0,0,208,156ZM57.66,52H96a4,4,0,0,0,0-8H48a4,4,0,0,0-4,4V96a4,4,0,0,0,8,0V57.66l49.17,49.17a4,4,0,0,0,5.66-5.66Z`}))]]),di=new Map([[`bold`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M216.49,168.49a12,12,0,0,1-17,0L128,97,56.49,168.49a12,12,0,0,1-17-17l80-80a12,12,0,0,1,17,0l80,80A12,12,0,0,1,216.49,168.49Z`}))],[`duotone`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M208,160H48l80-80Z`,opacity:`0.2`}),B.createElement(`path`,{d:`M213.66,154.34l-80-80a8,8,0,0,0-11.32,0l-80,80A8,8,0,0,0,48,168H208a8,8,0,0,0,5.66-13.66ZM67.31,152,128,91.31,188.69,152Z`}))],[`fill`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M215.39,163.06A8,8,0,0,1,208,168H48a8,8,0,0,1-5.66-13.66l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,215.39,163.06Z`}))],[`light`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M212.24,164.24a6,6,0,0,1-8.48,0L128,88.49,52.24,164.24a6,6,0,0,1-8.48-8.48l80-80a6,6,0,0,1,8.48,0l80,80A6,6,0,0,1,212.24,164.24Z`}))],[`regular`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M213.66,165.66a8,8,0,0,1-11.32,0L128,91.31,53.66,165.66a8,8,0,0,1-11.32-11.32l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,213.66,165.66Z`}))],[`thin`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M210.83,162.83a4,4,0,0,1-5.66,0L128,85.66,50.83,162.83a4,4,0,0,1-5.66-5.66l80-80a4,4,0,0,1,5.66,0l80,80A4,4,0,0,1,210.83,162.83Z`}))]]),fi=new Map([[`bold`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M172,108a12,12,0,0,1-12,12H96a12,12,0,0,1,0-24h64A12,12,0,0,1,172,108Zm-12,28H96a12,12,0,0,0,0,24h64a12,12,0,0,0,0-24Zm76-8A108,108,0,0,1,78.77,224.15L46.34,235A20,20,0,0,1,21,209.66l10.81-32.43A108,108,0,1,1,236,128Zm-24,0A84,84,0,1,0,55.27,170.06a12,12,0,0,1,1,9.81l-9.93,29.79,29.79-9.93a12.1,12.1,0,0,1,3.8-.62,12,12,0,0,1,6,1.62A84,84,0,0,0,212,128Z`}))],[`duotone`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M224,128A96,96,0,0,1,79.93,211.11h0L42.54,223.58a8,8,0,0,1-10.12-10.12l12.47-37.39h0A96,96,0,1,1,224,128Z`,opacity:`0.2`}),B.createElement(`path`,{d:`M128,24A104,104,0,0,0,36.18,176.88L24.83,210.93a16,16,0,0,0,20.24,20.24l34.05-11.35A104,104,0,1,0,128,24Zm0,192a87.87,87.87,0,0,1-44.06-11.81,8,8,0,0,0-4-1.08,7.85,7.85,0,0,0-2.53.42L40,216,52.47,178.6a8,8,0,0,0-.66-6.54A88,88,0,1,1,128,216Zm40-104a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,112Zm0,32a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,144Z`}))],[`fill`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M128,24A104,104,0,0,0,36.18,176.88L24.83,210.93a16,16,0,0,0,20.24,20.24l34.05-11.35A104,104,0,1,0,128,24Zm32,128H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Zm0-32H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Z`}))],[`light`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M166,112a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,112Zm-6,26H96a6,6,0,0,0,0,12h64a6,6,0,0,0,0-12Zm70-10A102,102,0,0,1,79.31,217.65L44.44,229.27a14,14,0,0,1-17.71-17.71l11.62-34.87A102,102,0,1,1,230,128Zm-12,0A90,90,0,1,0,50.08,173.06a6,6,0,0,1,.5,4.91L38.12,215.35a2,2,0,0,0,2.53,2.53L78,205.42a6.2,6.2,0,0,1,1.9-.31,6.09,6.09,0,0,1,3,.81A90,90,0,0,0,218,128Z`}))],[`regular`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M168,112a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,112Zm-8,24H96a8,8,0,0,0,0,16h64a8,8,0,0,0,0-16Zm72-8A104,104,0,0,1,79.12,219.82L45.07,231.17a16,16,0,0,1-20.24-20.24l11.35-34.05A104,104,0,1,1,232,128Zm-16,0A88,88,0,1,0,51.81,172.06a8,8,0,0,1,.66,6.54L40,216,77.4,203.53a7.85,7.85,0,0,1,2.53-.42,8,8,0,0,1,4,1.08A88,88,0,0,0,216,128Z`}))],[`thin`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M164,112a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,112Zm-4,28H96a4,4,0,0,0,0,8h64a4,4,0,0,0,0-8Zm68-12A100,100,0,0,1,79.5,215.47l-35.69,11.9a12,12,0,0,1-15.18-15.18l11.9-35.69A100,100,0,1,1,228,128Zm-8,0A92,92,0,1,0,48.35,174.07a4,4,0,0,1,.33,3.27L36.22,214.72a4,4,0,0,0,5.06,5.06l37.38-12.46a3.93,3.93,0,0,1,1.27-.21,4.05,4.05,0,0,1,2,.54A92,92,0,0,0,220,128Z`}))]]),pi=new Map([[`bold`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm0,192a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,212Zm68-84a12,12,0,0,1-12,12H128a12,12,0,0,1-12-12V72a12,12,0,0,1,24,0v44h44A12,12,0,0,1,196,128Z`}))],[`duotone`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),B.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm64-88a8,8,0,0,1-8,8H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48h48A8,8,0,0,1,192,128Z`}))],[`fill`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm56,112H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48h48a8,8,0,0,1,0,16Z`}))],[`light`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm0,192a90,90,0,1,1,90-90A90.1,90.1,0,0,1,128,218Zm62-90a6,6,0,0,1-6,6H128a6,6,0,0,1-6-6V72a6,6,0,0,1,12,0v50h50A6,6,0,0,1,190,128Z`}))],[`regular`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm64-88a8,8,0,0,1-8,8H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48h48A8,8,0,0,1,192,128Z`}))],[`thin`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28Zm0,192a92,92,0,1,1,92-92A92.1,92.1,0,0,1,128,220Zm60-92a4,4,0,0,1-4,4H128a4,4,0,0,1-4-4V72a4,4,0,0,1,8,0v52h52A4,4,0,0,1,188,128Z`}))]]),mi=new Map([[`bold`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M140,80v41.21l34.17,20.5a12,12,0,1,1-12.34,20.58l-40-24A12,12,0,0,1,116,128V80a12,12,0,0,1,24,0ZM128,28A99.38,99.38,0,0,0,57.24,57.34c-4.69,4.74-9,9.37-13.24,14V64a12,12,0,0,0-24,0v40a12,12,0,0,0,12,12H72a12,12,0,0,0,0-24H57.77C63,86,68.37,80.22,74.26,74.26a76,76,0,1,1,1.58,109,12,12,0,0,0-16.48,17.46A100,100,0,1,0,128,28Z`}))],[`duotone`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z`,opacity:`0.2`}),B.createElement(`path`,{d:`M136,80v43.47l36.12,21.67a8,8,0,0,1-8.24,13.72l-40-24A8,8,0,0,1,120,128V80a8,8,0,0,1,16,0Zm-8-48A95.44,95.44,0,0,0,60.08,60.15C52.81,67.51,46.35,74.59,40,82V64a8,8,0,0,0-16,0v40a8,8,0,0,0,8,8H72a8,8,0,0,0,0-16H49c7.15-8.42,14.27-16.35,22.39-24.57a80,80,0,1,1,1.66,114.75,8,8,0,1,0-11,11.64A96,96,0,1,0,128,32Z`}))],[`fill`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M224,128A96,96,0,0,1,62.11,197.82a8,8,0,1,1,11-11.64A80,80,0,1,0,71.43,71.43C67.9,75,64.58,78.51,61.35,82L77.66,98.34A8,8,0,0,1,72,112H32a8,8,0,0,1-8-8V64a8,8,0,0,1,13.66-5.66L50,70.7c3.22-3.49,6.54-7,10.06-10.55A96,96,0,0,1,224,128ZM128,72a8,8,0,0,0-8,8v48a8,8,0,0,0,3.88,6.86l40,24a8,8,0,1,0,8.24-13.72L136,123.47V80A8,8,0,0,0,128,72Z`}))],[`light`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M134,80v44.6l37.09,22.25a6,6,0,0,1-6.18,10.3l-40-24A6,6,0,0,1,122,128V80a6,6,0,0,1,12,0Zm-6-46A93.4,93.4,0,0,0,61.51,61.56c-8.58,8.68-16,17-23.51,25.8V64a6,6,0,0,0-12,0v40a6,6,0,0,0,6,6H72a6,6,0,0,0,0-12H44.73C52.86,88.29,60.79,79.35,70,70a82,82,0,1,1,1.7,117.62,6,6,0,1,0-8.24,8.72A94,94,0,1,0,128,34Z`}))],[`regular`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M136,80v43.47l36.12,21.67a8,8,0,0,1-8.24,13.72l-40-24A8,8,0,0,1,120,128V80a8,8,0,0,1,16,0Zm-8-48A95.44,95.44,0,0,0,60.08,60.15C52.81,67.51,46.35,74.59,40,82V64a8,8,0,0,0-16,0v40a8,8,0,0,0,8,8H72a8,8,0,0,0,0-16H49c7.15-8.42,14.27-16.35,22.39-24.57a80,80,0,1,1,1.66,114.75,8,8,0,1,0-11,11.64A96,96,0,1,0,128,32Z`}))],[`thin`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M132,80v45.74l38.06,22.83a4,4,0,0,1-4.12,6.86l-40-24A4,4,0,0,1,124,128V80a4,4,0,0,1,8,0Zm-4-44A91.42,91.42,0,0,0,62.93,63C53.05,73,44.66,82.47,36,92.86V64a4,4,0,0,0-8,0v40a4,4,0,0,0,4,4H72a4,4,0,0,0,0-8H40.47C49.61,89,58.3,79,68.6,68.6a84,84,0,1,1,1.75,120.49,4,4,0,1,0-5.5,5.82A92,92,0,1,0,128,36Z`}))]]),hi=new Map([[`bold`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M108,84a16,16,0,1,1,16,16A16,16,0,0,1,108,84Zm128,44A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-24,0a84,84,0,1,0-84,84A84.09,84.09,0,0,0,212,128Zm-72,36.68V132a20,20,0,0,0-20-20,12,12,0,0,0-4,23.32V168a20,20,0,0,0,20,20,12,12,0,0,0,4-23.32Z`}))],[`duotone`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),B.createElement(`path`,{d:`M144,176a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176Zm88-48A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128ZM124,96a12,12,0,1,0-12-12A12,12,0,0,0,124,96Z`}))],[`fill`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm-4,48a12,12,0,1,1-12,12A12,12,0,0,1,124,72Zm12,112a16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40a8,8,0,0,1,0,16Z`}))],[`light`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M142,176a6,6,0,0,1-6,6,14,14,0,0,1-14-14V128a2,2,0,0,0-2-2,6,6,0,0,1,0-12,14,14,0,0,1,14,14v40a2,2,0,0,0,2,2A6,6,0,0,1,142,176ZM124,94a10,10,0,1,0-10-10A10,10,0,0,0,124,94Zm106,34A102,102,0,1,1,128,26,102.12,102.12,0,0,1,230,128Zm-12,0a90,90,0,1,0-90,90A90.1,90.1,0,0,0,218,128Z`}))],[`regular`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z`}))],[`thin`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M140,176a4,4,0,0,1-4,4,12,12,0,0,1-12-12V128a4,4,0,0,0-4-4,4,4,0,0,1,0-8,12,12,0,0,1,12,12v40a4,4,0,0,0,4,4A4,4,0,0,1,140,176ZM124,92a8,8,0,1,0-8-8A8,8,0,0,0,124,92Zm104,36A100,100,0,1,1,128,28,100.11,100.11,0,0,1,228,128Zm-8,0a92,92,0,1,0-92,92A92.1,92.1,0,0,0,220,128Z`}))]]),gi=new Map([[`bold`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M224,44H32A20,20,0,0,0,12,64V192a20,20,0,0,0,20,20H224a20,20,0,0,0,20-20V64A20,20,0,0,0,224,44Zm-4,144H36V68H220ZM52,128a12,12,0,0,1,12-12H192a12,12,0,0,1,0,24H64A12,12,0,0,1,52,128Zm0-36A12,12,0,0,1,64,80H192a12,12,0,0,1,0,24H64A12,12,0,0,1,52,92Zm0,72a12,12,0,0,1,12-12h8a12,12,0,0,1,0,24H64A12,12,0,0,1,52,164Zm108,0a12,12,0,0,1-12,12H108a12,12,0,0,1,0-24h40A12,12,0,0,1,160,164Zm44,0a12,12,0,0,1-12,12h-8a12,12,0,0,1,0-24h8A12,12,0,0,1,204,164Z`}))],[`duotone`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M232,64V192a8,8,0,0,1-8,8H32a8,8,0,0,1-8-8V64a8,8,0,0,1,8-8H224A8,8,0,0,1,232,64Z`,opacity:`0.2`}),B.createElement(`path`,{d:`M224,48H32A16,16,0,0,0,16,64V192a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V64A16,16,0,0,0,224,48Zm0,144H32V64H224V192Zm-16-64a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16H200A8,8,0,0,1,208,128Zm0-32a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16H200A8,8,0,0,1,208,96ZM72,160a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16h8A8,8,0,0,1,72,160Zm96,0a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,160Zm40,0a8,8,0,0,1-8,8h-8a8,8,0,0,1,0-16h8A8,8,0,0,1,208,160Z`}))],[`fill`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M224,48H32A16,16,0,0,0,16,64V192a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V64A16,16,0,0,0,224,48ZM64,168H48a8,8,0,0,1,0-16H64a8,8,0,0,1,0,16Zm96,0H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Zm48,0H192a8,8,0,0,1,0-16h16a8,8,0,0,1,0,16Zm0-32H48a8,8,0,0,1,0-16H208a8,8,0,0,1,0,16Zm0-32H48a8,8,0,0,1,0-16H208a8,8,0,0,1,0,16Z`}))],[`light`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M224,50H32A14,14,0,0,0,18,64V192a14,14,0,0,0,14,14H224a14,14,0,0,0,14-14V64A14,14,0,0,0,224,50Zm2,142a2,2,0,0,1-2,2H32a2,2,0,0,1-2-2V64a2,2,0,0,1,2-2H224a2,2,0,0,1,2,2Zm-20-64a6,6,0,0,1-6,6H56a6,6,0,0,1,0-12H200A6,6,0,0,1,206,128Zm0-32a6,6,0,0,1-6,6H56a6,6,0,0,1,0-12H200A6,6,0,0,1,206,96ZM70,160a6,6,0,0,1-6,6H56a6,6,0,0,1,0-12h8A6,6,0,0,1,70,160Zm96,0a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,160Zm40,0a6,6,0,0,1-6,6h-8a6,6,0,0,1,0-12h8A6,6,0,0,1,206,160Z`}))],[`regular`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M224,48H32A16,16,0,0,0,16,64V192a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V64A16,16,0,0,0,224,48Zm0,144H32V64H224V192Zm-16-64a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16H200A8,8,0,0,1,208,128Zm0-32a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16H200A8,8,0,0,1,208,96ZM72,160a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16h8A8,8,0,0,1,72,160Zm96,0a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,160Zm40,0a8,8,0,0,1-8,8h-8a8,8,0,0,1,0-16h8A8,8,0,0,1,208,160Z`}))],[`thin`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M224,52H32A12,12,0,0,0,20,64V192a12,12,0,0,0,12,12H224a12,12,0,0,0,12-12V64A12,12,0,0,0,224,52Zm4,140a4,4,0,0,1-4,4H32a4,4,0,0,1-4-4V64a4,4,0,0,1,4-4H224a4,4,0,0,1,4,4Zm-24-64a4,4,0,0,1-4,4H56a4,4,0,0,1,0-8H200A4,4,0,0,1,204,128Zm0-32a4,4,0,0,1-4,4H56a4,4,0,0,1,0-8H200A4,4,0,0,1,204,96ZM68,160a4,4,0,0,1-4,4H56a4,4,0,0,1,0-8h8A4,4,0,0,1,68,160Zm96,0a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,160Zm40,0a4,4,0,0,1-4,4h-8a4,4,0,0,1,0-8h8A4,4,0,0,1,204,160Z`}))]]),_i=new Map([[`bold`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M76,64A12,12,0,0,1,88,52H216a12,12,0,0,1,0,24H88A12,12,0,0,1,76,64Zm140,52H88a12,12,0,0,0,0,24H216a12,12,0,0,0,0-24Zm0,64H88a12,12,0,0,0,0,24H216a12,12,0,0,0,0-24ZM44,112a16,16,0,1,0,16,16A16,16,0,0,0,44,112Zm0-64A16,16,0,1,0,60,64,16,16,0,0,0,44,48Zm0,128a16,16,0,1,0,16,16A16,16,0,0,0,44,176Z`}))],[`duotone`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M216,64V192H88V64Z`,opacity:`0.2`}),B.createElement(`path`,{d:`M80,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H88A8,8,0,0,1,80,64Zm136,56H88a8,8,0,1,0,0,16H216a8,8,0,0,0,0-16Zm0,64H88a8,8,0,1,0,0,16H216a8,8,0,0,0,0-16ZM44,52A12,12,0,1,0,56,64,12,12,0,0,0,44,52Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,116Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,180Z`}))],[`fill`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM68,188a12,12,0,1,1,12-12A12,12,0,0,1,68,188Zm0-48a12,12,0,1,1,12-12A12,12,0,0,1,68,140Zm0-48A12,12,0,1,1,80,80,12,12,0,0,1,68,92Zm124,92H104a8,8,0,0,1,0-16h88a8,8,0,0,1,0,16Zm0-48H104a8,8,0,0,1,0-16h88a8,8,0,0,1,0,16Zm0-48H104a8,8,0,0,1,0-16h88a8,8,0,0,1,0,16Z`}))],[`light`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M82,64a6,6,0,0,1,6-6H216a6,6,0,0,1,0,12H88A6,6,0,0,1,82,64Zm134,58H88a6,6,0,0,0,0,12H216a6,6,0,0,0,0-12Zm0,64H88a6,6,0,0,0,0,12H216a6,6,0,0,0,0-12ZM44,54A10,10,0,1,0,54,64,10,10,0,0,0,44,54Zm0,128a10,10,0,1,0,10,10A10,10,0,0,0,44,182Zm0-64a10,10,0,1,0,10,10A10,10,0,0,0,44,118Z`}))],[`regular`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M80,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H88A8,8,0,0,1,80,64Zm136,56H88a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm0,64H88a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16ZM44,52A12,12,0,1,0,56,64,12,12,0,0,0,44,52Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,116Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,180Z`}))],[`thin`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M84,64a4,4,0,0,1,4-4H216a4,4,0,0,1,0,8H88A4,4,0,0,1,84,64Zm132,60H88a4,4,0,0,0,0,8H216a4,4,0,0,0,0-8Zm0,64H88a4,4,0,0,0,0,8H216a4,4,0,0,0,0-8ZM44,120a8,8,0,1,0,8,8A8,8,0,0,0,44,120Zm0-64a8,8,0,1,0,8,8A8,8,0,0,0,44,56Zm0,128a8,8,0,1,0,8,8A8,8,0,0,0,44,184Z`}))]]),vi=new Map([[`bold`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M28,64A12,12,0,0,1,40,52H216a12,12,0,0,1,0,24H40A12,12,0,0,1,28,64Zm12,76h64a12,12,0,0,0,0-24H40a12,12,0,0,0,0,24Zm80,40H40a12,12,0,0,0,0,24h80a12,12,0,0,0,0-24Zm120.49,20.49a12,12,0,0,1-17,0l-18.08-18.08a44,44,0,1,1,17-17l18.08,18.07A12,12,0,0,1,240.49,200.49ZM184,164a20,20,0,1,0-20-20A20,20,0,0,0,184,164Z`}))],[`duotone`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M216,144a32,32,0,1,1-32-32A32,32,0,0,1,216,144Z`,opacity:`0.2`}),B.createElement(`path`,{d:`M32,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H40A8,8,0,0,1,32,64Zm8,72h72a8,8,0,0,0,0-16H40a8,8,0,0,0,0,16Zm88,48H40a8,8,0,0,0,0,16h88a8,8,0,0,0,0-16Zm109.66,13.66a8,8,0,0,1-11.32,0L206,177.36A40,40,0,1,1,217.36,166l20.3,20.3A8,8,0,0,1,237.66,197.66ZM184,168a24,24,0,1,0-24-24A24,24,0,0,0,184,168Z`}))],[`fill`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M32,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H40A8,8,0,0,1,32,64Zm8,72h72a8,8,0,0,0,0-16H40a8,8,0,0,0,0,16Zm88,48H40a8,8,0,0,0,0,16h88a8,8,0,0,0,0-16Zm109.66,2.34L217.36,166A40,40,0,1,0,206,177.36l20.3,20.3a8,8,0,0,0,11.32-11.32Z`}))],[`light`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M34,64a6,6,0,0,1,6-6H216a6,6,0,0,1,0,12H40A6,6,0,0,1,34,64Zm6,70h72a6,6,0,0,0,0-12H40a6,6,0,0,0,0,12Zm88,52H40a6,6,0,0,0,0,12h88a6,6,0,0,0,0-12Zm108.24,10.24a6,6,0,0,1-8.48,0l-21.49-21.48a38.06,38.06,0,1,1,8.49-8.49l21.48,21.49A6,6,0,0,1,236.24,196.24ZM184,170a26,26,0,1,0-26-26A26,26,0,0,0,184,170Z`}))],[`regular`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M32,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H40A8,8,0,0,1,32,64Zm8,72h72a8,8,0,0,0,0-16H40a8,8,0,0,0,0,16Zm88,48H40a8,8,0,0,0,0,16h88a8,8,0,0,0,0-16Zm109.66,13.66a8,8,0,0,1-11.32,0L206,177.36A40,40,0,1,1,217.36,166l20.3,20.3A8,8,0,0,1,237.66,197.66ZM184,168a24,24,0,1,0-24-24A24,24,0,0,0,184,168Z`}))],[`thin`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M36,64a4,4,0,0,1,4-4H216a4,4,0,0,1,0,8H40A4,4,0,0,1,36,64Zm4,68h72a4,4,0,0,0,0-8H40a4,4,0,0,0,0,8Zm88,56H40a4,4,0,0,0,0,8h88a4,4,0,0,0,0-8Zm106.83,6.83a4,4,0,0,1-5.66,0l-22.72-22.72a36.06,36.06,0,1,1,5.66-5.66l22.72,22.72A4,4,0,0,1,234.83,194.83ZM184,172a28,28,0,1,0-28-28A28,28,0,0,0,184,172Z`}))]]),yi=new Map([[`bold`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M156,112a12,12,0,0,1-12,12H80a12,12,0,0,1,0-24h64A12,12,0,0,1,156,112Zm76.49,120.49a12,12,0,0,1-17,0L168,185a92.12,92.12,0,1,1,17-17l47.54,47.53A12,12,0,0,1,232.49,232.49ZM112,180a68,68,0,1,0-68-68A68.08,68.08,0,0,0,112,180Z`}))],[`duotone`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M192,112a80,80,0,1,1-80-80A80,80,0,0,1,192,112Z`,opacity:`0.2`}),B.createElement(`path`,{d:`M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Zm112,0a8,8,0,0,1-8,8H80a8,8,0,0,1,0-16h64A8,8,0,0,1,152,112Z`}))],[`fill`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM144,120H80a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Z`}))],[`light`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M150,112a6,6,0,0,1-6,6H80a6,6,0,0,1,0-12h64A6,6,0,0,1,150,112Zm78.24,116.24a6,6,0,0,1-8.48,0l-51.38-51.38a86.15,86.15,0,1,1,8.48-8.48l51.38,51.38A6,6,0,0,1,228.24,228.24ZM112,186a74,74,0,1,0-74-74A74.09,74.09,0,0,0,112,186Z`}))],[`regular`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M152,112a8,8,0,0,1-8,8H80a8,8,0,0,1,0-16h64A8,8,0,0,1,152,112Zm77.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88.11,88.11,0,1,1,11.31-11.31l50.07,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z`}))],[`thin`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M148,112a4,4,0,0,1-4,4H80a4,4,0,0,1,0-8h64A4,4,0,0,1,148,112Zm78.83,114.83a4,4,0,0,1-5.66,0l-52.7-52.7a84.1,84.1,0,1,1,5.66-5.66l52.7,52.7A4,4,0,0,1,226.83,226.83ZM112,188a76,76,0,1,0-76-76A76.08,76.08,0,0,0,112,188Z`}))]]),bi=new Map([[`bold`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M230.47,67.5a12,12,0,0,0-19.26-4.32L172.43,99l-12.68-2.72L157,83.57l35.79-38.78a12,12,0,0,0-4.32-19.26A76.07,76.07,0,0,0,88.41,121.64L30.92,174.18a4.68,4.68,0,0,0-.39.38,36,36,0,0,0,50.91,50.91l.38-.39,52.54-57.49A76.05,76.05,0,0,0,230.47,67.5ZM160,148a51.5,51.5,0,0,1-23.35-5.52,12,12,0,0,0-14.26,2.62L64.31,208.66a12,12,0,0,1-17-17l63.55-58.07a12,12,0,0,0,2.62-14.26A51.5,51.5,0,0,1,108,96a52.06,52.06,0,0,1,52-52h.89L135.17,71.87a12,12,0,0,0-2.91,10.65l5.66,26.35a12,12,0,0,0,9.21,9.21l26.35,5.66a12,12,0,0,0,10.65-2.91L212,95.12c0,.3,0,.59,0,.89A52.06,52.06,0,0,1,160,148Z`}))],[`duotone`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M224,96a64,64,0,0,1-94.94,56L73,217A24,24,0,0,1,39,183L104,126.94a64,64,0,0,1,80-90.29L144,80l5.66,26.34L176,112l43.35-40A63.8,63.8,0,0,1,224,96Z`,opacity:`0.2`}),B.createElement(`path`,{d:`M226.76,69a8,8,0,0,0-12.84-2.88l-40.3,37.19-17.23-3.7-3.7-17.23,37.19-40.3A8,8,0,0,0,187,29.24,72,72,0,0,0,88,96,72.34,72.34,0,0,0,94,124.94L33.79,177c-.15.12-.29.26-.43.39a32,32,0,0,0,45.26,45.26c.13-.13.27-.28.39-.42L131.06,162A72,72,0,0,0,232,96,71.56,71.56,0,0,0,226.76,69ZM160,152a56.14,56.14,0,0,1-27.07-7,8,8,0,0,0-9.92,1.77L67.11,211.51a16,16,0,0,1-22.62-22.62L109.18,133a8,8,0,0,0,1.77-9.93,56,56,0,0,1,58.36-82.31l-31.2,33.81a8,8,0,0,0-1.94,7.1L141.83,108a8,8,0,0,0,6.14,6.14l26.35,5.66a8,8,0,0,0,7.1-1.94l33.81-31.2A56.06,56.06,0,0,1,160,152Z`}))],[`fill`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M232,96a72,72,0,0,1-100.94,66L79,222.22c-.12.14-.26.29-.39.42a32,32,0,0,1-45.26-45.26c.14-.13.28-.27.43-.39L94,124.94a72.07,72.07,0,0,1,83.54-98.78,8,8,0,0,1,3.93,13.19L144,80l5.66,26.35L176,112l40.65-37.52a8,8,0,0,1,13.19,3.93A72.6,72.6,0,0,1,232,96Z`}))],[`light`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M224.91,69.75a6,6,0,0,0-9.63-2.16l-41.07,37.9L154.7,101.3l-4.19-19.51,37.9-41.07a6,6,0,0,0-2.16-9.63,70,70,0,0,0-89.77,94.39l-61.39,53c-.11.09-.21.19-.32.3A30,30,0,0,0,77.2,221.23c.11-.11.21-.21.3-.32l53-61.39a70,70,0,0,0,94.39-89.77ZM160,154a58,58,0,0,1-28-7.22,6,6,0,0,0-7.45,1.33L68.57,212.88a18,18,0,0,1-25.45-25.45l64.76-55.94A6,6,0,0,0,109.2,124a58,58,0,0,1,64-84.53L139.58,75.93a6,6,0,0,0-1.45,5.33l5.65,26.35a6,6,0,0,0,4.61,4.61l26.35,5.65a6,6,0,0,0,5.33-1.45L216.49,82.8A58.06,58.06,0,0,1,160,154Z`}))],[`regular`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M226.76,69a8,8,0,0,0-12.84-2.88l-40.3,37.19-17.23-3.7-3.7-17.23,37.19-40.3A8,8,0,0,0,187,29.24,72,72,0,0,0,88,96,72.34,72.34,0,0,0,94,124.94L33.79,177c-.15.12-.29.26-.43.39a32,32,0,0,0,45.26,45.26c.13-.13.27-.28.39-.42L131.06,162A72,72,0,0,0,232,96,71.56,71.56,0,0,0,226.76,69ZM160,152a56.14,56.14,0,0,1-27.07-7,8,8,0,0,0-9.92,1.77L67.11,211.51a16,16,0,0,1-22.62-22.62L109.18,133a8,8,0,0,0,1.77-9.93,56,56,0,0,1,58.36-82.31l-31.2,33.81a8,8,0,0,0-1.94,7.1L141.83,108a8,8,0,0,0,6.14,6.14l26.35,5.66a8,8,0,0,0,7.1-1.94l33.81-31.2A56.06,56.06,0,0,1,160,152Z`}))],[`thin`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M223.05,70.5a4,4,0,0,0-6.42-1.44l-41.82,38.6L153,103l-4.68-21.79,38.6-41.82a4,4,0,0,0-1.44-6.43A68,68,0,0,0,98.94,126L36.4,180l-.21.2a28,28,0,0,0,39.6,39.6l.2-.21,54-62.54A68,68,0,0,0,228,96,67.51,67.51,0,0,0,223.05,70.5ZM160,156a60,60,0,0,1-29-7.47,4,4,0,0,0-5,.89L70,214.25A20,20,0,0,1,41.75,186l64.82-56a4,4,0,0,0,.89-5,60,60,0,0,1,69.46-86.59L141.05,77.29a4,4,0,0,0-1,3.55l5.66,26.35a4,4,0,0,0,3.07,3.07l26.35,5.66a4,4,0,0,0,3.55-1l38.87-35.87A60.05,60.05,0,0,1,160,156Z`}))]]),xi=B.forwardRef((e,t)=>B.createElement(x,{ref:t,...e,weights:ci}));xi.displayName=`ArrowClockwiseIcon`;var Si=xi,Ci=B.forwardRef((e,t)=>B.createElement(x,{ref:t,...e,weights:li}));Ci.displayName=`ArrowCounterClockwiseIcon`;var wi=Ci,Ti=B.forwardRef((e,t)=>B.createElement(x,{ref:t,...e,weights:ui}));Ti.displayName=`ArrowsOutIcon`;var Ei=Ti,Di=B.forwardRef((e,t)=>B.createElement(x,{ref:t,...e,weights:di}));Di.displayName=`CaretUpIcon`;var Oi=Di,ki=B.forwardRef((e,t)=>B.createElement(x,{ref:t,...e,weights:fi}));ki.displayName=`ChatCircleTextIcon`;var Ai=ki,ji=B.forwardRef((e,t)=>B.createElement(x,{ref:t,...e,weights:pi}));ji.displayName=`ClockIcon`;var Mi=ji,Ni=B.forwardRef((e,t)=>B.createElement(x,{ref:t,...e,weights:mi}));Ni.displayName=`ClockCounterClockwiseIcon`;var Pi=Ni,Fi=B.forwardRef((e,t)=>B.createElement(x,{ref:t,...e,weights:hi}));Fi.displayName=`InfoIcon`;var Ii=Fi,Li=B.forwardRef((e,t)=>B.createElement(x,{ref:t,...e,weights:gi}));Li.displayName=`KeyboardIcon`;var Ri=Li,zi=B.forwardRef((e,t)=>B.createElement(x,{ref:t,...e,weights:_i}));zi.displayName=`ListBulletsIcon`;var Bi=zi,Vi=B.forwardRef((e,t)=>B.createElement(x,{ref:t,...e,weights:vi}));Vi.displayName=`ListMagnifyingGlassIcon`;var Hi=Vi,Ui=B.forwardRef((e,t)=>B.createElement(x,{ref:t,...e,weights:yi}));Ui.displayName=`MagnifyingGlassMinusIcon`;var Wi=Ui,Gi=B.forwardRef((e,t)=>B.createElement(x,{ref:t,...e,weights:bi}));Gi.displayName=`WrenchIcon`;var Ki=Gi,qi=i(b(),1),Ji=`$__all`;function Yi(e,t,n){if(e.kind===`constant`)return e.value??``;let r=e.kind===`custom`?e.options?.map(e=>({value:e}))??[]:n===null?[]:n,i=t[e.name],a=!e.multi&&Array.isArray(i)&&i.length===0?void 0:i;if(a===`$__all`){if(e.include_all)return Ji}else if(a!==void 0){if(e.kind===`text`||r===void 0)return a;let t=new Set(r.map(e=>e.value));if(Array.isArray(a)){if(a.length===0&&e.multi)return[];let n=a.filter(e=>t.has(e));if(n.length>0)return n}else if(t.has(a))return a}return e.default?e.default:e.include_all?Ji:r?.[0]?.value??``}var Xi=(e,t)=>e.replace(/\$([a-z][a-z0-9_]*)/g,(e,n)=>{let r=t[n];return r===void 0?e:r===`$__all`?`all`:Array.isArray(r)?r.join(`, `):r});function Zi(e,t,n){let r={};for(let i of e??[]){let e=Yi(i,t,n?.[i.name]);(i.kind!==`query`||e!==``)&&(r[i.name]=e)}return r}function Qi(e){return e.replace(/[&<>"']/g,e=>({"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`})[e])}var $i=e=>e.map(Qi).join(`
`);function ea(e,t=!1){return n=>{let r=Array.isArray(n)?n:[n];return $i([...r[0]?.axisValueLabel?[r[0].axisValueLabel]:[],...r.map(n=>{let r=n.value,i=Array.isArray(r)?t?r.slice(1):r:[r];return`${n.seriesName??``}${n.name?` · ${n.name}`:``}: ${i.map(t=>typeof t==`number`?e(t,n.seriesName):String(t??`—`)).join(` · `)}`})])}}var ta=e=>/^Other(?: \(\d+\))?$/.test(e??``);function na(e,t){let n=Math.min(6,Math.max(1,Math.floor(t.options?.top||6))),r=e.filter(e=>!ta(e.name)),i=r.slice(0,n).map(e=>({name:e.name,items:[e]})),a=[...e.filter(e=>ta(e.name)),...r.slice(n)];return a.length&&i.push({name:a.length===1&&ta(a[0].name)?a[0].name:`Other (${a.reduce((e,t)=>e+(ta(t.name)?Number(t.name.match(/\d+/)?.[0]??1):1),0)})`,items:a}),i}function ra(e){let t=e.filter(e=>e!==null);return t.length?t.reduce((e,t)=>e+t,0):null}function ia(e,t){let n=Math.min(6,Math.max(1,Math.floor(t.options?.top||6))),r=e.filter(e=>!ta(e.name));return{shown:[...r.slice(0,n),...e.filter(e=>ta(e.name))],hidden:Math.max(0,r.length-n)}}function aa(e,t){return e>0?[{type:`text`,right:8,bottom:2,silent:!0,style:{text:`${e} more series not shown`,fill:t,fontSize:11}}]:[]}function oa(e,t,n,r,i=`sans-serif`,a){let o=e=>Array.from(e).length>24?`${Array.from(e).slice(0,23).join(``)}…`:e,s=Math.max(1,t-16),c=1,l=0;for(let t of e){let e=15+(a?.(o(t),`12px ${i}`)??Array.from(o(t)).length*7.2);l&&l+10+e>s&&(c++,l=0),l+=(l?10:0)+e}let u=c>2;return{top:n?u?30:c*20+2:12,option:{type:u?`scroll`:`plain`,show:n,top:0,left:0,right:0,padding:0,itemGap:6,icon:`roundRect`,itemWidth:10,itemHeight:10,itemStyle:{borderColor:r,borderWidth:1},textStyle:{color:r,fontSize:12,lineHeight:14},data:e,formatter:o,tooltip:{show:!0,renderMode:`html`,formatter:e=>Qi(e.name)}}}}function sa(e,t){if(!(!Number.isFinite(e)||!Number.isFinite(t)||e>=t||Math.abs(e)>864e13||Math.abs(t)>864e13))return{from:new Date(Math.floor(e)).toISOString(),to:new Date(Math.ceil(t)).toISOString()}}function ca(e){let t=[e.time?.range?`Range ${e.time.range}`:void 0,e.time?.shift?`Shifted ${e.time.shift}`:void 0].filter(Boolean);return t.length?t.join(` · `):void 0}function la(e,t,n){if(n.interactive===!1||n.data?.value===null)return;let r=n.data?.selection;if(r)return Object.values(r.dimensions).some(ta)?void 0:r;if(ta(n.seriesName)||ta(n.name)||n.value===null||Array.isArray(n.value)&&n.value.at(-1)==null)return;let i=e.query?.by?.[0]??t.frame?.columns.find(e=>e.role===`dimension`)?.name,a=e.viz===`timeseries`?n.seriesName:n.name,o=Array.isArray(n.value)?n.value:[];return{time:e.viz===`timeseries`&&typeof o[0]==`number`?o[0]:void 0,dimensions:i&&a?{[i]:a}:{}}}function ua(e){return Array.from({length:e.rows},(t,n)=>Object.fromEntries(e.columns.map((t,r)=>{let i=e.values[r]?.[n]??null;return[t.name,typeof i==`number`&&!Number.isFinite(i)?null:i]})))}function da(e,t){return e.viz!==`logs`||!t||t.rows<2?[]:t.columns.flatMap((e,n)=>{if(e.role!==`dimension`||e.type!==`string`||[`body`,`body_template`,`severity`,`status`].includes(e.name)||/(^id$|_id$)/.test(e.name))return[];let r=t.values[n][0];return typeof r==`string`&&r!==``&&t.values[n].slice(0,t.rows).every(e=>e===r)?[{name:e.name,value:r}]:[]})}function fa(e,t){let n=t.frame??{columns:[],values:[],rows:0};return{columns:n.columns.map(e=>e.name),rows:ua(n),selection:t=>{let n={};for(let r of e.query?.by??[]){let e=r.startsWith(`attributes[`)||r.startsWith(`resource[`)?r.slice(r.indexOf(`'`)+1,r.lastIndexOf(`'`)):r;t[e]!==void 0&&t[e]!==null&&(n[r]=String(t[e]))}return{time:typeof t.time==`number`?t.time:typeof t.start==`number`?t.start:void 0,dimensions:n,trace_id:typeof t.trace_id==`string`?t.trace_id:void 0,namespace:typeof t.namespace==`string`?t.namespace:void 0}}}}var pa=new Intl.NumberFormat(`en`,{notation:`compact`,maximumFractionDigits:1}),ma=new Intl.NumberFormat(`en`,{maximumFractionDigits:2});function ha(e){return Math.abs(e)<1e-4?e.toExponential(2).replace(/\.?(0+)(?=e)/,``):String(Number(e.toPrecision(3)))}function ga(e,t=ma){return e!==0&&Math.abs(e)<1?ha(e):t.format(e)}function _a(e,t){let n=t===`s`?e*1e3:t===`ns`?e/1e6:e;return e!==0&&n===0?`${ha(e)}${t}`:n!==0&&Math.abs(n)<1?`${ha(n)}ms`:be(n)}function va(e){let t=[`B`,`KiB`,`MiB`,`GiB`,`TiB`],n=e,r=0;for(;Math.abs(n)>=1024&&r=1e4?pa:ma);default:return ga(t,Math.abs(t)>=1e4?pa:ma)}}function ba(e){return t=>e===`ms`||e===`s`||e===`ns`?ya(e,t).replace(/(\.\d*?)0+([a-z]*)$/,`$1$2`).replace(/\.([a-z]*)$/,`$1`):ya(e,t)}function xa(e,t){return ba(e)(t??NaN).replace(/(?<=\d)(ms|ns|s|m|h)\b/g,` $1`)}function Sa(e){return Math.max(3,Math.min(10,Math.round(e/70)))-1}function Ca(e,t){let n=t===`ms`?1:t===`s`?1e3:t===`ns`?1e-6:void 0,r=e=>{let t=10**Math.floor(Math.log10(e));return[1,2,5,10].map(e=>e*t).find(t=>t>=e)};if(n===void 0)return r(e);let i=e*n,a=[1,10,100,1e3,1e4,6e4,6e5,36e5,36e6].flatMap(e=>[1,2,5].map(t=>e*t)).sort((e,t)=>e-t);return(i<1?r(i):a.find(e=>e>=i)??r(i/36e5)*36e5)/n}function wa(e,t,n,r){e=Number.isFinite(e)?Math.min(0,e):0,t=Number.isFinite(t)?Math.max(0,t):1,t===e&&(t=e+1);let i=Sa(r),a=Ca(Math.max(t-e,2**-52)/i,n);for(;Math.ceil(t/a)-Math.floor(e/a)>i;)a=Ca(a*1.01,n);return{min:Math.floor(e/a)*a,max:Math.ceil(t/a)*a,interval:a,splitNumber:i,fanout_unit:n}}function Ta(e,t){return e.type!==`value`&&e.type!==`log`?e:{...e,...e.type===`value`&&typeof e.min==`number`&&typeof e.max==`number`?wa(e.min,e.max,typeof e.fanout_unit==`string`?e.fanout_unit:void 0,t):{splitNumber:Sa(t)}}}function Ea(e,t,n){let r=e=>ya(n,e),i=``;if(n===`ms`||n===`s`||n===`ns`){let a=n===`s`?1e3:n===`ns`?1e-6:1,o=Math.abs((e??t??0)*a),s=o>=6e4?6e4:o>=1e3?1e3:1;i=s===6e4?` min`:s===1e3?` s`:` ms`;let c=s===6e4?1:s===1e3?+(o<1e4):2,l=new Intl.NumberFormat(void 0,{maximumFractionDigits:c});r=e=>l.format(e*a/s)}return t===null&&e!==null?`≥${r(e)}${i}`:(e===null||e===0)&&t!==null?`<${r(t)}${i}`:`${e===null?`−∞`:r(e)}–${t===null?`∞`:r(t)}${i}`}function Da(e){let t=new Date(e);return t.getHours()===0&&t.getMinutes()===0&&t.getSeconds()===0?t.toLocaleDateString(void 0,{month:`short`,day:`numeric`}):t.toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`})}function Oa(e,t=new Date,n){let r=new Date(e);if(!Number.isFinite(r.getTime()))return`—`;let i=new Intl.DateTimeFormat(n,{month:`short`,day:`numeric`,...r.getFullYear()===t.getFullYear()?{}:{year:`numeric`},hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`}).formatToParts(r),a=i.filter(e=>[`month`,`day`,`year`].includes(e.type)).map(e=>e.value),o=i.filter(e=>[`hour`,`minute`,`second`].includes(e.type)).map(e=>e.value);return`${a.join(` `)} ${o.join(`:`)}`}function ka({panel:e,result:t}){let n=t?.frame;return(0,V.jsxs)(`div`,{"data-panel-data":!0,children:[t?.error&&(0,V.jsx)(T,{"data-panel-error-detail":!0,size:`sm`,role:`status`,style:{whiteSpace:`pre-wrap`,overflowWrap:`anywhere`,userSelect:`text`},children:t.error}),n?(0,V.jsxs)(xe,{fz:12,striped:!0,children:[(0,V.jsx)(xe.Thead,{children:(0,V.jsx)(xe.Tr,{children:n.columns.map(e=>(0,V.jsx)(xe.Th,{ff:Tt.display,children:e.name},e.name))})}),(0,V.jsx)(xe.Tbody,{children:Array.from({length:Math.min(n.rows,500)},(t,r)=>(0,V.jsx)(xe.Tr,{children:n.columns.map((t,i)=>{let a=n.values[i][r];return(0,V.jsx)(xe.Td,{ff:Tt.display,children:a===null?`—`:t.type===`time`?new Date(Number(a)).toISOString():t.role===`measure`?ya(t.unit??e.unit,Number(a)):String(a)},t.name)})},r))})]}):(0,V.jsx)(T,{c:`dimmed`,size:`sm`,children:`No data.`}),(0,V.jsxs)(T,{c:`dimmed`,fz:12,mt:8,children:[`Ran in `,t?.elapsed_ms??0,` ms`,t?.interval?`, one point per ${t.interval}`:``,n?`, ${n.rows} rows${n.truncated?` (truncated)`:``}`:``,`.`]}),(t?.sql??e.sql)&&(0,V.jsx)(ze,{block:!0,tabIndex:0,mt:8,children:t?.sql??e.sql})]})}function Aa({panel:e,dark:t}){let n=JSON.stringify(e,null,2).split(/("(?:[^"\\]|\\.)*"(?=\s*:)|"(?:[^"\\]|\\.)*"|\b(?:true|false|null)\b|-?\d+(?:\.\d+)?)/g);return(0,V.jsx)(`pre`,{"data-panel-spec":!0,style:{margin:0,fontFamily:Tt.display,fontSize:12,color:pt[t?`dark`:`light`].text},children:n.map((e,r)=>{let i=e.startsWith(`"`)&&/^\s*:/.test(n[r+1]??``)?`key`:e.startsWith(`"`)?`string`:/^(true|false|null)$/.test(e)?`literal`:/^-?\d/.test(e)?`number`:`punctuation`,a=i===`key`?vt[t?4:7]:i===`string`?ht[t?4:8]:i===`number`||i===`literal`?Ot[t?4:8]:void 0;return i===`punctuation`?e:(0,V.jsx)(`span`,{"data-json-token":i,style:{color:a},children:e},r)})})}function ja(e){let t=e.event.data?.selection,n=e.event.value;return JSON.stringify([e.event.seriesName,e.event.name,t?.from??t?.time??(Array.isArray(n)?n[0]:void 0),t?.dimensions,t?.bucket])}function Ma(e){let t=new Date().toISOString().slice(0,10),n=e.from.slice(0,10),r=e.to.slice(0,10),i=e=>e.slice(11,-1).replace(/\.000$/,``);return`${(n===t?``:n+` `)+i(e.from)} – ${(r!==n&&r!==t?r+` `:``)+i(e.to)} UTC · ${be(Date.parse(e.to)-Date.parse(e.from))}`}var Na={background:`color-mix(in srgb, var(--mantine-color-body) 92%, transparent)`,border:`1px solid var(--mantine-color-default-border)`,borderRadius:`var(--mantine-radius-sm)`,padding:`2px 6px`};function Pa(e){return e.replace(`Enter drill`,`↵ drill`).replace(`Shift+←→`,`⇧←→`)}var Fa=(0,B.createContext)(void 0);function Ia({points:e,label:t,summary:n,children:r,onClick:i,canSelect:a,onHighlight:s,onActiveChange:c,onRangePending:l,onRangeChange:u,onRangeBarHeight:d,rangeReset:f,height:p=`100%`,onZoom:m,bounds:h,pointWindow:g}){let[_,v]=(0,B.useState)(!1),[b,x]=(0,B.useState)(``),[S,w]=(0,B.useState)(),[E,D]=(0,B.useState)(null),O=(0,B.useRef)(null),k=(0,B.useRef)(!1);(0,B.useEffect)(()=>{let e=e=>{e.key===`Tab`&&(k.current=!1)};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},[]);let A=(0,B.useId)(),j=(0,B.useContext)(Fa),M=(0,B.useRef)(null),N=(0,B.useRef)({onHighlight:s,onActiveChange:c,onRangePending:l,onRangeChange:u,onRangeBarHeight:d});N.current={onHighlight:s,onActiveChange:c,onRangePending:l,onRangeChange:u,onRangeBarHeight:d};let P=(0,B.useMemo)(()=>new Map(e.map(e=>[ja(e),e])),[e]),F=(0,B.useRef)(void 0),I=e=>g?.(e)?.from??e.event.name??(Array.isArray(e.event.value)?e.event.value[0]:void 0),L=F.current,ee=L?e.filter(e=>e.event.seriesName===L.event.seriesName):e,te=ee.length?ee:e,ne=L&&I(L),re=typeof ne==`number`?te.reduce((e,t)=>{let n=I(t),r=e&&I(e);return typeof n==`number`&&(!e||typeof r!=`number`||Math.abs(n-ne)I(e)===ne),ie=S?P.get(S)??re??te[0]??e[0]:e[0],ae=!!(m&&h&&Number.isFinite(h.from)&&Number.isFinite(h.to)&&h.from[...new Set(e.map(e=>e.event.seriesName))],[e]),oe=(0,B.useMemo)(()=>e.filter(e=>e.event.seriesName===ie?.event.seriesName),[e,ie?.event.seriesName]),z=ie?oe.indexOf(ie):-1;(0,B.useEffect)(()=>{ie&&(!S||P.has(S)||!ee.length)&&(F.current=ie,(!S||!ee.length)&&w(ja(ie))),_&&N.current.onHighlight(ie)},[ie,S,_]),(0,B.useEffect)(()=>{if(!E)return;let e=Date.parse(E.from),t=Date.parse(E.to);h&&(Number.isFinite(e)&&eh.to)&&D(null)},[h?.from,h?.to,E]),(0,B.useEffect)(()=>{N.current.onRangePending?.(!!E)},[!!E]),(0,B.useEffect)(()=>{N.current.onRangeChange?.(E?{from:Date.parse(E.from),to:Date.parse(E.to)}:void 0)},[E]),(0,B.useEffect)(()=>{D(null)},[f]),(0,B.useEffect)(()=>()=>{N.current.onHighlight(void 0),N.current.onRangePending?.(!1),N.current.onRangeChange?.(void 0)},[]);let se=(e,t=!1)=>{if(e){if(x(n(e)),t&&ae&&ie){let t=E?.anchor??ja(ie),n=P.get(t),r=E?.window??(n&&g?.(n)),i=g?.(e);if(r&&i){let e=Math.max(h.from,Math.min(r.from,i.from)),n=Math.min(h.to,Math.max(r.to,i.to));Number.isFinite(e)&&Number.isFinite(n)&&e{if(!ie)return;let n=R[Math.max(0,Math.min(R.length-1,R.indexOf(ie.event.seriesName)+t))],r=e.filter(e=>e.event.seriesName===n),i=I(ie),a=r.find(e=>I(e)===i),o=typeof i==`number`?r.reduce((e,t)=>{let n=I(t),r=e&&I(e);return typeof n==`number`&&(!e||typeof r!=`number`||Math.abs(n-i){e===`ArrowLeft`||e===`ArrowRight`?se(oe[Math.max(0,Math.min(oe.length-1,z+(e===`ArrowLeft`?-1:1)))],t):!t&&(e===`ArrowUp`||e===`ArrowDown`)?ce(e===`ArrowUp`?-1:1):!t&&(e===`Home`||e===`End`)&&se(e===`Home`?oe[0]:oe.at(-1))},ue=()=>{D(null),O.current?.focus()},de=ae?`←→ points · ↑↓ series · Enter drill · Shift+←→ range`:`←→ points · ↑↓ series · Enter drill`;return(0,B.useLayoutEffect)(()=>(j?.setHint(_?de:void 0),()=>j?.setHint(void 0)),[j,_,de]),(0,B.useLayoutEffect)(()=>{let e=M.current;if(!e)return;N.current.onRangeBarHeight?.(e.getBoundingClientRect().height);let t=new ResizeObserver(([t])=>{if(!t)return;let n=getComputedStyle(e),r=[n.paddingTop,n.paddingBottom,n.borderTopWidth,n.borderBottomWidth].reduce((e,t)=>e+(parseFloat(t)||0),0);N.current.onRangeBarHeight?.(t.borderBoxSize?.[0]?.blockSize??t.contentRect.height+r)});return t.observe(e),()=>{t.disconnect(),N.current.onRangeBarHeight?.(0)}},[!!(E&&ae)]),(0,V.jsxs)(o,{ref:O,"data-chart-plot":!0,tabIndex:0,role:`application`,"aria-roledescription":`chart`,"aria-label":t,"aria-describedby":A,"data-mantine-stop-propagation":E?`true`:void 0,className:`chart-keyboard-point`,style:{position:`relative`,height:p,width:`100%`,flex:`1 1 auto`,minHeight:0,minWidth:0},onPointerDownCapture:e=>{M.current?.contains(e.target)||(k.current=!0,v(!1),_&&N.current.onHighlight(void 0),N.current.onActiveChange?.(!1))},onFocus:e=>{e.target!==e.currentTarget||k.current||(N.current.onActiveChange?.(!0),v(!0))},onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||(v(!1),D(null),x(``),N.current.onHighlight(void 0),N.current.onActiveChange?.(!1))},onKeyDown:e=>{if(e.defaultPrevented||e.ctrlKey||e.metaKey||e.altKey||e.nativeEvent.isComposing)return;if(e.key===`Escape`&&!e.repeat){E?(e.preventDefault(),e.stopPropagation(),ue()):e.target===e.currentTarget&&!e.currentTarget.closest(`[data-panel-fullscreen],[data-fragment-fullscreen]`)&&(e.preventDefault(),e.stopPropagation(),e.currentTarget.blur());return}if(e.target!==e.currentTarget||e.repeat&&![`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`].includes(e.key))return;let t=[`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key);if(t&&!_&&(k.current=!1,v(!0),N.current.onActiveChange?.(!0),!ie)){e.preventDefault();return}e.key===`Enter`&&_&&!e.shiftKey&&ie&&i&&(!a||a(ie.event))?(e.preventDefault(),i(ie.event)):t&&(!e.shiftKey||e.key===`ArrowLeft`||e.key===`ArrowRight`)&&(e.preventDefault(),le(e.key,e.shiftKey))},children:[r,(0,V.jsx)(o,{"data-chart-overlay":!0,style:{position:`absolute`,inset:0,zIndex:1,pointerEvents:`none`,overflow:`hidden`},children:E&&ae&&(0,V.jsxs)(y,{ref:M,"data-chart-range-bar":!0,gap:6,style:{...Na,position:`absolute`,bottom:4,left:4,right:4,maxHeight:`100%`,overflow:`auto`,pointerEvents:`auto`},children:[(0,V.jsx)(T,{"data-chart-range-label":!0,size:`xs`,title:E.from+` – `+E.to,truncate:!0,style:{flex:`1 1 140px`,minWidth:0},children:Ma(E)}),(0,V.jsx)(C,{size:`compact-xs`,"data-mantine-stop-propagation":`true`,onClick:()=>{m(Date.parse(E.from),Date.parse(E.to)),ue()},children:`Zoom to range`}),(0,V.jsx)(C,{size:`compact-xs`,variant:`subtle`,"data-mantine-stop-propagation":`true`,onClick:ue,children:`Cancel`})]})}),(0,V.jsx)(He,{id:A,children:de}),(0,V.jsx)(He,{"aria-live":`polite`,"aria-atomic":`true`,children:b})]})}function La(e){return e===`healthy`?`ok`:e===`degraded`?`warn`:e===`unknown`?`gray`:`bad`}function Ra(e){return pt[e?`dark`:`light`]}function za(e){let t=e?5:7;return{ok:ht[t],warn:gt[t],bad:Dt[t],info:Ot[t]}}function Ba(e,t){return St[t?`dark`:`light`][e]??Ra(t).muted}function Va(e){return e===`unhealthy`?`diamond`:e===`degraded`?`roundRect`:`circle`}function Ha(e){return e===`unknown`?`dashed`:`solid`}var Ua=e=>typeof e==`number`&&Number.isFinite(e)?e:null;function Wa(e){return e.columns.flatMap((e,t)=>e.role===`measure`?[t]:[])}function Ga(e){let t=e.columns.findIndex(e=>e.role===`time`);if(t<0)return[];let n=e.columns.findIndex(e=>e.role===`dimension`),r=Wa(e);if(n>=0&&r.length>0){let i=r[0],a=new Map;for(let r=0;r({name:e.columns[n].name,unit:e.columns[n].unit,points:e.values[t].map((t,r)=>[Number(t),Ua(e.values[n][r])])}))}function Ka(e){let t=e.columns.flatMap((e,t)=>e.role===`dimension`?[t]:[]),n=Wa(e);if(t.length===0||n.length===0)return{categories:[],series:[]};let r=t[0],i=[];for(let t=0;t1){let a=t[1],o=n[0],s=new Map;for(let t=0;tnull)),s.get(n)[i.indexOf(String(e.values[r][t]??``))]=Ua(e.values[o][t])}return{categories:i,series:[...s.entries()].map(([t,n])=>({name:t,unit:e.columns[o].unit,values:n}))}}return{categories:i,series:n.map(t=>({name:e.columns[t].name,unit:e.columns[t].unit,values:e.values[t].map(Ua)}))}}function qa(e,t){let n=e.filter(e=>e!==null);if(n.length===0)return null;switch(t){case`last`:return n[n.length-1];case`min`:return Math.min(...n);case`max`:return Math.max(...n);case`sum`:return n.reduce((e,t)=>e+t,0);default:return n.reduce((e,t)=>e+t,0)/n.length}}function Ja(e,t){let n=Wa(t)[0];return n===void 0?null:(e.reduce??`window`)===`window`?t.totals?Ua(t.totals[n]):qa(t.values[n].map(Ua),`mean`):qa(t.values[n].map(Ua),e.reduce??`mean`)}function Ya(e){let t=Wa(e)[0];return t===void 0?[]:e.values[t].map(Ua)}var Xa={ok:0,warn:1,bad:2};function Za(e){if(!e?.length)return;let t=[...e].sort((e,t)=>Xa[e.status]-Xa[t.status]),n=t[0],r=t[t.length-1];return Xa[r.status]>Xa[n.status]&&r.value!==n.value?r.value>n.value?`lower`:`higher`:`lower`}function Qa(e,t,n){if(e===null||!t||t.length===0)return null;n??=Za(t);let r=`ok`;for(let i of t)(n===`lower`?e>=i.value:e<=i.value)&&Xa[i.status]>Xa[r]&&(r=i.status);return r}function $a(e,t){let n=wt(e),r=wt(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function eo(e,t){return`rgba(${[1,3,5].map(t=>parseInt(e.slice(t,t+2),16)).join(`, `)}, ${t})`}function to(e,t){return{color:e,...$a(e,t.surface)<3?{borderColor:t.text,borderWidth:1}:{}}}function no(e,t){return{color:e,...$a(e,t.surface)<3?{shadowColor:t.text,shadowBlur:2}:{}}}function ro(e,t){return{ok:ht,warn:gt,bad:Dt}[e][t?5:8]}function io(e){let t=Ra(e),n=za(e);return{dark:e,text:t.text,muted:t.muted,grid:t.grid,surface:t.surface,border:t.border,status:{ok:n.ok,warn:n.warn,bad:n.bad},font:Tt.display}}function ao(e,t,n){if(!Array.isArray(e.series))return e;let r=e.series,i=Array.isArray(e.yAxis)?e.yAxis:[e.yAxis],a=[],o=r.map((e,o)=>{let s=e.endLabel;if(!s?.show||!Array.isArray(e.data))return e;let c;for(let t=e.data.length-1;t>=0;t--){let n=e.data[t];if(Array.isArray(n)&&typeof n[1]==`number`&&Number.isFinite(n[1])){c=n;break}}let l=i[Number(e.yAxisIndex??0)];if(!c||!l)return{...e,endLabel:{...s,show:!1}};let u=l.type===`log`?Math.log:e=>e,d=l.min??1/0,f=l.max??0;if(l.type===`log`&&(l.min===void 0||l.max===void 0)){for(let t of r)if(Number(t.yAxisIndex??0)===Number(e.yAxisIndex??0)&&Array.isArray(t.data))for(let e of t.data)Array.isArray(e)&&typeof e[1]==`number`&&Number.isFinite(e[1])&&e[1]>0&&(l.min===void 0&&(d=Math.min(d,e[1])),l.max===void 0&&(f=Math.max(f,e[1])))}Number.isFinite(d)||(d=1);let p=u(l.type===`log`?d:l.min??0),m=u(l.type===`log`?Math.max(f,d*1.01):l.max??1),h=n?.(o,c),g=Number.isFinite(h)?h:t.y+t.height*(1-(u(c[1])-p)/(m-p)),_=((s.lineHeight??14)+2)/2,v=[Math.max(t.y+_,Math.min(t.y+t.height-_,g)),...a.flatMap(e=>[e.y-e.half-_,e.y+e.half+_])].filter(e=>Number.isFinite(e)&&e-_>=t.y&&e+_<=t.y+t.height&&a.every(t=>Math.abs(t.y-e)>=t.half+_)).sort((e,t)=>Math.abs(e-g)-Math.abs(t-g))[0];return v===void 0?{...e,endLabel:{...s,show:!1}}:(a.push({y:v,half:_}),{...e,labelLayout:{dy:v-g,hideOverlap:!0}})});return{...e,series:o}}var oo=(e,t,n)=>ta(e)?n.muted:Ba(t,n.dark);function so(e,t){let n=Ga(e);if(!e.columns.some(e=>e.role===`dimension`))for(let e of n){let t=e.name;e.name=/^p\d+(?:\(.*\))?$/.test(t)&&[`ms`,`s`,`ns`].includes(e.unit??``)?`${t.match(/^p\d+/)[0]} latency`:/^error_rate(?:\(\))?$/.test(t)?`Error rate`:/^rate(?:\(\))?$/.test(t)?`Request rate`:t.replaceAll(`_`,` `).replace(/^./,e=>e.toUpperCase())}return ia(n,t)}function co(e,t){return{animationDuration:200,textStyle:{fontFamily:e.font,color:e.muted,fontSize:11},grid:{left:8,right:16,top:28,bottom:8,containLabel:!0},tooltip:{trigger:`axis`,formatter:ea(e=>ya(t,e)),confine:!0,backgroundColor:e.surface,borderColor:e.border,textStyle:{color:e.text,fontSize:12},valueFormatter:e=>ya(t,e),axisPointer:{type:`line`,lineStyle:{color:e.border}}},aria:{enabled:!0}}}function lo(e,t,n,r){return(e.thresholds??[]).map(i=>({yAxis:i.value,label:{formatter:`${i.label??i.status} ${ba(r??e.unit)(i.value).replace(/(?<=\d)(ms|s|m|h)$/,` $1`)}`,position:i.value<=(n.min+n.max)/2?`insideEndTop`:`insideEndBottom`,distance:8,color:t.muted,textBorderColor:t.surface,textBorderWidth:3,fontSize:12},lineStyle:{color:t.status[i.status],type:[4,3],width:1}}))}function uo(e,t,n,r={width:500,height:248}){let i=t.frame?so(t.frame,e):{shown:[],hidden:0},a=i.shown,o=a[0]?.unit??e.unit,s=new Set(a.map(e=>e.name)),c=a.find(e=>ta(e.name)),l=t.previous&&t.shift_ms!==void 0?so(t.previous,e).shown.flatMap(e=>ta(e.name)?c?[e]:[]:s.has(e.name)?[e]:[]):[],u=[...new Set([...a,...l].map(t=>t.unit??e.unit))];u.length===0&&u.push(e.unit);let d=e.options?.style??`line`,f=a.length>=2&&a.length<=6&&i.hidden===0&&d!==`bars`&&d!==`stacked`,p=f?Math.max(40,...a.map(e=>{let t=Array.from(e.name).slice(0,24).join(``);return r.measureText?.(t,`12px ${n.font}`)??Array.from(t).length*7.2}))+12:0,m=f?p+8:0,h=(e.options?.legend??`auto`)!==`hidden`&&a.length>1,g=oa(a.map(e=>e.name),r.width,h,n.text,n.font,r.measureText),_=r.height-g.top-(i.hidden?24:8)-22,v=Math.max(0,Math.floor(_/16)),y=t.shift_ms,b=u.map(t=>{let n=[...a,...l].filter(n=>(n.unit??e.unit)===t).flatMap(e=>e.points.flatMap(([,e])=>e===null?[]:[e]));if(d===`stacked`){let r=new Map;for(let n of a.filter(n=>(n.unit??e.unit)===t))for(let[e,t]of n.points){let n=r.get(e)??{positive:0,negative:0};t!==null&&(t>0?n.positive+=t:n.negative+=t),r.set(e,n)}n.push(...[...r.values()].flatMap(e=>[e.positive,e.negative]))}return wa(Math.min(0,...n),Math.max(0,...n),t,_)}),x=a.map((t,r)=>{let i=oo(t.name,r,n);return{name:t.name,interactive:!0,yAxisIndex:u.indexOf(t.unit??e.unit),tooltip:{valueFormatter:n=>ya(t.unit??e.unit,n)},type:d===`bars`||d===`stacked`?`bar`:`line`,data:t.points,endLabel:f?{show:r0?{symbol:[`none`,`none`],silent:!0,data:lo(e,n,b[0],o)}:void 0}}),S=y===void 0?[]:l.map(t=>({name:`${t.name} · previous`,interactive:!1,yAxisIndex:u.indexOf(t.unit??e.unit),tooltip:{valueFormatter:n=>ya(t.unit??e.unit,n)},type:`line`,data:t.points.map(([e,t])=>[e+y,t]),showSymbol:!1,silent:!0,z:1,lineStyle:{width:1,type:`dashed`,color:n.muted},itemStyle:{color:n.muted}})),C=u.map((t,r)=>({...e.options?.scale===`log`?{splitNumber:Sa(_)}:b[r],type:e.options?.scale===`log`?`log`:`value`,position:r===0?`left`:`right`,offset:Math.max(0,r-1)*56,axisLine:{show:!1},splitLine:{show:r===0,lineStyle:{color:n.grid}},axisLabel:{color:n.muted,fontFamily:n.font,fontSize:11,hideOverlap:!0,formatter:ba(t)}}));return ao({...co(n,o),tooltip:{...co(n,o).tooltip,formatter:ea((t,n)=>ya([...a,...l].find(e=>e.name===n||`${e.name} · previous`===n)?.unit??e.unit,t),!0)},legend:g.option,grid:{left:8,right:16+(f?m:0)+Math.max(0,u.length-2)*56,top:g.top,bottom:i.hidden?24:8,containLabel:!0},xAxis:{type:`time`,min:t.from_ms,max:t.to_ms,axisLine:{lineStyle:{color:n.grid}},axisTick:{show:!1},splitLine:{show:!1},axisLabel:{color:n.muted,fontFamily:n.font,fontSize:11,hideOverlap:!0,formatter:Da}},yAxis:C.length===1?C[0]:C,series:[...x,...S],graphic:aa(i.hidden,n.muted)},{y:g.top,height:_})}function fo(e,t,n){if(n(e)<=t)return e;let r=Array.from(e);for(let e=r.length-1;e>0;e--){let i=Math.floor(e*.45),a=e-i,o=r.slice(0,i).join(``)+`…`+r.slice(-a).join(``);if(n(o)<=t)return o}return`…`}function po(e,t,n,r={width:500,height:248}){let i=Ka(t),a=i.categories,{shown:o,hidden:s}=ia(i.series,e),c=t.columns.flatMap((e,t)=>e.role===`dimension`?[t]:[]),l=new Map;for(let n=0;nString(t.values[e][n]??``))),{dimensions:r,...i})}let u=o[0]?.unit??e.unit,d=[...new Set(o.map(t=>t.unit??e.unit))];d.length===0&&d.push(e.unit);let f=o.length>1,p=!!(t.periods?.[`Before deploy`]||t.periods?.[`Since deploy`]),m=e=>r.measureText?.(e,`11px ${n.font}`)??Array.from(e).length*6.6,h=Math.min(r.width*.4,Math.max(40,...a.map(m))),g=oa(o.map(e=>e.name),r.width,f&&e.options?.legend!==`hidden`,n.text,n.font,r.measureText),_=d.map((t,i)=>({...wa(Math.min(0,...o.filter(n=>(n.unit??e.unit)===t).flatMap(e=>e.values.filter(e=>e!==null))),Math.max(0,...o.filter(n=>(n.unit??e.unit)===t).flatMap(e=>e.values.filter(e=>e!==null))),t,r.width-h-80),type:`value`,position:i===0?`bottom`:`top`,offset:Math.max(0,i-1)*36,splitLine:{show:i===0,lineStyle:{color:n.grid}},axisLabel:{color:n.muted,fontFamily:n.font,fontSize:11,formatter:e=>xa(t,e),hideOverlap:!0}}));return{...co(n,u),tooltip:{...co(n,u).tooltip,formatter:ea((t,n)=>ya(o.find(e=>e.name===n)?.unit??e.unit,t)),axisPointer:{type:`shadow`}},legend:g.option,grid:{left:8,right:56,top:(f?g.top:8)+Math.max(0,d.length-1)*36,bottom:s?24:8,containLabel:!0},yAxis:{type:`category`,inverse:!0,data:a,splitLine:{show:!1},axisLine:{lineStyle:{color:n.grid}},axisTick:{show:!1},axisLabel:{color:n.muted,fontFamily:n.font,fontSize:11,width:h,overflow:`truncate`,formatter:e=>fo(e,h,m)}},xAxis:_.length===1?_[0]:_,series:o.map((t,r)=>({name:t.name,interactive:!0,xAxisIndex:d.indexOf(t.unit??e.unit),tooltip:{valueFormatter:n=>ya(t.unit??e.unit,n)},type:`bar`,data:t.values.map((e,n)=>({value:e,selection:l.get(JSON.stringify(c.length>1?[a[n],t.name]:[a[n]]))})),barMaxWidth:p&&t.name===`Before deploy`?7:14,barGap:`20%`,itemStyle:{...to(p?t.name===`Before deploy`?n.muted:Ba(0,n.dark):oo(t.name,r,n),n),borderRadius:[0,4,4,0]},label:{show:p?t.name===`Since deploy`:!f||r===0,position:`right`,color:n.text,fontFamily:n.font,fontSize:11,formatter:({value:n})=>xa(t.unit??e.unit,n)}})),graphic:aa(s,n.muted)}}function mo(e,t,n,r=e.unit,i={width:270,height:140}){let a=e.min??0,o=e.max??100,s=ho(e,a,o,n),c=ya(r,t),l=Qa(t,e.thresholds,e.better),u=l===`bad`?`◆ Bad`:l===`warn`?`■ Warn`:l===`ok`?`● OK`:t===null?`○ Unknown`:void 0,d=e=>`${e}40`,f=i.measureText?.(c,`600 28px ${n.font}`)??c.length*28*.6,p=i.measureText?.(u??``,`11px ${n.font}`)??(u?.length??0)*11*.6,m=i.width{let r=y;return y=e,{type:`rect`,shape:{x:4+r*_,y:g,width:(e-r)*_,height:10,r:[n===0?5:0,n===s.length-1?5:0,n===s.length-1?5:0,n===0?5:0]},style:{fill:d(t)}}}),{id:`gauge-fill`,type:`rect`,shape:{x:4,y:g,width:v*_,height:10,r:5},style:{fill:l?n.status[l]:Ba(0,n.dark)}},{id:`gauge-marker`,type:`rect`,shape:{x:3+v*_,y:g-2,width:2,height:14,r:1},style:{fill:n.text}},{type:`text`,left:4,top:g+12,style:{text:ya(r,a),fill:n.muted,fontSize:11,fontFamily:n.font}},{type:`text`,right:4,top:g+12,style:{text:ya(r,o),fill:n.muted,fontSize:11,fontFamily:n.font}}]}}function ho(e,t,n,r){let i=n-t||1,a=[t,...(e.thresholds??[]).map(e=>Math.min(n,Math.max(t,e.value))),n].sort((e,t)=>e-t),o=[];for(let t=0;t[(e.end-t)/i,r.status[e.status]])}var go=function(e,t){return go=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},go(e,t)};function H(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);go(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var _o=`12px sans-serif`,vo=20,yo=100,bo=`007LLmW'55;N0500LLLLLLLLLL00NNNLzWW\\\\WQb\\0FWLg\\bWb\\WQ\\WrWWQ000CL5LLFLL0LL**F*gLLLL5F0LF\\FFF5.5N`;function xo(e){var t={};if(typeof JSON>`u`)return t;for(var n=0;n=0)s=o*n.length;else for(var c=0;c=Io&&(Fo=0),Fo++}function Ro(){var e=[...arguments];typeof console<`u`&&console.error.apply(console,e)}function zo(e){if(typeof e!=`object`||!e)return e;var t=e,n=Eo.call(e);if(n===`[object Array]`){if(!vs(e)){t=[];for(var r=0,i=e.length;r`u`&&typeof self<`u`?ks.worker=!0:!ks.hasGlobalWindow||`Deno`in window||typeof navigator<`u`&&typeof navigator.userAgent==`string`&&navigator.userAgent.indexOf(`Node.js`)>-1?(ks.node=!0,ks.svgSupported=!0):As(navigator.userAgent,ks);function As(e,t){var n=t.browser,r=e.match(/Firefox\/([\d.]+)/),i=e.match(/MSIE\s([\d.]+)/)||e.match(/Trident\/.+?rv:(([\d.]+))/),a=e.match(/Edge?\/([\d.]+)/),o=/micromessenger/i.test(e);if(r&&(n.firefox=!0,n.version=r[1]),i&&(n.ie=!0,n.version=i[1]),a&&(n.edge=!0,n.version=a[1],n.newEdge=+a[1].split(`.`)[0]>18),o&&(n.weChat=!0),t.svgSupported=typeof SVGRect<`u`,t.touchEventsSupported=`ontouchstart`in window&&!n.ie&&!n.edge,t.pointerEventsSupported=`onpointerdown`in window&&(n.edge||n.ie&&+n.version>=11),t.domSupported=typeof document<`u`){var s=document.documentElement.style;t.transform3dSupported=(n.ie&&`transition`in s||n.edge||`WebKitCSSMatrix`in window&&`m11`in new WebKitCSSMatrix||`MozPerspective`in s)&&!(`OTransition`in s),t.transformSupported=t.transform3dSupported||n.ie&&+n.version>=9}}var js=1e-4,Ms=20;function Ns(e){return e.replace(/^\s+|\s+$/g,``)}var Ps=Math.min,Fs=Math.max,Is=Math.abs,Ls=Math.round,Rs=Math.floor,zs=Math.ceil,Bs=Math.pow,Vs=Math.log,Hs=Math.LN10,Us=Math.PI,Ws=Math.random;function Gs(e,t,n,r){var i=t[0],a=t[1],o=n[0],s=n[1],c=a-i,l=s-o;if(c===0)return l===0?o:(o+s)/2;if(r){if(c>0){if(e<=i)return o;if(e>=a)return s}else if(e>=i)return o;else if(e<=a)return s}else{if(e===i)return o;if(e===a)return s}return(e-i)/c*l+o}var Ks=qs;function qs(e,t,n){switch(e){case`center`:case`middle`:e=`50%`;break;case`left`:case`top`:e=`0%`;break;case`right`:case`bottom`:e=`100%`}return Js(e,t,n)}function Js(e,t,n){return J(e)?Ys(e)?parseFloat(e)/100*t+(n||0):parseFloat(e):e==null?NaN:+e}function Ys(e){return!!Ns(e).match(/%$/)}function Xs(e,t,n){return isNaN(t)?n?``+e:+e:(t=Ps(Fs(0,t),Ms),e=(+e).toFixed(t),n?e:+e)}function Zs(e){return e.sort(function(e,t){return e-t}),e}function Qs(e){if(e=+e,isNaN(e))return 0;if(e>1e-14){for(var t=1,n=0;n<15;n++,t*=10)if(Ls(e*t)/t===e)return n}return $s(e)}function $s(e){var t=e.toString().toLowerCase(),n=t.indexOf(`e`),r=n>0?+t.slice(n+1):0,i=n>0?n:t.length,a=t.indexOf(`.`);return Fs(0,(a<0?0:i-1-a)-r)}function ec(e,t,n){var r=Is(e[1]-e[0]);if(!isFinite(r)||r===0)return NaN;var i=Vs(2*Is(n||1)*Is(r))/Hs,a=Vs(Is(t))/Hs,o=Fs(0,zs(-i+a));return isFinite(o)||(o=NaN),o}function tc(e,t){var n=Fs(Qs(e),Qs(t)),r=e+t;return n>Ms?r:Xs(r,n)}var nc=Bs(2,53)-1;function rc(e){var t=Us*2;return(e%t+t)%t}function ic(e){return e>-js&&e=10&&t++,t}function lc(e,t){var n=cc(e),r=Bs(10,n),i=e/r;return e=(t===2?1:t?i<1.5?1:i<2.5?2:i<4?3:i<7?5:10:i<1?1:i<2?2:i<3?3:i<5?5:10)*r,Xs(e,-n)}function uc(e){e.sort(function(e,t){return s(e,t,0)?-1:1});for(var t=-1/0,n=1,r=0;r0?e.length:0),this.item=null,this.key=NaN,this},e.prototype.next=function(){return(this._step>0?this._idx=this._end)&&(this.item=this._list[this._idx],this.key=this._idx+=this._step,!0)},e})();function ol(){return[1/0,-1/0]}function sl(e,t){dl(t)&&(te[1]&&(e[1]=t))}function cl(e,t){dl(t)&&te[1]&&(e[1]=t)}function ul(e,t){fl(t[0],t[1])&&(t[0]e[1]&&(e[1]=t[1]))}function dl(e){return e!=null&&isFinite(e)}function fl(e,t){return dl(e)&&dl(t)&&e<=t}function pl(e){var t=e[1]-e[0];return isFinite(t)&&t>=0}function ml(e){fl(e[0],e[1])&&e[0]>e[1]&&(e[0]=e[1])}function hl(){var e=`__ec_once_`+gl++;return function(t,n){Z(t,e)||(t[e]=1,n())}}var gl=pc();function _l(e,t,n){var r=X(),i=0;W(e,function(a){var o=t(a),s=r.get(o)||0;n&&n(a,s),!s&&!n&&(e[i++]=a),r.set(o,s+1)}),n||(e.length=i)}function vl(e){return e.value+``}function yl(e){return e+``}function bl(e,t){return Y(t,!0)?e.seriesIndex+2:0}function xl(e,t,n){var r=e.getData().count();return{progressiveRender:n.progressiveEnabled&&t.incrementalPrepareRender&&r>=n.threshold,large:e.get(`large`)&&r>=e.get(`largeThreshold`),modDataCount:e.get(`progressiveChunkMode`)===`mod`?e.getData().count():null}}function Sl(e){return{overallReset:e}}var Cl=`.`,wl=`___EC__COMPONENT__CONTAINER___`,Tl=`___EC__EXTENDED_CLASS___`;function El(e){var t={main:``,sub:``};if(e){var n=e.split(Cl);t.main=n[0]||``,t.sub=n[1]||``}return t}function Dl(e){ms(/^[a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)?$/.test(e),`componentType "`+e+`" illegal`)}function Ol(e){return!!(e&&e[Tl])}function kl(e,t){e.$constructor=e,e.extend=function(e){var t=this,n;return Al(t)?n=function(e){H(t,e);function t(){return e.apply(this,arguments)||this}return t}(t):(n=function(){(e.$constructor||t).apply(this,arguments)},Go(n,this)),U(n.prototype,e),n[Tl]=!0,n.extend=this.extend,n.superCall=Pl,n.superApply=Fl,n.superClass=t,n}}function Al(e){return es(e)&&/^class\s/.test(Function.prototype.toString.call(e))}function jl(e,t){e.extend=t.extend}var Ml=Math.round(Math.random()*10);function Nl(e){var t=[`__\0is_clz`,Ml++].join(`_`);e.prototype[t]=!0,e.isInstance=function(e){return!!(e&&e[t])}}function Pl(e,t){var n=[...arguments].slice(2);return this.superClass.prototype[t].apply(e,n)}function Fl(e,t,n){return this.superClass.prototype[t].apply(e,n)}function Il(e){var t={};e.registerClass=function(e){var r=e.type||e.prototype.type;if(r){Dl(r),e.prototype.type=r;var i=El(r);if(!i.sub)t[i.main]=e;else if(i.sub!==wl){var a=n(i);a[i.sub]=e}}return e},e.getClass=function(e,n,r){var i=t[e];if(i&&i[wl]&&(i=n?i[n]:null),r&&!i)throw Error(n?`Component `+e+`.`+(n||``)+` is used but not imported.`:e+`.type should be specified.`);return i},e.getClassesByMainType=function(e){var n=El(e),r=[],i=t[n.main];return i&&i[wl]?W(i,function(e,t){t!==wl&&r.push(e)}):r.push(i),r},e.hasClass=function(e){return!!t[El(e).main]},e.getAllClassMainTypes=function(){var e=[];return W(t,function(t,n){e.push(n)}),e},e.hasSubTypes=function(e){var n=t[El(e).main];return n&&n[wl]};function n(e){var n=t[e.main];return(!n||!n[wl])&&(n=t[e.main]={},n[wl]=!0),n}}function Ll(e,t){for(var n=0;n=0||i&&Wo(i,s)<0)){var c=n.getShallow(s,t);c!=null&&(a[e[o][0]]=c)}}return a}}var Rl=Ll([[`fill`,`color`],[`shadowBlur`],[`shadowOffsetX`],[`shadowOffsetY`],[`opacity`],[`shadowColor`]]),zl=function(){function e(){}return e.prototype.getAreaStyle=function(e,t){return Rl(this,e,t)},e}(),Bl=function(){function e(e){this.value=e}return e}(),Vl=function(){function e(){this._len=0}return e.prototype.insert=function(e){var t=new Bl(e);return this.insertEntry(t),t},e.prototype.insertEntry=function(e){this.head?(this.tail.next=e,e.prev=this.tail,e.next=null,this.tail=e):this.head=this.tail=e,this._len++},e.prototype.remove=function(e){var t=e.prev,n=e.next;t?t.next=n:this.head=n,n?n.prev=t:this.tail=t,e.next=e.prev=null,this._len--},e.prototype.len=function(){return this._len},e.prototype.clear=function(){this.head=this.tail=null,this._len=0},e}(),Hl=function(){function e(e){this._list=new Vl,this._maxSize=10,this._map={},this._maxSize=e}return e.prototype.put=function(e,t){var n=this._list,r=this._map,i=null;if(r[e]==null){var a=n.len(),o=this._lastRemovedEntry;if(a>=this._maxSize&&a>0){var s=n.head;n.remove(s),delete r[s.key],i=s.value,this._lastRemovedEntry=s}o?o.value=t:o=new Bl(t),o.key=e,n.insertEntry(o),r[e]=o}return i},e.prototype.get=function(e){var t=this._map[e],n=this._list;if(t!=null)return t!==n.tail&&(n.remove(t),n.insertEntry(t)),t.value},e.prototype.clear=function(){this._list.clear(),this._map={}},e.prototype.len=function(){return this._list.len()},e}(),Ul=new Hl(50);function Wl(e){if(typeof e==`string`){var t=Ul.get(e);return t&&t.image}return e}function Gl(e,t,n,r,i){if(!e)return t;if(typeof e==`string`){if(t&&t.__zrImageSrc===e||!n)return t;var a=Ul.get(e),o={hostEl:n,cb:r,cbPayload:i};return a?(t=a.image,!ql(t)&&a.pending.push(o)):(t=Co.loadImage(e,Kl,Kl),t.__zrImageSrc=e,Ul.put(e,t.__cachedImgObj={image:t,pending:[o]})),t}return e}function Kl(){var e=this.__cachedImgObj;this.onload=this.onerror=this.__cachedImgObj=null;for(var t=0;tu||d>f||p>m||h>g)return!1;var _=!(u=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height},e.prototype.contain=function(t,n){return e.contain(this,t,n)},e.prototype.clone=function(){return new e(this.x,this.y,this.width,this.height)},e.prototype.copy=function(e){Lu(this,e)},e.prototype.plain=function(){return{x:this.x,y:this.y,width:this.width,height:this.height}},e.prototype.isFinite=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)},e.prototype.isZero=function(){return this.width===0||this.height===0},e.create=function(t){return new e(t?t.x:0,t?t.y:0,t?t.width:0,t?t.height:0)},e.copy=function(e,t){return e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height,e},e.applyTransform=function(e,t,n){if(!n){e!==t&&Lu(e,t);return}if(n[1]<1e-5&&n[1]>-1e-5&&n[2]<1e-5&&n[2]>-1e-5){var r=n[0],i=n[3],a=n[4],o=n[5];e.x=t.x*r+a,e.y=t.y*i+o,e.width=t.width*r,e.height=t.height*i,e.width<0&&(e.x+=e.width,e.width=-e.width),e.height<0&&(e.y+=e.height,e.height=-e.height);return}Eu.x=Ou.x=t.x,Eu.y=ku.y=t.y,Du.x=ku.x=t.x+t.width,Du.y=Ou.y=t.y+t.height,Eu.transform(n),ku.transform(n),Du.transform(n),Ou.transform(n),e.x=xu(Eu.x,Du.x,Ou.x,ku.x),e.y=xu(Eu.y,Du.y,Ou.y,ku.y);var s=Su(Eu.x,Du.x,Ou.x,ku.x),c=Su(Eu.y,Du.y,Ou.y,ku.y);e.width=s-e.x,e.height=c-e.y},e.calculateTransform=function(e,t,n){var r=n.width/t.width,i=n.height/t.height;return e=Yl(e||[]),Ql(e,e,au(Uu,-t.x,-t.y)),eu(e,e,au(Uu,r,i)),Ql(e,e,au(Uu,n.x,n.y)),e},e}(),Fu=Pu.create,Iu=Pu.set,Lu=Pu.copy,Ru=Pu.calculateTransform,zu=Pu.applyTransform,Bu=Pu.contain,Vu=new Pu(0,0,0,0),Hu=new Pu(0,0,0,0),Uu=[];function Wu(e,t,n,r,i,a,o,s){var c=Cu(t-n),l=Cu(r-e),u=xu(c,l),d=wu[i],f=wu[1-i],p=Tu[i];t=l||!Au.bidirectional)&&(ju[d]=-l,ju[f]=0,Au.useDir&&Au.calcDirMTV())))}function Gu(){var e=0,t=new bu,n=new bu,r={minTv:new bu,maxTv:new bu,useDir:!1,dirMinTv:new bu,touchThreshold:0,bidirectional:!0,negativeSize:!1,reset:function(i,a){r.touchThreshold=0,i&&i.touchThreshold!=null&&(r.touchThreshold=Su(0,i.touchThreshold)),r.negativeSize=!1,a&&(r.minTv.set(1/0,1/0),r.maxTv.set(0,0),r.useDir=!1,i&&i.direction!=null&&(r.useDir=!0,r.dirMinTv.copy(r.minTv),n.copy(r.minTv),e=i.direction,r.bidirectional=i.bidirectional==null||!!i.bidirectional,r.bidirectional||t.set(Math.cos(e),Math.sin(e))))},calcDirMTV:function(){var a=r.minTv,o=r.dirMinTv,s=a.y*a.y+a.x*a.x,c=Math.sin(e),l=Math.cos(e),u=c*a.y+l*a.x;if(i(u)){i(a.x)&&i(a.y)&&o.set(0,0);return}if(n.x=s*l/u,n.y=s*c/u,i(n.x)&&i(n.y)){o.set(0,0);return}(r.bidirectional||t.dot(n)>0)&&n.len()=Xu)){e||=`12px sans-serif`;for(var t=[],n=+new Date,r=0;r<=127;r++)t[r]=Co.measureText(String.fromCharCode(r),e).width;var i=+new Date-n;return i>16?Yu=Xu:i>2&&Yu++,t}}var Yu=0,Xu=5;function Zu(e,t){return e.asciiWidthMapTried||=(e.asciiWidthMap=Ju(e.font),!0),0<=t&&t<=127?e.asciiWidthMap==null?e.asciiCharWidth:e.asciiWidthMap[t]:e.stWideCharWidth}function Qu(e,t){var n=e.strWidthCache,r=n.get(t);return r??(r=Co.measureText(t,e.font).width,n.put(t,r)),r}function $u(e,t,n,r){var i=Qu(Ku(t),e),a=rd(t);return new Pu(td(0,i,n),nd(0,a,r),i,a)}function ed(e,t,n,r){var i=((e||``)+``).split(` +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/panel-sql-editor-DoqW8p7v.js","assets/useRouter-ByJ6_rwb.js","assets/brand-DUaZkIz1.js","assets/index-Du7sNMda.js","assets/useNavigate-B1zgPEUp.js","assets/preload-helper-CButVOn1.js","assets/Tooltip-B3r3s_B9.js","assets/index-C3uJb_UT.css"])))=>i.map(i=>d[i]); +import{a as e,i as t,o as n,r,s as i}from"./useRouter-ByJ6_rwb.js";import{A as a,C as o,D as s,E as c,K as l,M as u,O as d,P as f,Q as p,S as m,T as h,X as g,Y as _,Z as v,_ as y,_t as b,a as x,c as S,d as C,dt as w,f as T,ft as E,g as D,gt as O,h as k,j as A,k as j,lt as M,m as N,mt as P,nt as F,o as I,ot as L,p as ee,r as te,s as ne,st as re,tt as ie,u as ae,ut as R,v as oe,x as z,y as se}from"./brand-DUaZkIz1.js";import{c as ce,s as le,t as ue}from"./preload-helper-CButVOn1.js";import{C as de,E as fe,b as pe,o as me,t as he,w as ge}from"./Tooltip-B3r3s_B9.js";import{a as _e,c as ve,d as ye,i as be,l as xe,n as Se,o as Ce,r as we,s as Te,t as Ee,u as De}from"./dashboard-change-chips-myL7tsV1.js";import{n as Oe,r as ke,t as Ae}from"./WarningCircle.es-wTz6NA9-.js";import{A as je,At as Me,B as Ne,Bt as Pe,C as Fe,D as Ie,E as Le,F as Re,Ft as ze,Gt as Be,H as Ve,Ht as He,I as Ue,It as We,Jt as Ge,Kt as Ke,Lt as qe,M as Je,Mt as Ye,N as Xe,Nt as Ze,O as Qe,P as $e,Pt as et,Q as tt,R as nt,Rt as rt,U as it,Ut as at,V as ot,W as st,Wt as ct,Xt as lt,Yt as ut,Zt as dt,_ as ft,a as pt,b as mt,c as ht,d as gt,h as _t,i as vt,j as yt,jt as bt,k as xt,l as St,m as Ct,n as wt,o as Tt,qt as Et,r as Dt,s as Ot,t as kt,u as At,v as jt,w as Mt,x as Nt,zt as Pt}from"./index-Du7sNMda.js";function Ft(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!t.has(n)||!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();let n=It(e);if(n.length!==It(t).length)return!1;for(let r=0;r{if(typeof n!=`string`||n.trim().length===0)throw Error(t);return`${e}-${n}`}}var V=r();function Rt(e){return typeof e==`object`&&e?`base`in e?e.base:void 0:e}function zt(e,t){if(e===t||Number.isNaN(e)&&Number.isNaN(t))return!0;if(!(e instanceof Object)||!(t instanceof Object))return!1;let n=Object.keys(e),{length:r}=n;if(r!==Object.keys(t).length)return!1;for(let i=0;i{r.current||=window.setTimeout(()=>{i(...e),r.current=null},t)},[t]),o=(0,B.useCallback)(()=>{r.current&&=(window.clearTimeout(r.current),null)},[]);return(0,B.useEffect)(()=>(n.autoInvoke&&a(),o),[o,a]),{start:a,clear:o}}function Wt(e){let t=(0,B.useRef)(void 0);return(0,B.useEffect)(()=>{t.current=e},[e]),t.current}function Gt(e,t,n){let r=(0,B.useRef)(null);(0,B.useEffect)(()=>{r.current&&=(r.current.disconnect(),null);let i=typeof n==`function`?n():n;return i&&(r.current=new MutationObserver(e),r.current.observe(i,t)),()=>{r.current&&=(r.current.disconnect(),null)}},[e,t,n])}function Kt(){let[e,t]=(0,B.useState)(!1);return(0,B.useEffect)(()=>t(!0),[]),e}function qt(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`}function Jt(e,t=document){let n=t.querySelector(e);if(n)return n;let r=t.querySelectorAll(`*`);for(let t=0;t{if(!e||!t||!n.current)return;let r=e.getBoundingClientRect(),i=t.getBoundingClientRect(),a=t.offsetWidth===0?1:i.width/t.offsetWidth,o=t.offsetHeight===0?1:i.height/t.offsetHeight,s=window.getComputedStyle(e),c=window.getComputedStyle(t),l=pe(s.borderTopWidth)+pe(c.borderTopWidth),u=pe(s.borderLeftWidth)+pe(c.borderLeftWidth),d={top:(r.top-i.top)/o-l,left:(r.left-i.left)/a-u,width:r.width/a,height:r.height/o};n.current.style.transform=`translateY(${d.top}px) translateX(${d.left}px)`,n.current.style.width=`${d.width}px`,n.current.style.height=`${d.height}px`},p=()=>{window.clearTimeout(o.current),n.current&&(n.current.style.transitionDuration=`0ms`),f(),o.current=window.setTimeout(()=>{n.current&&(n.current.style.transitionDuration=``)},30)},m=(0,B.useRef)(null),h=(0,B.useRef)(null);return(0,B.useEffect)(()=>{if(c&&s.current!==e&&i&&i(),s.current=e,f(),e)return m.current=new ResizeObserver(p),m.current.observe(e),t&&(h.current=new ResizeObserver(p),h.current.observe(t)),()=>{m.current?.disconnect(),h.current?.disconnect()}},[t,e]),(0,B.useEffect)(()=>{if(t){let e=e=>{Qt(e.target,t)&&(p(),d(!1))};return t.addEventListener(`transitionend`,e),()=>{t.removeEventListener(`transitionend`,e)}}},[t]),(0,B.useEffect)(()=>{if(n.current&&a){let e=e=>{e.propertyName===`transform`&&a()};return n.current.addEventListener(`transitionend`,e),()=>{n.current?.removeEventListener(`transitionend`,e)}}},[a]),Ut(()=>{ye()!==`test`&&l(!0)},20,{autoInvoke:!0}),Gt(e=>{e.forEach(e=>{e.type===`attributes`&&e.attributeName===`dir`&&p()})},{attributes:!0,attributeFilter:[`dir`]},()=>document.documentElement),{initialized:c,hidden:u}}var en={root:`m_96b553a6`},tn=g((e,{transitionDuration:t},{shouldReduceMotion:n})=>({root:{"--transition-duration":e.respectReducedMotion&&n?`0ms`:typeof t==`number`?`${t}ms`:t||`150ms`}})),nn=h(e=>{let t=u(`FloatingIndicator`,null,e),{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:l,target:d,parent:f,transitionDuration:m,mod:h,displayAfterTransitionEnd:g,onTransitionStart:_,onTransitionEnd:v,attributes:y,ref:b,...x}=t,S=p(),C=a({name:`FloatingIndicator`,classes:en,props:t,className:r,style:i,classNames:n,styles:s,unstyled:c,attributes:y,vars:l,varsResolver:tn,stylesCtx:{shouldReduceMotion:S}}),w=(0,B.useRef)(null),{initialized:T,hidden:E}=$t({target:d,parent:f,ref:w,displayAfterTransitionEnd:g,onTransitionStart:_,onTransitionEnd:v}),D=ie(b,w);return!d||!f?null:(0,V.jsx)(o,{ref:D,mod:[{initialized:T,hidden:E},h],...C(`root`),...x})});nn.displayName=`@mantine/core/FloatingIndicator`,nn.classes=en,nn.varsResolver=tn;var[rn,an]=fe(`Accordion component was not found in the tree`),[on,sn]=fe(`Accordion.Item component was not found in the tree`),cn={root:`m_9bdbb667`,panel:`m_df78851f`,content:`m_4ba554d4`,itemTitle:`m_8fa820a0`,control:`m_4ba585b8`,"control--default":`m_6939a5e9`,"control--contained":`m_4271d21b`,label:`m_df3ffa0f`,chevron:`m_3f35ae96`,icon:`m_9bd771fe`,item:`m_9bd7b098`,"item--default":`m_fe19b709`,"item--contained":`m_1f921b3b`,"item--filled":`m_2cdf939a`,"item--separated":`m_9f59b069`},ln=h(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,chevron:s,icon:c,onClick:l,onKeyDown:d,children:f,disabled:p,mod:h,...g}=u(`AccordionControl`,null,e),{value:_}=sn(),v=an(),y=v.isItemActive(_),b=typeof v.order==`number`,x=`h${v.order}`,S=(0,V.jsxs)(m,{...v.getStyles(`control`,{className:n,classNames:t,style:r,styles:i,variant:v.variant}),unstyled:v.unstyled,mod:[`accordion-control`,{active:y,"chevron-position":v.chevronPosition,disabled:p},h],onClick:e=>{l?.(e),v.onChange(_)},type:`button`,disabled:p,"aria-expanded":y,"aria-controls":v.getRegionId(_),id:v.getControlId(_),onKeyDown:Et({siblingSelector:`[data-accordion-control]`,parentSelector:`[data-accordion]`,activateOnFocus:!1,loop:v.loop,orientation:`vertical`,onKeyDown:d}),...g,children:[(0,V.jsx)(o,{component:`span`,mod:{rotate:!v.disableChevronRotation&&y,position:v.chevronPosition},...v.getStyles(`chevron`,{classNames:t,styles:i}),children:s||v.chevron}),(0,V.jsx)(`span`,{...v.getStyles(`label`,{classNames:t,styles:i}),children:f}),c&&(0,V.jsx)(o,{component:`span`,mod:{"chevron-position":v.chevronPosition},...v.getStyles(`icon`,{classNames:t,styles:i}),children:c})]});return b?(0,V.jsx)(x,{...v.getStyles(`itemTitle`,{classNames:t,styles:i}),children:S}):S});ln.displayName=`@mantine/core/AccordionControl`,ln.classes=cn;var un=h(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,value:s,mod:c,...l}=u(`AccordionItem`,null,e),d=an();return(0,V.jsx)(on,{value:{value:s},children:(0,V.jsx)(o,{mod:[{active:d.isItemActive(s)},c],...d.getStyles(`item`,{className:n,classNames:t,styles:i,style:r,variant:d.variant}),...l})})});un.displayName=`@mantine/core/AccordionItem`,un.classes=cn;var dn=h(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,children:o,keepMounted:s,keepMountedMode:c,...l}=u(`AccordionPanel`,null,e),{value:d}=sn(),f=an();return(0,V.jsx)(De,{...f.getStyles(`panel`,{className:n,classNames:t,style:r,styles:i}),expanded:f.isItemActive(d),transitionDuration:f.transitionDuration??200,role:`region`,id:f.getRegionId(d),"aria-labelledby":f.getControlId(d),keepMounted:s??f.keepMounted,keepMountedMode:c??f.keepMountedMode,...l,children:(0,V.jsx)(`div`,{...f.getStyles(`content`,{classNames:t,styles:i}),children:o})})});dn.displayName=`@mantine/core/AccordionPanel`,dn.classes=cn;var fn={multiple:!1,loop:!0,disableChevronRotation:!1,disableCollapse:!1,chevronPosition:`right`,variant:`default`,chevronSize:`auto`,chevronIconSize:16,keepMountedMode:`activity`},pn=g((e,{transitionDuration:t,chevronSize:n,radius:r})=>({root:{"--accordion-transition-duration":t===void 0?void 0:`${t}ms`,"--accordion-chevron-size":n===void 0?void 0:P(n),"--accordion-radius":r===void 0?void 0:re(r)}})),mn=c(e=>{let t=u(`Accordion`,fn,e),{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:l,children:d,multiple:f,value:p,defaultValue:m,onChange:h,id:g,loop:_,transitionDuration:v,disableChevronRotation:y,disableCollapse:b,chevronPosition:x,chevronSize:S,order:C,chevron:w,variant:T,radius:E,chevronIconSize:D,attributes:O,keepMounted:k,keepMountedMode:A,...j}=t,M=F(g),[N,P]=Be({value:p,defaultValue:m,finalValue:f?[]:null,onChange:h}),I=e=>Array.isArray(N)?N.includes(e):e===N,L=e=>{if(!Array.isArray(N)&&b&&e===N)return;let t=Array.isArray(N)?N.includes(e)?N.filter(t=>t!==e):[...N,e]:e===N?null:e;P(t)},ee=a({name:`Accordion`,classes:cn,props:t,className:r,style:i,classNames:n,styles:s,unstyled:c,attributes:O,vars:l,varsResolver:pn});return(0,V.jsx)(rn,{value:{isItemActive:I,onChange:L,getControlId:Lt(`${M}-control`,`Accordion.Item component was rendered with invalid value or without value`),getRegionId:Lt(`${M}-panel`,`Accordion.Item component was rendered with invalid value or without value`),chevron:w===null?null:w||(0,V.jsx)(rt,{size:D}),transitionDuration:v,disableChevronRotation:y,chevronPosition:x,order:C,loop:_,getStyles:ee,variant:T,unstyled:c,keepMounted:k,keepMountedMode:A},children:(0,V.jsx)(o,{...ee(`root`),id:M,...j,variant:T,"data-accordion":!0,children:d})})});mn.classes=cn,mn.varsResolver=pn,mn.displayName=`@mantine/core/Accordion`,mn.Item=un,mn.Panel=dn,mn.Control=ln,mn.Chevron=rt;function hn(e){return typeof e==`string`?{value:e,label:e}:typeof e==`object`&&`value`in e&&!(`label`in e)?{value:e.value,label:`${e.value}`,disabled:e.disabled}:typeof e==`object`&&`group`in e?{group:e.group,items:e.items.map(e=>hn(e))}:typeof e==`number`||typeof e==`bigint`||typeof e==`boolean`?{value:e,label:`${e}`}:e}function gn(e){return e?e.map(e=>hn(e)):[]}function _n(e){return e.reduce((e,t)=>`group`in t?{...e,..._n(t.items)}:(e[`${t.value}`]=t,e),{})}var vn={dropdown:`m_88b62a41`,search:`m_985517d8`,options:`m_b2821a6e`,option:`m_92253aa5`,empty:`m_2530cd1d`,header:`m_858f94bd`,footer:`m_82b967cb`,group:`m_254f3e4f`,groupLabel:`m_2bb2e9e5`,chevron:`m_2943220b`,optionsDropdownOption:`m_390b5f4`,optionsDropdownCheckIcon:`m_8ee53fc2`,optionsDropdownCheckPlaceholder:`m_a530ee0a`},yn={error:null},bn=g((e,{size:t,color:n})=>({chevron:{"--combobox-chevron-size":M(t,`combobox-chevron-size`),"--combobox-chevron-color":n?l(n,e):void 0}})),xn=h(e=>{let t=u(`ComboboxChevron`,yn,e),{size:n,error:r,style:i,className:s,classNames:c,styles:l,unstyled:d,vars:f,attributes:p,mod:m,...h}=t,g=a({name:`ComboboxChevron`,classes:vn,props:t,style:i,className:s,classNames:c,styles:l,unstyled:d,vars:f,varsResolver:bn,attributes:p,rootSelector:`chevron`});return(0,V.jsx)(o,{component:`svg`,...h,...g(`chevron`),size:n,viewBox:`0 0 15 15`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,mod:[`combobox-chevron`,{error:r},m],children:(0,V.jsx)(`path`,{d:`M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z`,fill:`currentColor`,fillRule:`evenodd`,clipRule:`evenodd`})})});xn.classes=vn,xn.varsResolver=bn,xn.displayName=`@mantine/core/ComboboxChevron`;var[Sn,Cn]=fe(`Combobox component was not found in tree`);function wn({onMouseDown:e,onClick:t,onClear:n,...r}){return(0,V.jsx)(k.ClearButton,{tabIndex:-1,"aria-hidden":!0,...r,onMouseDown:t=>{t.preventDefault(),e?.(t)},onClick:e=>{n(),t?.(e)}})}wn.displayName=`@mantine/core/ComboboxClearButton`;var Tn=h(e=>{let{classNames:t,styles:n,className:r,style:i,hidden:a,...o}=u(`ComboboxDropdown`,null,e),s=Cn();return(0,V.jsx)(Pe.Dropdown,{...o,role:`presentation`,"data-hidden":a||void 0,"data-floating-height":s.floatingHeight||void 0,...s.getStyles(`dropdown`,{className:r,style:i,classNames:t,styles:n})})});Tn.classes=vn,Tn.displayName=`@mantine/core/ComboboxDropdown`;var En={refProp:`ref`},Dn=h(e=>{let{children:t,refProp:n,ref:r}=u(`ComboboxDropdownTarget`,En,e);if(Cn(),!w(t))throw Error(`Combobox.DropdownTarget component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);return(0,V.jsx)(Pe.Target,{ref:r,refProp:n,children:t})});Dn.displayName=`@mantine/core/ComboboxDropdownTarget`;var On=h(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...s}=u(`ComboboxEmpty`,null,e),c=Cn();return(0,V.jsx)(o,{...c.getStyles(`empty`,{className:n,classNames:t,styles:i,style:r}),...s})});On.classes=vn,On.displayName=`@mantine/core/ComboboxEmpty`;function kn({onKeyDown:e,onClick:t,withKeyboardNavigation:n,withAriaAttributes:r,withExpandedAttribute:i,targetType:a,autoComplete:o}){let s=Cn(),[c,l]=(0,B.useState)(null),u=t=>{if(e?.(t),!s.readOnly&&n){if(t.nativeEvent.isComposing)return;if(t.nativeEvent.code===`ArrowDown`&&(t.preventDefault(),s.store.dropdownOpened?l(s.store.selectNextOption()):(s.store.openDropdown(`keyboard`),l(s.store.selectActiveOption()),s.store.updateSelectedOptionIndex(`selected`,{scrollIntoView:!0}))),t.nativeEvent.code===`ArrowUp`&&(t.preventDefault(),s.store.dropdownOpened?l(s.store.selectPreviousOption()):(s.store.openDropdown(`keyboard`),l(s.store.selectActiveOption()),s.store.updateSelectedOptionIndex(`selected`,{scrollIntoView:!0}))),t.nativeEvent.code===`Enter`||t.nativeEvent.code===`NumpadEnter`){if(t.nativeEvent.keyCode===229)return;let e=s.store.getSelectedOptionIndex();s.store.dropdownOpened&&e!==-1?(t.preventDefault(),s.store.clickSelectedOption()):a===`button`&&(t.preventDefault(),s.store.openDropdown(`keyboard`))}t.key===`Escape`&&s.store.closeDropdown(`keyboard`),t.nativeEvent.code===`Space`&&a===`button`&&(t.preventDefault(),s.store.toggleDropdown(`keyboard`))}},d=r?{...i?{role:`combobox`}:{},"aria-haspopup":`listbox`,"aria-expanded":i?!!(s.store.listId&&s.store.dropdownOpened):void 0,"aria-controls":s.store.dropdownOpened&&s.store.listId?s.store.listId:void 0,"aria-activedescendant":s.store.dropdownOpened&&c||void 0,autoComplete:o,"data-expanded":s.store.dropdownOpened||void 0,"data-mantine-stop-propagation":s.store.dropdownOpened||void 0}:{},f=e=>{a===`button`&&e.currentTarget.focus(),t?.(e)};return{...d,onKeyDown:u,onClick:f}}var An={refProp:`ref`,targetType:`input`,withKeyboardNavigation:!0,withAriaAttributes:!0,withExpandedAttribute:!1,autoComplete:`off`},jn=h(e=>{let{children:t,refProp:n,withKeyboardNavigation:r,withAriaAttributes:i,withExpandedAttribute:a,targetType:o,autoComplete:s,ref:c,...l}=u(`ComboboxEventsTarget`,An,e),d=v(t);if(!d)throw Error(`Combobox.EventsTarget component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);let f=Cn(),p=kn({targetType:o,withAriaAttributes:i,withKeyboardNavigation:r,withExpandedAttribute:a,onKeyDown:d.props.onKeyDown,onClick:d.props.onClick,autoComplete:s});return(0,B.cloneElement)(d,{...p,...l,[n]:ie(c,f.store.targetRef,de(d))})});jn.displayName=`@mantine/core/ComboboxEventsTarget`;var Mn=h(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...s}=u(`ComboboxFooter`,null,e),c=Cn();return(0,V.jsx)(o,{...c.getStyles(`footer`,{className:n,classNames:t,style:r,styles:i}),...s,onMouseDown:e=>{e.preventDefault()}})});Mn.classes=vn,Mn.displayName=`@mantine/core/ComboboxFooter`;var Nn=h(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,children:s,label:c,id:l,...d}=u(`ComboboxGroup`,null,e),f=Cn(),p=F(l),m=c!=null&&c!==!1&&c!==``;return(0,V.jsxs)(o,{role:`group`,"aria-labelledby":m?p:void 0,...f.getStyles(`group`,{className:n,classNames:t,style:r,styles:i}),...d,children:[m&&(0,V.jsx)(`div`,{id:p,...f.getStyles(`groupLabel`,{classNames:t,styles:i}),children:c}),s]})});Nn.classes=vn,Nn.displayName=`@mantine/core/ComboboxGroup`;var Pn=h(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,...s}=u(`ComboboxHeader`,null,e),c=Cn();return(0,V.jsx)(o,{...c.getStyles(`header`,{className:n,classNames:t,style:r,styles:i}),...s,onMouseDown:e=>{e.preventDefault()}})});Pn.classes=vn,Pn.displayName=`@mantine/core/ComboboxHeader`;function Fn({value:e,valuesDivider:t=`,`,...n}){return(0,V.jsx)(`input`,{type:`hidden`,value:Array.isArray(e)?e.join(t):e?`${e}`:``,...n})}Fn.displayName=`@mantine/core/ComboboxHiddenInput`;var In=h(e=>{let t=u(`ComboboxOption`,null,e),{classNames:n,className:r,style:i,styles:a,vars:s,onClick:c,id:l,active:d,onMouseDown:f,onMouseOver:p,disabled:m,selected:h,mod:g,..._}=t,v=Cn(),y=(0,B.useId)(),b=l||y;return(0,V.jsx)(o,{...v.getStyles(`option`,{className:r,classNames:n,styles:a,style:i}),"aria-disabled":m||void 0,..._,id:b,mod:[`combobox-option`,{"combobox-active":d,"combobox-disabled":m,"combobox-selected":h},g],role:`option`,onClick:e=>{m?e.preventDefault():(v.onOptionSubmit?.(t.value,t),c?.(e))},onMouseDown:e=>{e.preventDefault(),f?.(e)},onMouseOver:e=>{v.resetSelectionOnOptionHover&&v.store.resetSelectedOption(),p?.(e)}})});In.classes=vn,In.displayName=`@mantine/core/ComboboxOption`;var Ln=h(e=>{let{classNames:t,className:n,style:r,styles:i,id:a,onMouseDown:s,labelledBy:c,...l}=u(`ComboboxOptions`,null,e),d=Cn(),f=F(a);return(0,B.useEffect)(()=>{d.store.setListId(f)},[f]),(0,V.jsx)(o,{...d.getStyles(`options`,{className:n,style:r,classNames:t,styles:i}),...l,id:f,role:`listbox`,"aria-labelledby":c,onMouseDown:e=>{e.preventDefault(),s?.(e)}})});Ln.classes=vn,Ln.displayName=`@mantine/core/ComboboxOptions`;var Rn={withAriaAttributes:!0,withKeyboardNavigation:!0},zn=h(e=>{let{classNames:t,styles:n,unstyled:r,vars:i,withAriaAttributes:a,onKeyDown:o,onClick:s,withKeyboardNavigation:c,size:l,ref:d,...f}=u(`ComboboxSearch`,Rn,e),p=Cn(),m=p.getStyles(`search`),h=kn({targetType:`input`,withAriaAttributes:a,withKeyboardNavigation:c,withExpandedAttribute:!1,onKeyDown:o,onClick:s,autoComplete:`off`});return(0,V.jsx)(k,{ref:ie(d,p.store.searchRef),classNames:[{input:m.className},t],styles:[{input:m.style},n],size:l||p.size,...h,...f,__staticSelector:`Combobox`})});zn.classes=vn,zn.displayName=`@mantine/core/ComboboxSearch`;var Bn={refProp:`ref`,targetType:`input`,withKeyboardNavigation:!0,withAriaAttributes:!0,withExpandedAttribute:!1,autoComplete:`off`},Vn=h(e=>{let{children:t,refProp:n,withKeyboardNavigation:r,withAriaAttributes:i,withExpandedAttribute:a,targetType:o,autoComplete:s,ref:c,...l}=u(`ComboboxTarget`,Bn,e),d=v(t);if(!d)throw Error(`Combobox.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported`);let f=Cn(),p=kn({targetType:o,withAriaAttributes:i,withKeyboardNavigation:r,withExpandedAttribute:a,onKeyDown:d.props.onKeyDown,onClick:d.props.onClick,autoComplete:s}),m=(0,B.cloneElement)(d,{...p,...l});return(0,V.jsx)(Pe.Target,{refProp:n,ref:ie(c,f.store.targetRef),children:m})});Vn.displayName=`@mantine/core/ComboboxTarget`;function Hn(e,t,n){for(let n=e-1;n>=0;--n)if(!t[n].hasAttribute(`data-combobox-disabled`))return n;if(n){for(let e=t.length-1;e>-1;--e)if(!t[e].hasAttribute(`data-combobox-disabled`))return e}return e}function Un(e,t,n){for(let n=e+1;n{s||(c(!0),i?.(e))},[c,i,s]),_=(0,B.useCallback)((e=`unknown`)=>{s&&(c(!1),r?.(e))},[c,r,s]),v=(0,B.useCallback)((e=`unknown`)=>{s?_(e):g(e)},[_,g,s]),y=(0,B.useCallback)(()=>{let e=Xt(f.current);Jt(`#${l.current} [data-combobox-selected]`,e)?.removeAttribute(`data-combobox-selected`)},[]),b=(0,B.useCallback)(e=>{let t=Xt(f.current),n=Jt(`#${l.current}`,t),r=n?Yt(`[data-combobox-option]`,n):null;if(!r)return null;let i=e>=r.length?0:e<0?r.length-1:e;return u.current=i,r?.[i]&&!r[i].hasAttribute(`data-combobox-disabled`)?(y(),r[i].setAttribute(`data-combobox-selected`,`true`),r[i].scrollIntoView({block:`nearest`,behavior:o}),r[i].id):null},[o,y]),x=(0,B.useCallback)(()=>{let e=Xt(f.current),t=Jt(`#${l.current} [data-combobox-active]`,e);if(t){let n=Yt(`#${l.current} [data-combobox-option]`,e).findIndex(e=>e===t);return b(n)}return b(0)},[b]),S=(0,B.useCallback)(()=>{let e=Xt(f.current),t=Yt(`#${l.current} [data-combobox-option]`,e);return b(Un(u.current,t,a))},[b,a]),C=(0,B.useCallback)(()=>{let e=Xt(f.current),t=Yt(`#${l.current} [data-combobox-option]`,e);return b(Hn(u.current,t,a))},[b,a]),w=(0,B.useCallback)(()=>{let e=Xt(f.current),t=Yt(`#${l.current} [data-combobox-option]`,e);return b(Wn(t))},[b]),T=(0,B.useCallback)((e=`selected`,t)=>{if(typeof e==`number`){u.current=e;let n=Xt(f.current),r=Yt(`#${l.current} [data-combobox-option]`,n);t?.scrollIntoView&&r[e]?.scrollIntoView({block:`nearest`,behavior:o});return}h.current=window.setTimeout(()=>{let n=Xt(f.current),r=Yt(`#${l.current} [data-combobox-option]`,n),i=r.findIndex(t=>t.hasAttribute(`data-combobox-${e}`));u.current=i,t?.scrollIntoView&&r[i]?.scrollIntoView({block:`nearest`,behavior:o})},0)},[]),E=(0,B.useCallback)(()=>{u.current=-1,y()},[y]),D=(0,B.useCallback)(()=>{let e=Xt(f.current);(Yt(`#${l.current} [data-combobox-option]`,e)?.[u.current])?.click()},[]),O=(0,B.useCallback)(e=>{l.current=e},[]),k=(0,B.useCallback)(()=>{p.current=window.setTimeout(()=>d.current?.focus(),0)},[]),A=(0,B.useCallback)(()=>{m.current=window.setTimeout(()=>f.current?.focus(),0)},[]),j=(0,B.useCallback)(()=>u.current,[]);return(0,B.useEffect)(()=>()=>{window.clearTimeout(p.current),window.clearTimeout(m.current),window.clearTimeout(h.current)},[]),{dropdownOpened:s,openDropdown:g,closeDropdown:_,toggleDropdown:v,selectedOptionIndex:u.current,getSelectedOptionIndex:j,selectOption:b,selectFirstOption:w,selectActiveOption:x,selectNextOption:S,selectPreviousOption:C,resetSelectedOption:E,updateSelectedOptionIndex:T,listId:l.current,setListId:O,clickSelectedOption:D,searchRef:d,focusSearchInput:k,targetRef:f,focusTarget:A}}var Kn={keepMounted:!0,keepMountedMode:`display-none`,withinPortal:!0,resetSelectionOnOptionHover:!1,width:`target`,transitionProps:{transition:`fade`,duration:0},size:`sm`},qn=g((e,{size:t,dropdownPadding:n})=>({options:{"--combobox-option-fz":L(t),"--combobox-option-padding":M(t,`combobox-option-padding`)},dropdown:{"--combobox-padding":n===void 0?void 0:P(n),"--combobox-option-fz":L(t),"--combobox-option-padding":M(t,`combobox-option-padding`)}})),Jn=e=>{let t=u(`Combobox`,Kn,e),{classNames:n,styles:r,unstyled:i,children:o,store:s,vars:c,onOptionSubmit:l,onClose:d,size:f,dropdownPadding:p,resetSelectionOnOptionHover:m,__staticSelector:h,readOnly:g,attributes:_,floatingHeight:v,middlewares:y,...b}=t,x=v===`viewport`?{...y,flip:!1,size:{...typeof y?.size==`object`?y.size:{},padding:typeof y?.size==`object`&&y.size.padding!==void 0?y.size.padding:10,apply:({availableHeight:e,availableWidth:t,elements:n,...r})=>{n.floating.style.setProperty(`--combobox-floating-max-height`,`${e}px`);let i=y?.size;typeof i==`object`&&i.apply?i.apply({availableHeight:e,availableWidth:t,elements:n,...r}):i&&Object.assign(n.floating.style,{maxWidth:`${t}px`,maxHeight:`${e}px`})}}}:y,S=Gn(),C=s||S,w=a({name:h||`Combobox`,classes:vn,props:t,classNames:n,styles:r,unstyled:i,attributes:_,vars:c,varsResolver:qn}),T=()=>{d?.(),C.closeDropdown()};return(0,V.jsx)(Sn,{value:{getStyles:w,store:C,onOptionSubmit:l,size:f,resetSelectionOnOptionHover:m,readOnly:g,floatingHeight:v},children:(0,V.jsx)(Pe,{opened:C.dropdownOpened,...b,middlewares:x,onChange:e=>!e&&T(),withRoles:!1,unstyled:i,children:o})})};Jn.extend=e=>e,Jn.classes=vn,Jn.varsResolver=qn,Jn.displayName=`@mantine/core/Combobox`,Jn.Target=Vn,Jn.Dropdown=Tn,Jn.Options=Ln,Jn.Option=In,Jn.Search=zn,Jn.Empty=On,Jn.Chevron=xn,Jn.Footer=Mn,Jn.Header=Pn,Jn.EventsTarget=jn,Jn.DropdownTarget=Dn,Jn.Group=Nn,Jn.ClearButton=wn,Jn.HiddenInput=Fn;function Yn({children:e,role:t}){let n=(0,B.use)(D);return n?(0,V.jsx)(`div`,{role:t,"aria-labelledby":n.labelId,"aria-describedby":n.describedBy,children:e}):(0,V.jsx)(V.Fragment,{children:e})}var Xn={root:`m_5f75b09e`,body:`m_5f6e695e`,labelWrapper:`m_d3ea56bb`,label:`m_8ee546b8`,description:`m_328f68c0`,error:`m_8e8a99cc`},Zn=Xn;function Qn({__staticSelector:e,__stylesApiProps:t,className:n,classNames:r,styles:i,unstyled:s,children:c,label:l,description:u,id:d,disabled:f,error:p,size:m,labelPosition:h=`left`,bodyElement:g=`div`,labelElement:_=`label`,variant:v,style:y,vars:b,mod:x,attributes:S,...C}){let w=a({name:e,props:t,className:n,style:y,classes:Xn,classNames:r,styles:i,unstyled:s,attributes:S}),T=u?`${d}-description`:void 0,E=p&&typeof p!=`boolean`?`${d}-error`:void 0;return(0,V.jsx)(o,{...w(`root`),__vars:{"--label-fz":L(m),"--label-lh":M(m,`label-lh`)},mod:[{"label-position":h},x],variant:v,size:m,...C,children:(0,V.jsxs)(o,{component:g,htmlFor:g===`label`?d:void 0,...w(`body`),children:[c,(0,V.jsxs)(`div`,{...w(`labelWrapper`),"data-disabled":f||void 0,children:[l&&(0,V.jsx)(o,{component:_,htmlFor:_===`label`?d:void 0,...w(`label`),"data-disabled":f||void 0,children:l}),u&&(0,V.jsx)(k.Description,{id:T,size:m,__inheritStyles:!1,...w(`description`),children:u}),p&&typeof p!=`boolean`&&(0,V.jsx)(k.Error,{id:E,size:m,__inheritStyles:!1,...w(`error`),children:p})]})]})})}Qn.displayName=`@mantine/core/InlineInput`;function $n(e){return`group`in e}function er({options:e,search:t,limit:n}){let r=t.trim().toLowerCase(),i=[];for(let a=0;a0)return!1;return!0}function nr(e,t=new Set){if(Array.isArray(e))for(let n of e)if($n(n))nr(n.items,t);else{if(n.value===void 0)throw Error(`[@mantine/core] Each option must have value property`);if(t.has(n.value))throw Error(`[@mantine/core] Duplicate options are not supported. Option with value "${n.value}" was provided more than once`);t.add(n.value)}}function rr(e,t){return Array.isArray(e)?e.includes(t):e===t}function ir({data:e,withCheckIcon:t,withAlignedLabels:n,value:r,checkIconPosition:i,unstyled:a,renderOption:o}){if(!$n(e)){let s=rr(r,e.value),c=t&&(s?(0,V.jsx)(qe,{className:vn.optionsDropdownCheckIcon}):n?(0,V.jsx)(`div`,{className:vn.optionsDropdownCheckPlaceholder}):null),l=(0,V.jsxs)(V.Fragment,{children:[i===`left`&&c,(0,V.jsx)(`span`,{children:e.label}),i===`right`&&c]});return(0,V.jsx)(Jn.Option,{value:e.value,disabled:e.disabled,className:_({[vn.optionsDropdownOption]:!a}),"data-reverse":i===`right`||void 0,"data-checked":s||void 0,"aria-selected":s,active:s,children:typeof o==`function`?o({option:e,checked:s}):l})}let s=e.items.map(e=>(0,V.jsx)(ir,{data:e,value:r,unstyled:a,withCheckIcon:t,withAlignedLabels:n,checkIconPosition:i,renderOption:o},`${e.value}`));return(0,V.jsx)(Jn.Group,{label:e.group,children:s})}function ar({data:e,hidden:t,hiddenWhenEmpty:n,filter:r,search:i,limit:a,maxDropdownHeight:o,floatingHeight:s,withScrollArea:c=!0,filterOptions:l=!0,withCheckIcon:u=!1,withAlignedLabels:d=!1,value:f,checkIconPosition:p,nothingFoundMessage:m,unstyled:h,labelId:g,renderOption:_,scrollAreaProps:v,"aria-label":y}){let b=Cn();nr(e);let x=typeof i==`string`?(r||er)({options:e,search:l?i:``,limit:a??1/0}):e,S=tr(x),C=x.map((e,t)=>(0,V.jsx)(ir,{data:e,withCheckIcon:u,withAlignedLabels:d,value:f,checkIconPosition:p,unstyled:h,renderOption:_},$n(e)?`group-${typeof e.group==`string`?e.group:t}`:`${e.value}`));return(0,V.jsx)(Jn.Dropdown,{hidden:t||n&&S,"data-composed":!0,children:(0,V.jsxs)(Jn.Options,{labelledBy:g,"aria-label":y,children:[c?(0,V.jsx)(me.Autosize,{mah:(s??b.floatingHeight)===`viewport`?`var(--combobox-floating-options-max-height)`:o??220,type:`scroll`,scrollbarSize:`var(--combobox-padding)`,offsetScrollbars:`y`,...v,children:C}):C,S&&m&&(0,V.jsx)(Jn.Empty,{children:m})]})})}function or(e,t,n,r){if(t===n||r===`before`&&n===t+1||r===`after`&&n===t-1)return e;let i=e.slice(),[a]=i.splice(t,1),o=t{let t=e.lastElementChild;return t?t instanceof HTMLInputElement?t:t.querySelector(`input`):null},cr=(e,t)=>{if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n{let e=i.current;e&&(i.current=null,cr(o.current,e.expectedValue)&&e.container?.querySelector(`[data-mantine-pill-index="${e.index}"]`)?.focus())});let s=(0,B.useCallback)(e=>{a.current=e},[]);return{getPillProps:e=>{if(n)return{draggable:!0,tabIndex:-1,"data-mantine-pill-index":e,"aria-keyshortcuts":`Alt+ArrowLeft Alt+ArrowRight`,onMouseDown:e=>{e.button===0&&e.stopPropagation()},onDragStart:t=>{t.stopPropagation(),t.dataTransfer.effectAllowed=`move`,t.dataTransfer.setData(`text/plain`,String(e)),r.current.draggedIndex=e;let n=t.currentTarget,i=n.getBoundingClientRect(),a=n.cloneNode(!0);a.removeAttribute(`data-dragging`),a.removeAttribute(`data-drag-over`),a.style.position=`fixed`,a.style.top=`-9999px`,a.style.left=`-9999px`,a.style.width=`${i.width}px`,a.style.height=`${i.height}px`,a.style.pointerEvents=`none`,document.body.appendChild(a),t.dataTransfer.setDragImage(a,t.clientX-i.left,t.clientY-i.top),setTimeout(()=>a.parentNode?.removeChild(a),0),requestAnimationFrame(()=>{n.setAttribute(`data-dragging`,`true`)})},onDragOver:t=>{let{draggedIndex:n}=r.current;if(n===null||n===e)return;let i=t.currentTarget,a=i.getBoundingClientRect(),o=t.clientX-a.left,s=(getComputedStyle(i).direction===`rtl`?o>a.width/2:o{let t=e.currentTarget,n=e.relatedTarget;n&&t.contains(n)||(t.removeAttribute(`data-drag-over`),r.current.currentDropTarget===t&&(r.current.currentDropTarget=null))},onDrop:n=>{n.preventDefault(),n.stopPropagation();let i=n.currentTarget,a=i.getAttribute(`data-drag-over`);i.removeAttribute(`data-drag-over`);let{draggedIndex:s}=r.current;if(s!==null&&a&&s!==e){let n=or(o.current,s,e,a);n!==o.current&&t(n)}r.current.draggedIndex=null,r.current.currentDropTarget=null},onDragEnd:e=>{e.currentTarget.removeAttribute(`data-dragging`);let t=r.current.currentDropTarget;t&&t.removeAttribute(`data-drag-over`),r.current.draggedIndex=null,r.current.currentDropTarget=null},onKeyDown:n=>{if(n.key!==`ArrowLeft`&&n.key!==`ArrowRight`)return;let r=n.currentTarget,a=getComputedStyle(r).direction===`rtl`?n.key===`ArrowLeft`:n.key===`ArrowRight`,s=a?e+1:e-1;if(n.altKey){if(s<0||s>=o.current.length)return;n.preventDefault(),n.stopPropagation();let c=a?`after`:`before`,l=or(o.current,e,s,c);if(l===o.current)return;i.current={container:r.parentElement,index:s,expectedValue:l},t(l);return}if(s<0)return;let c=r.parentElement;if(c){if(n.preventDefault(),n.stopPropagation(),s>=o.current.length){sr(c)?.focus();return}c.querySelector(`[data-mantine-pill-index="${s}"]`)?.focus()}}}},getListProps:()=>n?{ref:s}:{},handleInputKeyDown:e=>{if(!n||e.key!==`ArrowLeft`)return;let t=e.currentTarget;if(!(t.value.length===0||t.selectionStart===0&&t.selectionEnd===0))return;let r=a.current;if(!r)return;let i=r.querySelectorAll(`[data-mantine-pill-index]`);i.length!==0&&(e.preventDefault(),i[i.length-1].focus())}}}function ur({id:e,label:t,labelProps:n,inputWrapperOrder:r}){if(t&&(!r||r.includes(`label`)))return n?.id||`${e}-label`}function dr(e){let t=e.currentTarget;return Xt(t).activeElement!==t}var fr=(0,B.createContext)(null),pr={root:`m_7cda1cd6`,"root--default":`m_44da308b`,"root--contrast":`m_e3a01f8`,label:`m_1e0e6180`,remove:`m_ae386778`,group:`m_1dcfd90b`},mr=(0,B.createContext)(null),hr=g((e,{gap:t},{size:n})=>({group:{"--pg-gap":t===void 0?M(n,`pg-gap`):M(t)}})),gr=h(e=>{let t=u(`PillGroup`,null,e),{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:l,size:d,disabled:f,attributes:p,...m}=t,h=(0,B.use)(fr)?.size||d||void 0,g=a({name:`PillGroup`,classes:pr,props:t,className:r,style:i,classNames:n,styles:s,unstyled:c,attributes:p,vars:l,varsResolver:hr,stylesCtx:{size:h},rootSelector:`group`});return(0,V.jsx)(mr,{value:{size:h,disabled:f},children:(0,V.jsx)(o,{size:h,...g(`group`),...m})})});gr.classes=pr,gr.varsResolver=hr,gr.displayName=`@mantine/core/PillGroup`;var _r={variant:`default`},vr=g((e,{radius:t},{size:n})=>({root:{"--pill-fz":M(n,`pill-fz`),"--pill-height":M(n,`pill-height`),"--pill-radius":t===void 0?void 0:re(t)}})),yr=h(e=>{let t=u(`Pill`,_r,e),{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:l,variant:d,children:f,withRemoveButton:p,onRemove:m,removeButtonProps:h,radius:g,size:_,disabled:v,mod:y,attributes:b,...x}=t,S=(0,B.use)(mr),C=(0,B.use)(fr),w=_||S?.size||void 0,T=C?.variant===`filled`?`contrast`:d||`default`,E=a({name:`Pill`,classes:pr,props:t,className:r,style:i,classNames:n,styles:s,unstyled:c,attributes:b,vars:l,varsResolver:vr,stylesCtx:{size:w}});return(0,V.jsxs)(o,{component:`span`,variant:T,size:w,...E(`root`,{variant:T}),mod:[{"with-remove":p&&!v,disabled:v||S?.disabled},y],...x,children:[(0,V.jsx)(`span`,{...E(`label`),children:f}),p&&(0,V.jsx)(oe,{variant:`transparent`,radius:g,tabIndex:-1,"aria-hidden":!0,unstyled:c,...h,...E(`remove`,{className:h?.className,style:h?.style}),onMouseDown:e=>{e.preventDefault(),e.stopPropagation(),h?.onMouseDown?.(e)},onClick:e=>{e.stopPropagation(),m?.(),h?.onClick?.(e)}})]})});yr.classes=pr,yr.varsResolver=vr,yr.displayName=`@mantine/core/Pill`,yr.Group=gr;var br={field:`m_45c4369d`},xr={type:`visible`},Sr=h(e=>{let t=u(`PillsInputField`,xr,e),{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:l,type:d,disabled:f,id:p,pointer:m,mod:h,attributes:g,ref:_,...v}=t,y=(0,B.use)(fr),b=(0,B.use)(D),x=a({name:`PillsInputField`,classes:br,props:t,className:r,style:i,classNames:n,styles:s,unstyled:c,attributes:g,rootSelector:`field`}),S=f||y?.disabled;return(0,V.jsx)(o,{component:`input`,ref:ie(_,y?.fieldRef),"data-type":d,disabled:S,mod:[{disabled:S,pointer:m},h],...x(`field`),...v,id:b?.inputId||p,"aria-invalid":y?.hasError,"aria-describedby":b?.describedBy,type:`text`,onMouseDown:e=>!m&&e.stopPropagation()})});Sr.classes=br,Sr.displayName=`@mantine/core/PillsInputField`;var Cr={size:`sm`},wr=h(e=>{let{children:t,onMouseDown:n,onClick:r,size:i,disabled:a,__staticSelector:o,error:s,variant:c,...l}=u([`Input`,`InputWrapper`,`PillsInput`],Cr,e),d=(0,B.useRef)(null);return(0,V.jsx)(fr,{value:{fieldRef:d,size:i,disabled:a,hasError:!!s,variant:c},children:(0,V.jsx)(N,{size:i,error:s,variant:c,component:`div`,"data-no-overflow":!0,onMouseDown:e=>{e.preventDefault(),n?.(e),d.current?.focus()},onClick:e=>{e.preventDefault(),e.currentTarget.closest(`fieldset`)?.disabled||(d.current?.focus(),r?.(e))},...l,multiline:!0,disabled:a,__staticSelector:o||`PillsInput`,withAria:!1,children:t})})});wr.displayName=`@mantine/core/PillsInput`,wr.classes=N.classes,wr.Field=Sr;function Tr(e,t){let n=t.trim().toLowerCase();if(n===``)return;let r=Object.values(e).filter(e=>!e.disabled&&e.label.trim().toLowerCase()===n);return r.length===1?r[0]:void 0}function Er(e){return typeof e==`string`?e.trim().toLowerCase():e}function Dr({data:e,value:t}){let n=t.map(Er);return e.reduce((e,t)=>($n(t)?e.push({group:t.group,items:t.items.filter(e=>n.indexOf(Er(e.value))===-1)}):n.indexOf(Er(t.value))===-1&&e.push(t),e),[])}var Or={xs:41,sm:50,md:60,lg:72,xl:89},kr={maxValues:1/0,withCheckIcon:!0,checkIconPosition:`left`,hiddenInputValuesDivider:`,`,clearSearchOnChange:!0,openOnFocus:!0,size:`sm`},Ar=c(e=>{let t=u([`Input`,`InputWrapper`,`MultiSelect`],kr,e),{classNames:n,className:r,style:i,styles:o,unstyled:s,vars:c,size:l,value:f,defaultValue:p,onChange:m,onKeyDown:h,variant:g,data:_,dropdownOpened:v,defaultDropdownOpened:y,onDropdownOpen:b,onDropdownClose:x,selectFirstOptionOnChange:S,selectFirstOptionOnDropdownOpen:C,onOptionSubmit:w,comboboxProps:T,filter:E,limit:D,withScrollArea:O,maxDropdownHeight:k,floatingHeight:j,searchValue:M,defaultSearchValue:N,onSearchChange:P,readOnly:I,disabled:L,onFocus:ee,onBlur:te,radius:ne,rightSection:re,rightSectionWidth:ie,rightSectionPointerEvents:ae,rightSectionProps:R,leftSection:oe,leftSectionWidth:z,leftSectionPointerEvents:se,leftSectionProps:ce,inputContainer:le,inputWrapperOrder:ue,withAsterisk:de,labelProps:fe,descriptionProps:pe,errorProps:me,successProps:he,wrapperProps:ge,description:_e,label:ve,error:ye,success:be,maxValues:xe,searchable:Se,nothingFoundMessage:Ce,withCheckIcon:we,withAlignedLabels:Te,checkIconPosition:Ee,hidePickedOptions:De,withErrorStyles:Oe,withSuccessStyles:ke,name:Ae,form:je,id:Me,clearable:Ne,clearSectionMode:Pe,clearButtonProps:Fe,hiddenInputProps:Ie,placeholder:Le,hiddenInputValuesDivider:Re,required:ze,mod:Ve,renderOption:He,renderPill:Ue,onRemove:We,onClear:Ge,onMaxValues:Ke,scrollAreaProps:qe,chevronColor:Je,attributes:Ye,clearSearchOnChange:Xe,openOnFocus:Ze,loading:Qe,loadingPosition:$e,withPillsReorder:et,...tt}=t,nt=F(Me),rt=ur({id:nt,label:ve,labelProps:fe,inputWrapperOrder:ue}),it=gn(_),at=_n(it),ot=(0,B.useRef)({}),st=Gn({opened:v,defaultOpened:y,onDropdownOpen:()=>{b?.(),C&&st.selectFirstOption()},onDropdownClose:()=>{x?.(),st.resetSelectedOption()}}),{styleProps:ct,rest:{type:lt,autoComplete:ut,...dt}}=d(tt),[ft,pt]=Be({value:f,defaultValue:p,finalValue:[],onChange:m}),{getPillProps:mt,getListProps:ht,handleInputKeyDown:gt}=lr({value:ft,onChange:pt,enabled:et&&!L&&!I}),[_t,vt]=Be({value:M,defaultValue:N,finalValue:``,onChange:P}),yt=e=>{vt(e),st.resetSelectedOption()},bt=a({name:`MultiSelect`,classes:{},props:t,classNames:n,styles:o,unstyled:s,attributes:Ye}),{resolvedClassNames:xt,resolvedStyles:St}=A({props:t,styles:o,classNames:n}),Ct=e=>{h?.(e),!e.defaultPrevented&&(e.key===` `&&!Se&&(e.preventDefault(),st.toggleDropdown()),e.key===`Backspace`&&_t.length===0&&ft.length>0&&!I&&(We?.(ft[ft.length-1]),pt(ft.slice(0,ft.length-1))),gt(e))},wt=ft.map((e,t)=>{let n=at[`${e}`]||ot.current[`${e}`],r=mt(t);return Ue?(0,V.jsx)(B.Fragment,{children:Ue({option:n,value:e,onRemove:()=>{pt(ft.filter(t=>e!==t)),We?.(e)},disabled:L,reorderProps:r})},`${e}-${t}`):(0,V.jsx)(yr,{withRemoveButton:!I&&!at[`${e}`]?.disabled,onRemove:()=>{pt(ft.filter(t=>e!==t)),We?.(e)},unstyled:s,disabled:L,...bt(`pill`),...r,children:n?.label||e},`${e}-${t}`)});(0,B.useEffect)(()=>{S&&st.selectFirstOption()},[S,_t]),(0,B.useEffect)(()=>{ft.forEach(e=>{`${e}`in at&&(ot.current[`${e}`]=at[`${e}`])})},[at,ft]);let Tt=(0,V.jsx)(Jn.ClearButton,{...Fe,onClear:()=>{Ge?.(),pt([]),yt(``)}}),Et=Dr({data:it,value:ft}),Dt=Ne&&ft.length>0&&!L&&!I,Ot=Dt?{paddingInlineEnd:Or[l]??Or.sm}:void 0;return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(Jn,{store:st,classNames:xt,styles:St,unstyled:s,size:l,readOnly:I,__staticSelector:`MultiSelect`,attributes:Ye,floatingHeight:j,onOptionSubmit:e=>{w?.(e),Xe&&yt(``),st.updateSelectedOptionIndex(`selected`),ft.includes(at[`${e}`].value)?(pt(ft.filter(t=>t!==at[`${e}`].value)),We?.(at[`${e}`].value)):ft.lengthSe?st.openDropdown():st.toggleDropdown(),"data-expanded":st.dropdownOpened||void 0,id:nt,required:ze,mod:Ve,attributes:Ye,children:(0,V.jsxs)(yr.Group,{attributes:Ye,disabled:L,unstyled:s,...bt(`pillsList`,{style:Ot}),...ht(),children:[wt,(0,V.jsx)(Jn.EventsTarget,{autoComplete:ut,withExpandedAttribute:!0,children:(0,V.jsx)(wr.Field,{...dt,id:nt,placeholder:Le,type:!Se&&!Le?`hidden`:`visible`,...bt(`inputField`),unstyled:s,onFocus:e=>{ee?.(e),Ze&&Se&&st.openDropdown()},onBlur:e=>{te?.(e),st.closeDropdown(),yt(``)},onKeyDown:Ct,value:_t,onChange:e=>{if(dr(e)){if(!I){let t=Tr(at,e.currentTarget.value);t&&!ft.includes(t.value)&&ft.length{let{classNames:t,className:n,style:r,styles:i,vars:a,...s}=u(`ProgressLabel`,null,e),c=Mr();return(0,V.jsx)(o,{...c.getStyles(`label`,{className:n,style:r,classNames:t,styles:i}),...s})});Pr.classes=Nr,Pr.displayName=`@mantine/core/ProgressLabel`;var Fr=g((e,{size:t,radius:n,transitionDuration:r})=>({root:{"--progress-size":M(t,`progress-size`),"--progress-radius":n===void 0?void 0:re(n),"--progress-transition-duration":typeof r==`number`?`${r}ms`:void 0}})),Ir=h(e=>{let t=u(`ProgressRoot`,null,e),{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:l,autoContrast:d,transitionDuration:f,orientation:p,attributes:m,mod:h,...g}=t,_=a({name:`Progress`,classes:Nr,props:t,className:r,style:i,classNames:n,styles:s,unstyled:c,attributes:m,vars:l,varsResolver:Fr});return(0,V.jsx)(jr,{value:{getStyles:_,autoContrast:d},children:(0,V.jsx)(o,{mod:[{orientation:p},h],..._(`root`),...g})})});Ir.classes=Nr,Ir.varsResolver=Fr,Ir.displayName=`@mantine/core/ProgressRoot`;var Lr={withAria:!0},Rr=h(e=>{let{classNames:t,className:n,style:r,styles:i,vars:a,value:s,withAria:c,color:d,striped:p,animated:m,mod:h,...g}=u(`ProgressSection`,Lr,e),_=Mr(),v=f(),y=c?{role:`progressbar`,"aria-valuemax":100,"aria-valuemin":0,"aria-valuenow":s,"aria-valuetext":`${s}%`}:{};return(0,V.jsx)(o,{..._.getStyles(`section`,{className:n,classNames:t,styles:i,style:r}),...g,...y,mod:[{striped:p||m,animated:m},h],__vars:{"--progress-section-size":`${s}%`,"--progress-section-color":l(d,v),"--progress-label-color":Zt(_.autoContrast,v)?ct({color:d,theme:v,autoContrast:_.autoContrast}):void 0}})});Rr.classes=Nr,Rr.displayName=`@mantine/core/ProgressSection`;var zr=h(e=>{let t=u(`Progress`,null,e),{value:n,classNames:r,styles:i,vars:a,color:o,striped:s,animated:c,"aria-label":l,...d}=t,{resolvedClassNames:f,resolvedStyles:p}=A({classNames:r,styles:i,props:t});return(0,V.jsx)(Ir,{classNames:f,styles:p,vars:a,...d,children:(0,V.jsx)(Rr,{value:n,color:o,striped:s,animated:c,"aria-label":l})})});zr.classes=Nr,zr.displayName=`@mantine/core/Progress`,zr.Section=Rr,zr.Root=Ir,zr.Label=Pr;var Br={root:`m_cf365364`,indicator:`m_9e182ccd`,label:`m_1738fcb2`,input:`m_1714d588`,control:`m_69686b9b`,innerLabel:`m_78882f40`},Vr={withItemsBorders:!0},Hr=g((e,{radius:t,color:n,transitionDuration:r,size:i,transitionTimingFunction:a})=>({root:{"--sc-radius":t===void 0?void 0:re(t),"--sc-color":n?l(n,e):void 0,"--sc-shadow":n?void 0:`var(--mantine-shadow-xs)`,"--sc-transition-duration":r===void 0?void 0:`${r}ms`,"--sc-transition-timing-function":a,"--sc-padding":M(i,`sc-padding`),"--sc-font-size":L(i)}})),Ur=c(e=>{let t=u(`SegmentedControl`,Vr,e),{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:l,data:d,value:p,defaultValue:m,onChange:h,size:g,name:_,disabled:v,readOnly:y,fullWidth:b,orientation:x,radius:S,color:C,transitionDuration:w,transitionTimingFunction:T,variant:E,autoContrast:D,withItemsBorders:O,mod:k,attributes:A,ref:j,...M}=t,N=a({name:`SegmentedControl`,props:t,classes:Br,className:r,style:i,classNames:n,styles:s,unstyled:c,attributes:A,vars:l,varsResolver:Hr}),P=f(),I=d.map(e=>qt(e)?{label:`${e}`,value:e}:e),L=Kt(),[ee,te]=(0,B.useState)(0),[ne,re]=(0,B.useState)(null),[ae,R]=(0,B.useState)({}),oe=(e,t)=>{e!==null&&ae[t]!==e&&(ae[t]=e,R({...ae}))},[z,se]=Be({value:p,defaultValue:m,finalValue:Array.isArray(d)?I.find(e=>!e.disabled)?.value??d[0]?.value??null:null,onChange:h}),ce=F(_),le=I.map(e=>`${e.value}`),ue=I.map(e=>(0,B.createElement)(o,{...N(`control`),mod:{active:z===e.value,orientation:x},key:`${e.value}`},(0,B.createElement)(`input`,{...N(`input`),disabled:v||e.disabled,type:`radio`,name:ce,value:`${e.value}`,id:`${ce}-${e.value}`,checked:z===e.value,onChange:()=>!y&&se(e.value),"data-focus-ring":P.focusRing,key:`${e.value}-input`}),(0,B.createElement)(o,{component:`label`,...N(`label`),mod:{active:z===e.value&&!(v||e.disabled),disabled:v||e.disabled,"read-only":y},htmlFor:`${ce}-${e.value}`,ref:t=>oe(t,`${e.value}`),__vars:{"--sc-label-color":C===void 0?void 0:ct({color:C,theme:P,autoContrast:D})},key:`${e.value}-label`},(0,V.jsx)(`span`,{...N(`innerLabel`),children:e.label})))),de=ie(j,re);return Ht(()=>{te(e=>e+1)},[d.length]),Ht(()=>{R(e=>{let t={};return le.forEach(n=>{n in e&&(t[n]=e[n])}),Object.keys(t).length===Object.keys(e).length?e:t})},[le]),d.length===0?null:(0,V.jsxs)(o,{...N(`root`),variant:E,size:g,ref:de,mod:[{"full-width":b,orientation:x,initialized:L,"with-items-borders":O},k],...M,role:`radiogroup`,"data-disabled":v,children:[z!==void 0&&(0,V.jsx)(nn,{target:ae[`${z}`],parent:ne,component:`span`,transitionDuration:`var(--sc-transition-duration)`,...N(`indicator`)},ee),ue]})});Ur.classes=Br,Ur.varsResolver=Hr,Ur.displayName=`@mantine/core/SegmentedControl`;var Wr={size:`sm`,withCheckIcon:!0,allowDeselect:!0,checkIconPosition:`left`,openOnFocus:!0},Gr=c(e=>{let t=u([`Input`,`InputWrapper`,`Select`],Wr,e),{classNames:n,styles:r,unstyled:i,vars:a,dropdownOpened:o,defaultDropdownOpened:s,onDropdownClose:c,onDropdownOpen:l,onFocus:d,onBlur:f,onClick:p,onChange:m,data:h,value:g,defaultValue:_,selectFirstOptionOnChange:v,selectFirstOptionOnDropdownOpen:y,onOptionSubmit:b,comboboxProps:x,readOnly:S,disabled:C,filter:w,limit:T,withScrollArea:E,maxDropdownHeight:D,floatingHeight:O,size:k,searchable:j,rightSection:M,checkIconPosition:P,withCheckIcon:I,withAlignedLabels:L,nothingFoundMessage:ee,name:te,form:ne,searchValue:re,defaultSearchValue:ie,onSearchChange:ae,allowDeselect:R,error:oe,rightSectionPointerEvents:z,id:se,clearable:ce,clearSectionMode:le,clearButtonProps:ue,hiddenInputProps:de,renderOption:fe,onClear:pe,autoComplete:me,scrollAreaProps:he,__defaultRightSection:ge,__clearSection:_e,__clearable:ve,chevronColor:ye,autoSelectOnBlur:be,openOnFocus:xe,attributes:Se,...Ce}=t,we=(0,B.useMemo)(()=>gn(h),[h]),Te=(0,B.useRef)({}),Ee=(0,B.useMemo)(()=>_n(we),[we]),De=F(se),Oe=ur({id:De,label:Ce.label,labelProps:Ce.labelProps,inputWrapperOrder:Ce.inputWrapperOrder}),[ke,Ae,je]=Be({value:g,defaultValue:_,finalValue:null,onChange:m}),Me=ke==null?void 0:`${ke}`in Ee?Ee[`${ke}`]:Te.current[`${ke}`],Ne=Wt(Me),[Pe,Fe,Ie]=Be({value:re,defaultValue:ie,finalValue:Me?Me.label:``,onChange:ae}),Le=Gn({opened:o,defaultOpened:s,onDropdownOpen:()=>{l?.(),y?Le.selectFirstOption():Le.updateSelectedOptionIndex(`active`,{scrollIntoView:!0})},onDropdownClose:()=>{c?.(),setTimeout(Le.resetSelectedOption,0)}}),Re=e=>{Fe(e),Le.resetSelectedOption()},{resolvedClassNames:ze,resolvedStyles:Ve}=A({props:t,styles:r,classNames:n});(0,B.useEffect)(()=>{v&&Le.selectFirstOption()},[v,Pe]),(0,B.useEffect)(()=>{g===null&&Re(``),g!=null&&Me&&(Ne?.value!==Me.value||Ne?.label!==Me.label)&&Re(Me.label)},[g,Me]),(0,B.useEffect)(()=>{!je&&!Ie&&Re(ke==null?``:`${ke}`in Ee?Ee[`${ke}`]?.label:Te.current[`${ke}`]?.label||``)},[Ee,ke]),(0,B.useEffect)(()=>{ke&&`${ke}`in Ee&&(Te.current[`${ke}`]=Ee[`${ke}`])},[Ee,ke]);let He=(0,V.jsx)(Jn.ClearButton,{...ue,onClear:()=>{Ae(null,null),Re(``),pe?.()}}),Ue=ce&&ke!=null&&!C&&!S;return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(Jn,{store:Le,__staticSelector:`Select`,classNames:ze,styles:Ve,unstyled:i,readOnly:S,size:k,attributes:Se,floatingHeight:O,keepMounted:be,onOptionSubmit:e=>{b?.(e);let t=R&&`${Ee[e].value}`==`${ke}`?null:Ee[e],n=t?t.value:null;n!==ke&&Ae(n,t),!je&&Re(n==null?``:t?.label||``),Le.closeDropdown()},...x,children:[(0,V.jsx)(Jn.Target,{targetType:j?`input`:`button`,autoComplete:me,withExpandedAttribute:!0,children:(0,V.jsx)(N,{id:De,__defaultRightSection:(0,V.jsx)(Jn.Chevron,{size:k,error:oe,unstyled:i,color:ye}),__clearSection:He,__clearable:Ue,__clearSectionMode:le,rightSection:M,rightSectionPointerEvents:z||`none`,...Ce,size:k,__staticSelector:`Select`,disabled:C,readOnly:S||!j,value:Pe,onChange:e=>{if(dr(e)){if(!S){let t=Tr(Ee,e.currentTarget.value);t&&`${t.value}`!=`${ke}`&&(Ae(t.value,t),!je&&Re(t.label))}return}Re(e.currentTarget.value),Le.openDropdown(),v&&Le.selectFirstOption()},onFocus:e=>{xe&&j&&Le.openDropdown(),d?.(e)},onBlur:e=>{be&&Le.clickSelectedOption(),Le.closeDropdown();let t=ke!=null&&(`${ke}`in Ee?Ee[`${ke}`]:Te.current[`${ke}`]);Re(t&&t.label||``),f?.(e)},onClick:e=>{j?Le.openDropdown():Le.toggleDropdown(),p?.(e)},classNames:ze,styles:Ve,unstyled:i,pointer:!j,error:oe,attributes:Se})}),(0,V.jsx)(ar,{data:we,hidden:S||C,filter:w,search:Pe,limit:T,hiddenWhenEmpty:!ee,withScrollArea:E,maxDropdownHeight:D,filterOptions:!!j&&Me?.label!==Pe,value:ke,checkIconPosition:P,withCheckIcon:I,withAlignedLabels:L,nothingFoundMessage:ee,unstyled:i,labelId:Oe,"aria-label":Oe?void 0:Ce[`aria-label`],renderOption:fe,scrollAreaProps:he})]}),(0,V.jsx)(Jn.HiddenInput,{value:ke,name:te,form:ne,disabled:C,...de})]})});Gr.classes={...N.classes,...Jn.classes},Gr.displayName=`@mantine/core/Select`;function Kr(e){if(e!==void 0)return typeof e==`number`?P(e):e}function qr({spacing:e,verticalSpacing:t,cols:n,minColWidth:r,autoRows:i,selector:a}){let o=f(),s=t===void 0?e:t,c=r!==void 0,l=E({"--sg-spacing-x":R(Rt(e)),"--sg-spacing-y":R(Rt(s)),"--sg-auto-rows":i,...c?{"--sg-min-col-width":Kr(r)}:{"--sg-cols":Rt(n)?.toString()}}),u=O(o.breakpoints).reduce((t,r)=>(t[r]||(t[r]={}),typeof e==`object`&&e[r]!==void 0&&(t[r][`--sg-spacing-x`]=R(e[r])),typeof s==`object`&&s[r]!==void 0&&(t[r][`--sg-spacing-y`]=R(s[r])),!c&&typeof n==`object`&&n[r]!==void 0&&(t[r][`--sg-cols`]=n[r]),t),{}),d=Ke(O(u),o.breakpoints).filter(e=>O(u[e.value]).length>0).map(e=>({query:`(min-width: ${o.breakpoints[e.value]})`,styles:u[e.value]}));return(0,V.jsx)(j,{styles:l,media:d,selector:a})}function Jr(e){return typeof e==`object`&&e?O(e):[]}function Yr(e){return e.sort((e,t)=>Ge(e)-Ge(t))}function Xr({spacing:e,verticalSpacing:t,cols:n,minColWidth:r}){return Yr(Array.from(new Set([...Jr(e),...Jr(t),...r===void 0?Jr(n):[]])))}function Zr({spacing:e,verticalSpacing:t,cols:n,minColWidth:r,autoRows:i,selector:a}){let o=t===void 0?e:t,s=r!==void 0,c=E({"--sg-spacing-x":R(Rt(e)),"--sg-spacing-y":R(Rt(o)),"--sg-auto-rows":i,...s?{"--sg-min-col-width":Kr(r)}:{"--sg-cols":Rt(n)?.toString()}}),l=Xr({spacing:e,verticalSpacing:t,cols:n,minColWidth:r}),u=l.reduce((t,r)=>(t[r]||(t[r]={}),typeof e==`object`&&e[r]!==void 0&&(t[r][`--sg-spacing-x`]=R(e[r])),typeof o==`object`&&o[r]!==void 0&&(t[r][`--sg-spacing-y`]=R(o[r])),!s&&typeof n==`object`&&n[r]!==void 0&&(t[r][`--sg-cols`]=n[r]),t),{}),d=l.map(e=>({query:`simple-grid (min-width: ${e})`,styles:u[e]}));return(0,V.jsx)(j,{styles:c,container:d,selector:a})}var Qr={container:`m_925c2d2c`,root:`m_2415a157`},$r={cols:1,spacing:`md`,type:`media`},ei=h(e=>{let t=u(`SimpleGrid`,$r,e),{classNames:n,className:r,style:i,styles:c,unstyled:l,vars:d,cols:f,verticalSpacing:p,spacing:m,type:h,minColWidth:g,autoFlow:_,autoRows:v,attributes:y,...b}=t,x=a({name:`SimpleGrid`,classes:Qr,props:t,className:r,style:i,classNames:n,styles:c,unstyled:l,attributes:y,vars:d}),S=s(),C=g===void 0?void 0:_||`auto-fill`;return h===`container`?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Zr,{...t,selector:`.${S}`}),(0,V.jsx)(`div`,{...x(`container`),children:(0,V.jsx)(o,{...x(`root`,{className:S}),...b,"data-auto-cols":C})})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(qr,{...t,selector:`.${S}`}),(0,V.jsx)(o,{...x(`root`,{className:S}),...b,"data-auto-cols":C})]})});ei.classes=Qr,ei.displayName=`@mantine/core/SimpleGrid`;var ti=(0,B.createContext)(null),ni={hiddenInputValuesSeparator:`,`},ri=c((e=>{let{value:t,defaultValue:n,onChange:r,size:i,wrapperProps:a,children:o,readOnly:s,name:c,hiddenInputValuesSeparator:l,hiddenInputProps:d,maxSelectedValues:f,disabled:p,...m}=u(`SwitchGroup`,ni,e),[h,g]=Be({value:t,defaultValue:n,finalValue:[],onChange:r}),_=e=>{let t=e.currentTarget.value;if(s)return;let n=h.includes(t);!n&&f&&h.length>=f||g(n?h.filter(e=>e!==t):[...h,t])},v=e=>{if(p)return!0;if(!f)return!1;let t=h.includes(e),n=h.length>=f;return!t&&n},y=h.join(l);return(0,V.jsx)(ti,{value:{value:h,onChange:_,size:i,isDisabled:v},children:(0,V.jsxs)(k.Wrapper,{size:i,...a,...m,labelElement:`div`,__staticSelector:`SwitchGroup`,children:[(0,V.jsx)(Yn,{role:`group`,children:o}),(0,V.jsx)(`input`,{type:`hidden`,name:c,value:y,...d})]})})}));ri.classes=k.Wrapper.classes,ri.displayName=`@mantine/core/SwitchGroup`;var ii={root:`m_5f93f3bb`,input:`m_926b4011`,track:`m_9307d992`,thumb:`m_93039a1d`,trackLabel:`m_8277e082`},ai={labelPosition:`right`,withThumbIndicator:!0},oi=g((e,{radius:t,color:n,size:r})=>({root:{"--switch-radius":t===void 0?void 0:re(t),"--switch-height":M(r,`switch-height`),"--switch-width":M(r,`switch-width`),"--switch-thumb-size":M(r,`switch-thumb-size`),"--switch-label-font-size":M(r,`switch-label-font-size`),"--switch-track-label-padding":M(r,`switch-track-label-padding`),"--switch-color":n?l(n,e):void 0}})),si=h(e=>{let t=u(`Switch`,ai,e),{classNames:n,className:r,style:i,styles:s,unstyled:c,vars:l,color:f,label:p,offLabel:m,onLabel:h,id:g,size:_,radius:v,wrapperProps:y,thumbIcon:b,checked:x,defaultChecked:S,onChange:C,labelPosition:w,description:T,error:E,disabled:D,variant:O,rootRef:k,mod:A,withThumbIndicator:j,attributes:M,...N}=t,P=(0,B.use)(ti),I=_||P?.size,L=a({name:`Switch`,props:t,classes:ii,className:r,style:i,classNames:n,styles:s,unstyled:c,attributes:M,vars:l,varsResolver:oi}),{styleProps:ee,rest:te}=d(N),ne=F(g),re=[T?`${ne}-description`:void 0,E&&typeof E!=`boolean`?`${ne}-error`:void 0,te[`aria-describedby`]].filter(Boolean).join(` `)||void 0,ie={checked:P?.value.includes(te.value)??x,onChange:e=>{P?.onChange(e),C?.(e)}},ae=D||P?.isDisabled?.(te.value),[R,oe]=Be({value:ie.checked??x,defaultValue:S,finalValue:!1});return(0,V.jsxs)(Qn,{...L(`root`),__staticSelector:`Switch`,__stylesApiProps:t,id:ne,size:I,labelPosition:w,label:p,description:T,error:E,disabled:ae,bodyElement:`label`,labelElement:`span`,classNames:n,styles:s,unstyled:c,"data-checked":ie.checked,variant:O,ref:k,mod:A,attributes:M,inert:te.inert,...ee,...y,children:[(0,V.jsx)(`input`,{...te,...ie,disabled:ae,checked:R,"data-checked":ie.checked,onChange:e=>{ie.onChange?.(e),oe(e.currentTarget.checked)},id:ne,type:`checkbox`,role:`switch`,inert:te.inert,"aria-describedby":re,...L(`input`)}),(0,V.jsxs)(o,{"aria-hidden":`true`,component:`span`,mod:{error:E,"label-position":w,"without-labels":!h&&!m},...L(`track`),children:[(0,V.jsx)(o,{component:`span`,mod:{"reduce-motion":!0,"with-thumb-indicator":j&&!b},...L(`thumb`),children:b}),(0,V.jsx)(`span`,{...L(`trackLabel`),children:R?h:m})]})]})});si.classes={...ii,...Zn},si.varsResolver=oi,si.displayName=`@mantine/core/Switch`,si.Group=ri;var ci=new Map([[`bold`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M244,56v48a12,12,0,0,1-12,12H184a12,12,0,1,1,0-24H201.1l-19-17.38c-.13-.12-.26-.24-.38-.37A76,76,0,1,0,127,204h1a75.53,75.53,0,0,0,52.15-20.72,12,12,0,0,1,16.49,17.45A99.45,99.45,0,0,1,128,228h-1.37A100,100,0,1,1,198.51,57.06L220,76.72V56a12,12,0,0,1,24,0Z`}))],[`duotone`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z`,opacity:`0.2`}),B.createElement(`path`,{d:`M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1,0-16H211.4L184.81,71.64l-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,0,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60L224,85.8V56a8,8,0,1,1,16,0Z`}))],[`fill`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1-5.66-13.66l17-17-10.55-9.65-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,1,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60l10.93,10L226.34,50.3A8,8,0,0,1,240,56Z`}))],[`light`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M238,56v48a6,6,0,0,1-6,6H184a6,6,0,0,1,0-12h32.55l-30.38-27.8c-.06-.06-.12-.13-.19-.19a82,82,0,1,0-1.7,117.65,6,6,0,0,1,8.24,8.73A93.46,93.46,0,0,1,128,222h-1.28A94,94,0,1,1,194.37,61.4L226,90.35V56a6,6,0,1,1,12,0Z`}))],[`regular`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M240,56v48a8,8,0,0,1-8,8H184a8,8,0,0,1,0-16H211.4L184.81,71.64l-.25-.24a80,80,0,1,0-1.67,114.78,8,8,0,0,1,11,11.63A95.44,95.44,0,0,1,128,224h-1.32A96,96,0,1,1,195.75,60L224,85.8V56a8,8,0,1,1,16,0Z`}))],[`thin`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M236,56v48a4,4,0,0,1-4,4H184a4,4,0,0,1,0-8h37.7L187.53,68.69l-.13-.12a84,84,0,1,0-1.75,120.51,4,4,0,0,1,5.5,5.82A91.43,91.43,0,0,1,128,220h-1.26A92,92,0,1,1,193,62.84l35,32.05V56a4,4,0,1,1,8,0Z`}))]]),li=new Map([[`bold`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M228,128a100,100,0,0,1-98.66,100H128a99.39,99.39,0,0,1-68.62-27.29,12,12,0,0,1,16.48-17.45,76,76,0,1,0-1.57-109c-.13.13-.25.25-.39.37L54.89,92H72a12,12,0,0,1,0,24H24a12,12,0,0,1-12-12V56a12,12,0,0,1,24,0V76.72L57.48,57.06A100,100,0,0,1,228,128Z`}))],[`duotone`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z`,opacity:`0.2`}),B.createElement(`path`,{d:`M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L44.59,96H72a8,8,0,0,1,0,16H24a8,8,0,0,1-8-8V56a8,8,0,0,1,16,0V85.8L60.25,60A96,96,0,0,1,224,128Z`}))],[`fill`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L60.63,81.29l17,17A8,8,0,0,1,72,112H24a8,8,0,0,1-8-8V56A8,8,0,0,1,29.66,50.3L49.31,70,60.25,60A96,96,0,0,1,224,128Z`}))],[`light`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M222,128a94,94,0,0,1-92.74,94H128a93.43,93.43,0,0,1-64.5-25.65,6,6,0,1,1,8.24-8.72A82,82,0,1,0,70,70l-.19.19L39.44,98H72a6,6,0,0,1,0,12H24a6,6,0,0,1-6-6V56a6,6,0,0,1,12,0V90.34L61.63,61.4A94,94,0,0,1,222,128Z`}))],[`regular`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L44.59,96H72a8,8,0,0,1,0,16H24a8,8,0,0,1-8-8V56a8,8,0,0,1,16,0V85.8L60.25,60A96,96,0,0,1,224,128Z`}))],[`thin`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M220,128a92,92,0,0,1-90.77,92H128a91.47,91.47,0,0,1-63.13-25.1,4,4,0,1,1,5.5-5.82A84,84,0,1,0,68.6,68.57l-.13.12L34.3,100H72a4,4,0,0,1,0,8H24a4,4,0,0,1-4-4V56a4,4,0,0,1,8,0V94.89l35-32A92,92,0,0,1,220,128Z`}))]]),ui=new Map([[`bold`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M220,48V96a12,12,0,0,1-24,0V77l-35.51,35.52a12,12,0,0,1-17-17L179,60H160a12,12,0,0,1,0-24h48A12,12,0,0,1,220,48ZM95.51,143.51,60,179V160a12,12,0,0,0-24,0v48a12,12,0,0,0,12,12H96a12,12,0,0,0,0-24H77l35.52-35.51a12,12,0,0,0-17-17ZM208,148a12,12,0,0,0-12,12v19l-35.51-35.52a12,12,0,0,0-17,17L179,196H160a12,12,0,0,0,0,24h48a12,12,0,0,0,12-12V160A12,12,0,0,0,208,148ZM77,60H96a12,12,0,0,0,0-24H48A12,12,0,0,0,36,48V96a12,12,0,0,0,24,0V77l35.51,35.52a12,12,0,0,0,17-17Z`}))],[`duotone`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M208,48V208H48V48Z`,opacity:`0.2`}),B.createElement(`path`,{d:`M216,48V96a8,8,0,0,1-16,0V67.31l-42.34,42.35a8,8,0,0,1-11.32-11.32L188.69,56H160a8,8,0,0,1,0-16h48A8,8,0,0,1,216,48ZM98.34,146.34,56,188.69V160a8,8,0,0,0-16,0v48a8,8,0,0,0,8,8H96a8,8,0,0,0,0-16H67.31l42.35-42.34a8,8,0,0,0-11.32-11.32ZM208,152a8,8,0,0,0-8,8v28.69l-42.34-42.35a8,8,0,0,0-11.32,11.32L188.69,200H160a8,8,0,0,0,0,16h48a8,8,0,0,0,8-8V160A8,8,0,0,0,208,152ZM67.31,56H96a8,8,0,0,0,0-16H48a8,8,0,0,0-8,8V96a8,8,0,0,0,16,0V67.31l42.34,42.35a8,8,0,0,0,11.32-11.32Z`}))],[`fill`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M109.66,146.34a8,8,0,0,1,0,11.32L83.31,184l18.35,18.34A8,8,0,0,1,96,216H48a8,8,0,0,1-8-8V160a8,8,0,0,1,13.66-5.66L72,172.69l26.34-26.35A8,8,0,0,1,109.66,146.34ZM83.31,72l18.35-18.34A8,8,0,0,0,96,40H48a8,8,0,0,0-8,8V96a8,8,0,0,0,13.66,5.66L72,83.31l26.34,26.35a8,8,0,0,0,11.32-11.32ZM208,40H160a8,8,0,0,0-5.66,13.66L172.69,72,146.34,98.34a8,8,0,0,0,11.32,11.32L184,83.31l18.34,18.35A8,8,0,0,0,216,96V48A8,8,0,0,0,208,40Zm3.06,112.61a8,8,0,0,0-8.72,1.73L184,172.69l-26.34-26.35a8,8,0,0,0-11.32,11.32L172.69,184l-18.35,18.34A8,8,0,0,0,160,216h48a8,8,0,0,0,8-8V160A8,8,0,0,0,211.06,152.61Z`}))],[`light`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M214,48V96a6,6,0,0,1-12,0V62.48l-45.76,45.76a6,6,0,0,1-8.48-8.48L193.52,54H160a6,6,0,0,1,0-12h48A6,6,0,0,1,214,48ZM99.76,147.76,54,193.52V160a6,6,0,0,0-12,0v48a6,6,0,0,0,6,6H96a6,6,0,0,0,0-12H62.48l45.76-45.76a6,6,0,0,0-8.48-8.48ZM208,154a6,6,0,0,0-6,6v33.52l-45.76-45.76a6,6,0,0,0-8.48,8.48L193.52,202H160a6,6,0,0,0,0,12h48a6,6,0,0,0,6-6V160A6,6,0,0,0,208,154ZM62.48,54H96a6,6,0,0,0,0-12H48a6,6,0,0,0-6,6V96a6,6,0,0,0,12,0V62.48l45.76,45.76a6,6,0,0,0,8.48-8.48Z`}))],[`regular`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M216,48V96a8,8,0,0,1-16,0V67.31l-42.34,42.35a8,8,0,0,1-11.32-11.32L188.69,56H160a8,8,0,0,1,0-16h48A8,8,0,0,1,216,48ZM98.34,146.34,56,188.69V160a8,8,0,0,0-16,0v48a8,8,0,0,0,8,8H96a8,8,0,0,0,0-16H67.31l42.35-42.34a8,8,0,0,0-11.32-11.32ZM208,152a8,8,0,0,0-8,8v28.69l-42.34-42.35a8,8,0,0,0-11.32,11.32L188.69,200H160a8,8,0,0,0,0,16h48a8,8,0,0,0,8-8V160A8,8,0,0,0,208,152ZM67.31,56H96a8,8,0,0,0,0-16H48a8,8,0,0,0-8,8V96a8,8,0,0,0,16,0V67.31l42.34,42.35a8,8,0,0,0,11.32-11.32Z`}))],[`thin`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M212,48V96a4,4,0,0,1-8,0V57.66l-49.17,49.17a4,4,0,0,1-5.66-5.66L198.34,52H160a4,4,0,0,1,0-8h48A4,4,0,0,1,212,48ZM101.17,149.17,52,198.34V160a4,4,0,0,0-8,0v48a4,4,0,0,0,4,4H96a4,4,0,0,0,0-8H57.66l49.17-49.17a4,4,0,0,0-5.66-5.66ZM208,156a4,4,0,0,0-4,4v38.34l-49.17-49.17a4,4,0,0,0-5.66,5.66L198.34,204H160a4,4,0,0,0,0,8h48a4,4,0,0,0,4-4V160A4,4,0,0,0,208,156ZM57.66,52H96a4,4,0,0,0,0-8H48a4,4,0,0,0-4,4V96a4,4,0,0,0,8,0V57.66l49.17,49.17a4,4,0,0,0,5.66-5.66Z`}))]]),di=new Map([[`bold`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M216.49,168.49a12,12,0,0,1-17,0L128,97,56.49,168.49a12,12,0,0,1-17-17l80-80a12,12,0,0,1,17,0l80,80A12,12,0,0,1,216.49,168.49Z`}))],[`duotone`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M208,160H48l80-80Z`,opacity:`0.2`}),B.createElement(`path`,{d:`M213.66,154.34l-80-80a8,8,0,0,0-11.32,0l-80,80A8,8,0,0,0,48,168H208a8,8,0,0,0,5.66-13.66ZM67.31,152,128,91.31,188.69,152Z`}))],[`fill`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M215.39,163.06A8,8,0,0,1,208,168H48a8,8,0,0,1-5.66-13.66l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,215.39,163.06Z`}))],[`light`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M212.24,164.24a6,6,0,0,1-8.48,0L128,88.49,52.24,164.24a6,6,0,0,1-8.48-8.48l80-80a6,6,0,0,1,8.48,0l80,80A6,6,0,0,1,212.24,164.24Z`}))],[`regular`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M213.66,165.66a8,8,0,0,1-11.32,0L128,91.31,53.66,165.66a8,8,0,0,1-11.32-11.32l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,213.66,165.66Z`}))],[`thin`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M210.83,162.83a4,4,0,0,1-5.66,0L128,85.66,50.83,162.83a4,4,0,0,1-5.66-5.66l80-80a4,4,0,0,1,5.66,0l80,80A4,4,0,0,1,210.83,162.83Z`}))]]),fi=new Map([[`bold`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M172,108a12,12,0,0,1-12,12H96a12,12,0,0,1,0-24h64A12,12,0,0,1,172,108Zm-12,28H96a12,12,0,0,0,0,24h64a12,12,0,0,0,0-24Zm76-8A108,108,0,0,1,78.77,224.15L46.34,235A20,20,0,0,1,21,209.66l10.81-32.43A108,108,0,1,1,236,128Zm-24,0A84,84,0,1,0,55.27,170.06a12,12,0,0,1,1,9.81l-9.93,29.79,29.79-9.93a12.1,12.1,0,0,1,3.8-.62,12,12,0,0,1,6,1.62A84,84,0,0,0,212,128Z`}))],[`duotone`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M224,128A96,96,0,0,1,79.93,211.11h0L42.54,223.58a8,8,0,0,1-10.12-10.12l12.47-37.39h0A96,96,0,1,1,224,128Z`,opacity:`0.2`}),B.createElement(`path`,{d:`M128,24A104,104,0,0,0,36.18,176.88L24.83,210.93a16,16,0,0,0,20.24,20.24l34.05-11.35A104,104,0,1,0,128,24Zm0,192a87.87,87.87,0,0,1-44.06-11.81,8,8,0,0,0-4-1.08,7.85,7.85,0,0,0-2.53.42L40,216,52.47,178.6a8,8,0,0,0-.66-6.54A88,88,0,1,1,128,216Zm40-104a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,112Zm0,32a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,144Z`}))],[`fill`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M128,24A104,104,0,0,0,36.18,176.88L24.83,210.93a16,16,0,0,0,20.24,20.24l34.05-11.35A104,104,0,1,0,128,24Zm32,128H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Zm0-32H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Z`}))],[`light`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M166,112a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,112Zm-6,26H96a6,6,0,0,0,0,12h64a6,6,0,0,0,0-12Zm70-10A102,102,0,0,1,79.31,217.65L44.44,229.27a14,14,0,0,1-17.71-17.71l11.62-34.87A102,102,0,1,1,230,128Zm-12,0A90,90,0,1,0,50.08,173.06a6,6,0,0,1,.5,4.91L38.12,215.35a2,2,0,0,0,2.53,2.53L78,205.42a6.2,6.2,0,0,1,1.9-.31,6.09,6.09,0,0,1,3,.81A90,90,0,0,0,218,128Z`}))],[`regular`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M168,112a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,112Zm-8,24H96a8,8,0,0,0,0,16h64a8,8,0,0,0,0-16Zm72-8A104,104,0,0,1,79.12,219.82L45.07,231.17a16,16,0,0,1-20.24-20.24l11.35-34.05A104,104,0,1,1,232,128Zm-16,0A88,88,0,1,0,51.81,172.06a8,8,0,0,1,.66,6.54L40,216,77.4,203.53a7.85,7.85,0,0,1,2.53-.42,8,8,0,0,1,4,1.08A88,88,0,0,0,216,128Z`}))],[`thin`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M164,112a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,112Zm-4,28H96a4,4,0,0,0,0,8h64a4,4,0,0,0,0-8Zm68-12A100,100,0,0,1,79.5,215.47l-35.69,11.9a12,12,0,0,1-15.18-15.18l11.9-35.69A100,100,0,1,1,228,128Zm-8,0A92,92,0,1,0,48.35,174.07a4,4,0,0,1,.33,3.27L36.22,214.72a4,4,0,0,0,5.06,5.06l37.38-12.46a3.93,3.93,0,0,1,1.27-.21,4.05,4.05,0,0,1,2,.54A92,92,0,0,0,220,128Z`}))]]),pi=new Map([[`bold`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm0,192a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,212Zm68-84a12,12,0,0,1-12,12H128a12,12,0,0,1-12-12V72a12,12,0,0,1,24,0v44h44A12,12,0,0,1,196,128Z`}))],[`duotone`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),B.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm64-88a8,8,0,0,1-8,8H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48h48A8,8,0,0,1,192,128Z`}))],[`fill`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm56,112H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48h48a8,8,0,0,1,0,16Z`}))],[`light`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm0,192a90,90,0,1,1,90-90A90.1,90.1,0,0,1,128,218Zm62-90a6,6,0,0,1-6,6H128a6,6,0,0,1-6-6V72a6,6,0,0,1,12,0v50h50A6,6,0,0,1,190,128Z`}))],[`regular`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm64-88a8,8,0,0,1-8,8H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48h48A8,8,0,0,1,192,128Z`}))],[`thin`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28Zm0,192a92,92,0,1,1,92-92A92.1,92.1,0,0,1,128,220Zm60-92a4,4,0,0,1-4,4H128a4,4,0,0,1-4-4V72a4,4,0,0,1,8,0v52h52A4,4,0,0,1,188,128Z`}))]]),mi=new Map([[`bold`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M140,80v41.21l34.17,20.5a12,12,0,1,1-12.34,20.58l-40-24A12,12,0,0,1,116,128V80a12,12,0,0,1,24,0ZM128,28A99.38,99.38,0,0,0,57.24,57.34c-4.69,4.74-9,9.37-13.24,14V64a12,12,0,0,0-24,0v40a12,12,0,0,0,12,12H72a12,12,0,0,0,0-24H57.77C63,86,68.37,80.22,74.26,74.26a76,76,0,1,1,1.58,109,12,12,0,0,0-16.48,17.46A100,100,0,1,0,128,28Z`}))],[`duotone`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z`,opacity:`0.2`}),B.createElement(`path`,{d:`M136,80v43.47l36.12,21.67a8,8,0,0,1-8.24,13.72l-40-24A8,8,0,0,1,120,128V80a8,8,0,0,1,16,0Zm-8-48A95.44,95.44,0,0,0,60.08,60.15C52.81,67.51,46.35,74.59,40,82V64a8,8,0,0,0-16,0v40a8,8,0,0,0,8,8H72a8,8,0,0,0,0-16H49c7.15-8.42,14.27-16.35,22.39-24.57a80,80,0,1,1,1.66,114.75,8,8,0,1,0-11,11.64A96,96,0,1,0,128,32Z`}))],[`fill`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M224,128A96,96,0,0,1,62.11,197.82a8,8,0,1,1,11-11.64A80,80,0,1,0,71.43,71.43C67.9,75,64.58,78.51,61.35,82L77.66,98.34A8,8,0,0,1,72,112H32a8,8,0,0,1-8-8V64a8,8,0,0,1,13.66-5.66L50,70.7c3.22-3.49,6.54-7,10.06-10.55A96,96,0,0,1,224,128ZM128,72a8,8,0,0,0-8,8v48a8,8,0,0,0,3.88,6.86l40,24a8,8,0,1,0,8.24-13.72L136,123.47V80A8,8,0,0,0,128,72Z`}))],[`light`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M134,80v44.6l37.09,22.25a6,6,0,0,1-6.18,10.3l-40-24A6,6,0,0,1,122,128V80a6,6,0,0,1,12,0Zm-6-46A93.4,93.4,0,0,0,61.51,61.56c-8.58,8.68-16,17-23.51,25.8V64a6,6,0,0,0-12,0v40a6,6,0,0,0,6,6H72a6,6,0,0,0,0-12H44.73C52.86,88.29,60.79,79.35,70,70a82,82,0,1,1,1.7,117.62,6,6,0,1,0-8.24,8.72A94,94,0,1,0,128,34Z`}))],[`regular`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M136,80v43.47l36.12,21.67a8,8,0,0,1-8.24,13.72l-40-24A8,8,0,0,1,120,128V80a8,8,0,0,1,16,0Zm-8-48A95.44,95.44,0,0,0,60.08,60.15C52.81,67.51,46.35,74.59,40,82V64a8,8,0,0,0-16,0v40a8,8,0,0,0,8,8H72a8,8,0,0,0,0-16H49c7.15-8.42,14.27-16.35,22.39-24.57a80,80,0,1,1,1.66,114.75,8,8,0,1,0-11,11.64A96,96,0,1,0,128,32Z`}))],[`thin`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M132,80v45.74l38.06,22.83a4,4,0,0,1-4.12,6.86l-40-24A4,4,0,0,1,124,128V80a4,4,0,0,1,8,0Zm-4-44A91.42,91.42,0,0,0,62.93,63C53.05,73,44.66,82.47,36,92.86V64a4,4,0,0,0-8,0v40a4,4,0,0,0,4,4H72a4,4,0,0,0,0-8H40.47C49.61,89,58.3,79,68.6,68.6a84,84,0,1,1,1.75,120.49,4,4,0,1,0-5.5,5.82A92,92,0,1,0,128,36Z`}))]]),hi=new Map([[`bold`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M108,84a16,16,0,1,1,16,16A16,16,0,0,1,108,84Zm128,44A108,108,0,1,1,128,20,108.12,108.12,0,0,1,236,128Zm-24,0a84,84,0,1,0-84,84A84.09,84.09,0,0,0,212,128Zm-72,36.68V132a20,20,0,0,0-20-20,12,12,0,0,0-4,23.32V168a20,20,0,0,0,20,20,12,12,0,0,0,4-23.32Z`}))],[`duotone`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),B.createElement(`path`,{d:`M144,176a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176Zm88-48A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128ZM124,96a12,12,0,1,0-12-12A12,12,0,0,0,124,96Z`}))],[`fill`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm-4,48a12,12,0,1,1-12,12A12,12,0,0,1,124,72Zm12,112a16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40a8,8,0,0,1,0,16Z`}))],[`light`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M142,176a6,6,0,0,1-6,6,14,14,0,0,1-14-14V128a2,2,0,0,0-2-2,6,6,0,0,1,0-12,14,14,0,0,1,14,14v40a2,2,0,0,0,2,2A6,6,0,0,1,142,176ZM124,94a10,10,0,1,0-10-10A10,10,0,0,0,124,94Zm106,34A102,102,0,1,1,128,26,102.12,102.12,0,0,1,230,128Zm-12,0a90,90,0,1,0-90,90A90.1,90.1,0,0,0,218,128Z`}))],[`regular`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z`}))],[`thin`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M140,176a4,4,0,0,1-4,4,12,12,0,0,1-12-12V128a4,4,0,0,0-4-4,4,4,0,0,1,0-8,12,12,0,0,1,12,12v40a4,4,0,0,0,4,4A4,4,0,0,1,140,176ZM124,92a8,8,0,1,0-8-8A8,8,0,0,0,124,92Zm104,36A100,100,0,1,1,128,28,100.11,100.11,0,0,1,228,128Zm-8,0a92,92,0,1,0-92,92A92.1,92.1,0,0,0,220,128Z`}))]]),gi=new Map([[`bold`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M224,44H32A20,20,0,0,0,12,64V192a20,20,0,0,0,20,20H224a20,20,0,0,0,20-20V64A20,20,0,0,0,224,44Zm-4,144H36V68H220ZM52,128a12,12,0,0,1,12-12H192a12,12,0,0,1,0,24H64A12,12,0,0,1,52,128Zm0-36A12,12,0,0,1,64,80H192a12,12,0,0,1,0,24H64A12,12,0,0,1,52,92Zm0,72a12,12,0,0,1,12-12h8a12,12,0,0,1,0,24H64A12,12,0,0,1,52,164Zm108,0a12,12,0,0,1-12,12H108a12,12,0,0,1,0-24h40A12,12,0,0,1,160,164Zm44,0a12,12,0,0,1-12,12h-8a12,12,0,0,1,0-24h8A12,12,0,0,1,204,164Z`}))],[`duotone`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M232,64V192a8,8,0,0,1-8,8H32a8,8,0,0,1-8-8V64a8,8,0,0,1,8-8H224A8,8,0,0,1,232,64Z`,opacity:`0.2`}),B.createElement(`path`,{d:`M224,48H32A16,16,0,0,0,16,64V192a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V64A16,16,0,0,0,224,48Zm0,144H32V64H224V192Zm-16-64a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16H200A8,8,0,0,1,208,128Zm0-32a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16H200A8,8,0,0,1,208,96ZM72,160a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16h8A8,8,0,0,1,72,160Zm96,0a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,160Zm40,0a8,8,0,0,1-8,8h-8a8,8,0,0,1,0-16h8A8,8,0,0,1,208,160Z`}))],[`fill`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M224,48H32A16,16,0,0,0,16,64V192a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V64A16,16,0,0,0,224,48ZM64,168H48a8,8,0,0,1,0-16H64a8,8,0,0,1,0,16Zm96,0H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Zm48,0H192a8,8,0,0,1,0-16h16a8,8,0,0,1,0,16Zm0-32H48a8,8,0,0,1,0-16H208a8,8,0,0,1,0,16Zm0-32H48a8,8,0,0,1,0-16H208a8,8,0,0,1,0,16Z`}))],[`light`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M224,50H32A14,14,0,0,0,18,64V192a14,14,0,0,0,14,14H224a14,14,0,0,0,14-14V64A14,14,0,0,0,224,50Zm2,142a2,2,0,0,1-2,2H32a2,2,0,0,1-2-2V64a2,2,0,0,1,2-2H224a2,2,0,0,1,2,2Zm-20-64a6,6,0,0,1-6,6H56a6,6,0,0,1,0-12H200A6,6,0,0,1,206,128Zm0-32a6,6,0,0,1-6,6H56a6,6,0,0,1,0-12H200A6,6,0,0,1,206,96ZM70,160a6,6,0,0,1-6,6H56a6,6,0,0,1,0-12h8A6,6,0,0,1,70,160Zm96,0a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,160Zm40,0a6,6,0,0,1-6,6h-8a6,6,0,0,1,0-12h8A6,6,0,0,1,206,160Z`}))],[`regular`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M224,48H32A16,16,0,0,0,16,64V192a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V64A16,16,0,0,0,224,48Zm0,144H32V64H224V192Zm-16-64a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16H200A8,8,0,0,1,208,128Zm0-32a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16H200A8,8,0,0,1,208,96ZM72,160a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16h8A8,8,0,0,1,72,160Zm96,0a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,160Zm40,0a8,8,0,0,1-8,8h-8a8,8,0,0,1,0-16h8A8,8,0,0,1,208,160Z`}))],[`thin`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M224,52H32A12,12,0,0,0,20,64V192a12,12,0,0,0,12,12H224a12,12,0,0,0,12-12V64A12,12,0,0,0,224,52Zm4,140a4,4,0,0,1-4,4H32a4,4,0,0,1-4-4V64a4,4,0,0,1,4-4H224a4,4,0,0,1,4,4Zm-24-64a4,4,0,0,1-4,4H56a4,4,0,0,1,0-8H200A4,4,0,0,1,204,128Zm0-32a4,4,0,0,1-4,4H56a4,4,0,0,1,0-8H200A4,4,0,0,1,204,96ZM68,160a4,4,0,0,1-4,4H56a4,4,0,0,1,0-8h8A4,4,0,0,1,68,160Zm96,0a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,160Zm40,0a4,4,0,0,1-4,4h-8a4,4,0,0,1,0-8h8A4,4,0,0,1,204,160Z`}))]]),_i=new Map([[`bold`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M76,64A12,12,0,0,1,88,52H216a12,12,0,0,1,0,24H88A12,12,0,0,1,76,64Zm140,52H88a12,12,0,0,0,0,24H216a12,12,0,0,0,0-24Zm0,64H88a12,12,0,0,0,0,24H216a12,12,0,0,0,0-24ZM44,112a16,16,0,1,0,16,16A16,16,0,0,0,44,112Zm0-64A16,16,0,1,0,60,64,16,16,0,0,0,44,48Zm0,128a16,16,0,1,0,16,16A16,16,0,0,0,44,176Z`}))],[`duotone`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M216,64V192H88V64Z`,opacity:`0.2`}),B.createElement(`path`,{d:`M80,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H88A8,8,0,0,1,80,64Zm136,56H88a8,8,0,1,0,0,16H216a8,8,0,0,0,0-16Zm0,64H88a8,8,0,1,0,0,16H216a8,8,0,0,0,0-16ZM44,52A12,12,0,1,0,56,64,12,12,0,0,0,44,52Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,116Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,180Z`}))],[`fill`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM68,188a12,12,0,1,1,12-12A12,12,0,0,1,68,188Zm0-48a12,12,0,1,1,12-12A12,12,0,0,1,68,140Zm0-48A12,12,0,1,1,80,80,12,12,0,0,1,68,92Zm124,92H104a8,8,0,0,1,0-16h88a8,8,0,0,1,0,16Zm0-48H104a8,8,0,0,1,0-16h88a8,8,0,0,1,0,16Zm0-48H104a8,8,0,0,1,0-16h88a8,8,0,0,1,0,16Z`}))],[`light`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M82,64a6,6,0,0,1,6-6H216a6,6,0,0,1,0,12H88A6,6,0,0,1,82,64Zm134,58H88a6,6,0,0,0,0,12H216a6,6,0,0,0,0-12Zm0,64H88a6,6,0,0,0,0,12H216a6,6,0,0,0,0-12ZM44,54A10,10,0,1,0,54,64,10,10,0,0,0,44,54Zm0,128a10,10,0,1,0,10,10A10,10,0,0,0,44,182Zm0-64a10,10,0,1,0,10,10A10,10,0,0,0,44,118Z`}))],[`regular`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M80,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H88A8,8,0,0,1,80,64Zm136,56H88a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16Zm0,64H88a8,8,0,0,0,0,16H216a8,8,0,0,0,0-16ZM44,52A12,12,0,1,0,56,64,12,12,0,0,0,44,52Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,116Zm0,64a12,12,0,1,0,12,12A12,12,0,0,0,44,180Z`}))],[`thin`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M84,64a4,4,0,0,1,4-4H216a4,4,0,0,1,0,8H88A4,4,0,0,1,84,64Zm132,60H88a4,4,0,0,0,0,8H216a4,4,0,0,0,0-8Zm0,64H88a4,4,0,0,0,0,8H216a4,4,0,0,0,0-8ZM44,120a8,8,0,1,0,8,8A8,8,0,0,0,44,120Zm0-64a8,8,0,1,0,8,8A8,8,0,0,0,44,56Zm0,128a8,8,0,1,0,8,8A8,8,0,0,0,44,184Z`}))]]),vi=new Map([[`bold`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M28,64A12,12,0,0,1,40,52H216a12,12,0,0,1,0,24H40A12,12,0,0,1,28,64Zm12,76h64a12,12,0,0,0,0-24H40a12,12,0,0,0,0,24Zm80,40H40a12,12,0,0,0,0,24h80a12,12,0,0,0,0-24Zm120.49,20.49a12,12,0,0,1-17,0l-18.08-18.08a44,44,0,1,1,17-17l18.08,18.07A12,12,0,0,1,240.49,200.49ZM184,164a20,20,0,1,0-20-20A20,20,0,0,0,184,164Z`}))],[`duotone`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M216,144a32,32,0,1,1-32-32A32,32,0,0,1,216,144Z`,opacity:`0.2`}),B.createElement(`path`,{d:`M32,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H40A8,8,0,0,1,32,64Zm8,72h72a8,8,0,0,0,0-16H40a8,8,0,0,0,0,16Zm88,48H40a8,8,0,0,0,0,16h88a8,8,0,0,0,0-16Zm109.66,13.66a8,8,0,0,1-11.32,0L206,177.36A40,40,0,1,1,217.36,166l20.3,20.3A8,8,0,0,1,237.66,197.66ZM184,168a24,24,0,1,0-24-24A24,24,0,0,0,184,168Z`}))],[`fill`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M32,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H40A8,8,0,0,1,32,64Zm8,72h72a8,8,0,0,0,0-16H40a8,8,0,0,0,0,16Zm88,48H40a8,8,0,0,0,0,16h88a8,8,0,0,0,0-16Zm109.66,2.34L217.36,166A40,40,0,1,0,206,177.36l20.3,20.3a8,8,0,0,0,11.32-11.32Z`}))],[`light`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M34,64a6,6,0,0,1,6-6H216a6,6,0,0,1,0,12H40A6,6,0,0,1,34,64Zm6,70h72a6,6,0,0,0,0-12H40a6,6,0,0,0,0,12Zm88,52H40a6,6,0,0,0,0,12h88a6,6,0,0,0,0-12Zm108.24,10.24a6,6,0,0,1-8.48,0l-21.49-21.48a38.06,38.06,0,1,1,8.49-8.49l21.48,21.49A6,6,0,0,1,236.24,196.24ZM184,170a26,26,0,1,0-26-26A26,26,0,0,0,184,170Z`}))],[`regular`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M32,64a8,8,0,0,1,8-8H216a8,8,0,0,1,0,16H40A8,8,0,0,1,32,64Zm8,72h72a8,8,0,0,0,0-16H40a8,8,0,0,0,0,16Zm88,48H40a8,8,0,0,0,0,16h88a8,8,0,0,0,0-16Zm109.66,13.66a8,8,0,0,1-11.32,0L206,177.36A40,40,0,1,1,217.36,166l20.3,20.3A8,8,0,0,1,237.66,197.66ZM184,168a24,24,0,1,0-24-24A24,24,0,0,0,184,168Z`}))],[`thin`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M36,64a4,4,0,0,1,4-4H216a4,4,0,0,1,0,8H40A4,4,0,0,1,36,64Zm4,68h72a4,4,0,0,0,0-8H40a4,4,0,0,0,0,8Zm88,56H40a4,4,0,0,0,0,8h88a4,4,0,0,0,0-8Zm106.83,6.83a4,4,0,0,1-5.66,0l-22.72-22.72a36.06,36.06,0,1,1,5.66-5.66l22.72,22.72A4,4,0,0,1,234.83,194.83ZM184,172a28,28,0,1,0-28-28A28,28,0,0,0,184,172Z`}))]]),yi=new Map([[`bold`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M156,112a12,12,0,0,1-12,12H80a12,12,0,0,1,0-24h64A12,12,0,0,1,156,112Zm76.49,120.49a12,12,0,0,1-17,0L168,185a92.12,92.12,0,1,1,17-17l47.54,47.53A12,12,0,0,1,232.49,232.49ZM112,180a68,68,0,1,0-68-68A68.08,68.08,0,0,0,112,180Z`}))],[`duotone`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M192,112a80,80,0,1,1-80-80A80,80,0,0,1,192,112Z`,opacity:`0.2`}),B.createElement(`path`,{d:`M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Zm112,0a8,8,0,0,1-8,8H80a8,8,0,0,1,0-16h64A8,8,0,0,1,152,112Z`}))],[`fill`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM144,120H80a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Z`}))],[`light`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M150,112a6,6,0,0,1-6,6H80a6,6,0,0,1,0-12h64A6,6,0,0,1,150,112Zm78.24,116.24a6,6,0,0,1-8.48,0l-51.38-51.38a86.15,86.15,0,1,1,8.48-8.48l51.38,51.38A6,6,0,0,1,228.24,228.24ZM112,186a74,74,0,1,0-74-74A74.09,74.09,0,0,0,112,186Z`}))],[`regular`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M152,112a8,8,0,0,1-8,8H80a8,8,0,0,1,0-16h64A8,8,0,0,1,152,112Zm77.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88.11,88.11,0,1,1,11.31-11.31l50.07,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z`}))],[`thin`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M148,112a4,4,0,0,1-4,4H80a4,4,0,0,1,0-8h64A4,4,0,0,1,148,112Zm78.83,114.83a4,4,0,0,1-5.66,0l-52.7-52.7a84.1,84.1,0,1,1,5.66-5.66l52.7,52.7A4,4,0,0,1,226.83,226.83ZM112,188a76,76,0,1,0-76-76A76.08,76.08,0,0,0,112,188Z`}))]]),bi=new Map([[`bold`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M230.47,67.5a12,12,0,0,0-19.26-4.32L172.43,99l-12.68-2.72L157,83.57l35.79-38.78a12,12,0,0,0-4.32-19.26A76.07,76.07,0,0,0,88.41,121.64L30.92,174.18a4.68,4.68,0,0,0-.39.38,36,36,0,0,0,50.91,50.91l.38-.39,52.54-57.49A76.05,76.05,0,0,0,230.47,67.5ZM160,148a51.5,51.5,0,0,1-23.35-5.52,12,12,0,0,0-14.26,2.62L64.31,208.66a12,12,0,0,1-17-17l63.55-58.07a12,12,0,0,0,2.62-14.26A51.5,51.5,0,0,1,108,96a52.06,52.06,0,0,1,52-52h.89L135.17,71.87a12,12,0,0,0-2.91,10.65l5.66,26.35a12,12,0,0,0,9.21,9.21l26.35,5.66a12,12,0,0,0,10.65-2.91L212,95.12c0,.3,0,.59,0,.89A52.06,52.06,0,0,1,160,148Z`}))],[`duotone`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M224,96a64,64,0,0,1-94.94,56L73,217A24,24,0,0,1,39,183L104,126.94a64,64,0,0,1,80-90.29L144,80l5.66,26.34L176,112l43.35-40A63.8,63.8,0,0,1,224,96Z`,opacity:`0.2`}),B.createElement(`path`,{d:`M226.76,69a8,8,0,0,0-12.84-2.88l-40.3,37.19-17.23-3.7-3.7-17.23,37.19-40.3A8,8,0,0,0,187,29.24,72,72,0,0,0,88,96,72.34,72.34,0,0,0,94,124.94L33.79,177c-.15.12-.29.26-.43.39a32,32,0,0,0,45.26,45.26c.13-.13.27-.28.39-.42L131.06,162A72,72,0,0,0,232,96,71.56,71.56,0,0,0,226.76,69ZM160,152a56.14,56.14,0,0,1-27.07-7,8,8,0,0,0-9.92,1.77L67.11,211.51a16,16,0,0,1-22.62-22.62L109.18,133a8,8,0,0,0,1.77-9.93,56,56,0,0,1,58.36-82.31l-31.2,33.81a8,8,0,0,0-1.94,7.1L141.83,108a8,8,0,0,0,6.14,6.14l26.35,5.66a8,8,0,0,0,7.1-1.94l33.81-31.2A56.06,56.06,0,0,1,160,152Z`}))],[`fill`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M232,96a72,72,0,0,1-100.94,66L79,222.22c-.12.14-.26.29-.39.42a32,32,0,0,1-45.26-45.26c.14-.13.28-.27.43-.39L94,124.94a72.07,72.07,0,0,1,83.54-98.78,8,8,0,0,1,3.93,13.19L144,80l5.66,26.35L176,112l40.65-37.52a8,8,0,0,1,13.19,3.93A72.6,72.6,0,0,1,232,96Z`}))],[`light`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M224.91,69.75a6,6,0,0,0-9.63-2.16l-41.07,37.9L154.7,101.3l-4.19-19.51,37.9-41.07a6,6,0,0,0-2.16-9.63,70,70,0,0,0-89.77,94.39l-61.39,53c-.11.09-.21.19-.32.3A30,30,0,0,0,77.2,221.23c.11-.11.21-.21.3-.32l53-61.39a70,70,0,0,0,94.39-89.77ZM160,154a58,58,0,0,1-28-7.22,6,6,0,0,0-7.45,1.33L68.57,212.88a18,18,0,0,1-25.45-25.45l64.76-55.94A6,6,0,0,0,109.2,124a58,58,0,0,1,64-84.53L139.58,75.93a6,6,0,0,0-1.45,5.33l5.65,26.35a6,6,0,0,0,4.61,4.61l26.35,5.65a6,6,0,0,0,5.33-1.45L216.49,82.8A58.06,58.06,0,0,1,160,154Z`}))],[`regular`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M226.76,69a8,8,0,0,0-12.84-2.88l-40.3,37.19-17.23-3.7-3.7-17.23,37.19-40.3A8,8,0,0,0,187,29.24,72,72,0,0,0,88,96,72.34,72.34,0,0,0,94,124.94L33.79,177c-.15.12-.29.26-.43.39a32,32,0,0,0,45.26,45.26c.13-.13.27-.28.39-.42L131.06,162A72,72,0,0,0,232,96,71.56,71.56,0,0,0,226.76,69ZM160,152a56.14,56.14,0,0,1-27.07-7,8,8,0,0,0-9.92,1.77L67.11,211.51a16,16,0,0,1-22.62-22.62L109.18,133a8,8,0,0,0,1.77-9.93,56,56,0,0,1,58.36-82.31l-31.2,33.81a8,8,0,0,0-1.94,7.1L141.83,108a8,8,0,0,0,6.14,6.14l26.35,5.66a8,8,0,0,0,7.1-1.94l33.81-31.2A56.06,56.06,0,0,1,160,152Z`}))],[`thin`,B.createElement(B.Fragment,null,B.createElement(`path`,{d:`M223.05,70.5a4,4,0,0,0-6.42-1.44l-41.82,38.6L153,103l-4.68-21.79,38.6-41.82a4,4,0,0,0-1.44-6.43A68,68,0,0,0,98.94,126L36.4,180l-.21.2a28,28,0,0,0,39.6,39.6l.2-.21,54-62.54A68,68,0,0,0,228,96,67.51,67.51,0,0,0,223.05,70.5ZM160,156a60,60,0,0,1-29-7.47,4,4,0,0,0-5,.89L70,214.25A20,20,0,0,1,41.75,186l64.82-56a4,4,0,0,0,.89-5,60,60,0,0,1,69.46-86.59L141.05,77.29a4,4,0,0,0-1,3.55l5.66,26.35a4,4,0,0,0,3.07,3.07l26.35,5.66a4,4,0,0,0,3.55-1l38.87-35.87A60.05,60.05,0,0,1,160,156Z`}))]]),xi=B.forwardRef((e,t)=>B.createElement(x,{ref:t,...e,weights:ci}));xi.displayName=`ArrowClockwiseIcon`;var Si=xi,Ci=B.forwardRef((e,t)=>B.createElement(x,{ref:t,...e,weights:li}));Ci.displayName=`ArrowCounterClockwiseIcon`;var wi=Ci,Ti=B.forwardRef((e,t)=>B.createElement(x,{ref:t,...e,weights:ui}));Ti.displayName=`ArrowsOutIcon`;var Ei=Ti,Di=B.forwardRef((e,t)=>B.createElement(x,{ref:t,...e,weights:di}));Di.displayName=`CaretUpIcon`;var Oi=Di,ki=B.forwardRef((e,t)=>B.createElement(x,{ref:t,...e,weights:fi}));ki.displayName=`ChatCircleTextIcon`;var Ai=ki,ji=B.forwardRef((e,t)=>B.createElement(x,{ref:t,...e,weights:pi}));ji.displayName=`ClockIcon`;var Mi=ji,Ni=B.forwardRef((e,t)=>B.createElement(x,{ref:t,...e,weights:mi}));Ni.displayName=`ClockCounterClockwiseIcon`;var Pi=Ni,Fi=B.forwardRef((e,t)=>B.createElement(x,{ref:t,...e,weights:hi}));Fi.displayName=`InfoIcon`;var Ii=Fi,Li=B.forwardRef((e,t)=>B.createElement(x,{ref:t,...e,weights:gi}));Li.displayName=`KeyboardIcon`;var Ri=Li,zi=B.forwardRef((e,t)=>B.createElement(x,{ref:t,...e,weights:_i}));zi.displayName=`ListBulletsIcon`;var Bi=zi,Vi=B.forwardRef((e,t)=>B.createElement(x,{ref:t,...e,weights:vi}));Vi.displayName=`ListMagnifyingGlassIcon`;var Hi=Vi,Ui=B.forwardRef((e,t)=>B.createElement(x,{ref:t,...e,weights:yi}));Ui.displayName=`MagnifyingGlassMinusIcon`;var Wi=Ui,Gi=B.forwardRef((e,t)=>B.createElement(x,{ref:t,...e,weights:bi}));Gi.displayName=`WrenchIcon`;var Ki=Gi,qi=i(b(),1),Ji=`$__all`;function Yi(e,t,n){if(e.kind===`constant`)return e.value??``;let r=e.kind===`custom`?e.options?.map(e=>({value:e}))??[]:n===null?[]:n,i=t[e.name],a=!e.multi&&Array.isArray(i)&&i.length===0?void 0:i;if(a===`$__all`){if(e.include_all)return Ji}else if(a!==void 0){if(e.kind===`text`||r===void 0)return a;let t=new Set(r.map(e=>e.value));if(Array.isArray(a)){if(a.length===0&&e.multi)return[];let n=a.filter(e=>t.has(e));if(n.length>0)return n}else if(t.has(a))return a}return e.default?e.default:e.include_all?Ji:r?.[0]?.value??``}var Xi=(e,t)=>e.replace(/\$([a-z][a-z0-9_]*)/g,(e,n)=>{let r=t[n];return r===void 0?e:r===`$__all`?`all`:Array.isArray(r)?r.join(`, `):r});function Zi(e,t,n){let r={};for(let i of e??[]){let e=Yi(i,t,n?.[i.name]);(i.kind!==`query`||e!==``)&&(r[i.name]=e)}return r}function Qi(e){return e.replace(/[&<>"']/g,e=>({"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`})[e])}var $i=e=>e.map(Qi).join(`
`);function ea(e,t=!1){return n=>{let r=Array.isArray(n)?n:[n];return $i([...r[0]?.axisValueLabel?[r[0].axisValueLabel]:[],...r.map(n=>{let r=n.value,i=Array.isArray(r)?t?r.slice(1):r:[r];return`${n.seriesName??``}${n.name?` · ${n.name}`:``}: ${i.map(t=>typeof t==`number`?e(t,n.seriesName):String(t??`—`)).join(` · `)}`})])}}var ta=e=>/^Other(?: \(\d+\))?$/.test(e??``);function na(e,t){let n=Math.min(6,Math.max(1,Math.floor(t.options?.top||6))),r=e.filter(e=>!ta(e.name)),i=r.slice(0,n).map(e=>({name:e.name,items:[e]})),a=[...e.filter(e=>ta(e.name)),...r.slice(n)];return a.length&&i.push({name:a.length===1&&ta(a[0].name)?a[0].name:`Other (${a.reduce((e,t)=>e+(ta(t.name)?Number(t.name.match(/\d+/)?.[0]??1):1),0)})`,items:a}),i}function ra(e){let t=e.filter(e=>e!==null);return t.length?t.reduce((e,t)=>e+t,0):null}function ia(e,t){let n=Math.min(6,Math.max(1,Math.floor(t.options?.top||6))),r=e.filter(e=>!ta(e.name));return{shown:[...r.slice(0,n),...e.filter(e=>ta(e.name))],hidden:Math.max(0,r.length-n)}}function aa(e,t){return e>0?[{type:`text`,right:8,bottom:2,silent:!0,style:{text:`${e} more series not shown`,fill:t,fontSize:11}}]:[]}function oa(e,t,n,r,i=`sans-serif`,a){let o=e=>Array.from(e).length>24?`${Array.from(e).slice(0,23).join(``)}…`:e,s=Math.max(1,t-16),c=1,l=0;for(let t of e){let e=15+(a?.(o(t),`12px ${i}`)??Array.from(o(t)).length*7.2);l&&l+10+e>s&&(c++,l=0),l+=(l?10:0)+e}let u=c>2;return{top:n?u?30:c*20+2:12,option:{type:u?`scroll`:`plain`,show:n,top:0,left:0,right:0,padding:0,itemGap:6,icon:`roundRect`,itemWidth:10,itemHeight:10,itemStyle:{borderColor:r,borderWidth:1},textStyle:{color:r,fontSize:12,lineHeight:14},data:e,formatter:o,tooltip:{show:!0,renderMode:`html`,formatter:e=>Qi(e.name)}}}}function sa(e,t){if(!(!Number.isFinite(e)||!Number.isFinite(t)||e>=t||Math.abs(e)>864e13||Math.abs(t)>864e13))return{from:new Date(Math.floor(e)).toISOString(),to:new Date(Math.ceil(t)).toISOString()}}function ca(e){let t=[e.time?.range?`Range ${e.time.range}`:void 0,e.time?.shift?`Shifted ${e.time.shift}`:void 0].filter(Boolean);return t.length?t.join(` · `):void 0}function la(e,t,n){if(n.interactive===!1||n.data?.value===null)return;let r=n.data?.selection;if(r)return Object.values(r.dimensions).some(ta)?void 0:r;if(ta(n.seriesName)||ta(n.name)||n.value===null||Array.isArray(n.value)&&n.value.at(-1)==null)return;let i=e.query?.by?.[0]??t.frame?.columns.find(e=>e.role===`dimension`)?.name,a=e.viz===`timeseries`?n.seriesName:n.name,o=Array.isArray(n.value)?n.value:[];return{time:e.viz===`timeseries`&&typeof o[0]==`number`?o[0]:void 0,dimensions:i&&a?{[i]:a}:{}}}function ua(e){return Array.from({length:e.rows},(t,n)=>Object.fromEntries(e.columns.map((t,r)=>{let i=e.values[r]?.[n]??null;return[t.name,typeof i==`number`&&!Number.isFinite(i)?null:i]})))}function da(e,t){return e.viz!==`logs`||!t||t.rows<2?[]:t.columns.flatMap((e,n)=>{if(e.role!==`dimension`||e.type!==`string`||[`body`,`body_template`,`severity`,`status`].includes(e.name)||/(^id$|_id$)/.test(e.name))return[];let r=t.values[n][0];return typeof r==`string`&&r!==``&&t.values[n].slice(0,t.rows).every(e=>e===r)?[{name:e.name,value:r}]:[]})}function fa(e,t){let n=t.frame??{columns:[],values:[],rows:0};return{columns:n.columns.map(e=>e.name),rows:ua(n),selection:t=>{let n={};for(let r of e.query?.by??[]){let e=r.startsWith(`attributes[`)||r.startsWith(`resource[`)?r.slice(r.indexOf(`'`)+1,r.lastIndexOf(`'`)):r;t[e]!==void 0&&t[e]!==null&&(n[r]=String(t[e]))}return{time:typeof t.time==`number`?t.time:typeof t.start==`number`?t.start:void 0,dimensions:n,trace_id:typeof t.trace_id==`string`?t.trace_id:void 0,namespace:typeof t.namespace==`string`?t.namespace:void 0}}}}var pa=new Intl.NumberFormat(`en`,{notation:`compact`,maximumFractionDigits:1}),ma=new Intl.NumberFormat(`en`,{maximumFractionDigits:2});function ha(e){return Math.abs(e)<1e-4?e.toExponential(2).replace(/\.?(0+)(?=e)/,``):String(Number(e.toPrecision(3)))}function ga(e,t=ma){return e!==0&&Math.abs(e)<1?ha(e):t.format(e)}function _a(e,t){let n=t===`s`?e*1e3:t===`ns`?e/1e6:e;return e!==0&&n===0?`${ha(e)}${t}`:n!==0&&Math.abs(n)<1?`${ha(n)}ms`:be(n)}function va(e){let t=[`B`,`KiB`,`MiB`,`GiB`,`TiB`],n=e,r=0;for(;Math.abs(n)>=1024&&r=1e4?pa:ma);default:return ga(t,Math.abs(t)>=1e4?pa:ma)}}function ba(e){return t=>e===`ms`||e===`s`||e===`ns`?ya(e,t).replace(/(\.\d*?)0+([a-z]*)$/,`$1$2`).replace(/\.([a-z]*)$/,`$1`):ya(e,t)}function xa(e,t){return ba(e)(t??NaN).replace(/(?<=\d)(ms|ns|s|m|h)\b/g,` $1`)}function Sa(e){return Math.max(3,Math.min(10,Math.round(e/70)))-1}function Ca(e,t){let n=t===`ms`?1:t===`s`?1e3:t===`ns`?1e-6:void 0,r=e=>{let t=10**Math.floor(Math.log10(e));return[1,2,5,10].map(e=>e*t).find(t=>t>=e)};if(n===void 0)return r(e);let i=e*n,a=[1,10,100,1e3,1e4,6e4,6e5,36e5,36e6].flatMap(e=>[1,2,5].map(t=>e*t)).sort((e,t)=>e-t);return(i<1?r(i):a.find(e=>e>=i)??r(i/36e5)*36e5)/n}function wa(e,t,n,r){e=Number.isFinite(e)?Math.min(0,e):0,t=Number.isFinite(t)?Math.max(0,t):1,t===e&&(t=e+1);let i=Sa(r),a=Ca(Math.max(t-e,2**-52)/i,n);for(;Math.ceil(t/a)-Math.floor(e/a)>i;)a=Ca(a*1.01,n);return{min:Math.floor(e/a)*a,max:Math.ceil(t/a)*a,interval:a,splitNumber:i,fanout_unit:n}}function Ta(e,t){return e.type!==`value`&&e.type!==`log`?e:{...e,...e.type===`value`&&typeof e.min==`number`&&typeof e.max==`number`?wa(e.min,e.max,typeof e.fanout_unit==`string`?e.fanout_unit:void 0,t):{splitNumber:Sa(t)}}}function Ea(e,t,n){let r=e=>ya(n,e),i=``;if(n===`ms`||n===`s`||n===`ns`){let a=n===`s`?1e3:n===`ns`?1e-6:1,o=Math.abs((e??t??0)*a),s=o>=6e4?6e4:o>=1e3?1e3:1;i=s===6e4?` min`:s===1e3?` s`:` ms`;let c=s===6e4?1:s===1e3?+(o<1e4):2,l=new Intl.NumberFormat(void 0,{maximumFractionDigits:c});r=e=>l.format(e*a/s)}return t===null&&e!==null?`≥${r(e)}${i}`:(e===null||e===0)&&t!==null?`<${r(t)}${i}`:`${e===null?`−∞`:r(e)}–${t===null?`∞`:r(t)}${i}`}function Da(e){let t=new Date(e);return t.getHours()===0&&t.getMinutes()===0&&t.getSeconds()===0?t.toLocaleDateString(void 0,{month:`short`,day:`numeric`}):t.toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`})}function Oa(e,t=new Date,n){let r=new Date(e);if(!Number.isFinite(r.getTime()))return`—`;let i=new Intl.DateTimeFormat(n,{month:`short`,day:`numeric`,...r.getFullYear()===t.getFullYear()?{}:{year:`numeric`},hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`}).formatToParts(r),a=i.filter(e=>[`month`,`day`,`year`].includes(e.type)).map(e=>e.value),o=i.filter(e=>[`hour`,`minute`,`second`].includes(e.type)).map(e=>e.value);return`${a.join(` `)} ${o.join(`:`)}`}function ka({panel:e,result:t}){let n=t?.frame;return(0,V.jsxs)(`div`,{"data-panel-data":!0,children:[t?.error&&(0,V.jsx)(T,{"data-panel-error-detail":!0,size:`sm`,role:`status`,style:{whiteSpace:`pre-wrap`,overflowWrap:`anywhere`,userSelect:`text`},children:t.error}),n?(0,V.jsxs)(xe,{fz:12,striped:!0,children:[(0,V.jsx)(xe.Thead,{children:(0,V.jsx)(xe.Tr,{children:n.columns.map(e=>(0,V.jsx)(xe.Th,{ff:Tt.display,children:e.name},e.name))})}),(0,V.jsx)(xe.Tbody,{children:Array.from({length:Math.min(n.rows,500)},(t,r)=>(0,V.jsx)(xe.Tr,{children:n.columns.map((t,i)=>{let a=n.values[i][r];return(0,V.jsx)(xe.Td,{ff:Tt.display,children:a===null?`—`:t.type===`time`?new Date(Number(a)).toISOString():t.role===`measure`?ya(t.unit??e.unit,Number(a)):String(a)},t.name)})},r))})]}):(0,V.jsx)(T,{c:`dimmed`,size:`sm`,children:`No data.`}),(0,V.jsxs)(T,{c:`dimmed`,fz:12,mt:8,children:[`Ran in `,t?.elapsed_ms??0,` ms`,t?.interval?`, one point per ${t.interval}`:``,n?`, ${n.rows} rows${n.truncated?` (truncated)`:``}`:``,`.`]}),(t?.sql??e.sql)&&(0,V.jsx)(ze,{block:!0,tabIndex:0,mt:8,children:t?.sql??e.sql})]})}function Aa({panel:e,dark:t}){let n=JSON.stringify(e,null,2).split(/("(?:[^"\\]|\\.)*"(?=\s*:)|"(?:[^"\\]|\\.)*"|\b(?:true|false|null)\b|-?\d+(?:\.\d+)?)/g);return(0,V.jsx)(`pre`,{"data-panel-spec":!0,style:{margin:0,fontFamily:Tt.display,fontSize:12,color:pt[t?`dark`:`light`].text},children:n.map((e,r)=>{let i=e.startsWith(`"`)&&/^\s*:/.test(n[r+1]??``)?`key`:e.startsWith(`"`)?`string`:/^(true|false|null)$/.test(e)?`literal`:/^-?\d/.test(e)?`number`:`punctuation`,a=i===`key`?vt[t?4:7]:i===`string`?ht[t?4:8]:i===`number`||i===`literal`?Ot[t?4:8]:void 0;return i===`punctuation`?e:(0,V.jsx)(`span`,{"data-json-token":i,style:{color:a},children:e},r)})})}function ja(e){let t=e.event.data?.selection,n=e.event.value;return JSON.stringify([e.event.seriesName,e.event.name,t?.from??t?.time??(Array.isArray(n)?n[0]:void 0),t?.dimensions,t?.bucket])}function Ma(e){let t=new Date().toISOString().slice(0,10),n=e.from.slice(0,10),r=e.to.slice(0,10),i=e=>e.slice(11,-1).replace(/\.000$/,``);return`${(n===t?``:n+` `)+i(e.from)} – ${(r!==n&&r!==t?r+` `:``)+i(e.to)} UTC · ${be(Date.parse(e.to)-Date.parse(e.from))}`}var Na={background:`color-mix(in srgb, var(--mantine-color-body) 92%, transparent)`,border:`1px solid var(--mantine-color-default-border)`,borderRadius:`var(--mantine-radius-sm)`,padding:`2px 6px`};function Pa(e){return e.replace(`Enter drill`,`↵ drill`).replace(`Shift+←→`,`⇧←→`)}var Fa=(0,B.createContext)(void 0);function Ia({points:e,label:t,summary:n,children:r,onClick:i,canSelect:a,onHighlight:s,onActiveChange:c,onRangePending:l,onRangeChange:u,onRangeBarHeight:d,rangeReset:f,height:p=`100%`,onZoom:m,bounds:h,pointWindow:g}){let[_,v]=(0,B.useState)(!1),[b,x]=(0,B.useState)(``),[S,w]=(0,B.useState)(),[E,D]=(0,B.useState)(null),O=(0,B.useRef)(null),k=(0,B.useRef)(!1);(0,B.useEffect)(()=>{let e=e=>{e.key===`Tab`&&(k.current=!1)};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},[]);let A=(0,B.useId)(),j=(0,B.useContext)(Fa),M=(0,B.useRef)(null),N=(0,B.useRef)({onHighlight:s,onActiveChange:c,onRangePending:l,onRangeChange:u,onRangeBarHeight:d});N.current={onHighlight:s,onActiveChange:c,onRangePending:l,onRangeChange:u,onRangeBarHeight:d};let P=(0,B.useMemo)(()=>new Map(e.map(e=>[ja(e),e])),[e]),F=(0,B.useRef)(void 0),I=e=>g?.(e)?.from??e.event.name??(Array.isArray(e.event.value)?e.event.value[0]:void 0),L=F.current,ee=L?e.filter(e=>e.event.seriesName===L.event.seriesName):e,te=ee.length?ee:e,ne=L&&I(L),re=typeof ne==`number`?te.reduce((e,t)=>{let n=I(t),r=e&&I(e);return typeof n==`number`&&(!e||typeof r!=`number`||Math.abs(n-ne)I(e)===ne),ie=S?P.get(S)??re??te[0]??e[0]:e[0],ae=!!(m&&h&&Number.isFinite(h.from)&&Number.isFinite(h.to)&&h.from[...new Set(e.map(e=>e.event.seriesName))],[e]),oe=(0,B.useMemo)(()=>e.filter(e=>e.event.seriesName===ie?.event.seriesName),[e,ie?.event.seriesName]),z=ie?oe.indexOf(ie):-1;(0,B.useEffect)(()=>{ie&&(!S||P.has(S)||!ee.length)&&(F.current=ie,(!S||!ee.length)&&w(ja(ie))),_&&N.current.onHighlight(ie)},[ie,S,_]),(0,B.useEffect)(()=>{if(!E)return;let e=Date.parse(E.from),t=Date.parse(E.to);h&&(Number.isFinite(e)&&eh.to)&&D(null)},[h?.from,h?.to,E]),(0,B.useEffect)(()=>{N.current.onRangePending?.(!!E)},[!!E]),(0,B.useEffect)(()=>{N.current.onRangeChange?.(E?{from:Date.parse(E.from),to:Date.parse(E.to)}:void 0)},[E]),(0,B.useEffect)(()=>{D(null)},[f]),(0,B.useEffect)(()=>()=>{N.current.onHighlight(void 0),N.current.onRangePending?.(!1),N.current.onRangeChange?.(void 0)},[]);let se=(e,t=!1)=>{if(e){if(x(n(e)),t&&ae&&ie){let t=E?.anchor??ja(ie),n=P.get(t),r=E?.window??(n&&g?.(n)),i=g?.(e);if(r&&i){let e=Math.max(h.from,Math.min(r.from,i.from)),n=Math.min(h.to,Math.max(r.to,i.to));Number.isFinite(e)&&Number.isFinite(n)&&e{if(!ie)return;let n=R[Math.max(0,Math.min(R.length-1,R.indexOf(ie.event.seriesName)+t))],r=e.filter(e=>e.event.seriesName===n),i=I(ie),a=r.find(e=>I(e)===i),o=typeof i==`number`?r.reduce((e,t)=>{let n=I(t),r=e&&I(e);return typeof n==`number`&&(!e||typeof r!=`number`||Math.abs(n-i){e===`ArrowLeft`||e===`ArrowRight`?se(oe[Math.max(0,Math.min(oe.length-1,z+(e===`ArrowLeft`?-1:1)))],t):!t&&(e===`ArrowUp`||e===`ArrowDown`)?ce(e===`ArrowUp`?-1:1):!t&&(e===`Home`||e===`End`)&&se(e===`Home`?oe[0]:oe.at(-1))},ue=()=>{D(null),O.current?.focus()},de=ae?`←→ points · ↑↓ series · Enter drill · Shift+←→ range`:`←→ points · ↑↓ series · Enter drill`;return(0,B.useLayoutEffect)(()=>(j?.setHint(_?de:void 0),()=>j?.setHint(void 0)),[j,_,de]),(0,B.useLayoutEffect)(()=>{let e=M.current;if(!e)return;N.current.onRangeBarHeight?.(e.getBoundingClientRect().height);let t=new ResizeObserver(([t])=>{if(!t)return;let n=getComputedStyle(e),r=[n.paddingTop,n.paddingBottom,n.borderTopWidth,n.borderBottomWidth].reduce((e,t)=>e+(parseFloat(t)||0),0);N.current.onRangeBarHeight?.(t.borderBoxSize?.[0]?.blockSize??t.contentRect.height+r)});return t.observe(e),()=>{t.disconnect(),N.current.onRangeBarHeight?.(0)}},[!!(E&&ae)]),(0,V.jsxs)(o,{ref:O,"data-chart-plot":!0,tabIndex:0,role:`application`,"aria-roledescription":`chart`,"aria-label":t,"aria-describedby":A,"data-mantine-stop-propagation":E?`true`:void 0,className:`chart-keyboard-point`,style:{position:`relative`,height:p,width:`100%`,flex:`1 1 auto`,minHeight:0,minWidth:0},onPointerDownCapture:e=>{M.current?.contains(e.target)||(k.current=!0,v(!1),_&&N.current.onHighlight(void 0),N.current.onActiveChange?.(!1))},onFocus:e=>{e.target!==e.currentTarget||k.current||(N.current.onActiveChange?.(!0),v(!0))},onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||(v(!1),D(null),x(``),N.current.onHighlight(void 0),N.current.onActiveChange?.(!1))},onKeyDown:e=>{if(e.defaultPrevented||e.ctrlKey||e.metaKey||e.altKey||e.nativeEvent.isComposing)return;if(e.key===`Escape`&&!e.repeat){E?(e.preventDefault(),e.stopPropagation(),ue()):e.target===e.currentTarget&&!e.currentTarget.closest(`[data-panel-fullscreen],[data-fragment-fullscreen]`)&&(e.preventDefault(),e.stopPropagation(),e.currentTarget.blur());return}if(e.target!==e.currentTarget||e.repeat&&![`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`].includes(e.key))return;let t=[`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key);if(t&&!_&&(k.current=!1,v(!0),N.current.onActiveChange?.(!0),!ie)){e.preventDefault();return}e.key===`Enter`&&_&&!e.shiftKey&&ie&&i&&(!a||a(ie.event))?(e.preventDefault(),i(ie.event)):t&&(!e.shiftKey||e.key===`ArrowLeft`||e.key===`ArrowRight`)&&(e.preventDefault(),le(e.key,e.shiftKey))},children:[r,(0,V.jsx)(o,{"data-chart-overlay":!0,style:{position:`absolute`,inset:0,zIndex:1,pointerEvents:`none`,overflow:`hidden`},children:E&&ae&&(0,V.jsxs)(y,{ref:M,"data-chart-range-bar":!0,gap:6,style:{...Na,position:`absolute`,bottom:4,left:4,right:4,maxHeight:`100%`,overflow:`auto`,pointerEvents:`auto`},children:[(0,V.jsx)(T,{"data-chart-range-label":!0,size:`xs`,title:E.from+` – `+E.to,truncate:!0,style:{flex:`1 1 140px`,minWidth:0},children:Ma(E)}),(0,V.jsx)(C,{size:`compact-xs`,"data-mantine-stop-propagation":`true`,onClick:()=>{m(Date.parse(E.from),Date.parse(E.to)),ue()},children:`Zoom to range`}),(0,V.jsx)(C,{size:`compact-xs`,variant:`subtle`,"data-mantine-stop-propagation":`true`,onClick:ue,children:`Cancel`})]})}),(0,V.jsx)(He,{id:A,children:de}),(0,V.jsx)(He,{"aria-live":`polite`,"aria-atomic":`true`,children:b})]})}function La(e){return e===`healthy`?`ok`:e===`degraded`?`warn`:e===`unknown`?`gray`:`bad`}function Ra(e){return pt[e?`dark`:`light`]}function za(e){let t=e?5:7;return{ok:ht[t],warn:gt[t],bad:Dt[t],info:Ot[t]}}function Ba(e,t){return St[t?`dark`:`light`][e]??Ra(t).muted}function Va(e){return e===`unhealthy`?`diamond`:e===`degraded`?`roundRect`:`circle`}function Ha(e){return e===`unknown`?`dashed`:`solid`}var Ua=e=>typeof e==`number`&&Number.isFinite(e)?e:null;function Wa(e){return e.columns.flatMap((e,t)=>e.role===`measure`?[t]:[])}function Ga(e){let t=e.columns.findIndex(e=>e.role===`time`);if(t<0)return[];let n=e.columns.findIndex(e=>e.role===`dimension`),r=Wa(e);if(n>=0&&r.length>0){let i=r[0],a=new Map;for(let r=0;r({name:e.columns[n].name,unit:e.columns[n].unit,points:e.values[t].map((t,r)=>[Number(t),Ua(e.values[n][r])])}))}function Ka(e){let t=e.columns.flatMap((e,t)=>e.role===`dimension`?[t]:[]),n=Wa(e);if(t.length===0||n.length===0)return{categories:[],series:[]};let r=t[0],i=[];for(let t=0;t1){let a=t[1],o=n[0],s=new Map;for(let t=0;tnull)),s.get(n)[i.indexOf(String(e.values[r][t]??``))]=Ua(e.values[o][t])}return{categories:i,series:[...s.entries()].map(([t,n])=>({name:t,unit:e.columns[o].unit,values:n}))}}return{categories:i,series:n.map(t=>({name:e.columns[t].name,unit:e.columns[t].unit,values:e.values[t].map(Ua)}))}}function qa(e,t){let n=e.filter(e=>e!==null);if(n.length===0)return null;switch(t){case`last`:return n[n.length-1];case`min`:return Math.min(...n);case`max`:return Math.max(...n);case`sum`:return n.reduce((e,t)=>e+t,0);default:return n.reduce((e,t)=>e+t,0)/n.length}}function Ja(e,t){let n=Wa(t)[0];return n===void 0?null:(e.reduce??`window`)===`window`?t.totals?Ua(t.totals[n]):qa(t.values[n].map(Ua),`mean`):qa(t.values[n].map(Ua),e.reduce??`mean`)}function Ya(e){let t=Wa(e)[0];return t===void 0?[]:e.values[t].map(Ua)}var Xa={ok:0,warn:1,bad:2};function Za(e){if(!e?.length)return;let t=[...e].sort((e,t)=>Xa[e.status]-Xa[t.status]),n=t[0],r=t[t.length-1];return Xa[r.status]>Xa[n.status]&&r.value!==n.value?r.value>n.value?`lower`:`higher`:`lower`}function Qa(e,t,n){if(e===null||!t||t.length===0)return null;n??=Za(t);let r=`ok`;for(let i of t)(n===`lower`?e>=i.value:e<=i.value)&&Xa[i.status]>Xa[r]&&(r=i.status);return r}function $a(e,t){let n=wt(e),r=wt(t);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}function eo(e,t){return`rgba(${[1,3,5].map(t=>parseInt(e.slice(t,t+2),16)).join(`, `)}, ${t})`}function to(e,t){return{color:e,...$a(e,t.surface)<3?{borderColor:t.text,borderWidth:1}:{}}}function no(e,t){return{color:e,...$a(e,t.surface)<3?{shadowColor:t.text,shadowBlur:2}:{}}}function ro(e,t){return{ok:ht,warn:gt,bad:Dt}[e][t?5:8]}function io(e){let t=Ra(e),n=za(e);return{dark:e,text:t.text,muted:t.muted,grid:t.grid,surface:t.surface,border:t.border,status:{ok:n.ok,warn:n.warn,bad:n.bad},font:Tt.display}}function ao(e,t,n){if(!Array.isArray(e.series))return e;let r=e.series,i=Array.isArray(e.yAxis)?e.yAxis:[e.yAxis],a=[],o=r.map((e,o)=>{let s=e.endLabel;if(!s?.show||!Array.isArray(e.data))return e;let c;for(let t=e.data.length-1;t>=0;t--){let n=e.data[t];if(Array.isArray(n)&&typeof n[1]==`number`&&Number.isFinite(n[1])){c=n;break}}let l=i[Number(e.yAxisIndex??0)];if(!c||!l)return{...e,endLabel:{...s,show:!1}};let u=l.type===`log`?Math.log:e=>e,d=l.min??1/0,f=l.max??0;if(l.type===`log`&&(l.min===void 0||l.max===void 0)){for(let t of r)if(Number(t.yAxisIndex??0)===Number(e.yAxisIndex??0)&&Array.isArray(t.data))for(let e of t.data)Array.isArray(e)&&typeof e[1]==`number`&&Number.isFinite(e[1])&&e[1]>0&&(l.min===void 0&&(d=Math.min(d,e[1])),l.max===void 0&&(f=Math.max(f,e[1])))}Number.isFinite(d)||(d=1);let p=u(l.type===`log`?d:l.min??0),m=u(l.type===`log`?Math.max(f,d*1.01):l.max??1),h=n?.(o,c),g=Number.isFinite(h)?h:t.y+t.height*(1-(u(c[1])-p)/(m-p)),_=((s.lineHeight??14)+2)/2,v=[Math.max(t.y+_,Math.min(t.y+t.height-_,g)),...a.flatMap(e=>[e.y-e.half-_,e.y+e.half+_])].filter(e=>Number.isFinite(e)&&e-_>=t.y&&e+_<=t.y+t.height&&a.every(t=>Math.abs(t.y-e)>=t.half+_)).sort((e,t)=>Math.abs(e-g)-Math.abs(t-g))[0];return v===void 0?{...e,endLabel:{...s,show:!1}}:(a.push({y:v,half:_}),{...e,labelLayout:{dy:v-g,hideOverlap:!0}})});return{...e,series:o}}var oo=(e,t,n)=>ta(e)?n.muted:Ba(t,n.dark);function so(e,t){let n=Ga(e);if(!e.columns.some(e=>e.role===`dimension`))for(let e of n){let t=e.name;e.name=/^p\d+(?:\(.*\))?$/.test(t)&&[`ms`,`s`,`ns`].includes(e.unit??``)?`${t.match(/^p\d+/)[0]} latency`:/^error_rate(?:\(\))?$/.test(t)?`Error rate`:/^rate(?:\(\))?$/.test(t)?`Request rate`:t.replaceAll(`_`,` `).replace(/^./,e=>e.toUpperCase())}return ia(n,t)}function co(e,t){return{animationDuration:200,textStyle:{fontFamily:e.font,color:e.muted,fontSize:11},grid:{left:8,right:16,top:28,bottom:8,containLabel:!0},tooltip:{trigger:`axis`,formatter:ea(e=>ya(t,e)),confine:!0,backgroundColor:e.surface,borderColor:e.border,textStyle:{color:e.text,fontSize:12},valueFormatter:e=>ya(t,e),axisPointer:{type:`line`,lineStyle:{color:e.border}}},aria:{enabled:!0}}}function lo(e,t,n,r){return(e.thresholds??[]).map(i=>({yAxis:i.value,label:{formatter:`${i.label??i.status} ${ba(r??e.unit)(i.value).replace(/(?<=\d)(ms|s|m|h)$/,` $1`)}`,position:i.value<=(n.min+n.max)/2?`insideEndTop`:`insideEndBottom`,distance:8,color:t.muted,textBorderColor:t.surface,textBorderWidth:3,fontSize:12},lineStyle:{color:t.status[i.status],type:[4,3],width:1}}))}function uo(e,t,n,r={width:500,height:248}){let i=t.frame?so(t.frame,e):{shown:[],hidden:0},a=i.shown,o=a[0]?.unit??e.unit,s=new Set(a.map(e=>e.name)),c=a.find(e=>ta(e.name)),l=t.previous&&t.shift_ms!==void 0?so(t.previous,e).shown.flatMap(e=>ta(e.name)?c?[e]:[]:s.has(e.name)?[e]:[]):[],u=[...new Set([...a,...l].map(t=>t.unit??e.unit))];u.length===0&&u.push(e.unit);let d=e.options?.style??`line`,f=a.length>=2&&a.length<=6&&i.hidden===0&&d!==`bars`&&d!==`stacked`,p=f?Math.max(40,...a.map(e=>{let t=Array.from(e.name).slice(0,24).join(``);return r.measureText?.(t,`12px ${n.font}`)??Array.from(t).length*7.2}))+12:0,m=f?p+8:0,h=(e.options?.legend??`auto`)!==`hidden`&&a.length>1,g=oa(a.map(e=>e.name),r.width,h,n.text,n.font,r.measureText),_=r.height-g.top-(i.hidden?24:8)-22,v=Math.max(0,Math.floor(_/16)),y=t.shift_ms,b=u.map(t=>{let n=[...a,...l].filter(n=>(n.unit??e.unit)===t).flatMap(e=>e.points.flatMap(([,e])=>e===null?[]:[e]));if(d===`stacked`){let r=new Map;for(let n of a.filter(n=>(n.unit??e.unit)===t))for(let[e,t]of n.points){let n=r.get(e)??{positive:0,negative:0};t!==null&&(t>0?n.positive+=t:n.negative+=t),r.set(e,n)}n.push(...[...r.values()].flatMap(e=>[e.positive,e.negative]))}return wa(Math.min(0,...n),Math.max(0,...n),t,_)}),x=a.map((t,r)=>{let i=oo(t.name,r,n);return{name:t.name,interactive:!0,yAxisIndex:u.indexOf(t.unit??e.unit),tooltip:{valueFormatter:n=>ya(t.unit??e.unit,n)},type:d===`bars`||d===`stacked`?`bar`:`line`,data:t.points,endLabel:f?{show:r0?{symbol:[`none`,`none`],silent:!0,data:lo(e,n,b[0],o)}:void 0}}),S=y===void 0?[]:l.map(t=>({name:`${t.name} · previous`,interactive:!1,yAxisIndex:u.indexOf(t.unit??e.unit),tooltip:{valueFormatter:n=>ya(t.unit??e.unit,n)},type:`line`,data:t.points.map(([e,t])=>[e+y,t]),showSymbol:!1,silent:!0,z:1,lineStyle:{width:1,type:`dashed`,color:n.muted},itemStyle:{color:n.muted}})),C=u.map((t,r)=>({...e.options?.scale===`log`?{splitNumber:Sa(_)}:b[r],type:e.options?.scale===`log`?`log`:`value`,position:r===0?`left`:`right`,offset:Math.max(0,r-1)*56,axisLine:{show:!1},splitLine:{show:r===0,lineStyle:{color:n.grid}},axisLabel:{color:n.muted,fontFamily:n.font,fontSize:11,hideOverlap:!0,formatter:ba(t)}}));return ao({...co(n,o),tooltip:{...co(n,o).tooltip,formatter:ea((t,n)=>ya([...a,...l].find(e=>e.name===n||`${e.name} · previous`===n)?.unit??e.unit,t),!0)},legend:g.option,grid:{left:8,right:16+(f?m:0)+Math.max(0,u.length-2)*56,top:g.top,bottom:i.hidden?24:8,containLabel:!0},xAxis:{type:`time`,min:t.from_ms,max:t.to_ms,axisLine:{lineStyle:{color:n.grid}},axisTick:{show:!1},splitLine:{show:!1},axisLabel:{color:n.muted,fontFamily:n.font,fontSize:11,hideOverlap:!0,formatter:Da}},yAxis:C.length===1?C[0]:C,series:[...x,...S],graphic:aa(i.hidden,n.muted)},{y:g.top,height:_})}function fo(e,t,n){if(n(e)<=t)return e;let r=Array.from(e);for(let e=r.length-1;e>0;e--){let i=Math.floor(e*.45),a=e-i,o=r.slice(0,i).join(``)+`…`+r.slice(-a).join(``);if(n(o)<=t)return o}return`…`}function po(e,t,n,r={width:500,height:248}){let i=Ka(t),a=i.categories,{shown:o,hidden:s}=ia(i.series,e),c=t.columns.flatMap((e,t)=>e.role===`dimension`?[t]:[]),l=new Map;for(let n=0;nString(t.values[e][n]??``))),{dimensions:r,...i})}let u=o[0]?.unit??e.unit,d=[...new Set(o.map(t=>t.unit??e.unit))];d.length===0&&d.push(e.unit);let f=o.length>1,p=!!(t.periods?.[`Before deploy`]||t.periods?.[`Since deploy`]),m=e=>r.measureText?.(e,`11px ${n.font}`)??Array.from(e).length*6.6,h=Math.min(r.width*.4,Math.max(40,...a.map(m))),g=oa(o.map(e=>e.name),r.width,f&&e.options?.legend!==`hidden`,n.text,n.font,r.measureText),_=d.map((t,i)=>({...wa(Math.min(0,...o.filter(n=>(n.unit??e.unit)===t).flatMap(e=>e.values.filter(e=>e!==null))),Math.max(0,...o.filter(n=>(n.unit??e.unit)===t).flatMap(e=>e.values.filter(e=>e!==null))),t,r.width-h-80),type:`value`,position:i===0?`bottom`:`top`,offset:Math.max(0,i-1)*36,splitLine:{show:i===0,lineStyle:{color:n.grid}},axisLabel:{color:n.muted,fontFamily:n.font,fontSize:11,formatter:e=>xa(t,e),hideOverlap:!0}}));return{...co(n,u),tooltip:{...co(n,u).tooltip,formatter:ea((t,n)=>ya(o.find(e=>e.name===n)?.unit??e.unit,t)),axisPointer:{type:`shadow`}},legend:g.option,grid:{left:8,right:56,top:(f?g.top:8)+Math.max(0,d.length-1)*36,bottom:s?24:8,containLabel:!0},yAxis:{type:`category`,inverse:!0,data:a,splitLine:{show:!1},axisLine:{lineStyle:{color:n.grid}},axisTick:{show:!1},axisLabel:{color:n.muted,fontFamily:n.font,fontSize:11,width:h,overflow:`truncate`,formatter:e=>fo(e,h,m)}},xAxis:_.length===1?_[0]:_,series:o.map((t,r)=>({name:t.name,interactive:!0,xAxisIndex:d.indexOf(t.unit??e.unit),tooltip:{valueFormatter:n=>ya(t.unit??e.unit,n)},type:`bar`,data:t.values.map((e,n)=>({value:e,selection:l.get(JSON.stringify(c.length>1?[a[n],t.name]:[a[n]]))})),barMaxWidth:p&&t.name===`Before deploy`?7:14,barGap:`20%`,itemStyle:{...to(p?t.name===`Before deploy`?n.muted:Ba(0,n.dark):oo(t.name,r,n),n),borderRadius:[0,4,4,0]},label:{show:p?t.name===`Since deploy`:!f||r===0,position:`right`,color:n.text,fontFamily:n.font,fontSize:11,formatter:({value:n})=>xa(t.unit??e.unit,n)}})),graphic:aa(s,n.muted)}}function mo(e,t,n,r=e.unit,i={width:270,height:140}){let a=e.min??0,o=e.max??100,s=ho(e,a,o,n),c=ya(r,t),l=Qa(t,e.thresholds,e.better),u=l===`bad`?`◆ Bad`:l===`warn`?`■ Warn`:l===`ok`?`● OK`:t===null?`○ Unknown`:void 0,d=e=>`${e}40`,f=i.measureText?.(c,`600 28px ${n.font}`)??c.length*28*.6,p=i.measureText?.(u??``,`11px ${n.font}`)??(u?.length??0)*11*.6,m=i.width{let r=y;return y=e,{type:`rect`,shape:{x:4+r*_,y:g,width:(e-r)*_,height:10,r:[n===0?5:0,n===s.length-1?5:0,n===s.length-1?5:0,n===0?5:0]},style:{fill:d(t)}}}),{id:`gauge-fill`,type:`rect`,shape:{x:4,y:g,width:v*_,height:10,r:5},style:{fill:l?n.status[l]:Ba(0,n.dark)}},{id:`gauge-marker`,type:`rect`,shape:{x:3+v*_,y:g-2,width:2,height:14,r:1},style:{fill:n.text}},{type:`text`,left:4,top:g+12,style:{text:ya(r,a),fill:n.muted,fontSize:11,fontFamily:n.font}},{type:`text`,right:4,top:g+12,style:{text:ya(r,o),fill:n.muted,fontSize:11,fontFamily:n.font}}]}}function ho(e,t,n,r){let i=n-t||1,a=[t,...(e.thresholds??[]).map(e=>Math.min(n,Math.max(t,e.value))),n].sort((e,t)=>e-t),o=[];for(let t=0;t[(e.end-t)/i,r.status[e.status]])}var go=function(e,t){return go=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},go(e,t)};function H(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);go(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var _o=`12px sans-serif`,vo=20,yo=100,bo=`007LLmW'55;N0500LLLLLLLLLL00NNNLzWW\\\\WQb\\0FWLg\\bWb\\WQ\\WrWWQ000CL5LLFLL0LL**F*gLLLL5F0LF\\FFF5.5N`;function xo(e){var t={};if(typeof JSON>`u`)return t;for(var n=0;n=0)s=o*n.length;else for(var c=0;c=Io&&(Fo=0),Fo++}function Ro(){var e=[...arguments];typeof console<`u`&&console.error.apply(console,e)}function zo(e){if(typeof e!=`object`||!e)return e;var t=e,n=Eo.call(e);if(n===`[object Array]`){if(!vs(e)){t=[];for(var r=0,i=e.length;r`u`&&typeof self<`u`?ks.worker=!0:!ks.hasGlobalWindow||`Deno`in window||typeof navigator<`u`&&typeof navigator.userAgent==`string`&&navigator.userAgent.indexOf(`Node.js`)>-1?(ks.node=!0,ks.svgSupported=!0):As(navigator.userAgent,ks);function As(e,t){var n=t.browser,r=e.match(/Firefox\/([\d.]+)/),i=e.match(/MSIE\s([\d.]+)/)||e.match(/Trident\/.+?rv:(([\d.]+))/),a=e.match(/Edge?\/([\d.]+)/),o=/micromessenger/i.test(e);if(r&&(n.firefox=!0,n.version=r[1]),i&&(n.ie=!0,n.version=i[1]),a&&(n.edge=!0,n.version=a[1],n.newEdge=+a[1].split(`.`)[0]>18),o&&(n.weChat=!0),t.svgSupported=typeof SVGRect<`u`,t.touchEventsSupported=`ontouchstart`in window&&!n.ie&&!n.edge,t.pointerEventsSupported=`onpointerdown`in window&&(n.edge||n.ie&&+n.version>=11),t.domSupported=typeof document<`u`){var s=document.documentElement.style;t.transform3dSupported=(n.ie&&`transition`in s||n.edge||`WebKitCSSMatrix`in window&&`m11`in new WebKitCSSMatrix||`MozPerspective`in s)&&!(`OTransition`in s),t.transformSupported=t.transform3dSupported||n.ie&&+n.version>=9}}var js=1e-4,Ms=20;function Ns(e){return e.replace(/^\s+|\s+$/g,``)}var Ps=Math.min,Fs=Math.max,Is=Math.abs,Ls=Math.round,Rs=Math.floor,zs=Math.ceil,Bs=Math.pow,Vs=Math.log,Hs=Math.LN10,Us=Math.PI,Ws=Math.random;function Gs(e,t,n,r){var i=t[0],a=t[1],o=n[0],s=n[1],c=a-i,l=s-o;if(c===0)return l===0?o:(o+s)/2;if(r){if(c>0){if(e<=i)return o;if(e>=a)return s}else if(e>=i)return o;else if(e<=a)return s}else{if(e===i)return o;if(e===a)return s}return(e-i)/c*l+o}var Ks=qs;function qs(e,t,n){switch(e){case`center`:case`middle`:e=`50%`;break;case`left`:case`top`:e=`0%`;break;case`right`:case`bottom`:e=`100%`}return Js(e,t,n)}function Js(e,t,n){return J(e)?Ys(e)?parseFloat(e)/100*t+(n||0):parseFloat(e):e==null?NaN:+e}function Ys(e){return!!Ns(e).match(/%$/)}function Xs(e,t,n){return isNaN(t)?n?``+e:+e:(t=Ps(Fs(0,t),Ms),e=(+e).toFixed(t),n?e:+e)}function Zs(e){return e.sort(function(e,t){return e-t}),e}function Qs(e){if(e=+e,isNaN(e))return 0;if(e>1e-14){for(var t=1,n=0;n<15;n++,t*=10)if(Ls(e*t)/t===e)return n}return $s(e)}function $s(e){var t=e.toString().toLowerCase(),n=t.indexOf(`e`),r=n>0?+t.slice(n+1):0,i=n>0?n:t.length,a=t.indexOf(`.`);return Fs(0,(a<0?0:i-1-a)-r)}function ec(e,t,n){var r=Is(e[1]-e[0]);if(!isFinite(r)||r===0)return NaN;var i=Vs(2*Is(n||1)*Is(r))/Hs,a=Vs(Is(t))/Hs,o=Fs(0,zs(-i+a));return isFinite(o)||(o=NaN),o}function tc(e,t){var n=Fs(Qs(e),Qs(t)),r=e+t;return n>Ms?r:Xs(r,n)}var nc=Bs(2,53)-1;function rc(e){var t=Us*2;return(e%t+t)%t}function ic(e){return e>-js&&e=10&&t++,t}function lc(e,t){var n=cc(e),r=Bs(10,n),i=e/r;return e=(t===2?1:t?i<1.5?1:i<2.5?2:i<4?3:i<7?5:10:i<1?1:i<2?2:i<3?3:i<5?5:10)*r,Xs(e,-n)}function uc(e){e.sort(function(e,t){return s(e,t,0)?-1:1});for(var t=-1/0,n=1,r=0;r0?e.length:0),this.item=null,this.key=NaN,this},e.prototype.next=function(){return(this._step>0?this._idx=this._end)&&(this.item=this._list[this._idx],this.key=this._idx+=this._step,!0)},e})();function ol(){return[1/0,-1/0]}function sl(e,t){dl(t)&&(te[1]&&(e[1]=t))}function cl(e,t){dl(t)&&te[1]&&(e[1]=t)}function ul(e,t){fl(t[0],t[1])&&(t[0]e[1]&&(e[1]=t[1]))}function dl(e){return e!=null&&isFinite(e)}function fl(e,t){return dl(e)&&dl(t)&&e<=t}function pl(e){var t=e[1]-e[0];return isFinite(t)&&t>=0}function ml(e){fl(e[0],e[1])&&e[0]>e[1]&&(e[0]=e[1])}function hl(){var e=`__ec_once_`+gl++;return function(t,n){Z(t,e)||(t[e]=1,n())}}var gl=pc();function _l(e,t,n){var r=X(),i=0;W(e,function(a){var o=t(a),s=r.get(o)||0;n&&n(a,s),!s&&!n&&(e[i++]=a),r.set(o,s+1)}),n||(e.length=i)}function vl(e){return e.value+``}function yl(e){return e+``}function bl(e,t){return Y(t,!0)?e.seriesIndex+2:0}function xl(e,t,n){var r=e.getData().count();return{progressiveRender:n.progressiveEnabled&&t.incrementalPrepareRender&&r>=n.threshold,large:e.get(`large`)&&r>=e.get(`largeThreshold`),modDataCount:e.get(`progressiveChunkMode`)===`mod`?e.getData().count():null}}function Sl(e){return{overallReset:e}}var Cl=`.`,wl=`___EC__COMPONENT__CONTAINER___`,Tl=`___EC__EXTENDED_CLASS___`;function El(e){var t={main:``,sub:``};if(e){var n=e.split(Cl);t.main=n[0]||``,t.sub=n[1]||``}return t}function Dl(e){ms(/^[a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)?$/.test(e),`componentType "`+e+`" illegal`)}function Ol(e){return!!(e&&e[Tl])}function kl(e,t){e.$constructor=e,e.extend=function(e){var t=this,n;return Al(t)?n=function(e){H(t,e);function t(){return e.apply(this,arguments)||this}return t}(t):(n=function(){(e.$constructor||t).apply(this,arguments)},Go(n,this)),U(n.prototype,e),n[Tl]=!0,n.extend=this.extend,n.superCall=Pl,n.superApply=Fl,n.superClass=t,n}}function Al(e){return es(e)&&/^class\s/.test(Function.prototype.toString.call(e))}function jl(e,t){e.extend=t.extend}var Ml=Math.round(Math.random()*10);function Nl(e){var t=[`__\0is_clz`,Ml++].join(`_`);e.prototype[t]=!0,e.isInstance=function(e){return!!(e&&e[t])}}function Pl(e,t){var n=[...arguments].slice(2);return this.superClass.prototype[t].apply(e,n)}function Fl(e,t,n){return this.superClass.prototype[t].apply(e,n)}function Il(e){var t={};e.registerClass=function(e){var r=e.type||e.prototype.type;if(r){Dl(r),e.prototype.type=r;var i=El(r);if(!i.sub)t[i.main]=e;else if(i.sub!==wl){var a=n(i);a[i.sub]=e}}return e},e.getClass=function(e,n,r){var i=t[e];if(i&&i[wl]&&(i=n?i[n]:null),r&&!i)throw Error(n?`Component `+e+`.`+(n||``)+` is used but not imported.`:e+`.type should be specified.`);return i},e.getClassesByMainType=function(e){var n=El(e),r=[],i=t[n.main];return i&&i[wl]?W(i,function(e,t){t!==wl&&r.push(e)}):r.push(i),r},e.hasClass=function(e){return!!t[El(e).main]},e.getAllClassMainTypes=function(){var e=[];return W(t,function(t,n){e.push(n)}),e},e.hasSubTypes=function(e){var n=t[El(e).main];return n&&n[wl]};function n(e){var n=t[e.main];return(!n||!n[wl])&&(n=t[e.main]={},n[wl]=!0),n}}function Ll(e,t){for(var n=0;n=0||i&&Wo(i,s)<0)){var c=n.getShallow(s,t);c!=null&&(a[e[o][0]]=c)}}return a}}var Rl=Ll([[`fill`,`color`],[`shadowBlur`],[`shadowOffsetX`],[`shadowOffsetY`],[`opacity`],[`shadowColor`]]),zl=function(){function e(){}return e.prototype.getAreaStyle=function(e,t){return Rl(this,e,t)},e}(),Bl=function(){function e(e){this.value=e}return e}(),Vl=function(){function e(){this._len=0}return e.prototype.insert=function(e){var t=new Bl(e);return this.insertEntry(t),t},e.prototype.insertEntry=function(e){this.head?(this.tail.next=e,e.prev=this.tail,e.next=null,this.tail=e):this.head=this.tail=e,this._len++},e.prototype.remove=function(e){var t=e.prev,n=e.next;t?t.next=n:this.head=n,n?n.prev=t:this.tail=t,e.next=e.prev=null,this._len--},e.prototype.len=function(){return this._len},e.prototype.clear=function(){this.head=this.tail=null,this._len=0},e}(),Hl=function(){function e(e){this._list=new Vl,this._maxSize=10,this._map={},this._maxSize=e}return e.prototype.put=function(e,t){var n=this._list,r=this._map,i=null;if(r[e]==null){var a=n.len(),o=this._lastRemovedEntry;if(a>=this._maxSize&&a>0){var s=n.head;n.remove(s),delete r[s.key],i=s.value,this._lastRemovedEntry=s}o?o.value=t:o=new Bl(t),o.key=e,n.insertEntry(o),r[e]=o}return i},e.prototype.get=function(e){var t=this._map[e],n=this._list;if(t!=null)return t!==n.tail&&(n.remove(t),n.insertEntry(t)),t.value},e.prototype.clear=function(){this._list.clear(),this._map={}},e.prototype.len=function(){return this._list.len()},e}(),Ul=new Hl(50);function Wl(e){if(typeof e==`string`){var t=Ul.get(e);return t&&t.image}return e}function Gl(e,t,n,r,i){if(!e)return t;if(typeof e==`string`){if(t&&t.__zrImageSrc===e||!n)return t;var a=Ul.get(e),o={hostEl:n,cb:r,cbPayload:i};return a?(t=a.image,!ql(t)&&a.pending.push(o)):(t=Co.loadImage(e,Kl,Kl),t.__zrImageSrc=e,Ul.put(e,t.__cachedImgObj={image:t,pending:[o]})),t}return e}function Kl(){var e=this.__cachedImgObj;this.onload=this.onerror=this.__cachedImgObj=null;for(var t=0;tu||d>f||p>m||h>g)return!1;var _=!(u=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height},e.prototype.contain=function(t,n){return e.contain(this,t,n)},e.prototype.clone=function(){return new e(this.x,this.y,this.width,this.height)},e.prototype.copy=function(e){Lu(this,e)},e.prototype.plain=function(){return{x:this.x,y:this.y,width:this.width,height:this.height}},e.prototype.isFinite=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)},e.prototype.isZero=function(){return this.width===0||this.height===0},e.create=function(t){return new e(t?t.x:0,t?t.y:0,t?t.width:0,t?t.height:0)},e.copy=function(e,t){return e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height,e},e.applyTransform=function(e,t,n){if(!n){e!==t&&Lu(e,t);return}if(n[1]<1e-5&&n[1]>-1e-5&&n[2]<1e-5&&n[2]>-1e-5){var r=n[0],i=n[3],a=n[4],o=n[5];e.x=t.x*r+a,e.y=t.y*i+o,e.width=t.width*r,e.height=t.height*i,e.width<0&&(e.x+=e.width,e.width=-e.width),e.height<0&&(e.y+=e.height,e.height=-e.height);return}Eu.x=Ou.x=t.x,Eu.y=ku.y=t.y,Du.x=ku.x=t.x+t.width,Du.y=Ou.y=t.y+t.height,Eu.transform(n),ku.transform(n),Du.transform(n),Ou.transform(n),e.x=xu(Eu.x,Du.x,Ou.x,ku.x),e.y=xu(Eu.y,Du.y,Ou.y,ku.y);var s=Su(Eu.x,Du.x,Ou.x,ku.x),c=Su(Eu.y,Du.y,Ou.y,ku.y);e.width=s-e.x,e.height=c-e.y},e.calculateTransform=function(e,t,n){var r=n.width/t.width,i=n.height/t.height;return e=Yl(e||[]),Ql(e,e,au(Uu,-t.x,-t.y)),eu(e,e,au(Uu,r,i)),Ql(e,e,au(Uu,n.x,n.y)),e},e}(),Fu=Pu.create,Iu=Pu.set,Lu=Pu.copy,Ru=Pu.calculateTransform,zu=Pu.applyTransform,Bu=Pu.contain,Vu=new Pu(0,0,0,0),Hu=new Pu(0,0,0,0),Uu=[];function Wu(e,t,n,r,i,a,o,s){var c=Cu(t-n),l=Cu(r-e),u=xu(c,l),d=wu[i],f=wu[1-i],p=Tu[i];t=l||!Au.bidirectional)&&(ju[d]=-l,ju[f]=0,Au.useDir&&Au.calcDirMTV())))}function Gu(){var e=0,t=new bu,n=new bu,r={minTv:new bu,maxTv:new bu,useDir:!1,dirMinTv:new bu,touchThreshold:0,bidirectional:!0,negativeSize:!1,reset:function(i,a){r.touchThreshold=0,i&&i.touchThreshold!=null&&(r.touchThreshold=Su(0,i.touchThreshold)),r.negativeSize=!1,a&&(r.minTv.set(1/0,1/0),r.maxTv.set(0,0),r.useDir=!1,i&&i.direction!=null&&(r.useDir=!0,r.dirMinTv.copy(r.minTv),n.copy(r.minTv),e=i.direction,r.bidirectional=i.bidirectional==null||!!i.bidirectional,r.bidirectional||t.set(Math.cos(e),Math.sin(e))))},calcDirMTV:function(){var a=r.minTv,o=r.dirMinTv,s=a.y*a.y+a.x*a.x,c=Math.sin(e),l=Math.cos(e),u=c*a.y+l*a.x;if(i(u)){i(a.x)&&i(a.y)&&o.set(0,0);return}if(n.x=s*l/u,n.y=s*c/u,i(n.x)&&i(n.y)){o.set(0,0);return}(r.bidirectional||t.dot(n)>0)&&n.len()=Xu)){e||=`12px sans-serif`;for(var t=[],n=+new Date,r=0;r<=127;r++)t[r]=Co.measureText(String.fromCharCode(r),e).width;var i=+new Date-n;return i>16?Yu=Xu:i>2&&Yu++,t}}var Yu=0,Xu=5;function Zu(e,t){return e.asciiWidthMapTried||=(e.asciiWidthMap=Ju(e.font),!0),0<=t&&t<=127?e.asciiWidthMap==null?e.asciiCharWidth:e.asciiWidthMap[t]:e.stWideCharWidth}function Qu(e,t){var n=e.strWidthCache,r=n.get(t);return r??(r=Co.measureText(t,e.font).width,n.put(t,r)),r}function $u(e,t,n,r){var i=Qu(Ku(t),e),a=rd(t);return new Pu(td(0,i,n),nd(0,a,r),i,a)}function ed(e,t,n,r){var i=((e||``)+``).split(` `);if(i.length===1)return $u(i[0],t,n,r);for(var a=new Pu(0,0,0,0),o=0;o=0?parseFloat(e)/100*t:parseFloat(e):e}function ad(e,t,n){var r=t.position||`inside`,i=t.distance==null?5:t.distance,a=n.height,o=n.width,s=a/2,c=n.x,l=n.y,u=`left`,d=`top`;if(r instanceof Array)c+=id(r[0],n.width),l+=id(r[1],n.height),u=null,d=null;else switch(r){case`left`:c-=i,l+=s,u=`right`,d=`middle`;break;case`right`:c+=i+o,l+=s,d=`middle`;break;case`top`:c+=o/2,l-=i,u=`center`,d=`bottom`;break;case`bottom`:c+=o/2,l+=a+i,u=`center`;break;case`inside`:c+=o/2,l+=s,u=`center`,d=`middle`;break;case`insideLeft`:c+=i,l+=s,d=`middle`;break;case`insideRight`:c+=o-i,l+=s,u=`right`,d=`middle`;break;case`insideTop`:c+=o/2,l+=i,u=`center`;break;case`insideBottom`:c+=o/2,l+=a-i,u=`center`,d=`bottom`;break;case`insideTopLeft`:c+=i,l+=i;break;case`insideTopRight`:c+=o-i,l+=i,u=`right`;break;case`insideBottomLeft`:c+=i,l+=a-i,d=`bottom`;break;case`insideBottomRight`:c+=o-i,l+=a-i,u=`right`,d=`bottom`}return e||={},e.x=c,e.y=l,e.align=u,e.verticalAlign=d,e}var od=/\{([a-zA-Z0-9_]+)\|([^}]*)\}/g;function sd(e,t,n,r,i,a){if(!n){e.text=``,e.isTruncated=!1;return}var o=(t+``).split(` `);a=cd(n,r,i,a);for(var s=!1,c={},l=0,u=o.length;l=s;l++)c-=s;var u=Qu(o,n);return u>c&&(n=``,u=0),c=e-u,i.ellipsis=n,i.ellipsisWidth=u,i.contentWidth=c,i.containerWidth=e,i}function ld(e,t,n){var r=n.containerWidth,i=n.contentWidth,a=n.fontMeasureInfo;if(!r){e.textLine=``,e.isTruncated=!1;return}var o=Qu(a,t);if(o<=r){e.textLine=t,e.isTruncated=!1;return}for(var s=0;;s++){if(o<=i||s>=n.maxIterations){t+=n.ellipsis;break}var c=s===0?ud(t,i,a):o>0?Math.floor(t.length*i/o):0;t=t.substr(0,c),o=Qu(a,t)}t===``&&(t=n.placeholder),e.textLine=t,e.isTruncated=!0}function ud(e,t,n){for(var r=0,i=0,a=e.length;i{E6(e)}):E6(e)}function E6(e){if(e)try{e.body&&O6(e.body,`react-draggable-transparent-selection`);let t=e.selection;if(t)t.empty();else{let t=(e.defaultView||window).getSelection();t&&t.type!==`Caret`&&t.removeAllRanges()}}catch{}}function D6(e,t){e.classList?e.classList.add(t):e.className.match(RegExp(`(?:^|\\s)${t}(?!\\S)`))||(e.className+=` ${t}`)}function O6(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(RegExp(`(?:^|\\s)${t}(?!\\S)`,`g`),``)}function k6(e,t,n){if(!e.props.bounds)return[t,n];let{bounds:r}=e.props;r=typeof r==`string`?r:I6(r);let i=L6(e);if(typeof r==`string`){let{ownerDocument:e}=i,t=e.defaultView;if(!t)throw Error(`Cannot resolve the owner window of the draggable node.`);let n;if(n=r===`parent`?i.parentNode:i.getRootNode().querySelector(r),!(n instanceof t.HTMLElement))throw Error(`Bounds selector "`+r+`" could not find an element.`);let a=n,o=t.getComputedStyle(i),s=t.getComputedStyle(a);r={left:-i.offsetLeft+t6(s.paddingLeft)+t6(o.marginLeft),top:-i.offsetTop+t6(s.paddingTop)+t6(o.marginTop),right:g6(a)-m6(i)-i.offsetLeft+t6(s.paddingRight)-t6(o.marginRight),bottom:h6(a)-p6(i)-i.offsetTop+t6(s.paddingBottom)-t6(o.marginBottom)}}return e6(r.right)&&(t=Math.min(t,r.right)),e6(r.bottom)&&(n=Math.min(n,r.bottom)),e6(r.left)&&(t=Math.max(t,r.left)),e6(r.top)&&(n=Math.max(n,r.top)),[t,n]}function A6(e,t,n){return[Math.round(t/e[0])*e[0],Math.round(n/e[1])*e[1]]}function j6(e){return e.props.axis===`both`||e.props.axis===`x`}function M6(e){return e.props.axis===`both`||e.props.axis===`y`}function N6(e,t,n){let r=typeof t==`number`?x6(e,t):null;if(typeof t==`number`&&!r)return null;let i=L6(n),a=n.props.offsetParent||i.offsetParent||i.ownerDocument.body;return _6(r||e,a,n.props.scale)}function P6(e,t,n){let r=!e6(e.lastX),i=L6(e);return r?{node:i,deltaX:0,deltaY:0,lastX:t,lastY:n,x:t,y:n}:{node:i,deltaX:t-e.lastX,deltaY:n-e.lastY,lastX:e.lastX,lastY:e.lastY,x:t,y:n}}function F6(e,t){let n=e.props.scale;return{node:t.node,x:e.state.x+t.deltaX/n,y:e.state.y+t.deltaY/n,deltaX:t.deltaX/n,deltaY:t.deltaY/n,lastX:e.state.x,lastY:e.state.y}}function I6(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function L6(e){let t=e.findDOMNode();if(!t)throw Error(`: Unmounted during event!`);return t}var R6=typeof process<`u`&&{}.DRAGGABLE_DEBUG?console.log.bind(console):function(){},z6={touch:{start:`touchstart`,move:`touchmove`,stop:`touchend`},mouse:{start:`mousedown`,move:`mousemove`,stop:`mouseup`}},B6=z6.mouse,V6=class extends B.Component{constructor(){super(...arguments),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,this.touchIdentifier=null,this.mounted=!1,this.handleDragStart=e=>{if(this.props.onMouseDown(e),!this.props.allowAnyClick&&(typeof e.button==`number`&&e.button!==0||e.ctrlKey))return!1;let t=this.findDOMNode();if(!t||!t.ownerDocument||!t.ownerDocument.body)throw Error(` not mounted on DragStart!`);let{ownerDocument:n}=t;if(this.props.disabled||!(e.target instanceof n.defaultView.Node)||this.props.handle&&!u6(e.target,this.props.handle,t)||this.props.cancel&&u6(e.target,this.props.cancel,t))return;e.type===`touchstart`&&!this.props.allowMobileScroll&&e.preventDefault();let r=S6(e);this.touchIdentifier=r;let i=N6(e,r,this);if(i==null)return;let{x:a,y:o}=i,s=P6(this,a,o);R6(`DraggableCore: handleDragStart: %j`,s),R6(`calling`,this.props.onStart),this.props.onStart(e,s)!==!1&&this.mounted!==!1&&(this.props.enableUserSelectHack&&w6(n,this.props.nonce),this.dragging=!0,this.lastX=a,this.lastY=o,d6(n,B6.move,this.handleDrag),d6(n,B6.stop,this.handleDragStop))},this.handleDrag=e=>{let t=N6(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX,t=r-this.lastY;if([e,t]=A6(this.props.grid,e,t),!e&&!t)return;n=this.lastX+e,r=this.lastY+t}let i=P6(this,n,r);if(R6(`DraggableCore: handleDrag: %j`,i),this.props.onDrag(e,i)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent(`mouseup`))}catch{let e=document.createEvent(`MouseEvents`);e.initMouseEvent(`mouseup`,!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(e)}return}this.lastX=n,this.lastY=r},this.handleDragStop=e=>{if(!this.dragging)return;let t=N6(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX||0,t=r-this.lastY||0;[e,t]=A6(this.props.grid,e,t),n=this.lastX+e,r=this.lastY+t}let i=P6(this,n,r);if(this.props.onStop(e,i)===!1||this.mounted===!1)return!1;let a=this.findDOMNode();a&&this.props.enableUserSelectHack&&T6(a.ownerDocument),R6(`DraggableCore: handleDragStop: %j`,i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,a&&(R6(`DraggableCore: Removing handlers`),f6(a.ownerDocument,B6.move,this.handleDrag),f6(a.ownerDocument,B6.stop,this.handleDragStop))},this.onMouseDown=e=>(B6=z6.mouse,this.handleDragStart(e)),this.onMouseUp=e=>(B6=z6.mouse,this.handleDragStop(e)),this.onTouchStart=e=>(B6=z6.touch,this.handleDragStart(e)),this.onTouchEnd=e=>(B6=z6.touch,this.handleDragStop(e))}componentDidMount(){this.mounted=!0;let e=this.findDOMNode();e&&d6(e,z6.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;let e=this.findDOMNode();if(e){let{ownerDocument:t}=e;f6(t,z6.mouse.move,this.handleDrag),f6(t,z6.touch.move,this.handleDrag),f6(t,z6.mouse.stop,this.handleDragStop),f6(t,z6.touch.stop,this.handleDragStop),f6(e,z6.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&T6(t)}}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=qi.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):(R6(`react-draggable: ReactDOM.findDOMNode is not available in React 19+. You must provide a nodeRef prop. See: https://github.com/react-grid-layout/react-draggable#noderef`),null)}render(){return B.cloneElement(B.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};V6.displayName=`DraggableCore`,V6.propTypes={allowAnyClick:Z3.default.bool,allowMobileScroll:Z3.default.bool,children:Z3.default.node.isRequired,disabled:Z3.default.bool,enableUserSelectHack:Z3.default.bool,offsetParent:function(e,t){if(e[t]&&e[t].nodeType!==1)throw Error(`Draggable's offsetParent must be a DOM Node.`)},grid:Z3.default.arrayOf(Z3.default.number),handle:Z3.default.string,cancel:Z3.default.string,nodeRef:Z3.default.object,nonce:Z3.default.string,onStart:Z3.default.func,onDrag:Z3.default.func,onStop:Z3.default.func,onMouseDown:Z3.default.func,scale:Z3.default.number,className:n6,style:n6,transform:n6},V6.defaultProps={allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1};var H6=class extends B.Component{constructor(e){super(e),this.onDragStart=(e,t)=>{if(R6(`Draggable: onDragStart: %j`,t),this.props.onStart(e,F6(this,t))===!1)return!1;this.setState({dragging:!0,dragged:!0})},this.onDrag=(e,t)=>{if(!this.state.dragging)return!1;R6(`Draggable: onDrag: %j`,t);let n=F6(this,t),r={x:n.x,y:n.y,slackX:0,slackY:0};if(this.props.bounds){let{x:e,y:t}=r;r.x+=this.state.slackX,r.y+=this.state.slackY;let[i,a]=k6(this,r.x,r.y);r.x=i,r.y=a,r.slackX=this.state.slackX+(e-r.x),r.slackY=this.state.slackY+(t-r.y),n.x=r.x,n.y=r.y,n.deltaX=r.x-this.state.x,n.deltaY=r.y-this.state.y}if(this.props.onDrag(e,n)===!1)return!1;this.setState(r)},this.onDragStop=(e,t)=>{if(!this.state.dragging||this.props.onStop(e,F6(this,t))===!1)return!1;R6(`Draggable: onDragStop: %j`,t);let n={dragging:!1,slackX:0,slackY:0};if(this.props.position){let{x:e,y:t}=this.props.position;n.x=e,n.y=t}this.setState(n)},this.state={dragging:!1,dragged:!1,x:e.position?e.position.x:e.defaultPosition.x,y:e.position?e.position.y:e.defaultPosition.y,prevPropsPosition:{...e.position},slackX:0,slackY:0,isElementSVG:!1},e.position&&!(e.onDrag||e.onStop)&&console.warn("A `position` was applied to this , without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}static getDerivedStateFromProps({position:e},{prevPropsPosition:t}){return e&&(!t||e.x!==t.x||e.y!==t.y)?(R6(`Draggable: getDerivedStateFromProps %j`,{position:e,prevPropsPosition:t}),{x:e.x,y:e.y,prevPropsPosition:{...e}}):null}componentDidMount(){window.SVGElement!==void 0&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.state.dragging&&this.setState({dragging:!1})}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=qi.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):null}render(){let{axis:e,bounds:t,children:n,defaultPosition:r,defaultClassName:i,defaultClassNameDragging:a,defaultClassNameDragged:o,position:s,positionOffset:c,scale:l,...u}=this.props,d={},f=null,p=!s||this.state.dragging,m=s||r,h={x:j6(this)&&p?this.state.x:m.x,y:M6(this)&&p?this.state.y:m.y};this.state.isElementSVG?f=y6(h,c):d=v6(h,c);let g=B.Children.only(n),v=_(g.props.className||``,i,{[a]:this.state.dragging,[o]:this.state.dragged});return B.createElement(V6,{...u,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop},B.cloneElement(g,{className:v,style:{...g.props.style,...d},transform:f}))}};H6.displayName=`Draggable`,H6.propTypes={...V6.propTypes,axis:Z3.default.oneOf([`both`,`x`,`y`,`none`]),bounds:Z3.default.oneOfType([Z3.default.shape({left:Z3.default.number,right:Z3.default.number,top:Z3.default.number,bottom:Z3.default.number}),Z3.default.string,Z3.default.oneOf([!1])]),defaultClassName:Z3.default.string,defaultClassNameDragging:Z3.default.string,defaultClassNameDragged:Z3.default.string,defaultPosition:Z3.default.shape({x:Z3.default.number,y:Z3.default.number}),positionOffset:Z3.default.shape({x:Z3.default.oneOfType([Z3.default.number,Z3.default.string]),y:Z3.default.oneOfType([Z3.default.number,Z3.default.string])}),position:Z3.default.shape({x:Z3.default.number,y:Z3.default.number}),className:n6,style:n6,transform:n6},H6.defaultProps={...V6.defaultProps,axis:`both`,bounds:!1,defaultClassName:`react-draggable`,defaultClassNameDragging:`react-draggable-dragging`,defaultClassNameDragged:`react-draggable-dragged`,defaultPosition:{x:0,y:0},scale:1};var U6=e(((e,t)=>{function n(e){var t,r,i=``;if(typeof e==`string`||typeof e==`number`)i+=e;else if(typeof e==`object`){if(Array.isArray(e)){var a=e.length;for(t=0;t{var r=Object.create,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,l=(e,t)=>{for(var n in t)i(e,n,{get:t[n],enumerable:!0})},u=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let s of o(t))!c.call(e,s)&&s!==n&&i(e,s,{get:()=>t[s],enumerable:!(r=a(t,s))||r.enumerable});return e},d=(e,t,n)=>(n=e==null?{}:r(s(e)),u(t||!e||!e.__esModule?i(n,`default`,{value:e,enumerable:!0}):n,e)),f=e=>u(i({},`__esModule`,{value:!0}),e),p={};l(p,{DraggableCore:()=>Te,default:()=>Ee}),n.exports=f(p);var m=d(t()),h=d(X3()),g=d(b()),_=U6();function v(e,t){for(let n=0,r=e.length;n`u`)return``;let t=window.document?.documentElement?.style;if(!t||e in t)return``;for(let n=0;nt===e.identifier)||e.changedTouches&&v(e.changedTouches,e=>t===e.identifier)}function ae(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function R(){return typeof __webpack_nonce__<`u`?__webpack_nonce__:void 0}function oe(e,t){if(!e)return;let n=e.getElementById(`react-draggable-style-el`);if(!n){n=e.createElement(`style`),n.type=`text/css`,n.id=`react-draggable-style-el`;let r=t??R();r&&n.setAttribute(`nonce`,r),n.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;} `,n.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;} -`,e.getElementsByTagName(`head`)[0].appendChild(n)}e.body&&ce(e.body,`react-draggable-transparent-selection`)}function z(e){window.requestAnimationFrame?window.requestAnimationFrame(()=>{se(e)}):se(e)}function se(e){if(e)try{e.body&&le(e.body,`react-draggable-transparent-selection`);let t=e.selection;if(t)t.empty();else{let t=(e.defaultView||window).getSelection();t&&t.type!==`Caret`&&t.removeAllRanges()}}catch{}}function ce(e,t){e.classList?e.classList.add(t):e.className.match(RegExp(`(?:^|\\s)${t}(?!\\S)`))||(e.className+=` ${t}`)}function le(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(RegExp(`(?:^|\\s)${t}(?!\\S)`,`g`),``)}function ue(e,t,n){if(!e.props.bounds)return[t,n];let{bounds:r}=e.props;r=typeof r==`string`?r:_e(r);let i=ve(e);if(typeof r==`string`){let{ownerDocument:e}=i,t=e.defaultView;if(!t)throw Error(`Cannot resolve the owner window of the draggable node.`);let n;if(n=r===`parent`?i.parentNode:i.getRootNode().querySelector(r),!(n instanceof t.HTMLElement))throw Error(`Bounds selector "`+r+`" could not find an element.`);let a=n,o=t.getComputedStyle(i),s=t.getComputedStyle(a);r={left:-i.offsetLeft+S(s.paddingLeft)+S(o.marginLeft),top:-i.offsetTop+S(s.paddingTop)+S(o.marginTop),right:L(a)-F(i)-i.offsetLeft+S(s.paddingRight)-S(o.marginRight),bottom:I(a)-P(i)-i.offsetTop+S(s.paddingBottom)-S(o.marginBottom)}}return x(r.right)&&(t=Math.min(t,r.right)),x(r.bottom)&&(n=Math.min(n,r.bottom)),x(r.left)&&(t=Math.max(t,r.left)),x(r.top)&&(n=Math.max(n,r.top)),[t,n]}function de(e,t,n){return[Math.round(t/e[0])*e[0],Math.round(n/e[1])*e[1]]}function fe(e){return e.props.axis===`both`||e.props.axis===`x`}function pe(e){return e.props.axis===`both`||e.props.axis===`y`}function me(e,t,n){let r=typeof t==`number`?ie(e,t):null;if(typeof t==`number`&&!r)return null;let i=ve(n),a=n.props.offsetParent||i.offsetParent||i.ownerDocument.body;return ee(r||e,a,n.props.scale)}function he(e,t,n){let r=!x(e.lastX),i=ve(e);return r?{node:i,deltaX:0,deltaY:0,lastX:t,lastY:n,x:t,y:n}:{node:i,deltaX:t-e.lastX,deltaY:n-e.lastY,lastX:e.lastX,lastY:e.lastY,x:t,y:n}}function ge(e,t){let n=e.props.scale;return{node:t.node,x:e.state.x+t.deltaX/n,y:e.state.y+t.deltaY/n,deltaX:t.deltaX/n,deltaY:t.deltaY/n,lastX:e.state.x,lastY:e.state.y}}function _e(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function ve(e){let t=e.findDOMNode();if(!t)throw Error(`: Unmounted during event!`);return t}var ye=d(t()),be=d(X3()),xe=d(b()),Se=typeof process<`u`&&{}.DRAGGABLE_DEBUG?console.log.bind(console):function(){},Ce={touch:{start:`touchstart`,move:`touchmove`,stop:`touchend`},mouse:{start:`mousedown`,move:`mousemove`,stop:`mouseup`}},we=Ce.mouse,Te=class extends ye.Component{constructor(){super(...arguments),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,this.touchIdentifier=null,this.mounted=!1,this.handleDragStart=e=>{if(this.props.onMouseDown(e),!this.props.allowAnyClick&&(typeof e.button==`number`&&e.button!==0||e.ctrlKey))return!1;let t=this.findDOMNode();if(!t||!t.ownerDocument||!t.ownerDocument.body)throw Error(` not mounted on DragStart!`);let{ownerDocument:n}=t;if(this.props.disabled||!(e.target instanceof n.defaultView.Node)||this.props.handle&&!j(e.target,this.props.handle,t)||this.props.cancel&&j(e.target,this.props.cancel,t))return;e.type===`touchstart`&&!this.props.allowMobileScroll&&e.preventDefault();let r=ae(e);this.touchIdentifier=r;let i=me(e,r,this);if(i==null)return;let{x:a,y:o}=i,s=he(this,a,o);Se(`DraggableCore: handleDragStart: %j`,s),Se(`calling`,this.props.onStart),this.props.onStart(e,s)!==!1&&this.mounted!==!1&&(this.props.enableUserSelectHack&&oe(n,this.props.nonce),this.dragging=!0,this.lastX=a,this.lastY=o,M(n,we.move,this.handleDrag),M(n,we.stop,this.handleDragStop))},this.handleDrag=e=>{let t=me(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX,t=r-this.lastY;if([e,t]=de(this.props.grid,e,t),!e&&!t)return;n=this.lastX+e,r=this.lastY+t}let i=he(this,n,r);if(Se(`DraggableCore: handleDrag: %j`,i),this.props.onDrag(e,i)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent(`mouseup`))}catch{let e=document.createEvent(`MouseEvents`);e.initMouseEvent(`mouseup`,!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(e)}return}this.lastX=n,this.lastY=r},this.handleDragStop=e=>{if(!this.dragging)return;let t=me(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX||0,t=r-this.lastY||0;[e,t]=de(this.props.grid,e,t),n=this.lastX+e,r=this.lastY+t}let i=he(this,n,r);if(this.props.onStop(e,i)===!1||this.mounted===!1)return!1;let a=this.findDOMNode();a&&this.props.enableUserSelectHack&&z(a.ownerDocument),Se(`DraggableCore: handleDragStop: %j`,i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,a&&(Se(`DraggableCore: Removing handlers`),N(a.ownerDocument,we.move,this.handleDrag),N(a.ownerDocument,we.stop,this.handleDragStop))},this.onMouseDown=e=>(we=Ce.mouse,this.handleDragStart(e)),this.onMouseUp=e=>(we=Ce.mouse,this.handleDragStop(e)),this.onTouchStart=e=>(we=Ce.touch,this.handleDragStart(e)),this.onTouchEnd=e=>(we=Ce.touch,this.handleDragStop(e))}componentDidMount(){this.mounted=!0;let e=this.findDOMNode();e&&M(e,Ce.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;let e=this.findDOMNode();if(e){let{ownerDocument:t}=e;N(t,Ce.mouse.move,this.handleDrag),N(t,Ce.touch.move,this.handleDrag),N(t,Ce.mouse.stop,this.handleDragStop),N(t,Ce.touch.stop,this.handleDragStop),N(e,Ce.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&z(t)}}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=xe.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):(Se(`react-draggable: ReactDOM.findDOMNode is not available in React 19+. You must provide a nodeRef prop. See: https://github.com/react-grid-layout/react-draggable#noderef`),null)}render(){return ye.cloneElement(ye.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};Te.displayName=`DraggableCore`,Te.propTypes={allowAnyClick:be.default.bool,allowMobileScroll:be.default.bool,children:be.default.node.isRequired,disabled:be.default.bool,enableUserSelectHack:be.default.bool,offsetParent:function(e,t){if(e[t]&&e[t].nodeType!==1)throw Error(`Draggable's offsetParent must be a DOM Node.`)},grid:be.default.arrayOf(be.default.number),handle:be.default.string,cancel:be.default.string,nodeRef:be.default.object,nonce:be.default.string,onStart:be.default.func,onDrag:be.default.func,onStop:be.default.func,onMouseDown:be.default.func,scale:be.default.number,className:C,style:C,transform:C},Te.defaultProps={allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1};var Ee=class extends m.Component{constructor(e){super(e),this.onDragStart=(e,t)=>{if(Se(`Draggable: onDragStart: %j`,t),this.props.onStart(e,ge(this,t))===!1)return!1;this.setState({dragging:!0,dragged:!0})},this.onDrag=(e,t)=>{if(!this.state.dragging)return!1;Se(`Draggable: onDrag: %j`,t);let n=ge(this,t),r={x:n.x,y:n.y,slackX:0,slackY:0};if(this.props.bounds){let{x:e,y:t}=r;r.x+=this.state.slackX,r.y+=this.state.slackY;let[i,a]=ue(this,r.x,r.y);r.x=i,r.y=a,r.slackX=this.state.slackX+(e-r.x),r.slackY=this.state.slackY+(t-r.y),n.x=r.x,n.y=r.y,n.deltaX=r.x-this.state.x,n.deltaY=r.y-this.state.y}if(this.props.onDrag(e,n)===!1)return!1;this.setState(r)},this.onDragStop=(e,t)=>{if(!this.state.dragging||this.props.onStop(e,ge(this,t))===!1)return!1;Se(`Draggable: onDragStop: %j`,t);let n={dragging:!1,slackX:0,slackY:0};if(this.props.position){let{x:e,y:t}=this.props.position;n.x=e,n.y=t}this.setState(n)},this.state={dragging:!1,dragged:!1,x:e.position?e.position.x:e.defaultPosition.x,y:e.position?e.position.y:e.defaultPosition.y,prevPropsPosition:{...e.position},slackX:0,slackY:0,isElementSVG:!1},e.position&&!(e.onDrag||e.onStop)&&console.warn("A `position` was applied to this , without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}static getDerivedStateFromProps({position:e},{prevPropsPosition:t}){return e&&(!t||e.x!==t.x||e.y!==t.y)?(Se(`Draggable: getDerivedStateFromProps %j`,{position:e,prevPropsPosition:t}),{x:e.x,y:e.y,prevPropsPosition:{...e}}):null}componentDidMount(){window.SVGElement!==void 0&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.state.dragging&&this.setState({dragging:!1})}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=g.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):null}render(){let{axis:e,bounds:t,children:n,defaultPosition:r,defaultClassName:i,defaultClassNameDragging:a,defaultClassNameDragged:o,position:s,positionOffset:c,scale:l,...u}=this.props,d={},f=null,p=!s||this.state.dragging,h=s||r,g={x:fe(this)&&p?this.state.x:h.x,y:pe(this)&&p?this.state.y:h.y};this.state.isElementSVG?f=ne(g,c):d=te(g,c);let v=m.Children.only(n),y=(0,_.clsx)(v.props.className||``,i,{[a]:this.state.dragging,[o]:this.state.dragged});return m.createElement(Te,{...u,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop},m.cloneElement(v,{className:y,style:{...v.props.style,...d},transform:f}))}};Ee.displayName=`Draggable`,Ee.propTypes={...Te.propTypes,axis:h.default.oneOf([`both`,`x`,`y`,`none`]),bounds:h.default.oneOfType([h.default.shape({left:h.default.number,right:h.default.number,top:h.default.number,bottom:h.default.number}),h.default.string,h.default.oneOf([!1])]),defaultClassName:h.default.string,defaultClassNameDragging:h.default.string,defaultClassNameDragged:h.default.string,defaultPosition:h.default.shape({x:h.default.number,y:h.default.number}),positionOffset:h.default.shape({x:h.default.oneOfType([h.default.number,h.default.string]),y:h.default.oneOfType([h.default.number,h.default.string])}),position:h.default.shape({x:h.default.number,y:h.default.number}),className:C,style:C,transform:C},Ee.defaultProps={...Te.defaultProps,axis:`both`,bounds:!1,defaultClassName:`react-draggable`,defaultClassNameDragging:`react-draggable-dragging`,defaultClassNameDragged:`react-draggable-dragged`,defaultPosition:{x:0,y:0},scale:1},0&&(n.exports={DraggableCore:Te})})),G6=e(((e,t)=>{var n=W6(),r=n.DraggableCore,i=n.default||n;t.exports=i,t.exports.default=i,t.exports.DraggableCore=r})),K6=e((e=>{e.__esModule=!0,e.cloneElement=l;var n=r(t());function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function a(e){for(var t=1;t{e.__esModule=!0,e.resizableProps=void 0;var t=n(X3());G6();function n(e){return e&&e.__esModule?e:{default:e}}e.resizableProps={axis:t.default.oneOf([`both`,`x`,`y`,`none`]),className:t.default.string,children:t.default.element.isRequired,draggableOpts:t.default.shape({allowAnyClick:t.default.bool,cancel:t.default.string,children:t.default.node,disabled:t.default.bool,enableUserSelectHack:t.default.bool,offsetParent:typeof Element<`u`?t.default.instanceOf(Element):t.default.any,grid:t.default.arrayOf(t.default.number),handle:t.default.string,nodeRef:t.default.object,onStart:t.default.func,onDrag:t.default.func,onStop:t.default.func,onMouseDown:t.default.func,scale:t.default.number}),height:function(){var e=[...arguments];let n=e[0];return n.axis===`both`||n.axis===`y`?t.default.number.isRequired(...e):t.default.number(...e)},handle:t.default.oneOfType([t.default.node,t.default.func]),handleSize:t.default.arrayOf(t.default.number),lockAspectRatio:t.default.bool,maxConstraints:t.default.arrayOf(t.default.number),minConstraints:t.default.arrayOf(t.default.number),onResizeStop:t.default.func,onResizeStart:t.default.func,onResize:t.default.func,resizeHandles:t.default.arrayOf(t.default.oneOf([`s`,`w`,`e`,`n`,`sw`,`nw`,`se`,`ne`])),transformScale:t.default.number,width:function(){var e=[...arguments];let n=e[0];return n.axis===`both`||n.axis===`x`?t.default.number.isRequired(...e):t.default.number(...e)}}})),J6=e((e=>{e.__esModule=!0,e.default=void 0;var n=s(t()),r=G6(),i=K6(),a=q6(),o=[`children`,`className`,`draggableOpts`,`width`,`height`,`handle`,`handleSize`,`lockAspectRatio`,`axis`,`minConstraints`,`maxConstraints`,`onResize`,`onResizeStop`,`onResizeStart`,`resizeHandles`,`transformScale`];function s(e,t){if(typeof WeakMap==`function`)var n=new WeakMap,r=new WeakMap;return(s=function(e,t){if(!t&&e&&e.__esModule)return e;var i,a,o={__proto__:null,default:e};if(e===null||typeof e!=`object`&&typeof e!=`function`)return o;if(i=t?r:n){if(i.has(e))return i.get(e);i.set(e,o)}for(let t in e)t!=="default"&&{}.hasOwnProperty.call(e,t)&&((a=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(a.get||a.set)?i(o,t,a):o[t]=e[t]);return o})(e,t)}function c(){return c=Object.assign?Object.assign.bind():function(e){for(var t=1;tMath.abs(i*n)?t=e/n:e=t*n}let o=e,s=t,c=this.slack||[0,0],l=c[0],u=c[1];return e+=l,t+=u,r&&(e=Math.max(r[0],e),t=Math.max(r[1],t)),i&&(e=Math.min(i[0],e),t=Math.min(i[1],t)),this.slack=[l+(o-e),u+(s-t)],[e,t]}resizeHandler(e,t){return(n,r)=>{let i=r.node,a=r.deltaX,o=r.deltaY;e===`onResizeStart`&&this.resetData();let s=(this.props.axis===`both`||this.props.axis===`x`)&&t!==`n`&&t!==`s`,c=(this.props.axis===`both`||this.props.axis===`y`)&&t!==`e`&&t!==`w`;if(!s&&!c)return;let l=t[0],u=t[t.length-1],d=i.getBoundingClientRect();if(this.lastHandleRect!=null){if(u===`w`){let e=d.left-this.lastHandleRect.left;a+=e}if(l===`n`){let e=d.top-this.lastHandleRect.top;o+=e}}this.lastHandleRect=d,u===`w`&&(a=-a),l===`n`&&(o=-o);let f=this.lastSize?.width??this.props.width,p=this.lastSize?.height??this.props.height,m=f+(s?a/this.props.transformScale:0),h=p+(c?o/this.props.transformScale:0);var g=this.runConstraints(m,h);if(m=g[0],h=g[1],e===`onResizeStop`&&this.lastSize){var _=this.lastSize;m=_.width,h=_.height}let v=m!==f||h!==p;e!==`onResizeStop`&&(this.lastSize={width:m,height:h});let y=typeof this.props[e]==`function`?this.props[e]:null;y&&(e!==`onResize`||v)&&(n.persist==null||n.persist(),y(n,{node:i,size:{width:m,height:h},handle:t})),e===`onResizeStop`&&this.resetData()}}renderResizeHandle(e,t){let r=this.props.handle;if(!r)return n.createElement(`span`,{className:`react-resizable-handle react-resizable-handle-`+e,ref:t});if(typeof r==`function`)return r(e,t);let i=typeof r.type==`string`,a=d({ref:t},i?{}:{handleAxis:e});return n.cloneElement(r,a)}render(){let e=this.props,t=e.children,a=e.className,s=e.draggableOpts;e.width,e.height,e.handle,e.handleSize,e.lockAspectRatio,e.axis,e.minConstraints,e.maxConstraints,e.onResize,e.onResizeStop,e.onResizeStart;let u=e.resizeHandles;e.transformScale;let f=l(e,o);return(0,i.cloneElement)(t,d(d({},f),{},{className:(a?a+` `:``)+`react-resizable`,children:[...n.Children.toArray(t.props.children),...u.map(e=>{let t=this.handleRefs[e]??(this.handleRefs[e]=n.createRef());return n.createElement(r.DraggableCore,c({},s,{nodeRef:t,key:`resizableHandle-`+e,onStop:this.resizeHandler(`onResizeStop`,e),onStart:this.resizeHandler(`onResizeStart`,e),onDrag:this.resizeHandler(`onResize`,e)}),this.renderResizeHandle(e,t))})]}))}};e.default=h,h.propTypes=a.resizableProps,h.defaultProps={axis:`both`,handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:[`se`],transformScale:1}})),Y6=e((e=>{e.__esModule=!0,e.default=void 0;var n=c(t()),r=s(X3()),i=s(J6()),a=q6(),o=[`handle`,`handleSize`,`onResize`,`onResizeStart`,`onResizeStop`,`draggableOpts`,`minConstraints`,`maxConstraints`,`lockAspectRatio`,`axis`,`width`,`height`,`resizeHandles`,`style`,`transformScale`];function s(e){return e&&e.__esModule?e:{default:e}}function c(e,t){if(typeof WeakMap==`function`)var n=new WeakMap,r=new WeakMap;return(c=function(e,t){if(!t&&e&&e.__esModule)return e;var i,a,o={__proto__:null,default:e};if(e===null||typeof e!=`object`&&typeof e!=`function`)return o;if(i=t?r:n){if(i.has(e))return i.get(e);i.set(e,o)}for(let t in e)t!=="default"&&{}.hasOwnProperty.call(e,t)&&((a=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(a.get||a.set)?i(o,t,a):o[t]=e[t]);return o})(e,t)}function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let n=t.size;this.props.onResize?(e.persist==null||e.persist(),this.setState(n,()=>this.props.onResize&&this.props.onResize(e,t))):this.setState(n)}}static getDerivedStateFromProps(e,t){return t.propsWidth!==e.width||t.propsHeight!==e.height?{width:e.width,height:e.height,propsWidth:e.width,propsHeight:e.height}:null}render(){let e=this.props,t=e.handle,r=e.handleSize;e.onResize;let a=e.onResizeStart,s=e.onResizeStop,c=e.draggableOpts,u=e.minConstraints,f=e.maxConstraints,p=e.lockAspectRatio,m=e.axis;e.width,e.height;let g=e.resizeHandles,_=e.style,v=e.transformScale,y=h(e,o);return n.createElement(i.default,{axis:m,draggableOpts:c,handle:t,handleSize:r,height:this.state.height,lockAspectRatio:p,maxConstraints:f,minConstraints:u,onResizeStart:a,onResize:this.onResize,onResizeStop:s,resizeHandles:g,transformScale:v,width:this.state.width},n.createElement(`div`,l({},y,{style:d(d({},_),{},{width:this.state.width+`px`,height:this.state.height+`px`})})))}};e.default=g,g.propTypes=d(d({},a.resizableProps),{},{children:r.default.element})})),X6=e(((e,t)=>{t.exports=function(){throw Error(`Don't instantiate Resizable directly! Use require('react-resizable').Resizable`)},t.exports.Resizable=J6().default,t.exports.ResizableBox=Y6().default}))(),Z6=q3(),Q6=50,$6=12;function e8(e){let t=e;for(;t;){let e=window.getComputedStyle(t).overflowY;if((e===`auto`||e===`scroll`)&&t.scrollHeight>t.clientHeight)return t;t=t.parentElement}return null}function t8(e){let t=e8(e),n=null,r=0,i=0,a=!1;function o(){let e=t;if(!e)return;let s=e.getBoundingClientRect(),{clientHeight:c,scrollTop:l,scrollHeight:u}=e,{scrollLeft:d,scrollWidth:f,clientWidth:p}=e,m=0,h=0;i0?m=-$6:i>s.bottom-Q6&&l+c0?h=-$6:r>s.right-Q6&&d+p({cols:n,containerPadding:a,containerWidth:r,margin:i,maxRows:s,rowHeight:o}),[n,a,r,i,s,o]),be=(0,B.useMemo)(()=>({cols:n,maxRows:s,containerWidth:r,containerHeight:0,rowHeight:o,margin:i,layout:[]}),[n,s,r,o,i]),xe=(0,B.useCallback)(e=>({...be,containerHeight:e??be.containerHeight,layout:fe.current}),[be]),Se=(0,B.useMemo)(()=>I??{i:M,x:w,y:T,w:E,h:D,minW:O,maxW:k,minH:A,maxH:j},[I,M,w,T,E,D,O,k,A,j]),Ce=(0,B.useCallback)(e=>{if(g?.calcStyle)return g.calcStyle(e);if(p)return m3(e);let t=h3(e);return m?{...t,left:g3(e.left/r),width:g3(e.width/r)}:t},[g,p,m,r]),we=(0,B.useCallback)((e,{node:t})=>{if(!ee)return;let{offsetParent:n}=t;if(!n)return;let r=n.getBoundingClientRect(),i=t.getBoundingClientRect(),a=i.left/h,o=r.left/h,s=i.top/h,c=r.top/h,l;if(g?.calcDragPosition){let t=e;l=g.calcDragPosition(t.clientX,t.clientY,t.clientX-i.left,t.clientY-i.top)}else l={left:a-o+n.scrollLeft,top:s-c+n.scrollTop};if(le.current=l,ve.current||=t8(t instanceof HTMLElement?t:null),v>0){let t=e;ge.current={x:t.clientX,y:t.clientY},he.current=!0,_e.current=!1,oe(!0);return}oe(!0);let u=G4(ye,l.top,l.left),{x:d,y:f}=f3(F,Se,u.x,u.y,xe());ee(M,d,f,{e,node:t,newPosition:l})},[ee,h,ye,g,v,F,Se,xe,M]),Te=(0,B.useCallback)((e,{node:t,deltaX:n,deltaY:a})=>{if(!te||!R)return;let s=e;if(he.current&&!_e.current){let n=s.clientX-ge.current.x,r=s.clientY-ge.current.y;if(Math.hypot(n,r){if(!ne||!R)return;ve.current?.stop(),ve.current=null;let n=he.current;if(he.current=!1,_e.current=!1,ge.current={x:0,y:0},n){oe(!1),le.current={left:0,top:0};return}let{left:r,top:i}=le.current,a={top:i,left:r};oe(!1),le.current={left:0,top:0};let o=G4(ye,i,r),{x:s,y:c}=f3(F,Se,o.x,o.y,xe());ne(M,s,c,{e,node:t,newPosition:a})},[ne,R,ye,F,Se,xe,M]);pe.current=we,me.current=Te;let De=(0,B.useCallback)((e,{node:t,size:n,handle:i},a,o)=>{let s=o===`onResizeStart`?re:o===`onResize`?ie:ae;if(!s)return;let c;c=t?E3(i,a,n,r):{...n,top:a.top,left:a.left},ue.current=c;let l=t?.offsetParent?.clientHeight??0,u=K4(ye,c.width,c.height),{w:d,h:f}=p3(F,Se,u.w,u.h,i,xe(l));s(M,d,f,{e:e.nativeEvent??e,node:t,size:c,handle:i})},[re,ie,ae,r,ye,M,F,Se,xe]),Oe=(0,B.useCallback)((e,t)=>{se(!0);let n=U4(ye,w,T,E,D),r={...t,handle:t.handle};De(e,r,n,`onResizeStart`)},[De,ye,w,T,E,D]),ke=(0,B.useCallback)((e,t)=>{let n=U4(ye,w,T,E,D),r={...t,handle:t.handle};De(e,r,n,`onResize`)},[De,ye,w,T,E,D]),Ae=(0,B.useCallback)((e,t)=>{se(!1),ue.current={top:0,left:0,width:0,height:0};let n=U4(ye,w,T,E,D),r={...t,handle:t.handle};De(e,r,n,`onResizeStop`)},[De,ye,w,T,E,D]);(0,B.useEffect)(()=>{if(!y)return;let e=ce.current;if(!e)return;let t=de.current||{left:0,top:0},n=R&&(y.left!==t.left||y.top!==t.top);if(!R){let t={node:e,deltaX:y.left,deltaY:y.top,lastX:0,lastY:0,x:y.left,y:y.top};pe.current?.(y.e,t)}else if(n){let t={node:e,deltaX:y.left-le.current.left,deltaY:y.top-le.current.top,lastX:le.current.left,lastY:le.current.top,x:y.left,y:y.top};me.current?.(y.e,t)}de.current=y},[y,R,M]);let je=U4(ye,w,T,E,D,R?le.current:null,z?ue.current:null),Me=B.Children.only(t),Ne=V4(ye),Pe=[H4(O,Ne,i[0]),H4(A,o,i[1])],Fe=[H4(k,Ne,i[0]),H4(j,o,i[1])],Ie=Me.props,Le=Ie.className,Re=Ie.style,ze=B.cloneElement(Me,{ref:ce,className:_(`react-grid-item`,Le,b,{static:f,resizing:z,"react-draggable":c,"react-draggable-dragging":R,dropping:!!y,cssTransforms:p}),style:{...x,...Re,...Ce(je)}}),Be=P;return ze=(0,V.jsx)(X6.Resizable,{draggableOpts:{disabled:!l},className:l?void 0:`react-resizable-hide`,width:je.width,height:je.height,minConstraints:Pe,maxConstraints:Fe,onResizeStart:Oe,onResize:ke,onResizeStop:Ae,transformScale:h,resizeHandles:N,handle:Be,children:ze}),ze=(0,V.jsx)(V6,{disabled:!c,onStart:we,onDrag:Te,onStop:Ee,handle:S,cancel:`.react-resizable-handle`+(C?`,`+C:``),scale:h,allowMobileScroll:d,nodeRef:ce,children:ze}),ze}var r8=B.memo(n8,(e,t)=>e.x===t.x&&e.y===t.y&&e.w===t.w&&e.h===t.h&&e.minW===t.minW&&e.maxW===t.maxW&&e.minH===t.minH&&e.maxH===t.maxH&&e.cols===t.cols&&e.containerWidth===t.containerWidth&&e.rowHeight===t.rowHeight&&e.maxRows===t.maxRows&&e.margin===t.margin&&e.containerPadding===t.containerPadding&&e.transformScale===t.transformScale&&e.isDraggable===t.isDraggable&&e.isResizable===t.isResizable&&e.isBounded===t.isBounded&&e.allowMobileScroll===t.allowMobileScroll&&e.useCSSTransforms===t.useCSSTransforms&&e.usePercentages===t.usePercentages&&e.children===t.children&&e.onDrag===t.onDrag&&e.onDragStop===t.onDragStop&&e.onResize===t.onResize&&e.onResizeStop===t.onResizeStop&&e.droppingPosition===t.droppingPosition);r8.displayName=`GridItem`;function i8(e){let{clientX:t,clientY:n,gridElement:r,droppingItem:i,event:a,dragOffsetX:o=0,dragOffsetY:s=0,transformScale:c,cols:l,margin:u,maxRows:d,rowHeight:f,width:p,containerPadding:m}=e,h=r.getBoundingClientRect(),g={cols:l,margin:u,maxRows:d,rowHeight:f,containerWidth:p,containerPadding:m},_=V4(g),v=H4(i.w,_,u[0]),y=H4(i.h,f,u[1]),b=v/2,x=y/2,S=r.scrollLeft??0,C=r.scrollTop??0,w=t-h.left+S+o-b,T=n-h.top+C+s-x,E=Math.max(0,w),D=Math.max(0,T);return{newDroppingPosition:{left:E/c,top:D/c,e:a},calculatedXY:W4(g,D,E,i.w,i.h)}}var a8=()=>{},o8=`react-grid-layout`,s8=!1;try{s8=/firefox/i.test(navigator.userAgent)}catch{}function c8(e,t){let n=B.Children.toArray(e),r=B.Children.toArray(t);if(n.length!==r.length)return!1;for(let e=0;e{if(!B.isValidElement(t)||t.key===null)return;let n=String(t.key);a.add(n);let r=e.find(e=>e.i===n);if(r)i.push(r3(r));else{let e=t.props[`data-grid`];e?i.push({i:n,x:e.x??0,y:e.y??0,w:e.w??1,h:e.h??1,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,static:e.static,isDraggable:e.isDraggable,isResizable:e.isResizable,resizeHandles:e.resizeHandles,isBounded:e.isBounded}):i.push({i:n,x:0,y:e3(i),w:1,h:1})}});let o=s3(i,{cols:n});return r.compact(o,n)}function u8(e){let{children:t,width:n,gridConfig:r,dragConfig:i,resizeConfig:a,dropConfig:o,positionStrategy:s=D3,compactor:c,constraints:l=d3,layout:u=[],droppingItem:d,autoSize:f=!0,className:p=``,style:m={},innerRef:h,onLayoutChange:g=a8,onDragStart:v=a8,onDrag:y=a8,onDragStop:b=a8,onResizeStart:x=a8,onResize:S=a8,onResizeStop:C=a8,onDrop:w=a8,onDropDragOver:T=a8}=e,E=(0,B.useMemo)(()=>({...O3,...r}),[r]),D=(0,B.useMemo)(()=>({...k3,...i}),[i]),O=(0,B.useMemo)(()=>({...A3,...a}),[a]),k=(0,B.useMemo)(()=>({...j3,...o}),[o]),{cols:A,rowHeight:j,maxRows:M,margin:N,containerPadding:P}=E,{enabled:F,bounded:I,handle:L,cancel:ee,threshold:te,allowMobileScroll:ne}=D,{enabled:re,handles:ie,handleComponent:ae}=O,{enabled:R,defaultItem:oe,onDragOver:z,touchEnabled:se=!0,touchDragSource:ce=`[data-rgl-draggable]`}=k,le=c??V3(`vertical`),ue=le.type,de=le.allowOverlap,fe=le.preventCollision??!1,pe=(0,B.useMemo)(()=>d??{i:`__dropping-elem__`,...oe},[d,oe]),me=s.type===`transform`,he=s.scale,ge=P??N,[_e,ve]=(0,B.useState)(!1),[ye,be]=(0,B.useState)(()=>l8(u,t,A,le)),[xe,Se]=(0,B.useState)(null),[Ce,we]=(0,B.useState)(!1),[Te,Ee]=(0,B.useState)(null),[De,Oe]=(0,B.useState)(),ke=(0,B.useRef)(void 0);ke.current=De;let Ae=(0,B.useRef)(null),je=(0,B.useRef)(null),Me=(0,B.useRef)(null),Ne=(0,B.useRef)(0),Pe=(0,B.useRef)(ye),Fe=(0,B.useRef)(u),Ie=(0,B.useRef)(t),Le=(0,B.useRef)(ue),Re=(0,B.useRef)(null),ze=(0,B.useRef)(!1),Be=(0,B.useRef)(null),Ve=(0,B.useRef)(null);Ve.current=Te;let He=(0,B.useRef)(w);(0,B.useLayoutEffect)(()=>{He.current=w});let Ue=(0,B.useRef)(ye);Ue.current=ye,(0,B.useEffect)(()=>{ve(!0),(0,Z6.deepEqual)(ye,u)||g(ye)},[]),(0,B.useEffect)(()=>{if(xe||Te)return;let e=!(0,Z6.deepEqual)(u,Fe.current),n=!c8(t,Ie.current),r=ue!==Le.current;if(e||n||r){let n=l8(e?u:ye,t,A,le);(0,Z6.deepEqual)(n,ye)||be(n)}Fe.current=u,Ie.current=t,Le.current=ue},[u,t,A,ue,le,xe,Te,ye]),(0,B.useEffect)(()=>{if(!xe&&!Te&&!(0,Z6.deepEqual)(ye,Pe.current)){Pe.current=ye;let e=ye.filter(e=>e.i!==pe.i);g(e)}},[ye,xe,Te,g,pe.i]);let We=(0,B.useMemo)(()=>{if(!f)return;let e=e3(ye),t=ge[1];return e*j+(e-1)*N[1]+t*2+`px`},[f,ye,j,N,ge]),Ge=(0,B.useCallback)((e,t,n,r)=>{let i=Ue.current,a=t3(i,e);if(!a)return;let o={w:a.w,h:a.h,x:a.x,y:a.y,i:e};Ae.current=r3(a),Me.current=i,Se(o),v(i,a,a,null,r.e,r.node)},[v]),Ke=(0,B.useCallback)((e,t,n,r)=>{let i=Ue.current,a=Ae.current,o=t3(i,e);if(!o)return;let s={w:o.w,h:o.h,x:o.x,y:o.y,i:e},c=c3(i,o,t,n,!0,fe,ue,A,de);y(c,a,o,s,r.e,r.node),be(le.compact(c,A)),Se(s)},[fe,ue,A,de,le,y]),qe=(0,B.useCallback)((e,t,n,r)=>{if(!Ae.current)return;let i=Ue.current,a=Ae.current,o=t3(i,e);if(!o)return;let s=c3(i,o,t,n,!0,fe,ue,A,de),c=le.compact(s,A);b(c,a,o,null,r.e,r.node);let l=Me.current;Ae.current=null,Me.current=null,Se(null),be(c),l&&!(0,Z6.deepEqual)(l,c)&&g(c)},[fe,ue,A,de,le,b,g]),Je=(0,B.useCallback)((e,t,n,r)=>{let i=Ue.current,a=t3(i,e);a&&(je.current=r3(a),Me.current=i,we(!0),x(i,a,a,null,r.e,r.node))},[x]),Ye=(0,B.useCallback)((e,t,n,r)=>{let i=Ue.current,a=je.current,{handle:o}=r,s=!1,c,l,[u,d]=o3(i,e,e=>(c=e.x,l=e.y,[`sw`,`w`,`nw`,`n`,`ne`].includes(o)&&([`sw`,`nw`,`w`].includes(o)&&(c=e.x+(e.w-t),t=e.x!==c&&c<0?e.w:t,c=c<0?0:c),[`ne`,`n`,`nw`].includes(o)&&(l=e.y+(e.h-n),n=e.y!==l&&l<0?e.h:n,l=l<0?0:l),s=!0),fe&&!de&&X4(i,{...e,w:t,h:n,x:c??e.x,y:l??e.y}).filter(t=>t.i!==e.i).length>0&&(l=e.y,n=e.h,c=e.x,t=e.w,s=!1),e.w=t,e.h=n,(o===`n`||o===`nw`||o===`ne`)&&(e.y=l??e.y),e));if(!d)return;let f=u;s&&c!==void 0&&l!==void 0&&(f=c3(u,d,c,l,!0,fe,ue,A,de));let p={w:d.w,h:d.h,x:d.x,y:d.y,i:e,static:!0};S(f,a,d,p,r.e,r.node);let m=le.compact(f,A);if(o===`n`||o===`nw`||o===`ne`){let t=m.find(t=>t.i===e);t&&(t.y=d.y)}be(m),Se(p)},[fe,ue,A,de,le,S]),Xe=(0,B.useCallback)((e,t,n,r)=>{let i=Ue.current,a=je.current,o=t3(i,e),s=le.compact(i,A);C(s,a,o??null,null,r.e,r.node);let c=Me.current;je.current=null,Me.current=null,Se(null),we(!1),be(s),c&&!(0,Z6.deepEqual)(c,s)&&g(s)},[A,le,C,g]),Ze=(0,B.useCallback)((e,t,n,r)=>{if(r)ke.current&&(ke.current.left!==t.left||ke.current.top!==t.top)&&(Oe(t),be(t=>t.map(t=>t.i===e.i&&(t.x!==n.x||t.y!==n.y)?{...t,x:n.x,y:n.y}:t)));else{Ee((0,V.jsx)(`div`,{},e.i)),Oe(t);let r=Ue.current.filter(t=>t.i!==e.i);be([...r,{...e,x:n.x,y:n.y,static:!1,isDraggable:!0}])}},[]),Qe=(0,B.useCallback)((e,t,r)=>{let i=Re.current;if(!i)return;let{newDroppingPosition:a,calculatedXY:o}=i8({clientX:e,clientY:t,gridElement:i,droppingItem:pe,event:r,transformScale:he,cols:A,margin:N,maxRows:M,rowHeight:j,width:n,containerPadding:ge});Ze(pe,a,o,!!Ve.current)},[pe,he,A,N,M,j,n,ge,Ze]),$e=(0,B.useCallback)(()=>{let e=Ue.current;if(!e.some(e=>e.i===pe.i)){Ee(null),Se(null),Oe(void 0);return}let t=le.compact(e.filter(e=>e.i!==pe.i),A);be(t),Ee(null),Se(null),Oe(void 0)},[pe.i,A,le]),et=(0,B.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),s8&&!e.nativeEvent.target?.classList.contains(o8))return!1;let t=z?z(e.nativeEvent):T(e);if(t===!1)return Te&&$e(),!1;let{dragOffsetX:r=0,dragOffsetY:i=0,...a}=t??{},o={...pe,...a},{newDroppingPosition:s,calculatedXY:c}=i8({clientX:e.clientX,clientY:e.clientY,gridElement:e.currentTarget,droppingItem:o,event:e.nativeEvent,dragOffsetX:r,dragOffsetY:i,transformScale:he,cols:A,margin:N,maxRows:M,rowHeight:j,width:n,containerPadding:ge});Ze(o,s,c,!!Te)},[Te,pe,z,T,$e,Ze,he,A,N,M,j,n,ge]),tt=(0,B.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),Ne.current--,Ne.current<0&&(Ne.current=0),Ne.current===0&&$e()},[$e]),nt=(0,B.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),Ne.current++},[]),rt=(0,B.useCallback)(e=>{let t=Ue.current,n=t.find(e=>e.i===pe.i);$e(),He.current(t,n,e)},[pe.i,$e]),it=(0,B.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),Ne.current=0,rt(e.nativeEvent)},[rt]);(0,B.useEffect)(()=>{if(!R||!se)return;let e=Re.current;if(!e)return;let t=(t,n)=>{let r=document.elementFromPoint(t,n);return r?e.contains(r):!1},n=e=>e instanceof HTMLElement&&e.closest(ce)!==null,r=e=>{let t=e.changedTouches;if(!t||t.length===0)return;let n=Be.current;if(n===null)return t[0];for(let e=0;e{if(!n(e.target)||Be.current!==null)return;e.preventDefault();let t=e.changedTouches?.[0];t&&(Be.current=t.identifier,ze.current=!0)},a=e=>{if(!ze.current)return;e.preventDefault();let n=r(e);if(n){if(!t(n.clientX,n.clientY)){Ve.current&&$e();return}Qe(n.clientX,n.clientY,e)}},o=e=>{if(!ze.current)return;e.preventDefault();let n=r(e);if(ze.current=!1,Be.current=null,n){if(!t(n.clientX,n.clientY)){$e();return}rt(e)}},s=()=>{ze.current&&(ze.current=!1,Be.current=null,$e())},c={passive:!1};return document.addEventListener(`touchstart`,i,c),document.addEventListener(`touchmove`,a,c),document.addEventListener(`touchend`,o,c),document.addEventListener(`touchcancel`,s,c),()=>{document.removeEventListener(`touchstart`,i,c),document.removeEventListener(`touchmove`,a,c),document.removeEventListener(`touchend`,o,c),document.removeEventListener(`touchcancel`,s,c)}},[R,se,ce,Qe,$e,rt,pe.i]);let at=(0,B.useCallback)((e,t)=>{if(!e||!e.key)return null;let r=t3(ye,String(e.key));if(!r)return null;let i=typeof r.isDraggable==`boolean`?r.isDraggable:!r.static&&F,a=typeof r.isResizable==`boolean`?r.isResizable:!r.static&&re,o=r.resizeHandles||[...ie],c=i&&I&&r.isBounded!==!1,u=ae;return(0,V.jsx)(r8,{containerWidth:n,cols:A,margin:N,containerPadding:ge,maxRows:M,rowHeight:j,cancel:ee,handle:L,onDragStart:Ge,onDrag:Ke,onDragStop:qe,onResizeStart:Je,onResize:Ye,onResizeStop:Xe,isDraggable:i,isResizable:a,isBounded:c,allowMobileScroll:ne,useCSSTransforms:me&&_e,usePercentages:!_e,transformScale:he,positionStrategy:s,dragThreshold:te,w:r.w,h:r.h,x:r.x,y:r.y,i:r.i,minH:r.minH,minW:r.minW,maxH:r.maxH,maxW:r.maxW,static:r.static,droppingPosition:t?De:void 0,resizeHandles:o,resizeHandle:u,constraints:l,layoutItem:r,layout:ye,children:e},r.i)},[ye,n,A,N,ge,M,j,ee,L,Ge,Ke,qe,Je,Ye,Xe,F,re,I,me,_e,he,s,te,De,ie,ae,l]),ot=()=>xe?(0,V.jsx)(r8,{w:xe.w,h:xe.h,x:xe.x,y:xe.y,i:xe.i,className:`react-grid-placeholder ${Ce?`placeholder-resizing`:``}`,containerWidth:n,cols:A,margin:N,containerPadding:ge,maxRows:M,rowHeight:j,isDraggable:!1,isResizable:!1,isBounded:!1,useCSSTransforms:me,transformScale:he,constraints:l,layout:ye,children:(0,V.jsx)(`div`,{})}):null,st=(0,B.useCallback)(e=>{Re.current=e,typeof h==`function`?h(e):h&&`current`in h&&(h.current=e)},[h]),ct=_(o8,p),lt={height:We,...m};return(0,V.jsxs)(`div`,{ref:st,className:ct,style:lt,onDrop:R?it:void 0,onDragLeave:R?tt:void 0,onDragEnter:R?nt:void 0,onDragOver:R?et:void 0,children:[B.Children.map(t,e=>B.isValidElement(e)?at(e):null),R&&Te&&at(Te,!0),ot()]})}var d8={lg:1200,md:996,sm:768,xs:480,xxs:0},f8={lg:12,md:10,sm:6,xs:4,xxs:2},p8=()=>{};function m8(e,t,n,r,i=!1){let a=[];B.Children.forEach(t,t=>{if(!B.isValidElement(t)||t.key===null)return;let n=String(t.key),r=t.props[`data-grid`],o=e.find(e=>e.i===n);o?i&&r?a.push({...o,i:n,w:r.w??o.w,h:r.h??o.h,minW:r.minW??o.minW,maxW:r.maxW??o.maxW,minH:r.minH??o.minH,maxH:r.maxH??o.maxH}):a.push({...o,i:n}):r?a.push({i:n,x:r.x??0,y:r.y??0,w:r.w??1,h:r.h??1,minW:r.minW,maxW:r.maxW,minH:r.minH,maxH:r.maxH,static:r.static,isDraggable:r.isDraggable,isResizable:r.isResizable,resizeHandles:r.resizeHandles,isBounded:r.isBounded}):a.push({i:n,x:0,y:e3(a),w:1,h:1})});let o=s3(a,{cols:n});return r.compact(o,n)}function h8(e){let{children:t,width:n,breakpoint:r,breakpoints:i=d8,cols:a=f8,layouts:o={},rowHeight:s=150,maxRows:c=1/0,margin:l=[10,10],containerPadding:u=null,compactor:d,onBreakpointChange:f=p8,onLayoutChange:p=p8,onWidthChange:m=p8,...h}=e,g=d??V3(`vertical`),_=g.type,v=g.allowOverlap,y=(0,B.useMemo)(()=>r??U3(i,n),[]),b=(0,B.useMemo)(()=>W3(y,a),[y,a]),x=(0,B.useMemo)(()=>G3(o,i,y,y,b,_),[]),[S,C]=(0,B.useState)(y),[w,T]=(0,B.useState)(b),[E,D]=(0,B.useState)(x),[O,k]=(0,B.useState)(o),A=(0,B.useRef)(n),j=(0,B.useRef)(r),M=(0,B.useRef)(i),N=(0,B.useRef)(a),P=(0,B.useRef)(o),F=(0,B.useRef)(_),I=(0,B.useRef)(O);(0,B.useEffect)(()=>{I.current=O},[O]);let L=(0,B.useMemo)(()=>(0,Z6.deepEqual)(o,P.current)?null:G3(o,i,S,S,w,g),[o,i,S,w,g]),ee=L??E;(0,B.useEffect)(()=>{L!==null&&(D(L),k(o),I.current=o,P.current=o)},[L,o]),(0,B.useEffect)(()=>{if(_!==F.current){let e=g.compact(i3(ee),w),t={...I.current,[S]:e};D(e),k(t),I.current=t,p(e,t),F.current=_}},[_,g,ee,w,v,S,p]),(0,B.useEffect)(()=>{let e=n!==A.current,o=r!==j.current,s=!(0,Z6.deepEqual)(i,M.current),c=!(0,Z6.deepEqual)(a,N.current);if(e||o||s||c){let e=r??U3(i,n),o=W3(e,a),d=S;if(d!==e||s||c){let n={...I.current};n[d]||(n[d]=i3(E));let r=G3(n,i,e,d,o,g),a=!n[e];r=m8(r,t,o,g,a),n[e]=r,C(e),T(o),D(r),k(n),I.current=n,f(e,o),p(r,n)}let h=K3(l,e),_=u?K3(u,e):null;m(n,h,o,_),A.current=n,j.current=r,M.current=i,N.current=a}},[n,r,i,a,S,w,E,t,g,_,v,l,u,f,p,m]);let te=(0,B.useCallback)(e=>{let t={...I.current,[S]:e};D(e),k(t),I.current=t,p(e,t)},[S,p]),ne=(0,B.useMemo)(()=>K3(l,S),[l,S]),re=(0,B.useMemo)(()=>u===null?null:K3(u,S),[u,S]),ie=(0,B.useMemo)(()=>({cols:w,rowHeight:s,maxRows:c,margin:ne,containerPadding:re}),[w,s,c,ne,re]);return(0,V.jsx)(u8,{...h,width:n,gridConfig:ie,compactor:g,onLayoutChange:te,layout:ee,children:t})}var g8=B.forwardRef(function(e,t){let{innerRef:n,...r}=e,i=n??t;return(0,V.jsx)(h8,{...r,innerRef:i})});g8.displayName=`ResponsiveGridLayout`;function _8(e,t,n,r){let i=e=>t?.frame?.columns.some((n,r)=>n.name===e&&t.frame.values[r]?.some(e=>typeof e==`string`&&e!==``));return{onSelect:e.click&&(e.viz===`service_map`||!(e.drill&&r))?t=>n(e.click.set_variable,t):void 0,onPoint:r&&(e.viz===`service_map`||e.click||e.drill||i(`trace_id`)||e.options?.columns?.some(e=>e.format===`trace_link`&&i(e.field)))?r:void 0}}function v8(e,t,n,r){if(!t)return;let i=mt(e,t,n);if(!i)return;let a=Object.values(n.dimensions)[0],o=e.click?.set_variable;return{target:i,vars:o&&a!==void 0?{...r,[o]:a}:r}}function y8(e){let t=Number.isFinite(e.from_ms)&&Number.isFinite(e.to_ms)?`${new Date(e.from_ms).toISOString()} to ${new Date(e.to_ms).toISOString()}`:`No executed window is available; say that explicitly.`;return`Explain the panel ${JSON.stringify(e.title)} (panel id ${e.panel_id}${e.dashboard_id?`, dashboard id ${e.dashboard_id}, version ${e.version}`:``}). Observed window (millisecond-truncated): ${t}. Resolved variables: ${JSON.stringify(e.vars)}. Observed state: ${JSON.stringify({status:e.status,diagnosis:e.diagnosis,stale_since:e.stale_since,truncated:e.truncated,note:e.note})}. ${e.error?`Observed error: ${JSON.stringify(e.error)}. `:``}${e.spec?`Panel specification: ${JSON.stringify(e.spec)}. `:``}Answer what it shows and what evidence supports unusual behavior. This is an explanation request. Do not create, edit, replace or restore a dashboard. If it fails, explain the error and suggest a correction without saving it.`}function b8(e){return`Please fix the panel ${JSON.stringify(e.title)} (panel id ${e.panel_id}, dashboard id ${e.dashboard_id}, version ${e.version}). Observed error: ${JSON.stringify(e.error)}. Resolved variables: ${JSON.stringify(e.vars)}. This is an explicit dashboard edit request. Get the dashboard and correct only this panel.`}var x8=e=>e*40+(e-1)*12,S8={s:3,m:6,l:10},C8={stat:4},w8=e=>Math.max(C8[e.viz]??0,S8[e.height??(e.viz===`service_map`?`l`:e.viz===`stat`?`s`:`m`)]),T8=(0,B.lazy)(()=>ue(()=>import(`./panel-sql-editor-DZsqGx1F.js`),__vite__mapDeps([0,1,2,3,4,5,6,7]))),E8=0;function D8(e){let t;do t=`p_${Date.now().toString(36)}_${(++E8).toString(36)}_${Math.random().toString(36).slice(2,10)}`;while(e.some(e=>e.id===t));return t}function O8({dashboardId:e,version:t,spec:n,vars:r,results:i,fetching:a,annotations:o,fetchingIds:s=[],staleAt:c=new Map,time:l=n.time,onEditExit:u,editing:d,view:f,agentAvailable:p,canManage:m=!1,onOpenChat:h,onVariable:g,onRetry:_,onPoint:v,onZoom:b,onZoomReset:x,zoomed:S,onView:w,onVisible:E,onRangePending:D,shortcutScope:O,onShortcuts:k,overlayOpen:A,returnViewFocus:j}){let M=tt(),[N,P]=(0,B.useState)(),[F,I]=(0,B.useState)(()=>n.panels.map(e=>({i:e.id,x:e.grid?.x??0,y:e.grid?.y??0,w:e.grid?.w??6,h:e.grid?.h??w8(e)})));(0,B.useEffect)(()=>{I(n.panels.map(e=>({i:e.id,x:e.grid?.x??0,y:e.grid?.y??0,w:e.grid?.w??6,h:e.grid?.h??w8(e)})))},[n]);let[L,te]=(0,B.useState)(()=>window.innerHeight),[ne,re]=(0,B.useState)();(0,B.useEffect)(()=>{let e=()=>te(window.innerHeight);return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let ie=(0,B.useRef)(null),ae=(0,B.useRef)(new Map),R=(0,B.useRef)(null),oe=(0,B.useRef)(null),z=()=>{let e=N?.panel.id;P(void 0),requestAnimationFrame(()=>(oe.current?.isConnected?oe.current:ae.current.get(e??``))?.focus())},ce=(0,B.useRef)(f);f&&(ce.current=f);let[le,ue]=(0,B.useState)(0),de=le>0,fe=d&&(le>=1100?`lg`:le>=800?`md`:`sm`)==`lg`;(0,B.useLayoutEffect)(()=>{if(!ie.current)return;ue(Math.max(0,Math.round(ie.current.getBoundingClientRect().width)));let e=new ResizeObserver(([e])=>{e&&ue(Math.max(0,Math.round(e.contentRect.width)))});return e.observe(ie.current),()=>e.disconnect()},[]);let pe=(0,B.useRef)(E);pe.current=E,(0,B.useEffect)(()=>{if(!de||!ie.current||typeof IntersectionObserver>`u`)return;let e=new Set(n.panels.map(e=>e.id)),t=new IntersectionObserver(t=>{for(let n of t){let t=n.target.dataset.panel;t&&(n.isIntersecting?e.add(t):e.delete(t))}f&&n.panels.some(e=>e.id===f)&&e.add(f),pe.current([...e])},{rootMargin:`200px`});return ie.current.querySelectorAll(`.react-grid-item[data-panel]`).forEach(e=>t.observe(e)),()=>t.disconnect()},[n,f,de]);let me=(0,B.useMemo)(()=>n.panels.some(e=>{let t=F.find(t=>t.i===e.id);return t&&(t.x!==e.grid?.x||t.y!==e.grid?.y||t.w!==e.grid?.w||t.h!==e.grid?.h)}),[F,n]),he=e=>({...n,panels:e.map(e=>{let t=F.find(t=>t.i===e.id);return t?{...e,grid:{x:t.x,y:t.y,w:t.w,h:t.h}}:e})}),ge=Oe({mutationFn:()=>$e(e,he(n.panels),t,`Edited layout`),onSuccess:t=>{M.setQueryData([`dashboard`,e],t)}}),_e=Oe({mutationFn:r=>me?$e(e,he(n.panels.filter(e=>e.id!==r)),t,`Removed a panel and saved layout`):je(e,[{op:`remove_panel`,id:r}],t,`Removed a panel`),onSuccess:t=>{M.setQueryData([`dashboard`,e],t)}}),ve=Oe({mutationFn:r=>{let i={...r,id:D8(n.panels),title:`${Array.from(r.title).slice(0,73).join(``)} (copy)`,grid:void 0};if(me){let a=[...n.panels];return a.splice(a.findIndex(e=>e.id===r.id)+1,0,i),$e(e,he(a),t,`Duplicated a panel and saved layout`)}return je(e,[{op:`add_panel`,after:r.id,panel:i}],t,`Duplicated a panel`)},onSuccess:t=>{M.setQueryData([`dashboard`,e],t)}});(0,B.useEffect)(()=>{d||(ge.reset(),_e.reset(),ve.reset())},[d]);let ye=()=>{ge.reset(),_e.reset(),ve.reset(),u?.(),M.invalidateQueries({queryKey:[`dashboard`,e]})},be=async e=>{let t=new URL(window.location.href);t.searchParams.set(`view`,e),t.searchParams.delete(`edit`);try{await navigator.clipboard.writeText(t.toString()),re(`Link copied`)}catch{re(`Copy this URL: ${t.toString()}`)}},xe=`dashboard-${e}`,Se=n=>({dashboard_id:e,version:t,panel_id:n.id,title:Xi(n.title,r),from_ms:i.get(n.id)?.from_ms,to_ms:i.get(n.id)?.to_ms,vars:r,error:i.get(n.id)?.error,status:i.get(n.id)?.status,diagnosis:i.get(n.id)?.diagnosis,stale_since:c.get(n.id),truncated:i.has(n.id)?!!(i.get(n.id)?.frame?.truncated||i.get(n.id)?.previous?.truncated):void 0,note:i.get(n.id)?.frame?.note,spec:{...n,dashboard_time:l}}),Ce=(u,d,y=!1)=>(0,V.jsx)(L4,{panel:u,title:Xi(u.title,r),result:i.get(u.id),loading:a&&s.includes(u.id),height:d,group:xe,editing:fe&&!y,agentAvailable:p,suspended:!y&&u.id===f,menuRef:y?R:e=>{e?ae.current.set(u.id,e):ae.current.delete(u.id)},compare:l.compare===`previous_period`,range:u.time?.range??l.range,annotations:o,vars:r,onVariable:g,..._8(u,i.get(u.id),g,v?e=>v(u,e):void 0),onRangePending:e=>D?.(u.id,e),onZoom:b,zoomed:S,onZoomReset:x,onRetry:_?()=>_(u.id):void 0,onView:()=>w(u.id),onCopyLink:()=>{be(u.id)},onEditSQL:m&&typeof u.sql==`string`?()=>{oe.current=y?R.current:ae.current.get(u.id)??null,P({panel:u,spec:n,version:t})}:void 0,onExplain:e?()=>h(y8(Se(u)),{answer_only:!0}):void 0,onFix:e&&m?()=>h(b8(Se(u))):void 0,staleAt:c.get(u.id),onDuplicate:fe&&!y?()=>ve.mutate(u):void 0,onRemove:fe&&!y?()=>_e.mutate(u.id):void 0}),we=n.panels.find(e=>e.id===f),Te=d?ge.error??_e.error??ve.error:null,Ee=Te instanceof Ne&&Te.code===`dashboard_version_conflict`,De=e=>{fe&&I(e.map(({i:e,x:t,y:n,w:r,h:i})=>({i:e,x:t,y:n,w:r,h:i})))};return(0,V.jsxs)(`div`,{ref:ie,style:{minWidth:0},children:[d&&(0,V.jsxs)(y,{justify:`space-between`,mb:`sm`,p:`xs`,style:{border:`1px dashed var(--mantine-color-default-border)`,borderRadius:8},children:[(0,V.jsx)(T,{size:`sm`,c:`dimmed`,children:fe?`Drag a panel by its title and resize it from the corner. Changes are saved as a new version.`:`The layout can be edited only on a wider screen.`}),(0,V.jsx)(C,{size:`compact-sm`,disabled:!me||!fe,loading:ge.isPending,onClick:()=>ge.mutate(),children:`Save layout`})]}),Ee&&(0,V.jsxs)(ee,{color:`warn`,mb:`sm`,children:[`Someone saved this dashboard since you opened it. Load the latest version, then redo your change. `,(0,V.jsx)(C,{size:`compact-sm`,onClick:ye,children:`Load latest`})]}),Te&&!Ee&&(0,V.jsx)(ee,{color:`bad`,mb:`sm`,children:Te.message}),ne&&(0,V.jsx)(ee,{role:`status`,mb:`sm`,children:ne}),!de&&(0,V.jsx)(`div`,{"data-grid-placeholder":!0,style:{height:x8(Math.max(1,...F.map(e=>e.y+e.h)))}}),de&&(0,V.jsx)(g8,{width:le,className:`dashboard-grid${fe?` dashboard-grid-editing`:``}`,layouts:{lg:F,md:F,sm:F.map(e=>({...e,x:0,w:12}))},breakpoints:{lg:1100,md:800,sm:0},cols:{lg:12,md:12,sm:12},rowHeight:40,margin:[12,12],containerPadding:[0,0],compactor:F3,dragConfig:{enabled:fe,handle:`.panel-drag`,cancel:`button`},resizeConfig:{enabled:fe},onDragStop:De,onResizeStop:De,children:n.panels.map(e=>{let t=F.find(t=>t.i===e.id);return(0,V.jsx)(`div`,{"data-panel":e.id,children:Ce(e,x8(t?.h??6))},e.id)})}),(0,V.jsx)(I4,{shortcutScope:O,onShortcuts:k,escapeEnabled:!A&&!N,opened:!!f,onClose:()=>w(void 0),title:we?Xi(we.title,r):`Missing panel`,returnFocusTo:()=>j?.(ce.current)??ae.current.get(ce.current??``)??ae.current.values().next().value,children:we?(0,V.jsx)(`div`,{style:{height:`calc(100vh - 120px)`},children:Ce(we,Math.max(40,L-140),!0)}):(0,V.jsx)(ee,{color:`warn`,children:`This panel is missing from the dashboard. The shared link may be out of date.`})}),N&&(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(bt,{opened:!0,onClose:z,title:`Loading SQL editor`,children:(0,V.jsx)(se,{size:`sm`,"aria-label":`Loading SQL editor`})}),children:(0,V.jsx)(T8,{dashboardId:e,version:N.version,spec:N.spec,panel:N.panel,time:l,vars:r,onClose:z})})]})}function k8(e,t=1,n=8){let r=(t-1)*n;return e.slice(r,r+n)}function A8({icon:e,title:t,children:n,tall:r=!1}){return(0,V.jsx)(ae,{mih:r?220:130,p:`xl`,children:(0,V.jsxs)(y,{wrap:`nowrap`,children:[(0,V.jsx)(ne,{variant:`light`,size:`xl`,radius:`md`,children:e}),(0,V.jsxs)(o,{children:[(0,V.jsx)(T,{fw:700,size:`sm`,children:t}),(0,V.jsx)(T,{c:`dimmed`,size:`xs`,mt:3,children:n})]})]})})}function j8(e,t=8){let[n,r]=(0,B.useState)(1),i=Math.max(1,Math.ceil(e.length/t));(0,B.useEffect)(()=>{n>i&&r(i)},[n,i]);let a=(n-1)*t;return{page:n,setPage:r,totalPages:i,pageItems:k8(e,n,t),from:e.length?a+1:0,to:Math.min(a+t,e.length),total:e.length}}function M8({page:e,totalPages:t,from:n,to:r,total:i,onChange:a}){return t<=1?null:(0,V.jsxs)(y,{justify:`space-between`,mt:`xs`,children:[(0,V.jsxs)(T,{c:`dimmed`,size:`xs`,children:[n,`–`,r,` of `,i]}),(0,V.jsx)(y,{gap:4,children:[{label:`First page`,page:1,disabled:e===1},{label:`Previous page`,page:e-1,disabled:e===1},{label:`Next page`,page:e+1,disabled:e===t},{label:`Last page`,page:t,disabled:e===t}].map(e=>(0,V.jsx)(C,{size:`compact-xs`,variant:`subtle`,"aria-label":e.label,disabled:e.disabled,onClick:()=>a(e.page),children:e.label},e.label))})]})}function N8({spans:e,dark:t,onSpan:n}){let r=Math.min(...e.map(e=>new Date(e.start).valueOf())),i=Math.max(...e.map(e=>new Date(e.start).valueOf()+e.duration_ms)),a=Math.max(i-r,1),s=[...new Set(e.map(e=>e.service))],c=j8(e);return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(xe.ScrollContainer,{minWidth:680,children:(0,V.jsxs)(xe,{highlightOnHover:!!n,verticalSpacing:`sm`,children:[(0,V.jsx)(xe.Thead,{children:(0,V.jsxs)(xe.Tr,{children:[(0,V.jsx)(xe.Th,{w:230,children:`Operation`}),(0,V.jsx)(xe.Th,{children:`Timeline`}),(0,V.jsx)(xe.Th,{w:90,ta:`right`,children:`Duration`})]})}),(0,V.jsx)(xe.Tbody,{children:c.pageItems.map(e=>{let i=(new Date(e.start).valueOf()-r)/a*100,c=Math.max(e.duration_ms/a*100,.6),l=e.status===`STATUS_CODE_ERROR`;return(0,V.jsxs)(xe.Tr,{tabIndex:n?0:void 0,onClick:n?()=>n(e):void 0,onKeyDown:n?t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),n(e))}:void 0,style:{cursor:n?`pointer`:void 0},children:[(0,V.jsx)(xe.Td,{children:(0,V.jsxs)(y,{gap:`xs`,wrap:`nowrap`,children:[(0,V.jsx)(o,{w:8,h:8,bg:Ba(s.indexOf(e.service),t),style:{borderRadius:`50%`,flex:`0 0 auto`}}),(0,V.jsxs)(o,{miw:0,children:[(0,V.jsx)(T,{fw:600,size:`sm`,truncate:!0,children:e.operation}),(0,V.jsx)(T,{c:`dimmed`,size:`xs`,truncate:!0,children:e.service})]})]})}),(0,V.jsx)(xe.Td,{children:(0,V.jsx)(he,{label:`${e.service} · ${e.operation} · ${be(e.duration_ms)}`,withArrow:!0,children:(0,V.jsx)(o,{pos:`relative`,h:14,bg:`var(--mantine-color-default-hover)`,role:`img`,"aria-label":`${e.operation} on ${e.service} took ${be(e.duration_ms)}`,style:{borderRadius:`var(--mantine-radius-sm)`},children:(0,V.jsx)(o,{pos:`absolute`,left:`${i}%`,w:`${Math.min(c,100-i)}%`,h:`100%`,bg:l?`bad`:Ba(s.indexOf(e.service),t),style:{borderRadius:`var(--mantine-radius-sm)`,minWidth:3}})})})}),(0,V.jsx)(xe.Td,{ta:`right`,children:(0,V.jsx)(T,{size:`sm`,ff:`monospace`,children:be(e.duration_ms)})})]},e.span_id)})})]})}),(0,V.jsx)(M8,{...c,onChange:c.setPage})]})}function P8({result:e,dark:t,onSpan:n}){let[r,i]=(0,B.useState)(`waterfall`),a=e.data,s=(0,B.useMemo)(()=>({id:`correlated_logs`,status:a.logs.length?`ok`:`empty`,elapsed_ms:0,frame:{columns:[{name:`time`,type:`time`,role:`time`},...[`severity`,`service`,`body`].map(e=>({name:e,type:`string`,role:`dimension`}))],rows:a.logs.length,values:[a.logs.map(e=>Date.parse(e.time)),a.logs.map(e=>e.severity),a.logs.map(e=>e.service),a.logs.map(e=>e.body)]}}),[a.logs]);return(0,V.jsxs)(S,{gap:`sm`,children:[(0,V.jsxs)(y,{children:[(0,V.jsx)(T,{fw:600,children:a.trace_id}),(0,V.jsx)(T,{c:a.has_error?`bad`:`dimmed`,children:a.has_error?`■ Error`:`● OK`})]}),a.spans.length>0?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(y,{role:`group`,"aria-label":`Trace view`,children:[(0,V.jsx)(C,{"aria-pressed":r===`waterfall`,variant:r===`waterfall`?`light`:`subtle`,onClick:()=>i(`waterfall`),children:`Waterfall`}),(0,V.jsx)(C,{"aria-pressed":r===`flame`,variant:r===`flame`?`light`:`subtle`,onClick:()=>i(`flame`),children:`Flame graph`})]}),r===`waterfall`?(0,V.jsx)(N8,{spans:a.spans,dark:t,onSpan:n}):(0,V.jsx)(F8,{spans:a.spans,dark:t,onSpan:n})]}):(0,V.jsx)(T,{c:`dimmed`,children:`No spans were found for this trace.`}),(0,V.jsx)(T,{fw:600,children:`Correlated logs`}),a.logs.length?(0,V.jsx)(o,{style:{overflow:`auto`,minWidth:0},children:(0,V.jsx)(A4,{foldConstants:!1,panel:{id:`correlated_logs`,title:`Correlated logs`,viz:`logs`},result:s,dark:t,height:320})}):(0,V.jsx)(A8,{tall:!0,icon:(0,V.jsx)(Bi,{size:20,weight:`duotone`}),title:`No correlated logs`,children:`No logs in this window carry the selected trace ID.`}),a.truncated&&(0,V.jsxs)(ee,{color:`warn`,children:[`This trace is truncated: `,a.spans.length,` of `,a.span_count,` spans, `,a.services.length,` of `,a.service_count,` services.`]})]})}function F8({spans:e,dark:t,onSpan:n}){let r=(0,B.useMemo)(()=>I8(e),[e]),i=[...new Set(e.map(e=>e.service))];return(0,V.jsxs)(S,{px:{base:`md`,sm:`lg`},pb:`md`,gap:`xs`,children:[(0,V.jsxs)(y,{justify:`space-between`,children:[(0,V.jsx)(y,{gap:`md`,children:i.map(e=>(0,V.jsxs)(y,{gap:5,children:[(0,V.jsx)(o,{w:8,h:8,bg:Ba(i.indexOf(e),t),style:{borderRadius:`50%`}}),(0,V.jsx)(T,{c:`dimmed`,size:`xs`,children:e})]},e))}),(0,V.jsx)(We,{variant:`light`,children:be(r.total)})]}),(0,V.jsx)(z,{withBorder:!0,radius:`md`,p:`sm`,children:(0,V.jsx)(me,{type:`auto`,offsetScrollbars:!0,children:(0,V.jsxs)(o,{miw:760,children:[(0,V.jsx)(o,{pos:`relative`,h:22,mb:4,children:[0,25,50,75,100].map(e=>(0,V.jsx)(T,{pos:`absolute`,left:`${e}%`,c:`dimmed`,size:`xs`,style:{transform:e===100?`translateX(-100%)`:e?`translateX(-50%)`:void 0},children:be(r.total*e/100)},e))}),(0,V.jsxs)(o,{pos:`relative`,h:Math.max(150,r.laneCount*36+12),bg:`var(--mantine-color-default-hover)`,style:{overflow:`hidden`,borderRadius:`var(--mantine-radius-md)`},children:[[0,25,50,75,100].map(e=>(0,V.jsx)(o,{pos:`absolute`,left:`${e}%`,top:0,bottom:0,style:{borderLeft:`1px solid var(--mantine-color-default-border)`}},e)),r.frames.map(({span:e,lane:r,left:a,width:s})=>{let c=e.status===`STATUS_CODE_ERROR`,l=s<7,u=c?za(t).bad:Ba(i.indexOf(e.service),t),d=`${e.operation} · ${be(e.duration_ms)} · ${e.service}`,f=(0,V.jsxs)(T,{component:`span`,size:`xs`,fw:700,truncate:!0,children:[l?``:e.operation,s>=12?` · ${be(e.duration_ms)}`:``]}),p={position:`absolute`,left:`${a}%`,top:r*36+6,width:`${Math.max(s,.35)}%`,height:30,overflow:`hidden`,minWidth:3};return(0,V.jsx)(he,{label:`${e.service} · ${e.operation} · ${be(e.duration_ms)}`,withArrow:!0,events:{hover:!0,focus:!0,touch:!1},children:n?(0,V.jsx)(C,{variant:`filled`,color:u,"aria-label":d,px:l?2:`xs`,size:`compact-xs`,onClick:()=>n(e),style:p,children:f}):(0,V.jsx)(o,{role:`img`,tabIndex:0,"aria-label":d,style:{...p,display:`flex`,alignItems:`center`,paddingInline:l?2:8,borderRadius:`var(--mantine-radius-sm)`,background:u,color:kt(u)},children:f})},e.span_id)})]})]})})}),(0,V.jsx)(T,{c:`dimmed`,size:`xs`,children:`Width represents wall-clock duration; lanes preserve span hierarchy without overlap.`})]})}function I8(e){let t=Math.min(...e.map(e=>new Date(e.start).valueOf())),n=Math.max(...e.map(e=>new Date(e.start).valueOf()+e.duration_ms)),r=Math.max(n-t,1),i=new Map(e.map(e=>[e.span_id,e])),a=(e,t=new Set)=>{if(!e.parent_span_id||t.has(e.span_id))return 0;let n=i.get(e.parent_span_id);return n?(t.add(e.span_id),1+a(n,t)):0},o=e.map(e=>{let n=new Date(e.start).valueOf();return{span:e,depth:a(e),start:n,end:n+e.duration_ms,left:(n-t)/r*100,width:e.duration_ms/r*100}}).sort((e,t)=>e.depth-t.depth||e.start-t.start||t.span.duration_ms-e.span.duration_ms),s=[],c=0;for(let e of[...new Set(o.map(e=>e.depth))].sort((e,t)=>e-t)){let t=[];for(let n of o.filter(t=>t.depth===e)){let e=t.findIndex(e=>e<=n.start);e===-1&&(e=t.length),t[e]=n.end,s.push({...n,lane:c+e})}c+=Math.max(t.length,1)}return{frames:s,laneCount:c,total:r}}function L8({client:e,spec:t,time:n,vars:r,target:i,onChange:a}){let o=at(`light`)===`dark`,s=t.panels.find(e=>e.id===i?.panel_id),c=i?.kind===`logs`&&s?.query?.from===`logs`,l=st({queryKey:[`exemplars`,t,i,r],queryFn:({signal:n})=>e.exemplars({dashboard:t,panel_id:i.panel_id,kind:c?`logs`:`traces`,time:{from:i.window_from,to:i.window_to,refresh:`off`},from:i.from,to:i.to,dimensions:i.dimensions,bucket:i.bucket,vars:r},n),enabled:!!(i&&s&&!i.trace_id),retry:!1}),u=st({queryKey:[`drill-trace`,i],queryFn:({signal:t})=>e.trace(i,t),enabled:!!i?.trace_id,retry:!1});return(0,V.jsxs)(et,{opened:!!i,onClose:()=>a(void 0),title:s?`${s.title} · ${i?.kind}`:`Panel selection unavailable`,position:`right`,size:`xl`,children:[i?.trace_id&&(0,V.jsx)(C,{variant:`subtle`,mb:`sm`,onClick:()=>{let{trace_id:e,namespace:t,...n}=i;a(n)},children:`Back to traces`}),!s&&(0,V.jsx)(ee,{color:`bad`,children:`This panel is no longer in the dashboard.`}),(l.isFetching||u.isFetching)&&(0,V.jsx)(se,{role:`status`,"aria-label":`Loading drill data`,size:`sm`}),(l.error||u.error)&&(0,V.jsx)(ee,{color:`bad`,children:(l.error??u.error)?.message}),c&&l.data?.logs&&s&&(0,V.jsx)(A4,{panel:{...s,viz:`logs`},result:{id:s.id,status:l.data.logs.rows?`ok`:`empty`,frame:l.data.logs,elapsed_ms:0,from_ms:Date.parse(i.from),to_ms:Date.parse(i.to)},dark:o,height:500}),c&&l.data?.logs?.rows===0&&(0,V.jsx)(T,{c:`dimmed`,children:`No logs match this selection.`}),!c&&!i?.trace_id&&l.data&&(0,V.jsxs)(S,{gap:`xs`,children:[l.data.traces.length===0&&(0,V.jsx)(T,{c:`dimmed`,children:`No exemplar traces match this selection.`}),l.data.traces.map(e=>(0,V.jsxs)(C,{variant:`default`,justify:`space-between`,onClick:()=>a({...i,trace_id:e.trace_id,namespace:e.namespace}),children:[e.service,` · `,e.operation,` · `,e.duration_ms.toFixed(1),` ms`]},`${e.namespace}/${e.trace_id}`)),l.data.truncated&&(0,V.jsx)(T,{size:`xs`,c:`dimmed`,children:`Showing at most 20 exemplar traces.`})]}),u.data&&(0,V.jsx)(P8,{result:u.data,dark:o})]})}var R8={"5m":`Last 5 minutes`,"15m":`Last 15 minutes`,"1h":`Last hour`,"3h":`Last 3 hours`,"6h":`Last 6 hours`,"12h":`Last 12 hours`,"24h":`Last 24 hours`,"2d":`Last 2 days`,"7d":`Last 7 days`,"30d":`Last 30 days`};function z8(e){return e.from&&e.to?`${_e(e.from)} – ${_e(e.to)}`:R8[e.range??`1h`]??e.range??`Last hour`}function B8({time:e,refresh:t,compare:n,editing:r,fetching:i,updatedAt:a,onRange:o,onAbsolute:s,onZoomOut:c,onRefresh:l,onRefreshNow:u,onCompare:d,onEdit:f,onHistory:p,onShortcuts:m,selecting:h=!1}){let[g,_]=(0,B.useState)(``),[v,b]=(0,B.useState)(``),[x,S]=(0,B.useState)(!1);return(0,V.jsxs)(y,{gap:`xs`,wrap:`wrap`,role:`group`,"aria-label":`Dashboard controls`,children:[(0,V.jsxs)(Ye,{position:`bottom-end`,withinPortal:!0,opened:x,onChange:S,children:[(0,V.jsx)(Ye.Target,{children:(0,V.jsx)(C,{variant:`default`,size:`sm`,leftSection:(0,V.jsx)(Mi,{size:15}),rightSection:(0,V.jsx)(ve,{size:12,weight:`bold`}),children:z8(e)})}),(0,V.jsxs)(Ye.Dropdown,{miw:260,children:[(0,V.jsx)(Ye.Label,{children:`Relative`}),ft.map(t=>(0,V.jsx)(Ye.Item,{onClick:()=>o(t),fw:e.range===t?600:void 0,children:R8[t]},t)),(0,V.jsx)(Ye.Divider,{}),(0,V.jsx)(Ye.Label,{children:`Absolute (your time zone)`}),(0,V.jsxs)(y,{gap:6,px:`xs`,pb:`xs`,wrap:`nowrap`,children:[(0,V.jsx)(Me,{type:`datetime-local`,size:`xs`,"aria-label":`From`,value:g,onChange:e=>_(e.currentTarget.value)}),(0,V.jsx)(Me,{type:`datetime-local`,size:`xs`,"aria-label":`To`,value:v,onChange:e=>b(e.currentTarget.value)})]}),(0,V.jsx)(y,{px:`xs`,pb:`xs`,justify:`flex-end`,children:(0,V.jsx)(C,{size:`compact-sm`,disabled:!g||!v||g>=v,onClick:()=>{s(new Date(g).toISOString(),new Date(v).toISOString()),S(!1)},children:`Apply range`})})]})]}),(0,V.jsx)(he,{label:`Zoom out`,children:(0,V.jsx)(C,{variant:`default`,size:`sm`,px:10,"aria-label":`Zoom out`,onClick:c,children:(0,V.jsx)(Wi,{size:15})})}),(0,V.jsxs)(y,{"data-refresh-controls":!0,gap:4,wrap:`nowrap`,children:[(0,V.jsx)(he,{label:a?`Updated ${_e(a)}`:`Refresh now`,children:(0,V.jsx)(C,{variant:`default`,size:`sm`,px:10,"aria-label":`Refresh now`,loading:i,onClick:u,children:(0,V.jsx)(Si,{size:15})})}),(0,V.jsx)(Ur,{size:`xs`,"aria-label":`Auto refresh`,value:t,onChange:l,data:jt.map(e=>({value:e,label:e===`off`?`Off`:e}))})]}),(0,V.jsx)(si,{size:`sm`,label:`Compare with previous period`,checked:n,onChange:e=>d(e.currentTarget.checked)}),(0,V.jsx)(C,{variant:r?`filled`:`default`,size:`sm`,leftSection:(0,V.jsx)(Ve,{size:15}),onClick:f,children:r?`Done`:`Edit layout`}),(0,V.jsx)(C,{variant:`default`,size:`sm`,leftSection:(0,V.jsx)(Pi,{size:15}),onClick:p,children:`History`}),m&&(0,V.jsx)(P4,{onClick:m}),a&&(0,V.jsxs)(T,{size:`xs`,c:`dimmed`,visibleFrom:`md`,children:[`Updated `,new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`,second:`2-digit`}).format(a)]}),h&&(0,V.jsx)(T,{"data-range-paused":!0,size:`xs`,c:`dimmed`,role:`status`,children:`Paused while selecting`})]})}var V8=(e,t)=>!(t instanceof Ne&&t.status<500)&&e<2,H8=(e,t)=>!(t instanceof Ne&&t.code===`timeout`)&&V8(e,t),U8=e=>({panels:e.panels.map(({grid:e,...t})=>t),variables:e.variables,time:e.time,annotations:e.annotations});function W8(e,t,n,r,i){return[`panels`,JSON.stringify([e,U8(t),n,r,i])]}function G8(e,t,n,r){return[`variables`,e,U8(t),n,r]}async function K8(e,t){let n=await Xe(e,t),r=new Set(e.dashboard.panels.filter(e=>[`timeseries`,`heatmap`,`state_timeline`].includes(e.viz)).map(e=>e.id)),i=n.filter(e=>r.has(e.id)&&e.from_ms!==void 0&&e.to_ms!==void 0&&e.from_mse.from_ms)),o=Math.max(...i.map(e=>e.to_ms));try{return{results:n,annotations:await yt({from:new Date(a).toISOString(),to:new Date(o).toISOString()},t)}}catch(e){if(t?.aborted)throw e;return{results:n,annotation_error:e instanceof Error?e.message:`Annotations unavailable`}}}var q8={off:!1,"10s":1e4,"30s":3e4,"1m":6e4,"5m":3e5},J8=0;function Y8(e,t){let[n,r]=e.queryKey;if(n!==`panels`||typeof r!=`string`)return!1;try{return JSON.parse(r)[0]===t}catch{return!1}}function X8({dashboardId:e,spec:t,time:n,vars:r,compare:i,widths:a,visible:o,refresh:s,enabled:c=!0}){let l=(0,B.useMemo)(()=>Object.fromEntries(Object.entries(a).map(([e,t])=>[e,Math.max(100,Math.round(t/100)*100)])),[a]),u=W8(e,t,n,r,i),d=u[1],f=o.filter(e=>t.panels.some(t=>t.id===e)),p=(0,B.useRef)([]),m=(0,B.useRef)(void 0),h=(0,B.useRef)(null),g=(0,B.useRef)(!1),_=(0,B.useRef)(null),v=(0,B.useRef)({key:d,ids:new Set}),[y,b]=(0,B.useState)({key:d}),[x,S]=(0,B.useState)({key:d,results:new Map,updated:new Map,stale:new Set,receivedAt:0}),C=f.length===0&&x.key===d&&x.receivedAt>0,w=c&&t.panels.some(e=>e.viz!==`text`),T=st({queryKey:u,queryFn:({signal:e})=>{if(C&&h.current?.key!==d)return p.current=[],Promise.resolve({results:[],hasTimePanels:!1,batch:++J8});let a=h.current?.key===d?h.current.ids:f;p.current=(a.length?[...a]:t.panels.map(e=>e.id)).sort(),v.current.key!==d&&(v.current={key:d,ids:new Set});for(let e of p.current)v.current.ids.add(e);let o=[...p.current];return K8({dashboard:t,panels:o,time:n,vars:r,widths:l,compare:i},e).then(e=>{let n=new Set(e.results.map(e=>e.id)),r=o.filter(e=>!n.has(e)&&t.panels.find(t=>t.id===e)?.viz!==`text`).map(e=>({id:e,status:`error`,elapsed_ms:0,error:`No result was returned for this panel; refresh to retry.`,request_error:o}));return{...e,batch:++J8,results:[...e.results.map(e=>B4(e,o)),...r],hasTimePanels:t.panels.some(e=>o.includes(e.id)&&[`timeseries`,`heatmap`,`state_timeline`].includes(e.viz))}}).catch(n=>{throw e.aborted||(m.current={key:d,ids:o.filter(e=>t.panels.find(t=>t.id===e)?.viz!==`text`),error:n instanceof Error?n.message:String(n),retryable:!(n instanceof Ne)||n.status===408||n.status===429||n.status>=500}),n})},retry:H8,enabled:w,refetchInterval:C?!1:q8[s]??3e4,staleTime:5e3,placeholderData:e=>e}),E=T.error&&m.current?.key===d?m.current:void 0,D=(0,B.useMemo)(()=>Z8(x,d,T.isPlaceholderData?void 0:T.data?.results,T.dataUpdatedAt,T.data?.batch,E),[x,d,T.data,T.dataUpdatedAt,T.isPlaceholderData,T.error,T.errorUpdatedAt]),O=D.results,k=T.isPlaceholderData?void 0:T.data?.hasTimePanels?T.data:y.key===d?y:void 0;(0,B.useEffect)(()=>{!T.isPlaceholderData&&T.data?.hasTimePanels&&b({key:d,annotations:T.data.annotations,annotation_error:T.data.annotation_error})},[d,T.data,T.isPlaceholderData]),(0,B.useEffect)(()=>{T.isPlaceholderData||S(e=>Z8(e,d,T.data?.results,T.dataUpdatedAt,T.data?.batch,E))},[d,T.data,T.dataUpdatedAt,T.isPlaceholderData,T.error,T.errorUpdatedAt]);let A=new Map([...D.stale].flatMap(e=>{let t=D.updated.get(e);return t?[[e,t]]:[]})),j=(T.data?.results??[]).find(e=>e.status===`error`&&D.stale.has(e.id));(0,B.useEffect)(()=>{if(!w||T.isFetching||g.current||_.current?.key===d||h.current?.key===d)return;let e=v.current.key===d?v.current.ids:new Set,n=[...new Set(f.filter(n=>!O.has(n)&&!e.has(n)&&t.panels.find(e=>e.id===n)?.viz!==`text`))].sort();if(!n.length)return;let r={key:d,ids:n};h.current=r,T.refetch({cancelRefetch:!1}).finally(()=>{h.current===r&&(h.current=null)})},[o,w,d,T.isFetching,T.error,T.refetch,O,t.panels]),(0,B.useEffect)(()=>{!T.isFetching&&_.current?.key!==d&&g.current&&(g.current=!1,h.current=null,w&&!C&&T.refetch({cancelRefetch:!1}))},[T.isFetching,d,w,C,T.refetch]);let M=e=>{let t={key:d,ids:e};h.current=t,T.refetch({cancelRefetch:!1}).finally(()=>{h.current===t&&(h.current=null)})};return(0,B.useEffect)(()=>{if(T.isFetching||!_.current)return;let e=_.current;if(_.current=null,e.key!==d||!w)return;let n=[...e.ids].filter(e=>t.panels.some(t=>t.id===e&&t.viz!==`text`)&&O.get(e)?.request_error).sort();n.length&&M(n)},[T.isFetching,d,w,O,t.panels]),{retry:e=>{if(!w)return;let n=e?O.get(e)?.request_error??[]:[...O.values()].flatMap(e=>e.request_error??[]),r=[...new Set(n)].filter(e=>t.panels.some(t=>t.id===e&&t.viz!==`text`)&&O.get(e)?.request_error).sort();if(r.length){if(T.isFetching){_.current?.key!==d&&(_.current={key:d,ids:new Set});for(let e of r)_.current.ids.add(e);return}M(r)}},results:O,staleAt:A,annotations:k?.annotations,annotationError:k?.annotation_error,fetchingIds:T.isFetching?p.current:[],fetching:T.isFetching,error:T.error??(j?Error(j.error??`Panel refresh failed`):null),updatedAt:T.isPlaceholderData?null:T.dataUpdatedAt||null,refetch:()=>{if(w&&!C){if(T.isFetching){h.current?.key===d&&(g.current=!0);return}T.refetch({cancelRefetch:!1})}}}}function Z8(e,t,n,r,i,a){let o=e.key===t?{key:t,results:new Map(e.results),updated:new Map(e.updated),stale:new Set(e.stale),receivedAt:e.receivedAt,receivedBatch:e.receivedBatch}:{key:t,results:new Map,updated:new Map,stale:new Set,receivedAt:0};for(let e of n&&i!==o.receivedBatch?n:[])e.status===`error`&&o.results.get(e.id)?.frame?(o.stale.add(e.id),o.results.set(e.id,{...o.results.get(e.id),error:e.error,request_error:e.request_error})):(o.results.set(e.id,e),o.updated.set(e.id,r),o.stale.delete(e.id));n&&(o.receivedAt=r,o.receivedBatch=i);for(let e of a?.ids??[]){let t=o.results.get(e);t?.frame?(o.stale.add(e),o.results.set(e,{...t,error:a.error,request_error:a.retryable?a.ids:void 0})):o.results.set(e,{id:e,status:`error`,elapsed_ms:0,error:a.error,request_error:a.retryable?a.ids:void 0})}return o}function Q8(e,t){return e.queryKey[0]===`variables`&&e.queryKey[1]===t}function $8(e,t,n,r,i,a=!1){let o=!!t.variables?.some(e=>e.kind===`query`),s=st({queryKey:G8(e,t,n,r),queryFn:async({signal:e})=>{let a=await i({dashboard:t,time:n,vars:r},e);return Object.fromEntries((t.variables??[]).map(e=>[e.name,a[e.name]??(e.kind===`custom`?e.options?.map(e=>({value:e})):void 0)??[]]))},enabled:o,retry:a,staleTime:6e4,placeholderData:e=>e}),c=s.isPlaceholderData?void 0:s.data,l=s.isError||(t.variables??[]).every(e=>e.kind!==`query`||r[e.name]!==void 0&&r[e.name]!==`$__all`&&(e.multi||!Array.isArray(r[e.name])||r[e.name].length>0)||!!e.default||e.include_all||c?.[e.name]!==void 0);return{...s,currentData:c,ready:l}}function e5(e){return t=>Y8(t,e)||Q8(t,`dashboard-${e}`)}function t5({id:e,currentVersion:t,opened:n,onClose:r,onRestored:i}){let a=tt(),[o,s]=(0,B.useState)(),[c,l]=(0,B.useState)(``),[u,d]=(0,B.useState)(!1),[f,p]=(0,B.useState)(n),m=(0,B.useRef)(0),h=(0,B.useRef)(n);h.current=n;let g=(0,B.useRef)(!1),_=(0,B.useRef)(!1),v=(0,B.useRef)(i);v.current=i,(0,B.useEffect)(()=>(_.current=!0,()=>{_.current=!1}),[]);let y=Oe({mutationFn:({version:t})=>Ue(e,t),retry:!1,onSuccess:(t,{version:n,generation:r})=>{a.cancelQueries({queryKey:[`dashboard`,e],exact:!0}),a.cancelQueries({predicate:e5(e)}),a.cancelQueries({queryKey:[`exemplars`]}),a.cancelQueries({queryKey:[`drill-trace`]}),a.setQueryData([`dashboard`,e],t),a.invalidateQueries({predicate:e5(e),refetchType:`none`}),_.current&&(h.current&&r===m.current&&l(`Restored v${n} as v${t.version}`),v.current(t)),a.invalidateQueries({queryKey:Fe}),a.invalidateQueries({queryKey:[`dashboard-versions`,e]},{cancelRefetch:!1}),a.invalidateQueries({queryKey:[`exemplars`],refetchType:`none`}),a.invalidateQueries({queryKey:[`drill-trace`],refetchType:`none`})},onError:t=>{t instanceof Ne&&t.code===`dashboard_version_not_found`&&a.invalidateQueries({queryKey:[`dashboard-versions`,e]})},onSettled:()=>{g.current=!1,_.current&&d(!1)}}),b=()=>{m.current++,y.reset(),l(``)};(0,B.useEffect)(()=>{if(n){p(!0);return}m.current++,y.reset(),l(``),a.cancelQueries({queryKey:[`dashboard-versions`,e]}),a.cancelQueries({queryKey:[`dashboard-version`,e]})},[n,e,a,y.reset]);let x=(0,B.useRef)(t);return(0,B.useEffect)(()=>{x.current!==t&&(x.current=t,a.invalidateQueries({queryKey:[`dashboard-versions`,e]},{cancelRefetch:!1}))},[t,e,a]),(0,V.jsx)(et,{opened:n,onClose:()=>{b(),r()},onExitTransitionEnd:()=>p(!1),title:`Version history`,position:`right`,size:`xl`,children:(n||f)&&(0,V.jsx)(n5,{id:e,opened:n,currentVersion:t,selected:o,onSelect:e=>{b(),s(e)},pending:u,error:y.error,failedVersion:y.variables?.version,success:c,onRestore:e=>{g.current||(g.current=!0,d(!0),l(``),y.mutate({version:e,generation:m.current}))}})})}function n5({id:e,opened:t,currentVersion:n,selected:r,onSelect:i,pending:a,error:s,failedVersion:c,success:l,onRestore:u}){let d=st({queryKey:[`dashboard-versions`,e],queryFn:({signal:t})=>xt(e,t),enabled:t,retry:!1}),f=r??d.data?.[0]?.version,p=st({queryKey:[`dashboard-version`,e,f],queryFn:({signal:t})=>Ie(e,f,t),enabled:t&&f!==void 0,retry:!1});return(0,V.jsxs)(S,{gap:`md`,"data-version-history":!0,children:[(0,V.jsx)(T,{size:`sm`,c:`dimmed`,children:`Inspect saved specs and changes. Restoring adds a new version.`}),l&&(0,V.jsx)(ee,{color:`ok`,role:`status`,children:l}),s&&c===f&&(0,V.jsx)(o5,{error:s,version:f}),(0,V.jsxs)(o,{mih:160,children:[d.isPending&&(0,V.jsxs)(y,{gap:`xs`,role:`status`,children:[(0,V.jsx)(se,{size:`sm`}),(0,V.jsx)(T,{size:`sm`,children:`Loading history…`})]}),d.error&&(0,V.jsxs)(ee,{color:`bad`,title:`History unavailable`,children:[d.error.message,(0,V.jsx)(C,{mt:`xs`,variant:`default`,size:`xs`,onClick:()=>void d.refetch(),children:`Retry history`})]}),d.data?.length===0&&(0,V.jsx)(T,{c:`dimmed`,children:`No versions available.`}),!!d.data?.length&&(0,V.jsx)(me,{h:200,type:`auto`,children:(0,V.jsx)(S,{gap:`xs`,pr:`sm`,role:`list`,"aria-label":`Saved versions`,children:d.data.map(e=>(0,V.jsxs)(z,{role:`listitem`,withBorder:!0,p:`xs`,radius:`sm`,style:{borderColor:f===e.version?`var(--mantine-color-brand-filled)`:void 0},children:[(0,V.jsxs)(y,{justify:`space-between`,gap:`xs`,children:[(0,V.jsxs)(C,{variant:f===e.version?`light`:`subtle`,size:`compact-sm`,"aria-pressed":f===e.version,onClick:()=>i(e.version),children:[`Version `,e.version]}),e.version===n&&(0,V.jsx)(We,{color:`gray`,variant:`light`,tt:`none`,children:`Current`}),(0,V.jsx)(i5,{at:e.created_at})]}),(0,V.jsxs)(T,{size:`xs`,c:`dimmed`,mt:4,children:[r5(e),` · `,e.message||`No edit message`]})]},e.version))})})]}),(0,V.jsx)(He,{role:`status`,"aria-live":`polite`,children:f===void 0?`Select a version.`:p.isFetching?`Loading version ${f}…`:p.error?`Version ${f} unavailable.`:`Version ${f} ready.`}),(0,V.jsxs)(o,{mih:280,"aria-busy":p.isFetching,children:[f!==void 0&&p.isPending&&(0,V.jsxs)(y,{gap:`xs`,role:`status`,children:[(0,V.jsx)(se,{size:`sm`}),(0,V.jsx)(T,{size:`sm`,children:`Loading version…`})]}),p.error&&(0,V.jsxs)(ee,{color:`bad`,title:p.error instanceof Ne&&p.error.code===`dashboard_version_not_found`?`This version is no longer available`:`Version unavailable`,children:[p.error.message,(0,V.jsx)(C,{mt:`xs`,variant:`default`,size:`xs`,onClick:()=>void p.refetch(),children:`Retry version`})]}),p.data&&!p.error&&(0,V.jsx)(a5,{record:p.data,currentVersion:n,pending:a,onRestore:()=>u(p.data.dashboard.version)})]})]})}function r5(e){return e.author_kind===`agent`?`Agent`:e.author_kind===`user`?`You`:`System`}function i5({at:e}){let t=(Date.parse(e)-Date.now())/1e3,[n,r]=Math.abs(t)<60?[1,`second`]:Math.abs(t)<3600?[60,`minute`]:Math.abs(t)<86400?[3600,`hour`]:[86400,`day`];return(0,V.jsx)(T,{component:`time`,dateTime:e,title:_e(e),size:`xs`,c:`dimmed`,children:new Intl.RelativeTimeFormat(void 0,{numeric:`auto`}).format(Math.round(t/n),r)})}function a5({record:e,currentVersion:t,pending:n,onRestore:r}){let{dashboard:i}=e,a=ce(e);return(0,V.jsxs)(S,{gap:`sm`,"data-history-version":i.version,children:[(0,V.jsxs)(y,{justify:`space-between`,align:`flex-start`,children:[(0,V.jsxs)(o,{miw:0,children:[(0,V.jsxs)(I,{order:2,fz:`lg`,children:[i.name,` · v`,i.version]}),(0,V.jsxs)(T,{size:`sm`,c:`dimmed`,children:[r5(e),` · `,e.message||`No edit message`]}),(0,V.jsx)(i5,{at:e.created_at})]}),i.version===t?(0,V.jsx)(C,{size:`sm`,variant:`default`,disabled:!0,children:`Current version`}):(0,V.jsxs)(C,{size:`sm`,disabled:n,loading:n,onClick:r,children:[`Restore version `,i.version]})]}),i.description&&(0,V.jsx)(T,{size:`sm`,children:i.description}),e.changes_available?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Ee,{labels:a}),!a.length&&!e.layout_changed&&(0,V.jsx)(T,{size:`sm`,c:`dimmed`,children:`No authored changes.`})]}):(0,V.jsx)(ee,{color:`warn`,title:`Changes unavailable`,children:`The preceding version is no longer retained. This saved spec is still available.`}),(0,V.jsxs)(T,{size:`sm`,c:`dimmed`,children:[`Read-only · `,i.spec.panels.length,` panels. Historical data is not queried.`]}),(0,V.jsxs)(mn,{variant:`contained`,children:[(0,V.jsxs)(mn.Item,{value:`spec`,children:[(0,V.jsx)(mn.Control,{children:`Spec`}),(0,V.jsx)(mn.Panel,{children:(0,V.jsx)(ze,{block:!0,tabIndex:0,style:{maxHeight:320,overflow:`auto`},children:JSON.stringify(i.spec,null,2)})})]}),(0,V.jsxs)(mn.Item,{value:`data`,children:[(0,V.jsx)(mn.Control,{children:`Data`}),(0,V.jsx)(mn.Panel,{children:(0,V.jsx)(S,{gap:`xs`,children:i.spec.panels.map(e=>(0,V.jsxs)(o,{children:[(0,V.jsxs)(T,{size:`sm`,fw:500,children:[e.title,` · `,e.viz]}),(0,V.jsx)(ze,{block:!0,tabIndex:0,children:e.content??e.sql??JSON.stringify(e.query??{},null,2)})]},e.id))})})]})]})]})}function o5({error:e,version:t}){let n=e instanceof Ne?e.code:void 0,r=!(e instanceof Ne)||e.status>=500?`Try again with the restore button.`:n===`invalid_spec`?`This saved spec is invalid. Review the fields below and choose another version.`:n===`dashboard_version_not_found`?`Reload history and choose a retained version.`:[`already_current`,`dashboard_version_conflict`,`conflict`].includes(n??``)?`This dashboard changed or its name conflicts. Reload history and choose another version.`:`Check your access and reload history.`;return(0,V.jsxs)(ee,{color:`bad`,title:`Restore of version ${t} failed`,children:[(0,V.jsx)(T,{size:`sm`,children:e.message}),e instanceof Ne&&e.problems.length>0&&(0,V.jsx)(`ul`,{children:e.problems.map((e,t)=>(0,V.jsxs)(`li`,{children:[e.path,`: `,e.message,e.hint?` (${e.hint})`:``]},t))}),(0,V.jsx)(T,{size:`sm`,mt:`xs`,children:r})]})}function s5(e,t){let n=JSON.stringify([e.range,e.from,e.to]),r=(0,B.useRef)({search:e,onSearch:t,scope:n}),i=(0,B.useRef)(``),a=(0,B.useRef)(void 0),[o,s]=(0,B.useState)(!1);r.current.scope!==n&&(i.current!==`${e.from}/${e.to}`&&(a.current=void 0,o&&s(!1)),i.current=``),r.current={search:e,onSearch:t,scope:n};let c=(0,B.useCallback)(()=>{i.current=``,a.current=void 0,s(!1)},[]),l=(0,B.useCallback)(()=>{if(!a.current)return;let e=a.current;c(),r.current.onSearch({...r.current.search,...e},!1)},[c]);return{zoom:(0,B.useCallback)((e,t)=>{let n=sa(e,t);if(!n)return;let o=r.current,c=`${n.from}/${n.to}`;o.search.from===n.from&&o.search.to===n.to||i.current===c||(a.current??={range:o.search.range,from:o.search.from,to:o.search.to},s(!0),i.current=c,o.onSearch({...o.search,range:void 0,...n},!1))},[]),reset:c,resetZoom:l,zoomed:o}}function c5({variables:e,vars:t,options:n,onChange:r}){return e.length===0?null:(0,V.jsx)(y,{gap:`sm`,wrap:`wrap`,role:`group`,"aria-label":`Dashboard variables`,children:e.map(e=>{let i=Yi(e,t,n[e.name]),a=[...e.include_all?[{value:Ji,label:`All`}]:[],...(n[e.name]??e.options?.map(e=>({value:e}))??[]).map(e=>({value:e.value,label:e.value}))],o=(0,V.jsxs)(T,{size:`xs`,c:`dimmed`,ff:`monospace`,children:[`$`,e.name]});return e.kind===`constant`?(0,V.jsx)(Me,{label:o,size:`xs`,value:e.value,readOnly:!0,w:160},e.name):e.kind===`text`?(0,V.jsx)(Me,{label:o,size:`xs`,w:200,defaultValue:typeof i==`string`?i:``,onBlur:t=>r(e.name,t.currentTarget.value),onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur()}},`${e.name}:${JSON.stringify(i)}`):e.multi?(0,V.jsx)(Ar,{label:o,size:`xs`,w:260,searchable:!0,clearable:!0,data:a.filter(e=>e.value!==Ji),value:Array.isArray(i)?i:i&&i!==`$__all`?[i]:[],placeholder:e.include_all?`All`:`None`,onChange:t=>r(e.name,t.length?t:e.include_all?Ji:[])},e.name):(0,V.jsx)(Gr,{label:o,size:`xs`,w:220,searchable:!0,allowDeselect:!1,data:a,value:Array.isArray(i)?i[0]??null:i||null,onChange:t=>t!==null&&r(e.name,t)},e.name)})})}function l5(e,t,n=!1){let r=e.target;return t||e.defaultPrevented||e.repeat||e.ctrlKey||e.metaKey||e.altKey||e.shiftKey&&e.key!==`?`||r instanceof Element&&r.closest(`input,textarea,select,[contenteditable]:not([contenteditable="false"]),[role="textbox"],[role="menu"]`)||r instanceof Element&&r.closest(`[role="dialog"]`)&&!(n&&r.closest(`[data-panel-fullscreen]`))?null:[`r`,`e`,`h`,`f`,`?`].includes(e.key)?e.key:null}function u5(e,t,n={}){let r=(0,B.useRef)({actions:t,options:n});r.current={actions:t,options:n},(0,B.useEffect)(()=>{let t=t=>{let n=e.current,i=t.target,{actions:a,options:o}=r.current;if(!n||!(i instanceof Element)||o.enabled===!1)return;let s=o.fullscreenScope?[...document.querySelectorAll(`[data-shortcut-scope]`)].find(e=>e.dataset.shortcutScope===o.fullscreenScope&&e.hasAttribute(`data-panel-fullscreen`)):void 0,c=n.contains(i)&&n.contains(document.activeElement),l=i===document.body&&document.activeElement===document.body,u=s?.contains(i)&&s.contains(document.activeElement);if(!c&&!l&&!u)return;let d=l5(t,!!(o.modalOpen||[...document.querySelectorAll(`[role="dialog"]`)].some(e=>e!==s)),!!s);if(!d||s&&![`r`,`f`,`?`].includes(d))return;let f=a[d];f&&(t.preventDefault(),f(i))};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[e])}function d5({opened:e,onClose:t,fullscreen:n=!1,enabled:r,onEnabled:i}){let a=[[`r`,`Refresh now`],...n?[]:[[`e`,`Toggle layout mode`],[`h`,`Open history`]],[`f`,n?`Exit full-screen`:`Open the focused panel in full-screen`],[`?`,`Open keyboard shortcuts`],[`Escape`,`Cancel a range, then leave the chart or close full-screen`]];return(0,V.jsx)(bt,{opened:e,onClose:t,title:`Keyboard shortcuts`,trapFocus:!0,returnFocus:!0,closeOnEscape:!0,children:(0,V.jsxs)(S,{gap:`xs`,children:[(0,V.jsx)(si,{label:`Single-key shortcuts`,checked:r,onChange:e=>i(e.currentTarget.checked)}),a.map(([e,t])=>(0,V.jsxs)(y,{gap:`sm`,children:[(0,V.jsx)(Ze,{children:e}),(0,V.jsx)(T,{size:`sm`,children:t})]},e)),!n&&(0,V.jsx)(T,{size:`sm`,children:`Focus a chart or a panel control before pressing f. Without a focused panel, f does nothing.`}),(0,V.jsx)(T,{size:`sm`,children:`Tab directly to a chart. Left/Right moves between points; Up/Down changes series at the same time or category. Home/End jumps to the first/last point. Enter drills or applies the panel filter. Comparison and Other values can be read even when selection is unavailable.`}),(0,V.jsx)(T,{size:`sm`,children:`On time charts, Shift+Left/Right extends a range and pauses auto-refresh. Review the shaded range and compact UTC label, then choose Zoom to range. Use the time picker after zooming for precise edits. Escape or Cancel cancels it and resumes refresh. The next Escape leaves the chart or closes full-screen. Reset zoom, Zoom out and browser Back preserve comparison and filters.`}),(0,V.jsxs)(T,{size:`sm`,children:[n?`In full-screen, r refreshes, f exits and ? opens help; e and h are inactive.`:`Shortcuts work in the dashboard.`,` Typing, menus and other dialogs or drawers pause shortcuts. Modifier shortcuts keep their browser behavior. Turning off single-key shortcuts keeps chart navigation and visible controls available.`]}),(0,V.jsx)(T,{size:`sm`,children:`The global / shortcut focuses the chat composer.`})]})})}function f5(e){let t=`fanout:single-key-shortcuts:`+e,n=()=>{try{return localStorage.getItem(t)!==`off`}catch{return!0}},[r,i]=(0,B.useState)(n);return(0,B.useEffect)(()=>{i(n())},[t]),(0,B.useEffect)(()=>{let e=e=>{e.key===t&&i(n())};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[t]),{enabled:r,change:e=>{i(e);try{localStorage.setItem(t,e?`on`:`off`)}catch{}}}}function p5(e){let t=(0,B.useRef)(void 0),n=t=>[...e.current?.querySelectorAll(`[data-panel]`)??[]].find(e=>e.dataset.panel===t&&!e.closest(`[data-panel-fullscreen],[data-fragment-fullscreen]`));return(0,B.useEffect)(()=>{t.current&&!n(t.current.panel)&&(t.current=void 0)}),{remember(n){t.current=void 0;let r=document.activeElement;if(!(r instanceof HTMLElement)||!e.current?.contains(r)||r.closest(`[data-panel]`)?.dataset.panel!==n)return;let i=r.getAttribute(`data-panel-view`),a=r.getAttribute(`aria-label`),o=r.hasAttribute(`data-chart-plot`)?`[data-chart-plot]`:i?`[data-panel-view=${JSON.stringify(i)}]`:a?`[aria-label=${JSON.stringify(a)}]`:void 0;t.current={element:r,panel:n,selector:o}},restore(e){let r=t.current;if(t.current=void 0,r&&(e===void 0||r.panel===e)&&n(r.panel))return r.element.isConnected&&!r.element.closest(`[hidden]`)?r.element:r.selector?n(r.panel)?.querySelector(r.selector)??void 0:void 0}}}var m5={exemplars:Je,trace:Le},h5={"5m":`15m`,"15m":`1h`,"1h":`3h`,"3h":`6h`,"6h":`12h`,"12h":`24h`,"24h":`2d`,"2d":`7d`,"7d":`30d`,"30d":`30d`};function g5({dashboardId:e,search:t,onSearch:n,onOpen:r}){let{agentAvailable:i,openChat:a}=le(),o=st({queryKey:Fe,queryFn:Qe,staleTime:15e3});(0,B.useEffect)(()=>{!e&&o.data?.length&&r((o.data.find(e=>e.is_default)??o.data[0]).id,!0)},[e,o.data]);let s=st({queryKey:[`dashboard`,e],queryFn:({signal:t})=>Mt(e,t),enabled:!!e,retry:(e,t)=>!(t instanceof Ne&&t.code===`not_found`)&&e<2});return!e&&o.error?(0,V.jsx)(ae,{mih:`50vh`,children:(0,V.jsx)(ee,{color:`bad`,title:`Dashboards could not be loaded`,children:o.error.message})}):!e&&o.data?.length===0?(0,V.jsx)(ae,{mih:`50vh`,children:(0,V.jsxs)(S,{align:`center`,gap:`xs`,children:[(0,V.jsx)(I,{order:1,fz:24,children:`No dashboards yet`}),(0,V.jsx)(T,{c:`dimmed`,size:`sm`,ta:`center`,children:`Create a dashboard to explore your services.`}),i&&(0,V.jsx)(C,{mt:`sm`,size:`sm`,onClick:()=>a(`Build me a dashboard for my services, showing request volume, latency, and errors. Ask me which services to monitor first.`),children:`Create with AI`})]})}):!e||s.isLoading?(0,V.jsxs)(ae,{mih:`50vh`,children:[(0,V.jsx)(se,{size:`sm`}),(0,V.jsx)(T,{c:`dimmed`,size:`sm`,ml:`sm`,children:`Loading your dashboard…`})]}):s.error instanceof Ne&&s.error.code===`not_found`?(0,V.jsx)(ae,{mih:`50vh`,children:(0,V.jsxs)(S,{align:`center`,gap:`xs`,children:[(0,V.jsx)(I,{order:1,fz:24,children:`This dashboard isn't here`}),(0,V.jsx)(T,{c:`dimmed`,size:`sm`,ta:`center`,children:`The link may be out of date, or the dashboard may have been deleted.`}),o.data?.length?(0,V.jsx)(C,{mt:`sm`,variant:`default`,size:`sm`,onClick:()=>r((o.data.find(e=>e.is_default)??o.data[0]).id,!0),children:`Open your default dashboard`}):null]})}):s.error||!s.data?(0,V.jsx)(ae,{mih:`50vh`,children:(0,V.jsx)(T,{c:`dimmed`,size:`sm`,children:`Your dashboard is unavailable. Try refreshing.`})}):(0,V.jsx)(_5,{id:s.data.id,version:s.data.version,spec:s.data.spec,search:t,onSearch:n,agentAvailable:i,openChat:a},s.data.id)}function _5({id:e,version:t,spec:n,search:r,onSearch:i,agentAvailable:a,openChat:s}){let[c,l]=(0,B.useState)(!1),[u,d]=(0,B.useState)(!1),f=(0,B.useRef)(null),p=(0,B.useId)(),m=f5(nt().id),h=p5(f),[g,_]=(0,B.useState)(()=>new Set),v=(0,B.useCallback)((e,t)=>_(n=>{if(n.has(e)===t)return n;let r=new Set(n);return t?r.add(e):r.delete(e),r}),[]),b=tt(),[x,w]=(0,B.useState)(),{zoom:E,reset:D,resetZoom:O,zoomed:k}=s5(r,i),A=_t(n,r),[j,M]=(0,B.useState)(A.refresh??`30s`),N=r.compare?r.compare===`1`:n.time.compare===`previous_period`,P=r.vars??{},F=$8(`dashboard-${e}`,n,A,P,Re,V8),L=(0,B.useMemo)(()=>Zi(n.variables,P,F.currentData),[n.variables,P,F.currentData]),[te,ne]=(0,B.useState)(()=>window.innerWidth);(0,B.useEffect)(()=>{let e=0,t=()=>{window.clearTimeout(e),e=window.setTimeout(()=>ne(window.innerWidth),300)};return window.addEventListener(`resize`,t),()=>{window.removeEventListener(`resize`,t),window.clearTimeout(e)}},[]);let re=(0,B.useMemo)(()=>{let e=Math.max(320,Math.min(te-64,1600));return Object.fromEntries(n.panels.map(t=>[t.id,e/12*(t.grid?.w??t.width??6)]))},[te,n]),[ie,ae]=(0,B.useState)(()=>n.panels.map(e=>e.id)),R=X8({dashboardId:e,version:t,spec:n,time:A,vars:L,compare:N,widths:re,visible:(0,B.useMemo)(()=>ie.filter(e=>n.panels.some(t=>t.id===e)),[ie,n.panels]),refresh:g.size?`off`:j,enabled:F.ready});(0,B.useEffect)(()=>{x===t&&b.refetchQueries({predicate:e5(e),type:`active`,stale:!0},{cancelRefetch:!1})},[x,t,e,b]);let oe=(0,B.useMemo)(()=>R.annotations?{...R.annotations,deploys:n.annotations?.deploys===!1?[]:R.annotations.deploys,anomalies:n.annotations?.anomalies===!1?[]:R.annotations.anomalies}:void 0,[R.annotations,n.annotations?.deploys,n.annotations?.anomalies]),z=F.error??R.error,se=(e,t)=>{let n={...P};t===void 0?delete n[e]:n[e]=t,i({...r,vars:n},!0)},ce=()=>i({...r,edit:r.edit===`1`?void 0:`1`}),le=e=>{e&&h.remember(e),i({...r,view:e},e===void 0)};return u5(f,{r:()=>R.refetch(),e:ce,h:()=>l(!0),"?":()=>d(!0),f:e=>{if(r.view){le();return}let t=e.closest(`[data-panel]`)?.dataset.panel;t&&n.panels.some(e=>e.id===t)&&le(t)}},{modalOpen:c||u||!!r.drill,fullscreenScope:r.view?p:void 0,enabled:m.enabled}),(0,V.jsxs)(o,{component:`main`,ref:f,"aria-label":`Dashboard`,maw:1600,mx:`auto`,px:{base:`md`,sm:`xl`},pt:`lg`,pb:`xl`,children:[(0,V.jsxs)(S,{gap:`sm`,mb:`md`,children:[(0,V.jsxs)(y,{justify:`space-between`,align:`flex-start`,wrap:`wrap`,gap:`sm`,children:[(0,V.jsxs)(o,{miw:0,children:[(0,V.jsx)(I,{order:1,fz:28,lts:`-0.02em`,children:n.name}),n.description&&(0,V.jsx)(T,{c:`dimmed`,size:`sm`,mt:2,children:n.description})]}),(0,V.jsx)(B8,{selecting:g.size>0,time:A,refresh:j,compare:N,editing:r.edit===`1`,fetching:R.fetching,updatedAt:R.updatedAt,onRange:e=>{D(),i({...r,range:e,from:void 0,to:void 0})},onAbsolute:(e,t)=>{D(),i({...r,range:void 0,from:e,to:t})},onZoomOut:()=>{if(A.from&&A.to){let e=Date.parse(A.from),t=Date.parse(A.to),n=(t-e)/2;i({...r,range:void 0,from:new Date(e-n).toISOString(),to:new Date(t+n).toISOString()})}else i({...r,range:h5[A.range??`1h`]??`1h`,from:void 0,to:void 0})},onRefresh:M,onRefreshNow:R.refetch,onCompare:e=>i({...r,compare:e?`1`:`0`},!0),onEdit:ce,onHistory:()=>l(!0),onShortcuts:()=>d(!0)})]}),(0,V.jsx)(c5,{variables:n.variables??[],vars:P,options:F.data??{},onChange:se}),Object.entries(P).filter(([,e])=>e!==`$__all`).length>0&&(0,V.jsx)(y,{gap:6,children:Object.entries(P).filter(([,e])=>e!==`$__all`).map(([e,t])=>(0,V.jsxs)(C,{size:`compact-xs`,variant:`light`,"aria-label":`$${e} = ${Array.isArray(t)?t.join(`, `):t} ×: remove filter`,onClick:()=>se(e,void 0),children:[`$`,e,` = `,Array.isArray(t)?t.join(`, `):t,` ×`]},e))}),R.annotationError&&(0,V.jsx)(ee,{color:`warn`,title:`Annotations unavailable`,children:R.annotationError}),R.annotations?.truncated&&(0,V.jsx)(T,{size:`xs`,c:`warn`,role:`status`,children:`Annotation history is limited.`})]}),z&&(0,V.jsxs)(ee,{color:`bad`,icon:(0,V.jsx)(Ae,{size:18,weight:`fill`}),mb:`md`,title:F.error?`Variables could not be loaded`:`Panels could not be loaded`,children:[z.message,z instanceof Ne&&(0,V.jsx)(`ul`,{children:z.problems.map((e,t)=>(0,V.jsxs)(`li`,{children:[e.path,`: `,e.message,e.hint?` (${e.hint})`:``]},t))})]}),(0,V.jsx)(O8,{dashboardId:e,version:t,spec:n,vars:L,results:R.results,annotations:oe,fetching:R.fetching,fetchingIds:R.fetchingIds,staleAt:R.staleAt,time:{...A,compare:N?`previous_period`:void 0},onEditExit:()=>i({...r,edit:void 0}),editing:r.edit===`1`,view:r.view,canManage:!0,agentAvailable:a,onOpenChat:s,onRetry:R.retry,onVariable:se,onZoom:E,zoomed:k,onZoomReset:O,onView:le,onRangePending:v,shortcutScope:p,onShortcuts:()=>d(!0),overlayOpen:c||u||!!r.drill,returnViewFocus:h.restore,onVisible:ae,onPoint:(e,t)=>{let n=v8(e,R.results.get(e.id),t,P);n&&i({...r,vars:n.vars,drill:JSON.stringify(n.target)},!1)}}),(0,V.jsx)(L8,{client:m5,spec:n,time:A,vars:L,target:Nt(r.drill),onChange:e=>i({...r,drill:e?JSON.stringify(e):void 0},!1)}),(0,V.jsx)(t5,{id:e,currentVersion:t,opened:c,onClose:()=>l(!1),onRestored:e=>{w(e.version);let t=new Set(e.spec.panels.map(e=>e.id)),n=Nt(r.drill),a=r.view&&!t.has(r.view)?void 0:r.view,o=n&&!t.has(n.panel_id)?void 0:r.drill;(a!==r.view||o!==r.drill)&&i({...r,view:a,drill:o},!0)}}),(0,V.jsx)(d5,{opened:u,onClose:()=>d(!1),fullscreen:!!r.view,enabled:m.enabled,onEnabled:m.change})]})}export{Xi as i,B4 as n,L4 as r,g5 as t}; \ No newline at end of file +`,e.getElementsByTagName(`head`)[0].appendChild(n)}e.body&&ce(e.body,`react-draggable-transparent-selection`)}function z(e){window.requestAnimationFrame?window.requestAnimationFrame(()=>{se(e)}):se(e)}function se(e){if(e)try{e.body&&le(e.body,`react-draggable-transparent-selection`);let t=e.selection;if(t)t.empty();else{let t=(e.defaultView||window).getSelection();t&&t.type!==`Caret`&&t.removeAllRanges()}}catch{}}function ce(e,t){e.classList?e.classList.add(t):e.className.match(RegExp(`(?:^|\\s)${t}(?!\\S)`))||(e.className+=` ${t}`)}function le(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(RegExp(`(?:^|\\s)${t}(?!\\S)`,`g`),``)}function ue(e,t,n){if(!e.props.bounds)return[t,n];let{bounds:r}=e.props;r=typeof r==`string`?r:_e(r);let i=ve(e);if(typeof r==`string`){let{ownerDocument:e}=i,t=e.defaultView;if(!t)throw Error(`Cannot resolve the owner window of the draggable node.`);let n;if(n=r===`parent`?i.parentNode:i.getRootNode().querySelector(r),!(n instanceof t.HTMLElement))throw Error(`Bounds selector "`+r+`" could not find an element.`);let a=n,o=t.getComputedStyle(i),s=t.getComputedStyle(a);r={left:-i.offsetLeft+S(s.paddingLeft)+S(o.marginLeft),top:-i.offsetTop+S(s.paddingTop)+S(o.marginTop),right:L(a)-F(i)-i.offsetLeft+S(s.paddingRight)-S(o.marginRight),bottom:I(a)-P(i)-i.offsetTop+S(s.paddingBottom)-S(o.marginBottom)}}return x(r.right)&&(t=Math.min(t,r.right)),x(r.bottom)&&(n=Math.min(n,r.bottom)),x(r.left)&&(t=Math.max(t,r.left)),x(r.top)&&(n=Math.max(n,r.top)),[t,n]}function de(e,t,n){return[Math.round(t/e[0])*e[0],Math.round(n/e[1])*e[1]]}function fe(e){return e.props.axis===`both`||e.props.axis===`x`}function pe(e){return e.props.axis===`both`||e.props.axis===`y`}function me(e,t,n){let r=typeof t==`number`?ie(e,t):null;if(typeof t==`number`&&!r)return null;let i=ve(n),a=n.props.offsetParent||i.offsetParent||i.ownerDocument.body;return ee(r||e,a,n.props.scale)}function he(e,t,n){let r=!x(e.lastX),i=ve(e);return r?{node:i,deltaX:0,deltaY:0,lastX:t,lastY:n,x:t,y:n}:{node:i,deltaX:t-e.lastX,deltaY:n-e.lastY,lastX:e.lastX,lastY:e.lastY,x:t,y:n}}function ge(e,t){let n=e.props.scale;return{node:t.node,x:e.state.x+t.deltaX/n,y:e.state.y+t.deltaY/n,deltaX:t.deltaX/n,deltaY:t.deltaY/n,lastX:e.state.x,lastY:e.state.y}}function _e(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function ve(e){let t=e.findDOMNode();if(!t)throw Error(`: Unmounted during event!`);return t}var ye=d(t()),be=d(X3()),xe=d(b()),Se=typeof process<`u`&&{}.DRAGGABLE_DEBUG?console.log.bind(console):function(){},Ce={touch:{start:`touchstart`,move:`touchmove`,stop:`touchend`},mouse:{start:`mousedown`,move:`mousemove`,stop:`mouseup`}},we=Ce.mouse,Te=class extends ye.Component{constructor(){super(...arguments),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,this.touchIdentifier=null,this.mounted=!1,this.handleDragStart=e=>{if(this.props.onMouseDown(e),!this.props.allowAnyClick&&(typeof e.button==`number`&&e.button!==0||e.ctrlKey))return!1;let t=this.findDOMNode();if(!t||!t.ownerDocument||!t.ownerDocument.body)throw Error(` not mounted on DragStart!`);let{ownerDocument:n}=t;if(this.props.disabled||!(e.target instanceof n.defaultView.Node)||this.props.handle&&!j(e.target,this.props.handle,t)||this.props.cancel&&j(e.target,this.props.cancel,t))return;e.type===`touchstart`&&!this.props.allowMobileScroll&&e.preventDefault();let r=ae(e);this.touchIdentifier=r;let i=me(e,r,this);if(i==null)return;let{x:a,y:o}=i,s=he(this,a,o);Se(`DraggableCore: handleDragStart: %j`,s),Se(`calling`,this.props.onStart),this.props.onStart(e,s)!==!1&&this.mounted!==!1&&(this.props.enableUserSelectHack&&oe(n,this.props.nonce),this.dragging=!0,this.lastX=a,this.lastY=o,M(n,we.move,this.handleDrag),M(n,we.stop,this.handleDragStop))},this.handleDrag=e=>{let t=me(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX,t=r-this.lastY;if([e,t]=de(this.props.grid,e,t),!e&&!t)return;n=this.lastX+e,r=this.lastY+t}let i=he(this,n,r);if(Se(`DraggableCore: handleDrag: %j`,i),this.props.onDrag(e,i)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent(`mouseup`))}catch{let e=document.createEvent(`MouseEvents`);e.initMouseEvent(`mouseup`,!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(e)}return}this.lastX=n,this.lastY=r},this.handleDragStop=e=>{if(!this.dragging)return;let t=me(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:r}=t;if(Array.isArray(this.props.grid)){let e=n-this.lastX||0,t=r-this.lastY||0;[e,t]=de(this.props.grid,e,t),n=this.lastX+e,r=this.lastY+t}let i=he(this,n,r);if(this.props.onStop(e,i)===!1||this.mounted===!1)return!1;let a=this.findDOMNode();a&&this.props.enableUserSelectHack&&z(a.ownerDocument),Se(`DraggableCore: handleDragStop: %j`,i),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,a&&(Se(`DraggableCore: Removing handlers`),N(a.ownerDocument,we.move,this.handleDrag),N(a.ownerDocument,we.stop,this.handleDragStop))},this.onMouseDown=e=>(we=Ce.mouse,this.handleDragStart(e)),this.onMouseUp=e=>(we=Ce.mouse,this.handleDragStop(e)),this.onTouchStart=e=>(we=Ce.touch,this.handleDragStart(e)),this.onTouchEnd=e=>(we=Ce.touch,this.handleDragStop(e))}componentDidMount(){this.mounted=!0;let e=this.findDOMNode();e&&M(e,Ce.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;let e=this.findDOMNode();if(e){let{ownerDocument:t}=e;N(t,Ce.mouse.move,this.handleDrag),N(t,Ce.touch.move,this.handleDrag),N(t,Ce.mouse.stop,this.handleDragStop),N(t,Ce.touch.stop,this.handleDragStop),N(e,Ce.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&z(t)}}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=xe.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):(Se(`react-draggable: ReactDOM.findDOMNode is not available in React 19+. You must provide a nodeRef prop. See: https://github.com/react-grid-layout/react-draggable#noderef`),null)}render(){return ye.cloneElement(ye.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};Te.displayName=`DraggableCore`,Te.propTypes={allowAnyClick:be.default.bool,allowMobileScroll:be.default.bool,children:be.default.node.isRequired,disabled:be.default.bool,enableUserSelectHack:be.default.bool,offsetParent:function(e,t){if(e[t]&&e[t].nodeType!==1)throw Error(`Draggable's offsetParent must be a DOM Node.`)},grid:be.default.arrayOf(be.default.number),handle:be.default.string,cancel:be.default.string,nodeRef:be.default.object,nonce:be.default.string,onStart:be.default.func,onDrag:be.default.func,onStop:be.default.func,onMouseDown:be.default.func,scale:be.default.number,className:C,style:C,transform:C},Te.defaultProps={allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1};var Ee=class extends m.Component{constructor(e){super(e),this.onDragStart=(e,t)=>{if(Se(`Draggable: onDragStart: %j`,t),this.props.onStart(e,ge(this,t))===!1)return!1;this.setState({dragging:!0,dragged:!0})},this.onDrag=(e,t)=>{if(!this.state.dragging)return!1;Se(`Draggable: onDrag: %j`,t);let n=ge(this,t),r={x:n.x,y:n.y,slackX:0,slackY:0};if(this.props.bounds){let{x:e,y:t}=r;r.x+=this.state.slackX,r.y+=this.state.slackY;let[i,a]=ue(this,r.x,r.y);r.x=i,r.y=a,r.slackX=this.state.slackX+(e-r.x),r.slackY=this.state.slackY+(t-r.y),n.x=r.x,n.y=r.y,n.deltaX=r.x-this.state.x,n.deltaY=r.y-this.state.y}if(this.props.onDrag(e,n)===!1)return!1;this.setState(r)},this.onDragStop=(e,t)=>{if(!this.state.dragging||this.props.onStop(e,ge(this,t))===!1)return!1;Se(`Draggable: onDragStop: %j`,t);let n={dragging:!1,slackX:0,slackY:0};if(this.props.position){let{x:e,y:t}=this.props.position;n.x=e,n.y=t}this.setState(n)},this.state={dragging:!1,dragged:!1,x:e.position?e.position.x:e.defaultPosition.x,y:e.position?e.position.y:e.defaultPosition.y,prevPropsPosition:{...e.position},slackX:0,slackY:0,isElementSVG:!1},e.position&&!(e.onDrag||e.onStop)&&console.warn("A `position` was applied to this , without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}static getDerivedStateFromProps({position:e},{prevPropsPosition:t}){return e&&(!t||e.x!==t.x||e.y!==t.y)?(Se(`Draggable: getDerivedStateFromProps %j`,{position:e,prevPropsPosition:t}),{x:e.x,y:e.y,prevPropsPosition:{...e}}):null}componentDidMount(){window.SVGElement!==void 0&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.state.dragging&&this.setState({dragging:!1})}findDOMNode(){if(this.props?.nodeRef)return this.props.nodeRef.current;let e=g.default;return typeof e.findDOMNode==`function`?e.findDOMNode(this):null}render(){let{axis:e,bounds:t,children:n,defaultPosition:r,defaultClassName:i,defaultClassNameDragging:a,defaultClassNameDragged:o,position:s,positionOffset:c,scale:l,...u}=this.props,d={},f=null,p=!s||this.state.dragging,h=s||r,g={x:fe(this)&&p?this.state.x:h.x,y:pe(this)&&p?this.state.y:h.y};this.state.isElementSVG?f=ne(g,c):d=te(g,c);let v=m.Children.only(n),y=(0,_.clsx)(v.props.className||``,i,{[a]:this.state.dragging,[o]:this.state.dragged});return m.createElement(Te,{...u,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop},m.cloneElement(v,{className:y,style:{...v.props.style,...d},transform:f}))}};Ee.displayName=`Draggable`,Ee.propTypes={...Te.propTypes,axis:h.default.oneOf([`both`,`x`,`y`,`none`]),bounds:h.default.oneOfType([h.default.shape({left:h.default.number,right:h.default.number,top:h.default.number,bottom:h.default.number}),h.default.string,h.default.oneOf([!1])]),defaultClassName:h.default.string,defaultClassNameDragging:h.default.string,defaultClassNameDragged:h.default.string,defaultPosition:h.default.shape({x:h.default.number,y:h.default.number}),positionOffset:h.default.shape({x:h.default.oneOfType([h.default.number,h.default.string]),y:h.default.oneOfType([h.default.number,h.default.string])}),position:h.default.shape({x:h.default.number,y:h.default.number}),className:C,style:C,transform:C},Ee.defaultProps={...Te.defaultProps,axis:`both`,bounds:!1,defaultClassName:`react-draggable`,defaultClassNameDragging:`react-draggable-dragging`,defaultClassNameDragged:`react-draggable-dragged`,defaultPosition:{x:0,y:0},scale:1},0&&(n.exports={DraggableCore:Te})})),G6=e(((e,t)=>{var n=W6(),r=n.DraggableCore,i=n.default||n;t.exports=i,t.exports.default=i,t.exports.DraggableCore=r})),K6=e((e=>{e.__esModule=!0,e.cloneElement=l;var n=r(t());function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function a(e){for(var t=1;t{e.__esModule=!0,e.resizableProps=void 0;var t=n(X3());G6();function n(e){return e&&e.__esModule?e:{default:e}}e.resizableProps={axis:t.default.oneOf([`both`,`x`,`y`,`none`]),className:t.default.string,children:t.default.element.isRequired,draggableOpts:t.default.shape({allowAnyClick:t.default.bool,cancel:t.default.string,children:t.default.node,disabled:t.default.bool,enableUserSelectHack:t.default.bool,offsetParent:typeof Element<`u`?t.default.instanceOf(Element):t.default.any,grid:t.default.arrayOf(t.default.number),handle:t.default.string,nodeRef:t.default.object,onStart:t.default.func,onDrag:t.default.func,onStop:t.default.func,onMouseDown:t.default.func,scale:t.default.number}),height:function(){var e=[...arguments];let n=e[0];return n.axis===`both`||n.axis===`y`?t.default.number.isRequired(...e):t.default.number(...e)},handle:t.default.oneOfType([t.default.node,t.default.func]),handleSize:t.default.arrayOf(t.default.number),lockAspectRatio:t.default.bool,maxConstraints:t.default.arrayOf(t.default.number),minConstraints:t.default.arrayOf(t.default.number),onResizeStop:t.default.func,onResizeStart:t.default.func,onResize:t.default.func,resizeHandles:t.default.arrayOf(t.default.oneOf([`s`,`w`,`e`,`n`,`sw`,`nw`,`se`,`ne`])),transformScale:t.default.number,width:function(){var e=[...arguments];let n=e[0];return n.axis===`both`||n.axis===`x`?t.default.number.isRequired(...e):t.default.number(...e)}}})),J6=e((e=>{e.__esModule=!0,e.default=void 0;var n=s(t()),r=G6(),i=K6(),a=q6(),o=[`children`,`className`,`draggableOpts`,`width`,`height`,`handle`,`handleSize`,`lockAspectRatio`,`axis`,`minConstraints`,`maxConstraints`,`onResize`,`onResizeStop`,`onResizeStart`,`resizeHandles`,`transformScale`];function s(e,t){if(typeof WeakMap==`function`)var n=new WeakMap,r=new WeakMap;return(s=function(e,t){if(!t&&e&&e.__esModule)return e;var i,a,o={__proto__:null,default:e};if(e===null||typeof e!=`object`&&typeof e!=`function`)return o;if(i=t?r:n){if(i.has(e))return i.get(e);i.set(e,o)}for(let t in e)t!=="default"&&{}.hasOwnProperty.call(e,t)&&((a=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(a.get||a.set)?i(o,t,a):o[t]=e[t]);return o})(e,t)}function c(){return c=Object.assign?Object.assign.bind():function(e){for(var t=1;tMath.abs(i*n)?t=e/n:e=t*n}let o=e,s=t,c=this.slack||[0,0],l=c[0],u=c[1];return e+=l,t+=u,r&&(e=Math.max(r[0],e),t=Math.max(r[1],t)),i&&(e=Math.min(i[0],e),t=Math.min(i[1],t)),this.slack=[l+(o-e),u+(s-t)],[e,t]}resizeHandler(e,t){return(n,r)=>{let i=r.node,a=r.deltaX,o=r.deltaY;e===`onResizeStart`&&this.resetData();let s=(this.props.axis===`both`||this.props.axis===`x`)&&t!==`n`&&t!==`s`,c=(this.props.axis===`both`||this.props.axis===`y`)&&t!==`e`&&t!==`w`;if(!s&&!c)return;let l=t[0],u=t[t.length-1],d=i.getBoundingClientRect();if(this.lastHandleRect!=null){if(u===`w`){let e=d.left-this.lastHandleRect.left;a+=e}if(l===`n`){let e=d.top-this.lastHandleRect.top;o+=e}}this.lastHandleRect=d,u===`w`&&(a=-a),l===`n`&&(o=-o);let f=this.lastSize?.width??this.props.width,p=this.lastSize?.height??this.props.height,m=f+(s?a/this.props.transformScale:0),h=p+(c?o/this.props.transformScale:0);var g=this.runConstraints(m,h);if(m=g[0],h=g[1],e===`onResizeStop`&&this.lastSize){var _=this.lastSize;m=_.width,h=_.height}let v=m!==f||h!==p;e!==`onResizeStop`&&(this.lastSize={width:m,height:h});let y=typeof this.props[e]==`function`?this.props[e]:null;y&&(e!==`onResize`||v)&&(n.persist==null||n.persist(),y(n,{node:i,size:{width:m,height:h},handle:t})),e===`onResizeStop`&&this.resetData()}}renderResizeHandle(e,t){let r=this.props.handle;if(!r)return n.createElement(`span`,{className:`react-resizable-handle react-resizable-handle-`+e,ref:t});if(typeof r==`function`)return r(e,t);let i=typeof r.type==`string`,a=d({ref:t},i?{}:{handleAxis:e});return n.cloneElement(r,a)}render(){let e=this.props,t=e.children,a=e.className,s=e.draggableOpts;e.width,e.height,e.handle,e.handleSize,e.lockAspectRatio,e.axis,e.minConstraints,e.maxConstraints,e.onResize,e.onResizeStop,e.onResizeStart;let u=e.resizeHandles;e.transformScale;let f=l(e,o);return(0,i.cloneElement)(t,d(d({},f),{},{className:(a?a+` `:``)+`react-resizable`,children:[...n.Children.toArray(t.props.children),...u.map(e=>{let t=this.handleRefs[e]??(this.handleRefs[e]=n.createRef());return n.createElement(r.DraggableCore,c({},s,{nodeRef:t,key:`resizableHandle-`+e,onStop:this.resizeHandler(`onResizeStop`,e),onStart:this.resizeHandler(`onResizeStart`,e),onDrag:this.resizeHandler(`onResize`,e)}),this.renderResizeHandle(e,t))})]}))}};e.default=h,h.propTypes=a.resizableProps,h.defaultProps={axis:`both`,handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:[`se`],transformScale:1}})),Y6=e((e=>{e.__esModule=!0,e.default=void 0;var n=c(t()),r=s(X3()),i=s(J6()),a=q6(),o=[`handle`,`handleSize`,`onResize`,`onResizeStart`,`onResizeStop`,`draggableOpts`,`minConstraints`,`maxConstraints`,`lockAspectRatio`,`axis`,`width`,`height`,`resizeHandles`,`style`,`transformScale`];function s(e){return e&&e.__esModule?e:{default:e}}function c(e,t){if(typeof WeakMap==`function`)var n=new WeakMap,r=new WeakMap;return(c=function(e,t){if(!t&&e&&e.__esModule)return e;var i,a,o={__proto__:null,default:e};if(e===null||typeof e!=`object`&&typeof e!=`function`)return o;if(i=t?r:n){if(i.has(e))return i.get(e);i.set(e,o)}for(let t in e)t!=="default"&&{}.hasOwnProperty.call(e,t)&&((a=(i=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,t))&&(a.get||a.set)?i(o,t,a):o[t]=e[t]);return o})(e,t)}function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let n=t.size;this.props.onResize?(e.persist==null||e.persist(),this.setState(n,()=>this.props.onResize&&this.props.onResize(e,t))):this.setState(n)}}static getDerivedStateFromProps(e,t){return t.propsWidth!==e.width||t.propsHeight!==e.height?{width:e.width,height:e.height,propsWidth:e.width,propsHeight:e.height}:null}render(){let e=this.props,t=e.handle,r=e.handleSize;e.onResize;let a=e.onResizeStart,s=e.onResizeStop,c=e.draggableOpts,u=e.minConstraints,f=e.maxConstraints,p=e.lockAspectRatio,m=e.axis;e.width,e.height;let g=e.resizeHandles,_=e.style,v=e.transformScale,y=h(e,o);return n.createElement(i.default,{axis:m,draggableOpts:c,handle:t,handleSize:r,height:this.state.height,lockAspectRatio:p,maxConstraints:f,minConstraints:u,onResizeStart:a,onResize:this.onResize,onResizeStop:s,resizeHandles:g,transformScale:v,width:this.state.width},n.createElement(`div`,l({},y,{style:d(d({},_),{},{width:this.state.width+`px`,height:this.state.height+`px`})})))}};e.default=g,g.propTypes=d(d({},a.resizableProps),{},{children:r.default.element})})),X6=e(((e,t)=>{t.exports=function(){throw Error(`Don't instantiate Resizable directly! Use require('react-resizable').Resizable`)},t.exports.Resizable=J6().default,t.exports.ResizableBox=Y6().default}))(),Z6=q3(),Q6=50,$6=12;function e8(e){let t=e;for(;t;){let e=window.getComputedStyle(t).overflowY;if((e===`auto`||e===`scroll`)&&t.scrollHeight>t.clientHeight)return t;t=t.parentElement}return null}function t8(e){let t=e8(e),n=null,r=0,i=0,a=!1;function o(){let e=t;if(!e)return;let s=e.getBoundingClientRect(),{clientHeight:c,scrollTop:l,scrollHeight:u}=e,{scrollLeft:d,scrollWidth:f,clientWidth:p}=e,m=0,h=0;i0?m=-$6:i>s.bottom-Q6&&l+c0?h=-$6:r>s.right-Q6&&d+p({cols:n,containerPadding:a,containerWidth:r,margin:i,maxRows:s,rowHeight:o}),[n,a,r,i,s,o]),be=(0,B.useMemo)(()=>({cols:n,maxRows:s,containerWidth:r,containerHeight:0,rowHeight:o,margin:i,layout:[]}),[n,s,r,o,i]),xe=(0,B.useCallback)(e=>({...be,containerHeight:e??be.containerHeight,layout:fe.current}),[be]),Se=(0,B.useMemo)(()=>I??{i:M,x:w,y:T,w:E,h:D,minW:O,maxW:k,minH:A,maxH:j},[I,M,w,T,E,D,O,k,A,j]),Ce=(0,B.useCallback)(e=>{if(g?.calcStyle)return g.calcStyle(e);if(p)return m3(e);let t=h3(e);return m?{...t,left:g3(e.left/r),width:g3(e.width/r)}:t},[g,p,m,r]),we=(0,B.useCallback)((e,{node:t})=>{if(!ee)return;let{offsetParent:n}=t;if(!n)return;let r=n.getBoundingClientRect(),i=t.getBoundingClientRect(),a=i.left/h,o=r.left/h,s=i.top/h,c=r.top/h,l;if(g?.calcDragPosition){let t=e;l=g.calcDragPosition(t.clientX,t.clientY,t.clientX-i.left,t.clientY-i.top)}else l={left:a-o+n.scrollLeft,top:s-c+n.scrollTop};if(le.current=l,ve.current||=t8(t instanceof HTMLElement?t:null),v>0){let t=e;ge.current={x:t.clientX,y:t.clientY},he.current=!0,_e.current=!1,oe(!0);return}oe(!0);let u=G4(ye,l.top,l.left),{x:d,y:f}=f3(F,Se,u.x,u.y,xe());ee(M,d,f,{e,node:t,newPosition:l})},[ee,h,ye,g,v,F,Se,xe,M]),Te=(0,B.useCallback)((e,{node:t,deltaX:n,deltaY:a})=>{if(!te||!R)return;let s=e;if(he.current&&!_e.current){let n=s.clientX-ge.current.x,r=s.clientY-ge.current.y;if(Math.hypot(n,r){if(!ne||!R)return;ve.current?.stop(),ve.current=null;let n=he.current;if(he.current=!1,_e.current=!1,ge.current={x:0,y:0},n){oe(!1),le.current={left:0,top:0};return}let{left:r,top:i}=le.current,a={top:i,left:r};oe(!1),le.current={left:0,top:0};let o=G4(ye,i,r),{x:s,y:c}=f3(F,Se,o.x,o.y,xe());ne(M,s,c,{e,node:t,newPosition:a})},[ne,R,ye,F,Se,xe,M]);pe.current=we,me.current=Te;let De=(0,B.useCallback)((e,{node:t,size:n,handle:i},a,o)=>{let s=o===`onResizeStart`?re:o===`onResize`?ie:ae;if(!s)return;let c;c=t?E3(i,a,n,r):{...n,top:a.top,left:a.left},ue.current=c;let l=t?.offsetParent?.clientHeight??0,u=K4(ye,c.width,c.height),{w:d,h:f}=p3(F,Se,u.w,u.h,i,xe(l));s(M,d,f,{e:e.nativeEvent??e,node:t,size:c,handle:i})},[re,ie,ae,r,ye,M,F,Se,xe]),Oe=(0,B.useCallback)((e,t)=>{se(!0);let n=U4(ye,w,T,E,D),r={...t,handle:t.handle};De(e,r,n,`onResizeStart`)},[De,ye,w,T,E,D]),ke=(0,B.useCallback)((e,t)=>{let n=U4(ye,w,T,E,D),r={...t,handle:t.handle};De(e,r,n,`onResize`)},[De,ye,w,T,E,D]),Ae=(0,B.useCallback)((e,t)=>{se(!1),ue.current={top:0,left:0,width:0,height:0};let n=U4(ye,w,T,E,D),r={...t,handle:t.handle};De(e,r,n,`onResizeStop`)},[De,ye,w,T,E,D]);(0,B.useEffect)(()=>{if(!y)return;let e=ce.current;if(!e)return;let t=de.current||{left:0,top:0},n=R&&(y.left!==t.left||y.top!==t.top);if(!R){let t={node:e,deltaX:y.left,deltaY:y.top,lastX:0,lastY:0,x:y.left,y:y.top};pe.current?.(y.e,t)}else if(n){let t={node:e,deltaX:y.left-le.current.left,deltaY:y.top-le.current.top,lastX:le.current.left,lastY:le.current.top,x:y.left,y:y.top};me.current?.(y.e,t)}de.current=y},[y,R,M]);let je=U4(ye,w,T,E,D,R?le.current:null,z?ue.current:null),Me=B.Children.only(t),Ne=V4(ye),Pe=[H4(O,Ne,i[0]),H4(A,o,i[1])],Fe=[H4(k,Ne,i[0]),H4(j,o,i[1])],Ie=Me.props,Le=Ie.className,Re=Ie.style,ze=B.cloneElement(Me,{ref:ce,className:_(`react-grid-item`,Le,b,{static:f,resizing:z,"react-draggable":c,"react-draggable-dragging":R,dropping:!!y,cssTransforms:p}),style:{...x,...Re,...Ce(je)}}),Be=P;return ze=(0,V.jsx)(X6.Resizable,{draggableOpts:{disabled:!l},className:l?void 0:`react-resizable-hide`,width:je.width,height:je.height,minConstraints:Pe,maxConstraints:Fe,onResizeStart:Oe,onResize:ke,onResizeStop:Ae,transformScale:h,resizeHandles:N,handle:Be,children:ze}),ze=(0,V.jsx)(V6,{disabled:!c,onStart:we,onDrag:Te,onStop:Ee,handle:S,cancel:`.react-resizable-handle`+(C?`,`+C:``),scale:h,allowMobileScroll:d,nodeRef:ce,children:ze}),ze}var r8=B.memo(n8,(e,t)=>e.x===t.x&&e.y===t.y&&e.w===t.w&&e.h===t.h&&e.minW===t.minW&&e.maxW===t.maxW&&e.minH===t.minH&&e.maxH===t.maxH&&e.cols===t.cols&&e.containerWidth===t.containerWidth&&e.rowHeight===t.rowHeight&&e.maxRows===t.maxRows&&e.margin===t.margin&&e.containerPadding===t.containerPadding&&e.transformScale===t.transformScale&&e.isDraggable===t.isDraggable&&e.isResizable===t.isResizable&&e.isBounded===t.isBounded&&e.allowMobileScroll===t.allowMobileScroll&&e.useCSSTransforms===t.useCSSTransforms&&e.usePercentages===t.usePercentages&&e.children===t.children&&e.onDrag===t.onDrag&&e.onDragStop===t.onDragStop&&e.onResize===t.onResize&&e.onResizeStop===t.onResizeStop&&e.droppingPosition===t.droppingPosition);r8.displayName=`GridItem`;function i8(e){let{clientX:t,clientY:n,gridElement:r,droppingItem:i,event:a,dragOffsetX:o=0,dragOffsetY:s=0,transformScale:c,cols:l,margin:u,maxRows:d,rowHeight:f,width:p,containerPadding:m}=e,h=r.getBoundingClientRect(),g={cols:l,margin:u,maxRows:d,rowHeight:f,containerWidth:p,containerPadding:m},_=V4(g),v=H4(i.w,_,u[0]),y=H4(i.h,f,u[1]),b=v/2,x=y/2,S=r.scrollLeft??0,C=r.scrollTop??0,w=t-h.left+S+o-b,T=n-h.top+C+s-x,E=Math.max(0,w),D=Math.max(0,T);return{newDroppingPosition:{left:E/c,top:D/c,e:a},calculatedXY:W4(g,D,E,i.w,i.h)}}var a8=()=>{},o8=`react-grid-layout`,s8=!1;try{s8=/firefox/i.test(navigator.userAgent)}catch{}function c8(e,t){let n=B.Children.toArray(e),r=B.Children.toArray(t);if(n.length!==r.length)return!1;for(let e=0;e{if(!B.isValidElement(t)||t.key===null)return;let n=String(t.key);a.add(n);let r=e.find(e=>e.i===n);if(r)i.push(r3(r));else{let e=t.props[`data-grid`];e?i.push({i:n,x:e.x??0,y:e.y??0,w:e.w??1,h:e.h??1,minW:e.minW,maxW:e.maxW,minH:e.minH,maxH:e.maxH,static:e.static,isDraggable:e.isDraggable,isResizable:e.isResizable,resizeHandles:e.resizeHandles,isBounded:e.isBounded}):i.push({i:n,x:0,y:e3(i),w:1,h:1})}});let o=s3(i,{cols:n});return r.compact(o,n)}function u8(e){let{children:t,width:n,gridConfig:r,dragConfig:i,resizeConfig:a,dropConfig:o,positionStrategy:s=D3,compactor:c,constraints:l=d3,layout:u=[],droppingItem:d,autoSize:f=!0,className:p=``,style:m={},innerRef:h,onLayoutChange:g=a8,onDragStart:v=a8,onDrag:y=a8,onDragStop:b=a8,onResizeStart:x=a8,onResize:S=a8,onResizeStop:C=a8,onDrop:w=a8,onDropDragOver:T=a8}=e,E=(0,B.useMemo)(()=>({...O3,...r}),[r]),D=(0,B.useMemo)(()=>({...k3,...i}),[i]),O=(0,B.useMemo)(()=>({...A3,...a}),[a]),k=(0,B.useMemo)(()=>({...j3,...o}),[o]),{cols:A,rowHeight:j,maxRows:M,margin:N,containerPadding:P}=E,{enabled:F,bounded:I,handle:L,cancel:ee,threshold:te,allowMobileScroll:ne}=D,{enabled:re,handles:ie,handleComponent:ae}=O,{enabled:R,defaultItem:oe,onDragOver:z,touchEnabled:se=!0,touchDragSource:ce=`[data-rgl-draggable]`}=k,le=c??V3(`vertical`),ue=le.type,de=le.allowOverlap,fe=le.preventCollision??!1,pe=(0,B.useMemo)(()=>d??{i:`__dropping-elem__`,...oe},[d,oe]),me=s.type===`transform`,he=s.scale,ge=P??N,[_e,ve]=(0,B.useState)(!1),[ye,be]=(0,B.useState)(()=>l8(u,t,A,le)),[xe,Se]=(0,B.useState)(null),[Ce,we]=(0,B.useState)(!1),[Te,Ee]=(0,B.useState)(null),[De,Oe]=(0,B.useState)(),ke=(0,B.useRef)(void 0);ke.current=De;let Ae=(0,B.useRef)(null),je=(0,B.useRef)(null),Me=(0,B.useRef)(null),Ne=(0,B.useRef)(0),Pe=(0,B.useRef)(ye),Fe=(0,B.useRef)(u),Ie=(0,B.useRef)(t),Le=(0,B.useRef)(ue),Re=(0,B.useRef)(null),ze=(0,B.useRef)(!1),Be=(0,B.useRef)(null),Ve=(0,B.useRef)(null);Ve.current=Te;let He=(0,B.useRef)(w);(0,B.useLayoutEffect)(()=>{He.current=w});let Ue=(0,B.useRef)(ye);Ue.current=ye,(0,B.useEffect)(()=>{ve(!0),(0,Z6.deepEqual)(ye,u)||g(ye)},[]),(0,B.useEffect)(()=>{if(xe||Te)return;let e=!(0,Z6.deepEqual)(u,Fe.current),n=!c8(t,Ie.current),r=ue!==Le.current;if(e||n||r){let n=l8(e?u:ye,t,A,le);(0,Z6.deepEqual)(n,ye)||be(n)}Fe.current=u,Ie.current=t,Le.current=ue},[u,t,A,ue,le,xe,Te,ye]),(0,B.useEffect)(()=>{if(!xe&&!Te&&!(0,Z6.deepEqual)(ye,Pe.current)){Pe.current=ye;let e=ye.filter(e=>e.i!==pe.i);g(e)}},[ye,xe,Te,g,pe.i]);let We=(0,B.useMemo)(()=>{if(!f)return;let e=e3(ye),t=ge[1];return e*j+(e-1)*N[1]+t*2+`px`},[f,ye,j,N,ge]),Ge=(0,B.useCallback)((e,t,n,r)=>{let i=Ue.current,a=t3(i,e);if(!a)return;let o={w:a.w,h:a.h,x:a.x,y:a.y,i:e};Ae.current=r3(a),Me.current=i,Se(o),v(i,a,a,null,r.e,r.node)},[v]),Ke=(0,B.useCallback)((e,t,n,r)=>{let i=Ue.current,a=Ae.current,o=t3(i,e);if(!o)return;let s={w:o.w,h:o.h,x:o.x,y:o.y,i:e},c=c3(i,o,t,n,!0,fe,ue,A,de);y(c,a,o,s,r.e,r.node),be(le.compact(c,A)),Se(s)},[fe,ue,A,de,le,y]),qe=(0,B.useCallback)((e,t,n,r)=>{if(!Ae.current)return;let i=Ue.current,a=Ae.current,o=t3(i,e);if(!o)return;let s=c3(i,o,t,n,!0,fe,ue,A,de),c=le.compact(s,A);b(c,a,o,null,r.e,r.node);let l=Me.current;Ae.current=null,Me.current=null,Se(null),be(c),l&&!(0,Z6.deepEqual)(l,c)&&g(c)},[fe,ue,A,de,le,b,g]),Je=(0,B.useCallback)((e,t,n,r)=>{let i=Ue.current,a=t3(i,e);a&&(je.current=r3(a),Me.current=i,we(!0),x(i,a,a,null,r.e,r.node))},[x]),Ye=(0,B.useCallback)((e,t,n,r)=>{let i=Ue.current,a=je.current,{handle:o}=r,s=!1,c,l,[u,d]=o3(i,e,e=>(c=e.x,l=e.y,[`sw`,`w`,`nw`,`n`,`ne`].includes(o)&&([`sw`,`nw`,`w`].includes(o)&&(c=e.x+(e.w-t),t=e.x!==c&&c<0?e.w:t,c=c<0?0:c),[`ne`,`n`,`nw`].includes(o)&&(l=e.y+(e.h-n),n=e.y!==l&&l<0?e.h:n,l=l<0?0:l),s=!0),fe&&!de&&X4(i,{...e,w:t,h:n,x:c??e.x,y:l??e.y}).filter(t=>t.i!==e.i).length>0&&(l=e.y,n=e.h,c=e.x,t=e.w,s=!1),e.w=t,e.h=n,(o===`n`||o===`nw`||o===`ne`)&&(e.y=l??e.y),e));if(!d)return;let f=u;s&&c!==void 0&&l!==void 0&&(f=c3(u,d,c,l,!0,fe,ue,A,de));let p={w:d.w,h:d.h,x:d.x,y:d.y,i:e,static:!0};S(f,a,d,p,r.e,r.node);let m=le.compact(f,A);if(o===`n`||o===`nw`||o===`ne`){let t=m.find(t=>t.i===e);t&&(t.y=d.y)}be(m),Se(p)},[fe,ue,A,de,le,S]),Xe=(0,B.useCallback)((e,t,n,r)=>{let i=Ue.current,a=je.current,o=t3(i,e),s=le.compact(i,A);C(s,a,o??null,null,r.e,r.node);let c=Me.current;je.current=null,Me.current=null,Se(null),we(!1),be(s),c&&!(0,Z6.deepEqual)(c,s)&&g(s)},[A,le,C,g]),Ze=(0,B.useCallback)((e,t,n,r)=>{if(r)ke.current&&(ke.current.left!==t.left||ke.current.top!==t.top)&&(Oe(t),be(t=>t.map(t=>t.i===e.i&&(t.x!==n.x||t.y!==n.y)?{...t,x:n.x,y:n.y}:t)));else{Ee((0,V.jsx)(`div`,{},e.i)),Oe(t);let r=Ue.current.filter(t=>t.i!==e.i);be([...r,{...e,x:n.x,y:n.y,static:!1,isDraggable:!0}])}},[]),Qe=(0,B.useCallback)((e,t,r)=>{let i=Re.current;if(!i)return;let{newDroppingPosition:a,calculatedXY:o}=i8({clientX:e,clientY:t,gridElement:i,droppingItem:pe,event:r,transformScale:he,cols:A,margin:N,maxRows:M,rowHeight:j,width:n,containerPadding:ge});Ze(pe,a,o,!!Ve.current)},[pe,he,A,N,M,j,n,ge,Ze]),$e=(0,B.useCallback)(()=>{let e=Ue.current;if(!e.some(e=>e.i===pe.i)){Ee(null),Se(null),Oe(void 0);return}let t=le.compact(e.filter(e=>e.i!==pe.i),A);be(t),Ee(null),Se(null),Oe(void 0)},[pe.i,A,le]),et=(0,B.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),s8&&!e.nativeEvent.target?.classList.contains(o8))return!1;let t=z?z(e.nativeEvent):T(e);if(t===!1)return Te&&$e(),!1;let{dragOffsetX:r=0,dragOffsetY:i=0,...a}=t??{},o={...pe,...a},{newDroppingPosition:s,calculatedXY:c}=i8({clientX:e.clientX,clientY:e.clientY,gridElement:e.currentTarget,droppingItem:o,event:e.nativeEvent,dragOffsetX:r,dragOffsetY:i,transformScale:he,cols:A,margin:N,maxRows:M,rowHeight:j,width:n,containerPadding:ge});Ze(o,s,c,!!Te)},[Te,pe,z,T,$e,Ze,he,A,N,M,j,n,ge]),tt=(0,B.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),Ne.current--,Ne.current<0&&(Ne.current=0),Ne.current===0&&$e()},[$e]),nt=(0,B.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),Ne.current++},[]),rt=(0,B.useCallback)(e=>{let t=Ue.current,n=t.find(e=>e.i===pe.i);$e(),He.current(t,n,e)},[pe.i,$e]),it=(0,B.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),Ne.current=0,rt(e.nativeEvent)},[rt]);(0,B.useEffect)(()=>{if(!R||!se)return;let e=Re.current;if(!e)return;let t=(t,n)=>{let r=document.elementFromPoint(t,n);return r?e.contains(r):!1},n=e=>e instanceof HTMLElement&&e.closest(ce)!==null,r=e=>{let t=e.changedTouches;if(!t||t.length===0)return;let n=Be.current;if(n===null)return t[0];for(let e=0;e{if(!n(e.target)||Be.current!==null)return;e.preventDefault();let t=e.changedTouches?.[0];t&&(Be.current=t.identifier,ze.current=!0)},a=e=>{if(!ze.current)return;e.preventDefault();let n=r(e);if(n){if(!t(n.clientX,n.clientY)){Ve.current&&$e();return}Qe(n.clientX,n.clientY,e)}},o=e=>{if(!ze.current)return;e.preventDefault();let n=r(e);if(ze.current=!1,Be.current=null,n){if(!t(n.clientX,n.clientY)){$e();return}rt(e)}},s=()=>{ze.current&&(ze.current=!1,Be.current=null,$e())},c={passive:!1};return document.addEventListener(`touchstart`,i,c),document.addEventListener(`touchmove`,a,c),document.addEventListener(`touchend`,o,c),document.addEventListener(`touchcancel`,s,c),()=>{document.removeEventListener(`touchstart`,i,c),document.removeEventListener(`touchmove`,a,c),document.removeEventListener(`touchend`,o,c),document.removeEventListener(`touchcancel`,s,c)}},[R,se,ce,Qe,$e,rt,pe.i]);let at=(0,B.useCallback)((e,t)=>{if(!e||!e.key)return null;let r=t3(ye,String(e.key));if(!r)return null;let i=typeof r.isDraggable==`boolean`?r.isDraggable:!r.static&&F,a=typeof r.isResizable==`boolean`?r.isResizable:!r.static&&re,o=r.resizeHandles||[...ie],c=i&&I&&r.isBounded!==!1,u=ae;return(0,V.jsx)(r8,{containerWidth:n,cols:A,margin:N,containerPadding:ge,maxRows:M,rowHeight:j,cancel:ee,handle:L,onDragStart:Ge,onDrag:Ke,onDragStop:qe,onResizeStart:Je,onResize:Ye,onResizeStop:Xe,isDraggable:i,isResizable:a,isBounded:c,allowMobileScroll:ne,useCSSTransforms:me&&_e,usePercentages:!_e,transformScale:he,positionStrategy:s,dragThreshold:te,w:r.w,h:r.h,x:r.x,y:r.y,i:r.i,minH:r.minH,minW:r.minW,maxH:r.maxH,maxW:r.maxW,static:r.static,droppingPosition:t?De:void 0,resizeHandles:o,resizeHandle:u,constraints:l,layoutItem:r,layout:ye,children:e},r.i)},[ye,n,A,N,ge,M,j,ee,L,Ge,Ke,qe,Je,Ye,Xe,F,re,I,me,_e,he,s,te,De,ie,ae,l]),ot=()=>xe?(0,V.jsx)(r8,{w:xe.w,h:xe.h,x:xe.x,y:xe.y,i:xe.i,className:`react-grid-placeholder ${Ce?`placeholder-resizing`:``}`,containerWidth:n,cols:A,margin:N,containerPadding:ge,maxRows:M,rowHeight:j,isDraggable:!1,isResizable:!1,isBounded:!1,useCSSTransforms:me,transformScale:he,constraints:l,layout:ye,children:(0,V.jsx)(`div`,{})}):null,st=(0,B.useCallback)(e=>{Re.current=e,typeof h==`function`?h(e):h&&`current`in h&&(h.current=e)},[h]),ct=_(o8,p),lt={height:We,...m};return(0,V.jsxs)(`div`,{ref:st,className:ct,style:lt,onDrop:R?it:void 0,onDragLeave:R?tt:void 0,onDragEnter:R?nt:void 0,onDragOver:R?et:void 0,children:[B.Children.map(t,e=>B.isValidElement(e)?at(e):null),R&&Te&&at(Te,!0),ot()]})}var d8={lg:1200,md:996,sm:768,xs:480,xxs:0},f8={lg:12,md:10,sm:6,xs:4,xxs:2},p8=()=>{};function m8(e,t,n,r,i=!1){let a=[];B.Children.forEach(t,t=>{if(!B.isValidElement(t)||t.key===null)return;let n=String(t.key),r=t.props[`data-grid`],o=e.find(e=>e.i===n);o?i&&r?a.push({...o,i:n,w:r.w??o.w,h:r.h??o.h,minW:r.minW??o.minW,maxW:r.maxW??o.maxW,minH:r.minH??o.minH,maxH:r.maxH??o.maxH}):a.push({...o,i:n}):r?a.push({i:n,x:r.x??0,y:r.y??0,w:r.w??1,h:r.h??1,minW:r.minW,maxW:r.maxW,minH:r.minH,maxH:r.maxH,static:r.static,isDraggable:r.isDraggable,isResizable:r.isResizable,resizeHandles:r.resizeHandles,isBounded:r.isBounded}):a.push({i:n,x:0,y:e3(a),w:1,h:1})});let o=s3(a,{cols:n});return r.compact(o,n)}function h8(e){let{children:t,width:n,breakpoint:r,breakpoints:i=d8,cols:a=f8,layouts:o={},rowHeight:s=150,maxRows:c=1/0,margin:l=[10,10],containerPadding:u=null,compactor:d,onBreakpointChange:f=p8,onLayoutChange:p=p8,onWidthChange:m=p8,...h}=e,g=d??V3(`vertical`),_=g.type,v=g.allowOverlap,y=(0,B.useMemo)(()=>r??U3(i,n),[]),b=(0,B.useMemo)(()=>W3(y,a),[y,a]),x=(0,B.useMemo)(()=>G3(o,i,y,y,b,_),[]),[S,C]=(0,B.useState)(y),[w,T]=(0,B.useState)(b),[E,D]=(0,B.useState)(x),[O,k]=(0,B.useState)(o),A=(0,B.useRef)(n),j=(0,B.useRef)(r),M=(0,B.useRef)(i),N=(0,B.useRef)(a),P=(0,B.useRef)(o),F=(0,B.useRef)(_),I=(0,B.useRef)(O);(0,B.useEffect)(()=>{I.current=O},[O]);let L=(0,B.useMemo)(()=>(0,Z6.deepEqual)(o,P.current)?null:G3(o,i,S,S,w,g),[o,i,S,w,g]),ee=L??E;(0,B.useEffect)(()=>{L!==null&&(D(L),k(o),I.current=o,P.current=o)},[L,o]),(0,B.useEffect)(()=>{if(_!==F.current){let e=g.compact(i3(ee),w),t={...I.current,[S]:e};D(e),k(t),I.current=t,p(e,t),F.current=_}},[_,g,ee,w,v,S,p]),(0,B.useEffect)(()=>{let e=n!==A.current,o=r!==j.current,s=!(0,Z6.deepEqual)(i,M.current),c=!(0,Z6.deepEqual)(a,N.current);if(e||o||s||c){let e=r??U3(i,n),o=W3(e,a),d=S;if(d!==e||s||c){let n={...I.current};n[d]||(n[d]=i3(E));let r=G3(n,i,e,d,o,g),a=!n[e];r=m8(r,t,o,g,a),n[e]=r,C(e),T(o),D(r),k(n),I.current=n,f(e,o),p(r,n)}let h=K3(l,e),_=u?K3(u,e):null;m(n,h,o,_),A.current=n,j.current=r,M.current=i,N.current=a}},[n,r,i,a,S,w,E,t,g,_,v,l,u,f,p,m]);let te=(0,B.useCallback)(e=>{let t={...I.current,[S]:e};D(e),k(t),I.current=t,p(e,t)},[S,p]),ne=(0,B.useMemo)(()=>K3(l,S),[l,S]),re=(0,B.useMemo)(()=>u===null?null:K3(u,S),[u,S]),ie=(0,B.useMemo)(()=>({cols:w,rowHeight:s,maxRows:c,margin:ne,containerPadding:re}),[w,s,c,ne,re]);return(0,V.jsx)(u8,{...h,width:n,gridConfig:ie,compactor:g,onLayoutChange:te,layout:ee,children:t})}var g8=B.forwardRef(function(e,t){let{innerRef:n,...r}=e,i=n??t;return(0,V.jsx)(h8,{...r,innerRef:i})});g8.displayName=`ResponsiveGridLayout`;function _8(e,t,n,r){let i=e=>t?.frame?.columns.some((n,r)=>n.name===e&&t.frame.values[r]?.some(e=>typeof e==`string`&&e!==``));return{onSelect:e.click&&(e.viz===`service_map`||!(e.drill&&r))?t=>n(e.click.set_variable,t):void 0,onPoint:r&&(e.viz===`service_map`||e.click||e.drill||i(`trace_id`)||e.options?.columns?.some(e=>e.format===`trace_link`&&i(e.field)))?r:void 0}}function v8(e,t,n,r){if(!t)return;let i=mt(e,t,n);if(!i)return;let a=Object.values(n.dimensions)[0],o=e.click?.set_variable;return{target:i,vars:o&&a!==void 0?{...r,[o]:a}:r}}function y8(e){let t=Number.isFinite(e.from_ms)&&Number.isFinite(e.to_ms)?`${new Date(e.from_ms).toISOString()} to ${new Date(e.to_ms).toISOString()}`:`No executed window is available; say that explicitly.`;return`Explain the panel ${JSON.stringify(e.title)} (panel id ${e.panel_id}${e.dashboard_id?`, dashboard id ${e.dashboard_id}, version ${e.version}`:``}). Observed window (millisecond-truncated): ${t}. Resolved variables: ${JSON.stringify(e.vars)}. Observed state: ${JSON.stringify({status:e.status,diagnosis:e.diagnosis,stale_since:e.stale_since,truncated:e.truncated,note:e.note})}. ${e.error?`Observed error: ${JSON.stringify(e.error)}. `:``}${e.spec?`Panel specification: ${JSON.stringify(e.spec)}. `:``}Answer what it shows and what evidence supports unusual behavior. This is an explanation request. Do not create, edit, replace or restore a dashboard. If it fails, explain the error and suggest a correction without saving it.`}function b8(e){return`Please fix the panel ${JSON.stringify(e.title)} (panel id ${e.panel_id}, dashboard id ${e.dashboard_id}, version ${e.version}). Observed error: ${JSON.stringify(e.error)}. Resolved variables: ${JSON.stringify(e.vars)}. This is an explicit dashboard edit request. Get the dashboard and correct only this panel.`}var x8=e=>e*40+(e-1)*12,S8={s:3,m:6,l:10},C8={stat:4},w8=e=>Math.max(C8[e.viz]??0,S8[e.height??(e.viz===`service_map`?`l`:e.viz===`stat`?`s`:`m`)]),T8=(0,B.lazy)(()=>ue(()=>import(`./panel-sql-editor-DoqW8p7v.js`),__vite__mapDeps([0,1,2,3,4,5,6,7]))),E8=0;function D8(e){let t;do t=`p_${Date.now().toString(36)}_${(++E8).toString(36)}_${Math.random().toString(36).slice(2,10)}`;while(e.some(e=>e.id===t));return t}function O8({dashboardId:e,version:t,spec:n,vars:r,results:i,fetching:a,annotations:o,fetchingIds:s=[],staleAt:c=new Map,time:l=n.time,onEditExit:u,editing:d,view:f,agentAvailable:p,canManage:m=!1,onOpenChat:h,onVariable:g,onRetry:_,onPoint:v,onZoom:b,onZoomReset:x,zoomed:S,onView:w,onVisible:E,onRangePending:D,shortcutScope:O,onShortcuts:k,overlayOpen:A,returnViewFocus:j}){let M=tt(),[N,P]=(0,B.useState)(),[F,I]=(0,B.useState)(()=>n.panels.map(e=>({i:e.id,x:e.grid?.x??0,y:e.grid?.y??0,w:e.grid?.w??6,h:e.grid?.h??w8(e)})));(0,B.useEffect)(()=>{I(n.panels.map(e=>({i:e.id,x:e.grid?.x??0,y:e.grid?.y??0,w:e.grid?.w??6,h:e.grid?.h??w8(e)})))},[n]);let[L,te]=(0,B.useState)(()=>window.innerHeight),[ne,re]=(0,B.useState)();(0,B.useEffect)(()=>{let e=()=>te(window.innerHeight);return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let ie=(0,B.useRef)(null),ae=(0,B.useRef)(new Map),R=(0,B.useRef)(null),oe=(0,B.useRef)(null),z=()=>{let e=N?.panel.id;P(void 0),requestAnimationFrame(()=>(oe.current?.isConnected?oe.current:ae.current.get(e??``))?.focus())},ce=(0,B.useRef)(f);f&&(ce.current=f);let[le,ue]=(0,B.useState)(0),de=le>0,fe=d&&(le>=1100?`lg`:le>=800?`md`:`sm`)==`lg`;(0,B.useLayoutEffect)(()=>{if(!ie.current)return;ue(Math.max(0,Math.round(ie.current.getBoundingClientRect().width)));let e=new ResizeObserver(([e])=>{e&&ue(Math.max(0,Math.round(e.contentRect.width)))});return e.observe(ie.current),()=>e.disconnect()},[]);let pe=(0,B.useRef)(E);pe.current=E,(0,B.useEffect)(()=>{if(!de||!ie.current||typeof IntersectionObserver>`u`)return;let e=new Set(n.panels.map(e=>e.id)),t=new IntersectionObserver(t=>{for(let n of t){let t=n.target.dataset.panel;t&&(n.isIntersecting?e.add(t):e.delete(t))}f&&n.panels.some(e=>e.id===f)&&e.add(f),pe.current([...e])},{rootMargin:`200px`});return ie.current.querySelectorAll(`.react-grid-item[data-panel]`).forEach(e=>t.observe(e)),()=>t.disconnect()},[n,f,de]);let me=(0,B.useMemo)(()=>n.panels.some(e=>{let t=F.find(t=>t.i===e.id);return t&&(t.x!==e.grid?.x||t.y!==e.grid?.y||t.w!==e.grid?.w||t.h!==e.grid?.h)}),[F,n]),he=e=>({...n,panels:e.map(e=>{let t=F.find(t=>t.i===e.id);return t?{...e,grid:{x:t.x,y:t.y,w:t.w,h:t.h}}:e})}),ge=Oe({mutationFn:()=>$e(e,he(n.panels),t,`Edited layout`),onSuccess:t=>{M.setQueryData([`dashboard`,e],t)}}),_e=Oe({mutationFn:r=>me?$e(e,he(n.panels.filter(e=>e.id!==r)),t,`Removed a panel and saved layout`):je(e,[{op:`remove_panel`,id:r}],t,`Removed a panel`),onSuccess:t=>{M.setQueryData([`dashboard`,e],t)}}),ve=Oe({mutationFn:r=>{let i={...r,id:D8(n.panels),title:`${Array.from(r.title).slice(0,73).join(``)} (copy)`,grid:void 0};if(me){let a=[...n.panels];return a.splice(a.findIndex(e=>e.id===r.id)+1,0,i),$e(e,he(a),t,`Duplicated a panel and saved layout`)}return je(e,[{op:`add_panel`,after:r.id,panel:i}],t,`Duplicated a panel`)},onSuccess:t=>{M.setQueryData([`dashboard`,e],t)}});(0,B.useEffect)(()=>{d||(ge.reset(),_e.reset(),ve.reset())},[d]);let ye=()=>{ge.reset(),_e.reset(),ve.reset(),u?.(),M.invalidateQueries({queryKey:[`dashboard`,e]})},be=async e=>{let t=new URL(window.location.href);t.searchParams.set(`view`,e),t.searchParams.delete(`edit`);try{await navigator.clipboard.writeText(t.toString()),re(`Link copied`)}catch{re(`Copy this URL: ${t.toString()}`)}},xe=`dashboard-${e}`,Se=n=>({dashboard_id:e,version:t,panel_id:n.id,title:Xi(n.title,r),from_ms:i.get(n.id)?.from_ms,to_ms:i.get(n.id)?.to_ms,vars:r,error:i.get(n.id)?.error,status:i.get(n.id)?.status,diagnosis:i.get(n.id)?.diagnosis,stale_since:c.get(n.id),truncated:i.has(n.id)?!!(i.get(n.id)?.frame?.truncated||i.get(n.id)?.previous?.truncated):void 0,note:i.get(n.id)?.frame?.note,spec:{...n,dashboard_time:l}}),Ce=(u,d,y=!1)=>(0,V.jsx)(L4,{panel:u,title:Xi(u.title,r),result:i.get(u.id),loading:a&&s.includes(u.id),height:d,group:xe,editing:fe&&!y,agentAvailable:p,suspended:!y&&u.id===f,menuRef:y?R:e=>{e?ae.current.set(u.id,e):ae.current.delete(u.id)},compare:l.compare===`previous_period`,range:u.time?.range??l.range,annotations:o,vars:r,onVariable:g,..._8(u,i.get(u.id),g,v?e=>v(u,e):void 0),onRangePending:e=>D?.(u.id,e),onZoom:b,zoomed:S,onZoomReset:x,onRetry:_?()=>_(u.id):void 0,onView:()=>w(u.id),onCopyLink:()=>{be(u.id)},onEditSQL:m&&typeof u.sql==`string`?()=>{oe.current=y?R.current:ae.current.get(u.id)??null,P({panel:u,spec:n,version:t})}:void 0,onExplain:e?()=>h(y8(Se(u)),{answer_only:!0}):void 0,onFix:e&&m?()=>h(b8(Se(u))):void 0,staleAt:c.get(u.id),onDuplicate:fe&&!y?()=>ve.mutate(u):void 0,onRemove:fe&&!y?()=>_e.mutate(u.id):void 0}),we=n.panels.find(e=>e.id===f),Te=d?ge.error??_e.error??ve.error:null,Ee=Te instanceof Ne&&Te.code===`dashboard_version_conflict`,De=e=>{fe&&I(e.map(({i:e,x:t,y:n,w:r,h:i})=>({i:e,x:t,y:n,w:r,h:i})))};return(0,V.jsxs)(`div`,{ref:ie,style:{minWidth:0},children:[d&&(0,V.jsxs)(y,{justify:`space-between`,mb:`sm`,p:`xs`,style:{border:`1px dashed var(--mantine-color-default-border)`,borderRadius:8},children:[(0,V.jsx)(T,{size:`sm`,c:`dimmed`,children:fe?`Drag a panel by its title and resize it from the corner. Changes are saved as a new version.`:`The layout can be edited only on a wider screen.`}),(0,V.jsx)(C,{size:`compact-sm`,disabled:!me||!fe,loading:ge.isPending,onClick:()=>ge.mutate(),children:`Save layout`})]}),Ee&&(0,V.jsxs)(ee,{color:`warn`,mb:`sm`,children:[`Someone saved this dashboard since you opened it. Load the latest version, then redo your change. `,(0,V.jsx)(C,{size:`compact-sm`,onClick:ye,children:`Load latest`})]}),Te&&!Ee&&(0,V.jsx)(ee,{color:`bad`,mb:`sm`,children:Te.message}),ne&&(0,V.jsx)(ee,{role:`status`,mb:`sm`,children:ne}),!de&&(0,V.jsx)(`div`,{"data-grid-placeholder":!0,style:{height:x8(Math.max(1,...F.map(e=>e.y+e.h)))}}),de&&(0,V.jsx)(g8,{width:le,className:`dashboard-grid${fe?` dashboard-grid-editing`:``}`,layouts:{lg:F,md:F,sm:F.map(e=>({...e,x:0,w:12}))},breakpoints:{lg:1100,md:800,sm:0},cols:{lg:12,md:12,sm:12},rowHeight:40,margin:[12,12],containerPadding:[0,0],compactor:F3,dragConfig:{enabled:fe,handle:`.panel-drag`,cancel:`button`},resizeConfig:{enabled:fe},onDragStop:De,onResizeStop:De,children:n.panels.map(e=>{let t=F.find(t=>t.i===e.id);return(0,V.jsx)(`div`,{"data-panel":e.id,children:Ce(e,x8(t?.h??6))},e.id)})}),(0,V.jsx)(I4,{shortcutScope:O,onShortcuts:k,escapeEnabled:!A&&!N,opened:!!f,onClose:()=>w(void 0),title:we?Xi(we.title,r):`Missing panel`,returnFocusTo:()=>j?.(ce.current)??ae.current.get(ce.current??``)??ae.current.values().next().value,children:we?(0,V.jsx)(`div`,{style:{height:`calc(100vh - 120px)`},children:Ce(we,Math.max(40,L-140),!0)}):(0,V.jsx)(ee,{color:`warn`,children:`This panel is missing from the dashboard. The shared link may be out of date.`})}),N&&(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(bt,{opened:!0,onClose:z,title:`Loading SQL editor`,children:(0,V.jsx)(se,{size:`sm`,"aria-label":`Loading SQL editor`})}),children:(0,V.jsx)(T8,{dashboardId:e,version:N.version,spec:N.spec,panel:N.panel,time:l,vars:r,onClose:z})})]})}function k8(e,t=1,n=8){let r=(t-1)*n;return e.slice(r,r+n)}function A8({icon:e,title:t,children:n,tall:r=!1}){return(0,V.jsx)(ae,{mih:r?220:130,p:`xl`,children:(0,V.jsxs)(y,{wrap:`nowrap`,children:[(0,V.jsx)(ne,{variant:`light`,size:`xl`,radius:`md`,children:e}),(0,V.jsxs)(o,{children:[(0,V.jsx)(T,{fw:700,size:`sm`,children:t}),(0,V.jsx)(T,{c:`dimmed`,size:`xs`,mt:3,children:n})]})]})})}function j8(e,t=8){let[n,r]=(0,B.useState)(1),i=Math.max(1,Math.ceil(e.length/t));(0,B.useEffect)(()=>{n>i&&r(i)},[n,i]);let a=(n-1)*t;return{page:n,setPage:r,totalPages:i,pageItems:k8(e,n,t),from:e.length?a+1:0,to:Math.min(a+t,e.length),total:e.length}}function M8({page:e,totalPages:t,from:n,to:r,total:i,onChange:a}){return t<=1?null:(0,V.jsxs)(y,{justify:`space-between`,mt:`xs`,children:[(0,V.jsxs)(T,{c:`dimmed`,size:`xs`,children:[n,`–`,r,` of `,i]}),(0,V.jsx)(y,{gap:4,children:[{label:`First page`,page:1,disabled:e===1},{label:`Previous page`,page:e-1,disabled:e===1},{label:`Next page`,page:e+1,disabled:e===t},{label:`Last page`,page:t,disabled:e===t}].map(e=>(0,V.jsx)(C,{size:`compact-xs`,variant:`subtle`,"aria-label":e.label,disabled:e.disabled,onClick:()=>a(e.page),children:e.label},e.label))})]})}function N8({spans:e,dark:t,onSpan:n}){let r=Math.min(...e.map(e=>new Date(e.start).valueOf())),i=Math.max(...e.map(e=>new Date(e.start).valueOf()+e.duration_ms)),a=Math.max(i-r,1),s=[...new Set(e.map(e=>e.service))],c=j8(e);return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(xe.ScrollContainer,{minWidth:680,children:(0,V.jsxs)(xe,{highlightOnHover:!!n,verticalSpacing:`sm`,children:[(0,V.jsx)(xe.Thead,{children:(0,V.jsxs)(xe.Tr,{children:[(0,V.jsx)(xe.Th,{w:230,children:`Operation`}),(0,V.jsx)(xe.Th,{children:`Timeline`}),(0,V.jsx)(xe.Th,{w:90,ta:`right`,children:`Duration`})]})}),(0,V.jsx)(xe.Tbody,{children:c.pageItems.map(e=>{let i=(new Date(e.start).valueOf()-r)/a*100,c=Math.max(e.duration_ms/a*100,.6),l=e.status===`STATUS_CODE_ERROR`;return(0,V.jsxs)(xe.Tr,{tabIndex:n?0:void 0,onClick:n?()=>n(e):void 0,onKeyDown:n?t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),n(e))}:void 0,style:{cursor:n?`pointer`:void 0},children:[(0,V.jsx)(xe.Td,{children:(0,V.jsxs)(y,{gap:`xs`,wrap:`nowrap`,children:[(0,V.jsx)(o,{w:8,h:8,bg:Ba(s.indexOf(e.service),t),style:{borderRadius:`50%`,flex:`0 0 auto`}}),(0,V.jsxs)(o,{miw:0,children:[(0,V.jsx)(T,{fw:600,size:`sm`,truncate:!0,children:e.operation}),(0,V.jsx)(T,{c:`dimmed`,size:`xs`,truncate:!0,children:e.service})]})]})}),(0,V.jsx)(xe.Td,{children:(0,V.jsx)(he,{label:`${e.service} · ${e.operation} · ${be(e.duration_ms)}`,withArrow:!0,children:(0,V.jsx)(o,{pos:`relative`,h:14,bg:`var(--mantine-color-default-hover)`,role:`img`,"aria-label":`${e.operation} on ${e.service} took ${be(e.duration_ms)}`,style:{borderRadius:`var(--mantine-radius-sm)`},children:(0,V.jsx)(o,{pos:`absolute`,left:`${i}%`,w:`${Math.min(c,100-i)}%`,h:`100%`,bg:l?`bad`:Ba(s.indexOf(e.service),t),style:{borderRadius:`var(--mantine-radius-sm)`,minWidth:3}})})})}),(0,V.jsx)(xe.Td,{ta:`right`,children:(0,V.jsx)(T,{size:`sm`,ff:`monospace`,children:be(e.duration_ms)})})]},e.span_id)})})]})}),(0,V.jsx)(M8,{...c,onChange:c.setPage})]})}function P8({result:e,dark:t,onSpan:n}){let[r,i]=(0,B.useState)(`waterfall`),a=e.data,s=(0,B.useMemo)(()=>({id:`correlated_logs`,status:a.logs.length?`ok`:`empty`,elapsed_ms:0,frame:{columns:[{name:`time`,type:`time`,role:`time`},...[`severity`,`service`,`body`].map(e=>({name:e,type:`string`,role:`dimension`}))],rows:a.logs.length,values:[a.logs.map(e=>Date.parse(e.time)),a.logs.map(e=>e.severity),a.logs.map(e=>e.service),a.logs.map(e=>e.body)]}}),[a.logs]);return(0,V.jsxs)(S,{gap:`sm`,children:[(0,V.jsxs)(y,{children:[(0,V.jsx)(T,{fw:600,children:a.trace_id}),(0,V.jsx)(T,{c:a.has_error?`bad`:`dimmed`,children:a.has_error?`■ Error`:`● OK`})]}),a.spans.length>0?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(y,{role:`group`,"aria-label":`Trace view`,children:[(0,V.jsx)(C,{"aria-pressed":r===`waterfall`,variant:r===`waterfall`?`light`:`subtle`,onClick:()=>i(`waterfall`),children:`Waterfall`}),(0,V.jsx)(C,{"aria-pressed":r===`flame`,variant:r===`flame`?`light`:`subtle`,onClick:()=>i(`flame`),children:`Flame graph`})]}),r===`waterfall`?(0,V.jsx)(N8,{spans:a.spans,dark:t,onSpan:n}):(0,V.jsx)(F8,{spans:a.spans,dark:t,onSpan:n})]}):(0,V.jsx)(T,{c:`dimmed`,children:`No spans were found for this trace.`}),(0,V.jsx)(T,{fw:600,children:`Correlated logs`}),a.logs.length?(0,V.jsx)(o,{style:{overflow:`auto`,minWidth:0},children:(0,V.jsx)(A4,{foldConstants:!1,panel:{id:`correlated_logs`,title:`Correlated logs`,viz:`logs`},result:s,dark:t,height:320})}):(0,V.jsx)(A8,{tall:!0,icon:(0,V.jsx)(Bi,{size:20,weight:`duotone`}),title:`No correlated logs`,children:`No logs in this window carry the selected trace ID.`}),a.truncated&&(0,V.jsxs)(ee,{color:`warn`,children:[`This trace is truncated: `,a.spans.length,` of `,a.span_count,` spans, `,a.services.length,` of `,a.service_count,` services.`]})]})}function F8({spans:e,dark:t,onSpan:n}){let r=(0,B.useMemo)(()=>I8(e),[e]),i=[...new Set(e.map(e=>e.service))];return(0,V.jsxs)(S,{px:{base:`md`,sm:`lg`},pb:`md`,gap:`xs`,children:[(0,V.jsxs)(y,{justify:`space-between`,children:[(0,V.jsx)(y,{gap:`md`,children:i.map(e=>(0,V.jsxs)(y,{gap:5,children:[(0,V.jsx)(o,{w:8,h:8,bg:Ba(i.indexOf(e),t),style:{borderRadius:`50%`}}),(0,V.jsx)(T,{c:`dimmed`,size:`xs`,children:e})]},e))}),(0,V.jsx)(We,{variant:`light`,children:be(r.total)})]}),(0,V.jsx)(z,{withBorder:!0,radius:`md`,p:`sm`,children:(0,V.jsx)(me,{type:`auto`,offsetScrollbars:!0,children:(0,V.jsxs)(o,{miw:760,children:[(0,V.jsx)(o,{pos:`relative`,h:22,mb:4,children:[0,25,50,75,100].map(e=>(0,V.jsx)(T,{pos:`absolute`,left:`${e}%`,c:`dimmed`,size:`xs`,style:{transform:e===100?`translateX(-100%)`:e?`translateX(-50%)`:void 0},children:be(r.total*e/100)},e))}),(0,V.jsxs)(o,{pos:`relative`,h:Math.max(150,r.laneCount*36+12),bg:`var(--mantine-color-default-hover)`,style:{overflow:`hidden`,borderRadius:`var(--mantine-radius-md)`},children:[[0,25,50,75,100].map(e=>(0,V.jsx)(o,{pos:`absolute`,left:`${e}%`,top:0,bottom:0,style:{borderLeft:`1px solid var(--mantine-color-default-border)`}},e)),r.frames.map(({span:e,lane:r,left:a,width:s})=>{let c=e.status===`STATUS_CODE_ERROR`,l=s<7,u=c?za(t).bad:Ba(i.indexOf(e.service),t),d=`${e.operation} · ${be(e.duration_ms)} · ${e.service}`,f=(0,V.jsxs)(T,{component:`span`,size:`xs`,fw:700,truncate:!0,children:[l?``:e.operation,s>=12?` · ${be(e.duration_ms)}`:``]}),p={position:`absolute`,left:`${a}%`,top:r*36+6,width:`${Math.max(s,.35)}%`,height:30,overflow:`hidden`,minWidth:3};return(0,V.jsx)(he,{label:`${e.service} · ${e.operation} · ${be(e.duration_ms)}`,withArrow:!0,events:{hover:!0,focus:!0,touch:!1},children:n?(0,V.jsx)(C,{variant:`filled`,color:u,"aria-label":d,px:l?2:`xs`,size:`compact-xs`,onClick:()=>n(e),style:p,children:f}):(0,V.jsx)(o,{role:`img`,tabIndex:0,"aria-label":d,style:{...p,display:`flex`,alignItems:`center`,paddingInline:l?2:8,borderRadius:`var(--mantine-radius-sm)`,background:u,color:kt(u)},children:f})},e.span_id)})]})]})})}),(0,V.jsx)(T,{c:`dimmed`,size:`xs`,children:`Width represents wall-clock duration; lanes preserve span hierarchy without overlap.`})]})}function I8(e){let t=Math.min(...e.map(e=>new Date(e.start).valueOf())),n=Math.max(...e.map(e=>new Date(e.start).valueOf()+e.duration_ms)),r=Math.max(n-t,1),i=new Map(e.map(e=>[e.span_id,e])),a=(e,t=new Set)=>{if(!e.parent_span_id||t.has(e.span_id))return 0;let n=i.get(e.parent_span_id);return n?(t.add(e.span_id),1+a(n,t)):0},o=e.map(e=>{let n=new Date(e.start).valueOf();return{span:e,depth:a(e),start:n,end:n+e.duration_ms,left:(n-t)/r*100,width:e.duration_ms/r*100}}).sort((e,t)=>e.depth-t.depth||e.start-t.start||t.span.duration_ms-e.span.duration_ms),s=[],c=0;for(let e of[...new Set(o.map(e=>e.depth))].sort((e,t)=>e-t)){let t=[];for(let n of o.filter(t=>t.depth===e)){let e=t.findIndex(e=>e<=n.start);e===-1&&(e=t.length),t[e]=n.end,s.push({...n,lane:c+e})}c+=Math.max(t.length,1)}return{frames:s,laneCount:c,total:r}}function L8({client:e,spec:t,time:n,vars:r,target:i,onChange:a}){let o=at(`light`)===`dark`,s=t.panels.find(e=>e.id===i?.panel_id),c=i?.kind===`logs`&&s?.query?.from===`logs`,l=st({queryKey:[`exemplars`,t,i,r],queryFn:({signal:n})=>e.exemplars({dashboard:t,panel_id:i.panel_id,kind:c?`logs`:`traces`,time:{from:i.window_from,to:i.window_to,refresh:`off`},from:i.from,to:i.to,dimensions:i.dimensions,bucket:i.bucket,vars:r},n),enabled:!!(i&&s&&!i.trace_id),retry:!1}),u=st({queryKey:[`drill-trace`,i],queryFn:({signal:t})=>e.trace(i,t),enabled:!!i?.trace_id,retry:!1});return(0,V.jsxs)(et,{opened:!!i,onClose:()=>a(void 0),title:s?`${s.title} · ${i?.kind}`:`Panel selection unavailable`,position:`right`,size:`xl`,children:[i?.trace_id&&(0,V.jsx)(C,{variant:`subtle`,mb:`sm`,onClick:()=>{let{trace_id:e,namespace:t,...n}=i;a(n)},children:`Back to traces`}),!s&&(0,V.jsx)(ee,{color:`bad`,children:`This panel is no longer in the dashboard.`}),(l.isFetching||u.isFetching)&&(0,V.jsx)(se,{role:`status`,"aria-label":`Loading drill data`,size:`sm`}),(l.error||u.error)&&(0,V.jsx)(ee,{color:`bad`,children:(l.error??u.error)?.message}),c&&l.data?.logs&&s&&(0,V.jsx)(A4,{panel:{...s,viz:`logs`},result:{id:s.id,status:l.data.logs.rows?`ok`:`empty`,frame:l.data.logs,elapsed_ms:0,from_ms:Date.parse(i.from),to_ms:Date.parse(i.to)},dark:o,height:500}),c&&l.data?.logs?.rows===0&&(0,V.jsx)(T,{c:`dimmed`,children:`No logs match this selection.`}),!c&&!i?.trace_id&&l.data&&(0,V.jsxs)(S,{gap:`xs`,children:[l.data.traces.length===0&&(0,V.jsx)(T,{c:`dimmed`,children:`No exemplar traces match this selection.`}),l.data.traces.map(e=>(0,V.jsxs)(C,{variant:`default`,justify:`space-between`,onClick:()=>a({...i,trace_id:e.trace_id,namespace:e.namespace}),children:[e.service,` · `,e.operation,` · `,e.duration_ms.toFixed(1),` ms`]},`${e.namespace}/${e.trace_id}`)),l.data.truncated&&(0,V.jsx)(T,{size:`xs`,c:`dimmed`,children:`Showing at most 20 exemplar traces.`})]}),u.data&&(0,V.jsx)(P8,{result:u.data,dark:o})]})}var R8={"5m":`Last 5 minutes`,"15m":`Last 15 minutes`,"1h":`Last hour`,"3h":`Last 3 hours`,"6h":`Last 6 hours`,"12h":`Last 12 hours`,"24h":`Last 24 hours`,"2d":`Last 2 days`,"7d":`Last 7 days`,"30d":`Last 30 days`};function z8(e){return e.from&&e.to?`${_e(e.from)} – ${_e(e.to)}`:R8[e.range??`1h`]??e.range??`Last hour`}function B8({time:e,refresh:t,compare:n,editing:r,fetching:i,updatedAt:a,onRange:o,onAbsolute:s,onZoomOut:c,onRefresh:l,onRefreshNow:u,onCompare:d,onEdit:f,onHistory:p,onShortcuts:m,selecting:h=!1}){let[g,_]=(0,B.useState)(``),[v,b]=(0,B.useState)(``),[x,S]=(0,B.useState)(!1);return(0,V.jsxs)(y,{gap:`xs`,wrap:`wrap`,role:`group`,"aria-label":`Dashboard controls`,children:[(0,V.jsxs)(Ye,{position:`bottom-end`,withinPortal:!0,opened:x,onChange:S,children:[(0,V.jsx)(Ye.Target,{children:(0,V.jsx)(C,{variant:`default`,size:`sm`,leftSection:(0,V.jsx)(Mi,{size:15}),rightSection:(0,V.jsx)(ve,{size:12,weight:`bold`}),children:z8(e)})}),(0,V.jsxs)(Ye.Dropdown,{miw:260,children:[(0,V.jsx)(Ye.Label,{children:`Relative`}),ft.map(t=>(0,V.jsx)(Ye.Item,{onClick:()=>o(t),fw:e.range===t?600:void 0,children:R8[t]},t)),(0,V.jsx)(Ye.Divider,{}),(0,V.jsx)(Ye.Label,{children:`Absolute (your time zone)`}),(0,V.jsxs)(y,{gap:6,px:`xs`,pb:`xs`,wrap:`nowrap`,children:[(0,V.jsx)(Me,{type:`datetime-local`,size:`xs`,"aria-label":`From`,value:g,onChange:e=>_(e.currentTarget.value)}),(0,V.jsx)(Me,{type:`datetime-local`,size:`xs`,"aria-label":`To`,value:v,onChange:e=>b(e.currentTarget.value)})]}),(0,V.jsx)(y,{px:`xs`,pb:`xs`,justify:`flex-end`,children:(0,V.jsx)(C,{size:`compact-sm`,disabled:!g||!v||g>=v,onClick:()=>{s(new Date(g).toISOString(),new Date(v).toISOString()),S(!1)},children:`Apply range`})})]})]}),(0,V.jsx)(he,{label:`Zoom out`,children:(0,V.jsx)(C,{variant:`default`,size:`sm`,px:10,"aria-label":`Zoom out`,onClick:c,children:(0,V.jsx)(Wi,{size:15})})}),(0,V.jsxs)(y,{"data-refresh-controls":!0,gap:4,wrap:`nowrap`,children:[(0,V.jsx)(he,{label:a?`Updated ${_e(a)}`:`Refresh now`,children:(0,V.jsx)(C,{variant:`default`,size:`sm`,px:10,"aria-label":`Refresh now`,loading:i,onClick:u,children:(0,V.jsx)(Si,{size:15})})}),(0,V.jsx)(Ur,{size:`xs`,"aria-label":`Auto refresh`,value:t,onChange:l,data:jt.map(e=>({value:e,label:e===`off`?`Off`:e}))})]}),(0,V.jsx)(si,{size:`sm`,label:`Compare with previous period`,checked:n,onChange:e=>d(e.currentTarget.checked)}),(0,V.jsx)(C,{variant:r?`filled`:`default`,size:`sm`,leftSection:(0,V.jsx)(Ve,{size:15}),onClick:f,children:r?`Done`:`Edit layout`}),(0,V.jsx)(C,{variant:`default`,size:`sm`,leftSection:(0,V.jsx)(Pi,{size:15}),onClick:p,children:`History`}),m&&(0,V.jsx)(P4,{onClick:m}),a&&(0,V.jsxs)(T,{size:`xs`,c:`dimmed`,visibleFrom:`md`,children:[`Updated `,new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`,second:`2-digit`}).format(a)]}),h&&(0,V.jsx)(T,{"data-range-paused":!0,size:`xs`,c:`dimmed`,role:`status`,children:`Paused while selecting`})]})}var V8=(e,t)=>!(t instanceof Ne&&t.status<500)&&e<2,H8=(e,t)=>!(t instanceof Ne&&t.code===`timeout`)&&V8(e,t),U8=e=>({panels:e.panels.map(({grid:e,...t})=>t),variables:e.variables,time:e.time,annotations:e.annotations});function W8(e,t,n,r,i){return[`panels`,JSON.stringify([e,U8(t),n,r,i])]}function G8(e,t,n,r){return[`variables`,e,U8(t),n,r]}async function K8(e,t){let n=await Xe(e,t),r=new Set(e.dashboard.panels.filter(e=>[`timeseries`,`heatmap`,`state_timeline`].includes(e.viz)).map(e=>e.id)),i=n.filter(e=>r.has(e.id)&&e.from_ms!==void 0&&e.to_ms!==void 0&&e.from_mse.from_ms)),o=Math.max(...i.map(e=>e.to_ms));try{return{results:n,annotations:await yt({from:new Date(a).toISOString(),to:new Date(o).toISOString()},t)}}catch(e){if(t?.aborted)throw e;return{results:n,annotation_error:e instanceof Error?e.message:`Annotations unavailable`}}}var q8={off:!1,"10s":1e4,"30s":3e4,"1m":6e4,"5m":3e5},J8=0;function Y8(e,t){let[n,r]=e.queryKey;if(n!==`panels`||typeof r!=`string`)return!1;try{return JSON.parse(r)[0]===t}catch{return!1}}function X8({dashboardId:e,spec:t,time:n,vars:r,compare:i,widths:a,visible:o,refresh:s,enabled:c=!0}){let l=(0,B.useMemo)(()=>Object.fromEntries(Object.entries(a).map(([e,t])=>[e,Math.max(100,Math.round(t/100)*100)])),[a]),u=W8(e,t,n,r,i),d=u[1],f=o.filter(e=>t.panels.some(t=>t.id===e)),p=(0,B.useRef)([]),m=(0,B.useRef)(void 0),h=(0,B.useRef)(null),g=(0,B.useRef)(!1),_=(0,B.useRef)(null),v=(0,B.useRef)({key:d,ids:new Set}),[y,b]=(0,B.useState)({key:d}),[x,S]=(0,B.useState)({key:d,results:new Map,updated:new Map,stale:new Set,receivedAt:0}),C=f.length===0&&x.key===d&&x.receivedAt>0,w=c&&t.panels.some(e=>e.viz!==`text`),T=st({queryKey:u,queryFn:({signal:e})=>{if(C&&h.current?.key!==d)return p.current=[],Promise.resolve({results:[],hasTimePanels:!1,batch:++J8});let a=h.current?.key===d?h.current.ids:f;p.current=(a.length?[...a]:t.panels.map(e=>e.id)).sort(),v.current.key!==d&&(v.current={key:d,ids:new Set});for(let e of p.current)v.current.ids.add(e);let o=[...p.current];return K8({dashboard:t,panels:o,time:n,vars:r,widths:l,compare:i},e).then(e=>{let n=new Set(e.results.map(e=>e.id)),r=o.filter(e=>!n.has(e)&&t.panels.find(t=>t.id===e)?.viz!==`text`).map(e=>({id:e,status:`error`,elapsed_ms:0,error:`No result was returned for this panel; refresh to retry.`,request_error:o}));return{...e,batch:++J8,results:[...e.results.map(e=>B4(e,o)),...r],hasTimePanels:t.panels.some(e=>o.includes(e.id)&&[`timeseries`,`heatmap`,`state_timeline`].includes(e.viz))}}).catch(n=>{throw e.aborted||(m.current={key:d,ids:o.filter(e=>t.panels.find(t=>t.id===e)?.viz!==`text`),error:n instanceof Error?n.message:String(n),retryable:!(n instanceof Ne)||n.status===408||n.status===429||n.status>=500}),n})},retry:H8,enabled:w,refetchInterval:C?!1:q8[s]??3e4,staleTime:5e3,placeholderData:e=>e}),E=T.error&&m.current?.key===d?m.current:void 0,D=(0,B.useMemo)(()=>Z8(x,d,T.isPlaceholderData?void 0:T.data?.results,T.dataUpdatedAt,T.data?.batch,E),[x,d,T.data,T.dataUpdatedAt,T.isPlaceholderData,T.error,T.errorUpdatedAt]),O=D.results,k=T.isPlaceholderData?void 0:T.data?.hasTimePanels?T.data:y.key===d?y:void 0;(0,B.useEffect)(()=>{!T.isPlaceholderData&&T.data?.hasTimePanels&&b({key:d,annotations:T.data.annotations,annotation_error:T.data.annotation_error})},[d,T.data,T.isPlaceholderData]),(0,B.useEffect)(()=>{T.isPlaceholderData||S(e=>Z8(e,d,T.data?.results,T.dataUpdatedAt,T.data?.batch,E))},[d,T.data,T.dataUpdatedAt,T.isPlaceholderData,T.error,T.errorUpdatedAt]);let A=new Map([...D.stale].flatMap(e=>{let t=D.updated.get(e);return t?[[e,t]]:[]})),j=(T.data?.results??[]).find(e=>e.status===`error`&&D.stale.has(e.id));(0,B.useEffect)(()=>{if(!w||T.isFetching||g.current||_.current?.key===d||h.current?.key===d)return;let e=v.current.key===d?v.current.ids:new Set,n=[...new Set(f.filter(n=>!O.has(n)&&!e.has(n)&&t.panels.find(e=>e.id===n)?.viz!==`text`))].sort();if(!n.length)return;let r={key:d,ids:n};h.current=r,T.refetch({cancelRefetch:!1}).finally(()=>{h.current===r&&(h.current=null)})},[o,w,d,T.isFetching,T.error,T.refetch,O,t.panels]),(0,B.useEffect)(()=>{!T.isFetching&&_.current?.key!==d&&g.current&&(g.current=!1,h.current=null,w&&!C&&T.refetch({cancelRefetch:!1}))},[T.isFetching,d,w,C,T.refetch]);let M=e=>{let t={key:d,ids:e};h.current=t,T.refetch({cancelRefetch:!1}).finally(()=>{h.current===t&&(h.current=null)})};return(0,B.useEffect)(()=>{if(T.isFetching||!_.current)return;let e=_.current;if(_.current=null,e.key!==d||!w)return;let n=[...e.ids].filter(e=>t.panels.some(t=>t.id===e&&t.viz!==`text`)&&O.get(e)?.request_error).sort();n.length&&M(n)},[T.isFetching,d,w,O,t.panels]),{retry:e=>{if(!w)return;let n=e?O.get(e)?.request_error??[]:[...O.values()].flatMap(e=>e.request_error??[]),r=[...new Set(n)].filter(e=>t.panels.some(t=>t.id===e&&t.viz!==`text`)&&O.get(e)?.request_error).sort();if(r.length){if(T.isFetching){_.current?.key!==d&&(_.current={key:d,ids:new Set});for(let e of r)_.current.ids.add(e);return}M(r)}},results:O,staleAt:A,annotations:k?.annotations,annotationError:k?.annotation_error,fetchingIds:T.isFetching?p.current:[],fetching:T.isFetching,error:T.error??(j?Error(j.error??`Panel refresh failed`):null),updatedAt:T.isPlaceholderData?null:T.dataUpdatedAt||null,refetch:()=>{if(w&&!C){if(T.isFetching){h.current?.key===d&&(g.current=!0);return}T.refetch({cancelRefetch:!1})}}}}function Z8(e,t,n,r,i,a){let o=e.key===t?{key:t,results:new Map(e.results),updated:new Map(e.updated),stale:new Set(e.stale),receivedAt:e.receivedAt,receivedBatch:e.receivedBatch}:{key:t,results:new Map,updated:new Map,stale:new Set,receivedAt:0};for(let e of n&&i!==o.receivedBatch?n:[])e.status===`error`&&o.results.get(e.id)?.frame?(o.stale.add(e.id),o.results.set(e.id,{...o.results.get(e.id),error:e.error,request_error:e.request_error})):(o.results.set(e.id,e),o.updated.set(e.id,r),o.stale.delete(e.id));n&&(o.receivedAt=r,o.receivedBatch=i);for(let e of a?.ids??[]){let t=o.results.get(e);t?.frame?(o.stale.add(e),o.results.set(e,{...t,error:a.error,request_error:a.retryable?a.ids:void 0})):o.results.set(e,{id:e,status:`error`,elapsed_ms:0,error:a.error,request_error:a.retryable?a.ids:void 0})}return o}function Q8(e,t){return e.queryKey[0]===`variables`&&e.queryKey[1]===t}function $8(e,t,n,r,i,a=!1){let o=!!t.variables?.some(e=>e.kind===`query`),s=st({queryKey:G8(e,t,n,r),queryFn:async({signal:e})=>{let a=await i({dashboard:t,time:n,vars:r},e);return Object.fromEntries((t.variables??[]).map(e=>[e.name,a[e.name]??(e.kind===`custom`?e.options?.map(e=>({value:e})):void 0)??[]]))},enabled:o,retry:a,staleTime:6e4,placeholderData:e=>e}),c=s.isPlaceholderData?void 0:s.data,l=s.isError||(t.variables??[]).every(e=>e.kind!==`query`||r[e.name]!==void 0&&r[e.name]!==`$__all`&&(e.multi||!Array.isArray(r[e.name])||r[e.name].length>0)||!!e.default||e.include_all||c?.[e.name]!==void 0);return{...s,currentData:c,ready:l}}function e5(e){return t=>Y8(t,e)||Q8(t,`dashboard-${e}`)}function t5({id:e,currentVersion:t,opened:n,onClose:r,onRestored:i}){let a=tt(),[o,s]=(0,B.useState)(),[c,l]=(0,B.useState)(``),[u,d]=(0,B.useState)(!1),[f,p]=(0,B.useState)(n),m=(0,B.useRef)(0),h=(0,B.useRef)(n);h.current=n;let g=(0,B.useRef)(!1),_=(0,B.useRef)(!1),v=(0,B.useRef)(i);v.current=i,(0,B.useEffect)(()=>(_.current=!0,()=>{_.current=!1}),[]);let y=Oe({mutationFn:({version:t})=>Ue(e,t),retry:!1,onSuccess:(t,{version:n,generation:r})=>{a.cancelQueries({queryKey:[`dashboard`,e],exact:!0}),a.cancelQueries({predicate:e5(e)}),a.cancelQueries({queryKey:[`exemplars`]}),a.cancelQueries({queryKey:[`drill-trace`]}),a.setQueryData([`dashboard`,e],t),a.invalidateQueries({predicate:e5(e),refetchType:`none`}),_.current&&(h.current&&r===m.current&&l(`Restored v${n} as v${t.version}`),v.current(t)),a.invalidateQueries({queryKey:Fe}),a.invalidateQueries({queryKey:[`dashboard-versions`,e]},{cancelRefetch:!1}),a.invalidateQueries({queryKey:[`exemplars`],refetchType:`none`}),a.invalidateQueries({queryKey:[`drill-trace`],refetchType:`none`})},onError:t=>{t instanceof Ne&&t.code===`dashboard_version_not_found`&&a.invalidateQueries({queryKey:[`dashboard-versions`,e]})},onSettled:()=>{g.current=!1,_.current&&d(!1)}}),b=()=>{m.current++,y.reset(),l(``)};(0,B.useEffect)(()=>{if(n){p(!0);return}m.current++,y.reset(),l(``),a.cancelQueries({queryKey:[`dashboard-versions`,e]}),a.cancelQueries({queryKey:[`dashboard-version`,e]})},[n,e,a,y.reset]);let x=(0,B.useRef)(t);return(0,B.useEffect)(()=>{x.current!==t&&(x.current=t,a.invalidateQueries({queryKey:[`dashboard-versions`,e]},{cancelRefetch:!1}))},[t,e,a]),(0,V.jsx)(et,{opened:n,onClose:()=>{b(),r()},onExitTransitionEnd:()=>p(!1),title:`Version history`,position:`right`,size:`xl`,children:(n||f)&&(0,V.jsx)(n5,{id:e,opened:n,currentVersion:t,selected:o,onSelect:e=>{b(),s(e)},pending:u,error:y.error,failedVersion:y.variables?.version,success:c,onRestore:e=>{g.current||(g.current=!0,d(!0),l(``),y.mutate({version:e,generation:m.current}))}})})}function n5({id:e,opened:t,currentVersion:n,selected:r,onSelect:i,pending:a,error:s,failedVersion:c,success:l,onRestore:u}){let d=st({queryKey:[`dashboard-versions`,e],queryFn:({signal:t})=>xt(e,t),enabled:t,retry:!1}),f=r??d.data?.[0]?.version,p=st({queryKey:[`dashboard-version`,e,f],queryFn:({signal:t})=>Ie(e,f,t),enabled:t&&f!==void 0,retry:!1});return(0,V.jsxs)(S,{gap:`md`,"data-version-history":!0,children:[(0,V.jsx)(T,{size:`sm`,c:`dimmed`,children:`Inspect saved specs and changes. Restoring adds a new version.`}),l&&(0,V.jsx)(ee,{color:`ok`,role:`status`,children:l}),s&&c===f&&(0,V.jsx)(o5,{error:s,version:f}),(0,V.jsxs)(o,{mih:160,children:[d.isPending&&(0,V.jsxs)(y,{gap:`xs`,role:`status`,children:[(0,V.jsx)(se,{size:`sm`}),(0,V.jsx)(T,{size:`sm`,children:`Loading history…`})]}),d.error&&(0,V.jsxs)(ee,{color:`bad`,title:`History unavailable`,children:[d.error.message,(0,V.jsx)(C,{mt:`xs`,variant:`default`,size:`xs`,onClick:()=>void d.refetch(),children:`Retry history`})]}),d.data?.length===0&&(0,V.jsx)(T,{c:`dimmed`,children:`No versions available.`}),!!d.data?.length&&(0,V.jsx)(me,{h:200,type:`auto`,children:(0,V.jsx)(S,{gap:`xs`,pr:`sm`,role:`list`,"aria-label":`Saved versions`,children:d.data.map(e=>(0,V.jsxs)(z,{role:`listitem`,withBorder:!0,p:`xs`,radius:`sm`,style:{borderColor:f===e.version?`var(--mantine-color-brand-filled)`:void 0},children:[(0,V.jsxs)(y,{justify:`space-between`,gap:`xs`,children:[(0,V.jsxs)(C,{variant:f===e.version?`light`:`subtle`,size:`compact-sm`,"aria-pressed":f===e.version,onClick:()=>i(e.version),children:[`Version `,e.version]}),e.version===n&&(0,V.jsx)(We,{color:`gray`,variant:`light`,tt:`none`,children:`Current`}),(0,V.jsx)(i5,{at:e.created_at})]}),(0,V.jsxs)(T,{size:`xs`,c:`dimmed`,mt:4,children:[r5(e),` · `,e.message||`No edit message`]})]},e.version))})})]}),(0,V.jsx)(He,{role:`status`,"aria-live":`polite`,children:f===void 0?`Select a version.`:p.isFetching?`Loading version ${f}…`:p.error?`Version ${f} unavailable.`:`Version ${f} ready.`}),(0,V.jsxs)(o,{mih:280,"aria-busy":p.isFetching,children:[f!==void 0&&p.isPending&&(0,V.jsxs)(y,{gap:`xs`,role:`status`,children:[(0,V.jsx)(se,{size:`sm`}),(0,V.jsx)(T,{size:`sm`,children:`Loading version…`})]}),p.error&&(0,V.jsxs)(ee,{color:`bad`,title:p.error instanceof Ne&&p.error.code===`dashboard_version_not_found`?`This version is no longer available`:`Version unavailable`,children:[p.error.message,(0,V.jsx)(C,{mt:`xs`,variant:`default`,size:`xs`,onClick:()=>void p.refetch(),children:`Retry version`})]}),p.data&&!p.error&&(0,V.jsx)(a5,{record:p.data,currentVersion:n,pending:a,onRestore:()=>u(p.data.dashboard.version)})]})]})}function r5(e){return e.author_kind===`agent`?`Agent`:e.author_kind===`user`?`You`:`System`}function i5({at:e}){let t=(Date.parse(e)-Date.now())/1e3,[n,r]=Math.abs(t)<60?[1,`second`]:Math.abs(t)<3600?[60,`minute`]:Math.abs(t)<86400?[3600,`hour`]:[86400,`day`];return(0,V.jsx)(T,{component:`time`,dateTime:e,title:_e(e),size:`xs`,c:`dimmed`,children:new Intl.RelativeTimeFormat(void 0,{numeric:`auto`}).format(Math.round(t/n),r)})}function a5({record:e,currentVersion:t,pending:n,onRestore:r}){let{dashboard:i}=e,a=ce(e);return(0,V.jsxs)(S,{gap:`sm`,"data-history-version":i.version,children:[(0,V.jsxs)(y,{justify:`space-between`,align:`flex-start`,children:[(0,V.jsxs)(o,{miw:0,children:[(0,V.jsxs)(I,{order:2,fz:`lg`,children:[i.name,` · v`,i.version]}),(0,V.jsxs)(T,{size:`sm`,c:`dimmed`,children:[r5(e),` · `,e.message||`No edit message`]}),(0,V.jsx)(i5,{at:e.created_at})]}),i.version===t?(0,V.jsx)(C,{size:`sm`,variant:`default`,disabled:!0,children:`Current version`}):(0,V.jsxs)(C,{size:`sm`,disabled:n,loading:n,onClick:r,children:[`Restore version `,i.version]})]}),i.description&&(0,V.jsx)(T,{size:`sm`,children:i.description}),e.changes_available?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Ee,{labels:a}),!a.length&&!e.layout_changed&&(0,V.jsx)(T,{size:`sm`,c:`dimmed`,children:`No authored changes.`})]}):(0,V.jsx)(ee,{color:`warn`,title:`Changes unavailable`,children:`The preceding version is no longer retained. This saved spec is still available.`}),(0,V.jsxs)(T,{size:`sm`,c:`dimmed`,children:[`Read-only · `,i.spec.panels.length,` panels. Historical data is not queried.`]}),(0,V.jsxs)(mn,{variant:`contained`,children:[(0,V.jsxs)(mn.Item,{value:`spec`,children:[(0,V.jsx)(mn.Control,{children:`Spec`}),(0,V.jsx)(mn.Panel,{children:(0,V.jsx)(ze,{block:!0,tabIndex:0,style:{maxHeight:320,overflow:`auto`},children:JSON.stringify(i.spec,null,2)})})]}),(0,V.jsxs)(mn.Item,{value:`data`,children:[(0,V.jsx)(mn.Control,{children:`Data`}),(0,V.jsx)(mn.Panel,{children:(0,V.jsx)(S,{gap:`xs`,children:i.spec.panels.map(e=>(0,V.jsxs)(o,{children:[(0,V.jsxs)(T,{size:`sm`,fw:500,children:[e.title,` · `,e.viz]}),(0,V.jsx)(ze,{block:!0,tabIndex:0,children:e.content??e.sql??JSON.stringify(e.query??{},null,2)})]},e.id))})})]})]})]})}function o5({error:e,version:t}){let n=e instanceof Ne?e.code:void 0,r=!(e instanceof Ne)||e.status>=500?`Try again with the restore button.`:n===`invalid_spec`?`This saved spec is invalid. Review the fields below and choose another version.`:n===`dashboard_version_not_found`?`Reload history and choose a retained version.`:[`already_current`,`dashboard_version_conflict`,`conflict`].includes(n??``)?`This dashboard changed or its name conflicts. Reload history and choose another version.`:`Check your access and reload history.`;return(0,V.jsxs)(ee,{color:`bad`,title:`Restore of version ${t} failed`,children:[(0,V.jsx)(T,{size:`sm`,children:e.message}),e instanceof Ne&&e.problems.length>0&&(0,V.jsx)(`ul`,{children:e.problems.map((e,t)=>(0,V.jsxs)(`li`,{children:[e.path,`: `,e.message,e.hint?` (${e.hint})`:``]},t))}),(0,V.jsx)(T,{size:`sm`,mt:`xs`,children:r})]})}function s5(e,t){let n=JSON.stringify([e.range,e.from,e.to]),r=(0,B.useRef)({search:e,onSearch:t,scope:n}),i=(0,B.useRef)(``),a=(0,B.useRef)(void 0),[o,s]=(0,B.useState)(!1);r.current.scope!==n&&(i.current!==`${e.from}/${e.to}`&&(a.current=void 0,o&&s(!1)),i.current=``),r.current={search:e,onSearch:t,scope:n};let c=(0,B.useCallback)(()=>{i.current=``,a.current=void 0,s(!1)},[]),l=(0,B.useCallback)(()=>{if(!a.current)return;let e=a.current;c(),r.current.onSearch({...r.current.search,...e},!1)},[c]);return{zoom:(0,B.useCallback)((e,t)=>{let n=sa(e,t);if(!n)return;let o=r.current,c=`${n.from}/${n.to}`;o.search.from===n.from&&o.search.to===n.to||i.current===c||(a.current??={range:o.search.range,from:o.search.from,to:o.search.to},s(!0),i.current=c,o.onSearch({...o.search,range:void 0,...n},!1))},[]),reset:c,resetZoom:l,zoomed:o}}function c5({variables:e,vars:t,options:n,onChange:r}){return e.length===0?null:(0,V.jsx)(y,{gap:`sm`,wrap:`wrap`,role:`group`,"aria-label":`Dashboard variables`,children:e.map(e=>{let i=Yi(e,t,n[e.name]),a=[...e.include_all?[{value:Ji,label:`All`}]:[],...(n[e.name]??e.options?.map(e=>({value:e}))??[]).map(e=>({value:e.value,label:e.value}))],o=(0,V.jsxs)(T,{size:`xs`,c:`dimmed`,ff:`monospace`,children:[`$`,e.name]});return e.kind===`constant`?(0,V.jsx)(Me,{label:o,size:`xs`,value:e.value,readOnly:!0,w:160},e.name):e.kind===`text`?(0,V.jsx)(Me,{label:o,size:`xs`,w:200,defaultValue:typeof i==`string`?i:``,onBlur:t=>r(e.name,t.currentTarget.value),onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur()}},`${e.name}:${JSON.stringify(i)}`):e.multi?(0,V.jsx)(Ar,{label:o,size:`xs`,w:260,searchable:!0,clearable:!0,data:a.filter(e=>e.value!==Ji),value:Array.isArray(i)?i:i&&i!==`$__all`?[i]:[],placeholder:e.include_all?`All`:`None`,onChange:t=>r(e.name,t.length?t:e.include_all?Ji:[])},e.name):(0,V.jsx)(Gr,{label:o,size:`xs`,w:220,searchable:!0,allowDeselect:!1,data:a,value:Array.isArray(i)?i[0]??null:i||null,onChange:t=>t!==null&&r(e.name,t)},e.name)})})}function l5(e,t,n=!1){let r=e.target;return t||e.defaultPrevented||e.repeat||e.ctrlKey||e.metaKey||e.altKey||e.shiftKey&&e.key!==`?`||r instanceof Element&&r.closest(`input,textarea,select,[contenteditable]:not([contenteditable="false"]),[role="textbox"],[role="menu"]`)||r instanceof Element&&r.closest(`[role="dialog"]`)&&!(n&&r.closest(`[data-panel-fullscreen]`))?null:[`r`,`e`,`h`,`f`,`?`].includes(e.key)?e.key:null}function u5(e,t,n={}){let r=(0,B.useRef)({actions:t,options:n});r.current={actions:t,options:n},(0,B.useEffect)(()=>{let t=t=>{let n=e.current,i=t.target,{actions:a,options:o}=r.current;if(!n||!(i instanceof Element)||o.enabled===!1)return;let s=o.fullscreenScope?[...document.querySelectorAll(`[data-shortcut-scope]`)].find(e=>e.dataset.shortcutScope===o.fullscreenScope&&e.hasAttribute(`data-panel-fullscreen`)):void 0,c=n.contains(i)&&n.contains(document.activeElement),l=i===document.body&&document.activeElement===document.body,u=s?.contains(i)&&s.contains(document.activeElement);if(!c&&!l&&!u)return;let d=l5(t,!!(o.modalOpen||[...document.querySelectorAll(`[role="dialog"]`)].some(e=>e!==s)),!!s);if(!d||s&&![`r`,`f`,`?`].includes(d))return;let f=a[d];f&&(t.preventDefault(),f(i))};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[e])}function d5({opened:e,onClose:t,fullscreen:n=!1,enabled:r,onEnabled:i}){let a=[[`r`,`Refresh now`],...n?[]:[[`e`,`Toggle layout mode`],[`h`,`Open history`]],[`f`,n?`Exit full-screen`:`Open the focused panel in full-screen`],[`?`,`Open keyboard shortcuts`],[`Escape`,`Cancel a range, then leave the chart or close full-screen`]];return(0,V.jsx)(bt,{opened:e,onClose:t,title:`Keyboard shortcuts`,trapFocus:!0,returnFocus:!0,closeOnEscape:!0,children:(0,V.jsxs)(S,{gap:`xs`,children:[(0,V.jsx)(si,{label:`Single-key shortcuts`,checked:r,onChange:e=>i(e.currentTarget.checked)}),a.map(([e,t])=>(0,V.jsxs)(y,{gap:`sm`,children:[(0,V.jsx)(Ze,{children:e}),(0,V.jsx)(T,{size:`sm`,children:t})]},e)),!n&&(0,V.jsx)(T,{size:`sm`,children:`Focus a chart or a panel control before pressing f. Without a focused panel, f does nothing.`}),(0,V.jsx)(T,{size:`sm`,children:`Tab directly to a chart. Left/Right moves between points; Up/Down changes series at the same time or category. Home/End jumps to the first/last point. Enter drills or applies the panel filter. Comparison and Other values can be read even when selection is unavailable.`}),(0,V.jsx)(T,{size:`sm`,children:`On time charts, Shift+Left/Right extends a range and pauses auto-refresh. Review the shaded range and compact UTC label, then choose Zoom to range. Use the time picker after zooming for precise edits. Escape or Cancel cancels it and resumes refresh. The next Escape leaves the chart or closes full-screen. Reset zoom, Zoom out and browser Back preserve comparison and filters.`}),(0,V.jsxs)(T,{size:`sm`,children:[n?`In full-screen, r refreshes, f exits and ? opens help; e and h are inactive.`:`Shortcuts work in the dashboard.`,` Typing, menus and other dialogs or drawers pause shortcuts. Modifier shortcuts keep their browser behavior. Turning off single-key shortcuts keeps chart navigation and visible controls available.`]}),(0,V.jsx)(T,{size:`sm`,children:`The global / shortcut focuses the chat composer.`})]})})}function f5(e){let t=`fanout:single-key-shortcuts:`+e,n=()=>{try{return localStorage.getItem(t)!==`off`}catch{return!0}},[r,i]=(0,B.useState)(n);return(0,B.useEffect)(()=>{i(n())},[t]),(0,B.useEffect)(()=>{let e=e=>{e.key===t&&i(n())};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[t]),{enabled:r,change:e=>{i(e);try{localStorage.setItem(t,e?`on`:`off`)}catch{}}}}function p5(e){let t=(0,B.useRef)(void 0),n=t=>[...e.current?.querySelectorAll(`[data-panel]`)??[]].find(e=>e.dataset.panel===t&&!e.closest(`[data-panel-fullscreen],[data-fragment-fullscreen]`));return(0,B.useEffect)(()=>{t.current&&!n(t.current.panel)&&(t.current=void 0)}),{remember(n){t.current=void 0;let r=document.activeElement;if(!(r instanceof HTMLElement)||!e.current?.contains(r)||r.closest(`[data-panel]`)?.dataset.panel!==n)return;let i=r.getAttribute(`data-panel-view`),a=r.getAttribute(`aria-label`),o=r.hasAttribute(`data-chart-plot`)?`[data-chart-plot]`:i?`[data-panel-view=${JSON.stringify(i)}]`:a?`[aria-label=${JSON.stringify(a)}]`:void 0;t.current={element:r,panel:n,selector:o}},restore(e){let r=t.current;if(t.current=void 0,r&&(e===void 0||r.panel===e)&&n(r.panel))return r.element.isConnected&&!r.element.closest(`[hidden]`)?r.element:r.selector?n(r.panel)?.querySelector(r.selector)??void 0:void 0}}}var m5={exemplars:Je,trace:Le},h5={"5m":`15m`,"15m":`1h`,"1h":`3h`,"3h":`6h`,"6h":`12h`,"12h":`24h`,"24h":`2d`,"2d":`7d`,"7d":`30d`,"30d":`30d`};function g5({dashboardId:e,search:t,onSearch:n,onOpen:r}){let{agentAvailable:i,openChat:a}=le(),o=st({queryKey:Fe,queryFn:Qe,staleTime:15e3});(0,B.useEffect)(()=>{!e&&o.data?.length&&r((o.data.find(e=>e.is_default)??o.data[0]).id,!0)},[e,o.data]);let s=st({queryKey:[`dashboard`,e],queryFn:({signal:t})=>Mt(e,t),enabled:!!e,retry:(e,t)=>!(t instanceof Ne&&t.code===`not_found`)&&e<2});return!e&&o.error?(0,V.jsx)(ae,{mih:`50vh`,children:(0,V.jsx)(ee,{color:`bad`,title:`Dashboards could not be loaded`,children:o.error.message})}):!e&&o.data?.length===0?(0,V.jsx)(ae,{mih:`50vh`,children:(0,V.jsxs)(S,{align:`center`,gap:`xs`,children:[(0,V.jsx)(I,{order:1,fz:24,children:`No dashboards yet`}),(0,V.jsx)(T,{c:`dimmed`,size:`sm`,ta:`center`,children:`Create a dashboard to explore your services.`}),i&&(0,V.jsx)(C,{mt:`sm`,size:`sm`,onClick:()=>a(`Build me a dashboard for my services, showing request volume, latency, and errors. Ask me which services to monitor first.`),children:`Create with AI`})]})}):!e||s.isLoading?(0,V.jsxs)(ae,{mih:`50vh`,children:[(0,V.jsx)(se,{size:`sm`}),(0,V.jsx)(T,{c:`dimmed`,size:`sm`,ml:`sm`,children:`Loading your dashboard…`})]}):s.error instanceof Ne&&s.error.code===`not_found`?(0,V.jsx)(ae,{mih:`50vh`,children:(0,V.jsxs)(S,{align:`center`,gap:`xs`,children:[(0,V.jsx)(I,{order:1,fz:24,children:`This dashboard isn't here`}),(0,V.jsx)(T,{c:`dimmed`,size:`sm`,ta:`center`,children:`The link may be out of date, or the dashboard may have been deleted.`}),o.data?.length?(0,V.jsx)(C,{mt:`sm`,variant:`default`,size:`sm`,onClick:()=>r((o.data.find(e=>e.is_default)??o.data[0]).id,!0),children:`Open your default dashboard`}):null]})}):s.error||!s.data?(0,V.jsx)(ae,{mih:`50vh`,children:(0,V.jsx)(T,{c:`dimmed`,size:`sm`,children:`Your dashboard is unavailable. Try refreshing.`})}):(0,V.jsx)(_5,{id:s.data.id,version:s.data.version,spec:s.data.spec,search:t,onSearch:n,agentAvailable:i,openChat:a},s.data.id)}function _5({id:e,version:t,spec:n,search:r,onSearch:i,agentAvailable:a,openChat:s}){let[c,l]=(0,B.useState)(!1),[u,d]=(0,B.useState)(!1),f=(0,B.useRef)(null),p=(0,B.useId)(),m=f5(nt().id),h=p5(f),[g,_]=(0,B.useState)(()=>new Set),v=(0,B.useCallback)((e,t)=>_(n=>{if(n.has(e)===t)return n;let r=new Set(n);return t?r.add(e):r.delete(e),r}),[]),b=tt(),[x,w]=(0,B.useState)(),{zoom:E,reset:D,resetZoom:O,zoomed:k}=s5(r,i),A=_t(n,r),[j,M]=(0,B.useState)(A.refresh??`30s`),N=r.compare?r.compare===`1`:n.time.compare===`previous_period`,P=r.vars??{},F=$8(`dashboard-${e}`,n,A,P,Re,V8),L=(0,B.useMemo)(()=>Zi(n.variables,P,F.currentData),[n.variables,P,F.currentData]),[te,ne]=(0,B.useState)(()=>window.innerWidth);(0,B.useEffect)(()=>{let e=0,t=()=>{window.clearTimeout(e),e=window.setTimeout(()=>ne(window.innerWidth),300)};return window.addEventListener(`resize`,t),()=>{window.removeEventListener(`resize`,t),window.clearTimeout(e)}},[]);let re=(0,B.useMemo)(()=>{let e=Math.max(320,Math.min(te-64,1600));return Object.fromEntries(n.panels.map(t=>[t.id,e/12*(t.grid?.w??t.width??6)]))},[te,n]),[ie,ae]=(0,B.useState)(()=>n.panels.map(e=>e.id)),R=X8({dashboardId:e,version:t,spec:n,time:A,vars:L,compare:N,widths:re,visible:(0,B.useMemo)(()=>ie.filter(e=>n.panels.some(t=>t.id===e)),[ie,n.panels]),refresh:g.size?`off`:j,enabled:F.ready});(0,B.useEffect)(()=>{x===t&&b.refetchQueries({predicate:e5(e),type:`active`,stale:!0},{cancelRefetch:!1})},[x,t,e,b]);let oe=(0,B.useMemo)(()=>R.annotations?{...R.annotations,deploys:n.annotations?.deploys===!1?[]:R.annotations.deploys,anomalies:n.annotations?.anomalies===!1?[]:R.annotations.anomalies}:void 0,[R.annotations,n.annotations?.deploys,n.annotations?.anomalies]),z=F.error??R.error,se=(e,t)=>{let n={...P};t===void 0?delete n[e]:n[e]=t,i({...r,vars:n},!0)},ce=()=>i({...r,edit:r.edit===`1`?void 0:`1`}),le=e=>{e&&h.remember(e),i({...r,view:e},e===void 0)};return u5(f,{r:()=>R.refetch(),e:ce,h:()=>l(!0),"?":()=>d(!0),f:e=>{if(r.view){le();return}let t=e.closest(`[data-panel]`)?.dataset.panel;t&&n.panels.some(e=>e.id===t)&&le(t)}},{modalOpen:c||u||!!r.drill,fullscreenScope:r.view?p:void 0,enabled:m.enabled}),(0,V.jsxs)(o,{component:`main`,ref:f,"aria-label":`Dashboard`,maw:1600,mx:`auto`,px:{base:`md`,sm:`xl`},pt:`lg`,pb:`xl`,children:[(0,V.jsxs)(S,{gap:`sm`,mb:`md`,children:[(0,V.jsxs)(y,{justify:`space-between`,align:`flex-start`,wrap:`wrap`,gap:`sm`,children:[(0,V.jsxs)(o,{miw:0,children:[(0,V.jsx)(I,{order:1,fz:28,lts:`-0.02em`,children:n.name}),n.description&&(0,V.jsx)(T,{c:`dimmed`,size:`sm`,mt:2,children:n.description})]}),(0,V.jsx)(B8,{selecting:g.size>0,time:A,refresh:j,compare:N,editing:r.edit===`1`,fetching:R.fetching,updatedAt:R.updatedAt,onRange:e=>{D(),i({...r,range:e,from:void 0,to:void 0})},onAbsolute:(e,t)=>{D(),i({...r,range:void 0,from:e,to:t})},onZoomOut:()=>{if(A.from&&A.to){let e=Date.parse(A.from),t=Date.parse(A.to),n=(t-e)/2;i({...r,range:void 0,from:new Date(e-n).toISOString(),to:new Date(t+n).toISOString()})}else i({...r,range:h5[A.range??`1h`]??`1h`,from:void 0,to:void 0})},onRefresh:M,onRefreshNow:R.refetch,onCompare:e=>i({...r,compare:e?`1`:`0`},!0),onEdit:ce,onHistory:()=>l(!0),onShortcuts:()=>d(!0)})]}),(0,V.jsx)(c5,{variables:n.variables??[],vars:P,options:F.data??{},onChange:se}),Object.entries(P).filter(([,e])=>e!==`$__all`).length>0&&(0,V.jsx)(y,{gap:6,children:Object.entries(P).filter(([,e])=>e!==`$__all`).map(([e,t])=>(0,V.jsxs)(C,{size:`compact-xs`,variant:`light`,"aria-label":`$${e} = ${Array.isArray(t)?t.join(`, `):t} ×: remove filter`,onClick:()=>se(e,void 0),children:[`$`,e,` = `,Array.isArray(t)?t.join(`, `):t,` ×`]},e))}),R.annotationError&&(0,V.jsx)(ee,{color:`warn`,title:`Annotations unavailable`,children:R.annotationError}),R.annotations?.truncated&&(0,V.jsx)(T,{size:`xs`,c:`warn`,role:`status`,children:`Annotation history is limited.`})]}),z&&(0,V.jsxs)(ee,{color:`bad`,icon:(0,V.jsx)(Ae,{size:18,weight:`fill`}),mb:`md`,title:F.error?`Variables could not be loaded`:`Panels could not be loaded`,children:[z.message,z instanceof Ne&&(0,V.jsx)(`ul`,{children:z.problems.map((e,t)=>(0,V.jsxs)(`li`,{children:[e.path,`: `,e.message,e.hint?` (${e.hint})`:``]},t))})]}),(0,V.jsx)(O8,{dashboardId:e,version:t,spec:n,vars:L,results:R.results,annotations:oe,fetching:R.fetching,fetchingIds:R.fetchingIds,staleAt:R.staleAt,time:{...A,compare:N?`previous_period`:void 0},onEditExit:()=>i({...r,edit:void 0}),editing:r.edit===`1`,view:r.view,canManage:!0,agentAvailable:a,onOpenChat:s,onRetry:R.retry,onVariable:se,onZoom:E,zoomed:k,onZoomReset:O,onView:le,onRangePending:v,shortcutScope:p,onShortcuts:()=>d(!0),overlayOpen:c||u||!!r.drill,returnViewFocus:h.restore,onVisible:ae,onPoint:(e,t)=>{let n=v8(e,R.results.get(e.id),t,P);n&&i({...r,vars:n.vars,drill:JSON.stringify(n.target)},!1)}}),(0,V.jsx)(L8,{client:m5,spec:n,time:A,vars:L,target:Nt(r.drill),onChange:e=>i({...r,drill:e?JSON.stringify(e):void 0},!1)}),(0,V.jsx)(t5,{id:e,currentVersion:t,opened:c,onClose:()=>l(!1),onRestored:e=>{w(e.version);let t=new Set(e.spec.panels.map(e=>e.id)),n=Nt(r.drill),a=r.view&&!t.has(r.view)?void 0:r.view,o=n&&!t.has(n.panel_id)?void 0:r.drill;(a!==r.view||o!==r.drill)&&i({...r,view:a,drill:o},!0)}}),(0,V.jsx)(d5,{opened:u,onClose:()=>d(!1),fullscreen:!!r.view,enabled:m.enabled,onEnabled:m.change})]})}export{Xi as i,B4 as n,L4 as r,g5 as t}; \ No newline at end of file diff --git a/internal/ui/dist/assets/panel-sql-editor-DZsqGx1F.js b/internal/ui/dist/assets/panel-sql-editor-DoqW8p7v.js similarity index 99% rename from internal/ui/dist/assets/panel-sql-editor-DZsqGx1F.js rename to internal/ui/dist/assets/panel-sql-editor-DoqW8p7v.js index 20bf44086..33ac7da90 100644 --- a/internal/ui/dist/assets/panel-sql-editor-DZsqGx1F.js +++ b/internal/ui/dist/assets/panel-sql-editor-DoqW8p7v.js @@ -1,4 +1,4 @@ -import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{C as r,_ as i,c as a,d as o,f as s,p as c}from"./brand-DUaZkIz1.js";import{i as l,n as u,r as d}from"./page-BEAiBOTm.js";import{A as f,B as p,C as m,N as h,Q as g,T as _,W as v,jt as y,o as b}from"./index-_VmsjY84.js";var x=n(e(),1),S=[],ee=[];(()=>{let e=`lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,1n,9,16,o,,x,1i,3,,i,,7,a,2,t,3,1k,,,7,2,2,2,3,9,,a,2,q,,2,3,1k,,,5,4,2,2,3,3,,u,2,3,,b,3,1k,,,8,,3,,3,k,2,m,6,,3,1k,,,7,2,2,2,3,7,3,a,2,u,,1n,5,3,3,,4,9,,14,5,1j,,,7,,3,,4,7,2,b,2,t,3,1k,,,7,,3,,4,7,2,b,2,f,,c,4,1j,2,,7,,3,,4,9,,a,2,t,3,1y,,4,6,,,,8,i,2,1p,,,8,c,8,2q,,,a,b,7,21,2,r,,,,,,4,2,1d,k,,2,5,b,,10,9,,2u,b,,6,n,4,4,3,g,4,d,,,3,6,,f,,jj,3,qa,4,s,3,t,2,u,2,1s,w,9,,19,3,,,39,2,y,,3a,c,4,c,63,5,1l,a,,,,,2,o,2,,1c,1a,2,c,k,5,1b,h,12,9,c,3,u,d,1k,e,1c,k,48,3,,l,4,,6,,2,3,5i,1s,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,n,5,4,,2b,2,1e,i,q,i,d,,12,8,p,d,18,4,1b,e,10,,1v,e,c,,8,2,1a,,1f,,,3,2,2,5,2,,,15,5,5,2,6k,8,,2,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,1t,5,8t,2,25,6,1y,b,1d,4,3e,3,1h,f,15,,2,2,a,4,19,b,7,,1p,3,10,e,g,2,18,,c,3,1c,e,8,4,,2,2k,c,6,,2,,4d,c,l,4,1j,2,,7,2,2,2,3,9,,a,2,2,7,3,5,1v,9,,,2,,,4,,5,,,e,2,2a,i,n,,29,k,6j,7,2,9,r,2,2a,h,2y,d,2t,3,2,a,74,f,6t,6,,2,2,4,,,,2,3x,7,2,7,3,,s,a,14,7,,4,8,,9,b,1a,g,5i,8,5j,8,,8,2a,m,,e,3e,6,3,,,2,,7,,,1u,5,,2,,5,9n,4,9,2,,,1c,7,3,5,n,,44l,,6,f,8ug,i,1xc,5,1n,7,t4,,,1j,7,4,29,,b,2,f57,2,3mp,1a,2,n,f2,5,3,6,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,2s,,4g,7,af,,1p,4,e4,4,72,2,6r,,2,,7,2,5,,d6,7,31,7,240,5`.split(`,`).map(e=>e?parseInt(e,36):1);for(let t=0,n=0;t>1;if(e=ee[r])t=r+1;else return!0;if(t==n)return!1}}function ne(e){return e>=127462&&e<=127487}var re=8205;function ie(e,t,n=!0,r=!0){return(n?ae:oe)(e,t,r)}function ae(e,t,n){if(t==e.length)return t;t&&ce(e.charCodeAt(t))&&le(e.charCodeAt(t-1))&&t--;let r=se(e,t);for(t+=ue(r);t=0&&ne(se(e,r));)n++,r-=2;if(n%2==0)break;t+=2}else break}return t}function oe(e,t,n){for(;t>1;){let r=ae(e,t-2,n);if(r=56320&&e<57344}function le(e){return e>=55296&&e<56320}function ue(e){return e<65536?1:2}var C=class e{lineAt(e){if(e<0||e>this.length)throw RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=w(this,e,t);let r=[];return this.decompose(0,e,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(t,this.length,r,1),fe.from(r,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=w(this,e,t);let n=[];return this.decompose(e,t,n,0),fe.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),r=new ge(this),i=new ge(e);for(let e=t,a=t;;){if(r.next(e),i.next(e),e=0,r.lineBreak!=i.lineBreak||r.done!=i.done||r.value!=i.value)return!1;if(a+=r.value.length,r.done||a>=n)return!0}}iter(e=1){return new ge(this,e)}iterRange(e,t=this.length){return new _e(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{t??=this.lines+1;let r=this.line(e).from;n=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new ve(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(t){if(t.length==0)throw RangeError(`A document must have at least one line`);return t.length==1&&!t[0]?e.empty:t.length<=32?new de(t):fe.from(de.split(t,[]))}},de=class e extends C{constructor(e,t=pe(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,r){for(let i=0;;i++){let a=this.text[i],o=r+a.length;if((t?n:o)>=e)return new ye(r,o,n,a);r=o+1,n++}}decompose(t,n,r,i){let a=t<=0&&n>=this.length?this:new e(he(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(i&1){let t=r.pop(),n=me(a.text,t.text.slice(),0,a.length);if(n.length<=32)r.push(new e(n,t.length+a.length));else{let t=n.length>>1;r.push(new e(n.slice(0,t)),new e(n.slice(t)))}}else r.push(a)}replace(t,n,r){if(!(r instanceof e))return super.replace(t,n,r);[t,n]=w(this,t,n);let i=me(this.text,me(r.text,he(this.text,0,t)),n),a=this.length+r.length-(n-t);return i.length<=32?new e(i,a):fe.from(e.split(i,[]),a)}sliceString(e,t=this.length,n=` +import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{C as r,_ as i,c as a,d as o,f as s,p as c}from"./brand-DUaZkIz1.js";import{i as l,n as u,r as d}from"./page-DGkiHXHP.js";import{A as f,B as p,C as m,N as h,Q as g,T as _,W as v,jt as y,o as b}from"./index-Du7sNMda.js";var x=n(e(),1),S=[],ee=[];(()=>{let e=`lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,1n,9,16,o,,x,1i,3,,i,,7,a,2,t,3,1k,,,7,2,2,2,3,9,,a,2,q,,2,3,1k,,,5,4,2,2,3,3,,u,2,3,,b,3,1k,,,8,,3,,3,k,2,m,6,,3,1k,,,7,2,2,2,3,7,3,a,2,u,,1n,5,3,3,,4,9,,14,5,1j,,,7,,3,,4,7,2,b,2,t,3,1k,,,7,,3,,4,7,2,b,2,f,,c,4,1j,2,,7,,3,,4,9,,a,2,t,3,1y,,4,6,,,,8,i,2,1p,,,8,c,8,2q,,,a,b,7,21,2,r,,,,,,4,2,1d,k,,2,5,b,,10,9,,2u,b,,6,n,4,4,3,g,4,d,,,3,6,,f,,jj,3,qa,4,s,3,t,2,u,2,1s,w,9,,19,3,,,39,2,y,,3a,c,4,c,63,5,1l,a,,,,,2,o,2,,1c,1a,2,c,k,5,1b,h,12,9,c,3,u,d,1k,e,1c,k,48,3,,l,4,,6,,2,3,5i,1s,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,n,5,4,,2b,2,1e,i,q,i,d,,12,8,p,d,18,4,1b,e,10,,1v,e,c,,8,2,1a,,1f,,,3,2,2,5,2,,,15,5,5,2,6k,8,,2,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,1t,5,8t,2,25,6,1y,b,1d,4,3e,3,1h,f,15,,2,2,a,4,19,b,7,,1p,3,10,e,g,2,18,,c,3,1c,e,8,4,,2,2k,c,6,,2,,4d,c,l,4,1j,2,,7,2,2,2,3,9,,a,2,2,7,3,5,1v,9,,,2,,,4,,5,,,e,2,2a,i,n,,29,k,6j,7,2,9,r,2,2a,h,2y,d,2t,3,2,a,74,f,6t,6,,2,2,4,,,,2,3x,7,2,7,3,,s,a,14,7,,4,8,,9,b,1a,g,5i,8,5j,8,,8,2a,m,,e,3e,6,3,,,2,,7,,,1u,5,,2,,5,9n,4,9,2,,,1c,7,3,5,n,,44l,,6,f,8ug,i,1xc,5,1n,7,t4,,,1j,7,4,29,,b,2,f57,2,3mp,1a,2,n,f2,5,3,6,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,2s,,4g,7,af,,1p,4,e4,4,72,2,6r,,2,,7,2,5,,d6,7,31,7,240,5`.split(`,`).map(e=>e?parseInt(e,36):1);for(let t=0,n=0;t>1;if(e=ee[r])t=r+1;else return!0;if(t==n)return!1}}function ne(e){return e>=127462&&e<=127487}var re=8205;function ie(e,t,n=!0,r=!0){return(n?ae:oe)(e,t,r)}function ae(e,t,n){if(t==e.length)return t;t&&ce(e.charCodeAt(t))&&le(e.charCodeAt(t-1))&&t--;let r=se(e,t);for(t+=ue(r);t=0&&ne(se(e,r));)n++,r-=2;if(n%2==0)break;t+=2}else break}return t}function oe(e,t,n){for(;t>1;){let r=ae(e,t-2,n);if(r=56320&&e<57344}function le(e){return e>=55296&&e<56320}function ue(e){return e<65536?1:2}var C=class e{lineAt(e){if(e<0||e>this.length)throw RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=w(this,e,t);let r=[];return this.decompose(0,e,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(t,this.length,r,1),fe.from(r,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=w(this,e,t);let n=[];return this.decompose(e,t,n,0),fe.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),r=new ge(this),i=new ge(e);for(let e=t,a=t;;){if(r.next(e),i.next(e),e=0,r.lineBreak!=i.lineBreak||r.done!=i.done||r.value!=i.value)return!1;if(a+=r.value.length,r.done||a>=n)return!0}}iter(e=1){return new ge(this,e)}iterRange(e,t=this.length){return new _e(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{t??=this.lines+1;let r=this.line(e).from;n=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new ve(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(t){if(t.length==0)throw RangeError(`A document must have at least one line`);return t.length==1&&!t[0]?e.empty:t.length<=32?new de(t):fe.from(de.split(t,[]))}},de=class e extends C{constructor(e,t=pe(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,r){for(let i=0;;i++){let a=this.text[i],o=r+a.length;if((t?n:o)>=e)return new ye(r,o,n,a);r=o+1,n++}}decompose(t,n,r,i){let a=t<=0&&n>=this.length?this:new e(he(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(i&1){let t=r.pop(),n=me(a.text,t.text.slice(),0,a.length);if(n.length<=32)r.push(new e(n,t.length+a.length));else{let t=n.length>>1;r.push(new e(n.slice(0,t)),new e(n.slice(t)))}}else r.push(a)}replace(t,n,r){if(!(r instanceof e))return super.replace(t,n,r);[t,n]=w(this,t,n);let i=me(this.text,me(r.text,he(this.text,0,t)),n),a=this.length+r.length-(n-t);return i.length<=32?new e(i,a):fe.from(e.split(i,[]),a)}sliceString(e,t=this.length,n=` `){[e,t]=w(this,e,t);let r=``;for(let i=0,a=0;i<=t&&ae&&a&&(r+=n),ei&&(r+=o.slice(Math.max(0,e-i),t-i)),i=s+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(t,n){let r=[],i=-1;for(let a of t)r.push(a),i+=a.length+1,r.length==32&&(n.push(new e(r,i)),r=[],i=-1);return i>-1&&n.push(new e(r,i)),n}},fe=class e extends C{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let t of e)this.lines+=t.lines}lineInner(e,t,n,r){for(let i=0;;i++){let a=this.children[i],o=r+a.length,s=n+a.lines-1;if((t?s:o)>=e)return a.lineInner(e,t,n,r);r=o+1,n=s+1}}decompose(e,t,n,r){for(let i=0,a=0;a<=t&&i=a){let i=r&(a<=e|(s>=t?2:0));a>=e&&s<=t&&!i?n.push(o):o.decompose(e-a,t-a,n,i)}a=s+1}}replace(t,n,r){if([t,n]=w(this,t,n),r.lines=a&&n<=s){let c=o.replace(t-a,n-a,r),l=this.lines-o.lines+c.lines;if(c.lines>4&&c.lines>l>>6){let a=this.children.slice();return a[i]=c,new e(a,this.length-(n-t)+r.length)}return super.replace(a,s,c)}a=s+1}return super.replace(t,n,r)}sliceString(e,t=this.length,n=` `){[e,t]=w(this,e,t);let r=``;for(let i=0,a=0;ie&&i&&(r+=n),ea&&(r+=o.sliceString(e-a,t-a,n)),a=s+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(t,n){if(!(t instanceof e))return 0;let r=0,[i,a,o,s]=n>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;i+=n,a+=n){if(i==o||a==s)return r;let e=this.children[i],c=t.children[a];if(e!=c)return r+e.scanIdentical(c,n);r+=e.length+1}}static from(t,n=t.reduce((e,t)=>e+t.length+1,-1)){let r=0;for(let e of t)r+=e.lines;if(r<32){let e=[];for(let n of t)n.flatten(e);return new de(e,n)}let i=Math.max(32,r>>5),a=i<<1,o=i>>1,s=[],c=0,l=-1,u=[];function d(t){let n;if(t.lines>a&&t instanceof e)for(let e of t.children)d(e);else t.lines>o&&(c>o||!c)?(f(),s.push(t)):t instanceof de&&c&&(n=u[u.length-1])instanceof de&&t.lines+n.lines<=32?(c+=t.lines,l+=t.length+1,u[u.length-1]=new de(n.text.concat(t.text),n.length+1+t.length)):(c+t.lines>i&&f(),c+=t.lines,l+=t.length+1,u.push(t))}function f(){c!=0&&(s.push(u.length==1?u[0]:e.from(u,l)),l=-1,c=u.length=0)}for(let e of t)d(e);return f(),s.length==1?s[0]:new e(s,n)}};C.empty=new de([``],0);function pe(e){let t=-1;for(let n of e)t+=n.length+1;return t}function me(e,t,n=0,r=1e9){for(let i=0,a=0,o=!0;a=n&&(c>r&&(s=s.slice(0,r-i)),i0?1:(e instanceof de?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,r=this.nodes[n],i=this.offsets[n],a=i>>1,o=r instanceof de?r.text.length:r.children.length;if(a==(t>0?o:0)){if(n==0)return this.done=!0,this.value=``,this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((i&1)==(t>0?0:1)){if(this.offsets[n]+=t,e==0)return this.lineBreak=!0,this.value=` `,this;e--}else if(r instanceof de){let i=r.text[a+(t<0?-1:0)];if(this.offsets[n]+=t,i.length>Math.max(0,e))return this.value=e==0?i:t>0?i.slice(e):i.slice(0,i.length-e),this;e-=i.length}else{let i=r.children[a+(t<0?-1:0)];e>i.length?(e-=i.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(i),this.offsets.push(t>0?1:(i instanceof de?i.text.length:i.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}},_e=class{constructor(e,t,n){this.value=``,this.done=!1,this.cursor=new ge(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value=``,this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=n?r:t<0?r.slice(r.length-n):r.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=``}},ve=class{constructor(e){this.inner=e,this.afterBreak=!0,this.value=``,this.done=!1}next(e=0){let{done:t,lineBreak:n,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value=``,this.afterBreak=!1):t?(this.done=!0,this.value=``):n?this.afterBreak?this.value=``:(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol<`u`&&(C.prototype[Symbol.iterator]=function(){return this.iter()},ge.prototype[Symbol.iterator]=_e.prototype[Symbol.iterator]=ve.prototype[Symbol.iterator]=function(){return this});var ye=class{constructor(e,t,n,r){this.from=e,this.to=t,this.number=n,this.text=r}get length(){return this.to-this.from}};function w(e,t,n){return t=Math.max(0,Math.min(e.length,t)),[t,Math.max(t,Math.min(e.length,n))]}function T(e,t,n=!0,r=!0){return ie(e,t,n,r)}function be(e){return e>=56320&&e<57344}function xe(e){return e>=55296&&e<56320}function Se(e,t){let n=e.charCodeAt(t);if(!xe(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return be(r)?(n-55296<<10)+(r-56320)+65536:n}function Ce(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}function we(e){return e<65536?1:2}var Te=/\r\n?|\n/,E=(function(e){return e[e.Simple=0]=`Simple`,e[e.TrackDel=1]=`TrackDel`,e[e.TrackBefore=2]=`TrackBefore`,e[e.TrackAfter=3]=`TrackAfter`,e})(E||={}),Ee=class e{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;te)return i+(e-r);i+=o}else{if(n!=E.Simple&&c>=e&&(n==E.TrackDel&&re||n==E.TrackBefore&&re))return null;if(c>e||c==e&&t<0&&!o)return e==r||t<0?i:i+s;i+=s}r=c}if(e>r)throw RangeError(`Position ${e} is out of range for changeset of length ${r}`);return i}touchesRange(e,t=e){for(let n=0,r=0;n=0&&r<=t&&o>=e)return rt?`cover`:!0;r=o}return!1}toString(){let e=``;for(let t=0;t=0?`:`+r:``)}return e}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some(e=>typeof e!=`number`))throw RangeError(`Invalid JSON representation of ChangeDesc`);return new e(t)}static create(t){return new e(t)}},De=class e extends Ee{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw RangeError(`Applying change set to a document with the wrong length`);return ke(this,(t,n,r,i,a)=>e=e.replace(r,r+(n-t),a),!1),e}mapDesc(e,t=!1){return Ae(this,e,t,!0)}invert(t){let n=this.sections.slice(),r=[];for(let e=0,i=0;e=0){n[e]=o,n[e+1]=a;let s=e>>1;for(;r.length0&&Oe(r,n,a.text),a.forward(e),o+=e}let c=t[e++];for(;o>1].toJSON()))}return e}static of(t,n,r){let i=[],a=[],o=0,s=null;function c(t=!1){if(!t&&!i.length)return;os||e<0||s>n)throw RangeError(`Invalid change range ${e} to ${s} (in doc of length ${n})`);let u=l?typeof l==`string`?C.of(l.split(r||Te)):l:C.empty,d=u.length;if(e==s&&d==0)return;eo&&D(i,e-o,-1),D(i,s-e,d),Oe(a,i,u),o=s}}return l(t),c(!s),s}static empty(t){return new e(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw RangeError(`Invalid JSON representation of ChangeSet`);let n=[],r=[];for(let e=0;et&&typeof e!=`string`))throw RangeError(`Invalid JSON representation of ChangeSet`);else if(i.length==1)n.push(i[0],0);else{for(;r.length=0&&n<=0&&n==e[i+1]?e[i]+=t:i>=0&&t==0&&e[i]==0?e[i+1]+=n:r?(e[i]+=t,e[i+1]+=n):e.push(t,n)}function Oe(e,t,n){if(n.length==0)return;let r=t.length-2>>1;if(r>1])),!(n||o==e.sections.length||e.sections[o+1]<0);)s=e.sections[o++],c=e.sections[o++];t(i,l,a,u,d),i=l,a=u}}}function Ae(e,t,n,r=!1){let i=[],a=r?[]:null,o=new Me(e),s=new Me(t);for(let e=-1;;)if(o.done&&s.len||s.done&&o.len)throw Error(`Mismatched change set lengths`);else if(o.ins==-1&&s.ins==-1){let e=Math.min(o.len,s.len);D(i,e,-1),o.forward(e),s.forward(e)}else if(s.ins>=0&&(o.ins<0||e==o.i||o.off==0&&(s.len=0&&e=0){let t=0,n=o.len;for(;n;)if(s.ins==-1){let e=Math.min(n,s.len);t+=e,n-=e,s.forward(e)}else if(s.ins==0&&s.lent||o.ins>=0&&o.len>t)&&(e||r.length>n),a.forward2(t),o.forward(t)}}var Me=class{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return t>=e.length?C.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?C.empty:t[n].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}},Ne=class e{constructor(e,t,n,r){this.from=e,this.to=t,this.flags=n,this.goalColumn=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get undirectional(){return(this.flags&64)>0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}map(t,n=-1){let r,i;return this.empty?r=i=t.mapPos(this.from,n):(r=t.mapPos(this.from,1),i=t.mapPos(this.to,-1)),r==this.from&&i==this.to?this:new e(r,i,this.flags,this.goalColumn)}extend(e,t=e,n=0){if(e<=this.anchor&&t>=this.anchor)return O.range(e,t,void 0,void 0,n);let r=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return O.range(this.anchor,r,void 0,void 0,n)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!=`number`||typeof e.head!=`number`)throw RangeError(`Invalid JSON representation for SelectionRange`);return O.range(e.anchor,e.head)}static create(t,n,r,i){return new e(t,n,r,i)}},O=class e{constructor(e,t){this.ranges=e,this.mainIndex=t}map(t,n=-1){return t.empty?this:e.create(this.ranges.map(e=>e.map(t,n)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;ne.toJSON()),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||typeof t.main!=`number`||t.main>=t.ranges.length)throw RangeError(`Invalid JSON representation for EditorSelection`);return new e(t.ranges.map(e=>Ne.fromJSON(e)),t.main)}static single(t,n=t){return new e([e.range(t,n)],0)}static create(t,n=0){if(t.length==0)throw RangeError(`A selection needs at least one range`);for(let r=0,i=0;ie.from-t.from),n=t.indexOf(r);for(let r=1;ri.head?e.range(s,o):e.range(o,s))}}return new e(t,n)}};function Pe(e,t){for(let n of e.ranges)if(n.to>t)throw RangeError(`Selection points outside of document`)}var Fe=0,k=class e{constructor(e,t,n,r,i){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=r,this.id=Fe++,this.default=e([]),this.extensions=typeof i==`function`?i(this):i}get reader(){return this}static define(t={}){return new e(t.combine||(e=>e),t.compareInput||((e,t)=>e===t),t.compare||(t.combine?(e,t)=>e===t:Ie),!!t.static,t.enables)}of(e){return new Le([],this,0,e)}compute(e,t){if(this.isStatic)throw Error(`Can't compute a static facet`);return new Le(e,this,1,t)}computeN(e,t){if(this.isStatic)throw Error(`Can't compute a static facet`);return new Le(e,this,2,t)}from(e,t){return t||=e=>e,this.compute([e],n=>t(n.field(e)))}};function Ie(e,t){return e==t||e.length==t.length&&e.every((e,n)=>e===t[n])}var Le=class{constructor(e,t,n,r){this.dependencies=e,this.facet=t,this.type=n,this.value=r,this.id=Fe++}dynamicSlot(e){let t=this.value,n=this.facet.compareInput,r=this.id,i=e[r]>>1,a=this.type==2,o=!1,s=!1,c=[];for(let t of this.dependencies)t==`doc`?o=!0:t==`selection`?s=!0:(e[t.id]??1)&1||c.push(e[t.id]);return{create(e){return e.values[i]=t(e),1},update(e,r){if(o&&r.docChanged||s&&(r.docChanged||r.selection)||ze(e,c)){let r=t(e);if(a?!Re(r,e.values[i],n):!n(r,e.values[i]))return e.values[i]=r,1}return 0},reconfigure:(e,o)=>{let s,c=o.config.address[r];if(c!=null){let r=Qe(o,c);if(this.dependencies.every(t=>t instanceof k?o.facet(t)===e.facet(t):t instanceof He?o.field(t,!1)==e.field(t,!1):!0)||(a?Re(s=t(e),r,n):n(s=t(e),r)))return e.values[i]=r,0}else s=t(e);return e.values[i]=s,1}}}get extension(){return this}};function Re(e,t,n){if(e.length!=t.length)return!1;for(let r=0;re[t.id]),i=n.map(e=>e.type),a=r.filter(e=>!(e&1)),o=e[t.id]>>1;function s(e){let n=[];for(let t=0;te===t),t);return t.provide&&(n.provides=t.provide(n)),n}create(e){return(e.facet(Ve).find(e=>e.field==this)?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:e=>(e.values[t]=this.create(e),1),update:(e,n)=>{let r=e.values[t],i=this.updateF(r,n);return this.compareF(r,i)?0:(e.values[t]=i,1)},reconfigure:(e,n)=>{let r=e.facet(Ve),i=n.facet(Ve),a;return(a=r.find(e=>e.field==this))&&a!=i.find(e=>e.field==this)?(e.values[t]=a.create(e),1):n.config.address[this.id]==null?(e.values[t]=this.create(e),1):(e.values[t]=n.field(this),0)}}}init(e){return[this,Ve.of({field:this,create:e})]}get extension(){return this}},Ue={lowest:4,low:3,default:2,high:1,highest:0};function We(e){return t=>new Ke(t,e)}var Ge={highest:We(Ue.highest),high:We(Ue.high),default:We(Ue.default),low:We(Ue.low),lowest:We(Ue.lowest)},Ke=class{constructor(e,t){this.inner=e,this.prec=t}get extension(){return this}},qe=class e{of(e){return new Je(this,e)}reconfigure(t){return e.reconfigure.of({compartment:this,extension:t})}get(e){return e.config.compartments.get(this)}},Je=class{constructor(e,t){this.compartment=e,this.inner=t}get extension(){return this}},Ye=class e{constructor(e,t,n,r,i,a){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=r,this.staticValues=i,this.facets=a,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(t,n,r){let i=[],a=Object.create(null),o=new Map;for(let e of Xe(t,n,o))e instanceof He?i.push(e):(a[e.facet.id]||(a[e.facet.id]=[])).push(e);let s=Object.create(null),c=[],l=[];for(let e of i)s[e.id]=l.length<<1,l.push(t=>e.slot(t));let u=r?.config.facets;for(let e in a){let t=a[e],n=t[0].facet,i=u&&u[e]||[];if(t.every(e=>e.type==0)){if(s[n.id]=c.length<<1|1,Ie(i,t))c.push(r.facet(n));else{let e=n.combine(t.map(e=>e.value));c.push(r&&n.compare(e,r.facet(n))?r.facet(n):e)}}else{for(let e of t)e.type==0?(s[e.id]=c.length<<1|1,c.push(e.value)):(s[e.id]=l.length<<1,l.push(t=>e.dynamicSlot(t)));s[n.id]=l.length<<1,l.push(e=>Be(e,n,t))}}let d=l.map(e=>e(s));return new e(t,o,d,s,c,a)}};function Xe(e,t,n){let r=[[],[],[],[],[]],i=new Map;function a(e,o){let s=i.get(e);if(s!=null){if(s<=o)return;let t=r[s].indexOf(e);t>-1&&r[s].splice(t,1),e instanceof Je&&n.delete(e.compartment)}if(i.set(e,o),Array.isArray(e))for(let t of e)a(t,o);else if(e instanceof Je){if(n.has(e.compartment))throw RangeError(`Duplicate use of compartment in extensions`);let r=t.get(e.compartment)||e.inner;n.set(e.compartment,r),a(r,o)}else if(e instanceof Ke)a(e.inner,e.prec);else if(e instanceof He)r[o].push(e),e.provides&&a(e.provides,o);else if(e instanceof Le)r[o].push(e),e.facet.extensions&&a(e.facet.extensions,Ue.default);else{let t=e.extension;if(!t)throw Error(`Unrecognized extension value in extension set (${e}).`);if(t==e)throw Error(`Unrecognized extension value in extension set (${e}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);a(t,o)}}return a(e,Ue.default),r.reduce((e,t)=>e.concat(t))}function Ze(e,t){if(t&1)return 2;let n=t>>1,r=e.status[n];if(r==4)throw Error(`Cyclic dependency between fields and/or facets`);if(r&2)return r;e.status[n]=4;let i=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|i}function Qe(e,t){return t&1?e.config.staticValues[t>>1]:e.values[t>>1]}var $e=k.define(),et=k.define({combine:e=>e.some(e=>e),static:!0}),tt=k.define({combine:e=>e.length?e[0]:void 0,static:!0}),nt=k.define(),rt=k.define(),it=k.define(),at=k.define({combine:e=>e.length?e[0]:!1}),ot=class{constructor(e,t){this.type=e,this.value=t}static define(){return new st}},st=class{of(e){return new ot(this,e)}},ct=class{constructor(e){this.map=e}of(e){return new A(this,e)}},A=class e{constructor(e,t){this.type=e,this.value=t}map(t){let n=this.type.map(this.value,t);return n===void 0?void 0:n==this.value?this:new e(this.type,n)}is(e){return this.type==e}static define(e={}){return new ct(e.map||(e=>e))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let r of e){let e=r.map(t);e&&n.push(e)}return n}};A.reconfigure=A.define(),A.appendConfig=A.define();var lt=class e{constructor(t,n,r,i,a,o){this.startState=t,this.changes=n,this.selection=r,this.effects=i,this.annotations=a,this.scrollIntoView=o,this._doc=null,this._state=null,r&&Pe(r,n.newLength),a.some(t=>t.type==e.time)||(this.annotations=a.concat(e.time.of(Date.now())))}static create(t,n,r,i,a,o){return new e(t,n,r,i,a,o)}get newDoc(){return this._doc||=this.changes.apply(this.startState.doc)}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(t){let n=this.annotation(e.userEvent);return!!(n&&(n==t||n.length>t.length&&n.slice(0,t.length)==t&&n[t.length]==`.`))}};lt.time=ot.define(),lt.userEvent=ot.define(),lt.addToHistory=ot.define(),lt.remote=ot.define();function ut(e,t){let n=[];for(let r=0,i=0;;){let a,o;if(r=e[r]))a=e[r++],o=e[r++];else if(i=0;n--){let i=r[n](e);e=i instanceof lt?i:Array.isArray(i)&&i.length==1&&i[0]instanceof lt?i[0]:pt(t,_t(i),!1)}return e}function ht(e){let t=e.startState,n=t.facet(it),r=e;for(let i=n.length-1;i>=0;i--){let a=n[i](e);a&&Object.keys(a).length&&(r=dt(r,ft(t,a,e.changes.newLength),!0))}return r==e?e:lt.create(t,e.changes,e.selection,r.effects,r.annotations,r.scrollIntoView)}var gt=[];function _t(e){return e==null?gt:Array.isArray(e)?e:[e]}var vt=(function(e){return e[e.Word=0]=`Word`,e[e.Space=1]=`Space`,e[e.Other=2]=`Other`,e})(vt||={}),yt=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,bt;try{bt=RegExp(`[\\p{Alphabetic}\\p{Number}_]`,`u`)}catch{}function xt(e){if(bt)return bt.test(e);for(let t=0;t`€`&&(n.toUpperCase()!=n.toLowerCase()||yt.test(n)))return!0}return!1}function St(e){return t=>{if(!/\S/.test(t))return vt.Space;if(xt(t))return vt.Word;for(let n=0;n-1)return vt.Word;return vt.Other}}var j=class e{constructor(e,t,n,r,i,a){this.config=e,this.doc=t,this.selection=n,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=i,a&&(a._state=this);for(let e=0;ei.set(t,e)),null),i.set(e.value.compartment,e.value.extension)):e.is(A.reconfigure)?(n=null,r=e.value):e.is(A.appendConfig)&&(n=null,r=_t(r).concat(e.value));let a;n?a=t.startState.values.slice():(n=Ye.resolve(r,i,this),a=new e(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(e,t)=>t.reconfigure(e,this),null).values);let o=t.startState.facet(et)?t.newSelection:t.newSelection.asSingle();new e(n,t.newDoc,o,a,(e,n)=>n.update(e,t),t)}replaceSelection(e){return typeof e==`string`&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:O.cursor(t.from+e.length,-1)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),r=this.changes(n.changes),i=[n.range],a=_t(n.effects);for(let n=1;nn.spec.fromJSON(a,e)))}}return e.create({doc:t.doc,selection:O.fromJSON(t.selection),extensions:n.extensions?i.concat([n.extensions]):i})}static create(t={}){let n=Ye.resolve(t.extensions||[],new Map),r=t.doc instanceof C?t.doc:C.of((t.doc||``).split(n.staticFacet(e.lineSeparator)||Te)),i=t.selection?t.selection instanceof O?t.selection:O.single(t.selection.anchor,t.selection.head):O.single(0);return Pe(i,r.length),n.staticFacet(et)||(i=i.asSingle()),new e(n,r,i,n.dynamicSlots.map(()=>null),(e,t)=>t.create(e),null)}get tabSize(){return this.facet(e.tabSize)}get lineBreak(){return this.facet(e.lineSeparator)||` diff --git a/internal/ui/dist/assets/settings-KSF6knOe.js b/internal/ui/dist/assets/settings-674SZUVT.js similarity index 98% rename from internal/ui/dist/assets/settings-KSF6knOe.js rename to internal/ui/dist/assets/settings-674SZUVT.js index 142baf139..ccefb07dc 100644 --- a/internal/ui/dist/assets/settings-KSF6knOe.js +++ b/internal/ui/dist/assets/settings-674SZUVT.js @@ -1,4 +1,4 @@ -import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{C as r,M as i,_ as a,a as o,c as s,d as c,f as l,i as u,o as d,p as f,r as p,x as m,y as h}from"./brand-DUaZkIz1.js";import{t as g}from"./Tooltip-B3r3s_B9.js";import{n as _,r as v,t as y}from"./WarningCircle.es-1A8yYViJ.js";import{At as b,Ft as x,L as S,Q as C,R as w,S as T,W as E,jt as D,z as O}from"./index-_VmsjY84.js";var k=n(e(),1);function A(e={}){let t=e.timeout??2e3,[n,r]=(0,k.useState)(null),[i,a]=(0,k.useState)(!1),o=(0,k.useRef)(null);(0,k.useEffect)(()=>()=>{window.clearTimeout(o.current)},[]);let s=e=>{window.clearTimeout(o.current),o.current=window.setTimeout(()=>a(!1),t),a(e)};return{copy:e=>{`clipboard`in navigator?navigator.clipboard.writeText(e).then(()=>{r(null),s(!0)}).catch(e=>r(e)):r(Error(`useClipboard: navigator.clipboard is not supported`))},reset:()=>{a(!1),r(null),window.clearTimeout(o.current)},error:n,copied:i}}var j=t(),M={timeout:1e3};function N(e){let{children:t,timeout:n,value:r,...a}=i(`CopyButton`,M,e),o=A({timeout:n});return(0,j.jsx)(j.Fragment,{children:t({copy:()=>o.copy(r),copied:o.copied,...a})})}N.displayName=`@mantine/core/CopyButton`;var P=new Map([[`bold`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M228,48V96a12,12,0,0,1-12,12H168a12,12,0,0,1,0-24h19l-7.8-7.8a75.55,75.55,0,0,0-53.32-22.26h-.43A75.49,75.49,0,0,0,72.39,75.57,12,12,0,1,1,55.61,58.41a99.38,99.38,0,0,1,69.87-28.47H126A99.42,99.42,0,0,1,196.2,59.23L204,67V48a12,12,0,0,1,24,0ZM183.61,180.43a75.49,75.49,0,0,1-53.09,21.63h-.43A75.55,75.55,0,0,1,76.77,179.8L69,172H88a12,12,0,0,0,0-24H40a12,12,0,0,0-12,12v48a12,12,0,0,0,24,0V189l7.8,7.8A99.42,99.42,0,0,0,130,226.06h.56a99.38,99.38,0,0,0,69.87-28.47,12,12,0,0,0-16.78-17.16Z`}))],[`duotone`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z`,opacity:`0.2`}),k.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1,0-16h28.69L182.06,73.37a79.56,79.56,0,0,0-56.13-23.43h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27a96,96,0,0,1,135,.79L208,76.69V48a8,8,0,0,1,16,0ZM186.41,183.29a80,80,0,0,1-112.47-.66L59.31,168H88a8,8,0,0,0,0-16H40a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V179.31l14.63,14.63A95.43,95.43,0,0,0,130,222.06h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`fill`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1-5.66-13.66L180.65,72a79.48,79.48,0,0,0-54.72-22.09h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27,96,96,0,0,1,192,60.7l18.36-18.36A8,8,0,0,1,224,48ZM186.41,183.29A80,80,0,0,1,75.35,184l18.31-18.31A8,8,0,0,0,88,152H40a8,8,0,0,0-8,8v48a8,8,0,0,0,13.66,5.66L64,195.3a95.42,95.42,0,0,0,66,26.76h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`light`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M222,48V96a6,6,0,0,1-6,6H168a6,6,0,0,1,0-12h33.52L183.47,72a81.51,81.51,0,0,0-57.53-24h-.46A81.5,81.5,0,0,0,68.19,71.28a6,6,0,1,1-8.38-8.58,93.38,93.38,0,0,1,65.67-26.76H126a93.45,93.45,0,0,1,66,27.53l18,18V48a6,6,0,0,1,12,0ZM187.81,184.72a81.5,81.5,0,0,1-57.29,23.34h-.46a81.51,81.51,0,0,1-57.53-24L54.48,166H88a6,6,0,0,0,0-12H40a6,6,0,0,0-6,6v48a6,6,0,0,0,12,0V174.48l18,18.05a93.45,93.45,0,0,0,66,27.53h.52a93.38,93.38,0,0,0,65.67-26.76,6,6,0,1,0-8.38-8.58Z`}))],[`regular`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1,0-16h28.69L182.06,73.37a79.56,79.56,0,0,0-56.13-23.43h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27a96,96,0,0,1,135,.79L208,76.69V48a8,8,0,0,1,16,0ZM186.41,183.29a80,80,0,0,1-112.47-.66L59.31,168H88a8,8,0,0,0,0-16H40a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V179.31l14.63,14.63A95.43,95.43,0,0,0,130,222.06h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`thin`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M220,48V96a4,4,0,0,1-4,4H168a4,4,0,0,1,0-8h38.34L184.89,70.54A84,84,0,0,0,66.8,69.85a4,4,0,1,1-5.6-5.72,92,92,0,0,1,129.34.76L212,86.34V48a4,4,0,0,1,8,0ZM189.2,186.15a83.44,83.44,0,0,1-58.68,23.91h-.47a83.52,83.52,0,0,1-58.94-24.6L49.66,164H88a4,4,0,0,0,0-8H40a4,4,0,0,0-4,4v48a4,4,0,0,0,8,0V169.66l21.46,21.45A91.43,91.43,0,0,0,130,218.06h.51a91.45,91.45,0,0,0,64.28-26.19,4,4,0,1,0-5.6-5.72Z`}))]]),F=k.forwardRef((e,t)=>k.createElement(o,{ref:t,...e,weights:P}));F.displayName=`ArrowsClockwiseIcon`;var I=F,L=[`settings`,`ingest`];function R(e,t){let n=e.trim();return t||/^https:\/\//i.test(n)||/:443$/.test(n)}function z(e,t,n){if(/^https?:\/\//i.test(e.trim()))try{let t=new URL(e);e=`${t.protocol}//${t.hostname}:${t.port||(t.protocol===`https:`?`443`:`80`)}`}catch{}let r=R(e,n)?``:` +import{i as e,r as t,s as n}from"./useRouter-ByJ6_rwb.js";import{C as r,M as i,_ as a,a as o,c as s,d as c,f as l,i as u,o as d,p as f,r as p,x as m,y as h}from"./brand-DUaZkIz1.js";import{t as g}from"./Tooltip-B3r3s_B9.js";import{n as _,r as v,t as y}from"./WarningCircle.es-wTz6NA9-.js";import{At as b,Ft as x,L as S,Q as C,R as w,S as T,W as E,jt as D,z as O}from"./index-Du7sNMda.js";var k=n(e(),1);function A(e={}){let t=e.timeout??2e3,[n,r]=(0,k.useState)(null),[i,a]=(0,k.useState)(!1),o=(0,k.useRef)(null);(0,k.useEffect)(()=>()=>{window.clearTimeout(o.current)},[]);let s=e=>{window.clearTimeout(o.current),o.current=window.setTimeout(()=>a(!1),t),a(e)};return{copy:e=>{`clipboard`in navigator?navigator.clipboard.writeText(e).then(()=>{r(null),s(!0)}).catch(e=>r(e)):r(Error(`useClipboard: navigator.clipboard is not supported`))},reset:()=>{a(!1),r(null),window.clearTimeout(o.current)},error:n,copied:i}}var j=t(),M={timeout:1e3};function N(e){let{children:t,timeout:n,value:r,...a}=i(`CopyButton`,M,e),o=A({timeout:n});return(0,j.jsx)(j.Fragment,{children:t({copy:()=>o.copy(r),copied:o.copied,...a})})}N.displayName=`@mantine/core/CopyButton`;var P=new Map([[`bold`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M228,48V96a12,12,0,0,1-12,12H168a12,12,0,0,1,0-24h19l-7.8-7.8a75.55,75.55,0,0,0-53.32-22.26h-.43A75.49,75.49,0,0,0,72.39,75.57,12,12,0,1,1,55.61,58.41a99.38,99.38,0,0,1,69.87-28.47H126A99.42,99.42,0,0,1,196.2,59.23L204,67V48a12,12,0,0,1,24,0ZM183.61,180.43a75.49,75.49,0,0,1-53.09,21.63h-.43A75.55,75.55,0,0,1,76.77,179.8L69,172H88a12,12,0,0,0,0-24H40a12,12,0,0,0-12,12v48a12,12,0,0,0,24,0V189l7.8,7.8A99.42,99.42,0,0,0,130,226.06h.56a99.38,99.38,0,0,0,69.87-28.47,12,12,0,0,0-16.78-17.16Z`}))],[`duotone`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z`,opacity:`0.2`}),k.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1,0-16h28.69L182.06,73.37a79.56,79.56,0,0,0-56.13-23.43h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27a96,96,0,0,1,135,.79L208,76.69V48a8,8,0,0,1,16,0ZM186.41,183.29a80,80,0,0,1-112.47-.66L59.31,168H88a8,8,0,0,0,0-16H40a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V179.31l14.63,14.63A95.43,95.43,0,0,0,130,222.06h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`fill`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1-5.66-13.66L180.65,72a79.48,79.48,0,0,0-54.72-22.09h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27,96,96,0,0,1,192,60.7l18.36-18.36A8,8,0,0,1,224,48ZM186.41,183.29A80,80,0,0,1,75.35,184l18.31-18.31A8,8,0,0,0,88,152H40a8,8,0,0,0-8,8v48a8,8,0,0,0,13.66,5.66L64,195.3a95.42,95.42,0,0,0,66,26.76h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`light`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M222,48V96a6,6,0,0,1-6,6H168a6,6,0,0,1,0-12h33.52L183.47,72a81.51,81.51,0,0,0-57.53-24h-.46A81.5,81.5,0,0,0,68.19,71.28a6,6,0,1,1-8.38-8.58,93.38,93.38,0,0,1,65.67-26.76H126a93.45,93.45,0,0,1,66,27.53l18,18V48a6,6,0,0,1,12,0ZM187.81,184.72a81.5,81.5,0,0,1-57.29,23.34h-.46a81.51,81.51,0,0,1-57.53-24L54.48,166H88a6,6,0,0,0,0-12H40a6,6,0,0,0-6,6v48a6,6,0,0,0,12,0V174.48l18,18.05a93.45,93.45,0,0,0,66,27.53h.52a93.38,93.38,0,0,0,65.67-26.76,6,6,0,1,0-8.38-8.58Z`}))],[`regular`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M224,48V96a8,8,0,0,1-8,8H168a8,8,0,0,1,0-16h28.69L182.06,73.37a79.56,79.56,0,0,0-56.13-23.43h-.45A79.52,79.52,0,0,0,69.59,72.71,8,8,0,0,1,58.41,61.27a96,96,0,0,1,135,.79L208,76.69V48a8,8,0,0,1,16,0ZM186.41,183.29a80,80,0,0,1-112.47-.66L59.31,168H88a8,8,0,0,0,0-16H40a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V179.31l14.63,14.63A95.43,95.43,0,0,0,130,222.06h.53a95.36,95.36,0,0,0,67.07-27.33,8,8,0,0,0-11.18-11.44Z`}))],[`thin`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M220,48V96a4,4,0,0,1-4,4H168a4,4,0,0,1,0-8h38.34L184.89,70.54A84,84,0,0,0,66.8,69.85a4,4,0,1,1-5.6-5.72,92,92,0,0,1,129.34.76L212,86.34V48a4,4,0,0,1,8,0ZM189.2,186.15a83.44,83.44,0,0,1-58.68,23.91h-.47a83.52,83.52,0,0,1-58.94-24.6L49.66,164H88a4,4,0,0,0,0-8H40a4,4,0,0,0-4,4v48a4,4,0,0,0,8,0V169.66l21.46,21.45A91.43,91.43,0,0,0,130,218.06h.51a91.45,91.45,0,0,0,64.28-26.19,4,4,0,1,0-5.6-5.72Z`}))]]),F=k.forwardRef((e,t)=>k.createElement(o,{ref:t,...e,weights:P}));F.displayName=`ArrowsClockwiseIcon`;var I=F,L=[`settings`,`ingest`];function R(e,t){let n=e.trim();return t||/^https:\/\//i.test(n)||/:443$/.test(n)}function z(e,t,n){if(/^https?:\/\//i.test(e.trim()))try{let t=new URL(e);e=`${t.protocol}//${t.hostname}:${t.port||(t.protocol===`https:`?`443`:`80`)}`}catch{}let r=R(e,n)?``:` tls: insecure: true`;return`exporters: otlp/fanout: diff --git a/internal/ui/dist/index.html b/internal/ui/dist/index.html index 0564fb1a7..edaffa8dd 100644 --- a/internal/ui/dist/index.html +++ b/internal/ui/dist/index.html @@ -21,7 +21,7 @@ document.documentElement.setAttribute("data-mantine-color-scheme", computed); } catch (e) {} - + diff --git a/site/src/content/docs/reference/mcp-tools.mdx b/site/src/content/docs/reference/mcp-tools.mdx index d6b5633a2..e639f2a0c 100644 --- a/site/src/content/docs/reference/mcp-tools.mdx +++ b/site/src/content/docs/reference/mcp-tools.mdx @@ -61,7 +61,7 @@ AG-UI `mcp-app` activity content uses exactly `resource_uri`, `tool_name`, ## create_dashboard -**Create dashboard** — Create a dashboard for the authenticated user from a complete spec. Read get_telemetry_schema first and preview_panels until every panel is ok or deliberately empty. The result lists any panel that is still empty or failing. Successful saves return a receipt for that committed version: base_version, version, changes, layout_changed, dashboard_fields and save_check. Changes describe authored panel fields and position_changed; physical packing is only layout_changed. Order chips mark the minimal moved set. save_check reports checked, reason when unchecked, total elapsed_ms and one status/rows result per saved panel with elapsed_ms when executed. checked means every panel was executed, not that error or empty panels are healthy. Text rows identify nonempty content, not telemetry. Use the structured receipt rather than prose warnings as check evidence. Create receipts list added panels without layout or dashboard edit chips. No-op saves still create a new version with no change chips. Per-panel elapsed_ms is omitted when the panel did not run. A dashboard is \{name, description, time:\{range}, variables, panels}. Each panel: \{id (lowercase), title, viz, width 1-12, query or sql}. viz: stat or gauge (one measure; gauge needs min and max), timeseries (bucket auto, at most one by), bar (one or two by), table (up to three by), text (content in Markdown), heatmap (bucket auto, no by), histogram (at most one by), scatter (exactly two measures in x then y order, one item dimension and an optional colour dimension), state_timeline (one measure, one item dimension, bucket auto and thresholds required). Rollup panel types are service_map (dependency graph) and health (overview metrics, error trend and health distribution). They require query.from=spans, no measures, by, bucket or sort, and only namespace/service equality filters with a literal or single-value variable; explicit casts and values with surrounding whitespace are rejected. Reads default to 400 services/edges and are capped at 400 even when query.limit is larger. Service scope applies before the limit; map nodes carry p95_ms and edges carry average_ms; error_rate is percent. Row panel types are logs, log_patterns and traces. Logs and traces take no measures, by or bucket. Patterns use count() by body_template. Patterns group only by body_template. Severity is the most frequent severity, ties choose the higher severity. Service is the most frequent service, ties choose ascending service name. Both describe the scoped, redacted events, not extra grouping dimensions. Each pattern returns dominant severity, top service, count and a dense trend, computed in the same bounded query after redaction and scoped filters. Redaction applies before filtering, grouping, display and drill-down. Row panels cannot use SQL. "erroring" means slowest erroring traces: filter to erroring traces, then rank by root duration. Trace candidate ranking is approximate when filters exclude the root span, as with exemplars. Categorical charts use fixed-order colour slots. Categorical options.top defaults to 6, maximum 6. Structured panels: the server computes Other; series are chosen worst-first by confidence (Wilson lower bound for error rates; at least 20 samples for latency); the rest fold into Other (N). Count, rate, sum and share rank largest first. Error rates require at least 20 requests for eligible Wilson ranking (z=1.96). Percentiles, quantile, avg, max and min require at least 20 non-null numeric samples for eligible value ranking and use better (explicit or inferred). Ineligible series follow eligible ones by sample count descending. Ties use sample count descending, then name ascending. SQL panels: series past six are left out, with a note. state_timeline defaults to 8 rows, maximum 20; other noncategorical panels use the same limits. Scatter supports options.x_scale and options.y_scale (log or linear), with distinct x_unit for x and unit for y, each inferred independently when omitted. Rows returned use the count unit. State timelines preserve null and absent buckets as unknown and keep the top items without merging them into Other. Scatter requires a structured query. SQL state_timeline requires timestamp time, a string item, one numeric measure and optional string state; its interval is one minute and thresholds are required. Items rank by volume (row count) for top N. Previous-period comparison is not drawn for scatter or state_timeline. Distribution panels use a structured query with one count() measure and histogram: \{field: duration_ms, buckets: log2} for spans or \{field: value, buckets: explicit} for metrics. Negative span durations clamp to [0,1); +Inf goes to overflow; NaN is excluded because it is not a measurement. Metric histograms use stored temporality and shared per-series increases; resets contribute current counts. Delta histograms sum observation weights. query: \{from: spans|logs|metrics, where: [filter expressions], measures: [fn(field) as alias], by: [fields], bucket, sort, limit}. Measures: count(), rate() per second, error_rate() percent, share() percent, avg/min/max/sum(field), last(value) for metrics, p50/p75/p90/p95/p99(field), quantile(field, 0.999), count_distinct(field). Fields are columns from get_telemetry_schema or attributes['key'] / resource['key'] with the key written literally. Filters are SQL boolean expressions: service = $service, kind = 'SPAN_KIND_SERVER', status = 'STATUS_CODE_ERROR', http_route IN $routes, attributes['http.response.status_code']::INTEGER >= 500. Variables: \{name, kind: query|custom|constant|text, from, field, default, include_all}; $__all selects All and removes filters that use the variable. sql: one SELECT over spans, logs, metrics, service_rollup, edge_rollup or resource_inventory that filters time with $__window(column). Use values exactly as get_telemetry_schema lists them. Example panel: \{"id":"latency","title":"Checkout latency","viz":"timeseries","width":8,"query":\{"from":"spans","where":["service = 'checkout'","kind = 'SPAN_KIND_SERVER'"],"measures":["p50(duration_ms)","p95(duration_ms)","p99(duration_ms)"],"bucket":"auto"},"unit":"ms","thresholds":[\{"value":1500,"status":"bad"}]}. Metrics: gauge/updown | counter | histogram. count(): points; count_distinct(): distinct. rate(): undefined | series increase/elapsed summed | count rate summed. sum(value): series means summed | increases | sum increases. avg(value): mean series means | undefined | sum/count increases. Gauge/updown sum/avg carry earlier points within 5m. Deltas spread across covered buckets; rate alone carries within 5m. rate() is per-second increase over covered elapsed time; auto >=1m. min/max: points | points | undefined. last(value): latest strictly before bucket/window end, reported within 5m, summed | same | undefined. pNN/quantile: points | undefined | interpolated bucket increases. summary: no value aggregates. Undefined: NULL. Fix name in its own where entry: one literal or single-value variable without All or multi-value; or name in by. Read type/temporality from get_telemetry_schema. Panel SQL also supports resource_inventory: signal, namespace, service, full typed resource, first_seen and last_seen. One row per distinct full resource per signal/namespace/service observed inside the logical panel window; first_seen/last_seen are actual in-window event times. Select signal='spans', 'logs' or 'metrics' and use resource['key'] with literal dotted keys. count(*) counts resource identities per signal, not events or instances. Declare $__window(first_seen). This relation is SQL-only: query.from and variables remain spans|logs|metrics; unscoped SQL cannot read it. state_timeline needs at least one threshold marked warn or bad, rather than only ok. Annotations attach only to timeseries, heatmap and state_timeline panels, scoped by service and namespace filters. drill: logs needs query.from=logs. Drill is not available on metrics. Every table format's field must exist in the returned frame; formatting cannot reference an absent column. A structured-table sparkline field must be a measure alias from that table's query. service_link needs variable to name the query or custom variable selected by the link. highlight applies to logs and log_patterns, at most 200 characters. split: deploy needs a service equality filter, as a literal or a single-value variable; other filters are allowed. When the service is All, a split: deploy panel shows the plain bar with a note explaining the missing service scope. Use service_map for dependency context, health for service health; neither proves causality. Example 1: Reference shapes; use only the types the question needs. \{"name":"Investigation shapes","annotations":\{"deploys":true,"anomalies":true},"variables":[\{"name":"service","kind":"query","from":"spans","field":"service"}],"panels":[\{"id":"latency_heat","title":"Latency over time","viz":"heatmap","query":\{"from":"spans","where":["service = $service"],"measures":["count()"],"bucket":"auto","histogram":\{"field":"duration_ms","buckets":"log2"}},"drill":"traces"},\{"id":"latency_hist","title":"Latency by operation","viz":"histogram","query":\{"from":"spans","where":["service = $service"],"measures":["count()"],"by":["operation"],"histogram":\{"field":"duration_ms","buckets":"log2"}},"drill":"traces"},\{"id":"items","title":"Calls versus tail latency","viz":"scatter","query":\{"from":"spans","where":["service = $service"],"measures":["count() as rows","p95(duration_ms) as tail_latency"],"by":["operation"]},"drill":"traces"},\{"id":"states","title":"Error states","viz":"state_timeline","query":\{"from":"spans","where":["service = $service"],"measures":["error_rate()"],"by":["operation"],"bucket":"auto"},"thresholds":[\{"value":5,"status":"bad"}],"drill":"traces"},\{"id":"log_rows","title":"Recent logs","viz":"logs","query":\{"from":"logs","where":["service = $service"],"sort":"time","limit":100},"drill":"logs"},\{"id":"patterns","title":"Repeated log patterns","viz":"log_patterns","query":\{"from":"logs","where":["service = $service"],"measures":["count()"],"by":["body_template"],"bucket":"auto","limit":50},"drill":"logs"},\{"id":"trace_rows","title":"Slow traces","viz":"traces","query":\{"from":"spans","where":["service = $service"],"sort":"duration_ms","limit":20},"drill":"traces"},\{"id":"map","title":"Service calls","viz":"service_map","query":\{"from":"spans"}},\{"id":"health","title":"Service health","viz":"health","query":\{"from":"spans"}}]} Example 2: Reference shapes; use only the types the question needs. \{"name":"Interaction shapes","variables":[\{"name":"service","kind":"query","from":"spans","field":"service"}],"panels":[\{"id":"hist","title":"Metric distribution","viz":"histogram","query":\{"from":"metrics","where":["service = $service"],"measures":["count()"],"histogram":\{"field":"value","buckets":"explicit"}}},\{"id":"table","title":"Service calls and trends","viz":"table","query":\{"from":"spans","measures":["count() as calls"],"by":["service"]},"options":\{"columns":[\{"field":"service","format":"service_link","variable":"service"},\{"field":"calls","format":"sparkline"}]}},\{"id":"prior","title":"Service calls one day earlier","viz":"bar","query":\{"from":"spans","measures":["count()"],"by":["service"]},"click":\{"set_variable":"service"},"time":\{"shift":"1d"}}]} Metric examples; use when the discovered type fits. \{"name":"Metric measures","panels":[\{"id":"network","title":"Network bytes per second","viz":"timeseries","query":\{"from":"metrics","where":["name = 'system.network.io'"],"measures":["rate()"],"by":["attributes['direction']"],"bucket":"auto"}},\{"id":"duration","title":"Request duration p95","viz":"timeseries","query":\{"from":"metrics","where":["name = 'http.server.request.duration'"],"measures":["p95(value)"],"bucket":"auto"},"unit":"s"}]} Observed-resource SQL example. \{"name":"Observed resources","panels":[\{"id":"resources","title":"Span resources observed in this window","viz":"table","sql":"SELECT namespace,service,resource['service.version']::VARCHAR AS version,first_seen,last_seen FROM resource_inventory WHERE signal='spans' AND $__window(first_seen) ORDER BY namespace,service,version,first_seen,last_seen"}]} +**Create dashboard** — Create a dashboard for the authenticated user from a complete spec. Read get_telemetry_schema first and preview_panels until every non-text panel returns data. Empty or failing panels are rejected with their path, title and diagnosis. Successful saves return a receipt for that committed version: base_version, version, changes, layout_changed, dashboard_fields and save_check. Changes describe authored panel fields and position_changed; physical packing is only layout_changed. Order chips mark the minimal moved set. save_check reports checked, reason when unchecked, total elapsed_ms and one status/rows result per saved panel with elapsed_ms when executed. checked means every panel was executed, not that error or empty panels are healthy. Text rows identify nonempty content, not telemetry. Use the structured receipt rather than prose warnings as check evidence. Create receipts list added panels without layout or dashboard edit chips. No-op saves still create a new version with no change chips. Per-panel elapsed_ms is omitted when the panel did not run. A dashboard is \{name, description, time:\{range}, variables, panels}. Each panel: \{id (lowercase), title, viz, width 1-12, query or sql}. viz: stat or gauge (one measure; gauge needs min and max), timeseries (bucket auto, at most one by), bar (one or two by), table (up to three by), text (content in Markdown), heatmap (bucket auto, no by), histogram (at most one by), scatter (exactly two measures in x then y order, one item dimension and an optional colour dimension), state_timeline (one measure, one item dimension, bucket auto and thresholds required). Rollup panel types are service_map (dependency graph) and health (overview metrics, error trend and health distribution). They require query.from=spans, no measures, by, bucket or sort, and only namespace/service equality filters with a literal or single-value variable; explicit casts and values with surrounding whitespace are rejected. Reads default to 400 services/edges and are capped at 400 even when query.limit is larger. Service scope applies before the limit; map nodes carry p95_ms and edges carry average_ms; error_rate is percent. Row panel types are logs, log_patterns and traces. Logs and traces take no measures, by or bucket. Patterns use count() by body_template. Patterns group only by body_template. Severity is the most frequent severity, ties choose the higher severity. Service is the most frequent service, ties choose ascending service name. Both describe the scoped, redacted events, not extra grouping dimensions. Each pattern returns dominant severity, top service, count and a dense trend, computed in the same bounded query after redaction and scoped filters. Redaction applies before filtering, grouping, display and drill-down. Row panels cannot use SQL. "erroring" means slowest erroring traces: filter to erroring traces, then rank by root duration. Trace candidate ranking is approximate when filters exclude the root span, as with exemplars. Categorical charts use fixed-order colour slots. Categorical options.top defaults to 6, maximum 6. Structured panels: the server computes Other; series are chosen worst-first by confidence (Wilson lower bound for error rates; at least 20 samples for latency); the rest fold into Other (N). Count, rate, sum and share rank largest first. Error rates require at least 20 requests for eligible Wilson ranking (z=1.96). Percentiles, quantile, avg, max and min require at least 20 non-null numeric samples for eligible value ranking and use better (explicit or inferred). Ineligible series follow eligible ones by sample count descending. Ties use sample count descending, then name ascending. SQL panels: series past six are left out, with a note. state_timeline defaults to 8 rows, maximum 20; other noncategorical panels use the same limits. Scatter supports options.x_scale and options.y_scale (log or linear), with distinct x_unit for x and unit for y, each inferred independently when omitted. Rows returned use the count unit. State timelines preserve null and absent buckets as unknown and keep the top items without merging them into Other. Scatter requires a structured query. SQL state_timeline requires timestamp time, a string item, one numeric measure and optional string state; its interval is one minute and thresholds are required. Items rank by volume (row count) for top N. Previous-period comparison is not drawn for scatter or state_timeline. Distribution panels use a structured query with one count() measure and histogram: \{field: duration_ms, buckets: log2} for spans or \{field: value, buckets: explicit} for metrics. Negative span durations clamp to [0,1); +Inf goes to overflow; NaN is excluded because it is not a measurement. Metric histograms use stored temporality and shared per-series increases; resets contribute current counts. Delta histograms sum observation weights. query: \{from: spans|logs|metrics, where: [filter expressions], measures: [fn(field) as alias], by: [fields], bucket, sort, limit}. Measures: count(), rate() per second, error_rate() percent, share() percent, avg/min/max/sum(field), last(value) for metrics, p50/p75/p90/p95/p99(field), quantile(field, 0.999), count_distinct(field). Fields are columns from get_telemetry_schema or attributes['key'] / resource['key'] with the key written literally. Filters are SQL boolean expressions: service = $service, kind = 'SPAN_KIND_SERVER', status = 'STATUS_CODE_ERROR', http_route IN $routes, attributes['http.response.status_code']::INTEGER >= 500. Variables: \{name, kind: query|custom|constant|text, from, field, default, include_all}; $__all selects All and removes filters that use the variable. sql: one SELECT over spans, logs, metrics, service_rollup, edge_rollup or resource_inventory that filters time with $__window(column). Use values exactly as get_telemetry_schema lists them. Example panel: \{"id":"latency","title":"Checkout latency","viz":"timeseries","width":8,"query":\{"from":"spans","where":["service = 'checkout'","kind = 'SPAN_KIND_SERVER'"],"measures":["p50(duration_ms)","p95(duration_ms)","p99(duration_ms)"],"bucket":"auto"},"unit":"ms","thresholds":[\{"value":1500,"status":"bad"}]}. Metrics: gauge/updown | counter | histogram. count(): points; count_distinct(): distinct. rate(): undefined | series increase/elapsed summed | count rate summed. sum(value): series means summed | increases | sum increases. avg(value): mean series means | undefined | sum/count increases. Gauge/updown sum/avg carry earlier points within 5m. Deltas spread across covered buckets; rate alone carries within 5m. rate() is per-second increase over covered elapsed time; auto >=1m. min/max: points | points | undefined. last(value): latest strictly before bucket/window end, reported within 5m, summed | same | undefined. pNN/quantile: points | undefined | interpolated bucket increases. summary: no value aggregates. Undefined: NULL. Fix name in its own where entry: one literal or single-value variable without All or multi-value; or name in by. Read type/temporality from get_telemetry_schema. Panel SQL also supports resource_inventory: signal, namespace, service, full typed resource, first_seen and last_seen. One row per distinct full resource per signal/namespace/service observed inside the logical panel window; first_seen/last_seen are actual in-window event times. Select signal='spans', 'logs' or 'metrics' and use resource['key'] with literal dotted keys. count(*) counts resource identities per signal, not events or instances. Declare $__window(first_seen). This relation is SQL-only: query.from and variables remain spans|logs|metrics; unscoped SQL cannot read it. state_timeline needs at least one threshold marked warn or bad, rather than only ok. Annotations attach only to timeseries, heatmap and state_timeline panels, scoped by service and namespace filters. drill: logs needs query.from=logs. Drill is not available on metrics. Every table format's field must exist in the returned frame; formatting cannot reference an absent column. A structured-table sparkline field must be a measure alias from that table's query. service_link needs variable to name the query or custom variable selected by the link. highlight applies to logs and log_patterns, at most 200 characters. split: deploy needs a service equality filter, as a literal or a single-value variable; other filters are allowed. When the service is All, a split: deploy panel shows the plain bar with a note explaining the missing service scope. Use service_map for dependency context, health for service health; neither proves causality. Example 1: Reference shapes; use only the types the question needs. \{"name":"Investigation shapes","annotations":\{"deploys":true,"anomalies":true},"variables":[\{"name":"service","kind":"query","from":"spans","field":"service"}],"panels":[\{"id":"latency_heat","title":"Latency over time","viz":"heatmap","query":\{"from":"spans","where":["service = $service"],"measures":["count()"],"bucket":"auto","histogram":\{"field":"duration_ms","buckets":"log2"}},"drill":"traces"},\{"id":"latency_hist","title":"Latency by operation","viz":"histogram","query":\{"from":"spans","where":["service = $service"],"measures":["count()"],"by":["operation"],"histogram":\{"field":"duration_ms","buckets":"log2"}},"drill":"traces"},\{"id":"items","title":"Calls versus tail latency","viz":"scatter","query":\{"from":"spans","where":["service = $service"],"measures":["count() as rows","p95(duration_ms) as tail_latency"],"by":["operation"]},"drill":"traces"},\{"id":"states","title":"Error states","viz":"state_timeline","query":\{"from":"spans","where":["service = $service"],"measures":["error_rate()"],"by":["operation"],"bucket":"auto"},"thresholds":[\{"value":5,"status":"bad"}],"drill":"traces"},\{"id":"log_rows","title":"Recent logs","viz":"logs","query":\{"from":"logs","where":["service = $service"],"sort":"time","limit":100},"drill":"logs"},\{"id":"patterns","title":"Repeated log patterns","viz":"log_patterns","query":\{"from":"logs","where":["service = $service"],"measures":["count()"],"by":["body_template"],"bucket":"auto","limit":50},"drill":"logs"},\{"id":"trace_rows","title":"Slow traces","viz":"traces","query":\{"from":"spans","where":["service = $service"],"sort":"duration_ms","limit":20},"drill":"traces"},\{"id":"map","title":"Service calls","viz":"service_map","query":\{"from":"spans"}},\{"id":"health","title":"Service health","viz":"health","query":\{"from":"spans"}}]} Example 2: Reference shapes; use only the types the question needs. \{"name":"Interaction shapes","variables":[\{"name":"service","kind":"query","from":"spans","field":"service"}],"panels":[\{"id":"hist","title":"Metric distribution","viz":"histogram","query":\{"from":"metrics","where":["service = $service"],"measures":["count()"],"histogram":\{"field":"value","buckets":"explicit"}}},\{"id":"table","title":"Service calls and trends","viz":"table","query":\{"from":"spans","measures":["count() as calls"],"by":["service"]},"options":\{"columns":[\{"field":"service","format":"service_link","variable":"service"},\{"field":"calls","format":"sparkline"}]}},\{"id":"prior","title":"Service calls one day earlier","viz":"bar","query":\{"from":"spans","measures":["count()"],"by":["service"]},"click":\{"set_variable":"service"},"time":\{"shift":"1d"}}]} Metric examples; use when the discovered type fits. \{"name":"Metric measures","panels":[\{"id":"network","title":"Network bytes per second","viz":"timeseries","query":\{"from":"metrics","where":["name = 'system.network.io'"],"measures":["rate()"],"by":["attributes['direction']"],"bucket":"auto"}},\{"id":"duration","title":"Request duration p95","viz":"timeseries","query":\{"from":"metrics","where":["name = 'http.server.request.duration'"],"measures":["p95(value)"],"bucket":"auto"},"unit":"s"}]} Observed-resource SQL example. \{"name":"Observed resources","panels":[\{"id":"resources","title":"Span resources observed in this window","viz":"table","sql":"SELECT namespace,service,resource['service.version']::VARCHAR AS version,first_seen,last_seen FROM resource_inventory WHERE signal='spans' AND $__window(first_seen) ORDER BY namespace,service,version,first_seen,last_seen"}]} **Additive.** It creates something new and alters nothing that exists. @@ -71,7 +71,7 @@ AG-UI `mcp-app` activity content uses exactly `resource_uri`, `tool_name`, ## edit_dashboard -**Edit dashboard** — Change a dashboard with typed operations, applied in order and saved as one version: add_panel, update_panel (set replaces the named fields), remove_panel, move_panel, set_variable, remove_variable, set_time, rename. Panels not named are left unchanged. Only edit when the user asks to change that dashboard. Successful saves return a receipt for that committed version: base_version, version, changes, layout_changed, dashboard_fields and save_check. Changes describe authored panel fields and position_changed; physical packing is only layout_changed. Order chips mark the minimal moved set. save_check reports checked, reason when unchecked, total elapsed_ms and one status/rows result per saved panel with elapsed_ms when executed. checked means every panel was executed, not that error or empty panels are healthy. Text rows identify nonempty content, not telemetry. Use the structured receipt rather than prose warnings as check evidence. Create receipts list added panels without layout or dashboard edit chips. No-op saves still create a new version with no change chips. Per-panel elapsed_ms is omitted when the panel did not run. See create_dashboard for the spec guide. +**Edit dashboard** — Every non-text panel must return data in the preview or the save is rejected. Change a dashboard with typed operations, applied in order and saved as one version: add_panel, update_panel (set replaces the named fields), remove_panel, move_panel, set_variable, remove_variable, set_time, rename. Panels not named are left unchanged. Only edit when the user asks to change that dashboard. Successful saves return a receipt for that committed version: base_version, version, changes, layout_changed, dashboard_fields and save_check. Changes describe authored panel fields and position_changed; physical packing is only layout_changed. Order chips mark the minimal moved set. save_check reports checked, reason when unchecked, total elapsed_ms and one status/rows result per saved panel with elapsed_ms when executed. checked means every panel was executed, not that error or empty panels are healthy. Text rows identify nonempty content, not telemetry. Use the structured receipt rather than prose warnings as check evidence. Create receipts list added panels without layout or dashboard edit chips. No-op saves still create a new version with no change chips. Per-panel elapsed_ms is omitted when the panel did not run. See create_dashboard for the spec guide. **Replaces existing state.** @@ -102,7 +102,7 @@ Takes no arguments. ## get_observability_overview -**System health overview** — Summarize service health for a bounded telemetry window. Start here for incident triage. +**System health overview** — Summarize service health for a bounded telemetry window. Start here for incident triage. All-empty results return no_data guidance instead of a view. State no matching data findings in the answer and prefer signals the service actually has. Read-only. @@ -133,7 +133,7 @@ Read-only. ## get_service_performance -**Service performance explorer** — Display separate latency, error rate and request rate panels plus a Slow operations table showing p95 duration grouped by operation over server and consumer spans, covering HTTP, gRPC and message consumers, for one service or the system. +**Service performance explorer** — Display separate latency, error rate and request rate panels plus a Slow operations table showing p95 duration grouped by operation over server and consumer spans, covering HTTP, gRPC and message consumers, for one service or the system. All-empty results return no_data guidance instead of a view. State no matching data findings in the answer and prefer signals the service actually has. Read-only. @@ -150,7 +150,7 @@ Read-only. ## get_service_topology -**Service dependency topology** — Return services and observed dependency edges with health, traffic, latency, and error data. +**Service dependency topology** — Return services and observed dependency edges with health, traffic, latency, and error data. All-empty results return no_data guidance instead of a view. State no matching data findings in the answer and prefer signals the service actually has. Read-only. @@ -177,7 +177,7 @@ Read-only. ## inspect_trace -**Trace detail** — Inspect an exact trace, or select the most relevant recent error or slow trace, with spans, waterfall, flame graph, and correlated logs. +**Trace detail** — Inspect an exact trace, or select the most relevant recent error or slow trace, with spans, waterfall, flame graph, and correlated logs. All-empty results return no_data guidance instead of a view. State no matching data findings in the answer and prefer signals the service actually has. Read-only. @@ -233,7 +233,7 @@ Read-only. ## preview_panels -**Preview panels** — Check and run panels without saving them. Each panel reports ok with rows and a sample, empty with the reason, error, or invalid with the exact field and a suggestion. The result includes total elapsed_ms and executed per-panel elapsed_ms; invalid and not_run panels omit elapsed_ms because they were not executed. Fix every invalid panel and replace or explain every empty one before saving. Spec guide: see create_dashboard. +**Preview panels** — Check and run panels without saving them. Each panel reports ok with rows and a sample, empty with the reason, error, or invalid with the exact field and a suggestion. The result includes total elapsed_ms and executed per-panel elapsed_ms; invalid and not_run panels omit elapsed_ms because they were not executed. Fix every invalid panel and replace or drop every empty one before saving. Spec guide: see create_dashboard. Read-only. @@ -246,7 +246,7 @@ Read-only. ## query_panel_fragment -**Refresh telemetry panels** — Run every panel in a dashboard fragment; panel subsets are forbidden. +**Refresh telemetry panels** — Run every panel in a dashboard fragment; panel subsets are forbidden. All-empty results return no_data guidance instead of a view. State no matching data findings in the answer and prefer signals the service actually has. Read-only. @@ -262,7 +262,7 @@ Read-only. ## query_telemetry -**Telemetry panel** — Display one v1 panel in chat as an executable dashboard fragment. Use get_telemetry_schema to discover fields; see create_dashboard for the spec guide. The authored spec plus vars must fit 128 KiB (131072 serialized JSON bytes); larger inputs are rejected with their actual size. +**Telemetry panel** — Display one v1 panel in chat as an executable dashboard fragment. Use get_telemetry_schema to discover fields; see create_dashboard for the spec guide. The authored spec plus vars must fit 128 KiB (131072 serialized JSON bytes); larger inputs are rejected with their actual size. All-empty results return no_data guidance instead of a view. State no matching data findings in the answer and prefer signals the service actually has. Read-only. @@ -277,7 +277,7 @@ Read-only. ## replace_dashboard -**Replace dashboard** — Replace a dashboard's whole spec; omitted panels are removed. Use only for a redesign the user asked for; use edit_dashboard to change a few panels. Successful saves return a receipt for that committed version: base_version, version, changes, layout_changed, dashboard_fields and save_check. Changes describe authored panel fields and position_changed; physical packing is only layout_changed. Order chips mark the minimal moved set. save_check reports checked, reason when unchecked, total elapsed_ms and one status/rows result per saved panel with elapsed_ms when executed. checked means every panel was executed, not that error or empty panels are healthy. Text rows identify nonempty content, not telemetry. Use the structured receipt rather than prose warnings as check evidence. Create receipts list added panels without layout or dashboard edit chips. No-op saves still create a new version with no change chips. Per-panel elapsed_ms is omitted when the panel did not run. See create_dashboard for the spec guide. +**Replace dashboard** — Every non-text panel must return data in the preview or the save is rejected. Replace a dashboard's whole spec; omitted panels are removed. Use only for a redesign the user asked for; use edit_dashboard to change a few panels. Successful saves return a receipt for that committed version: base_version, version, changes, layout_changed, dashboard_fields and save_check. Changes describe authored panel fields and position_changed; physical packing is only layout_changed. Order chips mark the minimal moved set. save_check reports checked, reason when unchecked, total elapsed_ms and one status/rows result per saved panel with elapsed_ms when executed. checked means every panel was executed, not that error or empty panels are healthy. Text rows identify nonempty content, not telemetry. Use the structured receipt rather than prose warnings as check evidence. Create receipts list added panels without layout or dashboard edit chips. No-op saves still create a new version with no change chips. Per-panel elapsed_ms is omitted when the panel did not run. See create_dashboard for the spec guide. **Replaces existing state.** @@ -315,7 +315,7 @@ Read-only. ## search_logs -**Log explorer** — Search and filter logs with a severity timeline and links back to correlated traces. +**Log explorer** — Search and filter logs with a severity timeline and links back to correlated traces. All-empty results return no_data guidance instead of a view. State no matching data findings in the answer and prefer signals the service actually has. Read-only. diff --git a/ui/host/e2e/landing-recordings.spec.ts b/ui/host/e2e/landing-recordings.spec.ts index a912195e4..31784dc47 100644 --- a/ui/host/e2e/landing-recordings.spec.ts +++ b/ui/host/e2e/landing-recordings.spec.ts @@ -3,7 +3,7 @@ import { mkdir, writeFile } from "node:fs/promises"; import { fileURLToPath } from "node:url"; import { cardSelector, readyCard, settle } from "./accessibility-support"; import { recordingTimeline, revealRecording } from "./landing-recording-support"; -import type { DashboardSpec } from "../../panels/types"; +import type { DashboardSpec, PanelResult } from "../../panels/types"; const baseURL = process.env.FANOUT_LANDING_BASE_URL; const directory = fileURLToPath(new URL("../test-results/landing-recordings/", import.meta.url)); @@ -22,7 +22,7 @@ test.use({ const prompts = { chat: "Why is checkout slower in the last hour?", - dashboard: "Build a dashboard for checkout: request rate, error rate, p95 latency, and its slowest dependencies", + dashboard: "Build a dashboard for checkout: request rate, error rate, p95 latency by operation, its slowest dependencies, and recent slow traces", }; for (const view of ["chat", "dashboard"] as const) { @@ -97,7 +97,19 @@ for (const view of ["chat", "dashboard"] as const) { const response = await responseReady; const responseAt = (Date.now() - startedAt) / 1000; expect(response.ok(), "Agent request failed; check chat configuration and the session's agent:run capability").toBe(true); - const timeline = recordingTimeline(await response.text(), responseAt); + const stream = await response.text(); + const timeline = recordingTimeline(stream, responseAt); + // Check every evidence view, including collapsed views without a mounted iframe. + const evidence = stream.split(/\r?\n/).filter(line => line.startsWith("data:")).map(line => JSON.parse(line.slice(5)) as { + type: string; messageId?: string; activityType?: string; + content?: { tool_result?: { view: { key: string }; results: PanelResult[] } }; + }).filter(event => event.type === "ACTIVITY_SNAPSHOT" && event.activityType === "mcp-app") + .map(event => event.content!.tool_result!); + expect(new Set(evidence.map(fragment => fragment.view.key)).size, "Chat must show at least four evidence views").toBeGreaterThanOrEqual(4); + for (const fragment of evidence) { + expect(fragment.results.some(result => result.status === "ok" && (result.frame?.rows ?? 0) > 0), + "Chat must not contain an empty evidence view").toBe(true); + } // RUN_FINISHED in the real stream plus the UI's idle state gates the reveal. await expect(page.getByRole("button", { name: "Stop", exact: true })).toHaveCount(0); await expect(page.locator(".chat-pane .mantine-Loader-root")).toHaveCount(0); @@ -118,7 +130,17 @@ for (const view of ["chat", "dashboard"] as const) { const saved = await context.request.get(`/api/dashboards/${encodeURIComponent(timeline.dashboardId)}`); expect(saved.ok()).toBe(true); const { spec } = await saved.json() as { spec: DashboardSpec }; - expect(spec.panels.length, "The created dashboard must contain panels").toBeGreaterThan(0); + expect(spec.panels.length, "The created dashboard must contain at least six panels").toBeGreaterThanOrEqual(6); + const preview = await context.request.post("/api/panels/query", { + headers: { "Fanout-Request": "1" }, data: { dashboard: spec }, + }); + expect(preview.ok()).toBe(true); + const { results } = await preview.json() as { results: PanelResult[] }; + for (const panel of spec.panels.filter(panel => panel.viz !== "text")) { + const result = results.find(result => result.id === panel.id); + expect(result?.status, `${panel.title} must return data`).toBe("ok"); + expect(result?.frame?.rows ?? 0, `${panel.title} must have rows`).toBeGreaterThan(0); + } for (const panel of spec.panels) await readyCard(page, panel); await page.evaluate(() => window.scrollTo(0, 0)); // Lazy panels returning to the first fold must be settled too. diff --git a/ui/host/src/chat.test.tsx b/ui/host/src/chat.test.tsx index 6f4b8393f..a1a409b07 100644 --- a/ui/host/src/chat.test.tsx +++ b/ui/host/src/chat.test.tsx @@ -403,16 +403,6 @@ it.each(["mixed", "presets", "custom"])("expands requested presets over discover } finally { await act(async () => root.unmount()); } } }); -it("keeps all-empty views collapsed and opens the turn's last view with data", async () => { - const empty = appMessage("two", "query_telemetry", "No matches") as Message & { content: { tool_result: ReturnType } }; - for (const result of empty.content.tool_result.results) result.status = "empty"; - const root = await mount(value({ messages: [appMessage("one", "query_telemetry", "Data"), empty] })); - try { - const toggles = [...document.querySelectorAll('button[aria-expanded]')]; - expect(toggles.map(toggle => toggle.getAttribute("aria-expanded"))).toEqual(["true", "false"]); - expect(toggles[1].textContent).toContain("empty"); - } finally { await act(async () => root.unmount()); } -}); it("renders the latest server view snapshot without a host preset-winner rule", async () => { const preset = appMessage("one", "get_service_topology", "Requested"); const custom = structuredClone(preset) as Message & { content: Record }; custom.id = "two"; custom.content.tool_name = "query_telemetry"; (custom.content.tool_result as ReturnType).view.kind="query"; diff --git a/ui/host/src/chat.tsx b/ui/host/src/chat.tsx index 6efefe8d1..78f3cb05c 100644 --- a/ui/host/src/chat.tsx +++ b/ui/host/src/chat.tsx @@ -18,9 +18,6 @@ import { DashboardReceiptView } from "./dashboard-receipt-view"; const MCPAppFrame = lazy(() => import("./mcp-app-frame")); const isPreset = (content: MCPAppContent) => content.tool_result.view.kind === "preset"; -// An all-empty view has nothing to show beyond its summary row, so it never -// opens by default; the turn's last view with data opens instead. -const isEmpty = (content: MCPAppContent) => content.tool_result.results.length > 0 && content.tool_result.results.every(result => result.status === "empty"); type AppView = { content: MCPAppContent; expanded: boolean }; function chatAppViews(messages: Message[]) { const views = new Map(), duplicates = new Set(); @@ -33,10 +30,10 @@ function chatAppViews(messages: Message[]) { } const chosen = new Set([...winners.values()].map(item => item.id)); const hasPreset = [...winners.values()].some(item => isPreset(item.content)); - const last = turn.filter(item => chosen.has(item.id) && !isEmpty(item.content)).at(-1)?.id; + const last = turn.filter(item => chosen.has(item.id)).at(-1)?.id; for (const item of turn) { if (!chosen.has(item.id)) duplicates.add(item.id); - else views.set(item.id, { content: item.content, expanded: !isEmpty(item.content) && (isPreset(item.content) || !hasPreset && item.id === last) }); + else views.set(item.id, { content: item.content, expanded: isPreset(item.content) || !hasPreset && item.id === last }); } turn = []; };